summaryrefslogtreecommitdiff
path: root/app/bin/cstruct.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/bin/cstruct.c')
-rw-r--r--app/bin/cstruct.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/app/bin/cstruct.c b/app/bin/cstruct.c
index 1f86217..41c47e5 100644
--- a/app/bin/cstruct.c
+++ b/app/bin/cstruct.c
@@ -1,8 +1,5 @@
-/*
- * $Header: /home/dmarkle/xtrkcad-fork-cvs/xtrkcad/app/bin/cstruct.c,v 1.4 2008-03-06 19:35:06 m_fischer Exp $
- *
+/** \file cstruct.c
* T_STRUCTURE
- *
*/
/* XTrkCad - Model Railroad CAD
@@ -24,11 +21,20 @@
*/
#include <ctype.h>
-#include "track.h"
+#include <math.h>
+#include <stdint.h>
+#include <string.h>
+
#include "compound.h"
+#include "cundo.h"
+#include "custom.h"
+#include "fileio.h"
#include "i18n.h"
-
-#include <stdint.h>
+#include "layout.h"
+#include "messages.h"
+#include "param.h"
+#include "track.h"
+#include "utility.h"
EXPORT TRKTYP_T T_STRUCTURE = -1;
@@ -272,7 +278,7 @@ static ANGLE_T GetAngleStruct(
pos.x -= xx->orig.x;
pos.y -= xx->orig.y;
Rotate( &pos, zero, -xx->angle );
- angle = GetAngleSegs( xx->segCnt, xx->segs, pos, NULL );
+ angle = GetAngleSegs( xx->segCnt, xx->segs, &pos, NULL, NULL, NULL, NULL, NULL);
if ( ep0 ) *ep0 = -1;
if ( ep1 ) *ep1 = -1;
return NormalizeAngle( angle+xx->angle );
@@ -403,7 +409,7 @@ static void structureChange( long changes )
maxStructureDim.x = maxStructureDim.y = 0.0;
if (structureInfo_da.cnt <= 0)
return;
- curStructure = StructAdd( LABEL_TABBED|LABEL_MANUF|LABEL_PARTNO|LABEL_DESCR, curScaleInx, structureListL, &maxStructureDim );
+ curStructure = StructAdd( LABEL_TABBED|LABEL_MANUF|LABEL_PARTNO|LABEL_DESCR, GetLayoutCurScale(), structureListL, &maxStructureDim );
wControlShow( (wControl_p)structureListL, TRUE );
if (curStructure == NULL) {
wDrawClear( structureD.d );
@@ -653,6 +659,7 @@ EXPORT STATUS_T CmdStructureAction(
DrawSegs( &tempD, Dst.pos, Dst.angle,
curStructure->segs, curStructure->segCnt, 0.0, wDrawColorBlack );
MainRedraw();
+ MapRedraw();
InfoMessage( "[ %0.3f %0.3f ]", pos.x - origPos.x, pos.y - origPos.y );
return C_CONTINUE;
@@ -701,6 +708,7 @@ EXPORT STATUS_T CmdStructureAction(
DrawLine( &tempD, rot0, rot1, 0, wDrawColorBlack );
case C_UP:
MainRedraw();
+ MapRedraw();
return C_CONTINUE;
case C_CMDMENU:
@@ -854,7 +862,7 @@ EXPORT void AddHotBarStructures( void )
to = structureInfo(inx);
if ( !( IsParamValid(to->paramFileIndex) &&
to->segCnt > 0 &&
- CompatibleScale( FALSE, to->scaleInx, curScaleInx ) ) )
+ CompatibleScale( FALSE, to->scaleInx, GetLayoutCurScale()) ) )
/*( (strcmp( to->scale, "*" ) == 0 && strcasecmp( curScaleName, "DEMO" ) != 0 ) ||
strncasecmp( to->scale, curScaleName, strlen(to->scale) ) == 0 ) ) )*/
continue;