add new convenience features to rme and fix typos
This commit is contained in:
parent
3cef77a174
commit
5b6f658e29
12 changed files with 96 additions and 47 deletions
|
@ -1092,7 +1092,10 @@
|
||||||
<addaction name="action_RegionMap_Undo"/>
|
<addaction name="action_RegionMap_Undo"/>
|
||||||
<addaction name="action_RegionMap_Redo"/>
|
<addaction name="action_RegionMap_Redo"/>
|
||||||
<addaction name="action_RegionMap_Resize"/>
|
<addaction name="action_RegionMap_Resize"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
<addaction name="action_Swap"/>
|
<addaction name="action_Swap"/>
|
||||||
|
<addaction name="action_RegionMap_ResetImage"/>
|
||||||
|
<addaction name="action_RegionMap_ResetLayout"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuTools">
|
<widget class="QMenu" name="menuTools">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -1147,6 +1150,16 @@
|
||||||
<string>Swap...</string>
|
<string>Swap...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="action_RegionMap_ResetImage">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reset Image</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_RegionMap_ResetLayout">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reset Layout</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|
|
@ -70,6 +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 resetImage();
|
||||||
void replaceSectionId(unsigned oldId, unsigned newId);
|
void replaceSectionId(unsigned oldId, unsigned newId);
|
||||||
|
|
||||||
int width();
|
int width();
|
||||||
|
|
|
@ -29,7 +29,9 @@ public:
|
||||||
QString layoutsLabel;
|
QString layoutsLabel;
|
||||||
QMap<QString, MapLayout*> mapLayouts;
|
QMap<QString, MapLayout*> mapLayouts;
|
||||||
QMap<QString, MapLayout*> mapLayoutsMaster;
|
QMap<QString, MapLayout*> mapLayoutsMaster;
|
||||||
QStringList *regionMapSections = nullptr;
|
QMap<QString, QString> *mapSecToMapHoverName;
|
||||||
|
QMap<QString, int> mapSectionNameToValue;
|
||||||
|
QMap<int, QString> mapSectionValueToName;
|
||||||
QStringList *itemNames = nullptr;
|
QStringList *itemNames = nullptr;
|
||||||
QStringList *flagNames = nullptr;
|
QStringList *flagNames = nullptr;
|
||||||
QStringList *varNames = nullptr;
|
QStringList *varNames = nullptr;
|
||||||
|
@ -47,8 +49,6 @@ public:
|
||||||
Map* loadMap(QString);
|
Map* loadMap(QString);
|
||||||
Map* getMap(QString);
|
Map* getMap(QString);
|
||||||
|
|
||||||
QMap<QString, QString> *mapSecToMapHoverName;
|
|
||||||
|
|
||||||
QMap<QString, Tileset*> *tileset_cache = nullptr;
|
QMap<QString, Tileset*> *tileset_cache = nullptr;
|
||||||
Tileset* loadTileset(QString, Tileset *tileset = nullptr);
|
Tileset* loadTileset(QString, Tileset *tileset = nullptr);
|
||||||
Tileset* getTileset(QString, bool forceLoad = false);
|
Tileset* getTileset(QString, bool forceLoad = false);
|
||||||
|
|
|
@ -92,6 +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_ResetLayout_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);
|
||||||
|
|
|
@ -260,7 +260,7 @@ void PorymapConfig::setShowCursorTile(bool enabled) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PorymapConfig::setRegionMapDimensions(int width, int height) {
|
void PorymapConfig::setRegionMapDimensions(int width, int height) {
|
||||||
this->regionMapDimensions = QSize(width, height);//QString("%1x%2").arg(width).arg(height);
|
this->regionMapDimensions = QSize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PorymapConfig::getRecentProject() {
|
QString PorymapConfig::getRecentProject() {
|
||||||
|
|
|
@ -116,8 +116,9 @@ void RegionMap::readLayout() {
|
||||||
for (int y = 0; y < layout_height_; y++) {
|
for (int y = 0; y < layout_height_; y++) {
|
||||||
for (int x = 0; x < layout_width_; x++) {
|
for (int x = 0; x < layout_width_; x++) {
|
||||||
int i = img_index_(x,y);
|
int i = img_index_(x,y);
|
||||||
map_squares[i].secid = static_cast<uint8_t>(mapBinData.at(layout_index_(x,y)));
|
uint8_t id = static_cast<uint8_t>(mapBinData.at(layout_index_(x,y)));
|
||||||
QString secname = (*(project->regionMapSections))[static_cast<uint8_t>(mapBinData.at(layout_index_(x,y)))];
|
map_squares[i].secid = id;
|
||||||
|
QString secname = project->mapSectionValueToName.value(id);
|
||||||
if (secname != "MAPSEC_NONE") map_squares[i].has_map = true;
|
if (secname != "MAPSEC_NONE") map_squares[i].has_map = true;
|
||||||
map_squares[i].mapsec = secname;
|
map_squares[i].mapsec = secname;
|
||||||
map_squares[i].map_name = sMapNamesMap.value(mapSecToMapEntry.value(secname).name);
|
map_squares[i].map_name = sMapNamesMap.value(mapSecToMapEntry.value(secname).name);
|
||||||
|
@ -140,7 +141,7 @@ void RegionMap::saveLayout() {
|
||||||
|
|
||||||
entries_text += "\nconst struct RegionMapLocation gRegionMapEntries[] = {\n";
|
entries_text += "\nconst struct RegionMapLocation gRegionMapEntries[] = {\n";
|
||||||
|
|
||||||
for (auto sec : *(project->regionMapSections)) {
|
for (auto sec : project->mapSectionNameToValue.keys()) {
|
||||||
if (!mapSecToMapEntry.contains(sec)) continue;
|
if (!mapSecToMapEntry.contains(sec)) continue;
|
||||||
struct RegionMapEntry entry = mapSecToMapEntry.value(sec);
|
struct RegionMapEntry entry = mapSecToMapEntry.value(sec);
|
||||||
entries_text += " [" + sec + "] = {" + QString::number(entry.x) + ", " + QString::number(entry.y) + ", "
|
entries_text += " [" + sec + "] = {" + QString::number(entry.x) + ", " + QString::number(entry.y) + ", "
|
||||||
|
@ -168,7 +169,7 @@ void RegionMap::saveOptions(int id, QString sec, QString name, int x, int y) {
|
||||||
int index = getMapSquareIndex(x + this->padLeft, y + this->padTop);
|
int index = getMapSquareIndex(x + this->padLeft, y + this->padTop);
|
||||||
if (!sec.isEmpty()) {
|
if (!sec.isEmpty()) {
|
||||||
this->map_squares[index].has_map = sec == "MAPSEC_NONE" ? false : true;
|
this->map_squares[index].has_map = sec == "MAPSEC_NONE" ? false : true;
|
||||||
this->map_squares[index].secid = static_cast<uint8_t>(project->regionMapSections->indexOf(sec));
|
this->map_squares[index].secid = static_cast<uint8_t>(project->mapSectionNameToValue.value(sec));
|
||||||
this->map_squares[index].mapsec = sec;
|
this->map_squares[index].mapsec = sec;
|
||||||
if (!name.isEmpty()) {
|
if (!name.isEmpty()) {
|
||||||
this->map_squares[index].map_name = name;
|
this->map_squares[index].map_name = name;
|
||||||
|
@ -191,11 +192,20 @@ void RegionMap::resetSquare(int index) {
|
||||||
this->map_squares[index].mapsec = "MAPSEC_NONE";
|
this->map_squares[index].mapsec = "MAPSEC_NONE";
|
||||||
this->map_squares[index].map_name = QString();
|
this->map_squares[index].map_name = QString();
|
||||||
this->map_squares[index].has_map = false;
|
this->map_squares[index].has_map = false;
|
||||||
this->map_squares[index].secid = static_cast<uint8_t>(project->regionMapSections->indexOf("MAPSEC_NONE"));
|
this->map_squares[index].secid = static_cast<uint8_t>(project->mapSectionNameToValue.value("MAPSEC_NONE"));
|
||||||
this->map_squares[index].has_city_map = false;
|
this->map_squares[index].has_city_map = false;
|
||||||
this->map_squares[index].city_map_name = QString();
|
this->map_squares[index].city_map_name = QString();
|
||||||
this->map_squares[index].duplicated = false;
|
this->map_squares[index].duplicated = false;
|
||||||
logInfo(QString("Reset map square at (%1, %2).").arg(this->map_squares[index].x).arg(this->map_squares[index].y));
|
}
|
||||||
|
|
||||||
|
void RegionMap::resetLayout() {
|
||||||
|
for (int i = 0; i < map_squares.size(); i++)
|
||||||
|
resetSquare(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RegionMap::resetImage() {
|
||||||
|
for (int i = 0; i < map_squares.size(); i++)
|
||||||
|
this->map_squares[i].tile_img_id = 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegionMap::replaceSectionId(unsigned oldId, unsigned newId) {
|
void RegionMap::replaceSectionId(unsigned oldId, unsigned newId) {
|
||||||
|
@ -203,7 +213,7 @@ void RegionMap::replaceSectionId(unsigned oldId, unsigned newId) {
|
||||||
if (square.secid == oldId) {
|
if (square.secid == oldId) {
|
||||||
square.has_map = false;
|
square.has_map = false;
|
||||||
square.secid = newId;
|
square.secid = newId;
|
||||||
QString secname = (*(project->regionMapSections))[newId];
|
QString secname = project->mapSectionValueToName.value(newId);
|
||||||
if (secname != "MAPSEC_NONE") square.has_map = true;
|
if (secname != "MAPSEC_NONE") square.has_map = true;
|
||||||
square.mapsec = secname;
|
square.mapsec = secname;
|
||||||
square.map_name = sMapNamesMap.value(mapSecToMapEntry.value(secname).name);
|
square.map_name = sMapNamesMap.value(mapSecToMapEntry.value(secname).name);
|
||||||
|
|
|
@ -469,7 +469,7 @@ void MainWindow::displayMapProperties() {
|
||||||
ui->comboBox_Song->addItems(songs);
|
ui->comboBox_Song->addItems(songs);
|
||||||
ui->comboBox_Song->setCurrentText(map->song);
|
ui->comboBox_Song->setCurrentText(map->song);
|
||||||
|
|
||||||
ui->comboBox_Location->addItems(*project->regionMapSections);
|
ui->comboBox_Location->addItems(project->mapSectionValueToName.values());
|
||||||
ui->comboBox_Location->setCurrentText(map->location);
|
ui->comboBox_Location->setCurrentText(map->location);
|
||||||
|
|
||||||
QMap<QString, QStringList> tilesets = project->getTilesets();
|
QMap<QString, QStringList> tilesets = project->getTilesets();
|
||||||
|
@ -661,8 +661,8 @@ void MainWindow::sortMapList() {
|
||||||
case MapSortOrder::Area:
|
case MapSortOrder::Area:
|
||||||
{
|
{
|
||||||
QMap<QString, int> mapsecToGroupNum;
|
QMap<QString, int> mapsecToGroupNum;
|
||||||
for (int i = 0; i < project->regionMapSections->length(); i++) {
|
for (int i = 0; i < project->mapSectionNameToValue.size(); i++) {
|
||||||
QString mapsec_name = project->regionMapSections->value(i);
|
QString mapsec_name = project->mapSectionValueToName.value(i);
|
||||||
QStandardItem *mapsec = new QStandardItem;
|
QStandardItem *mapsec = new QStandardItem;
|
||||||
mapsec->setText(mapsec_name);
|
mapsec->setText(mapsec_name);
|
||||||
mapsec->setIcon(folderIcon);
|
mapsec->setIcon(folderIcon);
|
||||||
|
@ -1979,21 +1979,6 @@ void MainWindow::on_horizontalSlider_MetatileZoom_valueChanged(int value) {
|
||||||
ui->graphicsView_Metatiles->setFixedSize(size.width() + 2, size.height() + 2);
|
ui->graphicsView_Metatiles->setFixedSize(size.width() + 2, size.height() + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_pushButton_RM_Options_save_clicked() {
|
|
||||||
this->editor->region_map->saveOptions(
|
|
||||||
this->editor->region_map_layout_item->selectedTile,
|
|
||||||
this->ui->comboBox_RM_ConnectedMap->currentText(),
|
|
||||||
this->ui->lineEdit_RM_MapName->text(),
|
|
||||||
this->ui->spinBox_RM_Options_x->value(),
|
|
||||||
this->ui->spinBox_RM_Options_y->value()
|
|
||||||
);
|
|
||||||
this->editor->region_map_layout_item->draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_pushButton_CityMap_save_clicked() {
|
|
||||||
this->editor->city_map_item->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_actionRegion_Map_Editor_triggered() {
|
void MainWindow::on_actionRegion_Map_Editor_triggered() {
|
||||||
if (!this->regionMapEditor) {
|
if (!this->regionMapEditor) {
|
||||||
this->regionMapEditor = new RegionMapEditor(this, this->editor->project);
|
this->regionMapEditor = new RegionMapEditor(this, this->editor->project);
|
||||||
|
|
|
@ -31,7 +31,6 @@ Project::Project()
|
||||||
groupNames = new QStringList;
|
groupNames = new QStringList;
|
||||||
map_groups = new QMap<QString, int>;
|
map_groups = new QMap<QString, int>;
|
||||||
mapNames = new QStringList;
|
mapNames = new QStringList;
|
||||||
regionMapSections = new QStringList;
|
|
||||||
itemNames = new QStringList;
|
itemNames = new QStringList;
|
||||||
flagNames = new QStringList;
|
flagNames = new QStringList;
|
||||||
varNames = new QStringList;
|
varNames = new QStringList;
|
||||||
|
@ -1510,8 +1509,18 @@ void Project::readTilesetProperties() {
|
||||||
|
|
||||||
void Project::readRegionMapSections() {
|
void Project::readRegionMapSections() {
|
||||||
QString filepath = root + "/include/constants/region_map_sections.h";
|
QString filepath = root + "/include/constants/region_map_sections.h";
|
||||||
QStringList prefixes = (QStringList() << "MAPSEC_");
|
this->mapSectionNameToValue.clear();
|
||||||
readCDefinesSorted(filepath, prefixes, regionMapSections);
|
this->mapSectionValueToName.clear();
|
||||||
|
QString text = readTextFile(filepath);
|
||||||
|
if (!text.isNull()) {
|
||||||
|
QStringList prefixes = (QStringList() << "MAPSEC_");
|
||||||
|
this->mapSectionNameToValue = readCDefines(text, prefixes);
|
||||||
|
for (QString defineName : this->mapSectionNameToValue.keys()) {
|
||||||
|
this->mapSectionValueToName.insert(this->mapSectionNameToValue[defineName], defineName);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logError(QString("Failed to read C defines file: '%1'").arg(filepath));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readItemNames() {
|
void Project::readItemNames() {
|
||||||
|
|
|
@ -54,9 +54,6 @@ void CityMapPixmapItem::paint(QGraphicsSceneMouseEvent *event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CityMapPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
|
void CityMapPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
|
||||||
QPointF pos = event->pos();
|
|
||||||
int x = static_cast<int>(pos.x()) / 8;
|
|
||||||
int y = static_cast<int>(pos.y()) / 8;
|
|
||||||
emit mouseEvent(event, this);
|
emit mouseEvent(event, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ void NewMapPopup::setDefaultValues(int groupNum, QString mapSec) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->comboBox_NewMap_Type->addItems(*project->mapTypes);
|
ui->comboBox_NewMap_Type->addItems(*project->mapTypes);
|
||||||
ui->comboBox_NewMap_Location->addItems(*project->regionMapSections);
|
ui->comboBox_NewMap_Location->addItems(project->mapSectionValueToName.values());
|
||||||
if (!mapSec.isEmpty()) ui->comboBox_NewMap_Location->setCurrentText(mapSec);
|
if (!mapSec.isEmpty()) ui->comboBox_NewMap_Location->setCurrentText(mapSec);
|
||||||
|
|
||||||
ui->frame_NewMap_Options->setEnabled(true);
|
ui->frame_NewMap_Options->setEnabled(true);
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDialogButtonBox>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
RegionMapEditor::RegionMapEditor(QWidget *parent, Project *project_) :
|
RegionMapEditor::RegionMapEditor(QWidget *parent, Project *project_) :
|
||||||
|
@ -41,8 +40,6 @@ RegionMapEditor::~RegionMapEditor()
|
||||||
|
|
||||||
void RegionMapEditor::on_action_RegionMap_Save_triggered() {
|
void RegionMapEditor::on_action_RegionMap_Save_triggered() {
|
||||||
if (project && region_map) {
|
if (project && region_map) {
|
||||||
region_map->save();
|
|
||||||
this->city_map_item->save();
|
|
||||||
this->region_map->saveOptions(
|
this->region_map->saveOptions(
|
||||||
this->region_map_layout_item->selectedTile,
|
this->region_map_layout_item->selectedTile,
|
||||||
this->ui->comboBox_RM_ConnectedMap->currentText(),
|
this->ui->comboBox_RM_ConnectedMap->currentText(),
|
||||||
|
@ -50,6 +47,8 @@ void RegionMapEditor::on_action_RegionMap_Save_triggered() {
|
||||||
this->ui->spinBox_RM_Options_x->value(),
|
this->ui->spinBox_RM_Options_x->value(),
|
||||||
this->ui->spinBox_RM_Options_y->value()
|
this->ui->spinBox_RM_Options_y->value()
|
||||||
);
|
);
|
||||||
|
this->region_map->save();
|
||||||
|
this->city_map_item->save();
|
||||||
this->currIndex = this->region_map_layout_item->highlightedTile;
|
this->currIndex = this->region_map_layout_item->highlightedTile;
|
||||||
this->region_map_layout_item->highlightedTile = -1;
|
this->region_map_layout_item->highlightedTile = -1;
|
||||||
displayRegionMap();
|
displayRegionMap();
|
||||||
|
@ -144,7 +143,7 @@ void RegionMapEditor::displayRegionMapLayout() {
|
||||||
|
|
||||||
void RegionMapEditor::displayRegionMapLayoutOptions() {
|
void RegionMapEditor::displayRegionMapLayoutOptions() {
|
||||||
this->ui->comboBox_RM_ConnectedMap->clear();
|
this->ui->comboBox_RM_ConnectedMap->clear();
|
||||||
this->ui->comboBox_RM_ConnectedMap->addItems(*(this->project->regionMapSections));
|
this->ui->comboBox_RM_ConnectedMap->addItems(this->project->mapSectionValueToName.values());
|
||||||
|
|
||||||
this->ui->frame_RM_Options->setEnabled(true);
|
this->ui->frame_RM_Options->setEnabled(true);
|
||||||
|
|
||||||
|
@ -567,10 +566,10 @@ void RegionMapEditor::on_action_Swap_triggered() {
|
||||||
QFormLayout form(&popup);
|
QFormLayout form(&popup);
|
||||||
|
|
||||||
QComboBox *oldSecBox = new QComboBox();
|
QComboBox *oldSecBox = new QComboBox();
|
||||||
oldSecBox->addItems(*(this->project->regionMapSections));
|
oldSecBox->addItems(this->project->mapSectionValueToName.values());
|
||||||
form.addRow(new QLabel("Old Map Section:"), oldSecBox);
|
form.addRow(new QLabel("Old Map Section:"), oldSecBox);
|
||||||
QComboBox *newSecBox = new QComboBox();
|
QComboBox *newSecBox = new QComboBox();
|
||||||
newSecBox->addItems(*(this->project->regionMapSections));
|
newSecBox->addItems(this->project->mapSectionValueToName.values());
|
||||||
form.addRow(new QLabel("New Map Section:"), newSecBox);
|
form.addRow(new QLabel("New Map Section:"), newSecBox);
|
||||||
|
|
||||||
QDialogButtonBox buttonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &popup);
|
QDialogButtonBox buttonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &popup);
|
||||||
|
@ -584,8 +583,8 @@ void RegionMapEditor::on_action_Swap_triggered() {
|
||||||
beforeSection = oldSecBox->currentText();
|
beforeSection = oldSecBox->currentText();
|
||||||
afterSection = newSecBox->currentText();
|
afterSection = newSecBox->currentText();
|
||||||
if (!beforeSection.isEmpty() && !afterSection.isEmpty()) {
|
if (!beforeSection.isEmpty() && !afterSection.isEmpty()) {
|
||||||
oldId = static_cast<uint8_t>(project->regionMapSections->indexOf(beforeSection));
|
oldId = static_cast<uint8_t>(this->project->mapSectionNameToValue.value(beforeSection));
|
||||||
newId = static_cast<uint8_t>(project->regionMapSections->indexOf(afterSection));
|
newId = static_cast<uint8_t>(this->project->mapSectionNameToValue.value(afterSection));
|
||||||
popup.accept();
|
popup.accept();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -598,6 +597,41 @@ 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
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result == QMessageBox::Yes) {
|
||||||
|
this->region_map->resetImage();
|
||||||
|
displayRegionMapImage();
|
||||||
|
displayRegionMapLayout();
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RegionMapEditor::on_action_RegionMap_ResetLayout_triggered() {
|
||||||
|
QMessageBox::StandardButton result = QMessageBox::question(
|
||||||
|
this,
|
||||||
|
"WARNING",
|
||||||
|
"This action will reset the entire map layout to MAPSEC_NONE, continue?",
|
||||||
|
QMessageBox::Yes | QMessageBox::Cancel,
|
||||||
|
QMessageBox::Yes
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result == QMessageBox::Yes) {
|
||||||
|
this->region_map->resetLayout();
|
||||||
|
displayRegionMapLayout();
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void RegionMapEditor::on_comboBox_CityMap_picker_currentTextChanged(const QString &file) {
|
void RegionMapEditor::on_comboBox_CityMap_picker_currentTextChanged(const QString &file) {
|
||||||
this->displayCityMap(file);
|
this->displayCityMap(file);
|
||||||
this->cityMapFirstDraw = true;
|
this->cityMapFirstDraw = true;
|
||||||
|
|
|
@ -50,9 +50,6 @@ void RegionMapPixmapItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegionMapPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
|
void RegionMapPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
|
||||||
QPointF pos = event->pos();
|
|
||||||
int x = static_cast<int>(pos.x()) / 8;
|
|
||||||
int y = static_cast<int>(pos.y()) / 8;
|
|
||||||
emit mouseEvent(event, this);
|
emit mouseEvent(event, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue