summaryrefslogtreecommitdiff
path: root/app/bin/ccontrol.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/bin/ccontrol.c')
-rw-r--r--app/bin/ccontrol.c44
1 files changed, 19 insertions, 25 deletions
diff --git a/app/bin/ccontrol.c b/app/bin/ccontrol.c
index 793acc3..a4f9b27 100644
--- a/app/bin/ccontrol.c
+++ b/app/bin/ccontrol.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_CONTROL = -1;
@@ -85,6 +81,7 @@ static char controlOffScript[STR_LONG_SIZE];
#endif
typedef struct controlData_t {
+ extraDataBase_t base;
coOrd orig;
BOOL_T IsHilite;
char * name;
@@ -94,7 +91,7 @@ typedef struct controlData_t {
static controlData_p GetcontrolData ( track_p trk )
{
- return (controlData_p) GetTrkExtraData(trk);
+ return GET_EXTRA_DATA( trk, T_CONTROL, controlData_t );
}
#define RADIUS 6
@@ -310,9 +307,9 @@ static BOOL_T WriteControl ( track_p t, FILE * f )
controlData_p xx = GetcontrolData(t);
char *controlName = MyStrdup(xx->name);
-#ifdef WINDOWS
+#ifdef UTFCONVERT
controlName = Convert2UTF8(controlName);
-#endif // WINDOWS
+#endif // UTFCONVERT
rc &= fprintf(f, "CONTROL %d %u %s %d %0.6f %0.6f \"%s\" \"%s\" \"%s\"\n",
GetTrkIndex(t), GetTrkLayer(t), GetTrkScaleName(t),
@@ -340,9 +337,9 @@ static BOOL_T ReadControl ( char * line )
return FALSE;
}
-#ifdef WINDOWS
+#ifdef UTFCONVERT
ConvertUTF8ToSystem(name);
-#endif // WINDOWS
+#endif // UTFCONVERT
trk = NewTrack(index, T_CONTROL, 0, sizeof(controlData_t));
SetTrkVisible(trk, visible);
@@ -422,18 +419,18 @@ static char controlEditOffScript[STR_LONG_SIZE];
static paramFloatRange_t r_1000_1000 = { -1000.0, 1000.0, 80 };
static paramData_t controlEditPLs[] = {
#define I_CONTROLNAME (0)
- /*0*/ { PD_STRING, controlEditName, "name", PDO_NOPREF | PDO_STRINGLIMITLENGTH, (void*)200, N_("Name"), 0, 0, sizeof(controlEditName) },
+ /*0*/ { PD_STRING, controlEditName, "name", PDO_NOPREF | PDO_NOTBLANK, I2VP(200), N_("Name"), 0, 0, sizeof(controlEditName) },
#define I_ORIGX (1)
/*1*/ { PD_FLOAT, &controlEditOrig.x, "origx", PDO_DIM, &r_1000_1000, N_("Origin X") },
#define I_ORIGY (2)
/*2*/ { PD_FLOAT, &controlEditOrig.y, "origy", PDO_DIM, &r_1000_1000, N_("Origin Y") },
#define I_CONTROLONSCRIPT (3)
- /*3*/ { PD_STRING, controlEditOnScript, "script", PDO_NOPREF | PDO_STRINGLIMITLENGTH, (void*)350, N_("On Script"), 0, 0, sizeof(controlEditOnScript)},
+ /*3*/ { PD_STRING, controlEditOnScript, "script", PDO_NOPREF, I2VP(350), N_("On Script"), 0, 0, sizeof(controlEditOnScript)},
#define I_CONTROLOFFSCRIPT (4)
- /*4*/ { PD_STRING, controlEditOffScript, "script", PDO_NOPREF | PDO_STRINGLIMITLENGTH, (void*)350, N_("Off Script"), 0, 0, sizeof(controlEditOffScript)},
+ /*4*/ { PD_STRING, controlEditOffScript, "script", PDO_NOPREF, I2VP(350), N_("Off Script"), 0, 0, sizeof(controlEditOffScript)},
};
-static paramGroup_t controlEditPG = { "controlEdit", 0, controlEditPLs, sizeof controlEditPLs/sizeof controlEditPLs[0] };
+static paramGroup_t controlEditPG = { "controlEdit", 0, controlEditPLs, COUNT( controlEditPLs ) };
static wWin_p controlEditW;
static void ControlEditOk ( void * junk )
@@ -524,6 +521,7 @@ static STATUS_T CmdControl ( wAction_t action, coOrd pos )
switch (action) {
case C_START:
InfoMessage(_("Place control"));
+ SetAllTrackSelect( FALSE );
create = FALSE;
return C_CONTINUE;
case C_DOWN:
@@ -553,13 +551,9 @@ static POS_T ctlhiliteBorder;
static wDrawColor ctlhiliteColor = 0;
static void DrawControlTrackHilite( 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( mainD.d, x, y, w, h, ctlhiliteColor, wDrawOptTemp|wDrawOptTransparent );
+ DrawRectangle( &tempD, ctlhiliteOrig, ctlhiliteSize, ctlhiliteColor, DRAW_TRANSPARENT );
}
static int ControlMgmProc ( int cmd, void * data )
@@ -624,12 +618,12 @@ EXPORT void ControlMgmLoad ( void )
static wIcon_p controlI = NULL;
if (controlI == NULL) {
- controlI = wIconCreatePixMap( control_xpm );
+ controlI = wIconCreatePixMap( control_xpm[iconSize] );
}
TRK_ITERATE(trk) {
if (GetTrkType(trk) != T_CONTROL) continue;
- ContMgmLoad (controlI, ControlMgmProc, (void *) trk );
+ ContMgmLoad (controlI, ControlMgmProc, trk );
}
}
@@ -638,7 +632,7 @@ EXPORT void ControlMgmLoad ( void )
EXPORT void InitCmdControl ( wMenu_p menu )
{
AddMenuButton( menu, CmdControl, "cmdControl", _("Control"),
- wIconCreatePixMap( control_xpm ), LEVEL0_50, IC_STICKY|IC_POPUP2, ACCL_CONTROL, NULL );
+ wIconCreatePixMap( control_xpm[iconSize] ), LEVEL0_50, IC_STICKY|IC_POPUP2, ACCL_CONTROL, NULL );
}
EXPORT void InitTrkControl ( void )