From: <pst...@us...> - 2009-01-20 04:14:10
|
Revision: 692 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=692&view=rev Author: pstieber Date: 2009-01-20 04:14:04 +0000 (Tue, 20 Jan 2009) Log Message: ----------- 1. Put the proper controls in the new shift dialog. 2. Made the event frame usable by derived classes and started leaning up this class. Most of the stuff that is in it should be in the event window class, but the old dialogs still rely on the code being there. 3. Added event shift handling to the event window. 4. Changed or removed comments in the piano window header. 5. Changed tSynthSysex::Reset() to tSynthSysex::CreateResetEvent(). 6. Attempted to prevent leaks in the player code when reset is sent. 7. Cleared all of the tracks in JZSong::Clear. 8. Changed e to pEvent in the track code and changed Reset to mpReset. 9. Deleted mpReset in JZTrack::Clear. 10. Fixed a leak in the track code by using a local instance of tJazzMeta. 11. Derived JZTrackFrame form JZEventFrame and let the base class deal with shift event handling. Modified Paths: -------------- trunk/jazz/src/Dialogs/ShiftDialog.cpp trunk/jazz/src/Dialogs/ShiftDialog.h trunk/jazz/src/EventFrame.cpp trunk/jazz/src/EventFrame.h trunk/jazz/src/EventWindow.cpp trunk/jazz/src/PianoWindow.h trunk/jazz/src/Player.cpp trunk/jazz/src/Song.cpp trunk/jazz/src/Synth.h trunk/jazz/src/Track.cpp trunk/jazz/src/Track.h trunk/jazz/src/TrackFrame.cpp trunk/jazz/src/TrackFrame.h Modified: trunk/jazz/src/Dialogs/ShiftDialog.cpp =================================================================== --- trunk/jazz/src/Dialogs/ShiftDialog.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Dialogs/ShiftDialog.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -23,16 +23,13 @@ #include "../Command.h" #include "../Filter.h" #include "../ProjectManager.h" -#include "IntegerEdit.h" #include <wx/button.h> -#include <wx/checkbox.h> -#include <wx/msgdlg.h> #include <wx/sizer.h> +#include <wx/slider.h> #include <wx/stattext.h> -#include <wx/textctrl.h> -#include <string> +#include <sstream> using namespace std; @@ -51,92 +48,25 @@ JZShiftDialog::JZShiftDialog( JZEventWindow& EventWindow, JZFilter& Filter, + int Unit, + int& Shift, wxWindow* pParent) : wxDialog(pParent, wxID_ANY, wxString("Shift")), mFilter(Filter), - mpFromTimeEdit(0), - mpToTimeEdit(0), - mpFromTrackEdit(0), - mpToTrackEdit(0), - mpNoteCheckBox(0), - mpNoteMinEdit(0), - mpNoteMaxEdit(0), - mpPolyAftertouchCheckBox(0), - mpPolyAftertouchMinEdit(0), - mpPolyAftertouchMaxEdit(0), - mpControllerCheckBox(0), - mpControllerMinEdit(0), - mpControllerMaxEdit(0), - mpPatchCheckBox(0), - mpPatchMinEdit(0), - mpPatchMaxEdit(0), - mpPitchCheckBox(0), - mpPitchMinEdit(0), - mpPitchMaxEdit(0), - mpMeterCheckBox(0), - mpChannelAftertouchCheckBox(0), - mpSysExCheckBox(0), - mpOtherBox(0) + mUnit(Unit), + mShift(Shift), + mpStepsSlider(0) { - mpFromTimeEdit = new wxTextCtrl(this, wxID_ANY); - mpToTimeEdit = new wxTextCtrl(this, wxID_ANY); + mpStepsSlider = new wxSlider( + this, + wxID_ANY, + mShift, + -16, + 16, + wxDefaultPosition, + wxDefaultSize, + wxSL_LABELS | wxSL_BOTTOM); - mpFromTrackEdit = new JZIntegerEdit(this, wxID_ANY); - mpFromTrackEdit->SetValueName("FromTrack"); - mpFromTrackEdit->SetMinAndMax(1, 127); - mpToTrackEdit = new JZIntegerEdit(this, wxID_ANY); - mpToTrackEdit->SetValueName("To Track"); - mpToTrackEdit->SetMinAndMax(1, 127); - - mpNoteCheckBox = new wxCheckBox(this, wxID_ANY, "Note"); - mpNoteMinEdit = new JZIntegerEdit(this, wxID_ANY); - mpNoteMinEdit->SetValueName("Note Minimum"); - mpNoteMinEdit->SetMinAndMax(0, 127); - mpNoteMaxEdit = new JZIntegerEdit(this, wxID_ANY); - mpNoteMaxEdit->SetValueName("Note Maximum"); - mpNoteMaxEdit->SetMinAndMax(0, 127); - - mpPolyAftertouchCheckBox = new wxCheckBox(this, wxID_ANY, "Poly Aftertouch"); - mpPolyAftertouchMinEdit = new JZIntegerEdit(this, wxID_ANY); - mpPolyAftertouchMinEdit->SetValueName("Poly Aftertouch Minimum"); - mpPolyAftertouchMinEdit->SetMinAndMax(0, 127); - mpPolyAftertouchMaxEdit = new JZIntegerEdit(this, wxID_ANY); - mpPolyAftertouchMaxEdit->SetValueName("Poly Aftertouch Maximum"); - mpPolyAftertouchMaxEdit->SetMinAndMax(0, 127); - - mpControllerCheckBox = new wxCheckBox(this, wxID_ANY, "Controller"); - mpControllerMinEdit = new JZIntegerEdit(this, wxID_ANY); - mpControllerMinEdit->SetValueName("Controller Minimum"); - mpControllerMinEdit->SetMinAndMax(0, 127); - mpControllerMaxEdit = new JZIntegerEdit(this, wxID_ANY); - mpControllerMaxEdit->SetValueName("Controller Maximum"); - mpControllerMaxEdit->SetMinAndMax(0, 127); - - mpPatchCheckBox = new wxCheckBox(this, wxID_ANY, "Patch"); - mpPatchMinEdit = new JZIntegerEdit(this, wxID_ANY); - mpPatchMinEdit->SetValueName("Patch Minimum"); - mpPatchMinEdit->SetMinAndMax(0, 127); - mpPatchMaxEdit = new JZIntegerEdit(this, wxID_ANY); - mpPatchMaxEdit->SetValueName("Patch Maximum"); - mpPatchMaxEdit->SetMinAndMax(0, 127); - - mpPitchCheckBox = new wxCheckBox(this, wxID_ANY, "Pitch"); - mpPitchMinEdit = new JZIntegerEdit(this, wxID_ANY); - mpPitchMinEdit->SetValueName("Pitch Minimum"); - mpPitchMinEdit->SetMinAndMax(-8192, 8192); - mpPitchMaxEdit = new JZIntegerEdit(this, wxID_ANY); - mpPitchMaxEdit->SetValueName("Pitch Maximum"); - mpPitchMaxEdit->SetMinAndMax(-8192, 8192); - - mpMeterCheckBox = new wxCheckBox(this, wxID_ANY, "Meter"); - - mpChannelAftertouchCheckBox = - new wxCheckBox(this, wxID_ANY, "Channel Aftertouch"); - - mpSysExCheckBox = new wxCheckBox(this, wxID_ANY, "SysEx"); - - mpOtherBox = new wxCheckBox(this, wxID_ANY, "Other"); - wxButton* pOkButton = new wxButton(this, wxID_OK, "&OK"); wxButton* pCancelButton = new wxButton(this, wxID_CANCEL, "Cancel"); wxButton* pHelpButton = new wxButton(this, wxID_HELP, "Help"); @@ -144,167 +74,23 @@ wxBoxSizer* pTopSizer = new wxBoxSizer(wxVERTICAL); - wxFlexGridSizer* pFlexGridSizer; - - pFlexGridSizer = new wxFlexGridSizer(2, 4, 4, 2); - - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "From Time:"), + pTopSizer->Add( + new wxStaticText(this, wxID_ANY, "Shift events left or right"), 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpFromTimeEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "To Time:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpToTimeEdit, - 0, - wxALIGN_CENTER_VERTICAL); + wxCENTER | wxALL, + 5); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "From Track:"), + ostringstream Oss; + Oss << "Snap is currently " << mUnit << " clocks"; + pTopSizer->Add( + new wxStaticText(this, wxID_ANY, Oss.str().c_str()), 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpFromTrackEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "To Track:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpToTrackEdit, - 0, - wxALIGN_CENTER_VERTICAL); - - pTopSizer->Add(pFlexGridSizer, 0, wxCENTER | wxALL, 10); - - pFlexGridSizer = new wxFlexGridSizer(5, 5, 4, 2); - - pFlexGridSizer->Add( - mpNoteCheckBox, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Min:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpNoteMinEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Max:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpNoteMaxEdit, - 0, - wxALIGN_CENTER_VERTICAL); - - pFlexGridSizer->Add( - mpPolyAftertouchCheckBox, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Min:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpPolyAftertouchMinEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Max:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpPolyAftertouchMaxEdit, - 0, - wxALIGN_CENTER_VERTICAL); - - pFlexGridSizer->Add( - mpControllerCheckBox, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Min:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpControllerMinEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Max:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpControllerMaxEdit, - 0, - wxALIGN_CENTER_VERTICAL); - - pFlexGridSizer->Add( - mpPatchCheckBox, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Min:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpPatchMinEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Max:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpPatchMaxEdit, - 0, - wxALIGN_CENTER_VERTICAL); - - pFlexGridSizer->Add( - mpPitchCheckBox, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Min:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpPitchMinEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Max:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpPitchMaxEdit, - 0, - wxALIGN_CENTER_VERTICAL); - - pTopSizer->Add(pFlexGridSizer, 0, wxCENTER | wxALL, 10); - + wxCENTER | wxALL, + 5); wxBoxSizer* pCheckBoxSizer = new wxBoxSizer(wxHORIZONTAL); - pCheckBoxSizer->Add(mpMeterCheckBox, 0, wxALL, 5); + pTopSizer->Add(mpStepsSlider, 0, wxCENTER | wxALL, 5); - pCheckBoxSizer->Add(mpChannelAftertouchCheckBox, 0, wxALL, 5); - - pCheckBoxSizer->Add(mpSysExCheckBox, 0, wxALL, 5); - - pCheckBoxSizer->Add(mpOtherBox, 0, wxALL, 5); - - pTopSizer->Add(pCheckBoxSizer, 0, wxCENTER | wxALL, 5); - wxBoxSizer* pButtonSizer = new wxBoxSizer(wxHORIZONTAL); pButtonSizer->Add(pOkButton, 0, wxALL, 5); pButtonSizer->Add(pCancelButton, 0, wxALL, 5); @@ -323,53 +109,6 @@ //----------------------------------------------------------------------------- bool JZShiftDialog::TransferDataToWindow() { - string TimeString; - - mFilter.GenerateFromTimeString(TimeString); - mpFromTimeEdit->ChangeValue(TimeString); - - mFilter.GenerateToTimeString(TimeString); - mpToTimeEdit->ChangeValue(TimeString); - - mpFromTrackEdit->SetNumber(mFilter.GetFromTrack()); - mpToTrackEdit->SetNumber(mFilter.GetToTrack()); - - bool Selected; - int FromValue, ToValue; - - mFilter.GetFilterEvent(eFilterKeyOn, Selected, FromValue, ToValue); - mpNoteCheckBox->SetValue(Selected); - mpNoteMinEdit->SetNumber(FromValue); - mpNoteMaxEdit->SetNumber(ToValue); - - mFilter.GetFilterEvent(eFilterKeyPressure, Selected, FromValue, ToValue); - mpPolyAftertouchCheckBox->SetValue(Selected); - mpPolyAftertouchMinEdit->SetNumber(FromValue); - mpPolyAftertouchMaxEdit->SetNumber(ToValue); - - mFilter.GetFilterEvent(eFilterControl, Selected, FromValue, ToValue); - mpControllerCheckBox->SetValue(Selected); - mpControllerMinEdit->SetNumber(FromValue); - mpControllerMaxEdit->SetNumber(ToValue); - - mFilter.GetFilterEvent(eFilterProgram, Selected, FromValue, ToValue); - mpPatchCheckBox->SetValue(Selected); - mpPatchMinEdit->SetNumber(FromValue); - mpPatchMaxEdit->SetNumber(ToValue); - - mFilter.GetFilterEvent(eFilterPitch, Selected, FromValue, ToValue); - mpPitchCheckBox->SetValue(Selected); - mpPitchMinEdit->SetNumber(FromValue); - mpPitchMaxEdit->SetNumber(ToValue); - - mpMeterCheckBox->SetValue(mFilter.GetFilterMeter()); - - mpChannelAftertouchCheckBox->SetValue(mFilter.GetFilterChannelAftertouch()); - - mpSysExCheckBox->SetValue(mFilter.GetFilterSysEx()); - - mpOtherBox->SetValue(mFilter.GetFilterOther()); - return true; } @@ -377,171 +116,14 @@ //----------------------------------------------------------------------------- bool JZShiftDialog::TransferDataFromWindow() { - int FromTrack, ToTrack; - int NoteMin, NoteMax; - int PolyAftertouchMin, PolyAftertouchMax; - int ControllerMin, ControllerMax; - int PatchMin, PatchMax; - int PitchMin, PitchMax; + mShift = mpStepsSlider->GetValue(); - if ( - mpFromTrackEdit->GetNumber(FromTrack) && - mpToTrackEdit->GetNumber(ToTrack) && - mpNoteMinEdit->GetNumber(NoteMin) && - mpNoteMaxEdit->GetNumber(NoteMax) && - mpPolyAftertouchMinEdit->GetNumber(PolyAftertouchMin) && - mpPolyAftertouchMaxEdit->GetNumber(PolyAftertouchMax) && - mpControllerMinEdit->GetNumber(ControllerMin) && - mpControllerMaxEdit->GetNumber(ControllerMax) && - mpPatchMinEdit->GetNumber(PatchMin) && - mpPatchMaxEdit->GetNumber(PatchMax) && - mpPitchMinEdit->GetNumber(PitchMin) && - mpPitchMaxEdit->GetNumber(PitchMax)) - { - if (FromTrack > ToTrack) - { - ::wxMessageBox( - "The From Track must be less than or equal to the To Track", - "Invalid Track Values", - wxOK | wxICON_EXCLAMATION, - this); - - mpFromTrackEdit->SetFocus(); - - return false; - } - - if (NoteMin > NoteMax) - { - ::wxMessageBox( - "The Minimum Note must be less than or equal to the Maximum Note", - "Invalid Note Values", - wxOK | wxICON_EXCLAMATION, - this); - - mpNoteMinEdit->SetFocus(); - - return false; - } - - if (PolyAftertouchMin > PolyAftertouchMax) - { - ::wxMessageBox( - "The Minimum Poly Aftertouch must be less than or equal to the Maximum" - " Poly Aftertouch", - "Invalid Poly Aftertouch Values", - wxOK | wxICON_EXCLAMATION, - this); - - mpPolyAftertouchMinEdit->SetFocus(); - - return false; - } - - if (ControllerMin > ControllerMax) - { - ::wxMessageBox( - "The Minimum Controller must be less than or equal to the Maximum" - " Controller", - "Invalid Controller Values", - wxOK | wxICON_EXCLAMATION, - this); - - mpControllerMinEdit->SetFocus(); - - return false; - } - - if (PatchMin > PatchMax) - { - ::wxMessageBox( - "The Minimum Patch must be less than or equal to the Maximum Patch", - "Invalid Patch Values", - wxOK | wxICON_EXCLAMATION, - this); - - mpPatchMinEdit->SetFocus(); - - return false; - } - - if (PitchMin > PitchMax) - { - ::wxMessageBox( - "The Minimum Pitch must be less than or equal to the Maximum Pitch", - "Invalid Pitch Values", - wxOK | wxICON_EXCLAMATION, - this); - - mpPitchMinEdit->SetFocus(); - - return false; - } - - string TimeString; - - TimeString = mpFromTimeEdit->GetValue(); - mFilter.SetFromTime(TimeString); - - TimeString = mpToTimeEdit->GetValue(); - mFilter.SetToTime(TimeString); - - mFilter.SetFromTrack(FromTrack); - mFilter.SetToTrack(ToTrack); - - mFilter.SetFilterEvent( - eFilterKeyOn, - mpNoteCheckBox->GetValue(), - NoteMin, - NoteMax); - - mFilter.SetFilterEvent( - eFilterKeyPressure, - mpPolyAftertouchCheckBox->GetValue(), - PolyAftertouchMin, - PolyAftertouchMax); - - mFilter.SetFilterEvent( - eFilterControl, - mpControllerCheckBox->GetValue(), - ControllerMin, - ControllerMax); - - mFilter.SetFilterEvent( - eFilterProgram, - mpPatchCheckBox->GetValue(), - PatchMin, - PatchMax); - - mFilter.SetFilterEvent( - eFilterPitch, - mpPitchCheckBox->GetValue(), - PitchMin, - PitchMax); - - mFilter.SetFilterMeter(mpMeterCheckBox->GetValue()); - - mFilter.SetFilterChannelAftertouch( - mpChannelAftertouchCheckBox->GetValue()); - - mFilter.SetFilterSysEx(mpSysExCheckBox->GetValue()); - - mFilter.SetFilterOther(mpOtherBox->GetValue()); - -// tCmdShift ShiftCommand(&mFilter, mSteps * mUnit); -// ShiftCommand.Execute(); - - JZProjectManager::Instance()->UpdateAllViews(); - - return true; - } - - return false; + return true; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void JZShiftDialog::OnHelp(wxCommandEvent& Event) { -// gpHelpInstance->ShowTopic("Filter Dialog"); +// gpHelpInstance->ShowTopic("Shift Dialog"); } Modified: trunk/jazz/src/Dialogs/ShiftDialog.h =================================================================== --- trunk/jazz/src/Dialogs/ShiftDialog.h 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Dialogs/ShiftDialog.h 2009-01-20 04:14:04 UTC (rev 692) @@ -28,6 +28,7 @@ class JZIntegerEdit; class wxCheckBox; class wxTextCtrl; +class wxSlider; //***************************************************************************** //***************************************************************************** @@ -38,6 +39,8 @@ JZShiftDialog( JZEventWindow& EventWindow, JZFilter& Filter, + int Unit, + int& Shift, wxWindow* pParent); private: @@ -51,41 +54,11 @@ private: JZFilter& mFilter; + int mUnit; + int& mShift; - wxTextCtrl* mpFromTimeEdit; - wxTextCtrl* mpToTimeEdit; + wxSlider* mpStepsSlider; - JZIntegerEdit* mpFromTrackEdit; - JZIntegerEdit* mpToTrackEdit; - - wxCheckBox* mpNoteCheckBox; - JZIntegerEdit* mpNoteMinEdit; - JZIntegerEdit* mpNoteMaxEdit; - - wxCheckBox* mpPolyAftertouchCheckBox; - JZIntegerEdit* mpPolyAftertouchMinEdit; - JZIntegerEdit* mpPolyAftertouchMaxEdit; - - wxCheckBox* mpControllerCheckBox; - JZIntegerEdit* mpControllerMinEdit; - JZIntegerEdit* mpControllerMaxEdit; - - wxCheckBox* mpPatchCheckBox; - JZIntegerEdit* mpPatchMinEdit; - JZIntegerEdit* mpPatchMaxEdit; - - wxCheckBox* mpPitchCheckBox; - JZIntegerEdit* mpPitchMinEdit; - JZIntegerEdit* mpPitchMaxEdit; - - wxCheckBox* mpMeterCheckBox; - - wxCheckBox* mpChannelAftertouchCheckBox; - - wxCheckBox* mpSysExCheckBox; - - wxCheckBox* mpOtherBox; - DECLARE_EVENT_TABLE(); }; Modified: trunk/jazz/src/EventFrame.cpp =================================================================== --- trunk/jazz/src/EventFrame.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/EventFrame.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -26,23 +26,20 @@ EVT_UPDATE_UI(ID_SHIFT, JZEventFrame::OnUpdateEditShift) EVT_MENU(ID_SHIFT, JZEventFrame::OnEditShift) - EVT_SIZE(JZEventFrame::OnSize) - END_EVENT_TABLE() //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- JZEventFrame::JZEventFrame( - JZEventWindow* pEventWindow, + wxWindow* pParent, const wxString& Title, JZSong* pSong, const wxPoint& Position, - const wxSize& Size) - : wxFrame(pEventWindow, wxID_ANY, Title, Position, Size), + const wxSize& Size, + long WindowStyle) + : wxFrame(pParent, wxID_ANY, Title, Position, Size, WindowStyle), Song(pSong), mpFilter(0), - mpFixedFont(0), - hFixedFont(0), mTrackHeight(0), mTopInfoHeight(40), FontSize(12), @@ -67,7 +64,7 @@ mpToolBar(0), mpGreyColor(0), mpGreyBrush(0), - mpEventWindow(pEventWindow) + mpEventWindow(0) { #ifdef __WXMSW__ mpGreyColor = new wxColor(192, 192, 192); @@ -88,8 +85,6 @@ delete mpFilter; - delete mpFixedFont; - delete mpToolBar; if (MixerForm) @@ -99,127 +94,40 @@ } //----------------------------------------------------------------------------- +// Description: +// Register the event window with the frame. //----------------------------------------------------------------------------- -void JZEventFrame::CreateMenu() +void JZEventFrame::SetEventWindow(JZEventWindow* pEventWindow) { + mpEventWindow = pEventWindow; } - //----------------------------------------------------------------------------- -// create the canvas component(used for differently dependingon the subclass) -// size it to the client area of the frame(frame size minus toolbar and menus ) //----------------------------------------------------------------------------- -//void JZEventFrame::CreateCanvas() -//{ -// cout << "CreateCanvas" << endl; -// int Width, Height; -// GetClientSize(&Width, &Height); -// mpEventWindow = new JZEventWindow(this, 0, 0, Width, Height); -//} - -/** -second phase of creation. make menus, the canvas, and so on -*/ -void JZEventFrame::Create() -{ - CreateMenu(); - - Setup(); -} - -//----------------------------------------------------------------------------- -// Initialize the constants used in drawing. -//----------------------------------------------------------------------------- -void JZEventFrame::Setup() -{ -/* - int x, y; - - wxClientDC Dc(mpEventWindow); - Dc.SetFont(wxNullFont); - delete mpFixedFont; - mpFixedFont = new wxFont(12, wxSWISS, wxNORMAL, wxNORMAL); - Dc.SetFont(*mpFixedFont); - Dc.GetTextExtent("M", &x, &y); - hFixedFont = (int)y; - - delete mpFont; - mpFont = new wxFont(FontSize, wxSWISS, wxNORMAL, wxNORMAL); - Dc.SetFont(*mpFont); - - Dc.GetTextExtent("M", &x, &y); - mLittleBit = (int)(x/2); - - Dc.GetTextExtent("HXWjgi", &x, &y); - mTrackHeight = (int)y + mLittleBit; -*/ -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- void JZEventFrame::OnUpdateEditShift(wxUpdateUIEvent& Event) { - Event.Enable(mpEventWindow->AreEventsSelected()); + if (mpEventWindow) + { + Event.Enable(mpEventWindow->AreEventsSelected()); + } + else + { + Event.Enable(false); + } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void JZEventFrame::OnEditShift(wxCommandEvent& Event) { -// mpEventWindow->Shift(); + if (mpEventWindow) + { + mpEventWindow->Shift(16); + } } //----------------------------------------------------------------------------- -// this onsize handler is supposed to take care of handling of the resizing -// the two subwindows sizes to they dont overlap //----------------------------------------------------------------------------- -void JZEventFrame::OnSize(wxSizeEvent& Event) -{ -// wxFrame::OnSize(Event); - - // The code below is from the toolbar sample, the layoutchidlren function - wxSize size = GetClientSize(); - - int offset; -// if (mpToolBar) -// { -// mpToolBar->SetSize(-1, size.y); -// mpToolBar->Move(0, 0); -// -// offset = mpToolBar->GetSize().x; -// } -// else -// { -// offset = 0; -// } - - // The step below should set the offset of the mpEventWindow - // m_textWindow->SetSize(offset, 0, size.x - offset, size.y); - -// float maxToolBarWidth = 0.0; -// float maxToolBarHeight = 0.0; -// if (mpToolBar) -// { -// mpToolBar->GetMaxSize(&maxToolBarWidth, &maxToolBarHeight); -// } - - offset = mpToolBar->GetSize().y; //get the height of the toolbar - - int frameWidth, frameHeight; - GetClientSize(&frameWidth, &frameHeight); - -// if (mpEventWindow) -// // mpEventWindow->SetSize(0, (int)offset, (int)frameWidth, (int)(frameHeight - offset)); -// mpEventWindow->SetSize(0, (int)0, (int)frameWidth, (int)(frameHeight)); -// // if (mpToolBar) -// // mpToolBar->SetSize(0, 0, (int)frameWidth, (int)maxToolBarHeight); - - cout - << "JZEventFrame::OnSize " << frameWidth<< 'x' << frameHeight << endl; -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- bool JZEventFrame::OnCharHook(wxKeyEvent& e) { return OnKeyEvent(e); @@ -227,20 +135,6 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZEventFrame::y2yLine(int y, int up) -{ - if (up) - { - y += mTrackHeight; - } - y -= mTopInfoHeight; - y -= y % mTrackHeight; - y += mTopInfoHeight; - return y; -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- int JZEventFrame::y2Line(int y, int up) { if (up) @@ -318,10 +212,14 @@ // wxPaintEvent e; // cout<<"FIXME JZEventFrame::Redraw"<<endl; // mpEventWindow->OnDraw(*dc); //this will in turn call the eventwin onpaintsub -// //the problem is that onpaint no longer tkes no argument, and is supposed to be called from the framework only, so it should be split +// // the problem is that onpaint no longer takes arguments, and is supposed +// // to be called from the framework only, so it should be split. // delete dc; -// mpEventWindow->Refresh(); +// if (mpEventWindow) +// { +// mpEventWindow->Refresh(); +// } } //----------------------------------------------------------------------------- Modified: trunk/jazz/src/EventFrame.h =================================================================== --- trunk/jazz/src/EventFrame.h 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/EventFrame.h 2009-01-20 04:14:04 UTC (rev 692) @@ -48,11 +48,12 @@ // 2-step initialization: 1) constructor JZEventFrame( - JZEventWindow* pEventWindow, + wxWindow* pParent, const wxString& Title, JZSong* pSong, const wxPoint& Position = wxDefaultPosition, - const wxSize& Size = wxDefaultSize); + const wxSize& Size = wxDefaultSize, + long WindowStyle = wxDEFAULT_FRAME_STYLE); virtual ~JZEventFrame(); @@ -60,25 +61,14 @@ JZFilter* mpFilter; - // 2) Create(): - virtual void Create(); - virtual void CreateMenu(); - void CreateCanvas(); -// JZEventWindow* mpEventWindow; + virtual void SetEventWindow(JZEventWindow* pEventWindow); - // Setup() - wxFont* mpFixedFont; // remains with 12pt - int hFixedFont; // Height of letters - int mTrackHeight; int mTopInfoHeight; int FontSize; int ClocksPerPixel; - // Parameters changed, e.g. Song loaded - virtual void Setup(); - int mEventsX, mEventsY, mEventsWidth, mEventsHeight; int CanvasX, CanvasY, CanvasW, CanvasH; // canvas coords int FromClock, ToClock; @@ -92,9 +82,7 @@ // methods int y2Line(int y, int up = 0); - int y2yLine(int y, int up = 0); int Line2y(int line); -// void LineText(wxDC *dc, int x, int y, int w, const char *str, int h = -1, bool down = false); int PlayClock; @@ -124,8 +112,6 @@ void OnUpdateEditShift(wxUpdateUIEvent& Event); void OnEditShift(wxCommandEvent& Event); - void OnSize(wxSizeEvent& Event); - bool OnCharHook(wxKeyEvent& Event); void OnChar(wxKeyEvent& Event); Modified: trunk/jazz/src/EventWindow.cpp =================================================================== --- trunk/jazz/src/EventWindow.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/EventWindow.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -22,12 +22,14 @@ #include "EventWindow.h" +#include "Command.h" #include "Dialogs/ShiftDialog.h" #include "EventFrame.h" #include "Filter.h" #include "MouseAction.h" #include "Song.h" #include "Help.h" +#include "ProjectManager.h" #include "PropertyListDialog.h" #include <wx/dc.h> @@ -130,10 +132,16 @@ { if (AreEventsSelected()) { - JZShiftDialog ShiftDialog(*this, *mpFilter, this); + int Unit = 30; + int Shift = 0; + JZShiftDialog ShiftDialog(*this, *mpFilter, Units, Shift, this); - if (ShiftDialog.ShowModal() == wxID_OK) + if (ShiftDialog.ShowModal() == wxID_OK && Shift != 0) { + tCmdShift ShiftCommand(mpFilter, Shift * Unit); + ShiftCommand.Execute(); + + JZProjectManager::Instance()->UpdateAllViews(); } } } Modified: trunk/jazz/src/PianoWindow.h =================================================================== --- trunk/jazz/src/PianoWindow.h 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/PianoWindow.h 2009-01-20 04:14:04 UTC (rev 692) @@ -294,7 +294,7 @@ void Draw(wxDC& Dc); - // Overridden tButtonLabelInterface finction. + // Overridden tButtonLabelInterface function. void ButtonLabelDisplay(const wxString& Text, bool IsButtonDown); private: @@ -326,9 +326,8 @@ int mFontSize; wxFont* mpFont; - // remains with 12pt/ bleibt bei 12pt wxFont* mpFixedFont; - int mFixedFontHeight; //Height letters/ Hoehe eines Buchstaben + int mFixedFontHeight; wxFont* mpDrumFont; Modified: trunk/jazz/src/Player.cpp =================================================================== --- trunk/jazz/src/Player.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Player.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -245,7 +245,9 @@ { // fixme: we should have different synths for each device t = Song->GetTrack(0); - OutNow(t, gpSynth->Reset()); + JZEvent* mpResetEvent = gpSynth->CreateResetEvent(); + OutNow(t, mpResetEvent); + delete mpResetEvent; } // Send Volume, Pan, Chorus, etc @@ -640,7 +642,9 @@ if (Reset) { - OutNow(gpSynth->Reset()); + JZEvent* mpResetEvent = gpSynth->CreateResetEvent(); + OutNow(mpResetEvent); + delete mpResetEvent; } } Modified: trunk/jazz/src/Song.cpp =================================================================== --- trunk/jazz/src/Song.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Song.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -154,7 +154,7 @@ //----------------------------------------------------------------------------- void JZSong::Clear() { - for (int i = 0; i < mTrackCount; i++) + for (int i = 0; i < eMaxTrackCount; ++i) { mTracks[i].Clear(); } @@ -210,9 +210,10 @@ void JZSong::Write(JZWriteBase& Io, const char* pFileName) { // Make sure track 0 has a synth reset - if (!mTracks[0].Reset) + if (!mTracks[0].mpReset) { - mTracks[0].Reset = gpSynth->Reset()->IsSysEx(); + JZEvent* pEvent = gpSynth->CreateResetEvent(); + mTracks[0].mpReset = dynamic_cast<tSysEx*>(pEvent); } int n = NumUsedTracks(); Modified: trunk/jazz/src/Synth.h =================================================================== --- trunk/jazz/src/Synth.h 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Synth.h 2009-01-20 04:14:04 UTC (rev 692) @@ -325,7 +325,7 @@ Sysex.FixCheckSum( s ); } - virtual JZEvent* Reset() = 0; + virtual JZEvent* CreateResetEvent() = 0; virtual JZEvent* MasterVolSX( long clk, unsigned char vol ) { @@ -375,7 +375,7 @@ return this; } - virtual JZEvent* Reset() + virtual JZEvent* CreateResetEvent() { return Sysex(0, SX_GM_ON); } @@ -389,7 +389,7 @@ return this; } - JZEvent* Reset() + virtual JZEvent* CreateResetEvent() { return Sysex(0, SX_GS_ON); } @@ -420,7 +420,7 @@ return this; } - JZEvent* Reset() + virtual JZEvent* CreateResetEvent() { return Sysex(0, SX_XG_ON); } Modified: trunk/jazz/src/Track.cpp =================================================================== --- trunk/jazz/src/Track.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Track.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -523,9 +523,9 @@ nEvents = newnEvents; } -void tSimpleEventArray::Put(JZEvent* e) +void tSimpleEventArray::Put(JZEvent* pEvent) { - if (e->IsEndOfTrack()) + if (pEvent->IsEndOfTrack()) { // Remove the old EOT if we are adding a new one. RemoveEOT(); @@ -534,7 +534,7 @@ { Resize(); } - Events[nEvents++] = e; + Events[nEvents++] = pEvent; #ifdef E_DBUG { @@ -567,11 +567,11 @@ void tSimpleEventArray::Copy(tSimpleEventArray& src, int frclk, int toclk) { tEventIterator iter(&src); - JZEvent* e = iter.Range(frclk, toclk); - while (e) + JZEvent* pEvent = iter.Range(frclk, toclk); + while (pEvent) { - Put(e->Copy()); - e = iter.Next(); + Put(pEvent->Copy()); + pEvent = iter.Next(); } } @@ -588,7 +588,7 @@ Chorus(0), mpBank(0), mpBank2(0), - Reset(0) + mpReset(0) { nEvents = 0; @@ -632,7 +632,9 @@ delete mpBank2; mpBank2 = 0; - Reset = 0; + delete mpReset; + mpReset = 0; + Speed = 0; Channel = 1; Device = 0; @@ -741,7 +743,7 @@ void tEventArray::Cleanup(bool dont_delete_killed_events) { - JZEvent *e; + JZEvent* pEvent; tControl* pControl; tSysEx *s; int i; @@ -820,7 +822,7 @@ for (i = 0; i < nEvents; i++) { - if ((e = Events[i])->IsKilled()) + if ((pEvent = Events[i])->IsKilled()) { if (!dont_delete_killed_events) { @@ -834,29 +836,29 @@ } // accept only events having clock == 0 as track defaults - if (e->GetClock() != 0) + if (pEvent->GetClock() != 0) { continue; } if (!mpName) { - mpName = e->IsTrackName(); + mpName = pEvent->IsTrackName(); } if (!Copyright) { - Copyright = e->IsCopyright(); + Copyright = pEvent->IsCopyright(); } if (!Speed) { - Speed = e->IsSetTempo(); + Speed = pEvent->IsSetTempo(); } if (!MtcOffset) { - MtcOffset = e->IsMtcOffset(); + MtcOffset = pEvent->IsMtcOffset(); } - if ((pControl = e->IsControl()) != 0) + if ((pControl = pEvent->IsControl()) != 0) { switch (pControl->GetControl()) { @@ -886,13 +888,13 @@ break; } } - if ((s = e->IsSysEx()) != 0) + if ((s = pEvent->IsSysEx()) != 0) { - int sxid = gpSynth->GetSysexId(s); + int SysExId = gpSynth->GetSysexId(s); if (!gpSynth->IsGS()) { - switch (sxid) + switch (SysExId) { case SX_GM_MasterVol: // GS has its own; SC-55 doesn't recognize GM Mastervol @@ -905,7 +907,7 @@ if (gpSynth->IsGS()) { - switch (sxid) + switch (SysExId) { case SX_GS_MasterVol: MasterVol = s; @@ -924,7 +926,7 @@ case SX_GS_BendLfo2Pitch: case SX_GS_BendLfo2Tvf: case SX_GS_BendLfo2Tva: - BenderSettings[sxid - SX_GS_BendPitch] = s; + BenderSettings[SysExId - SX_GS_BendPitch] = s; break; case SX_GS_ModPitch: @@ -938,7 +940,7 @@ case SX_GS_ModLfo2Pitch: case SX_GS_ModLfo2Tvf: case SX_GS_ModLfo2Tva: - ModulationSettings[sxid - SX_GS_ModPitch] = s; + ModulationSettings[SysExId - SX_GS_ModPitch] = s; break; case SX_GS_CafPitch: @@ -952,7 +954,7 @@ case SX_GS_CafLfo2Pitch: case SX_GS_CafLfo2Tvf: case SX_GS_CafLfo2Tva: - CAfSettings[sxid - SX_GS_CafPitch] = s; + CAfSettings[SysExId - SX_GS_CafPitch] = s; break; case SX_GS_PafPitch: @@ -966,7 +968,7 @@ case SX_GS_PafLfo2Pitch: case SX_GS_PafLfo2Tvf: case SX_GS_PafLfo2Tva: - PAfSettings[sxid - SX_GS_PafPitch] = s; + PAfSettings[SysExId - SX_GS_PafPitch] = s; break; case SX_GS_CC1Pitch: @@ -980,7 +982,7 @@ case SX_GS_CC1Lfo2Pitch: case SX_GS_CC1Lfo2Tvf: case SX_GS_CC1Lfo2Tva: - CC1Settings[sxid - SX_GS_CC1Pitch] = s; + CC1Settings[SysExId - SX_GS_CC1Pitch] = s; break; case SX_GS_CC2Pitch: @@ -994,7 +996,7 @@ case SX_GS_CC2Lfo2Pitch: case SX_GS_CC2Lfo2Tvf: case SX_GS_CC2Lfo2Tva: - CC2Settings[sxid - SX_GS_CC2Pitch] = s; + CC2Settings[SysExId - SX_GS_CC2Pitch] = s; break; case SX_GS_ReverbMacro: @@ -1007,7 +1009,7 @@ case SX_GS_RevTime: case SX_GS_RevDelayFeedback: case SX_GS_RevSendChorus: - ReverbSettings[sxid - SX_GS_RevCharacter] = s; + ReverbSettings[SysExId - SX_GS_RevCharacter] = s; break; case SX_GS_ChorusMacro: @@ -1021,7 +1023,7 @@ case SX_GS_ChoRate: case SX_GS_ChoDepth: case SX_GS_ChoSendReverb: - ChorusSettings[sxid - SX_GS_ChoPreLpf] = s; + ChorusSettings[SysExId - SX_GS_ChoPreLpf] = s; break; case SX_GS_CC1CtrlNo: @@ -1050,78 +1052,78 @@ } else if (gpSynth->IsXG()) { - switch (sxid) + switch (SysExId) { case SX_XG_BendPitch: case SX_XG_BendTvf: case SX_XG_BendAmpl: - BenderSettings[sxid - SX_XG_BendPitch] = s; + BenderSettings[SysExId - SX_XG_BendPitch] = s; break; case SX_XG_BendLfoPitch: case SX_XG_BendLfoTvf: case SX_XG_BendLfoTva: - BenderSettings[sxid + 1 - SX_XG_BendPitch] = s; + BenderSettings[SysExId + 1 - SX_XG_BendPitch] = s; break; case SX_XG_ModPitch: case SX_XG_ModTvf: case SX_XG_ModAmpl: - ModulationSettings[sxid - SX_XG_ModPitch] = s; + ModulationSettings[SysExId - SX_XG_ModPitch] = s; break; case SX_XG_ModLfoPitch: case SX_XG_ModLfoTvf: case SX_XG_ModLfoTva: - ModulationSettings[sxid + 1 - SX_XG_ModPitch] = s; + ModulationSettings[SysExId + 1 - SX_XG_ModPitch] = s; break; case SX_XG_CafPitch: case SX_XG_CafTvf: case SX_XG_CafAmpl: - CAfSettings[sxid - SX_XG_CafPitch] = s; + CAfSettings[SysExId - SX_XG_CafPitch] = s; break; case SX_XG_CafLfoPitch: case SX_XG_CafLfoTvf: case SX_XG_CafLfoTva: - CAfSettings[sxid + 1 - SX_XG_CafPitch] = s; + CAfSettings[SysExId + 1 - SX_XG_CafPitch] = s; break; case SX_XG_PafPitch: case SX_XG_PafTvf: case SX_XG_PafAmpl: - PAfSettings[sxid - SX_XG_PafPitch] = s; + PAfSettings[SysExId - SX_XG_PafPitch] = s; break; case SX_XG_PafLfoPitch: case SX_XG_PafLfoTvf: case SX_XG_PafLfoTva: - PAfSettings[sxid + 1 - SX_XG_PafPitch] = s; + PAfSettings[SysExId + 1 - SX_XG_PafPitch] = s; break; case SX_XG_CC1Pitch: case SX_XG_CC1Tvf: case SX_XG_CC1Ampl: - CC1Settings[sxid - SX_XG_CC1Pitch] = s; + CC1Settings[SysExId - SX_XG_CC1Pitch] = s; break; case SX_XG_CC1LfoPitch: case SX_XG_CC1LfoTvf: case SX_XG_CC1LfoTva: - CC1Settings[sxid + 1 - SX_XG_CC1Pitch] = s; + CC1Settings[SysExId + 1 - SX_XG_CC1Pitch] = s; break; case SX_XG_CC2Pitch: case SX_XG_CC2Tvf: case SX_XG_CC2Ampl: - CC2Settings[sxid - SX_XG_CC2Pitch] = s; + CC2Settings[SysExId - SX_XG_CC2Pitch] = s; break; case SX_XG_CC2LfoPitch: case SX_XG_CC2LfoTvf: case SX_XG_CC2LfoTva: - CC2Settings[sxid + 1 - SX_XG_CC2Pitch] = s; + CC2Settings[SysExId + 1 - SX_XG_CC2Pitch] = s; break; case SX_XG_ReverbMacro: @@ -1200,10 +1202,10 @@ tKeyOff* pKeyOff; if ((pKeyOff = Events[i]->IsKeyOff()) != 0) { - JZEvent **e = &Events[i - 1]; - while (e >= Events) + JZEvent** ppEvent = &Events[i - 1]; + while (ppEvent >= Events) { - tKeyOn* pKeyOn = (*e)->IsKeyOn(); + tKeyOn* pKeyOn = (*ppEvent)->IsKeyOn(); if ( pKeyOn && pKeyOn->Key == pKeyOff->Key && @@ -1218,7 +1220,7 @@ pKeyOff->Kill(); break; } - --e; + --ppEvent; } } } @@ -1292,7 +1294,7 @@ void tEventArray::Write(JZWriteBase& Io) { - JZEvent *e; + JZEvent* pEvent; int WrittenBefore; Length2Keyoff(); @@ -1311,9 +1313,9 @@ } // Synth reset - if (Reset) + if (mpReset) { - Reset->Write(Io); + mpReset->Write(Io); } // Rpn / Nrpn: @@ -1385,21 +1387,20 @@ mPatch->Write(Io); } - // write jazz track info - tJazzMeta *jazz = new tJazzMeta; - jazz->SetAudioMode(audio_mode); - jazz->SetTrackState(State); - jazz->SetTrackDevice(Device); - jazz->SetIntroLength(gpSong->GetIntroLength()); - jazz->Write(Io); + tJazzMeta JazzMeta; + JazzMeta.SetAudioMode(audio_mode); + JazzMeta.SetTrackState(State); + JazzMeta.SetTrackDevice(Device); + JazzMeta.SetIntroLength(gpSong->GetIntroLength()); + JazzMeta.Write(Io); for (int i = 0; i < nEvents; i++) { - e = Events[i]; + pEvent = Events[i]; WrittenBefore = 0; - if (e->IsControl()) + if (pEvent->IsControl()) { - switch (e->IsControl()->GetControl()) + switch (pEvent->IsControl()->GetControl()) { // Don't write these again if present as events // and clock == 0 (should not happen) @@ -1410,7 +1411,7 @@ case 0x06: // Rpn/Nrpn Data case 0x00: // mpBank case 0x20: // Bank2 - if (e->GetClock() == 0) + if (pEvent->GetClock() == 0) { WrittenBefore = 1; } @@ -1419,23 +1420,23 @@ WrittenBefore = 0; } } - else if (e->IsProgram()) + else if (pEvent->IsProgram()) { // Don't write these again if present as events // and clock == 0 (should not happen) - if (e->GetClock() == 0) + if (pEvent->GetClock() == 0) { WrittenBefore = 1; } } - else if (e->IsCopyright() || e->IsMtcOffset()) + else if (pEvent->IsCopyright() || pEvent->IsMtcOffset()) { // Will probably happen WrittenBefore = 1; } if (!WrittenBefore) { - e->Write(Io); + pEvent->Write(Io); } } Keyoff2Length(); @@ -1443,10 +1444,10 @@ void tEventArray::Read(JZReadBase& Io) { - JZEvent *e; + JZEvent* pEvent; Channel = 0; unsigned char Msb, Lsb, Data; - int SpecialEvent; + bool SpecialEvent; Msb = Lsb = Data = 0xff; int cha; @@ -1454,13 +1455,13 @@ bool NeedToDelete; Io.NextTrack(); - while ((e = Io.Read()) != 0) + while ((pEvent = Io.Read()) != 0) { NeedToDelete = false; - SpecialEvent = 0; - if (e->IsJazzMeta()) + SpecialEvent = false; + if (pEvent->IsJazzMeta()) { - tJazzMeta *j = e->IsJazzMeta(); + tJazzMeta *j = pEvent->IsJazzMeta(); audio_mode = (int)j->GetAudioMode(); State = (int)j->GetTrackState(); Device = (int)j->GetTrackDevice(); @@ -1468,26 +1469,26 @@ delete j; continue; } - if (e->IsControl()) + if (pEvent->IsControl()) { - switch (e->IsControl()->GetControl()) + switch (pEvent->IsControl()->GetControl()) { // Grab Rpn/Nrpn/Bank from file and save them, don't put // them into event-array case 0x63: case 0x65: - Msb = e->IsControl()->GetControlValue(); // Rpn/Nrpn Msb - SpecialEvent = 1; + Msb = pEvent->IsControl()->GetControlValue(); // Rpn/Nrpn Msb + SpecialEvent = true; break; case 0x62: case 0x64: - Lsb = e->IsControl()->GetControlValue(); // Rpn/Nrpn Lsb - SpecialEvent = 1; + Lsb = pEvent->IsControl()->GetControlValue(); // Rpn/Nrpn Lsb + SpecialEvent = true; break; case 0x06: - Data = e->IsControl()->GetControlValue(); // Rpn/Nrpn Data - SpecialEvent = 1; - cha = e->IsControl()->GetChannel(); + Data = pEvent->IsControl()->GetControlValue(); // Rpn/Nrpn Data + SpecialEvent = true; + cha = pEvent->IsControl()->GetChannel(); switch (Msb) { case 0x01: // Nrpn @@ -1570,65 +1571,65 @@ case 0x00: if (!mpBank) { - SpecialEvent = 1; - mpBank = e->IsControl(); + SpecialEvent = true; + mpBank = pEvent->IsControl(); mpBank->SetClock(0); } break; case 0x20: if (!mpBank2) { - SpecialEvent = 1; - mpBank2 = e->IsControl(); + SpecialEvent = true; + mpBank2 = pEvent->IsControl(); mpBank2->SetClock(0); } break; default: - SpecialEvent = 0; // Other control + SpecialEvent = false; // Other control break; } } - else if (e->IsProgram()) + else if (pEvent->IsProgram()) { if (!mPatch) { - mPatch = e->IsProgram(); + mPatch = pEvent->IsProgram(); mPatch->SetClock(0); - SpecialEvent = 1; + SpecialEvent = true; } } - else if (e->IsCopyright()) + else if (pEvent->IsCopyright()) { if (!Copyright) { - Copyright = e->IsCopyright(); + Copyright = pEvent->IsCopyright(); // Just make sure clock is zero, then put into event array Copyright->SetClock(0); } } - else if (e->IsSysEx()) + else if (pEvent->IsSysEx()) { NeedToDelete = true; // Get hold of the Reset sysex... - int sxid = gpSynth->GetSysexId(e->IsSysEx()); + int SysExId = gpSynth->GetSysexId(pEvent->IsSysEx()); - if ((sxid == SX_GM_ON) || (sxid == SX_GS_ON) || (sxid == SX_XG_ON)) + if (SysExId == SX_GM_ON || SysExId == SX_GS_ON || SysExId == SX_XG_ON) { // Take them all away - SpecialEvent = 1; + SpecialEvent = true; // Save it in the track defaults if it fits with synth // type settings if ( - (gpSynth->IsGM() && (sxid == SX_GM_ON)) || - (gpSynth->IsGS() && (sxid == SX_GS_ON)) || - (gpSynth->IsXG() && (sxid == SX_XG_ON))) + (gpSynth->IsGM() && (SysExId == SX_GM_ON)) || + (gpSynth->IsGS() && (SysExId == SX_GS_ON)) || + (gpSynth->IsXG() && (SysExId == SX_XG_ON))) { - if (!Reset) + if (!mpReset) { - Reset = e->IsSysEx(); + mpReset = pEvent->IsSysEx(); NeedToDelete = false; } } @@ -1637,14 +1638,14 @@ if (!SpecialEvent) { - Put(e); + Put(pEvent); NeedToDelete = false; - if (!Channel && e->IsChannelEvent()) + if (!Channel && pEvent->IsChannelEvent()) { - Channel = e->IsChannelEvent()->GetChannel() + 1; + Channel = pEvent->IsChannelEvent()->GetChannel() + 1; } } - if (e->IsEndOfTrack()) + if (pEvent->IsEndOfTrack()) { // JAVE I want explicit end of track events // Break out of loop here because endoftrack is end, and we want it read @@ -1655,7 +1656,7 @@ if (NeedToDelete) { - delete e; + delete pEvent; } } // while read @@ -1772,17 +1773,17 @@ tSysEx *s; tEventIterator Iterator(trk); trk->Sort(); - JZEvent *e = Iterator.Range(0, (unsigned) trk->GetLastClock() + 1); - while (e) + JZEvent* pEvent = Iterator.Range(0, (unsigned) trk->GetLastClock() + 1); + while (pEvent) { - if ((c = e->IsChannelEvent()) != 0) + if ((c = pEvent->IsChannelEvent()) != 0) { - c = (tChannelEvent *)e->Copy(); + c = (tChannelEvent *)pEvent->Copy(); c->SetChannel(trk->Channel - 1); - trk->Kill(e); + trk->Kill(pEvent); trk->Put(c); } - else if ((s = e->IsSysEx()) != 0) + else if ((s = pEvent->IsSysEx()) != 0) { // Check for sysex that contains channel number const unsigned char* pChannel = gpSynth->GetSysexChaPtr(s); @@ -1798,13 +1799,13 @@ *pChannel |= sysex_channel(trk->Channel); } - s = (tSysEx *) e->Copy(); - trk->Kill(e); + s = (tSysEx *) pEvent->Copy(); + trk->Kill(pEvent); trk->Put(s); } } - e = Iterator.Next(); - } // while e + pEvent = Iterator.Next(); + } // while pEvent if (trk->VibRate) { @@ -1997,20 +1998,20 @@ if (Replace) { tEventIterator Erase(this); - JZEvent *e = Erase.Range(FromClock, ToClock); - while (e) + JZEvent* pEvent = Erase.Range(FromClock, ToClock); + while (pEvent) { - Kill(e); - e = Erase.Next(); + Kill(pEvent); + pEvent = Erase.Next(); } } // Merge Recorded Events tEventIterator Copy(other); - JZEvent *e = Copy.Range(FromClock, ToClock); - while (e) + JZEvent* pEvent = Copy.Range(FromClock, ToClock); + while (pEvent) { - JZEvent *c = e->Copy(); + JZEvent* c = pEvent->Copy(); if (ForceChannel) { tChannelEvent* pChannelEvent = c->IsChannelEvent(); @@ -2020,7 +2021,7 @@ } } Put(c); - e = Copy.Next(); + pEvent = Copy.Next(); } Cleanup(); } @@ -2044,17 +2045,17 @@ tUndoBuffer *undo = &mUndoBuffers[mUndoIndex]; for (int i = undo->nEvents - 1; i >= 0; i--) { - JZEvent *e = undo->Events[i]; + JZEvent* pEvent = undo->Events[i]; if (undo->bits(i)) { undo->bits.set(i, 0); - e->UnKill(); - tEventArray::Put(e); + pEvent->UnKill(); + tEventArray::Put(pEvent); } else { undo->bits.set(i, 1); - e->Kill(); + pEvent->Kill(); } } tEventArray::Cleanup(TRUE); @@ -2074,17 +2075,17 @@ tUndoBuffer *undo = &mUndoBuffers[mUndoIndex]; for (int i = 0; i < undo->nEvents; i++) { - JZEvent *e = undo->Events[i]; + JZEvent* pEvent = undo->Events[i]; if (undo->bits(i)) { undo->bits.set(i, 0); - e->UnKill(); - tEventArray::Put(e); + pEvent->UnKill(); + tEventArray::Put(pEvent); } else { undo->bits.set(i, 1); - e->Kill(); + pEvent->Kill(); } } tEventArray::Cleanup(TRUE); @@ -2268,9 +2269,9 @@ } if (Value > 0) { - JZEvent *e = new tControl(0, Channel - 1, 0x0a, Value - 1); - Put(e); - gpMidiPlayer->OutNow(this, e); + JZEvent* pEvent = new tControl(0, Channel - 1, 0x0a, Value - 1); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } Cleanup(); } @@ -2294,9 +2295,9 @@ } if (Value > 0) { - JZEvent *e = new tControl(0, Channel - 1, 0x5B, Value - 1); - Put(e); - gpMidiPlayer->OutNow(this, e); + JZEvent* pEvent = new tControl(0, Channel - 1, 0x5B, Value - 1); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } Cleanup(); } @@ -2320,9 +2321,9 @@ } if (Value > 0) { - JZEvent *e = new tControl(0, Channel - 1, 0x5D, Value - 1); - Put(e); - gpMidiPlayer->OutNow(this, e); + JZEvent* pEvent = new tControl(0, Channel - 1, 0x5D, Value - 1); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } Cleanup(); } @@ -2743,11 +2744,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->ModSX(msp, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->ModSX(msp, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2775,11 +2776,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->BendSX(bsp, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->BendSX(bsp, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2807,11 +2808,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->CafSX(csp, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->CafSX(csp, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2839,11 +2840,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->PafSX(psp, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->PafSX(psp, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2871,11 +2872,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->CC1SX(csp, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->CC1SX(csp, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2901,11 +2902,11 @@ Kill(CC2Settings[csp]); if (Value > 0) { - JZEvent *e = gpSynth->CC2SX(csp, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->CC2SX(csp, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2933,11 +2934,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->ControllerNumberSX(1, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->ControllerNumberSX(1, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2965,11 +2966,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->ControllerNumberSX(2, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->ControllerNumberSX(2, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -3002,13 +3003,13 @@ if (Value > 0) { - JZEvent *e = gpSynth->ReverbMacroSX(0, Value - 1, lsb - 1); - if (e) + JZEvent* pEvent = gpSynth->ReverbMacroSX(0, Value - 1, lsb - 1); + if (pEvent) { - Put(e); + Put(pEvent); if (gpConfig->GetValue(C_UseReverbMacro)) { - gpMidiPlayer->OutNow(this, e); + gpMidiPlayer->OutNow(this, pEvent); } } } @@ -3043,13 +3044,13 @@ if (Value > 0) { - JZEvent *e = gpSynth->ChorusMacroSX(0, Value - 1, lsb - 1); - if (e) + JZEvent* pEvent = gpSynth->ChorusMacroSX(0, Value - 1, lsb - 1); + if (pEvent) { - Put(e); + Put(pEvent); if (gpConfig->GetValue(C_UseChorusMacro)) { - gpMidiPlayer->OutNow(this, e); + gpMidiPlayer->OutNow(this, pEvent); } } } @@ -3079,11 +3080,11 @@ if (Value > 0) { - JZEvent *e = gpSynth->EqualizerMacroSX(0, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->EqualizerMacroSX(0, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -3112,13 +3113,13 @@ if (Value > 0) { - JZEvent *e = gpSynth->ReverbParamSX(rsp, 0, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->ReverbParamSX(rsp, 0, Value - 1); + if (pEvent) { - Put(e); + Put(pEvent); if (!gpConfig->GetValue(C_UseReverbMacro)) { - gpMidiPlayer->OutNow(this, e); + gpMidiPlayer->OutNow(this, pEvent); } } } @@ -3148,13 +3149,13 @@ if (Value > 0) { - JZEvent *e = gpSynth->ChorusParamSX(csp, 0, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->ChorusParamSX(csp, 0, Value - 1); + if (pEvent) { - Put(e); + Put(pEvent); if (!gpConfig->GetValue(C_UseChorusMacro)) { - gpMidiPlayer->OutNow(this, e); + gpMidiPlayer->OutNow(this, pEvent); } } } @@ -3185,11 +3186,11 @@ if (rsrv) { - JZEvent *e = gpSynth->PartialReserveSX(0, Channel, rsrv); - if (e) + JZEvent* pEvent = gpSynth->PartialReserveSX(0, Channel, rsrv); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -3223,11 +3224,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->MasterVolSX(0, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->MasterVolSX(0, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -3256,11 +3257,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->MasterPanSX(0, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->MasterPanSX(0, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -3310,24 +3311,24 @@ break; } - JZEvent *e = 0; + JZEvent* pEvent = 0; if (Value > 0) { switch (param) { case mspRxChannel: - e = gpSynth->RxChannelSX(0, Channel, Value - 1); + pEvent = gpSynth->RxChannelSX(0, Channel, Value - 1); break; case mspUseForRhythm: - e = gpSynth->UseForRhythmSX(0, Channel, Value - 1); + pEvent = gpSynth->UseForRhythmSX(0, Channel, Value - 1); break; } - if (e) + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -3352,8 +3353,8 @@ } if (mtc) { - JZEvent *e = mtc->ToOffset(); - Put(e); + JZEvent* pEvent = mtc->ToOffset(); + Put(pEvent); } Cleanup(); } @@ -3372,13 +3373,13 @@ void JZTrack::SetDefaultSpeed(int bpm) { - JZEvent *e = new tSetTempo(0, bpm); + JZEvent* pEvent = new tSetTempo(0, bpm); if (Speed) { Kill(Speed); } - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); Cleanup(); } @@ -3386,16 +3387,16 @@ { tEventIterator Iterator(this); Sort(); - JZEvent *e = Iterator.Range(0, clk + 1); + JZEvent* pEvent = Iterator.Range(0, clk + 1); tSetTempo *t = Speed; - while (e) + while (pEvent) { - if (e->IsSetTempo()) + if (pEvent->IsSetTempo()) { - t = e->IsSetTempo(); + t = pEvent->IsSetTempo(); } - e = Iterator.Next(); - } // while e + pEvent = Iterator.Next(); + } // while pEvent return t; } Modified: trunk/jazz/src/Track.h =================================================================== --- trunk/jazz/src/Track.h 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Track.h 2009-01-20 04:14:04 UTC (rev 692) @@ -467,7 +467,7 @@ public: - tSysEx* Reset; + tSysEx* mpReset; tSysEx* ModulationSettings[mspModulationSysexParameters]; tSysEx* BenderSettings[bspBenderSysexParameters]; Modified: trunk/jazz/src/TrackFrame.cpp =================================================================== --- trunk/jazz/src/TrackFrame.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/TrackFrame.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -75,7 +75,7 @@ //***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(JZTrackFrame, wxFrame) +BEGIN_EVENT_TABLE(JZTrackFrame, JZEventFrame) EVT_MENU(wxID_NEW, JZTrackFrame::OnFileNew) @@ -85,9 +85,6 @@ EVT_MENU(wxID_EXIT, JZTrackFrame::OnFileExit) - EVT_UPDATE_UI(ID_SHIFT, JZTrackFrame::OnUpdateEditShift) - EVT_MENU(ID_SHIFT, JZTrackFrame::OnEditShift) - EVT_MENU... [truncated message content] |