From: <pst...@us...> - 2011-07-28 12:36:46
|
Revision: 845 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=845&view=rev Author: pstieber Date: 2011-07-28 12:36:39 +0000 (Thu, 28 Jul 2011) Log Message: ----------- Changed to remove the need for DeprecatedStringUtils.cpp and DeprecatedStringUtils.h. Modified Paths: -------------- trunk/jazz/src/Audio.cpp trunk/jazz/src/ClockDialog.cpp trunk/jazz/src/Dialogs.cpp trunk/jazz/src/FileSelector.cpp trunk/jazz/src/FileSelector.h trunk/jazz/src/Harmony.cpp trunk/jazz/src/Makefile.am trunk/jazz/src/Player.h trunk/jazz/src/Rhythm.cpp trunk/jazz/src/Rhythm.h trunk/jazz/src/Sample.cpp trunk/jazz/src/SampleDialog.cpp trunk/jazz/src/SampleDialog.h trunk/jazz/src/Track.cpp trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj Removed Paths: ------------- trunk/jazz/src/DeprecatedStringUtils.cpp trunk/jazz/src/DeprecatedStringUtils.h Modified: trunk/jazz/src/Audio.cpp =================================================================== --- trunk/jazz/src/Audio.cpp 2011-07-27 14:22:13 UTC (rev 844) +++ trunk/jazz/src/Audio.cpp 2011-07-28 12:36:39 UTC (rev 845) @@ -689,10 +689,10 @@ wxText* pFile; #endif // OBSOLETE - static char* mpSamplePath; + static wxString mSamplePath; static int current; - char* ListEntry(int i); + std::string ListEntry(int i); void Sample2Win(int index); void Win2Sample(int index); void SetCurrentListEntry(int i); @@ -721,19 +721,18 @@ "44100", 0 }; - speed = mSampleSet.GetSamplingRate(); - speedstr = 0; + speed = mSampleSet.GetSamplingRate(); for (int i = 0; speedtxt[i]; i++) { strlist.Append((wxObject*)speedtxt[i]); // ??? if (atol(speedtxt[i]) == speed) { - speedstr = copystring(speedtxt[i]); + mSpeedString = speedtxt[i]; } } - if (!speedstr) + if (mSpeedString.empty()) { - speedstr = copystring(speedtxt[0]); + mSpeedString = speedtxt[0]; } enable = gpMidiPlayer->GetAudioEnabled(); @@ -742,8 +741,8 @@ Add(wxMakeFormBool("Enable Audio", &enable)); Add(wxMakeFormNewLine()); - //Add(wxMakeFormString("Sample Freq", (char**)&speedstr, wxFORM_CHOICE, - Add(wxMakeFormString("Sample Freq", (char**)&speedstr, wxFORM_DEFAULT, + //Add(wxMakeFormString("Sample Freq", (char**)&mSpeedString, wxFORM_CHOICE, + Add(wxMakeFormString("Sample Freq", (char**)&mSpeedString.c_str(), wxFORM_DEFAULT, new wxList(wxMakeConstraintStrings(&strlist), 0), NULL, wxHORIZONTAL)); Add(wxMakeFormNewLine()); Add(wxMakeFormBool("Stereo", &stereo)); @@ -772,7 +771,8 @@ return; wxBeginBusyCursor(); mSampleSet.mpGlobalSettingsDialog = 0; - speed = atol(speedstr); + istringstream Iss(mSpeedString); + Iss >> speed; mSampleSet.SetSamplingRate(speed); mSampleSet.SetChannelCount(stereo ? 2 : 1); mSampleSet.SetSoftSync(mSoftwareSynchonization); @@ -817,7 +817,7 @@ wxList strlist; long speed; - const char* speedstr; + const std::string mSpeedString; bool enable; bool stereo; bool mSoftwareSynchonization; @@ -1134,7 +1134,7 @@ #if 0 //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -char* JZSamplesDlg::mpSamplePath = 0; +wxString JZSamplesDlg::mSamplePath; int JZSamplesDlg::current = 0; //----------------------------------------------------------------------------- @@ -1143,9 +1143,9 @@ : wxDialog(pParent, wxID_ANY, wxString("Sample Settings")), set(s) { - if (mpSamplePath == 0) + if (mSamplePath.empty()) { - mpSamplePath = copystring("*.wav"); + mSamplePath = "*.wav"; } wxArrayString SampleNames; @@ -1199,12 +1199,12 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -char* JZSamplesDlg::ListEntry(int i) +string JZSamplesDlg::ListEntry(int i) { ostringstream Oss; Oss << i + 1 << ' ' << set.mSamples[i]->GetLabel(); // KeyToString(i, buf + strlen(buf)); - return copystring(Oss.str().c_str()); + return Oss.str(); } //----------------------------------------------------------------------------- @@ -1241,9 +1241,8 @@ { if (i >= 0) { - current = i; - mpListBox->SetString(current, ListEntry(current)); - mpListBox->SetSelection(current, true); + mpListBox->SetString(current, ListEntry(i)); + mpListBox->SetSelection(i, true); } } @@ -1275,7 +1274,7 @@ void JZSamplesDlg::OnAddButton() { wxString FileName = file_selector( - mpSamplePath, + mSamplePath, "Load Sample", false, false, Modified: trunk/jazz/src/ClockDialog.cpp =================================================================== --- trunk/jazz/src/ClockDialog.cpp 2011-07-27 14:22:13 UTC (rev 844) +++ trunk/jazz/src/ClockDialog.cpp 2011-07-28 12:36:39 UTC (rev 845) @@ -38,9 +38,7 @@ //----------------------------------------------------------------------------- JZClockDialog::JZClockDialog(JZSong* pSong, const char* pTitle, int Clock) { - string ClockString; - pSong->ClockToString(Clock, ClockString); - mpString = copystring(ClockString.c_str()); + pSong->ClockToString(Clock, mString); mpTitle = pTitle; mpSong = pSong; } @@ -49,7 +47,6 @@ //----------------------------------------------------------------------------- JZClockDialog::~JZClockDialog() { - delete mpString; } //----------------------------------------------------------------------------- @@ -58,7 +55,7 @@ { return new wxProperty( mpTitle, - wxPropertyValue((char**)&mpString), + wxPropertyValue((char**)&mString.c_str()), "string"); } @@ -66,5 +63,5 @@ //----------------------------------------------------------------------------- int JZClockDialog::GetClock() { - return mpSong->StringToClock(mpString); + return mpSong->StringToClock(mString.c_str()); } Deleted: trunk/jazz/src/DeprecatedStringUtils.cpp =================================================================== --- trunk/jazz/src/DeprecatedStringUtils.cpp 2011-07-27 14:22:13 UTC (rev 844) +++ trunk/jazz/src/DeprecatedStringUtils.cpp 2011-07-28 12:36:39 UTC (rev 845) @@ -1,36 +0,0 @@ -//***************************************************************************** -// The JAZZ++ Midi Sequencer -// -// Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. -// Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008-2010 Peter J. Stieber -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -//***************************************************************************** - -#include <cstring> - -//***************************************************************************** -// Description: -// This code used to be include with old versions of wxWidgets. The code -// make a copy of the passed string using 'new'. -//***************************************************************************** -char* copystring(const char* pString) -{ - int Length = strlen(pString); - char* pNewString = new char[Length + 1]; - strcpy(pNewString, pString); - return pNewString; -} Deleted: trunk/jazz/src/DeprecatedStringUtils.h =================================================================== --- trunk/jazz/src/DeprecatedStringUtils.h 2011-07-27 14:22:13 UTC (rev 844) +++ trunk/jazz/src/DeprecatedStringUtils.h 2011-07-28 12:36:39 UTC (rev 845) @@ -1,33 +0,0 @@ -//***************************************************************************** -// The JAZZ++ Midi Sequencer -// -// Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. -// Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008-2010 Peter J. Stieber -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -//***************************************************************************** - -#ifndef JZ_DEPRECATEDSTRINGUTILS_H -#define JZ_DEPRECATEDSTRINGUTILS_H - -//***************************************************************************** -// Description: -// This code used to be include with old versions of wxWidgets. The code -// make a copy of the passed string using 'new'. -//***************************************************************************** -char* copystring(const char *s); - -#endif // !defined(JZ_DEPRECATEDSTRINGUTILS_H) Modified: trunk/jazz/src/Dialogs.cpp =================================================================== --- trunk/jazz/src/Dialogs.cpp 2011-07-27 14:22:13 UTC (rev 844) +++ trunk/jazz/src/Dialogs.cpp 2011-07-28 12:36:39 UTC (rev 845) @@ -40,7 +40,7 @@ #include "Filter.h" #include "Globals.h" #include "Help.h" -#include "NamedChoice.h" +//#include "NamedChoice.h" #include "PianoFrame.h" #include "PianoWindow.h" #include "Player.h" @@ -475,14 +475,14 @@ switch (pEvent->GetStat()) { case StatKeyOn: - if (pTrack->GetAudioMode()) - { - if (!gpMidiPlayer->IsPlaying()) - { - gpMidiPlayer->EditSample(pEvent->IsKeyOn()->GetKey()); - } - break; - } +// if (pTrack->GetAudioMode()) +// { +// if (!gpMidiPlayer->IsPlaying()) +// { +// gpMidiPlayer->EditSample(pEvent->IsKeyOn()->GetKey()); +// } +// break; +// } { JZKeyOnDialog KeyOnDialog(pEvent->IsKeyOn(), pTrack, pPianoWindow); Modified: trunk/jazz/src/FileSelector.cpp =================================================================== --- trunk/jazz/src/FileSelector.cpp 2011-07-27 14:22:13 UTC (rev 844) +++ trunk/jazz/src/FileSelector.cpp 2011-07-28 12:36:39 UTC (rev 845) @@ -28,9 +28,9 @@ // Description: // Add a supplied extension to a file name if the file name doesn't already // have an extension. -// ext is assumed to have a leading dot. (.mid for example) +// Extension is assumed to have a leading dot. (.mid for example) //***************************************************************************** -wxString add_default_ext(const wxString fn, const wxString ext) +wxString add_default_ext(const wxString fn, const wxString Extension) { // Is any extension already there? @@ -45,7 +45,7 @@ // Otherwise append the supplied extension and return wxString RevisedFileName = fn; - RevisedFileName += ext; + RevisedFileName += Extension; return RevisedFileName; } @@ -60,29 +60,29 @@ // This is the file name. //***************************************************************************** wxString file_selector( - wxString deffile, + wxString DefaultFileName, const wxString title, bool save, bool changed, - const wxString ext) + const wxString Extension) { wxString file; wxString path; if (save) { - file = wxFileNameFromPath(deffile); + file = wxFileNameFromPath(DefaultFileName); } - path = wxPathOnly(deffile); + path = wxPathOnly(DefaultFileName); int flags = save ? wxFD_SAVE : wxFD_OPEN; - wxString s = wxFileSelector(title, path, file, 0, ext, flags); + wxString s = wxFileSelector(title, path, file, 0, Extension, flags); // add extension if missing - if (!s.empty() && ext) + if (!s.empty() && Extension) { - s = add_default_ext(s, ext); + s = add_default_ext(s, Extension); } // warn if overwriting existent file @@ -104,7 +104,7 @@ if (s && !save && changed) { wxString buf; - buf<<deffile; + buf << DefaultFileName; buf <<" has changed. Load anyway?"; if (wxMessageBox(buf, "Load ?", wxYES_NO) == wxNO) { @@ -124,11 +124,10 @@ } } - if (s!=wxEmptyString) + if (s != wxEmptyString) { - //delete [] deffile; - //deffile = s; - //return deffile; + //DefaultFileName = s; + //return DefaultFileName; //i dont understand the point of the above original construct // wxString rv=*(new wxString(s)); // return rv;//copy the local string and return it Modified: trunk/jazz/src/FileSelector.h =================================================================== --- trunk/jazz/src/FileSelector.h 2011-07-27 14:22:13 UTC (rev 844) +++ trunk/jazz/src/FileSelector.h 2011-07-28 12:36:39 UTC (rev 845) @@ -24,7 +24,7 @@ #define JZ_FILESELECTOR_H wxString file_selector( - wxString DefaultFile, + wxString DefaultFileName, const wxString Title, bool Sve, bool Changed, Modified: trunk/jazz/src/Harmony.cpp =================================================================== --- trunk/jazz/src/Harmony.cpp 2011-07-27 14:22:13 UTC (rev 844) +++ trunk/jazz/src/Harmony.cpp 2011-07-28 12:36:39 UTC (rev 845) @@ -591,7 +591,7 @@ int mSequenceCount; - std::string mDefaultFileName; + wxString mDefaultFileName; bool mHasChanged; @@ -836,8 +836,15 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -JZHarmonyBrowserCanvas::JZHarmonyBrowserCanvas(wxFrame* pParent, int x, int y, int w, int h) - : wxScrolledWindow(pParent, wxID_ANY, wxPoint(x, y), wxSize(w, h)) +JZHarmonyBrowserCanvas::JZHarmonyBrowserCanvas( + wxFrame* pParent, + int x, + int y, + int w, + int h) + : wxScrolledWindow(pParent, wxID_ANY, wxPoint(x, y), wxSize(w, h)), + mDefaultFileName("noname.har") + { mSequenceCount = 0; @@ -876,7 +883,6 @@ } - mDefaultFileName = "noname.har"; mHasChanged = false; SetScrollbars(0, (int)(mChordHeight + 0.5), 0, 12 + SEQMAX / 8 + 2, 0, 0); @@ -1435,7 +1441,7 @@ void JZHarmonyBrowserCanvas::FileLoad() { wxString FileName = file_selector( - mDefaultFileName.c_str(), + mDefaultFileName, "Load Harmonies", false, mHasChanged, @@ -1453,7 +1459,7 @@ void JZHarmonyBrowserCanvas::FileSaveAs() { wxString FileName = file_selector( - mDefaultFileName.c_str(), + mDefaultFileName, "Save Harmonies", true, mHasChanged, Modified: trunk/jazz/src/Makefile.am =================================================================== --- trunk/jazz/src/Makefile.am 2011-07-27 14:22:13 UTC (rev 844) +++ trunk/jazz/src/Makefile.am 2011-07-28 12:36:39 UTC (rev 845) @@ -18,7 +18,6 @@ Command.cpp \ Configuration.cpp \ ControlEdit.cpp \ -DeprecatedStringUtils.cpp \ DeprecatedWx/prop.cpp \ DeprecatedWx/propform.cpp \ DeprecatedWx/proplist.cpp \ @@ -117,7 +116,6 @@ Command.cpp \ Configuration.cpp \ ControlEdit.cpp \ -DeprecatedStringUtils.cpp \ DeprecatedWx/prop.cpp \ DeprecatedWx/propform.cpp \ DeprecatedWx/proplist.cpp \ @@ -224,7 +222,6 @@ DeprecatedWx/prop.h \ DeprecatedWx/propform.h \ DeprecatedWx/proplist.h \ -DeprecatedStringUtils.h \ Dialogs/AudioSettingsDialog.h \ Dialogs/CleanupDialog.h \ Dialogs/ControllerDialog.h \ Modified: trunk/jazz/src/Player.h =================================================================== --- trunk/jazz/src/Player.h 2011-07-27 14:22:13 UTC (rev 844) +++ trunk/jazz/src/Player.h 2011-07-28 12:36:39 UTC (rev 845) @@ -31,7 +31,6 @@ #include "Song.h" //#include "midinet.h" #include "Audio.h" -#include "DeprecatedStringUtils.h" #include <sys/types.h> #include <time.h> Modified: trunk/jazz/src/Rhythm.cpp =================================================================== --- trunk/jazz/src/Rhythm.cpp 2011-07-27 14:22:13 UTC (rev 844) +++ trunk/jazz/src/Rhythm.cpp 2011-07-28 12:36:39 UTC (rev 845) @@ -23,7 +23,6 @@ #include "Rhythm.h" #include "Command.h" -#include "DeprecatedStringUtils.h" #include "EventWindow.h" #include "FileSelector.h" #include "Filter.h" @@ -524,13 +523,13 @@ wxSize(640, 580)), edit(0), mpEventWindow(pEventWindow), - mpSong(pSong) + mpSong(pSong), + mDefaultFileName("noname.rhy") { #ifdef OBSOLETE in_create = 1; n_instruments = 0; act_instrument = -1; - default_filename = copystring("noname.rhy"); has_changed = false; JZToolDef tdefs[] = @@ -763,7 +762,7 @@ case wxID_OPEN: { wxString fname = file_selector( - default_filename, + mDefaultFileName, "Load Rhythm", false, has_changed, @@ -781,7 +780,7 @@ { Win2Instrument(); wxString fname = file_selector( - default_filename, + mDefaultFileName, "Save Rhythm", true, has_changed, Modified: trunk/jazz/src/Rhythm.h =================================================================== --- trunk/jazz/src/Rhythm.h 2011-07-27 14:22:13 UTC (rev 844) +++ trunk/jazz/src/Rhythm.h 2011-07-28 12:36:39 UTC (rev 845) @@ -233,7 +233,7 @@ void RndEnable(); - char *default_filename; + wxString mDefaultFileName; bool has_changed; wxToolBar* mpToolBar; float tb_width, tb_height; Modified: trunk/jazz/src/Sample.cpp =================================================================== --- trunk/jazz/src/Sample.cpp 2011-07-27 14:22:13 UTC (rev 844) +++ trunk/jazz/src/Sample.cpp 2011-07-28 12:36:39 UTC (rev 845) @@ -25,7 +25,6 @@ #include "Audio.h" #include "Random.h" #include "SampleCommand.h" -#include "DeprecatedStringUtils.h" #include "Mapper.h" #include <cassert> Modified: trunk/jazz/src/SampleDialog.cpp =================================================================== --- trunk/jazz/src/SampleDialog.cpp 2011-07-27 14:22:13 UTC (rev 844) +++ trunk/jazz/src/SampleDialog.cpp 2011-07-28 12:36:39 UTC (rev 845) @@ -30,7 +30,6 @@ #include "Song.h" // Speed() #include "ToolBar.h" #include "FileSelector.h" -#include "DeprecatedStringUtils.h" #include "Help.h" #include <wx/checkbox.h> @@ -496,11 +495,11 @@ JZSynthDlg::JZSynthDlg(JZSampleFrame& SampleFrame) -: JZSliderWindow(&SampleFrame, "Additive Synthesis", geo, syn_tdefs), - win(SampleFrame) + : JZSliderWindow(&SampleFrame, "Additive Synthesis", geo, syn_tdefs), + win(SampleFrame), + mDefaultFileName("noname.syn") { Initialize(); - default_filename = copystring("noname.syn"); } JZSynthDlg::~JZSynthDlg() @@ -508,7 +507,6 @@ int i; for (i = 0; i < MAXSYNTHS; i++) delete synths[i]; - delete [] default_filename; } ostream& operator << (ostream& Os, JZSynthDlg const &a) @@ -620,7 +618,12 @@ { case SYN_LOAD: { - wxString fname = file_selector(default_filename, "Load Synth", 0, 0, "*.syn"); + wxString fname = file_selector( + mDefaultFileName, + "Load Synth", + 0, + 0, + "*.syn"); if (fname) { ifstream is(fname); @@ -637,7 +640,12 @@ case SYN_SAVE: { - wxString fname = file_selector(default_filename, "Save Synth", 1, 0, "*.syn"); + wxString fname = file_selector( + mDefaultFileName, + "Save Synth", + 1, + 0, + "*.syn"); if (fname) { ofstream os(fname); Modified: trunk/jazz/src/SampleDialog.h =================================================================== --- trunk/jazz/src/SampleDialog.h 2011-07-27 14:22:13 UTC (rev 844) +++ trunk/jazz/src/SampleDialog.h 2011-07-28 12:36:39 UTC (rev 845) @@ -150,7 +150,7 @@ static bool noise_enable; static int geo[4]; - char *default_filename; + wxString mDefaultFileName; }; Modified: trunk/jazz/src/Track.cpp =================================================================== --- trunk/jazz/src/Track.cpp 2011-07-27 14:22:13 UTC (rev 844) +++ trunk/jazz/src/Track.cpp 2011-07-28 12:36:39 UTC (rev 845) @@ -1682,7 +1682,7 @@ { JZTrackWindow* TrackWin; JZTrack *trk; - char *TrackName; + std::string& mTrackName; JZNamedChoice PatchChoice; JZNamedChoice DeviceChoice; int PatchNr; @@ -1733,13 +1733,13 @@ if (ClearTrack) { trk->Clear(); - delete TrackName; + mTrackName.clear(); TrackWin->Redraw(); wxForm::OnOk(); return; } - trk->SetName(TrackName); - delete TrackName; + trk->SetName(mTrackName); + mTrackName.clear(); PatchChoice.GetValue(); DeviceChoice.GetValue(); BankNr = (PatchNr & 0x0000ff00) >> 8; Modified: trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj =================================================================== --- trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj 2011-07-27 14:22:13 UTC (rev 844) +++ trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj 2011-07-28 12:36:39 UTC (rev 845) @@ -542,14 +542,6 @@ > </File> <File - RelativePath="..\src\DeprecatedStringUtils.cpp" - > - </File> - <File - RelativePath="..\src\DeprecatedStringUtils.h" - > - </File> - <File RelativePath="..\src\Dialogs.cpp" > </File> @@ -776,10 +768,26 @@ <File RelativePath="..\src\NamedChoice.cpp" > + <FileConfiguration + Name="Debug GUI VC9|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> </File> <File RelativePath="..\src\NamedChoice.h" > + <FileConfiguration + Name="Debug GUI VC9|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> </File> <File RelativePath="..\src\NamedValue.cpp" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |