Linux multi-monitor fullscreen support
[ryzomcore.git] / ryzom / client / src / interface_v3 / macrocmd_manager.h
blob0bc2eec03c0796ac59633db274854b66150b3be2
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010-2016 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef RZ_MACROCMD_MANAGER_H
20 #define RZ_MACROCMD_MANAGER_H
22 #include "nel/misc/stream.h"
23 #include "../actions.h"
25 // ***************************************************************************
26 class CActionsManager;
27 class CModalContainerEditCmd;
29 // ***************************************************************************
30 class CMacroCmd
32 public:
33 class CCommand // An action handler
35 public:
36 std::string Name;
37 std::string Params;
39 // ------------------------------
40 CCommand() { }
42 CCommand(const char *name)
44 Name = name;
47 CCommand(const char *name, const char *params)
49 Name = name;
50 Params = params;
53 void serial (NLMISC::IStream &f);
56 // All commands
57 std::vector<CCommand> Commands;
59 CCombo Combo;
61 // Display bitmap form
62 uint8 BitmapBack; // 0xFF = Pas de Back
63 uint8 BitmapIcon; // 0xFF = Pas de Ico
64 uint8 BitmapOver; // 0xFF = Pas de Over
65 std::string DispText; // Simple text (A-Z,0-9)
67 // Display strings form
68 std::string Name;
70 // The macro id
71 sint32 ID;
73 // ------------------------------
74 public:
75 CMacroCmd();
77 void addCommand (const std::string &sName, const std::string &sParam, sint32 nPos=-1);
78 void delCommand (uint cmdNb);
79 void moveUpCommand (uint cmdNb);
80 void moveDownCommand (uint cmdNb);
82 void writeTo (xmlNodePtr node) const;
83 bool readFrom (xmlNodePtr node);
86 // ***************************************************************************
87 class CMacroCmdManager
89 public:
91 static CMacroCmdManager *getInstance()
93 if (_Instance == NULL)
94 _Instance = new CMacroCmdManager;
95 return _Instance;
98 // release singleton
99 static void releaseInstance();
101 void initInGame();
102 void uninitInGame();
104 const std::vector<CMacroCmd> &getMacros() { return _Macros; }
105 void addMacro (const CMacroCmd &m, sint32 nPos=-1);
106 void delMacro(sint32 nMacNb);
107 void removeAllMacros();
109 void refreshMacroCombo();
111 sint32 getTexIdBack(uint8 nb) { return (nb>=_OptBackId.size()) ? _OptBackId[_OptBackId.size()-1] : _OptBackId[nb]; }
112 sint32 getTexIdIcon(uint8 nb) { return (nb>=_OptIconId.size()) ? _OptIconId[_OptIconId.size()-1] : _OptIconId[nb]; }
113 sint32 getTexIdOver(uint8 nb) { return (nb>=_OptOverId.size()) ? _OptOverId[_OptOverId.size()-1] : _OptOverId[nb]; }
115 void execute (uint nMacroNb);
116 void executeID (sint32 nMacroID);
117 void updateMacroExecution ();
118 void receiveActionEnd(uint8 actionId);
120 uint32 getActionId() { return _ActionId; }
121 void incActionId() { _ActionId++; }
123 const CMacroCmd *getMacroFromMacroID(sint32 id);
125 // Call This method when keys changed (delete, edit, etc...)
126 void refreshAllKeyDisplays();
128 public:
129 std::vector<CActionsManager*> ActionManagers;
131 CMacroCmd CurrentEditMacro;
132 sint32 CurrentEditMacroNb; // -1 -> create;
134 CModalContainerEditCmd *EditCmd;
135 CModalContainerEditCmd *NewKey;
137 protected:
139 std::vector<CMacroCmd> _Macros;
141 std::vector<sint32> _OptBackId; // All the back bitmap possible
142 std::vector<sint32> _OptIconId; // All the icon bitmap possible
143 std::vector<sint32> _OptOverId; // All the over bitmap possible
145 sint32 _CurExecMac; // Current macro in execution
146 sint32 _CurExecCmd;
147 sint32 _CurExecCmdWait;
148 sint32 _CurExecCmdWaitId;
149 bool _CurExecCmdWaitEnded;
151 uint8 _ActionId;
153 sint32 _MacroIDGenerator;
154 private:
156 static CMacroCmdManager *_Instance;
158 CMacroCmdManager();
159 ~CMacroCmdManager();
160 void delActionManagerEntries();
161 void addActionManagerEntries();
165 // ***************************************************************************
166 // Interface Part
167 // ***************************************************************************
169 #define AH_MACRO_EXEC "macro_exec"
171 #define WIN_MACRO "ui:interface:macros"
172 #define WIN_MACRO_CONTENT "ui:interface:macros:content:macros:list"
173 #define TEMPLATE_MACRO_ELT "element_macro"
174 #define TEMPLATE_MACRO_ELT_TEXT "macro_name"
175 #define TEMPLATE_MACRO_ELT_ICON "icon"
176 #define TEMPLATE_MACRO_ELT_KEYTEXT "macro_key"
179 #define WIN_NEWMACRO "ui:interface:new_macro"
180 #define VIEW_NEWMACRO_TITLE "ui:interface:new_macro:header_opened:title"
181 #define NEWMACRO_TITLE_NEW "uiNewMacro"
182 #define NEWMACRO_TITLE_EDIT "uiEditMacro"
183 #define CTRL_NEWMACRO_ICON "ui:interface:new_macro:content:icon"
184 #define GROUP_NEWMACRO_EDIT_NAME "ui:interface:new_macro:content:edit_name"
185 #define GROUP_NEWMACRO_COMMANDS "ui:interface:new_macro:content:cmds:macros:list"
186 #define VIEW_NEWMACRO_KEY "ui:interface:new_macro:content:macro_key"
187 #define TEMPLATE_NEWMACRO_COMMAND "macro_command"
188 #define TEMPLATE_NEWMACRO_COMMAND_TEXT "macro_name"
190 #define WIN_MACROICONCREATION "ui:interface:macro_icon_creation"
191 #define CTRL_MACROICONCREATION_ICON "ui:interface:macro_icon_creation:icon"
192 #define GROUP_MACROICONCREATION_BACK "ui:interface:macro_icon_creation:IconBackground"
193 #define GROUP_MACROICONCREATION_ICON "ui:interface:macro_icon_creation:IconForeground"
194 #define GROUP_MACROICONCREATION_OVER "ui:interface:macro_icon_creation:IconPattern"
195 #define CTRL_MACROICONCREATION_BUTTON ":but"
196 #define CTRL_MACROICONCREATION_EDITTEXT "ui:interface:macro_icon_creation:edit_name"
198 // ***************************************************************************
201 #endif // RZ_MACROCMD_MANAGER_H