Skip to content
Permalink
Browse files
Editor: Support for initial widgets visibility states from a Config Pack
  • Loading branch information
Wohlstand committed May 26, 2018
1 parent 149e0c7 commit b13df77b99d0b7f26627ac652c3d54c52379a680
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 22 deletions.
@@ -153,6 +153,26 @@ bool dataconfigs::loadBasics()
}
guiset.endGroup();

guiset.beginGroup("widgets-default-visibility");
{
guiset.read("lvl-itembox", editor.default_visibility.lvl_itembox, true);
guiset.read("lvl-section-props", editor.default_visibility.lvl_section_props, false);
guiset.read("lvl-warp-props", editor.default_visibility.lvl_warp_props, true);
guiset.read("lvl-layers", editor.default_visibility.lvl_layers, true);
guiset.read("lvl-events", editor.default_visibility.lvl_events, true);
guiset.read("lvl-search", editor.default_visibility.lvl_search, false);

guiset.read("wld-itembox", editor.default_visibility.wld_itembox, true);
guiset.read("wld-settings", editor.default_visibility.wld_settings, false);
guiset.read("wld-search", editor.default_visibility.wld_search, false);

guiset.read("tilesets-box", editor.default_visibility.tilesets_box, true);
guiset.read("debugger-box", editor.default_visibility.debugger_box, false);
guiset.read("bookmarks-box", editor.default_visibility.bookmarks_box, false);
guiset.read("variables-box", editor.default_visibility.variables_box, false);
}
guiset.endGroup();

if(!openSection(&guiset, "main"))
return false;

@@ -56,6 +56,28 @@ struct DataFolders
PGEString gcustom;
};

struct EditorSetup
{
struct WidgetVisiblity
{
bool lvl_itembox = true;
bool lvl_section_props = false;
bool lvl_warp_props = true;
bool lvl_layers = true;
bool lvl_events = true;
bool lvl_search = false;

bool wld_itembox = true;
bool wld_settings = false;
bool wld_search = false;

bool tilesets_box = true;
bool debugger_box = false;
bool bookmarks_box = false;
bool variables_box = false;
} default_visibility;
};

