changeset 19402:2218dd129a6b

maint: Periodic merge of gui-release to default.
author Rik <rik@octave.org>
date Fri, 28 Nov 2014 10:23:03 -0800
parents c446da1da9ff (current diff) 7467c3e773fd (diff)
children cc7931e8953d
files bootstrap.conf build-aux/common.mk configure.ac libgui/src/octave-dock-widget.cc libinterp/corefcn/pr-output.cc libinterp/corefcn/toplev.cc scripts/gui/uiputfile.m
diffstat 11 files changed, 72 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/bootstrap.conf	Fri Nov 28 07:55:46 2014 -0800
+++ b/bootstrap.conf	Fri Nov 28 10:23:03 2014 -0800
@@ -191,19 +191,3 @@
   (cd libinterp/dldfcn; ./config-module.sh)
 }
 
-bootstrap_epilogue ()
-{
-  ## G77 is obsolete, but it is still the first option in the autoconf
-  ## Fortran macros.  We should avoid it, because mixing old versions of
-  ## g77 with modern gcc and g++ causes trouble.  The following will
-  ## make it harder (but not impossible) for users to make this mistake.
-  ##
-  ## FIXME -- we should really work to fix autoconf so that it prefers
-  ## gfortran over g77 even when searching for a Fortran 77 compiler.
-
-  echo "replacing all occurrences of g77 with gfortran in configure script..."
-
-  sed 's/g77/gfortran/g' configure > configure.t
-  mv configure.t configure
-  chmod 755 configure
-}
--- a/build-aux/common.mk	Fri Nov 28 07:55:46 2014 -0800
+++ b/build-aux/common.mk	Fri Nov 28 10:23:03 2014 -0800
@@ -91,7 +91,6 @@
 
 # Fortran compiler flags.
 
-FC = @FC@
 F77 = @F77@
 AM_FFLAGS = @FFLAGS@
 FPICFLAG = @FPICFLAG@
@@ -549,7 +548,6 @@
   -e "s|%OCTAVE_CONF_F77%|\"${F77}\"|" \
   -e "s|%OCTAVE_CONF_F77_FLOAT_STORE_FLAG%|\"${F77_FLOAT_STORE_FLAG}\"|" \
   -e "s|%OCTAVE_CONF_F77_INTEGER_8_FLAG%|\"${F77_INTEGER_8_FLAG}\"|" \
-  -e "s|%OCTAVE_CONF_FC%|\"${FC}\"|" \
   -e "s|%OCTAVE_CONF_FFLAGS%|\"${FFLAGS}\"|" \
   -e "s|%OCTAVE_CONF_FFTW3_CPPFLAGS%|\"${FFTW3_CPPFLAGS}\"|" \
   -e "s|%OCTAVE_CONF_FFTW3_LDFLAGS%|\"${FFTW3_LDFLAGS}\"|" \
--- a/configure.ac	Fri Nov 28 07:55:46 2014 -0800
+++ b/configure.ac	Fri Nov 28 10:23:03 2014 -0800
@@ -592,8 +592,17 @@
   FFLAGS="-O"
 fi
 
-## the F77 variable, if set, overrides AC_PROG_F77 automatically
-AC_PROG_F77
+## Prefer gfortran, but the user's F77 environment variable will override.
+AC_PROG_F77([gfortran])
+if test -z "$F77"; then
+  ## No gfortran found, search for any other installed compiler.
+  AC_PROG_F77
+fi
+if test "$F77" = g77; then
+  AC_MSG_ERROR([g77 is not a supported Fortran compiler.  Select another compiler by setting the environment variable F77 and re-running configure.])
+fi
+
+## Determine calling conventions for Fortran compiler
 AC_F77_LIBRARY_LDFLAGS
 AC_F77_DUMMY_MAIN
 AC_F77_WRAPPERS
@@ -689,10 +698,6 @@
 fi
 AC_SUBST(F77_INTEGER_8_FLAG)
 
