void PropertyFieldPosition::notifyApplyProperties(MyGUI::Widget* _sender, bool _force) { std::string DEFAULT_VALUE = replaceTags("ColourDefault") + DEFAULT_STRING; std::string value = mField->getOnlyText(); if (value == DEFAULT_STRING && mField->getCaption() == DEFAULT_VALUE) value = ""; onAction(value, _force); UndoManager::getInstance().addValue(PR_PROPERTIES); }
void EditorState::commandClear(const MyGUI::UString& _commandName) { if (!checkCommand()) return; if (ActionManager::getInstance().getChanges()) { MyGUI::Message* message = MessageBoxManager::getInstance().create( replaceTags("Warning"), replaceTags("MessageUnsavedData"), MyGUI::MessageBoxStyle::IconQuest | MyGUI::MessageBoxStyle::Yes | MyGUI::MessageBoxStyle::No | MyGUI::MessageBoxStyle::Cancel); message->eventMessageBoxResult += MyGUI::newDelegate(this, &EditorState::notifyMessageBoxResultClear); } else { clear(); } }
bool EditorState::save() { if (EditorWidgets::getInstance().save(mFileName)) { if (mFileName != mDefaultFileName && !isProjectFile(mFileName)) RecentFilesManager::getInstance().addRecentFile(mFileName); UndoManager::getInstance().addValue(); UndoManager::getInstance().setUnsaved(false); return true; } else { /*MyGUI::Message* message = */MessageBoxManager::getInstance().create( replaceTags("Error"), replaceTags("MessageFailedSaveFile"), MyGUI::MessageBoxStyle::IconError | MyGUI::MessageBoxStyle::Ok ); } return false; }
MyGUI::UString SkinListControl::getNextFreeName() { for (size_t index = 0; index < (std::numeric_limits<size_t>::max)(); index++) { addUserTag("SkinNameIndex", MyGUI::utility::toString(index)); MyGUI::UString name = replaceTags("SkinNamePattern"); if (!isNameExist(name)) return name; } return ""; }
void PropertyFieldComboBox::setValue(const std::string& _value) { std::string DEFAULT_VALUE = replaceTags("ColourDefault") + DEFAULT_STRING; if (_value.empty()) { mField->setCaption(DEFAULT_VALUE); } else { mField->setOnlyText(_value); } }
void EditorState::load() { if (EditorWidgets::getInstance().load(mFileName)) { if (mFileName != mDefaultFileName && !isProjectFile(mFileName)) RecentFilesManager::getInstance().addRecentFile(mFileName); UndoManager::getInstance().addValue(); UndoManager::getInstance().setUnsaved(false); } else { /*MyGUI::Message* message = */MessageBoxManager::getInstance().create( replaceTags("Error"), replaceTags("MessageFailedLoadFile"), MyGUI::MessageBoxStyle::IconError | MyGUI::MessageBoxStyle::Ok ); setFileName(mDefaultFileName); updateCaption(); } }
void EditorState::command_Quit(const MyGUI::UString& _commandName, bool& _result) { if (!checkCommand()) return; if (UndoManager::getInstance().isUnsaved()) { MyGUI::Message* message = MessageBoxManager::getInstance().create( replaceTags("Warning"), replaceTags("MessageUnsavedData"), MyGUI::MessageBoxStyle::IconQuest | MyGUI::MessageBoxStyle::Yes | MyGUI::MessageBoxStyle::No | MyGUI::MessageBoxStyle::Cancel); message->eventMessageBoxResult += MyGUI::newDelegate(this, &EditorState::notifyMessageBoxResultQuit); } else { StateManager::getInstance().stateEvent(this, "Exit"); } _result = true; }
void SettingsUpdateResourcesControl::notifyClickAdd(MyGUI::Widget* _sender) { mResources->addItem(""); mResources->beginToItemAt(mResources->getItemCount() - 1); mTextFieldControl->setCaption(replaceTags("CaptionAddResource")); mTextFieldControl->setTextField(""); MyGUI::Widget* widget = mResources->getWidgetByIndex(mResources->getItemCount() - 1); if (widget != nullptr) mTextFieldControl->setCoord(MyGUI::IntCoord(widget->getAbsoluteLeft(), widget->getAbsoluteTop(), widget->getWidth(), widget->getHeight())); mTextFieldControl->doModal(); }
std::string ImageExporterOutputWidget::buildFileName() { std::string filename{ replaceTags(m_ui->fileNameTextEdit->toPlainText().toStdString()) }; const std::string sep("/"); const std::string suf(".png"); std::string final_filename = m_dirName.toStdString() + sep + filename + suf; int duplicate_count{ 2 }; while (QFile::exists(QString::fromStdString(final_filename))) final_filename = m_dirName.toStdString() + sep + filename + " (" + std::to_string(duplicate_count++) + ")" + suf; return final_filename; }
std::string MainMenuControlLE::getDescriptionString(MyGUI::Widget* _widget, bool _print_name, bool _print_type, bool _print_skin) { WidgetContainer* widgetContainer = EditorWidgets::getInstance().find(_widget); addUserTag("WidgetName", _print_name ? widgetContainer->getName() : ""); addUserTag("WidgetType", _print_type ? _widget->getTypeName() : ""); addUserTag("WidgetSkin", _print_skin ? widgetContainer->getSkin() : ""); addUserTag("FormatWidgetName", (_print_name && !widgetContainer->getName().empty()) ? "#{PatternWidgetName}" : ""); addUserTag("FormatWidgetType", _print_type ? "#{PatternWidgetType}" : ""); addUserTag("FormatWidgetSkin", _print_skin ? "#{PatternWidgetSkin}" : ""); return replaceTags("MenuItemWidgetInfo"); }
bool run(OperationContext* opCtx, const std::string&, const BSONObj& cmdObj, BSONObjBuilder& result) final { Status status = getGlobalReplicationCoordinator()->checkReplEnabledForCommand(&result); if (!status.isOK()) { return appendCommandStatus(result, status); } ReplSetRequestVotesArgs parsedArgs; status = parsedArgs.initialize(cmdObj); if (!status.isOK()) { return appendCommandStatus(result, status); } // We want to keep request vote connection open when relinquishing primary. // Tag it here. transport::Session::TagMask originalTag = 0; auto session = opCtx->getClient()->session(); if (session) { originalTag = session->getTags(); session->replaceTags(originalTag | transport::Session::kKeepOpen); } // Untag the connection on exit. ON_BLOCK_EXIT([session, originalTag]() { if (session) { session->replaceTags(originalTag); } }); ReplSetRequestVotesResponse response; status = getGlobalReplicationCoordinator()->processReplSetRequestVotes( opCtx, parsedArgs, &response); response.addToBSON(&result); return appendCommandStatus(result, status); }
void PropertyFieldEditBox::notifyApplyProperties(MyGUI::Widget* _sender, bool _force) { std::string DEFAULT_VALUE = replaceTags("ColourDefault") + DEFAULT_STRING; std::string value = mField->getOnlyText(); if (value == DEFAULT_STRING && mField->getCaption() == DEFAULT_VALUE) value = ""; bool goodData = onCheckValue(); if (goodData || _force) { onAction(value, true); } }
void ListBoxDataControl::OnRenameData() { size_t index = mListBox->getIndexSelected(); if (index != MyGUI::ITEM_NONE) { mListBox->beginToItemAt(index); MyGUI::Widget* widget = mListBox->getWidgetByIndex(index); if (widget != nullptr) { DataPtr data = *mListBox->getItemDataAt<DataPtr>(index); mTextFieldControl->setCaption(replaceTags("CaptionEnterName")); mTextFieldControl->setTextField(data->getPropertyValue(mPropertyForName)); mTextFieldControl->setUserData(data); mTextFieldControl->setCoord(MyGUI::IntCoord(widget->getAbsoluteLeft(), widget->getAbsoluteTop(), widget->getWidth(), widget->getHeight())); mTextFieldControl->doModal(); } } }
void MainMenuControlLE::updateRecentProjectsMenu() { MyGUI::MenuItem* recentProjectsMenu = mBar->findItemById("RecentProjects", true); if (recentProjectsMenu != nullptr) { recentProjectsMenu->getItemChild()->removeAllItems(); // список последних открытых проектов const RecentFilesManager::VectorUString& recentProjects = RecentFilesManager::getInstance().getRecentProjects(); if (!recentProjects.empty()) { size_t index = 1; for (RecentFilesManager::VectorUString::const_iterator iter = recentProjects.begin(); iter != recentProjects.end(); ++iter, ++index) { addUserTag("IndexRecentProject", MyGUI::utility::toString(index)); addUserTag("RecentProject", *iter); recentProjectsMenu->getItemChild()->addItem(replaceTags("FormatRecentProject"), MyGUI::MenuItemType::Normal, "Command_OpenRecentProject", *iter); } } } }
void PropertyFieldFont::onFillValues() { WidgetStyle::VectorString values; const std::string DEFAULT_STRING = "[DEFAULT]"; values.push_back(replaceTags("ColourDefault") + DEFAULT_STRING); values.push_back("Default"); MyGUI::ResourceManager::EnumeratorPtr resource = MyGUI::ResourceManager::getInstance().getEnumerator(); while (resource.next()) { MyGUI::IFont* resourceFont = resource.current().second->castType<MyGUI::IFont>(false); if (resourceFont != nullptr) values.push_back(resourceFont->getResourceName()); } for (WidgetStyle::VectorString::iterator iter = values.begin(); iter != values.end(); ++iter) mField->addItem(*iter); mField->beginToItemFirst(); }
void PanelControllers::initialise() { mPanelCell->setCaption(replaceTags("PanelControllersName")); assignWidget(mControllerName, "controllerName"); assignWidget(mButtonAdd, "buttonAdd"); assignWidget(mButtonDelete, "buttonDelete"); assignWidget(mList, "list"); mButtonAdd->eventMouseButtonClick += MyGUI::newDelegate(this, &PanelControllers::notifyAdd); mButtonDelete->eventMouseButtonClick += MyGUI::newDelegate(this, &PanelControllers::notifyDelete); mList->eventListChangePosition += MyGUI::newDelegate(this, &PanelControllers::notifySelectItem); mButtonLeft = mButtonAdd->getLeft(); mButtonRight = mMainWidget->getWidth() - mButtonDelete->getRight(); mButtonSpace = mButtonDelete->getLeft() - mButtonAdd->getRight(); MyGUI::ResourceManager::getInstance().registerLoadXmlDelegate("ControllerTypes") = MyGUI::newDelegate(this, &PanelControllers::loadControllerTypes); MyGUI::ResourceManager::getInstance().load("Controllers.xml"); }
void PanelProperties::update(MyGUI::Widget* _currentWidget, WidgetStyle* _widgetType) { hidePropertyFields(); mCurrentWidget = _currentWidget; if (mCurrentWidget == nullptr) return; WidgetContainer* widgetContainer = EditorWidgets::getInstance().find(_currentWidget); MyGUI::LanguageManager::getInstance().addUserTag("widget_type", _widgetType->name); mPanelCell->setCaption(replaceTags("Widget_type_propertes")); size_t count = addParametrs(_widgetType, widgetContainer, mCurrentWidget); setVisible(count > 0); updateSize(); }
void ListBoxDataControl::notifyChangeProperty(PropertyPtr _sender) { if (mParentData == nullptr) return; if (mParentData != _sender->getOwner()->getParent()) return; for (size_t index = 0; index < mListBox->getItemCount(); index ++) { DataPtr data = *mListBox->getItemDataAt<DataPtr>(index); if (data == _sender->getOwner()) { bool unique = isDataEnabled(data); if (unique) mListBox->setItemNameAt(index, data->getPropertyValue(mPropertyForName)); else mListBox->setItemNameAt(index, replaceTags(mColourName) + data->getPropertyValue(mPropertyForName)); } } }
void ListBoxDataControl::invalidateList() { mLastIndex = MyGUI::ITEM_NONE; mListBox->setIndexSelected(MyGUI::ITEM_NONE); if (mParentData != nullptr) { for (size_t index = 0; index < mListBox->getItemCount(); index ++) mListBox->setItemDataAt(index, nullptr); const Data::VectorData& childs = DataUtility::getChildsByType(mParentData, mThisType); while (mListBox->getItemCount() > childs.size()) mListBox->removeItemAt(mListBox->getItemCount() - 1); while (mListBox->getItemCount() < childs.size()) mListBox->addItem("", nullptr); for (size_t index = 0; index < childs.size(); index ++) { DataPtr child = childs.at(index); bool unique = isDataEnabled(child); if (unique) mListBox->setItemNameAt(index, child->getPropertyValue(mPropertyForName)); else mListBox->setItemNameAt(index, replaceTags(mColourName) + child->getPropertyValue(mPropertyForName)); mListBox->setItemDataAt(index, child); connectToProperty(child); } } else { mListBox->removeAllItems(); } if (mHelpPanel != nullptr) mHelpPanel->setVisible(mListBox->getItemCount() == 0); }
void SeparatorListControl::updateList() { if (getCurrentSkin() != nullptr) { SeparatorItem* selectedItem = getCurrentSkin()->getSeparators().getItemSelected(); size_t selectedIndex = MyGUI::ITEM_NONE; size_t index = 0; ItemHolder<SeparatorItem>::EnumeratorItem separators = getCurrentSkin()->getSeparators().getChildsEnumerator(); while (separators.next()) { SeparatorItem* item = separators.current(); MyGUI::UString name; if (item->getPropertySet()->getPropertyValue("Visible") != "True") name = replaceTags("ColourDisabled") + item->getName(); else name = item->getName(); if (index < mList->getItemCount()) { mList->setItemNameAt(index, name); mList->setItemDataAt(index, item); } else { mList->addItem(name, item); } if (item == selectedItem) selectedIndex = index; index ++; } while (index < mList->getItemCount()) mList->removeItemAt(mList->getItemCount() - 1); mList->setIndexSelected(selectedIndex); } }
void PropertyFieldColour::notifyEndDialog(Dialog* _sender, bool _result) { mColourPanel->endModal(); if (_result) { setColour(mColourPanel->getColour(), true); } else { if (mGoodData) { setColour(mPreviewColour, true); } else { std::string DEFAULT_VALUE = replaceTags("ColourDefault") + DEFAULT_STRING; mField->setCaption(DEFAULT_VALUE); updateColourPlace(false); onAction("", true); } } }
void PanelUserData::initialise() { mPanelCell->setCaption(replaceTags("PanelUserDataName")); assignWidget(mEditKey, "editKey"); assignWidget(mEditValue, "editValue"); assignWidget(mButtonAdd, "buttonAdd"); assignWidget(mButtonDelete, "buttonDelete"); assignWidget(mMultilist, "multilist"); mButtonAdd->eventMouseButtonClick += MyGUI::newDelegate(this, &PanelUserData::notifyAddUserData); mButtonDelete->eventMouseButtonClick += MyGUI::newDelegate(this, &PanelUserData::notifyDeleteUserData); mEditKey->eventEditSelectAccept += MyGUI::newDelegate(this, &PanelUserData::notifyUpdateUserData); mEditValue->eventEditSelectAccept += MyGUI::newDelegate(this, &PanelUserData::notifyUpdateUserData); mMultilist->eventListChangePosition += MyGUI::newDelegate(this, &PanelUserData::notifySelectUserDataItem); mEditLeft = mEditKey->getLeft(); mEditRight = mMainWidget->getWidth() - mEditValue->getRight(); mEditSpace = mEditValue->getLeft() - mEditKey->getRight(); mButtonLeft = mButtonAdd->getLeft(); mButtonRight = mMainWidget->getWidth() - mButtonDelete->getRight(); mButtonSpace = mButtonDelete->getLeft() - mButtonAdd->getRight(); }
void Application::command_UpdateAppCaption(const MyGUI::UString& _commandName, bool& _result) { setWindowCaption(replaceTags("CaptionMainWindow")); _result = true; }
void ImageExporterOutputWidget::updateFilenamePreview() { m_ui->filenamePeviewLabel->setText(QString::fromStdString(replaceTags(m_ui->fileNameTextEdit->toPlainText().toStdString(), false)) + ".png"); }
void PanelMainProperties::initialise() { mPanelCell->setCaption(replaceTags("Main_properties")); }
void PanelProperties::initialise() { mPanelCell->setCaption(replaceTags("Widget_type_propertes")); }
void PanelExtensionProperties::initialise() { mPanelCell->setCaption(replaceTags("PanelExtensionPropertiesName")); }
void PanelTemplateProperties::initialise() { mPanelCell->setCaption(replaceTags("PanelTemplatePropertiesName")); }
void SettingsResourcesControl::notifyClickResourcePathAdd(MyGUI::Widget* _sender) { mTextFieldControl->setCaption(replaceTags("CaptionAddResource")); mTextFieldControl->setTextField(""); mTextFieldControl->doModal(); }
void EditorState::updateCaption() { addUserTag("HasChanged", ActionManager::getInstance().getChanges() ? "*" : ""); Application::getInstance().setCaption(replaceTags("CaptionMainWindow")); }