void FileConfigTestCase::CheckGroupSubgroups(const wxFileConfig& fc, const wxChar *path, size_t nGroups, ...) { wxConfigPathChanger change(&fc, wxString(path) + wxT("/")); CPPUNIT_ASSERT( fc.GetNumberOfGroups() == nGroups ); va_list ap; va_start(ap, nGroups); long cookie; wxString name; for ( bool cont = fc.GetFirstGroup(name, cookie); cont; cont = fc.GetNextGroup(name, cookie), nGroups-- ) { CPPUNIT_ASSERT( name == va_arg(ap, wxChar *) ); } CPPUNIT_ASSERT( nGroups == 0 ); va_end(ap); }
void ActLearn::actLoad(wxFileConfig & fileConfig) { fileConfig.Read("listName", &_listName); double tmp; fileConfig.Read("nbText", &tmp); if(tmp == 0)//La valeur minimums de _nbText est 1. _nbText = 1; else _nbText = tmp; }
void copyValuesIntoConfig(HKEY key, wxFileConfig& config, const wxString& sectionName) { config.SetPath(sectionName); for (DWORD i = 0; ; ++i) { wxString name; wxString value; if (!enumRegistryValue(key, i, name, value)) { break; } config.Write(name, value); } }
void ActTranslationToNotification::actLoad(wxFileConfig& fileConfig) { _lgto = ManGeneral::get().getSystemLanguage(); if( _lgto == wxLANGUAGE_ENGLISH) _lgsrc = wxLANGUAGE_FRENCH; else _lgsrc = wxLANGUAGE_ENGLISH; //On récupère les préférences. wxString lg; lg = fileConfig.Read("lgsrc", wxLocale::GetLanguageName(_lgsrc)); _lgsrc = (wxLanguage)wxLocale::FindLanguageInfo(lg)->Language; lg = fileConfig.Read("lgto", wxLocale::GetLanguageName(_lgto)); _lgto = (wxLanguage)wxLocale::FindLanguageInfo(lg)->Language; }
void wxFontsManager::SetDefaultFonts(wxFileConfig& cfg) { wxString name; if ( cfg.Read("Default", &name) ) { m_defaultFacenames[wxFONTFAMILY_DECORATIVE] = m_defaultFacenames[wxFONTFAMILY_ROMAN] = m_defaultFacenames[wxFONTFAMILY_SCRIPT] = m_defaultFacenames[wxFONTFAMILY_SWISS] = m_defaultFacenames[wxFONTFAMILY_MODERN] = m_defaultFacenames[wxFONTFAMILY_TELETYPE] = name; } if ( cfg.Read("DefaultDecorative", &name) ) m_defaultFacenames[wxFONTFAMILY_DECORATIVE] = name; if ( cfg.Read("DefaultRoman", &name) ) m_defaultFacenames[wxFONTFAMILY_ROMAN] = name; if ( cfg.Read("DefaultScript", &name) ) m_defaultFacenames[wxFONTFAMILY_SCRIPT] = name; if ( cfg.Read("DefaultSwiss", &name) ) m_defaultFacenames[wxFONTFAMILY_SWISS] = name; if ( cfg.Read("DefaultModern", &name) ) m_defaultFacenames[wxFONTFAMILY_MODERN] = name; if ( cfg.Read("DefaultTeletype", &name) ) m_defaultFacenames[wxFONTFAMILY_TELETYPE] = name; }
void ManAction::manSave(wxFileConfig& fileConfig)const { for(auto &it: _shortcutKeysActions) { //Obtenir la version string du raccourci. wxString stringShortcut = ShortcutKey::shortcutKeyToString(it.first); //Crée un groupe pour ce raccourci. fileConfig.SetPath(stringShortcut+"/"); //Sauvegarde le type de l'action. fileConfig.Write("ActTypeName", it.second->getActTypeName()); //Sauvegarde de l'action. it.second->save(fileConfig); //On positionne le path fileConfig.SetPath(".."); } }
static wxString ReadFilePath(const wxString& name, const wxString& dir, wxFileConfig& cfg) { wxString p = cfg.Read(name, wxEmptyString); if ( p.empty() || wxFileName(p).IsAbsolute() ) return p; return dir + "/" + p; }
void ManAction::manLoad(wxFileConfig& fileConfig) { wxString stringShortcut; long lIndex; //Avent de charger quoi que se soi on supprime tout les raccourcis/actions removeAll(); //On récupère le premier raccourci. if(!fileConfig.GetFirstGroup(stringShortcut, lIndex)) return; do { //On positionne le path fileConfig.SetPath(stringShortcut+"/"); //Récupérer le type de l'action. wxString actTypeName; fileConfig.Read("ActTypeName", &actTypeName); //Création d'une action a partir de son nom. Action* tmpAct = Action::createAction(actTypeName); //Si la création de l'action a réussie, alor on l'ajoute. if(tmpAct) { //Chargement des préférences de l'action à partir du fichier de configuration. tmpAct->load(fileConfig); //Ajout de l'action. add(ShortcutKey::stringToShortcutKey(stringShortcut), tmpAct); } //On positionne le path fileConfig.SetPath(".."); }//Puis tous les autres while(fileConfig.GetNextGroup(stringShortcut, lIndex)); }
void wxFontsManager::AddFont(const wxString& dir, const wxString& name, wxFileConfig& cfg) { wxLogTrace("font", "adding font '%s'", name.c_str()); wxConfigPathChanger ch(&cfg, wxString::Format("/%s/", name.c_str())); AddBundle ( new wxFontBundle ( name, ReadFilePath("Regular", dir, cfg), ReadFilePath("Italic", dir, cfg), ReadFilePath("Bold", dir, cfg), ReadFilePath("BoldItalic", dir, cfg), cfg.Read("IsFixed", (long)false) ) ); }
static wxString Dump(wxFileConfig& fc) { wxStringOutputStream sos; fc.Save(sos); return wxTextFile::Translate(sos.GetString(), wxTextFileType_Unix); }
//~~ int GetIconIndex() [AstadeTransition] ~~ wxArrayString names; wxFileConfig theConfig(wxEmptyString, wxEmptyString, wxEmptyString, myModelElement->GetFileName().GetFullPath()); wxString TransitionType = theConfig.Read(wxS("Astade/TransitionType")); if (TransitionType == wxS("Self")) names.Add(wxS("selftransition")); else if (TransitionType == wxS("Internal")) names.Add(wxS("internaltransition")); else names.Add(wxS("transition")); if (search->isSet(AdeSearch::SearchIsActive)) { switch (myModelElement->Search(*search)) { case AdeSearch::contain: names.Add(wxS("hasfound")); break; case AdeSearch::found: names.Add(wxS("found")); break; default: break; } } else {
static wxString ChangePath(wxFileConfig& fc, const wxChar *path) { fc.SetPath(path); return fc.GetPath(); }
void ManNotification::manLoad(wxFileConfig& fileConfig) { //On détruis les fenêtres de notification au préalable. deleteAllFramesNotify(); _useNotification = (UseNotification_e)fileConfig.ReadLong("useNotification", (long)USE_NOTIFICATION_RICH); _notificationPosition = (NotificationPosition_e)fileConfig.ReadLong("notificationPosition", (long)NOTIFICATION_POSITION_TOP_RIGHT); _nearCursor = fileConfig.ReadBool("nearCursor", true); _multipleNotifications = fileConfig.ReadBool("multipleNotifications", true); _border = fileConfig.ReadLong("border", (long)SIZE_BORDER); _colourBackground.SetRGB(fileConfig.ReadLong("colourBackground", (long)0x000000)); _colourText.SetRGB(fileConfig.ReadLong("colourText", (long)0xd2d2d2)); fileConfig.SetPath("workarea/"); //On lie -1 pour les valeur par défaut. _workarea = wxDisplay().GetGeometry(); long readVal = -1; readVal = fileConfig.ReadLong("x", -1); if(readVal != -1) _workarea.x = readVal; readVal = fileConfig.ReadLong("y", -1); if(readVal != -1) _workarea.y = readVal; readVal = fileConfig.ReadLong("height", -1); if(readVal != -1) _workarea.height = readVal; else _workarea.height -= _workarea.y; readVal = fileConfig.ReadLong("width", -1); if(readVal != -1) _workarea.width = readVal; else _workarea.width -= _workarea.x; fileConfig.SetPath(".."); }
void ActTranslationToNotification::actSave(wxFileConfig& fileConfig)const { fileConfig.Write("lgsrc", wxLocale::GetLanguageName(_lgsrc)); fileConfig.Write("lgto", wxLocale::GetLanguageName(_lgto)); }
void ManNotification::manSave(wxFileConfig& fileConfig)const { fileConfig.Write("useNotification", (long)_useNotification); fileConfig.Write("notificationPosition", (long)_notificationPosition); fileConfig.Write("nearCursor", _nearCursor); fileConfig.Write("multipleNotifications", _multipleNotifications); fileConfig.Write("border", (long)_border); fileConfig.Write("colourBackground", (long)_colourBackground.GetRGB()); fileConfig.Write("colourText", (long)_colourText.GetRGB()); fileConfig.SetPath("workarea/"); //On écrit -1 pour les valeur par défaut. wxRect workarea = wxDisplay().GetGeometry(); if(workarea.x == _workarea.x) fileConfig.Write("x", (long)-1); else fileConfig.Write("x", (long)_workarea.x); if(workarea.y == _workarea.y) fileConfig.Write("y", (long)-1); else fileConfig.Write("y", (long)_workarea.y); if(workarea.height == _workarea.height) fileConfig.Write("height", (long)-1); else fileConfig.Write("height", (long)_workarea.height); if(workarea.width == _workarea.width) fileConfig.Write("width", (long)-1); else fileConfig.Write("width", (long)_workarea.width); fileConfig.SetPath(".."); }
void ActLearn::actSave(wxFileConfig & fileConfig)const { fileConfig.Write("listName", _listName); fileConfig.Write("nbText", (double)_nbText); }
//~~ int GetIconIndex() [AstadeRelation] ~~ wxArrayString names; wxFileConfig theConfig(wxEmptyString, wxEmptyString, wxEmptyString, myModelElement->GetFileName().GetFullPath()); wxString RelationType = theConfig.Read(wxS("Astade/RelationType")); if (RelationType == wxS("ImplementationDependency")) { names.Add(wxS("relation")); names.Add(CODE_CPlusPlus); } else if (RelationType == wxS("SpecificationDependency")) { names.Add(wxS("relation")); names.Add(wxS("h")); } else if (RelationType == wxS("Friend")) names.Add(wxS("relation")); else if (RelationType == wxS("Association")) names.Add(wxS("association")); else if (RelationType == wxS("Aggregation")) names.Add(wxS("aggregation")); else if (RelationType == wxS("Composition")) names.Add(wxS("composition")); else if (RelationType == wxS("Generalization")) names.Add(wxS("generalisation")); else assert(false);
//~~ void Load(const wxString fileName) [glFrame] ~~ if (!fileName.empty()) { currentFile = fileName; wxFileName aFile(currentFile); wxFileConfig aConfig(wxEmptyString, wxEmptyString, aFile.GetFullPath(), wxEmptyString, wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_RELATIVE_PATH); int saveVersion = 1; bool read = aConfig.Read(wxS("SaveFileVersion"), &saveVersion); if (read && (saveVersion < 2)) { wxMessageBox(wxS("This file has an older graphic format. If you overwrite it with this newer program, the program which has generated this file will not be able to read it any more!"), wxS("Notice!"), wxOK | wxICON_INFORMATION, this); } int w = 600; aConfig.Read(wxS("Window/XSize"), &w); int h = 400; aConfig.Read(wxS("Window/YSize"), &h); xPixelSlider->SetValue(w); yPixelSlider->SetValue(h); wxScrollEvent dummy; OnSliderMove(dummy); graphicPanel->Load(aConfig); SetTitle(currentFile); isChanged = false; }