Replace 'Change Dimensions' button with tool button

This commit is contained in:
GriffinR 2026-03-26 13:59:12 -04:00
parent 8e672b4f58
commit b9dd7637a6
7 changed files with 64 additions and 45 deletions

View File

@ -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

View File

@ -527,6 +527,20 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_Resize">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Resize&lt;br/&gt;&lt;br/&gt;Opens an interactive window for resizing the current map layout (and the border, if enabled in Project Settings).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../resources/images.qrc">
<normaloff>:/icons/resize.ico</normaloff>:/icons/resize.ico</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -563,16 +577,6 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_ChangeDimensions">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Change a map layout's width and height.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Change Dimensions</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer1">
<property name="orientation">
@ -1699,7 +1703,7 @@
<x>0</x>
<y>0</y>
<width>100</width>
<height>16</height>
<height>30</height>
</rect>
</property>
<property name="sizePolicy">
@ -1793,7 +1797,7 @@
<x>0</x>
<y>0</y>
<width>100</width>
<height>16</height>
<height>30</height>
</rect>
</property>
<property name="sizePolicy">
@ -1887,7 +1891,7 @@
<x>0</x>
<y>0</y>
<width>100</width>
<height>16</height>
<height>30</height>
</rect>
</property>
<property name="sizePolicy">
@ -1987,7 +1991,7 @@
<x>0</x>
<y>0</y>
<width>100</width>
<height>16</height>
<height>30</height>
</rect>
</property>
<property name="sizePolicy">
@ -2081,7 +2085,7 @@
<x>0</x>
<y>0</y>
<width>100</width>
<height>16</height>
<height>30</height>
</rect>
</property>
<property name="sizePolicy">
@ -2237,8 +2241,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>72</width>
<height>20</height>
<width>100</width>
<height>30</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_21">
@ -2642,8 +2646,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>204</width>
<height>16</height>
<width>100</width>
<height>30</height>
</rect>
</property>
<layout class="QVBoxLayout" name="layout_ConnectionsList">
@ -2865,6 +2869,10 @@
<property name="title">
<string>Edit</string>
</property>
<addaction name="actionCopy"/>
<addaction name="actionPaste"/>
<addaction name="separator"/>
<addaction name="actionChange_Map_Dimensions"/>
</widget>
<widget class="QMenu" name="menuView">
<property name="title">
@ -3262,6 +3270,27 @@
<string>Open Manual</string>
</property>
</action>
<action name="actionCopy">
<property name="text">
<string>Copy</string>
</property>
<property name="shortcut">
<string>Ctrl+C</string>
</property>
</action>
<action name="actionPaste">
<property name="text">
<string>Paste</string>
</property>
<property name="shortcut">
<string>Ctrl+V</string>
</property>
</action>
<action name="actionChange_Map_Dimensions">
<property name="text">
<string>Change Map Dimensions...</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>

View File

@ -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> wildMonSearch = nullptr;
QPointer<QuestionMessage> fileWatcherWarning = nullptr;
QPointer<ResizeLayoutPopup> resizeLayoutPopup = nullptr;
QAction *undoAction = nullptr;
QAction *redoAction = nullptr;
QPointer<QUndoView> undoView = nullptr;
struct MapNavigation {
@ -359,9 +355,6 @@ private:
UnlockableIcon unlockableMainTabIcon;
QAction *copyAction = nullptr;
QAction *pasteAction = nullptr;
MapHeaderForm *mapHeaderForm = nullptr;
QMap<Event::Group, Event*> 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.

BIN
resources/icons/resize.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -42,6 +42,7 @@
<file>icons/porymap-icon-2.ico</file>
<file>icons/porymap.icns</file>
<file>icons/refresh.ico</file>
<file>icons/resize.ico</file>
<file>icons/shift_cursor.ico</file>
<file>icons/shift.ico</file>
<file>icons/swap_cursor.ico</file>

View File

@ -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) {

View File

@ -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);