|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tfxattributes.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tconst.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFxAttributes::TFxAttributes()
|
|
Toshihiro Shimizu |
890ddd |
: m_id(0), m_dagNodePos(TConst::nowhere), m_enabled(true), m_speedAware(false), m_isOpened(false), m_speed(), m_groupSelector(-1), m_passiveCacheDataIdx(-1)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFxAttributes::~TFxAttributes()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TFxAttributes::setDagNodePos(const TPointD &pos)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_dagNodePos = pos;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int TFxAttributes::setGroupId(int value)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_groupSelector++;
|
|
Toshihiro Shimizu |
890ddd |
m_groupId.insert(m_groupSelector, value);
|
|
Toshihiro Shimizu |
890ddd |
return m_groupSelector;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TFxAttributes::setGroupId(int value, int position)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(position >= 0 && position <= m_groupId.size());
|
|
Toshihiro Shimizu |
890ddd |
m_groupId.insert(position, value);
|
|
Toshihiro Shimizu |
890ddd |
if (m_groupSelector + 1 >= position)
|
|
Toshihiro Shimizu |
890ddd |
m_groupSelector++;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int TFxAttributes::getGroupId()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_groupId.isEmpty() ||
|
|
Toshihiro Shimizu |
890ddd |
m_groupSelector < 0 ||
|
|
Toshihiro Shimizu |
890ddd |
m_groupSelector >= m_groupId.size()
|
|
Toshihiro Shimizu |
890ddd |
? 0
|
|
Toshihiro Shimizu |
890ddd |
: m_groupId[m_groupSelector];
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QStack<int> TFxAttributes::getGroupIdStack()</int>
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_groupId;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TFxAttributes::removeGroupId(int position)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!isGrouped())
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
assert(position >= 0 && position <= m_groupId.size());
|
|
Toshihiro Shimizu |
890ddd |
m_groupId.remove(position);
|
|
Toshihiro Shimizu |
890ddd |
if (m_groupSelector + 1 >= position && m_groupSelector > -1)
|
|
Toshihiro Shimizu |
890ddd |
m_groupSelector--;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int TFxAttributes::removeGroupId()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_groupId.remove(m_groupSelector);
|
|
Toshihiro Shimizu |
890ddd |
if (m_groupSelector > -1)
|
|
Toshihiro Shimizu |
890ddd |
m_groupSelector--;
|
|
Toshihiro Shimizu |
890ddd |
return m_groupSelector + 1;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool TFxAttributes::isGrouped()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return !m_groupId.isEmpty();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool TFxAttributes::isContainedInGroup(int groupId)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_groupId.contains(groupId);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TFxAttributes::setGroupName(const wstring &name, int position)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int groupSelector = position < 0 ? m_groupSelector : position;
|
|
Toshihiro Shimizu |
890ddd |
assert(groupSelector >= 0 && groupSelector <= m_groupName.size());
|
|
Toshihiro Shimizu |
890ddd |
m_groupName.insert(groupSelector, name);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
wstring TFxAttributes::getGroupName(bool fromEditor)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int groupSelector = fromEditor ? m_groupSelector + 1 : m_groupSelector;
|
|
Toshihiro Shimizu |
890ddd |
return m_groupName.isEmpty() ||
|
|
Toshihiro Shimizu |
890ddd |
groupSelector < 0 ||
|
|
Toshihiro Shimizu |
890ddd |
groupSelector >= m_groupName.size()
|
|
Toshihiro Shimizu |
890ddd |
? L""
|
|
Toshihiro Shimizu |
890ddd |
: m_groupName[groupSelector];
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QStack<wstring> TFxAttributes::getGroupNameStack()</wstring>
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_groupName;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int TFxAttributes::removeGroupName(bool fromEditor)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int groupSelector = fromEditor ? m_groupSelector + 1 : m_groupSelector;
|
|
Toshihiro Shimizu |
890ddd |
if (!isGrouped())
|
|
Toshihiro Shimizu |
890ddd |
return -1;
|
|
Toshihiro Shimizu |
890ddd |
assert(groupSelector >= 0 && groupSelector <= m_groupName.size());
|
|
Toshihiro Shimizu |
890ddd |
m_groupName.remove(groupSelector);
|
|
Toshihiro Shimizu |
890ddd |
return groupSelector;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TFxAttributes::removeGroupName(int position)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int groupSelector = position < 0 ? m_groupSelector : position;
|
|
Toshihiro Shimizu |
890ddd |
assert(groupSelector >= 0 && groupSelector <= m_groupName.size());
|
|
Toshihiro Shimizu |
890ddd |
m_groupName.remove(groupSelector);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool TFxAttributes::editGroup()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return (m_groupSelector < 0) ? false : (--m_groupSelector, true);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool TFxAttributes::isGroupEditing()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return isGrouped() && (m_groupSelector == -1);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TFxAttributes::closeEditingGroup(int groupId)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!m_groupId.contains(groupId))
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
m_groupSelector = 0;
|
|
Toshihiro Shimizu |
890ddd |
while (m_groupId[m_groupSelector] != groupId && m_groupSelector < m_groupId.size())
|
|
Toshihiro Shimizu |
890ddd |
m_groupSelector++;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int TFxAttributes::getEditingGroupId()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!isGrouped() || m_groupSelector + 1 >= m_groupId.size())
|
|
Toshihiro Shimizu |
890ddd |
return -1;
|
|
Toshihiro Shimizu |
890ddd |
return m_groupId[m_groupSelector + 1];
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
wstring TFxAttributes::getEditingGroupName()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!isGrouped() || m_groupSelector + 1 >= m_groupName.size())
|
|
Toshihiro Shimizu |
890ddd |
return L"";
|
|
Toshihiro Shimizu |
890ddd |
return m_groupName[m_groupSelector + 1];
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TFxAttributes::removeFromAllGroup()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_groupId.clear();
|
|
Toshihiro Shimizu |
890ddd |
m_groupName.clear();
|
|
Toshihiro Shimizu |
890ddd |
m_groupSelector = -1;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TFxAttributes::closeAllGroups()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (isGroupEditing())
|
|
Toshihiro Shimizu |
890ddd |
m_groupSelector = m_groupId.size() - 1;
|
|
Toshihiro Shimizu |
890ddd |
}
|