summaryrefslogtreecommitdiff
path: root/app/bin/cjoin.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2018-03-19 19:56:15 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2018-03-19 19:56:15 +0100
commit1542c122b3672fe83e027411ad2445772e2d0ed3 (patch)
treee535bc621bd7ffa9d5ce89e0d495df5d1c4ab6fd /app/bin/cjoin.c
parent773810e6583142d7d15263e6481c42aebed6d7f1 (diff)
parentd1a8285f818eb7e5c3d6a05709ea21a808490b8c (diff)
Update upstream source from tag 'upstream/5.1.0'
Update to upstream version '5.1.0' with Debian dir 93ca74b8b4602fce4c9c7740e0cfdde25f086673
Diffstat (limited to 'app/bin/cjoin.c')
-rw-r--r--app/bin/cjoin.c105
1 files changed, 51 insertions, 54 deletions
diff --git a/app/bin/cjoin.c b/app/bin/cjoin.c
index e8d72eb..8cfa3d4 100644
--- a/app/bin/cjoin.c
+++ b/app/bin/cjoin.c
@@ -29,7 +29,15 @@
#include "ccurve.h"
#include "cstraigh.h"
#include "cjoin.h"
+#include "ccornu.h"
#include "i18n.h"
+#include "utility.h"
+#include "math.h"
+#include "messages.h"
+#include "param.h"
+#include "cundo.h"
+#include "cselect.h"
+#include "fileio.h"
static int log_join = 0;
@@ -444,18 +452,25 @@ static STATUS_T CmdJoin(
DIST_T eR[2];
BOOL_T ok;
- switch (action) {
+ switch (action&0xFF) {
case C_START:
- InfoMessage( _("Left click - join with track, Shift Left click - move to join") );
+ if (selectedTrackCount==0)
+ InfoMessage( _("Left click - join with track") );
+ else
+ InfoMessage( _("Left click - join with track, Shift Left click - move to join") );
Dj.state = 0;
Dj.joinMoveState = 0;
/*ParamGroupRecord( &easementPG );*/
+ if (easementVal < 0)
+ return CmdCornu(action, pos);
return C_CONTINUE;
case C_DOWN:
if ( (Dj.state == 0 && (MyGetKeyState() & WKEY_SHIFT) != 0) || Dj.joinMoveState != 0 )
return DoMoveToJoin( pos );
+ if (easementVal < 0.0)
+ return CmdCornu(action, pos);
DYNARR_SET( trkSeg_t, tempSegs_da, 3 );
tempSegs(0).color = drawColorBlack;
@@ -545,6 +560,8 @@ LOG( log_join, 1, ("P1=[%0.3f %0.3f]\n", pos.x, pos.y ) )
tempSegs_da.cnt = 0;
case C_MOVE:
+ if (easementVal < 0)
+ return CmdCornu(action, pos);
LOG( log_join, 3, ("P1=[%0.3f %0.3f]\n", pos.x, pos.y ) )
if (Dj.state != 2)
@@ -580,6 +597,8 @@ LOG( log_join, 3, ("P1=[%0.3f %0.3f]\n", pos.x, pos.y ) )
((Dj.inp[0].params.ep==0)?-90.0:90.0) );
break;
case curveTypeNone:
+ case curveTypeBezier:
+ case curveTypeCornu:
break;
}
@@ -655,6 +674,11 @@ LOG( log_join, 3, (" -E POS0=[%0.3f %0.3f] POS1=[%0.3f %0.3f]\n",
d = Dj.inp[0].params.arcR * a1 * 2.0*M_PI/360.0;
}
break;
+ case curveTypeCornu:
+ case curveTypeBezier:
+ case curveTypeNone:
+ InfoMessage( _("First Track Type not supported for non-Cornu Join") );
+ goto errorReturn;
default:
AbortProg( "cmdJoin - unknown type[0]" );
}
@@ -682,6 +706,11 @@ LOG( log_join, 3, (" -E POS0=[%0.3f %0.3f] POS1=[%0.3f %0.3f]\n",
d = Dj.inp[1].params.arcR * a1 * 2.0*M_PI/360.0;
}
break;
+ case curveTypeCornu:
+ case curveTypeBezier:
+ case curveTypeNone:
+ InfoMessage( _("Second Track Type not supported for non-Cornu Join") );
+ goto errorReturn;
default:
AbortProg( "cmdJoin - unknown type[1]" );
}
@@ -775,8 +804,13 @@ errorReturn:
return C_CONTINUE;
case C_UP:
- if (Dj.state == 0)
- return C_CONTINUE;
+
+ if (Dj.state == 0) {
+ if (easementVal<0)
+ return CmdCornu(action, pos);
+ else
+ return C_CONTINUE;
+ }
if (Dj.state == 1) {
InfoMessage( _("Select 2nd track") );
return C_CONTINUE;
@@ -801,6 +835,8 @@ errorReturn:
Dj.jRes.arcA0, Dj.jRes.arcA1, 0 );
break;
case curveTypeNone:
+ case curveTypeBezier:
+ case curveTypeCornu:
return C_CONTINUE;
}
@@ -822,65 +858,26 @@ errorReturn:
DrawNewTrack( trk );
return rc;
-#ifdef LATER
- case C_LCLICK:
- if ( (MyGetKeyState() & WKEY_SHIFT) == 0 ) {
- rc = CmdJoin( C_DOWN, pos );
- if (rc == C_TERMINATE)
- return rc;
- return CmdJoin( C_UP, pos );
- }
- if ( selectedTrackCount <= 0 ) {
- ErrorMessage( MSG_NO_SELECTED_TRK );
- return C_CONTINUE;
- }
- if ( (Dj.inp[Dj.joinMoveState].trk = OnTrack( &pos, TRUE, TRUE )) == NULL )
- return C_CONTINUE;
- if (!CheckTrackLayer( Dj.inp[Dj.joinMoveState].trk ) )
- return C_CONTINUE;
- Dj.inp[Dj.joinMoveState].params.ep = PickUnconnectedEndPoint( pos, Dj.inp[Dj.joinMoveState].trk ); /* CHECKME */
- if ( Dj.inp[Dj.joinMoveState].params.ep == -1 ) {
-#ifdef LATER
- ErrorMessage( MSG_NO_ENDPTS );
-#endif
- return C_CONTINUE;
- }
-#ifdef LATER
- if ( GetTrkEndTrk( Dj.inp[Dj.joinMoveState].trk, Dj.inp[Dj.joinMoveState].params.ep ) ) {
- ErrorMessage( MSG_SEL_EP_CONN );
- return C_CONTINUE;
- }
-#endif
- if (Dj.joinMoveState == 0) {
- Dj.joinMoveState++;
- InfoMessage( GetTrkSelected(Dj.inp[0].trk)?
- _("Click on an unselected End-Point"):
- _("Click on a selected End-Point") );
- return C_CONTINUE;
- }
- if ( GetTrkSelected(Dj.inp[0].trk) == GetTrkSelected(Dj.inp[1].trk) ) {
- ErrorMessage( MSG_2ND_TRK_NOT_SEL_UNSEL, GetTrkSelected(Dj.inp[0].trk)
- ? _("unselected") : _("selected") );
- return C_CONTINUE;
- }
- if (GetTrkSelected(Dj.inp[0].trk))
- MoveToJoin( Dj.inp[0].trk, Dj.inp[0].params.ep, Dj.inp[1].trk, Dj.inp[1].params.ep );
- else
- MoveToJoin( Dj.inp[1].trk, Dj.inp[1].params.ep, Dj.inp[0].trk, Dj.inp[0].params.ep );
- Dj.joinMoveState = 0;
- return C_TERMINATE;
- break;
-#endif
case C_CANCEL:
case C_REDRAW:
+
+
if ( Dj.joinMoveState == 1 || Dj.state == 1 ) {
DrawFillCircle( &tempD, Dj.inp[0].pos, 0.10*mainD.scale, selectedColor );
- }
+ } else if (easementVal<0 )
+ return CmdCornu(action,pos);
+
DrawSegs( &tempD, zero, 0.0, &tempSegs(0), tempSegs_da.cnt, trackGauge, wDrawColorBlack );
break;
+ case C_TEXT:
+ case C_OK:
+ if (easementVal<0 )
+ return CmdCornu(action,pos);
}
+
+
return C_CONTINUE;
}