Wed, 20 Mar 2013 21:47:33 +0200
Added color selectors for the add object dialog
|
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 |
|
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
3 | * Copyright (C) 2013 Santeri `arezey` Piippo |
|
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 | |
| 0 | 19 | #ifndef __GUI_H__ |
| 20 | #define __GUI_H__ | |
| 21 | ||
| 22 | #include <QMainWindow> | |
| 23 | #include <QMenu> | |
| 24 | #include <QToolBar> | |
| 25 | #include <QAction> | |
| 26 | #include <QTreeWidget> | |
| 27 | #include <QToolBar> | |
| 28 | #include <QTextEdit> | |
|
26
83184d9407c7
Renamed io.cpp to file.cpp, draw.cpp to gldraw.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
29 | #include "gldraw.h" |
| 0 | 30 | |
|
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
31 | // Stuff for dialogs |
|
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
32 | #define IMPLEMENT_DIALOG_BUTTONS \ |
|
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
33 | qButtons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); \ |
|
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
34 | connect (qButtons, SIGNAL (accepted ()), this, SLOT (accept ())); \ |
|
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
35 | connect (qButtons, SIGNAL (rejected ()), this, SLOT (reject ())); \ |
|
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
36 | |
|
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
37 | |
|
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
38 | class ForgeWindow : public QMainWindow { |
| 0 | 39 | Q_OBJECT |
| 40 | ||
| 41 | public: | |
| 42 | renderer* R; | |
| 43 | ||
| 44 | // Object list view | |
| 45 | QTreeWidget* qObjList; | |
| 46 | ||
| 47 | // Message log | |
| 48 | QTextEdit* qMessageLog; | |
|
13
3955ff2a7d72
Added logf function to write to message log. Write warnings of unparsable files into the message log.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
49 | str zMessageLogHTML; |
| 0 | 50 | |
| 51 | // Menus | |
| 52 | QMenu* qFileMenu, *qEditMenu, *qInsertMenu, *qHelpMenu; | |
| 53 | ||
| 54 | // Toolbars | |
| 55 | QToolBar* qFileToolBar, *qEditToolBar, *qInsertToolBar; | |
| 56 | ||
| 57 | // ACTION ARMADA | |
| 58 | QAction* qAct_new, *qAct_open, *qAct_save, *qAct_saveAs, *qAct_exit; | |
| 59 | QAction* qAct_cut, *qAct_copy, *qAct_paste; | |
| 60 | QAction* qAct_newSubfile, *qAct_newLine, *qAct_newTriangle, *qAct_newQuad; | |
|
43
85b24285a8c7
Removed vectors. I realized that subfiles can actually perform their job just as well and that keeping them around would just imply extra work - for nothing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
39
diff
changeset
|
61 | QAction* qAct_newCondLine, *qAct_newComment, *qAct_newVertex; |
|
24
d2d4d0154338
added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
21
diff
changeset
|
62 | QAction* qAct_splitQuads, *qAct_setContents, *qAct_inline; |
|
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
63 | QAction* qAct_settings; |
|
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
64 | QAction* qAct_help, *qAct_about, *qAct_aboutQt; |
|
50
7fd213c6b844
Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
48
diff
changeset
|
65 | QAction* qAct_setColor; |
| 0 | 66 | |
|
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
67 | ForgeWindow (); |
| 0 | 68 | void buildObjList (); |
|
7
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
69 | void setTitle (); |
|
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
70 | void refresh (); |
|
50
7fd213c6b844
Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
48
diff
changeset
|
71 | std::vector<LDObject*> getSelectedObjects (); |
| 0 | 72 | |
|
17
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
73 | // Where would a new item be inserted into? |
|
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
74 | ulong getInsertionPoint (); |
|
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
75 | |
| 0 | 76 | private: |
| 77 | void createMenuActions (); | |
| 78 | void createMenus (); | |
| 79 | void createToolbars (); | |
| 80 | ||
| 81 | private slots: | |
|
14
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
13
diff
changeset
|
82 | void slot_selectionChanged (); |
|
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
13
diff
changeset
|
83 | |
| 0 | 84 | void slot_new (); |
| 85 | void slot_open (); | |
| 86 | void slot_save (); | |
| 87 | void slot_saveAs (); | |
| 88 | void slot_exit (); | |
| 89 | ||
| 90 | void slot_newSubfile (); | |
| 91 | void slot_newLine (); | |
| 92 | void slot_newTriangle (); | |
| 93 | void slot_newQuad (); | |
| 94 | void slot_newCondLine (); | |
| 95 | void slot_newComment (); | |
| 96 | void slot_newVertex (); | |
| 97 | ||
|
24
d2d4d0154338
added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
21
diff
changeset
|
98 | void slot_inline (); |
|
21
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
17
diff
changeset
|
99 | void slot_splitQuads (); |
|
14
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
13
diff
changeset
|
100 | void slot_setContents (); |
|
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
13
diff
changeset
|
101 | |
| 0 | 102 | void slot_cut (); |
| 103 | void slot_copy (); | |
| 104 | void slot_paste (); | |
| 105 | ||
|
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
106 | void slot_settings (); |
|
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
107 | |
|
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
108 | void slot_help (); |
| 0 | 109 | void slot_about (); |
| 110 | void slot_aboutQt (); | |
|
48
113eb6446c61
Color dialog almost up and running. Need to make it actually selectable now. TODO: make it read LDConfig.ldr
Santeri Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
111 | |
|
50
7fd213c6b844
Turned the test palette action into a set color action for mass object coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
48
diff
changeset
|
112 | void slot_setColor (); |
| 0 | 113 | }; |
| 114 | ||
| 115 | enum { | |
| 116 | LDOLC_Icon, | |
| 117 | LDOLC_Data, | |
| 118 | NUM_LDOL_Columns | |
| 119 | }; | |
| 120 | ||
| 121 | #endif |