From 5d2c2b27a6323e2666378b986129b2a7c2c39e5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 6 Feb 2022 16:04:24 +0100 Subject: New upstream version 5.2.2GA --- app/bin/csensor.c | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) (limited to 'app/bin/csensor.c') diff --git a/app/bin/csensor.c b/app/bin/csensor.c index 4f395c2..b6f2224 100644 --- a/app/bin/csensor.c +++ b/app/bin/csensor.c @@ -46,23 +46,19 @@ static const char rcsid[] = "@(#) : $Id$"; -#include -#include - #include "compound.h" +#include "cselect.h" #include "cundo.h" #include "custom.h" #include "fileio.h" -#include "i18n.h" #include "layout.h" #include "param.h" #include "track.h" #include "trackx.h" -#ifdef WINDOWS +#include "common-ui.h" +#ifdef UTFCONVERT #include "include/utf8convert.h" -#endif // WINDOWS -#include "utility.h" -#include "messages.h" +#endif // UTFCONVERT EXPORT TRKTYP_T T_SENSOR = -1; @@ -84,6 +80,7 @@ static char sensorScript[STR_LONG_SIZE]; #endif typedef struct sensorData_t { + extraDataBase_t base; coOrd orig; BOOL_T IsHilite; char * name; @@ -92,7 +89,7 @@ typedef struct sensorData_t { static sensorData_p GetsensorData ( track_p trk ) { - return (sensorData_p) GetTrkExtraData(trk); + return GET_EXTRA_DATA( trk, T_SENSOR, sensorData_t ); } #define RADIUS 6 @@ -275,9 +272,9 @@ static BOOL_T WriteSensor ( track_p t, FILE * f ) sensorData_p xx = GetsensorData(t); char *sensorName = MyStrdup(xx->name); -#ifdef WINDOWS +#ifdef UTFCONVERT sensorName = Convert2UTF8(sensorName); -#endif // WINDOWS +#endif // UTFCONVERT rc &= fprintf(f, "SENSOR %d %u %s %d %0.6f %0.6f \"%s\" \"%s\"\n", GetTrkIndex(t), GetTrkLayer(t), GetTrkScaleName(t), @@ -305,9 +302,9 @@ static BOOL_T ReadSensor ( char * line ) return FALSE; } -#ifdef WINDOWS +#ifdef UTFCONVERT ConvertUTF8ToSystem(name); -#endif // WINDOWS +#endif // UTFCONVERT trk = NewTrack(index, T_SENSOR, 0, sizeof(sensorData_t)); SetTrkVisible(trk, visible); @@ -386,16 +383,16 @@ static char sensorEditScript[STR_LONG_SIZE]; static paramFloatRange_t r_1000_1000 = { -1000.0, 1000.0, 80 }; static paramData_t sensorEditPLs[] = { #define I_SENSORNAME (0) - /*0*/ { PD_STRING, sensorEditName, "name", PDO_NOPREF|PDO_STRINGLIMITLENGTH, (void*)200, N_("Name"), 0, 0, sizeof(sensorEditName)}, + /*0*/ { PD_STRING, sensorEditName, "name", PDO_NOPREF|PDO_NOTBLANK, I2VP(200), N_("Name"), 0, 0, sizeof(sensorEditName)}, #define I_ORIGX (1) - /*1*/ { PD_FLOAT, &sensorEditOrig.x, "origx", PDO_DIM, &r_1000_1000, N_("Orgin X") }, + /*1*/ { PD_FLOAT, &sensorEditOrig.x, "origx", PDO_DIM, &r_1000_1000, N_("Origin X") }, #define I_ORIGY (2) /*2*/ { PD_FLOAT, &sensorEditOrig.y, "origy", PDO_DIM, &r_1000_1000, N_("Origin Y") }, #define I_SENSORSCRIPT (3) - /*3*/ { PD_STRING, sensorEditScript, "script", PDO_NOPREF|PDO_STRINGLIMITLENGTH, (void*)350, N_("Script"), 0, 0, sizeof(sensorEditScript)}, + /*3*/ { PD_STRING, sensorEditScript, "script", PDO_NOPREF, I2VP(350), N_("Script"), 0, 0, sizeof(sensorEditScript)}, }; -static paramGroup_t sensorEditPG = { "sensorEdit", 0, sensorEditPLs, sizeof sensorEditPLs/sizeof sensorEditPLs[0] }; +static paramGroup_t sensorEditPG = { "sensorEdit", 0, sensorEditPLs, COUNT( sensorEditPLs ) }; static wWin_p sensorEditW; static void SensorEditOk ( void * junk ) @@ -479,6 +476,7 @@ static STATUS_T CmdSensor ( wAction_t action, coOrd pos ) switch (action) { case C_START: InfoMessage(_("Place sensor")); + SetAllTrackSelect( FALSE ); create = FALSE; return C_CONTINUE; case C_DOWN: @@ -509,13 +507,9 @@ static POS_T ctlhiliteBorder; static wDrawColor ctlhiliteColor = 0; static void DrawSensorTrackHilite( void ) { - wPos_t x, y, w, h; if (ctlhiliteColor==0) ctlhiliteColor = wDrawColorGray(87); - w = (wPos_t)((ctlhiliteSize.x/mainD.scale)*mainD.dpi+0.5); - h = (wPos_t)((ctlhiliteSize.y/mainD.scale)*mainD.dpi+0.5); - mainD.CoOrd2Pix(&mainD,ctlhiliteOrig,&x,&y); - wDrawFilledRectangle( tempD.d, x, y, w, h, ctlhiliteColor, wDrawOptTemp|wDrawOptTransparent ); + DrawRectangle( &tempD, ctlhiliteOrig, ctlhiliteSize, ctlhiliteColor, DRAW_TRANSPARENT ); } static int SensorMgmProc ( int cmd, void * data ) @@ -580,12 +574,12 @@ EXPORT void SensorMgmLoad ( void ) static wIcon_p sensorI = NULL; if (sensorI == NULL) { - sensorI = wIconCreatePixMap( sensor_xpm ); + sensorI = wIconCreatePixMap( sensor_xpm[iconSize] ); } TRK_ITERATE(trk) { if (GetTrkType(trk) != T_SENSOR) continue; - ContMgmLoad (sensorI, SensorMgmProc, (void *) trk ); + ContMgmLoad (sensorI, SensorMgmProc, trk ); } } @@ -594,7 +588,7 @@ EXPORT void SensorMgmLoad ( void ) EXPORT void InitCmdSensor ( wMenu_p menu ) { AddMenuButton( menu, CmdSensor, "cmdSensor", _("Sensor"), - wIconCreatePixMap( sensor_xpm ), LEVEL0_50, IC_STICKY|IC_POPUP2, ACCL_SENSOR, NULL ); + wIconCreatePixMap( sensor_xpm[iconSize] ), LEVEL0_50, IC_STICKY|IC_POPUP2, ACCL_SENSOR, NULL ); } EXPORT void InitTrkSensor ( void ) -- cgit v1.2.3