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.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 4 deletions(-) (limited to 'src/interface.h') diff --git a/src/interface.h b/src/interface.h index 2b01a20d7..db98c3ae3 100644 --- a/src/interface.h +++ b/src/interface.h @@ -8,7 +8,9 @@ * Lauris Kaplinski * Frank Felfe * Abhishek Sharma + * Kris De Gussem * + * Copyright (C) 2012 Kris De Gussem * Copyright (C) 1999-2002 authors * Copyright (C) 2001-2002 Ximian, Inc. * @@ -16,6 +18,7 @@ */ #include +#include #include "sp-item.h" @@ -58,10 +61,7 @@ unsigned int sp_ui_close_all (void); */ GtkWidget *sp_ui_main_menubar (Inkscape::UI::View::View *view); -/** - * - */ -GtkWidget *sp_ui_context_menu (Inkscape::UI::View::View *v, SPItem *item); +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); /** @@ -82,6 +82,59 @@ void sp_ui_dialog_title_string (Inkscape::Verb * verb, gchar* c); void sp_ui_error_dialog (const gchar * message); bool sp_ui_overwrite_file (const gchar * filename); +class ContextMenu : public Gtk::Menu +{ + public: + ContextMenu(Inkscape::UI::View::View *view, SPItem *item); + ~ContextMenu(void); + private: + SPItem *_item; + SPObject *_object; + SPDesktop *_desktop; + + std::vector separators; + Gtk::MenuItem MIGroup; + Gtk::MenuItem MIParent; + + Gtk::SeparatorMenuItem* AddSeparator(void); + void AppendItemFromVerb(Inkscape::Verb *verb, Inkscape::UI::View::View *view); + void MakeObjectMenu (void); + void MakeItemMenu (void); + void MakeGroupMenu (void); + void MakeAnchorMenu (void); + void MakeImageMenu (void); + void MakeShapeMenu (void); + void MakeTextMenu (void); + + void EnterGroup(Gtk::MenuItem* mi); + void LeaveGroup(void); + void ItemProperties(void); + void ItemSelectThis(void); + void SelectSameFillStroke(void); + void ItemCreateLink(void); + void SetMask(void); + void ReleaseMask(void); + void SetClip(void); + void ReleaseClip(void); + + void ActivateUngroup(void); + + void AnchorLinkProperties(void); + void AnchorLinkFollow(void); + void AnchorLinkRemove(void); + + void ImageProperties(void); + void ImageEdit(void); + Glib::ustring getImageEditorName(); + void ImageEmbed(void); + void ImageExtract(void); + + void FillSettings(void); + + void TextSettings(void); + void SpellcheckSettings(void); +}; + #endif // SEEN_SP_INTERFACE_H /* -- cgit v1.2.3