X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fextension%2Finternal%2Fgrid.cpp;h=b9d626f783b379779603b46883f7bea189ee7191;hb=a46ff97a45048ea8d1241a4d175da72691b9aed2;hp=f74c652aa20f7f870d39c453c7a41bbf3121f2f2;hpb=6b15695578f07a3f72c4c9475c1a261a3021472a;p=inkscape.git diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index f74c652aa..b9d626f78 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -17,8 +17,10 @@ #include #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,71 +188,42 @@ 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 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" + void Grid::init (void) { Inkscape::Extension::build_from_mem( "\n" - "Grid\n" + "" N_("Grid") "\n" "org.inkscape.effect.grid\n" - "1.0\n" - "10.0\n" - "10.0\n" - "5.0\n" - "5.0\n" + "1.0\n" + "10.0\n" + "10.0\n" + "5.0\n" + "5.0\n" "\n" "all\n" + "\n" + "\n" + "\n" + "" N_("Draw a path which is a grid") "\n" "\n" "\n", new Grid()); return;