annotate libgui/src/main-window.cc @ 24534:194eb4bd202b

maint: Update punctuation for GPL v3 license text. * COPYING, Makefile.am, README, bootstrap, bootstrap.conf, OctJavaQry.java, changelog.tmpl, check-subst-vars.in.sh, find-defun-files.sh, find-files-with-tests.sh, get-source-mtime.sh, mk-hg-id.sh, mk-octave-config-h.sh, mk-opts.pl, stl_algo.h-fixed, subst-config-vals.in.sh, subst-cross-config-vals.in.sh, subst-default-vals.in.sh, subst-script-vals.in.sh, configure.ac, Doxyfile.in, arith.txi, audio.txi, basics.txi, bugs.txi, config-images.sh, container.txi, cp-idx.txi, data.txi, debug.txi, diagperm.txi, diffeq.txi, add_to_aspell_dict, mk_undocumented_list, spellcheck, errors.txi, eval.txi, expr.txi, external.txi, fn-idx.txi, func.txi, genpropdoc.m, geometry.txi, geometryimages.m, grammar.txi, gui.txi, image.txi, images.awk, install.txi, interp.txi, interpimages.m, intro.txi, io.txi, linalg.txi, macros.texi, matrix.txi, mk-doc-cache.pl, mkcontrib.awk, mkoctfile.1, munge-texi.pl, nonlin.txi, numbers.txi, obsolete.txi, octave-cli.1, octave-config.1, octave.1, octave.css, octave.texi, oop.txi, op-idx.txi, optim.txi, package.txi, plot.txi, plotimages.m, poly.txi, preface.txi, quad.txi, set.txi, signal.txi, sparse.txi, sparseimages.m, splineimages.m, stats.txi, stmt.txi, strings.txi, system.txi, testfun.txi, var.txi, vectorize.txi, array.texi, bugs.texi, cp-idx.texi, dae.texi, diffeq.texi, error.texi, factor.texi, fn-idx.texi, gpl.texi, install.texi, intro.texi, liboctave.texi, matvec.texi, nleqn.texi, nlfunc.texi, ode.texi, optim.texi, preface.texi, quad.texi, range.texi, refcard-a4.tex, refcard-legal.tex, refcard-letter.tex, refcard.tex, HACKING.md, octave.appdata.xml.in, Backend.cc, Backend.h, 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, KeyMap.h, ListBoxControl.cc, ListBoxControl.h, Logger.cc, Logger.h, Menu.cc, Menu.h, MenuContainer.h, MouseModeActionGroup.cc, MouseModeActionGroup.h, Object.cc, Object.h, ObjectFactory.cc, ObjectFactory.h, ObjectProxy.cc, ObjectProxy.h, Panel.cc, Panel.h, PopupMenuControl.cc, PopupMenuControl.h, PushButtonControl.cc, PushButtonControl.h, PushTool.cc, PushTool.h, QtHandlesUtils.cc, QtHandlesUtils.h, RadioButtonControl.cc, RadioButtonControl.h, SliderControl.cc, SliderControl.h, TextControl.cc, TextControl.h, TextEdit.cc, TextEdit.h, ToggleButtonControl.cc, ToggleButtonControl.h, ToggleTool.cc, ToggleTool.h, ToolBar.cc, ToolBar.h, ToolBarButton.cc, ToolBarButton.h, __init_qt__.cc, __init_qt__.h, annotation-dialog.cc, annotation-dialog.h, gl-select.cc, gl-select.h, liboctgui-build-info.h, liboctgui-build-info.in.cc, mk-default-qt-settings.in.sh, QTerminal.cc, QTerminal.h, BlockArray.cpp, BlockArray.h, Character.h, CharacterColor.h, Emulation.cpp, Emulation.h, Filter.cpp, Filter.h, History.cpp, History.h, KeyboardTranslator.cpp, KeyboardTranslator.h, QUnixTerminalImpl.cpp, QUnixTerminalImpl.h, Screen.cpp, Screen.h, ScreenWindow.cpp, ScreenWindow.h, SelfListener.cpp, SelfListener.h, TerminalCharacterDecoder.cpp, TerminalCharacterDecoder.h, TerminalModel.cpp, TerminalModel.h, TerminalView.cpp, TerminalView.h, Vt102Emulation.cpp, Vt102Emulation.h, kpty.cpp, kpty.h, kpty_p.h, QTerminalColors.cpp, QTerminalColors.h, QWinTerminalImpl.cpp, QWinTerminalImpl.h, main.cpp, color-picker.cc, color-picker.h, dialog.cc, dialog.h, documentation-dock-widget.cc, documentation-dock-widget.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, history-dock-widget.cc, history-dock-widget.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, octave-cmd.cc, octave-cmd.h, octave-dock-widget.cc, octave-dock-widget.h, octave-gui.cc, octave-gui.h, octave-qt-link.cc, octave-qt-link.h, octave-settings.h, texinfo-parser.cc, texinfo-parser.h, webinfo.cc, webinfo.h, resource-manager.cc, resource-manager.h, settings-dialog.cc, settings-dialog.h, shortcut-manager.cc, shortcut-manager.h, terminal-dock-widget.cc, terminal-dock-widget.h, thread-manager.cc, thread-manager.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, build-env.in.cc, builtins.h, Cell.cc, Cell.h, __contourc__.cc, __dsearchn__.cc, __ichol__.cc, __ilu__.cc, __lin_interpn__.cc, __luinc__.cc, __magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, balance.cc, base-text-renderer.h, besselj.cc, betainc.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h, call-stack.cc, call-stack.h, cdisplay.c, cdisplay.h, cellfun.cc, coct-hdf5-types.c, colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, data.h, debug.cc, default-defs.in.h, defaults.cc, defaults.h, defun-dld.h, defun-int.h, defun.cc, defun.h, det.cc, dirfns.cc, dirfns.h, display.cc, display.h, dlmread.cc, dot.cc, dynamic-ld.cc, dynamic-ld.h, eig.cc, ellipj.cc, environment.cc, environment.h, error.cc, error.h, errwarn.cc, errwarn.h, event-queue.cc, event-queue.h, fcn-info.cc, fcn-info.h, fft.cc, fft2.cc, fftn.cc, file-io.cc, file-io.h, filter.cc, find.cc, ft-text-renderer.cc, ft-text-renderer.h, gammainc.cc, gcd.cc, genprops.awk, getgrent.cc, getpwent.cc, getrusage.cc, givens.cc, gl-render.cc, gl-render.h, gl2ps-print.cc, gl2ps-print.h, graphics-handle.h, graphics-toolkit.cc, graphics-toolkit.h, graphics.cc, graphics.in.h, gripes.cc, gripes.h, gsvd.cc, gtk-manager.cc, gtk-manager.h, hash.cc, help.cc, help.h, hess.cc, hex2num.cc, hook-fcn.cc, hook-fcn.h, input.cc, input.h, interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h, inv.cc, kron.cc, load-path.cc, load-path.h, load-save.cc, load-save.h, lookup.cc, ls-ascii-helper.cc, ls-ascii-helper.h, ls-hdf5.cc, ls-hdf5.h, ls-mat-ascii.cc, ls-mat-ascii.h, ls-mat4.cc, ls-mat4.h, ls-mat5.cc, ls-mat5.h, ls-oct-binary.cc, ls-oct-binary.h, ls-oct-text.cc, ls-oct-text.h, ls-utils.cc, ls-utils.h, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mex.cc, mex.h, mexproto.h, mgorth.cc, mk-errno-list.sh, mk-mxarray-h.in.sh, mxarray.in.h, nproc.cc, oct-errno.h, oct-errno.in.cc, oct-fstrm.cc, oct-fstrm.h, oct-handle.h, oct-hdf5-types.cc, oct-hdf5-types.h, oct-hdf5.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc, oct-iostrm.h, oct-map.cc, oct-map.h, oct-obj.h, oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.cc, oct-strstrm.h, oct-tex-lexer.in.ll, oct-tex-parser.in.yy, oct.h, octave-default-image.h, octave-link.cc, octave-link.h, ordschur.cc, pager.cc, pager.h, pinv.cc, pr-output.cc, pr-output.h, procstream.cc, procstream.h, psi.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, sighandlers.cc, sighandlers.h, sparse-xdiv.cc, sparse-xdiv.h, sparse-xpow.cc, sparse-xpow.h, sparse.cc, spparms.cc, sqrtm.cc, str2double.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc, symrec.cc, symrec.h, symscope.cc, symscope.h, symtab.cc, symtab.h, syscalls.cc, sysdep.cc, sysdep.h, text-renderer.cc, text-renderer.h, time.cc, toplev.cc, toplev.h, tril.cc, tsearch.cc, txt-eng.cc, txt-eng.h, typecast.cc, url-handle-manager.cc, url-handle-manager.h, urlwrite.cc, utils.cc, utils.h, variables.cc, variables.h, workspace-element.h, xdiv.cc, xdiv.h, xnorm.cc, xnorm.h, xpow.cc, xpow.h, zfstream.cc, zfstream.h, deprecated-config.h, __delaunayn__.cc, __eigs__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc, __init_gnuplot__.cc, __ode15__.cc, __osmesa_print__.cc, __voronoi__.cc, amd.cc, audiodevinfo.cc, audioread.cc, ccolamd.cc, chol.cc, colamd.cc, config-module.awk, config-module.sh, convhulln.cc, dmperm.cc, fftw.cc, gzip.cc, oct-qhull.h, qr.cc, symbfact.cc, symrcm.cc, liboctinterp-build-info.h, liboctinterp-build-info.in.cc, mk-build-env-features.sh, mk-builtins.pl, mk-doc.pl, mk-pkg-add.sh, mk-version-h.in.sh, 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.cc, ov-colon.h, ov-complex.cc, ov-complex.h, ov-cs-list.cc, 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-inline.cc, ov-fcn-inline.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-int-traits.h, ov-int16.cc, ov-int16.h, ov-int32.cc, ov-int32.h, ov-int64.cc, ov-int64.h, ov-int8.cc, ov-int8.h, ov-intx.h, ov-java.cc, ov-java.h, ov-lazy-idx.cc, ov-lazy-idx.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-uint16.cc, ov-uint16.h, ov-uint32.cc, ov-uint32.h, ov-uint64.cc, ov-uint64.h, ov-uint8.cc, ov-uint8.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, ovl.cc, ovl.h, octave.cc, octave.h, op-kw-docs, mk-ops.sh, op-b-b.cc, op-b-bm.cc, op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cdm-cm.cc, op-cdm-cs.cc, op-cdm-dm.cc, op-cdm-m.cc, op-cdm-s.cc, op-cell.cc, op-chm.cc, op-class.cc, op-cm-cdm.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-dm.cc, op-cm-m.cc, op-cm-pm.cc, op-cm-s.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc, op-cs-scm.cc, op-cs-sm.cc, op-dm-cdm.cc, op-dm-cm.cc, op-dm-cs.cc, op-dm-dm.cc, op-dm-m.cc, op-dm-s.cc, op-dm-scm.cc, op-dm-sm.cc, op-dm-template.cc, op-dms-template.cc, op-fcdm-fcdm.cc, op-fcdm-fcm.cc, op-fcdm-fcs.cc, op-fcdm-fdm.cc, op-fcdm-fm.cc, op-fcdm-fs.cc, op-fcm-fcdm.cc, op-fcm-fcm.cc, op-fcm-fcs.cc, op-fcm-fdm.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcm-pm.cc, op-fcn.cc, op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fcdm.cc, op-fdm-fcm.cc, op-fdm-fcs.cc, op-fdm-fdm.cc, op-fdm-fm.cc, op-fdm-fs.cc, op-fm-fcdm.cc, op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fdm.cc, op-fm-fm.cc, op-fm-fs.cc, op-fm-pm.cc, op-fs-fcm.cc, op-fs-fcs.cc, op-fs-fm.cc, op-fs-fs.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc, op-i8-i8.cc, op-int-concat.cc, op-int.h, op-m-cdm.cc, op-m-cm.cc, op-m-cs.cc, op-m-dm.cc, op-m-m.cc, op-m-pm.cc, op-m-s.cc, op-m-scm.cc, op-m-sm.cc, op-pm-cm.cc, op-pm-fcm.cc, op-pm-fm.cc, op-pm-m.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-pm-template.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc, op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc, op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, ops.h, options-usage.h, bp-table.cc, bp-table.h, comment-list.cc, comment-list.h, jit-ir.cc, jit-ir.h, jit-typeinfo.cc, jit-typeinfo.h, jit-util.cc, jit-util.h, lex.h, lex.ll, oct-lvalue.cc, oct-lvalue.h, oct-parse.in.yy, octave.gperf, parse.h, profiler.cc, profiler.h, pt-all.h, pt-arg-list.cc, pt-arg-list.h, pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h, pt-binop.cc, pt-binop.h, pt-bp.cc, pt-bp.h, pt-cbinop.cc, pt-cbinop.h, pt-cell.cc, pt-cell.h, pt-check.cc, pt-check.h, pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-colon.cc, pt-colon.h, pt-const.cc, 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-funcall.cc, pt-funcall.h, pt-id.cc, pt-id.h, pt-idx.cc, pt-idx.h, pt-jit.cc, pt-jit.h, pt-jump.cc, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.cc, pt-mat.h, pt-misc.cc, pt-misc.h, pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-stmt.cc, pt-stmt.h, pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-walk.cc, pt-walk.h, pt.cc, pt.h, token.cc, token.h, Array-jit.cc, Array-tc.cc, version.cc, version.in.h, Array-C.cc, Array-b.cc, Array-ch.cc, Array-d.cc, Array-f.cc, Array-fC.cc, Array-i.cc, Array-idx-vec.cc, Array-s.cc, Array-str.cc, Array-util.cc, Array-util.h, Array-voidp.cc, Array.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-C.cc, MArray-d.cc, MArray-f.cc, MArray-fC.cc, MArray-i.cc, MArray-s.cc, MArray.cc, MArray.h, MDiagArray2.cc, MDiagArray2.h, MSparse-C.cc, MSparse-d.cc, MSparse.cc, MSparse.h, Matrix.h, MatrixType.cc, MatrixType.h, PermMatrix.cc, PermMatrix.h, Range.cc, Range.h, Sparse-C.cc, Sparse-b.cc, Sparse-d.cc, Sparse.cc, Sparse.h, boolMatrix.cc, boolMatrix.h, boolNDArray.cc, boolNDArray.h, boolSparse.cc, boolSparse.h, chMatrix.cc, chMatrix.h, chNDArray.cc, 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, int16NDArray.cc, int16NDArray.h, int32NDArray.cc, int32NDArray.h, int64NDArray.cc, int64NDArray.h, int8NDArray.cc, int8NDArray.h, intNDArray.cc, intNDArray.h, uint16NDArray.cc, uint16NDArray.h, uint32NDArray.cc, uint32NDArray.h, uint64NDArray.cc, uint64NDArray.h, uint8NDArray.cc, uint8NDArray.h, cconv2.f, cdotc3.f, cmatm3.f, csconv2.f, dconv2.f, ddot3.f, dmatm3.f, sconv2.f, sdot3.f, smatm3.f, zconv2.f, zdconv2.f, zdotc3.f, zmatm3.f, crsf2csf.f, zrsf2csf.f, mk-f77-def.in.sh, liboctave-build-info.h, liboctave-build-info.in.cc, CollocWt.cc, CollocWt.h, DAE.h, DAEFunc.h, DAERT.h, DAERTFunc.h, DASPK-opts.in, DASPK.cc, DASPK.h, DASRT-opts.in, DASRT.cc, DASRT.h, DASSL-opts.in, DASSL.cc, DASSL.h, DET.h, EIG.cc, EIG.h, LSODE-opts.in, LSODE.cc, LSODE.h, ODE.h, ODEFunc.h, ODES.cc, ODES.h, ODESFunc.h, Quad-opts.in, Quad.cc, Quad.h, aepbalance.cc, aepbalance.h, base-dae.h, base-de.h, base-min.h, bsxfun-decl.h, bsxfun-defs.cc, bsxfun.h, chol.cc, chol.h, eigs-base.cc, eigs-base.h, fEIG.cc, fEIG.h, gepbalance.cc, gepbalance.h, gsvd.cc, gsvd.h, hess.cc, hess.h, lo-amos-proto.h, lo-arpack-proto.h, lo-blas-proto.h, lo-fftpack-proto.h, lo-lapack-proto.h, lo-mappers.cc, lo-mappers.h, lo-qrupdate-proto.h, lo-ranlib-proto.h, lo-slatec-proto.h, lo-specfun.cc, lo-specfun.h, lu.cc, lu.h, oct-convn.cc, oct-convn.h, oct-fftw.cc, oct-fftw.h, oct-norm.cc, oct-norm.h, oct-rand.cc, oct-rand.h, oct-spparms.cc, oct-spparms.h, qr.cc, qr.h, qrp.cc, qrp.h, randgamma.cc, randgamma.h, randmtzig.cc, randmtzig.h, randpoisson.cc, randpoisson.h, schur.cc, schur.h, sparse-chol.cc, sparse-chol.h, sparse-dmsolve.cc, sparse-dmsolve.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc, sparse-qr.h, svd.cc, svd.h, Sparse-diag-op-defs.h, Sparse-op-decls.h, Sparse-op-defs.h, Sparse-perm-op-defs.h, config-ops.sh, mk-ops.awk, mx-base.h, mx-defs.h, mx-ext.h, mx-inlines.cc, mx-op-decl.h, mx-op-defs.h, mx-ops, smx-ops, vx-ops, child-list.cc, child-list.h, cmach-info.c, cmach-info.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, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h, oct-group.cc, oct-group.h, oct-passwd.cc, oct-passwd.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, blaswrap.c, byte-swap.h, caseless-str.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, cquit.c, data-conv.cc, data-conv.h, f2c-main.c, f77-fcn.c, f77-fcn.h, file-info.cc, file-info.h, functor.h, glob-match.cc, glob-match.h, kpse.cc, kpse.h, lo-array-errwarn.cc, lo-array-errwarn.h, lo-array-gripes.cc, lo-array-gripes.h, lo-cutils.c, lo-cutils.h, lo-error.c, lo-error.h, lo-hash.cc, lo-hash.h, lo-ieee.cc, lo-ieee.h, lo-regexp.cc, lo-regexp.h, lo-traits.h, lo-utils.cc, lo-utils.h, oct-base64.cc, oct-base64.h, oct-binmap.h, oct-cmplx.h, oct-glob.cc, oct-glob.h, oct-inttypes-fwd.h, oct-inttypes.cc, oct-inttypes.h, oct-locbuf.h, oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-rl-edit.c, oct-rl-edit.h, oct-rl-hist.c, oct-rl-hist.h, oct-shlib.cc, oct-shlib.h, oct-sort.cc, oct-sort.h, oct-sparse.cc, oct-sparse.h, oct-string.cc, oct-string.h, octave-preserve-stream-state.h, pathsearch.cc, pathsearch.h, quit.cc, quit.h, singleton-cleanup.cc, singleton-cleanup.h, sparse-sort.cc, sparse-sort.h, sparse-util.cc, sparse-util.h, str-vec.cc, str-vec.h, sun-utils.h, unwind-prot.cc, unwind-prot.h, url-transfer.cc, url-transfer.h, areadlink-wrapper.c, areadlink-wrapper.h, async-system-wrapper.c, async-system-wrapper.h, base64-wrappers.c, base64-wrappers.h, canonicalize-file-name-wrapper.c, canonicalize-file-name-wrapper.h, dirent-wrappers.c, dirent-wrappers.h, fcntl-wrappers.c, fcntl-wrappers.h, filepos-wrappers.c, filepos-wrappers.h, fpucw-wrappers.c, fpucw-wrappers.h, gen-tempname-wrapper.c, gen-tempname-wrapper.h, getopt-wrapper.c, getopt-wrapper.h, glob-wrappers.c, glob-wrappers.h, hash-wrappers.c, hash-wrappers.h, localcharset-wrapper.c, localcharset-wrapper.h, math-wrappers.c, math-wrappers.h, mkostemp-wrapper.c, mkostemp-wrapper.h, nanosleep-wrapper.c, nanosleep-wrapper.h, nproc-wrapper.c, nproc-wrapper.h, octave-popen2.c, octave-popen2.h, putenv-wrapper.c, putenv-wrapper.h, set-program-name-wrapper.c, set-program-name-wrapper.h, signal-wrappers.c, signal-wrappers.h, stat-wrappers.c, stat-wrappers.h, strdup-wrapper.c, strdup-wrapper.h, strftime-wrapper.c, strftime-wrapper.h, strmode-wrapper.c, strmode-wrapper.h, strptime-wrapper.c, strptime-wrapper.h, time-wrappers.c, time-wrappers.h, tmpfile-wrapper.c, tmpfile-wrapper.h, uname-wrapper.c, uname-wrapper.h, uniconv-wrappers.c, uniconv-wrappers.h, unistd-wrappers.c, unistd-wrappers.h, unsetenv-wrapper.c, unsetenv-wrapper.h, vasprintf-wrapper.c, vasprintf-wrapper.h, wait-for-input.c, wait-for-input.h, wait-wrappers.c, wait-wrappers.h, acinclude.m4, ax_blas.m4, ax_lapack.m4, ax_openmp.m4, ax_pthread.m4, octave_blas_f77_func.m4, pkg.m4, oct-conf-post.in.h, run-octave.in, Map.m, ascii.m, binary.m, cd.m, close.m, delete.m, dir.m, disp.m, ftp.m, loadobj.m, mget.m, mkdir.m, mput.m, rename.m, rmdir.m, saveobj.m, __get_properties__.m, audioplayer.m, disp.m, get.m, isplaying.m, pause.m, play.m, playblocking.m, resume.m, set.m, stop.m, subsasgn.m, subsref.m, __get_properties__.m, audiorecorder.m, disp.m, get.m, getaudiodata.m, getplayer.m, isrecording.m, pause.m, play.m, record.m, recordblocking.m, resume.m, set.m, stop.m, subsasgn.m, subsref.m, lin2mu.m, mu2lin.m, record.m, sound.m, soundsc.m, bitmax.m, chop.m, comma.m, isstr.m, mahalanobis.m, md5sum.m, octave_config_info.m, onenormest.m, paren.m, semicolon.m, sleep.m, usleep.m, wavread.m, wavwrite.m, acosd.m, acot.m, acotd.m, acoth.m, acsc.m, acscd.m, acsch.m, asec.m, asecd.m, asech.m, asind.m, atan2d.m, atand.m, cosd.m, cot.m, cotd.m, coth.m, csc.m, cscd.m, csch.m, sec.m, secd.m, sech.m, sind.m, tand.m, accumarray.m, accumdim.m, bincoeff.m, bitcmp.m, bitget.m, bitset.m, blkdiag.m, cart2pol.m, cart2sph.m, cell2mat.m, celldisp.m, circshift.m, common_size.m, cplxpair.m, cumtrapz.m, curl.m, dblquad.m, deal.m, deg2rad.m, del2.m, divergence.m, flip.m, flipdim.m, fliplr.m, flipud.m, gradient.m, idivide.m, int2str.m, integral.m, integral2.m, integral3.m, interp1.m, interp2.m, interp3.m, interpft.m, interpn.m, isequal.m, isequaln.m, logspace.m, nextpow2.m, num2str.m, pol2cart.m, polyarea.m, postpad.m, prepad.m, __splinen__.m, quad2d.m, quadgk.m, quadl.m, quadv.m, rad2deg.m, randi.m, rat.m, repelem.m, repmat.m, rot90.m, rotdim.m, shift.m, shiftdim.m, sortrows.m, sph2cart.m, structfun.m, subsindex.m, trapz.m, triplequad.m, xor.m, convhull.m, delaunay.m, delaunayn.m, dsearch.m, dsearchn.m, griddata.m, griddata3.m, griddatan.m, inpolygon.m, rectint.m, tsearchn.m, voronoi.m, voronoin.m, dialog.m, errordlg.m, getappdata.m, guidata.m, guihandles.m, helpdlg.m, inputdlg.m, isappdata.m, listdlg.m, msgbox.m, __file_filter__.m, __fltk_file_filter__.m, __get_funcname__.m, __is_function__.m, __uigetdir_fltk__.m, __uigetfile_fltk__.m, __uiobject_split_args__.m, __uiputfile_fltk__.m, questdlg.m, rmappdata.m, setappdata.m, uibuttongroup.m, uicontextmenu.m, uicontrol.m, uigetdir.m, uigetfile.m, uimenu.m, uipanel.m, uipushtool.m, uiputfile.m, uiresume.m, uitoggletool.m, uitoolbar.m, uiwait.m, waitbar.m, waitforbuttonpress.m, warndlg.m, __gripe_missing_component__.m, __makeinfo__.m, __unimplemented__.m, ans.m, debug.m, doc.m, doc_cache_create.m, error_ids.m, get_first_help_sentence.m, help.m, lookfor.m, print_usage.m, __additional_help_message__.m, __strip_html_tags__.m, slash.m, type.m, warning_ids.m, which.m, autumn.m, bone.m, brighten.m, cmpermute.m, cmunique.m, colorcube.m, colormap.m, contrast.m, cool.m, copper.m, cubehelix.m, flag.m, frame2im.m, getframe.m, gray.m, gray2ind.m, hot.m, hsv.m, hsv2rgb.m, im2double.m, im2frame.m, image.m, imagesc.m, imfinfo.m, imformats.m, imread.m, imshow.m, imwrite.m, ind2gray.m, ind2rgb.m, iscolormap.m, jet.m, lines.m, ntsc2rgb.m, ocean.m, pink.m, prism.m, __imfinfo__.m, __imread__.m, __imwrite__.m, colorspace_conversion_input_check.m, colorspace_conversion_revert.m, imageIO.m, imwrite_filename.m, ind2x.m, rainbow.m, rgb2hsv.m, rgb2ind.m, rgb2ntsc.m, rgbplot.m, spinmap.m, spring.m, summer.m, viridis.m, white.m, winter.m, beep.m, csvread.m, csvwrite.m, dlmwrite.m, fileread.m, importdata.m, is_valid_file_id.m, strread.m, textread.m, javaArray.m, java_get.m, java_set.m, javaaddpath.m, javachk.m, javaclasspath.m, javamem.m, javarmpath.m, ClassHelper.java, Matrix.java, OctClassLoader.java, Octave.java, OctaveReference.java, usejava.m, bandwidth.m, commutation_matrix.m, cond.m, condeig.m, condest.m, cross.m, duplication_matrix.m, expm.m, gls.m, housh.m, isbanded.m, isdefinite.m, isdiag.m, ishermitian.m, issymmetric.m, istril.m, istriu.m, krylov.m, linsolve.m, logm.m, lscov.m, normest.m, normest1.m, null.m, ols.m, orth.m, planerot.m, qzhess.m, rank.m, rref.m, subspace.m, trace.m, vech.m, vecnorm.m, bug_report.m, bunzip2.m, cast.m, citation.m, compare_versions.m, computer.m, copyfile.m, delete.m, desktop.m, dir.m, dos.m, edit.m, fact.m, fieldnames.m, fileattrib.m, fileparts.m, fullfile.m, genvarname.m, getfield.m, grabcode.m, gunzip.m, info.m, inputParser.m, inputname.m, isdeployed.m, isdir.m, ismac.m, ispc.m, isunix.m, license.m, list_primes.m, loadobj.m, ls.m, ls_command.m, menu.m, methods.m, mex.m, mexext.m, mkdir.m, mkoctfile.m, movefile.m, namelengthmax.m, nargchk.m, narginchk.m, nargoutchk.m, news.m, nthargout.m, open.m, orderfields.m, pack.m, parseparams.m, perl.m, __publish_html_output__.m, __publish_latex_output__.m, __w2mpth__.m, display_info_file.m, publish.m, python.m, recycle.m, run.m, saveobj.m, setfield.m, substruct.m, swapbytes.m, symvar.m, tar.m, tempdir.m, tmpnam.m, unix.m, unpack.m, untar.m, unzip.m, validateattributes.m, ver.m, version.m, what.m, zip.m, mk-doc.pl, mk-pkg-add.sh, decic.m, ode15i.m, ode15s.m, ode23.m, ode45.m, odeget.m, odeplot.m, odeset.m, AbsRel_norm.m, check_default_input.m, integrate_adaptive.m, kahan.m, ode_event_handler.m, odedefaults.m, odemergeopts.m, runge_kutta_23.m, runge_kutta_45_dorpri.m, runge_kutta_interpolate.m, starting_stepsize.m, __all_opts__.m, fminbnd.m, fminsearch.m, fminunc.m, fsolve.m, fzero.m, glpk.m, humps.m, lsqnonneg.m, optimget.m, optimset.m, pqpnonneg.m, __fdjac__.m, qp.m, sqp.m, import.m, matlabroot.m, pathdef.m, getsavepath.m, savepath.m, pkg.m, build.m, configure_make.m, default_prefix.m, describe.m, dirempty.m, get_description.m, get_forge_download.m, get_forge_pkg.m, get_unsatisfied_deps.m, getarch.m, getarchdir.m, install.m, installed_packages.m, list_forge_packages.m, load_packages.m, load_packages_and_dependencies.m, rebuild.m, save_order.m, uninstall.m, unload_packages.m, __clabel__.m, __getlegenddata__.m, __rotate_around_axis__.m, annotation.m, axis.m, box.m, camlookat.m, camorbit.m, campos.m, camroll.m, camtarget.m, camup.m, camva.m, camzoom.m, caxis.m, clabel.m, daspect.m, datetick.m, diffuse.m, grid.m, gtext.m, hidden.m, legend.m, lighting.m, material.m, orient.m, pbaspect.m, __axis_label__.m, __axis_limits__.m, rticks.m, shading.m, specular.m, text.m, thetaticks.m, title.m, view.m, whitebg.m, xlabel.m, xlim.m, xticklabels.m, xticks.m, ylabel.m, ylim.m, yticklabels.m, yticks.m, zlabel.m, zlim.m, zticklabels.m, zticks.m, area.m, bar.m, barh.m, camlight.m, colorbar.m, comet.m, comet3.m, compass.m, contour.m, contour3.m, contourc.m, contourf.m, cylinder.m, ellipsoid.m, errorbar.m, ezcontour.m, ezcontourf.m, ezmesh.m, ezmeshc.m, ezplot.m, ezplot3.m, ezpolar.m, ezsurf.m, ezsurfc.m, feather.m, fill.m, fplot.m, hist.m, isocaps.m, isocolors.m, isonormals.m, isosurface.m, light.m, line.m, loglog.m, loglogerr.m, mesh.m, meshc.m, meshz.m, pareto.m, patch.m, pcolor.m, peaks.m, pie.m, pie3.m, plot.m, plot3.m, plotmatrix.m, plotyy.m, polar.m, __add_datasource__.m, __bar__.m, __calc_isovalue_from_data__.m, __contour__.m, __errplot__.m, __ezplot__.m, __interp_cube__.m, __line__.m, __marching_cube__.m, __patch__.m, __pie__.m, __plt__.m, __quiver__.m, __scatter__.m, __stem__.m, __unite_shared_vertices__.m, quiver.m, quiver3.m, rectangle.m, reducepatch.m, reducevolume.m, ribbon.m, rose.m, scatter.m, scatter3.m, semilogx.m, semilogxerr.m, semilogy.m, semilogyerr.m, shrinkfaces.m, slice.m, smooth3.m, sombrero.m, sphere.m, stairs.m, stem.m, stem3.m, stemleaf.m, surf.m, surface.m, surfc.m, surfl.m, surfnorm.m, tetramesh.m, trimesh.m, triplot.m, trisurf.m, waterfall.m, __actual_axis_position__.m, __default_plot_options__.m, __gnuplot_drawnow__.m, __next_line_color__.m, __next_line_style__.m, __opengl_info__.m, __plt_get_axis_arg__.m, __pltopt__.m, allchild.m, ancestor.m, axes.m, cla.m, clf.m, close.m, closereq.m, colstyle.m, copyobj.m, figure.m, findall.m, findfigs.m, findobj.m, gca.m, gcbf.m, gcbo.m, gcf.m, gco.m, ginput.m, gnuplot_binary.in.m, graphics_toolkit.m, groot.m, hdl2struct.m, hggroup.m, hgload.m, hgsave.m, hgtransform.m, hold.m, isaxes.m, isfigure.m, isgraphics.m, ishandle.m, ishold.m, isprop.m, linkaxes.m, linkprop.m, meshgrid.m, ndgrid.m, newplot.m, pan.m, print.m, printd.m, __add_default_menu__.m, __ghostscript__.m, __gnuplot_draw_axes__.m, __gnuplot_draw_figure__.m, __gnuplot_get_var__.m, __gnuplot_ginput__.m, __gnuplot_has_feature__.m, __gnuplot_has_terminal__.m, __gnuplot_open_stream__.m, __gnuplot_print__.m, __gnuplot_version__.m, __opengl_print__.m, __print_parse_opts__.m, __set_default_mouse_modes__.m, refresh.m, refreshdata.m, rotate.m, rotate3d.m, saveas.m, shg.m, struct2hdl.m, subplot.m, zoom.m, compan.m, conv.m, deconv.m, mkpp.m, mpoles.m, padecoef.m, pchip.m, poly.m, polyaffine.m, polyder.m, polyeig.m, polyfit.m, polygcd.m, polyint.m, polyout.m, polyreduce.m, polyval.m, polyvalm.m, ppder.m, ppint.m, ppjumps.m, ppval.m, residue.m, roots.m, spline.m, splinefit.m, unmkpp.m, addpref.m, getpref.m, ispref.m, prefdir.m, preferences.m, loadprefs.m, prefsfile.m, saveprefs.m, rmpref.m, setpref.m, style.css, profexplore.m, profexport.m, profile.m, profshow.m, intersect.m, ismember.m, powerset.m, validsetargs.m, setdiff.m, setxor.m, union.m, unique.m, arch_fit.m, arch_rnd.m, arch_test.m, arma_rnd.m, autoreg_matrix.m, bartlett.m, blackman.m, detrend.m, diffpara.m, durbinlevinson.m, fftconv.m, fftfilt.m, fftshift.m, filter2.m, fractdiff.m, freqz.m, freqz_plot.m, hamming.m, hanning.m, hurst.m, ifftshift.m, periodogram.m, rectangle_lw.m, rectangle_sw.m, triangle_lw.m, triangle_sw.m, sinc.m, sinetone.m, sinewave.m, spectral_adf.m, spectral_xdf.m, spencer.m, stft.m, synthesis.m, unwrap.m, yulewalker.m, bicg.m, bicgstab.m, cgs.m, colperm.m, eigs.m, etreeplot.m, gmres.m, gplot.m, ichol.m, ilu.m, nonzeros.m, pcg.m, pcr.m, __sprand__.m, qmr.m, spaugment.m, spconvert.m, spdiags.m, speye.m, spfun.m, spones.m, sprand.m, sprandn.m, sprandsym.m, spstats.m, spy.m, svds.m, treelayout.m, treeplot.m, bessel.m, beta.m, betaln.m, ellipke.m, expint.m, factor.m, factorial.m, isprime.m, lcm.m, legendre.m, nchoosek.m, nthroot.m, perms.m, pow2.m, primes.m, reallog.m, realpow.m, realsqrt.m, gallery.m, hadamard.m, hankel.m, hilb.m, invhilb.m, magic.m, pascal.m, rosser.m, toeplitz.m, vander.m, wilkinson.m, __finish__.m, center.m, cloglog.m, corr.m, corrcoef.m, cov.m, crosstab.m, histc.m, iqr.m, kendall.m, kurtosis.m, logit.m, mean.m, meansq.m, median.m, mode.m, moment.m, ppplot.m, prctile.m, probit.m, qqplot.m, quantile.m, range.m, ranks.m, run_count.m, runlength.m, skewness.m, spearman.m, statistics.m, std.m, var.m, zscore.m, betacdf.m, betainv.m, betapdf.m, betarnd.m, binocdf.m, binoinv.m, binopdf.m, binornd.m, cauchy_cdf.m, cauchy_inv.m, cauchy_pdf.m, cauchy_rnd.m, chi2cdf.m, chi2inv.m, chi2pdf.m, chi2rnd.m, discrete_cdf.m, discrete_inv.m, discrete_pdf.m, discrete_rnd.m, empirical_cdf.m, empirical_inv.m, empirical_pdf.m, empirical_rnd.m, expcdf.m, expinv.m, exppdf.m, exprnd.m, fcdf.m, finv.m, fpdf.m, frnd.m, gamcdf.m, gaminv.m, gampdf.m, gamrnd.m, geocdf.m, geoinv.m, geopdf.m, geornd.m, hygecdf.m, hygeinv.m, hygepdf.m, hygernd.m, kolmogorov_smirnov_cdf.m, laplace_cdf.m, laplace_inv.m, laplace_pdf.m, laplace_rnd.m, logistic_cdf.m, logistic_inv.m, logistic_pdf.m, logistic_rnd.m, logncdf.m, logninv.m, lognpdf.m, lognrnd.m, nbincdf.m, nbininv.m, nbinpdf.m, nbinrnd.m, normcdf.m, norminv.m, normpdf.m, normrnd.m, poisscdf.m, poissinv.m, poisspdf.m, poissrnd.m, stdnormal_cdf.m, stdnormal_inv.m, stdnormal_pdf.m, stdnormal_rnd.m, tcdf.m, tinv.m, tpdf.m, trnd.m, unidcdf.m, unidinv.m, unidpdf.m, unidrnd.m, unifcdf.m, unifinv.m, unifpdf.m, unifrnd.m, wblcdf.m, wblinv.m, wblpdf.m, wblrnd.m, wienrnd.m, logistic_regression.m, logistic_regression_derivatives.m, logistic_regression_likelihood.m, anova.m, bartlett_test.m, chisquare_test_homogeneity.m, chisquare_test_independence.m, cor_test.m, f_test_regression.m, hotelling_test.m, hotelling_test_2.m, kolmogorov_smirnov_test.m, kolmogorov_smirnov_test_2.m, kruskal_wallis_test.m, manova.m, mcnemar_test.m, prop_test_2.m, run_test.m, sign_test.m, t_test.m, t_test_2.m, t_test_regression.m, u_test.m, var_test.m, welch_test.m, wilcoxon_test.m, z_test.m, z_test_2.m, base2dec.m, bin2dec.m, blanks.m, cstrcat.m, deblank.m, dec2base.m, dec2bin.m, dec2hex.m, erase.m, findstr.m, hex2dec.m, index.m, isletter.m, isstring.m, isstrprop.m, mat2str.m, native2unicode.m, ostrsplit.m, regexptranslate.m, rindex.m, str2num.m, strcat.m, strchr.m, strjoin.m, strjust.m, strmatch.m, strsplit.m, strtok.m, strtrim.m, strtrunc.m, substr.m, unicode2native.m, untabify.m, validatestring.m, __have_feature__.m, __printf_assert__.m, __prog_output_assert__.m, __run_test_suite__.m, assert.m, demo.m, example.m, fail.m, compare_plot_demos.m, dump_demos.m, html_compare_plot_demos.m, rundemos.m, runtests.m, speed.m, test.m, addtodate.m, asctime.m, calendar.m, clock.m, ctime.m, date.m, datenum.m, datestr.m, datevec.m, eomday.m, etime.m, is_leap_year.m, now.m, weekday.m, display-available.c, display-available.h, 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, shared-fcns.h, args.tst, bug-31371.tst, bug-35448.tst, bug-35881.tst, bug-36025.tst, bug-38236.tst, bug-38565.tst, bug-38576.tst, bug-38691.tst, bug-41723.tst, bug-44940.tst, bug-46330.tst, bug-46660.tst, bug-50014.tst, bug-50035.tst, bug-50716.tst, bug-51192.tst, bug-51532.tst, bug-51534.tst, bug-51599.tst, bug-52075.tst, class-concat.tst, classdef-multiple-inheritance.tst, classdef.tst, classes.tst, colormaps.tst, command.tst, complex.tst, ctor-vs-method.tst, deprecate-props.tst, diag-perm.tst, error.tst, eval-catch.tst, fcn-handle-derived-resolution.tst, fntests.m, for.tst, func.tst, global.tst, if.tst, index.tst, io.tst, jit.tst, leftdiv.tst, line-continue.tst, logical-index.tst, mk-bc-overloads-tst.sh, mk-conv-tst.sh, mk-sparse-tst.sh, nest.tst, null-assign.tst, parser.tst, prefer.tst, publish.tst, range.tst, recursion.tst, return.tst, show-failures.awk, single-index.tst, slice.tst, struct.tst, switch.tst, system.tst, transpose.tst, try.tst, unwind.tst, while.tst: Changed punctuation of GPL license text to match that suggested by FSF.
author Rik <rik@octave.org>
date Sat, 06 Jan 2018 07:57:19 -0800
parents c5c11b07598a
children be37df6e1fb4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
1 /*
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
2
23219
3ac9f9ecfae5 maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents: 23160
diff changeset
3 Copyright (C) 2013-2017 John W. Eaton
22323
bac0d6f07a3e maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents: 22254
diff changeset
4 Copyright (C) 2011-2016 Jacob Dawid
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
5
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
6 This file is part of Octave.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
7
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24520
diff changeset
8 Octave is free software: you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22599
diff changeset
9 under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24520
diff changeset
10 the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22599
diff changeset
11 (at your option) any later version.
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22599
diff changeset
12
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22599
diff changeset
13 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22599
diff changeset
14 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22599
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22599
diff changeset
16 GNU General Public License for more details.
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
17
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
18 You should have received a copy of the GNU General Public License
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
19 along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24520
diff changeset
20 <https://www.gnu.org/licenses/>.
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
21
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
22 */
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
23
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21670
diff changeset
24 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21203
diff changeset
25 # include "config.h"
15286
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15274
diff changeset
26 #endif
ae9079bbc627 Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents: 15274
diff changeset
27
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
28 #include <QKeySequence>
15257
7ee62f559a73 Fix compilation under Windows with GUI and LLVM enabled.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15204
diff changeset
29 #include <QApplication>
23385
41639665aa34 improve opening files from gui when built without qscintilla (bug #39179)
Torsten <mttl@mailbox.org>
parents: 23380
diff changeset
30 #include <QInputDialog>
15257
7ee62f559a73 Fix compilation under Windows with GUI and LLVM enabled.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15204
diff changeset
31 #include <QLabel>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
32 #include <QMenuBar>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
33 #include <QMenu>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
34 #include <QAction>
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
35 #include <QSettings>
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
36 #include <QStyle>
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
37 #include <QToolBar>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
38 #include <QDesktopServices>
16391
a695ee2dc17e * main-window.cc: Include <QDesktopWidget>
John W. Eaton <jwe@octave.org>
parents: 16386
diff changeset
39 #include <QDesktopWidget>
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
40 #include <QFileDialog>
13626
cc90c62ada21 Removed terminal, instead now using QPlainTextEdit, which looks much nicer and is not that error-prone...
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13620
diff changeset
41 #include <QMessageBox>
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
42 #include <QIcon>
17764
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
43 #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
44 #include <QThread>
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
45 #include <QDateTime>
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
46 #include <QDebug>
21439
912b8828193b * main-window.cc: include QTimer header file
Mike Miller <mtmiller@octave.org>
parents: 21428
diff changeset
47 #include <QTimer>
14670
7fbea449737d Restructured menus, added toolbar and current directory line edit.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14669
diff changeset
48
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
49 #include <utility>
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
50
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21670
diff changeset
51 #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
52 # include "file-editor.h"
16290
d07aeecb2d22 build: Add more #ifdefs to build GUI when Qscintilla is not present.
Rik <rik@octave.org>
parents: 16176
diff changeset
53 #endif
14707
674740c44c09 Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14703
diff changeset
54 #include "main-window.h"
674740c44c09 Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14703
diff changeset
55 #include "settings-dialog.h"
18611
086093fbdc1a first implementation of a shortcut manager (bug #41217)
Torsten <ttl@justmail.de>
parents: 18575
diff changeset
56 #include "shortcut-manager.h"
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
57
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
58 #include "Array.h"
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
59 #include "cmd-edit.h"
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
60 #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
61
19893
67cb2f421255 restore include statement removed in changeset c7c50030e76c
John W. Eaton <jwe@octave.org>
parents: 19882
diff changeset
62 #include "builtin-defun-decls.h"
15404
f52a62a6db3a eliminate copy and paste copyright info in GUI about info box
John W. Eaton <jwe@octave.org>
parents: 15402
diff changeset
63 #include "defaults.h"
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23497
diff changeset
64 #if defined (HAVE_QT_GRAPHICS)
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23497
diff changeset
65 # include "__init_qt__.h"
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23497
diff changeset
66 #endif
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23497
diff changeset
67 #include "interpreter-private.h"
23773
5ff24576b783 defer installing qt graphics toolkit until interpreter is ready
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
68 #include "interpreter.h"
23479
06bf3a0b08bf maint: Use "" instead of <> for our own include files.
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
69 #include "oct-map.h"
22089
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
70 #include "octave.h"
24362
3fc24b792a24 avoid including symtab.h, symscope.h, or symrec.h unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24361
diff changeset
71 #include "symscope.h"
23479
06bf3a0b08bf maint: Use "" instead of <> for our own include files.
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
72 #include "utils.h"
15404
f52a62a6db3a eliminate copy and paste copyright info in GUI about info box
John W. Eaton <jwe@octave.org>
parents: 15402
diff changeset
73 #include "version.h"
23380
c319e6d737f2 Backed out changeset 7332287221a9
Torsten <mttl@mailbox.org>
parents: 23379
diff changeset
74
c319e6d737f2 Backed out changeset 7332287221a9
Torsten <mttl@mailbox.org>
parents: 23379
diff changeset
75 static file_editor_interface *
c319e6d737f2 Backed out changeset 7332287221a9
Torsten <mttl@mailbox.org>
parents: 23379
diff changeset
76 create_default_editor (QWidget *p)
c319e6d737f2 Backed out changeset 7332287221a9
Torsten <mttl@mailbox.org>
parents: 23379
diff changeset
77 {
c319e6d737f2 Backed out changeset 7332287221a9
Torsten <mttl@mailbox.org>
parents: 23379
diff changeset
78 #if defined (HAVE_QSCINTILLA)
c319e6d737f2 Backed out changeset 7332287221a9
Torsten <mttl@mailbox.org>
parents: 23379
diff changeset
79 return new file_editor (p);
c319e6d737f2 Backed out changeset 7332287221a9
Torsten <mttl@mailbox.org>
parents: 23379
diff changeset
80 #else
c319e6d737f2 Backed out changeset 7332287221a9
Torsten <mttl@mailbox.org>
parents: 23379
diff changeset
81 octave_unused_parameter (p);
c319e6d737f2 Backed out changeset 7332287221a9
Torsten <mttl@mailbox.org>
parents: 23379
diff changeset
82
c319e6d737f2 Backed out changeset 7332287221a9
Torsten <mttl@mailbox.org>
parents: 23379
diff changeset
83 return 0;
c319e6d737f2 Backed out changeset 7332287221a9
Torsten <mttl@mailbox.org>
parents: 23379
diff changeset
84 #endif
c319e6d737f2 Backed out changeset 7332287221a9
Torsten <mttl@mailbox.org>
parents: 23379
diff changeset
85 }
16457
10edb6f1ae98 improve encapsulation of file editor window object
John W. Eaton <jwe@octave.org>
parents: 16456
diff changeset
86
23119
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
87 octave_interpreter::octave_interpreter (octave::application *app_context)
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
88 : QObject (), m_thread_manager (), m_app_context (app_context)
23119
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
89 { }
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
90
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
91 void
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
92 octave_interpreter::execute (void)
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
93 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
94 m_thread_manager.register_current_thread ();
23119
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
95
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
96 // The application context owns the interpreter.
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
97
23773
5ff24576b783 defer installing qt graphics toolkit until interpreter is ready
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
98 octave::interpreter& interp = m_app_context->create_interpreter ();
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23497
diff changeset
99
23119
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
100 int exit_status = 0;
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
101
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
102 try
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
103 {
23819
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23810
diff changeset
104 // Final initialization.
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23810
diff changeset
105
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23810
diff changeset
106 interp.initialize ();
23773
5ff24576b783 defer installing qt graphics toolkit until interpreter is ready
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
107
5ff24576b783 defer installing qt graphics toolkit until interpreter is ready
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
108 if (interp.initialized ())
23119
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
109 {
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
110 // The interpreter should be completely ready at this point so let
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
111 // the GUI know.
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
112
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
113 emit octave_ready_signal ();
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
114
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
115 // Start executing commands in the command window.
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
116
23773
5ff24576b783 defer installing qt graphics toolkit until interpreter is ready
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
117 #if defined (HAVE_QT_GRAPHICS)
23819
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23810
diff changeset
118 // The qt graphics toolkit must be initialized before startup
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23810
diff changeset
119 // files are executed.
5d8ef9b859f8 defer execution of user code to interpreter::execute (bug #51631)
John W. Eaton <jwe@octave.org>
parents: 23810
diff changeset
120
23773
5ff24576b783 defer installing qt graphics toolkit until interpreter is ready
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
121 install___init_qt___functions ();
5ff24576b783 defer installing qt graphics toolkit until interpreter is ready
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
122
23774
41795b504a8b don't use singleton for gtk_manager
John W. Eaton <jwe@octave.org>
parents: 23773
diff changeset
123 Fregister_graphics_toolkit (interp, ovl ("qt"));
23773
5ff24576b783 defer installing qt graphics toolkit until interpreter is ready
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
124 #endif
5ff24576b783 defer installing qt graphics toolkit until interpreter is ready
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
125
5ff24576b783 defer installing qt graphics toolkit until interpreter is ready
John W. Eaton <jwe@octave.org>
parents: 23721
diff changeset
126 exit_status = interp.execute ();
23119
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
127 }
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
128 }
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
129 catch (const octave::exit_exception& ex)
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
130 {
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
131 exit_status = ex.exit_status ();
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
132 }
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
133
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
134 // Whether or not initialization succeeds we need to clean up the
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
135 // interpreter once we are done with it.
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
136
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
137 m_app_context->delete_interpreter ();
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
138
23979
fb9b024a6041 avoid SIGABRT on exit from the GUI (bug #50210)
John W. Eaton <jwe@octave.org>
parents: 23953
diff changeset
139 emit octave_finished_signal (exit_status);
23119
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
140 }
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
141
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
142 void
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
143 octave_interpreter::interrupt (void)
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
144 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
145 m_thread_manager.interrupt ();
23119
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
146 }
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
147
22089
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
148 main_window::main_window (QWidget *p, octave::gui_application *app_context)
23119
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
149 : QMainWindow (p), m_app_context (app_context),
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
150 m_interpreter (new octave_interpreter (app_context)),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
151 m_main_thread (new QThread ()), m_workspace_model (nullptr),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
152 m_status_bar (nullptr), m_command_window (nullptr),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
153 m_history_window (nullptr), m_file_browser_window (nullptr),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
154 m_doc_browser_window (nullptr), m_editor_window (nullptr),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
155 m_workspace_window (nullptr), m_variable_editor_window (nullptr),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
156 m_settings_dlg (nullptr), m_find_files_dlg (nullptr),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
157 m_release_notes_window (nullptr), m_community_news_window (nullptr),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
158 m_octave_qt_link (nullptr), m_clipboard (QApplication::clipboard ()),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
159 m_prevent_readline_conflicts (true), m_suppress_dbg_location (true),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
160 m_start_gui (app_context && app_context->start_gui_p ()),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
161 m_file_encoding (QString ())
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
162 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
163 if (m_start_gui)
22089
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
164 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
165 m_workspace_model = new workspace_model ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
166 m_status_bar = new QStatusBar ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
167 m_command_window = new terminal_dock_widget (this);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
168 m_history_window = new history_dock_widget (this);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
169 m_file_browser_window = new files_dock_widget (this);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
170 m_doc_browser_window = new documentation_dock_widget (this);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
171 m_editor_window = create_default_editor (this);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
172 m_variable_editor_window = new variable_editor (this);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
173 m_workspace_window = new workspace_view (this);
22089
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
174 }
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 22022
diff changeset
175
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
176 m_external_editor = new external_editor_interface (this);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
177 m_active_editor = m_editor_window; // for connecting signals
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
178 if (! m_editor_window)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
179 m_active_editor = m_external_editor;
23385
41639665aa34 improve opening files from gui when built without qscintilla (bug #39179)
Torsten <mttl@mailbox.org>
parents: 23380
diff changeset
180
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
181 QSettings *settings = resource_manager::get_settings ();
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
182
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
183 bool connect_to_web = true;
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
184 QDateTime last_checked;
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
185 int serial = 0;
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
186 m_active_dock = nullptr;
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
187
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
188 if (settings)
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
189 {
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
190 connect_to_web
24094
1265c7f0119a consistent defaults values for all preferences (bug #52090)
Torsten <mttl@mailbox.org>
parents: 24082
diff changeset
191 = settings->value ("news/allow_web_connection", false).toBool ();
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
192
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
193 last_checked
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
194 = settings->value ("news/last_time_checked", QDateTime ()).toDateTime ();
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
195
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
196 serial = settings->value ("news/last_news_item", 0).toInt ();
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
197 }
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
198
17982
7c48493d98e1 Use currentDateTime instead of currentDateTimeUtc for Qt compatibility
Mike Miller <mtmiller@ieee.org>
parents: 17954
diff changeset
199 QDateTime current = QDateTime::currentDateTime ();
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
200 QDateTime one_day_ago = current.addDays (-1);
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
201
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
202 if (m_start_gui && connect_to_web
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
203 && (! last_checked.isValid () || one_day_ago > last_checked))
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
204 load_and_display_community_news (serial);
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
205
14599
97cb9286919c Cleaned up code.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14588
diff changeset
206 // We have to set up all our windows, before we finally launch octave.
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
207 construct ();
23119
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
208
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
209 connect (m_interpreter, SIGNAL (octave_ready_signal (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
210 this, SLOT (handle_octave_ready (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
211
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
212 connect (m_interpreter, SIGNAL (octave_ready_signal (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
213 m_doc_browser_window, SLOT (load_info_file (void)));
23721
b2d55b52ee51 new class to manage help system and associated variables
John W. Eaton <jwe@octave.org>
parents: 23717
diff changeset
214
23979
fb9b024a6041 avoid SIGABRT on exit from the GUI (bug #50210)
John W. Eaton <jwe@octave.org>
parents: 23953
diff changeset
215 connect (m_interpreter, SIGNAL (octave_finished_signal (int)),
fb9b024a6041 avoid SIGABRT on exit from the GUI (bug #50210)
John W. Eaton <jwe@octave.org>
parents: 23953
diff changeset
216 this, SLOT (handle_octave_finished (int)));
fb9b024a6041 avoid SIGABRT on exit from the GUI (bug #50210)
John W. Eaton <jwe@octave.org>
parents: 23953
diff changeset
217
24001
8e4abfaadd97 attempt better cleanup of Octave interpreter thread in GUI
John W. Eaton <jwe@octave.org>
parents: 23979
diff changeset
218 connect (m_interpreter, SIGNAL (octave_finished_signal (int)),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
219 m_main_thread, SLOT (quit (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
220
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
221 connect (m_main_thread, SIGNAL (finished (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
222 m_main_thread, SLOT (deleteLater (void)));
24001
8e4abfaadd97 attempt better cleanup of Octave interpreter thread in GUI
John W. Eaton <jwe@octave.org>
parents: 23979
diff changeset
223
23119
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
224 m_interpreter->moveToThread (m_main_thread);
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
225
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
226 m_main_thread->start ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
227 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
228
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
229 main_window::~main_window (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
230 {
24001
8e4abfaadd97 attempt better cleanup of Octave interpreter thread in GUI
John W. Eaton <jwe@octave.org>
parents: 23979
diff changeset
231 // Note that we don't delete m_main_thread here. That is handled by
8e4abfaadd97 attempt better cleanup of Octave interpreter thread in GUI
John W. Eaton <jwe@octave.org>
parents: 23979
diff changeset
232 // deleteLater slot that is called when the m_main_thread issues a
8e4abfaadd97 attempt better cleanup of Octave interpreter thread in GUI
John W. Eaton <jwe@octave.org>
parents: 23979
diff changeset
233 // finished signal.
8e4abfaadd97 attempt better cleanup of Octave interpreter thread in GUI
John W. Eaton <jwe@octave.org>
parents: 23979
diff changeset
234
16485
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
235 // Destroy the terminal first so that STDERR stream is redirected back
8b783661e03f improve exit sequence for GUI
John W. Eaton <jwe@octave.org>
parents: 16484
diff changeset
236 // to its original pipe to capture error messages at exit.
16484
fa842e78f491 Restore STDERR stream pipe before exit to capture error messages.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16479
diff changeset
237
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
238 delete m_editor_window; // first one for dialogs of modified editor-tabs
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
239 delete m_external_editor;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
240 delete m_command_window;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
241 delete m_workspace_window;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
242 delete m_doc_browser_window;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
243 delete m_file_browser_window;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
244 delete m_history_window;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
245 delete m_status_bar;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
246 delete m_workspace_model;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
247 delete m_variable_editor_window;
23119
3107d3717cc2 refactor and simplify interpreter startup in GUI
John W. Eaton <jwe@octave.org>
parents: 23092
diff changeset
248 delete m_interpreter;
23979
fb9b024a6041 avoid SIGABRT on exit from the GUI (bug #50210)
John W. Eaton <jwe@octave.org>
parents: 23953
diff changeset
249
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
250 if (m_find_files_dlg)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
251 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
252 delete m_find_files_dlg;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
253 m_find_files_dlg = nullptr;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
254 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
255 if (m_release_notes_window)
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
256 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
257 delete m_release_notes_window;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
258 m_release_notes_window = nullptr;
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
259 }
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
260 if (m_settings_dlg)
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
261 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
262 delete m_settings_dlg;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
263 m_settings_dlg = nullptr;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
264 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
265 if (m_community_news_window)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
266 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
267 delete m_community_news_window;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
268 m_community_news_window = nullptr;
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
269 }
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
270 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
271
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
272 bool
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
273 main_window::command_window_has_focus (void) const
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
274 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
275 return m_command_window->has_focus ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
276 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
277
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
278 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
279 main_window::focus_command_window (void)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
280 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
281 m_command_window->focus ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
282 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
283
19422
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19411
diff changeset
284 // catch focus changes and determine the active dock widget
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19411
diff changeset
285 void
19425
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19422
diff changeset
286 main_window::focus_changed (QWidget *, QWidget *new_widget)
19422
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19411
diff changeset
287 {
23457
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23450
diff changeset
288 octave_dock_widget *dock = nullptr;
19425
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19422
diff changeset
289 QWidget *w_new = new_widget; // get a copy of new focus widget
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19422
diff changeset
290 QWidget *start = w_new; // Save it as start of our search
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19422
diff changeset
291 int count = 0; // fallback to prevent endless loop
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19422
diff changeset
292
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
293 while (w_new && w_new != m_main_tool_bar && count < 100)
19422
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19411
diff changeset
294 {
21661
1b9a36a66b01 maint: Octave coding convention cleanups.
Rik <rik@octave.org>
parents: 21568
diff changeset
295 dock = qobject_cast<octave_dock_widget *> (w_new);
19422
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19411
diff changeset
296 if (dock)
19425
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19422
diff changeset
297 break; // it is a QDockWidget ==> exit loop
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19422
diff changeset
298
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21670
diff changeset
299 #if defined (HAVE_QSCINTILLA)
21661
1b9a36a66b01 maint: Octave coding convention cleanups.
Rik <rik@octave.org>
parents: 21568
diff changeset
300 if (qobject_cast<octave_qscintilla *> (w_new))
19533
52c51472b6b9 improved search for active dock-widget after focus has changed
Torsten <ttl@justmail.de>
parents: 19437
diff changeset
301 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
302 dock = static_cast<octave_dock_widget *> (m_editor_window);
19533
52c51472b6b9 improved search for active dock-widget after focus has changed
Torsten <ttl@justmail.de>
parents: 19437
diff changeset
303 break; // it is the editor window ==> exit loop
52c51472b6b9 improved search for active dock-widget after focus has changed
Torsten <ttl@justmail.de>
parents: 19437
diff changeset
304 }
19589
4fe86a372f10 Fix compilation error when building without QScintilla
Mike Miller <mtmiller@ieee.org>
parents: 19585
diff changeset
305 #endif
19533
52c51472b6b9 improved search for active dock-widget after focus has changed
Torsten <ttl@justmail.de>
parents: 19437
diff changeset
306
21661
1b9a36a66b01 maint: Octave coding convention cleanups.
Rik <rik@octave.org>
parents: 21568
diff changeset
307 w_new = qobject_cast<QWidget *> (w_new->previousInFocusChain ());
19425
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19422
diff changeset
308 if (w_new == start)
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19422
diff changeset
309 break; // we have arrived where we began ==> exit loop
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19422
diff changeset
310
5e93d228ff6b fix regression from 476032040df9 (endless loop while looking for active widget)
Torsten <ttl@justmail.de>
parents: 19422
diff changeset
311 count++;
19422
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19411
diff changeset
312 }
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19411
diff changeset
313
19533
52c51472b6b9 improved search for active dock-widget after focus has changed
Torsten <ttl@justmail.de>
parents: 19437
diff changeset
314 // editor needs extra handling
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
315 octave_dock_widget *edit_dock_widget
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
316 = static_cast<octave_dock_widget *> (m_editor_window);
19422
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19411
diff changeset
317 // if new dock has focus, emit signal and store active focus
19533
52c51472b6b9 improved search for active dock-widget after focus has changed
Torsten <ttl@justmail.de>
parents: 19437
diff changeset
318 // except editor changes to a dialog (dock=0)
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
319 if ((dock || m_active_dock != edit_dock_widget) && (dock != m_active_dock))
19422
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19411
diff changeset
320 {
19426
f90bb1e30de2 switching between edit and main shortcuts depending on active dock widget now
Torsten <ttl@justmail.de>
parents: 19425
diff changeset
321 // signal to all dock widgets for updating the style
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
322 emit active_dock_changed (m_active_dock, dock);
19426
f90bb1e30de2 switching between edit and main shortcuts depending on active dock widget now
Torsten <ttl@justmail.de>
parents: 19425
diff changeset
323
19983
643de08e524c save and restore previously active widget in a tabbed stack (bug #42980)
Torsten <ttl@justmail.de>
parents: 19970
diff changeset
324 QList<QDockWidget *> tabbed = tabifiedDockWidgets (dock);
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
325 if (tabbed.contains (m_active_dock))
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
326 dock->set_predecessor_widget (m_active_dock);
19983
643de08e524c save and restore previously active widget in a tabbed stack (bug #42980)
Torsten <ttl@justmail.de>
parents: 19970
diff changeset
327
19426
f90bb1e30de2 switching between edit and main shortcuts depending on active dock widget now
Torsten <ttl@justmail.de>
parents: 19425
diff changeset
328 if (edit_dock_widget == dock)
19429
be53bf420464 fix access to already removed editor window at exit
Torsten <ttl@justmail.de>
parents: 19426
diff changeset
329 emit editor_focus_changed (true);
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
330 else if (edit_dock_widget == m_active_dock)
19429
be53bf420464 fix access to already removed editor window at exit
Torsten <ttl@justmail.de>
parents: 19426
diff changeset
331 emit editor_focus_changed (false);
19426
f90bb1e30de2 switching between edit and main shortcuts depending on active dock widget now
Torsten <ttl@justmail.de>
parents: 19425
diff changeset
332
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
333 m_active_dock = dock;
19422
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19411
diff changeset
334 }
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19411
diff changeset
335 }
476032040df9 determining the active dock from focus changes in the gui
Torsten <ttl@justmail.de>
parents: 19411
diff changeset
336
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
337 void
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
338 main_window::request_reload_settings (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
339 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
340 QSettings *settings = resource_manager::get_settings ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
341
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
342 if (settings)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
343 emit settings_changed (settings);
20995
aab7a3c7168e edit a file from an error message in the terminal (bug #35619)
Torsten <ttl@justmail.de>
parents: 20989
diff changeset
344 }
13558
248b897d9f36 editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents: 13550
diff changeset
345
248b897d9f36 editor: custom lexer, syntax highlighting, auto completion
ttl <ttl@justmail.de>
parents: 13550
diff changeset
346 void
15300
fd27e10b9b05 pass QString by const reference instead of value
John W. Eaton <jwe@octave.org>
parents: 15286
diff changeset
347 main_window::report_status_message (const QString& statusMessage)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
348 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
349 m_status_bar->showMessage (statusMessage, 1000);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
350 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
351
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
352 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
353 main_window::handle_save_workspace_request (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
354 {
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
355 QString file
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23774
diff changeset
356 = QFileDialog::getSaveFileName (this, tr ("Save Workspace As"), ".",
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23774
diff changeset
357 nullptr, nullptr,
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
358 QFileDialog::DontUseNativeDialog);
16532
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
359
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
360 if (! file.isEmpty ())
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
361 octave_link::post_event (this, &main_window::save_workspace_callback,
16532
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
362 file.toStdString ());
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
363 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
364
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
365 void
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
366 main_window::handle_load_workspace_request (const QString& file_arg)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
367 {
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
368 QString file = file_arg;
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
369
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
370 if (file.isEmpty ())
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23774
diff changeset
371 file = QFileDialog::getOpenFileName (this, tr ("Load Workspace"), ".",
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23774
diff changeset
372 nullptr, nullptr,
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
373 QFileDialog::DontUseNativeDialog);
16532
67d4111d078d look for save/load files starting in current directory
John W. Eaton <jwe@octave.org>
parents: 16526
diff changeset
374
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
375 if (! file.isEmpty ())
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
376 octave_link::post_event (this, &main_window::load_workspace_callback,
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
377 file.toStdString ());
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
378 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
379
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
380 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
381 main_window::handle_clear_workspace_request (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
382 {
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
383 octave_link::post_event (this, &main_window::clear_workspace_callback);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
384 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
385
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
386 void
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
387 main_window::handle_clear_command_window_request (void)
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
388 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
389 octave_link::post_event (this, &main_window::clear_command_window_callback);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
390 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
391
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
392 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
393 main_window::handle_clear_history_request (void)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
394 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
395 octave_link::post_event (this, &main_window::clear_history_callback);
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
396 }
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
397
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
398 void
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
399 main_window::handle_undo_request (void)
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
400 {
19945
f7a805f02723 link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents: 19938
diff changeset
401 if (command_window_has_focus ())
f7a805f02723 link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents: 19938
diff changeset
402 octave_link::post_event (this, &main_window::command_window_undo_callback);
f7a805f02723 link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents: 19938
diff changeset
403 else
f7a805f02723 link undo in main window to editor if the latter has focus (bug #44402)
Torsten <ttl@justmail.de>
parents: 19938
diff changeset
404 emit undo_signal ();
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
405 }
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
406
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
407 void
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
408 main_window::handle_rename_variable_request (const QString& old_name,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
409 const QString& new_name)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
410
14814
61c80e9326a8 Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14813
diff changeset
411 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
412 name_pair names (old_name.toStdString (), new_name.toStdString ());
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
413
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
414 octave_link::post_event (this, &main_window::rename_variable_callback,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
415 names);
18156
14acb08d75fa gui: optionally set focus to console when a command is run from another widget
Torsten <ttl@justmail.de>
parents: 18117
diff changeset
416 }
14acb08d75fa gui: optionally set focus to console when a command is run from another widget
Torsten <ttl@justmail.de>
parents: 18117
diff changeset
417
14814
61c80e9326a8 Clearing the command history works.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14813
diff changeset
418 void
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
419 main_window::new_file (const QString& commands)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
420 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
421 emit new_file_signal (commands);
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
422 }
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
423
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
424 void
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
425 main_window::open_file (const QString& file_name, int line)
16635
25e418d23a4b fix running files from file browser's context menu
Torsten <ttl@justmail.de>
parents: 16593
diff changeset
426 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
427 if (line < 0)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
428 emit open_file_signal (file_name);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
429 else
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
430 emit open_file_signal (file_name, QString (), line);
17331
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
431 }
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
432
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
433 void
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
434 main_window::edit_mfile (const QString& name, int line)
17331
636d75a58cd9 fix running file from editor that is not in the search path (bug #39870)
Torsten <ttl@justmail.de>
parents: 17329
diff changeset
435 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
436 handle_edit_mfile_request (name, QString (), QString (), line);
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
437 }
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
438
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
439 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
440 main_window::open_online_documentation_page (void)
15989
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
441 {
21669
7cb63f3994b0 Use correct URL for Online Documentation (bug #47835).
Rik <rik@octave.org>
parents: 20243
diff changeset
442 QDesktopServices::openUrl (
7cb63f3994b0 Use correct URL for Online Documentation (bug #47835).
Rik <rik@octave.org>
parents: 20243
diff changeset
443 QUrl ("http://octave.org/doc/interpreter/index.html"));
15989
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
444 }
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
445
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
446 void
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
447 main_window::display_release_notes (void)
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
448 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
449 if (! m_release_notes_window)
17764
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
450 {
23717
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23693
diff changeset
451 std::string news_file = octave::config::oct_etc_dir () + "/NEWS";
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
452
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
453 QString news;
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
454
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
455 QFile *file = new QFile (QString::fromStdString (news_file));
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
456 if (file->open (QFile::ReadOnly))
17764
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
457 {
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
458 QTextStream *stream = new QTextStream (file);
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
459 news = stream->readAll ();
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
460 if (! news.isEmpty ())
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
461 {
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
462 news.prepend ("<pre>");
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
463 news.append ("</pre>");
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
464 }
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
465 else
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
466 news = (tr ("The release notes file '%1' is empty.")
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
467 . arg (QString::fromStdString (news_file)));
17764
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
468 }
811b5a562680 Format release notes as preformatted text in the GUI (bug #40367)
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
469 else
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
470 news = (tr ("The release notes file '%1' cannot be read.")
17771
7690c3477da1 if NEWS file is missing, include expected file name in release notes message
John W. Eaton <jwe@octave.org>
parents: 17764
diff changeset
471 . arg (QString::fromStdString (news_file)));
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
472
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
473 m_release_notes_window = new QWidget;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
474
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
475 QTextBrowser *browser = new QTextBrowser (m_release_notes_window);
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
476 browser->setText (news);
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
477
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
478 QVBoxLayout *vlayout = new QVBoxLayout;
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
479 vlayout->addWidget (browser);
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
480
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
481 m_release_notes_window->setLayout (vlayout);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
482 m_release_notes_window->setWindowTitle (tr ("Octave Release Notes"));
17936
8c23f844bd30 set maximum size for release notes window from screen size
John W. Eaton <jwe@octave.org>
parents: 17935
diff changeset
483
23070
bef714f45999 maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents: 22755
diff changeset
484 browser->document ()->adjustSize ();
18840
e7b5be5a7f80 improve size of the release notes window
Torsten <ttl@justmail.de>
parents: 18839
diff changeset
485
e7b5be5a7f80 improve size of the release notes window
Torsten <ttl@justmail.de>
parents: 18839
diff changeset
486 // center the window on the screen where octave is running
e7b5be5a7f80 improve size of the release notes window
Torsten <ttl@justmail.de>
parents: 18839
diff changeset
487 QDesktopWidget *m_desktop = QApplication::desktop ();
e7b5be5a7f80 improve size of the release notes window
Torsten <ttl@justmail.de>
parents: 18839
diff changeset
488 int screen = m_desktop->screenNumber (this); // screen of the main window
e7b5be5a7f80 improve size of the release notes window
Torsten <ttl@justmail.de>
parents: 18839
diff changeset
489 QRect screen_geo = m_desktop->availableGeometry (screen);
e7b5be5a7f80 improve size of the release notes window
Torsten <ttl@justmail.de>
parents: 18839
diff changeset
490 int win_x = screen_geo.width (); // width of the screen
e7b5be5a7f80 improve size of the release notes window
Torsten <ttl@justmail.de>
parents: 18839
diff changeset
491 int win_y = screen_geo.height (); // height of the screen
21396
309bba07a4f6 Change size of Release Notes window so it displays without hz scrollbar.
Rik <rik@octave.org>
parents: 21310
diff changeset
492 int reln_x = std::min (720, win_x-80); // desired width of release notes
309bba07a4f6 Change size of Release Notes window so it displays without hz scrollbar.
Rik <rik@octave.org>
parents: 21310
diff changeset
493 int reln_y = std::min (740, win_y-80); // desired height of release notes
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
494 m_release_notes_window->resize (reln_x, reln_y); // set size
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
495 m_release_notes_window->move (20, 0); // move to the top left corner
17883
3851e5fde76d GUI: allow only one release notes windows to be open
John Donoghue <john.donoghue@ieee.org>
parents: 17824
diff changeset
496 }
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
497
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
498 if (! m_release_notes_window->isVisible ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
499 m_release_notes_window->show ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
500 else if (m_release_notes_window->isMinimized ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
501 m_release_notes_window->showNormal ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
502
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
503 m_release_notes_window->setWindowIcon (QIcon (m_release_notes_icon));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
504
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
505 m_release_notes_window->raise ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
506 m_release_notes_window->activateWindow ();
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
507 }
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
508
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
509 void
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
510 main_window::load_and_display_community_news (int serial)
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
511 {
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
512 QSettings *settings = resource_manager::get_settings ();
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
513
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
514 bool connect_to_web
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
515 = (settings
24094
1265c7f0119a consistent defaults values for all preferences (bug #52090)
Torsten <mttl@mailbox.org>
parents: 24082
diff changeset
516 ? settings->value ("news/allow_web_connection", false).toBool ()
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
517 : true);
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
518
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
519 QString base_url = "http://octave.org";
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
520 QString page = "community-news.html";
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
521
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
522 QThread *worker_thread = new QThread;
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
523
17940
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
524 news_reader *reader = new news_reader (base_url, page, serial,
b3e4ee8f4d6d respect option for opting out of web connections for community news
John W. Eaton <jwe@octave.org>
parents: 17939
diff changeset
525 connect_to_web);
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
526
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
527 reader->moveToThread (worker_thread);
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
528
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
529 connect (reader, SIGNAL (display_news_signal (const QString&)),
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
530 this, SLOT (display_community_news (const QString&)));
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
531
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
532 connect (worker_thread, SIGNAL (started (void)),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
533 reader, SLOT (process (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
534
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
535 connect (reader, SIGNAL (finished (void)), worker_thread, SLOT (quit (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
536
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
537 connect (reader, SIGNAL (finished (void)), reader, SLOT (deleteLater (void)));
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
538
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
539 connect (worker_thread, SIGNAL (finished (void)),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
540 worker_thread, SLOT (deleteLater (void)));
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
541
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
542 worker_thread->start ();
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
543 }
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
544
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
545 void
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
546 main_window::display_community_news (const QString& news)
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
547 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
548 if (! m_community_news_window)
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
549 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
550 m_community_news_window = new QWidget;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
551
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
552 QTextBrowser *browser = new QTextBrowser (m_community_news_window);
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
553
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
554 browser->setHtml (news);
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
555 browser->setObjectName ("OctaveNews");
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
556 browser->setOpenExternalLinks (true);
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
557
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
558 QVBoxLayout *vlayout = new QVBoxLayout;
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
559
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
560 vlayout->addWidget (browser);
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
561
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
562 m_community_news_window->setLayout (vlayout);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
563 m_community_news_window->setWindowTitle (tr ("Octave Community News"));
18839
41980d0a5fd2 center the community news window on the screen not on the desktop (bug #42567)
Torsten <ttl@justmail.de>
parents: 18833
diff changeset
564
41980d0a5fd2 center the community news window on the screen not on the desktop (bug #42567)
Torsten <ttl@justmail.de>
parents: 18833
diff changeset
565 // center the window on the screen where octave is running
41980d0a5fd2 center the community news window on the screen not on the desktop (bug #42567)
Torsten <ttl@justmail.de>
parents: 18833
diff changeset
566 QDesktopWidget *m_desktop = QApplication::desktop ();
41980d0a5fd2 center the community news window on the screen not on the desktop (bug #42567)
Torsten <ttl@justmail.de>
parents: 18833
diff changeset
567 int screen = m_desktop->screenNumber (this); // screen of the main window
41980d0a5fd2 center the community news window on the screen not on the desktop (bug #42567)
Torsten <ttl@justmail.de>
parents: 18833
diff changeset
568 QRect screen_geo = m_desktop->availableGeometry (screen);
41980d0a5fd2 center the community news window on the screen not on the desktop (bug #42567)
Torsten <ttl@justmail.de>
parents: 18833
diff changeset
569 int win_x = screen_geo.width (); // width of the screen
41980d0a5fd2 center the community news window on the screen not on the desktop (bug #42567)
Torsten <ttl@justmail.de>
parents: 18833
diff changeset
570 int win_y = screen_geo.height (); // height of the screen
41980d0a5fd2 center the community news window on the screen not on the desktop (bug #42567)
Torsten <ttl@justmail.de>
parents: 18833
diff changeset
571 int news_x = std::min (640, win_x-80); // desired width of news window
41980d0a5fd2 center the community news window on the screen not on the desktop (bug #42567)
Torsten <ttl@justmail.de>
parents: 18833
diff changeset
572 int news_y = std::min (480, win_y-80); // desired height of news window
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
573 m_community_news_window->resize (news_x, news_y); // set size and center
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
574 m_community_news_window->move ((win_x - m_community_news_window->width ())/2,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
575 (win_y - m_community_news_window->height ())/2);
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
576 }
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
577
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
578 if (! m_community_news_window->isVisible ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
579 m_community_news_window->show ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
580 else if (m_community_news_window->isMinimized ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
581 m_community_news_window->showNormal ();
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
582
18002
67978cb5d269 fix icons for the release and community windows
Torsten <ttl@justmail.de>
parents: 18001
diff changeset
583 // same icon as release notes
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
584 m_community_news_window->setWindowIcon (QIcon (m_release_notes_icon));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
585
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
586 m_community_news_window->raise ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
587 m_community_news_window->activateWindow ();
17939
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
588 }
16cf38c39915 display community news in simple window; check timestamp and serial number
John W. Eaton <jwe@octave.org>
parents: 17936
diff changeset
589
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
590 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
591 main_window::open_bug_tracker_page (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
592 {
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
593 QDesktopServices::openUrl (QUrl ("http://octave.org/bugs.html"));
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
594 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
595
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
596 void
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
597 main_window::open_octave_packages_page (void)
15989
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
598 {
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
599 QDesktopServices::openUrl (QUrl ("http://octave.org/packages.html"));
15989
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
600 }
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
601
afc4e08f2143 Add access to documentation and to online html page via Help menu
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 15987
diff changeset
602 void
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
603 main_window::open_contribute_page (void)
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
604 {
22211
6065bd58db2b use contribute/donate consistently in GUI (bug #44335)
Sahil Badyal <sbadyals@gmail.com>
parents: 22177
diff changeset
605 QDesktopServices::openUrl (QUrl ("http://octave.org/contribute.html"));
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
606 }
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
607
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
608 void
22211
6065bd58db2b use contribute/donate consistently in GUI (bug #44335)
Sahil Badyal <sbadyals@gmail.com>
parents: 22177
diff changeset
609 main_window::open_donate_page (void)
17509
d0fa3568eb5d update links in Help menu
John W. Eaton <jwe@octave.org>
parents: 17331
diff changeset
610 {
22211
6065bd58db2b use contribute/donate consistently in GUI (bug #44335)
Sahil Badyal <sbadyals@gmail.com>
parents: 22177
diff changeset
611 QDesktopServices::openUrl (QUrl ("http://octave.org/donate.html"));
13533
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
612 }
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
613
edaf8e72070e Added urls for Agora and Octave Forge in Community Window.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13532
diff changeset
614 void
17676
c060ad097056 add menu entries to the editor for directly accessing the editor's settings
Torsten <ttl@justmail.de>
parents: 17674
diff changeset
615 main_window::process_settings_dialog_request (const QString& desired_tab)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
616 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
617 if (m_settings_dlg) // m_settings_dlg is a guarded pointer!
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
618 {
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
619 // here the dialog is still open and called once again
19632
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19631
diff changeset
620 if (! desired_tab.isEmpty ())
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
621 m_settings_dlg->show_tab (desired_tab);
19632
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19631
diff changeset
622 return;
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19631
diff changeset
623 }
101ce4eaa56c prevent opening the settings dialog multiple times
Torsten <ttl@justmail.de>
parents: 19631
diff changeset
624
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
625 m_settings_dlg = new settings_dialog (this, desired_tab);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
626
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
627 connect (m_settings_dlg, SIGNAL (apply_new_settings (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
628 this, SLOT (request_reload_settings (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
629
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
630 m_settings_dlg->setModal (false);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
631 m_settings_dlg->setAttribute (Qt::WA_DeleteOnClose);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
632 m_settings_dlg->show ();
14588
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
633 }
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
634
19631
4e85ca0b4887 add apply button to the settings dialog (bug #44081)
Torsten <ttl@justmail.de>
parents: 19589
diff changeset
635 void
20113
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
636 main_window::copy_image_to_clipboard (const QString& file, bool remove_file)
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
637 {
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
638 QClipboard *clipboard = QApplication::clipboard ();
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
639
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
640 QImage img (file);
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
641
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
642 if (img.isNull ())
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
643 {
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
644 // Report error?
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
645 return;
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
646 }
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
647
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
648 clipboard->setImage (img);
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
649
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
650 if (remove_file)
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
651 QFile::remove (file);
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
652 }
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
653
c36f2b083613 make copying figures to clipboard work (bug #44866)
John W. Eaton <jwe@octave.org>
parents: 20091
diff changeset
654 void
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
655 main_window::show_about_octave (void)
19631
4e85ca0b4887 add apply button to the settings dialog (bug #44081)
Torsten <ttl@justmail.de>
parents: 19589
diff changeset
656 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
657 std::string message
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
658 = octave_name_version_copyright_copying_warranty_and_bugs (true);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
659
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
660 QMessageBox::about (this, tr ("About Octave"),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
661 QString::fromStdString (message));
19631
4e85ca0b4887 add apply button to the settings dialog (bug #44081)
Torsten <ttl@justmail.de>
parents: 19589
diff changeset
662 }
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
663
14588
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
664 void
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
665 main_window::notice_settings (const QSettings *settings)
14588
fa52c6e84ae0 Added controls and settings for changing the terminal font.
"Israel Herraiz <israel.herraiz@upm.es>"
parents: 14586
diff changeset
666 {
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
667 // QSettings pointer is checked before emitting.
14998
de3a318128f2 Added support for changing the terminal cursor and the cursor blinking.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14996
diff changeset
668
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
669 // the widget's icons (when floating)
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
670 QString icon_set
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
671 = settings->value ("DockWidgets/widget_icon_set", "NONE").toString ();
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
672
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
673 static struct
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
674 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
675 QString name;
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
676 QString path;
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
677 }
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
678
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
679 widget_icon_data[] =
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
680 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
681 // array of possible icon sets (name, path (complete for NONE))
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
682 // the first entry here is the default!
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
683 {"NONE", ":/actions/icons/logo.png"},
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
684 {"GRAPHIC", ":/actions/icons/graphic_logo_"},
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
685 {"LETTER", ":/actions/icons/letter_logo_"},
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
686 {"", ""} // end marker has empty name
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
687 };
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
688
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
689 int count = 0;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
690 int icon_set_found = 0; // default
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
691
20955
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 20278
diff changeset
692 while (! widget_icon_data[count].name.isEmpty ())
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
693 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
694 // while not end of data
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
695 if (widget_icon_data[count].name == icon_set)
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
696 {
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
697 // data of desired icon set found
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
698 icon_set_found = count;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
699 break;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
700 }
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
701 count++;
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
702 }
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
703
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
704 QString icon;
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
705 foreach (octave_dock_widget *widget, dock_widget_list ())
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
706 {
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
707 QString name = widget->objectName ();
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
708 if (! name.isEmpty ())
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
709 { // if children has a name
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
710 icon = widget_icon_data[icon_set_found].path; // prefix | octave-logo
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
711 if (widget_icon_data[icon_set_found].name != "NONE")
20230
e914b5399c67 Use in-place operators in C++ code where possible.
Rik <rik@octave.org>
parents: 20186
diff changeset
712 icon += name + ".png"; // add widget name and ext.
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
713 widget->setWindowIcon (QIcon (icon));
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
714 }
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
715 }
17619
4288b90f18c4 icons for news and release notes widgets
Torsten <ttl@justmail.de>
parents: 17617
diff changeset
716 if (widget_icon_data[icon_set_found].name != "NONE")
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
717 m_release_notes_icon = widget_icon_data[icon_set_found].path
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
718 + "ReleaseWidget.png";
17619
4288b90f18c4 icons for news and release notes widgets
Torsten <ttl@justmail.de>
parents: 17617
diff changeset
719 else
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
720 m_release_notes_icon = ":/actions/icons/logo.png";
15787
b081fbe80174 provide separate icons for gui's floating widgets
Torsten <ttl@justmail.de>
parents: 15758
diff changeset
721
19847
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19846
diff changeset
722 int icon_size_settings = settings->value ("toolbar_icon_size",0).toInt ();
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19846
diff changeset
723 QStyle *st = style ();
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19846
diff changeset
724 int icon_size = st->pixelMetric (QStyle::PM_ToolBarIconSize);
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19846
diff changeset
725
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19846
diff changeset
726 if (icon_size_settings == 1)
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19846
diff changeset
727 icon_size = st->pixelMetric (QStyle::PM_LargeIconSize);
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19846
diff changeset
728 else if (icon_size_settings == -1)
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19846
diff changeset
729 icon_size = st->pixelMetric (QStyle::PM_SmallIconSize);
597fc0fd8e54 make size of toolbar icons depending on scaling of display
Torsten <ttl@justmail.de>
parents: 19846
diff changeset
730
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
731 m_main_tool_bar->setIconSize (QSize (icon_size,icon_size));
16525
e192525236ad configurable size of toolbar icons
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
732
18733
f6f1f27026bb status bars and code folding a user preference (bug #42306)
Torsten <ttl@justmail.de>
parents: 18717
diff changeset
733 if (settings->value ("show_status_bar",true).toBool ())
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
734 m_status_bar->show ();
18733
f6f1f27026bb status bars and code folding a user preference (bug #42306)
Torsten <ttl@justmail.de>
parents: 18717
diff changeset
735 else
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
736 m_status_bar->hide ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
737
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
738 m_prevent_readline_conflicts
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
739 = settings->value ("shortcuts/prevent_readline_conflicts", true).toBool ();
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
740
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
741 m_suppress_dbg_location
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
742 = ! settings->value ("terminal/print_debug_location", false).toBool ();
19585
f9a944b9e1cb provide a user preference for printing the debug location in the terminal
Torsten <ttl@justmail.de>
parents: 19572
diff changeset
743
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
744 resource_manager::update_network_settings ();
19882
b403780efe90 make sure shortcuts are active in editor after settings dialog (bug #44397)
Torsten <ttl@justmail.de>
parents: 19868
diff changeset
745
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
746 emit active_dock_changed (nullptr, m_active_dock); // update dock widget styles
19907
7d888f9e94eb fix some shortcut issues
Torsten <ttl@justmail.de>
parents: 19899
diff changeset
747
7d888f9e94eb fix some shortcut issues
Torsten <ttl@justmail.de>
parents: 19899
diff changeset
748 configure_shortcuts ();
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
749 set_global_shortcuts (m_active_dock == m_command_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
750 disable_menu_shortcuts (m_active_dock == m_editor_window);
23810
9c24aae7515f allow cursor flashing to be configured globally in gui (bug #51460)
Torsten <mttl@mailbox.org>
parents: 23807
diff changeset
751
9c24aae7515f allow cursor flashing to be configured globally in gui (bug #51460)
Torsten <mttl@mailbox.org>
parents: 23807
diff changeset
752
9c24aae7515f allow cursor flashing to be configured globally in gui (bug #51460)
Torsten <mttl@mailbox.org>
parents: 23807
diff changeset
753 // Set cursor blinking depending on the settings
9c24aae7515f allow cursor flashing to be configured globally in gui (bug #51460)
Torsten <mttl@mailbox.org>
parents: 23807
diff changeset
754 // Cursor blinking: consider old terminal related setting if not yet set
9c24aae7515f allow cursor flashing to be configured globally in gui (bug #51460)
Torsten <mttl@mailbox.org>
parents: 23807
diff changeset
755 // TODO: This pref. can be deprecated / removed if Qt adds support for
9c24aae7515f allow cursor flashing to be configured globally in gui (bug #51460)
Torsten <mttl@mailbox.org>
parents: 23807
diff changeset
756 // getting the cursor blink preferences from all OS environments
9c24aae7515f allow cursor flashing to be configured globally in gui (bug #51460)
Torsten <mttl@mailbox.org>
parents: 23807
diff changeset
757 bool cursor_blinking;
9c24aae7515f allow cursor flashing to be configured globally in gui (bug #51460)
Torsten <mttl@mailbox.org>
parents: 23807
diff changeset
758
9c24aae7515f allow cursor flashing to be configured globally in gui (bug #51460)
Torsten <mttl@mailbox.org>
parents: 23807
diff changeset
759 if (settings->contains ("cursor_blinking"))
9c24aae7515f allow cursor flashing to be configured globally in gui (bug #51460)
Torsten <mttl@mailbox.org>
parents: 23807
diff changeset
760 cursor_blinking = settings->value ("cursor_blinking",true).toBool ();
9c24aae7515f allow cursor flashing to be configured globally in gui (bug #51460)
Torsten <mttl@mailbox.org>
parents: 23807
diff changeset
761 else
9c24aae7515f allow cursor flashing to be configured globally in gui (bug #51460)
Torsten <mttl@mailbox.org>
parents: 23807
diff changeset
762 cursor_blinking = settings->value ("terminal/cursorBlinking",true).toBool ();
9c24aae7515f allow cursor flashing to be configured globally in gui (bug #51460)
Torsten <mttl@mailbox.org>
parents: 23807
diff changeset
763
9c24aae7515f allow cursor flashing to be configured globally in gui (bug #51460)
Torsten <mttl@mailbox.org>
parents: 23807
diff changeset
764 if (cursor_blinking)
9c24aae7515f allow cursor flashing to be configured globally in gui (bug #51460)
Torsten <mttl@mailbox.org>
parents: 23807
diff changeset
765 QApplication::setCursorFlashTime (1000); // 1000 ms flash time
9c24aae7515f allow cursor flashing to be configured globally in gui (bug #51460)
Torsten <mttl@mailbox.org>
parents: 23807
diff changeset
766 else
9c24aae7515f allow cursor flashing to be configured globally in gui (bug #51460)
Torsten <mttl@mailbox.org>
parents: 23807
diff changeset
767 QApplication::setCursorFlashTime (0); // no flashing
9c24aae7515f allow cursor flashing to be configured globally in gui (bug #51460)
Torsten <mttl@mailbox.org>
parents: 23807
diff changeset
768
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
769 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
770
19714
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19702
diff changeset
771 void
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19702
diff changeset
772 main_window::confirm_shutdown_octave (void)
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19702
diff changeset
773 {
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19702
diff changeset
774 bool closenow = true;
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19702
diff changeset
775
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
776 if (m_start_gui)
19714
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19702
diff changeset
777 {
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
778 QSettings *settings = resource_manager::get_settings ();
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
779
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
780 if (settings->value ("prompt_to_exit", false).toBool ())
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
781 {
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
782 int ans = QMessageBox::question (this, tr ("Octave"),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
783 tr ("Are you sure you want to exit Octave?"),
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
784 (QMessageBox::Ok
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
785 | QMessageBox::Cancel),
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
786 QMessageBox::Ok);
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
787
21568
3d60ed163b70 maint: Eliminate bad spacing around '='.
Rik <rik@octave.org>
parents: 21439
diff changeset
788 if (ans != QMessageBox::Ok)
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
789 closenow = false;
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
790 }
19714
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19702
diff changeset
791
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21670
diff changeset
792 #if defined (HAVE_QSCINTILLA)
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
793 if (closenow)
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
794 closenow = m_editor_window->check_closing ();
19714
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19702
diff changeset
795 #endif
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
796 }
19714
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19702
diff changeset
797
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 20039
diff changeset
798 // Wait for link thread to go to sleep state.
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
799 m_octave_qt_link->lock ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
800
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
801 m_octave_qt_link->shutdown_confirmation (closenow);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
802
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
803 m_octave_qt_link->unlock ();
20091
89d843d6de14 Add mutex lock to shutdown confirmation for proper thread timing (bug #44751).
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 20039
diff changeset
804
19714
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19702
diff changeset
805 // Awake the worker thread so that it continues shutting down (or not).
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
806 m_octave_qt_link->wake_all ();
19714
21015ca26566 Restructure shutdown flow and behavior for improved robustness
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 19702
diff changeset
807 }
15914
85f9aca30c76 gui: reorganized handling of different icons for dock widgets
Torsten <ttl@justmail.de>
parents: 15900
diff changeset
808
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
809 void
16468
0f143f68078d use signal/slot for updating workspace instead of using event listener
John W. Eaton <jwe@octave.org>
parents: 16460
diff changeset
810 main_window::prepare_to_exit (void)
14693
c952f1e35e50 Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14692
diff changeset
811 {
22177
6e9f5408c0db Save settings in Qt convention, delete all children in destructors (bug #45366)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 22089
diff changeset
812 // Find files dialog is constructed dynamically, not at time of main_window
6e9f5408c0db Save settings in Qt convention, delete all children in destructors (bug #45366)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 22089
diff changeset
813 // construction. Connecting it to qApp aboutToQuit signal would have
6e9f5408c0db Save settings in Qt convention, delete all children in destructors (bug #45366)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 22089
diff changeset
814 // caused it to run after QSettings deleted.
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
815 if (m_find_files_dlg)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
816 m_find_files_dlg->save_settings ();
22177
6e9f5408c0db Save settings in Qt convention, delete all children in destructors (bug #45366)
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 22089
diff changeset
817
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14709
diff changeset
818 write_settings ();
14693
c952f1e35e50 Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14692
diff changeset
819 }
c952f1e35e50 Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14692
diff changeset
820
c952f1e35e50 Added patch from Marco Atzeri for QTerminal to build with cygwin. Removed some compiler warnings.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14692
diff changeset
821 void
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
822 main_window::reset_windows (void)
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
823 {
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
824 QSettings *settings = resource_manager::get_default_settings ();
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
825
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
826 set_window_layout (settings);
18117
a829f40933a8 fix minimized main window after resetting window layout (bug #40832)
Torsten <ttl@justmail.de>
parents: 18034
diff changeset
827 showNormal (); // make sure main window is not minimized
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
828 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
829
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
830 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
831 main_window::change_directory (const QString& dir)
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
832 {
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
833 // Remove existing entry, if any, then add new directory at top and
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
834 // mark it as the current directory. Finally, update the file list
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
835 // widget.
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
836
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
837 int index = m_current_directory_combo_box->findText (dir);
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
838
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
839 if (index >= 0)
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
840 m_current_directory_combo_box->removeItem (index);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
841
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
842 m_current_directory_combo_box->insertItem (0, dir);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
843 m_current_directory_combo_box->setCurrentIndex (0);
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
844 }
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
845
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
846 void
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
847 main_window::browse_for_directory (void)
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
848 {
16578
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
849 QString dir
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23774
diff changeset
850 = QFileDialog::getExistingDirectory (this, tr ("Browse directories"), nullptr,
18778
6e2b1de8348e only show directories in dialog box for setting new octave directory
Torsten <ttl@justmail.de>
parents: 18572
diff changeset
851 QFileDialog::ShowDirsOnly |
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
852 QFileDialog::DontUseNativeDialog);
16578
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
853
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
854 set_current_working_directory (dir);
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
855
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
856 // FIXME: on Windows systems, the command window freezes after the
16578
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
857 // previous actions. Forcing the focus appears to unstick it.
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
858
0eca6c5657c9 force focus to command window after browsing for directory
John W. Eaton <jwe@octave.org>
parents: 16576
diff changeset
859 focus_command_window ();
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
860 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
861
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
862 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
863 main_window::set_current_working_directory (const QString& dir)
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
864 {
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
865 // Change to dir if it is an existing directory.
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
866
23450
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23449
diff changeset
867 QString xdir = (dir.isEmpty () ? "." : dir);
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
868
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
869 QFileInfo fileInfo (xdir);
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
870
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
871 if (fileInfo.exists () && fileInfo.isDir ())
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
872 octave_link::post_event (this, &main_window::change_directory_callback,
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
873 xdir.toStdString ());
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
874 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
875
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
876 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
877 main_window::change_directory_up (void)
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
878 {
16526
01541f7321f7 correctly track directory for cd ..
John W. Eaton <jwe@octave.org>
parents: 16525
diff changeset
879 set_current_working_directory ("..");
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
880 }
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
881
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
882 // Slot that is called if return is pressed in the line edit of the
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
883 // combobox to change to a new directory or a directory that is already
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
884 // in the drop down list.
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
885
15626
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
886 void
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
887 main_window::accept_directory_line_edit (void)
15626
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
888 {
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
889 // Get new directory name, and change to it if it is new. Otherwise,
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
890 // the combo box will triggers the "activated" signal to change to the
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
891 // directory.
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
892
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
893 QString dir = m_current_directory_combo_box->currentText ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
894
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
895 int index = m_current_directory_combo_box->findText (dir);
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
896
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
897 if (index < 0)
15626
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
898 set_current_working_directory (dir);
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
899 }
1cc10ce368ea enable entering a new directory in the current directory combobox
Torsten <ttl@justmail.de>
parents: 15607
diff changeset
900
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
901 void
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
902 main_window::execute_command_in_terminal (const QString& command)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
903 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
904 octave_cmd_exec *cmd = new octave_cmd_exec (command);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
905 m_cmd_queue.add_cmd (cmd);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
906 if (focus_console_after_command ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
907 focus_command_window ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
908 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
909
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
910 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
911 main_window::run_file_in_terminal (const QFileInfo& info)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
912 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
913 octave_link::post_event (this, &main_window::run_file_callback, info);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
914 if (focus_console_after_command ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
915 focus_command_window ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
916 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
917
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
918 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
919 main_window::handle_new_figure_request (void)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
920 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
921 octave_link::post_event (this, &main_window::new_figure_callback);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
922 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
923
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
924 void
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
925 main_window::handle_enter_debugger (void)
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
926 {
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
927 setWindowTitle ("Octave (Debugging)");
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
928
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
929 m_debug_continue->setEnabled (true);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
930 m_debug_step_into->setEnabled (true);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
931 m_debug_step_over->setEnabled (true);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
932 m_debug_step_out->setEnabled (true);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
933 m_debug_quit->setEnabled (true);
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
934
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21670
diff changeset
935 #if defined (HAVE_QSCINTILLA)
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
936 m_editor_window->handle_enter_debug_mode ();
15873
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15848
diff changeset
937 #endif
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
938 }
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
939
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
940 void
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
941 main_window::handle_exit_debugger (void)
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
942 {
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
943 setWindowTitle ("Octave");
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
944
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
945 m_debug_continue->setEnabled (false);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
946 m_debug_step_into->setEnabled (false);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
947 m_debug_step_over->setEnabled (false);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
948 m_debug_step_out->setEnabled (false);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
949 m_debug_quit->setEnabled (false);
16438
a971d8bdaadc use signals instead of event queue for entering/leaving debug mode
John W. Eaton <jwe@octave.org>
parents: 16437
diff changeset
950
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21670
diff changeset
951 #if defined (HAVE_QSCINTILLA)
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
952 m_editor_window->handle_exit_debug_mode ();
15873
7d300b85ee25 allow build to proceed if either Qt or QScintilla is missing
John W. Eaton <jwe@octave.org>
parents: 15848
diff changeset
953 #endif
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
954 }
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
955
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
956 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
957 main_window::debug_continue (void)
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
958 {
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
959 octave_cmd_debug *cmd
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
960 = new octave_cmd_debug ("cont", m_suppress_dbg_location);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
961 m_cmd_queue.add_cmd (cmd);
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
962 }
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
963
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
964 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
965 main_window::debug_step_into (void)
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
966 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
967 octave_cmd_debug *cmd = new octave_cmd_debug ("in", m_suppress_dbg_location);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
968 m_cmd_queue.add_cmd (cmd);
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
969 }
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
970
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
971 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
972 main_window::debug_step_over (void)
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
973 {
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
974 octave_cmd_debug *cmd
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
975 = new octave_cmd_debug ("step", m_suppress_dbg_location);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
976 m_cmd_queue.add_cmd (cmd);
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
977 }
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
978
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
979 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
980 main_window::debug_step_out (void)
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
981 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
982 octave_cmd_debug *cmd = new octave_cmd_debug ("out", m_suppress_dbg_location);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
983 m_cmd_queue.add_cmd (cmd);
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
984 }
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
985
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
986 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
987 main_window::debug_quit (void)
14752
564cc673bcc5 Added menu for debugging. Now sending debug control events, but these seem to not work flawlessly
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14727
diff changeset
988 {
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
989 octave_cmd_debug *cmd
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
990 = new octave_cmd_debug ("quit", m_suppress_dbg_location);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
991 m_cmd_queue.add_cmd (cmd);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
992 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
993
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
994 //
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
995 // Functions related to file editing
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
996 //
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
997 // These are moved from editor to here for also using them when octave
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
998 // is built without qscintilla
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
999 //
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1000 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1001 main_window::request_open_file (void)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1002 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1003 // Open file isn't a file_editor_tab or editor function since the file
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1004 // might be opened in an external editor. Hence, functionality is here.
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1005
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1006 QSettings *settings = resource_manager::get_settings ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1007 bool is_internal = m_editor_window
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1008 && ! settings->value ("useCustomFileEditor",false).toBool ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1009
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1010 // Create a NonModal message.
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1011 QWidget *p = this;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1012 if (is_internal)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1013 p = m_editor_window;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1014 QFileDialog *fileDialog = new QFileDialog (p);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1015 fileDialog->setNameFilter (tr ("Octave Files (*.m);;All Files (*)"));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1016
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1017 // Giving trouble under KDE (problem is related to Qt signal handling on unix,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1018 // see https://bugs.kde.org/show_bug.cgi?id=260719 ,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1019 // it had/has no effect on Windows, though)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1020 fileDialog->setOption (QFileDialog::DontUseNativeDialog, true);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1021
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1022 // define a new grid layout with the extra elements
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1023 QGridLayout *extra = new QGridLayout (fileDialog);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1024 QFrame *separator = new QFrame (fileDialog);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1025 separator->setFrameShape (QFrame::HLine); // horizontal line as separator
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1026 separator->setFrameStyle (QFrame::Sunken);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1027
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1028 if (is_internal)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1029 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1030 // combo box for encoding, only when using the internal editor
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1031 QLabel *label_enc = new QLabel (tr ("File Encoding:"));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1032 QComboBox *combo_enc = new QComboBox ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1033 resource_manager::combo_encoding (combo_enc);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1034 m_file_encoding = QString (); // default
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1035
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1036 // track changes in the combo boxes
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1037 connect (combo_enc, SIGNAL (currentIndexChanged (QString)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1038 this, SLOT (set_file_encoding (QString)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1039
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1040 // build the extra grid layout
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1041 extra->addWidget (separator,0,0,1,3);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1042 extra->addWidget (label_enc,1,0);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1043 extra->addWidget (combo_enc,1,1);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1044 extra->addItem (new QSpacerItem (1,20,QSizePolicy::Expanding,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1045 QSizePolicy::Fixed), 1,2);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1046
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1047 // and add the extra grid layout to the dialog's layout
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1048 QGridLayout *dialog_layout = dynamic_cast<QGridLayout *> (
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1049 fileDialog->layout ());
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1050 dialog_layout->addLayout (extra,dialog_layout->rowCount (),0,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1051 1,dialog_layout->columnCount ());
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1052 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1053
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1054 fileDialog->setAcceptMode (QFileDialog::AcceptOpen);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1055 fileDialog->setViewMode (QFileDialog::Detail);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1056 fileDialog->setFileMode (QFileDialog::ExistingFiles);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1057 fileDialog->setDirectory (m_current_directory_combo_box->itemText (0));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1058
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1059 connect (fileDialog, SIGNAL (filesSelected (const QStringList&)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1060 this, SLOT (request_open_files (const QStringList&)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1061
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1062 fileDialog->setWindowModality (Qt::NonModal);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1063 fileDialog->setAttribute (Qt::WA_DeleteOnClose);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1064 fileDialog->show ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1065 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1066
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1067 // Create a new script
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1068 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1069 main_window::request_new_script (const QString& commands)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1070 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1071 emit new_file_signal (commands);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1072 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1073
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1074 // Create a new function and open it
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1075 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1076 main_window::request_new_function (bool)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1077 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1078 bool ok;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1079 // Get the name of the new function: Parent of the input dialog is the
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1080 // editor window or the main window. The latter is chosen, if a custom
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1081 // editor is used or qscintilla is not available
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1082 QWidget *p = m_editor_window;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1083 QSettings *settings = resource_manager::get_settings ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1084 if (! p || settings->value ("useCustomFileEditor",false).toBool ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1085 p = this;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1086 QString new_name = QInputDialog::getText (p, tr ("New Function"),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1087 tr ("New function name:\n"), QLineEdit::Normal, "", &ok);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1088
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1089 if (ok && new_name.length () > 0)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1090 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1091 // append suffix if it not already exists
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1092 if (new_name.rightRef (2) != ".m")
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1093 new_name.append (".m");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1094 // check whether new files are created without prompt
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1095 if (! settings->value ("editor/create_new_file",false).toBool ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1096 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1097 // no, so enable this settings and wait for end of new file loading
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1098 settings->setValue ("editor/create_new_file",true);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1099 connect (m_editor_window, SIGNAL (file_loaded_signal (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1100 this, SLOT (restore_create_file_setting (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1101 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1102 // start the edit command
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1103 execute_command_in_terminal ("edit " + new_name);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1104 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1105 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1106
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1107 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1108 main_window::handle_edit_mfile_request (const QString& fname,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1109 const QString& ffile,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1110 const QString& curr_dir, int line)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1111 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1112 octave::interpreter& interp
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1113 = octave::__get_interpreter__ ("main_window::clear_workspace_callback");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1114
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1115 // Is it a regular function within the search path? (Call __which__)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1116 octave_value_list fct = F__which__ (interp, ovl (fname.toStdString ()),0);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1117 octave_map map = fct(0).map_value ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1118
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1119 QString type = QString::fromStdString (
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1120 map.contents ("type").data ()[0].string_value ());
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1121 QString name = QString::fromStdString (
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1122 map.contents ("name").data ()[0].string_value ());
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1123
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1124 QString message = QString ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1125 QString filename = QString ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1126
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1127 if (type == QString ("built-in function"))
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1128 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1129 // built in function: can't edit
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1130 message = tr ("%1 is a built-in function");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1131 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1132 else if (type.isEmpty ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1133 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1134 // function not known to octave -> try directory of edited file
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1135 // get directory
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1136 QDir dir;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1137 if (ffile.isEmpty ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1138 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1139 if (curr_dir.isEmpty ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1140 dir = QDir (m_current_directory_combo_box->itemText (0));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1141 else
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1142 dir = QDir (curr_dir);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1143 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1144 else
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1145 dir = QDir (QFileInfo (ffile).canonicalPath ());
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1146
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1147 // function not known to octave -> try directory of edited file
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1148 QFileInfo file = QFileInfo (dir, fname + ".m");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1149
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1150 if (file.exists ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1151 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1152 filename = file.canonicalFilePath (); // local file exists
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1153 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1154 else
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1155 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1156 // local file does not exist -> try private directory
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1157 file = QFileInfo (ffile);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1158 file = QFileInfo (QDir (file.canonicalPath () + "/private"),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1159 fname + ".m");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1160
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1161 if (file.exists ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1162 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1163 filename = file.canonicalFilePath (); // private function exists
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1164 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1165 else
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1166 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1167 message = tr ("Can not find function %1"); // no file found
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1168 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1169 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1170 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1171
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1172 if (! message.isEmpty ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1173 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1174 QMessageBox *msgBox
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1175 = new QMessageBox (QMessageBox::Critical,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1176 tr ("Octave Editor"),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1177 message.arg (name),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1178 QMessageBox::Ok, this);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1179
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1180 msgBox->setWindowModality (Qt::NonModal);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1181 msgBox->setAttribute (Qt::WA_DeleteOnClose);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1182 msgBox->show ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1183 return;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1184 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1185
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1186 if (filename.isEmpty ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1187 filename = QString::fromStdString (
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1188 map.contents ("file").data ()[0].string_value ());
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1189
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1190 if (! filename.endsWith (".m"))
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1191 filename.append (".m");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1192
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1193 emit open_file_signal (filename, QString (), line); // default encoding
14726
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
1194 }
e94a54ee0f46 Added debug events, debug mode detection and fixed compiling error.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14721
diff changeset
1195
14700
7623bece76df Implemented logic for current directory bar.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14698
diff changeset
1196 void
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1197 main_window::handle_insert_debugger_pointer_request (const QString& file,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1198 int line)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1199 {
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1200 bool cmd_focus = command_window_has_focus ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1201
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1202 emit insert_debugger_pointer_signal (file, line);
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1203
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1204 if (cmd_focus)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1205 focus_command_window ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1206 }
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1207
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1208 void
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1209 main_window::handle_delete_debugger_pointer_request (const QString& file,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1210 int line)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1211 {
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1212 bool cmd_focus = command_window_has_focus ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1213
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1214 emit delete_debugger_pointer_signal (file, line);
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1215
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1216 if (cmd_focus)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1217 focus_command_window ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1218 }
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1219
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1220 void
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1221 main_window::handle_update_breakpoint_marker_request (bool insert,
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1222 const QString& file,
21158
65827e9cccb8 Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21148
diff changeset
1223 int line,
22599
51b395d24782 maint: strip tabs and trailing whitespace from C++ sources.
John W. Eaton <jwe@octave.org>
parents: 22587
diff changeset
1224 const QString& cond)
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1225 {
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1226 bool cmd_focus = command_window_has_focus ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1227
21158
65827e9cccb8 Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21148
diff changeset
1228 emit update_breakpoint_marker_signal (insert, file, line, cond);
16576
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1229
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1230 if (cmd_focus)
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1231 focus_command_window ();
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1232 }
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1233
2754c5fd6ae0 keep focus in the command window after dbstop, dbstep, etc.
John W. Eaton <jwe@octave.org>
parents: 16572
diff changeset
1234 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1235 main_window::read_settings (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
1236 {
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
1237 QSettings *settings = resource_manager::get_settings ();
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1238
20955
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 20278
diff changeset
1239 if (! settings)
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
1240 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1241 qDebug ("Error: QSettings pointer from resource manager is NULL.");
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
1242 return;
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
1243 }
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
1244
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1245 set_window_layout (settings);
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1246
15465
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
1247 // restore the list of the last directories
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1248 QStringList curr_dirs
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1249 = settings->value ("MainWindow/current_directory_list").toStringList ();
15465
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
1250 for (int i=0; i < curr_dirs.size (); i++)
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
1251 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1252 m_current_directory_combo_box->addItem (curr_dirs.at (i));
15465
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
1253 }
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
1254 emit settings_changed (settings);
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1255 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1256
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
1257 void
19303
c6615ca0a11d horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents: 19302
diff changeset
1258 main_window::init_terminal_size (void)
c6615ca0a11d horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents: 19302
diff changeset
1259 {
c6615ca0a11d horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents: 19302
diff changeset
1260 emit init_terminal_size_signal ();
c6615ca0a11d horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents: 19302
diff changeset
1261 }
c6615ca0a11d horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents: 19302
diff changeset
1262
c6615ca0a11d horizontal scrollbar for GUI terminal on Windows systems
John W. Eaton <jwe@octave.org>
parents: 19302
diff changeset
1263 void
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1264 main_window::set_window_layout (QSettings *settings)
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1265 {
18435
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
1266 restoreState (settings->value ("MainWindow/windowState").toByteArray ());
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
1267 restoreGeometry (settings->value ("MainWindow/geometry").toByteArray ());
17083
ceca3e65a8fe make sure a central menu bar does not show a widgets title but "Octave"
Torsten <ttl@justmail.de>
parents: 17029
diff changeset
1268
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1269 // Restore the geometry of all dock-widgets
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
1270 foreach (octave_dock_widget *widget, dock_widget_list ())
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1271 {
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
1272 QString name = widget->objectName ();
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1273
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
1274 if (! name.isEmpty ())
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1275 {
16798
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
1276 bool floating = settings->value
d749c9b588e5 make stand-alone windows from dock widgets when floating (bug #38785)
Torsten <ttl@justmail.de>
parents: 16699
diff changeset
1277 ("DockWidgets/" + name + "Floating", false).toBool ();
17899
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
1278 bool visible = settings->value
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
1279 ("DockWidgets/" + name + "Visible", true).toBool ();
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
1280
14c427b5c5c1 Restore geometry of floating widgets after restart in windows (bug #40485)
Torsten <ttl@justmail.de>
parents: 17890
diff changeset
1281 // If floating, make window from widget.
16811
81344ade678f fix resetting the window layout when some widgets are floating
Torsten <ttl@justmail.de>
parents: 16798
diff changeset
1282 if (floating)
18435
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
1283 {
24318
a17862b28f0d handle floating widgets on all platforms as done on windows (bug #52378)
Torsten <mttl@mailbox.org>
parents: 24275
diff changeset
1284 widget->make_window ();
a17862b28f0d handle floating widgets on all platforms as done on windows (bug #52378)
Torsten <mttl@mailbox.org>
parents: 24275
diff changeset
1285
a17862b28f0d handle floating widgets on all platforms as done on windows (bug #52378)
Torsten <mttl@mailbox.org>
parents: 24275
diff changeset
1286 if (visible)
a17862b28f0d handle floating widgets on all platforms as done on windows (bug #52378)
Torsten <mttl@mailbox.org>
parents: 24275
diff changeset
1287 {
a17862b28f0d handle floating widgets on all platforms as done on windows (bug #52378)
Torsten <mttl@mailbox.org>
parents: 24275
diff changeset
1288 if (settings->value ("DockWidgets/" + widget->objectName ()
a17862b28f0d handle floating widgets on all platforms as done on windows (bug #52378)
Torsten <mttl@mailbox.org>
parents: 24275
diff changeset
1289 + "_minimized").toBool ())
a17862b28f0d handle floating widgets on all platforms as done on windows (bug #52378)
Torsten <mttl@mailbox.org>
parents: 24275
diff changeset
1290 widget->showMinimized ();
a17862b28f0d handle floating widgets on all platforms as done on windows (bug #52378)
Torsten <mttl@mailbox.org>
parents: 24275
diff changeset
1291 else
a17862b28f0d handle floating widgets on all platforms as done on windows (bug #52378)
Torsten <mttl@mailbox.org>
parents: 24275
diff changeset
1292 widget->setVisible (true);
a17862b28f0d handle floating widgets on all platforms as done on windows (bug #52378)
Torsten <mttl@mailbox.org>
parents: 24275
diff changeset
1293 }
18435
4e49bc41f899 fix problems with gui startup (bug #41452) and focus issues (bug #40823)
Torsten <ttl@justmail.de>
parents: 18287
diff changeset
1294 }
24318
a17862b28f0d handle floating widgets on all platforms as done on windows (bug #52378)
Torsten <mttl@mailbox.org>
parents: 24275
diff changeset
1295 else // not floating
17090
1d544ac39369 show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents: 17083
diff changeset
1296 {
24318
a17862b28f0d handle floating widgets on all platforms as done on windows (bug #52378)
Torsten <mttl@mailbox.org>
parents: 24275
diff changeset
1297 if (! widget->parent ()) // should not be floating but is
a17862b28f0d handle floating widgets on all platforms as done on windows (bug #52378)
Torsten <mttl@mailbox.org>
parents: 24275
diff changeset
1298 widget->make_widget (false); // no docking, just reparent
a17862b28f0d handle floating widgets on all platforms as done on windows (bug #52378)
Torsten <mttl@mailbox.org>
parents: 24275
diff changeset
1299
17090
1d544ac39369 show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents: 17083
diff changeset
1300 widget->make_widget ();
24318
a17862b28f0d handle floating widgets on all platforms as done on windows (bug #52378)
Torsten <mttl@mailbox.org>
parents: 24275
diff changeset
1301 widget->setVisible (visible); // not floating -> show
17090
1d544ac39369 show correct undock-button of widgets when window layout is resetted
Torsten <ttl@justmail.de>
parents: 17083
diff changeset
1302 }
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1303 }
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1304 }
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1305
17995
ea1db0ede4ce make sure Octave is displayed in a global menu bar, not another widget name
Torsten <ttl@justmail.de>
parents: 17988
diff changeset
1306 show ();
16593
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1307 }
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1308
e13051d7a472 allow GUI window layout to be restored
John W. Eaton <jwe@octave.org>
parents: 16581
diff changeset
1309 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1310 main_window::write_settings (void)
13506
c70511cf64ee Reformatted to GNU Style.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13504
diff changeset
1311 {
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
1312 QSettings *settings = resource_manager::get_settings ();
20955
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 20278
diff changeset
1313 if (! settings)
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
1314 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1315 qDebug ("Error: QSettings pointer from resource manager is NULL.");
16413
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
1316 return;
28136851099a remove _terminal pointer from main_window, it is contained by other Qt object
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16399
diff changeset
1317 }
15164
bc801a44bb1f follow Octave pattern for resource_manager singleton
John W. Eaton <jwe@octave.org>
parents: 15106
diff changeset
1318
13537
a43ecce77eec Introduced a central ResourceManager class.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 13536
diff changeset
1319 settings->setValue ("MainWindow/geometry", saveGeometry ());
15552
bbbb89cc338f make a floating widget behave like a normal window (bug #37190)
Torsten <ttl@justmail.de>
parents: 15465
diff changeset
1320 settings->setValue ("MainWindow/windowState", saveState ());
15465
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
1321 // write the list of recent used directories
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
1322 QStringList curr_dirs;
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1323 for (int i=0; i<m_current_directory_combo_box->count (); i++)
15465
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
1324 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1325 curr_dirs.append (m_current_directory_combo_box->itemText (i));
15465
ded4ce76ee7a save and restore the list of recently visited directories
Torsten <ttl@justmail.de>
parents: 15426
diff changeset
1326 }
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1327 settings->setValue ("MainWindow/current_directory_list", curr_dirs);
14694
ea11c9d8aa47 Calling qApp->quit () via QMetaObject::invoke caused a segfault, now exits cleanly.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14693
diff changeset
1328 settings->sync ();
13501
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1329 }
86d6c3b90ad7 Added new gui files.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1330
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1331 // Connecting the signals emitted when the visibility of a widget changes.
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1332 // This has to be done after the window is shown (see octave-gui.cc)
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1333 void
16456
203efbbcea63 * main-window.h, main-window.cc: Style fixes.
John W. Eaton <jwe@octave.org>
parents: 16455
diff changeset
1334 main_window::connect_visibility_changed (void)
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1335 {
17617
9abb1422d60b correct indication of news-windows visibility in the window menu
Torsten <ttl@justmail.de>
parents: 17599
diff changeset
1336 foreach (octave_dock_widget *widget, dock_widget_list ())
9abb1422d60b correct indication of news-windows visibility in the window menu
Torsten <ttl@justmail.de>
parents: 17599
diff changeset
1337 widget->connect_visibility_changed ();
18944
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18840
diff changeset
1338
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21670
diff changeset
1339 #if defined (HAVE_QSCINTILLA)
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1340 m_editor_window->enable_menu_shortcuts (false);
19589
4fe86a372f10 Fix compilation error when building without QScintilla
Mike Miller <mtmiller@ieee.org>
parents: 19585
diff changeset
1341 #endif
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1342 }
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1343
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1344 void
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1345 main_window::copyClipboard (void)
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1346 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1347 if (m_current_directory_combo_box->hasFocus ())
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1348 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1349 QLineEdit *edit = m_current_directory_combo_box->lineEdit ();
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1350 if (edit && edit->hasSelectedText ())
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1351 {
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1352 QClipboard *clipboard = QApplication::clipboard ();
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1353 clipboard->setText (edit->selectedText ());
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1354 }
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1355 }
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1356 else
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1357 emit copyClipboard_signal ();
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1358 }
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1359
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1360 void
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1361 main_window::pasteClipboard (void)
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1362 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1363 if (m_current_directory_combo_box->hasFocus ())
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1364 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1365 QLineEdit *edit = m_current_directory_combo_box->lineEdit ();
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1366 QClipboard *clipboard = QApplication::clipboard ();
21568
3d60ed163b70 maint: Eliminate bad spacing around '='.
Rik <rik@octave.org>
parents: 21439
diff changeset
1367 QString str = clipboard->text ();
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1368 if (edit && str.length () > 0)
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1369 {
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1370 edit->insert (str);
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1371 }
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1372 }
16881
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1373 else
944ade6e7f66 Make main window copy and paste global for current focused window
John Donoghue <john.donoghue@ieee.org>
parents: 16818
diff changeset
1374 emit pasteClipboard_signal ();
16648
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1375 }
b04413e5a811 improve handling of interrupts, copy and paste shortcuts
John W. Eaton <jwe@octave.org>
parents: 16642
diff changeset
1376
18555
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1377 void
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1378 main_window::selectAll (void)
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1379 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1380 if (m_current_directory_combo_box->hasFocus ())
18555
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1381 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1382 QLineEdit *edit = m_current_directory_combo_box->lineEdit ();
18555
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1383 if (edit)
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1384 {
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1385 edit->selectAll ();
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1386 }
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1387 }
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1388 else
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1389 emit selectAll_signal ();
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1390 }
2d5d0d86432e gui: Add select all menu (Bug #41797)
John Donoghue <john.donoghue@ieee.org>
parents: 18498
diff changeset
1391
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1392 // Connect the signals emitted when the Octave thread wants to create
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1393 // a dialog box of some sort. Perhaps a better place for this would be
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1394 // as part of the QUIWidgetCreator class. However, mainWindow currently
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1395 // is not a global variable and not accessible for connecting.
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1396
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1397 void
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1398 main_window::connect_uiwidget_links (void)
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1399 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1400 connect (&uiwidget_creator,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1401 SIGNAL (create_dialog (const QString&, const QString&,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1402 const QString&, const QStringList&,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1403 const QString&, const QStringList&)),
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1404 this,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1405 SLOT (handle_create_dialog (const QString&, const QString&,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1406 const QString&, const QStringList&,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1407 const QString&, const QStringList&)));
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1408
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1409 // Register QIntList so that list of ints may be part of a signal.
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1410 qRegisterMetaType<QIntList> ("QIntList");
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1411 connect (&uiwidget_creator,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1412 SIGNAL (create_listview (const QStringList&, const QString&,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1413 int, int, const QIntList&,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
1414 const QString&, const QStringList&,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1415 const QString&, const QString&)),
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1416 this,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1417 SLOT (handle_create_listview (const QStringList&, const QString&,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1418 int, int, const QIntList&,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
1419 const QString&, const QStringList&,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1420 const QString&, const QString&)));
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1421
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
1422 // Register QFloatList so that list of floats may be part of a signal.
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1423 qRegisterMetaType<QFloatList> ("QFloatList");
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1424 connect (&uiwidget_creator,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1425 SIGNAL (create_inputlayout (const QStringList&, const QString&,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
1426 const QFloatList&, const QFloatList&,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1427 const QStringList&)),
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1428 this,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1429 SLOT (handle_create_inputlayout (const QStringList&, const QString&,
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1430 const QFloatList&,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1431 const QFloatList&,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1432 const QStringList&)));
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1433
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1434 connect (&uiwidget_creator,
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1435 SIGNAL (create_filedialog (const QStringList &,const QString&,
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1436 const QString&, const QString&,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1437 const QString&)),
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1438 this,
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1439 SLOT (handle_create_filedialog (const QStringList &, const QString&,
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1440 const QString&, const QString&,
16581
fa4a035e0cf4 Add octave_link uiputfile implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16580
diff changeset
1441 const QString&)));
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1442 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1443
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1444 // Create a message dialog with specified string, buttons and decorative
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1445 // text.
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1446
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1447 void
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1448 main_window::handle_create_dialog (const QString& message,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1449 const QString& title,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1450 const QString& icon,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1451 const QStringList& button,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1452 const QString& defbutton,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1453 const QStringList& role)
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1454 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1455 MessageDialog *message_dialog = new MessageDialog (message, title, icon,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1456 button, defbutton, role);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1457 message_dialog->setAttribute (Qt::WA_DeleteOnClose);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1458 message_dialog->show ();
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1459 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1460
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1461 // Create a list dialog with specified list, initially selected, mode,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1462 // view size and decorative text.
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1463
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1464 void
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1465 main_window::handle_create_listview (const QStringList& list,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1466 const QString& mode,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1467 int wd, int ht,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1468 const QIntList& initial,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1469 const QString& name,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
1470 const QStringList& prompt,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1471 const QString& ok_string,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1472 const QString& cancel_string)
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1473 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1474 ListDialog *list_dialog = new ListDialog (list, mode, wd, ht,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
1475 initial, name, prompt,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1476 ok_string, cancel_string);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1477
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1478 list_dialog->setAttribute (Qt::WA_DeleteOnClose);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1479 list_dialog->show ();
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1480 }
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1481
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1482 // Create an input dialog with specified prompts and defaults, title and
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1483 // row/column size specifications.
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1484 void
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1485 main_window::handle_create_inputlayout (const QStringList& prompt,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1486 const QString& title,
16551
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
1487 const QFloatList& nr,
6ae555fc8c43 Add questdlg dialog function and fix variety of dialog bugs.
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 16547
diff changeset
1488 const QFloatList& nc,
16512
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1489 const QStringList& defaults)
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1490 {
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1491 InputDialog *input_dialog = new InputDialog (prompt, title, nr, nc,
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1492 defaults);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1493
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1494 input_dialog->setAttribute (Qt::WA_DeleteOnClose);
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1495 input_dialog->show ();
7f2395651a1c dialog boxes with Qt widgets
Daniel J Sebald <daniel.sebald@ieee.org>, John W. Eaton <jwe@octave.org>
parents: 16504
diff changeset
1496 }
15987
47a4c92924a7 gui: prevent error messages at start-up (regression from changeset 6c0fce0632a4)
Torsten <ttl@justmail.de>
parents: 15983
diff changeset
1497
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1498 void
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1499 main_window::handle_create_filedialog (const QStringList& filters,
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1500 const QString& title,
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
1501 const QString& filename,
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1502 const QString& dirname,
16581
fa4a035e0cf4 Add octave_link uiputfile implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16580
diff changeset
1503 const QString& multimode)
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1504 {
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1505 FileDialog *file_dialog = new FileDialog (filters, title, filename,
16581
fa4a035e0cf4 Add octave_link uiputfile implementation
John Donoghue <john.donoghue@ieee.org>
parents: 16580
diff changeset
1506 dirname, multimode);
16580
adc150db1809 style fixes for uigetfile changes
John W. Eaton <jwe@octave.org>
parents: 16579
diff changeset
1507
16579
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1508 file_dialog->setAttribute (Qt::WA_DeleteOnClose);
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1509 file_dialog->show ();
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1510 }
7f8db1942dc0 Add Qt link uigetfile dialog implementation.
John Donoghue <john.donoghue@ieee.org>
parents: 16578
diff changeset
1511
23385
41639665aa34 improve opening files from gui when built without qscintilla (bug #39179)
Torsten <mttl@mailbox.org>
parents: 23380
diff changeset
1512 void
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1513 main_window::handle_show_doc (const QString& file)
23385
41639665aa34 improve opening files from gui when built without qscintilla (bug #39179)
Torsten <mttl@mailbox.org>
parents: 23380
diff changeset
1514 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1515 m_doc_browser_window->setVisible (true);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1516 emit show_doc_signal (file);
23385
41639665aa34 improve opening files from gui when built without qscintilla (bug #39179)
Torsten <mttl@mailbox.org>
parents: 23380
diff changeset
1517 }
41639665aa34 improve opening files from gui when built without qscintilla (bug #39179)
Torsten <mttl@mailbox.org>
parents: 23380
diff changeset
1518
41639665aa34 improve opening files from gui when built without qscintilla (bug #39179)
Torsten <mttl@mailbox.org>
parents: 23380
diff changeset
1519 void
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1520 main_window::handle_octave_ready (void)
18309
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1521 {
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1522 // actions after the startup files are executed
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1523 QSettings *settings = resource_manager::get_settings ();
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1524
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1525 QDir startup_dir = QDir (); // current octave dir after startup
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1526
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1527 if (settings)
18309
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1528 {
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1529 if (settings->value ("restore_octave_dir").toBool ())
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1530 {
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1531 // restore last dir from previous session
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1532 QStringList curr_dirs
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1533 = settings->value ("MainWindow/current_directory_list").toStringList ();
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
1534 startup_dir
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
1535 = QDir (curr_dirs.at (0)); // last dir in previous session
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1536 }
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1537 else if (! settings->value ("octave_startup_dir").toString ().isEmpty ())
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1538 {
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1539 // do not restore but there is a startup dir configured
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
1540 startup_dir
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
1541 = QDir (settings->value ("octave_startup_dir").toString ());
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1542 }
18309
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1543 }
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1544
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1545 if (! startup_dir.exists ())
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1546 {
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1547 // the configured startup dir does not exist, take actual one
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1548 startup_dir = QDir ();
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1549 }
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1550
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1551 set_current_working_directory (startup_dir.absolutePath ());
18833
6504a1932637 auto completion offers builtins and file functions for octave (bug #41371)
Torsten <ttl@justmail.de>
parents: 18823
diff changeset
1552
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1553 if (m_editor_window)
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1554 {
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21670
diff changeset
1555 #if defined (HAVE_QSCINTILLA)
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1556 // Octave ready, determine whether to create an empty script.
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1557 // This can not be done when the editor is created because all functions
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1558 // must be known for the lexer's auto completion informations
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1559 m_editor_window->empty_script (true, false);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1560 m_editor_window->restore_session (settings);
18833
6504a1932637 auto completion offers builtins and file functions for octave (bug #41371)
Torsten <ttl@justmail.de>
parents: 18823
diff changeset
1561 #endif
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1562 }
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1563
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1564 if (m_start_gui)
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1565 focus_command_window (); // make sure that the command window has focus
23979
fb9b024a6041 avoid SIGABRT on exit from the GUI (bug #50210)
John W. Eaton <jwe@octave.org>
parents: 23953
diff changeset
1566 }
fb9b024a6041 avoid SIGABRT on exit from the GUI (bug #50210)
John W. Eaton <jwe@octave.org>
parents: 23953
diff changeset
1567
fb9b024a6041 avoid SIGABRT on exit from the GUI (bug #50210)
John W. Eaton <jwe@octave.org>
parents: 23953
diff changeset
1568 void
fb9b024a6041 avoid SIGABRT on exit from the GUI (bug #50210)
John W. Eaton <jwe@octave.org>
parents: 23953
diff changeset
1569 main_window::handle_octave_finished (int exit_status)
fb9b024a6041 avoid SIGABRT on exit from the GUI (bug #50210)
John W. Eaton <jwe@octave.org>
parents: 23953
diff changeset
1570 {
fb9b024a6041 avoid SIGABRT on exit from the GUI (bug #50210)
John W. Eaton <jwe@octave.org>
parents: 23953
diff changeset
1571 qApp->exit (exit_status);
18309
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1572 }
024940bd5b77 gui: provide prefernces for the octave directory at startup
Torsten <ttl@justmail.de>
parents: 18288
diff changeset
1573
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1574 void
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1575 main_window::find_files (const QString& start_dir)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1576 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1577
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1578 if (! m_find_files_dlg)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1579 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1580 m_find_files_dlg = new find_files_dialog (this);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1581
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1582 connect (m_find_files_dlg, SIGNAL (finished (int)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1583 this, SLOT (find_files_finished (int)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1584
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1585 connect (m_find_files_dlg, SIGNAL (dir_selected (const QString &)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1586 m_file_browser_window,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1587 SLOT (set_current_directory (const QString&)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1588
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1589 connect (m_find_files_dlg, SIGNAL (file_selected (const QString &)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1590 this, SLOT (open_file (const QString &)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1591
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1592 m_find_files_dlg->setWindowModality (Qt::NonModal);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1593 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1594
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1595 if (! m_find_files_dlg->isVisible ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1596 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1597 m_find_files_dlg->show ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1598 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1599
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1600 m_find_files_dlg->set_search_dir (start_dir);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1601
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1602 m_find_files_dlg->activateWindow ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1603
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1604 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1605
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1606 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1607 main_window::set_global_shortcuts (bool set_shortcuts)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1608 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1609 // this slot is called when the terminal gets/loses focus
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1610
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1611 // return if the user don't want to use readline shortcuts
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1612 if (! m_prevent_readline_conflicts)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1613 return;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1614
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1615 if (set_shortcuts)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1616 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1617 // terminal loses focus: set the global shortcuts
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1618 configure_shortcuts ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1619 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1620 else
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1621 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1622 // terminal gets focus: disable some shortcuts
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1623 QKeySequence no_key = QKeySequence ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1624
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1625 // file menu
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1626 m_open_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1627 m_new_script_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1628 m_new_function_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1629 m_new_function_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1630 m_load_workspace_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1631 m_save_workspace_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1632 m_preferences_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1633 m_exit_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1634
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1635 // edit menu
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1636 m_select_all_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1637 m_clear_clipboard_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1638 m_find_files_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1639 m_clear_command_history_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1640 m_clear_command_window_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1641 m_clear_workspace_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1642
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1643 // window menu
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1644 m_reset_windows_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1645
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1646 // help menu
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1647 m_ondisk_doc_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1648 m_online_doc_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1649 m_report_bug_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1650 m_octave_packages_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1651 m_contribute_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1652 m_developer_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1653 m_about_octave_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1654
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1655 // news menu
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1656 m_release_notes_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1657 m_current_news_action->setShortcut (no_key);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1658 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1659 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1660
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1661 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1662 main_window::set_screen_size (int ht, int wd)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1663 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1664 octave_link::post_event (this, &main_window::set_screen_size_callback,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1665 int_pair (ht, wd));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1666 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1667
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1668 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1669 main_window::clipboard_has_changed (QClipboard::Mode cp_mode)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1670 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1671 if (cp_mode == QClipboard::Clipboard)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1672 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1673 if (m_clipboard->text ().isEmpty ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1674 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1675 m_paste_action->setEnabled (false);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1676 m_clear_clipboard_action->setEnabled (false);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1677 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1678 else
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1679 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1680 m_paste_action->setEnabled (true);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1681 m_clear_clipboard_action->setEnabled (true);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1682 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1683 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1684 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1685
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1686 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1687 main_window::clear_clipboard (void)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1688 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1689 m_clipboard->clear (QClipboard::Clipboard);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1690 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1691
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1692 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1693 main_window::interrupt_interpreter (void)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1694 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1695 m_interpreter->interrupt ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1696 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1697
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1698 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1699 main_window::disable_menu_shortcuts (bool disable)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1700 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1701 QHash<QMenu*, QStringList>::const_iterator i = m_hash_menu_text.constBegin ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1702
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1703 while (i != m_hash_menu_text.constEnd ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1704 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1705 i.key ()->setTitle (i.value ().at (disable));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1706 ++i;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1707 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1708 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1709
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1710 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1711 main_window::restore_create_file_setting (void)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1712 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1713 // restore the new files creation setting
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1714 QSettings *settings = resource_manager::get_settings ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1715 settings->setValue ("editor/create_new_file",false);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1716 disconnect (m_editor_window, SIGNAL (file_loaded_signal (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1717 this, SLOT (restore_create_file_setting (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1718 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1719
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1720 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1721 main_window::set_file_encoding (const QString& new_encoding)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1722 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1723 m_file_encoding = new_encoding;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1724 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1725
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1726 // The following slot is called after files have been selected in the
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1727 // open file dialog., possibly with a new selected encoding stored in
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1728 // m_file_encoding
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1729 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1730 main_window::request_open_files (const QStringList& open_file_names)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1731 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1732 for (int i = 0; i < open_file_names.count (); i++)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1733 emit open_file_signal (open_file_names.at (i), m_file_encoding, -1);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1734 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1735
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1736 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1737 main_window::edit_variable (const QString &expr)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1738 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1739 m_variable_editor_window->edit_variable (expr);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1740
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1741 if (! m_variable_editor_window->isVisible ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1742 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1743 m_variable_editor_window->show ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1744 m_variable_editor_window->raise ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1745 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1746
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1747 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1748
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1749 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1750 main_window::clear_variable_editor_cache (void)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1751 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1752 m_variable_editor_window->clear_data_cache ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1753 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1754
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1755 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1756 main_window::variable_editor_callback (void)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1757 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1758 // Called when the variable editor makes changes.
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1759 octave_link::post_event(this, &main_window::force_refresh_workspace);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1760 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1761
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1762 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1763 main_window::closeEvent (QCloseEvent *e)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1764 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1765 e->ignore ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1766 octave_cmd_exec *cmd = new octave_cmd_exec ("exit");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1767 m_cmd_queue.add_cmd (cmd);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1768 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1769
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1770 // Main subroutine of the constructor
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1771
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1772 void
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1773 main_window::construct (void)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1774 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1775 m_closing = false; // flag for editor files when closed
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1776
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1777 // Create and set the central widget. QMainWindow takes ownership of
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1778 // the widget (pointer) so there is no need to delete the object upon
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1779 // destroying this main_window.
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1780
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1781 QWidget *dummyWidget = new QWidget ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1782 dummyWidget->setObjectName ("CentralDummyWidget");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1783 dummyWidget->resize (10, 10);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1784 dummyWidget->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Minimum);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1785 dummyWidget->hide ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1786 setCentralWidget (dummyWidget);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1787
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1788 connect_uiwidget_links ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1789
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1790 construct_octave_qt_link ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1791
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1792 if (m_start_gui)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1793 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1794 setWindowIcon (QIcon (":/actions/icons/logo.png"));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1795
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1796 m_workspace_window->setModel (m_workspace_model);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1797
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1798 connect (m_workspace_model, SIGNAL (model_changed (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1799 m_workspace_window, SLOT (handle_model_changed (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1800
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1801 connect (m_octave_qt_link, SIGNAL (open_variable (const QString&)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1802 this, SLOT (edit_variable (const QString&)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1803
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1804 connect (m_octave_qt_link, SIGNAL (refresh_variable_editor (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1805 this, SLOT (clear_variable_editor_cache (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1806
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1807 connect (m_workspace_model,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1808 SIGNAL (rename_variable (const QString&, const QString&)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1809 this,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1810 SLOT (handle_rename_variable_request (const QString&,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1811 const QString&)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1812
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1813 connect (m_variable_editor_window, SIGNAL (updated (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1814 this, SLOT (variable_editor_callback (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1815
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1816 connect (m_command_window, SIGNAL (interrupt_signal (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1817 this, SLOT (interrupt_interpreter (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1818
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1819 construct_menu_bar ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1820
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1821 construct_tool_bar ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1822
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1823 // Order is important. Deleting QSettings must be last.
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1824 connect (qApp, SIGNAL (aboutToQuit (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1825 m_command_window, SLOT (save_settings (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1826
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1827 connect (qApp, SIGNAL (aboutToQuit (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1828 m_history_window, SLOT (save_settings (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1829
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1830 connect (qApp, SIGNAL (aboutToQuit (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1831 m_file_browser_window, SLOT (save_settings (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1832
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1833 connect (qApp, SIGNAL (aboutToQuit (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1834 m_doc_browser_window, SLOT (save_settings (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1835
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1836 connect (qApp, SIGNAL (aboutToQuit (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1837 m_workspace_window, SLOT (save_settings (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1838
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1839 connect (qApp, SIGNAL (aboutToQuit (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1840 m_editor_window, SLOT (save_settings (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1841
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1842 connect (qApp, SIGNAL (aboutToQuit (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1843 m_variable_editor_window, SLOT (save_settings (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1844
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1845 connect (qApp, SIGNAL (aboutToQuit (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1846 this, SLOT (prepare_to_exit (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1847
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1848 connect (qApp, SIGNAL (aboutToQuit (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1849 shortcut_manager::instance, SLOT (cleanup_instance (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1850
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1851 // QSettings are saved upon deletion (i.e., cleanup_instance)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1852 connect (qApp, SIGNAL (aboutToQuit (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1853 resource_manager::instance, SLOT (cleanup_instance (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1854
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1855 connect (qApp, SIGNAL (focusChanged (QWidget*, QWidget*)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1856 this, SLOT (focus_changed (QWidget*, QWidget*)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1857
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1858 connect (this, SIGNAL (settings_changed (const QSettings *)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1859 this, SLOT (notice_settings (const QSettings *)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1860
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1861 connect (this, SIGNAL (editor_focus_changed (bool)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1862 this, SLOT (disable_menu_shortcuts (bool)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1863
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1864 connect (this, SIGNAL (editor_focus_changed (bool)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1865 m_editor_window, SLOT (enable_menu_shortcuts (bool)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1866
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1867 connect (m_editor_window,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1868 SIGNAL (request_open_file_external (const QString&, int)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1869 m_external_editor,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1870 SLOT (call_custom_editor (const QString&, int)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1871
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1872 connect (m_external_editor,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1873 SIGNAL (request_settings_dialog (const QString&)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1874 this, SLOT (process_settings_dialog_request (const QString&)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1875
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1876 connect (m_file_browser_window, SIGNAL (load_file_signal (const QString&)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1877 this, SLOT (handle_load_workspace_request (const QString&)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1878
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1879 connect (m_file_browser_window, SIGNAL (find_files_signal (const QString&)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1880 this, SLOT (find_files (const QString&)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1881
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1882 setWindowTitle ("Octave");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1883
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1884 setDockOptions (QMainWindow::AnimatedDocks
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1885 | QMainWindow::AllowNestedDocks
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1886 | QMainWindow::AllowTabbedDocks);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1887
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1888 addDockWidget (Qt::RightDockWidgetArea, m_command_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1889 addDockWidget (Qt::RightDockWidgetArea, m_doc_browser_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1890 tabifyDockWidget (m_command_window, m_doc_browser_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1891
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1892 #if defined (HAVE_QSCINTILLA)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1893 addDockWidget (Qt::RightDockWidgetArea, m_editor_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1894 tabifyDockWidget (m_command_window, m_editor_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1895 #endif
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1896 addDockWidget (Qt::RightDockWidgetArea, m_variable_editor_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1897 tabifyDockWidget (m_command_window, m_variable_editor_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1898
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1899 addDockWidget (Qt::LeftDockWidgetArea, m_file_browser_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1900 addDockWidget (Qt::LeftDockWidgetArea, m_workspace_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1901 addDockWidget (Qt::LeftDockWidgetArea, m_history_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1902
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1903 int win_x = QApplication::desktop ()->width ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1904 int win_y = QApplication::desktop ()->height ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1905
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1906 if (win_x > 960)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1907 win_x = 960;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1908
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1909 if (win_y > 720)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1910 win_y = 720;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1911
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1912 setGeometry (0, 0, win_x, win_y);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1913
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1914 setStatusBar (m_status_bar);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1915
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1916 #if defined (HAVE_QSCINTILLA)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1917 connect (this,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1918 SIGNAL (insert_debugger_pointer_signal (const QString&, int)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1919 m_editor_window,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1920 SLOT (handle_insert_debugger_pointer_request (const QString&,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1921 int)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1922
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1923 connect (this,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1924 SIGNAL (delete_debugger_pointer_signal (const QString&, int)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1925 m_editor_window,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1926 SLOT (handle_delete_debugger_pointer_request (const QString&,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1927 int)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1928
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1929 connect (this,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1930 SIGNAL (update_breakpoint_marker_signal (bool, const QString&,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1931 int, const QString&)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1932 m_editor_window,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1933 SLOT (handle_update_breakpoint_marker_request (bool,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1934 const QString&,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1935 int,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1936 const QString&)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1937
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1938 connect (m_file_browser_window,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1939 SIGNAL (file_remove_signal (const QString&, const QString&)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1940 m_editor_window,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1941 SLOT (handle_file_remove (const QString&, const QString&)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1942
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1943 connect (m_file_browser_window, SIGNAL (file_renamed_signal (bool)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1944 m_editor_window, SLOT (handle_file_renamed (bool)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1945 #endif
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1946
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1947 octave_link::post_event (this,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1948 &main_window::resize_command_window_callback);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1949
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1950 configure_shortcuts ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1951 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1952 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1953
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1954 void
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1955 main_window::construct_octave_qt_link (void)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
1956 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1957 m_octave_qt_link = new octave_qt_link (this, m_app_context);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1958
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1959 octave_link::connect_link (m_octave_qt_link);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1960
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1961 connect (m_octave_qt_link, SIGNAL (confirm_shutdown_signal (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1962 this, SLOT (confirm_shutdown_octave (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1963
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1964 connect (m_octave_qt_link,
20243
ede7224d062f Allow copying a figure to clipboard even in --no-gui mode (bug #44886)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20186
diff changeset
1965 SIGNAL (copy_image_to_clipboard_signal (const QString&, bool)),
ede7224d062f Allow copying a figure to clipboard even in --no-gui mode (bug #44886)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20186
diff changeset
1966 this, SLOT (copy_image_to_clipboard (const QString&, bool)));
ede7224d062f Allow copying a figure to clipboard even in --no-gui mode (bug #44886)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20186
diff changeset
1967
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1968 if (m_start_gui)
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1969 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1970 connect (m_octave_qt_link,
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1971 SIGNAL (set_workspace_signal
19970
f7846f0ea6db GUI: enable workspace update when debugging (Bug #44455)
John Donoghue
parents: 19949
diff changeset
1972 (bool, bool, const QString&, const QStringList&,
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1973 const QStringList&, const QStringList&,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1974 const QStringList&, const QIntList&)),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1975 m_workspace_model,
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1976 SLOT (set_workspace
19970
f7846f0ea6db GUI: enable workspace update when debugging (Bug #44455)
John Donoghue
parents: 19949
diff changeset
1977 (bool, bool, const QString&, const QStringList&,
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1978 const QStringList&, const QStringList&,
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1979 const QStringList&, const QIntList&)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1980
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1981 connect (m_octave_qt_link, SIGNAL (clear_workspace_signal (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1982 m_workspace_model, SLOT (clear_workspace (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1983
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1984 connect (m_octave_qt_link, SIGNAL (change_directory_signal (QString)),
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1985 this, SLOT (change_directory (QString)));
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1986
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1987 connect (m_octave_qt_link, SIGNAL (change_directory_signal (QString)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1988 m_file_browser_window, SLOT (update_octave_directory (QString)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1989
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1990 connect (m_octave_qt_link, SIGNAL (change_directory_signal (QString)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1991 m_editor_window, SLOT (update_octave_directory (QString)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1992
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1993 connect (m_octave_qt_link,
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1994 SIGNAL (execute_command_in_terminal_signal (QString)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1995 this, SLOT (execute_command_in_terminal (QString)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1996
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1997 connect (m_octave_qt_link,
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
1998 SIGNAL (set_history_signal (const QStringList&)),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
1999 m_history_window, SLOT (set_history (const QStringList&)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2000
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2001 connect (m_octave_qt_link,
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
2002 SIGNAL (append_history_signal (const QString&)),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2003 m_history_window, SLOT (append_history (const QString&)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2004
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2005 connect (m_octave_qt_link,
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
2006 SIGNAL (clear_history_signal (void)),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2007 m_history_window, SLOT (clear_history (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2008
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2009 connect (m_octave_qt_link, SIGNAL (enter_debugger_signal (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2010 this, SLOT (handle_enter_debugger (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2011
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2012 connect (m_octave_qt_link, SIGNAL (exit_debugger_signal (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2013 this, SLOT (handle_exit_debugger (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2014
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2015 connect (m_octave_qt_link,
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
2016 SIGNAL (show_preferences_signal (void)),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2017 this, SLOT (process_settings_dialog_request (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2018
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2019 connect (m_octave_qt_link,
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
2020 SIGNAL (edit_file_signal (const QString&)),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2021 m_active_editor,
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
2022 SLOT (handle_edit_file_request (const QString&)));
16424
ad052cdc89ad use signal for octave_link::edit_file
John W. Eaton <jwe@octave.org>
parents: 16423
diff changeset
2023
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2024 connect (m_octave_qt_link,
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
2025 SIGNAL (insert_debugger_pointer_signal (const QString&, int)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
2026 this,
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
2027 SLOT (handle_insert_debugger_pointer_request (const QString&,
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
2028 int)));
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
2029
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2030 connect (m_octave_qt_link,
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
2031 SIGNAL (delete_debugger_pointer_signal (const QString&, int)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
2032 this,
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
2033 SLOT (handle_delete_debugger_pointer_request (const QString&,
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
2034 int)));
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
2035
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2036 connect (m_octave_qt_link,
21158
65827e9cccb8 Gui support for enhancement of dbstop.
Lachlan Andrew <lachlanbis@gmail.com>
parents: 21148
diff changeset
2037 SIGNAL (update_breakpoint_marker_signal (bool, const QString&,
22599
51b395d24782 maint: strip tabs and trailing whitespace from C++ sources.
John W. Eaton <jwe@octave.org>
parents: 22587
diff changeset
2038 int, const QString&)),
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
2039 this,
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2040 SLOT (handle_update_breakpoint_marker_request (bool, const QString&,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2041 int, const QString&)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2042
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2043 connect (m_octave_qt_link,
19949
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
2044 SIGNAL (show_doc_signal (const QString &)),
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
2045 this, SLOT (handle_show_doc (const QString &)));
857a8f018f53 set up octave_link when running with --no-gui option (bug #44116)
John W. Eaton <jwe@octave.org>
parents: 19945
diff changeset
2046 }
17920
5c3f22dd0bbb raise SIGINT in octave_interpreter instead of in QTerminal
John W. Eaton <jwe@octave.org>
parents: 17918
diff changeset
2047
21428
217e6e97085b Prevent race conditions in GUI and interpreter initialization (bug #47326)
Mike Miller <mtmiller@octave.org>
parents: 21396
diff changeset
2048 // Defer initializing and executing the interpreter until after the main
217e6e97085b Prevent race conditions in GUI and interpreter initialization (bug #47326)
Mike Miller <mtmiller@octave.org>
parents: 21396
diff changeset
2049 // window and QApplication are running to prevent race conditions
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2050 QTimer::singleShot (0, m_interpreter, SLOT (execute (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2051 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2052
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2053 QAction*
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2054 main_window::add_action (QMenu *menu, const QIcon& icon, const QString& text,
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2055 const char *member, const QWidget *receiver)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2056 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2057 QAction *a;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2058
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2059 if (receiver)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2060 a = menu->addAction (icon, text, receiver, member);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2061 else
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2062 a = menu->addAction (icon, text, this, member);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2063
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2064 addAction (a); // important for shortcut context
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2065 a->setShortcutContext (Qt::ApplicationShortcut);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2066 return a;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2067 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2068
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2069 QMenu*
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2070 main_window::m_add_menu (QMenuBar *p, QString name)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2071 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2072 QMenu *menu = p->addMenu (name);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2073
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2074 QString base_name = name; // get a copy
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2075 // replace intended '&' ("&&") by a temp. string
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2076 base_name.replace ("&&", "___octave_amp_replacement___");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2077 // remove single '&' (shortcut)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2078 base_name.remove ("&");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2079 // restore intended '&'
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2080 base_name.replace ("___octave_amp_replacement___", "&&");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2081
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2082 // remember names with and without shortcut
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2083 m_hash_menu_text[menu] = QStringList () << name << base_name;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2084
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2085 return menu;
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2086 }
16437
919796a440c6 use signal for changing directory
John W. Eaton <jwe@octave.org>
parents: 16432
diff changeset
2087
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2088 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2089 main_window::construct_menu_bar (void)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2090 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2091 QMenuBar *menu_bar = menuBar ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2092
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2093 construct_file_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2094
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2095 construct_edit_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2096
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2097 construct_debug_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2098
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2099 construct_window_menu (menu_bar);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2100
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2101 construct_help_menu (menu_bar);
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
2102
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
2103 construct_news_menu (menu_bar);
20986
00835323fb44 prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents: 20955
diff changeset
2104
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21670
diff changeset
2105 #if defined (HAVE_QSCINTILLA)
20989
98e75f952a36 add find files action also to the editor menu
Torsten <ttl@justmail.de>
parents: 20986
diff changeset
2106 // call the editor to add actions which should also be available in the
98e75f952a36 add find files action also to the editor menu
Torsten <ttl@justmail.de>
parents: 20986
diff changeset
2107 // editor's menu and tool bar
98e75f952a36 add find files action also to the editor menu
Torsten <ttl@justmail.de>
parents: 20986
diff changeset
2108 QList<QAction*> shared_actions;
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2109 shared_actions << m_new_script_action
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2110 << m_new_function_action
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2111 << m_open_action
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2112 << m_find_files_action
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2113 << m_undo_action
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2114 << m_copy_action
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2115 << m_paste_action
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2116 <<m_select_all_action;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2117 m_editor_window->insert_global_actions (shared_actions);
20986
00835323fb44 prevent shortcut ambiguity between main and editor window
Torsten <ttl@justmail.de>
parents: 20955
diff changeset
2118 #endif
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2119 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2120
18944
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18840
diff changeset
2121 void
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2122 main_window::construct_file_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2123 {
18944
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18840
diff changeset
2124 QMenu *file_menu = m_add_menu (p, tr ("&File"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2125
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2126 construct_new_menu (file_menu);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2127
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2128 m_open_action
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19893
diff changeset
2129 = file_menu->addAction (resource_manager::icon ("document-open"),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2130 tr ("Open..."));
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2131 m_open_action->setShortcutContext (Qt::ApplicationShortcut);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2132 m_open_action->setToolTip (tr ("Open an existing file in editor"));
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2133
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21670
diff changeset
2134 #if defined (HAVE_QSCINTILLA)
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2135 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
2136 #endif
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2137
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2138 file_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2139
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2140 m_load_workspace_action
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 18251
diff changeset
2141 = file_menu->addAction (tr ("Load Workspace..."));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2142
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2143 m_save_workspace_action
18257
cae24b7cfaf4 minor fix of text strings and related translations (part of bug #41201)
Torsten <ttl@justmail.de>
parents: 18251
diff changeset
2144 = file_menu->addAction (tr ("Save Workspace As..."));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2145
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2146 file_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2147
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2148 m_exit_action = file_menu->addAction (tr ("Exit"));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2149 m_exit_action->setShortcutContext (Qt::ApplicationShortcut);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2150
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2151 connect (m_open_action, SIGNAL (triggered (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2152 this, SLOT (request_open_file (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2153
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2154 connect (m_load_workspace_action, SIGNAL (triggered (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2155 this, SLOT (handle_load_workspace_request (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2156
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2157 connect (m_save_workspace_action, SIGNAL (triggered (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2158 this, SLOT (handle_save_workspace_request (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2159
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2160 connect (m_exit_action, SIGNAL (triggered (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2161 this, SLOT (close (void)));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2162 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2163
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2164 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2165 main_window::construct_new_menu (QMenu *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2166 {
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2167 QMenu *new_menu = p->addMenu (tr ("New"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2168
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2169 m_new_script_action
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19893
diff changeset
2170 = new_menu->addAction (resource_manager::icon ("document-new"),
18345
dfc6ef6ac455 some text improvements in the gui (#bug 41201)
Torsten <ttl@justmail.de>
parents: 18318
diff changeset
2171 tr ("New Script"));
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2172 m_new_script_action->setShortcutContext (Qt::ApplicationShortcut);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2173
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2174 m_new_function_action = new_menu->addAction (tr ("New Function..."));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2175 m_new_function_action->setEnabled (true);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2176 m_new_function_action->setShortcutContext (Qt::ApplicationShortcut);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2177
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2178 m_new_figure_action = new_menu->addAction (tr ("New Figure"));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2179 m_new_figure_action->setEnabled (true);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2180
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2181 connect (m_new_script_action, SIGNAL (triggered (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2182 this, SLOT (request_new_script (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2183
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2184 connect (m_new_function_action, SIGNAL (triggered (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2185 this, SLOT (request_new_function (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2186
23385
41639665aa34 improve opening files from gui when built without qscintilla (bug #39179)
Torsten <mttl@mailbox.org>
parents: 23380
diff changeset
2187 connect (this, SIGNAL (new_file_signal (const QString&)),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2188 m_active_editor, SLOT (request_new_file (const QString&)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2189
23385
41639665aa34 improve opening files from gui when built without qscintilla (bug #39179)
Torsten <mttl@mailbox.org>
parents: 23380
diff changeset
2190 connect (this, SIGNAL (open_file_signal (const QString&)),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2191 m_active_editor, SLOT (request_open_file (const QString&)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2192
23385
41639665aa34 improve opening files from gui when built without qscintilla (bug #39179)
Torsten <mttl@mailbox.org>
parents: 23380
diff changeset
2193 connect (this,
41639665aa34 improve opening files from gui when built without qscintilla (bug #39179)
Torsten <mttl@mailbox.org>
parents: 23380
diff changeset
2194 SIGNAL (open_file_signal (const QString&, const QString&, int)),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2195 m_active_editor,
23385
41639665aa34 improve opening files from gui when built without qscintilla (bug #39179)
Torsten <mttl@mailbox.org>
parents: 23380
diff changeset
2196 SLOT (request_open_file (const QString&, const QString&, int)));
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2197
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2198 connect (m_new_figure_action, SIGNAL (triggered (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2199 this, SLOT (handle_new_figure_request (void)));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2200 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2201
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2202 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2203 main_window::construct_edit_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2204 {
18944
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18840
diff changeset
2205 QMenu *edit_menu = m_add_menu (p, tr ("&Edit"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2206
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2207 QKeySequence ctrl_shift = Qt::ControlModifier + Qt::ShiftModifier;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2208
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2209 m_undo_action
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19893
diff changeset
2210 = edit_menu->addAction (resource_manager::icon ("edit-undo"), tr ("Undo"));
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2211 m_undo_action->setShortcutContext (Qt::ApplicationShortcut);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2212
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2213 edit_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2214
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2215 m_copy_action
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19893
diff changeset
2216 = edit_menu->addAction (resource_manager::icon ("edit-copy"),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2217 tr ("Copy"), this, SLOT (copyClipboard (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2218 m_copy_action->setShortcutContext (Qt::ApplicationShortcut);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2219
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2220 m_paste_action
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19893
diff changeset
2221 = edit_menu->addAction (resource_manager::icon ("edit-paste"),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2222 tr ("Paste"), this, SLOT (pasteClipboard (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2223 m_paste_action->setShortcutContext (Qt::ApplicationShortcut);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2224
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2225 m_select_all_action
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2226 = edit_menu->addAction (tr ("Select All"), this, SLOT (selectAll (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2227 m_select_all_action->setShortcutContext (Qt::ApplicationShortcut);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2228
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2229 m_clear_clipboard_action
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2230 = edit_menu->addAction (tr ("Clear Clipboard"), this,
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2231 SLOT (clear_clipboard (void)));
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2232
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2233 edit_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2234
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2235 m_find_files_action
19908
4e15e8cb16ae gui: added icons menu items that have icons used elsewhere
John Donoghue
parents: 19907
diff changeset
2236 = edit_menu->addAction (resource_manager::icon ("edit-find"),
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
2237 tr ("Find Files..."));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2238
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2239 edit_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2240
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2241 m_clear_command_window_action
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2242 = edit_menu->addAction (tr ("Clear Command Window"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2243
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2244 m_clear_command_history_action
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2245 = edit_menu->addAction (tr ("Clear Command History"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2246
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2247 m_clear_workspace_action
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2248 = edit_menu->addAction (tr ("Clear Workspace"));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2249
20039
3538c2824dd8 GUI: Move preferences to edit menu (Bug #44725)
John Donoghue
parents: 19985
diff changeset
2250 edit_menu->addSeparator ();
3538c2824dd8 GUI: Move preferences to edit menu (Bug #44725)
John Donoghue
parents: 19985
diff changeset
2251
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2252 m_preferences_action
20039
3538c2824dd8 GUI: Move preferences to edit menu (Bug #44725)
John Donoghue
parents: 19985
diff changeset
2253 = edit_menu->addAction (resource_manager::icon ("preferences-system"),
3538c2824dd8 GUI: Move preferences to edit menu (Bug #44725)
John Donoghue
parents: 19985
diff changeset
2254 tr ("Preferences..."));
3538c2824dd8 GUI: Move preferences to edit menu (Bug #44725)
John Donoghue
parents: 19985
diff changeset
2255
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2256 connect (m_find_files_action, SIGNAL (triggered (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2257 this, SLOT (find_files (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2258
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2259 connect (m_clear_command_window_action, SIGNAL (triggered (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2260 this, SLOT (handle_clear_command_window_request (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2261
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2262 connect (m_clear_command_history_action, SIGNAL (triggered (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2263 this, SLOT (handle_clear_history_request (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2264
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2265 connect (m_clear_workspace_action, SIGNAL (triggered (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2266 this, SLOT (handle_clear_workspace_request (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2267
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2268 connect (m_clipboard, SIGNAL (changed (QClipboard::Mode)),
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2269 this, SLOT (clipboard_has_changed (QClipboard::Mode)));
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2270 clipboard_has_changed (QClipboard::Clipboard);
20039
3538c2824dd8 GUI: Move preferences to edit menu (Bug #44725)
John Donoghue
parents: 19985
diff changeset
2271
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2272 connect (m_preferences_action, SIGNAL (triggered (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2273 this, SLOT (process_settings_dialog_request (void)));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2274 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2275
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2276 QAction *
18697
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18684
diff changeset
2277 main_window::construct_debug_menu_item (const char *icon, const QString& item,
908523bd79b4 use shortcut manager for the debug menu
Torsten <ttl@justmail.de>
parents: 18684
diff changeset
2278 const char *member)
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2279 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2280 QAction *action = add_action (m_debug_menu,
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
2281 resource_manager::icon (QString (icon)),
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19893
diff changeset
2282 item, member);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2283
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2284 action->setEnabled (false);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2285
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21670
diff changeset
2286 #if defined (HAVE_QSCINTILLA)
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2287 m_editor_window->debug_menu ()->addAction (action);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2288 m_editor_window->toolbar ()->addAction (action);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2289 #endif
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2290
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2291 return action;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2292 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2293
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2294 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2295 main_window::construct_debug_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2296 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2297 m_debug_menu = m_add_menu (p, tr ("De&bug"));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2298
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2299 m_debug_step_over = construct_debug_menu_item (
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
2300 "db-step", tr ("Step"),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2301 SLOT (debug_step_over (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2302
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2303 m_debug_step_into = construct_debug_menu_item (
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
2304 "db-step-in", tr ("Step In"),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2305 SLOT (debug_step_into (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2306
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2307 m_debug_step_out = construct_debug_menu_item (
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19893
diff changeset
2308 "db-step-out", tr ("Step Out"),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2309 SLOT (debug_step_out (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2310
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2311 m_debug_continue = construct_debug_menu_item (
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19893
diff changeset
2312 "db-cont", tr ("Continue"),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2313 SLOT (debug_continue (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2314
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2315 m_debug_menu->addSeparator ();
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21670
diff changeset
2316 #if defined (HAVE_QSCINTILLA)
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2317 m_editor_window->debug_menu ()->addSeparator ();
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2318 #endif
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2319
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2320 m_debug_quit = construct_debug_menu_item (
22411
c69805d1fa64 maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents: 22323
diff changeset
2321 "db-stop", tr ("Quit Debug Mode"),
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2322 SLOT (debug_quit (void)));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2323 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2324
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2325 QAction *
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2326 main_window::construct_window_menu_item (QMenu *p, const QString& item,
18707
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2327 bool checkable, QWidget *widget)
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2328 {
18707
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2329 QAction *action = p->addAction (QIcon (), item);
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2330
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2331 addAction (action); // important for shortcut context
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2332 action->setCheckable (checkable);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2333 action->setShortcutContext (Qt::ApplicationShortcut);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2334
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2335 if (widget) // might be zero for m_editor_window
18707
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2336 {
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2337 if (checkable)
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2338 {
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2339 // action for visibilty of dock widget
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2340 connect (action, SIGNAL (toggled (bool)),
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2341 widget, SLOT (setVisible (bool)));
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2342
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2343 connect (widget, SIGNAL (active_changed (bool)),
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19855
diff changeset
2344 action, SLOT (setChecked (bool)));
18707
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2345 }
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2346 else
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2347 {
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2348 // action for focus of dock widget
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2349 connect (action, SIGNAL (triggered (void)), widget, SLOT (focus (void)));
18707
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2350 }
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2351 }
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2352
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2353 return action;
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2354 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2355
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2356 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2357 main_window::construct_window_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2358 {
18944
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18840
diff changeset
2359 QMenu *window_menu = m_add_menu (p, tr ("&Window"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2360
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2361 m_show_command_window_action = construct_window_menu_item
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2362 (window_menu, tr ("Show Command Window"), true, m_command_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2363
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2364 m_show_history_action = construct_window_menu_item
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2365 (window_menu, tr ("Show Command History"), true, m_history_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2366
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2367 m_show_file_browser_action = construct_window_menu_item
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2368 (window_menu, tr ("Show File Browser"), true, m_file_browser_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2369
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2370 m_show_workspace_action = construct_window_menu_item
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2371 (window_menu, tr ("Show Workspace"), true, m_workspace_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2372
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2373 m_show_editor_action = construct_window_menu_item
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2374 (window_menu, tr ("Show Editor"), true, m_editor_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2375
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2376 m_show_documentation_action = construct_window_menu_item
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2377 (window_menu, tr ("Show Documentation"), true, m_doc_browser_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2378
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2379 m_show_variable_editor_action = construct_window_menu_item
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2380 (window_menu, tr ("Show Variable Editor"), true, m_variable_editor_window);
23927
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23920
diff changeset
2381
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2382 window_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2383
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2384 m_command_window_action = construct_window_menu_item
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2385 (window_menu, tr ("Command Window"), false, m_command_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2386
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2387 m_history_action = construct_window_menu_item
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2388 (window_menu, tr ("Command History"), false, m_history_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2389
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2390 m_file_browser_action = construct_window_menu_item
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2391 (window_menu, tr ("File Browser"), false, m_file_browser_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2392
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2393 m_workspace_action = construct_window_menu_item
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2394 (window_menu, tr ("Workspace"), false, m_workspace_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2395
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2396 m_editor_action = construct_window_menu_item
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2397 (window_menu, tr ("Editor"), false, m_editor_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2398
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2399 m_documentation_action = construct_window_menu_item
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2400 (window_menu, tr ("Documentation"), false, m_doc_browser_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2401
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2402 m_variable_editor_action = construct_window_menu_item
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2403 (window_menu, tr ("Variable Editor"), false, m_variable_editor_window);
23927
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23920
diff changeset
2404
18707
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2405 window_menu->addSeparator ();
f31fde98c872 use shortcut manager for the window menu
Torsten <ttl@justmail.de>
parents: 18697
diff changeset
2406
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2407 m_reset_windows_action = add_action (window_menu, QIcon (),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2408 tr ("Reset Default Window Layout"), SLOT (reset_windows (void)));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2409 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2410
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2411 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2412 main_window::construct_help_menu (QMenuBar *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2413 {
18944
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18840
diff changeset
2414 QMenu *help_menu = m_add_menu (p, tr ("&Help"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2415
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2416 construct_documentation_menu (help_menu);
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2417
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2418 help_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2419
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2420 m_report_bug_action = add_action (help_menu, QIcon (),
18710
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18708
diff changeset
2421 tr ("Report Bug"), SLOT (open_bug_tracker_page ()));
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18708
diff changeset
2422
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2423 m_octave_packages_action = add_action (help_menu, QIcon (),
18710
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18708
diff changeset
2424 tr ("Octave Packages"), SLOT (open_octave_packages_page ()));
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18708
diff changeset
2425
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2426 m_contribute_action = add_action (help_menu, QIcon (),
22211
6065bd58db2b use contribute/donate consistently in GUI (bug #44335)
Sahil Badyal <sbadyals@gmail.com>
parents: 22177
diff changeset
2427 tr ("Contribute"), SLOT (open_contribute_page ()));
18710
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18708
diff changeset
2428
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2429 m_developer_action = add_action (help_menu, QIcon (),
22211
6065bd58db2b use contribute/donate consistently in GUI (bug #44335)
Sahil Badyal <sbadyals@gmail.com>
parents: 22177
diff changeset
2430 tr ("Donate to Octave"), SLOT (open_donate_page ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2431
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2432 help_menu->addSeparator ();
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2433
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2434 m_about_octave_action = add_action (help_menu, QIcon (),
18710
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18708
diff changeset
2435 tr ("About Octave"), SLOT (show_about_octave ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2436 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2437
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2438 void
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2439 main_window::construct_documentation_menu (QMenu *p)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2440 {
18710
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18708
diff changeset
2441 QMenu *doc_menu = p->addMenu (tr ("Documentation"));
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18708
diff changeset
2442
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2443 m_ondisk_doc_action = add_action (doc_menu, QIcon (),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2444 tr ("On Disk"), SLOT (focus ()), m_doc_browser_window);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2445
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2446 m_online_doc_action = add_action (doc_menu, QIcon (),
18710
584b20e9112c use shortcut manager for the main help menu
Torsten <ttl@justmail.de>
parents: 18708
diff changeset
2447 tr ("Online"), SLOT (open_online_documentation_page ()));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2448 }
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2449
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2450 void
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
2451 main_window::construct_news_menu (QMenuBar *p)
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
2452 {
18944
b2c4d6d461f0 fix conflict between main and editor menus when using alt keys (bug #42659)
Torsten <ttl@justmail.de>
parents: 18840
diff changeset
2453 QMenu *news_menu = m_add_menu (p, tr ("&News"));
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
2454
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2455 m_release_notes_action = add_action (news_menu, QIcon (),
18711
9ef65c422f53 use shortcut manager for the main news menu
Torsten <ttl@justmail.de>
parents: 18710
diff changeset
2456 tr ("Release Notes"), SLOT (display_release_notes ()));
9ef65c422f53 use shortcut manager for the main news menu
Torsten <ttl@justmail.de>
parents: 18710
diff changeset
2457
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2458 m_current_news_action = add_action (news_menu, QIcon (),
18711
9ef65c422f53 use shortcut manager for the main news menu
Torsten <ttl@justmail.de>
parents: 18710
diff changeset
2459 tr ("Community News"), SLOT (load_and_display_community_news ()));
17599
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
2460 }
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
2461
f5950975a172 community news dock widget and other user info in GUI
John W. Eaton <jwe@octave.org>
parents: 17576
diff changeset
2462 void
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2463 main_window::construct_tool_bar (void)
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2464 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2465 m_main_tool_bar = addToolBar (tr ("Toolbar"));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2466
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2467 m_main_tool_bar->setObjectName ("MainToolBar");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2468 m_main_tool_bar->addAction (m_new_script_action);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2469 m_main_tool_bar->addAction (m_open_action);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2470
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2471 m_main_tool_bar->addSeparator ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2472
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2473 m_main_tool_bar->addAction (m_copy_action);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2474 m_main_tool_bar->addAction (m_paste_action);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2475 m_main_tool_bar->addAction (m_undo_action);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2476
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2477 m_main_tool_bar->addSeparator ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2478
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2479 m_current_directory_combo_box = new QComboBox (this);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2480 QFontMetrics fm = m_current_directory_combo_box->fontMetrics ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2481 m_current_directory_combo_box->setFixedWidth (48*fm.averageCharWidth ());
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2482 m_current_directory_combo_box->setEditable (true);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2483 m_current_directory_combo_box->setInsertPolicy (QComboBox::NoInsert);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2484 m_current_directory_combo_box->setToolTip (tr ("Enter directory name"));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2485 m_current_directory_combo_box->setMaxVisibleItems (
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2486 current_directory_max_visible);
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2487 m_current_directory_combo_box->setMaxCount (current_directory_max_count);
19846
72fe9df87fe8 improve scalability of gui objects (as discussed in bug #41938)
Torsten <ttl@justmail.de>
parents: 19803
diff changeset
2488 QSizePolicy sizePol (QSizePolicy::Preferred, QSizePolicy::Preferred);
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2489 m_current_directory_combo_box->setSizePolicy (sizePol);
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2490
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2491 // addWidget takes ownership of the objects so there is no
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2492 // need to delete these upon destroying this main_window.
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2493 m_main_tool_bar->addWidget (new QLabel (tr ("Current Directory: ")));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2494 m_main_tool_bar->addWidget (m_current_directory_combo_box);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2495 QAction *current_dir_up = m_main_tool_bar->addAction (
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19893
diff changeset
2496 resource_manager::icon ("go-up"),
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2497 tr ("One directory up"));
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2498 QAction *current_dir_search = m_main_tool_bar->addAction (
19899
a8a5415b05cb new gui icons
Torsten <ttl@justmail.de>
parents: 19893
diff changeset
2499 resource_manager::icon ("folder"),
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 17771
diff changeset
2500 tr ("Browse directories"));
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2501
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2502 connect (m_current_directory_combo_box, SIGNAL (activated (QString)),
16454
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2503 this, SLOT (set_current_working_directory (QString)));
246d25c8761b split main_window::construct for clarity
John W. Eaton <jwe@octave.org>
parents: 16453
diff changeset
2504
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2505 connect (m_current_directory_combo_box->lineEdit (), SIGNAL (returnPressed (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2506 this, SLOT (accept_directory_line_edit (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2507
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2508 connect (current_dir_search, SIGNAL (triggered (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2509 this, SLOT (browse_for_directory (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2510
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2511 connect (current_dir_up, SIGNAL (triggered (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2512 this, SLOT (change_directory_up (void)));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2513
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2514 connect (m_undo_action, SIGNAL (triggered (void)),
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2515 this, SLOT (handle_undo_request (void)));
23927
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23920
diff changeset
2516 }
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23920
diff changeset
2517
e3a36f84d01d provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents: 23920
diff changeset
2518 void
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2519 main_window::save_workspace_callback (const std::string& file)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2520 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
2521 Fsave (ovl (file));
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2522 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2523
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2524 void
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2525 main_window::load_workspace_callback (const std::string& file)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2526 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
2527 Fload (ovl (file));
16504
49b059bf27c7 allow loading files from file browser
John W. Eaton <jwe@octave.org>
parents: 16502
diff changeset
2528
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24347
diff changeset
2529 octave::symbol_scope scope
23611
91c8f006ed8b remove additional functions from symbol_table class
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
2530 = octave::__get_current_scope__ ("main_window::load_workspace_callback");
91c8f006ed8b remove additional functions from symbol_table class
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
2531
91c8f006ed8b remove additional functions from symbol_table class
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
2532 if (scope)
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24347
diff changeset
2533 octave_link::set_workspace (true, scope.workspace_info ());
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2534 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2535
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2536 void
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2537 main_window::rename_variable_callback (const main_window::name_pair& names)
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2538 {
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24347
diff changeset
2539 octave::symbol_scope scope
23611
91c8f006ed8b remove additional functions from symbol_table class
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
2540 = octave::__get_current_scope__ ("main_window::rename_variable_callback");
91c8f006ed8b remove additional functions from symbol_table class
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
2541
91c8f006ed8b remove additional functions from symbol_table class
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
2542 if (scope)
91c8f006ed8b remove additional functions from symbol_table class
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
2543 {
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24347
diff changeset
2544 scope.rename (names.first, names.second);
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24347
diff changeset
2545
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24347
diff changeset
2546 octave_link::set_workspace (true, scope.workspace_info ());
23611
91c8f006ed8b remove additional functions from symbol_table class
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
2547 }
91c8f006ed8b remove additional functions from symbol_table class
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
2548
91c8f006ed8b remove additional functions from symbol_table class
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
2549 // FIXME: if this action fails, do we need a way to display that info
91c8f006ed8b remove additional functions from symbol_table class
John W. Eaton <jwe@octave.org>
parents: 23599
diff changeset
2550 // in the GUI?
16502
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2551 }
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2552
45ae1038ee89 allow renaming of variables in workspace viewer
John W. Eaton <jwe@octave.org>
parents: 16499
diff changeset
2553 void
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2554 main_window::command_window_undo_callback (void)
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2555 {
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21744
diff changeset
2556 octave::command_editor::undo ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21744
diff changeset
2557 octave::command_editor::redisplay ();
16539
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2558 }
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2559
8ea8df0747e9 make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents: 16532
diff changeset
2560 void
16514
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
2561 main_window::clear_command_window_callback (void)
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
2562 {
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21744
diff changeset
2563 octave::command_editor::kill_full_line ();
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21744
diff changeset
2564 octave::command_editor::clear_screen ();
16514
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
2565 }
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
2566
db045633405c Added clear command window implementation to MainWindow Clear COmmand Window menu.
John Donoghue <john.donoghue@ieee.org>
parents: 16512
diff changeset
2567 void
16541
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
2568 main_window::resize_command_window_callback (void)
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
2569 {
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21744
diff changeset
2570 octave::command_editor::resize_terminal ();
16541
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
2571 }
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
2572
6afb29359968 set size of command window terminal at GUI startup
John W. Eaton <jwe@octave.org>
parents: 16539
diff changeset
2573 void
19302
37159a873c96 preserve text on Windows terminal resize (bug #41893; patch #8532)
John W. Eaton <jwe@octave.org>
parents: 19180
diff changeset
2574 main_window::set_screen_size_callback (const int_pair& sz)
37159a873c96 preserve text on Windows terminal resize (bug #41893; patch #8532)
John W. Eaton <jwe@octave.org>
parents: 19180
diff changeset
2575 {
21748
176536b15d68 use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents: 21744
diff changeset
2576 octave::command_editor::set_screen_size (sz.first, sz.second);
19302
37159a873c96 preserve text on Windows terminal resize (bug #41893; patch #8532)
John W. Eaton <jwe@octave.org>
parents: 19180
diff changeset
2577 }
37159a873c96 preserve text on Windows terminal resize (bug #41893; patch #8532)
John W. Eaton <jwe@octave.org>
parents: 19180
diff changeset
2578
37159a873c96 preserve text on Windows terminal resize (bug #41893; patch #8532)
John W. Eaton <jwe@octave.org>
parents: 19180
diff changeset
2579 void
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2580 main_window::clear_workspace_callback (void)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2581 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2582 octave::interpreter& interp
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2583 = octave::__get_interpreter__ ("main_window::clear_workspace_callback");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2584
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2585 Fclear (interp);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2586 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2587
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2588 void
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2589 main_window::clear_history_callback (void)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2590 {
16431
5982d469f79b use signal for setting, appending to, and clearing history widget
John W. Eaton <jwe@octave.org>
parents: 16426
diff changeset
2591 Fhistory (ovl ("-c"));
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2592 }
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2593
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2594 void
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2595 main_window::run_file_callback (const QFileInfo& info)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2596 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2597 octave_cmd_eval *cmd = new octave_cmd_eval (info);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2598 m_cmd_queue.add_cmd (cmd);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2599 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2600
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2601 bool
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2602 main_window::focus_console_after_command (void)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2603 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2604 QSettings *settings = resource_manager::get_settings ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2605 return settings->value ("terminal/focus_after_command",false).toBool ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2606 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2607
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2608 void
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2609 main_window::new_figure_callback (void)
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2610 {
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23497
diff changeset
2611 octave::interpreter& interp
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23497
diff changeset
2612 = octave::__get_interpreter__ ("main_window::new_figure_callback");
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23497
diff changeset
2613
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23497
diff changeset
2614 Fbuiltin (interp, ovl ("figure"));
16566
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2615 Fdrawnow ();
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2616 }
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2617
662a712b8fd5 partial menu bar cleanup
John W. Eaton <jwe@octave.org>
parents: 16565
diff changeset
2618 void
15402
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2619 main_window::change_directory_callback (const std::string& directory)
7f423c6111c6 refactor GUI event handling to use new event_queue class
John W. Eaton <jwe@octave.org>
parents: 15388
diff changeset
2620 {
15420
1249a615c91b call built-in functions directly in GUI callbacks
John W. Eaton <jwe@octave.org>
parents: 15404
diff changeset
2621 Fcd (ovl (directory));
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2622 m_octave_qt_link->update_directory ();
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2623 }
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents: 16518
diff changeset
2624
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2625 void
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2626 main_window::configure_shortcuts (void)
18717
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18711
diff changeset
2627 {
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18711
diff changeset
2628 // file menu
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2629 shortcut_manager::set_shortcut (m_open_action, "main_file:open_file");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2630 shortcut_manager::set_shortcut (m_new_script_action, "main_file:new_file");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2631 shortcut_manager::set_shortcut (m_new_function_action, "main_file:new_function");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2632 shortcut_manager::set_shortcut (m_new_function_action, "main_file:new_figure");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2633 shortcut_manager::set_shortcut (m_load_workspace_action,
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19855
diff changeset
2634 "main_file:load_workspace");
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2635 shortcut_manager::set_shortcut (m_save_workspace_action,
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19855
diff changeset
2636 "main_file:save_workspace");
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2637 shortcut_manager::set_shortcut (m_preferences_action, "main_file:preferences");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2638 shortcut_manager::set_shortcut (m_exit_action,"main_file:exit");
18717
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18711
diff changeset
2639
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18711
diff changeset
2640 // edit menu
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2641 shortcut_manager::set_shortcut (m_copy_action, "main_edit:copy");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2642 shortcut_manager::set_shortcut (m_paste_action, "main_edit:paste");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2643 shortcut_manager::set_shortcut (m_undo_action, "main_edit:undo");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2644 shortcut_manager::set_shortcut (m_select_all_action, "main_edit:select_all");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2645 shortcut_manager::set_shortcut (m_clear_clipboard_action,
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19855
diff changeset
2646 "main_edit:clear_clipboard");
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2647 shortcut_manager::set_shortcut (m_find_files_action, "main_edit:find_in_files");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2648 shortcut_manager::set_shortcut (m_clear_command_history_action,
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19855
diff changeset
2649 "main_edit:clear_history");
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2650 shortcut_manager::set_shortcut (m_clear_command_window_action,
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19855
diff changeset
2651 "main_edit:clear_command_window");
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2652 shortcut_manager::set_shortcut (m_clear_workspace_action,
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19855
diff changeset
2653 "main_edit:clear_workspace");
18717
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18711
diff changeset
2654
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18711
diff changeset
2655 // debug menu
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2656 shortcut_manager::set_shortcut (m_debug_step_over, "main_debug:step_over");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2657 shortcut_manager::set_shortcut (m_debug_step_into, "main_debug:step_into");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2658 shortcut_manager::set_shortcut (m_debug_step_out, "main_debug:step_out");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2659 shortcut_manager::set_shortcut (m_debug_continue, "main_debug:continue");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2660 shortcut_manager::set_shortcut (m_debug_quit, "main_debug:quit");
18717
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18711
diff changeset
2661
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18711
diff changeset
2662 // window menu
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2663 shortcut_manager::set_shortcut (m_show_command_window_action,
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19855
diff changeset
2664 "main_window:show_command");
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2665 shortcut_manager::set_shortcut (m_show_history_action,
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19855
diff changeset
2666 "main_window:show_history");
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2667 shortcut_manager::set_shortcut (m_show_workspace_action,
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19855
diff changeset
2668 "main_window:show_workspace");
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2669 shortcut_manager::set_shortcut (m_show_file_browser_action,
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19855
diff changeset
2670 "main_window:show_file_browser");
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2671 shortcut_manager::set_shortcut (m_show_editor_action, "main_window:show_editor");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2672 shortcut_manager::set_shortcut (m_show_documentation_action,
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19855
diff changeset
2673 "main_window:show_doc");
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2674 shortcut_manager::set_shortcut (m_show_variable_editor_action,
23941
804d60784340 fix shortcuts for showing and giving focus to the variable editor
Torsten <mttl@mailbox.org>
parents: 23927
diff changeset
2675 "main_window:show_variable_editor");
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2676 shortcut_manager::set_shortcut (m_command_window_action, "main_window:command");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2677 shortcut_manager::set_shortcut (m_history_action, "main_window:history");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2678 shortcut_manager::set_shortcut (m_workspace_action, "main_window:workspace");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2679 shortcut_manager::set_shortcut (m_file_browser_action,
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19855
diff changeset
2680 "main_window:file_browser");
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2681 shortcut_manager::set_shortcut (m_editor_action, "main_window:editor");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2682 shortcut_manager::set_shortcut (m_documentation_action, "main_window:doc");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2683 shortcut_manager::set_shortcut (m_variable_editor_action, "main_window:variable_editor");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2684 shortcut_manager::set_shortcut (m_reset_windows_action, "main_window:reset");
18717
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18711
diff changeset
2685
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18711
diff changeset
2686 // help menu
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2687 shortcut_manager::set_shortcut (m_ondisk_doc_action, "main_help:ondisk_doc");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2688 shortcut_manager::set_shortcut (m_online_doc_action, "main_help:online_doc");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2689 shortcut_manager::set_shortcut (m_report_bug_action, "main_help:report_bug");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2690 shortcut_manager::set_shortcut (m_octave_packages_action, "main_help:packages");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2691 shortcut_manager::set_shortcut (m_contribute_action, "main_help:contribute");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2692 shortcut_manager::set_shortcut (m_developer_action, "main_help:developer");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2693 shortcut_manager::set_shortcut (m_about_octave_action, "main_help:about");
18717
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18711
diff changeset
2694
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18711
diff changeset
2695 // news menu
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2696 shortcut_manager::set_shortcut (m_release_notes_action,
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19855
diff changeset
2697 "main_news:release_notes");
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2698 shortcut_manager::set_shortcut (m_current_news_action,
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19855
diff changeset
2699 "main_news:community_news");
18717
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18711
diff changeset
2700 }
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18711
diff changeset
2701
f017240310fb disabling global shortcuts when terminal has focus as user preference
Torsten <ttl@justmail.de>
parents: 18711
diff changeset
2702 void
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2703 main_window::force_refresh_workspace (void)
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2704 {
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24347
diff changeset
2705 octave::symbol_scope scope
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2706 = octave::__get_current_scope__ ("main_window::load_workspace_callback");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2707
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2708 if (scope)
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24347
diff changeset
2709 octave_link::set_workspace (true, scope.workspace_info (), false);
16970
78116b88dbf5 enable readline key bindings in terminal widget of gui (bug #36986)
Torsten <ttl@justmail.de>
parents: 16956
diff changeset
2710 }
17029
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
2711
20278
3b25741a9927 Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 20253
diff changeset
2712 QList<octave_dock_widget *>
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2713 main_window::dock_widget_list (void)
20278
3b25741a9927 Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 20253
diff changeset
2714 {
3b25741a9927 Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 20253
diff changeset
2715 QList<octave_dock_widget *> list = QList<octave_dock_widget *> ();
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2716 list.append (static_cast<octave_dock_widget *> (m_command_window));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2717 list.append (static_cast<octave_dock_widget *> (m_history_window));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2718 list.append (static_cast<octave_dock_widget *> (m_file_browser_window));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2719 list.append (static_cast<octave_dock_widget *> (m_doc_browser_window));
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21670
diff changeset
2720 #if defined (HAVE_QSCINTILLA)
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2721 list.append (static_cast<octave_dock_widget *> (m_editor_window));
20278
3b25741a9927 Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 20253
diff changeset
2722 #endif
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2723 list.append (static_cast<octave_dock_widget *> (m_workspace_window));
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2724 list.append (static_cast<octave_dock_widget *> (m_variable_editor_window));
20278
3b25741a9927 Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 20253
diff changeset
2725 return list;
3b25741a9927 Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 20253
diff changeset
2726 }
3b25741a9927 Avoid HAVE_ macro in header file.
John W. Eaton <jwe@octave.org>
parents: 20253
diff changeset
2727
17029
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
2728 void
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2729 news_reader::process (void)
17029
359c5ca795cd Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents: 17010
diff changeset
2730 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2731 QString html_text;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2732
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2733 if (m_connect_to_web)
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2734 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2735 // Run this part in a separate thread so Octave can continue to
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2736 // run while we wait for the page to load. Then emit the signal
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2737 // to display it when we have the page contents.
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2738
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2739 QString url = m_base_url + '/' + m_page;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2740 std::ostringstream buf;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2741 octave::url_transfer octave_dot_org (url.toStdString (), buf);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2742
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2743 if (octave_dot_org.is_valid ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2744 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2745 Array<std::string> param;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2746 octave_dot_org.http_get (param);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2747
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2748 if (octave_dot_org.good ())
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2749 html_text = QString::fromStdString (buf.str ());
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2750 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2751
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2752 if (html_text.contains ("this-is-the-gnu-octave-community-news-page"))
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2753 {
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2754 if (m_serial >= 0)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2755 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2756 QSettings *settings = resource_manager::get_settings ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2757
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2758 if (settings)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2759 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2760 settings->setValue ("news/last_time_checked",
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2761 QDateTime::currentDateTime ());
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2762
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2763 settings->sync ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2764 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2765
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2766 QString tag ("community-news-page-serial=");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2767
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2768 int b = html_text.indexOf (tag);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2769
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2770 if (b)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2771 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2772 b += tag.length ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2773
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2774 int e = html_text.indexOf ("\n", b);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2775
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2776 QString tmp = html_text.mid (b, e-b);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2777
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2778 int curr_page_serial = tmp.toInt ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2779
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2780 if (curr_page_serial > m_serial)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2781 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2782 if (settings)
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2783 {
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2784 settings->setValue ("news/last_news_item",
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2785 curr_page_serial);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2786
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2787 settings->sync ();
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2788 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2789 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2790 else
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2791 return;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2792 }
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2793 else
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2794 return;
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2795 }
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2796 }
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2797 else
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2798 html_text = QString
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2799 (tr ("<html>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2800 "<body>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2801 "<p>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2802 "Octave's community news source seems to be unavailable.\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2803 "</p>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2804 "<p>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2805 "For the latest news, please check\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2806 "<a href=\"http://octave.org/community-news.html\">http://octave.org/community-news.html</a>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2807 "when you have a connection to the web (link opens in an external browser).\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2808 "</p>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2809 "<p>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2810 "<small><em>&mdash; The Octave Developers, ") + OCTAVE_RELEASE_DATE + "</em></small>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2811 "</p>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2812 "</body>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2813 "</html>\n");
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2814 }
24019
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2815 else
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2816 html_text = QString
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2817 (tr ("<html>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2818 "<body>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2819 "<p>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2820 "Connecting to the web to display the latest Octave Community news has been disabled.\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2821 "</p>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2822 "<p>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2823 "For the latest news, please check\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2824 "<a href=\"http://octave.org/community-news.html\">http://octave.org/community-news.html</a>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2825 "when you have a connection to the web (link opens in an external browser)\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2826 "or enable web connections for news in Octave's network settings dialog.\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2827 "</p>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2828 "<p>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2829 "<small><em>&mdash; The Octave Developers, ") + OCTAVE_RELEASE_DATE + "</em></small>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2830 "</p>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2831 "</body>\n"
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2832 "</html>\n");
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2833
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2834 emit display_news_signal (html_text);
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2835
fc4ba8b1ff87 style fixes for GUI main window
John W. Eaton <jwe@octave.org>
parents: 24016
diff changeset
2836 emit finished ();
17117
47b504503a3f disable global paste action when clipboard is empty
Torsten <ttl@justmail.de>
parents: 17090
diff changeset
2837 }