|
From: <pst...@us...> - 2011-08-05 00:44:26
|
Revision: 869
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=869&view=rev
Author: pstieber
Date: 2011-08-05 00:44:20 +0000 (Fri, 05 Aug 2011)
Log Message:
-----------
1. Upgraded from wxStringList to wxArrayString.
2. Removed unneeded casts.
Modified Paths:
--------------
trunk/jazz/src/DeprecatedWx/proplist.cpp
trunk/jazz/src/DeprecatedWx/proplist.h
Modified: trunk/jazz/src/DeprecatedWx/proplist.cpp
===================================================================
--- trunk/jazz/src/DeprecatedWx/proplist.cpp 2011-08-05 00:07:36 UTC (rev 868)
+++ trunk/jazz/src/DeprecatedWx/proplist.cpp 2011-08-05 00:44:20 UTC (rev 869)
@@ -57,11 +57,6 @@
using namespace std;
-#if !WXWIN_COMPATIBILITY_2_4
-static inline wxChar* copystring(const wxChar* s)
- { return wxStrcpy(new wxChar[wxStrlen(s) + 1], s); }
-#endif
-
// ----------------------------------------------------------------------------
// Property text edit control
// ----------------------------------------------------------------------------
@@ -911,7 +906,7 @@
wxString value(view->GetValueText()->GetValue());
float val = 0.0;
- if (!StringToFloat(WXSTRINGCAST value, &val))
+ if (!StringToFloat(value, &val))
{
wxChar buf[200];
wxSprintf(buf, wxT("Value %s is not a valid real number!"), value.GetData());
@@ -974,7 +969,7 @@
wxString value(view->GetValueText()->GetValue());
long val = 0;
- if (!StringToLong(WXSTRINGCAST value, &val))
+ if (!StringToLong(value, &val))
{
wxChar buf[200];
wxSprintf(buf, wxT("Value %s is not a valid integer!"), value.GetData());
@@ -1093,9 +1088,7 @@
view->GetValueList()->Append(wxT("True"));
view->GetValueList()->Append(wxT("False"));
- wxChar *currentString = copystring(view->GetValueText()->GetValue());
- view->GetValueList()->SetStringSelection(currentString);
- delete[] currentString;
+ view->GetValueList()->SetStringSelection(view->GetValueText()->GetValue());
}
return true;
}
@@ -1132,7 +1125,7 @@
///
IMPLEMENT_DYNAMIC_CLASS(wxStringListValidator, wxPropertyListValidator)
-wxStringListValidator::wxStringListValidator(wxStringList *list, long flags):
+wxStringListValidator::wxStringListValidator(wxArrayString *list, long flags):
wxPropertyListValidator(flags)
{
m_strings = list;
@@ -1150,7 +1143,7 @@
return false;
wxString value(view->GetValueText()->GetValue());
- if (!m_strings->Member(value.GetData()))
+ if (m_strings->Index(value.GetData()) == wxNOT_FOUND)
{
wxString str( wxT("Value ") );
str += value.GetData();
@@ -1227,12 +1220,13 @@
{
view->ShowListBoxControl(true);
view->GetValueList()->Enable();
- wxStringList::compatibility_iterator node = m_strings->GetFirst();
- while (node)
+ for (
+ wxArrayString::iterator iString = m_strings->begin();
+ iString != m_strings->end();
+ ++iString)
{
- const wxChar* s = node->GetData();
+ const wxString& s = *iString;
view->GetValueList()->Append(s);
- node = node->GetNext();
}
wxChar *currentString = property->GetValue().StringValue();
view->GetValueList()->SetStringSelection(currentString);
@@ -1267,25 +1261,33 @@
if (!m_strings)
return false;
- wxStringList::compatibility_iterator node = m_strings->GetFirst();
+ wxArrayString::iterator iString = m_strings->begin();
wxChar* currentString = property->GetValue().StringValue();
- while (node)
+ while (iString != m_strings->end())
{
- const wxChar* s = node->GetData();
+ const wxString& s = *iString;
if (wxStrcmp(s, currentString) == 0)
{
const wxChar *nextString;
- if (node->GetNext())
- nextString = node->GetNext()->GetData();
+ ++iString;
+ if (iString != m_strings->end())
+ {
+ nextString = *iString;
+ }
else
- nextString = m_strings->GetFirst()->GetData();
+ {
+ nextString = *m_strings->begin();
+ }
property->GetValue() = wxString(nextString);
view->DisplayProperty(property);
view->UpdatePropertyDisplayInList(property);
view->OnPropertyChanged(property);
return true;
}
- else node = node->GetNext();
+ else
+ {
+ ++iString;
+ }
}
return true;
}
@@ -1366,7 +1368,7 @@
m_filenameMessage.GetData(),
wxPathOnly(property->GetValue().StringValue()),
wxFileNameFromPath(property->GetValue().StringValue()),
- NULL,
+ wxEmptyString,
m_filenameWildCard.GetData(),
0,
parentWindow);
@@ -1811,11 +1813,13 @@
if (sel == wxNOT_FOUND)
return;
- wxStringList::compatibility_iterator* node =
- (wxStringList::compatibility_iterator*)
+ wxStringList::compatibility_iterator* node =
+ (wxStringList::compatibility_iterator*)
m_listBox->wxListBox::GetClientData(sel);
if (!node)
+ {
return;
+ }
m_listBox->Delete(sel);
delete[] (const wxChar *)(*node)->GetData();
@@ -1875,18 +1879,17 @@
if (m_currentSelection == -1)
return;
- wxStringList::compatibility_iterator* node =
- (wxStringList::compatibility_iterator*)
- m_listBox->wxListBox::GetClientData(m_currentSelection);
- if (!node)
+ list<wxString>::iterator* piString =
+ (list<wxString>::iterator*)
+ m_listBox->wxListBox::GetClientData(m_currentSelection);
+ if (!piString)
+ {
return;
+ }
- wxString txt(m_stringText->GetValue());
- if ((*node)->GetData())
- delete[] (const wxChar *)(*node)->GetData();
- (*node)->SetData(wxStrdup(txt));
+ **piString = m_stringText->GetValue();
- m_listBox->SetString(m_currentSelection, (const wxChar *)(*node)->GetData());
+ m_listBox->SetString(m_currentSelection, **piString);
}
void wxPropertyStringListEditorDialog::ShowCurrentSelection()
Modified: trunk/jazz/src/DeprecatedWx/proplist.h
===================================================================
--- trunk/jazz/src/DeprecatedWx/proplist.h 2011-08-05 00:07:36 UTC (rev 868)
+++ trunk/jazz/src/DeprecatedWx/proplist.h 2011-08-05 00:44:20 UTC (rev 869)
@@ -539,7 +539,7 @@
class WXDLLIMPEXP_DEPRECATED wxStringListValidator: public wxPropertyListValidator
{
public:
- wxStringListValidator(wxStringList *list = NULL, long flags = 0);
+ wxStringListValidator(wxArrayString *list = NULL, long flags = 0);
~wxStringListValidator()
{
@@ -566,7 +566,7 @@
bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
protected:
- wxStringList* m_strings;
+ wxArrayString* m_strings;
private:
DECLARE_DYNAMIC_CLASS(wxStringListValidator)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|