diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2018-12-24 16:42:06 +0000 |
|---|---|---|
| committer | Jabiertxof <jabier.arraiza@marker.es> | 2018-12-26 11:46:58 +0000 |
| commit | 2e9f2b6e96cec362e1b3f2ed884186cc49c2455c (patch) | |
| tree | 46857ec1fe481768ca11c980e95a020aec8fc421 /src/ui/dialog/cssdialog.cpp | |
| parent | Add status to attribute widget (diff) | |
| download | inkscape-2e9f2b6e96cec362e1b3f2ed884186cc49c2455c.tar.gz inkscape-2e9f2b6e96cec362e1b3f2ed884186cc49c2455c.zip | |
Add messagess to CSS dialog
Diffstat (limited to 'src/ui/dialog/cssdialog.cpp')
| -rw-r--r-- | src/ui/dialog/cssdialog.cpp | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/src/ui/dialog/cssdialog.cpp b/src/ui/dialog/cssdialog.cpp index 5b3fe7660..54713315b 100644 --- a/src/ui/dialog/cssdialog.cpp +++ b/src/ui/dialog/cssdialog.cpp @@ -16,11 +16,13 @@ #include "verbs.h" #include "selection.h" - +#include "message-context.h" +#include "message-stack.h" #include "ui/icon-loader.h" #include "ui/widget/iconrenderer.h" #include "xml/attribute-record.h" +#include <glibmm/i18n.h> namespace Inkscape { namespace UI { @@ -78,6 +80,20 @@ CssDialog::CssDialog(): _attrCol->add_attribute(_attrRenderer->property_text(), _cssColumns._styleAttrVal); } + status.set_halign(Gtk::ALIGN_START); + status.set_valign(Gtk::ALIGN_CENTER); + status.set_size_request(1, -1); + status.set_markup(""); + status.set_line_wrap(true); + status_box.pack_start( status, TRUE, TRUE, 0); + _getContents()->pack_end(status_box, false, false, 2); + + _message_stack = std::make_shared<Inkscape::MessageStack>(); + _message_context = std::unique_ptr<Inkscape::MessageContext>(new Inkscape::MessageContext(_message_stack)); + _message_changed_connection = _message_stack->connectChanged( + sigc::bind(sigc::ptr_fun(_set_status_message), GTK_WIDGET(status.gobj()))); + + GtkWidget *child = sp_get_icon_image("list-add", GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_widget_show(child); _buttonAddProperty.add(*manage(Glib::wrap(child))); @@ -89,6 +105,7 @@ CssDialog::CssDialog(): _getContents()->pack_start(_mainBox, Gtk::PACK_EXPAND_WIDGET); + css_reset_context(0); setDesktop(getDesktop()); _buttonAddProperty.signal_clicked().connect(sigc::mem_fun(*this, &CssDialog::_addProperty)); @@ -102,6 +119,17 @@ CssDialog::CssDialog(): CssDialog::~CssDialog() { setDesktop(nullptr); + _message_changed_connection.disconnect(); + _message_context = nullptr; + _message_stack = nullptr; + _message_changed_connection.~connection(); +} + +void CssDialog::_set_status_message(Inkscape::MessageType /*type*/, const gchar *message, GtkWidget *widget) +{ + if (widget) { + gtk_label_set_markup(GTK_LABEL(widget), message ? message : ""); + } } @@ -116,6 +144,22 @@ void CssDialog::setDesktop(SPDesktop* desktop) } /** + * Sets the CSSDialog status bar, depending on which attr is selected. + */ +void CssDialog::css_reset_context(gint css) +{ + if (css == 0) { + _message_context->set(Inkscape::NORMAL_MESSAGE, + _("<b>Click</b> CSS property to edit.")); + } + else { + const gchar *name = g_quark_to_string(css); + _message_context->setF(Inkscape::NORMAL_MESSAGE, + _("Propery <b>%s</b> selected. Press <b>Ctrl+Enter</b> when done editing to commit changes."), name); + } +} + +/** * @brief CssDialog::_addProperty * This function is a slot to signal_clicked for '+' button at the bottom of CSS * panel. A new row is added, double clicking which text for new property can be |
