annotate libgui/src/main-window.cc @ 16576:2754c5fd6ae0

keep focus in the command window after dbstop, dbstep, etc. * main-window.h, main-window.cc (main_window::command_window_has_focus, main_window::handle_insert_debugger_pointer_request, main_window::handle_delete_debugger_pointer_request, main_window::handle_update_breakpoint_marker_request): New functions. (main_window::insert_debugger_pointer_signal main_window::delete_debugger_pointer_signal, main_window::update_breakpoint_marker_signal): New signals. (main_window::construct): Connect main_window::insert_debugger_pointer_signal to editor_window::handle_insert_debugger_pointer_request. Connect main_window::delete_debugger_pointer_signal to editor_window::handle_delete_debugger_pointer_request. Connect main_window::update_breakpoint_marker_signal to editor_window::handle_update_breakpoint_marker_request. (main_window::construct_octave_qt_link): Connect _octave_qt_link::insert_debugger_pointer_signal to main_window::handle_insert_debugger_pointer_request instead of editor_window::handle_insert_debugger_pointer_request. Connect _octave_qt_link::delete_debugger_pointer_signal to main_window::handle_delete_debugger_pointer_request instead of editor_window::handle_delete_debugger_pointer_request. Connect _octave_qt_link::update_breakpoint_marker_signal to main_window::handle_update_breakpoint_marker_request instead of editor_window::handle_update_breakpoint_marker_request. * terminal-dock-widget.h, terminal-dock-widget.cc (terminal_dock_widget::has_focus): New function.
author John W. Eaton <jwe@octave.org>
date Sun, 28 Apr 2013 01:21:16 -0400
parents 17941fedd4ce
children 0eca6c5657c9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
16447
e3b33a7530bc improve encapsulation of history window object
John W. Eaton <jwe@octave.org>
parents: 16446
diff changeset
3 Copyright (C) 2013 John W. Eaton
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
4 Copyright (C) 2011-2012 Jacob Dawid
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
5
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
6 This file is part of Octave.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
7
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
8 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
9 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
10 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
11 option) any later version.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
12
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
13 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
14 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
15 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
16 for more details.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
17
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
18 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
19 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
20 <http://www.gnu.org/licenses/>.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
21
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
22 */
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
23
15286
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15274
diff changeset
24 #ifdef HAVE_CONFIG_H
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15274
diff changeset
25 #include <config.h>
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15274
diff changeset
26 #endif
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15274
diff changeset
27
15257
7ee62f559a73 Fix compilation under Windows with GUI and LLVM enabled.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15204
diff changeset
28 #include <QApplication>
7ee62f559a73 Fix compilation under Windows with GUI and LLVM enabled.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15204
diff changeset
29 #include <QLabel>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
30 #include <QMenuBar>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
31 #include <QMenu>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
32 #include <QAction>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
33 #include <QSettings>
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
34 #include <QStyle>
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
35 #include <QToolBar>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
36 #include <QDesktopServices>
16391
a695ee2dc17e * main-window.cc: Include <QDesktopWidget>
John W. Eaton <jwe@octave.org>
parents: 16386
diff changeset
37 #include <QDesktopWidget>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
38 #include <QFileDialog>
13626
cc90c62ada21 Removed terminal, instead now using QPlainTextEdit, which looks much nicer and is not that error-prone...
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13620
diff changeset
39 #include <QMessageBox>
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
40 #include <QIcon>
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
41
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
42 #include <utility>
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
43
16290
d07aeecb2d22 build: Add more #ifdefs to build GUI when Qscintilla is not present.
Rik <rik@octave.org>
parents: 16176
diff changeset
44 #ifdef HAVE_QSCINTILLA
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
45 #include "file-editor.h"
16290
d07aeecb2d22 build: Add more #ifdefs to build GUI when Qscintilla is not present.
Rik <rik@octave.org>
parents: 16176
diff changeset
46 #endif
14707
674740c44c09 Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14703
diff changeset
47 #include "main-window.h"
674740c44c09 Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14703
diff changeset
48 #include "settings-dialog.h"
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
49
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
50 #include "cmd-edit.h"
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
51
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
52 #include "builtin-defun-decls.h"
15404
f52a62a6db3a eliminate copy and paste copyright info in GUI about info box
John W. Eaton <jwe@octave.org>
parents: 15402
diff changeset
53 #include "defaults.h"
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
54 #include "symtab.h"
15404
f52a62a6db3a eliminate copy and paste copyright info in GUI about info box
John W. Eaton <jwe@octave.org>
parents: 15402
diff changeset
55 #include "version.h"
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
56
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
57 static file_editor_interface *
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
58 create_default_editor (QWidget *p)
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
59 {
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
60 #ifdef HAVE_QSCINTILLA
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
61 return new file_editor (p);
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
62 #else
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
63 return 0;
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
64 #endif
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
65 }
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
66
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
67 main_window::main_window (QWidget *p)
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
68 : QMainWindow (p),
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
69 _workspace_model (new workspace_model ()),
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
70 status_bar (new QStatusBar ()),
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
71 command_window (new terminal_dock_widget (this)),
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
72 history_window (new history_dock_widget (this)),
16453
2e3c652c89d1 improve encapsulation of documentation browser window object
John W. Eaton <jwe@octave.org>
parents: 16452
diff changeset
73 file_browser_window (new files_dock_widget (this)),
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
74 doc_browser_window (new documentation_dock_widget (this)),
16459
cbc39a3d0c42 improve encapsulation of workspace window object
John W. Eaton <jwe@octave.org>
parents: 16458
diff changeset
75 editor_window (create_default_editor (this)),
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
76 workspace_window (new workspace_view (this)),
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
77 find_files_dlg (0),
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
78 _octave_main_thread (0),
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
79 _octave_qt_link (0)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
80 {
14599
97cb9286919c Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14588
diff changeset
81 // We have to set up all our windows, before we finally launch octave.
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
82 construct ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
83 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
84
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
85 main_window::~main_window (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
86 {
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
87 // Destroy the terminal first so that STDERR stream is redirected back
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
88 // to its original pipe to capture error messages at exit.
16484
fa842e78f491 Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16479
diff changeset
89
fa842e78f491 Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16479
diff changeset
90 delete command_window;
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
91 delete workspace_window;
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
92 delete editor_window;
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
93 delete doc_browser_window;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
94 delete file_browser_window;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
95 delete history_window;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
96 delete status_bar;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
97 delete _workspace_model;
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
98 if (find_files_dlg)
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
99 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
100 delete find_files_dlg;
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
101 find_files_dlg = 0;
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
102 }
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
103 delete _octave_main_thread;
16421
40d1ddca4db5 improve use of octave_link
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
104 delete _octave_qt_link;
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
105 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
106
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
107 bool
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
108 main_window::command_window_has_focus (void) const
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
109 {
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
110 return command_window->has_focus ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
111 }
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
112
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
113 void
16449
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
114 main_window::focus_command_window (void)
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
115 {
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
116 command_window->focus ();
16449
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
117 }
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
118
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
119 void
16452
744ff2fe11ce add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents: 16451
diff changeset
120 main_window::new_file (const QString& commands)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
121 {
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
122 emit new_file_signal (commands);
14875
3fd857c284fe Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14831
diff changeset
123 }
3fd857c284fe Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14831
diff changeset
124
3fd857c284fe Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14831
diff changeset
125 void
15300
fd27e10b9b05 pass QString by const reference instead of value
John W. Eaton <jwe@octave.org>
parents: 15286
diff changeset
126 main_window::open_file (const QString& file_name)
14875
3fd857c284fe Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14831
diff changeset
127 {
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
128 emit open_file_signal (file_name);
13558
248b897d9f36 editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents: 13550
diff changeset
129 }
248b897d9f36 editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents: 13550
diff changeset
130
248b897d9f36 editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents: 13550
diff changeset
131 void
15300
fd27e10b9b05 pass QString by const reference instead of value
John W. Eaton <jwe@octave.org>
parents: 15286
diff changeset
132 main_window::report_status_message (const QString& statusMessage)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
133 {
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
134 status_bar->showMessage (statusMessage, 1000);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
135 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
136
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
137 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
138 main_window::handle_save_workspace_request (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
139 {
16532
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
140 QString file =
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
141 QFileDialog::getSaveFileName (this, tr ("Save Workspace As"), ".");
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
142
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
143 if (! file.isEmpty ())
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
144 octave_link::post_event (this, &main_window::save_workspace_callback,
16532
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
145 file.toStdString ());
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
146 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
147
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
148 void
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
149 main_window::handle_load_workspace_request (const QString& file_arg)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
150 {
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
151 QString file = file_arg;
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
152
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
153 if (file.isEmpty ())
16532
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
154 file = QFileDialog::getOpenFileName (this, tr ("Load Workspace"), ".");
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
155
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
156 if (! file.isEmpty ())
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
157 octave_link::post_event (this, &main_window::load_workspace_callback,
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
158 file.toStdString ());
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
159 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
160
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
161 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
162 main_window::handle_clear_workspace_request (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
163 {
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
164 octave_link::post_event (this, &main_window::clear_workspace_callback);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
165 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
166
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
167 void
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
168 main_window::handle_rename_variable_request (const QString& old_name,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
169 const QString& new_name)
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
170
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
171 {
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
172 name_pair names (old_name.toStdString (), new_name.toStdString ());
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
173
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
174 octave_link::post_event (this, &main_window::rename_variable_callback,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
175 names);
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
176 }
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
177
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
178 void
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
179 main_window::handle_undo_request (void)
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
180 {
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
181 octave_link::post_event (this, &main_window::command_window_undo_callback);
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
182 }
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
183
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
184 void
16514
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
185 main_window::handle_clear_command_window_request (void)
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
186 {
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
187 octave_link::post_event (this, &main_window::clear_command_window_callback);
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
188 }
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
189
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
190 void
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
191 main_window::handle_clear_history_request (void)
14814
61c80e9326a8 Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14813
diff changeset
192 {
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
193 octave_link::post_event (this, &main_window::clear_history_callback);
14814
61c80e9326a8 Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14813
diff changeset
194 }
61c80e9326a8 Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14813
diff changeset
195
61c80e9326a8 Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14813
diff changeset
196 void
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
197 main_window::execute_command_in_terminal (const QString& command)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
198 {
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
199 octave_link::post_event (this, &main_window::execute_command_callback,
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
200 command.toStdString ());
16449
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
201
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
202 focus_command_window ();
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
203 }
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
204
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
205 void
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
206 main_window::handle_new_figure_request (void)
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
207 {
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
208 octave_link::post_event (this, &main_window::new_figure_callback);
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
209 }
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
210
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
211 void
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
212 main_window::handle_new_variable_request (void)
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
213 {
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
214 QMessageBox::about (this, tr ("New Variable"),
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
215 tr ("The new variable action is not implemented."));
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
216 }
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
217
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
218 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
219 main_window::open_online_documentation_page (void)
15989
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
220 {
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
221 QDesktopServices::openUrl (QUrl ("http://gnu.org/software/octave/doc/interpreter"));
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
222 }
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
223
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
224 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
225 main_window::open_bug_tracker_page (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
226 {
15044
b7b1ffc88086 Update urls to Agora and bug tracker
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15041
diff changeset
227 QDesktopServices::openUrl (QUrl ("http://bugs.octave.org"));
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
228 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
229
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
230 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
231 main_window::open_octave_forge_page (void)
15989
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
232 {
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
233 QDesktopServices::openUrl (QUrl ("http://octave.sourceforge.net/"));
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
234 }
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
235
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
236 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
237 main_window::open_agora_page (void)
13533
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
238 {
15044
b7b1ffc88086 Update urls to Agora and bug tracker
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15041
diff changeset
239 QDesktopServices::openUrl (QUrl ("http://agora.octave.org/"));
13533
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
240 }
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
241
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
242 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
243 main_window::process_settings_dialog_request (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
244 {
14709
f50591409306 Started to rename class names and methods from camel case to underscore-
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14707
diff changeset
245 settings_dialog *settingsDialog = new settings_dialog (this);
15274
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15257
diff changeset
246 int change_settings = settingsDialog->exec ();
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15257
diff changeset
247 if (change_settings == QDialog::Accepted)
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15257
diff changeset
248 {
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15257
diff changeset
249 settingsDialog->write_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: 16399
diff changeset
250 QSettings *settings = resource_manager::get_settings ();
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
251 if (settings)
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
252 emit settings_changed (settings);
15274
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15257
diff changeset
253 }
14586
8e9823066dad Fixed bug with not correctly syncing settings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14308
diff changeset
254 delete settingsDialog;
14588
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
255 }
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
256
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
257
14588
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
258 void
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
259 main_window::notice_settings (const QSettings *settings)
14588
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
260 {
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
261 // QSettings pointer is checked before emitting.
14998
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14996
diff changeset
262
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
263 // the widget's icons (when floating)
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
264 QString icon_set
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
265 = settings->value ("DockWidgets/widget_icon_set", "NONE").toString ();
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
266
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
267 static struct
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
268 {
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
269 QString name;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
270 QString path;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
271 }
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
272
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
273 widget_icon_data[] =
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
274 { // array of possible icon sets (name, path (complete for NONE))
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
275 // the first entry here is the default!
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
276 {"NONE", ":/actions/icons/logo.png"},
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
277 {"GRAPHIC", ":/actions/icons/graphic_logo_"},
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
278 {"LETTER", ":/actions/icons/letter_logo_"},
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
279 {"", ""} // end marker has empty name
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
280 };
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
281
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
282 int count = 0;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
283 int icon_set_found = 0; // default
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
284
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
285 while (!widget_icon_data[count].name.isEmpty ())
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
286 { // while not end of data
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
287 if (widget_icon_data[count].name == icon_set)
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
288 { // data of desired icon set found
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
289 icon_set_found = count;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
290 break;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
291 }
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
292 count++;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
293 }
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
294
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
295 QString icon;
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
296 foreach (QObject *obj, children ())
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
297 {
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
298 QString name = obj->objectName ();
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
299 if (obj->inherits ("QDockWidget") && ! name.isEmpty ())
16460
4d4e7c6f839d use consistent names for dock-widget files
John W. Eaton <jwe@octave.org>
parents: 16459
diff changeset
300 { // if children is a dock widget with a name
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
301 QDockWidget *widget = qobject_cast<QDockWidget *> (obj);
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
302 icon = widget_icon_data[icon_set_found].path; // prefix or octave-logo
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
303 if (widget_icon_data[icon_set_found].name != "NONE")
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
304 icon = icon + name + ".png"; // add widget name and ext.
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
305 widget->setWindowIcon (QIcon (icon));
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
306 }
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
307 }
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
308
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
309 int icon_size = settings->value ("toolbar_icon_size",24).toInt ();
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
310 _main_tool_bar->setIconSize (QSize (icon_size,icon_size));
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
311
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
312 resource_manager::update_network_settings ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
313 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
314
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
315
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
316 void
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
317 main_window::prepare_to_exit (void)
14693
c952f1e35e50 Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14692
diff changeset
318 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
319 write_settings ();
14693
c952f1e35e50 Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14692
diff changeset
320 }
c952f1e35e50 Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14692
diff changeset
321
c952f1e35e50 Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14692
diff changeset
322 void
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
323 main_window::exit (int status)
16479
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
324 {
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
325 qApp->exit (status);
16479
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
326 }
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
327
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
328 void
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
329 main_window::reset_windows ()
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
330 {
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
331 // TODO: Implement.
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
332 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
333
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
334 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
335 main_window::change_directory (const QString& dir)
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
336 {
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
337 // Remove existing entry, if any, then add new directory at top and
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
338 // mark it as the current directory. Finally, update the file list
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
339 // widget.
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
340
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
341 int index = _current_directory_combo_box->findText (dir);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
342
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
343 if (index >= 0)
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
344 _current_directory_combo_box->removeItem (index);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
345
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
346 _current_directory_combo_box->insertItem (0, dir);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
347 _current_directory_combo_box->setCurrentIndex (0);
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
348
16499
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16497
diff changeset
349 file_browser_window->update_octave_directory (dir);
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
350 }
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
351
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
352 void
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
353 main_window::browse_for_directory (void)
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
354 {
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
355 QString dir =
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
356 QFileDialog::getExistingDirectory (this, tr ("Set working directory"));
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
357
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
358 if (! dir.isEmpty ())
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
359 octave_link::post_event (this,
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
360 &main_window::change_directory_callback,
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
361 dir.toStdString ());
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
362 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
363
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
364 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
365 main_window::set_current_working_directory (const QString& dir)
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
366 {
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
367 // Change to dir if it is an existing directory.
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
368
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
369 QString xdir = dir.isEmpty () ? "." : dir;
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
370
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
371 QFileInfo fileInfo (xdir);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
372
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
373 if (fileInfo.exists () && fileInfo.isDir ())
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
374 octave_link::post_event (this, &main_window::change_directory_callback,
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
375 xdir.toStdString ());
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
376 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
377
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
378 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
379 main_window::change_directory_up (void)
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
380 {
16526
01541f7321f7 correctly track directory for cd ..
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
381 set_current_working_directory ("..");
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
382 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
383
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
384 // Slot that is called if return is pressed in the line edit of the
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
385 // combobox to change to a new directory or a directory that is already
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
386 // in the drop down list.
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
387
15626
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
388 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
389 main_window::accept_directory_line_edit (void)
15626
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
390 {
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
391 // Get new directory name, and change to it if it is new. Otherwise,
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
392 // the combo box will triggers the "activated" signal to change to the
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
393 // directory.
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
394
16518
59dbdaeeea40 * main_window.cc(construct_tool_bar): code cleanup and tool tips for combo box
Torsten <ttl@justmail.de>
parents: 16514
diff changeset
395 QString dir = _current_directory_combo_box->currentText ();
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
396
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
397 int index = _current_directory_combo_box->findText (dir);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
398
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
399 if (index < 0)
15626
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
400 set_current_working_directory (dir);
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
401 }
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
402
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
403 void
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
404 main_window::handle_enter_debugger (void)
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
405 {
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
406 setWindowTitle ("Octave (Debugging)");
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
407
14795
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
408 _debug_continue->setEnabled (true);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
409 _debug_step_into->setEnabled (true);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
410 _debug_step_over->setEnabled (true);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
411 _debug_step_out->setEnabled (true);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
412 _debug_quit->setEnabled (true);
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
413
15873
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15848
diff changeset
414 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
415 editor_window->handle_enter_debug_mode ();
15873
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15848
diff changeset
416 #endif
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
417 }
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
418
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
419 void
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
420 main_window::handle_exit_debugger (void)
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
421 {
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
422 setWindowTitle ("Octave");
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
423
14795
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
424 _debug_continue->setEnabled (false);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
425 _debug_step_into->setEnabled (false);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
426 _debug_step_over->setEnabled (false);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
427 _debug_step_out->setEnabled (false);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
428 _debug_quit->setEnabled (false);
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
429
15873
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15848
diff changeset
430 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
431 editor_window->handle_exit_debug_mode ();
15873
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15848
diff changeset
432 #endif
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
433 }
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
434
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
435 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
436 main_window::debug_continue (void)
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
437 {
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
438 octave_link::post_event (this, &main_window::debug_continue_callback);
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
439 }
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
440
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
441 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
442 main_window::debug_step_into (void)
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
443 {
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
444 octave_link::post_event (this, &main_window::debug_step_into_callback);
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
445 }
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
446
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
447 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
448 main_window::debug_step_over (void)
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
449 {
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
450 octave_link::post_event (this, &main_window::debug_step_over_callback);
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
451 }
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
452
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
453 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
454 main_window::debug_step_out (void)
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
455 {
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
456 octave_link::post_event (this, &main_window::debug_step_out_callback);
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
457 }
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
458
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
459 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
460 main_window::debug_quit (void)
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
461 {
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
462 octave_link::post_event (this, &main_window::debug_quit_callback);
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
463 }
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
464
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
465 void
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
466 main_window::handle_insert_debugger_pointer_request (const QString& file,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
467 int line)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
468 {
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
469 bool cmd_focus = command_window_has_focus ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
470
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
471 emit insert_debugger_pointer_signal (file, line);
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
472
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
473 if (cmd_focus)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
474 focus_command_window ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
475 }
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
476
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
477 void
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
478 main_window::handle_delete_debugger_pointer_request (const QString& file,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
479 int line)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
480 {
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
481 bool cmd_focus = command_window_has_focus ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
482
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
483 emit delete_debugger_pointer_signal (file, line);
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
484
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
485 if (cmd_focus)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
486 focus_command_window ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
487 }
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
488
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
489 void
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
490 main_window::handle_update_breakpoint_marker_request (bool insert,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
491 const QString& file,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
492 int line)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
493 {
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
494 bool cmd_focus = command_window_has_focus ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
495
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
496 emit update_breakpoint_marker_signal (insert, file, line);
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
497
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
498 if (cmd_focus)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
499 focus_command_window ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
500 }
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
501
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
502 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
503 main_window::show_about_octave (void)
13548
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
504 {
15404
f52a62a6db3a eliminate copy and paste copyright info in GUI about info box
John W. Eaton <jwe@octave.org>
parents: 15402
diff changeset
505 QString message = OCTAVE_STARTUP_MESSAGE;
13548
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
506
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
507 QMessageBox::about (this, tr ("About Octave"), message);
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
508 }
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
509
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
510 void
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
511 main_window::closeEvent (QCloseEvent *e)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
512 {
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
513 e->ignore ();
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
514 octave_link::post_event (this, &main_window::exit_callback);
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
515 }
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
516
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
517 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
518 main_window::read_settings (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
519 {
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
520 QSettings *settings = resource_manager::get_settings ();
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
521 if (!settings)
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
522 {
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
523 qDebug("Error: QSettings pointer from resource manager is NULL.");
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
524 return;
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
525 }
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
526
15348
450fedd44176 correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents: 15300
diff changeset
527 restoreState (settings->value ("MainWindow/windowState").toByteArray ());
450fedd44176 correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents: 15300
diff changeset
528 settings->beginGroup ("DockWidgets");
15552
bbbb89cc338f make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents: 15465
diff changeset
529 // restoring the geometry of all dock-widgets
15348
450fedd44176 correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents: 15300
diff changeset
530 foreach (QObject *obj, children ())
450fedd44176 correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents: 15300
diff changeset
531 {
450fedd44176 correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents: 15300
diff changeset
532 QString name = obj->objectName ();
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
533 if (obj->inherits ("QDockWidget") && ! name.isEmpty ())
15348
450fedd44176 correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents: 15300
diff changeset
534 {
15552
bbbb89cc338f make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents: 15465
diff changeset
535 QDockWidget *widget = qobject_cast<QDockWidget *> (obj);
15348
450fedd44176 correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents: 15300
diff changeset
536 QVariant val = settings->value (name);
450fedd44176 correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents: 15300
diff changeset
537 widget->restoreGeometry (val.toByteArray ());
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
538 bool floating = settings->value (name+"Floating", false).toBool ();
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
539 bool visible = settings->value (name+"Visible", true).toBool ();
15552
bbbb89cc338f make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents: 15465
diff changeset
540 if (floating)
bbbb89cc338f make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents: 15465
diff changeset
541 widget->setWindowFlags (Qt::Window); // if floating, make window from widget
bbbb89cc338f make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents: 15465
diff changeset
542 widget->setVisible (visible); // make widget visible if desired (setWindowFlags hides widget)
15348
450fedd44176 correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents: 15300
diff changeset
543 }
15367
501a9cc2c68f maint: whitespace cleanup in GUI code
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 15365
diff changeset
544 }
15348
450fedd44176 correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents: 15300
diff changeset
545 settings->endGroup();
13537
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
546 restoreGeometry (settings->value ("MainWindow/geometry").toByteArray ());
15465
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
547 // restore the list of the last directories
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
548 QStringList curr_dirs = settings->value ("MainWindow/current_directory_list").toStringList ();
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
549 for (int i=0; i < curr_dirs.size (); i++)
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
550 {
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
551 _current_directory_combo_box->addItem (curr_dirs.at (i));
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
552 }
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
553 emit settings_changed (settings);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
554 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
555
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
556 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
557 main_window::write_settings (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
558 {
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
559 QSettings *settings = resource_manager::get_settings ();
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
560 if (!settings)
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
561 {
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
562 qDebug("Error: QSettings pointer from resource manager is NULL.");
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
563 return;
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
564 }
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
565
13537
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
566 settings->setValue ("MainWindow/geometry", saveGeometry ());
15348
450fedd44176 correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents: 15300
diff changeset
567 settings->beginGroup ("DockWidgets");
450fedd44176 correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents: 15300
diff changeset
568 // saving the geometry of all widgets
450fedd44176 correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents: 15300
diff changeset
569 foreach (QObject *obj, children())
450fedd44176 correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents: 15300
diff changeset
570 {
450fedd44176 correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents: 15300
diff changeset
571 QString name = obj->objectName ();
15552
bbbb89cc338f make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents: 15465
diff changeset
572 if (obj->inherits ("QDockWidget") && ! name.isEmpty ())
15348
450fedd44176 correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents: 15300
diff changeset
573 {
15552
bbbb89cc338f make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents: 15465
diff changeset
574 QDockWidget *widget = qobject_cast<QDockWidget *> (obj);
15348
450fedd44176 correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents: 15300
diff changeset
575 settings->setValue (name, widget->saveGeometry ());
15552
bbbb89cc338f make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents: 15465
diff changeset
576 bool floating = widget->isFloating ();
bbbb89cc338f make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents: 15465
diff changeset
577 bool visible = widget->isVisible ();
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
578 settings->setValue (name+"Floating", floating); // store floating state
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
579 settings->setValue (name+"Visible", visible); // store visibility
15552
bbbb89cc338f make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents: 15465
diff changeset
580 if (floating)
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
581 widget->setWindowFlags (Qt::Widget); // if floating, recover the widget state such that the widget's
15552
bbbb89cc338f make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents: 15465
diff changeset
582 } // state is correctly saved by the saveSate () below
15348
450fedd44176 correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents: 15300
diff changeset
583 }
450fedd44176 correctly restore the size of all dock-widgets when maximized
Torsten <ttl@justmail.de>
parents: 15300
diff changeset
584 settings->endGroup();
15552
bbbb89cc338f make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents: 15465
diff changeset
585 settings->setValue ("MainWindow/windowState", saveState ());
15465
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
586 // write the list of recent used directories
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
587 QStringList curr_dirs;
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
588 for (int i=0; i<_current_directory_combo_box->count (); i++)
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
589 {
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
590 curr_dirs.append (_current_directory_combo_box->itemText (i));
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
591 }
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
592 settings->setValue ("MainWindow/current_directory_list", curr_dirs);
14694
ea11c9d8aa47 Calling qApp->quit () via QMetaObject::invoke caused a segfault, now exits cleanly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14693
diff changeset
593 settings->sync ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
594 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
595
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
596
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
597 // Connecting the signals emitted when the visibility of a widget changes.
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
598 // This has to be done after the window is shown (see octave-gui.cc)
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
599 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
600 main_window::connect_visibility_changed (void)
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
601 {
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
602 command_window->connect_visibility_changed ();
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
603 history_window->connect_visibility_changed ();
16450
3207f1d62e74 improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents: 16449
diff changeset
604 file_browser_window->connect_visibility_changed ();
16453
2e3c652c89d1 improve encapsulation of documentation browser window object
John W. Eaton <jwe@octave.org>
parents: 16452
diff changeset
605 doc_browser_window->connect_visibility_changed ();
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
606 #ifdef HAVE_QSCINTILLA
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
607 editor_window->connect_visibility_changed ();
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
608 #endif
16459
cbc39a3d0c42 improve encapsulation of workspace window object
John W. Eaton <jwe@octave.org>
parents: 16458
diff changeset
609 workspace_window->connect_visibility_changed ();
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
610 }
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
611
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
612 // Connect the signals emitted when the Octave thread wants to create
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
613 // a dialog box of some sort. Perhaps a better place for this would be
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
614 // as part of the QUIWidgetCreator class. However, mainWindow currently
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
615 // is not a global variable and not accessible for connecting.
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
616
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
617 void
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
618 main_window::connect_uiwidget_links ()
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
619 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
620 connect (&uiwidget_creator,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
621 SIGNAL (create_dialog (const QString&, const QString&,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
622 const QString&, const QStringList&,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
623 const QString&, const QStringList&)),
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
624 this,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
625 SLOT (handle_create_dialog (const QString&, const QString&,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
626 const QString&, const QStringList&,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
627 const QString&, const QStringList&)));
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
628
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
629 // Register QIntList so that list of ints may be part of a signal.
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
630 qRegisterMetaType<QIntList> ("QIntList");
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
631 connect (&uiwidget_creator,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
632 SIGNAL (create_listview (const QStringList&, const QString&,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
633 int, int, const QIntList&,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
634 const QString&, const QStringList&,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
635 const QString&, const QString&)),
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
636 this,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
637 SLOT (handle_create_listview (const QStringList&, const QString&,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
638 int, int, const QIntList&,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
639 const QString&, const QStringList&,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
640 const QString&, const QString&)));
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
641
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
642 // Register QFloatList so that list of floats may be part of a signal.
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
643 qRegisterMetaType<QFloatList> ("QFloatList");
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
644 connect (&uiwidget_creator,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
645 SIGNAL (create_inputlayout (const QStringList&, const QString&,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
646 const QFloatList&, const QFloatList&,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
647 const QStringList&)),
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
648 this,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
649 SLOT (handle_create_inputlayout (const QStringList&, const QString&,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
650 const QFloatList&, const QFloatList&,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
651 const QStringList&)));
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
652 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
653
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
654 // Create a message dialog with specified string, buttons and decorative
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
655 // text.
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
656
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
657 void
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
658 main_window::handle_create_dialog (const QString& message,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
659 const QString& title,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
660 const QString& icon,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
661 const QStringList& button,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
662 const QString& defbutton,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
663 const QStringList& role)
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
664 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
665 MessageDialog *message_dialog = new MessageDialog (message, title, icon,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
666 button, defbutton, role);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
667 message_dialog->setAttribute (Qt::WA_DeleteOnClose);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
668 message_dialog->show ();
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
669 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
670
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
671 // Create a list dialog with specified list, initially selected, mode,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
672 // view size and decorative text.
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
673
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
674 void
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
675 main_window::handle_create_listview (const QStringList& list,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
676 const QString& mode,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
677 int wd, int ht,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
678 const QIntList& initial,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
679 const QString& name,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
680 const QStringList& prompt,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
681 const QString& ok_string,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
682 const QString& cancel_string)
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
683 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
684 ListDialog *list_dialog = new ListDialog (list, mode, wd, ht,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
685 initial, name, prompt,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
686 ok_string, cancel_string);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
687
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
688 list_dialog->setAttribute (Qt::WA_DeleteOnClose);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
689 list_dialog->show ();
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
690 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
691
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
692 // Create an input dialog with specified prompts and defaults, title and
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
693 // row/column size specifications.
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
694 void
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
695 main_window::handle_create_inputlayout (const QStringList& prompt,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
696 const QString& title,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
697 const QFloatList& nr,
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
698 const QFloatList& nc,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
699 const QStringList& defaults)
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
700 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
701 InputDialog *input_dialog = new InputDialog (prompt, title, nr, nc,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
702 defaults);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
703
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
704 input_dialog->setAttribute (Qt::WA_DeleteOnClose);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
705 input_dialog->show ();
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
706 }
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
707
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
708 // Main subroutine of the constructor
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
709 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
710 main_window::construct (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
711 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
712 _closing = false; // flag for editor files when closed
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
713 setWindowIcon (QIcon (":/actions/icons/logo.png"));
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
714
16459
cbc39a3d0c42 improve encapsulation of workspace window object
John W. Eaton <jwe@octave.org>
parents: 16458
diff changeset
715 workspace_window->setModel (_workspace_model);
16572
17941fedd4ce Change workspace row height to font height.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16570
diff changeset
716 connect (_workspace_model, SIGNAL (model_changed (void)),
17941fedd4ce Change workspace row height to font height.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16570
diff changeset
717 workspace_window, SLOT (handle_model_changed (void)));
16445
3f8d3fc907af store workspace model in main_window, not in workspace view
John W. Eaton <jwe@octave.org>
parents: 16443
diff changeset
718
15607
c9c79d4a0a00 Delete dynamic objects in the main_window destructor for proper cleanup. (bug #37234)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15591
diff changeset
719 // Create and set the central widget. QMainWindow takes ownership of
c9c79d4a0a00 Delete dynamic objects in the main_window destructor for proper cleanup. (bug #37234)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15591
diff changeset
720 // the widget (pointer) so there is no need to delete the object upon
c9c79d4a0a00 Delete dynamic objects in the main_window destructor for proper cleanup. (bug #37234)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15591
diff changeset
721 // destroying this main_window.
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
722
14693
c952f1e35e50 Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14692
diff changeset
723 QWidget *dummyWidget = new QWidget ();
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14695
diff changeset
724 dummyWidget->setObjectName ("CentralDummyWidget");
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14695
diff changeset
725 dummyWidget->resize (10, 10);
14693
c952f1e35e50 Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14692
diff changeset
726 dummyWidget->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Minimum);
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14695
diff changeset
727 dummyWidget->hide ();
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14695
diff changeset
728 setCentralWidget (dummyWidget);
14692
d6d250812c01 Made the terminal window dockable, too. Now the whole interface is fully dockable.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14690
diff changeset
729
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
730 construct_menu_bar ();
14812
9d9eb9bac65e Improved menu structure of file, edit and window menu. Removed ambiguous shortcuts, improved focus handling for operating the GUI with the keyboard. Added new shortcuts to focus subwindows directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14804
diff changeset
731
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
732 construct_tool_bar ();
14812
9d9eb9bac65e Improved menu structure of file, edit and window menu. Removed ambiguous shortcuts, improved focus handling for operating the GUI with the keyboard. Added new shortcuts to focus subwindows directly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14804
diff changeset
733
16497
9ff3181e671c Reconnect aboutToQuit signal and prepare_to_exit (write_settings) slot.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16485
diff changeset
734 connect (qApp, SIGNAL (aboutToQuit ()),
9ff3181e671c Reconnect aboutToQuit signal and prepare_to_exit (write_settings) slot.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16485
diff changeset
735 this, SLOT (prepare_to_exit ()));
9ff3181e671c Reconnect aboutToQuit signal and prepare_to_exit (write_settings) slot.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16485
diff changeset
736
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
737 connect (this, SIGNAL (settings_changed (const QSettings *)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
738 this, SLOT (notice_settings (const QSettings *)));
15989
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
739
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
740 connect (file_browser_window, SIGNAL (load_file_signal (const QString&)),
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
741 this, SLOT (handle_load_workspace_request (const QString&)));
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
742
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
743 connect_uiwidget_links ();
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
744
14601
772ce0204b3f Removed version number and "Octave GUI"-labelling.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14599
diff changeset
745 setWindowTitle ("Octave");
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
746
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
747 setDockOptions (QMainWindow::AnimatedDocks
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
748 | QMainWindow::AllowNestedDocks
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
749 | QMainWindow::AllowTabbedDocks);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
750
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
751 addDockWidget (Qt::RightDockWidgetArea, command_window);
16453
2e3c652c89d1 improve encapsulation of documentation browser window object
John W. Eaton <jwe@octave.org>
parents: 16452
diff changeset
752 addDockWidget (Qt::RightDockWidgetArea, doc_browser_window);
2e3c652c89d1 improve encapsulation of documentation browser window object
John W. Eaton <jwe@octave.org>
parents: 16452
diff changeset
753 tabifyDockWidget (command_window, doc_browser_window);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
754
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
755 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
756 addDockWidget (Qt::RightDockWidgetArea, editor_window);
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
757 tabifyDockWidget (command_window, editor_window);
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
758 #endif
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
759
16450
3207f1d62e74 improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents: 16449
diff changeset
760 addDockWidget (Qt::LeftDockWidgetArea, file_browser_window);
16459
cbc39a3d0c42 improve encapsulation of workspace window object
John W. Eaton <jwe@octave.org>
parents: 16458
diff changeset
761 addDockWidget (Qt::LeftDockWidgetArea, workspace_window);
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
762 addDockWidget (Qt::LeftDockWidgetArea, history_window);
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
763
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
764 int win_x = QApplication::desktop()->width();
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
765 int win_y = QApplication::desktop()->height();
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
766
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
767 if (win_x > 960)
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
768 win_x = 960;
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
769
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
770 if (win_y > 720)
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
771 win_y = 720;
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
772
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
773 setGeometry (0, 0, win_x, win_y);
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
774
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
775 setStatusBar (status_bar);
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
776
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
777 construct_octave_qt_link ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
778
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
779 connect (this,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
780 SIGNAL (insert_debugger_pointer_signal (const QString&, int)),
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
781 editor_window,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
782 SLOT (handle_insert_debugger_pointer_request (const QString&, int)));
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
783
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
784 connect (this,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
785 SIGNAL (delete_debugger_pointer_signal (const QString&, int)),
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
786 editor_window,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
787 SLOT (handle_delete_debugger_pointer_request (const QString&, int)));
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
788
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
789 connect (this,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
790 SIGNAL (update_breakpoint_marker_signal (bool, const QString&, int)),
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
791 editor_window,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
792 SLOT (handle_update_breakpoint_marker_request (bool, const QString&, int)));
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
793
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
794 QDir curr_dir;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
795 set_current_working_directory (curr_dir.absolutePath ());
16541
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
796
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
797 octave_link::post_event (this, &main_window::resize_command_window_callback);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
798 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
799
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
800 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
801 main_window::construct_octave_qt_link (void)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
802 {
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
803 _octave_main_thread = new octave_main_thread ();
16421
40d1ddca4db5 improve use of octave_link
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
804
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
805 _octave_qt_link = new octave_qt_link (_octave_main_thread);
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
806
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
807 connect (_octave_qt_link, SIGNAL (exit_signal (int)),
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
808 this, SLOT (exit (int)));
16479
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
809
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
810 connect (_octave_qt_link,
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
811 SIGNAL (set_workspace_signal
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
812 (bool, const QString&, const QStringList&,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
813 const QStringList&, const QStringList&,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
814 const QStringList&)),
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
815 _workspace_model,
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
816 SLOT (set_workspace
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
817 (bool, const QString&, const QStringList&,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
818 const QStringList&, const QStringList&,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
819 const QStringList&)));
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
820
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
821 connect (_octave_qt_link, SIGNAL (clear_workspace_signal ()),
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
822 _workspace_model, SLOT (clear_workspace ()));
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
823
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
824 connect (_octave_qt_link, SIGNAL (change_directory_signal (QString)),
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
825 this, SLOT (change_directory (QString)));
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
826
16423
04c4dd7fd3ce use signal for octave_link::update_dbstop_marker
John W. Eaton <jwe@octave.org>
parents: 16421
diff changeset
827 connect (_octave_qt_link,
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
828 SIGNAL (execute_command_in_terminal_signal (QString)),
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
829 this, SLOT (execute_command_in_terminal (QString)));
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
830
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
831 connect (_octave_qt_link,
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
832 SIGNAL (set_history_signal (const QStringList&)),
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
833 history_window, SLOT (set_history (const QStringList&)));
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
834
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
835 connect (_octave_qt_link,
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
836 SIGNAL (append_history_signal (const QString&)),
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
837 history_window, SLOT (append_history (const QString&)));
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
838
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
839 connect (_octave_qt_link,
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
840 SIGNAL (clear_history_signal (void)),
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
841 history_window, SLOT (clear_history (void)));
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
842
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
843 connect (_octave_qt_link, SIGNAL (enter_debugger_signal ()),
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
844 this, SLOT (handle_enter_debugger ()));
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
845
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
846 connect (_octave_qt_link, SIGNAL (exit_debugger_signal ()),
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
847 this, SLOT (handle_exit_debugger ()));
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
848
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
849 connect (_octave_qt_link,
16424
ad052cdc89ad use signal for octave_link::edit_file
John W. Eaton <jwe@octave.org>
parents: 16423
diff changeset
850 SIGNAL (edit_file_signal (const QString&)),
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
851 editor_window,
16424
ad052cdc89ad use signal for octave_link::edit_file
John W. Eaton <jwe@octave.org>
parents: 16423
diff changeset
852 SLOT (handle_edit_file_request (const QString&)));
ad052cdc89ad use signal for octave_link::edit_file
John W. Eaton <jwe@octave.org>
parents: 16423
diff changeset
853
16426
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16425
diff changeset
854 connect (_octave_qt_link,
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16425
diff changeset
855 SIGNAL (insert_debugger_pointer_signal (const QString&, int)),
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
856 this,
16426
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16425
diff changeset
857 SLOT (handle_insert_debugger_pointer_request (const QString&, int)));
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16425
diff changeset
858
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16425
diff changeset
859 connect (_octave_qt_link,
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16425
diff changeset
860 SIGNAL (delete_debugger_pointer_signal (const QString&, int)),
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
861 this,
16426
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16425
diff changeset
862 SLOT (handle_delete_debugger_pointer_request (const QString&, int)));
203976ae18d1 use signals for octave_link::enter_debugger_event and octave_link::exit_debugger_event
John W. Eaton <jwe@octave.org>
parents: 16425
diff changeset
863
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
864 connect (_octave_qt_link,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
865 SIGNAL (update_breakpoint_marker_signal (bool, const QString&, int)),
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
866 this,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
867 SLOT (handle_update_breakpoint_marker_request (bool, const QString&, int)));
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
868
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
869 connect (_workspace_model,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
870 SIGNAL (rename_variable (const QString&, const QString&)),
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
871 this,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
872 SLOT (handle_rename_variable_request (const QString&,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
873 const QString&)));
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
874
16432
fe4cd846c3e7 separate octave interpreter thread creation from execution
John W. Eaton <jwe@octave.org>
parents: 16431
diff changeset
875 _octave_qt_link->execute_interpreter ();
fe4cd846c3e7 separate octave interpreter thread creation from execution
John W. Eaton <jwe@octave.org>
parents: 16431
diff changeset
876
16421
40d1ddca4db5 improve use of octave_link
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
877 octave_link::connect_link (_octave_qt_link);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
878 }
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
879
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
880 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
881 main_window::construct_menu_bar (void)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
882 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
883 QMenuBar *menu_bar = menuBar ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
884
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
885 construct_file_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
886
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
887 construct_edit_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
888
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
889 construct_debug_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
890
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
891 construct_window_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
892
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
893 construct_help_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
894 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
895
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
896 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
897 main_window::construct_file_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
898 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
899 QMenu *file_menu = p->addMenu (tr ("&File"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
900
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
901 construct_new_menu (file_menu);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
902
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
903 _open_action
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
904 = file_menu->addAction (QIcon (":/actions/icons/fileopen.png"),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
905 tr ("Open..."));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
906 _open_action->setShortcut (QKeySequence::Open);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
907 _open_action->setShortcutContext (Qt::ApplicationShortcut);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
908
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
909 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
910 file_menu->addMenu (editor_window->get_mru_menu ());
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
911 #endif
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
912
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
913 file_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
914
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
915 QAction *load_workspace_action
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
916 = file_menu->addAction (tr ("Load workspace"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
917
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
918 QAction *save_workspace_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
919 = file_menu->addAction (tr ("Save Workspace As"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
920
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
921 file_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
922
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
923 QAction *preferences_action
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
924 = file_menu->addAction (QIcon (":/actions/icons/configure.png"),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
925 tr ("Preferences..."));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
926
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
927 file_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
928
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
929 QAction *exit_action = file_menu->addAction (tr ("Exit"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
930 exit_action->setShortcut (QKeySequence::Quit);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
931
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
932 connect (preferences_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
933 this, SLOT (process_settings_dialog_request ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
934
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
935 connect (_open_action, SIGNAL (triggered ()),
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
936 editor_window, SLOT (request_open_file ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
937
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
938 connect (load_workspace_action, SIGNAL (triggered ()),
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
939 this, SLOT (handle_load_workspace_request ()));
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
940
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
941 connect (save_workspace_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
942 this, SLOT (handle_save_workspace_request ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
943
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
944 connect (exit_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
945 this, SLOT (close ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
946 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
947
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
948 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
949 main_window::construct_new_menu (QMenu *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
950 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
951 QMenu *new_menu = p->addMenu (tr ("New"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
952
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
953 _new_script_action
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
954 = new_menu->addAction (QIcon (":/actions/icons/filenew.png"),
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
955 tr ("Script"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
956
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
957 QAction *new_function_action = new_menu->addAction (tr ("Function"));
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
958 new_function_action->setEnabled (true);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
959
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
960 QAction *new_figure_action = new_menu->addAction (tr ("Figure"));
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
961 new_figure_action->setEnabled (true);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
962
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
963 QAction *new_variable_action = new_menu->addAction (tr ("Variable"));
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
964 new_variable_action->setEnabled (true);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
965
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
966 connect (_new_script_action, SIGNAL (triggered ()),
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
967 editor_window, SLOT (request_new_script ()));
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
968
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
969 connect (new_function_action, SIGNAL (triggered ()),
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
970 editor_window, SLOT (request_new_function ()));
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
971
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
972 connect (new_figure_action, SIGNAL (triggered ()),
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
973 this, SLOT (handle_new_figure_request ()));
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
974
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
975 connect (new_variable_action, SIGNAL (triggered ()),
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
976 this, SLOT (handle_new_variable_request ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
977 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
978
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
979 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
980 main_window::construct_edit_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
981 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
982 QMenu *edit_menu = p->addMenu (tr ("&Edit"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
983
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
984 QKeySequence ctrl_shift = Qt::ControlModifier + Qt::ShiftModifier;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
985
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
986 _undo_action
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
987 = edit_menu->addAction (QIcon (":/actions/icons/undo.png"), tr ("Undo"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
988 _undo_action->setShortcut (QKeySequence::Undo);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
989
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
990 edit_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
991
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
992 _cut_action
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
993 = edit_menu->addAction (QIcon (":/actions/icons/editcut.png"), tr ("Cut"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
994 _cut_action->setShortcut (ctrl_shift + Qt::Key_X);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
995
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
996 _copy_action
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
997 = edit_menu->addAction (QIcon (":/actions/icons/editcopy.png"), tr ("Copy"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
998 _copy_action->setShortcut (ctrl_shift + Qt::Key_C);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
999
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1000 _paste_action
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1001 = edit_menu->addAction (QIcon (":/actions/icons/editpaste.png"), tr ("Paste"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1002 _paste_action->setShortcut (ctrl_shift + Qt::Key_V);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1003
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1004 QAction *select_all_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1005 = edit_menu->addAction (tr ("Select All"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1006 select_all_action->setEnabled (false); // TODO: Make this work.
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1007
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1008 QAction *delete_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1009 = edit_menu->addAction (tr ("Delete"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1010 delete_action->setShortcut (Qt::Key_Delete);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1011 delete_action->setEnabled (false); // TODO: Make this work.
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1012
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1013 edit_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1014
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1015 QAction *find_files_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1016 = edit_menu->addAction (tr ("Find Files..."));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1017 find_files_action->setShortcut (ctrl_shift + Qt::Key_F);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1018
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1019 edit_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1020
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1021 QAction *clear_command_window_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1022 = edit_menu->addAction (tr ("Clear Command Window"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1023
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1024 QAction *clear_command_history
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1025 = edit_menu->addAction(tr ("Clear Command History"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1026
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1027 QAction *clear_workspace_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1028 = edit_menu->addAction (tr ("Clear Workspace"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1029
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1030 connect (_copy_action, SIGNAL (triggered()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1031 command_window, SLOT (copyClipboard ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1032
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1033 connect (_paste_action, SIGNAL (triggered()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1034 command_window, SLOT (pasteClipboard ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1035
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1036 connect (find_files_action, SIGNAL (triggered()),
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1037 this, SLOT (find_files ()));
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1038
16514
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
1039 connect (clear_command_window_action, SIGNAL (triggered ()),
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
1040 this, SLOT (handle_clear_command_window_request ()));
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
1041
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1042 connect (clear_command_history, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1043 this, SLOT (handle_clear_history_request ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1044
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1045 connect (clear_workspace_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1046 this, SLOT (handle_clear_workspace_request ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1047 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1048
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1049 QAction *
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1050 main_window::construct_debug_menu_item (const char *icon_file,
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1051 const QString& item,
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1052 const QKeySequence& key)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1053 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1054 QAction *action = _debug_menu->addAction (QIcon (icon_file), item);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1055
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1056 action->setEnabled (false);
16458
a3513fc13cdb fix cut and paste error in changeset 246d25c8761b
John W. Eaton <jwe@octave.org>
parents: 16457
diff changeset
1057 action->setShortcut (key);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1058
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1059 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1060 editor_window->debug_menu ()->addAction (action);
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1061 editor_window->toolbar ()->addAction (action);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1062 #endif
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1063
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1064 return action;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1065 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1066
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1067 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1068 main_window::construct_debug_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1069 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1070 _debug_menu = p->addMenu (tr ("De&bug"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1071
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1072 _debug_step_over = construct_debug_menu_item
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1073 (":/actions/icons/db_step.png", tr ("Step"), Qt::Key_F10);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1074
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1075 _debug_step_into = construct_debug_menu_item
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1076 (":/actions/icons/db_step_in.png", tr ("Step in"), Qt::Key_F11);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1077
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1078 _debug_step_out = construct_debug_menu_item
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1079 (":/actions/icons/db_step_out.png", tr ("Step out"),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1080 Qt::ShiftModifier + Qt::Key_F11);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1081
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1082 _debug_continue = construct_debug_menu_item
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1083 (":/actions/icons/db_cont.png", tr ("Continue"), Qt::Key_F5);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1084
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1085 _debug_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1086 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1087 editor_window->debug_menu ()->addSeparator ();
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1088 #endif
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1089
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1090 _debug_quit = construct_debug_menu_item
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1091 (":/actions/icons/db_stop.png", tr ("Exit Debug Mode"),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1092 Qt::ShiftModifier + Qt::Key_F5);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1093
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1094 connect (_debug_step_over, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1095 this, SLOT (debug_step_over ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1096
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1097 connect (_debug_step_into, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1098 this, SLOT (debug_step_into ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1099
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1100 connect (_debug_step_out, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1101 this, SLOT (debug_step_out ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1102
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1103 connect (_debug_continue, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1104 this, SLOT (debug_continue ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1105
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1106 connect (_debug_quit, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1107 this, SLOT (debug_quit ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1108 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1109
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1110 QAction *
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1111 main_window::construct_window_menu_item (QMenu *p, const QString& item,
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1112 bool checkable,
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1113 const QKeySequence& key)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1114 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1115 QAction *action = p->addAction (item);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1116
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1117 action->setCheckable (checkable);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1118 action->setShortcut (key);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1119 action->setShortcutContext (Qt::ApplicationShortcut);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1120
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1121 return action;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1122 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1123
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1124 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1125 main_window::construct_window_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1126 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1127 QMenu *window_menu = p->addMenu (tr ("&Window"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1128
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1129 QKeySequence ctrl = Qt::ControlModifier;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1130 QKeySequence ctrl_shift = Qt::ControlModifier + Qt::ShiftModifier;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1131
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1132 QAction *show_command_window_action = construct_window_menu_item
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1133 (window_menu, tr ("Show Command Window"), true, ctrl_shift + Qt::Key_0);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1134
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1135 QAction *show_history_action = construct_window_menu_item
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1136 (window_menu, tr ("Show Command History"), true, ctrl_shift + Qt::Key_1);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1137
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1138 QAction *show_file_browser_action = construct_window_menu_item
16499
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16497
diff changeset
1139 (window_menu, tr ("Show File Browser"), true, ctrl_shift + Qt::Key_2);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1140
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1141 QAction *show_workspace_action = construct_window_menu_item
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1142 (window_menu, tr ("Show Workspace"), true, ctrl_shift + Qt::Key_3);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1143
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1144 QAction *show_editor_action = construct_window_menu_item
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1145 (window_menu, tr ("Show Editor"), true, ctrl_shift + Qt::Key_4);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1146
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1147 QAction *show_documentation_action = construct_window_menu_item
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1148 (window_menu, tr ("Show Documentation"), true, ctrl_shift + Qt::Key_5);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1149
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1150 window_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1151
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1152 QAction *command_window_action = construct_window_menu_item
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1153 (window_menu, tr ("Command Window"), false, ctrl + Qt::Key_0);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1154
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1155 QAction *history_action = construct_window_menu_item
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1156 (window_menu, tr ("Command History"), false, ctrl + Qt::Key_1);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1157
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1158 QAction *file_browser_action = construct_window_menu_item
16499
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16497
diff changeset
1159 (window_menu, tr ("File Browser"), false, ctrl + Qt::Key_2);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1160
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1161 QAction *workspace_action = construct_window_menu_item
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1162 (window_menu, tr ("Workspace"), false, ctrl + Qt::Key_3);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1163
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1164 QAction *editor_action = construct_window_menu_item
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1165 (window_menu, tr ("Editor"), false, ctrl + Qt::Key_4);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1166
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1167 QAction *documentation_action = construct_window_menu_item
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1168 (window_menu, tr ("Documentation"), false, ctrl + Qt::Key_5);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1169
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1170 window_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1171
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1172 QAction *reset_windows_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1173 = window_menu->addAction (tr ("Reset Windows"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1174
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1175 reset_windows_action->setEnabled (false); // TODO: Make this work.
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1176
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1177 connect (show_command_window_action, SIGNAL (toggled (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1178 command_window, SLOT (setVisible (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1179
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1180 connect (command_window, SIGNAL (active_changed (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1181 show_command_window_action, SLOT (setChecked (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1182
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1183 connect (show_workspace_action, SIGNAL (toggled (bool)),
16459
cbc39a3d0c42 improve encapsulation of workspace window object
John W. Eaton <jwe@octave.org>
parents: 16458
diff changeset
1184 workspace_window, SLOT (setVisible (bool)));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1185
16459
cbc39a3d0c42 improve encapsulation of workspace window object
John W. Eaton <jwe@octave.org>
parents: 16458
diff changeset
1186 connect (workspace_window, SIGNAL (active_changed (bool)),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1187 show_workspace_action, SLOT (setChecked (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1188
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1189 connect (show_history_action, SIGNAL (toggled (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1190 history_window, SLOT (setVisible (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1191
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1192 connect (history_window, SIGNAL (active_changed (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1193 show_history_action, SLOT (setChecked (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1194
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1195 connect (show_file_browser_action, SIGNAL (toggled (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1196 file_browser_window, SLOT (setVisible (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1197
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1198 connect (file_browser_window, SIGNAL (active_changed (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1199 show_file_browser_action, SLOT (setChecked (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1200
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1201 #ifdef HAVE_QSCINTILLA
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1202 connect (show_editor_action, SIGNAL (toggled (bool)),
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1203 editor_window, SLOT (setVisible (bool)));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1204
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1205 connect (editor_window, SIGNAL (active_changed (bool)),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1206 show_editor_action, SLOT (setChecked (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1207 #endif
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1208
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1209 connect (show_documentation_action, SIGNAL (toggled (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1210 doc_browser_window, SLOT (setVisible (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1211
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1212 connect (doc_browser_window, SIGNAL (active_changed (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1213 show_documentation_action, SLOT (setChecked (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1214
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1215 connect (command_window_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1216 command_window, SLOT (focus ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1217
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1218 connect (workspace_action, SIGNAL (triggered ()),
16459
cbc39a3d0c42 improve encapsulation of workspace window object
John W. Eaton <jwe@octave.org>
parents: 16458
diff changeset
1219 workspace_window, SLOT (focus ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1220
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1221 connect (history_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1222 history_window, SLOT (focus ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1223
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1224 connect (file_browser_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1225 file_browser_window, SLOT (focus ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1226
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1227 connect (editor_action, SIGNAL (triggered ()),
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1228 editor_window, SLOT (focus ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1229
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1230 connect (documentation_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1231 doc_browser_window, SLOT (focus ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1232
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1233 connect (reset_windows_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1234 this, SLOT (reset_windows ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1235 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1236
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1237 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1238 main_window::construct_help_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1239 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1240 QMenu *help_menu = p->addMenu (tr ("&Help"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1241
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1242 construct_documentation_menu (help_menu);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1243
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1244 help_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1245
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1246 QAction *report_bug_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1247 = help_menu->addAction (tr ("Report Bug"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1248
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1249 QAction *octave_forge_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1250 = help_menu->addAction (tr ("Visit Octave Forge"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1251
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1252 QAction *agora_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1253 = help_menu->addAction (tr ("Visit Agora"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1254
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1255 help_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1256
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1257 QAction *about_octave_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1258 = help_menu->addAction (tr ("About Octave"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1259
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1260 connect (report_bug_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1261 this, SLOT (open_bug_tracker_page ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1262
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1263 connect (octave_forge_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1264 this, SLOT (open_octave_forge_page ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1265
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1266 connect (agora_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1267 this, SLOT (open_agora_page ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1268
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1269 connect (about_octave_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1270 this, SLOT (show_about_octave ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1271 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1272
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1273 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1274 main_window::construct_documentation_menu (QMenu *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1275 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1276 QMenu *documentation_menu = p->addMenu (tr ("Documentation"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1277
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1278 QAction *ondisk_documentation_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1279 = documentation_menu->addAction (tr ("On Disk"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1280
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1281 QAction *online_documentation_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1282 = documentation_menu->addAction (tr ("Online"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1283
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1284 connect (ondisk_documentation_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1285 doc_browser_window, SLOT (focus ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1286
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1287 connect (online_documentation_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1288 this, SLOT (open_online_documentation_page ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1289 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1290
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1291 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1292 main_window::construct_tool_bar (void)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1293 {
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1294 _main_tool_bar = addToolBar ("Main");
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1295
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1296 _main_tool_bar->setObjectName ("MainToolBar");
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1297 _main_tool_bar->addAction (_new_script_action);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1298 _main_tool_bar->addAction (_open_action);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1299
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1300 _main_tool_bar->addSeparator ();
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1301
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1302 _main_tool_bar->addAction (_cut_action);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1303 _main_tool_bar->addAction (_copy_action);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1304 _main_tool_bar->addAction (_paste_action);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1305 _main_tool_bar->addAction (_undo_action);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1306
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1307 _main_tool_bar->addSeparator ();
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1308
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1309 _current_directory_combo_box = new QComboBox (this);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1310 _current_directory_combo_box->setFixedWidth (current_directory_width);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1311 _current_directory_combo_box->setEditable (true);
16518
59dbdaeeea40 * main_window.cc(construct_tool_bar): code cleanup and tool tips for combo box
Torsten <ttl@justmail.de>
parents: 16514
diff changeset
1312 _current_directory_combo_box->setInsertPolicy(QComboBox::NoInsert);
59dbdaeeea40 * main_window.cc(construct_tool_bar): code cleanup and tool tips for combo box
Torsten <ttl@justmail.de>
parents: 16514
diff changeset
1313 _current_directory_combo_box->setToolTip (tr ("Enter directory name"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1314 _current_directory_combo_box->setMaxVisibleItems (current_directory_max_visible);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1315 _current_directory_combo_box->setMaxCount (current_directory_max_count);
16518
59dbdaeeea40 * main_window.cc(construct_tool_bar): code cleanup and tool tips for combo box
Torsten <ttl@justmail.de>
parents: 16514
diff changeset
1316 QSizePolicy sizePol(QSizePolicy::Expanding, QSizePolicy::Preferred);
59dbdaeeea40 * main_window.cc(construct_tool_bar): code cleanup and tool tips for combo box
Torsten <ttl@justmail.de>
parents: 16514
diff changeset
1317 _current_directory_combo_box->setSizePolicy(sizePol);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1318
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1319 // addWidget takes ownership of the objects so there is no
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1320 // need to delete these upon destroying this main_window.
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1321 _main_tool_bar->addWidget (new QLabel (tr ("Current Directory: ")));
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1322 _main_tool_bar->addWidget (_current_directory_combo_box);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1323 QAction *current_dir_up = _main_tool_bar->addAction (
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1324 QIcon (":/actions/icons/up.png"),
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1325 tr ("One directory up"));
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1326 QAction *current_dir_search = _main_tool_bar->addAction (
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1327 QIcon (":/actions/icons/search.png"),
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1328 tr ("Browse directories"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1329
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1330 connect (_current_directory_combo_box, SIGNAL (activated (QString)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1331 this, SLOT (set_current_working_directory (QString)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1332
16518
59dbdaeeea40 * main_window.cc(construct_tool_bar): code cleanup and tool tips for combo box
Torsten <ttl@justmail.de>
parents: 16514
diff changeset
1333 connect (_current_directory_combo_box->lineEdit(), SIGNAL (returnPressed ()),
59dbdaeeea40 * main_window.cc(construct_tool_bar): code cleanup and tool tips for combo box
Torsten <ttl@justmail.de>
parents: 16514
diff changeset
1334 this, SLOT (accept_directory_line_edit ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1335
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1336 connect (current_dir_search, SIGNAL (triggered ()),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1337 this, SLOT (browse_for_directory ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1338
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1339 connect (current_dir_up, SIGNAL (triggered ()),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1340 this, SLOT (change_directory_up ()));
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
1341
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
1342 connect (_undo_action, SIGNAL (triggered ()),
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
1343 this, SLOT (handle_undo_request ()));
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1344 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1345
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1346 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1347 main_window::save_workspace_callback (const std::string& file)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1348 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1349 Fsave (ovl (file));
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1350 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1351
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1352 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1353 main_window::load_workspace_callback (const std::string& file)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1354 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1355 Fload (ovl (file));
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
1356
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
1357 octave_link::set_workspace (true, symbol_table::workspace_info ());
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1358 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1359
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1360 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1361 main_window::clear_workspace_callback (void)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1362 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1363 Fclear ();
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1364 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1365
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1366 void
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1367 main_window::rename_variable_callback (const main_window::name_pair& names)
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1368 {
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1369 /* bool status = */ symbol_table::rename (names.first, names.second);
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1370
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1371 // if (status)
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1372 octave_link::set_workspace (true, symbol_table::workspace_info ());
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1373
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1374 // else
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1375 // ; // we need an octave_link action that runs a GUI error option.
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1376 }
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1377
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1378 void
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
1379 main_window::command_window_undo_callback (void)
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
1380 {
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
1381 command_editor::undo ();
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
1382 command_editor::redisplay ();
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
1383 }
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
1384
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
1385 void
16514
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
1386 main_window::clear_command_window_callback (void)
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
1387 {
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
1388 Fclc ();
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
1389 command_editor::interrupt (true);
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
1390 }
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
1391
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
1392 void
16541
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1393 main_window::resize_command_window_callback (void)
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1394 {
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1395 command_editor::resize_terminal ();
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1396 }
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1397
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1398 void
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1399 main_window::clear_history_callback (void)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1400 {
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
1401 Fhistory (ovl ("-c"));
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1402 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1403
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1404 void
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1405 main_window::execute_command_callback (const std::string& command)
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1406 {
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1407 std::string pending_input = command_editor::get_current_line ();
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1408
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1409 command_editor::set_initial_input (pending_input);
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1410
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1411 command_editor::replace_line (command);
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1412 command_editor::redisplay ();
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1413
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1414 // We are executing inside the command editor event loop. Force
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1415 // the current line to be returned for processing.
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1416 command_editor::interrupt ();
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1417 }
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1418
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1419 void
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1420 main_window::new_figure_callback (void)
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1421 {
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1422 Fbuiltin (ovl ("figure"));
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1423 Fdrawnow ();
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1424 }
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1425
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1426 void
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1427 main_window::change_directory_callback (const std::string& directory)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1428 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1429 Fcd (ovl (directory));
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1430 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1431
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1432 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1433 main_window::debug_continue_callback (void)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1434 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1435 Fdbcont ();
16397
649d0b75ec06 allow continue and quit debug buttons to work
John W. Eaton <jwe@octave.org>
parents: 16395
diff changeset
1436
649d0b75ec06 allow continue and quit debug buttons to work
John W. Eaton <jwe@octave.org>
parents: 16395
diff changeset
1437 command_editor::interrupt (true);
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1438 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1439
16382
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
1440 // The next three callbacks are invoked by GUI buttons. Those buttons
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
1441 // should only be active when we are doing debugging, which means that
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
1442 // Octave is waiting for input in get_debug_input. Calling
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
1443 // command_editor::interrupt will force readline to return even if it
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
1444 // has not read any input, and then get_debug_input will return,
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
1445 // allowing the evaluator to continue and execute the next statement.
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
1446
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1447 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1448 main_window::debug_step_into_callback (void)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1449 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1450 Fdbstep (ovl ("in"));
16382
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
1451
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
1452 command_editor::interrupt (true);
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1453 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1454
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1455 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1456 main_window::debug_step_over_callback (void)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1457 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1458 Fdbstep ();
16382
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
1459
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
1460 command_editor::interrupt (true);
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1461 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1462
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1463 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1464 main_window::debug_step_out_callback (void)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1465 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1466 Fdbstep (ovl ("out"));
16382
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
1467
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
1468 command_editor::interrupt (true);
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1469 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1470
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1471 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1472 main_window::debug_quit_callback (void)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1473 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1474 Fdbquit ();
16397
649d0b75ec06 allow continue and quit debug buttons to work
John W. Eaton <jwe@octave.org>
parents: 16395
diff changeset
1475
649d0b75ec06 allow continue and quit debug buttons to work
John W. Eaton <jwe@octave.org>
parents: 16395
diff changeset
1476 command_editor::interrupt (true);
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1477 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1478
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1479 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1480 main_window::exit_callback (void)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1481 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1482 Fquit ();
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1483 }
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1484
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1485 void
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1486 main_window::find_files(const QString &start_dir)
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1487 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1488
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1489 if (! find_files_dlg)
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1490 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1491 find_files_dlg = new find_files_dialog (this);
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1492
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1493 connect (find_files_dlg, SIGNAL (finished (int)),
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1494 this, SLOT (find_files_finished (int)));
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1495
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1496 connect (find_files_dlg, SIGNAL (dir_selected(const QString &)),
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1497 file_browser_window, SLOT(set_current_directory(const QString&)));
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1498
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1499 connect (find_files_dlg, SIGNAL (file_selected(const QString &)),
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1500 this, SLOT(open_file(const QString &)));
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1501
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1502 find_files_dlg->setWindowModality (Qt::NonModal);
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1503 }
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1504
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1505 if (! find_files_dlg->isVisible ())
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1506 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1507 find_files_dlg->show ();
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1508 }
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1509
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1510 find_files_dlg->set_search_dir(start_dir);
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1511
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1512 find_files_dlg->activateWindow ();
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1513
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1514 }
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1515
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1516 void
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
1517 main_window::find_files_finished(int)
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1518 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1520 }
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1521