Code

Context menu. Fix for Bug #170806 (Add Fill&stroke to right-click menu for texts).
authorJazzyNico <nicoduf@yahoo.fr>
Tue, 19 Oct 2010 17:01:11 +0000 (19:01 +0200)
committerJazzyNico <nicoduf@yahoo.fr>
Tue, 19 Oct 2010 17:01:11 +0000 (19:01 +0200)
src/ui/context-menu.cpp

index 98ad9dc7bf8110d02b97857b2b34127fd82e8744..43de518c6a75e7cc37b9944505800dfe1bbf271e 100644 (file)
@@ -46,6 +46,7 @@ sp_object_menu(SPObject *object, SPDesktop *desktop, GtkMenu *menu)
 
 #include "sp-anchor.h"
 #include "sp-image.h"
+#include "sp-text.h"
 
 #include "document.h"
 #include "desktop-handles.h"
@@ -64,6 +65,7 @@ static void sp_group_menu(SPObject *object, SPDesktop *desktop, GtkMenu *menu);
 static void sp_anchor_menu(SPObject *object, SPDesktop *desktop, GtkMenu *menu);
 static void sp_image_menu(SPObject *object, SPDesktop *desktop, GtkMenu *menu);
 static void sp_shape_menu(SPObject *object, SPDesktop *desktop, GtkMenu *menu);
+static void sp_text_menu(SPObject *object, SPDesktop *desktop, GtkMenu *menu);
 
 static void
 sp_object_type_menu(GType type, SPObject *object, SPDesktop *desktop, GtkMenu *menu)
@@ -77,6 +79,7 @@ sp_object_type_menu(GType type, SPObject *object, SPDesktop *desktop, GtkMenu *m
         g_hash_table_insert(t2m, GUINT_TO_POINTER(SP_TYPE_ANCHOR), (void*)sp_anchor_menu);
         g_hash_table_insert(t2m, GUINT_TO_POINTER(SP_TYPE_IMAGE), (void*)sp_image_menu);
         g_hash_table_insert(t2m, GUINT_TO_POINTER(SP_TYPE_SHAPE), (void*)sp_shape_menu);
+        g_hash_table_insert(t2m, GUINT_TO_POINTER(SP_TYPE_TEXT), (void*)sp_text_menu);
     }
     handler = (void (*)(SPObject*, SPDesktop*, GtkMenu*))g_hash_table_lookup(t2m, GUINT_TO_POINTER(type));
     if (handler) handler(object, desktop, menu);
@@ -102,7 +105,7 @@ sp_item_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m)
     item = (SPItem *) object;
 
     /* Item dialog */
-    w = gtk_menu_item_new_with_mnemonic(_("Object _Properties"));
+    w = gtk_menu_item_new_with_mnemonic(_("_Object Properties..."));
     gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop);
     gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_item_properties), item);
     gtk_widget_show(w);
@@ -343,7 +346,7 @@ sp_anchor_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m)
     item = (SPItem *) object;
 
     /* Link dialog */
-    w = gtk_menu_item_new_with_mnemonic(_("Link _Properties"));
+    w = gtk_menu_item_new_with_mnemonic(_("Link _Properties..."));
     gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop);
     gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_anchor_link_properties), item);
     gtk_widget_show(w);
@@ -402,7 +405,7 @@ sp_image_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m)
     GtkWidget *w;
 
     /* Link dialog */
-    w = gtk_menu_item_new_with_mnemonic(_("Image _Properties"));
+    w = gtk_menu_item_new_with_mnemonic(_("Image _Properties..."));
     gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop);
     gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_image_image_properties), item);
     gtk_widget_show(w);
@@ -473,10 +476,10 @@ static void sp_image_image_edit(GtkMenuItem *menuitem, SPAnchor *anchor)
     g_free(editorBin);
 }
 
-/* SPShape */
+/* Fill and Stroke entry */
 
 static void
-sp_shape_fill_settings(GtkMenuItem *menuitem, SPItem *item)
+sp_fill_settings(GtkMenuItem *menuitem, SPItem *item)
 {
     SPDesktop *desktop;
 
@@ -492,6 +495,8 @@ sp_shape_fill_settings(GtkMenuItem *menuitem, SPItem *item)
     desktop->_dlg_mgr->showDialog("FillAndStroke");
 }
 
+/* SPShape */
+
 static void
 sp_shape_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m)
 {
@@ -501,14 +506,32 @@ sp_shape_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m)
     item = (SPItem *) object;
 
     /* Item dialog */
-    w = gtk_menu_item_new_with_mnemonic(_("_Fill and Stroke"));
+    w = gtk_menu_item_new_with_mnemonic(_("_Fill and Stroke..."));
     gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop);
-    gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_shape_fill_settings), item);
+    gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_fill_settings), item);
     gtk_widget_show(w);
     gtk_menu_append(GTK_MENU(m), w);
 }
 
+/* SPText */
+
+static void
+sp_text_menu(SPObject *object, SPDesktop *desktop, GtkMenu *m)
+{
+    SPItem *item;
+    GtkWidget *w;
 
+    item = (SPItem *) object;
+
+    /* Fill and Stroke dialog */
+    w = gtk_menu_item_new_with_mnemonic(_("_Fill and Stroke..."));
+    gtk_object_set_data(GTK_OBJECT(w), "desktop", desktop);
+    gtk_signal_connect(GTK_OBJECT(w), "activate", GTK_SIGNAL_FUNC(sp_fill_settings), item);
+    gtk_widget_show(w);
+    gtk_menu_append(GTK_MENU(m), w);
+    
+
+}
 /*
   Local Variables:
   mode:c++