Rename 'Reset' actions to 'Clear', and add 'Clear Background Map' to edit history

This commit is contained in:
Marcus Huderle 2019-03-17 11:37:13 -05:00
parent 5b6f658e29
commit 8af714a681
5 changed files with 34 additions and 41 deletions

View file

@ -61,8 +61,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>350</width>
<height>225</height>
<width>384</width>
<height>249</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_18">
@ -182,8 +182,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>350</width>
<height>225</height>
<width>384</width>
<height>249</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_19">
@ -330,10 +330,10 @@
</property>
<property name="geometry">
<rect>
<x>8</x>
<x>0</x>
<y>0</y>
<width>278</width>
<height>262</height>
<width>283</width>
<height>275</height>
</rect>
</property>
<property name="sizePolicy">
@ -651,8 +651,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>441</width>
<height>230</height>
<width>412</width>
<height>249</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_20">
@ -785,10 +785,10 @@
</property>
<property name="geometry">
<rect>
<x>8</x>
<x>0</x>
<y>0</y>
<width>255</width>
<height>274</height>
<width>295</width>
<height>283</height>
</rect>
</property>
<property name="sizePolicy">
@ -1076,7 +1076,7 @@
<x>0</x>
<y>0</y>
<width>829</width>
<height>22</height>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@ -1094,8 +1094,8 @@
<addaction name="action_RegionMap_Resize"/>
<addaction name="separator"/>
<addaction name="action_Swap"/>
<addaction name="action_RegionMap_ResetImage"/>
<addaction name="action_RegionMap_ResetLayout"/>
<addaction name="action_RegionMap_ClearImage"/>
<addaction name="action_RegionMap_ClearLayout"/>
</widget>
<widget class="QMenu" name="menuTools">
<property name="title">
@ -1150,14 +1150,14 @@
<string>Swap...</string>
</property>
</action>
<action name="action_RegionMap_ResetImage">
<action name="action_RegionMap_ClearImage">
<property name="text">
<string>Reset Image</string>
<string>Clear Background Image</string>
</property>
</action>
<action name="action_RegionMap_ResetLayout">
<action name="action_RegionMap_ClearLayout">
<property name="text">
<string>Reset Layout</string>
<string>Clear Map Layout</string>
</property>
</action>
</widget>

View file

@ -70,8 +70,8 @@ public:
void resize(int width, int height);
void resetSquare(int index);
void resetLayout();
void resetImage();
void clearLayout();
void clearImage();
void replaceSectionId(unsigned oldId, unsigned newId);
int width();

View file

@ -92,8 +92,8 @@ private slots:
void on_action_RegionMap_Undo_triggered();
void on_action_RegionMap_Redo_triggered();
void on_action_RegionMap_Resize_triggered();
void on_action_RegionMap_ResetImage_triggered();
void on_action_RegionMap_ResetLayout_triggered();
void on_action_RegionMap_ClearImage_triggered();
void on_action_RegionMap_ClearLayout_triggered();
void on_action_Swap_triggered();
void on_action_RegionMap_Generate_triggered();
void on_tabWidget_Region_Map_currentChanged(int);

View file

@ -198,12 +198,12 @@ void RegionMap::resetSquare(int index) {
this->map_squares[index].duplicated = false;
}
void RegionMap::resetLayout() {
void RegionMap::clearLayout() {
for (int i = 0; i < map_squares.size(); i++)
resetSquare(i);
}
void RegionMap::resetImage() {
void RegionMap::clearImage() {
for (int i = 0; i < map_squares.size(); i++)
this->map_squares[i].tile_img_id = 0x00;
}

View file

@ -597,25 +597,18 @@ void RegionMapEditor::on_action_Swap_triggered() {
}
}
void RegionMapEditor::on_action_RegionMap_ResetImage_triggered() {
QMessageBox::StandardButton result = QMessageBox::question(
this,
"WARNING",
"This action will reset the entire map image to metatile 0x00, continue?",
QMessageBox::Yes | QMessageBox::Cancel,
QMessageBox::Yes
void RegionMapEditor::on_action_RegionMap_ClearImage_triggered() {
this->region_map->clearImage();
RegionMapHistoryItem *commit = new RegionMapHistoryItem(
RegionMapEditorBox::BackgroundImage, this->region_map->getTiles(), this->region_map->width(), this->region_map->height()
);
history.push(commit);
if (result == QMessageBox::Yes) {
this->region_map->resetImage();
displayRegionMapImage();
displayRegionMapLayout();
} else {
return;
}
displayRegionMapImage();
displayRegionMapLayout();
}
void RegionMapEditor::on_action_RegionMap_ResetLayout_triggered() {
void RegionMapEditor::on_action_RegionMap_ClearLayout_triggered() {
QMessageBox::StandardButton result = QMessageBox::question(
this,
"WARNING",
@ -625,7 +618,7 @@ void RegionMapEditor::on_action_RegionMap_ResetLayout_triggered() {
);
if (result == QMessageBox::Yes) {
this->region_map->resetLayout();
this->region_map->clearLayout();
displayRegionMapLayout();
} else {
return;