# HG changeset patch # User John W. Eaton # Date 1670359527 18000 # Node ID deb553ac2c54f5a874be5fea5c56b2c2f43e7938 # Parent 431f80aba37a0b24e1df43db6c5617270fa67a9a# Parent 29d734430e5f4c327676fe81ecdcea6b8fa527be maint: Merge stable to default. diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/BaseControl.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/BaseControl.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/ButtonControl.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/ButtonControl.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/ButtonGroup.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/ButtonGroup.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/Canvas.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/Canvas.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/CheckBoxControl.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/CheckBoxControl.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/Container.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/Container.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/ContextMenu.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/ContextMenu.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/EditControl.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/EditControl.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/Figure.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/Figure.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/FigureWindow.cc --- a/libgui/graphics/FigureWindow.cc Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/graphics/FigureWindow.cc Tue Dec 06 15:45:27 2022 -0500 @@ -34,27 +34,27 @@ OCTAVE_BEGIN_NAMESPACE(octave) - FigureWindow::FigureWindow (QWidget *xparent) - : FigureWindowBase (xparent) - { - // set icon from application resources - setWindowIcon (QIcon (global_icon_paths.at (ICON_THEME_OCTAVE))); - } +FigureWindow::FigureWindow (QWidget *xparent) +: FigureWindowBase (xparent) +{ + // set icon from application resources + setWindowIcon (QIcon (global_icon_paths.at (ICON_THEME_OCTAVE))); +} - FigureWindow::~FigureWindow (void) - { } +FigureWindow::~FigureWindow (void) +{ } - QMenu * - FigureWindow::createPopupMenu (void) - { - // For the time being, disable menubar/toolbar popup menu - return nullptr; - } +QMenu * +FigureWindow::createPopupMenu (void) +{ + // For the time being, disable menubar/toolbar popup menu + return nullptr; +} - void FigureWindow::showEvent (QShowEvent *ev) - { - QMainWindow::showEvent (ev); - emit figureWindowShown(); - } +void FigureWindow::showEvent (QShowEvent *ev) +{ + QMainWindow::showEvent (ev); + emit figureWindowShown(); +} OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/FigureWindow.h --- a/libgui/graphics/FigureWindow.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/graphics/FigureWindow.h Tue Dec 06 15:45:27 2022 -0500 @@ -32,25 +32,25 @@ OCTAVE_BEGIN_NAMESPACE(octave) - DECLARE_GENERICEVENTNOTIFY_SENDER(FigureWindowBase, QMainWindow); +DECLARE_GENERICEVENTNOTIFY_SENDER(FigureWindowBase, QMainWindow); - class FigureWindow : public FigureWindowBase - { - Q_OBJECT +class FigureWindow : public FigureWindowBase +{ + Q_OBJECT - public: - explicit FigureWindow (QWidget *parent = nullptr); - ~FigureWindow (void); +public: + explicit FigureWindow (QWidget *parent = nullptr); + ~FigureWindow (void); - QMenu * createPopupMenu (void); + QMenu * createPopupMenu (void); - protected: - void showEvent(QShowEvent *ev); +protected: + void showEvent(QShowEvent *ev); - signals: - void figureWindowShown(); +signals: + void figureWindowShown(); - }; +}; OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/GLCanvas.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/GLCanvas.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/GenericEventNotify.h --- a/libgui/graphics/GenericEventNotify.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/graphics/GenericEventNotify.h Tue Dec 06 15:45:27 2022 -0500 @@ -34,56 +34,56 @@ OCTAVE_BEGIN_NAMESPACE(octave) - class GenericEventNotifyReceiver; +class GenericEventNotifyReceiver; - class GenericEventNotifySender - { - public: - GenericEventNotifySender (void) : m_receivers () { } - virtual ~GenericEventNotifySender (void) = default; +class GenericEventNotifySender +{ +public: + GenericEventNotifySender (void) : m_receivers () { } + virtual ~GenericEventNotifySender (void) = default; - void addReceiver (GenericEventNotifyReceiver *r) - { m_receivers.insert (r); } + void addReceiver (GenericEventNotifyReceiver *r) + { m_receivers.insert (r); } - void removeReceiver (GenericEventNotifyReceiver *r) - { m_receivers.remove (r); } + void removeReceiver (GenericEventNotifyReceiver *r) + { m_receivers.remove (r); } - protected: - bool notifyReceiversBefore (QObject *obj, QEvent *evt); - void notifyReceiversAfter (QObject *obj, QEvent *evt); +protected: + bool notifyReceiversBefore (QObject *obj, QEvent *evt); + void notifyReceiversAfter (QObject *obj, QEvent *evt); - private: - QSet m_receivers; - }; +private: + QSet m_receivers; +}; - class GenericEventNotifyReceiver - { - public: - GenericEventNotifyReceiver (void) { } - virtual ~GenericEventNotifyReceiver (void) = default; +class GenericEventNotifyReceiver +{ +public: + GenericEventNotifyReceiver (void) { } + virtual ~GenericEventNotifyReceiver (void) = default; - virtual bool eventNotifyBefore (QObject *obj, QEvent *evt) = 0; - virtual void eventNotifyAfter (QObject *obj, QEvent *evt) = 0; - }; + virtual bool eventNotifyBefore (QObject *obj, QEvent *evt) = 0; + virtual void eventNotifyAfter (QObject *obj, QEvent *evt) = 0; +}; - inline - bool GenericEventNotifySender::notifyReceiversBefore (QObject *obj, - QEvent *evt) - { - for (auto *r : m_receivers) - if (r->eventNotifyBefore (obj, evt)) - return true; +inline +bool GenericEventNotifySender::notifyReceiversBefore (QObject *obj, + QEvent *evt) +{ + for (auto *r : m_receivers) + if (r->eventNotifyBefore (obj, evt)) + return true; - return false; - } + return false; +} - inline - void GenericEventNotifySender::notifyReceiversAfter (QObject *obj, - QEvent *evt) - { - for (auto *r : m_receivers) - r->eventNotifyAfter (obj, evt); - } +inline +void GenericEventNotifySender::notifyReceiversAfter (QObject *obj, + QEvent *evt) +{ + for (auto *r : m_receivers) + r->eventNotifyAfter (obj, evt); +} OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/KeyMap.cc --- a/libgui/graphics/KeyMap.cc Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/graphics/KeyMap.cc Tue Dec 06 15:45:27 2022 -0500 @@ -34,228 +34,228 @@ OCTAVE_BEGIN_NAMESPACE(octave) - namespace KeyMap +namespace KeyMap +{ + QMap makeKeyMapper (void) { - QMap makeKeyMapper (void) - { - QMap keyMapper; + QMap keyMapper; - keyMapper[Qt::Key_Escape] = "escape"; - keyMapper[Qt::Key_Tab] = "tab"; - keyMapper[Qt::Key_Backtab] = "backtab"; - keyMapper[Qt::Key_Backspace] = "backspace"; - keyMapper[Qt::Key_Return] = "return"; - keyMapper[Qt::Key_Enter] = "enter"; - keyMapper[Qt::Key_Insert] = "insert"; - keyMapper[Qt::Key_Delete] = "delete"; - keyMapper[Qt::Key_Pause] = "pause"; - keyMapper[Qt::Key_Print] = "print"; - keyMapper[Qt::Key_SysReq] = "sysreq"; - keyMapper[Qt::Key_Clear] = "clear"; - keyMapper[Qt::Key_Home] = "home"; - keyMapper[Qt::Key_End] = "end"; - keyMapper[Qt::Key_Left] = "left"; - keyMapper[Qt::Key_Up] = "up"; - keyMapper[Qt::Key_Right] = "right"; - keyMapper[Qt::Key_Down] = "down"; - keyMapper[Qt::Key_PageUp] = "pageup"; - keyMapper[Qt::Key_PageDown] = "pagedown"; - keyMapper[Qt::Key_Shift] = "shift"; - keyMapper[Qt::Key_Control] = "control"; - keyMapper[Qt::Key_Meta] = "meta"; - keyMapper[Qt::Key_Alt] = "alt"; - keyMapper[Qt::Key_CapsLock] = "capslock"; - keyMapper[Qt::Key_NumLock] = "numlock"; - keyMapper[Qt::Key_ScrollLock] = "scrolllock"; - keyMapper[Qt::Key_F1] = "f1"; - keyMapper[Qt::Key_F2] = "f2"; - keyMapper[Qt::Key_F3] = "f3"; - keyMapper[Qt::Key_F4] = "f4"; - keyMapper[Qt::Key_F5] = "f5"; - keyMapper[Qt::Key_F6] = "f6"; - keyMapper[Qt::Key_F7] = "f7"; - keyMapper[Qt::Key_F8] = "f8"; - keyMapper[Qt::Key_F9] = "f9"; - keyMapper[Qt::Key_F10] = "f10"; - keyMapper[Qt::Key_F11] = "f11"; - keyMapper[Qt::Key_F12] = "f12"; - keyMapper[Qt::Key_F13] = "f13"; - keyMapper[Qt::Key_F14] = "f14"; - keyMapper[Qt::Key_F15] = "f15"; - keyMapper[Qt::Key_F16] = "f16"; - keyMapper[Qt::Key_F17] = "f17"; - keyMapper[Qt::Key_F18] = "f18"; - keyMapper[Qt::Key_F19] = "f19"; - keyMapper[Qt::Key_F20] = "f20"; - keyMapper[Qt::Key_F21] = "f21"; - keyMapper[Qt::Key_F22] = "f22"; - keyMapper[Qt::Key_F23] = "f23"; - keyMapper[Qt::Key_F24] = "f24"; - keyMapper[Qt::Key_F25] = "f25"; - keyMapper[Qt::Key_F26] = "f26"; - keyMapper[Qt::Key_F27] = "f27"; - keyMapper[Qt::Key_F28] = "f28"; - keyMapper[Qt::Key_F29] = "f29"; - keyMapper[Qt::Key_F30] = "f30"; - keyMapper[Qt::Key_F31] = "f31"; - keyMapper[Qt::Key_F32] = "f32"; - keyMapper[Qt::Key_F33] = "f33"; - keyMapper[Qt::Key_F34] = "f34"; - keyMapper[Qt::Key_F35] = "f35"; - keyMapper[Qt::Key_Super_L] = "super_l"; - keyMapper[Qt::Key_Super_R] = "super_r"; - keyMapper[Qt::Key_Menu] = "menu"; - keyMapper[Qt::Key_Hyper_L] = "hyper_l"; - keyMapper[Qt::Key_Hyper_R] = "hyper_r"; - keyMapper[Qt::Key_Help] = "help"; - keyMapper[Qt::Key_Direction_L] = "direction_l"; - keyMapper[Qt::Key_Direction_R] = "direction_r"; - keyMapper[Qt::Key_Space] = "space"; - keyMapper[Qt::Key_Exclam] = "exclam"; - keyMapper[Qt::Key_QuoteDbl] = "quotedbl"; - keyMapper[Qt::Key_NumberSign] = "numbersign"; - keyMapper[Qt::Key_Dollar] = "dollar"; - keyMapper[Qt::Key_Percent] = "percent"; - keyMapper[Qt::Key_Ampersand] = "ampersand"; - keyMapper[Qt::Key_Apostrophe] = "apostrophe"; - keyMapper[Qt::Key_ParenLeft] = "parenleft"; - keyMapper[Qt::Key_ParenRight] = "parenright"; - keyMapper[Qt::Key_Asterisk] = "asterisk"; - keyMapper[Qt::Key_Plus] = "plus"; - keyMapper[Qt::Key_Comma] = "comma"; - keyMapper[Qt::Key_Minus] = "minus"; - keyMapper[Qt::Key_Period] = "period"; - keyMapper[Qt::Key_Slash] = "slash"; - keyMapper[Qt::Key_0] = "0"; - keyMapper[Qt::Key_1] = "1"; - keyMapper[Qt::Key_2] = "2"; - keyMapper[Qt::Key_3] = "3"; - keyMapper[Qt::Key_4] = "4"; - keyMapper[Qt::Key_5] = "5"; - keyMapper[Qt::Key_6] = "6"; - keyMapper[Qt::Key_7] = "7"; - keyMapper[Qt::Key_8] = "8"; - keyMapper[Qt::Key_9] = "9"; - keyMapper[Qt::Key_Colon] = "colon"; - keyMapper[Qt::Key_Semicolon] = "semicolon"; - keyMapper[Qt::Key_Less] = "less"; - keyMapper[Qt::Key_Equal] = "equal"; - keyMapper[Qt::Key_Greater] = "greater"; - keyMapper[Qt::Key_Question] = "question"; - keyMapper[Qt::Key_At] = "at"; - keyMapper[Qt::Key_A] = "a"; - keyMapper[Qt::Key_B] = "b"; - keyMapper[Qt::Key_C] = "c"; - keyMapper[Qt::Key_D] = "d"; - keyMapper[Qt::Key_E] = "e"; - keyMapper[Qt::Key_F] = "f"; - keyMapper[Qt::Key_G] = "g"; - keyMapper[Qt::Key_H] = "h"; - keyMapper[Qt::Key_I] = "i"; - keyMapper[Qt::Key_J] = "j"; - keyMapper[Qt::Key_K] = "k"; - keyMapper[Qt::Key_L] = "l"; - keyMapper[Qt::Key_M] = "m"; - keyMapper[Qt::Key_N] = "n"; - keyMapper[Qt::Key_O] = "o"; - keyMapper[Qt::Key_P] = "p"; - keyMapper[Qt::Key_Q] = "q"; - keyMapper[Qt::Key_R] = "r"; - keyMapper[Qt::Key_S] = "s"; - keyMapper[Qt::Key_T] = "t"; - keyMapper[Qt::Key_U] = "u"; - keyMapper[Qt::Key_V] = "v"; - keyMapper[Qt::Key_W] = "w"; - keyMapper[Qt::Key_X] = "x"; - keyMapper[Qt::Key_Y] = "y"; - keyMapper[Qt::Key_Z] = "z"; - keyMapper[Qt::Key_BracketLeft] = "bracketleft"; - keyMapper[Qt::Key_Backslash] = "backslash"; - keyMapper[Qt::Key_BracketRight] = "bracketright"; - keyMapper[Qt::Key_AsciiCircum] = "asciicircum"; - keyMapper[Qt::Key_Underscore] = "underscore"; - keyMapper[Qt::Key_QuoteLeft] = "quoteleft"; - keyMapper[Qt::Key_BraceLeft] = "braceleft"; - keyMapper[Qt::Key_Bar] = "bar"; - keyMapper[Qt::Key_BraceRight] = "braceright"; - keyMapper[Qt::Key_AsciiTilde] = "asciitilde"; + keyMapper[Qt::Key_Escape] = "escape"; + keyMapper[Qt::Key_Tab] = "tab"; + keyMapper[Qt::Key_Backtab] = "backtab"; + keyMapper[Qt::Key_Backspace] = "backspace"; + keyMapper[Qt::Key_Return] = "return"; + keyMapper[Qt::Key_Enter] = "enter"; + keyMapper[Qt::Key_Insert] = "insert"; + keyMapper[Qt::Key_Delete] = "delete"; + keyMapper[Qt::Key_Pause] = "pause"; + keyMapper[Qt::Key_Print] = "print"; + keyMapper[Qt::Key_SysReq] = "sysreq"; + keyMapper[Qt::Key_Clear] = "clear"; + keyMapper[Qt::Key_Home] = "home"; + keyMapper[Qt::Key_End] = "end"; + keyMapper[Qt::Key_Left] = "left"; + keyMapper[Qt::Key_Up] = "up"; + keyMapper[Qt::Key_Right] = "right"; + keyMapper[Qt::Key_Down] = "down"; + keyMapper[Qt::Key_PageUp] = "pageup"; + keyMapper[Qt::Key_PageDown] = "pagedown"; + keyMapper[Qt::Key_Shift] = "shift"; + keyMapper[Qt::Key_Control] = "control"; + keyMapper[Qt::Key_Meta] = "meta"; + keyMapper[Qt::Key_Alt] = "alt"; + keyMapper[Qt::Key_CapsLock] = "capslock"; + keyMapper[Qt::Key_NumLock] = "numlock"; + keyMapper[Qt::Key_ScrollLock] = "scrolllock"; + keyMapper[Qt::Key_F1] = "f1"; + keyMapper[Qt::Key_F2] = "f2"; + keyMapper[Qt::Key_F3] = "f3"; + keyMapper[Qt::Key_F4] = "f4"; + keyMapper[Qt::Key_F5] = "f5"; + keyMapper[Qt::Key_F6] = "f6"; + keyMapper[Qt::Key_F7] = "f7"; + keyMapper[Qt::Key_F8] = "f8"; + keyMapper[Qt::Key_F9] = "f9"; + keyMapper[Qt::Key_F10] = "f10"; + keyMapper[Qt::Key_F11] = "f11"; + keyMapper[Qt::Key_F12] = "f12"; + keyMapper[Qt::Key_F13] = "f13"; + keyMapper[Qt::Key_F14] = "f14"; + keyMapper[Qt::Key_F15] = "f15"; + keyMapper[Qt::Key_F16] = "f16"; + keyMapper[Qt::Key_F17] = "f17"; + keyMapper[Qt::Key_F18] = "f18"; + keyMapper[Qt::Key_F19] = "f19"; + keyMapper[Qt::Key_F20] = "f20"; + keyMapper[Qt::Key_F21] = "f21"; + keyMapper[Qt::Key_F22] = "f22"; + keyMapper[Qt::Key_F23] = "f23"; + keyMapper[Qt::Key_F24] = "f24"; + keyMapper[Qt::Key_F25] = "f25"; + keyMapper[Qt::Key_F26] = "f26"; + keyMapper[Qt::Key_F27] = "f27"; + keyMapper[Qt::Key_F28] = "f28"; + keyMapper[Qt::Key_F29] = "f29"; + keyMapper[Qt::Key_F30] = "f30"; + keyMapper[Qt::Key_F31] = "f31"; + keyMapper[Qt::Key_F32] = "f32"; + keyMapper[Qt::Key_F33] = "f33"; + keyMapper[Qt::Key_F34] = "f34"; + keyMapper[Qt::Key_F35] = "f35"; + keyMapper[Qt::Key_Super_L] = "super_l"; + keyMapper[Qt::Key_Super_R] = "super_r"; + keyMapper[Qt::Key_Menu] = "menu"; + keyMapper[Qt::Key_Hyper_L] = "hyper_l"; + keyMapper[Qt::Key_Hyper_R] = "hyper_r"; + keyMapper[Qt::Key_Help] = "help"; + keyMapper[Qt::Key_Direction_L] = "direction_l"; + keyMapper[Qt::Key_Direction_R] = "direction_r"; + keyMapper[Qt::Key_Space] = "space"; + keyMapper[Qt::Key_Exclam] = "exclam"; + keyMapper[Qt::Key_QuoteDbl] = "quotedbl"; + keyMapper[Qt::Key_NumberSign] = "numbersign"; + keyMapper[Qt::Key_Dollar] = "dollar"; + keyMapper[Qt::Key_Percent] = "percent"; + keyMapper[Qt::Key_Ampersand] = "ampersand"; + keyMapper[Qt::Key_Apostrophe] = "apostrophe"; + keyMapper[Qt::Key_ParenLeft] = "parenleft"; + keyMapper[Qt::Key_ParenRight] = "parenright"; + keyMapper[Qt::Key_Asterisk] = "asterisk"; + keyMapper[Qt::Key_Plus] = "plus"; + keyMapper[Qt::Key_Comma] = "comma"; + keyMapper[Qt::Key_Minus] = "minus"; + keyMapper[Qt::Key_Period] = "period"; + keyMapper[Qt::Key_Slash] = "slash"; + keyMapper[Qt::Key_0] = "0"; + keyMapper[Qt::Key_1] = "1"; + keyMapper[Qt::Key_2] = "2"; + keyMapper[Qt::Key_3] = "3"; + keyMapper[Qt::Key_4] = "4"; + keyMapper[Qt::Key_5] = "5"; + keyMapper[Qt::Key_6] = "6"; + keyMapper[Qt::Key_7] = "7"; + keyMapper[Qt::Key_8] = "8"; + keyMapper[Qt::Key_9] = "9"; + keyMapper[Qt::Key_Colon] = "colon"; + keyMapper[Qt::Key_Semicolon] = "semicolon"; + keyMapper[Qt::Key_Less] = "less"; + keyMapper[Qt::Key_Equal] = "equal"; + keyMapper[Qt::Key_Greater] = "greater"; + keyMapper[Qt::Key_Question] = "question"; + keyMapper[Qt::Key_At] = "at"; + keyMapper[Qt::Key_A] = "a"; + keyMapper[Qt::Key_B] = "b"; + keyMapper[Qt::Key_C] = "c"; + keyMapper[Qt::Key_D] = "d"; + keyMapper[Qt::Key_E] = "e"; + keyMapper[Qt::Key_F] = "f"; + keyMapper[Qt::Key_G] = "g"; + keyMapper[Qt::Key_H] = "h"; + keyMapper[Qt::Key_I] = "i"; + keyMapper[Qt::Key_J] = "j"; + keyMapper[Qt::Key_K] = "k"; + keyMapper[Qt::Key_L] = "l"; + keyMapper[Qt::Key_M] = "m"; + keyMapper[Qt::Key_N] = "n"; + keyMapper[Qt::Key_O] = "o"; + keyMapper[Qt::Key_P] = "p"; + keyMapper[Qt::Key_Q] = "q"; + keyMapper[Qt::Key_R] = "r"; + keyMapper[Qt::Key_S] = "s"; + keyMapper[Qt::Key_T] = "t"; + keyMapper[Qt::Key_U] = "u"; + keyMapper[Qt::Key_V] = "v"; + keyMapper[Qt::Key_W] = "w"; + keyMapper[Qt::Key_X] = "x"; + keyMapper[Qt::Key_Y] = "y"; + keyMapper[Qt::Key_Z] = "z"; + keyMapper[Qt::Key_BracketLeft] = "bracketleft"; + keyMapper[Qt::Key_Backslash] = "backslash"; + keyMapper[Qt::Key_BracketRight] = "bracketright"; + keyMapper[Qt::Key_AsciiCircum] = "asciicircum"; + keyMapper[Qt::Key_Underscore] = "underscore"; + keyMapper[Qt::Key_QuoteLeft] = "quoteleft"; + keyMapper[Qt::Key_BraceLeft] = "braceleft"; + keyMapper[Qt::Key_Bar] = "bar"; + keyMapper[Qt::Key_BraceRight] = "braceright"; + keyMapper[Qt::Key_AsciiTilde] = "asciitilde"; - keyMapper[Qt::Key_nobreakspace] = "nobreakspace"; - keyMapper[Qt::Key_exclamdown] = "exclamdown"; - keyMapper[Qt::Key_cent] = "cent"; - keyMapper[Qt::Key_sterling] = "sterling"; - keyMapper[Qt::Key_currency] = "currency"; - keyMapper[Qt::Key_yen] = "yen"; - keyMapper[Qt::Key_brokenbar] = "brokenbar"; - keyMapper[Qt::Key_section] = "section"; - keyMapper[Qt::Key_diaeresis] = "diaeresis"; - keyMapper[Qt::Key_copyright] = "copyright"; - keyMapper[Qt::Key_ordfeminine] = "ordfeminine"; - keyMapper[Qt::Key_guillemotleft] = "guillemotleft"; - keyMapper[Qt::Key_notsign] = "notsign"; - keyMapper[Qt::Key_hyphen] = "hyphen"; - keyMapper[Qt::Key_registered] = "registered"; - keyMapper[Qt::Key_macron] = "macron"; - keyMapper[Qt::Key_degree] = "degree"; - keyMapper[Qt::Key_plusminus] = "plusminus"; - keyMapper[Qt::Key_twosuperior] = "twosuperior"; - keyMapper[Qt::Key_threesuperior] = "threesuperior"; - keyMapper[Qt::Key_acute] = "acute"; - keyMapper[Qt::Key_mu] = "mu"; - keyMapper[Qt::Key_paragraph] = "paragraph"; - keyMapper[Qt::Key_periodcentered] = "periodcentered"; - keyMapper[Qt::Key_cedilla] = "cedilla"; - keyMapper[Qt::Key_onesuperior] = "onesuperior"; - keyMapper[Qt::Key_masculine] = "masculine"; - keyMapper[Qt::Key_guillemotright] = "guillemotright"; - keyMapper[Qt::Key_onequarter] = "onequarter"; - keyMapper[Qt::Key_onehalf] = "onehalf"; - keyMapper[Qt::Key_threequarters] = "threequarters"; - keyMapper[Qt::Key_questiondown] = "questiondown"; - keyMapper[Qt::Key_Agrave] = "agrave"; - keyMapper[Qt::Key_Aacute] = "aacute"; - keyMapper[Qt::Key_Acircumflex] = "acircumflex"; - keyMapper[Qt::Key_Atilde] = "atilde"; - keyMapper[Qt::Key_Adiaeresis] = "adiaeresis"; - keyMapper[Qt::Key_Aring] = "aring"; - keyMapper[Qt::Key_AE] = "ae"; - keyMapper[Qt::Key_Ccedilla] = "ccedilla"; - keyMapper[Qt::Key_Egrave] = "egrave"; - keyMapper[Qt::Key_Eacute] = "eacute"; - keyMapper[Qt::Key_Ecircumflex] = "ecircumflex"; - keyMapper[Qt::Key_Ediaeresis] = "ediaeresis"; - keyMapper[Qt::Key_Igrave] = "igrave"; - keyMapper[Qt::Key_Iacute] = "iacute"; - keyMapper[Qt::Key_Icircumflex] = "icircumflex"; - keyMapper[Qt::Key_Idiaeresis] = "idiaeresis"; - keyMapper[Qt::Key_ETH] = "eth"; - keyMapper[Qt::Key_Ntilde] = "ntilde"; - keyMapper[Qt::Key_Ograve] = "ograve"; - keyMapper[Qt::Key_Oacute] = "oacute"; - keyMapper[Qt::Key_Ocircumflex] = "ocircumflex"; - keyMapper[Qt::Key_Otilde] = "otilde"; - keyMapper[Qt::Key_Odiaeresis] = "odiaeresis"; - keyMapper[Qt::Key_multiply] = "multiply"; - keyMapper[Qt::Key_Ooblique] = "ooblique"; - keyMapper[Qt::Key_Ugrave] = "ugrave"; - keyMapper[Qt::Key_Uacute] = "uacute"; - keyMapper[Qt::Key_Ucircumflex] = "ucircumflex"; - keyMapper[Qt::Key_Udiaeresis] = "udiaeresis"; - keyMapper[Qt::Key_Yacute] = "yacute"; - keyMapper[Qt::Key_THORN] = "thorn"; - keyMapper[Qt::Key_ssharp] = "ssharp"; - keyMapper[Qt::Key_division] = "division"; - keyMapper[Qt::Key_ydiaeresis] = "ydiaeresis"; + keyMapper[Qt::Key_nobreakspace] = "nobreakspace"; + keyMapper[Qt::Key_exclamdown] = "exclamdown"; + keyMapper[Qt::Key_cent] = "cent"; + keyMapper[Qt::Key_sterling] = "sterling"; + keyMapper[Qt::Key_currency] = "currency"; + keyMapper[Qt::Key_yen] = "yen"; + keyMapper[Qt::Key_brokenbar] = "brokenbar"; + keyMapper[Qt::Key_section] = "section"; + keyMapper[Qt::Key_diaeresis] = "diaeresis"; + keyMapper[Qt::Key_copyright] = "copyright"; + keyMapper[Qt::Key_ordfeminine] = "ordfeminine"; + keyMapper[Qt::Key_guillemotleft] = "guillemotleft"; + keyMapper[Qt::Key_notsign] = "notsign"; + keyMapper[Qt::Key_hyphen] = "hyphen"; + keyMapper[Qt::Key_registered] = "registered"; + keyMapper[Qt::Key_macron] = "macron"; + keyMapper[Qt::Key_degree] = "degree"; + keyMapper[Qt::Key_plusminus] = "plusminus"; + keyMapper[Qt::Key_twosuperior] = "twosuperior"; + keyMapper[Qt::Key_threesuperior] = "threesuperior"; + keyMapper[Qt::Key_acute] = "acute"; + keyMapper[Qt::Key_mu] = "mu"; + keyMapper[Qt::Key_paragraph] = "paragraph"; + keyMapper[Qt::Key_periodcentered] = "periodcentered"; + keyMapper[Qt::Key_cedilla] = "cedilla"; + keyMapper[Qt::Key_onesuperior] = "onesuperior"; + keyMapper[Qt::Key_masculine] = "masculine"; + keyMapper[Qt::Key_guillemotright] = "guillemotright"; + keyMapper[Qt::Key_onequarter] = "onequarter"; + keyMapper[Qt::Key_onehalf] = "onehalf"; + keyMapper[Qt::Key_threequarters] = "threequarters"; + keyMapper[Qt::Key_questiondown] = "questiondown"; + keyMapper[Qt::Key_Agrave] = "agrave"; + keyMapper[Qt::Key_Aacute] = "aacute"; + keyMapper[Qt::Key_Acircumflex] = "acircumflex"; + keyMapper[Qt::Key_Atilde] = "atilde"; + keyMapper[Qt::Key_Adiaeresis] = "adiaeresis"; + keyMapper[Qt::Key_Aring] = "aring"; + keyMapper[Qt::Key_AE] = "ae"; + keyMapper[Qt::Key_Ccedilla] = "ccedilla"; + keyMapper[Qt::Key_Egrave] = "egrave"; + keyMapper[Qt::Key_Eacute] = "eacute"; + keyMapper[Qt::Key_Ecircumflex] = "ecircumflex"; + keyMapper[Qt::Key_Ediaeresis] = "ediaeresis"; + keyMapper[Qt::Key_Igrave] = "igrave"; + keyMapper[Qt::Key_Iacute] = "iacute"; + keyMapper[Qt::Key_Icircumflex] = "icircumflex"; + keyMapper[Qt::Key_Idiaeresis] = "idiaeresis"; + keyMapper[Qt::Key_ETH] = "eth"; + keyMapper[Qt::Key_Ntilde] = "ntilde"; + keyMapper[Qt::Key_Ograve] = "ograve"; + keyMapper[Qt::Key_Oacute] = "oacute"; + keyMapper[Qt::Key_Ocircumflex] = "ocircumflex"; + keyMapper[Qt::Key_Otilde] = "otilde"; + keyMapper[Qt::Key_Odiaeresis] = "odiaeresis"; + keyMapper[Qt::Key_multiply] = "multiply"; + keyMapper[Qt::Key_Ooblique] = "ooblique"; + keyMapper[Qt::Key_Ugrave] = "ugrave"; + keyMapper[Qt::Key_Uacute] = "uacute"; + keyMapper[Qt::Key_Ucircumflex] = "ucircumflex"; + keyMapper[Qt::Key_Udiaeresis] = "udiaeresis"; + keyMapper[Qt::Key_Yacute] = "yacute"; + keyMapper[Qt::Key_THORN] = "thorn"; + keyMapper[Qt::Key_ssharp] = "ssharp"; + keyMapper[Qt::Key_division] = "division"; + keyMapper[Qt::Key_ydiaeresis] = "ydiaeresis"; - return keyMapper; - } - - std::string qKeyToKeyString (int key) - { - static const QMap keyMapper = makeKeyMapper (); - - return keyMapper.value (key, ""); - } + return keyMapper; } + std::string qKeyToKeyString (int key) + { + static const QMap keyMapper = makeKeyMapper (); + + return keyMapper.value (key, ""); + } +} + OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/KeyMap.h --- a/libgui/graphics/KeyMap.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/graphics/KeyMap.h Tue Dec 06 15:45:27 2022 -0500 @@ -30,10 +30,10 @@ OCTAVE_BEGIN_NAMESPACE(octave) - namespace KeyMap - { - std::string qKeyToKeyString (int key); - } +namespace KeyMap +{ + std::string qKeyToKeyString (int key); +} OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/ListBoxControl.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/ListBoxControl.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/Logger.cc --- a/libgui/graphics/Logger.cc Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/graphics/Logger.cc Tue Dec 06 15:45:27 2022 -0500 @@ -37,53 +37,53 @@ OCTAVE_BEGIN_NAMESPACE(octave) - Logger *Logger::s_instance = nullptr; - QMutex *Logger::s_mutex = nullptr; +Logger *Logger::s_instance = nullptr; +QMutex *Logger::s_mutex = nullptr; + +Logger::Logger (void) + : m_debugEnabled (false) +{ + QProcessEnvironment pe (QProcessEnvironment::systemEnvironment ()); + + if (pe.value ("QTHANDLES_DEBUG", "0") != "0") + m_debugEnabled = true; +} + +Logger::~Logger (void) +{ } - Logger::Logger (void) - : m_debugEnabled (false) - { - QProcessEnvironment pe (QProcessEnvironment::systemEnvironment ()); +Logger * +Logger::instance (void) +{ + if (! s_instance) + { + s_instance = new Logger (); + s_mutex = new QMutex (); + } - if (pe.value ("QTHANDLES_DEBUG", "0") != "0") - m_debugEnabled = true; + return s_instance; +} + +#define STATIC_LOGGER(fcn) \ + void Logger::fcn (const char *fmt, ...) \ + { \ + QMutexLocker lock (s_mutex); \ + va_list vl; \ + va_start (vl, fmt); \ + instance ()->fcn ## V (fmt, vl); \ + va_end (vl); \ } - Logger::~Logger (void) - { } - - Logger * - Logger::instance (void) - { - if (! s_instance) - { - s_instance = new Logger (); - s_mutex = new QMutex (); - } - - return s_instance; - } +STATIC_LOGGER (debug) -#define STATIC_LOGGER(fcn) \ - void Logger::fcn (const char *fmt, ...) \ - { \ - QMutexLocker lock (s_mutex); \ - va_list vl; \ - va_start (vl, fmt); \ - instance ()->fcn ## V (fmt, vl); \ - va_end (vl); \ - } - - STATIC_LOGGER (debug) - - void - Logger::debugV (const char *fmt, va_list arg) - { - if (m_debugEnabled) - { - vfprintf (stderr, fmt, arg); - fprintf (stderr, "\n"); - } - } +void +Logger::debugV (const char *fmt, va_list arg) +{ + if (m_debugEnabled) + { + vfprintf (stderr, fmt, arg); + fprintf (stderr, "\n"); + } +} OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/Logger.h --- a/libgui/graphics/Logger.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/graphics/Logger.h Tue Dec 06 15:45:27 2022 -0500 @@ -32,25 +32,25 @@ OCTAVE_BEGIN_NAMESPACE(octave) - class Logger - { - public: - static void debug (const char *fmt, ...); +class Logger +{ +public: + static void debug (const char *fmt, ...); - private: - bool m_debugEnabled; +private: + bool m_debugEnabled; - static Logger *s_instance; - static QMutex *s_mutex; + static Logger *s_instance; + static QMutex *s_mutex; - private: - Logger (void); - ~Logger (void); +private: + Logger (void); + ~Logger (void); - static Logger * instance (void); + static Logger * instance (void); - void debugV (const char *fmt, va_list arg); - }; + void debugV (const char *fmt, va_list arg); +}; OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/Menu.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/Menu.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/MenuContainer.h --- a/libgui/graphics/MenuContainer.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/graphics/MenuContainer.h Tue Dec 06 15:45:27 2022 -0500 @@ -30,11 +30,11 @@ OCTAVE_BEGIN_NAMESPACE(octave) - class MenuContainer - { - public: - virtual QWidget * menu (void) = 0; - }; +class MenuContainer +{ +public: + virtual QWidget * menu (void) = 0; +}; OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/Object.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/Object.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/ObjectProxy.cc --- a/libgui/graphics/ObjectProxy.cc Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/graphics/ObjectProxy.cc Tue Dec 06 15:45:27 2022 -0500 @@ -39,123 +39,123 @@ OCTAVE_BEGIN_NAMESPACE(octave) - ObjectProxy::ObjectProxy (Object *obj) - : QObject (), m_object (nullptr) - { - init (obj); - } +ObjectProxy::ObjectProxy (Object *obj) +: QObject (), m_object (nullptr) +{ + init (obj); +} - void - ObjectProxy::init (Object *obj) - { - if (obj != m_object) - { - if (m_object) - { - disconnect (this, &ObjectProxy::sendUpdate, - m_object, &Object::slotUpdate); - disconnect (this, &ObjectProxy::sendRedraw, - m_object, &Object::slotRedraw); - disconnect (this, &ObjectProxy::sendShow, - m_object, &Object::slotShow); - } +void +ObjectProxy::init (Object *obj) +{ + if (obj != m_object) + { + if (m_object) + { + disconnect (this, &ObjectProxy::sendUpdate, + m_object, &Object::slotUpdate); + disconnect (this, &ObjectProxy::sendRedraw, + m_object, &Object::slotRedraw); + disconnect (this, &ObjectProxy::sendShow, + m_object, &Object::slotShow); + } - m_object = obj; + m_object = obj; - if (m_object) - { - connect (this, &ObjectProxy::sendUpdate, - m_object, &Object::slotUpdate); - connect (this, &ObjectProxy::sendRedraw, - m_object, &Object::slotRedraw); - connect (this, &ObjectProxy::sendShow, - m_object, &Object::slotShow); - } - } - } + if (m_object) + { + connect (this, &ObjectProxy::sendUpdate, + m_object, &Object::slotUpdate); + connect (this, &ObjectProxy::sendRedraw, + m_object, &Object::slotRedraw); + connect (this, &ObjectProxy::sendShow, + m_object, &Object::slotShow); + } + } +} - void - ObjectProxy::setObject (Object *obj) - { - // Eventually destroy previous Object - if (m_object) - finalize (); +void +ObjectProxy::setObject (Object *obj) +{ + // Eventually destroy previous Object + if (m_object) + finalize (); - init (obj); - } + init (obj); +} - void - ObjectProxy::update (int pId) - { - emit sendUpdate (pId); - } +void +ObjectProxy::update (int pId) +{ + emit sendUpdate (pId); +} - void - ObjectProxy::finalize (void) - { - if (! m_object) - error ("ObjectProxy::finalize: invalid GUI Object"); +void +ObjectProxy::finalize (void) +{ + if (! m_object) + error ("ObjectProxy::finalize: invalid GUI Object"); - Qt::ConnectionType t = Qt::BlockingQueuedConnection; + Qt::ConnectionType t = Qt::BlockingQueuedConnection; - if (QThread::currentThread () == QCoreApplication::instance ()->thread ()) - t = Qt::DirectConnection; + if (QThread::currentThread () == QCoreApplication::instance ()->thread ()) + t = Qt::DirectConnection; - if (! QMetaObject::invokeMethod (m_object, "slotFinalize", t)) - error ("ObjectProxy::finalize: unable to delete GUI Object"); - } + if (! QMetaObject::invokeMethod (m_object, "slotFinalize", t)) + error ("ObjectProxy::finalize: unable to delete GUI Object"); +} - void - ObjectProxy::redraw (void) - { - emit sendRedraw (); - } +void +ObjectProxy::redraw (void) +{ + emit sendRedraw (); +} - void - ObjectProxy::show (void) - { - emit sendShow (); - } +void +ObjectProxy::show (void) +{ + emit sendShow (); +} - void - ObjectProxy::print (const QString& file_cmd, const QString& term) - { - if (! m_object) - error ("ObjectProxy::print: invalid GUI Object"); +void +ObjectProxy::print (const QString& file_cmd, const QString& term) +{ + if (! m_object) + error ("ObjectProxy::print: invalid GUI Object"); - Qt::ConnectionType t = Qt::BlockingQueuedConnection; + Qt::ConnectionType t = Qt::BlockingQueuedConnection; - if (QThread::currentThread () == QCoreApplication::instance ()->thread ()) - t = Qt::DirectConnection; + if (QThread::currentThread () == QCoreApplication::instance ()->thread ()) + t = Qt::DirectConnection; - if (! QMetaObject::invokeMethod (m_object, "slotPrint", t, - Q_ARG (QString, file_cmd), - Q_ARG (QString, term))) - error ("ObjectProxy::print: unable to print figure"); - } + if (! QMetaObject::invokeMethod (m_object, "slotPrint", t, + Q_ARG (QString, file_cmd), + Q_ARG (QString, term))) + error ("ObjectProxy::print: unable to print figure"); +} - uint8NDArray - ObjectProxy::get_pixels (void) - { - if (! m_object) - error ("ObjectProxy::finalize: invalid GUI Object"); +uint8NDArray +ObjectProxy::get_pixels (void) +{ + if (! m_object) + error ("ObjectProxy::finalize: invalid GUI Object"); - uint8NDArray retval; + uint8NDArray retval; - // The ObjectProxy is generally ran from the interpreter thread - // while the actual Figure (Object) lives in the gui thread. The - // following ensures synchronous execution of the Figure method and - // allows retrieving a return value. + // The ObjectProxy is generally ran from the interpreter thread + // while the actual Figure (Object) lives in the gui thread. The + // following ensures synchronous execution of the Figure method and + // allows retrieving a return value. - Qt::ConnectionType t = Qt::BlockingQueuedConnection; + Qt::ConnectionType t = Qt::BlockingQueuedConnection; - if (QThread::currentThread () == QCoreApplication::instance ()->thread ()) - t = Qt::DirectConnection; + if (QThread::currentThread () == QCoreApplication::instance ()->thread ()) + t = Qt::DirectConnection; - QMetaObject::invokeMethod (m_object, "slotGetPixels", t, - Q_RETURN_ARG (uint8NDArray, retval)); + QMetaObject::invokeMethod (m_object, "slotGetPixels", t, + Q_RETURN_ARG (uint8NDArray, retval)); - return retval; - } + return retval; +} OCTAVE_END_NAMESPACE(octave); diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/ObjectProxy.h --- a/libgui/graphics/ObjectProxy.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/graphics/ObjectProxy.h Tue Dec 06 15:45:27 2022 -0500 @@ -34,36 +34,36 @@ OCTAVE_BEGIN_NAMESPACE(octave) - class Object; +class Object; - class ObjectProxy : public QObject - { - Q_OBJECT +class ObjectProxy : public QObject +{ + Q_OBJECT - public: - ObjectProxy (Object *obj = nullptr); +public: + ObjectProxy (Object *obj = nullptr); - void update (int pId); - void finalize (void); - void redraw (void); - void show (void); - void print (const QString& file_cmd, const QString& term); - uint8NDArray get_pixels (void); + void update (int pId); + void finalize (void); + void redraw (void); + void show (void); + void print (const QString& file_cmd, const QString& term); + uint8NDArray get_pixels (void); - Object * object (void) { return m_object; } - void setObject (Object *obj); + Object * object (void) { return m_object; } + void setObject (Object *obj); - signals: - void sendUpdate (int pId); - void sendRedraw (void); - void sendShow (void); +signals: + void sendUpdate (int pId); + void sendRedraw (void); + void sendShow (void); - private: - void init (Object *obj); +private: + void init (Object *obj); - private: - Object *m_object; - }; +private: + Object *m_object; +}; OCTAVE_END_NAMESPACE(octave); diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/Panel.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/Panel.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/PopupMenuControl.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/PopupMenuControl.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/PushButtonControl.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/PushButtonControl.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/PushTool.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/PushTool.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/QtHandlesUtils.cc --- a/libgui/graphics/QtHandlesUtils.cc Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/graphics/QtHandlesUtils.cc Tue Dec 06 15:45:27 2022 -0500 @@ -46,376 +46,376 @@ OCTAVE_BEGIN_NAMESPACE(octave) - namespace Utils - { +namespace Utils +{ - QString - fromStdString (const std::string& s) - { - return QString::fromUtf8 (s.c_str ()); - } + QString + fromStdString (const std::string& s) + { + return QString::fromUtf8 (s.c_str ()); + } - std::string - toStdString (const QString& s) - { - return std::string (s.toUtf8 ().data ()); - } + std::string + toStdString (const QString& s) + { + return std::string (s.toUtf8 ().data ()); + } - QStringList - fromStringVector (const string_vector& v) - { - QStringList l; - octave_idx_type n = v.numel (); + QStringList + fromStringVector (const string_vector& v) + { + QStringList l; + octave_idx_type n = v.numel (); - for (octave_idx_type i = 0; i < n; i++) - l << fromStdString (v[i]); + for (octave_idx_type i = 0; i < n; i++) + l << fromStdString (v[i]); - return l; - } + return l; + } - string_vector - toStringVector (const QStringList& l) - { - string_vector v (l.length ()); - int i = 0; + string_vector + toStringVector (const QStringList& l) + { + string_vector v (l.length ()); + int i = 0; - for (const auto& s : l) - v[i++] = toStdString (s); + for (const auto& s : l) + v[i++] = toStdString (s); - return v; - } + return v; + } - Cell toCellString (const QStringList& l) - { - QStringList tmp = l; + Cell toCellString (const QStringList& l) + { + QStringList tmp = l; - // don't get any empty lines from end of the list - while ((tmp.length () > 0) && tmp.last ().isEmpty ()) - { - tmp.removeLast (); - } - // no strings converts to a 1x1 cell with empty string - if (tmp.isEmpty ()) - tmp += ""; + // don't get any empty lines from end of the list + while ((tmp.length () > 0) && tmp.last ().isEmpty ()) + { + tmp.removeLast (); + } + // no strings converts to a 1x1 cell with empty string + if (tmp.isEmpty ()) + tmp += ""; - Cell v (toStringVector (tmp)); - return v; - } + Cell v (toStringVector (tmp)); + return v; + } - template - QFont - computeFont (const typename T::properties& props, int height) - { - QFont f (fromStdString (props.get_fontname ())); - - static std::map weightMap; - static std::map angleMap; - static bool mapsInitialized = false; + template + QFont + computeFont (const typename T::properties& props, int height) + { + QFont f (fromStdString (props.get_fontname ())); - if (! mapsInitialized) - { - weightMap["normal"] = QFont::Normal; - weightMap["bold"] = QFont::Bold; + static std::map weightMap; + static std::map angleMap; + static bool mapsInitialized = false; - angleMap["normal"] = QFont::StyleNormal; - angleMap["italic"] = QFont::StyleItalic; - angleMap["oblique"] = QFont::StyleOblique; - - mapsInitialized = true; - } + if (! mapsInitialized) + { + weightMap["normal"] = QFont::Normal; + weightMap["bold"] = QFont::Bold; - f.setPointSizeF (props.get___fontsize_points__ (height)); - f.setWeight (weightMap[props.get_fontweight ()]); - f.setStyle (angleMap[props.get_fontangle ()]); + angleMap["normal"] = QFont::StyleNormal; + angleMap["italic"] = QFont::StyleItalic; + angleMap["oblique"] = QFont::StyleOblique; - return f; - } + mapsInitialized = true; + } - template QFont computeFont (const uicontrol::properties& props, - int height); - - template QFont computeFont (const uipanel::properties& props, - int height); + f.setPointSizeF (props.get___fontsize_points__ (height)); + f.setWeight (weightMap[props.get_fontweight ()]); + f.setStyle (angleMap[props.get_fontangle ()]); - template QFont computeFont (const uibuttongroup::properties& - props, - int height); + return f; + } - template QFont computeFont (const uitable::properties& props, + template QFont computeFont (const uicontrol::properties& props, int height); - QColor - fromRgb (const Matrix& rgb) - { - QColor c; + template QFont computeFont (const uipanel::properties& props, + int height); - if (rgb.numel () == 3) - c.setRgbF (rgb(0), rgb(1), rgb(2)); + template QFont computeFont (const uibuttongroup::properties& + props, + int height); - return c; - } + template QFont computeFont (const uitable::properties& props, + int height); - Matrix - toRgb (const QColor& c) - { - Matrix rgb (1, 3); - double *rgbData = rgb.fortran_vec (); + QColor + fromRgb (const Matrix& rgb) + { + QColor c; - // qreal is a typedef for double except for ARM CPU architectures - // where it is a typedef for float (Bug #44970). - qreal tmp[3]; - c.getRgbF (tmp, tmp+1, tmp+2); - rgbData[0] = tmp[0]; rgbData[1] = tmp[1]; rgbData[2] = tmp[2]; + if (rgb.numel () == 3) + c.setRgbF (rgb(0), rgb(1), rgb(2)); - return rgb; - } + return c; + } - std::string - figureSelectionType (QMouseEvent *event, bool isDoubleClick) - { - if (isDoubleClick) - return "open"; - else - { - Qt::MouseButtons buttons = event->buttons (); - Qt::KeyboardModifiers mods = event->modifiers (); + Matrix + toRgb (const QColor& c) + { + Matrix rgb (1, 3); + double *rgbData = rgb.fortran_vec (); + + // qreal is a typedef for double except for ARM CPU architectures + // where it is a typedef for float (Bug #44970). + qreal tmp[3]; + c.getRgbF (tmp, tmp+1, tmp+2); + rgbData[0] = tmp[0]; rgbData[1] = tmp[1]; rgbData[2] = tmp[2]; - if (mods == Qt::NoModifier) - { - if (buttons == Qt::LeftButton) - return "normal"; - else if (buttons == Qt::RightButton) - return "alt"; - else if (buttons == Qt::MiddleButton - || buttons == (Qt::LeftButton | Qt::RightButton)) - return "extend"; - } - else if (buttons == Qt::LeftButton) - { - if (mods == Qt::ShiftModifier) - return "extend"; - else if (mods == Qt::ControlModifier) - return "alt"; - } - } + return rgb; + } - return "normal"; - } + std::string + figureSelectionType (QMouseEvent *event, bool isDoubleClick) + { + if (isDoubleClick) + return "open"; + else + { + Qt::MouseButtons buttons = event->buttons (); + Qt::KeyboardModifiers mods = event->modifiers (); - /* - Two figureCurrentPoint() routines are required: - 1) Used for QMouseEvents where cursor position data is in callback from Qt. - 2) Used for QKeyEvents where cursor position must be determined. - */ - Matrix - figureCurrentPoint (const graphics_object& fig, QMouseEvent *event) - { - Object *tkFig = qt_graphics_toolkit::toolkitObject (fig); - - if (tkFig) - { - Container *c = tkFig->innerContainer (); + if (mods == Qt::NoModifier) + { + if (buttons == Qt::LeftButton) + return "normal"; + else if (buttons == Qt::RightButton) + return "alt"; + else if (buttons == Qt::MiddleButton + || buttons == (Qt::LeftButton | Qt::RightButton)) + return "extend"; + } + else if (buttons == Qt::LeftButton) + { + if (mods == Qt::ShiftModifier) + return "extend"; + else if (mods == Qt::ControlModifier) + return "alt"; + } + } - if (c) - { - QPoint qp = c->mapFromGlobal (event->globalPos ()); + return "normal"; + } - return tkFig->properties
().map_from_boundingbox (qp.x (), - qp.y ()); - } - } + /* + Two figureCurrentPoint() routines are required: + 1) Used for QMouseEvents where cursor position data is in callback from Qt. + 2) Used for QKeyEvents where cursor position must be determined. + */ + Matrix + figureCurrentPoint (const graphics_object& fig, QMouseEvent *event) + { + Object *tkFig = qt_graphics_toolkit::toolkitObject (fig); - return Matrix (1, 2, 0.0); - } - - Matrix - figureCurrentPoint (const graphics_object& fig) - { - Object *tkFig = qt_graphics_toolkit::toolkitObject (fig); + if (tkFig) + { + Container *c = tkFig->innerContainer (); - if (tkFig) - { - Container *c = tkFig->innerContainer (); + if (c) + { + QPoint qp = c->mapFromGlobal (event->globalPos ()); - if (c) - { - // FIXME: QCursor::pos() may give inaccurate results with - // asynchronous window systems like X11 over ssh. - QPoint qp = c->mapFromGlobal (QCursor::pos ()); + return tkFig->properties
().map_from_boundingbox (qp.x (), + qp.y ()); + } + } - return tkFig->properties
().map_from_boundingbox (qp.x (), - qp.y ()); - } - } + return Matrix (1, 2, 0.0); + } + + Matrix + figureCurrentPoint (const graphics_object& fig) + { + Object *tkFig = qt_graphics_toolkit::toolkitObject (fig); - return Matrix (1, 2, 0.0); - } + if (tkFig) + { + Container *c = tkFig->innerContainer (); - Qt::Alignment - fromHVAlign (const std::string& halign, const std::string& valign) - { - Qt::Alignment flags; + if (c) + { + // FIXME: QCursor::pos() may give inaccurate results with + // asynchronous window systems like X11 over ssh. + QPoint qp = c->mapFromGlobal (QCursor::pos ()); - if (octave::string::strcmpi (halign, "left")) - flags |= Qt::AlignLeft; - else if (octave::string::strcmpi (halign, "center")) - flags |= Qt::AlignHCenter; - else if (octave::string::strcmpi (halign, "right")) - flags |= Qt::AlignRight; - else - flags |= Qt::AlignLeft; + return tkFig->properties
().map_from_boundingbox (qp.x (), + qp.y ()); + } + } + + return Matrix (1, 2, 0.0); + } + + Qt::Alignment + fromHVAlign (const std::string& halign, const std::string& valign) + { + Qt::Alignment flags; - if (octave::string::strcmpi (valign, "middle")) - flags |= Qt::AlignVCenter; - else if (octave::string::strcmpi (valign, "top")) - flags |= Qt::AlignTop; - else if (octave::string::strcmpi (valign, "bottom")) - flags |= Qt::AlignBottom; - else - flags |= Qt::AlignVCenter; + if (octave::string::strcmpi (halign, "left")) + flags |= Qt::AlignLeft; + else if (octave::string::strcmpi (halign, "center")) + flags |= Qt::AlignHCenter; + else if (octave::string::strcmpi (halign, "right")) + flags |= Qt::AlignRight; + else + flags |= Qt::AlignLeft; - return flags; - } + if (octave::string::strcmpi (valign, "middle")) + flags |= Qt::AlignVCenter; + else if (octave::string::strcmpi (valign, "top")) + flags |= Qt::AlignTop; + else if (octave::string::strcmpi (valign, "bottom")) + flags |= Qt::AlignBottom; + else + flags |= Qt::AlignVCenter; - QImage - makeImageFromCData (const octave_value& v, int width, int height) - { - dim_vector dv (v.dims ()); + return flags; + } - if (dv.ndims () == 3 && dv(2) == 3) - { - int w = qMin (dv(1), static_cast (width)); - int h = qMin (dv(0), static_cast (height)); + QImage + makeImageFromCData (const octave_value& v, int width, int height) + { + dim_vector dv (v.dims ()); + + if (dv.ndims () == 3 && dv(2) == 3) + { + int w = qMin (dv(1), static_cast (width)); + int h = qMin (dv(0), static_cast (height)); - // If size mismatch, take data from center of CDATA and - // place in in center of QImage. - int x_img_off = (w < width ? (width - w) / 2 : 0); - int y_img_off = (h < height ? (height - h) / 2 : 0); - int x_cdat_off = (dv(1) > w ? (dv(1) - w) / 2 : 0); - int y_cdat_off = (dv(0) > h ? (dv(0) - h) / 2 : 0); + // If size mismatch, take data from center of CDATA and + // place in in center of QImage. + int x_img_off = (w < width ? (width - w) / 2 : 0); + int y_img_off = (h < height ? (height - h) / 2 : 0); + int x_cdat_off = (dv(1) > w ? (dv(1) - w) / 2 : 0); + int y_cdat_off = (dv(0) > h ? (dv(0) - h) / 2 : 0); - QImage img (width, height, QImage::Format_ARGB32); - img.fill (qRgba (0, 0, 0, 0)); + QImage img (width, height, QImage::Format_ARGB32); + img.fill (qRgba (0, 0, 0, 0)); - if (v.is_uint8_type ()) - { - uint8NDArray d = v.uint8_array_value (); + if (v.is_uint8_type ()) + { + uint8NDArray d = v.uint8_array_value (); - for (int i = x_cdat_off; i < w + x_cdat_off; i++) - for (int j = y_cdat_off; j < h + y_cdat_off; j++) - { - int r = d(j, i, 0); - int g = d(j, i, 1); - int b = d(j, i, 2); - int a = 255; + for (int i = x_cdat_off; i < w + x_cdat_off; i++) + for (int j = y_cdat_off; j < h + y_cdat_off; j++) + { + int r = d(j, i, 0); + int g = d(j, i, 1); + int b = d(j, i, 2); + int a = 255; - img.setPixel (x_img_off + i - x_cdat_off, - y_img_off + j - y_cdat_off, - qRgba (r, g, b, a)); - } - } - else if (v.is_single_type ()) - { - FloatNDArray f = v.float_array_value (); + img.setPixel (x_img_off + i - x_cdat_off, + y_img_off + j - y_cdat_off, + qRgba (r, g, b, a)); + } + } + else if (v.is_single_type ()) + { + FloatNDArray f = v.float_array_value (); - for (int i = x_cdat_off; i < w + x_cdat_off; i++) - for (int j = y_cdat_off; j < h + y_cdat_off; j++) - { - float r = f(j, i, 0); - float g = f(j, i, 1); - float b = f(j, i, 2); - int a = (octave::math::isnan (r) || octave::math::isnan (g) - || octave::math::isnan (b) ? 0 : 255); + for (int i = x_cdat_off; i < w + x_cdat_off; i++) + for (int j = y_cdat_off; j < h + y_cdat_off; j++) + { + float r = f(j, i, 0); + float g = f(j, i, 1); + float b = f(j, i, 2); + int a = (octave::math::isnan (r) || octave::math::isnan (g) + || octave::math::isnan (b) ? 0 : 255); - img.setPixel (x_img_off + i - x_cdat_off, - y_img_off + j - y_cdat_off, - qRgba (octave::math::round (r * 255), - octave::math::round (g * 255), - octave::math::round (b * 255), - a)); - } - } - else if (v.isreal ()) - { - NDArray d = v.array_value (); + img.setPixel (x_img_off + i - x_cdat_off, + y_img_off + j - y_cdat_off, + qRgba (octave::math::round (r * 255), + octave::math::round (g * 255), + octave::math::round (b * 255), + a)); + } + } + else if (v.isreal ()) + { + NDArray d = v.array_value (); - for (int i = x_cdat_off; i < w + x_cdat_off; i++) - for (int j = y_cdat_off; j < h + y_cdat_off; j++) - { - double r = d(j, i, 0); - double g = d(j, i, 1); - double b = d(j, i, 2); - int a = (octave::math::isnan (r) || octave::math::isnan (g) - || octave::math::isnan (b) ? 0 : 255); + for (int i = x_cdat_off; i < w + x_cdat_off; i++) + for (int j = y_cdat_off; j < h + y_cdat_off; j++) + { + double r = d(j, i, 0); + double g = d(j, i, 1); + double b = d(j, i, 2); + int a = (octave::math::isnan (r) || octave::math::isnan (g) + || octave::math::isnan (b) ? 0 : 255); - img.setPixel (x_img_off + i - x_cdat_off, - y_img_off + j - y_cdat_off, - qRgba (octave::math::round (r * 255), - octave::math::round (g * 255), - octave::math::round (b * 255), - a)); - } - } + img.setPixel (x_img_off + i - x_cdat_off, + y_img_off + j - y_cdat_off, + qRgba (octave::math::round (r * 255), + octave::math::round (g * 255), + octave::math::round (b * 255), + a)); + } + } - return img; - } + return img; + } - return QImage (); - } + return QImage (); + } - octave_scalar_map - makeKeyEventStruct (QKeyEvent *event) - { - octave_scalar_map retval; + octave_scalar_map + makeKeyEventStruct (QKeyEvent *event) + { + octave_scalar_map retval; - retval.setfield ("Key", KeyMap::qKeyToKeyString (event->key ())); - retval.setfield ("Character", toStdString (event->text ())); + retval.setfield ("Key", KeyMap::qKeyToKeyString (event->key ())); + retval.setfield ("Character", toStdString (event->text ())); - std::list modList; - Qt::KeyboardModifiers mods = event->modifiers (); + std::list modList; + Qt::KeyboardModifiers mods = event->modifiers (); - if (mods & Qt::ShiftModifier) - modList.push_back ("shift"); - if (mods & Qt::ControlModifier) + if (mods & Qt::ShiftModifier) + modList.push_back ("shift"); + if (mods & Qt::ControlModifier) #if defined (Q_OS_MAC) - modList.push_back ("command"); + modList.push_back ("command"); #else - modList.push_back ("control"); + modList.push_back ("control"); #endif - if (mods & Qt::AltModifier) - modList.push_back ("alt"); + if (mods & Qt::AltModifier) + modList.push_back ("alt"); #if defined (Q_OS_MAC) - if (mods & Qt::MetaModifier) - modList.push_back ("control"); + if (mods & Qt::MetaModifier) + modList.push_back ("control"); #endif - retval.setfield ("Modifier", Cell (modList)); - - return retval; - } - - octave_scalar_map - makeScrollEventStruct (QWheelEvent *event) - { - octave_scalar_map retval; + retval.setfield ("Modifier", Cell (modList)); - // We assume a standard mouse with 15 degree steps and Qt returns - // 1/8 of a degree. -#if defined (HAVE_QWHEELEVENT_ANGLEDELTA) - int ydelta = -(event->angleDelta().y ()); -#else - int ydelta = -(event->delta ()); -#endif - retval.setfield ("VerticalScrollCount", octave_value (ydelta / 120)); - - // FIXME: Is there any way to access the number of lines a scroll step - // should correspond to? - retval.setfield ("VerticalScrollAmount", octave_value (3)); - retval.setfield ("EventName", octave_value ("WindowScrollWheel")); - - return retval; - } - + return retval; } + octave_scalar_map + makeScrollEventStruct (QWheelEvent *event) + { + octave_scalar_map retval; + + // We assume a standard mouse with 15 degree steps and Qt returns + // 1/8 of a degree. +#if defined (HAVE_QWHEELEVENT_ANGLEDELTA) + int ydelta = -(event->angleDelta().y ()); +#else + int ydelta = -(event->delta ()); +#endif + retval.setfield ("VerticalScrollCount", octave_value (ydelta / 120)); + + // FIXME: Is there any way to access the number of lines a scroll step + // should correspond to? + retval.setfield ("VerticalScrollAmount", octave_value (3)); + retval.setfield ("EventName", octave_value ("WindowScrollWheel")); + + return retval; + } + +} + OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/QtHandlesUtils.h --- a/libgui/graphics/QtHandlesUtils.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/graphics/QtHandlesUtils.h Tue Dec 06 15:45:27 2022 -0500 @@ -42,42 +42,42 @@ OCTAVE_BEGIN_NAMESPACE(octave) - namespace Utils - { - QString fromStdString (const std::string& s); - std::string toStdString (const QString& s); +namespace Utils +{ + QString fromStdString (const std::string& s); + std::string toStdString (const QString& s); - QStringList fromStringVector (const string_vector& v); - string_vector toStringVector (const QStringList& l); + QStringList fromStringVector (const string_vector& v); + string_vector toStringVector (const QStringList& l); - Cell toCellString (const QStringList& l); + Cell toCellString (const QStringList& l); - template - QFont computeFont (const typename T::properties& props, int height = -1); + template + QFont computeFont (const typename T::properties& props, int height = -1); - QColor fromRgb (const Matrix& rgb); - Matrix toRgb (const QColor& c); + QColor fromRgb (const Matrix& rgb); + Matrix toRgb (const QColor& c); - Qt::Alignment fromHVAlign (const std::string& halign, - const std::string& valign); + Qt::Alignment fromHVAlign (const std::string& halign, + const std::string& valign); - std::string figureSelectionType (QMouseEvent *event, - bool isDoubleClick = false); + std::string figureSelectionType (QMouseEvent *event, + bool isDoubleClick = false); - Matrix figureCurrentPoint (const graphics_object& fig, QMouseEvent *event); - Matrix figureCurrentPoint (const graphics_object& fig); + Matrix figureCurrentPoint (const graphics_object& fig, QMouseEvent *event); + Matrix figureCurrentPoint (const graphics_object& fig); - template - inline typename T::properties& - properties (graphics_object obj) - { return dynamic_cast (obj.get_properties ()); } + template + inline typename T::properties& + properties (graphics_object obj) + { return dynamic_cast (obj.get_properties ()); } - QImage makeImageFromCData (const octave_value& v, int width = -1, - int height = -1); + QImage makeImageFromCData (const octave_value& v, int width = -1, + int height = -1); - octave_scalar_map makeKeyEventStruct (QKeyEvent *event); - octave_scalar_map makeScrollEventStruct (QWheelEvent *event); - } + octave_scalar_map makeKeyEventStruct (QKeyEvent *event); + octave_scalar_map makeScrollEventStruct (QWheelEvent *event); +} OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/RadioButtonControl.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/RadioButtonControl.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/SliderControl.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/SliderControl.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/Table.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/Table.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/TextControl.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/TextControl.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/TextEdit.cc --- a/libgui/graphics/TextEdit.cc Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/graphics/TextEdit.cc Tue Dec 06 15:45:27 2022 -0500 @@ -33,23 +33,23 @@ OCTAVE_BEGIN_NAMESPACE(octave) - void - TextEdit::focusOutEvent (QFocusEvent *xevent) - { - QTextEdit::focusOutEvent (xevent); +void +TextEdit::focusOutEvent (QFocusEvent *xevent) +{ + QTextEdit::focusOutEvent (xevent); - emit editingFinished (); - } + emit editingFinished (); +} - void - TextEdit::keyPressEvent (QKeyEvent *xevent) - { - QTextEdit::keyPressEvent (xevent); +void +TextEdit::keyPressEvent (QKeyEvent *xevent) +{ + QTextEdit::keyPressEvent (xevent); - if ((xevent->key () == Qt::Key_Return - || xevent->key () == Qt::Key_Enter) - && xevent->modifiers () == Qt::ControlModifier) - emit returnPressed (); - } + if ((xevent->key () == Qt::Key_Return + || xevent->key () == Qt::Key_Enter) + && xevent->modifiers () == Qt::ControlModifier) + emit returnPressed (); +} OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/TextEdit.h --- a/libgui/graphics/TextEdit.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/graphics/TextEdit.h Tue Dec 06 15:45:27 2022 -0500 @@ -30,22 +30,22 @@ OCTAVE_BEGIN_NAMESPACE(octave) - class TextEdit : public QTextEdit - { - Q_OBJECT +class TextEdit : public QTextEdit +{ + Q_OBJECT - public: - TextEdit (QWidget *xparent) : QTextEdit (xparent) { } - ~TextEdit (void) = default; +public: + TextEdit (QWidget *xparent) : QTextEdit (xparent) { } + ~TextEdit (void) = default; - signals: - void editingFinished (void); - void returnPressed (void); +signals: + void editingFinished (void); + void returnPressed (void); - protected: - void focusOutEvent (QFocusEvent *event); - void keyPressEvent (QKeyEvent *event); - }; +protected: + void focusOutEvent (QFocusEvent *event); + void keyPressEvent (QKeyEvent *event); +}; OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/ToggleButtonControl.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/ToggleButtonControl.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/ToggleTool.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/ToggleTool.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/ToolBar.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/ToolBar.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/ToolBarButton.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/ToolBarButton.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/annotation-dialog.h diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/gl-select.cc --- a/libgui/graphics/gl-select.cc Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/graphics/gl-select.cc Tue Dec 06 15:45:27 2022 -0500 @@ -31,221 +31,221 @@ OCTAVE_BEGIN_NAMESPACE(octave) - void - opengl_selector::apply_pick_matrix (void) - { - GLdouble p_matrix[16]; +void +opengl_selector::apply_pick_matrix (void) +{ + GLdouble p_matrix[16]; - m_glfcns.glGetDoublev (GL_PROJECTION_MATRIX, p_matrix); - m_glfcns.glMatrixMode (GL_PROJECTION); - m_glfcns.glLoadIdentity (); + m_glfcns.glGetDoublev (GL_PROJECTION_MATRIX, p_matrix); + m_glfcns.glMatrixMode (GL_PROJECTION); + m_glfcns.glLoadIdentity (); - // The following block is equivalent to gluPickMatrix, but we avoid - // using glu functions so that we can call OpenGL functions through - // the QOpenGLFunctions class so that the OpenGL implementation may - // be selected dynamically. + // The following block is equivalent to gluPickMatrix, but we avoid + // using glu functions so that we can call OpenGL functions through + // the QOpenGLFunctions class so that the OpenGL implementation may + // be selected dynamically. - Matrix viewport = get_viewport_scaled (); + Matrix viewport = get_viewport_scaled (); - if (size > 0) - { - m_glfcns.glTranslatef ((viewport(2) - 2 * (xp - viewport(0))) / size, - (viewport(3) - 2 * (yp - viewport(1))) / size, 0); + if (size > 0) + { + m_glfcns.glTranslatef ((viewport(2) - 2 * (xp - viewport(0))) / size, + (viewport(3) - 2 * (yp - viewport(1))) / size, 0); - m_glfcns.glScalef (viewport(2) / size, viewport(3) / size, 1.0); - } + m_glfcns.glScalef (viewport(2) / size, viewport(3) / size, 1.0); + } - m_glfcns.glMultMatrixd (p_matrix); - m_glfcns.glMatrixMode (GL_MODELVIEW); - } + m_glfcns.glMultMatrixd (p_matrix); + m_glfcns.glMatrixMode (GL_MODELVIEW); +} - void - opengl_selector::setup_opengl_transformation (const axes::properties& props) - { - opengl_renderer::setup_opengl_transformation (props); - apply_pick_matrix (); - } +void +opengl_selector::setup_opengl_transformation (const axes::properties& props) +{ + opengl_renderer::setup_opengl_transformation (props); + apply_pick_matrix (); +} - void - opengl_selector::init_marker (const std::string& m, double sz, float width) - { - opengl_renderer::init_marker (m, sz, width); - apply_pick_matrix (); - } +void +opengl_selector::init_marker (const std::string& m, double sz, float width) +{ + opengl_renderer::init_marker (m, sz, width); + apply_pick_matrix (); +} # define BUFFER_SIZE 128 - graphics_object - opengl_selector::select (const graphics_object& ax, int x, int y, int flags) - { - m_glfcns.glEnable (GL_DEPTH_TEST); - m_glfcns.glDepthFunc (GL_LEQUAL); +graphics_object +opengl_selector::select (const graphics_object& ax, int x, int y, int flags) +{ + m_glfcns.glEnable (GL_DEPTH_TEST); + m_glfcns.glDepthFunc (GL_LEQUAL); - xp = x; - yp = y; + xp = x; + yp = y; - GLuint select_buffer[BUFFER_SIZE]; + GLuint select_buffer[BUFFER_SIZE]; - m_glfcns.glSelectBuffer (BUFFER_SIZE, select_buffer); - m_glfcns.glRenderMode (GL_SELECT); - m_glfcns.glInitNames (); + m_glfcns.glSelectBuffer (BUFFER_SIZE, select_buffer); + m_glfcns.glRenderMode (GL_SELECT); + m_glfcns.glInitNames (); - object_map.clear (); + object_map.clear (); - draw (ax); + draw (ax); - int hits = m_glfcns.glRenderMode (GL_RENDER); - graphics_object obj; + int hits = m_glfcns.glRenderMode (GL_RENDER); + graphics_object obj; - if (hits > 0) - { - GLuint current_minZ = 0xffffffff; - GLuint current_name = 0xffffffff; + if (hits > 0) + { + GLuint current_minZ = 0xffffffff; + GLuint current_name = 0xffffffff; - for (int i = 0, j = 0; i < hits && j < BUFFER_SIZE-3; i++) - { - GLuint n = select_buffer[j++], - minZ = select_buffer[j++]; + for (int i = 0, j = 0; i < hits && j < BUFFER_SIZE-3; i++) + { + GLuint n = select_buffer[j++], + minZ = select_buffer[j++]; - j++; // skip maxZ - if (((flags & select_last) == 0 && (minZ <= current_minZ)) - || ((flags & select_last) != 0 && (minZ >= current_minZ))) - { - bool candidate = true; - GLuint name = - select_buffer[std::min (j + n, GLuint (BUFFER_SIZE)) - 1]; + j++; // skip maxZ + if (((flags & select_last) == 0 && (minZ <= current_minZ)) + || ((flags & select_last) != 0 && (minZ >= current_minZ))) + { + bool candidate = true; + GLuint name = + select_buffer[std::min (j + n, GLuint (BUFFER_SIZE)) - 1]; - if ((flags & select_ignore_hittest) == 0) - { - graphics_object go = object_map[name]; + if ((flags & select_ignore_hittest) == 0) + { + graphics_object go = object_map[name]; - if (! go.get_properties ().is_hittest ()) - candidate = false; - } + if (! go.get_properties ().is_hittest ()) + candidate = false; + } - if (candidate) - { - current_minZ = minZ; - current_name = name; - } + if (candidate) + { + current_minZ = minZ; + current_name = name; + } - j += n; - } - else j += n; - } + } + else + j += n; + } - if (current_name != 0xffffffff) - obj = object_map[current_name]; - } - else if (hits < 0) - warning ("opengl_selector::select: selection buffer overflow"); + if (current_name != 0xffffffff) + obj = object_map[current_name]; + } + else if (hits < 0) + warning ("opengl_selector::select: selection buffer overflow"); - object_map.clear (); + object_map.clear (); - return obj; - } + return obj; +} - void - opengl_selector::draw (const graphics_object& go, bool toplevel) - { - GLuint name = object_map.size (); +void +opengl_selector::draw (const graphics_object& go, bool toplevel) +{ + GLuint name = object_map.size (); - object_map[name] = go; - m_glfcns.glPushName (name); - set_selecting (true); - opengl_renderer::draw (go, toplevel); - set_selecting (false); - m_glfcns.glPopName (); - } + object_map[name] = go; + m_glfcns.glPushName (name); + set_selecting (true); + opengl_renderer::draw (go, toplevel); + set_selecting (false); + m_glfcns.glPopName (); +} - void - opengl_selector::fake_text (double x, double y, double z, const Matrix& bbox, - bool use_scale) - { - ColumnVector xpos, xp1, xp2; +void +opengl_selector::fake_text (double x, double y, double z, const Matrix& bbox, + bool use_scale) +{ + ColumnVector xpos, xp1, xp2; - xpos = get_transform ().transform (x, y, z, use_scale); + xpos = get_transform ().transform (x, y, z, use_scale); - xp1 = xp2 = xpos; - xp1(0) += bbox(0); - xp1(1) -= bbox(1); - xp2(0) += (bbox(0) + bbox(2)); - xp2(1) -= (bbox(1) + bbox(3)); + xp1 = xp2 = xpos; + xp1(0) += bbox(0); + xp1(1) -= bbox(1); + xp2(0) += (bbox(0) + bbox(2)); + xp2(1) -= (bbox(1) + bbox(3)); - ColumnVector p1, p2, p3, p4; + ColumnVector p1, p2, p3, p4; - p1 = get_transform ().untransform (xp1(0), xp1(1), xp1(2), false); - p2 = get_transform ().untransform (xp2(0), xp1(1), xp1(2), false); - p3 = get_transform ().untransform (xp2(0), xp2(1), xp1(2), false); - p4 = get_transform ().untransform (xp1(0), xp2(1), xp1(2), false); + p1 = get_transform ().untransform (xp1(0), xp1(1), xp1(2), false); + p2 = get_transform ().untransform (xp2(0), xp1(1), xp1(2), false); + p3 = get_transform ().untransform (xp2(0), xp2(1), xp1(2), false); + p4 = get_transform ().untransform (xp1(0), xp2(1), xp1(2), false); - m_glfcns.glBegin (GL_QUADS); - m_glfcns.glVertex3dv (p1.data ()); - m_glfcns.glVertex3dv (p2.data ()); - m_glfcns.glVertex3dv (p3.data ()); - m_glfcns.glVertex3dv (p4.data ()); - m_glfcns.glEnd (); - } + m_glfcns.glBegin (GL_QUADS); + m_glfcns.glVertex3dv (p1.data ()); + m_glfcns.glVertex3dv (p2.data ()); + m_glfcns.glVertex3dv (p3.data ()); + m_glfcns.glVertex3dv (p4.data ()); + m_glfcns.glEnd (); +} - void - opengl_selector::draw_text (const text::properties& props) - { - if (props.get_string ().isempty ()) - return; +void +opengl_selector::draw_text (const text::properties& props) +{ + if (props.get_string ().isempty ()) + return; - Matrix pos = props.get_data_position (); - const Matrix bbox = props.get_extent_matrix (); + Matrix pos = props.get_data_position (); + const Matrix bbox = props.get_extent_matrix (); - fake_text (pos(0), pos(1), pos.numel () > 2 ? pos(2) : 0.0, bbox); - } + fake_text (pos(0), pos(1), pos.numel () > 2 ? pos(2) : 0.0, bbox); +} - Matrix - opengl_selector::render_text (const std::string& txt, - double x, double y, double z, - int halign, int valign, double rotation) - { - uint8NDArray pixels; - Matrix bbox (1, 4, 0.0); +Matrix +opengl_selector::render_text (const std::string& txt, + double x, double y, double z, + int halign, int valign, double rotation) +{ + uint8NDArray pixels; + Matrix bbox (1, 4, 0.0); - // FIXME: probably more efficient to only compute bbox instead - // of doing full text rendering... - text_to_pixels (txt, pixels, bbox, halign, valign, rotation); - fake_text (x, y, z, bbox, false); + // FIXME: probably more efficient to only compute bbox instead + // of doing full text rendering... + text_to_pixels (txt, pixels, bbox, halign, valign, rotation); + fake_text (x, y, z, bbox, false); - return bbox; - } + return bbox; +} - void - opengl_selector::draw_image (const image::properties& props) - { - Matrix xd = props.get_xdata ().matrix_value (); - octave_idx_type nc = props.get_cdata ().columns (); - double x_pix_size = (nc == 1 ? 1 : (xd(1) - xd(0)) / (nc - 1)); +void +opengl_selector::draw_image (const image::properties& props) +{ + Matrix xd = props.get_xdata ().matrix_value (); + octave_idx_type nc = props.get_cdata ().columns (); + double x_pix_size = (nc == 1 ? 1 : (xd(1) - xd(0)) / (nc - 1)); - Matrix yd = props.get_ydata ().matrix_value (); - octave_idx_type nr = props.get_cdata ().rows (); - double y_pix_size = (nr == 1 ? 1 : (yd(1) - yd(0)) / (nr - 1)); + Matrix yd = props.get_ydata ().matrix_value (); + octave_idx_type nr = props.get_cdata ().rows (); + double y_pix_size = (nr == 1 ? 1 : (yd(1) - yd(0)) / (nr - 1)); - ColumnVector p1(3, 0.0), p2(3, 0.0), p3(3, 0.0), p4(3, 0.0); - p1(0) = xd(0) - x_pix_size/2; - p1(1) = yd(0) - y_pix_size/2; + ColumnVector p1(3, 0.0), p2(3, 0.0), p3(3, 0.0), p4(3, 0.0); + p1(0) = xd(0) - x_pix_size/2; + p1(1) = yd(0) - y_pix_size/2; - p2(0) = xd(1) + x_pix_size/2; - p2(1) = yd(0) - y_pix_size/2; + p2(0) = xd(1) + x_pix_size/2; + p2(1) = yd(0) - y_pix_size/2; - p3(0) = xd(1) + x_pix_size/2; - p3(1) = yd(1) + y_pix_size/2; + p3(0) = xd(1) + x_pix_size/2; + p3(1) = yd(1) + y_pix_size/2; - p4(0) = xd(0) - x_pix_size/2; - p4(1) = yd(1) + y_pix_size/2; + p4(0) = xd(0) - x_pix_size/2; + p4(1) = yd(1) + y_pix_size/2; - m_glfcns.glBegin (GL_QUADS); - m_glfcns.glVertex3dv (p1.data ()); - m_glfcns.glVertex3dv (p2.data ()); - m_glfcns.glVertex3dv (p3.data ()); - m_glfcns.glVertex3dv (p4.data ()); - m_glfcns.glEnd (); - } + m_glfcns.glBegin (GL_QUADS); + m_glfcns.glVertex3dv (p1.data ()); + m_glfcns.glVertex3dv (p2.data ()); + m_glfcns.glVertex3dv (p3.data ()); + m_glfcns.glVertex3dv (p4.data ()); + m_glfcns.glEnd (); +} OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/gl-select.h --- a/libgui/graphics/gl-select.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/graphics/gl-select.h Tue Dec 06 15:45:27 2022 -0500 @@ -34,55 +34,55 @@ OCTAVE_BEGIN_NAMESPACE(octave) - enum select_flags +enum select_flags { select_ignore_hittest = 0x01, select_last = 0x02 }; - class opengl_selector : public opengl_renderer - { - public: - opengl_selector (opengl_functions& glfcns) - : opengl_renderer (glfcns), size (5) - { } +class opengl_selector : public opengl_renderer +{ +public: + opengl_selector (opengl_functions& glfcns) + : opengl_renderer (glfcns), size (5) + { } - virtual ~opengl_selector (void) = default; + virtual ~opengl_selector (void) = default; - graphics_object select (const graphics_object& ax, int x, int y, - int flags = 0); + graphics_object select (const graphics_object& ax, int x, int y, + int flags = 0); - virtual void draw (const graphics_object& go, bool toplevel = true); + virtual void draw (const graphics_object& go, bool toplevel = true); - protected: - virtual void draw_text (const text::properties& props); +protected: + virtual void draw_text (const text::properties& props); - virtual void draw_image (const image::properties& props); + virtual void draw_image (const image::properties& props); - virtual void setup_opengl_transformation (const axes::properties& props); + virtual void setup_opengl_transformation (const axes::properties& props); - virtual void init_marker (const std::string& m, double size, float width); + virtual void init_marker (const std::string& m, double size, float width); - virtual Matrix render_text (const std::string& txt, - double x, double y, double z, - int halign, int valign, double rotation = 0.0); + virtual Matrix render_text (const std::string& txt, + double x, double y, double z, + int halign, int valign, double rotation = 0.0); - private: - void apply_pick_matrix (void); +private: + void apply_pick_matrix (void); - void fake_text (double x, double y, double z, const Matrix& bbox, - bool use_scale = true); + void fake_text (double x, double y, double z, const Matrix& bbox, + bool use_scale = true); - private: - // The mouse coordinate of the selection/picking point - int xp, yp; +private: + // The mouse coordinate of the selection/picking point + int xp, yp; - // The size (in pixels) of the picking window - int size; + // The size (in pixels) of the picking window + int size; - // The OpenGL name mapping - std::map object_map; - }; + // The OpenGL name mapping + std::map object_map; +}; OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/qopengl-functions.h --- a/libgui/graphics/qopengl-functions.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/graphics/qopengl-functions.h Tue Dec 06 15:45:27 2022 -0500 @@ -34,424 +34,424 @@ OCTAVE_BEGIN_NAMESPACE(octave) - // If we don't have QOPENGLFUNCTIONS_1_1, then we will default to - // calling OpenGL functions directly through the base - // opengl_functions class. +// If we don't have QOPENGLFUNCTIONS_1_1, then we will default to +// calling OpenGL functions directly through the base +// opengl_functions class. - class qopengl_functions : public opengl_functions - { - public: +class qopengl_functions : public opengl_functions +{ +public: - qopengl_functions (void) + qopengl_functions (void) #if defined (HAVE_QOPENGLFUNCTIONS_1_1) - : m_glfcns () + : m_glfcns () #endif - { } + { } - qopengl_functions (const qopengl_functions&) = default; + qopengl_functions (const qopengl_functions&) = default; - qopengl_functions& operator = (const qopengl_functions&) = default; + qopengl_functions& operator = (const qopengl_functions&) = default; - ~qopengl_functions (void) = default; + ~qopengl_functions (void) = default; - void init (void) - { + void init (void) + { #if defined (HAVE_QOPENGLFUNCTIONS_1_1) - m_glfcns.initializeOpenGLFunctions (); + m_glfcns.initializeOpenGLFunctions (); #endif - } + } #if defined (HAVE_QOPENGLFUNCTIONS_1_1) - void glAlphaFunc (GLenum fcn, GLclampf ref) - { - m_glfcns.glAlphaFunc (fcn, ref); - } + void glAlphaFunc (GLenum fcn, GLclampf ref) + { + m_glfcns.glAlphaFunc (fcn, ref); + } - void glBegin (GLenum mode) - { - m_glfcns.glBegin (mode); - } + void glBegin (GLenum mode) + { + m_glfcns.glBegin (mode); + } - void glBindTexture (GLenum target, GLuint texture) - { - m_glfcns.glBindTexture (target, texture); - } + void glBindTexture (GLenum target, GLuint texture) + { + m_glfcns.glBindTexture (target, texture); + } - void glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, - GLfloat xmove, GLfloat ymove, const GLubyte *bitmap) - { - m_glfcns.glBitmap (width, height, xorig, yorig, xmove, ymove, bitmap); - } + void glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, + GLfloat xmove, GLfloat ymove, const GLubyte *bitmap) + { + m_glfcns.glBitmap (width, height, xorig, yorig, xmove, ymove, bitmap); + } - void glBlendFunc (GLenum sfactor, GLenum dfactor) - { - m_glfcns.glBlendFunc (sfactor, dfactor); - } + void glBlendFunc (GLenum sfactor, GLenum dfactor) + { + m_glfcns.glBlendFunc (sfactor, dfactor); + } - void glCallList (GLuint list) - { - m_glfcns.glCallList (list); - } + void glCallList (GLuint list) + { + m_glfcns.glCallList (list); + } - void glClearColor (GLclampf red, GLclampf green, GLclampf blue, - GLclampf alpha) - { - m_glfcns.glClearColor (red, green, blue, alpha); - } + void glClearColor (GLclampf red, GLclampf green, GLclampf blue, + GLclampf alpha) + { + m_glfcns.glClearColor (red, green, blue, alpha); + } - void glClear (GLbitfield mask) - { - m_glfcns.glClear (mask); - } + void glClear (GLbitfield mask) + { + m_glfcns.glClear (mask); + } - void glClipPlane (GLenum plane, const GLdouble *equation) - { - m_glfcns.glClipPlane (plane, equation); - } + void glClipPlane (GLenum plane, const GLdouble *equation) + { + m_glfcns.glClipPlane (plane, equation); + } - void glColor3dv (const GLdouble *v) - { - m_glfcns.glColor3dv (v); - } + void glColor3dv (const GLdouble *v) + { + m_glfcns.glColor3dv (v); + } - void glColor3f (GLfloat red, GLfloat green, GLfloat blue) - { - m_glfcns.glColor3f (red, green, blue); - } + void glColor3f (GLfloat red, GLfloat green, GLfloat blue) + { + m_glfcns.glColor3f (red, green, blue); + } - void glColor3fv (const GLfloat *v) - { - m_glfcns.glColor3fv (v); - } + void glColor3fv (const GLfloat *v) + { + m_glfcns.glColor3fv (v); + } - void glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha) - { - m_glfcns.glColor4d (red, green, blue, alpha); - } + void glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha) + { + m_glfcns.glColor4d (red, green, blue, alpha); + } - void glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) - { - m_glfcns.glColor4f (red, green, blue, alpha); - } + void glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) + { + m_glfcns.glColor4f (red, green, blue, alpha); + } - void glColor4fv (const GLfloat *v) - { - m_glfcns.glColor4fv (v); - } + void glColor4fv (const GLfloat *v) + { + m_glfcns.glColor4fv (v); + } - void glDeleteLists (GLuint list, GLsizei range) - { - m_glfcns.glDeleteLists (list, range); - } + void glDeleteLists (GLuint list, GLsizei range) + { + m_glfcns.glDeleteLists (list, range); + } - void glDeleteTextures (GLsizei n, const GLuint *textures) - { - m_glfcns.glDeleteTextures (n, textures); - } + void glDeleteTextures (GLsizei n, const GLuint *textures) + { + m_glfcns.glDeleteTextures (n, textures); + } - void glDepthFunc (GLenum fcn) - { - m_glfcns.glDepthFunc (fcn); - } + void glDepthFunc (GLenum fcn) + { + m_glfcns.glDepthFunc (fcn); + } - void glDisable (GLenum cap) - { - m_glfcns.glDisable (cap); - } + void glDisable (GLenum cap) + { + m_glfcns.glDisable (cap); + } - void glDrawPixels (GLsizei width, GLsizei height, GLenum format, - GLenum type, const GLvoid *pixels) - { - m_glfcns.glDrawPixels (width, height, format, type, pixels); - } + void glDrawPixels (GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *pixels) + { + m_glfcns.glDrawPixels (width, height, format, type, pixels); + } - void glEdgeFlag (GLboolean flag) - { - m_glfcns.glEdgeFlag (flag); - } + void glEdgeFlag (GLboolean flag) + { + m_glfcns.glEdgeFlag (flag); + } - void glEnable (GLenum cap) - { - m_glfcns.glEnable (cap); - } + void glEnable (GLenum cap) + { + m_glfcns.glEnable (cap); + } - void glEndList (void) - { - m_glfcns.glEndList (); - } + void glEndList (void) + { + m_glfcns.glEndList (); + } - void glEnd (void) - { - m_glfcns.glEnd (); - } + void glEnd (void) + { + m_glfcns.glEnd (); + } - void glFinish (void) - { - m_glfcns.glFinish (); - } + void glFinish (void) + { + m_glfcns.glFinish (); + } - GLuint glGenLists (GLsizei range) - { - return m_glfcns.glGenLists (range); - } + GLuint glGenLists (GLsizei range) + { + return m_glfcns.glGenLists (range); + } - void glGenTextures (GLsizei n, GLuint *textures) - { - m_glfcns.glGenTextures (n, textures); - } + void glGenTextures (GLsizei n, GLuint *textures) + { + m_glfcns.glGenTextures (n, textures); + } - void glGetBooleanv (GLenum pname, GLboolean *data) - { - m_glfcns.glGetBooleanv (pname, data); - } + void glGetBooleanv (GLenum pname, GLboolean *data) + { + m_glfcns.glGetBooleanv (pname, data); + } - void glGetDoublev (GLenum pname, GLdouble *data) - { - m_glfcns.glGetDoublev (pname, data); - } + void glGetDoublev (GLenum pname, GLdouble *data) + { + m_glfcns.glGetDoublev (pname, data); + } - GLenum glGetError (void) - { - return m_glfcns.glGetError (); - } + GLenum glGetError (void) + { + return m_glfcns.glGetError (); + } - void glGetFloatv (GLenum pname, GLfloat *data) - { - m_glfcns.glGetFloatv (pname, data); - } + void glGetFloatv (GLenum pname, GLfloat *data) + { + m_glfcns.glGetFloatv (pname, data); + } - void glGetIntegerv (GLenum pname, GLint *data) - { - m_glfcns.glGetIntegerv (pname, data); - } + void glGetIntegerv (GLenum pname, GLint *data) + { + m_glfcns.glGetIntegerv (pname, data); + } - const GLubyte * glGetString (GLenum name) - { - return m_glfcns.glGetString (name); - } + const GLubyte * glGetString (GLenum name) + { + return m_glfcns.glGetString (name); + } - void glHint (GLenum target, GLenum mode) - { - m_glfcns.glHint (target, mode); - } + void glHint (GLenum target, GLenum mode) + { + m_glfcns.glHint (target, mode); + } - void glInitNames (void) - { - m_glfcns.glInitNames (); - } + void glInitNames (void) + { + m_glfcns.glInitNames (); + } - GLboolean glIsEnabled (GLenum cap) - { - return m_glfcns.glIsEnabled (cap); - } + GLboolean glIsEnabled (GLenum cap) + { + return m_glfcns.glIsEnabled (cap); + } - void glLightfv (GLenum light, GLenum pname, const GLfloat *params) - { - m_glfcns.glLightfv (light, pname, params); - } + void glLightfv (GLenum light, GLenum pname, const GLfloat *params) + { + m_glfcns.glLightfv (light, pname, params); + } - void glLineStipple (GLint factor, GLushort pattern) - { - m_glfcns.glLineStipple (factor, pattern); - } + void glLineStipple (GLint factor, GLushort pattern) + { + m_glfcns.glLineStipple (factor, pattern); + } - void glLineWidth (GLfloat width) - { - m_glfcns.glLineWidth (width); - } + void glLineWidth (GLfloat width) + { + m_glfcns.glLineWidth (width); + } - void glLoadIdentity (void) - { - m_glfcns.glLoadIdentity (); - } + void glLoadIdentity (void) + { + m_glfcns.glLoadIdentity (); + } - void glMaterialf (GLenum face, GLenum pname, GLfloat param) - { - m_glfcns.glMaterialf (face, pname, param); - } + void glMaterialf (GLenum face, GLenum pname, GLfloat param) + { + m_glfcns.glMaterialf (face, pname, param); + } - void glMaterialfv (GLenum face, GLenum pname, const GLfloat *params) - { - m_glfcns.glMaterialfv (face, pname, params); - } + void glMaterialfv (GLenum face, GLenum pname, const GLfloat *params) + { + m_glfcns.glMaterialfv (face, pname, params); + } - void glMatrixMode (GLenum mode) - { - m_glfcns.glMatrixMode (mode); - } + void glMatrixMode (GLenum mode) + { + m_glfcns.glMatrixMode (mode); + } - void glMultMatrixd (const GLdouble *m) - { - m_glfcns.glMultMatrixd (m); - } + void glMultMatrixd (const GLdouble *m) + { + m_glfcns.glMultMatrixd (m); + } - void glNewList (GLuint list, GLenum mode) - { - m_glfcns.glNewList (list, mode); - } + void glNewList (GLuint list, GLenum mode) + { + m_glfcns.glNewList (list, mode); + } - void glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz) - { - m_glfcns.glNormal3d (nx, ny, nz); - } + void glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz) + { + m_glfcns.glNormal3d (nx, ny, nz); + } - void glNormal3dv (const GLdouble *v) - { - m_glfcns.glNormal3dv (v); - } + void glNormal3dv (const GLdouble *v) + { + m_glfcns.glNormal3dv (v); + } - void glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, - GLdouble near_val, GLdouble far_val) - { - m_glfcns.glOrtho (left, right, bottom, top, near_val, far_val); - } + void glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, + GLdouble near_val, GLdouble far_val) + { + m_glfcns.glOrtho (left, right, bottom, top, near_val, far_val); + } - void glPixelStorei (GLenum pname, GLint param) - { - m_glfcns.glPixelStorei (pname, param); - } + void glPixelStorei (GLenum pname, GLint param) + { + m_glfcns.glPixelStorei (pname, param); + } - void glPixelZoom (GLfloat xfactor, GLfloat yfactor) - { - m_glfcns.glPixelZoom (xfactor, yfactor); - } + void glPixelZoom (GLfloat xfactor, GLfloat yfactor) + { + m_glfcns.glPixelZoom (xfactor, yfactor); + } - void glPolygonMode (GLenum face, GLenum mode) - { - m_glfcns.glPolygonMode (face, mode); - } + void glPolygonMode (GLenum face, GLenum mode) + { + m_glfcns.glPolygonMode (face, mode); + } - void glPolygonOffset (GLfloat factor, GLfloat units) - { - m_glfcns.glPolygonOffset (factor, units); - } + void glPolygonOffset (GLfloat factor, GLfloat units) + { + m_glfcns.glPolygonOffset (factor, units); + } - void glPopAttrib (void) - { - m_glfcns.glPopAttrib (); - } + void glPopAttrib (void) + { + m_glfcns.glPopAttrib (); + } - void glPopMatrix (void) - { - m_glfcns.glPopMatrix (); - } + void glPopMatrix (void) + { + m_glfcns.glPopMatrix (); + } - void glPopName (void) - { - m_glfcns.glPopName (); - } + void glPopName (void) + { + m_glfcns.glPopName (); + } - void glPushAttrib (GLbitfield mask) - { - m_glfcns.glPushAttrib (mask); - } + void glPushAttrib (GLbitfield mask) + { + m_glfcns.glPushAttrib (mask); + } - void glPushMatrix (void) - { - m_glfcns.glPushMatrix (); - } + void glPushMatrix (void) + { + m_glfcns.glPushMatrix (); + } - void glPushName (GLuint name) - { - m_glfcns.glPushName (name); - } + void glPushName (GLuint name) + { + m_glfcns.glPushName (name); + } - void glRasterPos3d (GLdouble x, GLdouble y, GLdouble z) - { - m_glfcns.glRasterPos3d (x, y, z); - } + void glRasterPos3d (GLdouble x, GLdouble y, GLdouble z) + { + m_glfcns.glRasterPos3d (x, y, z); + } - void glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, GLvoid *pixels) - { - m_glfcns.glReadPixels (x, y, width, height, format, type, pixels); - } + void glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, GLvoid *pixels) + { + m_glfcns.glReadPixels (x, y, width, height, format, type, pixels); + } - GLint glRenderMode (GLenum mode) - { - return m_glfcns.glRenderMode (mode); - } + GLint glRenderMode (GLenum mode) + { + return m_glfcns.glRenderMode (mode); + } - void glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z) - { - m_glfcns.glRotated (angle, x, y, z); - } + void glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z) + { + m_glfcns.glRotated (angle, x, y, z); + } - void glScaled (GLdouble x, GLdouble y, GLdouble z) - { - m_glfcns.glScaled (x, y, z); - } + void glScaled (GLdouble x, GLdouble y, GLdouble z) + { + m_glfcns.glScaled (x, y, z); + } - void glScalef (GLfloat x, GLfloat y, GLfloat z) - { - m_glfcns.glScalef (x, y, z); - } + void glScalef (GLfloat x, GLfloat y, GLfloat z) + { + m_glfcns.glScalef (x, y, z); + } - void glSelectBuffer (GLsizei size, GLuint *buffer) - { - m_glfcns.glSelectBuffer (size, buffer); - } + void glSelectBuffer (GLsizei size, GLuint *buffer) + { + m_glfcns.glSelectBuffer (size, buffer); + } - void glShadeModel (GLenum mode) - { - m_glfcns.glShadeModel (mode); - } + void glShadeModel (GLenum mode) + { + m_glfcns.glShadeModel (mode); + } - void glTexCoord2d (GLdouble s, GLdouble t) - { - m_glfcns.glTexCoord2d (s, t); - } + void glTexCoord2d (GLdouble s, GLdouble t) + { + m_glfcns.glTexCoord2d (s, t); + } - void glTexImage2D (GLenum target, GLint level, GLint internalFormat, - GLsizei width, GLsizei height, GLint border, - GLenum format, GLenum type, const GLvoid *pixels) - { - m_glfcns.glTexImage2D (target, level, internalFormat, width, height, - border, format, type, pixels); - } + void glTexImage2D (GLenum target, GLint level, GLint internalFormat, + GLsizei width, GLsizei height, GLint border, + GLenum format, GLenum type, const GLvoid *pixels) + { + m_glfcns.glTexImage2D (target, level, internalFormat, width, height, + border, format, type, pixels); + } - void glTexParameteri (GLenum target, GLenum pname, GLint param) - { - m_glfcns.glTexParameteri (target, pname, param); - } + void glTexParameteri (GLenum target, GLenum pname, GLint param) + { + m_glfcns.glTexParameteri (target, pname, param); + } - void glTranslated (GLdouble x, GLdouble y, GLdouble z) - { - m_glfcns.glTranslated (x, y, z); - } + void glTranslated (GLdouble x, GLdouble y, GLdouble z) + { + m_glfcns.glTranslated (x, y, z); + } - void glTranslatef (GLfloat x, GLfloat y, GLfloat z) - { - m_glfcns.glTranslatef (x, y, z); - } + void glTranslatef (GLfloat x, GLfloat y, GLfloat z) + { + m_glfcns.glTranslatef (x, y, z); + } - void glVertex2d (GLdouble x, GLdouble y) - { - m_glfcns.glVertex2d (x, y); - } + void glVertex2d (GLdouble x, GLdouble y) + { + m_glfcns.glVertex2d (x, y); + } - void glVertex3d (GLdouble x, GLdouble y, GLdouble z) - { - m_glfcns.glVertex3d (x, y, z); - } + void glVertex3d (GLdouble x, GLdouble y, GLdouble z) + { + m_glfcns.glVertex3d (x, y, z); + } - void glVertex3dv (const GLdouble *v) - { - m_glfcns.glVertex3dv (v); - } + void glVertex3dv (const GLdouble *v) + { + m_glfcns.glVertex3dv (v); + } - void glViewport (GLint x, GLint y, GLsizei width, GLsizei height) - { - m_glfcns.glViewport (x, y, width, height); - } + void glViewport (GLint x, GLint y, GLsizei width, GLsizei height) + { + m_glfcns.glViewport (x, y, width, height); + } - private: +private: - QOpenGLFunctions_1_1 m_glfcns; + QOpenGLFunctions_1_1 m_glfcns; #endif - }; +}; OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/qt-graphics-toolkit.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/graphics/qt-graphics-toolkit.h diff -r 431f80aba37a -r deb553ac2c54 libgui/module.mk --- a/libgui/module.mk Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/module.mk Tue Dec 06 15:45:27 2022 -0500 @@ -92,7 +92,7 @@ endef define moc-h-command - $(SED) -e 's/OCTAVE_BEGIN_NAMESPACE *(\([^)]*\))/namespace \1 {/' \ +$(SED) -e 's/OCTAVE_BEGIN_NAMESPACE *(\([^)]*\))/namespace \1 {/' \ -e 's/OCTAVE_END_NAMESPACE *([^)]*)/}/' $< > $@ endef diff -r 431f80aba37a -r deb553ac2c54 libgui/src/color-picker.cc --- a/libgui/src/color-picker.cc Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/color-picker.cc Tue Dec 06 15:45:27 2022 -0500 @@ -34,51 +34,51 @@ OCTAVE_BEGIN_NAMESPACE(octave) - // Constructor with initial color as parameter - color_picker::color_picker (QColor old_color, QWidget *p) - : QPushButton (p) - { - m_color = old_color; - setFlat (true); - setFocusPolicy (Qt::NoFocus); // no focus, would change the color - update_button (); - connect (this, &color_picker::clicked, this, &color_picker::select_color); - } +// Constructor with initial color as parameter +color_picker::color_picker (QColor old_color, QWidget *p) +: QPushButton (p) +{ + m_color = old_color; + setFlat (true); + setFocusPolicy (Qt::NoFocus); // no focus, would change the color + update_button (); + connect (this, &color_picker::clicked, this, &color_picker::select_color); +} - // Slot for button clicked: select a new color using QColorDialog - void color_picker::select_color (void) - { - QColor new_color = QColorDialog::getColor (m_color); +// Slot for button clicked: select a new color using QColorDialog +void color_picker::select_color (void) +{ + QColor new_color = QColorDialog::getColor (m_color); - if (new_color.isValid () && new_color != m_color) - { - m_color = new_color; - update_button (); - } - } + if (new_color.isValid () && new_color != m_color) + { + m_color = new_color; + update_button (); + } +} - // Set the color of the button - void color_picker::set_color (QColor new_color) - { - m_color = new_color; - update_button (); - } +// Set the color of the button +void color_picker::set_color (QColor new_color) +{ + m_color = new_color; + update_button (); +} - // Draw the button with the actual color (using a stylesheet) - void color_picker::update_button (void) - { - // Is this the right place to look for a "foreground" color that would - // provide a reasonable border for the color swatches? - QWidget *p = parentWidget (); +// Draw the button with the actual color (using a stylesheet) +void color_picker::update_button (void) +{ + // Is this the right place to look for a "foreground" color that would + // provide a reasonable border for the color swatches? + QWidget *p = parentWidget (); - QString bordercolor - = (p ? p->palette ().text ().color ().name () : QString ("#000000")); + QString bordercolor + = (p ? p->palette ().text ().color ().name () : QString ("#000000")); - setStyleSheet (QString ("background-color: %1; border: 1px solid %2;") - .arg (m_color.name ()) - .arg (bordercolor)); + setStyleSheet (QString ("background-color: %1; border: 1px solid %2;") + .arg (m_color.name ()) + .arg (bordercolor)); - repaint (); - } + repaint (); +} OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/color-picker.h --- a/libgui/src/color-picker.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/color-picker.h Tue Dec 06 15:45:27 2022 -0500 @@ -34,28 +34,28 @@ OCTAVE_BEGIN_NAMESPACE(octave) - class color_picker : public QPushButton - { - Q_OBJECT +class color_picker : public QPushButton +{ + Q_OBJECT - public: +public: - color_picker (QColor color = QColor (0, 0, 0), QWidget *parent = nullptr); + color_picker (QColor color = QColor (0, 0, 0), QWidget *parent = nullptr); - QColor color (void) const { return m_color; } + QColor color (void) const { return m_color; } - void set_color (QColor new_color); + void set_color (QColor new_color); - private slots: +private slots: - void select_color (void); + void select_color (void); - private: +private: - virtual void update_button (void); + virtual void update_button (void); - QColor m_color; - }; + QColor m_color; +}; OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/command-widget.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/command-widget.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/community-news.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/community-news.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/dialog.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/dialog.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/documentation-bookmarks.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/documentation-bookmarks.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/documentation-dock-widget.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/documentation-dock-widget.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/documentation.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/documentation.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/dw-main-window.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/dw-main-window.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/external-editor-interface.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/external-editor-interface.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/files-dock-widget.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/files-dock-widget.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/find-files-dialog.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/find-files-dialog.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/find-files-model.cc --- a/libgui/src/find-files-model.cc Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/find-files-model.cc Tue Dec 06 15:45:27 2022 -0500 @@ -36,181 +36,181 @@ OCTAVE_BEGIN_NAMESPACE(octave) - class find_file_less_than - { - public: - - find_file_less_than (int ord) { m_sortorder = ord; } +class find_file_less_than +{ +public: - QVariant getValue (const QFileInfo& f) const - { - QVariant val; - - int col = (m_sortorder > 0) ? m_sortorder : -m_sortorder; + find_file_less_than (int ord) { m_sortorder = ord; } - switch (col-1) - { - case 0: - val = QVariant (f.fileName ()); - break; + QVariant getValue (const QFileInfo& f) const + { + QVariant val; - case 1: - val = QVariant (f.absolutePath ()); - break; - - default: - break; - } - - return val; - } + int col = (m_sortorder > 0) ? m_sortorder : -m_sortorder; - bool lessThan (const QVariant& left, const QVariant& right) const - { - return - left.toString ().compare (right.toString (), Qt::CaseInsensitive) < 0; - } - - bool operator () (const QFileInfo& left, const QFileInfo& right) const - { - QVariant leftval = getValue (left); - QVariant rightval = getValue (right); + switch (col-1) + { + case 0: + val = QVariant (f.fileName ()); + break; - if (m_sortorder > 0) - return lessThan (leftval, rightval); - else - return ! lessThan (leftval, rightval); - } - - private: + case 1: + val = QVariant (f.absolutePath ()); + break; - int m_sortorder; - }; + default: + break; + } - find_files_model::find_files_model (QObject *p) - : QAbstractListModel (p) - { - m_columnNames.append (tr ("Filename")); - m_columnNames.append (tr ("Directory")); - m_sortorder = 0; + return val; } - void find_files_model::clear (void) + bool lessThan (const QVariant& left, const QVariant& right) const { - beginResetModel (); - - m_files.clear (); - - endResetModel (); + return + left.toString ().compare (right.toString (), Qt::CaseInsensitive) < 0; } - void find_files_model::addFile (const QFileInfo& info) + bool operator () (const QFileInfo& left, const QFileInfo& right) const { - beginInsertRows (QModelIndex (), m_files.size (), m_files.size ()); - - QList::Iterator it; - find_file_less_than less_than (m_sortorder); + QVariant leftval = getValue (left); + QVariant rightval = getValue (right); - for (it = m_files.begin (); it != m_files.end (); it++) - { - if (less_than (info, *it)) - break; - } - - m_files.insert (it, info); - - endInsertRows (); + if (m_sortorder > 0) + return lessThan (leftval, rightval); + else + return ! lessThan (leftval, rightval); } - int find_files_model::rowCount (const QModelIndex&) const - { - return m_files.size (); - } +private: + + int m_sortorder; +}; + +find_files_model::find_files_model (QObject *p) + : QAbstractListModel (p) +{ + m_columnNames.append (tr ("Filename")); + m_columnNames.append (tr ("Directory")); + m_sortorder = 0; +} - int find_files_model::columnCount (const QModelIndex&) const - { - return m_columnNames.size (); - } +void find_files_model::clear (void) +{ + beginResetModel (); + + m_files.clear (); - QVariant find_files_model::data (const QModelIndex& idx, int role) const - { - QVariant retval; + endResetModel (); +} + +void find_files_model::addFile (const QFileInfo& info) +{ + beginInsertRows (QModelIndex (), m_files.size (), m_files.size ()); + + QList::Iterator it; + find_file_less_than less_than (m_sortorder); - if (idx.isValid ()) - { - if (role == Qt::DisplayRole) - { - switch (idx.column ()) - { - case 0: - retval = QVariant (m_files[idx.row ()].fileName ()); - break; + for (it = m_files.begin (); it != m_files.end (); it++) + { + if (less_than (info, *it)) + break; + } + + m_files.insert (it, info); - case 1: - retval = QVariant (m_files[idx.row ()].absolutePath ()); - break; + endInsertRows (); +} + +int find_files_model::rowCount (const QModelIndex&) const +{ + return m_files.size (); +} - default: - break; - } - } - else if (role == Qt::DecorationRole) - { - switch (idx.column ()) - { - case 0: - retval = fileIcon (idx); +int find_files_model::columnCount (const QModelIndex&) const +{ + return m_columnNames.size (); +} + +QVariant find_files_model::data (const QModelIndex& idx, int role) const +{ + QVariant retval; - default: - break; - } - } - } + if (idx.isValid ()) + { + if (role == Qt::DisplayRole) + { + switch (idx.column ()) + { + case 0: + retval = QVariant (m_files[idx.row ()].fileName ()); + break; - return retval; - } + case 1: + retval = QVariant (m_files[idx.row ()].absolutePath ()); + break; - QVariant find_files_model::headerData (int section, - Qt::Orientation orientation, - int role) const - { - return ((orientation == Qt::Horizontal && role == Qt::DisplayRole) - ? m_columnNames[section] : QVariant ()); - } + default: + break; + } + } + else if (role == Qt::DecorationRole) + { + switch (idx.column ()) + { + case 0: + retval = fileIcon (idx); - void find_files_model::sort (int column, Qt::SortOrder order) - { - if (column >= 0) - { - if (order == Qt::DescendingOrder) - m_sortorder = -(column+1); - else - m_sortorder = column+1; - } - else - m_sortorder = 0; + default: + break; + } + } + } + + return retval; +} + +QVariant find_files_model::headerData (int section, + Qt::Orientation orientation, + int role) const +{ + return ((orientation == Qt::Horizontal && role == Qt::DisplayRole) + ? m_columnNames[section] : QVariant ()); +} - if (m_sortorder != 0) - { - beginResetModel (); +void find_files_model::sort (int column, Qt::SortOrder order) +{ + if (column >= 0) + { + if (order == Qt::DescendingOrder) + m_sortorder = -(column+1); + else + m_sortorder = column+1; + } + else + m_sortorder = 0; - std::sort (m_files.begin (), m_files.end (), - find_file_less_than (m_sortorder)); - - endResetModel (); - } - } + if (m_sortorder != 0) + { + beginResetModel (); - QFileInfo find_files_model::fileInfo (const QModelIndex& p) const - { - return p.isValid () ? m_files[p.row ()] : QFileInfo (); - } + std::sort (m_files.begin (), m_files.end (), + find_file_less_than (m_sortorder)); + + endResetModel (); + } +} - QIcon find_files_model::fileIcon (const QModelIndex& p) const - { - QFileIconProvider icon_provider; +QFileInfo find_files_model::fileInfo (const QModelIndex& p) const +{ + return p.isValid () ? m_files[p.row ()] : QFileInfo (); +} - return p.isValid () ? icon_provider.icon (m_files[p.row ()]) : QIcon (); - } +QIcon find_files_model::fileIcon (const QModelIndex& p) const +{ + QFileIconProvider icon_provider; + + return p.isValid () ? icon_provider.icon (m_files[p.row ()]) : QIcon (); +} OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/find-files-model.h --- a/libgui/src/find-files-model.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/find-files-model.h Tue Dec 06 15:45:27 2022 -0500 @@ -33,41 +33,41 @@ OCTAVE_BEGIN_NAMESPACE(octave) - class find_files_model : public QAbstractListModel - { - Q_OBJECT +class find_files_model : public QAbstractListModel +{ + Q_OBJECT - public: +public: - find_files_model (QObject *p = nullptr); + find_files_model (QObject *p = nullptr); - ~find_files_model (void) = default; + ~find_files_model (void) = default; - void clear (void); + void clear (void); - void addFile (const QFileInfo& info); + void addFile (const QFileInfo& info); - int rowCount (const QModelIndex& p = QModelIndex ()) const; + int rowCount (const QModelIndex& p = QModelIndex ()) const; - int columnCount (const QModelIndex& p = QModelIndex ()) const; + int columnCount (const QModelIndex& p = QModelIndex ()) const; - QVariant data (const QModelIndex& idx, int role) const; + QVariant data (const QModelIndex& idx, int role) const; - QVariant headerData (int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const; + QVariant headerData (int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const; - void sort (int column, Qt::SortOrder order = Qt::AscendingOrder); + void sort (int column, Qt::SortOrder order = Qt::AscendingOrder); - QFileInfo fileInfo (const QModelIndex& p) const; + QFileInfo fileInfo (const QModelIndex& p) const; - QIcon fileIcon (const QModelIndex& p) const; + QIcon fileIcon (const QModelIndex& p) const; - private: +private: - QList m_files; - QStringList m_columnNames; - int m_sortorder; - }; + QList m_files; + QStringList m_columnNames; + int m_sortorder; +}; OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/graphics-init.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/graphics-init.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/gui-settings.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/gui-settings.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/gui-utils.cc --- a/libgui/src/gui-utils.cc Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/gui-utils.cc Tue Dec 06 15:45:27 2022 -0500 @@ -35,90 +35,90 @@ OCTAVE_BEGIN_NAMESPACE(octave) - OCTGUI_API QColor - interpolate_color (const QColor& col1, const QColor& col2, - double fs, double fv) - { - qreal h1, s1, v1, h2, s2, v2; +OCTGUI_API QColor +interpolate_color (const QColor& col1, const QColor& col2, + double fs, double fv) +{ + qreal h1, s1, v1, h2, s2, v2; - col1.getHsvF (&h1, &s1, &v1); - col2.getHsvF (&h2, &s2, &v2); + col1.getHsvF (&h1, &s1, &v1); + col2.getHsvF (&h2, &s2, &v2); - return QColor::fromHsvF (h1, s1*fs, v1 + fv*(v2 - v1)); - } + return QColor::fromHsvF (h1, s1*fs, v1 + fv*(v2 - v1)); +} - OCTGUI_API void - get_screen_geometry (int& width, int& height) - { - QRect geom = QGuiApplication::primaryScreen ()->availableGeometry (); +OCTGUI_API void +get_screen_geometry (int& width, int& height) +{ + QRect geom = QGuiApplication::primaryScreen ()->availableGeometry (); - width = geom.width (); - height = geom.height (); - } + width = geom.width (); + height = geom.height (); +} - OCTGUI_API void - adjust_to_screen (QRect& actual_geometry, const QRect& default_geometry) - { +OCTGUI_API void +adjust_to_screen (QRect& actual_geometry, const QRect& default_geometry) +{ - // Get the screen that holds the largest part of the given actual geometry + // Get the screen that holds the largest part of the given actual geometry - const QScreen *actual_screen = nullptr; // no screen found yet - QRect actual_screen_geom = QRect (); // geometry of found screen - int intersected_area_max = 0; // max. intersected area + const QScreen *actual_screen = nullptr; // no screen found yet + QRect actual_screen_geom = QRect (); // geometry of found screen + int intersected_area_max = 0; // max. intersected area - const int area_actual_geometry - = actual_geometry.width () * actual_geometry.height (); - QRect intersection; + const int area_actual_geometry + = actual_geometry.width () * actual_geometry.height (); + QRect intersection; - foreach (const QScreen *screen, QGuiApplication::screens()) - { - QRect screen_geom = screen->availableGeometry (); - intersection = screen_geom.intersected (actual_geometry); - if (! intersection.isEmpty ()) - { - int area = intersection.width () * intersection.height (); - if (area > intersected_area_max) - { - actual_screen = screen; - actual_screen_geom = screen->availableGeometry (); - if (area == area_actual_geometry) - return; // Actual geom is completely on a screen: return - intersected_area_max = area; - } - } - } + foreach (const QScreen *screen, QGuiApplication::screens()) + { + QRect screen_geom = screen->availableGeometry (); + intersection = screen_geom.intersected (actual_geometry); + if (! intersection.isEmpty ()) + { + int area = intersection.width () * intersection.height (); + if (area > intersected_area_max) + { + actual_screen = screen; + actual_screen_geom = screen->availableGeometry (); + if (area == area_actual_geometry) + return; // Actual geom is completely on a screen: return + intersected_area_max = area; + } + } + } - // If the actual geometry is on no screen, use deault geometry + // If the actual geometry is on no screen, use deault geometry - if (actual_screen == nullptr) - { - actual_geometry = default_geometry; - return; - } + if (actual_screen == nullptr) + { + actual_geometry = default_geometry; + return; + } - // There is a screen that holds a part of the actual geometry. - // Now adjust actual geometry to this screen + // There is a screen that holds a part of the actual geometry. + // Now adjust actual geometry to this screen - // Get some properties of the actual and intersected geometry - int agx1, agy1, agx2, agy2; - actual_geometry.getCoords (&agx1, &agy1, &agx2, &agy2); - int isx1, isy1, isx2, isy2; - intersection.getCoords (&isx1, &isy1, &isx2, &isy2); + // Get some properties of the actual and intersected geometry + int agx1, agy1, agx2, agy2; + actual_geometry.getCoords (&agx1, &agy1, &agx2, &agy2); + int isx1, isy1, isx2, isy2; + intersection.getCoords (&isx1, &isy1, &isx2, &isy2); - // Make the intersection the same size as the actual geometry - if ((agx1 == isx1) && (agx2 != isx2)) - isx1 = isx1 - agx2 + isx2; - if ((agx1 != isx1) && (agx2 == isx2)) - isx2 = isx2 + agx2 - isx2; - if ((agy1 == isy1) && (agy2 != isy2)) - isy1 = isy1 - agy2 + isy2; - if ((agy1 != isy1) && (agy2 == isy2)) - isy2 = isy2 + agy2 - isy2; + // Make the intersection the same size as the actual geometry + if ((agx1 == isx1) && (agx2 != isx2)) + isx1 = isx1 - agx2 + isx2; + if ((agx1 != isx1) && (agx2 == isx2)) + isx2 = isx2 + agx2 - isx2; + if ((agy1 == isy1) && (agy2 != isy2)) + isy1 = isy1 - agy2 + isy2; + if ((agy1 != isy1) && (agy2 == isy2)) + isy2 = isy2 + agy2 - isy2; - // And compute again the intersection with the screen if this resizing - // led to corners outside the screen - actual_geometry = actual_screen_geom.intersected ( - QRect (QPoint (isx1,isy1), QPoint (isx2,isy2))); - } + // And compute again the intersection with the screen if this resizing + // led to corners outside the screen + actual_geometry = actual_screen_geom.intersected ( + QRect (QPoint (isx1,isy1), QPoint (isx2,isy2))); +} OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/gui-utils.h --- a/libgui/src/gui-utils.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/gui-utils.h Tue Dec 06 15:45:27 2022 -0500 @@ -33,48 +33,48 @@ OCTAVE_BEGIN_NAMESPACE(octave) - /*! - Deterimine an alternative color to @p col1 with less contrast - to @p col2. The HSV representation of the new color is calculated by - \f{eqnarray*}{ - H &=& H_1\\ - S &=& f_s S_1\\ - V &=& V_1 + f_s (V_2 - V_1) - \f} +/*! + Deterimine an alternative color to @p col1 with less contrast + to @p col2. The HSV representation of the new color is calculated by + \f{eqnarray*}{ + H &=& H_1\\ + S &=& f_s S_1\\ + V &=& V_1 + f_s (V_2 - V_1) + \f} - @param col1 Base color to which the alternative has to be computed - @param col2 Color to which the the new color should have less contrast - @param fs Factor for changing the saturation \f$(0\ldots\infty)\f$ - @param fv Factor for interpolating the brightness \f$(0\ldots 1)\f$. - For 0, \f$V = V_1\f$ and for 1, \f$V = V_2\f$. + @param col1 Base color to which the alternative has to be computed + @param col2 Color to which the the new color should have less contrast + @param fs Factor for changing the saturation \f$(0\ldots\infty)\f$ + @param fv Factor for interpolating the brightness \f$(0\ldots 1)\f$. + For 0, \f$V = V_1\f$ and for 1, \f$V = V_2\f$. - @return New color as QColor - */ + @return New color as QColor +*/ extern OCTGUI_API QColor interpolate_color (const QColor& col1, const QColor& col2, double fs, double fv); - /*! - Get the screen geometry of the actual screen. +/*! + Get the screen geometry of the actual screen. - @param width integer variable for storing the screen width - @param height integer variable for storing the screen height - */ + @param width integer variable for storing the screen width + @param height integer variable for storing the screen height +*/ - extern OCTGUI_API void - get_screen_geometry (int& width, int& height); +extern OCTGUI_API void +get_screen_geometry (int& width, int& height); - /*! - Adjust geometry to be completely on a screen +/*! + Adjust geometry to be completely on a screen - @param actual_geometry QRect with actual widget geometry; this is - changed to the updated geometry which is on the screen. - @param default_geometry the default geometry that is used in case - the actual geometry os on no available screen. - */ - extern OCTGUI_API void - adjust_to_screen (QRect& actual_geometry, const QRect& default_geometry); + @param actual_geometry QRect with actual widget geometry; this is + changed to the updated geometry which is on the screen. + @param default_geometry the default geometry that is used in case + the actual geometry os on no available screen. +*/ +extern OCTGUI_API void +adjust_to_screen (QRect& actual_geometry, const QRect& default_geometry); OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/history-dock-widget.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/history-dock-widget.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/interpreter-qobject.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/interpreter-qobject.h --- a/libgui/src/interpreter-qobject.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/interpreter-qobject.h Tue Dec 06 15:45:27 2022 -0500 @@ -32,70 +32,70 @@ OCTAVE_BEGIN_NAMESPACE(octave) - class interpreter; +class interpreter; - class base_qobject; +class base_qobject; - class interpreter_qobject : public QObject - { - Q_OBJECT +class interpreter_qobject : public QObject +{ + Q_OBJECT - public: +public: - interpreter_qobject (base_qobject& oct_qobj); + interpreter_qobject (base_qobject& oct_qobj); - ~interpreter_qobject (void) = default; + ~interpreter_qobject (void) = default; - qt_interpreter_events * qt_link (void); + qt_interpreter_events * qt_link (void); - void interpreter_event (const fcn_callback& fcn); + void interpreter_event (const fcn_callback& fcn); - void interpreter_event (const meth_callback& meth); + void interpreter_event (const meth_callback& meth); - void interrupt (void); + void interrupt (void); - // Note: PAUSE, STOP, and RESUME are currently only used by the new - // experimental terminal widget. - void pause (void); - void stop (void); - void resume (void); + // Note: PAUSE, STOP, and RESUME are currently only used by the new + // experimental terminal widget. + void pause (void); + void stop (void); + void resume (void); - signals: +signals: - void ready (void); + void ready (void); - void shutdown_finished (int); + void shutdown_finished (int); - public slots: +public slots: - // Programming Note: With the current design of the interpreter, - // additional signals will not be noticed because the execute - // function starts the Octave interpreter and it doesn't return - // until the interpreter exits. So the Qt event loop running in the - // thread where the interpreter_qobject object lives never has a - // chance to see another signal. Changing the design of the - // terminal widget as proposed and discussed here: - // - // https://lists.gnu.org/archive/html/octave-maintainers/2019-05/msg00115.html - // https://lists.gnu.org/archive/html/octave-maintainers/2019-06/msg00009.html - // - // coulld solve that problem. Briefly, instead of having the Octave - // interpreter block and wait for keyboard input, the terminal - // widget would be in charge of accepting keyboard events and use - // readline in callback mode. Then the terminal widget and the - // interpreter will not block except when executing code. Then we - // could have the interpreter qobject directly accept signals. + // Programming Note: With the current design of the interpreter, + // additional signals will not be noticed because the execute + // function starts the Octave interpreter and it doesn't return + // until the interpreter exits. So the Qt event loop running in the + // thread where the interpreter_qobject object lives never has a + // chance to see another signal. Changing the design of the + // terminal widget as proposed and discussed here: + // + // https://lists.gnu.org/archive/html/octave-maintainers/2019-05/msg00115.html + // https://lists.gnu.org/archive/html/octave-maintainers/2019-06/msg00009.html + // + // coulld solve that problem. Briefly, instead of having the Octave + // interpreter block and wait for keyboard input, the terminal + // widget would be in charge of accepting keyboard events and use + // readline in callback mode. Then the terminal widget and the + // interpreter will not block except when executing code. Then we + // could have the interpreter qobject directly accept signals. - //! Initialize and execute the octave interpreter. + //! Initialize and execute the octave interpreter. - void execute (void); + void execute (void); - private: +private: - base_qobject& m_octave_qobj; + base_qobject& m_octave_qobj; - interpreter *m_interpreter; - }; + interpreter *m_interpreter; +}; OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/led-indicator.cc --- a/libgui/src/led-indicator.cc Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/led-indicator.cc Tue Dec 06 15:45:27 2022 -0500 @@ -34,46 +34,46 @@ OCTAVE_BEGIN_NAMESPACE(octave) - led_indicator::led_indicator (led_state initial_state, QWidget *p) - : QLabel (p) - { - setFixedSize(12, 12); - set_state (initial_state); - } +led_indicator::led_indicator (led_state initial_state, QWidget *p) +: QLabel (p) +{ + setFixedSize(12, 12); + set_state (initial_state); +} - void led_indicator::set_state (led_state state) - { - QColor col (Qt::gray); +void led_indicator::set_state (led_state state) +{ + QColor col (Qt::gray); - switch (state) - { - case LED_STATE_NO: - break; + switch (state) + { + case LED_STATE_NO: + break; - case LED_STATE_INACTIVE: - col = QColor (Qt::darkGray); - col.setRedF (col.redF () * 1.25); - break; + case LED_STATE_INACTIVE: + col = QColor (Qt::darkGray); + col.setRedF (col.redF () * 1.25); + break; - case LED_STATE_ACTIVE: - col = QColor (Qt::red); - break; - } + case LED_STATE_ACTIVE: + col = QColor (Qt::red); + break; + } - setStyleSheet (style_sheet (col)); - } + setStyleSheet (style_sheet (col)); +} - QString led_indicator::style_sheet (const QColor& col) - { - QColor col_light = interpolate_color (col, QColor (Qt::white), 0.25, 0.9); +QString led_indicator::style_sheet (const QColor& col) +{ + QColor col_light = interpolate_color (col, QColor (Qt::white), 0.25, 0.9); - const QString style = QString ( - "border-radius: %1; background-color: " - "qlineargradient(spread:pad, x1:0.2, y1:0.2, x2:1, y2:1, stop:0 " - "%2, stop:1 %3);" - ).arg (width ()/2).arg (col_light.name ()).arg (col.name ()); + const QString style = QString ( + "border-radius: %1; background-color: " + "qlineargradient(spread:pad, x1:0.2, y1:0.2, x2:1, y2:1, stop:0 " + "%2, stop:1 %3);" + ).arg (width ()/2).arg (col_light.name ()).arg (col.name ()); - return style; - } + return style; +} OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/led-indicator.h --- a/libgui/src/led-indicator.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/led-indicator.h Tue Dec 06 15:45:27 2022 -0500 @@ -30,31 +30,31 @@ OCTAVE_BEGIN_NAMESPACE(octave) - class led_indicator: public QLabel - { - Q_OBJECT +class led_indicator: public QLabel +{ + Q_OBJECT - public: +public: - enum led_state + enum led_state { LED_STATE_NO = -1, LED_STATE_INACTIVE, LED_STATE_ACTIVE }; - led_indicator (led_state initial_state = LED_STATE_INACTIVE, - QWidget *parent = 0); + led_indicator (led_state initial_state = LED_STATE_INACTIVE, + QWidget *parent = 0); - public slots: +public slots: - void set_state (led_state state); + void set_state (led_state state); - private: +private: - QString style_sheet (const QColor& col); + QString style_sheet (const QColor& col); - }; +}; OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/m-editor/file-editor-interface.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/m-editor/file-editor-tab.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/m-editor/file-editor-tab.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/m-editor/file-editor.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/m-editor/file-editor.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/m-editor/find-dialog.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/m-editor/find-dialog.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/m-editor/marker.cc --- a/libgui/src/m-editor/marker.cc Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/m-editor/marker.cc Tue Dec 06 15:45:27 2022 -0500 @@ -33,137 +33,137 @@ OCTAVE_BEGIN_NAMESPACE(octave) - marker::marker (QsciScintilla *area, int original_linenr, - editor_markers type, int editor_linenr, - const QString& condition) - : QObject () - { - construct (area, original_linenr, type, editor_linenr, condition); - } +marker::marker (QsciScintilla *area, int original_linenr, + editor_markers type, int editor_linenr, + const QString& condition) +: QObject () +{ + construct (area, original_linenr, type, editor_linenr, condition); +} - marker::marker (QsciScintilla *area, int original_linenr, - editor_markers type, const QString& condition) - : QObject () - { - construct (area, original_linenr, type, original_linenr - 1, condition); - } +marker::marker (QsciScintilla *area, int original_linenr, + editor_markers type, const QString& condition) + : QObject () +{ + construct (area, original_linenr, type, original_linenr - 1, condition); +} - void marker::construct (QsciScintilla *area, int original_linenr, - editor_markers type, int editor_linenr, - const QString& condition) - { - m_edit_area = area; - m_original_linenr = original_linenr; - m_marker_type = type; - m_mhandle = m_edit_area->markerAdd (editor_linenr, m_marker_type); - m_condition = condition; - } +void marker::construct (QsciScintilla *area, int original_linenr, + editor_markers type, int editor_linenr, + const QString& condition) +{ + m_edit_area = area; + m_original_linenr = original_linenr; + m_marker_type = type; + m_mhandle = m_edit_area->markerAdd (editor_linenr, m_marker_type); + m_condition = condition; +} - void marker::handle_remove_via_original_linenr (int linenr) - { - if (m_original_linenr == linenr) - { - m_edit_area->markerDeleteHandle (m_mhandle); - delete this; - } - } +void marker::handle_remove_via_original_linenr (int linenr) +{ + if (m_original_linenr == linenr) + { + m_edit_area->markerDeleteHandle (m_mhandle); + delete this; + } +} - void marker::handle_request_remove_via_editor_linenr (int linenr) - { - // Get line number from the edit area and if it matches - // the requested line number, remove. - if (m_edit_area->markerLine (m_mhandle) == linenr) - { - // Rather than delete editor marker directly, issue command - // to Octave core. Octave core should signal back to remove - // this breakpoint via debugger line number. - emit request_remove (m_original_linenr); - } - } +void marker::handle_request_remove_via_editor_linenr (int linenr) +{ + // Get line number from the edit area and if it matches + // the requested line number, remove. + if (m_edit_area->markerLine (m_mhandle) == linenr) + { + // Rather than delete editor marker directly, issue command + // to Octave core. Octave core should signal back to remove + // this breakpoint via debugger line number. + emit request_remove (m_original_linenr); + } +} - void marker::handle_remove (void) - { - m_edit_area->markerDeleteHandle (m_mhandle); - delete this; - } +void marker::handle_remove (void) +{ + m_edit_area->markerDeleteHandle (m_mhandle); + delete this; +} - void marker::handle_find_translation (int linenr, int& translation_linenr, - marker *&bp) - { - if (m_original_linenr == linenr) - { - translation_linenr = m_edit_area->markerLine (m_mhandle); - bp = this; - } - } +void marker::handle_find_translation (int linenr, int& translation_linenr, + marker *&bp) +{ + if (m_original_linenr == linenr) + { + translation_linenr = m_edit_area->markerLine (m_mhandle); + bp = this; + } +} - void marker::handle_find_just_before (int linenr, int& original_linenr, - int& editor_linenr) - { - if (m_original_linenr < linenr && m_original_linenr >= original_linenr) - { - original_linenr = m_original_linenr; - editor_linenr = m_edit_area->markerLine (m_mhandle); - } - } +void marker::handle_find_just_before (int linenr, int& original_linenr, + int& editor_linenr) +{ + if (m_original_linenr < linenr && m_original_linenr >= original_linenr) + { + original_linenr = m_original_linenr; + editor_linenr = m_edit_area->markerLine (m_mhandle); + } +} - void marker::handle_find_just_after (int linenr, int& original_linenr, - int& editor_linenr) - { - if (m_original_linenr > linenr && m_original_linenr <= original_linenr) - { - original_linenr = m_original_linenr; - editor_linenr = m_edit_area->markerLine (m_mhandle); - } - } +void marker::handle_find_just_after (int linenr, int& original_linenr, + int& editor_linenr) +{ + if (m_original_linenr > linenr && m_original_linenr <= original_linenr) + { + original_linenr = m_original_linenr; + editor_linenr = m_edit_area->markerLine (m_mhandle); + } +} - void marker::handle_report_editor_linenr (QIntList& lines, - QStringList& conditions) - { - lines << m_edit_area->markerLine (m_mhandle); - conditions << m_condition; - } +void marker::handle_report_editor_linenr (QIntList& lines, + QStringList& conditions) +{ + lines << m_edit_area->markerLine (m_mhandle); + conditions << m_condition; +} - void marker::handle_marker_line_deleted (int mhandle) - { - // FUTURE SUPPORT: There really should be a signal in QsciScintilla - // called markerLineDeleted (int mhandle) because there is no way - // of knowing this. QsciScintilla will place the marker at a - // different line rather than remove it from the margin. I (DJS) will - // lobby for such a signal. - if (m_mhandle == mhandle) - { - if (m_marker_type == breakpoint || m_marker_type == debugger_position) - { - int editor_linenr = m_edit_area->markerLine (m_mhandle); - m_edit_area->markerDeleteHandle (m_mhandle); - m_marker_type = (m_marker_type == breakpoint - ? unsure_breakpoint : unsure_debugger_position); - m_mhandle = m_edit_area->markerAdd (editor_linenr, m_marker_type); - } - } - } +void marker::handle_marker_line_deleted (int mhandle) +{ + // FUTURE SUPPORT: There really should be a signal in QsciScintilla + // called markerLineDeleted (int mhandle) because there is no way + // of knowing this. QsciScintilla will place the marker at a + // different line rather than remove it from the margin. I (DJS) will + // lobby for such a signal. + if (m_mhandle == mhandle) + { + if (m_marker_type == breakpoint || m_marker_type == debugger_position) + { + int editor_linenr = m_edit_area->markerLine (m_mhandle); + m_edit_area->markerDeleteHandle (m_mhandle); + m_marker_type = (m_marker_type == breakpoint + ? unsure_breakpoint : unsure_debugger_position); + m_mhandle = m_edit_area->markerAdd (editor_linenr, m_marker_type); + } + } +} - void marker::handle_marker_line_undeleted (int mhandle) - { - // FUTURE SUPPORT: There really should be a signal in QsciScintilla - // called markerLineUndeleted (int mhandle) because there is no way - // of knowing this. QsciScintilla will place the marker at a - // different line rather than remove it from the margin. I (DJS) will - // lobby for such a signal. - if (m_mhandle == mhandle) - { - if (m_marker_type == unsure_breakpoint - || m_marker_type == unsure_debugger_position) - { - int editor_linenr = m_edit_area->markerLine (m_mhandle); - m_edit_area->markerDeleteHandle (m_mhandle); - m_marker_type = (m_marker_type == unsure_breakpoint - ? breakpoint : debugger_position); - m_mhandle = m_edit_area->markerAdd (editor_linenr, m_marker_type); - } - } - } +void marker::handle_marker_line_undeleted (int mhandle) +{ + // FUTURE SUPPORT: There really should be a signal in QsciScintilla + // called markerLineUndeleted (int mhandle) because there is no way + // of knowing this. QsciScintilla will place the marker at a + // different line rather than remove it from the margin. I (DJS) will + // lobby for such a signal. + if (m_mhandle == mhandle) + { + if (m_marker_type == unsure_breakpoint + || m_marker_type == unsure_debugger_position) + { + int editor_linenr = m_edit_area->markerLine (m_mhandle); + m_edit_area->markerDeleteHandle (m_mhandle); + m_marker_type = (m_marker_type == unsure_breakpoint + ? breakpoint : debugger_position); + m_mhandle = m_edit_area->markerAdd (editor_linenr, m_marker_type); + } + } +} OCTAVE_END_NAMESPACE(octave) #endif diff -r 431f80aba37a -r deb553ac2c54 libgui/src/m-editor/marker.h --- a/libgui/src/m-editor/marker.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/m-editor/marker.h Tue Dec 06 15:45:27 2022 -0500 @@ -41,16 +41,16 @@ OCTAVE_BEGIN_NAMESPACE(octave) - class marker : public QObject - { - Q_OBJECT +class marker : public QObject +{ + Q_OBJECT - public: +public: - // List of all marker types - // If multiple markers are on the same line, the first one listed - // is drawn at the back, so big ones should be first. - enum editor_markers + // List of all marker types + // If multiple markers are on the same line, the first one listed + // is drawn at the back, so big ones should be first. + enum editor_markers { breakpoint, cond_break, @@ -61,51 +61,51 @@ selection }; - marker (QsciScintilla *edit_area, int original_linenr, - editor_markers marker_type, const QString& condition = ""); + marker (QsciScintilla *edit_area, int original_linenr, + editor_markers marker_type, const QString& condition = ""); - marker (QsciScintilla *edit_area, int original_linenr, - editor_markers marker_type, int editor_linenr, - const QString& condition = ""); + marker (QsciScintilla *edit_area, int original_linenr, + editor_markers marker_type, int editor_linenr, + const QString& condition = ""); - ~marker (void) = default; + ~marker (void) = default; - const QString& get_cond (void) const { return m_condition; } + const QString& get_cond (void) const { return m_condition; } - void set_cond (const QString& cond) { m_condition = cond; } + void set_cond (const QString& cond) { m_condition = cond; } - signals: +signals: - void request_remove (int original_linenr); + void request_remove (int original_linenr); - public slots: +public slots: - void handle_remove_via_original_linenr (int original_linenr); - void handle_request_remove_via_editor_linenr (int editor_linenr); - void handle_remove (void); - void handle_find_translation (int original_linenr, int& editor_linenr, - marker*& bp); - void handle_find_just_before (int linenr, int& original_linenr, - int& editor_linenr); - void handle_find_just_after (int linenr, int& original_linenr, - int& editor_linenr); - /* void handle_lines_changed (void);*/ - void handle_marker_line_deleted (int mhandle); - void handle_marker_line_undeleted (int mhandle); - void handle_report_editor_linenr (QIntList& lines, QStringList& conditions); + void handle_remove_via_original_linenr (int original_linenr); + void handle_request_remove_via_editor_linenr (int editor_linenr); + void handle_remove (void); + void handle_find_translation (int original_linenr, int& editor_linenr, + marker*& bp); + void handle_find_just_before (int linenr, int& original_linenr, + int& editor_linenr); + void handle_find_just_after (int linenr, int& original_linenr, + int& editor_linenr); + /* void handle_lines_changed (void);*/ + void handle_marker_line_deleted (int mhandle); + void handle_marker_line_undeleted (int mhandle); + void handle_report_editor_linenr (QIntList& lines, QStringList& conditions); - private: +private: - void construct (QsciScintilla *edit_area, int original_linenr, - editor_markers marker_type, int editor_linenr, - const QString& condition); + void construct (QsciScintilla *edit_area, int original_linenr, + editor_markers marker_type, int editor_linenr, + const QString& condition); - QsciScintilla *m_edit_area; - int m_original_linenr; - editor_markers m_marker_type; - int m_mhandle; - QString m_condition; - }; + QsciScintilla *m_edit_area; + int m_original_linenr; + editor_markers m_marker_type; + int m_mhandle; + QString m_condition; +}; OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/m-editor/octave-qscintilla.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/m-editor/octave-qscintilla.h --- a/libgui/src/m-editor/octave-qscintilla.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/m-editor/octave-qscintilla.h Tue Dec 06 15:45:27 2022 -0500 @@ -38,123 +38,123 @@ OCTAVE_BEGIN_NAMESPACE(octave) - class base_qobject; +class base_qobject; - class octave_qscintilla : public QsciScintilla - { - Q_OBJECT +class octave_qscintilla : public QsciScintilla +{ + Q_OBJECT - public: +public: - octave_qscintilla (QWidget *p, base_qobject& oct_qobj); + octave_qscintilla (QWidget *p, base_qobject& oct_qobj); - ~octave_qscintilla (void) = default; + ~octave_qscintilla (void) = default; - enum + enum { ST_NONE = 0, ST_LINE_COMMENT, ST_BLOCK_COMMENT }; - virtual void contextMenuEvent (QContextMenuEvent *e); - virtual void setCursorPosition (int line, int col); + virtual void contextMenuEvent (QContextMenuEvent *e); + virtual void setCursorPosition (int line, int col); - void context_help_doc (bool); - void context_edit (void); - void context_run (void); - void get_global_textcursor_pos (QPoint *global_pos, QPoint *local_pos); - bool get_actual_word (void); - void clear_selection_markers (void); - QString eol_string (void); - void get_current_position (int *pos, int *line, int *col); - QStringList comment_string (bool comment = true); - int get_style (int pos = -1); - int is_style_comment (int pos = -1); - void smart_indent (bool do_smart_indent, int do_auto_close, - int line, int ind_char_width); + void context_help_doc (bool); + void context_edit (void); + void context_run (void); + void get_global_textcursor_pos (QPoint *global_pos, QPoint *local_pos); + bool get_actual_word (void); + void clear_selection_markers (void); + QString eol_string (void); + void get_current_position (int *pos, int *line, int *col); + QStringList comment_string (bool comment = true); + int get_style (int pos = -1); + int is_style_comment (int pos = -1); + void smart_indent (bool do_smart_indent, int do_auto_close, + int line, int ind_char_width); - void smart_indent_line_or_selected_text (int lineFrom, int lineTo); + void smart_indent_line_or_selected_text (int lineFrom, int lineTo); - void set_word_selection (const QString& word = QString ()); + void set_word_selection (const QString& word = QString ()); - void show_selection_markers (int l1, int c1, int l2, int c2); + void show_selection_markers (int l1, int c1, int l2, int c2); - void set_selection_marker_color (const QColor& c); + void set_selection_marker_color (const QColor& c); - void replace_all (const QString& o_str, const QString& n_str, - bool re, bool cs, bool wo); + void replace_all (const QString& o_str, const QString& n_str, + bool re, bool cs, bool wo); - signals: +signals: - void update_rowcol_indicator_signal (int line, int col); - void execute_command_in_terminal_signal (const QString&); - void create_context_menu_signal (QMenu *); - void context_menu_edit_signal (const QString&); - void qsci_has_focus_signal (bool); - void status_update (bool, bool); - void show_doc_signal (const QString&); - void context_menu_break_condition_signal (int); - void context_menu_break_once (int); - void ctx_menu_run_finished_signal (bool, int, QTemporaryFile *, - QTemporaryFile *, bool, bool); - void focus_console_after_command_signal (void); + void update_rowcol_indicator_signal (int line, int col); + void execute_command_in_terminal_signal (const QString&); + void create_context_menu_signal (QMenu *); + void context_menu_edit_signal (const QString&); + void qsci_has_focus_signal (bool); + void status_update (bool, bool); + void show_doc_signal (const QString&); + void context_menu_break_condition_signal (int); + void context_menu_break_once (int); + void ctx_menu_run_finished_signal (bool, int, QTemporaryFile *, + QTemporaryFile *, bool, bool); + void focus_console_after_command_signal (void); - void interpreter_event (const fcn_callback& fcn); - void interpreter_event (const meth_callback& meth); + void interpreter_event (const fcn_callback& fcn); + void interpreter_event (const meth_callback& meth); - public slots: +public slots: - void handle_enter_debug_mode (void); - void handle_exit_debug_mode (void); + void handle_enter_debug_mode (void); + void handle_exit_debug_mode (void); - private slots: +private slots: - void ctx_menu_run_finished (bool, int, QTemporaryFile *, QTemporaryFile *, - bool, bool); + void ctx_menu_run_finished (bool, int, QTemporaryFile *, QTemporaryFile *, + bool, bool); - void contextmenu_help (bool); - void contextmenu_doc (bool); - void contextmenu_help_doc (bool); - void contextmenu_edit (bool); - void contextmenu_run (bool); - void contextmenu_run_temp_error (void); + void contextmenu_help (bool); + void contextmenu_doc (bool); + void contextmenu_help_doc (bool); + void contextmenu_edit (bool); + void contextmenu_run (bool); + void contextmenu_run_temp_error (void); - void contextmenu_break_condition (bool); - void contextmenu_break_once (const QPoint&); + void contextmenu_break_condition (bool); + void contextmenu_break_once (const QPoint&); - void text_changed (void); - void cursor_position_changed (int, int); + void text_changed (void); + void cursor_position_changed (int, int); - protected: +protected: - void focusInEvent (QFocusEvent *focusEvent); + void focusInEvent (QFocusEvent *focusEvent); - void show_replace_action_tooltip (void); + void show_replace_action_tooltip (void); - bool event (QEvent *e); + bool event (QEvent *e); - void keyPressEvent (QKeyEvent *e); + void keyPressEvent (QKeyEvent *e); - void dragEnterEvent (QDragEnterEvent *e); + void dragEnterEvent (QDragEnterEvent *e); - private: +private: - void auto_close (int auto_endif, int l, - const QString& line, QString& first_word); + void auto_close (int auto_endif, int l, + const QString& line, QString& first_word); - base_qobject& m_octave_qobj; + base_qobject& m_octave_qobj; - bool m_debug_mode; + bool m_debug_mode; - QString m_word_at_cursor; + QString m_word_at_cursor; - QString m_selection; - QString m_selection_replacement; - int m_selection_line; - int m_selection_col; - int m_indicator_id; - }; + QString m_selection; + QString m_selection_replacement; + int m_selection_line; + int m_selection_col; + int m_indicator_id; +}; OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/m-editor/octave-txt-lexer.cc --- a/libgui/src/m-editor/octave-txt-lexer.cc Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/m-editor/octave-txt-lexer.cc Tue Dec 06 15:45:27 2022 -0500 @@ -35,23 +35,23 @@ OCTAVE_BEGIN_NAMESPACE(octave) - QString octave_txt_lexer::description (int style) const - { - if (style == 0) - return tr ("Default"); - else - return QString (); - }; +QString octave_txt_lexer::description (int style) const +{ + if (style == 0) + return tr ("Default"); + else + return QString (); +}; - const char * octave_txt_lexer::language (void) const - { - return "Text"; - } +const char * octave_txt_lexer::language (void) const +{ + return "Text"; +} - const char * octave_txt_lexer::lexer (void) const - { - return "text"; - } +const char * octave_txt_lexer::lexer (void) const +{ + return "text"; +} OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/m-editor/octave-txt-lexer.h --- a/libgui/src/m-editor/octave-txt-lexer.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/m-editor/octave-txt-lexer.h Tue Dec 06 15:45:27 2022 -0500 @@ -31,18 +31,18 @@ OCTAVE_BEGIN_NAMESPACE(octave) - class octave_txt_lexer : public QsciLexer - { - Q_OBJECT +class octave_txt_lexer : public QsciLexer +{ + Q_OBJECT - public: +public: - virtual const char * language (void) const; + virtual const char * language (void) const; - virtual const char * lexer (void) const; + virtual const char * lexer (void) const; - virtual QString description (int style) const; - }; + virtual QString description (int style) const; +}; OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/main-window.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/main-window.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/news-reader.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/news-reader.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/octave-dock-widget.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/octave-dock-widget.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/octave-qobject.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/octave-qobject.h --- a/libgui/src/octave-qobject.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/octave-qobject.h Tue Dec 06 15:45:27 2022 -0500 @@ -40,280 +40,280 @@ OCTAVE_BEGIN_NAMESPACE(octave) - class community_news; - class main_window; - class qt_application; - class qt_interpreter_events; - class release_notes; +class community_news; +class main_window; +class qt_application; +class qt_interpreter_events; +class release_notes; - //! This class is a simple wrapper around QApplication so that we can - //! reimplement QApplication::notify. The octave_qapplication object - //! should behave identically to a QApplication object except that it - //! overrides the notify method so we can handle forward Octave - //! execution_exception exceptions from the GUI thread to the - //! interpreter thread. +//! This class is a simple wrapper around QApplication so that we can +//! reimplement QApplication::notify. The octave_qapplication object +//! should behave identically to a QApplication object except that it +//! overrides the notify method so we can handle forward Octave +//! execution_exception exceptions from the GUI thread to the +//! interpreter thread. - class octave_qapplication : public QApplication - { - Q_OBJECT +class octave_qapplication : public QApplication +{ + Q_OBJECT - public: +public: - octave_qapplication (int& argc, char **argv) - : QApplication (argc, argv) - { } + octave_qapplication (int& argc, char **argv) + : QApplication (argc, argv) + { } - virtual bool notify (QObject *receiver, QEvent *e) override; + virtual bool notify (QObject *receiver, QEvent *e) override; - ~octave_qapplication (void) { }; + ~octave_qapplication (void) { }; - signals: +signals: - void interpreter_event (const fcn_callback& fcn); - void interpreter_event (const meth_callback& meth); - }; + void interpreter_event (const fcn_callback& fcn); + void interpreter_event (const meth_callback& meth); +}; - //! Container for windows that may be created from the command line or - //! docked with the main GUI window. Any of these windows that are - //! created in command line mode will be adopted by the main window if - //! it is opened from the command line. Any that are undocked from - //! the main window will remain open if control returns to the command - //! line. +//! Container for windows that may be created from the command line or +//! docked with the main GUI window. Any of these windows that are +//! created in command line mode will be adopted by the main window if +//! it is opened from the command line. Any that are undocked from +//! the main window will remain open if control returns to the command +//! line. - class base_qobject; - class documentation_dock_widget; - class file_editor_interface; - class files_dock_widget; - class history_dock_widget; - class terminal_dock_widget; - class variable_editor; - class workspace_model; - class workspace_view; +class base_qobject; +class documentation_dock_widget; +class file_editor_interface; +class files_dock_widget; +class history_dock_widget; +class terminal_dock_widget; +class variable_editor; +class workspace_model; +class workspace_view; - //! Base class for Octave interfaces that use Qt. There are two - //! classes derived from this one. One provides a command-line - //! interface that may use Qt graphics and another provides the - //! full GUI experience. +//! Base class for Octave interfaces that use Qt. There are two +//! classes derived from this one. One provides a command-line +//! interface that may use Qt graphics and another provides the +//! full GUI experience. - class base_qobject : public QObject - { - Q_OBJECT +class base_qobject : public QObject +{ + Q_OBJECT - public: +public: - // Note: the GUI_APP argument is not needed with the new - // experimental terminal widget. - base_qobject (qt_application& app_context, bool gui_app = false); + // Note: the GUI_APP argument is not needed with the new + // experimental terminal widget. + base_qobject (qt_application& app_context, bool gui_app = false); - ~base_qobject (void); + ~base_qobject (void); - void config_translators (void); + void config_translators (void); - void start_main_thread (void); + void start_main_thread (void); - int exec (void); + int exec (void); - // The Octave application context. - qt_application& app_context (void) { return m_app_context; } + // The Octave application context. + qt_application& app_context (void) { return m_app_context; } - // The Qt QApplication. - QApplication * qapplication (void) { return m_qapplication; }; + // The Qt QApplication. + QApplication * qapplication (void) { return m_qapplication; }; - // Provided for convenience. Will be removed once we eliminate the - // old terminal widget. - bool experimental_terminal_widget (void) const; + // Provided for convenience. Will be removed once we eliminate the + // old terminal widget. + bool experimental_terminal_widget (void) const; - // Provided for convenience. - bool gui_running (void) const; + // Provided for convenience. + bool gui_running (void) const; - bool have_terminal_window (void) const - { - return ! m_terminal_widget.isNull (); - } + bool have_terminal_window (void) const + { + return ! m_terminal_widget.isNull (); + } - main_window * get_main_window (void) - { - return m_main_window; - } + main_window * get_main_window (void) + { + return m_main_window; + } - resource_manager& get_resource_manager (void) - { - return m_resource_manager; - } + resource_manager& get_resource_manager (void) + { + return m_resource_manager; + } - shortcut_manager& get_shortcut_manager (void) - { - return m_shortcut_manager; - } + shortcut_manager& get_shortcut_manager (void) + { + return m_shortcut_manager; + } - std::shared_ptr get_qt_interpreter_events (void) - { - return m_qt_interpreter_events; - } + std::shared_ptr get_qt_interpreter_events (void) + { + return m_qt_interpreter_events; + } - qt_interpreter_events * qt_link (void) - { - return m_qt_interpreter_events.get (); - } + qt_interpreter_events * qt_link (void) + { + return m_qt_interpreter_events.get (); + } - interpreter_qobject * interpreter_qobj (void) - { - return m_interpreter_qobj; - } + interpreter_qobject * interpreter_qobj (void) + { + return m_interpreter_qobj; + } - workspace_model * get_workspace_model (void) - { - return m_workspace_model; - } + workspace_model * get_workspace_model (void) + { + return m_workspace_model; + } - QPointer - terminal_widget (main_window *mw = nullptr); + QPointer + terminal_widget (main_window *mw = nullptr); - QPointer - documentation_widget (main_window *mw = nullptr); + QPointer + documentation_widget (main_window *mw = nullptr); - QPointer - file_browser_widget (main_window *mw = nullptr); + QPointer + file_browser_widget (main_window *mw = nullptr); - QPointer - history_widget (main_window *mw = nullptr); + QPointer + history_widget (main_window *mw = nullptr); - QPointer - workspace_widget (main_window *mw = nullptr); + QPointer + workspace_widget (main_window *mw = nullptr); - // FIXME: The file_editor_interface needs to be a proper generic - // interface for all editors (internal and external) for this to - // work properly. - QPointer - editor_widget (main_window *mw = nullptr); + // FIXME: The file_editor_interface needs to be a proper generic + // interface for all editors (internal and external) for this to + // work properly. + QPointer + editor_widget (main_window *mw = nullptr); - QPointer - variable_editor_widget (main_window *mw = nullptr); + QPointer + variable_editor_widget (main_window *mw = nullptr); - QPointer community_news_widget (int serial = -1); + QPointer community_news_widget (int serial = -1); - QPointer release_notes_widget (void); + QPointer release_notes_widget (void); - QThread * main_thread (void) { return m_main_thread; } + QThread * main_thread (void) { return m_main_thread; } - // Declared virtual so that a derived class may redefine this - // method. + // Declared virtual so that a derived class may redefine this + // method. - virtual bool confirm_shutdown (void); + virtual bool confirm_shutdown (void); - bool is_gui_app (void) const { return m_gui_app; } + bool is_gui_app (void) const { return m_gui_app; } - template void connect_interpreter_events (T *widget) - { - connect (widget, QOverload::of (&T::interpreter_event), - this, QOverload::of (&base_qobject::interpreter_event)); + template void connect_interpreter_events (T *widget) + { + connect (widget, QOverload::of (&T::interpreter_event), + this, QOverload::of (&base_qobject::interpreter_event)); - connect (widget, QOverload::of (&T::interpreter_event), - this, QOverload::of (&base_qobject::interpreter_event)); - } + connect (widget, QOverload::of (&T::interpreter_event), + this, QOverload::of (&base_qobject::interpreter_event)); + } - public slots: +public slots: - void execute_command (const QString& command); + void execute_command (const QString& command); - // Note: START_GUI and CLOSE_GUI don't currently perform any work - // with the old terminal widget. - void start_gui (bool gui_app); - void close_gui (void); + // Note: START_GUI and CLOSE_GUI don't currently perform any work + // with the old terminal widget. + void start_gui (bool gui_app); + void close_gui (void); - void show_terminal_window (void); + void show_terminal_window (void); - void show_documentation_window (const QString& file); + void show_documentation_window (const QString& file); - void show_file_browser_window (void); + void show_file_browser_window (void); - void show_command_history_window (void); + void show_command_history_window (void); - void show_workspace_window (void); + void show_workspace_window (void); - void show_variable_editor_window (const QString& name, - const octave_value& value); + void show_variable_editor_window (const QString& name, + const octave_value& value); - void handle_variable_editor_update (void); + void handle_variable_editor_update (void); - void show_community_news (int serial); + void show_community_news (int serial); - void show_release_notes (void); + void show_release_notes (void); - void interpreter_ready (void); + void interpreter_ready (void); - void interpreter_event (const fcn_callback& fcn); + void interpreter_event (const fcn_callback& fcn); - void interpreter_event (const meth_callback& meth); + void interpreter_event (const meth_callback& meth); - void interpreter_interrupt (void); + void interpreter_interrupt (void); - // Note: these currently only work with the new experimental - // terminal widget. - void interpreter_pause (void); - void interpreter_stop (void); - void interpreter_resume (void); + // Note: these currently only work with the new experimental + // terminal widget. + void interpreter_pause (void); + void interpreter_stop (void); + void interpreter_resume (void); - void copy_image_to_clipboard (const QString& file, bool remove_file); + void copy_image_to_clipboard (const QString& file, bool remove_file); - protected: +protected: - qt_application& m_app_context; + qt_application& m_app_context; - // Use these to ensure that argc and argv exist for as long as the - // QApplication object. + // Use these to ensure that argc and argv exist for as long as the + // QApplication object. - int m_argc; - char **m_argv; + int m_argc; + char **m_argv; - octave_qapplication *m_qapplication; + octave_qapplication *m_qapplication; - resource_manager m_resource_manager; + resource_manager m_resource_manager; - shortcut_manager m_shortcut_manager; + shortcut_manager m_shortcut_manager; - QTranslator *m_qt_tr; - QTranslator *m_gui_tr; - QTranslator *m_qsci_tr; + QTranslator *m_qt_tr; + QTranslator *m_gui_tr; + QTranslator *m_qsci_tr; - bool m_translators_installed; + bool m_translators_installed; - std::shared_ptr m_qt_interpreter_events; + std::shared_ptr m_qt_interpreter_events; - interpreter_qobject *m_interpreter_qobj; + interpreter_qobject *m_interpreter_qobj; - QThread *m_main_thread; + QThread *m_main_thread; - bool m_gui_app; + bool m_gui_app; - bool m_interpreter_ready; + bool m_interpreter_ready; - workspace_model *m_workspace_model; + workspace_model *m_workspace_model; - // Dock widgets that may be used from the command line. They are - // adopted by the desktop (main window) if it is also started from - // the command line. + // Dock widgets that may be used from the command line. They are + // adopted by the desktop (main window) if it is also started from + // the command line. - QPointer m_terminal_widget; + QPointer m_terminal_widget; - QPointer m_documentation_widget; + QPointer m_documentation_widget; - QPointer m_file_browser_widget; + QPointer m_file_browser_widget; - QPointer m_history_widget; + QPointer m_history_widget; - QPointer m_workspace_widget; + QPointer m_workspace_widget; - QPointer m_editor_widget; + QPointer m_editor_widget; - QPointer m_variable_editor_widget; + QPointer m_variable_editor_widget; - QPointer m_community_news; + QPointer m_community_news; - QPointer m_release_notes; + QPointer m_release_notes; - main_window *m_main_window; - }; + main_window *m_main_window; +}; OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/qt-application.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/qt-application.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/qt-interpreter-events.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/qt-interpreter-events.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/qt-utils.h --- a/libgui/src/qt-utils.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/qt-utils.h Tue Dec 06 15:45:27 2022 -0500 @@ -33,37 +33,37 @@ OCTAVE_BEGIN_NAMESPACE(octave) - template - inline QList - std_list_to_qt_list (const std::list& lst) - { +template +inline QList +std_list_to_qt_list (const std::list& lst) +{ #if defined (HAVE_QLIST_ITERATOR_CONSTRUCTOR) - return QList (lst.begin (), lst.end ()); + return QList (lst.begin (), lst.end ()); #else - return QList::fromStdList (lst); + return QList::fromStdList (lst); #endif - } +} - inline int - qt_fontmetrics_horizontal_advance (const QFontMetrics& fm, QChar ch) - { +inline int +qt_fontmetrics_horizontal_advance (const QFontMetrics& fm, QChar ch) +{ #if defined (HAVE_QFONTMETRICS_HORIZONTAL_ADVANCE) - return fm.horizontalAdvance (ch); + return fm.horizontalAdvance (ch); #else - return fm.width (ch); + return fm.width (ch); #endif - } +} - inline int - qt_fontmetrics_horizontal_advance (const QFontMetrics& fm, - const QString& text, int len = -1) - { +inline int +qt_fontmetrics_horizontal_advance (const QFontMetrics& fm, + const QString& text, int len = -1) +{ #if defined (HAVE_QFONTMETRICS_HORIZONTAL_ADVANCE) - return fm.horizontalAdvance (text, len); + return fm.horizontalAdvance (text, len); #else - return fm.width (text, len); + return fm.width (text, len); #endif - } +} OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/release-notes.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/release-notes.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/resource-manager.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/resource-manager.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/set-path-dialog.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/set-path-dialog.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/set-path-model.cc --- a/libgui/src/set-path-model.cc Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/set-path-model.cc Tue Dec 06 15:45:27 2022 -0500 @@ -44,283 +44,283 @@ OCTAVE_BEGIN_NAMESPACE(octave) - set_path_model::set_path_model (QObject *p) - : QAbstractListModel (p) - { - connect (this, &set_path_model::update_data_signal, - this, &set_path_model::update_data); +set_path_model::set_path_model (QObject *p) +: QAbstractListModel (p) +{ + connect (this, &set_path_model::update_data_signal, + this, &set_path_model::update_data); - m_revertible = false; - } + m_revertible = false; +} - std::string set_path_model::to_string (void) - { - std::string path_sep = directory_path::path_sep_str (); +std::string set_path_model::to_string (void) +{ + std::string path_sep = directory_path::path_sep_str (); - std::string path_str; + std::string path_str; - QStringList::iterator it = m_dirs.begin (); + QStringList::iterator it = m_dirs.begin (); - while (it < m_dirs.end ()) - { - if (it != m_dirs.begin ()) - path_str += path_sep; - path_str += it->toStdString (); - ++it; - } + while (it < m_dirs.end ()) + { + if (it != m_dirs.begin ()) + path_str += path_sep; + path_str += it->toStdString (); + ++it; + } - return path_str; - } + return path_str; +} - void set_path_model::model_to_path (void) - { - std::string path_str = to_string (); +void set_path_model::model_to_path (void) +{ + std::string path_str = to_string (); - emit interpreter_event - ([=] (interpreter& interp) - { - // INTERPRETER THREAD + emit interpreter_event + ([=] (interpreter& interp) + { + // INTERPRETER THREAD - load_path& lp = interp.get_load_path (); + load_path& lp = interp.get_load_path (); - lp.set (path_str); - }); - } + lp.set (path_str); + }); +} - void set_path_model::clear (void) - { - beginResetModel (); +void set_path_model::clear (void) +{ + beginResetModel (); - m_dirs.clear (); + m_dirs.clear (); - endResetModel (); - } + endResetModel (); +} - void set_path_model::save (void) - { - model_to_path (); +void set_path_model::save (void) +{ + model_to_path (); - emit interpreter_event - ([] (interpreter& interp) - { - // INTERPRETER THREAD + emit interpreter_event + ([] (interpreter& interp) + { + // INTERPRETER THREAD - interp.feval ("savepath"); - }); - } + interp.feval ("savepath"); + }); +} - void set_path_model::revert (void) - { - clear (); +void set_path_model::revert (void) +{ + clear (); - beginInsertRows (QModelIndex (), 0, m_orig_dirs.size () - 1); - m_dirs = m_orig_dirs; - endInsertRows (); + beginInsertRows (QModelIndex (), 0, m_orig_dirs.size () - 1); + m_dirs = m_orig_dirs; + endInsertRows (); - model_to_path (); - } + model_to_path (); +} - void set_path_model::revert_last (void) - { - clear (); +void set_path_model::revert_last (void) +{ + clear (); - beginInsertRows (QModelIndex (), 0, m_last_dirs.size () - 1); - m_dirs = m_last_dirs; - endInsertRows (); + beginInsertRows (QModelIndex (), 0, m_last_dirs.size () - 1); + m_dirs = m_last_dirs; + endInsertRows (); - model_to_path (); - } + model_to_path (); +} - void set_path_model::add_dir (const QString& p) - { - m_last_dirs = m_dirs; +void set_path_model::add_dir (const QString& p) +{ + m_last_dirs = m_dirs; - beginInsertRows (QModelIndex (), m_dirs.size (), m_dirs.size ()); + beginInsertRows (QModelIndex (), m_dirs.size (), m_dirs.size ()); - QList::Iterator it = m_dirs.begin(); + QList::Iterator it = m_dirs.begin(); - m_dirs.insert (it, p); + m_dirs.insert (it, p); - endInsertRows (); + endInsertRows (); - model_to_path (); - } + model_to_path (); +} - void set_path_model::rm_dir (const QModelIndexList& indices) - { - m_last_dirs = m_dirs; +void set_path_model::rm_dir (const QModelIndexList& indices) +{ + m_last_dirs = m_dirs; - for (int i = indices.size () - 1; i >= 0; i--) - { - const QModelIndex& idx = indices.at (i); + for (int i = indices.size () - 1; i >= 0; i--) + { + const QModelIndex& idx = indices.at (i); - beginRemoveRows (idx, idx.row (), idx.row ()); - m_dirs.removeAt (idx.row ()); - endRemoveRows (); - } + beginRemoveRows (idx, idx.row (), idx.row ()); + m_dirs.removeAt (idx.row ()); + endRemoveRows (); + } - model_to_path (); - } + model_to_path (); +} - void set_path_model::move_dir_up (const QModelIndexList& indices) - { - m_last_dirs = m_dirs; +void set_path_model::move_dir_up (const QModelIndexList& indices) +{ + m_last_dirs = m_dirs; - for (int i = 0; i < indices.size (); i++) - { - const QModelIndex& idx = indices.at (i); + for (int i = 0; i < indices.size (); i++) + { + const QModelIndex& idx = indices.at (i); - if (idx.row () == 0 ) - continue; // already at top position + if (idx.row () == 0 ) + continue; // already at top position - beginMoveRows (idx, idx.row (), idx.row (), - this->index (idx.row () - 1), idx.row () - 1); + beginMoveRows (idx, idx.row (), idx.row (), + this->index (idx.row () - 1), idx.row () - 1); - m_dirs.move (idx.row (), idx.row () - 1); + m_dirs.move (idx.row (), idx.row () - 1); - endMoveRows (); - } + endMoveRows (); + } - model_to_path (); - } + model_to_path (); +} - void set_path_model::move_dir_down (const QModelIndexList& indices) - { - m_last_dirs = m_dirs; +void set_path_model::move_dir_down (const QModelIndexList& indices) +{ + m_last_dirs = m_dirs; - for (int i = indices.size () - 1; i >= 0; i--) - { - const QModelIndex& idx = indices.at (i); - int bottom = m_dirs.size () - 1; + for (int i = indices.size () - 1; i >= 0; i--) + { + const QModelIndex& idx = indices.at (i); + int bottom = m_dirs.size () - 1; - if (idx.row () >= bottom) - continue; // already at bottom position + if (idx.row () >= bottom) + continue; // already at bottom position - beginMoveRows (idx, idx.row (), idx.row (), - this->index (idx.row () + 1), idx.row () + 1); + beginMoveRows (idx, idx.row (), idx.row (), + this->index (idx.row () + 1), idx.row () + 1); - m_dirs.move (idx.row (), idx.row () + 1); + m_dirs.move (idx.row (), idx.row () + 1); - endMoveRows (); - } + endMoveRows (); + } - model_to_path (); - } + model_to_path (); +} - void set_path_model::move_dir_top (const QModelIndexList& indices) - { - m_last_dirs = m_dirs; +void set_path_model::move_dir_top (const QModelIndexList& indices) +{ + m_last_dirs = m_dirs; - for (int i = 0; i < indices.size (); i++) - { - const QModelIndex& idx = indices.at (i); + for (int i = 0; i < indices.size (); i++) + { + const QModelIndex& idx = indices.at (i); - if (idx.row () == i) - continue; // already at target position + if (idx.row () == i) + continue; // already at target position - beginMoveRows (idx, idx.row (), idx.row (), this->index (i), i); + beginMoveRows (idx, idx.row (), idx.row (), this->index (i), i); - m_dirs.move (idx.row (), i); + m_dirs.move (idx.row (), i); - endMoveRows (); - } + endMoveRows (); + } - model_to_path (); - } + model_to_path (); +} - void set_path_model::move_dir_bottom (const QModelIndexList& indices) - { - m_last_dirs = m_dirs; +void set_path_model::move_dir_bottom (const QModelIndexList& indices) +{ + m_last_dirs = m_dirs; - for (int i = 0; i < indices.size (); i++) - { - const QModelIndex& idx = indices.at (i); - int target = m_dirs.size () - 1 - i; + for (int i = 0; i < indices.size (); i++) + { + const QModelIndex& idx = indices.at (i); + int target = m_dirs.size () - 1 - i; - if (idx.row () == target) - continue; // already at target position + if (idx.row () == target) + continue; // already at target position - beginMoveRows (idx, idx.row (), idx.row (), - this->index (target), target); + beginMoveRows (idx, idx.row (), idx.row (), + this->index (target), target); - m_dirs.move (idx.row (), target); + m_dirs.move (idx.row (), target); - endMoveRows (); - } + endMoveRows (); + } - model_to_path (); - } + model_to_path (); +} - int set_path_model::rowCount (const QModelIndex&) const - { - return m_dirs.size (); - } +int set_path_model::rowCount (const QModelIndex&) const +{ + return m_dirs.size (); +} - QVariant set_path_model::data (const QModelIndex& idx, int role) const - { - QVariant retval; - if (idx.isValid ()) - { - switch (role) - { - case Qt::DisplayRole: - retval = QVariant (m_dirs[idx.row ()]); - break; +QVariant set_path_model::data (const QModelIndex& idx, int role) const +{ + QVariant retval; + if (idx.isValid ()) + { + switch (role) + { + case Qt::DisplayRole: + retval = QVariant (m_dirs[idx.row ()]); + break; - case Qt::DecorationRole: - retval = QVariant (QIcon ()); - break; + case Qt::DecorationRole: + retval = QVariant (QIcon ()); + break; - case Qt::SizeHintRole: - retval = QVariant (QSize (10, 20)); - break; - } - } + case Qt::SizeHintRole: + retval = QVariant (QSize (10, 20)); + break; + } + } - return retval; - } + return retval; +} - void set_path_model::path_to_model (void) - { - emit interpreter_event - ([=] (interpreter& interp) - { - // INTERPRETER THREAD +void set_path_model::path_to_model (void) +{ + emit interpreter_event + ([=] (interpreter& interp) + { + // INTERPRETER THREAD - load_path& lp = interp.get_load_path (); + load_path& lp = interp.get_load_path (); - std::list dir_list = lp.dir_list (); + std::list dir_list = lp.dir_list (); - QStringList qs_dir_list; + QStringList qs_dir_list; - for (const auto& dir : dir_list) - qs_dir_list << QString::fromStdString (dir); + for (const auto& dir : dir_list) + qs_dir_list << QString::fromStdString (dir); - emit update_data_signal (qs_dir_list); - }); + emit update_data_signal (qs_dir_list); + }); - m_revertible = false; - } + m_revertible = false; +} - void set_path_model::update_data (const QStringList& dirs) - { - m_dirs = dirs; +void set_path_model::update_data (const QStringList& dirs) +{ + m_dirs = dirs; - m_dirs.removeAll ("."); + m_dirs.removeAll ("."); - if (! m_revertible) - { - // first time update - m_orig_dirs = m_dirs; - m_last_dirs = m_dirs; + if (! m_revertible) + { + // first time update + m_orig_dirs = m_dirs; + m_last_dirs = m_dirs; - m_revertible = true; - } + m_revertible = true; + } - int numel = m_dirs.size (); + int numel = m_dirs.size (); - emit dataChanged (QAbstractListModel::index (0, 0), - QAbstractListModel::index (numel-1, 0)); - } + emit dataChanged (QAbstractListModel::index (0, 0), + QAbstractListModel::index (numel-1, 0)); +} OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/set-path-model.h --- a/libgui/src/set-path-model.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/set-path-model.h Tue Dec 06 15:45:27 2022 -0500 @@ -36,71 +36,71 @@ OCTAVE_BEGIN_NAMESPACE(octave) - class set_path_model : public QAbstractListModel - { - Q_OBJECT +class set_path_model : public QAbstractListModel +{ + Q_OBJECT - public: +public: - set_path_model (QObject *p = nullptr); + set_path_model (QObject *p = nullptr); - ~set_path_model (void) = default; + ~set_path_model (void) = default; - void clear (void); + void clear (void); - void add_dir (const QString& p); + void add_dir (const QString& p); - void rm_dir (const QModelIndexList& indices); + void rm_dir (const QModelIndexList& indices); - void move_dir_up (const QModelIndexList& indices); + void move_dir_up (const QModelIndexList& indices); - void move_dir_down (const QModelIndexList& indices); + void move_dir_down (const QModelIndexList& indices); - void move_dir_top (const QModelIndexList& indices); + void move_dir_top (const QModelIndexList& indices); - void move_dir_bottom (const QModelIndexList& indices); + void move_dir_bottom (const QModelIndexList& indices); - std::string to_string (void); + std::string to_string (void); - // Overloaded Qt methods + // Overloaded Qt methods - void model_to_path (void); + void model_to_path (void); - int rowCount (const QModelIndex& p = QModelIndex ()) const; + int rowCount (const QModelIndex& p = QModelIndex ()) const; - QVariant data (const QModelIndex& idx, int role) const; + QVariant data (const QModelIndex& idx, int role) const; - signals: +signals: - void update_data_signal (const QStringList& dirs); + void update_data_signal (const QStringList& dirs); - void interpreter_event (const fcn_callback& fcn); - void interpreter_event (const meth_callback& meth); + void interpreter_event (const fcn_callback& fcn); + void interpreter_event (const meth_callback& meth); - public slots: +public slots: - void path_to_model (void); + void path_to_model (void); - void save (void); + void save (void); - void revert (void); + void revert (void); - void revert_last (void); + void revert_last (void); - private slots: +private slots: - void update_data (const QStringList& dirs); + void update_data (const QStringList& dirs); - private: +private: - QStringList m_dirs; + QStringList m_dirs; - QStringList m_orig_dirs; + QStringList m_orig_dirs; - QStringList m_last_dirs; + QStringList m_last_dirs; - bool m_revertible; - }; + bool m_revertible; +}; OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/settings-dialog.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/settings-dialog.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/shortcut-manager.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/shortcut-manager.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/tab-bar.cc --- a/libgui/src/tab-bar.cc Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/tab-bar.cc Tue Dec 06 15:45:27 2022 -0500 @@ -34,253 +34,253 @@ OCTAVE_BEGIN_NAMESPACE(octave) - // - // Reimplemented QTabbar - // +// +// Reimplemented QTabbar +// - tab_bar::tab_bar (QWidget *p) - : QTabBar (p), m_context_menu (new QMenu (this)) - { } +tab_bar::tab_bar (QWidget *p) +: QTabBar (p), m_context_menu (new QMenu (this)) +{ } - void tab_bar::set_rotated (int rotated) - { - m_rotated = rotated; - } +void tab_bar::set_rotated (int rotated) +{ + m_rotated = rotated; +} - // slots for tab navigation - void tab_bar::switch_left_tab (void) - { - switch_tab (-1); - } +// slots for tab navigation +void tab_bar::switch_left_tab (void) +{ + switch_tab (-1); +} - void tab_bar::switch_right_tab (void) - { - switch_tab (1); - } +void tab_bar::switch_right_tab (void) +{ + switch_tab (1); +} - void tab_bar::move_tab_left (void) - { - switch_tab (-1, true); - } +void tab_bar::move_tab_left (void) +{ + switch_tab (-1, true); +} - void tab_bar::move_tab_right (void) - { - switch_tab (1, true); - } +void tab_bar::move_tab_right (void) +{ + switch_tab (1, true); +} - void tab_bar::switch_tab (int direction, bool movetab) - { - int tabs = count (); +void tab_bar::switch_tab (int direction, bool movetab) +{ + int tabs = count (); - if (tabs < 2) - return; + if (tabs < 2) + return; - int old_pos = currentIndex (); - int new_pos = currentIndex () + direction; + int old_pos = currentIndex (); + int new_pos = currentIndex () + direction; - if (new_pos < 0 || new_pos >= tabs) - new_pos = new_pos - direction*tabs; + if (new_pos < 0 || new_pos >= tabs) + new_pos = new_pos - direction*tabs; - if (movetab) - { - moveTab (old_pos, new_pos); - setCurrentIndex (old_pos); - setCurrentIndex (new_pos); - } - else + if (movetab) + { + moveTab (old_pos, new_pos); + setCurrentIndex (old_pos); setCurrentIndex (new_pos); - } + } + else + setCurrentIndex (new_pos); +} - void tab_bar::sort_tabs_alph (void) - { - QString current_title = tabText (currentIndex ()); - int tab_with_focus = 0; +void tab_bar::sort_tabs_alph (void) +{ + QString current_title = tabText (currentIndex ()); + int tab_with_focus = 0; - // Get all tab title and sort - QStringList tab_texts; + // Get all tab title and sort + QStringList tab_texts; - for (int i = 0; i < count (); i++) - tab_texts.append (tabText (i)); + for (int i = 0; i < count (); i++) + tab_texts.append (tabText (i)); - tab_texts.sort (); + tab_texts.sort (); - // Move tab into the order of the generated string list - for (int title = 0; title < tab_texts.count (); title++) - { - // Target tab is same as place of title in QStringList. - // Find index of next title in string list, leaving out the - // tabs (or titles) that were already moved. - for (int tab = title; tab < count (); tab++) - { - if (tabText (tab) == tab_texts.at (title)) - { - // Index of next tile found, so move tab into next position - moveTab (tab, title); + // Move tab into the order of the generated string list + for (int title = 0; title < tab_texts.count (); title++) + { + // Target tab is same as place of title in QStringList. + // Find index of next title in string list, leaving out the + // tabs (or titles) that were already moved. + for (int tab = title; tab < count (); tab++) + { + if (tabText (tab) == tab_texts.at (title)) + { + // Index of next tile found, so move tab into next position + moveTab (tab, title); - if (tab_texts.at (title) == current_title) - tab_with_focus = title; + if (tab_texts.at (title) == current_title) + tab_with_focus = title; - break; - } - } - } + break; + } + } + } - setCurrentIndex (tab_with_focus); - } + setCurrentIndex (tab_with_focus); +} - // The following two functions are reimplemented for allowing rotated - // tabs and are based on this answer on stack overflow: - // https://stackoverflow.com/a/50579369 +// The following two functions are reimplemented for allowing rotated +// tabs and are based on this answer on stack overflow: +// https://stackoverflow.com/a/50579369 - // Reimplemented size hint allowing rotated tabs - QSize tab_bar::tabSizeHint (int idx) const - { - QSize s = QTabBar::tabSizeHint (idx); - if (m_rotated) - s.transpose(); +// Reimplemented size hint allowing rotated tabs +QSize tab_bar::tabSizeHint (int idx) const +{ + QSize s = QTabBar::tabSizeHint (idx); + if (m_rotated) + s.transpose(); - return s; - } + return s; +} - // Reimplemented paint event allowing rotated tabs - void tab_bar::paintEvent(QPaintEvent *e) - { - // Just process the original event if not rotated - if (! m_rotated) - return QTabBar::paintEvent (e); +// Reimplemented paint event allowing rotated tabs +void tab_bar::paintEvent(QPaintEvent *e) +{ + // Just process the original event if not rotated + if (! m_rotated) + return QTabBar::paintEvent (e); - // Process the event for rotated tabs - QStylePainter painter (this); - QStyleOptionTab opt; + // Process the event for rotated tabs + QStylePainter painter (this); + QStyleOptionTab opt; - for (int idx = 0; idx < count(); idx++) - { - initStyleOption (&opt, idx); - painter.drawControl (QStyle::CE_TabBarTabShape, opt); - painter.save (); + for (int idx = 0; idx < count(); idx++) + { + initStyleOption (&opt, idx); + painter.drawControl (QStyle::CE_TabBarTabShape, opt); + painter.save (); - QSize s = opt.rect.size(); - s.transpose(); - QRect rect (QPoint (), s); - rect.moveCenter (opt.rect.center ()); - opt.rect = rect; + QSize s = opt.rect.size(); + s.transpose(); + QRect rect (QPoint (), s); + rect.moveCenter (opt.rect.center ()); + opt.rect = rect; - QPoint p = tabRect (idx).center (); - painter.translate (p); - painter.rotate (-m_rotated*90); - painter.translate (-p); - painter.drawControl (QStyle::CE_TabBarTabLabel, opt); - painter.restore (); - } - } + QPoint p = tabRect (idx).center (); + painter.translate (p); + painter.rotate (-m_rotated*90); + painter.translate (-p); + painter.drawControl (QStyle::CE_TabBarTabLabel, opt); + painter.restore (); + } +} - // Reimplement mouse event for filtering out the desired mouse clicks - void tab_bar::mousePressEvent (QMouseEvent *me) - { - QPoint click_pos; - int clicked_idx = -1; +// Reimplement mouse event for filtering out the desired mouse clicks +void tab_bar::mousePressEvent (QMouseEvent *me) +{ + QPoint click_pos; + int clicked_idx = -1; + + // detect the tab where the click occurred + for (int i = 0; i < count (); i++) + { + click_pos = mapToGlobal (me->pos ()); + if (tabRect (i).contains (mapFromGlobal (click_pos))) + { + clicked_idx = i; + break; + } + } - // detect the tab where the click occurred - for (int i = 0; i < count (); i++) - { - click_pos = mapToGlobal (me->pos ()); - if (tabRect (i).contains (mapFromGlobal (click_pos))) - { - clicked_idx = i; - break; - } - } + // If a tab was clicked + if (clicked_idx >= 0) + { + int current_idx = currentIndex (); + int current_count = count (); - // If a tab was clicked - if (clicked_idx >= 0) - { - int current_idx = currentIndex (); - int current_count = count (); + // detect the mouse click + if ((me->type () == QEvent::MouseButtonDblClick + && me->button() == Qt::LeftButton) + || (me->type () != QEvent::MouseButtonDblClick + && me->button() == Qt::MiddleButton)) + { + // Middle click or double click -> close the tab + // Make the clicked tab the current one and close it + setCurrentIndex (clicked_idx); + emit close_current_tab_signal (true); + // Was the closed tab before or after the previously current tab? + // According to the result, use previous index or reduce it by one + if (current_idx - clicked_idx > 0) + setCurrentIndex (current_idx - 1); + else if (current_idx - clicked_idx < 0) + setCurrentIndex (current_idx); + } + else if (me->type () != QEvent::MouseButtonDblClick + && me->button() == Qt::RightButton) + { + // Right click, show context menu + setCurrentIndex (clicked_idx); - // detect the mouse click - if ((me->type () == QEvent::MouseButtonDblClick - && me->button() == Qt::LeftButton) - || (me->type () != QEvent::MouseButtonDblClick - && me->button() == Qt::MiddleButton)) - { - // Middle click or double click -> close the tab - // Make the clicked tab the current one and close it - setCurrentIndex (clicked_idx); - emit close_current_tab_signal (true); - // Was the closed tab before or after the previously current tab? - // According to the result, use previous index or reduce it by one - if (current_idx - clicked_idx > 0) - setCurrentIndex (current_idx - 1); - else if (current_idx - clicked_idx < 0) + // Fill context menu with actions for selecting current tabs + m_ctx_actions = m_context_menu->actions (); // Copy of basic actions + QMenu ctx_menu; // The menu actually used + connect (&ctx_menu, &QMenu::triggered, + this, &tab_bar::ctx_menu_activated); + + for (int i = count () - 1; i >= 0; i--) + { + // Prepend an action for each tab + QAction *a = new QAction (tabIcon (i), tabText (i), &ctx_menu); + m_ctx_actions.prepend (a); + } + // Add all actions to our menu + ctx_menu.insertActions (nullptr, m_ctx_actions); + + if (! ctx_menu.exec (click_pos)) + { + // No action selected, back to previous tab setCurrentIndex (current_idx); - } - else if (me->type () != QEvent::MouseButtonDblClick - && me->button() == Qt::RightButton) - { - // Right click, show context menu - setCurrentIndex (clicked_idx); - - // Fill context menu with actions for selecting current tabs - m_ctx_actions = m_context_menu->actions (); // Copy of basic actions - QMenu ctx_menu; // The menu actually used - connect (&ctx_menu, &QMenu::triggered, - this, &tab_bar::ctx_menu_activated); - - for (int i = count () - 1; i >= 0; i--) - { - // Prepend an action for each tab - QAction *a = new QAction (tabIcon (i), tabText (i), &ctx_menu); - m_ctx_actions.prepend (a); - } - // Add all actions to our menu - ctx_menu.insertActions (nullptr, m_ctx_actions); + } + else if (count () < current_count) + { + // A tab was closed: + // Was the possibly only closed tab before or after the + // previously current tab? According to the result, use previous + // index or reduce it by one. Also prevent using a too large + // index if other or all files were closed. + int new_idx = count () - 1; + if (new_idx > 0) + { + if (current_idx - clicked_idx > 0) + new_idx = current_idx - 1; + else if (current_idx - clicked_idx < 0) + new_idx = current_idx; + } + if (new_idx >= 0) + setCurrentIndex (new_idx); + } + } + else + { + // regular handling of the mouse event + QTabBar::mousePressEvent (me); + } + } + else + { + // regular handling of the mouse event + QTabBar::mousePressEvent (me); + } +} - if (! ctx_menu.exec (click_pos)) - { - // No action selected, back to previous tab - setCurrentIndex (current_idx); - } - else if (count () < current_count) - { - // A tab was closed: - // Was the possibly only closed tab before or after the - // previously current tab? According to the result, use previous - // index or reduce it by one. Also prevent using a too large - // index if other or all files were closed. - int new_idx = count () - 1; - if (new_idx > 0) - { - if (current_idx - clicked_idx > 0) - new_idx = current_idx - 1; - else if (current_idx - clicked_idx < 0) - new_idx = current_idx; - } - if (new_idx >= 0) - setCurrentIndex (new_idx); - } - } - else - { - // regular handling of the mouse event - QTabBar::mousePressEvent (me); - } - } - else - { - // regular handling of the mouse event - QTabBar::mousePressEvent (me); - } - } - - // Slot if a menu entry in the context menu is activated - void tab_bar::ctx_menu_activated (QAction *a) - { - // If the index of the activated action is in the range of - // the current tabs, set the related current tab. The basic actions - // are handled by the editor - int i = m_ctx_actions.indexOf (a); - if ((i > -1) && (i < count ())) - setCurrentIndex (i); - } +// Slot if a menu entry in the context menu is activated +void tab_bar::ctx_menu_activated (QAction *a) +{ + // If the index of the activated action is in the range of + // the current tabs, set the related current tab. The basic actions + // are handled by the editor + int i = m_ctx_actions.indexOf (a); + if ((i > -1) && (i < count ())) + setCurrentIndex (i); +} OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/tab-bar.h --- a/libgui/src/tab-bar.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/tab-bar.h Tue Dec 06 15:45:27 2022 -0500 @@ -38,52 +38,52 @@ OCTAVE_BEGIN_NAMESPACE(octave) - // Subclassed QTabBar for usable tab-bar, rotated tabs and - // reimplemented mouse event +// Subclassed QTabBar for usable tab-bar, rotated tabs and +// reimplemented mouse event - class tab_bar : public QTabBar - { - Q_OBJECT +class tab_bar : public QTabBar +{ + Q_OBJECT - public: +public: - tab_bar (QWidget *p); + tab_bar (QWidget *p); - ~tab_bar (void) = default; + ~tab_bar (void) = default; - void set_rotated (int rotated); - QMenu * get_context_menu (void) { return m_context_menu; }; - QSize tabSizeHint (int idx) const; + void set_rotated (int rotated); + QMenu * get_context_menu (void) { return m_context_menu; }; + QSize tabSizeHint (int idx) const; - signals: +signals: - void close_current_tab_signal (bool); + void close_current_tab_signal (bool); - public slots: +public slots: - void switch_left_tab (void); - void switch_right_tab (void); - void move_tab_left (void); - void move_tab_right (void); - void sort_tabs_alph (void); + void switch_left_tab (void); + void switch_right_tab (void); + void move_tab_left (void); + void move_tab_right (void); + void sort_tabs_alph (void); - private slots: +private slots: - void ctx_menu_activated (QAction *a); + void ctx_menu_activated (QAction *a); - protected: +protected: - void paintEvent(QPaintEvent *e); - void mousePressEvent(QMouseEvent *event); + void paintEvent(QPaintEvent *e); + void mousePressEvent(QMouseEvent *event); - private: +private: - void switch_tab (int direction, bool movetab = false); + void switch_tab (int direction, bool movetab = false); - QMenu *m_context_menu; - QList m_ctx_actions; - int m_rotated; - }; + QMenu *m_context_menu; + QList m_ctx_actions; + int m_rotated; +}; OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/terminal-dock-widget.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/terminal-dock-widget.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/variable-editor-model.cc --- a/libgui/src/variable-editor-model.cc Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/variable-editor-model.cc Tue Dec 06 15:45:27 2022 -0500 @@ -50,143 +50,306 @@ OCTAVE_BEGIN_NAMESPACE(octave) - static bool - cell_is_editable (const octave_value& val) - { - if ((val.isnumeric () || val.islogical ()) && val.numel () == 1) - return true; +static bool +cell_is_editable (const octave_value& val) +{ + if ((val.isnumeric () || val.islogical ()) && val.numel () == 1) + return true; + + if (val.is_string () && (val.rows () == 1 || val.is_zero_by_zero ())) + return true; + + return false; +} + +static char +get_quote_char (const octave_value& val) +{ + if (val.is_sq_string ()) + return '\''; + + if (val.is_dq_string ()) + return '"'; + + return 0; +} + +static float_display_format +get_edit_display_format (const octave_value& val) +{ + // FIXME: make this limit configurable. + + return (val.numel () > 250000 + ? float_display_format () : val.get_edit_display_format ()); +} + +static bool +do_requires_sub_editor_sub (const octave_value& elt) +{ + return (! ((elt.numel () == 1 && (elt.isnumeric () || elt.islogical ())) + || (elt.is_string () && (elt.rows () == 1 || elt.isempty ())))); +} + +base_ve_model::base_ve_model (const QString& expr, const octave_value& val) + : m_name (expr.toStdString ()), + m_value (val), + m_data_rows (m_value.rows ()), + m_data_cols (m_value.columns ()), + m_display_rows (m_data_rows), + m_display_cols (m_data_cols), + m_update_pending (), + m_valid (m_value.is_defined ()), + m_display_fmt (get_edit_display_format (m_value)) +{ } + +std::string +base_ve_model::name (void) const +{ + return m_name; +} + +bool +base_ve_model::index_ok (const QModelIndex& idx, int& row, int& col) const +{ + row = 0; + col = 0; + + if (! idx.isValid ()) + return false; - if (val.is_string () && (val.rows () == 1 || val.is_zero_by_zero ())) - return true; + row = idx.row (); + col = idx.column (); + + return (row < data_rows () && col < data_columns ()); +} + +int +base_ve_model::column_width (void) const +{ + int width = 0; + + float_format r_fmt = m_display_fmt.real_format (); + float_format i_fmt = m_display_fmt.imag_format (); + + int rw = r_fmt.width (); + int iw = i_fmt.width (); + + if (rw > 0) + { + if (m_value.iscomplex ()) + { + if (iw > 0) + width = rw + iw + 5; + } + else + width = rw + 2; + } + + return width; +} - return false; - } +int +base_ve_model::rowCount (const QModelIndex&) const +{ + return m_valid ? m_display_rows : 1; +} + +int +base_ve_model::columnCount (const QModelIndex&) const +{ + return m_valid ? m_display_cols : 1; +} + +QString +base_ve_model::edit_display_sub (const octave_value& elt, int role) const +{ + std::string str; + + if (cell_is_editable (elt)) + { + float_display_format fmt; + + if (role == Qt::DisplayRole) + fmt = get_edit_display_format (elt); + else + fmt.set_precision (elt.is_single_type () ? 8 : 16); + + str = elt.edit_display (fmt, 0, 0); + } + else + { + dim_vector dv = elt.dims (); + str = "[" + dv.str () + " " + elt.class_name () + "]"; + } + + return QString::fromStdString (str); +} - static char - get_quote_char (const octave_value& val) - { - if (val.is_sq_string ()) - return '\''; +QVariant +base_ve_model::edit_display (const QModelIndex& idx, int role) const +{ + int row; + int col; + + if (! index_ok (idx, row, col)) + return QVariant (); + + float_display_format fmt; + if (role == Qt::DisplayRole) + fmt = m_display_fmt; + else + fmt.set_precision (m_value.is_single_type () ? 8 : 16); + + std::string str = m_value.edit_display (fmt, row, col); + + return QString::fromStdString (str); +} + +QVariant +base_ve_model::data (const QModelIndex& idx, int role) const +{ + if (idx.isValid () && role == Qt::DisplayRole && update_pending (idx)) + return QVariant (update_pending_data (idx)); + + if (! m_valid) + { + if (role == Qt::DisplayRole) + return QVariant (QString ("Variable %1 not found or value can't be edited") + .arg (QString::fromStdString (m_name))); + + return QVariant (QString ("x")); + } + + switch (role) + { + case Qt::DisplayRole: + case Qt::EditRole: + return edit_display (idx, role); + } + + // Invalid. + return QVariant (); +} + +bool +base_ve_model::requires_sub_editor (const QModelIndex&) const +{ + return false; +} + +void +base_ve_model::set_update_pending (const QModelIndex& idx, const QString& str) +{ + m_update_pending[idx] = str; +} + +bool +base_ve_model::update_pending (const QModelIndex& idx) const +{ + return m_update_pending.contains (idx); +} - if (val.is_dq_string ()) - return '"'; +QString +base_ve_model::update_pending_data (const QModelIndex& idx) const +{ + return m_update_pending[idx]; +} + +void +base_ve_model::clear_update_pending (void) +{ + return m_update_pending.clear (); +} + +char +base_ve_model::quote_char (const QModelIndex&) const +{ + return 0; +} + +QVariant +base_ve_model::header_data (int section, Qt::Orientation, int role) const +{ + + if (role != Qt::DisplayRole) + return QVariant (); + + return QString::number (section+1); +} + +QString +base_ve_model::subscript_expression (const QModelIndex&) const +{ + return ""; +} - return 0; - } +QString +base_ve_model::make_description_text (void) const +{ + QString lbl_txt = QString::fromStdString (m_name); + + if (m_value.is_defined ()) + { + if (! lbl_txt.isEmpty ()) + lbl_txt += " "; + + dim_vector dv = m_value.dims (); - static float_display_format - get_edit_display_format (const octave_value& val) + lbl_txt += ("[" + + QString::fromStdString (dv.str ()) + + " " + + QString::fromStdString (m_value.class_name ()) + + "]"); + } + else + lbl_txt += " [undefined]"; + + return lbl_txt; +} + +// Private slots. + +octave_value +base_ve_model::value_at (const QModelIndex&) const +{ + return octave_value (); +} + +class numeric_model : public base_ve_model +{ +public: + + numeric_model (const QString& expr, const octave_value& val) + : base_ve_model (expr, val) { - // FIXME: make this limit configurable. - - return (val.numel () > 250000 - ? float_display_format () : val.get_edit_display_format ()); - } - - static bool - do_requires_sub_editor_sub (const octave_value& elt) - { - return (! ((elt.numel () == 1 && (elt.isnumeric () || elt.islogical ())) - || (elt.is_string () && (elt.rows () == 1 || elt.isempty ())))); - } + // FIXME: should fill the window and expand on scrolling or + // resizing. - base_ve_model::base_ve_model (const QString& expr, const octave_value& val) - : m_name (expr.toStdString ()), - m_value (val), - m_data_rows (m_value.rows ()), - m_data_cols (m_value.columns ()), - m_display_rows (m_data_rows), - m_display_cols (m_data_cols), - m_update_pending (), - m_valid (m_value.is_defined ()), - m_display_fmt (get_edit_display_format (m_value)) - { } - - std::string - base_ve_model::name (void) const - { - return m_name; + maybe_resize_rows (m_data_rows + 16); + maybe_resize_columns (m_data_cols + 16); } - bool - base_ve_model::index_ok (const QModelIndex& idx, int& row, int& col) const - { - row = 0; - col = 0; + ~numeric_model (void) = default; - if (! idx.isValid ()) - return false; + // No copying! - row = idx.row (); - col = idx.column (); + numeric_model (const numeric_model&) = delete; - return (row < data_rows () && col < data_columns ()); - } + numeric_model& operator = (const numeric_model&) = delete; - int - base_ve_model::column_width (void) const + void maybe_resize_rows (int rows) { - int width = 0; - - float_format r_fmt = m_display_fmt.real_format (); - float_format i_fmt = m_display_fmt.imag_format (); - - int rw = r_fmt.width (); - int iw = i_fmt.width (); - - if (rw > 0) - { - if (m_value.iscomplex ()) - { - if (iw > 0) - width = rw + iw + 5; - } - else - width = rw + 2; - } - - return width; + if (rows > m_display_rows) + m_display_rows = rows; } - int - base_ve_model::rowCount (const QModelIndex&) const + void maybe_resize_columns (int cols) { - return m_valid ? m_display_rows : 1; - } - - int - base_ve_model::columnCount (const QModelIndex&) const - { - return m_valid ? m_display_cols : 1; + if (cols > m_display_cols) + m_display_cols = cols; } - QString - base_ve_model::edit_display_sub (const octave_value& elt, int role) const - { - std::string str; - - if (cell_is_editable (elt)) - { - float_display_format fmt; - - if (role == Qt::DisplayRole) - fmt = get_edit_display_format (elt); - else - fmt.set_precision (elt.is_single_type () ? 8 : 16); - - str = elt.edit_display (fmt, 0, 0); - } - else - { - dim_vector dv = elt.dims (); - str = "[" + dv.str () + " " + elt.class_name () + "]"; - } - - return QString::fromStdString (str); - } - - QVariant - base_ve_model::edit_display (const QModelIndex& idx, int role) const + QVariant edit_display (const QModelIndex& idx, int role) const { int row; int col; @@ -205,1196 +368,1033 @@ return QString::fromStdString (str); } - QVariant - base_ve_model::data (const QModelIndex& idx, int role) const + QString subscript_expression (const QModelIndex& idx) const + { + if (! idx.isValid ()) + return ""; + + return (QString ("(%1,%2)") + .arg (idx.row () + 1) + .arg (idx.column () + 1)); + } +}; + +class string_model : public base_ve_model +{ +public: + + string_model (const QString& expr, const octave_value& val) + : base_ve_model (expr, val) + { + m_data_rows = 1; + m_data_cols = 1; + + m_display_rows = 1; + m_display_cols = 1; + } + + ~string_model (void) = default; + + // No copying! + + string_model (const string_model&) = delete; + + string_model& operator = (const string_model&) = delete; + + QVariant edit_display (const QModelIndex&, int) const + { + // There isn't really a format for strings... + + std::string str = m_value.edit_display (float_display_format (), 0, 0); + + return QString::fromStdString (str); + } + + char quote_char (const QModelIndex&) const + { + return get_quote_char (m_value); + } +}; + +class cell_model : public base_ve_model +{ +public: + + cell_model (const QString& expr, const octave_value& val) + : base_ve_model (expr, val) { - if (idx.isValid () && role == Qt::DisplayRole && update_pending (idx)) - return QVariant (update_pending_data (idx)); + // FIXME: should fill the window and expand on scrolling or + // resizing. + + maybe_resize_rows (m_data_rows + 16); + maybe_resize_columns (m_data_cols + 16); + } + + ~cell_model (void) = default; + + // No copying! + + cell_model (const cell_model&) = delete; + + cell_model& operator = (const cell_model&) = delete; + + void maybe_resize_rows (int rows) + { + if (rows > m_display_rows) + m_display_rows = rows; + } + + void maybe_resize_columns (int cols) + { + if (cols > m_display_cols) + m_display_cols = cols; + } + + QVariant edit_display (const QModelIndex& idx, int role) const + { + int row; + int col; + + if (! index_ok (idx, row, col)) + return QVariant (); + + Cell cval = m_value.cell_value (); + + return edit_display_sub (cval(row, col), role); + } + + bool requires_sub_editor (const QModelIndex& idx) const + { + int row; + int col; + + if (! index_ok (idx, row, col)) + return false; + + Cell cval = m_value.cell_value (); + + return do_requires_sub_editor_sub (cval(row, col)); + } + + char quote_char (const QModelIndex& idx) const + { + octave_value ov = value_at (idx); + + if (ov.is_string ()) + return get_quote_char (ov); + + return 0; + } - if (! m_valid) + QString subscript_expression (const QModelIndex& idx) const + { + if (! idx.isValid ()) + return ""; + + return (QString ("{%1,%2}") + .arg (idx.row () + 1) + .arg (idx.column () + 1)); + } + + octave_value value_at (const QModelIndex& idx) const + { + int row; + int col; + + if (! index_ok (idx, row, col)) + return octave_value (); + + Cell cval = m_value.cell_value (); + + return cval(row, col); + } +}; + +// Scalar struct. Rows are fields, single column for values. + +class scalar_struct_model : public base_ve_model +{ +public: + + scalar_struct_model (const QString& expr, const octave_value& val) + : base_ve_model (expr, val) + { + // No extra cells. We currently don't allow new fields or + // additional values to be inserted. If we allow additional values, + // then the object becomes a vector structure and the display flips + // (see the vector struct model below). Do we want that? + + m_data_rows = val.nfields (); + m_data_cols = 1; + + m_display_rows = m_data_rows; + m_display_cols = 1; + } + + ~scalar_struct_model (void) = default; + + // No copying! + + scalar_struct_model (const scalar_struct_model&) = delete; + + scalar_struct_model& operator = (const scalar_struct_model&) = delete; + + QVariant edit_display (const QModelIndex& idx, int role) const + { + int row; + int col; + + if (! index_ok (idx, row, col)) + return QVariant (); + + octave_scalar_map m = m_value.scalar_map_value (); + + return edit_display_sub (m.contents (row), role); + } + + bool requires_sub_editor (const QModelIndex& idx) const + { + int row; + int col; + + if (! index_ok (idx, row, col)) + return false; + + octave_scalar_map m = m_value.scalar_map_value (); + + return do_requires_sub_editor_sub (m.contents (row)); + } + + char quote_char (const QModelIndex& idx) const + { + octave_value ov = value_at (idx); + + if (ov.is_string ()) + return get_quote_char (ov); + + return 0; + } + + QVariant header_data (int section, Qt::Orientation orientation, + int role) const + { + if (role != Qt::DisplayRole) + return QVariant (); + + switch (orientation) { - if (role == Qt::DisplayRole) - return QVariant (QString ("Variable %1 not found or value can't be edited") - .arg (QString::fromStdString (m_name))); + case Qt::Horizontal: + if (section < data_columns ()) + return QString ("Values"); + else + break; - return QVariant (QString ("x")); + case Qt::Vertical: + if (section < data_rows ()) + { + octave_scalar_map m = m_value.scalar_map_value (); + + string_vector fields = m.fieldnames (); + + return QString::fromStdString (fields(section)); + } + else + break; + + default: + break; } - switch (role) - { - case Qt::DisplayRole: - case Qt::EditRole: - return edit_display (idx, role); - } - - // Invalid. return QVariant (); } - bool - base_ve_model::requires_sub_editor (const QModelIndex&) const + QString subscript_expression (const QModelIndex& idx) const { - return false; + // Display size and data size match, so all valid indices should + // also be valid indices for the existing struct. + + int row; + int col; + + if (! index_ok (idx, row, col)) + return ""; + + octave_scalar_map m = m_value.scalar_map_value (); + + string_vector fields = m.fieldnames (); + + return QString (".%1").arg (QString::fromStdString (fields(row))); } - void - base_ve_model::set_update_pending (const QModelIndex& idx, const QString& str) + octave_value value_at (const QModelIndex& idx) const + { + int row; + int col; + + if (! index_ok (idx, row, col)) + return octave_value (); + + octave_scalar_map m = m_value.scalar_map_value (); + + return m.contents (row); + } +}; + +class display_only_model : public base_ve_model +{ +public: + + display_only_model (const QString& expr, const octave_value& val) + : base_ve_model (expr, val) { - m_update_pending[idx] = str; + m_data_rows = 1; + m_data_cols = 1; + + m_display_rows = m_data_rows; + m_display_cols = m_data_cols; + } + + ~display_only_model (void) = default; + + // No copying! + + display_only_model (const display_only_model&) = delete; + + display_only_model& operator = (const display_only_model&) = delete; + + bool is_editable (void) const { return false; } + + QVariant edit_display (const QModelIndex&, int) const + { + if (m_value.is_undefined ()) + return QVariant (); + + std::ostringstream buf; + + octave_value tval = m_value; + + tval.print_with_name (buf, m_name); + + return QString::fromStdString (buf.str ()); } - bool - base_ve_model::update_pending (const QModelIndex& idx) const + QString make_description_text (void) const { - return m_update_pending.contains (idx); + return (QString ("unable to edit %1") + .arg (base_ve_model::make_description_text ())); + } +}; + +// Vector struct. Columns are fields, rows are values. + +class vector_struct_model : public base_ve_model +{ +public: + + vector_struct_model (const QString& expr, const octave_value& val) + : base_ve_model (expr, val) + { + // FIXME: should fill the window vertically and expand on scrolling + // or resizing. No extra cells horizontally. New fields must be + // added specially. + + m_data_rows = val.numel (); + m_data_cols = val.nfields (); + + maybe_resize_rows (m_data_rows + 16); + m_display_cols = m_data_cols; } - QString - base_ve_model::update_pending_data (const QModelIndex& idx) const + ~vector_struct_model (void) = default; + + // No copying! + + vector_struct_model (const vector_struct_model&) = delete; + + vector_struct_model& operator = (const vector_struct_model&) = delete; + + void maybe_resize_rows (int rows) { - return m_update_pending[idx]; + if (rows > m_display_rows) + m_display_rows = rows; } - void - base_ve_model::clear_update_pending (void) + QVariant edit_display (const QModelIndex& idx, int role) const { - return m_update_pending.clear (); + int row; + int col; + + if (! index_ok (idx, row, col)) + return QVariant (); + + octave_map m = m_value.map_value (); + + Cell cval = m.contents (col); + + return edit_display_sub (cval(row), role); } - char - base_ve_model::quote_char (const QModelIndex&) const + bool requires_sub_editor (const QModelIndex& idx) const { + int row; + int col; + + if (! index_ok (idx, row, col)) + return false; + + octave_map m = m_value.map_value (); + + Cell cval = m.contents (col); + + return do_requires_sub_editor_sub (cval(row)); + } + + char quote_char (const QModelIndex& idx) const + { + octave_value ov = value_at (idx); + + if (ov.is_string ()) + return get_quote_char (ov); + return 0; } - QVariant - base_ve_model::header_data (int section, Qt::Orientation, int role) const + QVariant header_data (int section, Qt::Orientation orientation, + int role) const { - if (role != Qt::DisplayRole) return QVariant (); - return QString::number (section+1); + switch (orientation) + { + case Qt::Horizontal: + if (section < data_columns ()) + { + octave_map m = m_value.map_value (); + + string_vector fields = m.fieldnames (); + + return QString::fromStdString (fields(section)); + } + else + break; + + case Qt::Vertical: + if (section < data_rows ()) + return QString::number (section+1); + else + break; + + default: + break; + } + + return QVariant (); } - QString - base_ve_model::subscript_expression (const QModelIndex&) const + QString subscript_expression (const QModelIndex& idx) const { - return ""; + if (! idx.isValid ()) + return ""; + + octave_map m = m_value.map_value (); + + string_vector fields = m.fieldnames (); + + return (QString ("(%1).%2") + .arg (idx.row () + 1) + .arg (QString::fromStdString (fields(idx.column ())))); } - QString - base_ve_model::make_description_text (void) const + octave_value value_at (const QModelIndex& idx) const { - QString lbl_txt = QString::fromStdString (m_name); + int row; + int col; - if (m_value.is_defined ()) - { - if (! lbl_txt.isEmpty ()) - lbl_txt += " "; + if (! index_ok (idx, row, col)) + return octave_value (); + + octave_map m = m_value.map_value (); + + Cell cval = m.contents (col); - dim_vector dv = m_value.dims (); + return cval(row); + } +}; + +// 2-d struct array. Rows and columns index individual scalar structs. - lbl_txt += ("[" - + QString::fromStdString (dv.str ()) - + " " - + QString::fromStdString (m_value.class_name ()) - + "]"); - } - else - lbl_txt += " [undefined]"; +class struct_model : public base_ve_model +{ +public: - return lbl_txt; + struct_model (const QString& expr, const octave_value& val) + : base_ve_model (expr, val) + { + // FIXME: should fill the window and expand on scrolling or + // resizing. + + maybe_resize_rows (m_data_rows + 16); + maybe_resize_columns (m_data_cols + 16); } - // Private slots. + ~struct_model (void) = default; + + // No copying! + + struct_model (const struct_model&) = delete; - octave_value - base_ve_model::value_at (const QModelIndex&) const + struct_model& operator = (const struct_model&) = delete; + + void maybe_resize_rows (int rows) { - return octave_value (); + if (rows > m_display_rows) + m_display_rows = rows; } - class numeric_model : public base_ve_model + void maybe_resize_columns (int cols) { - public: - - numeric_model (const QString& expr, const octave_value& val) - : base_ve_model (expr, val) - { - // FIXME: should fill the window and expand on scrolling or - // resizing. - - maybe_resize_rows (m_data_rows + 16); - maybe_resize_columns (m_data_cols + 16); - } - - ~numeric_model (void) = default; - - // No copying! - - numeric_model (const numeric_model&) = delete; - - numeric_model& operator = (const numeric_model&) = delete; - - void maybe_resize_rows (int rows) - { - if (rows > m_display_rows) - m_display_rows = rows; - } - - void maybe_resize_columns (int cols) - { - if (cols > m_display_cols) - m_display_cols = cols; - } - - QVariant edit_display (const QModelIndex& idx, int role) const - { - int row; - int col; - - if (! index_ok (idx, row, col)) - return QVariant (); - - float_display_format fmt; - if (role == Qt::DisplayRole) - fmt = m_display_fmt; - else - fmt.set_precision (m_value.is_single_type () ? 8 : 16); - - std::string str = m_value.edit_display (fmt, row, col); - - return QString::fromStdString (str); - } - - QString subscript_expression (const QModelIndex& idx) const - { - if (! idx.isValid ()) - return ""; + if (cols > m_display_cols) + m_display_cols = cols; + } - return (QString ("(%1,%2)") - .arg (idx.row () + 1) - .arg (idx.column () + 1)); - } - }; - - class string_model : public base_ve_model + QVariant edit_display (const QModelIndex& idx, int) const { - public: - - string_model (const QString& expr, const octave_value& val) - : base_ve_model (expr, val) - { - m_data_rows = 1; - m_data_cols = 1; - - m_display_rows = 1; - m_display_cols = 1; - } - - ~string_model (void) = default; - - // No copying! - - string_model (const string_model&) = delete; - - string_model& operator = (const string_model&) = delete; + int row; + int col; - QVariant edit_display (const QModelIndex&, int) const - { - // There isn't really a format for strings... - - std::string str = m_value.edit_display (float_display_format (), 0, 0); - - return QString::fromStdString (str); - } - - char quote_char (const QModelIndex&) const - { - return get_quote_char (m_value); - } - }; + if (! index_ok (idx, row, col)) + return QVariant (); - class cell_model : public base_ve_model - { - public: - - cell_model (const QString& expr, const octave_value& val) - : base_ve_model (expr, val) - { - // FIXME: should fill the window and expand on scrolling or - // resizing. - - maybe_resize_rows (m_data_rows + 16); - maybe_resize_columns (m_data_cols + 16); - } - - ~cell_model (void) = default; - - // No copying! - - cell_model (const cell_model&) = delete; + std::string str = m_value.edit_display (m_display_fmt, row, col); + return QString::fromStdString (str); + } - cell_model& operator = (const cell_model&) = delete; - - void maybe_resize_rows (int rows) - { - if (rows > m_display_rows) - m_display_rows = rows; - } - - void maybe_resize_columns (int cols) - { - if (cols > m_display_cols) - m_display_cols = cols; - } - - QVariant edit_display (const QModelIndex& idx, int role) const - { - int row; - int col; - - if (! index_ok (idx, row, col)) - return QVariant (); - - Cell cval = m_value.cell_value (); - - return edit_display_sub (cval(row, col), role); - } + bool requires_sub_editor (const QModelIndex& idx) const + { + int row; + int col; - bool requires_sub_editor (const QModelIndex& idx) const - { - int row; - int col; - - if (! index_ok (idx, row, col)) - return false; - - Cell cval = m_value.cell_value (); - - return do_requires_sub_editor_sub (cval(row, col)); - } + if (! index_ok (idx, row, col)) + return false; - char quote_char (const QModelIndex& idx) const - { - octave_value ov = value_at (idx); - - if (ov.is_string ()) - return get_quote_char (ov); - - return 0; - } - - QString subscript_expression (const QModelIndex& idx) const - { - if (! idx.isValid ()) - return ""; - - return (QString ("{%1,%2}") - .arg (idx.row () + 1) - .arg (idx.column () + 1)); - } + octave_map m = m_value.map_value (); - octave_value value_at (const QModelIndex& idx) const - { - int row; - int col; - - if (! index_ok (idx, row, col)) - return octave_value (); - - Cell cval = m_value.cell_value (); - - return cval(row, col); - } - }; - - // Scalar struct. Rows are fields, single column for values. - - class scalar_struct_model : public base_ve_model - { - public: - - scalar_struct_model (const QString& expr, const octave_value& val) - : base_ve_model (expr, val) - { - // No extra cells. We currently don't allow new fields or - // additional values to be inserted. If we allow additional values, - // then the object becomes a vector structure and the display flips - // (see the vector struct model below). Do we want that? - - m_data_rows = val.nfields (); - m_data_cols = 1; + return do_requires_sub_editor_sub (m(row, col)); + } - m_display_rows = m_data_rows; - m_display_cols = 1; - } - - ~scalar_struct_model (void) = default; - - // No copying! - - scalar_struct_model (const scalar_struct_model&) = delete; - - scalar_struct_model& operator = (const scalar_struct_model&) = delete; + char quote_char (const QModelIndex& idx) const + { + octave_value ov = value_at (idx); - QVariant edit_display (const QModelIndex& idx, int role) const - { - int row; - int col; - - if (! index_ok (idx, row, col)) - return QVariant (); - - octave_scalar_map m = m_value.scalar_map_value (); + if (ov.is_string ()) + return get_quote_char (ov); - return edit_display_sub (m.contents (row), role); - } - - bool requires_sub_editor (const QModelIndex& idx) const - { - int row; - int col; - - if (! index_ok (idx, row, col)) - return false; + return 0; + } - octave_scalar_map m = m_value.scalar_map_value (); - - return do_requires_sub_editor_sub (m.contents (row)); - } - - char quote_char (const QModelIndex& idx) const - { - octave_value ov = value_at (idx); - - if (ov.is_string ()) - return get_quote_char (ov); + QString subscript_expression (const QModelIndex& idx) const + { + int row; + int col; - return 0; - } - - QVariant header_data (int section, Qt::Orientation orientation, - int role) const - { - if (role != Qt::DisplayRole) - return QVariant (); - - switch (orientation) - { - case Qt::Horizontal: - if (section < data_columns ()) - return QString ("Values"); - else - break; + if (! index_ok (idx, row, col)) + return ""; - case Qt::Vertical: - if (section < data_rows ()) - { - octave_scalar_map m = m_value.scalar_map_value (); - - string_vector fields = m.fieldnames (); - - return QString::fromStdString (fields(section)); - } - else - break; + return (QString ("(%1,%2)") + .arg (row + 1) + .arg (col + 1)); + } - default: - break; - } - - return QVariant (); - } - - QString subscript_expression (const QModelIndex& idx) const - { - // Display size and data size match, so all valid indices should - // also be valid indices for the existing struct. - - int row; - int col; - - if (! index_ok (idx, row, col)) - return ""; + octave_value value_at (const QModelIndex& idx) const + { + int row; + int col; - octave_scalar_map m = m_value.scalar_map_value (); - - string_vector fields = m.fieldnames (); - - return QString (".%1").arg (QString::fromStdString (fields(row))); - } - - octave_value value_at (const QModelIndex& idx) const - { - int row; - int col; + if (! index_ok (idx, row, col)) + return octave_value (); - if (! index_ok (idx, row, col)) - return octave_value (); - - octave_scalar_map m = m_value.scalar_map_value (); + octave_map m = m_value.map_value (); - return m.contents (row); - } - }; - - class display_only_model : public base_ve_model - { - public: + return m(row, col); + } +}; - display_only_model (const QString& expr, const octave_value& val) - : base_ve_model (expr, val) - { - m_data_rows = 1; - m_data_cols = 1; - - m_display_rows = m_data_rows; - m_display_cols = m_data_cols; - } - - ~display_only_model (void) = default; - - // No copying! - - display_only_model (const display_only_model&) = delete; - - display_only_model& operator = (const display_only_model&) = delete; +base_ve_model * +variable_editor_model::create (const QString& expr, const octave_value& val) +{ + // Choose specific model based on type of val. - bool is_editable (void) const { return false; } - - QVariant edit_display (const QModelIndex&, int) const - { - if (m_value.is_undefined ()) - return QVariant (); - - std::ostringstream buf; - - octave_value tval = m_value; - - tval.print_with_name (buf, m_name); - - return QString::fromStdString (buf.str ()); - } - - QString make_description_text (void) const + if ((val.isnumeric () || val.islogical ()) && val.ndims () == 2) + return new numeric_model (expr, val); + else if (val.is_string () && (val.rows () == 1 || val.is_zero_by_zero ())) + return new string_model (expr, val); + else if (val.iscell ()) + return new cell_model (expr, val); + else if (val.isstruct ()) { - return (QString ("unable to edit %1") - .arg (base_ve_model::make_description_text ())); - } - }; - - // Vector struct. Columns are fields, rows are values. - - class vector_struct_model : public base_ve_model - { - public: - - vector_struct_model (const QString& expr, const octave_value& val) - : base_ve_model (expr, val) - { - // FIXME: should fill the window vertically and expand on scrolling - // or resizing. No extra cells horizontally. New fields must be - // added specially. - - m_data_rows = val.numel (); - m_data_cols = val.nfields (); - - maybe_resize_rows (m_data_rows + 16); - m_display_cols = m_data_cols; - } - - ~vector_struct_model (void) = default; - - // No copying! - - vector_struct_model (const vector_struct_model&) = delete; - - vector_struct_model& operator = (const vector_struct_model&) = delete; - - void maybe_resize_rows (int rows) - { - if (rows > m_display_rows) - m_display_rows = rows; - } - - QVariant edit_display (const QModelIndex& idx, int role) const - { - int row; - int col; - - if (! index_ok (idx, row, col)) - return QVariant (); - - octave_map m = m_value.map_value (); - - Cell cval = m.contents (col); - - return edit_display_sub (cval(row), role); - } - - bool requires_sub_editor (const QModelIndex& idx) const - { - int row; - int col; - - if (! index_ok (idx, row, col)) - return false; - - octave_map m = m_value.map_value (); - - Cell cval = m.contents (col); - - return do_requires_sub_editor_sub (cval(row)); - } - - char quote_char (const QModelIndex& idx) const - { - octave_value ov = value_at (idx); - - if (ov.is_string ()) - return get_quote_char (ov); - - return 0; - } - - QVariant header_data (int section, Qt::Orientation orientation, - int role) const - { - if (role != Qt::DisplayRole) - return QVariant (); - - switch (orientation) + if (val.numel () == 1) + return new scalar_struct_model (expr, val); + else if (val.ndims () == 2) { - case Qt::Horizontal: - if (section < data_columns ()) - { - octave_map m = m_value.map_value (); - - string_vector fields = m.fieldnames (); - - return QString::fromStdString (fields(section)); - } - else - break; - - case Qt::Vertical: - if (section < data_rows ()) - return QString::number (section+1); + if (val.rows () == 1 || val.columns () == 1) + return new vector_struct_model (expr, val); else - break; - - default: - break; + return new struct_model (expr, val); } - - return QVariant (); - } - - QString subscript_expression (const QModelIndex& idx) const - { - if (! idx.isValid ()) - return ""; - - octave_map m = m_value.map_value (); - - string_vector fields = m.fieldnames (); - - return (QString ("(%1).%2") - .arg (idx.row () + 1) - .arg (QString::fromStdString (fields(idx.column ())))); } - octave_value value_at (const QModelIndex& idx) const - { - int row; - int col; + return new display_only_model (expr, val); +} + +variable_editor_model::variable_editor_model (const QString& expr, + const octave_value& val, + QObject *parent) + : QAbstractTableModel (parent), rep (create (expr, val)) +{ + update_description (); + + connect (this, &variable_editor_model::user_error_signal, + this, &variable_editor_model::user_error); + + connect (this, &variable_editor_model::update_data_signal, + this, &variable_editor_model::update_data); + + connect (this, &variable_editor_model::data_error_signal, + this, &variable_editor_model::data_error); - if (! index_ok (idx, row, col)) - return octave_value (); + if (is_editable ()) + { + int new_rows = display_rows (); + + if (new_rows > 0) + { + beginInsertRows (QModelIndex (), 0, new_rows-1); + endInsertRows (); + } - octave_map m = m_value.map_value (); + int new_cols = display_columns (); + + if (new_cols > 0) + { + beginInsertColumns (QModelIndex (), 0, new_cols-1); + endInsertColumns (); + } + } +} - Cell cval = m.contents (col); +bool +variable_editor_model::setData (const QModelIndex& idx, + const QVariant& v_user_input, int role) +{ + if (role != Qt::EditRole || ! v_user_input.canConvert (QMetaType::QString) + || ! idx.isValid ()) + return false; + + // Initially, set value to whatever the user entered. - return cval(row); - } - }; + QString user_input = v_user_input.toString (); + + char qc = quote_char (idx); + + // FIXME: maybe we need a better way to ask whether empty input is + // valid than to rely on whether there is a quote character (meaning + // we are editing a character string)? + if (user_input.isEmpty () && ! qc) + return false; - // 2-d struct array. Rows and columns index individual scalar structs. + set_update_pending (idx, user_input); + + std::ostringstream os; + + std::string nm = name (); + os << nm; + + QString tmp = subscript_expression (idx); + os << tmp.toStdString () << "="; - class struct_model : public base_ve_model - { - public: + if (qc) + os << qc; + + os << user_input.toStdString (); + + if (qc) + os << qc; + + std::string expr = os.str (); - struct_model (const QString& expr, const octave_value& val) - : base_ve_model (expr, val) + emit interpreter_event + ([=] (interpreter& interp) { - // FIXME: should fill the window and expand on scrolling or - // resizing. + // INTERPRETER THREAD + + try + { + int parse_status = 0; + interp.eval_string (expr, true, parse_status); + + octave_value val = retrieve_variable (interp, nm); + + emit update_data_signal (val); + } + catch (const execution_exception&) + { + clear_update_pending (); + + evaluation_error (expr); - maybe_resize_rows (m_data_rows + 16); - maybe_resize_columns (m_data_cols + 16); - } + // This will cause the data in the cell to be reset + // from the cached octave_value object. + + emit dataChanged (idx, idx); + } + }); + + return true; +} + +bool +variable_editor_model::clear_content (const QModelIndex& idx) +{ + int row = idx.row (); + int col = idx.column (); + + if (row < data_rows () && col < data_columns ()) + return setData (idx, QVariant ("0")); - ~struct_model (void) = default; + return false; +} - // No copying! +Qt::ItemFlags +variable_editor_model::flags (const QModelIndex& idx) const +{ + if (! is_valid ()) + return Qt::NoItemFlags; - struct_model (const struct_model&) = delete; + Qt::ItemFlags retval = QAbstractTableModel::flags (idx); + + if (! requires_sub_editor (idx)) + retval |= Qt::ItemIsEditable; + + return retval; +} - struct_model& operator = (const struct_model&) = delete; +bool +variable_editor_model::insertRows (int row, int count, const QModelIndex&) +{ + // FIXME: cells? + + eval_expr_event + (QString ("%1 = [%1(1:%2,:); zeros(%3,columns(%1)); %1(%2+%3:end,:)]") + .arg (QString::fromStdString (name ())) + .arg (row) + .arg (count)); - void maybe_resize_rows (int rows) + return true; +} + +bool +variable_editor_model::removeRows (int row, int count, const QModelIndex&) +{ + if (row + count > data_rows ()) { - if (rows > m_display_rows) - m_display_rows = rows; + qDebug () << "Tried to remove too many rows " + << data_rows () << " " + << count << " (" << row << ")"; + return false; } - void maybe_resize_columns (int cols) - { - if (cols > m_display_cols) - m_display_cols = cols; - } - - QVariant edit_display (const QModelIndex& idx, int) const - { - int row; - int col; + eval_expr_event + (QString ("%1(%2:%3,:) = []") + .arg (QString::fromStdString (name ())) + .arg (row) + .arg (row + count)); - if (! index_ok (idx, row, col)) - return QVariant (); - - std::string str = m_value.edit_display (m_display_fmt, row, col); - return QString::fromStdString (str); - } - - bool requires_sub_editor (const QModelIndex& idx) const - { - int row; - int col; - - if (! index_ok (idx, row, col)) - return false; + return true; +} - octave_map m = m_value.map_value (); - - return do_requires_sub_editor_sub (m(row, col)); - } - - char quote_char (const QModelIndex& idx) const - { - octave_value ov = value_at (idx); - - if (ov.is_string ()) - return get_quote_char (ov); +bool +variable_editor_model::insertColumns (int col, int count, const QModelIndex&) +{ + eval_expr_event + (QString ("%1 = [%1(:,1:%2); zeros(rows(%1),%3) %1(:,%2+%3:end)]") + .arg (QString::fromStdString (name ())) + .arg (col) + .arg (count)); - return 0; - } + return true; +} - QString subscript_expression (const QModelIndex& idx) const +bool +variable_editor_model::removeColumns (int col, int count, const QModelIndex&) +{ + if (col + count > data_columns ()) { - int row; - int col; - - if (! index_ok (idx, row, col)) - return ""; - - return (QString ("(%1,%2)") - .arg (row + 1) - .arg (col + 1)); + qDebug () << "Tried to remove too many cols " + << data_columns () << " " + << count << " (" << col << ")"; + return false; } - octave_value value_at (const QModelIndex& idx) const - { - int row; - int col; - - if (! index_ok (idx, row, col)) - return octave_value (); + eval_expr_event + (QString ("%1(:,%2:%3) = []") + .arg (QString::fromStdString (name ())) + .arg (col) + .arg (col + count)); - octave_map m = m_value.map_value (); + return true; +} - return m(row, col); - } - }; - - base_ve_model * - variable_editor_model::create (const QString& expr, const octave_value& val) - { - // Choose specific model based on type of val. +void +variable_editor_model::init_from_oct (interpreter& interp) +{ + // INTERPRETER THREAD - if ((val.isnumeric () || val.islogical ()) && val.ndims () == 2) - return new numeric_model (expr, val); - else if (val.is_string () && (val.rows () == 1 || val.is_zero_by_zero ())) - return new string_model (expr, val); - else if (val.iscell ()) - return new cell_model (expr, val); - else if (val.isstruct ()) - { - if (val.numel () == 1) - return new scalar_struct_model (expr, val); - else if (val.ndims () == 2) - { - if (val.rows () == 1 || val.columns () == 1) - return new vector_struct_model (expr, val); - else - return new struct_model (expr, val); - } - } + std::string nm = name (); + + try + { + octave_value val = retrieve_variable (interp, nm); - return new display_only_model (expr, val); - } - - variable_editor_model::variable_editor_model (const QString& expr, - const octave_value& val, - QObject *parent) - : QAbstractTableModel (parent), rep (create (expr, val)) - { - update_description (); + emit update_data_signal (val); + } + catch (const execution_exception&) + { + QString msg = (QString ("variable '%1' is invalid or undefined") + .arg (QString::fromStdString (nm))); - connect (this, &variable_editor_model::user_error_signal, - this, &variable_editor_model::user_error); - - connect (this, &variable_editor_model::update_data_signal, - this, &variable_editor_model::update_data); - - connect (this, &variable_editor_model::data_error_signal, - this, &variable_editor_model::data_error); - - if (is_editable ()) - { - int new_rows = display_rows (); + emit data_error_signal (msg); + } +} - if (new_rows > 0) - { - beginInsertRows (QModelIndex (), 0, new_rows-1); - endInsertRows (); - } - - int new_cols = display_columns (); +void +variable_editor_model::eval_expr_event (const QString& expr_arg) +{ + std::string expr = expr_arg.toStdString (); - if (new_cols > 0) - { - beginInsertColumns (QModelIndex (), 0, new_cols-1); - endInsertColumns (); - } - } - } + emit interpreter_event + ([=] (interpreter& interp) + { + // INTERPRETER THREAD - bool - variable_editor_model::setData (const QModelIndex& idx, - const QVariant& v_user_input, int role) - { - if (role != Qt::EditRole || ! v_user_input.canConvert (QMetaType::QString) - || ! idx.isValid ()) - return false; - - // Initially, set value to whatever the user entered. - - QString user_input = v_user_input.toString (); - - char qc = quote_char (idx); + try + { + int parse_status = 0; + interp.eval_string (expr, true, parse_status); - // FIXME: maybe we need a better way to ask whether empty input is - // valid than to rely on whether there is a quote character (meaning - // we are editing a character string)? - if (user_input.isEmpty () && ! qc) - return false; - - set_update_pending (idx, user_input); - - std::ostringstream os; - - std::string nm = name (); - os << nm; + init_from_oct (interp); + } + catch (const execution_exception&) + { + evaluation_error (expr); + } + }); +} - QString tmp = subscript_expression (idx); - os << tmp.toStdString () << "="; - - if (qc) - os << qc; - - os << user_input.toStdString (); +// If the variable exists, load it into the data model. If it doesn't +// exist, flag the data model as referring to a nonexistent variable. +// This allows the variable to be opened before it is created. - if (qc) - os << qc; - - std::string expr = os.str (); - - emit interpreter_event - ([=] (interpreter& interp) - { - // INTERPRETER THREAD +// This function should only be called within other functions that +// execute in the interpreter thread. It should also be called in a +// try-catch block that catches execution exceptions. - try - { - int parse_status = 0; - interp.eval_string (expr, true, parse_status); - - octave_value val = retrieve_variable (interp, nm); +octave_value +variable_editor_model::retrieve_variable (interpreter& interp, + const std::string& x) +{ + // INTERPRETER THREAD - emit update_data_signal (val); - } - catch (const execution_exception&) - { - clear_update_pending (); - - evaluation_error (expr); + std::string name = x; - // This will cause the data in the cell to be reset - // from the cached octave_value object. + name = name.substr (0, name.find (".")); - emit dataChanged (idx, idx); - } - }); - - return true; - } + if (name.back () == ')' || name.back () == '}') + name = name.substr (0, name.find (name.back () == ')' ? "(" : "{")); - bool - variable_editor_model::clear_content (const QModelIndex& idx) - { - int row = idx.row (); - int col = idx.column (); + if (symbol_exist (name, "var") > 0) + { + int parse_status = 0; - if (row < data_rows () && col < data_columns ()) - return setData (idx, QVariant ("0")); - - return false; - } + octave_value result = interp.eval_string (x, true, parse_status); - Qt::ItemFlags - variable_editor_model::flags (const QModelIndex& idx) const - { - if (! is_valid ()) - return Qt::NoItemFlags; - - Qt::ItemFlags retval = QAbstractTableModel::flags (idx); + if (result.is_cs_list ()) + error ("evaluation produced c-s list"); - if (! requires_sub_editor (idx)) - retval |= Qt::ItemIsEditable; + return result; + } - return retval; - } - - bool - variable_editor_model::insertRows (int row, int count, const QModelIndex&) - { - // FIXME: cells? + return octave_value (); +} - eval_expr_event - (QString ("%1 = [%1(1:%2,:); zeros(%3,columns(%1)); %1(%2+%3:end,:)]") - .arg (QString::fromStdString (name ())) - .arg (row) - .arg (count)); - - return true; - } +void +variable_editor_model::evaluation_error (const std::string& expr) const +{ + emit user_error_signal ("Evaluation failed", + QString ("failed to evaluate expression: '%1' or result can't be edited") + .arg (QString::fromStdString (expr))); +} - bool - variable_editor_model::removeRows (int row, int count, const QModelIndex&) - { - if (row + count > data_rows ()) - { - qDebug () << "Tried to remove too many rows " - << data_rows () << " " - << count << " (" << row << ")"; - return false; - } - - eval_expr_event - (QString ("%1(%2:%3,:) = []") - .arg (QString::fromStdString (name ())) - .arg (row) - .arg (row + count)); - - return true; - } +void +variable_editor_model::user_error (const QString& title, const QString& msg) +{ + QMessageBox::critical (nullptr, title, msg); +} - bool - variable_editor_model::insertColumns (int col, int count, const QModelIndex&) - { - eval_expr_event - (QString ("%1 = [%1(:,1:%2); zeros(rows(%1),%3) %1(:,%2+%3:end)]") - .arg (QString::fromStdString (name ())) - .arg (col) - .arg (count)); +void +variable_editor_model::update_data_cache (void) +{ + emit interpreter_event + ([=] (interpreter& interp) + { + // INTERPRETER_THREAD - return true; - } + init_from_oct (interp); + }); +} - bool - variable_editor_model::removeColumns (int col, int count, const QModelIndex&) - { - if (col + count > data_columns ()) - { - qDebug () << "Tried to remove too many cols " - << data_columns () << " " - << count << " (" << col << ")"; - return false; - } +void +variable_editor_model::update_data (const octave_value& val) +{ + if (val.is_undefined ()) + { + QString msg = (QString ("variable '%1' is invalid or undefined") + .arg (QString::fromStdString (name ()))); - eval_expr_event - (QString ("%1(:,%2:%3) = []") - .arg (QString::fromStdString (name ())) - .arg (col) - .arg (col + count)); + emit data_error_signal (msg); - return true; - } - - void - variable_editor_model::init_from_oct (interpreter& interp) - { - // INTERPRETER THREAD + return; + } - std::string nm = name (); - - try - { - octave_value val = retrieve_variable (interp, nm); + // Add or remove rows and columns when the size changes. - emit update_data_signal (val); - } - catch (const execution_exception&) - { - QString msg = (QString ("variable '%1' is invalid or undefined") - .arg (QString::fromStdString (nm))); + int old_rows = display_rows (); + int old_cols = display_columns (); - emit data_error_signal (msg); - } - } + reset (val); - void - variable_editor_model::eval_expr_event (const QString& expr_arg) - { - std::string expr = expr_arg.toStdString (); - - emit interpreter_event - ([=] (interpreter& interp) - { - // INTERPRETER THREAD + int new_rows = display_rows (); + int new_cols = display_columns (); - try - { - int parse_status = 0; - interp.eval_string (expr, true, parse_status); + if (new_rows != old_rows || new_cols != old_cols) + change_display_size (old_rows, old_cols, new_rows, new_cols); - init_from_oct (interp); - } - catch (const execution_exception&) - { - evaluation_error (expr); - } - }); - } + // Even if the size doesn't change, we still need to update here + // because the data may have changed. But only if we have some data + // to display. - // If the variable exists, load it into the data model. If it doesn't - // exist, flag the data model as referring to a nonexistent variable. - // This allows the variable to be opened before it is created. - - // This function should only be called within other functions that - // execute in the interpreter thread. It should also be called in a - // try-catch block that catches execution exceptions. + if (new_rows > 0 && new_cols > 0) + emit dataChanged (QAbstractTableModel::index (0, 0), + QAbstractTableModel::index (new_rows-1, new_cols-1)); - octave_value - variable_editor_model::retrieve_variable (interpreter& interp, - const std::string& x) - { - // INTERPRETER THREAD - - std::string name = x; - - name = name.substr (0, name.find (".")); + clear_update_pending (); +} - if (name.back () == ')' || name.back () == '}') - name = name.substr (0, name.find (name.back () == ')' ? "(" : "{")); - - if (symbol_exist (name, "var") > 0) - { - int parse_status = 0; - - octave_value result = interp.eval_string (x, true, parse_status); - - if (result.is_cs_list ()) - error ("evaluation produced c-s list"); - - return result; - } - - return octave_value (); - } - - void - variable_editor_model::evaluation_error (const std::string& expr) const - { - emit user_error_signal ("Evaluation failed", - QString ("failed to evaluate expression: '%1' or result can't be edited") - .arg (QString::fromStdString (expr))); - } - - void - variable_editor_model::user_error (const QString& title, const QString& msg) - { - QMessageBox::critical (nullptr, title, msg); - } +void +variable_editor_model::change_display_size (int old_rows, int old_cols, + int new_rows, int new_cols) +{ + if (new_rows < old_rows) + { + beginRemoveRows (QModelIndex (), new_rows, old_rows-1); + endRemoveRows (); + } + else if (new_rows > old_rows) + { + beginInsertRows (QModelIndex (), old_rows, new_rows-1); + endInsertRows (); + } - void - variable_editor_model::update_data_cache (void) - { - emit interpreter_event - ([=] (interpreter& interp) - { - // INTERPRETER_THREAD - - init_from_oct (interp); - }); - } + if (new_cols < old_cols) + { + beginRemoveColumns (QModelIndex (), new_cols, old_cols-1); + endRemoveColumns (); + } + else if (new_cols > old_cols) + { + beginInsertColumns (QModelIndex (), old_cols, new_cols-1); + endInsertColumns (); + } +} - void - variable_editor_model::update_data (const octave_value& val) - { - if (val.is_undefined ()) - { - QString msg = (QString ("variable '%1' is invalid or undefined") - .arg (QString::fromStdString (name ()))); - - emit data_error_signal (msg); +void +variable_editor_model::maybe_resize_rows (int rows) +{ + int old_rows = display_rows (); + int old_cols = display_columns (); - return; - } - - // Add or remove rows and columns when the size changes. + rep->maybe_resize_rows (rows); - int old_rows = display_rows (); - int old_cols = display_columns (); - - reset (val); + int new_rows = display_rows (); + int new_cols = display_columns (); - int new_rows = display_rows (); - int new_cols = display_columns (); - - if (new_rows != old_rows || new_cols != old_cols) - change_display_size (old_rows, old_cols, new_rows, new_cols); + if (new_rows != old_rows) + change_display_size (old_rows, old_cols, new_rows, new_cols); +} - // Even if the size doesn't change, we still need to update here - // because the data may have changed. But only if we have some data - // to display. +void +variable_editor_model::maybe_resize_columns (int cols) +{ + int old_rows = display_rows (); + int old_cols = display_columns (); - if (new_rows > 0 && new_cols > 0) - emit dataChanged (QAbstractTableModel::index (0, 0), - QAbstractTableModel::index (new_rows-1, new_cols-1)); + rep->maybe_resize_columns (cols); - clear_update_pending (); - } + int new_rows = display_rows (); + int new_cols = display_columns (); - void - variable_editor_model::change_display_size (int old_rows, int old_cols, - int new_rows, int new_cols) - { - if (new_rows < old_rows) - { - beginRemoveRows (QModelIndex (), new_rows, old_rows-1); - endRemoveRows (); - } - else if (new_rows > old_rows) - { - beginInsertRows (QModelIndex (), old_rows, new_rows-1); - endInsertRows (); - } + if (new_cols != old_cols) + change_display_size (old_rows, old_cols, new_rows, new_cols); +} + +void +variable_editor_model::data_error (const QString& msg) +{ + invalidate (); - if (new_cols < old_cols) - { - beginRemoveColumns (QModelIndex (), new_cols, old_cols-1); - endRemoveColumns (); - } - else if (new_cols > old_cols) - { - beginInsertColumns (QModelIndex (), old_cols, new_cols-1); - endInsertColumns (); - } - } + update_description (msg); +} - void - variable_editor_model::maybe_resize_rows (int rows) - { - int old_rows = display_rows (); - int old_cols = display_columns (); +void +variable_editor_model::reset (const octave_value& val) +{ + base_ve_model *old_rep = rep; - rep->maybe_resize_rows (rows); - - int new_rows = display_rows (); - int new_cols = display_columns (); - - if (new_rows != old_rows) - change_display_size (old_rows, old_cols, new_rows, new_cols); - } + rep = create (QString::fromStdString (name ()), val); - void - variable_editor_model::maybe_resize_columns (int cols) - { - int old_rows = display_rows (); - int old_cols = display_columns (); + delete old_rep; - rep->maybe_resize_columns (cols); + update_description (); - int new_rows = display_rows (); - int new_cols = display_columns (); - - if (new_cols != old_cols) - change_display_size (old_rows, old_cols, new_rows, new_cols); - } + emit set_editable_signal (is_editable ()); +} - void - variable_editor_model::data_error (const QString& msg) - { - invalidate (); - - update_description (msg); - } +void +variable_editor_model::invalidate (void) +{ + beginResetModel (); - void - variable_editor_model::reset (const octave_value& val) - { - base_ve_model *old_rep = rep; + reset (octave_value ()); - rep = create (QString::fromStdString (name ()), val); - - delete old_rep; + endResetModel (); +} - update_description (); - - emit set_editable_signal (is_editable ()); - } - - void - variable_editor_model::invalidate (void) - { - beginResetModel (); - - reset (octave_value ()); - - endResetModel (); - } +void +variable_editor_model::update_description (const QString& description) +{ + emit description_changed (description.isEmpty () + ? make_description_text () : description); +} - void - variable_editor_model::update_description (const QString& description) - { - emit description_changed (description.isEmpty () - ? make_description_text () : description); - } - - void - variable_editor_model::double_click (const QModelIndex& idx) - { - if (requires_sub_editor (idx)) - { - QString name = QString::fromStdString(rep->name ()); - emit edit_variable_signal (name + subscript_expression (idx), - value_at (idx)); - } - } +void +variable_editor_model::double_click (const QModelIndex& idx) +{ + if (requires_sub_editor (idx)) + { + QString name = QString::fromStdString(rep->name ()); + emit edit_variable_signal (name + subscript_expression (idx), + value_at (idx)); + } +} OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/variable-editor-model.h --- a/libgui/src/variable-editor-model.h Tue Dec 06 15:37:43 2022 -0500 +++ b/libgui/src/variable-editor-model.h Tue Dec 06 15:45:27 2022 -0500 @@ -37,313 +37,313 @@ OCTAVE_BEGIN_NAMESPACE(octave) - class interpreter; +class interpreter; - class base_ve_model - { - public: +class base_ve_model +{ +public: - base_ve_model (const QString& expr, const octave_value& val); + base_ve_model (const QString& expr, const octave_value& val); - virtual ~base_ve_model (void) = default; + virtual ~base_ve_model (void) = default; - // No copying! + // No copying! - base_ve_model (const base_ve_model&) = delete; + base_ve_model (const base_ve_model&) = delete; - base_ve_model& operator = (const base_ve_model&) = delete; + base_ve_model& operator = (const base_ve_model&) = delete; - virtual void maybe_resize_rows (int) { } + virtual void maybe_resize_rows (int) { } - virtual void maybe_resize_columns (int) { } + virtual void maybe_resize_columns (int) { } - std::string name (void) const; + std::string name (void) const; - bool index_ok (const QModelIndex& idx, int& row, int& col) const; + bool index_ok (const QModelIndex& idx, int& row, int& col) const; - virtual bool is_editable (void) const { return true; } + virtual bool is_editable (void) const { return true; } - virtual octave_value value_at (const QModelIndex& idx) const; + virtual octave_value value_at (const QModelIndex& idx) const; - int column_width (void) const; + int column_width (void) const; - int rowCount (const QModelIndex& = QModelIndex ()) const; + int rowCount (const QModelIndex& = QModelIndex ()) const; - int columnCount (const QModelIndex& = QModelIndex ()) const; + int columnCount (const QModelIndex& = QModelIndex ()) const; - QString edit_display_sub (const octave_value& elt, int role) const; + QString edit_display_sub (const octave_value& elt, int role) const; - virtual QVariant edit_display (const QModelIndex& idx, int role) const; + virtual QVariant edit_display (const QModelIndex& idx, int role) const; - QVariant data (const QModelIndex& idx, int role = Qt::DisplayRole) const; + QVariant data (const QModelIndex& idx, int role = Qt::DisplayRole) const; - virtual bool requires_sub_editor (const QModelIndex& idx) const; + virtual bool requires_sub_editor (const QModelIndex& idx) const; - void set_update_pending (const QModelIndex& idx, const QString& str); + void set_update_pending (const QModelIndex& idx, const QString& str); - bool update_pending (const QModelIndex& idx) const; + bool update_pending (const QModelIndex& idx) const; - QString update_pending_data (const QModelIndex& idx) const; + QString update_pending_data (const QModelIndex& idx) const; - void clear_update_pending (void); + void clear_update_pending (void); - virtual char quote_char (const QModelIndex& idx) const; + virtual char quote_char (const QModelIndex& idx) const; - virtual QVariant - header_data (int section, Qt::Orientation orientation, int role) const; + virtual QVariant + header_data (int section, Qt::Orientation orientation, int role) const; - // Return a subscript expression as a string that can be used to - // access a sub-element of a data structure. For example "{1,3}" - // for cell array element {1,3} or "(2,4)" for array element (2,4). + // Return a subscript expression as a string that can be used to + // access a sub-element of a data structure. For example "{1,3}" + // for cell array element {1,3} or "(2,4)" for array element (2,4). - virtual QString subscript_expression (const QModelIndex& idx) const; + virtual QString subscript_expression (const QModelIndex& idx) const; - bool is_valid (void) const { return m_valid; } + bool is_valid (void) const { return m_valid; } - octave_idx_type data_rows (void) const { return m_data_rows; } + octave_idx_type data_rows (void) const { return m_data_rows; } - octave_idx_type data_columns (void) const { return m_data_cols; } + octave_idx_type data_columns (void) const { return m_data_cols; } - int display_rows (void) const { return m_display_rows; } + int display_rows (void) const { return m_display_rows; } - int display_columns (void) const { return m_display_cols; } + int display_columns (void) const { return m_display_cols; } - virtual QString make_description_text (void) const; + virtual QString make_description_text (void) const; - void reset (const octave_value& val); + void reset (const octave_value& val); - protected: +protected: - std::string m_name; + std::string m_name; - octave_value m_value; + octave_value m_value; - octave_idx_type m_data_rows; - octave_idx_type m_data_cols; + octave_idx_type m_data_rows; + octave_idx_type m_data_cols; - // Qt table widget limits the size to int. - int m_display_rows; - int m_display_cols; + // Qt table widget limits the size to int. + int m_display_rows; + int m_display_cols; - QMap m_update_pending; + QMap m_update_pending; - bool m_valid; + bool m_valid; - float_display_format m_display_fmt; - }; + float_display_format m_display_fmt; +}; - class variable_editor_model : public QAbstractTableModel - { - Q_OBJECT +class variable_editor_model : public QAbstractTableModel +{ + Q_OBJECT - private: +private: - static base_ve_model * create (const QString& expr, const octave_value& val); + static base_ve_model * create (const QString& expr, const octave_value& val); - public: +public: - variable_editor_model (const QString& expr, const octave_value& val, - QObject *parent = nullptr); + variable_editor_model (const QString& expr, const octave_value& val, + QObject *parent = nullptr); - ~variable_editor_model (void) - { - delete rep; - } + ~variable_editor_model (void) + { + delete rep; + } - // No copying! + // No copying! - variable_editor_model (const variable_editor_model&) = delete; + variable_editor_model (const variable_editor_model&) = delete; - variable_editor_model& operator = (const variable_editor_model&) = delete; + variable_editor_model& operator = (const variable_editor_model&) = delete; - std::string name (void) const - { - return rep->name (); - } + std::string name (void) const + { + return rep->name (); + } - bool is_editable (void) const - { - return rep->is_editable (); - } + bool is_editable (void) const + { + return rep->is_editable (); + } - octave_value value_at (const QModelIndex& idx) const - { - return rep->value_at (idx); - } + octave_value value_at (const QModelIndex& idx) const + { + return rep->value_at (idx); + } - int column_width (void) const - { - return rep->column_width (); - } + int column_width (void) const + { + return rep->column_width (); + } - int rowCount (const QModelIndex& idx = QModelIndex ()) const - { - return rep->rowCount (idx); - } + int rowCount (const QModelIndex& idx = QModelIndex ()) const + { + return rep->rowCount (idx); + } - int columnCount (const QModelIndex& idx = QModelIndex ()) const - { - return rep->columnCount (idx); - } + int columnCount (const QModelIndex& idx = QModelIndex ()) const + { + return rep->columnCount (idx); + } - QVariant data (const QModelIndex& idx = QModelIndex (), - int role = Qt::DisplayRole) const - { - return rep->data (idx, role); - } + QVariant data (const QModelIndex& idx = QModelIndex (), + int role = Qt::DisplayRole) const + { + return rep->data (idx, role); + } - bool setData (const QModelIndex& idx, const QVariant& v, - int role = Qt::EditRole); + bool setData (const QModelIndex& idx, const QVariant& v, + int role = Qt::EditRole); - bool clear_content (const QModelIndex& idx); + bool clear_content (const QModelIndex& idx); - Qt::ItemFlags flags (const QModelIndex& idx) const; + Qt::ItemFlags flags (const QModelIndex& idx) const; - bool insertRows (int row, int count, - const QModelIndex& parent = QModelIndex()); + bool insertRows (int row, int count, + const QModelIndex& parent = QModelIndex()); - bool removeRows (int row, int count, - const QModelIndex& parent = QModelIndex()); + bool removeRows (int row, int count, + const QModelIndex& parent = QModelIndex()); - bool insertColumns (int column, int count, - const QModelIndex& parent = QModelIndex()); + bool insertColumns (int column, int count, + const QModelIndex& parent = QModelIndex()); - bool removeColumns (int column, int count, - const QModelIndex& parent = QModelIndex()); + bool removeColumns (int column, int count, + const QModelIndex& parent = QModelIndex()); - // Is cell at idx complex enough to require a sub editor? + // Is cell at idx complex enough to require a sub editor? - bool requires_sub_editor (const QModelIndex& idx) const - { - return rep->requires_sub_editor (idx); - } + bool requires_sub_editor (const QModelIndex& idx) const + { + return rep->requires_sub_editor (idx); + } - void set_update_pending (const QModelIndex& idx, const QString& str) - { - rep->set_update_pending (idx, str); - } + void set_update_pending (const QModelIndex& idx, const QString& str) + { + rep->set_update_pending (idx, str); + } - bool update_pending (const QModelIndex& idx) const - { - return rep->update_pending (idx); - } + bool update_pending (const QModelIndex& idx) const + { + return rep->update_pending (idx); + } - QString update_pending_data (const QModelIndex& idx) const - { - return rep->update_pending_data (idx); - } + QString update_pending_data (const QModelIndex& idx) const + { + return rep->update_pending_data (idx); + } - void clear_update_pending (void) - { - rep->clear_update_pending (); - } + void clear_update_pending (void) + { + rep->clear_update_pending (); + } - char quote_char (const QModelIndex& idx) const - { - return rep->quote_char (idx); - } + char quote_char (const QModelIndex& idx) const + { + return rep->quote_char (idx); + } - QVariant - headerData (int section, Qt::Orientation orientation, int role) const - { - return rep->header_data (section, orientation, role); - } + QVariant + headerData (int section, Qt::Orientation orientation, int role) const + { + return rep->header_data (section, orientation, role); + } - // Return a subscript expression as a string that can be used to - // access a sub-element of a data structure. For example "{1,3}" - // for cell array element {1,3} or "(2,4)" for array element (2,4). + // Return a subscript expression as a string that can be used to + // access a sub-element of a data structure. For example "{1,3}" + // for cell array element {1,3} or "(2,4)" for array element (2,4). - QString subscript_expression (const QModelIndex& idx) const - { - return rep->subscript_expression (idx); - } + QString subscript_expression (const QModelIndex& idx) const + { + return rep->subscript_expression (idx); + } - int display_rows (void) const - { - return rep->display_rows (); - } + int display_rows (void) const + { + return rep->display_rows (); + } - octave_idx_type data_rows (void) const - { - return rep->data_rows (); - } + octave_idx_type data_rows (void) const + { + return rep->data_rows (); + } - int display_columns (void) const - { - return rep->display_columns (); - } + int display_columns (void) const + { + return rep->display_columns (); + } - octave_idx_type data_columns (void) const - { - return rep->data_columns (); - } + octave_idx_type data_columns (void) const + { + return rep->data_columns (); + } - void maybe_resize_rows (int rows); + void maybe_resize_rows (int rows); - void maybe_resize_columns (int cols); + void maybe_resize_columns (int cols); - signals: +signals: - void update_data_signal (const octave_value& val); + void update_data_signal (const octave_value& val); - void data_error_signal (const QString& name) const; + void data_error_signal (const QString& name) const; - void user_error_signal (const QString& title, const QString& msg) const; + void user_error_signal (const QString& title, const QString& msg) const; - void set_editable_signal (bool); + void set_editable_signal (bool); - void description_changed (const QString& description); + void description_changed (const QString& description); - void edit_variable_signal (const QString& name, const octave_value& val); + void edit_variable_signal (const QString& name, const octave_value& val); - void interpreter_event (const fcn_callback& fcn); - void interpreter_event (const meth_callback& meth); + void interpreter_event (const fcn_callback& fcn); + void interpreter_event (const meth_callback& meth); - public slots: +public slots: - void update_data (const octave_value& val); + void update_data (const octave_value& val); - void update_data_cache (void); + void update_data_cache (void); - void double_click (const QModelIndex& idx); + void double_click (const QModelIndex& idx); - private slots: +private slots: - void data_error (const QString& msg); + void data_error (const QString& msg); - void user_error (const QString& title, const QString& msg); + void user_error (const QString& title, const QString& msg); - private: +private: - base_ve_model *rep; + base_ve_model *rep; - void init_from_oct (interpreter& interp); + void init_from_oct (interpreter& interp); - void eval_expr_event (const QString& expr); + void eval_expr_event (const QString& expr); - octave_value retrieve_variable (interpreter&, const std::string& name); + octave_value retrieve_variable (interpreter&, const std::string& name); - bool is_valid (void) const - { - return rep->is_valid (); - } + bool is_valid (void) const + { + return rep->is_valid (); + } - void change_display_size (int old_rows, int old_cols, - int new_rows, int new_cols); + void change_display_size (int old_rows, int old_cols, + int new_rows, int new_cols); - QString make_description_text (void) const - { - return rep->make_description_text (); - } + QString make_description_text (void) const + { + return rep->make_description_text (); + } - void reset (const octave_value& val); + void reset (const octave_value& val); - void invalidate (void); + void invalidate (void); - void update_description (const QString& description = QString ()); + void update_description (const QString& description = QString ()); - void evaluation_error (const std::string& expr) const; - }; + void evaluation_error (const std::string& expr) const; +}; OCTAVE_END_NAMESPACE(octave) diff -r 431f80aba37a -r deb553ac2c54 libgui/src/variable-editor.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/variable-editor.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/welcome-wizard.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/welcome-wizard.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/workspace-model.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/workspace-model.h diff -r 431f80aba37a -r deb553ac2c54 libgui/src/workspace-view.cc diff -r 431f80aba37a -r deb553ac2c54 libgui/src/workspace-view.h