move region map editor to its own window

This commit is contained in:
garak 2019-01-07 14:46:27 -05:00
parent 62009373f7
commit d3a16d34df
13 changed files with 1339 additions and 1202 deletions

View file

@ -2693,839 +2693,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Region Map</string>
</attribute>
<widget class="QScrollArea" name="scrollArea_CM_Metatiles">
<property name="geometry">
<rect>
<x>460</x>
<y>420</y>
<width>301</width>
<height>181</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_CM_Metatiles">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>8</x>
<y>0</y>
<width>283</width>
<height>179</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout_15">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="1">
<spacer name="verticalSpacer_CMM_South">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QGraphicsView" name="graphicsView_City_Map_Tiles">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer_CMM_West">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_CMM_East">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<widget class="QTabWidget" name="tabWidget_Region_Map">
<property name="geometry">
<rect>
<x>19</x>
<y>9</y>
<width>381</width>
<height>291</height>
</rect>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_RM_BkgImg">
<attribute name="title">
<string>Background Image</string>
</attribute>
<widget class="QScrollArea" name="scrollArea_RM_BkgImg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>371</width>
<height>261</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_8">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>369</width>
<height>259</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_18">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="1">
<widget class="QGraphicsView" name="graphicsView_Region_Map_BkgImg">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
<property name="dragMode">
<enum>QGraphicsView::NoDrag</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_RMBI_West">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>166</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_RMBI_South">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>166</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_RMBI_East">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>166</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<spacer name="verticalSpacer_RMBI_North">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>166</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</widget>
<widget class="QWidget" name="tab_RM_Layout">
<attribute name="title">
<string>Map Layout</string>
</attribute>
<widget class="QScrollArea" name="scrollArea_RM_Layout">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>371</width>
<height>261</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_9">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>369</width>
<height>259</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_19">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="1">
<widget class="QGraphicsView" name="graphicsView_Region_Map_Layout">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
<property name="dragMode">
<enum>QGraphicsView::NoDrag</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_RML_West">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>166</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_RML_South">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>166</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_RML_East">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>166</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<spacer name="verticalSpacer_RML_North">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>166</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</widget>
</widget>
<widget class="QStackedWidget" name="stackedWidget_RM_Options">
<property name="geometry">
<rect>
<x>440</x>
<y>20</y>
<width>351</width>
<height>291</height>
</rect>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page_RM_BkgImg_Options">
<widget class="QScrollArea" name="scrollArea_RM_Metatiles">
<property name="geometry">
<rect>
<x>30</x>
<y>20</y>
<width>281</width>
<height>261</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_RM_Metatiles">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>8</x>
<y>0</y>
<width>263</width>
<height>259</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout_21">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="1">
<spacer name="verticalSpacer_RMM_South">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QGraphicsView" name="graphicsView_RegionMap_Tiles">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer_RMM_West">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_RMM_East">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</widget>
<widget class="QWidget" name="page_RM_Layout_Options">
<widget class="QFrame" name="frame_RM_Options">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>331</width>
<height>211</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QPushButton" name="pushButton_RM_Options_save">
<property name="geometry">
<rect>
<x>210</x>
<y>170</y>
<width>107</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string>Set Values</string>
</property>
</widget>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>13</x>
<y>11</y>
<width>301</width>
<height>111</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_22">
<item row="0" column="0">
<widget class="QLabel" name="label_RM_MapSection">
<property name="text">
<string>Map Section</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBox_RM_ConnectedMap">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The section of the region map which the map is grouped under. This also determines the name of the map that is display when the player enters it.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_RM_MapName">
<property name="text">
<string>Map Name</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_RM_MapName"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_RM_CityMap">
<property name="text">
<string>City Map</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBox_RM_CityMap">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The map type is a general attribute, which is used for many different things. For example. it determines whether biking or running is allowed.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>20</x>
<y>130</y>
<width>121</width>
<height>26</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_RM_Options_xy">
<item>
<widget class="QLabel" name="label_RM_Options_x">
<property name="text">
<string>x</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_RM_Options_x"/>
</item>
<item>
<widget class="QLabel" name="label_RM_Options_y">
<property name="text">
<string>y</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_RM_Options_y"/>
</item>
</layout>
</widget>
</widget>
</widget>
</widget>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>40</x>
<y>350</y>
<width>341</width>
<height>281</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>City Map:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_CityMap_picker"/>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_CityMap_save">
<property name="text">
<string>save</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QScrollArea" name="scrollArea_City_Map">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_City_Map">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>337</width>
<height>235</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_20">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="1">
<widget class="QGraphicsView" name="graphicsView_City_Map">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
<property name="dragMode">
<enum>QGraphicsView::NoDrag</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_CM_West">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>166</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_CM_South">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>166</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_CM_East">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>166</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<spacer name="verticalSpacer_CM_North">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>166</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>
</widget>
</item>
@ -3582,6 +2749,7 @@
<addaction name="separator"/>
<addaction name="action_NewMap"/>
<addaction name="actionTileset_Editor"/>
<addaction name="actionRegion_Map_Editor"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
@ -3808,6 +2976,10 @@
<property name="text">
<string>Cursor Tile Outline</string>
</property>
<action name="actionRegion_Map_Editor">
<property name="text">
<string>Region Map Editor</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>

875
forms/regionmapeditor.ui Normal file
View file

