3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef GUICONFIGUREWORLD_HEADER
21 #define GUICONFIGUREWORLD_HEADER
23 #include "irrlichttypes_extrabloated.h"
24 #include "modalMenu.h"
32 class IGUITreeViewNode;
36 class GUIConfigureWorld : public GUIModalMenu
39 GUIConfigureWorld(gui::IGUIEnvironment* env,
40 gui::IGUIElement* parent, s32 id,
41 IMenuManager *menumgr, WorldSpec wspec);
43 void regenerateGui(v2u32 screensize);
47 bool OnEvent(const SEvent& event);
53 // tree of installed add-on mods. key is the mod name, modpacks
55 std::map<std::string, ModSpec> m_addontree;
57 // like m_addontree, but modpacks are expanded.
58 std::map<std::string, ModSpec> m_addonmods;
60 // list of game mods (flattened)
61 std::map<std::string, ModSpec> m_gamemods;
63 // list of world mods (flattened)
64 std::map<std::string, ModSpec> m_worldmods;
66 // for each mod, the set of mods depending on it
67 std::multimap<std::string, std::string> m_reverse_depends;
69 // the settings in the world.mt file
72 // mods that are installed but not mentioned in world.mt file
73 std::set<std::string> m_new_mod_names;
75 // maps modnames to nodes in m_treeview
76 std::map<std::string,gui::IGUITreeViewNode*> m_nodes;
78 gui::IGUIStaticText* m_modname_text;
79 gui::IGUITreeView* m_treeview;
80 gui::IGUIButton* m_enableall;
81 gui::IGUIButton* m_disableall;
82 gui::IGUICheckBox* m_enabled_checkbox;
83 gui::IGUIListBox* m_dependencies_listbox;
84 gui::IGUIListBox* m_rdependencies_listbox;
85 void buildTreeView(std::map<std::string,ModSpec> mods,
86 gui::IGUITreeViewNode* node);
88 void enableAllMods(std::map<std::string,ModSpec> mods, bool enable);
89 void setEnabled(std::string modname, bool enable)
97 void enableMod(std::string modname);
98 void disableMod(std::string modname);
100 // hack to work around wonky handling of double-click in
101 // irrlicht. store selected index of listbox items here so event
102 // handling can check whether it was a real double click on the
103 // same item. (irrlicht also reports a double click if you rapidly
104 // select two different items.)
108 IMenuManager* m_menumgr;