From: <pst...@us...> - 2011-08-04 23:41:13
|
Revision: 864 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=864&view=rev Author: pstieber Date: 2011-08-04 23:41:07 +0000 (Thu, 04 Aug 2011) Log Message: ----------- Updated some string code. Modified Paths: -------------- trunk/jazz/src/DeprecatedWx/prop.cpp trunk/jazz/src/DeprecatedWx/prop.h Modified: trunk/jazz/src/DeprecatedWx/prop.cpp =================================================================== --- trunk/jazz/src/DeprecatedWx/prop.cpp 2011-08-04 20:29:50 UTC (rev 863) +++ trunk/jazz/src/DeprecatedWx/prop.cpp 2011-08-04 23:41:07 UTC (rev 864) @@ -637,7 +637,7 @@ // void wxPropertyValue::operator=(const char *val) void wxPropertyValue::operator=(const wxString& val1) { - const wxChar *val = (const wxChar *)val1; + const wxChar *val = val1.c_str(); m_modifiedFlag = true; @@ -1226,7 +1226,7 @@ wxPropertyValidator::~wxPropertyValidator(void) {} -bool wxPropertyValidator::StringToFloat (wxChar *s, float *number) +bool wxPropertyValidator::StringToFloat (const wxString& s, float *number) { double num; bool ok = StringToDouble (s, &num); @@ -1234,7 +1234,7 @@ return ok; } -bool wxPropertyValidator::StringToDouble (wxChar *s, double *number) +bool wxPropertyValidator::StringToDouble (const wxString& s, double *number) { bool ok = true; wxChar *value_ptr; @@ -1251,7 +1251,7 @@ return ok; } -bool wxPropertyValidator::StringToInt (wxChar *s, int *number) +bool wxPropertyValidator::StringToInt (const wxString& s, int *number) { long num; bool ok = StringToLong (s, &num); @@ -1259,7 +1259,7 @@ return ok; } -bool wxPropertyValidator::StringToLong (wxChar *s, long *number) +bool wxPropertyValidator::StringToLong (const wxString& s, long *number) { bool ok = true; wxChar *value_ptr; Modified: trunk/jazz/src/DeprecatedWx/prop.h =================================================================== --- trunk/jazz/src/DeprecatedWx/prop.h 2011-08-04 20:29:50 UTC (rev 863) +++ trunk/jazz/src/DeprecatedWx/prop.h 2011-08-04 23:41:07 UTC (rev 864) @@ -195,10 +195,10 @@ return m_validatorProperty; } - virtual bool StringToFloat (wxChar *s, float *number); - virtual bool StringToDouble (wxChar *s, double *number); - virtual bool StringToInt (wxChar *s, int *number); - virtual bool StringToLong (wxChar *s, long *number); + virtual bool StringToFloat (const wxString& s, float *number); + virtual bool StringToDouble (const wxString& s, double *number); + virtual bool StringToInt (const wxString& s, int *number); + virtual bool StringToLong (const wxString& s, long *number); virtual wxChar *FloatToString (float number); virtual wxChar *DoubleToString (double number); virtual wxChar *IntToString (int number); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2011-08-05 00:02:56
|
Revision: 867 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=867&view=rev Author: pstieber Date: 2011-08-05 00:02:50 +0000 (Fri, 05 Aug 2011) Log Message: ----------- Upgraded from wxStringList to wxArrayString. Modified Paths: -------------- trunk/jazz/src/DeprecatedWx/propform.cpp trunk/jazz/src/DeprecatedWx/propform.h Modified: trunk/jazz/src/DeprecatedWx/propform.cpp =================================================================== --- trunk/jazz/src/DeprecatedWx/propform.cpp 2011-08-04 23:54:54 UTC (rev 866) +++ trunk/jazz/src/DeprecatedWx/propform.cpp 2011-08-05 00:02:50 UTC (rev 867) @@ -673,7 +673,7 @@ /// IMPLEMENT_DYNAMIC_CLASS(wxStringFormValidator, wxPropertyFormValidator) -wxStringFormValidator::wxStringFormValidator(wxStringList *list, long flags): +wxStringFormValidator::wxStringFormValidator(wxArrayString *list, long flags): wxPropertyFormValidator(flags) { m_strings = list; @@ -692,7 +692,7 @@ if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) { wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow; - if (!m_strings->Member(text->GetValue())) + if (m_strings->Index(text->GetValue()) == wxNOT_FOUND) { wxString str( wxT("Value ") ); str += text->GetValue(); @@ -765,12 +765,13 @@ if (lbox->GetCount() == 0 && m_strings) { // Try to initialize the listbox from 'strings' - 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; lbox->Append(s); - node = node->GetNext(); } } lbox->SetStringSelection(property->GetValue().StringValue()); @@ -789,12 +790,13 @@ { // Try to initialize the choice item from 'strings' // XView doesn't allow this kind of thing. - 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; choice->Append(s); - node = node->GetNext(); } } choice->SetStringSelection(property->GetValue().StringValue()); Modified: trunk/jazz/src/DeprecatedWx/propform.h =================================================================== --- trunk/jazz/src/DeprecatedWx/propform.h 2011-08-04 23:54:54 UTC (rev 866) +++ trunk/jazz/src/DeprecatedWx/propform.h 2011-08-05 00:02:50 UTC (rev 867) @@ -253,7 +253,7 @@ { DECLARE_DYNAMIC_CLASS(wxStringFormValidator) public: - wxStringFormValidator(wxStringList *list = NULL, long flags = 0); + wxStringFormValidator(wxArrayString *list = NULL, long flags = 0); ~wxStringFormValidator(void) { @@ -266,7 +266,7 @@ bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); protected: - wxStringList* m_strings; + wxArrayString* m_strings; }; /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <pst...@us...> - 2011-08-05 00:48:41
|
Revision: 870 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=870&view=rev Author: pstieber Date: 2011-08-05 00:48:35 +0000 (Fri, 05 Aug 2011) Log Message: ----------- 1. Used 0 instead of NULL. 2. Updated some string code. 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:44:20 UTC (rev 869) +++ trunk/jazz/src/DeprecatedWx/proplist.cpp 2011-08-05 00:48:35 UTC (rev 870) @@ -1268,7 +1268,7 @@ const wxString& s = *iString; if (wxStrcmp(s, currentString) == 0) { - const wxChar *nextString; + wxString nextString; ++iString; if (iString != m_strings->end()) { Modified: trunk/jazz/src/DeprecatedWx/proplist.h =================================================================== --- trunk/jazz/src/DeprecatedWx/proplist.h 2011-08-05 00:44:20 UTC (rev 869) +++ trunk/jazz/src/DeprecatedWx/proplist.h 2011-08-05 00:48:35 UTC (rev 870) @@ -539,7 +539,7 @@ class WXDLLIMPEXP_DEPRECATED wxStringListValidator: public wxPropertyListValidator { public: - wxStringListValidator(wxArrayString *list = NULL, long flags = 0); + wxStringListValidator(wxArrayString* list = 0, long flags = 0); ~wxStringListValidator() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2013-01-03 23:51:48
|
Revision: 934 http://sourceforge.net/p/jazzplusplus/code/934 Author: pstieber Date: 2013-01-03 23:51:45 +0000 (Thu, 03 Jan 2013) Log Message: ----------- Added includes of wx/wxcrtvararg.h for wxWidgets 2.9.* compatibility. Modified Paths: -------------- trunk/jazz/src/DeprecatedWx/prop.cpp trunk/jazz/src/DeprecatedWx/propform.cpp trunk/jazz/src/DeprecatedWx/proplist.cpp Modified: trunk/jazz/src/DeprecatedWx/prop.cpp =================================================================== --- trunk/jazz/src/DeprecatedWx/prop.cpp 2013-01-02 18:21:30 UTC (rev 933) +++ trunk/jazz/src/DeprecatedWx/prop.cpp 2013-01-03 23:51:45 UTC (rev 934) @@ -24,6 +24,7 @@ #endif #include "wx/debug.h" +#include "wx/wxcrtvararg.h" #include "prop.h" #include <ctype.h> Modified: trunk/jazz/src/DeprecatedWx/propform.cpp =================================================================== --- trunk/jazz/src/DeprecatedWx/propform.cpp 2013-01-02 18:21:30 UTC (rev 933) +++ trunk/jazz/src/DeprecatedWx/propform.cpp 2013-01-03 23:51:45 UTC (rev 934) @@ -21,6 +21,7 @@ #if wxUSE_PROPSHEET #ifndef WX_PRECOMP + #include "wx/wxcrtvararg.h" #include "wx/choice.h" #include "wx/checkbox.h" #include "wx/slider.h" Modified: trunk/jazz/src/DeprecatedWx/proplist.cpp =================================================================== --- trunk/jazz/src/DeprecatedWx/proplist.cpp 2013-01-02 18:21:30 UTC (rev 933) +++ trunk/jazz/src/DeprecatedWx/proplist.cpp 2013-01-03 23:51:45 UTC (rev 934) @@ -38,6 +38,7 @@ #include "wx/settings.h" #include "wx/msgdlg.h" #include "wx/filedlg.h" + #include "wx/wxcrtvararg.h" #endif #include "wx/sizer.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |