Mercurial > octave
annotate libgui/graphics/annotation-dialog.cc @ 33359:689d4d069bbf
maint: Use Octave coding convention of space between function name and parentheses in libgui/.
* libgui/graphics/BaseControl.cc, libgui/graphics/Canvas.cc,
libgui/graphics/Figure.cc, libgui/graphics/FigureWindow.cc,
libgui/graphics/FigureWindow.h, libgui/graphics/QtHandlesUtils.cc,
libgui/graphics/Table.h, libgui/graphics/annotation-dialog.cc,
libgui/graphics/gl-select.cc, libgui/src/command-widget.cc,
libgui/src/dialog.cc, libgui/src/documentation-bookmarks.cc,
libgui/src/documentation.cc, libgui/src/dw-main-window.cc,
libgui/src/files-dock-widget.cc, libgui/src/gui-settings.cc,
libgui/src/gui-settings.h, libgui/src/gui-utils.cc,
libgui/src/led-indicator.cc, libgui/src/m-editor/file-editor-tab.cc,
libgui/src/m-editor/find-dialog.cc, libgui/src/m-editor/octave-qscintilla.cc,
libgui/src/main-window.cc, libgui/src/main-window.h,
libgui/src/octave-dock-widget.cc, libgui/src/set-path-dialog.cc,
libgui/src/set-path-model.cc, libgui/src/settings-dialog.cc,
libgui/src/tab-bar.cc, libgui/src/tab-bar.h,
libgui/src/terminal-dock-widget.cc, libgui/src/variable-editor-model.cc,
libgui/src/variable-editor-model.h, libgui/src/variable-editor.cc,
libgui/src/workspace-model.h, libgui/src/workspace-view.cc:
Use Octave coding convention of space between function name and parentheses.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 08 Apr 2024 14:39:40 -0700 |
parents | 4b601ca024d5 |
children |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31838
diff
changeset
|
3 // Copyright (C) 2016-2024 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21568
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21203
diff
changeset
|
27 # include "config.h" |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
28 #endif |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
29 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
30 #include <QColorDialog> |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
31 #include <QPushButton> |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
32 #include <QPalette> |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
33 |
27611
0495b64288f7
use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
27417
diff
changeset
|
34 #include "gui-settings.h" |
27866
b134fc61d89e
use symbolic constants for prefs of graphics utlilities
Torsten Lilge <ttl-octave@mailbox.org>
parents:
27645
diff
changeset
|
35 #include "gui-preferences-gp.h" |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
36 #include "gui-settings.h" |
27611
0495b64288f7
use new gui_settings class instead of using QSettings directly
John W. Eaton <jwe@octave.org>
parents:
27417
diff
changeset
|
37 |
27417
f844b1f03dcc
update some header file lists in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
38 #include "QtHandlesUtils.h" |
f844b1f03dcc
update some header file lists in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
39 #include "annotation-dialog.h" |
f844b1f03dcc
update some header file lists in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
40 #include "ui-annotation-dialog.h" |
f844b1f03dcc
update some header file lists in libgui sources
John W. Eaton <jwe@octave.org>
parents:
27276
diff
changeset
|
41 |
31639
ca7d58406f82
eliminate unnecessary uses of octave_qobject in GUI classes
John W. Eaton <jwe@octave.org>
parents:
31619
diff
changeset
|
42 annotation_dialog::annotation_dialog (QWidget *p, const octave_value_list& pr): |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
43 QDialog (p), m_ui (new Ui::annotation_dialog) |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
44 { |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
45 m_props = pr; |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
46 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
47 init (); |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
48 } |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
49 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
50 void |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
51 annotation_dialog::init () |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
52 { |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
53 m_ui->setupUi (this); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
54 |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
55 octave::gui_settings settings; |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
56 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
57 // restore last geometry |
31702
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31639
diff
changeset
|
58 if (settings.contains (gp_annotation_geometry.settings_key ())) |
31709
3a23b89bd21d
define some convenience functions to reduce clutter
John W. Eaton <jwe@octave.org>
parents:
31707
diff
changeset
|
59 restoreGeometry (settings.byte_array_value (gp_annotation_geometry)); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
60 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
61 // connect signals |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
62 connect (m_ui->button_box, &QDialogButtonBox::clicked, |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
63 this, &annotation_dialog::button_clicked); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
64 |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
65 connect (m_ui->edit_string, &QLineEdit::textChanged, |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
66 this, &annotation_dialog::edit_string_changed); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
67 |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
68 connect (m_ui->btn_color, &QPushButton::clicked, |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
69 this, &annotation_dialog::prompt_for_color); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
70 |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
71 connect (m_ui->btn_background_color, &QPushButton::clicked, |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
72 this, &annotation_dialog::prompt_for_color); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
73 |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
74 connect (m_ui->btn_edge_color, &QPushButton::clicked, |
29542
3d34b70b5a49
connect many Qt signals and slots without SIGNAL and SLOT macros
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
75 this, &annotation_dialog::prompt_for_color); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
76 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
77 // set gui element to default values |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
78 m_ui->cb_fit_box_to_text->setChecked (true); |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
79 m_ui->cb_horz_align->setCurrentIndex (m_ui->cb_horz_align->findText ("left")); |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
80 m_ui->cb_vert_align->setCurrentIndex (m_ui->cb_vert_align->findText ("middle")); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
81 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
82 // set gui elements to any values from input properties |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
83 set_gui_props (); |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
84 } |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
85 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
86 annotation_dialog::~annotation_dialog () |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
87 { |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
88 delete m_ui; |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
89 } |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
90 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
91 // internal slots |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
92 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
93 void |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
94 annotation_dialog::button_clicked (QAbstractButton *button) |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
95 { |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
96 QDialogButtonBox::ButtonRole button_role |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
97 = m_ui->button_box->buttonRole (button); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
98 |
31619
ad014fc78bd6
use individual local gui_settings objects
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
99 octave::gui_settings settings; |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
100 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
101 // save position |
31702
aae24eaf89ad
update gui_pref class to match recent changes to sc_pref class
John W. Eaton <jwe@octave.org>
parents:
31639
diff
changeset
|
102 settings.setValue (gp_annotation_geometry.settings_key (), saveGeometry ()); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
103 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
104 if (button_role == QDialogButtonBox::ApplyRole |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
105 || button_role == QDialogButtonBox::AcceptRole) |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
106 { |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
107 get_gui_props (); |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
108 } |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
109 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
110 if (button_role == QDialogButtonBox::RejectRole |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
111 || button_role == QDialogButtonBox::AcceptRole) |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
112 close (); |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
113 } |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
114 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
115 octave_value_list |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
116 annotation_dialog::get_properties () const |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
117 { |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
118 return m_props; |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
119 } |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
120 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
121 void |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
122 annotation_dialog::get_gui_props () |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
123 { |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
124 // set props to the values of the gui |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
125 m_props = octave_value_list (); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
126 |
33359
689d4d069bbf
maint: Use Octave coding convention of space between function name and parentheses in libgui/.
Rik <rik@octave.org>
parents:
32633
diff
changeset
|
127 Matrix position (1, 4); |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
128 position(0) = m_ui->sb_x->value (); |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
129 position(1) = m_ui->sb_y->value (); |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
130 position(2) = m_ui->sb_width->value (); |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
131 position(3) = m_ui->sb_height->value (); |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
132 m_props.append (ovl ("textbox", position)); |
20181
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20109
diff
changeset
|
133 |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
134 m_props.append (ovl ("string", m_ui->edit_string->text ().toStdString ())); |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
135 m_props.append (ovl ("fitboxtotext", |
32592
094a296b3ba1
maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents:
31838
diff
changeset
|
136 m_ui->cb_fit_box_to_text->isChecked () ? "on" : "off")); |
22399
f0836b5ec628
Allow translation of all the annotation dialog strings (bug #48940)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22323
diff
changeset
|
137 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
138 // FIXME: only "normalized" units is selectable, change the code below |
22399
f0836b5ec628
Allow translation of all the annotation dialog strings (bug #48940)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22323
diff
changeset
|
139 // once more units are added in the UI. |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
140 std::string tmpstr; |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
141 m_props.append (ovl ("units", "normalized")); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
142 |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
143 tmpstr = (m_ui->cb_horz_align->currentIndex () == 0 ? "left" : |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
144 (m_ui->cb_horz_align->currentIndex () == 1 ? "center" : "right")); |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
145 m_props.append (ovl ("horizontalalignment", tmpstr)); |
22399
f0836b5ec628
Allow translation of all the annotation dialog strings (bug #48940)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22323
diff
changeset
|
146 |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
147 tmpstr = (m_ui->cb_vert_align->currentIndex () == 0 ? "top" : |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
148 (m_ui->cb_horz_align->currentIndex () == 1 ? "middle" : "bottom")); |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
149 m_props.append (ovl ("verticalalignment", tmpstr)); |
22399
f0836b5ec628
Allow translation of all the annotation dialog strings (bug #48940)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22323
diff
changeset
|
150 |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
151 tmpstr = m_ui->cb_font_name->currentText ().toStdString (); |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
152 m_props.append (ovl ("fontname", tmpstr)); |
22399
f0836b5ec628
Allow translation of all the annotation dialog strings (bug #48940)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22323
diff
changeset
|
153 |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
154 m_props.append (ovl ("fontsize", m_ui->sb_font_size->value ())); |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
155 m_props.append (ovl ("fontweight", |
32592
094a296b3ba1
maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents:
31838
diff
changeset
|
156 m_ui->cb_font_bold->isChecked () ? "bold" : "normal")); |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
157 m_props.append (ovl ("fontangle", |
32592
094a296b3ba1
maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents:
31838
diff
changeset
|
158 m_ui->cb_font_italic->isChecked () ? "italic" : "normal")); |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
159 m_props.append (ovl ("color", octave::Utils::toRgb (m_ui->btn_color->palette (). |
32592
094a296b3ba1
maint: C++ style check for libgui/ directory.
Rik <rik@octave.org>
parents:
31838
diff
changeset
|
160 color (QPalette::Button)))); |
22399
f0836b5ec628
Allow translation of all the annotation dialog strings (bug #48940)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22323
diff
changeset
|
161 |
f0836b5ec628
Allow translation of all the annotation dialog strings (bug #48940)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22323
diff
changeset
|
162 // FIXME: only "none" linestyle is selectable, change the code bellow |
f0836b5ec628
Allow translation of all the annotation dialog strings (bug #48940)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
22323
diff
changeset
|
163 // once more linestyles are added in the UI. |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
164 m_props.append (ovl ("linestyle", "none")); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
165 } |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
166 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
167 void |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
168 annotation_dialog::set_gui_props () |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
169 { |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
170 // set the gui to the values from the props |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
171 octave_idx_type len = m_props.length (); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
172 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
173 for (int i=0; i<len/2; i++) |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
174 { |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
175 std::string name = m_props(i*2).string_value (); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
176 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
177 if (name == "textbox") |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
178 { |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
179 Matrix position = m_props(2*i +1).matrix_value (); |
23070
bef714f45999
maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
180 int nels = position.numel (); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
181 if (nels >= 2) |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
182 { |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
183 m_ui->sb_x->setValue (position(0)); |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
184 m_ui->sb_y->setValue (position(1)); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
185 } |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
186 else |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
187 { |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
188 m_ui->sb_x->setValue (0); |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
189 m_ui->sb_y->setValue (0); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
190 } |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
191 if (nels >= 4) |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
192 { |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
193 m_ui->sb_width->setValue (position(2)); |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
194 m_ui->sb_height->setValue (position(3)); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
195 } |
26390
aabee709c13a
annotation-dialog.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
196 // FIXME: Should there be an else branch here? |
aabee709c13a
annotation-dialog.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
197 // In annotation.m "textbox" is forced to have a 4-elem vector. |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
198 } |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
199 else if (name == "string") |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
200 { |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
201 // FIXME: handle if is array of strings ? |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
202 m_ui->edit_string->setText (m_props(2*i +1).string_value ().c_str ()); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
203 } |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
204 else if (name == "fitboxtotext") |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
205 { |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
206 m_ui->cb_fit_box_to_text->setChecked (m_props(1*i +1).string_value () == "on"); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
207 } |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
208 else if (name == "units") |
20181
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20109
diff
changeset
|
209 { |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
210 m_ui->cb_units->setCurrentIndex |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
211 (m_ui->cb_units->findText (m_props(1*i +1).string_value ().c_str ())); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
212 } |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
213 else if (name == "horizontalalignment") |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
214 { |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
215 m_ui->cb_horz_align->setCurrentIndex |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
216 (m_ui->cb_horz_align->findText (m_props(1*i +1).string_value ().c_str ())); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
217 } |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
218 else if (name == "verticalalignment") |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
219 { |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
220 m_ui->cb_vert_align->setCurrentIndex |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
221 (m_ui->cb_vert_align->findText (m_props(1*i +1).string_value ().c_str ())); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
222 } |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
223 else if (name == "fontname") |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
224 { |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
225 m_ui->cb_vert_align->setCurrentIndex |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
226 (m_ui->cb_font_name->findText (m_props(1*i +1).string_value ().c_str ())); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
227 } |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
228 else if (name == "fontsize") |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
229 { |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
230 m_ui->sb_font_size->setValue (m_props(1*i +1).float_value ()); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
231 } |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
232 else if (name == "fontweight") |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
233 { |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
234 m_ui->cb_font_bold->setChecked (m_props(1*i +1).string_value () == "bold"); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
235 } |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
236 else if (name == "fontangle") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
237 { |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
238 m_ui->cb_font_italic->setChecked (m_props(1*i +1).string_value () == "italic"); |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
239 } |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
240 else if (name == "color") |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
241 { |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
242 QColor color; |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
243 if (m_props(1*i +1).is_matrix_type ()) |
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
244 color = octave::Utils::fromRgb (m_props(2*i +1).matrix_value ()); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
245 else |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
246 color.setNamedColor (m_props(2*i +1).string_value ().c_str ()); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
247 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
248 if (color.isValid ()) |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
249 m_ui->btn_color->setPalette (QPalette (color)); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
250 } |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
251 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
252 } |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
253 |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
254 edit_string_changed (m_ui->edit_string->text ()); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
255 } |
20181
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20109
diff
changeset
|
256 |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
257 void |
23433
c9fab0bc983e
maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
258 annotation_dialog::edit_string_changed (const QString& str) |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
259 { |
31838
45f8b601c992
maint: Use "m_" prefix on all private member variables in classes.
Rik <rik@octave.org>
parents:
31709
diff
changeset
|
260 m_ui->button_box->button (QDialogButtonBox::Ok)->setEnabled (str.length () > 0); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
261 } |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
262 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
263 void |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
264 annotation_dialog::prompt_for_color () |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
265 { |
23447
db1fdf4384dd
maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents:
23433
diff
changeset
|
266 QWidget *widg = dynamic_cast<QWidget *> (sender ()); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
267 if (widg) |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
268 { |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
269 QColor color = widg->palette ().color (QPalette::Button); |
20181
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20109
diff
changeset
|
270 |
23070
bef714f45999
maint: Use space after function name/before parenthesis in libgui.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
271 color = QColorDialog::getColor (color, this); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
272 |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
273 if (color.isValid ()) |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
274 { |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
275 widg->setPalette (QPalette (color)); |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
276 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
277 QString css = QString ("background-color: %1; border: 1px solid %2;") |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
278 .arg (color.name ()) |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
279 .arg ("#000000"); |
20181
aa36fb998a4d
maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents:
20109
diff
changeset
|
280 |
22411
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
281 widg->setStyleSheet (css); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
282 widg->update (); |
c69805d1fa64
maint: Style check C++ code in libgui/
Rik <rik@octave.org>
parents:
22399
diff
changeset
|
283 } |
20095
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
284 } |
c164cfc24bdd
QtHandles: add annotations dialog
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
285 } |