Mercurial > projects > doodle
annotate doodle/main/prog/doodler.d @ 55:4922e746dd76
Checkpoint
author | "David Bryant <bagnose@gmail.com>" |
---|---|
date | Sun, 08 Aug 2010 21:37:38 +0930 |
parents | 30ecedfe2ce2 |
children | b190a9d9352e |
rev | line source |
---|---|
28
1754cb773d41
Part-way through getting to compile with configure/builder.
Graham St Jack <graham.stjack@internode.on.net>
parents:
27
diff
changeset
|
1 private { |
44 | 2 import doodle.core.backtrace; |
38
452915ecd1f4
Basic logging functionality
David Bryant <bagnose@gmail.com>
parents:
35
diff
changeset
|
3 import doodle.core.logging; |
45 | 4 import doodle.core.backtrace; |
38
452915ecd1f4
Basic logging functionality
David Bryant <bagnose@gmail.com>
parents:
35
diff
changeset
|
5 |
28
1754cb773d41
Part-way through getting to compile with configure/builder.
Graham St Jack <graham.stjack@internode.on.net>
parents:
27
diff
changeset
|
6 import doodle.dia.tool_layer; |
1754cb773d41
Part-way through getting to compile with configure/builder.
Graham St Jack <graham.stjack@internode.on.net>
parents:
27
diff
changeset
|
7 import doodle.dia.standard_tools; |
35 | 8 import doodle.dia.grid_layer; |
28
1754cb773d41
Part-way through getting to compile with configure/builder.
Graham St Jack <graham.stjack@internode.on.net>
parents:
27
diff
changeset
|
9 import doodle.dia.page_layer; |
20 | 10 |
28
1754cb773d41
Part-way through getting to compile with configure/builder.
Graham St Jack <graham.stjack@internode.on.net>
parents:
27
diff
changeset
|
11 import doodle.gtk.canvas; |
51 | 12 import doodle.gtk.palette; |
27 | 13 |
20 | 14 import gtk.Main; |
15 import gtk.MainWindow; | |
27 | 16 import gtk.VBox; |
20 | 17 |
18 import std.stdio; | |
19 } | |
20 | |
21 void main(string[] args) { | |
54 | 22 void paletteCallback(int index) { |
23 writefln("Callback %s", index); | |
24 } | |
25 | |
51 | 26 Main.init(args); |
27 auto window = new MainWindow("Doodle"); | |
28 auto vbox = new VBox(false, 0); | |
38
452915ecd1f4
Basic logging functionality
David Bryant <bagnose@gmail.com>
parents:
35
diff
changeset
|
29 |
51 | 30 auto palette = new Palette; |
54 | 31 IPalette.Item[] items = |
32 [ | |
33 { "select.svg", "Select", &paletteCallback }, | |
55 | 34 { "rectangle.svg", "Rectangle", &paletteCallback }, |
35 { "ellipse.svg", "Ellipse", &paletteCallback }, | |
36 { "polyline.svg", "Polyline", &paletteCallback } | |
54 | 37 ]; |
38 palette.configure(items); | |
51 | 39 vbox.packStart(palette, false, false, 0); |
40 | |
20 | 41 Tool[] tools; |
42 tools ~= new PanTool; | |
43 tools ~= new ZoomTool; | |
44 tools ~= new LassoTool; | |
48 | 45 auto toolLayer = new ToolLayer(tools, "Tools"); |
51 | 46 |
48 | 47 auto gridLayer = new GridLayer("Grid"); |
51 | 48 |
20 | 49 Layer[] layers; |
50 layers ~= new PageLayer("Page"); | |
48 | 51 layers ~= gridLayer; |
52 layers ~= toolLayer; | |
53 auto canvas = new Canvas(layers, toolLayer, gridLayer, 120.0); | |
51 | 54 |
27 | 55 vbox.packStart(canvas, true, true, 0); |
56 window.add(vbox); | |
55 | 57 window.setDefaultSize(640, 580); |
20 | 58 window.showAll(); |
59 Main.run(); | |
60 } |