diff options
Diffstat (limited to 'tikzit/src/gtk')
-rw-r--r-- | tikzit/src/gtk/EdgeStyleSelector.m | 4 | ||||
-rw-r--r-- | tikzit/src/gtk/Menu.h | 2 | ||||
-rw-r--r-- | tikzit/src/gtk/Menu.m | 18 | ||||
-rw-r--r-- | tikzit/src/gtk/NodeStyleSelector.m | 4 | ||||
-rw-r--r-- | tikzit/src/gtk/TikzDocument.h | 1 | ||||
-rw-r--r-- | tikzit/src/gtk/TikzDocument.m | 8 | ||||
-rw-r--r-- | tikzit/src/gtk/mkdtemp.m | 4 |
7 files changed, 34 insertions, 7 deletions
diff --git a/tikzit/src/gtk/EdgeStyleSelector.m b/tikzit/src/gtk/EdgeStyleSelector.m index 544ed98..c9c9780 100644 --- a/tikzit/src/gtk/EdgeStyleSelector.m +++ b/tikzit/src/gtk/EdgeStyleSelector.m @@ -289,7 +289,7 @@ enum { } else { GdkPixbuf *pixbuf = [self pixbufOfEdgeInStyle:style]; gtk_list_store_set (store, &row, STYLES_ICON_COL, pixbuf, -1); - gdk_pixbuf_unref (pixbuf); + g_object_unref (pixbuf); } } } while (gtk_tree_model_iter_next (model, &row)); @@ -411,7 +411,7 @@ enum { STYLES_ICON_COL, pixbuf, STYLES_PTR_COL, (gpointer)[style retain], -1); - gdk_pixbuf_unref (pixbuf); + g_object_unref (pixbuf); [self observeStyle:style]; } diff --git a/tikzit/src/gtk/Menu.h b/tikzit/src/gtk/Menu.h index 024c9e0..5a364e4 100644 --- a/tikzit/src/gtk/Menu.h +++ b/tikzit/src/gtk/Menu.h @@ -39,6 +39,8 @@ GtkAction *pasteAction; GtkAction **nodeSelBasedActions; guint nodeSelBasedActionCount; + GtkAction **edgeSelBasedActions; + guint edgeSelBasedActionCount; GtkAction **selBasedActions; guint selBasedActionCount; } 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); diff --git a/tikzit/src/gtk/NodeStyleSelector.m b/tikzit/src/gtk/NodeStyleSelector.m index af02338..885dc79 100644 --- a/tikzit/src/gtk/NodeStyleSelector.m +++ b/tikzit/src/gtk/NodeStyleSelector.m @@ -282,7 +282,7 @@ enum { } else { GdkPixbuf *pixbuf = [self pixbufOfNodeInStyle:style]; gtk_list_store_set (store, &row, STYLES_ICON_COL, pixbuf, -1); - gdk_pixbuf_unref (pixbuf); + g_object_unref (pixbuf); } } } while (gtk_tree_model_iter_next (model, &row)); @@ -387,7 +387,7 @@ enum { STYLES_ICON_COL, pixbuf, STYLES_PTR_COL, (gpointer)[style retain], -1); - gdk_pixbuf_unref (pixbuf); + g_object_unref (pixbuf); [self observeStyle:style]; } diff --git a/tikzit/src/gtk/TikzDocument.h b/tikzit/src/gtk/TikzDocument.h index ddeaf29..79a9b17 100644 --- a/tikzit/src/gtk/TikzDocument.h +++ b/tikzit/src/gtk/TikzDocument.h @@ -152,6 +152,7 @@ - (void) insertGraph:(Graph*)g; - (void) flipSelectedNodesHorizontally; - (void) flipSelectedNodesVertically; +- (void) reverseSelectedEdges; - (void) bringSelectionForward; - (void) bringSelectionToFront; - (void) sendSelectionBackward; diff --git a/tikzit/src/gtk/TikzDocument.m b/tikzit/src/gtk/TikzDocument.m index a5f1d9f..2016d2a 100644 --- a/tikzit/src/gtk/TikzDocument.m +++ b/tikzit/src/gtk/TikzDocument.m @@ -726,7 +726,13 @@ } } -// FIXME: undo +- (void) reverseSelectedEdges { + if ([[pickSupport selectedEdges] count] > 0) { + GraphChange *change = [graph reverseEdges:[pickSupport selectedEdges]]; + [self completedGraphChange:change withName:@"Reverse edges"]; + } +} + - (void) bringSelectionForward { BOOL hasNodeSelection = [[pickSupport selectedNodes] count] > 0; BOOL hasEdgeSelection = [[pickSupport selectedEdges] count] > 0; diff --git a/tikzit/src/gtk/mkdtemp.m b/tikzit/src/gtk/mkdtemp.m index f6b73aa..ee3cd7c 100644 --- a/tikzit/src/gtk/mkdtemp.m +++ b/tikzit/src/gtk/mkdtemp.m @@ -13,8 +13,8 @@ You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + see <http://www.gnu.org/licenses/>. + */ /* Extracted from misc/mkdtemp.c and sysdeps/posix/tempname.c. */ |