Fri, 03 May 2013 17:30:44 +0300
Added new BFC dialog
gui.cpp | file | annotate | diff | comparison | revisions | |
gui_actions.cpp | file | annotate | diff | comparison | revisions | |
zz_addObjectDialog.cpp | file | annotate | diff | comparison | revisions | |
zz_addObjectDialog.h | file | annotate | diff | comparison | revisions |
--- a/gui.cpp Fri May 03 17:02:25 2013 +0300 +++ b/gui.cpp Fri May 03 17:30:44 2013 +0300 @@ -57,8 +57,9 @@ EXTERN_ACTION (newCondLine) EXTERN_ACTION (newTriangle) EXTERN_ACTION (newQuad) +EXTERN_ACTION (newComment) +EXTERN_ACTION (newBFC) EXTERN_ACTION (newVertex) -EXTERN_ACTION (newComment) EXTERN_ACTION (newRadial) EXTERN_ACTION (help) EXTERN_ACTION (about) @@ -222,6 +223,7 @@ qInsertMenu->addAction (ACTION (newQuad)); // New Quad qInsertMenu->addAction (ACTION (newCondLine)); // New Conditional Line qInsertMenu->addAction (ACTION (newComment)); // New Comment + qInsertMenu->addAction (ACTION (newBFC)); // New BFC Statment qInsertMenu->addAction (ACTION (newVertex)); // New Vertex qInsertMenu->addAction (ACTION (newRadial)); // New Radial @@ -336,6 +338,7 @@ g_CurrentToolBar->addAction (ACTION (newQuad)); g_CurrentToolBar->addAction (ACTION (newCondLine)); g_CurrentToolBar->addAction (ACTION (newComment)); + g_CurrentToolBar->addAction (ACTION (newBFC)); g_CurrentToolBar->addAction (ACTION (newVertex)); g_CurrentToolBar->addAction (ACTION (newRadial));
--- a/gui_actions.cpp Fri May 03 17:02:25 2013 +0300 +++ b/gui_actions.cpp Fri May 03 17:30:44 2013 +0300 @@ -142,6 +142,10 @@ AddObjectDialog::staticDialog (OBJ_Comment, null); } +MAKE_ACTION (newBFC, "New BFC Statement", "add-bfc", "Creates a new BFC statement.", 0) { + AddObjectDialog::staticDialog (OBJ_BFC, null); +} + MAKE_ACTION (newVertex, "New Vertex", "add-vertex", "Creates a new vertex.", 0) { AddObjectDialog::staticDialog (OBJ_Vertex, null); }
--- a/zz_addObjectDialog.cpp Fri May 03 17:02:25 2013 +0300 +++ b/zz_addObjectDialog.cpp Fri May 03 17:30:44 2013 +0300 @@ -77,6 +77,18 @@ case OBJ_Vertex: coordCount = 3; + break; + + case OBJ_BFC: + bb_bfcType = new ButtonBox<QRadioButton> ("Statement", {}, 0, Qt::Horizontal); + + for (int i = 0; i < LDBFC::NumStatements; ++i) { + if (i % (LDBFC::NumStatements / 2) == 0) + bb_bfcType->rowBreak (); + + bb_bfcType->addButton (new QRadioButton (LDBFC::saStatements[i])); + } + break; case OBJ_Subfile: coordCount = 3; @@ -203,6 +215,10 @@ layout->addWidget (le_comment, 0, 1); break; + case OBJ_BFC: + layout->addWidget (bb_bfcType, 0, 1); + break; + case OBJ_Radial: layout->addWidget (bb_radType, 1, 1, 3, 1); layout->addWidget (cb_radHiRes, 1, 2); @@ -243,7 +259,7 @@ layout->addWidget (bbx_buttons, 5, 0, 1, 4); setLayout (layout); - setWindowTitle (format (APPNAME_DISPLAY " - new %s", + setWindowTitle (format (APPNAME_DISPLAY ": New %s", g_saObjTypeNames[type]).chars()); setWindowIcon (QIcon (iconName.chars ())); @@ -253,11 +269,11 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -void AddObjectDialog::setButtonBackground (QPushButton* qButton, short dColor) { - qButton->setIcon (QIcon ("icons/palette.png")); - qButton->setAutoFillBackground (true); - qButton->setStyleSheet ( - format ("background-color: %s", getColor (dColor)->zColorString.chars()).chars() +void AddObjectDialog::setButtonBackground (QPushButton* button, short color) { + button->setIcon (QIcon ("icons/palette.png")); + button->setAutoFillBackground (true); + button->setStyleSheet ( + format ("background-color: %s", getColor (color)->zColorString.chars()).chars() ); } @@ -299,6 +315,9 @@ le_subfileName->setText (name); } +// ============================================================================= +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +// ============================================================================= template<class T> T* initObj (LDObject*& obj) { if (obj == null) obj = new T; @@ -358,6 +377,13 @@ } break; + case OBJ_BFC: + { + LDBFC* bfc = initObj<LDBFC> (obj); + bfc->eStatement = (LDBFC::Type) dlg.bb_bfcType->value (); + } + break; + case OBJ_Vertex: { LDVertex* vert = initObj<LDVertex> (obj);
--- a/zz_addObjectDialog.h Fri May 03 17:02:25 2013 +0300 +++ b/zz_addObjectDialog.h Fri May 03 17:30:44 2013 +0300 @@ -48,6 +48,9 @@ // Color selection dialog button QPushButton* pb_color; + // BFC-related widgets + ButtonBox<QRadioButton>* bb_bfcType; + // Subfile stuff QTreeWidget* tw_subfileList; QLineEdit* le_subfileName; @@ -62,14 +65,14 @@ QDialogButtonBox* bbx_buttons; private: - void setButtonBackground (QPushButton* qButton, short dColor); + void setButtonBackground (QPushButton* button, short color); char* currentSubfileName (); short dColor; private slots: void slot_colorButtonClicked (); - void slot_radialTypeChanged (int dType); + void slot_radialTypeChanged (int type); void slot_subfileTypeChanged (); };