From fa42beac1dc917cec1e2f1d826b217374dc70650 Mon Sep 17 00:00:00 2001 From: garak Date: Fri, 1 Nov 2019 21:19:39 -0400 Subject: [PATCH 01/10] update ui so that map and events tabs share widgets - use a programmatically created QTabBar to switch between pages of stacked widget - use stacked widget to display selected objects and metatiles frames - remove unique map events tab this gives access to the toolbuttons while editing events (not functional yet) --- forms/mainwindow.ui | 4493 ++++++++++++++++++++---------------------- include/config.h | 2 +- include/mainwindow.h | 2 +- src/config.cpp | 9 +- src/mainwindow.cpp | 35 +- 5 files changed, 2179 insertions(+), 2362 deletions(-) diff --git a/forms/mainwindow.ui b/forms/mainwindow.ui index 4bb93491..42379e44 100644 --- a/forms/mainwindow.ui +++ b/forms/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 1117 - 788 + 1287 + 815 @@ -202,14 +202,14 @@ - + 0 0 - 100 + 200 0 @@ -226,501 +226,469 @@ - - - true - - - - 1 - 0 - - - - 0 - - - false - - - false - - - - - - - - :/icons/map.ico:/icons/map.ico - - - Map - - - <html><head/><body><p>Edit the map layout.</p><p>Select metatiles or collision attributes from the right panel, and paint them onto the map.</p></body></html> - - - - 0 - - - 0 - - - 0 - - - 0 - - - 6 - - - - - Qt::Horizontal + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + true + + + + 1 + 0 + + + + 0 + + + false + + + + - - - - 1 - 0 - + + + 0 - - QFrame::StyledPanel + + 0 - - QFrame::Raised + + 0 - - 1 + + 0 - - - 3 - - - 3 - - - 3 - - - 3 - - - 6 - - - + + 6 + + + + + Qt::Horizontal + + - - 0 + + 1 0 - - - 0 - 32 - - QFrame::StyledPanel QFrame::Raised - + + 1 + + + + 3 + + + 3 + + + 3 + + + 3 + - 4 + 6 - - 4 - - - 4 - - - 4 - - - 4 - - - - - true + + + + QFrame::StyledPanel - - <html><head/><body><p>Pencil</p><p><span style=" font-weight:600;">Click</span> and drag to draw on the map.</p><p><span style=" font-weight:600;">Right-click</span> and drag to select tiles.</p></body></html> - - - Paint - - - - :/icons/pencil.ico:/icons/pencil.ico - - - true - - - true - - - false + + QFrame::Raised + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 1 + 0 + + + + true + + + + + 0 + 0 + 543 + 600 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Horizontal + + + + 166 + 16 + + + + + + + + Qt::Horizontal + + + + 166 + 16 + + + + + + + + Qt::Vertical + + + + 16 + 166 + + + + + + + + + 0 + 0 + + + + false + + + false + + + QAbstractScrollArea::AdjustIgnored + + + QGraphicsView::NoDrag + + + + + + + Qt::Vertical + + + + 16 + 166 + + + + + + + + + - - - - true - - - <html><head/><body><p>Pointer</p><p>Does nothing</p></body></html> - - - Select - - - - :/icons/cursor.ico:/icons/cursor.ico - - - true - - - - - - - <html><head/><body><p>Bucket Fill</p><p>Fills all similar tiles in a region with the selected metatiles or collision attributes</p></body></html> - - - Fill - - - - :/icons/fill_color.ico:/icons/fill_color.ico - - - true - - - - - - - <html><head/><body><p>Eyedropper</p><p><span style=" font-weight:600;">Click</span> to select a metatile or collision attribute.</p></body></html> - - - Dropper - - - - :/icons/pipette.ico:/icons/pipette.ico - - - true - - - - - - - <html><head/><body><p>Move</p><p>Click to drag map around.</p></body></html> - - - ... - - - - :/icons/move.ico:/icons/move.ico - - - true - - - - - - - <html><head/><body><p>Map Shift</p><p><span style=" font-weight:600;">Click and drag</span> on the map to shift the positions of all metatiles at once. This is useful after resizing a map.</p></body></html> - - - Shift - - - - :/icons/shift.ico:/icons/shift.ico - - - true - - - - - - - <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> - - - margin-left: 10px - - - Smart Paths - - - - - - - <html><head/><body><p>Toggles a grid over the map's metatile boundaries.</p><p><span style=" font-weight:600;">Ctrl + G</span></p></body></html> - - - - - - Grid - - - - - - - Border - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - <html><head/><body><p>Change a map layout's width and height.</p></body></html> - - - Change Dimensions - - - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - + - - 1 + + 0 0 - - true + + + 0 + 32 + - - - - 0 - 0 - 542 - 628 - + + QFrame::StyledPanel + + + QFrame::Raised + + + + 4 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - false - - - false - - - QAbstractScrollArea::AdjustIgnored - - - QGraphicsView::NoDrag - - - - - - - Qt::Horizontal - - - - 166 - 16 - - - - - - - - Qt::Vertical - - - - 16 - 166 - - - - - - - - Qt::Horizontal - - - - 166 - 16 - - - - - - - - Qt::Vertical - - - - 16 - 166 - - - - - - + + 4 + + + 4 + + + 4 + + + 4 + + + + + true + + + <html><head/><body><p>Pencil</p><p><span style=" font-weight:600;">Click</span> and drag to draw on the map.</p><p><span style=" font-weight:600;">Right-click</span> and drag to select tiles.</p></body></html> + + + Paint + + + + :/icons/pencil.ico:/icons/pencil.ico + + + true + + + true + + + false + + + + + + + true + + + <html><head/><body><p>Pointer</p><p>Does nothing</p></body></html> + + + Select + + + + :/icons/cursor.ico:/icons/cursor.ico + + + true + + + + + + + <html><head/><body><p>Bucket Fill</p><p>Fills all similar tiles in a region with the selected metatiles or collision attributes</p></body></html> + + + Fill + + + + :/icons/fill_color.ico:/icons/fill_color.ico + + + true + + + + + + + <html><head/><body><p>Eyedropper</p><p><span style=" font-weight:600;">Click</span> to select a metatile or collision attribute.</p></body></html> + + + Dropper + + + + :/icons/pipette.ico:/icons/pipette.ico + + + true + + + + + + + <html><head/><body><p>Move</p><p>Click to drag map around.</p></body></html> + + + ... + + + + :/icons/move.ico:/icons/move.ico + + + true + + + + + + + <html><head/><body><p>Map Shift</p><p><span style=" font-weight:600;">Click and drag</span> on the map to shift the positions of all metatiles (Map tab) or events (Events tab) at once. This is useful after resizing a map.</p></body></html> + + + Shift + + + + :/icons/shift.ico:/icons/shift.ico + + + true + + + + + + + <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> + + + margin-left: 10px + + + Smart Paths + + + + + + + <html><head/><body><p>Toggles a grid over the map's metatile boundaries.</p><p><span style=" font-weight:600;">Ctrl + G</span></p></body></html> + + + + + + Grid + + + + + + + Border + + + true + + + + + + + <html><head/><body><p>Change a map layout's width and height.</p></body></html> + + + Change Dimensions + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 3 - - - 3 - - - 3 - - - 3 - - - - - true - + - + 0 0 - - - 156 - 0 - + + QFrame::StyledPanel - - 0 + + QFrame::Raised - - - - 0 - 0 - - - - Metatiles - - + + 3 @@ -733,51 +701,508 @@ 3 - - 3 - - - + + + + true + - + 0 0 - - Qt::ScrollBarAlwaysOn + + + 156 + 0 + - - Qt::ScrollBarAsNeeded + + 0 - - QAbstractScrollArea::AdjustIgnored - - - true - - - Qt::AlignHCenter|Qt::AlignTop - - - - true - - - - 8 - 0 - 224 - 324 - - + - + 0 0 - + + Metatiles + + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Primary Tileset + + + + + + + Qt::StrongFocus + + + <html><head/><body><p>Primary Tileset</p><p>Defines the first 0x200 metatiles available for the map.</p></body></html> + + + true + + + + + + + Secondary Tileset + + + + + + + Qt::StrongFocus + + + <html><head/><body><p>Secondary Tileset</p><p>Defines the second 0x200 metatiles available for the map.</p></body></html> + + + true + + + + + + + + + + + 0 + 0 + + + + + 0 + 92 + + + + + 16777215 + 92 + + + + QFrame::NoFrame + + + QFrame::Raised + + + + 0 + + + QLayout::SetDefaultConstraint + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Selection + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QFrame::NoFrame + + + QFrame::Plain + + + true + + + + + 0 + 0 + 443 + 74 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + + + Border + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 16777215 + 48 + + + + <html><head/><body><p>The border is a 2x2 metatile which is repeated outside of the map layout's boundary. Draw on this border area to modify it.</p></body></html> + + + QFrame::StyledPanel + + + QFrame::Sunken + + + Qt::ScrollBarAsNeeded + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 0 + 0 + + + + Qt::ScrollBarAlwaysOn + + + Qt::ScrollBarAsNeeded + + + QAbstractScrollArea::AdjustIgnored + + + true + + + Qt::AlignHCenter|Qt::AlignTop + + + + true + + + + 8 + 0 + 431 + 341 + + + + + 0 + 0 + + + + + QLayout::SetDefaultConstraint + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + true + + + + 0 + 0 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractScrollArea::AdjustIgnored + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 10 + + + 90 + + + 30 + + + Qt::Horizontal + + + + + + + + true + + + + 0 + 0 + + + + Collision + + QLayout::SetDefaultConstraint @@ -793,11 +1218,24 @@ 0 - - 0 - - - + + + + + 0 + 0 + + + + + 64 + 512 + + + + + + Qt::Vertical @@ -809,60 +1247,68 @@ - - - - true + + + + Qt::Horizontal - - - 0 - 0 - + + + 40 + 20 + - - Qt::ScrollBarAlwaysOff + + + + + + Qt::Horizontal - - Qt::ScrollBarAlwaysOff + + + 40 + 20 + - - QAbstractScrollArea::AdjustIgnored + + + + + + 0 + + + 100 + + + 50 + + + Qt::Horizontal - - - - Qt::Horizontal + + + + Opacity - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - + - - + + + + + + + + true + 0 @@ -871,210 +1317,48 @@ - 0 - 92 + 444 + 0 - - - 16777215 - 92 - - - - QFrame::NoFrame - - - QFrame::Raised - - - - 0 - - - QLayout::SetDefaultConstraint - + - 0 + 3 - 0 + 3 - 0 + 3 - 0 + 3 - - - - Selection + + + + There are no events on the current map. + + + Qt::AlignCenter - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::NoFrame - - - QFrame::Plain - - - true - - - - - 0 - 0 - 256 - 74 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - - - 0 - 0 - - - - - 0 - 110 - - - - - 16777215 - 110 - - - - Border - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - 0 - + + + + 16777215 + 32 + - - - QLayout::SetMinAndMaxSize - + + QFrame::StyledPanel + + + QFrame::Raised + + 0 @@ -1087,152 +1371,374 @@ 0 - - 0 - - - + + + + + 40 + 32 + + + + <html><head/><body><p>Add a new event to the map.</p></body></html> + + + New Object + + + + :/icons/add.ico:/icons/add.ico + + + Qt::ToolButtonTextBesideIcon + + + + + - + 0 0 - 0 - 0 + 40 + 32 - + + <html><head/><body><p>Delete the selected event from the map.</p></body></html> + + + Delete + + + + :/icons/delete.ico:/icons/delete.ico + + + Qt::ToolButtonTextBesideIcon + + + false + + + + + + + Qt::Horizontal + + - 16777215 - 16777215 + 40 + 20 - - true + + + + + + + 0 + 0 + - - - - 0 - 0 - 234 - 83 - + + Open Map Scripts + + + false + + + + + + + + + + 0 + + + + Objects + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + true + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + 0 + 0 + 430 + 521 + + + + + 0 + 0 + + + + + + + + + + Warps + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + 0 + 0 + 430 + 521 + + + + + 0 + 0 + + + + + + + + + + Triggers + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + 0 + 0 + 430 + 521 + + + + + 0 + 0 + + + + + + + + + + BGs + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + 0 + 0 + 430 + 521 + + + + + 0 + 0 + + + + + + + + + + Healspots + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + 0 + 0 + 430 + 521 + + + + + 0 + 0 + + + + + + + + + + Multiple + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 0 - - - - - - 0 - 0 - - - - - 1 - 1 - - - - - 16777215 - 16777215 - - - - <html><head/><body><p>The border is a group of metatiles which are repeated outside of the map layout's boundary. Draw on this border area to modify it.</p></body></html> - - - - + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + 0 + 0 + 430 + 521 + + + + + 0 + 0 + + + - - - - - - - - - - - - 10 - - - 90 - - - 30 - - - Qt::Horizontal - - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Primary Tileset - - - - - - - Qt::StrongFocus - - - <html><head/><body><p>Primary Tileset</p><p>Defines the first 0x200 metatiles available for the map.</p></body></html> - - - true - - - - - - - Secondary Tileset - - - - - - - Qt::StrongFocus - - - <html><head/><body><p>Secondary Tileset</p><p>Defines the second 0x200 metatiles available for the map.</p></body></html> - - - true - + + + @@ -1240,1084 +1746,22 @@ - - - true - - - - 0 - 0 - - - - Collision - - - - QLayout::SetDefaultConstraint - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 64 - 512 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 0 - - - 100 - - - 50 - - - Qt::Horizontal - - - - - - - Opacity - - - - - - - - - - - - - - - true - - - Events - - - <html><head/><body><p>Edit the map's events.</p><p>View and modify objects, warps, signs, etc.</p></body></html> - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Qt::Horizontal - - - - - 1 - 0 - - - - true - - - - - 0 - 0 - 371 - 684 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::Horizontal - - - - 166 - 16 - - - - - - - - Qt::Horizontal - - - - 166 - 16 - - - - - - - - Qt::Vertical - - - - 16 - 166 - - - - - - - - Qt::Vertical - - - - 16 - 166 - - - - - - - - - 0 - 0 - - - - - - - - - - true - - - - 0 - 0 - - - - - 444 - 0 - - - - - 3 - - - 3 - - - 3 - - - 3 - - - - - There are no events on the current map. - - - Qt::AlignCenter - - - - - - - - 16777215 - 32 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 40 - 32 - - - - <html><head/><body><p>Add a new event to the map.</p></body></html> - - - New Object - - - - :/icons/add.ico:/icons/add.ico - - - Qt::ToolButtonTextBesideIcon - - - - - - - - 0 - 0 - - - - - 40 - 32 - - - - <html><head/><body><p>Delete the selected event from the map.</p></body></html> - - - Delete - - - - :/icons/delete.ico:/icons/delete.ico - - - Qt::ToolButtonTextBesideIcon - - - false - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - Open Map Scripts - - - false - - - - - - - - - - 0 - - - - Objects - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - true - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - 0 - 0 - 430 - 575 - - - - - 0 - 0 - - - - - - - - - - Warps - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - true - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - 0 - 0 - 98 - 28 - - - - - 0 - 0 - - - - - - - - - - Triggers - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - true - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - 0 - 0 - 98 - 28 - - - - - 0 - 0 - - - - - - - - - - BGs - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - true - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - 0 - 0 - 98 - 28 - - - - - 0 - 0 - - - - - - - - - - Healspots - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - true - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - 0 - 0 - 98 - 28 - - - - - 0 - 0 - - - - - - - - - - Multiple - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - true - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - 0 - 0 - 98 - 28 - - - - - 0 - 0 - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - Header - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - false - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - QFormLayout::FieldsStayAtSizeHint - - - 12 - - - 9 - - - - - Song - - - - - - - <html><head/><body><p>The default background music for this map.</p></body></html> - - - true - - - - - - - Location - - - - - - - <html><head/><body><p>The section of the region map which the map is grouped under. This also determines the name of the map that is display when the player enters it.</p></body></html> - - - true - - - - - - - Requires Flash - - - - - - - <html><head/><body><p>Whether or not the map is dark and requires Flash to illuminate.</p></body></html> - - - - - - - - - - Weather - - - - - - - <html><head/><body><p>The default weather for this map.</p></body></html> - - - true - - - - - - - Type - - - - - - - <html><head/><body><p>The map type is a general attribute, which is used for many different things. For example. it determines whether biking or running is allowed.</p></body></html> - - - true - - - - - - - Battle scene - - - - - - - <html><head/><body><p>Determines the type of battle scene graphics to use.</p></body></html> - - - true - - - - - - - Show Location Name - - - - - - - <html><head/><body><p>Whether or not to display the location name when the player enters the map.</p></body></html> - - - - - - - - - - Allow Running - - - - - - - <html><head/><body><p>Allows the player to use Running Shoes</p></body></html> - - - - - - - - - - Allow Biking - - - - - - - <html><head/><body><p>Allows the player to use a Bike</p></body></html> - - - - - - - - - - Allow Dig & Escape Rope - - - - - - - <html><head/><body><p>Allows the player to use Dig or Escape Rope</p></body></html> - - - - - - - - - - Floor Number - - - - - - - <html><head/><body><p>Floor number to be used for maps with elevators.</p></body></html> - - - -128 - - - 127 - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Custom Fields - - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Add - - - - - - - Delete - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Custom fields will be added to the map.json file for the current map. - - - false - - - false - - - true - - - false - - - true - - - false - - - - Key - - - - - Value - - - - - - - - - - - - Connections - - - - 0 - - - 0 - - - 0 - - - 0 - - - + - + 0 0 - - QFrame::StyledPanel - - - QFrame::Raised - - + + + 0 + 0 @@ -2330,258 +1774,362 @@ 0 - - 0 - - - + + + + false + - + 0 0 - - - 0 - 32 - - QFrame::StyledPanel QFrame::Raised - - - 4 + + + QFormLayout::FieldsStayAtSizeHint - - 4 - - - 4 - - - 4 + + 12 - 4 + 9 - - - - - 0 - 0 - + + + + Song + + + + - <html><head/><body><p>Add a new connection.</p></body></html> - - - - - - - :/icons/add.ico - - - - - - - - <html><head/><body><p>Remove the currently-selected connection.</p></body></html> - - - - - - - :/icons/delete.ico - - - - - - - - Number of Connections: - - - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - <html><head/><body><p>If enabled, connections will automatically be updated on the connected map.</p></body></html> - - - Mirror to Connecting Maps - - - true - - - - - - - - - - - 0 - 0 - - - - - 0 - 32 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 6 - - - 4 - - - 4 - - - 4 - - - 4 - - - - - Map - - - - - - - <html><head/><body><p>The destination map name of the connection.</p></body></html> + <html><head/><body><p>The default background music for this map.</p></body></html> true - - + + - Offset + Location - - + + - <html><head/><body><p>The number of metatiles to offset the connection.</p></body></html> + <html><head/><body><p>The section of the region map which the map is grouped under. This also determines the name of the map that is display when the player enters it.</p></body></html> + + + true + + + + + + + Requires Flash + + + + + + + <html><head/><body><p>Whether or not the map is dark and requires Flash to illuminate.</p></body></html> + + + + + + + + + + Weather + + + + + + + <html><head/><body><p>The default weather for this map.</p></body></html> + + + true + + + + + + + Type + + + + + + + <html><head/><body><p>The map type is a general attribute, which is used for many different things. For example. it determines whether biking or running is allowed.</p></body></html> + + + true + + + + + + + Battle scene + + + + + + + <html><head/><body><p>Determines the type of battle scene graphics to use.</p></body></html> + + + true + + + + + + + Show Location Name + + + + + + + <html><head/><body><p>Whether or not to display the location name when the player enters the map.</p></body></html> + + + + + + + + + + Allow Running + + + + + + + <html><head/><body><p>Allows the player to use Running Shoes</p></body></html> + + + + + + + + + + Allow Biking + + + + + + + <html><head/><body><p>Allows the player to use a Bike</p></body></html> + + + + + + + + + + Allow Dig & Escape Rope + + + + + + + <html><head/><body><p>Allows the player to use Dig or Escape Rope</p></body></html> + + + + + + + + + + Floor Number + + + + + + + <html><head/><body><p>Floor number to be used for maps with elevators.</p></body></html> - -999 + -128 - 999 + 127 - - - - <html><head/><body><p>The direction of the connection.</p></body></html> - - - - up - - - - - right - - - - - down - - - - - left - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - + + QFrame::StyledPanel QFrame::Raised - + + + + + Custom Fields + + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Add + + + + + + + Delete + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Custom fields will be added to the map.json file for the current map. + + + false + + + false + + + true + + + false + + + true + + + false + + + + Key + + + + + Value + + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + 0 @@ -2598,110 +2146,26 @@ 0 - + - - 1 - 0 - - - - true - - - - - 0 - 0 - 818 - 574 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - 0 - 0 - 0 - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - + 0 0 + + + 0 + 32 + + QFrame::StyledPanel QFrame::Raised - + 4 @@ -2718,16 +2182,140 @@ 4 - + + + + 0 + 0 + + + + <html><head/><body><p>Add a new connection.</p></body></html> + - Dive Map + + + + + :/icons/add.ico + - + - <html><head/><body><p>Destination map name when using <span style=" font-weight:600;">Dive</span>. If empty, no such connection will exist.</p></body></html> + <html><head/><body><p>Remove the currently-selected connection.</p></body></html> + + + + + + + :/icons/delete.ico + + + + + + + + Number of Connections: + + + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + <html><head/><body><p>If enabled, connections will automatically be updated on the connected map.</p></body></html> + + + Mirror to Connecting Maps + + + true + + + + + + + + + + + 0 + 0 + + + + + 0 + 32 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 6 + + + 4 + + + 4 + + + 4 + + + 4 + + + + + Map + + + + + + + <html><head/><body><p>The destination map name of the connection.</p></body></html> true @@ -2735,24 +2323,54 @@ - + - Emerge Map + Offset - + - <html><head/><body><p>Destination map name when emerging using <span style=" font-weight:600;">Dive</span>. If empty, no such connection will exist.</p></body></html> + <html><head/><body><p>The number of metatiles to offset the connection.</p></body></html> - - true + + -999 + + + 999 - + + + <html><head/><body><p>The direction of the connection.</p></body></html> + + + + up + + + + + right + + + + + down + + + + + left + + + + + + Qt::Horizontal @@ -2767,106 +2385,296 @@ + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 1 + 0 + + + + true + + + + + 0 + 0 + 118 + 118 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + 0 + 0 + 0 + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 4 + + + 4 + + + 4 + + + 4 + + + 4 + + + + + Dive Map + + + + + + + <html><head/><body><p>Destination map name when using <span style=" font-weight:600;">Dive</span>. If empty, no such connection will exist.</p></body></html> + + + true + + + + + + + Emerge Map + + + + + + + <html><head/><body><p>Destination map name when emerging using <span style=" font-weight:600;">Dive</span>. If empty, no such connection will exist.</p></body></html> + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + - - - - - - - :/icons/tall_grass.ico:/icons/tall_grass.ico - - - Wild Pokemon - - - - - - QFrame::NoFrame - - - QFrame::Raised - - + + - + QFrame::NoFrame - QFrame::Plain + QFrame::Raised - + - - - Group + + + QFrame::NoFrame + + QFrame::Plain + + + + + + Group + + + + + + + QComboBox::AdjustToContents + + + + + + + <html><head/><body><p>Create a new group for wild pokemon data on this map.</p></body></html> + + + + + + + :/icons/add.ico:/icons/add.ico + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Configure JSON... + + + + - - - QComboBox::AdjustToContents - - - - - - - <html><head/><body><p>Create a new group for wild pokemon data on this map.</p></body></html> - - - - - - - :/icons/add.ico:/icons/add.ico - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Configure JSON... - + + + - - - - - - - - - + + + @@ -2878,7 +2686,7 @@ 0 0 - 1117 + 1287 22 @@ -2976,6 +2784,11 @@ Ctrl+O + + + Reload Project + + Save @@ -2984,6 +2797,30 @@ Ctrl+S + + + true + + + Show Wild Encounter Tables + + + + + true + + + Monitor Project Files + + + + + true + + + Use PoryScript + + New Map... @@ -3183,35 +3020,6 @@ Themes... - - - Reload Project - - - - - true - - - Show Wild Encounter Tables - - - - - true - - - Monitor Project Files - - - - - true - - - Use PoryScript - - Export Map Stitch Image... @@ -3235,6 +3043,11 @@ QToolButton
neweventtoolbutton.h
+ + QTabBar + QWidget +
qtabbar.h
+
diff --git a/include/config.h b/include/config.h index d5e5e41c..f1b1d91b 100644 --- a/include/config.h +++ b/include/config.h @@ -49,7 +49,7 @@ public: void setRecentMap(QString map); void setMapSortOrder(MapSortOrder order); void setPrettyCursors(bool enabled); - void setGeometry(QByteArray, QByteArray, QByteArray, QByteArray, QByteArray); + void setGeometry(QByteArray, QByteArray, QByteArray, QByteArray); void setCollisionOpacity(int opacity); void setMetatilesZoom(int zoom); void setShowPlayerView(bool enabled); diff --git a/include/mainwindow.h b/include/mainwindow.h index 15182ec7..db42d478 100644 --- a/include/mainwindow.h +++ b/include/mainwindow.h @@ -78,7 +78,7 @@ private slots: void on_actionMonitor_Project_Files_triggered(bool checked); void on_actionUse_Poryscript_triggered(bool checked); - void on_tabWidget_currentChanged(int index); + void on_mainTabBar_tabBarClicked(int index); void on_actionUndo_triggered(); void on_actionRedo_triggered(); diff --git a/src/config.cpp b/src/config.cpp index de8a2f56..80fcaa83 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -127,8 +127,6 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) { this->windowState = bytesFromString(value); } else if (key == "map_splitter_state") { this->mapSplitterState = bytesFromString(value); - } else if (key == "events_splitter_state") { - this->eventsSlpitterState = bytesFromString(value); } else if (key == "main_splitter_state") { this->mainSplitterState = bytesFromString(value); } else if (key == "collision_opacity") { @@ -190,7 +188,6 @@ QMap PorymapConfig::getKeyValueMap() { map.insert("window_geometry", stringFromByteArray(this->windowGeometry)); map.insert("window_state", stringFromByteArray(this->windowState)); map.insert("map_splitter_state", stringFromByteArray(this->mapSplitterState)); - map.insert("events_splitter_state", stringFromByteArray(this->eventsSlpitterState)); map.insert("main_splitter_state", stringFromByteArray(this->mainSplitterState)); map.insert("collision_opacity", QString("%1").arg(this->collisionOpacity)); map.insert("metatiles_zoom", QString("%1").arg(this->metatilesZoom)); @@ -245,12 +242,11 @@ void PorymapConfig::setMonitorFiles(bool monitor) { this->save(); } -void PorymapConfig::setGeometry(QByteArray windowGeometry_, QByteArray windowState_, QByteArray mapSplitterState_, - QByteArray eventsSlpitterState_, QByteArray mainSplitterState_) { +void PorymapConfig::setGeometry(QByteArray windowGeometry_, QByteArray windowState_, + QByteArray mapSplitterState_, QByteArray mainSplitterState_) { this->windowGeometry = windowGeometry_; this->windowState = windowState_; this->mapSplitterState = mapSplitterState_; - this->eventsSlpitterState = eventsSlpitterState_; this->mainSplitterState = mainSplitterState_; this->save(); } @@ -305,7 +301,6 @@ QMap PorymapConfig::getGeometry() { geometry.insert("window_geometry", this->windowGeometry); geometry.insert("window_state", this->windowState); geometry.insert("map_splitter_state", this->mapSplitterState); - geometry.insert("events_splitter_state", this->eventsSlpitterState); geometry.insert("main_splitter_state", this->mainSplitterState); return geometry; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 732dc0f9..18afecc3 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -79,6 +79,15 @@ void MainWindow::initExtraShortcuts() { } void MainWindow::initCustomUI() { + // Set up the tab bar + ui->mainTabBar->addTab("Map"); // add the icon + ui->mainTabBar->setTabIcon(0, QIcon(QStringLiteral(":/icons/map.ico"))); + ui->mainTabBar->addTab("Events"); + ui->mainTabBar->addTab("Header"); + ui->mainTabBar->addTab("Connections"); + ui->mainTabBar->addTab("Wild Pokemon"); // add the icon + ui->mainTabBar->setTabIcon(4, QIcon(QStringLiteral(":/icons/tall_grass.ico"))); + // Right-clicking on items in the map list tree view brings up a context menu. ui->mapList->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->mapList, SIGNAL(customContextMenuRequested(const QPoint &)), @@ -152,11 +161,14 @@ void MainWindow::initMapSortOrder() { void MainWindow::setProjectSpecificUIVisibility() { - ui->tabWidget->setTabEnabled(4, projectConfig.getEncounterJsonActive()); - ui->actionUse_Encounter_Json->setChecked(projectConfig.getEncounterJsonActive()); ui->actionUse_Poryscript->setChecked(projectConfig.getUsePoryScript()); + if (!projectConfig.getEncounterJsonActive()) { + ui->mainTabBar->removeTab(4); + ui->mainStackedWidget->removeWidget(ui->mainStackedWidget->widget(4)); + } + switch (projectConfig.getBaseGameVersion()) { case BaseGameVersion::pokeruby: @@ -264,7 +276,6 @@ void MainWindow::restoreWindowState() { this->restoreGeometry(geometry.value("window_geometry")); this->restoreState(geometry.value("window_state")); this->ui->splitter_map->restoreState(geometry.value("map_splitter_state")); - this->ui->splitter_events->restoreState(geometry.value("events_splitter_state")); this->ui->splitter_main->restoreState(geometry.value("main_splitter_state")); } @@ -444,7 +455,7 @@ void MainWindow::redrawMapScene() if (!editor->displayMap()) return; - on_tabWidget_currentChanged(ui->tabWidget->currentIndex()); + on_mainTabBar_tabBarClicked(ui->mainStackedWidget->currentIndex()); double base = editor->scale_base; double exp = editor->scale_exp; @@ -455,11 +466,7 @@ void MainWindow::redrawMapScene() ui->graphicsView_Map->setScene(editor->scene); ui->graphicsView_Map->setSceneRect(editor->scene->sceneRect()); ui->graphicsView_Map->setFixedSize(width, height); - - ui->graphicsView_Objects_Map->setScene(editor->scene); - ui->graphicsView_Objects_Map->setSceneRect(editor->scene->sceneRect()); - ui->graphicsView_Objects_Map->setFixedSize(width, height); - ui->graphicsView_Objects_Map->editor = editor; + ui->graphicsView_Map->editor = editor; ui->graphicsView_Connections->setScene(editor->scene); ui->graphicsView_Connections->setSceneRect(editor->scene->sceneRect()); @@ -1203,11 +1210,16 @@ void MainWindow::on_action_Exit_triggered() QApplication::quit(); } -void MainWindow::on_tabWidget_currentChanged(int index) +void MainWindow::on_mainTabBar_tabBarClicked(int index) { + int tabIndexToStackIndex[5] = {0, 0, 1, 2, 3}; + ui->mainStackedWidget->setCurrentIndex(tabIndexToStackIndex[index]); + if (index == 0) { + ui->stackedWidget_MapEvents->setCurrentIndex(0); on_tabWidget_2_currentChanged(ui->tabWidget_2->currentIndex()); } else if (index == 1) { + ui->stackedWidget_MapEvents->setCurrentIndex(1); editor->setEditingObjects(); } else if (index == 3) { editor->setEditingConnections(); @@ -1318,13 +1330,11 @@ void MainWindow::scaleMapView(int s) { double sfactor = pow(base,s); ui->graphicsView_Map->scale(sfactor,sfactor); - ui->graphicsView_Objects_Map->scale(sfactor,sfactor); ui->graphicsView_Connections->scale(sfactor,sfactor); int width = static_cast(ceil((editor->scene->width()) * pow(base,exp))) + 2; int height = static_cast(ceil((editor->scene->height()) * pow(base,exp))) + 2; ui->graphicsView_Map->setFixedSize(width, height); - ui->graphicsView_Objects_Map->setFixedSize(width, height); ui->graphicsView_Connections->setFixedSize(width, height); } } @@ -2512,7 +2522,6 @@ void MainWindow::closeEvent(QCloseEvent *event) { this->saveGeometry(), this->saveState(), this->ui->splitter_map->saveState(), - this->ui->splitter_events->saveState(), this->ui->splitter_main->saveState() ); porymapConfig.save(); From bf585496668a5e76f2ccc49b47808bd38fc79b21 Mon Sep 17 00:00:00 2001 From: garak Date: Fri, 1 Nov 2019 23:08:45 -0400 Subject: [PATCH 02/10] update midnight theme disabled widgets, disable some ui in event tab --- include/editor.h | 1 + resources/icons/cursor.ico | Bin 1150 -> 1150 bytes resources/themes/midnight.qss | 2 +- src/editor.cpp | 21 +++++++++++++++++++++ src/mainwindow.cpp | 2 +- src/ui/mappixmapitem.cpp | 4 ++-- 6 files changed, 26 insertions(+), 4 deletions(-) diff --git a/include/editor.h b/include/editor.h index 31279095..c63217ea 100644 --- a/include/editor.h +++ b/include/editor.h @@ -70,6 +70,7 @@ public: void setEditingCollision(); void setEditingObjects(); void setEditingConnections(); + void setMapEditingButtonsVisibile(bool visible); void clearWildMonTabWidgets(); void setCurrentConnectionDirection(QString curDirection); void updateCurrentConnectionDirection(QString curDirection); diff --git a/resources/icons/cursor.ico b/resources/icons/cursor.ico index b502cb0444e6d7fb91794333dce0cb03b37221e7..7cab36073d87974a37776e4d042c7ed4e128e296 100644 GIT binary patch delta 14 Vcmeyz@sDGI_GEDu;f;0cursorMapTileRect->stopSingleTileMode(); this->cursorMapTileRect->setVisibility(true); + + setMapEditingButtonsVisibile(true); } void Editor::setEditingCollision() { @@ -120,6 +122,8 @@ void Editor::setEditingCollision() { setConnectionItemsVisible(false); this->cursorMapTileRect->setSingleTileMode(); this->cursorMapTileRect->setVisibility(true); + + setMapEditingButtonsVisibile(true); } void Editor::setEditingObjects() { @@ -139,6 +143,22 @@ void Editor::setEditingObjects() { setConnectionItemsVisible(false); this->cursorMapTileRect->setSingleTileMode(); this->cursorMapTileRect->setVisibility(false); + + setMapEditingButtonsVisibile(false); +} + +void Editor::setMapEditingButtonsVisibile(bool visible) { + this->ui->toolButton_Fill->setEnabled(visible); + // If the fill button is pressed, unpress it and select the pointer. + if (!visible && this->ui->toolButton_Fill->isChecked()) { + qDebug() << "deselect flood fill button"; + this->map_edit_mode = "select"; + this->settings->mapCursor = QCursor(); + this->cursorMapTileRect->setSingleTileMode(); + this->ui->toolButton_Fill->setChecked(false); + this->ui->toolButton_Select->setChecked(true); + } + this->ui->checkBox_smartPaths->setEnabled(visible); } void Editor::setEditingConnections() { @@ -987,6 +1007,7 @@ void Editor::setSmartPathCursorMode(QGraphicsSceneMouseEvent *event) } void Editor::mouseEvent_map(QGraphicsSceneMouseEvent *event, MapPixmapItem *item) { + // TODO: add event tab object painting tool buttons stuff here if (!item->paintingEnabled) { return; } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 18afecc3..1cdc8df0 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2054,7 +2054,7 @@ void MainWindow::on_toolButton_Paint_clicked() void MainWindow::on_toolButton_Select_clicked() { editor->map_edit_mode = "select"; - editor->settings->mapCursor = QCursor(QPixmap(":/icons/cursor.ico"), 0, 0); + editor->settings->mapCursor = QCursor();//QPixmap(":/icons/cursor.ico"), 0, 0); editor->cursorMapTileRect->setSingleTileMode(); ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); diff --git a/src/ui/mappixmapitem.cpp b/src/ui/mappixmapitem.cpp index 103a15c5..8bcfef7a 100644 --- a/src/ui/mappixmapitem.cpp +++ b/src/ui/mappixmapitem.cpp @@ -558,13 +558,13 @@ void MapPixmapItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { int x = static_cast(event->pos().x()) / 16; int y = static_cast(event->pos().y()) / 16; emit this->hoveredMapMetatileChanged(x, y); - if (this->settings->betterCursors && this->paintingEnabled) { + if (this->settings->betterCursors/* && this->paintingEnabled*/) { setCursor(this->settings->mapCursor); } } void MapPixmapItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *) { emit this->hoveredMapMetatileCleared(); - if (this->settings->betterCursors && this->paintingEnabled) { + if (this->settings->betterCursors/* && this->paintingEnabled*/) { unsetCursor(); } } From b5adbe782d7086f10888d4dbd30c2cd668a7b38b Mon Sep 17 00:00:00 2001 From: garak Date: Sat, 2 Nov 2019 14:40:43 -0400 Subject: [PATCH 03/10] extend most toolbuttons for use in event editing --- include/editor.h | 2 +- include/ui/mappixmapitem.h | 11 ++- src/editor.cpp | 166 ++++++++++++++++++++++----------- src/ui/collisionpixmapitem.cpp | 4 +- src/ui/mappixmapitem.cpp | 4 +- 5 files changed, 123 insertions(+), 64 deletions(-) diff --git a/include/editor.h b/include/editor.h index c63217ea..8a02898d 100644 --- a/include/editor.h +++ b/include/editor.h @@ -70,7 +70,7 @@ public: void setEditingCollision(); void setEditingObjects(); void setEditingConnections(); - void setMapEditingButtonsVisibile(bool visible); + void setMapEditingButtonsEnabled(bool enabled); void clearWildMonTabWidgets(); void setCurrentConnectionDirection(QString curDirection); void updateCurrentConnectionDirection(QString curDirection); diff --git a/include/ui/mappixmapitem.h b/include/ui/mappixmapitem.h index 0b61fff8..1443785d 100644 --- a/include/ui/mappixmapitem.h +++ b/include/ui/mappixmapitem.h @@ -13,14 +13,19 @@ private: using QGraphicsPixmapItem::paint; public: + enum class PaintMode { + Disabled, + Metatiles, + EventObjects + }; MapPixmapItem(Map *map_, MetatileSelector *metatileSelector, Settings *settings) { this->map = map_; this->metatileSelector = metatileSelector; this->settings = settings; - this->paintingEnabled = true; + this->paintingMode = PaintMode::Metatiles; setAcceptHoverEvents(true); } - bool paintingEnabled; + MapPixmapItem::PaintMode paintingMode; Map *map; MetatileSelector *metatileSelector; Settings *settings; @@ -46,6 +51,8 @@ private: void paintSmartPath(int x, int y); static QList smartPathTable; + void paint_object(QGraphicsSceneMouseEvent*);// ? + signals: void startPaint(QGraphicsSceneMouseEvent *, MapPixmapItem *); void endPaint(QGraphicsSceneMouseEvent *, MapPixmapItem *); diff --git a/src/editor.cpp b/src/editor.cpp index c103da57..6b7b22e6 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -54,7 +54,7 @@ void Editor::saveUiFields() { } void Editor::undo() { - if (current_view && map_item->paintingEnabled) { + if (current_view && map_item->paintingMode == MapPixmapItem::PaintMode::Metatiles) { map->undo(); map_item->draw(); collision_item->draw(); @@ -64,7 +64,7 @@ void Editor::undo() { } void Editor::redo() { - if (current_view && map_item->paintingEnabled) { + if (current_view && map_item->paintingMode == MapPixmapItem::PaintMode::Metatiles) { map->redo(); map_item->draw(); collision_item->draw(); @@ -83,7 +83,7 @@ void Editor::closeProject() { void Editor::setEditingMap() { current_view = map_item; if (map_item) { - map_item->paintingEnabled = true; + map_item->paintingMode = MapPixmapItem::PaintMode::Metatiles; displayMapConnections(); map_item->draw(); map_item->setVisible(true); @@ -100,7 +100,7 @@ void Editor::setEditingMap() { this->cursorMapTileRect->stopSingleTileMode(); this->cursorMapTileRect->setVisibility(true); - setMapEditingButtonsVisibile(true); + setMapEditingButtonsEnabled(true); } void Editor::setEditingCollision() { @@ -112,7 +112,7 @@ void Editor::setEditingCollision() { setConnectionsVisibility(ui->checkBox_ToggleBorder->isChecked()); } if (map_item) { - map_item->paintingEnabled = true; + map_item->paintingMode = MapPixmapItem::PaintMode::Metatiles; map_item->setVisible(false); } if (events_group) { @@ -123,7 +123,7 @@ void Editor::setEditingCollision() { this->cursorMapTileRect->setSingleTileMode(); this->cursorMapTileRect->setVisibility(true); - setMapEditingButtonsVisibile(true); + setMapEditingButtonsEnabled(true); } void Editor::setEditingObjects() { @@ -132,7 +132,7 @@ void Editor::setEditingObjects() { events_group->setVisible(true); } if (map_item) { - map_item->paintingEnabled = false; + map_item->paintingMode = MapPixmapItem::PaintMode::EventObjects; map_item->setVisible(true); setConnectionsVisibility(ui->checkBox_ToggleBorder->isChecked()); } @@ -144,27 +144,29 @@ void Editor::setEditingObjects() { this->cursorMapTileRect->setSingleTileMode(); this->cursorMapTileRect->setVisibility(false); - setMapEditingButtonsVisibile(false); + setMapEditingButtonsEnabled(false); } -void Editor::setMapEditingButtonsVisibile(bool visible) { - this->ui->toolButton_Fill->setEnabled(visible); +void Editor::setMapEditingButtonsEnabled(bool enabled) { + this->ui->toolButton_Fill->setEnabled(enabled); + this->ui->toolButton_Dropper->setEnabled(enabled); + this->ui->pushButton_ChangeDimensions->setEnabled(enabled); // If the fill button is pressed, unpress it and select the pointer. - if (!visible && this->ui->toolButton_Fill->isChecked()) { - qDebug() << "deselect flood fill button"; + if (!enabled && (this->ui->toolButton_Fill->isChecked() || this->ui->toolButton_Dropper->isChecked())) { this->map_edit_mode = "select"; this->settings->mapCursor = QCursor(); this->cursorMapTileRect->setSingleTileMode(); this->ui->toolButton_Fill->setChecked(false); + this->ui->toolButton_Dropper->setChecked(false); this->ui->toolButton_Select->setChecked(true); } - this->ui->checkBox_smartPaths->setEnabled(visible); + this->ui->checkBox_smartPaths->setEnabled(enabled); } void Editor::setEditingConnections() { current_view = map_item; if (map_item) { - map_item->paintingEnabled = false; + map_item->paintingMode = MapPixmapItem::PaintMode::Disabled; map_item->draw(); map_item->setVisible(true); populateConnectionMapPickers(); @@ -886,7 +888,8 @@ void Editor::onSelectedMetatilesChanged() { void Editor::onHoveredMapMetatileChanged(int x, int y) { this->playerViewRect->updateLocation(x, y); this->cursorMapTileRect->updateLocation(x, y); - if (map_item->paintingEnabled && x >= 0 && x < map->getWidth() && y >= 0 && y < map->getHeight()) { + if (map_item->paintingMode == MapPixmapItem::PaintMode::Metatiles + && x >= 0 && x < map->getWidth() && y >= 0 && y < map->getHeight()) { int blockIndex = y * map->getWidth() + x; int tile = map->layout->blockdata->blocks->at(blockIndex).tile; this->ui->statusBar->showMessage(QString("X: %1, Y: %2, Metatile: 0x%3, Scale = %4x") @@ -900,7 +903,7 @@ void Editor::onHoveredMapMetatileChanged(int x, int y) { void Editor::onHoveredMapMetatileCleared() { this->playerViewRect->setVisible(false); this->cursorMapTileRect->setVisible(false); - if (map_item->paintingEnabled) { + if (map_item->paintingMode == MapPixmapItem::PaintMode::Metatiles) { this->ui->statusBar->clearMessage(); } } @@ -908,7 +911,8 @@ void Editor::onHoveredMapMetatileCleared() { void Editor::onHoveredMapMovementPermissionChanged(int x, int y) { this->playerViewRect->updateLocation(x, y); this->cursorMapTileRect->updateLocation(x, y); - if (map_item->paintingEnabled && x >= 0 && x < map->getWidth() && y >= 0 && y < map->getHeight()) { + if (map_item->paintingMode == MapPixmapItem::PaintMode::Metatiles + && x >= 0 && x < map->getWidth() && y >= 0 && y < map->getHeight()) { int blockIndex = y * map->getWidth() + x; uint16_t collision = map->layout->blockdata->blocks->at(blockIndex).collision; uint16_t elevation = map->layout->blockdata->blocks->at(blockIndex).elevation; @@ -923,7 +927,7 @@ void Editor::onHoveredMapMovementPermissionChanged(int x, int y) { void Editor::onHoveredMapMovementPermissionCleared() { this->playerViewRect->setVisible(false); this->cursorMapTileRect->setVisible(false); - if (map_item->paintingEnabled) { + if (map_item->paintingMode == MapPixmapItem::PaintMode::Metatiles) { this->ui->statusBar->clearMessage(); } } @@ -974,7 +978,7 @@ bool Editor::setMap(QString map_name) { } void Editor::onMapStartPaint(QGraphicsSceneMouseEvent *event, MapPixmapItem *item) { - if (!item->paintingEnabled) { + if (!(item->paintingMode == MapPixmapItem::PaintMode::Metatiles)) { return; } @@ -989,7 +993,7 @@ void Editor::onMapStartPaint(QGraphicsSceneMouseEvent *event, MapPixmapItem *ite } void Editor::onMapEndPaint(QGraphicsSceneMouseEvent *, MapPixmapItem *item) { - if (!item->paintingEnabled) { + if (!(item->paintingMode == MapPixmapItem::PaintMode::Metatiles)) { return; } this->cursorMapTileRect->stopRightClickSelectionAnchor(); @@ -1008,53 +1012,94 @@ void Editor::setSmartPathCursorMode(QGraphicsSceneMouseEvent *event) void Editor::mouseEvent_map(QGraphicsSceneMouseEvent *event, MapPixmapItem *item) { // TODO: add event tab object painting tool buttons stuff here - if (!item->paintingEnabled) { + if (item->paintingMode == MapPixmapItem::PaintMode::Disabled) { return; } - if (map_edit_mode == "paint") { - if (event->buttons() & Qt::RightButton) { - item->updateMetatileSelection(event); - } else if (event->buttons() & Qt::MiddleButton) { - if (event->modifiers() & Qt::ControlModifier) { - item->magicFill(event); - } else { - item->floodFill(event); - } - } else { - this->setSmartPathCursorMode(event); - item->paint(event); - } - } else if (map_edit_mode == "select") { - item->select(event); - } else if (map_edit_mode == "fill") { - if (event->buttons() & Qt::RightButton) { - item->updateMetatileSelection(event); - } else if (event->modifiers() & Qt::ControlModifier) { - item->magicFill(event); - } else { - item->floodFill(event); - } - } else if (map_edit_mode == "pick") { - - if (event->buttons() & Qt::RightButton) { - item->updateMetatileSelection(event); - } else { - item->pick(event); - } - } else if (map_edit_mode == "shift") { - item->shift(event); - } - QPointF pos = event->pos(); int x = static_cast(pos.x()) / 16; int y = static_cast(pos.y()) / 16; + + if (item->paintingMode == MapPixmapItem::PaintMode::Metatiles) { + if (map_edit_mode == "paint") { + if (event->buttons() & Qt::RightButton) { + item->updateMetatileSelection(event); + } else if (event->buttons() & Qt::MiddleButton) { + if (event->modifiers() & Qt::ControlModifier) { + item->magicFill(event); + } else { + item->floodFill(event); + } + } else { + this->setSmartPathCursorMode(event); + item->paint(event); + } + } else if (map_edit_mode == "select") { + item->select(event); + } else if (map_edit_mode == "fill") { + if (event->buttons() & Qt::RightButton) { + item->updateMetatileSelection(event); + } else if (event->modifiers() & Qt::ControlModifier) { + item->magicFill(event); + } else { + item->floodFill(event); + } + } else if (map_edit_mode == "pick") { + if (event->buttons() & Qt::RightButton) { + item->updateMetatileSelection(event); + } else { + item->pick(event); + } + } else if (map_edit_mode == "shift") { + item->shift(event); + } + } else if (item->paintingMode == MapPixmapItem::PaintMode::EventObjects) { + if (map_edit_mode == "paint" && event->type() == QEvent::GraphicsSceneMousePress) { + // Right-clicking while in paint mode will change mode to select. + if (event->buttons() & Qt::RightButton) { + this->map_edit_mode = "select"; + this->settings->mapCursor = QCursor(); + this->cursorMapTileRect->setSingleTileMode(); + this->ui->toolButton_Paint->setChecked(false); + this->ui->toolButton_Select->setChecked(true); + } else { + // Left-clicking while in paint mode will add a new event of the + // type of the first currently selected events. + DraggablePixmapItem * newEvent = addNewEvent(this->selected_events->first()->event->get("event_type")); + if (newEvent) { + newEvent->move(x, y); + } + } + } else if (map_edit_mode == "select") { + // do nothing here, at least for now + } else if (map_edit_mode == "shift" && item->map) { + static QPoint selection_origin; + + if (event->type() == QEvent::GraphicsSceneMouseRelease) { + // TODO: commit / update history here + } else { + if (event->type() == QEvent::GraphicsSceneMousePress) { + selection_origin = QPoint(x, y); + } else if (event->type() == QEvent::GraphicsSceneMouseMove) { + if (x != selection_origin.x() || y != selection_origin.y()) { + int xDelta = x - selection_origin.x(); + int yDelta = y - selection_origin.y(); + + for (DraggablePixmapItem *item : *(getObjects())) { + item->move(xDelta, yDelta); + } + selection_origin = QPoint(x, y); + } + } + } + } + } this->playerViewRect->updateLocation(x, y); this->cursorMapTileRect->updateLocation(x, y); } void Editor::mouseEvent_collision(QGraphicsSceneMouseEvent *event, CollisionPixmapItem *item) { - if (!item->paintingEnabled) { + if (item->paintingMode != MapPixmapItem::PaintMode::Metatiles) { return; } @@ -1792,7 +1837,7 @@ void Editor::selectMapEvent(DraggablePixmapItem *object, bool toggle) { } DraggablePixmapItem* Editor::addNewEvent(QString event_type) { - if (project && map) { + if (project && map && !event_type.isEmpty()) { Event *event = Event::createNewEvent(event_type, map->name, project); event->put("map_name", map->name); if (event_type == "event_heal_location") { @@ -1823,6 +1868,13 @@ void Editor::deleteEvent(Event *event) { // variable "selectingEvent" so that we can detect whether or not the user // is clicking on the background instead of an event. void Editor::objectsView_onMousePress(QMouseEvent *event) { + if (this->map_edit_mode == "paint" && event->buttons() & Qt::RightButton) { + this->map_edit_mode = "select"; + this->settings->mapCursor = QCursor(); + this->cursorMapTileRect->setSingleTileMode(); + this->ui->toolButton_Paint->setChecked(false); + this->ui->toolButton_Select->setChecked(true); + } bool multiSelect = event->modifiers() & Qt::ControlModifier; if (!selectingEvent && !multiSelect && selected_events->length() > 1) { DraggablePixmapItem *first = selected_events->first(); diff --git a/src/ui/collisionpixmapitem.cpp b/src/ui/collisionpixmapitem.cpp index 3d7079d9..94589a8d 100644 --- a/src/ui/collisionpixmapitem.cpp +++ b/src/ui/collisionpixmapitem.cpp @@ -4,13 +4,13 @@ void CollisionPixmapItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { int x = static_cast(event->pos().x()) / 16; int y = static_cast(event->pos().y()) / 16; emit this->hoveredMapMovementPermissionChanged(x, y); - if (this->settings->betterCursors && this->paintingEnabled) { + if (this->settings->betterCursors && this->paintingMode == MapPixmapItem::PaintMode::Metatiles) { setCursor(this->settings->mapCursor); } } void CollisionPixmapItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *) { emit this->hoveredMapMovementPermissionCleared(); - if (this->settings->betterCursors && this->paintingEnabled){ + if (this->settings->betterCursors && this->paintingMode == MapPixmapItem::PaintMode::Metatiles){ unsetCursor(); } } diff --git a/src/ui/mappixmapitem.cpp b/src/ui/mappixmapitem.cpp index 8bcfef7a..cf67e8c9 100644 --- a/src/ui/mappixmapitem.cpp +++ b/src/ui/mappixmapitem.cpp @@ -558,13 +558,13 @@ void MapPixmapItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { int x = static_cast(event->pos().x()) / 16; int y = static_cast(event->pos().y()) / 16; emit this->hoveredMapMetatileChanged(x, y); - if (this->settings->betterCursors/* && this->paintingEnabled*/) { + if (this->settings->betterCursors && this->paintingMode != MapPixmapItem::PaintMode::Disabled) { setCursor(this->settings->mapCursor); } } void MapPixmapItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *) { emit this->hoveredMapMetatileCleared(); - if (this->settings->betterCursors/* && this->paintingEnabled*/) { + if (this->settings->betterCursors && this->paintingMode != MapPixmapItem::PaintMode::Disabled) { unsetCursor(); } } From ccccb7cec07b7c3b1946fea136c80d21698383f0 Mon Sep 17 00:00:00 2001 From: garak Date: Thu, 2 Jan 2020 14:59:31 -0500 Subject: [PATCH 04/10] fix bug with adding new widget to event frame outside of a paint event --- include/ui/eventpropertiesframe.h | 9 ++++++++- include/ui/mappixmapitem.h | 2 -- src/mainwindow.cpp | 18 +++++------------- src/ui/eventpropertiesframe.cpp | 16 +++++++++++++++- 4 files changed, 28 insertions(+), 17 deletions(-) diff --git a/include/ui/eventpropertiesframe.h b/include/ui/eventpropertiesframe.h index 49add45b..7e526ab7 100644 --- a/include/ui/eventpropertiesframe.h +++ b/include/ui/eventpropertiesframe.h @@ -1,6 +1,8 @@ #ifndef EVENTPROPERTIESFRAME_H #define EVENTPROPERTIESFRAME_H +#include "event.h" + #include namespace Ui { @@ -12,11 +14,16 @@ class EventPropertiesFrame : public QFrame Q_OBJECT public: - explicit EventPropertiesFrame(QWidget *parent = nullptr); + explicit EventPropertiesFrame(Event *event, QWidget *parent = nullptr); ~EventPropertiesFrame(); + void paintEvent(QPaintEvent*); public: Ui::EventPropertiesFrame *ui; + +private: + Event *event; + bool firstShow = true; }; #endif // EVENTPROPERTIESFRAME_H diff --git a/include/ui/mappixmapitem.h b/include/ui/mappixmapitem.h index 1443785d..e0111eb0 100644 --- a/include/ui/mappixmapitem.h +++ b/include/ui/mappixmapitem.h @@ -51,8 +51,6 @@ private: void paintSmartPath(int x, int y); static QList smartPathTable; - void paint_object(QGraphicsSceneMouseEvent*);// ? - signals: void startPaint(QGraphicsSceneMouseEvent *, MapPixmapItem *); void endPaint(QGraphicsSceneMouseEvent *, MapPixmapItem *); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1cdc8df0..5408452a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -8,7 +8,6 @@ #include "ui_eventpropertiesframe.h" #include "bordermetatilespixmapitem.h" #include "currentselectedmetatilespixmapitem.h" -#include "customattributestable.h" #include #include @@ -80,12 +79,12 @@ void MainWindow::initExtraShortcuts() { void MainWindow::initCustomUI() { // Set up the tab bar - ui->mainTabBar->addTab("Map"); // add the icon + ui->mainTabBar->addTab("Map"); ui->mainTabBar->setTabIcon(0, QIcon(QStringLiteral(":/icons/map.ico"))); ui->mainTabBar->addTab("Events"); ui->mainTabBar->addTab("Header"); ui->mainTabBar->addTab("Connections"); - ui->mainTabBar->addTab("Wild Pokemon"); // add the icon + ui->mainTabBar->addTab("Wild Pokemon"); ui->mainTabBar->setTabIcon(4, QIcon(QStringLiteral(":/icons/tall_grass.ico"))); // Right-clicking on items in the map list tree view brings up a context menu. @@ -455,7 +454,7 @@ void MainWindow::redrawMapScene() if (!editor->displayMap()) return; - on_mainTabBar_tabBarClicked(ui->mainStackedWidget->currentIndex()); + on_mainTabBar_tabBarClicked(ui->mainTabBar->currentIndex()); double base = editor->scale_base; double exp = editor->scale_exp; @@ -1440,7 +1439,7 @@ void MainWindow::updateSelectedObjects() { bool pokefirered = projectConfig.getBaseGameVersion() == BaseGameVersion::pokefirered; for (DraggablePixmapItem *item : *events) { - EventPropertiesFrame *frame = new EventPropertiesFrame; + EventPropertiesFrame *frame = new EventPropertiesFrame(item->event); // frame->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); QSpinBox *x = frame->ui->spinBox_x; @@ -1746,13 +1745,6 @@ void MainWindow::updateSelectedObjects() { item->bind(combo, key); } } - - // Custom fields table. - if (event_type != EventType::HealLocation) { - CustomAttributesTable *customAttributes = new CustomAttributesTable(item->event, frame); - frame->layout()->addWidget(customAttributes); - } - frames.append(frame); } @@ -2054,7 +2046,7 @@ void MainWindow::on_toolButton_Paint_clicked() void MainWindow::on_toolButton_Select_clicked() { editor->map_edit_mode = "select"; - editor->settings->mapCursor = QCursor();//QPixmap(":/icons/cursor.ico"), 0, 0); + editor->settings->mapCursor = QCursor(); editor->cursorMapTileRect->setSingleTileMode(); ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); diff --git a/src/ui/eventpropertiesframe.cpp b/src/ui/eventpropertiesframe.cpp index f340be50..d4ea2ac8 100644 --- a/src/ui/eventpropertiesframe.cpp +++ b/src/ui/eventpropertiesframe.cpp @@ -1,14 +1,28 @@ #include "eventpropertiesframe.h" +#include "customattributestable.h" + #include "ui_eventpropertiesframe.h" -EventPropertiesFrame::EventPropertiesFrame(QWidget *parent) : +EventPropertiesFrame::EventPropertiesFrame(Event *event, QWidget *parent) : QFrame(parent), ui(new Ui::EventPropertiesFrame) { ui->setupUi(this); + this->event = event; + this->firstShow = true; } EventPropertiesFrame::~EventPropertiesFrame() { delete ui; } + +void EventPropertiesFrame::paintEvent(QPaintEvent *painter) { + // Custom fields table. + if (firstShow && event->get("event_type") != EventType::HealLocation) { + CustomAttributesTable *customAttributes = new CustomAttributesTable(event, this); + this->layout()->addWidget(customAttributes); + } + QFrame::paintEvent(painter); + firstShow = false; +} From 7e039121bb06ac8460a12cb6deb4f9aff5edb612 Mon Sep 17 00:00:00 2001 From: garakmon Date: Tue, 21 Apr 2020 14:08:44 -0400 Subject: [PATCH 05/10] fix mainwindow ui conflicts --- src/mainwindow.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5408452a..8f8978d8 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -163,10 +163,7 @@ void MainWindow::setProjectSpecificUIVisibility() ui->actionUse_Encounter_Json->setChecked(projectConfig.getEncounterJsonActive()); ui->actionUse_Poryscript->setChecked(projectConfig.getUsePoryScript()); - if (!projectConfig.getEncounterJsonActive()) { - ui->mainTabBar->removeTab(4); - ui->mainStackedWidget->removeWidget(ui->mainStackedWidget->widget(4)); - } + ui->mainTabBar->setTabEnabled(4, projectConfig.getEncounterJsonActive()); switch (projectConfig.getBaseGameVersion()) { @@ -1224,7 +1221,8 @@ void MainWindow::on_mainTabBar_tabBarClicked(int index) editor->setEditingConnections(); } if (index != 4) { - editor->saveEncounterTabData(); + if (projectConfig.getEncounterJsonActive()) + editor->saveEncounterTabData(); } } From 9e883a8a2f3368defcd1d28c9086c799bd502408 Mon Sep 17 00:00:00 2001 From: garakmon Date: Tue, 21 Apr 2020 15:12:20 -0400 Subject: [PATCH 06/10] remember edit mode in map tab --- include/mainwindow.h | 1 + src/editor.cpp | 4 ++++ src/mainwindow.cpp | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/include/mainwindow.h b/include/mainwindow.h index db42d478..1e5a65be 100644 --- a/include/mainwindow.h +++ b/include/mainwindow.h @@ -211,6 +211,7 @@ private: void displayMapProperties(); void checkToolButtons(); + void clickToolButtonFromEditMode(QString editMode); void initWindow(); void initCustomUI(); diff --git a/src/editor.cpp b/src/editor.cpp index 6b7b22e6..4d994c9e 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -1868,6 +1868,10 @@ void Editor::deleteEvent(Event *event) { // variable "selectingEvent" so that we can detect whether or not the user // is clicking on the background instead of an event. void Editor::objectsView_onMousePress(QMouseEvent *event) { + // make sure we are in object editing mode + if (map_item && map_item->paintingMode != MapPixmapItem::PaintMode::EventObjects) { + return; + } if (this->map_edit_mode == "paint" && event->buttons() & Qt::RightButton) { this->map_edit_mode = "select"; this->settings->mapCursor = QCursor(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 8f8978d8..2e90506a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1214,9 +1214,12 @@ void MainWindow::on_mainTabBar_tabBarClicked(int index) if (index == 0) { ui->stackedWidget_MapEvents->setCurrentIndex(0); on_tabWidget_2_currentChanged(ui->tabWidget_2->currentIndex()); + clickToolButtonFromEditMode(editor->prev_edit_mode); } else if (index == 1) { ui->stackedWidget_MapEvents->setCurrentIndex(1); + editor->prev_edit_mode = editor->map_edit_mode; editor->setEditingObjects(); + clickToolButtonFromEditMode("select"); } else if (index == 3) { editor->setEditingConnections(); } @@ -2115,6 +2118,22 @@ void MainWindow::checkToolButtons() { ui->toolButton_Shift->setChecked(editor->map_edit_mode == "shift"); } +void MainWindow::clickToolButtonFromEditMode(QString editMode) { + if (editMode == "paint") { + on_toolButton_Paint_clicked(); + } else if (editMode == "select") { + on_toolButton_Select_clicked(); + } else if (editMode == "fill") { + on_toolButton_Fill_clicked(); + } else if (editMode == "pick") { + on_toolButton_Dropper_clicked(); + } else if (editMode == "move") { + on_toolButton_Move_clicked(); + } else if (editMode == "shift") { + on_toolButton_Shift_clicked(); + } +} + void MainWindow::onLoadMapRequested(QString mapName, QString fromMapName) { if (!setMap(mapName, true)) { QMessageBox msgBox(this); From f57ef7a819e9a149554f545b0b12441543dd8b75 Mon Sep 17 00:00:00 2001 From: garakmon Date: Tue, 21 Apr 2020 16:15:36 -0400 Subject: [PATCH 07/10] change main tab for every click --- src/mainwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2e90506a..69594192 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1208,6 +1208,8 @@ void MainWindow::on_action_Exit_triggered() void MainWindow::on_mainTabBar_tabBarClicked(int index) { + ui->mainTabBar->setCurrentIndex(index); + int tabIndexToStackIndex[5] = {0, 0, 1, 2, 3}; ui->mainStackedWidget->setCurrentIndex(tabIndexToStackIndex[index]); From 333fe69dd8414fe834d5df76172fa8a3999ba9ee Mon Sep 17 00:00:00 2001 From: garakmon Date: Sun, 26 Apr 2020 18:55:18 -0400 Subject: [PATCH 08/10] keep selected tool when switching tabs --- include/editor.h | 1 - src/editor.cpp | 2 ++ src/mainwindow.cpp | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/editor.h b/include/editor.h index 8a02898d..1f9d9232 100644 --- a/include/editor.h +++ b/include/editor.h @@ -128,7 +128,6 @@ public: QList *selected_events = nullptr; QString map_edit_mode; - QString prev_edit_mode; int scale_exp = 0; double scale_base = sqrt(2); // adjust scale factor with this diff --git a/src/editor.cpp b/src/editor.cpp index 4d994c9e..1124c699 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -133,6 +133,8 @@ void Editor::setEditingObjects() { } if (map_item) { map_item->paintingMode = MapPixmapItem::PaintMode::EventObjects; + displayMapConnections(); + map_item->draw(); map_item->setVisible(true); setConnectionsVisibility(ui->checkBox_ToggleBorder->isChecked()); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 69594192..2a8cbd77 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1216,12 +1216,12 @@ void MainWindow::on_mainTabBar_tabBarClicked(int index) if (index == 0) { ui->stackedWidget_MapEvents->setCurrentIndex(0); on_tabWidget_2_currentChanged(ui->tabWidget_2->currentIndex()); - clickToolButtonFromEditMode(editor->prev_edit_mode); } else if (index == 1) { ui->stackedWidget_MapEvents->setCurrentIndex(1); - editor->prev_edit_mode = editor->map_edit_mode; editor->setEditingObjects(); - clickToolButtonFromEditMode("select"); + QStringList validOptions = {"select", "move", "paint", "shift"}; + QString newEditMode = validOptions.contains(editor->map_edit_mode) ? editor->map_edit_mode : "select"; + clickToolButtonFromEditMode(newEditMode); } else if (index == 3) { editor->setEditingConnections(); } From 6a27536cbb32a79f584a181f4ee3426e967c511d Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sun, 26 Apr 2020 19:47:57 -0500 Subject: [PATCH 09/10] Automatically select the newly-created event via the Pencil tool --- src/editor.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/editor.cpp b/src/editor.cpp index 1124c699..0e8a0c30 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -1070,6 +1070,7 @@ void Editor::mouseEvent_map(QGraphicsSceneMouseEvent *event, MapPixmapItem *item DraggablePixmapItem * newEvent = addNewEvent(this->selected_events->first()->event->get("event_type")); if (newEvent) { newEvent->move(x, y); + selectMapEvent(newEvent, false); } } } else if (map_edit_mode == "select") { From 438a36f29a6a4c356fb7cef37125efa43e312d89 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Tue, 28 Apr 2020 19:09:42 -0500 Subject: [PATCH 10/10] Remove spacing between top tab bar and main contain frames --- forms/mainwindow.ui | 3 +++ 1 file changed, 3 insertions(+) diff --git a/forms/mainwindow.ui b/forms/mainwindow.ui index 42379e44..3e02c9f8 100644 --- a/forms/mainwindow.ui +++ b/forms/mainwindow.ui @@ -228,6 +228,9 @@ + + 0 +