From: <pst...@us...> - 2009-05-16 15:06:04
|
Revision: 720 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=720&view=rev Author: pstieber Date: 2009-05-16 15:05:54 +0000 (Sat, 16 May 2009) Log Message: ----------- 1. Added an updated cleanup dialog. 2. Changed the JZPlayer rec_info data member to mpRecordingInfo. 3. Made some cosmetic indentation changes ti the delete dialog header. 4. Removed the use of & in a wxStaticText control in the snap dialog because it is translated into an underscore. 5. Reordered the includes in the snap dialog. 6. Made a cosmetic indentation change in the snap dialog. Modified Paths: -------------- trunk/jazz/src/Dialogs/DeleteDialog.h trunk/jazz/src/Dialogs/SnapDialog.cpp trunk/jazz/src/Dialogs.cpp trunk/jazz/src/Dialogs.h trunk/jazz/src/EventFrame.cpp trunk/jazz/src/EventWindow.cpp trunk/jazz/src/Makefile.am trunk/jazz/src/Player.cpp trunk/jazz/src/Player.h trunk/jazz/src/mswin/WindowsAudioInterface.cpp trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj Added Paths: ----------- trunk/jazz/src/Dialogs/CleanupDialog.cpp trunk/jazz/src/Dialogs/CleanupDialog.h Added: trunk/jazz/src/Dialogs/CleanupDialog.cpp =================================================================== --- trunk/jazz/src/Dialogs/CleanupDialog.cpp (rev 0) +++ trunk/jazz/src/Dialogs/CleanupDialog.cpp 2009-05-16 15:05:54 UTC (rev 720) @@ -0,0 +1,157 @@ +//***************************************************************************** +// The JAZZ++ Midi Sequencer +// +// Copyright (C) 2009 Peter J. Stieber, all rights reserved. +// +// 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 "CleanupDialog.h" + +#include "../Globals.h" +#include "../Help.h" + +#include <wx/button.h> +#include <wx/checkbox.h> +#include <wx/choice.h> +#include <wx/sizer.h> +#include <wx/stattext.h> + +using namespace std; + +//***************************************************************************** +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +BEGIN_EVENT_TABLE(JZCleanupDialog, wxDialog) + + EVT_BUTTON(wxID_HELP, JZCleanupDialog::OnHelp) + +END_EVENT_TABLE() + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZCleanupDialog::JZCleanupDialog( + int& ShortestNote, + bool& ShortenOverlappingNotes, + wxWindow* pParent) + : wxDialog(pParent, wxID_ANY, wxString("Cleanup")), + mShortestNote(ShortestNote), + mShortenOverlappingNotes(ShortenOverlappingNotes), + mpShortestNoteChoice(0), + mpShortenOverlappingNotesCheckBox(0) +{ + mpShortestNoteChoice = new wxChoice(this, wxID_ANY); + for ( + map<int, string>::const_iterator iLimitSteps = gLimitSteps.begin(); + iLimitSteps != gLimitSteps.end(); + ++iLimitSteps) + { + mpShortestNoteChoice->Append(iLimitSteps->second); + } + + mpShortenOverlappingNotesCheckBox = new wxCheckBox( + this, + wxID_ANY, + "Shorten overlapping notes"); + + wxButton* pOkButton = new wxButton(this, wxID_OK, "&OK"); + wxButton* pCancelButton = new wxButton(this, wxID_CANCEL, "Cancel"); + wxButton* pHelpButton = new wxButton(this, wxID_HELP, "Help"); + pOkButton->SetDefault(); + + wxBoxSizer* pTopSizer = new wxBoxSizer(wxVERTICAL); + + pTopSizer->Add( + new wxStaticText(this, wxID_ANY, "Delete notes shorter than:"), + 0, + wxALIGN_CENTER | wxALL, + 5); + + pTopSizer->Add(mpShortestNoteChoice, 0, wxALIGN_CENTER | wxALL, 5); + + pTopSizer->Add( + mpShortenOverlappingNotesCheckBox, + 0, + wxALIGN_CENTER | wxALL, + 10); + + wxBoxSizer* pButtonSizer = new wxBoxSizer(wxHORIZONTAL); + pButtonSizer->Add(pOkButton, 0, wxALL, 5); + pButtonSizer->Add(pCancelButton, 0, wxALL, 5); + pButtonSizer->Add(pHelpButton, 0, wxALL, 5); + + pTopSizer->Add(pButtonSizer, 0, wxALIGN_CENTER | wxBOTTOM, 6); + + SetAutoLayout(true); + SetSizer(pTopSizer); + + pTopSizer->SetSizeHints(this); + pTopSizer->Fit(this); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool JZCleanupDialog::TransferDataToWindow() +{ + int Selection = 0; + for ( + map<int, string>::const_iterator iLimitSteps = gLimitSteps.begin(); + iLimitSteps != gLimitSteps.end(); + ++iLimitSteps, ++Selection) + { + const int& Value = iLimitSteps->first; + if (Value >= mShortestNote) + { + break; + } + } + mpShortestNoteChoice->SetSelection(Selection); + + mpShortenOverlappingNotesCheckBox->SetValue(mShortenOverlappingNotes); + + return true; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool JZCleanupDialog::TransferDataFromWindow() +{ + wxString SelectedValue = mpShortestNoteChoice->GetStringSelection(); + string SelectedString = SelectedValue.c_str(); + for ( + map<int, string>::const_iterator iLimitSteps = gLimitSteps.begin(); + iLimitSteps != gLimitSteps.end(); + ++iLimitSteps) + { + const string& String = iLimitSteps->second; + if (SelectedString == String) + { + mShortestNote = iLimitSteps->first; + break; + } + } + + mShortenOverlappingNotes = mpShortenOverlappingNotesCheckBox->GetValue(); + + return true; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZCleanupDialog::OnHelp(wxCommandEvent& Event) +{ + gpHelpInstance->ShowTopic("Cleanup"); +} Property changes on: trunk/jazz/src/Dialogs/CleanupDialog.cpp ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/jazz/src/Dialogs/CleanupDialog.h =================================================================== --- trunk/jazz/src/Dialogs/CleanupDialog.h (rev 0) +++ trunk/jazz/src/Dialogs/CleanupDialog.h 2009-05-16 15:05:54 UTC (rev 720) @@ -0,0 +1,61 @@ +//***************************************************************************** +// The JAZZ++ Midi Sequencer +// +// Copyright (C) 2009 Peter J. Stieber, all rights reserved. +// +// 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_CLEANUPDIALOG_H +#define JZ_CLEANUPDIALOG_H + +#include <wx/dialog.h> + +class wxChoice; +class wxCheckBox; + +//***************************************************************************** +//***************************************************************************** +class JZCleanupDialog : public wxDialog +{ + public: + + JZCleanupDialog( + int& ShortestNote, + bool& ShortenOverlappingNotes, + wxWindow* pParent); + + private: + + bool TransferDataToWindow(); + + bool TransferDataFromWindow(); + + void OnHelp(wxCommandEvent& Event); + + private: + + int& mShortestNote; + + bool& mShortenOverlappingNotes; + + wxChoice* mpShortestNoteChoice; + + wxCheckBox* mpShortenOverlappingNotesCheckBox; + + DECLARE_EVENT_TABLE(); +}; + +#endif // !defined(JZ_CLEANUPDIALOG_H) Property changes on: trunk/jazz/src/Dialogs/CleanupDialog.h ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/jazz/src/Dialogs/DeleteDialog.h =================================================================== --- trunk/jazz/src/Dialogs/DeleteDialog.h 2009-05-16 04:16:22 UTC (rev 719) +++ trunk/jazz/src/Dialogs/DeleteDialog.h 2009-05-16 15:05:54 UTC (rev 720) @@ -43,9 +43,9 @@ private: - bool& mLeaveSpace; + bool& mLeaveSpace; - wxCheckBox* mpLeaveSpaceCheckBox; + wxCheckBox* mpLeaveSpaceCheckBox; DECLARE_EVENT_TABLE(); }; Modified: trunk/jazz/src/Dialogs/SnapDialog.cpp =================================================================== --- trunk/jazz/src/Dialogs/SnapDialog.cpp 2009-05-16 04:16:22 UTC (rev 719) +++ trunk/jazz/src/Dialogs/SnapDialog.cpp 2009-05-16 15:05:54 UTC (rev 720) @@ -23,8 +23,8 @@ #include "../Globals.h" #include "../Help.h" +#include <wx/button.h> #include <wx/choice.h> -#include <wx/button.h> #include <wx/sizer.h> #include <wx/stattext.h> @@ -64,7 +64,7 @@ wxBoxSizer* pTopSizer = new wxBoxSizer(wxVERTICAL); pTopSizer->Add( - new wxStaticText(this, wxID_ANY, "Quantize Cut & Paste Events"), + new wxStaticText(this, wxID_ANY, "Quantize Cut and Paste Events"), 0, wxALIGN_CENTER | wxALL, 5); @@ -125,7 +125,7 @@ } } - return true; + return true; } //----------------------------------------------------------------------------- Modified: trunk/jazz/src/Dialogs.cpp =================================================================== --- trunk/jazz/src/Dialogs.cpp 2009-05-16 04:16:22 UTC (rev 719) +++ trunk/jazz/src/Dialogs.cpp 2009-05-16 15:05:54 UTC (rev 720) @@ -102,88 +102,7 @@ //} -//***************************************************************************** -// Cleanup -//***************************************************************************** -int tCleanupDlg::lowLimit = 48; -bool tCleanupDlg::shortenOverlaps = 1; - - - -tCleanupDlg::tCleanupDlg(JZEventWindow* w, JZFilter *f) - : tPropertyListDlg( "Clean up events" ) -{ - Filter = f; - Song = f->GetSong(); -} - - - -bool tCleanupDlg::OnClose() -{ - int limit = Song->GetTicksPerQuarter() * 4 / lowLimit; - cout - << "tCleanupDlg::OnClose " << lowLimit << ' ' << shortenOverlaps - << endl; - tCmdCleanup cln(Filter, limit, shortenOverlaps); - cln.Execute(); - - JZProjectManager::Instance()->UpdateAllViews(); - - //wxForm::OnOk(); - return false; -} - -void tCleanupDlg::OnHelp() -{ - gpHelpInstance->ShowTopic("Cleanup"); -} - - -//IMPLEMENT_DYNAMIC_CLASS(tNamedValueListValue, wxPropertyValue) - -void tCleanupDlg::AddProperties() -{ - // JAVE this doesnt work -// sheet->AddProperty(new wxProperty( -// "Delete notes shorther than", -// wxPropertyValue("1/8"), -// "props", -// Steps.GetStringListValidator())); - - // how it ought to work - // gLimitSteps is a name/value pair vector -// sheet->AddProperty(new wxProperty( -// "Delete notes shorther than", -// wxPropertyValue(&lowLimit), -// "props", -// new tNamedValueListValidator(gLimitSteps))); - - // How it really ought to work (except the validator might ask the "value" - // for the list of allowed values). - // http://sourceforge.net/tracker/?group_id=9863&atid=109863 wx bugracker -// tNamedValueListValue val1 = tNamedValueListValue( -// &lowLimit, -// gLimitSteps); - -// wxPropertyValue& val = val1; -// cout << "little test:" << val.GetStringRepresentation() << endl; -// sheet->AddProperty(new wxProperty( -// "Delete shorther than", -// (tNamedValueListValue&)val1, -// "props", -// new tNamedValueListValidator(gLimitSteps))); - - sheet->AddProperty(new wxProperty( - "Shorten overlapping", - wxPropertyValue((bool*)&shortenOverlaps), "bool")); - - // There seems to be a padding limit in - // wxPropertyListView::MakeNameValueString set to 25. -} - - //***************************************************************************** // SearchReplace //***************************************************************************** Modified: trunk/jazz/src/Dialogs.h =================================================================== --- trunk/jazz/src/Dialogs.h 2009-05-16 04:16:22 UTC (rev 719) +++ trunk/jazz/src/Dialogs.h 2009-05-16 15:05:54 UTC (rev 720) @@ -50,23 +50,6 @@ // void OnHelp(); //}; -class tCleanupDlg : public tPropertyListDlg -{ - public: - - static int lowLimit; // 1/32 - static bool shortenOverlaps; - - JZFilter *Filter; - JZSong *Song; - - tCleanupDlg(JZEventWindow* w, JZFilter *f); - void AddProperties(); - //tNamedChoice Steps; - bool OnClose(); - void OnHelp(); -}; - class tSearchReplaceDlg : public tPropertyListDlg { public: Modified: trunk/jazz/src/EventFrame.cpp =================================================================== --- trunk/jazz/src/EventFrame.cpp 2009-05-16 04:16:22 UTC (rev 719) +++ trunk/jazz/src/EventFrame.cpp 2009-05-16 15:05:54 UTC (rev 720) @@ -39,6 +39,9 @@ EVT_UPDATE_UI(ID_SHIFT, JZEventFrame::OnUpdateEventsSelected) EVT_MENU(ID_SHIFT, JZEventFrame::OnShift) + EVT_UPDATE_UI(ID_CLEANUP, JZEventFrame::OnUpdateEventsSelected) + EVT_MENU(ID_CLEANUP, JZEventFrame::OnCleanup) + EVT_UPDATE_UI(ID_QUANTIZE, JZEventFrame::OnUpdateEventsSelected) EVT_MENU(ID_QUANTIZE, JZEventFrame::OnQuantize) Modified: trunk/jazz/src/EventWindow.cpp =================================================================== --- trunk/jazz/src/EventWindow.cpp 2009-05-16 04:16:22 UTC (rev 719) +++ trunk/jazz/src/EventWindow.cpp 2009-05-16 15:05:54 UTC (rev 720) @@ -23,6 +23,7 @@ #include "EventWindow.h" #include "Command.h" +#include "Dialogs/CleanupDialog.h" #include "Dialogs/DeleteDialog.h" #include "Dialogs/LengthDialog.h" #include "Dialogs/MidiChannelDialog.h" @@ -288,8 +289,24 @@ //----------------------------------------------------------------------------- void JZEventWindow::Cleanup() { - tCleanupDlg * dlg = new tCleanupDlg(this, mpFilter); - dlg->Create(); + int ShortestNote = 48; + bool ShortenOverlappingNotes = false; + + JZCleanupDialog CleanupDialog(ShortestNote, ShortenOverlappingNotes, this); + if (CleanupDialog.ShowModal() == wxID_OK) + { + int LengthLimit = + mpFilter->GetSong()->GetTicksPerQuarter() * 4 / ShortestNote; + + tCmdCleanup CleanupCommand( + mpFilter, + LengthLimit, + ShortenOverlappingNotes); + + CleanupCommand.Execute(); + + JZProjectManager::Instance()->UpdateAllViews(); + } } //----------------------------------------------------------------------------- Modified: trunk/jazz/src/Makefile.am =================================================================== --- trunk/jazz/src/Makefile.am 2009-05-16 04:16:22 UTC (rev 719) +++ trunk/jazz/src/Makefile.am 2009-05-16 15:05:54 UTC (rev 720) @@ -22,6 +22,7 @@ DeprecatedWx/prop.cpp \ DeprecatedWx/propform.cpp \ DeprecatedWx/proplist.cpp \ +Dialogs/CleanupDialog.cpp \ Dialogs/DeleteDialog.cpp \ Dialogs/FilterDialog.cpp \ Dialogs/IntegerEdit.cpp \ @@ -107,6 +108,7 @@ DeprecatedWx/prop.cpp \ DeprecatedWx/propform.cpp \ DeprecatedWx/proplist.cpp \ +Dialogs/CleanupDialog.cpp \ Dialogs/DeleteDialog.cpp \ Dialogs/FilterDialog.cpp \ Dialogs/IntegerEdit.cpp \ @@ -197,6 +199,7 @@ DeprecatedWx/propform.h \ DeprecatedWx/proplist.h \ DeprecatedStringUtils.h \ +Dialogs/CleanupDialog.h \ Dialogs/DeleteDialog.h \ Dialogs/FilterDialog.h \ Dialogs/IntegerEdit.h \ Modified: trunk/jazz/src/Player.cpp =================================================================== --- trunk/jazz/src/Player.cpp 2009-05-16 04:16:22 UTC (rev 719) +++ trunk/jazz/src/Player.cpp 2009-05-16 15:05:54 UTC (rev 720) @@ -191,7 +191,7 @@ Playing = false; PlayLoop = new tPlayLoop(); AudioBuffer = 0; - rec_info = 0; + mpRecordingInfo = 0; } //----------------------------------------------------------------------------- Modified: trunk/jazz/src/Player.h =================================================================== --- trunk/jazz/src/Player.h 2009-05-16 04:16:22 UTC (rev 719) +++ trunk/jazz/src/Player.h 2009-05-16 15:05:54 UTC (rev 720) @@ -139,7 +139,7 @@ tPlayLoop* PlayLoop; // timer value for polling the record queue int poll_millisec; - JZRecordingInfo* rec_info; // 0 == not recording + JZRecordingInfo* mpRecordingInfo; // 0 == not recording public: @@ -157,7 +157,7 @@ tEventArray mRecdBuffer; void SetRecordInfo(JZRecordingInfo* inf) { - rec_info = inf; + mpRecordingInfo = inf; } bool IsPlaying() const Modified: trunk/jazz/src/mswin/WindowsAudioInterface.cpp =================================================================== --- trunk/jazz/src/mswin/WindowsAudioInterface.cpp 2009-05-16 04:16:22 UTC (rev 719) +++ trunk/jazz/src/mswin/WindowsAudioInterface.cpp 2009-05-16 15:05:54 UTC (rev 720) @@ -61,7 +61,7 @@ mpPlayer->mpListener = this; // Indicate that we are not recording! - mpPlayer->rec_info = 0; + mpPlayer->mpRecordingInfo = 0; mChannels = mpPlayer->mSamples.GetChannels(); @@ -88,7 +88,7 @@ mpPlayer->mpListener = this; // Indicate that we are not recording! - mpPlayer->rec_info = 0; + mpPlayer->mpRecordingInfo = 0; mChannels = mpPlayer->mSamples.GetChannels(); @@ -633,10 +633,10 @@ mSamples.StopPlay(); if (RecordMode()) { - long frc = rec_info->mFromClock; + long frc = mpRecordingInfo->mFromClock; if (frc < start_clock) frc = start_clock; - long toc = rec_info->mToClock; + long toc = mpRecordingInfo->mToClock; long play_clock = Time2Clock(mpState->play_time); if (toc > play_clock) toc = play_clock; @@ -708,5 +708,5 @@ //----------------------------------------------------------------------------- int JZWindowsAudioPlayer::RecordMode() const { - return rec_info != 0 && rec_info->mpTrack->GetAudioMode(); + return mpRecordingInfo != 0 && mpRecordingInfo->mpTrack->GetAudioMode(); } Modified: trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj =================================================================== --- trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj 2009-05-16 04:16:22 UTC (rev 719) +++ trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj 2009-05-16 15:05:54 UTC (rev 720) @@ -827,6 +827,14 @@ Name="Dialog Source Files" > <File + RelativePath="..\src\Dialogs\CleanupDialog.cpp" + > + </File> + <File + RelativePath="..\src\Dialogs\CleanupDialog.h" + > + </File> + <File RelativePath="..\src\Dialogs\DeleteDialog.cpp" > </File> Modified: trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj =================================================================== --- trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj 2009-05-16 04:16:22 UTC (rev 719) +++ trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj 2009-05-16 15:05:54 UTC (rev 720) @@ -845,6 +845,14 @@ Name="Dialog Source Files" > <File + RelativePath="..\src\Dialogs\CleanupDialog.cpp" + > + </File> + <File + RelativePath="..\src\Dialogs\CleanupDialog.h" + > + </File> + <File RelativePath="..\src\Dialogs\DeleteDialog.cpp" > </File> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |