diff --git a/forms/newlayoutform.ui b/forms/newlayoutform.ui
new file mode 100644
index 00000000..65183046
--- /dev/null
+++ b/forms/newlayoutform.ui
@@ -0,0 +1,236 @@
+
+
+ NewLayoutForm
+
+
+
+ 0
+ 0
+ 304
+ 344
+
+
+
+ Form
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+ Map Dimensions
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Width
+
+
+
+ -
+
+
+ <html><head/><body><p>Width (in metatiles) of the new map.</p></body></html>
+
+
+ 1
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Height
+
+
+
+ -
+
+
+ <html><head/><body><p>Height (in metatiles) of the new map.</p></body></html>
+
+
+ 1
+
+
+
+ -
+
+
+ false
+
+
+ color: rgb(255, 0, 0)
+
+
+
+
+
+ true
+
+
+
+
+
+
+ -
+
+
+ Border Dimensions
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Width
+
+
+
+ -
+
+
+ <html><head/><body><p>Width (in metatiles) of the new map's border.</p></body></html>
+
+
+ 1
+
+
+
+ -
+
+
+ <html><head/><body><p>Height (in metatiles) of the new map's border.</p></body></html>
+
+
+ 1
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Height
+
+
+
+
+
+
+ -
+
+
+ Tilesets
+
+
+
-
+
+
+ Primary
+
+
+
+ -
+
+
+ <html><head/><body><p>The primary tileset for the new map.</p></body></html>
+
+
+ true
+
+
+ QComboBox::InsertPolicy::NoInsert
+
+
+
+ -
+
+
+ Secondary
+
+
+
+ -
+
+
+ <html><head/><body><p>The secondary tileset for the new map.</p></body></html>
+
+
+ true
+
+
+ QComboBox::InsertPolicy::NoInsert
+
+
+
+ -
+
+
+ false
+
+
+ color: rgb(255, 0, 0)
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+ NoScrollComboBox
+ QComboBox
+
+
+
+ NoScrollSpinBox
+ QSpinBox
+
+
+
+
+
+
diff --git a/forms/newmapdialog.ui b/forms/newmapdialog.ui
index 3ddba1dc..911050d3 100644
--- a/forms/newmapdialog.ui
+++ b/forms/newmapdialog.ui
@@ -32,14 +32,27 @@
10
- -
-
+
-
+
- Name
+ Map ID
- -
+
-
+
+
+ Qt::Orientation::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
false
@@ -55,287 +68,10 @@
- -
-
-
- false
-
-
- color: rgb(255, 0, 0)
-
-
-
-
-
- true
-
-
+
-
+
- -
-
-
- Border Dimensions
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- Width
-
-
-
- -
-
-
- <html><head/><body><p>Width (in metatiles) of the new map's border.</p></body></html>
-
-
- 1
-
-
-
- -
-
-
- <html><head/><body><p>Height (in metatiles) of the new map's border.</p></body></html>
-
-
- 1
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Height
-
-
-
-
-
-
- -
-
-
- ID
-
-
-
- -
-
-
- Map Dimensions
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- Width
-
-
-
- -
-
-
- <html><head/><body><p>Width (in metatiles) of the new map.</p></body></html>
-
-
- 1
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Height
-
-
-
- -
-
-
- <html><head/><body><p>Height (in metatiles) of the new map.</p></body></html>
-
-
- 1
-
-
-
- -
-
-
- false
-
-
- color: rgb(255, 0, 0)
-
-
-
-
-
- true
-
-
-
-
-
-
- -
-
-
- <html><head/><body><p>The name of the group this map will be added to.</p></body></html>
-
-
- true
-
-
- QComboBox::InsertPolicy::NoInsert
-
-
-
- -
-
-
- <html><head/><body><p>The constant that will be used to refer to this map. It cannot be the same as any other existing map, and it must start with the specified prefix.</p></body></html>
-
-
-
- -
-
-
- <html><head/><body><p>The name of the new map. The name cannot be the same as any other existing map.</p></body></html>
-
-
- true
-
-
-
- -
-
-
- Tilesets
-
-
-
-
-
-
- Primary
-
-
-
- -
-
-
- <html><head/><body><p>The primary tileset for the new map.</p></body></html>
-
-
- true
-
-
- QComboBox::InsertPolicy::NoInsert
-
-
-
- -
-
-
- Secondary
-
-
-
- -
-
-
- <html><head/><body><p>The secondary tileset for the new map.</p></body></html>
-
-
- true
-
-
- QComboBox::InsertPolicy::NoInsert
-
-
-
- -
-
-
- false
-
-
- color: rgb(255, 0, 0)
-
-
-
-
-
- true
-
-
-
-
-
-
- -
-
-
- false
-
-
- color: rgb(255, 0, 0)
-
-
-
-
-
- true
-
-
-
- -
-
-
- Qt::Orientation::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
- Group
-
-
-
- -
+
-
@@ -353,7 +89,83 @@
- -
+
-
+
+
+ false
+
+
+ color: rgb(255, 0, 0)
+
+
+
+
+
+ true
+
+
+
+ -
+
+
+ <html><head/><body><p>The name of the new map. The name cannot be the same as any other existing map.</p></body></html>
+
+
+ true
+
+
+
+ -
+
+
+ Can Fly To
+
+
+
+ -
+
+
+ <html><head/><body><p>The name of the group this map will be added to.</p></body></html>
+
+
+ true
+
+
+ QComboBox::InsertPolicy::NoInsert
+
+
+
+ -
+
+
+ Map Group
+
+
+
+ -
+
+
+ false
+
+
+ color: rgb(255, 0, 0)
+
+
+
+
+
+ true
+
+
+
+ -
+
+
+ Map Name
+
+
+
+ -
<html><head/><body><p>If checked, a Heal Location will be added to this map automatically.</p></body></html>
@@ -363,13 +175,23 @@
- -
-
+
-
+
- Can Fly To
+ Layout ID
+ -
+
+
+ <html><head/><body><p>The constant that will be used to refer to this map. It cannot be the same as any other existing map, and it must start with the specified prefix.</p></body></html>
+
+
+
+ -
+
+
@@ -394,9 +216,10 @@
- NoScrollSpinBox
- QSpinBox
-
+ NewLayoutForm
+ QWidget
+
+ 1
diff --git a/include/config.h b/include/config.h
index 0655c0bd..21e2dde7 100644
--- a/include/config.h
+++ b/include/config.h
@@ -70,7 +70,7 @@ public:
this->showTilesetEditorLayerGrid = true;
this->monitorFiles = true;
this->tilesetCheckerboardFill = true;
- this->newMapHeaderSectionExpanded = false;
+ this->newMapHeaderSectionExpanded = true;
this->theme = "default";
this->wildMonChartTheme = "";
this->textEditorOpenFolder = "";
diff --git a/include/core/map.h b/include/core/map.h
index 314013d7..55eee303 100644
--- a/include/core/map.h
+++ b/include/core/map.h
@@ -7,6 +7,7 @@
#include "maplayout.h"
#include "tileset.h"
#include "events.h"
+#include "mapheader.h"
#include
#include
@@ -56,30 +57,8 @@ public:
int getBorderWidth() const;
int getBorderHeight() const;
- // TODO: Combine these into a separate MapHeader class?
- void setSong(const QString &song);
- void setLocation(const QString &location);
- void setRequiresFlash(bool requiresFlash);
- void setWeather(const QString &weather);
- void setType(const QString &type);
- void setShowsLocationName(bool showsLocationName);
- void setAllowsRunning(bool allowsRunning);
- void setAllowsBiking(bool allowsBiking);
- void setAllowsEscaping(bool allowsEscaping);
- void setFloorNumber(int floorNumber);
- void setBattleScene(const QString &battleScene);
-
- QString song() const { return m_song; }
- QString location() const { return m_location; }
- bool requiresFlash() const { return m_requiresFlash; }
- QString weather() const { return m_weather; }
- QString type() const { return m_type; }
- bool showsLocationName() const { return m_showsLocationName; }
- bool allowsRunning() const { return m_allowsRunning; }
- bool allowsBiking() const { return m_allowsBiking; }
- bool allowsEscaping() const { return m_allowsEscaping; }
- int floorNumber() const { return m_floorNumber; }
- QString battleScene() const { return m_battleScene; }
+ void setHeader(const MapHeader &header) { *m_header = header; }
+ MapHeader* header() const { return m_header; }
void setSharedEventsMap(const QString &sharedEventsMap) { m_sharedEventsMap = sharedEventsMap; }
void setSharedScriptsMap(const QString &sharedScriptsMap) { m_sharedScriptsMap = sharedScriptsMap; }
@@ -130,25 +109,13 @@ private:
QString m_name;
QString m_constantName;
QString m_layoutId; // TODO: Why do we do half this->layout()->id and half this->layoutId. Should these ever be different?
-
- QString m_song;
- QString m_location;
- bool m_requiresFlash;
- QString m_weather;
- QString m_type;
- bool m_showsLocationName;
- bool m_allowsRunning;
- bool m_allowsBiking;
- bool m_allowsEscaping;
- int m_floorNumber = 0;
- QString m_battleScene;
-
QString m_sharedEventsMap = "";
QString m_sharedScriptsMap = "";
QStringList m_scriptsFileLabels;
QMap m_customAttributes;
+ MapHeader *m_header = nullptr;
Layout *m_layout = nullptr;
bool m_isPersistedToFile = true;
diff --git a/include/core/mapheader.h b/include/core/mapheader.h
new file mode 100644
index 00000000..ee2c354e
--- /dev/null
+++ b/include/core/mapheader.h
@@ -0,0 +1,83 @@
+#ifndef MAPHEADER_H
+#define MAPHEADER_H
+
+#include
+
+class MapHeader : public QObject
+{
+ Q_OBJECT
+public:
+ MapHeader(QObject *parent = nullptr) : QObject(parent) {};
+ ~MapHeader() {};
+ MapHeader(const MapHeader& other);
+ MapHeader& operator=(const MapHeader& other);
+ bool operator==(const MapHeader& other) const {
+ return m_song == other.m_song
+ && m_location == other.m_location
+ && m_requiresFlash == other.m_requiresFlash
+ && m_weather == other.m_weather
+ && m_type == other.m_type
+ && m_showsLocationName == other.m_showsLocationName
+ && m_allowsRunning == other.m_allowsRunning
+ && m_allowsBiking == other.m_allowsBiking
+ && m_allowsEscaping == other.m_allowsEscaping
+ && m_floorNumber == other.m_floorNumber
+ && m_battleScene == other.m_battleScene;
+ }
+ bool operator!=(const MapHeader& other) const {
+ return !(operator==(other));
+ }
+
+ void setSong(const QString &song);
+ void setLocation(const QString &location);
+ void setRequiresFlash(bool requiresFlash);
+ void setWeather(const QString &weather);
+ void setType(const QString &type);
+ void setShowsLocationName(bool showsLocationName);
+ void setAllowsRunning(bool allowsRunning);
+ void setAllowsBiking(bool allowsBiking);
+ void setAllowsEscaping(bool allowsEscaping);
+ void setFloorNumber(int floorNumber);
+ void setBattleScene(const QString &battleScene);
+
+ QString song() const { return m_song; }
+ QString location() const { return m_location; }
+ bool requiresFlash() const { return m_requiresFlash; }
+ QString weather() const { return m_weather; }
+ QString type() const { return m_type; }
+ bool showsLocationName() const { return m_showsLocationName; }
+ bool allowsRunning() const { return m_allowsRunning; }
+ bool allowsBiking() const { return m_allowsBiking; }
+ bool allowsEscaping() const { return m_allowsEscaping; }
+ int floorNumber() const { return m_floorNumber; }
+ QString battleScene() const { return m_battleScene; }
+
+signals:
+ void songChanged(QString, QString);
+ void locationChanged(QString, QString);
+ void requiresFlashChanged(bool, bool);
+ void weatherChanged(QString, QString);
+ void typeChanged(QString, QString);
+ void showsLocationNameChanged(bool, bool);
+ void allowsRunningChanged(bool, bool);
+ void allowsBikingChanged(bool, bool);
+ void allowsEscapingChanged(bool, bool);
+ void floorNumberChanged(int, int);
+ void battleSceneChanged(QString, QString);
+ void modified();
+
+private:
+ QString m_song;
+ QString m_location;
+ bool m_requiresFlash = false;
+ QString m_weather;
+ QString m_type;
+ bool m_showsLocationName = false;
+ bool m_allowsRunning = false;
+ bool m_allowsBiking = false;
+ bool m_allowsEscaping = false;
+ int m_floorNumber = 0;
+ QString m_battleScene;
+};
+
+#endif // MAPHEADER_H
diff --git a/include/mainwindow.h b/include/mainwindow.h
index ab4e0482..a506f5e0 100644
--- a/include/mainwindow.h
+++ b/include/mainwindow.h
@@ -327,7 +327,7 @@ private:
QAction *copyAction = nullptr;
QAction *pasteAction = nullptr;
- MapHeaderForm *mapHeader = nullptr;
+ MapHeaderForm *mapHeaderForm = nullptr;
QMap lastSelectedEvent;
diff --git a/include/project.h b/include/project.h
index c76fcd72..f28f9259 100644
--- a/include/project.h
+++ b/include/project.h
@@ -263,7 +263,7 @@ private:
signals:
void fileChanged(QString filepath);
- void mapSectionIdNamesChanged();
+ void mapSectionIdNamesChanged(const QStringList &idNames);
void mapLoaded(Map *map);
};
diff --git a/include/ui/mapheaderform.h b/include/ui/mapheaderform.h
index afdee728..897b8e9a 100644
--- a/include/ui/mapheaderform.h
+++ b/include/ui/mapheaderform.h
@@ -1,18 +1,18 @@
#ifndef MAPHEADERFORM_H
#define MAPHEADERFORM_H
-#include "project.h"
-#include "map.h"
-#include "ui_mapheaderform.h"
-
-#include
-
/*
This is the UI class used to edit the fields in a map's header.
It's intended to be used anywhere the UI needs to present an editor for a map's header,
e.g. for the current map in the main editor or in the new map dialog.
*/
+#include
+#include
+#include "mapheader.h"
+
+class Project;
+
namespace Ui {
class MapHeaderForm;
}
@@ -25,32 +25,43 @@ public:
explicit MapHeaderForm(QWidget *parent = nullptr);
~MapHeaderForm();
- void setProject(Project * project);
- void setMap(Map * map);
-
- void clearDisplay();
+ void init(const Project * project);
void clear();
- void refreshLocationsComboBox();
+ void setHeader(MapHeader *header);
+ MapHeader headerData() const;
- Ui::MapHeaderForm *ui;
+ void setLocations(QStringList locations);
+ void setLocationsDisabled(bool disabled);
private:
- QPointer