@ -0,0 +1,875 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RegionMapEditor</class>
<widget class="QMainWindow" name="RegionMapEditor">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="tab">
<widget class="QScrollArea" name="scrollArea_CM_Metatiles">
<property name="geometry">
<rect>
<x>450</x>
<y>250</y>
<width>301</width>
<height>181</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_CM_Metatiles">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>8</x>
<y>0</y>
<width>283</width>
<height>179</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout_15">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="1">
<spacer name="verticalSpacer_CMM_South">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QGraphicsView" name="graphicsView_City_Map_Tiles">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer_CMM_West">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_CMM_East">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<widget class="QTabWidget" name="tabWidget_Region_Map">
<property name="geometry">
<rect>
<x>19</x>
<y>9</y>
<width>321</width>
<height>221</height>
</rect>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_RM_BkgImg">
<attribute name="title">
<string>Background Image</string>
</attribute>
<widget class="QScrollArea" name="scrollArea_RM_BkgImg">
<property name="geometry">
<rect>
<x>-10</x>
<y>-10</y>
<width>331</width>
<height>211</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_8">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>329</width>
<height>209</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_18">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="1">
<widget class="QGraphicsView" name="graphicsView_Region_Map_BkgImg">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
<property name="dragMode">
<enum>QGraphicsView::NoDrag</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_RMBI_West">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>166</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_RMBI_South">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>166</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_RMBI_East">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>166</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<spacer name="verticalSpacer_RMBI_North">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>166</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</widget>
<widget class="QWidget" name="tab_RM_Layout">
<attribute name="title">
<string>Map Layout</string>
</attribute>
<widget class="QScrollArea" name="scrollArea_RM_Layout">
<property name="geometry">
<rect>
<x>-10</x>
<y>-10</y>
<width>331</width>
<height>211</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_9">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>329</width>
<height>209</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_19">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="1">
<widget class="QGraphicsView" name="graphicsView_Region_Map_Layout">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
<property name="dragMode">
<enum>QGraphicsView::NoDrag</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_RML_West">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>166</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_RML_South">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>166</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_RML_East">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>166</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<spacer name="verticalSpacer_RML_North">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>166</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</widget>
</widget>
<widget class="QStackedWidget" name="stackedWidget_RM_Options">
<property name="geometry">
<rect>
<x>440</x>
<y>20</y>
<width>351</width>
<height>221</height>
</rect>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page_RM_BkgImg_Options">
<widget class="QScrollArea" name="scrollArea_RM_Metatiles">
<property name="geometry">
<rect>
<x>30</x>
<y>20</y>
<width>281</width>
<height>171</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_RM_Metatiles">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>8</x>
<y>0</y>
<width>263</width>
<height>169</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout_21">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="1">
<spacer name="verticalSpacer_RMM_South">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QGraphicsView" name="graphicsView_RegionMap_Tiles">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer_RMM_West">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_RMM_East">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</widget>
<widget class="QWidget" name="page_RM_Layout_Options">
<widget class="QFrame" name="frame_RM_Options">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>0</y>
<width>331</width>
<height>211</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QPushButton" name="pushButton_RM_Options_save">
<property name="geometry">
<rect>
<x>210</x>
<y>170</y>
<width>107</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string>Set Values</string>
</property>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>13</x>
<y>11</y>
<width>301</width>
<height>111</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_22">
<item row="0" column="0">
<widget class="QLabel" name="label_RM_MapSection">
<property name="text">
<string>Map Section</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBox_RM_ConnectedMap">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The section of the region map which the map is grouped under. This also determines the name of the map that is display when the player enters it.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_RM_MapName">
<property name="text">
<string>Map Name</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_RM_MapName"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_RM_CityMap">
<property name="text">
<string>City Map</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBox_RM_CityMap">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The map type is a general attribute, which is used for many different things. For example. it determines whether biking or running is allowed.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>130</y>
<width>138</width>
<height>26</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_RM_Options_xy">
<item>
<widget class="QLabel" name="label_RM_Options_x">
<property name="text">
<string>x</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_RM_Options_x"/>
</item>
<item>
<widget class="QLabel" name="label_RM_Options_y">
<property name="text">
<string>y</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_RM_Options_y"/>
</item>
</layout>
</widget>
</widget>
</widget>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>250</y>
<width>341</width>
<height>281</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>City Map:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_CityMap_picker"/>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_CityMap_save">
<property name="text">
<string>save</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QScrollArea" name="scrollArea_City_Map">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_City_Map">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>337</width>
<height>235</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_20">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="1">
<widget class="QGraphicsView" name="graphicsView_City_Map">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
<property name="dragMode">
<enum>QGraphicsView::NoDrag</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_CM_West">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>166</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_CM_South">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>166</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_CM_East">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>166</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<spacer name="verticalSpacer_CM_North">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>166</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="action_RegionMap_Save"/>
</widget>
<addaction name="menuFile"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="action_RegionMap_Save">
<property name="text">
<string>Save</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -19,10 +19,6 @@
#include "currentselectedmetatilespixmapitem.h"
#include "collisionpixmapitem.h"
#include "mappixmapitem.h"
#include "regionmappixmapitem.h"
#include "citymappixmapitem.h"
#include "regionmaplayoutpixmapitem.h"
#include "regionmapeditor.h"
#include "settings.h"
#include "movablerect.h"
#include "cursortilerect.h"
@ -81,49 +77,6 @@ public:
void updateCustomMapHeaderValues(QTableWidget *);
Tileset *getCurrentMapPrimaryTileset();
// TODO: move these to appropriate place
RegionMap *region_map;
void loadRegionMapData();
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;
RegionMapPixmapItem *region_map_item = nullptr;
CityMapPixmapItem *city_map_item = nullptr;
RegionMapLayoutPixmapItem *region_map_layout_item = nullptr;
void displayRegionMap();
void displayRegionMapImage();
void displayRegionMapLayout();
void displayRegionMapLayoutOptions();
void updateRegionMapLayoutOptions(int);
void displayRegionMapTileSelector();
void displayCityMapTileSelector();
void displayCityMap(QString);
void loadCityMaps();
void onRegionMapTileSelectorSelectedTileChanged();
void onRegionMapTileSelectorHoveredTileChanged(unsigned);
void onRegionMapTileSelectorHoveredTileCleared();
void onRegionMapLayoutSelectedTileChanged(int);
void onRegionMapLayoutHoveredTileChanged(int);
void onRegionMapLayoutHoveredTileCleared();
private slots:
void onHoveredRegionMapTileChanged(int, int);
void onHoveredRegionMapTileCleared();
void mouseEvent_region_map(QGraphicsSceneMouseEvent *, RegionMapPixmapItem *);
void mouseEvent_city_map(QGraphicsSceneMouseEvent *, CityMapPixmapItem *);
public:
QString rmStatusbarMessage;
//
DraggablePixmapItem *addMapEvent(Event *event);
void selectMapEvent(DraggablePixmapItem *object);
void selectMapEvent(DraggablePixmapItem *object, bool toggle);
@ -152,7 +105,6 @@ public:
QGraphicsScene *scene_selected_border_metatiles = nullptr;
QGraphicsScene *scene_collision_metatiles = nullptr;
QGraphicsScene *scene_elevation_metatiles = nullptr;
MetatileSelector *metatile_selector_item = nullptr;
BorderMetatilesPixmapItem *selected_border_metatiles_item = nullptr;
@ -164,7 +116,7 @@ public:
QString map_edit_mode;
QString prev_edit_mode;
int scale_exp = 0;
double scale_base = sqrt(2); // adjust scale factor with this
qreal collisionOpacity = 0.5;

