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
+
+
+
+
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 00000000..4bcb4470
Binary files /dev/null and b/resources/icons/resize.ico differ
diff --git a/resources/images.qrc b/resources/images.qrc
index 55be0e4f..79ffa5f4 100644
--- a/resources/images.qrc
+++ b/resources/images.qrc
@@ -42,6 +42,7 @@
icons/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);