summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2011-05-26 21:17:37 +0000
committerJohan Engelen <goejendaagh@zonnet.nl>2011-05-26 21:17:37 +0000
commitd08f8e9ed468767cc64766eb80ea134bb5edb197 (patch)
tree5ef0aa6763dc38420a0479469d4c2c8b352af65d /src/ui
parentrename "set width" and "units per em" to "Em-size" (diff)
downloadinkscape-d08f8e9ed468767cc64766eb80ea134bb5edb197.tar.gz
inkscape-d08f8e9ed468767cc64766eb80ea134bb5edb197.zip
add entry widget to guideline dialog to change guide's label
(and fix some label xml writing and rendering bugs) (bzr r10234)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/guides.cpp14
-rw-r--r--src/ui/dialog/guides.h2
2 files changed, 14 insertions, 2 deletions
diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp
index 60038cab0..12aeddecc 100644
--- a/src/ui/dialog/guides.cpp
+++ b/src/ui/dialog/guides.cpp
@@ -42,6 +42,7 @@ GuidelinePropertiesDialog::GuidelinePropertiesDialog(SPGuide *guide, SPDesktop *
_relative_toggle(_("Rela_tive change"), _("Move and/or rotate the guide relative to current settings")),
_spin_button_x(_("X:"), "", UNIT_TYPE_LINEAR, "", "", &_unit_menu),
_spin_button_y(_("Y:"), "", UNIT_TYPE_LINEAR, "", "", &_unit_menu),
+ _label_entry(_("Label:"), _("Optionally give this guideline a name")),
_spin_angle(_("Angle:"), "", UNIT_TYPE_RADIAL),
_mode(true), _oldpos(0.,0.), _oldangle(0.0)
{
@@ -104,6 +105,9 @@ void GuidelinePropertiesDialog::_onApply()
sp_guide_moveto(*_guide, newpos, true);
+ const gchar* name = _label_entry.getEntry()->get_text().c_str();
+ sp_guide_set_label(*_guide, name, true);
+
DocumentUndo::done(_guide->document, SP_VERB_NONE,
_("Set guide properties"));
}
@@ -167,8 +171,11 @@ void GuidelinePropertiesDialog::_setup() {
_label_descr.set_alignment(0, 0.5);
// indent
- _layout_table.attach(*manage(new Gtk::Label(" ")),
- 0, 1, 2, 3, Gtk::FILL, Gtk::FILL, 10);
+// _layout_table.attach(*manage(new Gtk::Label(" ")),
+// 0, 1, 2, 3, Gtk::FILL, Gtk::FILL, 10);
+
+ _layout_table.attach(_label_entry,
+ 1, 3, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
// unitmenus
/* fixme: We should allow percents here too, as percents of the canvas size */
@@ -245,6 +252,9 @@ void GuidelinePropertiesDialog::_setup() {
g_free(label);
}
+ // init name entry
+ _label_entry.getEntry()->set_text(_guide->label ? _guide->label : "");
+
_modeChanged(); // sets values of spinboxes.
if ( _oldangle == 90. || _oldangle == 270. || _oldangle == -90. || _oldangle == -270.) {
diff --git a/src/ui/dialog/guides.h b/src/ui/dialog/guides.h
index f015c49ff..efef0142b 100644
--- a/src/ui/dialog/guides.h
+++ b/src/ui/dialog/guides.h
@@ -24,6 +24,7 @@
#include "ui/widget/spinbutton.h"
#include "ui/widget/unit-menu.h"
#include "ui/widget/scalar-unit.h"
+#include "ui/widget/entry.h"
#include <2geom/point.h>
class SPGuide;
@@ -71,6 +72,7 @@ private:
Inkscape::UI::Widget::UnitMenu _unit_menu;
Inkscape::UI::Widget::ScalarUnit _spin_button_x;
Inkscape::UI::Widget::ScalarUnit _spin_button_y;
+ Inkscape::UI::Widget::Entry _label_entry;
Inkscape::UI::Widget::ScalarUnit _spin_angle;
static Glib::ustring _angle_unit_status; // remember the status of the _relative_toggle_status button across instances