Merge branch 'master' into ruler-tool
This commit is contained in:
commit
40a155329e
24 changed files with 1025 additions and 761 deletions
|
@ -15,6 +15,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
|
||||||
- The New Map dialog now gives an option to specify the "Show Location Name" field.
|
- The New Map dialog now gives an option to specify the "Show Location Name" field.
|
||||||
- Some new shortcuts were added in [porymap/#290](https://github.com/huderlem/porymap/pull/290).
|
- Some new shortcuts were added in [porymap/#290](https://github.com/huderlem/porymap/pull/290).
|
||||||
- All plain text boxes now have a clear button to delete the text.
|
- All plain text boxes now have a clear button to delete the text.
|
||||||
|
- The window sizes and positions of the tileset editor, palette editor, and region map editor are now stored in `porymap.cfg`.
|
||||||
- Add ruler tool for measuring metatile distance in events tab (Right-click to turn on/off, left-click to lock in place).
|
- Add ruler tool for measuring metatile distance in events tab (Right-click to turn on/off, left-click to lock in place).
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
@ -24,6 +25,8 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
|
||||||
- Fix a bug with the current metatile selection zoom.
|
- Fix a bug with the current metatile selection zoom.
|
||||||
- Fix bug preventing the status bar from updating the current position while dragging events.
|
- Fix bug preventing the status bar from updating the current position while dragging events.
|
||||||
- Fix porymap icon not showing on window or panel on Linux.
|
- Fix porymap icon not showing on window or panel on Linux.
|
||||||
|
- The main window can now be resized to fit on lower resolution displays.
|
||||||
|
- Zooming the map in/out will now focus on the cursor.
|
||||||
|
|
||||||
## [4.3.1] - 2020-07-17
|
## [4.3.1] - 2020-07-17
|
||||||
### Added
|
### Added
|
||||||
|
|
9
docsrc/_static/css/custom.css
Normal file
9
docsrc/_static/css/custom.css
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/* do not limit the width of the page */
|
||||||
|
.wy-nav-content {
|
||||||
|
max-width: 75%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wy-side-scroll {
|
||||||
|
width: auto;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
|
@ -99,6 +99,8 @@ html_context = {
|
||||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
html_static_path = ['_static']
|
html_static_path = ['_static']
|
||||||
|
|
||||||
|
html_favicon = '../resources/icons/porymap-icon-2.ico'
|
||||||
|
|
||||||
# Custom sidebar templates, must be a dictionary that maps document names
|
# Custom sidebar templates, must be a dictionary that maps document names
|
||||||
# to template names.
|
# to template names.
|
||||||
#
|
#
|
||||||
|
|
|
@ -243,13 +243,10 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="sprite" native="true">
|
<widget class="QWidget" name="sprite" native="true">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<layout class="QFormLayout" name="formLayout_sprite">
|
<layout class="QFormLayout" name="formLayout_sprite">
|
||||||
|
<property name="rowWrapPolicy">
|
||||||
|
<enum>QFormLayout::WrapLongRows</enum>
|
||||||
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -274,12 +271,6 @@
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="focusPolicy">
|
<property name="focusPolicy">
|
||||||
<enum>Qt::StrongFocus</enum>
|
<enum>Qt::StrongFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -15,6 +15,18 @@
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralWidget">
|
<widget class="QWidget" name="centralWidget">
|
||||||
<layout class="QGridLayout" name="gridLayout_15">
|
<layout class="QGridLayout" name="gridLayout_15">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QSplitter" name="splitter_main">
|
<widget class="QSplitter" name="splitter_main">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -41,7 +53,7 @@
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
|
@ -94,24 +106,6 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="toolButton_ExpandAll">
|
<widget class="QToolButton" name="toolButton_ExpandAll">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Expand all map folders</p></body></html></string>
|
<string><html><head/><body><p>Expand all map folders</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -132,24 +126,6 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="toolButton_CollapseAll">
|
<widget class="QToolButton" name="toolButton_CollapseAll">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>23</width>
|
|
||||||
<height>22</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>23</width>
|
|
||||||
<height>22</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Collapse all map list folders</p></body></html></string>
|
<string><html><head/><body><p>Collapse all map list folders</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -230,10 +206,28 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QFrame" name="frame_Main">
|
<widget class="QFrame" name="frame_Main">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</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>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||||
<item>
|
<item>
|
||||||
|
@ -350,81 +344,6 @@
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QScrollArea" name="scrollArea">
|
|
||||||
<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_5">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>543</width>
|
|
||||||
<height>600</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_8">
|
|
||||||
<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="2">
|
|
||||||
<spacer name="horizontalSpacer_5">
|
|
||||||
<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="1" column="0">
|
|
||||||
<spacer name="horizontalSpacer_4">
|
|
||||||
<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_4">
|
|
||||||
<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="1">
|
|
||||||
<widget class="GraphicsView" name="graphicsView_Map">
|
<widget class="GraphicsView" name="graphicsView_Map">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
@ -438,36 +357,31 @@
|
||||||
<property name="autoFillBackground">
|
<property name="autoFillBackground">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="verticalScrollBarPolicy">
|
||||||
|
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalScrollBarPolicy">
|
||||||
|
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||||
|
</property>
|
||||||
<property name="sizeAdjustPolicy">
|
<property name="sizeAdjustPolicy">
|
||||||
<enum>QAbstractScrollArea::AdjustIgnored</enum>
|
<enum>QAbstractScrollArea::AdjustIgnored</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="dragMode">
|
<property name="dragMode">
|
||||||
<enum>QGraphicsView::NoDrag</enum>
|
<enum>QGraphicsView::NoDrag</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="transformationAnchor">
|
||||||
</item>
|
<enum>QGraphicsView::AnchorUnderMouse</enum>
|
||||||
<item row="2" column="1">
|
|
||||||
<spacer name="verticalSpacer_3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="resizeAnchor">
|
||||||
<size>
|
<enum>QGraphicsView::AnchorUnderMouse</enum>
|
||||||
<width>16</width>
|
|
||||||
<height>166</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QFrame" name="frame_6">
|
<widget class="QFrame" name="frame_mapTools">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -488,19 +402,43 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>4</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>4</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>4</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>4</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>4</number>
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="frame_toolButtons">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_17">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="toolButton_Paint">
|
<widget class="QToolButton" name="toolButton_Paint">
|
||||||
|
@ -616,14 +554,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBox_smartPaths">
|
<widget class="QCheckBox" name="checkBox_smartPaths">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Smart-path mode allows easier drawing of paths. If a 3x3 metatile block is selcted in the right panel, then smart path mode will automatically form a pathway using those selected blocks.</p><p>When smart-path mode is <span style=" font-weight:600;">not</span> enabled, clicking and dragging a selection will tile it in a grid.</p><p>Hold down the <span style=" font-weight:600;">shift</span> key while editing to quickly enable smart-path mode.</p></body></html></string>
|
<string><html><head/><body><p>Smart-path mode allows easier drawing of paths. If a 3x3 metatile block is selcted in the right panel, then smart path mode will automatically form a pathway using those selected blocks.</p><p>When smart-path mode is <span style=" font-weight:600;">not</span> enabled, clicking and dragging a selection will tile it in a grid.</p><p>Hold down the <span style=" font-weight:600;">shift</span> key while editing to quickly enable smart-path mode.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">margin-left: 10px</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Smart Paths</string>
|
<string>Smart Paths</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1212,6 +1150,33 @@
|
||||||
<property name="sizeConstraint">
|
<property name="sizeConstraint">
|
||||||
<enum>QLayout::SetDefaultConstraint</enum>
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QScrollArea" name="scrollArea_1">
|
||||||
|
<property name="widgetResizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>434</width>
|
||||||
|
<height>643</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_7">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1224,61 +1189,16 @@
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="2" column="1">
|
<property name="spacing">
|
||||||
<widget class="QGraphicsView" name="graphicsView_Collision">
|
<number>0</number>
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<item row="0" column="1">
|
||||||
<size>
|
<widget class="QLabel" name="label">
|
||||||
<width>64</width>
|
<property name="text">
|
||||||
<height>512</height>
|
<string>Opacity</string>
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
|
||||||
<spacer name="verticalSpacer_6">
|
|
||||||
<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="2" column="2">
|
|
||||||
<spacer name="horizontalSpacer_19">
|
|
||||||
<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="2" column="0">
|
|
||||||
<spacer name="horizontalSpacer_18">
|
|
||||||
<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="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QSlider" name="horizontalSlider_CollisionTransparency">
|
<widget class="QSlider" name="horizontalSlider_CollisionTransparency">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
|
@ -1295,11 +1215,63 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<spacer name="horizontalSpacer_18">
|
||||||
<property name="text">
|
<property name="orientation">
|
||||||
<string>Opacity</string>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>86</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QGraphicsView" name="graphicsView_Collision">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>64</width>
|
||||||
|
<height>512</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<spacer name="horizontalSpacer_19">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>86</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<spacer name="verticalSpacer_6">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>94</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -1310,6 +1282,18 @@
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="mapView_ObjectInfo">
|
<widget class="QWidget" name="mapView_ObjectInfo">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QFrame" name="frame_Objects">
|
<widget class="QFrame" name="frame_Objects">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
|
@ -1323,7 +1307,7 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>444</width>
|
<width>330</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1379,11 +1363,11 @@
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="NewEventToolButton" name="newEventToolButton">
|
<widget class="NewEventToolButton" name="newEventToolButton">
|
||||||
<property name="minimumSize">
|
<property name="sizePolicy">
|
||||||
<size>
|
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||||
<width>40</width>
|
<horstretch>0</horstretch>
|
||||||
<height>32</height>
|
<verstretch>0</verstretch>
|
||||||
</size>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Add a new event to the map.</p></body></html></string>
|
<string><html><head/><body><p>Add a new event to the map.</p></body></html></string>
|
||||||
|
@ -1403,17 +1387,11 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="toolButton_deleteObject">
|
<widget class="QToolButton" name="toolButton_deleteObject">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>32</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Delete the selected event from the map.</p></body></html></string>
|
<string><html><head/><body><p>Delete the selected event from the map.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1437,18 +1415,12 @@
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="toolButton_Open_Scripts">
|
<widget class="QToolButton" name="toolButton_Open_Scripts">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
|
@ -1758,12 +1730,6 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tab_Attributes">
|
<widget class="QWidget" name="tab_Attributes">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="gridLayout_Attributes">
|
<layout class="QVBoxLayout" name="gridLayout_Attributes">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
|
@ -2151,7 +2117,7 @@
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="1" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QFrame" name="horizontalFrame">
|
<widget class="QFrame" name="horizontalFrame">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
@ -2275,7 +2241,41 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="6" column="0">
|
||||||
|
<widget class="QGraphicsView" name="graphicsView_Connections">
|
||||||
|
<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="verticalScrollBarPolicy">
|
||||||
|
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalScrollBarPolicy">
|
||||||
|
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeAdjustPolicy">
|
||||||
|
<enum>QAbstractScrollArea::AdjustIgnored</enum>
|
||||||
|
</property>
|
||||||
|
<property name="dragMode">
|
||||||
|
<enum>QGraphicsView::NoDrag</enum>
|
||||||
|
</property>
|
||||||
|
<property name="transformationAnchor">
|
||||||
|
<enum>QGraphicsView::AnchorUnderMouse</enum>
|
||||||
|
</property>
|
||||||
|
<property name="resizeAnchor">
|
||||||
|
<enum>QGraphicsView::AnchorUnderMouse</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
<widget class="QFrame" name="horizontalFrame2">
|
<widget class="QFrame" name="horizontalFrame2">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
@ -2391,121 +2391,7 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QFrame" name="gridFrame1">
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::StyledPanel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Raised</enum>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_13">
|
|
||||||
<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="0">
|
|
||||||
<widget class="QScrollArea" name="scrollArea_5">
|
|
||||||
<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_3">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>118</width>
|
|
||||||
<height>118</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_14">
|
|
||||||
<item row="1" column="2">
|
|
||||||
<spacer name="horizontalSpacer_8">
|
|
||||||
<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="2" column="1">
|
|
||||||
<spacer name="verticalSpacer_2">
|
|
||||||
<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">
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<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="1" column="1">
|
|
||||||
<widget class="QGraphicsView" name="graphicsView_Connections">
|
|
||||||
<property name="backgroundBrush">
|
|
||||||
<brush brushstyle="SolidPattern">
|
|
||||||
<color alpha="255">
|
|
||||||
<red>0</red>
|
|
||||||
<green>0</green>
|
|
||||||
<blue>0</blue>
|
|
||||||
</color>
|
|
||||||
</brush>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<spacer name="horizontalSpacer_7">
|
|
||||||
<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>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QFrame" name="horizontalFrame3">
|
<widget class="QFrame" name="horizontalFrame3">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
@ -2590,9 +2476,6 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab_WildMons">
|
<widget class="QWidget" name="tab_WildMons">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<enum>Qt::ClickFocus</enum>
|
<enum>Qt::ClickFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>MainWindow</string>
|
<string>Palette Editor</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
|
|
@ -50,7 +50,10 @@ public:
|
||||||
void setRecentMap(QString map);
|
void setRecentMap(QString map);
|
||||||
void setMapSortOrder(MapSortOrder order);
|
void setMapSortOrder(MapSortOrder order);
|
||||||
void setPrettyCursors(bool enabled);
|
void setPrettyCursors(bool enabled);
|
||||||
void setGeometry(QByteArray, QByteArray, QByteArray, QByteArray);
|
void setMainGeometry(QByteArray, QByteArray, QByteArray, QByteArray);
|
||||||
|
void setTilesetEditorGeometry(QByteArray, QByteArray);
|
||||||
|
void setPaletteEditorGeometry(QByteArray, QByteArray);
|
||||||
|
void setRegionMapEditorGeometry(QByteArray, QByteArray);
|
||||||
void setCollisionOpacity(int opacity);
|
void setCollisionOpacity(int opacity);
|
||||||
void setMetatilesZoom(int zoom);
|
void setMetatilesZoom(int zoom);
|
||||||
void setShowPlayerView(bool enabled);
|
void setShowPlayerView(bool enabled);
|
||||||
|
@ -62,7 +65,10 @@ public:
|
||||||
QString getRecentMap();
|
QString getRecentMap();
|
||||||
MapSortOrder getMapSortOrder();
|
MapSortOrder getMapSortOrder();
|
||||||
bool getPrettyCursors();
|
bool getPrettyCursors();
|
||||||
QMap<QString, QByteArray> getGeometry();
|
QMap<QString, QByteArray> getMainGeometry();
|
||||||
|
QMap<QString, QByteArray> getTilesetEditorGeometry();
|
||||||
|
QMap<QString, QByteArray> getPaletteEditorGeometry();
|
||||||
|
QMap<QString, QByteArray> getRegionMapEditorGeometry();
|
||||||
int getCollisionOpacity();
|
int getCollisionOpacity();
|
||||||
int getMetatilesZoom();
|
int getMetatilesZoom();
|
||||||
bool getShowPlayerView();
|
bool getShowPlayerView();
|
||||||
|
@ -83,11 +89,17 @@ private:
|
||||||
QByteArray bytesFromString(QString);
|
QByteArray bytesFromString(QString);
|
||||||
MapSortOrder mapSortOrder;
|
MapSortOrder mapSortOrder;
|
||||||
bool prettyCursors;
|
bool prettyCursors;
|
||||||
QByteArray windowGeometry;
|
QByteArray mainWindowGeometry;
|
||||||
QByteArray windowState;
|
QByteArray mainWindowState;
|
||||||
QByteArray mapSplitterState;
|
QByteArray mapSplitterState;
|
||||||
QByteArray eventsSlpitterState;
|
QByteArray eventsSlpitterState;
|
||||||
QByteArray mainSplitterState;
|
QByteArray mainSplitterState;
|
||||||
|
QByteArray tilesetEditorGeometry;
|
||||||
|
QByteArray tilesetEditorState;
|
||||||
|
QByteArray paletteEditorGeometry;
|
||||||
|
QByteArray paletteEditorState;
|
||||||
|
QByteArray regionMapEditorGeometry;
|
||||||
|
QByteArray regionMapEditorState;
|
||||||
int collisionOpacity;
|
int collisionOpacity;
|
||||||
int metatilesZoom;
|
int metatilesZoom;
|
||||||
bool showPlayerView;
|
bool showPlayerView;
|
||||||
|
|
|
@ -65,6 +65,7 @@ public:
|
||||||
void displayMapBorder();
|
void displayMapBorder();
|
||||||
void displayMapGrid();
|
void displayMapGrid();
|
||||||
void displayWildMonTables();
|
void displayWildMonTables();
|
||||||
|
void maskNonVisibleConnectionTiles();
|
||||||
|
|
||||||
void updateMapBorder();
|
void updateMapBorder();
|
||||||
void updateMapConnections();
|
void updateMapConnections();
|
||||||
|
@ -110,6 +111,7 @@ public:
|
||||||
ConnectionPixmapItem* selected_connection_item = nullptr;
|
ConnectionPixmapItem* selected_connection_item = nullptr;
|
||||||
QList<QGraphicsPixmapItem*> connection_items;
|
QList<QGraphicsPixmapItem*> connection_items;
|
||||||
QList<ConnectionPixmapItem*> connection_edit_items;
|
QList<ConnectionPixmapItem*> connection_edit_items;
|
||||||
|
QGraphicsPathItem *connection_mask = nullptr;
|
||||||
CollisionPixmapItem *collision_item = nullptr;
|
CollisionPixmapItem *collision_item = nullptr;
|
||||||
QGraphicsItemGroup *events_group = nullptr;
|
QGraphicsItemGroup *events_group = nullptr;
|
||||||
QList<QGraphicsPixmapItem*> borderItems;
|
QList<QGraphicsPixmapItem*> borderItems;
|
||||||
|
@ -150,6 +152,7 @@ public:
|
||||||
bool selectingEvent = false;
|
bool selectingEvent = false;
|
||||||
|
|
||||||
void shouldReselectEvents();
|
void shouldReselectEvents();
|
||||||
|
void scaleMapView(int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setConnectionItemsVisible(bool);
|
void setConnectionItemsVisible(bool);
|
||||||
|
@ -200,6 +203,7 @@ private slots:
|
||||||
void onHoveredMapMovementPermissionChanged(int, int);
|
void onHoveredMapMovementPermissionChanged(int, int);
|
||||||
void onHoveredMapMovementPermissionCleared();
|
void onHoveredMapMovementPermissionCleared();
|
||||||
void onSelectedMetatilesChanged();
|
void onSelectedMetatilesChanged();
|
||||||
|
void onWheelZoom(int);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void objectsChanged();
|
void objectsChanged();
|
||||||
|
@ -208,7 +212,6 @@ signals:
|
||||||
void wildMonDataChanged();
|
void wildMonDataChanged();
|
||||||
void warpEventDoubleClicked(QString mapName, QString warpNum);
|
void warpEventDoubleClicked(QString mapName, QString warpNum);
|
||||||
void currentMetatilesSelectionChanged();
|
void currentMetatilesSelectionChanged();
|
||||||
void wheelZoom(int delta);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EDITOR_H
|
#endif // EDITOR_H
|
||||||
|
|
|
@ -20,5 +20,6 @@ void logError(QString message);
|
||||||
void log(QString message, LogType type);
|
void log(QString message, LogType type);
|
||||||
QString getLogPath();
|
QString getLogPath();
|
||||||
QString getMostRecentError();
|
QString getMostRecentError();
|
||||||
|
bool cleanupLargeLog();
|
||||||
|
|
||||||
#endif // LOG_H
|
#endif // LOG_H
|
||||||
|
|
|
@ -109,11 +109,6 @@ public:
|
||||||
Q_INVOKABLE QList<float> getMetatileLayerOpacity();
|
Q_INVOKABLE QList<float> getMetatileLayerOpacity();
|
||||||
Q_INVOKABLE void setMetatileLayerOpacity(QList<float> order);
|
Q_INVOKABLE void setMetatileLayerOpacity(QList<float> order);
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void scaleMapView(int);
|
|
||||||
void onWheelZoom(int);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_action_Open_Project_triggered();
|
void on_action_Open_Project_triggered();
|
||||||
void on_action_Reload_Project_triggered();
|
void on_action_Reload_Project_triggered();
|
||||||
|
|
37
include/ui/flowlayout.h
Normal file
37
include/ui/flowlayout.h
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#ifndef FLOWLAYOUT_H
|
||||||
|
#define FLOWLAYOUT_H
|
||||||
|
|
||||||
|
#include <QLayout>
|
||||||
|
#include <QStyle>
|
||||||
|
|
||||||
|
|
||||||
|
class FlowLayout : public QLayout
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit FlowLayout(QWidget *parent, int margin = -1, int hSpacing = -1, int vSpacing = -1);
|
||||||
|
explicit FlowLayout(int margin = -1, int hSpacing = -1, int vSpacing = -1);
|
||||||
|
~FlowLayout();
|
||||||
|
|
||||||
|
void addItem(QLayoutItem *item) override;
|
||||||
|
int horizontalSpacing() const;
|
||||||
|
int verticalSpacing() const;
|
||||||
|
Qt::Orientations expandingDirections() const override;
|
||||||
|
bool hasHeightForWidth() const override;
|
||||||
|
int heightForWidth(int) const override;
|
||||||
|
int count() const override;
|
||||||
|
QLayoutItem *itemAt(int index) const override;
|
||||||
|
QSize minimumSize() const override;
|
||||||
|
void setGeometry(const QRect &rect) override;
|
||||||
|
QSize sizeHint() const override;
|
||||||
|
QLayoutItem *takeAt(int index) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int doLayout(const QRect &rect, bool testOnly) const;
|
||||||
|
int smartSpacing(QStyle::PixelMetric pm) const;
|
||||||
|
|
||||||
|
QList<QLayoutItem *> itemList;
|
||||||
|
int horzSpace;
|
||||||
|
int vertSpace;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FLOWLAYOUT_H
|
|
@ -45,7 +45,9 @@ private:
|
||||||
void refreshColor(int);
|
void refreshColor(int);
|
||||||
void setColor(int);
|
void setColor(int);
|
||||||
void commitEditHistory(int paletteid);
|
void commitEditHistory(int paletteid);
|
||||||
|
void restoreWindowState();
|
||||||
void setColorsFromHistory(PaletteHistoryItem*, int);
|
void setColorsFromHistory(PaletteHistoryItem*, int);
|
||||||
|
void closeEvent(QCloseEvent*);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void closed();
|
void closed();
|
||||||
|
|
|
@ -97,6 +97,7 @@ private:
|
||||||
bool createCityMap(QString name);
|
bool createCityMap(QString name);
|
||||||
bool tryInsertNewMapEntry(QString);
|
bool tryInsertNewMapEntry(QString);
|
||||||
|
|
||||||
|
void restoreWindowState();
|
||||||
void closeEvent(QCloseEvent* event);
|
void closeEvent(QCloseEvent* event);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
|
@ -37,8 +37,9 @@ class TilesetEditor : public QMainWindow
|
||||||
public:
|
public:
|
||||||
explicit TilesetEditor(Project*, Map*, QWidget *parent = nullptr);
|
explicit TilesetEditor(Project*, Map*, QWidget *parent = nullptr);
|
||||||
~TilesetEditor();
|
~TilesetEditor();
|
||||||
void setMap(Map*);
|
void update(Map *map, QString primaryTilsetLabel, QString secondaryTilesetLabel);
|
||||||
void setTilesets(QString, QString);
|
void updateMap(Map *map);
|
||||||
|
void updateTilesets(QString primaryTilsetLabel, QString secondaryTilesetLabel);
|
||||||
bool selectMetatile(uint16_t metatileId);
|
bool selectMetatile(uint16_t metatileId);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -92,17 +93,25 @@ private slots:
|
||||||
void on_actionImport_Secondary_Metatiles_triggered();
|
void on_actionImport_Secondary_Metatiles_triggered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init(Project*, Map*);
|
void initUi();
|
||||||
void closeEvent(QCloseEvent*);
|
void setMetatileBehaviors();
|
||||||
void initMetatileSelector(Map*);
|
void setMetatileLayersUi();
|
||||||
|
void setVersionSpecificUi();
|
||||||
|
void setMetatileLabelValidator();
|
||||||
|
void initMetatileSelector();
|
||||||
void initTileSelector();
|
void initTileSelector();
|
||||||
void initSelectedTileItem();
|
void initSelectedTileItem();
|
||||||
void initMetatileLayersItem();
|
void initMetatileLayersItem();
|
||||||
|
void restoreWindowState();
|
||||||
|
void initMetatileHistory();
|
||||||
|
void setTilesets(QString primaryTilesetLabel, QString secondaryTilesetLabel);
|
||||||
|
void reset();
|
||||||
void drawSelectedTiles();
|
void drawSelectedTiles();
|
||||||
void importTilesetTiles(Tileset*, bool);
|
void importTilesetTiles(Tileset*, bool);
|
||||||
void importTilesetMetatiles(Tileset*, bool);
|
void importTilesetMetatiles(Tileset*, bool);
|
||||||
void refresh();
|
void refresh();
|
||||||
void saveMetatileLabel();
|
void saveMetatileLabel();
|
||||||
|
void closeEvent(QCloseEvent*);
|
||||||
Ui::TilesetEditor *ui;
|
Ui::TilesetEditor *ui;
|
||||||
History<MetatileHistoryItem*> metatileHistory;
|
History<MetatileHistoryItem*> metatileHistory;
|
||||||
TilesetEditorMetatileSelector *metatileSelector = nullptr;
|
TilesetEditorMetatileSelector *metatileSelector = nullptr;
|
||||||
|
@ -110,6 +119,7 @@ private:
|
||||||
MetatileLayersItem *metatileLayersItem = nullptr;
|
MetatileLayersItem *metatileLayersItem = nullptr;
|
||||||
PaletteEditor *paletteEditor = nullptr;
|
PaletteEditor *paletteEditor = nullptr;
|
||||||
Project *project = nullptr;
|
Project *project = nullptr;
|
||||||
|
Map *map = nullptr;
|
||||||
Metatile *metatile = nullptr;
|
Metatile *metatile = nullptr;
|
||||||
int paletteId;
|
int paletteId;
|
||||||
bool tileXFlip;
|
bool tileXFlip;
|
||||||
|
|
|
@ -69,6 +69,7 @@ SOURCES += src/core/block.cpp \
|
||||||
src/ui/newmappopup.cpp \
|
src/ui/newmappopup.cpp \
|
||||||
src/ui/mapimageexporter.cpp \
|
src/ui/mapimageexporter.cpp \
|
||||||
src/ui/newtilesetdialog.cpp \
|
src/ui/newtilesetdialog.cpp \
|
||||||
|
src/ui/flowlayout.cpp \
|
||||||
src/ui/mapruler.cpp \
|
src/ui/mapruler.cpp \
|
||||||
src/config.cpp \
|
src/config.cpp \
|
||||||
src/editor.cpp \
|
src/editor.cpp \
|
||||||
|
@ -137,6 +138,7 @@ HEADERS += include/core/block.h \
|
||||||
include/ui/mapimageexporter.h \
|
include/ui/mapimageexporter.h \
|
||||||
include/ui/newtilesetdialog.h \
|
include/ui/newtilesetdialog.h \
|
||||||
include/ui/overlay.h \
|
include/ui/overlay.h \
|
||||||
|
include/ui/flowlayout.h \
|
||||||
include/ui/mapruler.h \
|
include/ui/mapruler.h \
|
||||||
include/config.h \
|
include/config.h \
|
||||||
include/editor.h \
|
include/editor.h \
|
||||||
|
|
|
@ -122,10 +122,10 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) {
|
||||||
this->mapSortOrder = MapSortOrder::Group;
|
this->mapSortOrder = MapSortOrder::Group;
|
||||||
logWarn(QString("Invalid config value for map_sort_order: '%1'. Must be 'group', 'area', or 'layout'.").arg(value));
|
logWarn(QString("Invalid config value for map_sort_order: '%1'. Must be 'group', 'area', or 'layout'.").arg(value));
|
||||||
}
|
}
|
||||||
} else if (key == "window_geometry") {
|
} else if (key == "main_window_geometry") {
|
||||||
this->windowGeometry = bytesFromString(value);
|
this->mainWindowGeometry = bytesFromString(value);
|
||||||
} else if (key == "window_state") {
|
} else if (key == "main_window_state") {
|
||||||
this->windowState = bytesFromString(value);
|
this->mainWindowState = bytesFromString(value);
|
||||||
} else if (key == "map_splitter_state") {
|
} else if (key == "map_splitter_state") {
|
||||||
this->mapSplitterState = bytesFromString(value);
|
this->mapSplitterState = bytesFromString(value);
|
||||||
} else if (key == "main_splitter_state") {
|
} else if (key == "main_splitter_state") {
|
||||||
|
@ -137,6 +137,18 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) {
|
||||||
logWarn(QString("Invalid config value for collision_opacity: '%1'. Must be an integer.").arg(value));
|
logWarn(QString("Invalid config value for collision_opacity: '%1'. Must be an integer.").arg(value));
|
||||||
this->collisionOpacity = 50;
|
this->collisionOpacity = 50;
|
||||||
}
|
}
|
||||||
|
} else if (key == "tileset_editor_geometry") {
|
||||||
|
this->tilesetEditorGeometry = bytesFromString(value);
|
||||||
|
} else if (key == "tileset_editor_state") {
|
||||||
|
this->tilesetEditorState = bytesFromString(value);
|
||||||
|
} else if (key == "palette_editor_geometry") {
|
||||||
|
this->paletteEditorGeometry = bytesFromString(value);
|
||||||
|
} else if (key == "palette_editor_state") {
|
||||||
|
this->paletteEditorState = bytesFromString(value);
|
||||||
|
} else if (key == "region_map_editor_geometry") {
|
||||||
|
this->regionMapEditorGeometry = bytesFromString(value);
|
||||||
|
} else if (key == "region_map_editor_state") {
|
||||||
|
this->regionMapEditorState = bytesFromString(value);
|
||||||
} else if (key == "metatiles_zoom") {
|
} else if (key == "metatiles_zoom") {
|
||||||
bool ok;
|
bool ok;
|
||||||
this->metatilesZoom = qMax(10, qMin(100, value.toInt(&ok)));
|
this->metatilesZoom = qMax(10, qMin(100, value.toInt(&ok)));
|
||||||
|
@ -186,10 +198,16 @@ QMap<QString, QString> PorymapConfig::getKeyValueMap() {
|
||||||
map.insert("recent_map", this->recentMap);
|
map.insert("recent_map", this->recentMap);
|
||||||
map.insert("pretty_cursors", this->prettyCursors ? "1" : "0");
|
map.insert("pretty_cursors", this->prettyCursors ? "1" : "0");
|
||||||
map.insert("map_sort_order", mapSortOrderMap.value(this->mapSortOrder));
|
map.insert("map_sort_order", mapSortOrderMap.value(this->mapSortOrder));
|
||||||
map.insert("window_geometry", stringFromByteArray(this->windowGeometry));
|
map.insert("main_window_geometry", stringFromByteArray(this->mainWindowGeometry));
|
||||||
map.insert("window_state", stringFromByteArray(this->windowState));
|
map.insert("main_window_state", stringFromByteArray(this->mainWindowState));
|
||||||
map.insert("map_splitter_state", stringFromByteArray(this->mapSplitterState));
|
map.insert("map_splitter_state", stringFromByteArray(this->mapSplitterState));
|
||||||
map.insert("main_splitter_state", stringFromByteArray(this->mainSplitterState));
|
map.insert("main_splitter_state", stringFromByteArray(this->mainSplitterState));
|
||||||
|
map.insert("tileset_editor_geometry", stringFromByteArray(this->tilesetEditorGeometry));
|
||||||
|
map.insert("tileset_editor_state", stringFromByteArray(this->tilesetEditorState));
|
||||||
|
map.insert("palette_editor_geometry", stringFromByteArray(this->paletteEditorGeometry));
|
||||||
|
map.insert("palette_editor_state", stringFromByteArray(this->paletteEditorState));
|
||||||
|
map.insert("region_map_editor_geometry", stringFromByteArray(this->regionMapEditorGeometry));
|
||||||
|
map.insert("region_map_editor_state", stringFromByteArray(this->regionMapEditorState));
|
||||||
map.insert("collision_opacity", QString("%1").arg(this->collisionOpacity));
|
map.insert("collision_opacity", QString("%1").arg(this->collisionOpacity));
|
||||||
map.insert("metatiles_zoom", QString("%1").arg(this->metatilesZoom));
|
map.insert("metatiles_zoom", QString("%1").arg(this->metatilesZoom));
|
||||||
map.insert("show_player_view", this->showPlayerView ? "1" : "0");
|
map.insert("show_player_view", this->showPlayerView ? "1" : "0");
|
||||||
|
@ -243,15 +261,33 @@ void PorymapConfig::setMonitorFiles(bool monitor) {
|
||||||
this->save();
|
this->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PorymapConfig::setGeometry(QByteArray windowGeometry_, QByteArray windowState_,
|
void PorymapConfig::setMainGeometry(QByteArray mainWindowGeometry_, QByteArray mainWindowState_,
|
||||||
QByteArray mapSplitterState_, QByteArray mainSplitterState_) {
|
QByteArray mapSplitterState_, QByteArray mainSplitterState_) {
|
||||||
this->windowGeometry = windowGeometry_;
|
this->mainWindowGeometry = mainWindowGeometry_;
|
||||||
this->windowState = windowState_;
|
this->mainWindowState = mainWindowState_;
|
||||||
this->mapSplitterState = mapSplitterState_;
|
this->mapSplitterState = mapSplitterState_;
|
||||||
this->mainSplitterState = mainSplitterState_;
|
this->mainSplitterState = mainSplitterState_;
|
||||||
this->save();
|
this->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PorymapConfig::setTilesetEditorGeometry(QByteArray tilesetEditorGeometry_, QByteArray tilesetEditorState_) {
|
||||||
|
this->tilesetEditorGeometry = tilesetEditorGeometry_;
|
||||||
|
this->tilesetEditorState = tilesetEditorState_;
|
||||||
|
this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PorymapConfig::setPaletteEditorGeometry(QByteArray paletteEditorGeometry_, QByteArray paletteEditorState_) {
|
||||||
|
this->paletteEditorGeometry = paletteEditorGeometry_;
|
||||||
|
this->paletteEditorState = paletteEditorState_;
|
||||||
|
this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PorymapConfig::setRegionMapEditorGeometry(QByteArray regionMapEditorGeometry_, QByteArray regionMapEditorState_) {
|
||||||
|
this->regionMapEditorGeometry = regionMapEditorGeometry_;
|
||||||
|
this->regionMapEditorState = regionMapEditorState_;
|
||||||
|
this->save();
|
||||||
|
}
|
||||||
|
|
||||||
void PorymapConfig::setCollisionOpacity(int opacity) {
|
void PorymapConfig::setCollisionOpacity(int opacity) {
|
||||||
this->collisionOpacity = opacity;
|
this->collisionOpacity = opacity;
|
||||||
// don't auto-save here because this can be called very frequently.
|
// don't auto-save here because this can be called very frequently.
|
||||||
|
@ -296,17 +332,44 @@ bool PorymapConfig::getPrettyCursors() {
|
||||||
return this->prettyCursors;
|
return this->prettyCursors;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, QByteArray> PorymapConfig::getGeometry() {
|
QMap<QString, QByteArray> PorymapConfig::getMainGeometry() {
|
||||||
QMap<QString, QByteArray> geometry;
|
QMap<QString, QByteArray> geometry;
|
||||||
|
|
||||||
geometry.insert("window_geometry", this->windowGeometry);
|
geometry.insert("main_window_geometry", this->mainWindowGeometry);
|
||||||
geometry.insert("window_state", this->windowState);
|
geometry.insert("main_window_state", this->mainWindowState);
|
||||||
geometry.insert("map_splitter_state", this->mapSplitterState);
|
geometry.insert("map_splitter_state", this->mapSplitterState);
|
||||||
geometry.insert("main_splitter_state", this->mainSplitterState);
|
geometry.insert("main_splitter_state", this->mainSplitterState);
|
||||||
|
|
||||||
return geometry;
|
return geometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QMap<QString, QByteArray> PorymapConfig::getTilesetEditorGeometry() {
|
||||||
|
QMap<QString, QByteArray> geometry;
|
||||||
|
|
||||||
|
geometry.insert("tileset_editor_geometry", this->tilesetEditorGeometry);
|
||||||
|
geometry.insert("tileset_editor_state", this->tilesetEditorState);
|
||||||
|
|
||||||
|
return geometry;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<QString, QByteArray> PorymapConfig::getPaletteEditorGeometry() {
|
||||||
|
QMap<QString, QByteArray> geometry;
|
||||||
|
|
||||||
|
geometry.insert("palette_editor_geometry", this->paletteEditorGeometry);
|
||||||
|
geometry.insert("palette_editor_state", this->paletteEditorState);
|
||||||
|
|
||||||
|
return geometry;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<QString, QByteArray> PorymapConfig::getRegionMapEditorGeometry() {
|
||||||
|
QMap<QString, QByteArray> geometry;
|
||||||
|
|
||||||
|
geometry.insert("region_map_editor_geometry", this->regionMapEditorGeometry);
|
||||||
|
geometry.insert("region_map_editor_state", this->regionMapEditorState);
|
||||||
|
|
||||||
|
return geometry;
|
||||||
|
}
|
||||||
|
|
||||||
int PorymapConfig::getCollisionOpacity() {
|
int PorymapConfig::getCollisionOpacity() {
|
||||||
return this->collisionOpacity;
|
return this->collisionOpacity;
|
||||||
}
|
}
|
||||||
|
|
|
@ -762,11 +762,13 @@ void Editor::updateCurrentConnectionDirection(QString curDirection) {
|
||||||
QString originalDirection = selected_connection_item->connection->direction;
|
QString originalDirection = selected_connection_item->connection->direction;
|
||||||
setCurrentConnectionDirection(curDirection);
|
setCurrentConnectionDirection(curDirection);
|
||||||
updateMirroredConnectionDirection(selected_connection_item->connection, originalDirection);
|
updateMirroredConnectionDirection(selected_connection_item->connection, originalDirection);
|
||||||
|
maskNonVisibleConnectionTiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::onConnectionMoved(MapConnection* connection) {
|
void Editor::onConnectionMoved(MapConnection* connection) {
|
||||||
updateMirroredConnectionOffset(connection);
|
updateMirroredConnectionOffset(connection);
|
||||||
onConnectionOffsetChanged(connection->offset.toInt());
|
onConnectionOffsetChanged(connection->offset.toInt());
|
||||||
|
maskNonVisibleConnectionTiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::onConnectionOffsetChanged(int newOffset) {
|
void Editor::onConnectionOffsetChanged(int newOffset) {
|
||||||
|
@ -890,11 +892,31 @@ void Editor::onSelectedMetatilesChanged() {
|
||||||
this->redrawCurrentMetatilesSelection();
|
this->redrawCurrentMetatilesSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Editor::onWheelZoom(int s) {
|
||||||
|
// Don't zoom the map when the user accidentally scrolls while performing a magic fill. (ctrl + middle button click)
|
||||||
|
if (!(QApplication::mouseButtons() & Qt::MiddleButton)) {
|
||||||
|
scaleMapView(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Editor::scaleMapView(int s) {
|
||||||
|
if ((scale_exp + s) <= 5 && (scale_exp + s) >= -2) // sane limits
|
||||||
|
{
|
||||||
|
if (s == 0)
|
||||||
|
scale_exp = 0;
|
||||||
|
else
|
||||||
|
scale_exp += s;
|
||||||
|
|
||||||
|
double sfactor = pow(scale_base, s);
|
||||||
|
ui->graphicsView_Map->scale(sfactor, sfactor);
|
||||||
|
ui->graphicsView_Connections->scale(sfactor, sfactor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Editor::onHoveredMapMetatileChanged(const QPointF &scenePos, const QPoint &screenPos) {
|
void Editor::onHoveredMapMetatileChanged(const QPointF &scenePos, const QPoint &screenPos) {
|
||||||
QPoint pos = Metatile::coordFromPixmapCoord(scenePos);
|
QPoint pos = Metatile::coordFromPixmapCoord(scenePos);
|
||||||
this->playerViewRect->updateLocation(pos.x(), pos.y());
|
this->playerViewRect->updateLocation(pos.x(), pos.y());
|
||||||
this->cursorMapTileRect->updateLocation(pos.x(), pos.y());
|
this->cursorMapTileRect->updateLocation(pos.x(), pos.y());
|
||||||
|
|
||||||
if (map_item->paintingMode == MapPixmapItem::PaintMode::Metatiles
|
if (map_item->paintingMode == MapPixmapItem::PaintMode::Metatiles
|
||||||
&& pos.x() >= 0 && pos.x() < map->getWidth() && pos.y() >= 0 && pos.y() < map->getHeight()) {
|
&& pos.x() >= 0 && pos.x() < map->getWidth() && pos.y() >= 0 && pos.y() < map->getHeight()) {
|
||||||
int blockIndex = pos.y() * map->getWidth() + pos.x();
|
int blockIndex = pos.y() * map->getWidth() + pos.x();
|
||||||
|
@ -1222,7 +1244,7 @@ bool Editor::displayMap() {
|
||||||
scene = new QGraphicsScene;
|
scene = new QGraphicsScene;
|
||||||
MapSceneEventFilter *filter = new MapSceneEventFilter();
|
MapSceneEventFilter *filter = new MapSceneEventFilter();
|
||||||
scene->installEventFilter(filter);
|
scene->installEventFilter(filter);
|
||||||
connect(filter, &MapSceneEventFilter::wheelZoom, this, &Editor::wheelZoom);
|
connect(filter, &MapSceneEventFilter::wheelZoom, this, &Editor::onWheelZoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (map_item && scene) {
|
if (map_item && scene) {
|
||||||
|
@ -1453,6 +1475,8 @@ void Editor::displayMapConnections() {
|
||||||
if (!connection_edit_items.empty()) {
|
if (!connection_edit_items.empty()) {
|
||||||
onConnectionItemSelected(connection_edit_items.first());
|
onConnectionItemSelected(connection_edit_items.first());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
maskNonVisibleConnectionTiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::createConnectionItem(MapConnection* connection, bool hide) {
|
void Editor::createConnectionItem(MapConnection* connection, bool hide) {
|
||||||
|
@ -1497,6 +1521,31 @@ void Editor::createConnectionItem(MapConnection* connection, bool hide) {
|
||||||
connection_edit_items.append(connection_edit_item);
|
connection_edit_items.append(connection_edit_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hides connected map tiles that cannot be seen from the current map (beyond BORDER_DISTANCE).
|
||||||
|
void Editor::maskNonVisibleConnectionTiles() {
|
||||||
|
if (connection_mask) {
|
||||||
|
if (connection_mask->scene()) {
|
||||||
|
connection_mask->scene()->removeItem(connection_mask);
|
||||||
|
}
|
||||||
|
delete connection_mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPainterPath mask;
|
||||||
|
mask.addRect(scene->itemsBoundingRect().toRect());
|
||||||
|
mask.addRect(
|
||||||
|
-BORDER_DISTANCE * 16,
|
||||||
|
-BORDER_DISTANCE * 16,
|
||||||
|
(map->getWidth() + BORDER_DISTANCE * 2) * 16,
|
||||||
|
(map->getHeight() + BORDER_DISTANCE * 2) * 16
|
||||||
|
);
|
||||||
|
|
||||||
|
// Mask the tiles with the current theme's background color.
|
||||||
|
QPen pen(ui->graphicsView_Map->palette().color(QPalette::Active, QPalette::Base));
|
||||||
|
QBrush brush(ui->graphicsView_Map->palette().color(QPalette::Active, QPalette::Base));
|
||||||
|
|
||||||
|
connection_mask = scene->addPath(mask, pen, brush);
|
||||||
|
}
|
||||||
|
|
||||||
void Editor::displayMapBorder() {
|
void Editor::displayMapBorder() {
|
||||||
for (QGraphicsPixmapItem* item : borderItems) {
|
for (QGraphicsPixmapItem* item : borderItems) {
|
||||||
if (item->scene()) {
|
if (item->scene()) {
|
||||||
|
@ -1543,6 +1592,8 @@ void Editor::updateMapConnections() {
|
||||||
connection_edit_items[i]->basePixmap = pixmap;
|
connection_edit_items[i]->basePixmap = pixmap;
|
||||||
connection_edit_items[i]->setPixmap(pixmap);
|
connection_edit_items[i]->setPixmap(pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
maskNonVisibleConnectionTiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
int Editor::getBorderDrawDistance(int dimension) {
|
int Editor::getBorderDrawDistance(int dimension) {
|
||||||
|
@ -1599,6 +1650,7 @@ void Editor::updateConnectionOffset(int offset) {
|
||||||
}
|
}
|
||||||
selected_connection_item->blockSignals(false);
|
selected_connection_item->blockSignals(false);
|
||||||
updateMirroredConnectionOffset(selected_connection_item->connection);
|
updateMirroredConnectionOffset(selected_connection_item->connection);
|
||||||
|
maskNonVisibleConnectionTiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setConnectionMap(QString mapName) {
|
void Editor::setConnectionMap(QString mapName) {
|
||||||
|
@ -1609,7 +1661,7 @@ void Editor::setConnectionMap(QString mapName) {
|
||||||
if (!selected_connection_item)
|
if (!selected_connection_item)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mapName.isEmpty()) {
|
if (mapName.isEmpty() || mapName == NONE_MAP_NAME) {
|
||||||
removeCurrentConnection();
|
removeCurrentConnection();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1619,6 +1671,7 @@ void Editor::setConnectionMap(QString mapName) {
|
||||||
selected_connection_item->connection->map_name = mapName;
|
selected_connection_item->connection->map_name = mapName;
|
||||||
setCurrentConnectionDirection(selected_connection_item->connection->direction);
|
setCurrentConnectionDirection(selected_connection_item->connection->direction);
|
||||||
updateMirroredConnectionMap(selected_connection_item->connection, originalMapName);
|
updateMirroredConnectionMap(selected_connection_item->connection, originalMapName);
|
||||||
|
maskNonVisibleConnectionTiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::addNewConnection() {
|
void Editor::addNewConnection() {
|
||||||
|
@ -1760,7 +1813,7 @@ void Editor::updateDiveEmergeMap(QString mapName, QString direction) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapName.isEmpty()) {
|
if (mapName.isEmpty() || mapName == NONE_MAP_NAME) {
|
||||||
// Remove dive/emerge connection
|
// Remove dive/emerge connection
|
||||||
if (connection) {
|
if (connection) {
|
||||||
map->connections.removeOne(connection);
|
map->connections.removeOne(connection);
|
||||||
|
|
11
src/log.cpp
11
src/log.cpp
|
@ -86,3 +86,14 @@ QString getLogPath() {
|
||||||
QString getMostRecentError() {
|
QString getMostRecentError() {
|
||||||
return mostRecentError;
|
return mostRecentError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cleanupLargeLog() {
|
||||||
|
QFile logFile(getLogPath());
|
||||||
|
if (logFile.size() < 20000000)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool removed = logFile.remove();
|
||||||
|
if (removed)
|
||||||
|
logWarn(QString("Previous log file %1 was cleared due to being over 20MB in size.").arg(getLogPath()));
|
||||||
|
return removed;
|
||||||
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "adjustingstackedwidget.h"
|
#include "adjustingstackedwidget.h"
|
||||||
#include "draggablepixmapitem.h"
|
#include "draggablepixmapitem.h"
|
||||||
#include "editcommands.h"
|
#include "editcommands.h"
|
||||||
|
#include "flowlayout.h"
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
|
@ -53,6 +54,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
QApplication::setWindowIcon(QIcon(":/icons/porymap-icon-2.ico"));
|
QApplication::setWindowIcon(QIcon(":/icons/porymap-icon-2.ico"));
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
cleanupLargeLog();
|
||||||
|
|
||||||
this->initWindow();
|
this->initWindow();
|
||||||
if (!this->openRecentProject()) {
|
if (!this->openRecentProject()) {
|
||||||
// Re-initialize everything to a blank slate if opening the recent project failed.
|
// Re-initialize everything to a blank slate if opening the recent project failed.
|
||||||
|
@ -133,6 +136,19 @@ void MainWindow::initCustomUI() {
|
||||||
connect(labelCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), [=](int index){
|
connect(labelCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), [=](int index){
|
||||||
stack->setCurrentIndex(index);
|
stack->setCurrentIndex(index);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Convert the layout of the map tools' frame into an adjustable FlowLayout
|
||||||
|
FlowLayout *flowLayout = new FlowLayout;
|
||||||
|
flowLayout->setContentsMargins(ui->frame_mapTools->layout()->contentsMargins());
|
||||||
|
flowLayout->setSpacing(ui->frame_mapTools->layout()->spacing());
|
||||||
|
for (auto *child : ui->frame_mapTools->findChildren<QWidget *>(QString(), Qt::FindDirectChildrenOnly)) {
|
||||||
|
flowLayout->addWidget(child);
|
||||||
|
child->setFixedHeight(
|
||||||
|
ui->frame_mapTools->height() - flowLayout->contentsMargins().top() - flowLayout->contentsMargins().bottom()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
delete ui->frame_mapTools->layout();
|
||||||
|
ui->frame_mapTools->setLayout(flowLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::initExtraSignals() {
|
void MainWindow::initExtraSignals() {
|
||||||
|
@ -148,7 +164,6 @@ void MainWindow::initEditor() {
|
||||||
connect(this->editor, SIGNAL(warpEventDoubleClicked(QString,QString)), this, SLOT(openWarpMap(QString,QString)));
|
connect(this->editor, SIGNAL(warpEventDoubleClicked(QString,QString)), this, SLOT(openWarpMap(QString,QString)));
|
||||||
connect(this->editor, SIGNAL(currentMetatilesSelectionChanged()), this, SLOT(currentMetatilesSelectionChanged()));
|
connect(this->editor, SIGNAL(currentMetatilesSelectionChanged()), this, SLOT(currentMetatilesSelectionChanged()));
|
||||||
connect(this->editor, SIGNAL(wildMonDataChanged()), this, SLOT(onWildMonDataChanged()));
|
connect(this->editor, SIGNAL(wildMonDataChanged()), this, SLOT(onWildMonDataChanged()));
|
||||||
connect(this->editor, &Editor::wheelZoom, this, &MainWindow::onWheelZoom);
|
|
||||||
|
|
||||||
this->loadUserSettings();
|
this->loadUserSettings();
|
||||||
|
|
||||||
|
@ -348,10 +363,10 @@ void MainWindow::loadUserSettings() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::restoreWindowState() {
|
void MainWindow::restoreWindowState() {
|
||||||
logInfo("Restoring window geometry from previous session.");
|
logInfo("Restoring main window geometry from previous session.");
|
||||||
QMap<QString, QByteArray> geometry = porymapConfig.getGeometry();
|
QMap<QString, QByteArray> geometry = porymapConfig.getMainGeometry();
|
||||||
this->restoreGeometry(geometry.value("window_geometry"));
|
this->restoreGeometry(geometry.value("main_window_geometry"));
|
||||||
this->restoreState(geometry.value("window_state"));
|
this->restoreState(geometry.value("main_window_state"));
|
||||||
this->ui->splitter_map->restoreState(geometry.value("map_splitter_state"));
|
this->ui->splitter_map->restoreState(geometry.value("map_splitter_state"));
|
||||||
this->ui->splitter_main->restoreState(geometry.value("main_splitter_state"));
|
this->ui->splitter_main->restoreState(geometry.value("main_splitter_state"));
|
||||||
}
|
}
|
||||||
|
@ -556,20 +571,12 @@ void MainWindow::refreshMapScene()
|
||||||
{
|
{
|
||||||
on_mainTabBar_tabBarClicked(ui->mainTabBar->currentIndex());
|
on_mainTabBar_tabBarClicked(ui->mainTabBar->currentIndex());
|
||||||
|
|
||||||
double base = editor->scale_base;
|
|
||||||
double exp = editor->scale_exp;
|
|
||||||
|
|
||||||
int width = static_cast<int>(ceil((editor->scene->width()) * pow(base,exp))) + 2;
|
|
||||||
int height = static_cast<int>(ceil((editor->scene->height()) * pow(base,exp))) + 2;
|
|
||||||
|
|
||||||
ui->graphicsView_Map->setScene(editor->scene);
|
ui->graphicsView_Map->setScene(editor->scene);
|
||||||
ui->graphicsView_Map->setSceneRect(editor->scene->sceneRect());
|
ui->graphicsView_Map->setSceneRect(editor->scene->sceneRect());
|
||||||
ui->graphicsView_Map->setFixedSize(width, height);
|
|
||||||
ui->graphicsView_Map->editor = editor;
|
ui->graphicsView_Map->editor = editor;
|
||||||
|
|
||||||
ui->graphicsView_Connections->setScene(editor->scene);
|
ui->graphicsView_Connections->setScene(editor->scene);
|
||||||
ui->graphicsView_Connections->setSceneRect(editor->scene->sceneRect());
|
ui->graphicsView_Connections->setSceneRect(editor->scene->sceneRect());
|
||||||
ui->graphicsView_Connections->setFixedSize(width, height);
|
|
||||||
|
|
||||||
ui->graphicsView_Metatiles->setScene(editor->scene_metatiles);
|
ui->graphicsView_Metatiles->setScene(editor->scene_metatiles);
|
||||||
//ui->graphicsView_Metatiles->setSceneRect(editor->scene_metatiles->sceneRect());
|
//ui->graphicsView_Metatiles->setSceneRect(editor->scene_metatiles->sceneRect());
|
||||||
|
@ -1204,8 +1211,11 @@ void MainWindow::on_actionNew_Tileset_triggered() {
|
||||||
|
|
||||||
void MainWindow::updateTilesetEditor() {
|
void MainWindow::updateTilesetEditor() {
|
||||||
if (this->tilesetEditor) {
|
if (this->tilesetEditor) {
|
||||||
this->tilesetEditor->setMap(this->editor->map);
|
this->tilesetEditor->update(
|
||||||
this->tilesetEditor->setTilesets(editor->ui->comboBox_PrimaryTileset->currentText(), editor->ui->comboBox_SecondaryTileset->currentText());
|
this->editor->map,
|
||||||
|
editor->ui->comboBox_PrimaryTileset->currentText(),
|
||||||
|
editor->ui->comboBox_SecondaryTileset->currentText()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1352,11 +1362,11 @@ void MainWindow::on_mainTabBar_tabBarClicked(int index)
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionZoom_In_triggered() {
|
void MainWindow::on_actionZoom_In_triggered() {
|
||||||
scaleMapView(1);
|
editor->scaleMapView(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionZoom_Out_triggered() {
|
void MainWindow::on_actionZoom_Out_triggered() {
|
||||||
scaleMapView(-1);
|
editor->scaleMapView(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionBetter_Cursors_triggered() {
|
void MainWindow::on_actionBetter_Cursors_triggered() {
|
||||||
|
@ -1380,7 +1390,7 @@ void MainWindow::on_actionCursor_Tile_Outline_triggered()
|
||||||
porymapConfig.setShowCursorTile(enabled);
|
porymapConfig.setShowCursorTile(enabled);
|
||||||
this->editor->settings->cursorTileRectEnabled = enabled;
|
this->editor->settings->cursorTileRectEnabled = enabled;
|
||||||
if (this->editor->map_item->has_mouse) {
|
if (this->editor->map_item->has_mouse) {
|
||||||
this->editor->cursorMapTileRect->setVisible(enabled);
|
this->editor->cursorMapTileRect->setVisibility(enabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1433,39 +1443,8 @@ void MainWindow::on_actionMap_Shift_triggered()
|
||||||
on_toolButton_Shift_clicked();
|
on_toolButton_Shift_clicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onWheelZoom(int s) {
|
|
||||||
// Don't zoom the map when the user accidentally scrolls while performing a magic fill. (ctrl + middle button click)
|
|
||||||
if (!(QApplication::mouseButtons() & Qt::MiddleButton)) {
|
|
||||||
scaleMapView(s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::scaleMapView(int s) {
|
|
||||||
if ((editor->scale_exp + s) <= 5 && (editor->scale_exp + s) >= -2) // sane limits
|
|
||||||
{
|
|
||||||
if (s == 0)
|
|
||||||
{
|
|
||||||
s = -editor->scale_exp;
|
|
||||||
}
|
|
||||||
|
|
||||||
editor->scale_exp += s;
|
|
||||||
|
|
||||||
double base = editor->scale_base;
|
|
||||||
double exp = editor->scale_exp;
|
|
||||||
double sfactor = pow(base,s);
|
|
||||||
|
|
||||||
ui->graphicsView_Map->scale(sfactor,sfactor);
|
|
||||||
ui->graphicsView_Connections->scale(sfactor,sfactor);
|
|
||||||
|
|
||||||
int width = static_cast<int>(ceil((editor->scene->width()) * pow(base,exp))) + 2;
|
|
||||||
int height = static_cast<int>(ceil((editor->scene->height()) * pow(base,exp))) + 2;
|
|
||||||
ui->graphicsView_Map->setFixedSize(width, height);
|
|
||||||
ui->graphicsView_Connections->setFixedSize(width, height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::resetMapViewScale() {
|
void MainWindow::resetMapViewScale() {
|
||||||
scaleMapView(0);
|
editor->scaleMapView(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::addNewEvent(QString event_type)
|
void MainWindow::addNewEvent(QString event_type)
|
||||||
|
@ -2142,9 +2121,9 @@ void MainWindow::on_toolButton_Paint_clicked()
|
||||||
if (ui->tabWidget_2->currentIndex() == 0)
|
if (ui->tabWidget_2->currentIndex() == 0)
|
||||||
editor->cursorMapTileRect->stopSingleTileMode();
|
editor->cursorMapTileRect->stopSingleTileMode();
|
||||||
|
|
||||||
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
ui->graphicsView_Map->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
ui->graphicsView_Map->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
QScroller::ungrabGesture(ui->scrollArea);
|
QScroller::ungrabGesture(ui->graphicsView_Map);
|
||||||
|
|
||||||
checkToolButtons();
|
checkToolButtons();
|
||||||
}
|
}
|
||||||
|
@ -2159,9 +2138,9 @@ void MainWindow::on_toolButton_Select_clicked()
|
||||||
editor->settings->mapCursor = QCursor();
|
editor->settings->mapCursor = QCursor();
|
||||||
editor->cursorMapTileRect->setSingleTileMode();
|
editor->cursorMapTileRect->setSingleTileMode();
|
||||||
|
|
||||||
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
ui->graphicsView_Map->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
ui->graphicsView_Map->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
QScroller::ungrabGesture(ui->scrollArea);
|
QScroller::ungrabGesture(ui->graphicsView_Map);
|
||||||
|
|
||||||
checkToolButtons();
|
checkToolButtons();
|
||||||
}
|
}
|
||||||
|
@ -2176,9 +2155,9 @@ void MainWindow::on_toolButton_Fill_clicked()
|
||||||
editor->settings->mapCursor = QCursor(QPixmap(":/icons/fill_color_cursor.ico"), 10, 10);
|
editor->settings->mapCursor = QCursor(QPixmap(":/icons/fill_color_cursor.ico"), 10, 10);
|
||||||
editor->cursorMapTileRect->setSingleTileMode();
|
editor->cursorMapTileRect->setSingleTileMode();
|
||||||
|
|
||||||
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
ui->graphicsView_Map->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
ui->graphicsView_Map->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
QScroller::ungrabGesture(ui->scrollArea);
|
QScroller::ungrabGesture(ui->graphicsView_Map);
|
||||||
|
|
||||||
checkToolButtons();
|
checkToolButtons();
|
||||||
}
|
}
|
||||||
|
@ -2193,9 +2172,9 @@ void MainWindow::on_toolButton_Dropper_clicked()
|
||||||
editor->settings->mapCursor = QCursor(QPixmap(":/icons/pipette_cursor.ico"), 10, 10);
|
editor->settings->mapCursor = QCursor(QPixmap(":/icons/pipette_cursor.ico"), 10, 10);
|
||||||
editor->cursorMapTileRect->setSingleTileMode();
|
editor->cursorMapTileRect->setSingleTileMode();
|
||||||
|
|
||||||
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
ui->graphicsView_Map->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
ui->graphicsView_Map->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
QScroller::ungrabGesture(ui->scrollArea);
|
QScroller::ungrabGesture(ui->graphicsView_Map);
|
||||||
|
|
||||||
checkToolButtons();
|
checkToolButtons();
|
||||||
}
|
}
|
||||||
|
@ -2210,9 +2189,9 @@ void MainWindow::on_toolButton_Move_clicked()
|
||||||
editor->settings->mapCursor = QCursor(QPixmap(":/icons/move.ico"), 7, 7);
|
editor->settings->mapCursor = QCursor(QPixmap(":/icons/move.ico"), 7, 7);
|
||||||
editor->cursorMapTileRect->setSingleTileMode();
|
editor->cursorMapTileRect->setSingleTileMode();
|
||||||
|
|
||||||
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
ui->graphicsView_Map->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
ui->graphicsView_Map->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
QScroller::grabGesture(ui->scrollArea, QScroller::LeftMouseButtonGesture);
|
QScroller::grabGesture(ui->graphicsView_Map, QScroller::LeftMouseButtonGesture);
|
||||||
|
|
||||||
checkToolButtons();
|
checkToolButtons();
|
||||||
}
|
}
|
||||||
|
@ -2227,9 +2206,9 @@ void MainWindow::on_toolButton_Shift_clicked()
|
||||||
editor->settings->mapCursor = QCursor(QPixmap(":/icons/shift_cursor.ico"), 10, 10);
|
editor->settings->mapCursor = QCursor(QPixmap(":/icons/shift_cursor.ico"), 10, 10);
|
||||||
editor->cursorMapTileRect->setSingleTileMode();
|
editor->cursorMapTileRect->setSingleTileMode();
|
||||||
|
|
||||||
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
ui->graphicsView_Map->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
ui->graphicsView_Map->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
QScroller::ungrabGesture(ui->scrollArea);
|
QScroller::ungrabGesture(ui->graphicsView_Map);
|
||||||
|
|
||||||
checkToolButtons();
|
checkToolButtons();
|
||||||
}
|
}
|
||||||
|
@ -2522,7 +2501,6 @@ void MainWindow::on_actionTileset_Editor_triggered()
|
||||||
this->tilesetEditor = new TilesetEditor(this->editor->project, this->editor->map, this);
|
this->tilesetEditor = new TilesetEditor(this->editor->project, this->editor->map, this);
|
||||||
connect(this->tilesetEditor, SIGNAL(tilesetsSaved(QString, QString)), this, SLOT(onTilesetsSaved(QString, QString)));
|
connect(this->tilesetEditor, SIGNAL(tilesetsSaved(QString, QString)), this, SLOT(onTilesetsSaved(QString, QString)));
|
||||||
connect(this->tilesetEditor, &QObject::destroyed, [=](QObject *) { this->tilesetEditor = nullptr; });
|
connect(this->tilesetEditor, &QObject::destroyed, [=](QObject *) { this->tilesetEditor = nullptr; });
|
||||||
this->tilesetEditor->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this->tilesetEditor->isVisible()) {
|
if (!this->tilesetEditor->isVisible()) {
|
||||||
|
@ -2582,6 +2560,7 @@ void MainWindow::on_actionThemes_triggered()
|
||||||
QString theme = themeSelector->currentText();
|
QString theme = themeSelector->currentText();
|
||||||
porymapConfig.setTheme(theme);
|
porymapConfig.setTheme(theme);
|
||||||
this->setTheme(theme);
|
this->setTheme(theme);
|
||||||
|
editor->maskNonVisibleConnectionTiles();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(&buttonBox, SIGNAL(rejected()), &themeSelectorWindow, SLOT(reject()));
|
connect(&buttonBox, SIGNAL(rejected()), &themeSelectorWindow, SLOT(reject()));
|
||||||
|
@ -2662,7 +2641,6 @@ void MainWindow::on_actionRegion_Map_Editor_triggered() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
connect(this->regionMapEditor, &QObject::destroyed, [=](QObject *) { this->regionMapEditor = nullptr; });
|
connect(this->regionMapEditor, &QObject::destroyed, [=](QObject *) { this->regionMapEditor = nullptr; });
|
||||||
this->regionMapEditor->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this->regionMapEditor->isVisible()) {
|
if (!this->regionMapEditor->isVisible()) {
|
||||||
|
@ -2701,7 +2679,7 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
porymapConfig.setGeometry(
|
porymapConfig.setMainGeometry(
|
||||||
this->saveGeometry(),
|
this->saveGeometry(),
|
||||||
this->saveState(),
|
this->saveState(),
|
||||||
this->ui->splitter_map->saveState(),
|
this->ui->splitter_map->saveState(),
|
||||||
|
|
|
@ -247,7 +247,7 @@ void MainWindow::addImage(int x, int y, QString filepath) {
|
||||||
|
|
||||||
void MainWindow::refreshAfterPaletteChange(Tileset *tileset) {
|
void MainWindow::refreshAfterPaletteChange(Tileset *tileset) {
|
||||||
if (this->tilesetEditor) {
|
if (this->tilesetEditor) {
|
||||||
this->tilesetEditor->setTilesets(this->editor->map->layout->tileset_primary_label, this->editor->map->layout->tileset_secondary_label);
|
this->tilesetEditor->updateTilesets(this->editor->map->layout->tileset_primary_label, this->editor->map->layout->tileset_secondary_label);
|
||||||
}
|
}
|
||||||
this->editor->metatile_selector_item->draw();
|
this->editor->metatile_selector_item->draw();
|
||||||
this->editor->selected_border_metatiles_item->draw();
|
this->editor->selected_border_metatiles_item->draw();
|
||||||
|
|
136
src/ui/flowlayout.cpp
Normal file
136
src/ui/flowlayout.cpp
Normal file
|
@ -0,0 +1,136 @@
|
||||||
|
#include <flowlayout.h>
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
|
||||||
|
FlowLayout::FlowLayout(QWidget *parent, int margin, int hSpacing, int vSpacing) :
|
||||||
|
QLayout(parent),
|
||||||
|
horzSpace(hSpacing),
|
||||||
|
vertSpace(vSpacing)
|
||||||
|
{
|
||||||
|
setContentsMargins(margin, margin, margin, margin);
|
||||||
|
}
|
||||||
|
|
||||||
|
FlowLayout::FlowLayout(int margin, int hSpacing, int vSpacing) :
|
||||||
|
horzSpace(hSpacing),
|
||||||
|
vertSpace(vSpacing)
|
||||||
|
{
|
||||||
|
setContentsMargins(margin, margin, margin, margin);
|
||||||
|
}
|
||||||
|
|
||||||
|
FlowLayout::~FlowLayout()
|
||||||
|
{
|
||||||
|
QLayoutItem *item;
|
||||||
|
while ((item = takeAt(0)))
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FlowLayout::addItem(QLayoutItem *item) {
|
||||||
|
itemList.append(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
int FlowLayout::horizontalSpacing() const {
|
||||||
|
if (horzSpace >= 0)
|
||||||
|
return horzSpace;
|
||||||
|
else
|
||||||
|
return smartSpacing(QStyle::PM_LayoutHorizontalSpacing);
|
||||||
|
}
|
||||||
|
|
||||||
|
int FlowLayout::verticalSpacing() const {
|
||||||
|
if (vertSpace >= 0)
|
||||||
|
return vertSpace;
|
||||||
|
else
|
||||||
|
return smartSpacing(QStyle::PM_LayoutVerticalSpacing);
|
||||||
|
}
|
||||||
|
|
||||||
|
int FlowLayout::count() const {
|
||||||
|
return itemList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
QLayoutItem *FlowLayout::itemAt(int index) const {
|
||||||
|
return itemList.value(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
QLayoutItem *FlowLayout::takeAt(int index) {
|
||||||
|
if (index >= 0 && index < itemList.size())
|
||||||
|
return itemList.takeAt(index);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
Qt::Orientations FlowLayout::expandingDirections() const {
|
||||||
|
return { };
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FlowLayout::hasHeightForWidth() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int FlowLayout::heightForWidth(int width) const {
|
||||||
|
int height = doLayout(QRect(0, 0, width, 0), true);
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FlowLayout::setGeometry(const QRect &rect) {
|
||||||
|
QLayout::setGeometry(rect);
|
||||||
|
doLayout(rect, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize FlowLayout::sizeHint() const {
|
||||||
|
return minimumSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize FlowLayout::minimumSize() const {
|
||||||
|
QSize size;
|
||||||
|
for (const QLayoutItem *item : qAsConst(itemList))
|
||||||
|
size = size.expandedTo(item->minimumSize());
|
||||||
|
|
||||||
|
const QMargins margins = contentsMargins();
|
||||||
|
size += QSize(margins.left() + margins.right(), margins.top() + margins.bottom());
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
int FlowLayout::doLayout(const QRect &rect, bool testOnly) const {
|
||||||
|
int left, top, right, bottom;
|
||||||
|
getContentsMargins(&left, &top, &right, &bottom);
|
||||||
|
QRect effectiveRect = rect.adjusted(+left, +top, -right, -bottom);
|
||||||
|
int x = effectiveRect.x();
|
||||||
|
int y = effectiveRect.y();
|
||||||
|
int lineHeight = 0;
|
||||||
|
|
||||||
|
for (QLayoutItem *item : qAsConst(itemList)) {
|
||||||
|
const QWidget *wid = item->widget();
|
||||||
|
int spaceX = horizontalSpacing();
|
||||||
|
if (spaceX == -1)
|
||||||
|
spaceX = wid->style()->layoutSpacing(QSizePolicy::PushButton, QSizePolicy::PushButton, Qt::Horizontal);
|
||||||
|
int spaceY = verticalSpacing();
|
||||||
|
if (spaceY == -1)
|
||||||
|
spaceY = wid->style()->layoutSpacing(QSizePolicy::PushButton, QSizePolicy::PushButton, Qt::Vertical);
|
||||||
|
|
||||||
|
int nextX = x + item->sizeHint().width() + spaceX;
|
||||||
|
if (nextX - spaceX > effectiveRect.right() && lineHeight > 0) {
|
||||||
|
x = effectiveRect.x();
|
||||||
|
y = y + lineHeight + spaceY;
|
||||||
|
nextX = x + item->sizeHint().width() + spaceX;
|
||||||
|
lineHeight = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!testOnly)
|
||||||
|
item->setGeometry(QRect(QPoint(x, y), item->sizeHint()));
|
||||||
|
|
||||||
|
x = nextX;
|
||||||
|
lineHeight = qMax(lineHeight, item->sizeHint().height());
|
||||||
|
}
|
||||||
|
return y + lineHeight - rect.y() + bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const {
|
||||||
|
QObject *parent = this->parent();
|
||||||
|
if (!parent) {
|
||||||
|
return -1;
|
||||||
|
} else if (parent->isWidgetType()) {
|
||||||
|
QWidget *pw = static_cast<QWidget *>(parent);
|
||||||
|
return pw->style()->pixelMetric(pm, nullptr, pw);
|
||||||
|
} else {
|
||||||
|
return static_cast<QLayout *>(parent)->spacing();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
#include "paletteeditor.h"
|
#include "paletteeditor.h"
|
||||||
#include "ui_paletteeditor.h"
|
#include "ui_paletteeditor.h"
|
||||||
#include "paletteutil.h"
|
#include "paletteutil.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "log.h"
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include "log.h"
|
|
||||||
|
|
||||||
PaletteEditor::PaletteEditor(Project *project, Tileset *primaryTileset, Tileset *secondaryTileset, int paletteId, QWidget *parent) :
|
PaletteEditor::PaletteEditor(Project *project, Tileset *primaryTileset, Tileset *secondaryTileset, int paletteId, QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
|
@ -112,6 +113,7 @@ PaletteEditor::PaletteEditor(Project *project, Tileset *primaryTileset, Tileset
|
||||||
this->initColorSliders();
|
this->initColorSliders();
|
||||||
this->setPaletteId(paletteId);
|
this->setPaletteId(paletteId);
|
||||||
this->commitEditHistory(this->ui->spinBox_PaletteId->value());
|
this->commitEditHistory(this->ui->spinBox_PaletteId->value());
|
||||||
|
this->restoreWindowState();
|
||||||
}
|
}
|
||||||
|
|
||||||
PaletteEditor::~PaletteEditor()
|
PaletteEditor::~PaletteEditor()
|
||||||
|
@ -227,6 +229,13 @@ void PaletteEditor::commitEditHistory(int paletteId) {
|
||||||
this->palettesHistory[paletteId].push(commit);
|
this->palettesHistory[paletteId].push(commit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PaletteEditor::restoreWindowState() {
|
||||||
|
logInfo("Restoring palette editor geometry from previous session.");
|
||||||
|
QMap<QString, QByteArray> geometry = porymapConfig.getPaletteEditorGeometry();
|
||||||
|
this->restoreGeometry(geometry.value("palette_editor_geometry"));
|
||||||
|
this->restoreState(geometry.value("palette_editor_state"));
|
||||||
|
}
|
||||||
|
|
||||||
void PaletteEditor::on_actionUndo_triggered()
|
void PaletteEditor::on_actionUndo_triggered()
|
||||||
{
|
{
|
||||||
int paletteId = this->ui->spinBox_PaletteId->value();
|
int paletteId = this->ui->spinBox_PaletteId->value();
|
||||||
|
@ -311,3 +320,10 @@ void PaletteEditor::on_actionImport_Palette_triggered()
|
||||||
this->commitEditHistory(paletteId);
|
this->commitEditHistory(paletteId);
|
||||||
emit this->changedPaletteColor();
|
emit this->changedPaletteColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PaletteEditor::closeEvent(QCloseEvent*) {
|
||||||
|
porymapConfig.setPaletteEditorGeometry(
|
||||||
|
this->saveGeometry(),
|
||||||
|
this->saveState()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ RegionMapEditor::RegionMapEditor(QWidget *parent, Project *project_) :
|
||||||
this->project = project_;
|
this->project = project_;
|
||||||
this->region_map = new RegionMap;
|
this->region_map = new RegionMap;
|
||||||
this->ui->action_RegionMap_Resize->setVisible(false);
|
this->ui->action_RegionMap_Resize->setVisible(false);
|
||||||
|
this->restoreWindowState();
|
||||||
}
|
}
|
||||||
|
|
||||||
RegionMapEditor::~RegionMapEditor()
|
RegionMapEditor::~RegionMapEditor()
|
||||||
|
@ -42,6 +43,13 @@ RegionMapEditor::~RegionMapEditor()
|
||||||
delete scene_region_map_tiles;
|
delete scene_region_map_tiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RegionMapEditor::restoreWindowState() {
|
||||||
|
logInfo("Restoring region map editor geometry from previous session.");
|
||||||
|
QMap<QString, QByteArray> geometry = porymapConfig.getRegionMapEditorGeometry();
|
||||||
|
this->restoreGeometry(geometry.value("region_map_editor_geometry"));
|
||||||
|
this->restoreState(geometry.value("region_map_editor_state"));
|
||||||
|
}
|
||||||
|
|
||||||
void RegionMapEditor::on_action_RegionMap_Save_triggered() {
|
void RegionMapEditor::on_action_RegionMap_Save_triggered() {
|
||||||
setCurrentSquareOptions();
|
setCurrentSquareOptions();
|
||||||
if (project && region_map) {
|
if (project && region_map) {
|
||||||
|
@ -899,6 +907,11 @@ void RegionMapEditor::closeEvent(QCloseEvent *event)
|
||||||
} else {
|
} else {
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
porymapConfig.setRegionMapEditorGeometry(
|
||||||
|
this->saveGeometry(),
|
||||||
|
this->saveState()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegionMapEditor::on_verticalSlider_Zoom_Map_Image_valueChanged(int val) {
|
void RegionMapEditor::on_verticalSlider_Zoom_Map_Image_valueChanged(int val) {
|
||||||
|
|
|
@ -14,10 +14,14 @@
|
||||||
|
|
||||||
TilesetEditor::TilesetEditor(Project *project, Map *map, QWidget *parent) :
|
TilesetEditor::TilesetEditor(Project *project, Map *map, QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::TilesetEditor)
|
ui(new Ui::TilesetEditor),
|
||||||
|
project(project),
|
||||||
|
map(map),
|
||||||
|
hasUnsavedChanges(false)
|
||||||
{
|
{
|
||||||
this->init(project, map);
|
this->setTilesets(this->map->layout->tileset_primary_label, this->map->layout->tileset_secondary_label);
|
||||||
new QShortcut(QKeySequence("Ctrl+Shift+Z"), this, SLOT(on_actionRedo_triggered()));
|
this->initUi();
|
||||||
|
this->initMetatileHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
TilesetEditor::~TilesetEditor()
|
TilesetEditor::~TilesetEditor()
|
||||||
|
@ -37,27 +41,78 @@ TilesetEditor::~TilesetEditor()
|
||||||
delete metatileLayersScene;
|
delete metatileLayersScene;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TilesetEditor::init(Project *project, Map *map) {
|
void TilesetEditor::update(Map *map, QString primaryTilesetLabel, QString secondaryTilesetLabel) {
|
||||||
ui->setupUi(this);
|
this->updateMap(map);
|
||||||
this->project = project;
|
this->updateTilesets(primaryTilesetLabel, secondaryTilesetLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TilesetEditor::updateMap(Map *map) {
|
||||||
|
this->map = map;
|
||||||
|
this->metatileSelector->map = map;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TilesetEditor::updateTilesets(QString primaryTilesetLabel, QString secondaryTilesetLabel) {
|
||||||
|
if (this->hasUnsavedChanges) {
|
||||||
|
QMessageBox::StandardButton result = QMessageBox::question(
|
||||||
|
this,
|
||||||
|
"porymap",
|
||||||
|
"Tileset has been modified, save changes?",
|
||||||
|
QMessageBox::No | QMessageBox::Yes,
|
||||||
|
QMessageBox::Yes);
|
||||||
|
if (result == QMessageBox::Yes)
|
||||||
|
this->on_actionSave_Tileset_triggered();
|
||||||
|
}
|
||||||
this->hasUnsavedChanges = false;
|
this->hasUnsavedChanges = false;
|
||||||
this->tileXFlip = ui->checkBox_xFlip->isChecked();
|
this->setTilesets(primaryTilesetLabel, secondaryTilesetLabel);
|
||||||
this->tileYFlip = ui->checkBox_yFlip->isChecked();
|
this->refresh();
|
||||||
this->paletteId = ui->spinBox_paletteSelector->value();
|
}
|
||||||
|
|
||||||
Tileset *primaryTileset = project->getTileset(map->layout->tileset_primary_label);
|
bool TilesetEditor::selectMetatile(uint16_t metatileId) {
|
||||||
Tileset *secondaryTileset = project->getTileset(map->layout->tileset_secondary_label);
|
if (!Tileset::metatileIsValid(metatileId, this->primaryTileset, this->secondaryTileset)) return false;
|
||||||
|
this->metatileSelector->select(metatileId);
|
||||||
|
QPoint pos = this->metatileSelector->getMetatileIdCoordsOnWidget(metatileId);
|
||||||
|
this->ui->scrollArea_Metatiles->ensureVisible(pos.x(), pos.y());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TilesetEditor::setTilesets(QString primaryTilesetLabel, QString secondaryTilesetLabel) {
|
||||||
|
Tileset *primaryTileset = project->getTileset(primaryTilesetLabel);
|
||||||
|
Tileset *secondaryTileset = project->getTileset(secondaryTilesetLabel);
|
||||||
if (this->primaryTileset) delete this->primaryTileset;
|
if (this->primaryTileset) delete this->primaryTileset;
|
||||||
if (this->secondaryTileset) delete this->secondaryTileset;
|
if (this->secondaryTileset) delete this->secondaryTileset;
|
||||||
this->primaryTileset = primaryTileset->copy();
|
this->primaryTileset = primaryTileset->copy();
|
||||||
this->secondaryTileset = secondaryTileset->copy();
|
this->secondaryTileset = secondaryTileset->copy();
|
||||||
|
}
|
||||||
|
|
||||||
QList<QString> sortedBehaviors;
|
void TilesetEditor::initUi() {
|
||||||
|
ui->setupUi(this);
|
||||||
|
new QShortcut(QKeySequence("Ctrl+Shift+Z"), this, SLOT(on_actionRedo_triggered()));
|
||||||
|
this->tileXFlip = ui->checkBox_xFlip->isChecked();
|
||||||
|
this->tileYFlip = ui->checkBox_yFlip->isChecked();
|
||||||
|
this->paletteId = ui->spinBox_paletteSelector->value();
|
||||||
|
this->ui->spinBox_paletteSelector->setMinimum(0);
|
||||||
|
this->ui->spinBox_paletteSelector->setMaximum(Project::getNumPalettesTotal() - 1);
|
||||||
|
|
||||||
|
this->setMetatileBehaviors();
|
||||||
|
this->setMetatileLayersUi();
|
||||||
|
this->setVersionSpecificUi();
|
||||||
|
this->setMetatileLabelValidator();
|
||||||
|
|
||||||
|
this->initMetatileSelector();
|
||||||
|
this->initMetatileLayersItem();
|
||||||
|
this->initTileSelector();
|
||||||
|
this->initSelectedTileItem();
|
||||||
|
this->metatileSelector->select(0);
|
||||||
|
this->restoreWindowState();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TilesetEditor::setMetatileBehaviors() {
|
||||||
for (int num : project->metatileBehaviorMapInverse.keys()) {
|
for (int num : project->metatileBehaviorMapInverse.keys()) {
|
||||||
this->ui->comboBox_metatileBehaviors->addItem(project->metatileBehaviorMapInverse[num], num);
|
this->ui->comboBox_metatileBehaviors->addItem(project->metatileBehaviorMapInverse[num], num);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TilesetEditor::setMetatileLayersUi() {
|
||||||
if (!projectConfig.getTripleLayerMetatilesEnabled()) {
|
if (!projectConfig.getTripleLayerMetatilesEnabled()) {
|
||||||
this->ui->comboBox_layerType->addItem("Normal - Middle/Top", 0);
|
this->ui->comboBox_layerType->addItem("Normal - Middle/Top", 0);
|
||||||
this->ui->comboBox_layerType->addItem("Covered - Bottom/Middle", 1);
|
this->ui->comboBox_layerType->addItem("Covered - Bottom/Middle", 1);
|
||||||
|
@ -67,10 +122,9 @@ void TilesetEditor::init(Project *project, Map *map) {
|
||||||
this->ui->label_layerType->setVisible(false);
|
this->ui->label_layerType->setVisible(false);
|
||||||
this->ui->label_BottomTop->setText("Bottom/Middle/Top");
|
this->ui->label_BottomTop->setText("Bottom/Middle/Top");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this->ui->spinBox_paletteSelector->setMinimum(0);
|
void TilesetEditor::setVersionSpecificUi() {
|
||||||
this->ui->spinBox_paletteSelector->setMaximum(Project::getNumPalettesTotal() - 1);
|
|
||||||
|
|
||||||
if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokefirered) {
|
if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokefirered) {
|
||||||
this->ui->comboBox_encounterType->setVisible(true);
|
this->ui->comboBox_encounterType->setVisible(true);
|
||||||
this->ui->label_encounterType->setVisible(true);
|
this->ui->label_encounterType->setVisible(true);
|
||||||
|
@ -89,72 +143,18 @@ void TilesetEditor::init(Project *project, Map *map) {
|
||||||
this->ui->comboBox_terrainType->setVisible(false);
|
this->ui->comboBox_terrainType->setVisible(false);
|
||||||
this->ui->label_terrainType->setVisible(false);
|
this->ui->label_terrainType->setVisible(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TilesetEditor::setMetatileLabelValidator() {
|
||||||
//only allow characters valid for a symbol
|
//only allow characters valid for a symbol
|
||||||
QRegExp expression("[_A-Za-z0-9]*$");
|
QRegExp expression("[_A-Za-z0-9]*$");
|
||||||
QRegExpValidator *validator = new QRegExpValidator(expression);
|
QRegExpValidator *validator = new QRegExpValidator(expression);
|
||||||
this->ui->lineEdit_metatileLabel->setValidator(validator);
|
this->ui->lineEdit_metatileLabel->setValidator(validator);
|
||||||
|
|
||||||
this->initMetatileSelector(map);
|
|
||||||
this->initMetatileLayersItem();
|
|
||||||
this->initTileSelector();
|
|
||||||
this->initSelectedTileItem();
|
|
||||||
this->metatileSelector->select(0);
|
|
||||||
|
|
||||||
MetatileHistoryItem *commit = new MetatileHistoryItem(0, nullptr, this->metatile->copy());
|
|
||||||
metatileHistory.push(commit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TilesetEditor::selectMetatile(uint16_t metatileId) {
|
void TilesetEditor::initMetatileSelector()
|
||||||
if (!Tileset::metatileIsValid(metatileId, this->primaryTileset, this->secondaryTileset)) return false;
|
|
||||||
this->metatileSelector->select(metatileId);
|
|
||||||
QPoint pos = this->metatileSelector->getMetatileIdCoordsOnWidget(metatileId);
|
|
||||||
this->ui->scrollArea_Metatiles->ensureVisible(pos.x(), pos.y());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TilesetEditor::setMap(Map *map) {
|
|
||||||
this->metatileSelector->map = map;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TilesetEditor::setTilesets(QString primaryTilesetLabel, QString secondaryTilesetLabel) {
|
|
||||||
if (this->hasUnsavedChanges) {
|
|
||||||
QMessageBox::StandardButton result = QMessageBox::question(
|
|
||||||
this,
|
|
||||||
"porymap",
|
|
||||||
"Tileset has been modified, save changes?",
|
|
||||||
QMessageBox::No | QMessageBox::Yes,
|
|
||||||
QMessageBox::Yes);
|
|
||||||
if (result == QMessageBox::Yes)
|
|
||||||
this->on_actionSave_Tileset_triggered();
|
|
||||||
}
|
|
||||||
this->hasUnsavedChanges = false;
|
|
||||||
delete this->primaryTileset;
|
|
||||||
delete this->secondaryTileset;
|
|
||||||
Tileset *primaryTileset = project->getTileset(primaryTilesetLabel);
|
|
||||||
Tileset *secondaryTileset = project->getTileset(secondaryTilesetLabel);
|
|
||||||
this->primaryTileset = primaryTileset->copy();
|
|
||||||
this->secondaryTileset = secondaryTileset->copy();
|
|
||||||
this->refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TilesetEditor::refresh() {
|
|
||||||
this->metatileLayersItem->setTilesets(this->primaryTileset, this->secondaryTileset);
|
|
||||||
this->tileSelector->setTilesets(this->primaryTileset, this->secondaryTileset);
|
|
||||||
this->metatileSelector->setTilesets(this->primaryTileset, this->secondaryTileset);
|
|
||||||
this->metatileSelector->select(this->metatileSelector->getSelectedMetatile());
|
|
||||||
this->drawSelectedTiles();
|
|
||||||
|
|
||||||
this->ui->graphicsView_Tiles->setSceneRect(0, 0, this->tileSelector->pixmap().width() + 2, this->tileSelector->pixmap().height() + 2);
|
|
||||||
this->ui->graphicsView_Tiles->setFixedSize(this->tileSelector->pixmap().width() + 2, this->tileSelector->pixmap().height() + 2);
|
|
||||||
this->ui->graphicsView_Metatiles->setSceneRect(0, 0, this->metatileSelector->pixmap().width() + 2, this->metatileSelector->pixmap().height() + 2);
|
|
||||||
this->ui->graphicsView_Metatiles->setFixedSize(this->metatileSelector->pixmap().width() + 2, this->metatileSelector->pixmap().height() + 2);
|
|
||||||
this->ui->graphicsView_selectedTile->setFixedSize(this->selectedTilePixmapItem->pixmap().width() + 2, this->selectedTilePixmapItem->pixmap().height() + 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TilesetEditor::initMetatileSelector(Map *map)
|
|
||||||
{
|
{
|
||||||
this->metatileSelector = new TilesetEditorMetatileSelector(this->primaryTileset, this->secondaryTileset, map);
|
this->metatileSelector = new TilesetEditorMetatileSelector(this->primaryTileset, this->secondaryTileset, this->map);
|
||||||
connect(this->metatileSelector, SIGNAL(hoveredMetatileChanged(uint16_t)),
|
connect(this->metatileSelector, SIGNAL(hoveredMetatileChanged(uint16_t)),
|
||||||
this, SLOT(onHoveredMetatileChanged(uint16_t)));
|
this, SLOT(onHoveredMetatileChanged(uint16_t)));
|
||||||
connect(this->metatileSelector, SIGNAL(hoveredMetatileCleared()),
|
connect(this->metatileSelector, SIGNAL(hoveredMetatileCleared()),
|
||||||
|
@ -170,6 +170,19 @@ void TilesetEditor::initMetatileSelector(Map *map)
|
||||||
this->ui->graphicsView_Metatiles->setFixedSize(this->metatileSelector->pixmap().width() + 2, this->metatileSelector->pixmap().height() + 2);
|
this->ui->graphicsView_Metatiles->setFixedSize(this->metatileSelector->pixmap().width() + 2, this->metatileSelector->pixmap().height() + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TilesetEditor::initMetatileLayersItem() {
|
||||||
|
Metatile *metatile = Tileset::getMetatile(this->metatileSelector->getSelectedMetatile(), this->primaryTileset, this->secondaryTileset);
|
||||||
|
this->metatileLayersItem = new MetatileLayersItem(metatile, this->primaryTileset, this->secondaryTileset);
|
||||||
|
connect(this->metatileLayersItem, SIGNAL(tileChanged(int, int)),
|
||||||
|
this, SLOT(onMetatileLayerTileChanged(int, int)));
|
||||||
|
connect(this->metatileLayersItem, SIGNAL(selectedTilesChanged(QPoint, int, int)),
|
||||||
|
this, SLOT(onMetatileLayerSelectionChanged(QPoint, int, int)));
|
||||||
|
|
||||||
|
this->metatileLayersScene = new QGraphicsScene;
|
||||||
|
this->metatileLayersScene->addItem(this->metatileLayersItem);
|
||||||
|
this->ui->graphicsView_metatileLayers->setScene(this->metatileLayersScene);
|
||||||
|
}
|
||||||
|
|
||||||
void TilesetEditor::initTileSelector()
|
void TilesetEditor::initTileSelector()
|
||||||
{
|
{
|
||||||
this->tileSelector = new TilesetEditorTileSelector(this->primaryTileset, this->secondaryTileset, projectConfig.getTripleLayerMetatilesEnabled());
|
this->tileSelector = new TilesetEditorTileSelector(this->primaryTileset, this->secondaryTileset, projectConfig.getTripleLayerMetatilesEnabled());
|
||||||
|
@ -196,6 +209,40 @@ void TilesetEditor::initSelectedTileItem() {
|
||||||
this->ui->graphicsView_selectedTile->setFixedSize(this->selectedTilePixmapItem->pixmap().width() + 2, this->selectedTilePixmapItem->pixmap().height() + 2);
|
this->ui->graphicsView_selectedTile->setFixedSize(this->selectedTilePixmapItem->pixmap().width() + 2, this->selectedTilePixmapItem->pixmap().height() + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TilesetEditor::restoreWindowState() {
|
||||||
|
logInfo("Restoring tileset editor geometry from previous session.");
|
||||||
|
QMap<QString, QByteArray> geometry = porymapConfig.getTilesetEditorGeometry();
|
||||||
|
this->restoreGeometry(geometry.value("tileset_editor_geometry"));
|
||||||
|
this->restoreState(geometry.value("tileset_editor_state"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void TilesetEditor::initMetatileHistory() {
|
||||||
|
MetatileHistoryItem *commit = new MetatileHistoryItem(0, nullptr, this->metatile->copy());
|
||||||
|
metatileHistory.push(commit);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TilesetEditor::reset() {
|
||||||
|
this->hasUnsavedChanges = false;
|
||||||
|
this->setTilesets(this->primaryTileset->name, this->secondaryTileset->name);
|
||||||
|
if (this->paletteEditor)
|
||||||
|
this->paletteEditor->setTilesets(this->primaryTileset, this->secondaryTileset);
|
||||||
|
this->refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TilesetEditor::refresh() {
|
||||||
|
this->metatileLayersItem->setTilesets(this->primaryTileset, this->secondaryTileset);
|
||||||
|
this->tileSelector->setTilesets(this->primaryTileset, this->secondaryTileset);
|
||||||
|
this->metatileSelector->setTilesets(this->primaryTileset, this->secondaryTileset);
|
||||||
|
this->metatileSelector->select(this->metatileSelector->getSelectedMetatile());
|
||||||
|
this->drawSelectedTiles();
|
||||||
|
|
||||||
|
this->ui->graphicsView_Tiles->setSceneRect(0, 0, this->tileSelector->pixmap().width() + 2, this->tileSelector->pixmap().height() + 2);
|
||||||
|
this->ui->graphicsView_Tiles->setFixedSize(this->tileSelector->pixmap().width() + 2, this->tileSelector->pixmap().height() + 2);
|
||||||
|
this->ui->graphicsView_Metatiles->setSceneRect(0, 0, this->metatileSelector->pixmap().width() + 2, this->metatileSelector->pixmap().height() + 2);
|
||||||
|
this->ui->graphicsView_Metatiles->setFixedSize(this->metatileSelector->pixmap().width() + 2, this->metatileSelector->pixmap().height() + 2);
|
||||||
|
this->ui->graphicsView_selectedTile->setFixedSize(this->selectedTilePixmapItem->pixmap().width() + 2, this->selectedTilePixmapItem->pixmap().height() + 2);
|
||||||
|
}
|
||||||
|
|
||||||
void TilesetEditor::drawSelectedTiles() {
|
void TilesetEditor::drawSelectedTiles() {
|
||||||
if (!this->selectedTileScene) {
|
if (!this->selectedTileScene) {
|
||||||
return;
|
return;
|
||||||
|
@ -222,19 +269,6 @@ void TilesetEditor::drawSelectedTiles() {
|
||||||
this->ui->graphicsView_selectedTile->setFixedSize(this->selectedTilePixmapItem->pixmap().width() + 2, this->selectedTilePixmapItem->pixmap().height() + 2);
|
this->ui->graphicsView_selectedTile->setFixedSize(this->selectedTilePixmapItem->pixmap().width() + 2, this->selectedTilePixmapItem->pixmap().height() + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TilesetEditor::initMetatileLayersItem() {
|
|
||||||
Metatile *metatile = Tileset::getMetatile(this->metatileSelector->getSelectedMetatile(), this->primaryTileset, this->secondaryTileset);
|
|
||||||
this->metatileLayersItem = new MetatileLayersItem(metatile, this->primaryTileset, this->secondaryTileset);
|
|
||||||
connect(this->metatileLayersItem, SIGNAL(tileChanged(int, int)),
|
|
||||||
this, SLOT(onMetatileLayerTileChanged(int, int)));
|
|
||||||
connect(this->metatileLayersItem, SIGNAL(selectedTilesChanged(QPoint, int, int)),
|
|
||||||
this, SLOT(onMetatileLayerSelectionChanged(QPoint, int, int)));
|
|
||||||
|
|
||||||
this->metatileLayersScene = new QGraphicsScene;
|
|
||||||
this->metatileLayersScene->addItem(this->metatileLayersItem);
|
|
||||||
this->ui->graphicsView_metatileLayers->setScene(this->metatileLayersScene);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TilesetEditor::onHoveredMetatileChanged(uint16_t metatileId) {
|
void TilesetEditor::onHoveredMetatileChanged(uint16_t metatileId) {
|
||||||
Metatile *metatile = Tileset::getMetatile(metatileId, this->primaryTileset, this->secondaryTileset);
|
Metatile *metatile = Tileset::getMetatile(metatileId, this->primaryTileset, this->secondaryTileset);
|
||||||
QString message;
|
QString message;
|
||||||
|
@ -526,7 +560,7 @@ void TilesetEditor::importTilesetTiles(Tileset *tileset, bool primary) {
|
||||||
if (image.colorCount() == 0) {
|
if (image.colorCount() == 0) {
|
||||||
QMessageBox msgBox(this);
|
QMessageBox msgBox(this);
|
||||||
msgBox.setText("Select Palette for Tiles");
|
msgBox.setText("Select Palette for Tiles");
|
||||||
msgBox.setInformativeText(QString("The provided image is not indexed. Please select a palette file to for the image. An indexed image will be generated using the provided image and palette.")
|
msgBox.setInformativeText(QString("The provided image is not indexed. Please select a palette file for the image. An indexed image will be generated using the provided image and palette.")
|
||||||
.arg(image.colorCount()));
|
.arg(image.colorCount()));
|
||||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||||
msgBox.setIcon(QMessageBox::Icon::Warning);
|
msgBox.setIcon(QMessageBox::Icon::Warning);
|
||||||
|
@ -599,6 +633,7 @@ void TilesetEditor::closeEvent(QCloseEvent *event)
|
||||||
this->on_actionSave_Tileset_triggered();
|
this->on_actionSave_Tileset_triggered();
|
||||||
event->accept();
|
event->accept();
|
||||||
} else if (result == QMessageBox::No) {
|
} else if (result == QMessageBox::No) {
|
||||||
|
this->reset();
|
||||||
event->accept();
|
event->accept();
|
||||||
} else if (result == QMessageBox::Cancel) {
|
} else if (result == QMessageBox::Cancel) {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
|
@ -606,6 +641,14 @@ void TilesetEditor::closeEvent(QCloseEvent *event)
|
||||||
} else {
|
} else {
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event->isAccepted()) {
|
||||||
|
if (this->paletteEditor) this->paletteEditor->close();
|
||||||
|
porymapConfig.setTilesetEditorGeometry(
|
||||||
|
this->saveGeometry(),
|
||||||
|
this->saveState()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TilesetEditor::on_actionChange_Metatiles_Count_triggered()
|
void TilesetEditor::on_actionChange_Metatiles_Count_triggered()
|
||||||
|
|
Loading…
Reference in a new issue