Mercurial > octave
diff libgui/src/m-editor/find-dialog.cc @ 27089:9326c2258e60
fix visibility of find dialog when editor is docked/undocked (bug #5)
* file-editor-interface.h: implementation of virtual slot toplevel_change
* file-editor-tab.cc (handle_toplevel_changed): new slot for editor singal
when editor toplevel changed, destroying and re-creating find dialog where
the state of the dialog is saved in a new structure;
(handle_find_dialog_finished): store geometry and visibility in the new
data structure of the find dialog;
(find_create): new method with the main actions for creating the find dialog
moved from find (), this method is called for re-creating the dialog
(find): move most of this slot into new method find_create, only leave
actions for very first initialization of the dialog;
(change_editor_state): use new data struct instead of separate variables
for saving and restoring dialog data
* file-editor-tab.h: new slot handle_toplevel_changed, new method
find_create, new structure for saving dialog data
* file-editor.cc (toplevel_changed): implementation of new slot for signal
on toplevel changed;
(add_file_editor_tab): connect editor signal on toplevel changed to the
related slot in file_editor_tab
* file-editor.h: new signal fetab_toplevel_changed, new slot toplevel_change
* find-dialog.cc (save_data): new method for saving the current state of
the find dialog in a structure passed by the caller;
(restore_data): new method for restoring the current state from a given
data structure;
* find-dialog.h: typedef of data structure with enum for the binary options,
new methods for saving and restoring data in/from the structure
* octave-dock-widget.cc (make_window): manually emit toplevelChanged signal
in case we undock a widget since our methid seems to prevent qt from
doing so
* octave-dock-widget.h: make slot toplevel_changed protected and virtual
allowing a re-implementation in specific widgets
author | Torsten Lilge <ttl-octave@mailbox.org> |
---|---|
date | Tue, 14 May 2019 22:41:32 +0200 |
parents | aced09cc1721 |
children | acedcba362be |
line wrap: on
line diff
--- a/libgui/src/m-editor/find-dialog.cc Fri May 10 22:15:37 2019 +0200 +++ b/libgui/src/m-editor/find-dialog.cc Tue May 14 22:41:32 2019 +0200 @@ -202,6 +202,39 @@ } + void find_dialog::save_data (find_dialog_data *fdlg_data) + { + fdlg_data->text = _search_line_edit->text (); + fdlg_data->replace_text = _replace_line_edit->text (); + fdlg_data->geometry = geometry (); + fdlg_data->is_visible = isVisible (); + fdlg_data->options = 0 + + _extension->isVisible () * FIND_DLG_MORE + + _case_check_box->isChecked () * FIND_DLG_CASE + + _from_start_check_box->isChecked () * FIND_DLG_START + + _wrap_check_box->isChecked () * FIND_DLG_WRAP + + _regex_check_box->isChecked () * FIND_DLG_REGX + + _whole_words_check_box->isChecked () * FIND_DLG_WORDS + + _backward_check_box->isChecked () * FIND_DLG_BACK + + _search_selection_check_box->isChecked () * FIND_DLG_SEL; + } + + void find_dialog::restore_data (const find_dialog_data* fdlg_data) + { + setGeometry (fdlg_data->geometry); + setVisible (fdlg_data->is_visible); + _search_line_edit->setText (fdlg_data->text); + _replace_line_edit->setText (fdlg_data->replace_text); + _extension->setVisible (FIND_DLG_MORE & fdlg_data->options); + _case_check_box->setChecked (FIND_DLG_CASE & fdlg_data->options); + _from_start_check_box->setChecked (FIND_DLG_START & fdlg_data->options); + _wrap_check_box->setChecked (FIND_DLG_WRAP & fdlg_data->options); + _regex_check_box->setChecked (FIND_DLG_REGX & fdlg_data->options); + _whole_words_check_box->setChecked (FIND_DLG_WORDS & fdlg_data->options); + _backward_check_box->setChecked (FIND_DLG_BACK & fdlg_data->options); + _search_selection_check_box->setChecked (FIND_DLG_SEL & fdlg_data->options); + } + // set text of "search from start" depending on backward search void find_dialog::handle_backward_search_changed (int backward) {