Fri, 03 May 2013 18:49:23 +0300
Adding objects now actually updates the bounding box like it should be.
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
1 | /* |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
104 | 3 | * Copyright (C) 2013 Santeri Piippo |
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
4 | * |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
8 | * (at your option) any later version. |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
9 | * |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
13 | * GNU General Public License for more details. |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
14 | * |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
17 | */ |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
18 | |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #include "common.h" |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include "zz_configDialog.h" |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | #include "file.h" |
69
6790dea720a8
Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
68
diff
changeset
|
22 | #include "config.h" |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
23 | #include "misc.h" |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
24 | #include "colors.h" |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
25 | #include "zz_colorSelectDialog.h" |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | #include <qgridlayout.h> |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | #include <qfiledialog.h> |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
28 | #include <qcolordialog.h> |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
29 | #include <qboxlayout.h> |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
30 | #include <qevent.h> |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
31 | |
69
6790dea720a8
Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
68
diff
changeset
|
32 | extern_cfg (str, io_ldpath); |
6790dea720a8
Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
68
diff
changeset
|
33 | extern_cfg (str, gl_bgcolor); |
6790dea720a8
Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
68
diff
changeset
|
34 | extern_cfg (str, gl_maincolor); |
6790dea720a8
Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
68
diff
changeset
|
35 | extern_cfg (bool, lv_colorize); |
6790dea720a8
Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
68
diff
changeset
|
36 | extern_cfg (bool, gl_colorbfc); |
6790dea720a8
Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
68
diff
changeset
|
37 | extern_cfg (float, gl_maincolor_alpha); |
6790dea720a8
Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
68
diff
changeset
|
38 | extern_cfg (int, gl_linethickness); |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
83
diff
changeset
|
39 | extern_cfg (int, gui_toolbar_iconsize); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
40 | extern_cfg (str, gui_colortoolbar); |
106
46e4202a44fc
Added additive selection blending, with a toggable flash effect. :P
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
41 | extern_cfg (bool, gl_selflash); |
141
184d117e1b12
corrections to inserting from file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
42 | extern_cfg (bool, edit_insertSchemanticsOnly); |
69
6790dea720a8
Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
68
diff
changeset
|
43 | |
104 | 44 | ConfigDialog* g_ConfigDialog = null; |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | |
54
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
46 | #define INIT_CHECKBOX(BOX, CFG) \ |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
47 | BOX->setCheckState (CFG ? Qt::Checked : Qt::Unchecked); |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
48 | |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
49 | #define APPLY_CHECKBOX(BTN, CFG) \ |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
50 | CFG = BTN->checkState() == Qt::Checked; |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
51 | |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | // ============================================================================= |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
53 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
54 | // ============================================================================= |
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
55 | ConfigDialog::ConfigDialog (ForgeWindow* parent) : QDialog (parent) { |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
56 | g_ConfigDialog = this; |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
57 | tabs = new QTabWidget; |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
58 | |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
59 | initMainTab (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
60 | initShortcutsTab (); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
61 | initQuickColorTab (); |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
62 | initGridTab (); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
63 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
64 | IMPLEMENT_DIALOG_BUTTONS |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
65 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
66 | QVBoxLayout* layout = new QVBoxLayout; |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
67 | layout->addWidget (tabs); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
68 | layout->addWidget (bbx_buttons); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
69 | setLayout (layout); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
70 | |
119 | 71 | setWindowTitle (APPNAME_DISPLAY " - Settings"); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
72 | setWindowIcon (QIcon ("icons/settings.png")); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
73 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
74 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
75 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
76 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
77 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
78 | void ConfigDialog::initMainTab () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
79 | mainTab = new QWidget; |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
80 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
81 | // ========================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
82 | // LDraw path |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
83 | lb_LDrawPath = new QLabel ("LDraw path:"); |
119 | 84 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
85 | le_LDrawPath = new QLineEdit; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
86 | le_LDrawPath->setText (io_ldpath.value.chars()); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
87 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
88 | pb_findLDrawPath = new QPushButton; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
89 | pb_findLDrawPath->setIcon (QIcon ("icons/folder.png")); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
90 | connect (pb_findLDrawPath, SIGNAL (clicked ()), |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
91 | this, SLOT (slot_findLDrawPath ())); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
92 | |
119 | 93 | QHBoxLayout* qLDrawPathLayout = new QHBoxLayout; |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
94 | qLDrawPathLayout->addWidget (le_LDrawPath); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
95 | qLDrawPathLayout->addWidget (pb_findLDrawPath); |
119 | 96 | |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
97 | // ========================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
98 | // Background and foreground colors |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
99 | lb_viewBg = new QLabel ("Background color:"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
100 | pb_viewBg = new QPushButton; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
101 | setButtonBackground (pb_viewBg, gl_bgcolor.value); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
102 | connect (pb_viewBg, SIGNAL (clicked ()), |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
103 | this, SLOT (slot_setGLBackground ())); |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
104 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
105 | lb_viewFg = new QLabel ("Foreground color:"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
106 | pb_viewFg = new QPushButton; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
107 | setButtonBackground (pb_viewFg, gl_maincolor.value); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
108 | connect (pb_viewFg, SIGNAL (clicked ()), |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
109 | this, SLOT (slot_setGLForeground ())); |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
110 | |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
111 | // ========================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
112 | // Alpha and line thickness sliders |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
113 | lb_viewFgAlpha = new QLabel ("Alpha:"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
114 | makeSlider (sl_viewFgAlpha, 1, 10, (gl_maincolor_alpha * 10.0f)); |
68
c637b172d565
Further fixes to bad color handling. Allow main color be represented with arbitrary transparency.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
54
diff
changeset
|
115 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
116 | lb_lineThickness = new QLabel ("Line thickness:"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
117 | makeSlider (sl_lineThickness, 1, 8, gl_linethickness); |
53
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
118 | |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
119 | // ========================================================================= |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
83
diff
changeset
|
120 | // Tool bar icon size slider |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
121 | lb_iconSize = new QLabel ("Toolbar icon size:"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
122 | makeSlider (sl_iconSize, 1, 5, (gui_toolbar_iconsize - 12) / 4); |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
83
diff
changeset
|
123 | |
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
83
diff
changeset
|
124 | // ========================================================================= |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
125 | // List view colorizer and BFC red/green view checkboxes |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
126 | cb_colorize = new QCheckBox ("Colorize polygons in list view"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
127 | INIT_CHECKBOX (cb_colorize, lv_colorize) |
54
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
128 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
129 | cb_colorBFC = new QCheckBox ("Red/green BFC view"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
130 | INIT_CHECKBOX (cb_colorBFC, gl_colorbfc) |
52
d71226763607
Colorized polygons now appear colorized in the list view (unless disabled). GL rendered now draws transparent polygons properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
47
diff
changeset
|
131 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
132 | cb_selFlash = new QCheckBox ("Selection flash"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
133 | INIT_CHECKBOX (cb_selFlash, gl_selflash) |
106
46e4202a44fc
Added additive selection blending, with a toggable flash effect. :P
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
134 | |
141
184d117e1b12
corrections to inserting from file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
135 | cb_insertSchemanticsOnly = new QCheckBox ("Only insert schemantic objects from a file"); |
184d117e1b12
corrections to inserting from file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
136 | INIT_CHECKBOX (cb_insertSchemanticsOnly, edit_insertSchemanticsOnly) |
184d117e1b12
corrections to inserting from file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
137 | |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
138 | QGridLayout* layout = new QGridLayout; |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
139 | layout->addWidget (lb_LDrawPath, 0, 0); |
119 | 140 | layout->addLayout (qLDrawPathLayout, 0, 1, 1, 3); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
141 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
142 | layout->addWidget (lb_viewBg, 1, 0); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
143 | layout->addWidget (pb_viewBg, 1, 1); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
144 | layout->addWidget (lb_viewFg, 1, 2); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
145 | layout->addWidget (pb_viewFg, 1, 3); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
146 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
147 | layout->addWidget (lb_lineThickness, 2, 0); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
148 | layout->addWidget (sl_lineThickness, 2, 1); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
149 | layout->addWidget (lb_viewFgAlpha, 2, 2); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
150 | layout->addWidget (sl_viewFgAlpha, 2, 3); |
52
d71226763607
Colorized polygons now appear colorized in the list view (unless disabled). GL rendered now draws transparent polygons properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
47
diff
changeset
|
151 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
152 | layout->addWidget (lb_iconSize, 3, 0); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
153 | layout->addWidget (sl_iconSize, 3, 1); |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
83
diff
changeset
|
154 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
155 | layout->addWidget (cb_colorize, 4, 0, 1, 4); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
156 | layout->addWidget (cb_colorBFC, 5, 0, 1, 4); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
157 | layout->addWidget (cb_selFlash, 6, 0, 1, 4); |
141
184d117e1b12
corrections to inserting from file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
158 | layout->addWidget (cb_insertSchemanticsOnly, 7, 0, 1, 4); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
159 | mainTab->setLayout (layout); |
53
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
160 | |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
161 | // Add the tab to the manager |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
162 | tabs->addTab (mainTab, "Main settings"); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
163 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
164 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
165 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
166 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
167 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
168 | void ConfigDialog::initShortcutsTab () { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
169 | QGridLayout* qLayout; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
170 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
171 | shortcutsTab = new QWidget; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
172 | lw_shortcutList = new QListWidget; |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
173 | qLayout = new QGridLayout; |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
174 | |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
175 | // Init table items |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
176 | ulong i = 0; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
177 | for (actionmeta meta : g_ActionMeta) { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
178 | QAction* const qAct = *meta.qAct; |
119 | 179 | |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
180 | QListWidgetItem* qItem = new QListWidgetItem; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
181 | setShortcutText (qItem, meta); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
182 | qItem->setIcon (qAct->icon ()); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
183 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
184 | shortcutItems.push_back (qItem); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
185 | lw_shortcutList->insertItem (i, qItem); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
186 | ++i; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
187 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
188 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
189 | pb_setShortcut = new QPushButton ("Set"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
190 | pb_resetShortcut = new QPushButton ("Reset"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
191 | pb_clearShortcut = new QPushButton ("Clear"); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
192 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
193 | connect (pb_setShortcut, SIGNAL (clicked ()), this, SLOT (slot_setShortcut ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
194 | connect (pb_resetShortcut, SIGNAL (clicked ()), this, SLOT (slot_resetShortcut ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
195 | connect (pb_clearShortcut, SIGNAL (clicked ()), this, SLOT (slot_clearShortcut ())); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
196 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
197 | QVBoxLayout* qButtonLayout = new QVBoxLayout; |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
198 | qButtonLayout->addWidget (pb_setShortcut); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
199 | qButtonLayout->addWidget (pb_resetShortcut); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
200 | qButtonLayout->addWidget (pb_clearShortcut); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
201 | qButtonLayout->addStretch (10); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
202 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
203 | qLayout->addWidget (lw_shortcutList, 0, 0); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
204 | qLayout->addLayout (qButtonLayout, 0, 1); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
205 | shortcutsTab->setLayout (qLayout); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
206 | tabs->addTab (shortcutsTab, "Shortcuts"); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
207 | } |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
208 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
209 | // ============================================================================= |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
210 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
211 | // ============================================================================= |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
212 | void ConfigDialog::initQuickColorTab () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
213 | quickColorTab = new QWidget; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
214 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
215 | pb_addColor = new QPushButton (getIcon ("palette"), "Add"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
216 | pb_delColor = new QPushButton (getIcon ("delete"), "Remove"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
217 | pb_changeColor = new QPushButton (getIcon ("palette"), "Set"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
218 | pb_addColorSeparator = new QPushButton ("Add Separator"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
219 | pb_moveColorUp = new QPushButton (getIcon ("arrow-up"), "Move Up"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
220 | pb_moveColorDown = new QPushButton (getIcon ("arrow-down"), "Move Down"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
221 | pb_clearColors = new QPushButton (getIcon ("delete-all"), "Clear"); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
222 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
223 | lw_quickColors = new QListWidget; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
224 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
225 | quickColorMeta = parseQuickColorMeta (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
226 | updateQuickColorList (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
227 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
228 | QVBoxLayout* qButtonLayout = new QVBoxLayout; |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
229 | qButtonLayout->addWidget (pb_addColor); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
230 | qButtonLayout->addWidget (pb_delColor); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
231 | qButtonLayout->addWidget (pb_changeColor); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
232 | qButtonLayout->addWidget (pb_addColorSeparator); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
233 | qButtonLayout->addWidget (pb_moveColorUp); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
234 | qButtonLayout->addWidget (pb_moveColorDown); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
235 | qButtonLayout->addWidget (pb_clearColors); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
236 | qButtonLayout->addStretch (1); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
237 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
238 | connect (pb_addColor, SIGNAL (clicked ()), this, SLOT (slot_setColor ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
239 | connect (pb_delColor, SIGNAL (clicked ()), this, SLOT (slot_delColor ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
240 | connect (pb_changeColor, SIGNAL (clicked ()), this, SLOT (slot_setColor ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
241 | connect (pb_addColorSeparator, SIGNAL (clicked ()), this, SLOT (slot_addColorSeparator ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
242 | connect (pb_moveColorUp, SIGNAL (clicked ()), this, SLOT (slot_moveColor ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
243 | connect (pb_moveColorDown, SIGNAL (clicked ()), this, SLOT (slot_moveColor ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
244 | connect (pb_clearColors, SIGNAL (clicked ()), this, SLOT (slot_clearColors ())); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
245 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
246 | QGridLayout* qLayout = new QGridLayout; |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
247 | qLayout->addWidget (lw_quickColors, 0, 0); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
248 | qLayout->addLayout (qButtonLayout, 0, 1); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
249 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
250 | quickColorTab->setLayout (qLayout); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
251 | tabs->addTab (quickColorTab, "Quick Colors"); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
252 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
253 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
254 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
255 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
256 | // ============================================================================= |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
257 | void ConfigDialog::initGridTab () { |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
258 | QWidget* tab = new QWidget; |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
259 | QGridLayout* layout = new QGridLayout; |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
260 | QVBoxLayout* l2 = new QVBoxLayout; |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
261 | |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
262 | QLabel* xlabel = new QLabel ("X"), |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
263 | *ylabel = new QLabel ("Y"), |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
264 | *zlabel = new QLabel ("Z"), |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
265 | *anglabel = new QLabel ("Angle"); |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
266 | |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
267 | short i = 1; |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
268 | for (QLabel* label : std::initializer_list<QLabel*> ({xlabel, ylabel, zlabel, anglabel})) { |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
269 | label->setAlignment (Qt::AlignCenter); |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
270 | layout->addWidget (label, 0, i++); |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
271 | } |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
272 | |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
273 | for (int i = 0; i < g_NumGrids; ++i) { |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
274 | // Icon |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
275 | lb_gridIcons[i] = new QLabel; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
276 | lb_gridIcons[i]->setPixmap (QPixmap (format ("icons/grid-%s", str (g_GridInfo[i].name).tolower ().chars ()))); |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
277 | |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
278 | // Text label |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
279 | lb_gridLabels[i] = new QLabel (format ("%s:", g_GridInfo[i].name)); |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
280 | |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
281 | QHBoxLayout* labellayout = new QHBoxLayout; |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
282 | labellayout->addWidget (lb_gridIcons[i]); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
283 | labellayout->addWidget (lb_gridLabels[i]); |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
284 | layout->addLayout (labellayout, i + 1, 0); |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
285 | |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
286 | // Add the widgets |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
287 | for (int j = 0; j < 4; ++j) { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
288 | dsb_gridData[i][j] = new QDoubleSpinBox; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
289 | dsb_gridData[i][j]->setValue (g_GridInfo[i].confs[j]->value); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
290 | layout->addWidget (dsb_gridData[i][j], i + 1, j + 1); |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
291 | } |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
292 | } |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
293 | |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
294 | l2->addLayout (layout); |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
295 | l2->addStretch (1); |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
296 | |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
297 | tab->setLayout (l2); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
298 | tabs->addTab (tab, "Grids"); |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
299 | } |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
300 | |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
301 | // ============================================================================= |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
302 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
303 | // ============================================================================= |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
304 | void ConfigDialog::updateQuickColorList (quickColorMetaEntry* pSel) { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
305 | for (QListWidgetItem* qItem : quickColorItems) |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
306 | delete qItem; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
307 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
308 | quickColorItems.clear (); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
309 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
310 | // Init table items |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
311 | for (quickColorMetaEntry& entry : quickColorMeta) { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
312 | QListWidgetItem* qItem = new QListWidgetItem; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
313 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
314 | if (entry.bSeparator) { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
315 | qItem->setText ("--------"); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
316 | qItem->setIcon (getIcon ("empty")); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
317 | } else { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
318 | color* col = entry.col; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
319 | |
104 | 320 | if (col == null) { |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
321 | qItem->setText ("[[unknown color]]"); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
322 | qItem->setIcon (getIcon ("error")); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
323 | } else { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
324 | qItem->setText (col->zName); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
325 | qItem->setIcon (getIcon ("palette")); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
326 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
327 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
328 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
329 | lw_quickColors->addItem (qItem); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
330 | quickColorItems.push_back (qItem); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
331 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
332 | if (pSel && &entry == pSel) { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
333 | lw_quickColors->setCurrentItem (qItem); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
334 | lw_quickColors->scrollToItem (qItem); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
335 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
336 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
337 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
338 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
339 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
340 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
341 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
342 | void ConfigDialog::slot_setColor () { |
104 | 343 | quickColorMetaEntry* pEntry = null; |
344 | QListWidgetItem* qItem = null; | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
345 | const bool bNew = static_cast<QPushButton*> (sender ()) == pb_addColor; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
346 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
347 | if (bNew == false) { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
348 | qItem = getSelectedQuickColor (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
349 | if (!qItem) |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
350 | return; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
351 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
352 | ulong ulIdx = getItemRow (qItem, quickColorItems); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
353 | pEntry = &quickColorMeta[ulIdx]; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
354 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
355 | if (pEntry->bSeparator == true) |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
356 | return; // don't color separators |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
357 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
358 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
359 | short dDefault = pEntry ? pEntry->col->index () : -1; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
360 | short dValue; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
361 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
362 | if (ColorSelectDialog::staticDialog (dValue, dDefault, this) == false) |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
363 | return; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
364 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
365 | if (pEntry) |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
366 | pEntry->col = getColor (dValue); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
367 | else { |
104 | 368 | quickColorMetaEntry entry = {getColor (dValue), null, false}; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
369 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
370 | qItem = getSelectedQuickColor (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
371 | ulong idx; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
372 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
373 | if (qItem) |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
374 | idx = getItemRow (qItem, quickColorItems) + 1; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
375 | else |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
376 | idx = quickColorItems.size(); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
377 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
378 | quickColorMeta.insert (quickColorMeta.begin() + idx, entry); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
379 | pEntry = &quickColorMeta[idx]; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
380 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
381 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
382 | updateQuickColorList (pEntry); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
383 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
384 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
385 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
386 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
387 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
388 | void ConfigDialog::slot_delColor () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
389 | if (lw_quickColors->selectedItems().size() == 0) |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
390 | return; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
391 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
392 | QListWidgetItem* qItem = lw_quickColors->selectedItems ()[0]; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
393 | ulong ulIdx = getItemRow (qItem, quickColorItems); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
394 | quickColorMeta.erase (quickColorMeta.begin () + ulIdx); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
395 | updateQuickColorList (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
396 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
397 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
398 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
399 | void ConfigDialog::slot_moveColor () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
400 | const bool bUp = (static_cast<QPushButton*> (sender()) == pb_moveColorUp); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
401 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
402 | if (lw_quickColors->selectedItems().size() == 0) |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
403 | return; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
404 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
405 | QListWidgetItem* qItem = lw_quickColors->selectedItems ()[0]; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
406 | ulong ulIdx = getItemRow (qItem, quickColorItems); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
407 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
408 | long lDest = bUp ? (ulIdx - 1) : (ulIdx + 1); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
409 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
410 | if (lDest < 0 || (ulong)lDest >= quickColorItems.size ()) |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
411 | return; // destination out of bounds |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
412 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
413 | quickColorMetaEntry tmp = quickColorMeta[lDest]; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
414 | quickColorMeta[lDest] = quickColorMeta[ulIdx]; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
415 | quickColorMeta[ulIdx] = tmp; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
416 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
417 | updateQuickColorList (&quickColorMeta[lDest]); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
418 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
419 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
420 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
421 | void ConfigDialog::slot_addColorSeparator() { |
104 | 422 | quickColorMeta.push_back ({null, null, true}); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
423 | updateQuickColorList (&quickColorMeta[quickColorMeta.size () - 1]); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
424 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
425 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
426 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
427 | void ConfigDialog::slot_clearColors () { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
428 | quickColorMeta.clear (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
429 | updateQuickColorList (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
430 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
431 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
432 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
433 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
434 | // ============================================================================= |
70
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
435 | void ConfigDialog::makeSlider (QSlider*& qSlider, short int dMin, short int dMax, |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
436 | short dDefault) |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
437 | { |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
438 | qSlider = new QSlider (Qt::Horizontal); |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
439 | qSlider->setRange (dMin, dMax); |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
440 | qSlider->setSliderPosition (dDefault); |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
441 | qSlider->setTickPosition (QSlider::TicksAbove); |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
442 | qSlider->setTickInterval (1); |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
443 | } |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
444 | |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
445 | // ============================================================================= |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
446 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
447 | // ============================================================================= |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
448 | ConfigDialog::~ConfigDialog () { |
104 | 449 | g_ConfigDialog = null; |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
450 | } |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
451 | |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
452 | // ============================================================================= |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
453 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
454 | // ============================================================================= |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
455 | void ConfigDialog::slot_findLDrawPath () { |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
456 | str zDir = QFileDialog::getExistingDirectory (this, "Choose LDraw directory", |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
457 | le_LDrawPath->text()); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
458 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
459 | if (~zDir) |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
460 | le_LDrawPath->setText (zDir.chars()); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
461 | } |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
462 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
463 | // ============================================================================= |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
464 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
465 | // ============================================================================= |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
466 | void ConfigDialog::pickColor (strconfig& cfg, QPushButton* qButton) { |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
467 | QColorDialog dlg (QColor (cfg.value.chars())); |
33
3e0cca764fd6
Added color selection icon
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
468 | dlg.setWindowIcon (QIcon ("icons/colorselect.png")); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
469 | |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
470 | if (dlg.exec ()) { |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
471 | uchar r = dlg.currentColor ().red (), |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
472 | g = dlg.currentColor ().green (), |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
473 | b = dlg.currentColor ().blue (); |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
474 | cfg.value.format ("#%.2X%.2X%.2X", r, g, b); |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
475 | setButtonBackground (qButton, cfg.value); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
476 | } |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
477 | } |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
478 | |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
479 | void ConfigDialog::slot_setGLBackground () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
480 | pickColor (gl_bgcolor, pb_viewBg); |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
481 | } |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
482 | |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
483 | void ConfigDialog::slot_setGLForeground () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
484 | pickColor (gl_maincolor, pb_viewFg); |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
485 | } |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
486 | |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
487 | // ============================================================================= |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
488 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
489 | // ============================================================================= |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
490 | void ConfigDialog::setButtonBackground (QPushButton* qButton, str zValue) { |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
491 | qButton->setIcon (QIcon ("icons/colorselect.png")); |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
492 | qButton->setAutoFillBackground (true); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
493 | qButton->setStyleSheet ( |
116 | 494 | format ("background-color: %s", zValue.chars()).chars() |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
495 | ); |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
496 | } |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
497 | |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
498 | // ============================================================================= |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
499 | long ConfigDialog::getItemRow (QListWidgetItem* qItem, std::vector<QListWidgetItem*>& haystack) { |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
500 | long i = 0; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
501 | |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
502 | for (QListWidgetItem* it : haystack) { |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
503 | if (it == qItem) |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
504 | return i; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
505 | ++i; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
506 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
507 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
508 | return -1; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
509 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
510 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
511 | // ============================================================================= |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
512 | QListWidgetItem* ConfigDialog::getSelectedQuickColor () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
513 | if (lw_quickColors->selectedItems().size() == 0) |
104 | 514 | return null; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
515 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
516 | return lw_quickColors->selectedItems ()[0]; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
517 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
518 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
519 | // ============================================================================= |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
520 | void ConfigDialog::slot_setShortcut () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
521 | QList<QListWidgetItem*> qaSel = lw_shortcutList->selectedItems (); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
522 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
523 | if (qaSel.size() < 1) |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
524 | return; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
525 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
526 | QListWidgetItem* qItem = qaSel[0]; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
527 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
528 | // Find the row this object is on. |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
529 | long idx = getItemRow (qItem, shortcutItems); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
530 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
531 | if (KeySequenceDialog::staticDialog (g_ActionMeta[idx], this)) |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
532 | setShortcutText (qItem, g_ActionMeta[idx]); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
533 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
534 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
535 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
536 | void ConfigDialog::slot_resetShortcut () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
537 | QList<QListWidgetItem*> qaSel = lw_shortcutList->selectedItems (); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
538 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
539 | for (QListWidgetItem* qItem : qaSel) { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
540 | long idx = getItemRow (qItem, shortcutItems); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
541 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
542 | actionmeta meta = g_ActionMeta[idx]; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
543 | keyseqconfig* conf = g_ActionMeta[idx].conf; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
544 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
545 | conf->reset (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
546 | (*meta.qAct)->setShortcut (*conf); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
547 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
548 | setShortcutText (qItem, meta); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
549 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
550 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
551 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
552 | // ============================================================================= |
83
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
553 | void ConfigDialog::slot_clearShortcut () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
554 | QList<QListWidgetItem*> qaSel = lw_shortcutList->selectedItems (); |
83
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
555 | QKeySequence qDummySeq; |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
556 | |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
557 | for (QListWidgetItem* qItem : qaSel) { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
558 | long idx = getItemRow (qItem, shortcutItems); |
83
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
559 | |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
560 | actionmeta meta = g_ActionMeta[idx]; |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
561 | keyseqconfig* conf = g_ActionMeta[idx].conf; |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
562 | conf->value = qDummySeq; |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
563 | |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
564 | (*meta.qAct)->setShortcut (*conf); |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
565 | setShortcutText (qItem, meta); |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
566 | } |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
567 | } |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
568 | |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
569 | // ============================================================================= |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
570 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
571 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
572 | void ConfigDialog::setShortcutText (QListWidgetItem* qItem, actionmeta meta) { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
573 | QAction* const qAct = *meta.qAct; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
574 | str zLabel = qAct->iconText (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
575 | str zKeybind = qAct->shortcut ().toString (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
576 | |
116 | 577 | qItem->setText (format ("%s (%s)", zLabel.chars () ,zKeybind.chars ()).chars()); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
578 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
579 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
580 | // ============================================================================= |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
581 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
582 | // ============================================================================= |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
583 | str ConfigDialog::makeColorToolBarString () { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
584 | str zVal; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
585 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
586 | for (quickColorMetaEntry entry : quickColorMeta) { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
587 | if (~zVal > 0) |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
588 | zVal += ':'; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
589 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
590 | if (entry.bSeparator) |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
591 | zVal += '|'; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
592 | else |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
593 | zVal.appendformat ("%d", entry.col->index ()); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
594 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
595 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
596 | return zVal; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
597 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
598 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
599 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
600 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
601 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
602 | void ConfigDialog::staticDialog () { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
603 | ConfigDialog dlg (g_ForgeWindow); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
604 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
605 | if (dlg.exec ()) { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
606 | io_ldpath = dlg.le_LDrawPath->text(); |
54
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
607 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
608 | APPLY_CHECKBOX (dlg.cb_colorize, lv_colorize) |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
609 | APPLY_CHECKBOX (dlg.cb_colorBFC, gl_colorbfc) |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
610 | APPLY_CHECKBOX (dlg.cb_selFlash, gl_selflash) |
141
184d117e1b12
corrections to inserting from file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
611 | APPLY_CHECKBOX (dlg.cb_insertSchemanticsOnly, edit_insertSchemanticsOnly) |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
612 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
613 | gl_maincolor_alpha = ((double)dlg.sl_viewFgAlpha->value ()) / 10.0f; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
614 | gl_linethickness = dlg.sl_lineThickness->value (); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
615 | gui_toolbar_iconsize = (dlg.sl_iconSize->value () * 4) + 12; |
53
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
616 | |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
617 | // Manage the quick color toolbar |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
618 | g_ForgeWindow->quickColorMeta = dlg.quickColorMeta; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
619 | gui_colortoolbar = dlg.makeColorToolBarString (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
620 | |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
621 | // Set the grid settings |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
622 | for (int i = 0; i < g_NumGrids; ++i) |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
623 | for (int j = 0; j < 4; ++j) |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
624 | g_GridInfo[i].confs[j]->value = dlg.dsb_gridData[i][j]->value (); |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
625 | |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
626 | // Save the config |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
627 | config::save (); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
628 | |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
629 | // Reload all subfiles |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
630 | reloadAllSubfiles (); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
631 | |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
632 | g_ForgeWindow->R->setBackground (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
633 | g_ForgeWindow->refresh (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
634 | g_ForgeWindow->updateToolBars (); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
635 | } |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
636 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
637 | |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
638 | // ========================================================================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
639 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
640 | // ========================================================================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
641 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
642 | // ========================================================================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
643 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
644 | // ========================================================================================================================= |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
645 | KeySequenceDialog::KeySequenceDialog (QKeySequence seq, QWidget* parent, |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
646 | Qt::WindowFlags f) : QDialog (parent, f), seq (seq) |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
647 | { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
648 | lb_output = new QLabel; |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
649 | IMPLEMENT_DIALOG_BUTTONS |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
650 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
651 | setWhatsThis ("Into this dialog you can input a key sequence for use as a " |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
652 | "shortcut in LDForge. Use OK to confirm the new shortcut and Cancel to " |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
653 | "dismiss."); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
654 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
655 | QVBoxLayout* layout = new QVBoxLayout; |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
656 | layout->addWidget (lb_output); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
657 | layout->addWidget (bbx_buttons); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
658 | setLayout (layout); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
659 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
660 | updateOutput (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
661 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
662 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
663 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
664 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
665 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
666 | bool KeySequenceDialog::staticDialog (actionmeta& meta, QWidget* parent) { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
667 | KeySequenceDialog dlg (*meta.conf, parent); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
668 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
669 | if (dlg.exec () == false) |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
670 | return false; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
671 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
672 | *meta.conf = dlg.seq; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
673 | (*meta.qAct)->setShortcut (*meta.conf); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
674 | return true; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
675 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
676 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
677 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
678 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
679 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
680 | void KeySequenceDialog::updateOutput () { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
681 | str zShortcut = seq.toString (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
682 | |
116 | 683 | str zText = format ("<center><b>%s</b></center>", zShortcut.chars ()); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
684 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
685 | lb_output->setText (zText); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
686 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
687 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
688 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
689 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
690 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
691 | void KeySequenceDialog::keyPressEvent (QKeyEvent* ev) { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
692 | seq = ev->key (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
693 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
694 | switch (seq) { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
695 | case Qt::Key_Shift: |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
696 | case Qt::Key_Control: |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
697 | case Qt::Key_Alt: |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
698 | case Qt::Key_Meta: |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
699 | seq = 0; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
700 | break; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
701 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
702 | default: |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
703 | break; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
704 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
705 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
706 | seq = (seq | ev->modifiers ()); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
707 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
708 | updateOutput (); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
709 | } |