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

View file

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

View file

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

View file

@ -198,12 +198,12 @@ void RegionMap::resetSquare(int index) {
this->map_squares[index].duplicated = false; this->map_squares[index].duplicated = false;
} }
void RegionMap::resetLayout() { void RegionMap::clearLayout() {
for (int i = 0; i < map_squares.size(); i++) for (int i = 0; i < map_squares.size(); i++)
resetSquare(i); resetSquare(i);
} }
void RegionMap::resetImage() { void RegionMap::clearImage() {
for (int i = 0; i < map_squares.size(); i++) for (int i = 0; i < map_squares.size(); i++)
this->map_squares[i].tile_img_id = 0x00; 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() { void RegionMapEditor::on_action_RegionMap_ClearImage_triggered() {
QMessageBox::StandardButton result = QMessageBox::question( this->region_map->clearImage();
this, RegionMapHistoryItem *commit = new RegionMapHistoryItem(
"WARNING", RegionMapEditorBox::BackgroundImage, this->region_map->getTiles(), this->region_map->width(), this->region_map->height()
"This action will reset the entire map image to metatile 0x00, continue?",
QMessageBox::Yes | QMessageBox::Cancel,
QMessageBox::Yes
); );
history.push(commit);
if (result == QMessageBox::Yes) {
this->region_map->resetImage();
displayRegionMapImage(); displayRegionMapImage();
displayRegionMapLayout(); displayRegionMapLayout();
} else {
return;
}
} }
void RegionMapEditor::on_action_RegionMap_ResetLayout_triggered() { void RegionMapEditor::on_action_RegionMap_ClearLayout_triggered() {
QMessageBox::StandardButton result = QMessageBox::question( QMessageBox::StandardButton result = QMessageBox::question(
this, this,
"WARNING", "WARNING",
@ -625,7 +618,7 @@ void RegionMapEditor::on_action_RegionMap_ResetLayout_triggered() {
); );
if (result == QMessageBox::Yes) { if (result == QMessageBox::Yes) {
this->region_map->resetLayout(); this->region_map->clearLayout();
displayRegionMapLayout(); displayRegionMapLayout();
} else { } else {
return; return;