summaryrefslogtreecommitdiff
path: root/app/bin/ccurve.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/bin/ccurve.c')
-rw-r--r--app/bin/ccurve.c655
1 files changed, 359 insertions, 296 deletions
diff --git a/app/bin/ccurve.c b/app/bin/ccurve.c
index 2308bd1..373a975 100644
--- a/app/bin/ccurve.c
+++ b/app/bin/ccurve.c
@@ -17,11 +17,11 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "ccurve.h"
-
+
#include "cjoin.h"
#include "cstraigh.h"
#include "cundo.h"
@@ -43,19 +43,19 @@
typedef enum createState_e {NOCURVE,FIRSTEND_DEF,SECONDEND_DEF,CENTER_DEF} createState_e;
static struct {
- STATE_T state;
- createState_e create_state;
- coOrd pos0;
- coOrd pos1;
- curveData_t curveData;
- track_p trk;
- EPINX_T ep;
- BOOL_T down;
- BOOL_T lock0;
- coOrd middle;
- coOrd end0;
- coOrd end1;
- } Da;
+ STATE_T state;
+ createState_e create_state;
+ coOrd pos0;
+ coOrd pos1;
+ curveData_t curveData;
+ track_p trk;
+ EPINX_T ep;
+ BOOL_T down;
+ BOOL_T lock0;
+ coOrd middle;
+ coOrd end0;
+ coOrd end1;
+} Da;
static long curveMode;
@@ -65,58 +65,60 @@ static dynArr_t anchors_da;
EXPORT int DrawArrowHeads(
- trkSeg_p sp,
- coOrd pos,
- ANGLE_T angle,
- BOOL_T bidirectional,
- wDrawColor color )
+ trkSeg_p sp,
+ coOrd pos,
+ ANGLE_T angle,
+ BOOL_T bidirectional,
+ wDrawColor color )
{
- coOrd p0, p1;
- DIST_T d, w;
- int inx;
- d = mainD.scale*0.25;
- w = mainD.scale/mainD.dpi*2;
- for ( inx=0; inx<5; inx++ ) {
- sp[inx].type = SEG_STRLIN;
- sp[inx].width = w;
- sp[inx].color = color;
- }
- Translate( &p0, pos, angle, d );
- Translate( &p1, pos, angle+180, bidirectional?d:(d/2.0) );
- sp[0].u.l.pos[0] = p0;
- sp[0].u.l.pos[1] = p1;
- sp[1].u.l.pos[0] = p0;
- Translate( &sp[1].u.l.pos[1], p0, angle+135, d/2.0 );
- sp[2].u.l.pos[0] = p0;
- Translate( &sp[2].u.l.pos[1], p0, angle-135, d/2.0 );
- if (bidirectional) {
- sp[3].u.l.pos[0] = p1;
- Translate( &sp[3].u.l.pos[1], p1, angle-45, d/2.0 );
- sp[4].u.l.pos[0] = p1;
- Translate( &sp[4].u.l.pos[1], p1, angle+45, d/2.0 );
- } else {
- sp[3].u.l.pos[0] = p1;
- sp[3].u.l.pos[1] = p1;
- sp[4].u.l.pos[0] = p1;
- sp[4].u.l.pos[1] = p1;
- }
- return 5;
+ coOrd p0, p1;
+ DIST_T d, w;
+ int inx;
+ d = mainD.scale*0.25;
+ w = mainD.scale/mainD.dpi*2;
+ for ( inx=0; inx<5; inx++ ) {
+ sp[inx].type = SEG_STRLIN;
+ sp[inx].lineWidth = w;
+ sp[inx].color = color;
+ }
+ Translate( &p0, pos, angle, d );
+ Translate( &p1, pos, angle+180, bidirectional?d:(d/2.0) );
+ sp[0].u.l.pos[0] = p0;
+ sp[0].u.l.pos[1] = p1;
+ sp[1].u.l.pos[0] = p0;
+ Translate( &sp[1].u.l.pos[1], p0, angle+135, d/2.0 );
+ sp[2].u.l.pos[0] = p0;
+ Translate( &sp[2].u.l.pos[1], p0, angle-135, d/2.0 );
+ if (bidirectional) {
+ sp[3].u.l.pos[0] = p1;
+ Translate( &sp[3].u.l.pos[1], p1, angle-45, d/2.0 );
+ sp[4].u.l.pos[0] = p1;
+ Translate( &sp[4].u.l.pos[1], p1, angle+45, d/2.0 );
+ } else {
+ sp[3].u.l.pos[0] = p1;
+ sp[3].u.l.pos[1] = p1;
+ sp[4].u.l.pos[0] = p1;
+ sp[4].u.l.pos[1] = p1;
+ }
+ return 5;
}
EXPORT int DrawArrowHeadsArray(
- dynArr_t *anchor_array,
- coOrd pos,
- ANGLE_T angle,
- BOOL_T bidirectional,
- wDrawColor color )
+ dynArr_t *anchor_array,
+ coOrd pos,
+ ANGLE_T angle,
+ BOOL_T bidirectional,
+ wDrawColor color )
{
int i = (*anchor_array).cnt;
DYNARR_SET(trkSeg_t,*anchor_array,i+5)
- return DrawArrowHeads(&DYNARR_N(trkSeg_t,*anchor_array,i),pos,angle,bidirectional,color);
+ return DrawArrowHeads(&DYNARR_N(trkSeg_t,*anchor_array,i),pos,angle,
+ bidirectional,color);
}
-static void CreateEndAnchor(coOrd p, dynArr_t * anchor_array, wBool_t lock) {
+static void CreateEndAnchor(coOrd p, dynArr_t * anchor_array, wBool_t lock)
+{
DIST_T d = tempD.scale*0.15;
DYNARR_APPEND(trkSeg_t,*anchor_array,1);
@@ -127,48 +129,50 @@ static void CreateEndAnchor(coOrd p, dynArr_t * anchor_array, wBool_t lock) {
array_anchor(i).u.c.radius = d/2;
array_anchor(i).u.c.a0 = 0.0;
array_anchor(i).u.c.a1 = 360.0;
- array_anchor(i).width = 0;
+ array_anchor(i).lineWidth = 0;
}
EXPORT STATUS_T CreateCurve(
- wAction_t action,
- coOrd pos,
- BOOL_T track,
- wDrawColor color,
- DIST_T width,
- long mode,
- dynArr_t * anchor_array,
- curveMessageProc message )
+ wAction_t action,
+ coOrd pos,
+ BOOL_T track,
+ wDrawColor color,
+ LWIDTH_T width,
+ long mode,
+ dynArr_t * anchor_array,
+ curveMessageProc message )
{
track_p t;
DIST_T d;
ANGLE_T a, angle1, angle2;
- static coOrd pos0, p;
+ static coOrd p;
+// static coOrd pos0;
int inx;
switch ( action ) {
case C_START:
DYNARR_RESET(trkSeg_t,*anchor_array);
- DYNARR_SET( trkSeg_t, tempSegs_da, 1 );
+ DYNARR_RESET( trkSeg_t, tempSegs_da );
Da.create_state = NOCURVE;
- tempSegs_da.cnt = 0;
Da.down = FALSE; //Not got a valid start yet
Da.pos0 = zero;
Da.pos1 = zero;
switch ( curveMode ) {
case crvCmdFromEP1:
- if (track)
+ if (track) {
message(_("Drag from endpoint in direction of curve - lock to track open endpoint") );
- else
+ } else {
message (_("Drag from endpoint in direction of curve") );
+ }
break;
case crvCmdFromTangent:
- if (track)
+ if (track) {
message(_("Drag from endpoint to center - lock to track open endpoint") );
- else
+ } else {
message(_("Drag from endpoint to center") );
+ }
break;
case crvCmdFromCenter:
message(_("Drag from center to endpoint") );
@@ -179,168 +183,178 @@ EXPORT STATUS_T CreateCurve(
}
return C_CONTINUE;
case C_DOWN:
- DYNARR_RESET(trkSeg_t, *anchor_array);
- for ( inx=0; inx<8; inx++ ) {
- tempSegs(inx).color = wDrawColorBlack;
- tempSegs(inx).width = 0;
- }
- tempSegs_da.cnt = 0;
- p = pos;
- BOOL_T found = FALSE;
- Da.trk = NULL;
- if (track) {
- if ((mode == crvCmdFromEP1 || mode == crvCmdFromTangent || (mode == crvCmdFromChord)) &&
- ((MyGetKeyState() & WKEY_ALT) == 0 ) == magneticSnap) {
- if ((t = OnTrack(&p, FALSE, TRUE)) != NULL) {
- EPINX_T ep = PickUnconnectedEndPointSilent(p, t);
- if (ep != -1) {
- if (GetTrkScale(t) != (char)GetLayoutCurScale()) {
- wBeep();
- InfoMessage(_("Track is different gauge"));
- return C_CONTINUE;
- }
- Da.trk = t;
- Da.ep = ep;
- pos = GetTrkEndPos(t, ep);
- found = TRUE;
+ DYNARR_RESET(trkSeg_t, *anchor_array);
+ DYNARR_SET( trkSeg_t, tempSegs_da, 8 );
+ for ( inx=0; inx<8; inx++ ) {
+ tempSegs(inx).color = wDrawColorBlack;
+ tempSegs(inx).lineWidth = width;
+ }
+ DYNARR_RESET( trkSeg_t, tempSegs_da );
+ p = pos;
+ BOOL_T found = FALSE;
+ Da.trk = NULL;
+ if (track) {
+ if ((mode == crvCmdFromEP1 || mode == crvCmdFromTangent
+ || (mode == crvCmdFromChord)) &&
+ ((MyGetKeyState() & WKEY_ALT) == 0 ) == magneticSnap) {
+ if ((t = OnTrack(&p, FALSE, TRUE)) != NULL) {
+ EPINX_T ep = PickUnconnectedEndPointSilent(p, t);
+ if (ep != -1) {
+ if (GetTrkScale(t) != (char)GetLayoutCurScale()) {
+ wBeep();
+ InfoMessage(_("Track is different gauge"));
+ return C_CONTINUE;
}
+ Da.trk = t;
+ Da.ep = ep;
+ pos = GetTrkEndPos(t, ep);
+ found = TRUE;
}
}
- } else {
- if (((t = OnTrack(&p, FALSE, FALSE)) != NULL) && IsClose(FindDistance(p,pos))) {
- if (!IsTrack(t)) {
- pos = p;
- found = TRUE;
- }
- }
- }
- Da.down = TRUE;
- if (!found && !track) SnapPos( &pos );
- if (mode == crvCmdFromCenter) SnapPos( &pos );
- Da.lock0 = found;
-
- if (Da.create_state == NOCURVE)
- Da.pos0 = pos;
- else
- Da.pos1 = pos;
+ }
+ } else {
+ if (((t = OnTrack(&p, FALSE, FALSE)) != NULL) && IsClose(FindDistance(p,pos))) {
+ if (!IsTrack(t)) {
+ pos = p;
+ found = TRUE;
+ }
+ }
+ }
+ Da.down = TRUE;
+ if (!found && !track) { SnapPos( &pos ); }
+ if (mode == crvCmdFromCenter) { SnapPos( &pos ); }
+ Da.lock0 = found;
- tempSegs_da.cnt = 1;
- switch (mode) {
- case crvCmdFromEP1:
- tempSegs(0).type = (track?SEG_STRTRK:SEG_STRLIN);
- tempSegs(0).color = color;
- tempSegs(0).width = width;
- Da.create_state = FIRSTEND_DEF;
- Da.end0 = pos;
- CreateEndAnchor(pos,anchor_array,found);
- if (Da.trk && !(MyGetKeyState() & WKEY_SHIFT)) message(_("End locked: Drag out curve start"));
- else if (Da.trk) message(_("End Position locked: Drag out curve start with Shift"));
- else message(_("Drag along curve start") );
- break;
- case crvCmdFromTangent:
- Da.create_state = FIRSTEND_DEF;
- tempSegs(0).type = SEG_STRLIN;
- tempSegs(0).color = color;
- Da.create_state = CENTER_DEF;
- CreateEndAnchor(pos,anchor_array,found);
- if (Da.trk && !(MyGetKeyState() & WKEY_SHIFT)) message(_("End locked: Drag out curve center"));
- else if (Da.trk) message(_("End Position locked: Drag out curve start with Shift"));
- else message(_("Drag out curve center") );
- break;
- case crvCmdFromCenter:
- tempSegs(0).type = SEG_STRLIN;
- tempSegs(0).color = color;
- Da.create_state = CENTER_DEF;
- CreateEndAnchor(pos,anchor_array,FALSE);
- message(_("Drag out from center to endpoint"));
- break;
- case crvCmdFromChord:
- tempSegs(0).type = (track?SEG_STRTRK:SEG_STRLIN);
- tempSegs(0).color = color;
- tempSegs(0).width = width;
- CreateEndAnchor(pos,anchor_array,FALSE);
- Da.create_state = FIRSTEND_DEF;
- if (Da.trk && !(MyGetKeyState() & WKEY_SHIFT))
- message( _("End locked: Drag to other end of chord") );
- else if (Da.trk) message(_("End Position locked: Drag out curve start with Shift"));
- else
- message( _("Drag to other end of chord") );
- break;
+ if (Da.create_state == NOCURVE) {
+ Da.pos0 = pos;
+ } else {
+ Da.pos1 = pos;
+ }
+
+ DYNARR_SET( trkSeg_t, tempSegs_da, 1 );
+ switch (mode) {
+ case crvCmdFromEP1:
+ tempSegs(0).type = (track?SEG_STRTRK:SEG_STRLIN);
+ tempSegs(0).color = color;
+ tempSegs(0).lineWidth = width;
+ Da.create_state = FIRSTEND_DEF;
+ Da.end0 = pos;
+ CreateEndAnchor(pos,anchor_array,found);
+ if (Da.trk && !(MyGetKeyState() & WKEY_SHIFT)) { message(_("End locked: Drag out curve start")); }
+ else if (Da.trk) { message(_("End Position locked: Drag out curve start with Shift")); }
+ else { message(_("Drag along curve start") ); }
+ break;
+ case crvCmdFromTangent:
+ Da.create_state = FIRSTEND_DEF;
+ tempSegs(0).type = SEG_STRLIN;
+ tempSegs(0).color = color;
+ Da.create_state = CENTER_DEF;
+ CreateEndAnchor(pos,anchor_array,found);
+ if (Da.trk && !(MyGetKeyState() & WKEY_SHIFT)) { message(_("End locked: Drag out curve center")); }
+ else if (Da.trk) { message(_("End Position locked: Drag out curve start with Shift")); }
+ else { message(_("Drag out curve center") ); }
+ break;
+ case crvCmdFromCenter:
+ tempSegs(0).type = SEG_STRLIN;
+ tempSegs(0).color = color;
+ Da.create_state = CENTER_DEF;
+ CreateEndAnchor(pos,anchor_array,FALSE);
+ message(_("Drag out from center to endpoint"));
+ break;
+ case crvCmdFromChord:
+ tempSegs(0).type = (track?SEG_STRTRK:SEG_STRLIN);
+ tempSegs(0).color = color;
+ tempSegs(0).lineWidth = width;
+ CreateEndAnchor(pos,anchor_array,FALSE);
+ Da.create_state = FIRSTEND_DEF;
+ if (Da.trk && !(MyGetKeyState() & WKEY_SHIFT)) {
+ message( _("End locked: Drag to other end of chord") );
+ } else if (Da.trk) { message(_("End Position locked: Drag out curve start with Shift")); }
+ else {
+ message( _("Drag to other end of chord") );
}
- tempSegs(0).u.l.pos[0] = tempSegs(0).u.l.pos[1] = pos;
+ break;
+ }
+ tempSegs(0).u.l.pos[0] = tempSegs(0).u.l.pos[1] = pos;
return C_CONTINUE;
case C_MOVE:
DYNARR_RESET(trkSeg_t,*anchor_array);
DYNARR_APPEND(trkSeg_t,*anchor_array,1);
- if (!Da.down) return C_CONTINUE;
- if (Da.trk && track && !(MyGetKeyState() & WKEY_SHIFT)) { //Shift inhibits direction lock
+ if (!Da.down) { return C_CONTINUE; }
+ if (Da.trk && track
+ && !(MyGetKeyState() & WKEY_SHIFT)) { //Shift inhibits direction lock
angle1 = NormalizeAngle(GetTrkEndAngle(Da.trk, Da.ep));
angle2 = NormalizeAngle(FindAngle(pos, Da.pos0)-angle1);
if (mode ==crvCmdFromEP1 ) {
- if (angle2 > 90.0 && angle2 < 270.0)
- Translate( &pos, Da.pos0, angle1, -FindDistance( Da.pos0, pos )*cos(D2R(angle2)) );
- else pos = Da.pos0;
+ if (angle2 > 90.0 && angle2 < 270.0) {
+ Translate( &pos, Da.pos0, angle1, -FindDistance( Da.pos0,
+ pos )*cos(D2R(angle2)) );
+ } else { pos = Da.pos0; }
} else if ( mode == crvCmdFromChord ) {
DIST_T dp = -FindDistance(Da.pos0, pos)*sin(D2R(angle2));
- if (DifferenceBetweenAngles(FindAngle(Da.pos0,pos),angle1)>0)
+ if (DifferenceBetweenAngles(FindAngle(Da.pos0,pos),angle1)>0) {
Translate( &pos, Da.pos0, angle1+90, dp );
- else
+ } else {
Translate( &pos, Da.pos0, angle1-90, -dp );
+ }
} else if (mode == crvCmdFromCenter) {
DIST_T dp = -FindDistance(Da.pos0, pos)*sin(D2R(angle2));
- if (angle2 > 90 && angle2 < 270.0)
+ if (angle2 > 90 && angle2 < 270.0) {
Translate( &pos, Da.pos0, angle1+90.0, dp );
- else
+ } else {
Translate( &pos, Da.pos0, angle1-90.0, dp );
+ }
} else if (mode == crvCmdFromTangent) {
DIST_T dp = FindDistance(Da.pos0, pos)*sin(D2R(angle2));
Translate( &pos, Da.pos0, angle1-90.0, dp );
}
- } else if (track) SnapPos(&pos);
- tempSegs_da.cnt =1;
+ } else if (track) { SnapPos(&pos); }
+ DYNARR_SET( trkSeg_t, tempSegs_da, 1 );
if (Da.trk && mode == crvCmdFromChord) {
tempSegs(0).type = SEG_CRVTRK;
tempSegs(0).u.c.center.x = (pos.x+Da.pos0.x)/2.0;
tempSegs(0).u.c.center.y = (pos.y+Da.pos0.y)/2.0;
tempSegs(0).u.c.radius = FindDistance(pos,Da.pos0)/2;
ANGLE_T a0 = FindAngle(tempSegs(0).u.c.center,Da.pos0);
- ANGLE_T a1 = FindAngle(tempSegs(0).u.c.center,pos);
- if (NormalizeAngle(a0+90-GetTrkEndAngle(Da.trk,Da.ep))<90) {
- tempSegs(0).u.c.a0 = a0;
- } else {
- tempSegs(0).u.c.a0 = a1;
+ if ( NormalizeAngle( GetTrkEndAngle(Da.trk,Da.ep) - a0 ) > 180.0 ) {
+ a0 = NormalizeAngle( a0 + 180.0 );
}
+ tempSegs(0).u.c.a0 = a0;
tempSegs(0).u.c.a1 = 180.0;
- } else tempSegs(0).u.l.pos[1] = pos;
+ } else { tempSegs(0).u.l.pos[1] = pos; }
Da.pos1 = pos;
d = FindDistance( Da.pos0, Da.pos1 );
a = FindAngle( Da.pos0, Da.pos1 );
switch ( mode ) {
case crvCmdFromEP1:
- if (Da.trk) message( _("Start Locked: Drag out curve start - Angle=%0.3f"), PutAngle(a));
- else message( _("Drag out curve start - Angle=%0.3f"), PutAngle(a) );
+ if (Da.trk) { message( _("Start Locked: Drag out curve start - Angle=%0.3f"), PutAngle(a)); }
+ else { message( _("Drag out curve start - Angle=%0.3f"), PutAngle(a) ); }
CreateEndAnchor(Da.pos0,anchor_array,Da.lock0);
- DrawArrowHeadsArray( anchor_array, pos, FindAngle(Da.pos0,Da.pos1)+90, TRUE, wDrawColorBlue );
- tempSegs_da.cnt = 1;
+ DrawArrowHeadsArray( anchor_array, pos, FindAngle(Da.pos0,Da.pos1)+90, TRUE,
+ wDrawColorBlue );
+ DYNARR_SET( trkSeg_t, tempSegs_da, 1 );
break;
case crvCmdFromTangent:
- if (Da.trk) message( _("Tangent locked: Drag out center - Radius=%s Angle=%0.3f"), FormatDistance(d), PutAngle(a) );
- else message( _("Drag out center - Radius=%s Angle=%0.3f"), FormatDistance(d), PutAngle(a) );
+ if (Da.trk) { message( _("Tangent locked: Drag out center - Radius=%s Angle=%0.3f"), FormatDistance(d), PutAngle(a) ); }
+ else { message( _("Drag out center - Radius=%s Angle=%0.3f"), FormatDistance(d), PutAngle(a) ); }
CreateEndAnchor(Da.pos1,anchor_array,TRUE);
- DrawArrowHeadsArray( anchor_array, Da.pos0, FindAngle(Da.pos0,Da.pos1)+90, TRUE, wDrawColorBlue );
- tempSegs_da.cnt = 1;
+ DrawArrowHeadsArray( anchor_array, Da.pos0, FindAngle(Da.pos0,Da.pos1)+90, TRUE,
+ wDrawColorBlue );
+ DYNARR_SET( trkSeg_t, tempSegs_da, 1 );
break;
case crvCmdFromCenter:
- message( _("Drag to Edge: Radius=%s Angle=%0.3f"), FormatDistance(d), PutAngle(a) );
+ message( _("Drag to Edge: Radius=%s Angle=%0.3f"), FormatDistance(d),
+ PutAngle(a) );
CreateEndAnchor(Da.pos0,anchor_array,Da.lock0);
- DrawArrowHeadsArray( anchor_array, Da.pos1, FindAngle(Da.pos1,Da.pos0)+90, TRUE, wDrawColorBlue );
- tempSegs_da.cnt = 1;
+ DrawArrowHeadsArray( anchor_array, Da.pos1, FindAngle(Da.pos1,Da.pos0)+90, TRUE,
+ wDrawColorBlue );
+ DYNARR_SET( trkSeg_t, tempSegs_da, 1 );
break;
case crvCmdFromChord:
- if (Da.trk) message( _("Start locked: Drag out chord length=%s angle=%0.3f"), FormatDistance(d), PutAngle(a) );
- else message( _("Drag out chord length=%s angle=%0.3f"), FormatDistance(d), PutAngle(a) );
+ if (Da.trk) { message( _("Start locked: Drag out chord length=%s angle=%0.3f"), FormatDistance(d), PutAngle(a) ); }
+ else { message( _("Drag out chord length=%s angle=%0.3f"), FormatDistance(d), PutAngle(a) ); }
Da.middle.x = (Da.pos1.x+Da.pos0.x)/2.0;
Da.middle.y = (Da.pos1.y+Da.pos0.y)/2.0;
if (track && Da.trk) {
@@ -349,20 +363,23 @@ EXPORT STATUS_T CreateCurve(
}
CreateEndAnchor(Da.pos0,anchor_array,TRUE);
CreateEndAnchor(Da.pos1,anchor_array,FALSE);
- if (!track || !Da.trk)
- DrawArrowHeadsArray( anchor_array, Da.middle, FindAngle(Da.pos0,Da.pos1)+90, TRUE, wDrawColorBlue );
+ if (!track || !Da.trk) {
+ DrawArrowHeadsArray( anchor_array, Da.middle, FindAngle(Da.pos0,Da.pos1)+90,
+ TRUE, wDrawColorBlue );
+ }
break;
}
return C_CONTINUE;
case C_UP:
/* Note - no anchor reset - assumes run after Down/Move */
- if (!Da.down) return C_CONTINUE;
+ if (!Da.down) { return C_CONTINUE; }
if (Da.trk) {
angle1 = NormalizeAngle(GetTrkEndAngle(Da.trk, Da.ep));
angle2 = NormalizeAngle(FindAngle(pos, Da.pos0)-angle1);
if (mode == crvCmdFromEP1) {
- if (angle2 > 90.0 && angle2 < 270.0) {
- Translate( &pos, Da.pos0, angle1, -FindDistance( Da.pos0, pos )*cos(D2R(angle2)) );
+ if (angle2 > 90.0 && angle2 < 270.0) {
+ Translate( &pos, Da.pos0, angle1, -FindDistance( Da.pos0,
+ pos )*cos(D2R(angle2)) );
Da.pos1 = pos;
} else {
ErrorMessage( MSG_TRK_TOO_SHORT, "Curved ", PutDim(0.0) );
@@ -374,23 +391,25 @@ EXPORT STATUS_T CreateCurve(
Da.pos1 = pos;
} else {
DIST_T dp = -FindDistance(Da.pos0, pos)*sin(D2R(angle2));
- if (angle2 > 180.0)
+ if (angle2 > 180.0) {
Translate( &pos, Da.pos0, angle1+90.0, dp );
- else
+ } else {
Translate( &pos, Da.pos0, angle1-90.0, dp );
+ }
Da.pos1 = pos;
}
if (FindDistance(Da.pos0,Da.pos1)<minLength) {
- ErrorMessage( MSG_TRK_TOO_SHORT, "Curved ", PutDim(FindDistance(Da.pos0,Da.pos1)) );
+ ErrorMessage( MSG_TRK_TOO_SHORT, "Curved ", PutDim(FindDistance(Da.pos0,
+ Da.pos1)) );
return C_TERMINATE;
}
}
switch (mode) {
- case crvCmdFromEP1:
+ case crvCmdFromEP1:
case crvCmdFromTangent:
case crvCmdFromCenter:
case crvCmdFromChord:
- for (int i=0;i<(*anchor_array).cnt;i++) {
+ for (int i=0; i<(*anchor_array).cnt; i++) {
DYNARR_N(trkSeg_t,*anchor_array,i).color = drawColorRed;
}
break;
@@ -434,7 +453,7 @@ static STATUS_T CmdCurve( wAction_t action, coOrd pos )
curveMode = VP2L(commandContext);
Da.state = -1;
Da.pos0 = pos;
- tempSegs_da.cnt = 0;
+ DYNARR_RESET( trkSeg_t, tempSegs_da );
segCnt = 0;
STATUS_T rcode;
DYNARR_RESET(trkSeg_t,anchors_da);
@@ -442,16 +461,18 @@ static STATUS_T CmdCurve( wAction_t action, coOrd pos )
ParamCreateControls(&curvePG, NULL);
}
SetAllTrackSelect(FALSE);
- return CreateCurve( action, pos, TRUE, wDrawColorBlack, 0, curveMode, &anchors_da, InfoMessage );
+ return CreateCurve( action, pos, TRUE, wDrawColorBlack, 0, curveMode,
+ &anchors_da, InfoMessage );
case C_DOWN:
if (Da.state == -1) {
- if (lock) pos = movePos;
+ if (lock) { pos = movePos; }
Da.pos0 = Da.pos1 = pos;
Da.state = 0;
- rcode = CreateCurve( action, pos, TRUE, wDrawColorBlack, 0, curveMode, &anchors_da, InfoMessage );
+ rcode = CreateCurve( action, pos, TRUE, wDrawColorBlack, 0, curveMode,
+ &anchors_da, InfoMessage );
segCnt = tempSegs_da.cnt ;
- if (!Da.down) Da.state = -1;
+ if (!Da.down) { Da.state = -1; }
return rcode;
//Da.pos0 = pos;
}
@@ -462,7 +483,7 @@ static STATUS_T CmdCurve( wAction_t action, coOrd pos )
}
infoSubst = FALSE;
//This is where the user could adjust - if we allow that?
- tempSegs_da.cnt = segCnt;
+ DYNARR_SET( trkSeg_t, tempSegs_da, segCnt );
return C_CONTINUE;
@@ -492,78 +513,89 @@ static STATUS_T CmdCurve( wAction_t action, coOrd pos )
return C_CONTINUE;
case C_MOVE:
- if (Da.state<0) return C_CONTINUE;
+ if (Da.state<0) { return C_CONTINUE; }
if ( Da.state == 0 ) {
- Da.pos1 = pos;
- rc = CreateCurve( action, pos, TRUE, wDrawColorBlack, 0, curveMode, &anchors_da, InfoMessage );
+ Da.pos1 = pos;
+ rc = CreateCurve( action, pos, TRUE, wDrawColorBlack, 0, curveMode, &anchors_da,
+ InfoMessage );
segCnt = tempSegs_da.cnt ;
} else {
DYNARR_RESET(trkSeg_t,anchors_da);
// SnapPos( &pos );
- tempSegs_da.cnt = segCnt;
- if (Da.trk) PlotCurve( curveMode, Da.pos0, Da.pos1, pos, &Da.curveData, FALSE, desired_radius );
- else PlotCurve( curveMode, Da.pos0, Da.pos1, pos, &Da.curveData, TRUE, desired_radius );
+ DYNARR_SET( trkSeg_t, tempSegs_da, segCnt );
+ if (Da.trk) { PlotCurve( curveMode, Da.pos0, Da.pos1, pos, &Da.curveData, FALSE, desired_radius ); }
+ else { PlotCurve( curveMode, Da.pos0, Da.pos1, pos, &Da.curveData, TRUE, desired_radius ); }
if (Da.curveData.type == curveTypeStraight) {
+ DYNARR_SET( trkSeg_t, tempSegs_da, 1 );
tempSegs(0).type = SEG_STRTRK;
tempSegs(0).u.l.pos[0] = Da.pos0;
tempSegs(0).u.l.pos[1] = Da.curveData.pos1;
- tempSegs_da.cnt = 1;
segCnt = 1;
InfoMessage( _("Straight Track: Length=%s Angle=%0.3f"),
- FormatDistance(FindDistance( Da.pos0, Da.curveData.pos1 )),
- PutAngle(FindAngle( Da.pos0, Da.curveData.pos1 )) );
- DrawArrowHeadsArray(&anchors_da,Da.curveData.pos1,FindAngle(Da.pos0, Da.curveData.pos1)+90,TRUE,wDrawColorRed);
+ FormatDistance(FindDistance( Da.pos0, Da.curveData.pos1 )),
+ PutAngle(FindAngle( Da.pos0, Da.curveData.pos1 )) );
+ DrawArrowHeadsArray(&anchors_da,Da.curveData.pos1,FindAngle(Da.pos0,
+ Da.curveData.pos1)+90,TRUE,wDrawColorRed);
} else if (Da.curveData.type == curveTypeNone) {
- tempSegs_da.cnt = 0;
+ DYNARR_RESET( trkSeg_t, tempSegs_da );
segCnt = 0;
InfoMessage( _("Back") );
} else if (Da.curveData.type == curveTypeCurve) {
+ DYNARR_SET( trkSeg_t, tempSegs_da, 1 );
tempSegs(0).type = SEG_CRVTRK;
tempSegs(0).u.c.center = Da.curveData.curvePos;
tempSegs(0).u.c.radius = Da.curveData.curveRadius;
tempSegs(0).u.c.a0 = Da.curveData.a0;
tempSegs(0).u.c.a1 = Da.curveData.a1;
- tempSegs_da.cnt = 1;
segCnt = 1;
d = D2R(Da.curveData.a1);
- if (d < 0.0)
+ if (d < 0.0) {
d = 2*M_PI+d;
+ }
if ( d*Da.curveData.curveRadius > mapD.size.x+mapD.size.y ) {
ErrorMessage( MSG_CURVE_TOO_LARGE );
- tempSegs_da.cnt = 0;
+ DYNARR_RESET( trkSeg_t, tempSegs_da );
Da.curveData.type = curveTypeNone;
return C_CONTINUE;
}
InfoMessage( _("Curved Track: Radius=%s Angle=%0.3f Length=%s"),
- FormatDistance(Da.curveData.curveRadius), Da.curveData.a1,
- FormatDistance(Da.curveData.curveRadius*d) );
+ FormatDistance(Da.curveData.curveRadius), Da.curveData.a1,
+ FormatDistance(Da.curveData.curveRadius*d) );
coOrd pos1;
- Translate(&pos1,Da.curveData.curvePos,Da.curveData.a0+Da.curveData.a1,Da.curveData.curveRadius);
- if (curveMode == crvCmdFromEP1 || curveMode == crvCmdFromChord)
- DrawArrowHeadsArray(&anchors_da,pos,FindAngle(Da.curveData.curvePos,pos),TRUE,wDrawColorRed);
- else if (curveMode == crvCmdFromTangent || curveMode == crvCmdFromCenter) {
- if (Da.curveData.curveRadius == desired_radius)
+ Translate(&pos1,Da.curveData.curvePos,Da.curveData.a0+Da.curveData.a1,
+ Da.curveData.curveRadius);
+ if (curveMode == crvCmdFromEP1 || curveMode == crvCmdFromChord) {
+ DrawArrowHeadsArray(&anchors_da,pos,FindAngle(Da.curveData.curvePos,pos),TRUE,
+ wDrawColorRed);
+ } else if (curveMode == crvCmdFromTangent || curveMode == crvCmdFromCenter) {
+ if (Da.curveData.curveRadius == desired_radius) {
CreateEndAnchor(Da.curveData.pos2,&anchors_da,TRUE);
- else
+ } else {
CreateEndAnchor(Da.curveData.pos2,&anchors_da,FALSE);
- DrawArrowHeadsArray(&anchors_da,Da.curveData.pos2,FindAngle(Da.curveData.curvePos,Da.curveData.pos2)+90,TRUE,wDrawColorRed);
+ }
+ DrawArrowHeadsArray(&anchors_da,Da.curveData.pos2,
+ FindAngle(Da.curveData.curvePos,Da.curveData.pos2)+90,TRUE,wDrawColorRed);
}
- if (Da.curveData.curveRadius == desired_radius)
+ if (Da.curveData.curveRadius == desired_radius) {
CreateEndAnchor(Da.curveData.curvePos,&anchors_da,TRUE);
- else
+ } else {
CreateEndAnchor(Da.curveData.curvePos,&anchors_da,FALSE);
+ }
}
}
return rc;
case C_TEXT:
- if ( Da.state == 0 )
- return CreateCurve( action, pos, TRUE, wDrawColorBlack, 0, curveMode, &anchors_da, InfoMessage );
- /*no break*/
+ if ( Da.state == 0 ) {
+ return CreateCurve( action, pos, TRUE, wDrawColorBlack, 0, curveMode,
+ &anchors_da, InfoMessage );
+ }
+ /*no break*/
case C_UP:
- if (Da.state<0) return C_CONTINUE;
- if (Da.state == 0 && ((curveMode != crvCmdFromChord) || (curveMode == crvCmdFromChord && !Da.trk))) {
+ if (Da.state<0) { return C_CONTINUE; }
+ if (Da.state == 0 && ((curveMode != crvCmdFromChord)
+ || (curveMode == crvCmdFromChord && !Da.trk))) {
//SnapPos( &pos );
//Da.pos1 = pos;
if ((d = FindDistance(Da.pos0,Da.pos1))<minLength) {
@@ -571,8 +603,9 @@ static STATUS_T CmdCurve( wAction_t action, coOrd pos )
return C_TERMINATE;
}
Da.state = 1;
- CreateCurve( action, pos, TRUE, wDrawColorBlack, 0, curveMode, &anchors_da, InfoMessage );
- tempSegs_da.cnt = 1;
+ CreateCurve( action, pos, TRUE, wDrawColorBlack, 0, curveMode, &anchors_da,
+ InfoMessage );
+ DYNARR_SET( trkSeg_t, tempSegs_da, 1 );
segCnt = tempSegs_da.cnt;
sprintf(message, "desired_radius-%s", curScaleName);
@@ -594,9 +627,10 @@ static STATUS_T CmdCurve( wAction_t action, coOrd pos )
ErrorMessage( MSG_TRK_TOO_SHORT, "Curved ", PutDim(fabs(minLength-d)) );
return C_TERMINATE;
}
- PlotCurve( curveMode, Da.pos0, Da.pos1, Da.middle, &Da.curveData, TRUE, desired_radius );
+ PlotCurve( curveMode, Da.pos0, Da.pos1, Da.middle, &Da.curveData, TRUE,
+ desired_radius );
}
- tempSegs_da.cnt = 0;
+ DYNARR_RESET( trkSeg_t, tempSegs_da );
segCnt = 0;
Da.state = -1;
DYNARR_RESET(trkSeg_t,anchors_da); // No More anchors for this one
@@ -609,21 +643,22 @@ static STATUS_T CmdCurve( wAction_t action, coOrd pos )
t = NewStraightTrack( Da.pos0, Da.curveData.pos1 );
if (Da.trk && !(MyGetKeyState() & WKEY_SHIFT)) {
EPINX_T ep = PickUnconnectedEndPoint(Da.pos0, t);
- if (ep != -1) ConnectTracks(Da.trk, Da.ep, t, ep);
+ if (ep != -1) { ConnectTracks(Da.trk, Da.ep, t, ep); }
}
UndoEnd();
} else if (Da.curveData.type == curveTypeCurve) {
- if ((d = Da.curveData.curveRadius * Da.curveData.a1 *2.0*M_PI/360.0) < minLength) {
+ if ((d = Da.curveData.curveRadius * Da.curveData.a1 *2.0*M_PI/360.0) <
+ minLength) {
ErrorMessage( MSG_TRK_TOO_SHORT, "Curved ", PutDim(fabs(minLength-d)) );
return C_TERMINATE;
}
UndoStart( _("Create Curved Track"), "newCurve - curve" );
t = NewCurvedTrack( Da.curveData.curvePos, Da.curveData.curveRadius,
- Da.curveData.a0, Da.curveData.a1, 0 );
+ Da.curveData.a0, Da.curveData.a1, 0 );
if (Da.trk && !(MyGetKeyState() & WKEY_SHIFT)) {
EPINX_T ep = PickUnconnectedEndPoint(Da.pos0, t);
- if (ep != -1) ConnectTracks(Da.trk, Da.ep, t, ep);
+ if (ep != -1) { ConnectTracks(Da.trk, Da.ep, t, ep); }
}
UndoEnd();
} else {
@@ -634,15 +669,15 @@ static STATUS_T CmdCurve( wAction_t action, coOrd pos )
case C_REDRAW:
if ( Da.state >= 0 ) {
- DrawSegs( &tempD, zero, 0.0, &tempSegs(0), tempSegs_da.cnt, trackGauge, wDrawColorBlack );
+ DrawSegsDA( &tempD, NULL, zero, 0.0, &tempSegs_da, trackGauge, wDrawColorBlack,
+ 0 );
}
- if (anchors_da.cnt)
- DrawSegs( &tempD, zero, 0.0, &anchors(0), anchors_da.cnt, trackGauge, wDrawColorBlack );
+ DrawSegsDA( &tempD, NULL, zero, 0.0, &anchors_da, trackGauge, wDrawColorBlack,
+ 0 );
return C_CONTINUE;
case C_CANCEL:
if (Da.state == 1) {
- tempSegs_da.cnt = 0;
Da.trk = NULL;
}
DYNARR_RESET(trkSeg_t,anchors_da);
@@ -695,24 +730,27 @@ static paramData_t helixPLs[] = {
{ PD_FLOAT, &helixGrade, "grade", 0, &r0_100, N_("Grade") },
{ PD_FLOAT, &helixVertSep, "vertSep", PDO_DIM, &r0_1000000, N_("Vertical Separation") },
#define I_HELIXMSG (6)
- { PD_MESSAGE, N_("Total Length"), NULL, PDO_DLGRESETMARGIN, I2VP(200) } };
+ { PD_MESSAGE, N_("Total Length"), NULL, PDO_DLGRESETMARGIN, I2VP(200) }
+};
static paramGroup_t helixPG = { "helix", PGO_PREFMISCGROUP, helixPLs, COUNT( helixPLs ) };
static paramData_t circleRadiusPLs[] = {
- { PD_FLOAT, &circleRadius, "radius", PDO_DIM, &r1_10000 } };
+ { PD_FLOAT, &circleRadius, "radius", PDO_DIM, &r1_10000 }
+};
static paramGroup_t circleRadiusPG = { "circle", 0, circleRadiusPLs, COUNT( circleRadiusPLs ) };
static void ComputeHelix(
- paramGroup_p pg,
- int h_inx,
- void * data )
+ paramGroup_p pg,
+ int h_inx,
+ void * data )
{
DIST_T totTurns;
DIST_T length;
long updates = 0;
- if ( h_inx < 0 || h_inx >= COUNT( h_orders ) )
+ if ( h_inx < 0 || h_inx >= COUNT( h_orders ) ) {
return;
+ }
ParamLoadData( &helixPG );
totTurns = helixTurns + helixAngSep/360.0;
length = totTurns * helixRadius * (2 * M_PI);
@@ -720,7 +758,7 @@ static void ComputeHelix(
switch ( h_inx ) {
case H_ELEV:
if (h_orders[H_TURNS]<h_orders[H_VERTSEP] &&
- origVertSep > 0.0) {
+ origVertSep > 0.0) {
helixTurns = (int)floor(helixElev/origVertSep - helixAngSep/360.0);
totTurns = helixTurns + helixAngSep/360.0;
updates |= (1<<H_TURNS);
@@ -753,7 +791,7 @@ static void ComputeHelix(
}
if ( totTurns > 0.0 ) {
if ( h_orders[H_RADIUS]>=h_orders[H_GRADE] ||
- (helixGrade==0.0 && totTurns>0 && helixRadius>0) ) {
+ (helixGrade==0.0 && totTurns>0 && helixRadius>0) ) {
if ( helixRadius > 0.0 ) {
helixGrade = helixElev/(totTurns*helixRadius*(2*M_PI))*100.0;
updates |= (1<<H_GRADE);
@@ -767,13 +805,15 @@ static void ComputeHelix(
}
length = totTurns * helixRadius * (2 * M_PI);
for ( h_inx=0; updates; h_inx++,updates>>=1 ) {
- if ( (updates&1) )
+ if ( (updates&1) ) {
ParamLoadControl( &helixPG, h_inx );
+ }
}
- if (length > 0.0)
+ if (length > 0.0) {
sprintf( message, _("Total Length %s"), FormatDistance(length) );
- else
+ } else {
strcpy( message, " " );
+ }
ParamLoadMessage( &helixPG, I_HELIXMSG, message );
}
@@ -787,8 +827,8 @@ static void HelixCancel( wWin_p win )
static void ChangeHelixW( long changes )
{
if ( (changes & CHANGE_UNITS) &&
- helixW != NULL &&
- wWinIsVisible(helixW) ) {
+ helixW != NULL &&
+ wWinIsVisible(helixW) ) {
ParamLoadControls( &helixPG );
ComputeHelix( NULL, 6, NULL );
}
@@ -808,8 +848,10 @@ static STATUS_T CmdCircleCommon( wAction_t action, coOrd pos, BOOL_T helix )
case C_START:
if (helix) {
- if (helixW == NULL)
- helixW = ParamCreateDialog(&helixPG, MakeWindowTitle(_("Helix")), NULL, NULL, HelixCancel, TRUE, NULL, 0, ComputeHelix);
+ if (helixW == NULL) {
+ helixW = ParamCreateDialog(&helixPG, MakeWindowTitle(_("Helix")), NULL, NULL,
+ HelixCancel, TRUE, NULL, 0, ComputeHelix);
+ }
ParamLoadControls(&helixPG);
ParamGroupRecord(&helixPG);
ComputeHelix(NULL, 6, NULL);
@@ -837,12 +879,10 @@ static STATUS_T CmdCircleCommon( wAction_t action, coOrd pos, BOOL_T helix )
}
}
SetAllTrackSelect( FALSE );
- tempSegs_da.cnt = 0;
+ DYNARR_RESET( trkSeg_t, tempSegs_da );
return C_CONTINUE;
case C_DOWN:
- DYNARR_SET(trkSeg_t, tempSegs_da, 1);
- tempSegs_da.cnt = 0;
if (helix) {
if (helixRadius <= 0.0) {
ErrorMessage(MSG_RADIUS_GTR_0);
@@ -873,13 +913,14 @@ static STATUS_T CmdCircleCommon( wAction_t action, coOrd pos, BOOL_T helix )
}
}
SnapPos(&pos);
- tempSegs(0).u.c.center = pos0 = pos;
- tempSegs(0).color = wDrawColorBlack;
- tempSegs(0).width = 0;
+ DYNARR_RESET(trkSeg_t, tempSegs_da);
+ pos0 = pos;
return C_CONTINUE;
case C_MOVE:
SnapPos(&pos);
+ DYNARR_SET( trkSeg_t, tempSegs_da, 1 );
+ tempSegs(0).type = SEG_CRVTRK;
tempSegs(0).u.c.center = pos;
if (!helix) {
switch (circleMode) {
@@ -896,11 +937,11 @@ static STATUS_T CmdCircleCommon( wAction_t action, coOrd pos, BOOL_T helix )
break;
}
}
- tempSegs(0).type = SEG_CRVTRK;
+ tempSegs(0).color = wDrawColorBlack;
+ tempSegs(0).lineWidth = 0;
tempSegs(0).u.c.radius = helix ? helixRadius : circleRadius;
tempSegs(0).u.c.a0 = 0.0;
tempSegs(0).u.c.a1 = 360.0;
- tempSegs_da.cnt = 1;
return C_CONTINUE;
case C_UP:
@@ -933,22 +974,25 @@ static STATUS_T CmdCircleCommon( wAction_t action, coOrd pos, BOOL_T helix )
}
UndoEnd();
DrawNewTrack(t);
- if (helix)
+ if (helix) {
wHide( helixW );
- else
+ } else {
InfoSubstituteControls( NULL, NULL );
- tempSegs_da.cnt = 0;
+ }
+ DYNARR_RESET( trkSeg_t, tempSegs_da );
return C_TERMINATE;
case C_REDRAW:
- DrawSegs( &tempD, zero, 0.0, &tempSegs(0), tempSegs_da.cnt, trackGauge, wDrawColorBlack );
+ DrawSegsDA( &tempD, NULL, zero, 0.0, &tempSegs_da, trackGauge, wDrawColorBlack,
+ 0 );
return C_CONTINUE;
case C_CANCEL:
- if (helix)
+ if (helix) {
wHide( helixW );
- else
+ } else {
InfoSubstituteControls( NULL, NULL );
+ }
return C_CONTINUE;
default:
@@ -971,31 +1015,50 @@ static STATUS_T CmdHelix( wAction_t action, coOrd pos )
return CmdCircleCommon( action, pos, TRUE );
}
-#include "bitmaps/curved-end.xpm"
-#include "bitmaps/curved-tangent.xpm"
-#include "bitmaps/curved-middle.xpm"
-#include "bitmaps/curved-chord.xpm"
-#include "bitmaps/bezier-track.xpm"
-#include "bitmaps/cornu.xpm"
-#include "bitmaps/circle.xpm"
-#include "bitmaps/circle-tangent.xpm"
-#include "bitmaps/circle-center.xpm"
+#include "bitmaps/curved-end.xpm3"
+#include "bitmaps/curved-tangent.xpm3"
+#include "bitmaps/curved-middle.xpm3"
+#include "bitmaps/curved-chord.xpm3"
+#include "bitmaps/bezier-track.xpm3"
+#include "bitmaps/cornu.xpm3"
+#include "bitmaps/circle.xpm3"
+#include "bitmaps/circle-tangent.xpm3"
+#include "bitmaps/circle-center.xpm3"
+// #include "bitmaps/helix.xpm"
EXPORT void InitCmdCurve( wMenu_p menu )
{
ButtonGroupBegin( _("Curve Track"), "cmdCurveSetCmd", _("Curve Tracks") );
- AddMenuButton( menu, CmdCurve, "cmdCurveEndPt", _("Curve from End-Pt"), wIconCreatePixMap( curved_end_xpm[iconSize] ), LEVEL0_50, IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_CURVE1, I2VP(0) );
- AddMenuButton( menu, CmdCurve, "cmdCurveTangent", _("Curve from Tangent"), wIconCreatePixMap( curved_tangent_xpm[iconSize] ), LEVEL0_50, IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_CURVE2, I2VP(1) );
- AddMenuButton( menu, CmdCurve, "cmdCurveCenter", _("Curve from Center"), wIconCreatePixMap( curved_middle_xpm[iconSize] ), LEVEL0_50, IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_CURVE3, I2VP(2) );
- AddMenuButton( menu, CmdCurve, "cmdCurveChord", _("Curve from Chord"), wIconCreatePixMap( curved_chord_xpm[iconSize] ), LEVEL0_50, IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_CURVE4, I2VP(3) );
- AddMenuButton( menu, CmdBezCurve, "cmdBezier", _("Bezier Curve"), wIconCreatePixMap( bezier_track_xpm[iconSize] ), LEVEL0_50, IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_BEZIER, I2VP(bezCmdCreateTrack) );
- AddMenuButton( menu, CmdCornu, "cmdCornu", _("Cornu Curve"), wIconCreatePixMap( cornu_xpm[iconSize] ), LEVEL0_50, IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_CORNU, I2VP(cornuCmdCreateTrack));
+ AddMenuButton( menu, CmdCurve, "cmdCurveEndPt", _("Curve from End-Pt"),
+ wIconCreatePixMap( curved_end_xpm3[iconSize] ), LEVEL0_50,
+ IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_CURVE1, I2VP(0) );
+ AddMenuButton( menu, CmdCurve, "cmdCurveTangent", _("Curve from Tangent"),
+ wIconCreatePixMap( curved_tangent_xpm3[iconSize] ), LEVEL0_50,
+ IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_CURVE2, I2VP(1) );
+ AddMenuButton( menu, CmdCurve, "cmdCurveCenter", _("Curve from Center"),
+ wIconCreatePixMap( curved_middle_xpm3[iconSize] ), LEVEL0_50,
+ IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_CURVE3, I2VP(2) );
+ AddMenuButton( menu, CmdCurve, "cmdCurveChord", _("Curve from Chord"),
+ wIconCreatePixMap( curved_chord_xpm3[iconSize] ), LEVEL0_50,
+ IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_CURVE4, I2VP(3) );
+ AddMenuButton( menu, CmdBezCurve, "cmdBezier", _("Bezier Curve"),
+ wIconCreatePixMap( bezier_track_xpm3[iconSize] ), LEVEL0_50,
+ IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_BEZIER, I2VP(bezCmdCreateTrack) );
+ AddMenuButton( menu, CmdCornu, "cmdCornu", _("Cornu Curve"),
+ wIconCreatePixMap( cornu_xpm3[iconSize] ), LEVEL0_50,
+ IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_CORNU, I2VP(cornuCmdCreateTrack));
ButtonGroupEnd();
ButtonGroupBegin( _("Circle Track"), "cmdCircleSetCmd", _("Circle Tracks") );
- AddMenuButton( menu, CmdCircle, "cmdCircleFixedRadius", _("Fixed Radius Circle"), wIconCreatePixMap( circle_xpm[iconSize] ), LEVEL0_50, IC_STICKY|IC_POPUP2, ACCL_CIRCLE1, I2VP(0) );
- AddMenuButton( menu, CmdCircle, "cmdCircleTangent", _("Circle from Tangent"), wIconCreatePixMap( circle_tangent_xpm[iconSize] ), LEVEL0_50, IC_STICKY|IC_POPUP2, ACCL_CIRCLE2, I2VP(1) );
- AddMenuButton( menu, CmdCircle, "cmdCircleCenter", _("Circle from Center"), wIconCreatePixMap( circle_center_xpm[iconSize] ), LEVEL0_50, IC_STICKY|IC_POPUP2, ACCL_CIRCLE3, I2VP(2) );
+ AddMenuButton( menu, CmdCircle, "cmdCircleFixedRadius",
+ _("Fixed Radius Circle"), wIconCreatePixMap( circle_xpm3[iconSize] ), LEVEL0_50,
+ IC_STICKY|IC_POPUP2, ACCL_CIRCLE1, I2VP(0) );
+ AddMenuButton( menu, CmdCircle, "cmdCircleTangent", _("Circle from Tangent"),
+ wIconCreatePixMap( circle_tangent_xpm3[iconSize] ), LEVEL0_50,
+ IC_STICKY|IC_POPUP2, ACCL_CIRCLE2, I2VP(1) );
+ AddMenuButton( menu, CmdCircle, "cmdCircleCenter", _("Circle from Center"),
+ wIconCreatePixMap( circle_center_xpm3[iconSize] ), LEVEL0_50,
+ IC_STICKY|IC_POPUP2, ACCL_CIRCLE3, I2VP(2) );
ButtonGroupEnd();
ParamRegister( &circleRadiusPG );
@@ -1013,8 +1076,8 @@ EXPORT void InitCmdCurve( wMenu_p menu )
void InitCmdHelix(wMenu_p menu)
{
- AddMenuButton(menu, CmdHelix, "cmdHelix", _("Helix"), NULL, LEVEL0_50,
- IC_STICKY|IC_INITNOTSTICKY|IC_POPUP2, ACCL_HELIX, NULL);
- ParamRegister(&helixPG);
- RegisterChangeNotification(ChangeHelixW);
+ AddMenuButton(menu, CmdHelix, "cmdHelix", _("Helix"), NULL, LEVEL0_50,
+ IC_STICKY|IC_INITNOTSTICKY|IC_POPUP2, ACCL_HELIX, NULL);
+ ParamRegister(&helixPG);
+ RegisterChangeNotification(ChangeHelixW);
}