|
From: <pst...@us...> - 2010-04-03 02:35:59
|
Revision: 741
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=741&view=rev
Author: pstieber
Date: 2010-04-03 02:35:53 +0000 (Sat, 03 Apr 2010)
Log Message:
-----------
Added a new sysex dialog.
Modified Paths:
--------------
trunk/jazz/src/Makefile.am
trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj
Added Paths:
-----------
trunk/jazz/src/Dialogs/SysexDialog.cpp
trunk/jazz/src/Dialogs/SysexDialog.h
Added: trunk/jazz/src/Dialogs/SysexDialog.cpp
===================================================================
--- trunk/jazz/src/Dialogs/SysexDialog.cpp (rev 0)
+++ trunk/jazz/src/Dialogs/SysexDialog.cpp 2010-04-03 02:35:53 UTC (rev 741)
@@ -0,0 +1,278 @@
+//*****************************************************************************
+// The JAZZ++ Midi Sequencer
+//
+// Copyright (C) 2009 Peter J. Stieber, all rights reserved.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//*****************************************************************************
+
+#include "SysexDialog.h"
+
+#include "../Events.h"
+#include "../Globals.h"
+#include "../KeyStringConverters.h"
+#include "../Knob.h"
+#include "../Project.h"
+#include "../Resources.h"
+
+#include <wx/button.h>
+#include <wx/sizer.h>
+#include <wx/stattext.h>
+#include <wx/textctrl.h>
+
+#include <sstream>
+
+using namespace std;
+
+//*****************************************************************************
+//*****************************************************************************
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+BEGIN_EVENT_TABLE(JZSysexDialog, wxDialog)
+
+ EVT_KNOB_CHANGED(IDC_KB_VELOCITY, JZSysexDialog::OnVelocityChange)
+
+ EVT_KNOB_CHANGED(IDC_KB_OFF_VELOCITY, JZSysexDialog::OnOffVelocityChange)
+
+ EVT_KNOB_CHANGED(IDC_KB_CHANNEL, JZSysexDialog::OnChannelChange)
+
+ EVT_BUTTON(wxID_HELP, JZSysexDialog::OnHelp)
+
+END_EVENT_TABLE()
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+JZSysexDialog::JZSysexDialog(tKeyOn* pEvent, wxWindow* pParent)
+ : wxDialog(pParent, wxID_ANY, wxString("Key On")),
+ mpEvent(pEvent),
+ mpPitchEdit(0),
+ mpVelocityValue(0),
+ mpVelocityKnob(0),
+ mpOffVelocityValue(0),
+ mpOffVelocityKnob(0),
+ mpLengthEdit(0),
+ mpChannelValue(0),
+ mpChannelKnob(0),
+ mpClockEdit(0)
+{
+ mpPitchEdit = new wxTextCtrl(this, wxID_ANY);
+
+ mpVelocityValue = new wxStaticText(this, wxID_ANY, "000");
+
+ mpVelocityKnob = new JZKnob(this, IDC_KB_VELOCITY, 0, 0, 127);
+
+ mpOffVelocityValue = new wxStaticText(this, wxID_ANY, "000");
+
+ mpOffVelocityKnob = new JZKnob(this, IDC_KB_OFF_VELOCITY, 0, 0, 127);
+
+ mpLengthEdit = new wxTextCtrl(this, wxID_ANY);
+
+ mpChannelValue = new wxStaticText(this, wxID_ANY, "00");
+
+ mpChannelKnob = new JZKnob(this, IDC_KB_CHANNEL, 0, 1, 16);
+
+ mpClockEdit = new wxTextCtrl(this, wxID_ANY);
+
+ 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(1, 2, 4, 2);
+
+ pFlexGridSizer->Add(
+ new wxStaticText(this, wxID_ANY, "Pitch:"),
+ 0,
+ wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pFlexGridSizer->Add(mpPitchEdit, 0, wxALIGN_CENTER_VERTICAL);
+
+ pTopSizer->Add(pFlexGridSizer, 0, wxCENTER | wxALL, 2);
+
+ pFlexGridSizer = new wxFlexGridSizer(2, 3, 4, 2);
+
+ pFlexGridSizer->Add(
+ new wxStaticText(this, wxID_ANY, "Velocity:"),
+ 0,
+ wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pFlexGridSizer->Add(
+ mpVelocityValue,
+ 0,
+ wxALIGN_CENTER_VERTICAL | wxFIXED_MINSIZE);
+ pFlexGridSizer->Add(mpVelocityKnob, 0, wxALIGN_CENTER_VERTICAL);
+
+ pFlexGridSizer->Add(
+ new wxStaticText(this, wxID_ANY, "Off Velocity:"),
+ 0,
+ wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pFlexGridSizer->Add(
+ mpOffVelocityValue,
+ 0,
+ wxALIGN_CENTER_VERTICAL | wxFIXED_MINSIZE);
+ pFlexGridSizer->Add(mpOffVelocityKnob, 0, wxALIGN_CENTER_VERTICAL);
+
+ pTopSizer->Add(pFlexGridSizer, 0, wxALIGN_CENTER);
+
+ pFlexGridSizer = new wxFlexGridSizer(1, 2, 4, 2);
+
+ pFlexGridSizer->Add(
+ new wxStaticText(this, wxID_ANY, "Length:"),
+ 0,
+ wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pFlexGridSizer->Add(mpLengthEdit, 0, wxALIGN_CENTER_VERTICAL);
+
+ pTopSizer->Add(pFlexGridSizer, 0, wxCENTER | wxALL, 2);
+
+ pFlexGridSizer = new wxFlexGridSizer(1, 3, 4, 2);
+
+ pFlexGridSizer->Add(
+ new wxStaticText(this, wxID_ANY, "Channel:"),
+ 0,
+ wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pFlexGridSizer->Add(
+ mpChannelValue,
+ 0,
+ wxALIGN_CENTER_VERTICAL | wxFIXED_MINSIZE);
+ pFlexGridSizer->Add(mpChannelKnob, 0, wxALIGN_CENTER_VERTICAL);
+
+ pTopSizer->Add(pFlexGridSizer, 0, wxCENTER | wxALL, 2);
+
+ pFlexGridSizer = new wxFlexGridSizer(1, 2, 4, 2);
+
+ pFlexGridSizer->Add(
+ new wxStaticText(this, wxID_ANY, "Clock:"),
+ 0,
+ wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pFlexGridSizer->Add(mpClockEdit, 0, wxALIGN_CENTER_VERTICAL);
+
+ pTopSizer->Add(pFlexGridSizer, 0, wxCENTER | wxALL, 2);
+
+ 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 JZSysexDialog::TransferDataToWindow()
+{
+ string KeyString;
+ KeyToString(mpEvent->GetKey(), KeyString);
+ mpPitchEdit->ChangeValue(KeyString.c_str());
+
+ ostringstream Oss;
+
+ Oss << (int)mpEvent->GetVelocity();
+ mpVelocityValue->SetLabel(Oss.str().c_str());
+
+ mpVelocityKnob->SetValue(mpEvent->GetVelocity());
+
+ Oss.str("");
+ Oss << (int)mpEvent->GetOffVelocity();
+ mpOffVelocityValue->SetLabel(Oss.str().c_str());
+
+ mpOffVelocityKnob->SetValue(mpEvent->GetOffVelocity());
+
+ wxString LengthString;
+ LengthString << mpEvent->GetEventLength();
+ mpLengthEdit->ChangeValue(LengthString);
+
+ Oss.str("");
+ Oss << (int)mpEvent->GetChannel() + 1;
+ mpChannelValue->SetLabel(Oss.str().c_str());
+
+ mpChannelKnob->SetValue(mpEvent->GetChannel() + 1);
+
+ string ClockString;
+ gpProject->ClockToString(mpEvent->GetClock(), ClockString);
+ mpClockEdit->ChangeValue(ClockString.c_str());
+
+ return true;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+bool JZSysexDialog::TransferDataFromWindow()
+{
+ wxString KeyString = mpPitchEdit->GetValue();
+ mpEvent->SetKey(StringToKey(KeyString.c_str()));
+
+ mpEvent->SetVelocity(mpVelocityKnob->GetValue());
+
+ mpEvent->SetOffVelocity(mpOffVelocityKnob->GetValue());
+
+ wxString LengthString = mpLengthEdit->GetValue();
+ istringstream Iss(LengthString.c_str());
+ unsigned short Length;
+ Iss >> Length;
+ mpEvent->SetLength(Length);
+
+ mpEvent->SetChannel(mpChannelKnob->GetValue() - 1);
+
+ wxString ClockString = mpClockEdit->GetValue();
+ int Clock = gpProject->StringToClock(ClockString.c_str());
+ mpEvent->SetClock(Clock);
+
+ return true;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZSysexDialog::OnVelocityChange(JZKnobEvent& Event)
+{
+ int Value = Event.GetValue();
+ ostringstream Oss;
+ Oss << Value;
+ mpVelocityValue->SetLabel(Oss.str().c_str());
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZSysexDialog::OnOffVelocityChange(JZKnobEvent& Event)
+{
+ int Value = Event.GetValue();
+ ostringstream Oss;
+ Oss << Value;
+ mpOffVelocityValue->SetLabel(Oss.str().c_str());
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZSysexDialog::OnChannelChange(JZKnobEvent& Event)
+{
+ int Value = Event.GetValue();
+ ostringstream Oss;
+ Oss << Value;
+ mpChannelValue->SetLabel(Oss.str().c_str());
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZSysexDialog::OnHelp(wxCommandEvent& Event)
+{
+// gpHelpInstance->ShowTopic("Sysex Dialog");
+}
Property changes on: trunk/jazz/src/Dialogs/SysexDialog.cpp
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/jazz/src/Dialogs/SysexDialog.h
===================================================================
--- trunk/jazz/src/Dialogs/SysexDialog.h (rev 0)
+++ trunk/jazz/src/Dialogs/SysexDialog.h 2010-04-03 02:35:53 UTC (rev 741)
@@ -0,0 +1,71 @@
+//*****************************************************************************
+// The JAZZ++ Midi Sequencer
+//
+// Copyright (C) 2009 Peter J. Stieber, all rights reserved.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//*****************************************************************************
+
+#ifndef JZ_SYSEXDIALOG_H
+#define JZ_SYSEXDIALOG_H
+
+#include <wx/dialog.h>
+
+class JZKnob;
+class JZKnobEvent;
+class tKeyOn;
+class wxStaticText;
+class wxTextCtrl;
+
+//*****************************************************************************
+//*****************************************************************************
+class JZSysexDialog : public wxDialog
+{
+ public:
+
+ JZSysexDialog(tKeyOn* pEvent, wxWindow* pParent);
+
+ private:
+
+ virtual bool TransferDataToWindow();
+
+ virtual bool TransferDataFromWindow();
+
+ void OnVelocityChange(JZKnobEvent& Event);
+
+ void OnOffVelocityChange(JZKnobEvent& Event);
+
+ void OnChannelChange(JZKnobEvent& Event);
+
+ void OnHelp(wxCommandEvent& Event);
+
+ private:
+
+ tKeyOn* mpEvent;
+
+ wxTextCtrl* mpPitchEdit;
+ wxStaticText* mpVelocityValue;
+ JZKnob* mpVelocityKnob;
+ wxStaticText* mpOffVelocityValue;
+ JZKnob* mpOffVelocityKnob;
+ wxTextCtrl* mpLengthEdit;
+ wxStaticText* mpChannelValue;
+ JZKnob* mpChannelKnob;
+ wxTextCtrl* mpClockEdit;
+
+ DECLARE_EVENT_TABLE();
+};
+
+#endif // !defined(JZ_SYSEXDIALOG_H)
Property changes on: trunk/jazz/src/Dialogs/SysexDialog.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/jazz/src/Makefile.am
===================================================================
--- trunk/jazz/src/Makefile.am 2010-02-21 17:41:53 UTC (rev 740)
+++ trunk/jazz/src/Makefile.am 2010-04-03 02:35:53 UTC (rev 741)
@@ -35,6 +35,7 @@
Dialogs/ShiftDialog.cpp \
Dialogs/SnapDialog.cpp \
Dialogs/SynthesizerSettingsDialog.cpp \
+Dialogs/SysexDialog.cpp \
Dialogs/TrackDialog.cpp \
Dialogs/TransposeDialog.cpp \
Dialogs/VelocityDialog.cpp \
@@ -123,6 +124,7 @@
Dialogs/ShiftDialog.cpp \
Dialogs/SnapDialog.cpp \
Dialogs/SynthesizerSettingsDialog.cpp \
+Dialogs/SysexDialog.cpp \
Dialogs/TrackDialog.cpp \
Dialogs/TransposeDialog.cpp \
Dialogs/VelocityDialog.cpp \
@@ -216,6 +218,7 @@
Dialogs/ShiftDialog.h \
Dialogs/SnapDialog.h \
Dialogs/SynthesizerSettingsDialog.h \
+Dialogs/SysexDialog.h \
Dialogs/TrackDialog.h \
Dialogs/TransposeDialog.h \
Dialogs/VelocityDialog.h \
Modified: trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj
===================================================================
--- trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj 2010-02-21 17:41:53 UTC (rev 740)
+++ trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj 2010-04-03 02:35:53 UTC (rev 741)
@@ -951,6 +951,14 @@
>
</File>
<File
+ RelativePath="..\src\Dialogs\SysexDialog.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\src\Dialogs\SysexDialog.h"
+ >
+ </File>
+ <File
RelativePath="..\src\Dialogs\TrackDialog.cpp"
>
</File>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|