We can identify the "Open Recent" and "Import Recent" submenus just as
easily by looking at the value of the .id field (MNU_OPEN_RECENT and
MNU_GROUP_RECENT, respectively).
This commit contains a grab bag of minor changes not worth committing
individually:
* Replaced raw Latin-1 characters with octal escapes to avoid source-file
encoding issues
* Undefined some convenience macros after they've served their purpose
* Rewrote SEdge::From() to avoid confusing less-capable C++ compilers
* Have oops() print a newline at the end of its message
* Removed "static" keyword from the Bernstein() function definition, as it
has a non-static prototype in srf/surface.h
* Added casts (and changed a variable type) to quell warnings about integer
size and signedness
* Simplified an expression with our handy arraylen() macro
Some menu items in the menu-bar are toggles (each representing an option
that can be turned on or off independently), and some are 1-of-N selections
(e.g. mm or inches), like tuner buttons on a car radio. Windows can draw an
optional check-mark besides a menu item, and SolveSpace has been using this
feature to implement both kinds of menu items, with the backend logic
making them behave as a toggle or radio button as appropriate.
Other GUI platforms can draw proper radio-button menu items that are
distinct from toggles, however. To allow the platform-specific logic to
tell the two kinds of menu items apart, this change adds the
RadioMenuById() routine, and replaces the appropriate calls to
CheckMenuById() with it. (Note that nothing is changed in the Windows GUI
code; radio-menu items are still drawn with check-marks.)
The Valgrind tool can give a full accounting of what memory allocations
have yet to be free()d when the program exits. It is easier to find actual
memory leaks in the code if all non-leaked allocations are elided from that
accounting, which is most easily accomplished by free()ing them.
The "most" qualifier is there because some allocations are difficult/
impossible to free, as they are internal to libraries like OpenGL and Xft.
The best we can hope for is to cover all allocations made by SolveSpace
directly.
This function was returning ID{YES,NO,CANCEL}, which are specific to
Windows as return values for MessageBox(). These have been replaced with
SAVE_{YES,NO,CANCEL}, which we define ourselves.
Later versions of libpng (1.5.x) have made the png_info structure opaque,
breaking direct access to its fields. Fortunately, the library also
provides getter routines, and these are available in the more-widely-
deployed 1.2.x series.
FLTK's Fl_Input widget, instantiated as {Graphics,Text}EditControl, returns
a 'const char *' string. In order to handle this properly, several of
SolveSpace's internal routines needed to gain a "const" qualifier on the
edit-control string argument.
* Generate icons.h and icons-proto.h in the source directory instead of
obj/, so that pre-generated copies of these files can be distributed
without being blown away by "make clean"; also updated the source files
that #include these to reflect the new location
* Compilation rules rewritten as batch-mode inference rules
* Use Windows commands instead of Unix ones ("del" instead of "rm", "move"
instead of "mv", etc.)
* Sorted the object lists
* Use tabs to indent rule bodies
* Use "#!/usr/bin/env perl" instead of "#!/usr/bin/perl", as this is better
practice (it allows e.g. /usr/local/bin/perl to work when executing via
the shebang)
* Use "use strict" and "use warnings"
* Declare variables with "my" as required by "use strict"
* Take an optional "srcdir" argument so that the scripts can find the icon
files in a location other than ./icons/ -- this will make building
outside of the source tree possible in the future
* Add a "this is a generated file" banner to the output, so that it can be
clearly recognized as a machine-generated file that should not be
hand-edited
* Minor regex tweaks
Several MenuEntry elements in GraphicsWindow::menu[] were being initialized
with four items instead of the requisite five, due to a missing fourth
column (corresponding to the .accel field of MenuEntry). This change simply
adds zeroes as the missing column to the appropriate elements.
This addresses a grab bag of compiler grievances relating to C++ syntax,
type, and scope, as observed on Linux with g++ and Solaris with Sun
WorkShop 6.
Having e.g. GetWORD() return a WORD rather than int eliminates the need for
a cast when assigning to WORD variables. We use casts only when assigning
to a different (but same-sized) type.
Also, check for EOF explicitly when calling fgetc().
The compiler gets nervous when we (for example) pass in a size_t as an int
parameter, or assign an int to a char, or assign -1 to an unsigned type. By
adding appropriate casts, we inform the compiler that, yes, we know what
we're doing.
This change also upgrades a va_arg() type from char to int, as char is
always promoted to int when passed through '...'.
Whether or not there is any actual danger of these variables being used
without initialization, the warnings are noise, and getting rid of them is
trivial.
String literals in C++ are implicitly typed as 'const char *', and with
this change, their const-ness is maintained when assigning them to
variables or passing them as arguments. This significantly cuts down the
number of warnings generated by the compiler.
the documentation accordingly. Also rename the C example for
consistency, and update copyright dates.
[git-p4: depot-paths = "//depot/solvespace/": change = 2190]
after decimal) current value of the dimension, not the value
truncated to the same number of digits that are usually displayed.
And make the paste transformed screen accept expressions, not
just integers, for the count, angle, and scale.
[git-p4: depot-paths = "//depot/solvespace/": change = 2181]
as they are displayed on the drawing, and for many other places) a
user-configurable parameter.
Also reshuffle some options in the configuration screen, to put all
the stuff relating to exports together.
[git-p4: depot-paths = "//depot/solvespace/": change = 2179]
and up for special things, the number of times that a group may
be stepped is limited to 999. So avoid a crash by not letting
the user specify more than that.
[git-p4: depot-paths = "//depot/solvespace/": change = 2178]
color picker.
And apply same rule to rewrite nearly-white colors (when exporting
with a file format typically viewed on a white background) for fill
color as for stroke color.
[git-p4: depot-paths = "//depot/solvespace/": change = 2176]
of that, where you can pick the hue and blackness, and then the
whiteness) color picker and some swatches.
This is used in three places now: the special colors in the config
screen, the background color, and the style colors.
[git-p4: depot-paths = "//depot/solvespace/": change = 2174]
in the text window. This means that I can move the conversion from
half-row and column to (x, y) into the platform-independent code,
and that I'll be ready to add my color picker.
[git-p4: depot-paths = "//depot/solvespace/": change = 2171]
library. If I understand correctly, that will avoid all the
compiler version issues with different required versions of libc.
[git-p4: depot-paths = "//depot/solvespace/": change = 2167]