2019-01-07 19:46:27 +00:00
|
|
|
#ifndef REGIONMAPEDITOR_H
|
|
|
|
#define REGIONMAPEDITOR_H
|
|
|
|
|
|
|
|
#include "regionmappixmapitem.h"
|
|
|
|
#include "citymappixmapitem.h"
|
|
|
|
#include "regionmaplayoutpixmapitem.h"
|
|
|
|
#include "regionmap.h"
|
2019-01-09 02:03:54 +00:00
|
|
|
#include "history.h"
|
|
|
|
#include "historyitem.h"
|
2019-01-07 19:46:27 +00:00
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QGraphicsSceneMouseEvent>
|
|
|
|
#include <QCloseEvent>
|
2019-01-22 20:06:49 +00:00
|
|
|
#include <QResizeEvent>
|
2019-01-07 19:46:27 +00:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class RegionMapEditor;
|
|
|
|
}
|
|
|
|
|
|
|
|
class RegionMapEditor : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit RegionMapEditor(QWidget *parent = 0, Project *pro = nullptr);
|
|
|
|
~RegionMapEditor();
|
|
|
|
|
|
|
|
RegionMap *region_map;
|
|
|
|
|
|
|
|
void loadRegionMapData();
|
|
|
|
void loadCityMaps();
|
|
|
|
|
2019-01-28 18:47:20 +00:00
|
|
|
void onRegionMapTileSelectorSelectedTileChanged(unsigned id);
|
|
|
|
void onCityMapTileSelectorSelectedTileChanged(unsigned id);
|
|
|
|
void onRegionMapTileSelectorHoveredTileChanged(unsigned id);
|
2019-01-07 19:46:27 +00:00
|
|
|
void onRegionMapTileSelectorHoveredTileCleared();
|
|
|
|
|
2019-01-28 18:47:20 +00:00
|
|
|
void onRegionMapLayoutSelectedTileChanged(int index);
|
|
|
|
void onRegionMapLayoutHoveredTileChanged(int index);
|
2019-01-07 19:46:27 +00:00
|
|
|
void onRegionMapLayoutHoveredTileCleared();
|
|
|
|
|
2019-01-09 02:03:54 +00:00
|
|
|
void undo();
|
|
|
|
void redo();
|
|
|
|
|
2019-01-28 18:47:20 +00:00
|
|
|
void resize(int width, int height);
|
2019-01-14 00:27:28 +00:00
|
|
|
|
2019-01-07 19:46:27 +00:00
|
|
|
private:
|
|
|
|
Ui::RegionMapEditor *ui;
|
|
|
|
Project *project;
|
|
|
|
|
2019-01-09 02:03:54 +00:00
|
|
|
History<RegionMapHistoryItem*> history;
|
|
|
|
|
2019-01-15 22:06:18 +00:00
|
|
|
int currIndex;
|
|
|
|
unsigned selectedCityTile;
|
|
|
|
unsigned selectedImageTile;
|
2019-01-14 00:27:28 +00:00
|
|
|
|
2019-01-22 20:06:49 +00:00
|
|
|
bool hasUnsavedChanges = false;
|
2019-01-28 18:47:20 +00:00
|
|
|
bool cityMapFirstDraw = true;
|
|
|
|
bool regionMapFirstDraw = true;
|
2019-01-22 20:06:49 +00:00
|
|
|
|
2019-01-15 22:06:18 +00:00
|
|
|
double scaleUpFactor = 2.0;
|
2019-01-09 02:03:54 +00:00
|
|
|
double scaleDownFactor = 1.0 / scaleUpFactor;
|
|
|
|
|
2019-01-22 20:06:49 +00:00
|
|
|
int scaleRegionMapTiles = 1;
|
|
|
|
int scaleRegionMapImage = 1;
|
|
|
|
int scaleCityMapTiles = 1;
|
|
|
|
int scaleCityMapImage = 1;
|
2019-01-09 02:03:54 +00:00
|
|
|
|
2019-01-14 00:27:28 +00:00
|
|
|
QGraphicsScene *scene_region_map_image = nullptr;
|
|
|
|
QGraphicsScene *scene_city_map_image = nullptr;
|
|
|
|
QGraphicsScene *scene_region_map_layout = nullptr;
|
|
|
|
QGraphicsScene *scene_region_map_tiles = nullptr;
|
|
|
|
QGraphicsScene *scene_city_map_tiles = nullptr;
|
|
|
|
|
|
|
|
TilemapTileSelector *mapsquare_selector_item = nullptr;
|
|
|
|
TilemapTileSelector *city_map_selector_item = nullptr;
|
|
|
|
|
|
|
|
RegionMapLayoutPixmapItem *region_map_layout_item = nullptr;
|
|
|
|
RegionMapPixmapItem *region_map_item = nullptr;
|
|
|
|
CityMapPixmapItem *city_map_item = nullptr;
|
|
|
|
|
|
|
|
void displayRegionMap();
|
|
|
|
void displayRegionMapImage();
|
|
|
|
void displayRegionMapLayout();
|
|
|
|
void displayRegionMapLayoutOptions();
|
2019-01-28 18:47:20 +00:00
|
|
|
void updateRegionMapLayoutOptions(int index);
|
2019-01-14 00:27:28 +00:00
|
|
|
void displayRegionMapTileSelector();
|
|
|
|
void displayCityMapTileSelector();
|
2019-01-28 18:47:20 +00:00
|
|
|
void displayCityMap(QString name);
|
2019-01-09 02:03:54 +00:00
|
|
|
|
2019-01-28 18:47:20 +00:00
|
|
|
bool createCityMap(QString name);
|
2019-01-07 19:46:27 +00:00
|
|
|
|
2019-01-28 18:47:20 +00:00
|
|
|
void closeEvent(QCloseEvent* event);
|
2019-01-22 20:06:49 +00:00
|
|
|
|
2019-01-07 19:46:27 +00:00
|
|
|
private slots:
|
|
|
|
void on_action_RegionMap_Save_triggered();
|
2019-01-09 02:03:54 +00:00
|
|
|
void on_action_RegionMap_Undo_triggered();
|
|
|
|
void on_action_RegionMap_Redo_triggered();
|
2019-01-14 00:27:28 +00:00
|
|
|
void on_action_RegionMap_Resize_triggered();
|
2019-01-15 22:06:18 +00:00
|
|
|
void on_action_RegionMap_Generate_triggered();
|
2019-01-07 19:46:27 +00:00
|
|
|
void on_tabWidget_Region_Map_currentChanged(int);
|
2019-01-09 02:03:54 +00:00
|
|
|
void on_pushButton_RM_Options_delete_clicked();
|
2019-01-28 18:47:20 +00:00
|
|
|
void on_comboBox_RM_ConnectedMap_activated(const QString &text);
|
2019-01-14 00:27:28 +00:00
|
|
|
void on_pushButton_CityMap_add_clicked();
|
2019-01-22 20:06:49 +00:00
|
|
|
void on_verticalSlider_Zoom_Map_Image_valueChanged(int);
|
|
|
|
void on_verticalSlider_Zoom_Image_Tiles_valueChanged(int);
|
|
|
|
void on_verticalSlider_Zoom_City_Map_valueChanged(int);
|
|
|
|
void on_verticalSlider_Zoom_City_Tiles_valueChanged(int);
|
2019-01-28 18:47:20 +00:00
|
|
|
void on_comboBox_CityMap_picker_currentTextChanged(const QString &text);
|
|
|
|
void on_spinBox_RM_Options_x_valueChanged(int val);
|
|
|
|
void on_spinBox_RM_Options_y_valueChanged(int val);
|
|
|
|
void on_lineEdit_RM_MapName_textEdited(const QString &text);
|
|
|
|
void onHoveredRegionMapTileChanged(int x, int y);
|
2019-01-07 19:46:27 +00:00
|
|
|
void onHoveredRegionMapTileCleared();
|
2019-01-28 18:47:20 +00:00
|
|
|
void mouseEvent_region_map(QGraphicsSceneMouseEvent *event, RegionMapPixmapItem *item);
|
|
|
|
void mouseEvent_city_map(QGraphicsSceneMouseEvent *event, CityMapPixmapItem *item);
|
2019-01-07 19:46:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // REGIONMAPEDITOR_H
|