View file

@ -15,6 +15,7 @@
#include "map.h"
#include "editor.h"
#include "tileseteditor.h"
#include "regionmapeditor.h"
#include "filterchildrenproxymodel.h"
#include "newmappopup.h"
@ -65,10 +66,7 @@ private slots:
void on_checkBox_AllowBiking_clicked(bool checked);
void on_checkBox_AllowEscapeRope_clicked(bool checked);
void on_tabWidget_Region_Map_currentChanged(int);
void on_tabWidget_currentChanged(int index);
void on_pushButton_RM_Options_save_clicked();
void on_actionUndo_triggered();
@ -134,9 +132,6 @@ private slots:
void on_pushButton_clicked();
void on_pushButton_CityMap_save_clicked();
void on_comboBox_CityMap_picker_currentTextChanged(const QString &);
void on_checkBox_smartPaths_stateChanged(int selected);
void on_checkBox_Visibility_clicked(bool checked);
@ -166,9 +161,12 @@ private slots:
void on_tableWidget_CustomHeaderFields_cellChanged(int row, int column);
void on_horizontalSlider_MetatileZoom_valueChanged(int value);
void on_actionRegion_Map_Editor_triggered();
private:
Ui::MainWindow *ui;
TilesetEditor *tilesetEditor = nullptr;
RegionMapEditor *regionMapEditor = nullptr;
FilterChildrenProxyModel *mapListProxyModel;
NewMapPopup *newmapprompt = nullptr;
QStandardItemModel *mapListModel;

View file

@ -0,0 +1,76 @@
#ifndef REGIONMAPEDITOR_H
#define REGIONMAPEDITOR_H
#include "regionmappixmapitem.h"
#include "citymappixmapitem.h"
#include "regionmaplayoutpixmapitem.h"
#include "regionmap.h"
#include <QMainWindow>
#include <QGraphicsSceneMouseEvent>
#include <QCloseEvent>
namespace Ui {
class RegionMapEditor;
}
class RegionMapEditor : public QMainWindow
{
Q_OBJECT
public:
explicit RegionMapEditor(QWidget *parent = 0, Project *pro = nullptr);
~RegionMapEditor();
// TODO: make members that are not called outside of this private
RegionMap *region_map;
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;
RegionMapPixmapItem *region_map_item = nullptr;
CityMapPixmapItem *city_map_item = nullptr;
RegionMapLayoutPixmapItem *region_map_layout_item = nullptr;
void loadRegionMapData();
void displayRegionMap();
void displayRegionMapImage();
void displayRegionMapLayout();
void displayRegionMapLayoutOptions();
void updateRegionMapLayoutOptions(int);
void displayRegionMapTileSelector();
void displayCityMapTileSelector();
void displayCityMap(QString);
void loadCityMaps();
void onRegionMapTileSelectorSelectedTileChanged();
void onRegionMapTileSelectorHoveredTileChanged(unsigned);
void onRegionMapTileSelectorHoveredTileCleared();
void onRegionMapLayoutSelectedTileChanged(int);
void onRegionMapLayoutHoveredTileChanged(int);
void onRegionMapLayoutHoveredTileCleared();
private:
Ui::RegionMapEditor *ui;
Project *project;
QString rmStatusbarMessage;
private slots:
void on_action_RegionMap_Save_triggered();
void on_tabWidget_Region_Map_currentChanged(int);
void on_pushButton_RM_Options_save_clicked();
void on_pushButton_CityMap_save_clicked();
void on_comboBox_CityMap_picker_currentTextChanged(const QString &);
void onHoveredRegionMapTileChanged(int, int);
void onHoveredRegionMapTileCleared();
void mouseEvent_region_map(QGraphicsSceneMouseEvent *, RegionMapPixmapItem *);
void mouseEvent_city_map(QGraphicsSceneMouseEvent *, CityMapPixmapItem *);
};
#endif // REGIONMAPEDITOR_H

View file

