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.
pull/3/head
Daniel Richard G 2013-12-02 01:25:09 -05:00
parent f9f321ca84
commit 1bc73c4a75
8 changed files with 46 additions and 53 deletions

View File

@ -520,11 +520,11 @@ void Entity::DrawOrGetDistance(void) {
// dimmer for the ones at the model origin.
int f = (i == 0 ? 100 : 255);
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) {
ssglColorRGB(RGB(f, 0, 0));
ssglColorRGB(RGBi(f, 0, 0));
} else if(hr.v == Request::HREQUEST_REFERENCE_ZX.v) {
ssglColorRGB(RGB(0, f, 0));
ssglColorRGB(RGBi(0, f, 0));
} else {
ssglColorRGB(Style::Color(Style::NORMALS));
if(i > 0) break;

View File

@ -395,8 +395,7 @@ public:
void Solve(void);
};
#undef RGB
#define RGB(r, g, b) RgbColor::From((r), (g), (b))
#define RGBi(r, g, b) RgbColor::From((r), (g), (b))
#define RGBf(r, g, b) RgbColor::FromFloat((float)(r), (float)(g), (float)(b))
#define NULL_COLOR RgbColor::Default()

View File

@ -371,13 +371,13 @@ void ssglDebugPolygon(SPolygon *p)
Vector a = (sc->l.elem[j]).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);
glBegin(GL_LINES);
ssglVertex3v(a.Plus(d));
ssglVertex3v(b.Minus(d));
glEnd();
ssglLockColorTo(RGB(255, 0, 0));
ssglLockColorTo(RGBi(255, 0, 0));
glBegin(GL_POINTS);
ssglVertex3v(a.Plus(d));
ssglVertex3v(b.Minus(d));
@ -415,7 +415,7 @@ void ssglDebugMesh(SMesh *m)
ssglDepthRangeOffset(1);
ssglUnlockColor();
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
ssglColorRGBa(RGB(0, 255, 0), 1.0);
ssglColorRGBa(RGBi(0, 255, 0), 1.0);
glBegin(GL_TRIANGLES);
for(i = 0; i < m->l.n; i++) {
STriangle *t = &(m->l.elem[i]);

View File

@ -55,7 +55,7 @@ void Group::MenuGroup(int id) {
Group g;
ZERO(&g);
g.visible = true;
g.color = RGB(100, 100, 100);
g.color = RGBi(100, 100, 100);
g.scale = 1;
if(id >= RECENT_IMPORT && id < (RECENT_IMPORT + MAX_RECENT)) {

View File

@ -15,14 +15,14 @@ void SolveSpace::Init(char *cmdLine) {
// Then, load the registry settings.
int i;
// Default list of colors for the model material
modelColor[0] = CnfThawColor(RGB(150, 150, 150), "ModelColor_0");
modelColor[1] = CnfThawColor(RGB(100, 100, 100), "ModelColor_1");
modelColor[2] = CnfThawColor(RGB( 30, 30, 30), "ModelColor_2");
modelColor[3] = CnfThawColor(RGB(150, 0, 0), "ModelColor_3");
modelColor[4] = CnfThawColor(RGB( 0, 100, 0), "ModelColor_4");
modelColor[5] = CnfThawColor(RGB( 0, 80, 80), "ModelColor_5");
modelColor[6] = CnfThawColor(RGB( 0, 0, 130), "ModelColor_6");
modelColor[7] = CnfThawColor(RGB( 80, 0, 80), "ModelColor_7");
modelColor[0] = CnfThawColor(RGBi(150, 150, 150), "ModelColor_0");
modelColor[1] = CnfThawColor(RGBi(100, 100, 100), "ModelColor_1");
modelColor[2] = CnfThawColor(RGBi( 30, 30, 30), "ModelColor_2");
modelColor[3] = CnfThawColor(RGBi(150, 0, 0), "ModelColor_3");
modelColor[4] = CnfThawColor(RGBi( 0, 100, 0), "ModelColor_4");
modelColor[5] = CnfThawColor(RGBi( 0, 80, 80), "ModelColor_5");
modelColor[6] = CnfThawColor(RGBi( 0, 0, 130), "ModelColor_6");
modelColor[7] = CnfThawColor(RGBi( 80, 0, 80), "ModelColor_7");
// Light intensities
lightIntensity[0] = CnfThawFloat(1.0f, "LightIntensity_0");
lightIntensity[1] = CnfThawFloat(0.5f, "LightIntensity_1");
@ -62,7 +62,7 @@ void SolveSpace::Init(char *cmdLine) {
// Export pwl curves (instead of exact) always
exportPwlCurves = CnfThawBool(false, "ExportPwlCurves");
// 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
exportCanvasSizeAuto = CnfThawBool(true, "ExportCanvasSizeAuto");
// Margins for automatic canvas size

View File

@ -113,7 +113,7 @@ void Style::LoadFactoryDefaults(void) {
s->fillColor = RGBf(0.3, 0.3, 0.3);
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);
SS.bgImage.fromFile = NULL;
}
@ -218,7 +218,7 @@ RgbColor Style::RewriteColor(RgbColor rgbin) {
// good for the default on-screen view (black bg) but probably
// not desired in the exported files, which typically are shown
// against white backgrounds.
return RGB(0, 0, 0);
return RGBi(0, 0, 0);
} else {
return rgbin;
}

View File

@ -7,24 +7,24 @@
#include <icons-proto.h>
const TextWindow::Color TextWindow::fgColors[] = {
{ 'd', RGB(255, 255, 255) },
{ 'l', RGB(100, 100, 255) },
{ 't', RGB(255, 200, 0) },
{ 'h', RGB( 90, 90, 90) },
{ 's', RGB( 40, 255, 40) },
{ 'm', RGB(200, 200, 0) },
{ 'r', RGB( 0, 0, 0) },
{ 'x', RGB(255, 20, 20) },
{ 'i', RGB( 0, 255, 255) },
{ 'g', RGB(160, 160, 160) },
{ 'b', RGB(200, 200, 200) },
{ 'd', RGBi(255, 255, 255) },
{ 'l', RGBi(100, 100, 255) },
{ 't', RGBi(255, 200, 0) },
{ 'h', RGBi( 90, 90, 90) },
{ 's', RGBi( 40, 255, 40) },
{ 'm', RGBi(200, 200, 0) },
{ 'r', RGBi( 0, 0, 0) },
{ 'x', RGBi(255, 20, 20) },
{ 'i', RGBi( 0, 255, 255) },
{ 'g', RGBi(160, 160, 160) },
{ 'b', RGBi(200, 200, 200) },
{ 0, NULL_COLOR }
};
const TextWindow::Color TextWindow::bgColors[] = {
{ 'd', RGB( 0, 0, 0) },
{ 't', RGB( 34, 15, 15) },
{ 'a', RGB( 25, 25, 25) },
{ 'r', RGB(255, 255, 255) },
{ 'd', RGBi( 0, 0, 0) },
{ 't', RGBi( 34, 15, 15) },
{ 'a', RGBi( 25, 25, 25) },
{ 'r', RGBi(255, 255, 255) },
{ 0, NULL_COLOR }
};
@ -558,20 +558,20 @@ bool TextWindow::DrawOrHitTestColorPicker(int how, bool leftDown,
if(how == CLICK || (how == HOVER && leftDown)) InvalidateText();
static const RgbColor BaseColor[12] = {
RGB(255, 0, 0),
RGB( 0, 255, 0),
RGB( 0, 0, 255),
RGBi(255, 0, 0),
RGBi( 0, 255, 0),
RGBi( 0, 0, 255),
RGB( 0, 255, 255),
RGB(255, 0, 255),
RGB(255, 255, 0),
RGBi( 0, 255, 255),
RGBi(255, 0, 255),
RGBi(255, 255, 0),
RGB(255, 127, 0),
RGB(255, 0, 127),
RGB( 0, 255, 127),
RGB(127, 255, 0),
RGB(127, 0, 255),
RGB( 0, 127, 255),
RGBi(255, 127, 0),
RGBi(255, 0, 127),
RGBi( 0, 255, 127),
RGBi(127, 255, 0),
RGBi(127, 0, 255),
RGBi( 0, 127, 255),
};
int width, height;

View File

@ -8,12 +8,6 @@
#include "solvespace.h"
#include <time.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 <commdlg.h>