struct EngineSetup
{
int screen_w;
@@ -122,6 +144,7 @@ class dataconfigs : public QObject
QString splash_logo;
QList<obj_splash_ani > animations;

EditorSetup editor;
EngineSetup engine;

//Playable Characters
@@ -127,23 +127,23 @@ void MainWindow::loadSettings()
GlobalSettings::animatorItemsLimit = settings.value("animation-item-limit", "30000").toInt();

// toolbox parameter prefix pointer to toolbox saved visibility state flag defaults: vis. flaoting
loadToolboxProps(settings, QStringLiteral("level-item-box"), dock_LvlItemBox, true, false);
loadToolboxProps(settings, QStringLiteral("level-item-box"), dock_LvlItemBox, configs.editor.default_visibility.lvl_itembox, false);
loadToolboxProps(settings, QStringLiteral("level-itemprops-box"), dock_LvlItemProps, false, true);
loadToolboxProps(settings, QStringLiteral("level-section-set"), dock_LvlSectionProps, true, true);
loadToolboxProps(settings, QStringLiteral("level-warps-box"), dock_LvlWarpProps, false, true);
loadToolboxProps(settings, QStringLiteral("level-layers"), dock_LvlLayers, true, true);
loadToolboxProps(settings, QStringLiteral("level-events"), dock_LvlEvents, true, true);
loadToolboxProps(settings, QStringLiteral("level-search"), dock_LvlSearchBox, false, true);

loadToolboxProps(settings, QStringLiteral("world-item-box"), dock_WldItemBox, true, false);
loadToolboxProps(settings, QStringLiteral("world-settings-box"), dock_WldSettingsBox, false, true);
loadToolboxProps(settings, QStringLiteral("level-section-set"), dock_LvlSectionProps, configs.editor.default_visibility.lvl_section_props, true);
loadToolboxProps(settings, QStringLiteral("level-warps-box"), dock_LvlWarpProps, configs.editor.default_visibility.lvl_warp_props, true);
loadToolboxProps(settings, QStringLiteral("level-layers"), dock_LvlLayers, configs.editor.default_visibility.lvl_layers, true);
loadToolboxProps(settings, QStringLiteral("level-events"), dock_LvlEvents, configs.editor.default_visibility.lvl_events, true);
loadToolboxProps(settings, QStringLiteral("level-search"), dock_LvlSearchBox, configs.editor.default_visibility.lvl_search, true);

loadToolboxProps(settings, QStringLiteral("world-item-box"), dock_WldItemBox, configs.editor.default_visibility.wld_itembox, false);
loadToolboxProps(settings, QStringLiteral("world-settings-box"), dock_WldSettingsBox, configs.editor.default_visibility.wld_settings, true);
loadToolboxProps(settings, QStringLiteral("world-itemprops-box"), dock_WldItemProps, false, false);
loadToolboxProps(settings, QStringLiteral("world-search"), dock_WldSearchBox, false, true);
loadToolboxProps(settings, QStringLiteral("world-search"), dock_WldSearchBox, configs.editor.default_visibility.wld_search, true);

loadToolboxProps(settings, QStringLiteral("tileset-box"), dock_TilesetBox, true, true);
loadToolboxProps(settings, QStringLiteral("debugger-box"), dock_DebuggerBox, false, true);
loadToolboxProps(settings, QStringLiteral("bookmarks-box"), dock_BookmarksBox, false, true);
loadToolboxProps(settings, QStringLiteral("variables-box"), dock_VariablesBox, false, true);
loadToolboxProps(settings, QStringLiteral("tileset-box"), dock_TilesetBox, configs.editor.default_visibility.tilesets_box, true);
loadToolboxProps(settings, QStringLiteral("debugger-box"), dock_DebuggerBox, configs.editor.default_visibility.debugger_box, true);
loadToolboxProps(settings, QStringLiteral("bookmarks-box"), dock_BookmarksBox, configs.editor.default_visibility.bookmarks_box, true);
loadToolboxProps(settings, QStringLiteral("variables-box"), dock_VariablesBox, configs.editor.default_visibility.variables_box, true);

ui->centralWidget->setViewMode(GlobalSettings::MainWindowView);
dock_LvlItemBox->tabWidget()->setTabPosition(GlobalSettings::LVLToolboxPos);
@@ -81,16 +81,17 @@ void MainWindow::on_actionSMBX_like_GUI_triggered()
setSubView();

int win = activeChildWindow();
if(win==WND_Level)
if(win == WND_Level)
on_actionLVLToolBox_triggered(false);
if(win==WND_World)
if(win == WND_World)
on_actionWLDToolBox_triggered(false);
if((win==WND_Level) || (win==WND_World))
if(((win == WND_Level) || (win == WND_World)) && configs.editor.default_visibility.tilesets_box)
on_actionTilesetBox_triggered(true);

dock_LvlItemBox->m_lastVisibilityState = false;
dock_WldItemBox->m_lastVisibilityState = false;
dock_TilesetBox->m_lastVisibilityState = true;
if(configs.editor.default_visibility.tilesets_box)
dock_TilesetBox->m_lastVisibilityState = true;
m_toolbarVanilla->setVisible(true);
}

@@ -100,15 +101,17 @@ void MainWindow::on_actionModern_GUI_triggered()
setTabView();

int win = activeChildWindow();
if(win==WND_Level)
if((win == WND_Level) && configs.editor.default_visibility.lvl_itembox)
on_actionLVLToolBox_triggered(true);
if(win==WND_World)
if((win == WND_World) && configs.editor.default_visibility.wld_itembox)
on_actionWLDToolBox_triggered(true);
//if((win==WND_Level) || (win==WND_World))
// on_actionTilesetBox_triggered(false);

dock_LvlItemBox->m_lastVisibilityState = true;
dock_WldItemBox->m_lastVisibilityState = true;
if(configs.editor.default_visibility.lvl_itembox)
dock_LvlItemBox->m_lastVisibilityState = true;
if(configs.editor.default_visibility.wld_itembox)
dock_WldItemBox->m_lastVisibilityState = true;
//dock_TilesetBox->m_lastVisibilityState = false;
m_toolbarVanilla->setVisible(false);
}
@@ -4,6 +4,7 @@ Editor 0.3.1.14-1-dev
- Player start points now aligning with 16x16 grid size
- Support for Legacy Editor level test run has been removed due to troubles produced by this very outdated thing
- Fixed the sync of the world map item box and the tool button
- Added an ability to declare default visibility of toolboxes visibility in the config pack main.ini

Editor 0.3.1.14
- Fixed a crash on attempt to load some NPC-*.txt files with incorrect values (for example, a grid size value that equal to zero)

0 comments on commit b13df77

Please sign in to comment.