From: <pst...@us...> - 2008-03-21 05:59:25
|
Revision: 347 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=347&view=rev Author: pstieber Date: 2008-03-20 22:59:20 -0700 (Thu, 20 Mar 2008) Log Message: ----------- 1. Updated some piano window related code. 2.ade some cosmetic changes. Modified Paths: -------------- trunk/jazz/src/ControlEdit.cpp trunk/jazz/src/ControlEdit.h Modified: trunk/jazz/src/ControlEdit.cpp =================================================================== --- trunk/jazz/src/ControlEdit.cpp 2008-03-21 05:58:22 UTC (rev 346) +++ trunk/jazz/src/ControlEdit.cpp 2008-03-21 05:59:20 UTC (rev 347) @@ -23,7 +23,7 @@ #include "WxWidgets.h" #include "ControlEdit.h" -#include "PianoFrame.h" +#include "PianoWindow.h" #include "EventWindow.h" #include "Song.h" #include "Track.h" @@ -34,7 +34,7 @@ tCtrlEditBase::tCtrlEditBase( int min, int max, - JZPianoFrame* p, + JZPianoWindow* p, char const *label, int dx, int x, @@ -50,7 +50,7 @@ } void tCtrlEditBase::Create( - JZPianoFrame* p, + JZPianoWindow* pPianoWindow, char const *label, int dx, int x, @@ -59,7 +59,7 @@ int h) { x_off = dx; - parent = p; + mpPianoWindow = pPianoWindow; track = 0; from_clock = 0; to_clock = 1; @@ -67,7 +67,7 @@ clocks_per_pixel = 0; sticky = 1; - panel = new tCtrlPanel(this, (wxWindow*)parent, x, y, dx, h, 0, "Controller Edit"); + panel = new tCtrlPanel(this, mpPianoWindow, x, y, dx, h, 0, "Controller Edit"); //(void) new wxMessage(panel, (char *)label); //panel->NewLine(); @@ -94,7 +94,7 @@ // ab hier dient ctrlmode zur Unterscheidung zwischen // Apply und Edit. - edit = new tArrayEdit((wxFrame *)parent, array, x+dx, y, w - dx, h, 0); + edit = new tArrayEdit((wxFrame *)mpPianoWindow, array, x+dx, y, w - dx, h, 0); edit->SetLabel(label); edit->SetDrawBars(this); @@ -240,7 +240,7 @@ void tCtrlEditBase::OnApply() { wxBeginBusyCursor(); - parent->Song->NewUndoBuffer(); + mpPianoWindow->mpSong->NewUndoBuffer(); // delete old events, but skip clock 0 to preserve track defaults: // (dirty but might work...) tEventIterator iter(track); @@ -314,7 +314,7 @@ OnRevert(); // SN+ Bug Fix Controller in Piano Fenster updaten. - parent->Redraw(); + mpPianoWindow->Refresh(); } // SN++ @@ -360,7 +360,7 @@ // av: called by tArrayEdit::OnPaint void tCtrlEditBase::DrawBars(wxDC* dc) { - JZBarInfo BarInfo(parent->Song); + JZBarInfo BarInfo(mpPianoWindow->mpSong); BarInfo.SetClock(from_clock); long gclk,x; int ii; @@ -370,13 +370,13 @@ while (gclk < to_clock) { gclk = BarInfo.Clock; - x = parent->Clock2x(gclk-from_clock); + x = mpPianoWindow->Clock2x(gclk-from_clock); edit->DrawBarLine(dc, x - x_off); if (bars_state == 2) for (ii = 0; ii < BarInfo.CountsPerBar; ii++) { gclk += BarInfo.TicksPerBar / BarInfo.CountsPerBar; - x = parent->Clock2x(gclk-from_clock); + x = mpPianoWindow->Clock2x(gclk-from_clock); edit->DrawBarLine(dc, x - x_off); } BarInfo.Next(); @@ -388,14 +388,14 @@ // ------------------------------------------------------------------ tPitchEdit::tPitchEdit( - JZPianoFrame* parent, + JZPianoWindow* pPianoWindow, char const *label, int xoff, int x, int y, int w, int h) - : tCtrlEditBase(-8191, 8191, parent, label, xoff, x, y, w, h) + : tCtrlEditBase(-8191, 8191, pPianoWindow, label, xoff, x, y, w, h) { } @@ -423,14 +423,14 @@ tCtrlEdit::tCtrlEdit( int CtrlNum, - JZPianoFrame* parent, + JZPianoWindow* pPianoWindow, char const *label, int xoff, int x, int y, int w, int h) - : tCtrlEditBase(0, 127, parent, label, xoff, x, y, w, h, 1) + : tCtrlEditBase(0, 127, pPianoWindow, label, xoff, x, y, w, h, 1) { ctrl_num = CtrlNum; if (ctrl_num == 10) // panpot @@ -466,14 +466,14 @@ // ------------------------------------------------------------------ tVelocEdit::tVelocEdit( - JZPianoFrame* parent, + JZPianoWindow* pParent, char const *label, int xoff, int x, int y, int w, int h) - : tCtrlEditBase(1, 127, parent, label, xoff, x, y, w, h) + : tCtrlEditBase(1, 127, pParent, label, xoff, x, y, w, h) { sticky = 0; selectable = 1; @@ -488,18 +488,18 @@ { // SN++ Falls im PianoWin Events selektiert sind, werden nur diese // Events geaendert - if (!parent->SnapSel->Selected) + if (!mpPianoWindow->mpSnapSel->Selected) { - return (e->IsKeyOn() != 0); + return (e->IsKeyOn() != 0); } else { if (e->IsKeyOn()) { return ( - parent->mpFilter->IsSelected(e) && - (e->GetClock() >= parent->mpFilter->FromClock && - e->GetClock() <= parent->mpFilter->ToClock)); + mpPianoWindow->GetFilter()->IsSelected(e) && + (e->GetClock() >= mpPianoWindow->GetFilter()->FromClock && + e->GetClock() <= mpPianoWindow->GetFilter()->ToClock)); } } return 0; @@ -515,13 +515,14 @@ static long from_clk, to_clk; wxBeginBusyCursor(); - parent->Song->NewUndoBuffer(); + mpPianoWindow->mpSong->NewUndoBuffer(); tEventIterator iter(track); - if (parent->SnapSel->Selected) { - from_clk = parent->mpFilter->FromClock; - to_clk = parent->mpFilter->ToClock; + if (mpPianoWindow->mpSnapSel->Selected) + { + from_clk = mpPianoWindow->GetFilter()->FromClock; + to_clk = mpPianoWindow->GetFilter()->ToClock; } else { from_clk = from_clock; to_clk = to_clock; @@ -532,7 +533,7 @@ while (e) { // SN++ Falls im PianoWin Events selektiert sind, werden nur diese // Events geaendert - if (!parent->SnapSel->Selected || parent->mpFilter->IsSelected(e) ) + if (!mpPianoWindow->mpSnapSel->Selected || mpPianoWindow->GetFilter()->IsSelected(e) ) { tKeyOn *k = e->IsKeyOn(); @@ -551,14 +552,22 @@ track->Cleanup(); wxEndBusyCursor(); OnRevert(); + // SN+ for Color Darstellung - parent->Redraw(); + mpPianoWindow->Refresh(); } // ------------------------------------------------------------------ -tPolyAfterEdit::tPolyAfterEdit(JZPianoFrame* parent, char const *label, int xoff, int x, int y, int w, int h) - : tCtrlEditBase(0, 127, parent, label, xoff, x, y, w, h, 1) +tPolyAfterEdit::tPolyAfterEdit( + JZPianoWindow* pPianoWindow, + char const *label, + int xoff, + int x, + int y, + int w, + int h) + : tCtrlEditBase(0, 127, pPianoWindow, label, xoff, x, y, w, h, 1) { sticky = 0; // SN must be set for proper editing! selectable = 1; @@ -575,15 +584,15 @@ // SN++ Falls im PianoWin Events selektiert sind, werden nur diese // Events geaendert - if (!parent->SnapSel->Selected) + if (!mpPianoWindow->mpSnapSel->Selected) return e->IsKeyPressure() != 0; else if (e->IsKeyPressure()) { return ( - parent->mpFilter->IsSelected(e) && - (e->GetClock() >= parent->mpFilter->FromClock && - e->GetClock() <= parent->mpFilter->ToClock)); + mpPianoWindow->GetFilter()->IsSelected(e) && + (e->GetClock() >= mpPianoWindow->GetFilter()->FromClock && + e->GetClock() <= mpPianoWindow->GetFilter()->ToClock)); } return 0; } @@ -602,20 +611,24 @@ JZEvent *e; // SN++ Apply works only if some events are selected !! - if (!parent->SnapSel->Selected) { + if (!mpPianoWindow->mpSnapSel->Selected) + { OnRevert(); return; } wxBeginBusyCursor(); - parent->Song->NewUndoBuffer(); + mpPianoWindow->mpSong->NewUndoBuffer(); tEventIterator iter(track); - if (parent->SnapSel->Selected) { - from_clk = parent->mpFilter->FromClock; - to_clk = parent->mpFilter->ToClock; - } else { + if (mpPianoWindow->mpSnapSel->Selected) + { + from_clk = mpPianoWindow->GetFilter()->FromClock; + to_clk = mpPianoWindow->GetFilter()->ToClock; + } + else + { from_clk = from_clock; to_clk = to_clock; } @@ -626,7 +639,7 @@ // SN++ Alle selektierten AfterTouch events loeschen e = iter.Range(from_clk, to_clk); while (e) { - if (!parent->SnapSel->Selected || parent->mpFilter->IsSelected(e) ) + if (!mpPianoWindow->mpSnapSel->Selected || mpPianoWindow->GetFilter()->IsSelected(e) ) { k = e->IsKeyPressure(); if (k) @@ -644,7 +657,7 @@ e = iter.Range(from_clk, to_clk); while (e) { - if (!parent->SnapSel->Selected || parent->mpFilter->IsSelected(e) ) + if (!mpPianoWindow->mpSnapSel->Selected || mpPianoWindow->GetFilter()->IsSelected(e) ) { keyon = e->IsKeyOn(); if (keyon) @@ -686,7 +699,7 @@ tKeyPressure *cpy; while (e) { - if (!parent->SnapSel->Selected || parent->mpFilter->IsSelected(e)) + if (!mpPianoWindow->mpSnapSel->Selected || mpPianoWindow->GetFilter()->IsSelected(e)) { if(e->IsKeyPressure()) { @@ -707,20 +720,20 @@ wxEndBusyCursor(); OnRevert(); // SN+ for Color Darstellung - parent->Redraw(); + mpPianoWindow->Refresh(); } // ---------------------------------------------------------------------- tChannelAfterEdit::tChannelAfterEdit( - JZPianoFrame* parent, + JZPianoWindow* pPianoWindow, char const *label, int xoff, int x, int y, int w, int h) - : tCtrlEditBase(0, 127, parent, label, xoff, x, y, w, h, 1) + : tCtrlEditBase(0, 127, pPianoWindow, label, xoff, x, y, w, h, 1) { } @@ -755,7 +768,7 @@ void tChannelAfterEdit::OnApply() { wxBeginBusyCursor(); - parent->Song->NewUndoBuffer(); + mpPianoWindow->mpSong->NewUndoBuffer(); // delete old events, but skip clock 0 to preserve track defaults: // (dirty but might work...) @@ -839,14 +852,14 @@ tTempoEdit::tTempoEdit( int min, int max, - JZPianoFrame* parent, + JZPianoWindow* pPianoWindow, char const *label, int xoff, int x, int y, int w, int h) - : tCtrlEditBase(min, max, parent, label, xoff, x, y, w, h) + : tCtrlEditBase(min, max, pPianoWindow, label, xoff, x, y, w, h) { } Modified: trunk/jazz/src/ControlEdit.h =================================================================== --- trunk/jazz/src/ControlEdit.h 2008-03-21 05:58:22 UTC (rev 346) +++ trunk/jazz/src/ControlEdit.h 2008-03-21 05:59:20 UTC (rev 347) @@ -25,7 +25,7 @@ #include "Random.h" -class JZPianoFrame; +class JZPianoWindow; class JZTrack; class JZEvent; class tCtrlEditBase; @@ -36,10 +36,16 @@ { public: friend class tCtrlEditBase; - tCtrlPanel(tCtrlEditBase *e, wxWindow *parent, - int x=-1, int y=-1, int width=-1, int height=-1, long style=0, - char *name = "panel") - : wxPanel(parent, x, y, width, height, style, name) + tCtrlPanel( + tCtrlEditBase* e, + wxWindow* pParent, + int x=-1, + int y=-1, + int width=-1, + int height=-1, + long style=0, + char *name = "panel") + : wxPanel(pParent, x, y, width, height, style, name) { edit = e; } @@ -52,23 +58,42 @@ class tCtrlEditBase : public tArrayEditDrawBars { public: - tCtrlEditBase(int min, int max, JZPianoFrame *parent, char const *label, int xoff, int x, int y, int w, int h, int mode=0); + + tCtrlEditBase( + int min, + int max, + JZPianoWindow* pPianoWindow, + char const *label, + int xoff, + int x, + int y, + int w, + int h, + int mode = 0); + virtual ~tCtrlEditBase(); + void SetSize(int xoff, int x, int y, int w, int h); + void ReInit(JZTrack *track, long FromClock, long ClocksPerPixel); // SN++ Default = 0, 1 bedeutet der Editor arbeitet auch auf Selektionen. // Dieser Patch zusammen mit dem "selectable Patch" im PianoWin // ist for VelocEdit und AftertouchEdit Updates. int selectable; + virtual void UpDate(); -// + protected: + virtual int Missing() = 0; + virtual int IsCtrlEdit(JZEvent *e) = 0; - virtual int GetValue(JZEvent *e) = 0; - virtual JZEvent * NewEvent(long clock, int val) { return 0; } + virtual int GetValue(JZEvent *e) = 0; + + virtual JZEvent* NewEvent(long clock, int val) { return 0; } + virtual void OnApply(); virtual void OnRevert(); virtual void OnEdit(); @@ -90,12 +115,12 @@ JZRndArray array; tArrayEdit* edit; - JZPianoFrame* parent; + JZPianoWindow* mpPianoWindow; tCtrlPanel* panel; private: - void Create(JZPianoFrame* p, char const *label, int dx, int x, int y, int w, int h); + void Create(JZPianoWindow* p, char const *label, int dx, int x, int y, int w, int h); static void Apply(wxButton &but, wxCommandEvent& event); static void Revert(wxButton &but, wxCommandEvent& event); @@ -108,7 +133,7 @@ class tPitchEdit : public tCtrlEditBase { public: - tPitchEdit(JZPianoFrame* parent, char const *label, int xoff, int x, int y, int w, int h); + tPitchEdit(JZPianoWindow* pPianoWindow, char const *label, int xoff, int x, int y, int w, int h); protected: virtual int Missing(); virtual int IsCtrlEdit(JZEvent *e); @@ -120,7 +145,7 @@ class tPolyAfterEdit : public tCtrlEditBase { public: - tPolyAfterEdit(JZPianoFrame* parent, char const *label, int xoff, int x, int y, int w, int h); + tPolyAfterEdit(JZPianoWindow* pPianoWindow, char const *label, int xoff, int x, int y, int w, int h); protected: virtual int Missing(); virtual int IsCtrlEdit(JZEvent *e); @@ -132,7 +157,7 @@ class tChannelAfterEdit : public tCtrlEditBase { public: - tChannelAfterEdit(JZPianoFrame* parent, char const *label, int xoff, int x, int y, int w, int h); + tChannelAfterEdit(JZPianoWindow* pPianoWindow, char const *label, int xoff, int x, int y, int w, int h); protected: virtual int Missing(); virtual int IsCtrlEdit(JZEvent *e); @@ -145,7 +170,7 @@ class tCtrlEdit : public tCtrlEditBase { public: - tCtrlEdit(int CtrlNum, JZPianoFrame* parent, char const *label, int xoff, int x, int y, int w, int h); + tCtrlEdit(int CtrlNum, JZPianoWindow* pPianoWindow, char const *label, int xoff, int x, int y, int w, int h); protected: virtual int Missing(); virtual int IsCtrlEdit(JZEvent *e); @@ -160,7 +185,7 @@ public: tVelocEdit( - JZPianoFrame* parent, + JZPianoWindow* pPianoWindow, char const* label, int xoff, int x, @@ -183,7 +208,7 @@ tTempoEdit( int min, int max, - JZPianoFrame* parent, + JZPianoWindow* pPianoWindow, char const *label, int xoff, int x, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |