Wed, 24 Apr 2013 23:27:36 +0300
Cleanup and some restructuring
--- a/bbox.h Wed Apr 24 20:33:06 2013 +0300 +++ b/bbox.h Wed Apr 24 23:27:36 2013 +0300 @@ -16,8 +16,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef __BBOX_H__ -#define __BBOX_H__ +#ifndef BBOX_H +#define BBOX_H #include "common.h" #include "types.h" @@ -53,4 +53,4 @@ } }; -#endif \ No newline at end of file +#endif // BBOX_H \ No newline at end of file
--- a/colors.h Wed Apr 24 20:33:06 2013 +0300 +++ b/colors.h Wed Apr 24 23:27:36 2013 +0300 @@ -16,8 +16,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef __COLORS_H__ -#define __COLORS_H__ +#ifndef COLORS_H +#define COLORS_H #include <qcolor.h> #include "common.h" @@ -44,4 +44,4 @@ // Safely gets a color with the given number or null if no such color. color* getColor (short dColorNum); -#endif // __COLORS_H__ \ No newline at end of file +#endif // COLORS_H \ No newline at end of file
--- a/common.h Wed Apr 24 20:33:06 2013 +0300 +++ b/common.h Wed Apr 24 23:27:36 2013 +0300 @@ -16,8 +16,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef __COMMON_H__ -#define __COMMON_H__ +#ifndef COMMON_H +#define COMMON_H #define APPNAME "ldforge" #define APPNAME_DISPLAY "LDForge" @@ -70,8 +70,6 @@ static const short dMainColor = 16; static const short dEdgeColor = 24; -using std::vector; - class ForgeWindow; class LDObject; class bbox; @@ -152,18 +150,4 @@ // Identity matrix extern const matrix g_mIdentity; -typedef unsigned int uint; -typedef short unsigned int ushort; -typedef long unsigned int ulong; - -// Typedef out the _t suffices :) -typedef int8_t int8; -typedef int16_t int16; -typedef int32_t int32; -typedef int64_t int64; -typedef uint8_t uint8; -typedef uint16_t uint16; -typedef uint32_t uint32; -typedef uint64_t uint64; - -#endif \ No newline at end of file +#endif // COMMON_H \ No newline at end of file
--- a/config.h Wed Apr 24 20:33:06 2013 +0300 +++ b/config.h Wed Apr 24 23:27:36 2013 +0300 @@ -16,8 +16,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef __OPTIONS_H__ -#define __OPTIONS_H__ +#ifndef CONFIG_H +#define CONFIG_H #include "common.h" #include "str.h" @@ -225,4 +225,4 @@ DEFINE_ASSIGN_OPERATOR (keyseq, =) }; -#endif // __OPTIONS_H__ \ No newline at end of file +#endif // CONFIG_H \ No newline at end of file
--- a/file.h Wed Apr 24 20:33:06 2013 +0300 +++ b/file.h Wed Apr 24 23:27:36 2013 +0300 @@ -16,8 +16,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef __FILE_H__ -#define __FILE_H__ +#ifndef FILE_H +#define FILE_H #include "common.h" #include "ldtypes.h" @@ -101,4 +101,4 @@ extern vector<OpenFile*> g_LoadedFiles; -#endif // __FILE_H__ \ No newline at end of file +#endif // FILE_H \ No newline at end of file
--- a/gldraw.cpp Wed Apr 24 20:33:06 2013 +0300 +++ b/gldraw.cpp Wed Apr 24 23:27:36 2013 +0300 @@ -248,8 +248,6 @@ gluPerspective (45.0f, (double)w / (double)h, 0.1f, 100.0f); } -template<class T> using initlist = std::initializer_list<T>; - // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= @@ -287,7 +285,7 @@ glLoadIdentity (); glOrtho (.0, width, height, .0, -1.0, 1.0); - for (int x : vector<int> ({GL_QUADS, GL_LINE_LOOP})) { + for (int x : {GL_QUADS, GL_LINE_LOOP}) { if (x == GL_QUADS) glColor4f (.0, .8, 1.0, .6); else @@ -545,7 +543,7 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= void GLRenderer::updateSelFlash () { - if (gl_selflash && g_ForgeWindow->paSelection.size() > 0) { + if (gl_selflash && g_ForgeWindow->sel.size() > 0) { qPulseTimer->start (g_dPulseInterval); g_dPulseTick = 0; } else @@ -560,8 +558,8 @@ // Clear the selection if we do not wish to add to it. if (add == false) { - std::vector<LDObject*> paOldSelection = g_ForgeWindow->paSelection; - g_ForgeWindow->paSelection.clear (); + std::vector<LDObject*> paOldSelection = g_ForgeWindow->sel; + g_ForgeWindow->sel.clear (); // Recompile the prior selection to remove the highlight color for (LDObject* obj : paOldSelection) @@ -629,14 +627,14 @@ continue; // White is background; skip LDObject* obj = g_CurrentFile->object (idx); - g_ForgeWindow->paSelection.push_back (obj); + g_ForgeWindow->sel.push_back (obj); } delete[] pixeldata; // Remove duplicate entries. For this to be effective, the vector must be // sorted first. - std::vector<LDObject*>& sel = g_ForgeWindow->paSelection; + std::vector<LDObject*>& sel = g_ForgeWindow->sel; std::sort (sel.begin(), sel.end ()); std::vector<LDObject*>::iterator pos = std::unique (sel.begin (), sel.end ()); sel.resize (std::distance (sel.begin (), pos)); @@ -651,7 +649,7 @@ setBackground (); updateSelFlash (); - for (LDObject* obj : g_ForgeWindow->selection ()) + for (LDObject* obj : g_ForgeWindow->sel) recompileObject (obj); paintGL (); @@ -681,7 +679,7 @@ void GLRenderer::slot_timerUpdate () { ++g_dPulseTick %= g_dNumPulseTicks; - for (LDObject* obj : g_ForgeWindow->selection ()) + for (LDObject* obj : g_ForgeWindow->sel) recompileObject (obj); paintGL ();
--- a/gui.cpp Wed Apr 24 20:33:06 2013 +0300 +++ b/gui.cpp Wed Apr 24 23:27:36 2013 +0300 @@ -155,14 +155,14 @@ } // Grid actions are checkable - ACTION_NAME (gridCoarse)->setCheckable (true); - ACTION_NAME (gridMedium)->setCheckable (true); - ACTION_NAME (gridFine)->setCheckable (true); + ACTION (gridCoarse)->setCheckable (true); + ACTION (gridMedium)->setCheckable (true); + ACTION (gridFine)->setCheckable (true); // things not implemented yet QAction* const qaDisabledActions[] = { - ACTION_NAME (newSubfile), - ACTION_NAME (help), + ACTION (newSubfile), + ACTION (help), }; for (QAction* act : qaDisabledActions) @@ -181,94 +181,94 @@ // File menu qFileMenu = menuBar ()->addMenu (tr ("&File")); - qFileMenu->addAction (ACTION_NAME (newFile)); // New - qFileMenu->addAction (ACTION_NAME (open)); // Open + qFileMenu->addAction (ACTION (newFile)); // New + qFileMenu->addAction (ACTION (open)); // Open qFileMenu->addMenu (qRecentFilesMenu); // Open Recent - qFileMenu->addAction (ACTION_NAME (save)); // Save - qFileMenu->addAction (ACTION_NAME (saveAs)); // Save As + qFileMenu->addAction (ACTION (save)); // Save + qFileMenu->addAction (ACTION (saveAs)); // Save As qFileMenu->addSeparator (); // ------- - qFileMenu->addAction (ACTION_NAME (settings)); // Settings + qFileMenu->addAction (ACTION (settings)); // Settings qFileMenu->addSeparator (); // ------- - qFileMenu->addAction (ACTION_NAME (exit)); // Exit + qFileMenu->addAction (ACTION (exit)); // Exit // View menu qViewMenu = menuBar ()->addMenu (tr ("&View")); - qViewMenu->addAction (ACTION_NAME (resetView)); + qViewMenu->addAction (ACTION (resetView)); // Insert menu qInsertMenu = menuBar ()->addMenu (tr ("&Insert")); - qInsertMenu->addAction (ACTION_NAME (newSubfile)); // New Subfile - qInsertMenu->addAction (ACTION_NAME (newLine)); // New Line - qInsertMenu->addAction (ACTION_NAME (newTriangle)); // New Triangle - qInsertMenu->addAction (ACTION_NAME (newQuad)); // New Quad - qInsertMenu->addAction (ACTION_NAME (newCondLine)); // New Conditional Line - qInsertMenu->addAction (ACTION_NAME (newComment)); // New Comment - qInsertMenu->addAction (ACTION_NAME (newVertex)); // New Vertex - qInsertMenu->addAction (ACTION_NAME (newRadial)); // New Radial + qInsertMenu->addAction (ACTION (newSubfile)); // New Subfile + qInsertMenu->addAction (ACTION (newLine)); // New Line + qInsertMenu->addAction (ACTION (newTriangle)); // New Triangle + qInsertMenu->addAction (ACTION (newQuad)); // New Quad + qInsertMenu->addAction (ACTION (newCondLine)); // New Conditional Line + qInsertMenu->addAction (ACTION (newComment)); // New Comment + qInsertMenu->addAction (ACTION (newVertex)); // New Vertex + qInsertMenu->addAction (ACTION (newRadial)); // New Radial // Edit menu qEditMenu = menuBar ()->addMenu (tr ("&Edit")); - qEditMenu->addAction (ACTION_NAME (undo)); // Undo - qEditMenu->addAction (ACTION_NAME (redo)); // Redo + qEditMenu->addAction (ACTION (undo)); // Undo + qEditMenu->addAction (ACTION (redo)); // Redo qEditMenu->addSeparator (); // ----- - qEditMenu->addAction (ACTION_NAME (cut)); // Cut - qEditMenu->addAction (ACTION_NAME (copy)); // Copy - qEditMenu->addAction (ACTION_NAME (paste)); // Paste - qEditMenu->addAction (ACTION_NAME (del)); // Delete + qEditMenu->addAction (ACTION (cut)); // Cut + qEditMenu->addAction (ACTION (copy)); // Copy + qEditMenu->addAction (ACTION (paste)); // Paste + qEditMenu->addAction (ACTION (del)); // Delete qEditMenu->addSeparator (); // ----- - qEditMenu->addAction (ACTION_NAME (selectByColor)); // Select by Color - qEditMenu->addAction (ACTION_NAME (selectByType)); // Select by Type + qEditMenu->addAction (ACTION (selectByColor)); // Select by Color + qEditMenu->addAction (ACTION (selectByType)); // Select by Type qEditMenu->addSeparator (); // ----- - qEditMenu->addAction (ACTION_NAME (setColor)); // Set Color - qEditMenu->addAction (ACTION_NAME (invert)); // Invert - qEditMenu->addAction (ACTION_NAME (inlineContents)); // Inline - qEditMenu->addAction (ACTION_NAME (deepInline)); // Deep Inline - qEditMenu->addAction (ACTION_NAME (splitQuads)); // Split Quads - qEditMenu->addAction (ACTION_NAME (setContents)); // Set Contents - qEditMenu->addAction (ACTION_NAME (makeBorders)); // Make Borders - qEditMenu->addAction (ACTION_NAME (makeCornerVerts)); // Make Corner Vertices - qEditMenu->addAction (ACTION_NAME (roundCoords)); // Round Coordinates + qEditMenu->addAction (ACTION (setColor)); // Set Color + qEditMenu->addAction (ACTION (invert)); // Invert + qEditMenu->addAction (ACTION (inlineContents)); // Inline + qEditMenu->addAction (ACTION (deepInline)); // Deep Inline + qEditMenu->addAction (ACTION (splitQuads)); // Split Quads + qEditMenu->addAction (ACTION (setContents)); // Set Contents + qEditMenu->addAction (ACTION (makeBorders)); // Make Borders + qEditMenu->addAction (ACTION (makeCornerVerts)); // Make Corner Vertices + qEditMenu->addAction (ACTION (roundCoords)); // Round Coordinates // Move menu qMoveMenu = menuBar ()->addMenu (tr ("&Move")); - qMoveMenu->addAction (ACTION_NAME (moveUp)); // Move Up - qMoveMenu->addAction (ACTION_NAME (moveDown)); // Move Down + qMoveMenu->addAction (ACTION (moveUp)); // Move Up + qMoveMenu->addAction (ACTION (moveDown)); // Move Down qMoveMenu->addSeparator (); // ----- - qMoveMenu->addAction (ACTION_NAME (gridCoarse)); // Coarse Grid - qMoveMenu->addAction (ACTION_NAME (gridMedium)); // Medium Grid - qMoveMenu->addAction (ACTION_NAME (gridFine)); // Fine Grid + qMoveMenu->addAction (ACTION (gridCoarse)); // Coarse Grid + qMoveMenu->addAction (ACTION (gridMedium)); // Medium Grid + qMoveMenu->addAction (ACTION (gridFine)); // Fine Grid qMoveMenu->addSeparator (); // ----- - qMoveMenu->addAction (ACTION_NAME (moveXPos)); // Move +X - qMoveMenu->addAction (ACTION_NAME (moveXNeg)); // Move -X - qMoveMenu->addAction (ACTION_NAME (moveYPos)); // Move +Y - qMoveMenu->addAction (ACTION_NAME (moveYNeg)); // Move -Y - qMoveMenu->addAction (ACTION_NAME (moveZPos)); // Move +Z - qMoveMenu->addAction (ACTION_NAME (moveZNeg)); // Move -Z + qMoveMenu->addAction (ACTION (moveXPos)); // Move +X + qMoveMenu->addAction (ACTION (moveXNeg)); // Move -X + qMoveMenu->addAction (ACTION (moveYPos)); // Move +Y + qMoveMenu->addAction (ACTION (moveYNeg)); // Move -Y + qMoveMenu->addAction (ACTION (moveZPos)); // Move +Z + qMoveMenu->addAction (ACTION (moveZNeg)); // Move -Z qMoveMenu->addSeparator (); // ----- - qMoveMenu->addAction (ACTION_NAME (rotateXPos)); // Rotate +X - qMoveMenu->addAction (ACTION_NAME (rotateXNeg)); // Rotate -X - qMoveMenu->addAction (ACTION_NAME (rotateYPos)); // Rotate +Y - qMoveMenu->addAction (ACTION_NAME (rotateYNeg)); // Rotate -Y - qMoveMenu->addAction (ACTION_NAME (rotateZPos)); // Rotate +Z - qMoveMenu->addAction (ACTION_NAME (rotateZNeg)); // Rotate -Z + qMoveMenu->addAction (ACTION (rotateXPos)); // Rotate +X + qMoveMenu->addAction (ACTION (rotateXNeg)); // Rotate -X + qMoveMenu->addAction (ACTION (rotateYPos)); // Rotate +Y + qMoveMenu->addAction (ACTION (rotateYNeg)); // Rotate -Y + qMoveMenu->addAction (ACTION (rotateZPos)); // Rotate +Z + qMoveMenu->addAction (ACTION (rotateZNeg)); // Rotate -Z // Control menu qControlMenu = menuBar ()->addMenu (tr ("&Control")); - qControlMenu->addAction (ACTION_NAME (showHistory)); // Show History + qControlMenu->addAction (ACTION (showHistory)); // Show History #ifndef RELEASE // Debug menu qDebugMenu = menuBar ()->addMenu (tr ("&Debug")); - qDebugMenu->addAction (ACTION_NAME (addTestQuad)); // Add Test Quad - qDebugMenu->addAction (ACTION_NAME (addTestRadial)); // Add Test Radial + qDebugMenu->addAction (ACTION (addTestQuad)); // Add Test Quad + qDebugMenu->addAction (ACTION (addTestRadial)); // Add Test Radial #endif // RELEASE // Help menu qHelpMenu = menuBar ()->addMenu (tr ("&Help")); - qHelpMenu->addAction (ACTION_NAME (help)); // Help + qHelpMenu->addAction (ACTION (help)); // Help qHelpMenu->addSeparator (); // ----- - qHelpMenu->addAction (ACTION_NAME (about)); // About - qHelpMenu->addAction (ACTION_NAME (aboutQt)); // About Qt + qHelpMenu->addAction (ACTION (about)); // About + qHelpMenu->addAction (ACTION (aboutQt)); // About Qt } // ============================================================================= @@ -295,78 +295,77 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -#define ADD_TOOLBAR_ITEM(ACT) g_CurrentToolBar->addAction (ACTION_NAME (ACT)); static QToolBar* g_CurrentToolBar; static Qt::ToolBarArea g_ToolBarArea = Qt::TopToolBarArea; void ForgeWindow::initSingleToolBar (const char* sName) { - QToolBar* qBar = new QToolBar (sName); - addToolBar (g_ToolBarArea, qBar); - qaToolBars.push_back (qBar); + QToolBar* toolbar = new QToolBar (sName); + addToolBar (g_ToolBarArea, toolbar); + qaToolBars.push_back (toolbar); - g_CurrentToolBar = qBar; + g_CurrentToolBar = toolbar; } void ForgeWindow::createToolbars () { initSingleToolBar ("File"); - ADD_TOOLBAR_ITEM (newFile) - ADD_TOOLBAR_ITEM (open) - ADD_TOOLBAR_ITEM (save) - ADD_TOOLBAR_ITEM (saveAs) + g_CurrentToolBar->addAction (ACTION (newFile)); + g_CurrentToolBar->addAction (ACTION (open)); + g_CurrentToolBar->addAction (ACTION (save)); + g_CurrentToolBar->addAction (ACTION (saveAs)); // ========================================== initSingleToolBar ("Insert"); - ADD_TOOLBAR_ITEM (newSubfile) - ADD_TOOLBAR_ITEM (newLine) - ADD_TOOLBAR_ITEM (newTriangle) - ADD_TOOLBAR_ITEM (newQuad) - ADD_TOOLBAR_ITEM (newCondLine) - ADD_TOOLBAR_ITEM (newComment) - ADD_TOOLBAR_ITEM (newVertex) - ADD_TOOLBAR_ITEM (newRadial) + g_CurrentToolBar->addAction (ACTION (newSubfile)); + g_CurrentToolBar->addAction (ACTION (newLine)); + g_CurrentToolBar->addAction (ACTION (newTriangle)); + g_CurrentToolBar->addAction (ACTION (newQuad)); + g_CurrentToolBar->addAction (ACTION (newCondLine)); + g_CurrentToolBar->addAction (ACTION (newComment)); + g_CurrentToolBar->addAction (ACTION (newVertex)); + g_CurrentToolBar->addAction (ACTION (newRadial)); // ========================================== initSingleToolBar ("Edit"); - ADD_TOOLBAR_ITEM (undo) - ADD_TOOLBAR_ITEM (redo) - ADD_TOOLBAR_ITEM (cut) - ADD_TOOLBAR_ITEM (copy) - ADD_TOOLBAR_ITEM (paste) - ADD_TOOLBAR_ITEM (del) + g_CurrentToolBar->addAction (ACTION (undo)); + g_CurrentToolBar->addAction (ACTION (redo)); + g_CurrentToolBar->addAction (ACTION (cut)); + g_CurrentToolBar->addAction (ACTION (copy)); + g_CurrentToolBar->addAction (ACTION (paste)); + g_CurrentToolBar->addAction (ACTION (del)); // ========================================== initSingleToolBar ("Select"); - ADD_TOOLBAR_ITEM (selectByColor) - ADD_TOOLBAR_ITEM (selectByType) + g_CurrentToolBar->addAction (ACTION (selectByColor)); + g_CurrentToolBar->addAction (ACTION (selectByType)); addToolBarBreak (Qt::TopToolBarArea); // ========================================== initSingleToolBar ("Move"); - ADD_TOOLBAR_ITEM (moveUp) - ADD_TOOLBAR_ITEM (moveDown) - ADD_TOOLBAR_ITEM (moveXPos) - ADD_TOOLBAR_ITEM (moveXNeg) - ADD_TOOLBAR_ITEM (moveYPos) - ADD_TOOLBAR_ITEM (moveYNeg) - ADD_TOOLBAR_ITEM (moveZPos) - ADD_TOOLBAR_ITEM (moveZNeg) + g_CurrentToolBar->addAction (ACTION (moveUp)); + g_CurrentToolBar->addAction (ACTION (moveDown)); + g_CurrentToolBar->addAction (ACTION (moveXPos)); + g_CurrentToolBar->addAction (ACTION (moveXNeg)); + g_CurrentToolBar->addAction (ACTION (moveYPos)); + g_CurrentToolBar->addAction (ACTION (moveYNeg)); + g_CurrentToolBar->addAction (ACTION (moveZPos)); + g_CurrentToolBar->addAction (ACTION (moveZNeg)); // ========================================== initSingleToolBar ("Rotate"); - ADD_TOOLBAR_ITEM (rotateXPos) - ADD_TOOLBAR_ITEM (rotateXNeg) - ADD_TOOLBAR_ITEM (rotateYPos) - ADD_TOOLBAR_ITEM (rotateYNeg) - ADD_TOOLBAR_ITEM (rotateZPos) - ADD_TOOLBAR_ITEM (rotateZNeg) + g_CurrentToolBar->addAction (ACTION (rotateXPos)); + g_CurrentToolBar->addAction (ACTION (rotateXNeg)); + g_CurrentToolBar->addAction (ACTION (rotateYPos)); + g_CurrentToolBar->addAction (ACTION (rotateYNeg)); + g_CurrentToolBar->addAction (ACTION (rotateZPos)); + g_CurrentToolBar->addAction (ACTION (rotateZNeg)); // ========================================== // Grid toolbar initSingleToolBar ("Grids"); - ADD_TOOLBAR_ITEM (gridCoarse) - ADD_TOOLBAR_ITEM (gridMedium) - ADD_TOOLBAR_ITEM (gridFine) + g_CurrentToolBar->addAction (ACTION (gridCoarse)); + g_CurrentToolBar->addAction (ACTION (gridMedium)); + g_CurrentToolBar->addAction (ACTION (gridFine)); // ========================================== // Color toolbar @@ -377,15 +376,15 @@ // Left area toolbars g_ToolBarArea = Qt::LeftToolBarArea; initSingleToolBar ("Objects"); - ADD_TOOLBAR_ITEM (setColor) - ADD_TOOLBAR_ITEM (invert) - ADD_TOOLBAR_ITEM (inlineContents) - ADD_TOOLBAR_ITEM (deepInline) - ADD_TOOLBAR_ITEM (splitQuads) - ADD_TOOLBAR_ITEM (setContents) - ADD_TOOLBAR_ITEM (makeBorders) - ADD_TOOLBAR_ITEM (makeCornerVerts) - ADD_TOOLBAR_ITEM (roundCoords) + g_CurrentToolBar->addAction (ACTION (setColor)); + g_CurrentToolBar->addAction (ACTION (invert)); + g_CurrentToolBar->addAction (ACTION (inlineContents)); + g_CurrentToolBar->addAction (ACTION (deepInline)); + g_CurrentToolBar->addAction (ACTION (splitQuads)); + g_CurrentToolBar->addAction (ACTION (setContents)); + g_CurrentToolBar->addAction (ACTION (makeBorders)); + g_CurrentToolBar->addAction (ACTION (makeCornerVerts)); + g_CurrentToolBar->addAction (ACTION (roundCoords)); updateToolBars (); } @@ -449,9 +448,9 @@ // ============================================================================= void ForgeWindow::updateGridToolBar () { // Ensure that the current grid - and only the current grid - is selected. - ACTION_NAME (gridCoarse)->setChecked (grid == Grid::Coarse); - ACTION_NAME (gridMedium)->setChecked (grid == Grid::Medium); - ACTION_NAME (gridFine)->setChecked (grid == Grid::Fine); + ACTION (gridCoarse)->setChecked (grid == Grid::Coarse); + ACTION (gridMedium)->setChecked (grid == Grid::Medium); + ACTION (gridFine)->setChecked (grid == Grid::Fine); } // ============================================================================= @@ -509,13 +508,13 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= void ForgeWindow::deleteSelection (vector<ulong>* ulapIndices, std::vector<LDObject*>* papObjects) { - if (selection ().size () == 0) + if (sel.size () == 0) return; - std::vector<LDObject*> sel = selection (); + std::vector<LDObject*> selCopy = sel; // Delete the objects that were being selected - for (LDObject* obj : sel) { + for (LDObject* obj : selCopy) { if (papObjects && ulapIndices) { papObjects->push_back (obj->clone ()); ulapIndices->push_back (obj->getIndex (g_CurrentFile)); @@ -562,8 +561,8 @@ { LDLine* line = static_cast<LDLine*> (obj); zText.format ("%s, %s", - line->vaCoords[0].getStringRep (true).chars(), - line->vaCoords[1].getStringRep (true).chars()); + line->vaCoords[0].stringRep (true).chars(), + line->vaCoords[1].stringRep (true).chars()); } break; @@ -571,9 +570,9 @@ { LDTriangle* triangle = static_cast<LDTriangle*> (obj); zText.format ("%s, %s, %s", - triangle->vaCoords[0].getStringRep (true).chars(), - triangle->vaCoords[1].getStringRep (true).chars(), - triangle->vaCoords[2].getStringRep (true).chars()); + triangle->vaCoords[0].stringRep (true).chars(), + triangle->vaCoords[1].stringRep (true).chars(), + triangle->vaCoords[2].stringRep (true).chars()); } break; @@ -581,10 +580,10 @@ { LDQuad* quad = static_cast<LDQuad*> (obj); zText.format ("%s, %s, %s, %s", - quad->vaCoords[0].getStringRep (true).chars(), - quad->vaCoords[1].getStringRep (true).chars(), - quad->vaCoords[2].getStringRep (true).chars(), - quad->vaCoords[3].getStringRep (true).chars()); + quad->vaCoords[0].stringRep (true).chars(), + quad->vaCoords[1].stringRep (true).chars(), + quad->vaCoords[2].stringRep (true).chars(), + quad->vaCoords[3].stringRep (true).chars()); } break; @@ -592,10 +591,10 @@ { LDCondLine* line = static_cast<LDCondLine*> (obj); zText.format ("%s, %s, %s, %s", - line->vaCoords[0].getStringRep (true).chars(), - line->vaCoords[1].getStringRep (true).chars(), - line->vaCoords[2].getStringRep (true).chars(), - line->vaCoords[3].getStringRep (true).chars()); + line->vaCoords[0].stringRep (true).chars(), + line->vaCoords[1].stringRep (true).chars(), + line->vaCoords[2].stringRep (true).chars(), + line->vaCoords[3].stringRep (true).chars()); } break; @@ -605,7 +604,7 @@ break; case OBJ_Vertex: - zText.format ("%s", static_cast<LDVertex*> (obj)->vPosition.getStringRep (true).chars()); + zText.format ("%s", static_cast<LDVertex*> (obj)->vPosition.stringRep (true).chars()); break; case OBJ_Subfile: @@ -613,7 +612,7 @@ LDSubfile* ref = static_cast<LDSubfile*> (obj); zText.format ("%s %s, (", - ref->zFileName.chars(), ref->vPosition.getStringRep (true).chars()); + ref->zFileName.chars(), ref->vPosition.stringRep (true).chars()); for (short i = 0; i < 9; ++i) zText.appendformat ("%s%s", @@ -640,7 +639,7 @@ if (pRad->eRadialType == LDRadial::Ring || pRad->eRadialType == LDRadial::Cone) zText.appendformat (" %d", pRad->dRingNum); - zText.appendformat (" %s", pRad->vPosition.getStringRep (true).chars ()); + zText.appendformat (" %s", pRad->vPosition.stringRep (true).chars ()); } break; @@ -698,11 +697,11 @@ // Update the shared selection array, unless this was called during GL picking, // in which case the GL renderer takes care of the selection. if (R->picking == false) { - std::vector<LDObject*> paPriorSelection = paSelection; - paSelection = getSelectedObjects (); + std::vector<LDObject*> paPriorSelection = sel; + sel = getSelectedObjects (); // Update the GL renderer - for (LDObject* obj : paSelection) + for (LDObject* obj : sel) R->recompileObject (obj); for (LDObject* obj : paPriorSelection) @@ -723,11 +722,11 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= void ForgeWindow::slot_quickColor () { - QPushButton* qBtn = static_cast<QPushButton*> (sender ()); + QPushButton* button = static_cast<QPushButton*> (sender ()); color* col = null; for (quickColorMetaEntry entry : quickColorMeta) { - if (entry.btn == qBtn) { + if (entry.btn == button) { col = entry.col; break; } @@ -736,21 +735,21 @@ if (col == null) return; - std::vector<ulong> ulaIndices; - std::vector<short> daColors; - short dNewColor = col->index (); + std::vector<ulong> indices; + std::vector<short> colors; + short newColor = col->index (); - for (LDObject* obj : paSelection) { + for (LDObject* obj : sel) { if (obj->dColor == -1) continue; // uncolored object - ulaIndices.push_back (obj->getIndex (g_CurrentFile)); - daColors.push_back (obj->dColor); + indices.push_back (obj->getIndex (g_CurrentFile)); + colors.push_back (obj->dColor); - obj->dColor = dNewColor; + obj->dColor = newColor; } - History::addEntry (new SetColorHistory (ulaIndices, daColors, dNewColor)); + History::addEntry (new SetColorHistory (indices, colors, newColor)); refresh (); } @@ -810,7 +809,7 @@ void ForgeWindow::updateSelection () { g_bSelectionLocked = true; - for (LDObject* obj : paSelection) + for (LDObject* obj : sel) obj->qObjListEntry->setSelected (true); g_bSelectionLocked = false; @@ -826,36 +825,36 @@ if (pNeedle == null) pNeedle = obj; - for (LDObject* pHay : paSelection) + for (LDObject* pHay : sel) if (pHay == pNeedle) return true; return false; } short ForgeWindow::getSelectedColor() { - short dResult = -1; + short result = -1; - for (LDObject* obj : paSelection) { + for (LDObject* obj : sel) { if (obj->dColor == -1) continue; // doesn't use color - if (dResult != -1 && obj->dColor != dResult) + if (result != -1 && obj->dColor != result) return -1; // No consensus in object color - if (dResult == -1) - dResult = obj->dColor; + if (result == -1) + result = obj->dColor; } - return dResult; + return result; } // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -LDObjectType_e ForgeWindow::getSelectedType () { +LDObjectType_e ForgeWindow::uniformSelectedType () { LDObjectType_e eResult = OBJ_Unidentified; - for (LDObject* obj : paSelection) { + for (LDObject* obj : sel) { if (eResult != OBJ_Unidentified && obj->dColor != eResult) return OBJ_Unidentified; @@ -888,13 +887,6 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -std::vector<LDObject*>& ForgeWindow::selection () { - return paSelection; -} - -// ============================================================================= -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -// ============================================================================= QIcon getIcon (const char* sIconName) { return (QIcon (format ("./icons/%s.png", sIconName))); }
--- a/gui.h Wed Apr 24 20:33:06 2013 +0300 +++ b/gui.h Wed Apr 24 23:27:36 2013 +0300 @@ -16,8 +16,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef __GUI_H__ -#define __GUI_H__ +#ifndef GUI_H +#define GUI_H #include <QMainWindow> #include <QMenu> @@ -32,9 +32,9 @@ // Stuff for dialogs #define IMPLEMENT_DIALOG_BUTTONS \ - qButtons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); \ - connect (qButtons, SIGNAL (accepted ()), this, SLOT (accept ())); \ - connect (qButtons, SIGNAL (rejected ()), this, SLOT (reject ())); \ + bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); \ + connect (bbx_buttons, SIGNAL (accepted ()), this, SLOT (accept ())); \ + connect (bbx_buttons, SIGNAL (rejected ()), this, SLOT (reject ())); \ // ============================================================================= // Metadata for actions @@ -50,16 +50,16 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -#define ACTION(NAME, DISPLAYNAME, ICONNAME, DESCR, DEFSHORTCUT) \ - QAction* ACTION_NAME (NAME); \ +#define MAKE_ACTION(NAME, DISPLAYNAME, ICONNAME, DESCR, DEFSHORTCUT) \ + QAction* ACTION (NAME); \ cfg (keyseq, key_##NAME, DEFSHORTCUT); \ static void actionHandler_##NAME (); \ - static ActionAdder ActionAdderInstance_##NAME (&ACTION_NAME(NAME), DISPLAYNAME, \ + static ActionAdder ActionAdderInstance_##NAME (&ACTION(NAME), DISPLAYNAME, \ ICONNAME, DESCR, &key_##NAME, actionHandler_##NAME); \ static void actionHandler_##NAME () -#define EXTERN_ACTION(NAME) extern QAction* ACTION_NAME (NAME); -#define ACTION_NAME(N) LDForgeAction_##N +#define EXTERN_ACTION(NAME) extern QAction* ACTION (NAME); +#define ACTION(N) LDForgeAction_##N // Convenience macros for key sequences. #define KEY(N) (Qt::Key_##N) @@ -125,7 +125,7 @@ std::vector<quickColorMetaEntry> quickColorMeta; // Selected objects - std::vector<LDObject*> paSelection; + std::vector<LDObject*> sel; str zMessageLogHTML; @@ -134,7 +134,6 @@ void setTitle (); void refresh (); std::vector<LDObject*> getSelectedObjects (); - std::vector<LDObject*>& selection (); ulong getInsertionPoint (); void deleteSelection (vector<ulong>* ulapIndices, std::vector<LDObject*>* papObjects); void updateToolBars (); @@ -143,7 +142,7 @@ void updateGridToolBar (); bool isSelected (LDObject* obj); short getSelectedColor(); - LDObjectType_e getSelectedType (); + LDObjectType_e uniformSelectedType (); protected: void closeEvent (QCloseEvent* ev); @@ -179,4 +178,4 @@ NUM_LDOL_Columns }; -#endif \ No newline at end of file +#endif // GUI_H \ No newline at end of file
--- a/gui_actions.cpp Wed Apr 24 20:33:06 2013 +0300 +++ b/gui_actions.cpp Wed Apr 24 23:27:36 2013 +0300 @@ -30,14 +30,14 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (newFile, "&New", "brick", "Create a new part model.", CTRL (N)) { +MAKE_ACTION (newFile, "&New", "brick", "Create a new part model.", CTRL (N)) { NewPartDialog::StaticDialog (); } // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (open, "&Open", "file-open", "Load a part model from a file.", CTRL (O)) { +MAKE_ACTION (open, "&Open", "file-open", "Load a part model from a file.", CTRL (O)) { str zName; zName += QFileDialog::getOpenFileName (g_ForgeWindow, "Open File", "", "LDraw files (*.dat *.ldr)"); @@ -90,88 +90,88 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (save, "&Save", "file-save", "Save the part model.", CTRL (S)) { +MAKE_ACTION (save, "&Save", "file-save", "Save the part model.", CTRL (S)) { doSave (false); } // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (saveAs, "Save &As", "file-save-as", "Save the part model to a specific file.", CTRL_SHIFT (S)) { +MAKE_ACTION (saveAs, "Save &As", "file-save-as", "Save the part model to a specific file.", CTRL_SHIFT (S)) { doSave (true); } // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (settings, "Settin&gs", "settings", "Edit the settings of " APPNAME_DISPLAY ".", (0)) { +MAKE_ACTION (settings, "Settin&gs", "settings", "Edit the settings of " APPNAME_DISPLAY ".", (0)) { ConfigDialog::staticDialog (); } // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (exit, "&Exit", "exit", "Close " APPNAME_DISPLAY ".", CTRL (Q)) { +MAKE_ACTION (exit, "&Exit", "exit", "Close " APPNAME_DISPLAY ".", CTRL (Q)) { exit (0); } // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (newSubfile, "New Subfile", "add-subfile", "Creates a new subfile reference.", 0) { +MAKE_ACTION (newSubfile, "New Subfile", "add-subfile", "Creates a new subfile reference.", 0) { } -ACTION (newLine, "New Line", "add-line", "Creates a new line.", 0) { +MAKE_ACTION (newLine, "New Line", "add-line", "Creates a new line.", 0) { AddObjectDialog::staticDialog (OBJ_Line, g_ForgeWindow); } -ACTION (newTriangle, "New Triangle", "add-triangle", "Creates a new triangle.", 0) { +MAKE_ACTION (newTriangle, "New Triangle", "add-triangle", "Creates a new triangle.", 0) { AddObjectDialog::staticDialog (OBJ_Triangle, g_ForgeWindow); } -ACTION (newQuad, "New Quadrilateral", "add-quad", "Creates a new quadrilateral.", 0) { +MAKE_ACTION (newQuad, "New Quadrilateral", "add-quad", "Creates a new quadrilateral.", 0) { AddObjectDialog::staticDialog (OBJ_Quad, g_ForgeWindow); } -ACTION (newCondLine, "New Conditional Line", "add-condline", "Creates a new conditional line.", 0) { +MAKE_ACTION (newCondLine, "New Conditional Line", "add-condline", "Creates a new conditional line.", 0) { AddObjectDialog::staticDialog (OBJ_CondLine, g_ForgeWindow); } -ACTION (newComment, "New Comment", "add-comment", "Creates a new comment.", 0) { +MAKE_ACTION (newComment, "New Comment", "add-comment", "Creates a new comment.", 0) { AddObjectDialog::staticDialog (OBJ_Comment, g_ForgeWindow); } -ACTION (newVertex, "New Vertex", "add-vertex", "Creates a new vertex.", 0) { +MAKE_ACTION (newVertex, "New Vertex", "add-vertex", "Creates a new vertex.", 0) { AddObjectDialog::staticDialog (OBJ_Vertex, g_ForgeWindow); } -ACTION (newRadial, "New Radial", "add-radial", "Creates a new radial.", 0) { +MAKE_ACTION (newRadial, "New Radial", "add-radial", "Creates a new radial.", 0) { AddObjectDialog::staticDialog (OBJ_Radial, g_ForgeWindow); } -ACTION (help, "Help", "help", "Shows the " APPNAME_DISPLAY " help manual.", KEY (F1)) { +MAKE_ACTION (help, "Help", "help", "Shows the " APPNAME_DISPLAY " help manual.", KEY (F1)) { } // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (about, "About " APPNAME_DISPLAY, "ldforge", +MAKE_ACTION (about, "About " APPNAME_DISPLAY, "ldforge", "Shows information about " APPNAME_DISPLAY ".", CTRL (F1)) { AboutDialog dlg; dlg.exec (); } -ACTION (aboutQt, "About Qt", "qt", "Shows information about Qt.", CTRL_SHIFT (F1)) { +MAKE_ACTION (aboutQt, "About Qt", "qt", "Shows information about Qt.", CTRL_SHIFT (F1)) { QMessageBox::aboutQt (g_ForgeWindow); } // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (selectByColor, "Select by Color", "select-color", +MAKE_ACTION (selectByColor, "Select by Color", "select-color", "Select all objects by the given color.", CTRL_SHIFT (A)) { short dColor = g_ForgeWindow->getSelectedColor (); @@ -179,21 +179,21 @@ if (dColor == -1) return; // no consensus on color - g_ForgeWindow->paSelection.clear (); + g_ForgeWindow->sel.clear (); for (LDObject* obj : g_CurrentFile->objects) if (obj->dColor == dColor) - g_ForgeWindow->paSelection.push_back (obj); + g_ForgeWindow->sel.push_back (obj); g_ForgeWindow->updateSelection (); } -ACTION (selectByType, "Select by Type", "select-type", +MAKE_ACTION (selectByType, "Select by Type", "select-type", "Select all objects by the given type.", (0)) { - if (g_ForgeWindow->selection ().size () == 0) + if (g_ForgeWindow->sel.size () == 0) return; - LDObjectType_e eType = g_ForgeWindow->getSelectedType (); + LDObjectType_e eType = g_ForgeWindow->uniformSelectedType (); if (eType == OBJ_Unidentified) return; @@ -203,14 +203,14 @@ str zRefName; if (eType == OBJ_Subfile) { - zRefName = static_cast<LDSubfile*> (g_ForgeWindow->selection ()[0])->zFileName; + zRefName = static_cast<LDSubfile*> (g_ForgeWindow->sel[0])->zFileName; - for (LDObject* pObj : g_ForgeWindow->selection ()) + for (LDObject* pObj : g_ForgeWindow->sel) if (static_cast<LDSubfile*> (pObj)->zFileName != zRefName) return; } - g_ForgeWindow->paSelection.clear (); + g_ForgeWindow->sel.clear (); for (LDObject* obj : g_CurrentFile->objects) { if (obj->getType() != eType) continue; @@ -218,7 +218,7 @@ if (eType == OBJ_Subfile && static_cast<LDSubfile*> (obj)->zFileName != zRefName) continue; - g_ForgeWindow->paSelection.push_back (obj); + g_ForgeWindow->sel.push_back (obj); } g_ForgeWindow->updateSelection (); @@ -227,23 +227,23 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (gridCoarse, "Coarse Grid", "grid-coarse", "Set the grid to Coarse", CTRL (1)) { +MAKE_ACTION (gridCoarse, "Coarse Grid", "grid-coarse", "Set the grid to Coarse", CTRL (1)) { grid = Grid::Coarse; g_ForgeWindow->updateGridToolBar (); } -ACTION (gridMedium, "Medium Grid", "grid-medium", "Set the grid to Medium", CTRL (2)) { +MAKE_ACTION (gridMedium, "Medium Grid", "grid-medium", "Set the grid to Medium", CTRL (2)) { grid = Grid::Medium; g_ForgeWindow->updateGridToolBar (); } -ACTION (gridFine, "Fine Grid", "grid-fine", "Set the grid to Fine", CTRL (3)) { +MAKE_ACTION (gridFine, "Fine Grid", "grid-fine", "Set the grid to Fine", CTRL (3)) { grid = Grid::Fine; g_ForgeWindow->updateGridToolBar (); } // ============================================================================= -ACTION (resetView, "Reset View", "reset-view", "Reset view angles, pan and zoom", CTRL (0)) { +MAKE_ACTION (resetView, "Reset View", "reset-view", "Reset view angles, pan and zoom", CTRL (0)) { g_ForgeWindow->R->resetAngles (); g_ForgeWindow->R->updateGL (); } @@ -253,7 +253,7 @@ // ============================================================================= // Debug things #ifndef RELEASE -ACTION (addTestQuad, "Add Test Quad", "add-quad", "Adds a test quad.", (0)) { +MAKE_ACTION (addTestQuad, "Add Test Quad", "add-quad", "Adds a test quad.", (0)) { LDQuad* pQuad = new LDQuad; pQuad->dColor = rand () % 24; pQuad->vaCoords[0] = { 1.0f, 0.0f, 1.0f}; @@ -266,7 +266,7 @@ g_ForgeWindow->refresh (); } -ACTION (addTestRadial, "Add Test Radial", "add-radial", "Adds a test radial.", (0)) { +MAKE_ACTION (addTestRadial, "Add Test Radial", "add-radial", "Adds a test radial.", (0)) { LDRadial* pRad = new LDRadial; pRad->eRadialType = LDRadial::Cone; pRad->mMatrix = g_mIdentity;
--- a/gui_editactions.cpp Wed Apr 24 20:33:06 2013 +0300 +++ b/gui_editactions.cpp Wed Apr 24 23:27:36 2013 +0300 @@ -32,7 +32,7 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= static bool copyToClipboard () { - vector<LDObject*> objs = g_ForgeWindow->selection (); + vector<LDObject*> objs = g_ForgeWindow->sel; if (objs.size() == 0) return false; @@ -56,7 +56,7 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (cut, "Cut", "cut", "Cut the current selection to clipboard.", CTRL (X)) { +MAKE_ACTION (cut, "Cut", "cut", "Cut the current selection to clipboard.", CTRL (X)) { vector<ulong> ulaIndices; vector<LDObject*> copies; @@ -70,14 +70,14 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (copy, "Copy", "copy", "Copy the current selection to clipboard.", CTRL (C)) { +MAKE_ACTION (copy, "Copy", "copy", "Copy the current selection to clipboard.", CTRL (C)) { copyToClipboard (); } // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (paste, "Paste", "paste", "Paste clipboard contents.", CTRL (V)) { +MAKE_ACTION (paste, "Paste", "paste", "Paste clipboard contents.", CTRL (V)) { vector<ulong> ulaIndices; vector<LDObject*> paCopies; @@ -97,7 +97,7 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (del, "Delete", "delete", "Delete the selection", KEY (Delete)) { +MAKE_ACTION (del, "Delete", "delete", "Delete the selection", KEY (Delete)) { vector<ulong> ulaIndices; vector<LDObject*> copies; @@ -111,7 +111,7 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= static void doInline (bool bDeep) { - vector<LDObject*> sel = g_ForgeWindow->selection (); + vector<LDObject*> sel = g_ForgeWindow->sel; // History stuff vector<LDSubfile*> paRefs; @@ -160,11 +160,11 @@ g_ForgeWindow->refresh (); } -ACTION (inlineContents, "Inline", "inline", "Inline selected subfiles.", CTRL (I)) { +MAKE_ACTION (inlineContents, "Inline", "inline", "Inline selected subfiles.", CTRL (I)) { doInline (false); } -ACTION (deepInline, "Deep Inline", "inline-deep", "Recursively inline selected subfiles " +MAKE_ACTION (deepInline, "Deep Inline", "inline-deep", "Recursively inline selected subfiles " "down to polygons only.", CTRL_SHIFT (I)) { doInline (true); @@ -173,8 +173,8 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (splitQuads, "Split Quads", "quad-split", "Split quads into triangles.", (0)) { - vector<LDObject*> objs = g_ForgeWindow->selection (); +MAKE_ACTION (splitQuads, "Split Quads", "quad-split", "Split quads into triangles.", (0)) { + vector<LDObject*> objs = g_ForgeWindow->sel; vector<ulong> ulaIndices; vector<LDQuad*> paCopies; @@ -216,25 +216,25 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (setContents, "Set Contents", "set-contents", "Set the raw code of this object.", KEY (F9)) { +MAKE_ACTION (setContents, "Set Contents", "set-contents", "Set the raw code of this object.", KEY (F9)) { if (g_ForgeWindow->qObjList->selectedItems().size() != 1) return; - LDObject* obj = g_ForgeWindow->selection ()[0]; + LDObject* obj = g_ForgeWindow->sel[0]; SetContentsDialog::staticDialog (obj); } // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (setColor, "Set Color", "palette", "Set the color on given objects.", KEY (F10)) { +MAKE_ACTION (setColor, "Set Color", "palette", "Set the color on given objects.", KEY (F10)) { if (g_ForgeWindow->qObjList->selectedItems().size() <= 0) return; short dColor; short dDefault = -1; - std::vector<LDObject*> objs = g_ForgeWindow->selection (); + std::vector<LDObject*> objs = g_ForgeWindow->sel; // If all selected objects have the same color, said color is our default // value to the color selection dialog. @@ -262,10 +262,10 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (makeBorders, "Make Borders", "make-borders", "Add borders around given polygons.", +MAKE_ACTION (makeBorders, "Make Borders", "make-borders", "Add borders around given polygons.", CTRL_SHIFT (B)) { - vector<LDObject*> objs = g_ForgeWindow->selection (); + vector<LDObject*> objs = g_ForgeWindow->sel; vector<ulong> ulaIndices; vector<LDObject*> paObjs; @@ -312,13 +312,13 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (makeCornerVerts, "Make Corner Vertices", "corner-verts", +MAKE_ACTION (makeCornerVerts, "Make Corner Vertices", "corner-verts", "Adds vertex objects to the corners of the given polygons", (0)) { vector<ulong> ulaIndices; vector<LDObject*> paObjs; - for (LDObject* obj : g_ForgeWindow->selection ()) { + for (LDObject* obj : g_ForgeWindow->sel) { vertex* vaCoords = null; ushort uNumCoords = 0; @@ -364,7 +364,7 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= static void doMoveSelection (const bool bUp) { - vector<LDObject*> objs = g_ForgeWindow->selection (); + vector<LDObject*> objs = g_ForgeWindow->sel; // Get the indices of the objects for history archival vector<ulong> ulaIndices; @@ -376,26 +376,26 @@ g_ForgeWindow->buildObjList (); } -ACTION (moveUp, "Move Up", "arrow-up", "Move the current selection up.", SHIFT (Up)) { +MAKE_ACTION (moveUp, "Move Up", "arrow-up", "Move the current selection up.", SHIFT (Up)) { doMoveSelection (true); } -ACTION (moveDown, "Move Down", "arrow-down", "Move the current selection down.", SHIFT (Down)) { +MAKE_ACTION (moveDown, "Move Down", "arrow-down", "Move the current selection down.", SHIFT (Down)) { doMoveSelection (false); } // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (undo, "Undo", "undo", "Undo a step.", CTRL (Z)) { +MAKE_ACTION (undo, "Undo", "undo", "Undo a step.", CTRL (Z)) { History::undo (); } -ACTION (redo, "Redo", "redo", "Redo a step.", CTRL_SHIFT (Z)) { +MAKE_ACTION (redo, "Redo", "redo", "Redo a step.", CTRL_SHIFT (Z)) { History::redo (); } -ACTION (showHistory, "Show History", "history", "Show the history dialog.", (0)) { +MAKE_ACTION (showHistory, "Show History", "history", "Show the history dialog.", (0)) { HistoryDialog dlg; dlg.exec (); } @@ -411,7 +411,7 @@ vVector.y *= currentGrid ().confs[Grid::Y]->value; vVector.z *= currentGrid ().confs[Grid::Z]->value; - for (LDObject* obj : g_ForgeWindow->selection ()) { + for (LDObject* obj : g_ForgeWindow->sel) { ulaIndices.push_back (obj->getIndex (g_CurrentFile)); obj->move (vVector); } @@ -420,27 +420,27 @@ g_ForgeWindow->refresh (); } -ACTION (moveXNeg, "Move -X", "move-x-neg", "Move selected objects negative on the X axis.", KEY (Left)) { +MAKE_ACTION (moveXNeg, "Move -X", "move-x-neg", "Move selected objects negative on the X axis.", KEY (Left)) { doMoveObjects ({-1, 0, 0}); } -ACTION (moveYNeg, "Move -Y", "move-y-neg", "Move selected objects negative on the Y axis.", KEY (PageUp)) { +MAKE_ACTION (moveYNeg, "Move -Y", "move-y-neg", "Move selected objects negative on the Y axis.", KEY (PageUp)) { doMoveObjects ({0, -1, 0}); } -ACTION (moveZNeg, "Move -Z", "move-z-neg", "Move selected objects negative on the Z axis.", KEY (Down)) { +MAKE_ACTION (moveZNeg, "Move -Z", "move-z-neg", "Move selected objects negative on the Z axis.", KEY (Down)) { doMoveObjects ({0, 0, -1}); } -ACTION (moveXPos, "Move +X", "move-x-pos", "Move selected objects positive on the X axis.", KEY (Right)) { +MAKE_ACTION (moveXPos, "Move +X", "move-x-pos", "Move selected objects positive on the X axis.", KEY (Right)) { doMoveObjects ({1, 0, 0}); } -ACTION (moveYPos, "Move +Y", "move-y-pos", "Move selected objects positive on the Y axis.", KEY (PageDown)) { +MAKE_ACTION (moveYPos, "Move +Y", "move-y-pos", "Move selected objects positive on the Y axis.", KEY (PageDown)) { doMoveObjects ({0, 1, 0}); } -ACTION (moveZPos, "Move +Z", "move-z-pos", "Move selected objects positive on the Z axis.", KEY (Up)) { +MAKE_ACTION (moveZPos, "Move +Z", "move-z-pos", "Move selected objects positive on the Z axis.", KEY (Up)) { doMoveObjects ({0, 0, 1}); } @@ -456,8 +456,8 @@ // simultaneous edits with different type. This is what we ultimately store into // History. // ============================================================================= -ACTION (invert, "Invert", "invert", "Reverse the winding of given objects.", CTRL_SHIFT (W)) { - std::vector<LDObject*> paSelection = g_ForgeWindow->selection (); +MAKE_ACTION (invert, "Invert", "invert", "Reverse the winding of given objects.", CTRL_SHIFT (W)) { + std::vector<LDObject*> paSelection = g_ForgeWindow->sel; std::vector<HistoryEntry*> paHistory; for (LDObject* obj : paSelection) { @@ -573,7 +573,7 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= static void doRotate (const short l, const short m, const short n) { - std::vector<LDObject*> sel = g_ForgeWindow->selection (); + std::vector<LDObject*> sel = g_ForgeWindow->sel; bbox box; vertex origin; std::vector<vertex*> queue; @@ -634,37 +634,37 @@ g_ForgeWindow->refresh (); } -ACTION (rotateXPos, "Rotate +X", "rotate-x-pos", "Rotate objects around X axis", CTRL (Right)) { +MAKE_ACTION (rotateXPos, "Rotate +X", "rotate-x-pos", "Rotate objects around X axis", CTRL (Right)) { doRotate (1, 0, 0); } -ACTION (rotateYPos, "Rotate +Y", "rotate-y-pos", "Rotate objects around Y axis", CTRL (PageDown)) { +MAKE_ACTION (rotateYPos, "Rotate +Y", "rotate-y-pos", "Rotate objects around Y axis", CTRL (PageDown)) { doRotate (0, 1, 0); } -ACTION (rotateZPos, "Rotate +Z", "rotate-z-pos", "Rotate objects around Z axis", CTRL (Up)) { +MAKE_ACTION (rotateZPos, "Rotate +Z", "rotate-z-pos", "Rotate objects around Z axis", CTRL (Up)) { doRotate (0, 0, 1); } -ACTION (rotateXNeg, "Rotate -X", "rotate-x-neg", "Rotate objects around X axis", CTRL (Left)) { +MAKE_ACTION (rotateXNeg, "Rotate -X", "rotate-x-neg", "Rotate objects around X axis", CTRL (Left)) { doRotate (-1, 0, 0); } -ACTION (rotateYNeg, "Rotate -Y", "rotate-y-neg", "Rotate objects around Y axis", CTRL (PageUp)) { +MAKE_ACTION (rotateYNeg, "Rotate -Y", "rotate-y-neg", "Rotate objects around Y axis", CTRL (PageUp)) { doRotate (0, -1, 0); } -ACTION (rotateZNeg, "Rotate -Z", "rotate-z-neg", "Rotate objects around Z axis", CTRL (Down)) { +MAKE_ACTION (rotateZNeg, "Rotate -Z", "rotate-z-neg", "Rotate objects around Z axis", CTRL (Down)) { doRotate (0, 0, -1); } // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -ACTION (roundCoords, "Round Coordinates", "round-coords", "Round coordinates down to 3/4 decimals", (0)) { +MAKE_ACTION (roundCoords, "Round Coordinates", "round-coords", "Round coordinates down to 3/4 decimals", (0)) { setlocale (LC_ALL, "C"); - for (LDObject* obj : g_ForgeWindow->selection ()) { + for (LDObject* obj : g_ForgeWindow->sel) { for (short i = 0; i < obj->vertices (); ++i) { double* coords[3] = { &obj->vaCoords[i].x,
--- a/history.cpp Wed Apr 24 20:33:06 2013 +0300 +++ b/history.cpp Wed Apr 24 23:27:36 2013 +0300 @@ -77,8 +77,8 @@ // ========================================================================= void updateActions () { - ACTION_NAME (undo)->setEnabled (m_pos > -1); - ACTION_NAME (redo)->setEnabled (m_pos < (long) entries.size () - 1); + ACTION (undo)->setEnabled (m_pos > -1); + ACTION (redo)->setEnabled (m_pos < (long) entries.size () - 1); // Update the window title as well g_ForgeWindow->setTitle ();
--- a/ldtypes.cpp Wed Apr 24 20:33:06 2013 +0300 +++ b/ldtypes.cpp Wed Apr 24 23:27:36 2013 +0300 @@ -114,8 +114,8 @@ } str LDSubfile::getContents () { - str val = format ("1 %d %s ", dColor, vPosition.getStringRep (false).chars ()); - val += mMatrix.getStringRep (); + str val = format ("1 %d %s ", dColor, vPosition.stringRep (false).chars ()); + val += mMatrix.stringRep (); val += ' '; val += zFileName; return val; @@ -125,7 +125,7 @@ str val = format ("2 %d", dColor); for (ushort i = 0; i < 2; ++i) - val.appendformat (" %s", vaCoords[i].getStringRep (false).chars ()); + val.appendformat (" %s", vaCoords[i].stringRep (false).chars ()); return val; } @@ -134,7 +134,7 @@ str val = format ("3 %d", dColor); for (ushort i = 0; i < 3; ++i) - val.appendformat (" %s", vaCoords[i].getStringRep (false).chars ()); + val.appendformat (" %s", vaCoords[i].stringRep (false).chars ()); return val; } @@ -143,7 +143,7 @@ str val = format ("4 %d", dColor); for (ushort i = 0; i < 4; ++i) - val.appendformat (" %s", vaCoords[i].getStringRep (false).chars ()); + val.appendformat (" %s", vaCoords[i].stringRep (false).chars ()); return val; } @@ -153,7 +153,7 @@ // Add the coordinates for (ushort i = 0; i < 4; ++i) - val.appendformat (" %s", vaCoords[i].getStringRep (false).chars ()); + val.appendformat (" %s", vaCoords[i].stringRep (false).chars ()); return val; } @@ -163,7 +163,7 @@ } str LDVertex::getContents () { - return format ("0 !LDFORGE VERTEX %d %s", dColor, vPosition.getStringRep (false).chars()); + return format ("0 !LDFORGE VERTEX %d %s", dColor, vPosition.stringRep (false).chars()); } str LDEmpty::getContents () { @@ -247,9 +247,9 @@ LDObject::~LDObject () { // Remove this object from the selection array if it is there. - for (ulong i = 0; i < g_ForgeWindow->paSelection.size(); ++i) - if (g_ForgeWindow->paSelection[i] == this) - g_ForgeWindow->paSelection.erase (g_ForgeWindow->paSelection.begin() + i); + for (ulong i = 0; i < g_ForgeWindow->sel.size(); ++i) + if (g_ForgeWindow->sel[i] == this) + g_ForgeWindow->sel.erase (g_ForgeWindow->sel.begin() + i); } LDComment::~LDComment () {} @@ -662,7 +662,7 @@ return format ("0 !LDFORGE RADIAL %s %d %d %d %d %s %s", str (radialTypeName()).toupper ().strip (' ').chars (), dColor, dSegments, dDivisions, dRingNum, - vPosition.getStringRep (false).chars(), mMatrix.getStringRep().chars()); + vPosition.stringRep (false).chars(), mMatrix.stringRep().chars()); } char const* g_saRadialNameRoots[] = {
--- a/ldtypes.h Wed Apr 24 20:33:06 2013 +0300 +++ b/ldtypes.h Wed Apr 24 23:27:36 2013 +0300 @@ -16,8 +16,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef __LDTYPES_H__ -#define __LDTYPES_H__ +#ifndef LDTYPES_H +#define LDTYPES_H #include "common.h" #include "types.h" @@ -334,4 +334,4 @@ // Icons for these types extern const char* g_saObjTypeIcons[]; -#endif \ No newline at end of file +#endif // LDTYPES_H \ No newline at end of file
--- a/misc.h Wed Apr 24 20:33:06 2013 +0300 +++ b/misc.h Wed Apr 24 23:27:36 2013 +0300 @@ -16,8 +16,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef __MISC_H__ -#define __MISC_H__ +#ifndef MISC_H +#define MISC_H #include "common.h" #include "str.h" @@ -99,4 +99,4 @@ } }; -#endif // __MISC_H__ \ No newline at end of file +#endif // MISC_H \ No newline at end of file
--- a/str.cpp Wed Apr 24 20:33:06 2013 +0300 +++ b/str.cpp Wed Apr 24 23:27:36 2013 +0300 @@ -498,7 +498,7 @@ std::vector<str> str::operator/ (const char* splitstring) {return split(splitstring);} str& str::operator+= (vertex vrt) { - appendformat ("%s", vrt.getStringRep (false).chars()); + appendformat ("%s", vrt.stringRep (false).chars()); return *this; }
--- a/str.h Wed Apr 24 20:33:06 2013 +0300 +++ b/str.h Wed Apr 24 23:27:36 2013 +0300 @@ -16,13 +16,12 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef __STR_H__ -#define __STR_H__ +#ifndef STR_H +#define STR_H #include <string.h> #include <stdlib.h> #include <stdarg.h> -// #include <initializer_list> #include <vector> #include <QString> @@ -270,4 +269,4 @@ str format (const char* fmt, ...); -#endif // __STR_H__ +#endif // STR_H
--- a/types.cpp Wed Apr 24 20:33:06 2013 +0300 +++ b/types.cpp Wed Apr 24 23:27:36 2013 +0300 @@ -17,7 +17,7 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -str vertex::getStringRep (const bool bMangled) { +str vertex::stringRep (const bool bMangled) { const char* sFormat = (bMangled) ? "(%s, %s, %s)" : "%s %s %s"; return format (sFormat, @@ -103,7 +103,7 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -str matrix::getStringRep () { +str matrix::stringRep () { str val; for (short i = 0; i < 9; ++i) { if (i > 0)
--- a/types.h Wed Apr 24 20:33:06 2013 +0300 +++ b/types.h Wed Apr 24 23:27:36 2013 +0300 @@ -1,9 +1,43 @@ -#ifndef __TYPES_H__ -#define __TYPES_H__ +/* + * LDForge: LDraw parts authoring CAD + * Copyright (C) 2013 Santeri Piippo + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ -#include "types.h" +#ifndef TYPES_H +#define TYPES_H + #include "common.h" +typedef unsigned int uint; +typedef short unsigned int ushort; +typedef long unsigned int ulong; + +// Typedef out the _t suffices :) +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; + +template<class T> using initlist = std::initializer_list<T>; +using std::vector; + class matrix; // ============================================================================= @@ -19,11 +53,7 @@ double x, y, z; vertex () {} - vertex (double fX, double fY, double fZ) { - x = fX; - y = fY; - z = fZ; - } + vertex (double x, double y, double z) : x (x), y (y), z (z) {} // ========================================================================= void move (vertex other) { @@ -60,7 +90,7 @@ // ========================================================================= // Midpoint between this vertex and another vertex. vertex midpoint (vertex& other); - str getStringRep (const bool bMangled); + str stringRep (const bool bMangled); void transform (matrix mMatrix, vertex pos); }; @@ -100,7 +130,7 @@ void zero (); void testOutput (); - str getStringRep(); + str stringRep (); }; -#endif // __TYPES_H__ \ No newline at end of file +#endif // TYPES_H \ No newline at end of file
--- a/zz_aboutDialog.cpp Wed Apr 24 20:33:06 2013 +0300 +++ b/zz_aboutDialog.cpp Wed Apr 24 23:27:36 2013 +0300 @@ -32,7 +32,7 @@ { mainTab = new QWidget; - // Application icon - in full 64x64 glory. + // Application icon - in full 64 x 64 glory. QLabel* icon = new QLabel; icon->setPixmap (QPixmap ("icons/ldforge.png"));
--- a/zz_aboutDialog.h Wed Apr 24 20:33:06 2013 +0300 +++ b/zz_aboutDialog.h Wed Apr 24 23:27:36 2013 +0300 @@ -27,7 +27,7 @@ public: AboutDialog (QWidget* parent = nullptr, Qt::WindowFlags f = 0); - QPushButton* mailButton; + QPushButton* pb_mailAuthor; private slots: void slot_mail ();
--- a/zz_addObjectDialog.cpp Wed Apr 24 20:33:06 2013 +0300 +++ b/zz_addObjectDialog.cpp Wed Apr 24 23:27:36 2013 +0300 @@ -67,10 +67,10 @@ case OBJ_Radial: dCoordCount = 3; - qRadialTypeLabel = new QLabel ("Type:"); - qRadialResolutionLabel = new QLabel ("Resolution:"); - qRadialSegmentsLabel = new QLabel ("Segments:"); - qRadialRingNumLabel = new QLabel ("Ring number:"); + lb_radType = new QLabel ("Type:"); + lb_radResolution = new QLabel ("Resolution:"); + lb_radSegments = new QLabel ("Segments:"); + lb_radRingNum = new QLabel ("Ring number:"); qRadialType = new QComboBox; @@ -82,11 +82,11 @@ qRadialResolution = new QComboBox; qRadialResolution->addItems ({"Normal (16)", "Hi-Res (48)"}); - qRadialSegments = new QSpinBox; - qRadialSegments->setMinimum (1); + sb_radSegments = new QSpinBox; + sb_radSegments->setMinimum (1); - qRadialRingNum = new QSpinBox; - qRadialRingNum->setEnabled (false); + sb_radRingNum = new QSpinBox; + sb_radRingNum->setEnabled (false); break; default: @@ -135,14 +135,14 @@ break; case OBJ_Radial: - qLayout->addWidget (qRadialTypeLabel, 1, 1); + qLayout->addWidget (lb_radType, 1, 1); qLayout->addWidget (qRadialType, 1, 2); - qLayout->addWidget (qRadialResolutionLabel, 2, 1); + qLayout->addWidget (lb_radResolution, 2, 1); qLayout->addWidget (qRadialResolution, 2, 2); - qLayout->addWidget (qRadialSegmentsLabel, 3, 1); - qLayout->addWidget (qRadialSegments, 3, 2); - qLayout->addWidget (qRadialRingNumLabel, 4, 1); - qLayout->addWidget (qRadialRingNum, 4, 2); + qLayout->addWidget (lb_radSegments, 3, 1); + qLayout->addWidget (sb_radSegments, 3, 2); + qLayout->addWidget (lb_radRingNum, 4, 1); + qLayout->addWidget (sb_radRingNum, 4, 2); break; default: @@ -161,7 +161,7 @@ qLayout->addLayout (qCoordLayout, 0, 1, 2, 2); } - qLayout->addWidget (qButtons, 5, 1); + qLayout->addWidget (bbx_buttons, 5, 1); setLayout (qLayout); setWindowTitle (format (APPNAME_DISPLAY " - new %s", g_saObjTypeNames[type]).chars()); @@ -193,7 +193,7 @@ // ============================================================================= void AddObjectDialog::slot_radialTypeChanged (int dType) { LDRadial::Type eType = (LDRadial::Type) dType; - qRadialRingNum->setEnabled (eType == LDRadial::Ring || eType == LDRadial::Cone); + sb_radRingNum->setEnabled (eType == LDRadial::Ring || eType == LDRadial::Cone); } // ============================================================================= @@ -264,9 +264,9 @@ pRad->vPosition.y = dlg.qaCoordinates[1]->value (); pRad->vPosition.z = dlg.qaCoordinates[2]->value (); pRad->dDivisions = (dlg.qRadialResolution->currentIndex () == 0) ? 16 : 48; - pRad->dSegments = min<short> (dlg.qRadialSegments->value (), pRad->dDivisions); + pRad->dSegments = min<short> (dlg.sb_radSegments->value (), pRad->dDivisions); pRad->eRadialType = (LDRadial::Type) dlg.qRadialType->currentIndex (); - pRad->dRingNum = dlg.qRadialRingNum->value (); + pRad->dRingNum = dlg.sb_radRingNum->value (); pRad->mMatrix = g_mIdentity; obj = pRad;
--- a/zz_addObjectDialog.h Wed Apr 24 20:33:06 2013 +0300 +++ b/zz_addObjectDialog.h Wed Apr 24 23:27:36 2013 +0300 @@ -16,8 +16,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef __ZZ_ADDOBJECTDIALOG_H__ -#define __ZZ_ADDOBJECTDIALOG_H__ +#ifndef ZZ_ADDOBJECTDIALOG_H +#define ZZ_ADDOBJECTDIALOG_H #include "gui.h" #include <qdialog.h> @@ -48,11 +48,11 @@ // Radial stuff QComboBox* qRadialType, *qRadialResolution; - QSpinBox* qRadialSegments, *qRadialRingNum; - QLabel* qRadialTypeLabel, *qRadialResolutionLabel, *qRadialSegmentsLabel, - *qRadialRingNumLabel; + QSpinBox* sb_radSegments, *sb_radRingNum; + QLabel* lb_radType, *lb_radResolution, *lb_radSegments, + *lb_radRingNum; - QDialogButtonBox* qButtons; + QDialogButtonBox* bbx_buttons; private: void setButtonBackground (QPushButton* qButton, short dColor); @@ -64,4 +64,4 @@ void slot_radialTypeChanged (int dType); }; -#endif // __ZZ_ADDOBJECTDIALOG_H__ \ No newline at end of file +#endif // ZZ_ADDOBJECTDIALOG_H \ No newline at end of file
--- a/zz_colorSelectDialog.cpp Wed Apr 24 20:33:06 2013 +0300 +++ b/zz_colorSelectDialog.cpp Wed Apr 24 23:27:36 2013 +0300 @@ -47,15 +47,15 @@ if (!getColor (dDefault)) dDefault = -1; - qScene = new QGraphicsScene; - qView = new QGraphicsView (qScene); - dSelColor = dDefault; + gs_scene = new QGraphicsScene; + gv_view = new QGraphicsView (gs_scene); + selColor = dDefault; // not really an icon but eh - qScene->setBackgroundBrush (QPixmap ("icons/checkerboard.png")); + gs_scene->setBackgroundBrush (QPixmap ("icons/checkerboard.png")); - qScene->setSceneRect (0, 0, g_lWidth, g_lMaxHeight); - qView->setSceneRect (0, 0, g_lWidth, g_lMaxHeight); + gs_scene->setSceneRect (0, 0, g_lWidth, g_lMaxHeight); + gv_view->setSceneRect (0, 0, g_lWidth, g_lMaxHeight); drawScene (); @@ -63,26 +63,26 @@ // Set the size of the view const long lWidth = g_lWidth + 21; // HACK - qView->setMaximumWidth (lWidth); - qView->setMinimumWidth (lWidth); - qView->setMaximumHeight (g_lHeight); - qView->setMinimumHeight (g_lHeight); - qView->setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff); + gv_view->setMaximumWidth (lWidth); + gv_view->setMinimumWidth (lWidth); + gv_view->setMaximumHeight (g_lHeight); + gv_view->setMinimumHeight (g_lHeight); + gv_view->setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff); // If we have a default color selected, scroll down so that it is visible. // TODO: find a better way to do this if (dDefault >= ((g_dNumColumns * g_dNumRows) - 2)) { ulong ulNewY = ((dDefault / g_dNumColumns) - 3) * g_dSquareSize; - qView->verticalScrollBar ()->setSliderPosition (ulNewY); + gv_view->verticalScrollBar ()->setSliderPosition (ulNewY); } - qColorInfo = new QLabel; + lb_colorInfo = new QLabel; drawColorInfo (); QVBoxLayout* qLayout = new QVBoxLayout; - qLayout->addWidget (qView); - qLayout->addWidget (qColorInfo); - qLayout->addWidget (qButtons); + qLayout->addWidget (gv_view); + qLayout->addWidget (lb_colorInfo); + qLayout->addWidget (bbx_buttons); setLayout (qLayout); setWindowIcon (QIcon ("icons/palette.png")); @@ -97,7 +97,7 @@ QPen qPen (Qt::black, fPenWidth, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); // Draw the color rectangles. - qScene->clear (); + gs_scene->clear (); for (short i = 0; i < MAX_COLORS; ++i) { color* meta = getColor (i); if (!meta) @@ -119,14 +119,14 @@ (0.7152f * qColor.green()) + (0.0722f * qColor.blue()); bool bDark = (ucLuma < 80); - qScene->addRect (x, y, w, w, qPen, qColor); - QGraphicsTextItem* qText = qScene->addText (format ("%lu", i).chars()); + gs_scene->addRect (x, y, w, w, qPen, qColor); + QGraphicsTextItem* qText = gs_scene->addText (format ("%lu", i).chars()); qText->setDefaultTextColor ((bDark) ? Qt::white : Qt::black); qText->setPos (x, y); - if (i == dSelColor) { + if (i == selColor) { QGraphicsPixmapItem* qCursorPic; - qCursorPic = qScene->addPixmap (QPixmap ("icons/colorcursor.png")); + qCursorPic = gs_scene->addPixmap (QPixmap ("icons/colorcursor.png")); qCursorPic->setPos (x, y); } } @@ -136,22 +136,22 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= void ColorSelectDialog::drawColorInfo () { - color* col = getColor (dSelColor); + color* col = getColor (selColor); - if (dSelColor == -1 || !col) { - qColorInfo->setText ("---"); + if (selColor == -1 || !col) { + lb_colorInfo->setText ("---"); return; } - qColorInfo->setText (format ("%d - %s", - dSelColor, col->zName.chars())); + lb_colorInfo->setText (format ("%d - %s", + selColor, col->zName.chars())); } // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= void ColorSelectDialog::mousePressEvent (QMouseEvent* event) { - QPointF qPoint = qView->mapToScene (event->pos ()); + QPointF qPoint = gv_view->mapToScene (event->pos ()); ulong x = ((ulong)qPoint.x () - (g_dSquareSize / 2)) / g_dSquareSize; ulong y = ((ulong)qPoint.y () - (g_dSquareSize / 2)) / g_dSquareSize; @@ -161,7 +161,7 @@ if (!col) return; - dSelColor = idx; + selColor = idx; drawScene (); drawColorInfo (); } @@ -172,8 +172,8 @@ bool ColorSelectDialog::staticDialog (short& dValue, short dDefault, QWidget* parent) { ColorSelectDialog dlg (dDefault, parent); - if (dlg.exec () && dlg.dSelColor != -1) { - dValue = dlg.dSelColor; + if (dlg.exec () && dlg.selColor != -1) { + dValue = dlg.selColor; return true; }
--- a/zz_colorSelectDialog.h Wed Apr 24 20:33:06 2013 +0300 +++ b/zz_colorSelectDialog.h Wed Apr 24 23:27:36 2013 +0300 @@ -16,6 +16,9 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#ifndef COLORSELECTOR_H +#define COLORSELECTOR_H + #include <qdialog.h> #include <qdialogbuttonbox.h> #include <qgraphicsscene.h> @@ -29,11 +32,11 @@ explicit ColorSelectDialog (short dDefault = -1, QWidget* parent = null); static bool staticDialog (short& dValue, short dDefault = -1, QWidget* parent = null); - QGraphicsScene* qScene; - QGraphicsView* qView; - QLabel* qColorInfo; - QDialogButtonBox* qButtons; - short dSelColor; + QGraphicsScene* gs_scene; + QGraphicsView* gv_view; + QLabel* lb_colorInfo; + QDialogButtonBox* bbx_buttons; + short selColor; private: void drawScene (); @@ -41,4 +44,6 @@ private slots: void mousePressEvent (QMouseEvent* event); -}; \ No newline at end of file +}; + +#endif // COLORSELECTOR_H \ No newline at end of file
--- a/zz_configDialog.cpp Wed Apr 24 20:33:06 2013 +0300 +++ b/zz_configDialog.cpp Wed Apr 24 23:27:36 2013 +0300 @@ -53,7 +53,7 @@ // ============================================================================= ConfigDialog::ConfigDialog (ForgeWindow* parent) : QDialog (parent) { g_ConfigDialog = this; - qTabs = new QTabWidget; + tabs = new QTabWidget; initMainTab (); initShortcutsTab (); @@ -63,8 +63,8 @@ IMPLEMENT_DIALOG_BUTTONS QVBoxLayout* layout = new QVBoxLayout; - layout->addWidget (qTabs); - layout->addWidget (qButtons); + layout->addWidget (tabs); + layout->addWidget (bbx_buttons); setLayout (layout); setWindowTitle (APPNAME_DISPLAY " - Settings"); @@ -75,86 +75,86 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= void ConfigDialog::initMainTab () { - qMainTab = new QWidget; + mainTab = new QWidget; // ========================================================================= // LDraw path - qLDrawPathLabel = new QLabel ("LDraw path:"); + lb_LDrawPath = new QLabel ("LDraw path:"); - qLDrawPath = new QLineEdit; - qLDrawPath->setText (io_ldpath.value.chars()); + le_LDrawPath = new QLineEdit; + le_LDrawPath->setText (io_ldpath.value.chars()); - qLDrawPathFindButton = new QPushButton; - qLDrawPathFindButton->setIcon (QIcon ("icons/folder.png")); - connect (qLDrawPathFindButton, SIGNAL (clicked ()), + pb_findLDrawPath = new QPushButton; + pb_findLDrawPath->setIcon (QIcon ("icons/folder.png")); + connect (pb_findLDrawPath, SIGNAL (clicked ()), this, SLOT (slot_findLDrawPath ())); QHBoxLayout* qLDrawPathLayout = new QHBoxLayout; - qLDrawPathLayout->addWidget (qLDrawPath); - qLDrawPathLayout->addWidget (qLDrawPathFindButton); + qLDrawPathLayout->addWidget (le_LDrawPath); + qLDrawPathLayout->addWidget (pb_findLDrawPath); // ========================================================================= // Background and foreground colors - qGLBackgroundLabel = new QLabel ("Background color:"); - qGLBackgroundButton = new QPushButton; - setButtonBackground (qGLBackgroundButton, gl_bgcolor.value); - connect (qGLBackgroundButton, SIGNAL (clicked ()), + lb_viewBg = new QLabel ("Background color:"); + pb_viewBg = new QPushButton; + setButtonBackground (pb_viewBg, gl_bgcolor.value); + connect (pb_viewBg, SIGNAL (clicked ()), this, SLOT (slot_setGLBackground ())); - qGLForegroundLabel = new QLabel ("Foreground color:"); - qGLForegroundButton = new QPushButton; - setButtonBackground (qGLForegroundButton, gl_maincolor.value); - connect (qGLForegroundButton, SIGNAL (clicked ()), + lb_viewFg = new QLabel ("Foreground color:"); + pb_viewFg = new QPushButton; + setButtonBackground (pb_viewFg, gl_maincolor.value); + connect (pb_viewFg, SIGNAL (clicked ()), this, SLOT (slot_setGLForeground ())); // ========================================================================= // Alpha and line thickness sliders - qGLForegroundAlphaLabel = new QLabel ("Alpha:"); - makeSlider (qGLForegroundAlpha, 1, 10, (gl_maincolor_alpha * 10.0f)); + lb_viewFgAlpha = new QLabel ("Alpha:"); + makeSlider (sl_viewFgAlpha, 1, 10, (gl_maincolor_alpha * 10.0f)); - qGLLineThicknessLabel = new QLabel ("Line thickness:"); - makeSlider (qGLLineThickness, 1, 8, gl_linethickness); + lb_lineThickness = new QLabel ("Line thickness:"); + makeSlider (sl_lineThickness, 1, 8, gl_linethickness); // ========================================================================= // Tool bar icon size slider - qToolBarIconSizeLabel = new QLabel ("Toolbar icon size:"); - makeSlider (qToolBarIconSize, 1, 5, (gui_toolbar_iconsize - 12) / 4); + lb_iconSize = new QLabel ("Toolbar icon size:"); + makeSlider (sl_iconSize, 1, 5, (gui_toolbar_iconsize - 12) / 4); // ========================================================================= // List view colorizer and BFC red/green view checkboxes - qLVColorize = new QCheckBox ("Colorize polygons in list view"); - INIT_CHECKBOX (qLVColorize, lv_colorize) + cb_colorize = new QCheckBox ("Colorize polygons in list view"); + INIT_CHECKBOX (cb_colorize, lv_colorize) - qGLColorBFC = new QCheckBox ("Red/green BFC view"); - INIT_CHECKBOX (qGLColorBFC, gl_colorbfc) + cb_colorBFC = new QCheckBox ("Red/green BFC view"); + INIT_CHECKBOX (cb_colorBFC, gl_colorbfc) - qGLSelFlash = new QCheckBox ("Selection flash"); - INIT_CHECKBOX (qGLSelFlash, gl_selflash) + cb_selFlash = new QCheckBox ("Selection flash"); + INIT_CHECKBOX (cb_selFlash, gl_selflash) QGridLayout* layout = new QGridLayout; - layout->addWidget (qLDrawPathLabel, 0, 0); + layout->addWidget (lb_LDrawPath, 0, 0); layout->addLayout (qLDrawPathLayout, 0, 1, 1, 3); - layout->addWidget (qGLBackgroundLabel, 1, 0); - layout->addWidget (qGLBackgroundButton, 1, 1); - layout->addWidget (qGLForegroundLabel, 1, 2); - layout->addWidget (qGLForegroundButton, 1, 3); + layout->addWidget (lb_viewBg, 1, 0); + layout->addWidget (pb_viewBg, 1, 1); + layout->addWidget (lb_viewFg, 1, 2); + layout->addWidget (pb_viewFg, 1, 3); - layout->addWidget (qGLLineThicknessLabel, 2, 0); - layout->addWidget (qGLLineThickness, 2, 1); - layout->addWidget (qGLForegroundAlphaLabel, 2, 2); - layout->addWidget (qGLForegroundAlpha, 2, 3); + layout->addWidget (lb_lineThickness, 2, 0); + layout->addWidget (sl_lineThickness, 2, 1); + layout->addWidget (lb_viewFgAlpha, 2, 2); + layout->addWidget (sl_viewFgAlpha, 2, 3); - layout->addWidget (qToolBarIconSizeLabel, 3, 0); - layout->addWidget (qToolBarIconSize, 3, 1); + layout->addWidget (lb_iconSize, 3, 0); + layout->addWidget (sl_iconSize, 3, 1); - layout->addWidget (qLVColorize, 4, 0, 1, 4); - layout->addWidget (qGLColorBFC, 5, 0, 1, 4); - layout->addWidget (qGLSelFlash, 6, 0, 1, 4); - qMainTab->setLayout (layout); + layout->addWidget (cb_colorize, 4, 0, 1, 4); + layout->addWidget (cb_colorBFC, 5, 0, 1, 4); + layout->addWidget (cb_selFlash, 6, 0, 1, 4); + mainTab->setLayout (layout); // Add the tab to the manager - qTabs->addTab (qMainTab, "Main settings"); + tabs->addTab (mainTab, "Main settings"); } // ============================================================================= @@ -163,8 +163,8 @@ void ConfigDialog::initShortcutsTab () { QGridLayout* qLayout; - qShortcutsTab = new QWidget; - qShortcutList = new QListWidget; + shortcutsTab = new QWidget; + lw_shortcutList = new QListWidget; qLayout = new QGridLayout; // Init table items @@ -176,74 +176,74 @@ setShortcutText (qItem, meta); qItem->setIcon (qAct->icon ()); - qaShortcutItems.push_back (qItem); - qShortcutList->insertItem (i, qItem); + shortcutItems.push_back (qItem); + lw_shortcutList->insertItem (i, qItem); ++i; } - qSetShortcut = new QPushButton ("Set"); - qResetShortcut = new QPushButton ("Reset"); - qClearShortcut = new QPushButton ("Clear"); + pb_setShortcut = new QPushButton ("Set"); + pb_resetShortcut = new QPushButton ("Reset"); + pb_clearShortcut = new QPushButton ("Clear"); - connect (qSetShortcut, SIGNAL (clicked ()), this, SLOT (slot_setShortcut ())); - connect (qResetShortcut, SIGNAL (clicked ()), this, SLOT (slot_resetShortcut ())); - connect (qClearShortcut, SIGNAL (clicked ()), this, SLOT (slot_clearShortcut ())); + connect (pb_setShortcut, SIGNAL (clicked ()), this, SLOT (slot_setShortcut ())); + connect (pb_resetShortcut, SIGNAL (clicked ()), this, SLOT (slot_resetShortcut ())); + connect (pb_clearShortcut, SIGNAL (clicked ()), this, SLOT (slot_clearShortcut ())); QVBoxLayout* qButtonLayout = new QVBoxLayout; - qButtonLayout->addWidget (qSetShortcut); - qButtonLayout->addWidget (qResetShortcut); - qButtonLayout->addWidget (qClearShortcut); + qButtonLayout->addWidget (pb_setShortcut); + qButtonLayout->addWidget (pb_resetShortcut); + qButtonLayout->addWidget (pb_clearShortcut); qButtonLayout->addStretch (10); - qLayout->addWidget (qShortcutList, 0, 0); + qLayout->addWidget (lw_shortcutList, 0, 0); qLayout->addLayout (qButtonLayout, 0, 1); - qShortcutsTab->setLayout (qLayout); - qTabs->addTab (qShortcutsTab, "Shortcuts"); + shortcutsTab->setLayout (qLayout); + tabs->addTab (shortcutsTab, "Shortcuts"); } // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= void ConfigDialog::initQuickColorTab () { - qQuickColorTab = new QWidget; + quickColorTab = new QWidget; - qAddColor = new QPushButton (getIcon ("palette"), "Add"); - qDelColor = new QPushButton (getIcon ("delete"), "Remove"); - qChangeColor = new QPushButton (getIcon ("palette"), "Set"); - qAddColorSeparator = new QPushButton ("Add Separator"); - qMoveColorUp = new QPushButton (getIcon ("arrow-up"), "Move Up"); - qMoveColorDown = new QPushButton (getIcon ("arrow-down"), "Move Down"); - qClearColors = new QPushButton (getIcon ("delete-all"), "Clear"); + pb_addColor = new QPushButton (getIcon ("palette"), "Add"); + pb_delColor = new QPushButton (getIcon ("delete"), "Remove"); + pb_changeColor = new QPushButton (getIcon ("palette"), "Set"); + pb_addColorSeparator = new QPushButton ("Add Separator"); + pb_moveColorUp = new QPushButton (getIcon ("arrow-up"), "Move Up"); + pb_moveColorDown = new QPushButton (getIcon ("arrow-down"), "Move Down"); + pb_clearColors = new QPushButton (getIcon ("delete-all"), "Clear"); - qQuickColorList = new QListWidget; + lw_quickColors = new QListWidget; quickColorMeta = parseQuickColorMeta (); updateQuickColorList (); QVBoxLayout* qButtonLayout = new QVBoxLayout; - qButtonLayout->addWidget (qAddColor); - qButtonLayout->addWidget (qDelColor); - qButtonLayout->addWidget (qChangeColor); - qButtonLayout->addWidget (qAddColorSeparator); - qButtonLayout->addWidget (qMoveColorUp); - qButtonLayout->addWidget (qMoveColorDown); - qButtonLayout->addWidget (qClearColors); + qButtonLayout->addWidget (pb_addColor); + qButtonLayout->addWidget (pb_delColor); + qButtonLayout->addWidget (pb_changeColor); + qButtonLayout->addWidget (pb_addColorSeparator); + qButtonLayout->addWidget (pb_moveColorUp); + qButtonLayout->addWidget (pb_moveColorDown); + qButtonLayout->addWidget (pb_clearColors); qButtonLayout->addStretch (1); - connect (qAddColor, SIGNAL (clicked ()), this, SLOT (slot_setColor ())); - connect (qDelColor, SIGNAL (clicked ()), this, SLOT (slot_delColor ())); - connect (qChangeColor, SIGNAL (clicked ()), this, SLOT (slot_setColor ())); - connect (qAddColorSeparator, SIGNAL (clicked ()), this, SLOT (slot_addColorSeparator ())); - connect (qMoveColorUp, SIGNAL (clicked ()), this, SLOT (slot_moveColor ())); - connect (qMoveColorDown, SIGNAL (clicked ()), this, SLOT (slot_moveColor ())); - connect (qClearColors, SIGNAL (clicked ()), this, SLOT (slot_clearColors ())); + connect (pb_addColor, SIGNAL (clicked ()), this, SLOT (slot_setColor ())); + connect (pb_delColor, SIGNAL (clicked ()), this, SLOT (slot_delColor ())); + connect (pb_changeColor, SIGNAL (clicked ()), this, SLOT (slot_setColor ())); + connect (pb_addColorSeparator, SIGNAL (clicked ()), this, SLOT (slot_addColorSeparator ())); + connect (pb_moveColorUp, SIGNAL (clicked ()), this, SLOT (slot_moveColor ())); + connect (pb_moveColorDown, SIGNAL (clicked ()), this, SLOT (slot_moveColor ())); + connect (pb_clearColors, SIGNAL (clicked ()), this, SLOT (slot_clearColors ())); QGridLayout* qLayout = new QGridLayout; - qLayout->addWidget (qQuickColorList, 0, 0); + qLayout->addWidget (lw_quickColors, 0, 0); qLayout->addLayout (qButtonLayout, 0, 1); - qQuickColorTab->setLayout (qLayout); - qTabs->addTab (qQuickColorTab, "Quick Colors"); + quickColorTab->setLayout (qLayout); + tabs->addTab (quickColorTab, "Quick Colors"); } // ============================================================================= @@ -267,22 +267,22 @@ for (int i = 0; i < g_NumGrids; ++i) { // Icon - gridIcons[i] = new QLabel; - gridIcons[i]->setPixmap (QPixmap (format ("icons/grid-%s", str (g_GridInfo[i].name).tolower ().chars ()))); + lb_gridIcons[i] = new QLabel; + lb_gridIcons[i]->setPixmap (QPixmap (format ("icons/grid-%s", str (g_GridInfo[i].name).tolower ().chars ()))); // Text label - gridLabels[i] = new QLabel (format ("%s:", g_GridInfo[i].name)); + lb_gridLabels[i] = new QLabel (format ("%s:", g_GridInfo[i].name)); QHBoxLayout* labellayout = new QHBoxLayout; - labellayout->addWidget (gridIcons[i]); - labellayout->addWidget (gridLabels[i]); + labellayout->addWidget (lb_gridIcons[i]); + labellayout->addWidget (lb_gridLabels[i]); layout->addLayout (labellayout, i + 1, 0); // Add the widgets for (int j = 0; j < 4; ++j) { - gridData[i][j] = new QDoubleSpinBox; - gridData[i][j]->setValue (g_GridInfo[i].confs[j]->value); - layout->addWidget (gridData[i][j], i + 1, j + 1); + dsb_gridData[i][j] = new QDoubleSpinBox; + dsb_gridData[i][j]->setValue (g_GridInfo[i].confs[j]->value); + layout->addWidget (dsb_gridData[i][j], i + 1, j + 1); } } @@ -290,17 +290,17 @@ l2->addStretch (1); tab->setLayout (l2); - qTabs->addTab (tab, "Grids"); + tabs->addTab (tab, "Grids"); } // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= void ConfigDialog::updateQuickColorList (quickColorMetaEntry* pSel) { - for (QListWidgetItem* qItem : qaQuickColorItems) + for (QListWidgetItem* qItem : quickColorItems) delete qItem; - qaQuickColorItems.clear (); + quickColorItems.clear (); // Init table items for (quickColorMetaEntry& entry : quickColorMeta) { @@ -321,12 +321,12 @@ } } - qQuickColorList->addItem (qItem); - qaQuickColorItems.push_back (qItem); + lw_quickColors->addItem (qItem); + quickColorItems.push_back (qItem); if (pSel && &entry == pSel) { - qQuickColorList->setCurrentItem (qItem); - qQuickColorList->scrollToItem (qItem); + lw_quickColors->setCurrentItem (qItem); + lw_quickColors->scrollToItem (qItem); } } } @@ -337,14 +337,14 @@ void ConfigDialog::slot_setColor () { quickColorMetaEntry* pEntry = null; QListWidgetItem* qItem = null; - const bool bNew = static_cast<QPushButton*> (sender ()) == qAddColor; + const bool bNew = static_cast<QPushButton*> (sender ()) == pb_addColor; if (bNew == false) { qItem = getSelectedQuickColor (); if (!qItem) return; - ulong ulIdx = getItemRow (qItem, qaQuickColorItems); + ulong ulIdx = getItemRow (qItem, quickColorItems); pEntry = &quickColorMeta[ulIdx]; if (pEntry->bSeparator == true) @@ -366,9 +366,9 @@ ulong idx; if (qItem) - idx = getItemRow (qItem, qaQuickColorItems) + 1; + idx = getItemRow (qItem, quickColorItems) + 1; else - idx = qaQuickColorItems.size(); + idx = quickColorItems.size(); quickColorMeta.insert (quickColorMeta.begin() + idx, entry); pEntry = &quickColorMeta[idx]; @@ -381,28 +381,28 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= void ConfigDialog::slot_delColor () { - if (qQuickColorList->selectedItems().size() == 0) + if (lw_quickColors->selectedItems().size() == 0) return; - QListWidgetItem* qItem = qQuickColorList->selectedItems ()[0]; - ulong ulIdx = getItemRow (qItem, qaQuickColorItems); + QListWidgetItem* qItem = lw_quickColors->selectedItems ()[0]; + ulong ulIdx = getItemRow (qItem, quickColorItems); quickColorMeta.erase (quickColorMeta.begin () + ulIdx); updateQuickColorList (); } // ============================================================================= void ConfigDialog::slot_moveColor () { - const bool bUp = (static_cast<QPushButton*> (sender()) == qMoveColorUp); + const bool bUp = (static_cast<QPushButton*> (sender()) == pb_moveColorUp); - if (qQuickColorList->selectedItems().size() == 0) + if (lw_quickColors->selectedItems().size() == 0) return; - QListWidgetItem* qItem = qQuickColorList->selectedItems ()[0]; - ulong ulIdx = getItemRow (qItem, qaQuickColorItems); + QListWidgetItem* qItem = lw_quickColors->selectedItems ()[0]; + ulong ulIdx = getItemRow (qItem, quickColorItems); long lDest = bUp ? (ulIdx - 1) : (ulIdx + 1); - if (lDest < 0 || (ulong)lDest >= qaQuickColorItems.size ()) + if (lDest < 0 || (ulong)lDest >= quickColorItems.size ()) return; // destination out of bounds quickColorMetaEntry tmp = quickColorMeta[lDest]; @@ -449,10 +449,10 @@ // ============================================================================= void ConfigDialog::slot_findLDrawPath () { str zDir = QFileDialog::getExistingDirectory (this, "Choose LDraw directory", - qLDrawPath->text()); + le_LDrawPath->text()); if (~zDir) - qLDrawPath->setText (zDir.chars()); + le_LDrawPath->setText (zDir.chars()); } // ============================================================================= @@ -472,11 +472,11 @@ } void ConfigDialog::slot_setGLBackground () { - pickColor (gl_bgcolor, qGLBackgroundButton); + pickColor (gl_bgcolor, pb_viewBg); } void ConfigDialog::slot_setGLForeground () { - pickColor (gl_maincolor, qGLForegroundButton); + pickColor (gl_maincolor, pb_viewFg); } // ============================================================================= @@ -505,15 +505,15 @@ // ============================================================================= QListWidgetItem* ConfigDialog::getSelectedQuickColor () { - if (qQuickColorList->selectedItems().size() == 0) + if (lw_quickColors->selectedItems().size() == 0) return null; - return qQuickColorList->selectedItems ()[0]; + return lw_quickColors->selectedItems ()[0]; } // ============================================================================= void ConfigDialog::slot_setShortcut () { - QList<QListWidgetItem*> qaSel = qShortcutList->selectedItems (); + QList<QListWidgetItem*> qaSel = lw_shortcutList->selectedItems (); if (qaSel.size() < 1) return; @@ -521,7 +521,7 @@ QListWidgetItem* qItem = qaSel[0]; // Find the row this object is on. - long idx = getItemRow (qItem, qaShortcutItems); + long idx = getItemRow (qItem, shortcutItems); if (KeySequenceDialog::staticDialog (g_ActionMeta[idx], this)) setShortcutText (qItem, g_ActionMeta[idx]); @@ -529,10 +529,10 @@ // ============================================================================= void ConfigDialog::slot_resetShortcut () { - QList<QListWidgetItem*> qaSel = qShortcutList->selectedItems (); + QList<QListWidgetItem*> qaSel = lw_shortcutList->selectedItems (); for (QListWidgetItem* qItem : qaSel) { - long idx = getItemRow (qItem, qaShortcutItems); + long idx = getItemRow (qItem, shortcutItems); actionmeta meta = g_ActionMeta[idx]; keyseqconfig* conf = g_ActionMeta[idx].conf; @@ -546,11 +546,11 @@ // ============================================================================= void ConfigDialog::slot_clearShortcut () { - QList<QListWidgetItem*> qaSel = qShortcutList->selectedItems (); + QList<QListWidgetItem*> qaSel = lw_shortcutList->selectedItems (); QKeySequence qDummySeq; for (QListWidgetItem* qItem : qaSel) { - long idx = getItemRow (qItem, qaShortcutItems); + long idx = getItemRow (qItem, shortcutItems); actionmeta meta = g_ActionMeta[idx]; keyseqconfig* conf = g_ActionMeta[idx].conf; @@ -598,15 +598,15 @@ ConfigDialog dlg (g_ForgeWindow); if (dlg.exec ()) { - io_ldpath = dlg.qLDrawPath->text(); + io_ldpath = dlg.le_LDrawPath->text(); - APPLY_CHECKBOX (dlg.qLVColorize, lv_colorize) - APPLY_CHECKBOX (dlg.qGLColorBFC, gl_colorbfc) - APPLY_CHECKBOX (dlg.qGLSelFlash, gl_selflash) + APPLY_CHECKBOX (dlg.cb_colorize, lv_colorize) + APPLY_CHECKBOX (dlg.cb_colorBFC, gl_colorbfc) + APPLY_CHECKBOX (dlg.cb_selFlash, gl_selflash) - gl_maincolor_alpha = ((double)dlg.qGLForegroundAlpha->value ()) / 10.0f; - gl_linethickness = dlg.qGLLineThickness->value (); - gui_toolbar_iconsize = (dlg.qToolBarIconSize->value () * 4) + 12; + gl_maincolor_alpha = ((double)dlg.sl_viewFgAlpha->value ()) / 10.0f; + gl_linethickness = dlg.sl_lineThickness->value (); + gui_toolbar_iconsize = (dlg.sl_iconSize->value () * 4) + 12; // Manage the quick color toolbar g_ForgeWindow->quickColorMeta = dlg.quickColorMeta; @@ -615,7 +615,7 @@ // Set the grid settings for (int i = 0; i < g_NumGrids; ++i) for (int j = 0; j < 4; ++j) - g_GridInfo[i].confs[j]->value = dlg.gridData[i][j]->value (); + g_GridInfo[i].confs[j]->value = dlg.dsb_gridData[i][j]->value (); // Save the config config::save (); @@ -639,7 +639,7 @@ KeySequenceDialog::KeySequenceDialog (QKeySequence seq, QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f), seq (seq) { - qOutput = new QLabel; + lb_output = new QLabel; IMPLEMENT_DIALOG_BUTTONS setWhatsThis ("Into this dialog you can input a key sequence for use as a " @@ -647,8 +647,8 @@ "dismiss."); QVBoxLayout* layout = new QVBoxLayout; - layout->addWidget (qOutput); - layout->addWidget (qButtons); + layout->addWidget (lb_output); + layout->addWidget (bbx_buttons); setLayout (layout); updateOutput (); @@ -676,7 +676,7 @@ str zText = format ("<center><b>%s</b></center>", zShortcut.chars ()); - qOutput->setText (zText); + lb_output->setText (zText); } // =============================================================================
--- a/zz_configDialog.h Wed Apr 24 20:33:06 2013 +0300 +++ b/zz_configDialog.h Wed Apr 24 23:27:36 2013 +0300 @@ -16,6 +16,9 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#ifndef CONFIGDIALOG_H +#define CONFIGDIALOG_H + #include "gui.h" #include <qdialog.h> #include <qlabel.h> @@ -30,42 +33,42 @@ Q_OBJECT public: - QTabWidget* qTabs; - QWidget* qMainTab, *qShortcutsTab, *qQuickColorTab; + QTabWidget* tabs; + QWidget* mainTab, *shortcutsTab, *quickColorTab; // ========================================================================= // Main tab widgets - QLabel* qLDrawPathLabel; - QLabel* qGLBackgroundLabel, *qGLForegroundLabel, *qGLForegroundAlphaLabel; - QLabel* qGLLineThicknessLabel, *qToolBarIconSizeLabel; - QLineEdit* qLDrawPath; - QPushButton* qLDrawPathFindButton; - QPushButton* qGLBackgroundButton, *qGLForegroundButton; - QCheckBox* qLVColorize, *qGLColorBFC, *qGLSelFlash; - QSlider* qGLForegroundAlpha, *qGLLineThickness, *qToolBarIconSize; + QLabel* lb_LDrawPath; + QLabel* lb_viewBg, *lb_viewFg, *lb_viewFgAlpha; + QLabel* lb_lineThickness, *lb_iconSize; + QLineEdit* le_LDrawPath; + QPushButton* pb_findLDrawPath; + QPushButton* pb_viewBg, *pb_viewFg; + QCheckBox* cb_colorize, *cb_colorBFC, *cb_selFlash; + QSlider* sl_viewFgAlpha, *sl_lineThickness, *sl_iconSize; // ========================================================================= // Shortcuts tab - QListWidget* qShortcutList; - QPushButton* qSetShortcut, *qResetShortcut, *qClearShortcut; - std::vector<QListWidgetItem*> qaShortcutItems; + QListWidget* lw_shortcutList; + QPushButton* pb_setShortcut, *pb_resetShortcut, *pb_clearShortcut; + std::vector<QListWidgetItem*> shortcutItems; // ========================================================================= // Quick color toolbar tab - QListWidget* qQuickColorList; - QPushButton* qAddColor, *qDelColor, *qChangeColor, *qAddColorSeparator, - *qMoveColorUp, *qMoveColorDown, *qClearColors; - std::vector<QListWidgetItem*> qaQuickColorItems; + QListWidget* lw_quickColors; + QPushButton* pb_addColor, *pb_delColor, *pb_changeColor, *pb_addColorSeparator, + *pb_moveColorUp, *pb_moveColorDown, *pb_clearColors; + std::vector<QListWidgetItem*> quickColorItems; std::vector<quickColorMetaEntry> quickColorMeta; // ========================================================================= // Grid tab - QLabel* gridLabels[3]; - QLabel* gridIcons[3]; - QDoubleSpinBox* gridData[3][4]; + QLabel* lb_gridLabels[3]; + QLabel* lb_gridIcons[3]; + QDoubleSpinBox* dsb_gridData[3][4]; // ========================================================================= - QDialogButtonBox* qButtons; + QDialogButtonBox* bbx_buttons; ConfigDialog (ForgeWindow* parent); ~ConfigDialog (); @@ -112,8 +115,8 @@ explicit KeySequenceDialog (QKeySequence seq, QWidget* parent = null, Qt::WindowFlags f = 0); static bool staticDialog (actionmeta& meta, QWidget* parent = null); - QLabel* qOutput; - QDialogButtonBox* qButtons; + QLabel* lb_output; + QDialogButtonBox* bbx_buttons; QKeySequence seq; private: @@ -121,4 +124,6 @@ private slots: virtual void keyPressEvent (QKeyEvent* ev); -}; \ No newline at end of file +}; + +#endif // CONFIGDIALOG_H \ No newline at end of file
--- a/zz_historyDialog.cpp Wed Apr 24 20:33:06 2013 +0300 +++ b/zz_historyDialog.cpp Wed Apr 24 23:27:36 2013 +0300 @@ -29,35 +29,35 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= HistoryDialog::HistoryDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) { - qHistoryList = new QListWidget; - qUndoButton = new QPushButton ("Undo"); - qRedoButton = new QPushButton ("Redo"); - qClearButton = new QPushButton ("Clear"); - qButtons = new QDialogButtonBox (QDialogButtonBox::Close); + historyList = new QListWidget; + undoButton = new QPushButton ("Undo"); + redoButton = new QPushButton ("Redo"); + clearButton = new QPushButton ("Clear"); + buttons = new QDialogButtonBox (QDialogButtonBox::Close); - qHistoryList->setAlternatingRowColors (true); + historyList->setAlternatingRowColors (true); - qUndoButton->setIcon (getIcon ("undo")); - qRedoButton->setIcon (getIcon ("redo")); + undoButton->setIcon (getIcon ("undo")); + redoButton->setIcon (getIcon ("redo")); - connect (qUndoButton, SIGNAL (clicked ()), this, SLOT (slot_undo ())); - connect (qRedoButton, SIGNAL (clicked ()), this, SLOT (slot_redo ())); - connect (qClearButton, SIGNAL (clicked ()), this, SLOT (slot_clear ())); - connect (qButtons, SIGNAL (rejected ()), this, SLOT (reject ())); - connect (qHistoryList, SIGNAL (itemSelectionChanged ()), this, SLOT (slot_selChanged ())); + connect (undoButton, SIGNAL (clicked ()), this, SLOT (slot_undo ())); + connect (redoButton, SIGNAL (clicked ()), this, SLOT (slot_redo ())); + connect (clearButton, SIGNAL (clicked ()), this, SLOT (slot_clear ())); + connect (buttons, SIGNAL (rejected ()), this, SLOT (reject ())); + connect (historyList, SIGNAL (itemSelectionChanged ()), this, SLOT (slot_selChanged ())); QVBoxLayout* qButtonLayout = new QVBoxLayout; qButtonLayout->setDirection (QBoxLayout::TopToBottom); - qButtonLayout->addWidget (qUndoButton); - qButtonLayout->addWidget (qRedoButton); - qButtonLayout->addWidget (qClearButton); + qButtonLayout->addWidget (undoButton); + qButtonLayout->addWidget (redoButton); + qButtonLayout->addWidget (clearButton); qButtonLayout->addStretch (); QGridLayout* qLayout = new QGridLayout; qLayout->setColumnStretch (0, 1); - qLayout->addWidget (qHistoryList, 0, 0, 2, 1); + qLayout->addWidget (historyList, 0, 0, 2, 1); qLayout->addLayout (qButtonLayout, 0, 1); - qLayout->addWidget (qButtons, 1, 1); + qLayout->addWidget (buttons, 1, 1); setLayout (qLayout); setWindowIcon (getIcon ("history")); @@ -72,12 +72,12 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= void HistoryDialog::populateList () { - qHistoryList->clear (); + historyList->clear (); QListWidgetItem* qItem = new QListWidgetItem; qItem->setText ("[[ initial state ]]"); qItem->setIcon (getIcon ("empty")); - qHistoryList->addItem (qItem); + historyList->addItem (qItem); for (HistoryEntry* entry : History::entries) { str zText; @@ -211,7 +211,7 @@ QListWidgetItem* qItem = new QListWidgetItem; qItem->setText (zText); qItem->setIcon (qEntryIcon); - qHistoryList->addItem (qItem); + historyList->addItem (qItem); } } @@ -232,7 +232,7 @@ } void HistoryDialog::updateSelection () { - qHistoryList->setCurrentItem (qHistoryList->item (History::pos () + 1)); + historyList->setCurrentItem (historyList->item (History::pos () + 1)); } // ============================================================================= @@ -247,21 +247,21 @@ // ============================================================================= void HistoryDialog::updateButtons () { - qUndoButton->setEnabled (ACTION_NAME (undo)->isEnabled ()); - qRedoButton->setEnabled (ACTION_NAME (redo)->isEnabled ()); + undoButton->setEnabled (ACTION (undo)->isEnabled ()); + redoButton->setEnabled (ACTION (redo)->isEnabled ()); } // ============================================================================= void HistoryDialog::slot_selChanged () { - if (qHistoryList->selectedItems ().size () != 1) + if (historyList->selectedItems ().size () != 1) return; - QListWidgetItem* qItem = qHistoryList->selectedItems ()[0]; + QListWidgetItem* qItem = historyList->selectedItems ()[0]; // Find the index of the edit long lIdx; - for (lIdx = 0; lIdx < qHistoryList->count (); ++lIdx) - if (qHistoryList->item (lIdx) == qItem) + for (lIdx = 0; lIdx < historyList->count (); ++lIdx) + if (historyList->item (lIdx) == qItem) break; // qHistoryList is 0-based, History is -1-based, thus decrement
--- a/zz_historyDialog.h Wed Apr 24 20:33:06 2013 +0300 +++ b/zz_historyDialog.h Wed Apr 24 23:27:36 2013 +0300 @@ -16,8 +16,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef ZZ_HISTORYDIALOG_H -#define ZZ_HISTORYDIALOG_H +#ifndef HISTORYDIALOG_H +#define HISTORYDIALOG_H #include <qdialog.h> #include <qdialogbuttonbox.h> @@ -32,9 +32,9 @@ explicit HistoryDialog (QWidget* parent = null, Qt::WindowFlags f = 0); void populateList (); - QListWidget* qHistoryList; - QPushButton* qUndoButton, *qRedoButton, *qClearButton; - QDialogButtonBox* qButtons; + QListWidget* historyList; + QPushButton* undoButton, *redoButton, *clearButton; + QDialogButtonBox* buttons; private: void updateButtons (); @@ -47,4 +47,4 @@ void slot_selChanged (); }; -#endif // ZZ_HISTORYDIALOG_H \ No newline at end of file +#endif // HISTORYDIALOG_H \ No newline at end of file
--- a/zz_newPartDialog.cpp Wed Apr 24 20:33:06 2013 +0300 +++ b/zz_newPartDialog.cpp Wed Apr 24 23:27:36 2013 +0300 @@ -38,17 +38,17 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= NewPartDialog::NewPartDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) { - qLB_Icon = new QLabel; - qLB_Icon->setPixmap (QPixmap ("icons/brick.png")); + lb_brickIcon = new QLabel; + lb_brickIcon->setPixmap (QPixmap ("icons/brick.png")); - qLB_NameLabel = new QLabel ("Name:"); - qLE_Name = new QLineEdit; - qLE_Name->setMinimumWidth (320); + lb_name = new QLabel ("Name:"); + le_name = new QLineEdit; + le_name->setMinimumWidth (320); - qLB_AuthorLabel = new QLabel ("Author:"); - qLE_Author = new QLineEdit; + lb_author = new QLabel ("Author:"); + le_author = new QLineEdit; - qLB_LicenseLabel = new QLabel ("License:"); + lb_license = new QLabel ("License:"); qCB_LicenseBox = new QComboBox; qCB_LicenseBox->addItems ({ "CCAL Redistributable", @@ -56,7 +56,7 @@ "[none]", }); - qLB_BFCLabel = new QLabel ("BFC:"); + lb_BFC = new QLabel ("BFC:"); qCB_BFCBox = new QComboBox; qCB_BFCBox->addItems ({ "CCW", @@ -67,16 +67,16 @@ IMPLEMENT_DIALOG_BUTTONS QGridLayout* layout = new QGridLayout; - layout->addWidget (qLB_Icon, 0, 0); - layout->addWidget (qLB_NameLabel, 0, 1); - layout->addWidget (qLE_Name, 0, 2); - layout->addWidget (qLB_AuthorLabel, 1, 1); - layout->addWidget (qLE_Author, 1, 2); - layout->addWidget (qLB_LicenseLabel, 2, 1); + layout->addWidget (lb_brickIcon, 0, 0); + layout->addWidget (lb_name, 0, 1); + layout->addWidget (le_name, 0, 2); + layout->addWidget (lb_author, 1, 1); + layout->addWidget (le_author, 1, 2); + layout->addWidget (lb_license, 2, 1); layout->addWidget (qCB_LicenseBox, 2, 2); - layout->addWidget (qLB_BFCLabel, 3, 1); + layout->addWidget (lb_BFC, 3, 1); layout->addWidget (qCB_BFCBox, 3, 2); - layout->addWidget (qButtons, 4, 2); + layout->addWidget (bbx_buttons, 4, 2); setLayout (layout); setWindowIcon (QIcon ("icons/brick.png")); @@ -92,7 +92,7 @@ newFile (); short idx; - str zAuthor = dlg.qLE_Author->text (); + str zAuthor = dlg.le_author->text (); vector<LDObject*>& objs = g_CurrentFile->objects; idx = dlg.qCB_BFCBox->currentIndex (); @@ -107,7 +107,7 @@ (idx == LICENSE_NonCA) ? "Not redistributable : see NonCAreadme.txt" : null; - objs.push_back (new LDComment (dlg.qLE_Name->text ())); + objs.push_back (new LDComment (dlg.le_name->text ())); objs.push_back (new LDComment ("Name: <untitled>.dat")); objs.push_back (new LDComment (format ("Author: %s", zAuthor.chars()))); objs.push_back (new LDComment (format ("!LDRAW_ORG Unofficial_Part")));
--- a/zz_newPartDialog.h Wed Apr 24 20:33:06 2013 +0300 +++ b/zz_newPartDialog.h Wed Apr 24 23:27:36 2013 +0300 @@ -16,8 +16,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef ZZ_NEWPARTDIALOG_H -#define ZZ_NEWPARTDIALOG_H +#ifndef NEWPARTDIALOG_H +#define NEWPARTDIALOG_H #include "gui.h" #include <qdialog.h> @@ -31,10 +31,10 @@ explicit NewPartDialog (QWidget* parent = null, Qt::WindowFlags f = 0); static void StaticDialog (); - QLabel* qLB_Icon, *qLB_NameLabel, *qLB_AuthorLabel, *qLB_LicenseLabel, *qLB_BFCLabel; - QLineEdit* qLE_Name, *qLE_Author; + QLabel* lb_brickIcon, *lb_name, *lb_author, *lb_license, *lb_BFC; + QLineEdit* le_name, *le_author; QComboBox* qCB_LicenseBox, *qCB_BFCBox; - QDialogButtonBox* qButtons; + QDialogButtonBox* bbx_buttons; }; -#endif // ZZ_NEWPARTDIALOG_H \ No newline at end of file +#endif // NEWPARTDIALOG_H \ No newline at end of file
--- a/zz_setContentsDialog.cpp Wed Apr 24 20:33:06 2013 +0300 +++ b/zz_setContentsDialog.cpp Wed Apr 24 23:27:36 2013 +0300 @@ -29,42 +29,42 @@ SetContentsDialog::SetContentsDialog (LDObject* obj, QWidget* parent) : QDialog(parent) { setWindowTitle (APPNAME_DISPLAY ": Set Contents"); - qContentsLabel = new QLabel ("Set contents:", parent); + lb_contents = new QLabel ("Set contents:", parent); - qContents = new QLineEdit (parent); - qContents->setText (obj->getContents ().chars()); - qContents->setWhatsThis ("The LDraw code of this object. The code written " + le_contents = new QLineEdit (parent); + le_contents->setText (obj->getContents ().chars()); + le_contents->setWhatsThis ("The LDraw code of this object. The code written " "here is expected to be valid LDraw code, invalid code here results " "the object being turned into an error object. Please do refer to the " "<a href=\"http://www.ldraw.org/article/218.html\">official file format " "standard</a> for further information."); - qContents->setMinimumWidth (384); + le_contents->setMinimumWidth (384); if (obj->getType() == OBJ_Gibberish) { - qErrorLabel = new QLabel; - qErrorLabel->setText (format ("<span style=\"color: #900\">%s</span>", + lb_error = new QLabel; + lb_error->setText (format ("<span style=\"color: #900\">%s</span>", static_cast<LDGibberish*> (obj)->zReason.chars())); QPixmap qErrorPixmap = QPixmap ("icons/error.png").scaledToHeight (16); - qErrorIcon = new QLabel; - qErrorIcon->setPixmap (qErrorPixmap); + lb_errorIcon = new QLabel; + lb_errorIcon->setPixmap (qErrorPixmap); } IMPLEMENT_DIALOG_BUTTONS QVBoxLayout* layout = new QVBoxLayout; - layout->addWidget (qContentsLabel); - layout->addWidget (qContents); + layout->addWidget (lb_contents); + layout->addWidget (le_contents); QHBoxLayout* layout2 = new QHBoxLayout; if (obj->getType() == OBJ_Gibberish) { - layout2->addWidget (qErrorIcon); - layout2->addWidget (qErrorLabel); + layout2->addWidget (lb_errorIcon); + layout2->addWidget (lb_error); } - layout2->addWidget (qButtons); + layout2->addWidget (bbx_buttons); layout->addLayout (layout2); setLayout (layout); @@ -93,7 +93,7 @@ LDObject* oldobj = obj; // Reinterpret it from the text of the input field - obj = parseLine (dlg.qContents->text ().toStdString ().c_str ()); + obj = parseLine (dlg.le_contents->text ().toStdString ().c_str ()); // Mark down the history now before we perform the replacement (which // destroys the old object)
--- a/zz_setContentsDialog.h Wed Apr 24 20:33:06 2013 +0300 +++ b/zz_setContentsDialog.h Wed Apr 24 23:27:36 2013 +0300 @@ -16,6 +16,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#ifndef SETCONTENTSDIALOG_H + #include <qdialog.h> #include <qlineedit.h> #include <qlabel.h> @@ -31,13 +33,15 @@ // ============================================================================= class SetContentsDialog : public QDialog { public: - QLabel* qContentsLabel, *qErrorIcon, *qErrorLabel; - QLineEdit* qContents; - QDialogButtonBox* qButtons; + QLabel* lb_contents, *lb_errorIcon, *lb_error; + QLineEdit* le_contents; + QDialogButtonBox* bbx_buttons; SetContentsDialog (LDObject* obj, QWidget* parent = null); static void staticDialog (LDObject* obj); private slots: void slot_handleButtons (QAbstractButton* qButton); -}; \ No newline at end of file +}; + +#endif // SETCONTENTSDIALOG_H \ No newline at end of file