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:55:58 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2018-03-19 19:55:58 +0100
commitd1a8285f818eb7e5c3d6a05709ea21a808490b8c (patch)
tree326578f0505cbed07cfe60de530022822dc237ac /app/bin/cblock.c
parent16e9630b79f0a7a90c6cedb6781175bb8b337dc1 (diff)
New upstream version 5.1.0upstream/5.1.0
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;
}