From f819c5ba44023769d5c8512cdf489d001c1da09d Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Thu, 19 Apr 2012 13:22:42 +0100 Subject: Edges can now be reversed easily --- tikzit/src/gtk/Menu.m | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tikzit/src/gtk/Menu.m') diff --git a/tikzit/src/gtk/Menu.m b/tikzit/src/gtk/Menu.m index ea2e333..37ab87c 100644 --- a/tikzit/src/gtk/Menu.m +++ b/tikzit/src/gtk/Menu.m @@ -224,6 +224,12 @@ static void flip_vert_cb (GtkAction *action, MainWindow *window) { [pool drain]; } +static void reverse_edges_cb (GtkAction *action, MainWindow *window) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + [[window activeDocument] reverseSelectedEdges]; + [pool drain]; +} + static void bring_forward_cb (GtkAction *action, MainWindow *window) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [[window activeDocument] bringSelectionForward]; @@ -375,6 +381,7 @@ static const gchar ui_info[] = " " " " " " +" " " " " " " " @@ -561,6 +568,9 @@ static GtkActionEntry document_entries[] = { { "FlipVert", NULL, N_("Flip nodes _vertically"), NULL, N_("Flip the selected nodes vertically"), G_CALLBACK (flip_vert_cb) }, + { "ReverseEdges", NULL, N_("Rever_se edges"), NULL, + N_("Reverse the selected edges"), G_CALLBACK (reverse_edges_cb) }, + { "SendToBack", NULL, N_("Send to _back"), NULL, N_("Send the selected nodes and edges to the back of the graph"), G_CALLBACK (send_to_back_cb) }, @@ -764,6 +774,9 @@ create_recent_chooser_menu () nodeSelBasedActions[1] = gtk_action_group_get_action (documentActions, "Copy"); nodeSelBasedActions[2] = gtk_action_group_get_action (documentActions, "FlipHoriz"); nodeSelBasedActions[3] = gtk_action_group_get_action (documentActions, "FlipVert"); + edgeSelBasedActionCount = 1; + edgeSelBasedActions = g_new (GtkAction*, edgeSelBasedActionCount); + edgeSelBasedActions[0] = gtk_action_group_get_action (documentActions, "ReverseEdges"); selBasedActionCount = 2; selBasedActions = g_new (GtkAction*, selBasedActionCount); selBasedActions[0] = gtk_action_group_get_action (documentActions, "Delete"); @@ -820,6 +833,11 @@ create_recent_chooser_menu () gtk_action_set_sensitive (nodeSelBasedActions[i], hasSelectedNodes); } } + for (int i = 0; i < edgeSelBasedActionCount; ++i) { + if (edgeSelBasedActions[i]) { + gtk_action_set_sensitive (edgeSelBasedActions[i], hasSelectedEdges); + } + } for (int i = 0; i < selBasedActionCount; ++i) { if (selBasedActions[i]) { gtk_action_set_sensitive (selBasedActions[i], hasSelectedNodes || hasSelectedEdges); -- cgit v1.2.3