summaryrefslogtreecommitdiff
path: root/app/bin
diff options
context:
space:
mode:
Diffstat (limited to 'app/bin')
-rw-r--r--app/bin/CMakeLists.txt8
-rw-r--r--app/bin/appdefaults.c53
-rw-r--r--app/bin/bitmaps/CMakeLists.txt242
-rw-r--r--app/bin/bitmaps/ballgreen.pngbin0 -> 451 bytes
-rw-r--r--app/bin/bitmaps/ballgreen.xpm35
-rw-r--r--app/bin/bitmaps/ballred.pngbin0 -> 799 bytes
-rw-r--r--app/bin/bitmaps/ballred.xpm38
-rw-r--r--app/bin/bitmaps/bluedot.pngbin0 -> 364 bytes
-rw-r--r--app/bin/bitmaps/bluedot.xpm26
-rw-r--r--app/bin/bitmaps/bo_edge.pngbin0 -> 319 bytes
-rw-r--r--app/bin/bitmaps/bo_edge.xpm20
-rw-r--r--app/bin/bitmaps/bo_flat.pngbin0 -> 310 bytes
-rw-r--r--app/bin/bitmaps/bo_flat.xpm20
-rw-r--r--app/bin/bitmaps/bo_ll.pngbin0 -> 335 bytes
-rw-r--r--app/bin/bitmaps/bo_ll.xpm20
-rw-r--r--app/bin/bitmaps/bo_lld.pngbin0 -> 340 bytes
-rw-r--r--app/bin/bitmaps/bo_lld.xpm20
-rw-r--r--app/bin/bitmaps/bo_lli.pngbin0 -> 334 bytes
-rw-r--r--app/bin/bitmaps/bo_lli.xpm20
-rw-r--r--app/bin/bitmaps/bo_llu.pngbin0 -> 341 bytes
-rw-r--r--app/bin/bitmaps/bo_llu.xpm20
-rw-r--r--app/bin/bitmaps/bo_lr.pngbin0 -> 337 bytes
-rw-r--r--app/bin/bitmaps/bo_lr.xpm20
-rw-r--r--app/bin/bitmaps/bo_lrd.pngbin0 -> 328 bytes
-rw-r--r--app/bin/bitmaps/bo_lrd.xpm20
-rw-r--r--app/bin/bitmaps/bo_lri.pngbin0 -> 345 bytes
-rw-r--r--app/bin/bitmaps/bo_lri.xpm20
-rw-r--r--app/bin/bitmaps/bo_lru.pngbin0 -> 332 bytes
-rw-r--r--app/bin/bitmaps/bo_lru.xpm20
-rw-r--r--app/bin/bitmaps/bo_t.pngbin0 -> 344 bytes
-rw-r--r--app/bin/bitmaps/bo_t.xpm20
-rw-r--r--app/bin/bitmaps/bo_ti.pngbin0 -> 347 bytes
-rw-r--r--app/bin/bitmaps/bo_ti.xpm20
-rw-r--r--app/bin/bitmaps/bo_tl.pngbin0 -> 355 bytes
-rw-r--r--app/bin/bitmaps/bo_tl.xpm20
-rw-r--r--app/bin/bitmaps/bo_tr.pngbin0 -> 351 bytes
-rw-r--r--app/bin/bitmaps/bo_tr.xpm20
-rw-r--r--app/bin/bitmaps/carpart.pngbin0 -> 319 bytes
-rw-r--r--app/bin/bitmaps/carpart.xpm22
-rw-r--r--app/bin/bitmaps/carproto.pngbin0 -> 347 bytes
-rw-r--r--app/bin/bitmaps/carproto.xpm23
-rw-r--r--app/bin/bitmaps/funnel.pngbin0 -> 527 bytes
-rw-r--r--app/bin/bitmaps/funnel.xpm62
-rw-r--r--app/bin/bitmaps/funnelclear.pngbin0 -> 780 bytes
-rw-r--r--app/bin/bitmaps/funnelclear.xpm124
-rw-r--r--app/bin/bitmaps/greendot.pngbin0 -> 343 bytes
-rw-r--r--app/bin/bitmaps/greendot.xpm23
-rw-r--r--app/bin/bitmaps/greenstar.pngbin0 -> 528 bytes
-rw-r--r--app/bin/bitmaps/greenstar.xpm69
-rw-r--r--app/bin/bitmaps/greydot.pngbin0 -> 359 bytes
-rw-r--r--app/bin/bitmaps/greydot.xpm25
-rw-r--r--app/bin/bitmaps/greystar.pngbin0 -> 528 bytes
-rw-r--r--app/bin/bitmaps/greystar.xpm69
-rw-r--r--app/bin/bitmaps/loosen.pngbin0 -> 265 bytes
-rw-r--r--app/bin/bitmaps/loosen.xpm183
-rwxr-xr-xapp/bin/bitmaps/mkimage3.cmake9
-rw-r--r--app/bin/bitmaps/note.pngbin0 -> 265 bytes
-rw-r--r--app/bin/bitmaps/note.xpm114
-rw-r--r--app/bin/bitmaps/partlist.pngbin0 -> 341 bytes
-rw-r--r--app/bin/bitmaps/partlist.xpm21
-rw-r--r--app/bin/bitmaps/pause.pngbin0 -> 265 bytes
-rw-r--r--app/bin/bitmaps/pause.xpm147
-rw-r--r--app/bin/bitmaps/png/down16.pngbin170 -> 193 bytes
-rw-r--r--app/bin/bitmaps/png/down24.pngbin180 -> 282 bytes
-rw-r--r--app/bin/bitmaps/reddot.pngbin0 -> 364 bytes
-rw-r--r--app/bin/bitmaps/reddot.xpm26
-rw-r--r--app/bin/bitmaps/redstar.pngbin0 -> 522 bytes
-rw-r--r--app/bin/bitmaps/redstar.xpm67
-rw-r--r--app/bin/bitmaps/struct.pngbin0 -> 343 bytes
-rw-r--r--app/bin/bitmaps/struct.xpm22
-rw-r--r--app/bin/bitmaps/svg/down.svg66
-rw-r--r--app/bin/bitmaps/xtc.pngbin0 -> 761 bytes
-rw-r--r--app/bin/bitmaps/xtc.xpm83
-rw-r--r--app/bin/bitmaps/yellowdot.pngbin0 -> 372 bytes
-rw-r--r--app/bin/bitmaps/yellowdot.xpm27
-rw-r--r--app/bin/bitmaps/yellowstar.pngbin0 -> 522 bytes
-rw-r--r--app/bin/bitmaps/yellowstar.xpm67
-rw-r--r--app/bin/bitmaps/zero.pngbin0 -> 290 bytes
-rw-r--r--app/bin/bitmaps/zero.xpm21
-rw-r--r--app/bin/cbezier.c5
-rw-r--r--app/bin/cblock.c14
-rw-r--r--app/bin/ccontrol.c8
-rw-r--r--app/bin/ccornu.c20
-rw-r--r--app/bin/ccurve.c130
-rw-r--r--app/bin/cdraw.c107
-rw-r--r--app/bin/celev.c11
-rw-r--r--app/bin/cgroup.c2
-rw-r--r--app/bin/chndldto.c4
-rw-r--r--app/bin/chotbar.c13
-rw-r--r--app/bin/cjoin.c8
-rw-r--r--app/bin/cmisc.c157
-rw-r--r--app/bin/cmodify.c4
-rw-r--r--app/bin/cnote.c3
-rw-r--r--app/bin/command.c305
-rw-r--r--app/bin/command.h38
-rw-r--r--app/bin/common.h5
-rw-r--r--app/bin/compound.c12
-rw-r--r--app/bin/compound.h4
-rw-r--r--app/bin/cparalle.c8
-rw-r--r--app/bin/cprint.c11
-rw-r--r--app/bin/cprofile.c13
-rw-r--r--app/bin/cpull.c4
-rw-r--r--app/bin/cruler.c8
-rw-r--r--app/bin/cselect.c448
-rw-r--r--app/bin/cselect.h3
-rw-r--r--app/bin/csensor.c14
-rw-r--r--app/bin/csignal.c20
-rw-r--r--app/bin/csnap.c57
-rw-r--r--app/bin/csplit.c12
-rw-r--r--app/bin/cstraigh.c4
-rw-r--r--app/bin/cstruct.c15
-rw-r--r--app/bin/cswitchmotor.c29
-rw-r--r--app/bin/ctext.c16
-rw-r--r--app/bin/ctodesgn.c31
-rw-r--r--app/bin/ctrain.c71
-rw-r--r--app/bin/ctrain.h5
-rw-r--r--app/bin/cturnout.c9
-rw-r--r--app/bin/cturntbl.c7
-rw-r--r--app/bin/cundo.c72
-rw-r--r--app/bin/cundo.h1
-rw-r--r--app/bin/custom.h2
-rw-r--r--app/bin/dbench.c60
-rw-r--r--app/bin/dbitmap.c2
-rw-r--r--app/bin/dcar.c97
-rw-r--r--app/bin/dcmpnd.c228
-rw-r--r--app/bin/dcontmgm.c6
-rw-r--r--app/bin/dcustmgm.c15
-rw-r--r--app/bin/dease.c49
-rw-r--r--app/bin/denum.c2
-rw-r--r--app/bin/dlayer.c16
-rw-r--r--app/bin/doption.c33
-rw-r--r--app/bin/dpricels.c3
-rw-r--r--app/bin/dprmfile.c35
-rw-r--r--app/bin/draw.c201
-rw-r--r--app/bin/draw.h1
-rw-r--r--app/bin/drawgeom.c2
-rw-r--r--app/bin/fileio.c99
-rw-r--r--app/bin/fileio.h10
-rw-r--r--app/bin/filenoteui.c24
-rw-r--r--app/bin/include/stringxtc.h1
-rw-r--r--app/bin/include/toolbar.h57
-rw-r--r--app/bin/layout.c111
-rw-r--r--app/bin/linknoteui.c24
-rw-r--r--app/bin/locale.c78
-rw-r--r--app/bin/macro.c43
-rw-r--r--app/bin/menu.c225
-rw-r--r--app/bin/misc.c41
-rw-r--r--app/bin/misc.h9
-rw-r--r--app/bin/param.c553
-rw-r--r--app/bin/param.h44
-rw-r--r--app/bin/paramfile.c1
-rw-r--r--app/bin/paramfilelist.c3
-rw-r--r--app/bin/paramfilesearch_ui.c20
-rw-r--r--app/bin/problemrep.c32
-rw-r--r--app/bin/problemrepui.c3
-rw-r--r--app/bin/scale.c2
-rw-r--r--app/bin/shortentext.c3
-rw-r--r--app/bin/smalldlg.c10
-rw-r--r--app/bin/stringxtc.c25
-rw-r--r--app/bin/svgoutput.c5
-rw-r--r--app/bin/tbezier.c9
-rw-r--r--app/bin/tcornu.c2
-rw-r--r--app/bin/tcurve.c30
-rw-r--r--app/bin/tease.c3
-rw-r--r--app/bin/textnoteui.c22
-rw-r--r--app/bin/toolbar.c613
-rw-r--r--app/bin/track.c42
-rw-r--r--app/bin/track.h4
-rw-r--r--app/bin/trknote.c25
-rw-r--r--app/bin/trkseg.c8
-rw-r--r--app/bin/tstraigh.c5
-rw-r--r--app/bin/turnout.c20
172 files changed, 2915 insertions, 3703 deletions
diff --git a/app/bin/CMakeLists.txt b/app/bin/CMakeLists.txt
index 48a0b72..0527d0e 100644
--- a/app/bin/CMakeLists.txt
+++ b/app/bin/CMakeLists.txt
@@ -168,6 +168,7 @@ target_sources(xtrkcad-lib
layout.h
levenshtein.c
linknoteui.c
+ locale.c
lprintf.c
macro.c
manifest.c
@@ -213,6 +214,7 @@ target_sources(xtrkcad-lib
trkseg.h
trkseg.c
tstraigh.c
+ toolbar.c
turnout.c
uthash.h
utility.c
@@ -268,10 +270,14 @@ else()
target_link_libraries(xtrkcad-lib
PRIVATE
Libzip::Libzip
- FreeImage::FreeImage
Zlib::Zlib)
endif()
+if(WIN32)
+ target_link_libraries(xtrkcad-lib
+ PRIVATE
+ FreeImage::FreeImage)
+endif()
#
# Start building the main program itself
#
diff --git a/app/bin/appdefaults.c b/app/bin/appdefaults.c
index 0e1898d..6b049cb 100644
--- a/app/bin/appdefaults.c
+++ b/app/bin/appdefaults.c
@@ -37,33 +37,33 @@ enum defaultTypes {
};
struct appDefault {
- char *defaultKey; /**< the key used to access the value */
+ const char *defaultKey; /**< the key used to access the value */
bool wasUsed; /**< value has already been used on this run */
enum defaultTypes
valueType; /**< type of default, constant or pointer to a function */
union {
int intValue;
double floatValue;
- char *stringValue;
- int (*intFunction)(struct appDefault *, void *);
- double (*floatFunction)(struct appDefault *, void *);
- char *(*stringFunction)(struct appDefault *, void *);
+ const char *stringValue;
+ int (*intFunction)(struct appDefault *, const void *);
+ double (*floatFunction)(struct appDefault *, const void *);
+ const char *(*stringFunction)(struct appDefault *, const void *);
} defaultValue;
- void *additionalData;
+ const void *additionalData;
};
static int GetLocalMeasureSystem(struct appDefault *ptrDefault,
- void *additionalData);
+ const void *additionalData);
static int GetLocalDistanceFormat(struct appDefault *ptrDefault,
- void *additionalData);
-static char *GetLocalPopularScale(struct appDefault *ptrDefault,
- void *additionalData);
+ const void *additionalData);
+static const char *GetLocalPopularScale(struct appDefault *ptrDefault,
+ const void *additionalData);
static double GetLocalRoomSize(struct appDefault *ptrDefault,
- void *additionalData);
-static char *GetParamFullPath(struct appDefault *ptrDefault,
- void *additionalData);
-static char *GetParamPrototype(struct appDefault *ptrDefault,
- void *additionalData);
+ const void *additionalData);
+static const char *GetParamFullPath(struct appDefault *ptrDefault,
+ const void *additionalData);
+static const char *GetParamPrototype(struct appDefault *ptrDefault,
+ const void *additionalData);
/**
* List of application default settings. As this is searched by binary search, the list has to be kept sorted
@@ -238,7 +238,7 @@ static bool UseMetric()
*/
static double
-GetLocalRoomSize(struct appDefault *ptrDefault, void *data)
+GetLocalRoomSize(struct appDefault *ptrDefault, const void *data)
{
if (!strcmp(ptrDefault->defaultKey, "draw.roomsizeY")) {
return (UseMetric() ? 125.0/2.54 : 48);
@@ -255,8 +255,8 @@ GetLocalRoomSize(struct appDefault *ptrDefault, void *data)
* The most popular scale is supposed to be HO except for UK where OO is assumed.
*/
-static char *
-GetLocalPopularScale(struct appDefault *ptrDefault, void *data)
+static const char *
+GetLocalPopularScale(struct appDefault *ptrDefault, const void *data)
{
return (strcmp(regionCode, "GB") ? "HO" : "OO");
}
@@ -265,7 +265,7 @@ GetLocalPopularScale(struct appDefault *ptrDefault, void *data)
* The measurement system is english for the US and Canada and metric elsewhere
*/
static int
-GetLocalMeasureSystem(struct appDefault *ptrDefault, void *data)
+GetLocalMeasureSystem(struct appDefault *ptrDefault, const void *data)
{
return (UseMetric() ? 1 : 0);
}
@@ -274,7 +274,7 @@ GetLocalMeasureSystem(struct appDefault *ptrDefault, void *data)
* The distance format is 999.9 cm for metric and 999.99 for english
*/
static int
-GetLocalDistanceFormat(struct appDefault *ptrDefault, void *data)
+GetLocalDistanceFormat(struct appDefault *ptrDefault, const void *data)
{
return (UseMetric() ? 8 : 4);
}
@@ -284,8 +284,8 @@ GetLocalDistanceFormat(struct appDefault *ptrDefault, void *data)
* is assumed to be the default.
*/
-static char*
-GetParamPrototype(struct appDefault *ptrDefault, void *additionalData)
+static const char*
+GetParamPrototype(struct appDefault *ptrDefault, const void *additionalData)
{
return (strcmp(regionCode,
"GB") ? "North American Prototypes" : "British stock");
@@ -294,8 +294,8 @@ GetParamPrototype(struct appDefault *ptrDefault, void *additionalData)
/**
* The full path to the applications parameter directory
*/
-static char *
-GetParamFullPath(struct appDefault *ptrDefault, void *additionalData)
+static const char *
+GetParamFullPath(struct appDefault *ptrDefault, const void *additionalData)
{
char *str;
MakeFullpath(&str, libDir, PARAM_SUBDIR, (char*)additionalData, I2VP(0));
@@ -409,8 +409,7 @@ wPrefGetStringExt(const char *section, const char *name)
return ((char *)wPrefGetStringBasic(section, name));
}
- char *prefString;
- char *defaultValue;
+ const char *defaultValue;
if (thisDefault->valueType == STRINGCONSTANT) {
defaultValue = thisDefault->defaultValue.stringValue;
@@ -420,7 +419,7 @@ wPrefGetStringExt(const char *section, const char *name)
}
// Next call will get value from Prefs
wPrefSetString( section, name, defaultValue );
- return (defaultValue);
+ return CAST_AWAY_CONST(defaultValue);
}
/**
diff --git a/app/bin/bitmaps/CMakeLists.txt b/app/bin/bitmaps/CMakeLists.txt
index 0a68722..e3601aa 100644
--- a/app/bin/bitmaps/CMakeLists.txt
+++ b/app/bin/bitmaps/CMakeLists.txt
@@ -1,100 +1,188 @@
-# Generate XPM bitmaps from SVG files
+# Generate bitmaps from SVG files and other places
+#
+# FLATPAK builds use pregenerated bitmap files. See below;
+#
+# We generate different types of bitmap files depending of the platform
+# Both use the common suffix .image1 (this saves lots of ugly preprocesor code)
+# Unix - ascii-ized version of the .png files (using gdk_pixbuf_csource)
+# Window - .xpm files (using pngtoxpm)
+#
+# Toolbar button icons come in 3 sizes. Separate .image1 files are generated for each size
+# A small #include file (.image3) is generated for each icon, Which #include's the 3 .image1 files
+# and an array definition to select the bitmap for the size
+# Toolbar icons are defined as .svg file which are converated by Inkscape into .png files.
+# Some of the generated bitmap are ugly and handcrafted .png files are used instead
+# This live in ${CMAKE_CURRENT_SOURCE}/png
+#
+# Another group of icons are used as dialog decorations.
+# These .png files live in ${CMAKE_CURRENT_SOURCE_DIR}
PROJECT(genbitmaps)
-# Find the conversion tool
+set (IMG3S
+ background benchwork bezier-line bezier-track block bottom box
+ bridge building car-inventory change-grid circle-center
+ circle-filled-center circle-filled-tangent circle-line-center
+ circle-line-tangent circle-line circle-tangent circle clone
+ connect control convert-from convert-to copy cornu curved-chord
+ curved-end curved-line-chord curved-line-end curved-line-middle
+ curved-line-tangent curved-middle curved-tangent cut delete
+ describe description dimension doc-export-bmap doc-export-dxf
+ doc-export-svg doc-export doc-import-mod doc-import doc-new doc-open
+ doc-print doc-recent doc-revert doc-save-as doc-save doc-setup down
+ ease-broad ease-cornu ease-gt-broad ease-gt-sharp ease-lt-broad
+ ease-lt-sharp ease-none ease-normal ease-sharp
+ elevation exit extend filled-box filled-polygon go helix
+ info join-line join layers magnet manage map move
+ new-car ok pan-zoom parallel-line parallel parameter paste
+ polygon polyline profile protractor redo reflect roadbed
+ rotate ruler select sensor signal snap-curs snap-grid
+ split-draw split sticky-doc sticky-link sticky-note stop
+ straight-line straight switch-motor table-edge text ties top
+ train trim tunnel turnout-design turnout turntable undo
+ zoom-choose zoom-extent zoom-in zoom-out
+ )
+set( PIXS 16 24 32 )
+
+set (IMG1S
+ ballgreen ballred bluedot bo_edge bo_flat bo_lld bo_lli bo_llu bo_ll bo_lrd bo_lri
+ bo_lru bo_lr bo_ti bo_tl bo_tr bo_t carpart carproto funnelclear funnel greendot
+ greenstar greydot greystar loosen note partlist pause reddot redstar struct xtc
+ yellowdot yellowstar zero
+)
+
+# If ../../../bitmaps exists it is because we are building for FlatPak which can't
+# build bitmaps because we don't have inkscape
+# Instead we copy the bitmaps from bia regular build and include them at the top
+# level of the source tree in the tarball we create for the FlatPak build
+# See distribution/flatpak/make-source-archive
+# So if bitmaps/ exists then we are doing a FlatPak build
+if ( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../../bitmaps/" )
+ # FLATPAK
+ MESSAGE( STATUS "FlatPak build" )
+ foreach( img1 ${IMG1S} )
+ list(APPEND IMG_RESULTS ${img1}.image1)
+ endforeach()
+ foreach( img3 ${IMG3S} )
+ foreach( pix 16 24 32 )
+ list(APPEND IMG_RESULTS ${img3}${pix}.image1)
+ endforeach()
+ list(APPEND IMG_RESULTS ${img3}.image3)
+ endforeach()
+
+ foreach ( img ${IMG_RESULTS} )
+ add_custom_command(
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../../../bitmaps/${img}
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${img}
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/../../../bitmaps/${img} ${CMAKE_CURRENT_BINARY_DIR}/${img}
+ )
+ endforeach()
+ MESSAGE( STATUS ${IMG_RESULTS} )
+
+ add_custom_target (
+ genbitmaps
+ DEPENDS ${IMG_RESULTS}
+ )
+ return()
+endif()
+# Find the conversion tool
find_package(Inkscape)
if( NOT Inkscape_FOUND )
message( STATUS "Inkscape not found." )
+ return()
else()
message(STATUS "Inkscape is: ${Inkscape_EXECUTABLE}")
message(STATUS "Export option is: ${Inkscape_EXPORT}")
+endif()
- set (XPMS
- background benchwork bezier-line bezier-track block bottom box
- bridge building car-inventory change-grid circle-center
- circle-filled-center circle-filled-tangent circle-line-center
- circle-line-tangent circle-line circle-tangent circle clone
- connect control convert-from convert-to copy cornu curved-chord
- curved-end curved-line-chord curved-line-end curved-line-middle
- curved-line-tangent curved-middle curved-tangent cut delete
- describe description dimension doc-export-bmap doc-export-dxf
- doc-export-svg doc-export doc-import-mod doc-import doc-new doc-open
- doc-print doc-recent doc-revert doc-save-as doc-save doc-setup down
- ease-broad ease-cornu ease-gt-broad ease-gt-sharp ease-lt-broad
- ease-lt-sharp ease-none ease-normal ease-sharp
- elevation exit extend filled-box filled-polygon go helix
- info join-line join layers magnet manage map move
- new-car ok pan-zoom parallel-line parallel parameter paste
- polygon polyline profile protractor redo reflect roadbed
- rotate ruler select sensor signal snap-curs snap-grid
- split-draw split sticky-doc sticky-link sticky-note stop
- straight-line straight switch-motor table-edge text ties top
- train trim tunnel turnout-design turnout turntable undo
- zoom-choose zoom-extent zoom-in zoom-out
- )
- set( PIXS 16 24 32 )
-
- foreach(xpm ${XPMS})
- foreach(pix ${PIXS})
- if ( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/png/${xpm}${pix}.png" )
- # MESSAGE( STATUS "Custom ${CMAKE_CURRENT_SOURCE_DIR}/png/${xpm}${pix}.png" )
- add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/png/${xpm}${pix}.png
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/png/${xpm}${pix}.png
- COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/png/
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/png/${xpm}${pix}.png ${CMAKE_CURRENT_BINARY_DIR}/png/${xpm}${pix}.png
- )
- else()
- # MESSAGE( STATUS "SVG ${CMAKE_CURRENT_SOURCE_DIR}/svg/${xpm}.svg" )
- add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/png/${xpm}${pix}.png
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/svg/${xpm}.svg
- COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/png/
- COMMAND ${Inkscape_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/svg/${xpm}.svg -h ${pix} ${Inkscape_EXPORT}${CMAKE_CURRENT_BINARY_DIR}/png/${xpm}${pix}.png
- )
- endif()
- # build a list of all the depends
- list(APPEND PNG_RESULTS ${CMAKE_CURRENT_BINARY_DIR}/png/${xpm}${pix}.png)
- endforeach()
- add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${xpm}.xpm3
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/png/${xpm}16.png
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/png/${xpm}24.png
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/png/${xpm}32.png
- COMMAND pngtoxpm ${CMAKE_CURRENT_BINARY_DIR}/${xpm}.xpm3
-# COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${xpm}.xpm3 ${CMAKE_CURRENT_SOURCE_DIR}/${xpm}.xpm3
- )
- # build a list of all the depends
- list(APPEND XPM_RESULTS ${xpm}.xpm3)
- endforeach()
- add_custom_target (
- genbitmaps
- DEPENDS ${XPM_RESULTS}
- DEPENDS ${PNG_RESULTS}
+foreach(img3 ${IMG3S})
+ STRING(MAKE_C_IDENTIFIER ${img3} NAME )
+ foreach(pix ${PIXS})
+ if ( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/png/${img3}${pix}.png" )
+ # MESSAGE( STATUS "Custom ${CMAKE_CURRENT_SOURCE_DIR}/png/${img3}${pix}.png" )
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/png/${img3}${pix}.png
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/png/${img3}${pix}.png
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/png/
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/png/${img3}${pix}.png ${CMAKE_CURRENT_BINARY_DIR}/png/${img3}${pix}.png
+ )
+ else()
+ # MESSAGE( STATUS "SVG ${CMAKE_CURRENT_SOURCE_DIR}/svg/${img3}.svg" )
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/png/${img3}${pix}.png
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/svg/${img3}.svg
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/png/
+ COMMAND ${Inkscape_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/svg/${img3}.svg -h ${pix} ${Inkscape_EXPORT}${CMAKE_CURRENT_BINARY_DIR}/png/${img3}${pix}.png
+ )
+ endif()
+ if(UNIX)
+ add_custom_command(
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/png/${img3}${pix}.png
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${img3}${pix}.image1
+ COMMAND gdk-pixbuf-csource --stream --name ${NAME}${pix}_image1 ${CMAKE_CURRENT_BINARY_DIR}/png/${img3}${pix}.png > ${CMAKE_CURRENT_BINARY_DIR}/${img3}${pix}.image1
+ )
+ else()
+ add_custom_command(
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/png/${img3}${pix}.png
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${img3}${pix}.image1
+ COMMAND pngtoxpm ${img3}${pix}_image1 ${CMAKE_CURRENT_BINARY_DIR}/png/${img3}${pix}.png ${CMAKE_CURRENT_BINARY_DIR}/${img3}${pix}.image1
+ )
+ endif()
+ endforeach()
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${img3}.image3
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${img3}16.image1
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${img3}24.image1
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${img3}32.image1
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/mkimage3.cmake ${img3}
)
-
- if(WIN32)
- # Temporarily the FreeImage dll is copied to the build directory
+ list(APPEND IMG_RESULTS ${img3}.image3)
+endforeach()
+
+foreach(img1 ${IMG1S})
+ STRING(MAKE_C_IDENTIFIER ${img1} NAME )
+ if(UNIX)
add_custom_command(
- TARGET genbitmaps PRE_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy ${FREEIMAGE_SHAREDLIB} ${CMAKE_CURRENT_BINARY_DIR}
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${img1}.image1
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${img1}.png
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/
+ COMMAND gdk-pixbuf-csource --stream --name ${NAME}_image1 ${CMAKE_CURRENT_SOURCE_DIR}/${img1}.png > ${CMAKE_CURRENT_BINARY_DIR}/${img1}.image1
)
- cmake_path(GET FREEIMAGE_SHAREDLIB FILENAME filename)
+ else()
add_custom_command(
- TARGET genbitmaps POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E rm ${CMAKE_CURRENT_BINARY_DIR}/${filename}
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${img1}.image1
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${img1}.png
+ COMMAND pngtoxpm ${img1}_image1 ${CMAKE_CURRENT_SOURCE_DIR}/${img1}.png ${CMAKE_CURRENT_BINARY_DIR}/${img1}.image1
)
-#
-
endif()
+ list(APPEND IMG_RESULTS ${img1}.image1)
+ list(APPEND IMG_RESULTS ${img1}.png)
+endforeach()
+
+add_custom_target (
+ genbitmaps
+ DEPENDS ${IMG_RESULTS}
+)
+
+
+if(WIN32)
+ # Temporarily the FreeImage dll is copied to the build directory
+ add_custom_command(
+ TARGET genbitmaps PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${FREEIMAGE_SHAREDLIB} ${CMAKE_CURRENT_BINARY_DIR}
+ )
+ cmake_path(GET FREEIMAGE_SHAREDLIB FILENAME filename)
+ add_custom_command(
+ TARGET genbitmaps POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E rm ${CMAKE_CURRENT_BINARY_DIR}/${filename}
+ )
+
endif()
#MESSAGE (STATUS "SVG Converter: ${SVG_CONVERTER}")
#MESSAGE (STATUS "Source Dir: ${CMAKE_CURRENT_SOURCE_DIR}")
-#MESSAGE (STATUS "XPMs: ${XPMS}")
-#MESSAGE (STATUS "XPM_RESULTS: ${XPM_RESULTS}")
-#MESSAGE (STATUS "PNG_RESULTS: ${PNG_RESULTS}")
+#MESSAGE (STATUS "XPMs: ${IMG3S}")
+#MESSAGE (STATUS "IMG_RESULTS: ${IMG_RESULTS}")
diff --git a/app/bin/bitmaps/ballgreen.png b/app/bin/bitmaps/ballgreen.png
new file mode 100644
index 0000000..788b7bc
--- /dev/null
+++ b/app/bin/bitmaps/ballgreen.png
Binary files differ
diff --git a/app/bin/bitmaps/ballgreen.xpm b/app/bin/bitmaps/ballgreen.xpm
deleted file mode 100644
index 14fb1e2..0000000
--- a/app/bin/bitmaps/ballgreen.xpm
+++ /dev/null
@@ -1,35 +0,0 @@
-/* XPM */
-static char * ballgreen[] = {
-"16 16 16 1",
-" c None",
-". c #292929",
-"+ c #292B29",
-"@ c #29322B",
-"# c #365233",
-"$ c #2D432E",
-"% c #57A572",
-"& c #B0D6C1",
-"* c #3F9159",
-"= c #7EC097",
-"- c #296932",
-"; c #2D8840",
-"> c #2C9231",
-", c #44C530",
-"' c #45BA32",
-") c #7BF737",
-" .+@#$@+. ",
-" +$%&&&&%$+ ",
-" +#&&&&&&&&*+ ",
-" +#=&===&&&==#+ ",
-".@%%%%%%%%%%%*@.",
-"+-;%%;*%**%%%*$+",
-"@-**;*;;;;;;*;-@",
-"@--;-;;;;;;;;;-@",
-"@---->>>;->>---$",
-"@->->>>>>;>>;--@",
-"+->>>>,>>,>>>>-+",
-".$>>>,,,,,,>>>@.",
-" +->',,)),,,>-+ ",
-" +#,)))))),>+ ",
-" +#,)))),$+ ",
-" .+$##$+. "};
diff --git a/app/bin/bitmaps/ballred.png b/app/bin/bitmaps/ballred.png
new file mode 100644
index 0000000..e49c445
--- /dev/null
+++ b/app/bin/bitmaps/ballred.png
Binary files differ
diff --git a/app/bin/bitmaps/ballred.xpm b/app/bin/bitmaps/ballred.xpm
deleted file mode 100644
index 8d56dd4..0000000
--- a/app/bin/bitmaps/ballred.xpm
+++ /dev/null
@@ -1,38 +0,0 @@
-/* XPM */
-static char *ballred[] = {
-/* columns rows colors chars-per-pixel */
-"16 16 16 1",
-" c #20F301EC00EA",
-". c #060400000000",
-"X c #297B14040000",
-"o c #ED34010C0000",
-"O c #FFFF07880000",
-"+ c #E2BA07180718",
-"@ c #A1E800000000",
-"# c #F4791D5E016C",
-"$ c #D2A11FA11FA1",
-"% c #6D77055602AD",
-"& c #FB014C2607BE",
-"* c #FB747AB40D88",
-"= c #CDB757875787",
-"- c #E5DEA339A339",
-"; c #000000000000",
-": c None",
-/* pixels */
-"::::;. .;::::",
-":::. =----= .:::",
-"::.%--------$.::",
-":.%=====-====%.:",
-"; $$$=$$$$=$$% ;",
-".%+$$$$$$$$$$$%.",
-" @++++++++++++@ ",
-" @++@+++++@+++@ ",
-" @ooooOoooooooo ",
-" oooooOOOOoooo@ ",
-".@ooOOOOOOOOoo@.",
-"; oOO######OOo ;",
-":.@O##&&&###O@.:",
-"::.%#&&*&*&#%.::",
-":::.X#***&#X.:::",
-"::::;. XX .;::::"
-};
diff --git a/app/bin/bitmaps/bluedot.png b/app/bin/bitmaps/bluedot.png
new file mode 100644
index 0000000..6f6353d
--- /dev/null
+++ b/app/bin/bitmaps/bluedot.png
Binary files differ
diff --git a/app/bin/bitmaps/bluedot.xpm b/app/bin/bitmaps/bluedot.xpm
deleted file mode 100644
index 5c1df4c..0000000
--- a/app/bin/bitmaps/bluedot.xpm
+++ /dev/null
@@ -1,26 +0,0 @@
-/* XPM */
-static char * bluedot[] = {
-"16 16 7 1",
-" c None",
-". c #000000",
-"+ c #3465A4",
-"@ c #3565A4",
-"# c #4465A1",
-"$ c #5A649B",
-"% c #4C79BA",
-" ",
-" ",
-" .... ",
-" ..#@@#.. ",
-" .$%%%+++$. ",
-" .%%%%%+++. ",
-" .#%%%%%+++#. ",
-" .@%%%%%+++@. ",
-" .@+%%%++++@. ",
-" .#++++++++#. ",
-" .++++++++. ",
-" .$++++++$. ",
-" ..#@@#.. ",
-" .... ",
-" ",
-" "};
diff --git a/app/bin/bitmaps/bo_edge.png b/app/bin/bitmaps/bo_edge.png
new file mode 100644
index 0000000..97926c1
--- /dev/null
+++ b/app/bin/bitmaps/bo_edge.png
Binary files differ
diff --git a/app/bin/bitmaps/bo_edge.xpm b/app/bin/bitmaps/bo_edge.xpm
deleted file mode 100644
index da936f9..0000000
--- a/app/bin/bitmaps/bo_edge.xpm
+++ /dev/null
@@ -1,20 +0,0 @@
-/* XPM */
-static char * bo_edge_xpm[] = {
-"16 14 3 1",
-" c None",
-". c #000000000000",
-"X c #FFFF9A691861",
-" ...... ",
-" .XXXX. ",
-" .XXXX. ",
-" .XXXX. ",
-" .XXXX. ",
-" .XXXX. ",
-" .XXXX. ",
-" .XXXX. ",
-" .XXXX. ",
-" .XXXX. ",
-" .XXXX. ",
-" .XXXX. ",
-" .XXXX. ",
-" ...... "};
diff --git a/app/bin/bitmaps/bo_flat.png b/app/bin/bitmaps/bo_flat.png
new file mode 100644
index 0000000..8783938
--- /dev/null
+++ b/app/bin/bitmaps/bo_flat.png
Binary files differ
diff --git a/app/bin/bitmaps/bo_flat.xpm b/app/bin/bitmaps/bo_flat.xpm
deleted file mode 100644
index 1402d10..0000000
--- a/app/bin/bitmaps/bo_flat.xpm
+++ /dev/null
@@ -1,20 +0,0 @@
-/* XPM */
-static char * bo_flat_xpm[] = {
-"16 14 3 1",
-" c None",
-". c #000000000000",
-"X c #FFFF9A691861",
-" ",
-" ",
-" ",
-" ",
-" .............. ",
-" .XXXXXXXXXXXX. ",
-" .XXXXXXXXXXXX. ",
-" .XXXXXXXXXXXX. ",
-" .XXXXXXXXXXXX. ",
-" .............. ",
-" ",
-" ",
-" ",
-" "};
diff --git a/app/bin/bitmaps/bo_ll.png b/app/bin/bitmaps/bo_ll.png
new file mode 100644
index 0000000..1b84179
--- /dev/null
+++ b/app/bin/bitmaps/bo_ll.png
Binary files differ
diff --git a/app/bin/bitmaps/bo_ll.xpm b/app/bin/bitmaps/bo_ll.xpm
deleted file mode 100644
index a3bfcdb..0000000
--- a/app/bin/bitmaps/bo_ll.xpm
+++ /dev/null
@@ -1,20 +0,0 @@
-/* XPM */
-static char * bo_ll_xpm[] = {
-"16 14 3 1",
-" c None",
-". c #000000000000",
-"X c #FFFF9A691861",
-" ........ ",
-" .XXXXXX. ",
-" .XXXXXX. ",
-" .XXXXXX. ",
-" .XXX.... ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" ..... "};
diff --git a/app/bin/bitmaps/bo_lld.png b/app/bin/bitmaps/bo_lld.png
new file mode 100644
index 0000000..06b66ed
--- /dev/null
+++ b/app/bin/bitmaps/bo_lld.png
Binary files differ
diff --git a/app/bin/bitmaps/bo_lld.xpm b/app/bin/bitmaps/bo_lld.xpm
deleted file mode 100644
index f1068cf..0000000
--- a/app/bin/bitmaps/bo_lld.xpm
+++ /dev/null
@@ -1,20 +0,0 @@
-/* XPM */
-static char * bo_lld_xpm[] = {
-"16 14 3 1",
-" c None",
-". c #000000000000",
-"X c #FFFF9A691861",
-" ",
-" ",
-" ",
-" .............. ",
-" .XXXXXXXXXXXX. ",
-" .XXXXXXXXXXXX. ",
-" .XXXXXXXXXXXX. ",
-" ..........XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" ..... ",
-" ",
-" "};
diff --git a/app/bin/bitmaps/bo_lli.png b/app/bin/bitmaps/bo_lli.png
new file mode 100644
index 0000000..669dcc1
--- /dev/null
+++ b/app/bin/bitmaps/bo_lli.png
Binary files differ
diff --git a/app/bin/bitmaps/bo_lli.xpm b/app/bin/bitmaps/bo_lli.xpm
deleted file mode 100644
index e5d5bc7..0000000
--- a/app/bin/bitmaps/bo_lli.xpm
+++ /dev/null
@@ -1,20 +0,0 @@
-/* XPM */
-static char * bo_lli_xpm[] = {
-"16 14 3 1",
-" c None",
-". c #000000000000",
-"X c #FFFF9A691861",
-" ..... ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .....XXX. ",
-" .XXXXXXX. ",
-" .XXXXXXX. ",
-" .XXXXXXX. ",
-" ......... "};
diff --git a/app/bin/bitmaps/bo_llu.png b/app/bin/bitmaps/bo_llu.png
new file mode 100644
index 0000000..e994f38
--- /dev/null
+++ b/app/bin/bitmaps/bo_llu.png
Binary files differ
diff --git a/app/bin/bitmaps/bo_llu.xpm b/app/bin/bitmaps/bo_llu.xpm
deleted file mode 100644
index 79ad1f1..0000000
--- a/app/bin/bitmaps/bo_llu.xpm
+++ /dev/null
@@ -1,20 +0,0 @@
-/* XPM */
-static char * bo_llu_xpm[] = {
-"16 14 3 1",
-" c None",
-". c #000000000000",
-"X c #FFFF9A691861",
-" ",
-" ",
-" ..... ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX.......... ",
-" .XXXXXXXXXXXX. ",
-" .XXXXXXXXXXXX. ",
-" .XXXXXXXXXXXX. ",
-" .............. ",
-" ",
-" ",
-" "};
diff --git a/app/bin/bitmaps/bo_lr.png b/app/bin/bitmaps/bo_lr.png
new file mode 100644
index 0000000..38f7a2c
--- /dev/null
+++ b/app/bin/bitmaps/bo_lr.png
Binary files differ
diff --git a/app/bin/bitmaps/bo_lr.xpm b/app/bin/bitmaps/bo_lr.xpm
deleted file mode 100644
index 869a0ba..0000000
--- a/app/bin/bitmaps/bo_lr.xpm
+++ /dev/null
@@ -1,20 +0,0 @@
-/* XPM */
-static char * bo_lr_xpm[] = {
-"16 14 3 1",
-" c None",
-". c #000000000000",
-"X c #FFFF9A691861",
-" ........ ",
-" .XXXXXX. ",
-" .XXXXXX. ",
-" .XXXXXX. ",
-" ....XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" ..... "};
diff --git a/app/bin/bitmaps/bo_lrd.png b/app/bin/bitmaps/bo_lrd.png
new file mode 100644
index 0000000..598cfa1
--- /dev/null
+++ b/app/bin/bitmaps/bo_lrd.png
Binary files differ
diff --git a/app/bin/bitmaps/bo_lrd.xpm b/app/bin/bitmaps/bo_lrd.xpm
deleted file mode 100644
index 29f6550..0000000
--- a/app/bin/bitmaps/bo_lrd.xpm
+++ /dev/null
@@ -1,20 +0,0 @@
-/* XPM */
-static char * bo_lrd_xpm[] = {
-"16 14 3 1",
-" c None",
-". c #000000000000",
-"X c #FFFF9A691861",
-" ",
-" ",
-" ",
-" .............. ",
-" .XXXXXXXXXXXX. ",
-" .XXXXXXXXXXXX. ",
-" .XXXXXXXXXXXX. ",
-" .XXX.......... ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" ..... ",
-" ",
-" "};
diff --git a/app/bin/bitmaps/bo_lri.png b/app/bin/bitmaps/bo_lri.png
new file mode 100644
index 0000000..0ecc88b
--- /dev/null
+++ b/app/bin/bitmaps/bo_lri.png
Binary files differ
diff --git a/app/bin/bitmaps/bo_lri.xpm b/app/bin/bitmaps/bo_lri.xpm
deleted file mode 100644
index e58e682..0000000
--- a/app/bin/bitmaps/bo_lri.xpm
+++ /dev/null
@@ -1,20 +0,0 @@
-/* XPM */
-static char * bo_lri_xpm[] = {
-"16 14 3 1",
-" c None",
-". c #000000000000",
-"X c #FFFF9A691861",
-" ..... ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX..... ",
-" .XXXXXXX. ",
-" .XXXXXXX. ",
-" .XXXXXXX. ",
-" ......... "};
diff --git a/app/bin/bitmaps/bo_lru.png b/app/bin/bitmaps/bo_lru.png
new file mode 100644
index 0000000..874c873
--- /dev/null
+++ b/app/bin/bitmaps/bo_lru.png
Binary files differ
diff --git a/app/bin/bitmaps/bo_lru.xpm b/app/bin/bitmaps/bo_lru.xpm
deleted file mode 100644
index 2c093b5..0000000
--- a/app/bin/bitmaps/bo_lru.xpm
+++ /dev/null
@@ -1,20 +0,0 @@
-/* XPM */
-static char * bo_lru_xpm[] = {
-"16 14 3 1",
-" c None",
-". c #000000000000",
-"X c #FFFF9A691861",
-" ",
-" ",
-" ..... ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" ..........XXX. ",
-" .XXXXXXXXXXXX. ",
-" .XXXXXXXXXXXX. ",
-" .XXXXXXXXXXXX. ",
-" .............. ",
-" ",
-" ",
-" "};
diff --git a/app/bin/bitmaps/bo_t.png b/app/bin/bitmaps/bo_t.png
new file mode 100644
index 0000000..94e9c34
--- /dev/null
+++ b/app/bin/bitmaps/bo_t.png
Binary files differ
diff --git a/app/bin/bitmaps/bo_t.xpm b/app/bin/bitmaps/bo_t.xpm
deleted file mode 100644
index 6842404..0000000
--- a/app/bin/bitmaps/bo_t.xpm
+++ /dev/null
@@ -1,20 +0,0 @@
-/* XPM */
-static char * bo_t_xpm[] = {
-"16 14 3 1",
-" c None",
-". c #000000000000",
-"X c #FFFF9A691861",
-" ............. ",
-" .XXXXXXXXXXX. ",
-" .XXXXXXXXXXX. ",
-" .XXXXXXXXXXX. ",
-" .....XXX..... ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" ..... "};
diff --git a/app/bin/bitmaps/bo_ti.png b/app/bin/bitmaps/bo_ti.png
new file mode 100644
index 0000000..71e0475
--- /dev/null
+++ b/app/bin/bitmaps/bo_ti.png
Binary files differ
diff --git a/app/bin/bitmaps/bo_ti.xpm b/app/bin/bitmaps/bo_ti.xpm
deleted file mode 100644
index 3c86b96..0000000
--- a/app/bin/bitmaps/bo_ti.xpm
+++ /dev/null
@@ -1,20 +0,0 @@
-/* XPM */
-static char * bo_ti_xpm[] = {
-"16 14 3 1",
-" c None",
-". c #000000000000",
-"X c #FFFF9A691861",
-" ..... ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .....XXX..... ",
-" .XXXXXXXXXXX. ",
-" .XXXXXXXXXXX. ",
-" .XXXXXXXXXXX. ",
-" ............. "};
diff --git a/app/bin/bitmaps/bo_tl.png b/app/bin/bitmaps/bo_tl.png
new file mode 100644
index 0000000..8b9627c
--- /dev/null
+++ b/app/bin/bitmaps/bo_tl.png
Binary files differ
diff --git a/app/bin/bitmaps/bo_tl.xpm b/app/bin/bitmaps/bo_tl.xpm
deleted file mode 100644
index 5d63874..0000000
--- a/app/bin/bitmaps/bo_tl.xpm
+++ /dev/null
@@ -1,20 +0,0 @@
-/* XPM */
-static char * bo_tl_xpm[] = {
-"16 14 3 1",
-" c None",
-". c #000000000000",
-"X c #FFFF9A691861",
-" ..... ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" ..........XXX. ",
-" .XXXXXXXXXXXX. ",
-" .XXXXXXXXXXXX. ",
-" .XXXXXXXXXXXX. ",
-" ..........XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" ..... ",
-" "};
diff --git a/app/bin/bitmaps/bo_tr.png b/app/bin/bitmaps/bo_tr.png
new file mode 100644
index 0000000..4f0d347
--- /dev/null
+++ b/app/bin/bitmaps/bo_tr.png
Binary files differ
diff --git a/app/bin/bitmaps/bo_tr.xpm b/app/bin/bitmaps/bo_tr.xpm
deleted file mode 100644
index 4acbcef..0000000
--- a/app/bin/bitmaps/bo_tr.xpm
+++ /dev/null
@@ -1,20 +0,0 @@
-/* XPM */
-static char * bo_tr_xpm[] = {
-"16 14 3 1",
-" c None",
-". c #000000000000",
-"X c #FFFF9A691861",
-" ..... ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX.......... ",
-" .XXXXXXXXXXXX. ",
-" .XXXXXXXXXXXX. ",
-" .XXXXXXXXXXXX. ",
-" .XXX.......... ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" .XXX. ",
-" ..... "};
diff --git a/app/bin/bitmaps/carpart.png b/app/bin/bitmaps/carpart.png
new file mode 100644
index 0000000..705f523
--- /dev/null
+++ b/app/bin/bitmaps/carpart.png
Binary files differ
diff --git a/app/bin/bitmaps/carpart.xpm b/app/bin/bitmaps/carpart.xpm
deleted file mode 100644
index 215a7c1..0000000
--- a/app/bin/bitmaps/carpart.xpm
+++ /dev/null
@@ -1,22 +0,0 @@
-/* XPM */
-static char*carpart_xpm[]={
-"16 16 3 1",
-". c None",
-"# c #ffff00000000",
-"a c #000000000000",
-"................",
-"................",
-"................",
-"................",
-"................",
-"................",
-".##############.",
-".##############.",
-".##############.",
-".##############.",
-"a##############a",
-"..a.a......a.a..",
-".a.a.a....a.a.a.",
-"..a.a......a.a..",
-"................",
-"................"};
diff --git a/app/bin/bitmaps/carproto.png b/app/bin/bitmaps/carproto.png
new file mode 100644
index 0000000..d9d9288
--- /dev/null
+++ b/app/bin/bitmaps/carproto.png
Binary files differ
diff --git a/app/bin/bitmaps/carproto.xpm b/app/bin/bitmaps/carproto.xpm
deleted file mode 100644
index eb07037..0000000
--- a/app/bin/bitmaps/carproto.xpm
+++ /dev/null
@@ -1,23 +0,0 @@
-/* XPM */
-static char*carproto_xpm[]={
-"16 16 4 1",
-". c None",
-"c c #ffff00000000",
-"a c #00000000ffff",
-"# c #000000000000",
-"....a.......a...",
-"...aa..aa..aa...",
-"..aaa..aa.aaa...",
-"...aa......aa...",
-"...aa..aa..aa...",
-"...aa..aa..aa...",
-"..aaaa....aaaa..",
-".cccccccccccccc.",
-".cccccccccccccc.",
-".cccccccccccccc.",
-".cccccccccccccc.",
-"#cccccccccccccc#",
-"..#.#......#.#..",
-".#.#.#....#.#.#.",
-"..#.#......#.#..",
-"................"};
diff --git a/app/bin/bitmaps/funnel.png b/app/bin/bitmaps/funnel.png
new file mode 100644
index 0000000..2bae581
--- /dev/null
+++ b/app/bin/bitmaps/funnel.png
Binary files differ
diff --git a/app/bin/bitmaps/funnel.xpm b/app/bin/bitmaps/funnel.xpm
deleted file mode 100644
index ef7cd23..0000000
--- a/app/bin/bitmaps/funnel.xpm
+++ /dev/null
@@ -1,62 +0,0 @@
-/* XPM */
-static char *funnel_xpm[] = {
-"16 16 43 1",
-" c None",
-". c #216262",
-"+ c #123737",
-"@ c #030A0A",
-"# c #000000",
-"$ c #010303",
-"% c #050E0E",
-"& c #091C1C",
-"* c #0F2E2E",
-"= c #164242",
-"- c #1C5353",
-"; c #76D1D1",
-"> c #82D5D5",
-", c #79D2D2",
-"' c #62CBCB",
-") c #65CCCC",
-"! c #75D1D1",
-"~ c #80D5D5",
-"{ c #5FCACA",
-"] c #52C5C5",
-"^ c #42C0C0",
-"/ c #39ACAC",
-"( c #3BB1B1",
-"_ c #57C7C7",
-": c #7BD3D3",
-"< c #89D8D8",
-"[ c #7ED4D4",
-"} c #60CACA",
-"| c #43C0C0",
-"1 c #4BC3C3",
-"2 c #86D7D7",
-"3 c #71D0D0",
-"4 c #46C1C1",
-"5 c #50C5C5",
-"6 c #49C2C2",
-"7 c #4CC3C3",
-"8 c #5EC9C9",
-"9 c #000101",
-"0 c #040B0B",
-"a c #020606",
-"b c #72D0D0",
-"c c #010404",
-"d c #313333",
-" ",
-" .+@###$%&*=-. ",
-" .;;;>,')!~;;. ",
-" .+;{]^/(^_:-. ",
-" +<;[}|1:;2- ",
-" +@;;345;;=- ",
-" @#;;6_;*= ",
-" ##;78&* ",
-" ##'%& ",
-" #'% ",
-" #'% ",
-" #'% ",
-" 9'0 ",
-" $'a ",
-" #bc ",
-" ##d "};
diff --git a/app/bin/bitmaps/funnelclear.png b/app/bin/bitmaps/funnelclear.png
new file mode 100644
index 0000000..171809b
--- /dev/null
+++ b/app/bin/bitmaps/funnelclear.png
Binary files differ
diff --git a/app/bin/bitmaps/funnelclear.xpm b/app/bin/bitmaps/funnelclear.xpm
deleted file mode 100644
index 45d948f..0000000
--- a/app/bin/bitmaps/funnelclear.xpm
+++ /dev/null
@@ -1,124 +0,0 @@
-/* XPM */
-static char * funnelclear_xpm[] = {
-"16 16 105 2",
-" c None",
-". c #216262",
-"+ c #123737",
-"@ c #030A0A",
-"# c #000000",
-"$ c #010303",
-"% c #050E0E",
-"& c #091C1C",
-"* c #0F2E2E",
-"= c #164242",
-"- c #1C5353",
-"; c #76D1D1",
-"> c #82D5D5",
-", c #79D2D2",
-"' c #62CBCB",
-") c #65CCCC",
-"! c #75D1D1",
-"~ c #80D5D5",
-"{ c #7AAEAE",
-"] c #9D5E5E",
-"^ c #6DA5A5",
-"/ c #39ACAC",
-"( c #3BB1B1",
-"_ c #42C0C0",
-": c #57C7C7",
-"< c #8AB6B6",
-"[ c #A21717",
-"} c #7D4747",
-"| c #92BABA",
-"1 c #9F6464",
-"2 c #FF7777",
-"3 c #9C6060",
-"4 c #6CA5A5",
-"5 c #4BC3C3",
-"6 c #7BD3D3",
-"7 c #86B4B4",
-"8 c #A16767",
-"9 c #F87070",
-"0 c #A70000",
-"a c #9C0101",
-"b c #FE7676",
-"c c #D44C4C",
-"d c #FA7272",
-"e c #965C5C",
-"f c #70AAAA",
-"g c #85B4B4",
-"h c #9B6464",
-"i c #EA6262",
-"j c #E45C5C",
-"k c #A30000",
-"l c #8C0303",
-"m c #990000",
-"n c #EF6767",
-"o c #BE3636",
-"p c #E65E5E",
-"q c #955F5F",
-"r c #996464",
-"s c #D74F4F",
-"t c #CD4545",
-"u c #A00000",
-"v c #A10000",
-"w c #880000",
-"x c #940000",
-"y c #DB5353",
-"z c #B72E2E",
-"A c #C63D3D",
-"B c #BA3131",
-"C c #9F1515",
-"D c #A81E1E",
-"E c #9B0000",
-"F c #9C0000",
-"G c #830000",
-"H c #8F0000",
-"I c #B42525",
-"J c #A21111",
-"K c #A51414",
-"L c #970000",
-"M c #980000",
-"N c #910000",
-"O c #8B0000",
-"P c #AF1515",
-"Q c #AC1111",
-"R c #920000",
-"S c #8C0000",
-"T c #8D0000",
-"U c #B81111",
-"V c #870000",
-"W c #C41111",
-"X c #800202",
-"Y c #820000",
-"Z c #D01111",
-"` c #7C6161",
-" . c #5A0606",
-".. c #570000",
-"+. c #720000",
-"@. c #D81111",
-"#. c #6C0000",
-"$. c #5FAFAF",
-"%. c #020606",
-"&. c #340000",
-"*. c #5F0000",
-"=. c #270000",
-"-. c #6AC2C2",
-";. c #360000",
-">. c #313333",
-" ",
-" . + @ # # # $ % & * = - . ",
-" . ; ; ; > , ' ) ! ~ ; ; . ",
-" . + ; { ] ^ / ( _ : < [ } ",
-" + | 1 2 3 4 5 6 7 8 9 0 0 ",
-" + a b c d e f g h i c j k ",
-" l m n o p q r s o t u v ",
-" w x y z A B C D E F ",
-" G H I J J K L M ",
-" N O P Q Q Q R N ",
-" S T U U U U U U T S ",
-" V V W W W X V W W W V V ",
-" Y Z Z Z ` .G Y Z Z Z Y ",
-" ..+.@.#.$.%. ..+.@.+... ",
-" # &.*.=.-.$ # # ;.*.&.# ",
-" # # >. "};
diff --git a/app/bin/bitmaps/greendot.png b/app/bin/bitmaps/greendot.png
new file mode 100644
index 0000000..e48b1c2
--- /dev/null
+++ b/app/bin/bitmaps/greendot.png
Binary files differ
diff --git a/app/bin/bitmaps/greendot.xpm b/app/bin/bitmaps/greendot.xpm
deleted file mode 100644
index 8c44035..0000000
--- a/app/bin/bitmaps/greendot.xpm
+++ /dev/null
@@ -1,23 +0,0 @@
-/* XPM */
-static char * greendot[] = {
-"16 16 4 1",
-" c None",
-". c #000000",
-"+ c #4E9A06",
-"@ c #59A51A",
-" ",
-" ",
-" .... ",
-" ..++++.. ",
-" .+@@@++++. ",
-" .@@@@@+++. ",
-" .+@@@@@++++. ",
-" .+@@@@@++++. ",
-" .++@@@+++++. ",
-" .++++++++++. ",
-" .++++++++. ",
-" .++++++++. ",
-" ..++++.. ",
-" .... ",
-" ",
-" "};
diff --git a/app/bin/bitmaps/greenstar.png b/app/bin/bitmaps/greenstar.png
new file mode 100644
index 0000000..b4e4c51
--- /dev/null
+++ b/app/bin/bitmaps/greenstar.png
Binary files differ
diff --git a/app/bin/bitmaps/greenstar.xpm b/app/bin/bitmaps/greenstar.xpm
deleted file mode 100644
index b83a4b9..0000000
--- a/app/bin/bitmaps/greenstar.xpm
+++ /dev/null
@@ -1,69 +0,0 @@
-/* XPM */
-static char * greenstar[] = {
-"16 16 50 1",
-" c None",
-". c #264706",
-"+ c #274906",
-"@ c #346408",
-"# c #386C09",
-"$ c #478A0D",
-"% c #46880C",
-"& c #224007",
-"* c #131D0A",
-"= c #234207",
-"- c #274B06",
-"; c #2D5306",
-"> c #305A07",
-", c #3A700A",
-"' c #4D960E",
-") c #4A900D",
-"! c #356508",
-"~ c #264806",
-"{ c #203B07",
-"] c #1C3508",
-"^ c #203C07",
-"/ c #42800C",
-"( c #478B0D",
-"_ c #529E0F",
-": c #4C940E",
-"< c #46890D",
-"[ c #417E0B",
-"} c #3C730A",
-"| c #1B3208",
-"1 c #346208",
-"2 c #4B920E",
-"3 c #498F0D",
-"4 c #45850C",
-"5 c #407C0B",
-"6 c #315B07",
-"7 c #336108",
-"8 c #44840C",
-"9 c #2E5507",
-"0 c #3F7A0B",
-"a c #3F790B",
-"b c #3C740A",
-"c c #2B5106",
-"d c #1F3808",
-"e c #386B09",
-"f c #234107",
-"g c #2A4F06",
-"h c #182C09",
-"i c #2E5707",
-"j c #1A3008",
-"k c #172B09",
-" ",
-" ",
-" ",
-" .+ ",
-" @# ",
-" $%& ",
-" *=-;>,')!~={] ",
-" ^#/('_:<[}@| ",
-" 1%)23456 ",
-" 74%8[9 ",
-" ,05abc ",
-" deef;e1 ",
-" &gh di| ",
-" j k ",
-" ",
-" "};
diff --git a/app/bin/bitmaps/greydot.png b/app/bin/bitmaps/greydot.png
new file mode 100644
index 0000000..6e45a24
--- /dev/null
+++ b/app/bin/bitmaps/greydot.png
Binary files differ
diff --git a/app/bin/bitmaps/greydot.xpm b/app/bin/bitmaps/greydot.xpm
deleted file mode 100644
index 771a096..0000000
--- a/app/bin/bitmaps/greydot.xpm
+++ /dev/null
@@ -1,25 +0,0 @@
-/* XPM */
-static char * greydot[] = {
-"16 16 6 1",
-" c None",
-". c #000000",
-"+ c #30312F",
-"@ c #959792",
-"# c #888A85",
-"$ c #A2A49F",
-" ",
-" ",
-" .... ",
-" .+@@@@+. ",
-" .#$$$@@@#. ",
-" +$$$$$@@@+ ",
-" .@$$$$$@@@@. ",
-" .@$$$$$@@@@. ",
-" .@@$$$@@@@@. ",
-" .@@@@@@@@@@. ",
-" +@@@@@@@@+ ",
-" .#@@@@@@#. ",
-" .+@@@@+. ",
-" .... ",
-" ",
-" "};
diff --git a/app/bin/bitmaps/greystar.png b/app/bin/bitmaps/greystar.png
new file mode 100644
index 0000000..5d6f465
--- /dev/null
+++ b/app/bin/bitmaps/greystar.png
Binary files differ
diff --git a/app/bin/bitmaps/greystar.xpm b/app/bin/bitmaps/greystar.xpm
deleted file mode 100644
index e7c5300..0000000
--- a/app/bin/bitmaps/greystar.xpm
+++ /dev/null
@@ -1,69 +0,0 @@
-/* XPM */
-static char * greystar[] = {
-"16 16 50 1",
-" c None",
-". c #5A5B57",
-"+ c #5B5D59",
-"@ c #6D6F6A",
-"# c #73756F",
-"$ c #878984",
-"% c #868882",
-"& c #555652",
-"* c #3D3F3C",
-"= c #565854",
-"- c #5C5E59",
-"; c #62645F",
-"> c #676964",
-", c #757772",
-"' c #8F918C",
-") c #8B8D88",
-"! c #6E706A",
-"~ c #5A5C58",
-"{ c #51534F",
-"] c #4D4F4B",
-"^ c #525450",
-"/ c #81837D",
-"( c #888A84",
-"_ c #959792",
-": c #8E908A",
-"< c #868983",
-"[ c #7F817B",
-"} c #787A74",
-"| c #4C4D49",
-"1 c #6C6E69",
-"2 c #8D8F8A",
-"3 c #8B8D87",
-"4 c #848680",
-"5 c #7D807A",
-"6 c #686A65",
-"7 c #6B6D68",
-"8 c #83857F",
-"9 c #646561",
-"0 c #7D7F79",
-"a c #7C7E78",
-"b c #787B75",
-"c c #60625D",
-"d c #50514D",
-"e c #72746E",
-"f c #565753",
-"g c #5F615D",
-"h c #474945",
-"i c #646661",
-"j c #4A4B48",
-"k c #474844",
-" ",
-" ",
-" ",
-" .+ ",
-" @# ",
-" $%& ",
-" *=-;>,')!~={] ",
-" ^#/('_:<[}@| ",
-" 1%)23456 ",
-" 74%8[9 ",
-" ,05abc ",
-" deef;e1 ",
-" &gh di| ",
-" j k ",
-" ",
-" "};
diff --git a/app/bin/bitmaps/loosen.png b/app/bin/bitmaps/loosen.png
new file mode 100644
index 0000000..cefff17
--- /dev/null
+++ b/app/bin/bitmaps/loosen.png
Binary files differ
diff --git a/app/bin/bitmaps/loosen.xpm b/app/bin/bitmaps/loosen.xpm
deleted file mode 100644
index 9a92872..0000000
--- a/app/bin/bitmaps/loosen.xpm
+++ /dev/null
@@ -1,183 +0,0 @@
-static char *loosen_x16[] = {
- "16 16 24 1",
- " c None",
- "0 c #4878c8",
- "1 c #c80000",
- "2 c #c86868",
- "3 c #6890c8",
- "4 c #78a8e8",
- "5 c #c82020",
- "6 c #5880c8",
- "7 c #7890b0",
- "8 c #c83838",
- "9 c #c81010",
- "A c #8090b8",
- "B c #88b0e8",
- "C c #c87070",
- "D c #5888d0",
- "E c #c82828",
- "F c #7090b8",
- "G c #5078c0",
- "H c #6088d0",
- "I c #c87878",
- "J c #c83030",
- "K c #c84040",
- "L c #6890d0",
- "M c #7890b8",
- " ",
- " ",
- " ",
- " D D 3 3 D D ",
- " 0A0A6M M6A0A0 ",
- " 4 4 B B 4 4 ",
- " 0707GF FG7070 ",
- " H H L L H H ",
- " EC2E ",
- " 89 9J ",
- " 1I 1C ",
- " K9 98 ",
- " 5C2E ",
- " ",
- " ",
- " "};
-static char *loosen_x24[] = {
- "24 24 38 1",
- " c None",
- "0 c #084098",
- "1 c #c80000",
- "2 c #3870c8",
- "3 c #c84848",
- "4 c #4888e8",
- "5 c #2058c0",
- "6 c #c81818",
- "7 c #78a8e8",
- "8 c #6080b8",
- "9 c #4870b0",
- "A c #c86868",
- "B c #6090e8",
- "C c #4068b0",
- "D c #90a8d0",
- "E c #5878a8",
- "F c #c82828",
- "G c #c80808",
- "H c #3068b8",
- "I c #5890f8",
- "J c #7088b0",
- "K c #6898f0",
- "L c #5880b8",
- "M c #c85858",
- "N c #c87070",
- "O c #88a8e8",
- "P c #104098",
- "Q c #3068c8",
- "R c #2860b8",
- "S c #6898e0",
- "T c #c81010",
- "U c #4070c0",
- "V c #5070a8",
- "W c #104898",
- "X c #c83030",
- "Y c #c82020",
- "Z c #c85050",
- "a c #c87878",
- " ",
- " ",
- " ",
- " ",
- " ",
- " LUJJQJJ28 82JJQJJUL ",
- " CHEV5EER9 9REE5VEHC ",
- " 7 I K K I 7 ",
- " 7 I K K I 7 ",
- " DS 4 B B 4 SD ",
- " P0PW0PP0P P0PP0WP0P ",
- " O K 7 7 K O ",
- " ZG 1M ",
- " N1G 11A ",
- " 11 11a ",
- " G1M A11 ",
- " 316 Y1X ",
- " F1X X1Y ",
- " T1 1T ",
- " A M ",
- " ",
- " ",
- " ",
- " "};
-static char *loosen_x32[] = {
- "32 32 41 1",
- " c None",
- "0 c #0840a0",
- "1 c #c80000",
- "2 c #7088b0",
- "3 c #c82828",
- "4 c #3068c0",
- "5 c #5090f8",
- "6 c #2058bc",
- "7 c #80a8e8",
- "8 c #c85050",
- "9 c #6078b0",
- "A c #c81010",
- "B c #3058a0",
- "C c #689df0",
- "D c #486ca8",
- "E c #205098",
- "F c #c83838",
- "G c #95b0e0",
- "H c #4068a0",
- "I c #c86060",
- "J c #1648a0",
- "K c #4870b8",
- "L c #3d68b0",
- "M c #2860b8",
- "N c #2050a4",
- "O c #1048a8",
- "P c #c84343",
- "Q c #c80808",
- "R c #c81919",
- "S c #5070a9",
- "T c #70a0f0",
- "U c #c86c6c",
- "V c #6480b0",
- "W c #4070b8",
- "X c #5890f8",
- "Y c #2860c4",
- "Z c #3860a0",
- "a c #c83030",
- "b c #2850a0",
- "c c #1850a8",
- "d c #88a8e8",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " 7G T C C T G7 ",
- " VMLSSL6SSS6LV VL6SSS6LSSLMV ",
- " DcNBBNOBBBObD DbOBBBONBBNcD ",
- " Cd GX 5 5 XG dC ",
- " Cd GX 5 5 XG dC ",
- " Cd GX 5 5 XG dC ",
- " Cd GX 5 5 XG dC ",
- " ZJJEEJ0EEE0JH HJ0EEE0JEEJJZ ",
- " 24W99KY999YS2 2SY999YK99W42 ",
- " 7G T C C T G7 ",
- " QF R1 ",
- " 111 11Q ",
- " A11U I11Q ",
- " 311P 811R ",
- " P113 P11R ",
- " 8113 F113 ",
- " a11P P11R ",
- " A11U I11A ",
- " 111 11Q ",
- " 1a R1 ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " "};
-
-static char **loosen_xpm[3] = { loosen_x16, loosen_x24, loosen_x32 };
diff --git a/app/bin/bitmaps/mkimage3.cmake b/app/bin/bitmaps/mkimage3.cmake
new file mode 100755
index 0000000..780a36a
--- /dev/null
+++ b/app/bin/bitmaps/mkimage3.cmake
@@ -0,0 +1,9 @@
+
+set ( IMG ${CMAKE_ARGV3} )
+
+file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${IMG}.image3 "#include \"${IMG}16.image1\"\n" )
+file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/${IMG}.image3 "#include \"${IMG}24.image1\"\n" )
+file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/${IMG}.image3 "#include \"${IMG}32.image1\"\n" )
+STRING(MAKE_C_IDENTIFIER ${IMG} NAME )
+file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/${IMG}.image3 "static wIconBitMap_t ${NAME}_image3[3] = { ${NAME}16_image1, ${NAME}24_image1, ${NAME}32_image1 };\n" )
+ #MESSAGE( "OUTFILE=${CMAKE_CURRENT_BINARY_DIR}/${IMG}.image3" )
diff --git a/app/bin/bitmaps/note.png b/app/bin/bitmaps/note.png
new file mode 100644
index 0000000..cefff17
--- /dev/null
+++ b/app/bin/bitmaps/note.png
Binary files differ
diff --git a/app/bin/bitmaps/note.xpm b/app/bin/bitmaps/note.xpm
deleted file mode 100644
index 51bf8c7..0000000
--- a/app/bin/bitmaps/note.xpm
+++ /dev/null
@@ -1,114 +0,0 @@
-static char *note_x16[] = {
- "16 16 10 1",
- " c None",
- "0 c #000000",
- "1 c #0066CC",
- "2 c #999999",
- "3 c #CC9900",
- "4 c #CC9933",
- "5 c #CC9999",
- "6 c #FFCC00",
- "7 c #FFCC33",
- "8 c #FFCC66",
- " ",
- " ",
- " ",
- " 444444444444 ",
- " 46666666666344 ",
- " 46888888886664 ",
- " 47222222227664 ",
- " 46522222566664 ",
- " 46788888866664 ",
- " 47111111117664 ",
- " 46666666666664 ",
- " 46666666666664 ",
- " 47777777777774 ",
- " ",
- " ",
- " "};
-
-static char *note_x24[] = {
- "24 24 10 1",
- " c None",
- "0 c #000000",
- "1 c #999999",
- "2 c #CC9900",
- "3 c #CC9933",
- "4 c #CC9999",
- "5 c #CCCC66",
- "6 c #FFCC00",
- "7 c #FFCC33",
- "8 c #FFCC66",
- " ",
- " ",
- " ",
- " ",
- " ",
- " 37777777777333333 ",
- " 3666666666666666233 ",
- " 36666666666666662223 ",
- " 36788888888888766663 ",
- " 36411111111111566663 ",
- " 36666666666666666663 ",
- " 36611111111156666663 ",
- " 36688888888876666663 ",
- " 36844444444444866663 ",
- " 36544444444444566663 ",
- " 36666666666666666663 ",
- " 36666666666666666663 ",
- " 36666666666666666663 ",
- " 37777777777777777773 ",
- " ",
- " ",
- " ",
- " ",
- " "};
-
-static char *note_x32[] = {
- "32 32 11 1",
- " c None",
- "0 c #000000",
- "1 c #0066CC",
- "2 c #3399CC",
- "3 c #999999",
- "4 c #CC9900",
- "5 c #CC9933",
- "6 c #CCCC00",
- "7 c #FFCC00",
- "8 c #FFCC33",
- "9 c #FFCC66",
- " ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " 55555555 ",
- " 57777778888888888888855 ",
- " 877777777777777777777445 ",
- " 8777777777777777777774445 ",
- " 87777777777777777777774465 ",
- " 87799999999999999997777775 ",
- " 87833333333333333337777775 ",
- " 87777777777777777777777775 ",
- " 87777777777777777777777775 ",
- " 87782111111111128777777775 ",
- " 87777777777777777777777775 ",
- " 87777777777777777777777775 ",
- " 87833333333333333337777775 ",
- " 87799999999999999997777775 ",
- " 87777777777777777777777775 ",
- " 87777777777777777777777775 ",
- " 87777777777777777777777775 ",
- " 87777777777777777777777775 ",
- " 58888887777777777777777775 ",
- " 55555555555555555555 ",
- " ",
- " ",
- " ",
- " ",
- " ",
- " "};
-
-static char *note_xpm[3] = { note_x16, note_x24, note_x32 };
-
diff --git a/app/bin/bitmaps/partlist.png b/app/bin/bitmaps/partlist.png
new file mode 100644
index 0000000..32b2ac4
--- /dev/null
+++ b/app/bin/bitmaps/partlist.png
Binary files differ
diff --git a/app/bin/bitmaps/partlist.xpm b/app/bin/bitmaps/partlist.xpm
deleted file mode 100644
index 78c4674..0000000
--- a/app/bin/bitmaps/partlist.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static char * partlist_xpm[] = {
-"16 16 2 1",
-" c None",
-". c #000000000000",
-" . . . ",
-"..... . . ",
-" . . . ",
-"..... . ",
-" . . . ",
-" ",
-". .. .. .. ",
-". . . . .",
-". . .. .. .. ",
-". . . . . .",
-". .. .. . .",
-" ... . . ",
-" . . . . ",
-" . .. ... . ",
-" . . . ",
-" . . ..."};
diff --git a/app/bin/bitmaps/pause.png b/app/bin/bitmaps/pause.png
new file mode 100644
index 0000000..cefff17
--- /dev/null
+++ b/app/bin/bitmaps/pause.png
Binary files differ
diff --git a/app/bin/bitmaps/pause.xpm b/app/bin/bitmaps/pause.xpm
deleted file mode 100644
index da61446..0000000
--- a/app/bin/bitmaps/pause.xpm
+++ /dev/null
@@ -1,147 +0,0 @@
-static char* pause_x16[] = {
- "16 16 20 1",
- " c None",
- "0 c #000000",
- "1 c #003300",
- "2 c #003333",
- "3 c #006633",
- "4 c #009966",
- "5 c #333333",
- "6 c #336633",
- "7 c #336666",
- "8 c #339966",
- "9 c #33CC99",
- "A c #666666",
- "B c #66CC99",
- "C c #99CC99",
- "D c #99CCCC",
- "E c #CCCCCC",
- "F c #CCFFCC",
- "G c #CCFFFF",
- "H c #FFFFFF",
- "I c #808080",
- " 0 ",
- " 00000 ",
- " 01133300 ",
- " 001688887210 ",
- " 01688888888821 ",
- " 07CCCCDDDDDDC5 ",
- " 0AEEEEEEEEEEE5 ",
- " 0IHHHHHHHHHHG5 ",
- " 0IHHHHHHHHHHG5 ",
- " 0AFFFFFFFFFFD5 ",
- " 07DDDDDDDDDDC2 ",
- " 05BBBBBBBBBBB2 ",
- " 128BBBBBB9720 ",
- " 0128999810 ",
- " 0134210 ",
- " 020 "};
-
-static char* pause_x24[] = {
- "24 24 22 1",
- " c None",
- "0 c #000000",
- "1 c #003300",
- "2 c #003333",
- "3 c #006633",
- "4 c #009966",
- "5 c #333333",
- "6 c #336633",
- "7 c #336666",
- "8 c #339966",
- "9 c #33CC66",
- "A c #33CC99",
- "B c #666666",
- "C c #669999",
- "D c #66CC99",
- "E c #99CCCC",
- "F c #99FFCC",
- "G c #CCCCCC",
- "H c #CCFFCC",
- "I c #CCFFFF",
- "J c #FFFFFF",
- "K c #808080",
- " ",
- " 000 ",
- " 0012000 ",
- " 0003333300 ",
- " 0036777773210 ",
- " 01278888888887100 ",
- " 01278888888888888710 ",
- " 05CCCCCCCCCCCCCCCCC0 ",
- " 07EEEEEEEEEEEEEEEEE0 ",
- " 0BGGGGGGGGGGGGGGGGG0 ",
- " 0BIIIIIIIIIIIIIIIII0 ",
- " 0KJJJJJJJJJJJJJJJJJ0 ",
- " 0KJJJJJJJJJJJJJJJJJ0 ",
- " 0BHHHHHHHHHHHHHHHHH0 ",
- " 0BFFFFFFFFFFFFFFFFF0 ",
- " 07EEEEEEEEEEEEEEEEE0 ",
- " 07DDDDDDDDDDDDDDDDD0 ",
- " 02DDDDDDDDDDDDDDDDC1 ",
- " 027DDDDDDDDDDDDA620 ",
- " 028AAAAAAAAA720 ",
- " 0128AAAA9811 ",
- " 013894110 ",
- " 01210 ",
- " 0 "};
-
-static char* pause_x32[] = {
- "32 32 22 1",
- " c None",
- "0 c #000000",
- "1 c #003300",
- "2 c #003333",
- "3 c #006633",
- "4 c #009966",
- "5 c #333333",
- "6 c #336633",
- "7 c #336666",
- "8 c #339966",
- "9 c #339999",
- "A c #33CC66",
- "B c #33CC99",
- "C c #669966",
- "D c #66CC99",
- "E c #99CC99",
- "F c #99CCCC",
- "G c #99FFCC",
- "H c #CCCCCC",
- "I c #CCFFCC",
- "J c #CCFFFF",
- "K c #FFFFFF",
- " ",
- " ",
- " 00000 ",
- " 0023300 ",
- " 00233333200 ",
- " 011333333333210 ",
- " 0013777777777776100 ",
- " 006888888888888888600 ",
- " 0168888888888888888888210 ",
- " 018CCCCCCCCCCCCCCCCCCCCC810 ",
- " 05EEEEEEEEEEEEEEEEEEEEEEE50 ",
- " 05FFFFFFFFFFFFFFFFFFFFFFF50 ",
- " 05HHHHHHHHHHHHHHHHHHHHHHH50 ",
- " 05IIIIIIIIIIIIIIIIIIIIIII50 ",
- " 05KKKKKKKKKKKKKKKKKKKKKKK50 ",
- " 05KKKKKKKKKKKKKKKKKKKKKKK50 ",
- " 06KKKKKKKKKKKKKKKKKKKKKKK60 ",
- " 05JJJJJJJJJJJJJJJJJJJJJJJ50 ",
- " 05IIIIIIIIIIIIIIIIIIIIIII50 ",
- " 05GGGGGGGGGGGGGGGGGGGGGGG50 ",
- " 05FFFFFFFFFFFFFFFFFFFFFFF50 ",
- " 05FFFFFFFFFFFFFFFFFFFFFFF50 ",
- " 05DDDDDDDDDDDDDDDDDDDDDDD50 ",
- " 028DDDDDDDDDDDDDDDDDDDDD820 ",
- " 0228DDDDDDDDDDDDDDDDD9220 ",
- " 026BBBBBBBBBBBBBBB620 ",
- " 028BBBBBBBBBBB820 ",
- " 128AAAAAAA821 ",
- " 0128AAA4210 ",
- " 0134310 ",
- " 010 ",
- " "};
-
-static char *pause_xpm[3] = { pause_x16, pause_x24, pause_x32 };
-
diff --git a/app/bin/bitmaps/png/down16.png b/app/bin/bitmaps/png/down16.png
index e272de2..53220c6 100644
--- a/app/bin/bitmaps/png/down16.png
+++ b/app/bin/bitmaps/png/down16.png
Binary files differ
diff --git a/app/bin/bitmaps/png/down24.png b/app/bin/bitmaps/png/down24.png
index 0b72634..d51c8ef 100644
--- a/app/bin/bitmaps/png/down24.png
+++ b/app/bin/bitmaps/png/down24.png
Binary files differ
diff --git a/app/bin/bitmaps/reddot.png b/app/bin/bitmaps/reddot.png
new file mode 100644
index 0000000..6c8aaf3
--- /dev/null
+++ b/app/bin/bitmaps/reddot.png
Binary files differ
diff --git a/app/bin/bitmaps/reddot.xpm b/app/bin/bitmaps/reddot.xpm
deleted file mode 100644
index 14529bf..0000000
--- a/app/bin/bitmaps/reddot.xpm
+++ /dev/null
@@ -1,26 +0,0 @@
-/* XPM */
-static char * reddot[] = {
-"16 16 7 1",
-" c None",
-". c #000000",
-"+ c #CC0000",
-"@ c #CA1F1E",
-"# c #E62E16",
-"$ c #C04E4B",
-"% c #B25F5B",
-" ",
-" ",
-" .... ",
-" ..$@@$.. ",
-" .%###+++%. ",
-" .#####+++. ",
-" .$#####+++$. ",
-" .@#####+++@. ",
-" .@+###++++@. ",
-" .$++++++++$. ",
-" .++++++++. ",
-" .%++++++%. ",
-" ..$@@$.. ",
-" .... ",
-" ",
-" "};
diff --git a/app/bin/bitmaps/redstar.png b/app/bin/bitmaps/redstar.png
new file mode 100644
index 0000000..5cb3a9c
--- /dev/null
+++ b/app/bin/bitmaps/redstar.png
Binary files differ
diff --git a/app/bin/bitmaps/redstar.xpm b/app/bin/bitmaps/redstar.xpm
deleted file mode 100644
index b9f51f9..0000000
--- a/app/bin/bitmaps/redstar.xpm
+++ /dev/null
@@ -1,67 +0,0 @@
-/* XPM */
-static char * redstar[] = {
-"16 16 48 1",
-" c None",
-". c #950800",
-"+ c #980800",
-"@ c #B50A00",
-"# c #BF0A00",
-"$ c #E00C00",
-"% c #DE0C00",
-"& c #8D0800",
-"* c #670600",
-"= c #900800",
-"- c #990800",
-"; c #A30900",
-"> c #AC0900",
-", c #C30B00",
-"' c #ED0D00",
-") c #E70C00",
-"! c #B70A00",
-"~ c #960800",
-"{ c #870700",
-"] c #810700",
-"^ c #890700",
-"/ c #D60C00",
-"( c #E20C00",
-"_ c #F70D00",
-": c #EC0D00",
-"< c #D30B00",
-"[ c #C70B00",
-"} c #7E0700",
-"| c #B40A00",
-"1 c #EA0D00",
-"2 c #DB0C00",
-"3 c #D10B00",
-"4 c #AD0900",
-"5 c #B20A00",
-"6 c #D90C00",
-"7 c #A50900",
-"8 c #D00B00",
-"9 c #CE0B00",
-"0 c #C90B00",
-"a c #A00900",
-"b c #850700",
-"c c #BE0A00",
-"d c #8E0800",
-"e c #9E0900",
-"f c #770600",
-"g c #A70900",
-"h c #7B0700",
-"i c #760600",
-" ",
-" ",
-" ",
-" .+ ",
-" @# ",
-" $%& ",
-" *=-;>,')!~={] ",
-" ^#/('_:$<[@} ",
-" |%)1)234 ",
-" 52%6<7 ",
-" ,8390a ",
-" bccd;c| ",
-" &ef bg} ",
-" h i ",
-" ",
-" "};
diff --git a/app/bin/bitmaps/struct.png b/app/bin/bitmaps/struct.png
new file mode 100644
index 0000000..678c92d
--- /dev/null
+++ b/app/bin/bitmaps/struct.png
Binary files differ
diff --git a/app/bin/bitmaps/struct.xpm b/app/bin/bitmaps/struct.xpm
deleted file mode 100644
index a37979c..0000000
--- a/app/bin/bitmaps/struct.xpm
+++ /dev/null
@@ -1,22 +0,0 @@
-/* XPM */
-static char * struct_xpm[] = {
-"16 16 3 1",
-"o c None",
-" c #000000000000",
-". c #FFFFFFFFFFFF",
-" ",
-" ............ ",
-" . .......... . ",
-" .. ........ .. ",
-" ... ...... ... ",
-" .... .... ",
-" ... ...... ... ",
-" .. ........ .. ",
-" . .......... . ",
-" ............ ",
-" ",
-"o ............ o",
-"oo .......... oo",
-"ooo ........ ooo",
-"oooo oo ",
-"oooooooooooooo "};
diff --git a/app/bin/bitmaps/svg/down.svg b/app/bin/bitmaps/svg/down.svg
index 41f83fb..c936d22 100644
--- a/app/bin/bitmaps/svg/down.svg
+++ b/app/bin/bitmaps/svg/down.svg
@@ -1,56 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="210mm"
+ height="297mm"
+ viewBox="0 0 210 297"
version="1.1"
- id="Layer_1"
- x="0px"
- y="0px"
- viewBox="0 0 24 48"
- style="enable-background:new 0 0 24 48;"
- xml:space="preserve"
- sodipodi:docname="down.svg"
- inkscape:version="1.0.2-2 (e86c870879, 2021-01-15)"><metadata
- id="metadata13"><rdf:RDF><cc:Work
- rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
- id="defs11" /><sodipodi:namedview
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1"
- objecttolerance="10"
- gridtolerance="10"
- guidetolerance="10"
- inkscape:pageopacity="0"
- inkscape:pageshadow="2"
- inkscape:window-width="1647"
- inkscape:window-height="933"
- id="namedview9"
- showgrid="false"
- inkscape:zoom="11.681573"
- inkscape:cx="10.715926"
- inkscape:cy="22.589078"
- inkscape:window-x="0"
- inkscape:window-y="0"
- inkscape:window-maximized="0"
- inkscape:current-layer="Layer_1"
- inkscape:document-rotation="0" />
-<style
- type="text/css"
- id="style2">
- .st0{stroke:#000000;stroke-miterlimit:10;}
-</style>
-
-
-<path
- id="path838"
- style="fill:#000000;fill-opacity:1;stroke-width:0.542529;stroke-linecap:square"
- inkscape:transform-center-x="0.02977867"
- inkscape:transform-center-y="-0.65983518"
- d="m 21.394513,16.625061 -18.8746311,0.01685 0.1253841,3.396706 9.422005,11.319468 9.386564,-11.355799 z"
- sodipodi:nodetypes="cccccc" /></svg>
+ id="svg5"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <defs
+ id="defs2" />
+ <g
+ id="layer1" />
+</svg>
diff --git a/app/bin/bitmaps/xtc.png b/app/bin/bitmaps/xtc.png
new file mode 100644
index 0000000..166e50f
--- /dev/null
+++ b/app/bin/bitmaps/xtc.png
Binary files differ
diff --git a/app/bin/bitmaps/xtc.xpm b/app/bin/bitmaps/xtc.xpm
deleted file mode 100644
index 3c13e32..0000000
--- a/app/bin/bitmaps/xtc.xpm
+++ /dev/null
@@ -1,83 +0,0 @@
-/* XPM */
-static char * xtc_xpm[] = {
-"64 64 16 1",
-" c None",
-". c #888A85",
-"+ c #555753",
-"@ c #D3D7CF",
-"# c #BABDB6",
-"$ c #EEEEEC",
-"% c #4E9A06",
-"& c #73D216",
-"* c #8AE234",
-"= c #E9B96E",
-"- c #FCAF3E",
-"; c #C4A000",
-"> c #C17D11",
-", c #8F5902",
-"' c #F57900",
-") c #2E3436",
-" .......................................+++++++++++ ",
-" .@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.+ ",
-" .#$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$. ",
-" .#$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$. ",
-" .#$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$. ",
-" .#$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$. ",
-" .#$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$. ",
-" .#$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$. ",
-" .#$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$. ",
-" .#$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$. ",
-" .#$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+ ",
-" .#$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+ ",
-" ..$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+ ",
-" ..$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+ ",
-" ..$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+ ",
-" ..$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+ ",
-" ..$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+ ",
-" ..$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+ ",
-" ..$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+ ",
-" ..$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@@+ ",
-" ..$$$@$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@%%+ ",
-" ..$$@#@$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#%&@+ ",
-" ..$$$@$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@%%*@@+ ",
-" ..$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%&*@**+ ",
-" ..$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@%*@=***+ ",
-" ..$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#%*=***&%+ ",
-" ..$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%*@***&%%+ ",
-" ..$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@%&*****%%%%+ ",
-" ..$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@%&=@***%%%%@+ ",
-" ..$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$=%*=***&%%%%#$+ ",
-" ..$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$@%&*@***&%%%%@$$+ ",
-" ..$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$@%&*=***%%%%%@$$$+ ",
-" +.$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$#%**=**&%%%%#$$$$$+ ",
-" +.$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$=%*=@**&%%%%@$$$$$$+ ",
-" +.$$$$$$@$$$$$$$$$$$$$$$$$$$$$$=-*@***%%%%%@$$$$$$$+ ",
-" +.$$$$$$@$$$===$$$$$$$$$$$$$$$=--=**&%%%%#$$$$$$$$$+ ",
-" +.$$$$$$@$$@@@@===$$$$$$$$$$$@----;*%%%%@$$$$$$$$$$+ ",
-" +.$$$@$$@$$@#.#=@=@=@$$$$$$$@------;%%%@$$$$$$$$$$$+ ",
-" +.$$@#@$@$$$$=..#=@==@@@$$$$--------;%$$$$$$$$$$$$$+ ",
-" +.$$$@$$@$$$@@=@#.=@=$===@==------=@$$$$$$$$$$$$$$$+ ",
-" +.$$$$$$@$$$#@=@=@...@==@==------=@$$$$$$$$$$$$$$$$+ ",
-" +.$$$$$$@$$@#.=##===@...#=-----====$==$@@$$@$$$$$$$+ ",
-" +.$$$$$$@$$@==>,.>===-===>--=>======-==-'=='@==$$$$+ ",
-" +.$$$$$$@$$$#===.,,,==>.,>>==..====>======='==@$$$$+ ",
-" +.$$$$$$@$$$#==#==,.+.,++,=.=====>.,......=>==#$$$$+ ",
-" +.$$$$$$@$$$@@@@===$-@=...=#=#,,#,#===.=...,..#@$$$+ ",
-" +.$$$$$$@$$$@@=@=@=$======#.==#>#>@=====@===@=$$$$$+ ",
-" +.$$$$$$@$$$####=#=#=#====#=#>#,.....,....#####$$$$+ ",
-" +.$$$$$$@$$$####.#=#=#==#=###=#=#=#,.......####$$$$+ ",
-" +.$$$$$$@$$$@==@===$=@====@===$-==='=$===@==@==$$$$+ ",
-" +.$$$$$$@$$$$@=$@@@$@@@@@=$@@@$=@@$==$=-=$==$==@$$$+ ",
-" +.$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$@$$$@$$@$$$$+ ",
-" +.$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+ ",
-" +.$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+ ",
-" ++$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+ ",
-" ++$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+ ",
-" ++$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+ ",
-" )+$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+) ",
-" )+$$$$$$@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$+) ",
-" )+.###############################################.+ ",
-" )+++++++++++++++++++++++++++++++++++++++++++++++++ ",
-" ",
-" ",
-" "};
diff --git a/app/bin/bitmaps/yellowdot.png b/app/bin/bitmaps/yellowdot.png
new file mode 100644
index 0000000..1595ab2
--- /dev/null
+++ b/app/bin/bitmaps/yellowdot.png
Binary files differ
diff --git a/app/bin/bitmaps/yellowdot.xpm b/app/bin/bitmaps/yellowdot.xpm
deleted file mode 100644
index da0dddf..0000000
--- a/app/bin/bitmaps/yellowdot.xpm
+++ /dev/null
@@ -1,27 +0,0 @@
-/* XPM */
-static char * yellowdot[] = {
-"16 16 8 1",
-" c None",
-". c #000000",
-"+ c #B69A19",
-"@ c #E0C504",
-"# c #EBD200",
-"$ c #CFB410",
-"% c #EFD947",
-"& c #EDD400",
-" ",
-" ",
-" .... ",
-" .+@##@+. ",
-" .$%%%&&&$. ",
-" +%%%%%&&&+ ",
-" .@%%%%%&&&@. ",
-" .#%%%%%&&&#. ",
-" .#&%%%&&&&#. ",
-" .@&&&&&&&&@. ",
-" +&&&&&&&&+ ",
-" .$&&&&&&$. ",
-" .+@##@+. ",
-" .... ",
-" ",
-" "};
diff --git a/app/bin/bitmaps/yellowstar.png b/app/bin/bitmaps/yellowstar.png
new file mode 100644
index 0000000..11ffe78
--- /dev/null
+++ b/app/bin/bitmaps/yellowstar.png
Binary files differ
diff --git a/app/bin/bitmaps/yellowstar.xpm b/app/bin/bitmaps/yellowstar.xpm
deleted file mode 100644
index 637ad9c..0000000
--- a/app/bin/bitmaps/yellowstar.xpm
+++ /dev/null
@@ -1,67 +0,0 @@
-/* XPM */
-static char * yellowstar[] = {
-"16 16 48 1",
-" c None",
-". c #AB9600",
-"+ c #AE9900",
-"@ c #D0B600",
-"# c #DBC000",
-"$ c #FFDF02",
-"% c #FFDF00",
-"& c #A28D00",
-"* c #766700",
-"= c #A59000",
-"- c #B09A00",
-"; c #BBA400",
-"> c #C5AC00",
-", c #DFC300",
-"' c #FFE111",
-") c #FFE00A",
-"! c #D2B800",
-"~ c #AC9700",
-"{ c #9B8800",
-"] c #948100",
-"^ c #9D8A00",
-"/ c #F6D700",
-"( c #FFE004",
-"_ c #FFE31D",
-": c #FFE10F",
-"< c #F2D400",
-"[ c #E5C800",
-"} c #917F00",
-"| c #CEB500",
-"1 c #FFE10E",
-"2 c #FCDC00",
-"3 c #F0D200",
-"4 c #C7AE00",
-"5 c #CCB300",
-"6 c #FADB00",
-"7 c #BEA600",
-"8 c #EED100",
-"9 c #ECCF00",
-"0 c #E6CA00",
-"a c #B8A100",
-"b c #988500",
-"c c #DABE00",
-"d c #A38F00",
-"e c #B69F00",
-"f c #897800",
-"g c #BFA700",
-"h c #8D7B00",
-"i c #877600",
-" ",
-" ",
-" ",
-" .+ ",
-" @# ",
-" $%& ",
-" *=-;>,')!~={] ",
-" ^#/('_:$<[@} ",
-" |%)1)234 ",
-" 52%6<7 ",
-" ,8390a ",
-" bccd;c| ",
-" &ef bg} ",
-" h i ",
-" ",
-" "};
diff --git a/app/bin/bitmaps/zero.png b/app/bin/bitmaps/zero.png
new file mode 100644
index 0000000..55a90cb
--- /dev/null
+++ b/app/bin/bitmaps/zero.png
Binary files differ
diff --git a/app/bin/bitmaps/zero.xpm b/app/bin/bitmaps/zero.xpm
deleted file mode 100644
index d3466d5..0000000
--- a/app/bin/bitmaps/zero.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static char * zero_xpm[] = {
-"6 16 2 1",
-" c None",
-". c #000000000000",
-" ",
-" .... ",
-"......",
-".. ..",
-".. ..",
-".. ..",
-".. ..",
-".. ..",
-".. ..",
-".. ..",
-".. ..",
-".. ..",
-".. ..",
-"......",
-" .... ",
-" "};
diff --git a/app/bin/cbezier.c b/app/bin/cbezier.c
index 1e09e5d..f4ef6df 100644
--- a/app/bin/cbezier.c
+++ b/app/bin/cbezier.c
@@ -938,7 +938,7 @@ STATUS_T CmdBezModify (track_p trk, wAction_t action, coOrd pos, DIST_T trackG)
if (Da.state != PICK_POINT) { //Too early - abandon
InfoMessage(_("No changes made"));
Da.state = NONE;
- return C_CANCEL;
+ return C_CONTINUE;
}
UndoStart( _("Modify Bezier"), "newBezier - CR" );
UndoModify( trk );
@@ -1283,9 +1283,6 @@ STATUS_T CmdBezCurve( wAction_t action, coOrd pos )
}
-//#include "bitmaps/bezier-track.xpm"
-//#include "bitmaps/bezier-line.xpm"
-
EXPORT void InitCmdBezier( wMenu_p menu )
{
diff --git a/app/bin/cblock.c b/app/bin/cblock.c
index bc23e14..741052e 100644
--- a/app/bin/cblock.c
+++ b/app/bin/cblock.c
@@ -690,7 +690,8 @@ static void NewBlockDialog()
if ( !blockW ) {
ParamRegister( &blockPG );
blockW = ParamCreateDialog (&blockPG, MakeWindowTitle(_("Create Block")),
- _("Ok"), BlockOk, wHide, TRUE, NULL, F_BLOCK, NULL );
+ _("Ok"), BlockOk, ParamCancel_Current,
+ TRUE, NULL, F_BLOCK, NULL );
blockD.dpi = mainD.dpi;
}
ParamLoadControls( &blockPG );
@@ -862,7 +863,7 @@ static void EditBlock (track_p trk)
blockEditW = ParamCreateDialog (&blockEditPG,
MakeWindowTitle(_("Edit block")),
_("Ok"), BlockEditOk,
- wHide, TRUE, NULL, F_BLOCK,
+ ParamCancel_Current, TRUE, NULL, F_BLOCK,
NULL );
}
ParamLoadControls( &blockEditPG );
@@ -999,10 +1000,7 @@ static int BlockMgmProc ( int cmd, void * data )
}
-//#include "bitmaps/blocknew.xpm"
-//#include "bitmaps/blockedit.xpm"
-//#include "bitmaps/blockdel.xpm"
-#include "bitmaps/block.xpm3"
+#include "bitmaps/block.image3"
EXPORT void BlockMgmLoad( void )
{
@@ -1010,7 +1008,7 @@ EXPORT void BlockMgmLoad( void )
static wIcon_p blockI = NULL;
if ( blockI == NULL) {
- blockI = wIconCreatePixMap( block_xpm3[iconSize] );
+ blockI = wIconCreatePixMap( block_image3[iconSize] );
}
TRK_ITERATE(trk) {
@@ -1025,7 +1023,7 @@ EXPORT void InitCmdBlock( wMenu_p menu )
blockName[0] = '\0';
blockScript[0] = '\0';
AddMenuButton( menu, CmdBlockCreate, "cmdBlockCreate", _("Block"),
- wIconCreatePixMap( block_xpm3[iconSize] ), LEVEL0_50,
+ wIconCreatePixMap( block_image3[iconSize] ), LEVEL0_50,
IC_STICKY|IC_POPUP2, ACCL_BLOCK1, NULL );
ParamRegister( &blockPG );
}
diff --git a/app/bin/ccontrol.c b/app/bin/ccontrol.c
index 90c4fb2..a0a3690 100644
--- a/app/bin/ccontrol.c
+++ b/app/bin/ccontrol.c
@@ -487,7 +487,7 @@ static void EditControlDialog()
controlEditW = ParamCreateDialog (&controlEditPG,
MakeWindowTitle(_("Edit control")),
_("Ok"), ControlEditOk,
- wHide, TRUE, NULL,
+ ParamCancel_Current, TRUE, NULL,
F_BLOCK,
NULL );
}
@@ -620,7 +620,7 @@ static int ControlMgmProc ( int cmd, void * data )
return FALSE;
}
-#include "bitmaps/control.xpm3"
+#include "bitmaps/control.image3"
EXPORT void ControlMgmLoad ( void )
{
@@ -628,7 +628,7 @@ EXPORT void ControlMgmLoad ( void )
static wIcon_p controlI = NULL;
if (controlI == NULL) {
- controlI = wIconCreatePixMap( control_xpm3[iconSize] );
+ controlI = wIconCreatePixMap( control_image3[iconSize] );
}
TRK_ITERATE(trk) {
@@ -642,7 +642,7 @@ EXPORT void ControlMgmLoad ( void )
EXPORT void InitCmdControl ( wMenu_p menu )
{
AddMenuButton( menu, CmdControl, "cmdControl", _("Control"),
- wIconCreatePixMap( control_xpm3[iconSize] ), LEVEL0_50, IC_STICKY|IC_POPUP2,
+ wIconCreatePixMap( control_image3[iconSize] ), LEVEL0_50, IC_STICKY|IC_POPUP2,
ACCL_CONTROL, NULL );
}
diff --git a/app/bin/ccornu.c b/app/bin/ccornu.c
index 9e721d8..cd978c0 100644
--- a/app/bin/ccornu.c
+++ b/app/bin/ccornu.c
@@ -1997,6 +1997,11 @@ STATUS_T CmdCornuModify (track_p trk, wAction_t action, coOrd pos,
}
DYNARR_N(coOrd,Da.mid_points,0) = GetTrkEndPos(prior,1-ep0);
Da.trk[0] = GetTrkEndTrk( prior, ep0 );
+ if ( Da.trk[0] == trk ) {
+ // loop
+ ErrorMessage( "Cornu loop detected" );
+ return C_ERROR;
+ }
if (Da.trk[0]) { Da.ep[0] = GetEndPtConnectedToMe(Da.trk[0],prior); }
else { Da.ep[0] = -1; }
}
@@ -2023,6 +2028,11 @@ STATUS_T CmdCornuModify (track_p trk, wAction_t action, coOrd pos,
DYNARR_APPEND(coOrd,Da.mid_points,1);
DYNARR_LAST(coOrd,Da.mid_points) = GetTrkEndPos(next,1-ep1);
Da.trk[1] = GetTrkEndTrk( next, ep1 );
+ if ( Da.trk[1] == trk ) {
+ // loop
+ ErrorMessage( "Cornu loop detected" );
+ return C_ERROR;
+ }
if (Da.trk[1]) { Da.ep[1] = GetEndPtConnectedToMe(Da.trk[1],next); }
}
@@ -2085,7 +2095,7 @@ STATUS_T CmdCornuModify (track_p trk, wAction_t action, coOrd pos,
InfoMessage(_("No changes made"));
Da.state = NONE;
//DYNARR_FREE(trkSeg_t,Da.crvSegs_da);
- return C_CANCEL;
+ return C_CONTINUE;
}
if (!CheckHelix(trk)) {
wBeep();
@@ -3261,17 +3271,17 @@ static STATUS_T CmdConvertFrom(
}
}
-#include "bitmaps/convert-to.xpm3"
-#include "bitmaps/convert-from.xpm3"
+#include "bitmaps/convert-to.image3"
+#include "bitmaps/convert-from.image3"
EXPORT void InitCmdCornu( wMenu_p menu )
{
ButtonGroupBegin( _("Convert"), "cmdConvertSetCmd", _("Convert") );
AddMenuButton( menu, CmdConvertTo, "cmdConvertTo", _("Convert To Cornu"),
- wIconCreatePixMap(convert_to_xpm3[iconSize]), LEVEL0_50,
+ wIconCreatePixMap(convert_to_image3[iconSize]), LEVEL0_50,
IC_STICKY|IC_LCLICK|IC_POPUP3|IC_WANT_MOVE,ACCL_CONVERTTO, NULL );
AddMenuButton( menu, CmdConvertFrom, "cmdConvertFrom", _("Convert From Cornu"),
- wIconCreatePixMap(convert_from_xpm3[iconSize]), LEVEL0_50,
+ wIconCreatePixMap(convert_from_image3[iconSize]), LEVEL0_50,
IC_STICKY|IC_LCLICK|IC_POPUP3|IC_WANT_MOVE,ACCL_CONVERTFR, NULL );
cornuHotBarCmdInx = AddMenuButton(menu, cmdCornuCreate, "cmdCornuCreate", "",
NULL, LEVEL0_50, IC_STICKY|IC_POPUP3|IC_WANT_MOVE, 0, NULL);
diff --git a/app/bin/ccurve.c b/app/bin/ccurve.c
index 373a975..de34aea 100644
--- a/app/bin/ccurve.c
+++ b/app/bin/ccurve.c
@@ -695,12 +695,17 @@ static STATUS_T CmdCurve( wAction_t action, coOrd pos )
static DIST_T circleRadius = 18.0;
-static long helixTurns = 5;
-static ANGLE_T helixAngSep = 0.0;
-static DIST_T helixElev = 0.0;
-static DIST_T helixRadius = 18.0;
-static DIST_T helixGrade = 0.0;
-static DIST_T helixVertSep = 0.0;
+struct helixData_s {
+ long turns;
+ ANGLE_T angSep;
+ DIST_T elev;
+ DIST_T radius;
+ DIST_T grade;
+ DIST_T vertSep;
+};
+struct helixData_s helixDataCur = { 5, 0.0, 0.0, 18.0, 0.0, 0.0 };
+struct helixData_s helixDataOld = { 5, 0.0, 0.0, 18.0, 0.0, 0.0 };
+
static DIST_T origVertSep = 0.0;
static wWin_p helixW;
#define H_ELEV (0)
@@ -723,12 +728,12 @@ static paramFloatRange_t r1_10000 = { 1, 10000 };
static paramFloatRange_t r0_100= { 0, 100 };
static paramData_t helixPLs[] = {
- { PD_FLOAT, &helixElev, "elev", PDO_DIM, &r0_1000000, N_("Elevation Difference") },
- { PD_FLOAT, &helixRadius, "radius", PDO_DIM, &r1_10000, N_("Radius") },
- { PD_LONG, &helixTurns, "turns", 0, &i1_1000000, N_("Turns") },
- { PD_FLOAT, &helixAngSep, "angSep", 0, &r0_360, N_("Angular Separation") },
- { PD_FLOAT, &helixGrade, "grade", 0, &r0_100, N_("Grade") },
- { PD_FLOAT, &helixVertSep, "vertSep", PDO_DIM, &r0_1000000, N_("Vertical Separation") },
+ { PD_FLOAT, &helixDataCur.elev, "elev", PDO_DIM, &r0_1000000, N_("Elevation Difference") },
+ { PD_FLOAT, &helixDataCur.radius, "radius", PDO_DIM, &r1_10000, N_("Radius") },
+ { PD_LONG, &helixDataCur.turns, "turns", 0, &i1_1000000, N_("Turns") },
+ { PD_FLOAT, &helixDataCur.angSep, "angSep", 0, &r0_360, N_("Angular Separation") },
+ { PD_FLOAT, &helixDataCur.grade, "grade", 0, &r0_100, N_("Grade") },
+ { PD_FLOAT, &helixDataCur.vertSep, "vertSep", PDO_DIM, &r0_1000000, N_("Vertical Separation") },
#define I_HELIXMSG (6)
{ PD_MESSAGE, N_("Total Length"), NULL, PDO_DLGRESETMARGIN, I2VP(200) }
};
@@ -752,35 +757,37 @@ static void ComputeHelix(
return;
}
ParamLoadData( &helixPG );
- totTurns = helixTurns + helixAngSep/360.0;
- length = totTurns * helixRadius * (2 * M_PI);
+ totTurns = helixDataCur.turns + helixDataCur.angSep/360.0;
+ length = totTurns * helixDataCur.radius * (2 * M_PI);
h_orders[h_inx] = ++h_clock;
switch ( h_inx ) {
case H_ELEV:
if (h_orders[H_TURNS]<h_orders[H_VERTSEP] &&
origVertSep > 0.0) {
- helixTurns = (int)floor(helixElev/origVertSep - helixAngSep/360.0);
- totTurns = helixTurns + helixAngSep/360.0;
+ helixDataCur.turns = (int)floor(helixDataCur.elev/origVertSep -
+ helixDataCur.angSep/360.0);
+ totTurns = helixDataCur.turns + helixDataCur.angSep/360.0;
updates |= (1<<H_TURNS);
}
if (totTurns > 0) {
- helixVertSep = helixElev/totTurns;
+ helixDataCur.vertSep = helixDataCur.elev/totTurns;
updates |= (1<<H_VERTSEP);
}
break;
case H_TURNS:
case H_ANGSEP:
- helixVertSep = helixElev/totTurns;
+ helixDataCur.vertSep = helixDataCur.elev/totTurns;
updates |= (1<<H_VERTSEP);
break;
case H_VERTSEP:
- if (helixVertSep > 0.0) {
- origVertSep = helixVertSep;
- helixTurns = (int)floor(helixElev/origVertSep - helixAngSep/360.0);
+ if (helixDataCur.vertSep > 0.0) {
+ origVertSep = helixDataCur.vertSep;
+ helixDataCur.turns = (int)floor(helixDataCur.elev/origVertSep -
+ helixDataCur.angSep/360.0);
updates |= (1<<H_TURNS);
- totTurns = helixTurns + helixAngSep/360.0;
+ totTurns = helixDataCur.turns + helixDataCur.angSep/360.0;
if (totTurns > 0) {
- helixVertSep = helixElev/totTurns;
+ helixDataCur.vertSep = helixDataCur.elev/totTurns;
updates |= (1<<H_VERTSEP);
}
}
@@ -791,19 +798,21 @@ static void ComputeHelix(
}
if ( totTurns > 0.0 ) {
if ( h_orders[H_RADIUS]>=h_orders[H_GRADE] ||
- (helixGrade==0.0 && totTurns>0 && helixRadius>0) ) {
- if ( helixRadius > 0.0 ) {
- helixGrade = helixElev/(totTurns*helixRadius*(2*M_PI))*100.0;
+ (helixDataCur.grade==0.0 && totTurns>0 && helixDataCur.radius>0) ) {
+ if ( helixDataCur.radius > 0.0 ) {
+ helixDataCur.grade = helixDataCur.elev/(totTurns*helixDataCur.radius*
+ (2*M_PI))*100.0;
updates |= (1<<H_GRADE);
}
} else {
- if( helixGrade > 0.0 ) {
- helixRadius = helixElev/(totTurns*(helixGrade/100.0)*2.0*M_PI);
+ if( helixDataCur.grade > 0.0 ) {
+ helixDataCur.radius = helixDataCur.elev/(totTurns*(helixDataCur.grade/100.0)
+ *2.0*M_PI);
updates |= (1<<H_RADIUS);
}
}
}
- length = totTurns * helixRadius * (2 * M_PI);
+ length = totTurns * helixDataCur.radius * (2 * M_PI);
for ( h_inx=0; updates; h_inx++,updates>>=1 ) {
if ( (updates&1) ) {
ParamLoadControl( &helixPG, h_inx );
@@ -818,12 +827,6 @@ static void ComputeHelix(
}
-static void HelixCancel( wWin_p win )
-{
- wHide( helixW );
-}
-
-
static void ChangeHelixW( long changes )
{
if ( (changes & CHANGE_UNITS) &&
@@ -850,8 +853,9 @@ static STATUS_T CmdCircleCommon( wAction_t action, coOrd pos, BOOL_T helix )
if (helix) {
if (helixW == NULL) {
helixW = ParamCreateDialog(&helixPG, MakeWindowTitle(_("Helix")), NULL, NULL,
- HelixCancel, TRUE, NULL, 0, ComputeHelix);
+ ParamCancel_Current, TRUE, NULL, 0, ComputeHelix);
}
+ helixDataCur = helixDataOld;
ParamLoadControls(&helixPG);
ParamGroupRecord(&helixPG);
ComputeHelix(NULL, 6, NULL);
@@ -884,15 +888,16 @@ static STATUS_T CmdCircleCommon( wAction_t action, coOrd pos, BOOL_T helix )
case C_DOWN:
if (helix) {
- if (helixRadius <= 0.0) {
+ if (helixDataCur.radius <= 0.0) {
ErrorMessage(MSG_RADIUS_GTR_0);
return C_ERROR;
}
- if (helixTurns <= 0) {
+ if (helixDataCur.turns <= 0) {
ErrorMessage(MSG_HELIX_TURNS_GTR_0);
return C_ERROR;
}
ParamLoadData(&helixPG);
+ helixDataOld = helixDataCur;
} else {
ParamLoadData(&circleRadiusPG);
switch (circleMode) {
@@ -939,23 +944,24 @@ static STATUS_T CmdCircleCommon( wAction_t action, coOrd pos, BOOL_T helix )
}
tempSegs(0).color = wDrawColorBlack;
tempSegs(0).lineWidth = 0;
- tempSegs(0).u.c.radius = helix ? helixRadius : circleRadius;
+ tempSegs(0).u.c.radius = helix ? helixDataCur.radius : circleRadius;
tempSegs(0).u.c.a0 = 0.0;
tempSegs(0).u.c.a1 = 360.0;
return C_CONTINUE;
case C_UP:
if (helix) {
- if (helixRadius > mapD.size.x || helixRadius > mapD.size.y) {
+ if (helixDataCur.radius > mapD.size.x || helixDataCur.radius > mapD.size.y) {
ErrorMessage(MSG_RADIUS_TOO_BIG);
return C_ERROR;
}
- if (helixRadius > 10000) {
+ if (helixDataCur.radius > 10000) {
ErrorMessage(MSG_RADIUS_GTR_10000);
return C_ERROR;
}
UndoStart(_("Create Helix Track"), "newHelix");
- t = NewCurvedTrack(tempSegs(0).u.c.center, helixRadius, 0.0, 0.0, helixTurns);
+ t = NewCurvedTrack(tempSegs(0).u.c.center, helixDataCur.radius, 0.0, 0.0,
+ helixDataCur.turns);
} else {
if (circleRadius > mapD.size.x || circleRadius > mapD.size.y) {
ErrorMessage(MSG_RADIUS_TOO_BIG);
@@ -965,7 +971,7 @@ static STATUS_T CmdCircleCommon( wAction_t action, coOrd pos, BOOL_T helix )
ErrorMessage(MSG_RADIUS_GTR_0);
return C_ERROR;
}
- if ((circleRadius > 100000) || (helixRadius > 10000)) {
+ if ((circleRadius > 100000) || (helixDataCur.radius > 10000)) {
ErrorMessage(MSG_RADIUS_GTR_10000);
return C_ERROR;
}
@@ -1015,49 +1021,49 @@ static STATUS_T CmdHelix( wAction_t action, coOrd pos )
return CmdCircleCommon( action, pos, TRUE );
}
-#include "bitmaps/curved-end.xpm3"
-#include "bitmaps/curved-tangent.xpm3"
-#include "bitmaps/curved-middle.xpm3"
-#include "bitmaps/curved-chord.xpm3"
-#include "bitmaps/bezier-track.xpm3"
-#include "bitmaps/cornu.xpm3"
-#include "bitmaps/circle.xpm3"
-#include "bitmaps/circle-tangent.xpm3"
-#include "bitmaps/circle-center.xpm3"
-// #include "bitmaps/helix.xpm"
+#include "bitmaps/curved-end.image3"
+#include "bitmaps/curved-tangent.image3"
+#include "bitmaps/curved-middle.image3"
+#include "bitmaps/curved-chord.image3"
+#include "bitmaps/bezier-track.image3"
+#include "bitmaps/cornu.image3"
+#include "bitmaps/circle.image3"
+#include "bitmaps/circle-tangent.image3"
+#include "bitmaps/circle-center.image3"
EXPORT void InitCmdCurve( wMenu_p menu )
{
ButtonGroupBegin( _("Curve Track"), "cmdCurveSetCmd", _("Curve Tracks") );
AddMenuButton( menu, CmdCurve, "cmdCurveEndPt", _("Curve from End-Pt"),
- wIconCreatePixMap( curved_end_xpm3[iconSize] ), LEVEL0_50,
+ wIconCreatePixMap( curved_end_image3[iconSize] ), LEVEL0_50,
IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_CURVE1, I2VP(0) );
AddMenuButton( menu, CmdCurve, "cmdCurveTangent", _("Curve from Tangent"),
- wIconCreatePixMap( curved_tangent_xpm3[iconSize] ), LEVEL0_50,
+ wIconCreatePixMap( curved_tangent_image3[iconSize] ), LEVEL0_50,
IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_CURVE2, I2VP(1) );
AddMenuButton( menu, CmdCurve, "cmdCurveCenter", _("Curve from Center"),
- wIconCreatePixMap( curved_middle_xpm3[iconSize] ), LEVEL0_50,
+ wIconCreatePixMap( curved_middle_image3[iconSize] ), LEVEL0_50,
IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_CURVE3, I2VP(2) );
AddMenuButton( menu, CmdCurve, "cmdCurveChord", _("Curve from Chord"),
- wIconCreatePixMap( curved_chord_xpm3[iconSize] ), LEVEL0_50,
+ wIconCreatePixMap( curved_chord_image3[iconSize] ), LEVEL0_50,
IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_CURVE4, I2VP(3) );
AddMenuButton( menu, CmdBezCurve, "cmdBezier", _("Bezier Curve"),
- wIconCreatePixMap( bezier_track_xpm3[iconSize] ), LEVEL0_50,
+ wIconCreatePixMap( bezier_track_image3[iconSize] ), LEVEL0_50,
IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_BEZIER, I2VP(bezCmdCreateTrack) );
AddMenuButton( menu, CmdCornu, "cmdCornu", _("Cornu Curve"),
- wIconCreatePixMap( cornu_xpm3[iconSize] ), LEVEL0_50,
+ wIconCreatePixMap( cornu_image3[iconSize] ), LEVEL0_50,
IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_CORNU, I2VP(cornuCmdCreateTrack));
ButtonGroupEnd();
ButtonGroupBegin( _("Circle Track"), "cmdCircleSetCmd", _("Circle Tracks") );
AddMenuButton( menu, CmdCircle, "cmdCircleFixedRadius",
- _("Fixed Radius Circle"), wIconCreatePixMap( circle_xpm3[iconSize] ), LEVEL0_50,
+ _("Fixed Radius Circle"), wIconCreatePixMap( circle_image3[iconSize] ),
+ LEVEL0_50,
IC_STICKY|IC_POPUP2, ACCL_CIRCLE1, I2VP(0) );
AddMenuButton( menu, CmdCircle, "cmdCircleTangent", _("Circle from Tangent"),
- wIconCreatePixMap( circle_tangent_xpm3[iconSize] ), LEVEL0_50,
+ wIconCreatePixMap( circle_tangent_image3[iconSize] ), LEVEL0_50,
IC_STICKY|IC_POPUP2, ACCL_CIRCLE2, I2VP(1) );
AddMenuButton( menu, CmdCircle, "cmdCircleCenter", _("Circle from Center"),
- wIconCreatePixMap( circle_center_xpm3[iconSize] ), LEVEL0_50,
+ wIconCreatePixMap( circle_center_image3[iconSize] ), LEVEL0_50,
IC_STICKY|IC_POPUP2, ACCL_CIRCLE3, I2VP(2) );
ButtonGroupEnd();
diff --git a/app/bin/cdraw.c b/app/bin/cdraw.c
index 4d52408..5416212 100644
--- a/app/bin/cdraw.c
+++ b/app/bin/cdraw.c
@@ -562,7 +562,7 @@ static descData_t drawDesc[] = {
/*WT*/ { DESC_DIM, N_("Width"), &drawData.width },
/*PV*/ { DESC_PIVOT, N_("Pivot"), &drawData.pivot },
/*VC*/ { DESC_LONG, N_("Point Count"), &drawData.pointCount },
- /*LW*/ { DESC_FLOAT, N_("Line Width"), &drawData.lineWidth },
+ /*LW*/ { DESC_DIM, N_("Line Width"), &drawData.lineWidth },
/*LT*/ { DESC_LIST, N_("Line Type"), &drawData.lineType },
/*CO*/ { DESC_COLOR, N_("Color"), &drawData.color },
/*FL*/ { DESC_BOXED, N_("Filled"), &drawData.filled },
@@ -1051,10 +1051,9 @@ static void UpdateDraw( track_p trk, int inx, descData_p descUpd, BOOL_T final )
if ( wTextGetModified((wText_p)drawDesc[TX].control0 ) ||
inPlayback ) {
int len = wTextGetSize((wText_p)drawDesc[TX].control0);
- // TODO - minor memory leak, but this allows Undo on text object. See BUG-527
- // MyFree( segPtr->u.t.string );
+ UndoDeferFree( segPtr->u.t.string );
if ( !descUndoStarted ) {
- UndoStart( _("Change Track"), "Change Track");
+ UndoStart( _("Change Track"), "Change Text");
descUndoStarted = TRUE;
}
UndoModify( trk );
@@ -1640,7 +1639,7 @@ static STATUS_T ModifyDraw( track_p trk, wAction_t action, coOrd pos )
drawModCmdContext.open = (drawModCmdContext.subtype==POLYLINE)?TRUE:FALSE;
break;
case SEG_TEXT:
- InfoMessage("Text can only be modified in Describe Mode");
+ InfoMessage("Text can only be modified with Property command");
wBeep();
return C_ERROR;
default:
@@ -2830,7 +2829,7 @@ wDrawColor benchColor;
static paramData_t drawPLs[] = {
#define drawLineWidthPD (drawPLs[0])
- { PD_FLOAT, &lineWidth, "linewidth", PDO_NORECORD, &r100_100, N_("Line Width") },
+ { PD_FLOAT, &lineWidth, "linewidth", PDO_DIM|PDO_NORECORD, &r100_100, N_("Line Width") },
#define drawColorPD (drawPLs[1])
{ PD_COLORLIST, &lineColor, "linecolor", PDO_NORECORD, NULL, N_("Color") },
#define drawBenchColorPD (drawPLs[2])
@@ -3162,32 +3161,32 @@ static STATUS_T CmdDraw( wAction_t action, coOrd pos )
}
}
-#include "bitmaps/straight-line.xpm3"
-#include "bitmaps/dimension.xpm3"
-#include "bitmaps/benchwork.xpm3"
-#include "bitmaps/table-edge.xpm3"
-
-#include "bitmaps/curved-line-end.xpm3"
-#include "bitmaps/curved-line-tangent.xpm3"
-#include "bitmaps/curved-line-middle.xpm3"
-#include "bitmaps/curved-line-chord.xpm3"
-
-/*#include "bitmaps/dcircle1.xpm"*/
-#include "bitmaps/circle-line-center.xpm3"
-#include "bitmaps/circle-line-tangent.xpm3"
-/*#include "bitmaps/dflcrcl1.xpm"*/
-#include "bitmaps/circle-filled-center.xpm3"
-#include "bitmaps/circle-filled-tangent.xpm3"
-
-#include "bitmaps/box.xpm3"
-#include "bitmaps/filled-box.xpm3"
-#include "bitmaps/polygon.xpm3"
-#include "bitmaps/filled-polygon.xpm3"
-#include "bitmaps/bezier-line.xpm3"
-#include "bitmaps/polyline.xpm3"
+#include "bitmaps/straight-line.image3"
+#include "bitmaps/dimension.image3"
+#include "bitmaps/benchwork.image3"
+#include "bitmaps/table-edge.image3"
+
+#include "bitmaps/curved-line-end.image3"
+#include "bitmaps/curved-line-tangent.image3"
+#include "bitmaps/curved-line-middle.image3"
+#include "bitmaps/curved-line-chord.image3"
+
+/*#include "bitmaps/dcircle1.image3"*/
+#include "bitmaps/circle-line-center.image3"
+#include "bitmaps/circle-line-tangent.image3"
+/*#include "bitmaps/dflcrcl1.image3"*/
+#include "bitmaps/circle-filled-center.image3"
+#include "bitmaps/circle-filled-tangent.image3"
+
+#include "bitmaps/box.image3"
+#include "bitmaps/filled-box.image3"
+#include "bitmaps/polygon.image3"
+#include "bitmaps/filled-polygon.image3"
+#include "bitmaps/bezier-line.image3"
+#include "bitmaps/polyline.image3"
typedef struct {
- char ***xpm;
+ wIconBitMap_t * image3;
int OP;
char * shortName;
char * cmdName;
@@ -3196,32 +3195,32 @@ typedef struct {
} drawData_t;
static drawData_t dlineCmds[] = {
- { straight_line_xpm3, OP_LINE, N_("Line"), N_("Draw Line"), "cmdDrawLine", ACCL_DRAWLINE },
- { dimension_xpm3, OP_DIMLINE, N_("Dimension Line"), N_("Draw Dimension Line"), "cmdDrawDimLine", ACCL_DRAWDIMLINE },
- { benchwork_xpm3, OP_BENCH, N_("Benchwork"), N_("Draw Benchwork"), "cmdDrawBench", ACCL_DRAWBENCH },
- { table_edge_xpm3, OP_TBLEDGE, N_("Table Edge"), N_("Draw Table Edge"), "cmdDrawTableEdge", ACCL_DRAWTBLEDGE }
+ { straight_line_image3, OP_LINE, N_("Line"), N_("Draw Line"), "cmdDrawLine", ACCL_DRAWLINE },
+ { dimension_image3, OP_DIMLINE, N_("Dimension Line"), N_("Draw Dimension Line"), "cmdDrawDimLine", ACCL_DRAWDIMLINE },
+ { benchwork_image3, OP_BENCH, N_("Benchwork"), N_("Draw Benchwork"), "cmdDrawBench", ACCL_DRAWBENCH },
+ { table_edge_image3, OP_TBLEDGE, N_("Table Edge"), N_("Draw Table Edge"), "cmdDrawTableEdge", ACCL_DRAWTBLEDGE }
};
static drawData_t dcurveCmds[] = {
- { curved_line_end_xpm3, OP_CURVE1, N_("Curve End"), N_("Draw Curve from End"), "cmdDrawCurveEndPt", ACCL_DRAWCURVE1 },
- { curved_line_tangent_xpm3, OP_CURVE2, N_("Curve Tangent"), N_("Draw Curve from Tangent"), "cmdDrawCurveTangent", ACCL_DRAWCURVE2 },
- { curved_line_middle_xpm3, OP_CURVE3, N_("Curve Center"), N_("Draw Curve from Center"), "cmdDrawCurveCenter", ACCL_DRAWCURVE3 },
- { curved_line_chord_xpm3, OP_CURVE4, N_("Curve Chord"), N_("Draw Curve from Chord"), "cmdDrawCurveChord", ACCL_DRAWCURVE4 },
- { bezier_line_xpm3, OP_BEZLIN, N_("Bezier Curve"), N_("Draw Bezier"), "cmdDrawBezierCurve", ACCL_DRAWBEZLINE }
+ { curved_line_end_image3, OP_CURVE1, N_("Curve End"), N_("Draw Curve from End"), "cmdDrawCurveEndPt", ACCL_DRAWCURVE1 },
+ { curved_line_tangent_image3, OP_CURVE2, N_("Curve Tangent"), N_("Draw Curve from Tangent"), "cmdDrawCurveTangent", ACCL_DRAWCURVE2 },
+ { curved_line_middle_image3, OP_CURVE3, N_("Curve Center"), N_("Draw Curve from Center"), "cmdDrawCurveCenter", ACCL_DRAWCURVE3 },
+ { curved_line_chord_image3, OP_CURVE4, N_("Curve Chord"), N_("Draw Curve from Chord"), "cmdDrawCurveChord", ACCL_DRAWCURVE4 },
+ { bezier_line_image3, OP_BEZLIN, N_("Bezier Curve"), N_("Draw Bezier"), "cmdDrawBezierCurve", ACCL_DRAWBEZLINE }
};
static drawData_t dcircleCmds[] = {
- /*{ dcircle1_xpm, OP_CIRCLE1, "Circle Fixed Radius", "Draw Fixed Radius Circle", "cmdDrawCircleFixedRadius", ACCL_DRAWCIRCLE1 },*/
- { circle_line_center_xpm3, OP_CIRCLE3, N_("Circle Center"), N_("Draw Circle from Center"), "cmdDrawCircleCenter", ACCL_DRAWCIRCLE2 },
- { circle_line_tangent_xpm3, OP_CIRCLE2, N_("Circle Tangent"), N_("Draw Circle from Tangent"), "cmdDrawCircleTangent", ACCL_DRAWCIRCLE3 },
- /*{ dflcrcl1_xpm, OP_FILLCIRCLE1, "Circle Filled Fixed Radius", "Draw Fixed Radius Filled Circle", "cmdDrawFilledCircleFixedRadius", ACCL_DRAWFILLCIRCLE1 },*/
- { circle_filled_center_xpm3, OP_FILLCIRCLE3, N_("Circle Filled Center"), N_("Draw Filled Circle from Center"), "cmdDrawFilledCircleCenter", ACCL_DRAWFILLCIRCLE2 },
- { circle_filled_tangent_xpm3, OP_FILLCIRCLE2, N_("Circle Filled Tangent"), N_("Draw Filled Circle from Tangent"), "cmdDrawFilledCircleTangent", ACCL_DRAWFILLCIRCLE3 }
+ /*{ dcircle1_image3, OP_CIRCLE1, "Circle Fixed Radius", "Draw Fixed Radius Circle", "cmdDrawCircleFixedRadius", ACCL_DRAWCIRCLE1 },*/
+ { circle_line_center_image3, OP_CIRCLE3, N_("Circle Center"), N_("Draw Circle from Center"), "cmdDrawCircleCenter", ACCL_DRAWCIRCLE2 },
+ { circle_line_tangent_image3, OP_CIRCLE2, N_("Circle Tangent"), N_("Draw Circle from Tangent"), "cmdDrawCircleTangent", ACCL_DRAWCIRCLE3 },
+ /*{ dflcrcl1_image3, OP_FILLCIRCLE1, "Circle Filled Fixed Radius", "Draw Fixed Radius Filled Circle", "cmdDrawFilledCircleFixedRadius", ACCL_DRAWFILLCIRCLE1 },*/
+ { circle_filled_center_image3, OP_FILLCIRCLE3, N_("Circle Filled Center"), N_("Draw Filled Circle from Center"), "cmdDrawFilledCircleCenter", ACCL_DRAWFILLCIRCLE2 },
+ { circle_filled_tangent_image3, OP_FILLCIRCLE2, N_("Circle Filled Tangent"), N_("Draw Filled Circle from Tangent"), "cmdDrawFilledCircleTangent", ACCL_DRAWFILLCIRCLE3 }
};
static drawData_t dshapeCmds[] = {
- { box_xpm3, OP_BOX, N_("Box"), N_("Draw Box"), "cmdDrawBox", ACCL_DRAWBOX },
- { filled_box_xpm3, OP_FILLBOX, N_("Filled Box"), N_("Draw Filled Box"), "cmdDrawFilledBox", ACCL_DRAWFILLBOX },
- { polygon_xpm3, OP_POLY, N_("Polygon"), N_("Draw Polygon"), "cmdDrawPolygon", ACCL_DRAWPOLY },
- { filled_polygon_xpm3, OP_FILLPOLY, N_("Filled Polygon"), N_("Draw Filled Polygon"), "cmdDrawFilledPolygon", ACCL_DRAWFILLPOLYGON },
- { polyline_xpm3, OP_POLYLINE, N_("PolyLine"), N_("Draw PolyLine"), "cmdDrawPolyline", ACCL_DRAWPOLYLINE },
+ { box_image3, OP_BOX, N_("Box"), N_("Draw Box"), "cmdDrawBox", ACCL_DRAWBOX },
+ { filled_box_image3, OP_FILLBOX, N_("Filled Box"), N_("Draw Filled Box"), "cmdDrawFilledBox", ACCL_DRAWFILLBOX },
+ { polygon_image3, OP_POLY, N_("Polygon"), N_("Draw Polygon"), "cmdDrawPolygon", ACCL_DRAWPOLY },
+ { filled_polygon_image3, OP_FILLPOLY, N_("Filled Polygon"), N_("Draw Filled Polygon"), "cmdDrawFilledPolygon", ACCL_DRAWFILLPOLYGON },
+ { polyline_image3, OP_POLYLINE, N_("PolyLine"), N_("Draw PolyLine"), "cmdDrawPolyline", ACCL_DRAWPOLYLINE },
};
typedef struct {
@@ -3234,8 +3233,6 @@ typedef struct {
wIndex_t cmdInx;
int curr;
} drawStuff_t;
-static drawStuff_t drawStuff[4];
-
static drawStuff_t drawStuff[4] = {
{ "cmdDrawLineSetCmd", N_("Straight Objects"), N_("Draw Straight Objects"), 4, dlineCmds },
@@ -3336,7 +3333,7 @@ EXPORT void InitCmdDraw( wMenu_p menu )
ButtonGroupBegin( _(dsp->menuTitle), dsp->helpKey, _(dsp->stickyLabel) );
for ( inx2=0; inx2<dsp->cnt; inx2++ ) {
ddp = &dsp->data[inx2];
- icon = wIconCreatePixMap( ddp->xpm[iconSize] );
+ icon = wIconCreatePixMap( ddp->image3[iconSize] );
AddMenuButton( menu, CmdDraw, ddp->helpKey, _(ddp->cmdName), icon, LEVEL0_50,
IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ddp->acclKey, I2VP(ddp->OP) );
}
@@ -3397,13 +3394,13 @@ EXPORT track_p NewText(
tempSeg.type = SEG_TEXT;
tempSeg.color = color;
tempSeg.lineWidth = 0;
- tempSeg.u.t.pos = pos;
+ tempSeg.u.t.pos = zero;
tempSeg.u.t.angle = angle;
tempSeg.u.t.fontP = NULL;
tempSeg.u.t.fontSize = textSize;
tempSeg.u.t.string = MyStrdup( text );
tempSeg.u.t.boxed = boxed;
- trk = MakeDrawFromSeg1( index, zero, 0.0, &tempSeg );
+ trk = MakeDrawFromSeg1( index, pos, 0.0, &tempSeg );
return trk;
}
diff --git a/app/bin/celev.c b/app/bin/celev.c
index e55a1fe..f97735a 100644
--- a/app/bin/celev.c
+++ b/app/bin/celev.c
@@ -382,7 +382,11 @@ static STATUS_T CmdElevation( wAction_t action, coOrd pos )
case C_START:
if ( elevW == NULL ) {
elevW = ParamCreateDialog( &elevationPG, MakeWindowTitle(_("Elevation")),
- _("Done"), DoElevDone, wHide, TRUE, LayoutElevW, 0, DoElevUpdate );
+ NULL, NULL,
+ ParamCancel_Reset,
+ TRUE, LayoutElevW,
+ PD_F_ALT_CANCELLABEL,
+ DoElevUpdate );
}
elevModeV = 0;
elevHeightV = 0.0;
@@ -512,6 +516,7 @@ static STATUS_T CmdElevation( wAction_t action, coOrd pos )
return C_TERMINATE;
case C_CANCEL:
elevTrk = NULL;
+ DoElevUpdate( NULL, 1, NULL );
wHide( elevW );
InfoMessage( "" );
return C_TERMINATE;
@@ -533,13 +538,13 @@ static STATUS_T CmdElevation( wAction_t action, coOrd pos )
-#include "bitmaps/elevation.xpm3"
+#include "bitmaps/elevation.image3"
EXPORT void InitCmdElevation( wMenu_p menu )
{
ParamRegister( &elevationPG );
AddMenuButton( menu, CmdElevation, "cmdElevation", _("Elevation"),
- wIconCreatePixMap(elevation_xpm3[iconSize]), LEVEL0_50,
+ wIconCreatePixMap(elevation_image3[iconSize]), LEVEL0_50,
IC_POPUP|IC_LCLICK|IC_RCLICK|IC_WANT_MOVE, ACCL_ELEVATION, NULL );
}
diff --git a/app/bin/cgroup.c b/app/bin/cgroup.c
index 6940ea0..728a004 100644
--- a/app/bin/cgroup.c
+++ b/app/bin/cgroup.c
@@ -1864,7 +1864,7 @@ EXPORT void DoGroup( void * unused )
if ( !groupW ) {
ParamRegister( &groupPG );
groupW = ParamCreateDialog( &groupPG, MakeWindowTitle(_("Group Objects")),
- _("Ok"), GroupOk, wHide, TRUE, NULL, F_BLOCK, NULL );
+ _("Ok"), GroupOk, ParamCancel_Current, TRUE, NULL, F_BLOCK, NULL );
groupD.dpi = mainD.dpi;
}
if (isTurnout) {
diff --git a/app/bin/chndldto.c b/app/bin/chndldto.c
index fb7c05f..715035f 100644
--- a/app/bin/chndldto.c
+++ b/app/bin/chndldto.c
@@ -373,11 +373,11 @@ static STATUS_T CmdHandLaidTurnout( wAction_t action, coOrd pos )
}
-#include "bitmaps/turnout-design.xpm3"
+#include "bitmaps/turnout-design.image3"
EXPORT void InitCmdHandLaidTurnout( wMenu_p menu )
{
AddMenuButton( menu, CmdHandLaidTurnout, "cmdHandLaidTurnout",
- _("HandLaidTurnout"), wIconCreatePixMap(turnout_design_xpm3[iconSize]),
+ _("HandLaidTurnout"), wIconCreatePixMap(turnout_design_image3[iconSize]),
LEVEL0_50, IC_STICKY|IC_INITNOTSTICKY|IC_POPUP2, ACCL_HNDLDTO, NULL );
}
diff --git a/app/bin/chotbar.c b/app/bin/chotbar.c
index a0e6332..90b2ca3 100644
--- a/app/bin/chotbar.c
+++ b/app/bin/chotbar.c
@@ -25,6 +25,7 @@
#include "ccornu.h"
#include "track.h"
#include "draw.h"
+#include "include/toolbar.h"
EXPORT DIST_T curBarScale = -1;
EXPORT long hotBarLabels = 0;
@@ -87,7 +88,7 @@ static void HotBarHighlight( int inx, DIST_T fixed_x )
}
orig.y = 0;
size.x = hotBarMap(inx).w - 2.0/hotBarD.dpi;
- size.y = toolbarHeight;
+ size.y = ToolbarGetHeight();
#ifdef LATER
printf( "HotBarHilite fixed_x:%0.3f X0:%d/%0.3f X:%d/%0.3f+%0.3f X=%0.3f\n",
fixed_x,
@@ -503,7 +504,7 @@ EXPORT void AddHotBarElement(
}
-static void ChangeHotBar( long changes )
+EXPORT void ChangeHotBar( long changes )
{
#ifdef LATER
int curFileIndex = -3;
@@ -595,11 +596,11 @@ EXPORT void LayoutHotBar( void * redraw )
buttonWidth = wControlGetWidth((wControl_p)hotBarLeftB);
buttonHeight = wControlGetHeight((wControl_p)hotBarLeftB);
wControlSetPos( (wControl_p)hotBarLeftB, HOTBAR_LEFT,
- toolbarHeight+(hbHeight-buttonHeight)/2 );
+ ToolbarGetHeight() +(hbHeight-buttonHeight)/2 );
wControlSetPos( (wControl_p)hotBarRightB, winWidth-20-buttonWidth+HOTBAR_LEFT+1,
- toolbarHeight+(hbHeight-buttonHeight)/2 );
+ ToolbarGetHeight() +(hbHeight-buttonHeight)/2 );
wControlSetPos( (wControl_p)hotBarD.d, buttonWidth+HOTBAR_LEFT+1,
- toolbarHeight );
+ ToolbarGetHeight());
wDrawSetSize( hotBarD.d, winWidth-20-buttonWidth*2, hbHeight+2, redraw );
hotBarD.size.x = ((double)(winWidth-20
-buttonWidth*2))/hotBarD.dpi*hotBarD.scale;
@@ -613,7 +614,7 @@ EXPORT void LayoutHotBar( void * redraw )
} else if (!redraw) {
RedrawHotBar( NULL, NULL, 0, 0 );
}
- toolbarHeight += hbHeight+3;
+ ToolbarSetHeight( ToolbarGetHeight() + hbHeight+3 );
}
void HideHotBar( void )
diff --git a/app/bin/cjoin.c b/app/bin/cjoin.c
index cb794bd..737de9f 100644
--- a/app/bin/cjoin.c
+++ b/app/bin/cjoin.c
@@ -1567,17 +1567,17 @@ errorReturn:
*
*/
-#include "bitmaps/join.xpm3"
-#include "bitmaps/join-line.xpm3"
+#include "bitmaps/join.image3"
+#include "bitmaps/join-line.image3"
void InitCmdJoin( wMenu_p menu )
{
ButtonGroupBegin( _("Join"), "cmdJoinSetCmd", _("Join") );
AddMenuButton( menu, CmdJoin, "cmdJoinTrack", _("Join Track"),
- wIconCreatePixMap(join_xpm3[iconSize]), LEVEL0_50,
+ wIconCreatePixMap(join_image3[iconSize]), LEVEL0_50,
IC_STICKY|IC_POPUP|IC_WANT_MOVE, ACCL_JOIN, NULL );
AddMenuButton( menu, CmdJoinLine, "cmdJoinLine", _("Join Lines"),
- wIconCreatePixMap(join_line_xpm3[iconSize]), LEVEL0_50,
+ wIconCreatePixMap(join_line_image3[iconSize]), LEVEL0_50,
IC_STICKY|IC_POPUP|IC_WANT_MOVE, ACCL_JOIN, NULL );
ButtonGroupEnd();
/** @logcmd @showrefby join=n cjoin.c Log Join Lines and Tracks command */
diff --git a/app/bin/cmisc.c b/app/bin/cmisc.c
index 580c681..354c290 100644
--- a/app/bin/cmisc.c
+++ b/app/bin/cmisc.c
@@ -28,6 +28,7 @@
#include "track.h"
#include "common-ui.h"
#include "draw.h"
+#include "note.h"
EXPORT wIndex_t describeCmdInx;
EXPORT BOOL_T inDescribeCmd;
@@ -42,6 +43,7 @@ EXPORT BOOL_T descUndoStarted;
static BOOL_T descNeedDrawHilite;
static wWinPix_t describeW_posy;
static wWinPix_t describeCmdButtonEnd;
+EXPORT char * descTitle = "<>";
static wMenu_p descPopupM;
@@ -230,7 +232,7 @@ static void DescribeUpdate(
}
if (!descUndoStarted) {
- UndoStart(_("Change Track"), "Change Track");
+ UndoStart( descTitle, "Change Track" );
descUndoStarted = TRUE;
}
@@ -296,30 +298,30 @@ static void DescribeUpdate(
}
-static void DescOk(void * junk)
+EXPORT void DescribeDone(void * junk)
{
- wHide(describePG.win);
-
- if (layerValue && *layerValue>=0) {
- SetTrkLayer(descTrk,
- editableLayerList[*layerValue]); //int found that is really in the parm controls.
+ if (descTrk) {
+ CHECK(!IsTrackDeleted(descTrk));
+ // TODO_CANCEL last arg could be true
+ if ( descUpdateFunc && descTrk && GetTrkType(descTrk) != T_NOTE ) {
+ descUpdateFunc(descTrk, -1, descData, !descUndoStarted);
+ }
+ if (layerValue && *layerValue>=0) {
+ SetTrkLayer(descTrk,
+ editableLayerList[*layerValue]);
+ }
+ // wipe out reference
+ layerValue = NULL;
+ descTrk = NULL;
+ }
+ if (describePG.win && wWinIsVisible(describePG.win)) {
+ wHide(describePG.win);
}
- layerValue = NULL; // wipe out reference
- descUpdateFunc(descTrk, -1, descData, !descUndoStarted);
- descTrk = NULL;
-
if (descUndoStarted) {
UndoEnd();
descUndoStarted = FALSE;
}
-
descNeedDrawHilite = FALSE;
- if (programMode == MODE_DESIGN) {
- Reset(); // DescOk
- } else {
- descNeedDrawHilite = FALSE;
- wSetCursor(mainD.d,defaultCursor);
- }
}
@@ -461,12 +463,16 @@ void DoDescribe(char * title, track_p trk, descData_p data, descUpdate_t update)
descData = data;
descUpdateFunc = update;
describeW_posy = 0;
+ descTitle = title;
if (describePG.win == NULL) {
/* SDB 5.13.2005 */
- ParamCreateDialog(&describePG, _("Description"), _("Done"), DescOk,
- (paramActionCancelProc) DescribeCancel,
- TRUE, DescribeLayout, F_RECALLPOS,
+ ParamCreateDialog(&describePG, _("Description"),
+ //_("Done"), DescribeDone,
+ NULL, NULL,
+ ParamCancel_Reset,
+ TRUE, DescribeLayout,
+ F_RECALLPOS|PD_F_ALT_CANCELLABEL,
DescribeUpdate);
describeCmdButtonEnd = wControlBelow((wControl_p)describePG.helpB);
}
@@ -561,26 +567,6 @@ static void DescChange(long changes)
*/
-EXPORT void DescribeCancel(void)
-{
- if (describePG.win && wWinIsVisible(describePG.win)) {
- if (descTrk) {
- CHECK(!IsTrackDeleted(descTrk));
- descUpdateFunc(descTrk, -1, descData, TRUE);
- descTrk = NULL;
-
- }
-
- wHide(describePG.win);
-
- if (descUndoStarted) {
- UndoEnd();
- descUndoStarted = FALSE;
- }
- }
-
- descNeedDrawHilite = FALSE;
-}
EXPORT STATUS_T CmdDescribe(wAction_t action, coOrd pos)
@@ -590,10 +576,11 @@ EXPORT STATUS_T CmdDescribe(wAction_t action, coOrd pos)
switch (action) {
case C_START:
- InfoMessage(_("Select track to describe +Shift for Frozen"));
+ InfoMessage(_("Click on object for Properties +Shift for Frozen"));
wSetCursor(mainD.d,wCursorQuestion);
descUndoStarted = FALSE;
trk = NULL;
+ descTrk = NULL;
return C_CONTINUE;
case wActionMove:
@@ -607,38 +594,59 @@ EXPORT STATUS_T CmdDescribe(wAction_t action, coOrd pos)
case C_DOWN:
- if ((trk = OnTrack(&pos, FALSE, FALSE)) != NULL) {
- if (GetLayerFrozen(GetTrkLayer(trk)) && !(MyGetKeyState()& WKEY_SHIFT)) {
- InfoMessage("Track is Frozen, Add Shift to Describe");
- trk = NULL;
- return C_CONTINUE;
- }
- if (describePG.win && wWinIsVisible(describePG.win) && descTrk) {
- descUpdateFunc(descTrk, -1, descData, TRUE);
- descTrk = NULL;
- }
+ if ((trk = OnTrack(&pos, FALSE, FALSE)) == NULL) {
+ // Not a track - ignore
+ return C_CONTINUE;
+ }
+#ifdef TODO_CANCEL
+ if ( trk == descTrk ) {
+ // Same track - ignore
+ return C_CONTINUE;
+ }
+#endif
+ InfoMessage( "" );
+ DescribeDone( NULL );
+ if ( trk == NULL ) {
+ // This should not happen.
+ // Somebody is stomping on trk
+ // Unreproducible.
+ printf( "CmdDescribe: trk is NULL!\n" );
+ return C_CONTINUE;
+ }
+ if (GetLayerFrozen(GetTrkLayer(trk)) && !(MyGetKeyState()& WKEY_SHIFT)) {
+ InfoMessage("Track is Frozen, Add Shift to Describe");
+ trk = NULL;
+ return C_CONTINUE;
+ }
+ if (describePG.win && wWinIsVisible(describePG.win) && descTrk) {
+ // finish update
+ descUpdateFunc(descTrk, -1, descData, TRUE);
+ descTrk = NULL;
+ }
- descBorder = mainD.scale*0.1;
+ descBorder = mainD.scale*0.1;
- if (descBorder < trackGauge) {
- descBorder = trackGauge;
- }
+ if (descBorder < trackGauge) {
+ descBorder = trackGauge;
+ }
- inDescribeCmd = TRUE;
- GetBoundingBox(trk, &descSize, &descOrig);
- descOrig.x -= descBorder;
- descOrig.y -= descBorder;
- descSize.x -= descOrig.x-descBorder;
- descSize.y -= descOrig.y-descBorder;
- descNeedDrawHilite = TRUE;
- DescribeTrack(trk, msg, 255);
- inDescribeCmd = FALSE;
- InfoMessage(msg);
- trk = NULL;
+ inDescribeCmd = TRUE;
+ GetBoundingBox(trk, &descSize, &descOrig);
+ descOrig.x -= descBorder;
+ descOrig.y -= descBorder;
+ descSize.x -= descOrig.x-descBorder;
+ descSize.y -= descOrig.y-descBorder;
+ descNeedDrawHilite = TRUE;
+ DescribeTrack(trk, msg, 255);
+ inDescribeCmd = FALSE;
+ InfoMessage(msg);
+ // Ugly code: but Describe Notes do not continue like other objects
+ if ( GetTrkType( trk ) != T_NOTE ) {
+ descTrk = trk;
} else {
- InfoMessage("");
+ descTrk = NULL;
}
-
+ trk = NULL;
return C_CONTINUE;
case C_REDRAW:
@@ -667,7 +675,7 @@ EXPORT STATUS_T CmdDescribe(wAction_t action, coOrd pos)
break;
case C_CANCEL:
- DescribeCancel();
+ DescribeDone( NULL );
wSetCursor(mainD.d,defaultCursor);
return C_CONTINUE;
@@ -675,6 +683,9 @@ EXPORT STATUS_T CmdDescribe(wAction_t action, coOrd pos)
menuPos = pos;
if (!trk) { wMenuPopupShow(descPopupM); }
return C_CONTINUE;
+
+ case C_FINISH:
+ return C_CONTINUE;
}
@@ -683,19 +694,19 @@ EXPORT STATUS_T CmdDescribe(wAction_t action, coOrd pos)
-#include "bitmaps/describe.xpm3"
+#include "bitmaps/describe.image3"
void InitCmdDescribe(wMenu_p menu)
{
describeCmdInx = AddMenuButton(menu, CmdDescribe, "cmdDescribe",
- _("Properties"), wIconCreatePixMap(describe_xpm3[iconSize]),
+ _("Properties"), wIconCreatePixMap(describe_image3[iconSize]),
LEVEL0, IC_CANCEL|IC_POPUP|IC_WANT_MOVE|IC_CMDMENU, ACCL_DESCRIBE, NULL);
RegisterChangeNotification(DescChange);
ParamRegister(&describePG);
}
void InitCmdDescribe2(wMenu_p menu)
{
- descPopupM = MenuRegister( "Describe Context Menu" );
+ descPopupM = MenuRegister( "Properties Context Menu" );
wMenuPushCreate(descPopupM, "cmdSelectMode", GetBalloonHelpStr("cmdSelectMode"),
0, DoCommandB, I2VP(selectCmdInx));
wMenuPushCreate(descPopupM, "cmdModifyMode", GetBalloonHelpStr("cmdModifyMode"),
diff --git a/app/bin/cmodify.c b/app/bin/cmodify.c
index 491aae3..7e3ca59 100644
--- a/app/bin/cmodify.c
+++ b/app/bin/cmodify.c
@@ -875,12 +875,12 @@ extendTrackUp:
*
*/
-#include "bitmaps/extend.xpm3"
+#include "bitmaps/extend.image3"
void InitCmdModify( wMenu_p menu )
{
modifyCmdInx = AddMenuButton( menu, CmdModify, "cmdModify", _("Modify"),
- wIconCreatePixMap(extend_xpm3[iconSize]), LEVEL0_50,
+ wIconCreatePixMap(extend_image3[iconSize]), LEVEL0_50,
IC_STICKY|IC_POPUP|IC_WANT_MOVE|IC_CMDMENU, ACCL_MODIFY, NULL );
/** @logcmd @showrefby modify=n cmodify.c Log Modify command */
log_modify = LogFindIndex( "modify" );
diff --git a/app/bin/cnote.c b/app/bin/cnote.c
index 04d63f1..941bf73 100644
--- a/app/bin/cnote.c
+++ b/app/bin/cnote.c
@@ -65,7 +65,8 @@ void DoNote(void * unused)
{
if (noteW == NULL) {
noteW = ParamCreateDialog(&notePG, MakeWindowTitle(_("Note")), _("Ok"), NoteOk,
- wHide, FALSE, NULL, F_NOTTRANSIENT|F_RESIZE, NULL);
+ ParamCancel_Current, FALSE, NULL,
+ F_NOTTRANSIENT|F_RESIZE, NULL);
}
wTextClear(noteT);
diff --git a/app/bin/command.c b/app/bin/command.c
index bf628f8..5e4d968 100644
--- a/app/bin/command.c
+++ b/app/bin/command.c
@@ -31,6 +31,7 @@
#include "track.h"
#include "common-ui.h"
#include "menu.h"
+#include "include/toolbar.h"
/*****************************************************************************
*
@@ -39,17 +40,6 @@
*/
#define COMMAND_MAX (250)
-#define BUTTON_MAX (250)
-
-static struct {
- wControl_p control;
- wBool_t enabled;
- wWinPix_t x, y;
- long options;
- int group;
- wIndex_t cmdInx;
-} buttonList[BUTTON_MAX];
-EXPORT int buttonCnt = 0; // TODO-misc-refactor
static struct {
procCommand_t cmdProc;
@@ -71,14 +61,9 @@ EXPORT int commandCnt = 0;
static wIndex_t curCommand = 0;
-EXPORT int cmdGroup;
-
static int log_command;
-#define TOOLBARSET_INIT (0xFFFF)
-EXPORT long toolbarSet = TOOLBARSET_INIT;
-EXPORT wWinPix_t toolbarHeight = 0;
-static wWinPix_t toolbarWidth = 0;
+
EXPORT long preSelect = 0; /**< default command 0 = Describe 1 = Select */
EXPORT long rightClickMode = 0;
EXPORT void * commandContext;
@@ -90,6 +75,42 @@ EXPORT const char* GetCurCommandName()
return commandList[curCommand].helpKey;
}
+/**
+ * Decide whether command is available in the current application mode.
+ * Basically track modifications are not available in Train Mode, file
+ * operations are always available and train control ops are available in
+ * train mode only.
+ * The specific logic was developed with the help of Wolfram Alpha:
+ * CNF | ((NOT m) OR o OR t) AND(m OR (NOT o) OR t)
+ *
+ * \param mode application mode
+ * \param options availability options
+ * \return true for enabled, false if disabled
+ */
+
+EXPORT bool IsCommandEnabled(long mode, long options)
+{
+ /*
+ if (((mode == MODE_DESIGN) || (options & IC_MODETRAIN_ONLY) ||
+ (options & IC_MODETRAIN_TOO)) &&
+ ((mode == MODE_TRAIN) || !(options & IC_MODETRAIN_ONLY)) ||
+ (options & IC_MODETRAIN_TOO)) {
+ */
+ if (
+ ((mode == MODE_DESIGN) ||
+ (options & IC_MODETRAIN_ONLY) ||
+ (options & IC_MODETRAIN_TOO))
+ &&
+ ((mode == MODE_TRAIN) ||
+ !(options & IC_MODETRAIN_ONLY) ||
+ (options & IC_MODETRAIN_TOO))
+ ) {
+ return true;
+ }
+
+ return false;
+}
+
EXPORT void EnableCommands(void)
{
int inx, minx;
@@ -102,20 +123,15 @@ EXPORT void EnableCommands(void)
if ((commandList[inx].options & IC_SELECTED)
&& selectedTrackCount <= 0) {
enable = FALSE;
- } else if ((programMode == MODE_TRAIN
- && (commandList[inx].options
- & (IC_MODETRAIN_TOO | IC_MODETRAIN_ONLY)) == 0)
- || (programMode != MODE_TRAIN
- && (commandList[inx].options & IC_MODETRAIN_ONLY)
- != 0)) {
- enable = FALSE;
- } else {
+ } else if (IsCommandEnabled(programMode, commandList[inx].options )) {
enable = TRUE;
+ } else {
+ enable = FALSE;
}
if (commandList[inx].enabled != enable) {
- if (commandList[inx].buttInx >= 0)
- wControlActive(buttonList[commandList[inx].buttInx].control,
- enable);
+ if (commandList[inx].buttInx >= 0) {
+ ToolbarButtonEnable(commandList[inx].buttInx, enable );
+ }
for (minx = 0; minx < NUM_CMDMENUS; minx++)
if (commandList[inx].menu[minx]) {
wMenuPushEnable(commandList[inx].menu[minx], enable);
@@ -127,12 +143,7 @@ EXPORT void EnableCommands(void)
EnableMenus();
- for (inx = 0; inx < buttonCnt; inx++) {
- if (buttonList[inx].cmdInx < 0
- && (buttonList[inx].options & IC_SELECTED)) {
- wControlActive(buttonList[inx].control, selectedTrackCount > 0);
- }
- }
+ ToolbarButtonEnableIfSelect(selectedTrackCount > 0);
}
EXPORT wIndex_t GetCurrentCommand()
@@ -149,17 +160,16 @@ EXPORT void Reset(void)
LOG(log_command, 2,
( "COMMAND CANCEL %s\n", commandList[curCommand].helpKey ))
commandList[curCommand].cmdProc( C_CANCEL, zero);
- if (commandList[curCommand].buttInx >= 0)
- wButtonSetBusy(
- (wButton_p) buttonList[commandList[curCommand].buttInx].control,
- FALSE);
+ if (commandList[curCommand].buttInx >= 0) {
+ ToolbarButtonBusy(commandList[curCommand].buttInx, FALSE);
+ }
curCommand = (preSelect ? selectCmdInx : describeCmdInx);
wSetCursor(mainD.d, preSelect ? defaultCursor : wCursorQuestion);
commandContext = commandList[curCommand].context;
- if (commandList[curCommand].buttInx >= 0)
- wButtonSetBusy(
- (wButton_p) buttonList[commandList[curCommand].buttInx].control,
- TRUE);
+ if (commandList[curCommand].buttInx >= 0) {
+ ToolbarButtonBusy(commandList[curCommand].buttInx, TRUE);
+ }
+
DYNARR_RESET( trkSeg_t, tempSegs_da );
TryCheckPoint();
@@ -335,7 +345,7 @@ EXPORT wBool_t DoCurCommand(wAction_t action, coOrd pos)
default:
break;
}
- if ((rc == C_TERMINATE || rc == C_INFO)
+ if ((rc == C_TERMINATE )
&& (commandList[curCommand].options & IC_STICKY)
&& (commandList[curCommand].stickyMask & stickySet)) {
DYNARR_RESET( trkSeg_t, tempSegs_da );
@@ -361,7 +371,6 @@ EXPORT wBool_t DoCurCommand(wAction_t action, coOrd pos)
break;
case C_TERMINATE:
InfoMessage("");
- case C_INFO:
Reset();
break;
}
@@ -401,7 +410,7 @@ EXPORT int ConfirmReset(BOOL_T retry)
commandList[curCommand].cmdProc( C_OK, zero);
return C_OK;
} else if (rc == -1) {
- return C_CANCEL;
+ return C_ERROR;
}
} else if (rc == C_TERMINATE) {
return C_TERMINATE;
@@ -424,7 +433,6 @@ EXPORT void DoCommandB(void * data)
STATUS_T rc;
static coOrd pos = { 0, 0 };
static int inDoCommandB = FALSE;
- wIndex_t buttInx;
if (inDoCommandB) {
return;
@@ -472,10 +480,9 @@ EXPORT void DoCommandB(void * data)
( "COMMAND FINISH %s\n", commandList[curCommand].helpKey ))
rc = commandList[curCommand].cmdProc( C_FINISH, zero);
}
- if (commandList[curCommand].buttInx >= 0)
- wButtonSetBusy(
- (wButton_p) buttonList[commandList[curCommand].buttInx].control,
- FALSE);
+ if (commandList[curCommand].buttInx >= 0) {
+ ToolbarButtonBusy(commandList[curCommand].buttInx, FALSE);
+ }
if (recordF) {
fprintf(recordF, "COMMAND %s\n", commandList[inx].helpKey + 3);
@@ -484,22 +491,18 @@ EXPORT void DoCommandB(void * data)
curCommand = inx;
commandContext = commandList[curCommand].context;
- if ((buttInx = commandList[curCommand].buttInx) >= 0) {
- if (buttonList[buttInx].cmdInx != curCommand) {
- wButtonSetLabel((wButton_p) buttonList[buttInx].control,
- (char*) commandList[curCommand].icon);
- wControlSetHelp(buttonList[buttInx].control,
- GetBalloonHelpStr(commandList[curCommand].helpKey));
- wControlSetContext(buttonList[buttInx].control,
- I2VP(curCommand));
- buttonList[buttInx].cmdInx = curCommand;
- }
- wButtonSetBusy(
- (wButton_p) buttonList[commandList[curCommand].buttInx].control,
- TRUE);
+ // update the toolbar icon when a sub-command is selected (eg. circle
+ // vs. filled circle)
+
+ if (commandList[curCommand].buttInx >= 0) {
+ ToolbarUpdateButton(commandList[curCommand].buttInx,
+ curCommand, (char *)commandList[curCommand].icon,
+ commandList[curCommand].helpKey, I2VP(curCommand));
+ ToolbarButtonBusy(commandList[curCommand].buttInx, TRUE);
}
+
LOG(log_command, 1,
- ( "COMMAND START %s\n", commandList[curCommand].helpKey ))
+ ("COMMAND START %s\n", commandList[curCommand].helpKey));
wSetCursor(mainD.d,defaultCursor);
rc = commandList[curCommand].cmdProc( C_START, pos);
LOG(log_command, 4, ( " COMMAND returns %d\n", rc ))
@@ -514,7 +517,6 @@ EXPORT void DoCommandB(void * data)
#endif
break;
case C_TERMINATE:
- case C_INFO:
if (rc == C_TERMINATE) {
InfoMessage("");
}
@@ -524,107 +526,6 @@ EXPORT void DoCommandB(void * data)
inDoCommandB = FALSE;
}
-static void LayoutSetPos(wIndex_t inx)
-{
- wWinPix_t w, h, offset;
- static wWinPix_t toolbarRowHeight = 0;
- static wWinPix_t width;
- static int lastGroup;
- static wWinPix_t gap;
- static int layerButtCnt;
- static int layerButtNumber;
- int currGroup;
-
- if (inx == 0) {
- lastGroup = 0;
- wWinGetSize(mainW, &width, &h);
- gap = 5;
- toolbarWidth = width - 20 + 5;
- layerButtCnt = 0;
- layerButtNumber = 0;
- toolbarHeight = 0;
- }
-
- if (buttonList[inx].control) {
- if (toolbarRowHeight <= 0) {
- toolbarRowHeight = wControlGetHeight(buttonList[inx].control);
- }
-
- currGroup = buttonList[inx].group & ~BG_BIGGAP;
- if (currGroup != lastGroup && (buttonList[inx].group & BG_BIGGAP)) {
- gap = 15;
- }
- if ((toolbarSet & (1 << currGroup))
- && (programMode != MODE_TRAIN
- || (buttonList[inx].options
- & (IC_MODETRAIN_TOO | IC_MODETRAIN_ONLY)))
- && (programMode == MODE_TRAIN
- || (buttonList[inx].options & IC_MODETRAIN_ONLY) == 0)
- && ((buttonList[inx].group & ~BG_BIGGAP) != BG_LAYER
- || layerButtCnt < layerCount)) {
- if (currGroup != lastGroup) {
- toolbarWidth += gap;
- lastGroup = currGroup;
- gap = 5;
- }
- w = wControlGetWidth(buttonList[inx].control);
- h = wControlGetHeight(buttonList[inx].control);
- if (h<toolbarRowHeight) {
- offset = (h-toolbarRowHeight)/2;
- h = toolbarRowHeight; //Uniform
- } else { offset = 0; }
- if (inx < buttonCnt - 1 && (buttonList[inx + 1].options & IC_ABUT)) {
- w += wControlGetWidth(buttonList[inx + 1].control);
- }
- if (toolbarWidth + w > width - 20) {
- toolbarWidth = 0;
- toolbarHeight += h + 5;
- }
- if ((currGroup == BG_LAYER) && layerButtNumber>1
- && GetLayerHidden(layerButtNumber-2) ) {
- wControlShow(buttonList[inx].control, FALSE);
- layerButtNumber++;
- } else {
- if (currGroup == BG_LAYER ) {
- if (layerButtNumber>1) { layerButtCnt++; } // Ignore List and Background
- layerButtNumber++;
- }
- wControlSetPos(buttonList[inx].control, toolbarWidth,
- toolbarHeight - (h + 5 +offset));
- buttonList[inx].x = toolbarWidth;
- buttonList[inx].y = toolbarHeight - (h + 5 + offset);
- toolbarWidth += wControlGetWidth(buttonList[inx].control);
- wControlShow(buttonList[inx].control, TRUE);
- }
- } else {
- wControlShow(buttonList[inx].control, FALSE);
- }
- }
-}
-
-EXPORT void LayoutToolBar( void * data )
-{
- int inx;
-
- for (inx = 0; inx < buttonCnt; inx++) {
- LayoutSetPos(inx);
- }
- if (toolbarSet&(1<<BG_HOTBAR)) {
- LayoutHotBar(data);
- } else {
- HideHotBar();
- }
-}
-
-static void ToolbarChange(long changes)
-{
- if ((changes & CHANGE_TOOLBAR)) {
- /*if ( !(changes&CHANGE_MAIN) )*/
- MainProc( mainW, wResize_e, NULL, NULL );
- /*else
- LayoutToolBar();*/
- }
-}
/***************************************************************************
*
@@ -659,56 +560,14 @@ EXPORT wIndex_t AddCommand(procCommand_t cmdProc, const char * helpKey,
commandList[commandCnt].menu[1] = cmdMenus[1];
commandList[commandCnt].menu[2] = cmdMenus[2];
commandList[commandCnt].menu[3] = cmdMenus[3];
- if ( buttInx >= 0 && buttonList[buttInx].cmdInx == -1 ) {
- // set button back-link
- buttonList[buttInx].cmdInx = commandCnt;
- }
+
+ ToolbarButtonCommandLink(buttInx, commandCnt);
+
commandCnt++;
return commandCnt - 1;
}
-EXPORT void AddToolbarControl(wControl_p control, long options)
-{
- CHECK( buttonCnt < COMMAND_MAX - 1 );
- buttonList[buttonCnt].enabled = TRUE;
- buttonList[buttonCnt].options = options;
- buttonList[buttonCnt].group = cmdGroup;
- buttonList[buttonCnt].x = 0;
- buttonList[buttonCnt].y = 0;
- buttonList[buttonCnt].control = control;
- buttonList[buttonCnt].cmdInx = -1;
- LayoutSetPos(buttonCnt);
- buttonCnt++;
-}
-
-
-/*--------------------------------------------------------------------*/
-EXPORT void PlaybackButtonMouse(wIndex_t buttInx)
-{
- wWinPix_t cmdX, cmdY;
- coOrd pos;
-
- if (buttInx < 0 || buttInx >= buttonCnt) {
- return;
- }
- if (buttonList[buttInx].control == NULL) {
- return;
- }
- cmdX = buttonList[buttInx].x + 17;
- cmdY = toolbarHeight - (buttonList[buttInx].y + 17)
- + (wWinPix_t) (mainD.size.y / mainD.scale * mainD.dpi) + 30;
-
- mainD.Pix2CoOrd( &mainD, cmdX, cmdY, &pos );
- MovePlaybackCursor(&mainD, pos, TRUE, buttonList[buttInx].control);
- if (playbackTimer == 0) {
- wButtonSetBusy((wButton_p) buttonList[buttInx].control, TRUE);
- wFlush();
- wPause(500);
- wButtonSetBusy((wButton_p) buttonList[buttInx].control, FALSE);
- wFlush();
- }
-}
EXPORT void PlaybackCommand(const char * line, wIndex_t lineNum)
@@ -728,39 +587,34 @@ EXPORT void PlaybackCommand(const char * line, wIndex_t lineNum)
fprintf(stderr, "Unknown playback COMMAND command %d : %s\n", lineNum,
line);
} else {
- wWinPix_t cmdX, cmdY;
- coOrd pos;
- if ((buttInx = commandList[inx].buttInx) >= 0) {
- cmdX = buttonList[buttInx].x + 17;
- cmdY = toolbarHeight - (buttonList[buttInx].y + 17)
- + (wWinPix_t) (mainD.size.y / mainD.scale * mainD.dpi) + 30;
- mainD.Pix2CoOrd( &mainD, cmdX, cmdY, &pos );
- MovePlaybackCursor(&mainD, pos,TRUE,buttonList[buttInx].control);
+ buttInx = commandList[inx].buttInx;
+ if ((commandList[inx].buttInx) >= 0) {
+ ToolbarButtonPlayback(commandList[inx].buttInx);
}
if (strcmp(line + 8, "Undo") == 0) {
if (buttInx > 0 && playbackTimer == 0) {
- wButtonSetBusy((wButton_p) buttonList[buttInx].control, TRUE);
+ ToolbarButtonBusy(buttInx, TRUE);
wFlush();
wPause(500);
- wButtonSetBusy((wButton_p) buttonList[buttInx].control, FALSE);
+ ToolbarButtonBusy(buttInx, FALSE);
wFlush();
}
UndoUndo(NULL);
} else if (strcmp(line + 8, "Redo") == 0) {
if (buttInx >= 0 && playbackTimer == 0) {
- wButtonSetBusy((wButton_p) buttonList[buttInx].control, TRUE);
+ ToolbarButtonBusy(buttInx, TRUE);
wFlush();
wPause(500);
- wButtonSetBusy((wButton_p) buttonList[buttInx].control, FALSE);
+ ToolbarButtonBusy(buttInx, FALSE);
wFlush();
}
UndoRedo(NULL);
} else {
if (buttInx >= 0 && playbackTimer == 0) {
- wButtonSetBusy((wButton_p) buttonList[buttInx].control, TRUE);
+ ToolbarButtonBusy(buttInx, TRUE);
wFlush();
wPause(500);
- wButtonSetBusy((wButton_p) buttonList[buttInx].control, FALSE);
+ ToolbarButtonBusy(buttInx, FALSE);
wFlush();
}
DoCommandB(I2VP(inx));
@@ -795,6 +649,5 @@ EXPORT void CommandInit( void )
curCommand = describeCmdInx;
commandContext = commandList[curCommand].context;
log_command = LogFindIndex( "command" );
- RegisterChangeNotification(ToolbarChange);
}
diff --git a/app/bin/command.h b/app/bin/command.h
index 073e412..882d94a 100644
--- a/app/bin/command.h
+++ b/app/bin/command.h
@@ -81,8 +81,7 @@
#define C_CONTINUE (100)
#define C_TERMINATE (101)
-#define C_INFO (102)
-#define C_ERROR (103)
+#define C_ERROR (102)
/*
* Command Levels - obsolete
@@ -92,58 +91,25 @@
#define LEVEL1 (2)
#define LEVEL2 (3)
-/*
- * Command groups
- */
-#define BG_SELECT (0)
-#define BG_ZOOM (1)
-#define BG_UNDO (2)
-#define BG_EASE (3)
-#define BG_TRKCRT (4)
-#define BG_TRKMOD (5)
-#define BG_TRKGRP (6)
-#define BG_MISCCRT (7)
-#define BG_RULER (8)
-#define BG_LAYER (9)
-#define BG_HOTBAR (10)
-#define BG_SNAP (11)
-#define BG_TRAIN (12)
-#define BG_COUNT (13)
-#define BG_FILE (14)
-#define BG_CONTROL (15)
-#define BG_EXPORTIMPORT (16)
-#define BG_PRINT (17)
-#define BG_BIGGAP (1<<8)
-extern int cmdGroup;
extern int buttonCnt;
extern int commandCnt;
-extern int cmdGroup;
-extern long toolbarSet;
-extern wWinPix_t toolbarHeight;
extern long preSelect;
extern long rightClickMode;
extern void * commandContext;
extern coOrd cmdMenuPos;
const char * GetCurCommandName( void );
+EXPORT bool IsCommandEnabled(long mode, long options);
void EnableCommands( void );
wIndex_t GetCurrentCommand(void);
void Reset( void );
wBool_t DoCurCommand( wAction_t, coOrd );
int ConfirmReset( BOOL_T );
void DoCommandB( void * );
-void LayoutToolBar( void * );
BOOL_T CommandEnabled( wIndex_t );
#define NUM_CMDMENUS (4)
-wIndex_t AddCommand(procCommand_t cmdProc, const char * helpKey,
- const char * nameStr, wIcon_p icon, int reqLevel, long options, long acclKey,
- wIndex_t buttInx, long stickyMask, wMenuPush_p cmdMenus[NUM_CMDMENUS],
- void * context);
-void AddToolbarControl( wControl_p, long );
-void PlaybackButtonMouse( wIndex_t );
-void PlaybackCommand( const char *, wIndex_t );
BOOL_T IsCurCommandSticky(void);
void ResetIfNotSticky( void );
void CommandInit( void );
diff --git a/app/bin/common.h b/app/bin/common.h
index f03a04c..da2d40e 100644
--- a/app/bin/common.h
+++ b/app/bin/common.h
@@ -314,5 +314,10 @@ typedef struct {
#include "command.h"
#include "menu.h"
+#ifndef WINDOWS
+// base type of converted .png files
+typedef unsigned char guint8;
+#endif
+
#endif
diff --git a/app/bin/compound.c b/app/bin/compound.c
index dea754d..d2ed27a 100644
--- a/app/bin/compound.c
+++ b/app/bin/compound.c
@@ -854,7 +854,7 @@ static void UpdateCompound( track_p trk, int inx, descData_p descUpd,
DrawCompoundDescription( trk, &mainD, wDrawColorWhite );
}
/*sprintf( message, "%s\t%s\t%s", manufS, nameS, partnoS );*/
- if (xx->title) { MyFree(xx->title); }
+ if (xx->title) { UndoDeferFree(xx->title); }
xx->title = newTitle;
xx->flipped = flipped;
xx->ungrouped = ungrouped;
@@ -1349,7 +1349,6 @@ BOOL_T ReadCompound(
char scale[10];
char *title;
wIndex_t layer;
- char *cp;
long options = 0;
long position = 0;
long lineType = 0;
@@ -1389,15 +1388,6 @@ BOOL_T ReadCompound(
return FALSE;
}
}
- if (paramVersion<6 && strlen( title ) > 2) {
- cp = strchr( title, '\t' );
- if (cp != NULL) {
- cp = strchr( cp, '\t' );
- }
- if (cp == NULL) {
- UpdateTitleMark( title, LookupScale(scale) );
- }
- }
trk = NewCompound( trkType, index, orig, angle, title, 0, NULL,
pathCnt > 1 ? pathPtr : NULL,
tempSegs_da.cnt, &tempSegs(0) );
diff --git a/app/bin/compound.h b/app/bin/compound.h
index 0a4a0ae..58edf91 100644
--- a/app/bin/compound.h
+++ b/app/bin/compound.h
@@ -163,9 +163,7 @@ void DoUngroup( void * unused );
void DoGroup( void * unused );
/* dcmpnd.c */
-void UpdateTitleMark( char *, SCALEINX_T );
-void DoUpdateTitles( void );
-BOOL_T RefreshCompound( track_p, BOOL_T );
+void DoRefreshCompound( void * unused );
wIndex_t FindListItemByContext( wList_p, void *);
diff --git a/app/bin/cparalle.c b/app/bin/cparalle.c
index 533b9d5..bb14663 100644
--- a/app/bin/cparalle.c
+++ b/app/bin/cparalle.c
@@ -291,17 +291,17 @@ static STATUS_T CmdParallel(wAction_t action, coOrd pos)
}
-#include "bitmaps/parallel.xpm3"
-#include "bitmaps/parallel-line.xpm3"
+#include "bitmaps/parallel.image3"
+#include "bitmaps/parallel-line.image3"
EXPORT void InitCmdParallel( wMenu_p menu )
{
ButtonGroupBegin( _("Parallel"), "cmdParallelSetCmd", _("Parallel") );
AddMenuButton( menu, CmdParallel, "cmdParallelTrack", _("Parallel Track"),
- wIconCreatePixMap(parallel_xpm3[iconSize]), LEVEL0_50,
+ wIconCreatePixMap(parallel_image3[iconSize]), LEVEL0_50,
IC_STICKY|IC_POPUP|IC_WANT_MOVE, ACCL_PARALLEL, I2VP(0) );
AddMenuButton( menu, CmdParallel, "cmdParallelLine", _("Parallel Line"),
- wIconCreatePixMap(parallel_line_xpm3[iconSize]), LEVEL0_50,
+ wIconCreatePixMap(parallel_line_image3[iconSize]), LEVEL0_50,
IC_STICKY|IC_POPUP|IC_WANT_MOVE, ACCL_PARALLEL, I2VP(1) );
ButtonGroupEnd();
ParamRegister( &parSepPG );
diff --git a/app/bin/cprint.c b/app/bin/cprint.c
index 123ad99..086fa21 100644
--- a/app/bin/cprint.c
+++ b/app/bin/cprint.c
@@ -743,7 +743,9 @@ static void DoPrintMargin( void )
if ( customMarginWin == NULL ) {
int x=10, y=10;
customMarginWin = ParamCreateDialog( &customMarginPG,
- MakeWindowTitle(_("Print Margins")), _("Ok"), DoPrintMarginOk, NULL, TRUE,
+ MakeWindowTitle(_("Print Margins")),
+ _("Ok"), DoPrintMarginOk,
+ ParamCancel_Null, TRUE,
PrintMarginLayout, F_BLOCK, PrintMarginDlgUpdate );
if ( customMarginWin == NULL ) {
return;
@@ -1438,7 +1440,8 @@ static STATUS_T CmdPrint(
}
print_d.scale = printScale;
printWin = ParamCreateDialog( &printPG, MakeWindowTitle(_("Print")), _("Print"),
- DoPrintPrint, (paramActionCancelProc)Reset, TRUE, NULL, 0, PrintDlgUpdate );
+ DoPrintPrint, ParamCancel_Reset,
+ TRUE, NULL, 0, PrintDlgUpdate );
}
sPrinterName = wPrintGetName();
while ( *sPrinterName == '\0' ) {
@@ -1560,7 +1563,7 @@ static STATUS_T CmdPrint(
}
-#include "bitmaps/doc-print.xpm3"
+#include "bitmaps/doc-print.image3"
EXPORT wIndex_t InitCmdPrint( wMenu_p menu )
{
@@ -1572,7 +1575,7 @@ EXPORT wIndex_t InitCmdPrint( wMenu_p menu )
AddRotateMenu( printGridPopupM, PrintGridRotate );
ParamRegister( &customMarginPG );
return AddMenuButton( menu, CmdPrint, "cmdPrint", N_("Print..."),
- wIconCreatePixMap(doc_print_xpm3[iconSize]), LEVEL0,
+ wIconCreatePixMap(doc_print_image3[iconSize]), LEVEL0,
IC_LCLICK|IC_POPUP3|IC_CMDMENU, ACCL_PRINT, NULL );
}
diff --git a/app/bin/cprofile.c b/app/bin/cprofile.c
index ba51383..0bf89b6 100644
--- a/app/bin/cprofile.c
+++ b/app/bin/cprofile.c
@@ -604,6 +604,7 @@ static void DoProfilePrint(void * junk)
wFont_p fp;
coOrd screenSize;
coOrd textsize;
+ double topMargin, rightMargin, bottomMargin, leftMargin;
if (!wPrintDocStart(_("Profile"), 1, &copies)) {
return;
@@ -614,6 +615,10 @@ static void DoProfilePrint(void * junk)
}
printProfileD.dpi = wDrawGetDPI(printProfileD.d);
wPrintGetPageSize(&w, &h);
+ wPrintGetMargins( &topMargin, &rightMargin,
+ &bottomMargin, &leftMargin );
+ w -= (leftMargin+rightMargin);
+ h -= (topMargin+bottomMargin);
printProfileD.orig.x = -PBL(printProfileFontSize);
printProfileD.orig.y = -PBB(printProfileFontSize);
printProfileD.angle = 0.0;
@@ -871,7 +876,7 @@ DoProfileReset(void *junk)
static void
DoProfileChange(void *junk)
{
- DestroyCopyOfProfileElements();
+ CreateCopyProfileElements();
TempRedraw();
}
@@ -1440,7 +1445,7 @@ static STATUS_T CmdProfile(wAction_t action, coOrd pos)
labelH = textsize.y;
labelW = textsize.x;
profileW = ParamCreateDialog(&profilePG, MakeWindowTitle(_("Profile")), NULL,
- NULL, wHide, TRUE, NULL, F_RESIZE, CloseProfileWindow);
+ NULL, ParamCancel_Undo, TRUE, NULL, F_RESIZE, CloseProfileWindow);
}
ParamLoadControls(&profilePG);
ParamGroupRecord(&profilePG);
@@ -1512,7 +1517,7 @@ static void ProfileChange(long changes)
}
}
-#include "bitmaps/profile.xpm3"
+#include "bitmaps/profile.image3"
EXPORT void InitCmdProfile(wMenu_p menu)
{
@@ -1520,7 +1525,7 @@ EXPORT void InitCmdProfile(wMenu_p menu)
ParamRegister(&profilePG);
AddMenuButton(menu, CmdProfile, "cmdProfile", _("Profile"),
- wIconCreatePixMap(profile_xpm3[iconSize]), LEVEL0_50,
+ wIconCreatePixMap(profile_image3[iconSize]), LEVEL0_50,
IC_LCLICK|IC_CMDMENU|IC_POPUP3,
ACCL_PROFILE, NULL);
profilePopupM = MenuRegister("Profile Mode");
diff --git a/app/bin/cpull.c b/app/bin/cpull.c
index af6642e..00e2251 100644
--- a/app/bin/cpull.c
+++ b/app/bin/cpull.c
@@ -900,7 +900,7 @@ static STATUS_T CmdPull(
-#include "bitmaps/connect.xpm3"
+#include "bitmaps/connect.image3"
wMenuPush_p pullConnectMultiple;
@@ -916,7 +916,7 @@ void pullMenuEnter( void * keyVP )
void InitCmdPull( wMenu_p menu )
{
AddMenuButton( menu, CmdPull, "cmdConnect", _("Connect Two Tracks"),
- wIconCreatePixMap(connect_xpm3[iconSize]), LEVEL0_50,
+ wIconCreatePixMap(connect_image3[iconSize]), LEVEL0_50,
IC_STICKY|IC_INITNOTSTICKY|IC_LCLICK|IC_POPUP3|IC_CMDMENU|IC_WANT_MOVE,
ACCL_CONNECT, NULL );
pullPopupM = MenuRegister( "Connect Options" );
diff --git a/app/bin/cruler.c b/app/bin/cruler.c
index 1ab65b2..7d318b8 100644
--- a/app/bin/cruler.c
+++ b/app/bin/cruler.c
@@ -382,17 +382,17 @@ STATUS_T ModifyRuler(
}
-#include "bitmaps/ruler.xpm3"
-#include "bitmaps/protractor.xpm3"
+#include "bitmaps/ruler.image3"
+#include "bitmaps/protractor.image3"
void InitCmdRuler( wMenu_p menu )
{
ButtonGroupBegin( _("Measurement"), "cmdMeasureSetCmd", _("Measurement") );
AddMenuButton( menu, CmdRuler, "cmdRuler", _("Ruler"),
- wIconCreatePixMap(ruler_xpm3[iconSize]), LEVEL0,
+ wIconCreatePixMap(ruler_image3[iconSize]), LEVEL0,
IC_STICKY|IC_POPUP|IC_NORESTART, ACCL_RULER, NULL );
AddMenuButton( menu, CmdAngle, "cmdAngle", _("Protractor"),
- wIconCreatePixMap(protractor_xpm3[iconSize]), LEVEL0,
+ wIconCreatePixMap(protractor_image3[iconSize]), LEVEL0,
IC_STICKY|IC_POPUP|IC_NORESTART, ACCL_ANGLE, NULL );
ButtonGroupEnd();
}
diff --git a/app/bin/cselect.c b/app/bin/cselect.c
index a1158bc..3c13336 100644
--- a/app/bin/cselect.c
+++ b/app/bin/cselect.c
@@ -83,7 +83,9 @@ BOOL_T TListSearch(track_p T)
{
for (int i=0; i<tlist_da.cnt-1; i++) {
\
- if (Tlist(i) == T) { return TRUE; }
+ if (Tlist(i) == T) {
+ return TRUE;
+ }
}
return FALSE;
}
@@ -96,7 +98,6 @@ static wMenu_p selectPopup2TYM;
static wMenuPush_p menuPushModify;
static wMenuPush_p rotateAlignMI;
static wMenuPush_p descriptionMI;
-static wMenuPush_p tiesMI;
static wMenuPush_p hideMI;
static wMenuPush_p bridgeMI;
static wMenuPush_p roadbedMI;
@@ -213,6 +214,13 @@ void CreateDescribeAnchor(coOrd pos)
wSetCursor(mainD.d,wCursorNone);
}
+/**
+ * Draw anchor for activable objects ie. objects that can be double clicked
+ * upon. Usually these are notes.
+ *
+ * \param pos position of object
+ */
+
void CreateActivateAnchor(coOrd pos)
{
DIST_T d = tempD.scale*0.15;
@@ -220,23 +228,23 @@ void CreateActivateAnchor(coOrd pos)
DYNARR_APPEND(trkSeg_t,anchors_da,1);
int i = anchors_da.cnt-1;
anchors(i).type = SEG_CRVLIN;
- anchors(i).lineWidth = 0;
- c.x -= d*3/4;
+ anchors(i).lineWidth = 0.1;
+ c.x += d*1/4;
+ c.y += d * 1 / 4;
anchors(i).u.c.center = c;
- anchors(i).u.c.a0 = 0.0;
- anchors(i).u.c.a1 = 360.0;
- anchors(i).u.c.radius = d;
+ anchors(i).u.c.a0 = 70.0;
+ anchors(i).u.c.a1 = 320.0;
+ anchors(i).u.c.radius = d*0.75;
anchors(i).color = wDrawColorPowderedBlue;
+
DYNARR_APPEND(trkSeg_t,anchors_da,1);
i = anchors_da.cnt-1;
- c.x += d*1.5;
- anchors(i).type = SEG_CRVLIN;
- anchors(i).lineWidth = 0;
- anchors(i).u.c.center = pos;
- anchors(i).u.c.a0 = 0.0;
- anchors(i).u.c.a1 = 360.0;
- anchors(i).u.c.radius = d;
- anchors(i).color = wDrawColorPowderedBlue;
+ anchors(i).type = SEG_STRLIN;
+ anchors(i).lineWidth = 0.15;
+ anchors(i).u.l.pos[0] = c;
+ Translate(&anchors(i).u.l.pos[1], anchors(i).u.l.pos[0], NormalizeAngle(45),
+ d*1.25);
+ anchors(i).color = wDrawColorBlue;
wSetCursor(mainD.d,wCursorNone);
}
@@ -527,9 +535,13 @@ EXPORT void HighlightSelectedTracks(
return;
}
while ( TrackIterate( &trk ) ) {
- if (trk == trk_ignore) { continue; }
+ if (trk == trk_ignore) {
+ continue;
+ }
if(GetTrkSelected(trk)) {
- if (!GetLayerVisible( GetTrkLayer( trk ))) { continue; }
+ if (!GetLayerVisible( GetTrkLayer( trk ))) {
+ continue;
+ }
if (keep) {
DrawTrack(trk,&tempD,selectedColor);
} else if (invert) {
@@ -556,7 +568,9 @@ static void SelectConnectedTracks(
DYNARR_RESET( track_p, tlist_da );
TlistAppend( trk );
InfoCount( 0 );
- if (!display_only) { wDrawDelayUpdate( mainD.d, FALSE ); }
+ if (!display_only) {
+ wDrawDelayUpdate( mainD.d, FALSE );
+ }
for (inx=0; inx<tlist_da.cnt; inx++) {
if ( inx > 0 && (selectedTrackCount == 0) && !display_only ) {
return;
@@ -580,12 +594,17 @@ static void SelectConnectedTracks(
trk1 = GetTrkEndTrk( trk, ep );
if (trk1 && !TListSearch(trk1) && GetLayerVisible( GetTrkLayer( trk1 ))) {
if (GetTrkSelected(trk1)) {
- if (display_only) { DrawTrack(trk1,&tempD,wDrawColorPreviewSelected ); }
- } else { TlistAppend( trk1 ); }
+ if (display_only) {
+ DrawTrack(trk1,&tempD,wDrawColorPreviewSelected );
+ }
+ } else {
+ TlistAppend( trk1 );
+ }
}
}
- if (display_only && !GetLayerFrozen(GetTrkLayer(trk))) { DrawTrack(trk,&tempD,wDrawColorPreviewSelected ); }
- else if (!GetTrkSelected(trk)) {
+ if (display_only && !GetLayerFrozen(GetTrkLayer(trk))) {
+ DrawTrack(trk,&tempD,wDrawColorPreviewSelected );
+ } else if (!GetTrkSelected(trk)) {
if (GetLayerModule(GetTrkLayer(trk))) {
continue;
} else if (GetLayerFrozen(GetTrkLayer(trk))) {
@@ -659,7 +678,7 @@ EXPORT void DoSelectedTracks( doSelectedTrackCallBack_t doit )
}
-static BOOL_T SelectedTracksAreFrozen( void )
+EXPORT BOOL_T SelectedTracksAreFrozen( void )
{
track_p trk;
trk = NULL;
@@ -742,7 +761,9 @@ EXPORT int SelectDelete( void )
}
}
- if (doingDouble || (GetCurrentCommand() == modifyCmdInx)) { return 1; }
+ if (doingDouble || (GetCurrentCommand() == modifyCmdInx)) {
+ return 1;
+ }
if (SelectedTracksAreFrozen()) {
return 0;
@@ -965,7 +986,9 @@ EXPORT void SelectCurrentLayer( void * unused )
{
track_p trk;
trk = NULL;
- if (GetLayerFrozen(curLayer)) { return; }
+ if (GetLayerFrozen(curLayer)) {
+ return;
+ }
while ( TrackIterate( &trk ) ) {
if ((!GetTrkSelected(trk)) && GetTrkLayer(trk) == curLayer) {
SelectOneTrack( trk, TRUE );
@@ -1063,23 +1086,6 @@ EXPORT void AddElevations( DIST_T delta )
}
-EXPORT void DoRefreshCompound( void * unused )
-{
- if (SelectedTracksAreFrozen()) {
- return;
- }
- if (selectedTrackCount>0) {
- UndoStart( _("Refresh Compound"), "refresh compound" );
- DoSelectedTracks( RefreshCompound );
- RefreshCompound( NULL, FALSE );
- UndoEnd();
- MainRedraw(); // DoRefreshCompound
- } else {
- ErrorMessage( MSG_NO_SELECTED_TRK );
- }
-}
-
-
static drawCmd_t tempSegsD = {
NULL, &tempSegDrawFuncs, 0, 1, 0.0, {0.0, 0.0}, {0.0, 0.0}, Pix2CoOrd, CoOrd2Pix
};
@@ -1161,10 +1167,18 @@ static BOOL_T GetBoundsDoIt( track_p trk, BOOL_T unused )
getSelectedBoundsLo = lo;
getSelectedBoundsHi = hi;
} else {
- if ( lo.x < getSelectedBoundsLo.x ) { getSelectedBoundsLo.x = lo.x; }
- if ( lo.y < getSelectedBoundsLo.y ) { getSelectedBoundsLo.y = lo.y; }
- if ( hi.x > getSelectedBoundsHi.x ) { getSelectedBoundsHi.x = hi.x; }
- if ( hi.y > getSelectedBoundsHi.y ) { getSelectedBoundsHi.y = hi.y; }
+ if ( lo.x < getSelectedBoundsLo.x ) {
+ getSelectedBoundsLo.x = lo.x;
+ }
+ if ( lo.y < getSelectedBoundsLo.y ) {
+ getSelectedBoundsLo.y = lo.y;
+ }
+ if ( hi.x > getSelectedBoundsHi.x ) {
+ getSelectedBoundsHi.x = hi.x;
+ }
+ if ( hi.y > getSelectedBoundsHi.y ) {
+ getSelectedBoundsHi.y = hi.y;
+ }
}
getSelectedBoundsCount++;
return TRUE;
@@ -1402,7 +1416,9 @@ static void MoveTracks(
for ( inx=0; inx<tlist_da.cnt; inx++ ) {
trk = Tlist(inx);
UndoModify( trk );
- if (QueryTrack(trk, Q_IS_CORNU)) { continue; }
+ if (QueryTrack(trk, Q_IS_CORNU)) {
+ continue;
+ }
if (move) {
MoveTrack( trk, base );
}
@@ -1424,7 +1440,9 @@ static void MoveTracks(
UndoModify( trk );
BOOL_T fixed_end;
fixed_end = FALSE;
- if (!QueryTrack(trk, Q_IS_CORNU)) { continue; }
+ if (!QueryTrack(trk, Q_IS_CORNU)) {
+ continue;
+ }
for (int i=0; i<2; i++) {
track_p te;
if ((te = GetTrkEndTrk(trk,i)) && !GetTrkSelected(te)) {
@@ -1509,7 +1527,9 @@ static void MoveTracks(
ClrAllTrkBits(TB_UNDRAWN);
DoRedraw();
wSetCursor( mainD.d, defaultCursor );
- if (undo) { UndoEnd(); }
+ if (undo) {
+ UndoEnd();
+ }
InfoCount( trackCount );
}
@@ -1574,7 +1594,9 @@ wBool_t FindEndIntersection(coOrd base, coOrd orig, ANGLE_T angle, track_p * t1,
for (int i=0; i<GetTrkEndPtCnt(ts); i++) { //All EndPoints
track_p ct;
if ((ct = GetTrkEndTrk(ts,i))!=NULL) {
- if (GetTrkSelected(ct) || QueryTrack(ts,Q_IS_CORNU)) { continue; } // Another selected track or Cornu - ignore
+ if (GetTrkSelected(ct) || QueryTrack(ts,Q_IS_CORNU)) {
+ continue; // Another selected track or Cornu - ignore
+ }
}
coOrd pos1 = GetTrkEndPos(ts,i);
@@ -1588,7 +1610,9 @@ wBool_t FindEndIntersection(coOrd base, coOrd orig, ANGLE_T angle, track_p * t1,
pos2 = pos1;
track_p tt;
if ((tt=OnTrackIgnore(&pos2,FALSE,TRUE,ts))!=NULL) {
- if (GetTrkGauge(ts) != GetTrkGauge(tt)) { continue; } //Ignore if different gauges
+ if (GetTrkGauge(ts) != GetTrkGauge(tt)) {
+ continue; //Ignore if different gauges
+ }
if (!GetTrkSelected(tt)) { //Ignore if new track is selected
EPINX_T epp = PickUnconnectedEndPointSilent(pos2, tt);
if (epp>=0) {
@@ -1630,9 +1654,15 @@ void DrawHighlightLayer(int layer)
BOOL_T initial = TRUE;
coOrd layer_hi = zero,layer_lo = zero;
while ( TrackIterate( &ts ) ) {
- if ( !GetLayerVisible( GetTrkLayer( ts))) { continue; }
- if (!GetTrkSelected(ts)) { continue; }
- if (GetTrkLayer(ts) != layer) { continue; }
+ if ( !GetLayerVisible( GetTrkLayer( ts))) {
+ continue;
+ }
+ if (!GetTrkSelected(ts)) {
+ continue;
+ }
+ if (GetTrkLayer(ts) != layer) {
+ continue;
+ }
coOrd hi,lo;
GetBoundingBox(ts, &hi, &lo);
if (initial) {
@@ -1640,10 +1670,18 @@ void DrawHighlightLayer(int layer)
layer_lo = lo;
initial = FALSE;
} else {
- if (layer_hi.x < hi.x ) { layer_hi.x = hi.x; }
- if (layer_hi.y < hi.y ) { layer_hi.y = hi.y; }
- if (layer_lo.x > lo.x ) { layer_lo.x = lo.x; }
- if (layer_lo.y > lo.y ) { layer_lo.y = lo.y; }
+ if (layer_hi.x < hi.x ) {
+ layer_hi.x = hi.x;
+ }
+ if (layer_hi.y < hi.y ) {
+ layer_hi.y = hi.y;
+ }
+ if (layer_lo.x > lo.x ) {
+ layer_lo.x = lo.x;
+ }
+ if (layer_lo.y > lo.y ) {
+ layer_lo.y = lo.y;
+ }
}
}
wDrawPix_t margin = (10.5*mainD.scale/mainD.dpi);
@@ -1769,7 +1807,9 @@ static STATUS_T CmdMove(
drawEnable = enableMoveDraw;
base.x = pos.x - orig.x;
base.y = pos.y - orig.y;
- if ((MyGetKeyState() & WKEY_ALT) == 0) { SnapPos( &base ); }
+ if ((MyGetKeyState() & WKEY_ALT) == 0) {
+ SnapPos( &base );
+ }
SetMoveD( TRUE, base, 0.0 );
if (((MyGetKeyState()&(WKEY_ALT)) == 0) == magneticSnap) { // ALT
if (FindEndIntersection(base,zero,0.0,&t1,&ep1,&t2,&ep2)) {
@@ -1804,7 +1844,9 @@ static STATUS_T CmdMove(
return C_TERMINATE;
case C_CMDMENU:
- if (doingMove) { UndoEnd(); }
+ if (doingMove) {
+ UndoEnd();
+ }
doingMove = FALSE;
base = pos;
track_p trk = OnTrack(&pos, FALSE, FALSE); //Note pollutes pos if turntable
@@ -1861,8 +1903,12 @@ static STATUS_T CmdMove(
break;
case wActionExtKey:
- if (state) { return C_CONTINUE; }
- if (SelectedTracksAreFrozen()) { return C_TERMINATE; }
+ if (state) {
+ return C_CONTINUE;
+ }
+ if (SelectedTracksAreFrozen()) {
+ return C_TERMINATE;
+ }
if ((MyGetKeyState() &
(WKEY_SHIFT | WKEY_CTRL)) == (WKEY_SHIFT | WKEY_CTRL)) { //Both
base = zero;
@@ -1887,7 +1933,9 @@ static STATUS_T CmdMove(
drawEnable = enableMoveDraw;
GetMovedTracks(TRUE);
- if (!doingMove) { UndoStart( _("Move Tracks"), "move" ); }
+ if (!doingMove) {
+ UndoStart( _("Move Tracks"), "move" );
+ }
doingMove = TRUE;
SetMoveD( TRUE, base, 0.0 );
MoveTracks( FALSE, TRUE, FALSE, base, zero, 0.0, FALSE );
@@ -2022,7 +2070,9 @@ static STATUS_T CmdRotate(
onTrackInSplit = TRUE;
trk = OnTrack( &pos, TRUE, FALSE );
onTrackInSplit = FALSE;
- if ( trk == NULL ) { return C_CONTINUE; }
+ if ( trk == NULL ) {
+ return C_CONTINUE;
+ }
angle1 = NormalizeAngle( GetAngleAtPoint( trk, pos, NULL, NULL ) );
if ( rotateAlignState == 1 ) {
if ( !GetTrkSelected(trk) ) {
@@ -2051,7 +2101,9 @@ static STATUS_T CmdRotate(
//if ( NormalizeAngle( FindAngle( base, pos1 ) - angle1 ) < 180.0 )
// angle = NormalizeAngle( angle + 180.0 );
/*printf( "angle 1 = %0.3f\n", angle );*/
- if ( angle1 > 180.0 ) { angle1 -= 180.0; }
+ if ( angle1 > 180.0 ) {
+ angle1 -= 180.0;
+ }
InfoMessage( _("Angle %0.3f"), angle1 );
}
GetMovedTracks(TRUE);
@@ -2086,7 +2138,9 @@ static STATUS_T CmdRotate(
if ( NormalizeAngle( FindAngle( pos, pos1 ) - angle1 ) < 180.0 ) {
angle = NormalizeAngle( angle + 180.0 );
}
- if ( angle1 > 180.0 ) { angle1 -= 180.0; }
+ if ( angle1 > 180.0 ) {
+ angle1 -= 180.0;
+ }
InfoMessage( _("Angle %0.3f"), angle1 );
SetMoveD( FALSE, orig, angle );
/*printf( "angle 2 = %0.3f\n", angle );*/
@@ -2104,8 +2158,11 @@ static STATUS_T CmdRotate(
direction_set = FALSE;
} else {
if (!direction_set) {
- if (DifferenceBetweenAngles(baseAngle,angle)>=0) { clockwise = TRUE; }
- else { clockwise = FALSE; }
+ if (DifferenceBetweenAngles(baseAngle,angle)>=0) {
+ clockwise = TRUE;
+ } else {
+ clockwise = FALSE;
+ }
direction_set = TRUE;
} else {
if (clockwise) {
@@ -2127,9 +2184,13 @@ static STATUS_T CmdRotate(
if ( (MyGetKeyState() & (WKEY_CTRL|WKEY_SHIFT)) ==
(WKEY_CTRL|WKEY_SHIFT) ) { //Both Shift+Ctrl
if (clockwise) {
- if (diff_angle<0) { diff_angle+=360; }
+ if (diff_angle<0) {
+ diff_angle+=360;
+ }
} else {
- if (diff_angle>0) { diff_angle-=360; }
+ if (diff_angle>0) {
+ diff_angle-=360;
+ }
}
diff_angle = floor((diff_angle+7.5)/15.0)*15.0;
angle = baseAngle+diff_angle;
@@ -2249,15 +2310,21 @@ static STATUS_T CmdRotate(
base));
DIST_T dist = FindDistance(orig,base);
- if (dist>(60.0/BASE_DPI)*mainD.scale) { dist = (60.0/BASE_DPI)*mainD.scale; }
+ if (dist>(60.0/BASE_DPI)*mainD.scale) {
+ dist = (60.0/BASE_DPI)*mainD.scale;
+ }
if (direction_set) {
if (clockwise) {
- if (a<0) { a = a + 360; }
+ if (a<0) {
+ a = a + 360;
+ }
DrawArc( &tempD, orig, dist/2, FindAngle(orig,orig_base), a, FALSE, 0,
wDrawColorBlue);
} else {
- if (a>0) { a = a - 360; }
+ if (a>0) {
+ a = a - 360;
+ }
DrawArc( &tempD, orig, dist/2, FindAngle(orig,base), fabs(a), FALSE, 0,
wDrawColorBlue);
}
@@ -2266,8 +2333,11 @@ static STATUS_T CmdRotate(
ANGLE_T arrow_a = NormalizeAngle(FindAngle(orig,orig_base)+a/2);
coOrd arr1,arr2,arr3;
Translate(&arr2,orig,arrow_a,dist/2);
- if (clockwise) { arrow_a +=90; }
- else { arrow_a -=90; }
+ if (clockwise) {
+ arrow_a +=90;
+ } else {
+ arrow_a -=90;
+ }
Translate(&arr1,arr2,arrow_a+135,d/2);
Translate(&arr3,arr2,arrow_a-135,d/2);
DrawLine( &tempD, arr1, arr2, 0, wDrawColorBlue );
@@ -2304,15 +2374,19 @@ static track_p SelectTrackByIndex(TRKINX_T ti, char * message )
if (!GetLayerFrozen( GetTrkLayer( trk ) ) ) {
if (GetLayerModule(GetTrkLayer(trk))) {
DoModuleTracks(GetTrkLayer(trk),DrawSingleTrack,TRUE);
- snprintf(message, STR_LONG_SIZE, "%s %d",_("In module layer:"),
+ snprintf(message, STR_LONG_SIZE, "%s %u",_("In module layer:"),
GetTrkLayer(trk)+1);
} else {
- if (!GetLayerVisible(GetTrkLayer(trk))) { FlipLayer(I2VP(GetTrkLayer(trk))); }
- if (!GetTrkVisible(trk) && drawTunnel==0 ) { drawTunnel = 1; } //Force DRAW_TUNNEL_DASH
+ if (!GetLayerVisible(GetTrkLayer(trk))) {
+ FlipLayer(I2VP(GetTrkLayer(trk)));
+ }
+ if (!GetTrkVisible(trk) && drawTunnel==0 ) {
+ drawTunnel = 1; //Force DRAW_TUNNEL_DASH
+ }
SelectOneTrack(trk,TRUE);
}
} else {
- snprintf(message, STR_LONG_SIZE, "%s %d",_("Frozen Layer:"),GetTrkLayer(trk)+1);
+ snprintf(message, STR_LONG_SIZE, "%s %u",_("Frozen Layer:"),GetTrkLayer(trk)+1);
trk = NULL;
}
} else {
@@ -2342,7 +2416,9 @@ EXPORT void SelectByIndex( void* string)
}
}
cp = strtok(NULL,",");
- if (cp) { single = FALSE; }
+ if (cp) {
+ single = FALSE;
+ }
}
DoZoomExtents(I2VP(1));
@@ -2446,7 +2522,9 @@ track_p FindTrackDescription(coOrd pos, EPINX_T * ep_o, int * mode_o,
}
}
}
- if (IsClose(dd)) { break; }
+ if (IsClose(dd)) {
+ break;
+ }
if ( *mode_o == 0 || !QueryTrack( trk1, Q_HAS_DESC ) ) {
continue;
}
@@ -2454,7 +2532,9 @@ track_p FindTrackDescription(coOrd pos, EPINX_T * ep_o, int * mode_o,
continue;
}
if ( ( GetTrkBits( trk1 ) & TB_HIDEDESC ) != 0 ) {
- if ( !show_hidden ) { continue; }
+ if ( !show_hidden ) {
+ continue;
+ }
}
d = CompoundDescriptionDistance( pos, trk1, &dpos, show_hidden, &hidden_t );
if ( d < dd ) {
@@ -2516,18 +2596,36 @@ track_p FindTrackDescription(coOrd pos, EPINX_T * ep_o, int * mode_o,
coOrd pos1 = pos;
if ((trk != NULL) && IsClose(dd) ) {
- if (ep_o) { *ep_o = ep; }
- if (mode_o) { *mode_o = mode; }
- if (hidden_o) { *hidden_o = hidden; }
+ if (ep_o) {
+ *ep_o = ep;
+ }
+ if (mode_o) {
+ *mode_o = mode;
+ }
+ if (hidden_o) {
+ *hidden_o = hidden;
+ }
return trk;
} else { // Return other track for description (not near to description but nearest to track)
- if ((trk1 = OnTrack(&pos1, FALSE, FALSE))==NULL) { return NULL; }
- if (!QueryTrack( trk1, Q_HAS_DESC )) { return NULL; }
- if (GetLayerFrozen(GetTrkLayer(trk1))) { return NULL; }
+ if ((trk1 = OnTrack(&pos1, FALSE, FALSE))==NULL) {
+ return NULL;
+ }
+ if (!QueryTrack( trk1, Q_HAS_DESC )) {
+ return NULL;
+ }
+ if (GetLayerFrozen(GetTrkLayer(trk1))) {
+ return NULL;
+ }
if (IsClose(FindDistance(pos,pos1))) {
- if (mode_o) { *mode_o = -1; }
- if (ep_o) { *ep_o = -1; }
- if (hidden_o) { *hidden_o = GetTrkBits( trk1 ) & TB_HIDEDESC; }
+ if (mode_o) {
+ *mode_o = -1;
+ }
+ if (ep_o) {
+ *ep_o = -1;
+ }
+ if (hidden_o) {
+ *hidden_o = GetTrkBits( trk1 ) & TB_HIDEDESC;
+ }
return trk1;
}
}
@@ -2564,7 +2662,9 @@ STATUS_T CmdMoveDescription(
SetAllTrackSelect( FALSE );
/* no break */
case wActionMove:
- if ( labelWhen < 2 || mainD.scale > labelScale ) { return C_CONTINUE; }
+ if ( labelWhen < 2 || mainD.scale > labelScale ) {
+ return C_CONTINUE;
+ }
mode = moveDescMode
-1; // -1 means everything, 0 means elevations only, 1 means descriptions only
if ((moveDescTrk=FindTrackDescription(pos,&ep,&mode,TRUE,&hidden))!=NULL) {
@@ -2590,8 +2690,12 @@ STATUS_T CmdMoveDescription(
InfoMessage( _("Select and drag a description") );
break;
case C_TEXT:
- if (!moveDescTrk) { return C_CONTINUE; }
- if (mode == 0) { return C_CONTINUE; }
+ if (!moveDescTrk) {
+ return C_CONTINUE;
+ }
+ if (mode == 0) {
+ return C_CONTINUE;
+ }
bChanged = FALSE;
if (action>>8 == 's') {
if ( ( GetTrkBits( moveDescTrk ) & TB_HIDEDESC) != 0 ) {
@@ -2710,8 +2814,12 @@ STATUS_T CmdMoveDescription(
} else {
moveDescPos = pos;
}
- if ( moveDescTrk == NULL ) { break; }
- if ( ! QueryTrack( moveDescTrk, Q_HAS_DESC ) ) { break; }
+ if ( moveDescTrk == NULL ) {
+ break;
+ }
+ if ( ! QueryTrack( moveDescTrk, Q_HAS_DESC ) ) {
+ break;
+ }
if ( moveDescM == NULL ) {
moveDescM = MenuRegister( "Move Desc Toggle" );
moveDescMI = wMenuToggleCreate( moveDescM, "", _("Show/Hide Description"), 0,
@@ -2892,7 +3000,9 @@ static BOOL_T SelectArea(
subtract = (action == C_RUP);
cnt = 0;
trk = NULL;
- if (add && (selectMode == 0)) { SetAllTrackSelect( FALSE ); } //Remove all tracks first
+ if (add && (selectMode == 0)) {
+ SetAllTrackSelect( FALSE ); //Remove all tracks first
+ }
while ( TrackIterate( &trk ) ) {
GetBoundingBox( trk, &hi, &lo );
if (GetLayerVisible( GetTrkLayer( trk ) ) &&
@@ -2954,7 +3064,9 @@ static BOOL_T SelectArea(
}
//Draw to-be selected tracks versus not.
trk = NULL;
- if (selectMode == 1 && add) { HighlightSelectedTracks(NULL, TRUE, TRUE); }
+ if (selectMode == 1 && add) {
+ HighlightSelectedTracks(NULL, TRUE, TRUE);
+ }
while ( TrackIterate( &trk ) ) {
GetBoundingBox( trk, &hi, &lo );
if (GetLayerVisible( GetTrkLayer( trk ) ) &&
@@ -3007,7 +3119,9 @@ static STATUS_T SelectTrack(
SetAllTrackSelect( FALSE ); //Unselect all
return C_CONTINUE;
}
- if (trk == NULL) { return C_CONTINUE; }
+ if (trk == NULL) {
+ return C_CONTINUE;
+ }
if (!CheckTrackLayerSilent( trk ) ) {
if (GetLayerFrozen(GetTrkLayer(trk)) ) {
trk = NULL;
@@ -3054,7 +3168,9 @@ static STATUS_T Activate( coOrd pos)
if (GetLayerModule(GetTrkLayer(trk))) {
return C_CONTINUE;
}
- if (QueryTrack(trk,Q_IS_ACTIVATEABLE)) { ActivateTrack(trk); }
+ if (QueryTrack(trk,Q_IS_ACTIVATEABLE)) {
+ ActivateTrack(trk);
+ }
return C_CONTINUE;
@@ -3064,8 +3180,12 @@ track_p IsInsideABox(coOrd pos)
{
track_p ts = NULL;
while ( TrackIterate( &ts ) ) {
- if (!GetLayerVisible( GetTrkLayer( ts))) { continue; }
- if (!GetTrkSelected(ts)) { continue; }
+ if (!GetLayerVisible( GetTrkLayer( ts))) {
+ continue;
+ }
+ if (!GetTrkSelected(ts)) {
+ continue;
+ }
coOrd hi,lo;
GetBoundingBox(ts, &hi, &lo);
double boundary = mainD.scale*5/mainD.dpi;
@@ -3081,26 +3201,41 @@ void DrawHighlightBoxes(BOOL_T highlight_selected, BOOL_T select,
track_p not_this)
{
track_p ts = NULL;
- coOrd origin,max;
+ coOrd origin,max = {0.0, 0.0};
BOOL_T first = TRUE;
while ( TrackIterate( &ts ) ) {
- if ( !GetLayerVisible( GetTrkLayer( ts))) { continue; }
- if (!GetTrkSelected(ts)) { continue; }
+ if ( !GetLayerVisible( GetTrkLayer( ts))) {
+ continue;
+ }
+ if (!GetTrkSelected(ts)) {
+ continue;
+ }
if (GetLayerModule(GetTrkLayer(ts))) {
DrawHighlightLayer(GetTrkLayer(ts));
}
coOrd hi,lo;
- if (highlight_selected && (ts != not_this)) { DrawTrack(ts,&tempD,select?wDrawColorPreviewSelected:wDrawColorPreviewUnselected ); }
+ if (highlight_selected && (ts != not_this)) {
+ DrawTrack(ts,&tempD,select?wDrawColorPreviewSelected:
+ wDrawColorPreviewUnselected );
+ }
GetBoundingBox(ts, &hi, &lo);
if (first) {
origin = lo;
max = hi;
first = FALSE;
} else {
- if (lo.x <origin.x) { origin.x = lo.x; }
- if (lo.y <origin.y) { origin.y = lo.y; }
- if (hi.x >max.x) { max.x = hi.x; }
- if (hi.y >max.y) { max.y = hi.y; }
+ if (lo.x <origin.x) {
+ origin.x = lo.x;
+ }
+ if (lo.y <origin.y) {
+ origin.y = lo.y;
+ }
+ if (hi.x >max.x) {
+ max.x = hi.x;
+ }
+ if (hi.y >max.y) {
+ max.y = hi.y;
+ }
}
}
if (!first) {
@@ -3164,7 +3299,7 @@ static STATUS_T CmdSelect(
STATUS_T rc=C_CONTINUE;
static track_p trk = NULL;
- typedef enum {NOSHOW,SHOWMOVE,SHOWROTATE,SHOWMODIFY,SHOWACTIVATE} showType;
+// typedef enum {NOSHOW,SHOWMOVE,SHOWROTATE,SHOWMODIFY,SHOWACTIVATE} showType;
// static showType showMode;
mode = AREA;
@@ -3208,7 +3343,9 @@ static STATUS_T CmdSelect(
coOrd p = pos;
trk = OnTrack( &p, FALSE, FALSE );
track_p ht;
- if ((selectedTrackCount==0) && (trk == NULL)) { return C_CONTINUE; }
+ if ((selectedTrackCount==0) && (trk == NULL)) {
+ return C_CONTINUE;
+ }
if (trk && !CheckTrackLayerSilent( trk ) ) {
if (GetLayerFrozen(GetTrkLayer(trk)) ) {
trk = NULL;
@@ -3234,11 +3371,19 @@ static STATUS_T CmdSelect(
if (QueryTrack(ht,Q_IS_ACTIVATEABLE)) {
CreateActivateAnchor(pos);
// showMode = SHOWACTIVATE;
- } else { wSetCursor(mainD.d,defaultCursor); }
+ } else {
+ wSetCursor(mainD.d,defaultCursor);
+ }
}
- } else { wSetCursor(mainD.d,defaultCursor); }
- } else { wSetCursor(mainD.d,defaultCursor); }
- } else { wSetCursor(mainD.d,defaultCursor); }
+ } else {
+ wSetCursor(mainD.d,defaultCursor);
+ }
+ } else {
+ wSetCursor(mainD.d,defaultCursor);
+ }
+ } else {
+ wSetCursor(mainD.d,defaultCursor);
+ }
break;
case C_DOWN:
@@ -3268,7 +3413,8 @@ static STATUS_T CmdSelect(
doingRotate = FALSE;
SelectArea( action, pos );
break;
- default: ;
+ default:
+ ;
}
trk = NULL;
return rc;
@@ -3310,7 +3456,8 @@ static STATUS_T CmdSelect(
doingRotate = FALSE;
SelectArea( action, pos );
break;
- default: ;
+ default:
+ ;
}
if ((action&0xFF) == wActionExtKey
&& ((MyGetKeyState() & (WKEY_SHIFT|WKEY_CTRL)) ==
@@ -3344,7 +3491,8 @@ static STATUS_T CmdSelect(
SelectArea( action, pos );
rc = C_CONTINUE;
break;
- default: ;
+ default:
+ ;
}
doingMove = FALSE;
doingRotate = FALSE;
@@ -3373,11 +3521,13 @@ static STATUS_T CmdSelect(
0 );
return C_CONTINUE;
}
- BOOL_T AreaSelect = FALSE;
// Draw the selected area, no-op if none selected
if (mode==AREA) {
+ BOOL_T AreaSelect = FALSE;
AreaSelect = SelectArea( action, pos );
- if (AreaSelect) { return C_CONTINUE; }
+ if (AreaSelect) {
+ return C_CONTINUE;
+ }
}
// Highlight a whole Module's worth of tracks if we are hovering over one
@@ -3510,7 +3660,9 @@ static STATUS_T CmdSelect(
(QueryTrack( ht, Q_IS_DRAW ) && !QueryTrack( ht, Q_IS_TEXT ))) {
doingDouble = TRUE;
CallModify(C_START,pos);
- if (doingDouble == FALSE) { return C_CONTINUE; }
+ if (doingDouble == FALSE) {
+ return C_CONTINUE;
+ }
CallModify(C_LDOUBLE,pos);
} else if (QueryTrack( ht, Q_IS_ACTIVATEABLE)) {
return Activate(pos);
@@ -3575,28 +3727,32 @@ static STATUS_T CmdSelect(
CallModify(C_OK,pos);
CallModify(C_FINISH,pos);
}
- if (doingMove) { UndoEnd(); }
+ if (doingMove) {
+ UndoEnd();
+ }
doingDouble = FALSE;
wSetCursor(mainD.d,defaultCursor);
break;
default:
- if (doingDouble) { return CallModify(action, pos); }
+ if (doingDouble) {
+ return CallModify(action, pos);
+ }
}
return C_CONTINUE;
}
-#include "bitmaps/select.xpm3"
-#include "bitmaps/delete.xpm3"
-#include "bitmaps/tunnel.xpm3"
-#include "bitmaps/ties.xpm3"
-#include "bitmaps/bridge.xpm3"
-#include "bitmaps/roadbed.xpm3"
-#include "bitmaps/move.xpm3"
-#include "bitmaps/rotate.xpm3"
-#include "bitmaps/reflect.xpm3"
-#include "bitmaps/description.xpm3"
+#include "bitmaps/select.image3"
+#include "bitmaps/delete.image3"
+#include "bitmaps/tunnel.image3"
+#include "bitmaps/ties.image3"
+#include "bitmaps/bridge.image3"
+#include "bitmaps/roadbed.image3"
+#include "bitmaps/move.image3"
+#include "bitmaps/rotate.image3"
+#include "bitmaps/reflect.image3"
+#include "bitmaps/description.image3"
static void SetMoveMode( char * line )
@@ -3611,7 +3767,9 @@ static void SetMoveMode( char * line )
static void moveDescription( void * unused )
{
- if (!moveDescTrk) { return; }
+ if (!moveDescTrk) {
+ return;
+ }
int hidden = GetTrkBits( moveDescTrk) &TB_HIDEDESC ;
if (hidden) {
ClrTrkBits( moveDescTrk, TB_HIDEDESC );
@@ -3625,7 +3783,7 @@ static void moveDescription( void * unused )
EXPORT void InitCmdSelect( wMenu_p menu )
{
selectCmdInx = AddMenuButton( menu, CmdSelect, "cmdSelect", _("Select"),
- wIconCreatePixMap(select_xpm3[iconSize]),
+ wIconCreatePixMap(select_image3[iconSize]),
LEVEL0, IC_CANCEL|IC_POPUP|IC_LCLICK|IC_CMDMENU|IC_WANT_MOVE|IC_WANT_MODKEYS,
ACCL_SELECT, NULL );
}
@@ -3756,7 +3914,7 @@ EXPORT void InitCmdSelect2( wMenu_p menu )
EXPORT void InitCmdDelete( void )
{
wIcon_p icon;
- icon = wIconCreatePixMap( delete_xpm3[iconSize] );
+ icon = wIconCreatePixMap( delete_image3[iconSize] );
AddToolbarButton( "cmdDelete", icon, IC_SELECTED,
(wButtonCallBack_p)SelectDelete, 0 );
}
@@ -3764,28 +3922,28 @@ EXPORT void InitCmdDelete( void )
EXPORT void InitCmdTies( void )
{
wIcon_p icon;
- icon = wIconCreatePixMap( ties_xpm3[iconSize] );
+ icon = wIconCreatePixMap( ties_image3[iconSize] );
AddToolbarButton( "cmdTies", icon, IC_SELECTED|IC_POPUP, SelectTies, NULL );
}
EXPORT void InitCmdTunnel( void )
{
wIcon_p icon;
- icon = wIconCreatePixMap( tunnel_xpm3[iconSize] );
+ icon = wIconCreatePixMap( tunnel_image3[iconSize] );
AddToolbarButton( "cmdTunnel", icon, IC_SELECTED|IC_POPUP, SelectTunnel, NULL );
}
EXPORT void InitCmdBridge( void)
{
wIcon_p icon;
- icon = wIconCreatePixMap( bridge_xpm3[iconSize] );
+ icon = wIconCreatePixMap( bridge_image3[iconSize] );
AddToolbarButton( "cmdBridge", icon, IC_SELECTED|IC_POPUP, SelectBridge, NULL );
}
EXPORT void InitCmdRoadbed( void)
{
wIcon_p icon;
- icon = wIconCreatePixMap( roadbed_xpm3[iconSize] );
+ icon = wIconCreatePixMap( roadbed_image3[iconSize] );
AddToolbarButton( "cmdRoadbed", icon, IC_SELECTED|IC_POPUP, SelectRoadbed,
NULL );
}
@@ -3794,7 +3952,7 @@ EXPORT void InitCmdRoadbed( void)
EXPORT void InitCmdMoveDescription( wMenu_p menu )
{
AddMenuButton( menu, CmdMoveDescription, "cmdMoveLabel", _("Move Description"),
- wIconCreatePixMap(description_xpm3[iconSize]),
+ wIconCreatePixMap(description_image3[iconSize]),
LEVEL0, IC_STICKY|IC_POPUP3|IC_CMDMENU|IC_WANT_MOVE, ACCL_MOVEDESC, I2VP( 0 ));
}
@@ -3802,12 +3960,12 @@ EXPORT void InitCmdMoveDescription( wMenu_p menu )
EXPORT void InitCmdMove( wMenu_p menu )
{
moveCmdInx = AddMenuButton( menu, CmdMove, "cmdMove", _("Move"),
- wIconCreatePixMap(move_xpm3[iconSize]),
+ wIconCreatePixMap(move_image3[iconSize]),
LEVEL0, IC_STICKY|IC_SELECTED|IC_CMDMENU|IC_WANT_MOVE, ACCL_MOVE, NULL );
rotateCmdInx = AddMenuButton( menu, CmdRotate, "cmdRotate", _("Rotate"),
- wIconCreatePixMap(rotate_xpm3[iconSize]),
+ wIconCreatePixMap(rotate_image3[iconSize]),
LEVEL0, IC_STICKY|IC_SELECTED|IC_CMDMENU|IC_WANT_MOVE, ACCL_ROTATE, NULL );
flipCmdInx = AddMenuButton( menu, CmdFlip, "cmdFlip", _("Flip"),
- wIconCreatePixMap(reflect_xpm3[iconSize]),
+ wIconCreatePixMap(reflect_image3[iconSize]),
LEVEL0, IC_STICKY|IC_SELECTED|IC_CMDMENU, ACCL_FLIP, NULL );
}
diff --git a/app/bin/cselect.h b/app/bin/cselect.h
index 9227032..06fffc5 100644
--- a/app/bin/cselect.h
+++ b/app/bin/cselect.h
@@ -54,7 +54,6 @@ void DeselectLayer( unsigned int );
void SelectByIndex( void* string);
void ClearElevations( void * unused );
void AddElevations( DIST_T );
-void DoRefreshCompound( void * unused );
void WriteSelectedTracksToTempSegs( void );
void GetSelectedBounds( coOrd *, coOrd * );
STATUS_T CmdMoveDescription( wAction_t, coOrd );
@@ -62,5 +61,5 @@ void DrawHighlightBoxes(BOOL_T, BOOL_T,track_p);
void HighlightSelectedTracks(track_p trk_ignore, BOOL_T keep, BOOL_T invert );
typedef BOOL_T (*doSelectedTrackCallBack_t)(track_p, BOOL_T);
void DoSelectedTracks( doSelectedTrackCallBack_t doit );
-
+BOOL_T SelectedTracksAreFrozen( void );
#endif
diff --git a/app/bin/csensor.c b/app/bin/csensor.c
index 761b511..c9ecebc 100644
--- a/app/bin/csensor.c
+++ b/app/bin/csensor.c
@@ -444,7 +444,7 @@ static void EditSensorDialog()
sensorEditW = ParamCreateDialog (&sensorEditPG,
MakeWindowTitle(_("Edit sensor")),
_("Ok"), SensorEditOk,
- wHide, TRUE, NULL,
+ ParamCancel_Current, TRUE, NULL,
F_BLOCK,
NULL );
}
@@ -453,8 +453,10 @@ static void EditSensorDialog()
sensorEditScript[0] = '\0';
} else {
xx = GetsensorData ( sensorEditTrack );
- strncpy(sensorEditName,xx->name,STR_SHORT_SIZE);
- strncpy(sensorEditScript,xx->script,STR_LONG_SIZE);
+ strncpy(sensorEditName,xx->name,STR_SHORT_SIZE - 1);
+ sensorEditName[STR_SHORT_SIZE - 1] = '\0';
+ strncpy(sensorEditScript,xx->script,STR_LONG_SIZE - 1);
+ sensorEditScript[STR_LONG_SIZE - 1] = '\0';
sensorEditOrig = xx->orig;
}
ParamLoadControls( &sensorEditPG );
@@ -575,7 +577,7 @@ static int SensorMgmProc ( int cmd, void * data )
return FALSE;
}
-#include "bitmaps/sensor.xpm3"
+#include "bitmaps/sensor.image3"
EXPORT void SensorMgmLoad ( void )
{
@@ -583,7 +585,7 @@ EXPORT void SensorMgmLoad ( void )
static wIcon_p sensorI = NULL;
if (sensorI == NULL) {
- sensorI = wIconCreatePixMap( sensor_xpm3[iconSize] );
+ sensorI = wIconCreatePixMap( sensor_image3[iconSize] );
}
TRK_ITERATE(trk) {
@@ -597,7 +599,7 @@ EXPORT void SensorMgmLoad ( void )
EXPORT void InitCmdSensor ( wMenu_p menu )
{
AddMenuButton( menu, CmdSensor, "cmdSensor", _("Sensor"),
- wIconCreatePixMap( sensor_xpm3[iconSize] ), LEVEL0_50, IC_STICKY|IC_POPUP2,
+ wIconCreatePixMap( sensor_image3[iconSize] ), LEVEL0_50, IC_STICKY|IC_POPUP2,
ACCL_SENSOR, NULL );
}
diff --git a/app/bin/csignal.c b/app/bin/csignal.c
index 36392cc..d8e64f2 100644
--- a/app/bin/csignal.c
+++ b/app/bin/csignal.c
@@ -667,8 +667,10 @@ static void EditAspectDialog ( wIndex_t inx )
signalAspectEditName[0] = '\0';
signalAspectEditScript[0] = '\0';
} else {
- strncpy(signalAspectEditName,signalAspect(inx).aspectName,STR_SHORT_SIZE);
- strncpy(signalAspectEditScript,signalAspect(inx).aspectScript,STR_LONG_SIZE);
+ strncpy(signalAspectEditName,signalAspect(inx).aspectName,STR_SHORT_SIZE-1);
+ signalAspectEditName[STR_SHORT_SIZE-1] = '\0';
+ strncpy(signalAspectEditScript,signalAspect(inx).aspectScript,STR_LONG_SIZE-1);
+ signalAspectEditScript[STR_LONG_SIZE-1] = '\0';
}
signalAspectEditIndex = inx;
if ( !aspectEditW ) {
@@ -676,7 +678,7 @@ static void EditAspectDialog ( wIndex_t inx )
aspectEditW = ParamCreateDialog (&aspectEditPG,
MakeWindowTitle(_("Edit aspect")),
_("Ok"), aspectEditOK,
- wHide, TRUE, NULL,F_BLOCK,NULL);
+ ParamCancel_Current, TRUE, NULL,F_BLOCK,NULL);
}
ParamLoadControls( &aspectEditPG );
wShow( aspectEditW );
@@ -746,7 +748,8 @@ static void EditSignalDialog()
signalEditW = ParamCreateDialog (&signalEditPG,
MakeWindowTitle(_("Edit signal")),
_("Ok"), SignalEditOk,
- SignalEditCancel, TRUE, NULL,
+ ParamCancel_Custom( SignalEditCancel ),
+ TRUE, NULL,
F_RESIZE|F_RECALLSIZE|F_BLOCK,
SignalEditDlgUpdate );
}
@@ -757,7 +760,8 @@ static void EditSignalDialog()
DYNARR_RESET( signalAspect_p, signalAspect_da );
} else {
xx = GetsignalData ( signalEditTrack );
- strncpy(signalEditName,xx->name,STR_SHORT_SIZE);
+ strncpy(signalEditName,xx->name,STR_SHORT_SIZE - 1);
+ signalEditName[STR_SHORT_SIZE - 1] = '\0';
signalEditHeadCount = xx->numHeads;
signalEditOrig = xx->orig;
signalEditAngle = xx->angle;
@@ -907,7 +911,7 @@ static int SignalMgmProc ( int cmd, void * data )
return FALSE;
}
-#include "bitmaps/signal.xpm3"
+#include "bitmaps/signal.image3"
EXPORT void SignalMgmLoad ( void )
{
@@ -915,7 +919,7 @@ EXPORT void SignalMgmLoad ( void )
static wIcon_p signalI = NULL;
if (signalI == NULL) {
- signalI = wIconCreatePixMap( signal_xpm3[iconSize] );
+ signalI = wIconCreatePixMap( signal_image3[iconSize] );
}
TRK_ITERATE(trk) {
@@ -929,7 +933,7 @@ EXPORT void SignalMgmLoad ( void )
EXPORT void InitCmdSignal ( wMenu_p menu )
{
AddMenuButton( menu, CmdSignal, "cmdSignal", _("Signal"),
- wIconCreatePixMap( signal_xpm3[iconSize] ), LEVEL0_50, IC_STICKY|IC_POPUP2,
+ wIconCreatePixMap( signal_image3[iconSize] ), LEVEL0_50, IC_STICKY|IC_POPUP2,
ACCL_SIGNAL, NULL );
}
diff --git a/app/bin/csnap.c b/app/bin/csnap.c
index baf6998..f863df2 100644
--- a/app/bin/csnap.c
+++ b/app/bin/csnap.c
@@ -120,13 +120,13 @@ void static DrawGridPoint(
p0.y < 0.0 || p0.y > size->y ) ) {
return;
}
- DIST_T r;
+// DIST_T r;
nDrawGridPoints++;
- if ( bigdot ) {
- r = (bigdot_width+0.5)/2 - 0.5;
- } else {
- r = 0.75;
- }
+// if ( bigdot ) {
+// r = (bigdot_width+0.5)/2 - 0.5;
+// } else {
+// r = 0.75;
+// }
coOrd sz;
sz.x = sz.y = (bigdot?2.5:1.5)/dpi;
p0.x -= 1.0/dpi;
@@ -178,7 +178,7 @@ EXPORT void DrawGrid(
DIST_T hMinSpacing=0, vMinSpacing=0;
long f;
POS_T hMajSpacing_dpi, vMajSpacing_dpi;
- BOOL_T bigdot;
+ BOOL_T bigdot = FALSE;
if (hMajSpacing <= 0 && vMajSpacing <= 0) {
return;
@@ -526,29 +526,30 @@ static paramIntegerRange_t i0_1000 = { 0, 1000, 30 };
static paramFloatRange_t r_1000_1000 = { -1000.0, 1000.0, 80 };
static paramFloatRange_t r0_360 = { 0.0, 360.0, 80 };
static char *gridLabels[] = { "", NULL };
+
static paramData_t gridPLs[] = {
{ PD_MESSAGE, N_("Horz"), NULL, 0, I2VP(60) },
#define I_HORZSPACING (1)
- { PD_FLOAT, &grid.Horz.Spacing, "horzspacing", PDO_DIM, &r0_999999, N_("Spacing") },
+ { PD_FLOAT, &grid.Horz.Spacing, "horzspacing", PDO_NOPSHUPD|PDO_DIM, &r0_999999, N_("Spacing") },
#define I_HORZDIVISION (2)
- { PD_LONG, &grid.Horz.Division, "horzdivision", 0, &i0_1000, N_("Divisions") },
+ { PD_LONG, &grid.Horz.Division, "horzdivision", PDO_NOPSHUPD, &i0_1000, N_("Divisions") },
#define I_HORZENABLE (3)
#define gridHorzEnableT ((wChoice_p)gridPLs[I_HORZENABLE].control)
{ PD_TOGGLE, &grid.Horz.Enable, "horzenable", 0, gridLabels, N_("Enable"), BC_HORZ|BC_NOBORDER },
{ PD_MESSAGE, N_("Vert"), NULL, PDO_DLGNEWCOLUMN|PDO_DLGWIDE, I2VP(60) },
#define I_VERTSPACING (5)
- { PD_FLOAT, &grid.Vert.Spacing, "vertspacing", PDO_DIM, &r0_999999, NULL },
+ { PD_FLOAT, &grid.Vert.Spacing, "vertspacing", PDO_NOPSHUPD|PDO_DIM, &r0_999999, NULL },
#define I_VERTDIVISION (6)
- { PD_LONG, &grid.Vert.Division, "vertdivision", 0, &i0_1000, NULL },
+ { PD_LONG, &grid.Vert.Division, "vertdivision", PDO_NOPSHUPD, &i0_1000, NULL },
#define I_VERTENABLE (7)
#define gridVertEnableT ((wChoice_p)gridPLs[I_VERTENABLE].control)
{ PD_TOGGLE, &grid.Vert.Enable, "vertenable", 0, gridLabels, NULL, BC_HORZ|BC_NOBORDER },
#define I_VALUEX (8)
- { PD_FLOAT, &grid.Orig.x, "origx", PDO_DIM|PDO_DLGNEWCOLUMN|PDO_DLGWIDE, &r_1000_1000, N_("X") },
+ { PD_FLOAT, &grid.Orig.x, "origx", PDO_NOPSHUPD|PDO_DLGNEWCOLUMN|PDO_DLGWIDE, &r_1000_1000, N_("X") },
#define I_VALUEY (9)
- { PD_FLOAT, &grid.Orig.y, "origy", PDO_DIM, &r_1000_1000, N_("Y") },
+ { PD_FLOAT, &grid.Orig.y, "origy", PDO_NOPSHUPD, &r_1000_1000, N_("Y") },
#define I_VALUEA (10)
- { PD_FLOAT, &grid.Angle, "origa", PDO_ANGLE, &r0_360, N_("A") },
+ { PD_FLOAT, &grid.Angle, "origa", PDO_NOPSHUPD, &r0_360, N_("A") },
#define I_SHOW (11)
#define gridShowT ((wChoice_p)gridPLs[I_SHOW].control)
{ PD_TOGGLE, &grid.Show, "show", PDO_DLGIGNORELABELWIDTH, gridLabels, N_("Show"), BC_HORZ|BC_NOBORDER }
@@ -667,7 +668,6 @@ static void GridButtonUpdate( long mode0 )
if ( mode0&CHK_SHOW ) {
RedrawGrid();
}
- oldGrid = grid;
}
@@ -699,10 +699,21 @@ static void GridDlgUpdate(
case I_SHOW:
GridButtonUpdate( CHK_SHOW );
break;
- default:
+ case I_HORZSPACING:
+ case I_HORZDIVISION:
+ case I_VERTSPACING:
+ case I_VERTDIVISION:
+ case I_VALUEX:
+ case I_VALUEY:
+ case I_VALUEA:
ParamLoadData( &gridPG );
+ MainRedraw(); // GridDlgUpdate
+ break;
+ default:
+// ParamLoadData( &gridPG );
GridButtonUpdate( 0 );
MainRedraw(); // GridDlgUpdate
+ break;
}
}
@@ -713,7 +724,6 @@ static void SnapGridRotate( void * pangle )
wDrawDelayUpdate( tempD.d, TRUE );
grid.Orig = cmdMenuPos;
grid.Angle += angle/1000;
- oldGrid = grid;
DrawASnapGrid( &grid, &tempD, mapD.size, TRUE );
wDrawDelayUpdate( tempD.d, FALSE );
ParamLoadControls( &gridPG );
@@ -731,7 +741,7 @@ EXPORT STATUS_T CmdGrid(
case C_START:
if (gridW == NULL) {
gridW = ParamCreateDialog( &gridPG, MakeWindowTitle(_("Snap Grid")), _("Ok"),
- GridOk, (paramActionCancelProc)Reset, TRUE, NULL, 0, GridDlgUpdate );
+ GridOk, ParamCancel_Null, TRUE, NULL, 0, GridDlgUpdate );
}
oldGrid = grid;
ParamLoadControls( &gridPG );
@@ -744,6 +754,7 @@ EXPORT STATUS_T CmdGrid(
case C_CANCEL:
grid = oldGrid;
+// ParamLoadControls( &gridPG );
wHide( gridW );
return C_TERMINATE;
@@ -761,7 +772,6 @@ EXPORT STATUS_T CmdGrid(
case C_DOWN:
case C_RDOWN:
- oldGrid = grid;
rc = GridAction( action, pos, &grid.Orig, &grid.Angle );
return rc;
case C_MOVE:
@@ -774,7 +784,6 @@ EXPORT STATUS_T CmdGrid(
rc = GridAction( action, pos, &grid.Orig, &grid.Angle );
ParamLoadControls( &gridPG );
RedrawGrid();
- oldGrid = grid;
return rc;
case C_CMDMENU:
@@ -830,14 +839,14 @@ EXPORT void SnapGridShow( void * unused )
GridButtonUpdate( CHK_SHOW );
}
-#include "bitmaps/snap-curs.xpm3"
-#include "bitmaps/snap-grid.xpm3"
+#include "bitmaps/snap-curs.image3"
+#include "bitmaps/snap-grid.image3"
EXPORT void InitSnapGridButtons( void )
{
snapGridEnable_b = AddToolbarButton( "cmdGridEnable",
- wIconCreatePixMap(snap_curs_xpm3[iconSize] ), 0, SnapGridEnable, NULL );
+ wIconCreatePixMap(snap_curs_image3[iconSize] ), 0, SnapGridEnable, NULL );
snapGridShow_b = AddToolbarButton( "cmdGridShow",
- wIconCreatePixMap(snap_grid_xpm3[iconSize] ), IC_MODETRAIN_TOO, SnapGridShow,
+ wIconCreatePixMap(snap_grid_image3[iconSize] ), IC_MODETRAIN_TOO, SnapGridShow,
NULL );
}
diff --git a/app/bin/csplit.c b/app/bin/csplit.c
index 154b837..8a98866 100644
--- a/app/bin/csplit.c
+++ b/app/bin/csplit.c
@@ -495,21 +495,21 @@ static STATUS_T CmdTrimDraw( wAction_t action, coOrd pos )
}
-#include "bitmaps/split.xpm3"
-#include "bitmaps/split-draw.xpm3"
-#include "bitmaps/trim.xpm3"
+#include "bitmaps/split.image3"
+#include "bitmaps/split-draw.image3"
+#include "bitmaps/trim.image3"
void InitCmdSplit( wMenu_p menu )
{
ButtonGroupBegin( _("Split"), "cmdSplitSetCmd", _("Split") );
AddMenuButton( menu, CmdSplitTrack, "cmdSplitTrack", _("Split Track"),
- wIconCreatePixMap(split_xpm3[iconSize]), LEVEL0_50,
+ wIconCreatePixMap(split_image3[iconSize]), LEVEL0_50,
IC_STICKY|IC_POPUP|IC_CMDMENU|IC_WANT_MOVE, ACCL_SPLIT, NULL);
AddMenuButton( menu, CmdSplitDraw, "cmdSplitDraw", _("Split Draw"),
- wIconCreatePixMap(split_draw_xpm3[iconSize]), LEVEL0_50,
+ wIconCreatePixMap(split_draw_image3[iconSize]), LEVEL0_50,
IC_STICKY|IC_POPUP|IC_WANT_MOVE, ACCL_SPLITDRAW, NULL);
AddMenuButton( menu, CmdTrimDraw, "cmdTrimDraw", _("Trim Draw"),
- wIconCreatePixMap(trim_xpm3[iconSize]), LEVEL0_50,
+ wIconCreatePixMap(trim_image3[iconSize]), LEVEL0_50,
IC_STICKY|IC_POPUP|IC_WANT_MOVE, ACCL_TRIMDRAW, NULL);
ButtonGroupEnd();
}
diff --git a/app/bin/cstraigh.c b/app/bin/cstraigh.c
index b61d9b8..79e0624 100644
--- a/app/bin/cstraigh.c
+++ b/app/bin/cstraigh.c
@@ -197,11 +197,11 @@ static STATUS_T CmdStraight( wAction_t action, coOrd pos )
}
-#include "bitmaps/straight.xpm3"
+#include "bitmaps/straight.image3"
void InitCmdStraight( wMenu_p menu )
{
AddMenuButton( menu, CmdStraight, "cmdStraight", _("Straight Track"),
- wIconCreatePixMap(straight_xpm3[iconSize]), LEVEL0_50,
+ wIconCreatePixMap(straight_image3[iconSize]), LEVEL0_50,
IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_STRAIGHT, NULL );
}
diff --git a/app/bin/cstruct.c b/app/bin/cstruct.c
index 9006ebd..f45988a 100644
--- a/app/bin/cstruct.c
+++ b/app/bin/cstruct.c
@@ -646,7 +646,6 @@ static void StructureDlgUpdate(
curStructure = to;
ShowPierL();
RedrawStructure( structureD.d, NULL, 0, 0 );
- /* ParamDialogOkActive( &structurePG, FALSE ); */
}
@@ -985,7 +984,7 @@ EXPORT STATUS_T CmdStructureAction(
DYNARR_RESET(trkSeg_t,anchors_da);
Dst.state = 0;
InfoSubstituteControls( NULL, NULL );
- HotBarCancel();
+ //HotBarCancel();
/*wHide( newTurn.reg.win );*/
return C_TERMINATE;
@@ -1028,11 +1027,13 @@ static STATUS_T CmdStructure(
case C_START:
if (structureW == NULL) {
structureW = ParamCreateDialog( &structurePG, MakeWindowTitle(_("Structure")),
- _("Close"), (paramActionOkProc)DoStructOk, wHide, TRUE, NULL, F_RESIZE,
+ _("Close"), (paramActionOkProc)DoStructOk,
+ ParamCancel_Null, TRUE, NULL,
+ F_RESIZE,
StructureDlgUpdate );
RegisterChangeNotification( structureChange );
}
- ParamDialogOkActive( &structurePG, FALSE );
+ ParamDialogOkActive( &structurePG, TRUE );
structureIndex = wListGetIndex( structureListL );
structurePtr = curStructure;
wShow( structureW );
@@ -1098,7 +1099,7 @@ static STATUS_T CmdStructure(
case C_CANCEL:
wHide( structureW );
- return C_CANCEL;
+ return C_TERMINATE;
case C_REDRAW:
case C_TEXT:
@@ -1239,12 +1240,12 @@ static STATUS_T CmdStructureHotBar(
}
}
-#include "bitmaps/building.xpm3"
+#include "bitmaps/building.image3"
EXPORT void InitCmdStruct( wMenu_p menu )
{
AddMenuButton( menu, CmdStructure, "cmdStructure", _("Structure"),
- wIconCreatePixMap(building_xpm3[iconSize]), LEVEL0_50,
+ wIconCreatePixMap(building_image3[iconSize]), LEVEL0_50,
IC_WANT_MOVE|IC_STICKY|IC_CMDMENU|IC_POPUP2, ACCL_STRUCTURE, NULL );
structureHotBarCmdInx = AddMenuButton( menu, CmdStructureHotBar,
"cmdStructureHotBar", "", NULL, LEVEL0_50,
diff --git a/app/bin/cswitchmotor.c b/app/bin/cswitchmotor.c
index 7bdbbcf..8748b97 100644
--- a/app/bin/cswitchmotor.c
+++ b/app/bin/cswitchmotor.c
@@ -605,7 +605,9 @@ static void NewSwitchMotorDialog(track_p trk)
if ( !switchmotorW ) {
ParamRegister( &switchmotorPG );
switchmotorW = ParamCreateDialog (&switchmotorPG,
- MakeWindowTitle(_("Create switch motor")), _("Ok"), SwitchMotorOk, wHide, TRUE,
+ MakeWindowTitle(_("Create switch motor")),
+ ("Ok"), SwitchMotorOk,
+ ParamCancel_Current, TRUE,
NULL, F_BLOCK, NULL );
switchmotorD.dpi = mainD.dpi;
}
@@ -763,10 +765,14 @@ static void SwitchMotorEditOk ( void * junk )
static void EditSwitchMotor (track_p trk)
{
switchmotorData_p xx = GetswitchmotorData(trk);
- strncpy(switchmotorEditName,xx->name,STR_SHORT_SIZE);
- strncpy(switchmotorEditNormal,xx->normal,STR_LONG_SIZE);
- strncpy(switchmotorEditReverse,xx->reverse,STR_LONG_SIZE);
- strncpy(switchmotorEditPointSense,xx->pointsense,STR_LONG_SIZE);
+ strncpy(switchmotorEditName,xx->name,STR_SHORT_SIZE - 1);
+ switchmotorEditName[STR_SHORT_SIZE - 1] = '\0';
+ strncpy(switchmotorEditNormal,xx->normal,STR_LONG_SIZE - 1);
+ switchmotorEditNormal[STR_LONG_SIZE - 1] = '\0';
+ strncpy(switchmotorEditReverse,xx->reverse,STR_LONG_SIZE - 1);
+ switchmotorEditReverse[STR_LONG_SIZE - 1] = '\0';
+ strncpy(switchmotorEditPointSense,xx->pointsense,STR_LONG_SIZE - 1);
+ switchmotorEditPointSense[STR_LONG_SIZE - 1] = '\0';
if (xx->turnout == NULL) { switchmotorEditTonum = 0; }
else { switchmotorEditTonum = GetTrkIndex(xx->turnout); }
switchmotorEditTrack = trk;
@@ -775,7 +781,7 @@ static void EditSwitchMotor (track_p trk)
switchmotorEditW = ParamCreateDialog (&switchmotorEditPG,
MakeWindowTitle(_("Edit switch motor")),
_("Ok"), SwitchMotorEditOk,
- wHide, TRUE, NULL, F_BLOCK,
+ ParamCancel_Current, TRUE, NULL, F_BLOCK,
NULL );
}
ParamLoadControls( &switchmotorEditPG );
@@ -857,12 +863,7 @@ static int SwitchmotorMgmProc ( int cmd, void * data )
return FALSE;
}
-//#include "bitmaps/switchmotor.xpm"
-
-//#include "bitmaps/switchmnew.xpm"
-//#include "bitmaps/switchmedit.xpm"
-//#include "bitmaps/switchmdel.xpm"
-#include "bitmaps/switch-motor.xpm3"
+#include "bitmaps/switch-motor.image3"
EXPORT void SwitchmotorMgmLoad( void )
{
@@ -870,7 +871,7 @@ EXPORT void SwitchmotorMgmLoad( void )
static wIcon_p switchmI = NULL;
if ( switchmI == NULL) {
- switchmI = wIconCreatePixMap( switch_motor_xpm3[iconSize] );
+ switchmI = wIconCreatePixMap( switch_motor_image3[iconSize] );
}
TRK_ITERATE(trk) {
@@ -886,7 +887,7 @@ EXPORT void InitCmdSwitchMotor( wMenu_p menu )
switchmotorReverse[0] = '\0';
switchmotorPointSense[0] = '\0';
AddMenuButton( menu, CmdSwitchMotorCreate, "cmdSwitchMotorCreate",
- _("Switch Motor"), wIconCreatePixMap( switch_motor_xpm3[iconSize] ),
+ _("Switch Motor"), wIconCreatePixMap( switch_motor_image3[iconSize] ),
LEVEL0_50, IC_STICKY|IC_POPUP2, ACCL_SWITCHMOTOR1,
NULL );
ParamRegister( &switchmotorPG );
diff --git a/app/bin/ctext.c b/app/bin/ctext.c
index 673e4f7..2a506dd 100644
--- a/app/bin/ctext.c
+++ b/app/bin/ctext.c
@@ -28,14 +28,6 @@
#include "misc.h"
#include "common-ui.h"
-track_p NewText( wIndex_t index, coOrd p, ANGLE_T angle, char * text,
- CSIZE_T textSize, wDrawColor color, BOOL_T boxed );
-
-void LoadFontSizeList( wList_p, long );
-void UpdateFontSizeList( long *, wList_p, wIndex_t );
-long GetFontSize(long);
-long GetFontSizeIndex(long size);
-
static wMenu_p textPopupM;
/*****************************************************************************
@@ -53,7 +45,7 @@ static struct {
coOrd pos;
ANGLE_T angle;
long size;
- wIndex_t fontSizeInx;
+ long fontSizeInx;
char text[STR_HUGE_SIZE];
wDrawColor color;
BOOL_T boxed;
@@ -127,7 +119,7 @@ static STATUS_T CmdText( wAction_t action, coOrd pos )
ParamCreateControls(&textPG, TextDlgUpdate);
LoadFontSizeList((wList_p)textPD.control, Dt.size);
ParamRegister(&textPG);
- Dt.size = GetFontSize(Dt.fontSizeInx);
+ Dt.size = GetFontSize((long int)Dt.fontSizeInx);
}
Dt.size = (long)wSelectedFontSize();
Dt.fontSizeInx = GetFontSizeIndex(Dt.size);
@@ -266,12 +258,12 @@ static STATUS_T CmdText( wAction_t action, coOrd pos )
}
-#include "bitmaps/text.xpm3"
+#include "bitmaps/text.image3"
void InitCmdText( wMenu_p menu )
{
AddMenuButton( menu, CmdText, "cmdText", _("Text"),
- wIconCreatePixMap(text_xpm3[iconSize]), LEVEL0_50,
+ wIconCreatePixMap(text_image3[iconSize]), LEVEL0_50,
IC_STICKY|IC_CMDMENU|IC_POPUP2, ACCL_TEXT, NULL );
textPopupM = MenuRegister( "Text Font" );
wMenuPushCreate( textPopupM, "", _("Fonts..."), 0, SelectFont, NULL );
diff --git a/app/bin/ctodesgn.c b/app/bin/ctodesgn.c
index 1b50d91..0c9a72b 100644
--- a/app/bin/ctodesgn.c
+++ b/app/bin/ctodesgn.c
@@ -35,7 +35,9 @@
#include "misc.h"
#include "common-ui.h"
+#ifndef MKTURNOUT
static int log_cornuturnoutdesigner;
+#endif
dynArr_t tempSegs_da;
char tempCustom[4096];
@@ -220,7 +222,9 @@ static paramData_t turnDesignPLs[] = {
static paramGroup_t turnDesignPG = { "turnoutNew", 0, turnDesignPLs, COUNT( turnDesignPLs ) };
static turnoutInfo_t * customTurnout1, * customTurnout2;
-static BOOL_T includeNontrackSegments;
+
+/* Copy non-track segs if there are any (Group & CustMgm/Edit) and user said yes. */
+static BOOL_T includeNontrackSegments = FALSE;
#else
int doCustomInfoLine = 1;
@@ -3085,7 +3089,7 @@ static void NewTurnOk( void * context )
fclose(f);
}
SetUserLocale();
- includeNontrackSegments = TRUE;
+ includeNontrackSegments = FALSE;
wHide( newTurnW );
DoChangeNotification( CHANGE_PARAMS );
@@ -3095,13 +3099,6 @@ static void NewTurnOk( void * context )
#ifndef MKTURNOUT
-static void NewTurnCancel( wWin_p win )
-{
- wHide( newTurnW );
- includeNontrackSegments = TRUE;
-}
-
-
static wWinPix_t turnDesignWidth;
static wWinPix_t turnDesignHeight;
@@ -3145,7 +3142,7 @@ static void SetupTurnoutDesignerW( toDesignDesc_t * newDesign )
I2VP(partnoWidth);
partnoWidth += wLabelWidth( " # " );
newTurnW = ParamCreateDialog( &turnDesignPG, _("Turnout Designer"), _("Print"),
- NewTurnPrint, NewTurnCancel, TRUE, TurnDesignLayout, F_BLOCK, NULL );
+ NewTurnPrint, ParamCancel_Current, TRUE, TurnDesignLayout, F_BLOCK, NULL );
for ( inx=0; inx<COUNT( designDescs ); inx++ ) {
designDescs[inx]->lineC = wLineCreate( turnDesignPG.win, NULL,
designDescs[inx]->lineCnt, designDescs[inx]->lines );
@@ -3265,6 +3262,7 @@ static void ShowTurnoutDesigner( void * context )
fprintf( recordF, TURNOUTDESIGNER " SHOW %s\n",
((toDesignDesc_t*)context)->label );
}
+ includeNontrackSegments = FALSE;
newTurnScaleName = curScaleName;
newTurnTrackGauge = trackGauge;
if (context && (curDesign == context)) {
@@ -3500,13 +3498,10 @@ EXPORT void EditCustomTurnout( turnoutInfo_t * to, turnoutInfo_t * to1 )
}
}
- includeNontrackSegments = TRUE;
- if ( segsDiff ) {
- if ( NoticeMessage( MSG_SEGMENTS_DIFFER, _("Yes"), _("No") ) <= 0 ) {
- includeNontrackSegments = FALSE;
- }
- } else {
- includeNontrackSegments = FALSE;
+ includeNontrackSegments = FALSE;
+ if ( segsDiff &&
+ NoticeMessage( MSG_SEGMENTS_DIFFER, _("Yes"), _("No") ) > 0 ) {
+ includeNontrackSegments = TRUE;
}
/*if (recordF)
fprintf( recordF, TURNOUTDESIGNER " SHOW %s\n", dp->label );*/
@@ -3527,7 +3522,7 @@ EXPORT void InitNewTurn( wMenu_p m )
AddPlaybackProc( message, (playbackProc_p)ShowTurnoutDesigner, designDescs[i] );
}
newTurnRoadbedColor = wDrawColorBlack;
- includeNontrackSegments = TRUE;
+ includeNontrackSegments = FALSE;
log_cornuturnoutdesigner = LogFindIndex( "cornuturnoutdesigner" );
}
#endif
diff --git a/app/bin/ctrain.c b/app/bin/ctrain.c
index 015f9e8..acbaef7 100644
--- a/app/bin/ctrain.c
+++ b/app/bin/ctrain.c
@@ -31,6 +31,8 @@
#include "track.h"
#include "common-ui.h"
+#include "include/toolbar.h"
+
long programMode;
long maxCouplingSpeed = 100;
long hideTrainsInTunnels;
@@ -47,7 +49,9 @@ typedef struct extraDataCar_t {
long state;
carItem_p item;
double speed;
+#ifdef CAR_CLEARANCE
BOOL_T pencils;
+#endif
BOOL_T direction;
BOOL_T autoReverse;
trainStatus_e status;
@@ -92,7 +96,7 @@ static void ControllerDialogSyncAll(void);
static STATUS_T CmdTrain(wAction_t, coOrd);
static wMenu_p trainPopupM;
static wMenuPush_p trainPopupMI[11];
-static track_p followTrain;
+static track_p followTrain = NULL;
static coOrd followCenter;
static BOOL_T trainsTimeoutPending;
static enum { TRAINS_STOP, TRAINS_RUN, TRAINS_IDLE, TRAINS_PAUSE } trainsState;
@@ -382,7 +386,10 @@ static void DrawCar(
CarItemDraw(d, xx->item, color, xx->direction, IsLocoMaster(xx), coupler,
- xx->pencils, xx->trvTrk.trk);
+#ifdef CAR_CLEARANCE
+ xx->pencils,
+#endif
+ xx->trvTrk.trk);
}
@@ -1376,7 +1383,7 @@ static trainControlDlg_p CreateTrainControlDlg(void)
sprintf(title, _("Train Control %d"), ++numTrainDlg);
dlg->trainPGp = &trainPG;
dlg->win = ParamCreateDialog(dlg->trainPGp, _("Train Control"), NULL, NULL,
- NULL, FALSE, NULL, 0, ControllerDialogUpdate);
+ ParamCancel_Null, FALSE, NULL, 0, ControllerDialogUpdate);
speedD.size.x = SLIDER_WIDTH/speedD.dpi;
speedD.size.y = SLIDER_HEIGHT/speedD.dpi;
return dlg;
@@ -1395,7 +1402,6 @@ static struct {
long trainPause = 200;
-static track_p followTrain = NULL;
static void DrawAllCars(track_p trk)
{
track_p car;
@@ -2573,8 +2579,10 @@ static BOOL_T TrainOnMovableTrack(
#define DO_MUMASTER (5)
#define DO_CHANGEDIR (6)
#define DO_STOP (7)
+#ifdef CAR_CLEARANCE
#define DO_PENCILS_ON (8)
#define DO_PENCILS_OFF (9)
+#endif
#define DO_DESCRIBE (10)
static track_p trainFuncCar;
static coOrd trainFuncPos;
@@ -2632,7 +2640,7 @@ static STATUS_T CmdTrain(wAction_t action, coOrd pos)
LocoListInit();
ControllerDialogSync(curTrainDlg);
wShow(curTrainDlg->win);
- wControlShow((wControl_p)newcarB, (toolbarSet&(1<<BG_TRAIN)));
+ wControlShow((wControl_p)newcarB, ToolbarIsGroupVisible(BG_TRAIN));
currCarItemPtr = NULL;
TempRedraw(); // CmdTrain C_START
return C_CONTINUE;
@@ -2668,7 +2676,9 @@ static STATUS_T CmdTrain(wAction_t action, coOrd pos)
CHECK(currCar != NULL);
xx = GET_EXTRA_DATA(currCar, T_CAR, extraDataCar_t);
+#ifdef CAR_CLEARANCE
xx->pencils = FALSE;
+#endif
dist = CarItemCoupledLength(xx->item)/2.0;
Translate(&pos, xx->trvTrk.pos, xx->trvTrk.angle, dist);
SetTrkEndPoint(currCar, 0, pos, xx->trvTrk.angle);
@@ -2857,13 +2867,15 @@ static STATUS_T CmdTrain(wAction_t action, coOrd pos)
}
xx = GET_EXTRA_DATA(trainFuncCar, T_CAR, extraDataCar_t);
+#ifdef CAR_CLEARANCE
if (xx->pencils) {
-// wMenuPushEnable(trainPopupMI[DO_PENCILS_OFF], TRUE);
-// wMenuPushEnable(trainPopupMI[DO_PENCILS_ON], FALSE);
+ wMenuPushEnable(trainPopupMI[DO_PENCILS_OFF], TRUE);
+ wMenuPushEnable(trainPopupMI[DO_PENCILS_ON], FALSE);
} else {
-// wMenuPushEnable(trainPopupMI[DO_PENCILS_OFF], FALSE);
-// wMenuPushEnable(trainPopupMI[DO_PENCILS_ON], TRUE);
+ wMenuPushEnable(trainPopupMI[DO_PENCILS_OFF], FALSE);
+ wMenuPushEnable(trainPopupMI[DO_PENCILS_ON], TRUE);
}
+#endif
trk0 = FindMasterLoco(trainFuncCar,NULL);
dir = IsAligned(xx->trvTrk.angle, FindAngle(xx->trvTrk.pos,
@@ -2956,6 +2968,7 @@ static STATUS_T CmdTrain(wAction_t action, coOrd pos)
}
+#ifdef LATER
/*
*
*/
@@ -2966,16 +2979,17 @@ static STATUS_T CmdCarDescAction(
{
return CmdTrain(action, pos);
}
+#endif
-#include "bitmaps/train.xpm3"
-#include "bitmaps/exit.xpm3"
-#include "bitmaps/new-car.xpm3"
-#include "bitmaps/go.xpm3"
-#include "bitmaps/stop.xpm3"
+#include "bitmaps/train.image3"
+#include "bitmaps/exit.image3"
+#include "bitmaps/new-car.image3"
+#include "bitmaps/go.image3"
+#include "bitmaps/stop.image3"
-#include "bitmaps/zero.xpm"
-#include "bitmaps/greendot.xpm"
-#include "bitmaps/reddot.xpm"
+#include "bitmaps/zero.image1"
+#include "bitmaps/greendot.image1"
+#include "bitmaps/reddot.image1"
static void CmdTrainStopGo(void * unused)
@@ -3031,7 +3045,6 @@ static void TrainFunc(
coOrd pos0, pos1;
ANGLE_T angle0, angle1;
EPINX_T ep0, ep1;
- char describe_str[STR_SIZE];
if (trainFuncCar == NULL) {
fprintf(stderr, "trainFunc: trainFuncCar==NULL\n");
@@ -3048,6 +3061,7 @@ static void TrainFunc(
UncoupleCars( trainFuncCar, dir );
break;
+#ifdef CAR_CLEARANCE
case DO_PENCILS_ON:
xx->pencils = TRUE;
break;
@@ -3055,6 +3069,7 @@ static void TrainFunc(
case DO_PENCILS_OFF:
xx->pencils = FALSE;
break;
+#endif
case DO_FLIPCAR:
temp0 = GetTrkEndTrk(trainFuncCar,0);
@@ -3196,23 +3211,23 @@ void InitCmdTrain(wMenu_p menu)
{
log_trainMove = LogFindIndex("trainMove");
log_trainPlayback = LogFindIndex("trainPlayback");
- trainPLs[I_ZERO].winLabel = (char*)wIconCreatePixMap(zero_xpm);
+ trainPLs[I_ZERO].winLabel = (char*)wIconCreatePixMap(zero_image1);
ParamRegister(&trainPG);
trainCmdInx = AddMenuButton(menu, CmdTrain, "cmdTrain", _("Run Trains"),
- wIconCreatePixMap(train_xpm3[iconSize]), LEVEL0_50,
+ wIconCreatePixMap(train_image3[iconSize]), LEVEL0_50,
IC_POPUP3|IC_LCLICK|IC_RCLICK|IC_WANT_MOVE, 0,
NULL);
- stopI = wIconCreatePixMap(reddot);
- goI = wIconCreatePixMap(greendot);
- stopB = wIconCreatePixMap(stop_xpm3[iconSize]);
- goB = wIconCreatePixMap(go_xpm3[iconSize]);
+ stopI = wIconCreatePixMap(reddot_image1);
+ goI = wIconCreatePixMap(greendot_image1);
+ stopB = wIconCreatePixMap(stop_image3[iconSize]);
+ goB = wIconCreatePixMap(go_image3[iconSize]);
trainPauseB = AddToolbarButton("cmdTrainPause", stopB, IC_MODETRAIN_ONLY,
CmdTrainStopGo, NULL);
- AddToolbarButton("cmdTrainExit", wIconCreatePixMap(exit_xpm3[iconSize]),
+ AddToolbarButton("cmdTrainExit", wIconCreatePixMap(exit_image3[iconSize]),
IC_MODETRAIN_ONLY,
CmdTrainExit, NULL);
newcarB = AddToolbarButton("cmdTrainNewCar",
- wIconCreatePixMap(new_car_xpm3[iconSize]),
+ wIconCreatePixMap(new_car_image3[iconSize]),
IC_MODETRAIN_ONLY, CarItemLoadList, NULL);
T_CAR = InitObject(&carCmds);
@@ -3221,15 +3236,17 @@ void InitCmdTrain(wMenu_p menu)
TrainFunc, I2VP(DO_UNCOUPLE));
trainPopupMI[DO_FLIPCAR] = wMenuPushCreate(trainPopupM, "", _("Flip Car"), 0,
TrainFunc, I2VP(DO_FLIPCAR));
+#ifdef CAR_CLEARANCE
trainPopupMI[DO_PENCILS_ON] = wMenuPushCreate(trainPopupM, "",
_("Clearance Lines On"), 0,
TrainFunc, I2VP(DO_PENCILS_ON));
trainPopupMI[DO_PENCILS_OFF] = wMenuPushCreate(trainPopupM, "",
_("Clearance Lines Off"), 0,
TrainFunc, I2VP(DO_PENCILS_OFF));
+#endif
trainPopupMI[DO_FLIPTRAIN] = wMenuPushCreate(trainPopupM, "", _("Flip Train"),
0, TrainFunc, I2VP(DO_FLIPTRAIN));
- trainPopupMI[DO_DESCRIBE] = wMenuPushCreate(trainPopupM, "", _("Describe"),
+ trainPopupMI[DO_DESCRIBE] = wMenuPushCreate(trainPopupM, "", _("Properties"),
0, TrainFunc, I2VP(DO_DESCRIBE));
trainPopupMI[DO_MUMASTER] = wMenuPushCreate(trainPopupM, "", _("MU Master"),
0, TrainFunc, I2VP(DO_MUMASTER));
diff --git a/app/bin/ctrain.h b/app/bin/ctrain.h
index 0e06332..a0d324a 100644
--- a/app/bin/ctrain.h
+++ b/app/bin/ctrain.h
@@ -62,7 +62,10 @@ void CarItemSetLocoMaster( carItem_p, BOOL_T );
void CarItemSetTrack( carItem_p, track_p );
void CarItemPlace( carItem_p, traverseTrack_p, DIST_T * );
void CarItemDraw( drawCmd_p, carItem_p, wDrawColor, int, BOOL_T, vector_t *,
- BOOL_T, track_p );
+#ifdef CAR_CLEARANCE
+ BOOL_T,
+#endif
+ track_p );
BOOL_T WriteCars( FILE * );
void ClearCars( void );
diff --git a/app/bin/cturnout.c b/app/bin/cturnout.c
index 9bae6ae..96f4f93 100644
--- a/app/bin/cturnout.c
+++ b/app/bin/cturnout.c
@@ -2117,7 +2117,6 @@ static void TurnoutDlgUpdate(
AddTurnout();
curTurnout = to;
RedrawTurnout( turnoutD.d, NULL, 0, 0 );
- /* ParamDialogOkActive( &turnoutPG, FALSE ); */
}
@@ -2958,13 +2957,11 @@ static STATUS_T CmdTurnout(
case C_START:
if (turnoutW == NULL) {
- /* turnoutW = ParamCreateDialog( &turnoutPG, MakeWindowTitle("Fixed-Track"), "Ok", , (paramActionCancelProc)Reset, TRUE, NULL, F_RESIZE|F_RECALLSIZE, TurnoutDlgUpdate ); */
turnoutW = ParamCreateDialog(&turnoutPG, MakeWindowTitle(_("Add Fixed-Track")),
- _("Close"), (paramActionOkProc)TurnoutOk, wHide, TRUE, NULL,
+ _("Close"), (paramActionOkProc)TurnoutOk, ParamCancel_Null, TRUE, NULL,
F_RESIZE | F_RECALLSIZE | PD_F_ALT_CANCELLABEL, TurnoutDlgUpdate);
InitNewTurn(turnoutNewM);
}
- /* ParamDialogOkActive( &turnoutPG, FALSE ); */
turnoutIndex = wListGetIndex(turnoutListL);
turnoutPtr = curTurnout;
wShow(turnoutW);
@@ -3182,13 +3179,13 @@ static STATUS_T CmdTurnoutHotBar(
}
#ifdef TURNOUTCMD
-#include "bitmaps/turnout.xpm3"
+#include "bitmaps/turnout.image3"
EXPORT void InitCmdTurnout(wMenu_p menu)
{
AddMenuButton(menu, CmdTurnout, "cmdNewFixedTrack", _("Fixed-Track"),
- wIconCreatePixMap(turnout_xpm3[iconSize]), LEVEL0_50,
+ wIconCreatePixMap(turnout_image3[iconSize]), LEVEL0_50,
IC_WANT_MOVE | IC_STICKY | IC_LCLICK | IC_CMDMENU | IC_POPUP2, ACCL_TURNOUT,
NULL);
turnoutHotBarCmdInx = AddMenuButton(menu, CmdTurnoutHotBar, "cmdTurnoutHotBar",
diff --git a/app/bin/cturntbl.c b/app/bin/cturntbl.c
index bab9850..e879f4e 100644
--- a/app/bin/cturntbl.c
+++ b/app/bin/cturntbl.c
@@ -221,9 +221,6 @@ static void DrawTurntable( track_p t, drawCmd_p d, wDrawColor color )
p0 = GetTrkEndPos( t, xx->currEp );
Translate( &p1, xx->pos, GetTrkEndAngle(t,xx->currEp)+180.0, xx->radius );
}
- if (color == wDrawColorBlack) {
- color = normalColor;
- }
DrawArc( d, xx->pos, xx->radius, 0.0, 360.0, 0,
(color == wDrawColorPreviewSelected
|| color == wDrawColorPreviewUnselected)?3:0, color );
@@ -1082,13 +1079,13 @@ static STATUS_T CmdTurntable( wAction_t action, coOrd pos )
}
-#include "bitmaps/turntable.xpm3"
+#include "bitmaps/turntable.image3"
EXPORT void InitCmdTurntable( wMenu_p menu )
{
AddMenuButton( menu, CmdTurntable, "cmdTurntable", _("Custom Turntable"),
- wIconCreatePixMap(turntable_xpm3[iconSize]), LEVEL0_50,
+ wIconCreatePixMap(turntable_image3[iconSize]), LEVEL0_50,
IC_STICKY|IC_INITNOTSTICKY, ACCL_TURNTABLE, NULL );
}
diff --git a/app/bin/cundo.c b/app/bin/cundo.c
index b58d541..4f302ee 100644
--- a/app/bin/cundo.c
+++ b/app/bin/cundo.c
@@ -96,12 +96,15 @@ static int rbuff_record = 0;
EXPORT void Rdump( FILE * outf )
{
- fprintf( outf, "Record Buffer:\n" );
+ time_t clock;
+ time(&clock);
+ fprintf( outf, "Record Buffer %s:\n", ctime(&clock) );
rbuff[RBUFF_SIZE] = '\0';
fprintf( outf, "%s", rbuff+roff );
rbuff[roff] = '\0';
fprintf( outf, "%s", rbuff );
memset( rbuff, 0, sizeof rbuff );
+ fflush( outf );
roff = 0;
}
@@ -152,6 +155,7 @@ typedef struct {
track_p * oldTail;
track_p * newTail;
char * label;
+ dynArr_t deferFree_da;
} undoStack_t, *undoStack_p;
static undoStack_t undoStack[UNDO_STACK_SIZE];
@@ -794,8 +798,6 @@ void UndoStart(
int inx;
int usp;
- LOG( log_undo, 1, ( "UndoStart[%d] (%s) d:%d u:%d us:"SLOG_FMT"\n", undoHead,
- label, undoHead, doCount, undoCount, undoStream.end ) )
if (recordUndo) {
va_start( ap, format );
vsprintf( buff, format, ap );
@@ -817,6 +819,8 @@ void UndoStart(
}
INC_UNDO_INX(undoHead);
+ LOG( log_undo, 1, ( "UndoStart[%d] (%s) d:%d u:%d us:"SLOG_FMT"\n", undoHead,
+ label, doCount, undoCount, undoStream.end ) )
us = &undoStack[undoHead];
SetFileChanged();
@@ -832,6 +836,29 @@ void UndoStart(
if (!TrimStream( &undoStream, us->undoEnd )) {
return;
}
+#ifdef UNDO_DEFER_FREE
+ // We keep a list of objects to be freed when this undoStack entry
+ // is expired, and then free the objects when they can not be referenced
+ // This is tricky
+ // Consider
+ // - Modify the text field of TextNote
+ // - The old text field is added to the deferFree list
+ // - Undo which restores the previous version of the text field
+ // - Modify the text field again
+ // - The old text field is added to the deferFree list again
+ // - Later when the UndoStack expires, we delete the old text field twice!
+ // This is one example of the issues we can hit
+ //
+ // So to resolve this issue, we don't free the old text object,
+ // but live with the memory leak (old versions of text fields)
+ //
+ for ( int inx=0; inx < us->deferFree_da.cnt; inx++ ) {
+ void * p = DYNARR_N( void*, us->deferFree_da, inx );
+ LOG( log_undo, 2, ( " deferFree free: "SLOG_FMT"\n", p ) );
+ MyFree( p );
+ }
+#endif
+ DYNARR_RESET( void*, us->deferFree_da );
} else if (undoCount != 0) {
if (recordUndo) { Rprintf( " Undid N:%d M:%d D:%d\n", us->newCnt, us->modCnt, us->delCnt ); }
/* reusing an undid entry */
@@ -866,6 +893,8 @@ void UndoStart(
undoStack[inx].newTail = NULL;
}
us->newTrks = NULL;
+
+
undoStack[undoHead].trackCount = trackCount;
undoCount = 0;
undoActive = TRUE;
@@ -881,6 +910,39 @@ void UndoStart(
/**
+ * Special free() for embedded objects that should preserved for Undo
+ *
+ * See BUG 555, 527
+ *
+ * Scenario:
+ * Some track types (compound) contain references (.title) in their extraData
+ * which Undo doesn't know about.
+ * The caller free's the reference and updates the reference to a new version of the data.
+ * The old data is reallocated
+ * When we Undo the track, the reference is restored to the old data
+ * so the reference (.title) now points to garbage
+ *
+ * The fix is to not free the old data immediately,
+ * but save a reference in UndoStack[].deferFree_da
+ * When the UndoStack[] is reused (in UndoStart) we then free the old memory
+ * (Since is won't be used any more)
+ *
+ * This mechanism can be used for other objects which now use StoreTrackData/ReplaceTrackData
+ *
+ */
+void UndoDeferFree( void * p )
+{
+ undoStack_p us;
+ if ( p == NULL ) {
+ return;
+ }
+ us = &undoStack[undoHead];
+ DYNARR_APPEND( void*, us->deferFree_da, 10 );
+ DYNARR_LAST( void*, us->deferFree_da ) = p;
+ LOG( log_undo, 2, ( " deferFree defer: "SLOG_FMT"\n", p ) );
+}
+
+/**
* Record Modify'd track for Undo
* \param trk
*
@@ -1040,7 +1102,9 @@ void UndoClear( void )
ClearStream( &undoStream );
ClearStream( &redoStream );
for (inx=0; inx<UNDO_STACK_SIZE; inx++) {
- undoStack[inx].undoStart = undoStack[inx].undoEnd = 0;
+ undoStack_p us = &undoStack[inx];
+ us->undoStart = us->undoEnd = 0;
+ DYNARR_INIT( void*, us->deferFree_da );
}
SetButtons( FALSE, FALSE );
}
diff --git a/app/bin/cundo.h b/app/bin/cundo.h
index 2282835..0fc6653 100644
--- a/app/bin/cundo.h
+++ b/app/bin/cundo.h
@@ -37,5 +37,6 @@ BOOL_T UndoDelete( track_p );
BOOL_T UndoNew( track_p );
void UndoEnd( void );
void UndoClear( void );
+void UndoDeferFree( void* );
#endif // !HAVE_CUNDO_H
diff --git a/app/bin/custom.h b/app/bin/custom.h
index d14bff7..982254e 100644
--- a/app/bin/custom.h
+++ b/app/bin/custom.h
@@ -126,7 +126,7 @@ void InitCmdEasement( void );
char * MakeWindowTitle( char * );
addButtonCallBack_t EasementInit( void );
-void InitLayers( void );
+void InitLayers( int cmdGroup );
void InitHotBar( void );
void InitCarDlg( void );
BOOL_T Initialize( void );
diff --git a/app/bin/dbench.c b/app/bin/dbench.c
index a6284ea..59eb670 100644
--- a/app/bin/dbench.c
+++ b/app/bin/dbench.c
@@ -37,45 +37,45 @@
static char *benchTypeS[] = { "", N_(" L-Girder"), N_(" T-Girder") };
-#include "bitmaps/bo_edge.xpm"
-#include "bitmaps/bo_flat.xpm"
-#include "bitmaps/bo_ll.xpm"
-#include "bitmaps/bo_lr.xpm"
-#include "bitmaps/bo_lld.xpm"
-#include "bitmaps/bo_lrd.xpm"
-#include "bitmaps/bo_llu.xpm"
-#include "bitmaps/bo_lru.xpm"
-#include "bitmaps/bo_lli.xpm"
-#include "bitmaps/bo_lri.xpm"
-#include "bitmaps/bo_t.xpm"
-#include "bitmaps/bo_tr.xpm"
-#include "bitmaps/bo_tl.xpm"
-#include "bitmaps/bo_ti.xpm"
+#include "bitmaps/bo_edge.image1"
+#include "bitmaps/bo_flat.image1"
+#include "bitmaps/bo_ll.image1"
+#include "bitmaps/bo_lr.image1"
+#include "bitmaps/bo_lld.image1"
+#include "bitmaps/bo_lrd.image1"
+#include "bitmaps/bo_llu.image1"
+#include "bitmaps/bo_lru.image1"
+#include "bitmaps/bo_lli.image1"
+#include "bitmaps/bo_lri.image1"
+#include "bitmaps/bo_t.image1"
+#include "bitmaps/bo_tr.image1"
+#include "bitmaps/bo_tl.image1"
+#include "bitmaps/bo_ti.image1"
typedef struct {
char * name;
- char ** xpm;
+ wIconBitMap_t image1;
wIcon_p icon;
} orientData_t;
static orientData_t rectOrientD[] = {
- { N_("On Edge"), bo_edge_xpm },
- { N_("Flat"), bo_flat_xpm }
+ { N_("On Edge"), bo_edge_image1 },
+ { N_("Flat"), bo_flat_image1 }
};
static orientData_t lgirderOrientD[] = {
- { N_("Left"), bo_ll_xpm },
- { N_("Right"), bo_lr_xpm },
- { N_("Left-Down"), bo_lld_xpm },
- { N_("Right-Down"), bo_lrd_xpm },
- { N_("Left-Up"), bo_llu_xpm },
- { N_("Right-Up"), bo_lru_xpm },
- { N_("Left-Inverted"), bo_lli_xpm },
- { N_("Right-Inverted"), bo_lri_xpm }
+ { N_("Left"), bo_ll_image1 },
+ { N_("Right"), bo_lr_image1 },
+ { N_("Left-Down"), bo_lld_image1 },
+ { N_("Right-Down"), bo_lrd_image1 },
+ { N_("Left-Up"), bo_llu_image1 },
+ { N_("Right-Up"), bo_lru_image1 },
+ { N_("Left-Inverted"), bo_lli_image1 },
+ { N_("Right-Inverted"), bo_lri_image1 }
};
static orientData_t tgirderOrientD[] = {
- { N_("Normal"), bo_t_xpm },
- { N_("Right"), bo_tr_xpm },
- { N_("Left"), bo_tl_xpm },
- { N_("Inverted"), bo_ti_xpm }
+ { N_("Normal"), bo_t_image1 },
+ { N_("Right"), bo_tr_image1 },
+ { N_("Left"), bo_tl_image1 },
+ { N_("Inverted"), bo_ti_image1 }
};
static struct {
@@ -103,7 +103,7 @@ EXPORT void BenchUpdateOrientationList(
for (cnt=orientD[type].cnt-1; cnt>=0; cnt--,op++) {
#ifdef WINDOWS
if (op->icon == NULL) {
- op->icon = wIconCreatePixMap( op->xpm );
+ op->icon = wIconCreatePixMap( op->image1 );
}
wListAddValue( list, NULL, op->icon, op );
#else
diff --git a/app/bin/dbitmap.c b/app/bin/dbitmap.c
index 0732065..8e43c09 100644
--- a/app/bin/dbitmap.c
+++ b/app/bin/dbitmap.c
@@ -472,7 +472,7 @@ static void DoOutputBitMap( void* unused )
MakeWindowTitle( _( "Export to bitmap" ) ),
_( "Ok" ),
OutputBitMapOk,
- wHide,
+ ParamCancel_Current,
TRUE,
NULL,
0,
diff --git a/app/bin/dcar.c b/app/bin/dcar.c
index 11a5a1e..cab29e7 100644
--- a/app/bin/dcar.c
+++ b/app/bin/dcar.c
@@ -35,6 +35,7 @@ static int log_carList;
static int log_carInvList;
static int log_carDlgState;
static int log_carDlgList;
+static int log_carDlgDims;
//static paramFloatRange_t r0_99999 = { 0, 99999, 80 };
static paramFloatRange_t r0d001_99999 = { 0.001, 99999, 80 };
@@ -1178,6 +1179,7 @@ static BOOL_T CarPartWrite(
BOOL_T rc = TRUE;
carPartParent_p parentP=partP->parent;
tabString_t tabs[7];
+ long longCenterOffset = (long)(partP->dim.truckCenterOffset*1000);
SetCLocale();
@@ -1191,8 +1193,9 @@ static BOOL_T CarPartWrite(
tabs[T_NUMBER].len, tabs[T_NUMBER].ptr );
rc &= fprintf( f, "CARPART %s \"%s\"", GetScaleName(partP->parent->scale),
PutTitle(message) )>0;
- rc &= fprintf( f, " %ld %ld %0.3f %0.3f 0 0 %0.3f %0.3f %ld\n",
+ rc &= fprintf( f, " %ld %ld %0.3f %0.3f 0 %ld %0.3f %0.3f %ld\n",
partP->options, partP->type, partP->dim.carLength, partP->dim.carWidth,
+ longCenterOffset,
partP->dim.truckCenter, partP->dim.coupledLength, wDrawGetRGB(partP->color) )>0;
SetUserLocale();
@@ -1643,6 +1646,7 @@ static void CarItemHotbarUpdate(
}
carItemInx = (wIndex_t)VP2L(wListGetItemContext( (wList_p)
pg->paramPtr[inx].control, carItemInx ));
+ CHECK( carItemInx < carItemHotbar_da.cnt );
item = carItemHotbar(carItemInx);
if ( item != NULL ) {
currCarItemPtr = item;
@@ -1787,6 +1791,7 @@ static char * CarItemHotbarProc(
char * cp;
wWinPix_t w, h;
+ CHECK( carItemInx < carItemHotbar_da.cnt );
item = carItemHotbar(carItemInx);
if ( item == NULL ) {
return NULL;
@@ -1811,7 +1816,8 @@ static char * CarItemHotbarProc(
/*wListSetValue( (wList_p)newCarPLs[0].control, "Select a car" );*/
wListSetIndex( (wList_p)newCarPLs[0].control, 0 );
cp = CarItemHotbarProc( HB_BARTITLE, I2VP(carItemInx), NULL, NULL );
- strncpy( newCarLabel1, cp, sizeof newCarLabel1 );
+ strncpy( newCarLabel1, cp, sizeof(newCarLabel1) -1);
+ newCarLabel1[sizeof(newCarLabel1) -1] = 0;
ParamLoadControls( &newCarPG );
ParamGroupRecord( &newCarPG );
@@ -1869,6 +1875,8 @@ EXPORT void AddHotBarCarDesc( void )
coOrd orig;
coOrd size;
+ LOG( log_carDlgDims, 1, ( "AddHotBarCarDesc/load carItemHB: carItemHB.cnt:%d\n",
+ carItemInfo_da.cnt ) );
DYNARR_SET( carItem_t*, carItemHotbar_da, carItemInfo_da.cnt );
memcpy( &carItemHotbar(0), &carItemInfo(0),
carItemInfo_da.cnt * sizeof carItemHotbar(0) );
@@ -1891,6 +1899,7 @@ EXPORT void AddHotBarCarDesc( void )
orig = zero;
size.x = item1->dim.carLength;
size.y = item1->dim.carWidth;
+ LOG( log_carDlgDims, 1, ( "AddHotBarElement( %d: %s\n", inx, item1->title ) );
AddHotBarElement( FormatCarTitle( item1, carHotbarContents[carHotbarModeInx] ),
size, orig, FALSE, FALSE, (60.0*12.0/curScaleRatio), I2VP(inx),
CarItemHotbarProc );
@@ -2128,7 +2137,9 @@ EXPORT void CarItemDraw(
int direction,
BOOL_T locoIsMaster,
vector_t *coupler,
+#ifdef CAR_CLEARANCE
BOOL_T pencils,
+#endif
track_p traverse)
{
coOrd size, pos, pos2;
@@ -2168,9 +2179,11 @@ EXPORT void CarItemDraw(
DrawSegs( d, pos, item->angle-90.0, item->segPtr, item->segCnt, 0.0, color );
}
+#ifdef CAR_CLEARANCE
if (pencils) {
// No code for pencils
}
+#endif
if ( drawCarTrucks ) {
@@ -3741,8 +3754,10 @@ static void CarDlgUpdate(
cmp_key_t cmp_key;
coOrd orig, size, size2;
carPartParent_p parentP;
+#ifdef TRUCK_OFFSET
static DIST_T carDlgTruckOffsetL;
static DIST_T carDlgTruckOffsetR;
+#endif
static long carDlgClock;
static long carDlgCarLengthClock;
static long carDlgTruckCenterClock;
@@ -3756,6 +3771,7 @@ static void CarDlgUpdate(
switch ( inx ) {
case -1:
+#ifdef TRUCK_OFFSET
if ( carDlgDim.truckCenter > 0
&& carDlgDim.carLength > carDlgDim.truckCenter ) {
carDlgTruckOffsetL = (carDlgDim.carLength - carDlgDim.truckCenter)/2 -
@@ -3766,9 +3782,18 @@ static void CarDlgUpdate(
carDlgTruckOffsetL = 0;
carDlgTruckOffsetR = 0;
}
+#endif
carDlgCarLengthClock = carDlgCoupledLengthClock = carDlgTruckCenterClock =
carDlgCouplerLengthClock = carDlgClock = 0;
+#ifdef TRUCK_OFFSET
+ LOG( log_carDlgDims, 1,
+ ( "truckCenter(%d): trkCenter:%0.3f, .carLength:%0.3f = trackOffset: %0.3f %0.3f\n",
+ carDlgDim.truckCenter,
+ carDlgDim.carLength,
+ carDlgTruckOffsetL,
+ carDlgTruckOffsetR ) );
+#endif
redraw = TRUE;
break;
@@ -3991,17 +4016,21 @@ static void CarDlgUpdate(
case I_CD_TRKOFFSET:
carDlgChanged++;
+#ifdef TRUCK_OFFSET
if ( carDlgDim.truckCenterOffset == 0 ) {
carDlgTruckOffsetL = carDlgDim.truckCenter/2;
carDlgTruckOffsetR = carDlgTruckOffsetL;
} else if (carDlgDim.carLength - carDlgDim.truckCenter > 2*fabs(
carDlgDim.truckCenterOffset)) {
- carDlgTruckOffsetL = carDlgDim.truckCenter/2 - carDlgDim.truckCenterOffset;
- carDlgTruckOffsetR = carDlgDim.truckCenter/2 + carDlgDim.truckCenterOffset;
+ carDlgTruckOffsetL = (carDlgDim.carLength-carDlgDim.truckCenter)/2 -
+ carDlgDim.truckCenterOffset;
+ carDlgTruckOffsetR = (carDlgDim.carLength-carDlgDim.truckCenter)/2 +
+ carDlgDim.truckCenterOffset;
} else {
carDlgTruckOffsetL = 0;
carDlgTruckOffsetR = 0;
}
+#endif
if ( 2*carDlgDim.truckCenterOffset > carDlgDim.carLength -
carDlgDim.truckCenter) {
ok = FALSE;
@@ -4009,11 +4038,22 @@ static void CarDlgUpdate(
_("Truck Center Offset plus Truck Centers must be less than Car Length") );
}
redraw = TRUE;
+#ifdef TRUCK_OFFSET
+ LOG( log_carDlgDims, 1,
+ ("I_CD_TRKOFFSET: len:%0.3f, center:%0.3f, cenoff:%0.3f = offset:%0.3f %0.3f\n",
+ carDlgDim.carLength,
+ carDlgDim.truckCenter,
+ carDlgDim.truckCenterOffset,
+ carDlgTruckOffsetL,
+ carDlgTruckOffsetR ) );
+#endif
break;
case I_CD_TRKCENTER:
carDlgChanged++;
- if ( carDlgDim.truckCenter == 0 ) {
+#ifdef TRUCK_OFFSET
+ if ( carDlgDim.truckCenter == 0 ||
+ carDlgDim.truckCenterOffset == 0.0 ) {
carDlgTruckOffsetL = 0;
carDlgTruckOffsetR = 0;
} else if ( carDlgDim.truckCenter <
@@ -4023,12 +4063,22 @@ static void CarDlgUpdate(
return;
} else if ( carDlgDim.carLength - carDlgDim.truckCenter > 2*fabs(
carDlgDim.truckCenterOffset) ) {
- carDlgTruckOffsetL = carDlgDim.truckCenter/2-carDlgDim.truckCenterOffset;
- carDlgTruckOffsetR = carDlgDim.truckCenter/2+carDlgDim.truckCenterOffset;
+ carDlgTruckOffsetL = (carDlgDim.carLength-carDlgDim.truckCenter)/2 -
+ carDlgDim.truckCenterOffset;
+ carDlgTruckOffsetR = (carDlgDim.carLength-carDlgDim.truckCenter)/2 +
+ carDlgDim.truckCenterOffset;
} else {
carDlgTruckOffsetL = 0;
carDlgTruckOffsetR = 0;
}
+ LOG( log_carDlgDims, 1,
+ ("I_CD_TRKCENTER: len:%0.3f, center:%0.3f, cenoff:%0.3f = offset:%0.3f %0.3f\n",
+ carDlgDim.carLength,
+ carDlgDim.truckCenter,
+ carDlgDim.truckCenterOffset,
+ carDlgTruckOffsetL,
+ carDlgTruckOffsetR ) );
+#endif
redraw = TRUE;
break;
@@ -4135,6 +4185,7 @@ static void CarDlgUpdate(
carDlgDim.carLength = size2.x;
carDlgDim.carWidth = size2.y;
carDlgDim.coupledLength = carDlgDim.carLength + 32;
+#ifdef TRUCK_OFFSET
if ( carDlgDim.carLength > 120 ) {
carDlgDim.truckCenter = carDlgDim.carLength - 120;
carDlgTruckOffsetL = (carDlgDim.carLength - carDlgDim.truckCenter)/2;
@@ -4144,6 +4195,7 @@ static void CarDlgUpdate(
carDlgTruckOffsetL = 0;
carDlgTruckOffsetR = 0;
}
+#endif
carDlgFlipToggle = FALSE;
ParamLoadControl( &carDlgPG, I_CD_CARLENGTH );
ParamLoadControl( &carDlgPG, I_CD_CARWIDTH );
@@ -4168,6 +4220,14 @@ static void CarDlgUpdate(
}
if ( checkTruckCenter && carDlgDim.carLength > 0 ) {
+#ifdef TRUCK_OFFSET
+ DIST_T offL = (carDlgDim.carLength - carDlgDim.truckCenter)/2 -
+ carDlgDim.truckCenterOffset;
+ DIST_T offR = (carDlgDim.carLength - carDlgDim.truckCenter)/2 +
+ carDlgDim.truckCenterOffset;
+ LOG( log_carDlgDims, 1, ( "OFF %0.3f %0.3f %0.3f %0.3f\n",
+ carDlgTruckOffsetL, carDlgTruckOffsetR, offL, offR ) );
+
if ( carDlgTruckOffsetL > 0 || carDlgTruckOffsetR > 0 ) {
carDlgDim.truckCenter = carDlgDim.carLength - ( carDlgTruckOffsetL +
carDlgTruckOffsetR );
@@ -4176,6 +4236,11 @@ static void CarDlgUpdate(
carDlgDim.truckCenter = carDlgDim.carLength * 0.75;
carDlgDim.truckCenterOffset = 0;
}
+ LOG( log_carDlgDims, 1,
+ ( "checkTruckCenter length:%0.3f, offset %0.3f, %0.3f = truckCenter:%0.3f, truckCenterOffset:%0.3f\n",
+ carDlgDim.carLength, carDlgTruckOffsetL, carDlgTruckOffsetR,
+ carDlgDim.truckCenter, carDlgDim.truckCenterOffset ) );
+#endif
ParamLoadControl( &carDlgPG, I_CD_TRKCENTER );
ParamLoadControl( &carDlgPG, I_CD_TRKOFFSET );
}
@@ -4596,7 +4661,8 @@ static void DoCarPartDlg( carDlgAction_e *actions )
if ( carDlgPG.win == NULL ) {
ParamCreateDialog( &carDlgPG, MakeWindowTitle(_("New Car Part")), _("Add"),
- CarDlgOk, CarDlgClose, TRUE, CarDlgLayout,
+ CarDlgOk, ParamCancel_Custom( CarDlgClose ),
+ TRUE, CarDlgLayout,
F_BLOCK|F_RESIZE|F_RECALLSIZE|PD_F_ALT_CANCELLABEL, CarDlgUpdate );
if ( carDlgDim.carWidth==0 ) {
@@ -4845,6 +4911,8 @@ static void CarInvDlgDeleteShelve( void )
}
bShowMsg = TRUE;
}
+ LOG( log_carDlgDims, 1, ( "CarInvDlgDeleteShelve( %d, %s\n", inx,
+ item->title ) );
wListDelete( (wList_p)carInvPLs[I_CI_LIST].control, inx );
if ( item->title ) { MyFree( item->title ); }
if ( item->data.number ) { MyFree( item->data.number ); }
@@ -4855,10 +4923,12 @@ static void CarInvDlgDeleteShelve( void )
carItemInfo_da.cnt -= 1;
inx--;
cnt--;
+ bNeedReload = TRUE; //DB
}
}
if ( bNeedReload ) {
CarInvListLoad();
+ ChangeHotBar( CHANGE_SCALE );
MainRedraw(); // Shelve Car from layout
}
SetFileChanged();
@@ -5684,7 +5754,7 @@ EXPORT void DoCarDlg( void * unused )
int inx, inx2;
if ( carInvPG.win == NULL ) {
ParamCreateDialog( &carInvPG, MakeWindowTitle(_("Car Inventory")), _("Find"),
- CarInvDlgFind, wHide, TRUE, NULL,
+ CarInvDlgFind, ParamCancel_Current, TRUE, NULL,
F_BLOCK|F_RESIZE|F_RECALLSIZE|PD_F_ALT_CANCELLABEL, CarInvDlgUpdate );
for ( inx=I_CI_SORT; inx<I_CI_SORT+N_SORT; inx++ ) {
for ( inx2=0; inx2<COUNT( sortOrders ); inx2++ ) {
@@ -5750,6 +5820,7 @@ EXPORT void InitCarDlg( void )
log_carInvList = LogFindIndex( "carInvList" );
log_carDlgState = LogFindIndex( "carDlgState" );
log_carDlgList = LogFindIndex( "carDlgList" );
+ log_carDlgDims = LogFindIndex( "carDlgDims" );
carDlgBodyColor = wDrawFindColor( wRGB(255,128,0) );
ParamRegister( &carDlgPG );
ParamRegister( &carInvPG );
@@ -5843,8 +5914,8 @@ static int CarProtoCustMgmProc(
}
-#include "bitmaps/carpart.xpm"
-#include "bitmaps/carproto.xpm"
+#include "bitmaps/carpart.image1"
+#include "bitmaps/carproto.image1"
EXPORT void CarCustMgmLoad( void )
{
@@ -5856,10 +5927,10 @@ EXPORT void CarCustMgmLoad( void )
static wIcon_p carprotoI = NULL;
if ( carpartI == NULL ) {
- carpartI = wIconCreatePixMap( carpart_xpm );
+ carpartI = wIconCreatePixMap( carpart_image1 );
}
if ( carprotoI == NULL ) {
- carprotoI = wIconCreatePixMap( carproto_xpm );
+ carprotoI = wIconCreatePixMap( carproto_image1 );
}
for ( parentX=0; parentX<carPartParent_da.cnt; parentX++ ) {
diff --git a/app/bin/dcmpnd.c b/app/bin/dcmpnd.c
index 9b7dfcc..99fe657 100644
--- a/app/bin/dcmpnd.c
+++ b/app/bin/dcmpnd.c
@@ -30,187 +30,8 @@
#include "track.h"
#include "trkendpt.h"
#include "common-ui.h"
+#include "cselect.h"
-/*****************************************************************************
- *
- * Update Titles
- *
- */
-
-static wWin_p updateTitleW;
-typedef enum { updateUnknown, updateTurnout, updateStructure } updateType_e;
-static updateType_e updateListType;
-static BOOL_T updateWVisible;
-static BOOL_T updateWStale;
-typedef struct {
- updateType_e type;
- SCALEINX_T scale;
- char * old;
- char * new;
-} updateTitleElement;
-static dynArr_t updateTitles_da;
-#define updateTitles(N) DYNARR_N( updateTitleElement, updateTitles_da, N )
-
-static void UpdateTitleIgnore( void* junk );
-static wIndex_t updateTitleInx;
-static paramData_t updateTitlePLs[] = {
- { PD_MESSAGE, "This file contains Turnout and Structure Titles which should be updated." },
- { PD_MESSAGE, "This dialog allows you to change the definitions in this file." },
- { PD_MESSAGE, "To replace the old name, choose a definition from the list." },
- { PD_MESSAGE, "If the required definition is not loaded you can use the Load button" },
- { PD_MESSAGE, "to invoke the Parameter Files dialog to load the required Parameter File." },
- { PD_MESSAGE, "If you choose Cancel then the Titles will not be changed and some" },
- { PD_MESSAGE, "features (Price List and Label selection) may not be fully functional." },
- { PD_MESSAGE, "You can use the List Labels control on the Preferences dialog to" },
- { PD_MESSAGE, "control the format of the list entries" },
-#define I_UPDATESTR (9)
- { PD_STRING, NULL, "old", PDO_NOPREF, I2VP(400), NULL, BO_READONLY },
-#define I_UPDATELIST (10)
-#define updateTitleL ((wList_p)updateTitlePLs[I_UPDATELIST].control)
- { PD_DROPLIST, NULL, "sel", PDO_NOPREF, I2VP(400) },
- { PD_BUTTON, UpdateTitleIgnore, "ignore", PDO_DLGCMDBUTTON, NULL, N_("Ignore") },
-#define I_UPDATELOAD (12)
- { PD_BUTTON, NULL, "load", 0, NULL, N_("Load") }
-};
-static paramGroup_t updateTitlePG = { "updatetitle", 0, updateTitlePLs, COUNT( updateTitlePLs ) };
-
-
-static void UpdateTitleChange( long changes )
-{
- if ( (changes & (CHANGE_SCALE|CHANGE_PARAMS)) == 0 ) {
- return;
- }
- if (!updateWVisible) {
- updateWStale = TRUE;
- return;
- }
- wControlShow( (wControl_p)updateTitleL, FALSE );
- wListClear( updateTitleL );
- if (updateTitles(updateTitleInx).type == updateTurnout) {
- TurnoutAdd( listLabels, updateTitles(updateTitleInx).scale, updateTitleL, NULL,
- -1 );
- } else {
- StructAdd( listLabels, updateTitles(updateTitleInx).scale, updateTitleL,
- NULL );
- }
- wControlShow( (wControl_p)updateTitleL, TRUE );
- updateListType = updateTitles(updateTitleInx).type;
-}
-
-
-static void UpdateTitleNext( void )
-{
- wIndex_t inx;
- wIndex_t cnt;
- track_p trk;
- struct extraDataCompound_t *xx;
- updateTitleInx++;
- if (updateTitleInx >= updateTitles_da.cnt) {
- wHide( updateTitleW );
- updateWVisible = FALSE;
- InfoMessage( _("Updating definitions, please wait") );
- cnt = 0;
- trk = NULL;
- while (TrackIterate( &trk ) ) {
- InfoCount(cnt++);
- TRKTYP_T trkType = GetTrkType(trk);
- if (trkType == T_TURNOUT || trkType == T_STRUCTURE) {
- xx = GET_EXTRA_DATA(trk, trkType, extraDataCompound_t);
- for (inx=0; inx<updateTitles_da.cnt; inx++) {
- if ( updateTitles(inx).old &&
- strcmp( xx->title, updateTitles(inx).old ) == 0 ) {
- xx->title = MyStrdup( updateTitles(inx).new );
- break;
- }
- }
- }
- }
- DYNARR_RESET( updateTitleElement, updateTitles_da );
- InfoMessage("");
- InfoCount( trackCount );
- SetFileChanged();
- DoChangeNotification( CHANGE_MAIN );
- return;
- }
- ParamLoadMessage( &updateTitlePG, I_UPDATESTR,
- updateTitles(updateTitleInx).old );
- if (updateWStale || updateTitles(updateTitleInx).type != updateListType) {
- UpdateTitleChange( CHANGE_SCALE|CHANGE_PARAMS );
- }
-}
-
-
-static void UpdateTitleUpdate( void* junk )
-{
- void * selP;
- turnoutInfo_t * to;
- wListGetValues( updateTitleL, NULL, 0, NULL, &selP );
- if (selP != NULL) {
- to = (turnoutInfo_t*)selP;
- updateTitles(updateTitleInx).new = to->title;
- }
- UpdateTitleNext();
-}
-
-static void UpdateTitleIgnore( void* junk )
-{
- updateTitles(updateTitleInx).old = NULL;
- UpdateTitleNext();
-}
-
-static void UpdateTitleCancel( wWin_p junk )
-{
- wHide( updateTitleW );
- DYNARR_RESET( updateTitleElement, updateTitles_da );
- updateWVisible = FALSE;
-}
-
-
-void DoUpdateTitles( void )
-{
- if (updateTitles_da.cnt <= 0) {
- return;
- }
- if (updateTitleW == NULL) {
- ParamRegister( &updateTitlePG );
- updateTitlePLs[I_UPDATELOAD].valueP = ParamFilesInit();
- updateTitleW = ParamCreateDialog( &updateTitlePG,
- MakeWindowTitle(_("Update Title")), _("Update"), UpdateTitleUpdate,
- UpdateTitleCancel, TRUE, NULL, 0, NULL );
- RegisterChangeNotification( UpdateTitleChange );
- }
- updateTitleInx = -1;
- wShow( updateTitleW );
- updateWVisible = TRUE;
- updateListType = updateUnknown;
- UpdateTitleNext();
-}
-
-EXPORT void UpdateTitleMark(
- char * title,
- SCALEINX_T scale )
-{
- int inx;
- updateTitleElement * ut;
- if ( inPlayback ) {
- return;
- }
- for (inx=0; inx<updateTitles_da.cnt; inx++) {
- if (strcmp(title,updateTitles(inx).old) == 0) {
- return;
- }
- }
- DYNARR_APPEND( updateTitleElement, updateTitles_da, 10 );
- ut = &updateTitles(updateTitles_da.cnt-1);
- if ( TempEndPtsCount() > 0) {
- ut->type = updateTurnout;
- } else {
- ut->type = updateStructure;
- }
- ut->scale = scale;
- ut->old = MyStrdup(title);
- ut->new = NULL;
-}
/*****************************************************************************
*
@@ -328,6 +149,7 @@ static dynArr_t refreshSpecial_da;
static wIndex_t refreshSpecialInx;
static BOOL_T refreshReturnVal;
static void RefreshSkip( void * junk );
+static void RefreshDone( void * junk );
static paramListData_t refreshSpecialListData = { 30, 600, 0, NULL, NULL };
static paramData_t refreshSpecialPLs[] = {
#define REFRESH_M1 (0)
@@ -338,7 +160,8 @@ static paramData_t refreshSpecialPLs[] = {
{ PD_MESSAGE, NULL, NULL, 0/*PDO_DLGRESIZEW*/, I2VP(380) },
#define REFRESH_L (3)
{ PD_LIST, &refreshSpecialInx, "list", PDO_LISTINDEX|PDO_NOPREF|PDO_DLGRESIZE, &refreshSpecialListData, NULL, BO_READONLY },
- { PD_BUTTON, RefreshSkip, "skip", PDO_DLGCMDBUTTON, NULL, N_("Skip") }
+ { PD_BUTTON, RefreshSkip, "skip", PDO_DLGCMDBUTTON, NULL, N_("Skip") },
+ { PD_BUTTON, RefreshDone, "done", PDO_DLGCMDBUTTON, NULL, N_("Done") }
};
static paramGroup_t refreshSpecialPG = { "refreshSpecial", 0, refreshSpecialPLs, COUNT( refreshSpecialPLs ) };
static void RefreshSpecialOk(
@@ -346,8 +169,8 @@ static void RefreshSpecialOk(
{
wHide( refreshSpecialPG.win );
}
-static void RefreshSpecialCancel(
- wWin_p win )
+static void RefreshDone(
+ void * junk )
{
refreshSpecialInx = -1;
refreshReturnVal = FALSE;
@@ -360,7 +183,7 @@ static void RefreshSkip(
wHide( refreshSpecialPG.win );
}
-EXPORT BOOL_T RefreshCompound(
+static BOOL_T RefreshCompound(
track_p trk,
BOOL_T junk )
{
@@ -397,7 +220,8 @@ EXPORT BOOL_T RefreshCompound(
}
if ( IsParamValid(to->paramFileIndex) &&
to->segCnt > 0 &&
- (FIT_NONE != CompatibleScale( GetTrkEndPtCnt(trk)>0, to->scaleInx, scale ) )) {
+ (FIT_NONE != CompatibleScale( GetTrkEndPtCnt(trk)>0?FIT_TURNOUT:FIT_STRUCTURE,
+ to->scaleInx, scale ) )) {
if ( RefreshCompound1( trk, refreshSpecial(inx).to ) ) {
if ( strcasecmp( xx->title, to->title ) != 0 ) {
MyFree( xx->title );
@@ -416,8 +240,8 @@ EXPORT BOOL_T RefreshCompound(
if ( refreshSpecialPG.win == NULL ) {
ParamRegister( &refreshSpecialPG );
ParamCreateDialog( &refreshSpecialPG,
- MakeWindowTitle(_("Refresh Turnout/Structure")), _("Ok"), RefreshSpecialOk,
- RefreshSpecialCancel, TRUE, NULL, F_BLOCK|F_RESIZE|F_RECALLSIZE, NULL );
+ MakeWindowTitle(_("Refresh Turnout/Structure")), _("Replace"), RefreshSpecialOk,
+ ParamCancel_Null, TRUE, NULL, F_BLOCK|F_RESIZE|F_RECALLSIZE, NULL );
}
ParamLoadMessage( &refreshSpecialPG, REFRESH_M1,
_("Choose a Turnout/Structure to replace:") );
@@ -468,6 +292,26 @@ EXPORT BOOL_T RefreshCompound(
}
}
+EXPORT void DoRefreshCompound( void * unused )
+{
+ if (SelectedTracksAreFrozen()) {
+ return;
+ }
+ refreshSpecialInx = -1;
+ refreshReturnVal = FALSE;
+ if (selectedTrackCount>0) {
+ UndoStart( _("Refresh Compound"), "refresh compound" );
+ DoSelectedTracks( RefreshCompound );
+ RefreshCompound( NULL, FALSE );
+ UndoEnd();
+ MainRedraw(); // DoRefreshCompound
+ } else {
+ ErrorMessage( MSG_NO_SELECTED_TRK );
+ }
+}
+
+
+
/*****************************************************************************
*
* Custom Management Support
@@ -580,7 +424,7 @@ static int CompoundCustMgmProc(
if ( !renamePG.win ) {
ParamRegister( &renamePG );
ParamCreateDialog( &renamePG, MakeWindowTitle(_("Rename Object")), _("Ok"),
- RenameOk, wHide, TRUE, NULL, F_BLOCK, NULL );
+ RenameOk, ParamCancel_Current, TRUE, NULL, F_BLOCK, NULL );
}
ParamLoadControls( &renamePG );
wShow( renamePG.win );
@@ -614,8 +458,8 @@ static int CompoundCustMgmProc(
}
-#include "bitmaps/turnout.xpm3"
-#include "bitmaps/building.xpm3"
+#include "bitmaps/turnout.image3"
+#include "bitmaps/building.image3"
EXPORT void CompoundCustMgmLoad( void )
{
@@ -625,10 +469,10 @@ EXPORT void CompoundCustMgmLoad( void )
static wIcon_p structI = NULL;
if ( turnoutI == NULL ) {
- turnoutI = wIconCreatePixMap( turnout_xpm3[0] );
+ turnoutI = wIconCreatePixMap( turnout_image3[0] );
}
if ( structI == NULL ) {
- structI = wIconCreatePixMap( building_xpm3[0] );
+ structI = wIconCreatePixMap( building_image3[0] );
}
for ( inx=0; inx<turnoutInfo_da.cnt; inx++ ) {
diff --git a/app/bin/dcontmgm.c b/app/bin/dcontmgm.c
index d9df025..7c8f81c 100644
--- a/app/bin/dcontmgm.c
+++ b/app/bin/dcontmgm.c
@@ -305,8 +305,10 @@ static void DoControlMgr( void * junk )
{
if (controlPG.win == NULL) {
ParamCreateDialog( &controlPG,
- MakeWindowTitle(_("Manage Layout Control Elements")), _("Done"), ControlDone,
- wHide, TRUE, NULL, F_RESIZE|F_RECALLSIZE|F_BLOCK, ControlDlgUpdate );
+ MakeWindowTitle(_("Manage Layout Control Elements")),
+ _("Done"), ControlDone,
+ ParamCancel_Current, TRUE, NULL, F_RESIZE|F_RECALLSIZE|F_BLOCK,
+ ControlDlgUpdate );
} else {
wListClear( controlSelL );
}
diff --git a/app/bin/dcustmgm.c b/app/bin/dcustmgm.c
index 871787f..0607eec 100644
--- a/app/bin/dcustmgm.c
+++ b/app/bin/dcustmgm.c
@@ -193,6 +193,14 @@ static void CustMgmContentsOk( void * junk )
wHide( custMgmContentsPG.win );
}
+/**
+ * Save custom parameter definitions to a parameter file.
+ *
+ * \param files count of filenames, must be 1
+ * \param fileName array of filenames, one member only
+ * \param data unused
+ * \return TRUE on success, FALSE in case of failure
+ */
static int CustomDoExport(
int files,
@@ -211,7 +219,7 @@ static int CustomDoExport(
return FALSE;
}
- SetCurrentPath( PARAMETERPATHKEY, fileName[ 0 ] );
+ SetCurrentPath( CUSTOMPATHKEY, fileName[ 0 ] );
rc = access( fileName[ 0 ], F_OK );
if ( rc != -1 ) {
rc = access( fileName[ 0 ], W_OK );
@@ -223,7 +231,7 @@ static int CustomDoExport(
} else {
if ( custMgmContentsPG.win == NULL ) {
ParamCreateDialog( &custMgmContentsPG, MakeWindowTitle(_("Contents Label")),
- _("Ok"), CustMgmContentsOk, wHide, TRUE, NULL, F_BLOCK, NULL );
+ _("Ok"), CustMgmContentsOk, ParamCancel_Current, TRUE, NULL, F_BLOCK, NULL );
}
custMgmProceed = FALSE;
wShow( custMgmContentsPG.win );
@@ -405,7 +413,8 @@ static void DoCustomMgr( void * junk )
if (customPG.win == NULL) {
ParamCreateDialog( &customPG,
MakeWindowTitle(_("Manage custom designed parts")), _("Done"), CustomDone,
- wHide, TRUE, NULL, F_RESIZE|F_RECALLSIZE|F_BLOCK, CustomDlgUpdate );
+ ParamCancel_Null, TRUE, NULL, F_RESIZE|F_RECALLSIZE|F_BLOCK,
+ CustomDlgUpdate );
while(customTypes[ i ] != NULL) {
wListAddValue( ((wList_p)customPLs[I_CUSTOMNEWTYPE].control),
customTypes[ i++ ], NULL, NULL );
diff --git a/app/bin/dease.c b/app/bin/dease.c
index 4112c61..58ae6dc 100644
--- a/app/bin/dease.c
+++ b/app/bin/dease.c
@@ -40,7 +40,6 @@ static DIST_T easeX = 0.0;
static DIST_T Rvalues[3];
static DIST_T Lvalues[3];
-static DIST_T oldEasementVal;
static wIcon_p enone_bm;
static wIcon_p esharp_bm;
@@ -63,7 +62,6 @@ static wWin_p easementW;
static void EasementSel( long );
static void SetEasement( DIST_T, void * );
static void EasementOk( void );
-static void EasementCancel( void );
static char *easementChoiceLabels[] = { N_("None"), N_("Sharp"), N_("Normal"), N_("Broad"), N_("Cornu"), NULL };
static paramFloatRange_t r0n1_100 = { -1.0, 100.0, 60 };
@@ -175,13 +173,6 @@ static void EasementOk( void )
}
-static void EasementCancel( void )
-{
- SetEasement( easementVal = oldEasementVal, I2VP(FALSE) );
- wHide( easementW );
-}
-
-
static void EasementSel(
long arg )
/*
@@ -248,11 +239,10 @@ static void DoEasement( void * unused )
{
if (easementW == NULL) {
easementW = ParamCreateDialog( &easementPG, MakeWindowTitle(_("Easement")),
- _("Ok"), (paramActionOkProc)EasementOk, (paramActionCancelProc)EasementCancel,
+ _("Ok"), (paramActionOkProc)EasementOk, ParamCancel_Null,
TRUE, LayoutEasementW, 0, EasementDlgUpdate );
SetEasement( easementVal, I2VP(TRUE) );
}
- oldEasementVal = easementVal;
wShow( easementW );
SetEasement( easementVal, I2VP(TRUE) );
}
@@ -270,30 +260,29 @@ static void EasementChange( long changes )
}
-#include "bitmaps/ease-none.xpm3"
-#include "bitmaps/ease-sharp.xpm3"
-#include "bitmaps/ease-gt-sharp.xpm3"
-#include "bitmaps/ease-lt-sharp.xpm3"
-#include "bitmaps/ease-normal.xpm3"
-#include "bitmaps/ease-broad.xpm3"
-#include "bitmaps/ease-gt-broad.xpm3"
-#include "bitmaps/ease-lt-broad.xpm3"
-#include "bitmaps/ease-cornu.xpm3"
-
+#include "bitmaps/ease-none.image3"
+#include "bitmaps/ease-sharp.image3"
+#include "bitmaps/ease-gt-sharp.image3"
+#include "bitmaps/ease-lt-sharp.image3"
+#include "bitmaps/ease-normal.image3"
+#include "bitmaps/ease-broad.image3"
+#include "bitmaps/ease-gt-broad.image3"
+#include "bitmaps/ease-lt-broad.image3"
+#include "bitmaps/ease-cornu.image3"
EXPORT addButtonCallBack_t EasementInit( void )
{
ParamRegister( &easementPG );
- enone_bm = wIconCreatePixMap( ease_none_xpm3[iconSize] );
- eltsharp_bm = wIconCreatePixMap( ease_lt_sharp_xpm3[iconSize] );
- esharp_bm = wIconCreatePixMap( ease_sharp_xpm3[iconSize] );
- egtsharp_bm = wIconCreatePixMap( ease_gt_sharp_xpm3[iconSize] );
- enormal_bm = wIconCreatePixMap( ease_normal_xpm3[iconSize] );
- eltbroad_bm = wIconCreatePixMap( ease_lt_broad_xpm3[iconSize] );
- ebroad_bm = wIconCreatePixMap( ease_broad_xpm3[iconSize] );
- egtbroad_bm = wIconCreatePixMap( ease_gt_broad_xpm3[iconSize] );
- ecornu_bm = wIconCreatePixMap( ease_cornu_xpm3[iconSize] );
+ enone_bm = wIconCreatePixMap( ease_none_image3[iconSize] );
+ eltsharp_bm = wIconCreatePixMap( ease_lt_sharp_image3[iconSize] );
+ esharp_bm = wIconCreatePixMap( ease_sharp_image3[iconSize] );
+ egtsharp_bm = wIconCreatePixMap( ease_gt_sharp_image3[iconSize] );
+ enormal_bm = wIconCreatePixMap( ease_normal_image3[iconSize] );
+ eltbroad_bm = wIconCreatePixMap( ease_lt_broad_image3[iconSize] );
+ ebroad_bm = wIconCreatePixMap( ease_broad_image3[iconSize] );
+ egtbroad_bm = wIconCreatePixMap( ease_gt_broad_image3[iconSize] );
+ ecornu_bm = wIconCreatePixMap( ease_cornu_image3[iconSize] );
easementB = AddToolbarButton( "cmdEasement", enone_bm, 0, DoEasementRedir,
NULL );
diff --git a/app/bin/denum.c b/app/bin/denum.c
index bb87601..1a0a252 100644
--- a/app/bin/denum.c
+++ b/app/bin/denum.c
@@ -150,7 +150,7 @@ void EnumerateStart(void)
if (enumW == NULL) {
ParamRegister( &enumPG );
enumW = ParamCreateDialog( &enumPG, MakeWindowTitle(_("Parts List")), NULL,
- NULL, wHide, TRUE, NULL, F_RESIZE, EnumDlgUpdate );
+ NULL, ParamCancel_Current, TRUE, NULL, F_RESIZE, EnumDlgUpdate );
enumFile_fs = wFilSelCreate( mainW, FS_SAVE, 0, _("Parts List"),
sPartsListFilePattern, DoEnumSave, NULL );
}
diff --git a/app/bin/dlayer.c b/app/bin/dlayer.c
index 92c58c4..560d7c4 100644
--- a/app/bin/dlayer.c
+++ b/app/bin/dlayer.c
@@ -31,6 +31,7 @@
#include "track.h"
#include "include/partcatalog.h"
#include "include/stringxtc.h"
+#include "include/toolbar.h"
#include "common-ui.h"
/*****************************************************************************
@@ -1218,7 +1219,8 @@ LayerPrefLoad(void)
if (prefString && prefString[ 0 ]) {
char layersSaved[3 * NUM_LAYERS];
- strncpy(layersSaved, prefString, sizeof(layersSaved));
+ strncpy(layersSaved, prefString, sizeof(layersSaved)-1);
+ layersSaved[sizeof(layersSaved)-1] = 0;
prefString = strtok(layersSaved, ",");
while (prefString) {
@@ -2069,7 +2071,7 @@ static void DoLayer(void * unused)
{
if (layerW == NULL) {
layerW = ParamCreateDialog(&layerPG, MakeWindowTitle(_("Layers")), _("Done"),
- LayerOk, wHide, TRUE, NULL, 0, LayerDlgUpdate);
+ LayerOk, ParamCancel_Current, TRUE, NULL, 0, LayerDlgUpdate);
GetScaleGauge(layerScaleInx, &layerScaleDescInx, &layerGaugeInx);
LoadScaleList(scaleL);
LoadGaugeList(gaugeL, layerScaleDescInx);
@@ -2087,7 +2089,7 @@ static void DoLayer(void * unused)
layoutLayerChanged = FALSE;
}
-#include "bitmaps/background.xpm3"
+#include "bitmaps/background.image3"
#if NUM_BUTTONS < 100
static int lbmap_width[3] = { 16, 24, 32 }; // For numbers < 100
@@ -2099,7 +2101,7 @@ static int lbmap_height[3] = { 16, 24, 32 };
static int lbit0_width[3] = { 6, 10, 14 };
static int lbit1_width[3] = { 4, 5, 6 };
-static int lbits_top[3] = { 3, 4, 6 };
+//static int lbits_top[3] = { 3, 4, 6 };
static int lbits_height[3] = { 10, 15, 20 };
#include "bitmaps/layer_num.inc"
@@ -2122,7 +2124,7 @@ static char** show_layer_digits[3][10] = {
*/
#define ONE_PIXEL v *= 2; if (v > 128) { show_layer_bits[xx + yy] = b; xx += 1; v = 1; b = 0; }
-void InitLayers(void)
+void InitLayers(int cmdGroup)
{
unsigned int i;
wPrefGetInteger(PREFSECT, "layer-button-count", &layerCount, layerCount);
@@ -2325,10 +2327,10 @@ void InitLayers(void)
setLayerL = wDropListCreate(mainW, 0, 0, "cmdLayerSet", NULL, 0, 10, 200, NULL,
SetCurrLayer, NULL);
wControlSetBalloonText((wControl_p)setLayerL, GetBalloonHelpStr("cmdLayerSet"));
- AddToolbarControl((wControl_p)setLayerL, IC_MODETRAIN_TOO);
+ ToolbarControlAdd((wControl_p)setLayerL, IC_MODETRAIN_TOO, cmdGroup );
backgroundB = AddToolbarButton("cmdBackgroundShow",
- wIconCreatePixMap(background_xpm3[iconSize]), 0,
+ wIconCreatePixMap(background_image3[iconSize]), 0,
BackgroundToggleShow, NULL);
/* add the help text */
wControlSetBalloonText((wControl_p)backgroundB, _("Show/Hide Background"));
diff --git a/app/bin/doption.c b/app/bin/doption.c
index 28010d4..4af3517 100644
--- a/app/bin/doption.c
+++ b/app/bin/doption.c
@@ -32,7 +32,6 @@
static paramIntegerRange_t i1_100 = { 1, 100 };
static paramIntegerRange_t i0_256 = { 0, 256 };
static paramIntegerRange_t i1_256 = { 1, 256 };
-static paramIntegerRange_t i1_1024 = { 1, 1024 };
static paramIntegerRange_t i0_10000 = { 0, 10000 };
static paramIntegerRange_t i0_99 = { 0, 99};
static paramIntegerRange_t i1_1000 = { 1, 1000 };
@@ -51,6 +50,7 @@ static void UpdateChkPtInterval(long);
static wIndex_t distanceFormatInx;
EXPORT long enableBalloonHelp = 1;
+EXPORT long enableAudio = 1;
EXPORT long showFlexTrack = 1;
@@ -67,18 +67,6 @@ long GetChanges( paramGroup_p pg )
return changes;
}
-static paramGroup_t prefPG;
-
-
-
-
-
-static void OptionDlgCancel(
- wWin_p win )
-{
- wEnableBalloonHelp( (int)enableBalloonHelp );
- wHide( win );
-}
/****************************************************************************
@@ -199,7 +187,7 @@ static void DoDisplay( void * junk )
{
if (displayW == NULL) {
displayW = ParamCreateDialog( &displayPG, MakeWindowTitle(_("Display Options")),
- _("Ok"), DisplayOk, OptionDlgCancel, TRUE, NULL, 0, OptionDlgUpdate );
+ _("Ok"), DisplayOk, ParamCancel_Restore, TRUE, NULL, 0, OptionDlgUpdate );
wListAddValue( (wList_p)displayPLs[I_HOTBARLABELS].control, _("Proto"), NULL,
I2VP(0x0002) );
wListAddValue( (wList_p)displayPLs[I_HOTBARLABELS].control, _("Proto/Manuf"),
@@ -284,7 +272,7 @@ static void DoCmdopt( void * junk )
{
if (cmdoptW == NULL) {
cmdoptW = ParamCreateDialog( &cmdoptPG, MakeWindowTitle(_("Command Options")),
- _("Ok"), CmdoptOk, OptionDlgCancel, TRUE, NULL, 0, OptionDlgUpdate );
+ _("Ok"), CmdoptOk, ParamCancel_Restore, TRUE, NULL, 0, OptionDlgUpdate );
}
ParamLoadControls( &cmdoptPG );
wShow( cmdoptW );
@@ -312,6 +300,7 @@ static char * unitsLabels[] = { N_("English"), N_("Metric"), NULL };
static char * angleSystemLabels[] = { N_("Polar"), N_("Cartesian"), NULL };
static char * enableBalloonHelpLabels[] = { N_("Balloon Help"), NULL };
static char * enableFlexTrackLabels[] = { N_("Show FlexTrack in HotBar"), NULL };
+static char * enableAudioLabels[] = { N_("Enable audio signals"), NULL };
static char * startOptions[] = { N_("Load Last Layout"), N_("Start New Layout"), NULL };
static paramData_t prefPLs[] = {
@@ -327,13 +316,14 @@ static paramData_t prefPLs[] = {
{ PD_FLOAT, &turntableAngle, "turntable-angle", PDO_NOPSHUPD, &r0_180, N_("Turntable Angle") },
{ PD_LONG, &maxCouplingSpeed, "coupling-speed-max", PDO_NOPSHUPD, &i10_100, N_("Max Coupling Speed"), 0 },
{ PD_TOGGLE, &enableBalloonHelp, "balloonhelp", PDO_NOPSHUPD, enableBalloonHelpLabels, "", BC_HORZ },
+ { PD_TOGGLE, &enableAudio, "setaudio", PDO_NOPSHUPD, enableAudioLabels, "", BC_HORZ },
{ PD_TOGGLE, &showFlexTrack, "showflextrack", PDO_NOPSHUPD, enableFlexTrackLabels, "", BC_HORZ},
{ PD_LONG, &dragPixels, "dragpixels", PDO_NOPSHUPD|PDO_DRAW, &i1_1000, N_("Drag Distance") },
{ PD_LONG, &dragTimeout, "dragtimeout", PDO_NOPSHUPD|PDO_DRAW, &i1_1000, N_("Drag Timeout") },
{ PD_LONG, &minGridSpacing, "mingridspacing", PDO_NOPSHUPD|PDO_DRAW, &i1_100, N_("Min Grid Spacing"), 0, 0 },
-#define I_CHKPT (14)
+#define I_CHKPT (15)
{ PD_LONG, &checkPtInterval, "checkpoint", PDO_NOPSHUPD|PDO_FILE, &i0_10000, N_("Check Point Frequency") },
-#define I_AUTOSAVE (15)
+#define I_AUTOSAVE (16)
{ PD_LONG, &autosaveChkPoints, "autosave", PDO_NOPSHUPD|PDO_FILE, &i0_99, N_("Autosave Checkpoint Frequency") },
{ PD_RADIO, &onStartup, "onstartup", PDO_NOPSHUPD, startOptions, N_("On Program Startup"), 0, NULL }
};
@@ -504,6 +494,9 @@ static void PrefOk( void * junk )
NoticeMessage( MSG_ICON_SIZE_RESTART, _("Ok"), NULL ) ;
}
+ wPrefSetInteger("misc", "audio", enableAudio);
+ wSetAudio(enableAudio);
+
wHide( prefW );
DoChangeNotification(changes);
}
@@ -514,7 +507,7 @@ static void DoPref( void * junk )
{
if (prefW == NULL) {
prefW = ParamCreateDialog( &prefPG, MakeWindowTitle(_("Preferences")), _("Ok"),
- PrefOk, wHide, TRUE, NULL, 0, OptionDlgUpdate );
+ PrefOk, ParamCancel_Restore, TRUE, NULL, 0, OptionDlgUpdate );
LoadDstFmtList();
}
ParamLoadControls( &prefPG );
@@ -561,7 +554,7 @@ static paramData_t colorPLs[] = {
{ PD_COLORLIST, &borderColor, "border", PDO_NOPSHUPD, NULL, N_("Border"), 0, I2VP(CHANGE_MAIN) },
{ PD_COLORLIST, &crossMajorColor, "crossmajor", PDO_NOPSHUPD, NULL, N_("Primary Axis"), 0, 0 },
{ PD_COLORLIST, &crossMinorColor, "crossminor", PDO_NOPSHUPD, NULL, N_("Secondary Axis"), 0, 0 },
- { PD_COLORLIST, &normalColor, "normal", PDO_NOPSHUPD, NULL, N_("Normal Track"), 0, I2VP(CHANGE_MAIN|CHANGE_PARAMS) },
+ { PD_COLORLIST, &normalColor, "normal", PDO_NOPSHUPD, NULL, N_("Normal Track"), 0, I2VP(CHANGE_MAIN|CHANGE_PARAMS|CHANGE_MAP) },
{ PD_COLORLIST, &selectedColor, "selected", PDO_NOPSHUPD, NULL, N_("Selected Track"), 0, I2VP(CHANGE_MAIN) },
{ PD_COLORLIST, &profilePathColor, "profile", PDO_NOPSHUPD, NULL, N_("Profile Path"), 0, I2VP(CHANGE_MAIN) },
{ PD_COLORLIST, &exceptionColor, "exception", PDO_NOPSHUPD, NULL, N_("Exception Track"), 0, I2VP(CHANGE_MAIN) },
@@ -589,7 +582,7 @@ static void DoColor( void * junk )
{
if (colorW == NULL) {
colorW = ParamCreateDialog( &colorPG, MakeWindowTitle(_("Color")), _("Ok"),
- ColorOk, wHide, TRUE, NULL, 0, NULL );
+ ColorOk, ParamCancel_Restore, TRUE, NULL, 0, NULL );
}
ParamLoadControls( &colorPG );
wShow( colorW );
diff --git a/app/bin/dpricels.c b/app/bin/dpricels.c
index 06931fe..9f27dc1 100644
--- a/app/bin/dpricels.c
+++ b/app/bin/dpricels.c
@@ -164,7 +164,8 @@ static void DoPriceList( void * junk )
{
if (priceListW == NULL) {
priceListW = ParamCreateDialog( &priceListPG, MakeWindowTitle(_("Price List")),
- _("Done"), PriceListOk, wHide, TRUE, NULL, F_RESIZE, PriceListDlgUpdate );
+ _("Done"), PriceListOk, ParamCancel_Null, TRUE, NULL, F_RESIZE,
+ PriceListDlgUpdate );
}
wShow( priceListW );
PriceListChange( CHANGE_SCALE|CHANGE_PARAMS );
diff --git a/app/bin/dprmfile.c b/app/bin/dprmfile.c
index ced4c8f..a9ddbb1 100644
--- a/app/bin/dprmfile.c
+++ b/app/bin/dprmfile.c
@@ -32,14 +32,14 @@
static struct wFilSel_t * paramFile_fs;
-#include "bitmaps/greendot.xpm"
-#include "bitmaps/greydot.xpm"
-#include "bitmaps/yellowdot.xpm"
-#include "bitmaps/reddot.xpm"
-#include "bitmaps/greenstar.xpm"
-#include "bitmaps/greystar.xpm"
-#include "bitmaps/yellowstar.xpm"
-#include "bitmaps/redstar.xpm"
+#include "bitmaps/greendot.image1"
+#include "bitmaps/greydot.image1"
+#include "bitmaps/yellowdot.image1"
+#include "bitmaps/reddot.image1"
+#include "bitmaps/greenstar.image1"
+#include "bitmaps/greystar.image1"
+#include "bitmaps/yellowstar.image1"
+#include "bitmaps/redstar.image1"
#define FAVORITE_PARAM 1
#define STANDARD_PARAM 0
@@ -410,25 +410,26 @@ void DoParamFiles(void * junk)
if (paramFileW == NULL) {
indicatorIcons[ STANDARD_PARAM ][ PARAMFILE_UNLOADED ] = wIconCreatePixMap(
- greydot);
+ greydot_image1);
indicatorIcons[ STANDARD_PARAM ][ PARAMFILE_NOTUSABLE ] = wIconCreatePixMap(
- reddot);
+ reddot_image1);
indicatorIcons[ STANDARD_PARAM ][ PARAMFILE_COMPATIBLE ] = wIconCreatePixMap(
- yellowdot);
- indicatorIcons[ STANDARD_PARAM ][ PARAMFILE_FIT] = wIconCreatePixMap(greendot);
+ yellowdot_image1);
+ indicatorIcons[ STANDARD_PARAM ][ PARAMFILE_FIT] = wIconCreatePixMap(
+ greendot_image1);
indicatorIcons[ FAVORITE_PARAM ][ PARAMFILE_UNLOADED ] = wIconCreatePixMap(
- greystar);
+ greystar_image1);
indicatorIcons[ FAVORITE_PARAM ][ PARAMFILE_NOTUSABLE ] = wIconCreatePixMap(
- redstar);
+ redstar_image1);
indicatorIcons[ FAVORITE_PARAM ][ PARAMFILE_COMPATIBLE ] = wIconCreatePixMap(
- yellowstar);
+ yellowstar_image1);
indicatorIcons[ FAVORITE_PARAM ][ PARAMFILE_FIT ] = wIconCreatePixMap(
- greenstar);
+ greenstar_image1);
ParamRegister(&paramFilePG);
paramFileW = ParamCreateDialog(&paramFilePG,
- MakeWindowTitle(_("Parameter Files")), _("Ok"), ParamFileOk, NULL,
+ MakeWindowTitle(_("Parameter Files")), _("Done"), ParamFileOk, ParamCancel_Null,
TRUE, NULL, F_RESIZE | F_RECALLSIZE, ParamFileDlgUpdate);
paramFile_fs = wFilSelCreate(mainW, FS_LOAD, FS_MULTIPLEFILES,
_("Load Parameters"), _("Parameter files (*.xtp)|*.xtp"), LoadParamFile, NULL);
diff --git a/app/bin/draw.c b/app/bin/draw.c
index d833a7b..2d3d2fd 100644
--- a/app/bin/draw.c
+++ b/app/bin/draw.c
@@ -29,6 +29,7 @@
#include "track.h"
#include "layout.h"
#include "common-ui.h"
+#include "include/toolbar.h"
EXPORT wIndex_t panCmdInx;
@@ -785,7 +786,7 @@ EXPORT void DrawBoxedString(
ANGLE_T a)
{
coOrd size, p[4], p0 = pos, p1, p2;
- static int bw = 2, bh = 2, br = 1, bb = 1;
+ static int br = 0, bl = 1, bt = 2, bb = -1;
static double arrowScale = 0.5;
POS_T descent, ascent;
if (fs < 2 * d->scale) {
@@ -804,21 +805,22 @@ EXPORT void DrawBoxedString(
#endif
DrawTextSize2(&mainD, text, fp, fs, TRUE, &size, &descent, &ascent);
- p0.x -= size.x / 2.0;
- p0.y -= size.y / 2.0;
+ if ( (style & BOX_POS_BOTTOM_LEFT) == 0 ) {
+ // p0 was pos of center, shift to bottom left corner
+ p0.x -= size.x / 2.0;
+ p0.y -= size.y / 2.0;
+ }
+ style &= ~BOX_POS_BOTTOM_LEFT;
+
if (style == BOX_NONE || d == &mapD) {
DrawString(d, p0, 0.0, text, fp, fs, color);
return;
}
- size.x += bw * d->scale / d->dpi;
- size.y += bh * d->scale / d->dpi;
- p[0] = p0;
- p[0].x -= br * d->scale / d->dpi; //Top of box
- p[0].y += (bb * d->scale / d->dpi + ascent);
- p[1].y = p[0].y;
- p[2].y = p[3].y = p[0].y - size.y - descent; //Bottom of box
- p[1].x = p[2].x = p[0].x + size.x;
- p[3].x = p[0].x;
+ p[0].x = p[3].x = p0.x - bl*d->scale/d->dpi;
+ p[2].x = p[1].x = p0.x + br*d->scale/d->dpi + size.x;
+ p[0].y = p[1].y = p0.y + bt*d->scale/d->dpi + ascent;
+ p[3].y = p[2].y = p0.y - bb*d->scale/d->dpi - descent;
+
d->options &= ~DC_DASH;
switch (style) {
case BOX_ARROW:
@@ -1432,69 +1434,6 @@ EXPORT void SetMessage( char * msg )
*
*/
-/*
- * Set mapW size to fit the rescaled map
- *
- * \param reset IN
- */
-static int mapBorderH = 24;
-static int mapBorderW = 24;
-static void ChangeMapScale()
-{
- wWinPix_t w, h;
- FLOAT_T fw, fh;
-
- // Restrict map size to 1/2 of screen
- FLOAT_T fScaleW = mapD.size.x / ( displayWidth * 0.5 / mapD.dpi );
- FLOAT_T fScaleH = mapD.size.y / ( displayHeight * 0.5 / mapD.dpi );
- FLOAT_T fScale = ceil( max( fScaleW, fScaleH ) );
- if ( fScale > mapD.scale ) {
- LOG( log_mapsize, 2, ( " ChangeMapScale incr scale from %0.3f to %0.3f\n",
- mapD.scale, fScale ) );
- mapD.scale = fScale;
- }
-
- fw = (((mapD.size.x/mapD.scale)*mapD.dpi) + 0.5)+2;
- fh = (((mapD.size.y/mapD.scale)*mapD.dpi) + 0.5)+2;
-
- w = (wWinPix_t)fw;
- h = (wWinPix_t)fh;
- LOG( log_mapsize, 2, ( " ChangeMapScale mapD.scale=%0.3f w=%ld h=%ld\n",
- mapD.scale, w, h ) );
- wWinSetSize( mapW, w+mapBorderW, h+mapBorderH );
- // This should be done by wWinSetSize
- wDrawSetSize( mapD.d, w, h, NULL );
-}
-
-
-EXPORT BOOL_T SetRoomSize( coOrd size )
-{
- LOG( log_mapsize, 2, ( "SetRoomSize NEW:%0.3fx%0.3f OLD:%0.3fx%0.3f\n", size.x,
- size.y, mapD.size.x, mapD.size.y ) );
- SetLayoutRoomSize(size);
- if (size.x < 1.0) {
- size.x = 1.0;
- }
- if (size.y < 1.0) {
- size.y = 1.0;
- }
- if ( mapD.size.x == size.x &&
- mapD.size.y == size.y ) {
- return TRUE;
- }
- mapD.size = size;
- SetLayoutRoomSize(size);
- wPrefSetFloat( "draw", "roomsizeX", mapD.size.x );
- wPrefSetFloat( "draw", "roomsizeY", mapD.size.y );
- if ( mapW == NULL) {
- return TRUE;
- }
- ChangeMapScale();
- return TRUE;
-}
-
-
-
/**
* Redraw the Map window using the Scale derived from the Window size and Room size
* \param bd [inout] Map canvas - not used
@@ -1570,6 +1509,70 @@ static void MapRedraw(
}
+/*
+ * Set mapW size to fit the rescaled map
+ *
+ * \param reset IN
+ */
+static int mapBorderH = 24;
+static int mapBorderW = 24;
+static void ChangeMapScale()
+{
+ wWinPix_t w, h;
+ FLOAT_T fw, fh;
+
+ // Restrict map size to 1/2 of screen
+ FLOAT_T fScaleW = mapD.size.x / ( displayWidth * 0.5 / mapD.dpi );
+ FLOAT_T fScaleH = mapD.size.y / ( displayHeight * 0.5 / mapD.dpi );
+ FLOAT_T fScale = ceil( max( fScaleW, fScaleH ) );
+ if ( fScale > mapD.scale ) {
+ LOG( log_mapsize, 2, ( " ChangeMapScale incr scale from %0.3f to %0.3f\n",
+ mapD.scale, fScale ) );
+ mapD.scale = fScale;
+ }
+
+ fw = (((mapD.size.x/mapD.scale)*mapD.dpi) + 0.5)+2;
+ fh = (((mapD.size.y/mapD.scale)*mapD.dpi) + 0.5)+2;
+
+ w = (wWinPix_t)fw;
+ h = (wWinPix_t)fh;
+ LOG( log_mapsize, 2, ( " ChangeMapScale mapD.scale=%0.3f w=%ld h=%ld\n",
+ mapD.scale, w, h ) );
+ wWinSetSize( mapW, w+mapBorderW, h+mapBorderH );
+ // This should be done by wWinSetSize
+ wDrawSetSize( mapD.d, w, h, NULL );
+ MapRedraw( mapD.d, NULL, 0, 0 );
+}
+
+
+EXPORT BOOL_T SetRoomSize( coOrd size )
+{
+ LOG( log_mapsize, 2, ( "SetRoomSize NEW:%0.3fx%0.3f OLD:%0.3fx%0.3f\n", size.x,
+ size.y, mapD.size.x, mapD.size.y ) );
+ SetLayoutRoomSize(size);
+ if (size.x < 1.0) {
+ size.x = 1.0;
+ }
+ if (size.y < 1.0) {
+ size.y = 1.0;
+ }
+ if ( mapD.size.x == size.x &&
+ mapD.size.y == size.y ) {
+ return TRUE;
+ }
+ mapD.size = size;
+ SetLayoutRoomSize(size);
+ wPrefSetFloat( "draw", "roomsizeX", mapD.size.x );
+ wPrefSetFloat( "draw", "roomsizeY", mapD.size.y );
+ if ( mapW == NULL) {
+ return TRUE;
+ }
+ ChangeMapScale();
+ return TRUE;
+}
+
+
+
EXPORT void SetMainSize( void )
{
wWinPix_t ww, hh;
@@ -1598,8 +1601,8 @@ EXPORT void TempRedraw( void )
} else {
wDrawDelayUpdate( tempD.d, TRUE );
wDrawSetTempMode( tempD.d, TRUE );
- DrawMarkers();
DoCurCommand( C_REDRAW, zero );
+ DrawMarkers();
RulerRedraw( FALSE );
RedrawPlaybackCursor(); //If in playback
wDrawSetTempMode( tempD.d, FALSE );
@@ -1694,8 +1697,8 @@ EXPORT void MainRedraw( void )
wGetTimer()-time0 ) );
// The remainder is from TempRedraw
wDrawSetTempMode( tempD.d, TRUE );
- DrawMarkers();
DoCurCommand( C_REDRAW, zero );
+ DrawMarkers();
RulerRedraw( FALSE );
RedrawPlaybackCursor(); //If in playback
wDrawSetTempMode( tempD.d, FALSE );
@@ -1796,15 +1799,15 @@ void MainProc( wWin_p win, winProcEvent e, void * refresh, void * data )
wWinGetSize( mainW, &width, &height );
LOG( log_redraw, 1, ( "MainProc/Resize: %d %s %ld %ld\n", cMP++,
refresh==NULL?"RDW":"---", width, height ) );
- LayoutToolBar(refresh);
- height -= (toolbarHeight+max(infoHeight,textHeight)+10);
+ ToolbarLayout(refresh);
+ height -= (ToolbarGetHeight() +max(infoHeight,textHeight)+10);
if (height >= 0) {
wBool_t bTemp = wDrawSetTempMode(mainD.d, FALSE );
if ( bTemp ) {
printf( "MainProc TempMode\n" );
}
wDrawSetSize( mainD.d, width-20, height, refresh );
- wControlSetPos( (wControl_p)mainD.d, 0, toolbarHeight );
+ wControlSetPos( (wControl_p)mainD.d, 0, ToolbarGetHeight());
SetMainSize();
SetInfoBar();
panCenter.x = mainD.orig.x + mainD.size.x/2.0;
@@ -1837,7 +1840,6 @@ EXPORT void DoRedraw( void )
{
LOG( log_mapsize, 2, ( "DoRedraw\n" ) );
ChangeMapScale();
- MapRedraw( mapD.d, NULL, 0, 0 );
MainRedraw(); // DoRedraw
}
@@ -1875,10 +1877,12 @@ static void DrawMarkers( void )
p0.x = p1.x = oldMarker.x;
p0.y = mainD.orig.y;
p1.y = mainD.orig.y-BBORDER*mainD.scale/mainD.dpi;
+ DrawLine( &tempD, p0, p1, 3, wDrawColorWhite );
DrawLine( &tempD, p0, p1, 0, markerColor );
p0.y = p1.y = oldMarker.y;
p0.x = mainD.orig.x;
p1.x = mainD.orig.x-LBORDER*mainD.scale/mainD.dpi;
+ DrawLine( &tempD, p0, p1, 3, wDrawColorWhite );
DrawLine( &tempD, p0, p1, 0, markerColor );
}
@@ -1900,7 +1904,7 @@ EXPORT void DrawRuler(
long inch, lastInch;
DIST_T len;
int digit;
- char quote;
+ char quote = ' ';
char message[STR_SHORT_SIZE];
coOrd d_orig, d_size;
wFontSize_t fs;
@@ -1936,6 +1940,7 @@ EXPORT void DrawRuler(
}
end = FindDistance( orig, pos1 );
+ DrawLine( d, pos0, pos1, 3, wDrawColorWhite );
DrawLine( d, pos0, pos1, 0, color );
if (units == UNITS_METRIC) {
@@ -1969,6 +1974,7 @@ EXPORT void DrawRuler(
if (power==1000 || mm%(power*10) != 0) {
Translate( &p0, orig, a, mm/25.4 );
Translate( &p1, p0, aa, len*d->scale/mainD.dpi );
+ DrawLine( d, p0, p1, 3, wDrawColorWhite );
DrawLine( d, p0, p1, 0, color );
if (!number || (d->scale > 40 && mm % skip != 0.0)) {
continue;
@@ -1991,7 +1997,9 @@ EXPORT void DrawRuler(
//p0.x = p0.x+((-(LBORDER-2)/2)+((LBORDER-2)/2+2)*sin_aa)*d->scale/mainD.dpi;
//p0.y = p1.y+dyn*d->scale/mainD.dpi;
}
- DrawString( d, p0, 0.0, message, rulerFp, fs*d->scale, color );
+ DrawBoxedString( BOX_BACKGROUND|BOX_POS_BOTTOM_LEFT,
+ d, p0, message, rulerFp, fs*d->scale,
+ color, 0 );
}
}
}
@@ -2058,6 +2066,7 @@ EXPORT void DrawRuler(
if(!skip) {
Translate( &p0, orig, a, inch+fraction/16.0 );
Translate( &p1, p0, aa, lengths[fraction]*d->scale/mainD.dpi );
+ DrawLine( d, p0, p1, 3, wDrawColorWhite );
DrawLine( d, p0, p1, 0, color );
}
if (fraction == 0) {
@@ -2078,7 +2087,9 @@ EXPORT void DrawRuler(
Translate( &p0, p0, aa, majorLength*d->scale/mainD.dpi );
Translate( &p0, p0, 225, fs*d->scale/mainD.dpi );
sprintf(message, "%d%c", digit, quote );
- DrawString( d, p0, 0.0, message, rulerFp, fs*d->scale, color );
+ DrawBoxedString( BOX_BACKGROUND|BOX_POS_BOTTOM_LEFT,
+ d, p0, message, rulerFp, fs*d->scale,
+ color, 0 );
}
}
}
@@ -2426,7 +2437,7 @@ EXPORT void DoZoomExtents( void * mode)
return;
}
track_p trk = NULL;
- coOrd bot, top;
+ coOrd bot = {0.0, 0.0}, top = {0.0, 0.0};
BOOL_T first = TRUE;
while ( TrackIterate( &trk ) ) {
if(GetTrkSelected(trk)) {
@@ -2839,7 +2850,7 @@ coOrd minIncrementSizes()
static void DoMouse( wAction_t action, coOrd pos )
{
- BOOL_T rc;
+ int rc;
wDrawPix_t x, y;
static BOOL_T ignoreCommands;
// Middle button pan state
@@ -2958,7 +2969,7 @@ static void DoMouse( wAction_t action, coOrd pos )
action = C_TEXT+((int)(0x0A<<8));
break;
}
- int rc = DoPanKeyAction(action);
+ rc = DoPanKeyAction(action);
if (rc!=1) { return; }
break;
case C_TEXT:
@@ -3047,9 +3058,6 @@ static void DoMouse( wAction_t action, coOrd pos )
Reset();
DoCurCommand( C_START, zero );
break;
- case C_INFO:
- Reset();
- break;
}
}
@@ -3283,11 +3291,11 @@ EXPORT void DrawInit( int initialZoom )
// InitColor();
wWinGetSize( mainW, &w, &h );
- /*LayoutToolBar();*/
- h = h - (toolbarHeight+max(textHeight,infoHeight)+10);
+
+ h = h - (ToolbarGetHeight() +max(textHeight,infoHeight)+10);
if ( w <= 0 ) { w = 1; }
if ( h <= 0 ) { h = 1; }
- tempD.d = mainD.d = wDrawCreate( mainW, 0, toolbarHeight, "",
+ tempD.d = mainD.d = wDrawCreate( mainW, 0, ToolbarGetHeight(), "",
BD_TICKS|BD_MODKEYS,
w, h, &mainD,
MainLayoutCB, DoMousew );
@@ -3320,7 +3328,8 @@ EXPORT void DrawInit( int initialZoom )
/*h = (wWinPix_t)((mapD.size.y/mapD.scale)*mainD.dpi + 0.5)+2;*/
ParamRegister( &mapPG );
LOG( log_mapsize, 2, ( "DrawInit/ParamCreateDialog(&mapPG\n" ) );
- mapW = ParamCreateDialog( &mapPG, MakeWindowTitle(_("Map")), NULL, NULL, NULL,
+ mapW = ParamCreateDialog( &mapPG, MakeWindowTitle(_("Map")), NULL, NULL,
+ ParamCancel_Null,
FALSE, NULL, F_RESIZE, NULL );
ChangeMapScale();
@@ -3336,7 +3345,7 @@ EXPORT void DrawInit( int initialZoom )
RegisterChangeNotification( DrawChange );
}
-#include "bitmaps/pan-zoom.xpm3"
+#include "bitmaps/pan-zoom.image3"
static wMenu_p panPopupM;
@@ -3526,7 +3535,7 @@ EXPORT void PanMenuEnter( void * keyVP )
EXPORT void InitCmdPan( wMenu_p menu )
{
panCmdInx = AddMenuButton( menu, CmdPan, "cmdPan", _("Pan/Zoom"),
- wIconCreatePixMap(pan_zoom_xpm3[iconSize]),
+ wIconCreatePixMap(pan_zoom_image3[iconSize]),
LEVEL0, IC_CANCEL|IC_POPUP|IC_LCLICK|IC_CMDMENU, ACCL_PAN, NULL );
}
EXPORT void InitCmdPan2( wMenu_p menu )
diff --git a/app/bin/draw.h b/app/bin/draw.h
index 0ddf547..828a8c3 100644
--- a/app/bin/draw.h
+++ b/app/bin/draw.h
@@ -241,6 +241,7 @@ void DrawHilightPolygon(drawCmd_p, coOrd *, int);
#define BOX_BACKGROUND (5) // draw box with backgound only, no frame
#define BOX_ARROW_BACKGROUND (6) // box has a connector and background
#define BOX_BOX_BACKGROUND (7) // draw complete frame and background
+#define BOX_POS_BOTTOM_LEFT (1<<8) // Origin position
void DrawBoxedString(int, drawCmd_p, coOrd, char *, wFont_p, wFontSize_t,
wDrawColor, ANGLE_T);
diff --git a/app/bin/drawgeom.c b/app/bin/drawgeom.c
index b52d42a..bdde040 100644
--- a/app/bin/drawgeom.c
+++ b/app/bin/drawgeom.c
@@ -2095,7 +2095,7 @@ STATUS_T DrawGeomModify(
}
break;
case SEG_TEXT:
- InfoMessage("Text can only be modified with Describe");
+ InfoMessage("Text can only be modified with Property command");
wBeep();
return C_ERROR;
default:
diff --git a/app/bin/fileio.c b/app/bin/fileio.c
index 4741c05..8695c5a 100644
--- a/app/bin/fileio.c
+++ b/app/bin/fileio.c
@@ -39,6 +39,7 @@
#include "include/paramfile.h"
#include "include/paramfilelist.h"
#include "paths.h"
+#include "include/stringxtc.h"
#include "track.h"
#include "version.h"
#include "dynstring.h"
@@ -49,8 +50,6 @@
#include "include/utf8convert.h"
#endif // UTFCONVERT
-EXPORT dynArr_t paramProc_da;
-
#define COPYBLOCKSIZE 1024
EXPORT const char * workingDir;
@@ -61,8 +60,8 @@ static coOrd paste_offset, cursor_offset;
EXPORT wBool_t bExample = FALSE;
EXPORT wBool_t bReadOnly = FALSE;
-EXPORT wBool_t bInReadTracks = FALSE;
+static int log_timereadfile = 0;
#ifdef WINDOWS
#define rename( F1, F2 ) Copyfile( F1, F2 )
@@ -89,52 +88,6 @@ EXPORT int Copyfile( const char * fn1, const char * fn2 )
return 0;
}
-//
-// Locale handling
-// SetCLocale is called before reading/writing any data files (.xtc, .xti, .xtq, .cus...)
-// SetUserLocale is called after
-// Calls can be nested: C, C, User, User
-//
-static char * sUserLocale = NULL; // current user locale
-static long lCLocale = 0; // locale state: > 0 C locale, <= 0 user locale
-static long nCLocale = 0; // total # of setlocals calls
-static int log_locale = 0; // logging
-static int log_timereadfile = 0;
-
-EXPORT void SetCLocale()
-{
- if ( sUserLocale == NULL ) {
- sUserLocale = MyStrdup( setlocale( LC_ALL, NULL ) );
- }
- if ( lCLocale == 0 ) {
- LOG( log_locale, 1, ( "Set C Locale: %ld\n", ++nCLocale ) );
- setlocale( LC_ALL, "C" );
-#ifdef LC_MESSAGES
- setlocale( LC_MESSAGES, "");
-#endif
- }
- lCLocale++;
- if ( lCLocale > 1 ) {
- LOG( log_locale, 3, ( "SetClocale - C! %ld\n", nCLocale) );
- } else if ( lCLocale < 1 ) {
- LOG( log_locale, 2, ( "SetClocale - User! %ld\n", nCLocale) );
- }
-}
-
-EXPORT void SetUserLocale()
-{
- if ( lCLocale == 1 ) {
- LOG( log_locale, 1, ( "Set %s Locale: %ld\n", sUserLocale, ++nCLocale ) );
- setlocale( LC_ALL, sUserLocale );
- }
- lCLocale--;
- if ( lCLocale < 0 ) {
- LOG( log_locale, 2, ("SetUserLocale - User! %ld\n", nCLocale) );
- } else if ( lCLocale > 0 ) {
- LOG( log_locale, 3, ("SetUserLocale - C! %ld\n", nCLocale) );
- }
-}
-
/****************************************************************************
*
@@ -151,23 +104,8 @@ EXPORT char * curSubContents;
#define PARAM_DEMO (-1)
-dynArr_t paramProc_da;
+EXPORT dynArr_t paramProc_da;
-EXPORT void Stripcr( char * line )
-{
- char * cp;
- cp = line + strlen(line);
- if (cp == line) {
- return;
- }
- cp--;
- if (*cp == '\n') {
- *cp-- = '\0';
- }
- if (cp >= line && *cp == '\r') {
- *cp = '\0';
- }
-}
EXPORT char * GetNextLine( void )
{
@@ -274,7 +212,7 @@ EXPORT void SyntaxError(
EXPORT BOOL_T GetArgs(
char * line,
- char * format,
+ const char * format,
... )
{
char * cp, * cq;
@@ -288,10 +226,6 @@ EXPORT BOOL_T GetArgs(
va_list ap;
char * sError = NULL;
- if ( lCLocale < 1 ) {
- LOG( log_locale, 1, ( "GetArgs: not in C locale\n" ) );
- }
-
cp = line;
va_start( ap, format );
for ( ; sError==NULL && *format; format++ ) {
@@ -680,7 +614,7 @@ static BOOL_T ReadTrackFile(
return FALSE;
}
- bInReadTracks = TRUE;
+ ParamSetInReadTracks(TRUE);
SetCLocale();
checkPtFileNameBackup = NULL;
paramLineNum = 0;
@@ -790,7 +724,7 @@ static BOOL_T ReadTrackFile(
}
}
- bInReadTracks = FALSE;
+ ParamSetInReadTracks(FALSE);
if (paramFile) {
fclose(paramFile);
paramFile = NULL;
@@ -889,8 +823,7 @@ int LoadTracks(
fseek(f, 0, SEEK_SET);
manifest = malloc(length + 1);
if (manifest) {
- fread(manifest, 1, length, f);
- manifest[length] = '\0';
+ manifest[ fread(manifest, 1, length, f) ] = '\0';
}
fclose(f);
} else {
@@ -971,7 +904,6 @@ int LoadTracks(
RecomputeElevations(NULL);
AttachTrains();
DoChangeNotification( CHANGE_ALL );
- DoUpdateTitles();
LayerSetCounts();
}
@@ -1511,7 +1443,6 @@ EXPORT int LoadCheckpoint( BOOL_T sameName )
RecomputeElevations(NULL);
AttachTrains();
DoChangeNotification( CHANGE_ALL );
- DoUpdateTitles();
} else { SetLayoutFullPath(""); }
@@ -1593,9 +1524,8 @@ static int ImportTracks(
return TRUE;
}
-EXPORT void DoImport( void * type )
+static void DoImport( void * type )
{
- importAsModule = (int)VP2L(type);
if (importFile_fs == NULL)
importFile_fs = wFilSelCreate( mainW, FS_LOAD, 0,
type == 0 ? _("Import Tracks") : _("Import Module"),
@@ -1604,6 +1534,17 @@ EXPORT void DoImport( void * type )
wFilSelect( importFile_fs, GetCurrentPath(LAYOUTPATHKEY));
}
+EXPORT void DoImportObjects( void * unused )
+{
+ importAsModule = FALSE;
+ DoImport( unused );
+}
+
+EXPORT void DoImportModule( void * unused )
+{
+ importAsModule = TRUE;
+ DoImport( unused );
+}
/**
* Export the selected track pieces
@@ -1800,7 +1741,7 @@ EXPORT void FileInit( void )
SetLayoutFullPath("");
MakeFullpath(&clipBoardN, workingDir, sClipboardF, NULL);
+ LocaleInit();
- log_locale = LogFindIndex( "locale" );
log_timereadfile = LogFindIndex( "timereadfile" );
}
diff --git a/app/bin/fileio.h b/app/bin/fileio.h
index 0ea80af..edd8cff 100644
--- a/app/bin/fileio.h
+++ b/app/bin/fileio.h
@@ -42,9 +42,6 @@ extern const char * libDir;
extern wBool_t bReadOnly;
extern wBool_t bExample;
-// Processing an input file, objects may be incomplete so avoid some ops (MapRedraw)
-extern wBool_t bInReadTracks;
-
#define PARAM_CUSTOM (-2)
#define PARAM_LAYOUT (-3)
extern int curParamFileIndex;
@@ -83,7 +80,6 @@ typedef struct {
extern dynArr_t paramProc_da;
#define paramProc(N) DYNARR_N( paramProc_t, paramProc_da, N )
-void Stripcr( char * );
char * GetNextLine( void );
#define END_TRK_FILE "END$TRACKS"
@@ -93,7 +89,7 @@ char * GetNextLine( void );
#define END_MESSAGE "END$MESSAGE"
wBool_t IsEND( char * sEnd );
-BOOL_T GetArgs( char *, char *, ... );
+BOOL_T GetArgs( char *, const char *, ... );
char * ReadMultilineText();
BOOL_T ParseRoomSize( char *, coOrd * );
int InputError( char *, BOOL_T, ... );
@@ -122,7 +118,8 @@ void CleanupCheckpointFiles( void );
void CleanupTempArchive( void );
int ExistsCheckpoint( void );
int LoadCheckpoint( BOOL_T );
-void DoImport( void * typeVP );
+void DoImportObjects( void * typeVP );
+void DoImportModule( void * typeVP );
void DoExport( void * unused );
void DoExportDXF( void * unused );
#if XTRKCAD_CREATE_SVG
@@ -154,6 +151,7 @@ BOOL_T MacroInit( void );
int Copyfile( const char * fn1, const char * fn2);
void SetCLocale();
void SetUserLocale();
+void LocaleInit();
// Parameter file search
void DoSearchParams(void * unused);
diff --git a/app/bin/filenoteui.c b/app/bin/filenoteui.c
index 9b1c2d5..3cef58f 100644
--- a/app/bin/filenoteui.c
+++ b/app/bin/filenoteui.c
@@ -29,6 +29,7 @@
#include "paths.h"
#include "include/stringxtc.h"
#include "track.h"
+#include "cundo.h"
#define MYMIN(x, y) (((x) < (y)) ? (x) : (y))
@@ -198,16 +199,6 @@ FileDlgUpdate(
/**
- * Handle Cancel button: restore old values for layer and position
- */
-
-static void
-FileEditCancel( wWin_p junk)
-{
- ResetIfNotSticky();
- wHide(fileNoteW);
-}
-/**
* Handle OK button: make sure the entered filename is syntactically valid, update
* the layout and close the dialog
*
@@ -221,13 +212,19 @@ FileEditOK(void *junk)
if ( trk == NULL ) {
// new file note
trk = NewNote( -1, fileNoteData.pos, OP_NOTEFILE );
+ } else {
+ if ( ! descUndoStarted ) {
+ UndoStart( _("Update File Note"), "Update File Note" );
+ descUndoStarted = TRUE;
+ }
+ UndoModify( trk );
}
struct extraDataNote_t * xx = GET_EXTRA_DATA( trk, T_NOTE, extraDataNote_t );
xx->pos = fileNoteData.pos;
SetTrkLayer( trk, fileNoteData.layer );
- MyFree( xx->noteData.fileData.title );
+ UndoDeferFree( xx->noteData.fileData.title );
+ UndoDeferFree( xx->noteData.fileData.path );
xx->noteData.fileData.title = MyStrdup( fileNoteData.title );
- MyFree( xx->noteData.fileData.path );
xx->noteData.fileData.path = MyStrdup( fileNoteData.path );
SetBoundingBox( trk, xx->pos, xx->pos );
DrawNewTrack( trk );
@@ -251,7 +248,7 @@ static void CreateEditFileDialog(char * windowTitle)
fileNoteW = ParamCreateDialog(&fileNotePG,
"",
_("Done"), FileEditOK,
- FileEditCancel, TRUE, NULL,
+ ParamCancel_Current, TRUE, NULL,
F_BLOCK,
FileDlgUpdate);
}
@@ -262,6 +259,7 @@ static void CreateEditFileDialog(char * windowTitle)
ParamLoadControls(&fileNotePG);
wControlActive(fileNotePLs[I_OPEN].control,
(IsFileValid(fileNoteData.path)?TRUE:FALSE));
+ descTitle = windowTitle;
wShow(fileNoteW);
}
diff --git a/app/bin/include/stringxtc.h b/app/bin/include/stringxtc.h
index dc054d7..2ccaa4f 100644
--- a/app/bin/include/stringxtc.h
+++ b/app/bin/include/stringxtc.h
@@ -6,4 +6,5 @@ size_t strscat(char *dest, const char *src, size_t count);
size_t strscpy(char *dest, const char *src, size_t count);
char *XtcStrlwr(char *str);
int XtcStricmp(const char *a, const char *b);
+void Stripcr(char*);
#endif
diff --git a/app/bin/include/toolbar.h b/app/bin/include/toolbar.h
new file mode 100644
index 0000000..f62b09a
--- /dev/null
+++ b/app/bin/include/toolbar.h
@@ -0,0 +1,57 @@
+/*****************************************************************//**
+ * \file toolbar.h
+ * \brief Header for toolbar functions
+ *********************************************************************/
+
+#ifndef TOOLBAR_H
+#define TOOLBAR_H
+ /*
+ * Command groups
+ */
+#define BG_SELECT (0)
+#define BG_ZOOM (1)
+#define BG_UNDO (2)
+#define BG_EASE (3)
+#define BG_TRKCRT (4)
+#define BG_TRKMOD (5)
+#define BG_TRKGRP (6)
+#define BG_MISCCRT (7)
+#define BG_RULER (8)
+#define BG_LAYER (9)
+#define BG_HOTBAR (10)
+#define BG_SNAP (11)
+#define BG_TRAIN (12)
+#define BG_FILE (13)
+#define BG_CONTROL (14)
+#define BG_EXPORTIMPORT (15)
+#define BG_PRINT (16)
+// This must be the last item:
+#define BG_LAST (17)
+
+extern void InitToolbar(void);
+extern void ToolbarLayout(void* data);
+extern void DoToolbar(void* unused);
+extern bool ToolbarIsGroupVisible(int group);
+extern wWinPix_t ToolbarGetHeight(void);
+extern void ToolbarSetHeight(wWinPix_t newHeight);
+
+extern void InitToolbar(void);
+extern void ToolbarButtonBusy(wIndex_t button, wBool_t busy);
+extern void ToolbarButtonEnable(wIndex_t button, wBool_t enable);
+extern void ToolbarButtonEnableIfSelect(bool selected);
+extern void ToolbarButtonCommandLink(wIndex_t button, int command);
+extern void ToolbarUpdateButton(wIndex_t button, wIndex_t command,
+ char* icon, const char* helpKey, void* context);
+extern void ToolbarButtonPlayback(wIndex_t buttonInx);
+extern void ToolbarLoadConfig(void);
+extern void ToolbarControlAdd(wControl_p control, long options, int cmdGroup);
+
+
+wIndex_t AddCommand(procCommand_t cmdProc, const char* helpKey,
+ const char* nameStr, wIcon_p icon, int reqLevel, long options, long acclKey,
+ wIndex_t buttInx, long stickyMask, wMenuPush_p cmdMenus[NUM_CMDMENUS],
+ void* context);
+
+void PlaybackButtonMouse(wIndex_t);
+void PlaybackCommand(const char*, wIndex_t);
+#endif
diff --git a/app/bin/layout.c b/app/bin/layout.c
index c61c23f..13c1931 100644
--- a/app/bin/layout.c
+++ b/app/bin/layout.c
@@ -29,6 +29,7 @@
#include "track.h"
#include "fileio.h"
#include "cselect.h"
+#include "include/toolbar.h"
#define MINTRACKRADIUSPREFS "minTrackRadius"
#define MAXTRACKGRADEPREFS "maxTrackGrade"
@@ -90,6 +91,8 @@ static paramIntegerRange_t i0_100 = { 0, 100 };
static void SettingsWrite( void );
static void SettingsRead( void );
+static void ImageFileClear(void* unused);
+static void ImageFileBrowse(void* unused);
static void LayoutDlgUpdate(paramGroup_p pg, int inx, void * valueP);
@@ -159,7 +162,7 @@ LoadLayoutMaxGradePref(char* scaleName, double defaultValue)
static void
CopyLayoutTitle(char* dest, char *src)
{
- strncpy(dest, src, TITLEMAXLEN);
+ strncpy(dest, src, TITLEMAXLEN - 1);
*(dest + TITLEMAXLEN - 1) = '\0';
}
@@ -494,6 +497,39 @@ GetLayoutRoomSize(coOrd *roomSize)
static wWin_p layoutW;
static void LayoutChange(long changes);
+static paramData_t layoutPLs[] = {
+ { PD_FLOAT, &thisLayout.props.roomSize.x, "roomsizeX", PDO_NOPREF | PDO_DIM | PDO_NOPSHUPD | PDO_DRAW, &r1_9999999, N_("Room Width"), 0, I2VP(CHANGE_MAIN | CHANGE_MAP) },
+ { PD_FLOAT, &thisLayout.props.roomSize.y, "roomsizeY", PDO_NOPREF | PDO_DIM | PDO_NOPSHUPD | PDO_DRAW | PDO_DLGHORZ, &r1_9999999, N_(" Height"), 0, I2VP(CHANGE_MAIN | CHANGE_MAP) },
+ { PD_STRING, &thisLayout.props.title1, "title1", PDO_NOPSHUPD | PDO_STRINGLIMITLENGTH, NULL, N_("Layout Title"), 0, 0, sizeof(thisLayout.props.title1)},
+ { PD_STRING, &thisLayout.props.title2, "title2", PDO_NOPSHUPD | PDO_STRINGLIMITLENGTH, NULL, N_("Subtitle"), 0, 0, sizeof(thisLayout.props.title2)},
+#define SCALEINX (4)
+ { PD_DROPLIST, &thisLayout.props.curScaleDescInx, "scale", PDO_NOPREF | PDO_NOPSHUPD | PDO_NORECORD | PDO_NOUPDACT, I2VP(180), N_("Scale"), 0, I2VP(CHANGE_SCALE) },
+#define GAUGEINX (5)
+ { PD_DROPLIST, &thisLayout.props.curGaugeInx, "gauge", PDO_NOPREF | PDO_NOPSHUPD | PDO_NORECORD | PDO_NOUPDACT | PDO_DLGHORZ, I2VP(180), N_(" Gauge"), 0, I2VP(CHANGE_SCALE) },
+#define MINRADIUSENTRY (6)
+ { PD_FLOAT, &thisLayout.props.minTrackRadius, "mintrackradius", PDO_DIM | PDO_NOPSHUPD | PDO_NOPREF, &r0_10000, N_("Min Track Radius"), 0, I2VP(CHANGE_MAIN | CHANGE_LIMITS) },
+ { PD_FLOAT, &thisLayout.props.maxTrackGrade, "maxtrackgrade", PDO_NOPSHUPD | PDO_DLGHORZ, &r0_90, N_(" Max Track Grade (%)"), 0, I2VP(CHANGE_MAIN) },
+#define BACKGROUNDFILEENTRY (8)
+ { PD_STRING, &thisLayout.props.backgroundTextBox, "backgroundfile", PDO_NOPSHUPD | PDO_NOPREF | PDO_NORECORD | PDO_STRINGLIMITLENGTH, NULL, N_("Background File Path"), 0, I2VP(CHANGE_BACKGROUND), TEXT_FIELD_LEN },
+ { PD_BUTTON, ImageFileBrowse, "browse", PDO_DLGHORZ, NULL, N_("Browse ...") },
+ { PD_BUTTON, ImageFileClear, "clear", PDO_DLGHORZ, NULL, N_("Clear") },
+#define BACKGROUNDPOSX (11)
+ { PD_FLOAT, &thisLayout.props.backgroundPos.x, "backgroundposX", PDO_DIM | PDO_NOPSHUPD | PDO_DRAW, &rN_9999999, N_("Background PosX,Y"), 0, I2VP(CHANGE_BACKGROUND) },
+#define BACKGROUNDPOSY (12)
+ { PD_FLOAT, &thisLayout.props.backgroundPos.y, "backgroundposY", PDO_DIM | PDO_NOPSHUPD | PDO_DRAW | PDO_DLGHORZ, &rN_9999999, NULL, 0, I2VP(CHANGE_BACKGROUND) },
+#define BACKGROUNDWIDTH (13)
+ { PD_FLOAT, &thisLayout.props.backgroundSize, "backgroundWidth", PDO_DIM | PDO_NOPSHUPD | PDO_DRAW, &r0_9999999, N_("Background Size"), 0, I2VP(CHANGE_BACKGROUND) },
+#define BACKGROUNDSCREEN (14)
+ { PD_LONG, &thisLayout.props.backgroundScreen, "backgroundScreen", PDO_NOPSHUPD | PDO_DRAW, &i0_100, N_("Background Screen %"), 0, I2VP(CHANGE_BACKGROUND) },
+#define BACKGROUNDANGLE (15)
+ { PD_FLOAT, &thisLayout.props.backgroundAngle, "backgroundAngle", PDO_NOPSHUPD | PDO_DRAW | PDO_DLGBOXEND, &r360_360, N_("Background Angle"), 0, I2VP(CHANGE_BACKGROUND) },
+ { PD_MESSAGE, N_("Named Settings File"), NULL, PDO_DLGRESETMARGIN, I2VP(180) },
+ { PD_BUTTON, SettingsWrite, "write", PDO_DLGHORZ, 0, N_("Write"), 0, I2VP(0) },
+ { PD_BUTTON, SettingsRead, "read", PDO_DLGHORZ | PDO_DLGBOXEND, 0, N_("Read"), 0, I2VP(0) }
+};
+
+static paramGroup_t layoutPG = { "layout", PGO_RECORD | PGO_PREFMISC, layoutPLs, COUNT(layoutPLs) };
+
/**
* Show only the filename in the Dialog
*/
@@ -572,7 +608,7 @@ LoadBackGroundImage(void)
return TRUE;
}
-#define BACKGROUNDFILEENTRY (8)
+
/**
* Callback from File Select for Background Image File
@@ -647,57 +683,46 @@ static void ImageFileBrowse( void * unused )
return;
}
+
+static void ClearBackgroundData(void)
+{
+ SetLayoutBackGroundFullPath(NULL);
+ thisLayout.props.backgroundAngle = 0.0;
+ thisLayout.props.backgroundPos.x = 0.0;
+ thisLayout.props.backgroundPos.y = 0.0;
+ thisLayout.props.backgroundScreen = 0;
+ thisLayout.props.backgroundSize = 0.0;
+}
+
+static void UpdateBackgroundDialogControls()
+{
+ SetName();
+ ParamLoadControl(layout_pg_p, BACKGROUNDFILEENTRY);
+
+ ParamLoadControl(layout_pg_p, BACKGROUNDPOSX);
+ ParamLoadControl(layout_pg_p, BACKGROUNDPOSY);
+ ParamLoadControl(layout_pg_p, BACKGROUNDSCREEN);
+ ParamLoadControl(layout_pg_p, BACKGROUNDWIDTH);
+ ParamLoadControl(layout_pg_p, BACKGROUNDANGLE);
+}
/**
* Remove the background Image File
*/
static void ImageFileClear( void * unused)
{
- char * noname = "";
- SetLayoutBackGroundFullPath(noname);
+ ClearBackgroundData();
+ UpdateBackgroundDialogControls();
+
wDrawSetBackground( mainD.d, NULL, NULL);
- SetName();
wControlActive((wControl_p)backgroundB, FALSE);
+
file_changed = TRUE;
haveBackground = false;
- ParamLoadControl(layout_pg_p, BACKGROUNDFILEENTRY);
-
- LayoutChange( CHANGE_BACKGROUND );
MainRedraw();
}
-static paramData_t layoutPLs[] = {
- { PD_FLOAT, &thisLayout.props.roomSize.x, "roomsizeX", PDO_NOPREF | PDO_DIM | PDO_NOPSHUPD | PDO_DRAW, &r1_9999999, N_("Room Width"), 0, I2VP(CHANGE_MAIN | CHANGE_MAP) },
- { PD_FLOAT, &thisLayout.props.roomSize.y, "roomsizeY", PDO_NOPREF | PDO_DIM | PDO_NOPSHUPD | PDO_DRAW | PDO_DLGHORZ, &r1_9999999, N_(" Height"), 0, I2VP(CHANGE_MAIN | CHANGE_MAP) },
- { PD_STRING, &thisLayout.props.title1, "title1", PDO_NOPSHUPD | PDO_STRINGLIMITLENGTH, NULL, N_("Layout Title"), 0, 0, sizeof(thisLayout.props.title1)},
- { PD_STRING, &thisLayout.props.title2, "title2", PDO_NOPSHUPD | PDO_STRINGLIMITLENGTH, NULL, N_("Subtitle"), 0, 0, sizeof(thisLayout.props.title2)},
-#define SCALEINX (4)
- { PD_DROPLIST, &thisLayout.props.curScaleDescInx, "scale", PDO_NOPREF | PDO_NOPSHUPD | PDO_NORECORD | PDO_NOUPDACT, I2VP(180), N_("Scale"), 0, I2VP(CHANGE_SCALE) },
-#define GAUGEINX (5)
- { PD_DROPLIST, &thisLayout.props.curGaugeInx, "gauge", PDO_NOPREF | PDO_NOPSHUPD | PDO_NORECORD | PDO_NOUPDACT | PDO_DLGHORZ, I2VP(180), N_(" Gauge"), 0, I2VP(CHANGE_SCALE) },
-#define MINRADIUSENTRY (6)
- { PD_FLOAT, &thisLayout.props.minTrackRadius, "mintrackradius", PDO_DIM | PDO_NOPSHUPD | PDO_NOPREF, &r0_10000, N_("Min Track Radius"), 0, I2VP(CHANGE_MAIN | CHANGE_LIMITS) },
- { PD_FLOAT, &thisLayout.props.maxTrackGrade, "maxtrackgrade", PDO_NOPSHUPD | PDO_DLGHORZ, &r0_90, N_(" Max Track Grade (%)"), 0, I2VP(CHANGE_MAIN) },
-#define BACKGROUNDFILECHECK (8) //Note this value used in the file section routines above - if it changes, they will need to change
- { PD_STRING, &thisLayout.props.backgroundTextBox, "backgroundfile", PDO_NOPSHUPD|PDO_NOPREF|PDO_NORECORD|PDO_STRINGLIMITLENGTH, NULL, N_("Background File Path"), 0, I2VP(CHANGE_BACKGROUND), TEXT_FIELD_LEN },
- { PD_BUTTON, ImageFileBrowse, "browse", PDO_DLGHORZ, NULL, N_("Browse ...") },
- { PD_BUTTON, ImageFileClear, "clear", PDO_DLGHORZ, NULL, N_("Clear") },
-#define BACKGROUNDPOSX (11)
- { PD_FLOAT, &thisLayout.props.backgroundPos.x, "backgroundposX", PDO_DIM | PDO_NOPSHUPD | PDO_DRAW, &rN_9999999, N_("Background PosX,Y"), 0, I2VP(CHANGE_BACKGROUND) },
-#define BACKGROUNDPOSY (12)
- { PD_FLOAT, &thisLayout.props.backgroundPos.y, "backgroundposY", PDO_DIM | PDO_NOPSHUPD | PDO_DRAW | PDO_DLGHORZ, &rN_9999999, NULL, 0, I2VP(CHANGE_BACKGROUND) },
-#define BACKGROUNDWIDTH (13)
- { PD_FLOAT, &thisLayout.props.backgroundSize, "backgroundWidth", PDO_DIM | PDO_NOPSHUPD | PDO_DRAW, &r0_9999999, N_("Background Size"), 0, I2VP(CHANGE_BACKGROUND) },
-#define BACKGROUNDSCREEN (14)
- { PD_LONG, &thisLayout.props.backgroundScreen, "backgroundScreen", PDO_NOPSHUPD | PDO_DRAW, &i0_100, N_("Background Screen %"), 0, I2VP(CHANGE_BACKGROUND) },
-#define BACKGROUNDANGLE (15)
- { PD_FLOAT, &thisLayout.props.backgroundAngle, "backgroundAngle", PDO_NOPSHUPD | PDO_DRAW | PDO_DLGBOXEND, &r360_360, N_("Background Angle"), 0, I2VP(CHANGE_BACKGROUND) },
- { PD_MESSAGE, N_("Named Settings File"), NULL, PDO_DLGRESETMARGIN, I2VP(180) },
- { PD_BUTTON, SettingsWrite, "write", PDO_DLGHORZ, 0, N_("Write"), 0, I2VP(0) },
- { PD_BUTTON, SettingsRead, "read", PDO_DLGHORZ | PDO_DLGBOXEND, 0, N_("Read"), 0, I2VP(0) }
-};
-static paramGroup_t layoutPG = { "layout", PGO_RECORD | PGO_PREFMISC, layoutPLs, COUNT( layoutPLs ) };
/**
* @brief Handle the Layout changes, setting the values of changed items from dialog.
@@ -823,13 +848,13 @@ static void LayoutChange(long changes)
*/
void DoLayout(void * unused)
{
- CHECK(BACKGROUNDFILEENTRY == BACKGROUNDFILECHECK);
SetLayoutRoomSize(mapD.size);
if (layoutW == NULL) {
layoutW = ParamCreateDialog(&layoutPG, MakeWindowTitle(_("Layout Options")),
- _("Ok"), LayoutOk, LayoutCancel, TRUE, NULL, 0, LayoutDlgUpdate);
+ _("Ok"), LayoutOk, ParamCancel_Custom( LayoutCancel ),
+ TRUE, NULL, 0, LayoutDlgUpdate);
LoadScaleList((wList_p)layoutPLs[4].control);
}
@@ -1016,7 +1041,7 @@ LayoutBackGroundInit(BOOL_T clear)
/**
* Read the settings defined in the file from sections [misc] and [DialogItem]
* @param files Number of files chosen
- * @param fileName Filename(s) shosen. Only the first is used
+ * @param fileName Filename(s) chosen. Only the first is used
* @param data Not used
* @return TRUE (always)
*/
@@ -1044,7 +1069,7 @@ EXPORT int DoSettingsRead(
wPrefGetInteger("DialogItem","cmdopt-selectzero",&selectZero,selectZero);
//Get Toolbar showing
- wPrefGetInteger( "misc", "toolbarset",&toolbarSet,toolbarSet);
+ ToolbarLoadConfig();
LayoutBackGroundInit( FALSE );
diff --git a/app/bin/linknoteui.c b/app/bin/linknoteui.c
index a47bb58..31cb9de 100644
--- a/app/bin/linknoteui.c
+++ b/app/bin/linknoteui.c
@@ -28,6 +28,7 @@
#include "include/stringxtc.h"
#include "track.h"
#include "validator.h"
+#include "cundo.h"
#define DEFAULTLINKURL "http://www.xtrkcad.org/"
#define DEFAULTLINKTITLE "The XTrackCAD Homepage"
@@ -116,16 +117,6 @@ LinkDlgUpdate(
}
}
-/**
-* Handle Cancel button: restore old values for layer and position
-*/
-
-static void
-LinkEditCancel( wWin_p junk)
-{
- ResetIfNotSticky();
- wHide(linkNoteW);
-}
/**
* Handle OK button: make sure the entered URL is syntactically valid, update
@@ -141,13 +132,19 @@ LinkEditOK(void *junk)
if ( trk == NULL ) {
// new note
trk = NewNote( -1, linkNoteData.pos, OP_NOTELINK );
+ } else {
+ if ( ! descUndoStarted ) {
+ UndoStart( _("Update Link Note"), "Update Link Note" );
+ descUndoStarted = TRUE;
+ }
+ UndoModify( trk );
}
struct extraDataNote_t * xx = GET_EXTRA_DATA( trk, T_NOTE, extraDataNote_t );
xx->pos = linkNoteData.pos;
SetTrkLayer( trk, linkNoteData.layer );
- MyFree( xx->noteData.linkData.title );
+ UndoDeferFree( xx->noteData.linkData.title );
+ UndoDeferFree( xx->noteData.linkData.url );
xx->noteData.linkData.title = MyStrdup( linkNoteData.title );
- MyFree( xx->noteData.linkData.url );
xx->noteData.linkData.url = MyStrdup( linkNoteData.url );
SetBoundingBox( trk, xx->pos, xx->pos );
DrawNewTrack( trk );
@@ -167,7 +164,7 @@ CreateEditLinkDialog(char *title)
linkNoteW = ParamCreateDialog(&linkNotePG,
"",
_("Done"), LinkEditOK,
- LinkEditCancel, TRUE, NULL,
+ ParamCancel_Current, TRUE, NULL,
F_BLOCK,
LinkDlgUpdate);
}
@@ -176,6 +173,7 @@ CreateEditLinkDialog(char *title)
FillLayerList((wList_p)linkNotePLs[I_LAYER].control);
ParamLoadControls(&linkNotePG);
+ descTitle = title;
// and show the dialog
wShow(linkNoteW);
diff --git a/app/bin/locale.c b/app/bin/locale.c
new file mode 100644
index 0000000..257a975
--- /dev/null
+++ b/app/bin/locale.c
@@ -0,0 +1,78 @@
+/**
+ * \file locale.c
+ * \brief Locale handling
+ */
+
+/* XTrackCad - Model Railroad CAD
+ * Copyright (C) 2005, 2024 Dave Bullis
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "common.h"
+#include <locale.h>
+
+/**
+ * SetCLocale is called before reading/writing any data files (.xtc, .xti, .xtq, .cus...).
+ * SetUserLocale is called after.
+ * Calls can be nested: C, C, User, User
+ */
+
+static char* sUserLocale = NULL; // current user locale
+static long lCLocale = 0; // locale state: > 0 C locale, <= 0 user locale
+static long nCLocale = 0; // total # of setlocals calls
+static int log_locale = 0; // logging
+
+
+EXPORT void SetCLocale()
+{
+ if (sUserLocale == NULL) {
+ sUserLocale = MyStrdup(setlocale(LC_ALL, NULL));
+ }
+ if (lCLocale == 0) {
+ LOG(log_locale, 1, ("Set C Locale: %ld\n", ++nCLocale));
+ setlocale(LC_ALL, "C");
+#ifdef LC_MESSAGES
+ setlocale(LC_MESSAGES, "");
+#endif
+ }
+ lCLocale++;
+ if (lCLocale > 1) {
+ LOG(log_locale, 3, ("SetClocale - C! %ld\n", nCLocale));
+ } else if (lCLocale < 1) {
+ LOG(log_locale, 2, ("SetClocale - User! %ld\n", nCLocale));
+ }
+}
+
+EXPORT void SetUserLocale()
+{
+ if (lCLocale == 1) {
+ LOG(log_locale, 1, ("Set %s Locale: %ld\n", sUserLocale, ++nCLocale));
+ setlocale(LC_ALL, sUserLocale);
+ }
+ lCLocale--;
+ if (lCLocale < 0) {
+ LOG(log_locale, 2, ("SetUserLocale - User! %ld\n", nCLocale));
+ } else if (lCLocale > 0) {
+ LOG(log_locale, 3, ("SetUserLocale - C! %ld\n", nCLocale));
+ }
+}
+
+void
+LocaleInit()
+{
+ log_locale = LogFindIndex("locale");
+}
+
diff --git a/app/bin/macro.c b/app/bin/macro.c
index 7105e98..7872df9 100644
--- a/app/bin/macro.c
+++ b/app/bin/macro.c
@@ -30,9 +30,11 @@
#include "misc.h"
#include "param.h"
#include "paths.h"
+#include "include/stringxtc.h"
#include "track.h"
#include "version.h"
#include "common-ui.h"
+#include "include/toolbar.h"
#ifdef UTFCONVERT
#include "include/utf8convert.h"
@@ -181,7 +183,7 @@ static int StartRecord( int cnt, char ** pathName, void * context )
if ( logTable_da.cnt > 11 ) {
lprintf( "StartRecord( %s ) @ %s\n", pathName, ctime(&clock) );
}
- ParamStartRecord();
+ ParamStartRecord(recordF);
WriteTracks( recordF, TRUE );
WriteLayers( recordF );
fprintf( recordF, "REDRAW\n" );
@@ -207,6 +209,7 @@ static void DoRecordButton( void * context )
fprintf( recordF, "%s\nSTEP\n", END_MESSAGE );
fclose( recordF );
recordF = NULL;
+ ParamStartRecord( NULL );
wHide( recordW );
break;
@@ -269,7 +272,8 @@ EXPORT void DoRecord( void * context )
{
if (recordW == NULL) {
char * title = MakeWindowTitle(_("Record"));
- recordW = ParamCreateDialog( &recordPG, title, NULL, NULL, NULL, FALSE, NULL,
+ recordW = ParamCreateDialog( &recordPG, title, NULL, NULL, ParamCancel_Null,
+ FALSE, NULL,
F_RESIZE, NULL );
recordFile_fs = wFilSelCreate( mainW, FS_SAVE, 0, title, sRecordFilePattern,
StartRecord, NULL );
@@ -320,7 +324,8 @@ static wDrawBitMap_p flash_bm;
static long flashTO = 120;
static DIST_T PixelsPerStep = 5;
static long stepTO = 100;
-EXPORT unsigned long playbackTimer;
+EXPORT unsigned long
+playbackTimer; /** if >0 performance measurement in progress */
static wBool_t didPause;
static wBool_t flashTwice = FALSE;
@@ -399,6 +404,8 @@ static void SetPlaybackSpeed(
case 5: playbackDelay = 0; break;
}
playbackSpeed = inx;
+
+ ParamSetInPlayback(inPlayback, playbackDelay);
}
@@ -958,6 +965,12 @@ static void PlaybackSetup( void )
nRegressionFail = 0;
}
+void
+SetInPlayback(wBool_t state)
+{
+ inPlayback = state;
+ ParamSetInPlayback(state, playbackDelay);
+}
static void Playback( void )
{
@@ -973,10 +986,11 @@ static void Playback( void )
char *demoFileName = NULL;
useCurrentLayer = FALSE;
- inPlayback = TRUE;
+ SetInPlayback( TRUE );
EnableButtons( FALSE );
// lastCmd = otherCmd;
playbackTimer = 0;
+ ParamTurnOffDelays(false);
if (demoWinOnTop) {
wWinTop( mainW );
demoWinOnTop = FALSE;
@@ -1009,7 +1023,7 @@ static void Playback( void )
if ( paramFile == NULL ) {
NoticeMessage( MSG_OPEN_FAIL, _("Continue"), NULL, _("Demo"), demoFileName,
strerror(errno) );
- inPlayback = FALSE;
+ SetInPlayback( FALSE );
SetUserLocale();
return;
}
@@ -1030,7 +1044,7 @@ static void Playback( void )
demoFileName );
fclose( paramFile );
paramFile = NULL;
- inPlayback = FALSE;
+ SetInPlayback( FALSE );
SetUserLocale();
return;
}
@@ -1059,7 +1073,7 @@ static void Playback( void )
/* empty paramLine */
} else if (ReadTrack( paramLine ) ) {
if ( paramFile == NULL ) {
- inPlayback = FALSE;
+ SetInPlayback(FALSE );
break;
}
} else if (strncmp( paramLine, "STEP", 5 ) == 0) {
@@ -1081,7 +1095,7 @@ static void Playback( void )
wPause( 1000 );
EnableButtons( FALSE );
} else {
- inPlayback = FALSE;
+ SetInPlayback(FALSE);
SetUserLocale();
return;
}
@@ -1103,7 +1117,7 @@ static void Playback( void )
wWinTop( demoW );
demoWinOnTop = TRUE;
EnableButtons( TRUE );
- inPlayback = FALSE;
+ SetInPlayback(FALSE);
SetUserLocale();
return;
}
@@ -1211,6 +1225,7 @@ static void Playback( void )
}
} else if (strncmp( paramLine, "TIMESTART", 9 ) == 0 ) {
playbackTimer = wGetTimer();
+ ParamTurnOffDelays(true);
} else if (strncmp( paramLine, "TIMEEND", 7 ) == 0 ) {
if (playbackTimer == 0) {
NoticeMessage( MSG_PLAYBACK_TIMEEND, _("Ok"), NULL );
@@ -1219,6 +1234,7 @@ static void Playback( void )
sprintf( message, _("Elapsed time %lu\n"), playbackTimer );
wTextAppend( demoT, message );
playbackTimer = 0;
+ ParamTurnOffDelays(false);
}
} else if (strncmp( paramLine, "MEMSTATS", 8 ) == 0 ) {
wTextAppend( demoT, wMemStats() );
@@ -1299,7 +1315,7 @@ static void Playback( void )
if (pauseDemo) {
EnableButtons( TRUE );
pauseDemo = FALSE;
- inPlayback = FALSE;
+ SetInPlayback(FALSE);
SetUserLocale();
return;
}
@@ -1312,7 +1328,7 @@ static void Playback( void )
fclose( documentFile );
documentFile = NULL;
}
- inPlayback = FALSE;
+ SetInPlayback(FALSE);
PlaybackQuit();
SetUserLocale();
}
@@ -1381,7 +1397,7 @@ static void DoDemoButton( void * command )
/* quit */
if ( inPlayback ) {
// We will exit the loop in Playback() after the current command
- inPlayback = FALSE;
+ SetInPlayback(FALSE);
} else {
// We're waiting for the user to press 'Step'
PlaybackQuit();
@@ -1408,7 +1424,8 @@ static void DemoDlgUpdate(
static void CreateDemoW( void )
{
char * title = MakeWindowTitle(_("Demo"));
- demoW = ParamCreateDialog( &demoPG, title, NULL, NULL, NULL, FALSE, NULL,
+ demoW = ParamCreateDialog( &demoPG, title, NULL, NULL, ParamCancel_Null, FALSE,
+ NULL,
F_RESIZE, DemoDlgUpdate );
wListAddValue( demoSpeedL, _("Slowest"), NULL, I2VP(0) );
diff --git a/app/bin/menu.c b/app/bin/menu.c
index ae2cfe2..814a0b5 100644
--- a/app/bin/menu.c
+++ b/app/bin/menu.c
@@ -36,9 +36,11 @@
#include "common-ui.h"
#include "ctrain.h"
-static paramData_t menuPLs[101] = { { PD_LONG, &toolbarSet, "toolbarset" }, {
- PD_LONG, &curTurnoutEp, "cur-turnout-ep"
- }
+#include "include/toolbar.h"
+
+static paramData_t menuPLs[101] = {
+ {PD_LONG, NULL, "toolbarset", PDO_NOPREF},
+ {PD_LONG, &curTurnoutEp, "cur-turnout-ep"}
};
static paramGroup_t menuPG = { "misc", PGO_RECORD, menuPLs, 2 };
@@ -62,6 +64,7 @@ EXPORT wMenuList_p fileList_ml;
EXPORT wMenuToggle_p snapGridEnableMI;
EXPORT wMenuToggle_p snapGridShowMI;
+static int cmdGroup;
/*--------------------------------------------------------------------*/
typedef struct {
@@ -115,78 +118,6 @@ static void MenuPlayback(char * line)
}
-/*****************************************************************************
- *
- * TOOLBAR
- *
- */
-
-
-/*
- * These array control the choices available in the Toolbar setup.
- * For each choice, the text is given and the respective mask is
- * specified in the following array.
- * Note: text and choices must be given in the same order.
- */
-static char *AllToolbarLabels[] = { N_("File Buttons"), N_("Print Buttons"), N_("Import/Export Buttons"),
- N_("Zoom Buttons"), N_("Undo Buttons"), N_("Easement Button"), N_("SnapGrid Buttons"),
- N_("Create Track Buttons"), N_("Layout Control Elements"),
- N_("Modify Track Buttons"), N_("Properties/Select"),
- N_("Track Group Buttons"), N_("Train Group Buttons"),
- N_("Create Misc Buttons"), N_("Ruler Button"),
- N_("Layer Buttons"), N_("Hot Bar"),
- NULL
- };
-static long AllToolbarMasks[] = { 1 << BG_FILE, 1<< BG_PRINT, 1<< BG_EXPORTIMPORT,
- 1<< BG_ZOOM, 1<< BG_UNDO, 1<< BG_EASE, 1 << BG_SNAP, 1 << BG_TRKCRT,
- 1<< BG_CONTROL, 1<< BG_TRKMOD, 1 << BG_SELECT, 1 << BG_TRKGRP, 1 << BG_TRAIN,
- 1<< BG_MISCCRT, 1<< BG_RULER, 1 << BG_LAYER, 1 << BG_HOTBAR
- };
-
-static wMenuToggle_p AllToolbarMI[ COUNT( AllToolbarMasks ) ];
-
-static void ToolbarAction(void * data)
-{
- int inx = (int)VP2L(data);
- CHECK( inx >=0 && inx < COUNT( AllToolbarMasks ) );
- wBool_t set = wMenuToggleGet( AllToolbarMI[inx] );
- long mask = AllToolbarMasks[inx];
- if (set) {
- toolbarSet |= mask;
- } else {
- toolbarSet &= ~mask;
- }
- wPrefSetInteger( "misc", "toolbarset", toolbarSet );
- MainProc( mainW, wResize_e, NULL, NULL );
- if (recordF)
- fprintf(recordF, "PARAMETER %s %s %ld", "misc", "toolbarset",
- toolbarSet);
-}
-
-/**
- * Create the Toolbar configuration submenu. Based on two arrays of descriptions and
- * masks, the toolbar submenu is created dynamically.
- *
- * \param toolbarM IN menu to which the toogles will be added
- */
-
-static void CreateToolbarM(wMenu_p toolbarM)
-{
- int inx, cnt;
- long *masks;
- char **labels;
- wBool_t set;
-
- cnt = COUNT(AllToolbarMasks);
- masks = AllToolbarMasks;
- labels = AllToolbarLabels;
- for (inx = 0; inx < cnt; inx++, masks++, labels++) {
- set = (toolbarSet & *masks) != 0;
- AllToolbarMI[inx] = wMenuToggleCreate(toolbarM, "toolbarM", _(*labels), 0, set,
- ToolbarAction, I2VP(inx));
- }
-}
-
/*****************************************************************************
*
@@ -224,7 +155,7 @@ static void ShowAddElevations(void * unused)
if (addElevW == NULL)
addElevW = ParamCreateDialog(&addElevPG,
MakeWindowTitle(_("Change Elevations")), _("Change"), DoAddElev,
- wHide, FALSE, NULL, 0, NULL);
+ ParamCancel_Current, FALSE, NULL, 0, NULL);
wShow(addElevW);
}
@@ -270,7 +201,7 @@ static void StartRotateDialog(void * funcVP)
rotateDialogCallBack_t func = funcVP;
if (rotateW == NULL)
rotateW = ParamCreateDialog(&rotatePG, MakeWindowTitle(_("Rotate")),
- _("Ok"), RotateEnterOk, wHide, FALSE, NULL, 0, NULL);
+ _("Ok"), RotateEnterOk, ParamCancel_Current, FALSE, NULL, 0, NULL);
ParamLoadControls(&rotatePG);
rotateDialogCallBack = func;
wShow(rotateW);
@@ -281,7 +212,7 @@ static void StartIndexDialog(void * funcVP)
indexDialogCallBack_t func = funcVP;
if (indexW == NULL)
indexW = ParamCreateDialog(&indexPG, MakeWindowTitle(_("Select Index")),
- _("Ok"), IndexEnterOk, wHide, FALSE, NULL, 0, NULL);
+ _("Ok"), IndexEnterOk, ParamCancel_Current, FALSE, NULL, 0, NULL);
ParamLoadControls(&indexPG);
indexDialogCallBack = func;
trackIndex[0] = '\0';
@@ -293,17 +224,19 @@ static void StartMoveDialog(void * funcVP)
moveDialogCallBack_t func = funcVP;
if (moveW == NULL)
moveW = ParamCreateDialog(&movePG, MakeWindowTitle(_("Move")), _("Ok"),
- MoveEnterOk, wHide, FALSE, NULL, 0, NULL);
+ MoveEnterOk, ParamCancel_Current, FALSE, NULL, 0, NULL);
ParamLoadControls(&movePG);
moveDialogCallBack = func;
- moveValue = zero;
wShow(moveW);
}
static void MoveEnterOk(void * unused)
{
ParamLoadData(&movePG);
- moveDialogCallBack(&moveValue);
+ if ( moveValue.x != 0.0 ||
+ moveValue.y != 0.0 ) {
+ moveDialogCallBack(&moveValue);
+ }
wHide(moveW);
}
@@ -317,10 +250,12 @@ static void IndexEnterOk(void * unused)
static void RotateEnterOk(void * unused)
{
ParamLoadData(&rotatePG);
- if (angleSystem == ANGLE_POLAR) {
- rotateDialogCallBack(I2VP(rotateValue * 1000));
- } else {
- rotateDialogCallBack(I2VP(rotateValue * 1000));
+ if ( rotateValue != 0.0 ) {
+ if (angleSystem == ANGLE_POLAR) {
+ rotateDialogCallBack(I2VP(rotateValue * 1000));
+ } else {
+ rotateDialogCallBack(I2VP(rotateValue * 1000));
+ }
}
wHide(rotateW);
}
@@ -436,10 +371,11 @@ EXPORT void SelectFont(void * unused)
EXPORT long stickySet = 0;
+static long stickySet1 = 0;
static wWin_p stickyW;
static const char * stickyLabels[33];
static paramData_t stickyPLs[] = { {
- PD_TOGGLE, &stickySet, "set", 0,
+ PD_TOGGLE, &stickySet1, "set", 0,
stickyLabels
}
};
@@ -449,6 +385,7 @@ static paramGroup_t stickyPG = { "sticky", PGO_RECORD, stickyPLs,
static void StickyOk(void * unused)
{
+ stickySet = stickySet1;
wHide(stickyW);
}
@@ -457,8 +394,9 @@ EXPORT void DoSticky(void * unused)
{
if (!stickyW)
stickyW = ParamCreateDialog(&stickyPG,
- MakeWindowTitle(_("Sticky Commands")), _("Ok"), StickyOk, wHide,
+ MakeWindowTitle(_("Sticky Commands")), _("Ok"), StickyOk, ParamCancel_Restore,
TRUE, NULL, 0, NULL);
+ stickySet1 = stickySet;
ParamLoadControls(&stickyPG);
wShow(stickyW);
}
@@ -496,7 +434,7 @@ static void CreateDebugW(void)
debugPG.paramCnt = debugCnt+1;
ParamRegister(&debugPG);
debugW = ParamCreateDialog(&debugPG, MakeWindowTitle(_("Debug")), _("Ok"),
- DebugOk, wHide, FALSE, NULL, 0, NULL);
+ DebugOk, ParamCancel_Current, FALSE, NULL, 0, NULL);
wHide(debugW);
}
@@ -698,11 +636,11 @@ EXPORT wButton_p AddToolbarButton(const char * helpStr, wIcon_p icon,
}
bb = wButtonCreate(mainW, 0, 0, helpStr, (char*) icon,
BO_ICON/*|((options&IC_CANCEL)?BB_CANCEL:0)*/, 0, action, context);
- AddToolbarControl((wControl_p) bb, options);
+ ToolbarControlAdd((wControl_p) bb, options, cmdGroup);
return bb;
}
-#include "bitmaps/down.xpm3"
+#include "bitmaps/down.image3"
static const char * buttonGroupMenuTitle;
static const char * buttonGroupHelpKey;
static const char * buttonGroupStickyLabel;
@@ -749,7 +687,7 @@ EXPORT wIndex_t AddMenuButton(wMenu_p menu, procCommand_t command,
}
if (buttonGroupMenuTitle != NULL && buttonGroupPopupM == NULL) {
if (openbuttIcon == NULL) {
- openbuttIcon = wIconCreatePixMap(down_xpm3[iconSize]);
+ openbuttIcon = wIconCreatePixMap(down_image3[iconSize]);
}
buttonGroupPopupM = wMenuPopupCreate(mainW, buttonGroupMenuTitle);
AddToolbarButton(buttonGroupHelpKey, openbuttIcon, IC_ABUT,
@@ -841,39 +779,37 @@ static void MiscMenuItemCreate(wMenu_p m1, wMenu_p m2, const char * name,
GetBalloonHelpStr(name);
}
menuPG.paramCnt++;
+ CHECK( menuPG.paramCnt < COUNT(menuPLs) );
}
-
-#include "bitmaps/zoom-in.xpm3"
-#include "bitmaps/zoom-choose.xpm3"
-#include "bitmaps/zoom-out.xpm3"
-#include "bitmaps/zoom-extent.xpm3"
-#include "bitmaps/undo.xpm3"
-#include "bitmaps/redo.xpm3"
-// #include "bitmaps/partlist.xpm" // unused
-#include "bitmaps/doc-export.xpm3"
-#include "bitmaps/doc-export-bmap.xpm3"
-#include "bitmaps/doc-export-dxf.xpm3"
+#include "bitmaps/zoom-in.image3"
+#include "bitmaps/zoom-choose.image3"
+#include "bitmaps/zoom-out.image3"
+#include "bitmaps/zoom-extent.image3"
+#include "bitmaps/undo.image3"
+#include "bitmaps/redo.image3"
+#include "bitmaps/doc-export.image3"
+#include "bitmaps/doc-export-bmap.image3"
+#include "bitmaps/doc-export-dxf.image3"
#if XTRKCAD_CREATE_SVG
-#include "bitmaps/doc-export-svg.xpm3"
+#include "bitmaps/doc-export-svg.image3"
#endif
-#include "bitmaps/doc-import.xpm3"
-#include "bitmaps/doc-import-mod.xpm3"
-#include "bitmaps/doc-new.xpm3"
-#include "bitmaps/doc-save.xpm3"
-#include "bitmaps/doc-open.xpm3"
-// #include "bitmaps/doc-print.xpm"
-#include "bitmaps/doc-setup.xpm3"
-#include "bitmaps/parameter.xpm3"
-#include "bitmaps/map.xpm3"
-#include "bitmaps/magnet.xpm3"
+#include "bitmaps/doc-import.image3"
+#include "bitmaps/doc-import-mod.image3"
+#include "bitmaps/doc-new.image3"
+#include "bitmaps/doc-save.image3"
+#include "bitmaps/doc-open.image3"
+#include "bitmaps/doc-setup.image3"
+#include "bitmaps/parameter.image3"
+#include "bitmaps/map.image3"
+#include "bitmaps/magnet.image3"
//static wMenu_p toolbarM;
static addButtonCallBack_t paramFilesCallback;
EXPORT void CreateMenus(void)
{
- wMenu_p fileM, editM, viewM, optionM, windowM, macroM, helpM, toolbarM,
+ wMenu_p fileM, editM, viewM, optionM, windowM, macroM, helpM,
manageM, addM, changeM, drawM;
wMenu_p zoomM, zoomSubM;
@@ -1018,11 +954,11 @@ EXPORT void CreateMenus(void)
wMenuSeparatorCreate(fileM);
cmdGroup = BG_FILE;
- AddToolbarButton("menuFile-clear", wIconCreatePixMap(doc_new_xpm3[iconSize]),
+ AddToolbarButton("menuFile-clear", wIconCreatePixMap(doc_new_image3[iconSize]),
IC_MODETRAIN_TOO, DoClear, NULL);
- AddToolbarButton("menuFile-load", wIconCreatePixMap(doc_open_xpm3[iconSize]),
+ AddToolbarButton("menuFile-load", wIconCreatePixMap(doc_open_image3[iconSize]),
IC_MODETRAIN_TOO, ChkLoad, NULL);
- AddToolbarButton("menuFile-save", wIconCreatePixMap(doc_save_xpm3[iconSize]),
+ AddToolbarButton("menuFile-save", wIconCreatePixMap(doc_save_image3[iconSize]),
IC_MODETRAIN_TOO, DoSave, NULL);
cmdGroup = BG_PRINT;
@@ -1030,15 +966,16 @@ EXPORT void CreateMenus(void)
ACCL_PRINTSETUP, (wMenuCallBack_p) wPrintSetup, 0,
I2VP(0));
InitCmdPrint(fileM);
- AddToolbarButton("menuFile-setup", wIconCreatePixMap(doc_setup_xpm3[iconSize]),
+ AddToolbarButton("menuFile-setup",
+ wIconCreatePixMap(doc_setup_image3[iconSize]),
IC_MODETRAIN_TOO, (wMenuCallBack_p) wPrintSetup, I2VP(0));
wMenuSeparatorCreate(fileM);
MiscMenuItemCreate(fileM, NULL, "cmdImport", _("&Import"), ACCL_IMPORT,
- DoImport, 0, I2VP(0));
+ DoImportObjects, 0, I2VP(0));
MiscMenuItemCreate(fileM, NULL, "cmdImportModule", _("Import &Module"),
ACCL_IMPORT_MOD,
- DoImport, 0, I2VP(1));
+ DoImportModule, 0, I2VP(1));
MiscMenuItemCreate(fileM, NULL, "cmdOutputbitmap", _("Export to &Bitmap"),
ACCL_PRINTBM, OutputBitMapInit(), 0,
NULL);
@@ -1069,28 +1006,28 @@ EXPORT void CreateMenus(void)
InitCmdExport();
AddToolbarButton("menuFile-parameter",
- wIconCreatePixMap(parameter_xpm3[iconSize]),
+ wIconCreatePixMap(parameter_image3[iconSize]),
IC_MODETRAIN_TOO, paramFilesCallback, NULL);
cmdGroup = BG_ZOOM;
zoomUpB = AddToolbarButton("cmdZoomIn",
- wIconCreatePixMap(zoom_in_xpm3[iconSize]),
+ wIconCreatePixMap(zoom_in_image3[iconSize]),
IC_MODETRAIN_TOO, DoZoomUp, NULL);
zoomM = wMenuPopupCreate(mainW, "");
- AddToolbarButton("cmdZoom", wIconCreatePixMap(zoom_choose_xpm3[iconSize]),
+ AddToolbarButton("cmdZoom", wIconCreatePixMap(zoom_choose_image3[iconSize]),
IC_MODETRAIN_TOO,
(wButtonCallBack_p) wMenuPopupShow, zoomM);
zoomDownB = AddToolbarButton("cmdZoomOut",
- wIconCreatePixMap(zoom_out_xpm3[iconSize]),
+ wIconCreatePixMap(zoom_out_image3[iconSize]),
IC_MODETRAIN_TOO, DoZoomDown, NULL);
zoomExtentsB = AddToolbarButton("cmdZoomExtent",
- wIconCreatePixMap(zoom_extent_xpm3[iconSize]),
+ wIconCreatePixMap(zoom_extent_image3[iconSize]),
IC_MODETRAIN_TOO, DoZoomExtents, NULL);
cmdGroup = BG_UNDO;
- undoB = AddToolbarButton("cmdUndo", wIconCreatePixMap(undo_xpm3[iconSize]), 0,
+ undoB = AddToolbarButton("cmdUndo", wIconCreatePixMap(undo_image3[iconSize]), 0,
UndoUndo, NULL);
- redoB = AddToolbarButton("cmdRedo", wIconCreatePixMap(redo_xpm3[iconSize]), 0,
+ redoB = AddToolbarButton("cmdRedo", wIconCreatePixMap(redo_image3[iconSize]), 0,
UndoRedo, NULL);
wControlActive((wControl_p) undoB, FALSE);
@@ -1211,8 +1148,9 @@ EXPORT void CreateMenus(void)
wMenuSeparatorCreate(viewM);
- toolbarM = wMenuMenuCreate(viewM, "toolbarM", _("&Tool Bar"));
- CreateToolbarM(toolbarM);
+ InitToolbar();
+ MiscMenuItemCreate(viewM, NULL, "cmdToolbarOpt", _("&Toolbar Options..."),
+ 0L, DoToolbar, IC_MODETRAIN_TOO, NULL);
cmdGroup = BG_EASE;
InitCmdEasement();
@@ -1220,12 +1158,13 @@ EXPORT void CreateMenus(void)
cmdGroup = BG_SNAP;
InitSnapGridButtons();
magnetsB = AddToolbarButton("cmdMagneticSnap",
- wIconCreatePixMap(magnet_xpm3[iconSize]),
+ wIconCreatePixMap(magnet_image3[iconSize]),
IC_MODETRAIN_TOO, MagneticSnapToggle, NULL);
wControlLinkedSet((wControl_p) magnetsMI, (wControl_p) magnetsB);
wButtonSetBusy(magnetsB, (wBool_t) magneticSnap);
- mapShowB = AddToolbarButton("cmdMapShow", wIconCreatePixMap(map_xpm3[iconSize]),
+ mapShowB = AddToolbarButton("cmdMapShow",
+ wIconCreatePixMap(map_image3[iconSize]),
IC_MODETRAIN_TOO, MapWindowToggleShow, NULL);
wControlLinkedSet((wControl_p) mapShowMI, (wControl_p) mapShowB);
wButtonSetBusy(mapShowB, (wBool_t) mapVisible);
@@ -1234,7 +1173,7 @@ EXPORT void CreateMenus(void)
* ADD MENU
*/
- cmdGroup = BG_TRKCRT | BG_BIGGAP;
+ cmdGroup = BG_TRKCRT;
InitCmdStraight(addM);
InitCmdCurve(addM);
InitCmdParallel(addM);
@@ -1393,7 +1332,7 @@ EXPORT void CreateMenus(void)
* MANAGE MENU
*/
- cmdGroup = BG_TRAIN | BG_BIGGAP;
+ cmdGroup = BG_TRAIN;
InitCmdTrain(manageM);
wMenuSeparatorCreate(manageM);
@@ -1432,13 +1371,13 @@ EXPORT void CreateMenus(void)
MiscMenuItemCreate(manageM, NULL, "cmdPricelist", _("Price List..."),
ACCL_PRICELIST, PriceListInit(), 0, NULL);
- cmdGroup = BG_LAYER | BG_BIGGAP;
+ cmdGroup = BG_LAYER;
InitCmdSelect2(changeM);
InitCmdDescribe2(changeM);
InitCmdPan2(changeM);
- InitLayers();
+ InitLayers(BG_LAYER);
cmdGroup = BG_HOTBAR;
InitHotBar();
@@ -1461,25 +1400,25 @@ static void InitCmdExport(void)
ButtonGroupBegin( _("Import/Export"), "cmdExportImportSetCmd",
_("Import/Export") );
cmdGroup = BG_EXPORTIMPORT;
- AddToolbarButton("cmdExport", wIconCreatePixMap(doc_export_xpm3[iconSize]),
+ AddToolbarButton("cmdExport", wIconCreatePixMap(doc_export_image3[iconSize]),
IC_SELECTED | IC_ACCLKEY, DoExport, NULL);
AddToolbarButton("cmdExportDXF",
- wIconCreatePixMap(doc_export_dxf_xpm3[iconSize]),
+ wIconCreatePixMap(doc_export_dxf_image3[iconSize]),
IC_SELECTED | IC_ACCLKEY, DoExportDXF, I2VP(1));
AddToolbarButton("cmdExportBmap",
- wIconCreatePixMap(doc_export_bmap_xpm3[iconSize]), IC_ACCLKEY,
+ wIconCreatePixMap(doc_export_bmap_image3[iconSize]), IC_ACCLKEY,
OutputBitMapInit(), NULL);
#if XTRKCAD_CREATE_SVG
AddToolbarButton("cmdExportSVG",
- wIconCreatePixMap(doc_export_svg_xpm3[iconSize]),
+ wIconCreatePixMap(doc_export_svg_image3[iconSize]),
IC_ACCLKEY, DoExportSVG, NULL); // IC_SELECTED |
#endif
- AddToolbarButton("cmdImport", wIconCreatePixMap(doc_import_xpm3[iconSize]),
+ AddToolbarButton("cmdImport", wIconCreatePixMap(doc_import_image3[iconSize]),
IC_ACCLKEY,
- DoImport, I2VP(0));
+ DoImportObjects, I2VP(0));
AddToolbarButton("cmdImportModule",
- wIconCreatePixMap(doc_import_mod_xpm3[iconSize]), IC_ACCLKEY,
- DoImport, I2VP(1));
+ wIconCreatePixMap(doc_import_mod_image3[iconSize]), IC_ACCLKEY,
+ DoImportModule, I2VP(1));
ButtonGroupEnd();
ParamRegister( &menuPG );
AddPlaybackProc( "MENU", MenuPlayback, NULL );
diff --git a/app/bin/misc.c b/app/bin/misc.c
index 901b684..fa1dee9 100644
--- a/app/bin/misc.c
+++ b/app/bin/misc.c
@@ -33,6 +33,7 @@
#include "include/paramfilelist.h"
#include "paths.h"
#include "smalldlg.h"
+#include "include/toolbar.h"
#include "track.h"
#include "common-ui.h"
@@ -748,11 +749,11 @@ EXPORT void MapWindowShow(int state)
wPrefSetInteger("misc", "mapVisible", mapVisible);
wMenuToggleSet(mapShowMI, mapVisible);
+ wWinShow(mapW, mapVisible | DONTGRABFOCUS);
if (mapVisible) {
DoChangeNotification(CHANGE_MAP);
}
- wWinShow(mapW, mapVisible);
wButtonSetBusy(mapShowB, (wBool_t) mapVisible);
}
@@ -959,13 +960,6 @@ static void SetAccelKeys()
}
-//EXPORT void InitCmdEnumerate(void) {
-// AddToolbarButton("cmdEnumerate", wIconCreatePixMap(partlist_xpm),
-// IC_SELECTED | IC_ACCLKEY, EnumerateTracks,
-// NULL);
-//}
-
-
/****************************************************************************
*
@@ -1009,6 +1003,13 @@ static int OfferCheckpoint( void )
return (ret>=0);
}
+void
+InitAudio()
+{
+ wPrefGetInteger("misc", "audio", &enableAudio, true);
+ wSetAudio(enableAudio);
+}
+
EXPORT wWin_p wMain(int argc, char * argv[])
{
int c;
@@ -1019,8 +1020,8 @@ EXPORT wWin_p wMain(int argc, char * argv[])
char * initialFile = NULL;
const char * pref;
coOrd roomSize;
- long oldToolbarMax;
- long newToolbarMax;
+ /* long oldToolbarMax;
+ long newToolbarMax; */
char *cp;
char buffer[STR_SIZE];
unsigned int i;
@@ -1133,12 +1134,15 @@ EXPORT wWin_p wMain(int argc, char * argv[])
displayHeight, -1, -1, -1);
InitAppDefaults();
- newToolbarMax = (1 << BG_COUNT) - 1;
- wPrefGetInteger("misc", "toolbarset", &toolbarSet, newToolbarMax);
- wPrefGetInteger("misc", "max-toolbarset", &oldToolbarMax, 0);
- toolbarSet |= newToolbarMax & ~oldToolbarMax;
- wPrefSetInteger("misc", "max-toolbarset", newToolbarMax);
- wPrefSetInteger("misc", "toolbarset", toolbarSet);
+ InitAudio();
+
+ ToolbarLoadConfig();
+ /* newToolbarMax = (1 << BG_COUNT) - 1;
+ wPrefGetInteger("misc", "toolbarset", &toolbarSet, newToolbarMax);
+ wPrefGetInteger("misc", "max-toolbarset", &oldToolbarMax, 0);
+ toolbarSet |= newToolbarMax & ~oldToolbarMax;
+ wPrefSetInteger("misc", "max-toolbarset", newToolbarMax);
+ wPrefSetInteger("misc", "toolbarset", toolbarSet); */
LOG1(log_init, ( "fontInit\n"))
@@ -1199,7 +1203,7 @@ EXPORT wWin_p wMain(int argc, char * argv[])
/*
* TIDY UP
*/
- if (toolbarSet&(1<<BG_HOTBAR)) {
+ if (ToolbarIsGroupVisible(BG_HOTBAR)) {
LayoutHotBar( NULL );
} else {
LayoutHotBar( NULL ); /* Must run once to set it up */
@@ -1207,6 +1211,7 @@ EXPORT wWin_p wMain(int argc, char * argv[])
}
LOG1(log_init, ( "drawInit\n" ))
DrawInit(initialZoom);
+ MainProc( mainW, wResize_e, NULL, NULL );
MacroInit();
@@ -1261,7 +1266,7 @@ EXPORT wWin_p wMain(int argc, char * argv[])
DoChangeNotification( CHANGE_MAIN | CHANGE_MAP);
wWinShow(mainW, TRUE);
- wWinShow(mapW, mapVisible);
+ wWinShow(mapW, mapVisible | DONTGRABFOCUS);
wDestroySplash();
/* this has to be called before ShowTip() */
diff --git a/app/bin/misc.h b/app/bin/misc.h
index 641f47f..bdb92fe 100644
--- a/app/bin/misc.h
+++ b/app/bin/misc.h
@@ -137,6 +137,14 @@ addButtonCallBack_t PriceListInit( void );
addButtonCallBack_t ParamFilesInit( void );
addButtonCallBack_t ControlMgrInit ( void );
+/* cdraw.h */
+track_p NewText( wIndex_t index, coOrd p, ANGLE_T angle, char * text,
+ CSIZE_T textSize, wDrawColor color, BOOL_T boxed );
+void LoadFontSizeList( wList_p, long );
+void UpdateFontSizeList( long *, wList_p, wIndex_t );
+long GetFontSize(wIndex_t);
+long GetFontSizeIndex(long size);
+
/* cnote.c */
void ClearNote( void );
void DoNote( void * unused );
@@ -226,6 +234,7 @@ void EnumerateEnd(void);
/* doption.c */
extern long enableBalloonHelp;
+extern long enableAudio;
long GetDistanceFormat( void );
/* cblock.c */
diff --git a/app/bin/param.c b/app/bin/param.c
index b6ad8c3..ed8469c 100644
--- a/app/bin/param.c
+++ b/app/bin/param.c
@@ -21,26 +21,29 @@
*/
#include "common.h"
-#include "compound.h"
-#include "custom.h"
+#include "messages.h"
#include "fileio.h"
-#include "misc.h"
#include "param.h"
-#include "track.h"
-#include "common-ui.h"
-
-/* Bogus reg vars */
-EXPORT int paramLevel = 1;
-EXPORT int paramLen;
-EXPORT unsigned long paramKey;
-EXPORT char paramId[100];
+
+#include "include/toolbar.h"
+#include "include/stringxtc.h"
+
+static void SimulateButtonClick(wButton_p p);
+
+// Processing an input file, objects may be incomplete so avoid some ops (MapRedraw)
+static bool bInReadTracks;
+
EXPORT BOOL_T paramTogglePlaybackHilite;
+static bool paramPlayback;
+static long paramDelay;
+static bool disablePlaybackDelays;
EXPORT char *PREFSECT = "DialogItem";
EXPORT long angleSystem = 0;
static int paramCheckErrorCount = 0;
static BOOL_T paramCheckShowErrors = FALSE;
+static FILE* recordParamF;
static int log_paramLayout = 0;
static int log_paraminput = 0;
@@ -51,7 +54,6 @@ EXPORT wWinPix_t DlgSepTop = 12;
EXPORT wWinPix_t DlgSepBottom = 12;
static wWinPix_t DlgSepMid = 18;
static wWinPix_t DlgSepNarrow = 6;
-static wWinPix_t DlgSepWide = 12;
static wWinPix_t DlgSepFrmLeft = 4;
static wWinPix_t DlgSepFrmRight = 4;
static wWinPix_t DlgSepFrmTop = 4;
@@ -271,42 +273,14 @@ static BOOL_T GetDistance(char ** cpp, FLOAT_T * distP)
}
-EXPORT FLOAT_T DecodeFloat(
- wString_p strCtrl,
- BOOL_T * validP )
-{
- FLOAT_T valF;
- const char *cp1;
-// const char *cp0;
- char *cp2;
-// cp0 = cp1 = wStringGetValue( strCtrl );
- cp1 = wStringGetValue( strCtrl );
- while (isspace((unsigned char)*cp1)) { cp1++; }
- if ( *cp1 ) {
- valF = strtod( cp1, &cp2 );
- if ( *cp2 != 0 ) {
- /*wStringSetHilight( strCtrl, cp2-cp0, -1 );*/
- snprintf( decodeErrorStr, sizeof(decodeErrorStr), _("Invalid Number") );
- *validP = FALSE;
- return 0.0;
- }
- *validP = TRUE;
- return valF;
- } else {
- *validP = TRUE;
- return 0.0;
- }
-}
-
-
-FLOAT_T DecodeDistance(
- wString_p strCtrl,
+static FLOAT_T DecodeDistance(
+ paramData_p pd,
BOOL_T * validP)
{
- FLOAT_T valF;
+ FLOAT_T valF = 0.0;
char *cp1, *cpN, c1;
// CAST_AWAY_CONST: we temporarily replace *cpN with a NULL and later restore
- cp1 = cpN = CAST_AWAY_CONST wStringGetValue(strCtrl);
+ cp1 = cpN = CAST_AWAY_CONST wStringGetValue((wString_p)pd->control);
cpN += strlen(cpN)-1;
while (cpN > cp1 && isspace((unsigned char)*cpN)) {
@@ -342,7 +316,7 @@ FLOAT_T DecodeDistance(
}
if (cpN) {
- wStringSetValue(strCtrl, FormatDistance(valF));
+ wStringSetValue((wString_p)pd->control, FormatDistance(valF));
}
} else {
snprintf(decodeErrorStr, sizeof(decodeErrorStr), "%s @ %s", _(getNumberError),
@@ -353,6 +327,46 @@ FLOAT_T DecodeDistance(
return valF;
}
+static FLOAT_T DecodeNumber(
+ paramData_p pd,
+ BOOL_T * validP )
+{
+ FLOAT_T valF;
+ const char *cp1;
+ char *cp2;
+ *validP = TRUE;
+ cp1 = wStringGetValue( (wString_p)pd->control );
+ while (isspace((unsigned char)*cp1)) { cp1++; }
+ if ( *cp1 == '\0' ) {
+ return 0.0;
+ }
+ BOOL_T bDistance = TRUE;
+ if ( ( pd->option & PDO_DIM ) == 0 ) {
+ bDistance = FALSE;
+ } else {
+ if ( pd->winLabel &&
+ strcmp( pd->winLabel, N_("Line Width") ) == 0 &&
+ *cp1 == '-' ) {
+ bDistance = FALSE;
+ }
+ }
+ if ( ! bDistance ) {
+ valF = strtod( cp1, &cp2 );
+ if ( *cp2 != 0 ) {
+ /*wStringSetHilight( strCtrl, cp2-cp0, -1 );*/
+ snprintf( decodeErrorStr, sizeof(decodeErrorStr), _("Invalid Number") );
+ *validP = FALSE;
+ return 0.0;
+ }
+ if ( pd->option & PDO_ANGLE) {
+ valF = NormalizeAngle( (angleSystem==ANGLE_POLAR)?valF:-valF );
+ }
+ return valF;
+ }
+ valF = DecodeDistance( pd, validP );
+ return valF;
+}
+
#define N_STRING (10)
static int formatStringInx; //Index ahead in case of overwrite
@@ -387,7 +401,7 @@ static void FormatFraction(
int digits,
BOOL_T rational,
FLOAT_T valF,
- char * unitFmt )
+ const char * unitFmt )
{
char * cp = *cpp;
long integ;
@@ -496,6 +510,36 @@ EXPORT char * FormatSmallDistance(
format |= 3;
return FormatDistanceEx( valF, format );
}
+
+
+static char * FormatNumber( paramData_t* pd, FLOAT_T valF )
+{
+ BOOL_T bDistance = TRUE;
+ if ( ( pd->option & PDO_DIM ) == 0 ) {
+ bDistance = FALSE;
+ } else {
+ // Line Width: <=0 is zoom indep pixel, >0 zoom dep dist
+ if ( pd->winLabel &&
+ strcmp( pd->winLabel, N_("Line Width") ) == 0 &&
+ valF <= 0 ) {
+ bDistance = FALSE;
+ }
+ }
+ if ( bDistance ) {
+ if (pd->option&PDO_SMALLDIM) {
+ return FormatSmallDistance( valF );
+ } else {
+ return FormatDistance( valF );
+ }
+ } else {
+ if (pd->option&PDO_ANGLE) {
+ valF = NormalizeAngle( (angleSystem==ANGLE_POLAR)?valF:-valF );
+ }
+ return FormatFloat( valF );
+ }
+}
+
+
/*****************************************************************************
*
@@ -579,18 +623,7 @@ EXPORT void ParamLoadControl(
break;
case PD_FLOAT:
tmpR = *(FLOAT_T*)p->valueP;
- if (p->option&PDO_DIM) {
- if (p->option&PDO_SMALLDIM) {
- valS = FormatSmallDistance( tmpR );
- } else {
- valS = FormatDistance( tmpR );
- }
- } else {
- if (p->option&PDO_ANGLE) {
- tmpR = NormalizeAngle( (angleSystem==ANGLE_POLAR)?tmpR:-tmpR );
- }
- valS = FormatFloat( tmpR );
- }
+ valS = FormatNumber( p, tmpR );
wStringSetValue( (wString_p)p->control, valS );
if ( !ParamFloatRangeCheck( p, tmpR ) ) {
break;
@@ -744,14 +777,7 @@ EXPORT long ParamUpdate(
}
break;
case PD_FLOAT:
- if (p->option & PDO_DIM) {
- floatV = DecodeDistance( (wString_p)p->control, &valid );
- } else {
- floatV = DecodeFloat( (wString_p)p->control, &valid );
- if (valid && (p->option & PDO_ANGLE) ) {
- floatV = NormalizeAngle( (angleSystem==ANGLE_POLAR)?floatV:-floatV );
- }
- }
+ floatV = DecodeNumber( p, &valid );
if ( !valid ) {
break;
}
@@ -806,11 +832,7 @@ EXPORT long ParamUpdate(
break;
}
}
-#ifdef PGPROC
- if (pg->proc) {
- pg->proc( PGACT_UPDATE, change );
- }
-#endif
+
return change;
}
@@ -871,15 +893,7 @@ void ParamLoadData(
break;
case PD_FLOAT:
- if (p->option & PDO_DIM) {
- floatV = DecodeDistance((wString_p)p->control, &valid);
- } else {
- floatV = DecodeFloat((wString_p)p->control, &valid);
-
- if (valid && (p->option & PDO_ANGLE)) {
- floatV = NormalizeAngle((angleSystem==ANGLE_POLAR)?floatV:-floatV);
- }
- }
+ floatV = DecodeNumber( p, &valid );
if (p->winData) {
inRange = (floatV <= ((paramFloatRange_t *)p->winData)->high) &&
@@ -991,18 +1005,7 @@ static long ParamIntRestore(
*(FLOAT_T*)p->valueP = oldP->f;
if (p->control) {
valR = oldP->f;
- if (p->option & PDO_DIM) {
- if (p->option & PDO_SMALLDIM) {
- valS = FormatSmallDistance( valR );
- } else {
- valS = FormatDistance( valR );
- }
- } else {
- if (p->option & PDO_ANGLE) {
- valR = NormalizeAngle( (angleSystem==ANGLE_POLAR)?valR:-valR );
- }
- valS = FormatFloat( valR );
- }
+ valS = FormatNumber( p, valR );
wStringSetValue( (wString_p)p->control, valS );
}
change |= (1L<<inx);
@@ -1028,11 +1031,7 @@ static long ParamIntRestore(
break;
}
}
-#ifdef PGPROC
- if (pg->proc) {
- pg->proc( PGACT_RESTORE, change );
- }
-#endif
+
return change;
}
@@ -1083,18 +1082,6 @@ static void ParamIntSave(
}
}
-#ifdef LATER
-static void ParamSave( paramGroup_p pg )
-{
- ParamIntSave( pg, 0 );
-}
-
-static long ParamRestore( paramGroup_p pg )
-{
- return ParamIntRestore( pg, 0 );
-}
-#endif
-
/****************************************************************************
*
*
@@ -1333,7 +1320,7 @@ EXPORT void ParamGroupRecord(
paramData_p p;
long rgb;
- if (recordF == NULL) {
+ if (recordParamF == NULL) {
return;
}
for ( p=pg->paramPtr; p<&pg->paramPtr[pg->paramCnt]; p++ ) {
@@ -1348,7 +1335,7 @@ EXPORT void ParamGroupRecord(
case PD_LONG:
case PD_RADIO:
case PD_TOGGLE:
- fprintf( recordF, "PARAMETER %s %s %ld\n", pg->nameStr, p->nameStr,
+ fprintf( recordParamF, "PARAMETER %s %s %ld\n", pg->nameStr, p->nameStr,
*(long*)p->valueP );
break;
case PD_LIST:
@@ -1359,20 +1346,20 @@ EXPORT void ParamGroupRecord(
} else {
message[0] = '\0';
}
- fprintf( recordF, "PARAMETER %s %s %d %s\n", pg->nameStr, p->nameStr,
+ fprintf( recordParamF, "PARAMETER %s %s %d %s\n", pg->nameStr, p->nameStr,
*(wIndex_t*)p->valueP, message );
break;
case PD_COLORLIST:
rgb = wDrawGetRGB( *(wDrawColor*)p->valueP );
- fprintf( recordF, "PARAMETER %s %s %ld\n",
+ fprintf( recordParamF, "PARAMETER %s %s %ld\n",
pg->nameStr, p->nameStr, rgb );
break;
case PD_FLOAT:
- fprintf( recordF, "PARAMETER %s %s %0.3f\n", pg->nameStr, p->nameStr,
+ fprintf( recordParamF, "PARAMETER %s %s %0.3f\n", pg->nameStr, p->nameStr,
*(FLOAT_T*)p->valueP );
break;
case PD_STRING:
- fprintf( recordF, "PARAMETER %s %s %s\n", pg->nameStr, p->nameStr,
+ fprintf( recordParamF, "PARAMETER %s %s %s\n", pg->nameStr, p->nameStr,
(char*)p->valueP );
break;
case PD_MESSAGE:
@@ -1386,18 +1373,24 @@ EXPORT void ParamGroupRecord(
}
}
if (pg->nameStr) {
- fprintf( recordF, "PARAMETER GROUP %s\n", pg->nameStr );
+ fprintf( recordParamF, "PARAMETER GROUP %s\n", pg->nameStr );
}
- fflush( recordF );
+ fflush( recordParamF );
}
+/**
+ * Start recording parameter activities to a macro file.
+ *
+ * \param macroFile handle of the opened macro file
+ */
-EXPORT void ParamStartRecord( void )
+EXPORT void ParamStartRecord( FILE *macroFile )
{
int inx;
paramGroup_p pg;
- if (recordF == NULL) {
+ recordParamF = macroFile;
+ if (recordParamF == NULL) {
return;
}
for ( inx=0; inx<paramGroups_da.cnt; inx++ ) {
@@ -1439,9 +1432,10 @@ EXPORT void ParamSaveAll( void )
static void ParamButtonPush( void * dp )
{
paramData_p p = (paramData_p)dp;
- if (recordF && (p->option&PDO_NORECORD)==0 && p->group->nameStr && p->nameStr) {
- fprintf( recordF, "PARAMETER %s %s\n", p->group->nameStr, p->nameStr );
- fflush( recordF );
+ if (recordParamF && (p->option&PDO_NORECORD)==0 && p->group->nameStr
+ && p->nameStr) {
+ fprintf( recordParamF, "PARAMETER %s %s\n", p->group->nameStr, p->nameStr );
+ fflush( recordParamF );
}
if ( (p->option&PDO_NOPSHACT)==0 ) {
if ( p->valueP ) {
@@ -1457,10 +1451,11 @@ static void ParamChoicePush( long valL, void * dp )
{
paramData_p p = (paramData_p)dp;
- if (recordF && (p->option&PDO_NORECORD)==0 && p->group->nameStr && p->nameStr) {
- fprintf( recordF, "PARAMETER %s %s %ld\n", p->group->nameStr, p->nameStr,
+ if (recordParamF && (p->option&PDO_NORECORD)==0 && p->group->nameStr
+ && p->nameStr) {
+ fprintf( recordParamF, "PARAMETER %s %s %ld\n", p->group->nameStr, p->nameStr,
valL );
- fflush( recordF );
+ fflush( recordParamF );
}
if ( (p->option&PDO_NOPSHUPD)==0 && p->valueP) {
*((long*)(p->valueP)) = valL;
@@ -1473,11 +1468,11 @@ static void ParamChoicePush( long valL, void * dp )
static wBool_t ParamIntegerRangeCheck( paramData_p p, long valL )
{
- if ( inPlayback ) {
+ if ( paramPlayback ) {
return TRUE;
}
paramIntegerRange_t * irangeP = (paramIntegerRange_t*)p->winData;
-// wBool_t bInvalid = p->bInvalid;
+
if ( ( (irangeP->rangechecks&PDO_NORANGECHECK_HIGH) == 0
&& valL > irangeP->high ) ||
( (irangeP->rangechecks&PDO_NORANGECHECK_LOW) == 0 && valL < irangeP->low ) ) {
@@ -1510,7 +1505,6 @@ static void ParamIntegerPush( const char * val, void * dp )
char * cp;
const char * value;
-// wBool_t bInvalid = p->bInvalid;
if (strlen(val) == 1 && val[strlen(val)-1] == '\n') {
value = wStringGetValue((wString_p)p->control);
p->enter_pressed = TRUE;
@@ -1537,10 +1531,11 @@ static void ParamIntegerPush( const char * val, void * dp )
wControlSetBalloon( p->control, 0, 0, NULL );
p->bInvalid = FALSE;
- if (recordF && (p->option&PDO_NORECORD)==0 && p->group->nameStr && p->nameStr) {
- fprintf( recordF, "PARAMETER %s %s %ld\n", p->group->nameStr, p->nameStr,
+ if (recordParamF && (p->option&PDO_NORECORD)==0 && p->group->nameStr
+ && p->nameStr) {
+ fprintf( recordParamF, "PARAMETER %s %s %ld\n", p->group->nameStr, p->nameStr,
valL );
- fflush( recordF );
+ fflush( recordParamF );
}
if ( (p->option&PDO_NOPSHUPD)==0 && p->valueP) {
*((long*)(p->valueP)) = valL;
@@ -1555,7 +1550,7 @@ static void ParamIntegerPush( const char * val, void * dp )
static wBool_t ParamFloatRangeCheck( paramData_p p, FLOAT_T valF )
{
- if ( inPlayback ) {
+ if ( paramPlayback ) {
return TRUE;
}
paramFloatRange_t * frangeP = (paramFloatRange_t*)p->winData;
@@ -1602,7 +1597,6 @@ static void ParamFloatPush( const char * val, void * dp )
BOOL_T valid;
const char * value;
-// wBool_t bInvalid = p->bInvalid;
if (strlen(val) == 1 && val[strlen(val)-1] == '\n') {
value = wStringGetValue((wString_p)p->control);
p->enter_pressed = TRUE;
@@ -1613,14 +1607,7 @@ static void ParamFloatPush( const char * val, void * dp )
LOG( log_paraminput, 1, ( "ParamFloatPush( %s: Enter:%d Val:%s )\n", p->nameStr,
p->enter_pressed, value ) );
- if (p->option & PDO_DIM) {
- valF = DecodeDistance( (wString_p)p->control, &valid );
- } else {
- valF = DecodeFloat( (wString_p)p->control, &valid );
- if (p->option & PDO_ANGLE) {
- valF = NormalizeAngle( (angleSystem==ANGLE_POLAR)?valF:-valF );
- }
- }
+ valF = DecodeNumber( p, &valid );
if ( !valid ) {
wWinPix_t h = wControlGetHeight(p->control);
wControlSetBalloon( p->control, 0, -h*3/4, decodeErrorStr );
@@ -1634,10 +1621,11 @@ static void ParamFloatPush( const char * val, void * dp )
wControlSetBalloon( p->control, 0, 0, NULL );
p->bInvalid = FALSE;
- if (recordF && (p->option&PDO_NORECORD)==0 && p->group->nameStr && p->nameStr) {
- fprintf( recordF, "PARAMETER %s %s %0.6f\n", p->group->nameStr, p->nameStr,
+ if (recordParamF && (p->option&PDO_NORECORD)==0 && p->group->nameStr
+ && p->nameStr) {
+ fprintf( recordParamF, "PARAMETER %s %s %0.6f\n", p->group->nameStr, p->nameStr,
valF );
- fflush( recordF );
+ fflush( recordParamF );
}
if ( (p->option&PDO_NOPSHUPD)==0 && p->valueP) {
*((FLOAT_T*)(p->valueP)) = valF;
@@ -1654,9 +1642,11 @@ static void ParamStringPush( const char * val, void * dp )
paramData_p p = (paramData_p)dp;
const char * value;
// wBool_t bInvalid = p->bInvalid;
- if (recordF && (p->option&PDO_NORECORD)==0 && p->group->nameStr && p->nameStr) {
- fprintf( recordF, "PARAMETER %s %s %s\n", p->group->nameStr, p->nameStr, val );
- fflush( recordF );
+ if (recordParamF && (p->option&PDO_NORECORD)==0 && p->group->nameStr
+ && p->nameStr) {
+ fprintf( recordParamF, "PARAMETER %s %s %s\n", p->group->nameStr, p->nameStr,
+ val );
+ fflush( recordParamF );
}
if (strlen(val) == 1 && val[strlen(val)-1] == '\n' ) {
value = wStringGetValue((wString_p)p->control);
@@ -1667,7 +1657,7 @@ static void ParamStringPush( const char * val, void * dp )
}
LOG( log_paraminput, 1, ( "ParamStringPush( %s: Enter:%d Val:%s )\n",
p->nameStr, p->enter_pressed, value ) );
- if ( ((!inPlayback) && p->option & PDO_NOTBLANK) && value[0] == '\0' ) {
+ if ( ((!paramPlayback) && p->option & PDO_NOTBLANK) && value[0] == '\0' ) {
p->bInvalid = TRUE;
wControlSetBalloon( p->control, 0, 0, NULL );
wWinPix_t h = wControlGetHeight(p->control);
@@ -1710,10 +1700,12 @@ static void ParamListPush( wIndex_t inx, const char * val, wIndex_t op,
case PD_LIST:
case PD_DROPLIST:
case PD_COMBOLIST:
- if (recordF && (p->option&PDO_NORECORD)==0 && p->group->nameStr && p->nameStr) {
- fprintf( recordF, "PARAMETER %s %s %d %s\n", p->group->nameStr, p->nameStr, inx,
+ if (recordParamF && (p->option&PDO_NORECORD)==0 && p->group->nameStr
+ && p->nameStr) {
+ fprintf( recordParamF, "PARAMETER %s %s %d %s\n", p->group->nameStr, p->nameStr,
+ inx,
val );
- fflush( recordF );
+ fflush( recordParamF );
}
if ( (p->option&PDO_NOPSHUPD)==0 && p->valueP) {
*(wIndex_t*)(p->valueP) = inx;
@@ -1734,9 +1726,9 @@ EXPORT void ParamMenuPush( void * dp )
{
paramData_p p = (paramData_p)dp;
const char * groupNameStr = p->group ? p->group->nameStr : "misc";
- if (recordF && (p->option&PDO_NORECORD)==0 && groupNameStr && p->nameStr) {
- fprintf( recordF, "PARAMETER %s %s\n", groupNameStr, p->nameStr );
- fflush( recordF );
+ if (recordParamF && (p->option&PDO_NORECORD)==0 && groupNameStr && p->nameStr) {
+ fprintf( recordParamF, "PARAMETER %s %s\n", groupNameStr, p->nameStr );
+ fflush( recordParamF );
}
if ( (p->option&PDO_NOPSHACT)==0 && p->valueP ) {
((wMenuCallBack_p)(p->valueP))( p->context );
@@ -1758,10 +1750,11 @@ static void ParamColorSelectPush( void * dp, wDrawColor dc )
}
dc = wDrawFindColor( rgb );
}
- if (recordF && (p->option&PDO_NORECORD)==0 && p->group->nameStr && p->nameStr) {
- fprintf( recordF, "PARAMETER %s %s %ld\n", p->group->nameStr, p->nameStr,
+ if (recordParamF && (p->option&PDO_NORECORD)==0 && p->group->nameStr
+ && p->nameStr) {
+ fprintf( recordParamF, "PARAMETER %s %s %ld\n", p->group->nameStr, p->nameStr,
wDrawGetRGB(dc) );
- fflush( recordF );
+ fflush( recordParamF );
}
if ( (p->option&PDO_NOPSHUPD)==0 && p->valueP) {
*(wDrawColor*)(p->valueP) = dc;
@@ -1789,11 +1782,11 @@ static void ParamDrawAction( wDraw_p d, void * dp, wAction_t a, wDrawPix_t w,
paramDrawData_t * ddp = (paramDrawData_t*)p->winData;
coOrd pos;
ddp->d->Pix2CoOrd( ddp->d, w, h, &pos );
- if ( recordF && (p->option&PDO_NORECORD)==0 && p->group->nameStr
+ if ( recordParamF && (p->option&PDO_NORECORD)==0 && p->group->nameStr
&& p->nameStr) {
- fprintf( recordF, "PARAMETER %s %s %d %0.3f %0.3f\n", p->group->nameStr,
+ fprintf( recordParamF, "PARAMETER %s %s %d %0.3f %0.3f\n", p->group->nameStr,
p->nameStr, a, pos.x, pos.y );
- fflush( recordF );
+ fflush( recordParamF );
}
if ( (p->option&PDO_NOPSHACT)== 0 && ddp->action ) {
ddp->action( a, pos );
@@ -1839,9 +1832,9 @@ static void ParamButtonOk( void * groupVP )
if ( ! ParamCheckInputs( group, (wControl_p)group->okB ) ) {
return;
}
- if ( recordF && group->nameStr ) {
- fprintf( recordF, "PARAMETER %s %s\n", group->nameStr, "ok" );
- fflush( recordF );
+ if ( recordParamF && group->nameStr ) {
+ fprintf( recordParamF, "PARAMETER %s %s\n", group->nameStr, "ok" );
+ fflush( recordParamF );
}
if ( group->okProc ) {
@@ -1854,120 +1847,58 @@ static void ParamButtonOk( void * groupVP )
LOG( log_paraminput, 1, ( "ParamButtonOk -> Ok\n" ) );
}
+/* No Cancel button required
+ */
+EXPORT void *ParamCancel_Null = NULL;
-static void ParamButtonCancel( void * groupVP )
+#ifdef PARAMCANCEL_NEWUNDO
+/* No Cancel button, Commnd can be undone
+ */
+EXPORT void *ParamCancel_Undo = NULL;
+#else
+EXPORT void ParamCancel_Undo(
+ wWin_p winP )
{
- paramGroup_p group = groupVP;
- if ( recordF && group->nameStr ) {
- fprintf( recordF, "PARAMETER %s %s\n", group->nameStr, "cancel" );
- fflush( recordF );
- }
- if ( group->cancelProc ) {
- group->cancelProc( group->win );
- }
+ wHide( winP );
}
+#endif
+/* Cancel button, exits commands leaving control values as current
+ */
+EXPORT void ParamCancel_Current(
+ wWin_p winP )
+{
+ wHide( winP );
+}
-#ifdef LATER
-EXPORT void ParamChange( paramData_p p )
+/* As above, but always exit command
+ */
+EXPORT void ParamCancel_Reset(
+ wWin_p winP )
{
- FLOAT_T tmpR;
+ ResetIfNotSticky();
+ wHide( winP );
+}
- if (p->valueP==NULL) {
- return;
- }
+/* Cancel button, exits commands restoring control values
+ */
+EXPORT void ParamCancel_Restore(
+ wWin_p winP )
+{
+ wHide( winP );
+}
- switch (p->type) {
- case PD_LONG:
- if (recordF && (p->option&PDO_NORECORD)==0 && p->group->nameStr && p->nameStr) {
- fprintf( recordF, "PARAMETER %s %s %ld\n", p->group->nameStr, p->nameStr,
- *(long*)p->valueP );
- }
-#ifdef LATER
- if ( p->control && (p->option&PDO_NOCONTUPD) == 0 ) {
- wStringSetValue( (wString_p)p->control, FormatLong( *(long*)p->valueP ) );
- }
-#endif
- break;
- case PD_RADIO:
- if (recordF && (p->option&PDO_NORECORD)==0 && p->group->nameStr && p->nameStr) {
- fprintf( recordF, "PARAMETER %s %s %ld\n", p->group->nameStr, p->nameStr,
- *(long*)p->valueP );
- }
-#ifdef LATER
- if ( p->control && (p->option&PDO_NOCONTUPD) == 0 ) {
- wRadioSetValue( (wChoice_p)p->control, *(long*)p->valueP );
- }
-#endif
- break;
- case PD_TOGGLE:
- if (recordF && (p->option&PDO_NORECORD)==0 && p->group->nameStr && p->nameStr) {
- fprintf( recordF, "PARAMETER %s %s %ld\n", p->group->nameStr, p->nameStr,
- *(long*)p->valueP );
- }
-#ifdef LATER
- if ( p->control && (p->option&PDO_NOCONTUPD) == 0 ) {
- wToggleSetValue( (wChoice_p)p->control, *(long*)p->valueP );
- }
-#endif
- break;
- case PD_LIST:
- case PD_DROPLIST:
- case PD_COMBOLIST:
- if (recordF && (p->option&PDO_NORECORD)==0 && p->group->nameStr && p->nameStr) {
- fprintf( recordF, "PARAMETER %s %s %d %s\n", p->group->nameStr, p->nameStr,
- *(wIndex_t*)p->valueP, "???" );
- }
-#ifdef LATER
- if ( p->control && (p->option&PDO_NOCONTUPD) == 0 ) {
- wListSetIndex( (wList_p)p->control, *(wIndex_t*)p->valueP );
- }
-#endif
- break;
- case PD_COLORLIST:
- if (recordF && (p->option&PDO_NORECORD)==0 && p->group->nameStr && p->nameStr) {
- fprintf( recordF, "PARAMETER %s %s %ld\n", p->group->nameStr, p->nameStr,
- rgb );
- }
- break;
- case PD_FLOAT:
- tmpR = *(FLOAT_T*)p->valueP;
- if (recordF && (p->option&PDO_NORECORD)==0 && p->group->nameStr && p->nameStr) {
- fprintf( recordF, "PARAMETER %s %s %0.6f\n", p->group->nameStr, p->nameStr,
- tmpR );
- }
-#ifdef LATER
- if ( p->control && (p->option&PDO_NOCONTUPD) == 0 ) {
- if (p->option&PDO_DIM)
-#endif
- if (p->option&PDO_ANGLE) {
- tmpR = NormalizeAngle( (angleSystem==ANGLE_POLAR)?tmpR:-tmpR );
- }
- wStringSetValue( (wString_p)p->control, tmpR );
- }
- break;
- case PD_STRING:
- if (recordF && (p->option&PDO_NORECORD)==0 && p->group->nameStr && p->nameStr) {
- fprintf( recordF, "PARAMETER %s %s %s\n", p->group->nameStr, p->nameStr,
- (char*)p->valueP );
- }
-#ifdef LATER
- if ( p->control && (p->option&PDO_NOCONTUPD) == 0 ) {
- wStringSetValue( (wString_p)p->control, (char*)p->valueP );
- }
-#endif
- break;
- case PD_MESSAGE:
- case PD_BUTTON:
- case PD_DRAW:
- case PD_TEXT:
- case PD_MENU:
- case PD_MENUITEM:
- break;
+static void ParamButtonCancel( void * groupVP )
+{
+ paramGroup_p group = groupVP;
+ if ( recordParamF && group->nameStr ) {
+ fprintf( recordParamF, "PARAMETER %s %s\n", group->nameStr, "cancel" );
+ fflush( recordParamF );
+ }
+ if ( group->cancelProc ) {
+ group->cancelProc( group->win );
}
}
-#endif
-
EXPORT void ParamHilite(
wWin_p win,
@@ -1979,8 +1910,8 @@ EXPORT void ParamHilite(
if ( hilite ) {
wControlHilite( control, TRUE );
wFlush();
- if ( inPlayback ) {
- wPause(playbackDelay*4+1);
+ if ( paramPlayback ) {
+ wPause(paramDelay*4+1);
}
} else {
wControlHilite( control, FALSE );
@@ -2015,6 +1946,28 @@ EXPORT void ParamControlShow( paramGroup_p pg, wIndex_t inx, wBool_t bShow )
p->bShown = bShow;
}
+/**
+ * .
+ *
+ * \param state
+ */
+void
+ParamSetInPlayback(bool state, long delay)
+{
+ paramPlayback = state;
+ paramDelay = delay;
+}
+
+void SimulateButtonClick(wButton_p control)
+{
+ if (!disablePlaybackDelays && control) {
+ wButtonSetBusy(control, TRUE);
+ wFlush();
+ wPause(500);
+ wButtonSetBusy(control, FALSE);
+ wFlush();
+ }
+}
static void ParamPlayback( char * line )
{
@@ -2034,17 +1987,7 @@ static void ParamPlayback( char * line )
char * valS;
if ( strncmp( line, "GROUP ", 6 ) == 0 ) {
-#ifdef PGPROC
- for ( inx=0; inx<paramGroups_da.cnt; inx++ ) {
- pg = paramGroups(inx);
- if ( pg->name && strncmp( line+6, pg->name, strlen( pg->name ) ) == 0 ) {
- if ( pg->proc ) {
- pg->proc( PGACT_PARAM, pg->action );
- }
- pg->action = 0;
- }
- }
-#endif
+
return;
}
@@ -2077,13 +2020,7 @@ static void ParamPlayback( char * line )
if (p->valueP) {
((wButtonCallBack_p)(p->valueP))( p->context );
}
- if (playbackTimer == 0 && p->control) {
- wButtonSetBusy( (wButton_p)p->control, TRUE );
- wFlush();
- wPause( 500 );
- wButtonSetBusy( (wButton_p)p->control, FALSE );
- wFlush();
- }
+ SimulateButtonClick((wButton_p)p->control);
break;
case PD_LONG:
valL = atol( line+len );
@@ -2184,18 +2121,7 @@ static void ParamPlayback( char * line )
if (p->valueP) {
*(FLOAT_T*)p->valueP = valF;
}
- if (p->option&PDO_DIM) {
- if ( p->option&PDO_SMALLDIM ) {
- valS = FormatSmallDistance( valF );
- } else {
- valS = FormatDistance( valF );
- }
- } else {
- if (p->option&PDO_ANGLE) {
- valF1 = NormalizeAngle( (angleSystem==ANGLE_POLAR)?valF1:-valF1 );
- }
- valS = FormatFloat( valF );
- }
+ valS = FormatNumber( p, valF );
if (p->control) {
wStringSetValue( (wString_p)p->control, valS );
wFlush();
@@ -2274,13 +2200,7 @@ static void ParamPlayback( char * line )
}
button = pg->cancelB;
}
- if ( playbackTimer == 0 && button ) {
- wButtonSetBusy( button, TRUE );
- wFlush();
- wPause( 500 );
- wButtonSetBusy( button, FALSE );
- wFlush();
- }
+ SimulateButtonClick(button);
ParamHilite( pg->win, (wControl_p)button, FALSE );
if ( !button ) {
NoticeMessage( "Unknown PARAM: %s", _("Ok"), NULL, line );
@@ -2966,6 +2886,25 @@ SkipControl:
group->nameStr, group->origW, group->origH, windowK.term.x, windowK.term.y ) );
}
+/**
+ * Inform about file operation in progress. While files are read, some
+ * operations in the params library must be disabled
+ *
+ * \param state TRUE if file operation starts, FALSE when done
+ */
+
+EXPORT void
+ParamSetInReadTracks(bool state)
+{
+ bInReadTracks = state;
+}
+
+EXPORT void
+ParamTurnOffDelays(bool disable)
+{
+ disablePlaybackDelays = disable;
+}
+
static void ParamDlgProc(
wWin_p win,
@@ -3021,7 +2960,7 @@ wWin_p ParamCreateDialog(
long winOption,
paramChangeProc changeProc )
{
- char helpStr[STR_SHORT_SIZE];
+ char helpStr[STR_SHORT_SIZE] = "";
wWinPix_t w0, h0;
char * cancelLabel = (winOption&PD_F_ALT_CANCELLABEL?_("Close"):_("Cancel"));
diff --git a/app/bin/param.h b/app/bin/param.h
index 004dcb5..3705161 100644
--- a/app/bin/param.h
+++ b/app/bin/param.h
@@ -227,8 +227,6 @@ extern long angleSystem;
#define DISTFMT_FRACT_NUM 0x0000
#define DISTFMT_FRACT_FRC 0x0400
-FLOAT_T DecodeFloat( wString_p, BOOL_T * );
-FLOAT_T DecodeDistance( wString_p, BOOL_T * );
char * FormatLong( long );
char * FormatFloat( FLOAT_T );
char * FormatDistance( FLOAT_T );
@@ -245,9 +243,14 @@ long ParamUpdate( paramGroup_p );
void ParamRegister( paramGroup_p );
void ParamGroupRecord( paramGroup_p );
void ParamUpdatePrefs( void );
-void ParamStartRecord( void );
+void ParamStartRecord( FILE *recordF );
void ParamRestoreAll( void );
void ParamSaveAll( void );
+void ParamSetInReadTracks(bool state);
+void ParamSetInPlayback(bool state, long delay);
+void ParamTurnOffDelays(bool disable);
+
+
void ParamMenuPush( void * );
void ParamHilite( wWin_p, wControl_p, BOOL_T );
@@ -269,6 +272,41 @@ long GetChanges(paramGroup_p pg);
if ( HS ) GetBalloonHelpStr(HS);
#define PD_F_ALT_CANCELLABEL (1L<<30) /**<use Close or Cancel for the discard button */
+
+// How dialogs handle Cancel:
+//
+// Remove Cancel button from dialogs that affect on-layout objects
+#define PARAMCANCEL_NEWUNDO
+
+// Cancel button not needed: map, demo, print margin,
+extern void *ParamCancel_Null;
+
+// These affect objects on the layout
+// No Cancel button, use Undo to revert: describe, profile, move, rotate
+// undefine PARAMCANCEL_NEWUNDO to re-enable Cancel button
+#ifdef PARAMCANCEL_NEWUNDO
+extern void *ParamCancel_Undo;
+#else
+void ParamCancel_Undo( wWin_p );
+#endif
+
+// Cancel leaves values in current state
+// Most dialogs
+void ParamCancel_Current( wWin_p );
+
+// As above and exits command regardless of Sticky
+// print, snap, *noteui
+void ParamCancel_Reset( wWin_p );
+
+// Cancel restores values to previous state
+// Done/Ok propagates changed values. Cancel just closes dialog
+void ParamCancel_Restore( wWin_p );
+
+// Pending
+// Dialogs which haven't been converted yet: work in progress
+// signalEdit, carDlg, layout, paramfilesearch_ui
+#define ParamCancel_Custom( PROC ) PROC
+
wWin_p ParamCreateDialog( paramGroup_p, char *, char *, paramActionOkProc,
paramActionCancelProc, BOOL_T, paramLayoutProc, long, paramChangeProc );
void ParamCreateControls( paramGroup_p, paramChangeProc );
diff --git a/app/bin/paramfile.c b/app/bin/paramfile.c
index 994a47d..c6cc5f4 100644
--- a/app/bin/paramfile.c
+++ b/app/bin/paramfile.c
@@ -30,6 +30,7 @@
#include "include/paramfile.h"
#include "include/paramfilelist.h"
#include "include/utf8convert.h"
+#include "include/stringxtc.h"
#include "common-ui.h"
static long paramCheckSum;
diff --git a/app/bin/paramfilelist.c b/app/bin/paramfilelist.c
index f6703f3..c43e2bd 100644
--- a/app/bin/paramfilelist.c
+++ b/app/bin/paramfilelist.c
@@ -31,6 +31,7 @@
#include "paths.h"
#include "include/paramfile.h"
#include "include/paramfilelist.h"
+#include "include/stringxtc.h"
#include "common-ui.h"
@@ -157,7 +158,7 @@ static BOOL_T UpdateParamFiles(void)
LOG1( log_paramupdate, ( " Old CONTENTS %s\n", oldContents ) );
// Check 'Parameter Files Names' map
for (int fileNo = 1; ; fileNo++) {
- char fileNoS[4+9+1];
+ char fileNoS[4+10+1];
sprintf(fileNoS, "File%d", fileNo);
char * prevContents = wPrefGetString("Parameter File Names", fileNoS);
if (prevContents == NULL || *prevContents == '\0') {
diff --git a/app/bin/paramfilesearch_ui.c b/app/bin/paramfilesearch_ui.c
index 5050f22..a04b82f 100644
--- a/app/bin/paramfilesearch_ui.c
+++ b/app/bin/paramfilesearch_ui.c
@@ -133,7 +133,7 @@ int SearchFileListLoad(Catalog *catalog)
char * type_copy = MyStrdup(catalogEntry->tag);
char * cp = type_copy;
char * type = strtok(cp, " \t");
- SCALE_FIT_TYPE_T fit_type;
+ SCALE_FIT_TYPE_T fit_type = FIT_STRUCTURE;
if (strcmp(type,TURNOUTCOMMAND) == 0) {
fit_type = FIT_TURNOUT;
} else if (strcmp(type,STRUCTURECOMMAND)==0) {
@@ -414,13 +414,6 @@ static void SearchUiDlgUpdate(
}
}
-void
-SearchUiCancel(wWin_p window)
-{
- ClearCurrentCatalog();
- wHide(window);
-}
-
/**
* Get the system default directory for parameter files. First step is to
* check the configuration file for a user specific setting. If that is not
@@ -445,8 +438,8 @@ GetParamsPath()
return (params_path);
}
-#include "bitmaps/funnel.xpm"
-#include "bitmaps/funnelclear.xpm"
+#include "bitmaps/funnel.image1"
+#include "bitmaps/funnelclear.image1"
/**
* Create and open the search dialog.
@@ -463,9 +456,9 @@ void DoSearchParams(void * junk)
trackLibrary = CreateLibrary(paramsDir);
free(paramsDir);
- searchUiPLs[I_SEARCHBUTTON].winLabel = (char *)wIconCreatePixMap(funnel_xpm);
+ searchUiPLs[I_SEARCHBUTTON].winLabel = (char *)wIconCreatePixMap(funnel_image1);
searchUiPLs[I_CLEARBUTTON].winLabel = (char *)wIconCreatePixMap(
- funnelclear_xpm);
+ funnelclear_image1);
searchFitMode = FIT_COMPATIBLE; //Default to "Any" after startup
@@ -474,7 +467,8 @@ void DoSearchParams(void * junk)
searchUiW = ParamCreateDialog(&searchUiPG,
- MakeWindowTitle(_("Choose parameter files")), _("Done"), NULL, SearchUiCancel,
+ MakeWindowTitle(_("Choose parameter files")), _("Done"), NULL,
+ ParamCancel_Current,
TRUE, NULL, F_RESIZE | F_RECALLSIZE, SearchUiDlgUpdate);
diff --git a/app/bin/problemrep.c b/app/bin/problemrep.c
index 6e23984..c508be4 100644
--- a/app/bin/problemrep.c
+++ b/app/bin/problemrep.c
@@ -48,6 +48,7 @@
#include "include/paramfilelist.h"
#include "paths.h"
#include "version.h"
+#include "cundo.h"
static void SaveSystemInfo(char* dir);
static void ZipProblemData(const char* src);
@@ -489,7 +490,9 @@ PickupLayoutFile(char* dir)
char* lineptr = NULL;
size_t linelen = 0;
while (!feof(fhRead)) {
- getline(&lineptr, &linelen, fhRead);
+ if ( getline(&lineptr, &linelen, fhRead) == -1 ) {
+ break;
+ };
if (!feof(fhRead)) {
FilterLayoutLine(fhWrite, lineptr);
}
@@ -530,6 +533,31 @@ PickupCustomFile(char* dest)
}
/**
+ * Get the undo log file.
+ *
+ * \param dest temporary directory
+ * \return true on success
+ */
+
+static bool
+PickupUndoLog(char* dest)
+{
+ char* outFile;
+
+ MakeFullpath(&outFile, dest, "command.log", NULL);
+ FILE * fDump = fopen( outFile, "w" );
+ if ( fDump == NULL ) {
+ ProblemrepUpdateW(_("Get command log file FAILed: %s\n"), outFile);
+ free(outFile);
+ return false;
+ }
+ ProblemrepUpdateW(_("Get command log file %s\n"), outFile);
+ Rdump(fDump);
+ free(outFile);
+ return(true);
+}
+
+/**
* Create a zip file from the collected information. The zip file is created
* in the same directory as the layout design. A unique name is generated from
* the current date and time.
@@ -617,6 +645,8 @@ ProblemDataCollect()
free(subdirectory);
subdirectory = NULL;
+ PickupUndoLog(tempDirectory);
+
if (ret) {
ZipProblemData(tempDirectory);
diff --git a/app/bin/problemrepui.c b/app/bin/problemrepui.c
index 22610e3..4588baf 100644
--- a/app/bin/problemrepui.c
+++ b/app/bin/problemrepui.c
@@ -54,7 +54,7 @@ void ProblemrepCreateW(void* ptr)
problemrepW = ParamCreateDialog(&problemrepPG,
MakeWindowTitle(_("Data for Problem Report")),
- NULL, NULL, wHide, TRUE, NULL,
+ NULL, NULL, ParamCancel_Current, TRUE, NULL,
F_TOP | F_CENTER | PD_F_ALT_CANCELLABEL, NULL);
} else {
wTextClear(PROBLEMREP_T);
@@ -107,3 +107,4 @@ ProblemSaveLayout(void)
}
return(rc);
}
+
diff --git a/app/bin/scale.c b/app/bin/scale.c
index bfc4edd..932a40f 100644
--- a/app/bin/scale.c
+++ b/app/bin/scale.c
@@ -1082,7 +1082,7 @@ EXPORT void DoRescale( void * unused )
{
if ( rescalePG.win == NULL ) {
ParamCreateDialog( &rescalePG, MakeWindowTitle(_("Rescale")), _("Ok"),
- RescaleDlgOk, wHide, TRUE, NULL, F_BLOCK, RescaleDlgUpdate );
+ RescaleDlgOk, ParamCancel_Current, TRUE, NULL, F_BLOCK, RescaleDlgUpdate );
LoadScaleList( (wList_p)rescalePLs[I_RESCALE_TO_SCALE].control );
LoadGaugeList( (wList_p)rescalePLs[I_RESCALE_TO_GAUGE].control,
GetLayoutCurScaleDesc() ); /* set correct gauge list here */
diff --git a/app/bin/shortentext.c b/app/bin/shortentext.c
index 9994915..163b162 100644
--- a/app/bin/shortentext.c
+++ b/app/bin/shortentext.c
@@ -1,5 +1,6 @@
-/** \file stringutils.c
+/** \file shortentext.c
* Some assorted string handling functions
+ * \todo Merge with stringxtc.c
*/
/* XTrackCAD - Model Railroad CAD
diff --git a/app/bin/smalldlg.c b/app/bin/smalldlg.c
index 1dde15e..8a333cf 100644
--- a/app/bin/smalldlg.c
+++ b/app/bin/smalldlg.c
@@ -70,7 +70,9 @@ static void CreateTipW( void )
char * cp;
tipW = ParamCreateDialog( &tipPG, MakeWindowTitle(_("Tip of the Day")), NULL,
- NULL, wHide, FALSE, NULL, F_RESIZE|F_CENTER|PD_F_ALT_CANCELLABEL, NULL );
+ NULL, ParamCancel_Current, FALSE, NULL,
+ F_RESIZE|F_CENTER|PD_F_ALT_CANCELLABEL,
+ NULL );
/* open the tip file */
MakeFullpath(&filename, libDir, sTipF, NULL);
@@ -180,7 +182,7 @@ void ShowTip( void * flagsVP )
/*--------------------------------------------------------------------*/
-#include "bitmaps/xtc.xpm"
+#include "bitmaps/xtc.image1"
static paramTextData_t aboutTextData = { 70, 10 };
@@ -205,10 +207,10 @@ void CreateAboutW(void *ptr)
// char *copyright = sAboutProd;
if (!aboutW) {
- aboutPLs[I_ABOUTDRAW].winData = wIconCreatePixMap(xtc_xpm);
+ aboutPLs[I_ABOUTDRAW].winData = wIconCreatePixMap(xtc_image1);
ParamRegister(&aboutPG);
aboutW = ParamCreateDialog(&aboutPG, MakeWindowTitle(_("About")), NULL, NULL,
- wHide, FALSE, NULL, F_TOP | F_CENTER| PD_F_ALT_CANCELLABEL, NULL);
+ ParamCancel_Current, FALSE, NULL, F_TOP | F_CENTER| PD_F_ALT_CANCELLABEL, NULL);
ParamLoadMessage(&aboutPG, I_ABOUTVERSION, sAboutProd);
wTextAppend(COPYRIGHT_T, DESCRIPTION);
wTextAppend(COPYRIGHT_T,
diff --git a/app/bin/stringxtc.c b/app/bin/stringxtc.c
index e65a97d..28eb9b4 100644
--- a/app/bin/stringxtc.c
+++ b/app/bin/stringxtc.c
@@ -143,3 +143,28 @@ XtcStricmp(const char *a, const char *b)
return ca - cb;
}
+
+/**
+ * Strip single trailing CR/LF characters from string. Multiple occurences
+ * will be ignored.
+ *
+ * \param line string to be checked. CR/LF are removed in place
+ */
+
+void Stripcr(char* line)
+{
+ char* cp;
+ cp = line + strlen(line);
+ if (cp == line) {
+ return;
+ }
+ cp--;
+ if (*cp == '\n') {
+ *cp-- = '\0';
+ }
+ if (cp >= line && *cp == '\r') {
+ *cp = '\0';
+ }
+}
+
+
diff --git a/app/bin/svgoutput.c b/app/bin/svgoutput.c
index e4ff66b..0074a43 100644
--- a/app/bin/svgoutput.c
+++ b/app/bin/svgoutput.c
@@ -331,7 +331,7 @@ static drawCmd_t svgD = {
/**
* Creates valid identifier from a string. Whitespaces are removed
- * and characters are prepended to make sure the i starts with
+ * and characters are prepended to make sure the id starts with
* valid chars.
* https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/id
*
@@ -346,7 +346,7 @@ CreateValidId(char *base)
const char *idHead = "id";
char *out = MyMalloc(strlen(idHead) + strlen(base) + 1);
char *tmp;
- int j;
+ size_t j;
strcpy(out, idHead);
j = strlen(out);
@@ -428,7 +428,6 @@ static int DoExportSVGTracks(
char ** fileName,
void * data)
{
- DynString command = NaS;
SVGDocument *svg;
SVGParent *svgData;
BOOL_T all = (selectedTrackCount == 0);
diff --git a/app/bin/tbezier.c b/app/bin/tbezier.c
index c5cff99..1fc95b1 100644
--- a/app/bin/tbezier.c
+++ b/app/bin/tbezier.c
@@ -1227,7 +1227,7 @@ BOOL_T GetTracksFromBezierSegment(trkSeg_p bezSeg, track_p newTracks[2],
if (bezSeg->type != SEG_BEZTRK) { return FALSE; }
for (int i=0; i<bezSeg->bezSegs.cnt; i++) {
trkSeg_p seg = &DYNARR_N(trkSeg_t,bezSeg->bezSegs,i);
- track_p new_trk;
+ track_p new_trk = NULL;
if (seg->type == SEG_CRVTRK) {
new_trk = NewCurvedTrack(seg->u.c.center,fabs(seg->u.c.radius),seg->u.c.a0,
seg->u.c.a1,0);
@@ -1846,12 +1846,14 @@ static DIST_T BezierMathDistance( coOrd * pos, coOrd p[4], int segments,
return dd;
}
+#ifdef LATER
static coOrd BezierMathFindNearestPoint(coOrd *pos, coOrd p[4], int segments)
{
double t = 0.0;
BezierMathDistance(pos, p, segments, &t);
return BezierPointByParameter(p, t);
}
+#endif
void BezierSlice(coOrd input[], coOrd output[], double t)
{
@@ -1937,6 +1939,7 @@ double BezierAddLengthIfClose(coOrd start[4], double error)
}
+#ifdef LATER
/**
* Use recursive splitting to get close approximation ot length of bezier
*
@@ -1947,6 +1950,7 @@ static double BezierMathLength(coOrd p[4], double error)
return BezierAddLengthIfClose(p, error); /* kick off recursion */
}
+#endif
coOrd BezierFirstDerivative(coOrd p[4], double t)
{
@@ -1988,6 +1992,7 @@ coOrd BezierSecondDerivative(coOrd p[4], double t)
return v;
}
+#ifdef LATER
/**
* Get curvature of a Bezier at a point
*/
@@ -2032,4 +2037,4 @@ static double BezierMathMinRadius(coOrd p[4])
if (curv >= 1000.0 || curv <= 0.001 ) { return 0.0; }
return 1/curv;
}
-
+#endif
diff --git a/app/bin/tcornu.c b/app/bin/tcornu.c
index 3e4b772..9669163 100644
--- a/app/bin/tcornu.c
+++ b/app/bin/tcornu.c
@@ -1105,7 +1105,7 @@ BOOL_T GetBezierSegmentsFromCornu(track_p trk, dynArr_t * segs, BOOL_T track)
segPtr->type = track?SEG_STRTRK:SEG_STRLIN;
segPtr->color = wDrawColorBlack;
segPtr->lineWidth = 0;
- for (int j=0; j<2; j++) { segPtr->u.l.pos[i] = p->u.l.pos[i]; }
+ for (int j=0; j<2; j++) { segPtr->u.l.pos[j] = p->u.l.pos[j]; }
segPtr->u.l.angle = p->u.l.angle;
segPtr->u.l.option = 0;
} else if (p->type == SEG_CRVTRK) {
diff --git a/app/bin/tcurve.c b/app/bin/tcurve.c
index 65b6bcc..5c56dd3 100644
--- a/app/bin/tcurve.c
+++ b/app/bin/tcurve.c
@@ -441,12 +441,14 @@ static void UpdateCurve( track_p trk, int inx, descData_p descUpd,
crvData.radius = xx0.radius;
crvDesc[RA].mode |= DESC_CHANGE;
} else {
- if ( crvData.pivot == DESC_PIVOT_FIRST || GetTrkEndTrk(trk,0) ) {
- Translate( &xx0.pos, xx0.pos, a0, xx0.radius-crvData.radius );
- } else if ( crvData.pivot == DESC_PIVOT_SECOND || GetTrkEndTrk(trk,1) ) {
- Translate( &xx0.pos, xx0.pos, a0+a1, xx0.radius-crvData.radius );
- } else {
- Translate( &xx0.pos, xx0.pos, a0+a1/2.0, xx0.radius-crvData.radius );
+ if ( xx0.helixTurns==0 && xx0.circle==FALSE ) {
+ if ( crvData.pivot == DESC_PIVOT_FIRST || GetTrkEndTrk(trk,0) ) {
+ Translate( &xx0.pos, xx0.pos, a0, xx0.radius-crvData.radius );
+ } else if ( crvData.pivot == DESC_PIVOT_SECOND || GetTrkEndTrk(trk,1) ) {
+ Translate( &xx0.pos, xx0.pos, a0+a1, xx0.radius-crvData.radius );
+ } else {
+ Translate( &xx0.pos, xx0.pos, a0+a1/2.0, xx0.radius-crvData.radius );
+ }
}
crvDesc[CE].mode |= DESC_CHANGE;
xx0.radius = crvData.radius;
@@ -748,9 +750,6 @@ static void DrawCurvedTies(
return;
}
- if (color == wDrawColorBlack) {
- color = tieColor;
- }
len = 2*M_PI*r*a1/360.0;
cnt = (int)floor(len/td.spacing + 0.5);
if ( len - td.spacing*cnt - (td.width/2) > (td.spacing - td.width)/2 ) {
@@ -829,9 +828,15 @@ EXPORT void DrawCurvedTrack(
if (color == wDrawColorBlack) {
color = normalColor;
}
+ int iDrawCenter = centerDrawMode;
+ if ( options & DTS_NOCENTER ) {
+ iDrawCenter = FALSE;
+ }
+ if ( d == &mapD ) {
+ iDrawCenter = FALSE;
+ }
if ( ! DrawTwoRails( d, 1 ) ) {
- DrawArc( d, p, r, a0, a1, (centerDrawMode
- && !(options&DTS_NOCENTER)) ? 1 : 0, width, color );
+ DrawArc( d, p, r, a0, a1, iDrawCenter, width, color );
} else {
if ( hasTrackCenterline(d)) {
long options = d->options;
@@ -840,8 +845,7 @@ EXPORT void DrawCurvedTrack(
d->options = options;
}
DrawArc( d, p, r+trackGauge/2.0, a0, a1, 0, width, color );
- DrawArc( d, p, r-trackGauge/2.0, a0, a1, (centerDrawMode
- && !(options&DTS_NOCENTER) ? 1: 0), width, color );
+ DrawArc( d, p, r-trackGauge/2.0, a0, a1, iDrawCenter, width, color );
if ( (d->options&DC_PRINT) && roadbedWidth > trackGauge
&& DrawTwoRails( d, 1 ) ) {
wDrawWidth rbw = (wDrawWidth)floor(roadbedLineWidth*(d->dpi/d->scale)+0.5);
diff --git a/app/bin/tease.c b/app/bin/tease.c
index 806ab22..44427c8 100644
--- a/app/bin/tease.c
+++ b/app/bin/tease.c
@@ -924,9 +924,6 @@ EXPORT void DrawJointTrack(
return;
}
LOG( log_ease, 4, ( "DJT( (X%0.3f Y%0.3f A%0.3f) \n", pos.x, pos.y, angle ) )
- if (color == wDrawColorBlack) {
- color = normalColor;
- }
if (!Scurve) {
/* print segments about 0.20" long */
len = (l0-l1)/(0.20*d->scale);
diff --git a/app/bin/textnoteui.c b/app/bin/textnoteui.c
index 40390bf..8dc15bf 100644
--- a/app/bin/textnoteui.c
+++ b/app/bin/textnoteui.c
@@ -27,6 +27,7 @@
#include "param.h"
#include "shortentext.h"
#include "track.h"
+#include "cundo.h"
struct {
coOrd pos;
@@ -76,16 +77,6 @@ TextDlgUpdate(
}
}
-/**
-* Handle Cancel button: restore old values for layer and position
-*/
-
-static void
-TextEditCancel( wWin_p junk )
-{
- ResetIfNotSticky();
- wHide(textNoteW);
-}
/**
* Handle OK button: make sure the entered URL is syntactically valid, update
@@ -101,13 +92,19 @@ TextEditOK(void *junk)
if ( trk == NULL ) {
// new note
trk = NewNote( -1, textNoteData.pos, OP_NOTETEXT );
+ } else {
+ if ( ! descUndoStarted ) {
+ UndoStart( _("Update Text Note"), "Update Text Note" );
+ descUndoStarted = TRUE;
+ }
+ UndoModify( trk );
}
struct extraDataNote_t * xx = GET_EXTRA_DATA( trk, T_NOTE, extraDataNote_t );
xx->pos = textNoteData.pos;
SetTrkLayer( trk, textNoteData.layer );
int len = wTextGetSize(textEntry);
- MyFree( xx->noteData.text );
+ UndoDeferFree( xx->noteData.text );
xx->noteData.text = (char*)MyMalloc(len + 2);
wTextGetText(textEntry, xx->noteData.text, len);
@@ -135,7 +132,7 @@ CreateEditTextNote(char *title, char * textData )
textNoteW = ParamCreateDialog(&textNotePG,
"",
_("Done"), TextEditOK,
- TextEditCancel, TRUE, NULL,
+ ParamCancel_Current, TRUE, NULL,
F_BLOCK,
TextDlgUpdate);
}
@@ -147,6 +144,7 @@ CreateEditTextNote(char *title, char * textData )
wTextSetReadonly(textEntry, FALSE);
FillLayerList((wList_p)textNotePLs[I_LAYER].control);
ParamLoadControls(&textNotePG);
+ descTitle = title;
// and show the dialog
wShow(textNoteW);
diff --git a/app/bin/toolbar.c b/app/bin/toolbar.c
new file mode 100644
index 0000000..57c3659
--- /dev/null
+++ b/app/bin/toolbar.c
@@ -0,0 +1,613 @@
+/*****************************************************************//**
+ * \file toolbar.c
+ * \brief Toolbar specific functions and data
+ *********************************************************************/
+
+/* XTrackCad - Model Railroad CAD
+ * Copyright (C) 2005,2023 Dave Bullis, Martin Fischer
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "common.h"
+#include "custom.h"
+#include "fileio.h"
+#include "param.h"
+#include "track.h"
+#include "include/toolbar.h"
+
+EXPORT void ToolbarLayout(void* unused);
+
+struct sToolbarState {
+ int previousGroup; // control variable for change control ops
+ int layerButton; // number of layer controls shown
+ wWinPix_t nextX; // drawing position for next control
+ wWinPix_t rowHeight; // height of row
+};
+
+// local function prototypes
+static void InitializeToolbarDialog(void);
+static void ToolbarChange(long changes);
+static void ToolbarOk(void* unused);
+static void ToolbarButtonPlace(struct sToolbarState* tbState, wIndex_t inx);
+static void SaveToolbarConfig(void);
+
+// toolbar properties
+static long toolbarSet;
+static wWinPix_t toolbarHeight = 0;
+
+#define TOOLBARSET_INIT (0xFFFF)
+#define TOOLBAR_SECTION "misc"
+#define TOOLBAR_VARIABLE "toolbarset"
+
+#define GROUP_DISTANCE (5) // default distance between button groups
+#define GROUP_BIG_DISTANCE (GROUP_DISTANCE * 3) // big gap
+#define TOOLBAR_MARGIN (20) // left and right margins of toolbar
+#define FIXEDLAYERCONTROLS (2) // the layer groups has two controls that are
+// always visible (list and background)
+
+/*
+* Bit handling macros
+* these macros do not change the passed values but return the result.
+* so if you want to change the value it has to be assigned eg.
+* bits = SETBIT(bits, 2);
+* in order to set bit 2 of the variable "bits"
+*
+*/
+#define GETBIT(value, bitpos ) ((value) & (1UL << (bitpos)))
+#define ISBITSET(value, bitpos ) (((value)&(1UL <<bitpos))!=0)
+#define CLEARBIT(value, bitpos ) ((value) & ~(1UL <<(bitpos)))
+#define SETBIT(value, bitpos) ((value) | (1UL <<(bitpos)))
+
+#define ISGROUPVISIBLE(group) ISBITSET(toolbarSet, group)
+
+// toolbar button list
+#define BUTTON_MAX (250)
+static struct {
+ wControl_p control;
+ wBool_t enabled;
+ wWinPix_t x, y;
+ long options;
+ int group;
+ wIndex_t cmdInx;
+} buttonList[BUTTON_MAX];
+EXPORT int buttonCnt = 0; // TODO-misc-refactor
+
+
+// control the order of the button groups inside the toolbar
+
+struct buttonGroups {
+ char* label; // display label
+ int group; // id of group
+ bool biggap; // control distance to previous group
+};
+
+static struct buttonGroups allToolbarGroups[] = {
+ {N_("File Buttons"), BG_FILE, false},
+ {N_("Print Buttons"), BG_PRINT, false},
+ {N_("Import/Export Buttons"), BG_EXPORTIMPORT, false},
+ {N_("Zoom Buttons"), BG_ZOOM, false},
+ {N_("Undo Buttons"), BG_UNDO, false},
+ {N_("Easement Button"), BG_EASE, false},
+ {N_("SnapGrid Buttons"), BG_SNAP, false},
+ {N_("Create Track Buttons"), BG_TRKCRT, true},
+ {N_("Layout Control Elements"), BG_CONTROL, true},
+ {N_("Modify Track Buttons"), BG_TRKMOD, false},
+ {N_("Properties/Select"), BG_SELECT, false},
+ {N_("Track Group Buttons"), BG_TRKGRP, false},
+ {N_("Train Group Buttons"), BG_TRAIN, true},
+ {N_("Create Misc Buttons"), BG_MISCCRT, false},
+ {N_("Ruler Button"), BG_RULER, false},
+ {N_("Layer Buttons"), BG_LAYER, true},
+ {N_("Hot Bar"), BG_HOTBAR},
+ {NULL, 0L}
+};
+
+#define COUNTTOOLBARGROUPS (BG_LAST)
+
+// toolbar options dialog
+static wWin_p toolbarW;
+static unsigned long toggleSet;
+
+// callbacks for button presses
+static void SelectAllGroups(void* unused);
+static void InvertSelection(void* unused);
+
+static paramData_t toolbarPLs[] = {
+ { PD_TOGGLE, &toggleSet, "toolbarset", 0, NULL},
+#define I_SELECTALL (1)
+ { PD_BUTTON, SelectAllGroups, "selectall", PDO_DLGBOXEND, NULL, N_("Select All") },
+#define I_INVERT (2)
+ { PD_BUTTON, InvertSelection, "invert", PDO_DLGHORZ, NULL, N_("Invert Selection")}
+};
+
+static paramGroup_t toolbarPG = { "toolbar", PGO_RECORD, toolbarPLs,
+ COUNT(toolbarPLs)
+ };
+
+/**
+ * Initialize the list of available options. The list of labels is created
+ * from the allToolbarGroups array. Memory allocated here
+ * is never freed as it might be used when opening the dialog
+ *
+ * \param unused
+ */
+
+static void
+InitializeToolbarDialog(void)
+{
+ char** labels = MyMalloc((COUNT(allToolbarGroups)) * sizeof(char*));
+
+ for (int i = 0; i < COUNT(allToolbarGroups); i++) {
+ labels[i] = allToolbarGroups[i].label;
+ }
+ toolbarPLs[0].winData = labels;
+
+ ParamRegister(&toolbarPG);
+}
+
+static void ToolbarChange(long changes)
+{
+ if ((changes & CHANGE_TOOLBAR)) {
+ MainProc(mainW, wResize_e, NULL, NULL);
+ }
+}
+
+/**
+ * Handle button press to select all groups. Set all bits to 1, unused bits
+ * will be ignored
+ *
+ * \param unused
+ */
+static void SelectAllGroups(void* unused)
+{
+ toggleSet = ~(0UL);
+
+ ParamLoadControls(&toolbarPG);
+}
+
+/**
+ * Handle button press to invert the current selection. Invert all bits by,
+ * XOR with 1s, unused bits will be ignored
+ *
+ * \param unused
+ */
+static void InvertSelection(void* unused)
+{
+ toggleSet ^= ~(0UL);
+
+ ParamLoadControls(&toolbarPG);
+}
+
+/**
+ * Handle the ok press. The bit pattern set up from the dialog is converted
+ * to the pattern used by the toolbar. Then the toolbar is refreshed.
+ *
+ * \param unused
+ */
+
+static void ToolbarOk(void* unused)
+{
+ toolbarSet = 0;
+
+ for (int i = 0; i < COUNTTOOLBARGROUPS; i++) {
+ if (toggleSet & (1UL << i)) {
+ toolbarSet = SETBIT(toolbarSet, allToolbarGroups[i].group);
+ }
+ }
+ SaveToolbarConfig();
+ ToolbarLayout(unused);
+ MainProc(mainW, wResize_e, NULL, NULL);
+ wHide(toolbarW);
+}
+
+/**
+ * When selected from the menu the toolbar config dialog is opened. First lazy
+ * initialization is done on first call. Then the toggle states are set from
+ * the toolbar configuration bit pattern and the dialog is shown.
+ *
+ * \param unused
+ */
+
+EXPORT void DoToolbar(void* unused)
+{
+ if (!toolbarW) {
+ InitializeToolbarDialog();
+ toolbarW = ParamCreateDialog(&toolbarPG,
+ MakeWindowTitle(_("Toolbar Options")), _("OK"), ToolbarOk, ParamCancel_Restore,
+ TRUE, NULL, 0, NULL);
+ }
+
+ toggleSet = 0;
+ for (int i = 0; i < COUNTTOOLBARGROUPS; i++) {
+ if (ISBITSET(toolbarSet, allToolbarGroups[i].group)) {
+ toggleSet = SETBIT(toggleSet, i);
+ }
+ }
+ ParamLoadControls(&toolbarPG);
+ wShow(toolbarW);
+}
+
+/**
+ * Check whether button group is configured to be visible.
+ *
+ * \param group single group to check
+ * \return true if visible
+ */
+
+EXPORT bool
+ToolbarIsGroupVisible(int group)
+{
+ CHECK(group > 0);
+ CHECK(group <= COUNTTOOLBARGROUPS);
+
+ return(ISGROUPVISIBLE(group));
+}
+
+/**
+ * Get the current height of the toolbar.
+ *
+ * \return
+ */
+
+EXPORT wWinPix_t
+ToolbarGetHeight(void)
+{
+ return(toolbarHeight);
+}
+
+/**
+ * .
+ */
+
+EXPORT void
+ToolbarSetHeight(wWinPix_t newHeight)
+{
+ toolbarHeight = newHeight;
+}
+
+/**
+ * Buttons are visible when the command is enabled or when additional
+ * layer buttons need to be shown.
+ *
+ * \param inx
+ */
+
+bool
+IsButtonVisible(int group, long mode, long options, long layerButtons)
+{
+ if (group == BG_LAYER) {
+ if (layerButtons < layerCount+FIXEDLAYERCONTROLS) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ return(IsCommandEnabled(mode, options));
+}
+
+/**
+ * Calculate the position and visibility of a button and display it.
+ *
+ * \param inx index into button list
+ */
+
+static void ToolbarButtonPlace(struct sToolbarState *tbState, wIndex_t inx)
+{
+ wWinPix_t w, h, offset;
+ wWinPix_t width;
+ wWinPix_t gap = GROUP_DISTANCE;
+ int currentGroup = buttonList[inx].group;
+
+ wWinGetSize(mainW, &width, &h);
+
+ if (buttonList[inx].control) {
+ if (tbState->rowHeight <= 0) {
+ tbState->rowHeight = wControlGetHeight(buttonList[inx].control);
+ toolbarHeight = tbState->rowHeight + 5;
+ }
+
+ if (currentGroup != tbState->previousGroup) {
+ for (int i = 0; i < COUNTTOOLBARGROUPS; i++) {
+ if (allToolbarGroups[i].group == currentGroup &&
+ allToolbarGroups[i].biggap) {
+ gap = GROUP_BIG_DISTANCE;
+ }
+ }
+ }
+
+ if ((ISGROUPVISIBLE(currentGroup)) &&
+ IsButtonVisible(currentGroup, programMode,
+ buttonList[inx].options, tbState->layerButton )) {
+ if (currentGroup != tbState->previousGroup) {
+ tbState->nextX += gap;
+ tbState->previousGroup = currentGroup;
+ }
+ w = wControlGetWidth(buttonList[inx].control);
+ h = wControlGetHeight(buttonList[inx].control);
+ if (h < tbState->rowHeight) {
+ offset = (h - tbState->rowHeight) / 2;
+ h = tbState->rowHeight; //Uniform
+ } else {
+ offset = 0;
+ }
+ if (inx < buttonCnt - 1 &&
+ (buttonList[inx + 1].options & IC_ABUT)) {
+ w += wControlGetWidth(buttonList[inx + 1].control);
+ }
+ if (tbState->nextX + w > width - TOOLBAR_MARGIN) {
+ tbState->nextX = 5;
+ toolbarHeight += h + 5;
+ }
+ if ((currentGroup == BG_LAYER) &&
+ tbState->layerButton >= FIXEDLAYERCONTROLS &&
+ GetLayerHidden(tbState->layerButton - FIXEDLAYERCONTROLS)) {
+ wControlShow(buttonList[inx].control, FALSE);
+ tbState->layerButton++;
+ } else {
+ wWinPix_t newX = tbState->nextX;
+ wWinPix_t newY = toolbarHeight - (h + 5 + offset);
+
+ // count number of shown layer buttons
+ if (currentGroup == BG_LAYER) {
+ tbState->layerButton++;
+ }
+ if ((newX != buttonList[inx].x) || (newY != buttonList[inx].y)) {
+ wControlShow(buttonList[inx].control, FALSE);
+
+ wControlSetPos(buttonList[inx].control, newX,
+ newY);
+ }
+ buttonList[inx].x = newX;
+ buttonList[inx].y = newY;
+ tbState->nextX += wControlGetWidth(buttonList[inx].control);
+ wControlShow(buttonList[inx].control, TRUE);
+ }
+ } else {
+ wControlShow(buttonList[inx].control, FALSE);
+ }
+ }
+}
+
+EXPORT void ToolbarLayout(void* data)
+{
+ int inx;
+ struct sToolbarState state = {
+ .previousGroup = 0,
+ .nextX = 0,
+ .layerButton = 0,
+ .rowHeight = 0,
+ };
+
+ for (inx = 0; inx < buttonCnt; inx++) {
+ ToolbarButtonPlace(&state, inx);
+ }
+
+ if (ISBITSET(toolbarSet, BG_HOTBAR)) {
+ LayoutHotBar(data);
+ } else {
+ HideHotBar();
+ }
+}
+
+/**
+ * Set the 'pressed' state of a toolbar button.
+ *
+ * \param button index into button list
+ * \param busy desired button state
+ */
+
+EXPORT void ToolbarButtonBusy(wIndex_t button, wBool_t busy)
+{
+ wButtonSetBusy((wButton_p)buttonList[button].control,
+ busy);
+}
+
+/**
+ * Set state of a toolbar button .
+ *
+ * \param button index into button list
+ * \param enable desired state, FALSE if disabled, TRUE if enabled
+ */
+
+EXPORT void ToolbarButtonEnable(wIndex_t button, wBool_t enable)
+{
+ wControlActive(buttonList[button].control,
+ enable);
+}
+
+/**
+ * Enable toolbar buttons that depend on selected track.
+ *
+ * \param selected true if any track is selected
+ */
+
+EXPORT void ToolbarButtonEnableIfSelect(bool selected)
+{
+ for (int inx = 0; inx < buttonCnt; inx++) {
+ if (buttonList[inx].cmdInx < 0
+ && (buttonList[inx].options & IC_SELECTED)) {
+ ToolbarButtonEnable(inx, selected );
+ }
+ }
+}
+
+/**
+ * Place a control onto the toolbar. The control is added to the toolbar
+ * control list and initially hidden. Placement and visibility is controlled
+ * by ToolbarButtonPlace()
+ *
+ * \param control the control to add
+ * \param options control options
+ */
+
+EXPORT void ToolbarControlAdd(wControl_p control, long options, int cmdGroup)
+{
+ CHECK(buttonCnt < BUTTON_MAX - 1);
+ buttonList[buttonCnt].enabled = TRUE;
+ buttonList[buttonCnt].options = options;
+ buttonList[buttonCnt].group = cmdGroup;
+ buttonList[buttonCnt].x = 0;
+ buttonList[buttonCnt].y = 0;
+ buttonList[buttonCnt].control = control;
+ buttonList[buttonCnt].cmdInx = -1;
+ wControlShow(control, FALSE);
+ buttonCnt++;
+}
+
+/**
+ * Link a command to a specific toolbar button.
+ *
+ * \param button the button
+ * \param command command to activate when button is pressed
+ * \return
+ */
+
+EXPORT void ToolbarButtonCommandLink(wIndex_t button, int command)
+{
+ if (button >= 0 && buttonList[button].cmdInx == -1) {
+ // set button back-link
+ buttonList[button].cmdInx = commandCnt;
+ }
+}
+
+/**
+ * Update the toolbar button for selected command eg. circle vs. filled
+ * circle.
+ *
+ * \param button toolbar button
+ * \param command current command
+ * \param icon new icon
+ * \param helpKey new help key
+ * \param context new command context
+ */
+
+EXPORT void ToolbarUpdateButton(wIndex_t button, wIndex_t command,
+ char * icon,
+ const char * helpKey,
+ void * context)
+{
+ if (buttonList[button].cmdInx != command) {
+ wButtonSetLabel((wButton_p) buttonList[button].control,icon);
+ wControlSetHelp(buttonList[button].control,
+ GetBalloonHelpStr(helpKey));
+ wControlSetContext(buttonList[button].control,
+ context);
+ buttonList[button].cmdInx = command;
+ }
+}
+
+/*--------------------------------------------------------------------*/
+
+/**
+ * Handle simulated button press during playbook.
+ *
+ * \param buttInx selected button
+ */
+EXPORT void PlaybackButtonMouse(wIndex_t buttInx)
+{
+ wWinPix_t cmdX, cmdY;
+ coOrd pos;
+
+ if (buttInx < 0 || buttInx >= buttonCnt) {
+ return;
+ }
+ if (buttonList[buttInx].control == NULL) {
+ return;
+ }
+ cmdX = buttonList[buttInx].x + 17;
+ cmdY = toolbarHeight - (buttonList[buttInx].y + 17)
+ + (wWinPix_t)(mainD.size.y / mainD.scale * mainD.dpi) + 30;
+
+ mainD.Pix2CoOrd(&mainD, cmdX, cmdY, &pos);
+ MovePlaybackCursor(&mainD, pos, TRUE, buttonList[buttInx].control);
+ if (playbackTimer == 0) {
+ wButtonSetBusy((wButton_p)buttonList[buttInx].control, TRUE);
+ wFlush();
+ wPause(500);
+ wButtonSetBusy((wButton_p)buttonList[buttInx].control, FALSE);
+ wFlush();
+ }
+}
+
+/**
+ * Handle cursor positioning for toolbar buttons during playback .
+ *
+ * \param buttonInx
+ */
+
+EXPORT void ToolbarButtonPlayback(wIndex_t buttonInx)
+{
+ wWinPix_t cmdX, cmdY;
+ coOrd pos;
+
+ cmdX = buttonList[buttonInx].x + 17;
+ cmdY = toolbarHeight - (buttonList[buttonInx].y + 17)
+ + (wWinPix_t)(mainD.size.y / mainD.scale * mainD.dpi) + 30;
+ mainD.Pix2CoOrd(&mainD, cmdX, cmdY, &pos);
+ MovePlaybackCursor(&mainD, pos, TRUE, buttonList[buttonInx].control);
+}
+
+/**
+ * Save the toolbar setting to the configuration file.
+ *
+ */
+
+static void
+SaveToolbarConfig(void)
+{
+ wPrefSetInteger(TOOLBAR_SECTION, TOOLBAR_VARIABLE, toolbarSet);
+ if (recordF)
+ fprintf(recordF, "PARAMETER %s %s %ld", TOOLBAR_SECTION,
+ TOOLBAR_VARIABLE, toolbarSet);
+
+}
+
+/**
+ * Get the preferences for the toolbar from the configuration file.
+ * Bits unused are cleared just to be sure;
+ *
+ */
+
+EXPORT void
+ToolbarLoadConfig(void)
+{
+ unsigned long maxToolbarSet = (1 << COUNTTOOLBARGROUPS) - 1;
+ long toolbarSetIni;
+
+ wPrefGetInteger(TOOLBAR_SECTION, TOOLBAR_VARIABLE, &toolbarSetIni,
+ TOOLBARSET_INIT);
+
+ toolbarSet = (unsigned long)toolbarSetIni & maxToolbarSet;
+
+ // unused but saved to stay compatible
+ wPrefSetInteger(TOOLBAR_SECTION, "max-toolbarset", maxToolbarSet);
+
+ if (recordF)
+ fprintf(recordF, "PARAMETER %s %s %lX -> %lX", TOOLBAR_SECTION,
+ TOOLBAR_VARIABLE, toolbarSetIni, toolbarSet);
+}
+
+/**
+ * Initialize toolbar functions.
+ *
+ */
+
+EXPORT void InitToolbar(void)
+{
+ RegisterChangeNotification(ToolbarChange);
+
+ ToolbarLoadConfig();
+}
diff --git a/app/bin/track.c b/app/bin/track.c
index 951eec3..7de4f4a 100644
--- a/app/bin/track.c
+++ b/app/bin/track.c
@@ -193,13 +193,16 @@ EXPORT track_p OnTrack2( coOrd * fp, BOOL_T complain, BOOL_T track,
}
}
- p = *fp;
- distance = trackCmds( GetTrkType(trk) )->distance( trk, &p );
- if (fabs(distance) <= fabs(
- closestDistance)) { //Make the last (highest) preferred
- closestDistance = distance;
- closestTrack = trk;
- closestPos = p;
+ if ( GetCurrentCommand() != modifyCmdInx ||
+ FALSE == QueryTrack( trk, Q_IS_TEXT ) ) {
+ p = *fp;
+ distance = trackCmds( GetTrkType(trk) )->distance( trk, &p );
+ if (fabs(distance) <= fabs(
+ closestDistance)) { //Make the last (highest) preferred
+ closestDistance = distance;
+ closestTrack = trk;
+ closestPos = p;
+ }
}
}
if (closestTrack && closestDistance <0 ) { closestDistance = 0.0; } //Turntable was closest - inside well
@@ -1512,15 +1515,15 @@ EXPORT void SelectBelow( void * unused )
}
-#include "bitmaps/top.xpm3"
-#include "bitmaps/bottom.xpm3"
+#include "bitmaps/top.image3"
+#include "bitmaps/bottom.image3"
EXPORT void InitCmdAboveBelow( void )
{
wIcon_p bm_p;
- bm_p = wIconCreatePixMap( top_xpm3[iconSize] );
+ bm_p = wIconCreatePixMap( top_image3[iconSize] );
AddToolbarButton( "cmdAbove", bm_p, IC_SELECTED|IC_POPUP, SelectAbove, NULL );
- bm_p = wIconCreatePixMap( bottom_xpm3[iconSize] );
+ bm_p = wIconCreatePixMap( bottom_image3[iconSize] );
AddToolbarButton( "cmdBelow", bm_p, IC_SELECTED|IC_POPUP, SelectBelow, NULL );
}
@@ -2819,6 +2822,9 @@ EXPORT void DrawTie(
return;
}
}
+ if ( color == wDrawColorBlack ) {
+ color = tieColor;
+ }
if ( solid ) {
DrawPoly( d, 4, p, t, color, 0, DRAW_FILL );
} else {
@@ -2827,6 +2833,20 @@ EXPORT void DrawTie(
}
+/**
+ * Return base color of a track
+ * Detect
+ * - grade, radius exception
+ * - profile path
+ * - layer override
+ * - Cornu/Bezier too tight
+ * These are used for track and ties
+ * If not, return Black. Which is converted to normalColor/tieColor before use
+ *
+ * \param trk track object
+ * \param d draw context
+ * \return track color
+ */
EXPORT wDrawColor GetTrkColor( track_p trk, drawCmd_p d )
{
DIST_T len, elev0, elev1;
diff --git a/app/bin/track.h b/app/bin/track.h
index fdc7909..ab6c925 100644
--- a/app/bin/track.h
+++ b/app/bin/track.h
@@ -504,6 +504,7 @@ STATUS_T JointDescriptionMove(track_p trk,wAction_t action,coOrd pos );
extern wIndex_t describeCmdInx;
extern BOOL_T inDescribeCmd;
extern BOOL_T descUndoStarted;
+extern char * descTitle;
typedef enum { DESC_NULL, DESC_POS, DESC_FLOAT, DESC_ANGLE, DESC_LONG, DESC_COLOR, DESC_DIM, DESC_PIVOT, DESC_LAYER, DESC_STRING, DESC_TEXT, DESC_LIST, DESC_EDITABLELIST, DESC_BOXED } descType;
#define DESC_RO (1<<0)
#define DESC_IGNORE (1<<1)
@@ -528,7 +529,7 @@ typedef struct {
} descData_t, * descData_p;
typedef void (*descUpdate_t)( track_p, int, descData_p, BOOL_T );
void DoDescribe( char *, track_p, descData_p, descUpdate_t );
-void DescribeCancel( void );
+void DescribeDone( void * );
BOOL_T UpdateDescStraight( int, int, int, int, int, descData_p, long );
STATUS_T CmdDescribe(wAction_t,coOrd);
@@ -600,6 +601,7 @@ void HotBarCancel( void );
void AddHotBarTurnouts( void );
void AddHotBarStructures( void );
void AddHotBarCarDesc( void );
+void ChangeHotBar( long );
/* cblock.c */
void CheckDeleteBlock( track_p t );
diff --git a/app/bin/trknote.c b/app/bin/trknote.c
index a62c22d..43bda68 100644
--- a/app/bin/trknote.c
+++ b/app/bin/trknote.c
@@ -36,7 +36,7 @@ EXPORT TRKTYP_T T_NOTE = -1;
static wDrawBitMap_p note_bm, link_bm, document_bm;
typedef struct {
- char ***xpm;
+ wIconBitMap_t * image3;
int OP;
char * shortName;
char * cmdName;
@@ -44,21 +44,18 @@ typedef struct {
long acclKey;
} trknoteData_t;
-#include "bitmaps/sticky-note.xpm3"
-#include "bitmaps/sticky-link.xpm3"
-#include "bitmaps/sticky-doc.xpm3"
+#include "bitmaps/sticky-note.image3"
+#include "bitmaps/sticky-link.image3"
+#include "bitmaps/sticky-doc.image3"
static trknoteData_t noteTypes[] = {
- { sticky_note_xpm3, OP_NOTETEXT, N_("Note"), N_("Text Note"), "cmdTextNote", ACCL_NOTE },
- { sticky_link_xpm3, OP_NOTELINK, N_("Link"), N_("Weblink"), "cmdLinkNote", 0L },
- { sticky_doc_xpm3, OP_NOTEFILE, N_("Document"), N_("Document"), "cmdFileNote", 0L },
+ { sticky_note_image3, OP_NOTETEXT, N_("Note"), N_("Text Note"), "cmdTextNote", ACCL_NOTE },
+ { sticky_link_image3, OP_NOTELINK, N_("Link"), N_("Weblink"), "cmdLinkNote", 0L },
+ { sticky_doc_image3, OP_NOTEFILE, N_("Document"), N_("Document"), "cmdFileNote", 0L },
};
static long curNoteType;
-static unsigned layerSave;
-static coOrd posSave;
-
#define NOTETYPESCOUNT COUNT(noteTypes)
@@ -519,7 +516,6 @@ static STATUS_T CmdNote(wAction_t action, coOrd pos)
{
static coOrd oldPos;
static int state_on = FALSE;
- track_p trk;
switch (action) {
case C_START:
@@ -571,18 +567,17 @@ static STATUS_T CmdNote(wAction_t action, coOrd pos)
return C_CONTINUE;
case C_CANCEL:
- DescribeCancel();
+ DescribeDone( NULL );
state_on = FALSE;
return C_CONTINUE;
}
- return C_INFO;
+ return C_CONTINUE;
}
#include "bitmaps/note.xbm"
#include "bitmaps/link.xbm"
#include "bitmaps/clip.xbm"
-// RWS not used #include "bitmaps/note.xpm"
void InitTrkNote(wMenu_p menu)
{
@@ -597,7 +592,7 @@ void InitTrkNote(wMenu_p menu)
wIcon_p icon;
nt = noteTypes + i;
- icon = wIconCreatePixMap(nt->xpm[iconSize]);
+ icon = wIconCreatePixMap(nt->image3[iconSize]);
AddMenuButton(menu, CmdNote, nt->helpKey, _(nt->cmdName), icon, LEVEL0_50,
IC_STICKY | IC_POPUP2, nt->acclKey, I2VP(nt->OP));
}
diff --git a/app/bin/trkseg.c b/app/bin/trkseg.c
index 82396a2..a663a82 100644
--- a/app/bin/trkseg.c
+++ b/app/bin/trkseg.c
@@ -1804,7 +1804,7 @@ EXPORT void DrawSegsO(
DrawStraightTrack( d,
p0, p1,
FindAngle(p1, p0 ),
- trk, color1, options );
+ trk, color, options );
break;
case SEG_STRLIN:;
wDrawWidth w;
@@ -1867,7 +1867,7 @@ EXPORT void DrawSegsO(
c,
fabs(segPtr->u.c.radius),
a0, segPtr->u.c.a1,
- trk, color1, options );
+ trk, color, options );
} else {
wDrawWidth w;
if (segPtr->lineWidth < 0) {
@@ -1916,7 +1916,7 @@ EXPORT void DrawSegsO(
c,
fabs(tempPtr->u.c.radius),
a0, tempPtr->u.c.a1,
- trk, color1, options );
+ trk, color, options );
} else if (tempPtr->type == SEG_CRVLIN) {
wDrawWidth w;
if (tempPtr->lineWidth < 0) {
@@ -1939,7 +1939,7 @@ EXPORT void DrawSegsO(
if ( tempPtr->color == wDrawColorWhite ) { break; }
DrawStraightTrack( d, p0, p1,
FindAngle(p1,p0),
- trk,color1,options);
+ trk,color,options);
break;
case SEG_STRLIN:
REORIGIN(p0,tempPtr->u.l.pos[0], angle, orig);
diff --git a/app/bin/tstraigh.c b/app/bin/tstraigh.c
index 1a3fa51..da4fe81 100644
--- a/app/bin/tstraigh.c
+++ b/app/bin/tstraigh.c
@@ -389,9 +389,6 @@ EXPORT void DrawStraightTies(
return;
}
- if ( color == wDrawColorBlack ) {
- color = tieColor;
- }
len = FindDistance( p0, p1 );
len -= tieOff0+tieOff1;
angle = FindAngle( p0, p1 );
@@ -472,7 +469,7 @@ EXPORT void DrawStraightTrack(
td = GetTrkTieData( trk );
DrawStraightTies( d, td, p0, p1, color );
}
- if (color == wDrawColorBlack) {
+ if ( color == wDrawColorBlack ) {
color = normalColor;
}
if ( ! DrawTwoRails( d, 1 ) ) {
diff --git a/app/bin/turnout.c b/app/bin/turnout.c
index 57c398b..f176d63 100644
--- a/app/bin/turnout.c
+++ b/app/bin/turnout.c
@@ -1001,7 +1001,7 @@ static void DrawDtoInit()
*
* \param d The drawing object
* \param scaleInx The layout/track scale index
- * \param color The tie color. If black the color is read from the global tieColor.
+ * \param color The tie color. If black the color is read from the global tieColor in DrawTie().
*/
static void DrawNormalTurnout(
drawCmd_p d,
@@ -1018,9 +1018,6 @@ static void DrawNormalTurnout(
// int s0;
ANGLE_T a0;
- if (color == wDrawColorBlack) {
- color = tieColor;
- }
// DIST_T trackGauge = GetTrkGauge(dtod.trk);
@@ -1246,7 +1243,7 @@ static void DrawNormalTurnout(
*
* \param d The drawing object
* \param scaleInx The layout/track scale index
- * \param color The tie color. If black the color is read from the global tieColor.
+ * \param color The tie color. If black the color is read from the global tieColor in DrawTie().
*/
static void DrawCurvedTurnout(
drawCmd_p d,
@@ -1263,9 +1260,6 @@ static void DrawCurvedTurnout(
ANGLE_T a0, a1, a2;
struct extraDataCompound_t* xx = dtod.xx;
- if (color == wDrawColorBlack) {
- color = tieColor;
- }
DrawDtoInit();
@@ -1505,7 +1499,7 @@ static void DrawCurvedTurnout(
*
* \param d The drawing object
* \param scaleInx The layout/track scale index
- * \param color The tie color. If black the color is read from the global tieColor.
+ * \param color The tie color. If black the color is read from the global tieColor in DrawTie().
*/
static void DrawXingTurnout(
drawCmd_p d,
@@ -1518,9 +1512,6 @@ static void DrawXingTurnout(
int cnt;
ANGLE_T cAngle;
- if (color == wDrawColorBlack) {
- color = tieColor;
- }
coOrd c1, c2, s1, s2, p1, p2, q1;
int p0, q0;
@@ -1840,7 +1831,7 @@ static void DrawXingTurnout(
*
* \param d The drawing object
* \param scaleInx The layout/track scale index
- * \param color The tie color. If black the color is read from the global tieColor.
+ * \param color The tie color. If black the color is read from the global tieColor in DrawTie().
*/
static void DrawCrossTurnout(
drawCmd_p d,
@@ -1853,9 +1844,6 @@ static void DrawCrossTurnout(
int cnt;
ANGLE_T angle;
- if (color == wDrawColorBlack) {
- color = tieColor;
- }
// struct extraDataCompound_t* xx = dtod.xx;