Update of /cvsroot/mahogany/M/src/wx/generic
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20295/src/wx/generic
Modified Files:
persctrl.cpp
Log Message:
implemented recursive fallback for wxPTextEntry
Index: persctrl.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/wx/generic/persctrl.cpp,v
retrieving revision 1.95
retrieving revision 1.96
diff -b -u -2 -r1.95 -r1.96
--- persctrl.cpp 16 Jan 2006 20:32:28 -0000 1.95
+++ persctrl.cpp 6 Mar 2006 00:19:26 -0000 1.96
@@ -462,8 +462,15 @@
size_t wxPTextEntry::ms_countSaveDefault = 16;
+void wxPTextEntry::Init()
+{
+ m_numParentsToCheck = 0;
+ m_countSaveMax = ms_countSaveDefault;
+}
+
wxPTextEntry::wxPTextEntry()
{
+ Init();
+
m_persist = new wxPHelper;
- m_countSaveMax = ms_countSaveDefault;
}
@@ -478,5 +485,15 @@
: wxComboBox(parent, id, value, pos, size, style)
{
+ Init();
+
wxString realConfigPath(configPath);
+
+ // first of all check if we have any trailing colons: they indicate that we
+ // should also read the values from the parent key(s)
+ while ( !realConfigPath.empty() && realConfigPath.Last() == _T(':') ) {
+ realConfigPath.RemoveLast();
+ m_numParentsToCheck++;
+ }
+
if ( !realConfigPath.empty() && realConfigPath.Last() != '/' ) {
// we need a subgroup name, not a key name
@@ -485,5 +502,4 @@
m_persist = new wxPHelper(realConfigPath, wxEmptyString, config);
- m_countSaveMax = ms_countSaveDefault;
RestoreStrings();
@@ -560,6 +576,9 @@
wxConfigBase *config = m_persist->GetConfig();
+ wxString text;
+ bool isFirst = true;
+ for ( size_t level = 0; level <= m_numParentsToCheck; level++ ) {
// read them all
- wxString key, val, text;
+ wxString key, val;
for ( size_t n = 0; ; n++ ) {
key.Printf(_T("%lu"), (unsigned long)n);
@@ -568,12 +587,27 @@
val = config->Read(key);
- // the first one is the text zone itself
- if ( n == 0 ) {
+ // the very first one is the text zone itself
+ if ( isFirst ) {
+ isFirst = false;
text = val;
}
+ else {
+ // check that we don't already have it, we don't need
+ // duplicates
+ if ( FindString(val) != wxNOT_FOUND )
+ continue;
+ }
Append(val);
}
+ const wxString oldPath = config->GetPath();
+ config->SetPath(_T(".."));
+ if ( config->GetPath() == oldPath ) {
+ // reached the root probably, doesn't make sense to continue
+ break;
+ }
+ }
+
SetValue(text);
m_persist->RestorePath();
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates