mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-13 20:36:19 -05:00
clean rme UI, undo / redo history, new city maps
This commit is contained in:
@@ -12,4 +12,19 @@ public:
|
||||
~HistoryItem();
|
||||
};
|
||||
|
||||
enum RegionMapEditorBox {
|
||||
BackgroundImage = 1,
|
||||
CityMapImage = 2,
|
||||
};
|
||||
|
||||
class RegionMapHistoryItem {
|
||||
public:
|
||||
int which;// region map or city map
|
||||
int index;
|
||||
unsigned tile;
|
||||
unsigned prev;
|
||||
RegionMapHistoryItem(int type, int index, unsigned prev, unsigned tile);
|
||||
~RegionMapHistoryItem();
|
||||
};
|
||||
|
||||
#endif // HISTORYITEM_H
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "project.h"
|
||||
#include "map.h"
|
||||
#include "tilemaptileselector.h"
|
||||
#include "history.h"
|
||||
#include "historyitem.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QString>
|
||||
@@ -73,6 +75,8 @@ public:
|
||||
//RegionMapSquare *map_squares = nullptr;// array of RegionMapSquares
|
||||
QList<RegionMapSquare> map_squares;
|
||||
|
||||
History<RegionMapHistoryItem*> history;
|
||||
|
||||
QString temp_path;// delete this
|
||||
QString city_map_squares_path;
|
||||
QString region_map_png_path;
|
||||
@@ -125,6 +129,8 @@ public:
|
||||
unsigned getTileId(int, int);
|
||||
int getMapSquareIndex(int, int);
|
||||
|
||||
void deleteLayoutSquare(int);
|
||||
|
||||
// implement these here?
|
||||
void undo();
|
||||
void redo();
|
||||
@@ -134,6 +140,7 @@ public:
|
||||
// TODO: move read / write functions to private (and others)
|
||||
private:
|
||||
//
|
||||
//History<QPair<int, uint8_t>> *history;// (index, tile)
|
||||
int layout_width_;
|
||||
int layout_height_;
|
||||
int img_width_;
|
||||
|
||||
@@ -18,6 +18,7 @@ public:
|
||||
|
||||
QString file;
|
||||
|
||||
// TODO: make private and use access functions
|
||||
int width;
|
||||
int height;
|
||||
|
||||
@@ -28,6 +29,11 @@ public:
|
||||
void create(QString);
|
||||
virtual void paint(QGraphicsSceneMouseEvent*);
|
||||
virtual void draw();
|
||||
int getIndexAt(int, int);
|
||||
|
||||
//private:
|
||||
// int width;
|
||||
// int height;
|
||||
|
||||
signals:
|
||||
void mouseEvent(QGraphicsSceneMouseEvent *, CityMapPixmapItem *);
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "citymappixmapitem.h"
|
||||
#include "regionmaplayoutpixmapitem.h"
|
||||
#include "regionmap.h"
|
||||
#include "history.h"
|
||||
#include "historyitem.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
@@ -55,17 +57,45 @@ public:
|
||||
void onRegionMapLayoutHoveredTileChanged(int);
|
||||
void onRegionMapLayoutHoveredTileCleared();
|
||||
|
||||
void undo();
|
||||
void redo();
|
||||
|
||||
private:
|
||||
Ui::RegionMapEditor *ui;
|
||||
Project *project;
|
||||
|
||||
QString rmStatusbarMessage;
|
||||
History<RegionMapHistoryItem*> history;
|
||||
|
||||
double scaleUpFactor = 2.0;
|
||||
double scaleDownFactor = 1.0 / scaleUpFactor;
|
||||
|
||||
double scaleRegionMapTiles = 1.0;
|
||||
double scaleRegionMapImage = 1.0;
|
||||
double scaleCityMapTiles = 1.0;
|
||||
double scaleCityMapImage = 1.0;
|
||||
|
||||
void scaleUp(QGraphicsView *, qreal factor, qreal width, qreal height);
|
||||
|
||||
bool createCityMap(QString);
|
||||
|
||||
private slots:
|
||||
void on_action_RegionMap_Save_triggered();
|
||||
void on_action_RegionMap_Undo_triggered();
|
||||
void on_action_RegionMap_Redo_triggered();
|
||||
void on_tabWidget_Region_Map_currentChanged(int);
|
||||
void on_pushButton_RM_Options_save_clicked();
|
||||
void on_pushButton_RM_Options_delete_clicked();
|
||||
void on_pushButton_CityMap_save_clicked();
|
||||
void on_pushButton_CityMap_add_clicked();//
|
||||
void on_pushButton_Zoom_In_Image_Tiles_clicked();
|
||||
void on_pushButton_Zoom_Out_Image_Tiles_clicked();
|
||||
void on_pushButton_Zoom_In_City_Tiles_clicked();
|
||||
void on_pushButton_Zoom_Out_City_Tiles_clicked();
|
||||
void on_pushButton_Zoom_In_City_Map_clicked();//
|
||||
void on_pushButton_Zoom_Out_City_Map_clicked();
|
||||
void on_pushButton_Zoom_In_Map_Image_clicked();
|
||||
void on_pushButton_Zoom_Out_Map_Image_clicked();//
|
||||
void on_comboBox_CityMap_picker_currentTextChanged(const QString &);
|
||||
void onHoveredRegionMapTileChanged(int, int);
|
||||
void onHoveredRegionMapTileCleared();
|
||||
|
||||
Reference in New Issue
Block a user