diff libgui/src/m-editor/file-editor-tab.h @ 27787:5169ed0ff0f0

only one find dialog for all editor tabs (bug #57238) This changeset essentially move the handling of the find dialog from the file editor tab(s) to the editor itself. * gui-preferences-ed.h: added enum with find dialog options and preferecens of the find dialog that are stored in the preferences file * file-editor-tab.cc (file_editor_tab): remove initialization of find dialog; (~file_editor_tab): remove removal of find dialog; (handle_toplevel_changed): remove slot, which only handled the find dialog (set_focus): emit new signal for updating the find dialog with edit area; (handle_find_dialog_finished, find, finde_create): removed; (change_editor_state): remove find dialog updates * file-editor-tab.h: do not include find-dialog.h, new signal edit_area_changed, removed slots request_find_next, request_find_previous, handle_toplevel_changed, find, find_next, find_previous, handle_find_dialog_finished, removed method find_create as well as class variables m_find_dialog and m_find_dlg_data * file-editor.cc (file_editor) initialize protexted pointer to find dialog, no more list of actions that are also required in the find dialog (enable_menu_shortcuts): make find dialog visible or not depending on the editors focus; (handle_tab_ready_to_close): close find dialog, when editor is closed; (request_find): do not emit a signal for the editor tabs but create and activate the find dialog here; (request_find_next, request_find_previous): no more teb signal, call the related method of the find dialog directly; (find_create): new method for creating the find dialog with appropriate icon and position; (notice_settings): update window icon of the find dialog (toplevel_change): do not emit signal for editor tabs but close and recreate the find dialog with the appropriate parent (make_file_editor_tab): connect new signal for changed edit area to find dialog slot, remove other find related connections * file-editor.h: include find-dialog.h, removed signal fetab_toplevel_changed, fetab_find, fetab_find_next, fetab_find_previous, added signal edit_area_changed, added method find_create, removed m_fetab_actions, added QPointer m_find_dialog * find-dialog.cc include required include file, (find_dialog): ctor with base_qobject, editor widget and parent, new window title, remove obsolete signal connection and add connections for new signals; (update_edit_area): slot when a new edit area gets focus and becomes the target for the find dialog (save_settings): moved from save_data, data is saved int he preferences file, not in struct (restore_settings): moved from restore data, load settings from preferences file, not from a given struct (reject): reimplemented reject method for calling close on ESC; (closeEvent): reimplemented close event for saving settings before close (set_visible): method for hiding and showing the dialog depending on the focus state of the editor, remember last position because otherwise the dialog would be slightly shifted each time it is re-shown * find-dialog.h: remove data structure for settings and enum with options, new methods find_next, find_prev, set_visible, moved save_data and restore_data to save_settings and restore_settings resp., new slot update_edit_area, reimplemented reject and closeEvent, class variables for editor, qobject and last position
author Torsten Lilge <ttl-octave@mailbox.org>
date Sun, 08 Dec 2019 21:39:57 +0100
parents a18081db8fa3
children 465ac679e976
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.h	Sun Dec 08 11:11:00 2019 -0800
+++ b/libgui/src/m-editor/file-editor-tab.h	Sun Dec 08 21:39:57 2019 +0100
@@ -33,9 +33,6 @@
 #include <QWidget>
 #include <Qsci/qsciapis.h>
 
-#include "find-dialog.h"
-// Only needed for typedef of "QIntList", which may be typedefed
-// elsewhere.  Could use common location.
 #include "gui-settings.h"
 #include "marker.h"
 #include "octave-qscintilla.h"
@@ -76,6 +73,7 @@
                             bool modified);
     void editor_state_changed (bool copy_available, bool is_octave_file);
     void set_focus_editor_signal (QWidget *);
+    void edit_area_changed (octave_qscintilla *edit_area);
     void tab_remove_request (void);
     void mru_add_file (const QString& file_name, const QString& encoding);
     void editor_check_conflict_save (const QString& saveFileName,
@@ -85,9 +83,6 @@
     void edit_mfile_request (const QString&, const QString&,
                              const QString&, int);
 
-    void request_find_next (void);
-    void request_find_previous (void);
-
     void update_breakpoints_signal (const octave_value_list& args);
 
     void remove_breakpoint_via_debugger_linenr (int debugger_linenr);
@@ -141,7 +136,6 @@
     // Change to a different editor tab by identifier tag.
     void change_editor_state (const QWidget *ID);
 
-    void handle_toplevel_changed (bool);
     void set_focus (const QWidget *ID);
     void set_current_directory (const QString& dir);
     void context_help (const QWidget *ID, bool);
@@ -177,9 +171,6 @@
     void zoom_out (const QWidget *ID);
     void zoom_normal (const QWidget *ID);
 
-    void find (const QWidget *ID, QList<QAction *>);
-    void find_next (const QWidget *ID);
-    void find_previous (const QWidget *ID);
     void goto_line (const QWidget *ID, int line = -1);
     void move_match_brace (const QWidget *ID, bool select);
     void show_auto_completion (const QWidget *ID);
@@ -220,9 +211,6 @@
     // When user closes message box for resave question.
     void handle_file_resave_answer (int decision);
 
-    // When user closes find_dialog box.
-    void handle_find_dialog_finished (int decision);
-
     // When user closes QFileDialog box.
     void handle_save_file_as_answer (const QString& fileName);
     void handle_save_file_as_answer_close (const QString& fileName);
@@ -279,8 +267,6 @@
 
     void add_breakpoint_event (const bp_info& info);
 
-    void find_create (void);
-
     bool valid_file_name (const QString& file = QString ());
     void save_file (const QString& saveFileName, bool remove_on_success = false,
                     bool restore_breakpoints = true);
@@ -359,9 +345,6 @@
     };
 
     breakpoint_info m_breakpoint_info;
-
-    find_dialog *m_find_dialog;
-    find_dialog::find_dialog_data m_find_dlg_data;
   };
 }