From: <pst...@us...> - 2008-03-21 05:58:23
|
Revision: 346 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=346&view=rev Author: pstieber Date: 2008-03-20 22:58:22 -0700 (Thu, 20 Mar 2008) Log Message: ----------- Updated some piano window related code. Modified Paths: -------------- trunk/jazz/src/Harmony.cpp Modified: trunk/jazz/src/Harmony.cpp =================================================================== --- trunk/jazz/src/Harmony.cpp 2008-03-21 05:57:34 UTC (rev 345) +++ trunk/jazz/src/Harmony.cpp 2008-03-21 05:58:22 UTC (rev 346) @@ -29,6 +29,7 @@ #include "TrackFrame.h" #include "TrackWindow.h" #include "PianoFrame.h" +#include "PianoWindow.h" #include "GuitarFrame.h" #include "Song.h" #include "Filter.h" @@ -835,7 +836,7 @@ if (cnvs->mark_piano) { - tEventArray &buf = gpTrackFrame->GetPianoWindow()->PasteBuffer; + tEventArray &buf = gpTrackFrame->GetPianoWindow()->mPasteBuffer; for (int i = 0; i < buf.nEvents; i++) { tKeyOn *on = buf.Events[i]->IsKeyOn(); @@ -1011,7 +1012,7 @@ player.StartPlay(context); } - if ((e.LeftDown() || e.MiddleDown()) ) // && context != mouse_context) + if (e.LeftDown() || e.MiddleDown()) // && context != mouse_context) { DrawMarkers(mouse_context, dc); mouse_context = context; @@ -1021,10 +1022,10 @@ // paste to PianoWin buffer if (!mark_piano) { - tEventArray &buf = gpTrackFrame->GetPianoWindow()->PasteBuffer; + tEventArray &buf = gpTrackFrame->GetPianoWindow()->mPasteBuffer; buf.Clear(); player.Paste(buf); - gpTrackFrame->GetPianoWindow()->Redraw(); + gpTrackFrame->GetPianoWindow()->Refresh(); } // Show in GuitarWin 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 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-05-09 19:03:47
|
Revision: 495 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=495&view=rev Author: pstieber Date: 2008-05-09 12:03:45 -0700 (Fri, 09 May 2008) Log Message: ----------- Used a larger font. Modified Paths: -------------- trunk/jazz/src/Harmony.cpp Modified: trunk/jazz/src/Harmony.cpp =================================================================== --- trunk/jazz/src/Harmony.cpp 2008-05-09 19:03:00 UTC (rev 494) +++ trunk/jazz/src/Harmony.cpp 2008-05-09 19:03:45 UTC (rev 495) @@ -841,7 +841,7 @@ wxClientDC Dc(this); - Dc.SetFont(*wxSMALL_FONT); + Dc.SetFont(*wxNORMAL_FONT); int TextWidth, TextHeight; Dc.GetTextExtent("xD#j75+9-x", &TextWidth, &TextHeight); @@ -1091,7 +1091,7 @@ { Dc.Clear(); - Dc.SetFont(*wxSMALL_FONT); + Dc.SetFont(*wxNORMAL_FONT); Dc.DrawText("Seq", 5, 5); @@ -1286,7 +1286,7 @@ DoPrepareDC(Dc); - Dc.SetFont(*wxSMALL_FONT); + Dc.SetFont(*wxNORMAL_FONT); HBContext Context; int x, y; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |