|
From: <pst...@us...> - 2009-01-02 18:37:54
|
Revision: 680
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=680&view=rev
Author: pstieber
Date: 2009-01-02 18:37:48 +0000 (Fri, 02 Jan 2009)
Log Message:
-----------
1. Separated the event frame and event window code into separate source modules.
Modified some includes in various file to handle this change.
2. Started implementing the shift dialog using a more modern wxWidgets approach.
This is a WIP.
3.
Modified Paths:
--------------
trunk/jazz/src/ControlEdit.cpp
trunk/jazz/src/Dialogs.cpp
trunk/jazz/src/EventWindow.cpp
trunk/jazz/src/EventWindow.h
trunk/jazz/src/HarmonyBrowserAnalyzer.cpp
trunk/jazz/src/Makefile.am
trunk/jazz/src/Rhythm.cpp
trunk/jazz/src/TrackFrame.cpp
trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj
trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj
Added Paths:
-----------
trunk/jazz/src/Dialogs/ShiftDialog.cpp
trunk/jazz/src/Dialogs/ShiftDialog.h
trunk/jazz/src/EventFrame.cpp
trunk/jazz/src/EventFrame.h
Modified: trunk/jazz/src/ControlEdit.cpp
===================================================================
--- trunk/jazz/src/ControlEdit.cpp 2009-01-01 08:46:37 UTC (rev 679)
+++ trunk/jazz/src/ControlEdit.cpp 2009-01-02 18:37:48 UTC (rev 680)
@@ -23,6 +23,7 @@
#include "ControlEdit.h"
#include "EventWindow.h"
+#include "Filter.h"
#include "PianoWindow.h"
#include "Song.h"
#include "Track.h"
Added: trunk/jazz/src/Dialogs/ShiftDialog.cpp
===================================================================
--- trunk/jazz/src/Dialogs/ShiftDialog.cpp (rev 0)
+++ trunk/jazz/src/Dialogs/ShiftDialog.cpp 2009-01-02 18:37:48 UTC (rev 680)
@@ -0,0 +1,540 @@
+//*****************************************************************************
+// The JAZZ++ Midi Sequencer
+//
+// Copyright (C) 2008 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 "ShiftDialog.h"
+
+#include "../Filter.h"
+#include "IntegerEdit.h"
+
+#include <wx/button.h>
+#include <wx/checkbox.h>
+#include <wx/msgdlg.h>
+#include <wx/sizer.h>
+#include <wx/stattext.h>
+#include <wx/textctrl.h>
+
+#include <string>
+
+using namespace std;
+
+//*****************************************************************************
+//*****************************************************************************
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+BEGIN_EVENT_TABLE(JZShiftDialog, wxDialog)
+
+ EVT_BUTTON(wxID_HELP, JZShiftDialog::OnHelp)
+
+END_EVENT_TABLE()
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+JZShiftDialog::JZShiftDialog(
+ JZEventFrame& EventWindow,
+ JZFilter& Filter,
+ 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)
+{
+ mpFromTimeEdit = new wxTextCtrl(this, wxID_ANY);
+ mpToTimeEdit = new wxTextCtrl(this, wxID_ANY);
+
+ 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");
+ pOkButton->SetDefault();
+
+ wxBoxSizer* pTopSizer = new wxBoxSizer(wxVERTICAL);
+
+ wxFlexGridSizer* pFlexGridSizer;
+
+ pFlexGridSizer = new wxFlexGridSizer(2, 4, 4, 2);
+
+ pFlexGridSizer->Add(
+ new wxStaticText(this, wxID_ANY, "From Time:"),
+ 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);
+
+ pFlexGridSizer->Add(
+ new wxStaticText(this, wxID_ANY, "From Track:"),
+ 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);
+
+ wxBoxSizer* pCheckBoxSizer = new wxBoxSizer(wxHORIZONTAL);
+
+ pCheckBoxSizer->Add(mpMeterCheckBox, 0, 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);
+ 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 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;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+bool JZShiftDialog::TransferDataFromWindow()
+{
+ int FromTrack, ToTrack;
+ int NoteMin, NoteMax;
+ int PolyAftertouchMin, PolyAftertouchMax;
+ int ControllerMin, ControllerMax;
+ int PatchMin, PatchMax;
+ int PitchMin, PitchMax;
+
+ 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());
+
+ return true;
+ }
+
+ return false;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZShiftDialog::OnHelp(wxCommandEvent& Event)
+{
+// gpHelpInstance->ShowTopic("Filter Dialog");
+}
Property changes on: trunk/jazz/src/Dialogs/ShiftDialog.cpp
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/jazz/src/Dialogs/ShiftDialog.h
===================================================================
--- trunk/jazz/src/Dialogs/ShiftDialog.h (rev 0)
+++ trunk/jazz/src/Dialogs/ShiftDialog.h 2009-01-02 18:37:48 UTC (rev 680)
@@ -0,0 +1,93 @@
+//*****************************************************************************
+// The JAZZ++ Midi Sequencer
+//
+// Copyright (C) 2008 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_SHIFTDIALOG_H
+#define JZ_SHIFTDIALOG_H
+
+#include <wx/dialog.h>
+
+class JZEventFrame;
+class JZFilter;
+class JZIntegerEdit;
+class wxCheckBox;
+class wxTextCtrl;
+
+//*****************************************************************************
+//*****************************************************************************
+class JZShiftDialog : public wxDialog
+{
+ public:
+
+ JZShiftDialog(
+ JZEventFrame& EventWindow,
+ JZFilter& Filter,
+ wxWindow* pParent);
+
+ private:
+
+ virtual bool TransferDataToWindow();
+
+ virtual bool TransferDataFromWindow();
+
+ void OnHelp(wxCommandEvent& Event);
+
+ private:
+
+ JZFilter& mFilter;
+
+ wxTextCtrl* mpFromTimeEdit;
+ wxTextCtrl* mpToTimeEdit;
+
+ 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();
+};
+
+
+#endif // !defined(JZ_SHIFTDIALOG_H)
Property changes on: trunk/jazz/src/Dialogs/ShiftDialog.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/jazz/src/Dialogs.cpp
===================================================================
--- trunk/jazz/src/Dialogs.cpp 2009-01-01 08:46:37 UTC (rev 679)
+++ trunk/jazz/src/Dialogs.cpp 2009-01-02 18:37:48 UTC (rev 680)
@@ -28,6 +28,7 @@
#include "Dialogs/KeyOnDialog.h"
#include "Events.h"
#include "EventWindow.h"
+#include "Filter.h"
#include "Globals.h"
#include "Help.h"
#include "NamedChoice.h"
@@ -982,7 +983,7 @@
{
Event = e;
text=new char[2048];
- strcpy(text,(const char*)(e->GetText()));
+ strcpy(text, (const char*)(e->GetText()));
}
Added: trunk/jazz/src/EventFrame.cpp
===================================================================
--- trunk/jazz/src/EventFrame.cpp (rev 0)
+++ trunk/jazz/src/EventFrame.cpp 2009-01-02 18:37:48 UTC (rev 680)
@@ -0,0 +1,512 @@
+#include "EventFrame.h"
+
+#include "Command.h"
+#include "Dialogs/ShiftDialog.h"
+#include "Dialogs.h"
+#include "Filter.h"
+#include "MouseAction.h"
+#include "ToolBar.h"
+
+#include <wx/dc.h>
+#include <wx/msgdlg.h>
+
+#include <iostream>
+
+using namespace std;
+
+//*****************************************************************************
+// Description:
+// This is the event frame class definition.
+//*****************************************************************************
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+BEGIN_EVENT_TABLE(JZEventFrame, wxFrame)
+ EVT_SIZE(JZEventFrame::OnSize)
+END_EVENT_TABLE()
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+JZEventFrame::JZEventFrame(
+ wxWindow* pParent,
+ const wxString& Title,
+ JZSong* pSong,
+ const wxPoint& Position,
+ const wxSize& Size)
+ : wxFrame(pParent, wxID_ANY, Title, Position, Size),
+ Song(pSong),
+ mpFilter(0),
+ mpFixedFont(0),
+ hFixedFont(0),
+ mTrackHeight(0),
+ mTopInfoHeight(40),
+ FontSize(12),
+ ClocksPerPixel(36),
+ mEventsX(),
+ mEventsY(mTopInfoHeight),
+ mEventsWidth(0),
+ mEventsHeight(0),
+ CanvasX(0),
+ CanvasY(0),
+ CanvasW(0),
+ CanvasH(0),
+ FromClock(0),
+ ToClock(0),
+ FromLine(0),
+ ToLine(0),
+ SnapSel(0),
+ MouseAction(0),
+ PlayClock(-1),
+ mpSettingsDialog(0),
+ MixerForm(0),
+ mpToolBar(0),
+ mpGreyColor(0),
+ mpGreyBrush(0)
+{
+#ifdef __WXMSW__
+ mpGreyColor = new wxColor(192, 192, 192);
+#else
+ mpGreyColor = new wxColor(220, 220, 220);
+#endif
+ mpGreyBrush = new wxBrush(*mpGreyColor, wxSOLID);
+
+ mpFilter = new JZFilter(Song);
+}
+
+JZEventFrame::~JZEventFrame()
+{
+ delete SnapSel;
+
+ delete mpGreyColor;
+ delete mpGreyBrush;
+
+ delete mpFilter;
+
+ delete mpFixedFont;
+
+ delete mpToolBar;
+
+ if (MixerForm)
+ {
+ delete MixerForm;
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZEventFrame::CreateMenu()
+{
+}
+
+
+//-----------------------------------------------------------------------------
+// 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;
+*/
+}
+
+//-----------------------------------------------------------------------------
+// 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);
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+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)
+ {
+ y += mTrackHeight;
+ }
+ y -= mTopInfoHeight;
+ return y / mTrackHeight;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+int JZEventFrame::Line2y(int Line)
+{
+ return Line * mTrackHeight + mTopInfoHeight;
+}
+
+/*
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZEventFrame::LineText(wxDC *dc, int x, int y, int w, const char *str, int h, bool down)
+{
+ if (h <= 0)
+ {
+ h = mTrackHeight;
+ y = y2yLine(y);
+ }
+ if (w && h)
+ {
+ //dc->SetBrush(wxGREY_BRUSH);
+ dc->SetBrush(*mpGreyBrush);
+ dc->SetPen(*wxGREY_PEN);
+ #ifdef __WXMSW__
+ dc->DrawRectangle(x, y, w+1, h+1);
+ #else
+ dc->DrawRectangle(x, y, w, h);
+ #endif
+ x += 1;
+ y += 1;
+ w -= 2;
+ h -= 2;
+ if (down)
+ {
+ dc->SetPen(*wxBLACK_PEN);
+ dc->DrawLine(x, y, x+w, y);
+ dc->DrawLine(x, y, x, y+h);
+ dc->SetPen(*wxWHITE_PEN);
+ dc->DrawLine(x+w, y, x+w, y+h);
+ dc->DrawLine(x, y+h, x+w, y+h);
+ }
+ else
+ {
+ dc->SetPen(*wxWHITE_PEN);
+ dc->DrawLine(x, y, x+w, y);
+ dc->DrawLine(x, y, x, y+h);
+ dc->SetPen(*wxBLACK_PEN);
+ dc->DrawLine(x+w, y, x+w, y+h);
+ dc->DrawLine(x, y+h, x+w, y+h);
+ }
+ dc->SetPen(*wxBLACK_PEN);
+ x -= 2;
+ y -= 2;
+ }
+ dc->SetTextBackground(*mpGreyColor);
+ dc->DrawText((char *)str, x + mLittleBit, y + mLittleBit);
+ dc->SetTextBackground(*wxWHITE);
+}
+*/
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZEventFrame::Redraw()
+{
+// wxDC* dc=new wxClientDC(this);
+// 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
+// delete dc;
+
+// mpEventWindow->Refresh();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+bool JZEventFrame::OnKeyEvent(wxKeyEvent &e)
+{
+ return false;
+}
+
+//-----------------------------------------------------------------------------
+// seems to handle the "selection" rectangle. normally called from the base
+// class onmouseevent handler
+//-----------------------------------------------------------------------------
+int JZEventFrame::OnMouseEvent(wxMouseEvent &e)
+{
+ // cout <<"JZEventFrame::OnMouseEvent"<<endl;
+ if (!MouseAction)
+ {
+ // create SnapSel?
+ int x;
+ int y;
+ e.GetPosition(&x, &y);
+ if (mEventsX < x && x < mEventsX + mEventsWidth && mEventsY < y && y < mEventsY + mEventsHeight)
+ {
+ if (e.LeftDown())
+ {
+ {
+ SnapSelStart(e);
+
+ if (SnapSel->IsSelected())
+ {
+ Refresh(); //redraw the whole window instead(inefficient, we should rather invalidate a rect)
+ }
+ SnapSel->Event(e);
+ MouseAction = SnapSel;
+ }
+ }
+ }
+ }
+ else
+ {
+ // MouseAction active
+
+ if (MouseAction->Event(e))
+ {
+ // MouseAction finished
+
+ if (MouseAction == SnapSel)
+ {
+ SnapSelStop(e);
+ Redraw(); //ineficcient, invalidate rect first instead
+ MouseAction = 0;
+ return 1;
+ }
+
+ MouseAction = 0;
+ }
+ }
+ return 0;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+bool JZEventFrame::OnClose()
+{
+ return FALSE;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZEventFrame::OnMenuCommand(int)
+{
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZEventFrame::SnapSelStart(wxMouseEvent& MouseEvent)
+{
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZEventFrame::SnapSelStop(wxMouseEvent& MouseEvent)
+{
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+int JZEventFrame::EventsSelected(const char* msg)
+{
+ if (!SnapSel->IsSelected())
+ {
+ if (msg == 0)
+ {
+ msg = "please select some events first";
+ }
+ wxMessageBox((char *)msg, "Error", wxOK);
+ return 0;
+ }
+ return 1;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZEventFrame::MenQuantize()
+{
+ if (!EventsSelected())
+ return;
+ // wxDialogBox *panel = new wxDialogBox(this, "Quantize", FALSE );
+ tQuantizeDlg * dlg = new tQuantizeDlg(this, mpFilter);
+ dlg->Create();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZEventFrame::MenCleanup()
+{
+ if (!EventsSelected())
+ return;
+ tCleanupDlg * dlg = new tCleanupDlg(this, mpFilter);
+ dlg->Create();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZEventFrame::MenSearchReplace()
+{
+ if (!EventsSelected())
+ return;
+ tSearchReplaceDlg * dlg = new tSearchReplaceDlg(this, mpFilter);
+ dlg->Create();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZEventFrame::MenSetChannel()
+{
+ if (!EventsSelected())
+ return;
+ tSetChannelDlg * dlg = new tSetChannelDlg(mpFilter);
+ dlg->Create();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZEventFrame::MenTranspose()
+{
+ if (!EventsSelected())
+ return;
+ tTransposeDlg * dlg = new tTransposeDlg(this, mpFilter);
+ dlg->Create();
+}
+
+//-----------------------------------------------------------------------------
+// show the "shift events" dialog
+//-----------------------------------------------------------------------------
+void JZEventFrame::MenShift(int Unit)
+{
+ if (EventsSelected())
+ {
+ JZShiftDialog ShiftDialog(*this, *mpFilter, this);
+
+ if (ShiftDialog.ShowModal() == wxID_OK)
+ {
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZEventFrame::MenDelete()
+{
+ if (!EventsSelected())
+ return;
+ tDeleteDlg * dlg = new tDeleteDlg(this, mpFilter);
+ dlg->Create();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZEventFrame::MenVelocity()
+{
+ if (!EventsSelected())
+ return;
+ tVelocityDlg * dlg = new tVelocityDlg(mpFilter);
+ dlg->Create();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZEventFrame::MenLength()
+{
+ if (!EventsSelected())
+ return;
+ tLengthDlg * dlg = new tLengthDlg(this, mpFilter);
+ dlg->Create();
+}
+
+//-----------------------------------------------------------------------------
+// convert to modulation
+//-----------------------------------------------------------------------------
+void JZEventFrame::MenConvertToModulation()
+{
+ if (!EventsSelected())
+ return;
+ tCmdConvertToModulation cmd(mpFilter);
+ cmd.Execute();
+ Redraw();
+}
Property changes on: trunk/jazz/src/EventFrame.cpp
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/jazz/src/EventFrame.h
===================================================================
--- trunk/jazz/src/EventFrame.h (rev 0)
+++ trunk/jazz/src/EventFrame.h 2009-01-02 18:37:48 UTC (rev 680)
@@ -0,0 +1,149 @@
+//*****************************************************************************
+// 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 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_EVENTFRAME_H
+#define JZ_EVENTFRAME_H
+
+#include <wx/frame.h>
+
+class JZFilter;
+class JZSnapSelection;
+class JZSong;
+class JZToolBar;
+class tMouseAction;
+class wxDialog;
+
+//*****************************************************************************
+// Description:
+// A frame window that containes a scrolled event window. Acts as the
+// common base class for JZTrackFrame and JSPianoFrame.
+//
+// The panel and menu are administered by derived classes.
+// Functionality:
+// - Settings dialog
+// - Selection via Snapsel
+//*****************************************************************************
+class JZEventFrame : public wxFrame
+{
+ public:
+
+ bool OnCharHook(wxKeyEvent& event);
+ void OnChar(wxKeyEvent& event);
+
+ // 2-step initialization: 1) constructor
+ JZEventFrame(
+ wxWindow* pParent,
+ const wxString& Title,
+ JZSong* pSong,
+ const wxPoint& Position = wxDefaultPosition,
+ const wxSize& Size = wxDefaultSize);
+
+ virtual ~JZEventFrame();
+
+ JZSong* Song;
+
+ JZFilter* mpFilter;
+
+ // 2) Create():
+ virtual void Create();
+ virtual void CreateMenu();
+ void CreateCanvas();
+// JZEventWindow* mpEventWindow;
+
+ // 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;
+ int FromLine, ToLine;
+
+ // Mousehandling
+ JZSnapSelection* SnapSel;
+ tMouseAction* MouseAction;
+ virtual void SnapSelStart(wxMouseEvent &e);
+ virtual void SnapSelStop(wxMouseEvent &e);
+
+ // 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;
+
+ // Events
+ virtual int OnMouseEvent(wxMouseEvent& Event);
+ virtual bool OnKeyEvent(wxKeyEvent& Event); // true = processed by eventwin
+ virtual void OnSize(wxSizeEvent& Event);
+ virtual void OnMenuCommand(int id);
+ virtual bool OnClose();
+
+ // Redraw - nach Aenderungen von Parametern, kein GUI-Event
+ virtual void Redraw();
+
+ // Settings-Dialog
+ wxDialog* mpSettingsDialog;
+ void SettingsDialog(int piano);
+
+ // Mixer-Dialog
+ wxDialog* MixerForm;
+
+ // Edit-Menu
+
+ // if selection active: TRUE, else: Errormessage + FALSE
+ int EventsSelected(const char* msg = 0);
+
+ void MenQuantize();
+ void MenSetChannel();
+ void MenTranspose();
+ void MenShift(int Unit);
+ void MenDelete();
+ void MenVelocity();
+ void MenLength();
+ void MenSeqLength();
+ void MenMidiDelay();
+ void MenConvertToModulation();
+ void MenCleanup();
+ void MenSearchReplace();
+ void MenMeterChange();
+
+ protected:
+
+ JZToolBar* mpToolBar;
+ wxColor* mpGreyColor;
+ wxBrush* mpGreyBrush;
+
+ DECLARE_EVENT_TABLE()
+};
+
+#endif // !defined(JZ_EVENTFRAME_H)
Property changes on: trunk/jazz/src/EventFrame.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/jazz/src/EventWindow.cpp
===================================================================
--- trunk/jazz/src/EventWindow.cpp 2009-01-01 08:46:37 UTC (rev 679)
+++ trunk/jazz/src/EventWindow.cpp 2009-01-02 18:37:48 UTC (rev 680)
@@ -22,15 +22,13 @@
#include "EventWindow.h"
-#include "PianoFrame.h"
+#include "EventFrame.h"
+#include "Filter.h"
+#include "MouseAction.h"
#include "Song.h"
-#include "Command.h"
-#include "Dialogs.h"
#include "Help.h"
-#include "ToolBar.h"
#include "PropertyListDialog.h"
-#include <wx/brush.h>
#include <wx/dc.h>
#include <wx/msgdlg.h>
@@ -346,500 +344,6 @@
//}
//*****************************************************************************
-// Description:
-// This is the event frame class definition.
-//*****************************************************************************
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-BEGIN_EVENT_TABLE(JZEventFrame, wxFrame)
- EVT_SIZE(JZEventFrame::OnSize)
-END_EVENT_TABLE()
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-JZEventFrame::JZEventFrame(
- wxWindow* pParent,
- const wxString& Title,
- JZSong* pSong,
- const wxPoint& Position,
- const wxSize& Size)
- : wxFrame(pParent, wxID_ANY, Title, Position, Size),
- Song(pSong),
- mpFilter(0),
- mpFixedFont(0),
- hFixedFont(0),
- mTrackHeight(0),
- mTopInfoHeight(40),
- FontSize(12),
- ClocksPerPixel(36),
- mEventsX(),
- mEventsY(mTopInfoHeight),
- mEventsWidth(0),
- mEventsHeight(0),
- CanvasX(0),
- CanvasY(0),
- CanvasW(0),
- CanvasH(0),
- FromClock(0),
- ToClock(0),
- FromLine(0),
- ToLine(0),
- SnapSel(0),
- MouseAction(0),
- PlayClock(-1),
- mpSettingsDialog(0),
- MixerForm(0),
- mpToolBar(0),
- mpGreyColor(0),
- mpGreyBrush(0)
-{
-#ifdef __WXMSW__
- mpGreyColor = new wxColor(192, 192, 192);
-#else
- mpGreyColor = new wxColor(220, 220, 220);
-#endif
- mpGreyBrush = new wxBrush(*mpGreyColor, wxSOLID);
-
- mpFilter = new JZFilter(Song);
-}
-
-JZEventFrame::~JZEventFrame()
-{
- delete SnapSel;
-
- delete mpGreyColor;
- delete mpGreyBrush;
-
- delete mpFilter;
-
- delete mpFixedFont;
-
- delete mpToolBar;
-
- if (MixerForm)
- {
- delete MixerForm;
- }
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void JZEventFrame::CreateMenu()
-{
-}
-
-
-//-----------------------------------------------------------------------------
-// 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;
-*/
-}
-
-//-----------------------------------------------------------------------------
-// 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);
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-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)
- {
- y += mTrackHeight;
- }
- y -= mTopInfoHeight;
- return y / mTrackHeight;
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-int JZEventFrame::Line2y(int Line)
-{
- return Line * mTrackHeight + mTopInfoHeight;
-}
-
-/*
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void JZEventFrame::LineText(wxDC *dc, int x, int y, int w, const char *str, int h, bool down)
-{
- if (h <= 0)
- {
- h = mTrackHeight;
- y = y2yLine(y);
- }
- if (w && h)
- {
- //dc->SetBrush(wxGREY_BRUSH);
- dc->SetBrush(*mpGreyBrush);
- dc->SetPen(*wxGREY_PEN);
- #ifdef __WXMSW__
- dc->DrawRectangle(x, y, w+1, h+1);
- #else
- dc->DrawRectangle(x, y, w, h);
- #endif
- x += 1;
- y += 1;
- w -= 2;
- h -= 2;
- if (down)
- {
- dc->SetPen(*wxBLACK_PEN);
- dc->DrawLine(x, y, x+w, y);
- dc->DrawLine(x, y, x, y+h);
- dc->SetPen(*wxWHITE_PEN);
- dc->DrawLine(x+w, y, x+w, y+h);
- dc->DrawLine(x, y+h, x+w, y+h);
- }
- else
- {
- dc->SetPen(*wxWHITE_PEN);
- dc->DrawLine(x, y, x+w, y);
- dc->DrawLine(x, y, x, y+h);
- dc->SetPen(*wxBLACK_PEN);
- dc->DrawLine(x+w, y, x+w, y+h);
- dc->DrawLine(x, y+h, x+w, y+h);
- }
- dc->SetPen(*wxBLACK_PEN);
- x -= 2;
- y -= 2;
- }
- dc->SetTextBackground(*mpGreyColor);
- dc->DrawText((char *)str, x + mLittleBit, y + mLittleBit);
- dc->SetTextBackground(*wxWHITE);
-}
-*/
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void JZEventFrame::Redraw()
-{
-// wxDC* dc=new wxClientDC(this);
-// 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
-// delete dc;
-
-// mpEventWindow->Refresh();
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-bool JZEventFrame::OnKeyEvent(wxKeyEvent &e)
-{
- return false;
-}
-
-//-----------------------------------------------------------------------------
-// seems to handle the "selection" rectangle. normally called from the base
-// class onmouseevent handler
-//-----------------------------------------------------------------------------
-int JZEventFrame::OnMouseEvent(wxMouseEvent &e)
-{
- // cout <<"JZEventFrame::OnMouseEvent"<<endl;
- if (!MouseAction)
- {
- // create SnapSel?
- int x;
- int y;
- e.GetPosition(&x, &y);
- if (mEventsX < x && x < mEventsX + mEventsWidth && mEventsY < y && y < mEventsY + mEventsHeight)
- {
- if (e.LeftDown())
- {
- {
- SnapSelStart(e);
-
- if (SnapSel->IsSelected())
- {
- Refresh(); //redraw the whole window instead(inefficient, we should rather invalidate a rect)
- }
- SnapSel->Event(e);
- MouseAction = SnapSel;
- }
- }
- }
- }
- else
- {
- // MouseAction active
-
- if (MouseAction->Event(e))
- {
- // MouseAction finished
-
- if (MouseAction == SnapSel)
- {
- SnapSelStop(e);
- Redraw(); //ineficcient, invalidate rect first instead
- MouseAction = 0;
- return 1;
- }
-
- MouseAction = 0;
- }
- }
- return 0;
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-bool JZEventFrame::OnClose()
-{
- return FALSE;
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void JZEventFrame::OnMenuCommand(int)
-{
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void JZEventFrame::SnapSelStart(wxMouseEvent& MouseEvent)
-{
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void JZEventFrame::SnapSelStop(wxMouseEvent& MouseEvent)
-{
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-int JZEventFrame::EventsSelected(const char* msg)
-{
- if (!SnapSel->IsSelected())
- {
- if (msg == 0)
- {
- msg = "please select some events first";
- }
- wxMessageBox((char *)msg, "Error", wxOK);
- return 0;
- }
- return 1;
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void JZEventFrame::MenQuantize()
-{
- if (!EventsSelected())
- return;
- // wxDialogBox *panel = new wxDialogBox(this, "Quantize", FALSE );
- tQuantizeDlg * dlg = new tQuantizeDlg(this, mpFilter);
- dlg->Create();
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void JZEventFrame::MenCleanup()
-{
- if (!EventsSelected())
- return;
- tCleanupDlg * dlg = new tCleanupDlg(this, mpFilter);
- dlg->Create();
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void JZEventFrame::MenSearchReplace()
-{
- if (!EventsSelected())
- return;
- tSearchReplaceDlg * dlg = new tSearchReplaceDlg(this, mpFilter);
- dlg->Create();
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void JZEventFrame::MenSetChannel()
-{
- if (!EventsSelected())
- return;
- tSetChannelDlg * dlg = new tSetChannelDlg(mpFilter);
- dlg->Create();
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void JZEventFrame::MenTranspose()
-{
- if (!EventsSelected())
- return;
- tTransposeDlg * dlg = new tTransposeDlg(this, mpFilter);
- dlg->Create();
-}
-
-//-----------------------------------------------------------------------------
-// show the "shift events" dialog
-//-----------------------------------------------------------------------------
-void JZEventFrame::MenShift(int Unit)
-{
- if (EventsSelected())
- {
- tShiftDlg * dlg = new tShiftDlg(this, mpFilter, Unit);
- dlg->Create();
- }
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void JZEventFrame::MenDelete()
-{
- if (!EventsSelected())
- return;
- tDeleteDlg * dlg = new tDeleteDlg(this, mpFilter);
- dlg->Create();
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void JZEventFrame::MenVelocity()
-{
- if (!EventsSelected())
- return;
- tVelocityDlg * dlg = new tVelocityDlg(mpFilter);
- dlg->Create();
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void JZEventFrame::MenLength()
-{
- if (!EventsSelected())
- return;
- tLengthDlg * dlg = new tLengthDlg(this, mpFilter);
- dlg->Create();
-}
-
-//-----------------------------------------------------------------------------
-// convert to modulation
-//-----------------------------------------------------------------------------
-void JZEventFrame::MenConvertToModulation()
-{
- if (!EventsSelected())
- return;
- tCmdConvertToModulation cmd(mpFilter);
- cmd.Execute();
- Redraw();
-}
-
-//*****************************************************************************
// MeterChange Dialog
//*****************************************************************************
class tMeterChangeDlg : public tPropertyListDlg
Modified: trunk/jazz/src/EventWindow.h
===================================================================
--- trunk/jazz/src/EventWindow.h 2009-01-01 08:46:37 UTC (rev 679)
+++ trunk/jazz/src/EventWindow.h 2009-01-02 18:37:48 UTC (rev 680)
@@ -20,18 +20,14 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//*****************************************************************************
-#ifndef JZ_EVENTFRAME_H
-#define JZ_EVENTFRAME_H
+#ifndef JZ_EVENTWINDOW_H
+#define JZ_EVENTWINDOW_H
-#include "Filter.h"
-#include "MouseAction.h"
+#include <wx/window.h>
-#include <wx/frame.h>
-
-class JZEventFrame;
+class JZFilter;
+class JZSnapSelection;
class JZSong;
-class JZToolBar;
-class JZPianoFrame;
//*****************************************************************************
// Description:
@@ -132,118 +128,4 @@
return mpSong;
}
-//*****************************************************************************
-// Description:
-// A frame window that containes a scrolled event window. Acts as the
-// common base class for JZTrackFrame and JSPianoFrame.
-//
-// The panel and menu are administered by derived classes.
-// Functionality:
-// - Settings dialog
-// - Selection via Snapsel
-//*****************************************************************************
-class JZEventFrame : public wxFrame
-{
- public:
-
- bool OnCharHook(wxKeyEvent& event);
- void OnChar(wxKeyEvent& event);
-
- // 2-step initialization: 1) constructor
- JZEventFrame(
- wxWindow* pParent,
- const wxString& Title,
- JZSong* pSong,
- const wxPoint& Position = wxDefaultPosition,
- const wxSize& Size = wxDefaultSize);
-
- virtual ~JZEventFrame();
-
- JZSong* Song;
-
- JZFilter* mpFilter;
-
- // 2) Create():
- virtual void Create();
- virtual void CreateMenu();
- void CreateCanvas();
-// JZEventWindow* mpEventWindow;
-
- // 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;
- int FromLine, ToLine;
-
- // Mousehandling
- JZSnapSelection *SnapSel;
- tMouseAction *MouseAction;
- virtual void SnapSelStart(wxMouseEvent &e);
- virtual void SnapSelStop(wxMouseEvent &e);
-
- // 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;
-
- // Events
- virtual int OnMouseEvent(wxMouseEvent& Event);
- virtual bool OnKeyEvent(wxKeyEvent& Event); // true = processed by eventwin
- virtual void OnSize(wxSizeEvent& Event);
- virtual void OnMenuCommand(int id);
- virtual bool OnClose();
-
- // Redraw - nach Aenderungen von Parametern, kein GUI-Event
- virtual void Redraw();
-
- // Settings-Dialog
- wxDialog* mpSettingsDialog;
- void SettingsDialog(int piano);
-
- // Mixer-Dialog
- wxDialog* MixerForm;
-
- // Edit-Menu
-
- // if selection active: TRUE, else: Errormessage + FALSE
- int EventsSelected(const char* msg = 0);
-
- void MenQuantize();
- void MenSetChannel();
- void MenTranspose();
- void MenShift(int Unit);
- void MenDelete();
- void MenVelocity();
- void MenLength();
- void MenSeqLength();
- void MenMidiDelay();
- void MenConvertToModulation();
- void MenCleanup();
- void MenSearchReplace();
- void MenMeterChange();
-
- protected:
-
- JZToolBar* mpToolBar;
- wxColor* mpGreyColor;
- wxBrush* mpGreyBrush;
-
- DECLARE_EVENT_TABLE()
-};
-
-#endif // !defined(JZ_EVENTFRAME_H)
+#endif // !defined(JZ_EVENTWINDOW_H)
Modified: trunk/jazz/src/HarmonyBrowserAnalyzer.cpp
===================================================================
--- trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2009-01-01 08:46:37 UTC (rev 679)
+++ trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2009-01-02 18:37:48 UTC (rev 680)
@@ -22,8 +22,9 @@
#include "HarmonyBrowserAnalyzer.h"
+#include "Command.h"
#include "EventWindow.h"
-#include "Command.h"
+#include "Filter.h"
#include "Harm...
[truncated message content] |