File source/frontend/menubar.d changed (mode: 100644) (index c3dc6c6..73f1333) |
... |
... |
import gdk.Event; |
8 |
8 |
import dp.ent.group; |
import dp.ent.group; |
9 |
9 |
import dp.command.load; |
import dp.command.load; |
10 |
10 |
import dp.command.create; |
import dp.command.create; |
|
11 |
|
import dp.win.ornament; |
11 |
12 |
|
|
12 |
13 |
import std.conv; |
import std.conv; |
13 |
14 |
|
|
14 |
15 |
import Global = dp.global; |
import Global = dp.global; |
15 |
16 |
|
|
|
17 |
|
private OrnamentDialog od; |
|
18 |
|
|
16 |
19 |
public class Menubar : Box { |
public class Menubar : Box { |
17 |
20 |
this() { |
this() { |
18 |
21 |
super(Orientation.VERTICAL, 10); |
super(Orientation.VERTICAL, 10); |
|
... |
... |
public class ShapeMenu : MenuItem { // protected |
152 |
155 |
public class GroupMenu : MenuItem { // protected |
public class GroupMenu : MenuItem { // protected |
153 |
156 |
Menu groupMenu; |
Menu groupMenu; |
154 |
157 |
|
|
|
158 |
|
MenuItem attachOrnament; |
155 |
159 |
MenuItem newGroup; |
MenuItem newGroup; |
156 |
160 |
MenuItem clearGroup; |
MenuItem clearGroup; |
157 |
161 |
MenuItem[] existingGroups = []; |
MenuItem[] existingGroups = []; |
|
... |
... |
public class GroupMenu : MenuItem { // protected |
161 |
165 |
groupMenu = new Menu(); |
groupMenu = new Menu(); |
162 |
166 |
this.addOnButtonPress(&activateCallback); |
this.addOnButtonPress(&activateCallback); |
163 |
167 |
|
|
|
168 |
|
attachOrnament = new MenuItem("Attach ornament to selected group"); |
|
169 |
|
attachOrnament.addOnButtonPress(&attOrnamentCallback); |
|
170 |
|
groupMenu.append(attachOrnament); |
|
171 |
|
|
164 |
172 |
clearGroup = new MenuItem("Clear group selection"); |
clearGroup = new MenuItem("Clear group selection"); |
165 |
173 |
clearGroup.addOnButtonPress(&clearGroupCallback); |
clearGroup.addOnButtonPress(&clearGroupCallback); |
166 |
174 |
groupMenu.append(clearGroup); |
groupMenu.append(clearGroup); |
|
... |
... |
public class GroupMenu : MenuItem { // protected |
186 |
194 |
return false; |
return false; |
187 |
195 |
} |
} |
188 |
196 |
|
|
|
197 |
|
private bool attOrnamentCallback(Event event, Widget widget) { |
|
198 |
|
od = new OrnamentDialog(Global.Brush.group); |
|
199 |
|
return true; |
|
200 |
|
} |
|
201 |
|
|
189 |
202 |
private bool clearGroupCallback(Event event, Widget widget) { |
private bool clearGroupCallback(Event event, Widget widget) { |
190 |
203 |
Global.Brush.group = null; |
Global.Brush.group = null; |
191 |
204 |
Global.selection.update(null); |
Global.selection.update(null); |
File source/frontend/ornamentDialog.d changed (mode: 100644) (index 5b5a173..205f18f) |
... |
... |
import gtk.Entry; |
8 |
8 |
import gtk.RadioButton, gtk.ToggleButton; |
import gtk.RadioButton, gtk.ToggleButton; |
9 |
9 |
import gtk.Box; |
import gtk.Box; |
10 |
10 |
|
|
11 |
|
import dp.ent.shape; |
|
|
11 |
|
import dp.ent.entity; |
12 |
12 |
|
|
13 |
13 |
import Global = dp.global; |
import Global = dp.global; |
14 |
14 |
|
|
15 |
15 |
class OrnamentDialog : Dialog { |
class OrnamentDialog : Dialog { |
16 |
|
Shape shape; |
|
|
16 |
|
Entity e; |
17 |
17 |
Entry factorEntry; |
Entry factorEntry; |
18 |
18 |
RadioButton topRd, bottomRd, leftRd, rightRd; |
RadioButton topRd, bottomRd, leftRd, rightRd; |
19 |
19 |
string position = "Top"; // Default value since 'topRd' is mnemonic. |
string position = "Top"; // Default value since 'topRd' is mnemonic. |
20 |
20 |
|
|
21 |
|
this(Shape shape) { |
|
|
21 |
|
this(Entity e) { |
22 |
22 |
super(); |
super(); |
23 |
23 |
setTitle("Attach ornament"); |
setTitle("Attach ornament"); |
24 |
|
this.shape = shape; |
|
|
24 |
|
this.e = e; |
25 |
25 |
|
|
26 |
26 |
Box box = new Box(Orientation.VERTICAL, 50); |
Box box = new Box(Orientation.VERTICAL, 50); |
27 |
27 |
|
|
|
... |
... |
class OrnamentDialog : Dialog { |
49 |
49 |
factorEntry.setPlaceholderText("Enter ornament text here"); |
factorEntry.setPlaceholderText("Enter ornament text here"); |
50 |
50 |
|
|
51 |
51 |
Box btnBox = new Box(Orientation.HORIZONTAL, 30); |
Box btnBox = new Box(Orientation.HORIZONTAL, 30); |
52 |
|
Button shapeBtn = new Button("Add ornament to shape", &clickCallback); |
|
53 |
|
Button groupBtn = new Button("Add ornament to group", &clickCallback); |
|
|
52 |
|
Button cancelBtn = new Button("Cancel", &cancelCallback); |
|
53 |
|
Button confirmBtn = new Button("Add ornament to shape/group", &clickCallback); |
54 |
54 |
|
|
55 |
|
btnBox.add(shapeBtn); |
|
56 |
|
btnBox.add(groupBtn); |
|
|
55 |
|
btnBox.add(cancelBtn); |
|
56 |
|
btnBox.add(confirmBtn); |
57 |
57 |
|
|
58 |
58 |
// Content area, containing non-interactable GTK objects. |
// Content area, containing non-interactable GTK objects. |
59 |
59 |
getContentArea().add(new Label("Position of ornament relative to shape/group:")); |
getContentArea().add(new Label("Position of ornament relative to shape/group:")); |
|
... |
... |
class OrnamentDialog : Dialog { |
69 |
69 |
showAll(); |
showAll(); |
70 |
70 |
} |
} |
71 |
71 |
|
|
72 |
|
private void clickCallback (Button button) { |
|
|
72 |
|
private void clickCallback(Button button) { |
73 |
73 |
string input = factorEntry.getText(); |
string input = factorEntry.getText(); |
74 |
74 |
|
|
|
75 |
|
if(e is null) |
|
76 |
|
this.close(); |
|
77 |
|
|
75 |
78 |
if(input != "") { |
if(input != "") { |
76 |
79 |
final switch(position) { |
final switch(position) { |
77 |
80 |
case "Top": |
case "Top": |
|
... |
... |
class OrnamentDialog : Dialog { |
96 |
99 |
} |
} |
97 |
100 |
} |
} |
98 |
101 |
|
|
|
102 |
|
private void cancelCallback(Button button) { |
|
103 |
|
this.close(); |
|
104 |
|
} |
|
105 |
|
|
99 |
106 |
private void toggledRd(ToggleButton rd) { |
private void toggledRd(ToggleButton rd) { |
100 |
107 |
if(rd.getActive) |
if(rd.getActive) |
101 |
108 |
position = rd.getLabel(); |
position = rd.getLabel(); |