Changed: Make number of virtual desktops dynamic
--HG-- branch : develop
This commit is contained in:
parent
23fa3d7460
commit
4851d1602d
3 changed files with 35 additions and 15 deletions
|
@ -896,11 +896,8 @@ bool CChatGroupWindow::removeFreeTeller(const std::string &containerID)
|
|||
if (i == _FreeTellers.size())
|
||||
return false;
|
||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||
// Create the free teller in all the desktops images
|
||||
for (uint m = 0; m < MAX_NUM_MODES; ++m)
|
||||
{
|
||||
pIM->removeGroupContainerImage(_FreeTellers[i]->getId(), m);
|
||||
}
|
||||
pIM->removeGroupContainerImageFromDesktops(_FreeTellers[i]->getId());
|
||||
|
||||
CInterfaceGroup *pRoot = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId("ui:interface"));
|
||||
CWidgetManager::getInstance()->unMakeWindow(_FreeTellers[i]);
|
||||
pRoot->delGroup (_FreeTellers[i]);
|
||||
|
|
|
@ -502,6 +502,7 @@ CInterfaceManager::CInterfaceManager()
|
|||
CViewRenderer::getInstance()->init();
|
||||
|
||||
_CurrentMode = 0;
|
||||
_Modes.resize(MAX_NUM_MODES);
|
||||
|
||||
setInGame( false );
|
||||
|
||||
|
@ -1700,6 +1701,11 @@ bool CInterfaceManager::loadConfig (const string &filename)
|
|||
f.serialCheck(NELID("GFCI"));
|
||||
f.serial(nNbMode);
|
||||
f.serial(_CurrentMode);
|
||||
if (_CurrentMode > nNbMode)
|
||||
{
|
||||
_CurrentMode = 0;
|
||||
}
|
||||
|
||||
if(ver>=10)
|
||||
{
|
||||
f.serial(_LastInGameScreenW);
|
||||
|
@ -1707,10 +1713,16 @@ bool CInterfaceManager::loadConfig (const string &filename)
|
|||
lastInGameScreenResLoaded= true;
|
||||
}
|
||||
|
||||
// Initialize at least number of modes that are saved in stream
|
||||
_Modes.resize(std::max((uint32)MAX_NUM_MODES, nNbMode));
|
||||
for (uint32 i = 0; i < _Modes.size(); ++i)
|
||||
{
|
||||
NLMISC::contReset(_Modes[i]);
|
||||
}
|
||||
|
||||
// Load All Window configuration of all Modes
|
||||
for (uint32 i = 0; i < nNbMode; ++i)
|
||||
{
|
||||
NLMISC::contReset(_Modes[i]);
|
||||
// must create a tmp mem stream because desktop image expect its datas to occupy the whole stream
|
||||
// This is because of old system that manipulated desktop image direclty as a mem stream
|
||||
CMemStream ms;
|
||||
|
@ -1890,7 +1902,7 @@ bool CInterfaceManager::saveConfig (const string &filename)
|
|||
|
||||
|
||||
// cleanup all desktops
|
||||
for(uint k = 0; k < MAX_NUM_MODES; ++k)
|
||||
for(uint k = 0; k < _Modes.size(); ++k)
|
||||
{
|
||||
quitVisitor.Desktop = k;
|
||||
setMode(k);
|
||||
|
@ -1919,7 +1931,7 @@ bool CInterfaceManager::saveConfig (const string &filename)
|
|||
|
||||
uint32 i;
|
||||
|
||||
i = MAX_NUM_MODES;
|
||||
i = _Modes.size();
|
||||
try
|
||||
{
|
||||
f.serialVersion(ICFG_STREAM_VERSION);
|
||||
|
@ -1941,7 +1953,7 @@ bool CInterfaceManager::saveConfig (const string &filename)
|
|||
f.serial(_LastInGameScreenH);
|
||||
|
||||
// Save All Window configuration of all Modes
|
||||
for (i = 0; i < MAX_NUM_MODES; ++i)
|
||||
for (i = 0; i < _Modes.size(); ++i)
|
||||
{
|
||||
// must create a tmp mem stream because desktop image expect its datas to occupy the whole stream
|
||||
// This is because of old system that manipulated desktop image direclty as a mem stream
|
||||
|
@ -2065,7 +2077,7 @@ bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
|
|||
void CInterfaceManager::updateDesktops( uint32 newScreenW, uint32 newScreenH )
|
||||
{
|
||||
// *** Do it for All Backuped Desktops
|
||||
for(uint md=0;md<MAX_NUM_MODES;md++)
|
||||
for(uint md=0; md<_Modes.size(); md++)
|
||||
{
|
||||
CInterfaceConfig::CDesktopImage &mode= _Modes[md];
|
||||
// For all containers of this mode
|
||||
|
@ -2413,7 +2425,7 @@ void CInterfaceManager::launchContextMenuInGame (const std::string &nameOfCM)
|
|||
// ***************************************************************************
|
||||
void CInterfaceManager::updateGroupContainerImage(CGroupContainer &gc, uint8 mode)
|
||||
{
|
||||
if (mode >= MAX_NUM_MODES)
|
||||
if (mode >= _Modes.size())
|
||||
{
|
||||
nlwarning("wrong desktop");
|
||||
return;
|
||||
|
@ -2424,7 +2436,7 @@ void CInterfaceManager::updateGroupContainerImage(CGroupContainer &gc, uint8 mod
|
|||
// ***************************************************************************
|
||||
void CInterfaceManager::removeGroupContainerImage(const std::string &groupName, uint8 mode)
|
||||
{
|
||||
if (mode >= MAX_NUM_MODES)
|
||||
if (mode >= _Modes.size())
|
||||
{
|
||||
nlwarning("wrong desktop");
|
||||
return;
|
||||
|
@ -2433,10 +2445,19 @@ void CInterfaceManager::removeGroupContainerImage(const std::string &groupName,
|
|||
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CInterfaceManager::removeGroupContainerImageFromDesktops(const std::string &groupName)
|
||||
{
|
||||
for (uint i = 0; i < _Modes.size(); i++)
|
||||
{
|
||||
_Modes[i].removeGroupContainerImage(groupName);
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CInterfaceManager::setMode(uint8 newMode)
|
||||
{
|
||||
if (newMode >= MAX_NUM_MODES)
|
||||
if (newMode >= _Modes.size())
|
||||
return;
|
||||
|
||||
if (newMode == _CurrentMode)
|
||||
|
@ -2501,7 +2522,7 @@ void CInterfaceManager::setMode(uint8 newMode)
|
|||
// ***************************************************************************
|
||||
void CInterfaceManager::resetMode(uint8 newMode)
|
||||
{
|
||||
if (newMode >= MAX_NUM_MODES)
|
||||
if (newMode >= _Modes.size())
|
||||
return;
|
||||
NLMISC::contReset(_Modes[newMode]);
|
||||
}
|
||||
|
|
|
@ -316,6 +316,8 @@ public:
|
|||
// Remove a group container from a virtual desktop image
|
||||
// \param mode Index of the virtual desktop
|
||||
void removeGroupContainerImage(const std::string &groupName, uint8 mode);
|
||||
// Remove group container from all virtual desktops
|
||||
void removeGroupContainerImageFromDesktops(const std::string &groupName);
|
||||
|
||||
|
||||
|
||||
|
@ -583,7 +585,7 @@ private:
|
|||
sint32 _LastInGameScreenW, _LastInGameScreenH; // Resolution used for last InGame interface
|
||||
|
||||
// Modes
|
||||
CInterfaceConfig::CDesktopImage _Modes[MAX_NUM_MODES];
|
||||
std::vector<CInterfaceConfig::CDesktopImage> _Modes;
|
||||
uint8 _CurrentMode;
|
||||
|
||||
// true when interface manager is running 'ingame' content
|
||||
|
|
Loading…
Reference in a new issue