Revision: 7229
http://svn.sourceforge.net/mahogany/?rev=7229&view=rev
Author: vadz
Date: 2007-04-03 06:43:17 -0700 (Tue, 03 Apr 2007)
Log Message:
-----------
use wxStringTokenize in wxPListCtrl::RestoreWidths() instead of doing it
manually
Modified Paths:
--------------
trunk/M/src/wx/generic/persctrl.cpp
Modified: trunk/M/src/wx/generic/persctrl.cpp
===================================================================
--- trunk/M/src/wx/generic/persctrl.cpp 2007-04-03 13:42:19 UTC (rev 7228)
+++ trunk/M/src/wx/generic/persctrl.cpp 2007-04-03 13:43:17 UTC (rev 7229)
@@ -838,31 +838,24 @@
wxString str = m_persist->GetConfig()->Read(m_persist->GetKey());
if ( !str.empty() )
{
- int countCol = GetColumnCount();
- char *p = (char *)str.c_str();
- for ( int col = 0; col < countCol; col++ )
+ const wxArrayString widths(wxStringTokenize(str, _T(":")));
+ const size_t count = widths.size();
+ if ( (int)count != GetColumnCount() )
{
- if ( wxIsEmpty(p) )
- break;
+ wxLogDebug(_T("columns count mismatch"));
+ return;
+ }
- char *end = strchr(p, ':');
- if ( end )
- *end = '\0'; // temporarily truncate
-
- int width;
- if ( sscanf(p, "%d", &width) == 1 )
+ for ( size_t n = 0; n < count; n++ )
+ {
+ unsigned long w;
+ if ( !widths[n].ToULong(&w) )
{
- SetColumnWidth(col, width);
+ wxLogDebug(_T("corrupted column widths data?"));
+ continue;
}
- else
- {
- wxFAIL_MSG(_T("wxPListCtrl: corrupted config entry?"));
- }
- if ( !end )
- break;
-
- p = end + 1;
+ SetColumnWidth(n, w);
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates