2012-12-16 12:52:23 +01:00
|
|
|
#include "columnbase.hpp"
|
|
|
|
|
2013-08-07 09:36:05 +02:00
|
|
|
#include "columns.hpp"
|
|
|
|
|
2015-04-02 20:19:15 +11:00
|
|
|
CSMWorld::ColumnBase::ColumnBase (int columnId, Display displayType, int flags)
|
2015-04-30 19:24:27 -05:00
|
|
|
: mColumnId (columnId), mFlags (flags), mDisplayType (displayType)
|
2012-12-16 12:52:23 +01:00
|
|
|
{}
|
|
|
|
|
|
|
|
CSMWorld::ColumnBase::~ColumnBase() {}
|
|
|
|
|
|
|
|
bool CSMWorld::ColumnBase::isUserEditable() const
|
|
|
|
{
|
|
|
|
return isEditable();
|
2013-08-07 09:36:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string CSMWorld::ColumnBase::getTitle() const
|
|
|
|
{
|
|
|
|
return Columns::getName (static_cast<Columns::ColumnId> (mColumnId));
|
2014-03-08 15:27:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int CSMWorld::ColumnBase::getId() const
|
|
|
|
{
|
|
|
|
return mColumnId;
|
2014-06-17 22:02:20 +02:00
|
|
|
}
|
2015-04-09 19:11:19 +10:00
|
|
|
|
2015-03-25 11:56:14 +01:00
|
|
|
bool CSMWorld::ColumnBase::isId (Display display)
|
|
|
|
{
|
|
|
|
static const Display ids[] =
|
|
|
|
{
|
|
|
|
Display_Skill,
|
|
|
|
Display_Class,
|
|
|
|
Display_Faction,
|
2018-12-21 14:16:40 +04:00
|
|
|
Display_Rank,
|
2015-03-25 11:56:14 +01:00
|
|
|
Display_Race,
|
|
|
|
Display_Sound,
|
|
|
|
Display_Region,
|
|
|
|
Display_Birthsign,
|
|
|
|
Display_Spell,
|
|
|
|
Display_Cell,
|
|
|
|
Display_Referenceable,
|
|
|
|
Display_Activator,
|
|
|
|
Display_Potion,
|
|
|
|
Display_Apparatus,
|
|
|
|
Display_Armor,
|
|
|
|
Display_Book,
|
|
|
|
Display_Clothing,
|
|
|
|
Display_Container,
|
|
|
|
Display_Creature,
|
|
|
|
Display_Door,
|
|
|
|
Display_Ingredient,
|
|
|
|
Display_CreatureLevelledList,
|
|
|
|
Display_ItemLevelledList,
|
|
|
|
Display_Light,
|
|
|
|
Display_Lockpick,
|
|
|
|
Display_Miscellaneous,
|
|
|
|
Display_Npc,
|
|
|
|
Display_Probe,
|
|
|
|
Display_Repair,
|
|
|
|
Display_Static,
|
|
|
|
Display_Weapon,
|
|
|
|
Display_Reference,
|
|
|
|
Display_Filter,
|
|
|
|
Display_Topic,
|
|
|
|
Display_Journal,
|
|
|
|
Display_TopicInfo,
|
|
|
|
Display_JournalInfo,
|
|
|
|
Display_Scene,
|
|
|
|
Display_GlobalVariable,
|
2015-06-03 00:02:53 +03:00
|
|
|
Display_BodyPart,
|
|
|
|
Display_Enchantment,
|
2015-04-04 19:55:53 +02:00
|
|
|
Display_Script,
|
2015-03-25 11:56:14 +01:00
|
|
|
|
|
|
|
Display_Mesh,
|
|
|
|
Display_Icon,
|
|
|
|
Display_Music,
|
|
|
|
Display_SoundRes,
|
|
|
|
Display_Texture,
|
|
|
|
Display_Video,
|
2015-03-28 14:48:06 +01:00
|
|
|
|
2015-04-10 13:27:34 +02:00
|
|
|
Display_Id,
|
2015-10-08 12:35:09 +11:00
|
|
|
Display_SkillId,
|
2015-04-18 08:09:14 +10:00
|
|
|
Display_EffectRange,
|
|
|
|
Display_EffectId,
|
2015-04-18 08:31:08 +10:00
|
|
|
Display_PartRefType,
|
2015-04-18 09:37:19 +10:00
|
|
|
Display_AiPackageType,
|
2015-05-09 21:21:16 +10:00
|
|
|
Display_InfoCondFunc,
|
|
|
|
Display_InfoCondVar,
|
|
|
|
Display_InfoCondComp,
|
2015-04-10 13:27:34 +02:00
|
|
|
|
2015-10-28 11:49:24 +11:00
|
|
|
Display_EffectSkill,
|
|
|
|
Display_EffectAttribute,
|
|
|
|
Display_IngredEffectId,
|
|
|
|
|
2015-03-25 11:56:14 +01:00
|
|
|
Display_None
|
|
|
|
};
|
|
|
|
|
|
|
|
for (int i=0; ids[i]!=Display_None; ++i)
|
|
|
|
if (ids[i]==display)
|
|
|
|
return true;
|
|
|
|
|
2015-04-17 12:37:34 +10:00
|
|
|
return false;
|
2015-03-25 11:56:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CSMWorld::ColumnBase::isText (Display display)
|
|
|
|
{
|
2015-06-26 18:19:00 +02:00
|
|
|
return display==Display_String || display==Display_LongString ||
|
|
|
|
display==Display_String32 || display==Display_LongString256;
|
2015-03-25 11:56:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CSMWorld::ColumnBase::isScript (Display display)
|
|
|
|
{
|
2015-04-04 19:55:53 +02:00
|
|
|
return display==Display_ScriptFile || display==Display_ScriptLines;
|
2015-03-25 11:56:14 +01:00
|
|
|
}
|
2015-04-17 12:37:34 +10:00
|
|
|
|
2015-04-09 19:11:19 +10:00
|
|
|
void CSMWorld::NestableColumn::addColumn(CSMWorld::NestableColumn *column)
|
|
|
|
{
|
|
|
|
mNestedColumns.push_back(column);
|
|
|
|
}
|
|
|
|
|
|
|
|
const CSMWorld::ColumnBase& CSMWorld::NestableColumn::nestedColumn(int subColumn) const
|
|
|
|
{
|
2015-04-11 11:26:29 +10:00
|
|
|
if (mNestedColumns.empty())
|
2015-04-09 19:11:19 +10:00
|
|
|
throw std::logic_error("Tried to access nested column of the non-nest column");
|
|
|
|
|
|
|
|
return *mNestedColumns.at(subColumn);
|
|
|
|
}
|
|
|
|
|
|
|
|
CSMWorld::NestableColumn::NestableColumn(int columnId, CSMWorld::ColumnBase::Display displayType,
|
|
|
|
int flag)
|
2015-04-11 11:26:29 +10:00
|
|
|
: CSMWorld::ColumnBase(columnId, displayType, flag)
|
2015-04-12 08:52:09 +10:00
|
|
|
{}
|
2015-04-09 19:11:19 +10:00
|
|
|
|
|
|
|
CSMWorld::NestableColumn::~NestableColumn()
|
|
|
|
{
|
|
|
|
for (unsigned int i = 0; i < mNestedColumns.size(); ++i)
|
|
|
|
{
|
|
|
|
delete mNestedColumns[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CSMWorld::NestableColumn::hasChildren() const
|
|
|
|
{
|
2015-04-11 11:26:29 +10:00
|
|
|
return !mNestedColumns.empty();
|
2015-04-09 19:11:19 +10:00
|
|
|
}
|
2015-04-12 08:52:09 +10:00
|
|
|
|
|
|
|
CSMWorld::NestedChildColumn::NestedChildColumn (int id,
|
2015-05-26 13:35:10 +10:00
|
|
|
CSMWorld::ColumnBase::Display display, int flags, bool isEditable)
|
|
|
|
: NestableColumn (id, display, flags) , mIsEditable(isEditable)
|
2015-04-12 08:52:09 +10:00
|
|
|
{}
|
|
|
|
|
|
|
|
bool CSMWorld::NestedChildColumn::isEditable () const
|
|
|
|
{
|
|
|
|
return mIsEditable;
|
|
|
|
}
|