Mercurial > octave-nkf
annotate libgui/src/m-editor/file-editor-tab.h @ 19445:ed0df431631b gui-release
allow to cancel exiting if editor tabs are modified and exit is requested in gui
* file-editor-interface.h: new function check_closing
* file-editor-tab.cc (ctor): set default for app_closing to 0 (not closing);
(check_file_modified): dialog boxes for modified editor tabs depending on
app closing or not;
(conditional_close): no slot, but ordinary function returning close result;
* file-editor-tab.h: conditional_close is function, not a slot;
_app_closing is now int for closing from gui, from octave, not closing
* file-editor.cc (dtor): calling new function check_closing if there are
open tabs (exit requested octave), do not save session here since the tabs
might already have been closed;
(check_closing): new function saving session info and closing all tabs,
stop closing tabs and returning false if user cancels exiting if there is
a modified tab;
(request_close_file, request_close_all_files, request_close_other_files,
handle_tab_close_request):
use conditional_close instead of signal;
(construct): do not connect old signal for closing the tabs
* file-editor.h: remove signal fetab_close_request, new function check_closing
* main-window.cc (confirm_exit_octave): call file_editor::check_closing
before really closing the app
author | Torsten <ttl@justmail.de> |
---|---|
date | Sat, 20 Dec 2014 17:26:53 +0100 |
parents | ce9bd5ed44d2 |
children | f90bb1e30de2 |
rev | line source |
---|---|
15204
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
1 /* |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
2 |
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
17635
diff
changeset
|
3 Copyright (C) 2011-2013 Jacob Dawid |
15204
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
4 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
5 This file is part of Octave. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
6 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
7 Octave is free software; you can redistribute it and/or modify it |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
8 under the terms of the GNU General Public License as published by the |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
9 Free Software Foundation; either version 3 of the License, or (at your |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
10 option) any later version. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
11 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
15 for more details. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
16 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
19 <http://www.gnu.org/licenses/>. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
20 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
21 */ |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
22 |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17790
diff
changeset
|
23 #if !defined (octave_file_editor_tab_h) |
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17790
diff
changeset
|
24 #define octave_file_editor_tab_h 1 |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
25 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
26 #include <QWidget> |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
27 #include <QCloseEvent> |
14690
ca733a66be7a
Fixed bug with not opening the editor when clicking a file from the file browser. Implemented watching the file on disk.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14680
diff
changeset
|
28 #include <QFileSystemWatcher> |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16395
diff
changeset
|
29 #include <QSettings> |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16570
diff
changeset
|
30 #include <QFileInfo> |
16704
e38a0fa08368
fix restoring editor files from previous session and speedup lexer preparation
Torsten <ttl@justmail.de>
parents:
16638
diff
changeset
|
31 #include <Qsci/qsciapis.h> |
17962
4a53bcc1a4ae
GUI: Add statusbar with line/col indicator to editor window (Bug #40626)
John Donoghue <john.donoghue@ieee.org>
parents:
17822
diff
changeset
|
32 #include <QStatusBar> |
4a53bcc1a4ae
GUI: Add statusbar with line/col indicator to editor window (Bug #40626)
John Donoghue <john.donoghue@ieee.org>
parents:
17822
diff
changeset
|
33 #include <QLabel> |
19283
d10c711a08d8
add a drop down menu with the eol mode in the save-file-as-dialog
Torsten <ttl@justmail.de>
parents:
19281
diff
changeset
|
34 #include <QComboBox> |
16558 | 35 |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
36 #include "find-dialog.h" |
16731
01d523d5f796
add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
16719
diff
changeset
|
37 #include "octave-qscintilla.h" |
18867
6504a1932637
auto completion offers builtins and file functions for octave (bug #41371)
Torsten <ttl@justmail.de>
parents:
18801
diff
changeset
|
38 #include "builtin-defun-decls.h" |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
39 |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
40 class file_editor; |
16558 | 41 |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
42 class file_editor_tab : public QWidget |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
43 { |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
44 Q_OBJECT |
16558 | 45 |
46 public: | |
47 | |
48 file_editor_tab (const QString& directory = ""); | |
49 | |
50 ~file_editor_tab (void); | |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
51 |
18723
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18721
diff
changeset
|
52 octave_qscintilla *qsci_edit_area () { return _edit_area; } |
fac35875f6eb
update enabled status of undo/redo actions in the editor
Torsten <ttl@justmail.de>
parents:
18721
diff
changeset
|
53 |
19445
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19290
diff
changeset
|
54 // Will initiate close if associated with the identifier tag. |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19290
diff
changeset
|
55 bool conditional_close (int app_closing = 0); // default 0: close tab only |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19290
diff
changeset
|
56 |
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19290
diff
changeset
|
57 |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
58 public slots: |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
59 |
16558 | 60 void update_window_title (bool modified); |
61 void handle_copy_available (bool enableCopy); | |
62 void handle_margin_clicked (int line, int margin, | |
63 Qt::KeyboardModifiers state); | |
64 | |
65 // Tells the editor tab to react on changed settings. | |
16413
28136851099a
remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
16395
diff
changeset
|
66 void notice_settings (const QSettings *settings); |
16558 | 67 |
68 // Change to a different editor tab by identifier tag. | |
69 void change_editor_state (const QWidget *ID); | |
70 | |
71 // Simply transmit file name. | |
72 void file_name_query (const QWidget *ID); | |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
73 |
16558 | 74 void set_focus (const QWidget *ID); |
17627
811019b9ef57
Add help and documentation on actual keyword to the editor menu
Torsten <ttl@justmail.de>
parents:
16731
diff
changeset
|
75 void context_help (const QWidget *ID, bool); |
17628
99ffa521ecec
Add possibility to edit the function related to the actual keyword in editor
Torsten <ttl@justmail.de>
parents:
17627
diff
changeset
|
76 void context_edit (const QWidget *ID); |
16558 | 77 void save_file (const QWidget *ID); |
78 void save_file (const QWidget *ID, const QString& fileName, | |
79 bool remove_on_success); | |
80 void save_file_as (const QWidget *ID); | |
81 void print_file (const QWidget *ID); | |
82 void run_file (const QWidget *ID); | |
17635
7945344506ae
Add possibility to run selected text of the editor in the terminal
Torsten <ttl@justmail.de>
parents:
17628
diff
changeset
|
83 void context_run (const QWidget *ID); |
16558 | 84 void toggle_bookmark (const QWidget *ID); |
85 void next_bookmark (const QWidget *ID); | |
86 void previous_bookmark (const QWidget *ID); | |
87 void remove_bookmark (const QWidget *ID); | |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
88 |
16558 | 89 void toggle_breakpoint (const QWidget *ID); |
90 void next_breakpoint (const QWidget *ID); | |
91 void previous_breakpoint (const QWidget *ID); | |
92 void remove_all_breakpoints (const QWidget *ID); | |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
93 |
18690
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18573
diff
changeset
|
94 void scintilla_command (const QWidget *, unsigned int); |
1b289f45187f
add some qscintilla actions to the menu and to the shortcut manager
Torsten <ttl@justmail.de>
parents:
18573
diff
changeset
|
95 |
16558 | 96 void comment_selected_text (const QWidget *ID); |
97 void uncomment_selected_text (const QWidget *ID); | |
18303
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18275
diff
changeset
|
98 |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18275
diff
changeset
|
99 void indent_selected_text (const QWidget *ID); |
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18275
diff
changeset
|
100 void unindent_selected_text (const QWidget *ID); |
19281
9582fad68730
add actions for converting the eol characters of the editor file
Torsten <ttl@justmail.de>
parents:
19274
diff
changeset
|
101 void convert_eol (const QWidget *ID, QsciScintilla::EolMode); |
18303
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18275
diff
changeset
|
102 |
18573
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18568
diff
changeset
|
103 void zoom_in (const QWidget *ID); |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18568
diff
changeset
|
104 void zoom_out (const QWidget *ID); |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18568
diff
changeset
|
105 void zoom_normal (const QWidget *ID); |
26d15a57f45b
add menu entries and shortcuts for zoom functions in the editor (bug #41516)
Torsten <ttl@justmail.de>
parents:
18568
diff
changeset
|
106 |
16558 | 107 void find (const QWidget *ID); |
108 void goto_line (const QWidget *ID, int line = -1); | |
18482
3a509de8e791
automatic completion list as user preference (bug #41469)
Torsten <ttl@justmail.de>
parents:
18460
diff
changeset
|
109 void show_auto_completion (const QWidget *ID); |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
110 |
16395
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
111 void insert_debugger_pointer (const QWidget *ID, int line = -1); |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
112 void delete_debugger_pointer (const QWidget *ID, int line = -1); |
fc491da603f6
also provide a hook for exiting debugger
John W. Eaton <jwe@octave.org>
parents:
16389
diff
changeset
|
113 |
16443
7a2ee6ea7800
rename dbstop -> breakpoint in GUI interface functions
John W. Eaton <jwe@octave.org>
parents:
16440
diff
changeset
|
114 void do_breakpoint_marker (bool insert, const QWidget *ID, int line = -1); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
115 |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
116 void set_modified (bool modified = true); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
117 |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
118 QString load_file (const QString& fileName); |
16452
744ff2fe11ce
add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents:
16443
diff
changeset
|
119 void new_file (const QString& commands = QString ()); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
120 |
15300
fd27e10b9b05
pass QString by const reference instead of value
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
121 void file_has_changed (const QString& fileName); |
14690
ca733a66be7a
Fixed bug with not opening the editor when clicking a file from the file browser. Implemented watching the file on disk.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14680
diff
changeset
|
122 |
16731
01d523d5f796
add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
16719
diff
changeset
|
123 void execute_command_in_terminal (const QString& command); |
18718
86eca5d178a6
disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents:
18690
diff
changeset
|
124 void edit_area_has_focus (bool foucs); |
18721
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18720
diff
changeset
|
125 void create_context_menu (QMenu *); |
19038
e87e65bc71ae
improved finding a function file for editing in gui (bug #41509)
Torsten <ttl@justmail.de>
parents:
18980
diff
changeset
|
126 void handle_context_menu_edit (const QString&); |
16731
01d523d5f796
add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
16719
diff
changeset
|
127 |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
128 signals: |
16558 | 129 |
15984
1eb3c67139f6
Add full-length-name tool tip to editor file tab when name is not full length.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15980
diff
changeset
|
130 void file_name_changed (const QString& fileName, const QString& toolTip); |
18801
095fdef3d67c
use editors run selection action for the context menu
Torsten <ttl@justmail.de>
parents:
18723
diff
changeset
|
131 void editor_state_changed (bool copy_available, const QString& fileName, |
095fdef3d67c
use editors run selection action for the context menu
Torsten <ttl@justmail.de>
parents:
18723
diff
changeset
|
132 bool is_octave_file); |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
133 void tab_remove_request (); |
16377
8430ea8c1594
open editor tab and insert marker for debugging with gui
John W. Eaton <jwe@octave.org>
parents:
16375
diff
changeset
|
134 void add_filename_to_list (const QString&, QWidget *); |
15860
feba9ff6e6a8
editor: add list of recently used files to the file menu
Torsten <ttl@justmail.de>
parents:
15848
diff
changeset
|
135 void mru_add_file (const QString& file_name); |
16558 | 136 void editor_check_conflict_save (const QString& saveFileName, |
137 bool remove_on_success); | |
16635
25e418d23a4b
fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents:
16570
diff
changeset
|
138 void run_file_signal (const QFileInfo& info); |
16731
01d523d5f796
add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
16719
diff
changeset
|
139 void execute_command_in_terminal_signal (const QString&); |
18718
86eca5d178a6
disable some global shortcuts when editor gets focus to prevent conflicts
Torsten <ttl@justmail.de>
parents:
18690
diff
changeset
|
140 void set_global_edit_shortcuts_signal (bool); |
18721
99e26cb0f87f
use the actions from the editor for the context menu
Torsten <ttl@justmail.de>
parents:
18720
diff
changeset
|
141 void create_context_menu_tab_signal (QMenu *); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
142 |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
143 protected: |
16558 | 144 |
14680
628eeaf879f7
Copy/Paste buttons get greyed out in the editor correctly again. Removed margin in editor tabs and status bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14676
diff
changeset
|
145 void closeEvent (QCloseEvent *event); |
15300
fd27e10b9b05
pass QString by const reference instead of value
John W. Eaton <jwe@octave.org>
parents:
15204
diff
changeset
|
146 void set_file_name (const QString& fileName); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
147 |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
148 private slots: |
16558 | 149 |
150 // When user closes message box for reload question. | |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
151 void handle_file_reload_answer (int decision); |
16558 | 152 |
153 // When user closes message box for resave question. | |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
154 void handle_file_resave_answer (int decision); |
16558 | 155 |
156 // When user closes message box for modified question. | |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
157 void handle_file_modified_answer (int decision); |
16558 | 158 |
159 // When user closes find_dialog box. | |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
160 void handle_find_dialog_finished (int decision); |
16558 | 161 |
162 // When user closes QFileDialog box. | |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
163 void handle_save_file_as_answer (const QString& fileName); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
164 void handle_save_file_as_answer_close (const QString& fileName); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
165 void handle_save_file_as_answer_cancel (); |
19290
ce9bd5ed44d2
usage of default suffix depending on filter in save as dialog (bug #43335)
Torsten <ttl@justmail.de>
parents:
19283
diff
changeset
|
166 void handle_save_as_filter_selected (const QString& filter); |
19283
d10c711a08d8
add a drop down menu with the eol mode in the save-file-as-dialog
Torsten <ttl@justmail.de>
parents:
19281
diff
changeset
|
167 void handle_combo_eol_current_index (int index); |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
168 |
16704
e38a0fa08368
fix restoring editor files from previous session and speedup lexer preparation
Torsten <ttl@justmail.de>
parents:
16638
diff
changeset
|
169 // When apis preparation has finished and is ready to save |
e38a0fa08368
fix restoring editor files from previous session and speedup lexer preparation
Torsten <ttl@justmail.de>
parents:
16638
diff
changeset
|
170 void save_apis_info (); |
e38a0fa08368
fix restoring editor files from previous session and speedup lexer preparation
Torsten <ttl@justmail.de>
parents:
16638
diff
changeset
|
171 |
16716
23b5dde25367
make octave lexer the default and dynamically set margin width for line numbers
Torsten <ttl@justmail.de>
parents:
16715
diff
changeset
|
172 // When the numer of lines changes -> adapt width of margin |
23b5dde25367
make octave lexer the default and dynamically set margin width for line numbers
Torsten <ttl@justmail.de>
parents:
16715
diff
changeset
|
173 void auto_margin_width (); |
23b5dde25367
make octave lexer the default and dynamically set margin width for line numbers
Torsten <ttl@justmail.de>
parents:
16715
diff
changeset
|
174 |
17962
4a53bcc1a4ae
GUI: Add statusbar with line/col indicator to editor window (Bug #40626)
John Donoghue <john.donoghue@ieee.org>
parents:
17822
diff
changeset
|
175 void handle_cursor_moved (int line, int col); |
4a53bcc1a4ae
GUI: Add statusbar with line/col indicator to editor window (Bug #40626)
John Donoghue <john.donoghue@ieee.org>
parents:
17822
diff
changeset
|
176 |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
177 private: |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
178 |
16558 | 179 enum editor_markers |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
180 { |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
181 bookmark, |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
182 breakpoint, |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
183 debugger_position |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
184 }; |
16558 | 185 |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
186 struct bp_info |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
187 { |
18236
f26d527c1a71
allow the gui editor to set breakpoints in class methods (bug #41126)
John W. Eaton <jwe@octave.org>
parents:
18082
diff
changeset
|
188 bp_info (const QString& fname, int l = 0); |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
189 |
18236
f26d527c1a71
allow the gui editor to set breakpoints in class methods (bug #41126)
John W. Eaton <jwe@octave.org>
parents:
18082
diff
changeset
|
190 int line; |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
16452
diff
changeset
|
191 std::string file; |
16568
477bfd5d95f5
use dir, not path, to refer to directory name
John W. Eaton <jwe@octave.org>
parents:
16558
diff
changeset
|
192 std::string dir; |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
193 std::string function_name; |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
194 }; |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
195 |
17979
a761ba02a52f
some code cleanup in file_editor_tab
Torsten <ttl@justmail.de>
parents:
17973
diff
changeset
|
196 bool valid_file_name (const QString& file=QString ()); |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
197 void save_file (const QString& saveFileName, bool remove_on_success = false); |
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
198 void save_file_as (bool remove_on_success = false); |
18318
770c525a1a2b
Warn when saving/running a script whose name is not a valid identifier.
Julien Bect <julien.bect@supelec.fr>
parents:
18303
diff
changeset
|
199 bool check_valid_identifier (QString file_name); |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
200 |
14869
db3c84d38345
Now supporting c/cc/cpp syntax highlighting.
Jacob Dawid <jacob.dawid@gmail.com>
parents:
14829
diff
changeset
|
201 void update_lexer (); |
14827
6b90737f69cc
Very basic breakpoint setting and removing in the editor works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14825
diff
changeset
|
202 void request_add_breakpoint (int line); |
6b90737f69cc
Very basic breakpoint setting and removing in the editor works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14825
diff
changeset
|
203 void request_remove_breakpoint (int line); |
6b90737f69cc
Very basic breakpoint setting and removing in the editor works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14825
diff
changeset
|
204 |
17973
6925dca34807
fix saving unnamed editor files when closing octave (bug #40637)
Torsten <ttl@justmail.de>
parents:
17962
diff
changeset
|
205 void show_dialog (QDialog *dlg); |
16018
e0df71fbe39b
gui: clearer message box with cancel button when closing an unsaved editor file
Torsten <ttl@justmail.de>
parents:
15984
diff
changeset
|
206 int check_file_modified (); |
14709
f50591409306
Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14707
diff
changeset
|
207 void do_comment_selected_text (bool comment); |
16719
0f6f14e3ac6a
commenting selected lines in the editor uses comment string depending on lexer
Torsten <ttl@justmail.de>
parents:
16716
diff
changeset
|
208 QString comment_string (const QString&); |
18303
106da7544504
gui: Add indent/unindent edit menu to editor (Bug #41223)
John Donoghue <john.donoghue@ieee.org>
parents:
18275
diff
changeset
|
209 void do_indent_selected_text (bool indent); |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
210 |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
211 void add_breakpoint_callback (const bp_info& info); |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
212 void remove_breakpoint_callback (const bp_info& info); |
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
213 void remove_all_breakpoints_callback (const bp_info& info); |
16389
f5204f486a29
gui: add shortcut for goto line action in the editor and center the target line
Torsten <ttl@justmail.de>
parents:
16386
diff
changeset
|
214 void center_current_line (); |
15402
7f423c6111c6
refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents:
15388
diff
changeset
|
215 |
18867
6504a1932637
auto completion offers builtins and file functions for octave (bug #41371)
Torsten <ttl@justmail.de>
parents:
18801
diff
changeset
|
216 void add_octave_apis (octave_value_list key_ovl); |
18868
0e6f7b5f6556
propose function name as file name when saving a new file (bug #42568)
Torsten <ttl@justmail.de>
parents:
18867
diff
changeset
|
217 QString get_function_name (); |
18867
6504a1932637
auto completion offers builtins and file functions for octave (bug #41371)
Torsten <ttl@justmail.de>
parents:
18801
diff
changeset
|
218 |
19271
c766a1f63c40
detect eol mode when opening a file in the editor of the gui (#bug 43334)
Torsten <ttl@justmail.de>
parents:
18236
diff
changeset
|
219 QsciScintilla::EolMode detect_eol_mode (); |
c766a1f63c40
detect eol mode when opening a file in the editor of the gui (#bug 43334)
Torsten <ttl@justmail.de>
parents:
18236
diff
changeset
|
220 void update_eol_indicator (); |
c766a1f63c40
detect eol mode when opening a file in the editor of the gui (#bug 43334)
Torsten <ttl@justmail.de>
parents:
18236
diff
changeset
|
221 |
16731
01d523d5f796
add help for word at mouse or text cursor to the editors context menu
Torsten <ttl@justmail.de>
parents:
16719
diff
changeset
|
222 octave_qscintilla *_edit_area; |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
223 |
17962
4a53bcc1a4ae
GUI: Add statusbar with line/col indicator to editor window (Bug #40626)
John Donoghue <john.donoghue@ieee.org>
parents:
17822
diff
changeset
|
224 QStatusBar *_status_bar; |
4a53bcc1a4ae
GUI: Add statusbar with line/col indicator to editor window (Bug #40626)
John Donoghue <john.donoghue@ieee.org>
parents:
17822
diff
changeset
|
225 QLabel *_row_indicator; |
4a53bcc1a4ae
GUI: Add statusbar with line/col indicator to editor window (Bug #40626)
John Donoghue <john.donoghue@ieee.org>
parents:
17822
diff
changeset
|
226 QLabel *_col_indicator; |
19271
c766a1f63c40
detect eol mode when opening a file in the editor of the gui (#bug 43334)
Torsten <ttl@justmail.de>
parents:
18236
diff
changeset
|
227 QLabel *_eol_indicator; |
17962
4a53bcc1a4ae
GUI: Add statusbar with line/col indicator to editor window (Bug #40626)
John Donoghue <john.donoghue@ieee.org>
parents:
17822
diff
changeset
|
228 |
19283
d10c711a08d8
add a drop down menu with the eol mode in the save-file-as-dialog
Torsten <ttl@justmail.de>
parents:
19281
diff
changeset
|
229 QsciScintilla::EolMode _save_as_desired_eol; |
d10c711a08d8
add a drop down menu with the eol mode in the save-file-as-dialog
Torsten <ttl@justmail.de>
parents:
19281
diff
changeset
|
230 |
16558 | 231 QString _file_name; |
232 QString _file_name_short; | |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
233 |
16558 | 234 bool _long_title; |
235 bool _copy_available; | |
19445
ed0df431631b
allow to cancel exiting if editor tabs are modified and exit is requested in gui
Torsten <ttl@justmail.de>
parents:
19290
diff
changeset
|
236 int _app_closing; // -1: octave exits, 1: exit request in gui, 0: no exit |
18801
095fdef3d67c
use editors run selection action for the context menu
Torsten <ttl@justmail.de>
parents:
18723
diff
changeset
|
237 bool _is_octave_file; |
18871
08d7dbd728bc
save a new file before trying to run it from the editor (bug #42571)
Torsten <ttl@justmail.de>
parents:
18868
diff
changeset
|
238 bool _modal_dialog; |
18980
0be65bd7f369
add an user preference for loading changed files without a prompt (bug #42678)
Torsten <ttl@justmail.de>
parents:
18871
diff
changeset
|
239 bool _always_reload_changed_files; |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
240 |
16558 | 241 QFileSystemWatcher _file_system_watcher; |
15848
424edeca3c66
Redo portions of file editor to use more signals/slots rather than casting.
Daniel J Sebald <daniel.sebald@ieee.org>
parents:
15425
diff
changeset
|
242 |
16558 | 243 find_dialog *_find_dialog; |
244 bool _find_dialog_is_visible; | |
245 QRect _find_dialog_geometry; | |
16704
e38a0fa08368
fix restoring editor files from previous session and speedup lexer preparation
Torsten <ttl@justmail.de>
parents:
16638
diff
changeset
|
246 |
e38a0fa08368
fix restoring editor files from previous session and speedup lexer preparation
Torsten <ttl@justmail.de>
parents:
16638
diff
changeset
|
247 QsciAPIs *_lexer_apis; |
16715
96ed7ab44e2e
save prepared apis info for qscintilla into a path depending on octave version
Torsten <ttl@justmail.de>
parents:
16704
diff
changeset
|
248 QString _prep_apis_file; |
14676
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
249 }; |
35512b788af2
Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
250 |
16558 | 251 #endif |