summaryrefslogtreecommitdiff
path: root/app/bin/cstraigh.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2022-02-06 16:04:38 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2022-02-06 16:04:38 +0100
commitd0ca838c7ab297036b4a7c45351761a48fe05efd (patch)
treef0f3cc006e8157d6bd699bd644b7dd7b35387ac2 /app/bin/cstraigh.c
parentfd6639655b399a79fb72f494786a4f57da9c90e7 (diff)
parent5d2c2b27a6323e2666378b986129b2a7c2c39e5c (diff)
Update upstream source from tag 'upstream/5.2.2GA'
Update to upstream version '5.2.2GA' with Debian dir 9c80045d0b4f9e463647bc8af8c090a673df4132
Diffstat (limited to 'app/bin/cstraigh.c')
-rw-r--r--app/bin/cstraigh.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/app/bin/cstraigh.c b/app/bin/cstraigh.c
index 464f16e..277db96 100644
--- a/app/bin/cstraigh.c
+++ b/app/bin/cstraigh.c
@@ -19,17 +19,15 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <math.h>
#include "cstraigh.h"
+#include "cselect.h"
#include "cundo.h"
#include "fileio.h"
-#include "i18n.h"
-#include "messages.h"
#include "param.h"
#include "track.h"
-#include "utility.h"
#include "layout.h"
+#include "common-ui.h"
/*
* STATE INFO
@@ -75,6 +73,7 @@ static STATUS_T CmdStraight( wAction_t action, coOrd pos )
Dl.ep=-1;
Dl.down = FALSE;
InfoMessage( _("Place 1st endpoint of straight track, snap to unconnected endpoint") );
+ SetAllTrackSelect( FALSE );
return C_CONTINUE;
case C_DOWN:
@@ -113,6 +112,7 @@ static STATUS_T CmdStraight( wAction_t action, coOrd pos )
case C_MOVE:
case wActionMove:
DYNARR_RESET(trkSeg_t,anchors_da);
+ found = FALSE;
if (!Dl.down) {
if (((MyGetKeyState() & WKEY_ALT) == 0) == magneticSnap) {
p = pos;
@@ -120,12 +120,18 @@ static STATUS_T CmdStraight( wAction_t action, coOrd pos )
if (GetTrkGauge(t) == GetScaleTrackGauge(GetLayoutCurScale())) {
EPINX_T ep = PickUnconnectedEndPointSilent(pos, t);
if (ep != -1) {
- if (GetTrkGauge(t) == GetScaleTrackGauge(GetLayoutCurScale()))
+ if (GetTrkGauge(t) == GetScaleTrackGauge(GetLayoutCurScale())) {
CreateEndAnchor(GetTrkEndPos(t,ep),FALSE);
+ found = TRUE;
+ }
}
}
}
}
+ if (!found && SnapPos( &pos )) {
+ CreateEndAnchor(pos,FALSE);
+ found = TRUE;
+ }
return C_CONTINUE;
}
ANGLE_T angle, angle2;
@@ -135,7 +141,10 @@ static STATUS_T CmdStraight( wAction_t action, coOrd pos )
if (angle2 > 90.0 && angle2 < 270.0)
Translate( &pos, Dl.pos0, angle, FindDistance( Dl.pos0, pos ) );
else pos = Dl.pos0;
- } else SnapPos( &pos );
+ } else if (SnapPos( &pos )) {
+ CreateEndAnchor(pos,FALSE);
+ found = TRUE;
+ }
InfoMessage( _("Straight Track Length=%s Angle=%0.3f"),
FormatDistance(FindDistance( Dl.pos0, pos )),
@@ -188,5 +197,5 @@ static STATUS_T CmdStraight( wAction_t action, coOrd pos )
void InitCmdStraight( wMenu_p menu )
{
- AddMenuButton( menu, CmdStraight, "cmdStraight", _("Straight Track"), wIconCreatePixMap(straight_xpm), LEVEL0_50, IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_STRAIGHT, NULL );
+ AddMenuButton( menu, CmdStraight, "cmdStraight", _("Straight Track"), wIconCreatePixMap(straight_xpm[iconSize]), LEVEL0_50, IC_STICKY|IC_POPUP2|IC_WANT_MOVE, ACCL_STRAIGHT, NULL );
}