Go to file
Daniel Richard G a5176f4545 Replaced RGB-color integers with dedicated data structure
RGB colors were represented using a uint32_t with the red, green and blue
values stuffed into the lower three octets (i.e. 0x00BBGGRR), like
Microsoft's COLORREF. This approach did not lend itself to type safety,
however, so this change replaces it with an RgbColor class that provides
the same infomation plus a handful of useful methods to work with it. (Note
that sizeof(RgbColor) == sizeof(uint32_t), so this change should not lead
to memory bloat.)

Some of the new methods/fields replace what were previously macro calls;
e.g. RED(c) is now c.red, REDf(c) is now c.redF(). The .Equals() method is
now used instead of == to compare colors.

RGB colors still need to be represented as packed integers in file I/O and
preferences, so the methods .FromPackedInt() and .ToPackedInt() are
provided. Also implemented are Cnf{Freeze,Thaw}Color(), type-safe wrappers
around Cnf{Freeze,Thaw}Int() that facilitate I/O with preferences.

(Cnf{Freeze,Thaw}Color() are defined outside of the system-dependent code
to minimize the footprint of the latter; because the same can be done with
Cnf{Freeze,Thaw}Bool(), those are also moved out of the system code with
this commit.)

Color integers were being OR'ed with 0x80000000 in some places for two
distinct purposes: One, to indicate use of a default color in
glxFillMesh(); this has been replaced by use of the .UseDefault() method.
Two, to indicate to TextWindow::Printf() that the format argument of a
"%Bp"/"%Fp" specifier is an RGB color rather than a color "code" from
TextWindow::bgColors[] or TextWindow::fgColors[] (as the specifier can
accept either); instead, we define a new flag "z" (as in "%Bz" or "%Fz") to
indicate an RGBcolor pointer, leaving "%Bp"/"%Fp" to indicate a color code
exclusively.

(This also allows TextWindow::meta[][].bg to be a char instead of an int,
partly compensating for the new .bgRgb field added immediately after.)

In array declarations, RGB colors could previously be specified as 0 (often
in a terminating element). As that no longer works, we define NULL_COLOR,
which serves much the same purpose for RgbColor variables as NULL serves
for pointers.
2013-10-25 01:49:12 -04:00
exposed Use C99 integer types and C++ boolean types/values 2013-10-02 01:45:13 -04:00
extlib Add support for the 3dconnexion six degree of freedom input devices 2009-07-20 11:05:33 -08:00
icons Add two more icons to the toolbar, for text in a TrueType font and 2010-05-16 09:04:56 -08:00
obj This is my initial checkin for solvespace, a second attempt at 2008-03-25 02:02:13 -08:00
srf Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
tools Use C99 integer types and C++ boolean types/values 2013-10-02 01:45:13 -04:00
win32 Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
COPYING.txt Changes in preparation for the release of SolveSpace under the GPL, 2013-07-28 14:08:34 -08:00
Makefile.msvc Make optional the use of the SpaceNavigator libraries 2013-09-20 15:25:14 -04:00
bitmapextra.table.h Renamed *.table files to *.table.h 2013-09-16 17:14:53 -04:00
bitmapfont.table.h Use C99 integer types and C++ boolean types/values 2013-10-02 01:45:13 -04:00
bsp.cpp Quash "variable may be used uninitialized" warnings 2013-08-26 15:36:00 -04:00
clipboard.cpp Use C99 integer types and C++ boolean types/values 2013-10-02 01:45:13 -04:00
confscreen.cpp Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
constraint.cpp Added const qualifiers 2013-08-26 14:58:35 -04:00
constrainteq.cpp Changes in preparation for the release of SolveSpace under the GPL, 2013-07-28 14:08:34 -08:00
describescreen.cpp Use C99 integer types and C++ boolean types/values 2013-10-02 01:45:13 -04:00
draw.cpp Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
drawconstraint.cpp Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
drawentity.cpp Quash "variable may be used uninitialized" warnings 2013-08-26 15:36:00 -04:00
dsc.h Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
entity.cpp Changes in preparation for the release of SolveSpace under the GPL, 2013-07-28 14:08:34 -08:00
export.cpp Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
exportstep.cpp Changes in preparation for the release of SolveSpace under the GPL, 2013-07-28 14:08:34 -08:00
exportvector.cpp Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
expr.cpp Use C99 integer types and C++ boolean types/values 2013-10-02 01:45:13 -04:00
expr.h Use C99 integer types and C++ boolean types/values 2013-10-02 01:45:13 -04:00
file.cpp Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
font.table.h Renamed *.table files to *.table.h 2013-09-16 17:14:53 -04:00
generate.cpp Use C99 integer types and C++ boolean types/values 2013-10-02 01:45:13 -04:00
glhelper.cpp Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
graphicswin.cpp Use C99 integer types and C++ boolean types/values 2013-10-02 01:45:13 -04:00
group.cpp Miscellaneous adjustments for warnings and code quality 2013-09-19 02:35:56 -04:00
groupmesh.cpp Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
icon.ico Add an icon file (ugly, but at least it's not the default anymore). 2008-07-18 01:50:52 -08:00
mesh.cpp Use C99 integer types and C++ boolean types/values 2013-10-02 01:45:13 -04:00
modify.cpp Quash "variable may be used uninitialized" warnings 2013-08-26 15:36:00 -04:00
mouse.cpp Use C99 integer types and C++ boolean types/values 2013-10-02 01:45:13 -04:00
png2c.pl Revised the Perl scripts 2013-08-26 17:45:09 -04:00
pngchar2c.pl Revised the Perl scripts 2013-08-26 17:45:09 -04:00
polygon.cpp Miscellaneous adjustments for warnings and code quality 2013-09-19 02:35:56 -04:00
polygon.h Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
request.cpp Quash "variable may be used uninitialized" warnings 2013-08-26 15:36:00 -04:00
sketch.h Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
solvespace.cpp Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
solvespace.h Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
style.cpp Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
system.cpp Use C99 integer types and C++ boolean types/values 2013-10-02 01:45:13 -04:00
textscreens.cpp Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
textwin.cpp Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
toolbar.cpp Use C99 integer types and C++ boolean types/values 2013-10-02 01:45:13 -04:00
ttf.cpp Use C99 integer types and C++ boolean types/values 2013-10-02 01:45:13 -04:00
ui.h Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
undoredo.cpp Changes in preparation for the release of SolveSpace under the GPL, 2013-07-28 14:08:34 -08:00
util.cpp Replaced RGB-color integers with dedicated data structure 2013-10-25 01:49:12 -04:00
view.cpp Use C99 integer types and C++ boolean types/values 2013-10-02 01:45:13 -04:00
wishlist.txt Make oops() calls exit instead of entering debugger by default, 2011-03-05 12:52:57 -08:00