diff options
Diffstat (limited to '')
-rw-r--r-- | lspaneeditor.cpp | 210 |
1 files changed, 203 insertions, 7 deletions
diff --git a/lspaneeditor.cpp b/lspaneeditor.cpp index 2da39f5..659fd1e 100644 --- a/lspaneeditor.cpp +++ b/lspaneeditor.cpp @@ -1,6 +1,11 @@ #include "lspaneeditor.h" #include <QGroupBox> +#include "lyt/bounding.h" +#include "lyt/picture.h" +#include "lyt/textbox.h" +#include "lyt/window.h" + LSPaneEditor::LSPaneEditor(QWidget *parent) : QWidget(parent) { @@ -20,6 +25,7 @@ LSPaneEditor::LSPaneEditor(QWidget *parent) : m_removeButton->setText("Remove This Pane"); m_tabs = new QTabWidget(this); + m_tabs->setVisible(false); QGridLayout *layout = new QGridLayout(this); @@ -32,6 +38,9 @@ LSPaneEditor::LSPaneEditor(QWidget *parent) : createPaneTab(); + + m_currentlyLoadingPane = false; + m_pane = 0; } void LSPaneEditor::createPaneTab() { @@ -47,14 +56,18 @@ void LSPaneEditor::createPaneTab() { m_nameEntry = new QLineEdit(propBox); m_nameEntry->setMaxLength(16); + connect(m_nameEntry, SIGNAL(textChanged(QString)), SLOT(handleNameChanged(QString))); m_userDataEntry = new QLineEdit(propBox); m_userDataEntry->setMaxLength(8); + connect(m_userDataEntry, SIGNAL(textChanged(QString)), SLOT(handleUserDataChanged(QString))); m_alpha = new QSpinBox(propBox); m_alpha->setRange(0, 255); + connect(m_alpha, SIGNAL(valueChanged(int)), SLOT(handleAlphaChanged(int))); m_influencedAlpha = new QCheckBox("Influenced Alpha", propBox); + connect(m_influencedAlpha, SIGNAL(toggled(bool)), SLOT(handleInfluencedAlphaChanged(bool))); // Column 0 gLayout->addWidget(new QLabel("Name:", propBox), 0, 0, 1, 1); @@ -74,31 +87,37 @@ void LSPaneEditor::createPaneTab() { m_width = new QDoubleSpinBox(geoBox); m_width->setRange(0.0, 100000.0); + connect(m_width, SIGNAL(valueChanged(double)), SLOT(handleWidthChanged(double))); m_height = new QDoubleSpinBox(geoBox); m_height->setRange(0.0, 100000.0); + connect(m_height, SIGNAL(valueChanged(double)), SLOT(handleHeightChanged(double))); m_horzOrigin = new QComboBox(geoBox); m_horzOrigin->addItem("Left"); m_horzOrigin->addItem("Center"); m_horzOrigin->addItem("Right"); + connect(m_horzOrigin, SIGNAL(currentIndexChanged(int)), SLOT(handleHorzOriginChanged(int))); m_vertOrigin = new QComboBox(geoBox); m_vertOrigin->addItem("Top"); m_vertOrigin->addItem("Center"); m_vertOrigin->addItem("Bottom"); + connect(m_vertOrigin, SIGNAL(currentIndexChanged(int)), SLOT(handleVertOriginChanged(int))); m_widescreen = new QCheckBox("Widescreen", this); + connect(m_widescreen, SIGNAL(toggled(bool)), SLOT(handleWidescreenChanged(bool))); m_visible = new QCheckBox("Visible", this); + connect(m_visible, SIGNAL(toggled(bool)), SLOT(handleVisibleChanged(bool))); - // Row 0 + // Column 0 gLayout->addWidget(new QLabel("Width:", geoBox), 0, 0, 1, 1); gLayout->addWidget(m_width, 0, 1, 1, 1); - gLayout->addWidget(new QLabel("Height:", geoBox), 0, 2, 1, 1); - gLayout->addWidget(m_height, 0, 3, 1, 1); + gLayout->addWidget(new QLabel("Height:", geoBox), 1, 0, 1, 1); + gLayout->addWidget(m_height, 1, 1, 1, 1); - // Row 1 - gLayout->addWidget(new QLabel("Horizontal Origin:", geoBox), 1, 0, 1, 1); - gLayout->addWidget(m_horzOrigin, 1, 1, 1, 1); + // Column 1 + gLayout->addWidget(new QLabel("Horizontal Origin:", geoBox), 0, 2, 1, 1); + gLayout->addWidget(m_horzOrigin, 0, 3, 1, 1); gLayout->addWidget(new QLabel("Vertical Origin:", geoBox), 1, 2, 1, 1); gLayout->addWidget(m_vertOrigin, 1, 3, 1, 1); @@ -120,6 +139,15 @@ void LSPaneEditor::createPaneTab() { m_scaleX = new QDoubleSpinBox(posBox); m_scaleY = new QDoubleSpinBox(posBox); + connect(m_transX, SIGNAL(valueChanged(double)), SLOT(handleTransXChanged(double))); + connect(m_transY, SIGNAL(valueChanged(double)), SLOT(handleTransYChanged(double))); + connect(m_transZ, SIGNAL(valueChanged(double)), SLOT(handleTransZChanged(double))); + connect(m_rotX, SIGNAL(valueChanged(double)), SLOT(handleRotXChanged(double))); + connect(m_rotY, SIGNAL(valueChanged(double)), SLOT(handleRotYChanged(double))); + connect(m_rotZ, SIGNAL(valueChanged(double)), SLOT(handleRotZChanged(double))); + connect(m_scaleX, SIGNAL(valueChanged(double)), SLOT(handleScaleXChanged(double))); + connect(m_scaleY, SIGNAL(valueChanged(double)), SLOT(handleScaleYChanged(double))); + gLayout->addWidget(new QLabel("Translation:", posBox), 0, 0, 1, 1); gLayout->addWidget(m_transX, 0, 1, 1, 1); gLayout->addWidget(m_transY, 0, 2, 1, 1); @@ -130,7 +158,7 @@ void LSPaneEditor::createPaneTab() { gLayout->addWidget(m_rotZ, 1, 3, 1, 1); gLayout->addWidget(new QLabel("Scale:", posBox), 2, 0, 1, 1); gLayout->addWidget(m_scaleX, 2, 1, 1, 1); - gLayout->addWidget(m_scaleY, 2, 1, 1, 1); + gLayout->addWidget(m_scaleY, 2, 2, 1, 1); // put it all together into one @@ -141,3 +169,171 @@ void LSPaneEditor::createPaneTab() { layout->addWidget(posBox); layout->addStretch(1); } + + +void LSPaneEditor::setPane(LYTPane *pane) { + m_currentlyLoadingPane = true; + m_pane = pane; + + m_tabs->setVisible(true); + + + m_nameEntry->setText(pane->name); + m_userDataEntry->setText(pane->userdata); + + m_alpha->setValue(pane->alpha); + m_influencedAlpha->setChecked(pane->influencedAlpha); + + + m_width->setValue(pane->width); + m_height->setValue(pane->height); + + m_horzOrigin->setCurrentIndex((int)pane->horzOrigin); + m_vertOrigin->setCurrentIndex((int)pane->vertOrigin); + + m_widescreen->setChecked(pane->isWidescreen); + m_visible->setChecked(pane->visible); + + + m_transX->setValue(pane->xTrans); + m_transY->setValue(pane->yTrans); + m_transZ->setValue(pane->zTrans); + + m_rotX->setValue(pane->xRot); + m_rotY->setValue(pane->yRot); + m_rotZ->setValue(pane->zRot); + + m_scaleX->setValue(pane->xScale); + m_scaleY->setValue(pane->yScale); + + + m_currentlyLoadingPane = false; +} + + +void LSPaneEditor::handleNameChanged(QString value) { + if (!m_currentlyLoadingPane) { + m_pane->name = value; + emit mustRedrawLayout(); + } +} + +void LSPaneEditor::handleUserDataChanged(QString value) { + if (!m_currentlyLoadingPane) { + m_pane->userdata = value; + emit mustRedrawLayout(); + } +} + +void LSPaneEditor::handleAlphaChanged(int value) { + if (!m_currentlyLoadingPane) { + m_pane->alpha = (quint8)value; + emit mustRedrawLayout(); + } +} + +void LSPaneEditor::handleInfluencedAlphaChanged(bool value) { + if (!m_currentlyLoadingPane) { + m_pane->influencedAlpha = value; + emit mustRedrawLayout(); + } +} + +void LSPaneEditor::handleWidthChanged(double value) { + if (!m_currentlyLoadingPane) { + m_pane->width = value; + emit mustRedrawLayout(); + } +} + +void LSPaneEditor::handleHeightChanged(double value) { + if (!m_currentlyLoadingPane) { + m_pane->width = value; + emit mustRedrawLayout(); + } +} + +void LSPaneEditor::handleHorzOriginChanged(int value) { + if (!m_currentlyLoadingPane) { + m_pane->horzOrigin = (LYTPane::OriginType)value; + emit mustRedrawLayout(); + } +} + +void LSPaneEditor::handleVertOriginChanged(int value) { + if (!m_currentlyLoadingPane) { + m_pane->vertOrigin = (LYTPane::OriginType)value; + emit mustRedrawLayout(); + } +} + +void LSPaneEditor::handleWidescreenChanged(bool value) { + if (!m_currentlyLoadingPane) { + m_pane->isWidescreen = value; + emit mustRedrawLayout(); + } +} + +void LSPaneEditor::handleVisibleChanged(bool value) { + if (!m_currentlyLoadingPane) { + m_pane->visible = value; + emit mustRedrawLayout(); + } +} + +void LSPaneEditor::handleTransXChanged(double value) { + if (!m_currentlyLoadingPane) { + m_pane->xTrans = value; + emit mustRedrawLayout(); + } +} + +void LSPaneEditor::handleTransYChanged(double value) { + if (!m_currentlyLoadingPane) { + m_pane->yTrans = value; + emit mustRedrawLayout(); + } +} + +void LSPaneEditor::handleTransZChanged(double value) { + if (!m_currentlyLoadingPane) { + m_pane->zTrans = value; + emit mustRedrawLayout(); + } +} + +void LSPaneEditor::handleRotXChanged(double value) { + if (!m_currentlyLoadingPane) { + m_pane->xRot = value; + emit mustRedrawLayout(); + } +} + +void LSPaneEditor::handleRotYChanged(double value) { + if (!m_currentlyLoadingPane) { + m_pane->yRot = value; + emit mustRedrawLayout(); + } +} + +void LSPaneEditor::handleRotZChanged(double value) { + if (!m_currentlyLoadingPane) { + m_pane->zRot = value; + emit mustRedrawLayout(); + } +} + +void LSPaneEditor::handleScaleXChanged(double value) { + if (!m_currentlyLoadingPane) { + m_pane->xScale = value; + emit mustRedrawLayout(); + } +} + +void LSPaneEditor::handleScaleYChanged(double value) { + if (!m_currentlyLoadingPane) { + m_pane->yScale = value; + emit mustRedrawLayout(); + } +} + |