You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
(58) |
Apr
(100) |
May
(92) |
Jun
(12) |
Jul
|
Aug
|
Sep
(5) |
Oct
(1) |
Nov
(26) |
Dec
(29) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(31) |
Feb
(20) |
Mar
(1) |
Apr
|
May
(5) |
Jun
(10) |
Jul
|
Aug
(2) |
Sep
|
Oct
(2) |
Nov
|
Dec
(1) |
2010 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
(36) |
May
(10) |
Jun
|
Jul
(38) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
(6) |
Mar
(8) |
Apr
|
May
|
Jun
|
Jul
(14) |
Aug
(56) |
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(13) |
Dec
(2) |
2013 |
Jan
(30) |
Feb
|
Mar
(43) |
Apr
(28) |
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
(10) |
Nov
(2) |
Dec
|
2014 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <pst...@us...> - 2008-04-08 23:56:58
|
Revision: 446 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=446&view=rev Author: pstieber Date: 2008-04-08 16:56:56 -0700 (Tue, 08 Apr 2008) Log Message: ----------- Removed an extra const qualifier. Modified Paths: -------------- trunk/jazz/src/HarmonyP.h Modified: trunk/jazz/src/HarmonyP.h =================================================================== --- trunk/jazz/src/HarmonyP.h 2008-04-08 21:14:12 UTC (rev 445) +++ trunk/jazz/src/HarmonyP.h 2008-04-08 23:56:56 UTC (rev 446) @@ -207,7 +207,7 @@ private: - static const std::string const mScaleNames[2][12]; + static const std::string mScaleNames[2][12]; }; inline std::ostream& operator << (std::ostream& os, HBChord const &a) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-08 21:14:39
|
Revision: 445 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=445&view=rev Author: pstieber Date: 2008-04-08 14:14:12 -0700 (Tue, 08 Apr 2008) Log Message: ----------- Made some cosmetic changes. Modified Paths: -------------- trunk/jazz/src/GuitarWindow.cpp trunk/jazz/src/GuitarWindow.h Modified: trunk/jazz/src/GuitarWindow.cpp =================================================================== --- trunk/jazz/src/GuitarWindow.cpp 2008-04-08 21:09:07 UTC (rev 444) +++ trunk/jazz/src/GuitarWindow.cpp 2008-04-08 21:14:12 UTC (rev 445) @@ -31,9 +31,8 @@ //***************************************************************************** // Description: -// This is the guitar window definition. +// This is the guitar window class definition. //***************************************************************************** - //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- bool JZGuitarWindow::mChordMode = false; Modified: trunk/jazz/src/GuitarWindow.h =================================================================== --- trunk/jazz/src/GuitarWindow.h 2008-04-08 21:09:07 UTC (rev 444) +++ trunk/jazz/src/GuitarWindow.h 2008-04-08 21:14:12 UTC (rev 445) @@ -25,7 +25,10 @@ class JZGuitarFrame; -// define a scrollable canvas for drawing onto +//***************************************************************************** +// Description: +// This is the guitar window class declaration. +//***************************************************************************** class JZGuitarWindow : public wxScrolledWindow { public: @@ -100,6 +103,8 @@ DECLARE_EVENT_TABLE() }; +//***************************************************************************** +//***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- inline This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-08 21:09:10
|
Revision: 444 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=444&view=rev Author: pstieber Date: 2008-04-08 14:09:07 -0700 (Tue, 08 Apr 2008) Log Message: ----------- Fixed up guitar fret board drawing. Modified Paths: -------------- trunk/jazz/src/GuitarFrame.cpp trunk/jazz/src/GuitarWindow.cpp trunk/jazz/src/GuitarWindow.h Modified: trunk/jazz/src/GuitarFrame.cpp =================================================================== --- trunk/jazz/src/GuitarFrame.cpp 2008-04-08 17:25:46 UTC (rev 443) +++ trunk/jazz/src/GuitarFrame.cpp 2008-04-08 21:09:07 UTC (rev 444) @@ -61,7 +61,7 @@ wxID_ANY, "Guitar board", wxPoint(20, 20), - wxSize(600, 120), + wxSize(600, 150), wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) { // set the frame icon Modified: trunk/jazz/src/GuitarWindow.cpp =================================================================== --- trunk/jazz/src/GuitarWindow.cpp 2008-04-08 17:25:46 UTC (rev 443) +++ trunk/jazz/src/GuitarWindow.cpp 2008-04-08 21:09:07 UTC (rev 444) @@ -25,6 +25,10 @@ #include "GuitarWindow.h" #include "GuitarFrame.h" +#include <string> + +using namespace std; + //***************************************************************************** // Description: // This is the guitar window definition. @@ -99,8 +103,10 @@ wxHSCROLL | wxVSCROLL | wxNO_FULL_REPAINT_ON_RESIZE), // mpGuitarFrame(pParent), // mpPianoWindow(pPianoWindow) + mMargin(2), mActivePitch(0), - mPlayPitch(0) + mPlayPitch(0), + mpFont(0) { mWidth = Size.GetWidth(); mHeight = Size.GetHeight(); @@ -117,11 +123,20 @@ mStringCount = 6; } mStringHeight = mHeight / (mStringCount + 1); - mFretWidth = mWidth / mFretCount; + mFretWidth = mWidth / mFretCount; + + mpFont = new wxFont(12, wxSWISS, wxNORMAL, wxNORMAL); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +JZGuitarWindow::~JZGuitarWindow() +{ + delete mpFont; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void JZGuitarWindow::ClearBuffer() { // piano->PasteBuffer.Clear(); @@ -145,6 +160,8 @@ wxClientDC Dc(this); PrepareDC(Dc); + Dc.SetFont(*mpFont); + Dc.SetTextBackground(GetForegroundColour()); ShowPitch(Dc, Pitch); } @@ -162,23 +179,14 @@ //----------------------------------------------------------------------------- void JZGuitarWindow::OnDraw(wxDC& Dc) { - Dc.SetFont(*wxSMALL_FONT); + Dc.SetFont(*mpFont); - //Dc.SetFont(wxNORMAL_FONT); - //mpFont = new wxFont(12, wxSWISS, wxNORMAL, wxNORMAL); - //Dc.SetFont(mpFont); - - mpFont = 0; - - Dc.GetTextExtent("xG#", &mTextWidth, &mTextHeight); - GetSize(&mWidth, &mHeight); Dc.Clear(); DrawBoard(Dc); DrawPitch(Dc, mActivePitch, true); -// DrawBuffer(Dc, piano->PasteBuffer, true); } //----------------------------------------------------------------------------- @@ -190,14 +198,14 @@ mStringHeight = mHeight / (mStringCount + 1); mFretWidth = mWidth / mFretCount; - // paint strings - for (i = 0; i < mStringCount; i++) + // Paint the guitar strings. + for (i = 0; i < mStringCount; ++i) { int y = mHeight * (i + 1) / (mStringCount + 1); Dc.DrawLine(0, y, mWidth, y); } - // paint frets + // Paint the guitar frets. int y1 = mHeight / (mStringCount + 1); int y2 = mHeight * (mStringCount) / (mStringCount + 1); int d1 = mHeight / 5; @@ -235,7 +243,7 @@ //----------------------------------------------------------------------------- void JZGuitarWindow::DrawPitch(wxDC& Dc, int Pitch, int String, bool Show) { - static const char* KeyNames[12] = + static const string KeyNames[12] = { "C", "C#", @@ -251,28 +259,45 @@ "B" }; - int x = (Pitch - mpPitches[String] - 1) * mWidth / mFretCount + mFretWidth / 3; + int x = + (Pitch - mpPitches[String] - 1) * mWidth / mFretCount + mFretWidth / 3; if (x < 0 || x > mWidth) { return; } - int y = mHeight * (String + 1) / (mStringCount + 1) - int(mTextHeight / 2); - int h = mTextHeight + 1; + int TextWidth, TextHeight; + Dc.GetTextExtent(KeyNames[Pitch % 12].c_str(), &TextWidth, &TextHeight); + int y = mHeight * (String + 1) / (mStringCount + 1) - int(TextHeight / 2); + + wxPen OldPen = Dc.GetPen(); Dc.SetPen(*wxTRANSPARENT_PEN); - Dc.SetBrush(*wxWHITE_BRUSH); - Dc.DrawRectangle(x, y, mTextWidth, h); + wxBrush OldBrush = Dc.GetBrush(); + wxBrush Brush(GetBackgroundColour()); + Dc.SetBrush(Brush); + Dc.DrawRectangle( + x - mMargin, + y - mMargin, + TextWidth + 2 * mMargin, + TextHeight + 2 * mMargin); Dc.SetPen(*wxBLACK_PEN); - Dc.SetBrush(*wxBLACK_BRUSH); + Dc.SetBrush(OldBrush); + if (Show) { - Dc.DrawText((char *)KeyNames[Pitch % 12], x, y); + // Draw the note name. + Dc.DrawText(KeyNames[Pitch % 12].c_str(), x, y); } else { - int YPosition = y + mTextHeight / 2; - Dc.DrawLine(x, YPosition, x + mTextWidth, YPosition); + // Draw the guitar string. + int YPosition = y + TextHeight / 2; + Dc.DrawLine( + x - mMargin, + YPosition, + x + TextWidth + 2 * mMargin, + YPosition); } } @@ -285,7 +310,6 @@ DrawPitch(Dc, mActivePitch, false); mActivePitch = Pitch; DrawPitch(Dc, mActivePitch, true); -// DrawBuffer(Dc, mpPianoWindow->PasteBuffer, true); } } @@ -330,6 +354,8 @@ int Pitch = Xy2Pitch(x, y); + Dc.SetFont(*mpFont); + Dc.SetTextBackground(GetForegroundColour()); ShowPitch(Dc, Pitch); } Modified: trunk/jazz/src/GuitarWindow.h =================================================================== --- trunk/jazz/src/GuitarWindow.h 2008-04-08 17:25:46 UTC (rev 443) +++ trunk/jazz/src/GuitarWindow.h 2008-04-08 21:09:07 UTC (rev 444) @@ -35,6 +35,8 @@ const wxPoint& Position, const wxSize& Size); + virtual ~JZGuitarWindow(); + virtual void OnDraw(wxDC& Dc); void ClearBuffer(); @@ -88,7 +90,7 @@ int mWidth, mHeight; int mStringHeight, mFretWidth; // rounded values - int mTextWidth, mTextHeight; + int mMargin; int mActivePitch; // mouse move int mPlayPitch; // sound int put_clock; // left up This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-08 17:25:58
|
Revision: 443 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=443&view=rev Author: pstieber Date: 2008-04-08 10:25:46 -0700 (Tue, 08 Apr 2008) Log Message: ----------- Converted some char* variables and functions to std::string. Modified Paths: -------------- trunk/jazz/src/Harmony.cpp trunk/jazz/src/HarmonyP.cpp trunk/jazz/src/HarmonyP.h Modified: trunk/jazz/src/Harmony.cpp =================================================================== --- trunk/jazz/src/Harmony.cpp 2008-04-08 14:03:32 UTC (rev 442) +++ trunk/jazz/src/Harmony.cpp 2008-04-08 17:25:46 UTC (rev 443) @@ -1057,12 +1057,12 @@ Rectangle.width, Rectangle.height); - const char* pName = Context.ChordName(); + string ChordName = Context.GetChordName(); int TextWidth, TextHeight; - Dc.GetTextExtent(pName, &TextWidth, &TextHeight); + Dc.GetTextExtent(ChordName.c_str(), &TextWidth, &TextHeight); Dc.DrawText( - pName, + ChordName.c_str(), Rectangle.x + (Rectangle.width - TextWidth) / 2, Rectangle.y + (Rectangle.height - TextHeight) / 2); } @@ -1110,7 +1110,7 @@ { JZRectangle Rectangle; ChordRect(Rectangle, Context); - Dc.DrawText(Context.ScaleName(), 5, Rectangle.y); + Dc.DrawText(Context.GetScaleName().c_str(), 5, Rectangle.y); } } @@ -1518,7 +1518,7 @@ struct tNamedChord { - const char* mpName; + const std::string mName; int bits; }; @@ -1542,7 +1542,7 @@ { " 75-", 0x451}, }; -tNamedChord scale_names[n_scale_names] = +tNamedChord mScaleNames[n_scale_names] = { { "***** major scales *****", 0x0}, { "maj I (ionic)", 0xab5}, @@ -1698,13 +1698,17 @@ scale_chk[i] = new wxCheckBox(this, wxID_ANY, " ", wxPoint(x, y+2*h));//(wxFunction)ScaleCheck, if (notename[i]) { - (void) new wxStaticText(this, wxID_ANY, (char *)notename[i], wxPoint(x, y+3*h)); + new wxStaticText(this, wxID_ANY, notename[i], wxPoint(x, y + 3 * h)); } - (void) new wxStaticText(this, wxID_ANY, (char *)HBChord::ScaleName(i + chord_key), wxPoint(x, y+0*h)); + new wxStaticText( + this, + wxID_ANY, + HBChord::ScaleName(i + chord_key), + wxPoint(x, y + 0 * h)); } y += 4*h; - // list boxes x y w h + // list boxes x y w h #ifdef OBSOLETE SetLabelPosition(wxVERTICAL); #endif @@ -1713,7 +1717,7 @@ for (i = 0; i < n_chord_names; i++) { - cnames[i] = (char *)chord_names[i].mpName; + cnames[i] = chord_names[i].mName; } chord_lst = new wxListBox(this, -1, wxPoint(10, y), wxSize(100, 200), n_chord_names, cnames, wxLB_SINGLE| wxLB_NEEDED_SB);//"Chords" @@ -1723,7 +1727,7 @@ wxString* snames = new wxString[n_scale_names]; for (i = 0; i < n_scale_names; i++) { - snames[i] = (char *)scale_names[i].mpName; + snames[i] = mScaleNames[i].mName; } scale_lst = new wxListBox( this, @@ -1755,9 +1759,9 @@ { // show single notes int i; - char buf[30]; - chord.Name(buf, ChordKey(0)); - chord_msg->SetLabel(buf); + string ChordName; + chord.CreateName(ChordName, ChordKey(0)); + chord_msg->SetLabel(ChordName.c_str()); for (i = 0; i < 12; i++) { chord_chk[i]->SetValue(0 != chord.Contains(ChordKey(i))); @@ -1784,11 +1788,11 @@ HBChord s = scale; s.Rotate(-ScaleKey()); i = chord_lst->GetSelection(); - if (i < 0 || s.Keys() != scale_names[i].bits) + if (i < 0 || s.Keys() != mScaleNames[i].bits) { for (i = 0; i < n_scale_names; i++) { - if (scale_names[i].bits == s.Keys()) + if (mScaleNames[i].bits == s.Keys()) { scale_lst->SetSelection(i); break; @@ -1863,7 +1867,6 @@ void HBContextDlg::OnChordCheck() { - char buf[30]; chord.Clear(); for (int i = 0; i < 12; i++) { @@ -1872,8 +1875,9 @@ chord += ChordKey(i); } } - chord.Name(buf, ChordKey()); - chord_msg->SetLabel(buf); + string ChordName; + chord.CreateName(ChordName, ChordKey()); + chord_msg->SetLabel(ChordName.c_str()); RestartPlayer(); } @@ -1910,7 +1914,7 @@ int i = scale_lst->GetSelection(); if (i >= 0) { - HBChord s(scale_names[i].bits); + HBChord s(mScaleNames[i].bits); s.Rotate(ScaleKey()); scale = s; ShowValues(); Modified: trunk/jazz/src/HarmonyP.cpp =================================================================== --- trunk/jazz/src/HarmonyP.cpp 2008-04-08 14:03:32 UTC (rev 442) +++ trunk/jazz/src/HarmonyP.cpp 2008-04-08 17:25:46 UTC (rev 443) @@ -25,13 +25,15 @@ #include <assert.h> #include <string.h> +#include <iostream> + using namespace std; // ======================================================================== // HBChord // ======================================================================== -const char *const HBChord::scale_names[2][12] = +const string const HBChord::mScaleNames[2][12] = { { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" }, { "C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab", "A", "Bb", "B" } @@ -54,17 +56,18 @@ if (l >= 0) operator += (l); } -void HBChord::Name(char *buf, int key, int flat) +void HBChord::CreateName(string& ChordName, int key, int flat) { HBChord c = *this; - strcpy(buf, ScaleName(key, flat)); - int i = strlen(buf); - c.Rotate(-key); // transpose to C + ChordName = ScaleName(key, flat); - // special cases + // Transpose to C. + c.Rotate(-key); + + // Handle special cases. if (c == C0) { - strcat(buf, "o"); + ChordName.append("o"); return; } @@ -79,21 +82,24 @@ if (c.Contains(3)) { if (!c.Contains(4)) - buf[i++] = 'm'; + { + ChordName.append("m"); + } else + { sharp9 = true; + } } // 7 if (c.Contains(11)) { - buf[i++] = 'j'; - buf[i++] = '7'; + ChordName.append("j7"); seven = true; } else if (c.Contains(10)) { - buf[i++] = '7'; + ChordName.append("j"); seven = true; } @@ -102,32 +108,35 @@ { if (!c.Contains(4)) { - strcpy(buf + i, "sus4"); - i += 5; + ChordName.append("sus4"); } else + { nat11 = true; + } } // 5 if (c.Contains(7)) { if (c.Contains(6)) + { sharp11 = true; + } if (c.Contains(8)) + { flat13 = true; + } } else { if (c.Contains(6)) { - buf[i++] = '5'; - buf[i++] = '-'; + ChordName.append("5-"); } if (c.Contains(8)) { - buf[i++] = '5'; - buf[i++] = '+'; + ChordName.append("5+"); } } @@ -135,56 +144,49 @@ if (c.Contains(9)) { if (!seven) - buf[i++] = '6'; + { + ChordName.append("6"); + } else + { nat13 = true; + } } // 9 if (c.Contains(1)) { - buf[i++] = '9'; - buf[i++] = '-'; + ChordName.append("9-"); } if (c.Contains(2)) { - buf[i++] = '9'; + ChordName.append("5"); } if (sharp9) { - buf[i++] = '9'; - buf[i++] = '+'; + ChordName.append("9+"); } // 11 if (nat11) { - buf[i++] = '1'; - buf[i++] = '1'; - buf[i++] = ' '; + ChordName.append("11 "); } if (sharp11) { - buf[i++] = '1'; - buf[i++] = '1'; - buf[i++] = '+'; + ChordName.append("11+"); } // 13 if (flat13) { - buf[i++] = '1'; - buf[i++] = '3'; - buf[i++] = '-'; + ChordName.append("13-"); } if (nat13) { - buf[i++] = '1'; - buf[i++] = '3'; + ChordName.append("13"); } - - buf[i++] = 0; } @@ -332,22 +334,21 @@ Initialize(); } -const char * HBContext::ChordName() const +string HBContext::GetChordName() const { #if NAME_TABLE - // use table of chordnames (fast) - static char buf[20]; + // Use the table of chord names (fast). int chord_key = ChordKey(); - strcpy(buf, HBChord::ScaleName(chord_key, flat_keys[scale_nr])); - strcat(buf, chord_names[scale_type][chord_nr]); - return buf; // "Dm75-" + string ChordName = HBChord::ScaleName(chord_key, flat_keys[scale_nr]); + ChordName.append(chord_names[scale_type][chord_nr]); + return ChordName; #else - // compute chordname (slow, but flexible) - static char buf[20]; + // Compute the chord name (slow, but flexible). int chord_key = ChordKey(); HBChord chord = Chord(); - chord.Name(buf, chord_key, flat_keys[chord_key]); - return buf; + string ChordName; + chord.CreateName(ChordName, chord_key, flat_keys[chord_key]); + return ChordName; #endif } @@ -356,16 +357,16 @@ return chord_nr_names[chord_nr]; // "IV" } -const char * HBContext::ScaleName() const +const string& HBContext::GetScaleName() const { - static char buf[20]; + static string ScaleName; //strcpy(buf, scale_names[flat_keys[scale_nr]][scale_nr]); - strcpy(buf, HBChord::ScaleName(scale_nr, flat_keys[scale_nr])); + ScaleName = HBChord::ScaleName(scale_nr, flat_keys[scale_nr]); #if 0 strcat(buf, "/"); strcat(buf, scale_type_names[scale_type]); #endif - return buf; + return ScaleName; } const char * HBContext::ScaleTypeName() const @@ -698,7 +699,7 @@ gensc(chords); cout << "};\n\n"; - cout << "tNamedChord scale_names[n_scale_names] = {\n"; + cout << "tNamedChord mScaleNames[n_scale_names] = {\n"; gensc(scales); cout << "};\n\n"; Modified: trunk/jazz/src/HarmonyP.h =================================================================== --- trunk/jazz/src/HarmonyP.h 2008-04-08 14:03:32 UTC (rev 442) +++ trunk/jazz/src/HarmonyP.h 2008-04-08 17:25:46 UTC (rev 443) @@ -24,6 +24,7 @@ #define JZ_HARMONYP_H #include <iostream> +#include <string> // ------------------------------------------------------------------ // HBChord @@ -194,18 +195,19 @@ *this += key+1; } - void Name(char *buf, int key, int flat = 0); + void CreateName(std::string& CordName, int key, int flat = 0); - static const char * ScaleName(int key, int flat = 0) + static const std::string ScaleName(int key, int flat = 0) { - return scale_names[flat != 0][(key + 240) % 12]; + return mScaleNames[flat != 0][(key + 240) % 12]; } protected: int keys; private: - static const char * const scale_names[2][12]; + + static const std::string const mScaleNames[2][12]; }; inline std::ostream& operator << (std::ostream& os, HBChord const &a) @@ -323,16 +325,19 @@ seq_nr = n; } - const char* ChordName() const; // "Dm75-" + // For example "Dm75-" + std::string GetChordName() const; - const char* ChordNrName() const; // "IV" + // For example "IV" + const char* ChordNrName() const; const char* ContextName() const // "mixo#11" { return context_names[scale_type][chord_nr]; } - const char* ScaleName() const; // "C#" + // For example "C#" + const std::string& GetScaleName() const; const char* ScaleTypeName() const; // "major" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-08 14:03:48
|
Revision: 442 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=442&view=rev Author: pstieber Date: 2008-04-08 07:03:32 -0700 (Tue, 08 Apr 2008) Log Message: ----------- Added more menu update handlers. I don't have this quite right, but it's close. Modified Paths: -------------- trunk/jazz/src/Harmony.cpp trunk/jazz/src/Harmony.h Modified: trunk/jazz/src/Harmony.cpp =================================================================== --- trunk/jazz/src/Harmony.cpp 2008-04-08 04:34:59 UTC (rev 441) +++ trunk/jazz/src/Harmony.cpp 2008-04-08 14:03:32 UTC (rev 442) @@ -487,6 +487,17 @@ virtual ~HBCanvas(); + bool GetMark4Common() const; + bool GetMark3Common() const; + bool GetMark2Common() const; + bool GetMark1Common() const; + bool GetMarkBCommon() const; + bool GetMark0Common() const; + bool GetMark1Semi() const; + bool GetMark251() const; + bool GetMarkTritone() const; + bool GetMarkPiano() const; + virtual void OnDraw(wxDC& Dc); void DrawMarkers(wxDC& Dc, const HBContext& Context); @@ -601,9 +612,69 @@ inline bool HBCanvas::IsUsingHaunschildLayout() const { - return mHaunschildLayout; + return mHaunschildLayout; } +inline +bool HBCanvas::GetMark4Common() const +{ + return mMark4Common; +} + +inline +bool HBCanvas::GetMark3Common() const +{ + return mMark3Common; +} + +inline +bool HBCanvas::GetMark2Common() const +{ + return mMark2Common; +} + +inline +bool HBCanvas::GetMark1Common() const +{ + return mMark1Common; +} + +inline +bool HBCanvas::GetMarkBCommon() const +{ + return mMarkBCommon; +} + +inline +bool HBCanvas::GetMark0Common() const +{ + return mMark0Common; +} + +inline +bool HBCanvas::GetMark1Semi() const +{ + return mMark1Semi; +} + +inline +bool HBCanvas::GetMark251() const +{ + return mMark251; +} + +inline +bool HBCanvas::GetMarkTritone() const +{ + return mMarkTritone; +} + +inline +bool HBCanvas::GetMarkPiano() const +{ + return mMarkPiano; +} + //***************************************************************************** // Description: // This is the harmony browser match markers class definition. @@ -1866,11 +1937,21 @@ EVT_UPDATE_UI(MEN_IONSCALE, HBFrame::OnUpdateIonicScale) EVT_MENU(MEN_IONSCALE, HBFrame::OnToolBarSelect) + EVT_UPDATE_UI(MEN_EQ4, HBFrame::OnUpdateFourEqualNotes) EVT_MENU(MEN_EQ4, HBFrame::OnToolBarSelect) + + EVT_UPDATE_UI(MEN_EQ3, HBFrame::OnUpdateThreeEqualNotes) EVT_MENU(MEN_EQ3, HBFrame::OnToolBarSelect) + + EVT_UPDATE_UI(MEN_EQ2, HBFrame::OnUpdateTwoEqualNotes) EVT_MENU(MEN_EQ2, HBFrame::OnToolBarSelect) + + EVT_UPDATE_UI(MEN_EQ1, HBFrame::OnUpdateOneEqualNotes) EVT_MENU(MEN_EQ1, HBFrame::OnToolBarSelect) + + EVT_UPDATE_UI(MEN_EQ1, HBFrame::OnUpdateZeroEqualNotes) EVT_MENU(MEN_EQ0, HBFrame::OnToolBarSelect) + EVT_MENU(MEN_EQH, HBFrame::OnToolBarSelect) EVT_MENU(MEN_251, HBFrame::OnToolBarSelect) EVT_MENU(MEN_EQB, HBFrame::OnToolBarSelect) @@ -1933,22 +2014,76 @@ true); wxMenu* pScaleMenu = new wxMenu; - pScaleMenu->Append(MEN_MAJSCALE, "&Major", "Use Major Scales", true); - pScaleMenu->Append(MEN_HARSCALE, "&Harmonic Minor", "Use Harmonic Minor Scales", true); - pScaleMenu->Append(MEN_MELSCALE, "&Melodic Minor", "Use Melodic Minor Scales", true); - pScaleMenu->Append(MEN_IONSCALE, "&Ionic", "Use Ionic Scales", true); + pScaleMenu->Append( + MEN_MAJSCALE, + "&Major", + "Use Major Scales", + true); + pScaleMenu->Append( + MEN_HARSCALE, + "&Harmonic Minor", + "Use Harmonic Minor Scales", + true); + pScaleMenu->Append( + MEN_MELSCALE, + "&Melodic Minor", + "Use Melodic Minor Scales", + true); + pScaleMenu->Append( + MEN_IONSCALE, + "&Ionic", + "Use Ionic Scales", + true); wxMenu* pShowMenu = new wxMenu; - pShowMenu->Append(MEN_EQ4, "&4 equal notes"); - pShowMenu->Append(MEN_EQ3, "&3 equal notes"); - pShowMenu->Append(MEN_EQ2, "&2 equal notes"); - pShowMenu->Append(MEN_EQ1, "&1 equal note"); - pShowMenu->Append(MEN_EQ0, "&0 equal notes"); - pShowMenu->Append(MEN_EQH, "1/2 note &difference"); - pShowMenu->Append(MEN_251, "2-5-1 &move"); - pShowMenu->Append(MEN_EQB, "&Same bass note"); - pShowMenu->Append(MEN_TRITONE, "&Tritone substitute"); - pShowMenu->Append(MEN_PIANO, "Contains &Pianowin Buffer"); + pShowMenu->Append( + MEN_EQ4, + "&4 equal notes", + "Display Chords with 4 common notes", + true); + pShowMenu->Append( + MEN_EQ3, + "&3 equal notes", + "Display Chords with 3 common notes", + true); + pShowMenu->Append( + MEN_EQ2, + "&2 equal notes", + "Display Chords with 2 common notes", + true); + pShowMenu->Append( + MEN_EQ1, + "&1 equal note", + "Display Chords with 1 common notes", + true); + pShowMenu->Append( + MEN_EQ0, + "&0 equal notes", + "Display Chords with no common notes", + true); + pShowMenu->Append( + MEN_EQH, + "1/2 note &difference", + "Display Chords with a 1/2 note difference", + true); + pShowMenu->Append( + MEN_251, + "2-5-1 &move", + "Display Chords with a 2-5-1 move", + true); + pShowMenu->Append( + MEN_EQB, + "&Same bass note", + "Display Chords with the same bass note", + true); + pShowMenu->Append( + MEN_TRITONE, + "&Tritone substitute", + "Display Chords with that are tritone substitutes", + true); + pShowMenu->Append( + MEN_PIANO, + "Contains &Pianowin Buffer"); wxMenu* pActionMenu = new wxMenu; pActionMenu->Append(MEN_TRANSPOSE, "&Transpose"); @@ -2077,6 +2212,41 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +void HBFrame::OnUpdateFourEqualNotes(wxUpdateUIEvent& Event) +{ + Event.Check(mpHbWindow->GetMark4Common()); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void HBFrame::OnUpdateThreeEqualNotes(wxUpdateUIEvent& Event) +{ + Event.Check(mpHbWindow->GetMark3Common()); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void HBFrame::OnUpdateTwoEqualNotes(wxUpdateUIEvent& Event) +{ + Event.Check(mpHbWindow->GetMark2Common()); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void HBFrame::OnUpdateOneEqualNotes(wxUpdateUIEvent& Event) +{ + Event.Check(mpHbWindow->GetMark1Common()); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void HBFrame::OnUpdateZeroEqualNotes(wxUpdateUIEvent& Event) +{ + Event.Check(mpHbWindow->GetMark0Common()); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void HBFrame::OnToolBarSelect(wxCommandEvent& Event) { mpHbWindow->MenuCommand( Modified: trunk/jazz/src/Harmony.h =================================================================== --- trunk/jazz/src/Harmony.h 2008-04-08 04:34:59 UTC (rev 441) +++ trunk/jazz/src/Harmony.h 2008-04-08 14:03:32 UTC (rev 442) @@ -91,6 +91,12 @@ void OnUpdateMelodicMinorScale(wxUpdateUIEvent& Event); void OnUpdateIonicScale(wxUpdateUIEvent& Event); + void OnUpdateFourEqualNotes(wxUpdateUIEvent& Event); + void OnUpdateThreeEqualNotes(wxUpdateUIEvent& Event); + void OnUpdateTwoEqualNotes(wxUpdateUIEvent& Event); + void OnUpdateOneEqualNotes(wxUpdateUIEvent& Event); + void OnUpdateZeroEqualNotes(wxUpdateUIEvent& Event); + void OnToolBarSelect(wxCommandEvent& Event); void OnFileLoad(wxCommandEvent& Event); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-08 04:35:06
|
Revision: 441 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=441&view=rev Author: pstieber Date: 2008-04-07 21:34:59 -0700 (Mon, 07 Apr 2008) Log Message: ----------- 1. Changed tScaleType to TEScaleType. 2. Added some menu entry update handlers. Modified Paths: -------------- trunk/jazz/src/Harmony.cpp trunk/jazz/src/Harmony.h trunk/jazz/src/HarmonyP.cpp trunk/jazz/src/HarmonyP.h Modified: trunk/jazz/src/Harmony.cpp =================================================================== --- trunk/jazz/src/Harmony.cpp 2008-04-07 14:01:49 UTC (rev 440) +++ trunk/jazz/src/Harmony.cpp 2008-04-08 04:34:59 UTC (rev 441) @@ -481,6 +481,8 @@ public: + static TEScaleType GetScaleType(); + HBCanvas(wxFrame* pParent, int x, int y, int w, int h); virtual ~HBCanvas(); @@ -508,6 +510,8 @@ void ToggleHaunschildLayout(); + bool IsUsingHaunschildLayout() const; + void FileLoad(); void FileSaveAs(); @@ -543,11 +547,11 @@ void SetMarker(int MenuId, wxToolBar* pToolBar); - void SetScaleType(int MenuId, tScaleType ScaleType, wxToolBar* pToolBar); + void SetScaleType(int MenuId, TEScaleType ScaleType, wxToolBar* pToolBar); private: - static tScaleType mScaleType; + static TEScaleType mScaleType; static int transpose_res; @@ -594,6 +598,12 @@ DECLARE_EVENT_TABLE() }; +inline +bool HBCanvas::IsUsingHaunschildLayout() const +{ + return mHaunschildLayout; +} + //***************************************************************************** // Description: // This is the harmony browser match markers class definition. @@ -712,13 +722,20 @@ //***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -tScaleType HBCanvas::mScaleType = Major; +TEScaleType HBCanvas::mScaleType = Major; const int HBCanvas::ScFa = 50; int HBCanvas::transpose_res = 8; int HBCanvas::analyze_res = 8; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +TEScaleType HBCanvas::GetScaleType() +{ + return mScaleType; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- BEGIN_EVENT_TABLE(HBCanvas, wxScrolledWindow) EVT_MOUSE_EVENTS(HBCanvas::OnMouseEvent) @@ -1291,7 +1308,7 @@ //----------------------------------------------------------------------------- void HBCanvas::SetScaleType( int MenuId, - tScaleType ScaleType, + TEScaleType ScaleType, wxToolBar* pToolBar) { mScaleType = ScaleType; @@ -1836,10 +1853,19 @@ //----------------------------------------------------------------------------- BEGIN_EVENT_TABLE(HBFrame, wxFrame) + + EVT_UPDATE_UI(MEN_MAJSCALE, HBFrame::OnUpdateMajorScale) EVT_MENU(MEN_MAJSCALE, HBFrame::OnToolBarSelect) + + EVT_UPDATE_UI(MEN_HARSCALE, HBFrame::OnUpdateHarmonicMinorScale) EVT_MENU(MEN_HARSCALE, HBFrame::OnToolBarSelect) + + EVT_UPDATE_UI(MEN_MELSCALE, HBFrame::OnUpdateMelodicMinorScale) EVT_MENU(MEN_MELSCALE, HBFrame::OnToolBarSelect) + + EVT_UPDATE_UI(MEN_IONSCALE, HBFrame::OnUpdateIonicScale) EVT_MENU(MEN_IONSCALE, HBFrame::OnToolBarSelect) + EVT_MENU(MEN_EQ4, HBFrame::OnToolBarSelect) EVT_MENU(MEN_EQ3, HBFrame::OnToolBarSelect) EVT_MENU(MEN_EQ2, HBFrame::OnToolBarSelect) @@ -1859,6 +1885,7 @@ EVT_MENU(MEN_MIDI, HBFrame::OnSettingsMidi) + EVT_UPDATE_UI(MEN_MAJSCALE, HBFrame::OnUpdateHaunschildLayout) EVT_MENU(MEN_HAUNSCH, HBFrame::OnSettingsHaunschild) EVT_MENU(MEN_CLEARSEQ, HBFrame::OnActionClearSequence) @@ -1899,13 +1926,17 @@ pSettingsMenu->Append(MEN_EDIT, "&Chord"); pSettingsMenu->Append(MEN_SETTINGS, "&Global"); pSettingsMenu->Append(MEN_MIDI, "&Midi"); - pSettingsMenu->Append(MEN_HAUNSCH, "&Haunschild Layout"); + pSettingsMenu->Append( + MEN_HAUNSCH, + "&Haunschild Layout", + "Display using Haunschild Layout", + true); wxMenu* pScaleMenu = new wxMenu; - pScaleMenu->Append(MEN_MAJSCALE, "&Major"); - pScaleMenu->Append(MEN_HARSCALE, "&Harmonic Minor"); - pScaleMenu->Append(MEN_MELSCALE, "&Melodic Minor"); - pScaleMenu->Append(MEN_IONSCALE, "&Ionic"); + pScaleMenu->Append(MEN_MAJSCALE, "&Major", "Use Major Scales", true); + pScaleMenu->Append(MEN_HARSCALE, "&Harmonic Minor", "Use Harmonic Minor Scales", true); + pScaleMenu->Append(MEN_MELSCALE, "&Melodic Minor", "Use Melodic Minor Scales", true); + pScaleMenu->Append(MEN_IONSCALE, "&Ionic", "Use Ionic Scales", true); wxMenu* pShowMenu = new wxMenu; pShowMenu->Append(MEN_EQ4, "&4 equal notes"); @@ -2018,6 +2049,34 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +void HBFrame::OnUpdateMajorScale(wxUpdateUIEvent& Event) +{ + Event.Check(HBCanvas::GetScaleType() == Major); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void HBFrame::OnUpdateHarmonicMinorScale(wxUpdateUIEvent& Event) +{ + Event.Check(HBCanvas::GetScaleType() == Harmon); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void HBFrame::OnUpdateMelodicMinorScale(wxUpdateUIEvent& Event) +{ + Event.Check(HBCanvas::GetScaleType() == Melod); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void HBFrame::OnUpdateIonicScale(wxUpdateUIEvent& Event) +{ + Event.Check(HBCanvas::GetScaleType() == Ionb13); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void HBFrame::OnToolBarSelect(wxCommandEvent& Event) { mpHbWindow->MenuCommand( @@ -2048,6 +2107,13 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +void HBFrame::OnUpdateHaunschildLayout(wxUpdateUIEvent& Event) +{ + Event.Check(mpHbWindow->IsUsingHaunschildLayout()); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void HBFrame::OnSettingsHaunschild(wxCommandEvent& Event) { mpHbWindow->ToggleHaunschildLayout(); Modified: trunk/jazz/src/Harmony.h =================================================================== --- trunk/jazz/src/Harmony.h 2008-04-07 14:01:49 UTC (rev 440) +++ trunk/jazz/src/Harmony.h 2008-04-08 04:34:59 UTC (rev 441) @@ -86,6 +86,11 @@ protected: + void OnUpdateMajorScale(wxUpdateUIEvent& Event); + void OnUpdateHarmonicMinorScale(wxUpdateUIEvent& Event); + void OnUpdateMelodicMinorScale(wxUpdateUIEvent& Event); + void OnUpdateIonicScale(wxUpdateUIEvent& Event); + void OnToolBarSelect(wxCommandEvent& Event); void OnFileLoad(wxCommandEvent& Event); @@ -96,6 +101,7 @@ void OnSettingsMidi(wxCommandEvent& Event); + void OnUpdateHaunschildLayout(wxUpdateUIEvent& Event); void OnSettingsHaunschild(wxCommandEvent& Event); void OnActionClearSequence(wxCommandEvent& Event); Modified: trunk/jazz/src/HarmonyP.cpp =================================================================== --- trunk/jazz/src/HarmonyP.cpp 2008-04-07 14:01:49 UTC (rev 440) +++ trunk/jazz/src/HarmonyP.cpp 2008-04-08 04:34:59 UTC (rev 441) @@ -147,7 +147,9 @@ buf[i++] = '-'; } if (c.Contains(2)) + { buf[i++] = '9'; + } if (sharp9) { @@ -312,7 +314,7 @@ }; -HBContext::HBContext(int sn, int cn, tScaleType st) +HBContext::HBContext(int sn, int cn, TEScaleType st) { scale_type = st; scale_nr = sn % 12; @@ -454,7 +456,7 @@ int sc; is >> sc >> a.scale_nr >> a.chord_nr >> a.seq_nr >> a.chord_key; is >> a.chord >> a.scale; - a.scale_type = (tScaleType)sc; + a.scale_type = (TEScaleType)sc; return is; } @@ -470,7 +472,7 @@ HBContextIterator::HBContextIterator() : match(def_match) { - context.scale_type = (tScaleType)0; + context.scale_type = (TEScaleType)0; context.scale_nr = 0; context.chord_nr = -1; i_seq = n_seq = 0; @@ -480,7 +482,7 @@ HBContextIterator::HBContextIterator(HBMatch &m) : match(m) { - context.scale_type = (tScaleType)0; + context.scale_type = (TEScaleType)0; context.scale_nr = 0; context.chord_nr = -1; i_seq = n_seq = 0; @@ -495,7 +497,7 @@ { if (scale_type != nScaleTypes && context.scale_type != scale_type) { - context.scale_type = (tScaleType)((int)context.scale_type + 1); + context.scale_type = (TEScaleType)((int)context.scale_type + 1); continue; } @@ -512,7 +514,7 @@ context.scale_nr ++; } context.scale_nr = 0; - context.scale_type = (tScaleType)((int)context.scale_type + 1); + context.scale_type = (TEScaleType)((int)context.scale_type + 1); } while (i_seq < n_seq) Modified: trunk/jazz/src/HarmonyP.h =================================================================== --- trunk/jazz/src/HarmonyP.h 2008-04-07 14:01:49 UTC (rev 440) +++ trunk/jazz/src/HarmonyP.h 2008-04-08 04:34:59 UTC (rev 441) @@ -29,7 +29,14 @@ // HBChord // ------------------------------------------------------------------ -enum tScaleType { Major, Harmon, Melod, Ionb13, nScaleTypes }; +enum TEScaleType +{ + Major, + Harmon, + Melod, + Ionb13, + nScaleTypes +}; class HBChord @@ -257,7 +264,7 @@ public: - HBContext(int sn, int cn = 0, tScaleType st = Major); + HBContext(int sn, int cn = 0, TEScaleType st = Major); HBContext(); @@ -301,7 +308,7 @@ return scale_nr; } - tScaleType ScaleType() const + TEScaleType ScaleType() const { return scale_type; } @@ -352,7 +359,7 @@ int MakeChordKey() const; - tScaleType scale_type; + TEScaleType scale_type; int scale_nr; @@ -426,7 +433,7 @@ n_seq = n; } - void SetScaleType(tScaleType st) + void SetScaleType(TEScaleType st) { scale_type = st; } @@ -455,7 +462,7 @@ int i_seq, n_seq; - tScaleType scale_type; + TEScaleType scale_type; }; #endif // !defined(JZ_HARMONYP_H) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-07 14:07:19
|
Revision: 440 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=440&view=rev Author: pstieber Date: 2008-04-07 07:01:49 -0700 (Mon, 07 Apr 2008) Log Message: ----------- Fixed marker drawing. Modified Paths: -------------- trunk/jazz/src/Harmony.cpp Modified: trunk/jazz/src/Harmony.cpp =================================================================== --- trunk/jazz/src/Harmony.cpp 2008-04-07 06:18:56 UTC (rev 439) +++ trunk/jazz/src/Harmony.cpp 2008-04-07 14:01:49 UTC (rev 440) @@ -435,8 +435,42 @@ //***************************************************************************** // Description: -// This is the harmony browser window. +// This is the harmony browser match markers class declaration. //***************************************************************************** +class HBMatchMarkers : public HBMatch +{ + public: + + HBMatchMarkers(const HBContext& Context, HBCanvas *cv); + + virtual bool operator()(const HBContext &); + + const char * GetText() + { + // + 2 for ", " + return msg + 2; + } + + private: + + HBCanvas* mpHbWindow; + HBContext mContext; + HBChord chord; + HBChord scale; + int n_chord; + int chord_key; + + int tritone; + HBChord piano; + int key251; + + char msg[100]; +}; + +//***************************************************************************** +// Description: +// This is the harmony browser window class declaration. +//***************************************************************************** class HBCanvas : public wxScrolledWindow { friend class HBSettingsDlg; @@ -455,7 +489,7 @@ void DrawMarkers(wxDC& Dc, const HBContext& Context); - void ClearSeq(); + void ClearSequence(); bool IsSequenceDefined() { @@ -560,8 +594,124 @@ DECLARE_EVENT_TABLE() }; +//***************************************************************************** +// Description: +// This is the harmony browser match markers class definition. +//***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +HBMatchMarkers::HBMatchMarkers(const HBContext& Context, HBCanvas* cv) + : HBMatch(), + mpHbWindow(cv), + mContext(Context), + chord(mContext.Chord()), + scale(mContext.Scale()), + n_chord(chord.Count()), + chord_key(mContext.ChordKey()), + tritone((chord_key + 6) % 12) +{ + msg[0] = 0; + msg[2] = 0; + + { + // 251-move + HBContext tmp(Context.ScaleNr(), Context.ChordNr() + 3, Context.ScaleType()); + key251 = tmp.ChordKey(); + } + + tritone = (chord_key + 6) % 12; + + if (mpHbWindow->mMarkPiano && gpTrackFrame->GetPianoWindow()) + { + tEventArray &buf = gpTrackFrame->GetPianoWindow()->mPasteBuffer; + for (int i = 0; i < buf.nEvents; i++) + { + tKeyOn *on = buf.Events[i]->IsKeyOn(); + if (on) + { + piano += on->Key; + } + } + } +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool HBMatchMarkers::operator()(const HBContext &o_context) +{ + HBChord o_chord = o_context.Chord(); + int o_chord_key = o_context.ChordKey(); + + HBChord common = (chord & o_chord); + int n_common = common.Count(); + + msg[0] = 0; + msg[2] = 0; + + if (mpHbWindow->mMarkPiano && o_chord.Contains(piano)) + { + strcat(msg, ", P"); + } + + if (mpHbWindow->mMark4Common && o_chord == chord) + { + strcat(msg, ", =4"); + } + + if (mpHbWindow->mMark3Common && n_common == 3) + { + strcat(msg, ", =3"); + } + + if (mpHbWindow->mMark2Common && n_common == 2) + { + strcat(msg, ", =2"); + } + + if (mpHbWindow->mMark1Common && n_common == 1) + { + strcat(msg, ", =1"); + } + + if (mpHbWindow->mMark0Common && n_common == 0) + { + strcat(msg, ", =0"); + } + + if (mpHbWindow->mMark1Semi && n_common == n_chord - 1) + { + HBChord delta = chord ^ o_chord; + int key = delta.Iter(0); + if (delta.Contains(key + 1) || delta.Contains(key - 1)) + { + strcat(msg, ", 1/2"); + } + } + + if (mpHbWindow->mMark251 && key251 == o_chord_key) + { + strcat(msg, ", 251"); + } + + if (mpHbWindow->mMarkBCommon && chord_key == o_chord_key) + { + strcat(msg, ", =B"); + } + + if (mpHbWindow->mMarkTritone && o_chord_key == tritone) + { + strcat(msg, ", =T"); + } + + return msg[2] ? 1 : 0; +} + +//***************************************************************************** +// Description: +// This is the harmony browser window class definition. +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- tScaleType HBCanvas::mScaleType = Major; const int HBCanvas::ScFa = 50; int HBCanvas::transpose_res = 8; @@ -819,13 +969,14 @@ Rectangle.width, Rectangle.height); - int w, h; const char* pName = Context.ChordName(); - Dc.GetTextExtent(pName, &w, &h); + + int TextWidth, TextHeight; + Dc.GetTextExtent(pName, &TextWidth, &TextHeight); Dc.DrawText( pName, - Rectangle.x + (Rectangle.width - w) / 2, - Rectangle.y + (Rectangle.height - h) / 2); + Rectangle.x + (Rectangle.width - TextWidth) / 2, + Rectangle.y + (Rectangle.height - TextHeight) / 2); } //----------------------------------------------------------------------------- @@ -874,40 +1025,43 @@ Dc.DrawText(Context.ScaleName(), 5, Rectangle.y); } } + DrawMarkers(Dc, mMouseContext); if (!mHaunschildLayout) { - for (int j = 0; j < 7; j++) + int TextWidth, TextHeight; + for (int j = 0; j < 7; ++j) { HBContext Context(0, j, mScaleType); + JZRectangle Rectangle; ChordRect(Rectangle, Context); Rectangle.y -= (int)mChordHeight; - int w, h; const char* pName = Context.ChordNrName(); - Dc.GetTextExtent(pName, &w, &h); + + Dc.GetTextExtent(pName, &TextWidth, &TextHeight); Dc.DrawText( pName, - Rectangle.x + (Rectangle.width - w) / 2, - Rectangle.y + (Rectangle.height - h) / 2); + Rectangle.x + (Rectangle.width - TextWidth) / 2, + Rectangle.y + (Rectangle.height - TextHeight) / 2); const char* pType = Context.ContextName(); - Dc.GetTextExtent(pType, &w, &h); + + Dc.GetTextExtent(pType, &TextWidth, &TextHeight); Dc.DrawText( pType, - Rectangle.x + (Rectangle.width - w) / 2, - Rectangle.y + (Rectangle.height - h) / 2 - h); + Rectangle.x + (Rectangle.width - TextWidth) / 2, + Rectangle.y + (Rectangle.height - TextHeight) / 2 - TextHeight); } } } -// ----------------------------------------------------------------------------- +#ifdef OBSOLETE +//***************************************************************************** // HBSettingsForm -// ----------------------------------------------------------------------------- - -#ifdef OBSOLETE +//***************************************************************************** class HBSettingsForm : public wxForm { public: @@ -948,160 +1102,10 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void HBCanvas::ToggleHaunschildLayout() -{ - mHaunschildLayout = !mHaunschildLayout; - Refresh(); -} - - - - - - - -//***************************************************************************** -// HBMatchMarkers -//***************************************************************************** -class HBMatchMarkers : public HBMatch -{ - public: - - HBMatchMarkers(const HBContext& Context, HBCanvas *cv); - - virtual bool operator()(const HBContext &); - - const char * GetText() - { - // + 2 for ", " - return msg + 2; - } - - private: - - HBCanvas* mpHbWindow; - HBContext mContext; - HBChord chord; - HBChord scale; - int n_chord; - int chord_key; - - int tritone; - HBChord piano; - int key251; - - char msg[100]; -}; - - -HBMatchMarkers::HBMatchMarkers(const HBContext& Context, HBCanvas *cv) - : mContext(Context) -{ - mpHbWindow = cv; - chord = mContext.Chord(); - n_chord = chord.Count(); - chord_key = mContext.ChordKey(); - scale = mContext.Scale(); - - msg[0] = 0; - msg[2] = 0; - - { - // 251-move - HBContext tmp(Context.ScaleNr(), Context.ChordNr() + 3, Context.ScaleType()); - key251 = tmp.ChordKey(); - } - - tritone = (chord_key + 6) % 12; - - if (mpHbWindow->mMarkPiano && gpTrackFrame->GetPianoWindow()) - { - tEventArray &buf = gpTrackFrame->GetPianoWindow()->mPasteBuffer; - for (int i = 0; i < buf.nEvents; i++) - { - tKeyOn *on = buf.Events[i]->IsKeyOn(); - if (on) - { - piano += on->Key; - } - } - } -} - - -bool HBMatchMarkers::operator()(const HBContext &o_context) -{ - HBChord o_chord = o_context.Chord(); - int o_chord_key = o_context.ChordKey(); - - HBChord common = (chord & o_chord); - int n_common = common.Count(); - - msg[0] = 0; - msg[2] = 0; - - if (mpHbWindow->mMarkPiano && o_chord.Contains(piano)) - { - strcat(msg, ", P"); - } - - if (mpHbWindow->mMark4Common && o_chord == chord) - { - strcat(msg, ", =4"); - } - - if (mpHbWindow->mMark3Common && n_common == 3) - { - strcat(msg, ", =3"); - } - - if (mpHbWindow->mMark2Common && n_common == 2) - { - strcat(msg, ", =2"); - } - - if (mpHbWindow->mMark1Common && n_common == 1) - { - strcat(msg, ", =1"); - } - - if (mpHbWindow->mMark0Common && n_common == 0) - { - strcat(msg, ", =0"); - } - - if (mpHbWindow->mMark1Semi && n_common == n_chord - 1) - { - HBChord delta = chord ^ o_chord; - int key = delta.Iter(0); - if (delta.Contains(key + 1) || delta.Contains(key - 1)) - { - strcat(msg, ", 1/2"); - } - } - - if (mpHbWindow->mMark251 && key251 == o_chord_key) - { - strcat(msg, ", 251"); - } - - if (mpHbWindow->mMarkBCommon && chord_key == o_chord_key) - { - strcat(msg, ", =B"); - } - - if (mpHbWindow->mMarkTritone && o_chord_key == tritone) - { - strcat(msg, ", =T"); - } - - return msg[2] ? 1 : 0; -} - void HBCanvas::DrawMarkers(wxDC& Dc, const HBContext& Context) { JZRectangle Rectangle; - Dc.SetLogicalFunction(wxXOR); + Dc.SetLogicalFunction(wxINVERT); Dc.SetBrush(*wxTRANSPARENT_BRUSH); HBMatchMarkers match(Context, this); HBContextIterator iter(match); @@ -1148,6 +1152,8 @@ Dc.SetBrush(*wxWHITE_BRUSH); } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- bool HBCanvas::Find(float x, float y, HBContext &out) { HBContextIterator iter; @@ -1166,15 +1172,25 @@ return false; } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void HBCanvas::ToggleHaunschildLayout() +{ + mHaunschildLayout = !mHaunschildLayout; + Refresh(); +} -void HBCanvas::ClearSeq() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void HBCanvas::ClearSequence() { mSequenceCount = 0; mMouseContext.SetSeqNr(0); Refresh(); } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void HBCanvas::OnMouseEvent(wxMouseEvent& MouseEvent) { wxClientDC Dc(this); @@ -1271,7 +1287,8 @@ } } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void HBCanvas::SetScaleType( int MenuId, tScaleType ScaleType, @@ -1286,7 +1303,8 @@ Refresh(); } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void HBCanvas::TransposeSelection() { if (!IsSequenceDefined()) @@ -1303,6 +1321,8 @@ } } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void HBCanvas::FileLoad() { wxString FileName = file_selector( @@ -1319,6 +1339,8 @@ } } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void HBCanvas::FileSaveAs() { wxString FileName = file_selector( @@ -1335,6 +1357,8 @@ } } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void HBCanvas::MenuCommand(int MenuId, wxToolBar* pToolBar) { switch (MenuId) @@ -1380,7 +1404,8 @@ } } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- HBAnalyzer * HBCanvas::GetAnalyzer() { if (mSequenceCount > 0 && gpTrackWindow->mpSnapSel->Selected) @@ -1392,6 +1417,13 @@ return 0; } + + + + + + + // --------------------------------------------------------- // HBContextDlg // --------------------------------------------------------- @@ -2039,7 +2071,7 @@ //----------------------------------------------------------------------------- void HBFrame::OnActionClearSequence(wxCommandEvent& Event) { - mpHbWindow->ClearSeq(); + mpHbWindow->ClearSequence(); } //----------------------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-07 06:18:58
|
Revision: 439 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=439&view=rev Author: pstieber Date: 2008-04-06 23:18:56 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Put come code back I accidentally commented out. Modified Paths: -------------- trunk/jazz/src/Harmony.cpp Modified: trunk/jazz/src/Harmony.cpp =================================================================== --- trunk/jazz/src/Harmony.cpp 2008-04-07 06:14:55 UTC (rev 438) +++ trunk/jazz/src/Harmony.cpp 2008-04-07 06:18:56 UTC (rev 439) @@ -875,7 +875,7 @@ } } DrawMarkers(Dc, mMouseContext); -/* + if (!mHaunschildLayout) { for (int j = 0; j < 7; j++) @@ -901,7 +901,6 @@ Rectangle.y + (Rectangle.height - h) / 2 - h); } } - */ } // ----------------------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-07 06:14:58
|
Revision: 438 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=438&view=rev Author: pstieber Date: 2008-04-06 23:14:55 -0700 (Sun, 06 Apr 2008) Log Message: ----------- 1. Fixed some save as menu entries. 2. Added more harmony browser functionality. The DrawMarkers logic is incorrect, but I'm close. Modified Paths: -------------- trunk/jazz/src/Harmony.cpp trunk/jazz/src/Harmony.h trunk/jazz/src/SampleWindow.cpp trunk/jazz/src/TrackFrame.cpp Modified: trunk/jazz/src/Harmony.cpp =================================================================== --- trunk/jazz/src/Harmony.cpp 2008-04-07 04:54:17 UTC (rev 437) +++ trunk/jazz/src/Harmony.cpp 2008-04-07 06:14:55 UTC (rev 438) @@ -69,7 +69,6 @@ #define MEN_ANALYZE 24 #define MEN_IONSCALE 25 #define MEN_SETTINGS 26 -#define MEN_LOAD 27 #include "Bitmaps/open.xpm" @@ -96,7 +95,7 @@ static JZToolDef tdefs[] = { - { MEN_LOAD, false, open_xpm, "open harmony file" }, + { wxID_OPEN, false, open_xpm, "open harmony file" }, { wxID_SAVEAS, false, save_xpm, "save harmony file" }, { JZToolBar::eToolBarSeparator }, { MEN_MAJSCALE, true, majscale_xpm, "major scale" }, @@ -151,7 +150,7 @@ const HBContext& Context() { - return context; + return mContext; } virtual void Notify(); @@ -164,7 +163,7 @@ private: - HBContext context; + HBContext mContext; static int bass_channel, bass_veloc; @@ -217,10 +216,10 @@ } -int HBPlayer::GetChordKeys(int *out, const HBContext &context) +int HBPlayer::GetChordKeys(int *out, const HBContext& Context) { // build chord keys - HBChord chord = context.Chord(); + HBChord chord = Context.Chord(); int key = chord.Iter(chord_pitch - 1); int n = chord.Count(); for (int i = 0; i < n; i++) @@ -232,10 +231,10 @@ } -int HBPlayer::GetBassKey(const HBContext &context) +int HBPlayer::GetBassKey(const HBContext& Context) { // build bass note - int key = context.ChordKey() + bass_pitch - bass_pitch % 12; + int key = Context.ChordKey() + bass_pitch - bass_pitch % 12; if (key < bass_pitch) { key += 12; @@ -244,10 +243,10 @@ } -int HBPlayer::GetMeldyKeys(int *out, const HBContext &context) +int HBPlayer::GetMeldyKeys(int *out, const HBContext &Context) { // build melody keys - HBChord scale = context.Scale(); + HBChord scale = Context.Scale(); int n = scale.Count(); int key = scale.Iter(meldy_pitch); @@ -279,7 +278,7 @@ } -void HBPlayer::StartPlay(const HBContext &ct) +void HBPlayer::StartPlay(const HBContext& Context) { int i; @@ -290,11 +289,11 @@ StopPlay(); } playing = 1; - context = ct; + mContext = Context; - bass_key = GetBassKey(context); - n_chord_keys = GetChordKeys(chord_keys, context); - n_meldy_keys = GetMeldyKeys(meldy_keys, context); + bass_key = GetBassKey(mContext); + n_chord_keys = GetChordKeys(chord_keys, mContext); + n_meldy_keys = GetMeldyKeys(meldy_keys, mContext); // Generate KeyOn's if (mBassEnabled) @@ -454,11 +453,11 @@ virtual void OnDraw(wxDC& Dc); - void DrawMarkers(wxDC& Dc, const HBContext &c); + void DrawMarkers(wxDC& Dc, const HBContext& Context); void ClearSeq(); - int SeqDefined() + bool IsSequenceDefined() { return mSequenceCount > 0; } @@ -479,7 +478,7 @@ void FileSaveAs(); - void OnMenuCommand(int id, wxToolBar *mpToolBar); + void MenuCommand(int MenuId, wxToolBar *mpToolBar); void TransposeSelection(); @@ -496,11 +495,11 @@ static const int ScFa; - void ChordRect(JZRectangle& Rectangle, const HBContext &ct); + void ChordRect(JZRectangle& Rectangle, const HBContext& Context); - void DrawChord(wxDC& Dc, const HBContext &ct); + void DrawChord(wxDC& Dc, const HBContext& Context); - void UnDrawChord(wxDC& Dc, const HBContext &ct); + void UnDrawChord(wxDC& Dc, const HBContext& Context); bool Find(float x, float y, HBContext &out); @@ -508,13 +507,13 @@ virtual void OnMouseEvent(wxMouseEvent& MouseEvent); - void SetMarker(int id, wxToolBar *mpToolBar); + void SetMarker(int MenuId, wxToolBar* pToolBar); - void SetScaleType(int menu_id, tScaleType st, wxToolBar *tb); + void SetScaleType(int MenuId, tScaleType ScaleType, wxToolBar* pToolBar); private: - static tScaleType scale_type; + static tScaleType mScaleType; static int transpose_res; @@ -524,7 +523,7 @@ int mMargin; - HBContext* seq[SEQMAX]; + HBContext* mSequence[SEQMAX]; int mSequenceCount; @@ -532,38 +531,38 @@ bool mHasChanged; - HBContext mouse_context; + HBContext mMouseContext; bool mHaunschildLayout; - bool mark_4_common; + bool mMark4Common; - bool mark_3_common; + bool mMark3Common; - bool mark_2_common; + bool mMark2Common; - bool mark_1_common; + bool mMark1Common; - bool mark_b_common; + bool mMarkBCommon; - bool mark_0_common; + bool mMark0Common; - bool mark_1_semi; + bool mMark1Semi; - bool mark_251; + bool mMark251; - bool mark_tritone; + bool mMarkTritone; - bool mark_piano; + bool mMarkPiano; - int active_marker; + int mActiveMarker; DECLARE_EVENT_TABLE() }; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -tScaleType HBCanvas::scale_type = Major; +tScaleType HBCanvas::mScaleType = Major; const int HBCanvas::ScFa = 50; int HBCanvas::transpose_res = 8; int HBCanvas::analyze_res = 8; @@ -581,25 +580,24 @@ HBCanvas::HBCanvas(wxFrame* pParent, int x, int y, int w, int h) : wxScrolledWindow(pParent, wxID_ANY, wxPoint(x, y), wxSize(w, h)) { -// parent = pParent; mSequenceCount = 0; - active_marker = 0; + mActiveMarker = 0; mHaunschildLayout = false; - mark_4_common = 0; - mark_3_common = 0; - mark_2_common = 0; - mark_1_common = 0; - mark_b_common = 0; - mark_0_common = 0; - mark_1_semi = 0; - mark_251 = 0; - mark_tritone = 0; - mark_piano = 0; + mMark4Common = false; + mMark3Common = false; + mMark2Common = false; + mMark1Common = false; + mMarkBCommon = false; + mMark0Common = false; + mMark1Semi = false; + mMark251 = false; + mMarkTritone = false; + mMarkPiano = false; for (int i = 0; i < SEQMAX; i++) { - seq[i] = new HBContext(); + mSequence[i] = new HBContext(); } wxClientDC Dc(this); @@ -635,7 +633,7 @@ } for (int i = 0; i < SEQMAX; i++) { - delete seq[i]; + delete mSequence[i]; } } @@ -648,7 +646,7 @@ Os << a.mSequenceCount << endl; for (i = 0; i < a.mSequenceCount; i++) { - Os << *a.seq[i]; + Os << *a.mSequence[i]; } return Os; } @@ -667,7 +665,7 @@ Is >> a.mSequenceCount; for (i = 0; i < a.mSequenceCount; i++) { - Is >> *a.seq[i]; + Is >> *a.mSequence[i]; } a.Refresh(); return Is; @@ -675,46 +673,66 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void HBCanvas::SetMarker(int id, wxToolBar *mpToolBar) +void HBCanvas::SetMarker(int MenuId, wxToolBar* pToolBar) { - if (id != active_marker) + if (MenuId != mActiveMarker) { - if (active_marker && mpToolBar->GetToolState(active_marker)) + if (mActiveMarker && pToolBar->GetToolState(mActiveMarker)) { - mpToolBar->ToggleTool(active_marker, false); + pToolBar->ToggleTool(mActiveMarker, false); } - mpToolBar->ToggleTool(id, true); - active_marker = id; + pToolBar->ToggleTool(MenuId, true); + mActiveMarker = MenuId; } - mark_4_common = 0; - mark_3_common = 0; - mark_2_common = 0; - mark_1_common = 0; - mark_b_common = 0; - mark_0_common = 0; - mark_1_semi = 0; - mark_251 = 0; - mark_tritone = 0; - mark_piano = 0; + mMark4Common = false; + mMark3Common = false; + mMark2Common = false; + mMark1Common = false; + mMarkBCommon = false; + mMark0Common = false; + mMark1Semi = false; + mMark251 = false; + mMarkTritone = false; + mMarkPiano = false; - switch (id) + switch (MenuId) { - case MEN_EQ4: mark_4_common = 1; break; - case MEN_EQ3: mark_3_common = 1; break; - case MEN_EQ2: mark_2_common = 1; break; - case MEN_EQ1: mark_1_common = 1; break; - case MEN_EQB: mark_b_common = 1; break; - case MEN_EQH: mark_1_semi = 1; break; - case MEN_EQ0: mark_0_common = 1; break; - case MEN_251: mark_251 = 1; break; - case MEN_TRITONE: mark_tritone = 1; break; - case MEN_PIANO: mark_piano = 1; break; + case MEN_EQ4: + mMark4Common = true; + break; + case MEN_EQ3: + mMark3Common = true; + break; + case MEN_EQ2: + mMark2Common = true; + break; + case MEN_EQ1: + mMark1Common = true; + break; + case MEN_EQB: + mMarkBCommon = true; + break; + case MEN_EQH: + mMark1Semi = true; + break; + case MEN_EQ0: + mMark0Common = true; + break; + case MEN_251: + mMark251 = true; + break; + case MEN_TRITONE: + mMarkTritone = true; + break; + case MEN_PIANO: + mMarkPiano = true; + break; } - if (id > 0 && !mpToolBar->GetToolState(id)) + if (MenuId > 0 && !pToolBar->GetToolState(MenuId)) { - mpToolBar->ToggleTool(id, true); + pToolBar->ToggleTool(MenuId, true); } Refresh(); @@ -729,21 +747,21 @@ return 0; } int i = step * mSequenceCount / n_steps; - return player.GetChordKeys(out, *seq[i]); + return player.GetChordKeys(out, *mSequence[i]); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- int HBCanvas::GetSelectedChord(int *out) { - return player.GetChordKeys(out, mouse_context); + return player.GetChordKeys(out, mMouseContext); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- int HBCanvas::GetSelectedScale(int *out) { - return player.GetMeldyKeys(out, mouse_context); + return player.GetMeldyKeys(out, mMouseContext); } //----------------------------------------------------------------------------- @@ -755,29 +773,30 @@ return 0; } int i = step * mSequenceCount / n_steps; - out[0] = player.GetBassKey(*seq[i]); + out[0] = player.GetBassKey(*mSequence[i]); return 1; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void HBCanvas::ChordRect(JZRectangle& Rectangle, const HBContext &ct) +void HBCanvas::ChordRect(JZRectangle& Rectangle, const HBContext& Context) { - if (ct.SeqNr()) + if (Context.SeqNr()) { - Rectangle.x = (int)(mChordX + (ct.SeqNr() - 1) % 8 * mChordWidth); - Rectangle.y = (int)(mChordHeight * ((ct.SeqNr() -1) / 8 + 0.5)); + Rectangle.x = (int)(mChordX + (Context.SeqNr() - 1) % 8 * mChordWidth); + Rectangle.y = (int)(mChordHeight * ((Context.SeqNr() -1) / 8 + 0.5)); } else if (!mHaunschildLayout) { - Rectangle.x = (int)(mChordX + ct.ChordNr() * mChordWidth); - Rectangle.y = (int)(mChordY + ct.ScaleNr() * mChordHeight); + Rectangle.x = (int)(mChordX + Context.ChordNr() * mChordWidth); + Rectangle.y = (int)(mChordY + Context.ScaleNr() * mChordHeight); } else { Rectangle.x = (int)( - mChordX + (5 * ct.ChordNr() % 7 + 5 * ct.ScaleNr() % 12) % 7 * mChordWidth); - Rectangle.y = (int)(mChordY + (5 * ct.ScaleNr() % 12) * mChordHeight); + mChordX + (5 * Context.ChordNr() % 7 + + 5 * Context.ScaleNr() % 12) % 7 * mChordWidth); + Rectangle.y = (int)(mChordY + (5 * Context.ScaleNr() % 12) * mChordHeight); } Rectangle.x += mMargin; @@ -788,11 +807,11 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void HBCanvas::DrawChord(wxDC& Dc, const HBContext &ct) +void HBCanvas::DrawChord(wxDC& Dc, const HBContext& Context) { // Draw the surrounding box. JZRectangle Rectangle; - ChordRect(Rectangle, ct); + ChordRect(Rectangle, Context); Dc.DrawRectangle( Rectangle.x, @@ -801,7 +820,7 @@ Rectangle.height); int w, h; - const char* pName = ct.ChordName(); + const char* pName = Context.ChordName(); Dc.GetTextExtent(pName, &w, &h); Dc.DrawText( pName, @@ -811,11 +830,11 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void HBCanvas::UnDrawChord(wxDC& Dc, const HBContext& ct) +void HBCanvas::UnDrawChord(wxDC& Dc, const HBContext& Context) { // draw surrounding box JZRectangle Rectangle; - ChordRect(Rectangle, ct); + ChordRect(Rectangle, Context); Dc.SetPen(*wxWHITE_PEN); Dc.DrawRectangle( @@ -837,44 +856,52 @@ Dc.DrawText("Seq", 5, 5); mChordY = - (mSequenceCount / 8 + 1) * mChordHeight + (mSequenceCount % 8 ? mChordHeight : 0) + + (mSequenceCount / 8 + 1) * mChordHeight + + (mSequenceCount % 8 ? mChordHeight : 0) + mChordHeight; HBContextIterator iter; - iter.SetSequence(seq, mSequenceCount); - iter.SetScaleType(scale_type); + iter.SetSequence(mSequence, mSequenceCount); + iter.SetScaleType(mScaleType); while (iter()) { - const HBContext &ct = iter.Context(); - DrawChord(Dc, ct); - if (ct.ChordNr() == 0 && ct.SeqNr() == 0) + const HBContext& Context = iter.Context(); + DrawChord(Dc, Context); + if (Context.ChordNr() == 0 && Context.SeqNr() == 0) { JZRectangle Rectangle; - ChordRect(Rectangle, ct); - Dc.DrawText(ct.ScaleName(), 5, Rectangle.y); + ChordRect(Rectangle, Context); + Dc.DrawText(Context.ScaleName(), 5, Rectangle.y); } } - DrawMarkers(Dc, mouse_context); - + DrawMarkers(Dc, mMouseContext); +/* if (!mHaunschildLayout) { for (int j = 0; j < 7; j++) { - HBContext ct(0, j, scale_type); + HBContext Context(0, j, mScaleType); JZRectangle Rectangle; - ChordRect(Rectangle, ct); + ChordRect(Rectangle, Context); Rectangle.y -= (int)mChordHeight; int w, h; - const char *name = ct.ChordNrName(); - Dc.GetTextExtent(name, &w, &h); - Dc.DrawText((char *)name, Rectangle.x + (Rectangle.width - w)/2, Rectangle.y + (Rectangle.height - h)/2); + const char* pName = Context.ChordNrName(); + Dc.GetTextExtent(pName, &w, &h); + Dc.DrawText( + pName, + Rectangle.x + (Rectangle.width - w) / 2, + Rectangle.y + (Rectangle.height - h) / 2); - const char *type = ct.ContextName(); - Dc.GetTextExtent(type, &w, &h); - Dc.DrawText((char *)type, Rectangle.x + (Rectangle.width - w)/2, Rectangle.y + (Rectangle.height - h)/2 - h); + const char* pType = Context.ContextName(); + Dc.GetTextExtent(pType, &w, &h); + Dc.DrawText( + pType, + Rectangle.x + (Rectangle.width - w) / 2, + Rectangle.y + (Rectangle.height - h) / 2 - h); } } + */ } // ----------------------------------------------------------------------------- @@ -941,7 +968,7 @@ { public: - HBMatchMarkers(const HBContext &ct, HBCanvas *cv); + HBMatchMarkers(const HBContext& Context, HBCanvas *cv); virtual bool operator()(const HBContext &); @@ -954,7 +981,7 @@ private: HBCanvas* mpHbWindow; - HBContext context; + HBContext mContext; HBChord chord; HBChord scale; int n_chord; @@ -968,27 +995,27 @@ }; -HBMatchMarkers::HBMatchMarkers(const HBContext &ct, HBCanvas *cv) - : context(ct) +HBMatchMarkers::HBMatchMarkers(const HBContext& Context, HBCanvas *cv) + : mContext(Context) { mpHbWindow = cv; - chord = context.Chord(); + chord = mContext.Chord(); n_chord = chord.Count(); - chord_key = context.ChordKey(); - scale = context.Scale(); + chord_key = mContext.ChordKey(); + scale = mContext.Scale(); msg[0] = 0; msg[2] = 0; { // 251-move - HBContext tmp(ct.ScaleNr(), ct.ChordNr() + 3, ct.ScaleType()); + HBContext tmp(Context.ScaleNr(), Context.ChordNr() + 3, Context.ScaleType()); key251 = tmp.ChordKey(); } tritone = (chord_key + 6) % 12; - if (mpHbWindow->mark_piano) + if (mpHbWindow->mMarkPiano && gpTrackFrame->GetPianoWindow()) { tEventArray &buf = gpTrackFrame->GetPianoWindow()->mPasteBuffer; for (int i = 0; i < buf.nEvents; i++) @@ -1014,37 +1041,37 @@ msg[0] = 0; msg[2] = 0; - if (mpHbWindow->mark_piano && o_chord.Contains(piano)) + if (mpHbWindow->mMarkPiano && o_chord.Contains(piano)) { strcat(msg, ", P"); } - if (mpHbWindow->mark_4_common && o_chord == chord) + if (mpHbWindow->mMark4Common && o_chord == chord) { strcat(msg, ", =4"); } - if (mpHbWindow->mark_3_common && n_common == 3) + if (mpHbWindow->mMark3Common && n_common == 3) { strcat(msg, ", =3"); } - if (mpHbWindow->mark_2_common && n_common == 2) + if (mpHbWindow->mMark2Common && n_common == 2) { strcat(msg, ", =2"); } - if (mpHbWindow->mark_1_common && n_common == 1) + if (mpHbWindow->mMark1Common && n_common == 1) { strcat(msg, ", =1"); } - if (mpHbWindow->mark_0_common && n_common == 0) + if (mpHbWindow->mMark0Common && n_common == 0) { strcat(msg, ", =0"); } - if (mpHbWindow->mark_1_semi && n_common == n_chord - 1) + if (mpHbWindow->mMark1Semi && n_common == n_chord - 1) { HBChord delta = chord ^ o_chord; int key = delta.Iter(0); @@ -1054,17 +1081,17 @@ } } - if (mpHbWindow->mark_251 && key251 == o_chord_key) + if (mpHbWindow->mMark251 && key251 == o_chord_key) { strcat(msg, ", 251"); } - if (mpHbWindow->mark_b_common && chord_key == o_chord_key) + if (mpHbWindow->mMarkBCommon && chord_key == o_chord_key) { strcat(msg, ", =B"); } - if (mpHbWindow->mark_tritone && o_chord_key == tritone) + if (mpHbWindow->mMarkTritone && o_chord_key == tritone) { strcat(msg, ", =T"); } @@ -1072,15 +1099,15 @@ return msg[2] ? 1 : 0; } -void HBCanvas::DrawMarkers(wxDC& Dc, const HBContext& ct) +void HBCanvas::DrawMarkers(wxDC& Dc, const HBContext& Context) { JZRectangle Rectangle; Dc.SetLogicalFunction(wxXOR); Dc.SetBrush(*wxTRANSPARENT_BRUSH); - HBMatchMarkers match(ct, this); + HBMatchMarkers match(Context, this); HBContextIterator iter(match); - iter.SetSequence(seq, mSequenceCount); - iter.SetScaleType(scale_type); + iter.SetSequence(mSequence, mSequenceCount); + iter.SetScaleType(mScaleType); while (iter()) { ChordRect(Rectangle, iter.Context()); @@ -1095,19 +1122,19 @@ Rectangle.height); } - // invert actual chord - if (ct.ScaleType() == scale_type) + // Invert the actual chord. + if (Context.ScaleType() == mScaleType) { Dc.SetBrush(*wxBLACK_BRUSH); - ChordRect(Rectangle, ct); + ChordRect(Rectangle, Context); Dc.DrawRectangle( Rectangle.x, Rectangle.y, Rectangle.width, Rectangle.height); - if (ct.SeqNr() > 0) + if (Context.SeqNr() > 0) { - HBContext c(ct); + HBContext c(Context); c.SetSeqNr(0); ChordRect(Rectangle, c); Dc.DrawRectangle( @@ -1117,6 +1144,7 @@ Rectangle.height); } } + Dc.SetLogicalFunction(wxCOPY); Dc.SetBrush(*wxWHITE_BRUSH); } @@ -1124,8 +1152,8 @@ bool HBCanvas::Find(float x, float y, HBContext &out) { HBContextIterator iter; - iter.SetSequence(seq, mSequenceCount); - iter.SetScaleType(scale_type); + iter.SetSequence(mSequence, mSequenceCount); + iter.SetScaleType(mScaleType); while (iter()) { JZRectangle Rectangle; @@ -1143,7 +1171,7 @@ void HBCanvas::ClearSeq() { mSequenceCount = 0; - mouse_context.SetSeqNr(0); + mMouseContext.SetSeqNr(0); Refresh(); } @@ -1156,65 +1184,66 @@ Dc.SetFont(*wxSMALL_FONT); - HBContext context; + HBContext Context; int x, y; MouseEvent.GetPosition(&x, &y); - if (Find(x, y, context)) + if (Find(x, y, Context)) { if (MouseEvent.ButtonDown()) { - player.StartPlay(context); + player.StartPlay(Context); if ( - MouseEvent.LeftDown() && - MouseEvent.ShiftDown() || + (MouseEvent.LeftDown() && MouseEvent.ShiftDown()) || MouseEvent.MiddleDown()) { - if (context.SeqNr()) + if (Context.SeqNr()) { - // remove a chord - if (context.SeqNr() == mSequenceCount) + // Remove a chord. + if (Context.SeqNr() == mSequenceCount) { - // remove markers first - if (mouse_context.SeqNr() == mSequenceCount) + // Remove markers first. + if (mMouseContext.SeqNr() == mSequenceCount) { - DrawMarkers(Dc, mouse_context); - mouse_context.SetSeqNr(0); - DrawMarkers(Dc, mouse_context); + DrawMarkers(Dc, mMouseContext); + mMouseContext.SetSeqNr(0); + DrawMarkers(Dc, mMouseContext); } --mSequenceCount; - UnDrawChord(Dc, context); - context.SetSeqNr(0); + UnDrawChord(Dc, Context); + Context.SetSeqNr(0); Refresh(); } } else if (mSequenceCount < SEQMAX) { - // add a chord - context.SetSeqNr(mSequenceCount + 1); - *seq[mSequenceCount++] = context; - DrawMarkers(Dc, mouse_context); - DrawChord(Dc, context); - DrawMarkers(Dc, mouse_context); + // Add a chord. + Context.SetSeqNr(mSequenceCount + 1); + *mSequence[mSequenceCount++] = Context; + DrawMarkers(Dc, mMouseContext); + DrawChord(Dc, Context); + DrawMarkers(Dc, mMouseContext); Refresh(); } } } else if ( - MouseEvent.Dragging() && player.IsPlaying() && context != player.Context()) + MouseEvent.Dragging() && + player.IsPlaying() && + Context != player.Context()) { player.StopPlay(); - player.StartPlay(context); + player.StartPlay(Context); } - if (MouseEvent.LeftDown() || MouseEvent.MiddleDown()) // && context != mouse_context) + if (MouseEvent.LeftDown() || MouseEvent.MiddleDown()) // && Context != mMouseContext) { - DrawMarkers(Dc, mouse_context); - mouse_context = context; - //mouse_context.SetSeqNr(0); - DrawMarkers(Dc, mouse_context); + DrawMarkers(Dc, mMouseContext); + mMouseContext = Context; +// mMouseContext.SetSeqNr(0); + DrawMarkers(Dc, mMouseContext); // paste to PianoWin buffer - if (!mark_piano && gpTrackFrame->GetPianoWindow()) + if (!mMarkPiano && gpTrackFrame->GetPianoWindow()) { tEventArray &buf = gpTrackFrame->GetPianoWindow()->mPasteBuffer; buf.Clear(); @@ -1225,13 +1254,14 @@ if (gpTrackFrame->GetPianoWindow()) { // Show in GuitarWin - JZGuitarFrame* guitar = gpTrackFrame->GetPianoWindow()->GetGuitarFrame(); - if (guitar) + JZGuitarFrame* pGuitarFrame = + gpTrackFrame->GetPianoWindow()->GetGuitarFrame(); + if (pGuitarFrame) { // Remove actual pianowin/mouse position - guitar->ShowPitch(0); -// guitar->Redraw(); - guitar->Update(); + pGuitarFrame->ShowPitch(0); +// pGuitarFrame->Redraw(); + pGuitarFrame->Update(); } } } @@ -1243,21 +1273,24 @@ } -void HBCanvas::SetScaleType(int menu_id, tScaleType st, wxToolBar *tb) +void HBCanvas::SetScaleType( + int MenuId, + tScaleType ScaleType, + wxToolBar* pToolBar) { - scale_type = st; - tb->ToggleTool(MEN_MAJSCALE, false); - tb->ToggleTool(MEN_HARSCALE, false); - tb->ToggleTool(MEN_MELSCALE, false); - tb->ToggleTool(MEN_IONSCALE, false); - tb->ToggleTool(menu_id, true); + mScaleType = ScaleType; + pToolBar->ToggleTool(MEN_MAJSCALE, false); + pToolBar->ToggleTool(MEN_HARSCALE, false); + pToolBar->ToggleTool(MEN_MELSCALE, false); + pToolBar->ToggleTool(MEN_IONSCALE, false); + pToolBar->ToggleTool(MenuId, true); Refresh(); } void HBCanvas::TransposeSelection() { - if (!SeqDefined()) + if (!IsSequenceDefined()) { wxMessageBox("define a chord sequence first", "error", wxOK); return; @@ -1265,7 +1298,7 @@ if (gpTrackWindow->EventsSelected("please select destination range in track window")) { wxBeginBusyCursor(); - HBAnalyzer analyzer(seq, mSequenceCount); + HBAnalyzer analyzer(mSequence, mSequenceCount); analyzer.Transpose(gpTrackWindow->mpFilter, transpose_res); wxEndBusyCursor(); } @@ -1303,31 +1336,31 @@ } } -void HBCanvas::OnMenuCommand(int id, wxToolBar *mpToolBar) +void HBCanvas::MenuCommand(int MenuId, wxToolBar* pToolBar) { - switch (id) + switch (MenuId) { case MEN_MAJSCALE: - SetScaleType(id, Major, mpToolBar); + SetScaleType(MenuId, Major, pToolBar); break; case MEN_HARSCALE: - SetScaleType(id, Harmon, mpToolBar); + SetScaleType(MenuId, Harmon, pToolBar); break; case MEN_MELSCALE: - SetScaleType(id, Melod, mpToolBar); + SetScaleType(MenuId, Melod, pToolBar); break; case MEN_IONSCALE: - SetScaleType(id, Ionb13, mpToolBar); + SetScaleType(MenuId, Ionb13, pToolBar); break; case MEN_ANALYZE: if (gpTrackWindow->EventsSelected("please select source range in track window")) { wxBeginBusyCursor(); - HBAnalyzer analyzer(seq, (int)SEQMAX); + HBAnalyzer analyzer(mSequence, (int)SEQMAX); mSequenceCount = analyzer.Analyze(gpTrackWindow->mpFilter, analyze_res); Refresh(); wxEndBusyCursor(); @@ -1343,9 +1376,8 @@ break; default: - SetMarker(id, mpToolBar); + SetMarker(MenuId, pToolBar); break; - } } @@ -1354,7 +1386,7 @@ { if (mSequenceCount > 0 && gpTrackWindow->mpSnapSel->Selected) { - HBAnalyzer *analyzer = new HBAnalyzer(seq, mSequenceCount); + HBAnalyzer *analyzer = new HBAnalyzer(mSequence, mSequenceCount); analyzer->Init(gpTrackWindow->mpFilter, transpose_res); return analyzer; } @@ -1367,7 +1399,7 @@ struct tNamedChord { - const char *name; + const char* mpName; int bits; }; @@ -1375,70 +1407,71 @@ const int n_scale_names = 45; -tNamedChord chord_names[n_chord_names] = { - { " j7", 0x891}, - { " m7", 0x489}, - { " 7", 0x491}, - { " m75-", 0x449}, - { " mj7", 0x889}, - { " j75+", 0x911}, - { " dim", 0x249}, - { " sus4", 0xa1}, +tNamedChord chord_names[n_chord_names] = +{ + { " j7", 0x891}, + { " m7", 0x489}, + { " 7", 0x491}, + { " m75-", 0x449}, + { " mj7", 0x889}, + { " j75+", 0x911}, + { " dim", 0x249}, + { " sus4", 0xa1}, { " 7sus4", 0x4a1}, - { " j7sus4", 0x8a1}, - { " alt (79+13-)", 0x519}, - { " 75-", 0x451}, + { " j7sus4", 0x8a1}, + { " alt (79+13-)", 0x519}, + { " 75-", 0x451}, }; -tNamedChord scale_names[n_scale_names] = { - { "***** major scales *****", 0x0}, - { "maj I (ionic)", 0xab5}, - { "maj IV (lydic)", 0xad5}, - { "har III (ion #5)", 0xb35}, - { "har VI (lyd #9)", 0xad9}, - { "mel III (lyd #5)", 0xb55}, - { "augmented", 0x333}, - { "hj I (ionic b13)", 0x9b5}, - { "***** minor scales *****", 0x0}, - { "minor penta", 0x4a9}, - { "maj VI (aeolic)", 0x5ad}, - { "maj II (doric)", 0x6ad}, - { "mel II (doric b9)", 0x6ab}, - { "maj III (phrygic)", 0x5ab}, - { "japan penta", 0x4a3}, - { "har IV (dor #11)", 0x6cd}, - { "har I (harmonic minor)", 0x9ad}, - { "mel I (melodic minor)", 0xaad}, - { "gipsy", 0x9cd}, - { "hj IV (melodic #11)", 0xacd}, - { "***** dominant scales *****", 0x0}, - { "major penta", 0x295}, - { "ind. penta", 0x4b1}, - { "maj V (mixolyd)", 0x6b5}, - { "har V (har dominant)", 0x5b3}, - { "mel IV (mixo #11)", 0x6d5}, - { "mixo #11b9", 0x6d3}, - { "mel V (mixo b13)", 0x5b5}, - { "hj V (mixo b9)", 0x6b3}, - { "full", 0x555}, - { "hj III (har alt)", 0x59b}, - { "mel VII (alt)", 0x55b}, - { "half/full", 0x6db}, - { "***** semi dimin *****", 0x0}, - { "maj VII (locr)", 0x56b}, - { "mel VI (locr 9)", 0x56d}, - { "har II (locr 13)", 0x66b}, - { "hj II (doric b5)", 0x66d}, - { "***** dimin *****", 0x0}, - { "har VII (har dim)", 0x35b}, - { "full/half", 0xa6d}, - { "hj VII (locr dim)", 0x36b}, - { "***** blues scales *****", 0x0}, - { "minor penta b5", 0x4e9}, - { "blues scale", 0x4f9}, +tNamedChord scale_names[n_scale_names] = +{ + { "***** major scales *****", 0x0}, + { "maj I (ionic)", 0xab5}, + { "maj IV (lydic)", 0xad5}, + { "har III (ion #5)", 0xb35}, + { "har VI (lyd #9)", 0xad9}, + { "mel III (lyd #5)", 0xb55}, + { "augmented", 0x333}, + { "hj I (ionic b13)", 0x9b5}, + { "***** minor scales *****", 0x0}, + { "minor penta", 0x4a9}, + { "maj VI (aeolic)", 0x5ad}, + { "maj II (doric)", 0x6ad}, + { "mel II (doric b9)", 0x6ab}, + { "maj III (phrygic)", 0x5ab}, + { "japan penta", 0x4a3}, + { "har IV (dor #11)", 0x6cd}, + { "har I (harmonic minor)", 0x9ad}, + { "mel I (melodic minor)", 0xaad}, + { "gipsy", 0x9cd}, + { "hj IV (melodic #11)", 0xacd}, + { "***** dominant scales *****", 0x0}, + { "major penta", 0x295}, + { "ind. penta", 0x4b1}, + { "maj V (mixolyd)", 0x6b5}, + { "har V (har dominant)", 0x5b3}, + { "mel IV (mixo #11)", 0x6d5}, + { "mixo #11b9", 0x6d3}, + { "mel V (mixo b13)", 0x5b5}, + { "hj V (mixo b9)", 0x6b3}, + { "full", 0x555}, + { "hj III (har alt)", 0x59b}, + { "mel VII (alt)", 0x55b}, + { "half/full", 0x6db}, + { "***** semi dimin *****", 0x0}, + { "maj VII (locr)", 0x56b}, + { "mel VI (locr 9)", 0x56d}, + { "har II (locr 13)", 0x66b}, + { "hj II (doric b5)", 0x66d}, + { "***** dimin *****", 0x0}, + { "har VII (har dim)", 0x35b}, + { "full/half", 0xa6d}, + { "hj VII (locr dim)", 0x36b}, + { "***** blues scales *****", 0x0}, + { "minor penta b5", 0x4e9}, + { "blues scale", 0x4f9}, }; - class HBContextDlg : public wxDialog { public: @@ -1493,7 +1526,7 @@ HBContextDlg::HBContextDlg(HBCanvas *c, wxFrame *parent, HBContext *pct) - : wxDialog(parent, -1, "Edit chord/scale" ) + : wxDialog(parent, wxID_ANY, "Edit chord/scale" ) { int i; @@ -1561,7 +1594,7 @@ for (i = 0; i < n_chord_names; i++) { - cnames[i] = (char *)chord_names[i].name; + cnames[i] = (char *)chord_names[i].mpName; } chord_lst = new wxListBox(this, -1, wxPoint(10, y), wxSize(100, 200), n_chord_names, cnames, wxLB_SINGLE| wxLB_NEEDED_SB);//"Chords" @@ -1571,7 +1604,7 @@ wxString* snames = new wxString[n_scale_names]; for (i = 0; i < n_scale_names; i++) { - snames[i] = (char *)scale_names[i].name; + snames[i] = (char *)scale_names[i].mpName; } scale_lst = new wxListBox( this, @@ -1683,10 +1716,10 @@ } else { - HBContext ct(*pcontext); - *ct.PChord() = chord; - *ct.PScale() = scale; - player.StartPlay(ct); + HBContext Context(*pcontext); + *Context.PChord() = chord; + *Context.PScale() = scale; + player.StartPlay(Context); play_but->SetLabel("stop"); } } @@ -1702,10 +1735,10 @@ if (player.IsPlaying()) { player.StopPlay(); - HBContext ct(*pcontext); - *ct.PChord() = chord; - *ct.PScale() = scale; - player.StartPlay(ct); + HBContext Context(*pcontext); + *Context.PChord() = chord; + *Context.PScale() = scale; + player.StartPlay(Context); } } @@ -1772,12 +1805,27 @@ //----------------------------------------------------------------------------- BEGIN_EVENT_TABLE(HBFrame, wxFrame) -// EVT_SIZE(HBFrame::OnSize) + EVT_MENU(MEN_MAJSCALE, HBFrame::OnToolBarSelect) + EVT_MENU(MEN_HARSCALE, HBFrame::OnToolBarSelect) + EVT_MENU(MEN_MELSCALE, HBFrame::OnToolBarSelect) + EVT_MENU(MEN_IONSCALE, HBFrame::OnToolBarSelect) + EVT_MENU(MEN_EQ4, HBFrame::OnToolBarSelect) + EVT_MENU(MEN_EQ3, HBFrame::OnToolBarSelect) + EVT_MENU(MEN_EQ2, HBFrame::OnToolBarSelect) + EVT_MENU(MEN_EQ1, HBFrame::OnToolBarSelect) + EVT_MENU(MEN_EQ0, HBFrame::OnToolBarSelect) + EVT_MENU(MEN_EQH, HBFrame::OnToolBarSelect) + EVT_MENU(MEN_251, HBFrame::OnToolBarSelect) + EVT_MENU(MEN_EQB, HBFrame::OnToolBarSelect) + EVT_MENU(MEN_TRITONE, HBFrame::OnToolBarSelect) + EVT_MENU(MEN_PIANO, HBFrame::OnToolBarSelect) - EVT_MENU(MEN_LOAD, HBFrame::OnFileLoad) + EVT_MENU(wxID_OPEN, HBFrame::OnFileLoad) EVT_MENU(wxID_SAVEAS, HBFrame::OnFileSaveAs) + EVT_MENU(MEN_EDIT, HBFrame::OnSettingsChord) + EVT_MENU(MEN_MIDI, HBFrame::OnSettingsMidi) EVT_MENU(MEN_HAUNSCH, HBFrame::OnSettingsHaunschild) @@ -1788,6 +1836,10 @@ EVT_MENU(MEN_HELP, HBFrame::OnHelp) +// EVT_MENU(MEN_ANALYZE, +// EVT_MENU(MEN_TRANSPOSE, +// EVT_MENU(MEN_SETTINGS, + END_EVENT_TABLE() //----------------------------------------------------------------------------- @@ -1808,7 +1860,7 @@ mpToolBar = new JZToolBar(this, tdefs); wxMenu* pFileMenu = new wxMenu; - pFileMenu->Append(MEN_LOAD, "&Load..."); + pFileMenu->Append(wxID_OPEN, "&Load..."); pFileMenu->Append(wxID_SAVEAS, "Save &As..."); pFileMenu->Append(wxID_CLOSE, "&Close"); @@ -1886,16 +1938,18 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int HBFrame::SeqDefined() +bool HBFrame::IsSequenceDefined() { - return mpHbWindow->SeqDefined(); + return mpHbWindow->IsSequenceDefined(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- int HBFrame::SeqSelected() { - if (mpHbWindow->mSequenceCount == 0 || mpHbWindow->mouse_context.SeqNr() == 0) + if ( + mpHbWindow->mSequenceCount == 0 || + mpHbWindow->mMouseContext.SeqNr() == 0) { wxMessageBox("Select a chord from sequence first", "Error", wxOK); return 0; @@ -1905,60 +1959,53 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int HBFrame::GetChordKeys(int *out, int step, int n_steps) +int HBFrame::GetChordKeys(int* out, int step, int n_steps) { return mpHbWindow->GetChordKeys(out, step, n_steps); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int HBFrame::GetSelectedChord(int *out) +int HBFrame::GetSelectedChord(int* out) { return mpHbWindow->GetSelectedChord(out); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int HBFrame::GetSelectedScale(int *out) +int HBFrame::GetSelectedScale(int* out) { return mpHbWindow->GetSelectedScale(out); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int HBFrame::GetBassKeys(int *out, int step, int n_steps) +int HBFrame::GetBassKeys(int* out, int step, int n_steps) { return mpHbWindow->GetBassKeys(out, step, n_steps); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void HBFrame::OnMenuCommand(int id) +void HBFrame::OnToolBarSelect(wxCommandEvent& Event) { - switch(id) + mpHbWindow->MenuCommand( + Event.GetId(), + mpToolBar->GetDelegateToolBar()); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void HBFrame::OnSettingsChord(wxCommandEvent& Event) +{ + if (!SeqSelected()) { - - case MEN_EDIT: - { - if (!SeqSelected()) - { - return; - } - } - (void) new HBContextDlg( - mpHbWindow, - this, - mpHbWindow->seq[mpHbWindow->mouse_context.SeqNr() - 1]); - break; - - case wxID_CLOSE: - Destroy(); - break; - - default: - mpHbWindow->OnMenuCommand(id, mpToolBar->GetDelegateToolBar()); - break; + return; } + (void) new HBContextDlg( + mpHbWindow, + this, + mpHbWindow->mSequence[mpHbWindow->mMouseContext.SeqNr() - 1]); } //----------------------------------------------------------------------------- Modified: trunk/jazz/src/Harmony.h =================================================================== --- trunk/jazz/src/Harmony.h 2008-04-07 04:54:17 UTC (rev 437) +++ trunk/jazz/src/Harmony.h 2008-04-07 06:14:55 UTC (rev 438) @@ -40,17 +40,18 @@ { } - virtual int SeqDefined() = 0; // true = yes + // true = yes + virtual bool IsSequenceDefined() = 0; // Return number of keys in out - virtual int GetChordKeys(int *out, int step, int n_steps) = 0; + virtual int GetChordKeys(int* out, int step, int n_steps) = 0; - virtual int GetBassKeys(int *out, int step, int n_steps) = 0; + virtual int GetBassKeys(int* out, int step, int n_steps) = 0; - virtual int GetSelectedChord(int *out) = 0; // returns # keys + virtual int GetSelectedChord(int* out) = 0; // returns # keys - virtual int GetSelectedScale(int *out) = 0; // returns # keys + virtual int GetSelectedScale(int* out) = 0; // returns # keys virtual HBAnalyzer* GetAnalyzer() = 0; @@ -67,7 +68,7 @@ ~HBFrame(); - int SeqDefined(); + bool IsSequenceDefined(); int GetChordKeys(int* out, int step, int n_steps); @@ -85,12 +86,14 @@ protected: - virtual void OnMenuCommand(int id); + void OnToolBarSelect(wxCommandEvent& Event); void OnFileLoad(wxCommandEvent& Event); void OnFileSaveAs(wxCommandEvent& Event); + void OnSettingsChord(wxCommandEvent& Event); + void OnSettingsMidi(wxCommandEvent& Event); void OnSettingsHaunschild(wxCommandEvent& Event); @@ -103,11 +106,17 @@ private: + int SeqSelected(); + + private: + HBCanvas* mpHbWindow; - int SeqSelected(); + JZToolBar* mpToolBar; + tGenMelody* genmeldy; - DECLARE_EVENT_TABLE() + + DECLARE_EVENT_TABLE() }; extern void CreateHarmonyBrowser(); Modified: trunk/jazz/src/SampleWindow.cpp =================================================================== --- trunk/jazz/src/SampleWindow.cpp 2008-04-07 04:54:17 UTC (rev 437) +++ trunk/jazz/src/SampleWindow.cpp 2008-04-07 06:14:55 UTC (rev 438) @@ -698,9 +698,9 @@ wxMenuBar *menu_bar = new wxMenuBar; wxMenu *menu = new wxMenu; menu->Append(MEN_REVERT, "&Revert to Saved"); - menu->Append(MEN_LOAD, "&Load ..."); - menu->Append(MEN_SAVE, "&Save"); - menu->Append(MEN_SAVEAS, "&Save as ..."); + menu->Append(MEN_LOAD, "&Load..."); + menu->Append(wxID_SAVE, "&Save"); + menu->Append(wxID_SAVEAS, "&Save As..."); menu->Append(MEN_CLOSE, "&Close"); menu_bar->Append(menu, "&File"); Modified: trunk/jazz/src/TrackFrame.cpp =================================================================== --- trunk/jazz/src/TrackFrame.cpp 2008-04-07 04:54:17 UTC (rev 437) +++ trunk/jazz/src/TrackFrame.cpp 2008-04-07 06:14:55 UTC (rev 438) @@ -190,7 +190,7 @@ mpFileMenu->Append(wxID_OPEN, "&Open..."); mpFileMenu->Append(wxID_CLOSE, "&Close"); mpFileMenu->Append(wxID_SAVE, "&Save Project"); - mpFileMenu->Append(wxID_SAVEAS, "Save Project &as..."); + mpFileMenu->Append(wxID_SAVEAS, "Save Project &As..."); mpFileMenu->AppendSeparator(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-07 04:54:18
|
Revision: 437 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=437&view=rev Author: pstieber Date: 2008-04-06 21:54:17 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Added a Save As... capability. Modified Paths: -------------- trunk/jazz/src/Harmony.cpp trunk/jazz/src/Harmony.h Modified: trunk/jazz/src/Harmony.cpp =================================================================== --- trunk/jazz/src/Harmony.cpp 2008-04-07 04:49:52 UTC (rev 436) +++ trunk/jazz/src/Harmony.cpp 2008-04-07 04:54:17 UTC (rev 437) @@ -44,7 +44,6 @@ using namespace std; -#define MEN_CLOSE 1 #define MEN_MIDI 2 #define MEN_TRANSPOSE 4 #define MEN_CLEARSEQ 6 @@ -71,7 +70,6 @@ #define MEN_IONSCALE 25 #define MEN_SETTINGS 26 #define MEN_LOAD 27 -#define MEN_SAVE 28 #include "Bitmaps/open.xpm" @@ -99,7 +97,7 @@ static JZToolDef tdefs[] = { { MEN_LOAD, false, open_xpm, "open harmony file" }, - { MEN_SAVE, false, save_xpm, "save harmony file" }, + { wxID_SAVEAS, false, save_xpm, "save harmony file" }, { JZToolBar::eToolBarSeparator }, { MEN_MAJSCALE, true, majscale_xpm, "major scale" }, { MEN_HARSCALE, true, harscale_xpm, "harmonic scale" }, @@ -479,6 +477,8 @@ void FileLoad(); + void FileSaveAs(); + void OnMenuCommand(int id, wxToolBar *mpToolBar); void TransposeSelection(); @@ -522,17 +522,15 @@ float mChordX, mChordY, mChordWidth, mChordHeight; - float ofs; + int mMargin; -// wxFrame* parent; - HBContext* seq[SEQMAX]; int mSequenceCount; std::string mDefaultFileName; - bool has_changed; + bool mHasChanged; HBContext mouse_context; @@ -614,10 +612,15 @@ mChordHeight = 2.5 * TextHeight; mChordX = 50; mChordY = 4 * mChordHeight; - ofs = TextHeight / 4; + mMargin = TextHeight / 4; + if (mMargin <= 0) + { + mMargin = 1; + } + mDefaultFileName = "noname.har"; - has_changed = false; + mHasChanged = false; SetScrollbars(0, (int)(mChordHeight + 0.5), 0, 12 + SEQMAX / 8 + 2, 0, 0); } @@ -777,10 +780,10 @@ Rectangle.y = (int)(mChordY + (5 * ct.ScaleNr() % 12) * mChordHeight); } - Rectangle.x += (int)ofs; - Rectangle.y -= (int)ofs; - Rectangle.width = (int)(mChordWidth - 2 * ofs); - Rectangle.height = (int)(mChordHeight - 2 * ofs); + Rectangle.x += mMargin; + Rectangle.y -= mMargin; + Rectangle.width = (int)(mChordWidth - 2 * mMargin); + Rectangle.height = (int)(mChordHeight - 2 * mMargin); } //----------------------------------------------------------------------------- @@ -1274,33 +1277,36 @@ mDefaultFileName.c_str(), "Load Harmonies", false, - has_changed, + mHasChanged, "*.har"); - ifstream Is(FileName.c_str()); - Is >> *this; + if (!FileName.empty()) + { + ifstream Is(FileName.c_str()); + Is >> *this; + } } +void HBCanvas::FileSaveAs() +{ + wxString FileName = file_selector( + mDefaultFileName.c_str(), + "Save Harmonies", + true, + mHasChanged, + "*.har"); + + if (!FileName.empty()) + { + ofstream os(FileName.c_str()); + os << *this; + } +} + void HBCanvas::OnMenuCommand(int id, wxToolBar *mpToolBar) { switch (id) { - case MEN_SAVE: - { - wxString fname = file_selector( - mDefaultFileName.c_str(), - "Save Harmonies", - true, - has_changed, - "*.har"); - if (fname) - { - ofstream os(fname); - os << *this; - } - } - break; - case MEN_MAJSCALE: SetScaleType(id, Major, mpToolBar); break; @@ -1770,6 +1776,8 @@ EVT_MENU(MEN_LOAD, HBFrame::OnFileLoad) + EVT_MENU(wxID_SAVEAS, HBFrame::OnFileSaveAs) + EVT_MENU(MEN_MIDI, HBFrame::OnSettingsMidi) EVT_MENU(MEN_HAUNSCH, HBFrame::OnSettingsHaunschild) @@ -1801,8 +1809,8 @@ wxMenu* pFileMenu = new wxMenu; pFileMenu->Append(MEN_LOAD, "&Load..."); - pFileMenu->Append(MEN_SAVE, "&Save"); - pFileMenu->Append(MEN_CLOSE, "&Close"); + pFileMenu->Append(wxID_SAVEAS, "Save &As..."); + pFileMenu->Append(wxID_CLOSE, "&Close"); wxMenu* pSettingsMenu = new wxMenu; pSettingsMenu->Append(MEN_EDIT, "&Chord"); @@ -1943,8 +1951,7 @@ mpHbWindow->seq[mpHbWindow->mouse_context.SeqNr() - 1]); break; - case MEN_CLOSE: -// DELETE_THIS(); + case wxID_CLOSE: Destroy(); break; @@ -1977,6 +1984,13 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +void HBFrame::OnFileSaveAs(wxCommandEvent& Event) +{ + mpHbWindow->FileSaveAs(); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void HBFrame::OnActionClearSequence(wxCommandEvent& Event) { mpHbWindow->ClearSeq(); Modified: trunk/jazz/src/Harmony.h =================================================================== --- trunk/jazz/src/Harmony.h 2008-04-07 04:49:52 UTC (rev 436) +++ trunk/jazz/src/Harmony.h 2008-04-07 04:54:17 UTC (rev 437) @@ -69,13 +69,13 @@ int SeqDefined(); - int GetChordKeys(int *out, int step, int n_steps); + int GetChordKeys(int* out, int step, int n_steps); - int GetSelectedChord(int *out); + int GetSelectedChord(int* out); - int GetSelectedScale(int *out); + int GetSelectedScale(int* out); - int GetBassKeys(int *out, int step, int n_steps); + int GetBassKeys(int* out, int step, int n_steps); HBAnalyzer* GetAnalyzer(); @@ -89,6 +89,8 @@ void OnFileLoad(wxCommandEvent& Event); + void OnFileSaveAs(wxCommandEvent& Event); + void OnSettingsMidi(wxCommandEvent& Event); void OnSettingsHaunschild(wxCommandEvent& Event); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-07 04:49:53
|
Revision: 436 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=436&view=rev Author: pstieber Date: 2008-04-06 21:49:52 -0700 (Sun, 06 Apr 2008) Log Message: ----------- 1. Checked the size of the returned string to fix a bug. 2. Made cosmetic changes. Modified Paths: -------------- trunk/jazz/src/FileSelector.cpp Modified: trunk/jazz/src/FileSelector.cpp =================================================================== --- trunk/jazz/src/FileSelector.cpp 2008-04-07 04:33:58 UTC (rev 435) +++ trunk/jazz/src/FileSelector.cpp 2008-04-07 04:49:52 UTC (rev 436) @@ -31,17 +31,17 @@ wxString add_default_ext(const wxString fn, const wxString ext) { - // is any extension already there? + // Is any extension already there? { const wxString x = wxFileNameFromPath(fn); - if (x.find( '.', TRUE) != 0) + if (x.find('.', TRUE) != 0) { - //if there is a dot, assume its an extension and return + // if there is a dot, assume its an extension and return. return fn; } } - // otherwise append the supplied extension and return + // Otherwise append the supplied extension and return wxString RevisedFileName = fn; RevisedFileName += ext; return RevisedFileName; @@ -64,7 +64,6 @@ bool changed, const wxString ext) { - wxString s; wxString file; wxString path; @@ -76,10 +75,10 @@ path = wxPathOnly(deffile); int flags = save ? wxFD_SAVE : wxFD_OPEN; - s = wxFileSelector(title, path, file, 0, ext, flags); + wxString s = wxFileSelector(title, path, file, 0, ext, flags); // add extension if missing - if (s && ext) + if (!s.empty() && ext) { s = add_default_ext(s, ext); } @@ -104,7 +103,8 @@ wxString buf; buf<<deffile; buf <<" has changed. Load anyway?"; - if (wxMessageBox(buf, "Load ?", wxYES_NO) == wxNO) { + if (wxMessageBox(buf, "Load ?", wxYES_NO) == wxNO) + { s = wxEmptyString; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-07 04:34:03
|
Revision: 435 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=435&view=rev Author: pstieber Date: 2008-04-06 21:33:58 -0700 (Sun, 06 Apr 2008) Log Message: ----------- 1. Changed the interface to CreateHarmonyBrowser. 2. Changed getAnalyzer to GetAnalyzer. 3. Added file loading, sequence clearing... 4. Fixed initial scrolled window layout. Modified Paths: -------------- trunk/jazz/src/Harmony.cpp trunk/jazz/src/Harmony.h trunk/jazz/src/PianoWindow.cpp trunk/jazz/src/TrackFrame.cpp Modified: trunk/jazz/src/Harmony.cpp =================================================================== --- trunk/jazz/src/Harmony.cpp 2008-04-07 01:05:58 UTC (rev 434) +++ trunk/jazz/src/Harmony.cpp 2008-04-07 04:33:58 UTC (rev 435) @@ -22,7 +22,6 @@ #include "WxWidgets.h" -//#include "config.h" #include "Harmony.h" #include "HarmonyP.h" #include "Player.h" @@ -45,32 +44,32 @@ using namespace std; -#define MEN_CLOSE 1 -#define MEN_MIDI 2 -#define MEN_TRANSPOSE 4 -#define MEN_CLEARSEQ 6 +#define MEN_CLOSE 1 +#define MEN_MIDI 2 +#define MEN_TRANSPOSE 4 +#define MEN_CLEARSEQ 6 #define MEN_EDIT 7 -#define MEN_MOUSE 8 +#define MEN_MOUSE 8 #define MEN_HELP 9 -#define MEN_MAJSCALE 10 -#define MEN_HARSCALE 11 -#define MEN_MELSCALE 12 +#define MEN_MAJSCALE 10 +#define MEN_HARSCALE 11 +#define MEN_MELSCALE 12 -#define MEN_EQ4 13 -#define MEN_EQ3 14 -#define MEN_EQ2 15 -#define MEN_EQ1 16 -#define MEN_EQH 17 -#define MEN_EQ0 18 -#define MEN_251 19 -#define MEN_TRITONE 20 -#define MEN_PIANO 21 -#define MEN_EQB 22 -#define MEN_HAUNSCH 23 -#define MEN_ANALYZE 24 -#define MEN_IONSCALE 25 -#define MEN_SETTINGS 26 +#define MEN_EQ4 13 +#define MEN_EQ3 14 +#define MEN_EQ2 15 +#define MEN_EQ1 16 +#define MEN_EQH 17 +#define MEN_EQ0 18 +#define MEN_251 19 +#define MEN_TRITONE 20 +#define MEN_PIANO 21 +#define MEN_EQB 22 +#define MEN_HAUNSCH 23 +#define MEN_ANALYZE 24 +#define MEN_IONSCALE 25 +#define MEN_SETTINGS 26 #define MEN_LOAD 27 #define MEN_SAVE 28 @@ -99,30 +98,30 @@ static JZToolDef tdefs[] = { - { MEN_LOAD, FALSE, open_xpm, "open harmony file" }, - { MEN_SAVE, FALSE, save_xpm, "save harmony file" }, + { MEN_LOAD, false, open_xpm, "open harmony file" }, + { MEN_SAVE, false, save_xpm, "save harmony file" }, { JZToolBar::eToolBarSeparator }, - { MEN_MAJSCALE, TRUE, majscale_xpm, "major scale" }, - { MEN_HARSCALE, TRUE, harscale_xpm, "harmonic scale" }, - { MEN_MELSCALE, TRUE, melscale_xpm, "melodic scale" }, - { MEN_IONSCALE, TRUE, ionscale_xpm, "ionic b13 scale" }, + { MEN_MAJSCALE, true, majscale_xpm, "major scale" }, + { MEN_HARSCALE, true, harscale_xpm, "harmonic scale" }, + { MEN_MELSCALE, true, melscale_xpm, "melodic scale" }, + { MEN_IONSCALE, true, ionscale_xpm, "ionic b13 scale" }, { JZToolBar::eToolBarSeparator }, - { MEN_EQ4, TRUE, same4_xpm, "4 common notes" }, - { MEN_EQ3, TRUE, same3_xpm, "3 common notes" }, - { MEN_EQ2, TRUE, same2_xpm, "2 common notes" }, - { MEN_EQ1, TRUE, same1_xpm, "1 common note" }, - { MEN_EQ0, TRUE, same0_xpm, "0 common notes" }, - { MEN_EQH, TRUE, sameh_xpm, "one half note difference" }, - { MEN_251, TRUE, std251_xpm, "next in 2-5-1 move" }, - { MEN_EQB, TRUE, sameb_xpm, "same base note" }, - { MEN_TRITONE, TRUE, tritone_xpm, "tritone substitute" }, - { MEN_PIANO, TRUE, piano_xpm, "pianowin copy buffer" }, + { MEN_EQ4, true, same4_xpm, "4 common notes" }, + { MEN_EQ3, true, same3_xpm, "3 common notes" }, + { MEN_EQ2, true, same2_xpm, "2 common notes" }, + { MEN_EQ1, true, same1_xpm, "1 common note" }, + { MEN_EQ0, true, same0_xpm, "0 common notes" }, + { MEN_EQH, true, sameh_xpm, "one half note difference" }, + { MEN_251, true, std251_xpm, "next in 2-5-1 move" }, + { MEN_EQB, true, sameb_xpm, "same base note" }, + { MEN_TRITONE, true, tritone_xpm, "tritone substitute" }, + { MEN_PIANO, true, piano_xpm, "pianowin copy buffer" }, { JZToolBar::eToolBarSeparator }, - { MEN_HAUNSCH, TRUE, haunsch_xpm, "haunschild layout" }, + { MEN_HAUNSCH, true, haunsch_xpm, "haunschild layout" }, { JZToolBar::eToolBarSeparator }, - { MEN_TRANSPOSE, FALSE, transpos_xpm, "transpose trackwin selection" }, - { MEN_ANALYZE, FALSE, analyze_xpm, "analyze trackwin selection" }, - { MEN_CLEARSEQ, FALSE, delchord_xpm, "clear harmonies" }, + { MEN_TRANSPOSE, false, transpos_xpm, "transpose trackwin selection" }, + { MEN_ANALYZE, false, analyze_xpm, "analyze trackwin selection" }, + { MEN_CLEARSEQ, false, delchord_xpm, "clear harmonies" }, { JZToolBar::eToolBarEnd } }; @@ -175,7 +174,7 @@ static int meldy_channel, meldy_veloc; - static bool mBassEnabled, mChordEnabled, meldy_enabled; + static bool mBassEnabled, mChordEnabled, mMeldyEnabled; static int bass_pitch, chord_pitch, meldy_pitch; @@ -203,11 +202,11 @@ int HBPlayer::chord_veloc = 90; int HBPlayer::chord_pitch = 60; -bool HBPlayer::meldy_enabled = 0; -int HBPlayer::meldy_channel = 3; -int HBPlayer::meldy_veloc = 90; -int HBPlayer::meldy_pitch = 70; -int HBPlayer::meldy_speed = 100; +bool HBPlayer::mMeldyEnabled = false; +int HBPlayer::meldy_channel = 3; +int HBPlayer::meldy_veloc = 90; +int HBPlayer::meldy_pitch = 70; +int HBPlayer::meldy_speed = 100; HBPlayer::HBPlayer() @@ -240,7 +239,9 @@ // build bass note int key = context.ChordKey() + bass_pitch - bass_pitch % 12; if (key < bass_pitch) + { key += 12; + } return key; } @@ -287,7 +288,9 @@ device = gpSong->GetTrack(0)->GetDevice(); if (playing) + { StopPlay(); + } playing = 1; context = ct; @@ -318,7 +321,7 @@ void HBPlayer::Notify() { - if (meldy_enabled) + if (mMeldyEnabled) { tKeyOff of(0, meldy_channel - 1, meldy_keys[meldy_index]); gpMidiPlayer->OutNow(device, &of); @@ -332,7 +335,9 @@ void HBPlayer::StopPlay() { if (!playing) + { return; + } Stop(); playing = 0; @@ -354,7 +359,7 @@ } } - if (meldy_enabled) + if (mMeldyEnabled) { for (i = 0; i < n_meldy_keys; i++) { @@ -383,7 +388,7 @@ void HBPlayer::SettingsDialog(wxFrame *parent) { #ifdef OBSOLETE - wxDialogBox *panel = new wxDialogBox(pParent, "MIDI settings", FALSE ); + wxDialogBox *panel = new wxDialogBox(pParent, "MIDI settings", false ); tHBPlayerForm *form = new tHBPlayerForm; form->Add(wxMakeFormMessage("Note Length for paste into piano window")); @@ -412,7 +417,7 @@ form->Add(wxMakeFormNewLine()); #if 0 - form->Add(wxMakeFormBool("Scale enable", &meldy_enabled)); + form->Add(wxMakeFormBool("Scale enable", &mMeldyEnabled)); form->Add(wxMakeFormNewLine()); form->Add(wxMakeFormShort("Channel", &meldy_channel, wxFORM_DEFAULT, new wxList(wxMakeConstraintRange(1.0, 16.0), 0))); form->Add(wxMakeFormNewLine()); @@ -427,7 +432,7 @@ form->AssociatePanel(panel); panel->Fit(); - panel->Show(TRUE); + panel->Show(true); #endif } @@ -457,7 +462,7 @@ int SeqDefined() { - return n_seq > 0; + return mSequenceCount > 0; } int GetChordKeys(int *out, int step, int n_steps); @@ -470,6 +475,10 @@ void SettingsDialog(); + void ToggleHaunschildLayout(); + + void FileLoad(); + void OnMenuCommand(int id, wxToolBar *mpToolBar); void TransposeSelection(); @@ -481,7 +490,7 @@ SEQMAX = 256 }; - HBAnalyzer* getAnalyzer(); + HBAnalyzer* GetAnalyzer(); protected: @@ -511,7 +520,7 @@ static int analyze_res; - float xchord, ychord, wchord, hchord; + float mChordX, mChordY, mChordWidth, mChordHeight; float ofs; @@ -519,15 +528,15 @@ HBContext* seq[SEQMAX]; - int n_seq; + int mSequenceCount; - char* default_filename; + std::string mDefaultFileName; bool has_changed; HBContext mouse_context; - bool haunschild_layout; + bool mHaunschildLayout; bool mark_4_common; @@ -549,11 +558,13 @@ bool mark_piano; - int active_marker; + int active_marker; DECLARE_EVENT_TABLE() }; +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- tScaleType HBCanvas::scale_type = Major; const int HBCanvas::ScFa = 50; int HBCanvas::transpose_res = 8; @@ -573,10 +584,10 @@ : wxScrolledWindow(pParent, wxID_ANY, wxPoint(x, y), wxSize(w, h)) { // parent = pParent; - n_seq = 0; + mSequenceCount = 0; active_marker = 0; - haunschild_layout = 0; + mHaunschildLayout = false; mark_4_common = 0; mark_3_common = 0; mark_2_common = 0; @@ -589,72 +600,87 @@ mark_piano = 0; for (int i = 0; i < SEQMAX; i++) + { seq[i] = new HBContext(); + } - wxDC *dc = new wxClientDC(this);//GetDC(); + wxClientDC Dc(this); - dc->SetFont(*wxSMALL_FONT); - int tw, th; - dc->GetTextExtent("xD#j75+9-x", &tw, &th); + Dc.SetFont(*wxSMALL_FONT); + int TextWidth, TextHeight; + Dc.GetTextExtent("xD#j75+9-x", &TextWidth, &TextHeight); - delete dc; + mChordWidth = 1.2 * TextWidth; + mChordHeight = 2.5 * TextHeight; + mChordX = 50; + mChordY = 4 * mChordHeight; + ofs = TextHeight / 4; - wchord = 1.2 * tw; - hchord = 2.5 * th; - xchord = 50; - ychord = 4 * hchord; - ofs = th/4; - - default_filename = copystring("noname.har"); + mDefaultFileName = "noname.har"; has_changed = false; - SetScrollbars(0, (int)(hchord + 0.5), 0, 12 + SEQMAX/8 + 2, 0, 4); + SetScrollbars(0, (int)(mChordHeight + 0.5), 0, 12 + SEQMAX / 8 + 2, 0, 0); } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- HBCanvas::~HBCanvas() { if (player.IsPlaying()) + { player.StopPlay(); + } for (int i = 0; i < SEQMAX; i++) + { delete seq[i]; + } } - -inline ostream & operator << (ostream &os, HBCanvas const &a) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +ostream & operator << (ostream& Os, HBCanvas const &a) { int i; - os << 1 << endl; - os << a.n_seq << endl; - for (i = 0; i < a.n_seq; i++) - os << *a.seq[i]; - return os; + Os << 1 << endl; + Os << a.mSequenceCount << endl; + for (i = 0; i < a.mSequenceCount; i++) + { + Os << *a.seq[i]; + } + return Os; } - -inline istream & operator >> (istream &is, HBCanvas &a) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +istream& operator >> (istream& Is, HBCanvas &a) { int i, version; - is >> version; - if (version != 1) { + Is >> version; + if (version != 1) + { wxMessageBox("Wrong file format!", "Error", wxOK); - return is; + return Is; } - is >> a.n_seq; - for (i = 0; i < a.n_seq; i++) - is >> *a.seq[i]; + Is >> a.mSequenceCount; + for (i = 0; i < a.mSequenceCount; i++) + { + Is >> *a.seq[i]; + } a.Refresh(); - return is; + return Is; } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void HBCanvas::SetMarker(int id, wxToolBar *mpToolBar) { if (id != active_marker) { if (active_marker && mpToolBar->GetToolState(active_marker)) - mpToolBar->ToggleTool(active_marker, FALSE); - mpToolBar->ToggleTool(id, TRUE); + { + mpToolBar->ToggleTool(active_marker, false); + } + mpToolBar->ToggleTool(id, true); active_marker = id; } @@ -683,71 +709,82 @@ case MEN_PIANO: mark_piano = 1; break; } -#ifndef wx_xt if (id > 0 && !mpToolBar->GetToolState(id)) - mpToolBar->ToggleTool(id, TRUE); -#endif + { + mpToolBar->ToggleTool(id, true); + } Refresh(); - } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int HBCanvas::GetChordKeys(int *out, int step, int n_steps) { - if (n_seq == 0) + if (mSequenceCount == 0) + { return 0; - int i = step * n_seq / n_steps; + } + int i = step * mSequenceCount / n_steps; return player.GetChordKeys(out, *seq[i]); } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int HBCanvas::GetSelectedChord(int *out) { return player.GetChordKeys(out, mouse_context); } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int HBCanvas::GetSelectedScale(int *out) { return player.GetMeldyKeys(out, mouse_context); } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int HBCanvas::GetBassKeys(int *out, int step, int n_steps) { - if (n_seq == 0) + if (mSequenceCount == 0) + { return 0; - int i = step * n_seq / n_steps; + } + int i = step * mSequenceCount / n_steps; out[0] = player.GetBassKey(*seq[i]); return 1; } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void HBCanvas::ChordRect(JZRectangle& Rectangle, const HBContext &ct) { if (ct.SeqNr()) { - Rectangle.x = (int)(xchord + (ct.SeqNr() - 1) % 8 * wchord); - Rectangle.y = (int)(hchord * ((ct.SeqNr() -1) / 8 + 0.5)); + Rectangle.x = (int)(mChordX + (ct.SeqNr() - 1) % 8 * mChordWidth); + Rectangle.y = (int)(mChordHeight * ((ct.SeqNr() -1) / 8 + 0.5)); } - else if (!haunschild_layout) + else if (!mHaunschildLayout) { - Rectangle.x = (int)(xchord + ct.ChordNr() * wchord); - Rectangle.y = (int)(ychord + ct.ScaleNr() * hchord); + Rectangle.x = (int)(mChordX + ct.ChordNr() * mChordWidth); + Rectangle.y = (int)(mChordY + ct.ScaleNr() * mChordHeight); } else { - Rectangle.x = (int)(xchord + (5 * ct.ChordNr() % 7 + 5 * ct.ScaleNr() % 12) % 7 * wchord); - Rectangle.y = (int)(ychord + (5 * ct.ScaleNr() % 12) * hchord); + Rectangle.x = (int)( + mChordX + (5 * ct.ChordNr() % 7 + 5 * ct.ScaleNr() % 12) % 7 * mChordWidth); + Rectangle.y = (int)(mChordY + (5 * ct.ScaleNr() % 12) * mChordHeight); } Rectangle.x += (int)ofs; Rectangle.y -= (int)ofs; - Rectangle.width = (int)(wchord - 2 * ofs); - Rectangle.height = (int)(hchord - 2 * ofs); + Rectangle.width = (int)(mChordWidth - 2 * ofs); + Rectangle.height = (int)(mChordHeight - 2 * ofs); } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void HBCanvas::DrawChord(wxDC& Dc, const HBContext &ct) { // Draw the surrounding box. @@ -763,10 +800,14 @@ int w, h; const char* pName = ct.ChordName(); Dc.GetTextExtent(pName, &w, &h); - Dc.DrawText(pName, Rectangle.x + (Rectangle.width - w)/2, Rectangle.y + (Rectangle.height - h)/2); + Dc.DrawText( + pName, + Rectangle.x + (Rectangle.width - w) / 2, + Rectangle.y + (Rectangle.height - h) / 2); } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void HBCanvas::UnDrawChord(wxDC& Dc, const HBContext& ct) { // draw surrounding box @@ -782,16 +823,22 @@ Dc.SetPen(*wxBLACK_PEN); } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void HBCanvas::OnDraw(wxDC& Dc) { Dc.Clear(); + + Dc.SetFont(*wxSMALL_FONT); + Dc.DrawText("Seq", 5, 5); - ychord = (n_seq/8 + 1) * hchord + (n_seq % 8 ? hchord : 0) + hchord; + mChordY = + (mSequenceCount / 8 + 1) * mChordHeight + (mSequenceCount % 8 ? mChordHeight : 0) + + mChordHeight; HBContextIterator iter; - iter.SetSequence(seq, n_seq); + iter.SetSequence(seq, mSequenceCount); iter.SetScaleType(scale_type); while (iter()) { @@ -806,14 +853,14 @@ } DrawMarkers(Dc, mouse_context); - if (!haunschild_layout) + if (!mHaunschildLayout) { for (int j = 0; j < 7; j++) { HBContext ct(0, j, scale_type); JZRectangle Rectangle; ChordRect(Rectangle, ct); - Rectangle.y -= (int)hchord; + Rectangle.y -= (int)mChordHeight; int w, h; const char *name = ct.ChordNrName(); @@ -825,7 +872,6 @@ Dc.DrawText((char *)type, Rectangle.x + (Rectangle.width - w)/2, Rectangle.y + (Rectangle.height - h)/2 - h); } } - } // ----------------------------------------------------------------------------- @@ -833,30 +879,25 @@ // ----------------------------------------------------------------------------- #ifdef OBSOLETE - class HBSettingsForm : public wxForm { public: HBSettingsForm(HBCanvas *c) : wxForm( USED_WXFORM_BUTTONS ) - { cnvs = c; } - virtual void OnOk() { cnvs->OnPaint(); wxForm::OnOk(); } + { mpHbWindow = c; } + virtual void OnOk() { mpHbWindow->OnPaint(); wxForm::OnOk(); } virtual void OnHelp(); private: - HBCanvas *cnvs; + HBCanvas *mpHbWindow; }; - -void HBSettingsForm::OnHelp() -{ - gpHelpInstance->ShowTopic("Harmony browser"); -} - #endif +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void HBCanvas::SettingsDialog() { #ifdef OBSOLETE - wxDialogBox *panel = new wxDialogBox(this, "settings", FALSE ); + wxDialogBox *panel = new wxDialogBox(this, "settings", false ); wxForm *form = new HBSettingsForm(this); panel->SetLabelPosition(wxHORIZONTAL); @@ -872,23 +913,44 @@ form->AssociatePanel(panel); panel->Fit(); - panel->Show(TRUE); + panel->Show(true); #endif } -// ----------------------------------------------------------------------------- -// HBMatchMarkers -// ----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void HBCanvas::ToggleHaunschildLayout() +{ + mHaunschildLayout = !mHaunschildLayout; + Refresh(); +} + + + + + +//***************************************************************************** +// HBMatchMarkers +//***************************************************************************** class HBMatchMarkers : public HBMatch { public: + HBMatchMarkers(const HBContext &ct, HBCanvas *cv); + virtual bool operator()(const HBContext &); - const char * GetText() { return msg + 2; } // + 2 for ", " + + const char * GetText() + { + // + 2 for ", " + return msg + 2; + } + private: - HBCanvas *cnvs; + + HBCanvas* mpHbWindow; HBContext context; HBChord chord; HBChord scale; @@ -906,7 +968,7 @@ HBMatchMarkers::HBMatchMarkers(const HBContext &ct, HBCanvas *cv) : context(ct) { - cnvs = cv; + mpHbWindow = cv; chord = context.Chord(); n_chord = chord.Count(); chord_key = context.ChordKey(); @@ -923,14 +985,16 @@ tritone = (chord_key + 6) % 12; - if (cnvs->mark_piano) + if (mpHbWindow->mark_piano) { tEventArray &buf = gpTrackFrame->GetPianoWindow()->mPasteBuffer; for (int i = 0; i < buf.nEvents; i++) { tKeyOn *on = buf.Events[i]->IsKeyOn(); if (on) + { piano += on->Key; + } } } } @@ -947,53 +1011,72 @@ msg[0] = 0; msg[2] = 0; - if (cnvs->mark_piano && o_chord.Contains(piano)) + if (mpHbWindow->mark_piano && o_chord.Contains(piano)) + { strcat(msg, ", P"); + } - if (cnvs->mark_4_common && o_chord == chord) + if (mpHbWindow->mark_4_common && o_chord == chord) + { strcat(msg, ", =4"); + } - if (cnvs->mark_3_common && n_common == 3) + if (mpHbWindow->mark_3_common && n_common == 3) + { strcat(msg, ", =3"); + } - if (cnvs->mark_2_common && n_common == 2) + if (mpHbWindow->mark_2_common && n_common == 2) + { strcat(msg, ", =2"); + } - if (cnvs->mark_1_common && n_common == 1) + if (mpHbWindow->mark_1_common && n_common == 1) + { strcat(msg, ", =1"); + } - if (cnvs->mark_0_common && n_common == 0) + if (mpHbWindow->mark_0_common && n_common == 0) + { strcat(msg, ", =0"); + } - if (cnvs->mark_1_semi && n_common == n_chord - 1) + if (mpHbWindow->mark_1_semi && n_common == n_chord - 1) { HBChord delta = chord ^ o_chord; int key = delta.Iter(0); if (delta.Contains(key + 1) || delta.Contains(key - 1)) + { strcat(msg, ", 1/2"); + } } - if (cnvs->mark_251 && key251 == o_chord_key) + if (mpHbWindow->mark_251 && key251 == o_chord_key) + { strcat(msg, ", 251"); + } - if (cnvs->mark_b_common && chord_key == o_chord_key) + if (mpHbWindow->mark_b_common && chord_key == o_chord_key) + { strcat(msg, ", =B"); + } - if (cnvs->mark_tritone && o_chord_key == tritone) + if (mpHbWindow->mark_tritone && o_chord_key == tritone) + { strcat(msg, ", =T"); + } - return msg[2] ? 1 : 0; } -void HBCanvas::DrawMarkers(wxDC& Dc, const HBContext &ct) +void HBCanvas::DrawMarkers(wxDC& Dc, const HBContext& ct) { JZRectangle Rectangle; Dc.SetLogicalFunction(wxXOR); Dc.SetBrush(*wxTRANSPARENT_BRUSH); HBMatchMarkers match(ct, this); HBContextIterator iter(match); - iter.SetSequence(seq, n_seq); + iter.SetSequence(seq, mSequenceCount); iter.SetScaleType(scale_type); while (iter()) { @@ -1002,7 +1085,11 @@ Rectangle.y += 3; Rectangle.width -= 6; Rectangle.height -= 6; - Dc.DrawRectangle(Rectangle.x, Rectangle.y, Rectangle.width, Rectangle.height); + Dc.DrawRectangle( + Rectangle.x, + Rectangle.y, + Rectangle.width, + Rectangle.height); } // invert actual chord @@ -1010,13 +1097,21 @@ { Dc.SetBrush(*wxBLACK_BRUSH); ChordRect(Rectangle, ct); - Dc.DrawRectangle(Rectangle.x, Rectangle.y, Rectangle.width, Rectangle.height); + Dc.DrawRectangle( + Rectangle.x, + Rectangle.y, + Rectangle.width, + Rectangle.height); if (ct.SeqNr() > 0) { HBContext c(ct); c.SetSeqNr(0); ChordRect(Rectangle, c); - Dc.DrawRectangle(Rectangle.x, Rectangle.y, Rectangle.width, Rectangle.height); + Dc.DrawRectangle( + Rectangle.x, + Rectangle.y, + Rectangle.width, + Rectangle.height); } } Dc.SetLogicalFunction(wxCOPY); @@ -1026,7 +1121,7 @@ bool HBCanvas::Find(float x, float y, HBContext &out) { HBContextIterator iter; - iter.SetSequence(seq, n_seq); + iter.SetSequence(seq, mSequenceCount); iter.SetScaleType(scale_type); while (iter()) { @@ -1035,16 +1130,16 @@ if (Rectangle.IsInside((int)x, (int)y)) { out = iter.Context(); - return TRUE; + return true; } } - return FALSE; + return false; } void HBCanvas::ClearSeq() { - n_seq = 0; + mSequenceCount = 0; mouse_context.SetSeqNr(0); Refresh(); } @@ -1053,8 +1148,11 @@ void HBCanvas::OnMouseEvent(wxMouseEvent& MouseEvent) { wxClientDC Dc(this); + DoPrepareDC(Dc); + Dc.SetFont(*wxSMALL_FONT); + HBContext context; int x, y; MouseEvent.GetPosition(&x, &y); @@ -1071,26 +1169,26 @@ if (context.SeqNr()) { // remove a chord - if (context.SeqNr() == n_seq) + if (context.SeqNr() == mSequenceCount) { // remove markers first - if (mouse_context.SeqNr() == n_seq) + if (mouse_context.SeqNr() == mSequenceCount) { DrawMarkers(Dc, mouse_context); mouse_context.SetSeqNr(0); DrawMarkers(Dc, mouse_context); } - -- n_seq; + --mSequenceCount; UnDrawChord(Dc, context); context.SetSeqNr(0); Refresh(); } } - else if (n_seq < SEQMAX) + else if (mSequenceCount < SEQMAX) { // add a chord - context.SetSeqNr(n_seq + 1); - *seq[n_seq ++] = context; + context.SetSeqNr(mSequenceCount + 1); + *seq[mSequenceCount++] = context; DrawMarkers(Dc, mouse_context); DrawChord(Dc, context); DrawMarkers(Dc, mouse_context); @@ -1145,11 +1243,11 @@ void HBCanvas::SetScaleType(int menu_id, tScaleType st, wxToolBar *tb) { scale_type = st; - tb->ToggleTool(MEN_MAJSCALE, FALSE); - tb->ToggleTool(MEN_HARSCALE, FALSE); - tb->ToggleTool(MEN_MELSCALE, FALSE); - tb->ToggleTool(MEN_IONSCALE, FALSE); - tb->ToggleTool(menu_id, TRUE); + tb->ToggleTool(MEN_MAJSCALE, false); + tb->ToggleTool(MEN_HARSCALE, false); + tb->ToggleTool(MEN_MELSCALE, false); + tb->ToggleTool(MEN_IONSCALE, false); + tb->ToggleTool(menu_id, true); Refresh(); } @@ -1164,36 +1262,33 @@ if (gpTrackWindow->EventsSelected("please select destination range in track window")) { wxBeginBusyCursor(); - HBAnalyzer analyzer(seq, n_seq); + HBAnalyzer analyzer(seq, mSequenceCount); analyzer.Transpose(gpTrackWindow->mpFilter, transpose_res); wxEndBusyCursor(); } } +void HBCanvas::FileLoad() +{ + wxString FileName = file_selector( + mDefaultFileName.c_str(), + "Load Harmonies", + false, + has_changed, + "*.har"); + + ifstream Is(FileName.c_str()); + Is >> *this; +} + void HBCanvas::OnMenuCommand(int id, wxToolBar *mpToolBar) { switch (id) { - case MEN_LOAD: - { - wxString fname = file_selector( - default_filename, - "Load Harmonies", - false, - has_changed, - "*.har"); - if (fname) - { - ifstream is(fname); - is >> *this; - } - } - break; - case MEN_SAVE: { wxString fname = file_selector( - default_filename, + mDefaultFileName.c_str(), "Save Harmonies", true, has_changed, @@ -1222,17 +1317,12 @@ SetScaleType(id, Ionb13, mpToolBar); break; - case MEN_HAUNSCH: - haunschild_layout = !haunschild_layout; - Refresh(); - break; - case MEN_ANALYZE: if (gpTrackWindow->EventsSelected("please select source range in track window")) { wxBeginBusyCursor(); HBAnalyzer analyzer(seq, (int)SEQMAX); - n_seq = analyzer.Analyze(gpTrackWindow->mpFilter, analyze_res); + mSequenceCount = analyzer.Analyze(gpTrackWindow->mpFilter, analyze_res); Refresh(); wxEndBusyCursor(); } @@ -1254,11 +1344,11 @@ } -HBAnalyzer * HBCanvas::getAnalyzer() +HBAnalyzer * HBCanvas::GetAnalyzer() { - if (n_seq > 0 && gpTrackWindow->mpSnapSel->Selected) + if (mSequenceCount > 0 && gpTrackWindow->mpSnapSel->Selected) { - HBAnalyzer *analyzer = new HBAnalyzer(seq, n_seq); + HBAnalyzer *analyzer = new HBAnalyzer(seq, mSequenceCount); analyzer->Init(gpTrackWindow->mpFilter, transpose_res); return analyzer; } @@ -1371,7 +1461,7 @@ private: - HBCanvas *cnvs; + HBCanvas* mpHbWindow; wxCheckBox *chord_chk[12]; wxCheckBox *scale_chk[12]; wxListBox *chord_lst; @@ -1401,7 +1491,7 @@ { int i; - cnvs = c; + mpHbWindow = c; pcontext = pct; chord = pcontext->Chord(); scale = pcontext->Scale(); @@ -1427,15 +1517,32 @@ int h = 40; int y = 80; - const char *notename[12] = { "1", 0, "9", 0, "3", "11", 0, "5", 0, "13", 0, "7" }; + const char* notename[12] = + { + "1", + 0, + "9", + 0, + "3", + "11", + 0, + "5", + 0, + "13", + 0, + "7" + }; + for (i = 0; i < 12; i++) { int x = w * i + 10; - chord_chk[i] = new wxCheckBox(this, -1, " ", wxPoint(x, y+1*h));//(wxFunction)ChordCheck, - scale_chk[i] = new wxCheckBox(this, -1, " ", wxPoint(x, y+2*h));//(wxFunction)ScaleCheck, + chord_chk[i] = new wxCheckBox(this, wxID_ANY, " ", wxPoint(x, y+1*h));//(wxFunction)ChordCheck, + scale_chk[i] = new wxCheckBox(this, wxID_ANY, " ", wxPoint(x, y+2*h));//(wxFunction)ScaleCheck, if (notename[i]) - (void) new wxStaticText(this, -1, (char *)notename[i], wxPoint(x, y+3*h)); - (void) new wxStaticText(this, -1, (char *)HBChord::ScaleName(i + chord_key), wxPoint(x, y+0*h)); + { + (void) new wxStaticText(this, wxID_ANY, (char *)notename[i], wxPoint(x, y+3*h)); + } + (void) new wxStaticText(this, wxID_ANY, (char *)HBChord::ScaleName(i + chord_key), wxPoint(x, y+0*h)); } y += 4*h; @@ -1447,7 +1554,9 @@ wxString* cnames = new wxString[n_chord_names]; for (i = 0; i < n_chord_names; i++) + { cnames[i] = (char *)chord_names[i].name; + } chord_lst = new wxListBox(this, -1, wxPoint(10, y), wxSize(100, 200), n_chord_names, cnames, wxLB_SINGLE| wxLB_NEEDED_SB);//"Chords" @@ -1455,20 +1564,32 @@ wxString* snames = new wxString[n_scale_names]; for (i = 0; i < n_scale_names; i++) + { snames[i] = (char *)scale_names[i].name; - scale_lst = new wxListBox(this, -1, wxPoint(200, y), wxSize(300, 200), n_scale_names, snames, wxLB_SINGLE| wxLB_NEEDED_SB);//"Scales", + } + scale_lst = new wxListBox( + this, + wxID_ANY, + wxPoint(200, y), + wxSize(300, 200), + n_scale_names, + snames, + wxLB_SINGLE | wxLB_NEEDED_SB);//"Scales", + delete [] snames; // thats it Fit(); - Show(TRUE); + Show(true); ShowValues(); } HBContextDlg::~HBContextDlg() { if (player.IsPlaying()) + { player.StopPlay(); + } } @@ -1526,13 +1647,17 @@ for (int i = 0; i < 12; i++) { if (chord_chk[i]->GetValue()) + { chord += ChordKey(i); + } if (scale_chk[i]->GetValue()) + { scale += ScaleKey(i); + } } *pcontext->PChord() = chord; *pcontext->PScale() = scale; - cnvs->Refresh(); + mpHbWindow->Refresh(); // DELETE_THIS(); Destroy(); } @@ -1585,7 +1710,9 @@ for (int i = 0; i < 12; i++) { if (chord_chk[i]->GetValue()) + { chord += ChordKey(i); + } } chord.Name(buf, ChordKey()); chord_msg->SetLabel(buf); @@ -1599,7 +1726,9 @@ for (int i = 0; i < 12; i++) { if (scale_chk[i]->GetValue()) + { scale += ScaleKey(i); + } } RestartPlayer(); } @@ -1631,8 +1760,104 @@ } } -// ------------------- HBFrame --------------------------- +//***************************************************************************** +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +BEGIN_EVENT_TABLE(HBFrame, wxFrame) +// EVT_SIZE(HBFrame::OnSize) + + EVT_MENU(MEN_LOAD, HBFrame::OnFileLoad) + + EVT_MENU(MEN_MIDI, HBFrame::OnSettingsMidi) + + EVT_MENU(MEN_HAUNSCH, HBFrame::OnSettingsHaunschild) + + EVT_MENU(MEN_CLEARSEQ, HBFrame::OnActionClearSequence) + + EVT_MENU(MEN_MOUSE, HBFrame::OnMouseHelp) + + EVT_MENU(MEN_HELP, HBFrame::OnHelp) + +END_EVENT_TABLE() + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +HBFrame::HBFrame() + : wxFrame( + 0, + wxID_ANY, + "Harmony Browser", + wxPoint( + gpConfig->GetValue(C_HarmonyXpos), + gpConfig->GetValue(C_HarmonyYpos)), + wxSize(660, 530)) +{ + mpHbWindow = 0; + genmeldy = 0; + + mpToolBar = new JZToolBar(this, tdefs); + + wxMenu* pFileMenu = new wxMenu; + pFileMenu->Append(MEN_LOAD, "&Load..."); + pFileMenu->Append(MEN_SAVE, "&Save"); + pFileMenu->Append(MEN_CLOSE, "&Close"); + + wxMenu* pSettingsMenu = new wxMenu; + pSettingsMenu->Append(MEN_EDIT, "&Chord"); + pSettingsMenu->Append(MEN_SETTINGS, "&Global"); + pSettingsMenu->Append(MEN_MIDI, "&Midi"); + pSettingsMenu->Append(MEN_HAUNSCH, "&Haunschild Layout"); + + wxMenu* pScaleMenu = new wxMenu; + pScaleMenu->Append(MEN_MAJSCALE, "&Major"); + pScaleMenu->Append(MEN_HARSCALE, "&Harmonic Minor"); + pScaleMenu->Append(MEN_MELSCALE, "&Melodic Minor"); + pScaleMenu->Append(MEN_IONSCALE, "&Ionic"); + + wxMenu* pShowMenu = new wxMenu; + pShowMenu->Append(MEN_EQ4, "&4 equal notes"); + pShowMenu->Append(MEN_EQ3, "&3 equal notes"); + pShowMenu->Append(MEN_EQ2, "&2 equal notes"); + pShowMenu->Append(MEN_EQ1, "&1 equal note"); + pShowMenu->Append(MEN_EQ0, "&0 equal notes"); + pShowMenu->Append(MEN_EQH, "1/2 note &difference"); + pShowMenu->Append(MEN_251, "2-5-1 &move"); + pShowMenu->Append(MEN_EQB, "&Same bass note"); + pShowMenu->Append(MEN_TRITONE, "&Tritone substitute"); + pShowMenu->Append(MEN_PIANO, "Contains &Pianowin Buffer"); + + wxMenu* pActionMenu = new wxMenu; + pActionMenu->Append(MEN_TRANSPOSE, "&Transpose"); + pActionMenu->Append(MEN_ANALYZE, "&Analyze"); + pActionMenu->AppendSeparator(); + pActionMenu->Append(MEN_CLEARSEQ, "&Clear Sequence"); + + wxMenu* pHelpMenu = new wxMenu; + pHelpMenu->Append(MEN_HELP, "&Harmony Browser"); + pHelpMenu->Append(MEN_MOUSE, "&Mouse"); + + wxMenuBar* pMenuBar = new wxMenuBar; + + pMenuBar->Append(pFileMenu, "&File"); + pMenuBar->Append(pSettingsMenu, "&Settings"); + pMenuBar->Append(pScaleMenu, "&Scale"); + pMenuBar->Append(pShowMenu, "&Show"); + pMenuBar->Append(pActionMenu, "&Action"); + pMenuBar->Append(pHelpMenu, "&Help"); + + SetMenuBar(pMenuBar); + + int w, h; + GetClientSize(&w, &h); + mpHbWindow = new HBCanvas(this, 0, 0, w, h); + + mpToolBar->ToggleTool(MEN_MAJSCALE, true); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- HBFrame::~HBFrame() { int XPixel, YPixel; @@ -1640,82 +1865,82 @@ gpConfig->Put(C_HarmonyXpos, XPixel); gpConfig->Put(C_HarmonyYpos, YPixel); delete mpToolBar; - delete cnvs; + delete mpHbWindow; gpHarmonyBrowser = 0; } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- bool HBFrame::OnClose() { return true; } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int HBFrame::SeqDefined() { - return cnvs->SeqDefined(); + return mpHbWindow->SeqDefined(); } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int HBFrame::SeqSelected() { - if (cnvs->n_seq == 0 || cnvs->mouse_context.SeqNr() == 0) + if (mpHbWindow->mSequenceCount == 0 || mpHbWindow->mouse_context.SeqNr() == 0) { - wxMessageBox("select a chord from sequence first", "error", wxOK); + wxMessageBox("Select a chord from sequence first", "Error", wxOK); return 0; } return 1; } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int HBFrame::GetChordKeys(int *out, int step, int n_steps) { - return cnvs->GetChordKeys(out, step, n_steps); + return mpHbWindow->GetChordKeys(out, step, n_steps); } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int HBFrame::GetSelectedChord(int *out) { - return cnvs->GetSelectedChord(out); + return mpHbWindow->GetSelectedChord(out); } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int HBFrame::GetSelectedScale(int *out) { - return cnvs->GetSelectedScale(out); + return mpHbWindow->GetSelectedScale(out); } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int HBFrame::GetBassKeys(int *out, int step, int n_steps) { - return cnvs->GetBassKeys(out, step, n_steps); + return mpHbWindow->GetBassKeys(out, step, n_steps); } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void HBFrame::OnMenuCommand(int id) { switch(id) { - case MEN_HELP: - gpHelpInstance->ShowTopic("Harmony browser"); - break; - case MEN_MOUSE: - wxMessageBox("left: select chord\n" - " +shift: put chord into sequence\n" - "middle: same as left+shift\n" - "right: play chord\n", "Mousebuttons", wxOK); - break; - - case MEN_MIDI: - cnvs->player.SettingsDialog(this); - break; - - case MEN_CLEARSEQ: - cnvs->ClearSeq(); - break; - case MEN_EDIT: { if (!SeqSelected()) + { return; + } } - (void) new HBContextDlg(cnvs, this, cnvs->seq[cnvs->mouse_context.SeqNr() - 1]); + (void) new HBContextDlg( + mpHbWindow, + this, + mpHbWindow->seq[mpHbWindow->mouse_context.SeqNr() - 1]); break; case MEN_CLOSE: @@ -1724,140 +1949,76 @@ break; default: - cnvs->OnMenuCommand(id, mpToolBar->GetDelegateToolBar()); + mpHbWindow->OnMenuCommand(id, mpToolBar->GetDelegateToolBar()); break; } } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void HBFrame::OnSettingsMidi(wxCommandEvent& Event) +{ + mpHbWindow->player.SettingsDialog(this); +} -HBFrame::HBFrame(wxFrame *parent) - : wxFrame( - 0, - wxID_ANY, - "Harmony Browser", - wxPoint( - gpConfig->GetValue(C_HarmonyXpos), - gpConfig->GetValue(C_HarmonyYpos)), - wxSize(660, 530)) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void HBFrame::OnSettingsHaunschild(wxCommandEvent& Event) { - int w, h; - cnvs = 0; - genmeldy = 0; + mpHbWindow->ToggleHaunschildLayout(); +} - mpToolBar = new JZToolBar(this, tdefs); +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void HBFrame::OnFileLoad(wxCommandEvent& Event) +{ + mpHbWindow->FileLoad(); +} - wxMenuBar *menu_bar = new wxMenuBar; - wxMenu *menu; - /* - wxMenu *menu = new wxMenu; - menu->Append(MEN_EDIT, "&Edit chord"); - menu->Append(MEN_SETTINGS, "Se&ttings"); - menu->Append(MEN_MIDI, "&Midi"); - menu->Append(MEN_HELP, "&Help"); - menu->Append(MEN_MOUSE, "Help &mouse"); - menu->Append(MEN_LOAD, "&Load"); - menu->Append(MEN_SAVE, "&Save"); - menu->Append(MEN_CLOSE, "Cl&ose"); - menu_bar->Append(menu, "&Menu"); - */ +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void HBFrame::OnActionClearSequence(wxCommandEvent& Event) +{ + mpHbWindow->ClearSeq(); +} - menu = new wxMenu("",wxMENU_TEAROFF); - menu->Append(MEN_LOAD, "&Load"); - menu->Append(MEN_SAVE, "&Save"); - menu->Append(MEN_CLOSE, "&Close"); - menu_bar->Append(menu, "&File"); - - menu = new wxMenu("",wxMENU_TEAROFF); - menu->Append(MEN_EDIT, "&Chord"); - menu->Append(MEN_SETTINGS, "&Global"); - menu->Append(MEN_MIDI, "&Midi"); - menu->Append(MEN_HAUNSCH, "&Haunschild Layout"); - menu_bar->Append(menu, "&Settings"); - - menu = new wxMenu("",wxMENU_TEAROFF); - menu->Append(MEN_MAJSCALE, "&Major"); - menu->Append(MEN_HARSCALE, "&Harmonic Minor"); - menu->Append(MEN_MELSCALE, "&Melodic Minor"); - menu->Append(MEN_IONSCALE, "&Ionic"); - menu_bar->Append(menu, "&Scale"); - - menu = new wxMenu("",wxMENU_TEAROFF); - menu->Append(MEN_EQ4, "&4 equal notes"); - menu->Append(MEN_EQ3, "&3 equal notes"); - menu->Append(MEN_EQ2, "&2 equal notes"); - menu->Append(MEN_EQ1, "&1 equal note"); - menu->Append(MEN_EQ0, "&0 equal notes"); - menu->Append(MEN_EQH, "1/2 note &difference"); - menu->Append(MEN_251, "2-5-1 &move"); - menu->Append(MEN_EQB, "&Same bass note"); - menu->Append(MEN_TRITONE, "&Tritone substitute"); - menu->Append(MEN_PIANO, "Contains &Pianowin Buffer"); - menu_bar->Append(menu, "&Show"); - - menu = new wxMenu("",wxMENU_TEAROFF); - menu->Append(MEN_TRANSPOSE, "&Transpose"); - menu->Append(MEN_ANALYZE, "&Analyze"); - menu->AppendSeparator(); - menu->Append(MEN_CLEARSEQ, "&Clear Sequence"); - menu_bar->Append(menu, "&Action"); - - menu = new wxMenu("",wxMENU_TEAROFF); - menu->Append(MEN_HELP, "&Harmony Browser"); - menu->Append(MEN_MOUSE, "&Mouse"); - menu_bar->Append(menu, "&Help"); - - - SetMenuBar(menu_bar); - - GetClientSize(&w, &h); - cnvs = new HBCanvas(this, 0, 0, w, h); - mpToolBar->ToggleTool(MEN_MAJSCALE, TRUE); +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void HBFrame::OnMouseHelp(wxCommandEvent& Event) +{ + wxMessageBox( + "left: select chord\n" + " +shift: put chord into sequence\n" + "middle: same as left+shift\n" + "right: play chord\n", "Mousebuttons", wxOK); } -HBAnalyzer * HBFrame::getAnalyzer() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void HBFrame::OnHelp(wxCommandEvent& Event) { - return cnvs->getAnalyzer(); +// gpHelpInstance->ShowTopic("Harmony browser"); } - -BEGIN_EVENT_TABLE(HBFrame, wxFrame) - EVT_SIZE(HBFrame::OnSize) -END_EVENT_TABLE() - -void HBFrame::OnSize(wxSizeEvent& Event) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +HBAnalyzer* HBFrame::GetAnalyzer() { - int frameWidth, frameHeight; - GetClientSize(&frameWidth, &frameHeight); - - cout << "HBFrame::OnSize"<<endl; - -#ifdef OBSOLETE - float th = 0.0; -#endif - if (cnvs) - cnvs->SetSize(0, (int)0, (int)frameWidth, (int)(frameHeight)); - // cnvs->SetSize(0, (int)th, cw, ch - (int)th); - -#ifdef OBSOLETE - float tw = 0.0; - if (mpToolBar) - mpToolBar->GetMaxSize(&tw, &th); - if (mpToolBar) - mpToolBar->SetSize(0, 0, (int)cw, (int)th); -#endif + return mpHbWindow->GetAnalyzer(); } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void HBFrame::TransposeSelection() { - cnvs->TransposeSelection(); + mpHbWindow->TransposeSelection(); } -void CreateHarmonyBrowser(wxFrame* pParent) +void CreateHarmonyBrowser() { if (!gpHarmonyBrowser) { - gpHarmonyBrowser = new HBFrame(pParent); + gpHarmonyBrowser = new HBFrame(); } ((HBFrame *)gpHarmonyBrowser)->Show(true); } - Modified: trunk/jazz/src/Harmony.h =================================================================== --- trunk/jazz/src/Harmony.h 2008-04-07 01:05:58 UTC (rev 434) +++ trunk/jazz/src/Harmony.h 2008-04-07 04:33:58 UTC (rev 435) @@ -30,7 +30,8 @@ class HBCanvas; class tGenMelody; - +//***************************************************************************** +//***************************************************************************** class tHBInterface { public: @@ -51,35 +52,62 @@ virtual int GetSelectedScale(int *out) = 0; // returns # keys - virtual HBAnalyzer * getAnalyzer() = 0; + virtual HBAnalyzer* GetAnalyzer() = 0; virtual void TransposeSelection() = 0; }; +//***************************************************************************** +//***************************************************************************** class HBFrame : public wxFrame, public tHBInterface { public: - HBFrame(wxFrame *parent); + + HBFrame(); + ~HBFrame(); + int SeqDefined(); + int GetChordKeys(int *out, int step, int n_steps); + int GetSelectedChord(int *out); + int GetSelectedScale(int *out); + int GetBassKeys(int *out, int step, int n_steps); - virtual void OnSize(wxSizeEvent& Event); - HBAnalyzer * getAnalyzer(); + + HBAnalyzer* GetAnalyzer(); + virtual bool OnClose(); + void TransposeSelection(); + protected: + virtual void OnMenuCommand(int id); + + void OnFileLoad(wxCommandEvent& Event); + + void OnSettingsMidi(wxCommandEvent& Event); + + void OnSettingsHaunschild(wxCommandEvent& Event); + + void OnActionClearSequence(wxCommandEvent& Event); + + void OnMouseHelp(wxCommandEvent& Event); + + void OnHelp(wxCommandEvent& Event); + private: - HBCanvas* cnvs; + + HBCanvas* mpHbWindow; int SeqSelected(); JZToolBar* mpToolBar; tGenMelody* genmeldy; DECLARE_EVENT_TABLE() }; -extern void CreateHarmonyBrowser(wxFrame* pParent); +extern void CreateHarmonyBrowser(); #endif // !defined(JZ_HARMONY_H) Modified: trunk/jazz/src/PianoWindow.cpp =================================================================== --- trunk/jazz/src/PianoWindow.cpp 2008-04-07 01:05:58 UTC (rev 434) +++ trunk/jazz/src/PianoWindow.cpp 2008-04-07 04:33:58 UTC (rev 435) @@ -811,8 +811,8 @@ // Draw chords from harmony-browser. if (mVisibleHBChord && gpHarmonyBrowser && !mpTrack->IsDrumTrack()) { - HBAnalyzer *an = gpHarmonyBrowser->getAnalyzer(); - if (an != 0) + HBAnalyzer* pAnalyzer = gpHarmonyBrowser->GetAnalyzer(); + if (pAnalyzer != 0) { wxBrush cbrush = *wxBLUE_BRUSH; wxBrush sbrush = *wxBLUE_BRUSH; @@ -828,15 +828,15 @@ Dc.SetLogicalFunction(wxXOR); Dc.SetPen(*wxTRANSPARENT_PEN); - int steps = an->Steps(); + int steps = pAnalyzer->Steps(); for (int step = 0; step < steps; step ++) { - int start = an->Step2Clock(step); - int stop = an->Step2Clock(step + 1); + int start = pAnalyzer->Step2Clock(step); + int stop = pAnalyzer->Step2Clock(step + 1); if (stop > mFromClock && start < mToClock) { // this chord is visible - HBContext *context = an->GetContext(step); + HBContext *context = pAnalyzer->GetContext(step); HBChord chord = context->Chord(); HBChord scale = context->Scale(); @@ -881,8 +881,6 @@ Dc.SetLogicalFunction(wxCOPY); Dc.SetPen(*wxBLACK_PEN); Dc.SetBrush(*wxBLACK_BRUSH); - - //delete an; PORTING } } /////////end draw choords @@ -2026,7 +2024,7 @@ } //----------------------------------------------------------------------------- -// This is an an event handler for tMouseCounter. +// This is an event handler for tMouseCounter. //----------------------------------------------------------------------------- void JZPianoWindow::ButtonLabelDisplay(const wxString& Text, bool IsButtonDown) { Modified: trunk/jazz/src/TrackFrame.cpp =================================================================== --- trunk/jazz/src/TrackFrame.cpp 2008-04-07 01:05:58 UTC (rev 434) +++ trunk/jazz/src/TrackFrame.cpp 2008-04-07 04:33:58 UTC (rev 435) @@ -538,7 +538,7 @@ //----------------------------------------------------------------------------- void JZTrackFrame::OnToolsHarmonyBrowser(wxCommandEvent& Event) { - CreateHarmonyBrowser(this); + CreateHarmonyBrowser(); } //----------------------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-07 01:06:00
|
Revision: 434 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=434&view=rev Author: pstieber Date: 2008-04-06 18:05:58 -0700 (Sun, 06 Apr 2008) Log Message: ----------- 1. Fixed scrolled drawing. 2. Made cosmetic changes. Modified Paths: -------------- trunk/jazz/src/Harmony.cpp trunk/jazz/src/HarmonyP.cpp trunk/jazz/src/HarmonyP.h Modified: trunk/jazz/src/Harmony.cpp =================================================================== --- trunk/jazz/src/Harmony.cpp 2008-04-07 00:26:38 UTC (rev 433) +++ trunk/jazz/src/Harmony.cpp 2008-04-07 01:05:58 UTC (rev 434) @@ -383,7 +383,7 @@ void HBPlayer::SettingsDialog(wxFrame *parent) { #ifdef OBSOLETE - wxDialogBox *panel = new wxDialogBox(parent, "MIDI settings", FALSE ); + wxDialogBox *panel = new wxDialogBox(pParent, "MIDI settings", FALSE ); tHBPlayerForm *form = new tHBPlayerForm; form->Add(wxMakeFormMessage("Note Length for paste into piano window")); @@ -432,10 +432,9 @@ } //***************************************************************************** -// HBCanvas +// Description: +// This is the harmony browser window. //***************************************************************************** - -/** painting component for the harmony browser*/ class HBCanvas : public wxScrolledWindow { friend class HBSettingsDlg; @@ -446,21 +445,33 @@ public: - HBCanvas(wxFrame *parent, int x, int y, int w, int h); + HBCanvas(wxFrame* pParent, int x, int y, int w, int h); + virtual ~HBCanvas(); - virtual void OnDraw(wxDC& dc); - void DrawMarkers(const HBContext &c, wxDC* dc); + virtual void OnDraw(wxDC& Dc); + + void DrawMarkers(wxDC& Dc, const HBContext &c); + void ClearSeq(); - int SeqDefined() { return n_seq > 0; } + int SeqDefined() + { + return n_seq > 0; + } + int GetChordKeys(int *out, int step, int n_steps); + int GetSelectedChord(int *out); + int GetSelectedScale(int *out); + int GetBassKeys(int *out, int step, int n_steps); - void SettingsDialog(wxFrame *parent); + void SettingsDialog(); + void OnMenuCommand(int id, wxToolBar *mpToolBar); + void TransposeSelection(); HBPlayer player; @@ -470,54 +481,76 @@ SEQMAX = 256 }; - HBAnalyzer * getAnalyzer(); + HBAnalyzer* getAnalyzer(); protected: static const int ScFa; - void ChordRect(JZRectangle &r, const HBContext &ct); - void DrawChord(const HBContext &ct); - void UnDrawChord(const HBContext &ct); + + void ChordRect(JZRectangle& Rectangle, const HBContext &ct); + + void DrawChord(wxDC& Dc, const HBContext &ct); + + void UnDrawChord(wxDC& Dc, const HBContext &ct); + bool Find(float x, float y, HBContext &out); private: virtual void OnMouseEvent(wxMouseEvent& MouseEvent); + void SetMarker(int id, wxToolBar *mpToolBar); + + void SetScaleType(int menu_id, tScaleType st, wxToolBar *tb); + private: + static tScaleType scale_type; + + static int transpose_res; + + static int analyze_res; + float xchord, ychord, wchord, hchord; + float ofs; - wxFrame *parent; - HBContext *seq[SEQMAX]; +// wxFrame* parent; + + HBContext* seq[SEQMAX]; + int n_seq; - char *default_filename; + char* default_filename; + bool has_changed; HBContext mouse_context; bool haunschild_layout; + bool mark_4_common; + bool mark_3_common; + bool mark_2_common; + bool mark_1_common; + bool mark_b_common; + bool mark_0_common; + bool mark_1_semi; + bool mark_251; + bool mark_tritone; + bool mark_piano; - void SetMarker(int id, wxToolBar *mpToolBar); + int active_marker; - static int transpose_res; - static int analyze_res; - - static tScaleType scale_type; - void SetScaleType(int menu_id, tScaleType st, wxToolBar *tb); - DECLARE_EVENT_TABLE() }; @@ -534,10 +567,12 @@ END_EVENT_TABLE() -HBCanvas::HBCanvas(wxFrame *p, int x, int y, int w, int h) - : wxScrolledWindow(p, -1, wxPoint(x, y), wxSize(w, h)) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +HBCanvas::HBCanvas(wxFrame* pParent, int x, int y, int w, int h) + : wxScrolledWindow(pParent, wxID_ANY, wxPoint(x, y), wxSize(w, h)) { - parent = p; +// parent = pParent; n_seq = 0; active_marker = 0; @@ -688,66 +723,70 @@ } -void HBCanvas::ChordRect(JZRectangle &r, const HBContext &ct) +void HBCanvas::ChordRect(JZRectangle& Rectangle, const HBContext &ct) { if (ct.SeqNr()) { - r.x = (int)(xchord + (ct.SeqNr() - 1) % 8 * wchord); - r.y = (int)(hchord * ((ct.SeqNr() -1) / 8 + 0.5)); + Rectangle.x = (int)(xchord + (ct.SeqNr() - 1) % 8 * wchord); + Rectangle.y = (int)(hchord * ((ct.SeqNr() -1) / 8 + 0.5)); } else if (!haunschild_layout) { - r.x = (int)(xchord + ct.ChordNr() * wchord); - r.y = (int)(ychord + ct.ScaleNr() * hchord); + Rectangle.x = (int)(xchord + ct.ChordNr() * wchord); + Rectangle.y = (int)(ychord + ct.ScaleNr() * hchord); } else { - r.x = (int)(xchord + (5 * ct.ChordNr() % 7 + 5 * ct.ScaleNr() % 12) % 7 * wchord); - r.y = (int)(ychord + (5 * ct.ScaleNr() % 12) * hchord); + Rectangle.x = (int)(xchord + (5 * ct.ChordNr() % 7 + 5 * ct.ScaleNr() % 12) % 7 * wchord); + Rectangle.y = (int)(ychord + (5 * ct.ScaleNr() % 12) * hchord); } - r.x += (int)ofs; - r.y -= (int)ofs; - r.width = (int)(wchord - 2 * ofs); - r.height = (int)(hchord - 2 * ofs); + Rectangle.x += (int)ofs; + Rectangle.y -= (int)ofs; + Rectangle.width = (int)(wchord - 2 * ofs); + Rectangle.height = (int)(hchord - 2 * ofs); } -void HBCanvas::DrawChord(const HBContext &ct) +void HBCanvas::DrawChord(wxDC& Dc, const HBContext &ct) { - // draw surrounding box - JZRectangle r; - ChordRect(r, ct); - wxDC *dc = new wxClientDC(this);//GetDC(); - dc->DrawRectangle(r.x, r.y, r.width, r.height); + // Draw the surrounding box. + JZRectangle Rectangle; + ChordRect(Rectangle, ct); + Dc.DrawRectangle( + Rectangle.x, + Rectangle.y, + Rectangle.width, + Rectangle.height); + int w, h; - const char *name = ct.ChordName(); - dc->GetTextExtent(name, &w, &h); - dc->DrawText((char *)name, r.x + (r.width - w)/2, r.y + (r.height - h)/2); - delete dc; + const char* pName = ct.ChordName(); + Dc.GetTextExtent(pName, &w, &h); + Dc.DrawText(pName, Rectangle.x + (Rectangle.width - w)/2, Rectangle.y + (Rectangle.height - h)/2); } -void HBCanvas::UnDrawChord(const HBContext &ct) +void HBCanvas::UnDrawChord(wxDC& Dc, const HBContext& ct) { // draw surrounding box - JZRectangle r; - ChordRect(r, ct); + JZRectangle Rectangle; + ChordRect(Rectangle, ct); - wxDC *dc = new wxClientDC(this);//GetDC(); - dc->SetPen(*wxWHITE_PEN); - dc->DrawRectangle(r.x, r.y, r.width, r.height); - dc->SetPen(*wxBLACK_PEN); - delete dc; + Dc.SetPen(*wxWHITE_PEN); + Dc.DrawRectangle( + Rectangle.x, + Rectangle.y, + Rectangle.width, + Rectangle.height); + Dc.SetPen(*wxBLACK_PEN); } -void HBCanvas::OnDraw(wxDC& dcref) +void HBCanvas::OnDraw(wxDC& Dc) { - wxDC *dc = &dcref; //im just lazy, didnt want to change old code - dc->Clear(); - dc->DrawText("Seq", 5, 5); + Dc.Clear(); + Dc.DrawText("Seq", 5, 5); ychord = (n_seq/8 + 1) * hchord + (n_seq % 8 ? hchord : 0) + hchord; @@ -757,33 +796,33 @@ while (iter()) { const HBContext &ct = iter.Context(); - DrawChord(ct); + DrawChord(Dc, ct); if (ct.ChordNr() == 0 && ct.SeqNr() == 0) { - JZRectangle r; - ChordRect(r, ct); - dc->DrawText((char *)ct.ScaleName(), 5, r.y); + JZRectangle Rectangle; + ChordRect(Rectangle, ct); + Dc.DrawText(ct.ScaleName(), 5, Rectangle.y); } } - DrawMarkers(mouse_context, dc); + DrawMarkers(Dc, mouse_context); if (!haunschild_layout) { for (int j = 0; j < 7; j++) { HBContext ct(0, j, scale_type); - JZRectangle r; - ChordRect(r, ct); - r.y -= (int)hchord; + JZRectangle Rectangle; + ChordRect(Rectangle, ct); + Rectangle.y -= (int)hchord; int w, h; const char *name = ct.ChordNrName(); - dc->GetTextExtent(name, &w, &h); - dc->DrawText((char *)name, r.x + (r.width - w)/2, r.y + (r.height - h)/2); + Dc.GetTextExtent(name, &w, &h); + Dc.DrawText((char *)name, Rectangle.x + (Rectangle.width - w)/2, Rectangle.y + (Rectangle.height - h)/2); const char *type = ct.ContextName(); - dc->GetTextExtent(type, &w, &h); - dc->DrawText((char *)type, r.x + (r.width - w)/2, r.y + (r.height - h)/2 - h); + Dc.GetTextExtent(type, &w, &h); + Dc.DrawText((char *)type, Rectangle.x + (Rectangle.width - w)/2, Rectangle.y + (Rectangle.height - h)/2 - h); } } @@ -814,10 +853,10 @@ #endif -void HBCanvas::SettingsDialog(wxFrame *parent) +void HBCanvas::SettingsDialog() { #ifdef OBSOLETE - wxDialogBox *panel = new wxDialogBox(parent, "settings", FALSE ); + wxDialogBox *panel = new wxDialogBox(this, "settings", FALSE ); wxForm *form = new HBSettingsForm(this); panel->SetLabelPosition(wxHORIZONTAL); @@ -947,42 +986,41 @@ return msg[2] ? 1 : 0; } -void HBCanvas::DrawMarkers(const HBContext &ct, wxDC* dc) +void HBCanvas::DrawMarkers(wxDC& Dc, const HBContext &ct) { - JZRectangle r; - //wxDC *dc = GetDC(); - dc->SetLogicalFunction(wxXOR); - dc->SetBrush(*wxTRANSPARENT_BRUSH); + JZRectangle Rectangle; + Dc.SetLogicalFunction(wxXOR); + Dc.SetBrush(*wxTRANSPARENT_BRUSH); HBMatchMarkers match(ct, this); HBContextIterator iter(match); iter.SetSequence(seq, n_seq); iter.SetScaleType(scale_type); while (iter()) { - ChordRect(r, iter.Context()); - r.x += 3; - r.y += 3; - r.width -= 6; - r.height -= 6; - dc->DrawRectangle(r.x, r.y, r.width, r.height); + ChordRect(Rectangle, iter.Context()); + Rectangle.x += 3; + Rectangle.y += 3; + Rectangle.width -= 6; + Rectangle.height -= 6; + Dc.DrawRectangle(Rectangle.x, Rectangle.y, Rectangle.width, Rectangle.height); } // invert actual chord if (ct.ScaleType() == scale_type) { - dc->SetBrush(*wxBLACK_BRUSH); - ChordRect(r, ct); - dc->DrawRectangle(r.x, r.y, r.width, r.height); + Dc.SetBrush(*wxBLACK_BRUSH); + ChordRect(Rectangle, ct); + Dc.DrawRectangle(Rectangle.x, Rectangle.y, Rectangle.width, Rectangle.height); if (ct.SeqNr() > 0) { HBContext c(ct); c.SetSeqNr(0); - ChordRect(r, c); - dc->DrawRectangle(r.x, r.y, r.width, r.height); + ChordRect(Rectangle, c); + Dc.DrawRectangle(Rectangle.x, Rectangle.y, Rectangle.width, Rectangle.height); } } - dc->SetLogicalFunction(wxCOPY); - dc->SetBrush(*wxWHITE_BRUSH); + Dc.SetLogicalFunction(wxCOPY); + Dc.SetBrush(*wxWHITE_BRUSH); } bool HBCanvas::Find(float x, float y, HBContext &out) @@ -992,9 +1030,9 @@ iter.SetScaleType(scale_type); while (iter()) { - JZRectangle r; - ChordRect(r, iter.Context()); - if (r.IsInside((int)x, (int)y)) + JZRectangle Rectangle; + ChordRect(Rectangle, iter.Context()); + if (Rectangle.IsInside((int)x, (int)y)) { out = iter.Context(); return TRUE; @@ -1014,7 +1052,9 @@ void HBCanvas::OnMouseEvent(wxMouseEvent& MouseEvent) { - wxDC* dc= new wxClientDC(this); + wxClientDC Dc(this); + DoPrepareDC(Dc); + HBContext context; int x, y; MouseEvent.GetPosition(&x, &y); @@ -1036,12 +1076,12 @@ // remove markers first if (mouse_context.SeqNr() == n_seq) { - DrawMarkers(mouse_context, dc); + DrawMarkers(Dc, mouse_context); mouse_context.SetSeqNr(0); - DrawMarkers(mouse_context, dc); + DrawMarkers(Dc, mouse_context); } -- n_seq; - UnDrawChord(context); + UnDrawChord(Dc, context); context.SetSeqNr(0); Refresh(); } @@ -1051,9 +1091,9 @@ // add a chord context.SetSeqNr(n_seq + 1); *seq[n_seq ++] = context; - DrawMarkers(mouse_context, dc); - DrawChord(context); - DrawMarkers(mouse_context, dc); + DrawMarkers(Dc, mouse_context); + DrawChord(Dc, context); + DrawMarkers(Dc, mouse_context); Refresh(); } } @@ -1067,10 +1107,10 @@ if (MouseEvent.LeftDown() || MouseEvent.MiddleDown()) // && context != mouse_context) { - DrawMarkers(mouse_context, dc); + DrawMarkers(Dc, mouse_context); mouse_context = context; //mouse_context.SetSeqNr(0); - DrawMarkers(mouse_context, dc); + DrawMarkers(Dc, mouse_context); // paste to PianoWin buffer if (!mark_piano && gpTrackFrame->GetPianoWindow()) @@ -1099,7 +1139,6 @@ { player.StopPlay(); } - delete dc; } @@ -1204,7 +1243,7 @@ break; case MEN_SETTINGS: - SettingsDialog(parent); + SettingsDialog(); break; default: Modified: trunk/jazz/src/HarmonyP.cpp =================================================================== --- trunk/jazz/src/HarmonyP.cpp 2008-04-07 00:26:38 UTC (rev 433) +++ trunk/jazz/src/HarmonyP.cpp 2008-04-07 01:05:58 UTC (rev 434) @@ -265,14 +265,51 @@ const char *const HBContext::context_names[nScaleTypes][7] = { - { "ion", "dor", "phry", "lyd", "mixo", "aeol", "locr"}, - { "harm", "locr 13", "ion #5", "dor #11", "HM5", "lyd #9", "har dim"}, - { "melod", "dor b9", "lyd #5", "mixo #11", "mixo b13", "locr 9", "superlocr"}, - { "ion b13", "dor b5", "harm alt", "melod #11", "mixo b9", "lyd #9#5", "locr dim"}, + { + "ion", + "dor", + "phry", + "lyd", + "mixo", + "aeol", + "locr" + }, + { + "harm", + "locr 13", + "ion #5", + "dor #11", + "HM5", + "lyd #9", + "har dim" + }, + { + "melod", + "dor b9", + "lyd #5", + "mixo #11", + "mixo b13", + "locr 9", + "superlocr" + }, + { + "ion b13", + "dor b5", + "harm alt", + "melod #11", + "mixo b9", + "lyd #9#5", + "locr dim" + }, }; -const char *const HBContext::scale_type_names[nScaleTypes] = - { "J", "HM", "MM", "HJ" }; +const char* const HBContext::scale_type_names[nScaleTypes] = +{ + "J", + "HM", + "MM", + "HJ" +}; HBContext::HBContext(int sn, int cn, tScaleType st) @@ -367,12 +404,16 @@ HBChord chord; int key = scale_nr; for (i = 0; i < chord_nr; i++) + { key = scale.Iter(key); + } chord += key; for (i = 1; i < 4; i++) { for (j = 0; j < 2; j++) + { key = scale.Iter(key); + } chord += key; } return chord; @@ -383,7 +424,9 @@ { int key = scale_nr; for (int i = 0; i < chord_nr; i++) + { key = scale.Iter(key); + } return key % 12; } Modified: trunk/jazz/src/HarmonyP.h =================================================================== --- trunk/jazz/src/HarmonyP.h 2008-04-07 00:26:38 UTC (rev 433) +++ trunk/jazz/src/HarmonyP.h 2008-04-07 01:05:58 UTC (rev 434) @@ -258,60 +258,122 @@ public: HBContext(int sn, int cn = 0, tScaleType st = Major); + HBContext(); - HBChord *PScale() { return &scale; } - HBChord Scale() const { return scale; } - HBChord *PChord() { return &chord; } - HBChord Chord() const { return chord; } - int ScaleKey() const { return scale_nr; } - int ChordKey() const { return chord_key; } - int ChordNr() const { return chord_nr; } - int ScaleNr() const { return scale_nr; } - tScaleType ScaleType() const { return scale_type; } - int SeqNr() const { return seq_nr; } - void SetSeqNr(int n = 0) { seq_nr = n; } + HBChord *PScale() + { + return &scale; + } - const char * ChordName() const; // "Dm75-" - const char * ChordNrName() const; // "IV" - const char * ContextName() const // "mixo#11" + HBChord Scale() const { + return scale; + } + + HBChord *PChord() + { + return &chord; + } + + HBChord Chord() const + { + return chord; + } + + int ScaleKey() const + { + return scale_nr; + } + + int ChordKey() const + { + return chord_key; + } + + int ChordNr() const + { + return chord_nr; + } + + int ScaleNr() const + { + return scale_nr; + } + + tScaleType ScaleType() const + { + return scale_type; + } + + int SeqNr() const + { + return seq_nr; + } + + void SetSeqNr(int n = 0) + { + seq_nr = n; + } + + const char* ChordName() const; // "Dm75-" + + const char* ChordNrName() const; // "IV" + + const char* ContextName() const // "mixo#11" + { return context_names[scale_type][chord_nr]; } - const char * ScaleName() const; // "C#" - const char * ScaleTypeName() const; // "major" - int operator == (const HBContext &o) const + const char* ScaleName() const; // "C#" + + const char* ScaleTypeName() const; // "major" + + int operator == (const HBContext& Rhs) const { - return scale_type == o.scale_type && - scale_nr == o.scale_nr && - chord_nr == o.chord_nr; + return + scale_type == Rhs.scale_type && + scale_nr == Rhs.scale_nr && + chord_nr == Rhs.chord_nr; } - int operator != (const HBContext &o) const { return !operator==(o); } + int operator != (const HBContext& Rhs) const + { + return !operator == (Rhs); + } + private: + void Initialize(); + HBChord MakeScale() const; + HBChord MakeChord() const; + int MakeChordKey() const; tScaleType scale_type; + int scale_nr; + int chord_nr; + int seq_nr; HBChord chord; + HBChord scale; + int chord_key; #if NAME_TABLE static const char *const chord_names[nScaleTypes][7]; #endif - static const char *const chord_nr_names[7]; - static const char *const scale_type_names[nScaleTypes]; + static const char* const chord_nr_names[7]; + static const char* const scale_type_names[nScaleTypes]; static const int flat_keys[12]; - static const char *const context_names[nScaleTypes][7]; + static const char* const context_names[nScaleTypes][7]; }; @@ -353,21 +415,46 @@ class HBContextIterator { public: + HBContextIterator(); + HBContextIterator(HBMatch &); - void SetSequence(HBContext *s[], int n) { seq = s; n_seq = n; } - void SetScaleType(tScaleType st) { scale_type = st; } + + void SetSequence(HBContext *s[], int n) + { + seq = s; + n_seq = n; + } + + void SetScaleType(tScaleType st) + { + scale_type = st; + } + bool operator()(); - const HBContext *operator->() const { return &context; } - const HBContext &Context() const { return context; } + const HBContext *operator->() const + { + return &context; + } + + const HBContext& Context() const + { + return context; + } + private: + HBContext context; - HBMatch &match; + + HBMatch& match; + HBMatch def_match; - HBContext **seq; + HBContext** seq; + int i_seq, n_seq; + tScaleType scale_type; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-07 00:26:39
|
Revision: 433 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=433&view=rev Author: pstieber Date: 2008-04-06 17:26:38 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Changed to get chords playing in the harmony browser. The harmony browser code needs lots of work. Modified Paths: -------------- trunk/jazz/src/Harmony.cpp trunk/jazz/src/Harmony.h Modified: trunk/jazz/src/Harmony.cpp =================================================================== --- trunk/jazz/src/Harmony.cpp 2008-04-07 00:06:59 UTC (rev 432) +++ trunk/jazz/src/Harmony.cpp 2008-04-07 00:26:38 UTC (rev 433) @@ -46,7 +46,7 @@ using namespace std; #define MEN_CLOSE 1 -#define MEN_MIDI 2 +#define MEN_MIDI 2 #define MEN_TRANSPOSE 4 #define MEN_CLEARSEQ 6 #define MEN_EDIT 7 @@ -127,52 +127,81 @@ }; -// ------------------------ HBPlayer ------------------------ - -/** handle playing of the harmony*/ +//***************************************************************************** +// Description: +// This class handles the playing of the harmony. +//***************************************************************************** class HBPlayer : public wxTimer { friend class HBCanvas; + public: + HBPlayer(); + void StartPlay(const HBContext &); + void Paste(tEventArray &); + void StopPlay(); + void SettingsDialog(wxFrame *parent); - int IsPlaying() const { return playing; } - const HBContext &Context() { return context; } + int IsPlaying() const + { + return playing; + } + + const HBContext& Context() + { + return context; + } + virtual void Notify(); - int GetChordKeys(int *out, const HBContext &); - int GetMeldyKeys(int *out, const HBContext &); - int GetBassKey(const HBContext &); + int GetChordKeys(int *out, const HBContext &); + int GetMeldyKeys(int *out, const HBContext &); + + int GetBassKey(const HBContext &); + private: + HBContext context; + static int bass_channel, bass_veloc; + static int chord_channel, chord_veloc; + static int meldy_channel, meldy_veloc; - static bool bass_enabled, chord_enabled, meldy_enabled; + + static bool mBassEnabled, mChordEnabled, meldy_enabled; + static int bass_pitch, chord_pitch, meldy_pitch; + static int meldy_speed; int bass_key, chord_keys[12], n_chord_keys; + int meldy_keys[12], n_meldy_keys, meldy_index; + int note_length; + int playing; + int device; + }; -bool HBPlayer::bass_enabled = 1; +bool HBPlayer::mBassEnabled = true; int HBPlayer::bass_channel = 1; int HBPlayer::bass_veloc = 90; int HBPlayer::bass_pitch = 40; -bool HBPlayer::chord_enabled = 1; -int HBPlayer::chord_channel = 2; -int HBPlayer::chord_veloc = 90; -int HBPlayer::chord_pitch = 60; +bool HBPlayer::mChordEnabled = true; +int HBPlayer::chord_channel = 2; +int HBPlayer::chord_veloc = 90; +int HBPlayer::chord_pitch = 60; bool HBPlayer::meldy_enabled = 0; int HBPlayer::meldy_channel = 3; @@ -234,13 +263,13 @@ void HBPlayer::Paste(tEventArray &arr) { - if (bass_enabled) + if (mBassEnabled) { tKeyOn e(0, bass_channel - 1, bass_key, bass_veloc, note_length); arr.Put(e.Copy()); } - if (chord_enabled) + if (mChordEnabled) { for (int i = 0; i < n_chord_keys; i++) { @@ -267,13 +296,13 @@ n_meldy_keys = GetMeldyKeys(meldy_keys, context); // Generate KeyOn's - if (bass_enabled) + if (mBassEnabled) { tKeyOn e(0, bass_channel - 1, bass_key, bass_veloc); gpMidiPlayer->OutNow(device, &e); } - if (chord_enabled) + if (mChordEnabled) { for (i = 0; i < n_chord_keys; i++) { @@ -308,14 +337,15 @@ playing = 0; int i; + // Generate KeyOff's - if (bass_enabled) + if (mBassEnabled) { tKeyOff e(0, bass_channel - 1, bass_key); gpMidiPlayer->OutNow(device, &e); } - if (chord_enabled) + if (mChordEnabled) { for (i = 0; i < n_chord_keys; i++) { @@ -363,7 +393,7 @@ panel->SetLabelPosition(wxHORIZONTAL); - form->Add(wxMakeFormBool("Bass enable", &bass_enabled)); + form->Add(wxMakeFormBool("Bass enable", &mBassEnabled)); form->Add(wxMakeFormNewLine()); form->Add(wxMakeFormShort("Channel", &bass_channel, wxFORM_DEFAULT, new wxList(wxMakeConstraintRange(1.0, 16.0), 0))); form->Add(wxMakeFormNewLine()); @@ -372,7 +402,7 @@ form->Add(wxMakeFormShort("Pitch", &bass_pitch, wxFORM_DEFAULT, new wxList(wxMakeConstraintRange(30.0, 99.0), 0))); form->Add(wxMakeFormNewLine()); - form->Add(wxMakeFormBool("Chord enable", &chord_enabled)); + form->Add(wxMakeFormBool("Chord enable", &mChordEnabled)); form->Add(wxMakeFormNewLine()); form->Add(wxMakeFormShort("Channel", &chord_channel, wxFORM_DEFAULT, new wxList(wxMakeConstraintRange(1.0, 16.0), 0))); form->Add(wxMakeFormNewLine()); @@ -401,9 +431,9 @@ #endif } -// ============================================================= +//***************************************************************************** // HBCanvas -// ============================================================= +//***************************************************************************** /** painting component for the harmony browser*/ class HBCanvas : public wxScrolledWindow @@ -413,13 +443,15 @@ friend class HBMatchMarkers; friend ostream & operator << (ostream &os, HBCanvas const &a); friend istream & operator >> (istream &is, HBCanvas &a); + public: + HBCanvas(wxFrame *parent, int x, int y, int w, int h); virtual ~HBCanvas(); virtual void OnDraw(wxDC& dc); void DrawMarkers(const HBContext &c, wxDC* dc); + void ClearSeq(); - virtual void OnEvent(wxMouseEvent &e); int SeqDefined() { return n_seq > 0; } int GetChordKeys(int *out, int step, int n_steps); @@ -441,6 +473,7 @@ HBAnalyzer * getAnalyzer(); protected: + static const int ScFa; void ChordRect(JZRectangle &r, const HBContext &ct); void DrawChord(const HBContext &ct); @@ -449,6 +482,10 @@ private: + virtual void OnMouseEvent(wxMouseEvent& MouseEvent); + + private: + float xchord, ychord, wchord, hchord; float ofs; wxFrame *parent; @@ -480,6 +517,8 @@ static tScaleType scale_type; void SetScaleType(int menu_id, tScaleType st, wxToolBar *tb); + + DECLARE_EVENT_TABLE() }; tScaleType HBCanvas::scale_type = Major; @@ -487,7 +526,14 @@ int HBCanvas::transpose_res = 8; int HBCanvas::analyze_res = 8; +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +BEGIN_EVENT_TABLE(HBCanvas, wxScrolledWindow) + EVT_MOUSE_EVENTS(HBCanvas::OnMouseEvent) + +END_EVENT_TABLE() + HBCanvas::HBCanvas(wxFrame *p, int x, int y, int w, int h) : wxScrolledWindow(p, -1, wxPoint(x, y), wxSize(w, h)) { @@ -901,7 +947,6 @@ return msg[2] ? 1 : 0; } - void HBCanvas::DrawMarkers(const HBContext &ct, wxDC* dc) { JZRectangle r; @@ -967,18 +1012,21 @@ } -void HBCanvas::OnEvent(wxMouseEvent &e) +void HBCanvas::OnMouseEvent(wxMouseEvent& MouseEvent) { wxDC* dc= new wxClientDC(this); HBContext context; int x, y; - e.GetPosition(&x, &y); + MouseEvent.GetPosition(&x, &y); if (Find(x, y, context)) { - if (e.ButtonDown()) + if (MouseEvent.ButtonDown()) { player.StartPlay(context); - if (e.LeftDown() && e.ShiftDown() || e.MiddleDown()) + if ( + MouseEvent.LeftDown() && + MouseEvent.ShiftDown() || + MouseEvent.MiddleDown()) { if (context.SeqNr()) { @@ -1010,13 +1058,14 @@ } } } - else if (e.Dragging() && player.IsPlaying() && context != player.Context()) + else if ( + MouseEvent.Dragging() && player.IsPlaying() && context != player.Context()) { player.StopPlay(); player.StartPlay(context); } - if (e.LeftDown() || e.MiddleDown()) // && context != mouse_context) + if (MouseEvent.LeftDown() || MouseEvent.MiddleDown()) // && context != mouse_context) { DrawMarkers(mouse_context, dc); mouse_context = context; @@ -1024,7 +1073,7 @@ DrawMarkers(mouse_context, dc); // paste to PianoWin buffer - if (!mark_piano) + if (!mark_piano && gpTrackFrame->GetPianoWindow()) { tEventArray &buf = gpTrackFrame->GetPianoWindow()->mPasteBuffer; buf.Clear(); @@ -1032,18 +1081,24 @@ gpTrackFrame->GetPianoWindow()->Refresh(); } - // Show in GuitarWin - JZGuitarFrame* guitar = gpTrackFrame->GetPianoWindow()->GetGuitarFrame(); - if (guitar) + if (gpTrackFrame->GetPianoWindow()) { - guitar->ShowPitch(0); // remove actual pianowin/mouse position -// guitar->Redraw(); - guitar->Update(); + // Show in GuitarWin + JZGuitarFrame* guitar = gpTrackFrame->GetPianoWindow()->GetGuitarFrame(); + if (guitar) + { + // Remove actual pianowin/mouse position + guitar->ShowPitch(0); +// guitar->Redraw(); + guitar->Update(); + } } } } - if (e.ButtonUp() && player.IsPlaying()) + if (MouseEvent.ButtonUp() && player.IsPlaying()) + { player.StopPlay(); + } delete dc; } Modified: trunk/jazz/src/Harmony.h =================================================================== --- trunk/jazz/src/Harmony.h 2008-04-07 00:06:59 UTC (rev 432) +++ trunk/jazz/src/Harmony.h 2008-04-07 00:26:38 UTC (rev 433) @@ -34,17 +34,25 @@ class tHBInterface { public: + virtual ~tHBInterface() { } + virtual int SeqDefined() = 0; // true = yes - // return number of keys in out + // Return number of keys in out + virtual int GetChordKeys(int *out, int step, int n_steps) = 0; + virtual int GetBassKeys(int *out, int step, int n_steps) = 0; + virtual int GetSelectedChord(int *out) = 0; // returns # keys + virtual int GetSelectedScale(int *out) = 0; // returns # keys + virtual HBAnalyzer * getAnalyzer() = 0; + virtual void TransposeSelection() = 0; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-07 00:07:01
|
Revision: 432 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=432&view=rev Author: pstieber Date: 2008-04-06 17:06:59 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Replaced tab characters with spaces. Modified Paths: -------------- trunk/jazz/src/AlsaThru.cpp trunk/jazz/src/AudioDriver.cpp trunk/jazz/src/Dialogs/copyDialog.cpp trunk/jazz/src/Dialogs/copyDialog.h trunk/jazz/src/Dialogs/midiThruDialog.cpp trunk/jazz/src/Dialogs/midiTiming.cpp trunk/jazz/src/Dialogs/midiTiming.h trunk/jazz/src/SignalInterface.h trunk/jazz/src/commands/copyCommand.cpp trunk/jazz/src/mswin/jazz.rc Modified: trunk/jazz/src/AlsaThru.cpp =================================================================== --- trunk/jazz/src/AlsaThru.cpp 2008-04-06 23:58:31 UTC (rev 431) +++ trunk/jazz/src/AlsaThru.cpp 2008-04-07 00:06:59 UTC (rev 432) @@ -21,7 +21,7 @@ // // Changes // -// 2000.03.18 Takashi Iwai <iw...@ww...> +// 2000.03.18 Takashi Iwai <iw...@ww...> // - Modified for ALSA 0.5.x // - Thru-connection is done inside ALSA sequencer core if // USE_DIRECT_CONNECTION is defined in alsathru.h. Modified: trunk/jazz/src/AudioDriver.cpp =================================================================== --- trunk/jazz/src/AudioDriver.cpp 2008-04-06 23:58:31 UTC (rev 431) +++ trunk/jazz/src/AudioDriver.cpp 2008-04-07 00:06:59 UTC (rev 432) @@ -101,7 +101,7 @@ count_info cinfo; if (ioctl(mpPlayer->dev, SNDCTL_DSP_GETOPTR, &cinfo) == -1) { - perror("SNDCTL_DSP_GETOPTR"); + perror("SNDCTL_DSP_GETOPTR"); } return (cinfo.bytes - cinfo.ptr) / sizeof(short); } @@ -143,7 +143,7 @@ if (caps & DSP_CAP_DUPLEX) { - mCanDuplex = 1; // good soundcard! + mCanDuplex = 1; // good soundcard! } if (!(caps & DSP_CAP_TRIGGER)) @@ -325,7 +325,7 @@ { if (ioctl(dev, SNDCTL_DSP_RESET, 0) == -1) { - perror("SNDCTL_DSP_RESET"); + perror("SNDCTL_DSP_RESET"); } } else @@ -432,7 +432,7 @@ // oss bug? It send EINTR?? on first read.. if (errno != EINTR && errno != EAGAIN) { - perror("read"); + perror("read"); } recbuffers.UndoRequest(); break; @@ -501,11 +501,11 @@ if (ioctl(seqfd, SNDCTL_TMR_TEMPO, &new_speed) < 0) { // Sometimes this happens with mpu-401 timer. - ; // perror("SNDCTL_TMR_TEMPO"); + ; // perror("SNDCTL_TMR_TEMPO"); } else { - curr_speed = new_speed; + curr_speed = new_speed; } } } Modified: trunk/jazz/src/Dialogs/copyDialog.cpp =================================================================== --- trunk/jazz/src/Dialogs/copyDialog.cpp 2008-04-06 23:58:31 UTC (rev 431) +++ trunk/jazz/src/Dialogs/copyDialog.cpp 2008-04-07 00:06:59 UTC (rev 432) @@ -26,7 +26,7 @@ void tCopyDlg::OnHelp() { - HelpInstance->ShowTopic("Replicate"); + HelpInstance->ShowTopic("Replicate"); } Modified: trunk/jazz/src/Dialogs/copyDialog.h =================================================================== --- trunk/jazz/src/Dialogs/copyDialog.h 2008-04-06 23:58:31 UTC (rev 431) +++ trunk/jazz/src/Dialogs/copyDialog.h 2008-04-07 00:06:59 UTC (rev 432) @@ -31,16 +31,30 @@ { tCopyCommand *cp; - public: - tCopyDlg(tCopyCommand *c) - : wxForm( USED_WXFORM_BUTTONS ) { cp = c; } - void OnOk() { cp->OnOk(); wxForm::OnOk(); } - void OnCancel() { cp->OnCancel(); wxForm::OnCancel(); } - void OnHelp(); - void EditForm(wxPanel *panel); + public: + tCopyDlg(tCopyCommand *c) + : wxForm( USED_WXFORM_BUTTONS ) + { + cp = c; + } + + void OnOk() + { + cp->OnOk(); + wxForm::OnOk(); + } + + void OnCancel() + { + cp->OnCancel(); + wxForm::OnCancel(); + } + + void OnHelp(); + + void EditForm(wxPanel *panel); }; #endif // Porting #endif // COPYDIALOG - Modified: trunk/jazz/src/Dialogs/midiThruDialog.cpp =================================================================== --- trunk/jazz/src/Dialogs/midiThruDialog.cpp 2008-04-06 23:58:31 UTC (rev 431) +++ trunk/jazz/src/Dialogs/midiThruDialog.cpp 2008-04-07 00:06:59 UTC (rev 432) @@ -37,7 +37,7 @@ void tMidiThruDlg::OnHelp() { - HelpInstance->ShowTopic("Midi Thru"); + HelpInstance->ShowTopic("Midi Thru"); } Modified: trunk/jazz/src/Dialogs/midiTiming.cpp =================================================================== --- trunk/jazz/src/Dialogs/midiTiming.cpp 2008-04-06 23:58:31 UTC (rev 431) +++ trunk/jazz/src/Dialogs/midiTiming.cpp 2008-04-07 00:06:59 UTC (rev 432) @@ -116,10 +116,12 @@ { int i; char *str = copystring( ClkSrcListBox->GetStringSelection() ); - for (i = 0; i < 4; i++) { - if (!strcmp(str,ClkSrcArray[i])) { - break; - } + for (i = 0; i < 4; i++) + { + if (!strcmp(str,ClkSrcArray[i])) + { + break; + } } delete str; if (i > 3) @@ -144,7 +146,7 @@ case CsFsk: case CsInt: default: - Midi = new tWinAudioPlayer(EventWin->Song); + Midi = new tWinAudioPlayer(EventWin->Song); break; } if (!Midi->Installed()) @@ -157,11 +159,13 @@ tMtcType MtcType; str = copystring( MtcTypeListBox->GetStringSelection() ); - for (i = 0; i < 4; i++) { - if (!strcmp(str,MtcTypeArray[i])) { - MtcType = (tMtcType) i; - break; - } + for (i = 0; i < 4; i++) + { + if (!strcmp(str,MtcTypeArray[i])) + { + MtcType = (tMtcType) i; + break; + } } delete str; if (i > 3) @@ -177,7 +181,7 @@ void tTimingDlg::OnHelp() { - HelpInstance->ShowTopic("Timing"); + HelpInstance->ShowTopic("Timing"); } @@ -191,11 +195,15 @@ panel->NewLine(); panel->SetLabelPosition(wxVERTICAL); - ClkSrcListBox = new wxListBox( panel, - NULL, - "Clock Source", - wxSINGLE|wxALWAYS_SB, - -1, -1, -1, -1 ); + ClkSrcListBox = new wxListBox( + panel, + NULL, + "Clock Source", + wxSINGLE | wxALWAYS_SB, + -1, + -1, + -1, + -1); #ifdef wx_msw ClkSrcListBox->Append( ClkSrcArray[CsInt] ); @@ -221,13 +229,14 @@ char str[80]; tMtcTime *offs = t->GetMtcOffset(); offs->ToString( str ); - MtcOffsetEntry = new wxText( panel, - NULL, - "MTC offset", - str, - -1, - -1, - 100 ); + MtcOffsetEntry = new wxText( + panel, + NULL, + "MTC offset", + str, + -1, + -1, + 100); panel->NewLine(); @@ -237,11 +246,16 @@ panel->NewLine(); #endif - MtcTypeListBox = new wxListBox( panel, - NULL, - "MTC Type", - wxSINGLE|wxALWAYS_SB, - -1, -1, -1, -1 ); + MtcTypeListBox = new wxListBox( + panel, + NULL, + "MTC Type", + wxSINGLE|wxALWAYS_SB, + -1, + -1, + -1, + -1); + MtcTypeListBox->Append( MtcTypeArray[0] ); MtcTypeListBox->Append( MtcTypeArray[1] ); MtcTypeListBox->Append( MtcTypeArray[2] ); @@ -250,14 +264,13 @@ delete offs; panel->NewLine(); - RealTimeCheckBox = new wxCheckBox( panel, - NULL, - "Realtime to MIDI Out" ); + RealTimeCheckBox = new wxCheckBox( + panel, + NULL, + "Realtime to MIDI Out"); + RealTimeCheckBox->SetValue( Config(C_RealTimeOut) ); panel->NewLine(); } - - #endif // Porting - Modified: trunk/jazz/src/Dialogs/midiTiming.h =================================================================== --- trunk/jazz/src/Dialogs/midiTiming.h 2008-04-06 23:58:31 UTC (rev 431) +++ trunk/jazz/src/Dialogs/midiTiming.h 2008-04-07 00:06:59 UTC (rev 432) @@ -57,11 +57,20 @@ static void HelpFunc( tMidiButton& button, wxCommandEvent& event ); }; -class tMidiButton : public wxButton { +class tMidiButton : public wxButton +{ public: - tMidiButton( tTimingDlg *dlg, - wxPanel *panel, wxFunction func, char *label, int x = -1, int y = -1, - int width = -1, int height = -1, long style = 0, char *name = "button") + tMidiButton( + tTimingDlg *dlg, + wxPanel *panel, + wxFunction func, + char *label, + int x = -1, + int y = -1, + int width = -1, + int height = -1, + long style = 0, + char *name = "button") : wxButton( panel, func, label, x, y, width, height, style, name ) { midiDlg = dlg; Modified: trunk/jazz/src/SignalInterface.h =================================================================== --- trunk/jazz/src/SignalInterface.h 2008-04-06 23:58:31 UTC (rev 431) +++ trunk/jazz/src/SignalInterface.h 2008-04-07 00:06:59 UTC (rev 432) @@ -36,7 +36,7 @@ float pitch_range, // 1 = one octave float pan_freq, // in Hz float pan_spread, // 0..1 - float volume // -1..1 + float volume // -1..1 ); void sig_reverb( @@ -47,12 +47,12 @@ float room_val); // echo delay void sig_wavsynth( - tSample& spl, // destin - double durat, // length in seconds - int midi_key, // base freq - double fshift, // frequeny modulation factor - int N, // number of wavetables to be mixed - JZRndArray* arr[][4], // (fft, vol, pitch, pan) * N + tSample& spl, // destin + double durat, // length in seconds + int midi_key, // base freq + double fshift, // frequeny modulation factor + int N, // number of wavetables to be mixed + JZRndArray* arr[][4], // (fft, vol, pitch, pan) * N int noisegen // first array is noise filter ); Modified: trunk/jazz/src/commands/copyCommand.cpp =================================================================== --- trunk/jazz/src/commands/copyCommand.cpp 2008-04-06 23:58:31 UTC (rev 431) +++ trunk/jazz/src/commands/copyCommand.cpp 2008-04-07 00:06:59 UTC (rev 432) @@ -48,9 +48,13 @@ if (Mouse->Aborted) { if (CopyDlg) - CopyDlg->OnCancel(); + { + CopyDlg->OnCancel(); + } else - Execute(0); + { + Execute(0); + } } else if (!MarkRepeat) { Modified: trunk/jazz/src/mswin/jazz.rc =================================================================== --- trunk/jazz/src/mswin/jazz.rc 2008-04-06 23:58:31 UTC (rev 431) +++ trunk/jazz/src/mswin/jazz.rc 2008-04-07 00:06:59 UTC (rev 432) @@ -18,45 +18,45 @@ tb_note83 BITMAP "..\\bitmaps\\note83.bmp" tb_note16 BITMAP "..\\bitmaps\\note16.bmp" tb_note163 BITMAP "..\\bitmaps\\note163.bmp" -tb_majscale BITMAP "..\\bitmaps\\majscale.bmp" -tb_harscale BITMAP "..\\bitmaps\\harscale.bmp" -tb_melscale BITMAP "..\\bitmaps\\melscale.bmp" -tb_ionscale BITMAP "..\\bitmaps\\ionscale.bmp" -tb_same4 BITMAP "..\\bitmaps\\same4.bmp" -tb_same3 BITMAP "..\\bitmaps\\same3.bmp" -tb_same2 BITMAP "..\\bitmaps\\same2.bmp" -tb_same1 BITMAP "..\\bitmaps\\same1.bmp" -tb_sameh BITMAP "..\\bitmaps\\sameh.bmp" -tb_sameb BITMAP "..\\bitmaps\\sameb.bmp" -tb_same0 BITMAP "..\\bitmaps\\same0.bmp" -tb_std251 BITMAP "..\\bitmaps\\std251.bmp" -tb_tritone BITMAP "..\\bitmaps\\tritone.bmp" -tb_haunsch BITMAP "..\\bitmaps\\haunsch.bmp" -tb_piano BITMAP "..\\bitmaps\\piano.bmp" -tb_transpos BITMAP "..\\bitmaps\\transpos.bmp" -tb_analyze BITMAP "..\\bitmaps\\analyze.bmp" -tb_delchord BITMAP "..\\bitmaps\\delchord.bmp" -tb_shiftl BITMAP "..\\bitmaps\\shiftl.bmp" -tb_shiftr BITMAP "..\\bitmaps\\shiftr.bmp" -tb_rrgadd BITMAP "..\\bitmaps\\rrgadd.bmp" -tb_rrgdel BITMAP "..\\bitmaps\\rrgdel.bmp" -tb_rrgup BITMAP "..\\bitmaps\\rrgup.bmp" -tb_rrgdown BITMAP "..\\bitmaps\\rrgdown.bmp" -tb_rrggen BITMAP "..\\bitmaps\\rrggen.bmp" -tb_pianowin BITMAP "..\\bitmaps\\pianowin.bmp" +tb_majscale BITMAP "..\\bitmaps\\majscale.bmp" +tb_harscale BITMAP "..\\bitmaps\\harscale.bmp" +tb_melscale BITMAP "..\\bitmaps\\melscale.bmp" +tb_ionscale BITMAP "..\\bitmaps\\ionscale.bmp" +tb_same4 BITMAP "..\\bitmaps\\same4.bmp" +tb_same3 BITMAP "..\\bitmaps\\same3.bmp" +tb_same2 BITMAP "..\\bitmaps\\same2.bmp" +tb_same1 BITMAP "..\\bitmaps\\same1.bmp" +tb_sameh BITMAP "..\\bitmaps\\sameh.bmp" +tb_sameb BITMAP "..\\bitmaps\\sameb.bmp" +tb_same0 BITMAP "..\\bitmaps\\same0.bmp" +tb_std251 BITMAP "..\\bitmaps\\std251.bmp" +tb_tritone BITMAP "..\\bitmaps\\tritone.bmp" +tb_haunsch BITMAP "..\\bitmaps\\haunsch.bmp" +tb_piano BITMAP "..\\bitmaps\\piano.bmp" +tb_transpos BITMAP "..\\bitmaps\\transpos.bmp" +tb_analyze BITMAP "..\\bitmaps\\analyze.bmp" +tb_delchord BITMAP "..\\bitmaps\\delchord.bmp" +tb_shiftl BITMAP "..\\bitmaps\\shiftl.bmp" +tb_shiftr BITMAP "..\\bitmaps\\shiftr.bmp" +tb_rrgadd BITMAP "..\\bitmaps\\rrgadd.bmp" +tb_rrgdel BITMAP "..\\bitmaps\\rrgdel.bmp" +tb_rrgup BITMAP "..\\bitmaps\\rrgup.bmp" +tb_rrgdown BITMAP "..\\bitmaps\\rrgdown.bmp" +tb_rrggen BITMAP "..\\bitmaps\\rrggen.bmp" +tb_pianowin BITMAP "..\\bitmaps\\pianowin.bmp" -tb_select BITMAP "..\\bitmaps\\select.bmp" -tb_length BITMAP "..\\bitmaps\\length.bmp" -tb_dialog BITMAP "..\\bitmaps\\dialog.bmp" +tb_select BITMAP "..\\bitmaps\\select.bmp" +tb_length BITMAP "..\\bitmaps\\length.bmp" +tb_dialog BITMAP "..\\bitmaps\\dialog.bmp" -tb_play BITMAP "..\\bitmaps\\play.bmp" -tb_playloop BITMAP "..\\bitmaps\\playloop.bmp" -tb_record BITMAP "..\\bitmaps\\record.bmp" -tb_metro BITMAP "..\\bitmaps\\metro.bmp" +tb_play BITMAP "..\\bitmaps\\play.bmp" +tb_playloop BITMAP "..\\bitmaps\\playloop.bmp" +tb_record BITMAP "..\\bitmaps\\record.bmp" +tb_metro BITMAP "..\\bitmaps\\metro.bmp" -tb_accept BITMAP "..\\bitmaps\\accept.bmp" -tb_cancel BITMAP "..\\bitmaps\\cancel.bmp" -tb_zoomin BITMAP "..\\bitmaps\\zoomin.bmp" -tb_zoomout BITMAP "..\\bitmaps\\zoomout.bmp" -tb_cutpaste BITMAP "..\\bitmaps\\cutpaste.bmp" +tb_accept BITMAP "..\\bitmaps\\accept.bmp" +tb_cancel BITMAP "..\\bitmaps\\cancel.bmp" +tb_zoomin BITMAP "..\\bitmaps\\zoomin.bmp" +tb_zoomout BITMAP "..\\bitmaps\\zoomout.bmp" +tb_cutpaste BITMAP "..\\bitmaps\\cutpaste.bmp" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-06 23:58:34
|
Revision: 431 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=431&view=rev Author: pstieber Date: 2008-04-06 16:58:31 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Removed white space from the ends of lines. Modified Paths: -------------- trunk/jazz/contrib/CakeWalk-Converter/jazzconvert.cpp trunk/jazz/doc/jazz.tex trunk/jazz/midinetd/main.c trunk/jazz/midinetd/reader.c trunk/jazz/src/AboutDialog.cpp trunk/jazz/src/AlsaPlayer.h trunk/jazz/src/AlsaThru.cpp trunk/jazz/src/Audio.h trunk/jazz/src/ClockDialog.cpp trunk/jazz/src/Command.cpp trunk/jazz/src/Configuration.cpp trunk/jazz/src/ControlEdit.cpp trunk/jazz/src/DeprecatedWx/proplist.cpp trunk/jazz/src/Dialogs.h trunk/jazz/src/EventWindow.cpp trunk/jazz/src/EventWindow.h trunk/jazz/src/Events.h trunk/jazz/src/FileSelector.cpp trunk/jazz/src/FindFile.cpp trunk/jazz/src/FindFile.h trunk/jazz/src/Harmony.cpp trunk/jazz/src/Harmony.h trunk/jazz/src/KeyDialog.cpp trunk/jazz/src/MouseAction.cpp trunk/jazz/src/PianoFrame.cpp trunk/jazz/src/PianoWindow.cpp trunk/jazz/src/Player.cpp trunk/jazz/src/Player.h trunk/jazz/src/Project.cpp trunk/jazz/src/PropertyListDialog.h trunk/jazz/src/ResourceDialog.cpp trunk/jazz/src/Sample.cpp trunk/jazz/src/SampleDialog.cpp trunk/jazz/src/SliderWindow.cpp trunk/jazz/src/Song.cpp trunk/jazz/src/Track.cpp trunk/jazz/src/TrackWindow.cpp Modified: trunk/jazz/contrib/CakeWalk-Converter/jazzconvert.cpp =================================================================== --- trunk/jazz/contrib/CakeWalk-Converter/jazzconvert.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/contrib/CakeWalk-Converter/jazzconvert.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -7,7 +7,7 @@ #define FALSE 0 #define TRUE 1 -enum sections +enum sections { none, patchNames, @@ -16,7 +16,7 @@ instrumentDefinitions }; -void trimend(char *t) +void trimend(char *t) { char *x = t + strlen(t) - 1; @@ -27,7 +27,7 @@ } } -int countPatches(char *fname) +int countPatches(char *fname) { FILE *f = fopen(fname, "r"); @@ -38,11 +38,11 @@ bzero(t, 80); fgets(t, 79, f); trimend(t); - while (!feof(f)) + while (!feof(f)) { - if (strncmp(t, ".Patch Names", 12) == 0) + if (strncmp(t, ".Patch Names", 12) == 0) patches = TRUE; - else if (t[0] == '.') + else if (t[0] == '.') patches = FALSE; else if (patches && isdigit(t[0])) ret++; @@ -54,9 +54,9 @@ return ret; } -int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { - if (argc != 2) + if (argc != 2) { cerr << "Usage: " << argv[0] << " cakewalkfile.ins\n"; exit(-1); @@ -76,26 +76,26 @@ int numpatches = countPatches(argv[1]); fgets(t, 255, inf); trimend(t); - while (!feof(inf)) + while (!feof(inf)) { - if (t[0] == ';') + if (t[0] == ';') { // Comment line, change first character only t[0] = '#'; fprintf(outf, "%s\n", t); } - else if (strlen(t) == 1) + else if (strlen(t) == 1) { // Blank line, don't change at all fprintf(outf, "\n"); - } + } else if (t[0] == '[') { switch (currentSection) { case (patchNames): // New bank - if (b_programs != 0) + if (b_programs != 0) { - cout << "\no Processed " << b_programs + cout << "\no Processed " << b_programs << " programs.\n\n"; } cout << "o Reading bank " << t << " (#" << ++bank @@ -106,15 +106,15 @@ break; } } - else if (strncmp(t, ".Patch Names", 12) == 0) + else if (strncmp(t, ".Patch Names", 12) == 0) { // Patch names directive - fprintf(outf, ".max_voice_names %d\n", + fprintf(outf, ".max_voice_names %d\n", numpatches); fprintf(outf, ".voicenames\n"); currentSection = patchNames; } else if (strncmp(t, ".Note Names", 11) == 0) - { // Note names section + { // Note names section fprintf(outf, ".drumnames\n"); currentSection = noteNames; @@ -134,16 +134,16 @@ char *tok; int patchnum, controllernumber, notenum; - switch (currentSection) + switch (currentSection) { case (patchNames): tok = strtok(t, "=\n"); patchnum = atoi(tok); tok = strtok(NULL, "=\n"); fprintf(outf, "%d %s %d %s\n", - (bank * 256 + patchnum), + (bank * 256 + patchnum), bankname, patchnum, tok); - printf("o \t%d %s\n", patchnum, tok); + printf("o \t%d %s\n", patchnum, tok); b_programs++; t_programs++; break; case (controllerNames): Modified: trunk/jazz/doc/jazz.tex =================================================================== --- trunk/jazz/doc/jazz.tex 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/doc/jazz.tex 2008-04-06 23:58:31 UTC (rev 431) @@ -120,7 +120,7 @@ \section{Copyright}\label{copyright} -The JAZZ++ MIDI Sequencer is copyright (C) 1994-2000 Andreas Voss and +The JAZZ++ MIDI Sequencer is copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. JAZZ++ program is free software; you can redistribute it and/or modify @@ -1527,8 +1527,8 @@ text in the Event List Editor and finally convert it back to midi events. The Event List Editor allows to filter events. The Editor will show only those -events that are currently enabled in the \helpref{Filter Dialog}{midifilter} -in the Settings menu. As we already know, changing the filter settings +events that are currently enabled in the \helpref{Filter Dialog}{midifilter} +in the Settings menu. As we already know, changing the filter settings affects most of the other edit functions too, e.g erase will erase only those events, that are enabled in the Filter Dialog. @@ -1536,7 +1536,7 @@ \begin{itemize} \item {\tt 1:2:030 key 1 4C 90 200}\\ - A note event. 1:2:030 is the timing information, it means bar 1, + A note event. 1:2:030 is the timing information, it means bar 1, beat 2 plus 30 ticks. The string key indicates that this line corresponds to a note on event. The following 1 is the midi channel (numbered from 1 to 16), 4C is the octave and pitch, 90 @@ -1559,7 +1559,7 @@ A pitchbend event, valid values are in -8191 .. 8191 \item {\tt 1:2:030 sys f0 11 22 33 44 f7}\\ - A system exclusive message, hex values including the start- + A system exclusive message, hex values including the start- (f0) and stop- (f7) byte. \item {\tt 1:2:030 txt here is some text}\\ Modified: trunk/jazz/midinetd/main.c =================================================================== --- trunk/jazz/midinetd/main.c 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/midinetd/main.c 2008-04-06 23:58:31 UTC (rev 431) @@ -138,7 +138,7 @@ printerror("bind"); exit(1); } - + /* Issue listen-command */ if (listen(sd1,5) < 0) { printerror("listen"); @@ -149,7 +149,7 @@ /* (hangs until call arrives) */ fprintf(stderr,"Start accepting\n"); tcp_sd = accept(sd1,(struct sockaddr*) remote_tcp_addr_ptr,addlen_ptr); - + if (tcp_sd < 0) { printerror("accept"); exit(1); Modified: trunk/jazz/midinetd/reader.c =================================================================== --- trunk/jazz/midinetd/reader.c 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/midinetd/reader.c 2008-04-06 23:58:31 UTC (rev 431) @@ -143,7 +143,7 @@ written to the midi device. On play/record stop JAZZ will send one byte through the TCP-connection as a command and will wait for the function to send the recorded midi data - through the TCP-connection. This will be caught by the select-statement. + through the TCP-connection. This will be caught by the select-statement. After sending the record buffer the function will clear the buffer and allocate a new one. @@ -210,7 +210,7 @@ for (k = 0; k < filebytes; k++) { ch = filebuf[k]; if (ch == 0xff) continue; - /* I sometimes get these 0xff bytes, + /* I sometimes get these 0xff bytes, don't know why but they are of no use */ /* clock-to-host received ? */ Modified: trunk/jazz/src/AboutDialog.cpp =================================================================== --- trunk/jazz/src/AboutDialog.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/AboutDialog.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -83,7 +83,7 @@ // wxString Paragraph2String = "Jazz++ is a MIDI sequencer program."; - wxString HtmlString = + wxString HtmlString = "<html>" "<head><META http-equiv=\"Content-Type\" content=\"text/html; charset=" + LocaleString + "\"></head>" Modified: trunk/jazz/src/AlsaPlayer.h =================================================================== --- trunk/jazz/src/AlsaPlayer.h 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/AlsaPlayer.h 2008-04-06 23:58:31 UTC (rev 431) @@ -76,7 +76,7 @@ int inp_dev, outp_dev; // input/output device index int sync_in, sync_in_dev, sync_in_mtcType; int sync_out, sync_out_dev, sync_out_mtcType; - + int installed; static int create_port(snd_seq_t *handle, const char *name); Modified: trunk/jazz/src/AlsaThru.cpp =================================================================== --- trunk/jazz/src/AlsaThru.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/AlsaThru.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -50,8 +50,8 @@ #include "AlsaPlayer.h" /* -** midi thru for alsa. it creates a new process (because threads dont work -** with wxwin) that copies from input to output. +** midi thru for alsa. it creates a new process (because threads dont work +** with wxwin) that copies from input to output. */ tAlsaThru::tAlsaThru() @@ -158,7 +158,7 @@ // thread version -void tAlsaThru::stopworker(int sig) +void tAlsaThru::stopworker(int sig) { running = 0; snd_seq_close(handle); @@ -176,7 +176,7 @@ return 0; } -void tAlsaThru::Start() +void tAlsaThru::Start() { if (!running) pthread_create(&worker, (void *)0, startworker, (void *)this); @@ -185,7 +185,7 @@ void tAlsaThru::Stop() { if (running) - pthread_kill(worker, SIGHUP); + pthread_kill(worker, SIGHUP); } @@ -196,13 +196,13 @@ static snd_seq_t *static_handle; // ugly!! -void tAlsaThru::stopworker(int sig) +void tAlsaThru::stopworker(int sig) { snd_seq_close(static_handle); exit(0); } -void tAlsaThru::Start() +void tAlsaThru::Start() { if (!running) { worker = fork(); Modified: trunk/jazz/src/Audio.h =================================================================== --- trunk/jazz/src/Audio.h 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/Audio.h 2008-04-06 23:58:31 UTC (rev 431) @@ -245,7 +245,7 @@ void Edit(int key); - int GetSpeed() const + int GetSpeed() const { return speed; } Modified: trunk/jazz/src/ClockDialog.cpp =================================================================== --- trunk/jazz/src/ClockDialog.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/ClockDialog.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -57,7 +57,7 @@ return new wxProperty( mpTitle, wxPropertyValue((char**)&mpString), - "string"); + "string"); } //----------------------------------------------------------------------------- Modified: trunk/jazz/src/Command.cpp =================================================================== --- trunk/jazz/src/Command.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/Command.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -535,7 +535,7 @@ */ void tCmdSeqLength::ExecuteEvent(JZTrack *t, JZEvent *e) { - //make a copy of the current event + // Make a copy of the current event. JZEvent *k; k = (tKeyOn *)e->Copy(); @@ -548,7 +548,6 @@ k->SetClock((long int)(((k->GetClock()-startClock)*scale) + startClock ) ); t->Kill(e); t->Put(k); - } @@ -593,7 +592,7 @@ 0x37ff, 0x3fff }; - + long startvelocity=0; long startkey=0; while (e) @@ -651,16 +650,17 @@ { tKeyOn *k; - for(int i=1; i< repeat; i++) + for (int i = 1; i < repeat; ++i) { - if(e->IsKeyOn()){ //only echo note events + if (e->IsKeyOn()) + { + //only echo note events k = (tKeyOn *)e->Copy(); - k->SetClock(k->GetClock()+ clockDelay*i ); - k->Veloc=(unsigned char)(pow(scale,i)*k->Veloc); - t->Put(k); - } + k->SetClock(k->GetClock()+ clockDelay * i); + k->Veloc = (unsigned char)(pow(scale, i) * k->Veloc); + t->Put(k); } - + } } Modified: trunk/jazz/src/Configuration.cpp =================================================================== --- trunk/jazz/src/Configuration.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/Configuration.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -94,12 +94,12 @@ tConfigEntry::~tConfigEntry() { delete [] Name; - delete [] StrValue; + delete [] StrValue; } void tConfigEntry::SetStrValue(const char* pStringValue) { - delete [] StrValue; + delete [] StrValue; if (pStringValue) { StrValue = new char[strlen(pStringValue) + 1]; Modified: trunk/jazz/src/ControlEdit.cpp =================================================================== --- trunk/jazz/src/ControlEdit.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/ControlEdit.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -100,10 +100,9 @@ panel->SetAutoLayout( TRUE ); // tell dialog to use sizer panel->SetSizer( topsizer ); // actually set the sizer - - topsizer->Fit( panel ); // set size to minimum size as calculated by the sizer - topsizer->SetSizeHints( panel ); // set size hints to honour mininum size + topsizer->Fit( panel ); // set size to minimum size as calculated by the sizer + topsizer->SetSizeHints( panel ); // set size hints to honour mininum size } Modified: trunk/jazz/src/DeprecatedWx/proplist.cpp =================================================================== --- trunk/jazz/src/DeprecatedWx/proplist.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/DeprecatedWx/proplist.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -1811,7 +1811,7 @@ if (sel == wxNOT_FOUND) return; - wxStringList::compatibility_iterator* node = + wxStringList::compatibility_iterator* node = (wxStringList::compatibility_iterator*) m_listBox->wxListBox::GetClientData(sel); if (!node) Modified: trunk/jazz/src/Dialogs.h =================================================================== --- trunk/jazz/src/Dialogs.h 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/Dialogs.h 2008-04-06 23:58:31 UTC (rev 431) @@ -39,11 +39,11 @@ long mSteps; // 0 was static long mUnit; - + JZEventFrame* mpEventWindow; JZFilter* mpFilter; JZSong* mpSong; - + tShiftDlg(JZEventFrame* pEventWindow, JZFilter* pFilter, long Unit); void AddProperties(); bool OnClose(); Modified: trunk/jazz/src/EventWindow.cpp =================================================================== --- trunk/jazz/src/EventWindow.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/EventWindow.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -220,7 +220,7 @@ // //onpaint never seems to get called, but ondraw does get called // int x = 0, y = 0; // GetViewStart(&x, &y); -// EventWin->OnPaintSub(Dc, x * mScrollSize, y * mScrollSize); +// EventWin->OnPaintSub(Dc, x * mScrollSize, y * mScrollSize); // cout << "JZEventWindow::OnDraw << endl; //} @@ -362,7 +362,7 @@ */ //void JZEventFrame::CreateCanvas() //{ -// cout << "CreateCanvas" << endl; +// cout << "CreateCanvas" << endl; // int Width, Height; // GetClientSize(&Width, &Height); // mpEventWindow = new JZEventWindow(this, 0, 0, Width, Height); @@ -414,7 +414,7 @@ /** -this onsize handler is supposed to take care of handling of the resizing the two subwindows sizes to +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) @@ -451,7 +451,7 @@ 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)); @@ -607,7 +607,7 @@ dc is the device context to draw in, normally generated from the framework from ondraw x and y is the coordinates of the start of the view - + */ void JZEventFrame::OnPaintSub(wxDC *dc, int x, int y) { @@ -625,7 +625,7 @@ mEventsWidth = CanvasW - mLeftInfoWidth; mEventsHeight = CanvasH - mTopInfoHeight; - FromLine = CanvasY / mTrackHeight; + FromLine = CanvasY / mTrackHeight; ToLine = (CanvasY + CanvasH - mTopInfoHeight) / mTrackHeight; FromClock = CanvasX * ClocksPerPixel; ToClock = x2Clock(CanvasX + CanvasW); Modified: trunk/jazz/src/EventWindow.h =================================================================== --- trunk/jazz/src/EventWindow.h 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/EventWindow.h 2008-04-06 23:58:31 UTC (rev 431) @@ -241,7 +241,7 @@ void ZoomIn(); void ZoomOut(); - + protected: JZToolBar* mpToolBar; Modified: trunk/jazz/src/Events.h =================================================================== --- trunk/jazz/src/Events.h 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/Events.h 2008-04-06 23:58:31 UTC (rev 431) @@ -734,7 +734,7 @@ void SetTrackState(char c) { Data[6] = c; } - + // Data[7] is unused unsigned char GetTrackDevice() const { @@ -963,12 +963,12 @@ } }; -/* the meaning of this event is to be able to reference a track and have that play the instant -the event is executed. you can also transpose the referenced track and loop it for the duration -of the playtrack event. this makes it possible to compose in a structured fashion. - -ececution of the events takes place in song.cpp. -*/ +// the meaning of this event is to be able to reference a track and have that +// play the instant the event is executed. You can also transpose the +// referenced track and loop it for the duration of the playtrack event. This +// makes it possible to compose in a structured fashion. +// +// Execution of the events takes place in song.cpp. class tPlayTrack : public tMetaEvent { public: @@ -977,12 +977,12 @@ int eventlength; //the length of the event, confusing with the Length field of tMetaEvent, that seems to be for serialization virtual int GetLength() { edb(); return eventlength; } - + tPlayTrack(int clk, unsigned char *chardat, unsigned short len) : tMetaEvent(clk, StatPlayTrack, chardat, len) { int *dat = (int *)chardat; - //fill in the fields from the data + //fill in the fields from the data track=0; transpose=0; eventlength=0; @@ -992,15 +992,15 @@ eventlength=dat[2]; } } - - tPlayTrack(int clk, int track, int transpose, int eventlength) - : tMetaEvent(clk, StatPlayTrack, 0, 0) - { - this->track=track; - this->transpose=transpose; - this->eventlength=eventlength; - } + tPlayTrack(int clk, int track, int transpose, int eventlength) + : tMetaEvent(clk, StatPlayTrack, 0, 0) + { + this->track=track; + this->transpose=transpose; + this->eventlength=eventlength; + } + virtual int Write(JZWriteBase &io) { @@ -1010,7 +1010,7 @@ dat[1]=transpose; dat[2]=eventlength; Length=sizeof(int)*3; - edb(); + edb(); Data[Length] = 0; return io.Write(this, Data, Length); @@ -1022,7 +1022,7 @@ edb(); return new tPlayTrack(mClock, track, transpose, eventlength); } - + //this event has no real "pitch" but the rest of jazz use the pitch, in the pianowin editor pitch is the y coord of the event virtual int GetPitch(){ return track; Modified: trunk/jazz/src/FileSelector.cpp =================================================================== --- trunk/jazz/src/FileSelector.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/FileSelector.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -58,10 +58,10 @@ // This is the file name. //***************************************************************************** wxString file_selector( - wxString deffile, - const wxString title, - bool save, - bool changed, + wxString deffile, + const wxString title, + bool save, + bool changed, const wxString ext) { wxString s; @@ -69,10 +69,12 @@ wxString path; if (save) + { file = wxFileNameFromPath(deffile); - + } + path = wxPathOnly(deffile); - + int flags = save ? wxFD_SAVE : wxFD_OPEN; s = wxFileSelector(title, path, file, 0, ext, flags); Modified: trunk/jazz/src/FindFile.cpp =================================================================== --- trunk/jazz/src/FindFile.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/FindFile.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -34,9 +34,9 @@ // // 1. using the passed file name // 2. appending the passed file name to the path specified by the HOME -// environment variable, if it exists +// environment variable, if it exists // 3. appending the passed file name to the path specified by the JAZZ -// environment variable, if it exists +// environment variable, if it exists // 4. appending the passed file name to the location of the jazz executable // // Returns: Modified: trunk/jazz/src/FindFile.h =================================================================== --- trunk/jazz/src/FindFile.h 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/FindFile.h 2008-04-06 23:58:31 UTC (rev 431) @@ -30,9 +30,9 @@ // // 1. using the passed file name // 2. appending the passed file name to the path specified by the HOME -// environment variable, if it exists +// environment variable, if it exists // 3. appending the passed file name to the path specified by the JAZZ -// environment variable, if it exists +// environment variable, if it exists // 4. appending the passed file name to the location of the jazz executable // // Returns: Modified: trunk/jazz/src/Harmony.cpp =================================================================== --- trunk/jazz/src/Harmony.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/Harmony.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -355,12 +355,12 @@ #ifdef OBSOLETE wxDialogBox *panel = new wxDialogBox(parent, "MIDI settings", FALSE ); tHBPlayerForm *form = new tHBPlayerForm; - + form->Add(wxMakeFormMessage("Note Length for paste into piano window")); form->Add(wxMakeFormNewLine()); form->Add(wxMakeFormShort("Length", ¬e_length, wxFORM_DEFAULT, new wxList(wxMakeConstraintRange(10.0, 120.0), 0))); form->Add(wxMakeFormNewLine()); - + panel->SetLabelPosition(wxHORIZONTAL); form->Add(wxMakeFormBool("Bass enable", &bass_enabled)); @@ -432,8 +432,12 @@ void TransposeSelection(); HBPlayer player; - enum {SEQMAX = 256}; + enum + { + SEQMAX = 256 + }; + HBAnalyzer * getAnalyzer(); protected: @@ -1358,7 +1362,7 @@ wxString* snames = new wxString[n_scale_names]; for (i = 0; i < n_scale_names; i++) snames[i] = (char *)scale_names[i].name; - scale_lst = new wxListBox(this, -1, wxPoint(200, y), wxSize(300, 200), n_scale_names, snames, wxLB_SINGLE| wxLB_NEEDED_SB);//"Scales", + scale_lst = new wxListBox(this, -1, wxPoint(200, y), wxSize(300, 200), n_scale_names, snames, wxLB_SINGLE| wxLB_NEEDED_SB);//"Scales", delete [] snames; // thats it Modified: trunk/jazz/src/Harmony.h =================================================================== --- trunk/jazz/src/Harmony.h 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/Harmony.h 2008-04-06 23:58:31 UTC (rev 431) @@ -34,7 +34,9 @@ class tHBInterface { public: - virtual ~tHBInterface() {} + virtual ~tHBInterface() + { + } virtual int SeqDefined() = 0; // true = yes // return number of keys in out Modified: trunk/jazz/src/KeyDialog.cpp =================================================================== --- trunk/jazz/src/KeyDialog.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/KeyDialog.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -50,7 +50,7 @@ wxProperty* tKeyDlg::mkProperty() { - return new wxProperty(mpTitle, wxPropertyValue((char**)&mpString), "string"); + return new wxProperty(mpTitle, wxPropertyValue((char**)&mpString), "string"); } int tKeyDlg::GetKey() Modified: trunk/jazz/src/MouseAction.cpp =================================================================== --- trunk/jazz/src/MouseAction.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/MouseAction.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -192,8 +192,8 @@ r2 = r; r2.SetNormal(); - win->Refresh(TRUE, &r1); - win->Refresh(TRUE, &r2); + win->Refresh(TRUE, &r1); + win->Refresh(TRUE, &r2); } //invalidate both old and new rect @@ -241,7 +241,7 @@ Dc.SetLogicalFunction(wxXOR); Dc.SetBrush(*mpBackgroundBrush); - + rr.SetNormal(); if (rr.width && rr.height) { Modified: trunk/jazz/src/PianoFrame.cpp =================================================================== --- trunk/jazz/src/PianoFrame.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/PianoFrame.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -163,9 +163,9 @@ EVT_MENU(ID_SNAP_16, JZPianoFrame::OnSnap16) EVT_MENU(ID_SNAP_16D, JZPianoFrame::OnSnap16D) - EVT_MENU(ID_SELECT, JZPianoFrame::OnMSelect) - EVT_MENU(ID_CHANGE_LENGTH, JZPianoFrame::OnMLength) - EVT_MENU(ID_EVENT_DIALOG, JZPianoFrame::OnMDialog) + EVT_MENU(ID_SELECT, JZPianoFrame::OnMSelect) + EVT_MENU(ID_CHANGE_LENGTH, JZPianoFrame::OnMLength) + EVT_MENU(ID_EVENT_DIALOG, JZPianoFrame::OnMDialog) EVT_MENU(ID_CUT_PASTE_EVENTS, JZPianoFrame::OnMCutPaste) EVT_MENU(MEN_GUITAR, JZPianoFrame::OnGuitar) @@ -266,7 +266,7 @@ delete mpPianoWindow; delete MixerForm; - + delete mpToolBar; } @@ -437,7 +437,7 @@ mpPianoWindow->Redo(); } -// Undo actions +// Undo actions void JZPianoFrame::OnUndo(wxCommandEvent& Event) { mpPianoWindow->Undo(); Modified: trunk/jazz/src/PianoWindow.cpp =================================================================== --- trunk/jazz/src/PianoWindow.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/PianoWindow.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -368,7 +368,7 @@ int Length = Clock - Copy->GetClock(); if (Length <= 0) Length = 1; - Copy->eventlength = Length; + Copy->eventlength = Length; Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 1, 1); return 0; @@ -530,7 +530,7 @@ //----------------------------------------------------------------------------- BEGIN_EVENT_TABLE(JZPianoWindow, JZEventWindow) - EVT_SIZE(JZPianoWindow::OnSize) + EVT_SIZE(JZPianoWindow::OnSize) EVT_MOUSE_EVENTS(JZPianoWindow::OnMouseEvent) @@ -628,7 +628,7 @@ int c; for (int i = 0; i < NUM_COLORS; ++i) { - c = 256 * i / NUM_COLORS; + c = 256 * i / NUM_COLORS; mpColorBrush[i].SetColour(c, 0, 127 - c / 2); mpColorBrush[i].SetStyle(wxSOLID); } @@ -679,7 +679,7 @@ // OnPaint never seems to get called, but OnDraw does get called. int x = 0, y = 0; GetViewStart(&x, &y); - OnPaintSub(Dc, x * mScrollSize, y * mScrollSize); + OnPaintSub(Dc, x * mScrollSize, y * mScrollSize); } //----------------------------------------------------------------------------- @@ -914,7 +914,7 @@ DrawEvents(Dc, mpTrack, StatSysEx, wxGREEN_BRUSH, FALSE); if (mVisiblePlayTrack) DrawEvents(Dc, mpTrack, StatPlayTrack, wxLIGHT_GREY_BRUSH, FALSE); - + DrawEvents(Dc, mpTrack, StatEndOfTrack, wxRED_BRUSH, FALSE); DrawEvents(Dc, mpTrack, StatText, wxBLACK_BRUSH, FALSE); @@ -962,7 +962,7 @@ mEventsWidth = mCanvasWidth - mLeftInfoWidth; mEventsHeight = mCanvasHeight - mTopInfoHeight; - mFromLine = mCanvasY / mTrackHeight; + mFromLine = mCanvasY / mTrackHeight; mToLine = (mCanvasY + mCanvasHeight - mTopInfoHeight) / mTrackHeight; mFromClock = mCanvasX * mClockTicsPerPixel; mToClock = x2Clock(mCanvasX + mCanvasWidth); @@ -1275,7 +1275,7 @@ } int x = Clock2x(pEvent->GetClock()); int y = Pitch2y(pEvent->GetPitch()); - if (!xoor) + if (!xoor) { Dc.SetBrush(*wxWHITE_BRUSH); Dc.DrawRectangle(x, y + mLittleBit, length, mTrackHeight - 2 * mLittleBit); @@ -1369,17 +1369,17 @@ // end velocity colors Dc.DrawRectangle(x1, y1 + mLittleBit, DrawLength, mTrackHeight - 2 * mLittleBit); - //shouldnt it be in drawevent? odd. + //shouldnt it be in drawevent? odd. if (pEvent->IsPlayTrack()) { Dc.SetPen(*wxBLACK_PEN); ostringstream Oss; - Oss << "Track:" << pEvent->IsPlayTrack()->track; + Oss << "Track:" << pEvent->IsPlayTrack()->track; Dc.DrawText(Oss.str().c_str(), x1, y1 + mLittleBit); } } - + if (Clock + Length >= mFromClock) { //thesse events are always visible in vertical @@ -1388,10 +1388,10 @@ Dc.SetPen(*wxRED_PEN); Dc.VLine(x1); //draw a vertical bar Dc.SetPen(*wxBLACK_PEN); - sprintf(buf, "EOT"); + sprintf(buf, "EOT"); Dc.DrawText(buf, x1, y1 + mLittleBit); } - + if (pEvent->IsText()) { Dc.SetPen(*wxGREEN_PEN); @@ -1400,8 +1400,8 @@ sprintf(buf, (const char*)pEvent->IsText()->GetText()); int textX; int textY; - - Dc.GetTextExtent((const char*)pEvent->IsText()->GetText(), &textX, &textY); + + Dc.GetTextExtent((const char*)pEvent->IsText()->GetText(), &textX, &textY); Dc.SetBrush(*wxWHITE_BRUSH); int textlabely = mCanvasY + mTopInfoHeight;//text labels drawn at top Dc.DrawRectangle(x1-textX, textlabely + mLittleBit, textX, textY);//mTrackHeight - 2 * mLittleBit); @@ -1814,7 +1814,7 @@ Dc.SetLogicalFunction(wxXOR); Dc.SetBrush(*wxBLUE_BRUSH); - if (mMouseLine >= 0) + if (mMouseLine >= 0) { // Erase the previous highlight. Dc.DrawRectangle( @@ -2299,7 +2299,7 @@ CtrlH(Height)); mpCtrlEdit->ReInit(mpTrack, mFromClock, mClockTicsPerPixel); - Refresh(); + Refresh(); } void JZPianoWindow::CtrlPolyAftertouchEdit() @@ -2319,14 +2319,14 @@ CtrlH(Height)); mpCtrlEdit->ReInit(mpTrack, mFromClock, mClockTicsPerPixel); - Refresh(); + Refresh(); } void JZPianoWindow::CtrlNone() { delete mpCtrlEdit; mpCtrlEdit = 0; - Refresh(); + Refresh(); } void JZPianoWindow::CtrlTempo() @@ -2388,7 +2388,7 @@ CtrlH(Height)); mpCtrlEdit->ReInit(mpTrack, mFromClock, mClockTicsPerPixel); - Refresh(); + Refresh(); } void JZPianoWindow::EditFilter() @@ -2418,7 +2418,7 @@ mpCtrlEdit->ReInit(mpTrack, mFromClock, mClockTicsPerPixel); Refresh(); - } + } } void JZPianoWindow::CtrlModulation() @@ -2439,7 +2439,7 @@ CtrlH(Height)); mpCtrlEdit->ReInit(mpTrack, mFromClock, mClockTicsPerPixel); - Refresh(); + Refresh(); } void JZPianoWindow::CtrlPitch() @@ -2457,9 +2457,9 @@ CtrlY(Height), mCanvasWidth, CtrlH(Height)); - + mpCtrlEdit->ReInit(mpTrack, mFromClock, mClockTicsPerPixel); - Refresh(); + Refresh(); } void JZPianoWindow::Redo() @@ -2468,18 +2468,18 @@ Refresh(); if (mpCtrlEdit && mpTrack >= 0) { - mpCtrlEdit->ReInit(mpTrack, mFromClock, mClockTicsPerPixel); + mpCtrlEdit->ReInit(mpTrack, mFromClock, mClockTicsPerPixel); } } -// Undo actions +// Undo actions void JZPianoWindow::Undo() { mpSong->Undo(); Refresh(); if (mpCtrlEdit && mpTrack >= 0) { - mpCtrlEdit->ReInit(mpTrack, mFromClock, mClockTicsPerPixel); + mpCtrlEdit->ReInit(mpTrack, mFromClock, mClockTicsPerPixel); } } @@ -2502,7 +2502,7 @@ tCmdExchUpDown cmd(mpFilter); cmd.Execute(1); Refresh(); - } + } } // Flip events left to right. @@ -2513,7 +2513,7 @@ tCmdExchLeftRight cmd(mpFilter); cmd.Execute(1); Refresh(); - } + } } // Shift events snapclock clocks to left. @@ -2561,7 +2561,7 @@ mpGuitarFrame->Update(); // mpGuitarFrame->Redraw(); } - } + } } void JZPianoWindow::Erase() @@ -2571,14 +2571,14 @@ tCmdErase cmd(mpFilter); cmd.Execute(1); // with UNDO Refresh(); - } + } } void JZPianoWindow::ToggleVisibleAllTracks() { mVisibleAllTracks = !mVisibleAllTracks; - Refresh(); + Refresh(); } void JZPianoWindow::MSelect() @@ -2798,7 +2798,7 @@ void JZPianoWindow::ActivateSettingsDialog() { jppResourceDialog Dialog(this, "windowSettings"); - + Dialog.Attach("use_colours", &mUseColors); Dialog.Attach("font_size", &mFontSize, mPianoFontSizes); @@ -2824,7 +2824,7 @@ int repeat = 6; jppResourceDialog dialog(this, "midiDelay"); - + dialog.Attach("scale", &scale); dialog.Attach("clockDelay", &clockDelay); dialog.Attach("repeat", &repeat); @@ -2849,9 +2849,9 @@ int scale = 100; //in percent jppResourceDialog dialog(this, "sequenceLength"); - + dialog.Attach("scale", &scale); - + if (dialog.ShowModal() == wxID_OK) { //execute the command Modified: trunk/jazz/src/Player.cpp =================================================================== --- trunk/jazz/src/Player.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/Player.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -95,7 +95,7 @@ // for (int i = 0; i < count; i++) // delete [] names[i]; } - + //tNamedValue *tDeviceList::AsNamedValue() //{ // tNamedValue *nv = new tNamedValue[count + 1]; Modified: trunk/jazz/src/Player.h =================================================================== --- trunk/jazz/src/Player.h 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/Player.h 2008-04-06 23:58:31 UTC (rev 431) @@ -299,7 +299,7 @@ protected: virtual void OutNow(JZEvent* pEvent) = 0; - + private: tDeviceList DummyDeviceList; Modified: trunk/jazz/src/Project.cpp =================================================================== --- trunk/jazz/src/Project.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/Project.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -332,7 +332,7 @@ //----------------------------------------------------------------------------- JZProject::~JZProject() { - delete mpMidiPlayer; + delete mpMidiPlayer; delete mpSynth; delete mpRecInfo; delete mpConfig; Modified: trunk/jazz/src/PropertyListDialog.h =================================================================== --- trunk/jazz/src/PropertyListDialog.h 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/PropertyListDialog.h 2008-04-06 23:58:31 UTC (rev 431) @@ -109,7 +109,7 @@ int MapName2Value(const char* pSelection); wxString MapValue2Name(int Value); - + virtual bool OnSelect( bool Select, wxProperty* pProperty, Modified: trunk/jazz/src/ResourceDialog.cpp =================================================================== --- trunk/jazz/src/ResourceDialog.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/ResourceDialog.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -58,7 +58,7 @@ wxXmlResource::Get()->InitAllHandlers(); initialized = true; } - + wxXmlResource::Get()->Load(xrcfile); } @@ -196,7 +196,7 @@ ++iResourceElement) { jppResourceElement* pResourceElement = *iResourceElement; - + wxWindow* win = wxWindow::FindWindowByName( pResourceElement->resource, dialog); @@ -290,7 +290,7 @@ { if (value == pResourceElement->longarr[i]) break; } - + if (i == pResourceElement->longarr.GetCount()) { // We couldn't find the value in the list. @@ -313,7 +313,7 @@ ((wxSlider*)win)->SetValue((int)value); } } - + if (!used) { wxMessageBox("Unable to locate a mapping for this widget:\n" Modified: trunk/jazz/src/Sample.cpp =================================================================== --- trunk/jazz/src/Sample.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/Sample.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -593,9 +593,9 @@ { /* PAT - The following error prompted the addition of the casts to double. sample.cpp: In member function `void tSample::TransposeSemis(float)': - choosing `double pow(double, double)' over `float + choosing `double pow(double, double)' over `float std::pow(float, float)' - because worst conversion for the former is better than worst + because worst conversion for the former is better than worst conversion for the latter */ float f = (double)pow((double)FSEMI, (double)semis); Modified: trunk/jazz/src/SampleDialog.cpp =================================================================== --- trunk/jazz/src/SampleDialog.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/SampleDialog.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -649,13 +649,13 @@ //cancel = new wxButton(panel, (wxFunction)ItemCallback, "Close"); //panel->NewLine(); chk_fft = new wxCheckBox(panel, -1, "Harmonics"); // (wxFunction)ItemCallback, - chk_fft->SetValue(fft_enable); + chk_fft->SetValue(fft_enable); chk_vol = new wxCheckBox(panel, -1, "Envelope"); // (wxFunction)ItemCallback, - chk_vol->SetValue(vol_enable); + chk_vol->SetValue(vol_enable); chk_pan = new wxCheckBox(panel, -1, "Panpot"); // (wxFunction)ItemCallback, - chk_pan->SetValue(pan_enable); + chk_pan->SetValue(pan_enable); chk_frq = new wxCheckBox(panel, -1, "Pitch"); // (wxFunction)ItemCallback, - chk_frq->SetValue(frq_enable); + chk_frq->SetValue(frq_enable); chk_noise = new wxCheckBox(panel, -1, "Noise"); // (wxFunction)ItemCallback, chk_noise->SetValue(noise_enable); #ifdef OBSOLETE Modified: trunk/jazz/src/SliderWindow.cpp =================================================================== --- trunk/jazz/src/SliderWindow.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/SliderWindow.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -83,7 +83,7 @@ BEGIN_EVENT_TABLE(tSliderWin, wxFrame) - EVT_SIZE(tSliderWin::OnSize) + EVT_SIZE(tSliderWin::OnSize) END_EVENT_TABLE() /**called from the event table whenever the window is resized Modified: trunk/jazz/src/Song.cpp =================================================================== --- trunk/jazz/src/Song.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/Song.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -248,15 +248,15 @@ return; fprintf(stderr, "playtrack %d\n",c->track); JZTrack* pTrack = &mTracks[c->track];//the track we want to play - tEventIterator IteratorPL(pTrack); //get an iterator of all events the playtrack is pointing to + tEventIterator IteratorPL(pTrack); //get an iterator of all events the playtrack is pointing to JZEvent *f; //FIXME this is just to test the idea, it would be good to modify getlastclock instead i think //find an EOT event, otherwise default to the last clock(should be + length of the last event as well) int loopLength = 0; - tEventIterator IteratorEOT(pTrack); //get an iterator of all events the playtrack is pointing to + tEventIterator IteratorEOT(pTrack); //get an iterator of all events the playtrack is pointing to f = IteratorEOT.Range(0, pTrack->GetLastClock()); - loopLength = pTrack->GetLastClock(); + loopLength = pTrack->GetLastClock(); while(f) { if (f->IsEndOfTrack()) @@ -280,8 +280,8 @@ // start of those to the beginning of the loop, and shorten the length. // There would still be a problem with playtracks not even bar length. while(loopOffset < c->eventlength) - { - f = IteratorPL.Range(0, (c->eventlength-loopOffset)); //no more events then the length of the playtrack! and ensure last iteration is no longer than what is left + { + f = IteratorPL.Range(0, (c->eventlength-loopOffset)); //no more events then the length of the playtrack! and ensure last iteration is no longer than what is left while (f) { JZEvent *d = f->Copy(); Modified: trunk/jazz/src/Track.cpp =================================================================== --- trunk/jazz/src/Track.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/Track.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -497,7 +497,7 @@ ++j; --newnEvents; } - + JZEvent* item; if (j <= MaxEvents) { @@ -524,7 +524,7 @@ Resize(); } Events[nEvents++] = e; - + #ifdef E_DBUG { for (int i = 0; i < nEvents; i++) Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2008-04-06 23:00:36 UTC (rev 430) +++ trunk/jazz/src/TrackWindow.cpp 2008-04-06 23:58:31 UTC (rev 431) @@ -635,7 +635,7 @@ // Draw the selection box. mpSnapSel->Draw(LocalDc, mEventsX, mEventsY, mEventsWidth, mEventsHeight); - + // LocalDc.SetClippingRegion(0, 0, mCanvasWidth, mCanvasHeight); Dc.Blit( mScrolledX, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-06 23:00:41
|
Revision: 430 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=430&view=rev Author: pstieber Date: 2008-04-06 16:00:36 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Updated the include path to the synthesizer dialog. Modified Paths: -------------- trunk/jazz/src/TrackFrame.cpp Modified: trunk/jazz/src/TrackFrame.cpp =================================================================== --- trunk/jazz/src/TrackFrame.cpp 2008-04-06 22:54:03 UTC (rev 429) +++ trunk/jazz/src/TrackFrame.cpp 2008-04-06 23:00:36 UTC (rev 430) @@ -36,7 +36,7 @@ #include "Configuration.h" #include "Harmony.h" #include "Dialogs/MetronomeSettingsDialog.h" -#include "SynthesizerSettingsDialog.h" +#include "Dialogs/SynthesizerSettingsDialog.h" #include "AboutDialog.h" // These are the tool bar icons. 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:54:06
|
Revision: 429 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=429&view=rev Author: pstieber Date: 2008-04-06 15:54:03 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Moved the synthesizer dialog under the Dialogs directory and adjusted the builds accordingly. Modified Paths: -------------- trunk/jazz/src/Makefile.am trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj Added Paths: ----------- trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.cpp trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.h Removed Paths: ------------- trunk/jazz/src/SynthesizerSettingsDialog.cpp trunk/jazz/src/SynthesizerSettingsDialog.h Copied: trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.cpp (from rev 427, trunk/jazz/src/SynthesizerSettingsDialog.cpp) =================================================================== --- trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.cpp (rev 0) +++ trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.cpp 2008-04-06 22:54:03 UTC (rev 429) @@ -0,0 +1,166 @@ +//***************************************************************************** +// 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 "SynthesizerSettingsDialog.h" +#include "../Configuration.h" +#include "../Globals.h" + +using namespace std; + +//***************************************************************************** +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +BEGIN_EVENT_TABLE(JZSynthesizerDialog, wxDialog) + + EVT_BUTTON(wxID_HELP, JZSynthesizerDialog::OnHelp) + +END_EVENT_TABLE() + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZSynthesizerDialog::JZSynthesizerDialog(wxWindow* pParent) + : wxDialog(pParent, wxID_ANY, wxString("Synthesizer Settings")), + mpSynthesizerListbox(0), + mpStartListbox(0) +{ + mpSynthesizerListbox = new wxListBox(this, wxID_ANY); + + for ( + vector<pair<string, int> >::const_iterator iPair = + gSynthesizerTypes.begin(); + iPair != gSynthesizerTypes.end(); + ++iPair) + { + mpSynthesizerListbox->Append(iPair->first.c_str()); + } + + mpStartListbox = new wxListBox(this, wxID_ANY); + + mpStartListbox->Append("Never"); + mpStartListbox->Append("Song Start"); + mpStartListbox->Append("Start Play"); + + 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); + wxBoxSizer* pListControlSizer = new wxBoxSizer(wxHORIZONTAL); + wxBoxSizer* pButtonSizer = new wxBoxSizer(wxHORIZONTAL); + + wxBoxSizer* pLeftSizer = new wxBoxSizer(wxVERTICAL); + wxBoxSizer* pRightSizer = new wxBoxSizer(wxVERTICAL); + + pLeftSizer->Add( + new wxStaticText(this, wxID_ANY, "Synthesizer Type"), + 0, + wxALL, + 2); + pLeftSizer->Add(mpSynthesizerListbox, 0, wxGROW | wxALL, 2); + + pRightSizer->Add( + new wxStaticText(this, wxID_ANY, "Send MIDI Reset"), + 0, + wxALL, + 2); + pRightSizer->Add(mpStartListbox, 0, wxALL, 2); + + pListControlSizer->Add(pLeftSizer, 0, wxALL, 3); + pListControlSizer->Add(pRightSizer, 0, wxALL, 3); + + pTopSizer->Add(pListControlSizer, 0, wxCENTER); + + 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 JZSynthesizerDialog::TransferDataToWindow() +{ + int Selection(0), Index(0); + for ( + vector<pair<string, int> >::const_iterator iPair = + gSynthesizerTypes.begin(); + iPair != gSynthesizerTypes.end(); + ++iPair, ++Index) + { + if (strcmp(iPair->first.c_str(), gpConfig->StrValue(C_SynthType)) == 0) + { + mOldSynthTypeName = iPair->first; + Selection = Index; + } + } + mpSynthesizerListbox->SetSelection(Selection); + + mpStartListbox->SetSelection(gpConfig->GetValue(C_SendSynthReset)); + + return true; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool JZSynthesizerDialog::TransferDataFromWindow() +{ + string SynthTypeName(mOldSynthTypeName); + wxString SelectionString = mpSynthesizerListbox->GetStringSelection(); + if (!SelectionString.empty()) + { + SynthTypeName = SelectionString; + } + + int Selection = mpStartListbox->GetSelection(); + if (Selection != wxNOT_FOUND) + { + gpConfig->Put(C_SendSynthReset, Selection); + } + + if (mOldSynthTypeName != SynthTypeName) + { + gpConfig->Put(C_SynthType, SynthTypeName.c_str()); + + ::wxMessageBox( + "Restart jazz for the synthesizer type change to take effect", + "Info", + wxOK); + } + + return true; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZSynthesizerDialog::OnHelp(wxCommandEvent& Event) +{ +// gpHelpInstance->ShowTopic("Synthesizer Type Settings"); +} Copied: trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.h (from rev 427, trunk/jazz/src/SynthesizerSettingsDialog.h) =================================================================== --- trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.h (rev 0) +++ trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.h 2008-04-06 22:54:03 UTC (rev 429) @@ -0,0 +1,53 @@ +//***************************************************************************** +// 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_SYNTHESIZERSETTINGDIALOG_H +#define JZ_SYNTHESIZERSETTINGDIALOG_H + +#include <string> + +//***************************************************************************** +//***************************************************************************** +class JZSynthesizerDialog : public wxDialog +{ + public: + + JZSynthesizerDialog(wxWindow* pParent); + + private: + + virtual bool TransferDataToWindow(); + + virtual bool TransferDataFromWindow(); + + void OnHelp(wxCommandEvent& Event); + + private: + + std::string mOldSynthTypeName; + + wxListBox* mpSynthesizerListbox; + + wxListBox* mpStartListbox; + + DECLARE_EVENT_TABLE(); +}; + +#endif // !defined(JZ_SYNTHESIZERSETTINGDIALOG_H) Modified: trunk/jazz/src/Makefile.am =================================================================== --- trunk/jazz/src/Makefile.am 2008-04-06 22:49:11 UTC (rev 428) +++ trunk/jazz/src/Makefile.am 2008-04-06 22:54:03 UTC (rev 429) @@ -19,6 +19,7 @@ DeprecatedWx/propform.cpp \ DeprecatedWx/proplist.cpp \ Dialogs/MetronomeSettingsDialog.cpp \ +Dialogs/SynthesizerSettingsDialog.cpp \ Dialogs.cpp \ DynamicArray.cpp \ ErrorMessage.cpp \ @@ -71,7 +72,6 @@ StandardFile.cpp \ StringReadWrite.cpp \ Synth.cpp \ -SynthesizerSettingsDialog.cpp \ ToolBar.cpp \ Track.cpp \ TrackFrame.cpp \ @@ -94,6 +94,7 @@ DeprecatedWx/proplist.h \ DeprecatedStringUtils.h \ Dialogs/MetronomeSettingsDialog.cpp \ +Dialogs/SynthesizerSettingsDialog.h \ Dialogs.h \ DynamicArray.h \ ErrorMessage.h \ @@ -148,7 +149,6 @@ StandardFile.h \ StringReadWrite.h \ Synth.h \ -SynthesizerSettingsDialog.h \ ToolBar.h \ TrackFrame.h \ Track.h \ Deleted: trunk/jazz/src/SynthesizerSettingsDialog.cpp =================================================================== --- trunk/jazz/src/SynthesizerSettingsDialog.cpp 2008-04-06 22:49:11 UTC (rev 428) +++ trunk/jazz/src/SynthesizerSettingsDialog.cpp 2008-04-06 22:54:03 UTC (rev 429) @@ -1,166 +0,0 @@ -//***************************************************************************** -// 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 "SynthesizerSettingsDialog.h" -#include "Configuration.h" -#include "Globals.h" - -using namespace std; - -//***************************************************************************** -//***************************************************************************** -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(JZSynthesizerDialog, wxDialog) - - EVT_BUTTON(wxID_HELP, JZSynthesizerDialog::OnHelp) - -END_EVENT_TABLE() - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -JZSynthesizerDialog::JZSynthesizerDialog(wxWindow* pParent) - : wxDialog(pParent, wxID_ANY, wxString("Synthesizer Settings")), - mpSynthesizerListbox(0), - mpStartListbox(0) -{ - mpSynthesizerListbox = new wxListBox(this, wxID_ANY); - - for ( - vector<pair<string, int> >::const_iterator iPair = - gSynthesizerTypes.begin(); - iPair != gSynthesizerTypes.end(); - ++iPair) - { - mpSynthesizerListbox->Append(iPair->first.c_str()); - } - - mpStartListbox = new wxListBox(this, wxID_ANY); - - mpStartListbox->Append("Never"); - mpStartListbox->Append("Song Start"); - mpStartListbox->Append("Start Play"); - - 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); - wxBoxSizer* pListControlSizer = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* pButtonSizer = new wxBoxSizer(wxHORIZONTAL); - - wxBoxSizer* pLeftSizer = new wxBoxSizer(wxVERTICAL); - wxBoxSizer* pRightSizer = new wxBoxSizer(wxVERTICAL); - - pLeftSizer->Add( - new wxStaticText(this, wxID_ANY, "Synthesizer Type"), - 0, - wxALL, - 2); - pLeftSizer->Add(mpSynthesizerListbox, 0, wxGROW | wxALL, 2); - - pRightSizer->Add( - new wxStaticText(this, wxID_ANY, "Send MIDI Reset"), - 0, - wxALL, - 2); - pRightSizer->Add(mpStartListbox, 0, wxALL, 2); - - pListControlSizer->Add(pLeftSizer, 0, wxALL, 3); - pListControlSizer->Add(pRightSizer, 0, wxALL, 3); - - pTopSizer->Add(pListControlSizer, 0, wxCENTER); - - 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 JZSynthesizerDialog::TransferDataToWindow() -{ - int Selection(0), Index(0); - for ( - vector<pair<string, int> >::const_iterator iPair = - gSynthesizerTypes.begin(); - iPair != gSynthesizerTypes.end(); - ++iPair, ++Index) - { - if (strcmp(iPair->first.c_str(), gpConfig->StrValue(C_SynthType)) == 0) - { - mOldSynthTypeName = iPair->first; - Selection = Index; - } - } - mpSynthesizerListbox->SetSelection(Selection); - - mpStartListbox->SetSelection(gpConfig->GetValue(C_SendSynthReset)); - - return true; -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -bool JZSynthesizerDialog::TransferDataFromWindow() -{ - string SynthTypeName(mOldSynthTypeName); - wxString SelectionString = mpSynthesizerListbox->GetStringSelection(); - if (!SelectionString.empty()) - { - SynthTypeName = SelectionString; - } - - int Selection = mpStartListbox->GetSelection(); - if (Selection != wxNOT_FOUND) - { - gpConfig->Put(C_SendSynthReset, Selection); - } - - if (mOldSynthTypeName != SynthTypeName) - { - gpConfig->Put(C_SynthType, SynthTypeName.c_str()); - - ::wxMessageBox( - "Restart jazz for the synthesizer type change to take effect", - "Info", - wxOK); - } - - return true; -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -void JZSynthesizerDialog::OnHelp(wxCommandEvent& Event) -{ -// gpHelpInstance->ShowTopic("Synthesizer Type Settings"); -} Deleted: trunk/jazz/src/SynthesizerSettingsDialog.h =================================================================== --- trunk/jazz/src/SynthesizerSettingsDialog.h 2008-04-06 22:49:11 UTC (rev 428) +++ trunk/jazz/src/SynthesizerSettingsDialog.h 2008-04-06 22:54:03 UTC (rev 429) @@ -1,53 +0,0 @@ -//***************************************************************************** -// 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_SYNTHESIZERSETTINGDIALOG_H -#define JZ_SYNTHESIZERSETTINGDIALOG_H - -#include <string> - -//***************************************************************************** -//***************************************************************************** -class JZSynthesizerDialog : public wxDialog -{ - public: - - JZSynthesizerDialog(wxWindow* pParent); - - private: - - virtual bool TransferDataToWindow(); - - virtual bool TransferDataFromWindow(); - - void OnHelp(wxCommandEvent& Event); - - private: - - std::string mOldSynthTypeName; - - wxListBox* mpSynthesizerListbox; - - wxListBox* mpStartListbox; - - DECLARE_EVENT_TABLE(); -}; - -#endif // !defined(JZ_SYNTHESIZERSETTINGDIALOG_H) Modified: trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj =================================================================== --- trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj 2008-04-06 22:49:11 UTC (rev 428) +++ trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj 2008-04-06 22:54:03 UTC (rev 429) @@ -733,14 +733,6 @@ > </File> <File - RelativePath="..\src\SynthesizerSettingsDialog.cpp" - > - </File> - <File - RelativePath="..\src\SynthesizerSettingsDialog.h" - > - </File> - <File RelativePath="..\src\ToolBar.cpp" > </File> @@ -829,6 +821,14 @@ RelativePath="..\src\Dialogs\MetronomeSettingsDialog.h" > </File> + <File + RelativePath="..\src\Dialogs\SynthesizerSettingsDialog.cpp" + > + </File> + <File + RelativePath="..\src\Dialogs\SynthesizerSettingsDialog.h" + > + </File> </Filter> </Files> <Globals> Modified: trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj =================================================================== --- trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj 2008-04-06 22:49:11 UTC (rev 428) +++ trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj 2008-04-06 22:54:03 UTC (rev 429) @@ -732,14 +732,6 @@ > </File> <File - RelativePath="..\src\SynthesizerSettingsDialog.cpp" - > - </File> - <File - RelativePath="..\src\SynthesizerSettingsDialog.h" - > - </File> - <File RelativePath="..\src\ToolBar.cpp" > </File> @@ -828,6 +820,14 @@ RelativePath="..\src\Dialogs\MetronomeSettingsDialog.h" > </File> + <File + RelativePath="..\src\Dialogs\SynthesizerSettingsDialog.cpp" + > + </File> + <File + RelativePath="..\src\Dialogs\SynthesizerSettingsDialog.h" + > + </File> </Filter> </Files> <Globals> 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-06 22:47:56
|
Revision: 427 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=427&view=rev Author: pstieber Date: 2008-04-06 15:47:54 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Changed to record settings. Modified Paths: -------------- trunk/jazz/src/SynthesizerSettingsDialog.cpp trunk/jazz/src/SynthesizerSettingsDialog.h Modified: trunk/jazz/src/SynthesizerSettingsDialog.cpp =================================================================== --- trunk/jazz/src/SynthesizerSettingsDialog.cpp 2008-04-06 22:47:03 UTC (rev 426) +++ trunk/jazz/src/SynthesizerSettingsDialog.cpp 2008-04-06 22:47:54 UTC (rev 427) @@ -30,6 +30,14 @@ //***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +BEGIN_EVENT_TABLE(JZSynthesizerDialog, wxDialog) + + EVT_BUTTON(wxID_HELP, JZSynthesizerDialog::OnHelp) + +END_EVENT_TABLE() + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- JZSynthesizerDialog::JZSynthesizerDialog(wxWindow* pParent) : wxDialog(pParent, wxID_ANY, wxString("Synthesizer Settings")), mpSynthesizerListbox(0), @@ -37,20 +45,14 @@ { mpSynthesizerListbox = new wxListBox(this, wxID_ANY); - int Selection = 0; - int Index = 0; for ( - vector<pair<string, int> >::const_iterator iPair = gSynthesizerTypes.begin(); + vector<pair<string, int> >::const_iterator iPair = + gSynthesizerTypes.begin(); iPair != gSynthesizerTypes.end(); - ++iPair, ++Index) + ++iPair) { mpSynthesizerListbox->Append(iPair->first.c_str()); - if (strcmp(iPair->first.c_str(), gpConfig->StrValue(C_SynthType)) == 0) - { - Selection = Index; - } } - mpSynthesizerListbox->SetSelection(Selection); mpStartListbox = new wxListBox(this, wxID_ANY); @@ -58,8 +60,6 @@ mpStartListbox->Append("Song Start"); mpStartListbox->Append("Start Play"); - mpStartListbox->SetSelection(gpConfig->GetValue(C_SendSynthReset)); - wxButton* pOkButton = new wxButton(this, wxID_OK, "&OK"); wxButton* pCancelButton = new wxButton(this, wxID_CANCEL, "Cancel"); wxButton* pHelpButton = new wxButton(this, wxID_HELP, "Help"); @@ -103,3 +103,64 @@ pTopSizer->SetSizeHints(this); pTopSizer->Fit(this); } + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool JZSynthesizerDialog::TransferDataToWindow() +{ + int Selection(0), Index(0); + for ( + vector<pair<string, int> >::const_iterator iPair = + gSynthesizerTypes.begin(); + iPair != gSynthesizerTypes.end(); + ++iPair, ++Index) + { + if (strcmp(iPair->first.c_str(), gpConfig->StrValue(C_SynthType)) == 0) + { + mOldSynthTypeName = iPair->first; + Selection = Index; + } + } + mpSynthesizerListbox->SetSelection(Selection); + + mpStartListbox->SetSelection(gpConfig->GetValue(C_SendSynthReset)); + + return true; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool JZSynthesizerDialog::TransferDataFromWindow() +{ + string SynthTypeName(mOldSynthTypeName); + wxString SelectionString = mpSynthesizerListbox->GetStringSelection(); + if (!SelectionString.empty()) + { + SynthTypeName = SelectionString; + } + + int Selection = mpStartListbox->GetSelection(); + if (Selection != wxNOT_FOUND) + { + gpConfig->Put(C_SendSynthReset, Selection); + } + + if (mOldSynthTypeName != SynthTypeName) + { + gpConfig->Put(C_SynthType, SynthTypeName.c_str()); + + ::wxMessageBox( + "Restart jazz for the synthesizer type change to take effect", + "Info", + wxOK); + } + + return true; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZSynthesizerDialog::OnHelp(wxCommandEvent& Event) +{ +// gpHelpInstance->ShowTopic("Synthesizer Type Settings"); +} Modified: trunk/jazz/src/SynthesizerSettingsDialog.h =================================================================== --- trunk/jazz/src/SynthesizerSettingsDialog.h 2008-04-06 22:47:03 UTC (rev 426) +++ trunk/jazz/src/SynthesizerSettingsDialog.h 2008-04-06 22:47:54 UTC (rev 427) @@ -21,6 +21,8 @@ #ifndef JZ_SYNTHESIZERSETTINGDIALOG_H #define JZ_SYNTHESIZERSETTINGDIALOG_H +#include <string> + //***************************************************************************** //***************************************************************************** class JZSynthesizerDialog : public wxDialog @@ -31,9 +33,21 @@ private: + virtual bool TransferDataToWindow(); + + virtual bool TransferDataFromWindow(); + + void OnHelp(wxCommandEvent& Event); + + private: + + std::string mOldSynthTypeName; + wxListBox* mpSynthesizerListbox; wxListBox* mpStartListbox; + + DECLARE_EVENT_TABLE(); }; #endif // !defined(JZ_SYNTHESIZERSETTINGDIALOG_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 22:47:06
|
Revision: 426 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=426&view=rev Author: pstieber Date: 2008-04-06 15:47:03 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Made some cosmetic indentation changes. Modified Paths: -------------- trunk/jazz/src/Configuration.cpp Modified: trunk/jazz/src/Configuration.cpp =================================================================== --- trunk/jazz/src/Configuration.cpp 2008-04-06 22:08:58 UTC (rev 425) +++ trunk/jazz/src/Configuration.cpp 2008-04-06 22:47:03 UTC (rev 426) @@ -183,19 +183,25 @@ Names[C_PartsColumnsMax] = new tConfigEntry(".parts_columns_max", 4); // Draw tracknames on the right too? - Names[C_PartsTracknamesRight] = new tConfigEntry(".parts_tracknames_right", 1); + Names[C_PartsTracknamesRight] = new tConfigEntry( + ".parts_tracknames_right", + 1); // Maximum number of voice names in .jazz Names[C_MaxVoiceNames] = new tConfigEntry(".max_voice_names", 317); // Use two-command bank select? - Names[C_UseTwoCommandBankSelect] = new tConfigEntry(".use_two_command_bank_select", 0); + Names[C_UseTwoCommandBankSelect] = new tConfigEntry( + ".use_two_command_bank_select", + 0); // Metronome settings Names[C_MetroIsAccented] = new tConfigEntry(".metronome_is_accented", 1); Names[C_MetroVelocity] = new tConfigEntry(".metronome_velocity", 127); Names[C_MetroNormalClick] = new tConfigEntry(".metronome_normal_click", 37); - Names[C_MetroAccentedClick] = new tConfigEntry(".metronome_accented_click", 36); + Names[C_MetroAccentedClick] = new tConfigEntry( + ".metronome_accented_click", + 36); // Window geometry settings. Names[C_TrackWinXpos] = new tConfigEntry(".trackwin_xpos", 10); @@ -232,7 +238,7 @@ Names[C_SendSynthReset] = new tConfigEntry(".send_synth_reset", 1); // Current include file - Names[C_Include] = new tConfigEntry(".include",""); + Names[C_Include] = new tConfigEntry(".include", ""); // Entries with empty values Names[C_BankTable] = new tConfigEntry(".bank_table"); @@ -249,8 +255,8 @@ Names[C_ThruInput] = new tConfigEntry(".thru_input", 0); Names[C_ThruOutput] = new tConfigEntry(".thru_output", 0); - //enable/disable welcome - Names[C_EnableWelcome] = new tConfigEntry(".enable_welcome",1); + // Enable/disable splash dialog. + Names[C_EnableWelcome] = new tConfigEntry(".enable_welcome", 1); // Other initialization 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:09:00
|
Revision: 425 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=425&view=rev Author: pstieber Date: 2008-04-06 15:08:58 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Updated the copyright and the web site in case anyone ever builds or looks at this code. Modified Paths: -------------- branches/jazz-4.1.3/src/about.cpp Modified: branches/jazz-4.1.3/src/about.cpp =================================================================== --- branches/jazz-4.1.3/src/about.cpp 2008-04-06 21:13:15 UTC (rev 424) +++ branches/jazz-4.1.3/src/about.cpp 2008-04-06 22:08:58 UTC (rev 425) @@ -27,7 +27,9 @@ Welcome to JAZZ++ version " JAZZ_FULL_VERSION "\n\ \n\ Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved.\n\ +Modifications Copyright (C) 2004 Patrick Earl\n\ +Modifications Copyright (C) 2008 Peter J. Stieber\n\ \n\ -See http://www.jazzware.com for latest information.\n"; +See http://jazzplusplus.sourceforge.net for latest information.\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-06 21:13:17
|
Revision: 424 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=424&view=rev Author: pstieber Date: 2008-04-06 14:13:15 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Added a custom path to FindFile so I can get the old code working on my development machine. Modified Paths: -------------- branches/jazz-4.1.3/src/jazz.cpp Modified: branches/jazz-4.1.3/src/jazz.cpp =================================================================== --- branches/jazz-4.1.3/src/jazz.cpp 2008-04-06 21:12:09 UTC (rev 423) +++ branches/jazz-4.1.3/src/jazz.cpp 2008-04-06 21:13:15 UTC (rev 424) @@ -654,33 +654,42 @@ const char *FindFile(const char *fname) { - static char buf[256]; + static char Buffer[256]; if (wxFileExists((char *)fname)) { return fname; } - char *home; - if ((home = getenv("HOME")) != 0) + char* pPath; + if ((pPath = getenv("HOME")) != 0) { - sprintf(buf, "%s/%s", home, fname); - if (wxFileExists(buf)) - return buf; + sprintf(Buffer, "%s/%s", pPath, fname); + if (wxFileExists(Buffer)) + return Buffer; } - if ((home = getenv("JAZZ")) != 0) + + if ((pPath = getenv("JAZZ")) != 0) { - sprintf(buf, "%s/%s", home, fname); - if (wxFileExists(buf)) - return buf; + sprintf(Buffer, "%s/%s", pPath, fname); + if (wxFileExists(Buffer)) + return Buffer; } // look where the executable was started - home = wxPathOnly((char *)wxTheApp->argv[0]); - sprintf(buf, "%s/%s", home, fname); - if (wxFileExists(buf)) - return buf; + pPath = wxPathOnly((char *)wxTheApp->argv[0]); + sprintf(Buffer, "%s/%s", pPath, fname); + if (wxFileExists(Buffer)) + { + return Buffer; + } + sprintf(Buffer, "/Jazz++/4.1.3/conf/%s", fname); + if (wxFileExists(Buffer)) + { + return Buffer; + } + return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-06 21:12:11
|
Revision: 423 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=423&view=rev Author: pstieber Date: 2008-04-06 14:12:09 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Replaced a tab character with spaces. Modified Paths: -------------- branches/jazz-4.1.3/src/trackwin.cpp Modified: branches/jazz-4.1.3/src/trackwin.cpp =================================================================== --- branches/jazz-4.1.3/src/trackwin.cpp 2008-04-06 21:09:59 UTC (rev 422) +++ branches/jazz-4.1.3/src/trackwin.cpp 2008-04-06 21:12:09 UTC (rev 423) @@ -2442,7 +2442,7 @@ void tMetronomeSettingsDlg::OnHelp() { - HelpInstance->ShowTopic("Metronome Settings"); + HelpInstance->ShowTopic("Metronome Settings"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-04-06 21:10:12
|
Revision: 422 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=422&view=rev Author: pstieber Date: 2008-04-06 14:09:59 -0700 (Sun, 06 Apr 2008) Log Message: ----------- 1. Changed tWinAudioPlayer::OpenDsp() to return 1 if audio is disabled. 2. Made some cosmetic changes. Modified Paths: -------------- branches/jazz-4.1.3/src/winaudio.cpp Modified: branches/jazz-4.1.3/src/winaudio.cpp =================================================================== --- branches/jazz-4.1.3/src/winaudio.cpp 2008-04-06 18:52:27 UTC (rev 421) +++ branches/jazz-4.1.3/src/winaudio.cpp 2008-04-06 21:09:59 UTC (rev 422) @@ -144,8 +144,11 @@ WAVEOUTCAPS ocaps; MMRESULT res = waveOutGetDevCaps((UINT)hout, &ocaps, sizeof(ocaps)); if (res != MMSYSERR_NOERROR) + { error = ErrCapGet; - else if (!(ocaps.dwSupport & WAVECAPS_SAMPLEACCURATE)) { + } + else if (!(ocaps.dwSupport & WAVECAPS_SAMPLEACCURATE)) + { // not a real error wxMessageBox("your soundcard does not support audio/midi sync", "Warning", wxOK); can_sync = 0; @@ -223,7 +226,9 @@ error = NoError; // everything ok for now. if (!audio_enabled) - return 0; + { + return 1; + } can_duplex = (Config(C_DuplexAudio) != 0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |