summaryrefslogtreecommitdiff
path: root/app/bin/cblock.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/cblock.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/cblock.c')
-rw-r--r--app/bin/cblock.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/app/bin/cblock.c b/app/bin/cblock.c
index 3c627e9..b1b14a8 100644
--- a/app/bin/cblock.c
+++ b/app/bin/cblock.c
@@ -47,10 +47,19 @@
*/
#include <ctype.h>
-#include "track.h"
-#include "trackx.h"
+#include <stdlib.h>
+#include <string.h>
+
#include "compound.h"
+#include "cundo.h"
+#include "custom.h"
+#include "fileio.h"
#include "i18n.h"
+#include "messages.h"
+#include "param.h"
+#include "track.h"
+#include "trackx.h"
+#include "utility.h"
EXPORT TRKTYP_T T_BLOCK = -1;
@@ -151,8 +160,8 @@ static descData_t blockDesc[] = {
/*NM*/ { DESC_STRING, N_("Name"), &blockData.name },
/*SC*/ { DESC_STRING, N_("Script"), &blockData.script },
/*LN*/ { DESC_DIM, N_("Length"), &blockData.length },
-/*E0*/ { DESC_POS, N_("End Pt 1: X"), &blockData.endPt[0] },
-/*E1*/ { DESC_POS, N_("End Pt 2: X"), &blockData.endPt[1] },
+/*E0*/ { DESC_POS, N_("End Pt 1: X,Y"), &blockData.endPt[0] },
+/*E1*/ { DESC_POS, N_("End Pt 2: X,Y"), &blockData.endPt[1] },
{ DESC_NULL } };
static void UpdateBlock (track_p trk, int inx, descData_p descUpd, BOOL_T needUndoStart )
@@ -196,12 +205,18 @@ static DIST_T DistanceBlock (track_p t, coOrd * p )
blockData_p xx = GetblockData(t);
DIST_T closest, current;
int iTrk = 1;
-
- closest = GetTrkDistance ((&(xx->trackList))[0].t, *p);
+ coOrd pos = *p;
+ closest = GetTrkDistance ((&(xx->trackList))[0].t, &pos);
+ coOrd best_pos = pos;
for (; iTrk < xx->numTracks; iTrk++) {
- current = GetTrkDistance ((&(xx->trackList))[iTrk].t, *p);
- if (current < closest) closest = current;
+ pos = *p;
+ current = GetTrkDistance ((&(xx->trackList))[iTrk].t, &pos);
+ if (current < closest) {
+ closest = current;
+ best_pos = pos;
+ }
}
+ *p = best_pos;
return closest;
}