summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleks Kissinger <aleks0@gmail.com>2012-05-22 20:57:23 +0100
committerAleks Kissinger <aleks0@gmail.com>2012-05-22 20:57:23 +0100
commit84c819cffec08ba13f788a1dc12c239ac857246e (patch)
treead9dbf0f788b8700ee64315b0a91226b9cbf953e
parent0973261fd48dc4b85387120fbef6fa9aac756a77 (diff)
parent37e7f18392109225ca5c257d14eda2f89a938370 (diff)
Merge branch 'master' into resize_preview
-rw-r--r--tikzit/.gitignore2
-rw-r--r--tikzit/NEWS1
-rw-r--r--tikzit/configure.ac6
-rw-r--r--tikzit/src/Makefile.am12
-rw-r--r--tikzit/src/common/Graph.h7
-rw-r--r--tikzit/src/common/Graph.m19
-rw-r--r--tikzit/src/common/GraphChange.h9
-rw-r--r--tikzit/src/common/GraphChange.m10
-rw-r--r--tikzit/src/common/NSString+LatexConstants.m4
-rw-r--r--tikzit/src/gtk/EdgeStyleSelector.m4
-rw-r--r--tikzit/src/gtk/Menu.h2
-rw-r--r--tikzit/src/gtk/Menu.m18
-rw-r--r--tikzit/src/gtk/NodeStyleSelector.m4
-rw-r--r--tikzit/src/gtk/TikzDocument.h1
-rw-r--r--tikzit/src/gtk/TikzDocument.m8
-rw-r--r--tikzit/src/gtk/mkdtemp.m4
-rw-r--r--tikzit/tikzit.spec12
17 files changed, 101 insertions, 22 deletions
diff --git a/tikzit/.gitignore b/tikzit/.gitignore
index 0f5e855..7fede17 100644
--- a/tikzit/.gitignore
+++ b/tikzit/.gitignore
@@ -23,3 +23,5 @@ Makefile.in
/src/gtk/icondata.m
/src/gtk/logodata.m
/src/gtk/edgedecdata.m
+/tikzit-*.tar.gz
+/tikzit-*.tar.bz2
diff --git a/tikzit/NEWS b/tikzit/NEWS
index fdac837..1811ac4 100644
--- a/tikzit/NEWS
+++ b/tikzit/NEWS
@@ -12,6 +12,7 @@ tikzit 0.8 (2012-01-??):
* Nodes and edges have consistent ordering, and this can be
changed with Edge->Arrange
* Edges now have colours
+ * Edges can now be reversed easily
tikzit 0.7 (2011-12-06):
* Add bounding box support
diff --git a/tikzit/configure.ac b/tikzit/configure.ac
index 114c154..8f791b6 100644
--- a/tikzit/configure.ac
+++ b/tikzit/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.60])
-AC_INIT([TikZiT], [0.7],
+AC_INIT([TikZiT], [1.0],
[http://sourceforge.net/apps/trac/tikzit],
[tikzit],
[http://tikzit.sourceforge.net])
@@ -67,8 +67,8 @@ AM_CONDITIONAL([HAVE_POPPLER],[test "x$have_poppler" = "xyes"])
# Test all the pkg-config stuff together, so that
# dependencies and duplicate flags are correctly handled
AS_IF([test "x$have_poppler" = "xyes"],
- [PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.16.0 gdk-pixbuf-2.0 >= 2.16.0 pango >= 1.16 cairo >= 1.4 poppler-glib >= 0.10])],
- [PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.16.0 gdk-pixbuf-2.0 >= 2.16.0 pango >= 1.16 cairo >= 1.4])])
+ [PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.18.0 gdk-pixbuf-2.0 >= 2.16.0 pango >= 1.16 cairo >= 1.4 poppler-glib >= 0.10])],
+ [PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.18.0 gdk-pixbuf-2.0 >= 2.16.0 pango >= 1.16 cairo >= 1.4])])
# Checks for header files.
AC_FUNC_ALLOCA
diff --git a/tikzit/src/Makefile.am b/tikzit/src/Makefile.am
index 4a63760..29b4cb6 100644
--- a/tikzit/src/Makefile.am
+++ b/tikzit/src/Makefile.am
@@ -15,6 +15,12 @@ LIBS = @FOUNDATION_LIBS@ \
@GTK_LIBS@
AM_YFLAGS = -d
PARSERFILES = common/tikzlexer.m common/tikzparser.m common/tikzparser.h
+ICONFILES = ../draw-ellipse.png \
+ ../draw-path.png \
+ ../select-rectangular.png \
+ ../transform-crop-and-resize.png \
+ ../transform-move.png
+EDGEDECFILES = ../AH_*.png ../ED_*.png
bin_PROGRAMS = tikzit
BUILT_SOURCES = $(PARSERFILES)
@@ -111,7 +117,7 @@ common/tikzparser.m: common/tikzparser.ym
common/tikzparser.h: common/tikzparser.m
-gtk/icondata.m: ../draw-ellipse.png ../draw-path.png ../select-rectangular.png ../transform-crop-and-resize.png ../transform-move.png
+gtk/icondata.m: $(ICONFILES)
$(AM_V_GEN)gdk-pixbuf-csource --struct --static --raw --build-list \
draw_ellipse ../draw-ellipse.png \
draw_path ../draw-path.png \
@@ -130,7 +136,7 @@ gtk/logodata.m: ../share/icons/hicolor/*/apps/tikzit.png
logo128 ../share/icons/hicolor/128x128/apps/tikzit.png \
> $@
-gtk/edgedecdata.m: ../AH_*.png ../ED_*.png
+gtk/edgedecdata.m: $(EDGEDECFILES)
$(AM_V_GEN)gdk-pixbuf-csource --struct --static --raw --build-list \
AH_none_pixdata ../AH_none.png \
AH_latex_head_pixdata ../AH_latex_head.png \
@@ -146,5 +152,5 @@ gtk/Menu.m: gtk/icondata.m
gtk/logo.m: gtk/logodata.m
gtk/EdgeStyleEditor.m: gtk/edgedecdata.m
-EXTRA_DIST = gtk/*.h common/*.h $(PARSERFILES) common/tikzlexer.lm common/tikzparser.ym
+EXTRA_DIST = gtk/*.h common/*.h $(PARSERFILES) common/tikzlexer.lm common/tikzparser.ym $(ICONFILES) $(EDGEDECFILES)
MAINTAINERCLEANFILES = $(PARSERFILES) gtk/icondata.m gtk/logodata.m gtk/edgedecdata.m
diff --git a/tikzit/src/common/Graph.h b/tikzit/src/common/Graph.h
index c680219..f5d8bed 100644
--- a/tikzit/src/common/Graph.h
+++ b/tikzit/src/common/Graph.h
@@ -278,6 +278,13 @@
- (GraphChange*)shiftNodes:(id<NSFastEnumeration>)ns byPoint:(NSPoint)p;
/*!
+ @brief Reverse the given edges
+ @param es the edges to reverse
+ @result A <tt>GraphChange</tt> recording this action.
+ */
+- (GraphChange*)reverseEdges:(NSSet *)es;
+
+/*!
@brief Insert the given graph into this one. Used for copy
and paste.
@param g a graph.
diff --git a/tikzit/src/common/Graph.m b/tikzit/src/common/Graph.m
index d04751a..27c2ebb 100644
--- a/tikzit/src/common/Graph.m
+++ b/tikzit/src/common/Graph.m
@@ -247,9 +247,7 @@
- (GraphChange*)removeEdges:(NSSet *)es {
[graphLock lock];
- NSEnumerator *en = [es objectEnumerator];
- Edge *e;
- while ((e = [en nextObject])) {
+ for (Edge *e in es) {
[edges removeObject:e];
}
dirty = YES;
@@ -272,6 +270,16 @@
return [GraphChange shiftNodes:nodeSet byPoint:p];
}
+- (GraphChange*)reverseEdges:(NSSet *)es {
+ [graphLock lock];
+ for (Edge *e in es) {
+ [e reverse];
+ }
+ dirty = YES;
+ [graphLock unlock];
+ return [GraphChange reverseEdges:es];
+}
+
- (int)indexOfNode:(Node *)node {
return [nodes indexOfObject:node];
}
@@ -633,6 +641,11 @@
case NodesFlip:
[self flipNodes:[ch affectedNodes] horizontal:[ch horizontal]];
break;
+ case EdgesReverse:
+ for (Edge *e in [[ch affectedEdges] objectEnumerator]) {
+ [e reverse];
+ }
+ break;
case BoundingBoxChange:
[self setBoundingBox:[ch nwBoundingBox]];
break;
diff --git a/tikzit/src/common/GraphChange.h b/tikzit/src/common/GraphChange.h
index cb4ca09..ef56005 100644
--- a/tikzit/src/common/GraphChange.h
+++ b/tikzit/src/common/GraphChange.h
@@ -33,6 +33,7 @@ typedef enum {
EdgesPropertyChange,
NodesShift,
NodesFlip,
+ EdgesReverse,
BoundingBoxChange,
GraphPropertyChange,
NodeOrderChange,
@@ -291,7 +292,6 @@ typedef enum {
*/
+ (GraphChange*)shiftNodes:(NSSet*)ns byPoint:(NSPoint)p;
-
/*!
@brief Construct a horizontal or vertical flip of a set of nodes.
@param ns the affected nodes.
@@ -301,6 +301,13 @@ typedef enum {
+ (GraphChange*)flipNodes:(NSSet*)ns horizontal:(BOOL)b;
/*!
+ @brief Construct a reversal of a set of edges.
+ @param es the affected edges.
+ @result A reverse of a set of edges.
+ */
++ (GraphChange*)reverseEdges:(NSSet*)es;
+
+/*!
@brief Construct a bounding box change
@param oldBB the old bounding box
@param newBB the new bounding box
diff --git a/tikzit/src/common/GraphChange.m b/tikzit/src/common/GraphChange.m
index 9707a19..c52a46d 100644
--- a/tikzit/src/common/GraphChange.m
+++ b/tikzit/src/common/GraphChange.m
@@ -90,6 +90,9 @@
inverse->affectedNodes = [affectedNodes retain];
[inverse setHorizontal:[self horizontal]];
break;
+ case EdgesReverse:
+ inverse->affectedEdges = [affectedEdges retain];
+ break;
case BoundingBoxChange:
inverse->oldBoundingBox = nwBoundingBox;
inverse->nwBoundingBox = oldBoundingBox;
@@ -197,6 +200,13 @@
return [gc autorelease];
}
++ (GraphChange*)reverseEdges:(NSSet*)es {
+ GraphChange *gc = [[GraphChange alloc] init];
+ [gc setChangeType:EdgesReverse];
+ [gc setAffectedEdges:es];
+ return [gc autorelease];
+}
+
+ (GraphChange*)changeBoundingBoxFrom:(NSRect)oldBB to:(NSRect)newBB {
GraphChange *gc = [[GraphChange alloc] init];
[gc setChangeType:BoundingBoxChange];
diff --git a/tikzit/src/common/NSString+LatexConstants.m b/tikzit/src/common/NSString+LatexConstants.m
index d2d0ed8..bd598b7 100644
--- a/tikzit/src/common/NSString+LatexConstants.m
+++ b/tikzit/src/common/NSString+LatexConstants.m
@@ -176,7 +176,9 @@ static NSSet *texModifiers = nil;
if (c=='\\') {
state = 1;
} else {
- [buf appendFormat:@"%C", c];
+ if (c!='$') {
+ [buf appendFormat:@"%C", c];
+ }
state = 0;
}
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. */
diff --git a/tikzit/tikzit.spec b/tikzit/tikzit.spec
index 90e8386..67fad52 100644
--- a/tikzit/tikzit.spec
+++ b/tikzit/tikzit.spec
@@ -1,5 +1,5 @@
Name: tikzit
-Version: 0.7
+Version: 1.0
Release: 1%{?dist}
Summary: Tool for creating and modifying pgf/TikZ diagrams for TeX
@@ -19,15 +19,15 @@ URL: http://tikzit.sourceforge.net
Source0: http://switch.dl.sourceforge.net/project/%{name}/%{name}-%{version}/%{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-build
-BuildRequires: gcc-objc
+BuildRequires: gcc-objc >= 4.6.0
BuildRequires: gnustep-base-devel >= 1.18.0
BuildRequires: gtk2-devel >= 2.18.0
BuildRequires: pango-devel >= 1.16
BuildRequires: cairo-devel >= 1.4
%if 0%{?suse_version}%{?mdkversion}
-BuildRequires: libpoppler-glib-devel
+BuildRequires: libpoppler-glib-devel >= 0.10
%else
-BuildRequires: poppler-glib-devel
+BuildRequires: poppler-glib-devel >= 0.10
%endif
%if 0%{?suse_version}
BuildRequires: update-desktop-files
@@ -71,6 +71,10 @@ rm -rf %{buildroot}
%changelog
+* Tue Dec 06 2011 Alex Merry <dev@randomguy3.me.uk> 1.0-1
+-Bumped version
+-Bumped requirements
+
* Tue Dec 06 2011 Alex Merry <dev@randomguy3.me.uk> 0.7-1
-Bumped version