|
|
|
@ -38,6 +38,27 @@ void CSVWidget::SceneToolMode::adjustToolTip (const ModeButton *activeMode)
|
|
|
|
|
setToolTip (toolTip);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWidget::SceneToolMode::setButton (std::map<ModeButton *, std::string>::iterator iter)
|
|
|
|
|
{
|
|
|
|
|
for (std::map<ModeButton *, std::string>::const_iterator iter2 = mButtons.begin();
|
|
|
|
|
iter2!=mButtons.end(); ++iter2)
|
|
|
|
|
iter2->first->setChecked (iter2==iter);
|
|
|
|
|
|
|
|
|
|
setIcon (iter->first->icon());
|
|
|
|
|
adjustToolTip (iter->first);
|
|
|
|
|
|
|
|
|
|
if (mCurrent!=iter->first)
|
|
|
|
|
{
|
|
|
|
|
if (mCurrent)
|
|
|
|
|
mCurrent->deactivate (mToolbar);
|
|
|
|
|
|
|
|
|
|
mCurrent = iter->first;
|
|
|
|
|
mCurrent->activate (mToolbar);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
emit modeChanged (iter->second);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CSVWidget::SceneToolMode::SceneToolMode (SceneToolbar *parent, const QString& toolTip)
|
|
|
|
|
: SceneTool (parent), mButtonSize (parent->getButtonSize()), mIconSize (parent->getIconSize()),
|
|
|
|
|
mToolTip (toolTip), mFirst (0), mCurrent (0), mToolbar (parent)
|
|
|
|
@ -101,9 +122,20 @@ std::string CSVWidget::SceneToolMode::getCurrentId() const
|
|
|
|
|
return mButtons.find (mCurrent)->second;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWidget::SceneToolMode::setButton (const std::string& id)
|
|
|
|
|
{
|
|
|
|
|
for (std::map<ModeButton *, std::string>::iterator iter = mButtons.begin();
|
|
|
|
|
iter!=mButtons.end(); ++iter)
|
|
|
|
|
if (iter->second==id)
|
|
|
|
|
{
|
|
|
|
|
setButton (iter);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWidget::SceneToolMode::selected()
|
|
|
|
|
{
|
|
|
|
|
std::map<ModeButton *, std::string>::const_iterator iter =
|
|
|
|
|
std::map<ModeButton *, std::string>::iterator iter =
|
|
|
|
|
mButtons.find (dynamic_cast<ModeButton *> (sender()));
|
|
|
|
|
|
|
|
|
|
if (iter!=mButtons.end())
|
|
|
|
@ -111,22 +143,6 @@ void CSVWidget::SceneToolMode::selected()
|
|
|
|
|
if (!iter->first->hasKeepOpen())
|
|
|
|
|
mPanel->hide();
|
|
|
|
|
|
|
|
|
|
for (std::map<ModeButton *, std::string>::const_iterator iter2 = mButtons.begin();
|
|
|
|
|
iter2!=mButtons.end(); ++iter2)
|
|
|
|
|
iter2->first->setChecked (iter2==iter);
|
|
|
|
|
|
|
|
|
|
setIcon (iter->first->icon());
|
|
|
|
|
adjustToolTip (iter->first);
|
|
|
|
|
|
|
|
|
|
if (mCurrent!=iter->first)
|
|
|
|
|
{
|
|
|
|
|
if (mCurrent)
|
|
|
|
|
mCurrent->deactivate (mToolbar);
|
|
|
|
|
|
|
|
|
|
mCurrent = iter->first;
|
|
|
|
|
mCurrent->activate (mToolbar);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
emit modeChanged (iter->second);
|
|
|
|
|
setButton (iter);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|