From: <pst...@us...> - 2008-04-06 05:10:28
|
Revision: 417 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=417&view=rev Author: pstieber Date: 2008-04-05 22:10:26 -0700 (Sat, 05 Apr 2008) Log Message: ----------- Started using the events generated by the knob control. Modified Paths: -------------- trunk/jazz/src/Dialogs/MetronomeSettingsDialog.cpp trunk/jazz/src/Dialogs/MetronomeSettingsDialog.h Modified: trunk/jazz/src/Dialogs/MetronomeSettingsDialog.cpp =================================================================== --- trunk/jazz/src/Dialogs/MetronomeSettingsDialog.cpp 2008-04-06 05:09:36 UTC (rev 416) +++ trunk/jazz/src/Dialogs/MetronomeSettingsDialog.cpp 2008-04-06 05:10:26 UTC (rev 417) @@ -26,8 +26,10 @@ #include "../Configuration.h" #include "../Globals.h" #include "../Knob.h" +#include "../Resources.h" #include <vector> +#include <sstream> using namespace std; @@ -35,18 +37,33 @@ //***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +BEGIN_EVENT_TABLE(JZMetronomeSettingsDialog, wxDialog) + + EVT_KNOB_CHANGED(IDC_KB_VOLUME, JZMetronomeSettingsDialog::OnVolumeChange) + +END_EVENT_TABLE() + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- JZMetronomeSettingsDialog::JZMetronomeSettingsDialog( wxWindow* pParent, JZMetronomeInfo& MetronomeInfo) : wxDialog(pParent, wxID_ANY, wxString("Metronome Settings")), mMetronomeInfo(MetronomeInfo), - mpSynthesizerListbox(0), - mpStartListbox(0) + mpVelocityKnob(0), + mpVelocityValue(0), + mpAccentedCheckBox(0), + mpNormalListbox(0), + mpAccentedListbox(0) { - JZKnob* pKnob = new JZKnob(this, wxID_ANY, 100, 0, 128); + mpVelocityKnob = new JZKnob(this, IDC_KB_VOLUME, 100, 0, 127); - mpSynthesizerListbox = new wxListBox(this, wxID_ANY); + mpVelocityValue = new wxStaticText(this, wxID_ANY, "127"); + mpAccentedCheckBox = new wxCheckBox(this, wxID_ANY, "Use Accented Click"); + + mpNormalListbox = new wxListBox(this, wxID_ANY); + int Selection = 0; int Index = 0; for ( @@ -54,21 +71,21 @@ iPair != gSynthesizerTypes.end(); ++iPair, ++Index) { - mpSynthesizerListbox->Append(iPair->first.c_str()); + mpNormalListbox->Append(iPair->first.c_str()); if (strcmp(iPair->first.c_str(), gpConfig->StrValue(C_SynthType)) == 0) { Selection = Index; } } - mpSynthesizerListbox->SetSelection(Selection); + mpNormalListbox->SetSelection(Selection); - mpStartListbox = new wxListBox(this, wxID_ANY); + mpAccentedListbox = new wxListBox(this, wxID_ANY); - mpStartListbox->Append("Never"); - mpStartListbox->Append("Song Start"); - mpStartListbox->Append("Start Play"); + mpAccentedListbox->Append("Never"); + mpAccentedListbox->Append("Song Start"); + mpAccentedListbox->Append("Start Play"); - mpStartListbox->SetSelection(gpConfig->GetValue(C_SendSynthReset)); + mpAccentedListbox->SetSelection(gpConfig->GetValue(C_SendSynthReset)); wxButton* pOkButton = new wxButton(this, wxID_OK, "&OK"); wxButton* pCancelButton = new wxButton(this, wxID_CANCEL, "Cancel"); @@ -79,24 +96,34 @@ wxBoxSizer* pListControlSizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* pButtonSizer = new wxBoxSizer(wxHORIZONTAL); + pTopSizer->Add( + new wxStaticText(this, wxID_ANY, "Velocity"), + 0, + wxCENTER | wxALL, + 2); + + pTopSizer->Add(mpVelocityKnob, 0, wxCENTER | wxALL, 2); + + pTopSizer->Add(mpVelocityValue, 0, wxCENTER | wxALL, 2); + + pTopSizer->Add(mpAccentedCheckBox, 0, wxCENTER | wxALL, 2); + wxBoxSizer* pLeftSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* pRightSizer = new wxBoxSizer(wxVERTICAL); - pLeftSizer->Add(pKnob, 0, wxALL, 2); - pLeftSizer->Add( - new wxStaticText(this, wxID_ANY, "Synthesizer Type"), + new wxStaticText(this, wxID_ANY, "Normal Click"), 0, wxALL, 2); - pLeftSizer->Add(mpSynthesizerListbox, 0, wxGROW | wxALL, 2); + pLeftSizer->Add(mpNormalListbox, 0, wxGROW | wxALL, 2); pRightSizer->Add( - new wxStaticText(this, wxID_ANY, "Send MIDI Reset"), + new wxStaticText(this, wxID_ANY, "Accented Click:"), 0, wxALL, 2); - pRightSizer->Add(mpStartListbox, 0, wxALL, 2); + pRightSizer->Add(mpAccentedListbox, 0, wxALL, 2); pListControlSizer->Add(pLeftSizer, 0, wxALL, 3); pListControlSizer->Add(pRightSizer, 0, wxALL, 3); @@ -115,3 +142,13 @@ pTopSizer->SetSizeHints(this); pTopSizer->Fit(this); } + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZMetronomeSettingsDialog::OnVolumeChange(JZKnobEvent& Event) +{ + int Value = Event.GetValue(); + ostringstream Oss; + Oss << Value; + mpVelocityValue->SetLabel(Oss.str().c_str()); +} \ No newline at end of file Modified: trunk/jazz/src/Dialogs/MetronomeSettingsDialog.h =================================================================== --- trunk/jazz/src/Dialogs/MetronomeSettingsDialog.h 2008-04-06 05:09:36 UTC (rev 416) +++ trunk/jazz/src/Dialogs/MetronomeSettingsDialog.h 2008-04-06 05:10:26 UTC (rev 417) @@ -22,6 +22,8 @@ #define JZ_METRONOMESETTINGDIALOG_H class JZMetronomeInfo; +class JZKnob; +class JZKnobEvent; //***************************************************************************** //***************************************************************************** @@ -35,11 +37,23 @@ private: + void OnVolumeChange(JZKnobEvent& Event); + + private: + JZMetronomeInfo& mMetronomeInfo; - wxListBox* mpSynthesizerListbox; + JZKnob* mpVelocityKnob; - wxListBox* mpStartListbox; + wxStaticText* mpVelocityValue; + + wxCheckBox* mpAccentedCheckBox; + + wxListBox* mpNormalListbox; + + wxListBox* mpAccentedListbox; + + DECLARE_EVENT_TABLE(); }; #endif // !defined(JZ_METRONOMESETTINGDIALOG_H) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-06 18:52:29
|
Revision: 421 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=421&view=rev Author: pstieber Date: 2008-04-06 11:52:27 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Removed obsolete metronome dialog. Removed Paths: ------------- trunk/jazz/src/Dialogs/metronomeSettings.cpp trunk/jazz/src/Dialogs/metronomeSettings.h Deleted: trunk/jazz/src/Dialogs/metronomeSettings.cpp =================================================================== --- trunk/jazz/src/Dialogs/metronomeSettings.cpp 2008-04-06 18:26:26 UTC (rev 420) +++ trunk/jazz/src/Dialogs/metronomeSettings.cpp 2008-04-06 18:52:27 UTC (rev 421) @@ -1,129 +0,0 @@ -/* -** Alacrity Midi Sequencer -** -** Some Code Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. -** I don't know why it says "All Rights Reserved" and then is licensed GPL -** -** 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 "metronomeSettings.h" - -#ifndef __PORTING - - -tMetronomeSettingsDlg::tMetronomeSettingsDlg(tEventWin *w) -: wxForm( USED_WXFORM_BUTTONS ) -{ - EventWin = w; - IsAccented = ((tTrackWin*)EventWin)->MetronomeInfo.IsAccented; - KeyAcc = ((tTrackWin*)EventWin)->MetronomeInfo.KeyAcc; - KeyNorm = ((tTrackWin*)EventWin)->MetronomeInfo.KeyNorm; - Veloc = ((tTrackWin*)EventWin)->MetronomeInfo.Veloc; - - numNames = 0; - for (int i = 0; Config.DrumName(i).Name; i++) - { - if (Config.DrumName(i).Name[0]) - { - index2Pitch[numNames] = Config.DrumName(i).Value - 1; - pitch2Index[Config.DrumName(i).Value - 1] = numNames; - index2Name[numNames++] = Config.DrumName(i).Name; - } - } - KeyAccName = copystring( index2Name[ pitch2Index[ KeyAcc ] ] ); - KeyNormName = copystring( index2Name[ pitch2Index[ KeyNorm ] ] ); -} - - -void tMetronomeSettingsDlg::OnHelp() -{ - HelpInstance->ShowTopic("Metronome Settings"); -} - - -void tMetronomeSettingsDlg::OnCancel() -{ - EventWin->DialogBox = 0; - wxForm::OnCancel(); -} - - -void tMetronomeSettingsDlg::OnOk() -{ - ((tTrackWin*)EventWin)->MetronomeInfo.IsAccented = IsAccented; - int i; - for (i = 0; i < numNames; i++) - { - if ( !strcmp(index2Name[i], KeyNormName) ) - break; - } - if (i < numNames) - ((tTrackWin*)EventWin)->MetronomeInfo.KeyNorm = index2Pitch[i]; - for (i = 0; i < numNames; i++) - { - if (!strcmp( index2Name[i], KeyAccName ) ) - break; - } - if (i < numNames) - ((tTrackWin*)EventWin)->MetronomeInfo.KeyAcc = index2Pitch[i]; - ((tTrackWin*)EventWin)->MetronomeInfo.Veloc = Veloc; - EventWin->Redraw(); - EventWin->DialogBox = 0; - wxForm::OnOk(); -} - - - -void tMetronomeSettingsDlg::EditForm(wxPanel *panel) -{ - Add(wxMakeFormBool( "Accented", &IsAccented )); - Add(wxMakeFormNewLine()); - Add(wxMakeFormShort( " Velocity:", &Veloc, wxFORM_DEFAULT, - new wxList(wxMakeConstraintRange(0.0, 127.0), 0))); - Add(wxMakeFormNewLine()); - Add(wxMakeFormString( "Normal click:", - &KeyNormName, - wxFORM_DEFAULT, - new wxList(wxMakeConstraintStrings( - index2Name[ pitch2Index[ 37 ] ], - index2Name[ pitch2Index[ 42 ] ], - index2Name[ pitch2Index[ 56 ] ], - 0 ), 0), - NULL, - wxVERTICAL - ) - ); - Add(wxMakeFormNewLine()); - Add(wxMakeFormString( "Accented click:", - &KeyAccName, - wxFORM_DEFAULT, - new wxList(wxMakeConstraintStrings( - index2Name[ pitch2Index[ 36 ] ], - index2Name[ pitch2Index[ 38 ] ], - index2Name[ pitch2Index[ 54 ] ], - 0 ), 0), - NULL, - wxVERTICAL - ) - ); - AssociatePanel(panel); -} - - - -#endif // Porting - Deleted: trunk/jazz/src/Dialogs/metronomeSettings.h =================================================================== --- trunk/jazz/src/Dialogs/metronomeSettings.h 2008-04-06 18:26:26 UTC (rev 420) +++ trunk/jazz/src/Dialogs/metronomeSettings.h 2008-04-06 18:52:27 UTC (rev 421) @@ -1,61 +0,0 @@ -/* -** Alacrity Midi Sequencer -** -** Some Code Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. -** I don't know why it says "All Rights Reserved" and then is licensed GPL -** -** 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 METRONOMESETTINGS -#define METRONOMESETTINGS - -#include "../eventwin.h" -#include "../trackwin.h" - -#ifndef __PORTING - -// ****************************************************************** -// Metronome-Settings Dialog -// ****************************************************************** - -class tMetronomeSettingsDlg : public wxForm -{ - public: - tEventWin *EventWin; - int IsAccented; - int KeyAcc; - int KeyNorm; - int Veloc; - - char *index2Name[130]; - int index2Pitch[130]; - int pitch2Index[130]; - int numNames; - char *KeyAccName; - char *KeyNormName; - - tMetronomeSettingsDlg(tEventWin *w); - void EditForm(wxPanel *panel); - virtual void OnOk(); - virtual void OnCancel(); - virtual void OnHelp(); -}; - -#endif // Porting - -#endif // MetronomeSettings - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-06 22:49:12
|
Revision: 428 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=428&view=rev Author: pstieber Date: 2008-04-06 15:49:11 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Removed obsolete files. Removed Paths: ------------- trunk/jazz/src/Dialogs/synthSettings.cpp trunk/jazz/src/Dialogs/synthSettings.h Deleted: trunk/jazz/src/Dialogs/synthSettings.cpp =================================================================== --- trunk/jazz/src/Dialogs/synthSettings.cpp 2008-04-06 22:47:54 UTC (rev 427) +++ trunk/jazz/src/Dialogs/synthSettings.cpp 2008-04-06 22:49:11 UTC (rev 428) @@ -1,140 +0,0 @@ -/* -** Alacrity Midi Sequencer -** -** Some Code Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. -** I don't know why it says "All Rights Reserved" and then is licensed GPL -** -** 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 "synthSettings.h" - -#ifndef __PORTING - -tSynthSettingsDlg::tSynthSettingsDlg(tEventWin *w) -: wxForm( USED_WXFORM_BUTTONS ) -{ - EventWin = w; - SynthTypeName = copystring( Config.StrValue(C_SynthType) ); - OldSynthTypeName = copystring( Config.StrValue(C_SynthType) ); - - ResetString[0] = "Never"; - ResetString[1] = "Song start"; - ResetString[2] = "Start play"; - - ResetVal = copystring( ResetString[Config( C_SendSynthReset )] ); -} - -void tSynthSettingsDlg::OnHelp() -{ - HelpInstance->ShowTopic("Synthesizer Type Settings"); -} - -void tSynthSettingsDlg::OnCancel() -{ - EventWin->DialogBox = 0; - wxForm::OnCancel(); -} - -void tSynthSettingsDlg::OnOk() -{ - int i; - char* str = copystring( SynthTypeName ); - - for (i = 0; i < NumSynthTypes; i++) - { - if (!strcmp( str, SynthTypes[i].Name)) - break; - } - - Config.Put( C_SynthConfig, SynthTypeFiles[i].Name ); - Config.StrValue(C_SynthType) = copystring(SynthTypes[i].Name); - - delete str; - str = copystring( ResetVal ); - - for (i = 0; i < NumResetStrings; i++) - { - if (!strcmp( str, ResetString[i])) - break; - } - - Config( C_SendSynthReset ) = i; - Config.Put( C_SendSynthReset ); - - if ( Config( C_SynthDialog ) ) { - Config( C_SynthDialog ) = 0; - Config.Put( C_SynthDialog ); - } - - if (strcmp( SynthTypeName, OldSynthTypeName )) - wxMessageBox("Restart jazz for the changes to take effect", "Info", wxOK); - - delete str; - delete SynthTypeName; - delete OldSynthTypeName; - delete ResetVal; - EventWin->Redraw(); - EventWin->DialogBox = 0; - wxForm::OnOk(); -} - -void tSynthSettingsDlg::EditForm(wxPanel *panel) -{ - int i; - // following adapted from wxwin/src/base/wb_form.cc - wxList *list = new wxList; - for (i = 0; i < NumSynthTypes; i++) - if (*SynthTypes[i].Name) // omit empty entries - list->Append((wxObject *)copystring(SynthTypes[i].Name)); - - wxFormItemConstraint *constraint = wxMakeConstraintStrings(list); - - Add(wxMakeFormNewLine()); - Add(wxMakeFormString( "Synthesizer type:", - &SynthTypeName, - //wxFORM_RADIOBOX, - wxFORM_DEFAULT, - new wxList(constraint, 0), - NULL, - wxVERTICAL - ) - ); - - // following adapted from wxwin/src/base/wb_form.cc - wxList *list2 = new wxList; - for (i = 0; i < NumResetStrings; i++) - list2->Append((wxObject *)copystring( ResetString[i] )); - - wxFormItemConstraint *constraint2 = wxMakeConstraintStrings(list2); - - Add(wxMakeFormNewLine()); - Add(wxMakeFormString( "Auto send MIDI reset:", - &ResetVal, - //wxFORM_RADIOBOX, - wxFORM_DEFAULT, - new wxList(constraint2, 0), - NULL, - wxVERTICAL - ) - ); - - Add(wxMakeFormNewLine()); - - AssociatePanel(panel); -} - -#endif // Porting Deleted: trunk/jazz/src/Dialogs/synthSettings.h =================================================================== --- trunk/jazz/src/Dialogs/synthSettings.h 2008-04-06 22:47:54 UTC (rev 427) +++ trunk/jazz/src/Dialogs/synthSettings.h 2008-04-06 22:49:11 UTC (rev 428) @@ -1,54 +0,0 @@ -/* -** Alacrity Midi Sequencer -** -** Some Code Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. -** I don't know why it says "All Rights Reserved" and then is licensed GPL -** -** 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 SYNTHSETTINGS -#define SYNTHSETTINGS -#include "../eventwin.h" -#include "../trackwin.h" - -#ifndef __PORTING - -// ****************************************************************** -// Synth settings dialog -// ****************************************************************** - -#define NumResetStrings 3 - -class tSynthSettingsDlg : public wxPropertyListForm -{ - public: - tEventWin *EventWin; - char *SynthTypeName; - char *OldSynthTypeName; - char *ResetVal; - char *ResetString[NumResetStrings]; - tSynthSettingsDlg(tEventWin *w); - void EditForm(wxPanel *panel); - virtual void OnOk(); - virtual void OnCancel(); - virtual void OnHelp(); -}; - -#endif // Porting - -#endif // Synthsettings - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-19 23:21:38
|
Revision: 465 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=465&view=rev Author: pstieber Date: 2008-04-19 16:21:32 -0700 (Sat, 19 Apr 2008) Log Message: ----------- Added a new version of the key on dialog. Added Paths: ----------- trunk/jazz/src/Dialogs/KeyOnDialog.cpp trunk/jazz/src/Dialogs/KeyOnDialog.h Added: trunk/jazz/src/Dialogs/KeyOnDialog.cpp =================================================================== --- trunk/jazz/src/Dialogs/KeyOnDialog.cpp (rev 0) +++ trunk/jazz/src/Dialogs/KeyOnDialog.cpp 2008-04-19 23:21:32 UTC (rev 465) @@ -0,0 +1,273 @@ +//***************************************************************************** +// 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 "WxWidgets.h" + +#include "KeyOnDialog.h" + +#include "../Globals.h" +#include "../Project.h" +#include "../Events.h" +#include "../Knob.h" +#include "../KeyStringConverters.h" +#include "../Resources.h" + +#include <sstream> + +using namespace std; + +//***************************************************************************** +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +BEGIN_EVENT_TABLE(JZKeyOnDialog, wxDialog) + + EVT_KNOB_CHANGED(IDC_KB_VELOCITY, JZKeyOnDialog::OnVelocityChange) + + EVT_KNOB_CHANGED(IDC_KB_OFF_VELOCITY, JZKeyOnDialog::OnOffVelocityChange) + + EVT_KNOB_CHANGED(IDC_KB_CHANNEL, JZKeyOnDialog::OnChannelChange) + + EVT_BUTTON(wxID_HELP, JZKeyOnDialog::OnHelp) + +END_EVENT_TABLE() + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZKeyOnDialog::JZKeyOnDialog(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 JZKeyOnDialog::TransferDataToWindow() +{ + string KeyString; + KeyToString(mpEvent->mKey, KeyString); + mpPitchEdit->ChangeValue(KeyString.c_str()); + + ostringstream Oss; + + Oss << (int)mpEvent->mVelocity; + mpVelocityValue->SetLabel(Oss.str().c_str()); + + mpVelocityKnob->SetValue(mpEvent->mVelocity); + + Oss.str(""); + Oss << (int)mpEvent->GetOffVelocity(); + mpOffVelocityValue->SetLabel(Oss.str().c_str()); + + mpOffVelocityKnob->SetValue(mpEvent->GetOffVelocity()); + + wxString LengthString; + LengthString << mpEvent->Length; + mpLengthEdit->ChangeValue(LengthString); + + Oss.str(""); + Oss << (int)mpEvent->Channel + 1; + mpChannelValue->SetLabel(Oss.str().c_str()); + + mpChannelKnob->SetValue(mpEvent->Channel + 1); + + string ClockString; + gpProject->ClockToString(mpEvent->GetClock(), ClockString); + mpClockEdit->ChangeValue(ClockString.c_str()); + + return true; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool JZKeyOnDialog::TransferDataFromWindow() +{ + wxString KeyString = mpPitchEdit->GetValue(); + mpEvent->mKey = StringToKey(KeyString.c_str()); + + mpEvent->mVelocity = mpVelocityKnob->GetValue(); + + mpEvent->SetOffVelocity(mpOffVelocityKnob->GetValue()); + + wxString LengthString = mpLengthEdit->GetValue(); + istringstream Iss(LengthString.c_str()); + Iss >> mpEvent->Length; + + mpEvent->Channel = mpChannelKnob->GetValue() - 1; + + wxString ClockString = mpClockEdit->GetValue(); + int Clock = gpProject->StringToClock(ClockString.c_str()); + mpEvent->SetClock(Clock); + + return true; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZKeyOnDialog::OnVelocityChange(JZKnobEvent& Event) +{ + int Value = Event.GetValue(); + ostringstream Oss; + Oss << Value; + mpVelocityValue->SetLabel(Oss.str().c_str()); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZKeyOnDialog::OnOffVelocityChange(JZKnobEvent& Event) +{ + int Value = Event.GetValue(); + ostringstream Oss; + Oss << Value; + mpOffVelocityValue->SetLabel(Oss.str().c_str()); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZKeyOnDialog::OnChannelChange(JZKnobEvent& Event) +{ + int Value = Event.GetValue(); + ostringstream Oss; + Oss << Value; + mpChannelValue->SetLabel(Oss.str().c_str()); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZKeyOnDialog::OnHelp(wxCommandEvent& Event) +{ +// gpHelpInstance->ShowTopic("Key On Dialog"); +} Property changes on: trunk/jazz/src/Dialogs/KeyOnDialog.cpp ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/jazz/src/Dialogs/KeyOnDialog.h =================================================================== --- trunk/jazz/src/Dialogs/KeyOnDialog.h (rev 0) +++ trunk/jazz/src/Dialogs/KeyOnDialog.h 2008-04-19 23:21:32 UTC (rev 465) @@ -0,0 +1,71 @@ +//***************************************************************************** +// 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_KEYONDIALOG_H +#define JZ_KEYONDIALOG_H + +class tKeyOn; +class JZKnobEvent; +class JZKnob; + +//***************************************************************************** +//***************************************************************************** +class JZKeyOnDialog : public wxDialog +{ + public: + + JZKeyOnDialog(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; +// int mPitch; +// int mVelocity; +// int mLength; +// int mOffVelocity; + + wxTextCtrl* mpPitchEdit; + wxStaticText* mpVelocityValue; + JZKnob* mpVelocityKnob; + wxStaticText* mpOffVelocityValue; + JZKnob* mpOffVelocityKnob; + wxTextCtrl* mpLengthEdit; + wxStaticText* mpChannelValue; + JZKnob* mpChannelKnob; + wxTextCtrl* mpClockEdit; + + DECLARE_EVENT_TABLE(); +}; + +#endif // !defined(JZ_KEYONDIALOG_H) Property changes on: trunk/jazz/src/Dialogs/KeyOnDialog.h ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-21 05:29:19
|
Revision: 471 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=471&view=rev Author: pstieber Date: 2008-04-20 22:29:17 -0700 (Sun, 20 Apr 2008) Log Message: ----------- Started adding a track settings dialog. Added Paths: ----------- trunk/jazz/src/Dialogs/TrackDialog.cpp trunk/jazz/src/Dialogs/TrackDialog.h Added: trunk/jazz/src/Dialogs/TrackDialog.cpp =================================================================== --- trunk/jazz/src/Dialogs/TrackDialog.cpp (rev 0) +++ trunk/jazz/src/Dialogs/TrackDialog.cpp 2008-04-21 05:29:17 UTC (rev 471) @@ -0,0 +1,125 @@ +//***************************************************************************** +// 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 "WxWidgets.h" + +#include "TrackDialog.h" +#include "../Track.h" +#include "../Configuration.h" +#include "../Globals.h" + +using namespace std; + +//***************************************************************************** +//***************************************************************************** +JZTrackDialog::JZTrackDialog(JZTrack& Track, wxWindow* pParent) + : wxDialog(pParent, wxID_ANY, wxString("Track Settings")), + mTrack(Track), + mpTrackNameEdit(0), + mpPatchListBox(0) +{ + mpTrackNameEdit = new wxTextCtrl(this, wxID_ANY); + + mpPatchListBox = new wxListBox(this, wxID_ANY); + if (Track.IsDrumTrack()) + { + const vector<pair<string, int> >& DrumNames = gpConfig->GetDrumNames(); + for ( + vector<pair<string, int> >::const_iterator iDrumName = + DrumNames.begin(); + iDrumName != DrumNames.end(); + ++iDrumName) + { + const string& DrumName = iDrumName->first; + + if (!DrumName.empty()) + { + mpPatchListBox->Append(DrumName.c_str()); + } + } + } + else + { + const vector<pair<string, int> >& VoiceNames = gpConfig->GetVoiceNames(); + for ( + vector<pair<string, int> >::const_iterator iVoiceName = + VoiceNames.begin(); + iVoiceName != VoiceNames.end(); + ++iVoiceName) + { + const string& VoiceName = iVoiceName->first; + + if (!VoiceName.empty()) + { + mpPatchListBox->Append(VoiceName.c_str()); + } + } + } + + wxButton* pOkButton = new wxButton(this, wxID_OK, "&OK"); + wxButton* pCancelButton = new wxButton(this, wxID_CANCEL, "Cancel"); + wxButton* pHelpButton = new wxButton(this, wxID_HELP, "Help"); + pOkButton->SetDefault(); + + wxBoxSizer* pTopSizer = new wxBoxSizer(wxVERTICAL); + + pTopSizer->Add( + new wxStaticText(this, wxID_ANY, "Track Name:"), + 0, + wxALL, + 2); + pTopSizer->Add(mpTrackNameEdit, 0, wxGROW | wxALL, 2); + + pTopSizer->Add( + new wxStaticText(this, wxID_ANY, "Patch:"), + 0, + wxALL, + 2); + pTopSizer->Add(mpPatchListBox, 0, wxGROW | 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 JZTrackDialog::TransferDataToWindow() +{ + mpTrackNameEdit->ChangeValue(mTrack.GetName()); + + return true; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool JZTrackDialog::TransferDataFromWindow() +{ + return true; +} Property changes on: trunk/jazz/src/Dialogs/TrackDialog.cpp ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/jazz/src/Dialogs/TrackDialog.h =================================================================== --- trunk/jazz/src/Dialogs/TrackDialog.h (rev 0) +++ trunk/jazz/src/Dialogs/TrackDialog.h 2008-04-21 05:29:17 UTC (rev 471) @@ -0,0 +1,50 @@ +//***************************************************************************** +// 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_TRACKDIALOG_H +#define JZ_TRACKDIALOG_H + +class JZTrack; +class wxTextCtrl; + +//***************************************************************************** +//***************************************************************************** +class JZTrackDialog : public wxDialog +{ + public: + + JZTrackDialog(JZTrack& Track, wxWindow* pParent); + + private: + + virtual bool TransferDataToWindow(); + + virtual bool TransferDataFromWindow(); + + private: + + JZTrack& mTrack; + + wxTextCtrl* mpTrackNameEdit; + + wxListBox* mpPatchListBox; +}; + +#endif // !defined(JZ_TRACKDIALOG_H) Property changes on: trunk/jazz/src/Dialogs/TrackDialog.h ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-28 01:31:06
|
Revision: 478 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=478&view=rev Author: pstieber Date: 2008-04-27 18:30:56 -0700 (Sun, 27 Apr 2008) Log Message: ----------- Added a MIDI channel knob control. Modified Paths: -------------- trunk/jazz/src/Dialogs/TrackDialog.cpp trunk/jazz/src/Dialogs/TrackDialog.h Modified: trunk/jazz/src/Dialogs/TrackDialog.cpp =================================================================== --- trunk/jazz/src/Dialogs/TrackDialog.cpp 2008-04-28 01:27:11 UTC (rev 477) +++ trunk/jazz/src/Dialogs/TrackDialog.cpp 2008-04-28 01:30:56 UTC (rev 478) @@ -21,14 +21,30 @@ #include "WxWidgets.h" #include "TrackDialog.h" +#include "../Knob.h" #include "../Track.h" #include "../Configuration.h" #include "../Globals.h" +#include "../Resources.h" +#include <sstream> + using namespace std; //***************************************************************************** //***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +BEGIN_EVENT_TABLE(JZTrackDialog, wxDialog) + + EVT_KNOB_CHANGED(IDC_KB_CHANNEL, JZTrackDialog::OnChannelChange) + + EVT_BUTTON(wxID_HELP, JZTrackDialog::OnHelp) + +END_EVENT_TABLE() + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- JZTrackDialog::JZTrackDialog(JZTrack& Track, wxWindow* pParent) : wxDialog(pParent, wxID_ANY, wxString("Track Settings")), mTrack(Track), @@ -73,6 +89,10 @@ } } + mpChannelValue = new wxStaticText(this, wxID_ANY, "00"); + + mpChannelKnob = new JZKnob(this, IDC_KB_CHANNEL, 0, 1, 16); + wxButton* pOkButton = new wxButton(this, wxID_OK, "&OK"); wxButton* pCancelButton = new wxButton(this, wxID_CANCEL, "Cancel"); wxButton* pHelpButton = new wxButton(this, wxID_HELP, "Help"); @@ -94,6 +114,21 @@ 4); pTopSizer->Add(mpPatchListBox, 0, wxGROW | wxALL, 4); + wxFlexGridSizer* 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); + + wxBoxSizer* pButtonSizer = new wxBoxSizer(wxHORIZONTAL); pButtonSizer->Add(pOkButton, 0, wxALL, 5); pButtonSizer->Add(pCancelButton, 0, wxALL, 5); @@ -117,6 +152,13 @@ int PatchIndex = mTrack.GetPatch() + (mTrack.GetBank() << 8); mpPatchListBox->SetSelection(PatchIndex); + ostringstream Oss; + + Oss << (int)mTrack.Channel; + mpChannelValue->SetLabel(Oss.str().c_str()); + + mpChannelKnob->SetValue(mTrack.Channel); + return true; } @@ -134,7 +176,25 @@ int Bank = (Selection & 0x0000ff00) >> 8; mTrack.SetPatch(Patch); mTrack.SetBank(Bank); + mTrack.Channel = mpChannelKnob->GetValue(); } return true; } + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZTrackDialog::OnChannelChange(JZKnobEvent& Event) +{ + int Value = Event.GetValue(); + ostringstream Oss; + Oss << Value; + mpChannelValue->SetLabel(Oss.str().c_str()); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZTrackDialog::OnHelp(wxCommandEvent& Event) +{ +// gpHelpInstance->ShowTopic("Track Dialog"); +} Modified: trunk/jazz/src/Dialogs/TrackDialog.h =================================================================== --- trunk/jazz/src/Dialogs/TrackDialog.h 2008-04-28 01:27:11 UTC (rev 477) +++ trunk/jazz/src/Dialogs/TrackDialog.h 2008-04-28 01:30:56 UTC (rev 478) @@ -23,6 +23,9 @@ class JZTrack; class wxTextCtrl; +class wxStaticText; +class JZKnobEvent; +class JZKnob; //***************************************************************************** //***************************************************************************** @@ -38,6 +41,10 @@ virtual bool TransferDataFromWindow(); + void OnChannelChange(JZKnobEvent& Event); + + void OnHelp(wxCommandEvent& Event); + private: JZTrack& mTrack; @@ -45,6 +52,12 @@ wxTextCtrl* mpTrackNameEdit; wxListBox* mpPatchListBox; + + wxStaticText* mpChannelValue; + + JZKnob* mpChannelKnob; + + DECLARE_EVENT_TABLE(); }; #endif // !defined(JZ_TRACKDIALOG_H) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |