# HG changeset patch
# User John W. Eaton
# Date 1670357836 18000
# Node ID bd9da634f00d44e43c9725f1f770cf039447652d
# Parent 91680d96c860f33873d39586ef25718e054c5ca2# Parent 9089bd969b370f8613112bc58a0b32d6faa7fd79
maint: Merge stable to default.
diff -r 9089bd969b37 -r bd9da634f00d .github/workflows/make.yaml
--- a/.github/workflows/make.yaml Tue Dec 06 14:23:21 2022 -0500
+++ b/.github/workflows/make.yaml Tue Dec 06 15:17:16 2022 -0500
@@ -85,7 +85,7 @@
key: ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ github.ref }}:${{ steps.ccache_cache_timestamp.outputs.timestamp }}:${{ github.sha }}
restore-keys: |
ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ github.ref }}
- ccache:${{ matrix.os }}:${{ matrix.compiler }}:refs/heads/stable
+ ccache:${{ matrix.os }}:${{ matrix.compiler }}:refs/heads/default
- name: configure ccache
env:
@@ -239,7 +239,7 @@
key: ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ github.ref }}:${{ steps.ccache_cache_timestamp.outputs.timestamp }}:${{ github.sha }}
restore-keys: |
ccache:${{ matrix.os }}:${{ matrix.compiler }}:${{ github.ref }}
- ccache:${{ matrix.os }}:${{ matrix.compiler }}:refs/heads/stable
+ ccache:${{ matrix.os }}:${{ matrix.compiler }}:refs/heads/default
- name: configure ccache
# The cache doesn't seem to compress well on macOS. Is it already compressed?
@@ -468,7 +468,7 @@
key: ccache:${{ matrix.os }}:${{ matrix.msystem }}:${{ github.ref }}:${{ steps.ccache_cache_timestamp.outputs.timestamp }}:${{ github.sha }}
restore-keys: |
ccache:${{ matrix.os }}:${{ matrix.msystem }}:${{ github.ref }}
- ccache:${{ matrix.os }}:${{ matrix.msystem }}:refs/heads/stable
+ ccache:${{ matrix.os }}:${{ matrix.msystem }}:refs/heads/default
- name: configure ccache
# Limit the maximum size and switch on compression to avoid exceeding the total disk or cache quota.
@@ -707,7 +707,7 @@
key: ccache:${{ matrix.os }}:cygwin:${{ github.ref }}:${{ steps.ccache_cache_timestamp.outputs.timestamp }}:${{ github.sha }}
restore-keys: |
ccache:${{ matrix.os }}:cygwin:${{ github.ref }}
- ccache:${{ matrix.os }}:cygwin:refs/heads/stable
+ ccache:${{ matrix.os }}:cygwin:refs/heads/default
- name: configure ccache
run: |
diff -r 9089bd969b37 -r bd9da634f00d configure.ac
--- a/configure.ac Tue Dec 06 14:23:21 2022 -0500
+++ b/configure.ac Tue Dec 06 15:17:16 2022 -0500
@@ -27,7 +27,7 @@
### Initialize Autoconf
AC_PREREQ([2.65])
-AC_INIT([GNU Octave], [8.0.1], [https://octave.org/bugs.html], [octave],
+AC_INIT([GNU Octave], [9.0.0], [https://octave.org/bugs.html], [octave],
[https://www.gnu.org/software/octave/])
### Declare version numbers
@@ -39,9 +39,9 @@
## explains how to update these numbers for release and development
## versions.
-OCTAVE_MAJOR_VERSION=8
+OCTAVE_MAJOR_VERSION=9
OCTAVE_MINOR_VERSION=0
-OCTAVE_PATCH_VERSION=1
+OCTAVE_PATCH_VERSION=0
dnl PACKAGE_VERSION is set by the AC_INIT VERSION argument.
OCTAVE_VERSION="$PACKAGE_VERSION"
diff -r 9089bd969b37 -r bd9da634f00d doc/interpreter/contributors.in
--- a/doc/interpreter/contributors.in Tue Dec 06 14:23:21 2022 -0500
+++ b/doc/interpreter/contributors.in Tue Dec 06 15:17:16 2022 -0500
@@ -101,6 +101,7 @@
Massimiliano Fasi
Stephen Fegan
Ramon Garcia Fernandez
+Kasper H. Filtenborg
Torsten Finke
David Finkel
Guillaume Flandin
diff -r 9089bd969b37 -r bd9da634f00d doc/interpreter/linalg.txi
--- a/doc/interpreter/linalg.txi Tue Dec 06 14:23:21 2022 -0500
+++ b/doc/interpreter/linalg.txi Tue Dec 06 15:17:16 2022 -0500
@@ -211,6 +211,8 @@
@DOCSTRING(kron)
+@DOCSTRING(tensorprod)
+
@DOCSTRING(blkmm)
@DOCSTRING(sylvester)
diff -r 9089bd969b37 -r bd9da634f00d doc/liboctave/range.texi
--- a/doc/liboctave/range.texi Tue Dec 06 14:23:21 2022 -0500
+++ b/doc/liboctave/range.texi Tue Dec 06 15:17:16 2022 -0500
@@ -20,35 +20,4 @@
@chapter Ranges
@cindex ranges
-@deftypefn {} {} Range (void)
-@deftypefnx {} {} Range (const Range &@var{r})
-@deftypefnx {} {} Range (double @var{b}, double @var{l})
-@deftypefnx {} {} Range (double @var{b}, double @var{l}, double @var{i})
-@end deftypefn
-
-@deftypefn {} double base (void) const
-@deftypefnx {} double limit (void) const
-@deftypefnx {} double inc (void) const
-@end deftypefn
-
-@deftypefn {} void set_base (double @var{b})
-@deftypefnx {} void set_limit (double @var{l})
-@deftypefnx {} void set_inc (double @var{i})
-@end deftypefn
-
-@deftypefn {} int nelem (void) const
-@end deftypefn
-
-@deftypefn {} double min (void) const
-@deftypefnx {} double max (void) const
-@end deftypefn
-
-@deftypefn {} void sort (void)
-@end deftypefn
-
-@deftypefn {} {ostream&} {operator <<} (ostream &@var{os}, const Range &@var{r})
-@deftypefnx {} {istream&} {operator >>} (istream &@var{is}, Range &@var{r})
-@end deftypefn
-
-@deftypefn {} void print_range (void)
-@end deftypefn
+FIXME: The @code{Range} class is obsolete.
diff -r 9089bd969b37 -r bd9da634f00d etc/NEWS.8.md
diff -r 9089bd969b37 -r bd9da634f00d etc/NEWS.9.md
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/etc/NEWS.9.md Tue Dec 06 15:17:16 2022 -0500
@@ -0,0 +1,93 @@
+Summary of important user-visible changes for version 9 (yyyy-mm-dd):
+---------------------------------------------------------------------
+
+### General improvements
+
+- `oruntests`: The current directory now changes to the directory
+containing the files with the tests for the duration of the test. This
+aligns the behavior of this function with Octave's test suite. This also
+means that the file encoding specified in the `.oct-config` file for the
+respective directory is taken into account for the tests.
+
+### Graphical User Interface
+
+### Graphics backend
+
+### Matlab compatibility
+
+### Alphabetical list of new functions added in Octave 9
+
+* `tensorprod`
+
+### Deprecated functions, properties, and operators
+
+The following functions and properties have been deprecated in Octave 9
+and will be removed from Octave 11 (or whatever version is the second
+major release after 9):
+
+- Functions
+
+ Function | Replacement
+ -----------------------|------------------
+
+- Properties
+
+ The following property names are discouraged, but there is no fixed
+ date for their removal.
+
+ Object | Property | Replacement
+ -----------------|-------------|------------
+
+The following features were deprecated in Octave 7 and have been removed
+from Octave 9.
+
+- Functions
+
+ Function | Replacement
+ ---------------------------|------------------
+ disable_diagonal_matrix | optimize_diagonal_matrix
+ disable_permutation_matrix | optimize_permutation_matrix
+ disable_range | optimize_range
+
+- Operators
+
+ Operator | Replacement
+ ---------|------------
+ .+ | +
+ .+= | +=
+ .- | -
+ .-= | -=
+ ** | ^
+ **= | ^=
+ .** | .^
+ .**= | .^=
+
+- Interpreter
+
+ * The use of `'...'` for line continuations *inside* double-quoted
+ strings has been removed. Use `'\'` for line continuations inside strings
+ instead.
+
+ * The use of `'\'` as a line continuation *outside* of double-quoted
+ strings has been removed. Use `'...'` for line continuations instead.
+
+ * Support for trailing whitespace after a `'\'` line continuation has been
+ removed. Delete unnecessary trailing whitespace.
+
+- For plot functions, the use of numbers to select line colors in
+ shorthand formats was an undocumented feature was removed from Octave 9.
+
+- The environment variable used by `mkoctfile` for linker flags is now
+ `LDFLAGS` rather than `LFLAGS`. `LFLAGS` was deprecated in Octave 6
+ and has been removed.
+
+### Old release news
+
+- [Octave 8.x](etc/NEWS.8)
+- [Octave 7.x](etc/NEWS.7)
+- [Octave 6.x](etc/NEWS.6)
+- [Octave 5.x](etc/NEWS.5)
+- [Octave 4.x](etc/NEWS.4)
+- [Octave 3.x](etc/NEWS.3)
+- [Octave 2.x](etc/NEWS.2)
+- [Octave 1.x](etc/NEWS.1)
diff -r 9089bd969b37 -r bd9da634f00d etc/module.mk
--- a/etc/module.mk Tue Dec 06 14:23:21 2022 -0500
+++ b/etc/module.mk Tue Dec 06 15:17:16 2022 -0500
@@ -13,6 +13,7 @@
%reldir%/NEWS.6.md \
%reldir%/NEWS.7.md \
%reldir%/NEWS.8.md \
+ %reldir%/NEWS.9.md \
%reldir%/gdbinit
%canon_reldir%_EXTRA_DIST += \
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/BaseControl.cc
--- a/libgui/graphics/BaseControl.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/BaseControl.cc Tue Dec 06 15:17:16 2022 -0500
@@ -116,10 +116,9 @@
w->setPalette (p);
}
- BaseControl::BaseControl (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ BaseControl::BaseControl (octave::interpreter& interp,
const graphics_object& go, QWidget *w)
- : Object (oct_qobj, interp, go, w), m_normalizedFont (false),
+ : Object (interp, go, w), m_normalizedFont (false),
m_keyPressHandlerDefined (false)
{
qObject ()->setObjectName ("UIControl");
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/BaseControl.h
--- a/libgui/graphics/BaseControl.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/BaseControl.h Tue Dec 06 15:17:16 2022 -0500
@@ -33,13 +33,12 @@
namespace octave
{
- class base_qobject;
class interpreter;
class BaseControl : public Object
{
public:
- BaseControl (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ BaseControl (octave::interpreter& interp,
const graphics_object& go, QWidget *w);
~BaseControl (void);
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/ButtonControl.cc
--- a/libgui/graphics/ButtonControl.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/ButtonControl.cc Tue Dec 06 15:17:16 2022 -0500
@@ -40,11 +40,10 @@
namespace octave
{
- ButtonControl::ButtonControl (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ ButtonControl::ButtonControl (octave::interpreter& interp,
const graphics_object& go,
QAbstractButton *btn)
- : BaseControl (oct_qobj, interp, go, btn), m_blockCallback (false)
+ : BaseControl (interp, go, btn), m_blockCallback (false)
{
uicontrol::properties& up = properties ();
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/ButtonControl.h
--- a/libgui/graphics/ButtonControl.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/ButtonControl.h Tue Dec 06 15:17:16 2022 -0500
@@ -32,7 +32,6 @@
namespace octave
{
- class base_qobject;
class interpreter;
class ButtonControl : public BaseControl
@@ -40,7 +39,7 @@
Q_OBJECT
public:
- ButtonControl (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ ButtonControl (octave::interpreter& interp,
const graphics_object& go, QAbstractButton *btn);
~ButtonControl (void);
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/ButtonGroup.cc
--- a/libgui/graphics/ButtonGroup.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/ButtonGroup.cc Tue Dec 06 15:17:16 2022 -0500
@@ -45,7 +45,6 @@
#include "QtHandlesUtils.h"
#include "qt-graphics-toolkit.h"
-#include "octave-qobject.h"
#include "octave-qtutils.h"
#include "interpreter.h"
@@ -100,8 +99,7 @@
}
ButtonGroup *
- ButtonGroup::create (octave::base_qobject& oct_qobj,
- octave::interpreter& interp, const graphics_object& go)
+ ButtonGroup::create (octave::interpreter& interp, const graphics_object& go)
{
Object *parent = parentObject (interp, go);
@@ -112,7 +110,7 @@
if (container)
{
QFrame *frame = new QFrame (container);
- return new ButtonGroup (oct_qobj, interp, go,
+ return new ButtonGroup (interp, go,
new QButtonGroup (frame), frame);
}
}
@@ -120,11 +118,10 @@
return nullptr;
}
- ButtonGroup::ButtonGroup (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ ButtonGroup::ButtonGroup (octave::interpreter& interp,
const graphics_object& go,
QButtonGroup *buttongroup, QFrame *frame)
- : Object (oct_qobj, interp, go, frame), m_hiddenbutton (nullptr),
+ : Object (interp, go, frame), m_hiddenbutton (nullptr),
m_container (nullptr), m_title (nullptr), m_blockUpdates (false)
{
uibuttongroup::properties& pp = properties ();
@@ -144,7 +141,7 @@
m_hiddenbutton->hide ();
m_buttongroup->addButton (m_hiddenbutton);
- m_container = new Container (frame, oct_qobj, interp);
+ m_container = new Container (frame, interp);
m_container->canvas (m_handle);
connect (m_container, SIGNAL (interpeter_event (const fcn_callback&)),
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/ButtonGroup.h
--- a/libgui/graphics/ButtonGroup.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/ButtonGroup.h Tue Dec 06 15:17:16 2022 -0500
@@ -36,7 +36,6 @@
namespace octave
{
- class base_qobject;
class interpreter;
class Container;
@@ -46,7 +45,7 @@
Q_OBJECT
public:
- ButtonGroup (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ ButtonGroup (octave::interpreter& interp,
const graphics_object& go, QButtonGroup *buttongroup,
QFrame *frame);
~ButtonGroup (void);
@@ -56,7 +55,7 @@
bool eventFilter (QObject *watched, QEvent *event);
static ButtonGroup *
- create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ create (octave::interpreter& interp,
const graphics_object& go);
void addButton (QAbstractButton *btn);
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/Canvas.cc
--- a/libgui/graphics/Canvas.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/Canvas.cc Tue Dec 06 15:17:16 2022 -0500
@@ -43,7 +43,7 @@
#include "qt-graphics-toolkit.h"
#include "annotation-dialog.h"
-#include "octave-qobject.h"
+#include "gui-settings.h"
#include "qt-interpreter-events.h"
#include "builtin-defun-decls.h"
@@ -77,9 +77,9 @@
QCursor
Canvas::make_cursor (const QString& name, int hot_x, int hot_y)
{
- octave::resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+ gui_settings settings;
- QIcon icon = rmgr.icon (name);
+ QIcon icon = settings.icon (name);
return QCursor (icon.pixmap (22, 22), hot_x, hot_y);
}
@@ -869,7 +869,7 @@
octave_value_list props = ovl ("textbox", bb);
- annotation_dialog anno_dlg (m_octave_qobj, w, props);
+ annotation_dialog anno_dlg (w, props);
if (anno_dlg.exec () == QDialog::Accepted)
{
@@ -1086,12 +1086,12 @@
}
Canvas *
- Canvas::create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ Canvas::create (octave::interpreter& interp,
const graphics_handle& handle, QWidget *parent,
const std::string& /* name */)
{
// Only OpenGL
- return new GLCanvas (oct_qobj, interp, handle, parent);
+ return new GLCanvas (interp, handle, parent);
}
}
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/Canvas.h
--- a/libgui/graphics/Canvas.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/Canvas.h Tue Dec 06 15:17:16 2022 -0500
@@ -43,7 +43,6 @@
namespace octave
{
- class base_qobject;
class interpreter;
class Canvas : public QObject
@@ -78,9 +77,8 @@
virtual QWidget * qWidget (void) = 0;
static Canvas *
- create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
- const graphics_handle& handle, QWidget *parent,
- const std::string& name);
+ create (octave::interpreter& interp, const graphics_handle& handle,
+ QWidget *parent, const std::string& name);
virtual uint8NDArray getPixels (void) { return do_getPixels (m_handle); };
@@ -114,10 +112,8 @@
const graphics_handle& handle) = 0;
protected:
- Canvas (octave::base_qobject& oct_qobj, octave::interpreter& interp,
- const graphics_handle& handle)
- : m_octave_qobj (oct_qobj),
- m_interpreter (interp),
+ Canvas (octave::interpreter& interp, const graphics_handle& handle)
+ : m_interpreter (interp),
m_handle (handle),
m_redrawBlocked (false),
m_mouseMode (NoMode),
@@ -149,7 +145,7 @@
std::vector omit = std::vector ());
protected:
- octave::base_qobject& m_octave_qobj;
+
octave::interpreter& m_interpreter;
private:
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/CheckBoxControl.cc
--- a/libgui/graphics/CheckBoxControl.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/CheckBoxControl.cc Tue Dec 06 15:17:16 2022 -0500
@@ -32,14 +32,11 @@
#include "CheckBoxControl.h"
#include "Container.h"
-#include "octave-qobject.h"
-
namespace octave
{
CheckBoxControl *
- CheckBoxControl::create (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ CheckBoxControl::create (octave::interpreter& interp,
const graphics_object& go)
{
Object *parent = parentObject (interp, go);
@@ -49,17 +46,16 @@
Container *container = parent->innerContainer ();
if (container)
- return new CheckBoxControl (oct_qobj, interp, go,
+ return new CheckBoxControl (interp, go,
new QCheckBox (container));
}
return nullptr;
}
- CheckBoxControl::CheckBoxControl (octave::base_qobject& oct_obj,
- octave::interpreter& interp,
+ CheckBoxControl::CheckBoxControl (octave::interpreter& interp,
const graphics_object& go, QCheckBox *box)
- : ButtonControl (oct_obj, interp, go, box)
+ : ButtonControl (interp, go, box)
{
uicontrol::properties& up = properties ();
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/CheckBoxControl.h
--- a/libgui/graphics/CheckBoxControl.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/CheckBoxControl.h Tue Dec 06 15:17:16 2022 -0500
@@ -32,19 +32,17 @@
namespace octave
{
- class base_qobject;
class interpreter;
class CheckBoxControl : public ButtonControl
{
public:
- CheckBoxControl (octave::base_qobject& oct_qobj,
- octave::interpreter& interp, const graphics_object& go,
+ CheckBoxControl (octave::interpreter& interp, const graphics_object& go,
QCheckBox *box);
~CheckBoxControl (void);
static CheckBoxControl *
- create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ create (octave::interpreter& interp,
const graphics_object& go);
protected:
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/Container.cc
--- a/libgui/graphics/Container.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/Container.cc Tue Dec 06 15:17:16 2022 -0500
@@ -41,10 +41,8 @@
namespace octave
{
- Container::Container (QWidget *xparent, octave::base_qobject& oct_qobj,
- octave::interpreter& interp)
- : ContainerBase (xparent), m_octave_qobj (oct_qobj),
- m_interpreter (interp), m_canvas (nullptr)
+ Container::Container (QWidget *xparent, octave::interpreter& interp)
+ : ContainerBase (xparent), m_interpreter (interp), m_canvas (nullptr)
{
setFocusPolicy (Qt::ClickFocus);
}
@@ -67,7 +65,7 @@
{
graphics_object fig = go.get_ancestor ("figure");
- m_canvas = Canvas::create (m_octave_qobj, m_interpreter, gh, this,
+ m_canvas = Canvas::create (m_interpreter, gh, this,
fig.get ("renderer").string_value ());
connect (m_canvas, QOverload::of (&Canvas::interpreter_event),
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/Container.h
--- a/libgui/graphics/Container.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/Container.h Tue Dec 06 15:17:16 2022 -0500
@@ -35,11 +35,6 @@
namespace octave
{
- class base_qobject;
-}
-
-namespace octave
-{
DECLARE_GENERICEVENTNOTIFY_SENDER(ContainerBase, QWidget);
@@ -50,8 +45,7 @@
Q_OBJECT
public:
- Container (QWidget *parent, octave::base_qobject& oct_qobj,
- octave::interpreter& interp);
+ Container (QWidget *parent, octave::interpreter& interp);
~Container (void);
Canvas * canvas (const graphics_handle& handle, bool create = true);
@@ -81,7 +75,6 @@
void resizeEvent (QResizeEvent *event);
private:
- octave::base_qobject& m_octave_qobj;
octave::interpreter& m_interpreter;
Canvas *m_canvas;
};
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/ContextMenu.cc
--- a/libgui/graphics/ContextMenu.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/ContextMenu.cc Tue Dec 06 15:17:16 2022 -0500
@@ -33,16 +33,13 @@
#include "QtHandlesUtils.h"
#include "qt-graphics-toolkit.h"
-#include "octave-qobject.h"
-
#include "interpreter.h"
namespace octave
{
ContextMenu *
- ContextMenu::create (octave::base_qobject& oct_qobj,
- octave::interpreter& interp, const graphics_object& go)
+ ContextMenu::create (octave::interpreter& interp, const graphics_object& go)
{
Object *xparent = parentObject (interp, go);
@@ -50,16 +47,15 @@
{
QWidget *w = xparent->qWidget ();
- return new ContextMenu (oct_qobj, interp, go, new QMenu (w));
+ return new ContextMenu (interp, go, new QMenu (w));
}
return nullptr;
}
- ContextMenu::ContextMenu (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ ContextMenu::ContextMenu (octave::interpreter& interp,
const graphics_object& go, QMenu *xmenu)
- : Object (oct_qobj, interp, go, xmenu)
+ : Object (interp, go, xmenu)
{
xmenu->setAutoFillBackground (true);
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/ContextMenu.h
--- a/libgui/graphics/ContextMenu.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/ContextMenu.h Tue Dec 06 15:17:16 2022 -0500
@@ -35,7 +35,6 @@
namespace octave
{
- class base_qobject;
class interpreter;
class ContextMenu : public Object, public MenuContainer
@@ -43,12 +42,12 @@
Q_OBJECT
public:
- ContextMenu (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ ContextMenu (octave::interpreter& interp,
const graphics_object& go, QMenu *menu);
~ContextMenu (void);
static ContextMenu *
- create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ create (octave::interpreter& interp,
const graphics_object& go);
static void executeAt (octave::interpreter& interp,
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/EditControl.cc
--- a/libgui/graphics/EditControl.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/EditControl.cc Tue Dec 06 15:17:16 2022 -0500
@@ -34,14 +34,11 @@
#include "TextEdit.h"
#include "QtHandlesUtils.h"
-#include "octave-qobject.h"
-
namespace octave
{
EditControl *
- EditControl::create (octave::base_qobject& oct_qobj,
- octave::interpreter& interp, const graphics_object& go)
+ EditControl::create (octave::interpreter& interp, const graphics_object& go)
{
Object *parent = parentObject (interp, go);
@@ -54,10 +51,10 @@
uicontrol::properties& up = Utils::properties (go);
if ((up.get_max () - up.get_min ()) > 1)
- return new EditControl (oct_qobj, interp, go,
+ return new EditControl (interp, go,
new TextEdit (container));
else
- return new EditControl (oct_qobj, interp, go,
+ return new EditControl (interp, go,
new QLineEdit (container));
}
}
@@ -65,10 +62,9 @@
return nullptr;
}
- EditControl::EditControl (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ EditControl::EditControl (octave::interpreter& interp,
const graphics_object& go, QLineEdit *edit)
- : BaseControl (oct_qobj, interp, go, edit), m_multiLine (false),
+ : BaseControl (interp, go, edit), m_multiLine (false),
m_textChanged (false)
{
init (edit);
@@ -101,10 +97,9 @@
this, &EditControl::returnPressed);
}
- EditControl::EditControl (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ EditControl::EditControl (octave::interpreter& interp,
const graphics_object& go, TextEdit *edit)
- : BaseControl (oct_qobj, interp, go, edit), m_multiLine (true),
+ : BaseControl (interp, go, edit), m_multiLine (true),
m_textChanged (false)
{
init (edit);
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/EditControl.h
--- a/libgui/graphics/EditControl.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/EditControl.h Tue Dec 06 15:17:16 2022 -0500
@@ -33,7 +33,6 @@
namespace octave
{
- class base_qobject;
class interpreter;
class TextEdit;
@@ -43,16 +42,16 @@
Q_OBJECT
public:
- EditControl (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ EditControl (octave::interpreter& interp,
const graphics_object& go, QLineEdit *edit);
- EditControl (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ EditControl (octave::interpreter& interp,
const graphics_object& go, TextEdit *edit);
~EditControl (void);
static EditControl *
- create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ create (octave::interpreter& interp,
const graphics_object& go);
protected:
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/Figure.cc
--- a/libgui/graphics/Figure.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/Figure.cc Tue Dec 06 15:17:16 2022 -0500
@@ -110,19 +110,19 @@
}
Figure *
- Figure::create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ Figure::create (octave::interpreter& interp,
const graphics_object& go)
{
- return new Figure (oct_qobj, interp, go, new FigureWindow ());
+ return new Figure (interp, go, new FigureWindow ());
}
- Figure::Figure (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ Figure::Figure (octave::interpreter& interp,
const graphics_object& go, FigureWindow *win)
- : Object (oct_qobj, interp, go, win), m_blockUpdates (false),
+ : Object (interp, go, win), m_blockUpdates (false),
m_figureToolBar (nullptr), m_menuBar (nullptr), m_innerRect (),
m_outerRect (), m_previousHeight (0), m_resizable (true)
{
- m_container = new Container (win, oct_qobj, interp);
+ m_container = new Container (win, interp);
win->setCentralWidget (m_container);
connect (m_container, QOverload::of (&Container::interpreter_event),
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/Figure.h
--- a/libgui/graphics/Figure.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/Figure.h Tue Dec 06 15:17:16 2022 -0500
@@ -39,7 +39,6 @@
namespace octave
{
- class base_qobject;
class interpreter;
enum MouseMode
@@ -68,12 +67,12 @@
friend class ToolBar;
public:
- Figure (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ Figure (octave::interpreter& interp,
const graphics_object& go, FigureWindow *win);
~Figure (void);
static Figure *
- create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ create (octave::interpreter& interp,
const graphics_object& go);
QString fileName (void);
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/GLCanvas.cc
--- a/libgui/graphics/GLCanvas.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/GLCanvas.cc Tue Dec 06 15:17:16 2022 -0500
@@ -50,11 +50,10 @@
# endif
#endif
- GLCanvas::GLCanvas (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ GLCanvas::GLCanvas (octave::interpreter& interp,
const graphics_handle& gh, QWidget *xparent)
: OCTAVE_QT_OPENGL_WIDGET (OCTAVE_QT_OPENGL_WIDGET_FORMAT_ARGS xparent),
- Canvas (oct_qobj, interp, gh), m_glfcns (), m_renderer (m_glfcns)
+ Canvas (interp, gh), m_glfcns (), m_renderer (m_glfcns)
{
setFocusPolicy (Qt::ClickFocus);
setFocus ();
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/GLCanvas.h
--- a/libgui/graphics/GLCanvas.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/GLCanvas.h Tue Dec 06 15:17:16 2022 -0500
@@ -51,7 +51,6 @@
namespace octave
{
- class base_qobject;
}
namespace octave
@@ -59,7 +58,7 @@
class GLCanvas : public OCTAVE_QT_OPENGL_WIDGET, public Canvas
{
public:
- GLCanvas (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ GLCanvas (octave::interpreter& interp,
const graphics_handle& handle, QWidget *parent);
~GLCanvas (void);
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/ListBoxControl.cc
--- a/libgui/graphics/ListBoxControl.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/ListBoxControl.cc Tue Dec 06 15:17:16 2022 -0500
@@ -35,8 +35,6 @@
#include "ListBoxControl.h"
#include "QtHandlesUtils.h"
-#include "octave-qobject.h"
-
namespace octave
{
@@ -70,8 +68,7 @@
}
ListBoxControl *
- ListBoxControl::create (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ ListBoxControl::create (octave::interpreter& interp,
const graphics_object& go)
{
Object *parent = parentObject (interp, go);
@@ -81,17 +78,16 @@
Container *container = parent->innerContainer ();
if (container)
- return new ListBoxControl (oct_qobj, interp, go,
+ return new ListBoxControl (interp, go,
new QListWidget (container));
}
return nullptr;
}
- ListBoxControl::ListBoxControl (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ ListBoxControl::ListBoxControl (octave::interpreter& interp,
const graphics_object& go, QListWidget *list)
- : BaseControl (oct_qobj, interp, go, list), m_blockCallback (false),
+ : BaseControl (interp, go, list), m_blockCallback (false),
m_selectionChanged (false)
{
uicontrol::properties& up = properties ();
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/ListBoxControl.h
--- a/libgui/graphics/ListBoxControl.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/ListBoxControl.h Tue Dec 06 15:17:16 2022 -0500
@@ -34,7 +34,6 @@
namespace octave
{
- class base_qobject;
class interpreter;
class ListBoxControl : public BaseControl
@@ -42,13 +41,12 @@
Q_OBJECT
public:
- ListBoxControl (octave::base_qobject& oct_qobj,
- octave::interpreter& interp, const graphics_object& go,
+ ListBoxControl (octave::interpreter& interp, const graphics_object& go,
QListWidget *list);
~ListBoxControl (void);
static ListBoxControl *
- create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ create (octave::interpreter& interp,
const graphics_object& go);
protected:
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/Menu.cc
--- a/libgui/graphics/Menu.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/Menu.cc Tue Dec 06 15:17:16 2022 -0500
@@ -36,8 +36,6 @@
#include "Menu.h"
#include "QtHandlesUtils.h"
-#include "octave-qobject.h"
-
namespace octave
{
@@ -63,7 +61,7 @@
}
Menu *
- Menu::create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ Menu::create (octave::interpreter& interp,
const graphics_object& go)
{
Object *parent_obj = parentObject (interp, go);
@@ -73,16 +71,16 @@
QObject *qObj = parent_obj->qObject ();
if (qObj)
- return new Menu (oct_qobj, interp, go, new QAction (qObj),
+ return new Menu (interp, go, new QAction (qObj),
parent_obj);
}
return nullptr;
}
- Menu::Menu (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ Menu::Menu (octave::interpreter& interp,
const graphics_object& go, QAction *action, Object *xparent)
- : Object (oct_qobj, interp, go, action), m_parent (nullptr),
+ : Object (interp, go, action), m_parent (nullptr),
m_separator (nullptr)
{
uimenu::properties& up = properties ();
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/Menu.h
--- a/libgui/graphics/Menu.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/Menu.h Tue Dec 06 15:17:16 2022 -0500
@@ -35,7 +35,6 @@
namespace octave
{
- class base_qobject;
class interpreter;
class Menu : public Object, public MenuContainer
@@ -43,12 +42,12 @@
Q_OBJECT
public:
- Menu (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ Menu (octave::interpreter& interp,
const graphics_object& go, QAction *action, Object *parent);
~Menu (void);
static Menu *
- create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ create (octave::interpreter& interp,
const graphics_object& go);
Container * innerContainer (void) { return nullptr; }
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/Object.cc
--- a/libgui/graphics/Object.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/Object.cc Tue Dec 06 15:17:16 2022 -0500
@@ -32,7 +32,6 @@
#include "Object.h"
#include "QtHandlesUtils.h"
-#include "octave-qobject.h"
#include "qt-graphics-toolkit.h"
#include "graphics.h"
@@ -41,10 +40,10 @@
namespace octave
{
- Object::Object (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ Object::Object (octave::interpreter& interp,
const graphics_object& go, QObject *obj)
- : QObject (), m_octave_qobj (oct_qobj), m_interpreter (interp),
- m_go (go), m_handle (go.get_handle ()), m_qobject (nullptr)
+ : QObject (), m_interpreter (interp), m_go (go),
+ m_handle (go.get_handle ()), m_qobject (nullptr)
{
gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/Object.h
--- a/libgui/graphics/Object.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/Object.h Tue Dec 06 15:17:16 2022 -0500
@@ -37,7 +37,6 @@
namespace octave
{
- class base_qobject;
class interpreter;
class Container;
@@ -48,8 +47,8 @@
Q_OBJECT
public:
- Object (octave::base_qobject& qobj, octave::interpreter& interp,
- const graphics_object& go, QObject *obj = nullptr);
+ Object (octave::interpreter& interp, const graphics_object& go,
+ QObject *obj = nullptr);
virtual ~Object (void);
@@ -132,7 +131,6 @@
protected:
- octave::base_qobject& m_octave_qobj;
octave::interpreter& m_interpreter;
// Store the graphics object directly so that it will exist when
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/Panel.cc
--- a/libgui/graphics/Panel.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/Panel.cc Tue Dec 06 15:17:16 2022 -0500
@@ -39,8 +39,6 @@
#include "Panel.h"
#include "QtHandlesUtils.h"
-#include "octave-qobject.h"
-
#include "graphics.h"
#include "interpreter.h"
@@ -93,7 +91,7 @@
}
Panel *
- Panel::create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ Panel::create (octave::interpreter& interp,
const graphics_object& go)
{
Object *parent = parentObject (interp, go);
@@ -103,15 +101,15 @@
Container *container = parent->innerContainer ();
if (container)
- return new Panel (oct_qobj, interp, go, new QFrame (container));
+ return new Panel (interp, go, new QFrame (container));
}
return nullptr;
}
- Panel::Panel (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ Panel::Panel (octave::interpreter& interp,
const graphics_object& go, QFrame *frame)
- : Object (oct_qobj, interp, go, frame), m_container (nullptr),
+ : Object (interp, go, frame), m_container (nullptr),
m_title (nullptr), m_blockUpdates (false),
m_previous_bbox (Matrix (1, 4, 0))
{
@@ -128,7 +126,7 @@
setupPalette (pp, pal);
frame->setPalette (pal);
- m_container = new Container (frame, oct_qobj, interp);
+ m_container = new Container (frame, interp);
m_container->canvas (m_handle);
connect (m_container, SIGNAL (interpeter_event (const fcn_callback&)),
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/Panel.h
--- a/libgui/graphics/Panel.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/Panel.h Tue Dec 06 15:17:16 2022 -0500
@@ -33,7 +33,6 @@
namespace octave
{
- class base_qobject;
class interpreter;
class Container;
@@ -41,7 +40,7 @@
class Panel : public Object
{
public:
- Panel (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ Panel (octave::interpreter& interp,
const graphics_object& go, QFrame *frame);
~Panel (void);
@@ -50,7 +49,7 @@
bool eventFilter (QObject *watched, QEvent *event);
static Panel *
- create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ create (octave::interpreter& interp,
const graphics_object& go);
void do_connections (const QObject *receiver,
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/PopupMenuControl.cc
--- a/libgui/graphics/PopupMenuControl.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/PopupMenuControl.cc Tue Dec 06 15:17:16 2022 -0500
@@ -33,15 +33,13 @@
#include "PopupMenuControl.h"
#include "QtHandlesUtils.h"
-#include "octave-qobject.h"
#include "octave-qtutils.h"
namespace octave
{
PopupMenuControl *
- PopupMenuControl::create (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ PopupMenuControl::create (octave::interpreter& interp,
const graphics_object& go)
{
Object *parent = parentObject (interp, go);
@@ -51,18 +49,17 @@
Container *container = parent->innerContainer ();
if (container)
- return new PopupMenuControl (oct_qobj, interp, go,
+ return new PopupMenuControl (interp, go,
new QComboBox (container));
}
return nullptr;
}
- PopupMenuControl::PopupMenuControl (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ PopupMenuControl::PopupMenuControl (octave::interpreter& interp,
const graphics_object& go,
QComboBox *box)
- : BaseControl (oct_qobj, interp, go, box), m_blockUpdate (false)
+ : BaseControl (interp, go, box), m_blockUpdate (false)
{
uicontrol::properties& up = properties ();
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/PopupMenuControl.h
--- a/libgui/graphics/PopupMenuControl.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/PopupMenuControl.h Tue Dec 06 15:17:16 2022 -0500
@@ -32,7 +32,6 @@
namespace octave
{
- class base_qobject;
class interpreter;
class PopupMenuControl : public BaseControl
@@ -40,13 +39,12 @@
Q_OBJECT
public:
- PopupMenuControl (octave::base_qobject& oct_qobj,
- octave::interpreter& interp, const graphics_object& go,
+ PopupMenuControl (octave::interpreter& interp, const graphics_object& go,
QComboBox *box);
~PopupMenuControl (void);
static PopupMenuControl *
- create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ create (octave::interpreter& interp,
const graphics_object& go);
protected:
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/PushButtonControl.cc
--- a/libgui/graphics/PushButtonControl.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/PushButtonControl.cc Tue Dec 06 15:17:16 2022 -0500
@@ -34,14 +34,11 @@
#include "Container.h"
#include "QtHandlesUtils.h"
-#include "octave-qobject.h"
-
namespace octave
{
PushButtonControl *
- PushButtonControl::create (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ PushButtonControl::create (octave::interpreter& interp,
const graphics_object& go)
{
Object *parent = parentObject (interp, go);
@@ -51,18 +48,17 @@
Container *container = parent->innerContainer ();
if (container)
- return new PushButtonControl (oct_qobj, interp, go,
+ return new PushButtonControl (interp, go,
new QPushButton (container));
}
return nullptr;
}
- PushButtonControl::PushButtonControl (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ PushButtonControl::PushButtonControl (octave::interpreter& interp,
const graphics_object& go,
QPushButton *btn)
- : ButtonControl (oct_qobj, interp, go, btn)
+ : ButtonControl (interp, go, btn)
{
uicontrol::properties& up = properties ();
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/PushButtonControl.h
--- a/libgui/graphics/PushButtonControl.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/PushButtonControl.h Tue Dec 06 15:17:16 2022 -0500
@@ -32,19 +32,17 @@
namespace octave
{
- class base_qobject;
class interpreter;
class PushButtonControl : public ButtonControl
{
public:
- PushButtonControl (octave::base_qobject& oct_qobj,
- octave::interpreter& interp, const graphics_object& go,
+ PushButtonControl (octave::interpreter& interp, const graphics_object& go,
QPushButton *btn);
~PushButtonControl (void);
static PushButtonControl *
- create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ create (octave::interpreter& interp,
const graphics_object& go);
protected:
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/PushTool.cc
--- a/libgui/graphics/PushTool.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/PushTool.cc Tue Dec 06 15:17:16 2022 -0500
@@ -31,14 +31,11 @@
#include "ToolBarButton.cc"
-#include "octave-qobject.h"
-
namespace octave
{
PushTool *
- PushTool::create (octave::base_qobject& oct_qobj,
- octave::interpreter& interp, const graphics_object& go)
+ PushTool::create (octave::interpreter& interp, const graphics_object& go)
{
Object *parent = parentObject (interp, go);
@@ -47,17 +44,16 @@
QWidget *parentWidget = parent->qWidget ();
if (parentWidget)
- return new PushTool (oct_qobj, interp, go,
+ return new PushTool (interp, go,
new QAction (parentWidget));
}
return nullptr;
}
- PushTool::PushTool (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ PushTool::PushTool (octave::interpreter& interp,
const graphics_object& go, QAction *action)
- : ToolBarButton (oct_qobj, interp, go, action)
+ : ToolBarButton (interp, go, action)
{
connect (action, &QAction::triggered, this, &PushTool::clicked);
}
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/PushTool.h
--- a/libgui/graphics/PushTool.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/PushTool.h Tue Dec 06 15:17:16 2022 -0500
@@ -30,7 +30,6 @@
namespace octave
{
- class base_qobject;
class interpreter;
class PushTool : public ToolBarButton
@@ -38,12 +37,12 @@
Q_OBJECT
public:
- PushTool (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ PushTool (octave::interpreter& interp,
const graphics_object& go, QAction *action);
~PushTool (void);
static PushTool *
- create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ create (octave::interpreter& interp,
const graphics_object& go);
protected:
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/RadioButtonControl.cc
--- a/libgui/graphics/RadioButtonControl.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/RadioButtonControl.cc Tue Dec 06 15:17:16 2022 -0500
@@ -34,14 +34,11 @@
#include "Container.h"
#include "QtHandlesUtils.h"
-#include "octave-qobject.h"
-
namespace octave
{
RadioButtonControl *
- RadioButtonControl::create (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ RadioButtonControl::create (octave::interpreter& interp,
const graphics_object& go)
{
Object *parent = parentObject (interp, go);
@@ -51,18 +48,17 @@
Container *container = parent->innerContainer ();
if (container)
- return new RadioButtonControl (oct_qobj, interp, go,
+ return new RadioButtonControl (interp, go,
new QRadioButton (container));
}
return nullptr;
}
- RadioButtonControl::RadioButtonControl (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ RadioButtonControl::RadioButtonControl (octave::interpreter& interp,
const graphics_object& go,
QRadioButton *radio)
- : ButtonControl (oct_qobj, interp, go, radio)
+ : ButtonControl (interp, go, radio)
{
Object *parent = parentObject (interp, go);
ButtonGroup *btnGroup = dynamic_cast(parent);
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/RadioButtonControl.h
--- a/libgui/graphics/RadioButtonControl.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/RadioButtonControl.h Tue Dec 06 15:17:16 2022 -0500
@@ -32,19 +32,16 @@
namespace octave
{
- class base_qobject;
class interpreter;
class RadioButtonControl : public ButtonControl
{
public:
- RadioButtonControl (octave::base_qobject& oct_qobj,
- octave::interpreter& interp, const graphics_object& go,
+ RadioButtonControl (octave::interpreter& interp, const graphics_object& go,
QRadioButton *box);
~RadioButtonControl (void);
- static RadioButtonControl * create (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ static RadioButtonControl * create (octave::interpreter& interp,
const graphics_object& go);
protected:
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/SliderControl.cc
--- a/libgui/graphics/SliderControl.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/SliderControl.cc Tue Dec 06 15:17:16 2022 -0500
@@ -33,8 +33,6 @@
#include "SliderControl.h"
#include "QtHandlesUtils.h"
-#include "octave-qobject.h"
-
#include "graphics.h"
#include "interpreter.h"
@@ -44,8 +42,7 @@
{
SliderControl *
- SliderControl::create (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ SliderControl::create (octave::interpreter& interp,
const graphics_object& go)
{
Object *parent = parentObject (interp, go);
@@ -55,18 +52,17 @@
Container *container = parent->innerContainer ();
if (container)
- return new SliderControl (oct_qobj, interp, go,
+ return new SliderControl (interp, go,
new QScrollBar (container));
}
return nullptr;
}
- SliderControl::SliderControl (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ SliderControl::SliderControl (octave::interpreter& interp,
const graphics_object& go,
QAbstractSlider *slider)
- : BaseControl (oct_qobj, interp, go, slider), m_blockUpdates (false)
+ : BaseControl (interp, go, slider), m_blockUpdates (false)
{
uicontrol::properties& up = properties ();
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/SliderControl.h
--- a/libgui/graphics/SliderControl.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/SliderControl.h Tue Dec 06 15:17:16 2022 -0500
@@ -32,7 +32,6 @@
namespace octave
{
- class base_qobject;
class interpreter;
class SliderControl : public BaseControl
@@ -40,12 +39,12 @@
Q_OBJECT
public:
- SliderControl (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ SliderControl (octave::interpreter& interp,
const graphics_object& go, QAbstractSlider *slider);
~SliderControl (void);
static SliderControl *
- create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ create (octave::interpreter& interp,
const graphics_object& go);
protected:
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/Table.cc
--- a/libgui/graphics/Table.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/Table.cc Tue Dec 06 15:17:16 2022 -0500
@@ -48,8 +48,6 @@
#include "Table.h"
#include "QtHandlesUtils.h"
-#include "octave-qobject.h"
-
#include "graphics.h"
#include "interpreter.h"
#include "oct-map.h"
@@ -436,7 +434,7 @@
}
Table *
- Table::create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ Table::create (octave::interpreter& interp,
const graphics_object& go)
{
Object *parent = parentObject (interp, go);
@@ -446,15 +444,15 @@
Container *container = parent->innerContainer ();
if (container)
- return new Table (oct_qobj, interp, go, new QTableWidget (container));
+ return new Table (interp, go, new QTableWidget (container));
}
return 0;
}
- Table::Table (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ Table::Table (octave::interpreter& interp,
const graphics_object& go, QTableWidget *tableWidget)
- : Object (oct_qobj, interp, go, tableWidget), m_tableWidget (tableWidget),
+ : Object (interp, go, tableWidget), m_tableWidget (tableWidget),
m_curData (), m_blockUpdates (false)
{
qObject ()->setObjectName ("UItable");
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/Table.h
--- a/libgui/graphics/Table.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/Table.h Tue Dec 06 15:17:16 2022 -0500
@@ -34,7 +34,6 @@
namespace octave
{
- class base_qobject;
class interpreter;
class Container;
@@ -44,7 +43,7 @@
Q_OBJECT
public:
- Table (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ Table (octave::interpreter& interp,
const graphics_object& go, QTableWidget *tableWidget);
~Table (void);
@@ -53,7 +52,7 @@
bool eventFilter (QObject *watched, QEvent *event);
static Table *
- create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ create (octave::interpreter& interp,
const graphics_object& go);
protected:
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/TextControl.cc
--- a/libgui/graphics/TextControl.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/TextControl.cc Tue Dec 06 15:17:16 2022 -0500
@@ -33,14 +33,11 @@
#include "TextControl.h"
#include "QtHandlesUtils.h"
-#include "octave-qobject.h"
-
namespace octave
{
TextControl *
- TextControl::create (octave::base_qobject& oct_qobj,
- octave::interpreter& interp, const graphics_object& go)
+ TextControl::create (octave::interpreter& interp, const graphics_object& go)
{
Object *parent = parentObject (interp, go);
@@ -49,16 +46,15 @@
Container *container = parent->innerContainer ();
if (container)
- return new TextControl (oct_qobj, interp, go, new QLabel (container));
+ return new TextControl (interp, go, new QLabel (container));
}
return nullptr;
}
- TextControl::TextControl (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ TextControl::TextControl (octave::interpreter& interp,
const graphics_object& go, QLabel *label)
- : BaseControl (oct_qobj, interp, go, label)
+ : BaseControl (interp, go, label)
{
uicontrol::properties& up = properties ();
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/TextControl.h
--- a/libgui/graphics/TextControl.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/TextControl.h Tue Dec 06 15:17:16 2022 -0500
@@ -32,18 +32,17 @@
namespace octave
{
- class base_qobject;
class interpreter;
class TextControl : public BaseControl
{
public:
- TextControl (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ TextControl (octave::interpreter& interp,
const graphics_object& go, QLabel *label);
~TextControl (void);
static TextControl *
- create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ create (octave::interpreter& interp,
const graphics_object& go);
protected:
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/ToggleButtonControl.cc
--- a/libgui/graphics/ToggleButtonControl.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/ToggleButtonControl.cc Tue Dec 06 15:17:16 2022 -0500
@@ -34,14 +34,11 @@
#include "Container.h"
#include "QtHandlesUtils.h"
-#include "octave-qobject.h"
-
namespace octave
{
ToggleButtonControl *
- ToggleButtonControl::create (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ ToggleButtonControl::create (octave::interpreter& interp,
const graphics_object& go)
{
Object *parent = parentObject (interp, go);
@@ -51,18 +48,17 @@
Container *container = parent->innerContainer ();
if (container)
- return new ToggleButtonControl (oct_qobj, interp, go,
+ return new ToggleButtonControl (interp, go,
new QPushButton (container));
}
return nullptr;
}
- ToggleButtonControl::ToggleButtonControl (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ ToggleButtonControl::ToggleButtonControl (octave::interpreter& interp,
const graphics_object& go,
QPushButton *btn)
- : ButtonControl (oct_qobj, interp, go, btn)
+ : ButtonControl (interp, go, btn)
{
Object *parent = parentObject (interp, go);
ButtonGroup *btnGroup = dynamic_cast(parent);
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/ToggleButtonControl.h
--- a/libgui/graphics/ToggleButtonControl.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/ToggleButtonControl.h Tue Dec 06 15:17:16 2022 -0500
@@ -32,19 +32,17 @@
namespace octave
{
- class base_qobject;
class interpreter;
class ToggleButtonControl : public ButtonControl
{
public:
- ToggleButtonControl (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ ToggleButtonControl (octave::interpreter& interp,
const graphics_object& go, QPushButton *box);
~ToggleButtonControl (void);
static ToggleButtonControl *
- create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ create (octave::interpreter& interp,
const graphics_object& go);
protected:
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/ToggleTool.cc
--- a/libgui/graphics/ToggleTool.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/ToggleTool.cc Tue Dec 06 15:17:16 2022 -0500
@@ -31,14 +31,11 @@
#include "ToolBarButton.cc"
-#include "octave-qobject.h"
-
namespace octave
{
ToggleTool *
- ToggleTool::create (octave::base_qobject& oct_qobj,
- octave::interpreter& interp, const graphics_object& go)
+ ToggleTool::create (octave::interpreter& interp, const graphics_object& go)
{
Object *parent = parentObject (interp, go);
@@ -47,17 +44,16 @@
QWidget *parentWidget = parent->qWidget ();
if (parentWidget)
- return new ToggleTool (oct_qobj, interp, go,
+ return new ToggleTool (interp, go,
new QAction (parentWidget));
}
return nullptr;
}
- ToggleTool::ToggleTool (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ ToggleTool::ToggleTool (octave::interpreter& interp,
const graphics_object& go, QAction *action)
- : ToolBarButton (oct_qobj, interp, go, action)
+ : ToolBarButton (interp, go, action)
{
uitoggletool::properties& tp = properties ();
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/ToggleTool.h
--- a/libgui/graphics/ToggleTool.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/ToggleTool.h Tue Dec 06 15:17:16 2022 -0500
@@ -30,7 +30,6 @@
namespace octave
{
- class base_qobject;
class interpreter;
class ToggleTool : public ToolBarButton
@@ -38,13 +37,13 @@
Q_OBJECT
public:
- ToggleTool (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ ToggleTool (octave::interpreter& interp,
const graphics_object& go,
QAction *action);
~ToggleTool (void);
static ToggleTool *
- create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ create (octave::interpreter& interp,
const graphics_object& go);
protected:
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/ToolBar.cc
--- a/libgui/graphics/ToolBar.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/ToolBar.cc Tue Dec 06 15:17:16 2022 -0500
@@ -42,7 +42,6 @@
#include "QtHandlesUtils.h"
#include "gui-preferences-global.h"
-#include "octave-qobject.h"
namespace octave
{
@@ -69,7 +68,7 @@
}
ToolBar *
- ToolBar::create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ ToolBar::create (octave::interpreter& interp,
const graphics_object& go)
{
Object *parent = parentObject (interp, go);
@@ -79,16 +78,16 @@
QWidget *parentWidget = parent->qWidget ();
if (parentWidget)
- return new ToolBar (oct_qobj, interp, go,
+ return new ToolBar (interp, go,
new QToolBar (parentWidget));
}
return nullptr;
}
- ToolBar::ToolBar (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ ToolBar::ToolBar (octave::interpreter& interp,
const graphics_object& go, QToolBar *bar)
- : Object (oct_qobj, interp, go, bar), m_empty (nullptr), m_figure (nullptr)
+ : Object (interp, go, bar), m_empty (nullptr), m_figure (nullptr)
{
uitoolbar::properties& tp = properties ();
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/ToolBar.h
--- a/libgui/graphics/ToolBar.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/ToolBar.h Tue Dec 06 15:17:16 2022 -0500
@@ -33,7 +33,6 @@
namespace octave
{
- class base_qobject;
class interpreter;
class Figure;
@@ -43,12 +42,12 @@
Q_OBJECT
public:
- ToolBar (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ ToolBar (octave::interpreter& interp,
const graphics_object& go, QToolBar *bar);
~ToolBar (void);
static ToolBar *
- create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ create (octave::interpreter& interp,
const graphics_object& go);
Container * innerContainer (void) { return nullptr; }
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/ToolBarButton.cc
--- a/libgui/graphics/ToolBarButton.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/ToolBarButton.cc Tue Dec 06 15:17:16 2022 -0500
@@ -34,16 +34,14 @@
#include "ToolBarButton.h"
#include "QtHandlesUtils.h"
-#include "octave-qobject.h"
#include "gui-preferences-global.h"
namespace octave
{
template
- ToolBarButton::ToolBarButton (octave::base_qobject& oct_qobj,
- octave::interpreter& interp,
+ ToolBarButton::ToolBarButton (octave::interpreter& interp,
const graphics_object& go, QAction *action)
- : Object (oct_qobj, interp, go, action), m_separator (nullptr)
+ : Object (interp, go, action), m_separator (nullptr)
{
typename T::properties& tp = properties ();
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/ToolBarButton.h
--- a/libgui/graphics/ToolBarButton.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/ToolBarButton.h Tue Dec 06 15:17:16 2022 -0500
@@ -33,7 +33,6 @@
namespace octave
{
- class base_qobject;
class interpreter;
class Container;
@@ -42,7 +41,7 @@
class ToolBarButton : public Object
{
public:
- ToolBarButton (octave::base_qobject& oct_qobj, octave::interpreter& interp,
+ ToolBarButton (octave::interpreter& interp,
const graphics_object& go, QAction *action);
~ToolBarButton (void);
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/annotation-dialog.cc
--- a/libgui/graphics/annotation-dialog.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/annotation-dialog.cc Tue Dec 06 15:17:16 2022 -0500
@@ -33,17 +33,14 @@
#include "gui-settings.h"
#include "gui-preferences-gp.h"
-#include "octave-qobject.h"
+#include "gui-settings.h"
#include "QtHandlesUtils.h"
#include "annotation-dialog.h"
#include "ui-annotation-dialog.h"
-using namespace octave;
-
-annotation_dialog::annotation_dialog (octave::base_qobject& oct_qobj,
- QWidget *p, const octave_value_list& pr):
- QDialog (p), m_octave_qobj (oct_qobj), ui (new Ui::annotation_dialog)
+annotation_dialog::annotation_dialog (QWidget *p, const octave_value_list& pr):
+ QDialog (p), ui (new Ui::annotation_dialog)
{
props = pr;
@@ -55,13 +52,11 @@
{
ui->setupUi (this);
- octave::resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
-
- octave::gui_settings *settings = rmgr.get_settings ();
+ octave::gui_settings settings;
// restore last geometry
- if (settings && settings->contains (gp_annotation_geometry.key))
- restoreGeometry (settings->value (gp_annotation_geometry).toByteArray ());
+ if (settings.contains (gp_annotation_geometry.key))
+ restoreGeometry (settings.value (gp_annotation_geometry).toByteArray ());
// connect signals
connect (ui->button_box, &QDialogButtonBox::clicked,
@@ -101,13 +96,10 @@
QDialogButtonBox::ButtonRole button_role
= ui->button_box->buttonRole (button);
- octave::resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
-
- octave::gui_settings *settings = rmgr.get_settings ();
+ octave::gui_settings settings;
// save position
- if (settings)
- settings->setValue (gp_annotation_geometry.key, saveGeometry ());
+ settings.setValue (gp_annotation_geometry.key, saveGeometry ());
if (button_role == QDialogButtonBox::ApplyRole
|| button_role == QDialogButtonBox::AcceptRole)
@@ -164,7 +156,7 @@
ui->cb_font_bold->isChecked () ? "bold" : "normal"));
props.append (ovl ("fontangle",
ui->cb_font_italic->isChecked () ? "italic" : "normal"));
- props.append (ovl ("color", Utils::toRgb (ui->btn_color->palette ().
+ props.append (ovl ("color", octave::Utils::toRgb (ui->btn_color->palette ().
color (QPalette::Button))));
// FIXME: only "none" linestyle is selectable, change the code bellow
@@ -249,7 +241,7 @@
{
QColor color;
if (props(1*i +1).is_matrix_type ())
- color = Utils::fromRgb (props(2*i +1).matrix_value ());
+ color = octave::Utils::fromRgb (props(2*i +1).matrix_value ());
else
color.setNamedColor (props(2*i +1).string_value ().c_str ());
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/annotation-dialog.h
--- a/libgui/graphics/annotation-dialog.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/annotation-dialog.h Tue Dec 06 15:17:16 2022 -0500
@@ -32,11 +32,6 @@
#include "ovl.h"
-namespace octave
-{
- class base_qobject;
-}
-
namespace Ui
{
class annotation_dialog;
@@ -46,8 +41,7 @@
{
Q_OBJECT
public:
- annotation_dialog (octave::base_qobject& oct_qobj, QWidget *parent,
- const octave_value_list& pr);
+ annotation_dialog (QWidget *parent, const octave_value_list& pr);
~annotation_dialog ();
octave_value_list get_properties () const;
@@ -64,7 +58,6 @@
void get_gui_props ();
void set_gui_props ();
- octave::base_qobject& m_octave_qobj;
Ui::annotation_dialog *ui;
octave_value_list props;
};
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/qt-graphics-toolkit.cc
--- a/libgui/graphics/qt-graphics-toolkit.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/qt-graphics-toolkit.cc Tue Dec 06 15:17:16 2022 -0500
@@ -57,8 +57,6 @@
#include "ToolBar.h"
#include "qt-graphics-toolkit.h"
-#include "octave-qobject.h"
-
#include "event-manager.h"
#include "graphics.h"
#include "interpreter.h"
@@ -98,10 +96,8 @@
return "";
}
- qt_graphics_toolkit::qt_graphics_toolkit (octave::interpreter& interp,
- octave::base_qobject& oct_qobj)
- : QObject (), base_graphics_toolkit ("qt"), m_interpreter (interp),
- m_octave_qobj (oct_qobj)
+ qt_graphics_toolkit::qt_graphics_toolkit (octave::interpreter& interp)
+ : QObject (), base_graphics_toolkit ("qt"), m_interpreter (interp)
{
// Implemented with a signal/slot connection in order to properly
// cross from the interpreter thread (where requests to create
@@ -412,47 +408,47 @@
Object *obj = nullptr;
if (go.isa ("figure"))
- obj = Figure::create (m_octave_qobj, m_interpreter, go);
+ obj = Figure::create (m_interpreter, go);
else if (go.isa ("uicontrol"))
{
uicontrol::properties& up =
Utils::properties (go);
if (up.style_is ("pushbutton"))
- obj = PushButtonControl::create (m_octave_qobj, m_interpreter, go);
+ obj = PushButtonControl::create (m_interpreter, go);
else if (up.style_is ("edit"))
- obj = EditControl::create (m_octave_qobj, m_interpreter, go);
+ obj = EditControl::create (m_interpreter, go);
else if (up.style_is ("checkbox"))
- obj = CheckBoxControl::create (m_octave_qobj, m_interpreter, go);
+ obj = CheckBoxControl::create (m_interpreter, go);
else if (up.style_is ("radiobutton"))
- obj = RadioButtonControl::create (m_octave_qobj, m_interpreter, go);
+ obj = RadioButtonControl::create (m_interpreter, go);
else if (up.style_is ("togglebutton"))
- obj = ToggleButtonControl::create (m_octave_qobj, m_interpreter, go);
+ obj = ToggleButtonControl::create (m_interpreter, go);
else if (up.style_is ("text"))
- obj = TextControl::create (m_octave_qobj, m_interpreter, go);
+ obj = TextControl::create (m_interpreter, go);
else if (up.style_is ("popupmenu"))
- obj = PopupMenuControl::create (m_octave_qobj, m_interpreter, go);
+ obj = PopupMenuControl::create (m_interpreter, go);
else if (up.style_is ("slider"))
- obj = SliderControl::create (m_octave_qobj, m_interpreter, go);
+ obj = SliderControl::create (m_interpreter, go);
else if (up.style_is ("listbox"))
- obj = ListBoxControl::create (m_octave_qobj, m_interpreter, go);
+ obj = ListBoxControl::create (m_interpreter, go);
}
else if (go.isa ("uibuttongroup"))
- obj = ButtonGroup::create (m_octave_qobj, m_interpreter, go);
+ obj = ButtonGroup::create (m_interpreter, go);
else if (go.isa ("uipanel"))
- obj = Panel::create (m_octave_qobj, m_interpreter, go);
+ obj = Panel::create (m_interpreter, go);
else if (go.isa ("uimenu"))
- obj = Menu::create (m_octave_qobj, m_interpreter, go);
+ obj = Menu::create (m_interpreter, go);
else if (go.isa ("uicontextmenu"))
- obj = ContextMenu::create (m_octave_qobj, m_interpreter, go);
+ obj = ContextMenu::create (m_interpreter, go);
else if (go.isa ("uitable"))
- obj = Table::create (m_octave_qobj, m_interpreter, go);
+ obj = Table::create (m_interpreter, go);
else if (go.isa ("uitoolbar"))
- obj = ToolBar::create (m_octave_qobj, m_interpreter, go);
+ obj = ToolBar::create (m_interpreter, go);
else if (go.isa ("uipushtool"))
- obj = PushTool::create (m_octave_qobj, m_interpreter, go);
+ obj = PushTool::create (m_interpreter, go);
else if (go.isa ("uitoggletool"))
- obj = ToggleTool::create (m_octave_qobj, m_interpreter, go);
+ obj = ToggleTool::create (m_interpreter, go);
else
qWarning ("qt_graphics_toolkit::create_object: unsupported type '%s'",
go.type ().c_str ());
diff -r 9089bd969b37 -r bd9da634f00d libgui/graphics/qt-graphics-toolkit.h
--- a/libgui/graphics/qt-graphics-toolkit.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/graphics/qt-graphics-toolkit.h Tue Dec 06 15:17:16 2022 -0500
@@ -34,7 +34,6 @@
namespace octave
{
class interpreter;
- class base_qobject;
class Object;
class ObjectProxy;
@@ -46,8 +45,7 @@
public:
- qt_graphics_toolkit (octave::interpreter& interp,
- octave::base_qobject& oct_qobj);
+ qt_graphics_toolkit (octave::interpreter& interp);
~qt_graphics_toolkit (void) = default;
@@ -119,8 +117,6 @@
private:
octave::interpreter& m_interpreter;
-
- octave::base_qobject& m_octave_qobj;
};
}
diff -r 9089bd969b37 -r bd9da634f00d libgui/qterminal/libqterminal/QTerminal.cc
--- a/libgui/qterminal/libqterminal/QTerminal.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/qterminal/libqterminal/QTerminal.cc Tue Dec 06 15:17:16 2022 -0500
@@ -38,6 +38,7 @@
#include "gui-preferences-global.h"
#include "gui-preferences-cs.h"
#include "gui-preferences-sc.h"
+#include "gui-settings.h"
#include "octave-qobject.h"
#include "resource-manager.h"
@@ -199,32 +200,31 @@
}
void
-QTerminal::notice_settings (const gui_settings *settings)
+QTerminal::notice_settings (void)
{
- if (! settings)
- return;
+ octave::gui_settings settings;
// Set terminal font:
QFont term_font = QFont ();
term_font.setStyleHint (QFont::TypeWriter);
- QString default_font = settings->value (global_mono_font).toString ();
+ QString default_font = settings.value (global_mono_font).toString ();
term_font.setFamily
- (settings->value (cs_font.key, default_font).toString ());
+ (settings.value (cs_font.key, default_font).toString ());
term_font.setPointSize
- (settings->value (cs_font_size).toInt ());
+ (settings.value (cs_font_size).toInt ());
setTerminalFont (term_font);
QFontMetrics metrics (term_font);
setMinimumSize (metrics.maxWidth ()*16, metrics.height ()*3);
QString cursor_type
- = settings->value (cs_cursor).toString ();
+ = settings.value (cs_cursor).toString ();
bool cursor_blinking;
- if (settings->contains (global_cursor_blinking.key))
- cursor_blinking = settings->value (global_cursor_blinking).toBool ();
+ if (settings.contains (global_cursor_blinking.key))
+ cursor_blinking = settings.value (global_cursor_blinking).toBool ();
else
- cursor_blinking = settings->value (cs_cursor_blinking).toBool ();
+ cursor_blinking = settings.value (cs_cursor_blinking).toBool ();
for (int ct = IBeamCursor; ct <= UnderlineCursor; ct++)
{
@@ -236,47 +236,47 @@
}
bool cursorUseForegroundColor
- = settings->value (cs_cursor_use_fgcol).toBool ();
+ = settings.value (cs_cursor_use_fgcol).toBool ();
- int mode = settings->value (cs_color_mode).toInt ();
+ int mode = settings.value (cs_color_mode).toInt ();
- setForegroundColor (settings->color_value (cs_colors[0], mode));
+ setForegroundColor (settings.color_value (cs_colors[0], mode));
- setBackgroundColor (settings->color_value (cs_colors[1], mode));
+ setBackgroundColor (settings.color_value (cs_colors[1], mode));
- setSelectionColor (settings->color_value (cs_colors[2], mode));
+ setSelectionColor (settings.color_value (cs_colors[2], mode));
setCursorColor (cursorUseForegroundColor,
- settings->color_value (cs_colors[3], mode));
+ settings.color_value (cs_colors[3], mode));
- setScrollBufferSize (settings->value (cs_hist_buffer).toInt ());
+ setScrollBufferSize (settings.value (cs_hist_buffer).toInt ());
// If the Copy shortcut is Ctrl+C, then the Copy action also emits
// a signal for interrupting the current code executed by the worker.
// If the Copy shortcut is not Ctrl+C, an extra interrupt action is
// set up for emitting the interrupt signal.
- QString sc = settings->sc_value (sc_main_edit_copy);
+ QString sc = settings.sc_value (sc_main_edit_copy);
// Dis- or enable extra interrupt action: We need an extra option when
// copy shortcut is not Ctrl-C or when global shortcuts (like copy) are
// disabled.
bool extra_ir_action
= (sc != QKeySequence (Qt::ControlModifier | Qt::Key_C).toString ())
- || settings->value (sc_prevent_rl_conflicts).toBool ();
+ || settings.value (sc_prevent_rl_conflicts).toBool ();
_interrupt_action->setEnabled (extra_ir_action);
has_extra_interrupt (extra_ir_action);
// check whether shortcut Ctrl-D is in use by the main-window
- bool ctrld = settings->value (sc_main_ctrld).toBool ();
+ bool ctrld = settings.value (sc_main_ctrld).toBool ();
_nop_action->setEnabled (! ctrld);
}
void
QTerminal::construct (octave::base_qobject& oct_qobj)
{
- octave::resource_manager& rmgr = oct_qobj.get_resource_manager ();
+ octave::gui_settings settings;
// context menu
setContextMenuPolicy (Qt::CustomContextMenu);
@@ -284,11 +284,11 @@
_contextMenu = new QMenu (this);
_copy_action
- = _contextMenu->addAction (rmgr.icon ("edit-copy"), tr ("Copy"), this,
+ = _contextMenu->addAction (settings.icon ("edit-copy"), tr ("Copy"), this,
SLOT (copyClipboard ()));
_paste_action
- = _contextMenu->addAction (rmgr.icon ("edit-paste"), tr ("Paste"), this,
+ = _contextMenu->addAction (settings.icon ("edit-paste"), tr ("Paste"), this,
SLOT (pasteClipboard ()));
_contextMenu->addSeparator ();
diff -r 9089bd969b37 -r bd9da634f00d libgui/qterminal/libqterminal/QTerminal.h
--- a/libgui/qterminal/libqterminal/QTerminal.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/qterminal/libqterminal/QTerminal.h Tue Dec 06 15:17:16 2022 -0500
@@ -30,13 +30,6 @@
#include
#include
-// For now, we need to use the following #include and using statement
-// for the signal/slot macros. Could maybe change later when using
-// Qt5-style signal/slot connections.
-#include "gui-settings.h"
-
-using octave::gui_settings;
-
namespace octave
{
class base_qobject;
@@ -126,7 +119,7 @@
virtual void handleCustomContextMenuRequested (const QPoint& at);
- void notice_settings (const gui_settings *settings);
+ void notice_settings (void);
virtual void init_terminal_size (void) { }
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/command-widget.cc
--- a/libgui/src/command-widget.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/command-widget.cc Tue Dec 06 15:17:16 2022 -0500
@@ -44,6 +44,7 @@
#include "event-manager.h"
#include "gui-preferences-cs.h"
#include "gui-preferences-global.h"
+#include "gui-settings.h"
#include "gui-utils.h"
#include "input.h"
#include "interpreter.h"
@@ -144,23 +145,25 @@
}
- void command_widget::notice_settings (const gui_settings *settings)
+ void command_widget::notice_settings (void)
{
+ gui_settings settings;
+
// Set terminal font:
QFont term_font = QFont ();
term_font.setStyleHint (QFont::TypeWriter);
- QString default_font = settings->value (global_mono_font).toString ();
+ QString default_font = settings.value (global_mono_font).toString ();
term_font.setFamily
- (settings->value (cs_font.key, default_font).toString ());
+ (settings.value (cs_font.key, default_font).toString ());
term_font.setPointSize
- (settings->value (cs_font_size).toInt ());
+ (settings.value (cs_font_size).toInt ());
m_console->setFont (term_font);
// Colors
- int mode = settings->value (cs_color_mode).toInt ();
- QColor fgc = settings->color_value (cs_colors[0], mode);
- QColor bgc = settings->color_value (cs_colors[1], mode);
+ int mode = settings.value (cs_color_mode).toInt ();
+ QColor fgc = settings.color_value (cs_colors[0], mode);
+ QColor bgc = settings.color_value (cs_colors[1], mode);
m_console->setStyleSheet (QString ("color: %1; background-color:%2;")
.arg (fgc.name ()).arg (bgc.name ()));
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/command-widget.h
--- a/libgui/src/command-widget.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/command-widget.h Tue Dec 06 15:17:16 2022 -0500
@@ -30,8 +30,11 @@
#include
-#include "octave-qobject.h"
-#include "gui-settings.h"
+// FIXME: We need the following header for the fcn_callback and
+// meth_callback typedefs. Maybe it would be better to declare those in
+// a separate file because inclding "event-manager.h" pulls in a lot of
+// other unnecessary declarations.
+#include "event-manager.h"
class QsciScintilla;
@@ -113,7 +116,7 @@
void insert_interpreter_output (const QString& msg);
- void notice_settings (const gui_settings *settings);
+ void notice_settings (void);
private:
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/community-news.cc
--- a/libgui/src/community-news.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/community-news.cc Tue Dec 06 15:17:16 2022 -0500
@@ -35,27 +35,25 @@
#include "gui-utils.h"
#include "gui-preferences-dw.h"
#include "gui-preferences-nr.h"
+#include "gui-settings.h"
#include "news-reader.h"
-#include "octave-qobject.h"
namespace octave
{
- community_news::community_news (base_qobject& oct_qobj, int serial)
+ community_news::community_news (int serial)
: QWidget (nullptr), m_browser (nullptr)
{
- construct (oct_qobj, "https://octave.org", "community-news.html", serial);
+ construct ("https://octave.org", "community-news.html", serial);
}
- community_news::community_news (base_qobject& oct_qobj, QWidget *parent,
- const QString& base_url, const QString& page,
- int serial)
+ community_news::community_news (QWidget *parent, const QString& base_url,
+ const QString& page, int serial)
: QWidget (parent), m_browser (nullptr)
{
- construct (oct_qobj, base_url, page, serial);
+ construct (base_url, page, serial);
}
- void community_news::construct (base_qobject& oct_qobj,
- const QString& base_url, const QString& page,
+ void community_news::construct (const QString& base_url, const QString& page,
int serial)
{
m_browser = new QTextBrowser (this);
@@ -76,11 +74,10 @@
resize (win_x/2, win_y/2);
move ((win_x - width ())/2, (win_y - height ())/2);
- resource_manager& rmgr = oct_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
QString icon;
- QString icon_set = settings->value (dw_icon_set).toString ();
+ QString icon_set = settings.value (dw_icon_set).toString ();
if (icon_set != "NONE")
// No extra icon for Community news, take the one of the release notes
icon = dw_icon_set_names[icon_set] + "ReleaseWidget.png";
@@ -92,15 +89,12 @@
// FIXME: This is a news reader preference, so shouldn't it be used
// in the news_reader object?
- bool connect_to_web
- = (settings
- ? settings->value (nr_allow_connection).toBool ()
- : true);
+ bool connect_to_web = settings.value (nr_allow_connection).toBool ();
QThread *worker_thread = new QThread;
- news_reader *reader = new news_reader (oct_qobj, base_url, page,
- serial, connect_to_web);
+ news_reader *reader
+ = new news_reader (base_url, page, serial, connect_to_web);
reader->moveToThread (worker_thread);
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/community-news.h
--- a/libgui/src/community-news.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/community-news.h Tue Dec 06 15:17:16 2022 -0500
@@ -33,17 +33,15 @@
namespace octave
{
- class base_qobject;
-
class community_news : public QWidget
{
Q_OBJECT
public:
- community_news (base_qobject& oct_qobj, int serial);
+ community_news (int serial);
- community_news (base_qobject& oct_qobj, QWidget *parent = nullptr,
+ community_news (QWidget *parent = nullptr,
const QString& base_url = "https://octave.org",
const QString& page = "community-news.html",
int serial = -1);
@@ -58,8 +56,7 @@
private:
- void construct (base_qobject& oct_qobj, const QString& base_url,
- const QString& page, int serial);
+ void construct (const QString& base_url, const QString& page, int serial);
QTextBrowser *m_browser;
};
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/dialog.cc
--- a/libgui/src/dialog.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/dialog.cc Tue Dec 06 15:17:16 2022 -0500
@@ -42,14 +42,14 @@
#include
#include "dialog.h"
-#include "octave-qobject.h"
#include "gui-preferences-global.h"
+#include "gui-settings.h"
namespace octave
{
- QUIWidgetCreator::QUIWidgetCreator (base_qobject& oct_qobj)
- : QObject (), m_octave_qobj (oct_qobj), m_dialog_result (-1),
- m_dialog_button (), m_string_list (), m_list_index (), m_path_name ()
+ QUIWidgetCreator::QUIWidgetCreator ()
+ : QObject (), m_dialog_result (-1), m_dialog_button (),
+ m_string_list (), m_list_index (), m_path_name ()
{
connect (this, &QUIWidgetCreator::create_dialog,
this, &QUIWidgetCreator::handle_create_dialog);
@@ -180,8 +180,7 @@
const QStringList& role)
{
MessageDialog *message_dialog
- = new MessageDialog (m_octave_qobj, message, title, icon,
- button, defbutton, role);
+ = new MessageDialog (message, title, icon, button, defbutton, role);
connect (message_dialog, &MessageDialog::buttonClicked,
this, &QUIWidgetCreator::dialog_button_clicked);
@@ -232,7 +231,7 @@
const QString& cancel_string)
{
ListDialog *list_dialog
- = new ListDialog (m_octave_qobj, list, mode, wd, ht, initial,
+ = new ListDialog (list, mode, wd, ht, initial,
name, prompt, ok_string, cancel_string);
connect (list_dialog, &ListDialog::finish_selection,
@@ -264,7 +263,7 @@
const QStringList& defaults)
{
InputDialog *input_dialog
- = new InputDialog (m_octave_qobj, prompt, title, nr, nc, defaults);
+ = new InputDialog (prompt, title, nr, nc, defaults);
connect (input_dialog, &InputDialog::finish_input,
this, &QUIWidgetCreator::input_finished);
@@ -292,8 +291,7 @@
const QString& multimode)
{
FileDialog *file_dialog
- = new FileDialog (m_octave_qobj, filters, title, filename,
- dirname, multimode);
+ = new FileDialog (filters, title, filename, dirname, multimode);
connect (file_dialog, &FileDialog::finish_input,
this, &QUIWidgetCreator::filedialog_finished);
@@ -316,7 +314,7 @@
wake_all ();
}
- MessageDialog::MessageDialog (base_qobject&, const QString& message,
+ MessageDialog::MessageDialog (const QString& message,
const QString& title, const QString& qsicon,
const QStringList& qsbutton,
const QString& defbutton,
@@ -388,7 +386,7 @@
}
}
- ListDialog::ListDialog (base_qobject&, const QStringList& list,
+ ListDialog::ListDialog (const QStringList& list,
const QString& mode, int wd, int ht,
const QList& initial, const QString& title,
const QStringList& prompt,
@@ -524,7 +522,7 @@
buttonOk_clicked ();
}
- InputDialog::InputDialog (base_qobject&, const QStringList& prompt,
+ InputDialog::InputDialog (const QStringList& prompt,
const QString& title, const QFloatList& nr,
const QFloatList& nc, const QStringList& defaults)
: QDialog ()
@@ -618,8 +616,7 @@
buttonCancel_clicked ();
}
- FileDialog::FileDialog (base_qobject& oct_qobj,
- const QStringList& name_filters,
+ FileDialog::FileDialog (const QStringList& name_filters,
const QString& title, const QString& filename,
const QString& dirname, const QString& multimode)
: QFileDialog ()
@@ -631,9 +628,10 @@
setDirectory (dirname);
// FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
- resource_manager& rmgr = oct_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- if (! settings->value (global_use_native_dialogs).toBool ())
+
+ gui_settings settings;
+
+ if (! settings.value (global_use_native_dialogs).toBool ())
setOption(QFileDialog::DontUseNativeDialog);
if (multimode == "on") // uigetfile multiselect=on
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/dialog.h
--- a/libgui/src/dialog.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/dialog.h Tue Dec 06 15:17:16 2022 -0500
@@ -44,15 +44,13 @@
namespace octave
{
- class base_qobject;
-
class QUIWidgetCreator : public QObject
{
Q_OBJECT
public:
- QUIWidgetCreator (base_qobject& oct_qobj);
+ QUIWidgetCreator (void);
~QUIWidgetCreator (void) = default;
@@ -148,8 +146,6 @@
private:
- base_qobject& m_octave_qobj;
-
int m_dialog_result;
QString m_dialog_button;
@@ -176,7 +172,7 @@
public:
- MessageDialog (base_qobject& oct_qobj, const QString& message,
+ MessageDialog (const QString& message,
const QString& title, const QString& icon,
const QStringList& button, const QString& defbutton,
const QStringList& role);
@@ -201,7 +197,7 @@
public:
- ListDialog (base_qobject& oct_qobj, const QStringList& list,
+ ListDialog (const QStringList& list,
const QString& mode, int width, int height,
const QList& initial, const QString& name,
const QStringList& prompt, const QString& ok_string,
@@ -236,7 +232,7 @@
public:
- InputDialog (base_qobject& oct_qobj, const QStringList& prompt,
+ InputDialog (const QStringList& prompt,
const QString& title, const QFloatList& nr,
const QFloatList& nc, const QStringList& defaults);
@@ -261,7 +257,7 @@
public:
- FileDialog (base_qobject& oct_qobj, const QStringList& filters,
+ FileDialog (const QStringList& filters,
const QString& title, const QString& filename,
const QString& dirname, const QString& multimode);
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/documentation-bookmarks.cc
--- a/libgui/src/documentation-bookmarks.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/documentation-bookmarks.cc Tue Dec 06 15:17:16 2022 -0500
@@ -28,7 +28,10 @@
#endif
#include
+#include
+#include
#include
+#include
#include
#include
#include
@@ -36,10 +39,10 @@
#include "documentation.h"
#include "documentation-bookmarks.h"
-#include "gui-settings.h"
#include "gui-preferences-global.h"
#include "gui-preferences-dc.h"
#include "gui-preferences-sc.h"
+#include "gui-settings.h"
#include "octave-qtutils.h"
#include "shortcut-manager.h"
@@ -49,17 +52,14 @@
namespace octave
{
- documentation_bookmarks::documentation_bookmarks (
- documentation *doc, documentation_browser *browser,
- base_qobject& oct_qobj, QWidget *p)
- : QWidget (p),
- m_doc (doc), m_browser (browser), m_octave_qobj (oct_qobj),
- m_ctx_menu_item (nullptr)
+ documentation_bookmarks::documentation_bookmarks (documentation *doc,
+ documentation_browser *browser,
+ QWidget *p)
+ : QWidget (p), m_doc (doc), m_browser (browser), m_ctx_menu_item (nullptr)
{
setObjectName ("documentation_tab_bookmarks");
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
// Setup the tree view with the bookmarks
m_tree = new QTreeWidget (p);
@@ -89,7 +89,7 @@
icon_bookmark.addPixmap (style ()->standardPixmap(QStyle::SP_FileIcon));
// Setup and read the bookmarkfile
- QFileInfo f (settings->fileName ());
+ QFileInfo f (settings.fileName ());
QString f_path = f.absolutePath ();
f.setFile (QDir (f_path), dc_bookmark_file);
m_xbel_file.setFileName (f.absoluteFilePath ());
@@ -121,7 +121,7 @@
m_filter->setSizePolicy (size_pol);
m_filter->completer ()->setCaseSensitivity (Qt::CaseSensitive);
- m_filter->addItems (settings->value (dc_bookmark_filter_mru).toStringList ());
+ m_filter->addItems (settings.value (dc_bookmark_filter_mru).toStringList ());
connect (m_filter, &QComboBox::editTextChanged,
this, &documentation_bookmarks::filter_bookmarks);
@@ -129,7 +129,7 @@
this, &documentation_bookmarks::update_filter_history);
m_filter_checkbox = new QCheckBox (m_filter_widget);
- bool filter_state = settings->value (dc_bookmark_filter_active).toBool ();
+ bool filter_state = settings.value (dc_bookmark_filter_active).toBool ();
m_filter_checkbox->setChecked (filter_state);
filter_activate (filter_state);
@@ -144,7 +144,7 @@
h_box_bm->setMargin (2);
m_filter_widget->setLayout (h_box_bm);
- m_filter_shown = settings->value (dc_bookmark_filter_shown).toBool ();
+ m_filter_shown = settings.value (dc_bookmark_filter_shown).toBool ();
m_filter_widget->setVisible (m_filter_shown);
// Resulting Layout of this widget
@@ -322,11 +322,11 @@
if (m_ctx_menu_item)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+ gui_settings settings;
menu.addAction (tr ("&Open"), this, &documentation_bookmarks::open);
menu.addAction (tr ("&Rename"), this, &documentation_bookmarks::edit);
- menu.addAction (rmgr.icon ("window-close"), tr ("Remo&ve"),
+ menu.addAction (settings.icon ("window-close"), tr ("Remo&ve"),
this, &documentation_bookmarks::remove);
menu.addSeparator ();
}
@@ -380,21 +380,23 @@
m_filter_widget->setVisible (m_filter_shown);
}
- void documentation_bookmarks::save_settings (gui_settings *settings)
+ void documentation_bookmarks::save_settings (void)
{
// Write the bookmarks to the xbel-file
write_bookmarks ();
// Store settings
- settings->setValue (dc_bookmark_filter_active.key, m_filter_checkbox->isChecked ());
- settings->setValue (dc_bookmark_filter_shown.key, m_filter_shown);
+ gui_settings settings;
+
+ settings.setValue (dc_bookmark_filter_active.key, m_filter_checkbox->isChecked ());
+ settings.setValue (dc_bookmark_filter_shown.key, m_filter_shown);
QStringList mru;
for (int i = 0; i < m_filter->count (); i++)
mru.append (m_filter->itemText (i));
- settings->setValue (dc_bookmark_filter_mru.key, mru);
+ settings.setValue (dc_bookmark_filter_mru.key, mru);
- settings->sync ();
+ settings.sync ();
}
void documentation_bookmarks::write_bookmarks (void)
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/documentation-bookmarks.h
--- a/libgui/src/documentation-bookmarks.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/documentation-bookmarks.h Tue Dec 06 15:17:16 2022 -0500
@@ -28,16 +28,14 @@
#include
#include
+#include
#include
#include
#include "documentation.h"
-#include "octave-qobject.h"
-
namespace octave
{
- class base_qobject;
class documentation;
class documentation_bookmarks : public QWidget
@@ -46,9 +44,9 @@
public:
- documentation_bookmarks (
- documentation *doc, documentation_browser *browser,
- base_qobject& oct_qobj, QWidget *p = nullptr);
+ documentation_bookmarks (documentation *doc,
+ documentation_browser *browser,
+ QWidget *p = nullptr);
~documentation_bookmarks (void) = default;
@@ -56,7 +54,7 @@
void add_bookmark (void);
void add_folder (bool);
- void save_settings (gui_settings *settings);
+ void save_settings (void);
private slots:
@@ -103,7 +101,6 @@
documentation *m_doc;
documentation_browser *m_browser;
- base_qobject& m_octave_qobj;
QComboBox *m_filter;
QTreeWidget *m_tree;
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/documentation-dock-widget.cc
--- a/libgui/src/documentation-dock-widget.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/documentation-dock-widget.cc Tue Dec 06 15:17:16 2022 -0500
@@ -47,9 +47,9 @@
make_window ();
}
- void documentation_dock_widget::notice_settings (const gui_settings *settings)
+ void documentation_dock_widget::notice_settings (void)
{
- m_docs->notice_settings (settings);
+ m_docs->notice_settings ();
}
void documentation_dock_widget::save_settings (void)
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/documentation-dock-widget.h
--- a/libgui/src/documentation-dock-widget.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/documentation-dock-widget.h Tue Dec 06 15:17:16 2022 -0500
@@ -45,7 +45,7 @@
public slots:
- void notice_settings (const gui_settings *settings);
+ void notice_settings (void);
void save_settings (void);
void copyClipboard (void);
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/documentation.cc
--- a/libgui/src/documentation.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/documentation.cc Tue Dec 06 15:17:16 2022 -0500
@@ -56,6 +56,7 @@
#include "gui-preferences-global.h"
#include "gui-preferences-dc.h"
#include "gui-preferences-sc.h"
+#include "gui-settings.h"
#include "octave-qobject.h"
#include "shortcut-manager.h"
@@ -156,14 +157,16 @@
QToolButton *forward_button = new QToolButton (find_footer);
forward_button->setText (tr ("Search forward"));
forward_button->setToolTip (tr ("Search forward"));
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- forward_button->setIcon (rmgr.icon ("go-down"));
+
+ gui_settings settings;
+
+ forward_button->setIcon (settings.icon ("go-down"));
connect (forward_button, &QToolButton::pressed,
this, [=] () { find (); });
QToolButton *backward_button = new QToolButton (find_footer);
backward_button->setText (tr ("Search backward"));
backward_button->setToolTip (tr ("Search backward"));
- backward_button->setIcon (rmgr.icon ("go-up"));
+ backward_button->setIcon (settings.icon ("go-up"));
connect (backward_button, &QToolButton::pressed,
this, &documentation::find_backward);
QHBoxLayout *h_box_find_footer = new QHBoxLayout (find_footer);
@@ -180,7 +183,7 @@
v_box_browser_find->addWidget (find_footer);
browser_find->setLayout (v_box_browser_find);
- notice_settings (rmgr.get_settings ());
+ notice_settings ();
m_findnext_shortcut->setContext (Qt::WidgetWithChildrenShortcut);
connect (m_findnext_shortcut, &QShortcut::activated,
@@ -262,8 +265,7 @@
this, &documentation::filter_update_history);
// Bookmarks (own class)
- m_bookmarks
- = new documentation_bookmarks (this, m_doc_browser, m_octave_qobj, navi);
+ m_bookmarks = new documentation_bookmarks (this, m_doc_browser, navi);
navi->addTab (m_bookmarks, tr ("Bookmarks"));
connect (m_action_bookmark, &QAction::triggered,
@@ -348,13 +350,14 @@
void documentation::construct_tool_bar (void)
{
// Home, Previous, Next
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+ gui_settings settings;
+
m_action_go_home
- = add_action (rmgr.icon ("go-home"), tr ("Go home"), SLOT (home (void)),
+ = add_action (settings.icon ("go-home"), tr ("Go home"), SLOT (home (void)),
m_doc_browser, m_tool_bar);
m_action_go_prev
- = add_action (rmgr.icon ("go-previous"), tr ("Go back"),
+ = add_action (settings.icon ("go-previous"), tr ("Go back"),
SLOT (backward (void)), m_doc_browser, m_tool_bar);
m_action_go_prev->setEnabled (false);
@@ -369,7 +372,7 @@
m_tool_bar->addWidget (popdown_button_prev_pages);
m_action_go_next
- = add_action (rmgr.icon ("go-next"), tr ("Go forward"),
+ = add_action (settings.icon ("go-next"), tr ("Go forward"),
SLOT (forward (void)), m_doc_browser, m_tool_bar);
m_action_go_next->setEnabled (false);
@@ -412,26 +415,26 @@
// Find
m_tool_bar->addSeparator ();
m_action_find
- = add_action (rmgr.icon ("edit-find"), tr ("Find"),
+ = add_action (settings.icon ("edit-find"), tr ("Find"),
SLOT (activate_find (void)), this, m_tool_bar);
// Zoom
m_tool_bar->addSeparator ();
m_action_zoom_in
- = add_action (rmgr.icon ("view-zoom-in"), tr ("Zoom in"),
+ = add_action (settings.icon ("view-zoom-in"), tr ("Zoom in"),
SLOT (zoom_in (void)), m_doc_browser, m_tool_bar);
m_action_zoom_out
- = add_action (rmgr.icon ("view-zoom-out"), tr ("Zoom out"),
+ = add_action (settings.icon ("view-zoom-out"), tr ("Zoom out"),
SLOT (zoom_out (void)), m_doc_browser, m_tool_bar);
m_action_zoom_original
- = add_action (rmgr.icon ("view-zoom-original"), tr ("Zoom original"),
+ = add_action (settings.icon ("view-zoom-original"), tr ("Zoom original"),
SLOT (zoom_original (void)), m_doc_browser, m_tool_bar);
// Bookmarks (connect slots later)
m_tool_bar->addSeparator ();
m_action_bookmark
- = add_action (rmgr.icon ("bookmark-new"), tr ("Bookmark current page"),
- nullptr, nullptr, m_tool_bar);
+ = add_action (settings.icon ("bookmark-new"),
+ tr ("Bookmark current page"), nullptr, nullptr, m_tool_bar);
}
void documentation::global_search (void)
@@ -603,15 +606,17 @@
m_doc_browser->moveCursor (QTextCursor::Start);
}
- void documentation::notice_settings (const gui_settings *settings)
+ void documentation::notice_settings (void)
{
+ gui_settings settings;
+
// If m_help_engine is not defined, the objects accessed by this method
// are not valid. Thus, just return in this case.
if (! m_help_engine)
return;
// Icon size in the toolbar.
- int size_idx = settings->value (global_icon_size).toInt ();
+ int size_idx = settings.value (global_icon_size).toInt ();
size_idx = (size_idx > 0) - (size_idx < 0) + 1; // Make valid index from 0 to 2
QStyle *st = style ();
@@ -633,16 +638,15 @@
scmgr.set_shortcut (m_action_bookmark, sc_doc_bookmark);
// Settings for the browser
- m_doc_browser->notice_settings (settings);
+ m_doc_browser->notice_settings ();
}
void documentation::save_settings (void)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
- m_doc_browser->save_settings (settings);
- m_bookmarks->save_settings (settings);
+ m_doc_browser->save_settings ();
+ m_bookmarks->save_settings ();
}
void documentation::copyClipboard (void)
@@ -1039,12 +1043,14 @@
QDesktopServices::openUrl (url);
}
- void documentation_browser::notice_settings (const gui_settings *settings)
+ void documentation_browser::notice_settings (void)
{
+ gui_settings settings;
+
// Zoom level only at startup, not when other settings have changed
if (m_zoom_level > max_zoom_level)
{
- m_zoom_level = settings->value (dc_browser_zoom_level).toInt ();
+ m_zoom_level = settings.value (dc_browser_zoom_level).toInt ();
zoomIn (m_zoom_level);
}
}
@@ -1057,11 +1063,13 @@
return QTextBrowser::loadResource(type, url);
}
- void documentation_browser::save_settings (gui_settings *settings)
+ void documentation_browser::save_settings (void)
{
- settings->setValue (dc_browser_zoom_level.key, m_zoom_level);
+ gui_settings settings;
- settings->sync ();
+ settings.setValue (dc_browser_zoom_level.key, m_zoom_level);
+
+ settings.sync ();
}
void documentation_browser::zoom_in (void)
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/documentation.h
--- a/libgui/src/documentation.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/documentation.h Tue Dec 06 15:17:16 2022 -0500
@@ -37,8 +37,6 @@
#include
#include
-#include "gui-settings.h"
-
namespace octave
{
class base_qobject;
@@ -62,8 +60,8 @@
void handle_index_clicked (const QUrl& url,
const QString& keyword = QString ());
- void notice_settings (const gui_settings *settings);
- void save_settings (gui_settings *settings);
+ void notice_settings (void);
+ void save_settings (void);
//! Zooming in and out while taking care of the zoom level
//!@{
@@ -122,7 +120,7 @@
public slots:
- void notice_settings (const gui_settings *settings);
+ void notice_settings (void);
void save_settings (void);
void copyClipboard (void);
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/dw-main-window.cc
--- a/libgui/src/dw-main-window.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/dw-main-window.cc Tue Dec 06 15:17:16 2022 -0500
@@ -36,9 +36,10 @@
#include
#include "dw-main-window.h"
+#include "gui-preferences-sc.h"
+#include "gui-settings.h"
#include "octave-qobject.h"
#include "shortcut-manager.h"
-#include "gui-preferences-sc.h"
namespace octave
{
@@ -46,19 +47,19 @@
dw_main_window::dw_main_window (base_qobject& oct_qobj, QWidget *p)
: QMainWindow (p), m_octave_qobj (oct_qobj)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+ gui_settings settings;
// Adding the actions for closing the dock widgets
m_close_action
- = add_action (nullptr, rmgr.icon ("window-close", false),
+ = add_action (nullptr, settings.icon ("window-close", false),
tr ("&Close"), SLOT (request_close ()), this);
m_close_all_action
- = add_action (nullptr, rmgr.icon ("window-close", false),
+ = add_action (nullptr, settings.icon ("window-close", false),
tr ("Close &All"), SLOT (request_close_all ()), this);
m_close_others_action
- = add_action (nullptr, rmgr.icon ("window-close", false),
+ = add_action (nullptr, settings.icon ("window-close", false),
tr ("Close &Other"), SLOT (request_close_other ()), this);
m_switch_left_action
@@ -76,7 +77,7 @@
m_actions_list << m_switch_left_action;
m_actions_list << m_switch_right_action;
- notice_settings (rmgr.get_settings ());
+ notice_settings ();
}
@@ -130,7 +131,7 @@
}
// Update the settings
- void dw_main_window::notice_settings (const gui_settings *)
+ void dw_main_window::notice_settings (void)
{
shortcut_manager& scmgr = m_octave_qobj.get_shortcut_manager ();
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/dw-main-window.h
--- a/libgui/src/dw-main-window.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/dw-main-window.h Tue Dec 06 15:17:16 2022 -0500
@@ -28,8 +28,6 @@
#include
-#include "gui-settings.h"
-
namespace octave
{
class base_qobject;
@@ -52,7 +50,7 @@
public slots:
- void notice_settings (const gui_settings *);
+ void notice_settings (void);
protected slots:
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/external-editor-interface.cc
--- a/libgui/src/external-editor-interface.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/external-editor-interface.cc Tue Dec 06 15:17:16 2022 -0500
@@ -33,13 +33,11 @@
#include "external-editor-interface.h"
#include "gui-settings.h"
#include "gui-preferences-global.h"
-#include "octave-qobject.h"
namespace octave
{
- external_editor_interface::external_editor_interface (QWidget *p,
- base_qobject& oct_qobj)
- : QWidget (p), m_octave_qobj (oct_qobj)
+ external_editor_interface::external_editor_interface (QWidget *p)
+ : QWidget (p)
{ }
// Calling the external editor
@@ -103,10 +101,10 @@
// Get and verify the settings of the external editor program
QString external_editor_interface::external_editor (void)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- QString editor = settings->value (global_custom_editor.key,
- global_custom_editor.def).toString ();
+ gui_settings settings;
+
+ QString editor = settings.value (global_custom_editor.key,
+ global_custom_editor.def).toString ();
// check the settings (avoid an empty string)
if (editor.trimmed ().isEmpty ())
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/external-editor-interface.h
--- a/libgui/src/external-editor-interface.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/external-editor-interface.h Tue Dec 06 15:17:16 2022 -0500
@@ -31,15 +31,13 @@
namespace octave
{
- class base_qobject;
-
class external_editor_interface : public QWidget
{
Q_OBJECT
public:
- external_editor_interface (QWidget *main_win, base_qobject& oct_qobj);
+ external_editor_interface (QWidget *main_win);
~external_editor_interface (void) = default;
@@ -64,8 +62,6 @@
private:
QString external_editor (void);
-
- base_qobject& m_octave_qobj;
};
}
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/files-dock-widget.cc
--- a/libgui/src/files-dock-widget.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/files-dock-widget.cc Tue Dec 06 15:17:16 2022 -0500
@@ -49,6 +49,7 @@
#include "files-dock-widget.h"
#include "gui-preferences-fb.h"
#include "gui-preferences-global.h"
+#include "gui-settings.h"
#include "octave-qobject.h"
#include "octave-qtutils.h"
#include "qt-interpreter-events.h"
@@ -226,20 +227,21 @@
QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred);
m_current_directory->setSizePolicy (sizePol);
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+ gui_settings settings;
QAction *directory_up_action
- = new QAction (rmgr.icon ("folder-up", false, "go-up"), "", m_navigation_tool_bar);
+ = new QAction (settings.icon ("folder-up", false, "go-up"), "",
+ m_navigation_tool_bar);
directory_up_action->setToolTip (tr ("One directory up"));
m_sync_browser_directory_action
- = new QAction (rmgr.icon ("go-first"), tr ("Show Octave directory"),
+ = new QAction (settings.icon ("go-first"), tr ("Show Octave directory"),
m_navigation_tool_bar);
m_sync_browser_directory_action->setToolTip (tr ("Go to current Octave directory"));
m_sync_browser_directory_action->setEnabled (false);
m_sync_octave_directory_action
- = new QAction (rmgr.icon ("go-last"), tr ("Set Octave directory"),
+ = new QAction (settings.icon ("go-last"), tr ("Set Octave directory"),
m_navigation_tool_bar);
m_sync_octave_directory_action->setToolTip (tr ("Set Octave directory to current browser directory"));
m_sync_octave_directory_action->setEnabled (false);
@@ -247,7 +249,7 @@
QToolButton *popdown_button = new QToolButton ();
popdown_button->setToolTip (tr ("Actions on current directory"));
QMenu *popdown_menu = new QMenu ();
- popdown_menu->addAction (rmgr.icon ("user-home"),
+ popdown_menu->addAction (settings.icon ("user-home"),
tr ("Show Home Directory"), this,
SLOT (popdownmenu_home (bool)));
popdown_menu->addAction (m_sync_browser_directory_action);
@@ -255,22 +257,23 @@
popdown_button->setMenu (popdown_menu);
popdown_button->setPopupMode (QToolButton::InstantPopup);
popdown_button->setDefaultAction (
- new QAction (rmgr.icon ("folder-settings", false, "applications-system"),
- "", m_navigation_tool_bar));
+ new QAction (settings.icon ("folder-settings", false,
+ "applications-system"),
+ "", m_navigation_tool_bar));
popdown_menu->addSeparator ();
- popdown_menu->addAction (rmgr.icon ("folder"),
+ popdown_menu->addAction (settings.icon ("folder"),
tr ("Set Browser Directory..."),
this, &files_dock_widget::popdownmenu_search_dir);
popdown_menu->addSeparator ();
- popdown_menu->addAction (rmgr.icon ("edit-find"),
+ popdown_menu->addAction (settings.icon ("edit-find"),
tr ("Find Files..."),
this, &files_dock_widget::popdownmenu_findfiles);
popdown_menu->addSeparator ();
- popdown_menu->addAction (rmgr.icon ("document-new"),
+ popdown_menu->addAction (settings.icon ("document-new"),
tr ("New File..."),
this, &files_dock_widget::popdownmenu_newfile);
- popdown_menu->addAction (rmgr.icon ("folder-new"),
+ popdown_menu->addAction (settings.icon ("folder-new"),
tr ("New Directory..."),
this, &files_dock_widget::popdownmenu_newdir);
@@ -285,24 +288,21 @@
connect (m_sync_browser_directory_action, &QAction::triggered,
this, &files_dock_widget::do_sync_browser_directory);
- gui_settings *settings = rmgr.get_settings ();
- // FIXME: what should happen if settings is 0?
-
// Create the QFileSystemModel starting in the desired directory
QDir startup_dir; // take current dir
- if (settings->value (fb_restore_last_dir).toBool ())
+ if (settings.value (fb_restore_last_dir).toBool ())
{
// restore last dir from previous session
QStringList last_dirs
- = settings->value (fb_mru_list.key).toStringList ();
+ = settings.value (fb_mru_list.key).toStringList ();
if (last_dirs.length () > 0)
startup_dir = QDir (last_dirs.at (0)); // last dir in previous session
}
- else if (! settings->value (fb_startup_dir).toString ().isEmpty ())
+ else if (! settings.value (fb_startup_dir).toString ().isEmpty ())
{
// do not restore but there is a startup dir configured
- startup_dir = QDir (settings->value (fb_startup_dir.key).toString ());
+ startup_dir = QDir (settings.value (fb_startup_dir.key).toString ());
}
if (! startup_dir.exists ())
@@ -349,14 +349,14 @@
// get sort column and order as well as column state (order and width)
m_file_tree_view->sortByColumn
- (settings->value (fb_sort_column).toInt (),
- static_cast (settings->value (fb_sort_order).toUInt ()));
+ (settings.value (fb_sort_column).toInt (),
+ static_cast (settings.value (fb_sort_order).toUInt ()));
// FIXME: use value instead of static cast after
// dropping support of Qt 5.4
- if (settings->contains (fb_column_state.key))
+ if (settings.contains (fb_column_state.key))
m_file_tree_view->header ()->restoreState
- (settings->value (fb_column_state.key).toByteArray ());
+ (settings.value (fb_column_state.key).toByteArray ());
// Set header properties for sorting
m_file_tree_view->header ()->setSectionsClickable (true);
@@ -364,7 +364,7 @@
m_file_tree_view->header ()->setSortIndicatorShown (true);
QStringList mru_dirs =
- settings->value (fb_mru_list.key).toStringList ();
+ settings.value (fb_mru_list.key).toStringList ();
m_current_directory->addItems (mru_dirs);
m_current_directory->setEditText
@@ -430,27 +430,23 @@
void files_dock_widget::save_settings (void)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
-
- if (! settings)
- return;
+ gui_settings settings;
int sort_column = m_file_tree_view->header ()->sortIndicatorSection ();
Qt::SortOrder sort_order = m_file_tree_view->header ()->sortIndicatorOrder ();
- settings->setValue (fb_sort_column.key, sort_column);
- settings->setValue (fb_sort_order.key, sort_order);
- settings->setValue (fb_column_state.key,
- m_file_tree_view->header ()->saveState ());
+ settings.setValue (fb_sort_column.key, sort_column);
+ settings.setValue (fb_sort_order.key, sort_order);
+ settings.setValue (fb_column_state.key,
+ m_file_tree_view->header ()->saveState ());
QStringList dirs;
for (int i=0; i< m_current_directory->count (); i++)
{
dirs.append (m_current_directory->itemText (i));
}
- settings->setValue (fb_mru_list.key, dirs);
+ settings.setValue (fb_mru_list.key, dirs);
- settings->sync ();
+ settings.sync ();
octave_dock_widget::save_settings ();
@@ -534,9 +530,10 @@
QString abs_fname = fileInfo.absoluteFilePath ();
QString suffix = fileInfo.suffix ().toLower ();
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- QString ext = settings->value (fb_txt_file_ext).toString ();
+
+ gui_settings settings;
+
+ QString ext = settings.value (fb_txt_file_ext).toString ();
#if defined (HAVE_QT_SPLITBEHAVIOR_ENUM)
QStringList extensions = ext.split (";", Qt::SkipEmptyParts);
#else
@@ -565,13 +562,12 @@
void files_dock_widget::toggle_header (int col)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
QString key = m_columns_shown_keys.at (col);
- bool shown = settings->value (key, false).toBool ();
- settings->setValue (key, ! shown);
- settings->sync ();
+ bool shown = settings.value (key, false).toBool ();
+ settings.setValue (key, ! shown);
+ settings.sync ();
switch (col)
{
@@ -584,7 +580,7 @@
case 3:
case 4:
// other actions depending on new settings
- notice_settings (settings);
+ notice_settings ();
break;
}
}
@@ -597,8 +593,7 @@
delete m_sig_mapper;
m_sig_mapper = new QSignalMapper (this);
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
for (int i = 0; i < m_columns_shown.size (); i++)
{
@@ -607,8 +602,8 @@
m_sig_mapper->setMapping (action, i);
action->setCheckable (true);
action->setChecked
- (settings->value (m_columns_shown_keys.at (i),
- m_columns_shown_defs.at (i)).toBool ());
+ (settings.value (m_columns_shown_keys.at (i),
+ m_columns_shown_defs.at (i)).toBool ());
}
// FIXME: We could use
@@ -655,10 +650,10 @@
| QItemSelectionModel::Rows);
}
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+ gui_settings settings;
// construct the context menu depending on item
- menu.addAction (rmgr.icon ("document-open"), tr ("Open"),
+ menu.addAction (settings.icon ("document-open"), tr ("Open"),
this, &files_dock_widget::contextmenu_open);
if (info.isDir ())
@@ -675,7 +670,7 @@
this, &files_dock_widget::contextmenu_copy_selection);
if (info.isFile () && info.suffix () == "m")
- menu.addAction (rmgr.icon ("media-playback-start"), tr ("Run"),
+ menu.addAction (settings.icon ("media-playback-start"), tr ("Run"),
this, &files_dock_widget::contextmenu_run);
if (info.isFile ())
@@ -685,7 +680,7 @@
if (info.isDir ())
{
menu.addSeparator ();
- menu.addAction (rmgr.icon ("go-first"), tr ("Set Current Directory"),
+ menu.addAction (settings.icon ("go-first"), tr ("Set Current Directory"),
this, &files_dock_widget::contextmenu_setcurrentdir);
QMenu *add_path_menu = menu.addMenu (tr ("Add to Path"));
@@ -704,21 +699,21 @@
menu.addSeparator ();
- menu.addAction (rmgr.icon ("edit-find"), tr ("Find Files..."),
+ menu.addAction (settings.icon ("edit-find"), tr ("Find Files..."),
this, &files_dock_widget::contextmenu_findfiles);
}
menu.addSeparator ();
menu.addAction (m_rename_action);
- menu.addAction (rmgr.icon ("edit-delete"), tr ("Delete..."),
+ menu.addAction (settings.icon ("edit-delete"), tr ("Delete..."),
this, &files_dock_widget::contextmenu_delete);
if (info.isDir ())
{
menu.addSeparator ();
- menu.addAction (rmgr.icon ("document-new"), tr ("New File..."),
+ menu.addAction (settings.icon ("document-new"), tr ("New File..."),
this, &files_dock_widget::contextmenu_newfile);
- menu.addAction (rmgr.icon ("folder-new"), tr ("New Directory..."),
+ menu.addAction (settings.icon ("folder-new"), tr ("New Directory..."),
this, &files_dock_widget::contextmenu_newdir);
}
@@ -1007,11 +1002,13 @@
}
}
- void files_dock_widget::notice_settings (const gui_settings *settings)
+ void files_dock_widget::notice_settings (void)
{
+ gui_settings settings;
+
// QSettings pointer is checked before emitting.
- int size_idx = settings->value (global_icon_size).toInt ();
+ int size_idx = settings.value (global_icon_size).toInt ();
size_idx = (size_idx > 0) - (size_idx < 0) + 1; // Make valid index from 0 to 2
QStyle *st = style ();
@@ -1021,22 +1018,22 @@
// filenames are always shown, other columns can be hidden by settings
for (int i = 0; i < 3; i++)
m_file_tree_view->setColumnHidden (i + 1,
- ! settings->value (m_columns_shown_keys.at (i),false).toBool ());
+ ! settings.value (m_columns_shown_keys.at (i),false).toBool ());
QDir::Filters current_filter = m_file_system_model->filter ();
- if (settings->value (m_columns_shown_keys.at (3), false).toBool ())
+ if (settings.value (m_columns_shown_keys.at (3), false).toBool ())
m_file_system_model->setFilter (current_filter | QDir::Hidden);
else
m_file_system_model->setFilter (current_filter & (~QDir::Hidden));
m_file_tree_view->setAlternatingRowColors
- (settings->value (m_columns_shown_keys.at (4),true).toBool ());
+ (settings.value (m_columns_shown_keys.at (4),true).toBool ());
m_file_tree_view->setModel (m_file_system_model);
// enable the buttons to sync octave/browser dir
// only if this is not done by default
m_sync_octave_dir
- = settings->value (fb_sync_octdir).toBool ();
+ = settings.value (fb_sync_octdir).toBool ();
m_sync_octave_directory_action->setEnabled (! m_sync_octave_dir);
m_sync_browser_directory_action->setEnabled (! m_sync_octave_dir);
@@ -1064,9 +1061,10 @@
{
// FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
int opts = QFileDialog::ShowDirsOnly;
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- if (! settings->value (global_use_native_dialogs).toBool ())
+
+ gui_settings settings;
+
+ if (! settings.value (global_use_native_dialogs).toBool ())
opts |= QFileDialog::DontUseNativeDialog;
QString dir = QFileDialog::getExistingDirectory (this,
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/files-dock-widget.h
--- a/libgui/src/files-dock-widget.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/files-dock-widget.h Tue Dec 06 15:17:16 2022 -0500
@@ -131,7 +131,7 @@
//! Tells the widget to react on changed settings.
- void notice_settings (const gui_settings *settings);
+ void notice_settings (void);
void save_settings (void);
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/find-files-dialog.cc
--- a/libgui/src/find-files-dialog.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/find-files-dialog.cc Tue Dec 06 15:17:16 2022 -0500
@@ -49,17 +49,17 @@
#include "find-files-model.h"
#include "gui-preferences-global.h"
#include "gui-preferences-ff.h"
-#include "octave-qobject.h"
+#include "gui-settings.h"
namespace octave
{
- find_files_dialog::find_files_dialog (QWidget *p, base_qobject& oct_qobj)
- : QDialog (p), m_octave_qobj (oct_qobj)
+ find_files_dialog::find_files_dialog (QWidget *p)
+ : QDialog (p)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+ gui_settings settings;
setWindowTitle (tr ("Find Files"));
- setWindowIcon (rmgr.icon ("edit-find"));
+ setWindowIcon (settings.icon ("edit-find"));
m_dir_iterator = nullptr;
@@ -67,20 +67,18 @@
connect (m_timer, &QTimer::timeout,
this, &find_files_dialog::look_for_files);
- gui_settings *settings = rmgr.get_settings ();
-
QLabel *file_name_label = new QLabel (tr ("Named:"));
m_file_name_edit = new QLineEdit;
m_file_name_edit->setToolTip (tr ("Enter the filename search expression"));
- m_file_name_edit->setText (settings->value (ff_file_name).toString ());
+ m_file_name_edit->setText (settings.value (ff_file_name).toString ());
file_name_label->setBuddy (m_file_name_edit);
QLabel *start_dir_label = new QLabel (tr ("Start in:"));
m_start_dir_edit = new QLineEdit;
- m_start_dir_edit->setText (settings->value (ff_start_dir.key,
- QDir::currentPath ()).toString ());
+ m_start_dir_edit->setText (settings.value (ff_start_dir.key,
+ QDir::currentPath ()).toString ());
m_start_dir_edit->setToolTip (tr ("Enter the start directory"));
start_dir_label->setBuddy (m_start_dir_edit);
@@ -90,27 +88,27 @@
this, &find_files_dialog::browse_folders);
m_recurse_dirs_check = new QCheckBox (tr ("Search subdirectories"));
- m_recurse_dirs_check->setChecked (settings->value (ff_recurse_dirs).toBool ());
+ m_recurse_dirs_check->setChecked (settings.value (ff_recurse_dirs).toBool ());
m_recurse_dirs_check->setToolTip (tr ("Search recursively through directories for matching files"));
m_include_dirs_check = new QCheckBox (tr ("Include directory names"));
- m_include_dirs_check->setChecked (settings->value (ff_include_dirs).toBool ());
+ m_include_dirs_check->setChecked (settings.value (ff_include_dirs).toBool ());
m_include_dirs_check->setToolTip (tr ("Include matching directories in search results"));
m_name_case_check = new QCheckBox (tr ("Name case insensitive"));
- m_name_case_check->setChecked (settings->value (ff_name_case).toBool ());
+ m_name_case_check->setChecked (settings.value (ff_name_case).toBool ());
m_name_case_check->setToolTip (tr ("Set matching name is case insensitive"));
m_contains_text_check = new QCheckBox (tr ("Contains text:"));
m_contains_text_check->setToolTip (tr ("Enter the file content search expression"));
- m_contains_text_check->setChecked (settings->value (ff_check_text).toBool ());
+ m_contains_text_check->setChecked (settings.value (ff_check_text).toBool ());
m_contains_text_edit = new QLineEdit ();
m_contains_text_edit->setToolTip (tr ("Text to match"));
- m_contains_text_edit->setText (settings->value (ff_contains_text).toString ());
+ m_contains_text_edit->setText (settings.value (ff_contains_text).toString ());
m_content_case_check = new QCheckBox (tr ("Text case insensitive"));
- m_content_case_check->setChecked (settings->value (ff_content_case).toBool ());
+ m_content_case_check->setChecked (settings.value (ff_content_case).toBool ());
m_content_case_check->setToolTip (tr ("Set text content is case insensitive"));
find_files_model *model = new find_files_model (this);
@@ -124,13 +122,13 @@
m_file_list->setAlternatingRowColors (true);
m_file_list->setToolTip (tr ("Search results"));
m_file_list->setSortingEnabled (true);
- m_file_list->horizontalHeader ()->restoreState (settings->value (ff_column_state.key).toByteArray ());
+ m_file_list->horizontalHeader ()->restoreState (settings.value (ff_column_state.key).toByteArray ());
m_file_list->horizontalHeader ()->setSortIndicatorShown (true);
m_file_list->horizontalHeader ()->setSectionsClickable (true);
m_file_list->horizontalHeader ()->setStretchLastSection (true);
- m_file_list->sortByColumn (settings->value (ff_sort_files_by_column).toInt (),
+ m_file_list->sortByColumn (settings.value (ff_sort_files_by_column).toInt (),
static_cast
- (settings->value (ff_sort_files_by_order).toUInt ()));
+ (settings.value (ff_sort_files_by_order).toUInt ()));
// FIXME: use value instead of static cast after
// dropping support of Qt 5.4
@@ -209,32 +207,28 @@
void find_files_dialog::save_settings (void)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
-
- if (! settings)
- return;
+ gui_settings settings;
int sort_column = m_file_list->horizontalHeader ()->sortIndicatorSection ();
Qt::SortOrder sort_order
= m_file_list->horizontalHeader ()->sortIndicatorOrder ();
- settings->setValue (ff_sort_files_by_column.key, sort_column);
- settings->setValue (ff_sort_files_by_order.key, sort_order);
- settings->setValue (ff_column_state.key, m_file_list->horizontalHeader ()->saveState ());
+ settings.setValue (ff_sort_files_by_column.key, sort_column);
+ settings.setValue (ff_sort_files_by_order.key, sort_order);
+ settings.setValue (ff_column_state.key, m_file_list->horizontalHeader ()->saveState ());
- settings->setValue (ff_file_name.key, m_file_name_edit->text ());
+ settings.setValue (ff_file_name.key, m_file_name_edit->text ());
- settings->setValue (ff_start_dir.key, m_start_dir_edit->text ());
+ settings.setValue (ff_start_dir.key, m_start_dir_edit->text ());
- settings->setValue (ff_recurse_dirs.key, m_recurse_dirs_check->text ());
- settings->setValue (ff_include_dirs.key, m_include_dirs_check->text ());
- settings->setValue (ff_name_case.key, m_name_case_check->text ());
+ settings.setValue (ff_recurse_dirs.key, m_recurse_dirs_check->text ());
+ settings.setValue (ff_include_dirs.key, m_include_dirs_check->text ());
+ settings.setValue (ff_name_case.key, m_name_case_check->text ());
- settings->setValue (ff_contains_text.key, m_contains_text_edit->text ());
- settings->setValue (ff_check_text.key, m_contains_text_check->isChecked ());
- settings->setValue (ff_content_case.key, m_content_case_check->isChecked ());
+ settings.setValue (ff_contains_text.key, m_contains_text_edit->text ());
+ settings.setValue (ff_check_text.key, m_contains_text_check->isChecked ());
+ settings.setValue (ff_content_case.key, m_content_case_check->isChecked ());
- settings->sync ();
+ settings.sync ();
}
void find_files_dialog::set_search_dir (const QString& dir)
@@ -311,10 +305,12 @@
void find_files_dialog::browse_folders (void)
{
int opts = 0; // No options by default.
+
// FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- if (! settings->value (global_use_native_dialogs).toBool ())
+
+ gui_settings settings;
+
+ if (! settings.value (global_use_native_dialogs).toBool ())
opts = QFileDialog::DontUseNativeDialog;
QString dir =
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/find-files-dialog.h
--- a/libgui/src/find-files-dialog.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/find-files-dialog.h Tue Dec 06 15:17:16 2022 -0500
@@ -39,15 +39,13 @@
namespace octave
{
- class base_qobject;
-
class find_files_dialog : public QDialog
{
Q_OBJECT
public:
- find_files_dialog (QWidget *parent, base_qobject& oct_qobj);
+ find_files_dialog (QWidget *parent);
virtual ~find_files_dialog (void);
@@ -75,8 +73,6 @@
bool is_match (const QFileInfo& info);
- base_qobject& m_octave_qobj;
-
QLineEdit *m_start_dir_edit;
QLineEdit *m_file_name_edit;
QPushButton *m_stop_button;
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/graphics-init.cc
--- a/libgui/src/graphics-init.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/graphics-init.cc Tue Dec 06 15:17:16 2022 -0500
@@ -32,7 +32,6 @@
#include
#include "graphics-init.h"
-#include "octave-qobject.h"
#include "qt-graphics-toolkit.h"
#include "QtHandlesUtils.h"
@@ -42,7 +41,7 @@
namespace octave
{
- void graphics_init (interpreter& interp, base_qobject& oct_qobj)
+ void graphics_init (interpreter& interp)
{
#if defined (HAVE_QT_GRAPHICS)
@@ -54,7 +53,7 @@
gh_mgr.enable_event_processing (true);
- qt_graphics_toolkit *qt_gtk = new qt_graphics_toolkit (interp, oct_qobj);
+ qt_graphics_toolkit *qt_gtk = new qt_graphics_toolkit (interp);
if (QThread::currentThread ()
!= QApplication::instance ()->thread ())
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/graphics-init.h
--- a/libgui/src/graphics-init.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/graphics-init.h Tue Dec 06 15:17:16 2022 -0500
@@ -34,9 +34,7 @@
{
class interpreter;
- class base_qobject;
-
- extern void graphics_init (interpreter& interp, base_qobject& oct_qobj);
+ extern void graphics_init (interpreter& interp);
}
#endif
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/gui-preferences-global.h
--- a/libgui/src/gui-preferences-global.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/gui-preferences-global.h Tue Dec 06 15:17:16 2022 -0500
@@ -34,6 +34,9 @@
// Global preferences
+const gui_pref
+global_skip_welcome_wizard ("global_skip_welcome_wizard", false);
+
// Get the default monospaced font
#if defined (Q_OS_WIN)
const QString global_font_family = "Courier";
@@ -118,6 +121,9 @@
};
const gui_pref
+global_icon_fallbacks ("icon_fallbacks", QVariant (QStringList ()));
+
+const gui_pref
global_status_bar ("show_status_bar", QVariant (true));
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/gui-preferences.h
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/gui-settings.cc
--- a/libgui/src/gui-settings.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/gui-settings.cc Tue Dec 06 15:17:16 2022 -0500
@@ -27,13 +27,37 @@
# include "config.h"
#endif
+#include
+
#include
+#include
+#include
+#include
+#include
+#include
#include
+#include
+#include
+#include "gui-preferences-cs.h"
+#include "gui-preferences-global.h"
#include "gui-settings.h"
+#include "oct-env.h"
+
namespace octave
{
+ QString gui_settings::file_name (void) const
+ {
+ return fileName ();
+ }
+
+ QString gui_settings::directory_name (void) const
+ {
+ QFileInfo sfile (fileName ());
+
+ return sfile.absolutePath ();
+ }
QColor gui_settings::get_color_value (const QVariant& def, int mode) const
{
@@ -109,4 +133,219 @@
return key_seq;
}
+ void gui_settings::config_icon_theme (void)
+ {
+ int theme_index;
+
+ if (contains (global_icon_theme_index.key))
+ theme_index = value (global_icon_theme_index).toInt ();
+ else
+ {
+ // New pref does not exist. Use old if required. Add new and
+ // remove deprecated key.
+
+ if (value (global_icon_theme).toBool ())
+ theme_index = ICON_THEME_SYSTEM;
+ else
+ theme_index = ICON_THEME_OCTAVE;
+
+ setValue (global_icon_theme_index.key, theme_index);
+ remove (global_icon_theme.key);
+ }
+
+ QIcon::setThemeName (global_all_icon_themes.at (theme_index));
+
+ QStringList icon_fallbacks;
+
+ // Set the required fallback search paths.
+
+ switch (theme_index)
+ {
+ case ICON_THEME_SYSTEM:
+ icon_fallbacks << global_icon_paths.at (ICON_THEME_OCTAVE);
+ icon_fallbacks << global_icon_paths.at (ICON_THEME_TANGO);
+ break;
+ case ICON_THEME_TANGO:
+ icon_fallbacks << global_icon_paths.at (ICON_THEME_OCTAVE);
+ break;
+ case ICON_THEME_OCTAVE:
+ icon_fallbacks << global_icon_paths.at (ICON_THEME_TANGO);
+ break;
+ }
+
+ icon_fallbacks << global_icon_paths.at (ICON_THEME_CURSORS);
+
+ setValue (global_icon_fallbacks.key, icon_fallbacks);
+ }
+
+ QIcon gui_settings::icon (const QString& icon_name, bool octave_only,
+ const QString& icon_alt_name)
+ {
+ if (octave_only)
+ return QIcon (global_icon_paths.at (ICON_THEME_OCTAVE) + icon_name + ".png");
+
+ if (QIcon::hasThemeIcon (icon_name))
+ return QIcon (QIcon::fromTheme (icon_name));
+ else if ((! icon_alt_name.isEmpty ()) && QIcon::hasThemeIcon (icon_alt_name))
+ return QIcon (QIcon::fromTheme (icon_alt_name));
+
+ QStringList icon_fallbacks
+ = value (global_icon_fallbacks.key).toStringList ();
+
+ for (int i = 0; i < icon_fallbacks.length (); i++ )
+ {
+ QString icon_file (icon_fallbacks.at (i) + icon_name + ".png");
+ if (QFile (icon_file).exists ())
+ return QIcon (icon_file);
+ }
+
+ //QIcon::setThemeName (current_theme);
+ return QIcon ();
+ }
+
+ QString gui_settings::get_default_font_family (void)
+ {
+ QString default_family;
+
+ // Get all available fixed width fonts via a font combobox
+ QFontComboBox font_combo_box;
+ font_combo_box.setFontFilters (QFontComboBox::MonospacedFonts);
+ QStringList fonts;
+
+ for (int index = 0; index < font_combo_box.count(); index++)
+ fonts << font_combo_box.itemText(index);
+
+#if defined (Q_OS_MAC)
+ // Use hard coded default on macOS, since selection of fixed width
+ // default font is unreliable (see bug #59128).
+ // Test for macOS default fixed width font
+ if (fonts.contains (global_mono_font.def.toString ()))
+ default_family = global_mono_font.def.toString ();
+#endif
+
+ // If default font is still empty (on all other platforms or
+ // if macOS default font is not available): use QFontDatabase
+ if (default_family.isEmpty ())
+ {
+ // Get the system's default monospaced font
+ QFont fixed_font = QFontDatabase::systemFont (QFontDatabase::FixedFont);
+ default_family = fixed_font.defaultFamily ();
+
+ // Since this might be unreliable, test all available fixed width fonts
+ if (! fonts.contains (default_family))
+ {
+ // Font returned by QFontDatabase is not in fixed fonts list.
+ // Fallback: take first from this list
+ default_family = fonts[0];
+ }
+ }
+
+ // Test env variable which has preference
+ std::string env_default_family = sys::env::getenv ("OCTAVE_DEFAULT_FONT");
+ if (! env_default_family.empty ())
+ default_family = QString::fromStdString (env_default_family);
+
+ return default_family;
+ }
+
+ QStringList gui_settings::get_default_font (void)
+ {
+ QString default_family = get_default_font_family ();
+
+ // determine the fefault font size of the system
+ // FIXME: QApplication::font () does not return the monospace font,
+ // but the size should be probably near to the monospace font
+ QFont font = QApplication::font ();
+
+ int font_size = font.pointSize ();
+ if (font_size == -1)
+ font_size = static_cast (std::floor(font.pointSizeF ()));
+
+ // check for valid font size, otherwise take default 10
+ QString default_font_size = "10";
+ if (font_size > 0)
+ default_font_size = QString::number (font_size);
+
+ std::string env_default_font_size
+ = sys::env::getenv ("OCTAVE_DEFAULT_FONT_SIZE");
+
+ if (! env_default_font_size.empty ())
+ default_font_size = QString::fromStdString (env_default_font_size);
+
+ QStringList result;
+ result << default_family;
+ result << default_font_size;
+ return result;
+ }
+
+ void gui_settings::reload (void)
+ {
+ // Declare some empty options, which may be set at first startup for
+ // writing them into the newly created settings file
+ QString custom_editor;
+ QStringList def_font;
+
+ // Check whether the settings file does not yet exist
+ if (! QFile::exists (file_name ()))
+ {
+ // Get the default font (for terminal)
+ def_font = get_default_font ();
+
+ // Get a custom editor defined as env variable
+ std::string env_default_editor
+ = sys::env::getenv ("OCTAVE_DEFAULT_EDITOR");
+
+ if (! env_default_editor.empty ())
+ custom_editor = QString::fromStdString (env_default_editor);
+ }
+
+ check ();
+
+ // Write some settings that were dynamically determined at first startup
+
+ // Custom editor
+ if (! custom_editor.isEmpty ())
+ setValue (global_custom_editor.key, custom_editor);
+
+ // Default monospace font for the terminal
+ if (def_font.count () > 1)
+ {
+ setValue (cs_font.key, def_font[0]);
+ setValue (cs_font_size.key, def_font[1].toInt ());
+ }
+
+ // Write the default monospace font into the settings for later use by
+ // console and editor as fallbacks of their font preferences.
+ setValue (global_mono_font.key, get_default_font_family ());
+ }
+
+ void gui_settings::check (void)
+ {
+ if (status () == QSettings::NoError)
+ {
+ // Test usability (force file to be really created)
+ setValue ("dummy", 0);
+ sync ();
+ }
+
+ if (! (QFile::exists (file_name ())
+ && isWritable ()
+ && status () == QSettings::NoError))
+ {
+ QString msg
+ = QString (QT_TR_NOOP ("Error %1 creating the settings file\n%2\n"
+ "Make sure you have read and write permissions to\n%3\n\n"
+ "Octave GUI must be closed now."));
+
+ QMessageBox::critical (nullptr,
+ QString (QT_TR_NOOP ("Octave Critical Error")),
+ msg.arg (status ())
+ .arg (file_name ())
+ .arg (directory_name ()));
+
+ exit (1);
+ }
+ else
+ remove ("dummy"); // Remove test entry
+ }
}
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/gui-settings.h
--- a/libgui/src/gui-settings.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/gui-settings.h Tue Dec 06 15:17:16 2022 -0500
@@ -26,6 +26,8 @@
#if ! defined (octave_gui_settings_h)
#define octave_gui_settings_h 1
+#include
+#include
#include
#include "gui-preferences.h"
@@ -38,6 +40,13 @@
public:
+ // Location, name, and format of settings file determined by
+ // settings in qt_application class construtor.
+
+ gui_settings (QObject *parent = nullptr)
+ : QSettings (parent)
+ { }
+
gui_settings (const QString& file_name, QSettings::Format format,
QObject *parent = nullptr)
: QSettings (file_name, format, parent)
@@ -58,6 +67,10 @@
~gui_settings (void) = default;
+ QString file_name (void) const;
+
+ QString directory_name (void) const;
+
using QSettings::value;
QVariant value (const gui_pref& pref) const
@@ -119,6 +132,30 @@
QKeySequence sc_def_value (const sc_pref& pref) const;
+ // config_icon_theme, icon, get_default_font_family,
+ // get_default_font, and possibly reload and check could be global
+ // functions instead of member functions. But at least for the icon
+ // function, defining it as a member function means that we can
+ // create a single gui_settings object and access multiple icon
+ // objects rather than having to create a separate settings object
+ // each time that an icon is needed. OTOH, creating the base
+ // QSettings object is supposed to be fast, so that may not matter.
+ // Hmm.
+
+ void config_icon_theme (void);
+
+ QIcon icon (const QString& icon_name, bool octave_only = false,
+ const QString& icon_alt_name = QString ());
+
+ QString get_default_font_family (void);
+
+ QStringList get_default_font (void);
+
+ void reload (void);
+
+ private:
+
+ void check (void);
};
}
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/history-dock-widget.cc
--- a/libgui/src/history-dock-widget.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/history-dock-widget.cc Tue Dec 06 15:17:16 2022 -0500
@@ -38,6 +38,7 @@
#include "gui-preferences-cs.h"
#include "gui-preferences-global.h"
#include "gui-preferences-hw.h"
+#include "gui-settings.h"
#include "history-dock-widget.h"
#include "octave-qobject.h"
@@ -87,21 +88,17 @@
void history_dock_widget::save_settings (void)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
- if (! settings)
- return;
-
- settings->setValue (hw_filter_active.key, m_filter_checkbox->isChecked ());
- settings->setValue (hw_filter_shown.key, m_filter_shown);
+ settings.setValue (hw_filter_active.key, m_filter_checkbox->isChecked ());
+ settings.setValue (hw_filter_shown.key, m_filter_shown);
QStringList mru;
for (int i = 0; i < m_filter->count (); i++)
mru.append (m_filter->itemText (i));
- settings->setValue (hw_mru_list.key, mru);
+ settings.setValue (hw_mru_list.key, mru);
- settings->sync ();
+ settings.sync ();
octave_dock_widget::save_settings ();
}
@@ -153,13 +150,13 @@
if (index.isValid () && index.column () == 0)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+ gui_settings settings;
- menu.addAction (rmgr.icon ("edit-copy"), tr ("Copy"), this,
+ menu.addAction (settings.icon ("edit-copy"), tr ("Copy"), this,
&history_dock_widget::handle_contextmenu_copy);
menu.addAction (tr ("Evaluate"), this,
&history_dock_widget::handle_contextmenu_evaluate);
- menu.addAction (rmgr.icon ("document-new"), tr ("Create script"), this,
+ menu.addAction (settings.icon ("document-new"), tr ("Create script"), this,
&history_dock_widget::handle_contextmenu_create_script);
}
if (m_filter_shown)
@@ -330,17 +327,15 @@
widget ()->setLayout (hist_layout);
// Init state of the filter
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- m_filter_shown
- = settings->value (hw_filter_shown).toBool ();
+ gui_settings settings;
+
+ m_filter_shown = settings.value (hw_filter_shown).toBool ();
m_filter_widget->setVisible (m_filter_shown);
- m_filter->addItems (settings->value (hw_mru_list).toStringList ());
+ m_filter->addItems (settings.value (hw_mru_list).toStringList ());
- bool filter_state
- = settings->value (hw_filter_active).toBool ();
+ bool filter_state = settings.value (hw_filter_active).toBool ();
m_filter_checkbox->setChecked (filter_state);
filter_activate (filter_state);
@@ -359,15 +354,17 @@
m_history_list_view->setTextElideMode (Qt::ElideRight);
}
- void history_dock_widget::notice_settings (const gui_settings *settings)
+ void history_dock_widget::notice_settings (void)
{
+ gui_settings settings;
+
QFont font = QFont ();
font.setStyleHint (QFont::TypeWriter);
- QString default_font = settings->value (global_mono_font).toString ();
+ QString default_font = settings.value (global_mono_font).toString ();
- font.setFamily (settings->value (cs_font.key, default_font).toString ());
- font.setPointSize (settings->value (cs_font_size).toInt ());
+ font.setFamily (settings.value (cs_font.key, default_font).toString ());
+ font.setPointSize (settings.value (cs_font_size).toInt ());
m_history_list_view->setFont (font);
}
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/history-dock-widget.h
--- a/libgui/src/history-dock-widget.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/history-dock-widget.h Tue Dec 06 15:17:16 2022 -0500
@@ -67,7 +67,7 @@
void append_history (const QString& hist_entry);
void clear_history (void);
void save_settings (void);
- void notice_settings (const gui_settings *);
+ void notice_settings (void);
private slots:
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/interpreter-qobject.cc
--- a/libgui/src/interpreter-qobject.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/interpreter-qobject.cc Tue Dec 06 15:17:16 2022 -0500
@@ -82,7 +82,7 @@
emit ready ();
- graphics_init (interp, m_octave_qobj);
+ graphics_init (interp);
// Start executing commands in the command window.
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/m-editor/file-editor-interface.h
--- a/libgui/src/m-editor/file-editor-interface.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/m-editor/file-editor-interface.h Tue Dec 06 15:17:16 2022 -0500
@@ -30,7 +30,6 @@
#include
#include
-#include "gui-settings.h"
#include "octave-dock-widget.h"
namespace octave
@@ -74,7 +73,7 @@
virtual void empty_script (bool, bool) = 0;
- virtual void restore_session (gui_settings *) = 0;
+ virtual void restore_session (void) = 0;
virtual void enable_menu_shortcuts (bool enable) = 0;
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/m-editor/file-editor-tab.cc
--- a/libgui/src/m-editor/file-editor-tab.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/m-editor/file-editor-tab.cc Tue Dec 06 15:17:16 2022 -0500
@@ -71,6 +71,7 @@
#include "gui-preferences-cs.h"
#include "gui-preferences-ed.h"
#include "gui-preferences-global.h"
+#include "gui-settings.h"
#include "gui-utils.h"
#include "marker.h"
#include "octave-qobject.h"
@@ -266,13 +267,12 @@
connect (this, &file_editor_tab::do_save_file_signal,
this, &file_editor_tab::do_save_file);
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- if (settings)
- notice_settings (settings, true);
+ notice_settings (true);
+
+ gui_settings settings;
// encoding, not updated with the settings
- m_encoding = settings->value (ed_default_enc.key, "UTF-8").toString ();
+ m_encoding = settings.value (ed_default_enc.key, "UTF-8").toString ();
m_enc_indicator->setText (m_encoding);
// no changes in encoding yet
m_new_encoding = m_encoding;
@@ -713,8 +713,7 @@
{
QsciLexer *lexer = m_edit_area->lexer ();
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
if (m_lexer_apis)
{
@@ -743,9 +742,9 @@
// get settings which infos are used for octave
bool octave_builtins
- = settings->value (ed_code_completion_octave_builtins).toBool ();
+ = settings.value (ed_code_completion_octave_builtins).toBool ();
bool octave_functions
- = settings->value (ed_code_completion_octave_functions).toBool ();
+ = settings.value (ed_code_completion_octave_functions).toBool ();
QCoreApplication::setApplicationName (tmp_app_name); // Restore name
@@ -883,8 +882,9 @@
if (update_apis_only)
return; // We are done here
- int mode = settings->value (ed_color_mode).toInt ();
- rmgr.read_lexer_settings (lexer, settings, mode);
+ int mode = settings.value (ed_color_mode).toInt ();
+ resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+ rmgr.read_lexer_settings (lexer, mode);
m_edit_area->setCaretForegroundColor (lexer->color (0));
m_edit_area->setIndentationGuidesForegroundColor (lexer->color (0));
@@ -908,7 +908,7 @@
m_edit_area->setFoldMarginColors (bgm, fgm);
QColor current_line_bg
- = settings->color_value (ed_highlight_current_line_color, mode);
+ = settings.color_value (ed_highlight_current_line_color, mode);
if (current_line_bg == settings_color_no_change)
bgm = interpolate_color (bg, fg, 0.5, 0.1); // It is the "auto" color
else
@@ -923,7 +923,7 @@
// fix line number width with respect to the font size of the lexer and
// set the line numbers font depending on the lexer's font
- if (settings->value (ed_show_line_numbers).toBool ())
+ if (settings.value (ed_show_line_numbers).toBool ())
{
// Line numbers width
auto_margin_width ();
@@ -932,7 +932,7 @@
QFont line_numbers_font = lexer->defaultFont ();
int font_size = line_numbers_font.pointSize ();
font_size = font_size
- + settings->value (ed_line_numbers_size).toInt ();
+ + settings.value (ed_line_numbers_size).toInt ();
if (font_size < 4)
font_size = 4;
line_numbers_font.setPointSize (font_size);
@@ -1535,20 +1535,19 @@
if (input_str)
{
bool ok;
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
used_comment_str
= QInputDialog::getText (this, tr ("Comment selected text"),
tr ("Comment string to use:\n"),
QLineEdit::Normal,
- settings->value (ed_last_comment_str, comment_str.at (0)).toString (),
+ settings.value (ed_last_comment_str, comment_str.at (0)).toString (),
&ok);
if ((! ok) || used_comment_str.isEmpty ())
return; // No input, do nothing
else
- settings->setValue (ed_last_comment_str, used_comment_str); // Store last
+ settings.setValue (ed_last_comment_str, used_comment_str); // Store last
}
}
else
@@ -1824,10 +1823,10 @@
QByteArray text_data = file.readAll ();
// remove newline at end of file if we add one again when saving
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
-
- if (settings->value (ed_force_newline).toBool ())
+
+ gui_settings settings;
+
+ if (settings.value (ed_force_newline).toBool ())
{
const QByteArray eol_lf = QByteArray (1, 0x0a);
const QByteArray eol_cr = QByteArray (1, 0x0d);
@@ -1968,10 +1967,10 @@
int count_lf = text.count (eol_lf) - count_crlf; // isolated lf
int count_cr = text.count (eol_cr) - count_crlf; // isolated cr
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
+
QsciScintilla::EolMode eol_mode
- = static_cast (settings->value (ed_default_eol_mode).toInt ());
+ = static_cast (settings.value (ed_default_eol_mode).toInt ());
int count_max = 0;
@@ -2052,12 +2051,11 @@
{
update_window_title (false); // window title (no modification)
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
// set the eol mode from the settings or depending on the OS if the entry is
// missing in the settings
- m_edit_area->setEolMode (static_cast (settings->value (ed_default_eol_mode).toInt ()));
+ m_edit_area->setEolMode (static_cast (settings.value (ed_default_eol_mode).toInt ()));
update_eol_indicator ();
@@ -2229,10 +2227,10 @@
m_file_system_watcher.removePath (file_to_save);
// Remove trailing white spaces if desired
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
-
- if (settings->value (ed_rm_trailing_spaces).toBool ())
+
+ gui_settings settings;
+
+ if (settings.value (ed_rm_trailing_spaces).toBool ())
{
// Replace trailing spaces, make sure edit area is writable,
// which is not the case when saving at exit or when closing
@@ -2280,7 +2278,7 @@
QApplication::setOverrideCursor (Qt::WaitCursor);
out << m_edit_area->text ();
- if (settings->value (ed_force_newline).toBool ()
+ if (settings.value (ed_force_newline).toBool ()
&& m_edit_area->text ().length ())
out << m_edit_area->eol_string (); // Add newline if desired
@@ -2385,9 +2383,10 @@
fileDialog->setOption (QFileDialog::HideNameFilterDetails, false);
// FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- if (! settings->value (global_use_native_dialogs).toBool ())
+
+ gui_settings settings;
+
+ if (! settings.value (global_use_native_dialogs).toBool ())
{
// Qt file dialogs
fileDialog->setOption(QFileDialog::DontUseNativeDialog);
@@ -2688,16 +2687,15 @@
}
}
- void file_editor_tab::notice_settings (const gui_settings *settings, bool init)
+ void file_editor_tab::notice_settings (bool init)
{
- if (! settings)
- return;
+ gui_settings settings;
if (! init)
update_lexer_settings ();
// code folding
- if (settings->value (ed_code_folding).toBool ())
+ if (settings.value (ed_code_folding).toBool ())
{
m_edit_area->setMarginType (3, QsciScintilla::SymbolMargin);
m_edit_area->setFolding (QsciScintilla::BoxedTreeFoldStyle, 3);
@@ -2708,19 +2706,19 @@
}
// status bar
- if (settings->value (ed_show_edit_status_bar).toBool ())
+ if (settings.value (ed_show_edit_status_bar).toBool ())
m_status_bar->show ();
else
m_status_bar->hide ();
//highlight current line color
m_edit_area->setCaretLineVisible
- (settings->value (ed_highlight_current_line).toBool ());
+ (settings.value (ed_highlight_current_line).toBool ());
// auto completion
- bool match_keywords = settings->value
+ bool match_keywords = settings.value
(ed_code_completion_keywords).toBool ();
- bool match_document = settings->value
+ bool match_document = settings.value
(ed_code_completion_document).toBool ();
QsciScintilla::AutoCompletionSource source = QsciScintilla::AcsNone;
@@ -2734,30 +2732,30 @@
m_edit_area->setAutoCompletionSource (source);
m_edit_area->setAutoCompletionReplaceWord
- (settings->value (ed_code_completion_replace).toBool ());
+ (settings.value (ed_code_completion_replace).toBool ());
m_edit_area->setAutoCompletionCaseSensitivity
- (settings->value (ed_code_completion_case).toBool ());
-
- if (settings->value (ed_code_completion).toBool ())
+ (settings.value (ed_code_completion_case).toBool ());
+
+ if (settings.value (ed_code_completion).toBool ())
m_edit_area->setAutoCompletionThreshold
- (settings->value (ed_code_completion_threshold).toInt ());
+ (settings.value (ed_code_completion_threshold).toInt ());
else
m_edit_area->setAutoCompletionThreshold (-1);
- if (settings->value (ed_show_white_space).toBool ())
- if (settings->value (ed_show_white_space_indent).toBool ())
+ if (settings.value (ed_show_white_space).toBool ())
+ if (settings.value (ed_show_white_space_indent).toBool ())
m_edit_area->setWhitespaceVisibility (QsciScintilla::WsVisibleAfterIndent);
else
m_edit_area->setWhitespaceVisibility (QsciScintilla::WsVisible);
else
m_edit_area->setWhitespaceVisibility (QsciScintilla::WsInvisible);
- m_edit_area->setEolVisibility (settings->value (ed_show_eol_chars).toBool ());
+ m_edit_area->setEolVisibility (settings.value (ed_show_eol_chars).toBool ());
m_save_as_desired_eol = static_cast
- (settings->value (ed_default_eol_mode).toInt ());
-
- if (settings->value (ed_show_line_numbers).toBool ())
+ (settings.value (ed_default_eol_mode).toInt ());
+
+ if (settings.value (ed_show_line_numbers).toBool ())
{
m_edit_area->setMarginLineNumbers (2, true);
auto_margin_width ();
@@ -2770,46 +2768,46 @@
disconnect (m_edit_area, SIGNAL (linesChanged ()), nullptr, nullptr);
}
- m_smart_indent = settings->value (ed_auto_indent).toBool ();
+ m_smart_indent = settings.value (ed_auto_indent).toBool ();
m_edit_area->setAutoIndent (m_smart_indent);
m_edit_area->setTabIndents
- (settings->value (ed_tab_indents_line).toBool ());
+ (settings.value (ed_tab_indents_line).toBool ());
m_edit_area->setBackspaceUnindents
- (settings->value (ed_backspace_unindents_line).toBool ());
+ (settings.value (ed_backspace_unindents_line).toBool ());
m_edit_area->setIndentationGuides
- (settings->value (ed_show_indent_guides).toBool ());
+ (settings.value (ed_show_indent_guides).toBool ());
m_edit_area->setIndentationsUseTabs
- (settings->value (ed_indent_uses_tabs).toBool ());
+ (settings.value (ed_indent_uses_tabs).toBool ());
m_edit_area->setIndentationWidth
- (settings->value (ed_indent_width).toInt ());
+ (settings.value (ed_indent_width).toInt ());
m_edit_area->setTabWidth
- (settings->value (ed_tab_width).toInt ());
+ (settings.value (ed_tab_width).toInt ());
m_ind_char_width = 1;
if (m_edit_area->indentationsUseTabs ())
m_ind_char_width = m_edit_area->tabWidth ();
m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETHSCROLLBAR,
- settings->value (ed_show_hscroll_bar).toBool ());
+ settings.value (ed_show_hscroll_bar).toBool ());
m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETSCROLLWIDTH,-1);
m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETSCROLLWIDTHTRACKING,true);
update_window_title (m_edit_area->isModified ());
- m_auto_endif = settings->value (ed_auto_endif).toInt ();
+ m_auto_endif = settings.value (ed_auto_endif).toInt ();
// long line marker
- int line_length = settings->value (ed_long_line_column).toInt ();
+ int line_length = settings.value (ed_long_line_column).toInt ();
m_edit_area->setEdgeColumn (line_length);
- if (settings->value (ed_long_line_marker).toBool ())
+ if (settings.value (ed_long_line_marker).toBool ())
{
- if (settings->value (ed_long_line_marker_line).toBool ())
+ if (settings.value (ed_long_line_marker_line).toBool ())
m_edit_area->setEdgeMode (QsciScintilla::EdgeLine);
else
{
- if (settings->value (ed_long_line_marker_background)
+ if (settings.value (ed_long_line_marker_background)
.toBool ())
m_edit_area->setEdgeMode (QsciScintilla::EdgeBackground);
else
@@ -2823,36 +2821,36 @@
m_edit_area->setWrapVisualFlags (QsciScintilla::WrapFlagByBorder);
m_edit_area->setWrapIndentMode (QsciScintilla::WrapIndentSame);
- if (settings->value (ed_wrap_lines).toBool ())
+ if (settings.value (ed_wrap_lines).toBool ())
m_edit_area->setWrapMode (QsciScintilla::WrapWord);
else
m_edit_area->setWrapMode (QsciScintilla::WrapNone);
- if (settings->value (ed_break_lines).toBool ())
+ if (settings.value (ed_break_lines).toBool ())
m_line_break = line_length;
else
m_line_break = 0;
m_line_break_comments =
- settings->value (ed_break_lines_comments).toBool ();
+ settings.value (ed_break_lines_comments).toBool ();
// highlight all occurrences of a word selected by a double click
m_highlight_all_occurrences =
- settings->value (ed_highlight_all_occurrences).toBool ();
+ settings.value (ed_highlight_all_occurrences).toBool ();
// reload changed files
m_always_reload_changed_files =
- settings->value (ed_always_reload_changed_files).toBool ();
+ settings.value (ed_always_reload_changed_files).toBool ();
// Set cursor blinking depending on the settings.
// QScintilla ignores the application global settings, so some special
// handling is required
bool cursor_blinking;
- if (settings->contains (global_cursor_blinking.key))
- cursor_blinking = settings->value (global_cursor_blinking).toBool ();
+ if (settings.contains (global_cursor_blinking.key))
+ cursor_blinking = settings.value (global_cursor_blinking).toBool ();
else
- cursor_blinking = settings->value (cs_cursor_blinking).toBool ();
+ cursor_blinking = settings.value (cs_cursor_blinking).toBool ();
if (cursor_blinking)
m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETCARETPERIOD, 500);
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/m-editor/file-editor-tab.h
--- a/libgui/src/m-editor/file-editor-tab.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/m-editor/file-editor-tab.h Tue Dec 06 15:17:16 2022 -0500
@@ -36,7 +36,6 @@
#include
#include
-#include "gui-settings.h"
#include "marker.h"
#include "octave-qscintilla.h"
#include "qt-interpreter-events.h"
@@ -138,7 +137,7 @@
Qt::KeyboardModifiers state);
// Tells the editor tab to react on changed settings.
- void notice_settings (const gui_settings *settings, bool init = false);
+ void notice_settings (bool init = false);
// Change to a different editor tab by identifier tag.
void change_editor_state (const QWidget *ID);
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/m-editor/file-editor.cc
--- a/libgui/src/m-editor/file-editor.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/m-editor/file-editor.cc Tue Dec 06 15:17:16 2022 -0500
@@ -50,6 +50,7 @@
#include "gui-preferences-ed.h"
#include "gui-preferences-sc.h"
#include "gui-preferences-global.h"
+#include "gui-settings.h"
#include "main-window.h"
#include "octave-qobject.h"
#include "octave-qtutils.h"
@@ -181,10 +182,10 @@
void file_editor::handle_enter_debug_mode (void)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- QString sc_run = settings->sc_value (sc_edit_run_run_file);
- QString sc_cont = settings->sc_value (sc_main_debug_continue);
+ gui_settings settings;
+
+ QString sc_run = settings.sc_value (sc_edit_run_run_file);
+ QString sc_cont = settings.sc_value (sc_main_debug_continue);
if (sc_run == sc_cont)
m_run_action->setShortcut (QKeySequence ()); // prevent ambiguous shortcuts
@@ -265,10 +266,10 @@
return; // not yet ready but got visibility changed signals
}
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- if (settings->value (global_use_custom_editor.key,
- global_use_custom_editor.def).toBool ())
+ gui_settings settings;
+
+ if (settings.value (global_use_custom_editor.key,
+ global_use_custom_editor.def).toBool ())
return; // do not open an empty script in the external editor
bool real_visible;
@@ -318,27 +319,29 @@
request_new_file ("");
}
- void file_editor::restore_session (gui_settings *settings)
+ void file_editor::restore_session (void)
{
+ gui_settings settings;
+
//restore previous session
- if (! settings->value (ed_restore_session).toBool ())
+ if (! settings.value (ed_restore_session).toBool ())
return;
// get the data from the settings file
QStringList sessionFileNames
- = settings->value (ed_session_names).toStringList ();
+ = settings.value (ed_session_names).toStringList ();
QStringList session_encodings
- = settings->value (ed_session_enc).toStringList ();
+ = settings.value (ed_session_enc).toStringList ();
QStringList session_index
- = settings->value (ed_session_ind).toStringList ();
+ = settings.value (ed_session_ind).toStringList ();
QStringList session_lines
- = settings->value (ed_session_lines).toStringList ();
+ = settings.value (ed_session_lines).toStringList ();
QStringList session_bookmarks
- = settings->value (ed_session_bookmarks).toStringList ();
+ = settings.value (ed_session_bookmarks).toStringList ();
// fill a list of the struct and sort it (depending on index)
QList s_data;
@@ -440,8 +443,7 @@
// together with encoding and the tab index
void file_editor::save_session (void)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
QStringList fetFileNames;
QStringList fet_encodings;
@@ -473,12 +475,13 @@
}
}
- settings->setValue (ed_session_names.key, fetFileNames);
- settings->setValue (ed_session_enc.key, fet_encodings);
- settings->setValue (ed_session_ind.key, fet_index);
- settings->setValue (ed_session_lines.key, fet_lines);
- settings->setValue (ed_session_bookmarks.key, fet_bookmarks);
- settings->sync ();
+ settings.setValue (ed_session_names.key, fetFileNames);
+ settings.setValue (ed_session_enc.key, fet_encodings);
+ settings.setValue (ed_session_ind.key, fet_index);
+ settings.setValue (ed_session_lines.key, fet_lines);
+ settings.setValue (ed_session_bookmarks.key, fet_bookmarks);
+
+ settings.sync ();
}
bool file_editor::check_closing (void)
@@ -901,9 +904,9 @@
m_find_dialog->close ();
if (isFloating ())
- m_find_dialog = new find_dialog (m_octave_qobj, this, this);
+ m_find_dialog = new find_dialog (this, this);
else
- m_find_dialog = new find_dialog (m_octave_qobj, this, parentWidget ());
+ m_find_dialog = new find_dialog (this, parentWidget ());
// Add required actions
m_find_dialog->addAction (m_find_next_action);
@@ -974,7 +977,7 @@
QObject *fileEditorTab = sender ();
if (fileEditorTab)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+ gui_settings settings;
for (int i = 0; i < m_tab_widget->count (); i++)
{
@@ -987,7 +990,7 @@
m_current_tab_modified = modified;
if (modified)
- m_tab_widget->setTabIcon (i, rmgr.icon ("document-save"));
+ m_tab_widget->setTabIcon (i, settings.icon ("document-save"));
else
m_tab_widget->setTabIcon (i, QIcon ());
}
@@ -1273,9 +1276,11 @@
m_tmp_closed_files.clear ();
}
- void file_editor::notice_settings (const gui_settings *settings)
+ void file_editor::notice_settings (void)
{
- int size_idx = settings->value (global_icon_size).toInt ();
+ gui_settings settings;
+
+ int size_idx = settings.value (global_icon_size).toInt ();
size_idx = (size_idx > 0) - (size_idx < 0) + 1; // Make valid index from 0 to 2
QStyle *st = style ();
@@ -1284,8 +1289,8 @@
// Tab position and rotation
QTabWidget::TabPosition pos
- = static_cast (settings->value (ed_tab_position).toInt ());
- bool rotated = settings->value (ed_tabs_rotated).toBool ();
+ = static_cast (settings.value (ed_tab_position).toInt ());
+ bool rotated = settings.value (ed_tabs_rotated).toBool ();
m_tab_widget->setTabPosition (pos);
@@ -1308,7 +1313,7 @@
height = is;
// Calculate possibly limited width and set the elide mode
- int chars = settings->value (ed_tabs_max_width).toInt ();
+ int chars = settings.value (ed_tabs_max_width).toInt ();
int width = 9999;
if (chars > 0)
width = chars * QFontMetrics (m_tab_widget->font ()).averageCharWidth ();
@@ -1349,23 +1354,23 @@
m_tab_widget->setStyleSheet (style_sheet);
bool show_it;
- show_it = settings->value (ed_show_line_numbers).toBool ();
+ show_it = settings.value (ed_show_line_numbers).toBool ();
m_show_linenum_action->setChecked (show_it);
- show_it = settings->value (ed_show_white_space).toBool ();
+ show_it = settings.value (ed_show_white_space).toBool ();
m_show_whitespace_action->setChecked (show_it);
- show_it = settings->value (ed_show_eol_chars).toBool ();
+ show_it = settings.value (ed_show_eol_chars).toBool ();
m_show_eol_action->setChecked (show_it);
- show_it = settings->value (ed_show_indent_guides).toBool ();
+ show_it = settings.value (ed_show_indent_guides).toBool ();
m_show_indguide_action->setChecked (show_it);
- show_it = settings->value (ed_long_line_marker).toBool ();
+ show_it = settings.value (ed_long_line_marker).toBool ();
m_show_longline_action->setChecked (show_it);
- show_it = settings->value (ed_show_toolbar).toBool ();
+ show_it = settings.value (ed_show_toolbar).toBool ();
m_show_toolbar_action->setChecked (show_it);
m_tool_bar->setVisible (show_it);
- show_it = settings->value (ed_show_edit_status_bar).toBool ();
+ show_it = settings.value (ed_show_edit_status_bar).toBool ();
m_show_statusbar_action->setChecked (show_it);
- show_it = settings->value (ed_show_hscroll_bar).toBool ();
+ show_it = settings.value (ed_show_hscroll_bar).toBool ();
m_show_hscrollbar_action->setChecked (show_it);
set_shortcuts ();
@@ -1375,7 +1380,7 @@
m_find_dialog->setWindowIcon (windowIcon ());
// Relay signal to file editor tabs.
- emit fetab_settings_changed (settings);
+ emit fetab_settings_changed ();
}
void file_editor::set_shortcuts (void)
@@ -1483,9 +1488,8 @@
if (m_closed && visible)
{
m_closed = false;
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- restore_session (settings);
+
+ restore_session ();
}
empty_script (false, visible);
@@ -1549,10 +1553,9 @@
const QString& cond, int index,
const QString& bookmarks)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
-
- if (settings->value (global_use_custom_editor).toBool ())
+ gui_settings settings;
+
+ if (settings.value (global_use_custom_editor).toBool ())
{
// Custom editor
if (debug_pointer || breakpoint_marker)
@@ -1562,8 +1565,7 @@
return; // Custom editor called
}
- bool show_dbg_file
- = settings->value (ed_show_dbg_file).toBool ();
+ bool show_dbg_file = settings.value (ed_show_dbg_file).toBool ();
if (openFileName.isEmpty ())
{
@@ -1677,7 +1679,7 @@
bool create_file = true;
QMessageBox *msgBox;
- if (! settings->value (ed_create_new_file).toBool ())
+ if (! settings.value (ed_create_new_file).toBool ())
{
msgBox = new QMessageBox (QMessageBox::Question,
tr ("Octave Editor"),
@@ -1849,9 +1851,9 @@
// handler for the close event
void file_editor::closeEvent (QCloseEvent *e)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- if (settings->value (ed_hiding_closes_files).toBool ())
+ gui_settings settings;
+
+ if (settings.value (ed_hiding_closes_files).toBool ())
{
if (check_closing ())
{
@@ -1931,12 +1933,12 @@
m_tab_widget = new file_editor_tab_widget (editor_widget, this);
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
-
// the mru-list and an empty array of actions
- gui_settings *settings = rmgr.get_settings ();
- m_mru_files = settings->value (ed_mru_file_list).toStringList ();
- m_mru_files_encodings = settings->value (ed_mru_file_encodings)
+
+ gui_settings settings;
+
+ m_mru_files = settings.value (ed_mru_file_list).toStringList ();
+ m_mru_files_encodings = settings.value (ed_mru_file_encodings)
.toStringList ();
if (m_mru_files_encodings.count () != m_mru_files.count ())
@@ -1975,33 +1977,33 @@
m_fileMenu->addSeparator ();
m_save_action
- = add_action (m_fileMenu, rmgr.icon ("document-save"),
+ = add_action (m_fileMenu, settings.icon ("document-save"),
tr ("&Save File"), SLOT (request_save_file (bool)));
m_save_as_action
- = add_action (m_fileMenu, rmgr.icon ("document-save-as"),
+ = add_action (m_fileMenu, settings.icon ("document-save-as"),
tr ("Save File &As..."),
SLOT (request_save_file_as (bool)));
m_fileMenu->addSeparator ();
m_close_action
- = add_action (m_fileMenu, rmgr.icon ("window-close", false),
+ = add_action (m_fileMenu, settings.icon ("window-close", false),
tr ("&Close"), SLOT (request_close_file (bool)));
m_close_all_action
- = add_action (m_fileMenu, rmgr.icon ("window-close", false),
+ = add_action (m_fileMenu, settings.icon ("window-close", false),
tr ("Close All"), SLOT (request_close_all_files (bool)));
m_close_others_action
- = add_action (m_fileMenu, rmgr.icon ("window-close", false),
+ = add_action (m_fileMenu, settings.icon ("window-close", false),
tr ("Close Other Files"),
SLOT (request_close_other_files (bool)));
m_fileMenu->addSeparator ();
m_print_action
- = add_action (m_fileMenu, rmgr.icon ("document-print"),
+ = add_action (m_fileMenu, settings.icon ("document-print"),
tr ("Print..."), SLOT (request_print_file (bool)));
// edit menu (undo, copy, paste and select all later via main window)
@@ -2009,19 +2011,19 @@
m_edit_menu = add_menu (m_menu_bar, tr ("&Edit"));
m_redo_action
- = add_action (m_edit_menu, rmgr.icon ("edit-redo"),
+ = add_action (m_edit_menu, settings.icon ("edit-redo"),
tr ("&Redo"), SLOT (request_redo (bool)));
m_redo_action->setEnabled (false);
m_edit_menu->addSeparator ();
m_cut_action
- = add_action (m_edit_menu, rmgr.icon ("edit-cut"),
+ = add_action (m_edit_menu, settings.icon ("edit-cut"),
tr ("Cu&t"), SLOT (request_cut (bool)));
m_cut_action->setEnabled (false);
m_find_action
- = add_action (m_edit_menu, rmgr.icon ("edit-find-replace"),
+ = add_action (m_edit_menu, settings.icon ("edit-find-replace"),
tr ("&Find and Replace..."), SLOT (request_find (bool)));
m_find_next_action
@@ -2173,12 +2175,12 @@
m_edit_menu->addSeparator ();
m_preferences_action
- = add_action (m_edit_menu, rmgr.icon ("preferences-system"),
+ = add_action (m_edit_menu, settings.icon ("preferences-system"),
tr ("&Preferences..."),
SLOT (request_preferences (bool)));
m_styles_preferences_action
- = add_action (m_edit_menu, rmgr.icon ("preferences-system"),
+ = add_action (m_edit_menu, settings.icon ("preferences-system"),
tr ("&Styles Preferences..."),
SLOT (request_styles_preferences (bool)));
@@ -2233,16 +2235,16 @@
view_menu->addSeparator ();
m_zoom_in_action
- = add_action (view_menu, rmgr.icon ("view-zoom-in"), tr ("Zoom &In"),
+ = add_action (view_menu, settings.icon ("view-zoom-in"), tr ("Zoom &In"),
SLOT (zoom_in (bool)));
m_zoom_out_action
- = add_action (view_menu, rmgr.icon ("view-zoom-out"), tr ("Zoom &Out"),
- SLOT (zoom_out (bool)));
+ = add_action (view_menu, settings.icon ("view-zoom-out"),
+ tr ("Zoom &Out"), SLOT (zoom_out (bool)));
m_zoom_normal_action
- = add_action (view_menu, rmgr.icon ("view-zoom-original"), tr ("&Normal Size"),
- SLOT (zoom_normal (bool)));
+ = add_action (view_menu, settings.icon ("view-zoom-original"),
+ tr ("&Normal Size"), SLOT (zoom_normal (bool)));
view_menu->addSeparator ();
@@ -2258,22 +2260,22 @@
m_debug_menu = add_menu (m_menu_bar, tr ("&Debug"));
m_toggle_breakpoint_action
- = add_action (m_debug_menu, rmgr.icon ("bp-toggle"),
+ = add_action (m_debug_menu, settings.icon ("bp-toggle"),
tr ("Toggle &Breakpoint"),
SLOT (request_toggle_breakpoint (bool)));
m_next_breakpoint_action
- = add_action (m_debug_menu, rmgr.icon ("bp-next"),
+ = add_action (m_debug_menu, settings.icon ("bp-next"),
tr ("&Next Breakpoint"),
SLOT (request_next_breakpoint (bool)));
m_previous_breakpoint_action
- = add_action (m_debug_menu, rmgr.icon ("bp-prev"),
+ = add_action (m_debug_menu, settings.icon ("bp-prev"),
tr ("Pre&vious Breakpoint"),
SLOT (request_previous_breakpoint (bool)));
m_remove_all_breakpoints_action
- = add_action (m_debug_menu, rmgr.icon ("bp-rm-all"),
+ = add_action (m_debug_menu, settings.icon ("bp-rm-all"),
tr ("&Remove All Breakpoints"),
SLOT (request_remove_breakpoint (bool)));
@@ -2287,7 +2289,7 @@
m_run_action
= add_action (_run_menu,
- rmgr.icon ("system-run"),
+ settings.icon ("system-run"),
tr ("Save File and Run / Continue"),
SLOT (request_run_file (bool)));
@@ -2493,7 +2495,7 @@
// Signals from the file_editor or main-win non-trivial operations
connect (this, &file_editor::fetab_settings_changed,
- f, [=] (const gui_settings *settings) { f->notice_settings (settings); });
+ f, [=] () { f->notice_settings (); });
connect (this, &file_editor::fetab_change_request,
f, &file_editor_tab::change_editor_state);
@@ -2677,21 +2679,22 @@
}
// save actual mru-list in settings
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
-
- settings->setValue (ed_mru_file_list.key, m_mru_files);
- settings->setValue (ed_mru_file_encodings.key, m_mru_files_encodings);
- settings->sync ();
+
+ gui_settings settings;
+
+ settings.setValue (ed_mru_file_list.key, m_mru_files);
+ settings.setValue (ed_mru_file_encodings.key, m_mru_files_encodings);
+
+ settings.sync ();
}
bool file_editor::call_custom_editor (const QString& file_name, int line)
{
// Check if the user wants to use a custom file editor.
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
-
- if (settings->value (global_use_custom_editor.key,
+
+ gui_settings settings;
+
+ if (settings.value (global_use_custom_editor.key,
global_use_custom_editor.def).toBool ())
{
// use the external editor interface for handling the call
@@ -2709,12 +2712,11 @@
void file_editor::toggle_preference (const gui_pref& preference)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
-
- bool old = settings->value (preference).toBool ();
- settings->setValue (preference.key, ! old);
- notice_settings (settings);
+ gui_settings settings;
+
+ bool old = settings.value (preference).toBool ();
+ settings.setValue (preference.key, ! old);
+ notice_settings ();
}
// Function for closing the files in a removed directory
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/m-editor/file-editor.h
--- a/libgui/src/m-editor/file-editor.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/m-editor/file-editor.h Tue Dec 06 15:17:16 2022 -0500
@@ -124,11 +124,11 @@
void check_actions (void);
void empty_script (bool startup, bool visible);
- void restore_session (gui_settings *settings);
+ void restore_session (void);
signals:
- void fetab_settings_changed (const gui_settings *settings);
+ void fetab_settings_changed (void);
void fetab_change_request (const QWidget *ID);
// Save is a ping-pong type of communication
void fetab_save_file (const QWidget *ID, const QString& fileName,
@@ -287,7 +287,7 @@
void handle_file_renamed (bool load_new = true);
// Tells the editor to react on changed settings.
- void notice_settings (const gui_settings *settings);
+ void notice_settings (void);
void set_shortcuts (void);
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/m-editor/find-dialog.cc
--- a/libgui/src/m-editor/find-dialog.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/m-editor/find-dialog.cc Tue Dec 06 15:17:16 2022 -0500
@@ -84,14 +84,12 @@
#include "gui-preferences-ed.h"
#include "gui-utils.h"
#include "resource-manager.h"
-#include "octave-qobject.h"
namespace octave
{
- find_dialog::find_dialog (base_qobject& oct_qobj,
- octave_dock_widget *ed, QWidget *p)
- : QDialog (p), m_octave_qobj (oct_qobj), m_editor (ed),
- m_in_sel (false), m_sel_beg (-1), m_sel_end (-1)
+ find_dialog::find_dialog (octave_dock_widget *ed, QWidget *p)
+ : QDialog (p), m_editor (ed), m_in_sel (false),
+ m_sel_beg (-1), m_sel_end (-1)
{
setWindowTitle (tr ("Editor: Find and Replace"));
@@ -218,8 +216,7 @@
void find_dialog::save_settings ()
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *s = rmgr.get_settings ();
+ gui_settings settings;
// Save position
QPoint dlg_pos = pos ();
@@ -232,7 +229,7 @@
m_last_position = QPoint (dlg_pos.x (), y);
- s->setValue (ed_fdlg_pos.key, m_last_position);
+ settings.setValue (ed_fdlg_pos.key, m_last_position);
// Is current search/replace text in the mru list?
mru_update (m_search_line_edit);
@@ -242,12 +239,12 @@
QStringList mru;
for (int i = 0; i < m_search_line_edit->count (); i++)
mru.append (m_search_line_edit->itemText (i));
- s->setValue (ed_fdlg_search.key, mru);
+ settings.setValue (ed_fdlg_search.key, mru);
mru.clear ();
for (int i = 0; i < m_replace_line_edit->count (); i++)
mru.append (m_replace_line_edit->itemText (i));
- s->setValue (ed_fdlg_replace.key, mru);
+ settings.setValue (ed_fdlg_replace.key, mru);
// Store dialog's options
int opts = 0
@@ -259,29 +256,28 @@
+ m_whole_words_check_box->isChecked () * FIND_DLG_WORDS
+ m_backward_check_box->isChecked () * FIND_DLG_BACK
+ m_search_selection_check_box->isChecked () * FIND_DLG_SEL;
- s->setValue (ed_fdlg_opts.key, opts);
+ settings.setValue (ed_fdlg_opts.key, opts);
- s->sync ();
+ settings.sync ();
}
void find_dialog::restore_settings (QPoint ed_bottom_right)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *s = rmgr.get_settings ();
+ gui_settings settings;
// Get mru lists for search and replace text
- QStringList mru = s->value (ed_fdlg_search.key).toStringList ();
+ QStringList mru = settings.value (ed_fdlg_search.key).toStringList ();
while (mru.length () > m_mru_length)
mru.removeLast ();
m_search_line_edit->addItems (mru);
- mru = s->value (ed_fdlg_replace.key).toStringList ();
+ mru = settings.value (ed_fdlg_replace.key).toStringList ();
while (mru.length () > m_mru_length)
mru.removeLast ();
m_replace_line_edit->addItems (mru);
// Get the dialog's options
- int opts = s->value (ed_fdlg_opts.key, ed_fdlg_opts.def).toInt ();
+ int opts = settings.value (ed_fdlg_opts.key, ed_fdlg_opts.def).toInt ();
m_extension->setVisible (FIND_DLG_MORE & opts);
m_case_check_box->setChecked (FIND_DLG_CASE & opts);
@@ -298,7 +294,7 @@
QRect default_geometry (xp, yp, sizeHint ().width (), sizeHint ().height ());
// Last position from settings
- m_last_position = s->value (ed_fdlg_pos.key, QPoint (xp, yp)).toPoint ();
+ m_last_position = settings.value (ed_fdlg_pos.key, QPoint (xp, yp)).toPoint ();
QRect last_geometry (m_last_position,
QSize (sizeHint ().width (), sizeHint ().height ()));
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/m-editor/find-dialog.h
--- a/libgui/src/m-editor/find-dialog.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/m-editor/find-dialog.h Tue Dec 06 15:17:16 2022 -0500
@@ -79,7 +79,6 @@
namespace octave
{
- class base_qobject;
class file_editor;
class find_dialog : public QDialog
@@ -88,7 +87,7 @@
public:
- find_dialog (base_qobject& oct_qobj, octave_dock_widget *ed, QWidget *p);
+ find_dialog (octave_dock_widget *ed, QWidget *p);
//! Set dialog visible or not and storing the new visibility state
void set_visible (bool visible);
@@ -122,8 +121,6 @@
private:
- base_qobject& m_octave_qobj;
-
//! Save position and the search options in the given settings
void save_settings ();
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/m-editor/octave-qscintilla.cc
--- a/libgui/src/m-editor/octave-qscintilla.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/m-editor/octave-qscintilla.cc Tue Dec 06 15:17:16 2022 -0500
@@ -54,6 +54,7 @@
#include "file-editor-tab.h"
#include "gui-preferences-ed.h"
+#include "gui-settings.h"
// FIXME: hardwired marker numbers?
#include "marker.h"
#include "octave-qobject.h"
@@ -430,20 +431,20 @@
case SCLEX_MATLAB:
#endif
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
+
int comment_string;
if (comment)
{
// The commenting string is requested
- if (settings->contains (ed_comment_str.key))
+ if (settings.contains (ed_comment_str.key))
// new version (radio buttons)
- comment_string = settings->value (ed_comment_str).toInt ();
+ comment_string = settings.value (ed_comment_str).toInt ();
else
// old version (combo box)
- comment_string = settings->value (ed_comment_str_old.key,
- ed_comment_str.def).toInt ();
+ comment_string = settings.value (ed_comment_str_old.key,
+ ed_comment_str.def).toInt ();
return (QStringList (ed_comment_strings.at (comment_string)));
}
@@ -452,7 +453,7 @@
QStringList c_str;
// The possible uncommenting string(s) are requested
- comment_string = settings->value (ed_uncomment_str).toInt ();
+ comment_string = settings.value (ed_uncomment_str).toInt ();
for (int i = 0; i < ed_comment_strings_count; i++)
{
@@ -908,9 +909,10 @@
});
// Disable opening a file at a breakpoint in case keyboard () is used
- gui_settings *settings = rmgr.get_settings ();
- bool show_dbg_file = settings->value (ed_show_dbg_file).toBool ();
- settings->setValue (ed_show_dbg_file.key, false);
+ gui_settings settings;
+
+ bool show_dbg_file = settings.value (ed_show_dbg_file).toBool ();
+ settings.setValue (ed_show_dbg_file.key, false);
// Let the interpreter execute the tmp file
emit interpreter_event
@@ -1035,8 +1037,10 @@
// possible lines from commands at a debug prompt must be
// taken into consideration.
resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- settings->setValue (ed_show_dbg_file.key, show_dbg_file);
+ gui_settings settings;
+
+ settings.setValue (ed_show_dbg_file.key, show_dbg_file);
+
rmgr.remove_tmp_file (tmp_file);
rmgr.remove_tmp_file (tmp_hist);
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/main-window.cc
--- a/libgui/src/main-window.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/main-window.cc Tue Dec 06 15:17:16 2022 -0500
@@ -100,7 +100,7 @@
m_file_browser_window (nullptr),
m_editor_window (nullptr),
m_workspace_window (nullptr),
- m_external_editor (new external_editor_interface (this, m_octave_qobj)),
+ m_external_editor (new external_editor_interface (this)),
m_active_editor (m_external_editor), m_settings_dlg (nullptr),
m_find_files_dlg (nullptr), m_set_path_dlg (nullptr),
m_clipboard (QApplication::clipboard ()),
@@ -111,23 +111,27 @@
{
resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- if (rmgr.is_first_run ())
+ gui_settings settings;
+
+ if (! settings.value (global_skip_welcome_wizard).toBool ())
{
// Before wizard.
m_octave_qobj.config_translators ();
- welcome_wizard welcomeWizard (m_octave_qobj);
+ welcome_wizard welcomeWizard;
if (welcomeWizard.exec () == QDialog::Rejected)
exit (1);
+ settings.setValue (global_skip_welcome_wizard.key, QVariant (true));
+
// Install settings file.
- rmgr.reload_settings ();
+ settings.reload ();
}
else
{
// Get settings file.
- rmgr.reload_settings ();
+ settings.reload ();
// After settings.
m_octave_qobj.config_translators ();
@@ -135,7 +139,7 @@
setObjectName (gui_obj_name_main_window);
- rmgr.config_icon_theme ();
+ settings.config_icon_theme ();
rmgr.update_network_settings ();
@@ -174,24 +178,15 @@
m_default_style = qapp->style ()->objectName ();
m_default_palette = qapp->palette ();
- gui_settings *settings = rmgr.get_settings ();
-
bool connect_to_web = true;
QDateTime last_checked;
int serial = 0;
m_active_dock = nullptr;
- if (settings)
- {
- connect_to_web
- = settings->value (nr_allow_connection).toBool ();
-
- last_checked
- = settings->value (nr_last_time).toDateTime ();
-
- serial = settings->value (nr_last_news).toInt ();
- m_default_encoding = settings->value (ed_default_enc).toString ();
- }
+ connect_to_web = settings.value (nr_allow_connection).toBool ();
+ last_checked = settings.value (nr_last_time).toDateTime ();
+ serial = settings.value (nr_last_news).toInt ();
+ m_default_encoding = settings.value (ed_default_enc).toString ();
QDateTime current = QDateTime::currentDateTime ();
QDateTime one_day_ago = current.addDays (-1);
@@ -508,11 +503,10 @@
{
bool closenow = true;
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
-
- if (settings->value (global_prompt_to_exit.key,
- global_prompt_to_exit.def).toBool ())
+ gui_settings settings;
+
+ if (settings.value (global_prompt_to_exit.key,
+ global_prompt_to_exit.def).toBool ())
{
int ans = QMessageBox::question (this, tr ("Octave"),
tr ("Are you sure you want to exit Octave?"),
@@ -648,11 +642,7 @@
void main_window::request_reload_settings (void)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
-
- if (settings)
- emit settings_changed (settings);
+ emit settings_changed ();
}
void main_window::report_status_message (const QString& statusMessage)
@@ -664,9 +654,10 @@
{
// FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
int opts = 0; // No options by default.
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- if (! settings->value (global_use_native_dialogs).toBool ())
+
+ gui_settings settings;
+
+ if (! settings.value (global_use_native_dialogs).toBool ())
opts = QFileDialog::DontUseNativeDialog;
QString file
@@ -689,9 +680,10 @@
{
// FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
int opts = 0; // No options by default.
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- if (! settings->value (global_use_native_dialogs).toBool ())
+
+ gui_settings settings;
+
+ if (! settings.value (global_use_native_dialogs).toBool ())
opts = QFileDialog::DontUseNativeDialog;
QString file = file_arg;
@@ -904,15 +896,13 @@
QString::fromStdString (message));
}
- void main_window::notice_settings (const gui_settings *settings,
- bool update_by_worker)
+ void main_window::notice_settings (bool update_by_worker)
{
- if (! settings)
- return;
+ gui_settings settings;
// Get desired style from preferences or take the default one if
// the desired one is not found
- QString preferred_style = settings->value (global_style).toString ();
+ QString preferred_style = settings.value (global_style).toString ();
if (preferred_style == global_style.def.toString ())
preferred_style = m_default_style;
@@ -938,7 +928,7 @@
}
// the widget's icons (when floating)
- QString icon_set = settings->value (dw_icon_set).toString ();
+ QString icon_set = settings.value (dw_icon_set).toString ();
QString icon;
for (auto *widget : dock_widget_list ())
@@ -954,26 +944,26 @@
}
}
- int size_idx = settings->value (global_icon_size).toInt ();
+ int size_idx = settings.value (global_icon_size).toInt ();
size_idx = (size_idx > 0) - (size_idx < 0) + 1; // Make valid index from 0 to 2
QStyle *st = style ();
int icon_size = st->pixelMetric (global_icon_sizes[size_idx]);
m_main_tool_bar->setIconSize (QSize (icon_size, icon_size));
- if (settings->value (global_status_bar).toBool ())
+ if (settings.value (global_status_bar).toBool ())
m_status_bar->show ();
else
m_status_bar->hide ();
m_prevent_readline_conflicts
- = settings->value (sc_prevent_rl_conflicts).toBool ();
+ = settings.value (sc_prevent_rl_conflicts).toBool ();
m_prevent_readline_conflicts_menu
- = settings->value (sc_prevent_rl_conflicts_menu).toBool ();
+ = settings.value (sc_prevent_rl_conflicts_menu).toBool ();
m_suppress_dbg_location
- = ! settings->value (cs_dbg_location).toBool ();
+ = ! settings.value (cs_dbg_location).toBool ();
resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
rmgr.update_network_settings ();
@@ -991,7 +981,7 @@
// Check whether some octave internal preferences have to be updated
QString new_default_encoding
- = settings->value (ed_default_enc).toString ();
+ = settings.value (ed_default_enc).toString ();
// Do not update internal pref only if a) this update was not initiated
// by the worker and b) the pref has really changes
if (! update_by_worker && (new_default_encoding != m_default_encoding))
@@ -1003,10 +993,10 @@
// getting the cursor blink preferences from all OS environments
bool cursor_blinking;
- if (settings->contains (global_cursor_blinking.key))
- cursor_blinking = settings->value (global_cursor_blinking).toBool ();
+ if (settings.contains (global_cursor_blinking.key))
+ cursor_blinking = settings.value (global_cursor_blinking).toBool ();
else
- cursor_blinking = settings->value (cs_cursor_blinking).toBool ();
+ cursor_blinking = settings.value (cs_cursor_blinking).toBool ();
if (cursor_blinking)
QApplication::setCursorFlashTime (1000); // 1000 ms flash time
@@ -1084,9 +1074,10 @@
{
// FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
int opts = QFileDialog::ShowDirsOnly;
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- if (! settings->value (global_use_native_dialogs).toBool ())
+
+ gui_settings settings;
+
+ if (! settings.value (global_use_native_dialogs).toBool ())
opts = QFileDialog::DontUseNativeDialog;
QString dir
@@ -1339,10 +1330,10 @@
// Open file isn't a file_editor_tab or editor function since the file
// might be opened in an external editor. Hence, functionality is here.
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
+
bool is_internal = m_editor_window
- && ! settings->value (global_use_custom_editor.key,
+ && ! settings.value (global_use_custom_editor.key,
global_use_custom_editor.def).toBool ();
// Create a NonModal message.
@@ -1358,7 +1349,7 @@
fileDialog->setDirectory (m_current_directory_combo_box->itemText (0));
// FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
- if (! settings->value (global_use_native_dialogs).toBool ())
+ if (! settings.value (global_use_native_dialogs).toBool ())
fileDialog->setOption(QFileDialog::DontUseNativeDialog);
connect (fileDialog, &QFileDialog::filesSelected,
@@ -1383,9 +1374,10 @@
// editor window or the main window. The latter is chosen, if a custom
// editor is used or qscintilla is not available
QWidget *p = m_editor_window;
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- if (! p || settings->value (global_use_custom_editor.key,
+
+ gui_settings settings;
+
+ if (! p || settings.value (global_use_custom_editor.key,
global_use_custom_editor.def).toBool ())
p = this;
QString new_name = QInputDialog::getText (p, tr ("New Function"),
@@ -1397,10 +1389,10 @@
if (new_name.rightRef (2) != ".m")
new_name.append (".m");
// check whether new files are created without prompt
- if (! settings->value (ed_create_new_file).toBool ())
+ if (! settings.value (ed_create_new_file).toBool ())
{
// no, so enable this settings and wait for end of new file loading
- settings->setValue (ed_create_new_file.key, true);
+ settings.setValue (ed_create_new_file.key, true);
connect (m_editor_window, SIGNAL (file_loaded_signal (void)),
this, SLOT (restore_create_file_setting (void)));
}
@@ -1546,24 +1538,18 @@
void main_window::read_settings (void)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
-
- if (! settings)
- {
- qDebug ("Error: gui_settings pointer from resource manager is NULL.");
- return;
- }
-
- set_window_layout (settings);
+ gui_settings settings;
+
+ set_window_layout ();
// restore the list of the last directories
- QStringList curr_dirs = settings->value (mw_dir_list).toStringList ();
+ QStringList curr_dirs = settings.value (mw_dir_list).toStringList ();
for (int i=0; i < curr_dirs.size (); i++)
{
m_current_directory_combo_box->addItem (curr_dirs.at (i));
}
- emit settings_changed (settings);
+
+ emit settings_changed ();
}
void main_window::init_terminal_size (void)
@@ -1571,15 +1557,17 @@
emit init_terminal_size_signal ();
}
- void main_window::set_window_layout (gui_settings *settings)
+ void main_window::set_window_layout (void)
{
+ gui_settings settings;
+
// For resetting from some inconsistent state, first reset layout
// without saving or showing it
do_reset_windows (true, false);
// Restore main window state and geometry from settings file or, in case
// of an error (no pref values yet), from the default layout.
- if (! restoreGeometry (settings->value (mw_geometry).toByteArray ()))
+ if (! restoreGeometry (settings.value (mw_geometry).toByteArray ()))
{
do_reset_windows (true);
return;
@@ -1608,7 +1596,7 @@
| Qt::WindowCloseButtonHint);
}
- if (! restoreState (settings->value (mw_state).toByteArray ()))
+ if (! restoreState (settings.value (mw_state).toByteArray ()))
{
do_reset_windows (true);
return;
@@ -1631,9 +1619,9 @@
bool floating = false;
bool visible = true;
- floating = settings->value
+ floating = settings.value
(dw_is_floating.key.arg (name), dw_is_floating.def).toBool ();
- visible = settings->value
+ visible = settings.value
(dw_is_visible.key.arg (name), dw_is_visible.def).toBool ();
// If floating, make window from widget.
@@ -1643,8 +1631,8 @@
if (visible)
{
- if (settings->value (dw_is_minimized.key.arg (name),
- dw_is_minimized.def).toBool ())
+ if (settings.value (dw_is_minimized.key.arg (name),
+ dw_is_minimized.def).toBool ())
widget->showMinimized ();
else
widget->setVisible (true);
@@ -1668,24 +1656,18 @@
void main_window::write_settings (void)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- if (! settings)
- {
- qDebug ("Error: gui_settings pointer from resource manager is NULL.");
- return;
- }
-
- settings->setValue (mw_geometry.key, saveGeometry ());
- settings->setValue (mw_state.key, saveState ());
+ gui_settings settings;
+
+ settings.setValue (mw_geometry.key, saveGeometry ());
+ settings.setValue (mw_state.key, saveState ());
// write the list of recently used directories
QStringList curr_dirs;
for (int i=0; icount (); i++)
{
curr_dirs.append (m_current_directory_combo_box->itemText (i));
}
- settings->setValue (mw_dir_list.key, curr_dirs);
- settings->sync ();
+ settings.setValue (mw_dir_list.key, curr_dirs);
+ settings.sync ();
}
void main_window::copyClipboard (void)
@@ -1751,30 +1733,27 @@
void main_window::handle_octave_ready (void)
{
// actions after the startup files are executed
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+
+ gui_settings settings;
QDir startup_dir = QDir (); // current octave dir after startup
- if (settings)
+ if (settings.value (global_restore_ov_dir).toBool ())
{
- if (settings->value (global_restore_ov_dir).toBool ())
- {
- // restore last dir from previous session
- QStringList curr_dirs
- = settings->value (mw_dir_list).toStringList ();
- if (curr_dirs.length () > 0)
- startup_dir = QDir (curr_dirs.at (0)); // last dir prev. session
- }
- else if (! settings->value (global_ov_startup_dir).toString ().isEmpty ())
- {
- // do not restore but there is a startup dir configured
- startup_dir
- = QDir (settings->value (global_ov_startup_dir).toString ());
- }
-
- update_default_encoding (settings->value (ed_default_enc).toString ());
+ // restore last dir from previous session
+ QStringList curr_dirs
+ = settings.value (mw_dir_list).toStringList ();
+ if (curr_dirs.length () > 0)
+ startup_dir = QDir (curr_dirs.at (0)); // last dir prev. session
}
+ else if (! settings.value (global_ov_startup_dir).toString ().isEmpty ())
+ {
+ // do not restore but there is a startup dir configured
+ startup_dir
+ = QDir (settings.value (global_ov_startup_dir).toString ());
+ }
+
+ update_default_encoding (settings.value (ed_default_enc).toString ());
if (! startup_dir.exists ())
{
@@ -1791,7 +1770,7 @@
// This can not be done when the editor is created because all functions
// must be known for the lexer's auto completion information
m_editor_window->empty_script (true, false);
- m_editor_window->restore_session (settings);
+ m_editor_window->restore_session ();
#endif
}
@@ -1823,7 +1802,7 @@
if (m_set_path_dlg) // m_set_path_dlg is a guarded pointer!
return;
- m_set_path_dlg = new set_path_dialog (this, m_octave_qobj);
+ m_set_path_dlg = new set_path_dialog (this);
m_set_path_dlg->setModal (false);
m_set_path_dlg->setAttribute (Qt::WA_DeleteOnClose);
@@ -1859,7 +1838,7 @@
if (! m_find_files_dlg)
{
- m_find_files_dlg = new find_files_dialog (this, m_octave_qobj);
+ m_find_files_dlg = new find_files_dialog (this);
connect (m_find_files_dlg, &find_files_dialog::finished,
this, &main_window::find_files_finished);
@@ -1928,9 +1907,10 @@
void main_window::restore_create_file_setting (void)
{
// restore the new files creation setting
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- settings->setValue (ed_create_new_file.key, false);
+
+ gui_settings settings;
+
+ settings.setValue (ed_create_new_file.key, false);
disconnect (m_editor_window, SIGNAL (file_loaded_signal (void)),
this, SLOT (restore_create_file_setting (void)));
}
@@ -2072,8 +2052,9 @@
connect (qApp, &QApplication::focusChanged,
this, &main_window::focus_changed);
+ // Default argument requires wrapper.
connect (this, &main_window::settings_changed,
- this, [=] (const gui_settings *settings) { notice_settings (settings); });
+ this, [=] () { notice_settings (); });
// Connections for signals from the interpreter thread where the slot
// should be executed by the gui thread
@@ -2216,10 +2197,10 @@
construct_new_menu (file_menu);
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+ gui_settings settings;
m_open_action = add_action (
- file_menu, rmgr.icon ("document-open"), tr ("Open..."),
+ file_menu, settings.icon ("document-open"), tr ("Open..."),
SLOT (request_open_file (void)), this);
m_open_action->setToolTip (tr ("Open an existing file in editor"));
@@ -2261,10 +2242,10 @@
{
QMenu *new_menu = p->addMenu (tr ("New"));
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+ gui_settings settings;
m_new_script_action = add_action (
- new_menu, rmgr.icon ("document-new"), tr ("New Script"),
+ new_menu, settings.icon ("document-new"), tr ("New Script"),
SLOT (request_new_script (void)), this);
m_new_function_action = add_action (
@@ -2282,20 +2263,21 @@
QKeySequence ctrl_shift = Qt::ControlModifier + Qt::ShiftModifier;
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+ gui_settings settings;
+
m_undo_action
- = edit_menu->addAction (rmgr.icon ("edit-undo"), tr ("Undo"));
+ = edit_menu->addAction (settings.icon ("edit-undo"), tr ("Undo"));
m_undo_action->setShortcutContext (Qt::ApplicationShortcut);
edit_menu->addSeparator ();
m_copy_action
- = edit_menu->addAction (rmgr.icon ("edit-copy"), tr ("Copy"), this,
+ = edit_menu->addAction (settings.icon ("edit-copy"), tr ("Copy"), this,
&main_window::copyClipboard);
m_copy_action->setShortcutContext (Qt::ApplicationShortcut);
m_paste_action
- = edit_menu->addAction (rmgr.icon ("edit-paste"), tr ("Paste"), this,
+ = edit_menu->addAction (settings.icon ("edit-paste"), tr ("Paste"), this,
&main_window::pasteClipboard);
m_paste_action->setShortcutContext (Qt::ApplicationShortcut);
@@ -2311,7 +2293,7 @@
edit_menu->addSeparator ();
m_find_files_action
- = edit_menu->addAction (rmgr.icon ("edit-find"), tr ("Find Files..."));
+ = edit_menu->addAction (settings.icon ("edit-find"), tr ("Find Files..."));
edit_menu->addSeparator ();
@@ -2330,7 +2312,7 @@
= edit_menu->addAction (tr ("Set Path"));
m_preferences_action
- = edit_menu->addAction (rmgr.icon ("preferences-system"),
+ = edit_menu->addAction (settings.icon ("preferences-system"),
tr ("Preferences..."));
connect (m_find_files_action, &QAction::triggered,
@@ -2368,8 +2350,9 @@
const QString& item,
const char *member)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- QAction *action = add_action (m_debug_menu, rmgr.icon (QString (icon)),
+ gui_settings settings;
+
+ QAction *action = add_action (m_debug_menu, settings.icon (QString (icon)),
item, member);
action->setEnabled (false);
@@ -2625,12 +2608,14 @@
// need to delete these upon destroying this main_window.
m_main_tool_bar->addWidget (new QLabel (tr ("Current Directory: ")));
m_main_tool_bar->addWidget (m_current_directory_combo_box);
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+
+ gui_settings settings;
+
QAction *current_dir_up
- = m_main_tool_bar->addAction (rmgr.icon ("folder-up", false, "go-up"),
+ = m_main_tool_bar->addAction (settings.icon ("folder-up", false, "go-up"),
tr ("One directory up"));
QAction *current_dir_search
- = m_main_tool_bar->addAction (rmgr.icon ("folder"),
+ = m_main_tool_bar->addAction (settings.icon ("folder"),
tr ("Browse directories"));
connect (m_current_directory_combo_box, SIGNAL (activated (const QString&)),
@@ -2652,9 +2637,9 @@
void main_window::focus_console_after_command (void)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- if (settings->value (cs_focus_cmd).toBool ())
+ gui_settings settings;
+
+ if (settings.value (cs_focus_cmd).toBool ())
focus_command_window ();
}
@@ -2902,11 +2887,10 @@
if (save)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
-
- settings->setValue (mw_geometry.key, saveGeometry ());
- settings->setValue (mw_state.key, saveState ());
+ gui_settings settings;
+
+ settings.setValue (mw_geometry.key, saveGeometry ());
+ settings.setValue (mw_state.key, saveState ());
}
focus_command_window ();
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/main-window.h
--- a/libgui/src/main-window.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/main-window.h Tue Dec 06 15:17:16 2022 -0500
@@ -52,7 +52,6 @@
#include "interpreter-qobject.h"
#include "led-indicator.h"
#include "octave-dock-widget.h"
-#include "octave-qobject.h"
#include "qt-interpreter-events.h"
#include "set-path-dialog.h"
#include "terminal-dock-widget.h"
@@ -65,6 +64,7 @@
{
class interpreter;
+ class base_qobject;
class settings_dialog;
//! Represents the main window.
@@ -99,7 +99,7 @@
void active_dock_changed (octave_dock_widget *, octave_dock_widget *);
void editor_focus_changed (bool);
- void settings_changed (const gui_settings *);
+ void settings_changed (void);
void init_terminal_size_signal (void);
void init_window_menu (void);
void new_file_signal (const QString&);
@@ -156,8 +156,7 @@
void process_settings_dialog_request (const QString& desired_tab
= QString ());
void show_about_octave (void);
- void notice_settings (const gui_settings *settings,
- bool update_by_worker = false);
+ void notice_settings (bool update_by_worker = false);
QPalette getFusionDarkPalette();
void prepare_to_exit (void);
void go_to_previous_widget (void);
@@ -199,7 +198,7 @@
void read_settings (void);
void init_terminal_size (void);
- void set_window_layout (gui_settings *settings);
+ void set_window_layout (void);
void write_settings (void);
void copyClipboard (void);
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/news-reader.cc
--- a/libgui/src/news-reader.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/news-reader.cc Tue Dec 06 15:17:16 2022 -0500
@@ -33,8 +33,8 @@
#include
#include "news-reader.h"
-#include "octave-qobject.h"
#include "gui-preferences-nr.h"
+#include "gui-settings.h"
#include "url-transfer.h"
#include "version.h"
@@ -68,16 +68,12 @@
{
if (m_serial >= 0)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
- if (settings)
- {
- settings->setValue (nr_last_time.key,
- QDateTime::currentDateTime ());
+ settings.setValue (nr_last_time.key,
+ QDateTime::currentDateTime ());
- settings->sync ();
- }
+ settings.sync ();
QString tag ("community-news-page-serial=");
@@ -95,13 +91,8 @@
if (curr_page_serial > m_serial)
{
- if (settings)
- {
- settings->setValue (nr_last_news.key,
- curr_page_serial);
-
- settings->sync ();
- }
+ settings.setValue (nr_last_news.key, curr_page_serial);
+ settings.sync ();
}
else
return;
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/news-reader.h
--- a/libgui/src/news-reader.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/news-reader.h Tue Dec 06 15:17:16 2022 -0500
@@ -31,18 +31,15 @@
namespace octave
{
- class base_qobject;
-
class news_reader : public QObject
{
Q_OBJECT
public:
- news_reader (base_qobject& oct_qobj, const QString& base_url,
- const QString& page, int serial = -1,
- bool connect_to_web = false)
- : QObject (), m_octave_qobj (oct_qobj), m_base_url (base_url),
+ news_reader (const QString& base_url, const QString& page,
+ int serial = -1, bool connect_to_web = false)
+ : QObject (), m_base_url (base_url),
m_page (page), m_serial (serial), m_connect_to_web (connect_to_web)
{ }
@@ -58,8 +55,6 @@
private:
- base_qobject& m_octave_qobj;
-
QString m_base_url;
QString m_page;
int m_serial;
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/octave-dock-widget.cc
--- a/libgui/src/octave-dock-widget.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/octave-dock-widget.cc Tue Dec 06 15:17:16 2022 -0500
@@ -73,13 +73,13 @@
}
}
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+ gui_settings settings;
// the custom (extra) title bar of the widget
m_title_widget = new QWidget ();
m_dock_action = new QAction
- (rmgr.icon ("widget-undock", true), "", this);
+ (settings.icon ("widget-undock", true), "", this);
m_dock_action->setToolTip (tr ("Undock widget"));
m_dock_button = new QToolButton (m_title_widget);
m_dock_button->setDefaultAction (m_dock_action);
@@ -87,7 +87,7 @@
m_dock_button->setIconSize (QSize (m_icon_size, m_icon_size));
m_close_action = new QAction
- (rmgr.icon ("widget-close", true), "", this);
+ (settings.icon ("widget-close", true), "", this);
m_close_action->setToolTip (tr ("Close widget"));
m_close_button = new QToolButton (m_title_widget);
m_close_button->setDefaultAction (m_close_action);
@@ -258,8 +258,7 @@
| QDockWidget::DockWidgetMovable
| QDockWidget::DockWidgetFloatable);
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- handle_settings (rmgr.get_settings ());
+ handle_settings ();
}
void
@@ -315,8 +314,9 @@
// adjust the (un)dock icon
if (titleBarWidget ())
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- m_dock_action->setIcon (rmgr.icon ("widget-dock" + m_icon_color, true));
+ gui_settings settings;
+
+ m_dock_action->setIcon (settings.icon ("widget-dock" + m_icon_color, true));
m_dock_action->setToolTip (tr ("Dock widget"));
}
else
@@ -343,15 +343,15 @@
void
octave_dock_widget::make_widget (bool)
{
+ gui_settings settings;
+
bool vis = isVisible ();
// Since floating widget has no parent, we have to read it
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
if (m_main_window)
{
- settings->setValue (mw_state.key, m_main_window->saveState ());
+ settings.setValue (mw_state.key, m_main_window->saveState ());
// Stay window, otherwise will bounce back to window by default
// because there is no layout information for this widget in the
@@ -360,7 +360,7 @@
m_main_window->addDockWidget (Qt::BottomDockWidgetArea, this);
m_adopted = false;
// recover old window states, hide and re-show new added widget
- m_main_window->restoreState (settings->value (mw_state.key).toByteArray ());
+ m_main_window->restoreState (settings.value (mw_state.key).toByteArray ());
setFloating (false);
// restore size using setGeometry instead of restoreGeometry
// following this post:
@@ -374,7 +374,7 @@
this, &octave_dock_widget::make_window);
if (titleBarWidget ())
{
- m_dock_action->setIcon (rmgr.icon ("widget-undock" + m_icon_color, true));
+ m_dock_action->setIcon (settings.icon ("widget-undock" + m_icon_color, true));
m_dock_action->setToolTip (tr ("Undock widget"));
}
else
@@ -472,28 +472,27 @@
}
void
- octave_dock_widget::handle_settings (const gui_settings *settings)
+ octave_dock_widget::handle_settings (void)
{
- if (! settings)
- return;
+ gui_settings settings;
- m_focus_follows_mouse = settings->value (dw_focus_follows_mouse).toBool ();
+ m_focus_follows_mouse = settings.value (dw_focus_follows_mouse).toBool ();
m_custom_style
- = settings->value (dw_title_custom_style).toBool ();
+ = settings.value (dw_title_custom_style).toBool ();
- m_title_3d = settings->value (dw_title_3d.key, dw_title_3d.def).toInt ();
+ m_title_3d = settings.value (dw_title_3d.key, dw_title_3d.def).toInt ();
m_fg_color
- = settings->value (dw_title_fg_color).value ();
+ = settings.value (dw_title_fg_color).value ();
m_fg_color_active
- = settings->value (dw_title_fg_color_active).value ();
+ = settings.value (dw_title_fg_color_active).value ();
- m_bg_color = settings->value (dw_title_bg_color).value ();
+ m_bg_color = settings.value (dw_title_bg_color).value ();
m_bg_color_active
- = settings->value (dw_title_bg_color_active).value ();
+ = settings.value (dw_title_bg_color_active).value ();
QColor bcol (m_bg_color);
QColor bcola (m_bg_color_active);
@@ -536,7 +535,7 @@
}
m_recent_float_geom
- = settings->value (dw_float_geometry.key.arg (objectName ()),
+ = settings.value (dw_float_geometry.key.arg (objectName ()),
default_floating_size).toRect ();
adjust_to_screen (m_recent_float_geom, default_floating_size);
@@ -545,14 +544,14 @@
// saveGeomety to new QRect setting (see comment for restoring size
// of docked widgets)
QVariant dock_geom
- = settings->value (dw_dock_geometry.key.arg (objectName ()),
- default_dock_size);
+ = settings.value (dw_dock_geometry.key.arg (objectName ()),
+ default_dock_size);
if (dock_geom.canConvert (QMetaType::QRect))
m_recent_dock_geom = dock_geom.toRect ();
else
m_recent_dock_geom = dw_dock_geometry.def.toRect ();
- notice_settings (settings); // call individual handler
+ notice_settings (); // call individual handler
set_style (false);
@@ -587,27 +586,24 @@
void
octave_dock_widget::save_settings (void)
{
+ gui_settings settings;
+
// save state of this dock-widget
QString name = objectName ();
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
-
- if (! settings)
- return;
store_geometry ();
// conditional needed?
if (! m_recent_float_geom.isNull ())
- settings->setValue (dw_float_geometry.key.arg (name), m_recent_float_geom);
+ settings.setValue (dw_float_geometry.key.arg (name), m_recent_float_geom);
if (! m_recent_dock_geom.isEmpty ())
- settings->setValue (dw_dock_geometry.key.arg (name), m_recent_dock_geom);
- settings->setValue (dw_is_visible.key.arg (name), isVisible ()); // store visibility
- settings->setValue (dw_is_floating.key.arg (name), isFloating ()); // store floating
- settings->setValue (dw_is_minimized.key.arg (name), isMinimized ()); // store minimized
+ settings.setValue (dw_dock_geometry.key.arg (name), m_recent_dock_geom);
+ settings.setValue (dw_is_visible.key.arg (name), isVisible ()); // store visibility
+ settings.setValue (dw_is_floating.key.arg (name), isFloating ()); // store floating
+ settings.setValue (dw_is_minimized.key.arg (name), isMinimized ()); // store minimized
- settings->sync ();
+ settings.sync ();
}
bool octave_dock_widget::eventFilter (QObject *obj, QEvent *e)
@@ -805,13 +801,14 @@
QString full_close_icon = "widget-close" + icon_col;
if (titleBarWidget ())
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+ gui_settings settings;
+
titleBarWidget ()->setStyleSheet (css_foreground + css_background);
css_button = QString ("QToolButton {background: transparent; border: 0px;}");
m_dock_button->setStyleSheet (css_button);
m_close_button->setStyleSheet (css_button);
- m_dock_action->setIcon (rmgr.icon (full_dock_icon, true));
- m_close_action->setIcon (rmgr.icon (full_close_icon, true));
+ m_dock_action->setIcon (settings.icon (full_dock_icon, true));
+ m_close_action->setIcon (settings.icon (full_close_icon, true));
}
else
{
@@ -834,26 +831,5 @@
m_predecessor_widget->setFocus ();
m_predecessor_widget = nullptr;
-
- // FIXME: Until cset bda0c5b38bda, the wrong keys "Dockwidget/..." were used
- // here. This had no effect in Qt4, but does in Qt5. In the following, the
- // four incorrect keys are updated if still present in the settings files.
- // The keys are also used in the settings dialog, but
- // octave_dock_widget::handle_settings is already called at program start.
- // These tests can be removed in a future version of Octave (version 6).
-
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
-
- rmgr.update_settings_key ("Dockwidgets/title_bg_color",
- dw_title_bg_color.key);
-
- rmgr.update_settings_key ("Dockwidgets/title_bg_color_active",
- dw_title_bg_color_active.key);
-
- rmgr.update_settings_key ("Dockwidgets/title_fg_color",
- dw_title_fg_color.key);
-
- rmgr.update_settings_key ("Dockwidgets/title_fg_color_active",
- dw_title_fg_color_active.key);
}
}
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/octave-dock-widget.h
--- a/libgui/src/octave-dock-widget.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/octave-dock-widget.h Tue Dec 06 15:17:16 2022 -0500
@@ -31,7 +31,6 @@
#include
#include
-#include "gui-settings.h"
#include "qt-interpreter-events.h"
namespace octave
@@ -126,13 +125,13 @@
virtual void handle_visibility (bool visible);
- virtual void notice_settings (const gui_settings *) { }
+ virtual void notice_settings (void) { }
virtual void save_settings (void);
void init_window_menu_entry (void);
- void handle_settings (const gui_settings *);
+ void handle_settings (void);
void handle_active_dock_changed (octave_dock_widget *, octave_dock_widget *);
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/octave-qobject.cc
--- a/libgui/src/octave-qobject.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/octave-qobject.cc Tue Dec 06 15:17:16 2022 -0500
@@ -46,6 +46,7 @@
#include "community-news.h"
#include "documentation-dock-widget.h"
#include "files-dock-widget.h"
+#include "gui-settings.h"
#include "history-dock-widget.h"
#include "interpreter-qobject.h"
#include "main-window.h"
@@ -176,7 +177,7 @@
m_argv (m_app_context.sys_argv ()),
m_qapplication (new octave_qapplication (m_argc, m_argv)),
m_resource_manager (),
- m_shortcut_manager (*this),
+ m_shortcut_manager (),
m_qt_tr (new QTranslator ()),
m_gui_tr (new QTranslator ()),
m_qsci_tr (new QTranslator ()),
@@ -208,11 +209,6 @@
QTextCodec::setCodecForLocale (QTextCodec::codecForName ("UTF-8"));
#endif
- // Initialize global Qt application metadata.
-
- QCoreApplication::setApplicationName ("GNU Octave");
- QCoreApplication::setApplicationVersion (OCTAVE_VERSION);
-
// Register octave_value_list for connecting thread crossing signals.
qRegisterMetaType ("octave_value_list");
@@ -311,11 +307,14 @@
else
{
// Get settings file.
- m_resource_manager.reload_settings ();
+ gui_settings settings;
+
+ settings.reload ();
// After settings.
config_translators ();
- m_resource_manager.config_icon_theme ();
+
+ settings.config_icon_theme ();
// Initilize the shortcut-manager
m_shortcut_manager.init_data ();
@@ -731,7 +730,7 @@
{
if (! m_community_news)
m_community_news
- = QPointer (new community_news (*this, serial));
+ = QPointer (new community_news (serial));
return m_community_news;
}
@@ -739,7 +738,7 @@
QPointer base_qobject::release_notes_widget (void)
{
if (! m_release_notes)
- m_release_notes = QPointer (new release_notes (*this));
+ m_release_notes = QPointer (new release_notes ());
return m_release_notes;
}
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/qt-application.cc
--- a/libgui/src/qt-application.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/qt-application.cc Tue Dec 06 15:17:16 2022 -0500
@@ -27,6 +27,10 @@
# include "config.h"
#endif
+#include
+#include
+#include
+
#include "main-window.h"
#include "octave-qobject.h"
#include "qt-application.h"
@@ -42,6 +46,31 @@
namespace octave
{
+ qt_application::qt_application (const std::string& organization_name,
+ const std::string& application_name,
+ const std::string& application_version,
+ int argc, char **argv)
+ : application (argc, argv)
+ {
+ if (! organization_name.empty ())
+ QCoreApplication::setOrganizationName
+ (QString::fromStdString (organization_name));
+
+ if (! application_name.empty ())
+ QCoreApplication::setApplicationName
+ (QString::fromStdString (application_name));
+
+ if (! application_version.empty ())
+ QCoreApplication::setApplicationVersion
+ (QString::fromStdString (application_version));
+
+ // FIXME: Is there a better place for this?
+ QSettings::setDefaultFormat (QSettings::IniFormat);
+
+ // This should probably happen early.
+ sysdep_init ();
+ }
+
qt_application::qt_application (int argc, char **argv)
: application (argc, argv)
{
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/qt-application.h
--- a/libgui/src/qt-application.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/qt-application.h Tue Dec 06 15:17:16 2022 -0500
@@ -26,6 +26,8 @@
#if ! defined (octave_qt_application_h)
#define octave_qt_application_h 1
+#include
+
#include "octave.h"
namespace octave
@@ -45,6 +47,11 @@
{
public:
+ qt_application (const std::string& organization_name,
+ const std::string& application_name,
+ const std::string& application_version,
+ int argc, char **argv);
+
qt_application (int argc, char **argv);
// No copying, at least not yet.
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/qt-interpreter-events.cc
--- a/libgui/src/qt-interpreter-events.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/qt-interpreter-events.cc Tue Dec 06 15:17:16 2022 -0500
@@ -39,6 +39,7 @@
#include "dialog.h"
#include "gui-preferences-ed.h"
+#include "gui-settings.h"
#include "octave-qobject.h"
#include "qt-interpreter-events.h"
#include "qt-utils.h"
@@ -109,7 +110,7 @@
qt_interpreter_events::qt_interpreter_events (base_qobject& oct_qobj)
: interpreter_events (), m_octave_qobj (oct_qobj),
- m_uiwidget_creator (oct_qobj), m_result (), m_mutex (),
+ m_uiwidget_creator (), m_result (), m_mutex (),
m_waitcondition ()
{
qRegisterMetaType ("QIntList");
@@ -323,10 +324,9 @@
bool qt_interpreter_events::prompt_new_edit_file (const std::string& file)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
- if (! settings || settings->value (ed_create_new_file).toBool ())
+ if (settings.value (ed_create_new_file).toBool ())
return true;
std::string abs_fname = sys::env::make_absolute (file);
@@ -438,8 +438,9 @@
{
QMutexLocker autolock (&m_mutex);
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- m_result = QVariant::fromValue (rmgr.icon (name));
+ gui_settings settings;
+
+ m_result = QVariant::fromValue (settings.icon (name));
wake_all ();
}
@@ -684,10 +685,9 @@
{
QMutexLocker autolock (&m_mutex);
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
- QString read_value = settings->value (key).toString ();
+ QString read_value = settings.value (key).toString ();
// Some preferences need extra handling
QString adjusted_value = gui_preference_adjust (key, value);
@@ -695,9 +695,9 @@
if (! adjusted_value.isEmpty () && (read_value != adjusted_value))
{
// Change settings only for new, non-empty values
- settings->setValue (key, QVariant (adjusted_value));
+ settings.setValue (key, QVariant (adjusted_value));
- emit settings_changed (settings, true); // true: changed by worker
+ emit settings_changed (true); // true: changed by worker
}
m_result = read_value;
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/qt-interpreter-events.h
--- a/libgui/src/qt-interpreter-events.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/qt-interpreter-events.h Tue Dec 06 15:17:16 2022 -0500
@@ -36,7 +36,6 @@
#include
#include "dialog.h"
-#include "gui-settings.h"
#include "event-manager.h"
@@ -303,7 +302,7 @@
void get_named_icon_signal (const QString& name);
- void settings_changed (const gui_settings *, bool);
+ void settings_changed (bool);
void apply_new_settings (void);
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/release-notes.cc
--- a/libgui/src/release-notes.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/release-notes.cc Tue Dec 06 15:17:16 2022 -0500
@@ -40,22 +40,22 @@
#include "gui-utils.h"
#include "gui-preferences-dw.h"
#include "gui-preferences-nr.h"
+#include "gui-settings.h"
#include "news-reader.h"
-#include "octave-qobject.h"
#include "defaults.h"
namespace octave
{
- release_notes::release_notes (base_qobject& oct_qobj)
+ release_notes::release_notes (void)
: QWidget (nullptr), m_browser (nullptr)
{
- resource_manager& rmgr = oct_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
// The icon
- QString icon_set = settings->value (dw_icon_set).toString ();
+ QString icon_set = settings.value (dw_icon_set).toString ();
+
if (icon_set != "NONE")
m_release_notes_icon = dw_icon_set_names[icon_set]
+ "ReleaseWidget.png";
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/release-notes.h
--- a/libgui/src/release-notes.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/release-notes.h Tue Dec 06 15:17:16 2022 -0500
@@ -33,15 +33,13 @@
namespace octave
{
- class base_qobject;
-
class release_notes : public QWidget
{
Q_OBJECT
public:
- release_notes (base_qobject& qct_qobj);
+ release_notes (void);
~release_notes (void) = default;
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/resource-manager.cc
--- a/libgui/src/resource-manager.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/resource-manager.cc Tue Dec 06 15:17:16 2022 -0500
@@ -33,12 +33,10 @@
#include
#include
+#include
#include
#include
-#include
-#include
#include
-#include
#include
#include
@@ -48,7 +46,7 @@
#include "gui-preferences-cs.h"
#include "gui-preferences-ed.h"
#include "gui-preferences-global.h"
-#include "octave-qobject.h"
+#include "gui-settings.h"
#include "resource-manager.h"
#include "variable-editor.h"
#include "workspace-model.h"
@@ -58,70 +56,15 @@
#include "oct-env.h"
#include "defaults.h"
-#include "error.h"
-#include "help.h"
namespace octave
{
resource_manager::resource_manager (void)
- : m_settings_directory (), m_settings_file (), m_settings (nullptr),
- m_default_settings (nullptr), m_temporary_files (), m_icon_fallbacks ()
- {
- // Let gui_settings decide where to put the ini file with gui preferences
- m_default_settings
- = new gui_settings (QSettings::IniFormat, QSettings::UserScope,
- "octave", "octave-gui");
-
- m_settings_file = m_default_settings->fileName ();
-
- QFileInfo sfile (m_settings_file);
- m_settings_directory = sfile.absolutePath ();
-
- QString xdg_config_home
- = QString::fromLocal8Bit (qgetenv ("XDG_CONFIG_HOME"));
-
- if ((! sfile.exists ()) && xdg_config_home.isEmpty ())
- {
- // File does not exist yet: Look for a settings file at the old
- // location ($HOME/.config/octave/qt-settings) for impoting all
- // available keys into the new settings file.
- // Do not look for an old settings file if XDG_CONFIG_HOME is set,
- // since then a nonexistent new settings file does not necessarily
- // indicate a first run of octave with new config file locations.
-#if defined (HAVE_QSTANDARDPATHS)
- QString home_path
- = QStandardPaths::writableLocation (QStandardPaths::HomeLocation);
-#else
- QString home_path
- = QDesktopServices::storageLocation (QDesktopServices::HomeLocation);
-#endif
-
- QString old_settings_directory = home_path + "/.config/octave";
- QString old_settings_file = old_settings_directory + "/qt-settings";
-
- QFile ofile (old_settings_file);
-
- if (ofile.exists ())
- {
- // Old settings file exists; create a gui_settings object related
- // to it and copy all available keys to the new settings
- gui_settings old_settings (old_settings_file, QSettings::IniFormat);
-
- QStringList keys = old_settings.allKeys ();
- for (int i = 0; i < keys.count(); i++)
- m_default_settings->setValue (keys.at(i),
- old_settings.value(keys.at(i)));
-
- m_default_settings->sync (); // Done, make sure keys are written
- }
- }
- }
+ : m_temporary_files ()
+ { }
resource_manager::~resource_manager (void)
{
- delete m_settings;
- delete m_default_settings;
-
for (int i = m_temporary_files.count () - 1; i >=0; i--)
remove_tmp_file (m_temporary_files.at (i));
}
@@ -131,7 +74,7 @@
// get environment variable for the locale dir (e.g. from run-octave)
std::string dldir = sys::env::getenv ("OCTAVE_LOCALE_DIR");
if (dldir.empty ())
- dldir = config::oct_locale_dir (); // env-var empty, load the default location
+ dldir = config::oct_locale_dir (); // env-var empty, load the default location
return QString::fromStdString (dldir);
}
@@ -149,12 +92,11 @@
// FIXME: can we somehow ensure that the settings object will always
// be initialize and valid?
- if (m_settings)
- {
- // get the locale from the settings if already available
- language = m_settings->value (global_language.key,
- global_language.def).toString ();
- }
+ gui_settings settings;
+
+ // get the locale from the settings if already available
+ language = settings.value (global_language.key,
+ global_language.def).toString ();
// load the translations depending on the settings
if (language == "SYSTEM")
@@ -171,11 +113,11 @@
{
// load the translation files depending on the given locale name
loaded = qt_tr->load ("qt_" + language, qt_trans_dir);
- if (! loaded) // try lower case
+ if (! loaded) // try lower case
qt_tr->load ("qt_" + language.toLower (), qt_trans_dir);
loaded = qsci_tr->load ("qscintilla_" + language, qt_trans_dir);
- if (! loaded) // try lower case
+ if (! loaded) // try lower case
qsci_tr->load ("qscintilla_" + language.toLower (), qt_trans_dir);
gui_tr->load (language, get_gui_translation_dir ());
@@ -183,216 +125,6 @@
}
- void resource_manager::config_icon_theme (void)
- {
- m_icon_fallbacks.clear ();
-
- int theme = global_icon_theme_index.def.toInt ();
-
- if (m_settings)
- {
- // check for new and old setting and use old if required
- if (! m_settings->contains (global_icon_theme_index.key))
- {
- // new pref does not exist
- if (m_settings->value (global_icon_theme).toBool ())
- theme = ICON_THEME_SYSTEM;
- else
- theme = ICON_THEME_OCTAVE;
- m_settings->setValue (global_icon_theme_index.key, theme); // add new
- m_settings->remove (global_icon_theme.key); // remove deprecated key
- }
- else
- {
- // get new settings
- theme = m_settings->value (global_icon_theme_index).toInt ();
- }
- }
-
- QIcon::setThemeName (global_all_icon_themes.at (theme));
-
- // set the required fallback search paths
- switch (theme)
- {
- case ICON_THEME_SYSTEM:
- m_icon_fallbacks << global_icon_paths.at (ICON_THEME_OCTAVE);
- m_icon_fallbacks << global_icon_paths.at (ICON_THEME_TANGO);
- break;
- case ICON_THEME_TANGO:
- m_icon_fallbacks << global_icon_paths.at (ICON_THEME_OCTAVE);
- break;
- case ICON_THEME_OCTAVE:
- m_icon_fallbacks << global_icon_paths.at (ICON_THEME_TANGO);
- break;
- }
-
- m_icon_fallbacks << global_icon_paths.at (ICON_THEME_CURSORS);
- }
-
- gui_settings * resource_manager::get_settings (void) const
- {
- if (! m_settings)
- {
- QString msg (QT_TR_NOOP ("Octave has lost its settings.\n"
- "This should not happen.\n\n"
- "Please report this bug.\n\n"
- "Octave GUI must be closed now."));
-
- QMessageBox::critical (nullptr,
- QString (QT_TR_NOOP ("Octave Critical Error")),
- msg);
- exit (1);
- }
-
- return m_settings;
- }
-
- gui_settings * resource_manager::get_default_settings (void) const
- {
- if (! m_default_settings)
- {
- QString msg (QT_TR_NOOP ("Octave has lost its default settings.\n"
- "This should not happen.\n"
- "Please report this bug.\n\n"
- "Octave GUI must be closed now."));
-
- QMessageBox::critical (nullptr,
- QString (QT_TR_NOOP ("Octave Critical Error")),
- msg);
- exit (1);
- }
-
- return m_default_settings;
- }
-
- QString resource_manager::get_settings_directory (void)
- {
- return m_settings_directory;
- }
-
- QString resource_manager::get_settings_file (void)
- {
- return m_settings_file;
- }
-
- QString resource_manager::get_default_font_family (void)
- {
- QString default_family;
-
- // Get all available fixed width fonts via a font combobox
- QFontComboBox font_combo_box;
- font_combo_box.setFontFilters (QFontComboBox::MonospacedFonts);
- QStringList fonts;
-
- for (int index = 0; index < font_combo_box.count(); index++)
- fonts << font_combo_box.itemText(index);
-
-#if defined (Q_OS_MAC)
- // Use hard coded default on macOS, since selection of fixed width
- // default font is unreliable (see bug #59128).
- // Test for macOS default fixed width font
- if (fonts.contains (global_mono_font.def.toString ()))
- default_family = global_mono_font.def.toString ();
-#endif
-
- // If default font is still empty (on all other platforms or
- // if macOS default font is not available): use QFontDatabase
- if (default_family.isEmpty ())
- {
- // Get the system's default monospaced font
- QFont fixed_font = QFontDatabase::systemFont (QFontDatabase::FixedFont);
- default_family = fixed_font.defaultFamily ();
-
- // Since this might be unreliable, test all available fixed width fonts
- if (! fonts.contains (default_family))
- {
- // Font returned by QFontDatabase is not in fixed fonts list.
- // Fallback: take first from this list
- default_family = fonts[0];
- }
- }
-
- // Test env variable which has preference
- std::string env_default_family = sys::env::getenv ("OCTAVE_DEFAULT_FONT");
- if (! env_default_family.empty ())
- default_family = QString::fromStdString (env_default_family);
-
- return default_family;
- }
-
- QStringList resource_manager::get_default_font (void)
- {
- QString default_family = get_default_font_family ();
-
- // determine the fefault font size of the system
- // FIXME: QApplication::font () does not return the monospace font,
- // but the size should be probably near to the monospace font
- QFont font = QApplication::font ();
-
- int font_size = font.pointSize ();
- if (font_size == -1)
- font_size = static_cast (std::floor(font.pointSizeF ()));
-
- // check for valid font size, otherwise take default 10
- QString default_font_size = "10";
- if (font_size > 0)
- default_font_size = QString::number (font_size);
-
- std::string env_default_font_size
- = sys::env::getenv ("OCTAVE_DEFAULT_FONT_SIZE");
-
- if (! env_default_font_size.empty ())
- default_font_size = QString::fromStdString (env_default_font_size);
-
- QStringList result;
- result << default_family;
- result << default_font_size;
- return result;
- }
-
- void resource_manager::reload_settings (void)
- {
- // Declare some empty options, which may be set at first startup for
- // writing them into the newly created settings file
- QString custom_editor;
- QStringList def_font;
-
- // Check whether the settings file does not yet exist
- if (! QFile::exists (m_settings_file))
- {
- // Get the default font (for terminal)
- def_font = get_default_font ();
-
- // Get a custom editor defined as env variable
- std::string env_default_editor
- = sys::env::getenv ("OCTAVE_DEFAULT_EDITOR");
-
- if (! env_default_editor.empty ())
- custom_editor = QString::fromStdString (env_default_editor);
- }
-
- set_settings (m_settings_file);
-
- // Write some settings that were dynamically determined at first startup
- if (m_settings)
- {
- // Custom editor
- if (! custom_editor.isEmpty ())
- m_settings->setValue (global_custom_editor.key, custom_editor);
-
- // Default monospace font for the terminal
- if (def_font.count () > 1)
- {
- m_settings->setValue (cs_font.key, def_font[0]);
- m_settings->setValue (cs_font_size.key, def_font[1].toInt ());
- }
-
- // Write the default monospace font into the settings for later use by
- // console and editor as fallbacks of their font preferences.
- m_settings->setValue (global_mono_font.key, get_default_font_family ());
- }
- }
-
#if defined (HAVE_QSCINTILLA)
int resource_manager::get_valid_lexer_styles (QsciLexer *lexer, int *styles)
{
@@ -422,9 +154,10 @@
#if defined (HAVE_QSCINTILLA)
void resource_manager::read_lexer_settings (QsciLexer *lexer,
- gui_settings *settings,
int mode, int def)
{
+ gui_settings settings;
+
// Test whether the settings for lexer is already contained in the
// given gui settings file. If yes, load them, if not copy them from the
// default settings file.
@@ -436,13 +169,13 @@
QString group ("Scintilla" + settings_color_modes_ext[m]);
- settings->beginGroup (group);
- settings->beginGroup (lexer->language ());
+ settings.beginGroup (group);
+ settings.beginGroup (lexer->language ());
- QStringList lexer_keys = settings->allKeys ();
+ QStringList lexer_keys = settings.allKeys ();
- settings->endGroup ();
- settings->endGroup ();
+ settings.endGroup ();
+ settings.endGroup ();
if (def == settings_reload_default_colors_flag || lexer_keys.count () == 0)
{
@@ -452,7 +185,7 @@
// and convert the color by inverting the lightness
// Get the default font
- QStringList def_font = get_default_font ();
+ QStringList def_font = settings.get_default_font ();
QFont df (def_font[0], def_font[1].toInt ());
QFont dfa = copy_font_attributes (lexer->defaultFont (), df);
lexer->setDefaultFont (dfa);
@@ -464,9 +197,9 @@
for (int i = 0; i < max_style; i++)
{
- c = settings->get_color_value (QVariant (lexer->color (styles[i])), m);
+ c = settings.get_color_value (QVariant (lexer->color (styles[i])), m);
lexer->setColor (c, styles[i]);
- p = settings->get_color_value (QVariant (lexer->paper (styles[i])), m);
+ p = settings.get_color_value (QVariant (lexer->paper (styles[i])), m);
lexer->setPaper (p, styles[i]);
dfa = copy_font_attributes (lexer->font (styles[i]), df);
lexer->setFont (dfa, styles[i]);
@@ -479,75 +212,37 @@
if (def != settings_reload_default_colors_flag)
{
const std::string group_str = group.toStdString ();
- lexer->writeSettings (*settings, group_str.c_str ());
- settings->sync ();
+ lexer->writeSettings (settings, group_str.c_str ());
+ settings.sync ();
}
}
else
{
// Found lexer keys, read the settings
const std::string group_str = group.toStdString ();
- lexer->readSettings (*settings, group_str.c_str ());
+ lexer->readSettings (settings, group_str.c_str ());
}
}
#endif
- void resource_manager::set_settings (const QString& file)
- {
- delete m_settings;
- m_settings = new gui_settings (file, QSettings::IniFormat);
-
- if (m_settings->status () == QSettings::NoError)
- {
- // Test usability (force file to be really created)
- m_settings->setValue ("dummy", 0);
- m_settings->sync ();
- }
-
- if (! (QFile::exists (m_settings->fileName ())
- && m_settings->isWritable ()
- && m_settings->status () == QSettings::NoError))
- {
- QString msg
- = QString (QT_TR_NOOP ("The settings file\n%1\n"
- "does not exist and can not be created.\n"
- "Make sure you have read and write permissions to\n%2\n\n"
- "Octave GUI must be closed now."));
-
- QMessageBox::critical (nullptr,
- QString (QT_TR_NOOP ("Octave Critical Error")),
- msg.arg (get_settings_file ()).arg (get_settings_directory ()));
-
- exit (1);
- }
- else
- m_settings->remove ("dummy"); // Remove test entry
- }
-
bool resource_manager::update_settings_key (const QString& old_key,
const QString& new_key)
{
- if (m_settings->contains (old_key))
+ gui_settings settings;
+
+ if (settings.contains (old_key))
{
- QVariant preference = m_settings->value (old_key);
- m_settings->setValue (new_key, preference);
- m_settings->remove (old_key);
+ QVariant preference = settings.value (old_key);
+ settings.setValue (new_key, preference);
+ settings.remove (old_key);
return true;
}
return false;
}
- bool resource_manager::is_first_run (void) const
- {
- return ! QFile::exists (m_settings_file);
- }
-
void resource_manager::update_network_settings (void)
{
- if (! m_settings)
- return;
-
QNetworkProxy proxy;
// Assume no proxy and empty proxy data
@@ -559,11 +254,13 @@
QString pass;
QUrl proxy_url = QUrl ();
- if (m_settings->value (global_use_proxy.key, global_use_proxy.def).toBool ())
+ gui_settings settings;
+
+ if (settings.value (global_use_proxy.key, global_use_proxy.def).toBool ())
{
// Use a proxy, collect all required information
QString proxy_type_string
- = m_settings->value (global_proxy_type.key, global_proxy_type.def).toString ();
+ = settings.value (global_proxy_type.key, global_proxy_type.def).toString ();
// The proxy type for the Qt proxy settings
if (proxy_type_string == "Socks5Proxy")
@@ -575,14 +272,14 @@
if (proxy_type_string == "HttpProxy"
|| proxy_type_string == "Socks5Proxy")
{
- host = m_settings->value (global_proxy_host.key,
- global_proxy_host.def).toString ();
- port = m_settings->value (global_proxy_port.key,
- global_proxy_port.def).toInt ();
- user = m_settings->value (global_proxy_user.key,
- global_proxy_user.def).toString ();
- pass = m_settings->value (global_proxy_pass.key,
- global_proxy_pass.def).toString ();
+ host = settings.value (global_proxy_host.key,
+ global_proxy_host.def).toString ();
+ port = settings.value (global_proxy_port.key,
+ global_proxy_port.def).toInt ();
+ user = settings.value (global_proxy_user.key,
+ global_proxy_user.def).toString ();
+ pass = settings.value (global_proxy_pass.key,
+ global_proxy_pass.def).toString ();
if (proxy_type_string == "HttpProxy")
scheme = "http";
else if (proxy_type_string == "Socks5Proxy")
@@ -651,28 +348,6 @@
sys::env::putenv ("HTTPS_PROXY", proxy_url_str);
}
- QIcon resource_manager::icon (const QString& icon_name, bool octave_only,
- const QString& icon_alt_name)
- {
- if (octave_only)
- return QIcon (global_icon_paths.at (ICON_THEME_OCTAVE) + icon_name + ".png");
-
- if (QIcon::hasThemeIcon (icon_name))
- return QIcon (QIcon::fromTheme (icon_name));
- else if ((! icon_alt_name.isEmpty ()) && QIcon::hasThemeIcon (icon_alt_name))
- return QIcon (QIcon::fromTheme (icon_alt_name));
-
- for (int i = 0; i < m_icon_fallbacks.length (); i++ )
- {
- QString icon_file (m_icon_fallbacks.at (i) + icon_name + ".png");
- if (QFile (icon_file).exists ())
- return QIcon (icon_file);
- }
-
- //QIcon::setThemeName (current_theme);
- return QIcon ();
- }
-
// get a list of all available encodings
void resource_manager::get_codecs (QStringList *codecs)
{
@@ -721,7 +396,9 @@
if (enc.isEmpty ())
{
- enc = m_settings->value (ed_default_enc).toString ();
+ gui_settings settings;
+
+ enc = settings.value (ed_default_enc).toString ();
if (enc.isEmpty ()) // still empty?
{
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/resource-manager.h
--- a/libgui/src/resource-manager.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/resource-manager.h Tue Dec 06 15:17:16 2022 -0500
@@ -27,7 +27,6 @@
#define octave_resource_manager_h 1
#include
-#include
#include
#if defined (HAVE_QSCINTILLA)
# include
@@ -35,8 +34,6 @@
#include
#include
-#include "gui-settings.h"
-
namespace octave
{
class resource_manager : public QObject
@@ -61,19 +58,6 @@
void config_translators (QTranslator *qt_tr, QTranslator *qsci_tr,
QTranslator *gui_tr);
- void config_icon_theme (void);
-
- gui_settings * get_settings (void) const;
-
- gui_settings * get_default_settings (void) const;
-
- QString get_settings_directory (void);
-
- QString get_settings_file (void);
-
- QString get_default_font_family (void);
-
- QStringList get_default_font (void);
QPointer
create_tmp_file (const QString& extension = QString (),
@@ -81,25 +65,15 @@
void remove_tmp_file (QPointer tmp_file);
- void reload_settings (void);
-
#if defined (HAVE_QSCINTILLA)
int get_valid_lexer_styles (QsciLexer *lexer, int *styles);
- void read_lexer_settings (QsciLexer *lexer, gui_settings *settings,
- int mode = 0, int def = 0);
+ void read_lexer_settings (QsciLexer *lexer, int mode = 0, int def = 0);
#endif
- void set_settings (const QString& file);
-
bool update_settings_key (const QString& new_key, const QString& old_key);
- bool is_first_run (void) const;
-
void update_network_settings (void);
- QIcon icon (const QString& icon_name, bool octave_only = false,
- const QString& icon_alt_name = QString ());
-
void get_codecs (QStringList *codecs);
void combo_encoding (QComboBox *combo, const QString& current = QString ());
@@ -115,17 +89,7 @@
*/
QFont copy_font_attributes (const QFont& attr, const QFont& base) const;
- QString m_settings_directory;
-
- QString m_settings_file;
-
- gui_settings *m_settings;
-
- gui_settings *m_default_settings;
-
QList m_temporary_files;
-
- QStringList m_icon_fallbacks;
};
}
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/set-path-dialog.cc
--- a/libgui/src/set-path-dialog.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/set-path-dialog.cc Tue Dec 06 15:17:16 2022 -0500
@@ -50,7 +50,7 @@
#include
#include "gui-preferences-pd.h"
-#include "octave-qobject.h"
+#include "gui-settings.h"
#include "octave-qtutils.h"
#include "set-path-dialog.h"
#include "set-path-model.h"
@@ -59,8 +59,8 @@
namespace octave
{
- set_path_dialog::set_path_dialog (QWidget *parent, base_qobject& oct_qobj)
- : QDialog (parent), m_octave_qobj (oct_qobj)
+ set_path_dialog::set_path_dialog (QWidget *parent)
+ : QDialog (parent)
{
setWindowTitle (tr ("Set Path"));
@@ -168,10 +168,9 @@
setLayout (main_layout);
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- restoreGeometry (
- settings->value(pd_geometry.key).toByteArray());
+ gui_settings settings;
+
+ restoreGeometry (settings.value(pd_geometry.key).toByteArray());
}
void set_path_dialog::update_model (void)
@@ -297,11 +296,11 @@
m_path_list->scrollTo (m->index (row_count - 1));
}
- void set_path_dialog::save_settings ()
+ void set_path_dialog::save_settings (void)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- settings->setValue (pd_geometry.key, saveGeometry ());
+ gui_settings settings;
+
+ settings.setValue (pd_geometry.key, saveGeometry ());
}
void set_path_dialog::closeEvent (QCloseEvent *e)
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/set-path-dialog.h
--- a/libgui/src/set-path-dialog.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/set-path-dialog.h Tue Dec 06 15:17:16 2022 -0500
@@ -41,8 +41,6 @@
namespace octave
{
- class base_qobject;
-
class set_path_dialog : public QDialog
{
Q_OBJECT
@@ -53,7 +51,7 @@
// in the dialog. That may only be done after the intepreter_event
// signal connections are made to the Octave interpreter.
- set_path_dialog (QWidget *parent, base_qobject& oct_qobj);
+ set_path_dialog (QWidget *parent);
virtual ~set_path_dialog (void) = default;
@@ -96,8 +94,6 @@
void add_dir_common (bool subdirs);
- base_qobject& m_octave_qobj;
-
QLabel *m_info_label;
QPushButton *m_reload_button;
QPushButton *m_save_button;
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/settings-dialog.cc
--- a/libgui/src/settings-dialog.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/settings-dialog.cc Tue Dec 06 15:17:16 2022 -0500
@@ -79,22 +79,12 @@
{
setupUi (this);
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
-
- if (! settings)
- {
- QMessageBox msgBox
- (QMessageBox::Warning, tr ("Octave Preferences"),
- tr ("Unable to save preferences. Missing preferences file or unknown directory."));
-
- msgBox.exec ();
-
- return;
- }
+ gui_settings settings;
// look for available language files and the actual settings
+ resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
QString qm_dir_name = rmgr.get_gui_translation_dir ();
+
QDir qm_dir (qm_dir_name);
QFileInfoList qm_files = qm_dir.entryInfoList (QStringList ("*.qm"),
QDir::Files | QDir::Readable, QDir::Name);
@@ -104,7 +94,7 @@
// System at beginning
comboBox_language->insertItem (0, tr ("System setting"));
comboBox_language->insertSeparator (1); // separator after System
- QString language = settings->value (global_language.key,
+ QString language = settings.value (global_language.key,
global_language.def).toString ();
if (language == global_language.def.toString ())
language = tr ("System setting");
@@ -120,7 +110,7 @@
combo_styles->addItems (styles);
combo_styles->insertItem (0, global_style.def.toString ());
combo_styles->insertSeparator (1);
- QString current_style = settings->value (global_style).toString ();
+ QString current_style = settings.value (global_style).toString ();
if (current_style == global_style.def.toString ())
current_style = global_style.def.toString ();
selected = combo_styles->findText (current_style);
@@ -134,12 +124,12 @@
icon_size_group->addButton (icon_size_small);
icon_size_group->addButton (icon_size_normal);
icon_size_group->addButton (icon_size_large);
- int icon_size = settings->value (global_icon_size).toInt ();
+ int icon_size = settings.value (global_icon_size).toInt ();
icon_size_normal->setChecked (true); // the default
icon_size_small->setChecked (icon_size < 0);
icon_size_large->setChecked (icon_size > 0);
combo_box_icon_theme->addItems (global_all_icon_theme_names);
- int theme = settings->value (global_icon_theme_index.key).toInt ();
+ int theme = settings.value (global_icon_theme_index.key).toInt ();
combo_box_icon_theme->setCurrentIndex (theme);
// which icon has to be selected
@@ -148,14 +138,14 @@
icon_group->addButton (general_icon_graphic);
icon_group->addButton (general_icon_letter);
QString widget_icon_set =
- settings->value (dw_icon_set).toString ();
+ settings.value (dw_icon_set).toString ();
general_icon_octave->setChecked (true); // the default (if invalid set)
general_icon_octave->setChecked (widget_icon_set == "NONE");
general_icon_graphic->setChecked (widget_icon_set == "GRAPHIC");
general_icon_letter->setChecked (widget_icon_set == "LETTER");
// custom title bar of dock widget
- QColor bg_color = settings->value (dw_title_bg_color).value ();
+ QColor bg_color = settings.value (dw_title_bg_color).value ();
m_widget_title_bg_color = new color_picker (bg_color);
m_widget_title_bg_color->setEnabled (false);
layout_widget_bgtitle->addWidget (m_widget_title_bg_color, 0);
@@ -163,7 +153,7 @@
connect (cb_widget_custom_style, &QCheckBox::toggled,
m_widget_title_bg_color, &color_picker::setEnabled);
- QColor bg_color_active = settings->value (dw_title_bg_color_active).value ();
+ QColor bg_color_active = settings.value (dw_title_bg_color_active).value ();
m_widget_title_bg_color_active = new color_picker (bg_color_active);
m_widget_title_bg_color_active->setEnabled (false);
layout_widget_bgtitle_active->addWidget (m_widget_title_bg_color_active, 0);
@@ -171,7 +161,7 @@
connect (cb_widget_custom_style, &QCheckBox::toggled,
m_widget_title_bg_color_active, &color_picker::setEnabled);
- QColor fg_color = settings->value (dw_title_fg_color).value ();
+ QColor fg_color = settings.value (dw_title_fg_color).value ();
m_widget_title_fg_color = new color_picker (fg_color);
m_widget_title_fg_color->setEnabled (false);
layout_widget_fgtitle->addWidget (m_widget_title_fg_color, 0);
@@ -179,7 +169,7 @@
connect (cb_widget_custom_style, &QCheckBox::toggled,
m_widget_title_fg_color, &color_picker::setEnabled);
- QColor fg_color_active = settings->value (dw_title_fg_color_active).value ();
+ QColor fg_color_active = settings.value (dw_title_fg_color_active).value ();
m_widget_title_fg_color_active = new color_picker (fg_color_active);
m_widget_title_fg_color_active->setEnabled (false);
layout_widget_fgtitle_active->addWidget (m_widget_title_fg_color_active, 0);
@@ -187,48 +177,48 @@
connect (cb_widget_custom_style, &QCheckBox::toggled,
m_widget_title_fg_color_active, &color_picker::setEnabled);
- sb_3d_title->setValue (settings->value (dw_title_3d.key,
+ sb_3d_title->setValue (settings.value (dw_title_3d.key,
dw_title_3d.def).toInt ());
- cb_widget_custom_style->setChecked (settings->value (dw_title_custom_style).toBool ());
+ cb_widget_custom_style->setChecked (settings.value (dw_title_custom_style).toBool ());
// Native file dialogs.
// FIXME: This preference can be deprecated / removed if all display
// managers, especially KDE, run those dialogs without hangs or
// delays from the start (bug #54607).
- cb_use_native_file_dialogs->setChecked (settings->value (global_use_native_dialogs).toBool ());
+ cb_use_native_file_dialogs->setChecked (settings.value (global_use_native_dialogs).toBool ());
// Cursor blinking: consider old terminal related setting if not yet set
// FIXME: This pref. can be deprecated / removed if Qt adds support for
// getting the cursor blink preferences from all OS environments
- if (settings->contains (global_cursor_blinking.key))
+ if (settings.contains (global_cursor_blinking.key))
{
// Preference exists, read its value
- cb_cursor_blinking->setChecked (settings->value
+ cb_cursor_blinking->setChecked (settings.value
(global_cursor_blinking.key, global_cursor_blinking.def).toBool ());
}
else
{
// Pref. does not exist, so take old terminal related pref.
- cb_cursor_blinking->setChecked (settings->value
+ cb_cursor_blinking->setChecked (settings.value
(cs_cursor_blinking.key, cs_cursor_blinking.def).toBool ());
}
// focus follows mouse
cb_focus_follows_mouse->setChecked (
- settings->value (dw_focus_follows_mouse).toBool ());
+ settings.value (dw_focus_follows_mouse).toBool ());
// prompt on exit
cb_prompt_to_exit->setChecked (
- settings->value (global_prompt_to_exit.key, global_prompt_to_exit.def).toBool ());
+ settings.value (global_prompt_to_exit.key, global_prompt_to_exit.def).toBool ());
// Main status bar
cb_status_bar->setChecked (
- settings->value (global_status_bar.key, global_status_bar.def).toBool ());
+ settings.value (global_status_bar.key, global_status_bar.def).toBool ());
// Octave startup
cb_restore_octave_dir->setChecked (
- settings->value (global_restore_ov_dir.key, global_restore_ov_dir.def).toBool ());
- le_octave_dir->setText (settings->value (global_ov_startup_dir.key,
+ settings.value (global_restore_ov_dir.key, global_restore_ov_dir.def).toBool ());
+ le_octave_dir->setText (settings.value (global_ov_startup_dir.key,
global_ov_startup_dir.def).toString ());
connect (pb_octave_dir, &QPushButton::pressed,
@@ -238,66 +228,66 @@
// editor
//
useCustomFileEditor->setChecked (
- settings->value (global_use_custom_editor.key, global_use_custom_editor.def).toBool ());
+ settings.value (global_use_custom_editor.key, global_use_custom_editor.def).toBool ());
customFileEditor->setText (
- settings->value (global_custom_editor.key, global_custom_editor.def).toString ());
- editor_showLineNumbers->setChecked (settings->value (ed_show_line_numbers).toBool ());
- editor_linenr_size->setValue (settings->value (ed_line_numbers_size).toInt ());
+ settings.value (global_custom_editor.key, global_custom_editor.def).toString ());
+ editor_showLineNumbers->setChecked (settings.value (ed_show_line_numbers).toBool ());
+ editor_linenr_size->setValue (settings.value (ed_line_numbers_size).toInt ());
rmgr.combo_encoding (editor_combo_encoding);
- editor_highlightCurrentLine->setChecked (settings->value (ed_highlight_current_line).toBool ());
- editor_long_line_marker->setChecked (settings->value (ed_long_line_marker).toBool ());
+ editor_highlightCurrentLine->setChecked (settings.value (ed_highlight_current_line).toBool ());
+ editor_long_line_marker->setChecked (settings.value (ed_long_line_marker).toBool ());
bool long_line =
- settings->value (ed_long_line_marker_line).toBool ();
+ settings.value (ed_long_line_marker_line).toBool ();
editor_long_line_marker_line->setChecked (long_line);
bool long_back =
- settings->value (ed_long_line_marker_background).toBool ();
+ settings.value (ed_long_line_marker_background).toBool ();
editor_long_line_marker_background->setChecked (long_back);
if (! (long_line || long_back))
editor_long_line_marker_line->setChecked (true);
- editor_long_line_column->setValue (settings->value (ed_long_line_column).toInt ());
- editor_break_checkbox->setChecked (settings->value (ed_break_lines).toBool ());
- editor_break_comments_checkbox->setChecked (settings->value (ed_break_lines_comments).toBool ());
- editor_wrap_checkbox->setChecked (settings->value (ed_wrap_lines).toBool ());
- cb_edit_status_bar->setChecked (settings->value (ed_show_edit_status_bar).toBool ());
- cb_edit_tool_bar->setChecked (settings->value (ed_show_toolbar).toBool ());
- cb_code_folding->setChecked (settings->value (ed_code_folding).toBool ());
- editor_highlight_all_occurrences->setChecked (settings->value (ed_highlight_all_occurrences).toBool ());
+ editor_long_line_column->setValue (settings.value (ed_long_line_column).toInt ());
+ editor_break_checkbox->setChecked (settings.value (ed_break_lines).toBool ());
+ editor_break_comments_checkbox->setChecked (settings.value (ed_break_lines_comments).toBool ());
+ editor_wrap_checkbox->setChecked (settings.value (ed_wrap_lines).toBool ());
+ cb_edit_status_bar->setChecked (settings.value (ed_show_edit_status_bar).toBool ());
+ cb_edit_tool_bar->setChecked (settings.value (ed_show_toolbar).toBool ());
+ cb_code_folding->setChecked (settings.value (ed_code_folding).toBool ());
+ editor_highlight_all_occurrences->setChecked (settings.value (ed_highlight_all_occurrences).toBool ());
- editor_auto_endif->setCurrentIndex (settings->value (ed_auto_endif).toInt () );
- editor_codeCompletion->setChecked (settings->value (ed_code_completion).toBool ());
- editor_spinbox_ac_threshold->setValue (settings->value (ed_code_completion_threshold).toInt ());
- editor_checkbox_ac_keywords->setChecked (settings->value (ed_code_completion_keywords).toBool ());
+ editor_auto_endif->setCurrentIndex (settings.value (ed_auto_endif).toInt () );
+ editor_codeCompletion->setChecked (settings.value (ed_code_completion).toBool ());
+ editor_spinbox_ac_threshold->setValue (settings.value (ed_code_completion_threshold).toInt ());
+ editor_checkbox_ac_keywords->setChecked (settings.value (ed_code_completion_keywords).toBool ());
editor_checkbox_ac_builtins->setEnabled (editor_checkbox_ac_keywords->isChecked ());
editor_checkbox_ac_functions->setEnabled (editor_checkbox_ac_keywords->isChecked ());
- editor_checkbox_ac_builtins->setChecked (settings->value (ed_code_completion_octave_builtins).toBool ());
- editor_checkbox_ac_functions->setChecked (settings->value (ed_code_completion_octave_functions).toBool ());
- editor_checkbox_ac_document->setChecked (settings->value (ed_code_completion_document).toBool ());
- editor_checkbox_ac_case->setChecked (settings->value (ed_code_completion_case).toBool ());
- editor_checkbox_ac_replace->setChecked (settings->value (ed_code_completion_replace).toBool ());
- editor_ws_checkbox->setChecked (settings->value (ed_show_white_space).toBool ());
- editor_ws_indent_checkbox->setChecked (settings->value (ed_show_white_space_indent).toBool ());
- cb_show_eol->setChecked (settings->value (ed_show_eol_chars).toBool ());
- cb_show_hscrollbar->setChecked (settings->value (ed_show_hscroll_bar).toBool ());
+ editor_checkbox_ac_builtins->setChecked (settings.value (ed_code_completion_octave_builtins).toBool ());
+ editor_checkbox_ac_functions->setChecked (settings.value (ed_code_completion_octave_functions).toBool ());
+ editor_checkbox_ac_document->setChecked (settings.value (ed_code_completion_document).toBool ());
+ editor_checkbox_ac_case->setChecked (settings.value (ed_code_completion_case).toBool ());
+ editor_checkbox_ac_replace->setChecked (settings.value (ed_code_completion_replace).toBool ());
+ editor_ws_checkbox->setChecked (settings.value (ed_show_white_space).toBool ());
+ editor_ws_indent_checkbox->setChecked (settings.value (ed_show_white_space_indent).toBool ());
+ cb_show_eol->setChecked (settings.value (ed_show_eol_chars).toBool ());
+ cb_show_hscrollbar->setChecked (settings.value (ed_show_hscroll_bar).toBool ());
for (int i = 0; i < ed_tab_position_names.length (); i++)
editor_combox_tab_pos->insertItem (i,
tr (ed_tab_position_names.at (i).toStdString ().data ()));
editor_combox_tab_pos->setCurrentIndex
- (settings->value (ed_tab_position).toInt ());
+ (settings.value (ed_tab_position).toInt ());
- editor_cb_tabs_rotated->setChecked (settings->value (ed_tabs_rotated).toBool ());
- editor_sb_tabs_max_width->setValue (settings->value (ed_tabs_max_width).toInt ());
+ editor_cb_tabs_rotated->setChecked (settings.value (ed_tabs_rotated).toBool ());
+ editor_sb_tabs_max_width->setValue (settings.value (ed_tabs_max_width).toInt ());
int selected_comment_string, selected_uncomment_string;
- if (settings->contains (ed_comment_str.key)) // new version (radio buttons)
- selected_comment_string = settings->value (ed_comment_str).toInt ();
+ if (settings.contains (ed_comment_str.key)) // new version (radio buttons)
+ selected_comment_string = settings.value (ed_comment_str).toInt ();
else // old version (combo box)
- selected_comment_string = settings->value (ed_comment_str_old.key, ed_comment_str.def).toInt ();
+ selected_comment_string = settings.value (ed_comment_str_old.key, ed_comment_str.def).toInt ();
- selected_uncomment_string = settings->value (ed_uncomment_str).toInt ();
+ selected_uncomment_string = settings.value (ed_uncomment_str).toInt ();
for (int i = 0; i < ed_comment_strings_count; i++)
{
@@ -320,33 +310,33 @@
}
- combo_eol_mode->setCurrentIndex (settings->value (ed_default_eol_mode).toInt ());
- editor_auto_ind_checkbox->setChecked (settings->value (ed_auto_indent).toBool ());
- editor_tab_ind_checkbox->setChecked (settings->value (ed_tab_indents_line).toBool ());
- editor_bs_unind_checkbox->setChecked (settings->value (ed_backspace_unindents_line).toBool ());
- editor_ind_guides_checkbox->setChecked (settings->value (ed_show_indent_guides).toBool ());
- editor_ind_width_spinbox->setValue (settings->value (ed_indent_width).toInt ());
- editor_ind_uses_tabs_checkbox->setChecked (settings->value (ed_indent_uses_tabs).toBool ());
- editor_tab_width_spinbox->setValue (settings->value (ed_tab_width).toInt ());
- editor_restoreSession->setChecked (settings->value (ed_restore_session).toBool ());
- editor_create_new_file->setChecked (settings->value (ed_create_new_file).toBool ());
- editor_reload_changed_files->setChecked (settings->value (ed_always_reload_changed_files).toBool ());
- editor_force_newline->setChecked (settings->value (ed_force_newline).toBool ());
- editor_remove_trailing_spaces->setChecked (settings->value (ed_rm_trailing_spaces).toBool ());
- editor_hiding_closes_files->setChecked (settings->value (ed_hiding_closes_files).toBool ());
- editor_show_dbg_file->setChecked (settings->value (ed_show_dbg_file).toBool ());
+ combo_eol_mode->setCurrentIndex (settings.value (ed_default_eol_mode).toInt ());
+ editor_auto_ind_checkbox->setChecked (settings.value (ed_auto_indent).toBool ());
+ editor_tab_ind_checkbox->setChecked (settings.value (ed_tab_indents_line).toBool ());
+ editor_bs_unind_checkbox->setChecked (settings.value (ed_backspace_unindents_line).toBool ());
+ editor_ind_guides_checkbox->setChecked (settings.value (ed_show_indent_guides).toBool ());
+ editor_ind_width_spinbox->setValue (settings.value (ed_indent_width).toInt ());
+ editor_ind_uses_tabs_checkbox->setChecked (settings.value (ed_indent_uses_tabs).toBool ());
+ editor_tab_width_spinbox->setValue (settings.value (ed_tab_width).toInt ());
+ editor_restoreSession->setChecked (settings.value (ed_restore_session).toBool ());
+ editor_create_new_file->setChecked (settings.value (ed_create_new_file).toBool ());
+ editor_reload_changed_files->setChecked (settings.value (ed_always_reload_changed_files).toBool ());
+ editor_force_newline->setChecked (settings.value (ed_force_newline).toBool ());
+ editor_remove_trailing_spaces->setChecked (settings.value (ed_rm_trailing_spaces).toBool ());
+ editor_hiding_closes_files->setChecked (settings.value (ed_hiding_closes_files).toBool ());
+ editor_show_dbg_file->setChecked (settings.value (ed_show_dbg_file).toBool ());
// terminal
- QString default_font = settings->value (global_mono_font).toString ();
- terminal_fontName->setCurrentFont (QFont (settings->value (cs_font.key, default_font).toString ()));
- terminal_fontSize->setValue (settings->value (cs_font_size).toInt ());
- terminal_history_buffer->setValue (settings->value (cs_hist_buffer).toInt ());
- terminal_cursorUseForegroundColor->setChecked (settings->value (cs_cursor_use_fgcol).toBool ());
- terminal_focus_command->setChecked (settings->value (cs_focus_cmd).toBool ());
- terminal_print_dbg_location->setChecked (settings->value (cs_dbg_location).toBool ());
+ QString default_font = settings.value (global_mono_font).toString ();
+ terminal_fontName->setCurrentFont (QFont (settings.value (cs_font.key, default_font).toString ()));
+ terminal_fontSize->setValue (settings.value (cs_font_size).toInt ());
+ terminal_history_buffer->setValue (settings.value (cs_hist_buffer).toInt ());
+ terminal_cursorUseForegroundColor->setChecked (settings.value (cs_cursor_use_fgcol).toBool ());
+ terminal_focus_command->setChecked (settings.value (cs_focus_cmd).toBool ());
+ terminal_print_dbg_location->setChecked (settings.value (cs_dbg_location).toBool ());
QString cursor_type
- = settings->value (cs_cursor).toString ();
+ = settings.value (cs_cursor).toString ();
QStringList items;
items << QString ("0") << QString ("1") << QString ("2");
@@ -364,28 +354,28 @@
}
}
- read_terminal_colors (settings);
+ read_terminal_colors ();
// file browser
connect (sync_octave_directory, &QCheckBox::toggled,
this, &settings_dialog::set_disabled_pref_file_browser_dir);
- sync_octave_directory->setChecked (settings->value (fb_sync_octdir).toBool ());
- cb_restore_file_browser_dir->setChecked (settings->value (fb_restore_last_dir).toBool ());
- le_file_browser_dir->setText (settings->value (fb_startup_dir.key).toString ());
+ sync_octave_directory->setChecked (settings.value (fb_sync_octdir).toBool ());
+ cb_restore_file_browser_dir->setChecked (settings.value (fb_restore_last_dir).toBool ());
+ le_file_browser_dir->setText (settings.value (fb_startup_dir.key).toString ());
connect (pb_file_browser_dir, &QPushButton::pressed,
this, &settings_dialog::get_file_browser_dir);
- le_file_browser_extensions->setText (settings->value (fb_txt_file_ext).toString ());
+ le_file_browser_extensions->setText (settings.value (fb_txt_file_ext).toString ());
- checkbox_allow_web_connect->setChecked (settings->value (nr_allow_connection).toBool ());
+ checkbox_allow_web_connect->setChecked (settings.value (nr_allow_connection).toBool ());
// Proxy
- bool use_proxy = settings->value (global_use_proxy.key, global_use_proxy.def).toBool ();
+ bool use_proxy = settings.value (global_use_proxy.key, global_use_proxy.def).toBool ();
use_proxy_server->setChecked (use_proxy);
// Fill combo box and activate current one
- QString proxy_type_string = settings->value (global_proxy_type.key, global_proxy_type.def).toString ();
+ QString proxy_type_string = settings.value (global_proxy_type.key, global_proxy_type.def).toString ();
proxy_type->addItems (global_proxy_all_types);
for (int i = 0; i < global_proxy_all_types.length (); i++)
{
@@ -396,10 +386,10 @@
}
}
// Fill all line edits
- proxy_host_name->setText (settings->value (global_proxy_host.key, global_proxy_host.def).toString ());
- proxy_port->setText (settings->value (global_proxy_port.key, global_proxy_port.def).toString ());
- proxy_username->setText (settings->value (global_proxy_user.key, global_proxy_user.def).toString ());
- proxy_password->setText (settings->value (global_proxy_pass.key, global_proxy_pass.def).toString ());
+ proxy_host_name->setText (settings.value (global_proxy_host.key, global_proxy_host.def).toString ());
+ proxy_port->setText (settings.value (global_proxy_port.key, global_proxy_port.def).toString ());
+ proxy_username->setText (settings.value (global_proxy_user.key, global_proxy_user.def).toString ());
+ proxy_password->setText (settings.value (global_proxy_pass.key, global_proxy_pass.def).toString ());
// Connect relevant signals for dis-/enabling some elements
connect (proxy_type, QOverload::of (&QComboBox::currentIndexChanged),
this, &settings_dialog::proxy_items_update);
@@ -409,37 +399,37 @@
proxy_items_update ();
// Workspace
- read_workspace_colors (settings);
+ read_workspace_colors ();
// variable editor
- varedit_columnWidth->setValue (settings->value (ve_column_width).toInt ());
- varedit_rowHeight->setValue (settings->value (ve_row_height).toInt ());
+ varedit_columnWidth->setValue (settings.value (ve_column_width).toInt ());
+ varedit_rowHeight->setValue (settings.value (ve_row_height).toInt ());
- varedit_font->setCurrentFont (QFont (settings->value (ve_font_name.key,
- settings->value (cs_font.key, default_font)).toString ()));
- varedit_fontSize->setValue (settings->value (ve_font_size).toInt ());
+ varedit_font->setCurrentFont (QFont (settings.value (ve_font_name.key,
+ settings.value (cs_font.key, default_font)).toString ()));
+ varedit_fontSize->setValue (settings.value (ve_font_size).toInt ());
connect (varedit_useTerminalFont, &QCheckBox::toggled,
varedit_font, &QFontComboBox::setDisabled);
connect (varedit_useTerminalFont, &QCheckBox::toggled,
varedit_fontSize, &QSpinBox::setDisabled);
- varedit_useTerminalFont->setChecked (settings->value (ve_use_terminal_font).toBool ());
+ varedit_useTerminalFont->setChecked (settings.value (ve_use_terminal_font).toBool ());
varedit_font->setDisabled (varedit_useTerminalFont->isChecked ());
varedit_fontSize->setDisabled (varedit_useTerminalFont->isChecked ());
- varedit_alternate->setChecked (settings->value (ve_alternate_rows).toBool ());
+ varedit_alternate->setChecked (settings.value (ve_alternate_rows).toBool ());
// variable editor colors
- read_varedit_colors (settings);
+ read_varedit_colors ();
// shortcuts
shortcut_manager& scmgr = m_octave_qobj.get_shortcut_manager ();
cb_prevent_readline_conflicts->setChecked (
- settings->value (sc_prevent_rl_conflicts.key,
+ settings.value (sc_prevent_rl_conflicts.key,
sc_prevent_rl_conflicts.def).toBool ());
cb_prevent_readline_conflicts_menu->setChecked (
- settings->value (sc_prevent_rl_conflicts_menu.key,
+ settings.value (sc_prevent_rl_conflicts_menu.key,
sc_prevent_rl_conflicts_menu.def).toBool ());
// initialize the tree view with all shortcut data
@@ -457,7 +447,7 @@
#if defined (HAVE_QSCINTILLA)
- int mode = settings->value (ed_color_mode).toInt ();
+ int mode = settings.value (ed_color_mode).toInt ();
QCheckBox *cb_color_mode = new QCheckBox (tr (settings_color_modes.toStdString ().data ()),
group_box_editor_styles);
@@ -469,7 +459,7 @@
pb_reload_default_colors->setToolTip (tr (settings_reload_styles_tooltip.toStdString ().data ()));
color_picker *current_line_color = new color_picker (
- settings->value (ed_highlight_current_line_color.key +
+ settings.value (ed_highlight_current_line_color.key +
settings_color_modes_ext[mode],
ed_highlight_current_line_color.def).value (), this);
current_line_color->setObjectName (ed_highlight_current_line_color.key);
@@ -509,8 +499,8 @@
this, &settings_dialog::button_clicked);
// restore last geometry
- if (settings->contains (sd_geometry.key))
- restoreGeometry (settings->value (sd_geometry).toByteArray ());
+ if (settings.contains (sd_geometry.key))
+ restoreGeometry (settings.value (sd_geometry).toByteArray ());
else
setGeometry (QRect (10, 50, 1000, 600));
}
@@ -519,10 +509,9 @@
{
if (tab.isEmpty ())
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- if (settings)
- tabWidget->setCurrentIndex (settings->value (sd_last_tab).toInt ());
+ gui_settings settings;
+
+ tabWidget->setCurrentIndex (settings.value (sd_last_tab).toInt ());
}
else
{
@@ -549,9 +538,10 @@
{
// FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
int opts = QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks;
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- if (! settings->value (global_use_native_dialogs).toBool ())
+
+ gui_settings settings;
+
+ if (! settings.value (global_use_native_dialogs).toBool ())
opts |= QFileDialog::DontUseNativeDialog;
QString dir = QFileDialog::getExistingDirectory
@@ -575,12 +565,12 @@
|| button_role == QDialogButtonBox::AcceptRole)
{
// save last settings dialog's geometry and close
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+
+ gui_settings settings;
- settings->setValue (sd_last_tab.key, tabWidget->currentIndex ());
- settings->setValue (sd_geometry.key, saveGeometry ());
- settings->sync ();
+ settings.setValue (sd_last_tab.key, tabWidget->currentIndex ());
+ settings.setValue (sd_geometry.key, saveGeometry ());
+ settings.sync ();
close ();
}
@@ -655,8 +645,7 @@
{
#if defined (HAVE_QSCINTILLA)
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
QCheckBox *cb_color_mode
= group_box_editor_styles->findChild (ed_color_mode.key);
@@ -671,12 +660,12 @@
if (def != settings_reload_default_colors_flag)
{
// Get current value from settings or the default
- c_picker->set_color (settings->color_value (ed_highlight_current_line_color, m));
+ c_picker->set_color (settings.color_value (ed_highlight_current_line_color, m));
}
else
{
// Get the default value
- c_picker->set_color (settings->get_color_value (ed_highlight_current_line_color.def, m));
+ c_picker->set_color (settings.get_color_value (ed_highlight_current_line_color.def, m));
}
}
@@ -686,40 +675,40 @@
# if defined (HAVE_LEXER_OCTAVE)
lexer = new QsciLexerOctave ();
- update_lexer (lexer, settings, m, def);
+ update_lexer (lexer, m, def);
delete lexer;
# elif defined (HAVE_LEXER_MATLAB)
lexer = new QsciLexerMatlab ();
- update_lexer (lexer, settings, m, def);
+ update_lexer (lexer, m, def);
delete lexer;
# endif
lexer = new QsciLexerCPP ();
- update_lexer (lexer, settings, m, def);
+ update_lexer (lexer, m, def);
delete lexer;
lexer = new QsciLexerJava ();
- update_lexer (lexer, settings, m, def);
+ update_lexer (lexer, m, def);
delete lexer;
lexer = new QsciLexerPerl ();
- update_lexer (lexer, settings, m, def);
+ update_lexer (lexer, m, def);
delete lexer;
lexer = new QsciLexerBatch ();
- update_lexer (lexer, settings, m, def);
+ update_lexer (lexer, m, def);
delete lexer;
lexer = new QsciLexerDiff ();
- update_lexer (lexer, settings, m, def);
+ update_lexer (lexer, m, def);
delete lexer;
lexer = new QsciLexerBash ();
- update_lexer (lexer, settings, m, def);
+ update_lexer (lexer, m, def);
delete lexer;
lexer = new octave_txt_lexer ();
- update_lexer (lexer, settings, m, def);
+ update_lexer (lexer, m, def);
delete lexer;
#else
@@ -731,13 +720,12 @@
#if defined (HAVE_QSCINTILLA)
- void settings_dialog::update_lexer (QsciLexer *lexer, gui_settings *settings,
- int mode, int def)
+ void settings_dialog::update_lexer (QsciLexer *lexer, int mode, int def)
{
// Get lexer settings and copy from default settings if not yet
// available in normal settings file
resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- rmgr.read_lexer_settings (lexer, settings, mode, def);
+ rmgr.read_lexer_settings (lexer, mode, def);
// When reloading default styles, the style tabs do already exists.
// Otherwise, check if they exist or not.
@@ -757,7 +745,7 @@
{
// This is not an update, call get_lexer_settings for building
// the settings tab
- get_lexer_settings (lexer, settings);
+ get_lexer_settings (lexer);
return;
}
@@ -834,8 +822,7 @@
}
- void settings_dialog::get_lexer_settings (QsciLexer *lexer,
- gui_settings *settings)
+ void settings_dialog::get_lexer_settings (QsciLexer *lexer)
{
resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
@@ -925,13 +912,14 @@
scroll_area->setWidget (scroll_area_contents);
tabs_editor_lexers->addTab (scroll_area, lexer->language ());
- tabs_editor_lexers->setCurrentIndex (settings->value (sd_last_editor_styles_tab).toInt ());
+ gui_settings settings;
+
+ tabs_editor_lexers->setCurrentIndex (settings.value (sd_last_editor_styles_tab).toInt ());
}
- void settings_dialog::write_lexer_settings (QsciLexer *lexer,
- gui_settings *settings)
+ void settings_dialog::write_lexer_settings (QsciLexer *lexer)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+ gui_settings settings;
QCheckBox *cb_color_mode
= group_box_editor_styles->findChild (ed_color_mode.key);
@@ -939,13 +927,16 @@
if (cb_color_mode && cb_color_mode->isChecked ())
mode = 1;
- settings->setValue (ed_color_mode.key, mode);
+ settings.setValue (ed_color_mode.key, mode);
QWidget *tab = tabs_editor_lexers->
findChild (QString (lexer->language ()) + "_styles");
int styles[ed_max_lexer_styles]; // array for saving valid styles
// (enum is not continuous)
+
+ resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
int max_style = rmgr.get_valid_lexer_styles (lexer, styles);
+
QFontComboBox *select_font;
QSpinBox *font_size;
QCheckBox *attrib_font[3];
@@ -955,11 +946,11 @@
color = findChild (ed_highlight_current_line_color.key);
if (color)
- settings->setValue (ed_highlight_current_line_color.key
+ settings.setValue (ed_highlight_current_line_color.key
+ settings_color_modes_ext[mode], color->color ());
QString default_font_name
- = settings->value (global_mono_font).toString ();
+ = settings.value (global_mono_font).toString ();
QFont default_font = QFont (default_font_name, 10, -1, 0);
QColor default_color = QColor ();
@@ -1024,19 +1015,18 @@
const std::string group =
QString ("Scintilla" + settings_color_modes_ext[mode]).toStdString ();
- lexer->writeSettings (*settings, group.c_str ());
+ lexer->writeSettings (settings, group.c_str ());
- settings->setValue (sd_last_editor_styles_tab.key,
- tabs_editor_lexers->currentIndex ());
- settings->sync ();
+ settings.setValue (sd_last_editor_styles_tab.key,
+ tabs_editor_lexers->currentIndex ());
+ settings.sync ();
}
#endif
void settings_dialog::write_changed_settings (bool closing)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
// the icon set
QString widget_icon_set = "NONE";
@@ -1044,87 +1034,87 @@
widget_icon_set = "LETTER";
else if (general_icon_graphic->isChecked ())
widget_icon_set = "GRAPHIC";
- settings->setValue (dw_icon_set.key, widget_icon_set);
+ settings.setValue (dw_icon_set.key, widget_icon_set);
// language
QString language = comboBox_language->currentText ();
if (language == tr ("System setting"))
language = global_language.def.toString ();
- settings->setValue (global_language.key, language);
+ settings.setValue (global_language.key, language);
// style
QString selected_style = combo_styles->currentText ();
if (selected_style == global_style.def.toString ())
selected_style = global_style.def.toString ();
- settings->setValue (global_style.key, selected_style);
+ settings.setValue (global_style.key, selected_style);
// dock widget title bar
- settings->setValue (dw_title_custom_style.key, cb_widget_custom_style->isChecked ());
- settings->setValue (dw_title_3d.key, sb_3d_title->value ());
- settings->setValue (dw_title_bg_color.key, m_widget_title_bg_color->color ());
- settings->setValue (dw_title_bg_color_active.key, m_widget_title_bg_color_active->color ());
- settings->setValue (dw_title_fg_color.key, m_widget_title_fg_color->color ());
- settings->setValue (dw_title_fg_color_active.key, m_widget_title_fg_color_active->color ());
+ settings.setValue (dw_title_custom_style.key, cb_widget_custom_style->isChecked ());
+ settings.setValue (dw_title_3d.key, sb_3d_title->value ());
+ settings.setValue (dw_title_bg_color.key, m_widget_title_bg_color->color ());
+ settings.setValue (dw_title_bg_color_active.key, m_widget_title_bg_color_active->color ());
+ settings.setValue (dw_title_fg_color.key, m_widget_title_fg_color->color ());
+ settings.setValue (dw_title_fg_color_active.key, m_widget_title_fg_color_active->color ());
// icon size and theme
int icon_size = icon_size_large->isChecked () - icon_size_small->isChecked ();
- settings->setValue (global_icon_size.key, icon_size);
- settings->setValue (global_icon_theme_index.key, combo_box_icon_theme->currentIndex ());
+ settings.setValue (global_icon_size.key, icon_size);
+ settings.setValue (global_icon_theme_index.key, combo_box_icon_theme->currentIndex ());
// native file dialogs
- settings->setValue (global_use_native_dialogs.key, cb_use_native_file_dialogs->isChecked ());
+ settings.setValue (global_use_native_dialogs.key, cb_use_native_file_dialogs->isChecked ());
// cursor blinking
- settings->setValue (global_cursor_blinking.key, cb_cursor_blinking->isChecked ());
+ settings.setValue (global_cursor_blinking.key, cb_cursor_blinking->isChecked ());
// focus follows mouse
- settings->setValue (dw_focus_follows_mouse.key, cb_focus_follows_mouse->isChecked ());
+ settings.setValue (dw_focus_follows_mouse.key, cb_focus_follows_mouse->isChecked ());
// promp to exit
- settings->setValue (global_prompt_to_exit.key, cb_prompt_to_exit->isChecked ());
+ settings.setValue (global_prompt_to_exit.key, cb_prompt_to_exit->isChecked ());
// status bar
- settings->setValue (global_status_bar.key, cb_status_bar->isChecked ());
+ settings.setValue (global_status_bar.key, cb_status_bar->isChecked ());
// Octave startup
- settings->setValue (global_restore_ov_dir.key, cb_restore_octave_dir->isChecked ());
- settings->setValue (global_ov_startup_dir.key, le_octave_dir->text ());
+ settings.setValue (global_restore_ov_dir.key, cb_restore_octave_dir->isChecked ());
+ settings.setValue (global_ov_startup_dir.key, le_octave_dir->text ());
//editor
- settings->setValue (global_use_custom_editor.key, useCustomFileEditor->isChecked ());
- settings->setValue (global_custom_editor.key, customFileEditor->text ());
- settings->setValue (ed_show_line_numbers.key, editor_showLineNumbers->isChecked ());
- settings->setValue (ed_line_numbers_size.key, editor_linenr_size->value ());
- settings->setValue (ed_highlight_current_line.key, editor_highlightCurrentLine->isChecked ());
- settings->setValue (ed_long_line_marker.key, editor_long_line_marker->isChecked ());
- settings->setValue (ed_long_line_marker_line.key, editor_long_line_marker_line->isChecked ());
- settings->setValue (ed_long_line_marker_background.key, editor_long_line_marker_background->isChecked ());
- settings->setValue (ed_long_line_column.key, editor_long_line_column->value ());
- settings->setValue (ed_break_lines.key, editor_break_checkbox->isChecked ());
- settings->setValue (ed_break_lines_comments.key, editor_break_comments_checkbox->isChecked ());
- settings->setValue (ed_wrap_lines.key, editor_wrap_checkbox->isChecked ());
- settings->setValue (ed_code_folding.key, cb_code_folding->isChecked ());
- settings->setValue (ed_show_edit_status_bar.key, cb_edit_status_bar->isChecked ());
- settings->setValue (ed_show_toolbar.key, cb_edit_tool_bar->isChecked ());
- settings->setValue (ed_highlight_all_occurrences.key, editor_highlight_all_occurrences->isChecked ());
- settings->setValue (ed_code_completion.key, editor_codeCompletion->isChecked ());
- settings->setValue (ed_code_completion_threshold.key, editor_spinbox_ac_threshold->value ());
- settings->setValue (ed_code_completion_keywords.key, editor_checkbox_ac_keywords->isChecked ());
- settings->setValue (ed_code_completion_octave_builtins.key, editor_checkbox_ac_builtins->isChecked ());
- settings->setValue (ed_code_completion_octave_functions.key, editor_checkbox_ac_functions->isChecked ());
- settings->setValue (ed_code_completion_document.key, editor_checkbox_ac_document->isChecked ());
- settings->setValue (ed_code_completion_case.key, editor_checkbox_ac_case->isChecked ());
- settings->setValue (ed_code_completion_replace.key, editor_checkbox_ac_replace->isChecked ());
- settings->setValue (ed_auto_endif.key, editor_auto_endif->currentIndex ());
- settings->setValue (ed_show_white_space.key, editor_ws_checkbox->isChecked ());
- settings->setValue (ed_show_white_space_indent.key, editor_ws_indent_checkbox->isChecked ());
- settings->setValue (ed_show_eol_chars.key, cb_show_eol->isChecked ());
- settings->setValue (ed_show_hscroll_bar.key, cb_show_hscrollbar->isChecked ());
- settings->setValue (ed_default_eol_mode.key, combo_eol_mode->currentIndex ());
+ settings.setValue (global_use_custom_editor.key, useCustomFileEditor->isChecked ());
+ settings.setValue (global_custom_editor.key, customFileEditor->text ());
+ settings.setValue (ed_show_line_numbers.key, editor_showLineNumbers->isChecked ());
+ settings.setValue (ed_line_numbers_size.key, editor_linenr_size->value ());
+ settings.setValue (ed_highlight_current_line.key, editor_highlightCurrentLine->isChecked ());
+ settings.setValue (ed_long_line_marker.key, editor_long_line_marker->isChecked ());
+ settings.setValue (ed_long_line_marker_line.key, editor_long_line_marker_line->isChecked ());
+ settings.setValue (ed_long_line_marker_background.key, editor_long_line_marker_background->isChecked ());
+ settings.setValue (ed_long_line_column.key, editor_long_line_column->value ());
+ settings.setValue (ed_break_lines.key, editor_break_checkbox->isChecked ());
+ settings.setValue (ed_break_lines_comments.key, editor_break_comments_checkbox->isChecked ());
+ settings.setValue (ed_wrap_lines.key, editor_wrap_checkbox->isChecked ());
+ settings.setValue (ed_code_folding.key, cb_code_folding->isChecked ());
+ settings.setValue (ed_show_edit_status_bar.key, cb_edit_status_bar->isChecked ());
+ settings.setValue (ed_show_toolbar.key, cb_edit_tool_bar->isChecked ());
+ settings.setValue (ed_highlight_all_occurrences.key, editor_highlight_all_occurrences->isChecked ());
+ settings.setValue (ed_code_completion.key, editor_codeCompletion->isChecked ());
+ settings.setValue (ed_code_completion_threshold.key, editor_spinbox_ac_threshold->value ());
+ settings.setValue (ed_code_completion_keywords.key, editor_checkbox_ac_keywords->isChecked ());
+ settings.setValue (ed_code_completion_octave_builtins.key, editor_checkbox_ac_builtins->isChecked ());
+ settings.setValue (ed_code_completion_octave_functions.key, editor_checkbox_ac_functions->isChecked ());
+ settings.setValue (ed_code_completion_document.key, editor_checkbox_ac_document->isChecked ());
+ settings.setValue (ed_code_completion_case.key, editor_checkbox_ac_case->isChecked ());
+ settings.setValue (ed_code_completion_replace.key, editor_checkbox_ac_replace->isChecked ());
+ settings.setValue (ed_auto_endif.key, editor_auto_endif->currentIndex ());
+ settings.setValue (ed_show_white_space.key, editor_ws_checkbox->isChecked ());
+ settings.setValue (ed_show_white_space_indent.key, editor_ws_indent_checkbox->isChecked ());
+ settings.setValue (ed_show_eol_chars.key, cb_show_eol->isChecked ());
+ settings.setValue (ed_show_hscroll_bar.key, cb_show_hscrollbar->isChecked ());
+ settings.setValue (ed_default_eol_mode.key, combo_eol_mode->currentIndex ());
- settings->setValue (ed_tab_position.key, editor_combox_tab_pos->currentIndex ());
- settings->setValue (ed_tabs_rotated.key, editor_cb_tabs_rotated->isChecked ());
- settings->setValue (ed_tabs_max_width.key, editor_sb_tabs_max_width->value ());
+ settings.setValue (ed_tab_position.key, editor_combox_tab_pos->currentIndex ());
+ settings.setValue (ed_tabs_rotated.key, editor_cb_tabs_rotated->isChecked ());
+ settings.setValue (ed_tabs_max_width.key, editor_sb_tabs_max_width->value ());
// Comment strings
int rb_uncomment = 0;
@@ -1132,56 +1122,56 @@
{
if (m_rb_comment_strings[i]->isChecked ())
{
- settings->setValue (ed_comment_str.key, i);
+ settings.setValue (ed_comment_str.key, i);
if (i < 3)
- settings->setValue (ed_comment_str_old.key, i);
+ settings.setValue (ed_comment_str_old.key, i);
else
- settings->setValue (ed_comment_str_old.key, ed_comment_str.def);
+ settings.setValue (ed_comment_str_old.key, ed_comment_str.def);
}
if (m_rb_uncomment_strings[i]->isChecked ())
rb_uncomment = rb_uncomment + (1 << i);
}
- settings->setValue (ed_uncomment_str.key, rb_uncomment);
+ settings.setValue (ed_uncomment_str.key, rb_uncomment);
- settings->setValue (ed_default_enc.key, editor_combo_encoding->currentText ());
- settings->setValue (ed_auto_indent.key, editor_auto_ind_checkbox->isChecked ());
- settings->setValue (ed_tab_indents_line.key, editor_tab_ind_checkbox->isChecked ());
- settings->setValue (ed_backspace_unindents_line.key, editor_bs_unind_checkbox->isChecked ());
- settings->setValue (ed_show_indent_guides.key, editor_ind_guides_checkbox->isChecked ());
- settings->setValue (ed_indent_width.key, editor_ind_width_spinbox->value ());
- settings->setValue (ed_indent_uses_tabs.key, editor_ind_uses_tabs_checkbox->isChecked ());
- settings->setValue (ed_tab_width.key, editor_tab_width_spinbox->value ());
- settings->setValue (ed_restore_session.key, editor_restoreSession->isChecked ());
- settings->setValue (ed_create_new_file.key, editor_create_new_file->isChecked ());
- settings->setValue (ed_hiding_closes_files.key, editor_hiding_closes_files->isChecked ());
- settings->setValue (ed_always_reload_changed_files.key, editor_reload_changed_files->isChecked ());
- settings->setValue (ed_force_newline.key, editor_force_newline->isChecked ());
- settings->setValue (ed_rm_trailing_spaces.key, editor_remove_trailing_spaces->isChecked ());
- settings->setValue (ed_show_dbg_file.key, editor_show_dbg_file->isChecked ());
+ settings.setValue (ed_default_enc.key, editor_combo_encoding->currentText ());
+ settings.setValue (ed_auto_indent.key, editor_auto_ind_checkbox->isChecked ());
+ settings.setValue (ed_tab_indents_line.key, editor_tab_ind_checkbox->isChecked ());
+ settings.setValue (ed_backspace_unindents_line.key, editor_bs_unind_checkbox->isChecked ());
+ settings.setValue (ed_show_indent_guides.key, editor_ind_guides_checkbox->isChecked ());
+ settings.setValue (ed_indent_width.key, editor_ind_width_spinbox->value ());
+ settings.setValue (ed_indent_uses_tabs.key, editor_ind_uses_tabs_checkbox->isChecked ());
+ settings.setValue (ed_tab_width.key, editor_tab_width_spinbox->value ());
+ settings.setValue (ed_restore_session.key, editor_restoreSession->isChecked ());
+ settings.setValue (ed_create_new_file.key, editor_create_new_file->isChecked ());
+ settings.setValue (ed_hiding_closes_files.key, editor_hiding_closes_files->isChecked ());
+ settings.setValue (ed_always_reload_changed_files.key, editor_reload_changed_files->isChecked ());
+ settings.setValue (ed_force_newline.key, editor_force_newline->isChecked ());
+ settings.setValue (ed_rm_trailing_spaces.key, editor_remove_trailing_spaces->isChecked ());
+ settings.setValue (ed_show_dbg_file.key, editor_show_dbg_file->isChecked ());
// file browser
- settings->setValue (fb_sync_octdir.key, sync_octave_directory->isChecked ());
- settings->setValue (fb_restore_last_dir.key, cb_restore_file_browser_dir->isChecked ());
- settings->setValue (fb_startup_dir.key, le_file_browser_dir->text ());
- settings->setValue (fb_txt_file_ext.key, le_file_browser_extensions->text ());
+ settings.setValue (fb_sync_octdir.key, sync_octave_directory->isChecked ());
+ settings.setValue (fb_restore_last_dir.key, cb_restore_file_browser_dir->isChecked ());
+ settings.setValue (fb_startup_dir.key, le_file_browser_dir->text ());
+ settings.setValue (fb_txt_file_ext.key, le_file_browser_extensions->text ());
// network
- settings->setValue (nr_allow_connection.key, checkbox_allow_web_connect->isChecked ());
- settings->setValue (global_use_proxy.key, use_proxy_server->isChecked ());
- settings->setValue (global_proxy_type.key, proxy_type->currentText ());
- settings->setValue (global_proxy_host.key, proxy_host_name->text ());
- settings->setValue (global_proxy_port.key, proxy_port->text ());
- settings->setValue (global_proxy_user.key, proxy_username->text ());
- settings->setValue (global_proxy_pass.key, proxy_password->text ());
+ settings.setValue (nr_allow_connection.key, checkbox_allow_web_connect->isChecked ());
+ settings.setValue (global_use_proxy.key, use_proxy_server->isChecked ());
+ settings.setValue (global_proxy_type.key, proxy_type->currentText ());
+ settings.setValue (global_proxy_host.key, proxy_host_name->text ());
+ settings.setValue (global_proxy_port.key, proxy_port->text ());
+ settings.setValue (global_proxy_user.key, proxy_username->text ());
+ settings.setValue (global_proxy_pass.key, proxy_password->text ());
// command window
- settings->setValue (cs_font_size.key, terminal_fontSize->value ());
- settings->setValue (cs_font.key, terminal_fontName->currentFont ().family ());
- settings->setValue (cs_cursor_use_fgcol.key, terminal_cursorUseForegroundColor->isChecked ());
- settings->setValue (cs_focus_cmd.key, terminal_focus_command->isChecked ());
- settings->setValue (cs_dbg_location.key, terminal_print_dbg_location->isChecked ());
- settings->setValue (cs_hist_buffer.key, terminal_history_buffer->value ());
- write_terminal_colors (settings);
+ settings.setValue (cs_font_size.key, terminal_fontSize->value ());
+ settings.setValue (cs_font.key, terminal_fontName->currentFont ().family ());
+ settings.setValue (cs_cursor_use_fgcol.key, terminal_cursorUseForegroundColor->isChecked ());
+ settings.setValue (cs_focus_cmd.key, terminal_focus_command->isChecked ());
+ settings.setValue (cs_dbg_location.key, terminal_print_dbg_location->isChecked ());
+ settings.setValue (cs_hist_buffer.key, terminal_history_buffer->value ());
+ write_terminal_colors ();
// the cursor
QString cursor_type;
@@ -1191,7 +1181,7 @@
else
cursor_type = cs_cursor.def.toString ();
- settings->setValue (cs_cursor.key, cursor_type);
+ settings.setValue (cs_cursor.key, cursor_type);
#if defined (HAVE_QSCINTILLA)
// editor styles: create lexer, get dialog contents, and write settings
@@ -1200,71 +1190,74 @@
#if defined (HAVE_LEXER_OCTAVE)
lexer = new QsciLexerOctave ();
- write_lexer_settings (lexer, settings);
+ write_lexer_settings (lexer);
delete lexer;
#elif defined (HAVE_LEXER_MATLAB)
lexer = new QsciLexerMatlab ();
- write_lexer_settings (lexer, settings);
+ write_lexer_settings (lexer);
delete lexer;
#endif
lexer = new QsciLexerCPP ();
- write_lexer_settings (lexer, settings);
+ write_lexer_settings (lexer);
delete lexer;
lexer = new QsciLexerJava ();
- write_lexer_settings (lexer, settings);
+ write_lexer_settings (lexer);
delete lexer;
lexer = new QsciLexerPerl ();
- write_lexer_settings (lexer, settings);
+ write_lexer_settings (lexer);
delete lexer;
lexer = new QsciLexerBatch ();
- write_lexer_settings (lexer, settings);
+ write_lexer_settings (lexer);
delete lexer;
lexer = new QsciLexerDiff ();
- write_lexer_settings (lexer, settings);
+ write_lexer_settings (lexer);
delete lexer;
lexer = new QsciLexerBash ();
- write_lexer_settings (lexer, settings);
+ write_lexer_settings (lexer);
delete lexer;
lexer = new octave_txt_lexer ();
- write_lexer_settings (lexer, settings);
+ write_lexer_settings (lexer);
delete lexer;
#endif
// Workspace
- write_workspace_colors (settings);
+ write_workspace_colors ();
// Variable editor
- settings->setValue (ve_column_width.key, varedit_columnWidth->value ());
- settings->setValue (ve_row_height.key, varedit_rowHeight->value ());
- settings->setValue (ve_use_terminal_font.key, varedit_useTerminalFont->isChecked ());
- settings->setValue (ve_alternate_rows.key, varedit_alternate->isChecked ());
- settings->setValue (ve_font_name.key, varedit_font->currentFont ().family ());
- settings->setValue (ve_font_size.key, varedit_fontSize->value ());
- write_varedit_colors (settings);
+ settings.setValue (ve_column_width.key, varedit_columnWidth->value ());
+ settings.setValue (ve_row_height.key, varedit_rowHeight->value ());
+ settings.setValue (ve_use_terminal_font.key, varedit_useTerminalFont->isChecked ());
+ settings.setValue (ve_alternate_rows.key, varedit_alternate->isChecked ());
+ settings.setValue (ve_font_name.key, varedit_font->currentFont ().family ());
+ settings.setValue (ve_font_size.key, varedit_fontSize->value ());
+ write_varedit_colors ();
// shortcuts
- settings->setValue (sc_prevent_rl_conflicts.key, cb_prevent_readline_conflicts->isChecked ());
- settings->setValue (sc_prevent_rl_conflicts_menu.key, cb_prevent_readline_conflicts_menu->isChecked ());
+ settings.setValue (sc_prevent_rl_conflicts.key, cb_prevent_readline_conflicts->isChecked ());
+ settings.setValue (sc_prevent_rl_conflicts_menu.key, cb_prevent_readline_conflicts_menu->isChecked ());
+
shortcut_manager& scmgr = m_octave_qobj.get_shortcut_manager ();
scmgr.write_shortcuts (settings, closing);
- settings->sync ();
+ settings.sync ();
}
- void settings_dialog::read_workspace_colors (gui_settings *settings)
+ void settings_dialog::read_workspace_colors (void)
{
+ gui_settings settings;
+
// Construct the grid with all color related settings
QGridLayout *style_grid = new QGridLayout ();
QVector description (ws_colors_count);
@@ -1273,7 +1266,7 @@
int column = 0;
const int color_columns = 3; // place colors in so many columns
int row = 0;
- int mode = settings->value (ws_color_mode).toInt ();
+ int mode = settings.value (ws_color_mode).toInt ();
m_ws_enable_colors = new QCheckBox (tr ("Enable attribute colors"));
style_grid->addWidget (m_ws_enable_colors, row++, column, 1, 4);
@@ -1283,7 +1276,7 @@
connect (m_ws_enable_colors, &QCheckBox::toggled,
m_ws_hide_tool_tips, &QCheckBox::setEnabled);
m_ws_hide_tool_tips->setChecked
- (settings->value (ws_hide_tool_tips).toBool ());
+ (settings.value (ws_hide_tool_tips).toBool ());
QCheckBox *cb_color_mode = new QCheckBox (tr (settings_color_modes.toStdString ().data ()));
cb_color_mode->setToolTip (tr (settings_color_modes_tooltip.toStdString ().data ()));
@@ -1299,7 +1292,7 @@
pb_reload_default_colors, &QPushButton::setEnabled);
style_grid->addWidget (pb_reload_default_colors, row+1, column++);
- bool colors_enabled = settings->value (ws_enable_colors).toBool ();
+ bool colors_enabled = settings.value (ws_enable_colors).toBool ();
for (int i = 0; i < ws_colors_count; i++)
{
@@ -1310,7 +1303,7 @@
connect (m_ws_enable_colors, &QCheckBox::toggled,
description[i], &QLabel::setEnabled);
- QColor setting_color = settings->color_value (ws_colors[i], mode);
+ QColor setting_color = settings.color_value (ws_colors[i], mode);
color[i] = new color_picker (setting_color);
color[i]->setObjectName (ws_colors[i].key);
color[i]->setMinimumSize (30, 10);
@@ -1354,8 +1347,7 @@
if (cb_color_mode && cb_color_mode->isChecked ())
m = 1;
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
color_picker *c_picker;
@@ -1367,21 +1359,23 @@
if (def != settings_reload_default_colors_flag)
{
// Get current value from settings or the default
- c_picker->set_color (settings->color_value (ws_colors[i], m));
+ c_picker->set_color (settings.color_value (ws_colors[i], m));
}
else
{
// Get the default value
- c_picker->set_color (settings->get_color_value (ws_colors[i].def, m));
+ c_picker->set_color (settings.get_color_value (ws_colors[i].def, m));
}
}
}
}
- void settings_dialog::write_workspace_colors (gui_settings *settings)
+ void settings_dialog::write_workspace_colors (void)
{
- settings->setValue (ws_enable_colors.key, m_ws_enable_colors->isChecked ());
- settings->setValue (ws_hide_tool_tips.key, m_ws_hide_tool_tips->isChecked ());
+ gui_settings settings;
+
+ settings.setValue (ws_enable_colors.key, m_ws_enable_colors->isChecked ());
+ settings.setValue (ws_hide_tool_tips.key, m_ws_hide_tool_tips->isChecked ());
QCheckBox *cb_color_mode
= workspace_colors_box->findChild (ws_color_mode.key);
@@ -1396,21 +1390,23 @@
{
color = workspace_colors_box->findChild (ws_colors[i].key);
if (color)
- settings->set_color_value (ws_colors[i], color->color (), mode);
+ settings.set_color_value (ws_colors[i], color->color (), mode);
}
- settings->setValue (ws_color_mode.key, mode);
+ settings.setValue (ws_color_mode.key, mode);
- settings->sync ();
+ settings.sync ();
}
- void settings_dialog::read_terminal_colors (gui_settings *settings)
+ void settings_dialog::read_terminal_colors (void)
{
+ gui_settings settings;
+
QGridLayout *style_grid = new QGridLayout ();
QVector description (cs_colors_count);
QVector color (cs_colors_count);
- int mode = settings->value (cs_color_mode).toInt ();
+ int mode = settings.value (cs_color_mode).toInt ();
QCheckBox *cb_color_mode = new QCheckBox (tr (settings_color_modes.toStdString ().data ()));
cb_color_mode->setToolTip (tr (settings_color_modes_tooltip.toStdString ().data ()));
@@ -1430,7 +1426,7 @@
description[i] = new QLabel (" "
+ tr (cs_color_names.at (i).toStdString ().data ()));
description[i]->setAlignment (Qt::AlignRight);
- QColor setting_color = settings->color_value (cs_colors[i], mode);
+ QColor setting_color = settings.color_value (cs_colors[i], mode);
color[i] = new color_picker (setting_color);
color[i]->setObjectName (cs_colors[i].key);
color[i]->setMinimumSize (30, 10);
@@ -1463,8 +1459,7 @@
if (cb_color_mode && cb_color_mode->isChecked ())
m = 1;
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
color_picker *c_picker;
@@ -1476,18 +1471,18 @@
if (def != settings_reload_default_colors_flag)
{
// Get current value from settings or the default
- c_picker->set_color (settings->color_value (cs_colors[i], m));
+ c_picker->set_color (settings.color_value (cs_colors[i], m));
}
else
{
// Get the default value
- c_picker->set_color (settings->get_color_value (cs_colors[i].def, m));
+ c_picker->set_color (settings.get_color_value (cs_colors[i].def, m));
}
}
}
}
- void settings_dialog::write_terminal_colors (gui_settings *settings)
+ void settings_dialog::write_terminal_colors (void)
{
QCheckBox *cb_color_mode
= terminal_colors_box->findChild (cs_color_mode.key);
@@ -1496,27 +1491,31 @@
if (cb_color_mode && cb_color_mode->isChecked ())
mode = 1;
+ gui_settings settings;
+
color_picker *color;
for (int i = 0; i < cs_color_names.size (); i++)
{
color = terminal_colors_box->findChild (cs_colors[i].key);
if (color)
- settings->set_color_value (cs_colors[i], color->color (), mode);
+ settings.set_color_value (cs_colors[i], color->color (), mode);
}
- settings->setValue (cs_color_mode.key, mode);
+ settings.setValue (cs_color_mode.key, mode);
- settings->sync ();
+ settings.sync ();
}
- void settings_dialog::read_varedit_colors (gui_settings *settings)
+ void settings_dialog::read_varedit_colors (void)
{
+ gui_settings settings;
+
QGridLayout *style_grid = new QGridLayout ();
QVector description (ve_colors_count);
QVector color (ve_colors_count);
- int mode = settings->value (ve_color_mode).toInt ();
+ int mode = settings.value (ve_color_mode).toInt ();
QCheckBox *cb_color_mode = new QCheckBox (tr (settings_color_modes.toStdString ().data ()));
cb_color_mode->setToolTip (tr (settings_color_modes_tooltip.toStdString ().data ()));
@@ -1537,7 +1536,7 @@
+ tr (ve_color_names.at (i).toStdString ().data ()));
description[i]->setAlignment (Qt::AlignRight);
- QColor setting_color = settings->color_value (ve_colors[i], mode);
+ QColor setting_color = settings.color_value (ve_colors[i], mode);
color[i] = new color_picker (setting_color);
color[i]->setObjectName (ve_colors[i].key);
color[i]->setMinimumSize (30, 10);
@@ -1570,8 +1569,7 @@
if (cb_color_mode && cb_color_mode->isChecked ())
m = 1;
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
color_picker *c_picker;
@@ -1583,18 +1581,18 @@
if (def != settings_reload_default_colors_flag)
{
// Get current value from settings or the default
- c_picker->set_color (settings->color_value (ve_colors[i], m));
+ c_picker->set_color (settings.color_value (ve_colors[i], m));
}
else
{
// Get the default value
- c_picker->set_color (settings->get_color_value (ve_colors[i].def, m));
+ c_picker->set_color (settings.get_color_value (ve_colors[i].def, m));
}
}
}
}
- void settings_dialog::write_varedit_colors (gui_settings *settings)
+ void settings_dialog::write_varedit_colors (void)
{
QCheckBox *cb_color_mode
= varedit_colors_box->findChild (ve_color_mode.key);
@@ -1603,17 +1601,19 @@
if (cb_color_mode && cb_color_mode->isChecked ())
mode = 1;
+ gui_settings settings;
+
color_picker *color;
for (int i = 0; i < ve_colors_count; i++)
{
color = varedit_colors_box->findChild (ve_colors[i].key);
if (color)
- settings->set_color_value (ve_colors[i], color->color (), mode);
+ settings.set_color_value (ve_colors[i], color->color (), mode);
}
- settings->setValue (ve_color_mode.key, mode);
+ settings.setValue (ve_color_mode.key, mode);
- settings->sync ();
+ settings.sync ();
}
}
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/settings-dialog.h
--- a/libgui/src/settings-dialog.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/settings-dialog.h Tue Dec 06 15:17:16 2022 -0500
@@ -33,7 +33,6 @@
#include "color-picker.h"
#include "gui-preferences-ed.h"
-#include "gui-settings.h"
#include "ui-settings-dialog.h"
class QsciLexer;
@@ -84,21 +83,21 @@
private:
#if defined (HAVE_QSCINTILLA)
- void update_lexer (QsciLexer *lexer, gui_settings *settings, int mode, int def = 0);
- void get_lexer_settings (QsciLexer *lexer, gui_settings *settings);
- void write_lexer_settings (QsciLexer *lexer, gui_settings *settings);
+ void update_lexer (QsciLexer *lexer, int mode, int def = 0);
+ void get_lexer_settings (QsciLexer *lexer);
+ void write_lexer_settings (QsciLexer *lexer);
#endif
void write_changed_settings (bool closing);
- void read_workspace_colors (gui_settings *settings);
- void write_workspace_colors (gui_settings *settings);
+ void read_workspace_colors (void);
+ void write_workspace_colors (void);
- void read_terminal_colors (gui_settings *settings);
- void write_terminal_colors (gui_settings *settings);
+ void read_terminal_colors (void);
+ void write_terminal_colors (void);
- void read_varedit_colors (gui_settings *settings);
- void write_varedit_colors (gui_settings *settings);
+ void read_varedit_colors (void);
+ void write_varedit_colors (void);
base_qobject& m_octave_qobj;
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/shortcut-manager.cc
--- a/libgui/src/shortcut-manager.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/shortcut-manager.cc Tue Dec 06 15:17:16 2022 -0500
@@ -42,10 +42,10 @@
#include
#include
-#include "octave-qobject.h"
#include "shortcut-manager.h"
#include "gui-preferences-global.h"
#include "gui-preferences-sc.h"
+#include "gui-settings.h"
#include "error.h"
namespace octave
@@ -109,8 +109,7 @@
}
- shortcut_manager::shortcut_manager (base_qobject& oct_qobj)
- : m_octave_qobj (oct_qobj)
+ shortcut_manager::shortcut_manager (void)
{
setObjectName ("Shortcut_Manager");
@@ -122,10 +121,9 @@
void shortcut_manager::init_data (void)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
- settings->setValue (sc_main_ctrld.key, false); // reset use fo ctrl-d
+ settings.setValue (sc_main_ctrld.key, false); // reset use fo ctrl-d
// actions not related to specific menus or widgets
@@ -309,7 +307,7 @@
}
// write one or all actual shortcut set(s) into a settings file
- void shortcut_manager::write_shortcuts (gui_settings *settings,
+ void shortcut_manager::write_shortcuts (gui_settings& settings,
bool closing)
{
bool sc_ctrld = false;
@@ -318,7 +316,7 @@
for (int i = 0; i < m_sc.count (); i++) // loop over all shortcuts
{
- settings->setValue (sc_group + "/" + m_sc.at (i).m_settings_key,
+ settings.setValue (sc_group + "/" + m_sc.at (i).m_settings_key,
m_sc.at (i).m_actual_sc.toString ());
// special: check main-window for Ctrl-D (Terminal)
if (m_sc.at (i).m_settings_key.startsWith (sc_main)
@@ -326,7 +324,7 @@
sc_ctrld = true;
}
- settings->setValue (sc_main_ctrld.key, sc_ctrld);
+ settings.setValue (sc_main_ctrld.key, sc_ctrld);
if (closing)
{
@@ -334,7 +332,7 @@
m_dialog = nullptr; // make sure it is zero again
}
- settings->sync (); // sync the settings file
+ settings.sync (); // sync the settings file
}
void shortcut_manager::set_shortcut (QAction *action, const sc_pref& scpref,
@@ -355,9 +353,9 @@
if (index > -1 && index < m_sc.count ())
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- action->setShortcut (QKeySequence (settings->sc_value (scpref)));
+ gui_settings settings;
+
+ action->setShortcut (QKeySequence (settings.sc_value (scpref)));
}
else
qDebug () << "Key: " << scpref.key << " not found in m_action_hash";
@@ -371,9 +369,9 @@
if (index > -1 && index < m_sc.count ())
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- sc->setKey (QKeySequence (settings->sc_value (scpref)));
+ gui_settings settings;
+
+ sc->setKey (QKeySequence (settings.sc_value (scpref)));
}
else
qDebug () << "Key: " << scpref.key << " not found in m_action_hash";
@@ -524,9 +522,10 @@
// FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
int opts = 0; // No options by default.
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- if (! settings->value (global_use_native_dialogs).toBool ())
+
+ gui_settings settings;
+
+ if (! settings.value (global_use_native_dialogs).toBool ())
opts = QFileDialog::DontUseNativeDialog;
if (action == OSC_IMPORT)
@@ -554,15 +553,13 @@
else
{
if (action == OSC_IMPORT)
- import_shortcuts (&osc_settings); // import (special action)
+ import_shortcuts (osc_settings); // import (special action)
else if (action == OSC_EXPORT)
- write_shortcuts (&osc_settings, false); // export, (save settings)
+ write_shortcuts (osc_settings, false); // export, (save settings)
}
}
else
- {
- import_shortcuts (nullptr);
- }
+ reset_default_shortcuts ();
return true;
}
@@ -628,17 +625,16 @@
void shortcut_manager::init (const QString& description, const sc_pref& sc)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
- QKeySequence actual = QKeySequence (settings->sc_value (sc));
+ QKeySequence actual = QKeySequence (settings.sc_value (sc));
// append the new shortcut to the list
shortcut_t shortcut_info;
shortcut_info.m_description = description;
shortcut_info.m_settings_key = sc.key;
shortcut_info.m_actual_sc = actual;
- shortcut_info.m_default_sc = settings->sc_def_value (sc);
+ shortcut_info.m_default_sc = settings.sc_def_value (sc);
m_sc << shortcut_info;
// insert shortcut in order to check for duplicates later
@@ -651,7 +647,7 @@
= sc_main_file.mid (0, sc_main_file.indexOf ('_') + 1);
if (sc.key.startsWith (main_group_prefix)
&& actual == QKeySequence (Qt::ControlModifier+Qt::Key_D))
- settings->setValue (sc_main_ctrld.key, true);
+ settings.setValue (sc_main_ctrld.key, true);
}
void shortcut_manager::shortcut_dialog (int index)
@@ -745,27 +741,54 @@
m_dialog->exec ();
}
- // import a shortcut set from a given settings file or reset to
- // the defaults (settings = 0) and refresh the tree view
- void shortcut_manager::import_shortcuts (gui_settings *settings)
+ // import a shortcut set from a given settings file and refresh the
+ // tree view
+ void shortcut_manager::import_shortcuts (gui_settings& settings)
{
for (int i = 0; i < m_sc.count (); i++)
{
// update the list of all shortcuts
- shortcut_t sc = m_sc.at (i); // make a copy
+
+ // make a copy
+ shortcut_t sc = m_sc.at (i);
- if (settings)
- sc.m_actual_sc = QKeySequence ( // get new shortcut from settings
- settings->value (sc_group + sc.m_settings_key,sc.m_actual_sc).
- toString ()); // and use the old one as default
- else
- sc.m_actual_sc = QKeySequence (sc.m_default_sc); // get default shortcut
+ // get new shortcut from settings and use the old one as default
+ sc.m_actual_sc = QKeySequence (settings.value (sc_group + sc.m_settings_key, sc.m_actual_sc).toString ());
- m_sc.replace (i, sc); // replace the old with the new one
+ // replace the old with the new one
+ m_sc.replace (i, sc);
// update the tree view
- QTreeWidgetItem *tree_item = m_index_item_hash[i]; // get related tree item
- tree_item->setText (2, sc.m_actual_sc.toString ()); // display new shortcut
+ // get related tree item
+ QTreeWidgetItem *tree_item = m_index_item_hash[i];
+
+ // display new shortcut
+ tree_item->setText (2, sc.m_actual_sc.toString ());
+ }
+ }
+
+ // reset to the defaults and refresh the tree view
+ void shortcut_manager::reset_default_shortcuts (void)
+ {
+ for (int i = 0; i < m_sc.count (); i++)
+ {
+ // update the list of all shortcuts
+
+ // make a copy
+ shortcut_t sc = m_sc.at (i);
+
+ // get default shortcut
+ sc.m_actual_sc = QKeySequence (sc.m_default_sc);
+
+ // replace the old with the new one
+ m_sc.replace (i, sc);
+
+ // update the tree view
+ // get related tree item
+ QTreeWidgetItem *tree_item = m_index_item_hash[i];
+
+ // display new shortcut
+ tree_item->setText (2, sc.m_actual_sc.toString ());
}
}
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/shortcut-manager.h
--- a/libgui/src/shortcut-manager.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/shortcut-manager.h Tue Dec 06 15:17:16 2022 -0500
@@ -33,7 +33,7 @@
#include
#include
-#include "gui-settings.h"
+#include "gui-preferences.h"
namespace octave
{
@@ -61,7 +61,7 @@
};
- class base_qobject;
+ class gui_settings;
class shortcut_manager : public QWidget
{
@@ -76,7 +76,7 @@
OSC_DEFAULT = 2
};
- shortcut_manager (base_qobject& oct_qobj);
+ shortcut_manager (void);
// No copying!
@@ -88,7 +88,7 @@
void init_data (void);
- void write_shortcuts (gui_settings *settings, bool closing);
+ void write_shortcuts (gui_settings& settings, bool closing);
void set_shortcut (QAction *action, const sc_pref& scpref, bool enable = true);
@@ -108,7 +108,8 @@
void init (const QString&, const sc_pref& scpref);
void shortcut_dialog (int);
- void import_shortcuts (gui_settings *settings);
+ void import_shortcuts (gui_settings& settings);
+ void reset_default_shortcuts (void);
bool overwrite_all_shortcuts (void);
class shortcut_t
@@ -155,8 +156,6 @@
QKeySequence m_default_sc;
};
- base_qobject& m_octave_qobj;
-
QList m_sc;
QHash m_shortcut_hash;
QHash m_action_hash;
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/terminal-dock-widget.cc
--- a/libgui/src/terminal-dock-widget.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/terminal-dock-widget.cc Tue Dec 06 15:17:16 2022 -0500
@@ -101,16 +101,16 @@
// Chose a reasonable size at startup in order to avoid truncated
// startup messages
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+
+ gui_settings settings;
QFont font = QFont ();
font.setStyleHint (QFont::TypeWriter);
- QString default_font = settings->value (global_mono_font).toString ();
+ QString default_font = settings.value (global_mono_font).toString ();
font.setFamily
- (settings->value (cs_font.key, default_font).toString ());
+ (settings.value (cs_font.key, default_font).toString ());
font.setPointSize
- (settings->value (cs_font_size).toInt ());
+ (settings.value (cs_font_size).toInt ());
QFontMetrics metrics(font);
@@ -151,9 +151,9 @@
}
#endif
- void terminal_dock_widget::notice_settings (const gui_settings *settings)
+ void terminal_dock_widget::notice_settings (void)
{
- emit settings_changed (settings);
+ emit settings_changed ();
}
void terminal_dock_widget::init_command_prompt ()
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/terminal-dock-widget.h
--- a/libgui/src/terminal-dock-widget.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/terminal-dock-widget.h Tue Dec 06 15:17:16 2022 -0500
@@ -65,7 +65,7 @@
signals:
- void settings_changed (const gui_settings *settings);
+ void settings_changed (void);
// Note: the following four signals are
// currently only used by the new experimental terminal widget.
@@ -80,7 +80,7 @@
public slots:
- void notice_settings (const gui_settings *settings);
+ void notice_settings (void);
private:
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/variable-editor.cc
--- a/libgui/src/variable-editor.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/variable-editor.cc Tue Dec 06 15:17:16 2022 -0500
@@ -55,6 +55,7 @@
#include "gui-preferences-global.h"
#include "gui-preferences-sc.h"
#include "gui-preferences-ve.h"
+#include "gui-settings.h"
#include "octave-qobject.h"
#include "octave-qtutils.h"
#include "ovl.h"
@@ -113,9 +114,10 @@
m_prev_geom = QRect (0, 0, 0, 0);
QHBoxLayout *h_layout = m_title_widget->findChild ();
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+
+ gui_settings settings;
m_fullscreen_action
- = new QAction (rmgr.icon ("view-fullscreen", false), "", this);
+ = new QAction (settings.icon ("view-fullscreen", false), "", this);
m_fullscreen_action->setToolTip (tr (DOCKED_FULLSCREEN_BUTTON_TOOLTIP));
QToolButton *fullscreen_button = new QToolButton (m_title_widget);
fullscreen_button->setDefaultAction (m_fullscreen_action);
@@ -148,8 +150,8 @@
if (m_full_screen)
{
setGeometry (m_prev_geom);
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- m_fullscreen_action->setIcon (rmgr.icon ("view-fullscreen", false));
+ gui_settings settings;
+ m_fullscreen_action->setIcon (settings.icon ("view-fullscreen", false));
m_full_screen = false;
}
m_fullscreen_action->setToolTip (tr (DOCKED_FULLSCREEN_BUTTON_TOOLTIP));
@@ -207,12 +209,12 @@
void
variable_dock_widget::change_fullscreen (void)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+ gui_settings settings;
if (! m_full_screen)
{
m_prev_floating = isFloating ();
- m_fullscreen_action->setIcon (rmgr.icon ("view-restore", false));
+ m_fullscreen_action->setIcon (settings.icon ("view-restore", false));
if (m_prev_floating)
m_fullscreen_action->setToolTip (tr ("Restore geometry"));
else
@@ -232,7 +234,7 @@
}
else
{
- m_fullscreen_action->setIcon (rmgr.icon ("view-fullscreen", false));
+ m_fullscreen_action->setIcon (settings.icon ("view-fullscreen", false));
setGeometry (m_prev_geom);
if (m_prev_floating)
m_fullscreen_action->setToolTip (tr (UNDOCKED_FULLSCREEN_BUTTON_TOOLTIP));
@@ -493,9 +495,10 @@
// FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
int opts = 0; // No options by default.
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
- if (! settings->value (global_use_native_dialogs).toBool ())
+
+ gui_settings settings;
+
+ if (! settings.value (global_use_native_dialogs).toBool ())
opts = QFileDialog::DontUseNativeDialog;
QString name = objectName ();
@@ -642,31 +645,31 @@
variable_editor_view::add_edit_actions (QMenu *menu,
const QString& qualifier_string)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+ gui_settings settings;
- menu->addAction (rmgr.icon ("edit-cut"),
+ menu->addAction (settings.icon ("edit-cut"),
tr ("Cut") + qualifier_string,
this, &variable_editor_view::cutClipboard);
- menu->addAction (rmgr.icon ("edit-copy"),
+ menu->addAction (settings.icon ("edit-copy"),
tr ("Copy") + qualifier_string,
this, &variable_editor_view::copyClipboard);
- menu->addAction (rmgr.icon ("edit-paste"),
+ menu->addAction (settings.icon ("edit-paste"),
tr ("Paste"),
this, &variable_editor_view::pasteClipboard);
menu->addSeparator ();
- menu->addAction (rmgr.icon ("edit-delete"),
+ menu->addAction (settings.icon ("edit-delete"),
tr ("Clear") + qualifier_string,
this, &variable_editor_view::clearContent);
- menu->addAction (rmgr.icon ("edit-delete"),
+ menu->addAction (settings.icon ("edit-delete"),
tr ("Delete") + qualifier_string,
this, &variable_editor_view::delete_selected);
- menu->addAction (rmgr.icon ("document-new"),
+ menu->addAction (settings.icon ("document-new"),
tr ("Variable from Selection"),
this, &variable_editor_view::createVariable);
}
@@ -1203,13 +1206,8 @@
void
variable_editor::edit_variable (const QString& name, const octave_value& val)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
-
if (m_stylesheet.isEmpty ())
- {
- gui_settings *settings = rmgr.get_settings ();
- notice_settings (settings);
- }
+ notice_settings ();
QDockWidget *existing_qdw = m_main->findChild (name);
if (existing_qdw)
@@ -1417,31 +1415,33 @@
}
void
- variable_editor::notice_settings (const gui_settings *settings)
+ variable_editor::notice_settings (void)
{
- m_main->notice_settings (settings); // update settings in parent main win
+ gui_settings settings;
- m_default_width = settings->value (ve_column_width).toInt ();
+ m_main->notice_settings (); // update settings in parent main win
- m_default_height = settings->value (ve_row_height).toInt ();
+ m_default_width = settings.value (ve_column_width).toInt ();
+
+ m_default_height = settings.value (ve_row_height).toInt ();
- m_alternate_rows = settings->value (ve_alternate_rows).toBool ();
+ m_alternate_rows = settings.value (ve_alternate_rows).toBool ();
- m_use_terminal_font = settings->value (ve_use_terminal_font).toBool ();
+ m_use_terminal_font = settings.value (ve_use_terminal_font).toBool ();
QString font_name;
int font_size;
- QString default_font = settings->value (global_mono_font).toString ();
+ QString default_font = settings.value (global_mono_font).toString ();
if (m_use_terminal_font)
{
- font_name = settings->value (cs_font.key, default_font).toString ();
- font_size = settings->value (cs_font_size).toInt ();
+ font_name = settings.value (cs_font.key, default_font).toString ();
+ font_size = settings.value (cs_font_size).toInt ();
}
else
{
- font_name = settings->value (ve_font_name.key, default_font).toString ();
- font_size = settings->value (ve_font_size).toInt ();
+ font_name = settings.value (ve_font_name.key, default_font).toString ();
+ font_size = settings.value (ve_font_size).toInt ();
}
m_font = QFont (font_name, font_size);
@@ -1450,11 +1450,11 @@
m_add_font_height = fm.height ();
- int mode = settings->value (ve_color_mode).toInt ();
+ int mode = settings.value (ve_color_mode).toInt ();
for (int i = 0; i < ve_colors_count; i++)
{
- QColor setting_color = settings->color_value (ve_colors[i], mode);
+ QColor setting_color = settings.color_value (ve_colors[i], mode);
m_table_colors.replace (i, setting_color);
}
@@ -1464,7 +1464,7 @@
if (m_tool_bar)
{
- int size_idx = settings->value (global_icon_size).toInt ();
+ int size_idx = settings.value (global_icon_size).toInt ();
size_idx = (size_idx > 0) - (size_idx < 0) + 1; // Make valid index from 0 to 2
QStyle *st = style ();
@@ -1664,22 +1664,23 @@
m_tool_bar->setWindowTitle (tr ("Variable Editor Toolbar"));
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
+ gui_settings settings;
- m_save_action = add_tool_bar_button (rmgr.icon ("document-save"), tr ("Save"),
- this, SLOT (save ()));
+ m_save_action = add_tool_bar_button (settings.icon ("document-save"),
+ tr ("Save"), this, SLOT (save ()));
addAction (m_save_action);
m_save_action->setShortcutContext (Qt::WidgetWithChildrenShortcut);
m_save_action->setStatusTip(tr("Save variable to a file"));
- QAction *action = new QAction (rmgr.icon ("document-save-as"), tr ("Save in format ..."), m_tool_bar);
+ QAction *action = new QAction (settings.icon ("document-save-as"),
+ tr ("Save in format ..."), m_tool_bar);
QToolButton *save_tool_button = new HoverToolButton (m_tool_bar);
save_tool_button->setDefaultAction (action);
save_tool_button->setText (tr ("Save in format ..."));
save_tool_button->setToolTip (tr("Save variable to a file in different format"));
- save_tool_button->setIcon (rmgr.icon ("document-save-as"));
+ save_tool_button->setIcon (settings.icon ("document-save-as"));
save_tool_button->setPopupMode (QToolButton::InstantPopup);
QMenu *save_menu = new ReturnFocusMenu (save_tool_button);
@@ -1698,15 +1699,15 @@
m_tool_bar->addSeparator ();
- action = add_tool_bar_button (rmgr.icon ("edit-cut"), tr ("Cut"),
+ action = add_tool_bar_button (settings.icon ("edit-cut"), tr ("Cut"),
this, SLOT (cutClipboard ()));
action->setStatusTip(tr("Cut data to clipboard"));
- action = add_tool_bar_button (rmgr.icon ("edit-copy"), tr ("Copy"),
+ action = add_tool_bar_button (settings.icon ("edit-copy"), tr ("Copy"),
this, SLOT (copyClipboard ()));
action->setStatusTip(tr("Copy data to clipboard"));
- action = add_tool_bar_button (rmgr.icon ("edit-paste"), tr ("Paste"),
+ action = add_tool_bar_button (settings.icon ("edit-paste"), tr ("Paste"),
this, SLOT (pasteClipboard ()));
action->setStatusTip(tr("Paste clipboard into variable data"));
@@ -1716,14 +1717,15 @@
// QAction *print_action; /icons/fileprint.png
// m_tool_bar->addSeparator ();
- action = new QAction (rmgr.icon ("plot-xy-curve"), tr ("Plot"), m_tool_bar);
+ action = new QAction (settings.icon ("plot-xy-curve"), tr ("Plot"),
+ m_tool_bar);
action->setToolTip (tr ("Plot Selected Data"));
QToolButton *plot_tool_button = new HoverToolButton (m_tool_bar);
plot_tool_button->setDefaultAction (action);
plot_tool_button->setText (tr ("Plot"));
plot_tool_button->setToolTip (tr ("Plot selected data"));
- plot_tool_button->setIcon (rmgr.icon ("plot-xy-curve"));
+ plot_tool_button->setIcon (settings.icon ("plot-xy-curve"));
plot_tool_button->setPopupMode (QToolButton::InstantPopup);
@@ -1739,7 +1741,7 @@
m_tool_bar->addSeparator ();
- action = add_tool_bar_button (rmgr.icon ("go-up"), tr ("Up"), this,
+ action = add_tool_bar_button (settings.icon ("go-up"), tr ("Up"), this,
SLOT (levelUp ()));
action->setStatusTip(tr("Go one level up in variable hierarchy"));
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/variable-editor.h
--- a/libgui/src/variable-editor.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/variable-editor.h Tue Dec 06 15:17:16 2022 -0500
@@ -32,7 +32,6 @@
#include
#include "dw-main-window.h"
-#include "gui-settings.h"
#include "octave-dock-widget.h"
#include "qt-interpreter-events.h"
#include "tab-bar.h"
@@ -340,7 +339,7 @@
void callUpdate (const QModelIndex&, const QModelIndex&);
- void notice_settings (const gui_settings *);
+ void notice_settings (void);
void edit_variable (const QString& name, const octave_value& val);
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/welcome-wizard.cc
--- a/libgui/src/welcome-wizard.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/welcome-wizard.cc Tue Dec 06 15:17:16 2022 -0500
@@ -39,7 +39,7 @@
#include "gui-preferences-dw.h"
#include "gui-preferences-nr.h"
-#include "octave-qobject.h"
+#include "gui-settings.h"
#include "welcome-wizard.h"
namespace octave
@@ -53,10 +53,9 @@
return logo;
};
- welcome_wizard::welcome_wizard (base_qobject& oct_qobj, QWidget *p)
- : QDialog (p), m_octave_qobj (oct_qobj), m_page_ctor_list (),
- m_page_list_iterator (),
- m_current_page (initial_page::create (oct_qobj, this)),
+ welcome_wizard::welcome_wizard (QWidget *p)
+ : QDialog (p), m_page_ctor_list (), m_page_list_iterator (),
+ m_current_page (initial_page::create (this)),
m_allow_web_connect_state (false),
m_max_height (0), m_max_width (0)
{
@@ -117,7 +116,7 @@
delete m_current_page;
delete layout ();
- m_current_page = (*m_page_list_iterator) (m_octave_qobj, this);
+ m_current_page = (*m_page_list_iterator) (this);
QVBoxLayout *new_layout = new QVBoxLayout ();
setLayout (new_layout);
@@ -143,23 +142,16 @@
{
// Create default settings file.
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- rmgr.reload_settings ();
-
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
- if (settings)
- {
- settings->setValue (nr_allow_connection.key,
- m_allow_web_connect_state);
+ settings.setValue (nr_allow_connection.key, m_allow_web_connect_state);
- settings->sync ();
- }
+ settings.sync ();
QDialog::accept ();
}
- initial_page::initial_page (base_qobject& oct_qobj, welcome_wizard *wizard)
+ initial_page::initial_page (welcome_wizard *wizard)
: QWidget (wizard),
m_title (new QLabel (tr ("Welcome to Octave!"), this)),
m_message (new QLabel (this)),
@@ -171,7 +163,7 @@
ft.setPointSize (20);
m_title->setFont (ft);
- resource_manager& rmgr = oct_qobj.get_resource_manager ();
+ gui_settings settings;
m_message->setText
(tr ("\n"
@@ -179,7 +171,7 @@
"Click 'Next' to create a configuration file and launch Octave.
\n"
"The configuration file is stored in
%1.
\n"
"").
- arg (rmgr.get_settings_file ()));
+ arg (settings.file_name ()));
m_message->setWordWrap (true);
m_message->setMinimumWidth (400);
@@ -217,8 +209,7 @@
connect (m_cancel, &QPushButton::clicked, wizard, &welcome_wizard::reject);
}
- setup_community_news::setup_community_news (base_qobject&,
- welcome_wizard *wizard)
+ setup_community_news::setup_community_news (welcome_wizard *wizard)
: QWidget (wizard),
m_title (new QLabel (tr ("Community News"), this)),
m_message (new QLabel (this)),
@@ -311,7 +302,7 @@
connect (m_cancel, &QPushButton::clicked, wizard, &welcome_wizard::reject);
}
- final_page::final_page (base_qobject&, welcome_wizard *wizard)
+ final_page::final_page (welcome_wizard *wizard)
: QWidget (wizard),
m_title (new QLabel (tr ("Enjoy!"), this)),
m_message (new QLabel (this)),
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/welcome-wizard.h
--- a/libgui/src/welcome-wizard.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/welcome-wizard.h Tue Dec 06 15:17:16 2022 -0500
@@ -32,17 +32,15 @@
namespace octave
{
- class base_qobject;
-
class welcome_wizard : public QDialog
{
Q_OBJECT
public:
- typedef QWidget *(*page_creator_fptr) (base_qobject&, welcome_wizard *);
+ typedef QWidget *(*page_creator_fptr) (welcome_wizard *);
- welcome_wizard (base_qobject& oct_qobj, QWidget *parent = nullptr);
+ welcome_wizard (QWidget *parent = nullptr);
~welcome_wizard (void) = default;
@@ -50,8 +48,6 @@
private:
- base_qobject& m_octave_qobj;
-
QList m_page_ctor_list;
QList::iterator m_page_list_iterator;
QWidget *m_current_page;
@@ -77,14 +73,14 @@
public:
- initial_page (base_qobject& oct_qobj, welcome_wizard *wizard);
+ initial_page (welcome_wizard *wizard);
~initial_page (void) = default;
static QWidget *
- create (base_qobject& oct_qobj, welcome_wizard *wizard)
+ create (welcome_wizard *wizard)
{
- return new initial_page (oct_qobj, wizard);
+ return new initial_page (wizard);
}
private:
@@ -103,14 +99,14 @@
public:
- setup_community_news (base_qobject& oct_qobj, welcome_wizard *wizard);
+ setup_community_news (welcome_wizard *wizard);
~setup_community_news (void) = default;
static QWidget *
- create (base_qobject& oct_qobj, welcome_wizard *wizard)
+ create (welcome_wizard *wizard)
{
- return new setup_community_news (oct_qobj, wizard);
+ return new setup_community_news (wizard);
}
private:
@@ -132,14 +128,14 @@
public:
- final_page (base_qobject& oct_qobj, welcome_wizard *wizard);
+ final_page (welcome_wizard *wizard);
~final_page (void) = default;
static QWidget *
- create (base_qobject& oct_qobj, welcome_wizard *wizard)
+ create (welcome_wizard *wizard)
{
- return new final_page (oct_qobj, wizard);
+ return new final_page (wizard);
}
private:
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/workspace-model.cc
--- a/libgui/src/workspace-model.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/workspace-model.cc Tue Dec 06 15:17:16 2022 -0500
@@ -33,7 +33,6 @@
#include "gui-preferences-ws.h"
#include "gui-settings.h"
-#include "octave-qobject.h"
#include "workspace-model.h"
#include "syminfo.h"
@@ -198,15 +197,17 @@
}
void
- workspace_model::notice_settings (const gui_settings *settings)
+ workspace_model::notice_settings (void)
{
- m_enable_colors = settings->value (ws_enable_colors).toBool ();
+ gui_settings settings;
- int mode = settings->value (ws_color_mode).toInt ();
+ m_enable_colors = settings.value (ws_enable_colors).toBool ();
+
+ int mode = settings.value (ws_color_mode).toInt ();
for (int i = 0; i < ws_colors_count; i++)
{
- QColor setting_color = settings->color_value (ws_colors[i], mode);
+ QColor setting_color = settings.color_value (ws_colors[i], mode);
QPalette p (setting_color);
m_storage_class_colors.replace (i, setting_color);
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/workspace-model.h
--- a/libgui/src/workspace-model.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/workspace-model.h Tue Dec 06 15:17:16 2022 -0500
@@ -34,8 +34,6 @@
#include
#include
-#include "gui-settings.h"
-
#include "syminfo.h"
// Defined for purposes of sending QList as part of signal.
@@ -88,7 +86,7 @@
void clear_workspace (void);
- void notice_settings (const gui_settings *);
+ void notice_settings (void);
private:
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/workspace-view.cc
--- a/libgui/src/workspace-view.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/workspace-view.cc Tue Dec 06 15:17:16 2022 -0500
@@ -42,6 +42,7 @@
#include
#include "gui-preferences-ws.h"
+#include "gui-settings.h"
#include "octave-qobject.h"
#include "octave-qtutils.h"
#include "workspace-view.h"
@@ -94,51 +95,46 @@
ws_layout->addWidget (m_view);
ws_layout->setSpacing (0);
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
- if (settings)
- {
- m_filter_shown = settings->value (ws_filter_shown).toBool ();
- m_filter_widget->setVisible (m_filter_shown);
+ m_filter_shown = settings.value (ws_filter_shown).toBool ();
+ m_filter_widget->setVisible (m_filter_shown);
- ws_layout->setMargin (2);
+ ws_layout->setMargin (2);
- // Set the empty widget to have our layout.
- widget ()->setLayout (ws_layout);
+ // Set the empty widget to have our layout.
+ widget ()->setLayout (ws_layout);
- // Initialize collapse/expand state of the workspace subcategories.
+ // Initialize collapse/expand state of the workspace subcategories.
- //enable sorting (setting column and order after model was set)
- m_view->setSortingEnabled (true);
- // Initialize column order and width of the workspace
- m_view->horizontalHeader ()->restoreState
- (settings->value (ws_column_state.key).toByteArray ());
+ //enable sorting (setting column and order after model was set)
+ m_view->setSortingEnabled (true);
+ // Initialize column order and width of the workspace
+ m_view->horizontalHeader ()->restoreState
+ (settings.value (ws_column_state.key).toByteArray ());
- // Set header properties for sorting
- m_view->horizontalHeader ()->setSectionsClickable (true);
- m_view->horizontalHeader ()->setSectionsMovable (true);
- m_view->horizontalHeader ()->setSortIndicator (
- settings->value (ws_sort_column).toInt (),
- static_cast (settings->value (ws_sort_order).toUInt ()));
- // FIXME: use value instead of static cast after
- // dropping support of Qt 5.4
+ // Set header properties for sorting
+ m_view->horizontalHeader ()->setSectionsClickable (true);
+ m_view->horizontalHeader ()->setSectionsMovable (true);
+ m_view->horizontalHeader ()->setSortIndicator (
+ settings.value (ws_sort_column).toInt (),
+ static_cast (settings.value (ws_sort_order).toUInt ()));
+ // FIXME: use value instead of static cast after
+ // dropping support of Qt 5.4
- m_view->horizontalHeader ()->setSortIndicatorShown (true);
+ m_view->horizontalHeader ()->setSortIndicatorShown (true);
- m_view->horizontalHeader ()->setContextMenuPolicy (Qt::CustomContextMenu);
- connect (m_view->horizontalHeader (),
- &QTableView::customContextMenuRequested,
- this, &workspace_view::header_contextmenu_requested);
+ m_view->horizontalHeader ()->setContextMenuPolicy (Qt::CustomContextMenu);
+ connect (m_view->horizontalHeader (),
+ &QTableView::customContextMenuRequested,
+ this, &workspace_view::header_contextmenu_requested);
- // Init state of the filter
- m_filter->addItems (settings->value (ws_mru_list.key).toStringList ());
+ // Init state of the filter
+ m_filter->addItems (settings.value (ws_mru_list.key).toStringList ());
- bool filter_state =
- settings->value (ws_filter_active).toBool ();
- m_filter_checkbox->setChecked (filter_state);
- filter_activate (filter_state);
- }
+ bool filter_state = settings.value (ws_filter_active).toBool ();
+ m_filter_checkbox->setChecked (filter_state);
+ filter_activate (filter_state);
// Connect signals and slots.
@@ -167,11 +163,12 @@
m_view->setModel (&m_filter_model);
// set the sorting after the model is set, it would be ignored otherwise
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+
+ gui_settings settings;
+
m_view->sortByColumn (
- settings->value (ws_sort_column).toInt (),
- static_cast (settings->value (ws_sort_order).toUInt ()));
+ settings.value (ws_sort_column).toInt (),
+ static_cast (settings.value (ws_sort_order).toUInt ()));
// FIXME: use value instead of static cast after
// dropping support of Qt 5.4
@@ -179,17 +176,19 @@
}
void
- workspace_view::notice_settings (const gui_settings *settings)
+ workspace_view::notice_settings (void)
{
- m_model->notice_settings (settings); // update colors of model first
+ gui_settings settings;
+
+ m_model->notice_settings (); // update colors of model first
for (int i = 0; i < ws_columns_shown.length (); i++)
- m_view->setColumnHidden (i + 1, ! settings->value (ws_columns_shown_keys.at (i), true).toBool ());
+ m_view->setColumnHidden (i + 1, ! settings.value (ws_columns_shown_keys.at (i), true).toBool ());
QString tool_tip;
- if (settings->value (ws_enable_colors).toBool ()
- && ! settings->value (ws_hide_tool_tips).toBool ())
+ if (settings.value (ws_enable_colors).toBool ()
+ && ! settings.value (ws_hide_tool_tips).toBool ())
{
tool_tip = QString (tr ("View the variables in the active workspace.
"));
tool_tip += QString (tr ("Colors for variable attributes:"));
@@ -211,29 +210,25 @@
void
workspace_view::save_settings (void)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
- if (! settings)
- return;
-
- settings->setValue (ws_column_state.key,
- m_view->horizontalHeader ()->saveState ());
+ settings.setValue (ws_column_state.key,
+ m_view->horizontalHeader ()->saveState ());
int sort_column = m_view->horizontalHeader ()->sortIndicatorSection ();
Qt::SortOrder sort_order = m_view->horizontalHeader ()->sortIndicatorOrder ();
- settings->setValue (ws_sort_column.key, sort_column);
- settings->setValue (ws_sort_order.key, sort_order);
+ settings.setValue (ws_sort_column.key, sort_column);
+ settings.setValue (ws_sort_order.key, sort_order);
- settings->setValue (ws_filter_active.key, m_filter_checkbox->isChecked ());
- settings->setValue (ws_filter_shown.key, m_filter_shown);
+ settings.setValue (ws_filter_active.key, m_filter_checkbox->isChecked ());
+ settings.setValue (ws_filter_shown.key, m_filter_shown);
QStringList mru;
for (int i = 0; i < m_filter->count (); i++)
mru.append (m_filter->itemText (i));
- settings->setValue (ws_mru_list.key, mru);
+ settings.setValue (ws_mru_list.key, mru);
- settings->sync ();
+ settings.sync ();
octave_dock_widget::save_settings ();
}
@@ -292,8 +287,7 @@
QMenu menu (this);
QSignalMapper sig_mapper (this);
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
for (int i = 0; i < ws_columns_shown.length (); i++)
{
@@ -302,7 +296,7 @@
&sig_mapper, SLOT (map ()));
sig_mapper.setMapping (action, i);
action->setCheckable (true);
- action->setChecked (settings->value (ws_columns_shown_keys.at (i), true).toBool ());
+ action->setChecked (settings.value (ws_columns_shown_keys.at (i), true).toBool ());
}
// FIXME: We could use
@@ -328,16 +322,15 @@
void
workspace_view::toggle_header (int col)
{
- resource_manager& rmgr = m_octave_qobj.get_resource_manager ();
- gui_settings *settings = rmgr.get_settings ();
+ gui_settings settings;
QString key = ws_columns_shown_keys.at (col);
- bool shown = settings->value (key, true).toBool ();
+ bool shown = settings.value (key, true).toBool ();
m_view->setColumnHidden (col + 1, shown);
- settings->setValue (key, ! shown);
- settings->sync ();
+ settings.setValue (key, ! shown);
+ settings.sync ();
octave_dock_widget::save_settings ();
}
diff -r 9089bd969b37 -r bd9da634f00d libgui/src/workspace-view.h
--- a/libgui/src/workspace-view.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libgui/src/workspace-view.h Tue Dec 06 15:17:16 2022 -0500
@@ -74,7 +74,7 @@
void setModel (workspace_model *model);
- void notice_settings (const gui_settings *);
+ void notice_settings (void);
void save_settings (void);
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/c-file-ptr-stream.h
--- a/libinterp/corefcn/c-file-ptr-stream.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/c-file-ptr-stream.h Tue Dec 06 15:17:16 2022 -0500
@@ -232,39 +232,4 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-
-OCTAVE_DEPRECATED (7, "use 'octave::i_c_file_ptr_stream' instead")
-typedef octave::i_c_file_ptr_stream i_c_file_ptr_stream;
-
-OCTAVE_DEPRECATED (7, "use 'octave::o_c_file_ptr_stream' instead")
-typedef octave::o_c_file_ptr_stream o_c_file_ptr_stream;
-
-OCTAVE_DEPRECATED (7, "use 'octave::io_c_file_ptr_stream' instead")
-typedef octave::io_c_file_ptr_stream io_c_file_ptr_stream;
-
-// FIXME: HAVE_ZLIB is not defined here because we do not (and should
-// not) include config.h in this header file. We need to find a way to
-// define this interface without exposing gzFile. Should this be a
-// private header that can only be used if included after config.h in an
-// Octave source file and not inside another header file?
-
-# if defined (HAVE_ZLIB)
-
-OCTAVE_DEPRECATED (7, "use 'octave::i_c_zfile_ptr_stream' instead")
-typedef octave::c_file_ptr_stream
- i_c_zfile_ptr_stream;
-
-OCTAVE_DEPRECATED (7, "use 'octave::o_c_zfile_ptr_stream' instead")
-typedef octave::c_file_ptr_stream
- o_c_zfile_ptr_stream;
-
-OCTAVE_DEPRECATED (7, "use 'octave::io_c_zfile_ptr_stream' instead")
-typedef octave::c_file_ptr_stream
- io_c_zfile_ptr_stream;
-
-# endif
-
#endif
-
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/data.cc
--- a/libinterp/corefcn/data.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/data.cc Tue Dec 06 15:17:16 2022 -0500
@@ -6523,7 +6523,7 @@
(@dots{}((@var{A1} * @var{A2}) * @var{A3}) * @dots{})
@end example
-@seealso{times, plus, minus, rdivide, mrdivide, mldivide, mpower}
+@seealso{times, plus, minus, rdivide, mrdivide, mldivide, mpower, tensorprod}
@end deftypefn */)
{
return binary_assoc_op_defun_body (octave_value::op_mul,
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/data.h
--- a/libinterp/corefcn/data.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/data.h Tue Dec 06 15:17:16 2022 -0500
@@ -41,14 +41,4 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-OCTAVE_DEPRECATED (7, "use 'octave::do_class_concat' instead")
-inline OCTINTERP_API octave_value
-do_class_concat (const octave_value_list& ovl, const std::string& cattype,
- int dim)
-{
- return octave::do_class_concat (ovl, cattype, dim);
-}
#endif
-
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/dot.cc
--- a/libinterp/corefcn/dot.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/dot.cc Tue Dec 06 15:17:16 2022 -0500
@@ -91,7 +91,7 @@
the result is equivalent to @code{@var{X}' * @var{Y}}. Although, @code{dot}
is defined for integer arrays, the output may differ from the expected result
due to the limited range of integer objects.
-@seealso{cross, divergence}
+@seealso{cross, divergence, tensorprod}
@end deftypefn */)
{
int nargin = args.length ();
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/error.cc
--- a/libinterp/corefcn/error.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/error.cc Tue Dec 06 15:17:16 2022 -0500
@@ -901,17 +901,6 @@
last_error_stack (make_stack_map (ee.stack_info ()));
}
-// DEPRECATED in Octave 7.
-void error_system::display_exception (const execution_exception& ee,
- std::ostream& os) const
-{
- if (m_beep_on_error)
- os << "\a";
-
- ee.display (octave_diary);
- ee.display (os);
-}
-
void error_system::display_exception (const execution_exception& ee) const
{
// FIXME: How should we handle beep_on_error?
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/error.h
--- a/libinterp/corefcn/error.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/error.h Tue Dec 06 15:17:16 2022 -0500
@@ -334,13 +334,6 @@
OCTINTERP_API void save_exception (const execution_exception& ee);
- // FIXME
- //#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
- OCTAVE_DEPRECATED (7, "second argument is no longer accepted")
- OCTINTERP_API void display_exception (const execution_exception& ee,
- std::ostream& os) const;
- //#endif
-
OCTINTERP_API void display_exception (const execution_exception& ee) const;
private:
@@ -573,44 +566,4 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-OCTAVE_DEPRECATED (7, "use 'octave::defun_usage_message' instead")
-inline void defun_usage_message (const std::string& msg)
-{
- octave::defun_usage_message (msg);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::set_warning_state' instead")
-inline octave_value_list
-set_warning_state (const std::string& id, const std::string& state)
-{
- return octave::set_warning_state (id, state);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::set_warning_state' instead")
-inline octave_value_list set_warning_state (const octave_value_list& args)
-{
- return octave::set_warning_state (args);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::warning_enabled' instead")
-inline int warning_enabled (const std::string& id)
-{
- return octave::warning_enabled (id);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::disable_warning' instead")
-inline void disable_warning (const std::string& id)
-{
- octave::disable_warning (id);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::interpreter_try' instead")
-inline void interpreter_try (octave::unwind_protect& uwp)
-{
- octave::interpreter_try (uwp);
-}
-
#endif
-
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/graphics.in.h
--- a/libinterp/corefcn/graphics.in.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/graphics.in.h Tue Dec 06 15:17:16 2022 -0500
@@ -6958,164 +6958,4 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-
-OCTAVE_DEPRECATED (7, "use 'octave::base_scaler' instead")
-typedef octave::base_scaler base_scaler;
-
-OCTAVE_DEPRECATED (7, "use 'octave::lin_scaler' instead")
-typedef octave::lin_scaler lin_scaler;
-
-OCTAVE_DEPRECATED (7, "use 'octave::log_scaler' instead")
-typedef octave::log_scaler log_scaler;
-
-OCTAVE_DEPRECATED (7, "use 'octave::neg_log_scaler' instead")
-typedef octave::neg_log_scaler neg_log_scaler;
-
-OCTAVE_DEPRECATED (7, "use 'octave::scaler' instead")
-typedef octave::scaler scaler;
-
-OCTAVE_DEPRECATED (7, "use 'octave::base_property' instead")
-typedef octave::base_property base_property;
-
-OCTAVE_DEPRECATED (7, "use 'octave::string_property' instead")
-typedef octave::string_property string_property;
-
-OCTAVE_DEPRECATED (7, "use 'octave::string_array_property' instead")
-typedef octave::string_array_property string_array_property;
-
-OCTAVE_DEPRECATED (7, "use 'octave::text_label_property' instead")
-typedef octave::text_label_property text_label_property;
-
-OCTAVE_DEPRECATED (7, "use 'octave::radio_values' instead")
-typedef octave::radio_values radio_values;
-
-OCTAVE_DEPRECATED (7, "use 'octave::radio_property' instead")
-typedef octave::radio_property radio_property;
-
-OCTAVE_DEPRECATED (7, "use 'octave::color_values' instead")
-typedef octave::color_values color_values;
-
-OCTAVE_DEPRECATED (7, "use 'octave::color_property' instead")
-typedef octave::color_property color_property;
-
-OCTAVE_DEPRECATED (7, "use 'octave::double_property' instead")
-typedef octave::double_property double_property;
-
-OCTAVE_DEPRECATED (7, "use 'octave::double_radio_property' instead")
-typedef octave::double_radio_property double_radio_property;
-
-OCTAVE_DEPRECATED (7, "use 'octave::array_property' instead")
-typedef octave::array_property array_property;
-
-OCTAVE_DEPRECATED (7, "use 'octave::row_vector_property' instead")
-typedef octave::row_vector_property row_vector_property;
-
-OCTAVE_DEPRECATED (7, "use 'octave::bool_property' instead")
-typedef octave::bool_property bool_property;
-
-OCTAVE_DEPRECATED (7, "use 'octave::handle_property' instead")
-typedef octave::handle_property handle_property;
-
-OCTAVE_DEPRECATED (7, "use 'octave::any_property' instead")
-typedef octave::any_property any_property;
-
-OCTAVE_DEPRECATED (7, "use 'octave::children_property' instead")
-typedef octave::children_property children_property;
-
-OCTAVE_DEPRECATED (7, "use 'octave::callback_property' instead")
-typedef octave::callback_property callback_property;
-
-OCTAVE_DEPRECATED (7, "use 'octave::property' instead")
-typedef octave::property property;
-
-OCTAVE_DEPRECATED (7, "use 'octave::pval_vector' instead")
-typedef octave::pval_vector pval_vector;
-
-OCTAVE_DEPRECATED (7, "use 'octave::property_list' instead")
-typedef octave::property_list property_list;
-
-OCTAVE_DEPRECATED (7, "use 'octave::base_properties' instead")
-typedef octave::base_properties base_properties;
-
-OCTAVE_DEPRECATED (7, "use 'octave::base_graphics_object' instead")
-typedef octave::base_graphics_object base_graphics_object;
-
-OCTAVE_DEPRECATED (7, "use 'octave::graphics_object' instead")
-typedef octave::graphics_object graphics_object;
-
-OCTAVE_DEPRECATED (7, "use 'octave::root_figure' instead")
-typedef octave::root_figure root_figure;
-
-OCTAVE_DEPRECATED (7, "use 'octave::figure' instead")
-typedef octave::figure figure;
-
-OCTAVE_DEPRECATED (7, "use 'octave::graphics_xform' instead")
-typedef octave::graphics_xform graphics_xform;
-
-OCTAVE_DEPRECATED (7, "use 'octave::axes' instead")
-typedef octave::axes axes;
-
-OCTAVE_DEPRECATED (7, "use 'octave::line' instead")
-typedef octave::line line;
-
-OCTAVE_DEPRECATED (7, "use 'octave::text' instead")
-typedef octave::text text;
-
-OCTAVE_DEPRECATED (7, "use 'octave::image' instead")
-typedef octave::image image;
-
-OCTAVE_DEPRECATED (7, "use 'octave::light' instead")
-typedef octave::light light;
-
-OCTAVE_DEPRECATED (7, "use 'octave::patch' instead")
-typedef octave::patch patch;
-
-OCTAVE_DEPRECATED (7, "use 'octave::scatter' instead")
-typedef octave::scatter scatter;
-
-OCTAVE_DEPRECATED (7, "use 'octave::surface' instead")
-typedef octave::surface surface;
-
-OCTAVE_DEPRECATED (7, "use 'octave::hggroup' instead")
-typedef octave::hggroup hggroup;
-
-OCTAVE_DEPRECATED (7, "use 'octave::uimenu' instead")
-typedef octave::uimenu uimenu;
-
-OCTAVE_DEPRECATED (7, "use 'octave::uicontextmenu' instead")
-typedef octave::uicontextmenu uicontextmenu;
-
-OCTAVE_DEPRECATED (7, "use 'octave::uicontrol' instead")
-typedef octave::uicontrol uicontrol;
-
-OCTAVE_DEPRECATED (7, "use 'octave::uibuttongroup' instead")
-typedef octave::uibuttongroup uibuttongroup;
-
-OCTAVE_DEPRECATED (7, "use 'octave::uipanel' instead")
-typedef octave::uipanel uipanel;
-
-OCTAVE_DEPRECATED (7, "use 'octave::uitable' instead")
-typedef octave::uitable uitable;
-
-OCTAVE_DEPRECATED (7, "use 'octave::uitoolbar' instead")
-typedef octave::uitoolbar uitoolbar;
-
-OCTAVE_DEPRECATED (7, "use 'octave::uipushtool' instead")
-typedef octave::uipushtool uipushtool;
-
-OCTAVE_DEPRECATED (7, "use 'octave::uitoggletool' instead")
-typedef octave::uitoggletool uitoggletool;
-
-OCTAVE_DEPRECATED (7, "use 'octave::base_graphics_event' instead")
-typedef octave::base_graphics_event base_graphics_event;
-
-OCTAVE_DEPRECATED (7, "use 'octave::graphics_event' instead")
-typedef octave::graphics_event graphics_event;
-
-OCTAVE_DEPRECATED (7, "use 'octave::gh_manager' instead")
-typedef octave::gh_manager gh_manager;
-
#endif
-
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/hook-fcn.h
--- a/libinterp/corefcn/hook-fcn.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/hook-fcn.h Tue Dec 06 15:17:16 2022 -0500
@@ -214,21 +214,4 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-OCTAVE_DEPRECATED (7, "use 'octave::base_hook_function' instead")
-typedef octave::base_hook_function base_hook_function;
-
-OCTAVE_DEPRECATED (7, "use 'octave::hook_function' instead")
-typedef octave::hook_function hook_function;
-
-OCTAVE_DEPRECATED (7, "use 'octave::named_hook_function' instead")
-typedef octave::named_hook_function named_hook_function;
-
-OCTAVE_DEPRECATED (7, "use 'octave::fcn_handle_hook_function' instead")
-typedef octave::fcn_handle_hook_function fcn_handle_hook_function;
-
-OCTAVE_DEPRECATED (7, "use 'octave::hook_function_list' instead")
-typedef octave::hook_function_list hook_function_list;
#endif
-
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/kron.cc
--- a/libinterp/corefcn/kron.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/kron.cc Tue Dec 06 15:17:16 2022 -0500
@@ -275,6 +275,7 @@
@noindent
Since the Kronecker product is associative, this is well-defined.
+@seealso{tensorprod}
@end deftypefn */)
{
int nargin = args.length ();
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/load-save.cc
--- a/libinterp/corefcn/load-save.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/load-save.cc Tue Dec 06 15:17:16 2022 -0500
@@ -2060,13 +2060,3 @@
}
OCTAVE_END_NAMESPACE(octave)
-
-// DEPRECATED in Octave 7
-
-void
-dump_octave_core (void)
-{
- octave::load_save_system& load_save_sys = octave::__get_load_save_system__ ();
-
- load_save_sys.dump_octave_core ();
-}
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/load-save.h
--- a/libinterp/corefcn/load-save.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/load-save.h Tue Dec 06 15:17:16 2022 -0500
@@ -294,7 +294,4 @@
OCTAVE_END_NAMESPACE(octave)
-OCTAVE_DEPRECATED (7, "use 'load_save_system::dump_octave_core' instead")
-extern OCTINTERP_API void dump_octave_core (void);
-
#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/ls-ascii-helper.h
--- a/libinterp/corefcn/ls-ascii-helper.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/ls-ascii-helper.h Tue Dec 06 15:17:16 2022 -0500
@@ -44,29 +44,4 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-
-OCTAVE_DEPRECATED (7, "use 'octave::skip_until_newline' instead")
-inline void
-skip_until_newline (std::istream& is, bool keep_newline = false)
-{
- return octave::skip_until_newline (is, keep_newline);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::skip_preceding_newline' instead")
-inline void
-skip_preceeding_newline (std::istream& is)
-{
- return octave::skip_preceeding_newline (is);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::read_until_newline' instead")
-inline std::string
-read_until_newline (std::istream& is, bool keep_newline = false)
-{
- return octave::read_until_newline (is, keep_newline);
-}
-
#endif
-
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/ls-utils.h
--- a/libinterp/corefcn/ls-utils.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/ls-utils.h Tue Dec 06 15:17:16 2022 -0500
@@ -40,22 +40,4 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-
-OCTAVE_DEPRECATED (7, "use 'octave::get_save_type' instead")
-inline save_type
-get_save_type (double max_val, double min_val)
-{
- return octave::get_save_type (max_val, min_val);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::get_save_type' instead")
-inline save_type
-get_save_type (float max_val, float min_val)
-{
- return octave::get_save_type (max_val, min_val);
-}
-
#endif
-
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/oct-fstrm.h
--- a/libinterp/corefcn/oct-fstrm.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/oct-fstrm.h Tue Dec 06 15:17:16 2022 -0500
@@ -90,11 +90,4 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-
-OCTAVE_DEPRECATED (7, "use 'octave::fstream' instead")
-typedef octave::fstream octave_fstream;
-
#endif
-
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/oct-hdf5-types.h
--- a/libinterp/corefcn/oct-hdf5-types.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/oct-hdf5-types.h Tue Dec 06 15:17:16 2022 -0500
@@ -38,16 +38,6 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-
-OCTAVE_DEPRECATED (7, "use 'octave::check_hdf5_types' instead")
-inline bool check_hdf5_types (bool warn = true)
-{
- return octave::check_hdf5_types (warn);
-}
-
-#endif
-
#endif
// Available for C and C++.
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/oct-iostrm.h
--- a/libinterp/corefcn/oct-iostrm.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/oct-iostrm.h Tue Dec 06 15:17:16 2022 -0500
@@ -161,17 +161,4 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-
-OCTAVE_DEPRECATED (7, "use 'octave::base_iostream' instead")
-typedef octave::base_iostream octave_base_iostream;
-
-OCTAVE_DEPRECATED (7, "use 'octave::istream' instead")
-typedef octave::istream octave_istream;
-
-OCTAVE_DEPRECATED (7, "use 'octave::ostream' instead")
-typedef octave::ostream octave_ostream;
-
#endif
-
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/oct-prcstrm.h
--- a/libinterp/corefcn/oct-prcstrm.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/oct-prcstrm.h Tue Dec 06 15:17:16 2022 -0500
@@ -98,14 +98,4 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-
-OCTAVE_DEPRECATED (7, "use 'octave::octave_iprocstream' instead")
-typedef octave::octave_iprocstream octave_iprocstream;
-
-OCTAVE_DEPRECATED (7, "use 'octave::octave_oprocstream' instead")
-typedef octave::octave_oprocstream octave_oprocstream;
-
#endif
-
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/oct-procbuf.h
--- a/libinterp/corefcn/oct-procbuf.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/oct-procbuf.h Tue Dec 06 15:17:16 2022 -0500
@@ -83,11 +83,4 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-
-OCTAVE_DEPRECATED (7, "use octave::procbuf' instead")
-typedef octave::procbuf procbuf;
-
#endif
-
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/oct-stdstrm.h
--- a/libinterp/corefcn/oct-stdstrm.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/oct-stdstrm.h Tue Dec 06 15:17:16 2022 -0500
@@ -199,14 +199,4 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-
-OCTAVE_DEPRECATED (7, "use 'octave::stdiostream' instead")
-typedef octave::stdiostream octave_stdiostream;
-
-OCTAVE_DEPRECATED (7, "use 'octave::zstdiostream' instead")
-typedef octave::zstdiostream octave_zstdiostream;
-
#endif
-
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/oct-stream.cc
--- a/libinterp/corefcn/oct-stream.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/oct-stream.cc Tue Dec 06 15:17:16 2022 -0500
@@ -4288,6 +4288,9 @@
{
T value = T ();
+ is >> std::ws; // skip through whitespace and advance stream pointer
+ std::streampos pos = is.tellg ();
+
switch (fmt.type)
{
case 'o':
@@ -4301,11 +4304,7 @@
case 'i':
{
- int c1 = std::istream::traits_type::eof ();
-
- while (is && (c1 = is.get ()) != std::istream::traits_type::eof ()
- && isspace (c1))
- ; // skip whitespace
+ int c1 = is.get ();
if (c1 != std::istream::traits_type::eof ())
{
@@ -4354,18 +4353,33 @@
break;
}
- // If conversion produces an integer that overflows, failbit is set but
- // value is non-zero. We want to treat this case as success, so clear
- // failbit from the stream state to keep going.
- // FIXME: Maybe set error state on octave stream as above? Matlab does
- // *not* indicate an error message on overflow.
- if ((is.rdstate () & std::ios::failbit) && value != T ())
- is.clear (is.rdstate () & ~std::ios::failbit);
-
- // Only copy the converted value if the stream is in a state where we
- // want to continue reading.
- if (! (is.rdstate () & std::ios::failbit))
- *valptr = value;
+ std::ios::iostate status = is.rdstate ();
+ if (! (status & std::ios::failbit))
+ {
+ // Copy the converted value if the stream is in a good state
+ *valptr = value;
+ }
+ else
+ {
+ if (value != T ())
+ {
+ // If conversion produces an integer that overflows, failbit is set
+ // but value is non-zero. We want to treat this case as success,
+ // so clear failbit from the stream state to keep going.
+ // FIXME: Maybe set error state on octave stream? Matlab does
+ // *not* indicate an error message on overflow.
+ is.clear (status & ~std::ios::failbit);
+ *valptr = value;
+ }
+ else
+ {
+ // True error.
+ // Reset stream to original position, clear eof bit, pass status on.
+ is.clear ();
+ is.seekg (pos);
+ is.setstate (status & ~std::ios_base::eofbit);
+ }
+ }
return is;
}
@@ -4433,17 +4447,20 @@
case 'E':
case 'G':
{
- int c1 = std::istream::traits_type::eof ();
-
- while (is && (c1 = is.get ()) != std::istream::traits_type::eof ()
- && isspace (c1))
- ; // skip whitespace
-
- if (c1 != std::istream::traits_type::eof ())
+ is >> std::ws; // skip through whitespace and advance stream pointer
+ if (is.good ())
{
- is.putback (c1);
+ std::streampos pos = is.tellg ();
ref = read_value (is);
+
+ std::ios::iostate status = is.rdstate ();
+ if (status & std::ios::failbit)
+ {
+ is.clear ();
+ is.seekg (pos);
+ is.setstate (status & ~std::ios_base::eofbit);
+ }
}
}
break;
@@ -4497,11 +4514,16 @@
{ \
int c = std::istream::traits_type::eof (); \
\
+ /* get all whitespace characters */ \
while (is && (c = is.get ()) != std::istream::traits_type::eof () \
&& isspace (c)) \
{ /* skip whitespace */ } \
\
- if (c != std::istream::traits_type::eof ()) \
+ if (c == std::istream::traits_type::eof ()) \
+ /* reset failbit at eof */ \
+ is.clear (is.rdstate () & (~std::ios::failbit)); \
+ else \
+ /* put back non-whitespace character */ \
is.putback (c); \
} \
while (0)
@@ -4566,8 +4588,8 @@
&& (c = is.get ()) != std::istream::traits_type::eof ()) \
tmp[n++] = static_cast (c); \
\
- if (n > 0 && c == std::istream::traits_type::eof ()) \
- is.clear (); \
+ if (c == std::istream::traits_type::eof ()) \
+ is.clear (is.rdstate () & (~std::ios::failbit)); \
\
tmp.resize (n)
@@ -4609,8 +4631,8 @@
tmp[n++] = static_cast (c); \
} \
\
- if (n > 0 && c == std::istream::traits_type::eof ()) \
- is.clear (); \
+ if (c == std::istream::traits_type::eof ()) \
+ is.clear (is.rdstate () & (~std::ios::failbit)); \
\
tmp.resize (n); \
} \
@@ -4623,15 +4645,13 @@
// This format must match a nonempty sequence of characters.
#define BEGIN_CHAR_CLASS_CONVERSION() \
- int width = elt->width; \
+ int width = (elt->width ? elt->width \
+ : std::numeric_limits::max ()); \
\
std::string tmp; \
\
do \
{ \
- if (! width) \
- width = std::numeric_limits::max (); \
- \
std::ostringstream buf; \
\
std::string char_class = elt->char_class; \
@@ -4642,29 +4662,39 @@
{ \
int chars_read = 0; \
while (is && chars_read++ < width \
- && (c = is.get ()) != std::istream::traits_type::eof () \
- && char_class.find (c) != std::string::npos) \
- buf << static_cast (c); \
+ && (c = is.get ()) != std::istream::traits_type::eof ()) \
+ { \
+ if (char_class.find (c) != std::string::npos) \
+ buf << static_cast (c); \
+ else \
+ { \
+ is.putback (c); \
+ break; \
+ } \
+ } \
} \
else \
{ \
int chars_read = 0; \
while (is && chars_read++ < width \
- && (c = is.get ()) != std::istream::traits_type::eof () \
- && char_class.find (c) == std::string::npos) \
- buf << static_cast (c); \
+ && (c = is.get ()) != std::istream::traits_type::eof ()) \
+ { \
+ if (char_class.find (c) == std::string::npos) \
+ buf << static_cast (c); \
+ else \
+ { \
+ is.putback (c); \
+ break; \
+ } \
+ } \
} \
\
- if (width == std::numeric_limits::max () \
- && c != std::istream::traits_type::eof ()) \
- is.putback (c); \
- \
tmp = buf.str (); \
\
if (tmp.empty ()) \
is.setstate (std::ios::failbit); \
else if (c == std::istream::traits_type::eof ()) \
- is.clear (); \
+ is.clear (is.rdstate () & (~std::ios::failbit)); \
\
} \
while (0)
@@ -4676,7 +4706,7 @@
tmp = string::u8_from_encoding (who, tmp, encoding ()); \
width = tmp.length (); \
\
- if (is) \
+ if (is && width > 0) \
{ \
int i = 0; \
\
@@ -5048,10 +5078,10 @@
// If it looks like we have a matching failure, then
// reset the failbit in the stream state.
- if (! is.eof () && is.rdstate () & std::ios::failbit)
+ if (is.rdstate () & std::ios::failbit)
{
- error (who, "format failed to match");
is.clear (is.rdstate () & (~std::ios::failbit));
+ error (who, "format failed to match");
}
// FIXME: is this the right thing to do?
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/oct-strstrm.h
--- a/libinterp/corefcn/oct-strstrm.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/oct-strstrm.h Tue Dec 06 15:17:16 2022 -0500
@@ -194,17 +194,4 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-
-OCTAVE_DEPRECATED (7, "use 'octave::base_strstream' instead")
-typedef octave::base_strstream octave_base_strstream;
-
-OCTAVE_DEPRECATED (7, "use 'octave::istrstream' instead")
-typedef octave::istrstream octave_istrstream;
-
-OCTAVE_DEPRECATED (7, "use 'octave::ostrstream' instead")
-typedef octave::ostrstream octave_ostrstream;
-
#endif
-
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/procstream.h
--- a/libinterp/corefcn/procstream.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/procstream.h Tue Dec 06 15:17:16 2022 -0500
@@ -187,20 +187,4 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-
-OCTAVE_DEPRECATED (7, "use 'octave::procstreambase' instead")
-typedef octave::procstreambase procstreambase;
-
-OCTAVE_DEPRECATED (7, "use 'octave::iprocstream' instead")
-typedef octave::iprocstream iprocstream;
-
-OCTAVE_DEPRECATED (7, "use 'octave::oprocstream' instead")
-typedef octave::oprocstream oprocstream;
-
-OCTAVE_DEPRECATED (7, "use 'octave::procstream' instead")
-typedef octave::procstream procstream;
-
#endif
-
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/sparse-xdiv.h
--- a/libinterp/corefcn/sparse-xdiv.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/sparse-xdiv.h Tue Dec 06 15:17:16 2022 -0500
@@ -104,207 +104,4 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline Matrix
-xdiv (const Matrix& a, const SparseMatrix& b, MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline ComplexMatrix
-xdiv (const Matrix& a, const SparseComplexMatrix& b, MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline ComplexMatrix
-xdiv (const ComplexMatrix& a, const SparseMatrix& b, MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline ComplexMatrix
-xdiv (const ComplexMatrix& a, const SparseComplexMatrix& b, MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline SparseMatrix
-xdiv (const SparseMatrix& a, const SparseMatrix& b, MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline SparseComplexMatrix
-xdiv (const SparseMatrix& a, const SparseComplexMatrix& b, MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline SparseComplexMatrix
-xdiv (const SparseComplexMatrix& a, const SparseMatrix& b, MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline SparseComplexMatrix
-xdiv (const SparseComplexMatrix& a, const SparseComplexMatrix& b,
- MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline SparseMatrix
-xdiv (const SparseMatrix& a, const DiagMatrix& b, MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline SparseComplexMatrix
-xdiv (const SparseMatrix& a, const ComplexDiagMatrix& b, MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline SparseComplexMatrix
-xdiv (const SparseComplexMatrix& a, const DiagMatrix& b, MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline SparseComplexMatrix
-xdiv (const SparseComplexMatrix& a, const ComplexDiagMatrix& b, MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline Matrix
-x_el_div (double a, const SparseMatrix& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline ComplexMatrix
-x_el_div (double a, const SparseComplexMatrix& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline ComplexMatrix
-x_el_div (const Complex& a, const SparseMatrix& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline ComplexMatrix
-x_el_div (const Complex& a, const SparseComplexMatrix& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline Matrix
-xleftdiv (const SparseMatrix& a, const Matrix& b, MatrixType& typ)
-{
- return octave::xleftdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline ComplexMatrix
-xleftdiv (const SparseMatrix& a, const ComplexMatrix& b, MatrixType& typ)
-{
- return octave::xleftdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline ComplexMatrix
-xleftdiv (const SparseComplexMatrix& a, const Matrix& b, MatrixType& typ)
-{
- return octave::xleftdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline ComplexMatrix
-xleftdiv (const SparseComplexMatrix& a, const ComplexMatrix& b, MatrixType& typ)
-{
- return octave::xleftdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline SparseMatrix
-xleftdiv (const SparseMatrix& a, const SparseMatrix& b, MatrixType& typ)
-{
- return octave::xleftdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline SparseComplexMatrix
-xleftdiv (const SparseMatrix& a, const SparseComplexMatrix& b, MatrixType& typ)
-{
- return octave::xleftdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline SparseComplexMatrix
-xleftdiv (const SparseComplexMatrix& a, const SparseMatrix& b, MatrixType& typ)
-{
- return octave::xleftdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline SparseComplexMatrix
-xleftdiv (const SparseComplexMatrix& a, const SparseComplexMatrix& b,
- MatrixType& typ)
-{
- return octave::xleftdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline SparseMatrix
-xleftdiv (const DiagMatrix& a, const SparseMatrix& b, MatrixType& typ)
-{
- return octave::xleftdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline SparseComplexMatrix
-xleftdiv (const ComplexDiagMatrix& a, const SparseMatrix& b, MatrixType& typ)
-{
- return octave::xleftdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline SparseComplexMatrix
-xleftdiv (const DiagMatrix& a, const SparseComplexMatrix& b, MatrixType& typ)
-{
- return octave::xleftdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline SparseComplexMatrix
-xleftdiv (const ComplexDiagMatrix& a, const SparseComplexMatrix& b,
- MatrixType& typ)
-{
- return octave::xleftdiv (a, b, typ);
-}
-
#endif
-
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/sparse-xpow.h
--- a/libinterp/corefcn/sparse-xpow.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/sparse-xpow.h Tue Dec 06 15:17:16 2022 -0500
@@ -62,106 +62,4 @@
OCTAVE_END_NAMESPACE(octave)
-#if (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const SparseMatrix& a, double b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const SparseComplexMatrix& a, double b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (double a, const SparseMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (double a, const SparseComplexMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const SparseMatrix& a, double b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const SparseMatrix& a, const SparseMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const SparseMatrix& a, const Complex& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const SparseMatrix& a, const SparseComplexMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const Complex& a, const SparseMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const Complex& a, const SparseComplexMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const SparseComplexMatrix& a, double b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const SparseComplexMatrix& a, const SparseMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const SparseComplexMatrix& a, const Complex& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const SparseComplexMatrix& a, const SparseComplexMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
#endif
-
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/variables.h
--- a/libinterp/corefcn/variables.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/variables.h Tue Dec 06 15:17:16 2022 -0500
@@ -107,91 +107,6 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-
-OCTAVE_DEPRECATED (7, "use 'octave::symbol_exist' instead")
-inline int
-symbol_exist (const std::string& name, const std::string& type = "any")
-{
- return octave::symbol_exist (name, type);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::unique_symbol_name' instead")
-inline std::string
-unique_symbol_name (const std::string& basename)
-{
- return octave::unique_symbol_name (basename);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead")
-inline octave_value
-set_internal_variable (bool& var, const octave_value_list& args, int nargout,
- const char *nm)
-{
- return octave::set_internal_variable (var, args, nargout, nm);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead")
-inline octave_value
-set_internal_variable (char& var, const octave_value_list& args, int nargout,
- const char *nm)
-{
- return octave::set_internal_variable (var, args, nargout, nm);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead")
-inline octave_value
-set_internal_variable (int& var, const octave_value_list& args, int nargout,
- const char *nm,
- int minval = std::numeric_limits::min (),
- int maxval = std::numeric_limits::max ())
-{
- return octave::set_internal_variable (var, args, nargout, nm, minval, maxval);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead")
-inline octave_value
-set_internal_variable (double& var, const octave_value_list& args, int nargout,
- const char *nm,
- double minval = -octave::numeric_limits::Inf (),
- double maxval = octave::numeric_limits::Inf ())
-{
- return octave::set_internal_variable (var, args, nargout, nm, minval, maxval);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead")
-inline octave_value
-set_internal_variable (std::string& var, const octave_value_list& args,
- int nargout, const char *nm, bool empty_ok = true)
-{
- return octave::set_internal_variable (var, args, nargout, nm, empty_ok);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead")
-inline octave_value
-set_internal_variable (std::string& var, const octave_value_list& args,
- int nargout, const char *nm, const char **choices)
-{
- return octave::set_internal_variable (var, args, nargout, nm, choices);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead")
-inline octave_value
-set_internal_variable (int& var, const octave_value_list& args, int nargout,
- const char *nm, const char **choices)
-{
- return octave::set_internal_variable (var, args, nargout, nm, choices);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::maybe_missing_function_hook' instead")
-inline std::string
-maybe_missing_function_hook (const std::string& name)
-{
- return octave::maybe_missing_function_hook (name);
-}
-
-#endif
-
// The following macros should also be considered obsolete.
#define SET_INTERNAL_VARIABLE(NM) \
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/xdiv.h
--- a/libinterp/corefcn/xdiv.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/xdiv.h Tue Dec 06 15:17:16 2022 -0500
@@ -156,415 +156,4 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline Matrix
-xdiv (const Matrix& a, const Matrix& b, MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline ComplexMatrix
-xdiv (const Matrix& a, const ComplexMatrix& b, MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline ComplexMatrix
-xdiv (const ComplexMatrix& a, const Matrix& b, MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline ComplexMatrix
-xdiv (const ComplexMatrix& a, const ComplexMatrix& b, MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline Matrix
-x_el_div (double a, const Matrix& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline ComplexMatrix
-x_el_div (double a, const ComplexMatrix& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline ComplexMatrix
-x_el_div (const Complex a, const Matrix& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline ComplexMatrix
-x_el_div (const Complex a, const ComplexMatrix& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline NDArray
-x_el_div (double a, const NDArray& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline ComplexNDArray
-x_el_div (double a, const ComplexNDArray& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline ComplexNDArray
-x_el_div (const Complex a, const NDArray& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline ComplexNDArray
-x_el_div (const Complex a, const ComplexNDArray& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline Matrix
-xleftdiv (const Matrix& a, const Matrix& b,
- MatrixType& typ, blas_trans_type transt = blas_no_trans)
-{
- return octave::xleftdiv (a, b, typ, transt);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline ComplexMatrix
-xleftdiv (const Matrix& a, const ComplexMatrix& b,
- MatrixType& typ, blas_trans_type transt = blas_no_trans)
-{
- return octave::xleftdiv (a, b, typ, transt);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline ComplexMatrix
-xleftdiv (const ComplexMatrix& a, const Matrix& b,
- MatrixType& typ, blas_trans_type transt = blas_no_trans)
-{
- return octave::xleftdiv (a, b, typ, transt);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline ComplexMatrix
-xleftdiv (const ComplexMatrix& a, const ComplexMatrix& b,
- MatrixType& typ, blas_trans_type transt = blas_no_trans)
-{
- return octave::xleftdiv (a, b, typ, transt);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline FloatMatrix
-xdiv (const FloatMatrix& a, const FloatMatrix& b, MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline FloatComplexMatrix
-xdiv (const FloatMatrix& a, const FloatComplexMatrix& b, MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline FloatComplexMatrix
-xdiv (const FloatComplexMatrix& a, const FloatMatrix& b, MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline FloatComplexMatrix
-xdiv (const FloatComplexMatrix& a, const FloatComplexMatrix& b, MatrixType& typ)
-{
- return octave::xdiv (a, b, typ);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline FloatMatrix
-x_el_div (float a, const FloatMatrix& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline FloatComplexMatrix
-x_el_div (float a, const FloatComplexMatrix& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline FloatComplexMatrix
-x_el_div (const FloatComplex a, const FloatMatrix& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline FloatComplexMatrix
-x_el_div (const FloatComplex a, const FloatComplexMatrix& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline FloatNDArray
-x_el_div (float a, const FloatNDArray& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline FloatComplexNDArray
-x_el_div (float a, const FloatComplexNDArray& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline FloatComplexNDArray
-x_el_div (const FloatComplex a, const FloatNDArray& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
-inline FloatComplexNDArray
-x_el_div (const FloatComplex a, const FloatComplexNDArray& b)
-{
- return octave::elem_xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline FloatMatrix
-xleftdiv (const FloatMatrix& a, const FloatMatrix& b,
- MatrixType& typ, blas_trans_type transt = blas_no_trans)
-{
- return octave::xleftdiv (a, b, typ, transt);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline FloatComplexMatrix
-xleftdiv (const FloatMatrix& a, const FloatComplexMatrix& b,
- MatrixType& typ, blas_trans_type transt = blas_no_trans)
-{
- return octave::xleftdiv (a, b, typ, transt);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline FloatComplexMatrix
-xleftdiv (const FloatComplexMatrix& a, const FloatMatrix& b,
- MatrixType& typ, blas_trans_type transt = blas_no_trans)
-{
- return octave::xleftdiv (a, b, typ, transt);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline FloatComplexMatrix
-xleftdiv (const FloatComplexMatrix& a, const FloatComplexMatrix& b,
- MatrixType& typ, blas_trans_type transt = blas_no_trans)
-{
- return octave::xleftdiv (a, b, typ, transt);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline Matrix
-xdiv (const Matrix& a, const DiagMatrix& b)
-{
- return octave::xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline ComplexMatrix
-xdiv (const ComplexMatrix& a, const DiagMatrix& b)
-{
- return octave::xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline ComplexMatrix
-xdiv (const ComplexMatrix& a, const ComplexDiagMatrix& b)
-{
- return octave::xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline DiagMatrix
-xdiv (const DiagMatrix& a, const DiagMatrix& b)
-{
- return octave::xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline ComplexDiagMatrix
-xdiv (const ComplexDiagMatrix& a, const DiagMatrix& b)
-{
- return octave::xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline ComplexDiagMatrix
-xdiv (const ComplexDiagMatrix& a, const ComplexDiagMatrix& b)
-{
- return octave::xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline FloatMatrix
-xdiv (const FloatMatrix& a, const FloatDiagMatrix& b)
-{
- return octave::xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline FloatComplexMatrix
-xdiv (const FloatComplexMatrix& a, const FloatDiagMatrix& b)
-{
- return octave::xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline FloatComplexMatrix
-xdiv (const FloatMatrix& a, const FloatComplexDiagMatrix& b)
-{
- return octave::xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline FloatComplexMatrix
-xdiv (const FloatComplexMatrix& a, const FloatComplexDiagMatrix& b)
-{
- return octave::xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline FloatDiagMatrix
-xdiv (const FloatDiagMatrix& a, const FloatDiagMatrix& b)
-{
- return octave::xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline FloatComplexDiagMatrix
-xdiv (const FloatComplexDiagMatrix& a, const FloatDiagMatrix& b)
-{
- return octave::xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
-inline FloatComplexDiagMatrix
-xdiv (const FloatComplexDiagMatrix& a, const FloatComplexDiagMatrix& b)
-{
- return octave::xdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline Matrix
-xleftdiv (const DiagMatrix& a, const Matrix& b)
-{
- return octave::xleftdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline ComplexMatrix
-xleftdiv (const DiagMatrix& a, const ComplexMatrix& b)
-{
- return octave::xleftdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline ComplexMatrix
-xleftdiv (const ComplexDiagMatrix& a, const ComplexMatrix& b)
-{
- return octave::xleftdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline DiagMatrix
-xleftdiv (const DiagMatrix& a, const DiagMatrix& b)
-{
- return octave::xleftdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline ComplexDiagMatrix
-xleftdiv (const DiagMatrix& a, const ComplexDiagMatrix& b)
-{
- return octave::xleftdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline ComplexDiagMatrix
-xleftdiv (const ComplexDiagMatrix& a, const ComplexDiagMatrix& b)
-{
- return octave::xleftdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline FloatMatrix
-xleftdiv (const FloatDiagMatrix& a, const FloatMatrix& b)
-{
- return octave::xleftdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline FloatComplexMatrix
-xleftdiv (const FloatDiagMatrix& a, const FloatComplexMatrix& b)
-{
- return octave::xleftdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline FloatComplexMatrix
-xleftdiv (const FloatComplexDiagMatrix& a, const FloatComplexMatrix& b)
-{
- return octave::xleftdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline FloatDiagMatrix
-xleftdiv (const FloatDiagMatrix& a, const FloatDiagMatrix& b)
-{
- return octave::xleftdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline FloatComplexDiagMatrix
-xleftdiv (const FloatDiagMatrix& a, const FloatComplexDiagMatrix& b)
-{
- return octave::xleftdiv (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
-inline FloatComplexDiagMatrix
-xleftdiv (const FloatComplexDiagMatrix& a, const FloatComplexDiagMatrix& b)
-{
- return octave::xleftdiv (a, b);
-}
-
#endif
-
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/xnorm.h
--- a/libinterp/corefcn/xnorm.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/xnorm.h Tue Dec 06 15:17:16 2022 -0500
@@ -48,36 +48,4 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-
-OCTAVE_DEPRECATED (7, "use 'octave::xnorm' instead")
-inline octave_value
-xnorm (const octave_value& x, const octave_value& p)
-{
- return octave::xnorm (x, p);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xcolnorms' instead")
-inline octave_value
-xcolnorms (const octave_value& x, const octave_value& p)
-{
- return octave::xcolnorms (x, p);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xrownorms' instead")
-inline octave_value
-xrownorms (const octave_value& x, const octave_value& p)
-{
- return octave::xrownorms (x, p);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xfrobnorm' instead")
-inline octave_value
-xfrobnorm (const octave_value& x)
-{
- return octave::xfrobnorm (x);
-}
-
#endif
-
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/corefcn/xpow.h
--- a/libinterp/corefcn/xpow.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/corefcn/xpow.h Tue Dec 06 15:17:16 2022 -0500
@@ -44,7 +44,6 @@
class ComplexNDArray;
class FloatComplexNDArray;
class octave_value;
-class Range;
OCTAVE_BEGIN_NAMESPACE(octave)
@@ -209,589 +208,4 @@
OCTAVE_END_NAMESPACE(octave)
-#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (double a, double b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (double a, const Matrix& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (double a, const Complex& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (double a, const ComplexMatrix& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const Matrix& a, double b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const Matrix& a, const Complex& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const DiagMatrix& a, double b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const DiagMatrix& a, const Complex& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const PermMatrix& a, double b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const Complex& a, double b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const Complex& a, const Matrix& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const Complex& a, const Complex& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const Complex& a, const ComplexMatrix& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const ComplexMatrix& a, double b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const ComplexMatrix& a, const Complex& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const ComplexDiagMatrix& a, double b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const ComplexDiagMatrix& a, const Complex& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (double a, const Matrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (double a, const ComplexMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (double a, const octave::range& r)
-{
- return octave::elem_xpow (a, r);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const Matrix& a, double b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const Matrix& a, const Matrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const Matrix& a, const Complex& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const Matrix& a, const ComplexMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const Complex& a, const Matrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const Complex& a, const ComplexMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const Complex& a, const octave::range& r)
-{
- return octave::elem_xpow (a, r);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const ComplexMatrix& a, double b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const ComplexMatrix& a, const Matrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const ComplexMatrix& a, const Complex& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const ComplexMatrix& a, const ComplexMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (double a, const NDArray& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (double a, const ComplexNDArray& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const NDArray& a, double b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const NDArray& a, const NDArray& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const NDArray& a, const Complex& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const NDArray& a, const ComplexNDArray& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const Complex& a, const NDArray& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const Complex& a, const ComplexNDArray& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const ComplexNDArray& a, double b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const ComplexNDArray& a, const NDArray& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const ComplexNDArray& a, const Complex& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const ComplexNDArray& a, const ComplexNDArray& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (float a, float b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (float a, const FloatMatrix& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (float a, const FloatComplex& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (float a, const FloatComplexMatrix& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const FloatMatrix& a, float b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const FloatMatrix& a, const FloatComplex& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const FloatDiagMatrix& a, float b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const FloatDiagMatrix& a, const FloatComplex& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const FloatComplex& a, float b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const FloatComplex& a, const FloatMatrix& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const FloatComplex& a, const FloatComplex& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const FloatComplex& a, const FloatComplexMatrix& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const FloatComplexMatrix& a, float b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const FloatComplexMatrix& a, const FloatComplex& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const FloatComplexDiagMatrix& a, float b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
-inline octave_value
-xpow (const FloatComplexDiagMatrix& a, const FloatComplex& b)
-{
- return octave::xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (float a, const FloatMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (float a, const FloatComplexMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatMatrix& a, float b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatMatrix& a, const FloatMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatMatrix& a, const FloatComplex& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatMatrix& a, const FloatComplexMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatComplex& a, const FloatMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatComplex& a, const FloatComplexMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatComplexMatrix& a, float b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatComplexMatrix& a, const FloatMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatComplexMatrix& a, const FloatComplex& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatComplexMatrix& a, const FloatComplexMatrix& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (float a, const FloatNDArray& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (float a, const FloatComplexNDArray& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatNDArray& a, float b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatNDArray& a, const FloatNDArray& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatNDArray& a, const FloatComplex& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatNDArray& a, const FloatComplexNDArray& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatComplex& a, const FloatNDArray& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatComplex& a, const FloatComplexNDArray& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatComplexNDArray& a, float b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatComplexNDArray& a, const FloatNDArray& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatComplexNDArray& a, const FloatComplex& b)
-{
- return octave::elem_xpow (a, b);
-}
-
-OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
-inline octave_value
-elem_xpow (const FloatComplexNDArray& a, const FloatComplexNDArray& b)
-{
- return octave::elem_xpow (a, b);
-}
-
#endif
-
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/mk-builtins.pl
--- a/libinterp/mk-builtins.pl Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/mk-builtins.pl Tue Dec 06 15:17:16 2022 -0500
@@ -150,23 +150,6 @@
print "\nOCTAVE_END_NAMESPACE(octave)\n";
- print "\n#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)\n\n";
-
- foreach $name (sort (@fcn_names))
- {
- print "OCTAVE_DEPRECATED (7, \"use 'octave::$name' instead\")
-inline octave_value_list
-$name (const octave_value_list& args = octave_value_list (), int nargout = 0)
-{
- return octave::$name (args, nargout);
-}
-
-";
- }
-
- ## end OCTAVE_PROVIDE_DEPRECATED_SYMBOLS block
- print "\n\n#endif\n";
-
print "\n#endif\n";
}
elsif ($make_source)
diff -r 9089bd969b37 -r bd9da634f00d libinterp/module.mk
--- a/libinterp/module.mk Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/module.mk Tue Dec 06 15:17:16 2022 -0500
@@ -176,11 +176,6 @@
LIBINTERP_DEFUN_FILES += \
$(BUILT_IN_DEFUN_FILES)
-## FIXME: The following two variables are deprecated and should be removed
-## in Octave version 3.12.
-DLL_CDEFS = @OCTINTERP_DLL_DEFS@
-DLL_CXXDEFS = @OCTINTERP_DLL_DEFS@
-
## Rules to build test files
LIBINTERP_TST_FILES_SRC := $(shell $(SHELL) $(srcdir)/build-aux/find-files-with-tests.sh "$(srcdir)" $(ULT_DIST_SRC) $(DLDFCN_SRC))
diff -r 9089bd969b37 -r bd9da634f00d libinterp/octave-value/ov-legacy-range.cc
--- a/libinterp/octave-value/ov-legacy-range.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/octave-value/ov-legacy-range.cc Tue Dec 06 15:17:16 2022 -0500
@@ -31,6 +31,7 @@
#include
#include
+#include "Range.h"
#include "lo-ieee.h"
#include "lo-utils.h"
@@ -49,23 +50,326 @@
#include "ls-hdf5.h"
#include "ls-utils.h"
-#if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+class
+Range
+{
+public:
+
+ Range (void)
+ : m_base (0), m_limit (0), m_inc (0), m_numel (0)
+ { }
+
+ // Assume range is already properly constructed, so just copy internal
+ // values. However, we set LIMIT to the computed final value because
+ // that mimics the behavior of the other Range class constructors that
+ // reset limit to the computed final value.
+
+ Range (const octave::range& r)
+ : m_base (r.base ()), m_limit (r.final_value ()), m_inc (r.increment ()),
+ m_numel (r.numel ())
+ { }
+
+ Range (const Range& r) = default;
+
+ Range& operator = (const Range& r) = default;
+
+ ~Range (void) = default;
+
+ Range (double b, double l)
+ : m_base (b), m_limit (l), m_inc (1), m_numel (numel_internal ())
+ {
+ if (! octave::math::isinf (m_limit))
+ m_limit = limit_internal ();
+ }
+
+ Range (double b, double l, double i)
+ : m_base (b), m_limit (l), m_inc (i), m_numel (numel_internal ())
+ {
+ if (! octave::math::isinf (m_limit))
+ m_limit = limit_internal ();
+ }
+
+ // The range has a finite number of elements.
+ bool ok (void) const
+ {
+ return (octave::math::isfinite (m_limit)
+ && (m_numel >= 0 || m_numel == -2));
+ }
+
+ double base (void) const { return m_base; }
+ double limit (void) const { return m_limit; }
+ double increment (void) const { return m_inc; }
+
+ octave_idx_type numel (void) const { return m_numel; }
+
+ bool all_elements_are_ints (void) const;
+
+ Matrix matrix_value (void) const;
+
+ double min (void) const;
+ double max (void) const;
+
+private:
+
+ double m_base;
+ double m_limit;
+ double m_inc;
+
+ octave_idx_type m_numel;
+
+ octave_idx_type numel_internal (void) const;
+
+ double limit_internal (void) const;
+
+ void init (void);
+};
+
+bool
+Range::all_elements_are_ints (void) const
+{
+ // If the base and increment are ints, the final value in the range will also
+ // be an integer, even if the limit is not. If there is one or fewer
+ // elements only the base needs to be an integer.
+
+ return (! (octave::math::isnan (m_base) || octave::math::isnan (m_inc))
+ && (octave::math::nint_big (m_base) == m_base || m_numel < 1)
+ && (octave::math::nint_big (m_inc) == m_inc || m_numel <= 1));
+}
+
+Matrix
+Range::matrix_value (void) const
+{
+ Matrix retval (1, m_numel);
+
+ if (m_numel > 0)
+ {
+ // The first element must always be *exactly* the base.
+ // E.g, -0 would otherwise become +0 in the loop (-0 + 0*increment).
+ retval(0) = m_base;
+
+ double b = m_base;
+ double increment = m_inc;
+ for (octave_idx_type i = 1; i < m_numel - 1; i++)
+ retval.xelem (i) = b + i * increment;
+
+ retval.xelem (m_numel - 1) = m_limit;
+ }
+
+ return retval;
+}
+
+// NOTE: max and min only return useful values if numel > 0.
+// do_minmax_body() in max.cc avoids calling Range::min/max if numel == 0.
+
+double
+Range::min (void) const
+{
+ double retval = 0.0;
+ if (m_numel > 0)
+ {
+ if (m_inc > 0)
+ retval = m_base;
+ else
+ {
+ retval = m_base + (m_numel - 1) * m_inc;
+
+ // Require '<=' test. See note in max ().
+ if (retval <= m_limit)
+ retval = m_limit;
+ }
+
+ }
+ return retval;
+}
+
+double
+Range::max (void) const
+{
+ double retval = 0.0;
+ if (m_numel > 0)
+ {
+ if (m_inc > 0)
+ {
+ retval = m_base + (m_numel - 1) * m_inc;
+
+ // On some machines (x86 with extended precision floating point
+ // arithmetic, for example) it is possible that we can overshoot the
+ // limit by approximately the machine precision even though we were
+ // very careful in our calculation of the number of elements.
+ // Therefore, we clip the result to the limit if it overshoots.
+ // The test also includes equality (>= m_limit) to have expressions
+ // such as -5:1:-0 result in a -0 endpoint.
+ if (retval >= m_limit)
+ retval = m_limit;
+ }
+ else
+ retval = m_base;
+ }
+ return retval;
+}
+
+// C See Knuth, Art Of Computer Programming, Vol. 1, Problem 1.2.4-5.
+// C
+// C===Tolerant FLOOR function.
+// C
+// C X - is given as a Double Precision argument to be operated on.
+// C It is assumed that X is represented with M mantissa bits.
+// C CT - is given as a Comparison Tolerance such that
+// C 0.LT.CT.LE.3-SQRT(5)/2. If the relative difference between
+// C X and A whole number is less than CT, then TFLOOR is
+// C returned as this whole number. By treating the
+// C floating-point numbers as a finite ordered set note that
+// C the heuristic EPS=2.**(-(M-1)) and CT=3*EPS causes
+// C arguments of TFLOOR/TCEIL to be treated as whole numbers
+// C if they are exactly whole numbers or are immediately
+// C adjacent to whole number representations. Since EPS, the
+// C "distance" between floating-point numbers on the unit
+// C interval, and M, the number of bits in X'S mantissa, exist
+// C on every floating-point computer, TFLOOR/TCEIL are
+// C consistently definable on every floating-point computer.
+// C
+// C For more information see the following references:
+// C (1) P. E. Hagerty, "More On Fuzzy Floor And Ceiling," APL QUOTE
+// C QUAD 8(4):20-24, June 1978. Note that TFLOOR=FL5.
+// C (2) L. M. Breed, "Definitions For Fuzzy Floor And Ceiling", APL
+// C QUOTE QUAD 8(3):16-23, March 1978. This paper cites FL1 through
+// C FL5, the history of five years of evolutionary development of
+// C FL5 - the seven lines of code below - by open collaboration
+// C and corroboration of the mathematical-computing community.
+// C
+// C Penn State University Center for Academic Computing
+// C H. D. Knoble - August, 1978.
+
+static inline double
+tfloor (double x, double ct)
+{
+// C---------FLOOR(X) is the largest integer algebraically less than
+// C or equal to X; that is, the unfuzzy FLOOR function.
+
+// DINT (X) = X - DMOD (X, 1.0);
+// FLOOR (X) = DINT (X) - DMOD (2.0 + DSIGN (1.0, X), 3.0);
+
+// C---------Hagerty's FL5 function follows...
+
+ double q = 1.0;
+
+ if (x < 0.0)
+ q = 1.0 - ct;
+
+ double rmax = q / (2.0 - ct);
+
+ double t1 = 1.0 + std::floor (x);
+ t1 = (ct / q) * (t1 < 0.0 ? -t1 : t1);
+ t1 = (rmax < t1 ? rmax : t1);
+ t1 = (ct > t1 ? ct : t1);
+ t1 = std::floor (x + t1);
+
+ if (x <= 0.0 || (t1 - x) < rmax)
+ return t1;
+ else
+ return t1 - 1.0;
+}
+
+static inline bool
+teq (double u, double v,
+ double ct = 3.0 * std::numeric_limits::epsilon ())
+{
+ double tu = std::abs (u);
+ double tv = std::abs (v);
+
+ return std::abs (u - v) < ((tu > tv ? tu : tv) * ct);
+}
+
+octave_idx_type
+Range::numel_internal (void) const
+{
+ octave_idx_type retval = -1;
+
+ if (! octave::math::isfinite (m_base) || ! octave::math::isfinite (m_inc)
+ || octave::math::isnan (m_limit))
+ retval = -2;
+ else if (octave::math::isinf (m_limit)
+ && ((m_inc > 0 && m_limit > 0)
+ || (m_inc < 0 && m_limit < 0)))
+ retval = std::numeric_limits::max () - 1;
+ else if (m_inc == 0
+ || (m_limit > m_base && m_inc < 0)
+ || (m_limit < m_base && m_inc > 0))
+ {
+ retval = 0;
+ }
+ else
+ {
+ double ct = 3.0 * std::numeric_limits::epsilon ();
+
+ double tmp = tfloor ((m_limit - m_base + m_inc) / m_inc, ct);
+
+ octave_idx_type n_elt = (tmp > 0.0
+ ? static_cast (tmp) : 0);
+
+ // If the final element that we would compute for the range is equal to
+ // the limit of the range, or is an adjacent floating point number,
+ // accept it. Otherwise, try a range with one fewer element. If that
+ // fails, try again with one more element.
+ //
+ // I'm not sure this is very good, but it seems to work better than just
+ // using tfloor as above. For example, without it, the expression
+ // 1.8:0.05:1.9 fails to produce the expected result of [1.8, 1.85, 1.9].
+
+ if (! teq (m_base + (n_elt - 1) * m_inc, m_limit))
+ {
+ if (teq (m_base + (n_elt - 2) * m_inc, m_limit))
+ n_elt--;
+ else if (teq (m_base + n_elt * m_inc, m_limit))
+ n_elt++;
+ }
+
+ retval = ((n_elt < std::numeric_limits::max ())
+ ? n_elt : -1);
+ }
+
+ return retval;
+}
+
+double
+Range::limit_internal (void) const
+{
+ double new_limit = m_inc > 0 ? max () : min ();
+
+ // If result must be an integer then force the new_limit to be one.
+ if (all_elements_are_ints ())
+ new_limit = std::round (new_limit);
+
+ return new_limit;
+}
+
+void
+Range::init (void)
+{
+ m_numel = numel_internal ();
+
+ if (! octave::math::isinf (m_limit))
+ m_limit = limit_internal ();
+}
DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_legacy_range, "range", "double");
octave_legacy_range::octave_legacy_range (void)
- : octave_base_value (), range () { }
+ : octave_base_value (), m_range (new Range ()) { }
octave_legacy_range::octave_legacy_range (const Range& r)
- : octave_base_value (), range (r)
+ : octave_base_value (), m_range (new Range (r))
{
- if (range.numel () < 0 && range.numel () != -2)
+ if (m_range->numel () < 0 && m_range->numel () != -2)
error ("invalid range");
}
+octave_legacy_range::octave_legacy_range (const octave_legacy_range& r)
+ : octave_base_value (r), m_range ()
+{
+ m_range.reset (new Range (*(r.m_range)));
+}
+
static octave_base_value *
default_numeric_conversion_function (const octave_base_value& a)
{
@@ -78,7 +382,7 @@
octave_legacy_range::numeric_conversion_function (void) const
{
return octave_base_value::type_conv_info (default_numeric_conversion_function,
- octave_matrix::static_type_id ());
+ octave_matrix::static_type_id ());
}
octave_base_value *
@@ -86,10 +390,10 @@
{
octave_base_value *retval = nullptr;
- switch (range.numel ())
+ switch (m_range->numel ())
{
case 1:
- retval = new octave_scalar (range.base ());
+ retval = new octave_scalar (m_range->base ());
break;
case 0:
@@ -97,17 +401,17 @@
break;
case -2:
- retval = new octave_matrix (range.matrix_value ());
+ retval = new octave_matrix (m_range->matrix_value ());
break;
default:
{
- if (range.increment () == 0)
- retval = new octave_matrix (range.matrix_value ());
+ if (m_range->increment () == 0)
+ retval = new octave_matrix (m_range->matrix_value ());
else
retval = new octave_range
- (octave::range (range.base (), range.increment (),
- range.limit (), range.numel ()));
+ (octave::range (m_range->base (), m_range->increment (),
+ m_range->limit (), m_range->numel ()));
}
break;
}
@@ -145,9 +449,9 @@
error ("load: failed to load range constant");
if (inc != 0)
- range = Range (base, limit, inc);
+ m_range.reset (new Range (base, limit, inc));
else
- range = Range (base, inc, static_cast (limit));
+ m_range.reset (new Range (base, inc, static_cast (limit)));
return true;
}
@@ -173,9 +477,9 @@
if (swap)
swap_bytes<8> (&inc);
if (inc != 0)
- range = Range (bas, lim, inc);
+ m_range.reset (new Range (bas, lim, inc));
else
- range = Range (bas, inc, static_cast (lim));
+ m_range.reset (new Range (bas, inc, static_cast (lim)));
return true;
}
@@ -245,14 +549,14 @@
octave_idx_type nel;
if (hdf5_get_scalar_attr (data_hid, H5T_NATIVE_IDX,
"OCTAVE_RANGE_NELEM", &nel))
- range = Range (rangevals[0], rangevals[2], nel);
+ m_range.reset (new Range (rangevals[0], rangevals[2], nel));
else
{
if (rangevals[2] != 0)
- range = Range (rangevals[0], rangevals[1], rangevals[2]);
+ m_range.reset (new Range (rangevals[0], rangevals[1], rangevals[2]));
else
- range = Range (rangevals[0], rangevals[2],
- static_cast (rangevals[1]));
+ m_range.reset (new Range (rangevals[0], rangevals[2],
+ static_cast (rangevals[1])));
}
}
@@ -269,7 +573,3 @@
return retval;
}
-
-#if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
-# pragma GCC diagnostic pop
-#endif
diff -r 9089bd969b37 -r bd9da634f00d libinterp/octave-value/ov-legacy-range.h
--- a/libinterp/octave-value/ov-legacy-range.h Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/octave-value/ov-legacy-range.h Tue Dec 06 15:17:16 2022 -0500
@@ -31,10 +31,9 @@
#include
#include
+#include
#include
-#include "Range.h"
-
#include "lo-mappers.h"
#include "lo-utils.h"
#include "mx-base.h"
@@ -45,6 +44,8 @@
#include "ov-re-mat.h"
#include "ov-typeinfo.h"
+class Range;
+
class octave_value_list;
// Legacy Range values.
@@ -65,13 +66,13 @@
octave_legacy_range (const Range& r);
- octave_legacy_range (const octave_legacy_range& r) = default;
+ octave_legacy_range (const octave_legacy_range& r);
// No assignment.
octave_legacy_range& operator = (const octave_legacy_range&) = delete;
- ~octave_legacy_range (void) { }
+ ~octave_legacy_range (void) = default;
octave_base_value * clone (void) const
{
@@ -102,7 +103,7 @@
private:
- Range range;
+ std::unique_ptr m_range;
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
};
diff -r 9089bd969b37 -r bd9da634f00d libinterp/octave-value/ov.cc
--- a/libinterp/octave-value/ov.cc Tue Dec 06 14:23:21 2022 -0500
+++ b/libinterp/octave-value/ov.cc Tue Dec 06 15:17:16 2022 -0500
@@ -1073,36 +1073,6 @@
maybe_mutate ();
}
-// Remove when public constructor that uses this function is removed.
-octave_base_value *
-octave_value::make_range_rep_deprecated (double base, double inc, double limit)
-{
-#if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
-
- return dynamic_cast
- (new octave_legacy_range (Range (base, inc, limit)));
-
-#if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
-# pragma GCC diagnostic pop
-#endif
-}
-
-// Remove when public constructor that uses this function is removed.
-octave_base_value *
-octave_value::make_range_rep_deprecated (const Range& r, bool force_range)
-{
- if (! force_range && ! r.ok ())
- error ("invalid range");
-
- if ((force_range || Voptimize_range))
- return dynamic_cast (new octave_legacy_range (r));
- else
- return dynamic_cast (new octave_matrix (r.matrix_value ()));
-}
-
octave_value::octave_value (const octave::range& r, bool force_range)
: m_rep (force_range || Voptimize_range
? dynamic_cast (new ov_range (r))
@@ -1201,8 +1171,8 @@
: m_rep (force_range || optimize_range
? dynamic_cast (new octave_char_range (r, type))
: dynamic_cast (type == '"'
- ? new octave_char_matrix_dq_str (r.array_value ())
- : new octave_char_matrix_sq_str (r.array_value ())))
+ ? new octave_char_matrix_dq_str (r.array_value ())
+ : new octave_char_matrix_sq_str (r.array_value ())))
#else
: m_rep (type == '"'
? new octave_char_matrix_dq_str (r.array_value ())
@@ -1891,10 +1861,10 @@
ComplexColumnVector
octave_value::complex_column_vector_value (bool force_string_conv,
- bool frc_vec_conv) const
+ bool frc_vec_conv) const
{
return ComplexColumnVector (complex_vector_value (force_string_conv,
- frc_vec_conv));
+ frc_vec_conv));
}
RowVector
@@ -1910,7 +1880,7 @@
bool frc_vec_conv) const
{
return ComplexRowVector (complex_vector_value (force_string_conv,
- frc_vec_conv));
+ frc_vec_conv));
}
Array
@@ -1920,8 +1890,8 @@
Array retval = array_value (force_string_conv);
return retval.reshape (make_vector_dims (retval.dims (),
- force_vector_conversion,
- type_name (), "real vector"));
+ force_vector_conversion,
+ type_name (), "real vector"));
}
template
@@ -1989,8 +1959,8 @@
}
return retval.reshape (make_vector_dims (retval.dims (),
- force_vector_conversion,
- type_name (), "integer vector"));
+ force_vector_conversion,
+ type_name (), "integer vector"));
}
template
@@ -2008,8 +1978,8 @@
Array
octave_value::octave_idx_type_vector_value (bool require_int,
- bool force_string_conv,
- bool force_vector_conversion) const
+ bool force_string_conv,
+ bool force_vector_conversion) const
{
Array retval;
@@ -2059,8 +2029,8 @@
}
return retval.reshape (make_vector_dims (retval.dims (),
- force_vector_conversion,
- type_name (), "integer vector"));
+ force_vector_conversion,
+ type_name (), "integer vector"));
}
Array
@@ -2070,25 +2040,25 @@
Array retval = complex_array_value (force_string_conv);
return retval.reshape (make_vector_dims (retval.dims (),
- force_vector_conversion,
- type_name (), "complex vector"));
+ force_vector_conversion,
+ type_name (), "complex vector"));
}
FloatColumnVector
octave_value::float_column_vector_value (bool force_string_conv,
- bool frc_vec_conv) const
+ bool frc_vec_conv) const
{
return FloatColumnVector (float_vector_value (force_string_conv,
- frc_vec_conv));
+ frc_vec_conv));
}
FloatComplexColumnVector
octave_value::float_complex_column_vector_value (bool force_string_conv,
- bool frc_vec_conv) const
+ bool frc_vec_conv) const
{
return
FloatComplexColumnVector (float_complex_vector_value (force_string_conv,
- frc_vec_conv));
+ frc_vec_conv));
}
FloatRowVector
@@ -2096,15 +2066,15 @@
bool frc_vec_conv) const
{
return FloatRowVector (float_vector_value (force_string_conv,
- frc_vec_conv));
+ frc_vec_conv));
}
FloatComplexRowVector
octave_value::float_complex_row_vector_value (bool force_string_conv,
- bool frc_vec_conv) const
+ bool frc_vec_conv) const
{
return FloatComplexRowVector (float_complex_vector_value (force_string_conv,
- frc_vec_conv));
+ frc_vec_conv));
}
Array
@@ -2114,19 +2084,19 @@
Array retval = float_array_value (force_string_conv);
return retval.reshape (make_vector_dims (retval.dims (),
- force_vector_conversion,
- type_name (), "real vector"));
+ force_vector_conversion,
+ type_name (), "real vector"));
}
Array
octave_value::float_complex_vector_value (bool force_string_conv,
- bool force_vector_conversion) const
+ bool force_vector_conversion) const
{
Array retval = float_complex_array_value (force_string_conv);
return retval.reshape (make_vector_dims (retval.dims (),
- force_vector_conversion,
- type_name (), "complex vector"));
+ force_vector_conversion,
+ type_name (), "complex vector"));
}
// NAME can't always be "x ## FCN" because some of the original
@@ -2214,8 +2184,7 @@
XVALUE_EXTRACTOR (DiagMatrix, xdiag_matrix_value, diag_matrix_value)
XVALUE_EXTRACTOR (FloatDiagMatrix, xfloat_diag_matrix_value, float_diag_matrix_value)
XVALUE_EXTRACTOR (ComplexDiagMatrix, xcomplex_diag_matrix_value, complex_diag_matrix_value)
-XVALUE_EXTRACTOR (FloatComplexDiagMatrix, xfloat_complex_diag_matrix_value,
- float_complex_diag_matrix_value)
+XVALUE_EXTRACTOR (FloatComplexDiagMatrix, xfloat_complex_diag_matrix_value, float_complex_diag_matrix_value)
XVALUE_EXTRACTOR (PermMatrix, xperm_matrix_value, perm_matrix_value)
@@ -2273,16 +2242,13 @@
XVALUE_EXTRACTOR (ComplexRowVector, xcomplex_row_vector_value, complex_row_vector_value)
XVALUE_EXTRACTOR (FloatColumnVector, xfloat_column_vector_value, float_column_vector_value)
-XVALUE_EXTRACTOR (FloatComplexColumnVector, xfloat_complex_column_vector_value,
- float_complex_column_vector_value)
+XVALUE_EXTRACTOR (FloatComplexColumnVector, xfloat_complex_column_vector_value, float_complex_column_vector_value)
XVALUE_EXTRACTOR (FloatRowVector, xfloat_row_vector_value, float_row_vector_value)
-XVALUE_EXTRACTOR (FloatComplexRowVector, xfloat_complex_row_vector_value,
- float_complex_row_vector_value)
+XVALUE_EXTRACTOR (FloatComplexRowVector, xfloat_complex_row_vector_value, float_complex_row_vector_value)
XVALUE_EXTRACTOR (Array, xint_vector_value, int_vector_value)
-XVALUE_EXTRACTOR (Array, xoctave_idx_type_vector_value,
- octave_idx_type_vector_value)
+XVALUE_EXTRACTOR (Array, xoctave_idx_type_vector_value, octave_idx_type_vector_value)
XVALUE_EXTRACTOR (Array, xvector_value, vector_value)
XVALUE_EXTRACTOR (Array, xcomplex_vector_value, complex_vector_value)
@@ -2520,7 +2486,7 @@
if (! tmp)
err_unary_op_conversion_failed
- (octave_value::unary_op_as_string (op), type_name ());
+ (octave_value::unary_op_as_string (op), type_name ());
octave_base_value *old_rep = m_rep;
m_rep = tmp;
@@ -2692,950 +2658,950 @@
OCTAVE_BEGIN_NAMESPACE(octave)
-OCTAVE_NORETURN static void
-err_binary_op (const std::string& on, const std::string& tn1,
- const std::string& tn2)
-{
- error ("binary operator '%s' not implemented for '%s' by '%s' operations",
- on.c_str (), tn1.c_str (), tn2.c_str ());
-}
-
-OCTAVE_NORETURN static void
-err_binary_op_conv (const std::string& on)
-{
- error ("type conversion failed for binary operator '%s'", on.c_str ());
-}
-
-octave_value
-binary_op (type_info& ti, octave_value::binary_op op,
- const octave_value& v1, const octave_value& v2)
-{
- octave_value retval;
-
- int t1 = v1.type_id ();
- int t2 = v2.type_id ();
-
- if (t1 == octave_class::static_type_id ()
- || t2 == octave_class::static_type_id ()
- || t1 == octave_classdef::static_type_id ()
- || t2 == octave_classdef::static_type_id ())
- {
- type_info::binary_class_op_fcn f = ti.lookup_binary_class_op (op);
-
- if (! f)
- err_binary_op (octave_value::binary_op_as_string (op),
- v1.class_name (), v2.class_name ());
-
- retval = f (v1, v2);
- }
- else
- {
- // FIXME: we need to handle overloading operators for built-in
- // classes (double, char, int8, etc.)
-
- type_info::binary_op_fcn f
- = ti.lookup_binary_op (op, t1, t2);
-
- if (f)
- retval = f (v1.get_rep (), v2.get_rep ());
- else
- {
- octave_value tv1;
- octave_base_value::type_conv_info cf1
- = v1.numeric_conversion_function ();
-
- octave_value tv2;
- octave_base_value::type_conv_info cf2
- = v2.numeric_conversion_function ();
-
- // Try biased (one-sided) conversions first.
- if (cf2.type_id () >= 0
- && ti.lookup_binary_op (op, t1, cf2.type_id ()))
- cf1 = nullptr;
- else if (cf1.type_id () >= 0
- && ti.lookup_binary_op (op, cf1.type_id (), t2))
- cf2 = nullptr;
-
- if (cf1)
- {
- octave_base_value *tmp = cf1 (v1.get_rep ());
-
- if (! tmp)
- err_binary_op_conv (octave_value::binary_op_as_string (op));
-
- tv1 = octave_value (tmp);
- t1 = tv1.type_id ();
- }
- else
- tv1 = v1;
-
- if (cf2)
- {
- octave_base_value *tmp = cf2 (v2.get_rep ());
-
- if (! tmp)
- err_binary_op_conv (octave_value::binary_op_as_string (op));
-
- tv2 = octave_value (tmp);
- t2 = tv2.type_id ();
- }
- else
- tv2 = v2;
-
- if (cf1 || cf2)
- {
- retval = binary_op (op, tv1, tv2);
- }
- else
- {
- //demote double -> single and try again
- cf1 = tv1.numeric_demotion_function ();
-
- cf2 = tv2.numeric_demotion_function ();
-
- // Try biased (one-sided) conversions first.
- if (cf2.type_id () >= 0
- && ti.lookup_binary_op (op, t1, cf2.type_id ()))
- cf1 = nullptr;
- else if (cf1.type_id () >= 0
- && ti.lookup_binary_op (op, cf1.type_id (), t2))
- cf2 = nullptr;
-
- if (cf1)
- {
- octave_base_value *tmp = cf1 (tv1.get_rep ());
-
- if (! tmp)
- err_binary_op_conv (octave_value::binary_op_as_string (op));
-
- tv1 = octave_value (tmp);
- t1 = tv1.type_id ();
- }
-
- if (cf2)
- {
- octave_base_value *tmp = cf2 (tv2.get_rep ());
-
- if (! tmp)
- err_binary_op_conv (octave_value::binary_op_as_string (op));
-
- tv2 = octave_value (tmp);
- t2 = tv2.type_id ();
- }
-
- if (! cf1 && ! cf2)
- err_binary_op (octave_value::binary_op_as_string (op),
- v1.type_name (), v2.type_name ());
-
- f = ti.lookup_binary_op (op, t1, t2);
-
- if (! f)
- err_binary_op (octave_value::binary_op_as_string (op),
- v1.type_name (), v2.type_name ());
-
- retval = f (tv1.get_rep (), tv2.get_rep ());
- }
- }
- }
-
- return retval;
-}
-
-octave_value
-binary_op (octave_value::binary_op op, const octave_value& v1,
- const octave_value& v2)
-{
- type_info& ti = __get_type_info__ ();
-
- return binary_op (ti, op, v1, v2);
-}
-
-static octave_value
-decompose_binary_op (type_info& ti, octave_value::compound_binary_op op,
- const octave_value& v1, const octave_value& v2)
-{
- switch (op)
- {
- case octave_value::op_trans_mul:
- return binary_op (octave_value::op_mul,
- unary_op (octave_value::op_transpose, v1), v2);
-
- case octave_value::op_mul_trans:
- return binary_op (ti, octave_value::op_mul,
- v1, unary_op (octave_value::op_transpose, v2));
-
- case octave_value::op_herm_mul:
- return binary_op (ti, octave_value::op_mul,
- unary_op (octave_value::op_hermitian, v1), v2);
-
- case octave_value::op_mul_herm:
- return binary_op (ti, octave_value::op_mul,
- v1, unary_op (octave_value::op_hermitian, v2));
-
- case octave_value::op_trans_ldiv:
- return binary_op (ti, octave_value::op_ldiv,
- unary_op (octave_value::op_transpose, v1), v2);
-
- case octave_value::op_herm_ldiv:
- return binary_op (ti, octave_value::op_ldiv,
- unary_op (octave_value::op_hermitian, v1), v2);
-
- case octave_value::op_el_not_and:
- return binary_op (ti, octave_value::op_el_and,
- unary_op (octave_value::op_not, v1), v2);
-
- case octave_value::op_el_not_or:
- return binary_op (ti, octave_value::op_el_or,
- unary_op (octave_value::op_not, v1), v2);
-
- case octave_value::op_el_and_not:
- return binary_op (ti, octave_value::op_el_and,
- v1, unary_op (octave_value::op_not, v2));
-
- case octave_value::op_el_or_not:
- return binary_op (ti, octave_value::op_el_or,
- v1, unary_op (octave_value::op_not, v2));
-
- default:
- error ("invalid compound operator");
- }
-}
-
-octave_value
-binary_op (type_info& ti, octave_value::compound_binary_op op,
- const octave_value& v1, const octave_value& v2)
-{
- octave_value retval;
-
- int t1 = v1.type_id ();
- int t2 = v2.type_id ();
-
- if (t1 == octave_class::static_type_id ()
- || t2 == octave_class::static_type_id ()
- || t1 == octave_classdef::static_type_id ()
- || t2 == octave_classdef::static_type_id ())
- {
- type_info::binary_class_op_fcn f = ti.lookup_binary_class_op (op);
-
- if (f)
+ OCTAVE_NORETURN static void
+ err_binary_op (const std::string& on, const std::string& tn1,
+ const std::string& tn2)
+ {
+ error ("binary operator '%s' not implemented for '%s' by '%s' operations",
+ on.c_str (), tn1.c_str (), tn2.c_str ());
+ }
+
+ OCTAVE_NORETURN static void
+ err_binary_op_conv (const std::string& on)
+ {
+ error ("type conversion failed for binary operator '%s'", on.c_str ());
+ }
+
+ octave_value
+ binary_op (type_info& ti, octave_value::binary_op op,
+ const octave_value& v1, const octave_value& v2)
+ {
+ octave_value retval;
+
+ int t1 = v1.type_id ();
+ int t2 = v2.type_id ();
+
+ if (t1 == octave_class::static_type_id ()
+ || t2 == octave_class::static_type_id ()
+ || t1 == octave_classdef::static_type_id ()
+ || t2 == octave_classdef::static_type_id ())
+ {
+ type_info::binary_class_op_fcn f = ti.lookup_binary_class_op (op);
+
+ if (! f)
+ err_binary_op (octave_value::binary_op_as_string (op),
+ v1.class_name (), v2.class_name ());
+
retval = f (v1, v2);
- else
- retval = decompose_binary_op (ti, op, v1, v2);
- }
- else
- {
- type_info::binary_op_fcn f = ti.lookup_binary_op (op, t1, t2);
-
- if (f)
- retval = f (v1.get_rep (), v2.get_rep ());
- else
- retval = decompose_binary_op (ti, op, v1, v2);
- }
-
- return retval;
-}
-
-octave_value
-binary_op (octave_value::compound_binary_op op,
- const octave_value& v1, const octave_value& v2)
-{
- type_info& ti = __get_type_info__ ();
-
- return binary_op (ti, op, v1, v2);
-}
-
-OCTAVE_NORETURN static void
-err_cat_op (const std::string& tn1, const std::string& tn2)
-{
- error ("concatenation operator not implemented for '%s' by '%s' operations",
- tn1.c_str (), tn2.c_str ());
-}
-
-OCTAVE_NORETURN static void
-err_cat_op_conv (void)
-{
- error ("type conversion failed for concatenation operator");
-}
-
-octave_value
-cat_op (type_info& ti, const octave_value& v1,
- const octave_value& v2, const Array& ra_idx)
-{
- octave_value retval;
-
- // Can't rapid return for concatenation with an empty object here as
- // something like cat(1,[],single([]) must return the correct type.
-
- int t1 = v1.type_id ();
- int t2 = v2.type_id ();
-
- type_info::cat_op_fcn f = ti.lookup_cat_op (t1, t2);
-
- if (f)
- retval = f (v1.get_rep (), v2.get_rep (), ra_idx);
- else
- {
- octave_value tv1;
- octave_base_value::type_conv_info cf1 = v1.numeric_conversion_function ();
-
- octave_value tv2;
- octave_base_value::type_conv_info cf2 = v2.numeric_conversion_function ();
-
- // Try biased (one-sided) conversions first.
- if (cf2.type_id () >= 0 && ti.lookup_cat_op (t1, cf2.type_id ()))
- cf1 = nullptr;
- else if (cf1.type_id () >= 0 && ti.lookup_cat_op (cf1.type_id (), t2))
- cf2 = nullptr;
-
- if (cf1)
- {
- octave_base_value *tmp = cf1 (v1.get_rep ());
-
- if (! tmp)
- err_cat_op_conv ();
-
- tv1 = octave_value (tmp);
- t1 = tv1.type_id ();
- }
- else
- tv1 = v1;
-
- if (cf2)
- {
- octave_base_value *tmp = cf2 (v2.get_rep ());
-
- if (! tmp)
- err_cat_op_conv ();
-
- tv2 = octave_value (tmp);
- t2 = tv2.type_id ();
- }
- else
- tv2 = v2;
-
- if (! cf1 && ! cf2)
- err_cat_op (v1.type_name (), v2.type_name ());
-
- retval = cat_op (ti, tv1, tv2, ra_idx);
- }
-
- return retval;
-}
-
-octave_value
-cat_op (const octave_value& v1, const octave_value& v2,
- const Array& ra_idx)
-{
- type_info& ti = __get_type_info__ ();
-
- return cat_op (ti, v1, v2, ra_idx);
-}
-
-// Unless the colon operator is used with a class or classdef object,
-// then all arguments must be the same type or mixed with double
-// values.
-
-static builtin_type_t
-get_colon_op_type (builtin_type_t op1_type, builtin_type_t op2_type)
-{
- if (op1_type == op2_type)
- return op1_type;
-
- if (op1_type == btyp_double)
- return op2_type;
-
- if (op2_type == btyp_double)
- return op1_type;
-
- return btyp_unknown;
-}
-
-static builtin_type_t
-get_colon_op_type (const octave_value& base, const octave_value& increment,
+ }
+ else
+ {
+ // FIXME: we need to handle overloading operators for built-in
+ // classes (double, char, int8, etc.)
+
+ type_info::binary_op_fcn f
+ = ti.lookup_binary_op (op, t1, t2);
+
+ if (f)
+ retval = f (v1.get_rep (), v2.get_rep ());
+ else
+ {
+ octave_value tv1;
+ octave_base_value::type_conv_info cf1
+ = v1.numeric_conversion_function ();
+
+ octave_value tv2;
+ octave_base_value::type_conv_info cf2
+ = v2.numeric_conversion_function ();
+
+ // Try biased (one-sided) conversions first.
+ if (cf2.type_id () >= 0
+ && ti.lookup_binary_op (op, t1, cf2.type_id ()))
+ cf1 = nullptr;
+ else if (cf1.type_id () >= 0
+ && ti.lookup_binary_op (op, cf1.type_id (), t2))
+ cf2 = nullptr;
+
+ if (cf1)
+ {
+ octave_base_value *tmp = cf1 (v1.get_rep ());
+
+ if (! tmp)
+ err_binary_op_conv (octave_value::binary_op_as_string (op));
+
+ tv1 = octave_value (tmp);
+ t1 = tv1.type_id ();
+ }
+ else
+ tv1 = v1;
+
+ if (cf2)
+ {
+ octave_base_value *tmp = cf2 (v2.get_rep ());
+
+ if (! tmp)
+ err_binary_op_conv (octave_value::binary_op_as_string (op));
+
+ tv2 = octave_value (tmp);
+ t2 = tv2.type_id ();
+ }
+ else
+ tv2 = v2;
+
+ if (cf1 || cf2)
+ {
+ retval = binary_op (op, tv1, tv2);
+ }
+ else
+ {
+ //demote double -> single and try again
+ cf1 = tv1.numeric_demotion_function ();
+
+ cf2 = tv2.numeric_demotion_function ();
+
+ // Try biased (one-sided) conversions first.
+ if (cf2.type_id () >= 0
+ && ti.lookup_binary_op (op, t1, cf2.type_id ()))
+ cf1 = nullptr;
+ else if (cf1.type_id () >= 0
+ && ti.lookup_binary_op (op, cf1.type_id (), t2))
+ cf2 = nullptr;
+
+ if (cf1)
+ {
+ octave_base_value *tmp = cf1 (tv1.get_rep ());
+
+ if (! tmp)
+ err_binary_op_conv (octave_value::binary_op_as_string (op));
+
+ tv1 = octave_value (tmp);
+ t1 = tv1.type_id ();
+ }
+
+ if (cf2)
+ {
+ octave_base_value *tmp = cf2 (tv2.get_rep ());
+
+ if (! tmp)
+ err_binary_op_conv (octave_value::binary_op_as_string (op));
+
+ tv2 = octave_value (tmp);
+ t2 = tv2.type_id ();
+ }
+
+ if (! cf1 && ! cf2)
+ err_binary_op (octave_value::binary_op_as_string (op),
+ v1.type_name (), v2.type_name ());
+
+ f = ti.lookup_binary_op (op, t1, t2);
+
+ if (! f)
+ err_binary_op (octave_value::binary_op_as_string (op),
+ v1.type_name (), v2.type_name ());
+
+ retval = f (tv1.get_rep (), tv2.get_rep ());
+ }
+ }
+ }
+
+ return retval;
+ }
+
+ octave_value
+ binary_op (octave_value::binary_op op, const octave_value& v1,
+ const octave_value& v2)
+ {
+ type_info& ti = __get_type_info__ ();
+
+ return binary_op (ti, op, v1, v2);
+ }
+
+ static octave_value
+ decompose_binary_op (type_info& ti, octave_value::compound_binary_op op,
+ const octave_value& v1, const octave_value& v2)
+ {
+ switch (op)
+ {
+ case octave_value::op_trans_mul:
+ return binary_op (octave_value::op_mul,
+ unary_op (octave_value::op_transpose, v1), v2);
+
+ case octave_value::op_mul_trans:
+ return binary_op (ti, octave_value::op_mul,
+ v1, unary_op (octave_value::op_transpose, v2));
+
+ case octave_value::op_herm_mul:
+ return binary_op (ti, octave_value::op_mul,
+ unary_op (octave_value::op_hermitian, v1), v2);
+
+ case octave_value::op_mul_herm:
+ return binary_op (ti, octave_value::op_mul,
+ v1, unary_op (octave_value::op_hermitian, v2));
+
+ case octave_value::op_trans_ldiv:
+ return binary_op (ti, octave_value::op_ldiv,
+ unary_op (octave_value::op_transpose, v1), v2);
+
+ case octave_value::op_herm_ldiv:
+ return binary_op (ti, octave_value::op_ldiv,
+ unary_op (octave_value::op_hermitian, v1), v2);
+
+ case octave_value::op_el_not_and:
+ return binary_op (ti, octave_value::op_el_and,
+ unary_op (octave_value::op_not, v1), v2);
+
+ case octave_value::op_el_not_or:
+ return binary_op (ti, octave_value::op_el_or,
+ unary_op (octave_value::op_not, v1), v2);
+
+ case octave_value::op_el_and_not:
+ return binary_op (ti, octave_value::op_el_and,
+ v1, unary_op (octave_value::op_not, v2));
+
+ case octave_value::op_el_or_not:
+ return binary_op (ti, octave_value::op_el_or,
+ v1, unary_op (octave_value::op_not, v2));
+
+ default:
+ error ("invalid compound operator");
+ }
+ }
+
+ octave_value
+ binary_op (type_info& ti, octave_value::compound_binary_op op,
+ const octave_value& v1, const octave_value& v2)
+ {
+ octave_value retval;
+
+ int t1 = v1.type_id ();
+ int t2 = v2.type_id ();
+
+ if (t1 == octave_class::static_type_id ()
+ || t2 == octave_class::static_type_id ()
+ || t1 == octave_classdef::static_type_id ()
+ || t2 == octave_classdef::static_type_id ())
+ {
+ type_info::binary_class_op_fcn f = ti.lookup_binary_class_op (op);
+
+ if (f)
+ retval = f (v1, v2);
+ else
+ retval = decompose_binary_op (ti, op, v1, v2);
+ }
+ else
+ {
+ type_info::binary_op_fcn f = ti.lookup_binary_op (op, t1, t2);
+
+ if (f)
+ retval = f (v1.get_rep (), v2.get_rep ());
+ else
+ retval = decompose_binary_op (ti, op, v1, v2);
+ }
+
+ return retval;
+ }
+
+ octave_value
+ binary_op (octave_value::compound_binary_op op,
+ const octave_value& v1, const octave_value& v2)
+ {
+ type_info& ti = __get_type_info__ ();
+
+ return binary_op (ti, op, v1, v2);
+ }
+
+ OCTAVE_NORETURN static void
+ err_cat_op (const std::string& tn1, const std::string& tn2)
+ {
+ error ("concatenation operator not implemented for '%s' by '%s' operations",
+ tn1.c_str (), tn2.c_str ());
+ }
+
+ OCTAVE_NORETURN static void
+ err_cat_op_conv (void)
+ {
+ error ("type conversion failed for concatenation operator");
+ }
+
+ octave_value
+ cat_op (type_info& ti, const octave_value& v1,
+ const octave_value& v2, const Array& ra_idx)
+ {
+ octave_value retval;
+
+ // Can't rapid return for concatenation with an empty object here as
+ // something like cat(1,[],single([]) must return the correct type.
+
+ int t1 = v1.type_id ();
+ int t2 = v2.type_id ();
+
+ type_info::cat_op_fcn f = ti.lookup_cat_op (t1, t2);
+
+ if (f)
+ retval = f (v1.get_rep (), v2.get_rep (), ra_idx);
+ else
+ {
+ octave_value tv1;
+ octave_base_value::type_conv_info cf1 = v1.numeric_conversion_function ();
+
+ octave_value tv2;
+ octave_base_value::type_conv_info cf2 = v2.numeric_conversion_function ();
+
+ // Try biased (one-sided) conversions first.
+ if (cf2.type_id () >= 0 && ti.lookup_cat_op (t1, cf2.type_id ()))
+ cf1 = nullptr;
+ else if (cf1.type_id () >= 0 && ti.lookup_cat_op (cf1.type_id (), t2))
+ cf2 = nullptr;
+
+ if (cf1)
+ {
+ octave_base_value *tmp = cf1 (v1.get_rep ());
+
+ if (! tmp)
+ err_cat_op_conv ();
+
+ tv1 = octave_value (tmp);
+ t1 = tv1.type_id ();
+ }
+ else
+ tv1 = v1;
+
+ if (cf2)
+ {
+ octave_base_value *tmp = cf2 (v2.get_rep ());
+
+ if (! tmp)
+ err_cat_op_conv ();
+
+ tv2 = octave_value (tmp);
+ t2 = tv2.type_id ();
+ }
+ else
+ tv2 = v2;
+
+ if (! cf1 && ! cf2)
+ err_cat_op (v1.type_name (), v2.type_name ());
+
+ retval = cat_op (ti, tv1, tv2, ra_idx);
+ }
+
+ return retval;
+ }
+
+ octave_value
+ cat_op (const octave_value& v1, const octave_value& v2,
+ const Array& ra_idx)
+ {
+ type_info& ti = __get_type_info__ ();
+
+ return cat_op (ti, v1, v2, ra_idx);
+ }
+
+ // Unless the colon operator is used with a class or classdef object,
+ // then all arguments must be the same type or mixed with double
+ // values.
+
+ static builtin_type_t
+ get_colon_op_type (builtin_type_t op1_type, builtin_type_t op2_type)
+ {
+ if (op1_type == op2_type)
+ return op1_type;
+
+ if (op1_type == btyp_double)
+ return op2_type;
+
+ if (op2_type == btyp_double)
+ return op1_type;
+
+ return btyp_unknown;
+ }
+
+ static builtin_type_t
+ get_colon_op_type (const octave_value& base, const octave_value& increment,
+ const octave_value& limit)
+ {
+ builtin_type_t typ
+ = get_colon_op_type (base.builtin_type (), increment.builtin_type ());
+
+ if (typ == btyp_unknown)
+ return typ;
+
+ return get_colon_op_type (typ, limit.builtin_type ());
+ }
+
+ // This check depends on the type of VAL either being the expected
+ // integer type or a double value.
+
+ template
+ static void
+ check_colon_operand (const octave_value& val, const char *op_str)
+ {
+ if (! val.is_double_type ())
+ return;
+
+ double dval = val.double_value ();
+ double intpart;
+ static const double out_of_range_top
+ = static_cast (std::numeric_limits::max ())
+ + 1.;
+
+ if (dval >= out_of_range_top
+ || dval < std::numeric_limits::min ()
+ || std::modf (dval, &intpart) != 0.0)
+ error ("colon operator %s invalid (not an integer or out of range for given integer type)", op_str);
+ }
+
+ // Return the difference between two unsigned integers as an unsigned
+ // integer of the same type.
+
+ template ::value
+ && std::is_unsigned::value),
+ bool>::type = true>
+ UT
+ integer_difference (UT a, UT b)
+ {
+ return a > b ? a - b : b - a;
+ }
+
+ // Return the difference between two signed integers as an unsigned
+ // integer corresponding to the signed type.
+
+ template ::type,
+ typename std::enable_if<(std::is_integral::value
+ && std::is_signed::value),
+ bool>::type = true>
+ UT
+ integer_difference (ST a, ST b)
+ {
+ // Map to unsigned.
+ // Idea from https://stackoverflow.com/questions/10589559
+
+ static const UT offset
+ = UT (0) - static_cast (std::numeric_limits::min ());
+
+ UT au = static_cast (a) + offset;
+ UT bu = static_cast (b) + offset;
+
+ return integer_difference (au, bu);
+ }
+
+ // Number of elements in an integer range taking care to avoid
+ // overflow. Base and limit are of the same type. If they are
+ // unsigned, then increment is also of the same type. If they are
+ // signed, then the type of increment is the unsigned type
+ // corresponding to T. Assumes that the base and limit values are
+ // consistent with the sign of the original increment (not an empty
+ // range) so we can calculate numel with the absolute value of the
+ // increment and the absolute difference between the base and limit
+ // values.
+
+ template ::type,
+ typename std::enable_if::value,
+ bool>::type = true>
+ octave_idx_type
+ range_numel_aux (T base, UT unsigned_increment, T limit)
+ {
+ // Adding one to DIFF/INCREMENT may overflow, so check whether it is
+ // out of range before adding.
+
+ UT nel_m1 = integer_difference (limit, base) / unsigned_increment;
+
+ // FIXME: fix error message.
+ if (nel_m1 > std::numeric_limits::max () - 1)
+ error ("too many elements for range!");
+
+ return static_cast (nel_m1) + 1;
+ }
+
+ // Convert signed range increment to unsigned.
+
+ template ::type,
+ typename std::enable_if<(std::is_integral::value
+ && std::is_signed::value),
+ bool>::type = true>
+ UT
+ range_increment (ST increment)
+ {
+ return (increment < 0
+ ? UT (0) - static_cast (increment)
+ : static_cast (increment));
+ }
+
+ // "Convert" unsigned range increment to unsigned. A no-op, but
+ // needed to provide a consistent interface for other template
+ // functions.
+
+ template ::type,
+ typename std::enable_if<(std::is_integral::value
+ && std::is_unsigned::value),
+ bool>::type = true>
+ UT
+ range_increment (UT increment)
+ {
+ return increment;
+ }
+
+ // Convert double range increment to unsigned. Enable by return type.
+
+ template ::type>
+ typename std::enable_if<(std::is_integral::value
+ && std::is_unsigned::value), UT>::type
+ range_increment (double increment)
+ {
+ double abs_increment = std::abs (increment);
+
+ return static_cast (abs_increment);
+ }
+
+ // Number of elements in an integer range base:increment:limit. Base,
+ // increment, and limit are of the same signed type.
+
+ template ::value
+ && std::is_signed::value),
+ bool>::type = true>
+ octave_idx_type
+ range_numel (ST base, ST increment, ST limit)
+ {
+ typedef typename std::make_unsigned::type UT;
+
+ if (increment == 0
+ || (increment > 0 && base > limit)
+ || (increment < 0 && base < limit))
+ return 0;
+
+ UT unsigned_increment = range_increment (increment);
+
+ return range_numel_aux (base, unsigned_increment, limit);
+ }
+
+ // Number of elements in an integer range base:increment:limit. Base,
+ // increment, and limit are unsigned and of the same type.
+
+ template ::value
+ && std::is_unsigned::value),
+ bool>::type = true>
+ octave_idx_type
+ range_numel (UT base, UT increment, UT limit)
+ {
+ // Unsigned, INCREMENT is always >= 0.
+ if (increment == 0 || base > limit)
+ return 0;
+
+ return range_numel_aux (base, increment, limit);
+ }
+
+ // Number of elements in an integer range base:increment:limit. Base
+ // and limit are of the same type and increment is a double value.
+
+ template ::type,
+ typename std::enable_if::value,
+ bool>::type = true>
+ octave_idx_type
+ range_numel (T base, double increment, T limit)
+ {
+ double intpart;
+ if (math::isnan (increment) || std::modf (increment, &intpart) != 0.0)
+ error ("colon operator increment invalid (not an integer)");
+
+ if (increment == 0
+ || (increment > 0 && base > limit)
+ || (increment < 0 && base < limit))
+ return 0;
+
+ static const double out_of_range_top
+ = static_cast (std::numeric_limits::max ()) + 1.;
+
+ double abs_increment = std::abs (increment);
+
+ // Technically, this condition should be
+ // `abs_increment > std::numeric_limits::max ()`.
+ // But intmax('uint64') is not representable exactly as floating point
+ // number. Instead, it "rounds" up by 1 to 2^64. To account for
+ // this, use the following expression which works for all unsigned
+ // integer types.
+ if (abs_increment >= out_of_range_top)
+ return 1;
+
+ UT unsigned_increment = range_increment (increment);
+
+ return range_numel_aux (base, unsigned_increment, limit);
+ }
+
+ // Make a range from integer values. Increment may be integer or double.
+
+ template ::value
+ && std::is_arithmetic::value),
+ bool>::type = true>
+ octave_value
+ make_int_range (T base, IT increment, T limit)
+ {
+ octave_idx_type nel = range_numel (base, increment, limit);
+
+ // For now, we create arrays instead of range for all types
+ // except double.
+
+ Array> result (dim_vector (1, nel));
+
+ if (nel > 0)
+ {
+ typedef typename std::make_unsigned::type UT;
+
+ UT unsigned_increment = range_increment (increment);
+
+ T val = base;
+ result.xelem (0) = val;
+
+ if (limit > base)
+ {
+ for (octave_idx_type i = 1; i < nel; i++)
+ {
+ val += unsigned_increment;
+ result.xelem (i) = val;
+ }
+ }
+ else
+ {
+ for (octave_idx_type i = 1; i < nel; i++)
+ {
+ val -= unsigned_increment;
+ result.xelem (i) = val;
+ }
+ }
+ }
+
+ return octave_value (result);
+ }
+
+ // Make a range from floating point values.
+
+ // FIXME: Try again to define memory efficient range classes for
+ // integer and floating point values? Maybe with the templates
+ // defined in this file we could do that in a reasonable way?
+ // Regardless of that, it might be good to provide special treatment
+ // of colon expressions in FOR loops so that we can eliminate the
+ // "is_for_cmd_expr / force_range" flag from the parser and the
+ // octave_value constructors for range objects.
+
+ // NOTE: We define this function separately for float and double so
+ // that we can avoid having to instantiate ov_range. We DO
+ // instantiate range but only so we can take advantage of the
+ // range class to generate the corresponding array of float values
+ // and not have to duplicate that code here.
+
+ template ::value,
+ bool>::type = true>
+ octave_value
+ make_float_range (T base, T increment, T limit, bool is_for_cmd_expr)
+ {
+ if (math::isnan (base)
+ || math::isnan (increment)
+ || math::isnan (limit))
+ return octave_value (numeric_limits::NaN ());
+
+ if (increment == 0
+ || (increment > 0 && base > limit)
+ || (increment < 0 && base < limit))
+ return octave_value (Array (dim_vector (1, 0)));
+
+ // At this point, we know that the base and limit values are
+ // consistent with the sign of the increment (not an empty range).
+
+ range r (base, increment, limit);
+
+ if (! is_for_cmd_expr && ! r.is_storable ())
+ error ("range with infinite number of elements cannot be stored");
+
+ return octave_value (r, is_for_cmd_expr);
+ }
+
+ template ::value,
+ bool>::type = true>
+ octave_value
+ make_float_range (T base, T increment, T limit, bool is_for_cmd_expr)
+ {
+ if (math::isnan (base)
+ || math::isnan (increment)
+ || math::isnan (limit))
+ return octave_value (numeric_limits::NaN ());
+
+ if (increment == 0
+ || (increment > 0 && base > limit)
+ || (increment < 0 && base < limit))
+ return octave_value (Array (dim_vector (1, 0)));
+
+ // At this point, we know that the base and limit values are
+ // consistent with the sign of the increment (not an empty range).
+
+ range r (base, increment, limit);
+
+ if (! is_for_cmd_expr && ! r.is_storable ())
+ error ("range with infinite number of elements cannot be stored");
+
+ return octave_value (r.array_value ());
+ }
+
+ template ::value
+ || std::is_same::value
+ || std::is_same::value
+ || std::is_same::value
+ || std::is_same::value
+ || std::is_same::value
+ || std::is_same::value
+ || std::is_same::value),
+ bool>::type = true>
+ octave_value
+ make_int_range (const octave_value& base, const octave_value& increment,
+ const octave_value& limit)
+ {
+ if (base.isempty () || increment.isempty () || limit.isempty ())
+ return octave_value (Array (dim_vector (1, 0)));
+
+ check_colon_operand (base, "lower bound");
+ check_colon_operand (limit, "upper bound");
+
+ typename T::val_type base_val = octave_value_extract (base).value ();
+ typename T::val_type limit_val = octave_value_extract (limit).value ();
+
+ if (increment.is_double_type ())
+ {
+ double increment_val = increment.double_value ();
+
+ return make_int_range (base_val, increment_val, limit_val);
+ }
+
+ check_colon_operand (increment, "increment");
+
+ typename T::val_type increment_val
+ = octave_value_extract (increment).value ();
+
+ return make_int_range (base_val, increment_val, limit_val);
+ }
+
+ template ::value,
+ bool>::type = true>
+ octave_value
+ make_float_range (const octave_value& base, const octave_value& increment,
+ const octave_value& limit, bool is_for_cmd_expr)
+ {
+ if (base.isempty () || increment.isempty () || limit.isempty ())
+ return octave_value (Array (dim_vector (1, 0)));
+
+ T base_val = octave_value_extract (base);
+ T increment_val = octave_value_extract (increment);
+ T limit_val = octave_value_extract (limit);
+
+ return make_float_range (base_val, increment_val, limit_val,
+ is_for_cmd_expr);
+ }
+
+
+ octave_value
+ make_char_range (const octave_value& base, const octave_value& increment,
const octave_value& limit)
-{
- builtin_type_t typ
- = get_colon_op_type (base.builtin_type (), increment.builtin_type ());
-
- if (typ == btyp_unknown)
- return typ;
-
- return get_colon_op_type (typ, limit.builtin_type ());
-}
-
-// This check depends on the type of VAL either being the expected
-// integer type or a double value.
-
-template
-static void
-check_colon_operand (const octave_value& val, const char *op_str)
-{
- if (! val.is_double_type ())
- return;
-
- double dval = val.double_value ();
- double intpart;
- static const double out_of_range_top
- = static_cast (std::numeric_limits::max ())
- + 1.;
-
- if (dval >= out_of_range_top
- || dval < std::numeric_limits::min ()
- || std::modf (dval, &intpart) != 0.0)
- error ("colon operator %s invalid (not an integer or out of range for given integer type)", op_str);
-}
-
-// Return the difference between two unsigned integers as an unsigned
-// integer of the same type.
-
-template ::value
- && std::is_unsigned::value),
- bool>::type = true>
-UT
-integer_difference (UT a, UT b)
-{
- return a > b ? a - b : b - a;
-}
-
-// Return the difference between two signed integers as an unsigned
-// integer corresponding to the signed type.
-
-template ::type,
- typename std::enable_if<(std::is_integral::value
- && std::is_signed::value),
- bool>::type = true>
-UT
-integer_difference (ST a, ST b)
-{
- // Map to unsigned.
- // Idea from https://stackoverflow.com/questions/10589559
-
- static const UT offset
- = UT (0) - static_cast (std::numeric_limits::min ());
-
- UT au = static_cast (a) + offset;
- UT bu = static_cast (b) + offset;
-
- return integer_difference (au, bu);
-}
-
-// Number of elements in an integer range taking care to avoid
-// overflow. Base and limit are of the same type. If they are
-// unsigned, then increment is also of the same type. If they are
-// signed, then the type of increment is the unsigned type
-// corresponding to T. Assumes that the base and limit values are
-// consistent with the sign of the original increment (not an empty
-// range) so we can calculate numel with the absolute value of the
-// increment and the absolute difference between the base and limit
-// values.
-
-template ::type,
- typename std::enable_if::value,
- bool>::type = true>
-octave_idx_type
-range_numel_aux (T base, UT unsigned_increment, T limit)
-{
- // Adding one to DIFF/INCREMENT may overflow, so check whether it is
- // out of range before adding.
-
- UT nel_m1 = integer_difference (limit, base) / unsigned_increment;
-
- // FIXME: fix error message.
- if (nel_m1 > std::numeric_limits::max () - 1)
- error ("too many elements for range!");
-
- return static_cast (nel_m1) + 1;
-}
-
-// Convert signed range increment to unsigned.
-
-template ::type,
- typename std::enable_if<(std::is_integral::value
- && std::is_signed::value),
- bool>::type = true>
-UT
-range_increment (ST increment)
-{
- return (increment < 0
- ? UT (0) - static_cast (increment)
- : static_cast (increment));
-}
-
-// "Convert" unsigned range increment to unsigned. A no-op, but
-// needed to provide a consistent interface for other template
-// functions.
-
-template ::type,
- typename std::enable_if<(std::is_integral::value
- && std::is_unsigned::value),
- bool>::type = true>
-UT
-range_increment (UT increment)
-{
- return increment;
-}
-
-// Convert double range increment to unsigned. Enable by return type.
-
-template ::type>
-typename std::enable_if<(std::is_integral::value
- && std::is_unsigned::value), UT>::type
-range_increment (double increment)
-{
- double abs_increment = std::abs (increment);
-
- return static_cast (abs_increment);
-}
-
-// Number of elements in an integer range base:increment:limit. Base,
-// increment, and limit are of the same signed type.
-
-template ::value
- && std::is_signed::value),
- bool>::type = true>
-octave_idx_type
-range_numel (ST base, ST increment, ST limit)
-{
- typedef typename std::make_unsigned::type UT;
-
- if (increment == 0
- || (increment > 0 && base > limit)
- || (increment < 0 && base < limit))
- return 0;
-
- UT unsigned_increment = range_increment (increment);
-
- return range_numel_aux (base, unsigned_increment, limit);
-}
-
-// Number of elements in an integer range base:increment:limit. Base,
-// increment, and limit are unsigned and of the same type.
-
-template ::value
- && std::is_unsigned::value),
- bool>::type = true>
-octave_idx_type
-range_numel (UT base, UT increment, UT limit)
-{
- // Unsigned, INCREMENT is always >= 0.
- if (increment == 0 || base > limit)
- return 0;
-
- return range_numel_aux (base, increment, limit);
-}
-
-// Number of elements in an integer range base:increment:limit. Base
-// and limit are of the same type and increment is a double value.
-
-template ::type,
- typename std::enable_if::value,
- bool>::type = true>
-octave_idx_type
-range_numel (T base, double increment, T limit)
-{
- double intpart;
- if (math::isnan (increment) || std::modf (increment, &intpart) != 0.0)
- error ("colon operator increment invalid (not an integer)");
-
- if (increment == 0
- || (increment > 0 && base > limit)
- || (increment < 0 && base < limit))
- return 0;
-
- static const double out_of_range_top
- = static_cast (std::numeric_limits::max ()) + 1.;
-
- double abs_increment = std::abs (increment);
-
- // Technically, this condition should be
- // `abs_increment > std::numeric_limits::max ()`.
- // But intmax('uint64') is not representable exactly as floating point
- // number. Instead, it "rounds" up by 1 to 2^64. To account for
- // this, use the following expression which works for all unsigned
- // integer types.
- if (abs_increment >= out_of_range_top)
- return 1;
-
- UT unsigned_increment = range_increment (increment);
-
- return range_numel_aux (base, unsigned_increment, limit);
-}
-
-// Make a range from integer values. Increment may be integer or double.
-
-template ::value
- && std::is_arithmetic::value),
- bool>::type = true>
-octave_value
-make_int_range (T base, IT increment, T limit)
-{
- octave_idx_type nel = range_numel (base, increment, limit);
-
- // For now, we create arrays instead of range for all types
- // except double.
-
- Array> result (dim_vector (1, nel));
-
- if (nel > 0)
- {
- typedef typename std::make_unsigned::type UT;
-
- UT unsigned_increment = range_increment (increment);
-
- T val = base;
- result.xelem (0) = val;
-
- if (limit > base)
- {
- for (octave_idx_type i = 1; i < nel; i++)
- {
- val += unsigned_increment;
- result.xelem (i) = val;
- }
- }
- else
- {
- for (octave_idx_type i = 1; i < nel; i++)
- {
- val -= unsigned_increment;
- result.xelem (i) = val;
- }
- }
- }
-
- return octave_value (result);
-}
-
-// Make a range from floating point values.
-
-// FIXME: Try again to define memory efficient range classes for
-// integer and floating point values? Maybe with the templates
-// defined in this file we could do that in a reasonable way?
-// Regardless of that, it might be good to provide special treatment
-// of colon expressions in FOR loops so that we can eliminate the
-// "is_for_cmd_expr / force_range" flag from the parser and the
-// octave_value constructors for range objects.
-
-// NOTE: We define this function separately for float and double so
-// that we can avoid having to instantiate ov_range. We DO
-// instantiate range but only so we can take advantage of the
-// range class to generate the corresponding array of float values
-// and not have to duplicate that code here.
-
-template ::value,
- bool>::type = true>
-octave_value
-make_float_range (T base, T increment, T limit, bool is_for_cmd_expr)
-{
- if (math::isnan (base)
- || math::isnan (increment)
- || math::isnan (limit))
- return octave_value (numeric_limits::NaN ());
-
- if (increment == 0
- || (increment > 0 && base > limit)
- || (increment < 0 && base < limit))
- return octave_value (Array (dim_vector (1, 0)));
-
- // At this point, we know that the base and limit values are
- // consistent with the sign of the increment (not an empty range).
-
- range r (base, increment, limit);
-
- if (! is_for_cmd_expr && ! r.is_storable ())
- error ("range with infinite number of elements cannot be stored");
-
- return octave_value (r, is_for_cmd_expr);
-}
-
-template ::value,
- bool>::type = true>
-octave_value
-make_float_range (T base, T increment, T limit, bool is_for_cmd_expr)
-{
- if (math::isnan (base)
- || math::isnan (increment)
- || math::isnan (limit))
- return octave_value (numeric_limits::NaN ());
-
- if (increment == 0
- || (increment > 0 && base > limit)
- || (increment < 0 && base < limit))
- return octave_value (Array (dim_vector (1, 0)));
-
- // At this point, we know that the base and limit values are
- // consistent with the sign of the increment (not an empty range).
-
- range r (base, increment, limit);
-
- if (! is_for_cmd_expr && ! r.is_storable ())
- error ("range with infinite number of elements cannot be stored");
-
- return octave_value (r.array_value ());
-}
-
-template ::value
- || std::is_same::value
- || std::is_same::value
- || std::is_same::value
- || std::is_same::value
- || std::is_same::value
- || std::is_same::value
- || std::is_same::value),
- bool>::type = true>
-octave_value
-make_int_range (const octave_value& base, const octave_value& increment,
- const octave_value& limit)
-{
- if (base.isempty () || increment.isempty () || limit.isempty ())
- return octave_value (Array (dim_vector (1, 0)));
-
- check_colon_operand (base, "lower bound");
- check_colon_operand (limit, "upper bound");
-
- typename T::val_type base_val = octave_value_extract (base).value ();
- typename T::val_type limit_val = octave_value_extract (limit).value ();
-
- if (increment.is_double_type ())
- {
- double increment_val = increment.double_value ();
-
- return make_int_range (base_val, increment_val, limit_val);
- }
-
- check_colon_operand (increment, "increment");
-
- typename T::val_type increment_val
- = octave_value_extract (increment).value ();
-
- return make_int_range (base_val, increment_val, limit_val);
-}
-
-template ::value,
- bool>::type = true>
-octave_value
-make_float_range (const octave_value& base, const octave_value& increment,
- const octave_value& limit, bool is_for_cmd_expr)
-{
- if (base.isempty () || increment.isempty () || limit.isempty ())
- return octave_value (Array (dim_vector (1, 0)));
-
- T base_val = octave_value_extract (base);
- T increment_val = octave_value_extract (increment);
- T limit_val = octave_value_extract (limit);
-
- return make_float_range (base_val, increment_val, limit_val,
- is_for_cmd_expr);
-}
-
-
-octave_value
-make_char_range (const octave_value& base, const octave_value& increment,
- const octave_value& limit)
-{
- octave_value retval;
-
- bool dq_str = (base.is_dq_string () || increment.is_dq_string ()
- || limit.is_dq_string ());
-
- char type = dq_str ? '"' : '\'';
-
- if (base.isempty () || increment.isempty () || limit.isempty ())
- retval = octave_value ("", type);
- else
- {
- Matrix mtx_base = base.matrix_value (true);
- Matrix mtx_increment = increment.matrix_value (true);
- Matrix mtx_limit = limit.matrix_value (true);
-
- range tmp (mtx_base(0), mtx_increment(0), mtx_limit(0));
-
- retval = octave_value (tmp);
- }
-
- return retval.convert_to_str (false, true, type);
-}
-
-octave_value
-colon_op (const octave_value& base, const octave_value& increment_arg,
- const octave_value& limit, bool is_for_cmd_expr)
-{
- if (base.isobject () || increment_arg.isobject () || limit.isobject ())
- {
- octave_value_list tmp1;
-
- if (increment_arg.is_defined ())
- {
- tmp1(2) = limit;
- tmp1(1) = increment_arg;
- tmp1(0) = base;
- }
- else
- {
- tmp1(1) = limit;
- tmp1(0) = base;
- }
-
- interpreter& interp = __get_interpreter__ ();
-
- symbol_table& symtab = interp.get_symbol_table ();
-
- octave_value fcn = symtab.find_function ("colon", tmp1);
-
- if (fcn.is_defined ())
- {
- octave_value_list tmp2 = interp.feval (fcn, tmp1, 1);
-
- return tmp2(0);
- }
- }
-
- octave_value increment
- = increment_arg.is_defined () ? increment_arg : octave_value (1.0);
-
- if (base.numel () > 1 || limit.numel () > 1 || increment.numel () > 1)
- warning_with_id ("Octave:colon-nonscalar-argument",
- "colon arguments should be scalars");
-
- if (base.iscomplex () || limit.iscomplex () || increment.iscomplex ())
- warning_with_id ("Octave:colon-complex-argument",
- "imaginary part of complex colon arguments is ignored");
-
- // FIXME: is there a better way to do this job, maybe using type traits?
-
- builtin_type_t type_id = get_colon_op_type (base, increment, limit);
-
- // For compatibility with Matlab, don't allow the range used in
- // a FOR loop expression to be converted to a Matrix.
-
- // For now, these functions create arrays instead of range for
- // all types except double.
-
- switch (type_id)
- {
- case btyp_double:
- case btyp_complex:
- return make_float_range (base, increment, limit, is_for_cmd_expr);
-
- case btyp_float:
- case btyp_float_complex:
- return make_float_range (base, increment, limit, is_for_cmd_expr);
-
- case btyp_int8:
- return make_int_range (base, increment, limit);
-
- case btyp_int16:
- return make_int_range (base, increment, limit);
-
- case btyp_int32:
- return make_int_range (base, increment, limit);
-
- case btyp_int64:
- return make_int_range (base, increment, limit);
-
- case btyp_uint8:
- return make_int_range (base, increment, limit);
-
- case btyp_uint16:
- return make_int_range (base, increment, limit);
-
- case btyp_uint32:
- return make_int_range (base, increment, limit);
-
- case btyp_uint64:
- return make_int_range (base, increment, limit);
-
- case btyp_char:
- return make_char_range (base, increment, limit);
-
- case btyp_unknown:
- error ("incompatible types found in range expression");
-
- default:
- error ("invalid types found in range expression");
- }
-
- return octave_value ();
-}
-
-OCTAVE_NORETURN static void
-err_unary_op_conv (const std::string& on)
-{
- error ("type conversion failed for unary operator '%s'", on.c_str ());
-}
-
-octave_value
-unary_op (type_info& ti, octave_value::unary_op op,
- const octave_value& v)
-{
- octave_value retval;
-
- int t = v.type_id ();
-
- if (t == octave_class::static_type_id ()
- || t == octave_classdef::static_type_id ())
- {
- type_info::unary_class_op_fcn f = ti.lookup_unary_class_op (op);
-
- if (! f)
- err_unary_op (octave_value::unary_op_as_string (op), v.class_name ());
-
- retval = f (v);
- }
- else
- {
- // FIXME: we need to handle overloading operators for built-in
- // classes (double, char, int8, etc.)
-
- type_info::unary_op_fcn f = ti.lookup_unary_op (op, t);
-
- if (f)
- retval = f (v.get_rep ());
- else
- {
- octave_value tv;
- octave_base_value::type_conv_fcn cf
- = v.numeric_conversion_function ();
-
- if (! cf)
- err_unary_op (octave_value::unary_op_as_string (op),
- v.type_name ());
-
- octave_base_value *tmp = cf (v.get_rep ());
-
- if (! tmp)
- err_unary_op_conv (octave_value::unary_op_as_string (op));
-
- tv = octave_value (tmp);
- retval = unary_op (op, tv);
- }
- }
-
- return retval;
-}
-
-octave_value
-unary_op (octave_value::unary_op op, const octave_value& v)
-{
- type_info& ti = __get_type_info__ ();
-
- return unary_op (ti, op, v);
-}
+ {
+ octave_value retval;
+
+ bool dq_str = (base.is_dq_string () || increment.is_dq_string ()
+ || limit.is_dq_string ());
+
+ char type = dq_str ? '"' : '\'';
+
+ if (base.isempty () || increment.isempty () || limit.isempty ())
+ retval = octave_value ("", type);
+ else
+ {
+ Matrix mtx_base = base.matrix_value (true);
+ Matrix mtx_increment = increment.matrix_value (true);
+ Matrix mtx_limit = limit.matrix_value (true);
+
+ range tmp (mtx_base(0), mtx_increment(0), mtx_limit(0));
+
+ retval = octave_value (tmp);
+ }
+
+ return retval.convert_to_str (false, true, type);
+ }
+
+ octave_value
+ colon_op (const octave_value& base, const octave_value& increment_arg,
+ const octave_value& limit, bool is_for_cmd_expr)
+ {
+ if (base.isobject () || increment_arg.isobject () || limit.isobject ())
+ {
+ octave_value_list tmp1;
+
+ if (increment_arg.is_defined ())
+ {
+ tmp1(2) = limit;
+ tmp1(1) = increment_arg;
+ tmp1(0) = base;
+ }
+ else
+ {
+ tmp1(1) = limit;
+ tmp1(0) = base;
+ }
+
+ interpreter& interp = __get_interpreter__ ();
+
+ symbol_table& symtab = interp.get_symbol_table ();
+
+ octave_value fcn = symtab.find_function ("colon", tmp1);
+
+ if (fcn.is_defined ())
+ {
+ octave_value_list tmp2 = interp.feval (fcn, tmp1, 1);
+
+ return tmp2(0);
+ }
+ }
+
+ octave_value increment
+ = increment_arg.is_defined () ? increment_arg : octave_value (1.0);
+
+ if (base.numel () > 1 || limit.numel () > 1 || increment.numel () > 1)
+ warning_with_id ("Octave:colon-nonscalar-argument",
+ "colon arguments should be scalars");
+
+ if (base.iscomplex () || limit.iscomplex () || increment.iscomplex ())
+ warning_with_id ("Octave:colon-complex-argument",
+ "imaginary part of complex colon arguments is ignored");
+
+ // FIXME: is there a better way to do this job, maybe using type traits?
+
+ builtin_type_t type_id = get_colon_op_type (base, increment, limit);
+
+ // For compatibility with Matlab, don't allow the range used in
+ // a FOR loop expression to be converted to a Matrix.
+
+ // For now, these functions create arrays instead of range for
+ // all types except double.
+
+ switch (type_id)
+ {
+ case btyp_double:
+ case btyp_complex:
+ return make_float_range (base, increment, limit, is_for_cmd_expr);
+
+ case btyp_float:
+ case btyp_float_complex:
+ return make_float_range