annotate libgui/src/main-window.cc @ 17899:14c427b5c5c1

Restore geometry of floating widgets after restart in windows (bug #40485) * main-window.cc(set_window_layout): non-window systems: restore geometry of all non-floating widgets, make widgets floating after restoring main window * octave_dock_widget.h: new class variable for floating state * octave_dock_widget.cc(constructor): initialize floating to false; (destructor): use this new state variable for saving settings; (make_window): store last docked geometry, set last floating geometry with setGeometry instead of restoreGeometry, set floating state true; (make_widget): save last geometry with geometry only, restore last docked geometry, set floating state false; (change_floating): determine necessary action from floating state;
author Torsten <ttl@justmail.de>
date Mon, 11 Nov 2013 07:32:19 +0100
parents e0495a8c1b5d
children 2c241092b47b
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
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 17686
diff changeset
4 Copyright (C) 2011-2013 Jacob Dawid
15204
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
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
28 #include <QKeySequence>
15257
7ee62f559a73 Fix compilation under Windows with GUI and LLVM enabled.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15204
diff changeset
29 #include <QApplication>
7ee62f559a73 Fix compilation under Windows with GUI and LLVM enabled.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15204
diff changeset
30 #include <QLabel>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
31 #include <QMenuBar>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
32 #include <QMenu>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
33 #include <QAction>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
34 #include <QSettings>
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
35 #include <QStyle>
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
36 #include <QToolBar>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
37 #include <QDesktopServices>
16391
a695ee2dc17e * main-window.cc: Include <QDesktopWidget>
John W. Eaton <jwe@octave.org>
parents: 16386
diff changeset
38 #include <QDesktopWidget>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
39 #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
40 #include <QMessageBox>
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
41 #include <QIcon>
17764
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
42 #include <QTextStream>
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
43
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
44 #include <utility>
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
45
16290
d07aeecb2d22 build: Add more #ifdefs to build GUI when Qscintilla is not present.
Rik <rik@octave.org>
parents: 16176
diff changeset
46 #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
47 #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
48 #endif
14707
674740c44c09 Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14703
diff changeset
49 #include "main-window.h"
674740c44c09 Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14703
diff changeset
50 #include "settings-dialog.h"
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
51
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
52 #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
53
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
54 #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
55 #include "defaults.h"
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
56 #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
57 #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
58
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
59 static file_editor_interface *
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
60 create_default_editor (QWidget *p)
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
61 {
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
62 #ifdef HAVE_QSCINTILLA
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
63 return new file_editor (p);
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
64 #else
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
65 return 0;
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
66 #endif
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
67 }
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
68
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
69 main_window::main_window (QWidget *p)
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
70 : QMainWindow (p),
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
71 _workspace_model (new workspace_model ()),
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
72 status_bar (new QStatusBar ()),
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
73 news_window (new news_dock_widget (this)),
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
74 command_window (new terminal_dock_widget (this)),
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
75 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
76 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
77 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
78 editor_window (create_default_editor (this)),
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
79 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
80 find_files_dlg (0),
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
81 release_notes_window (0),
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
82 _octave_main_thread (0),
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
83 _octave_qt_link (0),
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
84 _clipboard (QApplication::clipboard ()),
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
85 _cmd_queue (new QStringList ()), // no command pending
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
86 _cmd_processing (1),
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
87 _cmd_queue_mutex ()
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
88 {
14599
97cb9286919c Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14588
diff changeset
89 // 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
90 construct ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
91 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
92
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
93 main_window::~main_window (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
94 {
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
95 // 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
96 // 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
97
16638
3c2e457eeb72 ask for saving modified editor files if octave is closed (bug #38689)
Torsten <ttl@justmail.de>
parents: 16635
diff changeset
98 delete editor_window; // first one for dialogs of modified editor-tabs
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
99 delete news_window;
16484
fa842e78f491 Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16479
diff changeset
100 delete command_window;
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
101 delete workspace_window;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
102 delete doc_browser_window;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
103 delete file_browser_window;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
104 delete history_window;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
105 delete status_bar;
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
106 delete _workspace_model;
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
107 if (find_files_dlg)
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
108 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
109 delete find_files_dlg;
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
110 find_files_dlg = 0;
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
111 }
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
112 if (release_notes_window)
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
113 {
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
114 delete release_notes_window;
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
115 release_notes_window = 0;
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
116 }
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
117 delete _octave_main_thread;
16421
40d1ddca4db5 improve use of octave_link
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
118 delete _octave_qt_link;
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
119 delete _cmd_queue;
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
120 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
121
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
122 bool
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
123 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
124 {
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
125 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
126 }
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
127
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
128 void
16449
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
129 main_window::focus_command_window (void)
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
130 {
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
131 command_window->focus ();
16449
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
132 }
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
133
c129a8b73d25 avoid unneeded signals for window focus
John W. Eaton <jwe@octave.org>
parents: 16448
diff changeset
134 void
16452
744ff2fe11ce add create script context menu to history window
John Donoghue <john.donoghue@ieee.org>
parents: 16451
diff changeset
135 main_window::new_file (const QString& commands)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
136 {
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
137 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
138 }
3fd857c284fe Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14831
diff changeset
139
3fd857c284fe Editor now gets focussed when opening a file.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14831
diff changeset
140 void
15300
fd27e10b9b05 pass QString by const reference instead of value
John W. Eaton <jwe@octave.org>
parents: 15286
diff changeset
141 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
142 {
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
143 emit open_file_signal (file_name);
13558
248b897d9f36 editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents: 13550
diff changeset
144 }
248b897d9f36 editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents: 13550
diff changeset
145
248b897d9f36 editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents: 13550
diff changeset
146 void
15300
fd27e10b9b05 pass QString by const reference instead of value
John W. Eaton <jwe@octave.org>
parents: 15286
diff changeset
147 main_window::report_status_message (const QString& statusMessage)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
148 {
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
149 status_bar->showMessage (statusMessage, 1000);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
150 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
151
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
152 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
153 main_window::handle_save_workspace_request (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
154 {
16532
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
155 QString file =
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
156 QFileDialog::getSaveFileName (this, tr ("Save Workspace As"), ".", 0, 0,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
157 QFileDialog::DontUseNativeDialog);
16532
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
158
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
159 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
160 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
161 file.toStdString ());
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
162 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
163
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
164 void
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
165 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
166 {
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
167 QString file = file_arg;
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
168
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
169 if (file.isEmpty ())
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
170 file = QFileDialog::getOpenFileName (this, tr ("Load Workspace"), ".", 0, 0,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
171 QFileDialog::DontUseNativeDialog);
16532
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
172
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
173 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
174 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
175 file.toStdString ());
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
176 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
177
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
178 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
179 main_window::handle_clear_workspace_request (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
180 {
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
181 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
182 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
183
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
184 void
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
185 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
186 const QString& new_name)
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
187
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
188 {
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
189 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
190
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
191 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
192 names);
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
193 }
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
194
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
195 void
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
196 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
197 {
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
198 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
199 }
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
200
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
201 void
16514
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
202 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
203 {
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
204 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
205 }
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
206
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
207 void
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
208 main_window::handle_clear_history_request (void)
14814
61c80e9326a8 Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14813
diff changeset
209 {
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
210 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
211 }
61c80e9326a8 Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14813
diff changeset
212
61c80e9326a8 Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14813
diff changeset
213 void
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
214 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
215 {
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
216 queue_command (command);
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
217 focus_command_window ();
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
218 }
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
219
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
220 void
16635
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
221 main_window::run_file_in_terminal (const QFileInfo& info)
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
222 {
17331
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
223 octave_link::post_event (this, &main_window::run_file_callback, info);
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
224 }
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
225
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
226 void
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
227 main_window::run_file_callback (const QFileInfo& info)
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
228 {
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
229 QString dir = info.absolutePath ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
230 QString function_name = info.fileName ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
231 function_name.chop (info.suffix ().length () + 1);
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
232 if (octave_qt_link::file_in_path (info.absoluteFilePath ().toStdString (),
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
233 dir.toStdString ()))
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
234 queue_command (function_name);
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
235 }
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
236
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
237 void
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
238 main_window::queue_command (QString command)
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
239 {
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
240 _cmd_queue_mutex.lock ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
241 _cmd_queue->append (command); // queue command
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
242 _cmd_queue_mutex.unlock ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
243
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
244 if (_cmd_processing.tryAcquire ()) // if callback not processing, post event
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
245 octave_link::post_event (this, &main_window::execute_command_callback);
16635
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
246 }
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
247
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
248 void
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
249 main_window::handle_new_figure_request (void)
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
250 {
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
251 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
252 }
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
253
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
254 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
255 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
256 {
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
257 QDesktopServices::openUrl (QUrl ("http://octave.org/doc/interpreter"));
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
258 }
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
259
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
260 void
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
261 main_window::display_release_notes (void)
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
262 {
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
263 if (! release_notes_window)
17764
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
264 {
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
265 std::string news_file = Voct_etc_dir + "/NEWS";
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
266
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
267 QString news;
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
268
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
269 QFile *file = new QFile (QString::fromStdString (news_file));
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
270 if (file->open (QFile::ReadOnly))
17764
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
271 {
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
272 QTextStream *stream = new QTextStream (file);
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
273 news = stream->readAll ();
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
274 if (! news.isEmpty ())
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
275 {
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
276 news.prepend ("<pre>");
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
277 news.append ("</pre>");
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
278 }
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
279 else
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
280 news = (tr ("The release notes file '%1' is empty.")
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
281 . arg (QString::fromStdString (news_file)));
17764
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
282 }
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
283 else
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
284 news = (tr ("The release notes file '%1' cannot be read.")
17771
7690c3477da1 if NEWS file is missing, include expected file name in release notes message
John W. Eaton <jwe@octave.org>
parents: 17764
diff changeset
285 . arg (QString::fromStdString (news_file)));
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
286
17764
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
287
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
288 release_notes_window = new QWidget;
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
289
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
290 QTextBrowser *browser = new QTextBrowser (release_notes_window);
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
291 browser->setText (news);
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
292
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
293 QVBoxLayout *vlayout = new QVBoxLayout;
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
294 vlayout->addWidget (browser);
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
295
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
296 release_notes_window->setLayout (vlayout);
17890
e0495a8c1b5d Set initial size of GUI Release Notes window to something reasonable.
Rik <rik@octave.org>
parents: 17883
diff changeset
297 browser->document()->adjustSize ();
e0495a8c1b5d Set initial size of GUI Release Notes window to something reasonable.
Rik <rik@octave.org>
parents: 17883
diff changeset
298 QSize doc_size = browser->document()->size().toSize ();
e0495a8c1b5d Set initial size of GUI Release Notes window to something reasonable.
Rik <rik@octave.org>
parents: 17883
diff changeset
299 doc_size.rwidth () += 45;
e0495a8c1b5d Set initial size of GUI Release Notes window to something reasonable.
Rik <rik@octave.org>
parents: 17883
diff changeset
300 release_notes_window->resize (doc_size);
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
301 release_notes_window->setWindowTitle (tr ("Octave Release Notes"));
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
302 release_notes_window->setWindowIcon (QIcon (_release_notes_icon));
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
303 }
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
304
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
305 if (! release_notes_window->isVisible ())
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
306 release_notes_window->show ();
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
307 else if (release_notes_window->isMinimized ())
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
308 release_notes_window->showNormal ();
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
309
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
310 release_notes_window->raise ();
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
311 release_notes_window->activateWindow ();
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
312 }
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
313
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
314 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
315 main_window::open_bug_tracker_page (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
316 {
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
317 QDesktopServices::openUrl (QUrl ("http://octave.org/bugs.html"));
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
318 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
319
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
320 void
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
321 main_window::open_octave_packages_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
322 {
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
323 QDesktopServices::openUrl (QUrl ("http://octave.org/packages.html"));
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
324 }
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
325
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
326 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
327 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
328 {
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
329 QDesktopServices::openUrl (QUrl ("http://agora.octave.org"));
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
330 }
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
331
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
332 void
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
333 main_window::open_contribute_page (void)
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
334 {
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
335 QDesktopServices::openUrl (QUrl ("http://octave.org/donate.html"));
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
336 }
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
337
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
338 void
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
339 main_window::open_developer_page (void)
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
340 {
17576
387ecd448b30 main-windows.cc: Fixed typo in open_developer_page URL
Andreas Weber <andy.weber.aw@gmail.com>
parents: 17510
diff changeset
341 QDesktopServices::openUrl (QUrl ("http://octave.org/get-involved.html"));
13533
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
342 }
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
343
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
344 void
17676
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17674
diff changeset
345 main_window::process_settings_dialog_request (const QString& desired_tab)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
346 {
17676
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17674
diff changeset
347 settings_dialog *settingsDialog = new settings_dialog (this, desired_tab);
15274
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15257
diff changeset
348 int change_settings = settingsDialog->exec ();
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15257
diff changeset
349 if (change_settings == QDialog::Accepted)
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15257
diff changeset
350 {
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15257
diff changeset
351 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
352 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
353 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
354 emit settings_changed (settings);
15274
c5d09a57ceb2 provide buttons for the settings dialog (bug #36981)
Torsten <ttl@justmail.de>
parents: 15257
diff changeset
355 }
14586
8e9823066dad Fixed bug with not correctly syncing settings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14308
diff changeset
356 delete settingsDialog;
14588
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
357 }
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
358
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
359
14588
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
360 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
361 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
362 {
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
363 // 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
364
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
365 // 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
366 QString icon_set
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
367 = 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
368
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
369 static struct
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
370 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
371 QString name;
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
372 QString path;
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
373 }
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
374
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
375 widget_icon_data[] =
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
376 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
377 // array of possible icon sets (name, path (complete for NONE))
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
378 // the first entry here is the default!
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
379 {"NONE", ":/actions/icons/logo.png"},
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
380 {"GRAPHIC", ":/actions/icons/graphic_logo_"},
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
381 {"LETTER", ":/actions/icons/letter_logo_"},
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
382 {"", ""} // end marker has empty name
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
383 };
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
384
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
385 int count = 0;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
386 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
387
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
388 while (!widget_icon_data[count].name.isEmpty ())
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
389 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
390 // while not end of data
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
391 if (widget_icon_data[count].name == icon_set)
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
392 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
393 // data of desired icon set found
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
394 icon_set_found = count;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
395 break;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
396 }
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
397 count++;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
398 }
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
399
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
400 QString icon;
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
401 foreach (octave_dock_widget *widget, dock_widget_list ())
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
402 {
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
403 QString name = widget->objectName ();
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
404 if (! name.isEmpty ())
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
405 { // if children has a name
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
406 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
407 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
408 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
409 widget->setWindowIcon (QIcon (icon));
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
410 }
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
411 }
17619
4288b90f18c4 icons for news and release notes widgets
Torsten <ttl@justmail.de>
parents: 17617
diff changeset
412 if (widget_icon_data[icon_set_found].name != "NONE")
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
413 _release_notes_icon = widget_icon_data[icon_set_found].path
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
414 + "ReleaseWidget.png";
17619
4288b90f18c4 icons for news and release notes widgets
Torsten <ttl@justmail.de>
parents: 17617
diff changeset
415 else
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
416 _release_notes_icon = ":/actions/icons/logo.png";
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
417
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
418 int icon_size = settings->value ("toolbar_icon_size",24).toInt ();
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
419 _main_tool_bar->setIconSize (QSize (icon_size,icon_size));
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
420
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
421 resource_manager::update_network_settings ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
422 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
423
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
424
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
425 void
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
426 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
427 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
428 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
429 }
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
430
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
431 void
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
432 main_window::exit (int status)
16479
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
433 {
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
434 qApp->exit (status);
16479
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
435 }
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
436
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
437 void
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
438 main_window::reset_windows (void)
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
439 {
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
440 QSettings *settings = resource_manager::get_default_settings ();
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
441
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
442 set_window_layout (settings);
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
443 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
444
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
445 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
446 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
447 {
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
448 // 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
449 // 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
450 // widget.
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
451
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
452 int index = _current_directory_combo_box->findText (dir);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
453
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
454 if (index >= 0)
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
455 _current_directory_combo_box->removeItem (index);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
456
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
457 _current_directory_combo_box->insertItem (0, dir);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
458 _current_directory_combo_box->setCurrentIndex (0);
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
459
16499
facf00ce97d3 gui: configurable synchronization between file browser and octave directory
Torsten <ttl@justmail.de>
parents: 16497
diff changeset
460 file_browser_window->update_octave_directory (dir);
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
461 }
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
462
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
463 void
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
464 main_window::browse_for_directory (void)
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
465 {
16578
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
466 QString dir
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
467 = QFileDialog::getExistingDirectory (this, tr ("Set working directory"), 0,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
468 QFileDialog::DontUseNativeDialog);
16578
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
469
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
470 set_current_working_directory (dir);
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
471
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
472 // FIXME: on Windows systems, the command window freezes after the
16578
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
473 // previous actions. Forcing the focus appears to unstick it.
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
474
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
475 focus_command_window ();
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
476 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
477
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
478 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
479 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
480 {
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
481 // 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
482
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
483 QString xdir = dir.isEmpty () ? "." : dir;
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
484
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
485 QFileInfo fileInfo (xdir);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
486
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
487 if (fileInfo.exists () && fileInfo.isDir ())
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
488 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
489 xdir.toStdString ());
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
490 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
491
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
492 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
493 main_window::change_directory_up (void)
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
494 {
16526
01541f7321f7 correctly track directory for cd ..
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
495 set_current_working_directory ("..");
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
496 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
497
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
498 // 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
499 // 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
500 // in the drop down list.
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
501
15626
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
502 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
503 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
504 {
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
505 // 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
506 // 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
507 // directory.
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
508
16518
59dbdaeeea40 * main_window.cc(construct_tool_bar): code cleanup and tool tips for combo box
Torsten <ttl@justmail.de>
parents: 16514
diff changeset
509 QString dir = _current_directory_combo_box->currentText ();
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
510
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
511 int index = _current_directory_combo_box->findText (dir);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
512
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
513 if (index < 0)
15626
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
514 set_current_working_directory (dir);
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
515 }
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
516
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
517 void
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
518 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
519 {
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
520 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
521
14795
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
522 _debug_continue->setEnabled (true);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
523 _debug_step_into->setEnabled (true);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
524 _debug_step_over->setEnabled (true);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
525 _debug_step_out->setEnabled (true);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
526 _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
527
15873
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15848
diff changeset
528 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
529 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
530 #endif
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
531 }
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
532
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
533 void
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
534 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
535 {
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
536 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
537
14795
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
538 _debug_continue->setEnabled (false);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
539 _debug_step_into->setEnabled (false);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
540 _debug_step_over->setEnabled (false);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
541 _debug_step_out->setEnabled (false);
e3ae0850b105 Fixed integrating debug menu in the editor window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14784
diff changeset
542 _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
543
15873
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15848
diff changeset
544 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
545 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
546 #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
547 }
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
548
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
549 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
550 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
551 {
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
552 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
553 }
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
554
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
555 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
556 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
557 {
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
558 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
559 }
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
560
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
561 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
562 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
563 {
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
564 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
565 }
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
566
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
567 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
568 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
569 {
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
570 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
571 }
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
572
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
573 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
574 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
575 {
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
576 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
577 }
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
578
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
579 void
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
580 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
581 int line)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
582 {
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
583 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
584
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
585 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
586
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
587 if (cmd_focus)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
588 focus_command_window ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
589 }
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
590
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
591 void
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
592 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
593 int line)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
594 {
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
595 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
596
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
597 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
598
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
599 if (cmd_focus)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
600 focus_command_window ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
601 }
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
602
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
603 void
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
604 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
605 const QString& file,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
606 int line)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
607 {
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
608 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
609
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
610 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
611
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
612 if (cmd_focus)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
613 focus_command_window ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
614 }
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
615
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
616 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
617 main_window::show_about_octave (void)
13548
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
618 {
17510
7542f4496974 eliminate some macros in version.h
John W. Eaton <jwe@octave.org>
parents: 17509
diff changeset
619 std::string message
7542f4496974 eliminate some macros in version.h
John W. Eaton <jwe@octave.org>
parents: 17509
diff changeset
620 = octave_name_version_copyright_copying_warranty_and_bugs (true);
13548
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
621
17510
7542f4496974 eliminate some macros in version.h
John W. Eaton <jwe@octave.org>
parents: 17509
diff changeset
622 QMessageBox::about (this, tr ("About Octave"),
7542f4496974 eliminate some macros in version.h
John W. Eaton <jwe@octave.org>
parents: 17509
diff changeset
623 QString::fromStdString (message));
13548
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
624 }
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
625
5c2ea445e100 Added about boxes.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13546
diff changeset
626 void
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
627 main_window::closeEvent (QCloseEvent *e)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
628 {
15368
36ececf69385 avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents: 15367
diff changeset
629 e->ignore ();
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
630 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
631 }
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
632
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
633 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
634 main_window::read_settings (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
635 {
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
636 QSettings *settings = resource_manager::get_settings ();
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
637
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
638 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
639 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
640 qDebug ("Error: QSettings pointer from resource manager is NULL.");
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
641 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
642 }
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
643
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
644 set_window_layout (settings);
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
645
15465
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
646 // restore the list of the last directories
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
647 QStringList curr_dirs
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
648 = settings->value ("MainWindow/current_directory_list").toStringList ();
15465
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
649 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
650 {
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
651 _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
652 }
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
653 emit settings_changed (settings);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
654 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
655
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
656 void
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
657 main_window::set_window_layout (QSettings *settings)
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
658 {
17083
ceca3e65a8fe make sure a central menu bar does not show a widgets title but "Octave"
Torsten <ttl@justmail.de>
parents: 17029
diff changeset
659 QList<octave_dock_widget *> float_and_visible;
ceca3e65a8fe make sure a central menu bar does not show a widgets title but "Octave"
Torsten <ttl@justmail.de>
parents: 17029
diff changeset
660
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
661 // Restore the geometry of all dock-widgets
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
662 foreach (octave_dock_widget *widget, dock_widget_list ())
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
663 {
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
664 QString name = widget->objectName ();
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
665
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
666 if (! name.isEmpty ())
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
667 {
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
668 bool floating = settings->value
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
669 ("DockWidgets/" + name + "Floating", false).toBool ();
17899
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
670 bool visible = settings->value
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
671 ("DockWidgets/" + name + "Visible", true).toBool ();
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
672
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
673 #if defined (Q_OS_WIN32)
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
674 // If floating, make window from widget.
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
675 if (floating)
16818
caf3d2a45da0 clean up some code for undocking and docking widgets
Torsten <ttl@justmail.de>
parents: 16811
diff changeset
676 widget->make_window ();
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
677 else if (! widget->parent ()) // should not be floating but is
17090
1d544ac39369 show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents: 17083
diff changeset
678 widget->make_widget (false); // no docking, just reparent
17899
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
679 #else
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
680 // restore geometry
17686
65544374c1cf restore (un)docking of widgets without reparenting on non-windows systems
Torsten <ttl@justmail.de>
parents: 17676
diff changeset
681 QVariant val = settings->value ("DockWidgets/" + name);
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
682 widget->restoreGeometry (val.toByteArray ());
17899
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
683 #endif
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
684 // make widget visible if desired
17083
ceca3e65a8fe make sure a central menu bar does not show a widgets title but "Octave"
Torsten <ttl@justmail.de>
parents: 17029
diff changeset
685 if (floating && visible) // floating and visible
ceca3e65a8fe make sure a central menu bar does not show a widgets title but "Octave"
Torsten <ttl@justmail.de>
parents: 17029
diff changeset
686 float_and_visible.append (widget); // not show before main win
ceca3e65a8fe make sure a central menu bar does not show a widgets title but "Octave"
Torsten <ttl@justmail.de>
parents: 17029
diff changeset
687 else
17090
1d544ac39369 show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents: 17083
diff changeset
688 {
1d544ac39369 show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents: 17083
diff changeset
689 widget->make_widget ();
1d544ac39369 show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents: 17083
diff changeset
690 widget->setVisible (visible); // not floating -> show
1d544ac39369 show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents: 17083
diff changeset
691 }
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
692 }
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
693 }
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
694
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
695 restoreState (settings->value ("MainWindow/windowState").toByteArray ());
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
696 restoreGeometry (settings->value ("MainWindow/geometry").toByteArray ());
17083
ceca3e65a8fe make sure a central menu bar does not show a widgets title but "Octave"
Torsten <ttl@justmail.de>
parents: 17029
diff changeset
697 show (); // main window is ready and can be shown (as first window)
ceca3e65a8fe make sure a central menu bar does not show a widgets title but "Octave"
Torsten <ttl@justmail.de>
parents: 17029
diff changeset
698
ceca3e65a8fe make sure a central menu bar does not show a widgets title but "Octave"
Torsten <ttl@justmail.de>
parents: 17029
diff changeset
699 // show floating widgets after main win to ensure "Octave" in central menu
ceca3e65a8fe make sure a central menu bar does not show a widgets title but "Octave"
Torsten <ttl@justmail.de>
parents: 17029
diff changeset
700 foreach (octave_dock_widget *widget, float_and_visible)
17899
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
701 {
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
702 #if not defined (Q_OS_WIN32)
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
703 widget->make_window ();
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
704 #endif
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
705 widget->setVisible (true);
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
706 }
17083
ceca3e65a8fe make sure a central menu bar does not show a widgets title but "Octave"
Torsten <ttl@justmail.de>
parents: 17029
diff changeset
707
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
708 }
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
709
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
710 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
711 main_window::write_settings (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
712 {
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
713 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
714 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
715 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
716 qDebug ("Error: QSettings pointer from resource manager is NULL.");
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
717 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
718 }
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
719
13537
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
720 settings->setValue ("MainWindow/geometry", saveGeometry ());
15552
bbbb89cc338f make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents: 15465
diff changeset
721 settings->setValue ("MainWindow/windowState", saveState ());
15465
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
722 // 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
723 QStringList curr_dirs;
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
724 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
725 {
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
726 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
727 }
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
728 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
729 settings->sync ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
730 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
731
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
732
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
733 // 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
734 // 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
735 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
736 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
737 {
17617
9abb1422d60b correct indication of news-windows visibility in the window menu
Torsten <ttl@justmail.de>
parents: 17599
diff changeset
738 foreach (octave_dock_widget *widget, dock_widget_list ())
9abb1422d60b correct indication of news-windows visibility in the window menu
Torsten <ttl@justmail.de>
parents: 17599
diff changeset
739 widget->connect_visibility_changed ();
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
740 }
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
741
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
742 void
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
743 main_window::copyClipboard (void)
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
744 {
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
745 if (_current_directory_combo_box->hasFocus ())
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
746 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
747 QLineEdit * edit = _current_directory_combo_box->lineEdit ();
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
748 if (edit && edit->hasSelectedText ())
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
749 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
750 QClipboard *clipboard = QApplication::clipboard ();
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
751 clipboard->setText (edit->selectedText ());
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
752 }
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
753 }
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
754 else
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
755 emit copyClipboard_signal ();
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
756 }
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
757
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
758 void
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
759 main_window::pasteClipboard (void)
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
760 {
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
761 if (_current_directory_combo_box->hasFocus ())
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
762 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
763 QLineEdit * edit = _current_directory_combo_box->lineEdit ();
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
764 QClipboard *clipboard = QApplication::clipboard ();
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
765 QString str = clipboard->text ();
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
766 if (edit && str.length () > 0)
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
767 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
768 edit->insert (str);
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
769 }
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
770 }
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
771 else
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
772 emit pasteClipboard_signal ();
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
773 }
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
774
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
775 // 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
776 // 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
777 // 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
778 // 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
779
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
780 void
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
781 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
782 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
783 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
784 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
785 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
786 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
787 this,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
788 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
789 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
790 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
791
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
792 // 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
793 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
794 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
795 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
796 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
797 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
798 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
799 this,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
800 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
801 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
802 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
803 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
804
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
805 // 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
806 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
807 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
808 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
809 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
810 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
811 this,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
812 SLOT (handle_create_inputlayout (const QStringList&, const QString&,
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
813 const QFloatList&,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
814 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
815 const QStringList&)));
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
816
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
817 connect (&uiwidget_creator,
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
818 SIGNAL (create_filedialog (const QStringList &,const QString&,
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
819 const QString&, const QString&,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
820 const QString&)),
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
821 this,
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
822 SLOT (handle_create_filedialog (const QStringList &, const QString&,
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
823 const QString&, const QString&,
16581
fa4a035e0cf4 Add octave_link uiputfile implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16580
diff changeset
824 const QString&)));
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
825 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
826
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
827 // 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
828 // text.
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
829
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
830 void
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
831 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
832 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
833 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
834 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
835 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
836 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
837 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
838 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
839 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
840 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
841 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
842 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
843
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
844 // 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
845 // 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
846
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
847 void
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
848 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
849 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
850 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
851 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
852 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
853 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
854 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
855 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
856 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
857 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
858 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
859 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
860
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
861 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
862 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
863 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
864
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
865 // 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
866 // 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
867 void
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
868 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
869 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
870 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
871 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
872 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
873 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
874 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
875 defaults);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
876
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
877 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
878 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
879 }
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
880
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
881 void
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
882 main_window::handle_create_filedialog (const QStringList& filters,
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
883 const QString& title,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
884 const QString& filename,
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
885 const QString& dirname,
16581
fa4a035e0cf4 Add octave_link uiputfile implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16580
diff changeset
886 const QString& multimode)
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
887 {
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
888 FileDialog *file_dialog = new FileDialog (filters, title, filename,
16581
fa4a035e0cf4 Add octave_link uiputfile implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16580
diff changeset
889 dirname, multimode);
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
890
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
891 file_dialog->setAttribute (Qt::WA_DeleteOnClose);
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
892 file_dialog->show ();
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
893 }
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
894
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
895 // Main subroutine of the constructor
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
896 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
897 main_window::construct (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
898 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
899 _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
900 setWindowIcon (QIcon (":/actions/icons/logo.png"));
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
901
16459
cbc39a3d0c42 improve encapsulation of workspace window object
John W. Eaton <jwe@octave.org>
parents: 16458
diff changeset
902 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
903 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
904 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
905
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
906 // 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
907 // 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
908 // destroying this main_window.
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
909
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
910 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
911 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
912 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
913 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
914 dummyWidget->hide ();
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14695
diff changeset
915 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
916
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
917 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
918
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
919 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
920
16497
9ff3181e671c Reconnect aboutToQuit signal and prepare_to_exit (write_settings) slot.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16485
diff changeset
921 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
922 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
923
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
924 connect (this, SIGNAL (settings_changed (const QSettings *)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
925 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
926
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
927 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
928 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
929
16699
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16672
diff changeset
930 connect (file_browser_window, SIGNAL (find_files_signal (const QString&)),
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16672
diff changeset
931 this, SLOT (find_files (const QString&)));
d4bcb38ad056 Added find files context menu to files-dock-widget
John Donoghue <john.donoghue@ieee.org>
parents: 16672
diff changeset
932
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
933 connect (this, SIGNAL (set_widget_shortcuts_signal (bool)),
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
934 editor_window, SLOT (set_shortcuts (bool)));
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
935
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
936 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
937
14601
772ce0204b3f Removed version number and "Octave GUI"-labelling.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14599
diff changeset
938 setWindowTitle ("Octave");
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
939
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
940 setDockOptions (QMainWindow::AnimatedDocks
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
941 | QMainWindow::AllowNestedDocks
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
942 | QMainWindow::AllowTabbedDocks);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
943
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
944 addDockWidget (Qt::RightDockWidgetArea, news_window);
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
945 addDockWidget (Qt::RightDockWidgetArea, command_window);
16453
2e3c652c89d1 improve encapsulation of documentation browser window object
John W. Eaton <jwe@octave.org>
parents: 16452
diff changeset
946 addDockWidget (Qt::RightDockWidgetArea, doc_browser_window);
2e3c652c89d1 improve encapsulation of documentation browser window object
John W. Eaton <jwe@octave.org>
parents: 16452
diff changeset
947 tabifyDockWidget (command_window, doc_browser_window);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
948
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
949 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
950 addDockWidget (Qt::RightDockWidgetArea, editor_window);
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
951 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
952 #endif
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
953
16450
3207f1d62e74 improve encapsulation of file browser window object
John W. Eaton <jwe@octave.org>
parents: 16449
diff changeset
954 addDockWidget (Qt::LeftDockWidgetArea, file_browser_window);
16459
cbc39a3d0c42 improve encapsulation of workspace window object
John W. Eaton <jwe@octave.org>
parents: 16458
diff changeset
955 addDockWidget (Qt::LeftDockWidgetArea, workspace_window);
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
956 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
957
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
958 int win_x = QApplication::desktop ()->width ();
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
959 int win_y = QApplication::desktop ()->height ();
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
960
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
961 if (win_x > 960)
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
962 win_x = 960;
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
963
16379
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
964 if (win_y > 720)
4bb1b82076e5 gui: provide defaults for all values read from the settings file
Torsten <ttl@justmail.de>
parents: 16377
diff changeset
965 win_y = 720;
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
966
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
967 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
968
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
969 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
970
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
971 construct_octave_qt_link ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
972
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
973 #ifdef HAVE_QSCINTILLA
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
974 connect (this,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
975 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
976 editor_window,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
977 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
978
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
979 connect (this,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
980 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
981 editor_window,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
982 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
983
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
984 connect (this,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
985 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
986 editor_window,
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
987 SLOT (handle_update_breakpoint_marker_request (bool,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
988 const QString&,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
989 int)));
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
990 #endif
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
991
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
992 QDir curr_dir;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
993 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
994
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
995 octave_link::post_event (this, &main_window::resize_command_window_callback);
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
996
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
997 set_global_shortcuts (true);
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
998
16454
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
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1001 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1002 main_window::construct_octave_qt_link (void)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1003 {
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
1004 _octave_main_thread = new octave_main_thread ();
16421
40d1ddca4db5 improve use of octave_link
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
1005
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
1006 _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
1007
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
1008 connect (_octave_qt_link, SIGNAL (exit_signal (int)),
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
1009 this, SLOT (exit (int)));
16479
7a71ea0b7ae9 eliminate event listener class
John W. Eaton <jwe@octave.org>
parents: 16478
diff changeset
1010
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
1011 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
1012 SIGNAL (set_workspace_signal
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1013 (bool, const QString&, const QStringList&,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1014 const QStringList&, const QStringList&,
17824
86e8dbccf7c7 show when variables are complex in workspace view (bug #40445)
John W. Eaton <jwe@octave.org>
parents: 17790
diff changeset
1015 const QStringList&, const QIntList&)),
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
1016 _workspace_model,
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
1017 SLOT (set_workspace
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1018 (bool, const QString&, const QStringList&,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1019 const QStringList&, const QStringList&,
17824
86e8dbccf7c7 show when variables are complex in workspace view (bug #40445)
John W. Eaton <jwe@octave.org>
parents: 17790
diff changeset
1020 const QStringList&, const QIntList&)));
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
1021
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
1022 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
1023 _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
1024
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
1025 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
1026 this, SLOT (change_directory (QString)));
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
1027
16423
04c4dd7fd3ce use signal for octave_link::update_dbstop_marker
John W. Eaton <jwe@octave.org>
parents: 16421
diff changeset
1028 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
1029 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
1030 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
1031
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1032 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
1033 SIGNAL (set_history_signal (const QStringList&)),
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
1034 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
1035
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
1036 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
1037 SIGNAL (append_history_signal (const QString&)),
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
1038 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
1039
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
1040 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
1041 SIGNAL (clear_history_signal (void)),
16451
d4c3736e1e28 dynamically allocate Qt widgets
John W. Eaton <jwe@octave.org>
parents: 16450
diff changeset
1042 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
1043
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
1044 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
1045 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
1046
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
1047 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
1048 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
1049
17010
c50ee84842a9 Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents: 16970
diff changeset
1050 connect (_octave_qt_link,
c50ee84842a9 Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents: 16970
diff changeset
1051 SIGNAL (show_preferences_signal (void)),
c50ee84842a9 Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents: 16970
diff changeset
1052 this, SLOT (process_settings_dialog_request ()));
c50ee84842a9 Add preferences and prefdir functions
John Donoghue <john.donoghue@ieee.org>
parents: 16970
diff changeset
1053
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1054 #ifdef HAVE_QSCINTILLA
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
1055 connect (_octave_qt_link,
16424
ad052cdc89ad use signal for octave_link::edit_file
John W. Eaton <jwe@octave.org>
parents: 16423
diff changeset
1056 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
1057 editor_window,
16424
ad052cdc89ad use signal for octave_link::edit_file
John W. Eaton <jwe@octave.org>
parents: 16423
diff changeset
1058 SLOT (handle_edit_file_request (const QString&)));
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1059 #endif
16424
ad052cdc89ad use signal for octave_link::edit_file
John W. Eaton <jwe@octave.org>
parents: 16423
diff changeset
1060
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
1061 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
1062 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
1063 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
1064 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
1065
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
1066 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
1067 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
1068 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
1069 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
1070
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1071 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
1072 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
1073 this,
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1074 SLOT (handle_update_breakpoint_marker_request (bool, const QString&,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1075 int)));
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1076
17029
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
1077 connect (_octave_qt_link,
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
1078 SIGNAL (show_doc_signal (const QString &)),
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
1079 this, SLOT (handle_show_doc (const QString &)));
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
1080
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1081 connect (_workspace_model,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1082 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
1083 this,
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1084 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
1085 const QString&)));
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1086
16432
fe4cd846c3e7 separate octave interpreter thread creation from execution
John W. Eaton <jwe@octave.org>
parents: 16431
diff changeset
1087 _octave_qt_link->execute_interpreter ();
fe4cd846c3e7 separate octave interpreter thread creation from execution
John W. Eaton <jwe@octave.org>
parents: 16431
diff changeset
1088
16421
40d1ddca4db5 improve use of octave_link
John W. Eaton <jwe@octave.org>
parents: 16415
diff changeset
1089 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
1090 }
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
1091
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1092 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1093 main_window::construct_menu_bar (void)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1094 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1095 QMenuBar *menu_bar = menuBar ();
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 construct_file_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1098
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1099 construct_edit_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1100
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1101 construct_debug_menu (menu_bar);
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 construct_window_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1104
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1105 construct_help_menu (menu_bar);
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1106
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1107 construct_news_menu (menu_bar);
16454
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 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1111 main_window::construct_file_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1112 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1113 QMenu *file_menu = p->addMenu (tr ("&File"));
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 construct_new_menu (file_menu);
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 _open_action
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1118 = 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
1119 tr ("Open..."));
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1120 _open_action->setShortcutContext (Qt::ApplicationShortcut);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1121
16454
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 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1124 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
1125 #endif
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 file_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1128
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1129 QAction *load_workspace_action
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1130 = file_menu->addAction (tr ("Load workspace"));
16454
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 *save_workspace_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1133 = file_menu->addAction (tr ("Save Workspace As"));
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 file_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1136
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1137 QAction *preferences_action
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1138 = 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
1139 tr ("Preferences..."));
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 file_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1142
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1143 _exit_action = file_menu->addAction (tr ("Exit"));
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1144 _exit_action->setShortcutContext (Qt::ApplicationShortcut);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1145
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1146 connect (preferences_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1147 this, SLOT (process_settings_dialog_request ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1148
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1149 #ifdef HAVE_QSCINTILLA
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1150 connect (_open_action, SIGNAL (triggered ()),
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1151 editor_window, SLOT (request_open_file ()));
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1152 #endif
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1153
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1154 connect (load_workspace_action, SIGNAL (triggered ()),
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1155 this, SLOT (handle_load_workspace_request ()));
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1156
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1157 connect (save_workspace_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1158 this, SLOT (handle_save_workspace_request ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1159
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1160 connect (_exit_action, SIGNAL (triggered ()),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1161 this, SLOT (close ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1162 }
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 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1165 main_window::construct_new_menu (QMenu *p)
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 QMenu *new_menu = p->addMenu (tr ("New"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1168
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1169 _new_script_action
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1170 = new_menu->addAction (QIcon (":/actions/icons/filenew.png"),
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1171 tr ("Script"));
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1172 _new_script_action->setShortcutContext (Qt::ApplicationShortcut);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1173
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1174 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
1175 new_function_action->setEnabled (true);
16454
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 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
1178 new_figure_action->setEnabled (true);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1179
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1180 #ifdef HAVE_QSCINTILLA
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1181 connect (_new_script_action, SIGNAL (triggered ()),
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1182 editor_window, SLOT (request_new_script ()));
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1183
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1184 connect (new_function_action, SIGNAL (triggered ()),
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1185 editor_window, SLOT (request_new_function ()));
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1186 #endif
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1187
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1188 connect (new_figure_action, SIGNAL (triggered ()),
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1189 this, SLOT (handle_new_figure_request ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1190 }
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 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1193 main_window::construct_edit_menu (QMenuBar *p)
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 QMenu *edit_menu = p->addMenu (tr ("&Edit"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1196
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1197 QKeySequence ctrl_shift = Qt::ControlModifier + Qt::ShiftModifier;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1198
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1199 _undo_action
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1200 = 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
1201 _undo_action->setShortcut (QKeySequence::Undo);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1202
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1203 edit_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1204
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1205 _copy_action
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1206 = edit_menu->addAction (QIcon (":/actions/icons/editcopy.png"),
16649
de1f8e4b6b9b more copy/paste tweaks
John W. Eaton <jwe@octave.org>
parents: 16648
diff changeset
1207 tr ("Copy"), this, SLOT (copyClipboard ()));
16956
eefcfeb37446 make ctrl-c abort the actual octave command in linux (bug #37672)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1208 _copy_action->setShortcut (QKeySequence::Copy);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1209
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1210
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1211 _paste_action
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1212 = edit_menu->addAction (QIcon (":/actions/icons/editpaste.png"),
16649
de1f8e4b6b9b more copy/paste tweaks
John W. Eaton <jwe@octave.org>
parents: 16648
diff changeset
1213 tr ("Paste"), this, SLOT (pasteClipboard ()));
16956
eefcfeb37446 make ctrl-c abort the actual octave command in linux (bug #37672)
Torsten <ttl@justmail.de>
parents: 16912
diff changeset
1214 _paste_action->setShortcut (QKeySequence::Paste);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1215
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1216 _clear_clipboard_action
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1217 = edit_menu->addAction (tr ("Clear Clipboard"), this,
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1218 SLOT (clear_clipboard ()));
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1219
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1220 edit_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1221
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1222 _find_files_action = edit_menu->addAction (tr ("Find Files..."));
16454
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 edit_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1225
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1226 QAction *clear_command_window_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1227 = edit_menu->addAction (tr ("Clear Command Window"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1228
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1229 QAction *clear_command_history
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1230 = edit_menu->addAction (tr ("Clear Command History"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1231
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1232 QAction *clear_workspace_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1233 = edit_menu->addAction (tr ("Clear Workspace"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1234
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1235 connect (_find_files_action, SIGNAL (triggered ()),
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1236 this, SLOT (find_files ()));
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1237
16514
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
1238 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
1239 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
1240
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1241 connect (clear_command_history, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1242 this, SLOT (handle_clear_history_request ()));
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 connect (clear_workspace_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1245 this, SLOT (handle_clear_workspace_request ()));
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1246
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1247 connect (_clipboard, SIGNAL (changed (QClipboard::Mode)),
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1248 this, SLOT (clipboard_has_changed (QClipboard::Mode)));
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1249 clipboard_has_changed (QClipboard::Clipboard);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1250 }
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 *
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1253 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
1254 const QString& item,
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1255 const QKeySequence& key)
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 *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
1258
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1259 action->setEnabled (false);
16458
a3513fc13cdb fix cut and paste error in changeset 246d25c8761b
John W. Eaton <jwe@octave.org>
parents: 16457
diff changeset
1260 action->setShortcut (key);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1261
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1262 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1263 editor_window->debug_menu ()->addAction (action);
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1264 editor_window->toolbar ()->addAction (action);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1265 #endif
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1266
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1267 return action;
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
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1270 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1271 main_window::construct_debug_menu (QMenuBar *p)
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 _debug_menu = p->addMenu (tr ("De&bug"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1274
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1275 _debug_step_over = construct_debug_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1276 (":/actions/icons/db_step.png", tr ("Step"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1277 Qt::Key_F10);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1278
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1279 _debug_step_into = construct_debug_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1280 (":/actions/icons/db_step_in.png", tr ("Step in"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1281 Qt::Key_F11);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1282
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1283 _debug_step_out = construct_debug_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1284 (":/actions/icons/db_step_out.png", tr ("Step out"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1285 Qt::ShiftModifier + Qt::Key_F11);
16454
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 _debug_continue = construct_debug_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1288 (":/actions/icons/db_cont.png", tr ("Continue"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1289 Qt::Key_F5);
16454
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 _debug_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1292 #ifdef HAVE_QSCINTILLA
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1293 editor_window->debug_menu ()->addSeparator ();
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1294 #endif
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1295
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1296 _debug_quit = construct_debug_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1297 (":/actions/icons/db_stop.png", tr ("Exit Debug Mode"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1298 Qt::ShiftModifier + Qt::Key_F5);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1299
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1300 connect (_debug_step_over, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1301 this, SLOT (debug_step_over ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1302
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1303 connect (_debug_step_into, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1304 this, SLOT (debug_step_into ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1305
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1306 connect (_debug_step_out, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1307 this, SLOT (debug_step_out ()));
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 connect (_debug_continue, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1310 this, SLOT (debug_continue ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1311
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1312 connect (_debug_quit, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1313 this, SLOT (debug_quit ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1314 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1315
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1316 QAction *
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1317 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
1318 bool checkable,
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1319 const QKeySequence& key)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1320 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1321 QAction *action = p->addAction (item);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1322
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1323 action->setCheckable (checkable);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1324 action->setShortcut (key);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1325 action->setShortcutContext (Qt::ApplicationShortcut);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1326
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1327 return action;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1328 }
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 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1331 main_window::construct_window_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1332 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1333 QMenu *window_menu = p->addMenu (tr ("&Window"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1334
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1335 QKeySequence ctrl = Qt::ControlModifier;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1336 QKeySequence ctrl_shift = Qt::ControlModifier + Qt::ShiftModifier;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1337
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1338 QAction *show_command_window_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1339 (window_menu,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1340 tr ("Show Command Window"), true,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1341 ctrl_shift + Qt::Key_0);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1342
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1343 QAction *show_history_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1344 (window_menu, tr ("Show Command History"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1345 true, ctrl_shift + Qt::Key_1);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1346
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1347 QAction *show_file_browser_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1348 (window_menu, tr ("Show File Browser"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1349 true, ctrl_shift + Qt::Key_2);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1350
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1351 QAction *show_workspace_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1352 (window_menu, tr ("Show Workspace"), true,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1353 ctrl_shift + Qt::Key_3);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1354
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1355 QAction *show_editor_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1356 (window_menu, tr ("Show Editor"), true,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1357 ctrl_shift + Qt::Key_4);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1358
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1359 QAction *show_documentation_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1360 (window_menu, tr ("Show Documentation"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1361 true, ctrl_shift + Qt::Key_5);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1362
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1363 QAction *show_news_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1364 (window_menu, tr ("Show News Window"), true,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1365 ctrl_shift + Qt::Key_6);
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1366
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1367 window_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1368
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1369 QAction *command_window_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1370 (window_menu, tr ("Command Window"), false,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1371 ctrl + Qt::Key_0);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1372
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1373 QAction *history_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1374 (window_menu, tr ("Command History"), false,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1375 ctrl + Qt::Key_1);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1376
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1377 QAction *file_browser_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1378 (window_menu, tr ("File Browser"), false,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1379 ctrl + Qt::Key_2);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1380
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1381 QAction *workspace_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1382 (window_menu, tr ("Workspace"), false,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1383 ctrl + Qt::Key_3);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1384
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1385 QAction *editor_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1386 (window_menu, tr ("Editor"), false,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1387 ctrl + Qt::Key_4);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1388
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1389 QAction *documentation_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1390 (window_menu, tr ("Documentation"), false,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1391 ctrl + Qt::Key_5);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1392
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1393 QAction *news_action = construct_window_menu_item
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1394 (window_menu, tr ("News"), false, ctrl + Qt::Key_6);
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1395
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1396 window_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1397
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1398 QAction *reset_windows_action
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1399 = window_menu->addAction (tr ("Reset Default Window Layout"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1400
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1401 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
1402 command_window, SLOT (setVisible (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1403
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1404 connect (command_window, SIGNAL (active_changed (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1405 show_command_window_action, SLOT (setChecked (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1406
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1407 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
1408 workspace_window, SLOT (setVisible (bool)));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1409
16459
cbc39a3d0c42 improve encapsulation of workspace window object
John W. Eaton <jwe@octave.org>
parents: 16458
diff changeset
1410 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
1411 show_workspace_action, SLOT (setChecked (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1412
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1413 connect (show_history_action, SIGNAL (toggled (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1414 history_window, SLOT (setVisible (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1415
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1416 connect (history_window, SIGNAL (active_changed (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1417 show_history_action, SLOT (setChecked (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1418
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1419 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
1420 file_browser_window, SLOT (setVisible (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1421
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1422 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
1423 show_file_browser_action, SLOT (setChecked (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1424
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1425 #ifdef HAVE_QSCINTILLA
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1426 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
1427 editor_window, SLOT (setVisible (bool)));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1428
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1429 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
1430 show_editor_action, SLOT (setChecked (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1431 #endif
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1432
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1433 connect (show_news_action, SIGNAL (toggled (bool)),
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1434 news_window, SLOT (setVisible (bool)));
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1435
17617
9abb1422d60b correct indication of news-windows visibility in the window menu
Torsten <ttl@justmail.de>
parents: 17599
diff changeset
1436 connect (news_window, SIGNAL (active_changed (bool)),
9abb1422d60b correct indication of news-windows visibility in the window menu
Torsten <ttl@justmail.de>
parents: 17599
diff changeset
1437 show_news_action, SLOT (setChecked (bool)));
9abb1422d60b correct indication of news-windows visibility in the window menu
Torsten <ttl@justmail.de>
parents: 17599
diff changeset
1438
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1439 connect (show_documentation_action, SIGNAL (toggled (bool)),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1440 doc_browser_window, SLOT (setVisible (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1441
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1442 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
1443 show_documentation_action, SLOT (setChecked (bool)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1444
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1445 connect (command_window_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1446 command_window, SLOT (focus ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1447
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1448 connect (workspace_action, SIGNAL (triggered ()),
16459
cbc39a3d0c42 improve encapsulation of workspace window object
John W. Eaton <jwe@octave.org>
parents: 16458
diff changeset
1449 workspace_window, SLOT (focus ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1450
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1451 connect (history_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1452 history_window, SLOT (focus ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1453
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1454 connect (file_browser_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1455 file_browser_window, SLOT (focus ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1456
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1457 #ifdef HAVE_QSCINTILLA
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1458 connect (editor_action, SIGNAL (triggered ()),
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
1459 editor_window, SLOT (focus ()));
16672
fd43631f09c2 Fix Qt error messages w/o QScintilla-dev installed (Bug #38878)
John Donoghue <john.donoghue@ieee.org>
parents: 16649
diff changeset
1460 #endif
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1461
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1462 connect (news_action, SIGNAL (triggered ()),
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1463 news_window, SLOT (focus ()));
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1464
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1465 connect (documentation_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1466 doc_browser_window, SLOT (focus ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1467
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1468 connect (reset_windows_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1469 this, SLOT (reset_windows ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1470 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1471
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1472 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1473 main_window::construct_help_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1474 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1475 QMenu *help_menu = p->addMenu (tr ("&Help"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1476
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1477 construct_documentation_menu (help_menu);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1478
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1479 help_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1480
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1481 QAction *report_bug_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1482 = help_menu->addAction (tr ("Report Bug"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1483
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1484 QAction *octave_packages_action
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1485 = help_menu->addAction (tr ("Octave Packages"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1486
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1487 QAction *agora_action
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1488 = help_menu->addAction (tr ("Share Code"));
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1489
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1490 QAction *contribute_action
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1491 = help_menu->addAction (tr ("Contribute to Octave"));
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1492
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1493 QAction *developer_action
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1494 = help_menu->addAction (tr ("Octave Developer Resources"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1495
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1496 help_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1497
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1498 QAction *about_octave_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1499 = help_menu->addAction (tr ("About Octave"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1500
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1501 connect (report_bug_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1502 this, SLOT (open_bug_tracker_page ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1503
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1504 connect (octave_packages_action, SIGNAL (triggered ()),
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1505 this, SLOT (open_octave_packages_page ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1506
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1507 connect (agora_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1508 this, SLOT (open_agora_page ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1509
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1510 connect (contribute_action, SIGNAL (triggered ()),
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1511 this, SLOT (open_contribute_page ()));
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1512
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1513 connect (developer_action, SIGNAL (triggered ()),
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1514 this, SLOT (open_developer_page ()));
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
1515
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1516 connect (about_octave_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1517 this, SLOT (show_about_octave ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1518 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1519
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1520 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1521 main_window::construct_documentation_menu (QMenu *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1522 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1523 QMenu *documentation_menu = p->addMenu (tr ("Documentation"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1524
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1525 QAction *ondisk_documentation_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1526 = documentation_menu->addAction (tr ("On Disk"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1527
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1528 QAction *online_documentation_action
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1529 = documentation_menu->addAction (tr ("Online"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1530
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1531 connect (ondisk_documentation_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1532 doc_browser_window, SLOT (focus ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1533
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1534 connect (online_documentation_action, SIGNAL (triggered ()),
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1535 this, SLOT (open_online_documentation_page ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1536 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1537
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1538 void
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1539 main_window::construct_news_menu (QMenuBar *p)
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1540 {
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1541 QMenu *news_menu = p->addMenu (tr ("&News"));
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1542
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1543 QAction *release_notes_action
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1544 = news_menu->addAction (tr ("Release Notes"));
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1545
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1546 QAction *current_news_action
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1547 = news_menu->addAction (tr ("Community News"));
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1548
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1549 connect (release_notes_action, SIGNAL (triggered ()),
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1550 this, SLOT (display_release_notes ()));
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1551
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1552 connect (current_news_action, SIGNAL (triggered ()),
17660
516e1fa636ee Update news menu selection to display news window (current tab) and update windows menus correctly
John Donoghue <john.donoghue@ieee.org>
parents: 17640
diff changeset
1553 news_window, SLOT (focus ()));
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1554 }
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1555
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
1556 void
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1557 main_window::construct_tool_bar (void)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1558 {
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1559 _main_tool_bar = addToolBar ("Main");
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1560
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1561 _main_tool_bar->setObjectName ("MainToolBar");
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1562 _main_tool_bar->addAction (_new_script_action);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1563 _main_tool_bar->addAction (_open_action);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1564
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1565 _main_tool_bar->addSeparator ();
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1566
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1567 _main_tool_bar->addAction (_copy_action);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1568 _main_tool_bar->addAction (_paste_action);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1569 _main_tool_bar->addAction (_undo_action);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1570
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1571 _main_tool_bar->addSeparator ();
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1572
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1573 _current_directory_combo_box = new QComboBox (this);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1574 _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
1575 _current_directory_combo_box->setEditable (true);
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1576 _current_directory_combo_box->setInsertPolicy (QComboBox::NoInsert);
16518
59dbdaeeea40 * main_window.cc(construct_tool_bar): code cleanup and tool tips for combo box
Torsten <ttl@justmail.de>
parents: 16514
diff changeset
1577 _current_directory_combo_box->setToolTip (tr ("Enter directory name"));
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1578 _current_directory_combo_box->setMaxVisibleItems (
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1579 current_directory_max_visible);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1580 _current_directory_combo_box->setMaxCount (current_directory_max_count);
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1581 QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred);
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1582 _current_directory_combo_box->setSizePolicy (sizePol);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1583
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1584 // 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
1585 // need to delete these upon destroying this main_window.
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1586 _main_tool_bar->addWidget (new QLabel (tr ("Current Directory: ")));
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1587 _main_tool_bar->addWidget (_current_directory_combo_box);
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1588 QAction *current_dir_up = _main_tool_bar->addAction (
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1589 QIcon (":/actions/icons/up.png"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1590 tr ("One directory up"));
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1591 QAction *current_dir_search = _main_tool_bar->addAction (
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1592 QIcon (":/actions/icons/search.png"),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1593 tr ("Browse directories"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1594
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1595 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
1596 this, SLOT (set_current_working_directory (QString)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1597
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1598 connect (_current_directory_combo_box->lineEdit (), SIGNAL (returnPressed ()),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1599 this, SLOT (accept_directory_line_edit ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1600
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1601 connect (current_dir_search, SIGNAL (triggered ()),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1602 this, SLOT (browse_for_directory ()));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1603
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
1604 connect (current_dir_up, SIGNAL (triggered ()),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1605 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
1606
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
1607 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
1608 this, SLOT (handle_undo_request ()));
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1609 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1610
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1611 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1612 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
1613 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1614 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
1615 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1616
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1617 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1618 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
1619 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1620 Fload (ovl (file));
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
1621
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
1622 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
1623 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1624
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1625 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1626 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
1627 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1628 Fclear ();
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1629 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1630
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1631 void
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1632 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
1633 {
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1634 /* 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
1635
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1636 // if (status)
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1637 octave_link::set_workspace (true, symbol_table::workspace_info ());
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1638
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1639 // else
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1640 // ; // 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
1641 }
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1642
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
1643 void
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
1644 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
1645 {
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
1646 command_editor::undo ();
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
1647 command_editor::redisplay ();
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
1648 }
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
1649
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
1650 void
16514
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
1651 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
1652 {
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
1653 Fclc ();
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
1654 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
1655 }
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
1656
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
1657 void
16541
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1658 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
1659 {
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1660 command_editor::resize_terminal ();
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1661 }
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1662
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
1663 void
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1664 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
1665 {
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
1666 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
1667 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1668
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1669 void
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1670 main_window::execute_command_callback ()
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1671 {
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1672 bool repost = false; // flag for reposting event for this callback
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1673
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1674 if (!_cmd_queue->isEmpty ()) // list can not be empty here, just to make sure
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1675 {
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1676 std::string pending_input = command_editor::get_current_line ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1677 command_editor::set_initial_input (pending_input);
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1678
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1679 _cmd_queue_mutex.lock (); // critical path
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1680 std::string command = _cmd_queue->takeFirst ().toStdString ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1681 if (_cmd_queue->isEmpty ())
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1682 _cmd_processing.release (); // cmd queue empty, processing will stop
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1683 else
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1684 repost = true; // not empty, repost at end
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1685 _cmd_queue_mutex.unlock ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1686
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1687 command_editor::replace_line (command);
16570
d5ae5aa80d42 preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents: 16566
diff changeset
1688
17329
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1689 command_editor::redisplay ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1690 // We are executing inside the command editor event loop. Force
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1691 // the current line to be returned for processing.
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1692 command_editor::interrupt ();
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1693 }
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1694
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1695 if (repost) // queue not empty, so repost event for further processing
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1696 octave_link::post_event (this, &main_window::execute_command_callback);
352b442a72a5 queue and synchronize mutliple commands executed fro history (bug #39723)
Torsten <ttl@justmail.de>
parents: 17117
diff changeset
1697
16635
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
1698 }
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
1699
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
1700 void
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1701 main_window::new_figure_callback (void)
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1702 {
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1703 Fbuiltin (ovl ("figure"));
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1704 Fdrawnow ();
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1705 }
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1706
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
1707 void
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1708 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
1709 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1710 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
1711 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1712
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1713 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1714 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
1715 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1716 Fdbcont ();
16397
649d0b75ec06 allow continue and quit debug buttons to work
John W. Eaton <jwe@octave.org>
parents: 16395
diff changeset
1717
649d0b75ec06 allow continue and quit debug buttons to work
John W. Eaton <jwe@octave.org>
parents: 16395
diff changeset
1718 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
1719 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1720
16382
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
1721 // 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
1722 // 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
1723 // 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
1724 // 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
1725 // 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
1726 // 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
1727
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1728 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1729 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
1730 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1731 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
1732
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
1733 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
1734 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1735
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1736 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1737 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
1738 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1739 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
1740
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
1741 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
1742 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1743
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1744 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1745 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
1746 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1747 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
1748
389b09a914e2 allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents: 16380
diff changeset
1749 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
1750 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1751
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1752 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1753 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
1754 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1755 Fdbquit ();
16397
649d0b75ec06 allow continue and quit debug buttons to work
John W. Eaton <jwe@octave.org>
parents: 16395
diff changeset
1756
649d0b75ec06 allow continue and quit debug buttons to work
John W. Eaton <jwe@octave.org>
parents: 16395
diff changeset
1757 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
1758 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1759
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1760 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1761 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
1762 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
1763 Fquit ();
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
1764 }
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1765
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1766 void
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1767 main_window::find_files (const QString &start_dir)
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1768 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1769
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1770 if (! find_files_dlg)
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1771 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1772 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
1773
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1774 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
1775 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
1776
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1777 connect (find_files_dlg, SIGNAL (dir_selected (const QString &)),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1778 file_browser_window,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1779 SLOT (set_current_directory (const QString&)));
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1780
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1781 connect (find_files_dlg, SIGNAL (file_selected (const QString &)),
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1782 this, SLOT (open_file (const QString &)));
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1783
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1784 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
1785 }
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1786
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1787 if (! find_files_dlg->isVisible ())
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1788 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1789 find_files_dlg->show ();
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1790 }
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1791
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1792 find_files_dlg->set_search_dir (start_dir);
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1793
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1794 find_files_dlg->activateWindow ();
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1795
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1796 }
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1797
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1798 void
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1799 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
1800 {
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1801
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1802 }
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
1803
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1804 void
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1805 main_window::set_global_shortcuts (bool set_shortcuts)
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1806 {
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1807 if (set_shortcuts)
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1808 {
16635
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
1809
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1810 _open_action->setShortcut (QKeySequence::Open);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1811 _new_script_action->setShortcut (QKeySequence::New);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1812
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1813 _exit_action->setShortcut (QKeySequence::Quit);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1814
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1815 _find_files_action->setShortcut (Qt::ControlModifier
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1816 + Qt::ShiftModifier
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1817 + Qt::Key_F);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1818
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1819 }
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1820 else
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1821 {
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1822
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1823 QKeySequence no_key = QKeySequence ();
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1824
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1825 _open_action->setShortcut (no_key);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1826 _new_script_action->setShortcut (no_key);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1827
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1828 _exit_action->setShortcut (no_key);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1829
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1830 _find_files_action->setShortcut (no_key);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1831
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1832 }
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1833
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1834 emit set_widget_shortcuts_signal (set_shortcuts);
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
1835 }
17029
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
1836
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
1837 void
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
1838 main_window::handle_show_doc (const QString& file)
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
1839 {
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
1840 doc_browser_window->setVisible (true);
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
1841 emit show_doc_signal (file);
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
1842 }
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
1843
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1844 void
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1845 main_window::clipboard_has_changed (QClipboard::Mode cp_mode)
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1846 {
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1847 if (cp_mode == QClipboard::Clipboard)
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1848 {
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1849 if (_clipboard->text ().isEmpty ())
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1850 {
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1851 _paste_action->setEnabled (false);
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1852 _clear_clipboard_action->setEnabled (false);
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1853 }
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1854 else
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1855 {
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1856 _paste_action->setEnabled (true);
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1857 _clear_clipboard_action->setEnabled (true);
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1858 }
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1859 }
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1860 }
17029
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
1861
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1862 void
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1863 main_window::clear_clipboard ()
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1864 {
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1865 _clipboard->clear (QClipboard::Clipboard);
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
1866 }