annotate libgui/src/main-window.cc @ 31771:21f9b34eb893

maint: Eliminate "(void)" in C++ function prototypes/declarations. * mk-opts.pl, external.txi, embedded.cc, make_int.cc, standalone.cc, standalonebuiltin.cc, BaseControl.cc, BaseControl.h, ButtonControl.cc, ButtonControl.h, ButtonGroup.cc, ButtonGroup.h, Canvas.cc, Canvas.h, CheckBoxControl.cc, CheckBoxControl.h, Container.cc, Container.h, ContextMenu.cc, ContextMenu.h, EditControl.cc, EditControl.h, Figure.cc, Figure.h, FigureWindow.cc, FigureWindow.h, GLCanvas.cc, GLCanvas.h, GenericEventNotify.h, KeyMap.cc, ListBoxControl.cc, ListBoxControl.h, Logger.cc, Logger.h, Menu.cc, Menu.h, MenuContainer.h, Object.cc, Object.h, ObjectProxy.cc, ObjectProxy.h, Panel.cc, Panel.h, PopupMenuControl.cc, PopupMenuControl.h, PushButtonControl.cc, PushButtonControl.h, PushTool.cc, PushTool.h, RadioButtonControl.cc, RadioButtonControl.h, SliderControl.cc, SliderControl.h, Table.cc, Table.h, TextControl.cc, TextControl.h, TextEdit.h, ToggleButtonControl.cc, ToggleButtonControl.h, ToggleTool.cc, ToggleTool.h, ToolBar.cc, ToolBar.h, ToolBarButton.cc, ToolBarButton.h, gl-select.cc, gl-select.h, qopengl-functions.h, qt-graphics-toolkit.h, qdialog.cpp, qfontdialog.cpp, qprintdialog_win.cpp, liboctgui-build-info.h, liboctgui-build-info.in.cc, color-picker.cc, color-picker.h, command-widget.cc, command-widget.h, community-news.cc, community-news.h, dialog.cc, dialog.h, documentation-bookmarks.cc, documentation-bookmarks.h, documentation-dock-widget.cc, documentation-dock-widget.h, documentation.cc, documentation.h, dw-main-window.cc, dw-main-window.h, external-editor-interface.cc, external-editor-interface.h, files-dock-widget.cc, files-dock-widget.h, find-files-dialog.cc, find-files-dialog.h, find-files-model.cc, find-files-model.h, gui-preferences.cc, gui-preferences.h, gui-settings.cc, gui-settings.h, history-dock-widget.cc, history-dock-widget.h, interpreter-qobject.cc, interpreter-qobject.h, file-editor-interface.h, file-editor-tab.cc, file-editor-tab.h, file-editor.cc, file-editor.h, find-dialog.cc, find-dialog.h, marker.cc, marker.h, octave-qscintilla.cc, octave-qscintilla.h, octave-txt-lexer.cc, octave-txt-lexer.h, main-window.cc, main-window.h, news-reader.cc, news-reader.h, octave-dock-widget.cc, octave-dock-widget.h, octave-qobject.cc, octave-qobject.h, qt-application.cc, qt-application.h, qt-interpreter-events.cc, qt-interpreter-events.h, release-notes.cc, release-notes.h, set-path-dialog.cc, set-path-dialog.h, set-path-model.cc, set-path-model.h, settings-dialog.cc, settings-dialog.h, shortcuts-tree-widget.cc, shortcuts-tree-widget.h, tab-bar.cc, tab-bar.h, terminal-dock-widget.cc, terminal-dock-widget.h, variable-editor-model.cc, variable-editor-model.h, variable-editor.cc, variable-editor.h, welcome-wizard.cc, welcome-wizard.h, workspace-model.cc, workspace-model.h, workspace-view.cc, workspace-view.h, build-env.h, Cell.cc, Cell.h, __contourc__.cc, __magick_read__.cc, auto-shlib.cc, auto-shlib.h, base-text-renderer.h, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h, call-stack.cc, call-stack.h, debug.cc, defaults.cc, defaults.h, defun.cc, display.cc, display.h, dynamic-ld.cc, dynamic-ld.h, environment.cc, environment.h, error.cc, error.h, errwarn.cc, errwarn.h, event-manager.cc, event-manager.h, event-queue.cc, event-queue.h, fcn-info.cc, fcn-info.h, ft-text-renderer.cc, ft-text-renderer.h, genprops.awk, gh-manager.cc, gh-manager.h, gl-render.cc, gl-render.h, gl2ps-print.cc, graphics-toolkit.h, graphics.cc, graphics.in.h, gtk-manager.cc, gtk-manager.h, help.cc, help.h, hook-fcn.h, input.cc, input.h, interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h, jsondecode.cc, latex-text-renderer.cc, latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h, ls-hdf5.cc, ls-hdf5.h, mxarray.h, oct-errno.h, oct-errno.in.cc, oct-fstrm.cc, oct-fstrm.h, oct-handle.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc, oct-iostrm.h, oct-map.cc, oct-map.h, oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h, oct-process.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.cc, oct-strstrm.h, oct-tex-lexer.in.ll, pager.cc, pager.h, pr-flt-fmt.cc, pr-flt-fmt.h, pr-output.cc, pr-output.h, procstream.cc, procstream.h, settings.cc, settings.h, sighandlers.cc, sighandlers.h, stack-frame.cc, stack-frame.h, svd.cc, syminfo.cc, syminfo.h, symrec.cc, symrec.h, symscope.cc, symscope.h, symtab.cc, symtab.h, sysdep.cc, sysdep.h, text-engine.cc, text-engine.h, text-renderer.cc, text-renderer.h, toplev.cc, url-handle-manager.cc, url-handle-manager.h, variables.cc, xpow.cc, __init_fltk__.cc, __init_gnuplot__.cc, __ode15__.cc, audiodevinfo.cc, gzip.cc, liboctinterp-build-info.h, liboctinterp-build-info.in.cc, mk-build-env-features.sh, mk-builtins.pl, cdef-class.cc, cdef-class.h, cdef-manager.h, cdef-method.cc, cdef-method.h, cdef-object.cc, cdef-object.h, cdef-package.cc, cdef-package.h, cdef-property.cc, cdef-property.h, cdef-utils.cc, cdef-utils.h, ov-base-diag.cc, ov-base-diag.h, ov-base-int.cc, ov-base-int.h, ov-base-mat.cc, ov-base-mat.h, ov-base-scalar.cc, ov-base-scalar.h, ov-base-sparse.cc, ov-base-sparse.h, ov-base.cc, ov-base.h, ov-bool-mat.cc, ov-bool-mat.h, ov-bool-sparse.cc, ov-bool-sparse.h, ov-bool.cc, ov-bool.h, ov-builtin.cc, ov-builtin.h, ov-cell.cc, ov-cell.h, ov-ch-mat.cc, ov-ch-mat.h, ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h, ov-colon.h, ov-complex.cc, ov-complex.h, ov-cs-list.h, ov-cx-diag.cc, ov-cx-diag.h, ov-cx-mat.cc, ov-cx-mat.h, ov-cx-sparse.cc, ov-cx-sparse.h, ov-dld-fcn.cc, ov-dld-fcn.h, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn.cc, ov-fcn.h, ov-float.cc, ov-float.h, ov-flt-complex.cc, ov-flt-complex.h, ov-flt-cx-diag.cc, ov-flt-cx-diag.h, ov-flt-cx-mat.cc, ov-flt-cx-mat.h, ov-flt-re-diag.cc, ov-flt-re-diag.h, ov-flt-re-mat.cc, ov-flt-re-mat.h, ov-intx.h, ov-java.cc, ov-java.h, ov-lazy-idx.cc, ov-lazy-idx.h, ov-legacy-range.cc, ov-legacy-range.h, ov-magic-int.cc, ov-magic-int.h, ov-mex-fcn.cc, ov-mex-fcn.h, ov-null-mat.cc, ov-null-mat.h, ov-oncleanup.cc, ov-oncleanup.h, ov-perm.cc, ov-perm.h, ov-range.cc, ov-range.h, ov-re-diag.cc, ov-re-diag.h, ov-re-mat.cc, ov-re-mat.h, ov-re-sparse.cc, ov-re-sparse.h, ov-scalar.cc, ov-scalar.h, ov-str-mat.cc, ov-str-mat.h, ov-struct.cc, ov-struct.h, ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, ovl.cc, ovl.h, octave.cc, octave.h, anon-fcn-validator.h, bp-table.cc, bp-table.h, comment-list.cc, comment-list.h, filepos.h, lex.h, lex.ll, oct-lvalue.cc, oct-lvalue.h, oct-parse.yy, parse.h, profiler.cc, profiler.h, pt-anon-scopes.h, pt-arg-list.cc, pt-arg-list.h, pt-args-block.cc, pt-args-block.h, pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h, pt-binop.cc, pt-binop.h, pt-bp.h, pt-cbinop.h, pt-cell.h, pt-check.h, pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-colon.h, pt-const.h, pt-decl.cc, pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.cc, pt-except.h, pt-exp.cc, pt-exp.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-id.cc, pt-id.h, pt-idx.cc, pt-idx.h, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.h, pt-misc.cc, pt-misc.h, pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-spmd.cc, pt-spmd.h, pt-stmt.cc, pt-stmt.h, pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-walk.h, pt.cc, pt.h, token.cc, token.h, usage.h, Array-base.cc, Array.h, CColVector.cc, CColVector.h, CDiagMatrix.cc, CDiagMatrix.h, CMatrix.cc, CMatrix.h, CNDArray.cc, CNDArray.h, CRowVector.cc, CRowVector.h, CSparse.cc, CSparse.h, DiagArray2.cc, DiagArray2.h, MArray.cc, MArray.h, MDiagArray2.h, MSparse.h, MatrixType.cc, MatrixType.h, PermMatrix.cc, PermMatrix.h, Range.cc, Range.h, Sparse-b.cc, Sparse.cc, Sparse.h, boolMatrix.cc, boolMatrix.h, boolNDArray.cc, boolNDArray.h, boolSparse.cc, boolSparse.h, chMatrix.h, chNDArray.h, dColVector.cc, dColVector.h, dDiagMatrix.cc, dDiagMatrix.h, dMatrix.cc, dMatrix.h, dNDArray.cc, dNDArray.h, dRowVector.cc, dRowVector.h, dSparse.cc, dSparse.h, dim-vector.cc, dim-vector.h, fCColVector.cc, fCColVector.h, fCDiagMatrix.cc, fCDiagMatrix.h, fCMatrix.cc, fCMatrix.h, fCNDArray.cc, fCNDArray.h, fCRowVector.cc, fCRowVector.h, fColVector.cc, fColVector.h, fDiagMatrix.cc, fDiagMatrix.h, fMatrix.cc, fMatrix.h, fNDArray.cc, fNDArray.h, fRowVector.cc, fRowVector.h, idx-vector.cc, idx-vector.h, intNDArray.cc, intNDArray.h, liboctave-build-info.h, liboctave-build-info.in.cc, CollocWt.cc, CollocWt.h, DAE.h, DAEFunc.h, DAERT.h, DAERTFunc.h, DASPK.cc, DASPK.h, DASRT.cc, DASRT.h, DASSL.cc, DASSL.h, DET.h, EIG.h, LSODE.cc, LSODE.h, ODE.h, ODEFunc.h, ODES.h, ODESFunc.h, Quad.h, aepbalance.cc, aepbalance.h, base-dae.h, base-de.h, chol.cc, chol.h, eigs-base.cc, fEIG.h, gepbalance.h, gsvd.cc, gsvd.h, hess.h, lu.cc, lu.h, oct-fftw.cc, oct-fftw.h, oct-rand.cc, oct-rand.h, oct-spparms.cc, oct-spparms.h, qr.cc, qr.h, qrp.cc, qrp.h, randmtzig.cc, randmtzig.h, schur.h, sparse-chol.cc, sparse-chol.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc, sparse-qr.h, svd.cc, svd.h, child-list.cc, child-list.h, dir-ops.cc, dir-ops.h, file-ops.cc, file-ops.h, file-stat.cc, file-stat.h, lo-sysdep.cc, lo-sysdep.h, lo-sysinfo.cc, lo-sysinfo.h, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h, oct-group.cc, oct-group.h, oct-password.cc, oct-password.h, oct-syscalls.cc, oct-syscalls.h, oct-time.cc, oct-time.h, oct-uname.cc, oct-uname.h, action-container.h, base-list.h, caseless-str.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, data-conv.cc, file-info.h, glob-match.cc, glob-match.h, kpse.cc, kpse.h, lo-array-errwarn.cc, lo-array-errwarn.h, lo-hash.cc, lo-hash.h, lo-ieee.cc, lo-ieee.h, lo-regexp.cc, lo-regexp.h, oct-inttypes.cc, oct-inttypes.h, oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-shlib.cc, oct-shlib.h, oct-sort.cc, oct-sort.h, oct-sparse.cc, octave-preserve-stream-state.h, pathsearch.cc, pathsearch.h, quit.cc, singleton-cleanup.cc, singleton-cleanup.h, str-vec.cc, str-vec.h, unwind-prot.cc, unwind-prot.h, url-transfer.cc, url-transfer.h, version.cc, version.in.h, cxx-signal-helpers.cc, acinclude.m4, main-cli.cc, main-gui.cc, main.in.cc, mkoctfile.in.cc, octave-build-info.h, octave-build-info.in.cc, octave-config.in.cc, octave-svgconvert.cc, shared-fcns.h: maint: Eliminate "(void)" in C++ function prototypes/declarations.
author Rik <rik@octave.org>
date Tue, 24 Jan 2023 17:19:44 -0800
parents 90a741992f3f
children 2891372cce9f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
31706
597f3ee61a48 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 31648
diff changeset
3 // Copyright (C) 2011-2023 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
25
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21670
diff changeset
26 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21203
diff changeset
27 # include "config.h"
15286
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15274
diff changeset
28 #endif
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15274
diff changeset
29
27412
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27409
diff changeset
30 #include <utility>
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27409
diff changeset
31
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27409
diff changeset
32 #include <QAction>
15257
7ee62f559a73 Fix compilation under Windows with GUI and LLVM enabled.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15204
diff changeset
33 #include <QApplication>
27648
2952471e29a7 eliminate global access to resource_manager in qterminal widget
John W. Eaton <jwe@octave.org>
parents: 27631
diff changeset
34 #include <QClipboard>
27412
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27409
diff changeset
35 #include <QDateTime>
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27409
diff changeset
36 #include <QDebug>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
37 #include <QDesktopServices>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
38 #include <QFileDialog>
27412
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27409
diff changeset
39 #include <QIcon>
23385
41639665aa34 improve opening files from gui when built without qscintilla (bug #39179)
Torsten <mttl@mailbox.org>
parents: 23380
diff changeset
40 #include <QInputDialog>
27412
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27409
diff changeset
41 #include <QKeySequence>
15257
7ee62f559a73 Fix compilation under Windows with GUI and LLVM enabled.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15204
diff changeset
42 #include <QLabel>
27412
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27409
diff changeset
43 #include <QMenu>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
44 #include <QMenuBar>
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
45 #include <QMessageBox>
30639
6ad5bb8f6a6d fix masimized start on systems with two monitors (bug #61172)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30564
diff changeset
46 #include <QScreen>
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
47 #include <QStyle>
25956
2201f82db233 Add missing QStyleFactory header (Bug #54881)
John Donoghue
parents: 25944
diff changeset
48 #include <QStyleFactory>
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents: 25024
diff changeset
49 #include <QTextBrowser>
17764
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
50 #include <QTextStream>
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
51 #include <QThread>
21439
912b8828193b * main-window.cc: include QTimer header file
Mike Miller <mtmiller@octave.org>
parents: 21428
diff changeset
52 #include <QTimer>
27412
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27409
diff changeset
53 #include <QToolBar>
30639
6ad5bb8f6a6d fix masimized start on systems with two monitors (bug #61172)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30564
diff changeset
54 #include <QWindow>
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
55
29787
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
56 // QTerminal includes
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
57 #include "QTerminal.h"
b4d2fa28d1d4 allow terminal window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29786
diff changeset
58
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21670
diff changeset
59 #if defined (HAVE_QSCINTILLA)
21203
710e700cdd7f maint: Clean up naming and indentation of #ifdef blocks in libgui
Rik <rik@octave.org>
parents: 21158
diff changeset
60 # include "file-editor.h"
31222
1a0756f7c90a disable experimental terminal widget when building without qscintilla
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31188
diff changeset
61 # include "command-widget.h"
16290
d07aeecb2d22 build: Add more #ifdefs to build GUI when Qscintilla is not present.
Rik <rik@octave.org>
parents: 16176
diff changeset
62 #endif
27664
bd7decacf32e avoid unnecessary includes of gui-preference header files
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27653
diff changeset
63 #include "gui-preferences-cs.h"
27665
a1271c5b621a replace preference literals by symbolic constants for dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27664
diff changeset
64 #include "gui-preferences-dw.h"
27560
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents: 27556
diff changeset
65 #include "gui-preferences-ed.h"
27671
61883a1a80a1 don't include gui-preferences-global.h in gui-preferences.h
John W. Eaton <jwe@octave.org>
parents: 27669
diff changeset
66 #include "gui-preferences-global.h"
27412
da1f59fe04b3 try to use consitent ordering for include files in libgui sources
John W. Eaton <jwe@octave.org>
parents: 27409
diff changeset
67 #include "gui-preferences-mw.h"
27613
deb8877f2c34 use symbolic constants for preferences key and default values in news reader
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27611
diff changeset
68 #include "gui-preferences-nr.h"
27818
fa0582694fda replace literal strings by symbolic constants for shortcut preferences
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27805
diff changeset
69 #include "gui-preferences-sc.h"
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents: 27602
diff changeset
70 #include "gui-settings.h"
31006
35d37e433532 replace use of depreciated QDesktopWidget in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30743
diff changeset
71 #include "gui-utils.h"
27196
d993642352d0 rename octave_interpreter object in GUI
John W. Eaton <jwe@octave.org>
parents: 27194
diff changeset
72 #include "interpreter-qobject.h"
14707
674740c44c09 Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14703
diff changeset
73 #include "main-window.h"
27193
01e73e1664ff move news reader widget to separate file
John W. Eaton <jwe@octave.org>
parents: 27118
diff changeset
74 #include "news-reader.h"
27197
b8c0d5ad024f refactor and rename some qt application objects
John W. Eaton <jwe@octave.org>
parents: 27196
diff changeset
75 #include "octave-qobject.h"
14707
674740c44c09 Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14703
diff changeset
76 #include "settings-dialog.h"
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
77 #include "welcome-wizard.h"
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
78
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
79 #include "cmd-edit.h"
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
80 #include "oct-env.h"
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
81 #include "url-transfer.h"
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
82
19893
67cb2f421255 restore include statement removed in changeset c7c50030e76c
John W. Eaton <jwe@octave.org>
parents: 19882
diff changeset
83 #include "builtin-defun-decls.h"
25460
627d6bde9b8d solve installation info initialization problem differently
John W. Eaton <jwe@octave.org>
parents: 25440
diff changeset
84 #include "defaults.h"
23773
5ff24576b783 defer installing qt graphics toolkit until interpreter is ready
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
85 #include "interpreter.h"
27396
930c0fbc003b move qt_interpreter_events::file_in_path to load_path::contains_file_in_dir
John W. Eaton <jwe@octave.org>
parents: 27393
diff changeset
86 #include "load-path.h"
29820
fc8571a37d21 main-window.cc: eliminate unneeded header files
John W. Eaton <jwe@octave.org>
parents: 29796
diff changeset
87 #include "utils.h"
26117
a6df420457ac use symbol_info_list instead of symbol_scope to pass workspace info to gui
John W. Eaton <jwe@octave.org>
parents: 26115
diff changeset
88 #include "syminfo.h"
15404
f52a62a6db3a eliminate copy and paste copyright info in GUI about info box
John W. Eaton <jwe@octave.org>
parents: 15402
diff changeset
89 #include "version.h"
23380
c319e6d737f2 Backed out changeset 7332287221a9
Torsten <mttl@mailbox.org>
parents: 23379
diff changeset
90
31646
c6d54dd31a7e maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
91 OCTAVE_BEGIN_NAMESPACE(octave)
c6d54dd31a7e maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
92
27588
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
93 main_window::main_window (base_qobject& oct_qobj)
27620
45bb5bbaf291 don't use singleton pattern for resource manager in GUI
John W. Eaton <jwe@octave.org>
parents: 27613
diff changeset
94 : QMainWindow (), m_octave_qobj (oct_qobj),
29613
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29612
diff changeset
95 m_status_bar (nullptr),
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29612
diff changeset
96 m_command_window (nullptr),
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29612
diff changeset
97 m_history_window (nullptr),
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29612
diff changeset
98 m_file_browser_window (nullptr),
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29612
diff changeset
99 m_editor_window (nullptr),
9367cba2a6d5 allow most dock widgets to be used from command line
John W. Eaton <jwe@octave.org>
parents: 29612
diff changeset
100 m_workspace_window (nullptr),
31639
ca7d58406f82 eliminate unnecessary uses of octave_qobject in GUI classes
John W. Eaton <jwe@octave.org>
parents: 31638
diff changeset
101 m_external_editor (new external_editor_interface (this)),
27298
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents: 27287
diff changeset
102 m_active_editor (m_external_editor), m_settings_dlg (nullptr),
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents: 27287
diff changeset
103 m_find_files_dlg (nullptr), m_set_path_dlg (nullptr),
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
104 m_clipboard (QApplication::clipboard ()),
29084
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
105 m_prevent_readline_conflicts (true),
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
106 m_prevent_readline_conflicts_menu (false),
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
107 m_suppress_dbg_location (true),
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
108 m_closing (false), m_file_encoding (QString ())
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
109 {
31638
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31621
diff changeset
110 gui_settings settings;
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31621
diff changeset
111
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
112 if (! settings.bool_value (global_skip_welcome_wizard))
25938
6fec0e305268 Backed out changeset 2ab0a9b66388
John W. Eaton <jwe@octave.org>
parents: 25937
diff changeset
113 {
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
114 // Before wizard.
27588
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
115 m_octave_qobj.config_translators ();
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
116
31639
ca7d58406f82 eliminate unnecessary uses of octave_qobject in GUI classes
John W. Eaton <jwe@octave.org>
parents: 31638
diff changeset
117 welcome_wizard welcomeWizard;
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
118
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
119 if (welcomeWizard.exec () == QDialog::Rejected)
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
120 exit (1);
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
121
31702
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
122 settings.setValue (global_skip_welcome_wizard.settings_key (), QVariant (true));
31638
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31621
diff changeset
123
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
124 // Install settings file.
31638
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31621
diff changeset
125 settings.reload ();
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
126 }
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
127 else
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
128 {
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
129 // Get settings file.
31638
474e184321d3 move some functions from resource_manager to gui_settings
John W. Eaton <jwe@octave.org>
parents: 31621
diff changeset
130 settings.reload ();
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
131
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
132 // After settings.
27588
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
133 m_octave_qobj.config_translators ();
25938
6fec0e305268 Backed out changeset 2ab0a9b66388
John W. Eaton <jwe@octave.org>
parents: 25937
diff changeset
134 }
6fec0e305268 Backed out changeset 2ab0a9b66388
John W. Eaton <jwe@octave.org>
parents: 25937
diff changeset
135
29895
744bb06fea2a avoid connecting non existing signals from variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29853
diff changeset
136 setObjectName (gui_obj_name_main_window);
744bb06fea2a avoid connecting non existing signals from variable editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29853
diff changeset
137
31621
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31619
diff changeset
138 settings.config_icon_theme ();
30772
36dc11ee220d reorganize GUIs icons
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30745
diff changeset
139
31690
1a1f47f17ed4 eliminate resource_manager class
John W. Eaton <jwe@octave.org>
parents: 31649
diff changeset
140 settings.update_network_settings ();
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
141
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
142 // We provide specific terminal capabilities, so ensure that
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
143 // TERM is always set appropriately.
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
144
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
145 #if defined (OCTAVE_USE_WINDOWS_API)
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
146 sys::env::putenv ("TERM", "cygwin");
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
147 #else
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
148 sys::env::putenv ("TERM", "xterm");
25046
a4c687fec320 gui: set Qt Application and Desktop metadata for desktop integration (bug #53102)
Mike Miller <mtmiller@octave.org>
parents: 25042
diff changeset
149 #endif
a4c687fec320 gui: set Qt Application and Desktop metadata for desktop integration (bug #53102)
Mike Miller <mtmiller@octave.org>
parents: 25042
diff changeset
150
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
151 construct_central_widget ();
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
152
29133
0d8e5f890a9b where possible, allow Qt widgets to delete their children
John W. Eaton <jwe@octave.org>
parents: 29096
diff changeset
153 m_status_bar = new QStatusBar (this);
29061
8a425e771aa7 use a led like indicator for the prfiler state
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29057
diff changeset
154 m_profiler_status_indicator = new led_indicator ();
8a425e771aa7 use a led like indicator for the prfiler state
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29057
diff changeset
155 QLabel *text = new QLabel (tr ("Profiler"));
8a425e771aa7 use a led like indicator for the prfiler state
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29057
diff changeset
156 m_status_bar->addPermanentWidget (text);
29040
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
157 m_status_bar->addPermanentWidget (m_profiler_status_indicator);
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
158
29788
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
159 adopt_dock_widgets ();
29612
9c04fea333ca avoid connecting to parent slots in octave_dock_widget
John W. Eaton <jwe@octave.org>
parents: 29611
diff changeset
160
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
161 QGuiApplication::setDesktopFileName ("org.octave.Octave.desktop");
25938
6fec0e305268 Backed out changeset 2ab0a9b66388
John W. Eaton <jwe@octave.org>
parents: 25937
diff changeset
162
27218
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27209
diff changeset
163 QApplication *qapp = m_octave_qobj.qapplication ();
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27209
diff changeset
164
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27209
diff changeset
165 m_default_style = qapp->style ()->objectName ();
30965
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
166 m_default_palette = qapp->palette ();
26227
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26117
diff changeset
167
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
168 bool connect_to_web = true;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
169 QDateTime last_checked;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
170 int serial = 0;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
171 m_active_dock = nullptr;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
172
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
173 connect_to_web = settings.bool_value (nr_allow_connection);
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
174 last_checked = settings.date_time_value (nr_last_time);
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
175 serial = settings.int_value (nr_last_news);
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
176 m_default_encoding = settings.string_value (ed_default_enc);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
177
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
178 QDateTime current = QDateTime::currentDateTime ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
179 QDateTime one_day_ago = current.addDays (-1);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
180
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
181 if (connect_to_web
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
182 && (! last_checked.isValid () || one_day_ago > last_checked))
29835
a946d742fb97 allow community news window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29834
diff changeset
183 emit show_community_news_signal (serial);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
184
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
185 construct_octave_qt_link ();
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
186
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
187 // We have to set up all our windows, before we finally launch
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
188 // octave.
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
189
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
190 construct ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
191
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
192 read_settings ();
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
193
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
194 init_terminal_size ();
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
195
29199
0b18887bc997 simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29148
diff changeset
196 emit init_window_menu ();
0b18887bc997 simplify initialization of gui dock widgets
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29148
diff changeset
197
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
198 focus_command_window ();
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
199 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
200
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
201 main_window::~main_window () { }
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
202
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
203 void main_window::adopt_dock_widgets ()
29788
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
204 {
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
205 adopt_terminal_widget ();
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
206 adopt_documentation_widget ();
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
207 adopt_file_browser_widget ();
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
208 adopt_history_widget ();
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
209 adopt_workspace_widget ();
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
210 adopt_editor_widget ();
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
211 adopt_variable_editor_widget ();
29796
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
212
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
213 m_previous_dock = m_command_window;
29788
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
214 }
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
215
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
216 void main_window::adopt_terminal_widget ()
29788
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
217 {
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
218 m_command_window = m_octave_qobj.terminal_widget (this);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
219
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
220 make_dock_widget_connections (m_command_window);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
221
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
222 connect (this, &main_window::settings_changed,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
223 m_command_window, &terminal_dock_widget::notice_settings);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
224
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
225 if (! m_octave_qobj.experimental_terminal_widget ())
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
226 {
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
227 QTerminal *cmd_widget = m_command_window->get_qterminal ();
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
228
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
229 // The following connections were previously made in
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
230 // QTerminal::construct, QWinTerminalImpl::QWinTerminalImpl, and
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
231 // QUnixTerminalImpl::QUnixTerminalImpl. Similar actions should
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
232 // probably be possible for the new command widget.
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
233
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
234 connect (cmd_widget, &QTerminal::report_status_message,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
235 this, &main_window::report_status_message);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
236
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
237 connect (cmd_widget, &QTerminal::edit_mfile_request,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
238 this, &main_window::edit_mfile);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
239
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
240 connect (cmd_widget, &QTerminal::execute_command_in_terminal_signal,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
241 this, &main_window::execute_command_in_terminal);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
242
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
243 connect (this, &main_window::init_terminal_size_signal,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
244 cmd_widget, &QTerminal::init_terminal_size);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
245
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
246 connect (this, &main_window::copyClipboard_signal,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
247 cmd_widget, &QTerminal::copyClipboard);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
248
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
249 connect (this, &main_window::pasteClipboard_signal,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
250 cmd_widget, &QTerminal::pasteClipboard);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
251
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
252 connect (this, &main_window::selectAll_signal,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
253 cmd_widget, &QTerminal::selectAll);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
254
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
255 connect (cmd_widget, &QTerminal::request_edit_mfile_signal,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
256 this, &main_window::edit_mfile);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
257
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
258 connect (cmd_widget, &QTerminal::request_open_file_signal,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
259 this, QOverload<const QString&, const QString&, int>::of (&main_window::open_file_signal));
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
260
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
261 connect (cmd_widget, &QTerminal::set_screen_size_signal,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
262 this, &main_window::set_screen_size);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
263
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
264 connect (cmd_widget, &QTerminal::clear_command_window_request,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
265 this, &main_window::handle_clear_command_window_request);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
266 }
31068
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
267 else
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
268 {
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
269 connect (this, &main_window::execute_command_signal,
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
270 m_command_window, &terminal_dock_widget::execute_command_signal);
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
271 }
29788
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
272 }
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
273
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
274 void main_window::adopt_documentation_widget ()
29788
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
275 {
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
276 m_doc_browser_window = m_octave_qobj.documentation_widget (this);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
277
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
278 make_dock_widget_connections (m_doc_browser_window);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
279 }
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
280
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
281 void main_window::adopt_file_browser_widget ()
29788
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
282 {
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
283 m_file_browser_window = m_octave_qobj.file_browser_widget (this);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
284
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
285 make_dock_widget_connections (m_file_browser_window);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
286
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
287 connect (m_file_browser_window, &files_dock_widget::open_file,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
288 this, QOverload<const QString&>::of (&main_window::open_file_signal));
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
289 connect (m_file_browser_window,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
290 &files_dock_widget::displayed_directory_changed,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
291 this, &main_window::set_current_working_directory);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
292
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
293 connect (m_file_browser_window, &files_dock_widget::modify_path_signal,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
294 this, &main_window::modify_path);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
295
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
296 connect (m_file_browser_window, &files_dock_widget::run_file_signal,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
297 this, &main_window::run_file_in_terminal);
29796
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
298
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
299 connect (m_file_browser_window, &files_dock_widget::load_file_signal,
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
300 this, &main_window::handle_load_workspace_request);
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
301
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
302 connect (m_file_browser_window, &files_dock_widget::open_any_signal,
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
303 this, &main_window::handle_open_any_request);
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
304
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
305 connect (m_file_browser_window, &files_dock_widget::find_files_signal,
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
306 this, &main_window::find_files);
29788
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
307 }
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
308
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
309 void main_window::adopt_history_widget ()
29788
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
310 {
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
311 m_history_window = m_octave_qobj.history_widget (this);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
312
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
313 make_dock_widget_connections (m_history_window);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
314
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
315 connect (m_history_window, &history_dock_widget::command_create_script,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
316 this, &main_window::new_file_signal);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
317
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
318 connect (m_history_window, &history_dock_widget::command_double_clicked,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
319 this, &main_window::execute_command_in_terminal);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
320 }
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
321
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
322 void main_window::adopt_workspace_widget ()
29788
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
323 {
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
324 m_workspace_window = m_octave_qobj.workspace_widget (this);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
325
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
326 make_dock_widget_connections (m_workspace_window);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
327
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
328 connect (m_workspace_window, &workspace_view::command_requested,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
329 this, &main_window::execute_command_in_terminal);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
330 }
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
331
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
332 void main_window::adopt_editor_widget ()
29788
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
333 {
29853
b918ef934b71 allow building without QScintilla to work again (bug #60879)
John W. Eaton <jwe@octave.org>
parents: 29836
diff changeset
334 interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj ();
b918ef934b71 allow building without QScintilla to work again (bug #60879)
John W. Eaton <jwe@octave.org>
parents: 29836
diff changeset
335
b918ef934b71 allow building without QScintilla to work again (bug #60879)
John W. Eaton <jwe@octave.org>
parents: 29836
diff changeset
336 qt_interpreter_events *qt_link = interp_qobj->qt_link ();
b918ef934b71 allow building without QScintilla to work again (bug #60879)
John W. Eaton <jwe@octave.org>
parents: 29836
diff changeset
337
29788
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
338 #if defined (HAVE_QSCINTILLA)
31701
286306a9a393 eliminate base_qobject from octave_dock_widget and other classes
John W. Eaton <jwe@octave.org>
parents: 31699
diff changeset
339 file_editor *editor = new file_editor (this);
29788
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
340
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
341 make_dock_widget_connections (editor);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
342
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
343 // The editor is currently different from other dock widgets. Until
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
344 // those differences are resolved, make interpreter_event
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
345 // connections here instead of in base_qobject::editor_widget.
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
346 m_octave_qobj.connect_interpreter_events (editor);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
347
31699
ca3e6e324d54 use signal/slot connection for debugging tooltips in editor
John W. Eaton <jwe@octave.org>
parents: 31696
diff changeset
348 connect (editor, &file_editor::show_symbol_tooltip_signal,
ca3e6e324d54 use signal/slot connection for debugging tooltips in editor
John W. Eaton <jwe@octave.org>
parents: 31696
diff changeset
349 m_octave_qobj.get_workspace_model (),
ca3e6e324d54 use signal/slot connection for debugging tooltips in editor
John W. Eaton <jwe@octave.org>
parents: 31696
diff changeset
350 &workspace_model::show_symbol_tooltip);
ca3e6e324d54 use signal/slot connection for debugging tooltips in editor
John W. Eaton <jwe@octave.org>
parents: 31696
diff changeset
351
29788
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
352 connect (editor, &file_editor::request_settings_dialog,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
353 this, QOverload<const QString&>::of (&main_window::process_settings_dialog_request));
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
354
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
355 connect (editor, &file_editor::request_dbcont_signal,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
356 this, &main_window::debug_continue);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
357
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
358 connect (this, &main_window::update_gui_lexer_signal,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
359 editor, &file_editor::update_gui_lexer_signal);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
360
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
361 connect (editor, &file_editor::execute_command_in_terminal_signal,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
362 this, &main_window::execute_command_in_terminal);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
363
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
364 connect (editor, &file_editor::focus_console_after_command_signal,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
365 this, &main_window::focus_console_after_command);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
366
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
367 connect (editor, &file_editor::run_file_signal,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
368 this, &main_window::run_file_in_terminal);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
369
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
370 connect (editor, &file_editor::edit_mfile_request,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
371 this, &main_window::handle_edit_mfile_request);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
372
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
373 connect (editor, &file_editor::debug_quit_signal,
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
374 this, &main_window::debug_quit);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
375
29796
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
376 connect (this, &main_window::editor_focus_changed,
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
377 editor, &file_editor::enable_menu_shortcuts);
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
378
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
379 connect (this, &main_window::step_into_file_signal,
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
380 editor, &file_editor::request_step_into_file);
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
381
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
382 connect (editor, &file_editor::editor_tabs_changed_signal,
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
383 this, &main_window::editor_tabs_changed);
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
384
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
385 connect (editor, &file_editor::request_open_file_external,
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
386 m_external_editor, &external_editor_interface::call_custom_editor);
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
387
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
388 connect (m_external_editor, &external_editor_interface::request_settings_dialog,
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
389 this, &main_window::process_settings_dialog_request);
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
390
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
391 connect (this, &main_window::insert_debugger_pointer_signal,
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
392 editor, &file_editor::handle_insert_debugger_pointer_request);
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
393
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
394 connect (this, &main_window::delete_debugger_pointer_signal,
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
395 editor, &file_editor::handle_delete_debugger_pointer_request);
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
396
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
397 connect (this, &main_window::update_breakpoint_marker_signal,
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
398 editor, &file_editor::handle_update_breakpoint_marker_request);
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
399
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
400 // Signals for removing/renaming files/dirs in the file browser
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
401 connect (m_file_browser_window, &files_dock_widget::file_remove_signal,
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
402 editor, &file_editor::handle_file_remove);
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
403
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
404 connect (m_file_browser_window, &files_dock_widget::file_renamed_signal,
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
405 editor, &file_editor::handle_file_renamed);
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
406
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
407 // Signals for removing/renaming files/dirs in the terminal window
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
408 connect (qt_link, &qt_interpreter_events::file_renamed_signal,
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
409 editor, &file_editor::handle_file_renamed);
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
410
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
411 // Signals for entering/exiting debug mode
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
412 connect (qt_link, &qt_interpreter_events::enter_debugger_signal,
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
413 editor, &file_editor::handle_enter_debug_mode);
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
414
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
415 connect (qt_link, &qt_interpreter_events::exit_debugger_signal,
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
416 editor, &file_editor::handle_exit_debug_mode);
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
417
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
418 connect (qt_link, &qt_interpreter_events::directory_changed_signal,
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
419 editor, &file_editor::update_octave_directory);
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
420
29788
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
421 m_editor_window = editor;
29796
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
422
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
423 m_editor_menubar = m_editor_window->menubar ();
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
424
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
425 m_active_editor = m_editor_window;
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
426
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
427 m_editor_window->enable_menu_shortcuts (false);
29788
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
428 #else
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
429 m_editor_window = nullptr;
29796
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
430
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
431 m_editor_menubar = nullptr;
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
432
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
433 m_active_editor = m_external_editor;
29788
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
434 #endif
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
435
29796
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
436 connect (qt_link, SIGNAL (edit_file_signal (const QString&)),
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
437 m_active_editor, SLOT (handle_edit_file_request (const QString&)));
29788
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
438 }
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
439
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
440 void main_window::adopt_variable_editor_widget ()
29788
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
441 {
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
442 m_variable_editor_window = m_octave_qobj.variable_editor_widget (this);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
443
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
444 make_dock_widget_connections (m_variable_editor_window);
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
445 }
74d5cf382b86 refactor adoption of dock widgets in main window for clarity
John W. Eaton <jwe@octave.org>
parents: 29787
diff changeset
446
29612
9c04fea333ca avoid connecting to parent slots in octave_dock_widget
John W. Eaton <jwe@octave.org>
parents: 29611
diff changeset
447 void main_window::make_dock_widget_connections (octave_dock_widget *dw)
9c04fea333ca avoid connecting to parent slots in octave_dock_widget
John W. Eaton <jwe@octave.org>
parents: 29611
diff changeset
448 {
9c04fea333ca avoid connecting to parent slots in octave_dock_widget
John W. Eaton <jwe@octave.org>
parents: 29611
diff changeset
449 connect (this, &main_window::init_window_menu,
9c04fea333ca avoid connecting to parent slots in octave_dock_widget
John W. Eaton <jwe@octave.org>
parents: 29611
diff changeset
450 dw, &octave_dock_widget::init_window_menu_entry);
9c04fea333ca avoid connecting to parent slots in octave_dock_widget
John W. Eaton <jwe@octave.org>
parents: 29611
diff changeset
451
9c04fea333ca avoid connecting to parent slots in octave_dock_widget
John W. Eaton <jwe@octave.org>
parents: 29611
diff changeset
452 connect (this, &main_window::settings_changed,
9c04fea333ca avoid connecting to parent slots in octave_dock_widget
John W. Eaton <jwe@octave.org>
parents: 29611
diff changeset
453 dw, &octave_dock_widget::handle_settings);
9c04fea333ca avoid connecting to parent slots in octave_dock_widget
John W. Eaton <jwe@octave.org>
parents: 29611
diff changeset
454
9c04fea333ca avoid connecting to parent slots in octave_dock_widget
John W. Eaton <jwe@octave.org>
parents: 29611
diff changeset
455 connect (this, &main_window::active_dock_changed,
9c04fea333ca avoid connecting to parent slots in octave_dock_widget
John W. Eaton <jwe@octave.org>
parents: 29611
diff changeset
456 dw, &octave_dock_widget::handle_active_dock_changed);
29796
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
457
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
458 // FIXME: shouldn't this action should be associated with closing
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
459 // the main window, not with exiting the application? At one time,
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
460 // those two actions happened together, but now it is possible to
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
461 // close the main window without exiting the application.
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
462 connect (qApp, &QApplication::aboutToQuit,
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
463 dw, &octave_dock_widget::save_settings);
30722
0a082e1b7422 fix saving dock widget settings with exp. terminal widget (bug #61996)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30639
diff changeset
464
0a082e1b7422 fix saving dock widget settings with exp. terminal widget (bug #61996)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30639
diff changeset
465 // The following is required when the exp. terminal widget is used
0a082e1b7422 fix saving dock widget settings with exp. terminal widget (bug #61996)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30639
diff changeset
466 // and the main window is closed (no exit via interpreter)
0a082e1b7422 fix saving dock widget settings with exp. terminal widget (bug #61996)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30639
diff changeset
467 connect (this, &main_window::close_gui_signal,
0a082e1b7422 fix saving dock widget settings with exp. terminal widget (bug #61996)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30639
diff changeset
468 dw, &octave_dock_widget::save_settings);
29612
9c04fea333ca avoid connecting to parent slots in octave_dock_widget
John W. Eaton <jwe@octave.org>
parents: 29611
diff changeset
469 }
9c04fea333ca avoid connecting to parent slots in octave_dock_widget
John W. Eaton <jwe@octave.org>
parents: 29611
diff changeset
470
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
471 bool main_window::command_window_has_focus () const
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
472 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
473 return m_command_window->has_focus ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
474 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
475
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
476 void main_window::focus_command_window ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
477 {
27281
0915fec3d3a9 prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27277
diff changeset
478 m_command_window->activate ();
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
479 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
480
27669
271b5cd640d7 Add functions to show GUI windows (bug #57213)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27665
diff changeset
481 void main_window::focus_window (const QString& win_name)
271b5cd640d7 Add functions to show GUI windows (bug #57213)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27665
diff changeset
482 {
271b5cd640d7 Add functions to show GUI windows (bug #57213)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27665
diff changeset
483 if (win_name == "command")
271b5cd640d7 Add functions to show GUI windows (bug #57213)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27665
diff changeset
484 m_command_window->activate ();
271b5cd640d7 Add functions to show GUI windows (bug #57213)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27665
diff changeset
485 else if (win_name == "history")
271b5cd640d7 Add functions to show GUI windows (bug #57213)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27665
diff changeset
486 m_history_window->activate ();
271b5cd640d7 Add functions to show GUI windows (bug #57213)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27665
diff changeset
487 else if (win_name == "workspace")
271b5cd640d7 Add functions to show GUI windows (bug #57213)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27665
diff changeset
488 m_workspace_window->activate ();
271b5cd640d7 Add functions to show GUI windows (bug #57213)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27665
diff changeset
489 else if (win_name == "filebrowser")
271b5cd640d7 Add functions to show GUI windows (bug #57213)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27665
diff changeset
490 m_file_browser_window->activate ();
271b5cd640d7 Add functions to show GUI windows (bug #57213)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27665
diff changeset
491 }
271b5cd640d7 Add functions to show GUI windows (bug #57213)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27665
diff changeset
492
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
493 bool main_window::confirm_shutdown ()
27588
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
494 {
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
495 bool closenow = true;
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
496
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
497 gui_settings settings;
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
498
31702
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
499 if (settings.value (global_prompt_to_exit.settings_key (),
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
500 global_prompt_to_exit.def ()).toBool ())
27588
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
501 {
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
502 int ans = QMessageBox::question (this, tr ("Octave"),
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
503 tr ("Are you sure you want to exit Octave?"),
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
504 (QMessageBox::Ok
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
505 | QMessageBox::Cancel),
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
506 QMessageBox::Ok);
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
507
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
508 if (ans != QMessageBox::Ok)
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
509 closenow = false;
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
510 }
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
511
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
512 #if defined (HAVE_QSCINTILLA)
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
513 if (closenow)
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
514 closenow = m_editor_window->check_closing ();
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
515 #endif
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
516
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
517 return closenow;
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
518 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
519
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
520 // catch focus changes and determine the active dock widget
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
521 void main_window::focus_changed (QWidget *, QWidget *new_widget)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
522 {
29085
3b29d72645a9 fix alt-key stealing focus from current dock widget in gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29084
diff changeset
523 // If there is no new widget or the new widget is a menu bar
3b29d72645a9 fix alt-key stealing focus from current dock widget in gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29084
diff changeset
524 // (when pressing <alt>), we can return immediately and reset the
3b29d72645a9 fix alt-key stealing focus from current dock widget in gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29084
diff changeset
525 // focus to the previous widget
3b29d72645a9 fix alt-key stealing focus from current dock widget in gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29084
diff changeset
526 if (! new_widget
30398
d4d83344d653 maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29895
diff changeset
527 || (new_widget == menuBar ())
d4d83344d653 maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29895
diff changeset
528 || (new_widget == m_editor_menubar))
29085
3b29d72645a9 fix alt-key stealing focus from current dock widget in gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29084
diff changeset
529 {
3b29d72645a9 fix alt-key stealing focus from current dock widget in gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29084
diff changeset
530 if (m_active_dock)
3b29d72645a9 fix alt-key stealing focus from current dock widget in gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29084
diff changeset
531 m_active_dock->setFocus ();
3b29d72645a9 fix alt-key stealing focus from current dock widget in gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29084
diff changeset
532
3b29d72645a9 fix alt-key stealing focus from current dock widget in gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29084
diff changeset
533 return;
3b29d72645a9 fix alt-key stealing focus from current dock widget in gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29084
diff changeset
534 }
24772
860860e2e69e fix focus change between dock widgets of gui
Torsten <mttl@mailbox.org>
parents: 24729
diff changeset
535
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
536 octave_dock_widget *dock = nullptr;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
537 QWidget *w_new = new_widget; // get a copy of new focus widget
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
538 QWidget *start = w_new; // Save it as start of our search
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
539 int count = 0; // fallback to prevent endless loop
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
540
24772
860860e2e69e fix focus change between dock widgets of gui
Torsten <mttl@mailbox.org>
parents: 24729
diff changeset
541 QList<octave_dock_widget *> w_list = dock_widget_list ();
860860e2e69e fix focus change between dock widgets of gui
Torsten <mttl@mailbox.org>
parents: 24729
diff changeset
542
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
543 while (w_new && w_new != m_main_tool_bar && count < 100)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
544 {
24772
860860e2e69e fix focus change between dock widgets of gui
Torsten <mttl@mailbox.org>
parents: 24729
diff changeset
545 // Go through all dock widgets and check whether the current widget
27893
465ac679e976 Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents: 27860
diff changeset
546 // with focus is a child of one of them.
27676
ea7d36e9f197 use standard C++ range-based for loops instead of Qt foreach macro
John W. Eaton <jwe@octave.org>
parents: 27672
diff changeset
547 for (auto w : w_list)
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
548 {
24772
860860e2e69e fix focus change between dock widgets of gui
Torsten <mttl@mailbox.org>
parents: 24729
diff changeset
549 if (w->isAncestorOf (w_new))
860860e2e69e fix focus change between dock widgets of gui
Torsten <mttl@mailbox.org>
parents: 24729
diff changeset
550 dock = w;
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
551 }
24772
860860e2e69e fix focus change between dock widgets of gui
Torsten <mttl@mailbox.org>
parents: 24729
diff changeset
552
860860e2e69e fix focus change between dock widgets of gui
Torsten <mttl@mailbox.org>
parents: 24729
diff changeset
553 if (dock)
860860e2e69e fix focus change between dock widgets of gui
Torsten <mttl@mailbox.org>
parents: 24729
diff changeset
554 break;
860860e2e69e fix focus change between dock widgets of gui
Torsten <mttl@mailbox.org>
parents: 24729
diff changeset
555
27956
2310164737b3 fix many spelling errors (bug #57613)
John W. Eaton <jwe@octave.org>
parents: 27041
diff changeset
556 // If not yet found (in case w_new is not a child of its dock widget),
24772
860860e2e69e fix focus change between dock widgets of gui
Torsten <mttl@mailbox.org>
parents: 24729
diff changeset
557 // test next widget in the focus chain
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
558 w_new = qobject_cast<QWidget *> (w_new->previousInFocusChain ());
24772
860860e2e69e fix focus change between dock widgets of gui
Torsten <mttl@mailbox.org>
parents: 24729
diff changeset
559
860860e2e69e fix focus change between dock widgets of gui
Torsten <mttl@mailbox.org>
parents: 24729
diff changeset
560 // Measures preventing an endless loop
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
561 if (w_new == start)
24772
860860e2e69e fix focus change between dock widgets of gui
Torsten <mttl@mailbox.org>
parents: 24729
diff changeset
562 break; // We have arrived where we began ==> exit loop
860860e2e69e fix focus change between dock widgets of gui
Torsten <mttl@mailbox.org>
parents: 24729
diff changeset
563 count++; // Limited number of trials
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
564 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
565
29084
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
566 // editor and terminal needs extra handling
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
567 octave_dock_widget *edit_dock_widget
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
568 = static_cast<octave_dock_widget *> (m_editor_window);
29084
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
569 octave_dock_widget *cmd_dock_widget
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
570 = static_cast<octave_dock_widget *> (m_command_window);
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
571
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
572 // if new dock has focus, emit signal and store active focus
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
573 // except editor changes to a dialog (dock=0)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
574 if ((dock || m_active_dock != edit_dock_widget) && (dock != m_active_dock))
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
575 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
576 // signal to all dock widgets for updating the style
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
577 emit active_dock_changed (m_active_dock, dock);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
578
26555
84e0e0b6493e * main-window.cc (focus_changed): prevent accessing null pointer (bug #55440)
Torsten <mttl@mailbox.org>
parents: 26376
diff changeset
579 if (dock)
84e0e0b6493e * main-window.cc (focus_changed): prevent accessing null pointer (bug #55440)
Torsten <mttl@mailbox.org>
parents: 26376
diff changeset
580 {
84e0e0b6493e * main-window.cc (focus_changed): prevent accessing null pointer (bug #55440)
Torsten <mttl@mailbox.org>
parents: 26376
diff changeset
581 QList<QDockWidget *> tabbed = tabifiedDockWidgets (dock);
84e0e0b6493e * main-window.cc (focus_changed): prevent accessing null pointer (bug #55440)
Torsten <mttl@mailbox.org>
parents: 26376
diff changeset
582 if (tabbed.contains (m_active_dock))
84e0e0b6493e * main-window.cc (focus_changed): prevent accessing null pointer (bug #55440)
Torsten <mttl@mailbox.org>
parents: 26376
diff changeset
583 dock->set_predecessor_widget (m_active_dock);
84e0e0b6493e * main-window.cc (focus_changed): prevent accessing null pointer (bug #55440)
Torsten <mttl@mailbox.org>
parents: 26376
diff changeset
584 }
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
585
29206
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
586 // Check whether editor loses or gains focus
29084
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
587 int editor = 0;
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
588 if (edit_dock_widget == dock)
29084
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
589 {
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
590 emit editor_focus_changed (true);
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
591 editor = 1;
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
592 }
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
593 else if (edit_dock_widget == m_active_dock)
29084
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
594 {
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
595 emit editor_focus_changed (false);
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
596 editor = -1;
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
597 }
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
598
29206
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
599 // Check whether terminal loses or gains focus
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
600 int cmd_involved = 0;
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
601 if (cmd_dock_widget == dock)
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
602 cmd_involved = 1;
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
603 else if (cmd_dock_widget == m_active_dock)
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
604 cmd_involved = -1;
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
605
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
606 // If we have to take care of Alt+? accelerators of the main
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
607 // window, take result of test for terminal widget above
29084
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
608 int command = 0;
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
609 if (m_prevent_readline_conflicts_menu)
29206
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
610 command = cmd_involved;
29084
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
611
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
612 // If editor or command gets/looses focus, disable/enable
29206
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
613 // main menu accelerators (Alt + ?)
29084
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
614 if (editor || command)
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
615 {
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
616 int sum = editor + command;
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
617 if (sum > 0)
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
618 disable_menu_shortcuts (true);
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
619 else if (sum < 0)
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
620 disable_menu_shortcuts (false);
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
621 }
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
622
27860
cbd4d97100b3 add action and shortcut for switching to previews widget (bug #57447)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
623 if (m_active_dock)
cbd4d97100b3 add action and shortcut for switching to previews widget (bug #57447)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
624 m_previous_dock = m_active_dock;
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
625 m_active_dock = dock;
29206
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
626
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
627 // En-/disable global shortcuts (preventing conflicts with
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
628 // readline. Do it here because it relies on m_active_dock
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
629 if (cmd_involved)
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
630 configure_shortcuts ();
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
631 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
632 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
633
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
634 void main_window::request_reload_settings ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
635 {
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
636 emit settings_changed ();
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
637 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
638
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
639 void main_window::report_status_message (const QString& statusMessage)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
640 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
641 m_status_bar->showMessage (statusMessage, 1000);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
642 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
643
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
644 void main_window::handle_save_workspace_request ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
645 {
26096
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26067
diff changeset
646 // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26067
diff changeset
647 int opts = 0; // No options by default.
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
648
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
649 gui_settings settings;
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
650
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
651 if (! settings.bool_value (global_use_native_dialogs))
26096
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26067
diff changeset
652 opts = QFileDialog::DontUseNativeDialog;
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26067
diff changeset
653
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
654 QString file
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
655 = QFileDialog::getSaveFileName (this, tr ("Save Workspace As"), ".",
26096
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26067
diff changeset
656 nullptr, nullptr, QFileDialog::Option (opts));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
657
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
658 if (! file.isEmpty ())
25723
22544083fe2c use common callback for workspace actions initiated by gui
Torsten <mttl@mailbox.org>
parents: 25703
diff changeset
659 {
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
660 emit interpreter_event
28851
1ac5a76ae91d use [=] capture default specification where possible
John W. Eaton <jwe@octave.org>
parents: 28847
diff changeset
661 ([=] (interpreter& interp)
27255
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
662 {
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
663 // INTERPRETER THREAD
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
664
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
665 Fsave (interp, ovl (file.toStdString ()));
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
666 });
25723
22544083fe2c use common callback for workspace actions initiated by gui
Torsten <mttl@mailbox.org>
parents: 25703
diff changeset
667 }
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
668 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
669
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
670 void main_window::handle_load_workspace_request (const QString& file_arg)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
671 {
26096
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26067
diff changeset
672 // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26067
diff changeset
673 int opts = 0; // No options by default.
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
674
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
675 gui_settings settings;
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
676
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
677 if (! settings.bool_value (global_use_native_dialogs))
26096
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26067
diff changeset
678 opts = QFileDialog::DontUseNativeDialog;
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26067
diff changeset
679
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
680 QString file = file_arg;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
681
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
682 if (file.isEmpty ())
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
683 file = QFileDialog::getOpenFileName (this, tr ("Load Workspace"), ".",
26096
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26067
diff changeset
684 nullptr, nullptr, QFileDialog::Option (opts));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
685
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
686 if (! file.isEmpty ())
25723
22544083fe2c use common callback for workspace actions initiated by gui
Torsten <mttl@mailbox.org>
parents: 25703
diff changeset
687 {
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
688 emit interpreter_event
28851
1ac5a76ae91d use [=] capture default specification where possible
John W. Eaton <jwe@octave.org>
parents: 28847
diff changeset
689 ([=] (interpreter& interp)
27255
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
690 {
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
691 // INTERPRETER THREAD
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
692
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
693 Fload (interp, ovl (file.toStdString ()));
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
694
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
695 tree_evaluator& tw = interp.get_evaluator ();
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
696
27263
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27261
diff changeset
697 event_manager& xevmgr = interp.get_event_manager ();
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27261
diff changeset
698
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27261
diff changeset
699 xevmgr.set_workspace (true, tw.get_symbol_info ());
27255
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
700 });
25723
22544083fe2c use common callback for workspace actions initiated by gui
Torsten <mttl@mailbox.org>
parents: 25703
diff changeset
701 }
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
702 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
703
25408
ce725103ebf1 Fallback to open.m for opening files in the gui file browser (bug #50543)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25407
diff changeset
704 void main_window::handle_open_any_request (const QString& file_arg)
ce725103ebf1 Fallback to open.m for opening files in the gui file browser (bug #50543)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25407
diff changeset
705 {
ce725103ebf1 Fallback to open.m for opening files in the gui file browser (bug #50543)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25407
diff changeset
706 if (! file_arg.isEmpty ())
27243
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
707 {
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
708 std::string file = file_arg.toStdString ();
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
709
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
710 emit interpreter_event
28851
1ac5a76ae91d use [=] capture default specification where possible
John W. Eaton <jwe@octave.org>
parents: 28847
diff changeset
711 ([=] (interpreter& interp)
27243
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
712 {
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
713 // INTERPRETER THREAD
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
714
27405
646efbb5f407 avoid including builtin-defun-decls.h unless needed
John W. Eaton <jwe@octave.org>
parents: 27396
diff changeset
715 interp.feval ("open", ovl (file));
27243
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
716
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
717 // Update the workspace since open.m may have loaded new
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
718 // variables.
27261
dccdc3b001a2 eliminate static functions from octave_link class
John W. Eaton <jwe@octave.org>
parents: 27260
diff changeset
719 tree_evaluator& tw = interp.get_evaluator ();
dccdc3b001a2 eliminate static functions from octave_link class
John W. Eaton <jwe@octave.org>
parents: 27260
diff changeset
720
27263
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27261
diff changeset
721 event_manager& xevmgr = interp.get_event_manager ();
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27261
diff changeset
722
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27261
diff changeset
723 xevmgr.set_workspace (true, tw.get_symbol_info ());
27243
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
724 });
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
725 }
25408
ce725103ebf1 Fallback to open.m for opening files in the gui file browser (bug #50543)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25407
diff changeset
726 }
ce725103ebf1 Fallback to open.m for opening files in the gui file browser (bug #50543)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25407
diff changeset
727
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
728 void main_window::handle_clear_workspace_request ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
729 {
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
730 emit interpreter_event
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
731 ([] (interpreter& interp)
27255
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
732 {
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
733 // INTERPRETER THREAD
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
734
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
735 Fclear (interp);
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
736 });
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
737 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
738
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
739 void main_window::handle_clear_command_window_request ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
740 {
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
741 emit interpreter_event
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
742 ([] ()
27243
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
743 {
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
744 // INTERPRETER THREAD
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
745
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
746 command_editor::kill_full_line ();
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
747 command_editor::clear_screen ();
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
748 });
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
749 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
750
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
751 void main_window::handle_clear_history_request ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
752 {
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
753 emit interpreter_event
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
754 ([] (interpreter& interp)
27243
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
755 {
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
756 // INTERPRETER THREAD
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
757
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
758 history_system& history_sys = interp.get_history_system ();
27243
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
759
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
760 history_sys.do_history (ovl ("-c"));
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
761 });
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
762 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
763
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
764 void main_window::handle_undo_request ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
765 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
766 if (command_window_has_focus ())
27243
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
767 {
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
768 emit interpreter_event
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
769 ([] ()
27243
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
770 {
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
771 // INTERPRETER THREAD
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
772
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
773 command_editor::undo ();
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
774 command_editor::redisplay ();
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
775 });
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
776 }
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
777 else
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
778 emit undo_signal ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
779 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
780
29782
02461b0ccc00 reduce dependence of files_dock_widget on Octave interpreter
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
781 void main_window::modify_path (const QStringList& dir_list,
27308
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
782 bool rm, bool subdirs)
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
783 {
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
784 emit interpreter_event
28851
1ac5a76ae91d use [=] capture default specification where possible
John W. Eaton <jwe@octave.org>
parents: 28847
diff changeset
785 ([=] (interpreter& interp)
27308
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
786 {
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
787 // INTERPRETER THREAD
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
788
29782
02461b0ccc00 reduce dependence of files_dock_widget on Octave interpreter
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
789 octave_value_list paths;
02461b0ccc00 reduce dependence of files_dock_widget on Octave interpreter
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
790
02461b0ccc00 reduce dependence of files_dock_widget on Octave interpreter
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
791 // Loop over all directories in order to get all subdirs
02461b0ccc00 reduce dependence of files_dock_widget on Octave interpreter
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
792 for (octave_idx_type i = 0; i < dir_list.length (); i++)
27308
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
793 {
29782
02461b0ccc00 reduce dependence of files_dock_widget on Octave interpreter
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
794 std::string dir = dir_list.at(i).toStdString ();
02461b0ccc00 reduce dependence of files_dock_widget on Octave interpreter
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
795
02461b0ccc00 reduce dependence of files_dock_widget on Octave interpreter
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
796 if (subdirs)
02461b0ccc00 reduce dependence of files_dock_widget on Octave interpreter
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
797 paths.append (Fgenpath (ovl (dir)));
02461b0ccc00 reduce dependence of files_dock_widget on Octave interpreter
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
798 else
02461b0ccc00 reduce dependence of files_dock_widget on Octave interpreter
John W. Eaton <jwe@octave.org>
parents: 29773
diff changeset
799 paths.append (dir);
27308
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
800 }
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
801
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
802 if (rm)
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
803 Frmpath (interp, paths);
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
804 else
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
805 Faddpath (interp, paths);
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
806 });
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
807 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
808
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
809 void main_window::edit_mfile (const QString& name, int line)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
810 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
811 handle_edit_mfile_request (name, QString (), QString (), line);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
812 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
813
25742
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25723
diff changeset
814 void main_window::file_remove_proxy (const QString& o, const QString& n)
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25723
diff changeset
815 {
27218
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27209
diff changeset
816 interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj ();
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27209
diff changeset
817
27263
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27261
diff changeset
818 qt_interpreter_events *qt_link = interp_qobj->qt_link ();
27218
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27209
diff changeset
819
25742
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25723
diff changeset
820 // Wait for worker to suspend
27218
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27209
diff changeset
821 qt_link->lock ();
25742
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25723
diff changeset
822 // Close the file if opened
27039
32d9f57d7245 fix missing unlock of mutex when gui editor is not present (bug #56097)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 26643
diff changeset
823 #if defined (HAVE_QSCINTILLA)
25742
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25723
diff changeset
824 m_editor_window->handle_file_remove (o, n);
27041
6caf75200854 build: Silence unused parameter warning created in cset 43f6f02dd91c (bug #56097).
Rik <rik@octave.org>
parents: 27039
diff changeset
825 #else
6caf75200854 build: Silence unused parameter warning created in cset 43f6f02dd91c (bug #56097).
Rik <rik@octave.org>
parents: 27039
diff changeset
826 octave_unused_parameter (o);
6caf75200854 build: Silence unused parameter warning created in cset 43f6f02dd91c (bug #56097).
Rik <rik@octave.org>
parents: 27039
diff changeset
827 octave_unused_parameter (n);
27588
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
828 #endif
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
829
25742
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25723
diff changeset
830 // We are done: Unlock and wake the worker thread
27218
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27209
diff changeset
831 qt_link->unlock ();
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27209
diff changeset
832 qt_link->wake_all ();
25742
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25723
diff changeset
833 }
d3c6de326bae close/reload editor tab when file is (re)moved in gui terminal (bug #43922)
Torsten <mttl@mailbox.org>
parents: 25723
diff changeset
834
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
835 void main_window::open_online_documentation_page ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
836 {
27276
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
837 QDesktopServices::openUrl
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
838 (QUrl ("https://octave.org/doc/interpreter/index.html"));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
839 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
840
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
841 void main_window::open_bug_tracker_page ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
842 {
25024
3c817af70eed maint: use https for all Octave project URLs
Mike Miller <mtmiller@octave.org>
parents: 24792
diff changeset
843 QDesktopServices::openUrl (QUrl ("https://octave.org/bugs.html"));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
844 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
845
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
846 void main_window::open_octave_packages_page ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
847 {
31188
be5f23b39ee3 gui: Update Octave Packages menu link (bug #62897).
John Donoghue <john.donoghue@ieee.org>
parents: 31179
diff changeset
848 QDesktopServices::openUrl (QUrl ("https://packages.octave.org/index.html"));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
849 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
850
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
851 void main_window::open_contribute_page ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
852 {
25024
3c817af70eed maint: use https for all Octave project URLs
Mike Miller <mtmiller@octave.org>
parents: 24792
diff changeset
853 QDesktopServices::openUrl (QUrl ("https://octave.org/contribute.html"));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
854 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
855
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
856 void main_window::open_donate_page ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
857 {
25024
3c817af70eed maint: use https for all Octave project URLs
Mike Miller <mtmiller@octave.org>
parents: 24792
diff changeset
858 QDesktopServices::openUrl (QUrl ("https://octave.org/donate.html"));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
859 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
860
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
861 void main_window::process_settings_dialog_request (const QString& desired_tab)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
862 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
863 if (m_settings_dlg) // m_settings_dlg is a guarded pointer!
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
864 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
865 // here the dialog is still open and called once again
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
866 if (! desired_tab.isEmpty ())
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
867 m_settings_dlg->show_tab (desired_tab);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
868 return;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
869 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
870
31696
8fed04d0607c eliminate shortcut_manager class and revamp shortcut handling
John W. Eaton <jwe@octave.org>
parents: 31692
diff changeset
871 m_settings_dlg = new settings_dialog (this, desired_tab);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
872
29542
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
873 connect (m_settings_dlg, &settings_dialog::apply_new_settings,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
874 this, &main_window::request_reload_settings);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
875
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
876 m_settings_dlg->setModal (false);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
877 m_settings_dlg->setAttribute (Qt::WA_DeleteOnClose);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
878 m_settings_dlg->show ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
879 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
880
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
881 void main_window::show_about_octave ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
882 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
883 std::string message
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
884 = octave_name_version_copyright_copying_warranty_and_bugs (true);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
885
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
886 QMessageBox::about (this, tr ("About Octave"),
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
887 QString::fromStdString (message));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
888 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
889
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
890 void main_window::notice_settings (bool update_by_worker)
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
891 {
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
892 gui_settings settings;
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
893
26227
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26117
diff changeset
894 // Get desired style from preferences or take the default one if
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26117
diff changeset
895 // the desired one is not found
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
896 QString preferred_style = settings.string_value (global_style);
26227
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26117
diff changeset
897
31702
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
898 if (preferred_style == global_style.def ().toString ())
26227
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26117
diff changeset
899 preferred_style = m_default_style;
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26117
diff changeset
900
30965
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
901 QApplication* qapp = m_octave_qobj.qapplication();
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
902
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
903 if (preferred_style == global_extra_styles.at (EXTRA_STYLE_FUSION_DARK))
27218
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27209
diff changeset
904 {
30965
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
905 QStyle *new_style = QStyleFactory::create (QStringLiteral("Fusion"));
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
906 if (new_style)
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
907 qapp->setStyle (new_style);
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
908 qapp->setPalette (getFusionDarkPalette());
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
909 qapp->setStyleSheet ("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }");
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
910 }
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
911 else
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
912 {
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
913 QStyle *new_style = QStyleFactory::create (preferred_style);
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
914 if (new_style)
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
915 {
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
916 qapp->setPalette (m_default_palette);
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
917 qapp->setStyle (new_style);
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
918 }
27218
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27209
diff changeset
919 }
26227
2355f66cf91d allow to select the gui style in the preferences dialog
Torsten <mttl@mailbox.org>
parents: 26117
diff changeset
920
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
921 // the widget's icons (when floating)
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
922 QString icon_set = settings.string_value (dw_icon_set);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
923
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
924 QString icon;
27676
ea7d36e9f197 use standard C++ range-based for loops instead of Qt foreach macro
John W. Eaton <jwe@octave.org>
parents: 27672
diff changeset
925 for (auto *widget : dock_widget_list ())
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
926 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
927 QString name = widget->objectName ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
928 if (! name.isEmpty ())
25042
ba5af45bbfc4 documentation widget based on qt help engine (bug #53006)
Torsten <mttl@mailbox.org>
parents: 25024
diff changeset
929 {
27893
465ac679e976 Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents: 27860
diff changeset
930 // if child has a name
30964
04601f6c47f4 fix broken icon path after new icon structure in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30811
diff changeset
931 icon = dw_icon_set_names[icon_set];
04601f6c47f4 fix broken icon path after new icon structure in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30811
diff changeset
932 if (icon_set != "NONE")
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
933 icon += name + ".png"; // add widget name and ext.
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
934 widget->setWindowIcon (QIcon (icon));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
935 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
936 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
937
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
938 int size_idx = settings.int_value (global_icon_size);
26058
ecd86b8b8979 use constants for icon size preferences instead of hard coded numbers
Torsten <mttl@mailbox.org>
parents: 25994
diff changeset
939 size_idx = (size_idx > 0) - (size_idx < 0) + 1; // Make valid index from 0 to 2
ecd86b8b8979 use constants for icon size preferences instead of hard coded numbers
Torsten <mttl@mailbox.org>
parents: 25994
diff changeset
940
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
941 QStyle *st = style ();
26058
ecd86b8b8979 use constants for icon size preferences instead of hard coded numbers
Torsten <mttl@mailbox.org>
parents: 25994
diff changeset
942 int icon_size = st->pixelMetric (global_icon_sizes[size_idx]);
30398
d4d83344d653 maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29895
diff changeset
943 m_main_tool_bar->setIconSize (QSize (icon_size, icon_size));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
944
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
945 if (settings.bool_value (global_status_bar))
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
946 m_status_bar->show ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
947 else
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
948 m_status_bar->hide ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
949
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
950 m_prevent_readline_conflicts
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
951 = settings.bool_value (sc_prevent_rl_conflicts);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
952
29084
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
953 m_prevent_readline_conflicts_menu
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
954 = settings.bool_value (sc_prevent_rl_conflicts_menu);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
955
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
956 m_suppress_dbg_location
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
957 = ! settings.bool_value (cs_dbg_location);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
958
31690
1a1f47f17ed4 eliminate resource_manager class
John W. Eaton <jwe@octave.org>
parents: 31649
diff changeset
959 settings.update_network_settings ();
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
960
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
961 emit active_dock_changed (nullptr, m_active_dock); // update dock widget styles
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
962
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
963 configure_shortcuts ();
29084
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
964
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
965 bool do_disable_main_menu_shortcuts
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
966 = (m_active_dock == m_editor_window)
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
967 || (m_prevent_readline_conflicts_menu
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
968 && (m_active_dock == m_command_window));
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
969
2a70a068c4ab add option for using alt-modifer in command windows readline (bug #59478)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29068
diff changeset
970 disable_menu_shortcuts (do_disable_main_menu_shortcuts);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
971
27270
47f42ad90b0b Restore mfile_encoding on startup from GUI settings.
Markus Mützel <markus.muetzel@gmx.de>
parents: 27267
diff changeset
972 // Check whether some octave internal preferences have to be updated
25702
bd30c6f8cfb7 update internal __mfile_encoding__ when gui default encoding changes (bug #54310)
Torsten <mttl@mailbox.org>
parents: 25700
diff changeset
973 QString new_default_encoding
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
974 = settings.string_value (ed_default_enc);
29000
8a05763823d1 avoid possible infinite loop when default encoding is changed (bug #59331)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28837
diff changeset
975 // Do not update internal pref only if a) this update was not initiated
8a05763823d1 avoid possible infinite loop when default encoding is changed (bug #59331)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28837
diff changeset
976 // by the worker and b) the pref has really changes
8a05763823d1 avoid possible infinite loop when default encoding is changed (bug #59331)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 28837
diff changeset
977 if (! update_by_worker && (new_default_encoding != m_default_encoding))
27270
47f42ad90b0b Restore mfile_encoding on startup from GUI settings.
Markus Mützel <markus.muetzel@gmx.de>
parents: 27267
diff changeset
978 update_default_encoding (new_default_encoding);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
979
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
980 // Set cursor blinking depending on the settings
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
981 // Cursor blinking: consider old terminal related setting if not yet set
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
982 // TODO: This pref. can be deprecated / removed if Qt adds support for
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
983 // getting the cursor blink preferences from all OS environments
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
984 bool cursor_blinking;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
985
31702
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
986 if (settings.contains (global_cursor_blinking.settings_key ()))
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
987 cursor_blinking = settings.bool_value (global_cursor_blinking);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
988 else
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
989 cursor_blinking = settings.bool_value (cs_cursor_blinking);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
990
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
991 if (cursor_blinking)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
992 QApplication::setCursorFlashTime (1000); // 1000 ms flash time
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
993 else
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
994 QApplication::setCursorFlashTime (0); // no flashing
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
995
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
996 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
997
30965
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
998 QPalette main_window::getFusionDarkPalette()
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
999 {
30966
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1000 QPalette darkPalette;
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1001 darkPalette.setColor(QPalette::Window, QColor(53, 53, 53));
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1002 darkPalette.setColor(QPalette::WindowText, Qt::white);
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1003 darkPalette.setColor(QPalette::Disabled, QPalette::WindowText, QColor(127, 127, 127));
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1004 darkPalette.setColor(QPalette::Base, QColor(42, 42, 42));
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1005 darkPalette.setColor(QPalette::AlternateBase, QColor(66, 66, 66));
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1006 darkPalette.setColor(QPalette::ToolTipBase, Qt::white);
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1007 darkPalette.setColor(QPalette::ToolTipText, Qt::white);
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1008 darkPalette.setColor(QPalette::Text, Qt::white);
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1009 darkPalette.setColor(QPalette::Disabled, QPalette::Text, QColor(127, 127, 127));
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1010 darkPalette.setColor(QPalette::Dark, QColor(35, 35, 35));
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1011 darkPalette.setColor(QPalette::Shadow, QColor(20, 20, 20));
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1012 darkPalette.setColor(QPalette::Button, QColor(53, 53, 53));
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1013 darkPalette.setColor(QPalette::ButtonText, Qt::white);
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1014 darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(127, 127, 127));
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1015 darkPalette.setColor(QPalette::BrightText, Qt::red);
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1016 darkPalette.setColor(QPalette::Link, QColor(42, 130, 218));
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1017 darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1018 darkPalette.setColor(QPalette::Disabled, QPalette::Highlight, QColor(80, 80, 80));
5c4d807b3aff maint: Strip DOS line endings from cset 291994766c55.
Rik <rik@octave.org>
parents: 30965
diff changeset
1019 darkPalette.setColor(QPalette::HighlightedText, Qt::white);
30965
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
1020 darkPalette.setColor(QPalette::Disabled, QPalette::HighlightedText, QColor(127, 127, 127));
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
1021
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
1022 return darkPalette;
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
1023 }
291994766c55 add fusion dark style to gui
Farid Partonia <f.partonia@gmail.com>
parents: 30964
diff changeset
1024
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1025 void main_window::prepare_to_exit ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1026 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1027 // Find files dialog is constructed dynamically, not at time of main_window
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1028 // construction. Connecting it to qApp aboutToQuit signal would have
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents: 27602
diff changeset
1029 // caused it to run after gui_settings is deleted.
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1030 if (m_find_files_dlg)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1031 m_find_files_dlg->save_settings ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1032
27312
b9a436b0400e save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27311
diff changeset
1033 if (m_set_path_dlg)
b9a436b0400e save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27311
diff changeset
1034 m_set_path_dlg->save_settings ();
b9a436b0400e save and restore last geometry of load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27311
diff changeset
1035
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1036 write_settings ();
29085
3b29d72645a9 fix alt-key stealing focus from current dock widget in gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29084
diff changeset
1037
3b29d72645a9 fix alt-key stealing focus from current dock widget in gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29084
diff changeset
1038 // No more active dock, otherwise, focus_changed would try to set
3b29d72645a9 fix alt-key stealing focus from current dock widget in gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29084
diff changeset
1039 // the focus to a dock widget that might not exist anymore
3b29d72645a9 fix alt-key stealing focus from current dock widget in gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29084
diff changeset
1040 m_active_dock = nullptr;
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1041 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1042
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1043 void main_window::go_to_previous_widget ()
27860
cbd4d97100b3 add action and shortcut for switching to previews widget (bug #57447)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
1044 {
cbd4d97100b3 add action and shortcut for switching to previews widget (bug #57447)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
1045 m_previous_dock->activate ();
cbd4d97100b3 add action and shortcut for switching to previews widget (bug #57447)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
1046 }
cbd4d97100b3 add action and shortcut for switching to previews widget (bug #57447)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
1047
27409
a0d49e55acae rename change_directory to directory_changed in event manager
John W. Eaton <jwe@octave.org>
parents: 27408
diff changeset
1048 void main_window::update_octave_directory (const QString& dir)
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1049 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1050 // Remove existing entry, if any, then add new directory at top and
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1051 // mark it as the current directory. Finally, update the file list
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1052 // widget.
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1053
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1054 int index = m_current_directory_combo_box->findText (dir);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1055
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1056 if (index >= 0)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1057 m_current_directory_combo_box->removeItem (index);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1058
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1059 m_current_directory_combo_box->insertItem (0, dir);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1060 m_current_directory_combo_box->setCurrentIndex (0);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1061 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1062
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1063 void main_window::browse_for_directory ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1064 {
26096
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26067
diff changeset
1065 // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26067
diff changeset
1066 int opts = QFileDialog::ShowDirsOnly;
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1067
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1068 gui_settings settings;
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1069
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
1070 if (! settings.bool_value (global_use_native_dialogs))
26096
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26067
diff changeset
1071 opts = QFileDialog::DontUseNativeDialog;
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26067
diff changeset
1072
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1073 QString dir
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1074 = QFileDialog::getExistingDirectory (this, tr ("Browse directories"), nullptr,
26096
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26067
diff changeset
1075 QFileDialog::Option (opts));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1076
15626
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
1077 set_current_working_directory (dir);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1078
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1079 // FIXME: on Windows systems, the command window freezes after the
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1080 // previous actions. Forcing the focus appears to unstick it.
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1081
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1082 focus_command_window ();
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1083 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1084
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1085 void main_window::set_current_working_directory (const QString& dir)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1086 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1087 // Change to dir if it is an existing directory.
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1088
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1089 QString xdir = (dir.isEmpty () ? "." : dir);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1090
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1091 QFileInfo fileInfo (xdir);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1092
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1093 if (fileInfo.exists () && fileInfo.isDir ())
25703
7b4e99fbe9d4 include builtin functions without interpreter argument being into octave_cmd
Torsten <mttl@mailbox.org>
parents: 25702
diff changeset
1094 {
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
1095 emit interpreter_event
28851
1ac5a76ae91d use [=] capture default specification where possible
John W. Eaton <jwe@octave.org>
parents: 28847
diff changeset
1096 ([=] (interpreter& interp)
27255
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1097 {
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1098 // INTERPRETER THREAD
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1099
27408
9b19eec60931 move change directory function to interpreter class
John W. Eaton <jwe@octave.org>
parents: 27405
diff changeset
1100 interp.chdir (xdir.toStdString ());
27255
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1101 });
25703
7b4e99fbe9d4 include builtin functions without interpreter argument being into octave_cmd
Torsten <mttl@mailbox.org>
parents: 25702
diff changeset
1102 }
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1103 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1104
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1105 void main_window::change_directory_up ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1106 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1107 set_current_working_directory ("..");
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1108 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1109
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1110 // Slot that is called if return is pressed in the line edit of the
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1111 // combobox to change to a new directory or a directory that is already
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1112 // in the drop down list.
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1113
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1114 void main_window::accept_directory_line_edit ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1115 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1116 // Get new directory name, and change to it if it is new. Otherwise,
27893
465ac679e976 Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents: 27860
diff changeset
1117 // the combo box will trigger the "activated" signal to change to the
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1118 // directory.
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1119
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1120 QString dir = m_current_directory_combo_box->currentText ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1121
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1122 int index = m_current_directory_combo_box->findText (dir);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1123
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1124 if (index < 0)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1125 set_current_working_directory (dir);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1126 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1127
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1128 void main_window::execute_command_in_terminal (const QString& command)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1129 {
31068
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
1130 if (m_octave_qobj.experimental_terminal_widget ())
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
1131 {
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
1132 emit execute_command_signal (command);
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
1133 }
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
1134 else
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
1135 {
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
1136 emit interpreter_event
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1137 ([=] ()
31068
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
1138 {
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
1139 // INTERPRETER THREAD
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
1140
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
1141 std::string pending_input = command_editor::get_current_line ();
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
1142
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
1143 command_editor::set_initial_input (pending_input);
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
1144 command_editor::replace_line (command.toStdString ());
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
1145 command_editor::redisplay ();
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
1146 command_editor::interrupt_event_loop ();
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
1147 command_editor::accept_line ();
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
1148 });
0b402f523f09 allow executing a command in the new terminal widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31067
diff changeset
1149 }
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1150
27556
410622ac120f improve run selection from editor (bug #42705)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27478
diff changeset
1151 focus_console_after_command ();
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1152 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1153
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1154 void main_window::run_file_in_terminal (const QFileInfo& info)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1155 {
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
1156 emit interpreter_event
28851
1ac5a76ae91d use [=] capture default specification where possible
John W. Eaton <jwe@octave.org>
parents: 28847
diff changeset
1157 ([=] (interpreter& interp)
27255
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1158 {
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1159 // INTERPRETER THREAD
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1160
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1161 QString function_name = info.fileName ();
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1162 function_name.chop (info.suffix ().length () + 1);
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1163 std::string file_path = info.absoluteFilePath ().toStdString ();
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1164
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1165 std::string pending_input = command_editor::get_current_line ();
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1166
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1167 if (valid_identifier (function_name.toStdString ()))
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1168 {
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1169 // Valid identifier: call as function with possibility to
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1170 // debug.
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1171
27396
930c0fbc003b move qt_interpreter_events::file_in_path to load_path::contains_file_in_dir
John W. Eaton <jwe@octave.org>
parents: 27393
diff changeset
1172 load_path& lp = interp.get_load_path ();
930c0fbc003b move qt_interpreter_events::file_in_path to load_path::contains_file_in_dir
John W. Eaton <jwe@octave.org>
parents: 27393
diff changeset
1173
27255
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1174 std::string path = info.absolutePath ().toStdString ();
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1175
27396
930c0fbc003b move qt_interpreter_events::file_in_path to load_path::contains_file_in_dir
John W. Eaton <jwe@octave.org>
parents: 27393
diff changeset
1176 if (lp.contains_file_in_dir (file_path, path))
27255
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1177 command_editor::replace_line (function_name.toStdString ());
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1178 }
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1179 else
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1180 {
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1181 // No valid identifier: use equivalent of Fsource (), no
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1182 // debug possible.
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1183
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1184 interp.source_file (file_path);
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1185
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1186 command_editor::replace_line ("");
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1187 }
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1188
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1189 command_editor::set_initial_input (pending_input);
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1190 command_editor::redisplay ();
27339
64289bf338da use separate variable for interrupting command editor event loop (bug #56738)
John W. Eaton <jwe@octave.org>
parents: 27335
diff changeset
1191 command_editor::interrupt_event_loop ();
27255
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1192 command_editor::accept_line ();
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1193 });
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1194
27556
410622ac120f improve run selection from editor (bug #42705)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27478
diff changeset
1195 focus_console_after_command ();
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1196 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1197
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1198 void main_window::handle_new_figure_request ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1199 {
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
1200 emit interpreter_event
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
1201 ([] (interpreter& interp)
27243
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
1202 {
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
1203 // INTERPRETER THREAD
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
1204
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
1205 Fbuiltin (interp, ovl ("figure"));
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27312
diff changeset
1206 Fdrawnow (interp);
27243
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
1207 });
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1208 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1209
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1210 void main_window::handle_enter_debugger ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1211 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1212 setWindowTitle ("Octave (Debugging)");
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1213
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1214 m_debug_continue->setEnabled (true);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1215 m_debug_step_into->setEnabled (true);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1216 m_debug_step_over->setEnabled (true);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1217 m_debug_step_out->setEnabled (true);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1218 m_debug_quit->setEnabled (true);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1219 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1220
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1221 void main_window::handle_exit_debugger ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1222 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1223 setWindowTitle ("Octave");
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1224
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1225 m_debug_continue->setEnabled (false);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1226 m_debug_step_into->setEnabled (false);
29439
fe06fafb4cac fix en-/disabling some editor actions depending on file type (bug #60214)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
1227 m_debug_step_over->setEnabled (m_editor_has_tabs && m_editor_is_octave_file);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1228 m_debug_step_out->setEnabled (false);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1229 m_debug_quit->setEnabled (false);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1230 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1231
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1232 void main_window::debug_continue ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1233 {
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
1234 emit interpreter_event
28851
1ac5a76ae91d use [=] capture default specification where possible
John W. Eaton <jwe@octave.org>
parents: 28847
diff changeset
1235 ([=] (interpreter& interp)
27255
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1236 {
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1237 // INTERPRETER THREAD
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1238
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1239 F__db_next_breakpoint_quiet__ (interp, ovl (m_suppress_dbg_location));
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1240 Fdbcont (interp);
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1241
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1242 command_editor::interrupt (true);
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1243 });
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1244 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1245
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1246 void main_window::debug_step_into ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1247 {
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
1248 emit interpreter_event
28851
1ac5a76ae91d use [=] capture default specification where possible
John W. Eaton <jwe@octave.org>
parents: 28847
diff changeset
1249 ([=] (interpreter& interp)
27255
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1250 {
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1251 // INTERPRETER THREAD
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1252
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1253 F__db_next_breakpoint_quiet__ (interp, ovl (m_suppress_dbg_location));
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1254 Fdbstep (interp, ovl ("in"));
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1255
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1256 command_editor::interrupt (true);
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1257 });
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1258 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1259
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1260 void main_window::debug_step_over ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1261 {
26873
9ec36417c262 debug step starts script if not already running in debug mode (bug #44728)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 26643
diff changeset
1262 if (m_debug_quit->isEnabled ())
9ec36417c262 debug step starts script if not already running in debug mode (bug #44728)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 26643
diff changeset
1263 {
27255
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1264 // We are in debug mode, just call dbstep.
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1265
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
1266 emit interpreter_event
28851
1ac5a76ae91d use [=] capture default specification where possible
John W. Eaton <jwe@octave.org>
parents: 28847
diff changeset
1267 ([=] (interpreter& interp)
27255
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1268 {
27393
efe72866b483 mark all interpreter_event lambda functions with special comment
John W. Eaton <jwe@octave.org>
parents: 27391
diff changeset
1269 // INTERPRETER THREAD
efe72866b483 mark all interpreter_event lambda functions with special comment
John W. Eaton <jwe@octave.org>
parents: 27391
diff changeset
1270
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
1271 F__db_next_breakpoint_quiet__ (interp,
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
1272 ovl (m_suppress_dbg_location));
27255
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1273 Fdbstep (interp);
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1274
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1275 command_editor::interrupt (true);
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1276 });
26873
9ec36417c262 debug step starts script if not already running in debug mode (bug #44728)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 26643
diff changeset
1277 }
9ec36417c262 debug step starts script if not already running in debug mode (bug #44728)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 26643
diff changeset
1278 else
9ec36417c262 debug step starts script if not already running in debug mode (bug #44728)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 26643
diff changeset
1279 {
9ec36417c262 debug step starts script if not already running in debug mode (bug #44728)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 26643
diff changeset
1280 // Not in debug mode: "step into" the current editor file
9ec36417c262 debug step starts script if not already running in debug mode (bug #44728)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 26643
diff changeset
1281 emit step_into_file_signal ();
9ec36417c262 debug step starts script if not already running in debug mode (bug #44728)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 26643
diff changeset
1282 }
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1283 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1284
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1285 void main_window::debug_step_out ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1286 {
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
1287 emit interpreter_event
28851
1ac5a76ae91d use [=] capture default specification where possible
John W. Eaton <jwe@octave.org>
parents: 28847
diff changeset
1288 ([=] (interpreter& interp)
27255
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1289 {
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1290 // INTERPRETER THREAD
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1291
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1292 F__db_next_breakpoint_quiet__ (interp, ovl (m_suppress_dbg_location));
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1293 Fdbstep (interp, ovl ("out"));
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1294
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1295 command_editor::interrupt (true);
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1296 });
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1297 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1298
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1299 void main_window::debug_quit ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1300 {
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
1301 emit interpreter_event
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
1302 ([] (interpreter& interp)
27255
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1303 {
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1304 // INTERPRETER THREAD
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1305
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1306 Fdbquit (interp);
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1307
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1308 command_editor::interrupt (true);
420611c61298 eliminate octave_cmd classes
John W. Eaton <jwe@octave.org>
parents: 27243
diff changeset
1309 });
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1310 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1311
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1312 //
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1313 // Functions related to file editing
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1314 //
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1315 // These are moved from editor to here for also using them when octave
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1316 // is built without qscintilla
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1317 //
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1318 void main_window::request_open_file ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1319 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1320 // Open file isn't a file_editor_tab or editor function since the file
27929
265b386f8b20 maint: Use two spaces between sentences in code comments.
Rik <rik@octave.org>
parents: 27923
diff changeset
1321 // might be opened in an external editor. Hence, functionality is here.
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1322
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1323 gui_settings settings;
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1324
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1325 bool is_internal = m_editor_window
31702
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
1326 && ! settings.value (global_use_custom_editor.settings_key (),
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
1327 global_use_custom_editor.def ()).toBool ();
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1328
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1329 // Create a NonModal message.
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1330 QWidget *p = this;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1331 if (is_internal)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1332 p = m_editor_window;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1333 QFileDialog *fileDialog = new QFileDialog (p);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1334 fileDialog->setNameFilter (tr ("Octave Files (*.m);;All Files (*)"));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1335
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1336 fileDialog->setAcceptMode (QFileDialog::AcceptOpen);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1337 fileDialog->setViewMode (QFileDialog::Detail);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1338 fileDialog->setFileMode (QFileDialog::ExistingFiles);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1339 fileDialog->setDirectory (m_current_directory_combo_box->itemText (0));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1340
26096
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26067
diff changeset
1341 // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
1342 if (! settings.bool_value (global_use_native_dialogs))
26096
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26067
diff changeset
1343 fileDialog->setOption(QFileDialog::DontUseNativeDialog);
1002b49ce7b3 Make use of native file dialogs configurable (bug #54607).
Kai T. Ohlhus <k.ohlhus@gmail.com>
parents: 26067
diff changeset
1344
29542
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1345 connect (fileDialog, &QFileDialog::filesSelected,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1346 this, &main_window::request_open_files);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1347
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1348 fileDialog->setWindowModality (Qt::NonModal);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1349 fileDialog->setAttribute (Qt::WA_DeleteOnClose);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1350 fileDialog->show ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1351 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1352
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1353 // Create a new script
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1354 void main_window::request_new_script (const QString& commands)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1355 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1356 emit new_file_signal (commands);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1357 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1358
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1359 // Create a new function and open it
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1360 void main_window::request_new_function (bool)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1361 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1362 bool ok;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1363 // Get the name of the new function: Parent of the input dialog is the
27929
265b386f8b20 maint: Use two spaces between sentences in code comments.
Rik <rik@octave.org>
parents: 27923
diff changeset
1364 // editor window or the main window. The latter is chosen, if a custom
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1365 // editor is used or qscintilla is not available
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1366 QWidget *p = m_editor_window;
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1367
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1368 gui_settings settings;
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1369
31702
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
1370 if (! p || settings.value (global_use_custom_editor.settings_key (),
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
1371 global_use_custom_editor.def ()).toBool ())
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1372 p = this;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1373 QString new_name = QInputDialog::getText (p, tr ("New Function"),
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1374 tr ("New function name:\n"), QLineEdit::Normal, "", &ok);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1375
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1376 if (ok && new_name.length () > 0)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1377 {
27893
465ac679e976 Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents: 27860
diff changeset
1378 // append suffix if it does not already exist
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1379 if (new_name.rightRef (2) != ".m")
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1380 new_name.append (".m");
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1381 // check whether new files are created without prompt
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
1382 if (! settings.bool_value (ed_create_new_file))
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1383 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1384 // no, so enable this settings and wait for end of new file loading
31702
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
1385 settings.setValue (ed_create_new_file.settings_key (), true);
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1386 connect (m_editor_window, SIGNAL (file_loaded_signal ()),
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1387 this, SLOT (restore_create_file_setting ()));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1388 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1389 // start the edit command
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1390 execute_command_in_terminal ("edit " + new_name);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1391 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1392 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1393
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1394 void main_window::handle_edit_mfile_request (const QString& fname,
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1395 const QString& ffile,
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1396 const QString& curr_dir,
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1397 int line)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1398 {
31724
340d016c2edf maint: Merge stable to default.
John W. Eaton <jwe@octave.org>
parents: 31718 31723
diff changeset
1399 // The interpreter_event callback function below emits a signal.
340d016c2edf maint: Merge stable to default.
John W. Eaton <jwe@octave.org>
parents: 31718 31723
diff changeset
1400 // Because we don't control when that happens, use a guarded pointer
340d016c2edf maint: Merge stable to default.
John W. Eaton <jwe@octave.org>
parents: 31718 31723
diff changeset
1401 // so that the callback can abort if this object is no longer valid.
340d016c2edf maint: Merge stable to default.
John W. Eaton <jwe@octave.org>
parents: 31718 31723
diff changeset
1402
340d016c2edf maint: Merge stable to default.
John W. Eaton <jwe@octave.org>
parents: 31718 31723
diff changeset
1403 QPointer<main_window> this_mw (this);
340d016c2edf maint: Merge stable to default.
John W. Eaton <jwe@octave.org>
parents: 31718 31723
diff changeset
1404
27377
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1405 emit interpreter_event
28851
1ac5a76ae91d use [=] capture default specification where possible
John W. Eaton <jwe@octave.org>
parents: 28847
diff changeset
1406 ([=] (interpreter& interp)
27377
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1407 {
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1408 // INTERPRETER THREAD
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1409
31724
340d016c2edf maint: Merge stable to default.
John W. Eaton <jwe@octave.org>
parents: 31718 31723
diff changeset
1410 // We can skip the entire callback function because it does not
340d016c2edf maint: Merge stable to default.
John W. Eaton <jwe@octave.org>
parents: 31718 31723
diff changeset
1411 // make any changes to the interpreter state.
340d016c2edf maint: Merge stable to default.
John W. Eaton <jwe@octave.org>
parents: 31718 31723
diff changeset
1412
340d016c2edf maint: Merge stable to default.
John W. Eaton <jwe@octave.org>
parents: 31718 31723
diff changeset
1413 if (this_mw.isNull ())
340d016c2edf maint: Merge stable to default.
John W. Eaton <jwe@octave.org>
parents: 31718 31723
diff changeset
1414 return;
340d016c2edf maint: Merge stable to default.
John W. Eaton <jwe@octave.org>
parents: 31718 31723
diff changeset
1415
27893
465ac679e976 Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents: 27860
diff changeset
1416 // Split possible subfunctions
27377
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1417 QStringList fcn_list = fname.split ('>');
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1418 QString fcn_name = fcn_list.at (0) + ".m";
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1419
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1420 // FIXME: could use symbol_exist directly, but we may also want
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1421 // to fix that to be a member function in the interpreter
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1422 // class?
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1423
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1424 // Is it a regular function within the search path? (Call Fexist)
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1425 octave_value_list fct = Fexist (interp, ovl (fname.toStdString ()),0);
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1426 int type = fct (0).int_value ();
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1427
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1428 QString message = QString ();
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1429 QString filename = QString ();
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1430
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1431 switch (type)
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1432 {
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1433 case 3:
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1434 case 5:
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1435 case 103:
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1436 message = tr ("%1 is a built-in, compiled or inline\n"
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1437 "function and can not be edited.");
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1438 break;
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1439
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1440 case 2:
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1441 // FIXME: could use a load_path function directly.
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1442 octave_value_list file_path
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1443 = Ffile_in_loadpath (interp, ovl (fcn_name.toStdString ()), 0);
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1444 if (file_path.length () > 0)
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1445 filename = QString::fromStdString (file_path (0).string_value ());
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1446 break;
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1447 }
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1448
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1449 if (filename.isEmpty () && message.isEmpty ())
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1450 {
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1451 // No error so far, but function still not known
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1452 // -> try directory of edited file
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1453 // get directory
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1454 QDir dir;
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1455 if (ffile.isEmpty ())
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1456 {
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1457 if (curr_dir.isEmpty ())
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1458 dir = QDir (m_current_directory_combo_box->itemText (0));
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1459 else
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1460 dir = QDir (curr_dir);
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1461 }
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1462 else
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1463 dir = QDir (QFileInfo (ffile).canonicalPath ());
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1464
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1465 QFileInfo file = QFileInfo (dir, fcn_name);
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1466 if (file.exists ())
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1467 filename = file.canonicalFilePath (); // local file exists
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1468 else
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1469 {
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1470 // local file does not exist -> try private directory
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1471 file = QFileInfo (ffile);
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1472 file = QFileInfo (QDir (file.canonicalPath () + "/private"),
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1473 fcn_name);
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1474 if (file.exists ())
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1475 filename = file.canonicalFilePath (); // private function exists
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1476 else
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1477 message = tr ("Can not find function %1"); // no file found
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1478 }
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1479 }
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1480
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1481 if (! message.isEmpty ())
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1482 {
27653
3564d3999960 fix message box when trying to open a non-existant function in the editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27648
diff changeset
1483 emit warning_function_not_found_signal (message.arg (fname));
27377
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1484 return;
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1485 }
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1486
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1487 if (! filename.endsWith (".m"))
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1488 filename.append (".m");
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1489
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1490 // default encoding
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1491 emit open_file_signal (filename, QString (), line);
5ca84fb30205 use event manager to handle two more interpreter actions in GUI
John W. Eaton <jwe@octave.org>
parents: 27375
diff changeset
1492 });
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1493 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1494
27653
3564d3999960 fix message box when trying to open a non-existant function in the editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27648
diff changeset
1495 void main_window::warning_function_not_found (const QString& message)
3564d3999960 fix message box when trying to open a non-existant function in the editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27648
diff changeset
1496 {
3564d3999960 fix message box when trying to open a non-existant function in the editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27648
diff changeset
1497 QMessageBox *msgBox = new QMessageBox (QMessageBox::Critical,
3564d3999960 fix message box when trying to open a non-existant function in the editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27648
diff changeset
1498 tr ("Octave Editor"),
3564d3999960 fix message box when trying to open a non-existant function in the editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27648
diff changeset
1499 message, QMessageBox::Ok, this);
3564d3999960 fix message box when trying to open a non-existant function in the editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27648
diff changeset
1500 msgBox->setWindowModality (Qt::NonModal);
3564d3999960 fix message box when trying to open a non-existant function in the editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27648
diff changeset
1501 msgBox->setAttribute (Qt::WA_DeleteOnClose);
3564d3999960 fix message box when trying to open a non-existant function in the editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27648
diff changeset
1502 msgBox->show ();
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1503 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1504
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1505 void main_window::handle_insert_debugger_pointer_request (const QString& file,
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1506 int line)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1507 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1508 bool cmd_focus = command_window_has_focus ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1509
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1510 emit insert_debugger_pointer_signal (file, line);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1511
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1512 if (cmd_focus)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1513 focus_command_window ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1514 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1515
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1516 void main_window::handle_delete_debugger_pointer_request (const QString& file,
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1517 int line)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1518 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1519 bool cmd_focus = command_window_has_focus ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1520
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1521 emit delete_debugger_pointer_signal (file, line);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1522
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1523 if (cmd_focus)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1524 focus_command_window ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1525 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1526
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1527 void main_window::handle_update_breakpoint_marker_request (bool insert,
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1528 const QString& file,
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1529 int line,
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1530 const QString& cond)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1531 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1532 bool cmd_focus = command_window_has_focus ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1533
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1534 emit update_breakpoint_marker_signal (insert, file, line, cond);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1535
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1536 if (cmd_focus)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1537 focus_command_window ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1538 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1539
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1540 void main_window::read_settings ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1541 {
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1542 gui_settings settings;
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1543
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1544 set_window_layout ();
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1545
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1546 // restore the list of the last directories
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
1547 QStringList curr_dirs = settings.string_list_value (mw_dir_list);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1548 for (int i=0; i < curr_dirs.size (); i++)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1549 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1550 m_current_directory_combo_box->addItem (curr_dirs.at (i));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1551 }
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1552
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1553 emit settings_changed ();
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1554 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1555
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1556 void main_window::init_terminal_size ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1557 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1558 emit init_terminal_size_signal ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1559 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1560
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1561 void main_window::set_window_layout ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1562 {
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1563 gui_settings settings;
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1564
29450
6448a10a642a fix restoring the horizontal position of docked gui widgets (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29447
diff changeset
1565 // For resetting from some inconsistent state, first reset layout
6448a10a642a fix restoring the horizontal position of docked gui widgets (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29447
diff changeset
1566 // without saving or showing it
6448a10a642a fix restoring the horizontal position of docked gui widgets (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29447
diff changeset
1567 do_reset_windows (true, false);
6448a10a642a fix restoring the horizontal position of docked gui widgets (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29447
diff changeset
1568
26299
c95884eed1cf make restoring gui more robust to changes of desktop size (bug #53207)
Torsten <mttl@mailbox.org>
parents: 26277
diff changeset
1569 // Restore main window state and geometry from settings file or, in case
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
1570 // of an error (no pref values yet), from the default layout.
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
1571 if (! restoreGeometry (settings.byte_array_value (mw_geometry)))
26307
a21f58c5e573 fix resetting gui window layout
Torsten <mttl@mailbox.org>
parents: 26299
diff changeset
1572 {
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
1573 do_reset_windows (true);
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
1574 return;
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
1575 }
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
1576
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
1577 if (isMaximized())
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
1578 {
30639
6ad5bb8f6a6d fix masimized start on systems with two monitors (bug #61172)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30564
diff changeset
1579 // If the window state is restored to maximized layout, the
6ad5bb8f6a6d fix masimized start on systems with two monitors (bug #61172)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30564
diff changeset
1580 // horizontal layout is not preserved. This cann be avoided by
6ad5bb8f6a6d fix masimized start on systems with two monitors (bug #61172)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30564
diff changeset
1581 // setting the geometry to the max. available geometry. However, on
6ad5bb8f6a6d fix masimized start on systems with two monitors (bug #61172)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30564
diff changeset
1582 // X11, the available geometry (excluding task bar etc.) is equal to
6ad5bb8f6a6d fix masimized start on systems with two monitors (bug #61172)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30564
diff changeset
1583 // the total geometry leading to a full screen mode without window
31179
a44009224387 ensure window decorations when restoring maximized main window (bug #61172)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31068
diff changeset
1584 // decorations. This in turn can be avoided by explicitly adding
a44009224387 ensure window decorations when restoring maximized main window (bug #61172)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31068
diff changeset
1585 // a title bar in the window flags.
a44009224387 ensure window decorations when restoring maximized main window (bug #61172)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31068
diff changeset
1586
a44009224387 ensure window decorations when restoring maximized main window (bug #61172)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31068
diff changeset
1587 // Get available geometry for current screen and set this
a44009224387 ensure window decorations when restoring maximized main window (bug #61172)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31068
diff changeset
1588 // window's geometry to it.
30743
96f018336be9 * main-window.cc (main_window::set_window_layout): Eliminate unused variable.
John W. Eaton <jwe@octave.org>
parents: 30742
diff changeset
1589 QScreen *s = windowHandle ()->screen ();
96f018336be9 * main-window.cc (main_window::set_window_layout): Eliminate unused variable.
John W. Eaton <jwe@octave.org>
parents: 30742
diff changeset
1590 QRect av_geom = s->availableGeometry ();
31179
a44009224387 ensure window decorations when restoring maximized main window (bug #61172)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31068
diff changeset
1591 setGeometry (av_geom); // Set (correct) available geometry
a44009224387 ensure window decorations when restoring maximized main window (bug #61172)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31068
diff changeset
1592
a44009224387 ensure window decorations when restoring maximized main window (bug #61172)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31068
diff changeset
1593 // Force full title bar
a44009224387 ensure window decorations when restoring maximized main window (bug #61172)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31068
diff changeset
1594 setWindowFlags(Qt::WindowTitleHint
a44009224387 ensure window decorations when restoring maximized main window (bug #61172)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31068
diff changeset
1595 | Qt::WindowMinMaxButtonsHint
a44009224387 ensure window decorations when restoring maximized main window (bug #61172)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31068
diff changeset
1596 | Qt::WindowSystemMenuHint
a44009224387 ensure window decorations when restoring maximized main window (bug #61172)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31068
diff changeset
1597 | Qt::WindowCloseButtonHint);
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
1598 }
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
1599
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
1600 if (! restoreState (settings.byte_array_value (mw_state)))
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
1601 {
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
1602 do_reset_windows (true);
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
1603 return;
26307
a21f58c5e573 fix resetting gui window layout
Torsten <mttl@mailbox.org>
parents: 26299
diff changeset
1604 }
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1605
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1606 // Restore the geometry of all dock-widgets
29754
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
1607
27676
ea7d36e9f197 use standard C++ range-based for loops instead of Qt foreach macro
John W. Eaton <jwe@octave.org>
parents: 27672
diff changeset
1608 for (auto *widget : dock_widget_list ())
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1609 {
29754
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
1610 // Leave any widgets that existed before main_window was created
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
1611 // as they were.
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
1612
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
1613 if (widget->adopted ())
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
1614 continue;
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
1615
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1616 QString name = widget->objectName ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1617
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1618 if (! name.isEmpty ())
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1619 {
26307
a21f58c5e573 fix resetting gui window layout
Torsten <mttl@mailbox.org>
parents: 26299
diff changeset
1620 bool floating = false;
a21f58c5e573 fix resetting gui window layout
Torsten <mttl@mailbox.org>
parents: 26299
diff changeset
1621 bool visible = true;
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
1622
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1623 floating = settings.value
31702
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
1624 (dw_is_floating.settings_key ().arg (name), dw_is_floating.def ()).toBool ();
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1625 visible = settings.value
31702
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
1626 (dw_is_visible.settings_key ().arg (name), dw_is_visible.def ()).toBool ();
17899
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
1627
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1628 // If floating, make window from widget.
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1629 if (floating)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1630 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1631 widget->make_window ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1632
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1633 if (visible)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1634 {
31702
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
1635 if (settings.value (dw_is_minimized.settings_key ().arg (name),
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
1636 dw_is_minimized.def ()).toBool ())
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1637 widget->showMinimized ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1638 else
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1639 widget->setVisible (true);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1640 }
29459
4ae7e80fb7c5 prevent floating widgets from reopening after restart (bug #60279)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29450
diff changeset
1641 else
4ae7e80fb7c5 prevent floating widgets from reopening after restart (bug #60279)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29450
diff changeset
1642 widget->setVisible (false);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1643 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1644 else // not floating
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1645 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1646 if (! widget->parent ()) // should not be floating but is
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1647 widget->make_widget (false); // no docking, just reparent
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1648
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1649 widget->make_widget ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1650 widget->setVisible (visible); // not floating -> show
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1651 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1652 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1653 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1654
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1655 show ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1656 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1657
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1658 void main_window::write_settings ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1659 {
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1660 gui_settings settings;
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1661
31702
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
1662 settings.setValue (mw_geometry.settings_key (), saveGeometry ());
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
1663 settings.setValue (mw_state.settings_key (), saveState ());
27893
465ac679e976 Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents: 27860
diff changeset
1664 // write the list of recently used directories
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1665 QStringList curr_dirs;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1666 for (int i=0; i<m_current_directory_combo_box->count (); i++)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1667 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1668 curr_dirs.append (m_current_directory_combo_box->itemText (i));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1669 }
31702
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
1670 settings.setValue (mw_dir_list.settings_key (), curr_dirs);
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1671 settings.sync ();
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1672 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1673
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1674 void main_window::copyClipboard ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1675 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1676 if (m_current_directory_combo_box->hasFocus ())
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1677 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1678 QLineEdit *edit = m_current_directory_combo_box->lineEdit ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1679 if (edit && edit->hasSelectedText ())
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1680 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1681 QClipboard *clipboard = QApplication::clipboard ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1682 clipboard->setText (edit->selectedText ());
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1683 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1684 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1685 else
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1686 emit copyClipboard_signal ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1687 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1688
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1689 void main_window::pasteClipboard ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1690 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1691 if (m_current_directory_combo_box->hasFocus ())
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1692 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1693 QLineEdit *edit = m_current_directory_combo_box->lineEdit ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1694 QClipboard *clipboard = QApplication::clipboard ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1695 QString str = clipboard->text ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1696 if (edit && str.length () > 0)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1697 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1698 edit->insert (str);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1699 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1700 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1701 else
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1702 emit pasteClipboard_signal ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1703 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1704
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1705 void main_window::selectAll ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1706 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1707 if (m_current_directory_combo_box->hasFocus ())
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1708 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1709 QLineEdit *edit = m_current_directory_combo_box->lineEdit ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1710 if (edit)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1711 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1712 edit->selectAll ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1713 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1714 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1715 else
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1716 emit selectAll_signal ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1717 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1718
29057
450920c987b8 update profiler status in gui from interpreter
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29040
diff changeset
1719 void main_window::handle_gui_status_update (const QString& feature,
450920c987b8 update profiler status in gui from interpreter
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29040
diff changeset
1720 const QString& status)
450920c987b8 update profiler status in gui from interpreter
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29040
diff changeset
1721 {
450920c987b8 update profiler status in gui from interpreter
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29040
diff changeset
1722 // Put actions that are required for updating a gui features here
450920c987b8 update profiler status in gui from interpreter
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29040
diff changeset
1723
450920c987b8 update profiler status in gui from interpreter
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29040
diff changeset
1724 // Profiler on/off
450920c987b8 update profiler status in gui from interpreter
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29040
diff changeset
1725 if (! feature.compare ("profiler"))
450920c987b8 update profiler status in gui from interpreter
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29040
diff changeset
1726 {
450920c987b8 update profiler status in gui from interpreter
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29040
diff changeset
1727 if (! status.compare ("on", Qt::CaseInsensitive))
450920c987b8 update profiler status in gui from interpreter
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29040
diff changeset
1728 handle_profiler_status_update (true);
450920c987b8 update profiler status in gui from interpreter
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29040
diff changeset
1729 else if (! status.compare ("off", Qt::CaseInsensitive))
450920c987b8 update profiler status in gui from interpreter
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29040
diff changeset
1730 handle_profiler_status_update (false);
450920c987b8 update profiler status in gui from interpreter
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29040
diff changeset
1731 }
450920c987b8 update profiler status in gui from interpreter
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29040
diff changeset
1732 }
450920c987b8 update profiler status in gui from interpreter
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29040
diff changeset
1733
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1734 void main_window::handle_octave_ready ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1735 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1736 // actions after the startup files are executed
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1737
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1738 gui_settings settings;
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1739
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1740 QDir startup_dir = QDir (); // current octave dir after startup
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1741
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
1742 if (settings.bool_value (global_restore_ov_dir))
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1743 {
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1744 // restore last dir from previous session
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1745 QStringList curr_dirs
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
1746 = settings.string_list_value (mw_dir_list);
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1747 if (curr_dirs.length () > 0)
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1748 startup_dir = QDir (curr_dirs.at (0)); // last dir prev. session
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1749 }
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
1750 else if (! settings.string_value (global_ov_startup_dir).isEmpty ())
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1751 {
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1752 // do not restore but there is a startup dir configured
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1753 startup_dir
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
1754 = QDir (settings.string_value (global_ov_startup_dir));
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1755 }
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1756
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
1757 update_default_encoding (settings.string_value (ed_default_enc));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1758
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
1759 if (! startup_dir.exists ())
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
1760 {
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
1761 // the configured startup dir does not exist, take actual one
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
1762 startup_dir = QDir ();
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
1763 }
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
1764
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1765 set_current_working_directory (startup_dir.absolutePath ());
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1766
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1767 if (m_editor_window)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1768 {
27039
32d9f57d7245 fix missing unlock of mutex when gui editor is not present (bug #56097)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 26643
diff changeset
1769 #if defined (HAVE_QSCINTILLA)
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1770 // Octave ready, determine whether to create an empty script.
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1771 // This can not be done when the editor is created because all functions
27956
2310164737b3 fix many spelling errors (bug #57613)
John W. Eaton <jwe@octave.org>
parents: 27041
diff changeset
1772 // must be known for the lexer's auto completion information
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1773 m_editor_window->empty_script (true, false);
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1774 m_editor_window->restore_session ();
27039
32d9f57d7245 fix missing unlock of mutex when gui editor is not present (bug #56097)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 26643
diff changeset
1775 #endif
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1776 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1777
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
1778 if (m_octave_qobj.experimental_terminal_widget ())
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
1779 {
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
1780 // Set initial prompt.
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
1781
31726
eacd3dee4b01 eliminate some uses of the event manager in GUI callback functions
John W. Eaton <jwe@octave.org>
parents: 31724
diff changeset
1782 // The interpreter_event callback function below emits a
eacd3dee4b01 eliminate some uses of the event manager in GUI callback functions
John W. Eaton <jwe@octave.org>
parents: 31724
diff changeset
1783 // signal. Because we don't control when that happens, use a
eacd3dee4b01 eliminate some uses of the event manager in GUI callback functions
John W. Eaton <jwe@octave.org>
parents: 31724
diff changeset
1784 // guarded pointer so that the callback can abort if this object
eacd3dee4b01 eliminate some uses of the event manager in GUI callback functions
John W. Eaton <jwe@octave.org>
parents: 31724
diff changeset
1785 // is no longer valid.
eacd3dee4b01 eliminate some uses of the event manager in GUI callback functions
John W. Eaton <jwe@octave.org>
parents: 31724
diff changeset
1786
eacd3dee4b01 eliminate some uses of the event manager in GUI callback functions
John W. Eaton <jwe@octave.org>
parents: 31724
diff changeset
1787 QPointer<main_window> this_mw (this);
eacd3dee4b01 eliminate some uses of the event manager in GUI callback functions
John W. Eaton <jwe@octave.org>
parents: 31724
diff changeset
1788
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
1789 emit interpreter_event
31726
eacd3dee4b01 eliminate some uses of the event manager in GUI callback functions
John W. Eaton <jwe@octave.org>
parents: 31724
diff changeset
1790 ([=] (interpreter& interp)
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
1791 {
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
1792 // INTERPRETER_THREAD
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
1793
31726
eacd3dee4b01 eliminate some uses of the event manager in GUI callback functions
John W. Eaton <jwe@octave.org>
parents: 31724
diff changeset
1794 // We can skip the entire callback function because it does
eacd3dee4b01 eliminate some uses of the event manager in GUI callback functions
John W. Eaton <jwe@octave.org>
parents: 31724
diff changeset
1795 // not make any changes to the interpreter state.
eacd3dee4b01 eliminate some uses of the event manager in GUI callback functions
John W. Eaton <jwe@octave.org>
parents: 31724
diff changeset
1796
eacd3dee4b01 eliminate some uses of the event manager in GUI callback functions
John W. Eaton <jwe@octave.org>
parents: 31724
diff changeset
1797 if (this_mw.isNull ())
eacd3dee4b01 eliminate some uses of the event manager in GUI callback functions
John W. Eaton <jwe@octave.org>
parents: 31724
diff changeset
1798 return;
eacd3dee4b01 eliminate some uses of the event manager in GUI callback functions
John W. Eaton <jwe@octave.org>
parents: 31724
diff changeset
1799
31727
1f04951057bf avoid some calls to get_input_system and get_evaluator
John W. Eaton <jwe@octave.org>
parents: 31726
diff changeset
1800 interp.PS1 (">> ");
1f04951057bf avoid some calls to get_input_system and get_evaluator
John W. Eaton <jwe@octave.org>
parents: 31726
diff changeset
1801 std::string prompt = interp.PS1 ();
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
1802
31726
eacd3dee4b01 eliminate some uses of the event manager in GUI callback functions
John W. Eaton <jwe@octave.org>
parents: 31724
diff changeset
1803 std::string decoded_prompt
eacd3dee4b01 eliminate some uses of the event manager in GUI callback functions
John W. Eaton <jwe@octave.org>
parents: 31724
diff changeset
1804 = command_editor::decode_prompt_string (prompt);
eacd3dee4b01 eliminate some uses of the event manager in GUI callback functions
John W. Eaton <jwe@octave.org>
parents: 31724
diff changeset
1805
eacd3dee4b01 eliminate some uses of the event manager in GUI callback functions
John W. Eaton <jwe@octave.org>
parents: 31724
diff changeset
1806 emit update_prompt_signal (QString::fromStdString (decoded_prompt));
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
1807 });
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
1808 }
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
1809
31067
5261a81765b0 merge input and output of exp. terminal widget into one widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 31009
diff changeset
1810 m_command_window->init_command_prompt ();
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
1811 focus_command_window (); // make sure that the command window has focus
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1812 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1813
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1814 void main_window::handle_set_path_dialog_request ()
27298
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents: 27287
diff changeset
1815 {
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents: 27287
diff changeset
1816 if (m_set_path_dlg) // m_set_path_dlg is a guarded pointer!
27611
0495b64288f7 use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents: 27602
diff changeset
1817 return;
27298
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents: 27287
diff changeset
1818
31639
ca7d58406f82 eliminate unnecessary uses of octave_qobject in GUI classes
John W. Eaton <jwe@octave.org>
parents: 31638
diff changeset
1819 m_set_path_dlg = new set_path_dialog (this);
27298
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents: 27287
diff changeset
1820
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents: 27287
diff changeset
1821 m_set_path_dlg->setModal (false);
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents: 27287
diff changeset
1822 m_set_path_dlg->setAttribute (Qt::WA_DeleteOnClose);
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents: 27287
diff changeset
1823 m_set_path_dlg->show ();
27306
82ace1225a9c update path dialog if path is changed from withtin the file browser
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27302
diff changeset
1824
27391
a329a41cf341 use interpreter_event signals in set_path_dialog object
John W. Eaton <jwe@octave.org>
parents: 27377
diff changeset
1825 // Any interpreter_event signal from a set_path_dialog object is
a329a41cf341 use interpreter_event signals in set_path_dialog object
John W. Eaton <jwe@octave.org>
parents: 27377
diff changeset
1826 // handled the same as for the main_window object.
a329a41cf341 use interpreter_event signals in set_path_dialog object
John W. Eaton <jwe@octave.org>
parents: 27377
diff changeset
1827
29542
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1828 connect (m_set_path_dlg, QOverload<const fcn_callback&>::of (&set_path_dialog::interpreter_event),
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1829 this, QOverload<const fcn_callback&>::of (&main_window::interpreter_event));
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1830
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1831 connect (m_set_path_dlg, QOverload<const meth_callback&>::of (&set_path_dialog::interpreter_event),
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1832 this, QOverload<const meth_callback&>::of (&main_window::interpreter_event));
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1833
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1834 connect (m_set_path_dlg, &set_path_dialog::modify_path_signal,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1835 this, &main_window::modify_path);
27308
401a7cda7c9e add possibility for adding dir with subdirectories to load path dialog
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27306
diff changeset
1836
27311
0040b7668518 update load path dialog when path is modified via console
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27308
diff changeset
1837 interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj ();
27391
a329a41cf341 use interpreter_event signals in set_path_dialog object
John W. Eaton <jwe@octave.org>
parents: 27377
diff changeset
1838
27311
0040b7668518 update load path dialog when path is modified via console
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27308
diff changeset
1839 qt_interpreter_events *qt_link = interp_qobj->qt_link ();
27391
a329a41cf341 use interpreter_event signals in set_path_dialog object
John W. Eaton <jwe@octave.org>
parents: 27377
diff changeset
1840
29542
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1841 connect (qt_link, &qt_interpreter_events::update_path_dialog_signal,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1842 m_set_path_dlg, &set_path_dialog::update_model);
27391
a329a41cf341 use interpreter_event signals in set_path_dialog object
John W. Eaton <jwe@octave.org>
parents: 27377
diff changeset
1843
a329a41cf341 use interpreter_event signals in set_path_dialog object
John W. Eaton <jwe@octave.org>
parents: 27377
diff changeset
1844 // Now that all the signal connections are in place for the dialog
a329a41cf341 use interpreter_event signals in set_path_dialog object
John W. Eaton <jwe@octave.org>
parents: 27377
diff changeset
1845 // we can set the initial value of the path in the model.
a329a41cf341 use interpreter_event signals in set_path_dialog object
John W. Eaton <jwe@octave.org>
parents: 27377
diff changeset
1846
a329a41cf341 use interpreter_event signals in set_path_dialog object
John W. Eaton <jwe@octave.org>
parents: 27377
diff changeset
1847 m_set_path_dlg->update_model ();
27298
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents: 27287
diff changeset
1848 }
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents: 27287
diff changeset
1849
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1850 void main_window::find_files (const QString& start_dir)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1851 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1852
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1853 if (! m_find_files_dlg)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1854 {
31639
ca7d58406f82 eliminate unnecessary uses of octave_qobject in GUI classes
John W. Eaton <jwe@octave.org>
parents: 31638
diff changeset
1855 m_find_files_dlg = new find_files_dialog (this);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1856
29542
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1857 connect (m_find_files_dlg, &find_files_dialog::finished,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1858 this, &main_window::find_files_finished);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1859
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1860 connect (m_find_files_dlg, &find_files_dialog::dir_selected,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1861 m_file_browser_window, &files_dock_widget::set_current_directory);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1862
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1863 connect (m_find_files_dlg, &find_files_dialog::file_selected,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
1864 this, QOverload<const QString&>::of (&main_window::open_file_signal));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1865
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1866 m_find_files_dlg->setWindowModality (Qt::NonModal);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1867 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1868
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1869 if (! m_find_files_dlg->isVisible ())
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1870 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1871 m_find_files_dlg->show ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1872 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1873
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1874 m_find_files_dlg->set_search_dir (start_dir);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1875
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1876 m_find_files_dlg->activateWindow ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1877
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1878 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1879
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1880 void main_window::set_screen_size (int ht, int wd)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1881 {
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
1882 emit interpreter_event
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1883 ([=] ()
27243
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
1884 {
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
1885 // INTERPRETER THREAD
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
1886
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
1887 command_editor::set_screen_size (ht, wd);
c6807f5cc48b replace some explicit callback functions with lambda expressions
John W. Eaton <jwe@octave.org>
parents: 27220
diff changeset
1888 });
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1889 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1890
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1891 void main_window::clipboard_has_changed ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1892 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1893 if (m_clipboard->text ().isEmpty ())
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1894 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1895 m_paste_action->setEnabled (false);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1896 m_clear_clipboard_action->setEnabled (false);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1897 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1898 else
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1899 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1900 m_paste_action->setEnabled (true);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1901 m_clear_clipboard_action->setEnabled (true);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1902 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1903 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1904
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1905 void main_window::clear_clipboard ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1906 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1907 m_clipboard->clear (QClipboard::Clipboard);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1908 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1909
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1910 void main_window::disable_menu_shortcuts (bool disable)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1911 {
30398
d4d83344d653 maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29895
diff changeset
1912 QHash<QMenu *, QStringList>::const_iterator i = m_hash_menu_text.constBegin ();
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1913
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1914 while (i != m_hash_menu_text.constEnd ())
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1915 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1916 i.key ()->setTitle (i.value ().at (disable));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1917 ++i;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1918 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1919 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1920
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1921 void main_window::restore_create_file_setting ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1922 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1923 // restore the new files creation setting
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1924
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1925 gui_settings settings;
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
1926
31702
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
1927 settings.setValue (ed_create_new_file.settings_key (), false);
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1928 disconnect (m_editor_window, SIGNAL (file_loaded_signal ()),
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1929 this, SLOT (restore_create_file_setting ()));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1930 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1931
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1932 void main_window::set_file_encoding (const QString& new_encoding)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1933 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1934 m_file_encoding = new_encoding;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1935 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1936
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1937 // The following slot is called after files have been selected in the
27893
465ac679e976 Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents: 27860
diff changeset
1938 // open file dialog, possibly with a new selected encoding stored in
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1939 // m_file_encoding
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1940 void main_window::request_open_files (const QStringList& open_file_names)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1941 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1942 for (int i = 0; i < open_file_names.count (); i++)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1943 emit open_file_signal (open_file_names.at (i), m_file_encoding, -1);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1944 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
1945
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1946 void main_window::profiler_session ()
29040
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1947 {
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1948 emit interpreter_event
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1949 ([=] (interpreter& interp)
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1950 {
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1951 // INTERPRETER THREAD
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1952
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1953 Ffeval (interp, ovl ("profile","on"));
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1954 });
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1955 }
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1956
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1957 void main_window::profiler_session_resume ()
29040
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1958 {
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1959 emit interpreter_event
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1960 ([=] (interpreter& interp)
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1961 {
29040
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1962 // INTERPRETER THREAD
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1963
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1964 Ffeval (interp, ovl ("profile","resume"));
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1965 });
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1966 }
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1967
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1968 void main_window::profiler_stop ()
29040
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1969 {
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1970 emit interpreter_event
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1971 ([=] (interpreter& interp)
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1972 {
29040
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1973 // INTERPRETER THREAD
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1974
29057
450920c987b8 update profiler status in gui from interpreter
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29040
diff changeset
1975 Ffeval (interp, ovl ("profile","off"));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
1976 });
29040
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1977 }
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1978
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1979 void main_window::handle_profiler_status_update (bool active)
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1980 {
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1981 m_profiler_start->setEnabled (! active);
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1982 m_profiler_resume->setEnabled (! active);
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1983 m_profiler_stop->setEnabled (active);
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1984
29061
8a425e771aa7 use a led like indicator for the prfiler state
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29057
diff changeset
1985 led_indicator::led_state state = led_indicator::LED_STATE_INACTIVE;
29040
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1986 if (active)
29061
8a425e771aa7 use a led like indicator for the prfiler state
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29057
diff changeset
1987 state = led_indicator::LED_STATE_ACTIVE;
8a425e771aa7 use a led like indicator for the prfiler state
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29057
diff changeset
1988 m_profiler_status_indicator->set_state (state);
29040
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1989 }
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1990
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
1991 void main_window::profiler_show ()
29040
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1992 {
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1993 // Do not use a separate interpreter event as in the other
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1994 // profiler slots since the output of the command "profshow"
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1995 // would obscure the prompt and we do not need to emimt a signal
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1996 // for action that is required in the gui after rhe command
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1997 execute_command_in_terminal ("profshow");
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1998 }
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
1999
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2000 void main_window::closeEvent (QCloseEvent *e)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2001 {
29761
3b5ffc4c70e9 more tweaks for main window and dock widget settings
John W. Eaton <jwe@octave.org>
parents: 29760
diff changeset
2002 write_settings ();
3b5ffc4c70e9 more tweaks for main window and dock widget settings
John W. Eaton <jwe@octave.org>
parents: 29760
diff changeset
2003
27588
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
2004 if (confirm_shutdown ())
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
2005 {
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
2006 // FIXME: Instead of ignoring the event and posting an
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
2007 // interpreter event, should we just accept the event and
29761
3b5ffc4c70e9 more tweaks for main window and dock widget settings
John W. Eaton <jwe@octave.org>
parents: 29760
diff changeset
2008 // shutdown and clean up the interpreter as part of closing the
27588
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
2009 // GUI? Going that route might make it easier to close the GUI
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
2010 // without having to stop the interpreter, for example, if the
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
2011 // GUI is started from the interpreter command line.
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
2012
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
2013 e->ignore ();
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
2014
30740
d6ca77706ab3 shutdown via interpreter with experimental terminal in gui mode (bug #61994)
John W. Eaton <jwe@octave.org>
parents: 30722
diff changeset
2015 if (m_octave_qobj.experimental_terminal_widget ()
d6ca77706ab3 shutdown via interpreter with experimental terminal in gui mode (bug #61994)
John W. Eaton <jwe@octave.org>
parents: 30722
diff changeset
2016 && ! m_octave_qobj.is_gui_app ())
29503
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
2017 emit close_gui_signal ();
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
2018 else
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
2019 {
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
2020 emit interpreter_event
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
2021 ([] (interpreter& interp)
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
2022 {
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
2023 // INTERPRETER THREAD
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
2024
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
2025 interp.quit (0, false, false);
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
2026 });
3bfec185c9e2 experimental command window widget with server loop
John W. Eaton <jwe@octave.org>
parents: 29474
diff changeset
2027 }
27588
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
2028 }
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
2029 else
f0e3f3e28a8e move qt_interpreter_events object from interpreter_qobject to octave_qobject
John W. Eaton <jwe@octave.org>
parents: 27583
diff changeset
2030 e->ignore ();
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2031 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2032
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2033 void main_window::construct_central_widget ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2034 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2035 // Create and set the central widget. QMainWindow takes ownership of
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2036 // the widget (pointer) so there is no need to delete the object upon
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2037 // destroying this main_window.
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2038
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2039 QWidget *dummyWidget = new QWidget ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2040 dummyWidget->setObjectName ("CentralDummyWidget");
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2041 dummyWidget->resize (10, 10);
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2042 dummyWidget->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2043 dummyWidget->hide ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2044 setCentralWidget (dummyWidget);
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
2045 }
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
2046
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
2047 // Main subroutine of the constructor
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
2048
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2049 void main_window::construct ()
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
2050 {
30964
04601f6c47f4 fix broken icon path after new icon structure in GUI
Torsten Lilge <ttl-octave@mailbox.org>
parents: 30811
diff changeset
2051 setWindowIcon (QIcon (dw_icon_set_names["NONE"]));
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
2052
27218
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27209
diff changeset
2053 interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj ();
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27209
diff changeset
2054
27263
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27261
diff changeset
2055 qt_interpreter_events *qt_link = interp_qobj->qt_link ();
27218
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27209
diff changeset
2056
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
2057 construct_menu_bar ();
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
2058
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
2059 construct_tool_bar ();
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
2060
29796
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
2061 // FIXME: Is this action intended to be about quitting application
a0fce019cd1f additional reorganization of signal/slot connections in main_window class
John W. Eaton <jwe@octave.org>
parents: 29788
diff changeset
2062 // or closing the main window?
29542
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2063 connect (qApp, &QApplication::aboutToQuit,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2064 this, &main_window::prepare_to_exit);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2065
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2066 connect (qApp, &QApplication::focusChanged,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2067 this, &main_window::focus_changed);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2068
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
2069 // Default argument requires wrapper.
29542
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2070 connect (this, &main_window::settings_changed,
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
2071 this, [=] () { notice_settings (); });
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
2072
27653
3564d3999960 fix message box when trying to open a non-existant function in the editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27648
diff changeset
2073 // Connections for signals from the interpreter thread where the slot
3564d3999960 fix message box when trying to open a non-existant function in the editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27648
diff changeset
2074 // should be executed by the gui thread
3564d3999960 fix message box when trying to open a non-existant function in the editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27648
diff changeset
2075
29542
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2076 connect (this, &main_window::warning_function_not_found_signal,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2077 this, &main_window::warning_function_not_found);
27653
3564d3999960 fix message box when trying to open a non-existant function in the editor
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27648
diff changeset
2078
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
2079 setWindowTitle ("Octave");
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
2080
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
2081 setStatusBar (m_status_bar);
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2082
27039
32d9f57d7245 fix missing unlock of mutex when gui editor is not present (bug #56097)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 26643
diff changeset
2083 // Signals for removing/renaming files/dirs in the temrinal window
29542
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2084 connect (qt_link, &qt_interpreter_events::file_remove_signal,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2085 this, &main_window::file_remove_proxy);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2086
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2087 connect (this, QOverload<const fcn_callback&>::of (&main_window::interpreter_event),
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2088 &m_octave_qobj, QOverload<const fcn_callback&>::of (&base_qobject::interpreter_event));
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2089
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2090 connect (this, QOverload<const meth_callback&>::of (&main_window::interpreter_event),
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2091 &m_octave_qobj, QOverload<const meth_callback&>::of (&base_qobject::interpreter_event));
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
2092
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
2093 configure_shortcuts ();
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2094 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2095
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2096 void main_window::construct_octave_qt_link ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2097 {
27218
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27209
diff changeset
2098 interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj ();
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27209
diff changeset
2099
27263
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27261
diff changeset
2100 qt_interpreter_events *qt_link = interp_qobj->qt_link ();
27218
a044202208af more refactoring of GUI classes that manage the interpreter
John W. Eaton <jwe@octave.org>
parents: 27209
diff changeset
2101
29542
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2102 connect (qt_link, &qt_interpreter_events::settings_changed,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2103 this, &main_window::notice_settings);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2104
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2105 connect (qt_link, &qt_interpreter_events::apply_new_settings,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2106 this, &main_window::request_reload_settings);
27602
ba317c535adb define new __event_manager_apply_preferences__ function
John W. Eaton <jwe@octave.org>
parents: 27601
diff changeset
2107
29542
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2108 connect (qt_link, &qt_interpreter_events::directory_changed_signal,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2109 this, &main_window::update_octave_directory);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2110
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2111 connect (qt_link, &qt_interpreter_events::execute_command_in_terminal_signal,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2112 this, &main_window::execute_command_in_terminal);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2113
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2114 connect (qt_link, &qt_interpreter_events::enter_debugger_signal,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2115 this, &main_window::handle_enter_debugger);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2116
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2117 connect (qt_link, &qt_interpreter_events::exit_debugger_signal,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2118 this, &main_window::handle_exit_debugger);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2119
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2120 connect (qt_link, &qt_interpreter_events::show_preferences_signal,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2121 this, [=] () { process_settings_dialog_request (); });
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
2122
29542
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2123 connect (qt_link, &qt_interpreter_events::insert_debugger_pointer_signal,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2124 this, &main_window::handle_insert_debugger_pointer_request);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2125
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2126 connect (qt_link, &qt_interpreter_events::delete_debugger_pointer_signal,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2127 this, &main_window::handle_delete_debugger_pointer_request);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2128
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2129 connect (qt_link, &qt_interpreter_events::update_breakpoint_marker_signal,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2130 this, &main_window::handle_update_breakpoint_marker_request);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2131
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2132 connect (qt_link, &qt_interpreter_events::gui_status_update_signal,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2133 this, &main_window::handle_gui_status_update);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2134
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2135 connect (qt_link, &qt_interpreter_events::update_gui_lexer_signal,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2136 this, &main_window::update_gui_lexer_signal);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2137 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2138
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2139 QAction* main_window::add_action (QMenu *menu, const QIcon& icon,
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2140 const QString& text, const char *member,
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2141 const QWidget *receiver)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2142 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2143 QAction *a;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2144
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2145 if (receiver)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2146 a = menu->addAction (icon, text, receiver, member);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2147 else
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2148 a = menu->addAction (icon, text, this, member);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2149
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2150 addAction (a); // important for shortcut context
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2151 a->setShortcutContext (Qt::ApplicationShortcut);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2152 return a;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2153 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2154
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2155 QMenu* main_window::m_add_menu (QMenuBar *p, QString name)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2156 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2157 QMenu *menu = p->addMenu (name);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2158
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2159 QString base_name = name; // get a copy
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2160 // replace intended '&' ("&&") by a temp. string
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2161 base_name.replace ("&&", "___octave_amp_replacement___");
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2162 // remove single '&' (shortcut)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2163 base_name.remove ("&");
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2164 // restore intended '&'
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2165 base_name.replace ("___octave_amp_replacement___", "&&");
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2166
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2167 // remember names with and without shortcut
31599
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 31222
diff changeset
2168 m_hash_menu_text[menu] = QStringList ({ name, base_name });
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2169
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2170 return menu;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2171 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2172
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2173 void main_window::construct_menu_bar ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2174 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2175 QMenuBar *menu_bar = menuBar ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2176
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2177 construct_file_menu (menu_bar);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2178
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2179 construct_edit_menu (menu_bar);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2180
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2181 construct_debug_menu (menu_bar);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2182
29068
d8089b13d4d7 add shortcuts for the new profiler actions in the gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29061
diff changeset
2183 construct_tools_menu (menu_bar);
29040
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
2184
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2185 construct_window_menu (menu_bar);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2186
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2187 construct_help_menu (menu_bar);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2188
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2189 construct_news_menu (menu_bar);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2190
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21670
diff changeset
2191 #if defined (HAVE_QSCINTILLA)
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2192 // call the editor to add actions which should also be available in the
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2193 // editor's menu and tool bar
31599
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 31222
diff changeset
2194 QList<QAction *> shared_actions = {
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 31222
diff changeset
2195 m_new_script_action,
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 31222
diff changeset
2196 m_new_function_action,
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 31222
diff changeset
2197 m_open_action,
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 31222
diff changeset
2198 m_find_files_action,
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 31222
diff changeset
2199 m_undo_action,
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 31222
diff changeset
2200 m_copy_action,
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 31222
diff changeset
2201 m_paste_action,
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 31222
diff changeset
2202 m_select_all_action
50a225732661 use initializer lists instead of insertion operators
John W. Eaton <jwe@octave.org>
parents: 31222
diff changeset
2203 };
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2204 m_editor_window->insert_global_actions (shared_actions);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2205 #endif
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2206 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2207
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2208 void main_window::construct_file_menu (QMenuBar *p)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2209 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2210 QMenu *file_menu = m_add_menu (p, tr ("&File"));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2211
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2212 construct_new_menu (file_menu);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2213
31621
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31619
diff changeset
2214 gui_settings settings;
29200
6e0952fa5a4f removing obsolete code for some main window menus
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29199
diff changeset
2215
31718
52a5bec0fc74 style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents: 31709
diff changeset
2216 m_open_action
52a5bec0fc74 style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents: 31709
diff changeset
2217 = add_action (file_menu, settings.icon ("document-open"), tr ("Open..."),
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2218 SLOT (request_open_file ()), this);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2219 m_open_action->setToolTip (tr ("Open an existing file in editor"));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
2220
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21670
diff changeset
2221 #if defined (HAVE_QSCINTILLA)
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2222 file_menu->addMenu (m_editor_window->get_mru_menu ());
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2223 #endif
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2224
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2225 file_menu->addSeparator ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2226
31718
52a5bec0fc74 style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents: 31709
diff changeset
2227 m_load_workspace_action
52a5bec0fc74 style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents: 31709
diff changeset
2228 = add_action (file_menu, QIcon (), tr ("Load Workspace..."),
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2229 SLOT (handle_load_workspace_request ()), this);
31718
52a5bec0fc74 style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents: 31709
diff changeset
2230
52a5bec0fc74 style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents: 31709
diff changeset
2231 m_save_workspace_action
52a5bec0fc74 style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents: 31709
diff changeset
2232 = add_action (file_menu, QIcon (), tr ("Save Workspace As..."),
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2233 SLOT (handle_save_workspace_request ()), this);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2234
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2235 file_menu->addSeparator ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2236
31718
52a5bec0fc74 style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents: 31709
diff changeset
2237 m_exit_action
52a5bec0fc74 style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents: 31709
diff changeset
2238 = add_action (file_menu, QIcon (), tr ("Exit"),
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2239 SLOT (close ()), this);
27118
99adef2c6e10 Enable "Quit" menu item on Mac application menu (bug #56155)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 27102
diff changeset
2240 m_exit_action->setMenuRole (QAction::QuitRole);
29200
6e0952fa5a4f removing obsolete code for some main window menus
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29199
diff changeset
2241
6e0952fa5a4f removing obsolete code for some main window menus
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29199
diff changeset
2242 // Connect signal related to opening or creating editor files
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2243 connect (this, SIGNAL (new_file_signal (const QString&)),
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2244 m_active_editor, SLOT (request_new_file (const QString&)));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2245
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2246 connect (this, SIGNAL (open_file_signal (const QString&)),
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2247 m_active_editor, SLOT (request_open_file (const QString&)));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2248
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2249 connect (this,
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2250 SIGNAL (open_file_signal (const QString&, const QString&, int)),
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2251 m_active_editor,
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2252 SLOT (request_open_file (const QString&, const QString&, int)));
29200
6e0952fa5a4f removing obsolete code for some main window menus
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29199
diff changeset
2253 }
6e0952fa5a4f removing obsolete code for some main window menus
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29199
diff changeset
2254
6e0952fa5a4f removing obsolete code for some main window menus
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29199
diff changeset
2255 void main_window::construct_new_menu (QMenu *p)
6e0952fa5a4f removing obsolete code for some main window menus
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29199
diff changeset
2256 {
6e0952fa5a4f removing obsolete code for some main window menus
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29199
diff changeset
2257 QMenu *new_menu = p->addMenu (tr ("New"));
6e0952fa5a4f removing obsolete code for some main window menus
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29199
diff changeset
2258
31621
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31619
diff changeset
2259 gui_settings settings;
29200
6e0952fa5a4f removing obsolete code for some main window menus
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29199
diff changeset
2260
31718
52a5bec0fc74 style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents: 31709
diff changeset
2261 m_new_script_action
52a5bec0fc74 style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents: 31709
diff changeset
2262 = add_action (new_menu, settings.icon ("document-new"), tr ("New Script"),
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2263 SLOT (request_new_script ()), this);
31718
52a5bec0fc74 style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents: 31709
diff changeset
2264
52a5bec0fc74 style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents: 31709
diff changeset
2265 m_new_function_action
52a5bec0fc74 style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents: 31709
diff changeset
2266 = add_action (new_menu, QIcon (), tr ("New Function..."),
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2267 SLOT (request_new_function ()), this);
31718
52a5bec0fc74 style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents: 31709
diff changeset
2268
52a5bec0fc74 style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents: 31709
diff changeset
2269 m_new_figure_action
52a5bec0fc74 style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents: 31709
diff changeset
2270 = add_action (new_menu, QIcon (), tr ("New Figure"),
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2271 SLOT (handle_new_figure_request ()), this);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2272 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2273
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2274 void main_window::construct_edit_menu (QMenuBar *p)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2275 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2276 QMenu *edit_menu = m_add_menu (p, tr ("&Edit"));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2277
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2278 QKeySequence ctrl_shift = Qt::ControlModifier + Qt::ShiftModifier;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2279
31621
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31619
diff changeset
2280 gui_settings settings;
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31619
diff changeset
2281
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2282 m_undo_action
31621
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31619
diff changeset
2283 = edit_menu->addAction (settings.icon ("edit-undo"), tr ("Undo"));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2284 m_undo_action->setShortcutContext (Qt::ApplicationShortcut);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2285
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2286 edit_menu->addSeparator ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2287
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2288 m_copy_action
31621
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31619
diff changeset
2289 = edit_menu->addAction (settings.icon ("edit-copy"), tr ("Copy"), this,
29542
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2290 &main_window::copyClipboard);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2291 m_copy_action->setShortcutContext (Qt::ApplicationShortcut);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2292
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2293 m_paste_action
31621
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31619
diff changeset
2294 = edit_menu->addAction (settings.icon ("edit-paste"), tr ("Paste"), this,
29542
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2295 &main_window::pasteClipboard);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2296 m_paste_action->setShortcutContext (Qt::ApplicationShortcut);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2297
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2298 m_select_all_action
29542
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2299 = edit_menu->addAction (tr ("Select All"), this,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2300 &main_window::selectAll);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2301 m_select_all_action->setShortcutContext (Qt::ApplicationShortcut);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2302
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2303 m_clear_clipboard_action
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2304 = edit_menu->addAction (tr ("Clear Clipboard"), this,
29542
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2305 &main_window::clear_clipboard);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2306
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2307 edit_menu->addSeparator ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2308
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2309 m_find_files_action
31718
52a5bec0fc74 style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents: 31709
diff changeset
2310 = edit_menu->addAction (settings.icon ("edit-find"),
52a5bec0fc74 style fixes: avoid breaking lines after "(" and prefer "" over QString ("")
John W. Eaton <jwe@octave.org>
parents: 31709
diff changeset
2311 tr ("Find Files..."));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2312
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2313 edit_menu->addSeparator ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2314
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2315 m_clear_command_window_action
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2316 = edit_menu->addAction (tr ("Clear Command Window"));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2317
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2318 m_clear_command_history_action
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2319 = edit_menu->addAction (tr ("Clear Command History"));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2320
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2321 m_clear_workspace_action
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2322 = edit_menu->addAction (tr ("Clear Workspace"));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2323
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2324 edit_menu->addSeparator ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2325
27298
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents: 27287
diff changeset
2326 m_set_path_action
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents: 27287
diff changeset
2327 = edit_menu->addAction (tr ("Set Path"));
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents: 27287
diff changeset
2328
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2329 m_preferences_action
31621
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31619
diff changeset
2330 = edit_menu->addAction (settings.icon ("preferences-system"),
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2331 tr ("Preferences..."));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2332
29542
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2333 connect (m_find_files_action, &QAction::triggered,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2334 this, [=] () { find_files (); });
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2335
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2336 connect (m_clear_command_window_action, &QAction::triggered,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2337 this, &main_window::handle_clear_command_window_request);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2338
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2339 connect (m_clear_command_history_action, &QAction::triggered,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2340 this, &main_window::handle_clear_history_request);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2341
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2342 connect (m_clear_workspace_action, &QAction::triggered,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2343 this, &main_window::handle_clear_workspace_request);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2344
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2345 connect (m_clipboard, &QClipboard::dataChanged,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2346 this, &main_window::clipboard_has_changed);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2347 clipboard_has_changed ();
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
2348 #if defined (Q_OS_WIN32)
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2349 // Always enable paste action (unreliable clipboard signals in windows)
27893
465ac679e976 Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents: 27860
diff changeset
2350 // FIXME: This has to be removed, when the clipboard signals in windows
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2351 // are working again
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2352 m_paste_action->setEnabled (true);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2353 m_clear_clipboard_action->setEnabled (true);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2354 #endif
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
2355
29542
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2356 connect (m_preferences_action, &QAction::triggered,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2357 this, [=] () { process_settings_dialog_request (); });
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2358
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2359 connect (m_set_path_action, &QAction::triggered,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2360 this, &main_window::handle_set_path_dialog_request);
27298
1805f8586179 new gui dialog for modifying octaves load path (bug #43549)
JunWang <jstzwj@aliyun.com>
parents: 27287
diff changeset
2361
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2362 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2363
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2364 QAction * main_window::construct_debug_menu_item (const char *icon,
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2365 const QString& item,
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2366 const char *member)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2367 {
31621
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31619
diff changeset
2368 gui_settings settings;
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31619
diff changeset
2369
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31619
diff changeset
2370 QAction *action = add_action (m_debug_menu, settings.icon (QString (icon)),
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2371 item, member);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2372
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2373 action->setEnabled (false);
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2374
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2375 #if defined (HAVE_QSCINTILLA)
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2376 m_editor_window->debug_menu ()->addAction (action);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2377 m_editor_window->toolbar ()->addAction (action);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
2378 #endif
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
2379
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2380 return action;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2381 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2382
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2383 void main_window::construct_debug_menu (QMenuBar *p)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2384 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2385 m_debug_menu = m_add_menu (p, tr ("De&bug"));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2386
27276
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
2387 m_debug_step_over
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
2388 = construct_debug_menu_item ("db-step", tr ("Step"),
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2389 SLOT (debug_step_over ()));
27276
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
2390
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
2391 m_debug_step_into
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
2392 = construct_debug_menu_item ("db-step-in", tr ("Step In"),
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2393 SLOT (debug_step_into ()));
27276
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
2394
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
2395 m_debug_step_out
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
2396 = construct_debug_menu_item ("db-step-out", tr ("Step Out"),
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2397 SLOT (debug_step_out ()));
27276
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
2398
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
2399 m_debug_continue
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
2400 = construct_debug_menu_item ("db-cont", tr ("Continue"),
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2401 SLOT (debug_continue ()));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2402
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2403 m_debug_menu->addSeparator ();
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
2404 #if defined (HAVE_QSCINTILLA)
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2405 m_editor_window->debug_menu ()->addSeparator ();
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2406 #endif
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2407
27276
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
2408 m_debug_quit
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
2409 = construct_debug_menu_item ("db-stop", tr ("Quit Debug Mode"),
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2410 SLOT (debug_quit ()));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2411 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2412
29068
d8089b13d4d7 add shortcuts for the new profiler actions in the gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29061
diff changeset
2413 void main_window::construct_tools_menu (QMenuBar *p)
29040
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
2414 {
29068
d8089b13d4d7 add shortcuts for the new profiler actions in the gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29061
diff changeset
2415 QMenu *tools_menu = m_add_menu (p, tr ("&Tools"));
d8089b13d4d7 add shortcuts for the new profiler actions in the gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29061
diff changeset
2416
d8089b13d4d7 add shortcuts for the new profiler actions in the gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29061
diff changeset
2417 m_profiler_start = add_action (tools_menu, QIcon (),
29040
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
2418 tr ("Start &Profiler Session"), SLOT (profiler_session ()));
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
2419
29068
d8089b13d4d7 add shortcuts for the new profiler actions in the gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29061
diff changeset
2420 m_profiler_resume = add_action (tools_menu, QIcon (),
29040
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
2421 tr ("&Resume Profiler Session"), SLOT (profiler_session_resume ()));
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
2422
29068
d8089b13d4d7 add shortcuts for the new profiler actions in the gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29061
diff changeset
2423 m_profiler_stop = add_action (tools_menu, QIcon (),
29040
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
2424 tr ("&Stop Profiler"), SLOT (profiler_stop ()));
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
2425 m_profiler_stop->setEnabled (false);
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
2426
29068
d8089b13d4d7 add shortcuts for the new profiler actions in the gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29061
diff changeset
2427 m_profiler_show = add_action (tools_menu, QIcon (),
29040
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
2428 tr ("&Show Profile Data"), SLOT (profiler_show ()));
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
2429 }
05b8ad7b67e8 gui menu for handling the profile (based on patch #8300 by Hassan Radi)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29001
diff changeset
2430
29439
fe06fafb4cac fix en-/disabling some editor actions depending on file type (bug #60214)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
2431 void main_window::editor_tabs_changed (bool have_tabs, bool is_octave)
26873
9ec36417c262 debug step starts script if not already running in debug mode (bug #44728)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 26643
diff changeset
2432 {
27893
465ac679e976 Fix typos and grammar errors in comments in libgui (patch #9790)
Andrew Janke <andrew@apjanke.net>
parents: 27860
diff changeset
2433 // Set state of actions which depend on the existence of editor tabs
26873
9ec36417c262 debug step starts script if not already running in debug mode (bug #44728)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 26643
diff changeset
2434 m_editor_has_tabs = have_tabs;
29439
fe06fafb4cac fix en-/disabling some editor actions depending on file type (bug #60214)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
2435 m_editor_is_octave_file = is_octave;
fe06fafb4cac fix en-/disabling some editor actions depending on file type (bug #60214)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29359
diff changeset
2436 m_debug_step_over->setEnabled (have_tabs && is_octave);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2437 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2438
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2439 QAction * main_window::construct_window_menu_item (QMenu *p,
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2440 const QString& item,
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2441 bool checkable,
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2442 QWidget *widget)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2443 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2444 QAction *action = p->addAction (QIcon (), item);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2445
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2446 addAction (action); // important for shortcut context
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2447 action->setCheckable (checkable);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2448 action->setShortcutContext (Qt::ApplicationShortcut);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2449
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2450 if (widget) // might be zero for m_editor_window
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2451 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2452 if (checkable)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2453 {
27956
2310164737b3 fix many spelling errors (bug #57613)
John W. Eaton <jwe@octave.org>
parents: 27041
diff changeset
2454 // action for visibility of dock widget
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2455 connect (action, SIGNAL (toggled (bool)),
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2456 widget, SLOT (setVisible (bool)));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2457
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2458 connect (widget, SIGNAL (active_changed (bool)),
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2459 action, SLOT (setChecked (bool)));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2460 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2461 else
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2462 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2463 // action for focus of dock widget
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2464 connect (action, SIGNAL (triggered ()),
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2465 widget, SLOT (activate ()));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2466 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2467 }
27258
922c47ff5218 disable editor actions in window menu when editor is not available (bug #56114)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27255
diff changeset
2468 else
922c47ff5218 disable editor actions in window menu when editor is not available (bug #56114)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27255
diff changeset
2469 {
922c47ff5218 disable editor actions in window menu when editor is not available (bug #56114)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27255
diff changeset
2470 action->setEnabled (false);
922c47ff5218 disable editor actions in window menu when editor is not available (bug #56114)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27255
diff changeset
2471 }
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2472
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2473 return action;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2474 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2475
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2476 void main_window::construct_window_menu (QMenuBar *p)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2477 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2478 QMenu *window_menu = m_add_menu (p, tr ("&Window"));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2479
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2480 m_show_command_window_action = construct_window_menu_item
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2481 (window_menu, tr ("Show Command Window"), true, m_command_window);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2482
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2483 m_show_history_action = construct_window_menu_item
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2484 (window_menu, tr ("Show Command History"), true, m_history_window);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2485
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2486 m_show_file_browser_action = construct_window_menu_item
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2487 (window_menu, tr ("Show File Browser"), true, m_file_browser_window);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2488
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2489 m_show_workspace_action = construct_window_menu_item
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2490 (window_menu, tr ("Show Workspace"), true, m_workspace_window);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2491
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2492 m_show_editor_action = construct_window_menu_item
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2493 (window_menu, tr ("Show Editor"), true, m_editor_window);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2494
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2495 m_show_documentation_action = construct_window_menu_item
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2496 (window_menu, tr ("Show Documentation"), true, m_doc_browser_window);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2497
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2498 m_show_variable_editor_action = construct_window_menu_item
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2499 (window_menu, tr ("Show Variable Editor"), true, m_variable_editor_window);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2500
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2501 window_menu->addSeparator ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2502
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2503 m_command_window_action = construct_window_menu_item
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2504 (window_menu, tr ("Command Window"), false, m_command_window);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2505
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2506 m_history_action = construct_window_menu_item
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2507 (window_menu, tr ("Command History"), false, m_history_window);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2508
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2509 m_file_browser_action = construct_window_menu_item
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2510 (window_menu, tr ("File Browser"), false, m_file_browser_window);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2511
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2512 m_workspace_action = construct_window_menu_item
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2513 (window_menu, tr ("Workspace"), false, m_workspace_window);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2514
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2515 m_editor_action = construct_window_menu_item
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2516 (window_menu, tr ("Editor"), false, m_editor_window);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2517
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2518 m_documentation_action = construct_window_menu_item
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2519 (window_menu, tr ("Documentation"), false, m_doc_browser_window);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2520
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2521 m_variable_editor_action = construct_window_menu_item
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2522 (window_menu, tr ("Variable Editor"), false, m_variable_editor_window);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2523
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2524 window_menu->addSeparator ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2525
27860
cbd4d97100b3 add action and shortcut for switching to previews widget (bug #57447)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
2526 m_previous_dock_action = add_action (window_menu, QIcon (),
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2527 tr ("Previous Widget"), SLOT (go_to_previous_widget ()));
27860
cbd4d97100b3 add action and shortcut for switching to previews widget (bug #57447)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
2528
cbd4d97100b3 add action and shortcut for switching to previews widget (bug #57447)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
2529 window_menu->addSeparator ();
cbd4d97100b3 add action and shortcut for switching to previews widget (bug #57447)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27849
diff changeset
2530
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2531 m_reset_windows_action = add_action (window_menu, QIcon (),
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2532 tr ("Reset Default Window Layout"), SLOT (reset_windows ()));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2533 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2534
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2535 void main_window::construct_help_menu (QMenuBar *p)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2536 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2537 QMenu *help_menu = m_add_menu (p, tr ("&Help"));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2538
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2539 construct_documentation_menu (help_menu);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2540
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2541 help_menu->addSeparator ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2542
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2543 m_report_bug_action = add_action (help_menu, QIcon (),
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2544 tr ("Report Bug"), SLOT (open_bug_tracker_page ()));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2545
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2546 m_octave_packages_action = add_action (help_menu, QIcon (),
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2547 tr ("Octave Packages"), SLOT (open_octave_packages_page ()));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2548
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2549 m_contribute_action = add_action (help_menu, QIcon (),
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2550 tr ("Contribute"), SLOT (open_contribute_page ()));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2551
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2552 m_developer_action = add_action (help_menu, QIcon (),
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2553 tr ("Donate to Octave"), SLOT (open_donate_page ()));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2554
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2555 help_menu->addSeparator ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2556
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2557 m_about_octave_action = add_action (help_menu, QIcon (),
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2558 tr ("About Octave"), SLOT (show_about_octave ()));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2559 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2560
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2561 void main_window::construct_documentation_menu (QMenu *p)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2562 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2563 QMenu *doc_menu = p->addMenu (tr ("Documentation"));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2564
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2565 m_ondisk_doc_action = add_action (doc_menu, QIcon (),
27281
0915fec3d3a9 prevent gui from catching focus when its desktop workspace becomes active
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27277
diff changeset
2566 tr ("On Disk"), SLOT (activate ()), m_doc_browser_window);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2567
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2568 m_online_doc_action = add_action (doc_menu, QIcon (),
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2569 tr ("Online"), SLOT (open_online_documentation_page ()));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2570 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2571
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2572 void main_window::construct_news_menu (QMenuBar *p)
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2573 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2574 QMenu *news_menu = m_add_menu (p, tr ("&News"));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2575
29836
56465c0739fa allow release notes window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29835
diff changeset
2576 m_release_notes_action
56465c0739fa allow release notes window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29835
diff changeset
2577 = news_menu->addAction (QIcon (), tr ("Release Notes"),
56465c0739fa allow release notes window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29835
diff changeset
2578 [=] () {
56465c0739fa allow release notes window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29835
diff changeset
2579 emit show_release_notes_signal ();
56465c0739fa allow release notes window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29835
diff changeset
2580 });
56465c0739fa allow release notes window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29835
diff changeset
2581 addAction (m_release_notes_action);
56465c0739fa allow release notes window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29835
diff changeset
2582 m_release_notes_action->setShortcutContext (Qt::ApplicationShortcut);
56465c0739fa allow release notes window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29835
diff changeset
2583
29835
a946d742fb97 allow community news window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29834
diff changeset
2584 m_current_news_action
a946d742fb97 allow community news window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29834
diff changeset
2585 = news_menu->addAction (QIcon (), tr ("Community News"),
a946d742fb97 allow community news window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29834
diff changeset
2586 [=] () {
a946d742fb97 allow community news window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29834
diff changeset
2587 emit show_community_news_signal (-1);
a946d742fb97 allow community news window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29834
diff changeset
2588 });
a946d742fb97 allow community news window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29834
diff changeset
2589 addAction (m_current_news_action);
a946d742fb97 allow community news window to be opened from command line
John W. Eaton <jwe@octave.org>
parents: 29834
diff changeset
2590 m_current_news_action->setShortcutContext (Qt::ApplicationShortcut);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2591 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2592
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2593 void main_window::construct_tool_bar ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2594 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2595 m_main_tool_bar = addToolBar (tr ("Toolbar"));
27457
70d9746e9011 smaller toolbars in editor and main window (bug #53902)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27412
diff changeset
2596 m_main_tool_bar->setStyleSheet (m_main_tool_bar->styleSheet ()
27560
3fcc650de22f split gui-preferences.h into one file per widget
John W. Eaton <jwe@octave.org>
parents: 27556
diff changeset
2597 + global_toolbar_style);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2598
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2599 m_main_tool_bar->setObjectName ("MainToolBar");
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2600 m_main_tool_bar->addAction (m_new_script_action);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2601 m_main_tool_bar->addAction (m_open_action);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2602
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2603 m_main_tool_bar->addSeparator ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2604
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2605 m_main_tool_bar->addAction (m_copy_action);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2606 m_main_tool_bar->addAction (m_paste_action);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2607 m_main_tool_bar->addAction (m_undo_action);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2608
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2609 m_main_tool_bar->addSeparator ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2610
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2611 m_current_directory_combo_box = new QComboBox (this);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2612 QFontMetrics fm = m_current_directory_combo_box->fontMetrics ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2613 m_current_directory_combo_box->setFixedWidth (48*fm.averageCharWidth ());
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2614 m_current_directory_combo_box->setEditable (true);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2615 m_current_directory_combo_box->setInsertPolicy (QComboBox::NoInsert);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2616 m_current_directory_combo_box->setToolTip (tr ("Enter directory name"));
27276
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
2617 m_current_directory_combo_box->setMaxVisibleItems (current_directory_max_visible);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2618 m_current_directory_combo_box->setMaxCount (current_directory_max_count);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2619 QSizePolicy sizePol (QSizePolicy::Preferred, QSizePolicy::Preferred);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2620 m_current_directory_combo_box->setSizePolicy (sizePol);
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2621
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2622 // addWidget takes ownership of the objects so there is no
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2623 // need to delete these upon destroying this main_window.
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2624 m_main_tool_bar->addWidget (new QLabel (tr ("Current Directory: ")));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2625 m_main_tool_bar->addWidget (m_current_directory_combo_box);
31621
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31619
diff changeset
2626
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31619
diff changeset
2627 gui_settings settings;
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31619
diff changeset
2628
27276
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
2629 QAction *current_dir_up
31621
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31619
diff changeset
2630 = m_main_tool_bar->addAction (settings.icon ("folder-up", false, "go-up"),
27276
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
2631 tr ("One directory up"));
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
2632 QAction *current_dir_search
31621
0645ea65ca6b handle icons and themes in gui_settings class, not resource_manager
John W. Eaton <jwe@octave.org>
parents: 31619
diff changeset
2633 = m_main_tool_bar->addAction (settings.icon ("folder"),
27276
7455523fdf01 style fixes: avoid breaking lines immediately after '('
John W. Eaton <jwe@octave.org>
parents: 27271
diff changeset
2634 tr ("Browse directories"));
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2635
29542
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2636 connect (m_current_directory_combo_box, SIGNAL (activated (const QString&)),
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2637 this, SLOT (set_current_working_directory (const QString&)));
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2638
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2639 connect (m_current_directory_combo_box->lineEdit (),
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2640 &QLineEdit::returnPressed,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2641 this, &main_window::accept_directory_line_edit);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2642
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2643 connect (current_dir_search, &QAction::triggered,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2644 this, &main_window::browse_for_directory);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2645
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2646 connect (current_dir_up, &QAction::triggered,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2647 this, &main_window::change_directory_up);
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2648
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2649 connect (m_undo_action, &QAction::triggered,
3d34b70b5a49 connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents: 29535
diff changeset
2650 this, &main_window::handle_undo_request);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2651 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2652
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2653 void main_window::focus_console_after_command ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2654 {
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
2655 gui_settings settings;
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
2656
31709
3a23b89bd21d define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents: 31707
diff changeset
2657 if (settings.bool_value (cs_focus_cmd))
27556
410622ac120f improve run selection from editor (bug #42705)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 27478
diff changeset
2658 focus_command_window ();
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2659 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2660
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2661 void main_window::configure_shortcuts ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2662 {
31692
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2663 gui_settings settings;
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2664
29206
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
2665 bool enable
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
2666 = ! ((m_active_dock == m_command_window) && m_prevent_readline_conflicts);
a0a892829b6d fix handling global shortcuts when preventing conflicts with readline
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29200
diff changeset
2667
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2668 // file menu
31692
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2669 settings.set_shortcut (m_open_action, sc_main_file_open_file, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2670 settings.set_shortcut (m_new_script_action, sc_main_file_new_file, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2671 settings.set_shortcut (m_new_function_action, sc_main_file_new_function, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2672 settings.set_shortcut (m_new_figure_action, sc_main_file_new_figure, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2673 settings.set_shortcut (m_load_workspace_action, sc_main_file_load_workspace, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2674 settings.set_shortcut (m_save_workspace_action, sc_main_file_save_workspace, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2675 settings.set_shortcut (m_exit_action, sc_main_file_exit, enable);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2676
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2677 // edit menu
31692
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2678 settings.set_shortcut (m_copy_action, sc_main_edit_copy, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2679 settings.set_shortcut (m_paste_action, sc_main_edit_paste, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2680 settings.set_shortcut (m_undo_action, sc_main_edit_undo, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2681 settings.set_shortcut (m_select_all_action, sc_main_edit_select_all, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2682 settings.set_shortcut (m_clear_clipboard_action, sc_main_edit_clear_clipboard, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2683 settings.set_shortcut (m_find_files_action, sc_main_edit_find_in_files, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2684 settings.set_shortcut (m_clear_command_history_action, sc_main_edit_clear_history, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2685 settings.set_shortcut (m_clear_command_window_action, sc_main_edit_clear_command_window, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2686 settings.set_shortcut (m_clear_workspace_action, sc_main_edit_clear_workspace, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2687 settings.set_shortcut (m_set_path_action, sc_main_edit_set_path, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2688 settings.set_shortcut (m_preferences_action, sc_main_edit_preferences, enable);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2689
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2690 // debug menu
31692
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2691 settings.set_shortcut (m_debug_step_over, sc_main_debug_step_over, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2692 settings.set_shortcut (m_debug_step_into, sc_main_debug_step_into, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2693 settings.set_shortcut (m_debug_step_out, sc_main_debug_step_out, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2694 settings.set_shortcut (m_debug_continue, sc_main_debug_continue, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2695 settings.set_shortcut (m_debug_quit, sc_main_debug_quit, enable);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2696
29068
d8089b13d4d7 add shortcuts for the new profiler actions in the gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29061
diff changeset
2697 // tools menu
31692
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2698 settings.set_shortcut (m_profiler_start, sc_main_tools_start_profiler, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2699 settings.set_shortcut (m_profiler_resume, sc_main_tools_resume_profiler, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2700 settings.set_shortcut (m_profiler_stop, sc_main_tools_start_profiler, enable); // same, toggling
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2701 settings.set_shortcut (m_profiler_show, sc_main_tools_show_profiler, enable);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2702
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2703 // window menu
31692
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2704 settings.set_shortcut (m_show_command_window_action, sc_main_window_show_command, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2705 settings.set_shortcut (m_show_history_action, sc_main_window_show_history, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2706 settings.set_shortcut (m_show_workspace_action, sc_main_window_show_workspace, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2707 settings.set_shortcut (m_show_file_browser_action, sc_main_window_show_file_browser, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2708 settings.set_shortcut (m_show_editor_action, sc_main_window_show_editor, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2709 settings.set_shortcut (m_show_documentation_action, sc_main_window_show_doc, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2710 settings.set_shortcut (m_show_variable_editor_action, sc_main_window_show_variable_editor, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2711 settings.set_shortcut (m_reset_windows_action, sc_main_window_reset, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2712 settings.set_shortcut (m_command_window_action, sc_main_window_command, enable);
29474
34922160bda9 do not disable shortcuts for activating other widgets in console widget
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29460
diff changeset
2713 // Switching to the other widgets (including the previous one) is always enabled
31692
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2714 settings.set_shortcut (m_history_action, sc_main_window_history, true);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2715 settings.set_shortcut (m_workspace_action, sc_main_window_workspace, true);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2716 settings.set_shortcut (m_file_browser_action, sc_main_window_file_browser, true);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2717 settings.set_shortcut (m_editor_action, sc_main_window_editor, true);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2718 settings.set_shortcut (m_documentation_action, sc_main_window_doc, true);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2719 settings.set_shortcut (m_variable_editor_action, sc_main_window_variable_editor, true);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2720 settings.set_shortcut (m_previous_dock_action, sc_main_window_previous_dock, true);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2721
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2722 // help menu
31692
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2723 settings.set_shortcut (m_ondisk_doc_action, sc_main_help_ondisk_doc, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2724 settings.set_shortcut (m_online_doc_action, sc_main_help_online_doc, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2725 settings.set_shortcut (m_report_bug_action, sc_main_help_report_bug, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2726 settings.set_shortcut (m_octave_packages_action, sc_main_help_packages, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2727 settings.set_shortcut (m_contribute_action, sc_main_help_contribute, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2728 settings.set_shortcut (m_developer_action, sc_main_help_developer, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2729 settings.set_shortcut (m_about_octave_action, sc_main_help_about, enable);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2730
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2731 // news menu
31692
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2732 settings.set_shortcut (m_release_notes_action, sc_main_news_release_notes, enable);
2422fb7f1e6c move shortcut setting functions to gui_settings from shortcut_manager
John W. Eaton <jwe@octave.org>
parents: 31690
diff changeset
2733 settings.set_shortcut (m_current_news_action, sc_main_news_community_news, enable);
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2734 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2735
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2736 QList<octave_dock_widget *> main_window::dock_widget_list ()
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2737 {
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2738 QList<octave_dock_widget *> list = QList<octave_dock_widget *> ();
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2739 list.append (static_cast<octave_dock_widget *> (m_command_window));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2740 list.append (static_cast<octave_dock_widget *> (m_history_window));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2741 list.append (static_cast<octave_dock_widget *> (m_file_browser_window));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2742 list.append (static_cast<octave_dock_widget *> (m_doc_browser_window));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
2743 #if defined (HAVE_QSCINTILLA)
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2744 list.append (static_cast<octave_dock_widget *> (m_editor_window));
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
2745 #endif
24715
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2746 list.append (static_cast<octave_dock_widget *> (m_workspace_window));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2747 list.append (static_cast<octave_dock_widget *> (m_variable_editor_window));
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2748 return list;
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2749 }
88bb3f086d9a move GUI main_window and related classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 24645
diff changeset
2750
27270
47f42ad90b0b Restore mfile_encoding on startup from GUI settings.
Markus Mützel <markus.muetzel@gmx.de>
parents: 27267
diff changeset
2751 void main_window::update_default_encoding (const QString& default_encoding)
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
2752 {
27270
47f42ad90b0b Restore mfile_encoding on startup from GUI settings.
Markus Mützel <markus.muetzel@gmx.de>
parents: 27267
diff changeset
2753 m_default_encoding = default_encoding;
27271
a4416cd6bb4f Append name of actual encoding used if "SYSTEM" is selected.
Markus Mützel <markus.muetzel@gmx.de>
parents: 27270
diff changeset
2754 std::string mfile_encoding = m_default_encoding.toStdString ();
a4416cd6bb4f Append name of actual encoding used if "SYSTEM" is selected.
Markus Mützel <markus.muetzel@gmx.de>
parents: 27270
diff changeset
2755 if (m_default_encoding.startsWith ("SYSTEM", Qt::CaseInsensitive))
a4416cd6bb4f Append name of actual encoding used if "SYSTEM" is selected.
Markus Mützel <markus.muetzel@gmx.de>
parents: 27270
diff changeset
2756 mfile_encoding = "SYSTEM";
27270
47f42ad90b0b Restore mfile_encoding on startup from GUI settings.
Markus Mützel <markus.muetzel@gmx.de>
parents: 27267
diff changeset
2757
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
2758 emit interpreter_event
28851
1ac5a76ae91d use [=] capture default specification where possible
John W. Eaton <jwe@octave.org>
parents: 28847
diff changeset
2759 ([=] (interpreter& interp)
27270
47f42ad90b0b Restore mfile_encoding on startup from GUI settings.
Markus Mützel <markus.muetzel@gmx.de>
parents: 27267
diff changeset
2760 {
47f42ad90b0b Restore mfile_encoding on startup from GUI settings.
Markus Mützel <markus.muetzel@gmx.de>
parents: 27267
diff changeset
2761 // INTERPRETER THREAD
47f42ad90b0b Restore mfile_encoding on startup from GUI settings.
Markus Mützel <markus.muetzel@gmx.de>
parents: 27267
diff changeset
2762
27302
5f170ea12fa1 use Qt signals to pass interpreter callbacks to octave-qobject
John W. Eaton <jwe@octave.org>
parents: 27298
diff changeset
2763 F__mfile_encoding__ (interp, ovl (mfile_encoding));
27270
47f42ad90b0b Restore mfile_encoding on startup from GUI settings.
Markus Mützel <markus.muetzel@gmx.de>
parents: 27267
diff changeset
2764 });
25944
ceb508ea92ee refactor GUI main_window class
John W. Eaton <jwe@octave.org>
parents: 25940
diff changeset
2765 }
29144
7220b59c490b clean up constructing main window layout of the gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29095
diff changeset
2766
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2767 void main_window::resize_dock (QDockWidget *dw, int width, int height)
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2768 {
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2769 // resizeDockWidget was added to Qt in Qt 5.6
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2770 if (width >= 0)
30398
d4d83344d653 maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29895
diff changeset
2771 resizeDocks ({dw}, {width}, Qt::Horizontal);
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2772 if (height >= 0)
30398
d4d83344d653 maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29895
diff changeset
2773 resizeDocks ({dw}, {height}, Qt::Vertical);
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2774 }
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2775
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2776 // The default main window size relative to the desktop size
29144
7220b59c490b clean up constructing main window layout of the gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29095
diff changeset
2777 void main_window::set_default_geometry ()
7220b59c490b clean up constructing main window layout of the gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29095
diff changeset
2778 {
7220b59c490b clean up constructing main window layout of the gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29095
diff changeset
2779 int win_x, win_y;
29834
87925a935c7d pass arguments by reference to main_window::get_screen_geometry
John W. Eaton <jwe@octave.org>
parents: 29820
diff changeset
2780 get_screen_geometry (win_x, win_y);
29144
7220b59c490b clean up constructing main window layout of the gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29095
diff changeset
2781
7220b59c490b clean up constructing main window layout of the gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29095
diff changeset
2782 move (0, 0);
7220b59c490b clean up constructing main window layout of the gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29095
diff changeset
2783 resize (2*win_x/3, 7*win_y/8);
7220b59c490b clean up constructing main window layout of the gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29095
diff changeset
2784 }
7220b59c490b clean up constructing main window layout of the gui
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29095
diff changeset
2785
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31748
diff changeset
2786 void main_window::reset_windows ()
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2787 {
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2788 // Slot for resetting the window layout to the default one
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2789 hide ();
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2790 showNormal (); // Unmaximize
29761
3b5ffc4c70e9 more tweaks for main window and dock widget settings
John W. Eaton <jwe@octave.org>
parents: 29760
diff changeset
2791 do_reset_windows (true, true, true); // Add all widgets
3b5ffc4c70e9 more tweaks for main window and dock widget settings
John W. Eaton <jwe@octave.org>
parents: 29760
diff changeset
2792
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2793 // Re-add after giving time: This seems to be a reliable way to
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2794 // reset the main window's layout
29761
3b5ffc4c70e9 more tweaks for main window and dock widget settings
John W. Eaton <jwe@octave.org>
parents: 29760
diff changeset
2795
3b5ffc4c70e9 more tweaks for main window and dock widget settings
John W. Eaton <jwe@octave.org>
parents: 29760
diff changeset
2796 // JWE says: The following also works for me with 0 delay, so I
3b5ffc4c70e9 more tweaks for main window and dock widget settings
John W. Eaton <jwe@octave.org>
parents: 29760
diff changeset
2797 // think the problem might just be that the event loop needs to run
3b5ffc4c70e9 more tweaks for main window and dock widget settings
John W. Eaton <jwe@octave.org>
parents: 29760
diff changeset
2798 // somewhere in the sequence of resizing and adding widgets. Maybe
3b5ffc4c70e9 more tweaks for main window and dock widget settings
John W. Eaton <jwe@octave.org>
parents: 29760
diff changeset
2799 // some actions in do_reset_windows should be using signal/slot
3b5ffc4c70e9 more tweaks for main window and dock widget settings
John W. Eaton <jwe@octave.org>
parents: 29760
diff changeset
2800 // connections so that the event loop can do what it needs to do.
3b5ffc4c70e9 more tweaks for main window and dock widget settings
John W. Eaton <jwe@octave.org>
parents: 29760
diff changeset
2801 // But I haven't been able to find the magic sequence.
3b5ffc4c70e9 more tweaks for main window and dock widget settings
John W. Eaton <jwe@octave.org>
parents: 29760
diff changeset
2802
3b5ffc4c70e9 more tweaks for main window and dock widget settings
John W. Eaton <jwe@octave.org>
parents: 29760
diff changeset
2803 QTimer::singleShot (250, this, [=] () { do_reset_windows (true, true, true); });
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2804 }
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2805
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2806 // Create the default layout of the main window. Do not use
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2807 // restoreState () and restoreGeometry () with default values since
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2808 // this might lead to problems when the Qt version changes
29754
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2809 void main_window::do_reset_windows (bool show, bool save, bool force_all)
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2810 {
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2811 // Set main window default geometry and store its width for
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2812 // later resizing the command window
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2813 set_default_geometry ();
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2814 int win_x = geometry ().width ();
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2815
29535
0b429d1a4974 fix several gui issues (shown with OCTAVE_SHOW_GUI_MESSAGES=1)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29503
diff changeset
2816 // Resize command window (if docked),
0b429d1a4974 fix several gui issues (shown with OCTAVE_SHOW_GUI_MESSAGES=1)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29503
diff changeset
2817 //the important one in the default layout
0b429d1a4974 fix several gui issues (shown with OCTAVE_SHOW_GUI_MESSAGES=1)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29503
diff changeset
2818 if (dockWidgetArea (m_command_window) != Qt::NoDockWidgetArea)
0b429d1a4974 fix several gui issues (shown with OCTAVE_SHOW_GUI_MESSAGES=1)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29503
diff changeset
2819 resize_dock (m_command_window, 7*win_x/8, -1);
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2820
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2821 // See Octave bug #53409 and https://bugreports.qt.io/browse/QTBUG-55357
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
2822 #if (QT_VERSION < 0x050601) || (QT_VERSION >= 0x050701)
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2823 setDockOptions (QMainWindow::AnimatedDocks
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2824 | QMainWindow::AllowNestedDocks
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2825 | QMainWindow::AllowTabbedDocks);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
2826 #else
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2827 setDockNestingEnabled (true);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
2828 #endif
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
2829
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2830 // Add the dock widgets and show them
29754
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2831 if (! m_file_browser_window->adopted () || force_all)
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2832 {
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2833 // FIXME: Maybe there should be a main_window::add_dock_widget
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2834 // function that combines both of these actions?
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2835
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2836 addDockWidget (Qt::LeftDockWidgetArea, m_file_browser_window);
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2837 m_file_browser_window->set_adopted (false);
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2838 }
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2839
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2840 if (! m_workspace_window->adopted () || force_all)
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2841 {
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2842 addDockWidget (Qt::LeftDockWidgetArea, m_workspace_window);
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2843 m_workspace_window->set_adopted (false);
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2844 }
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2845
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2846 if (! m_history_window->adopted () || force_all)
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2847 {
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2848 addDockWidget (Qt::LeftDockWidgetArea, m_history_window);
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2849 m_history_window->set_adopted (false);
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2850 }
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2851
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2852 if (! m_command_window->adopted () || force_all)
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2853 {
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2854 addDockWidget (Qt::RightDockWidgetArea, m_command_window);
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2855 m_command_window->set_adopted (false);
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2856 }
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2857
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2858 if (! m_doc_browser_window->adopted () || force_all)
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2859 {
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2860 addDockWidget (Qt::RightDockWidgetArea, m_doc_browser_window);
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2861 tabifyDockWidget (m_command_window, m_doc_browser_window);
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2862 m_doc_browser_window->set_adopted (false);
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2863 }
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2864
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2865 if (! m_variable_editor_window->adopted () || force_all)
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2866 {
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2867 addDockWidget (Qt::RightDockWidgetArea, m_variable_editor_window);
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2868 tabifyDockWidget (m_command_window, m_variable_editor_window);
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2869 m_variable_editor_window->set_adopted (false);
4c569e386e9b improve behavior of dockable widgets (bug #60750)
John W. Eaton <jwe@octave.org>
parents: 29749
diff changeset
2870 }
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
2871
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
2872 #if defined (HAVE_QSCINTILLA)
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2873 addDockWidget (Qt::RightDockWidgetArea, m_editor_window);
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2874 tabifyDockWidget (m_command_window, m_editor_window);
31648
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
2875 #endif
29d734430e5f maint: Re-indent code after switch to using namespace macros.
John W. Eaton <jwe@octave.org>
parents: 31646
diff changeset
2876
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2877 // Resize command window, the important one in the default layout
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2878 resize_dock (m_command_window, 2*win_x/3, -1);
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2879
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2880 // Show main wibdow, save state and geometry of main window and
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2881 // all dock widgets
29450
6448a10a642a fix restoring the horizontal position of docked gui widgets (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29447
diff changeset
2882 if (show)
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2883 {
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2884 // Show all dock widgets
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2885 for (auto *widget : dock_widget_list ())
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2886 widget->show ();
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2887
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2888 // Show main window and store size and state
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2889 showNormal ();
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2890
29450
6448a10a642a fix restoring the horizontal position of docked gui widgets (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29447
diff changeset
2891 if (save)
6448a10a642a fix restoring the horizontal position of docked gui widgets (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29447
diff changeset
2892 {
31619
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
2893 gui_settings settings;
ad014fc78bd6 use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
2894
31702
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
2895 settings.setValue (mw_geometry.settings_key (), saveGeometry ());
aae24eaf89ad update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents: 31701
diff changeset
2896 settings.setValue (mw_state.settings_key (), saveState ());
29450
6448a10a642a fix restoring the horizontal position of docked gui widgets (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29447
diff changeset
2897 }
29147
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2898
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2899 focus_command_window ();
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2900 }
5d7a651bf0bb fix error when restoring previous main window layout (bug #59426)
Torsten Lilge <ttl-octave@mailbox.org>
parents: 29144
diff changeset
2901 }
31646
c6d54dd31a7e maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
2902
c6d54dd31a7e maint: Use macros to begin/end C++ namespaces.
John W. Eaton <jwe@octave.org>
parents: 31599
diff changeset
2903 OCTAVE_END_NAMESPACE(octave)