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(".."); } }
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 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 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 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(".."); }
static wxString ChangePath(wxFileConfig& fc, const wxChar *path) { fc.SetPath(path); return fc.GetPath(); }