Index: /trunk/dports/math/gnuplot/Portfile
===================================================================
--- /trunk/dports/math/gnuplot/Portfile	(revision 98292)
+++ /trunk/dports/math/gnuplot/Portfile	(revision 98293)
@@ -6,6 +6,5 @@
 
 name                        gnuplot
-version                     4.6.0
-revision                    2
+version                     4.6.1
 categories                  math science
 # the license has some inconvenient requirements that we're not meeting
@@ -33,9 +32,9 @@
 extract.only                ${distname}.tar.gz
 checksums                   ${distname}.tar.gz \
-                            rmd160  2c06500f45fb81850b45713a2cd0e38f0021b065 \
-                            sha256  6e60adb5039a3541f407c2ade670004178b376754c424c13f0be24c7960c17be \
+                            rmd160  2b6fb6c1f1ce60f0bac2cb9b496c45b073ce6bb2 \
+                            sha256  f4bf99907d0fea7db90b6e50147f1730b5bde2fbb93d9e58478b6b94409eebc6 \
                             ${name}.pdf \
-                            rmd160  374614145a7b78e263b0cfbb695eb22d07dede9a \
-                            sha256  57bd4d88e1321968ba06f29dfa322b4cd9e6beb4e0f42e1a4775d9c9a41af170
+                            rmd160  0ddad32373efab2145fcd0e6e4d4c3e751d535bf \
+                            sha256  05cec7b49c9b5435ca94f6b4e2f34b07365411a3610bca7eaf73fa9b5475b533
 
 depends_lib                 port:expat \
@@ -51,18 +50,7 @@
 
 patchfiles                  patch-src-variable.c.diff \
+                            patch-docs-Makefile.in.diff \
                             patch-upstream-compilerwarnings.diff \
-                            patch-upstream-wxt-scroll.diff \
-                            patch-upstream-qt.diff \
-                            patch-configure-qt.diff \
                             patch-configure-aquaterm.diff
-
-# upstream patches:
-#
-# - patch-upstream-compilerwarnings.diff
-#   2012-03-18 17:30:42 Hans-Bernhard Broeker (cvs commit:broeker)
-# - patch-upstream-wxt-scroll.diff
-#   2012-02-29 19:29:25 Mojca Miklavec (cvs commit:sfeam)
-# - patch-upstream-qt.diff
-#   2012-04-01 08:49:45 Jérôme Lodewyck (cvs commit:lodewyck)
 
 minimum_xcodeversions       {9 3.1}
@@ -166,5 +154,5 @@
 # and were installed straight into ${prefix}/share/texmf/tex/latex/gnuplot
 #
-# it may be removed after a while; it is only a problem for those who installed
+# it may be removed in August 2013; it is only a problem for those who installed
 # with +tutorial
 pre-activate {
Index: /trunk/dports/math/gnuplot/files/patch-configure-aquaterm.diff
===================================================================
--- /trunk/dports/math/gnuplot/files/patch-configure-aquaterm.diff	(revision 98292)
+++ /trunk/dports/math/gnuplot/files/patch-configure-aquaterm.diff	(revision 98293)
@@ -12,5 +12,5 @@
 --- configure.orig
 +++ configure
-@@ -769,6 +769,7 @@ with_texdir
+@@ -787,6 +787,7 @@ with_texdir
  with_kpsexpand
  with_x
@@ -20,5 +20,5 @@
  with_gihdir
  with_linux_vga
-@@ -1482,6 +1483,7 @@ Optional Packages:
+@@ -1509,6 +1510,7 @@ Optional Packages:
    --with-x                use the X Window System
    --with-x-app-defaultdir=DIR       location of X11 application defaults
@@ -28,5 +28,5 @@
    --with-gihdir=DIR       location of .gih help text file
                            (default PREFIX/share/PACKAGE/VERSION)
-@@ -7485,8 +7487,8 @@ fi
+@@ -8024,8 +8026,8 @@ fi
  rm -f conftest*
  
@@ -39,11 +39,14 @@
  /* end confdefs.h.  */
  #if defined(__APPLE__) && defined(__MACH__)
-@@ -7498,13 +7500,96 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+@@ -8035,15 +8037,98 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ _ACEOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
    $EGREP "yes" >/dev/null 2>&1; then :
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
  $as_echo "yes" >&6; }
 -     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for aqtInit in -laquaterm" >&5
 -$as_echo_n "checking for aqtInit in -laquaterm... " >&6; }
