Fix broken colors in file import/export.
The move to RgbColor() missed the code that reads and writes Style.color and Group.color. Also clarify redefinition of RGB() in w32main.cpp.pull/3/head
parent
c60e3dd34e
commit
f09ae15586
10
file.cpp
10
file.cpp
|
@ -94,7 +94,7 @@ const SolveSpace::SaveTable SolveSpace::SAVED[] = {
|
||||||
{ 'g', "Group.valA", 'f', &(SS.sv.g.valA) },
|
{ 'g', "Group.valA", 'f', &(SS.sv.g.valA) },
|
||||||
{ 'g', "Group.valB", 'f', &(SS.sv.g.valB) },
|
{ 'g', "Group.valB", 'f', &(SS.sv.g.valB) },
|
||||||
{ 'g', "Group.valC", 'f', &(SS.sv.g.valB) },
|
{ 'g', "Group.valC", 'f', &(SS.sv.g.valB) },
|
||||||
{ 'g', "Group.color", 'x', &(SS.sv.g.color) },
|
{ 'g', "Group.color", 'c', &(SS.sv.g.color) },
|
||||||
{ 'g', "Group.subtype", 'd', &(SS.sv.g.subtype) },
|
{ 'g', "Group.subtype", 'd', &(SS.sv.g.subtype) },
|
||||||
{ 'g', "Group.skipFirst", 'b', &(SS.sv.g.skipFirst) },
|
{ 'g', "Group.skipFirst", 'b', &(SS.sv.g.skipFirst) },
|
||||||
{ 'g', "Group.meshCombine", 'd', &(SS.sv.g.meshCombine) },
|
{ 'g', "Group.meshCombine", 'd', &(SS.sv.g.meshCombine) },
|
||||||
|
@ -192,7 +192,7 @@ const SolveSpace::SaveTable SolveSpace::SAVED[] = {
|
||||||
{ 's', "Style.textHeightAs", 'd', &(SS.sv.s.textHeightAs) },
|
{ 's', "Style.textHeightAs", 'd', &(SS.sv.s.textHeightAs) },
|
||||||
{ 's', "Style.textAngle", 'f', &(SS.sv.s.textAngle) },
|
{ 's', "Style.textAngle", 'f', &(SS.sv.s.textAngle) },
|
||||||
{ 's', "Style.textOrigin", 'x', &(SS.sv.s.textOrigin) },
|
{ 's', "Style.textOrigin", 'x', &(SS.sv.s.textOrigin) },
|
||||||
{ 's', "Style.color", 'x', &(SS.sv.s.color) },
|
{ 's', "Style.color", 'c', &(SS.sv.s.color) },
|
||||||
{ 's', "Style.fillColor", 'x', &(SS.sv.s.fillColor) },
|
{ 's', "Style.fillColor", 'x', &(SS.sv.s.fillColor) },
|
||||||
{ 's', "Style.filled", 'b', &(SS.sv.s.filled) },
|
{ 's', "Style.filled", 'b', &(SS.sv.s.filled) },
|
||||||
{ 's', "Style.visible", 'b', &(SS.sv.s.visible) },
|
{ 's', "Style.visible", 'b', &(SS.sv.s.visible) },
|
||||||
|
@ -221,6 +221,7 @@ void SolveSpace::SaveUsingTable(int type) {
|
||||||
case 'x': fprintf(fh, "%08x", *((uint32_t *)p)); break;
|
case 'x': fprintf(fh, "%08x", *((uint32_t *)p)); break;
|
||||||
case 'f': fprintf(fh, "%.20f", *((double *)p)); break;
|
case 'f': fprintf(fh, "%.20f", *((double *)p)); break;
|
||||||
case 'N': fprintf(fh, "%s", ((NameStr *)p)->str); break;
|
case 'N': fprintf(fh, "%s", ((NameStr *)p)->str); break;
|
||||||
|
case 'c': fprintf(fh, "%08x", ((RgbColor *)p)->ToPackedInt());break;
|
||||||
case 'P': fprintf(fh, "%s", (char *)p); break;
|
case 'P': fprintf(fh, "%s", (char *)p); break;
|
||||||
|
|
||||||
case 'M': {
|
case 'M': {
|
||||||
|
@ -368,6 +369,11 @@ void SolveSpace::LoadUsingTable(char *key, char *val) {
|
||||||
case 'f': *((double *)p) = atof(val); break;
|
case 'f': *((double *)p) = atof(val); break;
|
||||||
case 'N': ((NameStr *)p)->strcpy(val); break;
|
case 'N': ((NameStr *)p)->strcpy(val); break;
|
||||||
|
|
||||||
|
case 'c':
|
||||||
|
sscanf(val, "%x", &u);
|
||||||
|
*((RgbColor *)p) = RgbColor::FromPackedInt(u);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'P':
|
case 'P':
|
||||||
if(strlen(val)+1 < MAX_PATH) strcpy((char *)p, val);
|
if(strlen(val)+1 < MAX_PATH) strcpy((char *)p, val);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -8,8 +8,12 @@
|
||||||
#include "solvespace.h"
|
#include "solvespace.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#undef RGB // our definition clashes with Microsoft's
|
// we define RGB() to return our RgbColor, but that conflicts with Win32's
|
||||||
#define RGB(r, g, b) ((COLORREF)0)
|
// 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