diff --git a/forms/mainwindow.ui b/forms/mainwindow.ui index b35225a6..1aa69cdd 100644 --- a/forms/mainwindow.ui +++ b/forms/mainwindow.ui @@ -561,8 +561,8 @@ 0 0 - 469 - 608 + 545 + 587 @@ -876,8 +876,8 @@ 0 0 - 324 - 77 + 256 + 74 @@ -957,6 +957,84 @@ + + + + Border + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 16777215 + 48 + + + + <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> + + + QFrame::StyledPanel + + + QFrame::Sunken + + + Qt::ScrollBarAsNeeded + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + @@ -986,10 +1064,10 @@ - 0 + 8 0 - 307 - 387 + 221 + 328 @@ -1082,82 +1160,20 @@ - - - - Border + + + + 10 + + + 100 + + + 30 + + + Qt::Horizontal - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 16777215 - 48 - - - - <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> - - - QFrame::StyledPanel - - - QFrame::Sunken - - - Qt::ScrollBarAsNeeded - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - @@ -1328,8 +1344,8 @@ 0 0 - 381 - 657 + 371 + 643 @@ -1602,7 +1618,7 @@ 0 0 430 - 568 + 534 @@ -2154,7 +2170,7 @@ Custom fields will be added to the map.json file for the current map. - true + false false @@ -2515,8 +2531,8 @@ 0 0 - 826 - 557 + 818 + 539 @@ -2688,7 +2704,7 @@ 0 0 1117 - 21 + 22 diff --git a/include/mainwindow.h b/include/mainwindow.h index 06ab1999..bb7d98c1 100644 --- a/include/mainwindow.h +++ b/include/mainwindow.h @@ -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; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d24b298f..7228b5d9 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -26,6 +26,7 @@ #include #include #include +#include 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(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(),