diff options
| author | Ted Gould <ted@gould.cx> | 2006-05-06 16:02:13 +0000 |
|---|---|---|
| committer | gouldtj <gouldtj@users.sourceforge.net> | 2006-05-06 16:02:13 +0000 |
| commit | 08fb8c78b59e40dda562ceb13fa1c08e5f0fb9f6 (patch) | |
| tree | 82e2e29e8e76632abf231a693cb43ed9c11d37c7 /src/extension/internal/grid.cpp | |
| parent | r11675@tres: ted | 2006-05-05 21:28:44 -0700 (diff) | |
| download | inkscape-08fb8c78b59e40dda562ceb13fa1c08e5f0fb9f6.tar.gz inkscape-08fb8c78b59e40dda562ceb13fa1c08e5f0fb9f6.zip | |
r11676@tres: ted | 2006-05-05 21:45:20 -0700
Switching over to AutoGUI.
(bzr r750)
Diffstat (limited to 'src/extension/internal/grid.cpp')
| -rw-r--r-- | src/extension/internal/grid.cpp | 64 |
1 files changed, 16 insertions, 48 deletions
diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index e37aa9774..b9d626f78 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -17,8 +17,10 @@ #include <gtkmm/spinbutton.h> #include "desktop.h" +#include "desktop-handles.h" #include "selection.h" #include "sp-object.h" +#include "util/glib-list-iterators.h" #include "extension/effect.h" #include "extension/system.h" @@ -186,55 +188,20 @@ PrefAdjustment::val_changed (void) \param moudule Module which holds the params \param view Unused today - may get style information in the future. - This function builds a VBox, and puts it into a Gtk::Plug. This way - the native window pointer can be pulled out and returned up to be - stuck in a Gtk::Socket further up the call stack. In the Vbox there - are several Hboxes, each one being a spin button to adjust a particular - parameter. The names of the parameters and the labels are all - stored in the arrays in the middle of the function. This makes - the code very generic. This will probably have to change if someone - wants to make this dialog look nicer. + Uses AutoGUI for creating the GUI. */ Gtk::Widget * Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view) { - Gtk::VBox * vbox; - vbox = new Gtk::VBox(); + SPDocument * current_document = view->doc(); -#define NUM_PREFERENCES 5 - char * labels[NUM_PREFERENCES] = {N_("Line Width"), - N_("Horizontal Spacing"), - N_("Vertical Spacing"), - N_("Horizontal Offset"), - N_("Vertical Offset")}; - char * prefs[NUM_PREFERENCES] = {"lineWidth", - "xspacing", - "yspacing", - "xoffset", - "yoffset"}; + using Inkscape::Util::GSListConstIterator; + GSListConstIterator<SPItem *> selected = sp_desktop_selection((SPDesktop *)view)->itemList(); + Inkscape::XML::Node * first_select = NULL; + if (selected != NULL) + first_select = SP_OBJECT_REPR(*selected); - for (int i = 0; i < NUM_PREFERENCES; i++) { - Gtk::HBox * hbox = new Gtk::HBox(); - - Gtk::Label * label = new Gtk::Label(_(labels[i]), Gtk::ALIGN_LEFT); - label->show(); - hbox->pack_start(*label, true, true); - - PrefAdjustment * pref = new PrefAdjustment(module, prefs[i]); - - Gtk::SpinButton * spin = new Gtk::SpinButton(*pref, 0.1, 1); - spin->show(); - hbox->pack_start(*spin, false, false); - - hbox->show(); - - vbox->pack_start(*hbox, true, true); - } -#undef NUM_PREFERENCES - - vbox->show(); - - return vbox; + return module->autogui(current_document, first_select); } #include "clear-n_.h" @@ -246,16 +213,17 @@ Grid::init (void) "<inkscape-extension>\n" "<name>" N_("Grid") "</name>\n" "<id>org.inkscape.effect.grid</id>\n" - "<param name=\"lineWidth\" type=\"float\">1.0</param>\n" - "<param name=\"xspacing\" type=\"float\">10.0</param>\n" - "<param name=\"yspacing\" type=\"float\">10.0</param>\n" - "<param name=\"xoffset\" type=\"float\">5.0</param>\n" - "<param name=\"yoffset\" type=\"float\">5.0</param>\n" + "<param name=\"lineWidth\" gui-text=\"" N_("Line Width") "\" type=\"float\">1.0</param>\n" + "<param name=\"xspacing\" gui-text=\"" N_("Horizontal Spacing") "\" type=\"float\">10.0</param>\n" + "<param name=\"yspacing\" gui-text=\"" N_("Vertical Spacing") "\" type=\"float\">10.0</param>\n" + "<param name=\"xoffset\" gui-text=\"" N_("Horizontal Offset") "\" type=\"float\">5.0</param>\n" + "<param name=\"yoffset\" gui-text=\"" N_("Vertical Offset") "\" type=\"float\">5.0</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" "<submenu name=\"" N_("Render") "\" />\n" "</effects-menu>\n" + "<menu-tip>" N_("Draw a path which is a grid") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Grid()); return; |
