summaryrefslogtreecommitdiff
path: root/app/bin/csensor.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2022-02-06 16:04:24 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2022-02-06 16:04:24 +0100
commit5d2c2b27a6323e2666378b986129b2a7c2c39e5c (patch)
treece8982b6c0111f79791068de2c2d4c6ce3138a49 /app/bin/csensor.c
parentb623f5953691b2a0614e6f1f4def86bdbb9a4113 (diff)
New upstream version 5.2.2GAupstream/5.2.2GA
Diffstat (limited to 'app/bin/csensor.c')
-rw-r--r--app/bin/csensor.c44
1 files changed, 19 insertions, 25 deletions
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 <ctype.h>
-#include <string.h>
-
#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 )