diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-04-29 12:11:35 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-04-29 12:11:35 +0200 |
commit | dcef13a23c06398c0c9b3145c08b28d1110bc169 (patch) | |
tree | df8d3227b3d71fdd356b3c1e69c62533d1759f72 /app/bin/cblock.c | |
parent | 3e11d9c0e6173fce8a482efed8d7f965e8bd6dfa (diff) | |
parent | 16e9630b79f0a7a90c6cedb6781175bb8b337dc1 (diff) |
Merge tag 'upstream/4.3.0'
Upstream version 4.3.0
Diffstat (limited to 'app/bin/cblock.c')
-rw-r--r-- | app/bin/cblock.c | 367 |
1 files changed, 309 insertions, 58 deletions
diff --git a/app/bin/cblock.c b/app/bin/cblock.c index 5b728d0..3c627e9 100644 --- a/app/bin/cblock.c +++ b/app/bin/cblock.c @@ -1,6 +1,7 @@ /** \file cblock.c * Implement blocks: a group of trackwork with a single occ. detector - * Created by Robert Heller on Thu Mar 12 09:43:02 2009 + */ +/* Created by Robert Heller on Thu Mar 12 09:43:02 2009 * ------------------------------------------------------------------ * Modification History: $Log: not supported by cvs2svn $ * Modification History: Revision 1.4 2009/09/16 18:32:24 m_fischer @@ -47,17 +48,14 @@ #include <ctype.h> #include "track.h" +#include "trackx.h" #include "compound.h" #include "i18n.h" EXPORT TRKTYP_T T_BLOCK = -1; -#define BLOCKCMD - static int log_block = 0; -#ifdef BLOCKCMD - static void NoDrawLine(drawCmd_p d, coOrd p0, coOrd p1, wDrawWidth width, wDrawColor color ) {} static void NoDrawArc(drawCmd_p d, coOrd p, DIST_T r, ANGLE_T angle0, @@ -99,17 +97,37 @@ static paramData_t blockPLs[] = { /*1*/ { PD_STRING, blockScript, "script", PDO_NOPREF, (void*)350, N_("Script") } }; static paramGroup_t blockPG = { "block", 0, blockPLs, sizeof blockPLs/sizeof blockPLs[0] }; -static dynArr_t blockTrk_da; -#define blockTrk(N) DYNARR_N( track_p , blockTrk_da, N ) static wWin_p blockW; -#endif + +static char blockEditName[STR_SHORT_SIZE]; +static char blockEditScript[STR_LONG_SIZE]; +static char blockEditSegs[STR_LONG_SIZE]; +static track_p blockEditTrack; + +static paramData_t blockEditPLs[] = { +/*0*/ { PD_STRING, blockEditName, "name", PDO_NOPREF, (void*)200, N_("Name") }, +/*1*/ { PD_STRING, blockEditScript, "script", PDO_NOPREF, (void*)350, N_("Script") }, +/*2*/ { PD_STRING, blockEditSegs, "segments", PDO_NOPREF, (void*)350, N_("Segments"), BO_READONLY }, +}; +static paramGroup_t blockEditPG = { "block", 0, blockEditPLs, sizeof blockEditPLs/sizeof blockEditPLs[0] }; +static wWin_p blockEditW; + +typedef struct btrackinfo_t { + track_p t; + TRKINX_T i; +} btrackinfo_t, *btrackinfo_p; + +static dynArr_t blockTrk_da; +#define blockTrk(N) DYNARR_N( btrackinfo_t , blockTrk_da, N ) + typedef struct blockData_t { - char * name; - char * script; - wIndex_t numTracks; - track_p trackList; + char * name; + char * script; + BOOL_T IsHilite; + wIndex_t numTracks; + btrackinfo_t trackList; } blockData_t, *blockData_p; static blockData_p GetblockData ( track_p trk ) @@ -179,9 +197,9 @@ static DIST_T DistanceBlock (track_p t, coOrd * p ) DIST_T closest, current; int iTrk = 1; - closest = GetTrkDistance ((&(xx->trackList))[0], *p); + closest = GetTrkDistance ((&(xx->trackList))[0].t, *p); for (; iTrk < xx->numTracks; iTrk++) { - current = GetTrkDistance ((&(xx->trackList))[iTrk], *p); + current = GetTrkDistance ((&(xx->trackList))[iTrk].t, *p); if (current < closest) closest = current; } return closest; @@ -212,11 +230,12 @@ static void DescribeBlock (track_p trk, char * str, CSIZE_T len ) blockData.script[STR_LONG_SIZE-1] = '\0'; blockData.length = 0; if (xx->numTracks > 0) { - blockData.endPt[0] = GetTrkEndPos((&(xx->trackList))[0],0); + blockData.endPt[0] = GetTrkEndPos((&(xx->trackList))[0].t,0); } for (tcount = 0; tcount < xx->numTracks; tcount++) { - blockData.length += GetTrkLength((&(xx->trackList))[tcount],0,1); - lastTrk = (&(xx->trackList))[tcount]; + if ((&(xx->trackList))[tcount].t == NULL) continue; + blockData.length += GetTrkLength((&(xx->trackList))[tcount].t,0,1); + lastTrk = (&(xx->trackList))[tcount].t; } if (lastTrk != NULL) blockData.endPt[1] = GetTrkEndPos(lastTrk,1); blockDesc[E0].mode = @@ -228,7 +247,7 @@ static void DescribeBlock (track_p trk, char * str, CSIZE_T len ) } -static blockDebug (track_p trk) +static int blockDebug (track_p trk) { wIndex_t iTrack; blockData_p xx = GetblockData(trk); @@ -238,10 +257,11 @@ static blockDebug (track_p trk) LOG( log_block, 1, ("*** blockDebug(): script = \"%s\"\n",xx->script)) LOG( log_block, 1, ("*** blockDebug(): numTracks = %d\n",xx->numTracks)) for (iTrack = 0; iTrack < xx->numTracks; iTrack++) { - LOG( log_block, 1, ("*** blockDebug(): trackList[%d] = T%d, ",iTrack,GetTrkIndex((&(xx->trackList))[iTrack]))) - LOG( log_block, 1, ("%s\n",GetTrkTypeName((&(xx->trackList))[iTrack]))) + if ((&(xx->trackList))[iTrack].t == NULL) continue; + LOG( log_block, 1, ("*** blockDebug(): trackList[%d] = T%d, ",iTrack,GetTrkIndex((&(xx->trackList))[iTrack].t))) + LOG( log_block, 1, ("%s\n",GetTrkTypeName((&(xx->trackList))[iTrack].t))) } - + return(0); } static BOOL_T blockCheckContigiousPath() @@ -251,14 +271,14 @@ static BOOL_T blockCheckContigiousPath() track_p trk, trk1; DIST_T dist; ANGLE_T angle; - int pathElemStart = 0; + /*int pathElemStart = 0;*/ coOrd endPtOrig = zero; BOOL_T IsConnectedP; trkEndPt_p endPtP; DYNARR_RESET( trkEndPt_t, tempEndPts_da ); for ( inx=0; inx<blockTrk_da.cnt; inx++ ) { - trk = blockTrk(inx); + trk = blockTrk(inx).t; epCnt = GetTrkEndPtCnt(trk); IsConnectedP = FALSE; for ( ep=0; ep<epCnt; ep++ ) { @@ -297,7 +317,11 @@ static BOOL_T blockCheckContigiousPath() static void DeleteBlock ( track_p t ) { - blockData_p xx = GetblockData(t); + LOG( log_block, 1, ("*** DeleteBlock(%p)\n",t)) + blockData_p xx = GetblockData(t); + LOG( log_block, 1, ("*** DeleteBlock(): index is %d\n",GetTrkIndex(t))) + LOG( log_block, 1, ("*** DeleteBlock(): xx = %p, xx->name = %p, xx->script = %p\n", + xx,xx->name,xx->script)) MyFree(xx->name); xx->name = NULL; MyFree(xx->script); xx->script = NULL; } @@ -311,8 +335,9 @@ static BOOL_T WriteBlock ( track_p t, FILE * f ) rc &= fprintf(f, "BLOCK %d \"%s\" \"%s\"\n", GetTrkIndex(t), xx->name, xx->script)>0; for (iTrack = 0; iTrack < xx->numTracks && rc; iTrack++) { + if ((&(xx->trackList))[iTrack].t == NULL) continue; rc &= fprintf(f, "\tTRK %d\n", - GetTrkIndex((&(xx->trackList))[iTrack]))>0; + GetTrkIndex((&(xx->trackList))[iTrack].t))>0; } rc &= fprintf( f, "\tEND\n" )>0; return rc; @@ -334,7 +359,7 @@ static void ReadBlock ( char * line ) if (!GetArgs(line+6,"dqq",&index,&name,&script)) { return; } - DYNARR_RESET( track_p , blockTrk_da ); + DYNARR_RESET( btrackinfo_p , blockTrk_da ); while ( (cp = GetNextLine()) != NULL ) { while (isspace((unsigned char)*cp)) cp++; if ( strncmp( cp, "END", 3 ) == 0 ) { @@ -345,28 +370,49 @@ static void ReadBlock ( char * line ) } if ( strncmp( cp, "TRK", 3 ) == 0 ) { if (!GetArgs(cp+4,"d",&trkindex)) return; - trk = FindTrack(trkindex); - DYNARR_APPEND( track_p *, blockTrk_da, 10 ); - blockTrk(blockTrk_da.cnt-1) = trk; + /*trk = FindTrack(trkindex);*/ + DYNARR_APPEND( btrackinfo_p *, blockTrk_da, 10 ); + blockTrk(blockTrk_da.cnt-1).i = trkindex; } } - blockCheckContigiousPath(); - trk = NewTrack(index, T_BLOCK, tempEndPts_da.cnt, sizeof(blockData_t)+(sizeof(track_p)*(blockTrk_da.cnt-1))+1); + /*blockCheckContigiousPath(); save for ResolveBlockTracks */ + trk = NewTrack(index, T_BLOCK, tempEndPts_da.cnt, sizeof(blockData_t)+(sizeof(btrackinfo_t)*(blockTrk_da.cnt-1))+1); for ( ep=0; ep<tempEndPts_da.cnt; ep++) { endPtP = &tempEndPts(ep); SetTrkEndPoint( trk, ep, endPtP->pos, endPtP->angle ); } - xx = GetblockData( trk ); - xx->name = name; - xx->script = script; + xx = GetblockData( trk ); + LOG( log_block, 1, ("*** ReadBlock(): trk = %p (%d), xx = %p\n",trk,GetTrkIndex(trk),xx)) + LOG( log_block, 1, ("*** ReadBlock(): name = %p, script = %p\n",name,script)) + xx->name = name; + xx->script = script; + xx->IsHilite = FALSE; xx->numTracks = blockTrk_da.cnt; for (iTrack = 0; iTrack < blockTrk_da.cnt; iTrack++) { - LOG( log_block, 1, ("*** ReadBlock(): copying track T%d\n",GetTrkIndex(blockTrk(iTrack)))) - (&(xx->trackList))[iTrack] = blockTrk(iTrack); + LOG( log_block, 1, ("*** ReadBlock(): copying track T%d\n",GetTrkIndex(blockTrk(iTrack).t))) + memcpy((void*)&((&(xx->trackList))[iTrack]),(void*)&(blockTrk(iTrack)),sizeof(btrackinfo_t)); } blockDebug(trk); } +EXPORT void ResolveBlockTrack ( track_p trk ) +{ + LOG( log_block, 1, ("*** ResolveBlockTrack(%p)\n",trk)) + blockData_p xx; + track_p t_trk; + wIndex_t iTrack; + if (GetTrkType(trk) != T_BLOCK) return; + LOG( log_block, 1, ("*** ResolveBlockTrack(%d)\n",GetTrkIndex(trk))) + xx = GetblockData(trk); + for (iTrack = 0; iTrack < xx->numTracks; iTrack++) { + t_trk = FindTrack((&(xx->trackList))[iTrack].i); + if (t_trk == NULL) { + NoticeMessage( _("resolveBlockTrack: T%d[%d]: T%d doesn't exist"), _("Continue"), NULL, GetTrkIndex(trk), iTrack, (&(xx->trackList))[iTrack].i ); + } + (&(xx->trackList))[iTrack].t = t_trk; + LOG( log_block, 1, ("*** ResolveBlockTrack(): %d (%d): %p\n",iTrack,(&(xx->trackList))[iTrack].i,t_trk)) + } +} static void MoveBlock (track_p trk, coOrd orig ) {} static void RotateBlock (track_p trk, coOrd orig, ANGLE_T angle ) {} @@ -407,12 +453,11 @@ static trackCmd_t blockCmds = { -#ifdef BLOCKCMD static BOOL_T TrackInBlock (track_p trk, track_p blk) { wIndex_t iTrack; blockData_p xx = GetblockData(blk); for (iTrack = 0; iTrack < xx->numTracks; iTrack++) { - if (trk == (&(xx->trackList))[iTrack]) return TRUE; + if (trk == (&(xx->trackList))[iTrack].t) return TRUE; } return FALSE; } @@ -435,11 +480,11 @@ static void BlockOk ( void * junk ) trkEndPt_p endPtP; LOG( log_block, 1, ("*** BlockOk()\n")) - DYNARR_RESET( track_p *, blockTrk_da ); + DYNARR_RESET( btrackinfo_p *, blockTrk_da ); ParamUpdate( &blockPG ); if ( blockName[0]==0 ) { - NoticeMessage( 0, "Block must have a name!", _("Ok")); + NoticeMessage( _("Block must have a name!"), _("Ok"), NULL); return; } wDrawDelayUpdate( mainD.d, TRUE ); @@ -450,9 +495,10 @@ static void BlockOk ( void * junk ) while ( TrackIterate( &trk ) ) { if ( GetTrkSelected( trk ) ) { if ( IsTrack(trk) ) { - DYNARR_APPEND( track_p *, blockTrk_da, 10 ); + DYNARR_APPEND( btrackinfo_p *, blockTrk_da, 10 ); LOG( log_block, 1, ("*** BlockOk(): adding track T%d\n",GetTrkIndex(trk))) - blockTrk(blockTrk_da.cnt-1) = trk; + blockTrk(blockTrk_da.cnt-1).t = trk; + blockTrk(blockTrk_da.cnt-1).i = GetTrkIndex(trk); } } } @@ -474,18 +520,21 @@ static void BlockOk ( void * junk ) UndoStart( _("Create block"), "Create block" ); /* Create a block object */ LOG( log_block, 1, ("*** BlockOk(): %d tracks in block\n",blockTrk_da.cnt)) - trk = NewTrack(0, T_BLOCK, tempEndPts_da.cnt, sizeof(blockData_t)+(sizeof(track_p)*(blockTrk_da.cnt-1))+1); + trk = NewTrack(0, T_BLOCK, tempEndPts_da.cnt, sizeof(blockData_t)+(sizeof(btrackinfo_t)*(blockTrk_da.cnt-1))+1); for ( ep=0; ep<tempEndPts_da.cnt; ep++) { endPtP = &tempEndPts(ep); SetTrkEndPoint( trk, ep, endPtP->pos, endPtP->angle ); } - xx = GetblockData( trk ); + + xx = GetblockData( trk ); + LOG(log_block, 1, ("*** BlockOk(): trk = %p (%d), xx = %p\n", trk, GetTrkIndex(trk), xx)) xx->name = MyStrdup(blockName); xx->script = MyStrdup(blockScript); + xx->IsHilite = FALSE; xx->numTracks = blockTrk_da.cnt; for (iTrack = 0; iTrack < blockTrk_da.cnt; iTrack++) { - LOG( log_block, 1, ("*** BlockOk(): copying track T%d\n",GetTrkIndex(blockTrk(iTrack)))) - (&(xx->trackList))[iTrack] = blockTrk(iTrack); + LOG( log_block, 1, ("*** BlockOk(): copying track T%d\n",GetTrkIndex(blockTrk(iTrack).t))) + memcpy((void*)&(&(xx->trackList))[iTrack],(void*)&blockTrk(iTrack),sizeof(btrackinfo_t)); } blockDebug(trk); UndoEnd(); @@ -534,7 +583,7 @@ static STATUS_T CmdBlockCreate( wAction_t action, coOrd pos ) LOG( log_block, 1, ("*** CmdBlockAction(%08x,{%f,%f})\n",action,pos.x,pos.y)) switch (action & 0xFF) { case C_START: - fprintf(stderr,"*** CmdBlockCreate(): C_START\n"); + LOG( log_block, 1,("*** CmdBlockCreate(): C_START\n")) NewBlockDialog(); return C_TERMINATE; default: @@ -542,6 +591,7 @@ static STATUS_T CmdBlockCreate( wAction_t action, coOrd pos ) } } +#if 0 extern BOOL_T inDescribeCmd; static STATUS_T CmdBlockEdit( wAction_t action, coOrd pos ) @@ -613,14 +663,13 @@ static STATUS_T CmdBlockDelete( wAction_t action, coOrd pos ) } - #define BLOCK_CREATE 0 #define BLOCK_EDIT 1 #define BLOCK_DELETE 2 static STATUS_T CmdBlock (wAction_t action, coOrd pos ) { - fprintf(stderr,"*** CmdBlock(%08x,{%f,%f})\n",action,pos.x,pos.y); + LOG( log_block, 1, ("*** CmdBlock(%08x,{%f,%f})\n",action,pos.x,pos.y)) switch ((long)commandContext) { case BLOCK_CREATE: return CmdBlockCreate(action,pos); @@ -629,23 +678,225 @@ static STATUS_T CmdBlock (wAction_t action, coOrd pos ) default: return C_TERMINATE; } } +#endif -#include "bitmaps/blocknew.xpm" -#include "bitmaps/blockedit.xpm" -#include "bitmaps/blockdel.xpm" +EXPORT void CheckDeleteBlock (track_p t) +{ + track_p blk; + blockData_p xx; + + blk = FindBlock(t); + if (blk == NULL) return; + xx = GetblockData(blk); + NoticeMessage(_("Deleting block %s"),_("Ok"),NULL,xx->name); + DeleteTrack(blk,FALSE); +} + +static void BlockEditOk ( void * junk ) +{ + blockData_p xx; + track_p trk; + + LOG( log_block, 1, ("*** BlockEditOk()\n")) + ParamUpdate (&blockEditPG ); + if ( blockEditName[0]==0 ) { + NoticeMessage( _("Block must have a name!"), _("Ok"), NULL); + return; + } + wDrawDelayUpdate( mainD.d, TRUE ); + UndoStart( _("Modify Block"), "Modify Block" ); + trk = blockEditTrack; + xx = GetblockData( trk ); + xx->name = MyStrdup(blockEditName); + xx->script = MyStrdup(blockEditScript); + blockDebug(trk); + UndoEnd(); + wHide( blockEditW ); +} + + +static void EditBlock (track_p trk) +{ + blockData_p xx = GetblockData(trk); + wIndex_t iTrack; + BOOL_T needComma = FALSE; + char temp[32]; + + strncpy(blockEditName,xx->name,STR_SHORT_SIZE); + strncpy(blockEditScript,xx->script,STR_LONG_SIZE); + blockEditSegs[0] = '\0'; + for (iTrack = 0; iTrack < xx->numTracks ; iTrack++) { + if ((&(xx->trackList))[iTrack].t == NULL) continue; + sprintf(temp,"%d",GetTrkIndex((&(xx->trackList))[iTrack].t)); + if (needComma) strcat(blockEditSegs,", "); + strcat(blockEditSegs,temp); + needComma = TRUE; + } + blockEditTrack = trk; + if ( !blockEditW ) { + ParamRegister( &blockEditPG ); + blockEditW = ParamCreateDialog (&blockEditPG, + MakeWindowTitle(_("Edit block")), + _("Ok"), BlockEditOk, + wHide, TRUE, NULL, F_BLOCK, + NULL ); + } + ParamLoadControls( &blockEditPG ); + sprintf( message, _("Edit block %d"), GetTrkIndex(trk) ); + wWinSetTitle( blockEditW, message ); + wShow (blockEditW); +} + +static coOrd blkhiliteOrig, blkhiliteSize; +static POS_T blkhiliteBorder; +static wDrawColor blkhiliteColor = 0; +static void DrawBlockTrackHilite( void ) +{ + wPos_t x, y, w, h; + if (blkhiliteColor==0) + blkhiliteColor = wDrawColorGray(87); + w = (wPos_t)((blkhiliteSize.x/mainD.scale)*mainD.dpi+0.5); + h = (wPos_t)((blkhiliteSize.y/mainD.scale)*mainD.dpi+0.5); + mainD.CoOrd2Pix(&mainD,blkhiliteOrig,&x,&y); + wDrawFilledRectangle( mainD.d, x, y, w, h, blkhiliteColor, wDrawOptTemp ); +} + + +static int BlockMgmProc ( int cmd, void * data ) +{ + track_p trk = (track_p) data; + blockData_p xx = GetblockData(trk); + wIndex_t iTrack; + BOOL_T needComma = FALSE; + char temp[32]; + /*char msg[STR_SIZE];*/ + coOrd tempOrig, tempSize; + BOOL_T first = TRUE; + + switch ( cmd ) { + case CONTMGM_CAN_EDIT: + return TRUE; + break; + case CONTMGM_DO_EDIT: + EditBlock (trk); + /*inDescribeCmd = TRUE;*/ + /*DescribeTrack (trk, msg, sizeof msg );*/ + /*InfoMessage( msg );*/ + return TRUE; + break; + case CONTMGM_CAN_DELETE: + return TRUE; + break; + case CONTMGM_DO_DELETE: + DeleteTrack (trk, FALSE); + return TRUE; + break; + case CONTMGM_DO_HILIGHT: + if (!xx->IsHilite) { + blkhiliteBorder = mainD.scale*0.1; + if ( blkhiliteBorder < trackGauge ) blkhiliteBorder = trackGauge; + first = TRUE; + for (iTrack = 0; iTrack < xx->numTracks ; iTrack++) { + if ((&(xx->trackList))[iTrack].t == NULL) continue; + GetBoundingBox( (&(xx->trackList))[iTrack].t, &tempSize, &tempOrig ); + if (first) { + blkhiliteOrig = tempOrig; + blkhiliteSize = tempSize; + first = FALSE; + } else { + if (tempSize.x > blkhiliteSize.x) + blkhiliteSize.x = tempSize.x; + if (tempSize.y > blkhiliteSize.y) + blkhiliteSize.y = tempSize.y; + if (tempOrig.x < blkhiliteOrig.x) + blkhiliteOrig.x = tempOrig.x; + if (tempOrig.y < blkhiliteOrig.y) + blkhiliteOrig.y = tempOrig.y; + } + } + blkhiliteOrig.x -= blkhiliteBorder; + blkhiliteOrig.y -= blkhiliteBorder; + blkhiliteSize.x -= blkhiliteOrig.x-blkhiliteBorder; + blkhiliteSize.y -= blkhiliteOrig.y-blkhiliteBorder; + DrawBlockTrackHilite(); + xx->IsHilite = TRUE; + } + break; + case CONTMGM_UN_HILIGHT: + if (xx->IsHilite) { + blkhiliteBorder = mainD.scale*0.1; + if ( blkhiliteBorder < trackGauge ) blkhiliteBorder = trackGauge; + first = TRUE; + for (iTrack = 0; iTrack < xx->numTracks ; iTrack++) { + if ((&(xx->trackList))[iTrack].t == NULL) continue; + GetBoundingBox( (&(xx->trackList))[iTrack].t, &tempSize, &tempOrig ); + if (first) { + blkhiliteOrig = tempOrig; + blkhiliteSize = tempSize; + first = FALSE; + } else { + if (tempSize.x > blkhiliteSize.x) + blkhiliteSize.x = tempSize.x; + if (tempSize.y > blkhiliteSize.y) + blkhiliteSize.y = tempSize.y; + if (tempOrig.x < blkhiliteOrig.x) + blkhiliteOrig.x = tempOrig.x; + if (tempOrig.y < blkhiliteOrig.y) + blkhiliteOrig.y = tempOrig.y; + } + } + blkhiliteOrig.x -= blkhiliteBorder; + blkhiliteOrig.y -= blkhiliteBorder; + blkhiliteSize.x -= blkhiliteOrig.x-blkhiliteBorder; + blkhiliteSize.y -= blkhiliteOrig.y-blkhiliteBorder; + DrawBlockTrackHilite(); + xx->IsHilite = FALSE; + } + break; + case CONTMGM_GET_TITLE: + sprintf( message, "\t%s\t", xx->name); + for (iTrack = 0; iTrack < xx->numTracks ; iTrack++) { + if ((&(xx->trackList))[iTrack].t == NULL) continue; + sprintf(temp,"%d",GetTrkIndex((&(xx->trackList))[iTrack].t)); + if (needComma) strcat(message,", "); + strcat(message,temp); + needComma = TRUE; + } + break; + } + return FALSE; +} + + +//#include "bitmaps/blocknew.xpm" +//#include "bitmaps/blockedit.xpm" +//#include "bitmaps/blockdel.xpm" +#include "bitmaps/block.xpm" + +EXPORT void BlockMgmLoad( void ) +{ + track_p trk; + static wIcon_p blockI = NULL; + + if ( blockI == NULL) + blockI = wIconCreatePixMap( block_xpm ); + + TRK_ITERATE(trk) { + if (GetTrkType(trk) != T_BLOCK) continue; + ContMgmLoad( blockI, BlockMgmProc, (void *)trk ); + } + +} EXPORT void InitCmdBlock( wMenu_p menu ) { blockName[0] = '\0'; blockScript[0] = '\0'; - ButtonGroupBegin( _("Block"), "cmdBlockSetCmd", _("Blocks") ); - AddMenuButton( menu, CmdBlock, "cmdBlockCreate", _("Create Block"), wIconCreatePixMap(blocknew_xpm), LEVEL0_50, IC_CANCEL|IC_POPUP, ACCL_BLOCK1, (void*)BLOCK_CREATE ); - AddMenuButton( menu, CmdBlock, "cmdBlockEdit", _("Edit Block"), wIconCreatePixMap(blockedit_xpm), LEVEL0_50, IC_CANCEL|IC_POPUP, ACCL_BLOCK2, (void*)BLOCK_EDIT ); - AddMenuButton( menu, CmdBlock, "cmdBlockDelete", _("Delete Block"), wIconCreatePixMap(blockdel_xpm), LEVEL0_50, IC_CANCEL|IC_POPUP, ACCL_BLOCK3, (void*)BLOCK_DELETE ); - ButtonGroupEnd(); + AddMenuButton( menu, CmdBlockCreate, "cmdBlockCreate", _("Block"), + wIconCreatePixMap( block_xpm ), LEVEL0_50, + IC_STICKY|IC_POPUP2, ACCL_BLOCK1, NULL ); ParamRegister( &blockPG ); } -#endif EXPORT void InitTrkBlock( void ) |