2009-05-08 13:28:41 +00:00
|
|
|
/*
|
|
|
|
* OpenClonk, http://www.openclonk.org
|
|
|
|
*
|
2013-12-17 20:01:09 +00:00
|
|
|
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
|
2016-04-03 18:18:29 +00:00
|
|
|
* Copyright (c) 2009-2016, The OpenClonk Team and contributors
|
2009-05-08 13:28:41 +00:00
|
|
|
*
|
2013-12-17 20:01:09 +00:00
|
|
|
* Distributed under the terms of the ISC license; see accompanying file
|
|
|
|
* "COPYING" for details.
|
2009-05-08 13:28:41 +00:00
|
|
|
*
|
2013-12-17 20:01:09 +00:00
|
|
|
* "Clonk" is a registered trademark of Matthes Bender, used with permission.
|
|
|
|
* See accompanying file "TRADEMARK" for details.
|
2009-05-08 13:28:41 +00:00
|
|
|
*
|
2013-12-17 20:01:09 +00:00
|
|
|
* To redistribute this file separately, substitute the full license texts
|
|
|
|
* for the above references.
|
2009-05-08 13:28:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Core component of a folder */
|
|
|
|
|
2016-04-03 18:07:56 +00:00
|
|
|
#include "C4Include.h"
|
|
|
|
#include "gui/C4Folder.h"
|
2009-05-08 13:28:41 +00:00
|
|
|
|
2016-04-03 18:07:56 +00:00
|
|
|
#include "c4group/C4Group.h"
|
|
|
|
#include "c4group/C4Components.h"
|
2009-05-08 13:28:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
//================= C4FolderHead ====================
|
|
|
|
|
|
|
|
void C4FolderHead::Default()
|
2010-03-28 18:58:01 +00:00
|
|
|
{
|
2009-05-08 13:28:41 +00:00
|
|
|
Index = 0;
|
2010-03-28 18:58:01 +00:00
|
|
|
}
|
2009-05-08 13:28:41 +00:00
|
|
|
|
|
|
|
void C4FolderHead::CompileFunc(StdCompiler *pComp)
|
2010-03-28 18:58:01 +00:00
|
|
|
{
|
2010-03-27 16:05:02 +00:00
|
|
|
pComp->Value(mkNamingAdapt(Index, "Index", 0));
|
2010-03-28 18:58:01 +00:00
|
|
|
}
|
2009-05-08 13:28:41 +00:00
|
|
|
|
|
|
|
//=================== C4Folder ======================
|
|
|
|
|
|
|
|
C4Folder::C4Folder()
|
2010-03-28 18:58:01 +00:00
|
|
|
{
|
2010-03-27 16:05:02 +00:00
|
|
|
Default();
|
2010-03-28 18:58:01 +00:00
|
|
|
}
|
2009-05-08 13:28:41 +00:00
|
|
|
|
|
|
|
void C4Folder::Default()
|
2010-03-28 18:58:01 +00:00
|
|
|
{
|
2009-05-08 13:28:41 +00:00
|
|
|
Head.Default();
|
2010-03-28 18:58:01 +00:00
|
|
|
}
|
2009-05-08 13:28:41 +00:00
|
|
|
|
2009-08-15 18:50:32 +00:00
|
|
|
bool C4Folder::Load(C4Group &hGroup)
|
2010-03-28 18:58:01 +00:00
|
|
|
{
|
2009-05-08 13:28:41 +00:00
|
|
|
char *pSource;
|
|
|
|
// Load
|
2016-11-02 23:58:02 +00:00
|
|
|
if (!hGroup.LoadEntry(C4CFN_FolderCore, &pSource, nullptr, 1)) return false;
|
2009-05-08 13:28:41 +00:00
|
|
|
// Compile
|
2009-08-15 18:50:32 +00:00
|
|
|
if (!Compile(pSource)) { delete [] pSource; return false; }
|
2009-05-08 13:28:41 +00:00
|
|
|
delete [] pSource;
|
|
|
|
// Success
|
2009-08-15 18:50:32 +00:00
|
|
|
return true;
|
2010-03-28 18:58:01 +00:00
|
|
|
}
|
2009-05-08 13:28:41 +00:00
|
|
|
|
|
|
|
void C4Folder::CompileFunc(StdCompiler *pComp)
|
2010-03-28 18:58:01 +00:00
|
|
|
{
|
2010-03-27 16:05:02 +00:00
|
|
|
pComp->Value(mkNamingAdapt(Head, "Head"));
|
2010-03-28 18:58:01 +00:00
|
|
|
}
|
2009-05-08 13:28:41 +00:00
|
|
|
|
2009-08-15 18:50:32 +00:00
|
|
|
bool C4Folder::Compile(const char *szSource)
|
2010-03-28 18:58:01 +00:00
|
|
|
{
|
2009-05-08 13:28:41 +00:00
|
|
|
Default();
|
2010-03-27 16:05:02 +00:00
|
|
|
return CompileFromBuf_LogWarn<StdCompilerINIRead>(*this, StdStrBuf(szSource), C4CFN_FolderCore);
|
2010-03-28 18:58:01 +00:00
|
|
|
}
|
2009-05-08 13:28:41 +00:00
|
|
|
|