void WidgetSelectorManager::saveSelectedWidget()
	{
		if (mCurrentWidget != nullptr)
		{
			WidgetContainer* container = EditorWidgets::getInstance().find(mCurrentWidget);
			if (container != nullptr)
				container->setUserData(mStoreWidgetTag, mStoreWidgetTag);
		}
	}
Ejemplo n.º 2
0
	void PanelTemplateProperties::notifyAction(const std::string& _name, const std::string& _value, bool _final)
	{
		if (_final)
		{
			WidgetContainer* widgetContainer = EditorWidgets::getInstance().find(mCurrentWidget);
			widgetContainer->setUserData(_name, _value);

			UndoManager::getInstance().addValue(PR_PROPERTIES);
		}
	}
Ejemplo n.º 3
0
 void PanelUserData::notifyAddUserData(MyGUI::Widget* _sender)
 {
   std::string key = mEditKey->getOnlyText();
   std::string value = mEditValue->getOnlyText();
   WidgetContainer* widgetContainer = EditorWidgets::getInstance().find(mCurrentWidget);
   if (!widgetContainer->existUserData(key))
   {
     mMultilist->addItem(key);
   }
   mMultilist->setSubItemNameAt(1, mMultilist->findSubItemWith(0, key), MyGUI::TextIterator::toTagsString(value));
   widgetContainer->setUserData(key, value);
   UndoManager::getInstance().addValue();
 }
	void PanelMainProperties::notifyActionTemplate(const std::string& _type, const std::string& _value, bool _final)
	{
		if (_final)
		{
			WidgetContainer* widgetContainer = EditorWidgets::getInstance().find(mCurrentWidget);
			if (_value == "true")
			{
				if (!widgetContainer->existUserData(mUserDataTargetType))
				{
					widgetContainer->setUserData(mUserDataTargetType, widgetContainer->getType());
					widgetContainer->setType(MyGUI::Widget::getClassTypeName());

					WidgetSelectorManager::getInstance().saveSelectedWidget();

					MyGUI::xml::Document* savedDoc = EditorWidgets::getInstance().savexmlDocument();
					EditorWidgets::getInstance().clear();
					EditorWidgets::getInstance().loadxmlDocument(savedDoc);
					delete savedDoc;

					WidgetSelectorManager::getInstance().restoreSelectedWidget();

					UndoManager::getInstance().addValue(PR_PROPERTIES);
				}
			}
			else
			{
				if (widgetContainer->existUserData(mUserDataTargetType))
				{
					std::string targetType = widgetContainer->getUserData(mUserDataTargetType);
					widgetContainer->clearUserData(mUserDataTargetType);
					widgetContainer->setType(targetType);

					WidgetSelectorManager::getInstance().saveSelectedWidget();

					MyGUI::xml::Document* savedDoc = EditorWidgets::getInstance().savexmlDocument();
					EditorWidgets::getInstance().clear();
					EditorWidgets::getInstance().loadxmlDocument(savedDoc);
					delete savedDoc;

					WidgetSelectorManager::getInstance().restoreSelectedWidget();

					UndoManager::getInstance().addValue(PR_PROPERTIES);
				}
			}
		}
	}
Ejemplo n.º 5
0
  void PanelUserData::notifyUpdateUserData(MyGUI::EditBox* _widget)
  {
    size_t item = mMultilist->getIndexSelected();
    if (MyGUI::ITEM_NONE == item)
    {
      notifyAddUserData();
      return;
    }
    std::string key = mEditKey->getOnlyText();
    std::string value = mEditValue->getOnlyText();
    std::string lastkey = mMultilist->getItemNameAt(item);

    WidgetContainer* widgetContainer = EditorWidgets::getInstance().find(mCurrentWidget);
    mMultilist->removeItemAt(mMultilist->findSubItemWith(0, lastkey));
    widgetContainer->clearUserData(lastkey);
    if (!widgetContainer->existUserData(key))
    {
      mMultilist->addItem(key);
    }
    mMultilist->setSubItemNameAt(1, mMultilist->findSubItemWith(0, key), MyGUI::TextIterator::toTagsString(value));
    mMultilist->setIndexSelected(mMultilist->findSubItemWith(0, key));
    widgetContainer->setUserData(key, value);
    UndoManager::getInstance().addValue();
  }