From b9dd7637a67b5ee500aeaa3ca58ff1adc68520a0 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 26 Mar 2026 13:59:12 -0400 Subject: [PATCH] Replace 'Change Dimensions' button with tool button --- CHANGELOG.md | 1 + forms/mainwindow.ui | 67 ++++++++++++++++++++++++++----------- include/mainwindow.h | 8 +---- resources/icons/resize.ico | Bin 0 -> 5430 bytes resources/images.qrc | 1 + src/editor.cpp | 2 +- src/mainwindow.cpp | 30 +++++++---------- 7 files changed, 64 insertions(+), 45 deletions(-) create mode 100644 resources/icons/resize.ico diff --git a/CHANGELOG.md b/CHANGELOG.md index 50726a0d..2bb48837 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project somewhat adheres to [Semantic Versioning](https://semver.org/sp ### Changed - Porymap's .cfg files were replaced with .json. Any fields not listed in a config file are assumed to be the default value. - The dimensions of the current metatile selection are now displayed above the metatile selector. +- The 'Change Dimensions' button was replaced with a Resize tool button. Resizing is also now available under the `Edit` menu, and can be assigned a shortcut. - Some UI changes to prioritize horizontal space for the map. ### Fixed diff --git a/forms/mainwindow.ui b/forms/mainwindow.ui index a13aef07..0aa7dccd 100644 --- a/forms/mainwindow.ui +++ b/forms/mainwindow.ui @@ -527,6 +527,20 @@ + + + + <html><head/><body><p>Resize<br/><br/>Opens an interactive window for resizing the current map layout (and the border, if enabled in Project Settings).</p></body></html> + + + ... + + + + :/icons/resize.ico:/icons/resize.ico + + + @@ -563,16 +577,6 @@ - - - - <html><head/><body><p>Change a map layout's width and height.</p></body></html> - - - Change Dimensions - - - @@ -1699,7 +1703,7 @@ 0 0 100 - 16 + 30 @@ -1793,7 +1797,7 @@ 0 0 100 - 16 + 30 @@ -1887,7 +1891,7 @@ 0 0 100 - 16 + 30 @@ -1987,7 +1991,7 @@ 0 0 100 - 16 + 30 @@ -2081,7 +2085,7 @@ 0 0 100 - 16 + 30 @@ -2237,8 +2241,8 @@ 0 0 - 72 - 20 + 100 + 30 @@ -2642,8 +2646,8 @@ 0 0 - 204 - 16 + 100 + 30 @@ -2865,6 +2869,10 @@ Edit + + + + @@ -3262,6 +3270,27 @@ Open Manual + + + Copy + + + Ctrl+C + + + + + Paste + + + Ctrl+V + + + + + Change Map Dimensions... + + diff --git a/include/mainwindow.h b/include/mainwindow.h index 19360006..824683ed 100644 --- a/include/mainwindow.h +++ b/include/mainwindow.h @@ -261,7 +261,6 @@ private slots: void on_pushButton_AddConnection_clicked(); void on_button_OpenDiveMap_clicked(); void on_button_OpenEmergeMap_clicked(); - void on_pushButton_ChangeDimensions_clicked(); void resetMapViewScale(); @@ -344,9 +343,6 @@ private: QPointer wildMonSearch = nullptr; QPointer fileWatcherWarning = nullptr; QPointer resizeLayoutPopup = nullptr; - - QAction *undoAction = nullptr; - QAction *redoAction = nullptr; QPointer undoView = nullptr; struct MapNavigation { @@ -359,9 +355,6 @@ private: UnlockableIcon unlockableMainTabIcon; - QAction *copyAction = nullptr; - QAction *pasteAction = nullptr; - MapHeaderForm *mapHeaderForm = nullptr; QMap lastSelectedEvent; @@ -476,6 +469,7 @@ private: void setSmartPathsEnabled(bool enabled); void setBorderVisibility(bool visible); void setMirrorConnectionsEnabled(bool enabled); + void resizeMapLayout(); }; // These are namespaced in a struct to avoid colliding with e.g. class Map. diff --git a/resources/icons/resize.ico b/resources/icons/resize.ico new file mode 100644 index 0000000000000000000000000000000000000000..4bcb447022c66754677e26141bc3036bd0a438c8 GIT binary patch literal 5430 zcmbtYTWnO<6}@Sq^s7?x5r6YlDwVbg&{iT8LjaX1Qk1Gy(y9nWs3HvsAv_GFgb-|~ zsz#xdS9mlf0ms-78yi1n#xVlh#1F6;Kf(C@!pwUN7?Kdf>RRW{b;f3F2j@y#d(OUR zuXXl0=bp3oSk@!f53DDiu&Ae5e|^lder#FRv}txbllGmo{e(9DWDna;HQqCWFJ_IA zM19Bhc^ZIKn7XLPvttoF+ZV!3DcqWjF<8b=cD+|WyZ_>w^7m|CgxV7+sL5Q1(tS%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vw)v$sr@lmX ztsD7cIN1))-KbNeDW7!m>ZIZwi%mWhX8p>`4>=oVqA&L~43%%>IA#)ud(x~sF)w`> ztK+Cm9mg@4TF$W_;CI3`qEB|pGjTYxiG2?@&Tc{>b05|@&OMlp1<+T;%D%q6xs z#1+fybq*(~=8RUnkFJx;(SQ0i^yRHU@2S6_H)lC>#a+bWIy7)EiQnh7>rv?%@iSg& z$F8x}A2Rb6qHpi1cWCj=dbPhS+(^2dk@<0(;jCgP;&ul zb}wK#zsP7`eI9es*{mbhm^yo;?pEzRnXpFJcQ#nU`hz*AzaeiFwzy*Xuc<@bsq-<| zRe?yydCC`vFkg(cmm%E#1@hmSqjj26{h7bzS#(z%BPQ{T5Stw05+`v@4b1wmz@3^5 z*L(9~@*AUN)Bj=Y7oVrH`JJA}<*Pi~wN1D-rZ|KvPNFicons/porymap-icon-2.ico icons/porymap.icns icons/refresh.ico + icons/resize.ico icons/shift_cursor.ico icons/shift.ico icons/swap_cursor.ico diff --git a/src/editor.cpp b/src/editor.cpp index 451171c8..9f74bab5 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -175,7 +175,7 @@ void Editor::setEditMode(EditMode editMode) { this->editGroup.setActiveStack(editStack); this->ui->toolButton_Fill->setEnabled(editingLayout); this->ui->toolButton_Dropper->setEnabled(editingLayout); - this->ui->pushButton_ChangeDimensions->setEnabled(editingLayout); + this->ui->toolButton_Resize->setEnabled(editingLayout); this->ui->checkBox_smartPaths->setEnabled(editingLayout); if (this->editMode != oldEditMode) { diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7d4de337..09fa0b1b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -268,17 +268,6 @@ void MainWindow::initExtraShortcuts() { auto *shortcut_Open_Scripts = new Shortcut(QKeySequence(), ui->toolButton_Open_Scripts, SLOT(click())); shortcut_Open_Scripts->setObjectName("shortcut_Open_Scripts"); shortcut_Open_Scripts->setWhatsThis("Open Map Scripts"); - - copyAction = new QAction("Copy", this); - copyAction->setShortcut(QKeySequence("Ctrl+C")); - connect(copyAction, &QAction::triggered, this, &MainWindow::copy); - ui->menuEdit->addSeparator(); - ui->menuEdit->addAction(copyAction); - - pasteAction = new QAction("Paste", this); - pasteAction->setShortcut(QKeySequence("Ctrl+V")); - connect(pasteAction, &QAction::triggered, this, &MainWindow::paste); - ui->menuEdit->addAction(pasteAction); } QObjectList MainWindow::shortcutableObjects() const { @@ -399,6 +388,10 @@ void MainWindow::initExtraSignals() { if (this->editor->layout) openDuplicateLayoutDialog(this->editor->layout->id); }); connect(ui->actionProject_Settings, &QAction::triggered, this, &MainWindow::openProjectSettingsEditor); + connect(ui->actionCopy, &QAction::triggered, this, &MainWindow::copy); + connect(ui->actionPaste, &QAction::triggered, this, &MainWindow::paste); + connect(ui->actionChange_Map_Dimensions, &QAction::triggered, this, &MainWindow::resizeMapLayout); + connect(ui->toolButton_Resize, &QToolButton::clicked, this, &MainWindow::resizeMapLayout); } void MainWindow::on_actionCheck_for_Updates_triggered() { @@ -449,17 +442,14 @@ void MainWindow::initEditor() { loadUserSettings(); - undoAction = editor->editGroup.createUndoAction(this, tr("&Undo")); + QAction *undoAction = editor->editGroup.createUndoAction(this, tr("&Undo")); undoAction->setObjectName("action_Undo"); undoAction->setShortcut(QKeySequence("Ctrl+Z")); - redoAction = editor->editGroup.createRedoAction(this, tr("&Redo")); + QAction *redoAction = editor->editGroup.createRedoAction(this, tr("&Redo")); redoAction->setObjectName("action_Redo"); redoAction->setShortcuts({QKeySequence("Ctrl+Y"), QKeySequence("Ctrl+Shift+Z")}); - ui->menuEdit->addAction(undoAction); - ui->menuEdit->addAction(redoAction); - this->undoView = new QUndoView(&editor->editGroup); this->undoView->setWindowTitle(tr("Edit History")); this->undoView->setAttribute(Qt::WA_QuitOnClose, false); @@ -470,7 +460,11 @@ void MainWindow::initEditor() { showHistory->setShortcut(QKeySequence("Ctrl+E")); connect(showHistory, &QAction::triggered, this, &MainWindow::openEditHistory); - ui->menuEdit->addAction(showHistory); + QAction* insertionPoint = ui->actionCopy; + ui->menuEdit->insertAction(insertionPoint, undoAction); + ui->menuEdit->insertAction(insertionPoint, redoAction); + ui->menuEdit->insertAction(insertionPoint, showHistory); + ui->menuEdit->insertSeparator(insertionPoint); // Toggle an asterisk in the window title when the undo state is changed connect(&editor->editGroup, &QUndoGroup::indexChanged, this, &MainWindow::updateWindowTitle); @@ -2906,7 +2900,7 @@ void MainWindow::setSecondaryTileset(const QString &tilesetLabel) { ui->comboBox_SecondaryTileset->setTextItem(this->editor->layout->tileset_secondary_label); } -void MainWindow::on_pushButton_ChangeDimensions_clicked() { +void MainWindow::resizeMapLayout() { if (this->resizeLayoutPopup || !this->editor->layout || !this->editor->project) return; this->resizeLayoutPopup = new ResizeLayoutPopup(this->ui->graphicsView_Map, this->editor->layout, this->editor->project);