@ -2,8 +2,7 @@
#define REGIONMAPLAYOUTPIXMAPITEM_H
#include "tilemaptileselector.h"
//#include "regionmappixmapitem.h"
#include "regionmapeditor.h"
#include "regionmap.h"
class RegionMapLayoutPixmapItem : public SelectablePixmapItem {
Q_OBJECT

View file

@ -1,7 +1,7 @@
#ifndef REGIONMAPPIXMAPITEM_H
#define REGIONMAPPIXMAPITEM_H
#include "regionmapeditor.h"
#include "regionmap.h"
#include "tilemaptileselector.h"
#include <QGraphicsPixmapItem>

View file

@ -29,6 +29,7 @@ SOURCES += src/core/block.cpp \
src/core/tile.cpp \
src/core/tileset.cpp \
src/core/regionmapeditor.cpp \
src/core/regionmap.cpp \
src/ui/aboutporymap.cpp \
src/ui/bordermetatilespixmapitem.cpp \
src/ui/collisionpixmapitem.cpp \
@ -58,6 +59,7 @@ SOURCES += src/core/block.cpp \
src/ui/tileseteditormetatileselector.cpp \
src/ui/tileseteditortileselector.cpp \
src/ui/tilemaptileselector.cpp \
src/ui/regionmapeditor.cpp \
src/ui/newmappopup.cpp \
src/config.cpp \
src/editor.cpp \
@ -84,7 +86,8 @@ HEADERS += include/core/block.h \
include/core/tile.h \
include/core/tileset.h \
include/core/regionmapeditor.h \
include/ui/aboutporymap.h \
include/core/regionmap.h \
include/ui/aboutporymap.h \
include/ui/bordermetatilespixmapitem.h \
include/ui/collisionpixmapitem.h \
include/ui/connectionpixmapitem.h \
@ -113,6 +116,7 @@ HEADERS += include/core/block.h \
include/ui/tileseteditormetatileselector.h \
include/ui/tileseteditortileselector.h \
include/ui/tilemaptileselector.h \
include/ui/regionmapeditor.h \
include/ui/newmappopup.h \
include/config.h \
include/editor.h \
@ -125,6 +129,7 @@ FORMS += forms/mainwindow.ui \
forms/eventpropertiesframe.ui \
forms/tileseteditor.ui \
forms/paletteeditor.ui \
forms/regionmapeditor.ui \
forms/newmappopup.ui \
forms/aboutporymap.ui

View file

@ -1,4 +1,4 @@
#include "regionmapeditor.h"
#include "regionmap.h"
#include <QByteArray>
#include <QFile>
@ -108,13 +108,6 @@ void RegionMap::init(Project *pro) {
readBkgImgBin();
readLayout();
readCityMaps();
//tryGetMap();
//saveBkgImgBin();
//saveLayout();
//test();
}
// as of now, this needs to be called first because it initializes all the

View file

@ -20,17 +20,12 @@ Editor::Editor(Ui::MainWindow* ui)
this->settings = new Settings();
this->playerViewRect = new MovableRect(&this->settings->playerViewRectEnabled, 30 * 8, 20 * 8, qRgb(255, 255, 255));
this->cursorMapTileRect = new CursorTileRect(&this->settings->cursorTileRectEnabled, qRgb(255, 255, 255));
this->region_map = new RegionMap;// TODO: why is this here?
}
void Editor::saveProject() {
if (project) {
project->saveAllMaps();
project->saveAllDataStructures();
if (region_map) {
region_map->save();
displayRegionMap();
}
}
}
@ -39,10 +34,6 @@ void Editor::save() {
project->saveMap(map);
project->saveAllDataStructures();
}
if (project && region_map) {
region_map->save();
displayRegionMap();
}
}
void Editor::undo() {
@ -456,17 +447,6 @@ bool Editor::setMap(QString map_name) {
selected_events->clear();
displayMap();
updateSelectedEvents();
if (region_map) {
for (auto square : region_map->map_squares) {
if (square.mapsec == map->location) {
int img_x = square.x + 1;
int img_y = square.y + 2;
this->region_map_layout_item->select(img_x, img_y);
break;
}
}
}
}
return true;
@ -616,17 +596,11 @@ void Editor::displayMap() {
displayMapBorder();
displayMapGrid();
<<<<<<< abc873464dc736dcfdda4a20df61516f45478844
this->playerViewRect->setZValue(1000);
this->cursorMapTileRect->setZValue(1001);
scene->addItem(this->playerViewRect);
scene->addItem(this->cursorMapTileRect);
displayRegionMapTileSelector();//?
displayRegionMap();
=======
>>>>>>> add layout view to region map editor
if (map_item) {
map_item->setVisible(false);
}
@ -638,14 +612,6 @@ void Editor::displayMap() {
}
}
void Editor::displayRegionMap() {
displayRegionMapTileSelector();
displayCityMapTileSelector();
displayRegionMapImage();
displayRegionMapLayout();
displayRegionMapLayoutOptions();
}
void Editor::displayMetatileSelector() {
if (metatile_selector_item && metatile_selector_item->scene()) {
metatile_selector_item->scene()->removeItem(metatile_selector_item);
@ -1296,264 +1262,6 @@ void Editor::deleteEvent(Event *event) {
//updateSelectedObjects();
}
void Editor::loadCityMaps() {
//
QDir directory(project->root + "/graphics/pokenav/city_maps");
QStringList files = directory.entryList(QStringList() << "*.bin", QDir::Files);
QStringList without_bin;
for (QString file : files) {
without_bin.append(file.remove(".bin"));
}
this->ui->comboBox_CityMap_picker->addItems(without_bin);
}
void Editor::loadRegionMapData() {
//
this->region_map->init(project);
displayRegionMap();
}
// TODO: get this to display on a decent scale
void Editor::displayRegionMapTileSelector() {
//
this->mapsquare_selector_item = new TilemapTileSelector(QPixmap(this->region_map->region_map_png_path));
this->mapsquare_selector_item->draw();
this->scene_region_map_tiles = new QGraphicsScene;
this->scene_region_map_tiles->addItem(this->mapsquare_selector_item);
connect(this->mapsquare_selector_item, &TilemapTileSelector::selectedTileChanged,
this, &Editor::onRegionMapTileSelectorSelectedTileChanged);// TODO: remove this?
connect(this->mapsquare_selector_item, &TilemapTileSelector::hoveredTileChanged,
this, &Editor::onRegionMapTileSelectorHoveredTileChanged);
connect(this->mapsquare_selector_item, &TilemapTileSelector::hoveredTileCleared,
this, &Editor::onRegionMapTileSelectorHoveredTileCleared);
this->ui->graphicsView_RegionMap_Tiles->setScene(this->scene_region_map_tiles);
this->ui->graphicsView_RegionMap_Tiles->setFixedSize(this->mapsquare_selector_item->pixelWidth + 2,
this->mapsquare_selector_item->pixelHeight + 2);
}
void Editor::displayCityMapTileSelector() {
// city_map_selector_item
this->city_map_selector_item = new TilemapTileSelector(QPixmap(this->region_map->region_map_city_map_tiles_path));
this->city_map_selector_item->draw();
this->scene_city_map_tiles = new QGraphicsScene;
this->scene_city_map_tiles->addItem(this->city_map_selector_item);
/*connect(this->city_map_selector_item, &TilemapTileSelector::selectedTileChanged,
this, &Editor::onRegionMapTileSelectorSelectedTileChanged);// TODO: remove this?
connect(this->city_map_selector_item, &TilemapTileSelector::hoveredTileChanged,
this, &Editor::onRegionMapTileSelectorHoveredTileChanged);
connect(this->city_map_selector_item, &TilemapTileSelector::hoveredTileCleared,
this, &Editor::onRegionMapTileSelectorHoveredTileCleared);*/
this->ui->graphicsView_City_Map_Tiles->setScene(this->scene_city_map_tiles);
this->ui->graphicsView_City_Map_Tiles->setFixedSize(this->city_map_selector_item->pixelWidth + 2,
this->city_map_selector_item->pixelHeight + 2);
}
// TODO: change the signal slot to new syntax
// TODO: add scalability?
void Editor::displayRegionMapImage() {
//
this->region_map_item = new RegionMapPixmapItem(this->region_map, this->mapsquare_selector_item);
connect(region_map_item, SIGNAL(mouseEvent(QGraphicsSceneMouseEvent*, RegionMapPixmapItem*)),
this, SLOT(mouseEvent_region_map(QGraphicsSceneMouseEvent*, RegionMapPixmapItem*)));
connect(region_map_item, SIGNAL(hoveredRegionMapTileChanged(int, int)),
this, SLOT(onHoveredRegionMapTileChanged(int, int)));
connect(region_map_item, SIGNAL(hoveredRegionMapTileCleared()),
this, SLOT(onHoveredRegionMapTileCleared()));
this->region_map_item->draw();
this->scene_region_map_image = new QGraphicsScene;
this->scene_region_map_image->addItem(this->region_map_item);
this->scene_region_map_image->setSceneRect(this->scene_region_map_image->sceneRect());
this->ui->graphicsView_Region_Map_BkgImg->setScene(this->scene_region_map_image);
this->ui->graphicsView_Region_Map_BkgImg->setFixedSize(this->region_map->imgSize());
}
/*
if (!scene) {
scene = new QGraphicsScene;
MapSceneEventFilter *filter = new MapSceneEventFilter();
scene->installEventFilter(filter);
connect(filter, &MapSceneEventFilter::wheelZoom, this, &Editor::wheelZoom);
}
if (map_item && scene) {
scene->removeItem(map_item);
delete map_item;
}
*/
void Editor::displayCityMap(QString f) {
//
QString file = this->project->root + "/graphics/pokenav/city_maps/" + f + ".bin";
if (!scene_city_map_image) {
scene_city_map_image = new QGraphicsScene;
}
if (city_map_item && scene_city_map_image) {
scene_city_map_image->removeItem(city_map_item);
delete city_map_item;
}
city_map_item = new CityMapPixmapItem(file, this->city_map_selector_item);
city_map_item->draw();
connect(city_map_item, SIGNAL(mouseEvent(QGraphicsSceneMouseEvent*, CityMapPixmapItem*)),
this, SLOT(mouseEvent_city_map(QGraphicsSceneMouseEvent*, CityMapPixmapItem*)));
scene_city_map_image->addItem(city_map_item);
scene_city_map_image->setSceneRect(this->scene_city_map_image->sceneRect());
this->ui->graphicsView_City_Map->setScene(scene_city_map_image);
this->ui->graphicsView_City_Map->setFixedSize(QSize(82,82));
// set fixed size?
}
// TODO: add if (item) and if(scene) checks because called more than once per instance
void Editor::displayRegionMapLayout() {
//
this->region_map_layout_item = new RegionMapLayoutPixmapItem(this->region_map, this->mapsquare_selector_item);
//*
connect(this->region_map_layout_item, &RegionMapLayoutPixmapItem::selectedTileChanged,
this, &Editor::onRegionMapLayoutSelectedTileChanged);// TODO: remove this?
connect(this->region_map_layout_item, &RegionMapLayoutPixmapItem::hoveredTileChanged,
this, &Editor::onRegionMapLayoutHoveredTileChanged);
connect(this->region_map_layout_item, &RegionMapLayoutPixmapItem::hoveredTileCleared,
this, &Editor::onRegionMapLayoutHoveredTileCleared);
//*/
this->region_map_layout_item->draw();
this->region_map_layout_item->setDefaultSelection();
this->scene_region_map_layout = new QGraphicsScene;
this->scene_region_map_layout->addItem(region_map_layout_item);
this->scene_region_map_layout->setSceneRect(this->scene_region_map_layout->sceneRect());
this->ui->graphicsView_Region_Map_Layout->setScene(this->scene_region_map_layout);
this->ui->graphicsView_Region_Map_Layout->setFixedSize(this->region_map->imgSize());
}
void Editor::displayRegionMapLayoutOptions() {
//
this->ui->comboBox_RM_ConnectedMap->addItems(*(this->project->regionMapSections));
this->ui->frame_RM_Options->setEnabled(true);
// TODO: change these values to variables
this->ui->spinBox_RM_Options_x->setMaximum(27);
this->ui->spinBox_RM_Options_y->setMaximum(14);
updateRegionMapLayoutOptions(65);
}
void Editor::updateRegionMapLayoutOptions(int index) {
//
this->ui->lineEdit_RM_MapName->setText(this->project->mapSecToMapHoverName->value(this->region_map->map_squares[index].mapsec));//this->region_map->map_squares[index].map_name);
this->ui->comboBox_RM_ConnectedMap->setCurrentText(this->region_map->map_squares[index].mapsec);
this->ui->spinBox_RM_Options_x->setValue(this->region_map->map_squares[index].x);
this->ui->spinBox_RM_Options_y->setValue(this->region_map->map_squares[index].y);
}
void Editor::onRegionMapTileSelectorSelectedTileChanged() {
//
}
void Editor::onRegionMapTileSelectorHoveredTileChanged(unsigned tileId) {
QString message = QString("Tile: 0x") + QString("%1").arg(tileId, 4, 16, QChar('0')).toUpper();
this->ui->statusBar->showMessage(message);
}
void Editor::onRegionMapTileSelectorHoveredTileCleared() {
//
//QString message = QString("Selected Tile: 0x") + QString("%1").arg(this->region_map_layout_item->selectedTile, 4, 16, QChar('0')).toUpper();
//this->ui->statusBar->showMessage(message);
}
void Editor::onRegionMapLayoutSelectedTileChanged(int index) {
//
QString message = QString();
if (this->region_map->map_squares[index].has_map) {
//
message = QString("Map: %1").arg(this->project->mapSecToMapHoverName->value(
this->region_map->map_squares[index].mapsec)).remove("{NAME_END}");//.remove("{NAME_END}")
}
this->ui->statusBar->showMessage(message);
updateRegionMapLayoutOptions(index);
}
void Editor::onRegionMapLayoutHoveredTileChanged(int index) {
// TODO: change to x, y coords not index
QString message = QString();
int x = this->region_map->map_squares[index].x;
int y = this->region_map->map_squares[index].y;
if (x >= 0 && y >= 0) {
message = QString("(%1, %2)").arg(x).arg(y);
if (this->region_map->map_squares[index].has_map) {
//
message += QString("Map: %1").arg(this->project->mapSecToMapHoverName->value(
this->region_map->map_squares[index].mapsec)).remove("{NAME_END}");
}
}
this->ui->statusBar->showMessage(message);
}
void Editor::onRegionMapLayoutHoveredTileCleared() {
//
int index = this->region_map_layout_item->selectedTile;
QString message = QString();
int x = this->region_map->map_squares[index].x;
int y = this->region_map->map_squares[index].y;
if (x >= 0 && y >= 0) {
message = QString("(%1, %2)").arg(x).arg(y);
if (this->region_map->map_squares[index].has_map) {
//
message += QString("Map: %1").arg(this->project->mapSecToMapHoverName->value(
this->region_map->map_squares[index].mapsec)).remove("{NAME_END}");
}
}
this->ui->statusBar->showMessage(message);
}
void Editor::onHoveredRegionMapTileChanged(int x, int y) {
rmStatusbarMessage = QString("x: %1, y: %2 Tile: 0x").arg(x).arg(y) + QString("%1").arg(this->region_map->getTileId(x, y), 4, 16, QChar('0')).toUpper();
this->ui->statusBar->showMessage(rmStatusbarMessage);
}
void Editor::onHoveredRegionMapTileCleared() {
this->ui->statusBar->clearMessage();
}
void Editor::mouseEvent_region_map(QGraphicsSceneMouseEvent *event, RegionMapPixmapItem *item) {
//
if (event->buttons() & Qt::RightButton) {
//
item->select(event);
} else if (event->buttons() & Qt::MiddleButton) {
// TODO: add functionality here? replace or?
} else {
//
item->paint(event);
}
}
void Editor::mouseEvent_city_map(QGraphicsSceneMouseEvent *event, CityMapPixmapItem *item) {
//
if (event->buttons() & Qt::RightButton) {
//
//item->select(event);
} else if (event->buttons() & Qt::MiddleButton) {
// TODO: add functionality here? replace or?
} else {
//
item->paint(event);
}
}
// It doesn't seem to be possible to prevent the mousePress event
// from triggering both event's DraggablePixmapItem and the background mousePress.
// Since the DraggablePixmapItem's event fires first, we can set a temp

View file

@ -263,14 +263,11 @@ bool MainWindow::openProject(QString dir) {
setWindowTitle(editor->project->getProjectTitle());
loadDataStructures();
populateMapList();
editor->loadRegionMapData();
editor->loadCityMaps();
success = setMap(getDefaultMap(), true);
} else {
setWindowTitle(editor->project->getProjectTitle());
loadDataStructures();
populateMapList();
editor->loadRegionMapData();
}
if (success) {
@ -599,11 +596,6 @@ void MainWindow::on_checkBox_AllowEscapeRope_clicked(bool checked)
}
}
void MainWindow::on_tabWidget_Region_Map_currentChanged(int index) {
//
ui->stackedWidget_RM_Options->setCurrentIndex(index);
}
void MainWindow::loadDataStructures() {
Project *project = editor->project;
project->readMapLayouts();
@ -2004,8 +1996,22 @@ void MainWindow::on_pushButton_CityMap_save_clicked() {
this->editor->city_map_item->save();
}
void MainWindow::on_comboBox_CityMap_picker_currentTextChanged(const QString &file) {
this->editor->displayCityMap(file);
void MainWindow::on_actionRegion_Map_Editor_triggered() {
if (!this->regionMapEditor) {
this->regionMapEditor = new RegionMapEditor(this, this->editor->project);
this->regionMapEditor->loadRegionMapData();
this->regionMapEditor->loadCityMaps();
connect(this->regionMapEditor, &QObject::destroyed, [=](QObject *) { this->regionMapEditor = nullptr; });
this->regionMapEditor->setAttribute(Qt::WA_DeleteOnClose);
}
if (!this->regionMapEditor->isVisible()) {
this->regionMapEditor->show();
} else if (this->regionMapEditor->isMinimized()) {
this->regionMapEditor->showNormal();
} else {
this->regionMapEditor->activateWindow();
}
}
void MainWindow::closeEvent(QCloseEvent *event) {

353
src/ui/regionmapeditor.cpp Normal file
View file

@ -0,0 +1,353 @@
#include "regionmapeditor.h"
#include "ui_regionmapeditor.h"
#include <QDir>
RegionMapEditor::RegionMapEditor(QWidget *parent, Project *pro) :
QMainWindow(parent),
ui(new Ui::RegionMapEditor)
{
ui->setupUi(this);
this->project = pro;
this->region_map = new RegionMap;
}
RegionMapEditor::~RegionMapEditor()
{
delete ui;
}
void RegionMapEditor::on_action_RegionMap_Save_triggered() {
qDebug() << "Region Map Save Triggered";
if (project && region_map) {
qDebug() << "actually saving";
region_map->save();
displayRegionMap();
}
}
void RegionMapEditor::loadRegionMapData() {
//
this->region_map->init(project);
displayRegionMap();
}
void RegionMapEditor::loadCityMaps() {
//
QDir directory(project->root + "/graphics/pokenav/city_maps");
QStringList files = directory.entryList(QStringList() << "*.bin", QDir::Files);
QStringList without_bin;
for (QString file : files) {
without_bin.append(file.remove(".bin"));
}
this->ui->comboBox_CityMap_picker->addItems(without_bin);
}
void RegionMapEditor::displayRegionMap() {
displayRegionMapTileSelector();
displayCityMapTileSelector();
displayRegionMapImage();
displayRegionMapLayout();
displayRegionMapLayoutOptions();
}
// TODO: change the signal slot to new syntax
// TODO: add scalability?
void RegionMapEditor::displayRegionMapImage() {
//
this->region_map_item = new RegionMapPixmapItem(this->region_map, this->mapsquare_selector_item);
connect(region_map_item, SIGNAL(mouseEvent(QGraphicsSceneMouseEvent*, RegionMapPixmapItem*)),
this, SLOT(mouseEvent_region_map(QGraphicsSceneMouseEvent*, RegionMapPixmapItem*)));
connect(region_map_item, SIGNAL(hoveredRegionMapTileChanged(int, int)),
this, SLOT(onHoveredRegionMapTileChanged(int, int)));
connect(region_map_item, SIGNAL(hoveredRegionMapTileCleared()),
this, SLOT(onHoveredRegionMapTileCleared()));
this->region_map_item->draw();
this->scene_region_map_image = new QGraphicsScene;
this->scene_region_map_image->addItem(this->region_map_item);
this->scene_region_map_image->setSceneRect(this->scene_region_map_image->sceneRect());
this->ui->graphicsView_Region_Map_BkgImg->setScene(this->scene_region_map_image);
this->ui->graphicsView_Region_Map_BkgImg->setFixedSize(this->region_map->imgSize());
}
// TODO: add if (item) and if(scene) checks because called more than once per instance
void RegionMapEditor::displayRegionMapLayout() {
//
this->region_map_layout_item = new RegionMapLayoutPixmapItem(this->region_map, this->mapsquare_selector_item);
//*
connect(this->region_map_layout_item, &RegionMapLayoutPixmapItem::selectedTileChanged,
this, &RegionMapEditor::onRegionMapLayoutSelectedTileChanged);// TODO: remove this?
connect(this->region_map_layout_item, &RegionMapLayoutPixmapItem::hoveredTileChanged,
this, &RegionMapEditor::onRegionMapLayoutHoveredTileChanged);
connect(this->region_map_layout_item, &RegionMapLayoutPixmapItem::hoveredTileCleared,
this, &RegionMapEditor::onRegionMapLayoutHoveredTileCleared);
//*/
this->region_map_layout_item->draw();
this->region_map_layout_item->setDefaultSelection();
this->scene_region_map_layout = new QGraphicsScene;
this->scene_region_map_layout->addItem(region_map_layout_item);
this->scene_region_map_layout->setSceneRect(this->scene_region_map_layout->sceneRect());
this->ui->graphicsView_Region_Map_Layout->setScene(this->scene_region_map_layout);
this->ui->graphicsView_Region_Map_Layout->setFixedSize(this->region_map->imgSize());
}
void RegionMapEditor::displayRegionMapLayoutOptions() {
//
this->ui->comboBox_RM_ConnectedMap->addItems(*(this->project->regionMapSections));
this->ui->frame_RM_Options->setEnabled(true);
// TODO: change these values to variables
this->ui->spinBox_RM_Options_x->setMaximum(27);
this->ui->spinBox_RM_Options_y->setMaximum(14);
updateRegionMapLayoutOptions(65);
}
void RegionMapEditor::updateRegionMapLayoutOptions(int index) {
//
this->ui->lineEdit_RM_MapName->setText(this->project->mapSecToMapHoverName->value(this->region_map->map_squares[index].mapsec));//this->region_map->map_squares[index].map_name);
this->ui->comboBox_RM_ConnectedMap->setCurrentText(this->region_map->map_squares[index].mapsec);
this->ui->spinBox_RM_Options_x->setValue(this->region_map->map_squares[index].x);
this->ui->spinBox_RM_Options_y->setValue(this->region_map->map_squares[index].y);
}
// TODO: get this to display on a decent scale
void RegionMapEditor::displayRegionMapTileSelector() {
//
this->mapsquare_selector_item = new TilemapTileSelector(QPixmap(this->region_map->region_map_png_path));
this->mapsquare_selector_item->draw();
this->scene_region_map_tiles = new QGraphicsScene;
this->scene_region_map_tiles->addItem(this->mapsquare_selector_item);
connect(this->mapsquare_selector_item, &TilemapTileSelector::selectedTileChanged,
this, &RegionMapEditor::onRegionMapTileSelectorSelectedTileChanged);// TODO: remove this?
connect(this->mapsquare_selector_item, &TilemapTileSelector::hoveredTileChanged,
this, &RegionMapEditor::onRegionMapTileSelectorHoveredTileChanged);
connect(this->mapsquare_selector_item, &TilemapTileSelector::hoveredTileCleared,
this, &RegionMapEditor::onRegionMapTileSelectorHoveredTileCleared);
this->ui->graphicsView_RegionMap_Tiles->setScene(this->scene_region_map_tiles);
this->ui->graphicsView_RegionMap_Tiles->setFixedSize(this->mapsquare_selector_item->pixelWidth + 2,
this->mapsquare_selector_item->pixelHeight + 2);
}
void RegionMapEditor::displayCityMapTileSelector() {
// city_map_selector_item
this->city_map_selector_item = new TilemapTileSelector(QPixmap(this->region_map->region_map_city_map_tiles_path));
this->city_map_selector_item->draw();
this->scene_city_map_tiles = new QGraphicsScene;
this->scene_city_map_tiles->addItem(this->city_map_selector_item);
/*connect(this->city_map_selector_item, &TilemapTileSelector::selectedTileChanged,
this, &RegionMapEditor::onRegionMapTileSelectorSelectedTileChanged);// TODO: remove this?
connect(this->city_map_selector_item, &TilemapTileSelector::hoveredTileChanged,
this, &RegionMapEditor::onRegionMapTileSelectorHoveredTileChanged);
connect(this->city_map_selector_item, &TilemapTileSelector::hoveredTileCleared,
this, &RegionMapEditor::onRegionMapTileSelectorHoveredTileCleared);*/
this->ui->graphicsView_City_Map_Tiles->setScene(this->scene_city_map_tiles);
this->ui->graphicsView_City_Map_Tiles->setFixedSize(this->city_map_selector_item->pixelWidth + 2,
this->city_map_selector_item->pixelHeight + 2);
}
void RegionMapEditor::displayCityMap(QString f) {
//
QString file = this->project->root + "/graphics/pokenav/city_maps/" + f + ".bin";
if (!scene_city_map_image) {
scene_city_map_image = new QGraphicsScene;
}
if (city_map_item && scene_city_map_image) {
scene_city_map_image->removeItem(city_map_item);
delete city_map_item;
}
city_map_item = new CityMapPixmapItem(file, this->city_map_selector_item);
city_map_item->draw();
connect(city_map_item, SIGNAL(mouseEvent(QGraphicsSceneMouseEvent*, CityMapPixmapItem*)),
this, SLOT(mouseEvent_city_map(QGraphicsSceneMouseEvent*, CityMapPixmapItem*)));
scene_city_map_image->addItem(city_map_item);
scene_city_map_image->setSceneRect(this->scene_city_map_image->sceneRect());
this->ui->graphicsView_City_Map->setScene(scene_city_map_image);
this->ui->graphicsView_City_Map->setFixedSize(QSize(82,82));
// set fixed size?
}
////
void RegionMapEditor::onRegionMapTileSelectorSelectedTileChanged() {
//
}
void RegionMapEditor::onRegionMapTileSelectorHoveredTileChanged(unsigned tileId) {
QString message = QString("Tile: 0x") + QString("%1").arg(tileId, 4, 16, QChar('0')).toUpper();
this->ui->statusbar->showMessage(message);
}
void RegionMapEditor::onRegionMapTileSelectorHoveredTileCleared() {
//
//QString message = QString("Selected Tile: 0x") + QString("%1").arg(this->region_map_layout_item->selectedTile, 4, 16, QChar('0')).toUpper();
//this->ui->statusbar->showMessage(message);
}
void RegionMapEditor::onRegionMapLayoutSelectedTileChanged(int index) {
//
QString message = QString();
if (this->region_map->map_squares[index].has_map) {
//
message = QString("Map: %1").arg(this->project->mapSecToMapHoverName->value(
this->region_map->map_squares[index].mapsec)).remove("{NAME_END}");//.remove("{NAME_END}")
}
this->ui->statusbar->showMessage(message);
updateRegionMapLayoutOptions(index);
}
void RegionMapEditor::onRegionMapLayoutHoveredTileChanged(int index) {
// TODO: change to x, y coords not index
QString message = QString();
int x = this->region_map->map_squares[index].x;
int y = this->region_map->map_squares[index].y;
if (x >= 0 && y >= 0) {
message = QString("(%1, %2)").arg(x).arg(y);
if (this->region_map->map_squares[index].has_map) {
//
message += QString("Map: %1").arg(this->project->mapSecToMapHoverName->value(
this->region_map->map_squares[index].mapsec)).remove("{NAME_END}");
}
}
this->ui->statusbar->showMessage(message);
}
void RegionMapEditor::onRegionMapLayoutHoveredTileCleared() {
//
int index = this->region_map_layout_item->selectedTile;
QString message = QString();
int x = this->region_map->map_squares[index].x;
int y = this->region_map->map_squares[index].y;
if (x >= 0 && y >= 0) {
message = QString("(%1, %2)").arg(x).arg(y);
if (this->region_map->map_squares[index].has_map) {
//
message += QString("Map: %1").arg(this->project->mapSecToMapHoverName->value(
this->region_map->map_squares[index].mapsec)).remove("{NAME_END}");
}
}
this->ui->statusbar->showMessage(message);
}
void RegionMapEditor::onHoveredRegionMapTileChanged(int x, int y) {
rmStatusbarMessage = QString("x: %1, y: %2 Tile: 0x").arg(x).arg(y) + QString("%1").arg(this->region_map->getTileId(x, y), 4, 16, QChar('0')).toUpper();
this->ui->statusbar->showMessage(rmStatusbarMessage);
}
void RegionMapEditor::onHoveredRegionMapTileCleared() {
this->ui->statusbar->clearMessage();
}
void RegionMapEditor::mouseEvent_region_map(QGraphicsSceneMouseEvent *event, RegionMapPixmapItem *item) {
//
if (event->buttons() & Qt::RightButton) {
//
item->select(event);
} else if (event->buttons() & Qt::MiddleButton) {
// TODO: add functionality here? replace or?
} else {
//
item->paint(event);
}
}
void RegionMapEditor::mouseEvent_city_map(QGraphicsSceneMouseEvent *event, CityMapPixmapItem *item) {
//
if (event->buttons() & Qt::RightButton) {
//
//item->select(event);
} else if (event->buttons() & Qt::MiddleButton) {
// TODO: add functionality here? replace or?
} else {
//
item->paint(event);
}
}
////
void RegionMapEditor::on_tabWidget_Region_Map_currentChanged(int index) {
//
this->ui->stackedWidget_RM_Options->setCurrentIndex(index);
}
void RegionMapEditor::on_pushButton_RM_Options_save_clicked() {
//
this->region_map->saveOptions(
//
this->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->region_map_layout_item->draw();
}
void RegionMapEditor::on_pushButton_CityMap_save_clicked() {
this->city_map_item->save();
}
void RegionMapEditor::on_comboBox_CityMap_picker_currentTextChanged(const QString &file) {
this->displayCityMap(file);
}