--if test "${ac_cv_lib_aquaterm_aqtInit+set}" = set; then :
+-if ${ac_cv_lib_aquaterm_aqtInit+:} false; then :
 +    is_apple=yes
 +else
@@ -141,5 +144,5 @@
  /* end confdefs.h.  */
  
-@@ -7524,33 +7609,32 @@ return aqtInit ();
+@@ -8063,33 +8148,32 @@ return aqtInit ();
  }
  _ACEOF
@@ -158,5 +161,5 @@
 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_aquaterm_aqtInit" >&5
 -$as_echo "$ac_cv_lib_aquaterm_aqtInit" >&6; }
--if test "x$ac_cv_lib_aquaterm_aqtInit" = x""yes; then :
+-if test "x$ac_cv_lib_aquaterm_aqtInit" = xyes; then :
 -   LIBS="-laquaterm $LIBS -framework Foundation"
 -       CFLAGS="$CFLAGS -ObjC"
@@ -189,5 +192,5 @@
  
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BeOS" >&5
-@@ -14910,7 +14994,7 @@ else
+@@ -15496,7 +15580,7 @@ else
  $as_echo "  next terminal: no" >&6; }
  fi
@@ -200,5 +203,5 @@
 --- configure.in.orig
 +++ configure.in
-@@ -1366,7 +1366,7 @@ else
+@@ -1370,7 +1370,7 @@ else
    AC_MSG_RESULT([  next terminal: no])
  fi
@@ -357,11 +360,2 @@
  #import <Foundation/NSAutoreleasePool.h>
  #import <Foundation/NSArray.h>