-## FIXME: Is this really used?  Makefile seems to use $F77 for compiler
-FC=$F77
-AC_SUBST(FC)
-
 OCTAVE_F77_FLAG([-ffloat-store], [
   AC_MSG_RESULT([setting F77_FLOAT_STORE_FLAG to -ffloat-store])
   F77_FLOAT_STORE_FLAG=-ffloat-store
--- a/libgui/src/dialog.cc	Fri Nov 28 07:55:46 2014 -0800
+++ b/libgui/src/dialog.cc	Fri Nov 28 10:23:03 2014 -0800
@@ -466,18 +466,18 @@
            &uiwidget_creator,
            SLOT (filedialog_finished (const QStringList&, const QString&,
                                       int)));
+  connect (this, SIGNAL (accepted ()), this, SLOT (acceptSelection ()));
+  connect (this, SIGNAL (rejected ()), this, SLOT (rejectSelection ()));
 }
 
 void
-FileDialog::reject (void)
+FileDialog::rejectSelection(void)
 {
   QStringList empty;
   emit finish_input (empty, "", 0);
-  done (QDialog::Rejected);
-
 }
 
-void FileDialog::accept (void)
+void FileDialog::acceptSelection (void)
 {
   QStringList string_result;
   QString path;
@@ -513,6 +513,5 @@
 
   // send the selected info
   emit finish_input (string_result, path, idx);
-  done (QDialog::Accepted);
 }
 
--- a/libgui/src/dialog.h	Fri Nov 28 07:55:46 2014 -0800
+++ b/libgui/src/dialog.h	Fri Nov 28 10:23:03 2014 -0800
@@ -261,9 +261,9 @@
 
 private slots:
 
-  void reject (void);
+  void rejectSelection (void);
 
-  void accept (void);
+  void acceptSelection (void);
 };
 
 #endif
--- a/libgui/src/octave-dock-widget.cc	Fri Nov 28 07:55:46 2014 -0800
+++ b/libgui/src/octave-dock-widget.cc	Fri Nov 28 10:23:03 2014 -0800
@@ -107,6 +107,9 @@
            this, SLOT (pasteClipboard ()));
   connect (p, SIGNAL (selectAll_signal ()),
            this, SLOT (selectAll ()));
+
+  installEventFilter (this);
+
 }
 
 octave_dock_widget::~octave_dock_widget ()
@@ -362,3 +365,14 @@
 
   notice_settings (settings);  // call individual handler
 }
+
+bool octave_dock_widget::eventFilter(QObject *obj, QEvent *e)
+{
+  if (e->type () == QEvent::NonClientAreaMouseButtonDblClick)
+    {
+      e->ignore (); // ignore double clicks into window decoration elements
+      return true;
+    }
+
+  return QDockWidget::eventFilter (obj,e);
+}
--- a/libgui/src/octave-dock-widget.h	Fri Nov 28 07:55:46 2014 -0800
+++ b/libgui/src/octave-dock-widget.h	Fri Nov 28 10:23:03 2014 -0800
@@ -105,6 +105,9 @@
   {
   }
 
+  // event filter for double clicks into the window decoration elements
+  bool eventFilter(QObject *obj, QEvent *e);
+
 private slots:
 
   void change_floating (bool);
--- a/libinterp/corefcn/pr-output.cc	Fri Nov 28 07:55:46 2014 -0800
+++ b/libinterp/corefcn/pr-output.cc	Fri Nov 28 10:23:03 2014 -0800
@@ -385,8 +385,7 @@
           double nextd = d;
 
           // Have we converged to 1/intmax ?
