# HG changeset patch # User "David Bryant " # Date 1281269258 -34200 # Node ID 4922e746dd76dcaaa0f72d1894e5abb955974631 # Parent 30ecedfe2ce2c031deb30bb4c8341e4ec5e52e1d Checkpoint diff -r 30ecedfe2ce2 -r 4922e746dd76 doodle/gtk/data/ellipse.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doodle/gtk/data/ellipse.svg Sun Aug 08 21:37:38 2010 +0930 @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff -r 30ecedfe2ce2 -r 4922e746dd76 doodle/gtk/data/polyline.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doodle/gtk/data/polyline.svg Sun Aug 08 21:37:38 2010 +0930 @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff -r 30ecedfe2ce2 -r 4922e746dd76 doodle/gtk/data/rectangle.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doodle/gtk/data/rectangle.svg Sun Aug 08 21:37:38 2010 +0930 @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff -r 30ecedfe2ce2 -r 4922e746dd76 doodle/gtk/data/select.png Binary file doodle/gtk/data/select.png has changed diff -r 30ecedfe2ce2 -r 4922e746dd76 doodle/gtk/palette.d --- a/doodle/gtk/palette.d Sun Aug 08 21:07:47 2010 +0930 +++ b/doodle/gtk/palette.d Sun Aug 08 21:37:38 2010 +0930 @@ -10,27 +10,44 @@ import gtk.ToolButton; import gtk.RadioToolButton; import gtk.Image; + import gtk.Label; import glib.ListSG; import std.stdio; } class Palette : Toolbar, IPalette { this() { + // INVALID, MENU, SMALL_TOOLBAR, LARGE_TOOLBAR, + // BUTTON, DND, DIALOG setIconSize(GtkIconSize.LARGE_TOOLBAR); + // ICONS, TEXT, BOTH, BOTH_HORIZ setStyle(GtkToolbarStyle.ICONS); + // HORIZONTAL, VERTICAL setOrientation(GtkOrientation.HORIZONTAL); setTooltips(true); } override void configure(in Item[] items) { _items = items.dup; - ListSG group; + + RadioToolButton group; foreach(index, item; _items) { - auto button = new RadioToolButton(group); - if (index == 0) group = button.getGroup; + RadioToolButton button; + + if (index == 0) { + ListSG list; + button = new RadioToolButton(list); + group = button; + } + else { + button = new RadioToolButton(group); + } + auto image = new Image(_iconBase ~ "/" ~ item.iconPath); - button.setLabelWidget(image); + auto label = new Label(item.tooltipText); + button.setIconWidget(image); + button.setLabelWidget(label); button.setTooltipText(item.tooltipText); int * i = new int; diff -r 30ecedfe2ce2 -r 4922e746dd76 doodle/gtk/toolbar.d --- a/doodle/gtk/toolbar.d Sun Aug 08 21:07:47 2010 +0930 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -module doodle.gtk.toolbar; - -public { - import gtk.Toolbar; -} - -private { - import gtk.ToolButton; - import gtk.SeparatorToolItem; - import gtk.RadioToolButton; - import gtk.Image; - - import glib.ListSG; - - import std.stdio; -} - -class ToolBar : Toolbar { - this() { - // INVALID, MENU, SMALL_TOOLBAR, LARGE_TOOLBAR, - // BUTTON, DND, DIALOG - setIconSize(GtkIconSize.LARGE_TOOLBAR); - // ICONS, TEXT, BOTH, BOTH_HORIZ - setStyle(GtkToolbarStyle.ICONS); - // HORIZONTAL, VERTICAL - setOrientation(GtkOrientation.HORIZONTAL); - setTooltips(true); - - Image image; - ListSG group; - - image = new Image("icons/select.svg"); - button1 = new RadioToolButton(group); - button1.setLabelWidget(image); - insert(button1); - - image = new Image("icons/select.png"); - button2 = new RadioToolButton(group); - button2.setGroup(button1.getGroup); - button2.setLabelWidget(image); - button2.addOnClicked(&onClicked); - insert(button2); - - insert(new SeparatorToolItem); - - image = new Image("icons/select.png"); - button3 = new RadioToolButton(group); - button3.setGroup(button1.getGroup); - button3.setLabelWidget(image); - insert(button3); - } - - private { - - void onClicked(ToolButton tool_button) { - writefln("Clicked!"); - } - - RadioToolButton button1; - RadioToolButton button2; - RadioToolButton button3; - } -} diff -r 30ecedfe2ce2 -r 4922e746dd76 doodle/main/prog/doodler.d --- a/doodle/main/prog/doodler.d Sun Aug 08 21:07:47 2010 +0930 +++ b/doodle/main/prog/doodler.d Sun Aug 08 21:37:38 2010 +0930 @@ -9,7 +9,6 @@ import doodle.dia.page_layer; import doodle.gtk.canvas; - import doodle.gtk.toolbar; import doodle.gtk.palette; import gtk.Main; @@ -27,25 +26,16 @@ Main.init(args); auto window = new MainWindow("Doodle"); auto vbox = new VBox(false, 0); - /+ - auto toolBar = new ToolBar; - vbox.packStart(toolBar, false, false, 0); - +/ auto palette = new Palette; IPalette.Item[] items = [ { "select.svg", "Select", &paletteCallback }, - { "select.svg", "Select", &paletteCallback } + { "rectangle.svg", "Rectangle", &paletteCallback }, + { "ellipse.svg", "Ellipse", &paletteCallback }, + { "polyline.svg", "Polyline", &paletteCallback } ]; palette.configure(items); - /* - palette.add("select.svg", "tooltip-text", (int i){ writefln("Wow %s", i); }); - palette.add("select.svg", "tooltip-text", (int i){ writefln("Wow %s", i); }); - palette.add("select.svg", "tooltip-text", (int i){ writefln("Wow %s", i); }); - palette.add("select.svg", "tooltip-text", (int i){ writefln("Wow %s", i); }); - palette.add("select.svg", "tooltip-text", (int i){ writefln("Wow %s", i); }); - */ vbox.packStart(palette, false, false, 0); Tool[] tools; @@ -64,7 +54,7 @@ vbox.packStart(canvas, true, true, 0); window.add(vbox); - window.setDefaultSize(380, 380); + window.setDefaultSize(640, 580); window.showAll(); Main.run(); }