summaryrefslogtreecommitdiffstats
path: root/src/dialogs/guidelinedialog.cpp
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2006-05-02 05:29:03 +0000
committergouldtj <gouldtj@users.sourceforge.net>2006-05-02 05:29:03 +0000
commitdc81b746cf1305802b07f367a44e518d9036a2d6 (patch)
tree079328ba4b24bee0c7dc90b022f5d7b3529c62d7 /src/dialogs/guidelinedialog.cpp
parentr11569@tres: ted | 2006-04-29 08:55:02 -0700 (diff)
downloadinkscape-dc81b746cf1305802b07f367a44e518d9036a2d6.tar.gz
inkscape-dc81b746cf1305802b07f367a44e518d9036a2d6.zip
(bzr r690)
Diffstat (limited to 'src/dialogs/guidelinedialog.cpp')
-rw-r--r--src/dialogs/guidelinedialog.cpp98
1 files changed, 57 insertions, 41 deletions
diff --git a/src/dialogs/guidelinedialog.cpp b/src/dialogs/guidelinedialog.cpp
index 7be2545f0..6fab6c1c6 100644
--- a/src/dialogs/guidelinedialog.cpp
+++ b/src/dialogs/guidelinedialog.cpp
@@ -39,35 +39,43 @@ namespace Dialogs {
GuidelinePropertiesDialog::GuidelinePropertiesDialog(SPGuide *guide, SPDesktop *desktop)
: _desktop(desktop), _guide(guide),
- _relative_toggle(_("Rela_tive move"), _("Move guide relative to current position")),
- _adjustment(0.0, -SP_DESKTOP_SCROLL_LIMIT, SP_DESKTOP_SCROLL_LIMIT, 1.0, 10.0, 10.0),
+ _adjustment(0.0, -SP_DESKTOP_SCROLL_LIMIT, SP_DESKTOP_SCROLL_LIMIT, 1.0, 10.0, 10.0),
_unit_selector(NULL), _mode(true), _oldpos(0.0)
{
}
GuidelinePropertiesDialog::~GuidelinePropertiesDialog() {
+ if ( NULL != _unit_selector) {
+ //g_free(_unit_selector);
+ }
}
void GuidelinePropertiesDialog::showDialog(SPGuide *guide, SPDesktop *desktop) {
- GuidelinePropertiesDialog dialog(guide, desktop);
- dialog._setup();
- dialog.run();
+ GuidelinePropertiesDialog *dialog = new GuidelinePropertiesDialog(guide, desktop);
+ dialog->_setup();
+ dialog->run();
+ delete dialog;
}
void GuidelinePropertiesDialog::_modeChanged()
{
- _mode = !_relative_toggle.get_active();
- if (!_mode) {
- _label_move.set_label(_("Move by:"));
+ if (_mode) {
+ // TRANSLATORS: This string appears when double-clicking on a guide.
+ // This is the distance by which the guide is to be moved.
+ _m.set_label(_(" relative by "));
+ _mode = false;
} else {
- _label_move.set_label(_("Move to:"));
+ // TRANSLATORS: This string appears when double-clicking on a guide.
+ // This is the target location where the guide is to be moved.
+ _m.set_label(_(" absolute to "));
+ _mode = true;
}
}
void GuidelinePropertiesDialog::_onApply()
{
gdouble const raw_dist = _spin_button.get_value();
- SPUnit const &unit = *sp_unit_selector_get_unit(SP_UNIT_SELECTOR(_unit_selector->gobj()));
+ SPUnit const &unit = *sp_unit_selector_get_unit(SP_UNIT_SELECTOR(_unit_selector));
gdouble const points = sp_units_get_pixels(raw_dist, unit);
gdouble const newpos = ( _mode
? points
@@ -118,48 +126,54 @@ void GuidelinePropertiesDialog::_setup() {
Gtk::VBox *mainVBox = get_vbox();
- _layout_table.set_spacings(4);
- _layout_table.resize (3, 4);
+ _b1.set_homogeneous(false);
+ _b1.set_spacing(4);
+ mainVBox->pack_start(_b1, false, false, 0);
+ _b1.set_border_width(4);
+
+ _b2.set_homogeneous(false);
+ _b2.set_spacing(4);
+ _b1.pack_start(_b2, true, true, 0);
- mainVBox->pack_start(_layout_table, false, false, 0);
+ //labels
+ _b3.set_homogeneous(false);
+ _b3.set_spacing(4);
+ _b2.pack_start(_b3, true, true, 0);
- _label_descr.set_label("foo1");
- _layout_table.attach(_label_descr,
- 0, 3, 0, 1, Gtk::FILL, Gtk::FILL);
- _label_descr.set_alignment(0, 0.5);
+ _label.set_label("foo1");
+ _b3.pack_start(_label, true, true, 0);
+ _label.set_alignment(1.0, 0.5);
- _layout_table.attach(_label_move,
- 0, 2, 1, 2, Gtk::FILL, Gtk::FILL);
- _label_move.set_alignment(0, 0.5);
- _modeChanged();
+ _label_id.set_label("foo2");
+ _b3.pack_start(_label_id, true, true, 0);
+ _label_id.set_alignment(0.0, 0.5);
- // indent
- _layout_table.attach(*manage(new Gtk::Label(" ")),
- 0, 1, 2, 3, Gtk::FILL, Gtk::FILL, 10);
+ _b4.set_homogeneous(false);
+ _b4.set_spacing(4);
+ _b2.pack_start(_b4, false, false, 0);
- // mode radio button
- _layout_table.attach(_relative_toggle,
- 1, 3, 3, 4, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
- _relative_toggle.signal_toggled().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_modeChanged));
+ // mode button
+ _but.set_relief(Gtk::RELIEF_NONE);
+ _b4.pack_start(_but, false, true, 0);
+ _but.signal_clicked().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_modeChanged));
+ _m.set_label(_(" absolute to "));
+ _but.add(_m);
// unitmenu
/* fixme: We should allow percents here too, as percents of the canvas size */
- GtkWidget *unit_selector = sp_unit_selector_new(SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE);
- sp_unit_selector_set_unit(SP_UNIT_SELECTOR(unit_selector), _desktop->namedview->doc_units);
- _unit_selector = Gtk::manage(Glib::wrap(unit_selector));
+ _unit_selector = sp_unit_selector_new(SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE);
+ sp_unit_selector_set_unit(SP_UNIT_SELECTOR(_unit_selector), _desktop->namedview->doc_units);
// spinbutton
- sp_unit_selector_add_adjustment(SP_UNIT_SELECTOR(unit_selector), GTK_ADJUSTMENT(_adjustment.gobj()));
+ sp_unit_selector_add_adjustment(SP_UNIT_SELECTOR(_unit_selector), GTK_ADJUSTMENT(_adjustment.gobj()));
_spin_button.configure(_adjustment, 1.0 , 2);
_spin_button.set_numeric(TRUE);
- _layout_table.attach(_spin_button,
- 1, 2, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
+ _b4.pack_start(_spin_button, true, true, 0);
gtk_signal_connect_object(GTK_OBJECT(_spin_button.gobj()), "activate",
GTK_SIGNAL_FUNC(gtk_window_activate_default),
gobj());
- _layout_table.attach(*_unit_selector,
- 2, 3, 2, 3, Gtk::FILL, Gtk::FILL);
+ gtk_box_pack_start(GTK_BOX(_b4.gobj()), _unit_selector, FALSE, FALSE, 0);
// dialog
@@ -170,15 +184,17 @@ void GuidelinePropertiesDialog::_setup() {
_oldpos = _guide->position;
{
gchar *guide_description = sp_guide_description(_guide);
- Inkscape::XML::Node *repr = SP_OBJECT_REPR (_guide);
- const gchar *guide_id = repr->attribute("id");
- gchar *label = g_strdup_printf(_("Moving %s %s"), guide_description, guide_id);
+ gchar *label = g_strdup_printf(_("Move %s"), guide_description);
g_free(guide_description);
- _label_descr.set_label(label);
+ _label.set_label(label);
g_free(label);
+
+ Inkscape::XML::Node *repr = SP_OBJECT_REPR (_guide);
+ const gchar *guide_id = repr->attribute("id");
+ _label_id.set_label(guide_id);
}
- SPUnit const &unit = *sp_unit_selector_get_unit(SP_UNIT_SELECTOR(unit_selector));
+ SPUnit const &unit = *sp_unit_selector_get_unit(SP_UNIT_SELECTOR(_unit_selector));
gdouble const val = sp_pixels_get_units(_oldpos, unit);
_spin_button.set_value(val);
_spin_button.grab_focus();