diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-22 14:05:41 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-22 14:05:41 +0200 |
commit | b55285a77da0e0b829e4ce8d7e09debaabc68e15 (patch) | |
tree | f622559ef65bbdd3e1c5bdb06098a8f89eec0563 /app/bin/ccontrol.c | |
parent | d3897ce090dbeb220ed2c782f095597e417cf3cc (diff) | |
parent | d1ae75703e1ed81d65ea16946dcdb77e7a13adc9 (diff) |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'app/bin/ccontrol.c')
-rw-r--r-- | app/bin/ccontrol.c | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/app/bin/ccontrol.c b/app/bin/ccontrol.c index fb02fdf..793acc3 100644 --- a/app/bin/ccontrol.c +++ b/app/bin/ccontrol.c @@ -58,6 +58,9 @@ static const char rcsid[] = "@(#) : $Id$"; #include "param.h" #include "track.h" #include "trackx.h" +#ifdef WINDOWS +#include "include/utf8convert.h" +#endif // WINDOWS #include "utility.h" #include "messages.h" @@ -276,7 +279,7 @@ static void DescribeControl (track_p trk, char * str, CSIZE_T len ) *str = tolower((unsigned char)*str); str++; } - sprintf( str, _("(%d [%s]): Layer=%d, at %0.3f,%0.3f"), + sprintf( str, _("(%d [%s]): Layer=%u, at %0.3f,%0.3f"), GetTrkIndex(trk), xx->name,GetTrkLayer(trk)+1, xx->orig.x, xx->orig.y); strncpy(controlProperties.name,xx->name,STR_SHORT_SIZE-1); @@ -305,14 +308,22 @@ static BOOL_T WriteControl ( track_p t, FILE * f ) { BOOL_T rc = TRUE; controlData_p xx = GetcontrolData(t); - rc &= fprintf(f, "CONTROL %d %d %s %d %0.6f %0.6f \"%s\" \"%s\" \"%s\"\n", + char *controlName = MyStrdup(xx->name); + +#ifdef WINDOWS + controlName = Convert2UTF8(controlName); +#endif // WINDOWS + + rc &= fprintf(f, "CONTROL %d %u %s %d %0.6f %0.6f \"%s\" \"%s\" \"%s\"\n", GetTrkIndex(t), GetTrkLayer(t), GetTrkScaleName(t), - GetTrkVisible(t), xx->orig.x, xx->orig.y, xx->name, + GetTrkVisible(t), xx->orig.x, xx->orig.y, controlName, xx->onscript, xx->offscript)>0; + + MyFree(controlName); return rc; } -static void ReadControl ( char * line ) +static BOOL_T ReadControl ( char * line ) { wIndex_t index; /*TRKINX_T trkindex;*/ @@ -326,8 +337,13 @@ static void ReadControl ( char * line ) wIndex_t layer; controlData_p xx; if (!GetArgs(line+7,"dLsdpqqq",&index,&layer,scale, &visible, &orig,&name,&onscript,&offscript)) { - return; + return FALSE; } + +#ifdef WINDOWS + ConvertUTF8ToSystem(name); +#endif // WINDOWS + trk = NewTrack(index, T_CONTROL, 0, sizeof(controlData_t)); SetTrkVisible(trk, visible); SetTrkScale(trk, LookupScale( scale )); @@ -338,6 +354,7 @@ static void ReadControl ( char * line ) xx->onscript = onscript; xx->offscript = offscript; ComputeControlBoundingBox(trk); + return TRUE; } static void MoveControl (track_p trk, coOrd orig ) @@ -502,24 +519,29 @@ static void CreateNewControl (coOrd orig) static STATUS_T CmdControl ( wAction_t action, coOrd pos ) { - + static coOrd control_pos; + static BOOL_T create; switch (action) { case C_START: InfoMessage(_("Place control")); + create = FALSE; return C_CONTINUE; case C_DOWN: + create = TRUE; + /* no break */ case C_MOVE: SnapPos(&pos); - DDrawControl( &tempD, pos, GetScaleRatio(GetLayoutCurScale()), wDrawColorBlack ); + control_pos = pos; return C_CONTINUE; case C_UP: SnapPos(&pos); - DDrawControl( &tempD, pos, GetScaleRatio(GetLayoutCurScale()), wDrawColorBlack ); CreateNewControl(pos); return C_TERMINATE; case C_REDRAW: + if (create) + DDrawControl( &tempD, control_pos, GetScaleRatio(GetLayoutCurScale()), wDrawColorBlack ); + return C_CONTINUE; case C_CANCEL: - DDrawControl( &tempD, pos, GetScaleRatio(GetLayoutCurScale()), wDrawColorBlack ); return C_CONTINUE; default: return C_CONTINUE; @@ -537,7 +559,7 @@ static void DrawControlTrackHilite( void ) 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 ); + wDrawFilledRectangle( mainD.d, x, y, w, h, ctlhiliteColor, wDrawOptTemp|wDrawOptTransparent ); } static int ControlMgmProc ( int cmd, void * data ) |