summaryrefslogtreecommitdiff
path: root/vec2ddes.bmx
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2005-10-22 01:05:33 +0000
committerIan C <ianc@noddybox.co.uk>2005-10-22 01:05:33 +0000
commitfd3d4d38d1f87a6d9a256d320be958fdf41829d7 (patch)
treed620c7935b81851fde6ae4ec8c7c92183f7b2537 /vec2ddes.bmx
parentc7f1f10d3a27f82de2f68c704fdd3baf08b866e7 (diff)
Added option to edit all lines and keyboard shortcuts
Diffstat (limited to 'vec2ddes.bmx')
-rw-r--r--vec2ddes.bmx104
1 files changed, 89 insertions, 15 deletions
diff --git a/vec2ddes.bmx b/vec2ddes.bmx
index fe0c86a..93afa80 100644
--- a/vec2ddes.bmx
+++ b/vec2ddes.bmx
@@ -608,6 +608,57 @@ Function DoDesigner(loadfile:String)
Designer.gui.EventLoop()
EndIf
+ If mode=NORMAL_MODE
+
+ If KeyHit(KEY_DELETE)
+ If sellist.Count()>1
+ For Local o:TDesPoint=EachIn sellist
+ DeletePoint(o)
+ Next
+ sellist.Clear()
+ ElseIf sel<>Null
+ If IsPoint(sel)
+ DeletePoint(TDesPoint(sel))
+ Else
+ Designer.obj.Remove(sel)
+ EndIf
+ sel=Null
+ EndIf
+ EndIf
+
+ If KeyHit(KEY_S)
+ If sellist.Count()>1
+ For Local o:TDesPoint=EachIn sellist
+ o.Snap()
+ Next
+ sellist.Clear()
+ ElseIf sel<>Null
+ sel.Snap()
+ sel=Null
+ EndIf
+ EndIf
+
+ If KeyHit(KEY_F)
+ If sel<>Null And IsLine(sel)
+ Local l:TDesLine=TDesLine(sel)
+ l.FlipNormal()
+ sel=Null
+ EndIf
+ EndIf
+
+ If KeyHit(KEY_E)
+ If sel<>Null And IsLine(sel)
+ sel.Edit()
+ sel=Null
+ EndIf
+ EndIf
+
+ If KeyHit(KEY_F12)
+ ConfigAllLines()
+ EndIf
+
+ EndIf
+
If mode=NORMAL_MODE And KeyHit(KEY_MOUSERIGHT)
If sellist.Count()>1
Select GUIMenu("Point Menu",["Snap to grid","Delete"],MouseX(),MouseY(),pointer)
@@ -618,13 +669,7 @@ Function DoDesigner(loadfile:String)
sellist.Clear()
Case 1
For Local o:TDesPoint=EachIn sellist
- Designer.obj.Remove(o)
-
- For Local d:TDesLine=EachIn Designer.obj
- If d<>Null And (d.p1=o Or d.p2=o)
- Designer.obj.Remove(d)
- EndIf
- Next
+ DeletePoint(o)
Next
sellist.Clear()
EndSelect
@@ -634,13 +679,7 @@ Function DoDesigner(loadfile:String)
Case 0
sel.Snap()
Case 1
- Designer.obj.Remove(sel)
-
- For Local d:TDesLine=EachIn Designer.obj
- If d<>Null And (d.p1=sel Or d.p2=sel)
- Designer.obj.Remove(d)
- EndIf
- Next
+ DeletePoint(TDesPoint(sel))
End Select
Else
Local l:TDesLine=TDesLine(sel)
@@ -656,7 +695,7 @@ Function DoDesigner(loadfile:String)
End Select
EndIf
Else
- Select GUIMenu("Create Menu",["Create Point","Create Line","Create Points","Create Points (Snapped)","Create Lines"],MouseX(),MouseY(),pointer)
+ Select GUIMenu("Menu",["Create Point","Create Line","Create Points","Create Points (Snapped)","Create Lines","Config all Lines"],MouseX(),MouseY(),pointer)
Case 0
Designer.obj.AddLast(TDesPoint.Create(x/scale,y/scale))
Case 1
@@ -677,6 +716,8 @@ Function DoDesigner(loadfile:String)
sel=Null
line_sel=Null
mode=LINE_TO_LINE_MODE
+ Case 5
+ ConfigAllLines()
End Select
EndIf
sel=Null
@@ -846,3 +887,36 @@ Function GridSizeCallback(w:TWidget)
Local c:TNumberInt=TNumberInt(w)
Designer.GRID=c.value
End Function
+
+Function DeletePoint(o:TDesPoint)
+ Designer.obj.Remove(o)
+
+ For Local d:TDesLine=EachIn Designer.obj
+ If d<>Null And (d.p1=o Or d.p2=o)
+ Designer.obj.Remove(d)
+ EndIf
+ Next
+End Function
+
+Function ConfigAllLines()
+ Designer.ld_red.text = 0
+ Designer.ld_green.text = 0
+ Designer.ld_blue.text = 0
+ Designer.ld_id.text = 0
+
+ If GUIDialog(Designer.ldialog,Designer.ld_ok,Designer.ld_cancel,pointer)
+ Local r:Int = Min(255,Designer.ld_red.text.ToInt())
+ Local g:Int = Min(255,Designer.ld_green.text.ToInt())
+ Local b:Int = Min(255,Designer.ld_blue.text.ToInt())
+ Local id:Int = Designer.ld_id.text.ToInt()
+
+ For Local o:TDesLine=EachIn Designer.obj
+ If o<>Null
+ o.r=r
+ o.g=g
+ o.b=b
+ o.id=id
+ EndIf
+ Next
+ EndIf
+End Function \ No newline at end of file