Logo Search packages:      
Sourcecode: codeblocks version File versions  Download package

bool wxKeyProfileArray::Save ( wxConfigBase *  p,
const wxString &  key = wxEmptyString,
bool  bCleanOld = FALSE 
) const

Stores the wxKeyProfiles into the given wxConfig object.

bCleanOld If TRUE, this function will save all the mcStyleArrays it contains and then will delete any other group which starts with the mgSTYLES_CONFIG_PREFIX string.

Definition at line 1565 of file keybinder.cpp.

      wxString basekey = (key.IsEmpty()) ? wxString(wxT("")) : wxString(key + wxT("/"));
      bool b = TRUE;


      if (!cfg->Write(basekey + wxT("nSelProfile"), m_nSelected))
            return FALSE;

      for (int i=0; i<GetCount(); i++)
        LOGIT(wxT("wxKeyProfileArray::Save profile[%d]"),i);
            // save all our elements into a subkey of the given key
            b &= Item(i)->Save(cfg, basekey + wxKEYPROFILE_CONFIG_PREFIX +
                                                      wxString::Format(wxT("%d"), i), bCleanOld);

      // if required, remove any previously stored key profile...
      if (bCleanOld) {

            // the Save() calls could have changed our current path...

            // enumerate all groups
            wxString str;
            long n, idx;

            bool cont = cfg->GetFirstGroup(str, idx);
            while (cont) {
                  if (str.StartsWith(wxKEYPROFILE_CONFIG_PREFIX)) {

                        // extract the id of this group...
                        wxString id=str.Right(str.Len()-wxString(wxKEYPROFILE_CONFIG_PREFIX).Len());

                        if (n >= GetCount()) {

                              // this is a profile which was saved in a previous session
                              // but which has now been removed by the user... remove it
                              // from our config settings...

                              // re-start our enumeration; otherwise GetNextGroup() won't work...
                              cont = cfg->GetFirstGroup(str, idx);
                              if (!cont) break;

                  // proceed with next one...
                  cont &= cfg->GetNextGroup(str, idx);

      return b;

Generated by  Doxygen 1.6.0   Back to index