From 009aaef8060460f8ccdaf3d9dc7db0b227f684fa Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Thu, 5 Apr 2012 19:45:27 +0200 Subject: add NULL checks to perhaps fix bug 970105 Fixed bugs: - https://launchpad.net/bugs/970105 (bzr r11156) --- src/interface.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index 493ffa32f..1e1324e32 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -1585,19 +1585,21 @@ sp_ui_overwrite_file(gchar const *filename) static void sp_ui_menu_item_set_name(GtkWidget *data, Glib::ustring const &name) { - void *child = gtk_bin_get_child (GTK_BIN (data)); - //child is either - //- a GtkHBox, whose first child is a label displaying name if the menu - //item has an accel key - //- a GtkLabel if the menu has no accel key - if (GTK_IS_LABEL(child)) { - gtk_label_set_markup_with_mnemonic(GTK_LABEL (child), name.c_str()); - } else if (GTK_IS_HBOX(child)) { - gtk_label_set_markup_with_mnemonic( - GTK_LABEL (gtk_container_get_children(GTK_CONTAINER (child))->data), - name.c_str()); - }//else sp_ui_menu_append_item_from_verb has been modified and can set - //a menu item in yet another way... + if (data || GTK_IS_BIN (data)) { + void *child = gtk_bin_get_child (GTK_BIN (data)); + //child is either + //- a GtkHBox, whose first child is a label displaying name if the menu + //item has an accel key + //- a GtkLabel if the menu has no accel key + if (GTK_IS_LABEL(child)) { + gtk_label_set_markup_with_mnemonic(GTK_LABEL (child), name.c_str()); + } else if (GTK_IS_HBOX(child)) { + gtk_label_set_markup_with_mnemonic( + GTK_LABEL (gtk_container_get_children(GTK_CONTAINER (child))->data), + name.c_str()); + }//else sp_ui_menu_append_item_from_verb has been modified and can set + //a menu item in yet another way... + } } void injectRenamedIcons() -- cgit v1.2.3 From bcd804c6c383e2964b072257da282d9a91db7d16 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Thu, 5 Apr 2012 22:14:44 +0200 Subject: C++ify context menu: - c++ified context-menu.cpp (and included in interface.cpp) - removed dozens of pointer conversions (of which some were erroneous) - fixed a memory leak - added some null pointer checks to prevent crashes (bzr r11160) --- src/interface.cpp | 792 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 687 insertions(+), 105 deletions(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index 1e1324e32..77ef9a075 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -8,11 +8,13 @@ * bulia byak * Jon A. Cruz * Abhishek Sharma + * Kris De Gussem * + * Copyright (C) 2012 Kris De Gussem * Copyright (C) 2010 authors * Copyright (C) 1999-2005 authors - * Copyright (C) 2001-2002 Ximian, Inc. * Copyright (C) 2004 David Turner + * Copyright (C) 2001-2002 Ximian, Inc. * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -37,7 +39,6 @@ #include "desktop-handles.h" #include "interface.h" #include "desktop.h" -#include "ui/context-menu.h" #include "selection.h" #include "selection-chemistry.h" #include "svg-view-widget.h" @@ -66,6 +67,16 @@ #include "gradient-drag.h" #include "widgets/ege-paint-def.h" #include "document-undo.h" +#include "sp-anchor.h" +#include "sp-clippath.h" +#include "sp-image.h" +#include "sp-item.h" +#include "sp-mask.h" +// #include "verbs.h" +#include "message-stack.h" +// #include "inkscape.h" +#include "ui/dialog/dialog-manager.h" +// #include "../xml/repr.h" #include #include @@ -296,9 +307,9 @@ void sp_ui_new_view_preview() void sp_ui_close_view(GtkWidget */*widget*/) { - SPDesktop *dt = SP_ACTIVE_DESKTOP; + SPDesktop *dt = SP_ACTIVE_DESKTOP; - if (dt == NULL) { + if (dt == NULL) { return; } @@ -329,14 +340,14 @@ sp_ui_close_all(void) /* Iterate through all the windows, destroying each in the order they become active */ while (SP_ACTIVE_DESKTOP) { - SPDesktop *dt = SP_ACTIVE_DESKTOP; - if (dt->shutdown()) { + SPDesktop *dt = SP_ACTIVE_DESKTOP; + if (dt->shutdown()) { /* The user canceled the operation, so end doing the close */ return FALSE; } - // Shutdown can proceed; use the stored reference to the desktop here instead of the current SP_ACTIVE_DESKTOP, - // because the user might have changed the focus in the meantime (see bug #381357 on Launchpad) - dt->destroyWidget(); + // Shutdown can proceed; use the stored reference to the desktop here instead of the current SP_ACTIVE_DESKTOP, + // because the user might have changed the focus in the meantime (see bug #381357 on Launchpad) + dt->destroyWidget(); } return TRUE; @@ -353,7 +364,7 @@ static void sp_ui_menu_activate(void */*object*/, SPAction *action) { if (!temporarily_block_actions) { - sp_action_perform(action, NULL); + sp_action_perform(action, NULL); } } @@ -481,8 +492,7 @@ sp_ui_dialog_title_string(Inkscape::Verb *verb, gchar *c) * */ -static GtkWidget * -sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb *verb, Inkscape::UI::View::View *view, bool radio = false, GSList *group = NULL) +static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb *verb, Inkscape::UI::View::View *view, bool radio, GSList *group) { SPAction *action; GtkWidget *item; @@ -503,18 +513,18 @@ sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb *verb, Inkscape:: GtkWidget *const hb = gtk_hbox_new(FALSE, 16); GtkWidget *const name_lbl = gtk_label_new(""); gtk_label_set_markup_with_mnemonic(GTK_LABEL(name_lbl), action->name); - gtk_misc_set_alignment((GtkMisc *) name_lbl, 0.0, 0.5); - gtk_box_pack_start((GtkBox *) hb, name_lbl, TRUE, TRUE, 0); + gtk_misc_set_alignment(reinterpret_cast(name_lbl), 0.0, 0.5); + gtk_box_pack_start(reinterpret_cast(hb), name_lbl, TRUE, TRUE, 0); GtkWidget *const accel_lbl = gtk_label_new(c); - gtk_misc_set_alignment((GtkMisc *) accel_lbl, 1.0, 0.5); - gtk_box_pack_end((GtkBox *) hb, accel_lbl, FALSE, FALSE, 0); + gtk_misc_set_alignment(reinterpret_cast(accel_lbl), 1.0, 0.5); + gtk_box_pack_end(reinterpret_cast(hb), accel_lbl, FALSE, FALSE, 0); gtk_widget_show_all(hb); if (radio) { item = gtk_radio_menu_item_new (group); } else { item = gtk_image_menu_item_new(); } - gtk_container_add((GtkContainer *) item, hb); + gtk_container_add(reinterpret_cast(item), hb); g_free(c); } else { if (radio) { @@ -524,8 +534,8 @@ sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb *verb, Inkscape:: } GtkWidget *const name_lbl = gtk_label_new(""); gtk_label_set_markup_with_mnemonic(GTK_LABEL(name_lbl), action->name); - gtk_misc_set_alignment((GtkMisc *) name_lbl, 0.0, 0.5); - gtk_container_add((GtkContainer *) item, name_lbl); + gtk_misc_set_alignment(reinterpret_cast(name_lbl), 0.0, 0.5); + gtk_container_add(reinterpret_cast(item), name_lbl); } action->signal_set_sensitive.connect( @@ -929,8 +939,8 @@ void sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, Inkscape gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE); } if (verb->get_code() != SP_VERB_NONE) { - SPAction *action = verb->get_action(view); - g_signal_connect( G_OBJECT(item), "expose_event", (GCallback) update_view_menu, (void *) action); + SPAction *action = verb->get_action(view); + g_signal_connect( G_OBJECT(item), "expose_event", (GCallback) update_view_menu, (void *) action); } } else { sp_ui_menu_append_item_from_verb(GTK_MENU(menu), verb, view); @@ -1016,87 +1026,6 @@ GtkWidget *sp_ui_main_menubar(Inkscape::UI::View::View *view) return mbar; } -static void leave_group(GtkMenuItem *, SPDesktop *desktop) { - desktop->setCurrentLayer(desktop->currentLayer()->parent); -} - -static void enter_group(GtkMenuItem *mi, SPDesktop *desktop) { - desktop->setCurrentLayer(reinterpret_cast(g_object_get_data(G_OBJECT(mi), "group"))); - sp_desktop_selection(desktop)->clear(); -} - -GtkWidget * -sp_ui_context_menu(Inkscape::UI::View::View *view, SPItem *item) -{ - GtkWidget *m; - SPDesktop *dt; - - dt = static_cast(view); - - m = gtk_menu_new(); - - /* Undo and Redo */ - sp_ui_menu_append_item_from_verb(GTK_MENU(m), Inkscape::Verb::get(SP_VERB_EDIT_UNDO), view); - sp_ui_menu_append_item_from_verb(GTK_MENU(m), Inkscape::Verb::get(SP_VERB_EDIT_REDO), view); - - /* Separator */ - sp_ui_menu_append_item(GTK_MENU(m), NULL, NULL, NULL, NULL, NULL, NULL); - - sp_ui_menu_append_item_from_verb(GTK_MENU(m), Inkscape::Verb::get(SP_VERB_EDIT_CUT), view); - sp_ui_menu_append_item_from_verb(GTK_MENU(m), Inkscape::Verb::get(SP_VERB_EDIT_COPY), view); - sp_ui_menu_append_item_from_verb(GTK_MENU(m), Inkscape::Verb::get(SP_VERB_EDIT_PASTE), view); - - /* Separator */ - sp_ui_menu_append_item(GTK_MENU(m), NULL, NULL, NULL, NULL, NULL, NULL); - - sp_ui_menu_append_item_from_verb(GTK_MENU(m), Inkscape::Verb::get(SP_VERB_EDIT_DUPLICATE), view); - sp_ui_menu_append_item_from_verb(GTK_MENU(m), Inkscape::Verb::get(SP_VERB_EDIT_DELETE), view); - - /* Item menu */ - if (item) { - sp_ui_menu_append_item(GTK_MENU(m), NULL, NULL, NULL, NULL, NULL, NULL); - sp_object_menu((SPObject *) item, dt, GTK_MENU(m)); - } - - /* layer menu */ - SPGroup *group=NULL; - if (item) { - if (SP_IS_GROUP(item)) { - group = SP_GROUP(item); - } else if ( item != dt->currentRoot() && SP_IS_GROUP(item->parent) ) { - group = SP_GROUP(item->parent); - } - } - - if (( group && group != dt->currentLayer() ) || - ( dt->currentLayer() != dt->currentRoot() && dt->currentLayer()->parent != dt->currentRoot() ) ) { - /* Separator */ - sp_ui_menu_append_item(GTK_MENU(m), NULL, NULL, NULL, NULL, NULL, NULL); - } - - if ( group && group != dt->currentLayer() ) { - /* TRANSLATORS: #%s is the id of the group e.g. , not a number. */ - gchar *label=g_strdup_printf(_("Enter group #%s"), group->getId()); - GtkWidget *w = gtk_menu_item_new_with_label(label); - g_free(label); - g_object_set_data(G_OBJECT(w), "group", group); - g_signal_connect(G_OBJECT(w), "activate", GCallback(enter_group), dt); - gtk_widget_show(w); - gtk_menu_shell_append(GTK_MENU_SHELL(m), w); - } - - if ( dt->currentLayer() != dt->currentRoot() ) { - if ( dt->currentLayer()->parent != dt->currentRoot() ) { - GtkWidget *w = gtk_menu_item_new_with_label(_("Go to parent")); - g_signal_connect(G_OBJECT(w), "activate", GCallback(leave_group), dt); - gtk_widget_show(w); - gtk_menu_shell_append(GTK_MENU_SHELL(m), w); - - } - } - - return m; -} /* Drag and Drop */ void @@ -1455,9 +1384,9 @@ sp_ui_drag_data_received(GtkWidget *widget, gchar *filename = g_build_filename( g_get_tmp_dir(), "inkscape-dnd-import", NULL ); g_file_set_contents(filename, - reinterpret_cast(gtk_selection_data_get_data (data)), - gtk_selection_data_get_length (data), - NULL); + reinterpret_cast(gtk_selection_data_get_data (data)), + gtk_selection_data_get_length (data), + NULL); file_import(doc, filename, ext); g_free(filename); @@ -1629,6 +1558,659 @@ void injectRenamedIcons() } +void ContextMenu::EnterGroup(Gtk::MenuItem* mi) +{ + _desktop->setCurrentLayer(reinterpret_cast(mi->get_data("group"))); + _desktop->selection->clear(); +} + +void ContextMenu::LeaveGroup(void) +{ + _desktop->setCurrentLayer(_desktop->currentLayer()->parent); +} + +ContextMenu::ContextMenu(Inkscape::UI::View::View *view, SPItem *item) : + _item(item), + separators(), + MIGroup(), + MIParent(_("Go to parent")) +{ +// g_message("ContextMenu"); + _object = static_cast(item); + _desktop = static_cast(view); + + /* Undo and Redo */ + AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_UNDO), view); + AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_REDO), view); + + AddSeparator(); + + AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_CUT), view); + AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_COPY), view); + AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_PASTE), view); + + AddSeparator(); + + AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_DUPLICATE), view); + AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_DELETE), view); + + /* Item menu */ + if (item!=NULL) { + AddSeparator(); + MakeObjectMenu(); + } + + /* layer menu */ + SPGroup *group=NULL; + if (item) { + if (SP_IS_GROUP(item)) { + group = SP_GROUP(item); + } else if ( item != _desktop->currentRoot() && SP_IS_GROUP(item->parent) ) { + group = SP_GROUP(item->parent); + } + } + + if (( group && group != _desktop->currentLayer() ) || + ( _desktop->currentLayer() != _desktop->currentRoot() && _desktop->currentLayer()->parent != _desktop->currentRoot() ) ) { + AddSeparator(); + } + + if ( group && group != _desktop->currentLayer() ) { + /* TRANSLATORS: #%1 is the id of the group e.g. , not a number. */ + MIGroup.set_label (Glib::ustring::compose(_("Enter group #%1"), group->getId())); + MIGroup.set_data("group", group); + MIGroup.signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &ContextMenu::EnterGroup),&MIGroup)); + MIGroup.show(); + append(MIGroup); + } + + if ( _desktop->currentLayer() != _desktop->currentRoot() ) { + if ( _desktop->currentLayer()->parent != _desktop->currentRoot() ) { + MIParent.signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::LeaveGroup)); + MIParent.show(); + append(MIParent); + } + } +} + +ContextMenu::~ContextMenu(void) +{ +// g_message("~ContextMenu"); +} + +Gtk::SeparatorMenuItem* ContextMenu::AddSeparator(void) +{ + Gtk::SeparatorMenuItem* sep = new Gtk::SeparatorMenuItem(); + sep->show(); + append(*sep); + separators.push_back(sep); + return sep; +} + +void ContextMenu::AppendItemFromVerb(Inkscape::Verb *verb, Inkscape::UI::View::View *view)//, bool radio, GSList *group) +{ + SPAction *action; + + if (verb->get_code() == SP_VERB_NONE) { + Gtk::MenuItem *item = AddSeparator(); + item->show(); + append(*item); + } else { + action = verb->get_action(view); + if (!action) + { + return; + } + + Gtk::ImageMenuItem *item = NULL; + unsigned int shortcut = sp_shortcut_get_primary(verb); + if (shortcut!=GDK_VoidSymbol) { + gchar* c = sp_shortcut_get_label(shortcut); + Gtk::HBox *const hb = new Gtk::HBox (FALSE, 16); + Gtk::Label *const name_lbl = new Gtk::Label(action->name, true); + name_lbl->set_alignment(0.0, 0.5); + hb->pack_start(*name_lbl, TRUE, TRUE, 0); + Gtk::Label *const accel_lbl = new Gtk::Label(c); + accel_lbl->set_alignment(1.0, 0.5); + hb->pack_end(*accel_lbl, FALSE, FALSE, 0); + hb->show_all(); + // if (radio) { + // item = gtk_radio_menu_item_new (group); + // } else { + item = new Gtk::ImageMenuItem(); + // } + item->add(*hb); + g_free(c); + } else { + // if (radio) { + // item = gtk_radio_menu_item_new (group); + // } else { + item = new Gtk::ImageMenuItem(); + // } + Gtk::Label *const name_lbl = new Gtk::Label(action->name, true); + name_lbl->set_alignment(0.0, 0.5); + item->add(*name_lbl); + } + + action->signal_set_sensitive.connect(sigc::mem_fun(*this, &ContextMenu::set_sensitive)); + action->signal_set_name.connect(sigc::mem_fun(*item, &ContextMenu::set_name)); + + if (!action->sensitive) { + item->set_sensitive(FALSE); + } + + if (action->image) { + sp_ui_menuitem_add_icon((GtkWidget*)item->gobj(), action->image); + } + item->set_events(Gdk::KEY_PRESS_MASK); + item->set_data("view", (gpointer) view); + item->signal_activate().connect(sigc::bind(sigc::ptr_fun(sp_ui_menu_activate),item,action)); + item->signal_select().connect(sigc::bind(sigc::ptr_fun(sp_ui_menu_select_action),item,action)); + item->signal_deselect().connect(sigc::bind(sigc::ptr_fun(sp_ui_menu_deselect_action),item,action)); + item->show(); + append(*item); + } +} + +void ContextMenu::MakeObjectMenu(void) +{ + GObjectClass *klass = G_OBJECT_GET_CLASS(_object); //to deduce the object's type from its class + GType type = G_TYPE_FROM_CLASS(klass); + + if (type | SP_TYPE_ITEM) + { + MakeItemMenu (); + } + if (type == SP_TYPE_GROUP) + { + MakeGroupMenu(); + } + if (type == SP_TYPE_ANCHOR) + { + MakeAnchorMenu(); + } + if (type == SP_TYPE_IMAGE) + { + MakeImageMenu(); + } + if (type == SP_TYPE_SHAPE) + { + MakeShapeMenu(); + } + if (type == SP_TYPE_TEXT) + { + MakeTextMenu(); + } +} + +void ContextMenu::MakeItemMenu (void) +{ + Gtk::MenuItem* mi; + + /* Item dialog */ + mi = new Gtk::MenuItem(_("_Object Properties..."),1); + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ItemProperties)); + mi->show(); + append(*mi); + + AddSeparator(); + + /* Select item */ + mi = new Gtk::MenuItem(_("_Select This"),1); + if (_desktop->selection->includes(_item)) { + mi->set_sensitive(FALSE); + } else { + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ItemSelectThis)); + } + mi->show(); + append(*mi); + + /* Select same fill and stroke */ + mi = new Gtk::MenuItem(_("_Select Same Fill and Stroke"),1); + if (_desktop->selection->isEmpty()) { + mi->set_sensitive(FALSE); + } else { + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::SelectSameFillStroke)); + } + mi->set_sensitive(!SP_IS_ANCHOR(_item)); + mi->show(); + append(*mi); + + /* Create link */ + mi = new Gtk::MenuItem(_("_Create Link"),1); + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ItemCreateLink)); + mi->set_sensitive(!SP_IS_ANCHOR(_item)); + mi->show(); + append(*mi); + + bool ClipRefOK=false; + bool MaskRefOK=false; + if (_item){ + if (_item->clip_ref){ + if (_item->clip_ref->getObject()){ + ClipRefOK=true; + } + } + } + if (_item){ + if (_item->mask_ref){ + if (_item->mask_ref->getObject()){ + MaskRefOK=true; + } + } + } + /* Set mask */ + mi = new Gtk::MenuItem(_("Set Mask"),1); + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::SetMask)); + if (ClipRefOK || MaskRefOK) { + mi->set_sensitive(FALSE); + } else { + mi->set_sensitive(TRUE); + } + mi->show(); + append(*mi); + + /* Release mask */ + mi = new Gtk::MenuItem(_("Release Mask"),1); + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ReleaseMask)); + if (MaskRefOK) { + mi->set_sensitive(TRUE); + } else { + mi->set_sensitive(FALSE); + } + mi->show(); + append(*mi); + + /* Set Clip */ + mi = new Gtk::MenuItem(_("Set _Clip"),1); + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::SetClip)); + if (ClipRefOK || MaskRefOK) { + mi->set_sensitive(FALSE); + } else { + mi->set_sensitive(TRUE); + } + mi->show(); + append(*mi); + + /* Release Clip */ + mi = new Gtk::MenuItem(_("Release C_lip"),1); + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ReleaseClip)); + if (ClipRefOK) { + mi->set_sensitive(TRUE); + } else { + mi->set_sensitive(FALSE); + } + mi->show(); + append(*mi); +} + +void ContextMenu::SelectSameFillStroke(void) +{ + sp_select_same_fill_stroke_style(_desktop, true, true, true); +} + +void ContextMenu::ItemProperties(void) +{ + _desktop->selection->set(_item); + _desktop->_dlg_mgr->showDialog("ObjectProperties"); +} + +void ContextMenu::ItemSelectThis(void) +{ + _desktop->selection->set(_item); +} + +void ContextMenu::ItemCreateLink(void) +{ + Inkscape::XML::Document *xml_doc = _desktop->doc()->getReprDoc(); + Inkscape::XML::Node *repr = xml_doc->createElement("svg:a"); + _item->parent->getRepr()->addChild(repr, _item->getRepr()); + SPObject *object = _item->document->getObjectByRepr(repr); + g_return_if_fail(SP_IS_ANCHOR(object)); + + const char *id = _item->getRepr()->attribute("id"); + Inkscape::XML::Node *child = _item->getRepr()->duplicate(xml_doc); + _item->deleteObject(false); + repr->addChild(child, NULL); + child->setAttribute("id", id); + + Inkscape::GC::release(repr); + Inkscape::GC::release(child); + + DocumentUndo::done(object->document, SP_VERB_NONE, _("Create link")); + + _desktop->selection->set(SP_ITEM(object)); + _desktop->_dlg_mgr->showDialog("ObjectAttributes"); +} + +void ContextMenu::SetMask(void) +{ + sp_selection_set_mask(_desktop, false, false); +} + +void ContextMenu::ReleaseMask(void) +{ + sp_selection_unset_mask(_desktop, false); +} + + +void ContextMenu::SetClip(void) +{ + sp_selection_set_mask(_desktop, true, false); +} + + +void ContextMenu::ReleaseClip(void) +{ + sp_selection_unset_mask(_desktop, true); +} + +void ContextMenu::MakeGroupMenu(void) +{ + /* "Ungroup" */ + Gtk::MenuItem* mi = new Gtk::MenuItem(_("_Ungroup"),1); + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ActivateUngroup)); + mi->show(); + append(*mi); +} + +void ContextMenu::ActivateUngroup(void) +{ + GSList *children = NULL; + + sp_item_group_ungroup(static_cast(_item), &children); + _desktop->selection->setList(children); + g_slist_free(children); +} + +void ContextMenu::MakeAnchorMenu(void) +{ + Gtk::MenuItem* mi; + + /* Link dialog */ + mi = new Gtk::MenuItem(_("Link _Properties..."),1); + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::AnchorLinkProperties)); + mi->show(); + append(*mi); + + /* Select item */ + mi = new Gtk::MenuItem(_("_Follow Link"),1); + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::AnchorLinkFollow)); + mi->show(); + append(*mi); + + /* Reset transformations */ + mi = new Gtk::MenuItem(_("_Remove Link"),1); + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::AnchorLinkRemove)); + mi->show(); + append(*mi); +} + +void ContextMenu::AnchorLinkProperties(void) +{ + _desktop->_dlg_mgr->showDialog("ObjectAttributes"); +} + +void ContextMenu::AnchorLinkFollow(void) +{ + /* shell out to an external browser here */ +} + +void ContextMenu::AnchorLinkRemove(void) +{ + GSList *children = NULL; + sp_item_group_ungroup(static_cast(_item), &children); + g_slist_free(children); +} + +void ContextMenu::MakeImageMenu (void) +{ + Gtk::MenuItem* mi; + Inkscape::XML::Node *ir = _object->getRepr(); + const gchar *href = ir->attribute("xlink:href"); + + /* Image properties */ + mi = new Gtk::MenuItem(_("Image _Properties..."),1); + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ImageProperties)); + mi->show(); + append(*mi); + + /* Edit externally */ + mi = new Gtk::MenuItem(_("Edit Externally..."),1); + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ImageEdit)); + mi->show(); + append(*mi); + if ( (!href) || ((strncmp(href, "data:", 5) == 0)) ) { + mi->set_sensitive( FALSE ); + } + + /* Embed image */ + if (Inkscape::Verb::getbyid( "org.ekips.filter.embedselectedimages" )) { + mi = new Gtk::MenuItem(C_("Context menu", "Embed Image")); + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ImageEmbed)); + mi->show(); + append(*mi); + if ( (!href) || ((strncmp(href, "data:", 5) == 0)) ) { + mi->set_sensitive( FALSE ); + } + } + + /* Extract image */ + if (Inkscape::Verb::getbyid( "org.ekips.filter.extractimage" )) { + mi = new Gtk::MenuItem(C_("Context menu", "Extract Image...")); + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ImageExtract)); + mi->show(); + append(*mi); + if ( (!href) || ((strncmp(href, "data:", 5) == 0)) ) { + mi->set_sensitive( FALSE ); + } + } +} + +void ContextMenu::ImageProperties(void) +{ + _desktop->_dlg_mgr->showDialog("ObjectAttributes"); +} + +Glib::ustring ContextMenu::getImageEditorName() { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + Glib::ustring value; + Glib::ustring choices = prefs->getString("/options/bitmapeditor/value"); + if (!choices.empty()) { + value = choices; + } + else { + value = "gimp"; + } + return value; +} + +/* Edit Externally entry */ +void ContextMenu::ImageEdit(void) +{ + if (_desktop->selection->isEmpty()) { + _desktop->selection->set(_item); + } + + GSList const *selected = _desktop->selection->itemList(); + + GError* errThing = 0; + Glib::ustring cmdline = getImageEditorName(); + Glib::ustring name; + Glib::ustring fullname; + +#ifdef WIN32 + // g_spawn_command_line_sync parsing is done according to Unix shell rules, + // not Windows command interpreter rules. Thus we need to enclose the + // executable path with single quotes. + int index = cmdline.find(".exe"); + if ( index < 0 ) index = cmdline.find(".bat"); + if ( index < 0 ) index = cmdline.find(".com"); + if ( index >= 0 ) { + Glib::ustring editorBin = cmdline.substr(0, index + 4).c_str(); + Glib::ustring args = cmdline.substr(index + 4, cmdline.length()).c_str(); + editorBin.insert(0, "'"); + editorBin.append("'"); + cmdline = editorBin; + cmdline.append(args); + } else { + // Enclose the whole command line if no executable path can be extracted. + cmdline.insert(0, "'"); + cmdline.append("'"); + } +#endif + + for (GSList const *iter = selected; iter != NULL; iter = iter->next) { + Inkscape::XML::Node *ir = SP_ITEM(iter->data)->getRepr(); + const gchar *href = ir->attribute("xlink:href"); + + if (strncmp (href,"file:",5) == 0) { + // URI to filename conversion + name = g_filename_from_uri(href, NULL, NULL); + } else { + name.append(href); + } + + if (Glib::path_is_absolute(name)) { + fullname = name; + } else if (SP_ACTIVE_DOCUMENT->getBase()) { + fullname = Glib::build_filename(SP_ACTIVE_DOCUMENT->getBase(), name); + } else { + fullname = Glib::build_filename(Glib::get_current_dir(), name); + } + + cmdline.append(" '"); + cmdline.append(fullname.c_str()); + cmdline.append("'"); + } + + //g_warning("##Command line: %s\n", cmdline.c_str()); + + g_spawn_command_line_async(cmdline.c_str(), &errThing); + + if ( errThing ) { + g_warning("Problem launching editor (%d). %s", errThing->code, errThing->message); + (_desktop->messageStack())->flash(Inkscape::ERROR_MESSAGE, errThing->message); + g_error_free(errThing); + errThing = 0; + } +} + +/* Embed Image entry */ +void ContextMenu::ImageEmbed(void) +{ + if (_desktop->selection->isEmpty()) { + _desktop->selection->set(_item); + } + + Inkscape::Verb *verb = Inkscape::Verb::getbyid( "org.ekips.filter.embedselectedimages" ); + if (verb) { + SPAction *action = verb->get_action(_desktop); + if (action) { + sp_action_perform(action, NULL); + } + } +} + +/* Extract Image entry */ +void ContextMenu::ImageExtract(void) +{ + if (_desktop->selection->isEmpty()) { + _desktop->selection->set(_item); + } + + Inkscape::Verb *verb = Inkscape::Verb::getbyid( "org.ekips.filter.extractimage" ); + if (verb) { + SPAction *action = verb->get_action(_desktop); + if (action) { + sp_action_perform(action, NULL); + } + } +} + +void ContextMenu::MakeShapeMenu (void) +{ + Gtk::MenuItem* mi; + + /* Item dialog */ + mi = new Gtk::MenuItem(_("_Fill and Stroke..."),1); + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::FillSettings)); + mi->show(); + append(*mi); +} + +void ContextMenu::FillSettings(void) +{ + if (_desktop->selection->isEmpty()) { + _desktop->selection->set(_item); + } + + _desktop->_dlg_mgr->showDialog("FillAndStroke"); +} + +void ContextMenu::MakeTextMenu (void) +{ + Gtk::MenuItem* mi; + + /* Fill and Stroke dialog */ + mi = new Gtk::MenuItem(_("_Fill and Stroke..."),1); + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::FillSettings)); + mi->show(); + append(*mi); + + /* Edit Text dialog */ + mi = new Gtk::MenuItem(_("_Text and Font..."),1); + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::TextSettings)); + mi->show(); + append(*mi); + + /* Spellcheck dialog */ + mi = new Gtk::MenuItem(_("Check Spellin_g..."),1); + mi->set_data("desktop", _desktop); + mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::SpellcheckSettings)); + mi->show(); + append(*mi); +} + +/* Edit Text entry */ +void ContextMenu::TextSettings (void) +{ + if (_desktop->selection->isEmpty()) { + _desktop->selection->set(_item); + } + + _desktop->_dlg_mgr->showDialog("TextFont"); +} + +/* Spellcheck entry */ +void ContextMenu::SpellcheckSettings (void) +{ + if (_desktop->selection->isEmpty()) { + _desktop->selection->set(_item); + } + + _desktop->_dlg_mgr->showDialog("SpellCheck"); +} + /* Local Variables: mode:c++ -- cgit v1.2.3 From a5080325d2e488598ece94094a3984dcdd292055 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Fri, 6 Apr 2012 08:09:09 +0200 Subject: build warning fix (bzr r11161) --- src/interface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index 77ef9a075..05c8b9844 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -492,7 +492,7 @@ sp_ui_dialog_title_string(Inkscape::Verb *verb, gchar *c) * */ -static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb *verb, Inkscape::UI::View::View *view, bool radio, GSList *group) +static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb *verb, Inkscape::UI::View::View *view, bool radio = false, GSList *group = NULL) { SPAction *action; GtkWidget *item; -- cgit v1.2.3 From aa256328ec303abecd4c01bb662cdf7e21f69669 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Fri, 6 Apr 2012 08:38:32 +0200 Subject: fixes issue with revision 11160? (bzr r11162) --- src/interface.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index 05c8b9844..168a53ddc 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -1717,27 +1717,27 @@ void ContextMenu::MakeObjectMenu(void) GObjectClass *klass = G_OBJECT_GET_CLASS(_object); //to deduce the object's type from its class GType type = G_TYPE_FROM_CLASS(klass); - if (type | SP_TYPE_ITEM) + if (G_TYPE_CHECK_CLASS_TYPE(klass, SP_TYPE_ITEM)) { MakeItemMenu (); } - if (type == SP_TYPE_GROUP) + if (G_TYPE_CHECK_CLASS_TYPE(klass, SP_TYPE_GROUP)) { MakeGroupMenu(); } - if (type == SP_TYPE_ANCHOR) + if (G_TYPE_CHECK_CLASS_TYPE(klass, SP_TYPE_ANCHOR)) { MakeAnchorMenu(); } - if (type == SP_TYPE_IMAGE) + if (G_TYPE_CHECK_CLASS_TYPE(klass, SP_TYPE_IMAGE)) { MakeImageMenu(); } - if (type == SP_TYPE_SHAPE) + if (G_TYPE_CHECK_CLASS_TYPE(klass, SP_TYPE_SHAPE)) { MakeShapeMenu(); } - if (type == SP_TYPE_TEXT) + if (G_TYPE_CHECK_CLASS_TYPE(klass, SP_TYPE_TEXT)) { MakeTextMenu(); } -- cgit v1.2.3 From f0e728e66264419d8dbeaab2f0b0a246cb2ae16d Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Fri, 6 Apr 2012 20:51:45 +0200 Subject: restore item order of dialogs in context menu (Bug #910529) (bzr r11167) --- src/interface.cpp | 72 +++++++++++++++++++++---------------------------------- 1 file changed, 27 insertions(+), 45 deletions(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index 168a53ddc..319eceaec 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -1593,6 +1593,8 @@ ContextMenu::ContextMenu(Inkscape::UI::View::View *view, SPItem *item) : AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_DUPLICATE), view); AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_DELETE), view); + + positionOfLastDialog = 10; // 9 in front + 1 for the separator in the next if; used to position the dialog menu entries below each other /* Item menu */ if (item!=NULL) { @@ -1749,10 +1751,9 @@ void ContextMenu::MakeItemMenu (void) /* Item dialog */ mi = new Gtk::MenuItem(_("_Object Properties..."),1); - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ItemProperties)); mi->show(); - append(*mi); + append(*mi);//insert(*mi,positionOfLastDialog++); AddSeparator(); @@ -1761,7 +1762,6 @@ void ContextMenu::MakeItemMenu (void) if (_desktop->selection->includes(_item)) { mi->set_sensitive(FALSE); } else { - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ItemSelectThis)); } mi->show(); @@ -1772,7 +1772,6 @@ void ContextMenu::MakeItemMenu (void) if (_desktop->selection->isEmpty()) { mi->set_sensitive(FALSE); } else { - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::SelectSameFillStroke)); } mi->set_sensitive(!SP_IS_ANCHOR(_item)); @@ -1781,7 +1780,6 @@ void ContextMenu::MakeItemMenu (void) /* Create link */ mi = new Gtk::MenuItem(_("_Create Link"),1); - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ItemCreateLink)); mi->set_sensitive(!SP_IS_ANCHOR(_item)); mi->show(); @@ -1789,23 +1787,22 @@ void ContextMenu::MakeItemMenu (void) bool ClipRefOK=false; bool MaskRefOK=false; - if (_item){ - if (_item->clip_ref){ - if (_item->clip_ref->getObject()){ - ClipRefOK=true; - } - } - } - if (_item){ - if (_item->mask_ref){ - if (_item->mask_ref->getObject()){ - MaskRefOK=true; - } - } - } + if (_item){ + if (_item->clip_ref){ + if (_item->clip_ref->getObject()){ + ClipRefOK=true; + } + } + } + if (_item){ + if (_item->mask_ref){ + if (_item->mask_ref->getObject()){ + MaskRefOK=true; + } + } + } /* Set mask */ mi = new Gtk::MenuItem(_("Set Mask"),1); - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::SetMask)); if (ClipRefOK || MaskRefOK) { mi->set_sensitive(FALSE); @@ -1817,7 +1814,6 @@ void ContextMenu::MakeItemMenu (void) /* Release mask */ mi = new Gtk::MenuItem(_("Release Mask"),1); - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ReleaseMask)); if (MaskRefOK) { mi->set_sensitive(TRUE); @@ -1829,9 +1825,8 @@ void ContextMenu::MakeItemMenu (void) /* Set Clip */ mi = new Gtk::MenuItem(_("Set _Clip"),1); - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::SetClip)); - if (ClipRefOK || MaskRefOK) { + if (ClipRefOK || MaskRefOK) { mi->set_sensitive(FALSE); } else { mi->set_sensitive(TRUE); @@ -1841,9 +1836,8 @@ void ContextMenu::MakeItemMenu (void) /* Release Clip */ mi = new Gtk::MenuItem(_("Release C_lip"),1); - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ReleaseClip)); - if (ClipRefOK) { + if (ClipRefOK) { mi->set_sensitive(TRUE); } else { mi->set_sensitive(FALSE); @@ -1917,7 +1911,6 @@ void ContextMenu::MakeGroupMenu(void) { /* "Ungroup" */ Gtk::MenuItem* mi = new Gtk::MenuItem(_("_Ungroup"),1); - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ActivateUngroup)); mi->show(); append(*mi); @@ -1938,21 +1931,18 @@ void ContextMenu::MakeAnchorMenu(void) /* Link dialog */ mi = new Gtk::MenuItem(_("Link _Properties..."),1); - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::AnchorLinkProperties)); mi->show(); - append(*mi); + insert(*mi,positionOfLastDialog++);//append(*mi); /* Select item */ mi = new Gtk::MenuItem(_("_Follow Link"),1); - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::AnchorLinkFollow)); mi->show(); append(*mi); /* Reset transformations */ mi = new Gtk::MenuItem(_("_Remove Link"),1); - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::AnchorLinkRemove)); mi->show(); append(*mi); @@ -1983,17 +1973,15 @@ void ContextMenu::MakeImageMenu (void) /* Image properties */ mi = new Gtk::MenuItem(_("Image _Properties..."),1); - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ImageProperties)); mi->show(); - append(*mi); + insert(*mi,positionOfLastDialog++);//append(*mi); /* Edit externally */ mi = new Gtk::MenuItem(_("Edit Externally..."),1); - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ImageEdit)); mi->show(); - append(*mi); + insert(*mi,positionOfLastDialog++);//append(*mi); if ( (!href) || ((strncmp(href, "data:", 5) == 0)) ) { mi->set_sensitive( FALSE ); } @@ -2001,7 +1989,6 @@ void ContextMenu::MakeImageMenu (void) /* Embed image */ if (Inkscape::Verb::getbyid( "org.ekips.filter.embedselectedimages" )) { mi = new Gtk::MenuItem(C_("Context menu", "Embed Image")); - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ImageEmbed)); mi->show(); append(*mi); @@ -2013,10 +2000,9 @@ void ContextMenu::MakeImageMenu (void) /* Extract image */ if (Inkscape::Verb::getbyid( "org.ekips.filter.extractimage" )) { mi = new Gtk::MenuItem(C_("Context menu", "Extract Image...")); - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ImageExtract)); mi->show(); - append(*mi); + insert(*mi,positionOfLastDialog++);//append(*mi); if ( (!href) || ((strncmp(href, "data:", 5) == 0)) ) { mi->set_sensitive( FALSE ); } @@ -2150,10 +2136,9 @@ void ContextMenu::MakeShapeMenu (void) /* Item dialog */ mi = new Gtk::MenuItem(_("_Fill and Stroke..."),1); - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::FillSettings)); mi->show(); - append(*mi); + insert(*mi,positionOfLastDialog++);//append(*mi); } void ContextMenu::FillSettings(void) @@ -2171,24 +2156,21 @@ void ContextMenu::MakeTextMenu (void) /* Fill and Stroke dialog */ mi = new Gtk::MenuItem(_("_Fill and Stroke..."),1); - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::FillSettings)); mi->show(); - append(*mi); + insert(*mi,positionOfLastDialog++);//append(*mi); /* Edit Text dialog */ mi = new Gtk::MenuItem(_("_Text and Font..."),1); - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::TextSettings)); mi->show(); - append(*mi); + insert(*mi,positionOfLastDialog++);//append(*mi); /* Spellcheck dialog */ mi = new Gtk::MenuItem(_("Check Spellin_g..."),1); - mi->set_data("desktop", _desktop); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::SpellcheckSettings)); mi->show(); - append(*mi); + insert(*mi,positionOfLastDialog++);//append(*mi); } /* Edit Text entry */ -- cgit v1.2.3 From d0dd1656c0c53026ea672a366e7405a6e9cfc637 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Mon, 9 Apr 2012 21:18:03 +0200 Subject: Documentation / dropping some pointer conversions in context menu (bzr r11200) --- src/interface.cpp | 112 +++++++++++++++++------------------------------------- 1 file changed, 34 insertions(+), 78 deletions(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index 319eceaec..5d030c397 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -287,8 +287,6 @@ sp_ui_new_view() sp_namedview_update_layers_from_document(static_cast(dtw->view)); } -/* TODO: not yet working */ -/* To be re-enabled (by adding to menu) once it works. */ void sp_ui_new_view_preview() { SPDocument *document = SP_ACTIVE_DOCUMENT; @@ -301,9 +299,6 @@ void sp_ui_new_view_preview() } } -/** - * \param widget unused - */ void sp_ui_close_view(GtkWidget */*widget*/) { @@ -323,17 +318,6 @@ sp_ui_close_view(GtkWidget */*widget*/) } -/** - * sp_ui_close_all - * - * This function is called to exit the program, and iterates through all - * open document view windows, attempting to close each in turn. If the - * view has unsaved information, the user will be prompted to save, - * discard, or cancel. - * - * Returns FALSE if the user cancels the close_all operation, TRUE - * otherwise. - */ unsigned int sp_ui_close_all(void) { @@ -395,10 +379,7 @@ sp_ui_menu_deselect(gpointer object) } /** - * sp_ui_menuitem_add_icon - * * Creates and attaches a scaled icon to the given menu item. - * */ void sp_ui_menuitem_add_icon( GtkWidget *item, gchar *icon_name ) @@ -416,10 +397,7 @@ sp_ui_menuitem_add_icon( GtkWidget *item, gchar *icon_name ) } // end of sp_ui_menu_add_icon /** - * sp_ui_menu_append_item - * * Appends a UI item with specific info for Inkscape/Sodipodi. - * */ static GtkWidget * sp_ui_menu_append_item( GtkMenu *menu, gchar const *stock, @@ -486,12 +464,10 @@ sp_ui_dialog_title_string(Inkscape::Verb *verb, gchar *c) /** - * sp_ui_menu_append_item_from_verb - * * Appends a custom menu UI from a verb. - * + * + * @see ContextMenu::AppendItemFromVerb for a c++ified alternative. Consider dropping sp_ui_menu_append_item_from_verb when c++ifying interface.cpp. */ - static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb *verb, Inkscape::UI::View::View *view, bool radio = false, GSList *group = NULL) { SPAction *action; @@ -1010,15 +986,6 @@ void sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, Inkscape } } -/** - * Build the main tool bar. - * - * Currently the main tool bar is built as a dynamic XML menu using - * \c sp_ui_build_dyn_menus. This function builds the bar, and then - * pass it to get items attached to it. - * - * @param view View to build the bar for - */ GtkWidget *sp_ui_main_menubar(Inkscape::UI::View::View *view) { GtkWidget *mbar = gtk_menu_bar_new(); @@ -1558,18 +1525,7 @@ void injectRenamedIcons() } -void ContextMenu::EnterGroup(Gtk::MenuItem* mi) -{ - _desktop->setCurrentLayer(reinterpret_cast(mi->get_data("group"))); - _desktop->selection->clear(); -} - -void ContextMenu::LeaveGroup(void) -{ - _desktop->setCurrentLayer(_desktop->currentLayer()->parent); -} - -ContextMenu::ContextMenu(Inkscape::UI::View::View *view, SPItem *item) : +ContextMenu::ContextMenu(SPDesktop *desktop, SPItem *item) : _item(item), separators(), MIGroup(), @@ -1577,22 +1533,17 @@ ContextMenu::ContextMenu(Inkscape::UI::View::View *view, SPItem *item) : { // g_message("ContextMenu"); _object = static_cast(item); - _desktop = static_cast(view); - - /* Undo and Redo */ - AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_UNDO), view); - AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_REDO), view); + _desktop = desktop; + AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_UNDO)); + AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_REDO)); AddSeparator(); - - AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_CUT), view); - AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_COPY), view); - AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_PASTE), view); - + AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_CUT)); + AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_COPY)); + AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_PASTE)); AddSeparator(); - - AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_DUPLICATE), view); - AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_DELETE), view); + AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_DUPLICATE)); + AppendItemFromVerb(Inkscape::Verb::get(SP_VERB_EDIT_DELETE)); positionOfLastDialog = 10; // 9 in front + 1 for the separator in the next if; used to position the dialog menu entries below each other @@ -1649,10 +1600,22 @@ Gtk::SeparatorMenuItem* ContextMenu::AddSeparator(void) return sep; } -void ContextMenu::AppendItemFromVerb(Inkscape::Verb *verb, Inkscape::UI::View::View *view)//, bool radio, GSList *group) +void ContextMenu::EnterGroup(Gtk::MenuItem* mi) { - SPAction *action; + _desktop->setCurrentLayer(reinterpret_cast(mi->get_data("group"))); + _desktop->selection->clear(); +} +void ContextMenu::LeaveGroup(void) +{ + _desktop->setCurrentLayer(_desktop->currentLayer()->parent); +} + +void ContextMenu::AppendItemFromVerb(Inkscape::Verb *verb)//, SPDesktop *view)//, bool radio, GSList *group) +{ + SPAction *action; + SPDesktop *view = _desktop; + if (verb->get_code() == SP_VERB_NONE) { Gtk::MenuItem *item = AddSeparator(); item->show(); @@ -1705,7 +1668,6 @@ void ContextMenu::AppendItemFromVerb(Inkscape::Verb *verb, Inkscape::UI::View::V sp_ui_menuitem_add_icon((GtkWidget*)item->gobj(), action->image); } item->set_events(Gdk::KEY_PRESS_MASK); - item->set_data("view", (gpointer) view); item->signal_activate().connect(sigc::bind(sigc::ptr_fun(sp_ui_menu_activate),item,action)); item->signal_select().connect(sigc::bind(sigc::ptr_fun(sp_ui_menu_select_action),item,action)); item->signal_deselect().connect(sigc::bind(sigc::ptr_fun(sp_ui_menu_deselect_action),item,action)); @@ -1717,7 +1679,6 @@ void ContextMenu::AppendItemFromVerb(Inkscape::Verb *verb, Inkscape::UI::View::V void ContextMenu::MakeObjectMenu(void) { GObjectClass *klass = G_OBJECT_GET_CLASS(_object); //to deduce the object's type from its class - GType type = G_TYPE_FROM_CLASS(klass); if (G_TYPE_CHECK_CLASS_TYPE(klass, SP_TYPE_ITEM)) { @@ -1909,7 +1870,7 @@ void ContextMenu::ReleaseClip(void) void ContextMenu::MakeGroupMenu(void) { - /* "Ungroup" */ + /* Ungroup */ Gtk::MenuItem* mi = new Gtk::MenuItem(_("_Ungroup"),1); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ActivateUngroup)); mi->show(); @@ -1933,7 +1894,7 @@ void ContextMenu::MakeAnchorMenu(void) mi = new Gtk::MenuItem(_("Link _Properties..."),1); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::AnchorLinkProperties)); mi->show(); - insert(*mi,positionOfLastDialog++);//append(*mi); + insert(*mi,positionOfLastDialog++); /* Select item */ mi = new Gtk::MenuItem(_("_Follow Link"),1); @@ -1975,13 +1936,13 @@ void ContextMenu::MakeImageMenu (void) mi = new Gtk::MenuItem(_("Image _Properties..."),1); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ImageProperties)); mi->show(); - insert(*mi,positionOfLastDialog++);//append(*mi); + insert(*mi,positionOfLastDialog++); /* Edit externally */ mi = new Gtk::MenuItem(_("Edit Externally..."),1); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ImageEdit)); mi->show(); - insert(*mi,positionOfLastDialog++);//append(*mi); + insert(*mi,positionOfLastDialog++); if ( (!href) || ((strncmp(href, "data:", 5) == 0)) ) { mi->set_sensitive( FALSE ); } @@ -2002,7 +1963,7 @@ void ContextMenu::MakeImageMenu (void) mi = new Gtk::MenuItem(C_("Context menu", "Extract Image...")); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ImageExtract)); mi->show(); - insert(*mi,positionOfLastDialog++);//append(*mi); + insert(*mi,positionOfLastDialog++); if ( (!href) || ((strncmp(href, "data:", 5) == 0)) ) { mi->set_sensitive( FALSE ); } @@ -2027,7 +1988,6 @@ Glib::ustring ContextMenu::getImageEditorName() { return value; } -/* Edit Externally entry */ void ContextMenu::ImageEdit(void) { if (_desktop->selection->isEmpty()) { @@ -2098,7 +2058,6 @@ void ContextMenu::ImageEdit(void) } } -/* Embed Image entry */ void ContextMenu::ImageEmbed(void) { if (_desktop->selection->isEmpty()) { @@ -2114,7 +2073,6 @@ void ContextMenu::ImageEmbed(void) } } -/* Extract Image entry */ void ContextMenu::ImageExtract(void) { if (_desktop->selection->isEmpty()) { @@ -2138,7 +2096,7 @@ void ContextMenu::MakeShapeMenu (void) mi = new Gtk::MenuItem(_("_Fill and Stroke..."),1); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::FillSettings)); mi->show(); - insert(*mi,positionOfLastDialog++);//append(*mi); + insert(*mi,positionOfLastDialog++); } void ContextMenu::FillSettings(void) @@ -2158,22 +2116,21 @@ void ContextMenu::MakeTextMenu (void) mi = new Gtk::MenuItem(_("_Fill and Stroke..."),1); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::FillSettings)); mi->show(); - insert(*mi,positionOfLastDialog++);//append(*mi); + insert(*mi,positionOfLastDialog++); /* Edit Text dialog */ mi = new Gtk::MenuItem(_("_Text and Font..."),1); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::TextSettings)); mi->show(); - insert(*mi,positionOfLastDialog++);//append(*mi); + insert(*mi,positionOfLastDialog++); /* Spellcheck dialog */ mi = new Gtk::MenuItem(_("Check Spellin_g..."),1); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::SpellcheckSettings)); mi->show(); - insert(*mi,positionOfLastDialog++);//append(*mi); + insert(*mi,positionOfLastDialog++); } -/* Edit Text entry */ void ContextMenu::TextSettings (void) { if (_desktop->selection->isEmpty()) { @@ -2183,7 +2140,6 @@ void ContextMenu::TextSettings (void) _desktop->_dlg_mgr->showDialog("TextFont"); } -/* Spellcheck entry */ void ContextMenu::SpellcheckSettings (void) { if (_desktop->selection->isEmpty()) { -- cgit v1.2.3 From cd8cae5bf430285e5dcef81e9b46a43d8f91131b Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Tue, 10 Apr 2012 01:25:07 +0100 Subject: Replace remaining gtk_hbox_new usage (bzr r11204) --- src/interface.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index 5d030c397..afef8a08d 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -486,7 +486,12 @@ static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb shortcut = sp_shortcut_get_primary(verb); if (shortcut!=GDK_VoidSymbol) { gchar* c = sp_shortcut_get_label(shortcut); +#if GTK_CHECK_VERSION(3,0,0) + GtkWidget *const hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 16); + gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); +#else GtkWidget *const hb = gtk_hbox_new(FALSE, 16); +#endif GtkWidget *const name_lbl = gtk_label_new(""); gtk_label_set_markup_with_mnemonic(GTK_LABEL(name_lbl), action->name); gtk_misc_set_alignment(reinterpret_cast(name_lbl), 0.0, 0.5); @@ -670,7 +675,12 @@ sp_ui_menu_append_check_item_from_verb(GtkMenu *menu, Inkscape::UI::View::View * if (verb && shortcut!=GDK_VoidSymbol) { gchar* c = sp_shortcut_get_label(shortcut); +#if GTK_CHECK_VERSION(3,0,0) + GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 16); + gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); +#else GtkWidget *hb = gtk_hbox_new(FALSE, 16); +#endif { GtkWidget *l = gtk_label_new_with_mnemonic(action ? action->name : label); -- cgit v1.2.3 From 0d8dc3dc049f24b9d95a3c54e666fc89dee2321c Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Mon, 9 Apr 2012 23:21:26 -0700 Subject: Additional cleanup. (bzr r11206) --- src/interface.cpp | 38 -------------------------------------- 1 file changed, 38 deletions(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index afef8a08d..7dbcea9e7 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -396,44 +396,6 @@ sp_ui_menuitem_add_icon( GtkWidget *item, gchar *icon_name ) gtk_image_menu_item_set_image((GtkImageMenuItem *) item, icon); } // end of sp_ui_menu_add_icon -/** - * Appends a UI item with specific info for Inkscape/Sodipodi. - */ -static GtkWidget * -sp_ui_menu_append_item( GtkMenu *menu, gchar const *stock, - gchar const *label, gchar const *tip, Inkscape::UI::View::View *view, GCallback callback, - gpointer data, gboolean with_mnemonic = TRUE ) -{ - GtkWidget *item; - - if (stock) { - item = gtk_image_menu_item_new_from_stock(stock, NULL); - } else if (label) { - item = (with_mnemonic) - ? gtk_image_menu_item_new_with_mnemonic(label) : - gtk_image_menu_item_new_with_label(label); - } else { - item = gtk_separator_menu_item_new(); - } - - gtk_widget_show(item); - - if (callback) { - g_signal_connect(G_OBJECT(item), "activate", callback, data); - } - - if (tip && view) { - g_object_set_data(G_OBJECT(item), "view", (gpointer) view); - g_signal_connect( G_OBJECT(item), "select", G_CALLBACK(sp_ui_menu_select), (gpointer) tip ); - g_signal_connect( G_OBJECT(item), "deselect", G_CALLBACK(sp_ui_menu_deselect), NULL); - } - - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - - return item; - -} // end of sp_ui_menu_append_item() - void sp_ui_dialog_title_string(Inkscape::Verb *verb, gchar *c) { -- cgit v1.2.3 From 0da7be8ea421a11e81c3688956765f02ca043b6a Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Wed, 11 Apr 2012 20:56:34 +0200 Subject: UI. Restoring context menu items order (Embed image) and activation test (Extract image). (bzr r11223) --- src/interface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index 7dbcea9e7..a14a92e83 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -1924,7 +1924,7 @@ void ContextMenu::MakeImageMenu (void) mi = new Gtk::MenuItem(C_("Context menu", "Embed Image")); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ImageEmbed)); mi->show(); - append(*mi); + insert(*mi,positionOfLastDialog++); if ( (!href) || ((strncmp(href, "data:", 5) == 0)) ) { mi->set_sensitive( FALSE ); } @@ -1936,7 +1936,7 @@ void ContextMenu::MakeImageMenu (void) mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ImageExtract)); mi->show(); insert(*mi,positionOfLastDialog++); - if ( (!href) || ((strncmp(href, "data:", 5) == 0)) ) { + if ( (!href) || ((strncmp(href, "data:", 5) != 0)) ) { mi->set_sensitive( FALSE ); } } -- cgit v1.2.3 From caa23c1ffef7315ff8249256267cc2ea885f5717 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Wed, 11 Apr 2012 21:30:07 +0200 Subject: i18n. Adding some context tags (disambiguation). (bzr r11224) --- src/interface.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index a14a92e83..91f16cbf9 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -794,9 +794,9 @@ sp_ui_checkboxes_menus(GtkMenu *m, Inkscape::UI::View::View *view) void addTaskMenuItems(GtkMenu *menu, Inkscape::UI::View::View *view) { gchar const* data[] = { - _("Default"), _("Default interface setup"), - _("Custom"), _("Set the custom task"), - _("Wide"), _("Setup for widescreen work"), + C_("Interface setup", "Default"), _("Default interface setup"), + C_("Interface setup", "Custom"), _("Set the custom task"), + C_("Interface setup", "Wide"), _("Setup for widescreen work"), 0, 0 }; -- cgit v1.2.3 From 0024197c76bca50d557edc2824646a636d695c4d Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sun, 15 Apr 2012 01:17:25 +0100 Subject: Get rid of remaining deprecated GDK Key symbols (bzr r11250) --- src/interface.cpp | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 94 insertions(+), 4 deletions(-) (limited to 'src/interface.cpp') diff --git a/src/interface.cpp b/src/interface.cpp index 91f16cbf9..762a1692d 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -26,6 +26,8 @@ #include "file.h" #include #include +#include +#include #include "inkscape-private.h" #include "extension/db.h" @@ -81,6 +83,94 @@ #include #include +#if !GTK_CHECK_VERSION(2,22,0) +#define GDK_KEY_VoidSymbol 0xffffff +#define GDK_KEY_Up 0xff52 +#define GDK_KEY_KP_Up 0xff97 +#define GDK_KEY_Down 0xff54 +#define GDK_KEY_KP_Down 0xff99 +#define GDK_KEY_Left 0xff51 +#define GDK_KEY_KP_Left 0xff96 +#define GDK_KEY_Right 0xff53 +#define GDK_KEY_KP_Right 0xff98 +#define GDK_KEY_Page_Up 0xff55 +#define GDK_KEY_KP_Page_Up 0xff9a +#define GDK_KEY_Page_Down 0xff56 +#define GDK_KEY_KP_Page_Down 0xff9b +#define GDK_KEY_Home 0xff50 +#define GDK_KEY_KP_Home 0xff95 +#define GDK_KEY_End 0xff57 +#define GDK_KEY_KP_End 0xff9c +#define GDK_KEY_a 0x061 +#define GDK_KEY_A 0x041 +#define GDK_KEY_d 0x064 +#define GDK_KEY_D 0x044 +#define GDK_KEY_g 0x067 +#define GDK_KEY_G 0x047 +#define GDK_KEY_l 0x06c +#define GDK_KEY_L 0x04c +#define GDK_KEY_q 0x071 +#define GDK_KEY_Q 0x051 +#define GDK_KEY_r 0x072 +#define GDK_KEY_R 0x052 +#define GDK_KEY_s 0x073 +#define GDK_KEY_S 0x053 +#define GDK_KEY_u 0x075 +#define GDK_KEY_U 0x055 +#define GDK_KEY_w 0x077 +#define GDK_KEY_W 0x057 +#define GDK_KEY_x 0x078 +#define GDK_KEY_X 0x058 +#define GDK_KEY_z 0x07a +#define GDK_KEY_Z 0x05a +#define GDK_KEY_Escape 0xff1b +#define GDK_KEY_Control_L 0xffe3 +#define GDK_KEY_Control_R 0xffe4 +#define GDK_KEY_Alt_L 0xffe9 +#define GDK_KEY_Alt_R 0xffea +#define GDK_KEY_Shift_L 0xffe1 +#define GDK_KEY_Shift_R 0xffe2 +#define GDK_KEY_Meta_L 0xffe7 +#define GDK_KEY_Meta_R 0xffe8 +#define GDK_KEY_KP_0 0xffb0 +#define GDK_KEY_KP_1 0xffb1 +#define GDK_KEY_KP_2 0xffb2 +#define GDK_KEY_KP_3 0xffb3 +#define GDK_KEY_KP_4 0xffb4 +#define GDK_KEY_KP_5 0xffb5 +#define GDK_KEY_KP_6 0xffb6 +#define GDK_KEY_KP_7 0xffb7 +#define GDK_KEY_KP_8 0xffb8 +#define GDK_KEY_KP_9 0xffb9 +#define GDK_KEY_F1 0xffbe +#define GDK_KEY_F2 0xffbf +#define GDK_KEY_F3 0xffc0 +#define GDK_KEY_F4 0xffc1 +#define GDK_KEY_F5 0xffc2 +#define GDK_KEY_F6 0xffc3 +#define GDK_KEY_F7 0xffc4 +#define GDK_KEY_F8 0xffc5 +#define GDK_KEY_F9 0xffc6 +#define GDK_KEY_F10 0xffc7 +#define GDK_KEY_F11 0xffc8 +#define GDK_KEY_Insert 0xff63 +#define GDK_KEY_KP_Insert 0xff9e +#define GDK_KEY_Delete 0xffff +#define GDK_KEY_KP_Delete 0xff9f +#define GDK_KEY_BackSpace 0xff08 +#define GDK_KEY_Return 0xff0d +#define GDK_KEY_KP_Enter 0xff8d +#define GDK_KEY_space 0x020 +#define GDK_KEY_Tab 0xff09 +#define GDK_KEY_ISO_Left_Tab 0xfe20 +#define GDK_KEY_bracketleft 0x05b +#define GDK_KEY_bracketright 0x05d +#define GDK_KEY_less 0x03c +#define GDK_KEY_greater 0x03e +#define GDK_KEY_comma 0x02c +#define GDK_KEY_period 0x02e +#endif + using Inkscape::DocumentUndo; /* Drag and Drop */ @@ -415,7 +505,7 @@ sp_ui_dialog_title_string(Inkscape::Verb *verb, gchar *c) g_free(atitle); shortcut = sp_shortcut_get_primary(verb); - if (shortcut!=GDK_VoidSymbol) { + if (shortcut!=GDK_KEY_VoidSymbol) { gchar* key = sp_shortcut_get_label(shortcut); s = g_stpcpy(s, " ("); s = g_stpcpy(s, key); @@ -446,7 +536,7 @@ static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb if (!action) return NULL; shortcut = sp_shortcut_get_primary(verb); - if (shortcut!=GDK_VoidSymbol) { + if (shortcut!=GDK_KEY_VoidSymbol) { gchar* c = sp_shortcut_get_label(shortcut); #if GTK_CHECK_VERSION(3,0,0) GtkWidget *const hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 16); @@ -634,7 +724,7 @@ sp_ui_menu_append_check_item_from_verb(GtkMenu *menu, Inkscape::UI::View::View * SPAction *action = (verb) ? verb->get_action(view) : 0; GtkWidget *item = gtk_check_menu_item_new(); - if (verb && shortcut!=GDK_VoidSymbol) { + if (verb && shortcut!=GDK_KEY_VoidSymbol) { gchar* c = sp_shortcut_get_label(shortcut); #if GTK_CHECK_VERSION(3,0,0) @@ -1601,7 +1691,7 @@ void ContextMenu::AppendItemFromVerb(Inkscape::Verb *verb)//, SPDesktop *view)// Gtk::ImageMenuItem *item = NULL; unsigned int shortcut = sp_shortcut_get_primary(verb); - if (shortcut!=GDK_VoidSymbol) { + if (shortcut!=GDK_KEY_VoidSymbol) { gchar* c = sp_shortcut_get_label(shortcut); Gtk::HBox *const hb = new Gtk::HBox (FALSE, 16); Gtk::Label *const name_lbl = new Gtk::Label(action->name, true); -- cgit v1.2.3