diff --git a/po/POTFILES.ui.in b/po/POTFILES.ui.in
index 493cdb5b4708ad6b4dc05d7122e1bf02da41412a..bee55d7546aab7dfb7d16621142a990916a617ad 100644
--- a/po/POTFILES.ui.in
+++ b/po/POTFILES.ui.in
@@ -17,6 +17,7 @@
../share/ui/inkscape-about.glade
../share/ui/inkscape-start.glade
../share/ui/marker-popup.glade
+../share/ui/object-properties.glade
../share/ui/page-properties.glade
../share/ui/pattern-edit.glade
../share/ui/widget-blendmode-popup.glade
diff --git a/share/ui/object-properties.glade b/share/ui/object-properties.glade
new file mode 100644
index 0000000000000000000000000000000000000000..c553357e2b804a9aa774eb54393005b9e23e436b
--- /dev/null
+++ b/share/ui/object-properties.glade
@@ -0,0 +1,587 @@
+
+
+
+
+
+
+
+
diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp
index 6476b40477edfb574ae05f2c9db53a1e69b438f4..6492684443fbb1407698dc72f93c656b85802e6a 100644
--- a/src/ui/dialog/object-properties.cpp
+++ b/src/ui/dialog/object-properties.cpp
@@ -31,8 +31,6 @@
#include
-#include
-
#include "document-undo.h"
#include "document.h"
#include "inkscape.h"
@@ -40,31 +38,53 @@
#include "style-enums.h"
#include "object/sp-image.h"
+#include "ui/builder-utils.h"
#include "ui/icon-names.h"
+#include "ui/widget/color-picker.h"
#include "widgets/sp-attribute-widget.h"
+using Inkscape::UI::get_widget;
+using Inkscape::UI::get_derived_widget;
+
namespace Inkscape {
namespace UI {
namespace Dialog {
ObjectProperties::ObjectProperties()
- : DialogBase("/dialogs/object/", "ObjectProperties")
- , _blocked(false)
- , _current_item(nullptr)
- , _label_id(_("_ID:"), true)
- , _label_label(_("_Label:"), true)
- , _label_title(_("_Title:"), true)
- , _label_dpi(_("_DPI SVG:"), true)
- , _label_image_rendering(_("_Image Rendering:"), true)
- , _label_color(_("Highlight Color:"), true)
- , _highlight_color(_("Highlight Color"), "", 0xff0000ff, true)
- , _cb_hide(_("_Hide"), true)
- , _cb_lock(_("L_ock"), true)
- , _cb_aspect_ratio(_("Preserve Ratio"), true)
- , _exp_interactivity(_("_Interactivity"), true)
- , _attr_table(Gtk::manage(new SPAttributeTable()))
+ : DialogBase("/dialogs/object/", "ObjectProperties")
+ , _builder(create_builder("object-properties.glade"))
+ , _blocked(false)
+ , _attr_table(Gtk::manage(new SPAttributeTable()))
+ , _grid_top (get_widget(_builder, "grid-top"))
+ , _grid_bottom (get_widget(_builder, "grid-bottom"))
+ , _grid_interactivity (get_widget(_builder, "grid-interactivity"))
+ , _grid_main (get_widget(_builder, "grid-main"))
+ , _entry_id (get_widget(_builder, "entry-id"))
+ , _entry_label (get_widget(_builder, "entry-label"))
+ , _entry_title (get_widget(_builder, "entry-title"))
+ , _combo_image_rendering (get_widget(_builder, "combo-image-rendering"))
+ , _checkbox_hide (get_widget(_builder, "checkbox-hide"))
+ , _checkbox_lock (get_widget(_builder, "checkbox-lock"))
+ , _checkbox_preserve_ratio (get_widget(_builder, "checkbox-preserve-ratio"))
+ , _button_set (get_widget(_builder, "button-set"))
+ , _expander_interactivity (get_widget(_builder, "expander-interactivity"))
+ , _entry_onclick (get_widget(_builder, "entry-onclick"))
+ , _entry_onmouseover (get_widget(_builder, "entry-onmouseover"))
+ , _entry_onmouseout (get_widget(_builder, "entry-onmouseout"))
+ , _entry_onmousedown (get_widget(_builder, "entry-onmousedown"))
+ , _entry_onmouseup (get_widget(_builder, "entry-onmouseup"))
+ , _entry_onmousemove (get_widget(_builder, "entry-onmousemove"))
+ , _entry_onfocusin (get_widget(_builder, "entry-onfocusin"))
+ , _entry_onfocusout (get_widget(_builder, "entry-onfocusout"))
+ , _entry_onload (get_widget(_builder, "entry-onload"))
+ , _label_id (get_widget(_builder, "label-id"))
+ , _label_dpi (get_widget(_builder, "label-dpi"))
+ , _label_image_rendering (get_widget(_builder, "label-image-rendering"))
+ , _adjustment_spin_dpi (get_object(_builder, "adjustment-spin-dpi"))
+ , _textview_description (get_derived_widget>(_builder, "textview-description"))
+ , _spin_dpi (get_derived_widget(_builder, "spin-dpi"))
{
- //initialize labels for the table at the bottom of the dialog
+ // initialize labels for the table at the bottom of the dialog
_int_attrs.emplace_back("onclick");
_int_attrs.emplace_back("onmouseover");
_int_attrs.emplace_back("onmouseout");
@@ -85,199 +105,25 @@ ObjectProperties::ObjectProperties()
_int_labels.emplace_back("onfocusout:");
_int_labels.emplace_back("onload:");
- _init();
-}
-
-void ObjectProperties::_init()
-{
- set_spacing(0);
-
- auto grid_top = Gtk::manage(new Gtk::Grid());
- grid_top->set_row_spacing(4);
- grid_top->set_column_spacing(0);
- grid_top->set_border_width(4);
-
- pack_start(*grid_top, false, false, 0);
-
-
- /* Create the label for the object id */
- _label_id.set_label(_label_id.get_label() + " ");
- _label_id.set_halign(Gtk::ALIGN_START);
- _label_id.set_valign(Gtk::ALIGN_CENTER);
-
- /* Create the entry box for the object id */
- _entry_id.set_tooltip_text(_("The id= attribute (only letters, digits, and the characters .-_: allowed)"));
- _entry_id.set_max_length(64);
- _entry_id.set_hexpand();
- _entry_id.set_valign(Gtk::ALIGN_CENTER);
-
- _label_id.set_mnemonic_widget(_entry_id);
-
- // pressing enter in the id field is the same as clicking Set:
- _entry_id.signal_activate().connect(sigc::mem_fun(*this, &ObjectProperties::_labelChanged));
- // focus is in the id field initially:
- _entry_id.grab_focus();
-
-
- /* Create the label for the object label */
- _label_label.set_label(_label_label.get_label() + " ");
- _label_label.set_halign(Gtk::ALIGN_START);
- _label_label.set_valign(Gtk::ALIGN_CENTER);
-
- /* Create the entry box for the object label */
- _entry_label.set_tooltip_text(_("A freeform label for the object"));
- _entry_label.set_max_length(256);
-
- _entry_label.set_hexpand();
- _entry_label.set_valign(Gtk::ALIGN_CENTER);
-
- _label_label.set_mnemonic_widget(_entry_label);
-
- // pressing enter in the label field is the same as clicking Set:
- _entry_label.signal_activate().connect(sigc::mem_fun(*this, &ObjectProperties::_labelChanged));
-
-
- /* Create the label for the object title */
- _label_title.set_label(_label_title.get_label() + " ");
- _label_title.set_halign(Gtk::ALIGN_START);
- _label_title.set_valign(Gtk::ALIGN_CENTER);
-
- /* Create the entry box for the object title */
- _entry_title.set_sensitive (FALSE);
- _entry_title.set_max_length (256);
-
- _entry_title.set_hexpand();
- _entry_title.set_valign(Gtk::ALIGN_CENTER);
-
- _label_title.set_mnemonic_widget(_entry_title);
- // pressing enter in the label field is the same as clicking Set:
- _entry_title.signal_activate().connect(sigc::mem_fun(*this, &ObjectProperties::_labelChanged));
-
- _label_color.set_mnemonic_widget(_highlight_color);
- _label_color.set_halign(Gtk::ALIGN_START);
- _highlight_color.connectChanged(sigc::mem_fun(*this, &ObjectProperties::_highlightChanged));
-
- /* Create the frame for the object description */
- Gtk::Label *label_desc = Gtk::manage(new Gtk::Label(_("_Description:"), true));
- UI::Widget::Frame *frame_desc = Gtk::manage(new UI::Widget::Frame("", FALSE));
- frame_desc->set_label_widget(*label_desc);
- frame_desc->set_padding (0,0,0,0);
- pack_start(*frame_desc, true, true, 0);
-
- /* Create the text view box for the object description */
- _ft_description.set_border_width(4);
- _ft_description.set_sensitive(FALSE);
- frame_desc->add(_ft_description);
- _ft_description.set_shadow_type(Gtk::SHADOW_IN);
-
- _tv_description.set_wrap_mode(Gtk::WRAP_WORD);
- _tv_description.get_buffer()->set_text("");
- _ft_description.add(_tv_description);
- _tv_description.add_mnemonic_label(*label_desc);
-
- /* Create the label for the object title */
- _label_dpi.set_label(_label_dpi.get_label() + " ");
- _label_dpi.set_halign(Gtk::ALIGN_START);
- _label_dpi.set_valign(Gtk::ALIGN_CENTER);
-
- /* Create the entry box for the SVG DPI */
- _spin_dpi.set_digits(2);
- _spin_dpi.set_range(1, 1200);
-
- _label_dpi.set_mnemonic_widget(_spin_dpi);
- // pressing enter in the label field is the same as clicking Set:
- _spin_dpi.signal_activate().connect(sigc::mem_fun(*this, &ObjectProperties::_labelChanged));
-
- /* Image rendering */
- /* Create the label for the object ImageRendering */
- _label_image_rendering.set_label(_label_image_rendering.get_label() + " ");
- _label_image_rendering.set_halign(Gtk::ALIGN_START);
- _label_image_rendering.set_valign(Gtk::ALIGN_CENTER);
-
- /* Create the combo box text for the 'image-rendering' property */
- for (unsigned i = 0; enum_image_rendering[i].key; ++i) {
- _combo_image_rendering.append(enum_image_rendering[i].key);
- }
- _combo_image_rendering.set_tooltip_text(_("The 'image-rendering' property can influence how a bitmap is re-scaled:\n"
- "\t• 'auto': no preference (scaled image is usually smooth but blurred)\n"
- "\t• 'optimizeQuality': prefer rendering quality (usually smooth but blurred)\n"
- "\t• 'optimizeSpeed': prefer rendering speed (usually blocky)\n"
- "\t• 'crisp-edges': rescale without blurring edges (often blocky)\n"
- "\t• 'pixelated': render blocky\n"
- "Note that the specification of this property is not finalized. "
- "Support and interpretation of these values varies between renderers."));
-
- _combo_image_rendering.set_valign(Gtk::ALIGN_CENTER);
-
- _label_image_rendering.set_mnemonic_widget(_combo_image_rendering);
-
- _combo_image_rendering.signal_changed().connect(
- sigc::mem_fun(*this, &ObjectProperties::_imageRenderingChanged)
- );
-
-
- grid_top->attach(_label_id, 0, 0, 1, 1);
- grid_top->attach(_entry_id, 1, 0, 1, 1);
- grid_top->attach(_label_label, 0, 1, 1, 1);
- grid_top->attach(_entry_label, 1, 1, 1, 1);
- grid_top->attach(_label_title, 0, 2, 1, 1);
- grid_top->attach(_entry_title, 1, 2, 1, 1);
- grid_top->attach(_label_color, 0, 3, 1, 1);
- grid_top->attach(_highlight_color, 1, 3, 1, 1);
- grid_top->attach(_label_dpi, 0, 4, 1, 1);
- grid_top->attach(_spin_dpi, 1, 4, 1, 1);
- grid_top->attach(_label_image_rendering, 0, 5, 1, 1);
- grid_top->attach(_combo_image_rendering, 1, 5, 1, 1);
-
- /* Check boxes */
- Gtk::Box *hb_checkboxes = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
- pack_start(*hb_checkboxes, Gtk::PACK_SHRINK, 0);
-
- auto grid_cb = Gtk::manage(new Gtk::Grid());
- grid_cb->set_row_homogeneous();
- grid_cb->set_column_homogeneous(true);
-
- grid_cb->set_border_width(4);
- hb_checkboxes->pack_start(*grid_cb, true, true, 0);
-
- /* Hide */
- _cb_hide.set_tooltip_text (_("Check to make the object invisible"));
- _cb_hide.set_hexpand();
- _cb_hide.set_valign(Gtk::ALIGN_CENTER);
- grid_cb->attach(_cb_hide, 0, 0, 1, 1);
-
- _cb_hide.signal_toggled().connect(sigc::mem_fun(*this, &ObjectProperties::_hiddenToggled));
-
- /* Lock */
- // TRANSLATORS: "Lock" is a verb here
- _cb_lock.set_tooltip_text(_("Check to make the object insensitive (not selectable by mouse)"));
- _cb_lock.set_hexpand();
- _cb_lock.set_valign(Gtk::ALIGN_CENTER);
- grid_cb->attach(_cb_lock, 1, 0, 1, 1);
-
- _cb_lock.signal_toggled().connect(sigc::mem_fun(*this, &ObjectProperties::_sensitivityToggled));
-
- /* Preserve aspect ratio */
- _cb_aspect_ratio.set_tooltip_text(_("Check to preserve aspect ratio on images"));
- _cb_aspect_ratio.set_hexpand();
- _cb_aspect_ratio.set_valign(Gtk::ALIGN_CENTER);
- grid_cb->attach(_cb_aspect_ratio, 0, 1, 1, 1);
-
- _cb_aspect_ratio.signal_toggled().connect(sigc::mem_fun(*this, &ObjectProperties::_aspectRatioToggled));
-
-
- /* Button for setting the object's id, label, title and description. */
- Gtk::Button *btn_set = Gtk::manage(new Gtk::Button(_("_Set"), true));
- btn_set->set_hexpand();
- btn_set->set_valign(Gtk::ALIGN_CENTER);
- grid_cb->attach(*btn_set, 1, 1, 1, 1);
-
- btn_set->signal_clicked().connect(sigc::mem_fun(*this, &ObjectProperties::_labelChanged));
-
- /* Interactivity options */
- _exp_interactivity.set_vexpand(false);
- pack_start(_exp_interactivity, Gtk::PACK_SHRINK);
- show_all();
+ _picker_highlight_color = std::make_unique(
+ _("Highlight Color"), "", 0xff0000ff, true,
+ &get_widget(_builder, "highlight-color"));
+
+ _spin_dpi.set_adjustment(_adjustment_spin_dpi);
+
+ // connecting signals
+ _entry_id.signal_activate().connect(sigc::mem_fun(*this, &ObjectProperties::_idChanged));
+ _entry_title.signal_activate().connect(sigc::mem_fun(*this, &ObjectProperties::_titleChanged));
+ _picker_highlight_color->connectChanged(sigc::mem_fun(*this, &ObjectProperties::_highlightChanged));
+ _spin_dpi.signal_activate().connect(sigc::mem_fun(*this, &ObjectProperties::_dpiChanged));
+ _combo_image_rendering.signal_changed().connect(sigc::mem_fun(*this, &ObjectProperties::_imageRenderingChanged));
+ _checkbox_hide.signal_toggled().connect(sigc::mem_fun(*this, &ObjectProperties::_hiddenToggled));
+ _checkbox_lock.signal_toggled().connect(sigc::mem_fun(*this, &ObjectProperties::_sensitivityToggled));
+ _checkbox_preserve_ratio.signal_toggled().connect(sigc::mem_fun(*this, &ObjectProperties::_aspectRatioToggled));
+ _button_set.signal_clicked().connect(sigc::mem_fun(*this, &ObjectProperties::_setButtonCallback));
+
+ add(_grid_main);
+ show();
}
void ObjectProperties::update_entries()
@@ -295,7 +141,7 @@ void ObjectProperties::update_entries()
//no selection anymore or multiple objects selected, means that we need
//to close the connections to the previously selected object
_attr_table->clear();
- _highlight_color.setRgba32(0x0);
+ _picker_highlight_color->setRgba32(0x0);
return;
} else {
set_sensitive (true);
@@ -309,22 +155,20 @@ void ObjectProperties::update_entries()
return;
}
_blocked = true;
- _cb_aspect_ratio.set_active(g_strcmp0(item->getAttribute("preserveAspectRatio"), "none") != 0);
- _cb_lock.set_active(item->isLocked()); /* Sensitive */
- _cb_hide.set_active(item->isExplicitlyHidden()); /* Hidden */
- _highlight_color.setRgba32(item->highlight_color());
- _highlight_color.closeWindow();
+ _checkbox_preserve_ratio.set_active(g_strcmp0(item->getAttribute("preserveAspectRatio"), "none") != 0);
+ _checkbox_lock.set_active(item->isLocked()); /* Sensitive */
+ _checkbox_hide.set_active(item->isExplicitlyHidden()); /* Hidden */
+ _picker_highlight_color->setRgba32(item->highlight_color());
+ _picker_highlight_color->closeWindow();
if (item->cloned) {
/* ID */
_entry_id.set_text("");
_entry_id.set_sensitive(FALSE);
- _label_id.set_text(_("Ref"));
/* Label */
_entry_label.set_text("");
_entry_label.set_sensitive(FALSE);
- _label_label.set_text(_("Ref"));
} else {
SPObject *obj = static_cast(item);
@@ -332,17 +176,10 @@ void ObjectProperties::update_entries()
/* ID */
_entry_id.set_text(obj->getId() ? obj->getId() : "");
_entry_id.set_sensitive(TRUE);
- _label_id.set_markup_with_mnemonic(_("_ID:") + Glib::ustring(" "));
/* Label */
- char const *currentlabel = obj->label();
- char const *placeholder = "";
- if (!currentlabel) {
- currentlabel = "";
- placeholder = obj->defaultLabel();
- }
- _entry_label.set_text(currentlabel);
- _entry_label.set_placeholder_text(placeholder);
+ _entry_label.set_text(obj->defaultLabel());
+ _entry_label.set_placeholder_text("");
_entry_label.set_sensitive(TRUE);
/* Title */
@@ -359,8 +196,8 @@ void ObjectProperties::update_entries()
/* Image Rendering */
if (is(item)) {
_combo_image_rendering.show();
- _label_image_rendering.show();
_combo_image_rendering.set_active(obj->style->image_rendering.value);
+ _label_image_rendering.show();
if (obj->getAttribute("inkscape:svg-dpi")) {
_spin_dpi.set_value(std::stod(obj->getAttribute("inkscape:svg-dpi")));
_spin_dpi.show();
@@ -380,15 +217,14 @@ void ObjectProperties::update_entries()
/* Description */
gchar *desc = obj->desc();
if (desc) {
- _tv_description.get_buffer()->set_text(desc);
+ _textview_description.get_buffer()->set_text(desc);
g_free(desc);
} else {
- _tv_description.get_buffer()->set_text("");
+ _textview_description.get_buffer()->set_text("");
}
- _ft_description.set_sensitive(TRUE);
if (_current_item == nullptr) {
- _attr_table->set_object(obj, _int_labels, _int_attrs, (GtkWidget*) _exp_interactivity.gobj());
+ _attr_table->set_object(obj, _int_labels, _int_attrs, (GtkWidget*) _expander_interactivity.gobj());
} else {
_attr_table->change_object(obj);
}
@@ -398,7 +234,35 @@ void ObjectProperties::update_entries()
_blocked = false;
}
-void ObjectProperties::_labelChanged()
+// update all fields
+void ObjectProperties::_setButtonCallback()
+{
+ _titleChanged();
+ _idChanged();
+ _imageRenderingChanged();
+ _dpiChanged();
+ _descriptionChanged();
+}
+
+void ObjectProperties::_titleChanged()
+{
+ if (_blocked)
+ return;
+
+ _blocked = true;
+
+ if (auto obj = static_cast(getSelection()->singleItem())) {
+ if (obj->setTitle(_entry_title.get_text().c_str())) {
+ DocumentUndo::done(getDocument(), _("Set object title"), INKSCAPE_ICON("dialog-object-properties"));
+ }
+ }
+
+ _blocked = false;
+}
+
+// the ID and the label are tied together
+// the label for the ID entry updates based on the validity of the entered ID
+void ObjectProperties::_idChanged()
{
if (_blocked) {
return;
@@ -432,33 +296,29 @@ void ObjectProperties::_labelChanged()
* using the widget's label text
*/
SPObject *obj = static_cast(item);
- char const *currentlabel = obj->label();
+ auto currentlabel = obj->label();
if (label.compare(currentlabel ? currentlabel : "")) {
obj->setLabel(label.c_str());
DocumentUndo::done(getDocument(), _("Set object label"), INKSCAPE_ICON("dialog-object-properties"));
}
- /* Retrieve the title */
- if (obj->setTitle(_entry_title.get_text().c_str())) {
- DocumentUndo::done(getDocument(), _("Set object title"), INKSCAPE_ICON("dialog-object-properties"));
- }
- /* Retrieve the DPI */
- if (is(obj)) {
- Glib::ustring dpi_value = Glib::ustring::format(_spin_dpi.get_value());
- obj->setAttribute("inkscape:svg-dpi", dpi_value);
- DocumentUndo::done(getDocument(), _("Set image DPI"), INKSCAPE_ICON("dialog-object-properties"));
- }
+ _blocked = false;
+}
- /* Retrieve the description */
- Gtk::TextBuffer::iterator start, end;
- _tv_description.get_buffer()->get_bounds(start, end);
- Glib::ustring desc = _tv_description.get_buffer()->get_text(start, end, TRUE);
- if (obj->setDesc(desc.c_str())) {
- DocumentUndo::done(getDocument(), _("Set object description"), INKSCAPE_ICON("dialog-object-properties"));
- }
+void ObjectProperties::_descriptionChanged()
+{
+ if (_blocked)
+ return;
- _blocked = false;
+ if (auto obj = static_cast(getSelection()->singleItem())) {
+ Gtk::TextBuffer::iterator start, end;
+ _textview_description.get_buffer()->get_bounds(start, end);
+ auto desc = _textview_description.get_buffer()->get_text(start, end, TRUE);
+ if (obj->setDesc(desc.c_str())) {
+ DocumentUndo::done(getDocument(), _("Set object description"), INKSCAPE_ICON("dialog-object-properties"));
+ }
+ }
}
void ObjectProperties::_highlightChanged(guint rgba)
@@ -472,6 +332,26 @@ void ObjectProperties::_highlightChanged(guint rgba)
}
}
+void ObjectProperties::_dpiChanged()
+{
+ if (_blocked)
+ return;
+
+ _blocked = true;
+
+ if (auto obj = static_cast(getSelection()->singleItem())) {
+ if (is(obj)) {
+ auto dpi_value = Glib::ustring::format(_spin_dpi.get_value());
+ g_warning("%s", dpi_value.c_str());
+ obj->setAttribute("inkscape:svg-dpi", dpi_value);
+ DocumentUndo::done(getDocument(), _("Set image DPI"), INKSCAPE_ICON("dialog-object-properties"));
+ }
+ }
+
+ _blocked = false;
+
+}
+
void ObjectProperties::_imageRenderingChanged()
{
if (_blocked) {
@@ -508,8 +388,8 @@ void ObjectProperties::_sensitivityToggled()
g_return_if_fail(item != nullptr);
_blocked = true;
- item->setLocked(_cb_lock.get_active());
- DocumentUndo::done(getDocument(), _cb_lock.get_active() ? _("Lock object") : _("Unlock object"), INKSCAPE_ICON("dialog-object-properties"));
+ item->setLocked(_checkbox_lock.get_active());
+ DocumentUndo::done(getDocument(), _checkbox_lock.get_active() ? _("Lock object") : _("Unlock object"), INKSCAPE_ICON("dialog-object-properties"));
_blocked = false;
}
@@ -525,7 +405,7 @@ void ObjectProperties::_aspectRatioToggled()
_blocked = true;
const char *active;
- if (_cb_aspect_ratio.get_active()) {
+ if (_checkbox_preserve_ratio.get_active()) {
active = "xMidYMid";
}
else {
@@ -550,8 +430,8 @@ void ObjectProperties::_hiddenToggled()
g_return_if_fail(item != nullptr);
_blocked = true;
- item->setExplicitlyHidden(_cb_hide.get_active());
- DocumentUndo::done(getDocument(), _cb_hide.get_active() ? _("Hide object") : _("Unhide object"), INKSCAPE_ICON("dialog-object-properties"));
+ item->setExplicitlyHidden(_checkbox_hide.get_active());
+ DocumentUndo::done(getDocument(), _checkbox_hide.get_active() ? _("Hide object") : _("Unhide object"), INKSCAPE_ICON("dialog-object-properties"));
_blocked = false;
}
@@ -565,9 +445,9 @@ void ObjectProperties::desktopReplaced()
update_entries();
}
-}
-}
-}
+} // Dialog
+} // UI
+} // Inkscape
/*
Local Variables:
diff --git a/src/ui/dialog/object-properties.h b/src/ui/dialog/object-properties.h
index f52f0197eb566bd75826c6daa411b4112b9f8dbb..f5c401a0bb54cd62ef8a5314d03655fe20c9a8bf 100644
--- a/src/ui/dialog/object-properties.h
+++ b/src/ui/dialog/object-properties.h
@@ -30,26 +30,25 @@
#ifndef SEEN_DIALOGS_ITEM_PROPERTIES_H
#define SEEN_DIALOGS_ITEM_PROPERTIES_H
-
-#include
#include
#include
#include
#include
+#include
#include
#include
#include "ui/dialog/dialog-base.h"
-#include "ui/widget/scrollprotected.h"
#include "ui/widget/color-picker.h"
-#include "ui/widget/frame.h"
+#include "ui/widget/scrollprotected.h"
+#include "ui/widget/spinbutton.h"
class SPAttributeTable;
class SPItem;
-namespace Gtk {
-class Grid;
-}
+using Inkscape::UI::Widget::ScrollProtected;
+using Inkscape::UI::Widget::SpinButton;
+using Inkscape::UI::Widget::ColorPicker;
namespace Inkscape {
namespace UI {
@@ -65,48 +64,71 @@ class ObjectProperties : public DialogBase
{
public:
ObjectProperties();
- ~ObjectProperties() override {};
+ ~ObjectProperties() override = default;
/// Updates entries and other child widgets on selection change, object modification, etc.
void update_entries();
void selectionChanged(Selection *selection) override;
private:
+
bool _blocked;
- SPItem *_current_item; //to store the current item, for not wasting resources
+ SPItem *_current_item = nullptr; //to store the current item, for not wasting resources
std::vector _int_attrs;
std::vector _int_labels;
- Gtk::Label _label_id; //the label for the object ID
- Gtk::Entry _entry_id; //the entry for the object ID
- Gtk::Label _label_label; //the label for the object label
- Gtk::Entry _entry_label; //the entry for the object label
- Gtk::Label _label_title; //the label for the object title
- Gtk::Entry _entry_title; //the entry for the object title
-
- Gtk::Label _label_color; //the label for the object highlight
- Inkscape::UI::Widget::ColorPicker _highlight_color; // color picker for the object highlight
-
- Gtk::Label _label_image_rendering; // the label for 'image-rendering'
- Inkscape::UI::Widget::ScrollProtected _combo_image_rendering; // the combo box text for 'image-rendering'
-
- Gtk::Frame _ft_description; //the frame for the text of the object description
- Gtk::TextView _tv_description; //the text view object showing the object description
-
- Gtk::CheckButton _cb_hide; //the check button hide
- Gtk::CheckButton _cb_lock; //the check button lock
- Gtk::CheckButton _cb_aspect_ratio; //the preserve aspect ratio of images
-
- Gtk::Label _label_dpi; //the entry for the dpi value
- Gtk::SpinButton _spin_dpi; //the expander for interactivity
- Gtk::Expander _exp_interactivity; //the expander for interactivity
+ Glib::RefPtr _builder; // Builder for glade widgets, declare before widgets
+
+ Gtk::Expander &_expander_interactivity;
+
+ Gtk::Grid &_grid_main;
+ Gtk::Grid &_grid_top;
+ Gtk::Grid &_grid_bottom;
+ Gtk::Grid &_grid_interactivity;
+
+ Gtk::Label &_label_id;
+ Gtk::Entry &_entry_id;
+ Gtk::Entry &_entry_label;
+ Gtk::Entry &_entry_title;
+
+ Gtk::Entry &_entry_onclick;
+ Gtk::Entry &_entry_onmouseover;
+ Gtk::Entry &_entry_onmouseout;
+ Gtk::Entry &_entry_onmousedown;
+ Gtk::Entry &_entry_onmouseup;
+ Gtk::Entry &_entry_onmousemove;
+ Gtk::Entry &_entry_onfocusin;
+ Gtk::Entry &_entry_onfocusout;
+ Gtk::Entry &_entry_onload;
+
+ std::unique_ptr _picker_highlight_color;
+ ScrollProtected &_textview_description;
+
+ Gtk::ComboBoxText &_combo_image_rendering;
+ Gtk::Label &_label_image_rendering;
+
+ Gtk::CheckButton &_checkbox_hide;
+ Gtk::CheckButton &_checkbox_lock;
+ Gtk::CheckButton &_checkbox_preserve_ratio;
+
+ SpinButton &_spin_dpi;
+ Gtk::Label &_label_dpi;
+ Glib::RefPtr _adjustment_spin_dpi;
+
+ Gtk::Button &_button_set;
+
SPAttributeTable *_attr_table; //the widget for showing the on... names at the bottom
- /// Constructor auxiliary function creating the child widgets.
- void _init();
+ void _setButtonCallback();
+
+ /// Sets object properties ID on user input.
+ void _idChanged();
- /// Sets object properties (ID, label, title, description) on user input.
- void _labelChanged();
+ /// Callback for object's title
+ void _titleChanged();
+
+ /// Callback for object's description
+ void _descriptionChanged();
// Callback for highlight color
void _highlightChanged(guint rgba);
@@ -114,6 +136,9 @@ private:
/// Callback for 'image-rendering'.
void _imageRenderingChanged();
+ /// Callback for DPI spin button
+ void _dpiChanged();
+
/// Callback for checkbox Lock.
void _sensitivityToggled();