summaryrefslogtreecommitdiff
path: root/tikzit/src/gtk/Menu.m
diff options
context:
space:
mode:
authorAlex Merry <dev@randomguy3.me.uk>2012-04-19 13:22:42 +0100
committerAlex Merry <dev@randomguy3.me.uk>2012-05-04 10:14:38 +0100
commitf819c5ba44023769d5c8512cdf489d001c1da09d (patch)
tree7fc1d801672e04b40ee6f82f2409adea4c2a780f /tikzit/src/gtk/Menu.m
parentec48fc2bcce2483d89eb51a185c5826a8fcc7c6c (diff)
Edges can now be reversed easily
Diffstat (limited to 'tikzit/src/gtk/Menu.m')
-rw-r--r--tikzit/src/gtk/Menu.m18
1 files changed, 18 insertions, 0 deletions
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[] =
" <separator/>"
" <menuitem action='FlipVert'/>"
" <menuitem action='FlipHoriz'/>"
+" <menuitem action='ReverseEdges'/>"
" <separator/>"
" <menu action='Arrange'>"
" <menuitem action='SendToBack'/>"
@@ -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);