changeset 33564:36a19bb5cf61 bytecode-interpreter

maint: Merge default to bytecode-interpreter
author Arun Giridhar <arungiridhar@gmail.com>
date Fri, 10 May 2024 17:05:58 -0400
parents 67d22dc78b80 (current diff) 474f5a226fe0 (diff)
children 9f0f7a898b73
files
diffstat 4 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/command-widget.cc	Fri May 10 11:27:56 2024 -0400
+++ b/libgui/src/command-widget.cc	Fri May 10 17:05:58 2024 -0400
@@ -55,11 +55,9 @@
   : QWidget (p), m_incomplete_parse (false),
     m_prompt (QString ()),
     m_console (new console (this)),
-    m_find_widget (new find_widget (false, this))
-
+    m_find_widget (new find_widget (false, this)),
+    m_find_shortcut (new QShortcut (this))
 {
-  gui_settings settings;
-
   QPushButton *pause_button = new QPushButton (tr("Pause"), this);
   QPushButton *stop_button = new QPushButton (tr("Stop"), this);
   QPushButton *resume_button = new QPushButton (tr("Continue"), this);
@@ -111,6 +109,10 @@
   connect (m_console, qOverload<const meth_callback&> (&console::interpreter_event),
            this, qOverload<const meth_callback&> (&command_widget::interpreter_event));
 
+  m_find_shortcut->setContext (Qt::WidgetWithChildrenShortcut);
+  connect (m_find_shortcut, &QShortcut::activated,
+           m_find_widget, &find_widget::activate_find);
+
   insert_interpreter_output ("\n\n    Welcome to Octave\n\n");
 }
 
@@ -223,6 +225,8 @@
   m_console->setStyleSheet (QString ("color: %1; background-color:%2;")
                             .arg (fgc.name ()).arg (bgc.name ()));
 
+  settings.shortcut (m_find_shortcut, sc_edit_edit_find_replace);
+
   m_find_widget->notice_settings ();
 }
 
--- a/libgui/src/command-widget.h	Fri May 10 11:27:56 2024 -0400
+++ b/libgui/src/command-widget.h	Fri May 10 17:05:58 2024 -0400
@@ -27,10 +27,11 @@
 #define octave_command_widget_h 1
 
 #include <QWidget>
-
 #include <Qsci/qsciscintilla.h>
+#include <QShortcut>
 
 #include "find-widget.h"
+#include "gui-preferences-sc.h"
 
 // FIXME: We need the following header for the fcn_callback and
 // meth_callback typedefs.  Maybe it would be better to declare those in
@@ -138,6 +139,7 @@
   QString m_prompt;
   console *m_console;
   find_widget *m_find_widget;
+  QShortcut *m_find_shortcut;
 
 };
 
--- a/libgui/src/find-widget.cc	Fri May 10 11:27:56 2024 -0400
+++ b/libgui/src/find-widget.cc	Fri May 10 17:05:58 2024 -0400
@@ -38,6 +38,7 @@
 // of the doc dock widget
 find_widget::find_widget (bool x_button, QWidget *p)
   : QWidget (p),
+    m_is_closeable (x_button),
     m_find_line_edit (new QLineEdit (this)),
     m_findnext_shortcut (new QShortcut (this)),
     m_findprev_shortcut (new QShortcut (this))
@@ -101,7 +102,7 @@
 void
 find_widget::activate_find ()
 {
-  if (isVisible ())
+  if (m_is_closeable && isVisible ())
     {
       hide ();
     }
--- a/libgui/src/find-widget.h	Fri May 10 11:27:56 2024 -0400
+++ b/libgui/src/find-widget.h	Fri May 10 17:05:58 2024 -0400
@@ -94,6 +94,8 @@
 
 private:
 
+  bool m_is_closeable;
+
   QLineEdit *m_find_line_edit;
 
   QShortcut *m_findnext_shortcut;