-          if (m > 100
-              || fabs (frac) < 1 / static_cast<double> (std::numeric_limits<int>::max ()))
+          if (fabs (frac) < 1 / static_cast<double> (std::numeric_limits<int>::max ()))
             {
               lastn = n;
               lastd = d;
@@ -408,12 +407,14 @@
           if (n < 0 && d < 0)
             {
               // Double negative, string can be two characters longer..
-              if (buf.str ().length () > static_cast<unsigned int>(len + 2) &&
-                  m > 1)
+              if (buf.str ().length () > static_cast<unsigned int>(len + 2))
                 break;
             }
-          else if (buf.str ().length () > static_cast<unsigned int>(len) &&
-                   m > 1)
+          else if (buf.str ().length () > static_cast<unsigned int>(len))
+            break;
+
+          if (fabs (n) > std::numeric_limits<int>::max ()
+              || fabs (d) > std::numeric_limits<int>::max ())
             break;
 
           s = buf.str ();
@@ -435,6 +436,20 @@
   return s;
 }
 
+/*
+%!assert (rats (2.0005, 9), "4001/2000")
+%!assert (rats (-2.0005, 10), "-4001/2000")
+%!assert (strtrim (rats (2.0005, 30)), "4001/2000")
+%!assert (pi - str2num (rats (pi, 30)), 0, 4 * eps)
+%!assert (e - str2num (rats (e, 30)), 0, 4 * eps)
+%!assert (rats (123, 2), " *")
+
+%!test
+%! v = 1 / double (intmax);
+%! err = v - str2num (rats(v, 12));
+%! assert (err, 0, 4 * eps);
+*/
+
 class
 pr_rational_float
 {
@@ -3403,6 +3418,9 @@
 \n\
 The optional second argument defines the maximum length of the string\n\
 representing the elements of @var{x}.  By default @var{len} is 9.\n\
+\n\
+If the length of the smallest possible rational approximation exceeds\n\
+@var{len}, an asterisk (*) padded with spaces will be returned instead.\n\
 @seealso{format, rat}\n\
 @end deftypefn")
 {
--- a/libinterp/corefcn/toplev.cc	Fri Nov 28 07:55:46 2014 -0800
+++ b/libinterp/corefcn/toplev.cc	Fri Nov 28 10:23:03 2014 -0800
@@ -1326,7 +1326,6 @@
     { false, "F77", OCTAVE_CONF_F77 },
     { false, "F77_FLOAT_STORE_FLAG", OCTAVE_CONF_F77_FLOAT_STORE_FLAG },
     { false, "F77_INTEGER_8_FLAG", OCTAVE_CONF_F77_INTEGER_8_FLAG },
-    { false, "FC", OCTAVE_CONF_FC },
     { false, "FFLAGS", OCTAVE_CONF_FFLAGS },
     { false, "FFTW3_CPPFLAGS", OCTAVE_CONF_FFTW3_CPPFLAGS },
     { false, "FFTW3_LDFLAGS", OCTAVE_CONF_FFTW3_LDFLAGS },
--- a/scripts/gui/private/__file_filter__.m	Fri Nov 28 07:55:46 2014 -0800
+++ b/scripts/gui/private/__file_filter__.m	Fri Nov 28 10:23:03 2014 -0800
@@ -53,7 +53,7 @@
     if (! strcmp (fname, "*"))
       defname = strcat (fname, fext);
     endif
-    if (length (fext) > 0)
+    if ((length (fext) > 0) && (! strcmp(fext, '.*')))
       fext = strcat ("*", fext);
       retval = {fext, __default_filtername__(fext)};
     endif
--- a/scripts/gui/uiputfile.m	Fri Nov 28 07:55:46 2014 -0800
+++ b/scripts/gui/uiputfile.m	Fri Nov 28 10:23:03 2014 -0800
@@ -112,6 +112,19 @@
     [retfile, retpath, retindex] = feval (funcname, outargs{:});
   endif
 
+  # add extension to the name it isnt already added
+
+  if ischar (retfile)
+    ext = outargs{1}{retindex};
+    ext = strrep (ext, '*', '');
+
+    if length (retfile) >= length (ext)
+      if ! strcmp (retfile(end-length (ext)+1:end), ext)
+        retfile = [retfile ext];
+      endif
+    endif
+  endif
+
 endfunction