-@@ -356,7 +356,7 @@ AQUA_init()
-   [adapter openPlotWithIndex:AQUA_plotRef];
- 
-   /* Check for support of version-dependent features */
--   AQUA_hasAlphaSupport = [AQTAdapter respondsToSelector:@selector(setColorRed:green:blue:alpha:)];
-+   AQUA_hasAlphaSupport = [AQTAdapter instancesRespondToSelector:@selector(setColorRed:green:blue:alpha:)];
- 
-   /* set xmax, ymax*/
-   term->xmax = AQUA_xSize;
Index: unk/dports/math/gnuplot/files/patch-configure-qt.diff
===================================================================
--- /trunk/dports/math/gnuplot/files/patch-configure-qt.diff	(revision 98292)
+++ 	(revision )
@@ -1,96 +1,0 @@
---- configure.orig
-+++ configure
-@@ -7828,7 +7828,7 @@ else
- 	char b[false == 0 ? 1 : -1];
- 	char c[__bool_true_false_are_defined == 1 ? 1 : -1];
- 	char d[(bool) 0.5 == true ? 1 : -1];
--	bool e = &s;
-+	/* See body of main program for 'e'.  */
- 	char f[(_Bool) 0.0 == false ? 1 : -1];
- 	char g[true];
- 	char h[sizeof (_Bool)];
-@@ -7839,25 +7839,6 @@ else
- 	_Bool n[m];
- 	char o[sizeof n == m * sizeof n[0] ? 1 : -1];
- 	char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
--#	if defined __xlc__ || defined __GNUC__
--	 /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
--	    reported by James Lemley on 2005-10-05; see
--	    http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
--	    This test is not quite right, since xlc is allowed to
--	    reject this program, as the initializer for xlcbug is
--	    not one of the forms that C requires support for.
--	    However, doing the test right would require a runtime
--	    test, and that would make cross-compilation harder.
--	    Let us hope that IBM fixes the xlc bug, and also adds
--	    support for this kind of constant expression.  In the
--	    meantime, this test will reject xlc, which is OK, since
--	    our stdbool.h substitute should suffice.  We also test
--	    this with GCC, where it should work, to detect more
--	    quickly whether someone messes up the test in the
--	    future.  */
--	 char digs[] = "0123456789";
--	 int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
--#	endif
- 	/* Catch a bug in an HP-UX C compiler.  See
- 	   http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
- 	   http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
-@@ -7869,6 +7850,7 @@ int
- main ()
- {
- 
-+	bool e = &s;
- 	*pq |= q;
- 	*pq |= ! q;
- 	/* Refer to every declared value, to avoid compiler optimizations.  */
-@@ -13010,7 +12992,7 @@ fi
-   CXXFLAGS="$CXXFLAGS $QT_CXXFLAGS"
- 
-     if test "$is_apple" = yes; then
--    CXXFLAGS="$CXXFLAGS -ObjC"
-+    LIBS="$LIBS -framework Carbon"
-   fi
- 
-   QT4LOC=`$PKG_CONFIG --variable=exec_prefix QtCore`
---- configure.in.orig
-+++ configure.in
-@@ -1146,7 +1146,7 @@ if test "${enable_qt_ok}" = yes ; then
- 
-   dnl Compile Objective C Cocoa headers on Mac to hide the gnuplot icon from the dock
-   if test "$is_apple" = yes; then
--    CXXFLAGS="$CXXFLAGS -ObjC"
-+    LIBS="$LIBS -framework Carbon"
-   fi
- 
-   QT4LOC=`$PKG_CONFIG --variable=exec_prefix QtCore`
---- src/qtterminal/qt_term.cpp.orig
-+++ src/qtterminal/qt_term.cpp
-@@ -46,7 +46,7 @@
- #include <QtNetwork>
- 
- #ifdef Q_WS_MAC
--	#include <Cocoa/Cocoa.h>
-+	#include <Carbon/Carbon.h>
- #endif
- 
- extern "C" {
-@@ -308,10 +308,15 @@ void qt_init()
- 	QApplication* application = new QApplication(argc, (char**)( NULL));
- 
- #ifdef Q_WS_MAC
--	// Don't display this application in the MAC OS X dock
--	ProcessSerialNumber psn;
--	if (GetCurrentProcess(&psn) == noErr)
--		TransformProcessType(&psn, kProcessTransformToBackgroundApplication);
-+	#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
-+		#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
-+			// Don't display this application in the MAC OS X dock
-+			// kProcessTransformToBackgroundApplication only works on Mac OS X 10.7 and later
-+			ProcessSerialNumber psn;
-+			if (GetCurrentProcess(&psn) == noErr)
-+				TransformProcessType(&psn, kProcessTransformToBackgroundApplication);
-+		#endif
-+	#endif
- #endif
- 
- 	// The creation of a QApplication mangled our locale settings
Index: /trunk/dports/math/gnuplot/files/patch-upstream-compilerwarnings.diff
===================================================================
--- /trunk/dports/math/gnuplot/files/patch-upstream-compilerwarnings.diff	(revision 98292)
+++ /trunk/dports/math/gnuplot/files/patch-upstream-compilerwarnings.diff	(revision 98293)
@@ -1,5 +1,5 @@
 --- src/color.c.orig
 +++ src/color.c
-@@ -515,7 +515,7 @@ cbtick_callback(
+@@ -517,7 +517,7 @@ cbtick_callback(
  	    if (axis_array[axis].manual_justify)
  		just = axis_array[axis].label.pos;
@@ -10,5 +10,5 @@
  	    if (hrotate)
  		(*term->text_angle)(0);
-@@ -526,7 +526,7 @@ cbtick_callback(
+@@ -528,7 +528,7 @@ cbtick_callback(
  	    if (axis_array[axis].manual_justify)
  		just = axis_array[axis].label.pos;	    
@@ -19,36 +19,7 @@
  	}
  	term_apply_lp_properties(&border_lp);	/* border linetype */
---- src/gplt_x11.c.orig
-+++ src/gplt_x11.c
-@@ -2897,22 +2897,22 @@ exec_cmd(plot_struct *plot, char *command)
- 
- 		    case PseudoColor:
- 			fprintf(stderr, ERROR_NOTICE("PseudoColor"));
--			fprintf(stderr, display_error_text_after);
-+			fprintf(stderr, "%s", display_error_text_after);
- 			break;
- 
- 		    case GrayScale:
- 			fprintf(stderr, ERROR_NOTICE("GrayScale"));
--			fprintf(stderr, display_error_text_after);
-+			fprintf(stderr, "%s", display_error_text_after);
- 			break;
- 
- 		    case StaticColor:
- 			fprintf(stderr, ERROR_NOTICE("StaticColor"));
--			fprintf(stderr, display_error_text_after);
-+			fprintf(stderr, "%s", display_error_text_after);
- 			break;
- 
- 		    case StaticGray:
- 			fprintf(stderr, ERROR_NOTICE("StaticGray"));
--			fprintf(stderr, display_error_text_after);
-+			fprintf(stderr, "%s", display_error_text_after);
- 			break;
- 
- 		    case DirectColor:
 --- src/graphics.c.orig
 +++ src/graphics.c
-@@ -1734,7 +1734,7 @@ do_plot(struct curve_points *plots, int pcount)
+@@ -1720,7 +1720,7 @@ do_plot(struct curve_points *plots, int pcount)
  	ignore_enhanced(axis_array[FIRST_X_AXIS].label.noenhanced);
  	apply_pm3dcolor(&(axis_array[FIRST_X_AXIS].label.textcolor), t);
@@ -61,5 +32,5 @@
 --- src/plot2d.c.orig
 +++ src/plot2d.c
-@@ -2120,7 +2120,7 @@ eval_plots()
+@@ -2127,7 +2127,7 @@ eval_plots()
  
  		    if (this_plot->labels == NULL) {
@@ -70,5 +41,5 @@
  		    }
  		    parse_label_options(this_plot->labels);
-@@ -2309,7 +2309,7 @@ eval_plots()
+@@ -2316,7 +2316,7 @@ eval_plots()
  	    if (this_plot->plot_style == LABELPOINTS) {
  		if (this_plot->labels == NULL) {
@@ -81,5 +52,5 @@
 --- src/plot3d.c.orig
 +++ src/plot3d.c
-@@ -1555,7 +1555,7 @@ eval_3dplots()
+@@ -1559,7 +1559,7 @@ eval_3dplots()
  		    int stored_token = c_token;
  		    if (this_plot->labels == NULL) {
@@ -90,2 +61,38 @@
  		    }
  		    parse_label_options(this_plot->labels);
+--- src/wxterminal/wxt_gui.cpp.orig
++++ src/wxterminal/wxt_gui.cpp
+@@ -2692,6 +2692,7 @@ void wxtPanel::wxt_cairo_exec_command(gp_command command)
+ 		text_justification_mode = command.mode;
+ 		return;
+ 	case command_put_text :
++	case command_enhanced_put_text :
+ 		if (wxt_in_key_sample) {
+ 			int slen = strlen(command.string) * term->h_char * 0.75;
+ 			if (text_justification_mode == RIGHT) slen = -slen;
+--- term/lua.trm.orig
++++ term/lua.trm
+@@ -872,7 +872,7 @@ LUA_init()
+ {
+   fseek(gpoutfile, 0, SEEK_SET);
+   /* ignore compiler warnings here, because `gpoutfile' is already open */
+-  if (ftruncate(fileno(gpoutfile), 0));
++  (void)ftruncate(fileno(gpoutfile), 0);
+ 
+   /* reset image counter */
+   image_cnt = 0;
+--- term/x11.trm.orig
++++ term/x11.trm
+@@ -617,7 +617,11 @@ X11_options()
+     /* Leave the current window unchanged when closing an old window */
+     if (X11_ipc) {
+ 	if (set_close) {
+-	    fprintf(X11_ipc, (set_number ? "C%d\n" : "C\n"), new_term_number);
++	    if (set_number) {
++		fprintf(X11_ipc, "C%d\n", new_term_number);
++	    } else {
++		fputs("C\n", X11_ipc);
++	    }
+ 	    fflush(X11_ipc);
+ 	} else if (set_number) {
+ #ifdef EXTERNAL_X11_WINDOW
Index: unk/dports/math/gnuplot/files/patch-upstream-qt.diff
===================================================================
--- /trunk/dports/math/gnuplot/files/patch-upstream-qt.diff	(revision 98292)
+++ 	(revision )
@@ -1,86 +1,0 @@
---- src/qtterminal/QtGnuplotScene.cpp.orig
-+++ src/qtterminal/QtGnuplotScene.cpp
-@@ -56,7 +56,7 @@ QtGnuplotScene::QtGnuplotScene(QtGnuplotEventHandler* eventHandler, QObject* par
- 	m_eventHandler = eventHandler;
- 	m_lastModifierMask = 0;
- 	m_textAngle = 0.;
--	m_textAlignment == Qt::AlignLeft;
-+	m_textAlignment = Qt::AlignLeft;
- 	m_currentZ = 1.;
- 	m_currentPointSize = 1.;
- 	m_enhanced = 0;
---- src/qtterminal/QtGnuplotWidget.cpp.orig
-+++ src/qtterminal/QtGnuplotWidget.cpp
-@@ -169,6 +169,15 @@ void QtGnuplotWidget::resizeEvent(QResizeEvent* event)
- 	QWidget::resizeEvent(event);
- }
- 
-+QPainter::RenderHints QtGnuplotWidget::renderHints() const
-+{
-+	QPainter::RenderHints hint = QPainter::TextAntialiasing;
-+	if (m_antialias)
-+		hint |= QPainter::Antialiasing;
-+
-+	return hint;
-+}
-+
- /////////////////////////////////////////////////
- // Slots
- 
-@@ -178,7 +187,7 @@ QPixmap QtGnuplotWidget::createPixmap()
- 	pixmap.fill();
- 	QPainter painter(&pixmap);
- 	painter.translate(0.5, 0.5);
--	painter.setRenderHint(m_antialias ? QPainter::Antialiasing : QPainter::TextAntialiasing);
-+	painter.setRenderHints(renderHints());
- 	m_scene->render(&painter);
- 	painter.end();
- 	return pixmap;
-@@ -195,7 +204,7 @@ void QtGnuplotWidget::print()
- 	if (QPrintDialog(&printer).exec() == QDialog::Accepted)
- 	{
- 		QPainter painter(&printer);
--		painter.setRenderHint(m_antialias ? QPainter::Antialiasing : QPainter::TextAntialiasing);
-+		painter.setRenderHints(renderHints());
- 		m_scene->render(&painter);
- 	}
- }
-@@ -211,8 +220,10 @@ void QtGnuplotWidget::exportToPdf()
- 	QPrinter printer;
- 	printer.setOutputFormat(QPrinter::PdfFormat);
- 	printer.setOutputFileName(fileName);
-+	printer.setPaperSize(QSizeF(m_scene->width(), m_scene->height()), QPrinter::Point);
-+	printer.setPageMargins(0, 0, 0, 0, QPrinter::Point);
- 	QPainter painter(&printer);
--	painter.setRenderHint(m_antialias ? QPainter::Antialiasing : QPainter::TextAntialiasing);
-+	painter.setRenderHints(renderHints());
- 	m_scene->render(&painter);
- }
- 
-@@ -266,7 +277,7 @@ void QtGnuplotWidget::loadSettings()
- 
- void QtGnuplotWidget::applySettings()
- {
--	m_view->setRenderHints(m_antialias ? QPainter::Antialiasing : QPainter::TextAntialiasing);
-+	m_view->setRenderHints(renderHints());
- 	m_view->setBackgroundBrush(m_backgroundColor);
- }
- 
---- src/qtterminal/QtGnuplotWidget.h.orig
-+++ src/qtterminal/QtGnuplotWidget.h
-@@ -47,6 +47,7 @@
- #include "QtGnuplotEvent.h"
- 
- #include <QWidget>
-+#include <QPainter>
- 
- class QtGnuplotScene;
- class QGraphicsView;
-@@ -93,6 +94,7 @@ private:
- 	void loadSettings();
- 	void applySettings();
- 	void saveSettings();
-+	QPainter::RenderHints renderHints() const;
- 
- private:
- 	int m_id;
Index: unk/dports/math/gnuplot/files/patch-upstream-wxt-scroll.diff
===================================================================
--- /trunk/dports/math/gnuplot/files/patch-upstream-wxt-scroll.diff	(revision 98292)
+++ 	(revision )
@@ -1,23 +1,0 @@
---- src/wxterminal/wxt_gui.cpp.orig
-+++ src/wxterminal/wxt_gui.cpp
-@@ -1003,11 +1003,16 @@ void wxtPanel::OnRightUp( wxMouseEvent& event )
- /* mouse wheel event */
- void wxtPanel::OnMouseWheel( wxMouseEvent& event )
- {
--	UpdateModifiers(event);
-+	int mouse_button;
- 
--	wxt_exec_event(GE_buttonpress, 0, 0, 
--			event.GetWheelRotation() > 0 ? 4 : 5, 
--			0, this->GetId());
-+	UpdateModifiers(event);
-+	mouse_button = (event.GetWheelRotation() > 0 ? 4 : 5);
-+#if wxCHECK_VERSION(2, 9, 0)
-+	/* GetWheelAxis: 0 is the Y axis, 1 is the X axis. */
-+	if (event.GetWheelAxis() > 0)
-+	    mouse_button += 2;
-+#endif
-+	wxt_exec_event(GE_buttonpress, 0, 0, mouse_button, 0, this->GetId());
- }
- 
- /* the state of the modifiers is checked each time a key is pressed instead of
