add slider to scale metatiles view
This commit is contained in:
parent
4dedf73f76
commit
f587e03a49
3 changed files with 123 additions and 89 deletions
|
@ -561,8 +561,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>469</width>
|
||||
<height>608</height>
|
||||
<width>545</width>
|
||||
<height>587</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
|
@ -876,8 +876,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>324</width>
|
||||
<height>77</height>
|
||||
<width>256</width>
|
||||
<height>74</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
|
@ -957,6 +957,84 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Border</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_16">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QGraphicsView" name="graphicsView_BorderMetatile">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>48</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>The border is a 2x2 metatile which is repeated outside of the map layout's boundary. Draw on this border area to modify it.</p></body></html></string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer_12">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QScrollArea" name="scrollArea_2">
|
||||
<property name="sizePolicy">
|
||||
|
@ -986,10 +1064,10 @@
|
|||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<x>8</x>
|
||||
<y>0</y>
|
||||
<width>307</width>
|
||||
<height>387</height>
|
||||
<width>221</width>
|
||||
<height>328</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -1082,82 +1160,20 @@
|
|||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Border</string>
|
||||
<item row="4" column="0">
|
||||
<widget class="QSlider" name="horizontalSlider_MetatileZoom">
|
||||
<property name="minimum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_16">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QGraphicsView" name="graphicsView_BorderMetatile">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>48</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>The border is a 2x2 metatile which is repeated outside of the map layout's boundary. Draw on this border area to modify it.</p></body></html></string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer_12">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -1328,8 +1344,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>381</width>
|
||||
<height>657</height>
|
||||
<width>371</width>
|
||||
<height>643</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
|
@ -1602,7 +1618,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>430</width>
|
||||
<height>568</height>
|
||||
<height>534</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -2154,7 +2170,7 @@
|
|||
<string>Custom fields will be added to the map.json file for the current map.</string>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderCascadingSectionResizes">
|
||||
<bool>false</bool>
|
||||
|
@ -2515,8 +2531,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>826</width>
|
||||
<height>557</height>
|
||||
<width>818</width>
|
||||
<height>539</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_14">
|
||||
|
@ -2688,7 +2704,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1117</width>
|
||||
<height>21</height>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
|
|
@ -158,6 +158,7 @@ private slots:
|
|||
void on_pushButton_AddCustomHeaderField_clicked();
|
||||
void on_pushButton_DeleteCustomHeaderField_clicked();
|
||||
void on_tableWidget_CustomHeaderFields_cellChanged(int row, int column);
|
||||
void on_horizontalSlider_MetatileZoom_valueChanged(int value);
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <QProcess>
|
||||
#include <QSysInfo>
|
||||
#include <QDesktopServices>
|
||||
#include <QMatrix>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
|
@ -1797,11 +1798,13 @@ void MainWindow::on_comboBox_EmergeMap_currentTextChanged(const QString &mapName
|
|||
void MainWindow::on_comboBox_PrimaryTileset_activated(const QString &tilesetLabel)
|
||||
{
|
||||
editor->updatePrimaryTileset(tilesetLabel);
|
||||
on_horizontalSlider_MetatileZoom_valueChanged(ui->horizontalSlider_MetatileZoom->value());
|
||||
}
|
||||
|
||||
void MainWindow::on_comboBox_SecondaryTileset_activated(const QString &tilesetLabel)
|
||||
{
|
||||
editor->updateSecondaryTileset(tilesetLabel);
|
||||
on_horizontalSlider_MetatileZoom_valueChanged(ui->horizontalSlider_MetatileZoom->value());
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_clicked()
|
||||
|
@ -1956,6 +1959,20 @@ void MainWindow::on_tableWidget_CustomHeaderFields_cellChanged(int row, int colu
|
|||
this->editor->updateCustomMapHeaderValues(this->ui->tableWidget_CustomHeaderFields);
|
||||
}
|
||||
|
||||
void MainWindow::on_horizontalSlider_MetatileZoom_valueChanged(int value) {
|
||||
double scale = pow(3.0, static_cast<double>(value - 30) / 30.0);
|
||||
|
||||
QMatrix matrix;
|
||||
matrix.scale(scale, scale);
|
||||
QSize size(editor->metatile_selector_item->pixmap().width(),
|
||||
editor->metatile_selector_item->pixmap().height());
|
||||
size *= scale;
|
||||
|
||||
ui->graphicsView_Metatiles->setResizeAnchor(QGraphicsView::NoAnchor);
|
||||
ui->graphicsView_Metatiles->setMatrix(matrix);
|
||||
ui->graphicsView_Metatiles->setFixedSize(size.width() + 2, size.height() + 2);
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event) {
|
||||
porymapConfig.setGeometry(
|
||||
this->saveGeometry(),
|
||||
|
|
Loading…
Reference in a new issue