Logo Search packages:      
Sourcecode: inkscape version File versions

Gdk::NativeWindow Inkscape::Extension::Plugin::Grid::prefs_effect ( Inkscape::Extension::Effect *  module,
SPView *  view 
) [virtual]

A function to get the prefences for the grid.

Parameters:
moudule Module which holds the params
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.

Reimplemented from Inkscape::Extension::Implementation::Implementation.

Definition at line 211 of file grid.cpp.

{
    Gtk::Plug * plug;

    plug = new Gtk::Plug((unsigned int)0);

    Gtk::VBox * vbox;
    vbox = new Gtk::VBox();

#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"};

    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();
    plug->add(*vbox);
    plug->show();

    return plug->get_id();
}


Generated by  Doxygen 1.6.0   Back to index