Renamed the RGB() macro to RGBi() to avoid collisions with Microsoft
Microsoft defines an RGB() macro that at one point was compatible with our version (returning a packed integer containing 8-bit red, green and blue channels), but is no longer, and the incompatibility led to an awkward situation in w32main.cpp where we had to restore Microsoft's form of the macro in order for the commctrl.h header to compile. By renaming the macro to RGBi()---analogous to the RGBf() macro we already define---we avoid the hassle entirely.
This commit is contained in:
parent
f9f321ca84
commit
1bc73c4a75
|
@ -520,11 +520,11 @@ void Entity::DrawOrGetDistance(void) {
|
||||||
// dimmer for the ones at the model origin.
|
// dimmer for the ones at the model origin.
|
||||||
int f = (i == 0 ? 100 : 255);
|
int f = (i == 0 ? 100 : 255);
|
||||||
if(hr.v == Request::HREQUEST_REFERENCE_XY.v) {
|
if(hr.v == Request::HREQUEST_REFERENCE_XY.v) {
|
||||||
ssglColorRGB(RGB(0, 0, f));
|
ssglColorRGB(RGBi(0, 0, f));
|
||||||
} else if(hr.v == Request::HREQUEST_REFERENCE_YZ.v) {
|
} else if(hr.v == Request::HREQUEST_REFERENCE_YZ.v) {
|
||||||
ssglColorRGB(RGB(f, 0, 0));
|
ssglColorRGB(RGBi(f, 0, 0));
|
||||||
} else if(hr.v == Request::HREQUEST_REFERENCE_ZX.v) {
|
} else if(hr.v == Request::HREQUEST_REFERENCE_ZX.v) {
|
||||||
ssglColorRGB(RGB(0, f, 0));
|
ssglColorRGB(RGBi(0, f, 0));
|
||||||
} else {
|
} else {
|
||||||
ssglColorRGB(Style::Color(Style::NORMALS));
|
ssglColorRGB(Style::Color(Style::NORMALS));
|
||||||
if(i > 0) break;
|
if(i > 0) break;
|
||||||
|
|
|
@ -395,8 +395,7 @@ public:
|
||||||
void Solve(void);
|
void Solve(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef RGB
|
#define RGBi(r, g, b) RgbColor::From((r), (g), (b))
|
||||||
#define RGB(r, g, b) RgbColor::From((r), (g), (b))
|
|
||||||
#define RGBf(r, g, b) RgbColor::FromFloat((float)(r), (float)(g), (float)(b))
|
#define RGBf(r, g, b) RgbColor::FromFloat((float)(r), (float)(g), (float)(b))
|
||||||
#define NULL_COLOR RgbColor::Default()
|
#define NULL_COLOR RgbColor::Default()
|
||||||
|
|
||||||
|
|
|
@ -371,13 +371,13 @@ void ssglDebugPolygon(SPolygon *p)
|
||||||
Vector a = (sc->l.elem[j]).p;
|
Vector a = (sc->l.elem[j]).p;
|
||||||
Vector b = (sc->l.elem[j+1]).p;
|
Vector b = (sc->l.elem[j+1]).p;
|
||||||
|
|
||||||
ssglLockColorTo(RGB(0, 0, 255));
|
ssglLockColorTo(RGBi(0, 0, 255));
|
||||||
Vector d = (a.Minus(b)).WithMagnitude(-0);
|
Vector d = (a.Minus(b)).WithMagnitude(-0);
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
ssglVertex3v(a.Plus(d));
|
ssglVertex3v(a.Plus(d));
|
||||||
ssglVertex3v(b.Minus(d));
|
ssglVertex3v(b.Minus(d));
|
||||||
glEnd();
|
glEnd();
|
||||||
ssglLockColorTo(RGB(255, 0, 0));
|
ssglLockColorTo(RGBi(255, 0, 0));
|
||||||
glBegin(GL_POINTS);
|
glBegin(GL_POINTS);
|
||||||
ssglVertex3v(a.Plus(d));
|
ssglVertex3v(a.Plus(d));
|
||||||
ssglVertex3v(b.Minus(d));
|
ssglVertex3v(b.Minus(d));
|
||||||
|
@ -415,7 +415,7 @@ void ssglDebugMesh(SMesh *m)
|
||||||
ssglDepthRangeOffset(1);
|
ssglDepthRangeOffset(1);
|
||||||
ssglUnlockColor();
|
ssglUnlockColor();
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||||
ssglColorRGBa(RGB(0, 255, 0), 1.0);
|
ssglColorRGBa(RGBi(0, 255, 0), 1.0);
|
||||||
glBegin(GL_TRIANGLES);
|
glBegin(GL_TRIANGLES);
|
||||||
for(i = 0; i < m->l.n; i++) {
|
for(i = 0; i < m->l.n; i++) {
|
||||||
STriangle *t = &(m->l.elem[i]);
|
STriangle *t = &(m->l.elem[i]);
|
||||||
|
|
|
@ -55,7 +55,7 @@ void Group::MenuGroup(int id) {
|
||||||
Group g;
|
Group g;
|
||||||
ZERO(&g);
|
ZERO(&g);
|
||||||
g.visible = true;
|
g.visible = true;
|
||||||
g.color = RGB(100, 100, 100);
|
g.color = RGBi(100, 100, 100);
|
||||||
g.scale = 1;
|
g.scale = 1;
|
||||||
|
|
||||||
if(id >= RECENT_IMPORT && id < (RECENT_IMPORT + MAX_RECENT)) {
|
if(id >= RECENT_IMPORT && id < (RECENT_IMPORT + MAX_RECENT)) {
|
||||||
|
|
|
@ -15,14 +15,14 @@ void SolveSpace::Init(char *cmdLine) {
|
||||||
// Then, load the registry settings.
|
// Then, load the registry settings.
|
||||||
int i;
|
int i;
|
||||||
// Default list of colors for the model material
|
// Default list of colors for the model material
|
||||||
modelColor[0] = CnfThawColor(RGB(150, 150, 150), "ModelColor_0");
|
modelColor[0] = CnfThawColor(RGBi(150, 150, 150), "ModelColor_0");
|
||||||
modelColor[1] = CnfThawColor(RGB(100, 100, 100), "ModelColor_1");
|
modelColor[1] = CnfThawColor(RGBi(100, 100, 100), "ModelColor_1");
|
||||||
modelColor[2] = CnfThawColor(RGB( 30, 30, 30), "ModelColor_2");
|
modelColor[2] = CnfThawColor(RGBi( 30, 30, 30), "ModelColor_2");
|
||||||
modelColor[3] = CnfThawColor(RGB(150, 0, 0), "ModelColor_3");
|
modelColor[3] = CnfThawColor(RGBi(150, 0, 0), "ModelColor_3");
|
||||||
modelColor[4] = CnfThawColor(RGB( 0, 100, 0), "ModelColor_4");
|
modelColor[4] = CnfThawColor(RGBi( 0, 100, 0), "ModelColor_4");
|
||||||
modelColor[5] = CnfThawColor(RGB( 0, 80, 80), "ModelColor_5");
|
modelColor[5] = CnfThawColor(RGBi( 0, 80, 80), "ModelColor_5");
|
||||||
modelColor[6] = CnfThawColor(RGB( 0, 0, 130), "ModelColor_6");
|
modelColor[6] = CnfThawColor(RGBi( 0, 0, 130), "ModelColor_6");
|
||||||
modelColor[7] = CnfThawColor(RGB( 80, 0, 80), "ModelColor_7");
|
modelColor[7] = CnfThawColor(RGBi( 80, 0, 80), "ModelColor_7");
|
||||||
// Light intensities
|
// Light intensities
|
||||||
lightIntensity[0] = CnfThawFloat(1.0f, "LightIntensity_0");
|
lightIntensity[0] = CnfThawFloat(1.0f, "LightIntensity_0");
|
||||||
lightIntensity[1] = CnfThawFloat(0.5f, "LightIntensity_1");
|
lightIntensity[1] = CnfThawFloat(0.5f, "LightIntensity_1");
|
||||||
|
@ -62,7 +62,7 @@ void SolveSpace::Init(char *cmdLine) {
|
||||||
// Export pwl curves (instead of exact) always
|
// Export pwl curves (instead of exact) always
|
||||||
exportPwlCurves = CnfThawBool(false, "ExportPwlCurves");
|
exportPwlCurves = CnfThawBool(false, "ExportPwlCurves");
|
||||||
// Background color on-screen
|
// Background color on-screen
|
||||||
backgroundColor = CnfThawColor(RGB(0, 0, 0), "BackgroundColor");
|
backgroundColor = CnfThawColor(RGBi(0, 0, 0), "BackgroundColor");
|
||||||
// Whether export canvas size is fixed or derived from bbox
|
// Whether export canvas size is fixed or derived from bbox
|
||||||
exportCanvasSizeAuto = CnfThawBool(true, "ExportCanvasSizeAuto");
|
exportCanvasSizeAuto = CnfThawBool(true, "ExportCanvasSizeAuto");
|
||||||
// Margins for automatic canvas size
|
// Margins for automatic canvas size
|
||||||
|
|
|
@ -113,7 +113,7 @@ void Style::LoadFactoryDefaults(void) {
|
||||||
s->fillColor = RGBf(0.3, 0.3, 0.3);
|
s->fillColor = RGBf(0.3, 0.3, 0.3);
|
||||||
s->name.strcpy(CnfPrefixToName(d->cnfPrefix));
|
s->name.strcpy(CnfPrefixToName(d->cnfPrefix));
|
||||||
}
|
}
|
||||||
SS.backgroundColor = RGB(0, 0, 0);
|
SS.backgroundColor = RGBi(0, 0, 0);
|
||||||
if(SS.bgImage.fromFile) MemFree(SS.bgImage.fromFile);
|
if(SS.bgImage.fromFile) MemFree(SS.bgImage.fromFile);
|
||||||
SS.bgImage.fromFile = NULL;
|
SS.bgImage.fromFile = NULL;
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ RgbColor Style::RewriteColor(RgbColor rgbin) {
|
||||||
// good for the default on-screen view (black bg) but probably
|
// good for the default on-screen view (black bg) but probably
|
||||||
// not desired in the exported files, which typically are shown
|
// not desired in the exported files, which typically are shown
|
||||||
// against white backgrounds.
|
// against white backgrounds.
|
||||||
return RGB(0, 0, 0);
|
return RGBi(0, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
return rgbin;
|
return rgbin;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,24 +7,24 @@
|
||||||
#include <icons-proto.h>
|
#include <icons-proto.h>
|
||||||
|
|
||||||
const TextWindow::Color TextWindow::fgColors[] = {
|
const TextWindow::Color TextWindow::fgColors[] = {
|
||||||
{ 'd', RGB(255, 255, 255) },
|
{ 'd', RGBi(255, 255, 255) },
|
||||||
{ 'l', RGB(100, 100, 255) },
|
{ 'l', RGBi(100, 100, 255) },
|
||||||
{ 't', RGB(255, 200, 0) },
|
{ 't', RGBi(255, 200, 0) },
|
||||||
{ 'h', RGB( 90, 90, 90) },
|
{ 'h', RGBi( 90, 90, 90) },
|
||||||
{ 's', RGB( 40, 255, 40) },
|
{ 's', RGBi( 40, 255, 40) },
|
||||||
{ 'm', RGB(200, 200, 0) },
|
{ 'm', RGBi(200, 200, 0) },
|
||||||
{ 'r', RGB( 0, 0, 0) },
|
{ 'r', RGBi( 0, 0, 0) },
|
||||||
{ 'x', RGB(255, 20, 20) },
|
{ 'x', RGBi(255, 20, 20) },
|
||||||
{ 'i', RGB( 0, 255, 255) },
|
{ 'i', RGBi( 0, 255, 255) },
|
||||||
{ 'g', RGB(160, 160, 160) },
|
{ 'g', RGBi(160, 160, 160) },
|
||||||
{ 'b', RGB(200, 200, 200) },
|
{ 'b', RGBi(200, 200, 200) },
|
||||||
{ 0, NULL_COLOR }
|
{ 0, NULL_COLOR }
|
||||||
};
|
};
|
||||||
const TextWindow::Color TextWindow::bgColors[] = {
|
const TextWindow::Color TextWindow::bgColors[] = {
|
||||||
{ 'd', RGB( 0, 0, 0) },
|
{ 'd', RGBi( 0, 0, 0) },
|
||||||
{ 't', RGB( 34, 15, 15) },
|
{ 't', RGBi( 34, 15, 15) },
|
||||||
{ 'a', RGB( 25, 25, 25) },
|
{ 'a', RGBi( 25, 25, 25) },
|
||||||
{ 'r', RGB(255, 255, 255) },
|
{ 'r', RGBi(255, 255, 255) },
|
||||||
{ 0, NULL_COLOR }
|
{ 0, NULL_COLOR }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -558,20 +558,20 @@ bool TextWindow::DrawOrHitTestColorPicker(int how, bool leftDown,
|
||||||
if(how == CLICK || (how == HOVER && leftDown)) InvalidateText();
|
if(how == CLICK || (how == HOVER && leftDown)) InvalidateText();
|
||||||
|
|
||||||
static const RgbColor BaseColor[12] = {
|
static const RgbColor BaseColor[12] = {
|
||||||
RGB(255, 0, 0),
|
RGBi(255, 0, 0),
|
||||||
RGB( 0, 255, 0),
|
RGBi( 0, 255, 0),
|
||||||
RGB( 0, 0, 255),
|
RGBi( 0, 0, 255),
|
||||||
|
|
||||||
RGB( 0, 255, 255),
|
RGBi( 0, 255, 255),
|
||||||
RGB(255, 0, 255),
|
RGBi(255, 0, 255),
|
||||||
RGB(255, 255, 0),
|
RGBi(255, 255, 0),
|
||||||
|
|
||||||
RGB(255, 127, 0),
|
RGBi(255, 127, 0),
|
||||||
RGB(255, 0, 127),
|
RGBi(255, 0, 127),
|
||||||
RGB( 0, 255, 127),
|
RGBi( 0, 255, 127),
|
||||||
RGB(127, 255, 0),
|
RGBi(127, 255, 0),
|
||||||
RGB(127, 0, 255),
|
RGBi(127, 0, 255),
|
||||||
RGB( 0, 127, 255),
|
RGBi( 0, 127, 255),
|
||||||
};
|
};
|
||||||
|
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
|
@ -8,12 +8,6 @@
|
||||||
#include "solvespace.h"
|
#include "solvespace.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
// we define RGB() to return our RgbColor, but that conflicts with Win32's
|
|
||||||
// definition; so put that back like Windows expects
|
|
||||||
#undef RGB
|
|
||||||
#define RGB(r,g,b) \
|
|
||||||
((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16)))
|
|
||||||
|
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <commdlg.h>
|
#include <commdlg.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user