diff options
Diffstat (limited to 'app/bin/csignal.c')
-rw-r--r-- | app/bin/csignal.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/app/bin/csignal.c b/app/bin/csignal.c index 06adb19..2f02e58 100644 --- a/app/bin/csignal.c +++ b/app/bin/csignal.c @@ -12,7 +12,7 @@ * Author : $Author$ * Created By : Robert Heller * Created : Sun Feb 19 13:11:45 2017 - * Last Modified : <170314.1311> + * Last Modified : <170417.1113> * * Description * @@ -48,10 +48,18 @@ static const char rcsid[] = "@(#) : $Id$"; #include <ctype.h> -#include "track.h" -#include "trackx.h" +#include <string.h> + #include "compound.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" +#include "utility.h" EXPORT TRKTYP_T T_SIGNAL = -1; @@ -515,6 +523,7 @@ static void SignalEditOk ( void * junk ) track_p trk; signalData_p xx; wIndex_t ia; + CSIZE_T newsize; if (signalCreate_P) { UndoStart( _("Create Signal"), "Create Signal"); @@ -526,16 +535,15 @@ static void SignalEditOk ( void * junk ) xx = GetsignalData(trk); if (xx->numAspects != signalAspect_da.cnt) { /* We need to reallocate the extra data. */ - /* We will delete the Signal and re-create it. */ - BOOL_T visible = GetTrkVisible(trk); - SCALEINX_T scale = GetTrkScale(trk); - LAYER_T layer = GetTrkLayer(trk); - wIndex_t tindx = GetTrkIndex(trk); - FreeTrack(trk); - trk = NewTrack(tindx, T_SIGNAL, 0, sizeof(signalData_t)+(sizeof(signalAspect_t)*(signalAspect_da.cnt-1))+1); - SetTrkVisible(trk,visible); - SetTrkScale(trk,scale); - SetTrkLayer(trk,layer); + for (ia = 0; ia < xx->numAspects; ia++) { + MyFree((&(xx->aspectList))[ia].aspectName); + MyFree((&(xx->aspectList))[ia].aspectScript); + (&(xx->aspectList))[ia].aspectName = NULL; + (&(xx->aspectList))[ia].aspectScript = NULL; + } + newsize = sizeof(signalData_t)+(sizeof(signalAspect_t)*(signalAspect_da.cnt-1))+1; + trk->extraData = MyRealloc(trk->extraData,newsize); + trk->extraSize = newsize; xx = GetsignalData(trk); } } @@ -769,7 +777,7 @@ static STATUS_T CmdSignal ( wAction_t action, coOrd pos ) case C_MOVE: SnapPos(&pos); orient = FindAngle(pos0,pos); - DDrawSignal( &tempD, pos0, orient, 1, GetScaleRatio(curScaleInx), wDrawColorBlack ); + DDrawSignal( &tempD, pos0, orient, 1, GetScaleRatio(GetLayoutCurScale()), wDrawColorBlack ); return C_CONTINUE; case C_UP: SnapPos(&pos); @@ -778,7 +786,7 @@ static STATUS_T CmdSignal ( wAction_t action, coOrd pos ) return C_TERMINATE; case C_REDRAW: case C_CANCEL: - DDrawSignal( &tempD, pos0, orient, 1, GetScaleRatio(curScaleInx), wDrawColorBlack ); + DDrawSignal( &tempD, pos0, orient, 1, GetScaleRatio(GetLayoutCurScale()), wDrawColorBlack ); return C_CONTINUE; default: return C_CONTINUE; |