From: <pst...@us...> - 2008-03-17 05:16:25
|
Revision: 325 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=325&view=rev Author: pstieber Date: 2008-03-16 22:16:19 -0700 (Sun, 16 Mar 2008) Log Message: ----------- Added variables to convert between radians and degrees. Modified Paths: -------------- trunk/jazz/src/Globals.cpp trunk/jazz/src/Globals.h Modified: trunk/jazz/src/Globals.cpp =================================================================== --- trunk/jazz/src/Globals.cpp 2008-03-17 03:47:42 UTC (rev 324) +++ trunk/jazz/src/Globals.cpp 2008-03-17 05:16:19 UTC (rev 325) @@ -66,3 +66,6 @@ JZTrackWindow* gpTrackWindow = 0; tHBInterface* gpHarmonyBrowser = 0; + +const double gDegreesToRadians = 0.01745329251994330212; +const double gRadiansToDegrees = 57.2957795130823; Modified: trunk/jazz/src/Globals.h =================================================================== --- trunk/jazz/src/Globals.h 2008-03-17 03:47:42 UTC (rev 324) +++ trunk/jazz/src/Globals.h 2008-03-17 05:16:19 UTC (rev 325) @@ -63,5 +63,7 @@ extern JZTrackFrame* gpTrackFrame; extern JZTrackWindow* gpTrackWindow; extern tHBInterface* gpHarmonyBrowser; +extern const double gDegreesToRadians; +extern const double gRadiansToDegrees; #endif // !defined(JZ_GLOBALS_H) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-17 06:25:49
|
Revision: 327 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=327&view=rev Author: pstieber Date: 2008-03-16 23:25:43 -0700 (Sun, 16 Mar 2008) Log Message: ----------- 1. Added a bitmap to the track window to decrease flicker. This required a rework of the coordinates. Scrolling still isn't totally correct. This is a WIP. 2. Changed the way track storage was handled. 3. Changed some variable names to match my convention. Modified Paths: -------------- trunk/jazz/src/EventWindow.cpp trunk/jazz/src/EventWindow.h trunk/jazz/src/MouseAction.cpp trunk/jazz/src/PianoFrame.cpp trunk/jazz/src/PianoFrame.h trunk/jazz/src/PianoWindow.cpp trunk/jazz/src/Song.cpp trunk/jazz/src/Song.h trunk/jazz/src/SynthesizerSettingsDialog.cpp trunk/jazz/src/TrackFrame.cpp trunk/jazz/src/TrackWindow.cpp trunk/jazz/src/TrackWindow.h Modified: trunk/jazz/src/EventWindow.cpp =================================================================== --- trunk/jazz/src/EventWindow.cpp 2008-03-17 06:22:14 UTC (rev 326) +++ trunk/jazz/src/EventWindow.cpp 2008-03-17 06:25:43 UTC (rev 327) @@ -123,14 +123,10 @@ //void tCanvas::SetScrollRanges() //{ -// int w, h; -// EventWin->GetVirtSize(&w, &h); -// SetScrollbars(ScLine, ScLine, w/ScLine, h/ScLine, ScPage, ScPage); -//#ifdef wx_xt -// EnableScrolling(TRUE, TRUE); -//#else -// EnableScrolling(FALSE, FALSE); -//#endif +// int Width, Height; +// EventWin->GetVirtualEventSize(Width, Height); +// SetScrollbars(ScLine, ScLine, Width / ScLine, Height / ScLine); +// EnableScrolling(false, false); //} //void tCanvas::SetScrollPosition(int x, int y) @@ -161,16 +157,16 @@ mpFixedFont(0), hFixedFont(0), LittleBit(1), - hLine(0), - hTop(40), - wLeft(100), + mTrackHeight(0), + mTopInfoHeight(40), + mLeftInfoWidth(100), FontSize(12), ClocksPerPixel(36), UseColors(true), - xEvents(wLeft), - yEvents(hTop), - wEvents(0), - hEvents(0), + mEventsX(mLeftInfoWidth), + mEventsY(mTopInfoHeight), + mEventsWidth(0), + mEventsHeight(0), CanvasX(0), CanvasY(0), CanvasW(0), @@ -242,7 +238,7 @@ //void JZEventFrame::CreateCanvas() //{ // cout << "createcanvas\n"; -// int w, h; +// int w, h; // GetClientSize(&w, &h); // Canvas = new tCanvas(this, 0, 0, w, h); //} @@ -288,7 +284,7 @@ LittleBit = (int)(x/2); dc->GetTextExtent("HXWjgi", &x, &y); - hLine = (int)y + LittleBit; + mTrackHeight = (int)y + LittleBit; delete dc; */ } @@ -298,12 +294,10 @@ 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)//int w, int h) - { - // wxFrame::OnSize(event); +void JZEventFrame::OnSize(wxSizeEvent& Event) +{ + // wxFrame::OnSize(Event); - - //the below code is from the toolbar sample, the layoutchidlren function wxSize size = GetClientSize(); @@ -353,13 +347,13 @@ int JZEventFrame::x2Clock(int x) { - return (x - xEvents) * ClocksPerPixel + FromClock; + return (x - mEventsX) * ClocksPerPixel + FromClock; } int JZEventFrame::Clock2x(int clk) { - return xEvents + (clk - FromClock) / ClocksPerPixel; + return mEventsX + (clk - FromClock) / ClocksPerPixel; } int JZEventFrame::x2BarClock(int x, int next) @@ -378,32 +372,36 @@ int JZEventFrame::y2yLine(int y, int up) { if (up) - y += hLine; - y -= hTop; - y -= y % hLine; - y += hTop; + { + y += mTrackHeight; + } + y -= mTopInfoHeight; + y -= y % mTrackHeight; + y += mTopInfoHeight; return y; } int JZEventFrame::y2Line(int y, int up) { if (up) - y += hLine; - y -= hTop; - return y / hLine; + { + y += mTrackHeight; + } + y -= mTopInfoHeight; + return y / mTrackHeight; } int JZEventFrame::Line2y(int Line) { - return Line * hLine + hTop; + return Line * mTrackHeight + mTopInfoHeight; } void JZEventFrame::LineText(wxDC *dc, int x, int y, int w, const char *str, int h, bool down) { if (h <= 0) { - h = hLine; + h = mTrackHeight; y = y2yLine(y); } if (w && h) @@ -490,14 +488,13 @@ CanvasW = xc; CanvasH = yc; - xEvents = CanvasX + wLeft; - yEvents = CanvasY + hTop; - wEvents = CanvasW - wLeft; - hEvents = CanvasH - hTop; - //printf("EventWin::OnPaint: xe %ld, ye %ld, we %ld, he %ld\n", xEvents, yEvents, wEvents, hEvents); + mEventsX = CanvasX + mLeftInfoWidth; + mEventsY = CanvasY + mTopInfoHeight; + mEventsWidth = CanvasW - mLeftInfoWidth; + mEventsHeight = CanvasH - mTopInfoHeight; - FromLine = CanvasY / hLine; - ToLine = (CanvasY + CanvasH - hTop) / hLine; + FromLine = CanvasY / mTrackHeight; + ToLine = (CanvasY + CanvasH - mTopInfoHeight) / mTrackHeight; FromClock = CanvasX * ClocksPerPixel; ToClock = x2Clock(CanvasX + CanvasW); } @@ -522,7 +519,7 @@ int x; int y; e.GetPosition(&x, &y); - if (xEvents < x && x < xEvents + wEvents && yEvents < y && y < yEvents + hEvents) + if (mEventsX < x && x < mEventsX + mEventsWidth && mEventsY < y && y < mEventsY + mEventsHeight) { if (e.LeftDown()) { @@ -582,14 +579,13 @@ { } -void JZEventFrame::GetVirtSize(int *w, int *h) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::GetVirtualEventSize(int& Width, int& Height) { - int clk = Song->MaxQuarters * Song->TicksPerQuarter; - *w = clk / ClocksPerPixel + wLeft; - *h = 127 * hLine + hTop; - - - *w = 5000L; + int TotalClockTics = Song->MaxQuarters * Song->TicksPerQuarter; + Width = TotalClockTics / ClocksPerPixel + mLeftInfoWidth; + Height = 127 * mTrackHeight + mTopInfoHeight; } //----------------------------------------------------------------------------- @@ -608,7 +604,7 @@ if (Clock > FromClock && ToClock >= Song->MaxQuarters * Song->TicksPerQuarter) return; // int x = Clock2x(Clock); -// Canvas->SetScrollPosition(x - wLeft, CanvasY); +// Canvas->SetScrollPosition(x - mLeftInfoWidth, CanvasY); } if (!SnapSel->Active) // sets clipping @@ -641,22 +637,24 @@ /** draw the "play position", by placing a vertical line where the "play clock" is */ void JZEventFrame::DrawPlayPosition(wxDC* dc) { - if (!SnapSel->Active && PlayClock >= FromClock && PlayClock < ToClock) - { - // wxDC* dc=new wxClientDC(this); - // dc->SetLogicalFunction(wxXOR); + if (!SnapSel->Active && PlayClock >= FromClock && PlayClock < ToClock) + { +// wxDC* dc = new wxClientDC(this); +// dc->SetLogicalFunction(wxXOR); dc->SetBrush(*wxBLACK_BRUSH); dc->SetPen(*wxBLACK_PEN); int x = Clock2x(PlayClock); //cout<<"JZEventFrame::DrawPlayPosition play pos x "<<x<<" "<<FromClock<<" "<<ToClock<<endl; - //dc->DrawRectangle(x, CanvasY, 2*LittleBit, hTop); - dc->DrawLine(x, CanvasY,x, yEvents+hEvents); //draw a line, 2 pixwels wide - dc->DrawLine(x+1,CanvasY,x+1,yEvents+hEvents); + //dc->DrawRectangle(x, CanvasY, 2*LittleBit, mTopInfoHeight); + dc->DrawLine(x, CanvasY, x, mEventsY + mEventsHeight); //draw a line, 2 pixwels wide + dc->DrawLine(x + 1, CanvasY, x + 1, mEventsY + mEventsHeight); dc->SetLogicalFunction(wxCOPY); - } + } if (NextWin) + { NextWin->DrawPlayPosition(dc); + } } // ************************************************************************** @@ -668,7 +666,9 @@ if (!SnapSel->Selected) { if (msg == 0) + { msg = "please select some events first"; + } wxMessageBox((char *)msg, "Error", wxOK); return 0; } Modified: trunk/jazz/src/EventWindow.h =================================================================== --- trunk/jazz/src/EventWindow.h 2008-03-17 06:22:14 UTC (rev 326) +++ trunk/jazz/src/EventWindow.h 2008-03-17 06:25:43 UTC (rev 327) @@ -103,21 +103,21 @@ wxFont* mpFixedFont; // remains with 12pt int hFixedFont; // Height of letters - int LittleBit; - int hLine; + int LittleBit; + int mTrackHeight; - int hTop; - int wLeft; - int FontSize; - int ClocksPerPixel; - bool UseColors; + int mTopInfoHeight; + int mLeftInfoWidth; + int FontSize; + int ClocksPerPixel; + bool UseColors; // Parameters changed, e.g. Song loaded virtual void Setup(); // filled by OnPaint() //wxDC *dc; - int xEvents, yEvents, wEvents, hEvents; + int mEventsX, mEventsY, mEventsWidth, mEventsHeight; int CanvasX, CanvasY, CanvasW, CanvasH; // canvas coords int FromClock, ToClock; int FromLine, ToLine; @@ -164,7 +164,7 @@ // Mixer-Dialog wxDialog* MixerForm; - virtual void GetVirtSize(int *w, int *h); + virtual void GetVirtualEventSize(int& Width, int& Height); // Edit-Menu Modified: trunk/jazz/src/MouseAction.cpp =================================================================== --- trunk/jazz/src/MouseAction.cpp 2008-03-17 06:22:14 UTC (rev 326) +++ trunk/jazz/src/MouseAction.cpp 2008-03-17 06:25:43 UTC (rev 327) @@ -230,9 +230,9 @@ // in the parent window. void tSelection::Draw(wxDC& Dc) { - cout - << "tSelection::Draw ---------------------------------------------------" - << endl; +// cout +// << "tSelection::Draw ---------------------------------------------------" +// << endl; // Dc.DrawRectangle(100,100,100,100); // if (Selected) //we cant check for "selected" here, because... // { Modified: trunk/jazz/src/PianoFrame.cpp =================================================================== --- trunk/jazz/src/PianoFrame.cpp 2008-03-17 06:22:14 UTC (rev 326) +++ trunk/jazz/src/PianoFrame.cpp 2008-03-17 06:25:43 UTC (rev 327) @@ -393,12 +393,12 @@ DialogBox = 0; MixerForm = 0; - hTop = 40; - wLeft = 100; - xEvents = wLeft; - yEvents = hTop; - wEvents = hEvents = 0; - hLine = 0; + mTopInfoHeight = 40; + mLeftInfoWidth = 100; + mEventsX = mLeftInfoWidth; + mEventsY = mTopInfoHeight; + mEventsWidth = mEventsHeight = 0; + mTrackHeight = 0; LittleBit = 1; FontSize = PianoFontSizes[1]; // Must be an entry in the array. @@ -426,9 +426,9 @@ mpToolBar->ToggleTool(MEN_SNAP_16, TRUE); nSnaps = 0; - for (int i = 0; i < MaxTracks; i++) + for (int i = 0; i < eMaxTrackCount; i++) { - FromLines[i] = 64; + mFromLines[i] = 64; } DrumFont = 0; @@ -479,6 +479,7 @@ { delete mpGuitarFrame; } + delete mpToolBar; } @@ -541,7 +542,7 @@ LittleBit = (int)(lx/2); dc->GetTextExtent("HXWjgi", &lx, &ly); - hLine = (int)ly + LittleBit; + mTrackHeight = (int)ly + LittleBit; delete dc; @@ -552,7 +553,7 @@ dc=new wxClientDC(Canvas); dc->SetFont(*mpFixedFont); dc->GetTextExtent("H", &x, &y); - hTop = hFixedFont + 2 * LittleBit; + mTopInfoHeight = hFixedFont + 2 * LittleBit; dc->SetFont(*mpFont); dc->GetTextExtent("H", &x, &y); @@ -564,7 +565,7 @@ dc->GetTextExtent("Low Conga mid 2 or so", &x, &y); wPiano = (int)x + LittleBit; - wLeft = wPiano; + mLeftInfoWidth = wPiano; delete dc; } @@ -583,7 +584,7 @@ void JZPianoFrame::NewPosition(int track, int clock) { - FromLines[TrackNr] = FromLine; + mFromLines[TrackNr] = FromLine; // change track if (track >= 0) @@ -597,7 +598,7 @@ if (clock >= 0) { int x = Clock2x(clock); - Canvas->SetScrollPosition(x - wLeft, Line2y(FromLines[TrackNr])); + Canvas->SetScrollPosition(x - mLeftInfoWidth, Line2y(mFromLines[TrackNr])); } // SN++ Ist geaendert. OnPaint zeichnet immer neu -> Bug Fix bei ZoomOut! @@ -1197,41 +1198,41 @@ dc->DestroyClippingRegion(); dc->SetBackground(*wxWHITE_BRUSH); DrawPlayPosition(dc); - SnapSel->Draw(*dc, xEvents, yEvents, wEvents, hEvents); + SnapSel->Draw(*dc, mEventsX, mEventsY, mEventsWidth, mEventsHeight); dc->Clear(); /////////////////////////////////////////////////////////////// // horizontal lines(ripped from drawpianoroll code) -// for (y = Line2y(FromLine); y < yEvents + hEvents; y += hLine) -// if (y > yEvents) // cheaper than clipping -// dc->DrawLine(xEvents+1, y, xEvents + wEvents, y); +// for (y = Line2y(FromLine); y < mEventsY + mEventsHeight; y += mTrackHeight) +// if (y > mEventsY) // cheaper than clipping +// dc->DrawLine(mEventsX+1, y, mEventsX + mEventsWidth, y); dc->SetPen(*wxGREY_PEN); wxBrush blackKeysBrush=wxBrush(wxColor(250,240,240),wxSOLID); int Pitch = 127 - FromLine; y = Line2y(FromLine); - while (Pitch >= 0 && y < yEvents + hEvents) + while (Pitch >= 0 && y < mEventsY + mEventsHeight) { if (IsBlack(Pitch)) { dc->SetBrush(blackKeysBrush);//*wxLIGHT_GREY_PEN - dc->DrawRectangle(CanvasX, y, 2000, hLine); + dc->DrawRectangle(CanvasX, y, 2000, mTrackHeight); } else if ((Pitch % 12) == 0) { dc->SetPen(*wxCYAN_PEN); - dc->DrawLine(CanvasX, y + hLine, 2000, y + hLine); + dc->DrawLine(CanvasX, y + mTrackHeight, 2000, y + mTrackHeight); } else if (!IsBlack(Pitch - 1)) { dc->SetPen(*wxGREEN_PEN); - dc->DrawLine(CanvasX, y + hLine, 2000, y + hLine); + dc->DrawLine(CanvasX, y + mTrackHeight, 2000, y + mTrackHeight); } - y += hLine; + y += mTrackHeight; --Pitch; } @@ -1241,7 +1242,7 @@ MouseLine = -1; - #define VLine(x) DrawLine(x, CanvasY, x, yEvents+hEvents) + #define VLine(x) DrawLine(x, CanvasY, x, mEventsY + mEventsHeight) #define HLine(y) DrawLine(CanvasX, y, CanvasX + CanvasW, y) dc->SetPen(*wxBLACK_PEN); @@ -1249,11 +1250,11 @@ // vertical lines dc->VLine(xPiano); - dc->VLine(xEvents); - dc->VLine(xEvents-1); - dc->HLine(yEvents); - dc->HLine(yEvents-1); - dc->HLine(yEvents + hEvents); + dc->VLine(mEventsX); + dc->VLine(mEventsX-1); + dc->HLine(mEventsY); + dc->HLine(mEventsY-1); + dc->HLine(mEventsY + mEventsHeight); // draw vlines and bar numbers @@ -1270,11 +1271,11 @@ int i; dc->SetPen(*wxBLACK_PEN); sprintf(buf, "%d", BarInfo.BarNr + 1 - intro); - if (x > xEvents) + if (x > mEventsX) { - dc->DrawText(buf, x + LittleBit, yEvents - hFixedFont - 2); + dc->DrawText(buf, x + LittleBit, mEventsY - hFixedFont - 2); dc->SetPen(*wxGREY_PEN); - dc->DrawLine(x, yEvents - hFixedFont, x, yEvents+hEvents); + dc->DrawLine(x, mEventsY - hFixedFont, x, mEventsY + mEventsHeight); } dc->SetPen(*wxLIGHT_GREY_PEN); @@ -1282,13 +1283,15 @@ { clk += BarInfo.TicksPerBar / BarInfo.CountsPerBar; x = Clock2x(clk); - if (x > xEvents) - dc->DrawLine(x, yEvents+1, x, yEvents+hEvents); + if (x > mEventsX) + { + dc->DrawLine(x, mEventsY + 1, x, mEventsY + mEventsHeight); + } } BarInfo.Next(); } - LineText(dc, CanvasX, CanvasY, wPiano, hTop); + LineText(dc, CanvasX, CanvasY, wPiano, mTopInfoHeight); dc->SetPen(*wxBLACK_PEN); DrawPianoRoll(dc); @@ -1309,7 +1312,7 @@ sbrush.SetColour(230,255,230); #endif - //dc->SetClippingRegion(xEvents, yEvents, wEvents, hEvents); + //dc->SetClippingRegion(mEventsX, mEventsY, mEventsWidth, mEventsHeight); dc->SetLogicalFunction(wxXOR); dc->SetPen(*wxTRANSPARENT_PEN); @@ -1326,13 +1329,13 @@ HBChord scale = context->Scale(); int x = Clock2x(start); - if (x < xEvents) // clip to left border - x = xEvents; + if (x < mEventsX) // clip to left border + x = mEventsX; int w = Clock2x(stop) - x; if (w <= 0) continue; - int h = hLine; + int h = mTrackHeight; for (int i = 0; i < 12; i++) { int pitch = i; @@ -1351,7 +1354,7 @@ while (pitch < 127) { int y = Pitch2y(pitch); - if (y >= yEvents && y <= yEvents + hEvents - h) // y-clipping + if (y >= mEventsY && y <= mEventsY + mEventsHeight - h) // y-clipping { dc->DrawRectangle(x, y, w, h); } @@ -1409,7 +1412,7 @@ dc->SetBrush(*wxBLACK_BRUSH); dc->SetBackground(*wxWHITE_BRUSH); // xor-bug - SnapSel->Draw(*dc, xEvents, yEvents, wEvents, hEvents); + SnapSel->Draw(*dc, mEventsX, mEventsY, mEventsWidth, mEventsHeight); DrawPlayPosition(dc); //OBSOLETE dc->EndDrawing(); @@ -1423,7 +1426,7 @@ char buf[20]; dc->SetBrush(*wxLIGHT_GREY_BRUSH); - dc->DrawRectangle(xPiano, yEvents, wPiano, hEvents); //draw grey bg for keyboard + dc->DrawRectangle(xPiano, mEventsY, wPiano, mEventsHeight); //draw grey bg for keyboard dc->SetBrush(*wxBLACK_BRUSH); // dc->SetTextBackground(*wxLIGHT_GREY); @@ -1439,45 +1442,45 @@ { dc->SetFont(*mpFixedFont); - while (Pitch >= 0 && y < yEvents + hEvents) + while (Pitch >= 0 && y < mEventsY + mEventsHeight) { if (IsBlack(Pitch)) { - dc->DrawRectangle(CanvasX, y, wBlack, hLine); - dc->DrawLine(CanvasX + wBlack, y + hLine/2, CanvasX + wPiano, y + hLine/2); + dc->DrawRectangle(CanvasX, y, wBlack, mTrackHeight); + dc->DrawLine(CanvasX + wBlack, y + mTrackHeight/2, CanvasX + wPiano, y + mTrackHeight/2); dc->SetPen(*wxWHITE_PEN); - dc->DrawLine(CanvasX + wBlack+1, y + hLine/2+1, CanvasX + wPiano, y + hLine/2+1); + dc->DrawLine(CanvasX + wBlack+1, y + mTrackHeight/2+1, CanvasX + wPiano, y + mTrackHeight/2+1); dc->DrawLine(CanvasX, y, CanvasX + wBlack, y); dc->SetPen(*wxBLACK_PEN); } else if ((Pitch % 12) == 0) { - dc->DrawLine(CanvasX, y + hLine, CanvasX + wPiano, y + hLine); + dc->DrawLine(CanvasX, y + mTrackHeight, CanvasX + wPiano, y + mTrackHeight); dc->SetPen(*wxWHITE_PEN); - dc->DrawLine(CanvasX, y + hLine+1, CanvasX + wPiano, y + hLine+1); + dc->DrawLine(CanvasX, y + mTrackHeight + 1, CanvasX + wPiano, y + mTrackHeight + 1); dc->SetPen(*wxBLACK_PEN); sprintf(buf, "%d", Pitch / 12); - dc->DrawText(buf, CanvasX + wBlack + LittleBit, y + hLine / 2); + dc->DrawText(buf, CanvasX + wBlack + LittleBit, y + mTrackHeight / 2); } else if (!IsBlack(Pitch - 1)) { - dc->DrawLine(CanvasX, y + hLine, CanvasX + wPiano, y + hLine); + dc->DrawLine(CanvasX, y + mTrackHeight, CanvasX + wPiano, y + mTrackHeight); dc->SetPen(*wxWHITE_PEN); - dc->DrawLine(CanvasX, y + hLine+1, CanvasX + wPiano, y + hLine+1); + dc->DrawLine(CanvasX, y + mTrackHeight + 1, CanvasX + wPiano, y + mTrackHeight + 1); dc->SetPen(*wxBLACK_PEN); } - y += hLine; + y += mTrackHeight; --Pitch; } } else if (Track->GetAudioMode()) { dc->SetFont(*DrumFont); - while (Pitch >= 0 && y < yEvents + hEvents) + while (Pitch >= 0 && y < mEventsY + mEventsHeight) { dc->DrawText(gpMidiPlayer->GetSampleName(Pitch), CanvasX + LittleBit, y); - y += hLine; + y += mTrackHeight; --Pitch; } } @@ -1487,14 +1490,14 @@ if (VisibleKeyOn && VisibleDrumNames) { dc->SetFont(*DrumFont); - while (Pitch >= 0 && y < yEvents + hEvents) + while (Pitch >= 0 && y < mEventsY + mEventsHeight) { dc->DrawText( gpConfig->DrumName(Pitch + 1).first.c_str(), CanvasX + LittleBit, y); - y += hLine; + y += mTrackHeight; --Pitch; } @@ -1502,41 +1505,41 @@ else if (VisibleController) { dc->SetFont(*DrumFont); - while (Pitch >= 0 && y < yEvents + hEvents) + while (Pitch >= 0 && y < mEventsY + mEventsHeight) { dc->DrawText( gpConfig->CtrlName(Pitch + 1).first.c_str(), CanvasX + LittleBit, y); - y += hLine; + y += mTrackHeight; --Pitch; } } else if (VisibleProgram) { dc->SetFont(*DrumFont); - while (Pitch >= 0 && y < yEvents + hEvents) + while (Pitch >= 0 && y < mEventsY + mEventsHeight) { dc->DrawText( gpConfig->VoiceName(Pitch + 1).first.c_str(), CanvasX + LittleBit, y); - y += hLine; + y += mTrackHeight; --Pitch; } } else if (VisibleSysex) { dc->SetFont(*DrumFont); - while (Pitch >= 0 && y < yEvents + hEvents) + while (Pitch >= 0 && y < mEventsY + mEventsHeight) { dc->DrawText( tSynthSysex::GetSysexGroupName(Pitch + 1), CanvasX + LittleBit, y); - y += hLine; + y += mTrackHeight; --Pitch; } } @@ -1571,7 +1574,7 @@ if (!xoor) { dc->SetBrush(*wxWHITE_BRUSH); - dc->DrawRectangle(x, y + LittleBit, length, hLine - 2 * LittleBit); + dc->DrawRectangle(x, y + LittleBit, length, mTrackHeight - 2 * LittleBit); } // show velocity as colors @@ -1587,7 +1590,7 @@ } // end velocity colors - dc->DrawRectangle(x, y + LittleBit, length, hLine - 2 * LittleBit); + dc->DrawRectangle(x, y + LittleBit, length, mTrackHeight - 2 * LittleBit); if (xoor) { @@ -1602,7 +1605,7 @@ void JZPianoFrame::DrawEvents(wxDC* dc, tTrack *t, int Stat, const wxBrush* Brush, int force_color) { - //dc->SetClippingRegion(xEvents, yEvents, wEvents, hEvents); + //dc->SetClippingRegion(mEventsX, mEventsY, mEventsWidth, mEventsHeight); dc->SetBrush(*Brush); tEventIterator Iterator(t); @@ -1635,10 +1638,10 @@ { int DrawLength = Length/ClocksPerPixel; // do clipping ourselves - if (x1 < xEvents) + if (x1 < mEventsX) { - DrawLength -= xEvents - x1; - x1 = xEvents; + DrawLength -= mEventsX - x1; + x1 = mEventsX; } // Always draw at least two pixels to avoid invisible (behind a // vertical line) or zero-length events: @@ -1659,7 +1662,7 @@ } // end velocity colors - dc->DrawRectangle(x1, y1 + LittleBit, DrawLength, hLine - 2 * LittleBit); + dc->DrawRectangle(x1, y1 + LittleBit, DrawLength, mTrackHeight - 2 * LittleBit); //shouldnt it be in drawevent? odd. if (pEvent->IsPlayTrack()) @@ -1694,8 +1697,8 @@ dc->GetTextExtent((const char*)pEvent->IsText()->GetText(), &textX, &textY); dc->SetBrush(*wxWHITE_BRUSH); - int textlabely=CanvasY+hTop;//text labels drawn at top - dc->DrawRectangle(x1-textX, textlabely + LittleBit, textX, textY);//hLine - 2 * LittleBit); + int textlabely = CanvasY + mTopInfoHeight;//text labels drawn at top + dc->DrawRectangle(x1-textX, textlabely + LittleBit, textX, textY);//mTrackHeight - 2 * LittleBit); dc->DrawText(buf, x1-textX, textlabely + LittleBit); } } @@ -2466,7 +2469,7 @@ r.x = CanvasX + LittleBit; r.y = CanvasY; r.SetWidth(wPiano - 2 * LittleBit); - r.SetHeight(hTop); + r.SetHeight(mTopInfoHeight); tVelocCounter *VelocCounter = new tVelocCounter(this, &r, k); VelocCounter->Event(Event); @@ -2502,12 +2505,12 @@ if (MouseLine >= 0) { // Erase the previous highlight. - dc.DrawRectangle(xPiano, Line2y(MouseLine) + LittleBit, wPiano, hLine - 2 * LittleBit); + dc.DrawRectangle(xPiano, Line2y(MouseLine) + LittleBit, wPiano, mTrackHeight - 2 * LittleBit); } MouseLine = line; // Draw the new position. - dc.DrawRectangle(xPiano, Line2y(MouseLine) + LittleBit, wPiano, hLine - 2*LittleBit); + dc.DrawRectangle(xPiano, Line2y(MouseLine) + LittleBit, wPiano, mTrackHeight - 2*LittleBit); dc.SetLogicalFunction(wxCOPY); } @@ -2533,13 +2536,13 @@ int x, y; LogicalMousePosition(Event, &x, &y); - if (y > yEvents) // click in event area? + if (y > mEventsY) // click in event area? { if (xPiano < x && x < xPiano + wPiano) { MousePiano(Event); } - else if (xEvents < x && x < xEvents + wEvents) + else if (mEventsX < x && x < mEventsX + mEventsWidth) { MouseEvents(Event); } @@ -2548,7 +2551,7 @@ OnEventWinMouseEvent(Event); } } - else if (x > xEvents) + else if (x > mEventsX) { // click in top line int action = MousePlay.Action(Event); @@ -2730,7 +2733,7 @@ { SnapSel->SetXSnap(0,0,0); } - SnapSel->SetYSnap(FromLine * hLine + hTop, yEvents + hEvents, hLine); + SnapSel->SetYSnap(FromLine * mTrackHeight + mTopInfoHeight, mEventsY + mEventsHeight, mTrackHeight); } @@ -2840,7 +2843,7 @@ } int x = Clock2x(Clock); - Canvas->SetScrollPosition(x - wLeft, CanvasY); + Canvas->SetScrollPosition(x - mLeftInfoWidth, CanvasY); } if (!SnapSel->Active) // sets clipping @@ -2878,9 +2881,9 @@ dc->SetBrush(*wxBLACK_BRUSH); dc->SetPen(*wxBLACK_PEN); int x = Clock2x(PlayClock); - //dc->DrawRectangle(x, CanvasY, 2*LittleBit, hTop); - dc->DrawLine(x, CanvasY,x, yEvents+hEvents); //draw a line, 2 pixwels wide - dc->DrawLine(x+1,CanvasY,x+1,yEvents+hEvents); + //dc->DrawRectangle(x, CanvasY, 2*LittleBit, mTopInfoHeight); + dc->DrawLine(x, CanvasY,x, mEventsY + mEventsHeight); //draw a line, 2 pixwels wide + dc->DrawLine(x+1,CanvasY,x+1,mEventsY + mEventsHeight); dc->SetLogicalFunction(wxCOPY); } } @@ -2892,12 +2895,12 @@ int JZPianoFrame::Clock2x(int clk) { - return xEvents + (clk - FromClock) / ClocksPerPixel; + return mEventsX + (clk - FromClock) / ClocksPerPixel; } int JZPianoFrame::Line2y(int Line) { - return Line * hLine + hTop; + return Line * mTrackHeight + mTopInfoHeight; } void JZPianoFrame::ActSettingsDialog(wxCommandEvent& Event) @@ -3048,15 +3051,17 @@ int JZPianoFrame::x2Clock(int x) { - return (x - xEvents) * ClocksPerPixel + FromClock; + return (x - mEventsX) * ClocksPerPixel + FromClock; } int JZPianoFrame::y2Line(int y, int up) { if (up) - y += hLine; - y -= hTop; - return y / hLine; + { + y += mTrackHeight; + } + y -= mTopInfoHeight; + return y / mTrackHeight; } int JZPianoFrame::x2BarClock(int x, int next) @@ -3078,7 +3083,7 @@ int x; int y; LogicalMousePosition(Event, &x, &y); - if (xEvents < x && x < xEvents + wEvents && yEvents < y && y < yEvents + hEvents) + if (mEventsX < x && x < mEventsX + mEventsWidth && mEventsY < y && y < mEventsY + mEventsHeight) { if (Event.LeftDown()) { @@ -3125,13 +3130,13 @@ CanvasW = xc; CanvasH = yc; - xEvents = CanvasX + wLeft; - yEvents = CanvasY + hTop; - wEvents = CanvasW - wLeft; - hEvents = CanvasH - hTop; + mEventsX = CanvasX + mLeftInfoWidth; + mEventsY = CanvasY + mTopInfoHeight; + mEventsWidth = CanvasW - mLeftInfoWidth; + mEventsHeight = CanvasH - mTopInfoHeight; - FromLine = CanvasY / hLine; - ToLine = (CanvasY + CanvasH - hTop) / hLine; + FromLine = CanvasY / mTrackHeight; + ToLine = (CanvasY + CanvasH - mTopInfoHeight) / mTrackHeight; FromClock = CanvasX * ClocksPerPixel; ToClock = x2Clock(CanvasX + CanvasW); } @@ -3139,18 +3144,22 @@ int JZPianoFrame::y2yLine(int y, int up) { if (up) - y += hLine; - y -= hTop; - y -= y % hLine; - y += hTop; + { + y += mTrackHeight; + } + y -= mTopInfoHeight; + y -= y % mTrackHeight; + y += mTopInfoHeight; return y; } -void JZPianoFrame::GetVirtSize(int *w, int *h) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZPianoFrame::GetVirtualEventSize(int& Width, int& Height) { - int clk = Song->MaxQuarters * Song->TicksPerQuarter; - *w = clk / ClocksPerPixel + wLeft; - *h = 127 * hLine + hTop; + int TotalClockTics = Song->MaxQuarters * Song->TicksPerQuarter; + Width = TotalClockTics / ClocksPerPixel + mLeftInfoWidth; + Height = 127 * mTrackHeight + mTopInfoHeight; } bool JZPianoFrame::OnCharHook(wxKeyEvent& Event) @@ -3258,7 +3267,7 @@ void JZPianoFrame::ButtonLabelDisplay(const wxString& Text, bool IsButtonDown) { wxClientDC Dc(Canvas); - LineText(&Dc, 0, 0, wPiano, hTop, Text, IsButtonDown); + LineText(&Dc, 0, 0, wPiano, mTopInfoHeight, Text, IsButtonDown); } Modified: trunk/jazz/src/PianoFrame.h =================================================================== --- trunk/jazz/src/PianoFrame.h 2008-03-17 06:22:14 UTC (rev 326) +++ trunk/jazz/src/PianoFrame.h 2008-03-17 06:25:43 UTC (rev 327) @@ -77,7 +77,7 @@ int xSnaps[MaxSnaps]; - int FromLines[MaxTracks]; + int mFromLines[eMaxTrackCount]; int IsVisible(JZEvent *e); int IsVisible(tTrack *t); @@ -215,7 +215,7 @@ int OnEventWinMouseEvent(wxMouseEvent &e); void OnEventWinPaintSub(int x, int y); int y2yLine(int y, int up = 0); - void GetVirtSize(int *w, int *h); + void GetVirtualEventSize(int& Width, int& Height); bool OnCharHook(wxKeyEvent& e); JZPianoWindow *Canvas; @@ -227,12 +227,12 @@ wxFont* mpFont; wxFont* mpFixedFont; //remains with 12pt/ bleibt bei 12pt int hFixedFont; //Height letters/ Hoehe eines Buchstaben - int hTop; - int wLeft; + int mTopInfoHeight; + int mLeftInfoWidth; int LittleBit; int FromLine, ToLine; - int hLine; - int xEvents, yEvents, wEvents, hEvents; + int mTrackHeight; + int mEventsX, mEventsY, mEventsWidth, mEventsHeight; int CanvasX, CanvasY, CanvasW, CanvasH; // canvas coords int FromClock, ToClock; tSnapSelection* SnapSel; Modified: trunk/jazz/src/PianoWindow.cpp =================================================================== --- trunk/jazz/src/PianoWindow.cpp 2008-03-17 06:22:14 UTC (rev 326) +++ trunk/jazz/src/PianoWindow.cpp 2008-03-17 06:25:43 UTC (rev 327) @@ -94,10 +94,10 @@ void JZPianoWindow::SetScrollRanges() { - int w, h; - mpPianoFrame->GetVirtSize(&w, &h); - SetScrollbars(ScLine, ScLine, w/ScLine, h/ScLine, ScPage, ScPage); - EnableScrolling(FALSE, FALSE); + int Width, Height; + mpPianoFrame->GetVirtualEventSize(Width, Height); + SetScrollbars(ScLine, ScLine, Width / ScLine, Height / ScLine); + EnableScrolling(false, false); } void JZPianoWindow::SetScrollPosition(int x, int y) Modified: trunk/jazz/src/Song.cpp =================================================================== --- trunk/jazz/src/Song.cpp 2008-03-17 06:22:14 UTC (rev 326) +++ trunk/jazz/src/Song.cpp 2008-03-17 06:25:43 UTC (rev 327) @@ -31,50 +31,48 @@ #include "Metronome.h" -JZSong::~JZSong() -{ - int i; - Clear(); - for (i = 0; i < MaxTracks; i++) - { - delete Tracks[i]; - } -} - JZSong::JZSong() + : mTracks() { - int i; - nTracks = MaxTracks; + nTracks = eMaxTrackCount; TicksPerQuarter = 120; intro_length = 0; - for (i = 0; i < MaxTracks; i++) - Tracks[i] = new tTrack(); - MaxQuarters = 100 * 4; // start with 100 bars ... + + // Start with 100 measures of 4:4 time. + MaxQuarters = 100 * 4; } +JZSong::~JZSong() +{ + Clear(); +} + void JZSong::Clear() { for (int i = 0; i < nTracks; i++) - Tracks[i]->Clear(); - nTracks = MaxTracks; + { + mTracks[i].Clear(); + } + nTracks = eMaxTrackCount; } int JZSong::Speed() { - return Tracks[0]->GetDefaultSpeed(); + return mTracks[0].GetDefaultSpeed(); } void JZSong::Read(tReadBase &io, const char *fname) { int i; wxBeginBusyCursor(); - for (i = 0; i < MaxTracks; i++) { - // cout << Tracks<<"\n"; - Tracks[i]->Clear(); + for (i = 0; i < eMaxTrackCount; ++i) + { + mTracks[i].Clear(); } int n = io.Open(fname); - for (i = 0; i < n && i < MaxTracks; i++) { - Tracks[i]->Read(io); + for (i = 0; i < n && i < eMaxTrackCount; ++i) + { + mTracks[i].Read(io); } io.Close(); TicksPerQuarter = io.TicksPerQuarter; @@ -102,9 +100,9 @@ void JZSong::Write(tWriteBase &io, const char *fname) { // Make sure track 0 has a synth reset - if (!Tracks[0]->Reset) + if (!mTracks[0].Reset) { - Tracks[0]->Reset = gpSynth->Reset()->IsSysEx(); + mTracks[0].Reset = gpSynth->Reset()->IsSysEx(); } int n = NumUsedTracks(); @@ -114,8 +112,10 @@ } wxBeginBusyCursor(); - for (int i = 0; i < n; i++) - Tracks[i]->Write(io); + for (int i = 0; i < n; ++i) + { + mTracks[i].Write(io); + } io.Close(); wxEndBusyCursor(); } @@ -124,7 +124,9 @@ tTrack *JZSong::GetTrack(int Nr) { if (Nr >= 0 && Nr < nTracks) - return Tracks[Nr]; + { + return &mTracks[Nr]; + } return 0; } @@ -134,9 +136,11 @@ int max = 0; for (int i = 0; i < nTracks; i++) { - int clk = Tracks[i]->GetLastClock(); + int clk = mTracks[i].GetLastClock(); if (clk > max) + { max = clk; + } } return max; } @@ -191,28 +195,30 @@ int solo = 0; for (i = 0; i < nTracks; i++) { - if (Tracks[i]->State == tsSolo) + if (mTracks[i].State == tsSolo) { solo = 1; break; } } - for (i = 0; i < nTracks; i++) + for (i = 0; i < nTracks; ++i) { - tTrack *t = Tracks[i]; - if (t->State == tsSolo || (!solo && t->State == tsPlay)) + tTrack* pTrack = &mTracks[i]; + if (pTrack->State == tsSolo || (!solo && pTrack->State == tsPlay)) { - if (t->GetAudioMode() != mode) + if (pTrack->GetAudioMode() != mode) + { continue; + } - tEventIterator Iterator(Tracks[i]); + tEventIterator Iterator(&mTracks[i]); JZEvent *e = Iterator.Range(FrClock, ToClock); while (e) { JZEvent *c = e->Copy(); c->SetClock(c->GetClock() + delta); - c->SetDevice(t->GetDevice()); + c->SetDevice(pTrack->GetDevice()); Destin->Put(c); if(c->IsPlayTrack()) @@ -239,21 +245,21 @@ if(recursionDepth>100) //yes yes, you should use symbolics... return; fprintf(stderr, "playtrack %d\n",c->track); - tTrack *t=Tracks[c->track];//the track we want to play - tEventIterator IteratorPL(t); //get an iterator of all events the playtrack is pointing to + tTrack* pTrack = &mTracks[c->track];//the track we want to play + 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(t); //get an iterator of all events the playtrack is pointing to - f = IteratorEOT.Range(0, t->GetLastClock()); - loopLength=t->GetLastClock(); + tEventIterator IteratorEOT(pTrack); //get an iterator of all events the playtrack is pointing to + f = IteratorEOT.Range(0, pTrack->GetLastClock()); + loopLength = pTrack->GetLastClock(); while(f) { if (f->IsEndOfTrack()) { - loopLength = t->GetLastClock(); + loopLength = pTrack->GetLastClock(); } f = IteratorEOT.Next(); } @@ -286,7 +292,7 @@ { MergePlayTrackEvent(d->IsPlayTrack(), Destin, recursionDepth); } - d->SetDevice(t->GetDevice()); + d->SetDevice(pTrack->GetDevice()); Destin->Put(d); f = IteratorPL.Next(); } @@ -344,7 +350,7 @@ JZBarInfo::JZBarInfo(JZSong *Song) - : Iterator(Song->Tracks[0]) + : Iterator(&Song->mTracks[0]) { BarNr = 0; Clock = 0; @@ -426,23 +432,29 @@ void JZSong::NewUndoBuffer() { - for (int i = 0; i < nTracks; i++) - Tracks[i]->NewUndoBuffer(); + for (int i = 0; i < nTracks; ++i) + { + mTracks[i].NewUndoBuffer(); + } } void JZSong::Undo() { wxBeginBusyCursor(); - for (int i = 0; i < nTracks; i++) - Tracks[i]->Undo(); + for (int i = 0; i < nTracks; ++i) + { + mTracks[i].Undo(); + } wxEndBusyCursor(); } void JZSong::Redo() { wxBeginBusyCursor(); - for (int i = 0; i < nTracks; i++) - Tracks[i]->Redo(); + for (int i = 0; i < nTracks; ++i) + { + mTracks[i].Redo(); + } wxEndBusyCursor(); } @@ -455,12 +467,12 @@ int tt, ee; double f = (double)NewTicks / (double)TicksPerQuarter; - for (tt = 0; tt < nTracks; tt++) + for (tt = 0; tt < nTracks; ++tt) { - tTrack *t = Tracks[tt]; - for (ee = 0; ee < t->nEvents; ee++) + tTrack* pTrack = &mTracks[tt]; + for (ee = 0; ee < pTrack->nEvents; ee++) { - JZEvent *e = t->Events[ee]; + JZEvent *e = pTrack->Events[ee]; e->SetClock((int)(f * e->GetClock() + 0.5)); tKeyOn *k = e->IsKeyOn(); if (k) @@ -491,13 +503,15 @@ // evtl vorhandene TimeSignatures loeschen - tTrack *t = Tracks[0]; - tEventIterator Iterator(t); + tTrack* pTrack = &mTracks[0]; + tEventIterator Iterator(pTrack); JZEvent *e = Iterator.Range(FrClock, ToClock); while (e) { if (e->IsTimeSignat()) - t->Kill(e); + { + pTrack->Kill(e); + } e = Iterator.Next(); } @@ -515,8 +529,8 @@ } e = new tTimeSignat(FrClock, Numerator, Shift); - t->Put(e); - t->Cleanup(); + pTrack->Put(e); + pTrack->Cleanup(); return 0; } @@ -525,8 +539,12 @@ { int n; for (n = nTracks; n > 1; n--) - if (!Tracks[n-1]->IsEmpty()) + { + if (!mTracks[n - 1].IsEmpty()) + { break; + } + } return n; } @@ -534,20 +552,25 @@ // SN++ void JZSong::moveTrack(int from, int to) { - tTrack *Track; + tTrack* pTrack; int i; if (from == to) return; - Track = Tracks[from]; - if (from > to) { - for (i=from;i>=to;i--) - Tracks[i] = Tracks[i-1]; - } else { - for (i=from;i<=to;i++) - Tracks[i] = Tracks[i+1]; + pTrack = &mTracks[from]; + if (from > to) + { + for (i = from; i >= to; i--) + { + mTracks[i] = mTracks[i - 1]; + } } - Tracks[to] = Track; + else + { + for (i = from; i <= to; i++) + { + mTracks[i] = mTracks[i + 1]; + } + } + mTracks[to] = *pTrack; } - - Modified: trunk/jazz/src/Song.h =================================================================== --- trunk/jazz/src/Song.h 2008-03-17 06:22:14 UTC (rev 326) +++ trunk/jazz/src/Song.h 2008-03-17 06:25:43 UTC (rev 327) @@ -25,6 +25,7 @@ #include "Track.h" #include "Configuration.h" +#include "Globals.h" class tMetronomeInfo; class JZSong; @@ -55,9 +56,6 @@ int TicksPerQuarter; }; -// same as keys in pianowin -#define MaxTracks 127 - class JZSong { friend class JZBarInfo; @@ -75,7 +73,8 @@ int nTracks; int TicksPerQuarter; - tTrack *Tracks[MaxTracks]; + tTrack mTracks[eMaxTrackCount]; + void NewUndoBuffer(); void Undo(); void Redo(); Modified: trunk/jazz/src/SynthesizerSettingsDialog.cpp =================================================================== --- trunk/jazz/src/SynthesizerSettingsDialog.cpp 2008-03-17 06:22:14 UTC (rev 326) +++ trunk/jazz/src/SynthesizerSettingsDialog.cpp 2008-03-17 06:25:43 UTC (rev 327) @@ -1,7 +1,7 @@ //***************************************************************************** // The JAZZ++ Midi Sequencer // -// Modifications Copyright (C) 2008 Peter J. Stieber +// Copyright (C) 2008 Peter J. Stieber // // 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 @@ -23,6 +23,7 @@ #include "SynthesizerSettingsDialog.h" #include "Configuration.h" #include "Globals.h" +#include "Knob.h" using namespace std; @@ -35,6 +36,8 @@ mpSynthesizerListbox(0), mpStartListbox(0) { + JZKnob* pKnob = new JZKnob(this, wxID_ANY, 100, 0, 128); + mpSynthesizerListbox = new wxListBox(this, wxID_ANY); int Selection = 0; @@ -72,6 +75,8 @@ wxBoxSizer* pLeftSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* pRightSizer = new wxBoxSizer(wxVERTICAL); + pLeftSizer->Add(pKnob, 0, wxALL, 2); + pLeftSizer->Add( new wxStaticText(this, wxID_ANY, "Synthesizer Type"), 0, Modified: trunk/jazz/src/TrackFrame.cpp =================================================================== --- trunk/jazz/src/TrackFrame.cpp 2008-03-17 06:22:14 UTC (rev 326) +++ trunk/jazz/src/TrackFrame.cpp 2008-03-17 06:25:43 UTC (rev 327) @@ -440,10 +440,10 @@ gpProject->OpenSong(FileName); SetTitle(FileName); // NextWin->NewPosition(1, 0); - mpTrackWindow->SetScrollRanges(); - mpTrackWindow->SetScrollPosition(0, 0); + mpTrackWindow->SetScrollRanges(0, 0); +// mpTrackWindow->SetScrollPosition(0, 0); // NextWin->Canvas->SetScrollRanges(); - Refresh(); + mpTrackWindow->Refresh(false); // tTrack::changed = false; } } Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2008-03-17 06:22:14 UTC (rev 326) +++ trunk/jazz/src/TrackWindow.cpp 2008-03-17 06:25:43 UTC (rev 327) @@ -41,6 +41,7 @@ //----------------------------------------------------------------------------- BEGIN_EVENT_TABLE(JZTrackWindow, wxScrolledWindow) EVT_SIZE(JZTrackWindow::OnSize) + EVT_ERASE_BACKGROUND(JZTrackWindow::OnEraseBackground) END_EVENT_TABLE() //----------------------------------------------------------------------------- @@ -49,10 +50,6 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -const int JZTrackWindow::mScrollPage = 8; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- JZTrackWindow::JZTrackWindow( JZTrackFrame* pParent, JZSong* pSong, @@ -69,32 +66,44 @@ mpSong(pSong), mpGreyColor(0), mpGreyBrush(0), - hLine(0), - hTop(40), - wLeft(100), + mTrackHeight(10), + mTopInfoHeight(40), + mLeftInfoWidth(100), mClocksPerPixel(36), mPlayClock(-1), mUseColors(true), - mLittleBit(0), - mCanvasX(0), - mCanvasY(0), + mLittleBit(2), + mEventsX(), + mEventsY(), + mEventsWidth(), + mEventsHeight(), + mScrolledX(0), + mScrolledY(0), mCanvasWidth(0), mCanvasHeight(0), mFromClock(0), mToClock(0), mFromLine(0), mToLine(0), - xPatch(0), - wPatch(0), - nBars(0), + mNumberWidth(), + mTrackNameX(), + mTrackNameWidth(), + mStateX(), + mStateWidth(), + mPatchX(0), + mPatchWidth(0), + mBarCount(0), mCounterMode(eCmProgram), - mNumberMode(eNmMidiChannel), +// mNumberMode(eNmMidiChannel), + mNumberMode(eNmTrackNr), mpFixedFont(0), mFixedFontHeight(0), mFontSize(12), mpFont(0), mPreviouslyRecording(false), - mPreviousClock(0) + mPreviousClock(0), + mDrawing(false), + mpFrameBuffer(0) { #ifdef __WXMSW__ mpGreyColor = new wxColor(192, 192, 192); @@ -109,6 +118,8 @@ mpFilter = new tFilter(mpSong); SetBackgroundColour(*wxWHITE); + + mpFrameBuffer = new wxBitmap; } //----------------------------------------------------------------------------- @@ -121,63 +132,65 @@ delete mpFont; delete mpSnapSel; delete mpFilter; + delete mpFrameBuffer; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void JZTrackWindow::Create() { - int x, y; + wxClientDC Dc(this); - wxDC* pDc = new wxClientDC(this); + Dc.SetFont(wxNullFont); - pDc->SetFont(wxNullFont); - delete mpFixedFont; mpFixedFont = new wxFont(12, wxSWISS, wxNORMAL, wxNORMAL); - pDc->SetFont(*mpFixedFont); - pDc->GetTextExtent("M", &x, &mFixedFontHeight); + Dc.SetFont(*mpFixedFont); + int Width, Height; + Dc.GetTextExtent("M", &Width, &mFixedFontHeight); + delete mpFont; mpFont = new wxFont(mFontSize, wxSWISS, wxNORMAL, wxNORMAL); - pDc->SetFont(*mpFont); + Dc.SetFont(*mpFont); - pDc->GetTextExtent("M", &x, &y); - mLittleBit = (int)(x / 2); + Dc.GetTextExtent("M", &Width, &Height); + mLittleBit = Width / 2; - pDc->GetTextExtent("HXWjgi", &x, &y); - hLine = y + mLittleBit; + Dc.GetTextExtent("HXWjgi", &Width, &Height); + mTrackHeight = Height + 2 * mLittleBit; - hTop = mFixedFontHeight + 2 * mLittleBit; + mTopInfoHeight = mFixedFontHeight + 2 * mLittleBit; - pDc->GetTextExtent("99", &x, &y); - wNumber = x + mLittleBit; + Dc.GetTextExtent("999", &Width, &Height); + mNumberWidth = Width + 2 * mLittleBit; - pDc->GetTextExtent("Normal Trackname", &x, &y); - wName = x + mLittleBit; + Dc.GetTextExtent("Normal Track Name", &Width, &Height); + mTrackNameWidth = Width + 2 * mLittleBit; - pDc->GetTextExtent("m", &x, &y); - wState = x + mLittleBit; + Dc.GetTextExtent("m", &Width, &Height); + mStateWidth = Width + 2 * mLittleBit; - pDc->GetTextExtent("999", &x, &y); - wPatch = x + 2 * mLittleBit; + Dc.GetTextExtent("999", &Width, &Height); + mPatchWidth = Width + 2 * mLittleBit; - wLeft = wNumber + wName + wState + wPatch + 1; + mLeftInfoWidth = mNumberWidth + mTrackNameWidth + mStateWidth + mPatchWidth + 1; - cout - << ' ' << wNumber - << ' ' << wName - << ' ' << wState - << ' ' << wPatch - << ' ' << wLeft - << endl; +//DEBUG cout +//DEBUG << ' ' << mNumberWidth +//DEBUG << ' ' << mTrackNameWidth +//DEBUG << ' ' << mStateWidth +//DEBUG << ' ' << mPatchWidth +//DEBUG << ' ' << mLeftInfoWidth +//DEBUG << endl; UnMark(); - delete pDc; +// delete pDc; } //----------------------------------------------------------------------------- +// Description: // Update the play position to the clock argument, and trigger a redraw so // the play bar will be drawn. //----------------------------------------------------------------------------- @@ -197,7 +210,7 @@ return; } int x = Clock2x(Clock); - SetScrollPosition(x - wLeft, mCanvasY); + SetScrollPosition(x - mLeftInfoWidth, mScrolledY); } if (!mpSnapSel->Active) // sets clipping @@ -208,17 +221,19 @@ mPlayClock = Clock; wxRect invalidateRect; invalidateRect.x = Clock2x(OldPlayClock) - 1; - invalidateRect.y = mCanvasY; + invalidateRect.y = mScrolledY; invalidateRect.width = 3; invalidateRect.height= 100000000; //DrawPlayPosition(); + Refresh(true, &invalidateRect); invalidateRect.x = Clock2x(mPlayClock) - 1; + Refresh(true, &invalidateRect); //DrawPlayPosition(); - Refresh(); + Refresh(false); } } } @@ -230,7 +245,7 @@ Marked.SetX(x2xBar(x)); Marked.SetY(y2yLine(y)); Marked.SetWidth(x2wBar(x)); - Marked.SetHeight(hLine); + Marked.SetHeight(mTrackHeight); wxDC* pDc = new wxClientDC(this); LineText(*pDc, Marked.GetX(), Marked.GetY(), Marked.GetWidth(), ">"); @@ -249,27 +264,36 @@ void JZTrackWindow::OnSize(wxSizeEvent& Event) { GetClientSize(&mCanvasWidth, &mCanvasHeight); - if (mCanvasWidth && mCanvasHeight) + if (mCanvasWidth > 0 && mCanvasHeight > 0) { - SetScrollRanges(); - SetScrollPosition(0, 0); - Refresh(); + mpFrameBuffer->Create(mCanvasWidth, mCanvasHeight); + SetScrollRanges(mScrolledX, mScrolledY); +// SetScrollPosition(0, 0); } } //----------------------------------------------------------------------------- +// Description: +// Do nothing, to avoid flickering. //----------------------------------------------------------------------------- +void JZTrackWindow::OnEraseBackground(wxEraseEvent& Event) +{ +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void JZTrackWindow::ZoomIn() { if (mClocksPerPixel >= 2) { mClocksPerPixel /= 2; - int x = mCanvasX * 2; - int y = mCanvasY; + int x = mScrolledX * 2; + int y = mScrolledY; - SetScrollRanges(); - SetScrollPosition(x, y); - Refresh(); + SetScrollRanges(x, y); +// SetScrollPosition(x, y); + + Refresh(false); } } @@ -280,12 +304,13 @@ if (mClocksPerPixel <= 120) { mClocksPerPixel *= 2; - int x = mCanvasX / 2; - int y = mCanvasY; + int x = mScrolledX / 2; + int y = mScrolledY; - SetScrollRanges(); - SetScrollPosition(x, y); - Refresh(); + SetScrollRanges(x, y); +// SetScrollPosition(x, y); + + Refresh(false); } } @@ -293,57 +318,113 @@ //----------------------------------------------------------------------------- void JZTrackWindow::OnDraw(wxDC& Dc) { - GetViewStart(&mCanvasX, &mCanvasY); - mCanvasX *= mScrollLine; - mCanvasY *= mScrollLine; + Draw(Dc); +} +//----------------------------------------------------------------------------- +// Description: +// Draw the static portion of the scenario in the static bitmap. +//----------------------------------------------------------------------------- +void JZTrackWindow::Draw(wxDC& Dc) +{ + if (!mpFrameBuffer->Ok() || mDrawing) + { + return; + } + + mDrawing = true; + + // Create a memory device context and select the frame bitmap into it. + wxMemoryDC LocalDc; + LocalDc.SelectObject(*mpFrameBuffer); + + LocalDc.SetFont(*mpFont); + + // Setup the brush that is used to clear the background. + LocalDc.SetBackground(*wxWHITE_BRUSH); + + // Clear the background using the brush that was just setup, + // in case the following drawing calls fail. + LocalDc.Clear(); + + // Get the location, in scrolling units, of the upper left hand corner of + // viewable portion of the virtual window that makes up the scrolled window. + // Note that the bitmap we are drawing to always has upper left coordinates + // of (0, 0). The y value is used to draw the proper tracks and the x + // value is used to draw the proper measures or bars. + GetViewStart(&mScrolledX, &mScrolledY); + + // Convert scrolling units into pixels. + mScrolledX *= mScrollLine; + mScrolledY *= mScrollLine; + GetClientSize(&mCanvasWidth, &mCanvasHeight); + cout + << "mCanvasWidth: " << mCanvasWidth + << " mCanvasHeight: " << mCanvasHeight + << endl; - xEvents = mCanvasX + wLeft; - yEvents = mCanvasY + hTop; - wEvents = mCanvasWidth - wLeft; - hEvents = mCanvasHeight - hTop; + mEventsX = mLeftInfoWidth; + mEventsY = mTopInfoHeight; - mFromLine = mCanvasY / hLine; - mToLine = 1 + (mCanvasY + mCanvasHeight - hTop) / hLine; - mFromClock = mCanvasX * mClocksPerPixel; - mToClock = x2Clock(mCanvasX + mCanvasWidth); + mEventsWidth = mCanvasWidth - mLeftInfoWidth; + mEventsHeight = mCanvasHeight - mTopInfoHeight; - xNumber = mCanvasX; - xName = xNumber + wNumber; - xState = xName + wName; - xPatch = xState + wState; + mFromLine = mScrolledY / mTrackHeight; - Dc.DestroyClippingRegion(); + mToLine = 1 + (mScrolledY + mCanvasHeight - mTopInfoHeight) / mTrackHeight; + mFromClock = mScrolledX * mClocksPerPixel; +//OLD mToClock = x2Clock(mScrolledX + mCanvasWidth); + mToClock = x2Clock(mScrolledX + mCanvasWidth - mLeftInfoWidth); + mTrackNameX = mNumberWidth; + mStateX = mTrackNameX + mTrackNameWidth; + mPatchX = mStateX + mStateWidth; - Dc.SetPen(*wxBLACK_PEN); + LocalDc.DestroyClippingRegion(); + LocalDc.SetPen(*wxBLACK_PEN); + // Draw the vertical lines. - DrawVerticalLine(Dc, xNumber); - DrawVerticalLine(Dc, xName); - DrawVerticalLine(Dc, xState); - DrawVerticalLine(Dc, xPatch); + DrawVerticalLine(LocalDc, 0); + DrawVerticalLine(LocalDc, mTrackNameX); + DrawVerticalLine(LocalDc, mStateX); + DrawVerticalLine(LocalDc, mPatchX); - DrawVerticalLine(Dc, xEvents - 1); - DrawHorizontalLine(Dc, yEvents); - DrawHorizontalLine(Dc, yEvents - 1); + DrawVerticalLine(LocalDc, mEventsX - 1); + DrawHorizontalLine(LocalDc, mEventsY); + DrawHorizontalLine(LocalDc, mEventsY - 1); if (mpSong) { JZBarInfo BarInfo(mpSong); + + cout + << "mCanvasWidth - mLeftInfoWidth: " << mCanvasWidth - mLeftInfoWidth << '\n' + << "BarInfo.TicksPerBar " << BarInfo.TicksPerBar << '\n' + << "From Clock: " << mFromClock << '\n' + << "To Clock: " << mToClock << '\n' + << "Clocks/Pixel: " << mClocksPerPixel << '\n' + << "From Measure: " << mFromClock / BarInfo.TicksPerBar << '\n' + << "To Measure: " << mToClock / BarInfo.TicksPerBar +// << "From X: " << mFromClock << '\n' +// << "To X: " << mToClock << '\n' + << endl; + + BarInfo.SetClock(mFromClock); - nBars = 0; - int intro = gpProject->GetIntroLength(); - Dc.SetPen(*wxGREY_PEN); + mBarCount = 0; + int Intro = gpProject->GetIntroLength(); + LocalDc.SetPen(*wxGREY_PEN); while (1) { int x = Clock2x(BarInfo.Clock); - if (x > mCanvasX + mCanvasWidth) + if (x > mScrolledX + mCanvasWidth) { break; } - if (x >= xEvents) // so ne Art clipping + + if (x >= mEventsX) { int c; if (mClocksPerPixel > 48) @@ -354,97 +435,120 @@ { c = 4; } - if (((BarInfo.BarNr - intro + 96) % c) == 0) + if (((BarInfo.BarNr - Intro + 96) % c) == 0) { - Dc.SetPen(*wxBLACK_PEN); + LocalDc.SetPen(*wxBLACK_PEN); ostringstream Oss; - Oss << BarInfo.BarNr + 1 - intro; - Dc.DrawText(Oss.str().c_str(), x + mLittleBit, yEvents - hLine); - Dc.SetPen(*wxGREY_PEN); - Dc.DrawLine(x, yEvents + 1 - hLine, x, yEvents + hEvents); + Oss << BarInfo.BarNr + 1 - Intro; + LocalDc.DrawText(Oss.str().c_str(), x + mLittleBit, mEventsY - mTrackHeight); + LocalDc.SetPen(*wxGREY_PEN); + LocalDc.DrawLine(x, mEventsY + 1 - mTrackHeight, x, mEventsY + mEventsHeight); } else { - Dc.SetPen(*wxLIGHT_GREY_PEN); - Dc.DrawLine(x, yEvents + 1, x, yEvents + hEvents); + LocalDc.SetPen(*wxLIGHT_GREY_PEN); + LocalDc.DrawLine(x, mEventsY + 1, x, mEventsY + mEventsHeight); } // x-coordinate for MouseAction->Snap() - if (nBars < eMaxBars) + if (mBarCount < eMaxBars) { - xBars[nBars++] = x; + mBarX[mBarCount++] = x; } } BarInfo.Next(); } - Dc.SetPen(*wxBLACK_PEN); + LocalDc.SetPen(*wxBLACK_PEN); } // For each track show the MIDI channel, name, state, prg. int TrackNumber = mFromLine; - for (int y = Line2y(TrackNumber); y < yEvents + hEvents; y += hLine) + for (int y = Track2y(TrackNumber); y < mEventsY + mEventsHeight; y += mTrackHeight) { - Dc.SetClippingRegion( - mCanvasX, - yEvents, + LocalDc.SetClippingRegion( + 0, + mEventsY, mCanvasWidth, - hEvents); + mEventsHeight); - Dc.SetPen(*wxGREY_PEN); - Dc.DrawLine(xEvents + 1, y, mCanvasX + mCanvasWidth, y); - Dc.SetPen(*wxBLACK_PEN); - Dc.DrawLine(mCanvasX, y, xEvents, y); + LocalDc.SetPen(*wxGREY_PEN); + LocalDc.DrawLine(mEventsX + 1, y, mCanvasWidth, y); + LocalDc.SetPen(*wxBLACK_PEN); + LocalDc.DrawLine(0, y, mEventsX, y); - Dc.DestroyClippingRegion(); + LocalDc.DestroyClippingRegion(); tTrack* pTrack = gpProject->GetTrack(TrackNumber); if (pTrack) { - Dc.SetClippingRegion( - xName, - yEvents, - wName + wState, - hEvents); + LocalDc.SetClippingRegion( + mTrackNameX, + mEventsY, + mTrackNameWidth + mStateWidth, + mEventsHeight); // Draw the track name. if (pTrack->DialogBox) { // Show the button pressed when the dialog box is open. - LineText(Dc, xName, y, wName, pTrack->GetName(), -1, true); + LineText(LocalDc, mTrackNameX, y, mTrackNameWidth, pTrack->GetName(), -1, true); } else { - LineText(Dc, xName, y, wName, pTrack->GetName(), -1, false); + LineText(LocalDc, mTrackNameX, y, mTrackNameWidth, pTrack->GetName(), -1, false); } // Draw the track status. - LineText(Dc, xState, y, wState, pTrack->GetStateChar()); + LineText(LocalDc, mStateX, y, mStateWidth, pTrack->GetStateChar()); - Dc.DestroyClippingRegion(); + LocalDc.DestroyClippingRegion(); } + else + { + LineText(LocalDc, mTrackNameX, y, mTrackNameWidth, "", -1, false); + LineText(LocalDc, mStateX, y, mStateWidth, ""); + } + ++TrackNumber; } - DrawNumbers(Dc); - DrawSpeed(Dc); - DrawCounters(Dc); + DrawNumbers(LocalDc); + DrawSpeed(LocalDc); + DrawCounters(LocalDc); - LineText(Dc, xState, mCanvasY - 1, wState, "", hTop); + LineText(LocalDc, mStateX, -1, mStateWidth, "", mTopInfoHeight); - DrawEvents(Dc); + DrawEvents(LocalDc); if (Marked.x > 0) { - LineText(Dc, Marked.x, Marked.y, Marked.width, ">"); + LineText(LocalDc, Marked.x, Marked.y, Marked.width, ">"); } - Dc.DestroyClippingRegion(); + LocalDc.DestroyClippingRegion(); - DrawPlayPosition(Dc); + DrawPlayPosition(LocalDc); // Draw the selection box. - mpSnapSel->Draw(Dc, xEvents, yEvents, wEvents, hEvents); + mpSnapSel->Draw(LocalDc, mEventsX, mEventsY, mEventsWidth, mEventsHeight); + +// LocalDc.SetClippingRegion(0, 0, mCanvasWidth, mCanvasHeight); + Dc.Blit( + mScrolledX, + mScrolledY, + mCanvasWidth, + mCanvasHeight, + &LocalDc, + 0, + 0, + wxCOPY); +// LocalDc.DestroyClippingRegion(); + + LocalDc.SetFont(wxNullFont); + LocalDc.SelectObject(wxNullBitmap); + + mDrawing = false; } //----------------------------------------------------------------------------- @@ -454,10 +558,10 @@ //----------------------------------------------------------------------------- void JZTrackWindow::DrawNumbers(wxDC& Dc) { - const char* pString = NumberStr(); - LineText(Dc, xNumber, mCanvasY - 1, wNumber, pString, hTop); + const char* pString = GetNumberString(); + LineText(Dc, 0, -1, mNumberWidth, pString, mTopInfoHeight); - Dc.SetClippingRegion(xNumber, yEvents, wNumber, hEvents); + Dc.SetClippingRegion(0, mEventsY, mNumberWidth, mEventsHeight); for (int i = mFromLine; i < mToLine; ++i) { tTrack* pTrack = gpProject->GetTrack(i); @@ -465,7 +569,7 @@ { if (pTrack->GetAudioMode()) { - LineText(Dc, xNumber, Line2y(i), wNumber, "Au"); + LineText(Dc, 0, Track2y(i), mNumberWidth, "Au"); } else { @@ -473,7 +577,7 @@ switch (mNumberMode) { case eNmTrackNr: - Value = i; + Value = i + 1; break; case eNmMidiChannel: Value = pTrack->Channel; @@ -484,9 +588,13 @@ } ostringstream Oss; Oss << setw(2) << Value; - LineText(Dc, xNumber, Line2y(i), wNumber, Oss.str().c_str()); + LineText(Dc, 0, Track2y(i), mNumberWidth, Oss.str().c_str()); } } + else + { + LineText(Dc, 0, Track2y(i), mNumberWidth, ""); + } } Dc.DestroyClippingRegion(); } @@ -506,7 +614,7 @@ ostringstream Oss; Oss << "speed: " << setw(3) << Value; - LineText(Dc, xName, mCanvasY - 1, wName, Oss.str().c_str(), hTop, Down); + LineText(Dc, mTrackNameX, -1, mTrackNameWidth, Oss.str().c_str(), mTopInfoHeight, Down); } //----------------------------------------------------------------------------- @@ -521,15 +629,11 @@ Dc.SetBrush(*wxBLACK_BRUSH); Dc.SetPen(*wxBLACK_PEN); -// Dc.SetLogicalFunction(wxXOR); - int x = Clock2x(mPlayClock); // Draw a line, 2 pixwels wide. - Dc.DrawLine(x, mCanvasY, x, yEvents + hEvents); - Dc.DrawLine(x + 1, mCanvasY, x + 1, yEvents + hEvents); - -// Dc.SetLogicalFunction(wxCOPY); + Dc.DrawLine(x, 0, x, mEventsY + mEventsHeight); + Dc.DrawLine(x + 1, 0, x + 1, mEventsY + mEventsHeight); } // if (mpNextWin) // { @@ -550,7 +654,7 @@ { if (Height <= 0) { - Height = hLine; + Height = mTrackHeight; y = y2yLine(y); } if (Width && Height) @@ -599,10 +703,10 @@ void JZTrackWindow::DrawCounters(wxDC& Dc) { int i; - const char... [truncated message content] |
From: <pst...@us...> - 2008-03-18 03:56:09
|
Revision: 331 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=331&view=rev Author: pstieber Date: 2008-03-17 20:56:06 -0700 (Mon, 17 Mar 2008) Log Message: ----------- 1. Clicking the mouse on the number mode header toggles the mode between track number and MIDI channel. 2. Changed the way text is horizontally aligned in LineText. Modified Paths: -------------- trunk/jazz/src/TrackWindow.cpp trunk/jazz/src/TrackWindow.h Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2008-03-17 23:05:36 UTC (rev 330) +++ trunk/jazz/src/TrackWindow.cpp 2008-03-18 03:56:06 UTC (rev 331) @@ -42,6 +42,7 @@ BEGIN_EVENT_TABLE(JZTrackWindow, wxScrolledWindow) EVT_SIZE(JZTrackWindow::OnSize) EVT_ERASE_BACKGROUND(JZTrackWindow::OnEraseBackground) + EVT_LEFT_UP(JZTrackWindow::OnLeftButtonUp) END_EVENT_TABLE() //----------------------------------------------------------------------------- @@ -94,8 +95,7 @@ mPatchWidth(0), mBarCount(0), mCounterMode(eCmProgram), -// mNumberMode(eNmMidiChannel), - mNumberMode(eNmTrackNr), + mNumberMode(eNmMidiChannel), mpFixedFont(0), mFixedFontHeight(0), mFontSize(12), @@ -282,6 +282,29 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +void JZTrackWindow::OnLeftButtonUp(wxMouseEvent& Event) +{ + wxPoint Point = Event.GetPosition(); + + // Check to see if the mouse was clicked inside of the number mode + // indicator. + if (Point.x < mNumberWidth && Point.y < mTopInfoHeight) + { + if (mNumberMode == eNmTrackNr) + { + mNumberMode = eNmMidiChannel; + Refresh(false); + } + else + { + mNumberMode = eNmTrackNr; + Refresh(false); + } + } +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void JZTrackWindow::ZoomIn() { if (mClocksPerPixel >= 2) @@ -694,7 +717,14 @@ } wxColor bg = Dc.GetTextBackground(); Dc.SetTextBackground(*mpGreyColor); - Dc.DrawText(pString, x + mLittleBit, y + mLittleBit); + int TextWidth, TextHeight; + Dc.GetTextExtent(pString, &TextWidth, &TextHeight); + int Margin = (Width - TextWidth) / 2; + if (Margin < mLittleBit) + { + Margin = mLittleBit; + } + Dc.DrawText(pString, x + Margin, y + mLittleBit); Dc.SetTextBackground(*wxWHITE); } Modified: trunk/jazz/src/TrackWindow.h =================================================================== --- trunk/jazz/src/TrackWindow.h 2008-03-17 23:05:36 UTC (rev 330) +++ trunk/jazz/src/TrackWindow.h 2008-03-18 03:56:06 UTC (rev 331) @@ -95,6 +95,8 @@ void OnEraseBackground(wxEraseEvent& Event); + void OnLeftButtonUp(wxMouseEvent& Event); + virtual void OnDraw(wxDC& Dc); void Draw(wxDC& Dc); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-18 04:25:06
|
Revision: 333 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=333&view=rev Author: pstieber Date: 2008-03-17 21:25:04 -0700 (Mon, 17 Mar 2008) Log Message: ----------- Added code to increment the default tempo 1 bpm with a left-click on the tempo header and decrement the default tempo 1 bpm with a right-click. Modified Paths: -------------- trunk/jazz/src/TrackWindow.cpp trunk/jazz/src/TrackWindow.h Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2008-03-18 04:09:09 UTC (rev 332) +++ trunk/jazz/src/TrackWindow.cpp 2008-03-18 04:25:04 UTC (rev 333) @@ -43,6 +43,7 @@ EVT_SIZE(JZTrackWindow::OnSize) EVT_ERASE_BACKGROUND(JZTrackWindow::OnEraseBackground) EVT_LEFT_UP(JZTrackWindow::OnLeftButtonUp) + EVT_RIGHT_UP(JZTrackWindow::OnRightButtonUp) END_EVENT_TABLE() //----------------------------------------------------------------------------- @@ -302,6 +303,19 @@ } } else if ( + Point.x >= mTrackNameX && Point.x < mTrackNameX + mTrackNameWidth && + Point.y < mTopInfoHeight) + { + // Bump up the speed value one tick. + int SpeedBpm = gpProject->GetTrack(0)->GetDefaultSpeed(); + ++SpeedBpm; + if (SpeedBpm > 0 && SpeedBpm < 300) + { + gpProject->GetTrack(0)->SetDefaultSpeed(SpeedBpm); + } + Refresh(false); + } + else if ( Point.x >= mPatchX && Point.x < mPatchX + mPatchWidth && Point.y < mTopInfoHeight) { @@ -333,6 +347,27 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +void JZTrackWindow::OnRightButtonUp(wxMouseEvent& Event) +{ + wxPoint Point = Event.GetPosition(); + + if ( + Point.x >= mTrackNameX && Point.x < mTrackNameX + mTrackNameWidth && + Point.y < mTopInfoHeight) + { + // Knock down the speed value one tick. + int SpeedBpm = gpProject->GetTrack(0)->GetDefaultSpeed(); + --SpeedBpm; + if (SpeedBpm > 0 && SpeedBpm < 300) + { + gpProject->GetTrack(0)->SetDefaultSpeed(SpeedBpm); + } + Refresh(false); + } +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void JZTrackWindow::ZoomIn() { if (mClocksPerPixel >= 2) @@ -665,7 +700,14 @@ ostringstream Oss; Oss << "speed: " << setw(3) << Value; - LineText(Dc, mTrackNameX, -1, mTrackNameWidth, Oss.str().c_str(), mTopInfoHeight, Down); + LineText( + Dc, + mTrackNameX, + -1, + mTrackNameWidth, + Oss.str().c_str(), + mTopInfoHeight, + Down); } //----------------------------------------------------------------------------- Modified: trunk/jazz/src/TrackWindow.h =================================================================== --- trunk/jazz/src/TrackWindow.h 2008-03-18 04:09:09 UTC (rev 332) +++ trunk/jazz/src/TrackWindow.h 2008-03-18 04:25:04 UTC (rev 333) @@ -97,6 +97,8 @@ void OnLeftButtonUp(wxMouseEvent& Event); + void OnRightButtonUp(wxMouseEvent& Event); + virtual void OnDraw(wxDC& Dc); void Draw(wxDC& Dc); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-18 14:25:19
|
Revision: 334 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=334&view=rev Author: pstieber Date: 2008-03-18 07:25:17 -0700 (Tue, 18 Mar 2008) Log Message: ----------- 1. Renamed tTrack to JZTrack. 2. Added the ability to changed the state of an individual track between P = ? S = Solo M = Mute by clicking of the state column for the track. Modified Paths: -------------- trunk/jazz/src/Audio.cpp trunk/jazz/src/Audio.h trunk/jazz/src/Command.cpp trunk/jazz/src/Command.h trunk/jazz/src/ControlEdit.cpp trunk/jazz/src/ControlEdit.h trunk/jazz/src/Dialogs.cpp trunk/jazz/src/Dialogs.h trunk/jazz/src/Filter.cpp trunk/jazz/src/Filter.h trunk/jazz/src/HarmonyBrowserAnalyzer.cpp trunk/jazz/src/HarmonyBrowserAnalyzer.h trunk/jazz/src/PianoFrame.cpp trunk/jazz/src/PianoFrame.h trunk/jazz/src/Player.cpp trunk/jazz/src/Player.h trunk/jazz/src/RecordingInfo.h trunk/jazz/src/Rhythm.cpp trunk/jazz/src/Rhythm.h trunk/jazz/src/Song.cpp trunk/jazz/src/Song.h trunk/jazz/src/Track.cpp trunk/jazz/src/Track.h trunk/jazz/src/TrackFrame.cpp trunk/jazz/src/TrackWindow.cpp trunk/jazz/src/TrackWindow.h Modified: trunk/jazz/src/Audio.cpp =================================================================== --- trunk/jazz/src/Audio.cpp 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/Audio.cpp 2008-03-18 14:25:17 UTC (rev 334) @@ -523,7 +523,7 @@ -void tSampleSet::AdjustAudioLength(tTrack *t, long tpm) +void tSampleSet::AdjustAudioLength(JZTrack *t, long tpm) { if (!t->GetAudioMode() || !adjust_audio_length) return; @@ -829,7 +829,7 @@ JZSong *song = gpProject->Song; #endif const JZRecordingInfo* info = gpProject->GetRecInfo(); - tTrack* track = info->mpTrack; + JZTrack* track = info->mpTrack; #ifdef OBSOLETE song->NewUndoBuffer(); #endif Modified: trunk/jazz/src/Audio.h =================================================================== --- trunk/jazz/src/Audio.h 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/Audio.h 2008-03-18 14:25:17 UTC (rev 334) @@ -31,7 +31,7 @@ #include "Project.h" class tEventArray; -class tTrack; +class JZTrack; struct tAudioBuffer; class tAudioBufferQueue; class tAudioRecordBuffer; @@ -268,7 +268,7 @@ return buffers[i]; } - void AdjustAudioLength(tTrack *t, long ticks_per_minute); + void AdjustAudioLength(JZTrack *t, long ticks_per_minute); long Ticks2Samples(long ticks) const { Modified: trunk/jazz/src/Command.cpp =================================================================== --- trunk/jazz/src/Command.cpp 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/Command.cpp 2008-03-18 14:25:17 UTC (rev 334) @@ -43,7 +43,7 @@ public: long Keys[128]; tSelectedKeys(tFilter *f); - void ExecuteEvent(tTrack *t, JZEvent *e); + void ExecuteEvent(JZTrack *t, JZEvent *e); }; tSelectedKeys::tSelectedKeys(tFilter *f) @@ -54,7 +54,7 @@ Keys[i] = 0; } -void tSelectedKeys::ExecuteEvent(tTrack *t, JZEvent *e) +void tSelectedKeys::ExecuteEvent(JZTrack *t, JZEvent *e) { tKeyOn *k = e->IsKeyOn(); if (k) @@ -220,7 +220,7 @@ if (NewUndo) Song->NewUndoBuffer(); tTrackIterator Tracks(Filter, Reverse); - tTrack *t = Tracks.First(); + JZTrack *t = Tracks.First(); while (t) { ExecuteTrack(t); @@ -230,7 +230,7 @@ } -void tCommand::ExecuteTrack(tTrack *t) +void tCommand::ExecuteTrack(JZTrack *t) { tEventIterator Iterator(t); JZEvent *e = Iterator.Range(Filter->FromClock, Filter->ToClock); @@ -244,7 +244,7 @@ } -void tCommand::ExecuteEvent(tTrack *t, JZEvent *e) +void tCommand::ExecuteEvent(JZTrack *t, JZEvent *e) { } @@ -265,7 +265,7 @@ DeltaClock = dclk; } -void tCmdShift::ExecuteEvent(tTrack *t, JZEvent *e) +void tCmdShift::ExecuteEvent(JZTrack *t, JZEvent *e) { JZEvent *c = e->Copy(); t->Kill(e); @@ -297,7 +297,7 @@ } } -void tCmdErase::ExecuteEvent(tTrack *t, JZEvent *e) +void tCmdErase::ExecuteEvent(JZTrack *t, JZEvent *e) { t->Kill(e); } @@ -327,7 +327,7 @@ return Clock > minclk ? Clock : minclk; } -void tCmdQuantize::ExecuteEvent(tTrack *t, JZEvent *e) +void tCmdQuantize::ExecuteEvent(JZTrack *t, JZEvent *e) { tKeyOn *k; if ((k = e->IsKeyOn()) != 0) @@ -358,7 +358,7 @@ FitIntoScale = fit; } -void tCmdTranspose::ExecuteEvent(tTrack *t, JZEvent *e) +void tCmdTranspose::ExecuteEvent(JZTrack *t, JZEvent *e) { tKeyOn *k; if (e->IsKeyOn()) @@ -402,7 +402,7 @@ NewChannel = chan; } -void tCmdSetChannel::ExecuteEvent(tTrack *t, JZEvent *e) +void tCmdSetChannel::ExecuteEvent(JZTrack *t, JZEvent *e) { tChannelEvent *c; @@ -427,7 +427,7 @@ Mode = m; } -void tCmdVelocity::ExecuteEvent(tTrack *t, JZEvent *e) +void tCmdVelocity::ExecuteEvent(JZTrack *t, JZEvent *e) { tKeyOn *k; @@ -462,7 +462,7 @@ Mode = m; } -void tCmdLength::ExecuteEvent(tTrack *t, JZEvent *e) +void tCmdLength::ExecuteEvent(JZTrack *t, JZEvent *e) { tKeyOn *k; @@ -503,7 +503,7 @@ /** move an event according to startclock and scale */ -void tCmdSeqLength::ExecuteEvent(tTrack *t, JZEvent *e) +void tCmdSeqLength::ExecuteEvent(JZTrack *t, JZEvent *e) { //make a copy of the current event JZEvent *k; @@ -536,7 +536,7 @@ //need to override executetrack, since we have begin/end behaviour in this filter -void tCmdConvertToModulation::ExecuteTrack(tTrack *t) +void tCmdConvertToModulation::ExecuteTrack(JZTrack *t) { //JAVE:iterate over all events, make a long event from start until stop of the sequence, //convert all note-on messages to a pitch bend/volume controller pair, velocity -> volume @@ -617,7 +617,7 @@ this->repeat=repeat; } -void tCmdMidiDelay::ExecuteEvent(tTrack *t, JZEvent *e) +void tCmdMidiDelay::ExecuteEvent(JZTrack *t, JZEvent *e) { tKeyOn *k; @@ -646,13 +646,13 @@ shortenOverlaps = so; } -void tCmdCleanup::ExecuteTrack(tTrack *t) +void tCmdCleanup::ExecuteTrack(JZTrack *t) { memset(prev_note, 0, sizeof(prev_note)); tCommand::ExecuteTrack(t); } -void tCmdCleanup::ExecuteEvent(tTrack *t, JZEvent *e) +void tCmdCleanup::ExecuteEvent(JZTrack *t, JZEvent *e) { tKeyOn *k; if ((k = e->IsKeyOn()) != 0) @@ -688,7 +688,7 @@ to = st; } -void tCmdSearchReplace::ExecuteEvent(tTrack *t, JZEvent *e) +void tCmdSearchReplace::ExecuteEvent(JZTrack *t, JZEvent *e) { tControl *ctrl; if ((ctrl = e->IsControl()) != 0) @@ -713,7 +713,7 @@ Buffer = buf; } -void tCmdCopyToBuffer::ExecuteEvent(tTrack *t, JZEvent *e) +void tCmdCopyToBuffer::ExecuteEvent(JZTrack *t, JZEvent *e) { Buffer->Put(e->Copy()); } @@ -742,10 +742,10 @@ -void tCmdCopy::ExecuteTrack(tTrack *s) +void tCmdCopy::ExecuteTrack(JZTrack *s) { long StartClock, StopClock; - tTrack *d; + JZTrack *d; StartClock = DestClock; @@ -862,7 +862,7 @@ { } -void tCmdExchLeftRight::ExecuteEvent(tTrack *t, JZEvent *e) +void tCmdExchLeftRight::ExecuteEvent(JZTrack *t, JZEvent *e) { if (e->IsKeyOn()) { @@ -883,7 +883,7 @@ { } -void tCmdExchUpDown::ExecuteTrack(tTrack *t) +void tCmdExchUpDown::ExecuteTrack(JZTrack *t) { int i; int Keys[128]; @@ -954,7 +954,7 @@ delete binfo; } -void tCmdMapper::ExecuteEvent(tTrack *t, JZEvent *e) +void tCmdMapper::ExecuteEvent(JZTrack *t, JZEvent *e) { tKeyOn *k = e->IsKeyOn(); if (k) Modified: trunk/jazz/src/Command.h =================================================================== --- trunk/jazz/src/Command.h 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/Command.h 2008-03-18 14:25:17 UTC (rev 334) @@ -25,7 +25,7 @@ class tFilter; class JZEvent; -class tTrack; +class JZTrack; class JZSong; class tEventArray; class JZRndArray; @@ -60,8 +60,8 @@ tCommand(tFilter *f); virtual void Execute(int NewUndo = 1); - virtual void ExecuteTrack(tTrack *t); - virtual void ExecuteEvent(tTrack *t, JZEvent *e); + virtual void ExecuteTrack(JZTrack *t); + virtual void ExecuteEvent(JZTrack *t, JZEvent *e); long Interpolate(long clk, long vmin, long vmax); virtual ~tCommand() {} }; @@ -72,7 +72,7 @@ long DeltaClock; public: tCmdShift(tFilter *f, long DeltaClock); - virtual void ExecuteEvent(tTrack *t, JZEvent *e); + virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -82,7 +82,7 @@ int LeaveSpace; tCmdErase(tFilter *f, int LeaveSpace = 1); virtual void Execute(int NewUndo = 1); - virtual void ExecuteEvent(tTrack *t, JZEvent *e); + virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; class tCmdVelocity : public tCommand @@ -90,7 +90,7 @@ public: int FromValue, ToValue, Mode; tCmdVelocity(tFilter *f, int From, int To, int Mode); - virtual void ExecuteEvent(tTrack *t, JZEvent *e); + virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -99,7 +99,7 @@ public: int FromValue, ToValue, Mode; tCmdLength(tFilter *f, int From, int To, int Mode); - virtual void ExecuteEvent(tTrack *t, JZEvent *e); + virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -109,7 +109,7 @@ double scale; long startClock; tCmdSeqLength(tFilter *f, double scale); - virtual void ExecuteEvent(tTrack *t, JZEvent *e); + virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -122,7 +122,7 @@ int repeat; tCmdMidiDelay(tFilter *f, double scale, long clockDelay, int repeat); - virtual void ExecuteEvent(tTrack *t, JZEvent *e); + virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; class tCmdConvertToModulation : public tCommand @@ -130,7 +130,7 @@ public: tCmdConvertToModulation(tFilter *f); - virtual void ExecuteTrack(tTrack *t); + virtual void ExecuteTrack(JZTrack *t); }; @@ -144,8 +144,8 @@ tKeyOn *prev_note[16][128]; public: tCmdCleanup(tFilter *f, long limitClocks, int shortenOverlaps); - virtual void ExecuteTrack(tTrack *t); - virtual void ExecuteEvent(tTrack *t, JZEvent *e); + virtual void ExecuteTrack(JZTrack *t); + virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -154,7 +154,7 @@ short fr, to; public: tCmdSearchReplace(tFilter *f, short fr, short to); - virtual void ExecuteEvent(tTrack *t, JZEvent *e); + virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -168,7 +168,7 @@ int Delay; // zero int Groove; // zero tCmdQuantize(tFilter *f, long QntClocks, int groove, int delay); - virtual void ExecuteEvent(tTrack *t, JZEvent *e); + virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -179,7 +179,7 @@ int FitIntoScale; tScale Scale; tCmdTranspose(tFilter *f, int Notes, int ScaleNr = 0, int FitIntoScale = 0); - virtual void ExecuteEvent(tTrack *t, JZEvent *e); + virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -188,7 +188,7 @@ public: int NewChannel; // 0 tCmdSetChannel(tFilter *f, int NewChannel); - virtual void ExecuteEvent(tTrack *t, JZEvent *e); + virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -197,7 +197,7 @@ tEventArray *Buffer; public: tCmdCopyToBuffer(tFilter *f, tEventArray *Buffer); - virtual void ExecuteEvent(tTrack *t, JZEvent *e); + virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -214,7 +214,7 @@ long RepeatClock; // -1L tCmdCopy(tFilter *f, long DestTrack, long DestClock); - virtual void ExecuteTrack(tTrack *t); + virtual void ExecuteTrack(JZTrack *t); }; @@ -223,14 +223,14 @@ { public: tCmdExchLeftRight(tFilter *f); - virtual void ExecuteEvent(tTrack *t, JZEvent *e); + virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; class tCmdExchUpDown : public tCommand { public: tCmdExchUpDown(tFilter *f); - virtual void ExecuteTrack(tTrack *t); + virtual void ExecuteTrack(JZTrack *t); }; class tCmdMapper : public tCommand @@ -239,7 +239,7 @@ enum prop { veloc, length, key, rhythm, random, pan, modul, cc1, cc2, pitch, clock }; tCmdMapper(tFilter *f, prop src, prop dst, JZRndArray &array, int nbars, int add); ~tCmdMapper(); - virtual void ExecuteEvent(tTrack *t, JZEvent *e); + virtual void ExecuteEvent(JZTrack *t, JZEvent *e); private: int n_bars; int start_bar; Modified: trunk/jazz/src/ControlEdit.cpp =================================================================== --- trunk/jazz/src/ControlEdit.cpp 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/ControlEdit.cpp 2008-03-18 14:25:17 UTC (rev 334) @@ -131,7 +131,7 @@ } -void tCtrlEditBase::ReInit(tTrack *t, long fc, long cpp) +void tCtrlEditBase::ReInit(JZTrack *t, long fc, long cpp) { int w, h; edit->GetSize(&w, &h); Modified: trunk/jazz/src/ControlEdit.h =================================================================== --- trunk/jazz/src/ControlEdit.h 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/ControlEdit.h 2008-03-18 14:25:17 UTC (rev 334) @@ -26,7 +26,7 @@ #include "Random.h" class JZPianoFrame; -class tTrack; +class JZTrack; class JZEvent; class tCtrlEditBase; @@ -55,7 +55,7 @@ tCtrlEditBase(int min, int max, JZPianoFrame *parent, 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(tTrack *track, long FromClock, long ClocksPerPixel); + 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 @@ -82,7 +82,7 @@ // SN++ int x_off; int ctrlmode; - tTrack *track; + JZTrack *track; long from_clock; long to_clock; long i_max; Modified: trunk/jazz/src/Dialogs.cpp =================================================================== --- trunk/jazz/src/Dialogs.cpp 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/Dialogs.cpp 2008-03-18 14:25:17 UTC (rev 334) @@ -730,14 +730,14 @@ { public: - tTrack *Track; + JZTrack *Track; tClockDlg ClockDlg; JZPianoFrame* Win; JZEvent *Event; JZEvent *Copy; - tEventDlg(JZEvent *e, JZPianoFrame* w, tTrack *t); + tEventDlg(JZEvent *e, JZPianoFrame* w, JZTrack *t); virtual void AddProperties(); virtual bool OnClose(); virtual void OnHelp(); @@ -745,7 +745,7 @@ }; -tEventDlg::tEventDlg(JZEvent *e, JZPianoFrame* w, tTrack *t) +tEventDlg::tEventDlg(JZEvent *e, JZPianoFrame* w, JZTrack *t) : tPropertyListDlg( "Event" ), ClockDlg(w->Song, "Time ", e->GetClock()) { @@ -790,7 +790,7 @@ int Channel; - tChEventDlg(tChannelEvent *e, JZPianoFrame* w, tTrack *t) + tChEventDlg(tChannelEvent *e, JZPianoFrame* w, JZTrack *t) : tEventDlg(e, w, t) { Channel = e->Channel + 1; // 1..16 @@ -830,14 +830,14 @@ // SN++ int OffVeloc; - tKeyOnDlg(tKeyOn *e, JZPianoFrame* w, tTrack *t); + tKeyOnDlg(tKeyOn *e, JZPianoFrame* w, JZTrack *t); void AddProperties(); bool OnClose(); }; -tKeyOnDlg::tKeyOnDlg(tKeyOn *e, JZPianoFrame* w, tTrack *t) +tKeyOnDlg::tKeyOnDlg(tKeyOn *e, JZPianoFrame* w, JZTrack *t) : tChEventDlg(e, w, t), PitchDlg("Pitch", e->Key) { @@ -901,14 +901,14 @@ int Value; - tPitchDlg(tPitch *e, JZPianoFrame* w, tTrack *t); + tPitchDlg(tPitch *e, JZPianoFrame* w, JZTrack *t); void AddProperties(); bool OnClose(); }; -tPitchDlg::tPitchDlg(tPitch *e, JZPianoFrame* w, tTrack *t) +tPitchDlg::tPitchDlg(tPitch *e, JZPianoFrame* w, JZTrack *t) : tChEventDlg(e, w, t) { Event = e; @@ -944,14 +944,14 @@ int Control; //tNamedChoice Choice; - tControlDlg(tControl *e, JZPianoFrame* w, tTrack *t); + tControlDlg(tControl *e, JZPianoFrame* w, JZTrack *t); void AddProperties(); bool OnClose(); }; -tControlDlg::tControlDlg(tControl *e, JZPianoFrame* w, tTrack *t) +tControlDlg::tControlDlg(tControl *e, JZPianoFrame* w, JZTrack *t) : tChEventDlg(e, w, t) //, Choice("Controller", &gpConfig->CtrlName(0), &Control) { @@ -1006,14 +1006,14 @@ tNamedChoice Choice; - tPlayTrackDlg(tPlayTrack *e, JZPianoFrame* w, tTrack *t); + tPlayTrackDlg(tPlayTrack *e, JZPianoFrame* w, JZTrack *t); void AddProperties(); bool OnClose(); }; -tPlayTrackDlg::tPlayTrackDlg(tPlayTrack *e, JZPianoFrame* w, tTrack *t) +tPlayTrackDlg::tPlayTrackDlg(tPlayTrack *e, JZPianoFrame* w, JZTrack *t) : tEventDlg(e, w, t), Choice("playtrack", gpConfig->GetControlNames(), &track) { @@ -1065,14 +1065,14 @@ int track; tNamedChoice Choice; - tTextDlg(tText *e, JZPianoFrame* w, tTrack *t); + tTextDlg(tText *e, JZPianoFrame* w, JZTrack *t); void AddProperties(); bool OnClose(); }; -tTextDlg::tTextDlg(tText *e, JZPianoFrame* w, tTrack *t) +tTextDlg::tTextDlg(tText *e, JZPianoFrame* w, JZTrack *t) : tEventDlg(e, w, t), Choice("text", gpConfig->GetControlNames(), &track) { @@ -1112,14 +1112,14 @@ tNamedChoice Choice; - tEndOfTrackDlg(tEndOfTrack *e, JZPianoFrame* w, tTrack *t); + tEndOfTrackDlg(tEndOfTrack *e, JZPianoFrame* w, JZTrack *t); void AddProperties(); bool OnClose(); }; -tEndOfTrackDlg::tEndOfTrackDlg(tEndOfTrack *e, JZPianoFrame* w, tTrack *t) +tEndOfTrackDlg::tEndOfTrackDlg(tEndOfTrack *e, JZPianoFrame* w, JZTrack *t) : tEventDlg(e, w, t), Choice("End Of Track", gpConfig->GetControlNames(), &track) { @@ -1149,14 +1149,14 @@ int Program; // tNamedChoice Choice; - tProgramDlg(tProgram *e, JZPianoFrame* w, tTrack *t); + tProgramDlg(tProgram *e, JZPianoFrame* w, JZTrack *t); void AddProperties(); bool OnClose(); }; -tProgramDlg::tProgramDlg(tProgram *e, JZPianoFrame* w, tTrack *t) +tProgramDlg::tProgramDlg(tProgram *e, JZPianoFrame* w, JZTrack *t) : tEventDlg(e, w, t), Program(e->Program + 1) //, Choice("Program", &gpConfig->VoiceName(0), &Program) @@ -1194,14 +1194,14 @@ int Value; - tSetTempoDlg(tSetTempo *e, JZPianoFrame* w, tTrack *t); + tSetTempoDlg(tSetTempo *e, JZPianoFrame* w, JZTrack *t); void AddProperties(); bool OnClose(); }; -tSetTempoDlg::tSetTempoDlg(tSetTempo *e, JZPianoFrame* w, tTrack *t) +tSetTempoDlg::tSetTempoDlg(tSetTempo *e, JZPianoFrame* w, JZTrack *t) : tEventDlg(e, w, t) { Event = e; @@ -1234,14 +1234,14 @@ char *str; - tSysexDlg(tSysEx *s, JZPianoFrame* w, tTrack *t); + tSysexDlg(tSysEx *s, JZPianoFrame* w, JZTrack *t); void AddProperties(); bool OnClose(); }; -tSysexDlg::tSysexDlg(tSysEx *s, JZPianoFrame* w, tTrack *t) +tSysexDlg::tSysexDlg(tSysEx *s, JZPianoFrame* w, JZTrack *t) : tEventDlg(s, w, t) { Event = s; @@ -1452,7 +1452,7 @@ void EventDialog( JZEvent* e, JZPianoFrame* w, - tTrack* t, + JZTrack* t, long Clock, int Channel, int Pitch) Modified: trunk/jazz/src/Dialogs.h =================================================================== --- trunk/jazz/src/Dialogs.h 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/Dialogs.h 2008-03-18 14:25:17 UTC (rev 334) @@ -29,7 +29,7 @@ class tFilter; class JZSong; class JZEventFrame; -class tTrack; +class JZTrack; class JZEvent; class tShiftDlg : public tPropertyListDlg @@ -250,7 +250,7 @@ void EventDialog( JZEvent*, JZPianoFrame*, - tTrack*, + JZTrack*, long Clock, int Channel, int Pitch); Modified: trunk/jazz/src/Filter.cpp =================================================================== --- trunk/jazz/src/Filter.cpp 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/Filter.cpp 2008-03-18 14:25:17 UTC (rev 334) @@ -215,7 +215,7 @@ } -tTrack *tTrackIterator::First() +JZTrack *tTrackIterator::First() { if (Reverse) TrackNr = Filter->ToTrack; @@ -225,7 +225,7 @@ } -tTrack *tTrackIterator::Next() +JZTrack *tTrackIterator::Next() { if (Reverse) { Modified: trunk/jazz/src/Filter.h =================================================================== --- trunk/jazz/src/Filter.h 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/Filter.h 2008-03-18 14:25:17 UTC (rev 334) @@ -26,7 +26,7 @@ #include "Events.h" class JZSong; -class tTrack; +class JZTrack; #define FltKeyOn 0 @@ -126,8 +126,8 @@ int Reverse; public: tTrackIterator(tFilter *f, int Reverse = 0); - tTrack *First(); - tTrack *Next(); + JZTrack *First(); + JZTrack *Next(); int Count() const; }; Modified: trunk/jazz/src/HarmonyBrowserAnalyzer.cpp =================================================================== --- trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2008-03-18 14:25:17 UTC (rev 334) @@ -121,10 +121,10 @@ } -void HBAnalyzer::IterateEvents(void (HBAnalyzer::*Action)(tKeyOn *on, tTrack *t)) +void HBAnalyzer::IterateEvents(void (HBAnalyzer::*Action)(tKeyOn *on, JZTrack *t)) { tTrackIterator Tracks(filter); - tTrack *t = Tracks.First(); + JZTrack *t = Tracks.First(); while (t) { if (!t->IsDrumTrack()) @@ -154,7 +154,7 @@ return (step * (to - fr)) / steps + fr; } -void HBAnalyzer::CountEvent(tKeyOn *on, tTrack *t) +void HBAnalyzer::CountEvent(tKeyOn *on, JZTrack *t) { for (int i = 0; i < steps; i++) { @@ -176,7 +176,7 @@ } -void HBAnalyzer::TransposeEvent(tKeyOn *on, tTrack *track) +void HBAnalyzer::TransposeEvent(tKeyOn *on, JZTrack *track) { for (int i = 0; i < steps; i++) { Modified: trunk/jazz/src/HarmonyBrowserAnalyzer.h =================================================================== --- trunk/jazz/src/HarmonyBrowserAnalyzer.h 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/HarmonyBrowserAnalyzer.h 2008-03-18 14:25:17 UTC (rev 334) @@ -24,7 +24,7 @@ #define JZ_HARMONYBROWSERANALYZER_H class tFilter; -class tTrack; +class JZTrack; class HBContext; class tKeyOn; class HBChord; @@ -51,11 +51,11 @@ int eighths_per_chord; int steps; tFilter* filter; - tTrack* track; + JZTrack* track; - void IterateEvents(void (HBAnalyzer::*Action)(tKeyOn *on, tTrack *t)); - void CountEvent(tKeyOn *on, tTrack *t); - void TransposeEvent(tKeyOn *on, tTrack *t); + void IterateEvents(void (HBAnalyzer::*Action)(tKeyOn *on, JZTrack *t)); + void CountEvent(tKeyOn *on, JZTrack *t); + void TransposeEvent(tKeyOn *on, JZTrack *t); void CreateChords(); int NumCount(int i); int MaxCount(int i, const HBChord &done); Modified: trunk/jazz/src/PianoFrame.cpp =================================================================== --- trunk/jazz/src/PianoFrame.cpp 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/PianoFrame.cpp 2008-03-18 14:25:17 UTC (rev 334) @@ -250,7 +250,7 @@ { } void KeyOn( - tTrack *t, + JZTrack *t, int Pitch, int Channel, int Veloc = 64, @@ -260,10 +260,10 @@ private: - tTrack *track; + JZTrack *track; }; -void tListen::KeyOn(tTrack *t, int pitch, int channel, int veloc, int milli) +void tListen::KeyOn(JZTrack *t, int pitch, int channel, int veloc, int milli) { if (!Active) { @@ -1096,7 +1096,7 @@ } -int JZPianoFrame::IsVisible(tTrack *t) +int JZPianoFrame::IsVisible(JZTrack *t) { if (!VisibleAllTracks) return t == Track; @@ -1384,7 +1384,7 @@ int i; for (i = 0; i < Song->nTracks; i++) { - tTrack *t = Song->GetTrack(i); + JZTrack *t = Song->GetTrack(i); if (t != Track && IsVisible(t)) DrawEvents(dc, t, StatKeyOn, wxLIGHT_GREY_BRUSH, TRUE); } @@ -1603,7 +1603,7 @@ -void JZPianoFrame::DrawEvents(wxDC* dc, tTrack *t, int Stat, const wxBrush* Brush, int force_color) +void JZPianoFrame::DrawEvents(wxDC* dc, JZTrack *t, int Stat, const wxBrush* Brush, int force_color) { //dc->SetClippingRegion(mEventsX, mEventsY, mEventsWidth, mEventsHeight); dc->SetBrush(*Brush); @@ -1748,7 +1748,7 @@ } -JZEvent *JZPianoFrame::FindEvent(tTrack *Track, int Clock, int Pitch) +JZEvent *JZPianoFrame::FindEvent(JZTrack *Track, int Clock, int Pitch) // Pitch == -1: search for any pitches { tEventIterator Iterator(Track); @@ -1774,7 +1774,7 @@ } -void JZPianoFrame::kill_keys_aftertouch(tTrack *t, JZEvent* pEvent) +void JZPianoFrame::kill_keys_aftertouch(JZTrack *t, JZEvent* pEvent) { int key,channel; tEventIterator iter(t); @@ -1805,7 +1805,7 @@ } } -void JZPianoFrame::paste_keys_aftertouch(tTrack *t, JZEvent* pEvent) +void JZPianoFrame::paste_keys_aftertouch(JZTrack *t, JZEvent* pEvent) { int key,channel; tEventIterator iter(t); @@ -1849,7 +1849,7 @@ -void JZPianoFrame::Copy(tTrack *t, JZEvent* pEvent, int Kill) +void JZPianoFrame::Copy(JZTrack *t, JZEvent* pEvent, int Kill) { if (!pEvent) { @@ -1900,7 +1900,7 @@ } -void JZPianoFrame::Paste(tTrack *t, int Clock, int Pitch) +void JZPianoFrame::Paste(JZTrack *t, int Clock, int Pitch) { if (PasteBuffer.nEvents == 0) { @@ -2105,7 +2105,7 @@ tKeyOn *KeyOn; tKeyOn *Copy; JZPianoFrame *Win; - tTrack *Track; + JZTrack *Track; wxDC *dc; public: @@ -2224,7 +2224,7 @@ tPlayTrack *KeyOn; tPlayTrack *Copy; JZPianoFrame *Win; - tTrack *Track; + JZTrack *Track; wxDC *dc; public: @@ -2436,7 +2436,7 @@ int i; for (i = 0; i < Song->nTracks; i++) { - tTrack *t = Song->GetTrack(i); + JZTrack *t = Song->GetTrack(i); if (IsVisible(t) && FindEvent(t, Clock, Pitch)) { NewPosition(i, -1L); Modified: trunk/jazz/src/PianoFrame.h =================================================================== --- trunk/jazz/src/PianoFrame.h 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/PianoFrame.h 2008-03-18 14:25:17 UTC (rev 334) @@ -31,7 +31,7 @@ class JZToolBar; class tFilter; class tCtrlEditBase; -class tTrack; +class JZTrack; class JZPianoWindow; //***************************************************************************** @@ -80,7 +80,7 @@ int mFromLines[eMaxTrackCount]; int IsVisible(JZEvent *e); - int IsVisible(tTrack *t); + int IsVisible(JZTrack *t); void VisibleDialog(); bool VisibleKeyOn; bool VisiblePitch; @@ -117,10 +117,10 @@ void SnapDlg(wxCommandEvent& Event); int TrackNr; // aktueller Track - tTrack *Track; + JZTrack *Track; tEventArray PasteBuffer; - void DrawEvents(wxDC* dc, tTrack *t, int Stat, const wxBrush* Brush, int force_colors); + void DrawEvents(wxDC* dc, JZTrack *t, int Stat, const wxBrush* Brush, int force_colors); void DrawEvent(wxDC* dc, JZEvent *, const wxBrush* Brush, int xoor, int force_color=0); void DrawPianoRoll(wxDC* dc); @@ -138,12 +138,12 @@ // Utils int y2Pitch(int y); int Pitch2y(int Pitch); - JZEvent *FindEvent(tTrack *t, int Clock, int Pitch); - void Copy(tTrack *t, JZEvent *e, int Kill); - void Paste(tTrack *t, int Clock, int Pitch); + JZEvent *FindEvent(JZTrack *t, int Clock, int Pitch); + void Copy(JZTrack *t, JZEvent *e, int Kill); + void Paste(JZTrack *t, int Clock, int Pitch); // SN++ Key_Aftertouch Utils - void paste_keys_aftertouch(tTrack *t, JZEvent *e); - void kill_keys_aftertouch(tTrack *t, JZEvent *e); + void paste_keys_aftertouch(JZTrack *t, JZEvent *e); + void kill_keys_aftertouch(JZTrack *t, JZEvent *e); int nKeyOnEvents(); void LogicalMousePosition(wxMouseEvent &e, int *x, int *y); Modified: trunk/jazz/src/Player.cpp =================================================================== --- trunk/jazz/src/Player.cpp 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/Player.cpp 2008-03-18 14:25:17 UTC (rev 334) @@ -237,7 +237,7 @@ AudioBuffer->Clear(); } - tTrack *t; + JZTrack *t; if ( !Continue ) { @@ -510,7 +510,7 @@ for (ii = 0; ii < Song->nTracks; ii++) { - tTrack *Track = Song->GetTrack(ii); + JZTrack *Track = Song->GetTrack(ii); if (Track) { tEventIterator Iterator(Track); @@ -635,7 +635,7 @@ -void tPlayer::OutNow(tTrack *t, tParam *r) { +void tPlayer::OutNow(JZTrack *t, tParam *r) { OutNow(t, &r->Msb); OutNow(t, &r->Lsb); OutNow(t, &r->DataMsb); Modified: trunk/jazz/src/Player.h =================================================================== --- trunk/jazz/src/Player.h 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/Player.h 2008-03-18 14:25:17 UTC (rev 334) @@ -207,7 +207,7 @@ virtual const char *GetSampleName(int i) { return samples.GetSampleName(i); } - virtual void AdjustAudioLength(tTrack *t) { + virtual void AdjustAudioLength(JZTrack *t) { long ticks_per_minute = Song->TicksPerQuarter * Song->Speed(); samples.AdjustAudioLength(t, ticks_per_minute); } @@ -242,7 +242,7 @@ virtual void OutBreak() = 0; // send event immediately ignoring clock - void OutNow(tTrack *t, JZEvent* pEvent) + void OutNow(JZTrack *t, JZEvent* pEvent) { pEvent->SetDevice(t->GetDevice()); OutNow(pEvent); @@ -254,7 +254,7 @@ OutNow(pEvent); } - void OutNow(tTrack *t, tParam *r); + void OutNow(JZTrack *t, tParam *r); // what's played right now? virtual long GetRealTimeClock() = 0; Modified: trunk/jazz/src/RecordingInfo.h =================================================================== --- trunk/jazz/src/RecordingInfo.h 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/RecordingInfo.h 2008-03-18 14:25:17 UTC (rev 334) @@ -23,7 +23,7 @@ #ifndef JZ_RECORDINGINFO_H #define JZ_RECORDINGINFO_H -class tTrack; +class JZTrack; //***************************************************************************** // Description: @@ -35,7 +35,7 @@ JZRecordingInfo(); // If the track pointer is not set, the code is not recording. - tTrack* mpTrack; + JZTrack* mpTrack; // This is the recording from clock. long mFromClock; Modified: trunk/jazz/src/Rhythm.cpp =================================================================== --- trunk/jazz/src/Rhythm.cpp 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/Rhythm.cpp 2008-03-18 14:25:17 UTC (rev 334) @@ -260,7 +260,7 @@ } -void tRhythm::GenerateEvent(tTrack *track, long clock, short vel, short len) +void tRhythm::GenerateEvent(JZTrack *track, long clock, short vel, short len) { int chan = track->Channel - 1; @@ -296,7 +296,7 @@ #if 0 -void tRhythm::Generate(tTrack *track, long fr_clock, long to_clock, long ticks_per_bar) +void tRhythm::Generate(JZTrack *track, long fr_clock, long to_clock, long ticks_per_bar) { int chan = track->Channel - 1; long clock = fr_clock; @@ -404,7 +404,7 @@ } -void tRhythm::Generate(tTrack *track, JZBarInfo &bi, tRhythm *rhy[], int n_rhy) +void tRhythm::Generate(JZTrack *track, JZBarInfo &bi, tRhythm *rhy[], int n_rhy) { JZRndArray rrg(rhythm); @@ -1035,7 +1035,7 @@ long fr_clock = pFilter->FromClock; long to_clock = pFilter->ToClock; - tTrack *track = song->GetTrack(pFilter->FromTrack); + JZTrack *track = song->GetTrack(pFilter->FromTrack); song->NewUndoBuffer(); // remove selection Modified: trunk/jazz/src/Rhythm.h =================================================================== --- trunk/jazz/src/Rhythm.h 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/Rhythm.h 2008-03-18 14:25:17 UTC (rev 334) @@ -29,7 +29,7 @@ #include <iostream> -class tTrack; +class JZTrack; class JZEventFrame; class JZSong; class JZBarInfo; @@ -101,10 +101,10 @@ char const * GetLabel() { return label; } void SetLabel(char const *); - void Generate(tTrack *track, long fr_clock, long to_clock, long ticks_per_bar); - void Generate(tTrack *track, JZBarInfo &bi, tRhythm *rhy[], int n_rhy); + void Generate(JZTrack *track, long fr_clock, long to_clock, long ticks_per_bar); + void Generate(JZTrack *track, JZBarInfo &bi, tRhythm *rhy[], int n_rhy); void GenInit(long start_clock); - void GenerateEvent(tTrack *track, long clock, short vel, short len); + void GenerateEvent(JZTrack *track, long clock, short vel, short len); void write(std::ostream& os); void read(std::istream& is, int version); Modified: trunk/jazz/src/Song.cpp =================================================================== --- trunk/jazz/src/Song.cpp 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/Song.cpp 2008-03-18 14:25:17 UTC (rev 334) @@ -121,7 +121,7 @@ } -tTrack *JZSong::GetTrack(int Nr) +JZTrack *JZSong::GetTrack(int Nr) { if (Nr >= 0 && Nr < nTracks) { @@ -204,7 +204,7 @@ for (i = 0; i < nTracks; ++i) { - tTrack* pTrack = &mTracks[i]; + JZTrack* pTrack = &mTracks[i]; if (pTrack->State == tsSolo || (!solo && pTrack->State == tsPlay)) { if (pTrack->GetAudioMode() != mode) @@ -245,7 +245,7 @@ if(recursionDepth>100) //yes yes, you should use symbolics... return; fprintf(stderr, "playtrack %d\n",c->track); - tTrack* pTrack = &mTracks[c->track];//the track we want to play + 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 JZEvent *f; @@ -469,7 +469,7 @@ double f = (double)NewTicks / (double)TicksPerQuarter; for (tt = 0; tt < nTracks; ++tt) { - tTrack* pTrack = &mTracks[tt]; + JZTrack* pTrack = &mTracks[tt]; for (ee = 0; ee < pTrack->nEvents; ee++) { JZEvent *e = pTrack->Events[ee]; @@ -503,7 +503,7 @@ // evtl vorhandene TimeSignatures loeschen - tTrack* pTrack = &mTracks[0]; + JZTrack* pTrack = &mTracks[0]; tEventIterator Iterator(pTrack); JZEvent *e = Iterator.Range(FrClock, ToClock); while (e) @@ -552,7 +552,7 @@ // SN++ void JZSong::moveTrack(int from, int to) { - tTrack* pTrack; + JZTrack* pTrack; int i; if (from == to) return; Modified: trunk/jazz/src/Song.h =================================================================== --- trunk/jazz/src/Song.h 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/Song.h 2008-03-18 14:25:17 UTC (rev 334) @@ -73,7 +73,7 @@ int nTracks; int TicksPerQuarter; - tTrack mTracks[eMaxTrackCount]; + JZTrack mTracks[eMaxTrackCount]; void NewUndoBuffer(); void Undo(); @@ -86,7 +86,7 @@ void Read(tReadBase &io, const char *fname = 0); void Write(tWriteBase &io, const char *fname = 0); - tTrack *GetTrack(int Nr); + JZTrack *GetTrack(int Nr); int GetLastClock(); int NumUsedTracks(); // number of used tracks int Speed(); Modified: trunk/jazz/src/Track.cpp =================================================================== --- trunk/jazz/src/Track.cpp 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/Track.cpp 2008-03-18 14:25:17 UTC (rev 334) @@ -1682,7 +1682,7 @@ class tTrackDlg : public wxForm { JZTrackWindow* TrackWin; - tTrack *trk; + JZTrack *trk; char *TrackName; tNamedChoice PatchChoice; tNamedChoice DeviceChoice; @@ -1693,7 +1693,7 @@ int AudioMode; public: - tTrackDlg::tTrackDlg(JZTrackWindow *w, tTrack *t); + tTrackDlg::tTrackDlg(JZTrackWindow *w, JZTrack *t); void EditForm(wxPanel *panel); virtual void OnOk(); virtual void OnCancel(); @@ -1701,7 +1701,7 @@ }; -tTrackDlg::tTrackDlg(JZTrackWindow *w, tTrack *t) +tTrackDlg::tTrackDlg(JZTrackWindow *w, JZTrack *t) : wxForm(USED_WXFORM_BUTTONS), PatchChoice( "Patch", @@ -1903,7 +1903,7 @@ #endif // OBSOLETE -void tTrack::Dialog(JZTrackWindow *parent) +void JZTrack::Dialog(JZTrackWindow *parent) { #ifdef OBSOLETE @@ -1929,13 +1929,13 @@ // *********************************************************************** -// tTrack +// JZTrack // *********************************************************************** -bool tTrack::changed = false; +bool JZTrack::changed = false; -tTrack::tTrack() +JZTrack::JZTrack() : tEventArray() { iUndo = 0; @@ -1946,12 +1946,12 @@ } -bool tTrack::IsDrumTrack() +bool JZTrack::IsDrumTrack() { return Channel == gpConfig->GetValue(C_DrumChannel); } -void tTrack::Merge(tEventArray *t) +void JZTrack::Merge(tEventArray *t) { for (int i = 0; i < t->nEvents; i++) { @@ -1961,7 +1961,7 @@ } -void tTrack::MergeRange(tEventArray *other, int FromClock, int ToClock, int Replace) +void JZTrack::MergeRange(tEventArray *other, int FromClock, int ToClock, int Replace) { // Erase destin if (Replace) @@ -1996,7 +1996,7 @@ } -void tTrack::Cleanup() +void JZTrack::Cleanup() { // on audio tracks, adjust length of keyon events to // actual sample length @@ -2007,7 +2007,7 @@ -void tTrack::Undo() +void JZTrack::Undo() { if (nUndo > 0) { @@ -2035,7 +2035,7 @@ } } -void tTrack::Redo() +void JZTrack::Redo() { if (nRedo > 0) { @@ -2065,7 +2065,7 @@ } -void tTrack::NewUndoBuffer() +void JZTrack::NewUndoBuffer() { nRedo = 0; nUndo++; @@ -2079,7 +2079,7 @@ }; -void tTrack::Clear() +void JZTrack::Clear() { for (int i = 0; i < MaxUndo; i++) { @@ -2091,7 +2091,7 @@ // ----------------------- Copyright ------------------------------------ -char* tTrack::GetCopyright() +char* JZTrack::GetCopyright() { if (Copyright) { @@ -2102,7 +2102,7 @@ -void tTrack::SetCopyright(char *str) +void JZTrack::SetCopyright(char *str) { if (Copyright) { @@ -2122,7 +2122,7 @@ // ----------------------- Name ------------------------------------ -char* tTrack::GetName() +char* JZTrack::GetName() { if (mName) { @@ -2133,7 +2133,7 @@ -void tTrack::SetName(char *str) +void JZTrack::SetName(char *str) { if (mName) { @@ -2148,7 +2148,7 @@ // ------------------------ Volume ------------------------------ -int tTrack::GetVolume() +int JZTrack::GetVolume() { if (Volume) { @@ -2157,7 +2157,7 @@ return 0; } -void tTrack::SetVolume(int Value) +void JZTrack::SetVolume(int Value) { if (Volume) { @@ -2174,7 +2174,7 @@ // ------------------------ Pan ------------------------------ -int tTrack::GetPan() +int JZTrack::GetPan() { if (Pan) { @@ -2183,7 +2183,7 @@ return 0; } -void tTrack::SetPan(int Value) +void JZTrack::SetPan(int Value) { if (Pan) { @@ -2200,7 +2200,7 @@ // ------------------------ Reverb ------------------------------ -int tTrack::GetReverb() +int JZTrack::GetReverb() { if (Reverb) { @@ -2209,7 +2209,7 @@ return 0; } -void tTrack::SetReverb(int Value) +void JZTrack::SetReverb(int Value) { if (Reverb) { @@ -2226,7 +2226,7 @@ // ------------------------ Chorus ------------------------------ -int tTrack::GetChorus() +int JZTrack::GetChorus() { if (Chorus) { @@ -2235,7 +2235,7 @@ return 0; } -void tTrack::SetChorus(int Value) +void JZTrack::SetChorus(int Value) { if (Chorus) { @@ -2252,7 +2252,7 @@ // ------------------------ Bank ------------------------------ -int tTrack::GetBank() +int JZTrack::GetBank() { if (!gpConfig->GetValue(C_UseTwoCommandBankSelect)) { @@ -2284,7 +2284,7 @@ return 0; } -void tTrack::SetBank(int Value) +void JZTrack::SetBank(int Value) { if (mpBank) { @@ -2350,7 +2350,7 @@ // ------------------------ Patch ------------------------------ -int tTrack::GetPatch() +int JZTrack::GetPatch() { if (mPatch) { @@ -2359,7 +2359,7 @@ return 0; } -void tTrack::SetPatch(int PatchNr) +void JZTrack::SetPatch(int PatchNr) { if (mPatch) { @@ -2376,7 +2376,7 @@ // ------------------------ VibRate ------------------------------ -int tTrack::GetVibRate() +int JZTrack::GetVibRate() { if (VibRate) { @@ -2385,7 +2385,7 @@ return 0; } -void tTrack::SetVibRate(int Value) +void JZTrack::SetVibRate(int Value) { if (VibRate) { @@ -2403,7 +2403,7 @@ // ------------------------ VibDepth ------------------------------ -int tTrack::GetVibDepth() +int JZTrack::GetVibDepth() { if (VibDepth) { @@ -2412,7 +2412,7 @@ return 0; } -void tTrack::SetVibDepth(int Value) +void JZTrack::SetVibDepth(int Value) { if (VibDepth) { @@ -2429,7 +2429,7 @@ // ------------------------ VibDelay ------------------------------ -int tTrack::GetVibDelay() +int JZTrack::GetVibDelay() { if (VibDelay) { @@ -2438,7 +2438,7 @@ return 0; } -void tTrack::SetVibDelay(int Value) +void JZTrack::SetVibDelay(int Value) { if (VibDelay) { @@ -2456,7 +2456,7 @@ // ------------------------ Cutoff ------------------------------ -int tTrack::GetCutoff() +int JZTrack::GetCutoff() { if (Cutoff) { @@ -2465,7 +2465,7 @@ return 0; } -void tTrack::SetCutoff(int Value) +void JZTrack::SetCutoff(int Value) { if (Cutoff) { @@ -2483,7 +2483,7 @@ // ------------------------ Resonance ------------------------------ -int tTrack::GetResonance() +int JZTrack::GetResonance() { if (Resonance) { @@ -2492,7 +2492,7 @@ return 0; } -void tTrack::SetResonance(int Value) +void JZTrack::SetResonance(int Value) { if (Resonance) { @@ -2510,7 +2510,7 @@ // ------------------------ EnvAttack ------------------------------ -int tTrack::GetEnvAttack() +int JZTrack::GetEnvAttack() { if (EnvAttack) { @@ -2519,7 +2519,7 @@ return 0; } -void tTrack::SetEnvAttack(int Value) +void JZTrack::SetEnvAttack(int Value) { if (EnvAttack) { @@ -2537,7 +2537,7 @@ // ------------------------ EnvDecay ------------------------------ -int tTrack::GetEnvDecay() +int JZTrack::GetEnvDecay() { if (EnvDecay) { @@ -2546,7 +2546,7 @@ return 0; } -void tTrack::SetEnvDecay(int Value) +void JZTrack::SetEnvDecay(int Value) { if (EnvDecay) { @@ -2564,7 +2564,7 @@ // ------------------------ EnvRelease ------------------------------ -int tTrack::GetEnvRelease() +int JZTrack::GetEnvRelease() { if (EnvRelease) { @@ -2573,7 +2573,7 @@ return 0; } -void tTrack::SetEnvRelease(int Value) +void JZTrack::SetEnvRelease(int Value) { if (EnvRelease) { @@ -2591,7 +2591,7 @@ // ------------------------ DrumParam ------------------------------ -int tTrack::GetDrumParam(int pitch, int index) +int JZTrack::GetDrumParam(int pitch, int index) { if (!DrumParams.IsEmpty()) { @@ -2604,7 +2604,7 @@ return 0; } -void tTrack::SetDrumParam(int pitch, int index, int Value) +void JZTrack::SetDrumParam(int pitch, int index, int Value) { DrumParams.DelParam(pitch, index); if (Value > 0) @@ -2618,7 +2618,7 @@ // ------------------------ BendPitchSens ------------------------------ -int tTrack::GetBendPitchSens() +int JZTrack::GetBendPitchSens() { if (BendPitchSens) { @@ -2627,7 +2627,7 @@ return 0; } -void tTrack::SetBendPitchSens(int Value) +void JZTrack::SetBendPitchSens(int Value) { if (BendPitchSens) { @@ -2645,7 +2645,7 @@ // ------------------------ Modulation Sysex ------------------------------ -int tTrack::GetModulationSysex(int msp) +int JZTrack::GetModulationSysex(int msp) { unsigned char *valp = gpSynth->GetSysexValPtr(ModulationSettings[msp]); @@ -2657,7 +2657,7 @@ return 0; } -void tTrack::SetModulationSysex(int msp, int Value) +void JZTrack::SetModulationSysex(int msp, int Value) { if (ModulationSettings[msp]) { @@ -2677,7 +2677,7 @@ // ------------------------ Bender Sysex ------------------------------ -int tTrack::GetBenderSysex(int bsp) +int JZTrack::GetBenderSysex(int bsp) { unsigned char *valp = gpSynth->GetSysexValPtr(BenderSettings[bsp]); @@ -2689,7 +2689,7 @@ return 0; } -void tTrack::SetBenderSysex(int bsp, int Value) +void JZTrack::SetBenderSysex(int bsp, int Value) { if (BenderSettings[bsp]) { @@ -2709,7 +2709,7 @@ // ------------------------ CAf Sysex ------------------------------ -int tTrack::GetCAfSysex(int csp) +int JZTrack::GetCAfSysex(int csp) { unsigned char *valp = gpSynth->GetSysexValPtr(CAfSettings[csp]); @@ -2721,7 +2721,7 @@ return 0; } -void tTrack::SetCAfSysex(int csp, int Value) +void JZTrack::SetCAfSysex(int csp, int Value) { if (CAfSettings[csp]) { @@ -2741,7 +2741,7 @@ // ------------------------ PAf Sysex ------------------------------ -int tTrack::GetPAfSysex(int psp) +int JZTrack::GetPAfSysex(int psp) { unsigned char *valp = gpSynth->GetSysexValPtr(PAfSettings[psp]); @@ -2753,7 +2753,7 @@ return 0; } -void tTrack::SetPAfSysex(int psp, int Value) +void JZTrack::SetPAfSysex(int psp, int Value) { if (PAfSettings[psp]) { @@ -2773,7 +2773,7 @@ // ------------------------ CC1 Sysex ------------------------------ -int tTrack::GetCC1Sysex(int csp) +int JZTrack::GetCC1Sysex(int csp) { unsigned char *valp = gpSynth->GetSysexValPtr(CC1Settings[csp]); @@ -2785,7 +2785,7 @@ return 0; } -void tTrack::SetCC1Sysex(int csp, int Value) +void JZTrack::SetCC1Sysex(int csp, int Value) { if (CC1Settings[csp]) { @@ -2805,7 +2805,7 @@ // ------------------------ CC2 Sysex ------------------------------ -int tTrack::GetCC2Sysex(int csp) +int JZTrack::GetCC2Sysex(int csp) { unsigned char *valp = gpSynth->GetSysexValPtr(CC2Settings[csp]); @@ -2817,7 +2817,7 @@ return 0; } -void tTrack::SetCC2Sysex(int csp, int Value) +void JZTrack::SetCC2Sysex(int csp, int Value) { if (CC2Settings[csp]) Kill(CC2Settings[csp]); @@ -2835,7 +2835,7 @@ // ------------------------ CC1ControllerNr Sysex ------------------------------ -int tTrack::GetCC1ControllerNr() +int JZTrack::GetCC1ControllerNr() { unsigned char *valp = gpSynth->GetSysexValPtr(CC1ControllerNr); @@ -2847,7 +2847,7 @@ return 0; } -void tTrack::SetCC1ControllerNr(int Value) +void JZTrack::SetCC1ControllerNr(int Value) { if (CC1ControllerNr) { @@ -2867,7 +2867,7 @@ // ------------------------ CC2ControllerNr Sysex ------------------------------ -int tTrack::GetCC2ControllerNr() +int JZTrack::GetCC2ControllerNr() { unsigned char *valp = gpSynth->GetSysexValPtr(CC2ControllerNr); @@ -2879,7 +2879,7 @@ return 0; } -void tTrack::SetCC2ControllerNr(int Value) +void JZTrack::SetCC2ControllerNr(int Value) { if (CC2ControllerNr) { @@ -2899,7 +2899,7 @@ // ------------------------ Reverb Type ------------------------------ -int tTrack::GetReverbType(int lsb) +int JZTrack::GetReverbType(int lsb) { unsigned char *valp = gpSynth->GetSysexValPtr(ReverbType); @@ -2915,7 +2915,7 @@ return 0; } -void tTrack::SetReverbType(int Value, int lsb) +void JZTrack::SetReverbType(int Value, int lsb) { if (ReverbType) { @@ -2939,7 +2939,7 @@ // ------------------------ Chorus Type ------------------------------ -int tTrack::GetChorusType(int lsb) +int JZTrack::GetChorusType(int lsb) { unsigned char *valp = gpSynth->GetSysexValPtr(ChorusType); @@ -2956,7 +2956,7 @@ return 0; } -void tTrack::SetChorusType(int Value, int lsb) +void JZTrack::SetChorusType(int Value, int lsb) { if (ChorusType) { @@ -2980,7 +2980,7 @@ // ----------------------- Equalizer Type ------------------------------ -int tTrack::GetEqualizerType() +int JZTrack::GetEqualizerType() { unsigned char *valp = gpSynth->GetSysexValPtr(EqualizerType); @@ -2992,7 +2992,7 @@ return 0; } -void tTrack::SetEqualizerType(int Value) +void JZTrack::SetEqualizerType(int Value) { if (EqualizerType) { @@ -3013,7 +3013,7 @@ // ------------------------ Reverb Parameters Sysex ------------------------------ -int tTrack::GetRevSysex(int rsp) +int JZTrack::GetRevSysex(int rsp) { unsigned char *valp = gpSynth->GetSysexValPtr(ReverbSettings[rsp]); @@ -3025,7 +3025,7 @@ return 0; } -void tTrack::SetRevSysex(int rsp, int Value) +void JZTrack::SetRevSysex(int rsp, int Value) { if (ReverbSettings[rsp]) { @@ -3049,7 +3049,7 @@ // ------------------------ Chorus Parameters Sysex ------------------------------ -int tTrack::GetChoSysex(int csp) +int JZTrack::GetChoSysex(int csp) { unsigned char *valp = gpSynth->GetSysexValPtr(ChorusSettings[csp]); @@ -3061,7 +3061,7 @@ return 0; } -void tTrack::SetChoSysex(int csp, int Value) +void JZTrack::SetChoSysex(int csp, int Value) { if (ChorusSettings[csp]) { @@ -3086,7 +3086,7 @@ // ------------------------ Partial Reserve ------------------------------ -int tTrack::GetPartRsrv(int chan) +int JZTrack::GetPartRsrv(int chan) { unsigned char *valp = gpSynth->GetSysexValPtr(PartialReserve); @@ -3098,7 +3098,7 @@ return 0; } -void tTrack::SetPartRsrv(unsigned char *rsrv) +void JZTrack::SetPartRsrv(unsigned char *rsrv) { if (PartialReserve) { @@ -3119,7 +3119,7 @@ // ------------------------ Master Volume ------------------------------ -int tTrack::GetMasterVol() +int JZTrack::GetMasterVol() { unsigned char *valp = gpSynth->GetSysexValPtr(MasterVol); @@ -3137,7 +3137,7 @@ return 0; } -void tTrack::SetMasterVol(int Value) +void JZTrack::SetMasterVol(int Value) { if (MasterVol) { @@ -3158,7 +3158,7 @@ // ------------------------ Master Pan ------------------------------ -int tTrack::GetMasterPan() +int JZTrack::GetMasterPan() { unsigned char *valp = gpSynth->GetSysexValPtr(MasterPan); @@ -3170,7 +3170,7 @@ return 0; } -void tTrack::SetMasterPan(int Value) +void JZTrack::SetMasterPan(int Value) { if (MasterPan) { @@ -3190,7 +3190,7 @@ // ------------------------ Mode Sysex ------------------------------ -int tTrack::GetModeSysex(int param) +int JZTrack::GetModeSysex(int param) { unsigned char *valp = 0; @@ -3213,7 +3213,7 @@ return 0; } -void tTrack::SetModeSysex(int param, int Value) +void JZTrack::SetModeSysex(int param, int Value) { switch (param) { @@ -3257,7 +3257,7 @@ // ------------------------ Mtc offset (Time Code Offset) ------------------------------ -tMtcTime* tTrack::GetMtcOffset() +tMtcTime* JZTrack::GetMtcOffset() { if (MtcOffset) { @@ -3266,7 +3266,7 @@ return(new tMtcTime(0, Mtc30Ndf)); } -void tTrack::SetMtcOffset(tMtcTime* mtc) +void JZTrack::SetMtcOffset(tMtcTime* mtc) { if (MtcOffset) { @@ -3282,7 +3282,7 @@ // ------------------------ Speed ------------------------------ -int tTrack::GetDefaultSpeed() +int JZTrack::GetDefaultSpeed() { if (Speed) { @@ -3292,7 +3292,7 @@ } -void tTrack::SetDefaultSpeed(int bpm) +void JZTrack::SetDefaultSpeed(int bpm) { JZEvent *e = new tSetTempo(0, bpm); if (Speed) @@ -3304,7 +3304,7 @@ Cleanup(); } -tSetTempo *tTrack::GetCurrentTempo(int clk) +tSetTempo *JZTrack::GetCurrentTempo(int clk) { tEventIterator Iterator(this); Sort(); @@ -3322,7 +3322,7 @@ return t; } -int tTrack::GetCurrentSpeed(int clk) +int JZTrack::GetCurrentSpeed(int clk) { tSetTempo *t = GetCurrentTempo(clk); if (t) @@ -3337,7 +3337,7 @@ // ------------------------- State ---------------------------------- -char *tTrack::GetStateChar() +char *JZTrack::GetStateChar() { switch (State) { @@ -3351,19 +3351,19 @@ return "?"; } -void tTrack::SetState(int NewState) +void JZTrack::SetState(int NewState) { State = NewState % 3; } -void tTrack::ToggleState(int Direction) +void JZTrack::ToggleState(int Direction) { State = (State + Direction + 3) % 3; } // ------------------------- Channel --------------------------- -void tTrack::SetChannel(int NewChannel) +void JZTrack::SetChannel(int NewChannel) { Channel = NewChannel; } Modified: trunk/jazz/src/Track.h =================================================================== --- trunk/jazz/src/Track.h 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/Track.h 2008-03-18 14:25:17 UTC (rev 334) @@ -284,7 +284,7 @@ class tUndoBuffer : public tSimpleEventArray { - friend class tTrack; + friend class JZTrack; public: @@ -305,7 +305,7 @@ { friend class tEventIterator; friend class tTrackDlg; - friend class tTrack; + friend class JZTrack; public: @@ -398,14 +398,14 @@ #define MaxUndo 20 -class tTrack : public tEventArray +class JZTrack : public tEventArray { public: static bool changed; - tTrack(); - ~tTrack() { Clear(); } + JZTrack(); + ~JZTrack() { Clear(); } bool IsDrumTrack(); Modified: trunk/jazz/src/TrackFrame.cpp =================================================================== --- trunk/jazz/src/TrackFrame.cpp 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/TrackFrame.cpp 2008-03-18 14:25:17 UTC (rev 334) @@ -396,7 +396,7 @@ //----------------------------------------------------------------------------- bool JZTrackFrame::OnClose() { -// if (tTrack::changed) +// if (JZTrack::changed) // { // if ( // ::wxMessageBox( @@ -444,7 +444,7 @@ // mpTrackWindow->SetScrollPosition(0, 0); // NextWin->Canvas->SetScrollRanges(); mpTrackWindow->Refresh(false); -// tTrack::changed = false; +// JZTrack::changed = false; } } Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2008-03-18 04:25:04 UTC (rev 333) +++ trunk/jazz/src/TrackWindow.cpp 2008-03-18 14:25:17 UTC (rev 334) @@ -287,61 +287,70 @@ { wxPoint Point = Event.GetPosition(); - // Check to see if the mouse was clicked inside of the number mode - // indicator. - if (Point.x < mNumberWidth && Point.y < mTopInfoHeight) + // Check to see if the mouse was clicked in the top header. + if (Point.y < mTopInfoHeight) { - if (mNumberMode == eNmTrackNr) + // Check to see if the mouse was clicked inside of the number mode + // indicator. + if (Point.x < mNumberWidth && Point.y < mTopInfoHeight) { - mNumberMode = eNmMidiChannel; - Refresh(false); + if (mNumberMode == eNmTrackNr) + { + mNumberMode = eNmMidiChannel; + Refresh(false); + } + else + { + mNumberMode = eNmTrackNr; + Refresh(false); + } } - else + // Check to see if the mouse was clicked inside of the track name header. + else if ( + Point.x >= mTrackNameX && + Point.x < mTrackNameX + mTrackNameWidth) { - mNumberMode = eNmTrackNr; + // Bump up the speed value one tick. + int SpeedBpm = gpProject->GetTrack(0)->GetDefaultSpeed(); + ++SpeedBpm; + if (SpeedBpm > 0 && SpeedBpm < 300) + { + gpProject->GetTrack(0)->SetDefaultSpeed(SpeedBpm); + } Refresh(false); } - } - else if ( - Point.x >= mTrackNameX && Point.x < mTrackNameX + mTrackNameWidth && - Point.y < mTopInfoHeight) - { - // Bump up the speed value one tick. - int SpeedBpm = gpProject->GetTrack(0)->GetDefaultSpeed(); - ++SpeedBpm; - if (SpeedBpm > 0 && SpeedBpm < 300) + // Check to see if the mouse was clicked inside of the patch header. + else if (Point.x >= mPatchX && Point.x < mPatchX + mPatchWidth) { - gpProject->GetTrack(0)->SetDefaultSpeed(SpeedBpm); + // Toggle the patch type. + switch (mCounterMode) + { + case eCmProgram: + mCounterMode = eCmBank; + break; + case eCmBank: + mCounterMode = eCmVolume; + break; + case eCmVolume: + mCounterMode = eCmPan; + break; + case eCmPan: + mCounterMode = eCmReverb; + break; + case eCmReverb: + mCounterMode = eCmChorus; + break; + case eCmChorus: + default: + mCounterMode = eCmProgram; + break; + } + Refresh(false); } - Refresh(false); } - else if ( - Point.x >= mPatchX && Point.x < mPatchX + mPatchWidth && - Point.y < mTopInfoHeight) + else if (Point.x >= mStateX && Point.x < mStateX + mStateWidth) { - switch (mCounterMode) - { - case eCmProgram: - mCounterMode = eCmBank; - break; - case eCmBank: - mCounterMode = eCmVolume; - break; - case eCmVolume: - mCounterMode = eCmPan; - break; - case eCmPan: - mCounterMode = eCmReverb; - break; - case eCmReverb: - mCounterMode = eCmChorus; - break; - case eCmChorus: - default: - mCounterMode = eCmProgram; - break; - } - Refresh(false); + ToggleTrackState(Point); } } @@ -368,6 +377,18 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +void JZTrackWindow::ToggleTrackState(const wxPoint& Point) +{ + JZTrack* pTrack = y2Track(Point.y); + if (pTrack) + { + pTrack->ToggleState(1); + Refresh(false); + } +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void JZTrackWindow::ZoomIn() { if (mClocksPerPixel >= 2) @@ -550,7 +571,10 @@ // For each track show the MIDI channel, name, state, prg. int TrackNumber = mFromLine; - for (int y = Track2y(TrackNumber); y < mEventsY + mEventsHeight; y += mTrackHeight) + for ( + int y = TrackIndex2y(TrackNumber); + y < mEventsY + mEventsHeight; + y += mTrackHeight) { LocalDc.SetClippingRegion( 0, @@ -565,7 +589,7 @@ LocalDc.DestroyClippingRegion(); - tTrack* pTrack = gpProject->GetTrack(TrackNumber); + JZTrack* pTrack = gpProject->GetTrack(TrackNumber); if (pTrack) { LocalDc.SetClippingRegion( @@ -650,12 +674,12 @@ Dc.SetClippingRegion(0, mEventsY, mNumberWidth, mEventsHeight); for (int i = mFromLine; i < mToLine; ++i) { - tTrack* pTrack = gpProject->GetTrack(i); + JZTrack* pTrack = gpProject->GetTrack(i); if (pTrack != 0) { if (pTrack->GetAudioMode()) { - LineText(Dc, 0, Track2y(i), mNumberWidth, "Au"); + LineText(Dc, 0, TrackIndex2y(i), mNumberWidth, "Au"); } else { @@ -674,12 +698,12 @@ } ostringstream Oss; Oss << setw(2) << Value; - LineText(Dc, 0, Track2y(i), mNumberWidth, Oss.str().c_str()); + LineText(Dc, 0, TrackIndex2y(i), mNumberWidth, Oss.str().c_str()); } } else { - LineText(Dc, 0, Track2y(i), mNumberWidth, ""); + LineText(Dc, 0, TrackIndex2y(i), mNumberWidth, ""); } } Dc.DestroyClippingRegion(); @@ -785,17 +809,21 @@ x -= 2; y -= 2; } - wxColor bg = Dc.GetTextBackground(); - Dc.SetTextBackground(*mpGreyColor); - int TextWidth, TextHeight; - Dc.GetTextExtent(pString, &TextWidth, &TextHeight); - int Margin = (Width - TextWidth) / 2; - if (Margin < mLittleBit) + + if (pString && strlen(pString) > 0) { - Margin = mLittleBit; + wxColor TextBackgroundColor = Dc.GetTextBackground(); + Dc.SetTextBackground(*mpGreyColor); + int TextWidth, TextHeight; + Dc.GetTextExtent(pString, &TextWidth, &TextHeight); + int Margin = (Width - TextWidth) / 2; + if (Margin < mLittleBit) + { + Margin = mLittleBit; + } + Dc.DrawText(pString, x + Margin, y + mLittleBit); + Dc.SetTextBackground(TextBackgroundColor); } - Dc.DrawText(pString, x + Margin, y + mLittleBit); - Dc.SetTextBackground(*wxWHITE); } //----------------------------------------------------------------------------- @@ -809,7 +837,7 @@ Dc.SetClippingRegion(mPatchX, mEventsY, mPatchWidth, mEventsHeight); for (i = mFromLine; i < mToLine; i++) { - tTrack* pTrack = gpProject->GetTrack(i); + JZTrack* pTrack = gpProject->GetTrack(i); if (pTrack) { int Value; @@ -839,11 +867,11 @@ } ostringstream Oss; Oss << setw(3) << Value; - LineText(Dc, mPatchX, Track2y(i), mPatchWidth, Oss.str().c_str()); + LineText(Dc, mPatchX, TrackIndex2y(i), mPatchWidth, Oss.str().c_str()); } else { - LineText(Dc, mPatchX, Track2y(i), mPatchWidth, "?"); + LineText(Dc, mPatchX, TrackIndex2y(i), mPatchWidth, "?"); } } Dc.DestroyClippingRegion(); @@ -865,9 +893,12 @@ Dc.SetClippingRegion(mEventsX, mEventsY, mEventsWidth, mEventsHeight); int TrackNumber = mFromLine; - for (int y = Track2y(TrackNumber); y < mEventsY + mEventsHeight; y += mTrackHeight) + for ( + int y = TrackIndex2y(TrackNumber); + y < mEventsY + mEventsHeight; + y += mTrackHeight) { - tTrack *Track = gpProject->GetTrack(TrackNumber... [truncated message content] |
From: <pst...@us...> - 2008-03-21 05:40:30
|
Revision: 335 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=335&view=rev Author: pstieber Date: 2008-03-20 22:40:29 -0700 (Thu, 20 Mar 2008) Log Message: ----------- 1. Changed mScrollLine to mScrollSize. 2. Changed the JZTrackFrame constructor argument to a wxFrame. 3. Added the filter header due to other changes in the piano window. Modified Paths: -------------- trunk/jazz/src/Dialogs.cpp trunk/jazz/src/Dialogs.h trunk/jazz/src/TrackWindow.cpp trunk/jazz/src/TrackWindow.h Modified: trunk/jazz/src/Dialogs.cpp =================================================================== --- trunk/jazz/src/Dialogs.cpp 2008-03-18 14:25:17 UTC (rev 334) +++ trunk/jazz/src/Dialogs.cpp 2008-03-21 05:40:29 UTC (rev 335) @@ -31,6 +31,7 @@ #include "Events.h" #include "Player.h" #include "PianoFrame.h" +#include "PianoWindow.h" #include "ClockDialog.h" #include "KeyDialog.h" #include "PropertyListDialog.h" @@ -55,7 +56,7 @@ : tPropertyListDlg( "Shift events left/right" ) { Filter = f; - Song = f->Song; + Song = f->mpSong; Unit = unit; EventWin = w; Steps=0; @@ -70,7 +71,10 @@ cmd.Execute(); EventWin->Redraw(); if (EventWin->NextWin) - EventWin->NextWin->Redraw(); + { + EventWin->NextWin->Redraw(); + } + // wxForm::OnOk(); return false; } @@ -108,7 +112,7 @@ : tPropertyListDlg( "Clean up events" ) { Filter = f; - Song = f->Song; + Song = f->mpSong; EventWin = w; } @@ -192,7 +196,7 @@ : tPropertyListDlg("Search and replace controller types" ) { Filter = f; - Song = f->Song; + Song = f->mpSong; EventWin = w; } @@ -243,7 +247,7 @@ { EventWin = w; Filter = f; - Song = f->Song; + Song = f->mpSong; } @@ -298,7 +302,7 @@ : tPropertyListDlg("Set MIDI Channel") { Filter = f; - Song = f->Song; + Song = f->mpSong; } @@ -349,7 +353,7 @@ : tPropertyListDlg( "Velocity" ) { Filter = f; - Song = f->Song; + Song = f->mpSong; } @@ -400,7 +404,7 @@ : tPropertyListDlg("Length") { Filter = f; - Song = f->Song; + Song = f->mpSong; EventWin = w; } @@ -465,7 +469,7 @@ : tPropertyListDlg("stretch/contract by scale from start of selected sequence" ) { Filter = f; - Song = f->Song; + Song = f->mpSong; EventWin = w; } @@ -511,7 +515,7 @@ : tPropertyListDlg("MIDI delay line" ) { Filter = f; - Song = f->Song; + Song = f->mpSong; EventWin = w; } @@ -609,12 +613,12 @@ // Snap // ************************************************************************* -tSnapDlg::tSnapDlg(JZPianoFrame* w, int* snapptr) - : tPropertyListDlg("Snap:quantize cut/paste events") +tSnapDlg::tSnapDlg(JZPianoWindow* pPianoWindow, int* snapptr) + : tPropertyListDlg("Snap:quantize cut/paste events"), + mpPianoWindow(pPianoWindow) { //, Steps("Snap value", limitSteps, snapptr) //limitSteps lives in util.cpp - win = w; ptr = snapptr; } @@ -624,7 +628,7 @@ { //Steps.GetValue(); // toggle the tool buttons - win->SetSnapDenom(*ptr); + mpPianoWindow->SetSnapDenom(*ptr); //tPropertyListDlg::OnClose(); return false; } @@ -666,7 +670,7 @@ //, Steps("steps", gQntSteps, &gQntStep) { Filter = f; - Song = f->Song; + Song = f->mpSong; EventWin = w; } @@ -732,12 +736,12 @@ JZTrack *Track; tClockDlg ClockDlg; - JZPianoFrame* Win; + JZPianoWindow* Win; JZEvent *Event; JZEvent *Copy; - tEventDlg(JZEvent *e, JZPianoFrame* w, JZTrack *t); + tEventDlg(JZEvent *e, JZPianoWindow* w, JZTrack *t); virtual void AddProperties(); virtual bool OnClose(); virtual void OnHelp(); @@ -745,9 +749,9 @@ }; -tEventDlg::tEventDlg(JZEvent *e, JZPianoFrame* w, JZTrack *t) +tEventDlg::tEventDlg(JZEvent *e, JZPianoWindow* w, JZTrack *t) : tPropertyListDlg( "Event" ), - ClockDlg(w->Song, "Time ", e->GetClock()) + ClockDlg(w->mpSong, "Time ", e->GetClock()) { Win = w; Track = t; @@ -772,7 +776,7 @@ Track->Kill(Event); Track->Put(Copy); Track->Cleanup(); - Win->Redraw(); + Win->Refresh(); return tPropertyListDlg::OnClose(); } @@ -790,7 +794,7 @@ int Channel; - tChEventDlg(tChannelEvent *e, JZPianoFrame* w, JZTrack *t) + tChEventDlg(tChannelEvent *e, JZPianoWindow* w, JZTrack *t) : tEventDlg(e, w, t) { Channel = e->Channel + 1; // 1..16 @@ -830,14 +834,14 @@ // SN++ int OffVeloc; - tKeyOnDlg(tKeyOn *e, JZPianoFrame* w, JZTrack *t); + tKeyOnDlg(tKeyOn *e, JZPianoWindow* w, JZTrack *t); void AddProperties(); bool OnClose(); }; -tKeyOnDlg::tKeyOnDlg(tKeyOn *e, JZPianoFrame* w, JZTrack *t) +tKeyOnDlg::tKeyOnDlg(tKeyOn *e, JZPianoWindow* w, JZTrack *t) : tChEventDlg(e, w, t), PitchDlg("Pitch", e->Key) { @@ -901,14 +905,14 @@ int Value; - tPitchDlg(tPitch *e, JZPianoFrame* w, JZTrack *t); + tPitchDlg(tPitch *e, JZPianoWindow* w, JZTrack *t); void AddProperties(); bool OnClose(); }; -tPitchDlg::tPitchDlg(tPitch *e, JZPianoFrame* w, JZTrack *t) +tPitchDlg::tPitchDlg(tPitch *e, JZPianoWindow* w, JZTrack *t) : tChEventDlg(e, w, t) { Event = e; @@ -944,14 +948,14 @@ int Control; //tNamedChoice Choice; - tControlDlg(tControl *e, JZPianoFrame* w, JZTrack *t); + tControlDlg(tControl *e, JZPianoWindow* w, JZTrack *t); void AddProperties(); bool OnClose(); }; -tControlDlg::tControlDlg(tControl *e, JZPianoFrame* w, JZTrack *t) +tControlDlg::tControlDlg(tControl *e, JZPianoWindow* w, JZTrack *t) : tChEventDlg(e, w, t) //, Choice("Controller", &gpConfig->CtrlName(0), &Control) { @@ -1006,14 +1010,14 @@ tNamedChoice Choice; - tPlayTrackDlg(tPlayTrack *e, JZPianoFrame* w, JZTrack *t); + tPlayTrackDlg(tPlayTrack *e, JZPianoWindow* w, JZTrack *t); void AddProperties(); bool OnClose(); }; -tPlayTrackDlg::tPlayTrackDlg(tPlayTrack *e, JZPianoFrame* w, JZTrack *t) +tPlayTrackDlg::tPlayTrackDlg(tPlayTrack *e, JZPianoWindow* w, JZTrack *t) : tEventDlg(e, w, t), Choice("playtrack", gpConfig->GetControlNames(), &track) { @@ -1065,14 +1069,14 @@ int track; tNamedChoice Choice; - tTextDlg(tText *e, JZPianoFrame* w, JZTrack *t); + tTextDlg(tText *e, JZPianoWindow* w, JZTrack *t); void AddProperties(); bool OnClose(); }; -tTextDlg::tTextDlg(tText *e, JZPianoFrame* w, JZTrack *t) +tTextDlg::tTextDlg(tText *e, JZPianoWindow* w, JZTrack *t) : tEventDlg(e, w, t), Choice("text", gpConfig->GetControlNames(), &track) { @@ -1112,14 +1116,14 @@ tNamedChoice Choice; - tEndOfTrackDlg(tEndOfTrack *e, JZPianoFrame* w, JZTrack *t); + tEndOfTrackDlg(tEndOfTrack *e, JZPianoWindow* w, JZTrack *t); void AddProperties(); bool OnClose(); }; -tEndOfTrackDlg::tEndOfTrackDlg(tEndOfTrack *e, JZPianoFrame* w, JZTrack *t) +tEndOfTrackDlg::tEndOfTrackDlg(tEndOfTrack *e, JZPianoWindow* w, JZTrack *t) : tEventDlg(e, w, t), Choice("End Of Track", gpConfig->GetControlNames(), &track) { @@ -1149,14 +1153,14 @@ int Program; // tNamedChoice Choice; - tProgramDlg(tProgram *e, JZPianoFrame* w, JZTrack *t); + tProgramDlg(tProgram *e, JZPianoWindow* w, JZTrack *t); void AddProperties(); bool OnClose(); }; -tProgramDlg::tProgramDlg(tProgram *e, JZPianoFrame* w, JZTrack *t) +tProgramDlg::tProgramDlg(tProgram *e, JZPianoWindow* w, JZTrack *t) : tEventDlg(e, w, t), Program(e->Program + 1) //, Choice("Program", &gpConfig->VoiceName(0), &Program) @@ -1194,14 +1198,14 @@ int Value; - tSetTempoDlg(tSetTempo *e, JZPianoFrame* w, JZTrack *t); + tSetTempoDlg(tSetTempo *e, JZPianoWindow* w, JZTrack *t); void AddProperties(); bool OnClose(); }; -tSetTempoDlg::tSetTempoDlg(tSetTempo *e, JZPianoFrame* w, JZTrack *t) +tSetTempoDlg::tSetTempoDlg(tSetTempo *e, JZPianoWindow* w, JZTrack *t) : tEventDlg(e, w, t) { Event = e; @@ -1234,14 +1238,14 @@ char *str; - tSysexDlg(tSysEx *s, JZPianoFrame* w, JZTrack *t); + tSysexDlg(tSysEx *s, JZPianoWindow* w, JZTrack *t); void AddProperties(); bool OnClose(); }; -tSysexDlg::tSysexDlg(tSysEx *s, JZPianoFrame* w, JZTrack *t) +tSysexDlg::tSysexDlg(tSysEx *s, JZPianoWindow* w, JZTrack *t) : tEventDlg(s, w, t) { Event = s; @@ -1451,7 +1455,7 @@ void EventDialog( JZEvent* e, - JZPianoFrame* w, + JZPianoWindow* pPianoWindow, JZTrack* t, long Clock, int Channel, @@ -1473,47 +1477,47 @@ break; } str = "Key On"; - dlg = new tKeyOnDlg(e->IsKeyOn(), w, t); + dlg = new tKeyOnDlg(e->IsKeyOn(), pPianoWindow, t); break; case StatPitch: str = "Pitch Wheel"; - dlg = new tPitchDlg(e->IsPitch(), w, t); + dlg = new tPitchDlg(e->IsPitch(), pPianoWindow, t); break; case StatControl: str = "Controller"; - dlg = new tControlDlg(e->IsControl(), w, t); + dlg = new tControlDlg(e->IsControl(), pPianoWindow, t); break; case StatProgram: str = "Program Change"; - dlg = new tProgramDlg(e->IsProgram(), w, t); + dlg = new tProgramDlg(e->IsProgram(), pPianoWindow, t); break; case StatSetTempo: str = "Set Tempo (for track 0)"; - dlg = new tSetTempoDlg(e->IsSetTempo(), w, w->Song->GetTrack(0) ); + dlg = new tSetTempoDlg(e->IsSetTempo(), pPianoWindow, pPianoWindow->mpSong->GetTrack(0) ); break; case StatSysEx: str = "System Exclusive"; - dlg = new tSysexDlg(e->IsSysEx(), w, t ); + dlg = new tSysexDlg(e->IsSysEx(), pPianoWindow, t ); break; case StatPlayTrack: str = "Play Track"; - //dlg = new tPlayTrackDlg(e->IsPlayTrack(), w, t ); - dlg = new tPlayTrackDlg(e->IsPlayTrack(), w, t ); + //dlg = new tPlayTrackDlg(e->IsPlayTrack(), pPianoWindow, t ); + dlg = new tPlayTrackDlg(e->IsPlayTrack(), pPianoWindow, t ); break; case StatEndOfTrack: str = "End Of Track"; - dlg = new tEndOfTrackDlg(e->IsEndOfTrack(), w, t ); + dlg = new tEndOfTrackDlg(e->IsEndOfTrack(), pPianoWindow, t ); break; case StatText: str = "Text"; - dlg = new tTextDlg(e->IsText(), w, t ); + dlg = new tTextDlg(e->IsText(), pPianoWindow, t ); break; Modified: trunk/jazz/src/Dialogs.h =================================================================== --- trunk/jazz/src/Dialogs.h 2008-03-18 14:25:17 UTC (rev 334) +++ trunk/jazz/src/Dialogs.h 2008-03-21 05:40:29 UTC (rev 335) @@ -25,7 +25,7 @@ #include "PropertyListDialog.h" -class JZPianoFrame; +class JZPianoWindow; class tFilter; class JZSong; class JZEventFrame; @@ -212,15 +212,20 @@ { public: - tSnapDlg(JZPianoFrame *w, int* snapptr); + tSnapDlg(JZPianoWindow* pPianoWindow, int* snapptr); + void AddProperties(); + //tNamedChoice Steps; + bool OnClose(); + void OnHelp(); private: - JZPianoFrame* win; + JZPianoWindow* mpPianoWindow; + int* ptr; }; @@ -249,7 +254,7 @@ void EventDialog( JZEvent*, - JZPianoFrame*, + JZPianoWindow*, JZTrack*, long Clock, int Channel, Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2008-03-18 14:25:17 UTC (rev 334) +++ trunk/jazz/src/TrackWindow.cpp 2008-03-21 05:40:29 UTC (rev 335) @@ -24,6 +24,7 @@ #include "TrackWindow.h" #include "TrackFrame.h" +#include "Filter.h" #include "Project.h" #include "Player.h" #include "RecordingInfo.h" @@ -48,12 +49,12 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -const int JZTrackWindow::mScrollLine = 50; +const int JZTrackWindow::mScrollSize = 50; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- JZTrackWindow::JZTrackWindow( - JZTrackFrame* pParent, + wxFrame* pParent, JZSong* pSong, const wxPoint& Position, const wxSize& Size) @@ -462,8 +463,8 @@ GetViewStart(&mScrolledX, &mScrolledY); // Convert scrolling units into pixels. - mScrolledX *= mScrollLine; - mScrolledY *= mScrollLine; + mScrolledX *= mScrollSize; + mScrolledY *= mScrollSize; GetClientSize(&mCanvasWidth, &mCanvasHeight); cout @@ -1171,10 +1172,10 @@ int Width, Height; GetVirtualEventSize(Width, Height); SetScrollbars( - mScrollLine, - mScrollLine, - (Width + mScrollLine) / mScrollLine, - (Height + mScrollLine) / mScrollLine, + mScrollSize, + mScrollSize, + (Width + mScrollSize) / mScrollSize, + (Height + mScrollSize) / mScrollSize, x, y); EnableScrolling(false, false); @@ -1184,8 +1185,8 @@ //----------------------------------------------------------------------------- void JZTrackWindow::SetScrollPosition(int x, int y) { - x /= mScrollLine; - y /= mScrollLine; + x /= mScrollSize; + y /= mScrollSize; Scroll(x, y); } Modified: trunk/jazz/src/TrackWindow.h =================================================================== --- trunk/jazz/src/TrackWindow.h 2008-03-18 14:25:17 UTC (rev 334) +++ trunk/jazz/src/TrackWindow.h 2008-03-21 05:40:29 UTC (rev 335) @@ -26,7 +26,6 @@ #include "MouseAction.h" #include "Rectangle.h" -class JZTrackFrame; class JZSong; class JZTrack; class tFilter; @@ -65,7 +64,7 @@ }; JZTrackWindow( - JZTrackFrame* pParent, + wxFrame* pParent, JZSong* pSong, const wxPoint& Position, const wxSize& Size); @@ -159,7 +158,7 @@ private: - static const int mScrollLine; + static const int mScrollSize; JZSong* mpSong; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-21 05:44:13
|
Revision: 337 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=337&view=rev Author: pstieber Date: 2008-03-20 22:44:12 -0700 (Thu, 20 Mar 2008) Log Message: ----------- 1. Prefixed the Song data member with mp. 2. Made some cosmetic changes. Modified Paths: -------------- trunk/jazz/src/Filter.cpp trunk/jazz/src/Filter.h Modified: trunk/jazz/src/Filter.cpp =================================================================== --- trunk/jazz/src/Filter.cpp 2008-03-21 05:42:08 UTC (rev 336) +++ trunk/jazz/src/Filter.cpp 2008-03-21 05:44:12 UTC (rev 337) @@ -35,21 +35,21 @@ const tFltEvent FltEvents[nFltEvents] = { - { StatKeyOn, "Note", 1, 0, 127}, - { StatKeyPressure, "Poly Aftertouch",1, 0, 127}, - { StatControl, "Controller", 1, 0, 127}, - { StatProgram, "Patch", 1, 0, 127}, - { StatPitch, "Pitch", 1, -8192, 8192}, - { StatTimeSignat, "Meter", 1, 0, 0}, - { StatChnPressure, "Channel Aftertouch",1, 0, 0}, - { StatSysEx, "SysEx", 1, 0, 0} + { StatKeyOn, "Note", 1, 0, 127}, + { StatKeyPressure, "Poly Aftertouch", 1, 0, 127}, + { StatControl, "Controller", 1, 0, 127}, + { StatProgram, "Patch", 1, 0, 127}, + { StatPitch, "Pitch", 1, -8192, 8192}, + { StatTimeSignat, "Meter", 1, 0, 0}, + { StatChnPressure, "Channel Aftertouch", 1, 0, 0}, + { StatSysEx, "SysEx", 1, 0, 0} }; tFilter::tFilter(JZSong *s) { - Song = s; + mpSong = s; FltEvents = new tFltEvent [nFltEvents]; memcpy(FltEvents, ::FltEvents, sizeof(::FltEvents)); @@ -84,8 +84,9 @@ return *this; } -void tFilter::copy(tFilter const &o) { - Song = o.Song; +void tFilter::copy(tFilter const &o) +{ + mpSong = o.mpSong; FromClock = o.FromClock; ToClock = o.ToClock; FromTrack = o.FromTrack; @@ -191,7 +192,7 @@ { tFilterDlg *dlg; // DialogBox = new wxDialogBox(parent, "Event Filter", FALSE ); - dlg = new tFilterDlg(this, Song, ShowEventStats); + dlg = new tFilterDlg(this, mpSong, ShowEventStats); dlg->Create(); // dlg->EditForm(DialogBox, ShowEventStats); // DialogBox->Fit(); @@ -210,7 +211,7 @@ tTrackIterator::tTrackIterator(tFilter *f, int rev) { Filter = f; - Song = Filter->Song; + Song = Filter->mpSong; Reverse = rev; } Modified: trunk/jazz/src/Filter.h =================================================================== --- trunk/jazz/src/Filter.h 2008-03-21 05:42:08 UTC (rev 336) +++ trunk/jazz/src/Filter.h 2008-03-21 05:44:12 UTC (rev 337) @@ -64,14 +64,16 @@ tFltEvent *FltEvents; bool OtherSelected; - JZSong *Song; + JZSong* mpSong; + int FromClock, ToClock; // einschl .. ausschl + int FromTrack, ToTrack; // 1..n einschl .. einschl void Dialog(wxFrame *parent, int ShowEventStats = 1); - tFilter(JZSong *); - tFilter(tFilter *o); + tFilter(JZSong* pSong); + tFilter(tFilter* pOtherFilter); tFilter(tFilter const &o); tFilter& operator=(tFilter const &o); virtual ~tFilter(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-21 05:54:36
|
Revision: 343 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=343&view=rev Author: pstieber Date: 2008-03-20 22:54:35 -0700 (Thu, 20 Mar 2008) Log Message: ----------- 1. Made cosmetic changes. 2. Prefixed some data members with m and mp. 3. Put a destructor in the source file. Modified Paths: -------------- trunk/jazz/src/Command.cpp trunk/jazz/src/Command.h Modified: trunk/jazz/src/Command.cpp =================================================================== --- trunk/jazz/src/Command.cpp 2008-03-21 05:51:45 UTC (rev 342) +++ trunk/jazz/src/Command.cpp 2008-03-21 05:54:35 UTC (rev 343) @@ -34,37 +34,119 @@ using namespace std; -// ************************************************************************ +//***************************************************************************** +// tCommand +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +tCommand::tCommand(tFilter* pFilter) + : mpFilter(pFilter), + mpSong(pFilter->mpSong), + mReverse(0) +{ +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +tCommand::~tCommand() +{ +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void tCommand::Execute(int NewUndo) +{ + wxBeginBusyCursor(); + if (NewUndo) + { + mpSong->NewUndoBuffer(); + } + tTrackIterator Tracks(mpFilter, mReverse); + JZTrack* pTrack = Tracks.First(); + while (pTrack) + { + ExecuteTrack(pTrack); + pTrack = Tracks.Next(); + } + wxEndBusyCursor(); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void tCommand::ExecuteTrack(JZTrack* pTrack) +{ + tEventIterator Iterator(pTrack); + JZEvent* pEvent = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock); + while (pEvent) + { + if (mpFilter->IsSelected(pEvent)) + { + ExecuteEvent(pTrack, pEvent); + } + pEvent = Iterator.Next(); + } + pTrack->Cleanup(); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void tCommand::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent) +{ +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int tCommand::Interpolate(int Clock, int vmin, int vmax) +{ + int ClockMin = mpFilter->FromClock; + int ClockMax = mpFilter->ToClock; + return (Clock - ClockMin) * (vmax - vmin) / (ClockMax - ClockMin) + vmin; +} + +//***************************************************************************** // tSelectedEvents -// ************************************************************************ - +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- class tSelectedKeys : public tCommand { public: + + tSelectedKeys(tFilter* pFilter); + + void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); + + public: + long Keys[128]; - tSelectedKeys(tFilter *f); - void ExecuteEvent(JZTrack *t, JZEvent *e); }; -tSelectedKeys::tSelectedKeys(tFilter *f) - : tCommand(f) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +tSelectedKeys::tSelectedKeys(tFilter* pFilter) + : tCommand(pFilter) { int i; - for (i = 0; i < 128; i++) + for (i = 0; i < 128; ++i) + { Keys[i] = 0; + } } -void tSelectedKeys::ExecuteEvent(JZTrack *t, JZEvent *e) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void tSelectedKeys::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent) { - tKeyOn *k = e->IsKeyOn(); - if (k) - Keys[ k->Key ] += k->Length; + tKeyOn* pKey = pEvent->IsKeyOn(); + if (pKey) + { + Keys[pKey->Key] += pKey->Length; + } } -// ************************************************************************ +//***************************************************************************** // tScale -// ************************************************************************ - +//***************************************************************************** // c d e f g a b static const int CMajor[12] = { 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1 }; @@ -203,58 +285,6 @@ return Key; } -// ************************************************************************ -// tCommand -// ************************************************************************ - -tCommand::tCommand(tFilter *f) -{ - Filter = f; - Song = f->Song; - Reverse = 0; -} - -void tCommand::Execute(int NewUndo) -{ - wxBeginBusyCursor(); - if (NewUndo) - Song->NewUndoBuffer(); - tTrackIterator Tracks(Filter, Reverse); - JZTrack *t = Tracks.First(); - while (t) - { - ExecuteTrack(t); - t = Tracks.Next(); - } - wxEndBusyCursor(); -} - - -void tCommand::ExecuteTrack(JZTrack *t) -{ - tEventIterator Iterator(t); - JZEvent *e = Iterator.Range(Filter->FromClock, Filter->ToClock); - while (e) - { - if (Filter->IsSelected(e)) - ExecuteEvent(t, e); - e = Iterator.Next(); - } - t->Cleanup(); -} - - -void tCommand::ExecuteEvent(JZTrack *t, JZEvent *e) -{ -} - -long tCommand::Interpolate(long clk, long vmin, long vmax) -{ - long cmin = Filter->FromClock; - long cmax = Filter->ToClock; - return (clk - cmin) * (vmax - vmin) / (cmax - cmin) + vmin; -} - // *********************************************************************** // tCmdShift // *********************************************************************** @@ -288,10 +318,10 @@ tCommand::Execute(NewUndo); if (!LeaveSpace) { - tFilter f(Filter); - f.FromClock = Filter->ToClock; - f.ToClock = Song->GetLastClock() + 1; - long DeltaClock = Filter->FromClock - Filter->ToClock; + tFilter f(mpFilter); + f.FromClock = mpFilter->ToClock; + f.ToClock = mpSong->GetLastClock() + 1; + long DeltaClock = mpFilter->FromClock - mpFilter->ToClock; tCmdShift shift(&f, DeltaClock); shift.Execute(0); } @@ -353,7 +383,7 @@ tCmdTranspose::tCmdTranspose(tFilter *f, int notes, int ScaleNr, int fit) : tCommand(f) { - Scale.Init(ScaleNr, Filter); + Scale.Init(ScaleNr, mpFilter); Notes = notes; FitIntoScale = fit; } @@ -542,7 +572,7 @@ //convert all note-on messages to a pitch bend/volume controller pair, velocity -> volume //make a volume off controller at the end of the current event tEventIterator Iterator(t); - JZEvent *e = Iterator.Range(Filter->FromClock, Filter->ToClock); + JZEvent *e = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock); long startclock=-1; long endclock=-1; unsigned char channel=0; @@ -568,7 +598,7 @@ long startkey=0; while (e) { - if (Filter->IsSelected(e) && e->IsKeyOn()) + if (mpFilter->IsSelected(e) && e->IsKeyOn()) { if (startclock == -1) { @@ -707,15 +737,17 @@ // tCmdCopyToBuffer // ************************************************************************ -tCmdCopyToBuffer::tCmdCopyToBuffer(tFilter *f, tEventArray *buf) - : tCommand(f) +tCmdCopyToBuffer::tCmdCopyToBuffer( + tFilter* pFilter, + tEventArray* pBuffer) + : tCommand(pFilter) { - Buffer = buf; + mpBuffer = pBuffer; } -void tCmdCopyToBuffer::ExecuteEvent(JZTrack *t, JZEvent *e) +void tCmdCopyToBuffer::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent) { - Buffer->Put(e->Copy()); + mpBuffer->Put(pEvent->Copy()); } // ********************************************************************** @@ -735,9 +767,9 @@ InsertSpace = 0; // no RepeatClock = -1; // -1L - Reverse = DestTrack > Filter->FromTrack; - if (Reverse) - DestTrack += Filter->ToTrack - Filter->FromTrack; // ToTrack inclusive + mReverse = DestTrack > mpFilter->FromTrack; + if (mReverse) + DestTrack += mpFilter->ToTrack - mpFilter->FromTrack; // ToTrack inclusive } @@ -750,19 +782,23 @@ StartClock = DestClock; if (RepeatClock < 0) - StopClock = StartClock + Filter->ToClock - Filter->FromClock; + StopClock = StartClock + mpFilter->ToClock - mpFilter->FromClock; else StopClock = RepeatClock; - d = Song->GetTrack(DestTrack); + d = mpSong->GetTrack(DestTrack); - if (Reverse) + if (mReverse) { if (DestTrack) - -- DestTrack; + { + --DestTrack; + } } else - ++ DestTrack; + { + ++DestTrack; + } if (s && d) { @@ -771,15 +807,15 @@ tEventArray tmp; { tEventIterator Iterator(s); - long DeltaClock = StartClock - Filter->FromClock; - JZEvent *e = Iterator.Range(Filter->FromClock, Filter->ToClock); + long DeltaClock = StartClock - mpFilter->FromClock; + JZEvent *e = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock); while (e) { long NewClock = e->GetClock() + DeltaClock; if (NewClock >= StopClock) break; - if (Filter->IsSelected(e)) + if (mpFilter->IsSelected(e)) { JZEvent* cpy = e->Copy(); cpy->SetClock(NewClock); @@ -790,7 +826,7 @@ if (!e) { e = Iterator.First(); - DeltaClock += Filter->ToClock - Filter->FromClock; + DeltaClock += mpFilter->ToClock - mpFilter->FromClock; } } } @@ -804,7 +840,7 @@ long DeltaClock = StopClock - StartClock; while (e) { - if (Filter->IsSelected(e)) + if (mpFilter->IsSelected(e)) { JZEvent *c = e->Copy(); c->SetClock(c->GetClock() + DeltaClock); @@ -821,10 +857,10 @@ if (EraseSource) { tEventIterator Iterator(s); - JZEvent *e = Iterator.Range(Filter->FromClock, Filter->ToClock); + JZEvent *e = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock); while (e) { - if (Filter->IsSelected(e)) + if (mpFilter->IsSelected(e)) s->Kill(e); e = Iterator.Next(); } @@ -839,7 +875,7 @@ JZEvent *e = Iterator.Range(StartClock, StopClock); while (e) { - if (Filter->IsSelected(e)) + if (mpFilter->IsSelected(e)) d->Kill(e); e = Iterator.Next(); } @@ -867,7 +903,7 @@ if (e->IsKeyOn()) { tKeyOn *k = (tKeyOn *)e->Copy(); - k->SetClock(Filter->FromClock + Filter->ToClock - k->GetClock()); + k->SetClock(mpFilter->FromClock + mpFilter->ToClock - k->GetClock()); t->Kill(e); t->Put(k); } @@ -895,10 +931,10 @@ Keys[i] = 0; tEventIterator Iterator(t); - e = Iterator.Range(Filter->FromClock, Filter->ToClock); + e = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock); while (e) { - if (Filter->IsSelected(e) && e->IsKeyOn()) + if (mpFilter->IsSelected(e) && e->IsKeyOn()) { tKeyOn *k = (tKeyOn *)e; Keys[k->Key] = 1; @@ -908,10 +944,10 @@ // reverse Key's - e = Iterator.Range(Filter->FromClock, Filter->ToClock); + e = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock); while(e) { - if (Filter->IsSelected(e) && e->IsKeyOn()) + if (mpFilter->IsSelected(e) && e->IsKeyOn()) { tKeyOn *k = (tKeyOn *)e->Copy(); int n_th = 0; @@ -944,8 +980,8 @@ source = src; destin = dst; add = ad; - binfo = new JZBarInfo(Song); - binfo->SetClock(Filter->FromClock); + binfo = new JZBarInfo(mpSong); + binfo->SetClock(mpFilter->FromClock); start_bar = binfo->BarNr; } Modified: trunk/jazz/src/Command.h =================================================================== --- trunk/jazz/src/Command.h 2008-03-21 05:51:45 UTC (rev 342) +++ trunk/jazz/src/Command.h 2008-03-21 05:54:35 UTC (rev 343) @@ -54,16 +54,24 @@ class tCommand { public: - tFilter *Filter; - JZSong *Song; - int Reverse; - tCommand(tFilter *f); + tCommand(tFilter* pFilter); + + virtual ~tCommand(); + virtual void Execute(int NewUndo = 1); - virtual void ExecuteTrack(JZTrack *t); - virtual void ExecuteEvent(JZTrack *t, JZEvent *e); - long Interpolate(long clk, long vmin, long vmax); - virtual ~tCommand() {} + + virtual void ExecuteTrack(JZTrack* pTrack); + + virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); + + int Interpolate(int Clock, int vmin, int vmax); + + public: + + tFilter* mpFilter; + JZSong* mpSong; + int mReverse; }; @@ -194,10 +202,15 @@ class tCmdCopyToBuffer : public tCommand { - tEventArray *Buffer; public: - tCmdCopyToBuffer(tFilter *f, tEventArray *Buffer); + + tCmdCopyToBuffer(tFilter* pFilter, tEventArray *Buffer); + virtual void ExecuteEvent(JZTrack *t, JZEvent *e); + + private: + + tEventArray* mpBuffer; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-21 05:56:36
|
Revision: 344 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=344&view=rev Author: pstieber Date: 2008-03-20 22:56:35 -0700 (Thu, 20 Mar 2008) Log Message: ----------- Started cleaning up the harmony browser analyzer. Modified Paths: -------------- trunk/jazz/src/HarmonyBrowserAnalyzer.cpp trunk/jazz/src/HarmonyBrowserAnalyzer.h Modified: trunk/jazz/src/HarmonyBrowserAnalyzer.cpp =================================================================== --- trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2008-03-21 05:54:35 UTC (rev 343) +++ trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2008-03-21 05:56:35 UTC (rev 344) @@ -31,13 +31,17 @@ #include <cmath> HBAnalyzer::HBAnalyzer(HBContext **s, int n) + : seq(s), + max_seq(n), + start_clock(0), + stop_clock(0), + eighths_per_chord(1), + mSteps(0), + mpFilter(0), + mpTrack(0), + count(0), + delta(0) { - seq = s; - max_seq = n; - - count = 0; - delta = 0; - steps = 0; } @@ -47,30 +51,32 @@ } -void HBAnalyzer::Init(tFilter *f, int epc) +void HBAnalyzer::Init(tFilter* pFilter, int epc) { Exit(); // cleanup from previous run - filter = f; - start_clock = f->FromClock; - stop_clock = f->ToClock; + mpFilter = pFilter; + start_clock = pFilter->FromClock; + stop_clock = pFilter->ToClock; eighths_per_chord = epc; if (eighths_per_chord == 0) - steps = max_seq; // map number of chords to selection + { + mSteps = max_seq; // map number of chords to selection + } else { - JZBarInfo BarInfo(filter->Song); + JZBarInfo BarInfo(mpFilter->mpSong); BarInfo.SetClock(start_clock); int start_bar = BarInfo.BarNr; BarInfo.SetClock(stop_clock); int stop_bar = BarInfo.BarNr; - steps = (stop_bar - start_bar) * 8L / eighths_per_chord; + mSteps = (stop_bar - start_bar) * 8L / eighths_per_chord; } - count = new int* [steps]; - delta = new int* [steps]; - for (int i = 0; i < steps; i++) + count = new int* [mSteps]; + delta = new int* [mSteps]; + for (int i = 0; i < mSteps; i++) { count[i] = new int[12]; delta[i] = new int[12]; @@ -85,7 +91,7 @@ void HBAnalyzer::Exit() { - for (int i = 0; i < steps; i++) + for (int i = 0; i < mSteps; i++) { delete [] count[i]; delete [] delta[i]; @@ -94,26 +100,26 @@ delete [] delta; count = 0; delta = 0; - steps = 0; + mSteps = 0; } -int HBAnalyzer::Analyze(tFilter *f, int qbc) +int HBAnalyzer::Analyze(tFilter* pFilter, int qbc) { - Init(f, qbc); - if (steps < max_seq) + Init(pFilter, qbc); + if (mSteps < max_seq) { IterateEvents(&HBAnalyzer::CountEvent); CreateChords(); - return steps; + return mSteps; } return 0; } -int HBAnalyzer::Transpose(tFilter * f, int qbc) +int HBAnalyzer::Transpose(tFilter* pFilter, int qbc) { - f->Song->NewUndoBuffer(); - Init(f, qbc); + pFilter->mpSong->NewUndoBuffer(); + Init(pFilter, qbc); IterateEvents(&HBAnalyzer::CountEvent); GenerateMapping(); IterateEvents(&HBAnalyzer::TransposeEvent); @@ -123,14 +129,14 @@ void HBAnalyzer::IterateEvents(void (HBAnalyzer::*Action)(tKeyOn *on, JZTrack *t)) { - tTrackIterator Tracks(filter); + tTrackIterator Tracks(mpFilter); JZTrack *t = Tracks.First(); while (t) { if (!t->IsDrumTrack()) { tEventIterator Events(t); - JZEvent *e = Events.Range(filter->FromClock, filter->ToClock); + JZEvent *e = Events.Range(mpFilter->FromClock, mpFilter->ToClock); while (e) { tKeyOn *on = e->IsKeyOn(); @@ -149,14 +155,14 @@ int HBAnalyzer::Step2Clock(int step) { - int fr = filter->FromClock; - int to = filter->ToClock; - return (step * (to - fr)) / steps + fr; + int fr = mpFilter->FromClock; + int to = mpFilter->ToClock; + return (step * (to - fr)) / mSteps + fr; } void HBAnalyzer::CountEvent(tKeyOn *on, JZTrack *t) { - for (int i = 0; i < steps; i++) + for (int i = 0; i < mSteps; i++) { int start = Step2Clock(i); int stop = Step2Clock(i+1); @@ -176,9 +182,9 @@ } -void HBAnalyzer::TransposeEvent(tKeyOn *on, JZTrack *track) +void HBAnalyzer::TransposeEvent(tKeyOn *on, JZTrack* pTrack) { - for (int i = 0; i < steps; i++) + for (int i = 0; i < mSteps; i++) { int start = Step2Clock(i); int stop = Step2Clock(i+1); @@ -202,8 +208,8 @@ { tKeyOn *cp = (tKeyOn *)on->Copy(); cp->Key += delta[i][on->Key % 12]; - track->Kill(on); - track->Put(cp); + pTrack->Kill(on); + pTrack->Put(cp); // do not transpose again break; @@ -247,7 +253,7 @@ void HBAnalyzer::GenerateMapping() { int step; - for (step = 0; step < steps; step++) + for (step = 0; step < mSteps; step++) { int j; @@ -325,7 +331,7 @@ void HBAnalyzer::GenerateMapping() { int step; - for (step = 0; step < steps; step++) + for (step = 0; step < mSteps; step++) { int i, j; @@ -381,8 +387,8 @@ void HBAnalyzer::CreateChords() { - int* pBest = new int[steps]; - for (int i = 0; i < steps; i++) + int* pBest = new int[mSteps]; + for (int i = 0; i < mSteps; i++) { pBest[i] = -1; } @@ -393,7 +399,7 @@ const HBContext &ct = iter.Context(); const HBChord chord = ct.Chord(); const HBChord scale = ct.Scale(); - for (int i = 0; i < steps; i++) + for (int i = 0; i < mSteps; i++) { int err = 0; for (int k = 0; k < 12; k++) Modified: trunk/jazz/src/HarmonyBrowserAnalyzer.h =================================================================== --- trunk/jazz/src/HarmonyBrowserAnalyzer.h 2008-03-21 05:54:35 UTC (rev 343) +++ trunk/jazz/src/HarmonyBrowserAnalyzer.h 2008-03-21 05:56:35 UTC (rev 344) @@ -32,27 +32,27 @@ class HBAnalyzer { public: + HBAnalyzer(HBContext **seq, int n_seq); + ~HBAnalyzer(); + int Analyze(tFilter *f, int eighth_per_chord = 8); + int Transpose(tFilter *f, int eighth_per_chord = 8); void Init(tFilter *f, int steps_per_bar); + void Exit(); - int Steps() const { return steps; } + + int Steps() const; + int Step2Clock(int step); - HBContext * GetContext(int step) const { return seq[step % max_seq]; } + HBContext* GetContext(int step) const; + private: - HBContext **seq; - int max_seq; - int start_clock, stop_clock; - int eighths_per_chord; - int steps; - tFilter* filter; - JZTrack* track; - void IterateEvents(void (HBAnalyzer::*Action)(tKeyOn *on, JZTrack *t)); void CountEvent(tKeyOn *on, JZTrack *t); void TransposeEvent(tKeyOn *on, JZTrack *t); @@ -61,8 +61,31 @@ int MaxCount(int i, const HBChord &done); void GenerateMapping(); - int **count; - int **delta; + private: + + HBContext** seq; + int max_seq; + + int start_clock, stop_clock; + int eighths_per_chord; + int mSteps; + tFilter* mpFilter; + JZTrack* mpTrack; + + int** count; + int** delta; }; +inline +int HBAnalyzer::Steps() const +{ + return mSteps; +} + +inline +HBContext* HBAnalyzer::GetContext(int step) const +{ + return seq[step % max_seq]; +} + #endif // !defined(JZ_HARMONYBROWSERANALYZER_H) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <pst...@us...> - 2008-03-21 05:57:35
|
Revision: 345 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=345&view=rev Author: pstieber Date: 2008-03-20 22:57:34 -0700 (Thu, 20 Mar 2008) Log Message: ----------- Massively refactored this code. Mainly moved functionality from the frame to the window. Modified Paths: -------------- trunk/jazz/src/PianoFrame.cpp trunk/jazz/src/PianoFrame.h trunk/jazz/src/PianoWindow.cpp trunk/jazz/src/PianoWindow.h Modified: trunk/jazz/src/PianoFrame.cpp =================================================================== --- trunk/jazz/src/PianoFrame.cpp 2008-03-21 05:56:35 UTC (rev 344) +++ trunk/jazz/src/PianoFrame.cpp 2008-03-21 05:57:34 UTC (rev 345) @@ -30,7 +30,6 @@ #include "Track.h" #include "Synth.h" #include "StandardFile.h" -#include "Filter.h" #include "Dialogs.h" #include "Harmony.h" #include "Command.h" @@ -38,10 +37,7 @@ #include "Player.h" #include "ControlEdit.h" #include "GuitarFrame.h" -#include "HarmonyP.h" -#include "HarmonyBrowserAnalyzer.h" #include "ToolBar.h" -#include "SelectControllerDialog.h" #include "ResourceDialog.h" #include "Help.h" #include "Rectangle.h" @@ -50,69 +46,6 @@ using namespace std; -// Mouse Actions Mapping -enum -{ - MA_PLAY = 1, // 0 represents no action. - MA_CYCLE, - MA_SELECT, - MA_CONTSEL, - MA_CUTPASTE, - MA_LENGTH, - MA_DIALOG, - MA_LISTEN, - MA_COPY, - MA_VELOCITY -}; - -const int play_actions[12] = -{ - // left middle right - MA_PLAY, MA_CYCLE, 0, // plain - MA_CYCLE, 0, 0, // shift - 0, 0, 0, // ctrl - 0, 0, 0 // shift+ctrl -}; - -const int evnt_actions[12] = -{ - // left middle right - MA_SELECT, MA_CUTPASTE, MA_LENGTH, // plain - MA_CONTSEL, MA_COPY, MA_LISTEN, // shift - MA_VELOCITY, MA_DIALOG, MA_VELOCITY, // ctrl - MA_CUTPASTE, 0, MA_COPY // shift+ctrl -}; - -const char mouse_help[] = - "On Top Line:\n" - " Left Click: Start/stop play\n" - " +Shift: Start/stop cycle play\n" - " Middle Click: Start/stop cycle play\n" - "On Event Area:\n" - " Left Click: Depends on mode\n" - " +Shift: Continue selection\n" - " +Ctrl: Increase velocity\n" - " +Ctrl+Shift: Cut/paste event\n" - " Middle Click: Cut/paste event\n" - " +Shift: Copy event\n" - " +Ctrl: Event dialog\n" - " Right Click: Edit note length / change track\n" - " +Shift: Play pitch\n" - " +Ctrl: Decrease velocity\n" - " +Ctrl+Shift: Copy event\n"; - - -static int PianoFontSizes[] = -{ - 6, // Tiny - 7, // Small - 8, // Medium - 10, // Large - 12, // Huge - -1, // End of list -}; - - // ************************************************************************ // Menubar // ************************************************************************ @@ -123,19 +56,15 @@ #define MEN_METERCH 8 #define ACT_HELP_MOUSE 9 -#define MEN_COPY 10 #define MEN_SHIFT 11 #define MEN_QUANTIZE 12 -#define MEN_UNDO 13 #define MEN_SETCHAN 14 #define MEN_TRANSP 15 #define MEN_VELOC 16 -#define MEN_CUT 17 #define MEN_LERI 18 #define MEN_UPDN 19 #define MEN_LENGTH 20 -#define MEN_ERASE 21 #define MEN_VISIBLE 22 #define MEN_CTRL_EDIT 23 @@ -146,13 +75,8 @@ #define MEN_CTRL_MODUL 28 #define MEN_GUITAR 29 -#define MEN_HELP_PWIN 30 #define MEN_CLEANUP 31 -#define MEN_SNAP_8 32 -#define MEN_SNAP_8D 33 -#define MEN_SNAP_16 34 -#define MEN_SNAP_16D 35 #define MEN_RESET 36 #define MEN_VIS_ALL_TRK 37 #define MEN_SEARCHREP 38 @@ -162,10 +86,6 @@ #define ACT_CLOSE 41 #define MEN_CTRL_TEMPO 42 -#define MEN_MSELECT 43 -#define MEN_MLENGTH 44 -#define MEN_MDIALOG 45 -#define MEN_MCUTPASTE 46 #define MEN_REDO 47 #define MEN_ZOOMIN 48 #define MEN_ZOOMOUT 49 @@ -180,18 +100,18 @@ /* static JZToolDef tdefs[] = { - { MEN_MSELECT, TRUE, select_xpm, "select events"}, - { MEN_MLENGTH, TRUE, length_xpm, "change length"}, - { MEN_MDIALOG, TRUE, dialog_xpm, "event dialog"}, - { MEN_MCUTPASTE, TRUE, cutpaste_xpm, "cut/paste events"}, + { ID_SELECT, TRUE, select_xpm, "select events"}, + { ID_CHANGE_LENGTH, TRUE, length_xpm, "change length"}, + { ID_EVENT_DIALOG, TRUE, dialog_xpm, "event dialog"}, + { ID_CUT_PASTE_EVENTS, TRUE, cutpaste_xpm, "cut/paste events"}, { JZToolBar::eToolBarSeparator }, - { MEN_SNAP_8, TRUE, note8_xpm, "snap 1/8"}, - { MEN_SNAP_8D, TRUE, note83_xpm, "snap 1/12"}, - { MEN_SNAP_16, TRUE, note16_xpm, "snap 1/16"}, - { MEN_SNAP_16D, TRUE, note163_xpm, "snap 1/24"}, + { ID_SNAP_8, TRUE, note8_xpm, "snap 1/8"}, + { ID_SNAP_8D, TRUE, note83_xpm, "snap 1/12"}, + { ID_SNAP_16, TRUE, note16_xpm, "snap 1/16"}, + { ID_SNAP_16D, TRUE, note163_xpm, "snap 1/24"}, { JZToolBar::eToolBarSeparator }, - { MEN_CUT, FALSE, cut_xpm, "cut selection"}, - { MEN_ERASE, FALSE, delete_xpm, "delete selection"}, + { wxID_CUT, FALSE, cut_xpm, "cut selection"}, + { wxID_DELETE, FALSE, delete_xpm, "delete selection"}, { MEN_QUANTIZE, FALSE, quantize_xpm, "quantize selection"}, { MEN_SHIFTL, FALSE, shiftl_xpm, "shift selection left"}, { MEN_SHIFTR, FALSE, shiftr_xpm, "shift selection right"}, @@ -199,10 +119,10 @@ { JZToolBar::eToolBarSeparator }, { MEN_ZOOMIN, FALSE, zoomin_xpm, "zoom in"}, { MEN_ZOOMOUT, FALSE, zoomout_xpm, "zoom out"}, - { MEN_UNDO, FALSE, undo_xpm, "undo"}, + { wxID_UNDO, FALSE, undo_xpm, "undo"}, { MEN_REDO, FALSE, redo_xpm, "redo"}, { MEN_RESET, FALSE, panic_xpm, "all notes off"}, - { MEN_HELP_PWIN, FALSE, help_xpm, "help"}, + { ID_HELP_PIANO_WINDOW, FALSE, help_xpm, "help"}, { JZToolBar::eToolBarEnd } }; */ @@ -230,63 +150,6 @@ #include "Bitmaps/dialog.xpm" #include "Bitmaps/cutpaste.xpm" -// positions for controller editor -#define CtrlH(h) ((h)/4) -#define CtrlY(h) (h - CtrlH(h)) - -// ------------------------------------------------------------------------- -// MousePiano -// ------------------------------------------------------------------------- - -class tListen : public wxTimer -{ - public: - - int Active; - int Pitch, Channel; - - tListen() - : Active(0) - { - } - void KeyOn( - JZTrack *t, - int Pitch, - int Channel, - int Veloc = 64, - int Millisec = 100); - - void Notify(); - - private: - - JZTrack *track; -}; - -void tListen::KeyOn(JZTrack *t, int pitch, int channel, int veloc, int milli) -{ - if (!Active) - { - Pitch = pitch; - Channel = channel; - tKeyOn k(0, Channel, pitch, veloc); - gpMidiPlayer->OutNow(t, &k); - Active = 1; - Start(milli); - track = t; - } -} - -void tListen::Notify() -{ - Stop(); - tKeyOff k(0, Channel, Pitch); - gpMidiPlayer->OutNow(track, &k); - Active = 0; -} - -static tListen Listen; - //***************************************************************************** // Description: // This is the track piano class definition. @@ -295,30 +158,30 @@ EVT_MENU(MEN_ZOOMIN, JZPianoFrame::OnZoomIn) EVT_MENU(MEN_ZOOMOUT, JZPianoFrame::OnZoomOut) - EVT_MENU(MEN_SNAP_8, JZPianoFrame::OnSnap8) - EVT_MENU(MEN_SNAP_8D, JZPianoFrame::OnSnap8D) - EVT_MENU(MEN_SNAP_16, JZPianoFrame::OnSnap16) - EVT_MENU(MEN_SNAP_16D, JZPianoFrame::OnSnap16D) + EVT_MENU(ID_SNAP_8, JZPianoFrame::OnSnap8) + EVT_MENU(ID_SNAP_8D, JZPianoFrame::OnSnap8D) + EVT_MENU(ID_SNAP_16, JZPianoFrame::OnSnap16) + EVT_MENU(ID_SNAP_16D, JZPianoFrame::OnSnap16D) - EVT_MENU(MEN_MSELECT, JZPianoFrame::OnMSelect) - EVT_MENU(MEN_MLENGTH, JZPianoFrame::OnMLength) - EVT_MENU(MEN_MDIALOG, JZPianoFrame::OnMDialog) - EVT_MENU(MEN_MCUTPASTE, JZPianoFrame::OnMCutPaste) + 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) EVT_MENU(MEN_RESET, JZPianoFrame::OnReset) EVT_MENU(MEN_VIS_ALL_TRK, JZPianoFrame::OnVisibleAllTracks) - EVT_MENU(MEN_ERASE, JZPianoFrame::OnErase) - EVT_MENU(MEN_CUT, JZPianoFrame::OnCut) - EVT_MENU(MEN_COPY, JZPianoFrame::OnCopy) + EVT_MENU(wxID_DELETE, JZPianoFrame::OnErase) + EVT_MENU(wxID_CUT, JZPianoFrame::OnCut) + EVT_MENU(wxID_COPY, JZPianoFrame::OnCopy) EVT_MENU(MEN_SHIFT, JZPianoFrame::OnShift) EVT_MENU(MEN_SHIFTL, JZPianoFrame::OnShiftLeft) EVT_MENU(MEN_SHIFTR, JZPianoFrame::OnShiftRight) EVT_MENU(MEN_LERI, JZPianoFrame::OnExchangeLeftRight) EVT_MENU(MEN_UPDN, JZPianoFrame::OnExchangeUpDown) EVT_MENU(MEN_QUANTIZE, JZPianoFrame::OnQuantize) - EVT_MENU(MEN_UNDO, JZPianoFrame::OnUndo) - EVT_MENU(MEN_REDO, JZPianoFrame::OnRedo) + EVT_MENU(wxID_UNDO, JZPianoFrame::OnUndo) + EVT_MENU(wxID_REDO, JZPianoFrame::OnRedo) EVT_MENU(MEN_CTRL_PITCH, JZPianoFrame::OnCtrlPitch) EVT_MENU(MEN_CTRL_MODUL, JZPianoFrame::OnCtrlModulation) EVT_MENU(MEN_CTRL_CONTR, JZPianoFrame::OnSelectController) @@ -333,15 +196,15 @@ // EVT_MENU(MEN_SEARCHREP, JZPianoFrame::MenSearchReplace) // EVT_MENU(MEN_TRANSP, JZPianoFrame::MenTranspose) // EVT_MENU(MEN_SETCHAN, JZPianoFrame::MenSetChannel) - EVT_MENU(MEN_VELOC, JZPianoFrame::ActVelocityDialog) + EVT_MENU(MEN_VELOC, JZPianoFrame::OnActivateVelocityDialog) // EVT_MENU(MEN_LENGTH, JZPianoFrame::MenLength) - EVT_MENU(MEN_SEQLENGTH, JZPianoFrame::ActSequenceLengthDialog) - EVT_MENU(MEN_MIDIDELAY, JZPianoFrame::ActMidiDelayDialog) + EVT_MENU(MEN_MIDIDELAY, JZPianoFrame::OnActivateMidiDelayDialog) + EVT_MENU(MEN_SEQLENGTH, JZPianoFrame::OnActivateSequenceLengthDialog) // EVT_MENU(MEN_CONVERT_TO_MODULATION, JZPianoFrame::MenConvertToModulation) - EVT_MENU(ACT_SETTINGS, JZPianoFrame::ActSettingsDialog) + EVT_MENU(ACT_SETTINGS, JZPianoFrame::OnActivateSettingsDialog) EVT_MENU(MEN_FILTER, JZPianoFrame::OnFilter) - EVT_MENU(MEN_SNAP, JZPianoFrame::SnapDlg) + EVT_MENU(MEN_SNAP, JZPianoFrame::OnSnapDlg) // These are all "Patrick Approved" EVT_CLOSE(JZPianoFrame::ActCloseEvent) @@ -371,114 +234,38 @@ Position, Size, wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE), - Canvas(0), - mpFilter(0), + mpPianoWindow(0), // mpFileMenu(0), // mpEditMenu(0) - Song(pSong), - mpFont(0), - mpFixedFont(0), - MousePlay(play_actions), - MouseEvnt(evnt_actions), - mpToolBar(0), - mpGuitarFrame(0) + mpSong(pSong), + mpToolBar(0) { CreateToolBar(); // CreateMenu(); - mpFilter = new tFilter(Song); - - MouseAction = 0; DialogBox = 0; MixerForm = 0; - mTopInfoHeight = 40; - mLeftInfoWidth = 100; - mEventsX = mLeftInfoWidth; - mEventsY = mTopInfoHeight; - mEventsWidth = mEventsHeight = 0; - mTrackHeight = 0; - LittleBit = 1; - - FontSize = PianoFontSizes[1]; // Must be an entry in the array. - UseColors = 1; - - PlayClock = -1; - - hFixedFont = 0; - CanvasX = CanvasY = CanvasW = CanvasH = 0; - FromClock = ToClock = 0; - FromLine = ToLine = 0; - - InitColors(); - CreateMenu(); - mpToolBar->ToggleTool(MEN_MSELECT, TRUE); - MouseEvnt.SetLeftAction(MA_SELECT); + mpToolBar->ToggleTool(ID_SELECT, TRUE); - ClocksPerPixel = 4; + mClockTicsPerPixel = 4; - TrackNr = 0; - Track = Song->GetTrack(TrackNr); - SnapDenomiator = 16; - mpToolBar->ToggleTool(MEN_SNAP_16, TRUE); - nSnaps = 0; + mTrackIndex = 0; + mpToolBar->ToggleTool(ID_SNAP_16, TRUE); - for (int i = 0; i < eMaxTrackCount; i++) - { - mFromLines[i] = 64; - } - - DrumFont = 0; - - VisibleKeyOn = 1; - VisiblePitch = 0; - VisibleController = 0; - VisibleProgram = 0; - VisibleTempo = 0; - VisibleSysex = 0; - VisiblePlayTrack = 0; - VisibleDrumNames = 1; - VisibleAllTracks = 0; - VisibleHBChord = 1; - VisibleMono = 0; - - MouseLine = -1; - - CtrlEdit = 0; - - Canvas = new JZPianoWindow(this); - - SnapSel = new tSnapSelection(Canvas); - - Setup(); -// Canvas->SetScrollRanges(); -// Canvas->SetScrollPosition(0, 0); //this wasnt here before wx2, why? + mpPianoWindow = new JZPianoWindow(this, pSong); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- JZPianoFrame::~JZPianoFrame() { - delete mpFont; - delete mpFixedFont; + delete mpPianoWindow; - if (CtrlEdit) - delete CtrlEdit; - if (Canvas) - delete Canvas; - if (SnapSel) - delete SnapSel; - - delete mpFilter; - delete MixerForm; - if (mpGuitarFrame) - { - delete mpGuitarFrame; - } delete mpToolBar; } @@ -518,108 +305,25 @@ mpToolBar = new JZToolBar(this, ToolBarDefinitions); } -void JZPianoFrame::Setup() -{ - // This section is from JZEventFrame::Setup() - - int lx,ly; - - wxDC *dc = new wxClientDC(Canvas); - - dc->SetFont(wxNullFont); - delete mpFixedFont; - mpFixedFont = new wxFont(12, wxSWISS, wxNORMAL, wxNORMAL); - - dc->SetFont(*mpFixedFont); - dc->GetTextExtent("M", &lx, &ly); - hFixedFont = (int)ly; - - delete mpFont; - mpFont = new wxFont(FontSize, wxSWISS, wxNORMAL, wxNORMAL); - dc->SetFont(*mpFont); - - dc->GetTextExtent("M", &lx, &ly); - LittleBit = (int)(lx/2); - - dc->GetTextExtent("HXWjgi", &lx, &ly); - mTrackHeight = (int)ly + LittleBit; - delete dc; - - - // This section is from JZPianoFrame::Setup() - - int x, y; - - dc=new wxClientDC(Canvas); - dc->SetFont(*mpFixedFont); - dc->GetTextExtent("H", &x, &y); - mTopInfoHeight = hFixedFont + 2 * LittleBit; - - dc->SetFont(*mpFont); - dc->GetTextExtent("H", &x, &y); - LittleBit = (int)(x/2); - - delete DrumFont; - DrumFont = new wxFont(FontSize+3, wxSWISS, wxNORMAL, wxNORMAL); - dc->SetFont(*DrumFont); - dc->GetTextExtent("Low Conga mid 2 or so", &x, &y); - wPiano = (int)x + LittleBit; - - mLeftInfoWidth = wPiano; - delete dc; -} - // show the guitar edit window. void JZPianoFrame::OnGuitar(wxCommandEvent& Event) { - if (!mpGuitarFrame) - { - mpGuitarFrame = new JZGuitarFrame(this); - } - mpGuitarFrame->Show(TRUE); + mpPianoWindow->CreateGuitarWindow(); } -void JZPianoFrame::NewPosition(int track, int clock) -{ - mFromLines[TrackNr] = FromLine; - // change track - if (track >= 0) - { - TrackNr = track; - Track = Song->GetTrack(TrackNr); - SetTitle(Track->GetName()); - } - - // change position - if (clock >= 0) - { - int x = Clock2x(clock); - Canvas->SetScrollPosition(x - mLeftInfoWidth, Line2y(mFromLines[TrackNr])); - } - -// SN++ Ist geaendert. OnPaint zeichnet immer neu -> Bug Fix bei ZoomOut! -/* - // OnPaint() redraws only if clock has changed - if (CtrlEdit && track >= 0) - CtrlEdit->ReInit(Track, FromClock, ClocksPerPixel); -*/ - Redraw(); -} - - void JZPianoFrame::CreateMenu() { wxMenu *win_menu = new wxMenu; win_menu->Append(ACT_CLOSE, "&Close"); wxMenu *edit_menu = new wxMenu("",wxMENU_TEAROFF); - edit_menu->Append(MEN_ERASE, "&Delete"); - edit_menu->Append(MEN_COPY, "&Copy"); - edit_menu->Append(MEN_CUT, "&Cut"); + edit_menu->Append(wxID_DELETE, "&Delete"); + edit_menu->Append(wxID_COPY, "&Copy"); + edit_menu->Append(wxID_CUT, "&Cut"); edit_menu->Append(MEN_SHIFT, "&Shift ..."); edit_menu->Append(MEN_QUANTIZE, "&Quantize ..."); edit_menu->Append(MEN_SETCHAN, "&Set MIDI Channel ..."); @@ -644,8 +348,8 @@ setting_menu->Append(MEN_METERCH, "&Meterchange ..."); wxMenu *misc_menu = new wxMenu("",wxMENU_TEAROFF); - misc_menu->Append(MEN_UNDO, "&Undo"); - misc_menu->Append(MEN_REDO, "&Redo"); + misc_menu->Append(wxID_UNDO, "&Undo"); + misc_menu->Append(wxID_REDO, "&Redo"); misc_menu->Append(MEN_CTRL_PITCH, "Edit &Pitch"); misc_menu->Append(MEN_CTRL_VELOC, "Edit &Velocity"); misc_menu->Append(MEN_CTRL_MODUL, "Edit &Modulation"); @@ -659,7 +363,7 @@ misc_menu->Append(MEN_GUITAR, "&Guitar board"); wxMenu *help_menu = new wxMenu("",wxMENU_TEAROFF); - help_menu->Append(MEN_HELP_PWIN, "&Pianowin"); + help_menu->Append(ID_HELP_PIANO_WINDOW, "&Pianowin"); help_menu->Append(ACT_HELP_MOUSE, "&Mouse"); wxMenuBar *menu_bar = new wxMenuBar; @@ -674,251 +378,99 @@ -void JZPianoFrame::OnMenuCommand(int id) +JZGuitarFrame* JZPianoFrame::GetGuitarFrame() { - int cw, ch; - GetClientSize(&cw, &ch); - - switch (id) - { - case MEN_HELP_PWIN: - gpHelpInstance->ShowTopic("Piano Window"); - break; - } + return mpPianoWindow->GetGuitarFrame(); } - void JZPianoFrame::OnFilter(wxCommandEvent& Event) { - mpFilter->Dialog(0); + mpPianoWindow->EditFilter(); } -/**activate velocity edit*/ +// Activate velocity edit. void JZPianoFrame::OnCtrlVelocity(wxCommandEvent& Event) { - delete CtrlEdit; - int cw, ch; - GetClientSize(&cw, &ch); - - CtrlEdit = new tVelocEdit( - this, - "Velocity", - wPiano, - 0, - CtrlY(ch), - CanvasW, - CtrlH(ch)); - - CtrlEdit->ReInit(Track, FromClock, ClocksPerPixel); - Redraw(); + mpPianoWindow->CtrlVelocity(); } void JZPianoFrame::CtrlChannelAftertouchEdit(wxCommandEvent& Event) { - delete CtrlEdit; - int cw, ch; - GetClientSize(&cw, &ch); - CtrlEdit = new tChannelAfterEdit(this, "Channel Aftertouch", wPiano, 0, CtrlY(ch), CanvasW,CtrlH(ch)); - CtrlEdit->ReInit(Track, FromClock, ClocksPerPixel); - Redraw(); - + mpPianoWindow->CtrlChannelAftertouchEdit(); } void JZPianoFrame::OnCtrlPolyAftertouchEdit(wxCommandEvent& Event) { - int cw, ch; - GetClientSize(&cw, &ch); - delete CtrlEdit; - CtrlEdit = new tPolyAfterEdit(this, "Key Aftertouch", wPiano, 0, CtrlY(ch), CanvasW,CtrlH(ch)); - CtrlEdit->ReInit(Track, FromClock, ClocksPerPixel); - Redraw(); + mpPianoWindow->CtrlPolyAftertouchEdit(); } void JZPianoFrame::OnCtrlNone(wxCommandEvent& Event) { - delete CtrlEdit; - CtrlEdit = 0; - Redraw(); + mpPianoWindow->CtrlNone(); } void JZPianoFrame::OnCtrlTempo(wxCommandEvent& Event) { - tEventIterator Iterator(Track); - Track->Sort(); - JZEvent* pEvent = Iterator.Range(0, (unsigned) Track->GetLastClock() + 1); - tSetTempo *t; - int Min = 240; - int Max = 20; - while (pEvent) - { - if ((t = pEvent->IsSetTempo()) != 0) - { - if (t->GetBPM() < Min) - { - Min = t->GetBPM(); - } - if (t->GetBPM() > Max) - { - Max = t->GetBPM(); - } - } - pEvent = Iterator.Next(); - } - if (Min - 50 > 20) - { - Min -= 50; - } - else - { - Min = 20; - } - if (Max + 50 < 240) - { - Max += 50; - } - else - { - Max = 240; - } - delete CtrlEdit; - int cw, ch; - GetClientSize(&cw, &ch); - CtrlEdit = new tTempoEdit( - Min, - Max, - this, - "Tempo", - wPiano, - 0, - CtrlY(ch), - CanvasW, - CtrlH(ch)); - CtrlEdit->ReInit(Track, FromClock, ClocksPerPixel); - Redraw(); + mpPianoWindow->CtrlTempo(); } void JZPianoFrame::OnSelectController(wxCommandEvent& Event) { - int i = SelectControllerDlg(); - if (i > 0) - { - delete CtrlEdit; - int cw, ch; - GetClientSize(&cw, &ch); - CtrlEdit = new tCtrlEdit( - i - 1, - this, - gpConfig->CtrlName(i).first.c_str(), - wPiano, - 0, - CtrlY(ch), - CanvasW, - CtrlH(ch)); - CtrlEdit->ReInit(Track, FromClock, ClocksPerPixel); - Redraw(); - } + mpPianoWindow->SelectController(); } void JZPianoFrame::OnCtrlModulation(wxCommandEvent& Event) { - delete CtrlEdit; - int cw, ch; - GetClientSize(&cw, &ch); - CtrlEdit = new tCtrlEdit(1, this, "Modulation", wPiano, 0, CtrlY(ch), CanvasW, CtrlH(ch)); - CtrlEdit->ReInit(Track, FromClock, ClocksPerPixel); - Redraw(); + mpPianoWindow->CtrlModulation(); } void JZPianoFrame::OnCtrlPitch(wxCommandEvent& Event) { - int cw, ch; - GetClientSize(&cw, &ch); - delete CtrlEdit; - CtrlEdit = new tPitchEdit(this, "Pitch", wPiano, 0, CtrlY(ch), CanvasW, CtrlH(ch)); - - CtrlEdit->ReInit(Track, FromClock, ClocksPerPixel); - Redraw(); + mpPianoWindow->CtrlPitch(); } -/** - redo undone actions -*/ +// Redo undone actions void JZPianoFrame::OnRedo(wxCommandEvent& Event) { - Song->Redo(); - Redraw(); - if (CtrlEdit && Track >= 0) - CtrlEdit->ReInit(Track, FromClock, ClocksPerPixel); + mpPianoWindow->Redo(); } -/** - undo actions -*/ +// Undo actions void JZPianoFrame::OnUndo(wxCommandEvent& Event) { - Song->Undo(); - Redraw(); - if (CtrlEdit && Track >= 0) - CtrlEdit->ReInit(Track, FromClock, ClocksPerPixel); + mpPianoWindow->Undo(); } -/** quantize selected events*/ +// Quantize selected events void JZPianoFrame::OnQuantize(wxCommandEvent& Event) { - if (EventsSelected()) - { - tCmdQuantize cmd(mpFilter, SnapClocks(), 0, 0); - cmd.Execute(1); - Redraw(); - } + mpPianoWindow->Quantize(); } -/** flip events up and down*/ +// Flip events up and down. void JZPianoFrame::OnExchangeUpDown(wxCommandEvent& Event) { - if (EventsSelected()) - { - tCmdExchUpDown cmd(mpFilter); - cmd.Execute(1); - Redraw(); - } + mpPianoWindow->ExchangeUpDown(); } -/**flip events left to righ*/ +// Flip events left to right. void JZPianoFrame::OnExchangeLeftRight(wxCommandEvent& Event) { - if (EventsSelected()) - { - tCmdExchLeftRight cmd(mpFilter); - cmd.Execute(1); - Redraw(); - } + mpPianoWindow->ExchangeLeftRight(); } -/**shift events snapclock clocks to left*/ +// Shift events snapclock clocks to left. void JZPianoFrame::OnShiftLeft(wxCommandEvent& Event) { - if (EventsSelected()) - { - int steps = -SnapClocks(); - tCmdShift cmd(mpFilter, steps); - cmd.Execute(); - Redraw(); - } + mpPianoWindow->ShiftLeft(); } -/**shift events snapclock clocks to right*/ +// Shift events snapclock clocks to right. void JZPianoFrame::OnShiftRight(wxCommandEvent& Event) { - if (EventsSelected()) - { - int steps = SnapClocks(); - tCmdShift cmd(mpFilter, steps); - cmd.Execute(); - Redraw(); - } + mpPianoWindow->ShiftRight(); } void JZPianoFrame::OnShift(wxCommandEvent& Event) @@ -930,58 +482,26 @@ void JZPianoFrame::OnCut(wxCommandEvent& Event) { - CutOrCopy(MEN_CUT); + mpPianoWindow->CutOrCopy(wxID_CUT); } void JZPianoFrame::OnCopy(wxCommandEvent& Event) { - CutOrCopy(MEN_COPY); + mpPianoWindow->CutOrCopy(wxID_COPY); } -/**helper for cut and copy events*/ -void JZPianoFrame::CutOrCopy(int id) -{ - if (EventsSelected()) - { - PasteBuffer.Clear(); - tCmdCopyToBuffer cmd(mpFilter, &PasteBuffer); - mpFilter->OtherSelected = VisibleTempo; - cmd.Execute(0); // no UNDO - if (id == MEN_CUT) - { - tCmdErase cmd(mpFilter); - cmd.Execute(1); // with UNDO - Redraw(); - } - mpFilter->OtherSelected = 0; - if (mpGuitarFrame) - { - mpGuitarFrame->Update(); -// mpGuitarFrame->Redraw(); - } - } -} - - void JZPianoFrame::OnErase(wxCommandEvent& Event) { - if (EventsSelected()) - { - tCmdErase cmd(mpFilter); - cmd.Execute(1); // with UNDO - Redraw(); - } + mpPianoWindow->Erase(); } -/**togle display of events from all tracks, or just from the current track */ +// Toggle the display of events from all tracks, or just from the current track. void JZPianoFrame::OnVisibleAllTracks(wxCommandEvent& Event) { - VisibleAllTracks = !VisibleAllTracks; - //VisibleAllTracks = mpToolBar->GetToolState(MEN_VIS_ALL_TRK); - Redraw(); + mpPianoWindow->ToggleVisibleAllTracks(); } -/**send a midi reset*/ +// Send a midi reset. void JZPianoFrame::OnReset(wxCommandEvent& Event) { gpMidiPlayer->AllNotesOff(1); @@ -1001,59 +521,53 @@ void JZPianoFrame::OnMSelect(wxCommandEvent& Event) { - PressRadio(MEN_MSELECT); - MouseEvnt.SetLeftAction(MA_SELECT); + mpPianoWindow->MSelect(); } void JZPianoFrame::OnMLength(wxCommandEvent& Event) { - PressRadio(MEN_MLENGTH); - MouseEvnt.SetLeftAction(MA_LENGTH); + mpPianoWindow->MLength(); } void JZPianoFrame::OnMDialog(wxCommandEvent& Event) { - PressRadio(MEN_MDIALOG); - MouseEvnt.SetLeftAction(MA_DIALOG); + mpPianoWindow->MDialog(); } void JZPianoFrame::OnMCutPaste(wxCommandEvent& Event) { - PressRadio(MEN_MCUTPASTE); - MouseEvnt.SetLeftAction(MA_CUTPASTE); + mpPianoWindow->MCutPaste(); } - void JZPianoFrame::OnZoomIn(wxCommandEvent& Event){ - if (ClocksPerPixel > 1) { - ZoomIn(); - // TrackNr for Ctr-Editor - NewPosition(TrackNr,FromClock); - } +void JZPianoFrame::OnZoomIn(wxCommandEvent& Event) +{ + mpPianoWindow->ZoomIn(); } -void JZPianoFrame::OnZoomOut(wxCommandEvent& Event){ - if (ClocksPerPixel<32) { - ZoomOut(); - NewPosition(TrackNr, FromClock); - } +void JZPianoFrame::OnZoomOut(wxCommandEvent& Event) +{ + mpPianoWindow->ZoomOut(); } -void JZPianoFrame::OnSnap8(wxCommandEvent& Event){ - PasteBuffer.Clear(); SetSnapDenom(8); +void JZPianoFrame::OnSnap8(wxCommandEvent& Event) +{ + mpPianoWindow->Snap8(); } - -void JZPianoFrame::OnSnap8D(wxCommandEvent& Event){ - PasteBuffer.Clear(); SetSnapDenom(12); +void JZPianoFrame::OnSnap8D(wxCommandEvent& Event) +{ + mpPianoWindow->Snap8D(); } -void JZPianoFrame::OnSnap16(wxCommandEvent& Event){ - PasteBuffer.Clear(); SetSnapDenom(16); +void JZPianoFrame::OnSnap16(wxCommandEvent& Event) +{ + mpPianoWindow->Snap16(); } -void JZPianoFrame::OnSnap16D(wxCommandEvent& Event){ - PasteBuffer.Clear(); SetSnapDenom(24); +void JZPianoFrame::OnSnap16D(wxCommandEvent& Event) +{ + mpPianoWindow->Snap16D(); } @@ -1063,57 +577,15 @@ -// ******************************************************************** -// Visible -// ******************************************************************** -int JZPianoFrame::IsVisible(JZEvent* pEvent) -{ - switch (pEvent->Stat) - { - case StatKeyOn: - return VisibleKeyOn; - case StatPitch: - return VisiblePitch; - case StatControl: - return VisibleController; - case StatProgram: - return VisibleProgram; - case StatSetTempo: - return VisibleTempo; - case StatSysEx: - return VisibleSysex; - case StatPlayTrack: - return VisiblePlayTrack; - case StatEndOfTrack: - return true; - case StatText: - return true; - case StatChnPressure: - return VisibleMono; - } - return 0; -} - - -int JZPianoFrame::IsVisible(JZTrack *t) -{ - if (!VisibleAllTracks) - return t == Track; - - return ( - Track->Channel == gpConfig->GetValue(C_DrumChannel)) == - (t->Channel == gpConfig->GetValue(C_DrumChannel)); -} - #ifdef OBSOLETE class tVisibleDlg : public wxForm { - JZPianoFrame *win; + JZPianoFrame *pPianoWindow; public: - tVisibleDlg(JZPianoFrame *p) : wxForm( USED_WXFORM_BUTTONS ), win(p) {} + tVisibleDlg(JZPianoFrame *p) : wxForm( USED_WXFORM_BUTTONS ), pPianoWindow(p) {} void EditForm(wxPanel *panel); virtual void OnOk(); virtual void OnHelp(); @@ -1121,8 +593,8 @@ void tVisibleDlg::OnOk() { - win->SetVisibleAllTracks(win->VisibleAllTracks); - // win->Redraw(); + pPianoWindow->SetVisibleAllTracks(pPianoWindow->VisibleAllTracks); + // pPianoWindow->Redraw(); wxForm::OnOk(); } @@ -1136,19 +608,19 @@ { Add(wxMakeFormMessage("Select Events to be shown")); Add(wxMakeFormNewLine()); - Add(wxMakeFormBool("NoteOn", &win->VisibleKeyOn)); - //Add(wxMakeFormBool("Pitch", &win->VisiblePitch)); - Add(wxMakeFormBool("Controller", &win->VisibleController)); - Add(wxMakeFormBool("Program", &win->VisibleProgram)); - Add(wxMakeFormBool("Tempo", &win->VisibleTempo)); - Add(wxMakeFormBool("SysEx", &win->VisibleSysex)); - Add(wxMakeFormBool("PlayTrack", &win->VisiblePlayTrack)); + Add(wxMakeFormBool("NoteOn", &pPianoWindow->VisibleKeyOn)); + //Add(wxMakeFormBool("Pitch", &pPianoWindow->VisiblePitch)); + Add(wxMakeFormBool("Controller", &pPianoWindow->VisibleController)); + Add(wxMakeFormBool("Program", &pPianoWindow->VisibleProgram)); + Add(wxMakeFormBool("Tempo", &pPianoWindow->VisibleTempo)); + Add(wxMakeFormBool("SysEx", &pPianoWindow->VisibleSysex)); + Add(wxMakeFormBool("PlayTrack", &pPianoWindow->VisiblePlayTrack)); Add(wxMakeFormNewLine()); - Add(wxMakeFormBool("Show drumnames on drumtracks", &win->VisibleDrumNames)); + Add(wxMakeFormBool("Show drumnames on drumtracks", &pPianoWindow->VisibleDrumNames)); Add(wxMakeFormNewLine()); - Add(wxMakeFormBool("Show events from all Tracks", &win->VisibleAllTracks)); + Add(wxMakeFormBool("Show events from all Tracks", &pPianoWindow->VisibleAllTracks)); Add(wxMakeFormNewLine()); - Add(wxMakeFormBool("Show harmonies from Harmony Browser", &win->VisibleHBChord)); + Add(wxMakeFormBool("Show harmonies from Harmony Browser", &pPianoWindow->VisibleHBChord)); AssociatePanel(panel); } @@ -1163,814 +635,10 @@ } #endif // OBSOLETE -// ******************************************************************** -// Painting -// ******************************************************************** -const int isBlack[12] = {0,1,0,1,0,0,1,0,1,0,1,0}; -#define IsBlack(Key) isBlack[(Key) % 12] -void JZPianoFrame::OnPaintSub(wxDC* dc, int x, int y) -{ -// int OldFromClock = FromClock; - - OnEventWinPaintSub(x, y); - -// SN++ Da Jazz nun eine ReDo Funktion hat. Behebt gleichzeitig ein kleines -// Update Problem beim mehrfachen ZoomOut. -// Aktives Ctrl-Fenster neu zeichnen bzw. reinitialisieren. - -// if (CtrlEdit && OldFromClock != FromClock) -// CtrlEdit->ReInit(Track, FromClock, ClocksPerPixel); - - if (CtrlEdit) - CtrlEdit->ReInit(Track, FromClock, ClocksPerPixel); - -// - xPiano = CanvasX; - - int StopClk; - JZBarInfo BarInfo(Song); - char buf[20]; - -//OBSOLETE dc->BeginDrawing(); - dc->DestroyClippingRegion(); - dc->SetBackground(*wxWHITE_BRUSH); - DrawPlayPosition(dc); - SnapSel->Draw(*dc, mEventsX, mEventsY, mEventsWidth, mEventsHeight); - dc->Clear(); - - - /////////////////////////////////////////////////////////////// - // horizontal lines(ripped from drawpianoroll code) - -// for (y = Line2y(FromLine); y < mEventsY + mEventsHeight; y += mTrackHeight) -// if (y > mEventsY) // cheaper than clipping -// dc->DrawLine(mEventsX+1, y, mEventsX + mEventsWidth, y); - - dc->SetPen(*wxGREY_PEN); - wxBrush blackKeysBrush=wxBrush(wxColor(250,240,240),wxSOLID); - int Pitch = 127 - FromLine; - y = Line2y(FromLine); - while (Pitch >= 0 && y < mEventsY + mEventsHeight) - { - if (IsBlack(Pitch)) - { - dc->SetBrush(blackKeysBrush);//*wxLIGHT_GREY_PEN - dc->DrawRectangle(CanvasX, y, 2000, mTrackHeight); - } - else if ((Pitch % 12) == 0) - { - dc->SetPen(*wxCYAN_PEN); - dc->DrawLine(CanvasX, y + mTrackHeight, 2000, y + mTrackHeight); - - } - else if (!IsBlack(Pitch - 1)) - { - dc->SetPen(*wxGREEN_PEN); - dc->DrawLine(CanvasX, y + mTrackHeight, 2000, y + mTrackHeight); - } - - y += mTrackHeight; - --Pitch; - } - - - /////////////////////////////////////////////////////////////// - - - MouseLine = -1; - - #define VLine(x) DrawLine(x, CanvasY, x, mEventsY + mEventsHeight) - #define HLine(y) DrawLine(CanvasX, y, CanvasX + CanvasW, y) - - dc->SetPen(*wxBLACK_PEN); - - // vertical lines - - dc->VLine(xPiano); - dc->VLine(mEventsX); - dc->VLine(mEventsX-1); - dc->HLine(mEventsY); - dc->HLine(mEventsY-1); - dc->HLine(mEventsY + mEventsHeight); - - // draw vlines and bar numbers - - dc->SetFont(*mpFixedFont); - BarInfo.SetClock(FromClock); - StopClk = x2Clock(CanvasX + CanvasW); - int clk = BarInfo.Clock; - int intro = Song->GetIntroLength(); - while (clk < StopClk) - { - clk = BarInfo.Clock; - x = Clock2x(clk); - // vertical lines and bar numbers - int i; - dc->SetPen(*wxBLACK_PEN); - sprintf(buf, "%d", BarInfo.BarNr + 1 - intro); - if (x > mEventsX) - { - dc->DrawText(buf, x + LittleBit, mEventsY - hFixedFont - 2); - dc->SetPen(*wxGREY_PEN); - dc->DrawLine(x, mEventsY - hFixedFont, x, mEventsY + mEventsHeight); - } - - dc->SetPen(*wxLIGHT_GREY_PEN); - for (i = 0; i < BarInfo.CountsPerBar; i++) - { - clk += BarInfo.TicksPerBar / BarInfo.CountsPerBar; - x = Clock2x(clk); - if (x > mEventsX) - { - dc->DrawLine(x, mEventsY + 1, x, mEventsY + mEventsHeight); - } - } - BarInfo.Next(); - } - - LineText(dc, CanvasX, CanvasY, wPiano, mTopInfoHeight); - - dc->SetPen(*wxBLACK_PEN); - DrawPianoRoll(dc); - - // Draw chords from harmony-browser. - if (VisibleHBChord && gpHarmonyBrowser && !Track->IsDrumTrack()) - { - HBAnalyzer *an = gpHarmonyBrowser->getAnalyzer(); - if (an != 0) - { - wxBrush cbrush = *wxBLUE_BRUSH; - wxBrush sbrush = *wxBLUE_BRUSH; -#ifdef __WXMSW__ - cbrush.SetColour(191,191,255); - sbrush.SetColour(191,255,191); -#else - cbrush.SetColour(220,220,255); - sbrush.SetColour(230,255,230); -#endif - - //dc->SetClippingRegion(mEventsX, mEventsY, mEventsWidth, mEventsHeight); - dc->SetLogicalFunction(wxXOR); - dc->SetPen(*wxTRANSPARENT_PEN); - - int steps = an->Steps(); - for (int step = 0; step < steps; step ++) - { - int start = an->Step2Clock(step); - int stop = an->Step2Clock(step + 1); - if (stop > FromClock && start < ToClock) - { - // this chord is visible - HBContext *context = an->GetContext(step); - HBChord chord = context->Chord(); - HBChord scale = context->Scale(); - - int x = Clock2x(start); - if (x < mEventsX) // clip to left border - x = mEventsX; - int w = Clock2x(stop) - x; - if (w <= 0) - continue; - - int h = mTrackHeight; - for (int i = 0; i < 12; i++) - { - int pitch = i; - wxBrush *brush = 0; - if (chord.Contains(i)) - { - brush = &cbrush; - } - else if (scale.Contains(i)) - { - brush = &sbrush; - } - if (brush) - { - dc->SetBrush(*brush); - while (pitch < 127) - { - int y = Pitch2y(pitch); - if (y >= mEventsY && y <= mEventsY + mEventsHeight - h) // y-clipping - { - dc->DrawRectangle(x, y, w, h); - } - pitch += 12; - } - } - } - } - } - - - //dc->DestroyClippingRegion(); - dc->SetLogicalFunction(wxCOPY); - dc->SetPen(*wxBLACK_PEN); - dc->SetBrush(*wxBLACK_BRUSH); - - - //delete an; PORTING - - } - - } - /////////end draw choords - - if (VisibleAllTracks) - { - int i; - for (i = 0; i < Song->nTracks; i++) - { - JZTrack *t = Song->GetTrack(i); - if (t != Track && IsVisible(t)) - DrawEvents(dc, t, StatKeyOn, wxLIGHT_GREY_BRUSH, TRUE); - } - } - - if (VisibleKeyOn) - DrawEvents(dc,Track, StatKeyOn, wxRED_BRUSH, FALSE); - if (VisiblePitch) - DrawEvents(dc, Track, StatPitch, wxBLUE_BRUSH, FALSE); - if (VisibleController) - DrawEvents(dc, Track, StatControl, wxCYAN_BRUSH, FALSE); - if (VisibleProgram) - DrawEvents(dc, Track, StatProgram, wxGREEN_BRUSH, FALSE); - if (VisibleTempo) - DrawEvents(dc, Track, StatSetTempo, wxGREEN_BRUSH, FALSE); - if (VisibleSysex) - DrawEvents(dc, Track, StatSysEx, wxGREEN_BRUSH, FALSE); - if (VisiblePlayTrack) - DrawEvents(dc, Track, StatPlayTrack, wxLIGHT_GREY_BRUSH, FALSE); - - DrawEvents(dc, Track, StatEndOfTrack, wxRED_BRUSH, FALSE); - DrawEvents(dc, Track, StatText, wxBLACK_BRUSH, FALSE); - - dc->SetPen(*wxBLACK_PEN); - dc->SetBrush(*wxBLACK_BRUSH); - dc->SetBackground(*wxWHITE_BRUSH); // xor-bug - - SnapSel->Draw(*dc, mEventsX, mEventsY, mEventsWidth, mEventsHeight); - - DrawPlayPosition(dc); -//OBSOLETE dc->EndDrawing(); -} - - - - -void JZPianoFrame::DrawPianoRoll(wxDC* dc) -{ - char buf[20]; - - dc->SetBrush(*wxLIGHT_GREY_BRUSH); - dc->DrawRectangle(xPiano, mEventsY, wPiano, mEventsHeight); //draw grey bg for keyboard - dc->SetBrush(*wxBLACK_BRUSH); - -// dc->SetTextBackground(*wxLIGHT_GREY); - - int wBlack = wPiano * 2 / 3; - int Pitch = 127 - FromLine; - int y = Line2y(FromLine); - - if ( - VisibleKeyOn && - !Track->GetAudioMode() && - (!Track->IsDrumTrack() || !VisibleDrumNames)) - { - dc->SetFont(*mpFixedFont); - - while (Pitch >= 0 && y < mEventsY + mEventsHeight) - { - if (IsBlack(Pitch)) - { - dc->DrawRectangle(CanvasX, y, wBlack, mTrackHeight); - dc->DrawLine(CanvasX + wBlack, y + mTrackHeight/2, CanvasX + wPiano, y + mTrackHeight/2); - dc->SetPen(*wxWHITE_PEN); - dc->DrawLine(CanvasX + wBlack+1, y + mTrackHeight/2+1, CanvasX + wPiano, y + mTrackHeight/2+1); - dc->DrawLine(CanvasX, y, CanvasX + wBlack, y); - dc->SetPen(*wxBLACK_PEN); - } - else if ((Pitch % 12) == 0) - { - dc->DrawLine(CanvasX, y + mTrackHeight, CanvasX + wPiano, y + mTrackHeight); - dc->SetPen(*wxWHITE_PEN); - dc->DrawLine(CanvasX, y + mTrackHeight + 1, CanvasX + wPiano, y + mTrackHeight + 1); - dc->SetPen(*wxBLACK_PEN); - sprintf(buf, "%d", Pitch / 12); - dc->DrawText(buf, CanvasX + wBlack + LittleBit, y + mTrackHeight / 2); - } - else if (!IsBlack(Pitch - 1)) - { - dc->DrawLine(CanvasX, y + mTrackHeight, CanvasX + wPiano, y + mTrackHeight); - dc->SetPen(*wxWHITE_PEN); - dc->DrawLine(CanvasX, y + mTrackHeight + 1, CanvasX + wPiano, y + mTrackHeight + 1); - dc->SetPen(*wxBLACK_PEN); - } - - y += mTrackHeight; - --Pitch; - } - } - else if (Track->GetAudioMode()) - { - dc->SetFont(*DrumFont); - while (Pitch >= 0 && y < mEventsY + mEventsHeight) - { - dc->DrawText(gpMidiPlayer->GetSampleName(Pitch), CanvasX + LittleBit, y); - y += mTrackHeight; - --Pitch; - } - } - else - { - // Draw text? - if (VisibleKeyOn && VisibleDrumNames) - { - dc->SetFont(*DrumFont); - while (Pitch >= 0 && y < mEventsY + mEventsHeight) - { - dc->DrawText( - gpConfig->DrumName(Pitch + 1).first.c_str(), - CanvasX + LittleBit, - y); - - y += mTrackHeight; - - --Pitch; - } - } - else if (VisibleController) - { - dc->SetFont(*DrumFont); - while (Pitch >= 0 && y < mEventsY + mEventsHeight) - { - dc->DrawText( - gpConfig->CtrlName(Pitch + 1).first.c_str(), - CanvasX + LittleBit, - y); - - y += mTrackHeight; - --Pitch; - } - } - else if (VisibleProgram) - { - dc->SetFont(*DrumFont); - while (Pitch >= 0 && y < mEventsY + mEventsHeight) - { - dc->DrawText( - gpConfig->VoiceName(Pitch + 1).first.c_str(), - CanvasX + LittleBit, - y); - - y += mTrackHeight; - --Pitch; - } - } - else if (VisibleSysex) - { - dc->SetFont(*DrumFont); - while (Pitch >= 0 && y < mEventsY + mEventsHeight) - { - dc->DrawText( - tSynthSysex::GetSysexGroupName(Pitch + 1), - CanvasX + LittleBit, - y); - y += mTrackHeight; - --Pitch; - } - } - else if (VisiblePitch) - { - } - } - - //dc->DestroyClippingRegion(); - //dc->SetTextBackground(*wxWHITE); - dc->SetFont(*mpFont); -} - - -void JZPianoFrame::DrawEvent(wxDC* dc, JZEvent* pEvent, const wxBrush* Brush, int xoor, int force_color) -{ - if (pEvent->IsKeyPressure() || pEvent->IsChnPressure()) - { - return; - } - - int length = pEvent->GetLength() / ClocksPerPixel; - // Always draw at least two pixels to avoid invisible (behind a - // vertical line) or zero-length events: - if (length < 3) - length = 3; -//OBSOLETE dc->BeginDrawing(); - if (xoor) - dc->SetLogicalFunction(wxXOR); - int x = Clock2x(pEvent->GetClock()); - int y = Pitch2y(pEvent->GetPitch()); - if (!xoor) - { - dc->SetBrush(*wxWHITE_BRUSH); - dc->DrawRectangle(x, y + LittleBit, length, mTrackHeight - 2 * LittleBit); - } - - // show velocity as colors - if (force_color != 0 && UseColors && pEvent->IsKeyOn()) { - int vel = pEvent->IsKeyOn()->Veloc; - - // Next line is "Patrick Approved." - dc->SetBrush(color_brush[ vel * NUM_COLORS / 128 ]); - } - else - { - dc->SetBrush(*Brush); - } - // end velocity colors - - dc->DrawRectangle(x, y + LittleBit, length, mTrackHeight - 2 * LittleBit); - - if (xoor) - { - dc->SetLogicalFunction(wxCOPY); - } - dc->SetBrush(*wxBLACK_BRUSH); -//OBSOLETE dc->EndDrawing(); -} - - - - -void JZPianoFrame::DrawEvents(wxDC* dc, JZTrack *t, int Stat, const wxBrush* Brush, int force_color) -{ - //dc->SetClippingRegion(mEventsX, mEventsY, mEventsWidth, mEventsHeight); - dc->SetBrush(*Brush); - - tEventIterator Iterator(t); - JZEvent* pEvent = Iterator.First(); - int FromPitch = 127 - ToLine; - int ToPitch = 127 - FromLine; - - // Coordinate for Linien - - int x0 = Clock2x(0); - int y0 = Line2y(64); - char buf[20]; - - while (pEvent) - { - if (pEvent->Stat == Stat) - { - int Pitch = pEvent->GetPitch(); - int Length = pEvent->GetLength(); - int Clock = pEvent->GetClock(); - - int x1 = Clock2x(Clock); - int y1 = Line2y(127 - Pitch); -// if (pEvent->IsPlayTrack()) { -// y1=Line2y(127-pEvent->IsPlayTrack()->track); //JAVE so the y position of playtrack events tell which track they play (the drawing should rather be polymorpic in my opinion) - //use pitch instead - // } - // event partially visible? - if (Clock + Length >= FromClock && FromPitch < Pitch && Pitch <= ToPitch) - { - int DrawLength = Length/ClocksPerPixel; - // do clipping ourselves - if (x1 < mEventsX) - { - DrawLength -= mEventsX - x1; - x1 = mEventsX; - } - // Always draw at least two pixels to avoid invisible (behind a - // vertical line) or zero-length events: - if (DrawLength < 3) - { - DrawLength = 3; - } - - // show velocity as colors - if (!force_color && UseColors && pEvent->IsKeyOn()) - { - int vel = pEvent->IsKeyOn()->Veloc; - dc->SetBrush(color_brush[ vel * NUM_COLORS / 128 ]); - } - else - { - dc->SetBrush(*Brush); - } - // end velocity colors - - dc->DrawRectangle(x1, y1 + LittleBit, DrawLength, mTrackHeight - 2 * LittleBit); - //shouldnt it be in drawevent? odd. - - if (pEvent->IsPlayTrack()) - { - dc->SetPen(*wxBLACK_PEN); - ostringstream Oss; - Oss << "Track:" << pEvent->IsPlayTrack()->track; - dc->DrawText(Oss.str().c_str(), x1, y1 + LittleBit); - } - } - - if (Clock + Length >= FromClock) - { - //thesse events are always visible in vertical - if (pEvent->IsEndOfTrack()) - { - dc->SetPen(*wxRED_PEN); - dc->VLine(x1); //draw a vertical bar - dc->SetPen(*wxBLACK_PEN); - sprintf(buf, "EOT"); - dc->DrawText(buf, x1, y1 + LittleBit); - } - - if (pEvent->IsText()) - { - dc->SetPen(*wxGREEN_PEN); - dc->VLine(x1); //draw a vertical bar - dc->SetPen(*wxBLACK_PEN); - sprintf(buf, (const char*)pEvent->IsText()->GetText()); - int textX; - int textY; - - dc->GetTextExtent((const char*)pEvent->IsText()->GetText(), &textX, &textY); - dc->SetBrush(*wxWHITE_BRUSH); - int textlabely = CanvasY + mTopInfoHeight;//text labels drawn at top - dc->DrawRectangle(x1-textX, textlabely + LittleBit, textX, textY);//mTrackHeight - 2 * LittleBit); - dc->DrawText(buf, x1-textX, textlabely + LittleBit); - } - } - - x0 = x1; - y0 = y1; - - if (Clock > ToClock) - { - break; - } - } - pEvent = Iterator.Next(); - } - dc->SetBrush(*wxBLACK_BRUSH); - //dc->DestroyClippingRegion(); -} - - - // ******************************************************************** -// Utilities -// ******************************************************************** - -int JZPianoFrame::SnapClocks() -{ - int clk = Song->TicksPerQuarter * 4L / SnapDenomiator; - if (clk < 1) - return 1; - return clk; -} - -int JZPianoFrame::y2Pitch(int y) -{ - int pitch = 127 - y2Line(y); - if (pitch < 0) - return 0; - if (pitch > 127) - return 127; - return pitch; -} - - -int JZPianoFrame::Pitch2y(int Pitch) -{ - return Line2y(127 - Pitch); -} - - -JZEvent *JZPianoFrame::FindEvent(JZTrack *Track, int Clock, int Pitch) -// Pitch == -1: search for any pitches -{ - tEventIterator Iterator(Track); - JZEvent* pEvent = Iterator.First(); - while (pEvent) - { - if (pEvent->GetClock() <= Clock) - { - if ((pEvent->GetClock() + pEvent->GetLength() >= Clock) - && (pEvent->GetPitch() == Pitch || Pitch == -1) - && IsVisible(pEvent)) - { - return pEvent; - } - } - else - { - return 0; - } - pEvent = Iterator.Next(); - } - return 0; -} - - -void JZPianoFrame::kill_keys_aftertouch(JZTrack *t, JZEvent* pEvent) -{ - int key,channel; - tEventIterator iter(t); - tKeyPressure *a; - tKeyOn *k = pEvent->IsKeyOn(); - if (!k) - { - return; - } - if (k->Length < 2) - { - return; - } - key = k->Key; - channel = k->Channel; - pEvent = iter.Range(k->GetClock() + 1, k->GetClock() + k->Length); - while (pEvent) - { - a = pEvent->IsKeyPressure(); - if (a) - { - if (a->Key == key && a->Channel == channel) - { - t->Kill(pEvent); - } - } - pEvent = iter.Next(); - } -} - -void JZPianoFrame::paste_keys_aftertouch(JZTrack *t, JZEvent* pEvent) -{ - int key,channel; - tEventIterator iter(t); - tKeyPressure *a; - tKeyOn *k = pEvent->IsKeyOn(); - if (!k) return; - channel = k->Channel; - if (k->Length < 2) return; - key = k->Key; - pEvent = iter.Range(k->GetClock() + 1, k->GetClock() + k->Length); - while (pEvent) - { - a = pEvent->IsKeyPressure(); - if (a) - { - if (a->Key == key && a->Channel == channel) - { - PasteBuffer.Put(pEvent->Copy()); - } - } - pEvent = iter.Next(); - } -} - -int JZPianoFrame::nKeyOnEvents() -{ - int count = 0; - - tEventIterator Iterator(&PasteBuffer); - JZEvent* pEvent = Iterator.First(); - while (pEvent) - { - if (pEvent->IsKeyOn()) - { - count++; - } - pEvent = Iterator.Next(); - } - return count; -} - - - -void JZPianoFrame::Copy(JZTrack *t, JZEvent* pEvent, int Kill) -{ - if (!pEvent) - { - return; - } - - Song->NewUndoBuffer(); - PasteBuffer.Clear(); - PasteBuffer.Put(pEvent->Copy()); - - if (pEvent->IsKeyOn()) - { - paste_keys_aftertouch(t, pEvent); - } - - if (Kill) - { - tKeyOn *k = pEvent->IsKeyOn(); - if (k) - { - kill_keys_aftertouch(t,pEvent); - if (Track->GetAudioMode()) - { - gpMidiPlayer->ListenAudio(k->Key, 0); - } - else - { - Listen.KeyOn(Track, k->Key, k->Channel, k->Veloc, k->Length); - } - } - - wxClientDC dc(Canvas); - Canvas->PrepareDC(dc); - DrawEvent(&dc, pEvent, wxWHITE_BRUSH, 0); - t->Kill(pEvent); - t->Cleanup(); - } - - if (mpGuitarFrame) - { - mpGuitarFrame->Update(); -// mpGuitarFrame->Redraw(); - } - - // SN++ Veloc- oder Aftertouch-Editor updaten - if (CtrlEdit) - CtrlEdit->UpDate(); -} - - -void JZPianoFrame::Paste(JZTrack *t, int Clock, int Pitch) -{ - if (PasteBuffer.nEvents == 0) - { - int len = SnapClocks() - 4; - if (len < 2) - len = 2; - tKeyOn* pEvent = new tKeyOn(0, 0, 64, 64, len); - PasteBuffer.Put(pEvent); - } - // SN++ - if (nKeyOnEvents() > 1) - Pitch = -1; // don't change Pitch - - Song->NewUndoBuffer(); - tEventIterator Iterator(&PasteBuffer); - JZEvent* pEvent = Iterator.First(); - if (pEvent) - { - // SN++ - JZEvent *a = pEvent; - while (a) - { - if (pEvent->IsChnPressure()) - { - a = Iterator.Next(); - pEvent = a; - } - else - { - a = NULL; - } - } - - int DeltaClock = Clock - pEvent->GetClock(); - int DeltaPitch = 0; - if (Pitch >= 0) - DeltaPitch = Pitch - pEvent->GetPitch(); - while (pEvent) - { - JZEvent *c = pEvent->Copy(); - c->SetPitch(c->GetPitch() + DeltaPitch); - c->SetClock(c->GetClock() + DeltaClock); - if (t->ForceChannel && c->IsChannelEvent()) - c->IsChannelEvent()->Channel = t->Channel - 1; - tKeyOn *k = c->IsKeyOn(); - if (k) - { - if (Track->GetAudioMode()) - { - gpMidiPlayer->ListenAudio(k->Key, 0); - } - else - { - Listen.KeyOn(Track, k->Key, k->Channel, k->Veloc, k->Length); - } - } - wxClientDC dc(Canvas); - Canvas->PrepareDC(dc); - DrawEvent(&dc, c, c->GetBrush(), 0, 1); - t->Put(c); - pEvent = Iterator.Next(); - } - t->Cleanup(); - // SN++ Veloc- oder Aftertouch-Editor updaten - if (CtrlEdit) - CtrlEdit->UpDate(); - } -} - -// ******************************************************************** // Mouse // ******************************************************************** @@ -1992,836 +660,86 @@ * Left: midiout */ -// ------------------------------------------------------------ -// tMousePlay - Click in pianoroll -// ----------------------------------------------------------- -class tMousePlay : public tMouseAction -{ - int Pitch, Veloc, Channel; - JZPianoFrame *Win; - public: - tMousePlay(JZPianoFrame *win, wxMouseEvent& Event); - int ProcessEvent(wxMouseEvent& Event); -}; -tMousePlay::tMousePlay(JZPianoFrame *win, wxMouseEvent& Event) -{ - Win = win; - Pitch = 0; - Channel = Win->Track->Channel ? Win->Track->Channel - 1 : 0; - ProcessEvent(Event); -} - - -int tMousePlay::ProcessEvent(wxMouseEvent& Event) -{ - int x, y; - - int OldPitch = Pitch; - Win->LogicalMousePosition(Event, &x, &y); - - if (Event.LeftDown()) - { - Pitch = Win->y2Pitch(y); - Veloc = 64; - } - else if (Event.MiddleDown()) - { - Pitch = Win->y2Pitch(y); - Veloc = 80; - } - else if (Event.RightDown()) - { - Pitch = Win->y2Pitch(y); - Veloc = 110; - } - else if (Event.ButtonUp()) - { - Pitch = 0; - } - else if (Event.Dragging()) - { - Pitch = Win->y2Pitch(y); - } - else - { - return 0; - } - - if (Win->Track->GetAudioMode()) - { - if (Pitch && Pitch != OldPitch) - gpMidiPlayer->ListenAudio(Pitch, 0); - } - else - { - if (OldPitch && OldPitch != Pitch) - { - tKeyOff of(0, Channel, OldPitch); - gpMidiPlayer->OutNow(Win->Track, &of); - OldPitch = 0; - } - - if (Pitch && Pitch != OldPitch) - { - tKeyOn on(0, Channel, Pitch, Veloc); - gpMidiPlayer->OutNow(Win->Track, &on); - OldPitch = 0; - } - } - - if (!Pitch) - { - Win->MouseAction = 0; - delete this; - return 1; // done - } - return 0; -} - - -void JZPianoFrame::MousePiano(wxMouseEvent& Event) -{ - if (Event.ButtonDown()) - { - MouseAction = new tMousePlay(this, Event); - } -} - - -int JZPianoFrame::Channel() -{ - return Track->Channel ? Track->Channel - 1 : 0; -} - -// ------------------------------------------------------------------------- -// tKeyLengthDragger -// ------------------------------------------------------------------------- - -class tKeyLengthDragger : public tMouseAction -{ - tKeyOn *KeyOn; - tKeyOn *Copy; - JZPianoFrame *Win; - JZTrack *Track; - wxDC *dc; - - public: - tKeyLengthDragger(tKeyOn *k, JZPianoFrame *w); - int Dragging(wxMouseEvent& Event); - int ButtonUp(wxMouseEvent& Event); - int Event(wxMouseEvent& Event); -}; - - -tKeyLengthDragger::tKeyLengthDragger(tKeyOn *k, JZPianoFrame *w) -{ - KeyOn = k; - Copy = k->Copy() -> IsKeyOn(); - Win = w; - - // SN++ BUG FIX: undo/redo - Win->Song->NewUndoBuffer(); - // - wxClientDC dc(Win->Canvas); - Win->Canvas->PrepareDC(dc); //to translate scrolled coordinates - Win->DrawEvent(&dc, Copy, wxWHITE_BRUSH, 0); - Win->DrawEvent(&dc, Copy, Copy->GetBrush(), 1, 1); -} - -int tKeyLengthDragger::Event(wxMouseEvent& Event) -{ - if (Event.Dragging()) - { - return Dragging(Event); - } - else if (Event.ButtonUp()) - { - return ButtonUp(Event); - } - return 0; -} - -int tKeyLengthDragger::Dragging(wxMouseEvent& Event) -{ - int fx, fy; - - wxClientDC dc(Win->Canvas); - Win->Canvas->PrepareDC(dc); //to translate scrolled coordinates - Win->DrawEvent(&dc, Copy, Copy->GetBrush(), 1, 1); - Win->LogicalMousePosition(Event, &fx, &fy); - int Clock = Win->x2Clock(fx); - int Length = Clock - Copy->GetClock(); - if (Length <= 0) - { - Length = 1; - } - Copy->Length = Length; - - Win->DrawEvent(&dc, Copy, Copy->GetBrush(), 1, 1); - return 0; -} - -int tKeyLengthDragger::ButtonUp(wxMouseEvent& Event) -{ - // PAT - Since we repaint below, these calls are basically redundant. - //wxClientDC dc(Win->Canvas); - //Win->Canvas->PrepareDC(dc); - //Win->DrawEvent(&dc, Copy, Copy->GetBrush(), 1, 1); - //Win->DrawEvent(&dc, Copy, Copy->GetBrush(), 0, 1); - - // SN++ Key_Aftertouch - if (Copy->Length < KeyOn->Length) { - int key,channel; - tEventIterator iter(Win->Track); - tKeyPressure *a; - key = Copy->Key; - channel = Copy->Channel; - JZEvent* pEvent = iter.Range( - Copy->GetClock() + Copy->Length, - Copy->GetClock() + KeyOn->Length); - while (pEvent) - { - a = pEvent->IsKeyPressure(); - if (a) - { - if (a->Key == key && a->Channel == channel) - { - Win->Track->Kill(pEvent); - } - } - pEvent = iter.Next(); - } - } - // - - Win->Track->Kill(KeyOn); - Win->Track->Put(Copy); - Win->Track->Cleanup(); Win->MouseAction = 0; - - // SN++ Veloc- oder Aftertouch-Editor updaten - if (Win->CtrlEdit) - Win->CtrlEdit->UpDate(); - - - // allways repaint - Win->Redraw(); - - delete this; - return 0; -} - - -// ------------------------------------------------------------------------- -// tPlayTrackLengthDragger JAVE this is just copied from tKeyLengthDragger, -// the need to be inherited somehow -// ------------------------------------------------------------------------- - -class tPlayTrackLengthDragger : public tMouseAction -{ - tPlayTrack *KeyOn; - tPlayTrack *Copy; - JZPianoFrame *Win; - JZTrack *Track; - wxDC *dc; - - public: - tPlayTrackLengthDragger(tPlayTrack *k, JZPianoFrame *w); - int Dragging(wxMouseEvent& Event); - int ButtonUp(wxMouseEvent& Event); - int Event(wxMouseEvent& Event); -}; - - -tPlayTrackLengthDragger::tPlayTrackLengthDragger(tPlayTrack *k, JZPianoFrame *w) -{ - KeyOn = k; - Copy = k->Copy() -> IsPlayTrack(); - Win = w; - - // SN++ BUG FIX: undo/redo - Win->Song->NewUndoBuffer(); - // - wxClientDC dc(Win->Canvas); - Win->Canvas->PrepareDC(dc); - Win->DrawEvent(&dc, Copy, wxWHITE_BRUSH, 0); - Win->DrawEvent(&dc, Copy, Copy->GetBrush(), 1, 1); -} - -int tPlayTrackLengthDragger::Event(wxMouseEvent& Event) -{ - if (Event.Dragging()) - { - return Dragging(Event); - } - else if (Event.ButtonUp()) - { - return ButtonUp(Event); - } - return 0; -} - -int tPlayTrackLengthDragger::Dragging(wxMouseEvent& Event) -{ - int fx, fy; - wxClientDC dc(Win->Canvas); - Win->Canvas->PrepareDC(dc); - Win->DrawEvent(&dc, Copy, Copy->GetBrush(), 1, 1); - Win->LogicalMousePosition(Event, &fx, &fy); - int Clock = Win->x2Clock(fx); - int Length = Clock - Copy->GetClock(); - if (Length <= 0) - Length = 1; - Copy->eventlength = Length; - - Win->DrawEvent(&dc, Copy, Copy->GetBrush(), 1, 1); - return 0; -} - -int tPlayTrackLengthDragger::ButtonUp(wxMouseEvent& Event) -{ - wxClientDC dc(Win->Canvas); - Win->Canvas->PrepareDC(dc); - Win->DrawEvent(&dc, Copy, Copy->GetBrush(), 1, 1); - Win->DrawEvent(&dc, Copy, Copy->GetBrush(), 0, 1); - - Win->Track->Kill(KeyOn); - Win->Track->Put(Copy); - Win->Track->Cleanup(); Win->MouseAction = 0; - - // SN++ Veloc- oder Aftertouch-Editor updaten - if (Win->CtrlEdit) - Win->CtrlEdit->UpDate(); - - - // allways repaint - Win->Redraw(); - - delete this; - return 0; -} - - - // -------------------------------------------------------------------- -// VelocCounter -// -------------------------------------------------------------------- -class tVelocCounter : public tMouseCounter -{ - JZPianoFrame *Win; - tKeyOn *KeyOn; - public: - int Event(wxMouseEvent& Event); - tVelocCounter(JZPianoFrame *w, JZRectangle* r, tKeyOn* pEvent) - : tMouseCounter(w, r, pEvent->Veloc, 1, 127) - { - Win = w; - KeyOn = pEvent; - // SN++ BUG FIX: undo/redo - Win->Song->NewUndoBuffer(); - // - wxClientDC dc(Win->Canvas); - dc.SetFont(*(Win->mpFixedFont)); - } -}; - - -int tVelocCounter::Event(wxMouseEvent& Event) -{ - if (tMouseCounter::Event(Event)) - { - tKeyOn *Copy = (tKeyOn *)KeyOn->Copy(); - Copy->Veloc = Value; - Win->Track->Kill(KeyOn); - Win->Track->Put(Copy); - Win->Track->Cleanup(); - - wxClientDC dc(Win->Canvas); - Win->Canvas->PrepareDC(dc); - Win->DrawEvent(&dc, Copy, Copy->GetBrush(), 0, 1); - - if (Win->CtrlEdit) - Win->CtrlEdit->UpDate(); - - Win->MouseAction = 0; - - dc.SetFont(*(Win->mpFont)); - delete this; - } - return 0; -} - - - - -// -------------------------------------------------------------------- - - -void JZPianoFrame::MouseCutPaste(wxMouseEvent& Event, bool cut) -{ - - //converts physical coords to logical(scrolled) coords - wxClientDC dc(Canvas); - Canvas->PrepareDC(dc); - wxPoint point = Event.GetLogicalPosition(dc); - - int x = point.x; - int y = point.y; - - int Clock = x2Clock(x); - int Pitch = y2Pitch(y); - JZEvent *m = FindEvent(Track, Clock, Pitch); - if (m) - { - Copy(Track, m, cut); - } - else - { - Paste(Track, SnapClock(Clock), Pitch); - } - - // allways redraw - Redraw(); -} - - -void JZPianoFrame::MouseEvents(wxMouseEvent& Event) -{ - int action = MouseEvnt.Action(Event); - - if (action) - { - int x, y; - LogicalMousePosition(Event, &x, &y); - - int Clock = x2Clock(x); - int Pitch = y2Pitch(y); - JZEvent *m = FindEvent(Track, Clock, Pitch); - tKeyOn *k = 0; - tPlayTrack *p = 0; - if (m){ //both these events are drag length - k = m->IsKeyOn(); - p = m->IsPlayTrack(); - } - switch (action) - { - case MA_CUTPASTE: - MouseCutPaste(Event, 1); - break; - - case MA_COPY: - MouseCutPaste(Event, 0); - break; - - case MA_LENGTH : - if (k) - { - if (!Track->GetAudioMode()) - MouseAction = new tKeyLengthDragger(k, this); - } - else - { - if(p) - { - MouseAction = new tPlayTrackLengthDragger(p, this); - } - else if (VisibleAllTracks) - { - // event not found, maybe change to another Track - int i; - for (i = 0; i < Song->nTracks; i++) - { - JZTrack *t = Song->GetTrack(i); - if (IsVisible(t) && FindEvent(t, Clock, Pitch)) - ... [truncated message content] |
From: <pst...@us...> - 2008-03-29 21:23:57
|
Revision: 351 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=351&view=rev Author: pstieber Date: 2008-03-29 14:23:55 -0700 (Sat, 29 Mar 2008) Log Message: ----------- 1. Changed tPlayer to JZPlayer. 2. Wrapped some debug code with preprocessor checks in Player.cpp. Modified Paths: -------------- trunk/jazz/src/AlsaPlayer.cpp trunk/jazz/src/AlsaPlayer.h trunk/jazz/src/Globals.cpp trunk/jazz/src/Globals.h trunk/jazz/src/Player.cpp trunk/jazz/src/Player.h trunk/jazz/src/Project.h trunk/jazz/src/SampleWindow.cpp trunk/jazz/src/mswin/WindowsPlayer.cpp trunk/jazz/src/mswin/WindowsPlayer.h Modified: trunk/jazz/src/AlsaPlayer.cpp =================================================================== --- trunk/jazz/src/AlsaPlayer.cpp 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/AlsaPlayer.cpp 2008-03-29 21:23:55 UTC (rev 351) @@ -47,7 +47,7 @@ using namespace std; tAlsaPlayer::tAlsaPlayer(JZSong *song) - : tPlayer(song) + : JZPlayer(song) { ithru = othru = 0; @@ -74,7 +74,7 @@ snd_seq_poll_descriptors(handle, &pfds, 1, POLLIN|POLLOUT); //JAVE seqfd doesnt seem to be used for anything, not here nor in the base - // class tPlayer(but heavily in tSeq2Player) + // class JZPlayer(but heavily in tSeq2Player) // seqfd = pfds.fd; // create my input/output port @@ -412,7 +412,7 @@ play_clock = clock; flush_output(); start_timer(clock); - tPlayer::StartPlay(clock, loopClock, cont); + JZPlayer::StartPlay(clock, loopClock, cont); Notify(); //flush_output(); } @@ -590,7 +590,7 @@ void tAlsaPlayer::StopPlay() { - tPlayer::StopPlay(); + JZPlayer::StopPlay(); ResetPlay(0); flush_output(); stop_queue_timer(); Modified: trunk/jazz/src/AlsaPlayer.h =================================================================== --- trunk/jazz/src/AlsaPlayer.h 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/AlsaPlayer.h 2008-03-29 21:23:55 UTC (rev 351) @@ -40,7 +40,7 @@ -class tAlsaPlayer : public tPlayer +class tAlsaPlayer : public JZPlayer { friend class tAlsaThru; public: Modified: trunk/jazz/src/Globals.cpp =================================================================== --- trunk/jazz/src/Globals.cpp 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/Globals.cpp 2008-03-29 21:23:55 UTC (rev 351) @@ -39,7 +39,7 @@ JZSynth* gpSynth = 0; -tPlayer* gpMidiPlayer = 0; +JZPlayer* gpMidiPlayer = 0; tHelp* HelpInstance = 0; Modified: trunk/jazz/src/Globals.h =================================================================== --- trunk/jazz/src/Globals.h 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/Globals.h 2008-03-29 21:23:55 UTC (rev 351) @@ -32,7 +32,7 @@ class tConfig; class JZSong; class JZSynth; -class tPlayer; +class JZPlayer; class tHelp; class JZProject; class JZTrackFrame; @@ -49,7 +49,7 @@ extern std::string gpStartUpSong; extern JZSong* gpSong; extern JZSynth* gpSynth; -extern tPlayer* gpMidiPlayer; +extern JZPlayer* gpMidiPlayer; extern tHelp* HelpInstance; extern std::vector<std::pair<std::string, int> > gLimitSteps; extern std::vector<std::pair<std::string, int> > gModes; Modified: trunk/jazz/src/Player.cpp =================================================================== --- trunk/jazz/src/Player.cpp 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/Player.cpp 2008-03-29 21:23:55 UTC (rev 351) @@ -187,10 +187,10 @@ } } -// ------------------------- tPlayer --------------------- +// ------------------------- JZPlayer --------------------- -tPlayer::tPlayer(JZSong *song) +JZPlayer::JZPlayer(JZSong *song) : samples( song->TicksPerQuarter * song->Speed() ) { DummyDeviceList.Add("default"); @@ -203,20 +203,22 @@ rec_info = 0; } -tPlayer::~tPlayer() +JZPlayer::~JZPlayer() { delete PlayLoop; } -void tPlayer::ShowError() +void JZPlayer::ShowError() { wxMessageBox("could not install driver", "Error", wxOK); } -void tPlayer::StartPlay(long Clock, long LoopClock, int Continue) +void JZPlayer::StartPlay(long Clock, long LoopClock, int Continue) { - cout<< "tPlayer::StartPlay" << endl; +#ifdef DEBUG_PLAYER_STARTPLAY + cout << "JZPlayer::StartPlay" << endl; +#endif // DEBUG_PLAYER_STARTPLAY int i; @@ -496,7 +498,7 @@ } -void tPlayer::StopPlay() +void JZPlayer::StopPlay() { // Stop the wxTimer. Stop(); @@ -536,11 +538,14 @@ } -void tPlayer::Notify() +void JZPlayer::Notify() { // called by timer long Now = GetRealTimeClock(); - cout << "tPlayer::Notify " << Now << endl; + +#ifdef DEBUG_PLAYER_NOTIFY + cout << "JZPlayer::Notify " << Now << endl; +#endif // DEBUG_PLAYER_NOTIFY if (Now < 0) { return; @@ -549,7 +554,9 @@ // time to put more events if (Now >= (OutClock - ADVANCE_PLAY)) { +#ifdef DEBUG_PLAYER_NOTIFY cout << "*** Notify: more events to playbuffer" << endl; +#endif // DEBUG_PLAYER_NOTIFY PlayLoop->PrepareOutput(&mPlayBuffer, Song, OutClock, Now + DELTACLOCK, 0); if (AudioBuffer) @@ -578,7 +585,7 @@ } -void tPlayer::FlushToDevice() +void JZPlayer::FlushToDevice() // try to send all events up to OutClock to device { int BufferFull = 0; @@ -602,7 +609,7 @@ } -void tPlayer::AllNotesOff(int Reset) +void JZPlayer::AllNotesOff(int Reset) { tControl NoteOff(0, 0, 0x78, 0); tPitch Pitch (0, 0, 0); @@ -635,7 +642,8 @@ -void tPlayer::OutNow(JZTrack *t, tParam *r) { +void JZPlayer::OutNow(JZTrack *t, tParam *r) +{ OutNow(t, &r->Msb); OutNow(t, &r->Lsb); OutNow(t, &r->DataMsb); @@ -650,7 +658,7 @@ #ifdef DEV_MPU401 tMpuPlayer::tMpuPlayer(JZSong *song) - : tPlayer(song) + : JZPlayer(song) { poll_millisec = 25; midinethost = getenv("MIDINETHOST"); @@ -778,7 +786,7 @@ write_ack_mpu(timebase, 2); OutOfBandEvents.Clear(); - tPlayer::StartPlay(IntClock, LoopClock, Continue); + JZPlayer::StartPlay(IntClock, LoopClock, Continue); // Supress realtime messages to MIDI Out port? if (!Config(C_RealTimeOut)) { @@ -815,7 +823,7 @@ } write_ack_mpu(clocksource, 2); - tPlayer::Notify(); + JZPlayer::Notify(); // Start play write_ack_mpu( play, playsize ); @@ -827,7 +835,7 @@ void tMpuPlayer::StopPlay() { static const char stop = RES; - tPlayer::StopPlay(); + JZPlayer::StopPlay(); // Reset mpu write_ack_mpu( &stop, 1); PlyBytes.Clear(); @@ -1378,7 +1386,7 @@ tSeq2Player::tSeq2Player(JZSong *song) - : tPlayer(song) + : JZPlayer(song) { // got to poll fast for midi thru poll_millisec = 10; @@ -1734,7 +1742,7 @@ // send initial program changes, controller etc SEQ_START_TIMER(); seqbuf_dump(); - tPlayer::StartPlay(Clock, LoopClock, Continue); + JZPlayer::StartPlay(Clock, LoopClock, Continue); seqbuf_dump(); ioctl(seqfd, SNDCTL_SEQ_SYNC); SEQ_STOP_TIMER(); @@ -1751,7 +1759,7 @@ // start play SEQ_START_TIMER(); StartAudio(); - tPlayer::Notify(); + JZPlayer::Notify(); seqbuf_dump(); } @@ -1764,7 +1772,7 @@ ioctl(seqfd, SNDCTL_SEQ_RESET, 0); SEQ_START_TIMER(); - tPlayer::StopPlay(); + JZPlayer::StopPlay(); AllNotesOff(); SEQ_STOP_TIMER(); seqbuf_dump(); Modified: trunk/jazz/src/Player.h =================================================================== --- trunk/jazz/src/Player.h 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/Player.h 2008-03-29 21:23:55 UTC (rev 351) @@ -145,7 +145,7 @@ tDeviceList& operator = (const tDeviceList &); }; -class tPlayer : public wxTimer +class JZPlayer : public wxTimer { protected: @@ -229,8 +229,8 @@ tSampleSet samples; public: - tPlayer(JZSong *song); - virtual ~tPlayer(); + JZPlayer(JZSong *song); + virtual ~JZPlayer(); void Notify(); @@ -451,7 +451,7 @@ #define ACTIVE_TRACKS 7 #define ACTIVE_TRACKS_MASK 0x7f -class tMpuPlayer : public tPlayer +class tMpuPlayer : public JZPlayer { int dev; tBuffer PlyBytes; @@ -495,12 +495,12 @@ // ------------------------------ null-driver ------------------------------- -class tNullPlayer : public tPlayer +class tNullPlayer : public JZPlayer { public: tNullPlayer(JZSong* pSong) - : tPlayer(pSong) + : JZPlayer(pSong) { } @@ -565,7 +565,7 @@ -class tSeq2Player : public tPlayer +class tSeq2Player : public JZPlayer { public: friend class tOSSThru; Modified: trunk/jazz/src/Project.h =================================================================== --- trunk/jazz/src/Project.h 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/Project.h 2008-03-29 21:23:55 UTC (rev 351) @@ -23,7 +23,7 @@ #ifndef JZ_PROJECT_H #define JZ_PROJECT_H -class tPlayer; +class JZPlayer; class JZSynth; class tFilter; @@ -135,7 +135,7 @@ // Sets RecInfo, JZProject takes ownership of this object void SetRecInfo(JZRecordingInfo* pRecInfo); - tPlayer* GetPlayer() + JZPlayer* GetPlayer() { return mpMidiPlayer; } @@ -152,7 +152,7 @@ tConfig* mpConfig; - tPlayer* mpMidiPlayer; + JZPlayer* mpMidiPlayer; JZSynth* mpSynth; Modified: trunk/jazz/src/SampleWindow.cpp =================================================================== --- trunk/jazz/src/SampleWindow.cpp 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/SampleWindow.cpp 2008-03-29 21:23:55 UTC (rev 351) @@ -202,7 +202,7 @@ class tSamplePlayPosition : public wxTimer { public: - tSamplePlayPosition(tSampleCnvs &c, tPlayer *p, tSample &s) + tSamplePlayPosition(tSampleCnvs &c, JZPlayer *p, tSample &s) : cnvs(c), player(p), spl(s) { visible = FALSE; @@ -263,7 +263,7 @@ private: tSampleCnvs &cnvs; - tPlayer *player; + JZPlayer *player; tSample &spl; bool visible; int x; Modified: trunk/jazz/src/mswin/WindowsPlayer.cpp =================================================================== --- trunk/jazz/src/mswin/WindowsPlayer.cpp 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/mswin/WindowsPlayer.cpp 2008-03-29 21:23:55 UTC (rev 351) @@ -46,7 +46,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- tWinPlayer::tWinPlayer(JZSong* pSong) - : tPlayer(pSong) + : JZPlayer(pSong) { poll_millisec = 25; timer_installed = FALSE; @@ -631,7 +631,7 @@ OutOfBandEvents.Clear(); gpTrackWindow->NewPlayPosition(PlayLoop->Ext2IntClock(Clock)); state->playing = TRUE; // allow for SetTempo in OutNow() - tPlayer::StartPlay(Clock, LoopClock, Continue); + JZPlayer::StartPlay(Clock, LoopClock, Continue); if (gpConfig->GetValue(C_RealTimeOut)) { @@ -700,7 +700,7 @@ { wxBeginBusyCursor(); state->playing = FALSE; - tPlayer::StopPlay(); + JZPlayer::StopPlay(); if (gpConfig->GetValue(C_RealTimeOut)) { tStopPlay *e = new tStopPlay(0); Modified: trunk/jazz/src/mswin/WindowsPlayer.h =================================================================== --- trunk/jazz/src/mswin/WindowsPlayer.h 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/mswin/WindowsPlayer.h 2008-03-29 21:23:55 UTC (rev 351) @@ -34,7 +34,7 @@ //***************************************************************************** //***************************************************************************** -class tWinPlayer : public tPlayer +class tWinPlayer : public JZPlayer { public: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 03:03:42
|
Revision: 355 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=355&view=rev Author: pstieber Date: 2008-03-29 20:03:40 -0700 (Sat, 29 Mar 2008) Log Message: ----------- 1. Changed to take a const wxString&. 2. Fixed incorrect JAZZ environment variable test. 3. Only print debug info if the file is found. 4. Removed compiled path code. 5. Updated comment header. Modified Paths: -------------- trunk/jazz/src/FindFile.cpp trunk/jazz/src/FindFile.h Modified: trunk/jazz/src/FindFile.cpp =================================================================== --- trunk/jazz/src/FindFile.cpp 2008-03-30 00:21:03 UTC (rev 354) +++ trunk/jazz/src/FindFile.cpp 2008-03-30 03:03:40 UTC (rev 355) @@ -21,6 +21,7 @@ //***************************************************************************** #include "WxWidgets.h" +#include <wx/filename.h> #include <iostream> @@ -28,65 +29,64 @@ //***************************************************************************** // Description: -// Find a file, looking in -// 1. where the HOME environment var is pointing -// 2. where the JAZZ environment var is pointing -// 3. where the jazz executable was started +// This function attempts to find a file. It checks for the existence of +// the file by // -// This function was converted to use wxString instead of char* because it is -// safe to return localy allocated wxStrings because of reference counting. +// 1. using the passed file name +// 2. appending the passed file name to the path specified by the HOME +// environment variable, if it exists +// 3. appending the passed file name to the path specified by the JAZZ +// environment variable, if it exists +// 4. appending the passed file name to the location of the jazz executable +// +// Returns: +// wxString: +// A complete path and file name for the found file or wxEmptyString if +// the file was not found. //***************************************************************************** -wxString FindFile(const char* pFileName) +wxString FindFile(const wxString& FileName) { - wxString buf; - - if (wxFileExists((char *)pFileName)) + if (wxFileExists(FileName)) { - cout << "imediate hit " << pFileName << endl; - return pFileName; + cout << "imediate hit " << FileName << endl; + return FileName; } - wxString home; + wxString FoundFileName; + + wxString Home; if (getenv("HOME") != 0) { - home = getenv("HOME"); - buf << home << "/" << pFileName; - cout << "home " << buf <<endl; - if (wxFileExists(buf)) + Home = getenv("HOME"); + FoundFileName << Home << wxFileName::GetPathSeparator() << FileName; + if (wxFileExists(FoundFileName)) { - return buf; + cout << "home " << FoundFileName << endl; + return FoundFileName; } } - if (getenv("HOME") != 0) + + if (getenv("JAZZ") != 0) { - buf = ""; - home = getenv("JAZZ"); - buf << home << "/" << pFileName; - cout << "jazz " << buf <<endl; - if (wxFileExists(buf)) + FoundFileName = ""; + Home = getenv("JAZZ"); + FoundFileName << Home << wxFileName::GetPathSeparator() << FileName; + if (wxFileExists(FoundFileName)) { - return buf; + cout << "jazz " << FoundFileName <<endl; + return FoundFileName; } } - // look where the executable was started - home = wxPathOnly((const char *)wxTheApp->argv[0]); - buf = ""; - buf << home << "/" << pFileName; - cout <<"startup " << buf <<endl; - if (wxFileExists(buf)) + // Look where the executable was started. + FoundFileName = ""; + Home = wxPathOnly((const char *)wxTheApp->argv[0]); + FoundFileName << Home << wxFileName::GetPathSeparator() << FileName; + if (wxFileExists(FoundFileName)) { - return buf; + cout << "startup " << FoundFileName << endl; + return FoundFileName; } - // look in the compiled-in path -// buf = ""; -// buf << JAZZ_DATADIR << "/" << pFileName; -// cout << "compiled in path " << buf << " " << wxFileExists(buf) << endl; -// if (wxFileExists(buf)) -// { -// return buf; -// } - return wxEmptyString; } Modified: trunk/jazz/src/FindFile.h =================================================================== --- trunk/jazz/src/FindFile.h 2008-03-30 00:21:03 UTC (rev 354) +++ trunk/jazz/src/FindFile.h 2008-03-30 03:03:40 UTC (rev 355) @@ -23,6 +23,23 @@ #ifndef JZ_FINDFILE_H #define JZ_FINDFILE_H -wxString FindFile(const char* pFileName); +//***************************************************************************** +// Description: +// This function attempts to find a file. It checks for the existence of +// the file by +// +// 1. using the passed file name +// 2. appending the passed file name to the path specified by the HOME +// environment variable, if it exists +// 3. appending the passed file name to the path specified by the JAZZ +// environment variable, if it exists +// 4. appending the passed file name to the location of the jazz executable +// +// Returns: +// wxString: +// A complete path and file name for the found file or wxEmptyString if +// the file was not found. +//***************************************************************************** +wxString FindFile(const wxString& pFileName); #endif // !defined(JZ_FINDFILE_H) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 03:05:57
|
Revision: 357 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=357&view=rev Author: pstieber Date: 2008-03-29 20:05:55 -0700 (Sat, 29 Mar 2008) Log Message: ----------- 1. Added code to initiate loop play. 2. Removed some debug output. Modified Paths: -------------- trunk/jazz/src/TrackFrame.cpp trunk/jazz/src/TrackFrame.h Modified: trunk/jazz/src/TrackFrame.cpp =================================================================== --- trunk/jazz/src/TrackFrame.cpp 2008-03-30 03:04:51 UTC (rev 356) +++ trunk/jazz/src/TrackFrame.cpp 2008-03-30 03:05:55 UTC (rev 357) @@ -76,6 +76,8 @@ EVT_MENU(ID_PLAY, JZTrackFrame::OnPlay) + EVT_MENU(ID_PLAY_LOOP, JZTrackFrame::OnPlayLoop) + EVT_MENU(ID_PIANOWIN, JZTrackFrame::OnPianoWindow) EVT_MENU(ID_METRONOME_ON, JZTrackFrame::OnMetroOn) @@ -463,13 +465,20 @@ //----------------------------------------------------------------------------- void JZTrackFrame::OnPlay(wxCommandEvent& Event) { - cout << "JZTrackFrame::OnPlay" << endl; wxMouseEvent MouseEvent; MousePlay(MouseEvent, ePlayButton); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +void JZTrackFrame::OnPlayLoop(wxCommandEvent& Event) +{ + wxMouseEvent MouseEvent; + MousePlay(MouseEvent, ePlayLoopButton); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void JZTrackFrame::OnPianoWindow(wxCommandEvent& Event) { JZPianoFrame* pPianoFrame = new JZPianoFrame( @@ -547,8 +556,6 @@ //----------------------------------------------------------------------------- void JZTrackFrame::MousePlay(wxMouseEvent& Event, TEMousePlayMode Mode) { - cout << "JZTrackFrame::MousePlay" << endl; - mpTrackWindow->MousePlay(Event, Mode); /* @@ -585,7 +592,6 @@ break; case ePlayButton: - cout << "JZTrackFrame::PlayButton" << endl; gpProject->SetLoop(false); gpProject->SetRecord(false); break; @@ -665,16 +671,11 @@ loop_clock = mpFilter->ToClock; } - // GO! - cout << "Go!" << endl; - //if (pRecInfo->Track) // recording? //gpProject->Midi->SetRecordInfo(pRecInfo); //else //gpProject->Midi->SetRecordInfo(0); - cout << "Midi->StartPlay" << endl; - gpProject->mStartTime = mPreviousClock; gpProject->mStopTime = loop_clock; gpProject->Play(); Modified: trunk/jazz/src/TrackFrame.h =================================================================== --- trunk/jazz/src/TrackFrame.h 2008-03-30 03:04:51 UTC (rev 356) +++ trunk/jazz/src/TrackFrame.h 2008-03-30 03:05:55 UTC (rev 357) @@ -78,6 +78,8 @@ void OnPlay(wxCommandEvent& Event); + void OnPlayLoop(wxCommandEvent& Event); + void OnPianoWindow(wxCommandEvent& Event); void OnToolsHarmonyBrowser(wxCommandEvent& Event); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 12:07:04
|
Revision: 363 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=363&view=rev Author: pstieber Date: 2008-03-30 05:07:02 -0700 (Sun, 30 Mar 2008) Log Message: ----------- 1. Changed File to GetFileName and made it private. 2. Added a data member to record the name of the configuration file. If this variable is set, GetFileName can avoid calls to FindFile. Modified Paths: -------------- trunk/jazz/src/Configuration.cpp trunk/jazz/src/Configuration.h Modified: trunk/jazz/src/Configuration.cpp =================================================================== --- trunk/jazz/src/Configuration.cpp 2008-03-30 12:00:14 UTC (rev 362) +++ trunk/jazz/src/Configuration.cpp 2008-03-30 12:07:02 UTC (rev 363) @@ -114,7 +114,8 @@ tConfig::tConfig() - : mDrumNames(), + : mFileName(), + mDrumNames(), mDrumSets(), mCtrlNames(), mVoiceNames(), @@ -336,16 +337,27 @@ return -1; } -// Return the Jazz++ configuration file name, normally jazz.cfg. -// Search in the path provided by FindFile() -wxString tConfig::File() +//----------------------------------------------------------------------------- +// Description: +// Return the Jazz++ configuration file name, normally jazz.cfg. If the +// value has not been set by an earlier call to LoadConfig, attempt to find +// the file using FindFile(). +//----------------------------------------------------------------------------- +wxString tConfig::GetFileName() { - wxString FileName = FindFile("jazz.cfg"); - if (FileName.IsEmpty()) + if (!mFileName.empty()) { - FileName = FindFile(".jazz"); + return mFileName; } - return FileName; + + mFileName = FindFile("jazz.cfg"); + + if (mFileName.empty()) + { + mFileName = FindFile(".jazz"); + } + + return mFileName; } int tConfig::Load(char* buf) @@ -418,7 +430,7 @@ { assert((entry >= 0) && (entry < NumConfigNames)); - wxString FileName = File(); + wxString FileName = GetFileName(); if (FileName.IsEmpty()) { return false; @@ -458,15 +470,17 @@ return false; } +//----------------------------------------------------------------------------- // Description: // Write a configuration entry by making a temp file, and copying all // entries to there. If the name/value pair is found, replace it, otherwise // write it. Finally copy the temp file over the old configuration file. +//----------------------------------------------------------------------------- bool tConfig::Put(int Index, const char *value) { assert((Index >= 0) && (Index < NumConfigNames)); - wxString FileName = File(); + wxString FileName = GetFileName(); if (FileName.IsEmpty()) { return false; @@ -539,9 +553,16 @@ //----------------------------------------------------------------------------- void tConfig::LoadConfig(const wxString& FileName) { + if (!::wxFileExists(FileName)) + { + return; + } + + mFileName = FileName; + wxString OriginalCurrentWorkingDirectory = ::wxGetCwd(); - wxFileName FileNameObject(FileName); + wxFileName FileNameObject(mFileName); wxString Path = FileNameObject.GetPath(); ::wxSetWorkingDirectory(Path); @@ -562,10 +583,12 @@ FdArr[i] = NULL; } - cout << "tConfig::LoadConfig \"" << FileName << '"' << endl; + cout + << "tConfig::LoadConfig:" << '\n' + << " \"" << mFileName << '"' + << endl; - FdArr[IncLevel] = fopen(FileName.c_str(), "r"); - cout << FileName << endl; + FdArr[IncLevel] = fopen(mFileName.c_str(), "r"); if (FdArr[IncLevel] == NULL) { wxMessageBox( Modified: trunk/jazz/src/Configuration.h =================================================================== --- trunk/jazz/src/Configuration.h 2008-03-30 12:00:14 UTC (rev 362) +++ trunk/jazz/src/Configuration.h 2008-03-30 12:07:02 UTC (rev 363) @@ -181,8 +181,6 @@ void LoadConfig(const wxString& FileName); - wxString File(); - int Check(const char* pName) const; int Load(char* buf); @@ -232,6 +230,16 @@ private: + // Description: + // Return the Jazz++ configuration file name, normally jazz.cfg. If the + // value has not been set by an earlier call to LoadConfig, attempt to + // find the file using FindFile(). + wxString GetFileName(); + + private: + + wxString mFileName; + tConfigEntry* Names[NumConfigNames]; std::vector<std::pair<std::string, int> > mDrumNames; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 12:42:48
|
Revision: 365 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=365&view=rev Author: pstieber Date: 2008-03-30 05:42:46 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Made cosmetic style changes. Modified Paths: -------------- trunk/jazz/src/Song.cpp trunk/jazz/src/Song.h Modified: trunk/jazz/src/Song.cpp =================================================================== --- trunk/jazz/src/Song.cpp 2008-03-30 12:21:10 UTC (rev 364) +++ trunk/jazz/src/Song.cpp 2008-03-30 12:42:46 UTC (rev 365) @@ -61,7 +61,7 @@ return mTracks[0].GetDefaultSpeed(); } -void JZSong::Read(tReadBase &io, const char *fname) +void JZSong::Read(tReadBase& Io, const char* pFileName) { int i; wxBeginBusyCursor(); @@ -69,13 +69,13 @@ { mTracks[i].Clear(); } - int n = io.Open(fname); + int n = Io.Open(pFileName); for (i = 0; i < n && i < eMaxTrackCount; ++i) { - mTracks[i].Read(io); + mTracks[i].Read(Io); } - io.Close(); - TicksPerQuarter = io.TicksPerQuarter; + Io.Close(); + TicksPerQuarter = Io.TicksPerQuarter; if (TicksPerQuarter < 48) { @@ -97,7 +97,7 @@ } -void JZSong::Write(tWriteBase &io, const char *fname) +void JZSong::Write(tWriteBase& Io, const char* pFileName) { // Make sure track 0 has a synth reset if (!mTracks[0].Reset) @@ -106,7 +106,7 @@ } int n = NumUsedTracks(); - if (!io.Open(fname, n, TicksPerQuarter)) + if (!Io.Open(pFileName, n, TicksPerQuarter)) { return; } @@ -114,9 +114,9 @@ wxBeginBusyCursor(); for (int i = 0; i < n; ++i) { - mTracks[i].Write(io); + mTracks[i].Write(Io); } - io.Close(); + Io.Close(); wxEndBusyCursor(); } Modified: trunk/jazz/src/Song.h =================================================================== --- trunk/jazz/src/Song.h 2008-03-30 12:21:10 UTC (rev 364) +++ trunk/jazz/src/Song.h 2008-03-30 12:42:46 UTC (rev 365) @@ -83,8 +83,8 @@ virtual ~JZSong(); void Clear(); - void Read(tReadBase &io, const char *fname = 0); - void Write(tWriteBase &io, const char *fname = 0); + void Read(tReadBase& Io, const char* pFileName = 0); + void Write(tWriteBase& Io, const char* pFileName = 0); JZTrack *GetTrack(int Nr); int GetLastClock(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 12:45:11
|
Revision: 366 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=366&view=rev Author: pstieber Date: 2008-03-30 05:45:05 -0700 (Sun, 30 Mar 2008) Log Message: ----------- 1. Added some function comment headers. 2. Changed the Save argument from wxString to const wxString& to prevent the creation of a copy. 3. Recorded the song file name passed to Save as the startup song in the configuration file. Modified Paths: -------------- trunk/jazz/src/Project.cpp trunk/jazz/src/Project.h Modified: trunk/jazz/src/Project.cpp =================================================================== --- trunk/jazz/src/Project.cpp 2008-03-30 12:42:46 UTC (rev 365) +++ trunk/jazz/src/Project.cpp 2008-03-30 12:45:05 UTC (rev 366) @@ -497,26 +497,34 @@ //----------------------------------------------------------------------------- // Description: -// Open a midi file. Pass it a wxString containing the path to the file. +// Open a MIDI file. +// +// Inputs: +// const wxString& SongFileName: +// Song path and file name. //----------------------------------------------------------------------------- void JZProject::OpenSong(const wxString& SongFileName) { - tStdRead io; + tStdRead Io; Clear(); - Read(io, SongFileName); + Read(Io, SongFileName); mpConfig->Put(C_StartUpSong, SongFileName.c_str()); } -/** - * - * Save a midi file. Pass it a wxString containing the path to the file. - * Save will overwrite the file if it is already there! - * - */ -void JZProject::Save(wxString newsong) +//----------------------------------------------------------------------------- +// Description: +// Save a MIDI file. This function will overwrite the file if it already +// exists! +// +// Inputs: +// const wxString& SongFileName: +// Song path and file name. +//----------------------------------------------------------------------------- +void JZProject::Save(const wxString& SongFileName) { - tStdWrite io; - Write(io, newsong); + tStdWrite Io; + Write(Io, SongFileName); + mpConfig->Put(C_StartUpSong, SongFileName.c_str()); } //----------------------------------------------------------------------------- Modified: trunk/jazz/src/Project.h =================================================================== --- trunk/jazz/src/Project.h 2008-03-30 12:42:46 UTC (rev 365) +++ trunk/jazz/src/Project.h 2008-03-30 12:45:05 UTC (rev 366) @@ -95,11 +95,22 @@ // Set the pattern file name. void SetPattern(const wxString& PatternFileName); - // Open the Song + // Description: + // Open a MIDI file. + // + // Inputs: + // const wxString& SongFileName: + // Song path and file name. void OpenSong(const wxString& SongFileName); - // Save the song - void Save(wxString newsong); + // Description: + // Save a MIDI file. This function will overwrite the file if it + // already exists! + // + // Inputs: + // const wxString& SongFileName: + // Song path and file name. + void Save(const wxString& SongFileName); // Here is the new play interface. For now it just acts as a layer // between the Project and the GUI. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 13:41:22
|
Revision: 367 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=367&view=rev Author: pstieber Date: 2008-03-30 06:41:19 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Added code to implement Save As... Modified Paths: -------------- trunk/jazz/src/TrackFrame.cpp trunk/jazz/src/TrackFrame.h Modified: trunk/jazz/src/TrackFrame.cpp =================================================================== --- trunk/jazz/src/TrackFrame.cpp 2008-03-30 12:45:05 UTC (rev 366) +++ trunk/jazz/src/TrackFrame.cpp 2008-03-30 13:41:19 UTC (rev 367) @@ -72,6 +72,8 @@ EVT_MENU(wxID_OPEN, JZTrackFrame::OnFileOpen) + EVT_MENU(wxID_SAVEAS, JZTrackFrame::OnFileSaveAs) + EVT_MENU(wxID_EXIT, JZTrackFrame::OnFileExit) EVT_MENU(ID_PLAY, JZTrackFrame::OnPlay) @@ -452,6 +454,27 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +void JZTrackFrame::OnFileSaveAs(wxCommandEvent& Event) +{ + // wxFD_OVERWRITE_PROMPT - For save dialog only: prompt for a confirmation + // if a file will be overwritten. + wxFileDialog SaveAsDialog( + 0, + "Save MIDI File", + "", + "", + "*.mid", + wxFD_SAVE | wxFD_OVERWRITE_PROMPT); + if (SaveAsDialog.ShowModal() == wxID_OK) + { + wxString FileName = SaveAsDialog.GetPath(); + gpProject->Save(FileName); + SetTitle(FileName); + } +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void JZTrackFrame::OnFileExit(wxCommandEvent& Event) { if (OnClose() == false) Modified: trunk/jazz/src/TrackFrame.h =================================================================== --- trunk/jazz/src/TrackFrame.h 2008-03-30 12:45:05 UTC (rev 366) +++ trunk/jazz/src/TrackFrame.h 2008-03-30 13:41:19 UTC (rev 367) @@ -70,6 +70,8 @@ void OnFileOpen(wxCommandEvent& Event); + void OnFileSaveAs(wxCommandEvent& Event); + void OnFileExit(wxCommandEvent& Event); void OnZoomIn(wxCommandEvent& Event); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 14:35:34
|
Revision: 368 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=368&view=rev Author: pstieber Date: 2008-03-30 07:35:30 -0700 (Sun, 30 Mar 2008) Log Message: ----------- 1. Renamed the following classes to match the new coding style: tReadBase -> JZReadBase tWriteBase -> JZWriteBase tStdChunk -> JZStandardChunk tStdRead -> JZStandardRead tStdWrite -> JZStandardWrite 2. Added constructors for JZReadBase and JZWriteBase so data members could be initialized. 3. Separated JZReadBase and JZWriteBase inline member function definitions from the declarations. 4. Prefixed JZReadBase and JZWriteBase data members with m to match the new coding style, and made them protected. 5. Added JZReadBase::GetTicksPerQuarter so the mTicksPerQuarter data member could be made protected instead of public. 6. Moved the JZStandardChunk declaration from the header to the source file because no other code uses it. 7. Changed the file name argument of JZStandardWrite::Open from char* to const char* to match the virtual base class version. Prior to this change the base class version was incorrectly called when used in a polymorphic manner. 8. Changed some local variable names to match the new coding style. 9. Made some cosmetic indentation changes. Modified Paths: -------------- trunk/jazz/src/Events.cpp trunk/jazz/src/Events.h trunk/jazz/src/Project.cpp trunk/jazz/src/Song.cpp trunk/jazz/src/Song.h trunk/jazz/src/StandardFile.cpp trunk/jazz/src/StandardFile.h trunk/jazz/src/Track.cpp trunk/jazz/src/Track.h Modified: trunk/jazz/src/Events.cpp =================================================================== --- trunk/jazz/src/Events.cpp 2008-03-30 13:41:19 UTC (rev 367) +++ trunk/jazz/src/Events.cpp 2008-03-30 14:35:30 UTC (rev 368) @@ -41,16 +41,31 @@ //***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tReadBase::Open(const char* pFileName) +JZReadBase::JZReadBase() + : mTicksPerQuarter(0), + mTrackCount(0), + mpFd(NULL) { +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZReadBase::~JZReadBase() +{ +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZReadBase::Open(const char* pFileName) +{ if (pFileName == NULL) { - fd = stdin; + mpFd = stdin; } else { - fd = fopen(pFileName, "rb"); - if (fd == NULL) + mpFd = fopen(pFileName, "rb"); + if (mpFd == NULL) { ostringstream Oss; Oss << "Error opening file " << pFileName; @@ -63,11 +78,11 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void tReadBase::Close() +void JZReadBase::Close() { - if (fd != stdin) + if (mpFd != stdin) { - fclose(fd); + fclose(mpFd); } } @@ -75,11 +90,27 @@ //***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tWriteBase::Open(const char* pFileName, int nTracks, int TicksPerQuarter) +JZWriteBase::JZWriteBase() + : mpFd(NULL) { +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZWriteBase::~JZWriteBase() +{ +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZWriteBase::Open( + const char* pFileName, + int TrackCount, + int TicksPerQuarter) +{ if (pFileName == NULL) { - fd = stdout; + mpFd = stdout; } else { @@ -98,8 +129,8 @@ delete syscmd; } #endif - fd = fopen(pFileName, "wb"); - if (fd == NULL) + mpFd = fopen(pFileName, "wb"); + if (mpFd == NULL) { ostringstream Oss; Oss << "Error opening file " << pFileName; @@ -107,16 +138,16 @@ return 0; } } - return nTracks; + return TrackCount; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void tWriteBase::Close() +void JZWriteBase::Close() { - if (fd != stdout) + if (mpFd != stdout) { - fclose(fd); + fclose(mpFd); } } Modified: trunk/jazz/src/Events.h =================================================================== --- trunk/jazz/src/Events.h 2008-03-30 13:41:19 UTC (rev 367) +++ trunk/jazz/src/Events.h 2008-03-30 14:35:30 UTC (rev 368) @@ -33,113 +33,183 @@ // - Ascii-File // - Midi-Port //***************************************************************************** - -class tReadBase +class JZReadBase { public: - virtual ~tReadBase() - { - } + JZReadBase(); - // Ths value is known after a call to Open. - int TicksPerQuarter; + virtual ~JZReadBase(); - int nTracks; - virtual int Open(const char* pFileName); virtual void Close(); + int GetTicksPerQuarter() const; + virtual JZEvent* Read() = 0; virtual int NextTrack() = 0; protected: - FILE* fd; + // Ths value is known after a call to Open. + int mTicksPerQuarter; + + int mTrackCount; + + FILE* mpFd; }; +//***************************************************************************** +// Description: +// These are the read base class inline member functions. +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZReadBase::GetTicksPerQuarter() const +{ + return mTicksPerQuarter; +} -class tWriteBase +//***************************************************************************** +//***************************************************************************** +class JZWriteBase { public: - virtual ~tWriteBase() - { - } + JZWriteBase(); - virtual int Open(const char* pFileName, int nTracks, int TicksPerQuarter); + virtual ~JZWriteBase(); + virtual int Open( + const char* pFileName, + int TrackCount, + int TicksPerQuarter); + virtual void Close(); - virtual int Write(JZEvent* pEvent) - { - return Write(pEvent, 0, 0); - } + virtual int Write(JZEvent* pEvent); - virtual int Write(JZEvent* pEvent, unsigned char Character) - { - return Write(pEvent, &Character, 1); - } + virtual int Write(JZEvent* pEvent, unsigned char Character); virtual int Write( JZEvent* pEvent, unsigned char Character1, - unsigned char Character2) - { - unsigned char Array[2]; - Array[0] = Character1; - Array[1] = Character2; - return Write(pEvent, Array, 2); - } + unsigned char Character2); virtual int Write( JZEvent* pEvent, unsigned char Character1, unsigned char Character2, - unsigned char Character3) - { - unsigned char Array[3]; - Array[0] = Character1; - Array[1] = Character2; - Array[2] = Character3; - return Write(pEvent, Array, 3); - } + unsigned char Character3); virtual int Write( JZEvent* pEvent, unsigned char Character1, unsigned char Character2, unsigned char Character3, - unsigned char Character4) - { - unsigned char Array[4]; - Array[0] = Character1; - Array[1] = Character2; - Array[2] = Character3; - Array[3] = Character4; - return Write(pEvent, Array, 4); - } + unsigned char Character4); - virtual int Write(JZEvent* pEvent, unsigned char* pString, int Length) = 0; + virtual int Write( + JZEvent* pEvent, + unsigned char* pString, + int Length) = 0; - virtual void NextTrack() - { - } + virtual void NextTrack(); protected: - FILE* fd; + FILE* mpFd; }; +//***************************************************************************** +// Description: +// These are the write base class inline member functions. +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZWriteBase::Write(JZEvent* pEvent) +{ + return Write(pEvent, 0, 0); +} -// -------------------------------------------------------------------------- -// tGetMidiBytes -// -------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZWriteBase::Write(JZEvent* pEvent, unsigned char Character) +{ + return Write(pEvent, &Character, 1); +} -class tGetMidiBytes : public tWriteBase +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZWriteBase::Write( + JZEvent* pEvent, + unsigned char Character1, + unsigned char Character2) { + unsigned char Array[2]; + + Array[0] = Character1; + Array[1] = Character2; + + return Write(pEvent, Array, 2); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZWriteBase::Write( + JZEvent* pEvent, + unsigned char Character1, + unsigned char Character2, + unsigned char Character3) +{ + unsigned char Array[3]; + + Array[0] = Character1; + Array[1] = Character2; + Array[2] = Character3; + + return Write(pEvent, Array, 3); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZWriteBase::Write( + JZEvent* pEvent, + unsigned char Character1, + unsigned char Character2, + unsigned char Character3, + unsigned char Character4) +{ + unsigned char Array[4]; + + Array[0] = Character1; + Array[1] = Character2; + Array[2] = Character3; + Array[3] = Character4; + + return Write(pEvent, Array, 4); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZWriteBase::NextTrack() +{ +} + +//***************************************************************************** +// tGetMidiBytes +//***************************************************************************** +class tGetMidiBytes : public JZWriteBase +{ public: int Open(const char* pFileName, int nTracks, int TicksPerQuarter) @@ -348,7 +418,7 @@ virtual tEndOfTrack* IsEndOfTrack() { edb(); return 0; } virtual tChnPressure* IsChnPressure() { edb(); return 0; } - virtual int Write(tWriteBase& io) + virtual int Write(JZWriteBase& io) { edb(); return io.Write(this); @@ -470,7 +540,7 @@ OffVeloc = 0; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, Key, Veloc); } @@ -500,7 +570,7 @@ OffVeloc = veloc; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, Key, OffVeloc); } @@ -528,7 +598,7 @@ Value = val; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { int v = Value + 8192; edb(); return io.Write(this, (unsigned char)(v & 0x7F), (unsigned char)(v >> 7)); @@ -559,7 +629,7 @@ Value = val; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, Control, Value); } @@ -584,7 +654,7 @@ Program = prg; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, Program); } @@ -621,7 +691,7 @@ delete [] Data; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, Data, Length); } @@ -931,7 +1001,7 @@ this->eventlength=eventlength; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { Data = new unsigned char [Length + 1]; @@ -997,7 +1067,7 @@ virtual int GetPitch() { edb(); return GetBPM() / 2; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, (char)(uSec >> 16), (char)(uSec >> 8), (char)uSec); } @@ -1042,7 +1112,7 @@ Quarter = Character4; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, Numerator, Denomiator, Clocks, Quarter); } @@ -1068,7 +1138,7 @@ { } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this); } @@ -1092,7 +1162,7 @@ Minor = Character2; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, Sharps, Minor); } @@ -1114,7 +1184,7 @@ Key = key; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, Key, Value); } @@ -1139,7 +1209,7 @@ Value = val; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, Value); } Modified: trunk/jazz/src/Project.cpp =================================================================== --- trunk/jazz/src/Project.cpp 2008-03-30 13:41:19 UTC (rev 367) +++ trunk/jazz/src/Project.cpp 2008-03-30 14:35:30 UTC (rev 368) @@ -310,8 +310,8 @@ if (fd) { fclose(fd); - tStdRead io; - Read(io, gpStartUpSong.c_str()); + JZStandardRead Io; + Read(Io, gpStartUpSong.c_str()); // if (gpStartUpSong == string("jazz.mid")) // { // lasts = gpStartUpSong; @@ -505,7 +505,7 @@ //----------------------------------------------------------------------------- void JZProject::OpenSong(const wxString& SongFileName) { - tStdRead Io; + JZStandardRead Io; Clear(); Read(Io, SongFileName); mpConfig->Put(C_StartUpSong, SongFileName.c_str()); @@ -522,7 +522,7 @@ //----------------------------------------------------------------------------- void JZProject::Save(const wxString& SongFileName) { - tStdWrite Io; + JZStandardWrite Io; Write(Io, SongFileName); mpConfig->Put(C_StartUpSong, SongFileName.c_str()); } Modified: trunk/jazz/src/Song.cpp =================================================================== --- trunk/jazz/src/Song.cpp 2008-03-30 13:41:19 UTC (rev 367) +++ trunk/jazz/src/Song.cpp 2008-03-30 14:35:30 UTC (rev 368) @@ -61,7 +61,7 @@ return mTracks[0].GetDefaultSpeed(); } -void JZSong::Read(tReadBase& Io, const char* pFileName) +void JZSong::Read(JZReadBase& Io, const char* pFileName) { int i; wxBeginBusyCursor(); @@ -75,7 +75,7 @@ mTracks[i].Read(Io); } Io.Close(); - TicksPerQuarter = Io.TicksPerQuarter; + TicksPerQuarter = Io.GetTicksPerQuarter(); if (TicksPerQuarter < 48) { @@ -97,7 +97,7 @@ } -void JZSong::Write(tWriteBase& Io, const char* pFileName) +void JZSong::Write(JZWriteBase& Io, const char* pFileName) { // Make sure track 0 has a synth reset if (!mTracks[0].Reset) Modified: trunk/jazz/src/Song.h =================================================================== --- trunk/jazz/src/Song.h 2008-03-30 13:41:19 UTC (rev 367) +++ trunk/jazz/src/Song.h 2008-03-30 14:35:30 UTC (rev 368) @@ -83,8 +83,8 @@ virtual ~JZSong(); void Clear(); - void Read(tReadBase& Io, const char* pFileName = 0); - void Write(tWriteBase& Io, const char* pFileName = 0); + void Read(JZReadBase& Io, const char* pFileName = 0); + void Write(JZWriteBase& Io, const char* pFileName = 0); JZTrack *GetTrack(int Nr); int GetLastClock(); Modified: trunk/jazz/src/StandardFile.cpp =================================================================== --- trunk/jazz/src/StandardFile.cpp 2008-03-30 13:41:19 UTC (rev 367) +++ trunk/jazz/src/StandardFile.cpp 2008-03-30 14:35:30 UTC (rev 368) @@ -35,22 +35,24 @@ using namespace std; -// ---------------------------------------------------------------------- -// StdFile-Util -// ---------------------------------------------------------------------- - #ifdef sparc +//***************************************************************************** +//***************************************************************************** static void SwapW(void *p) { } +//***************************************************************************** +//***************************************************************************** static void SwapL(void *p) { } #else +//***************************************************************************** +//***************************************************************************** static void SwapW(void* p) { char *cp = (char *)p; @@ -59,7 +61,8 @@ cp[1] = tmp; } - +//***************************************************************************** +//***************************************************************************** static void SwapL(void* p) { short tmp, *sp = (short *)p; @@ -72,11 +75,50 @@ #endif -// -------------------------------------------------------------- +//***************************************************************************** +//***************************************************************************** +class JZStandardChunk +{ + public: + + JZStandardChunk(); + + ~JZStandardChunk(); + + int IsEof(); // Only after Load, Save never has Eof. + + void Load(FILE* fd); + + void Save(FILE* fd); // Depends on EndOfTrack + + void Put(JZEvent* pEvent, unsigned char* pData, int Length); + + // A return value of NULL indicates we are at the end of the track. + JZEvent* Get(); + + void Rewind(); + + private: + + long Size; // Size of base + long nRead; // Number of bytes read from the file + unsigned char* mpBase; // Buffer for data. + unsigned char* cp; // Aktueller Schreib/Lese pointer + long Clock; // Absolute Clock + int EofSeen; // endoftrack meta-event read + int RunningStatus; + + void Resize(int SizeNeeded); + void PutVar(unsigned long val); + unsigned long GetVar(); +}; + +//***************************************************************************** // StdChunk -// -------------------------------------------------------------- - -tStdChunk::tStdChunk() +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZStandardChunk::JZStandardChunk() : mpBase(0) { Size = 128; @@ -85,12 +127,16 @@ Rewind(); } -tStdChunk::~tStdChunk() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZStandardChunk::~JZStandardChunk() { delete [] mpBase; } -void tStdChunk::Rewind() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZStandardChunk::Rewind() { RunningStatus = 0; cp = mpBase; @@ -98,14 +144,17 @@ Clock = 0; } - -inline void tStdChunk::Resize(int Needed) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZStandardChunk::Resize(int Needed) { long Used = cp - mpBase; long i, n = Size; if (Size - Used < Needed) { - do { + do + { Size *= 2; //mpBase = (unsigned char *)realloc(mpBase, Size); } while (Size - Used < Needed); @@ -120,14 +169,17 @@ } } - -inline int tStdChunk::IsEof() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZStandardChunk::IsEof() { return EofSeen || ((cp - mpBase) >= nRead); } - -void tStdChunk::PutVar(unsigned long val) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZStandardChunk::PutVar(unsigned long val) { unsigned long buf; buf = val & 0x7f; @@ -148,8 +200,9 @@ } } - -unsigned long tStdChunk::GetVar() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +unsigned long JZStandardChunk::GetVar() { unsigned long val; char c; @@ -163,38 +216,40 @@ return val; } - - -void tStdChunk::Put(JZEvent *e, unsigned char* Data, int Length) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZStandardChunk::Put(JZEvent* pEvent, unsigned char* Data, int Length) { unsigned char Stat; long dif; Resize(Length + 20); - dif = e->GetClock() - Clock; + dif = pEvent->GetClock() - Clock; PutVar(dif); Clock += dif; #if 0 -printfxxo("%02X %02X ", e->Clock, dif); -if (e->Stat != 0x90) -{ - int i; - printf("%02X ", e->Stat); - for (i = 0; i < Length; i++) - printf("%02X ", Data[i]); - putchar('\n'); -} + printfxxo("%02X %02X ", pEvent->Clock, dif); + if (pEvent->Stat != 0x90) + { + int i; + printf("%02X ", pEvent->Stat); + for (i = 0; i < Length; i++) + { + printf("%02X ", Data[i]); + } + putchar('\n'); + } #endif - switch (e->Stat) + switch (pEvent->Stat) { // KeyOff -> KeyOn mit Vel=0. Gives better Runningstatus! case StatKeyOff: // SN-- only if KeyOff veloc is zero - if (!e->IsKeyOff()->OffVeloc) + if (!pEvent->IsKeyOff()->OffVeloc) { - Stat = StatKeyOn | e->IsChannelEvent()->Channel; + Stat = StatKeyOn | pEvent->IsChannelEvent()->Channel; if (Stat != RunningStatus) { RunningStatus = Stat; @@ -205,7 +260,7 @@ } else { - Stat = StatKeyOff | e->IsChannelEvent()->Channel; + Stat = StatKeyOff | pEvent->IsChannelEvent()->Channel; if (Stat != RunningStatus) { RunningStatus = Stat; @@ -226,7 +281,7 @@ // SN++ case StatChnPressure: - Stat = e->Stat | e->IsChannelEvent()->Channel; + Stat = pEvent->Stat | pEvent->IsChannelEvent()->Channel; if (Stat != RunningStatus) { RunningStatus = Stat; @@ -268,14 +323,14 @@ if (1) { int i; - printf("%02X ", e->Stat); + printf("%02X ", pEvent->Stat); for (i = 0; i < Length; i++) printf("%02X ", Data[i]); putchar('\n'); } #endif - Stat = e->Stat; + Stat = pEvent->Stat; RunningStatus = 0; *cp++ = 0xff; *cp++ = Stat; @@ -288,15 +343,14 @@ } } - - - -JZEvent* tStdChunk::Get() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZEvent* JZStandardChunk::Get() { int len; unsigned char Stat; unsigned char Channel; - JZEvent *e = 0; + JZEvent* pEvent = 0; while (!IsEof()) { @@ -307,10 +361,10 @@ case StatSysEx: // Sysex ++ cp; len = GetVar(); - e = new tSysEx(Clock, cp, len); + pEvent = new tSysEx(Clock, cp, len); cp += len; //RunningStatus = 0; - return e; + return pEvent; case 0xff: // Meta-Event ++cp; @@ -327,75 +381,75 @@ { case StatText: // Text-Event len = GetVar(); - e = new tText(Clock, cp, len); + pEvent = new tText(Clock, cp, len); cp += len; - return e; + return pEvent; case StatTrackName: // Track-Name len = GetVar(); - e = new tTrackName(Clock, cp, len); + pEvent = new tTrackName(Clock, cp, len); cp += len; - return e; + return pEvent; case StatPlayTrack: // JAVE playtrack event len = GetVar(); fprintf(stderr, "reading playtrack event\n"); - e = new tPlayTrack(Clock, cp, len); + pEvent = new tPlayTrack(Clock, cp, len); cp += len; - return e; + return pEvent; case StatJazzMeta: // Jazz Meta Event len = GetVar(); if (memcmp(cp, "JAZ2", 4) == 0) - e = new tJazzMeta(Clock, cp, len); + pEvent = new tJazzMeta(Clock, cp, len); else - e = new tMetaEvent(Clock, Stat, cp, len); + pEvent = new tMetaEvent(Clock, Stat, cp, len); cp += len; - return e; + return pEvent; case StatCopyright: // Copyright notice len = GetVar(); - e = new tCopyright(Clock, cp, len); + pEvent = new tCopyright(Clock, cp, len); cp += len; - return e; + return pEvent; case StatMarker: len = GetVar(); - e = new tMarker(Clock, cp, len); + pEvent = new tMarker(Clock, cp, len); cp += len; - return e; + return pEvent; case StatEndOfTrack: EofSeen = 1; cp += GetVar(); - e = new tEndOfTrack(Clock); //JAVE return an explicit event rather than 0 - return e; + pEvent = new tEndOfTrack(Clock); //JAVE return an explicit event rather than 0 + return pEvent; //return 0; // EOF case StatSetTempo: len = GetVar(); - e = new tSetTempo(Clock, cp[0], cp[1], cp[2]); + pEvent = new tSetTempo(Clock, cp[0], cp[1], cp[2]); cp += len; - return e; + return pEvent; case StatTimeSignat: len = GetVar(); - e = new tTimeSignat(Clock, cp[0], cp[1], cp[2], cp[3]); + pEvent = new tTimeSignat(Clock, cp[0], cp[1], cp[2], cp[3]); cp += len; - return e; + return pEvent; case StatMtcOffset: // MtcOffset len = GetVar(); - e = new tMtcOffset(Clock, cp, len); + pEvent = new tMtcOffset(Clock, cp, len); cp += len; RunningStatus = 0; - return e; + return pEvent; default: // Text und andere ignorieren len = GetVar(); - e = new tMetaEvent(Clock, Stat, cp, len); + pEvent = new tMetaEvent(Clock, Stat, cp, len); cp += len; - return e; + return pEvent; } break; @@ -409,43 +463,43 @@ switch(Stat) { case StatKeyOff: // SN++ added off veloc - e = new tKeyOff(Clock, Channel, cp[0],cp[1]); + pEvent = new tKeyOff(Clock, Channel, cp[0],cp[1]); cp += 2; - return e; + return pEvent; case StatKeyOn: if (cp[1]) - e = new tKeyOn(Clock, Channel, cp[0], cp[1]); + pEvent = new tKeyOn(Clock, Channel, cp[0], cp[1]); else - e = new tKeyOff(Clock, Channel, cp[0]); + pEvent = new tKeyOff(Clock, Channel, cp[0]); cp += 2; - return e; + return pEvent; case StatKeyPressure: // SN++ Aftertouch - e = new tKeyPressure(Clock, Channel, cp[0], cp[1]); + pEvent = new tKeyPressure(Clock, Channel, cp[0], cp[1]); cp += 2; - return e; + return pEvent; case StatControl: - e = new tControl(Clock, Channel, cp[0], cp[1]); + pEvent = new tControl(Clock, Channel, cp[0], cp[1]); cp += 2; - return e; + return pEvent; case StatPitch: - e = new tPitch(Clock, Channel, cp[0], cp[1]); + pEvent = new tPitch(Clock, Channel, cp[0], cp[1]); cp += 2; - return e; + return pEvent; case StatProgram: - e = new tProgram(Clock, Channel, cp[0]); + pEvent = new tProgram(Clock, Channel, cp[0]); cp += 1; - return e; + return pEvent; case StatChnPressure: - e = new tChnPressure(Clock, Channel, cp[0]); + pEvent = new tChnPressure(Clock, Channel, cp[0]); cp += 1; - return e; + return pEvent; default: { @@ -460,25 +514,24 @@ return 0; // eof } - -// ------------------------------------------------------------------- - - -void tStdChunk::Load(FILE *fd) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZStandardChunk::Load(FILE* pFd) { char Type[4]; int Size; - fread(Type, 4, 1, fd); - fread(&Size, 4, 1, fd); + fread(Type, 4, 1, pFd); + fread(&Size, 4, 1, pFd); SwapL(&Size); Resize(Size); - fread(mpBase, Size, 1, fd); + fread(mpBase, Size, 1, pFd); nRead = Size; } - -void tStdChunk::Save(FILE *fd) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZStandardChunk::Save(FILE* pFd) { int Size, hSize; @@ -487,54 +540,63 @@ *cp++ = 0xff; *cp++ = 0x2f; *cp++ = 0x00; - fwrite("MTrk", 4, 1, fd); + fwrite("MTrk", 4, 1, pFd); Size = hSize = cp - mpBase; SwapL(&hSize); - fwrite(&hSize, 4, 1, fd); - fwrite(mpBase, Size, 1, fd); + fwrite(&hSize, 4, 1, pFd); + fwrite(mpBase, Size, 1, pFd); } -// ---------------------------------------------------------------------- - -struct tFileHeader +//***************************************************************************** +//***************************************************************************** +struct JZFileHeader { short Format; - short nTracks; + short mTrackCount; short Unit; void Swap(); }; -void tFileHeader::Swap() +//***************************************************************************** +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZFileHeader::Swap() { SwapW(&Format); - SwapW(&nTracks); + SwapW(&mTrackCount); SwapW(&Unit); } -// ---------------------------- ReadStd ----------------------------- - - -tStdRead::tStdRead() - : tReadBase(), +//***************************************************************************** +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZStandardRead::JZStandardRead() + : JZReadBase(), mpTracks(0), - TrackNr(0) + mTrackIndex(0) { } -tStdRead::~tStdRead() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZStandardRead::~JZStandardRead() { delete [] mpTracks; } -int tStdRead::Open(const char* pFileName) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZStandardRead::Open(const char* pFileName) { - tFileHeader h; + JZFileHeader FileHeader; int hSize; int i; char Type[4]; - if (!tReadBase::Open(pFileName)) + if (!JZReadBase::Open(pFileName)) { ostringstream Oss; Oss << "Can't open " << pFileName; @@ -542,7 +604,7 @@ return 0; } - fread(Type, 4, 1, fd); + fread(Type, 4, 1, mpFd); if (strncmp("MThd", Type, 4) != 0) { @@ -550,105 +612,126 @@ return 0; } - fread(&hSize, 4, 1, fd); + fread(&hSize, 4, 1, mpFd); SwapL(&hSize); - assert (hSize == sizeof(h)); + assert (hSize == sizeof(FileHeader)); - fread(&h, 6, 1, fd); - h.Swap(); - nTracks = h.nTracks; - TicksPerQuarter = h.Unit; + fread(&FileHeader, 6, 1, mpFd); + FileHeader.Swap(); + mTrackCount = FileHeader.mTrackCount; + mTicksPerQuarter = FileHeader.Unit; - mpTracks = new tStdChunk [nTracks]; - for (i = 0; i < nTracks; i++) + mpTracks = new JZStandardChunk [mTrackCount]; + for (i = 0; i < mTrackCount; i++) { - mpTracks[i].Load(fd); + mpTracks[i].Load(mpFd); } - TrackNr = -1; + mTrackIndex = -1; - return nTracks; + return mTrackCount; } -void tStdRead::Close() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZStandardRead::Close() { - tReadBase::Close(); + JZReadBase::Close(); } -JZEvent *tStdRead::Read() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZEvent* JZStandardRead::Read() { - assert(TrackNr >= 0 && TrackNr < nTracks); - return mpTracks[TrackNr].Get(); + assert(mTrackIndex >= 0 && mTrackIndex < mTrackCount); + return mpTracks[mTrackIndex].Get(); } -int tStdRead::NextTrack() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZStandardRead::NextTrack() { - ++TrackNr; - return TrackNr < nTracks; + ++mTrackIndex; + return mTrackIndex < mTrackCount; } - -// ------------------------------ tWriteStd --------------------------------- - -tStdWrite::tStdWrite() - : tWriteBase(), +//***************************************************************************** +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZStandardWrite::JZStandardWrite() + : JZWriteBase(), mpTracks(0), - TrackNr(0), - nTracks(0), - TicksPerQuarter(0) + mTrackIndex(0), + mTrackCount(0), + mTicksPerQuarter(0) { } -tStdWrite::~tStdWrite() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZStandardWrite::~JZStandardWrite() { delete [] mpTracks; } -int tStdWrite::Open(char* pFileName, int ntracks, int timebase) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZStandardWrite::Open( + const char* pFileName, + int TrackCount, + int TicksPerQuarter) { - if (!tWriteBase::Open(pFileName, ntracks, timebase)) + if (!JZWriteBase::Open(pFileName, TrackCount, TicksPerQuarter)) { return 0; } - nTracks = ntracks; - TicksPerQuarter = timebase; - mpTracks = new tStdChunk [ntracks]; - TrackNr = -1; - return nTracks; + + mTrackCount = TrackCount; + mTicksPerQuarter = TicksPerQuarter; + mpTracks = new JZStandardChunk [TrackCount]; + mTrackIndex = -1; + return mTrackCount; } -void tStdWrite::Close() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZStandardWrite::Close() { long Size; - tFileHeader h; + JZFileHeader FileHeader; int i; - fwrite("MThd", 4, 1, fd); + fwrite("MThd", 4, 1, mpFd); Size = 6; SwapL(&Size); - fwrite(&Size, 4, 1, fd); - h.Unit = TicksPerQuarter; - h.Format = 1; - h.nTracks = nTracks; - h.Swap(); - fwrite(&h, 6, 1, fd); + fwrite(&Size, 4, 1, mpFd); + FileHeader.Unit = mTicksPerQuarter; + FileHeader.Format = 1; + FileHeader.mTrackCount = mTrackCount; + FileHeader.Swap(); + fwrite(&FileHeader, 6, 1, mpFd); - for (i = 0; i < nTracks; i++) + for (i = 0; i < mTrackCount; i++) { - mpTracks[i].Save(fd); + mpTracks[i].Save(mpFd); } - tWriteBase::Close(); + JZWriteBase::Close(); } -void tStdWrite::NextTrack() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZStandardWrite::NextTrack() { - ++TrackNr; + ++mTrackIndex; } -int tStdWrite::Write(JZEvent *e, unsigned char* data, int len) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZStandardWrite::Write(JZEvent* pEvent, unsigned char* pString, int Length) { - assert(TrackNr >= 0 && TrackNr < nTracks); - mpTracks[TrackNr].Put(e, data, len); + assert(mTrackIndex >= 0 && mTrackIndex < mTrackCount); + mpTracks[mTrackIndex].Put(pEvent, pString, Length); return 0; } Modified: trunk/jazz/src/StandardFile.h =================================================================== --- trunk/jazz/src/StandardFile.h 2008-03-30 13:41:19 UTC (rev 367) +++ trunk/jazz/src/StandardFile.h 2008-03-30 14:35:30 UTC (rev 368) @@ -28,84 +28,63 @@ #include <stdio.h> class JZEvent; -class tStdChunk +class JZStandardChunk; + +//***************************************************************************** +//***************************************************************************** +class JZStandardRead : public JZReadBase { public: - tStdChunk(); + JZStandardRead(); - ~tStdChunk(); + virtual ~JZStandardRead(); - int IsEof(); // Only after Load, Save never has Eof. + virtual int Open(const char* pFileName); - void Load(FILE* fd); + virtual void Close(); - void Save(FILE* fd); // Depends on EndOfTrack + virtual JZEvent* Read(); - void Put(JZEvent* pEvent, unsigned char* pData, int Length); + virtual int NextTrack(); - // A return value of NULL indicates we are at the end of the track. - JZEvent* Get(); - - void Rewind(); - private: - long Size; // Size of base - long nRead; // Number of bytes read from the file - unsigned char* mpBase; // Buffer for data. - unsigned char* cp; // Aktueller Schreib/Lese pointer - long Clock; // Absolute Clock - int EofSeen; // endoftrack meta-event read - int RunningStatus; + JZStandardChunk* mpTracks; - void Resize(int SizeNeeded); - void PutVar(unsigned long val); - unsigned long GetVar(); + int mTrackIndex; }; - -class tStdRead : public tReadBase +//***************************************************************************** +//***************************************************************************** +class JZStandardWrite : public JZWriteBase { public: - tStdRead(); + JZStandardWrite(); - virtual ~tStdRead(); + virtual ~JZStandardWrite(); - virtual int Open(const char* pFileName); + virtual int Open( + const char* pFileName, + int TrackCount, + int TicksPerQuarter); + virtual void Close(); - virtual JZEvent* Read(); - virtual int NextTrack(); + virtual int Write(JZEvent* Event, unsigned char* pString, int Length); + virtual void NextTrack(); + private: - tStdChunk* mpTracks; - int TrackNr; -}; + JZStandardChunk* mpTracks; + int mTrackIndex; + int mTrackCount; -class tStdWrite : public tWriteBase -{ - public: - - tStdWrite(); - - virtual ~tStdWrite(); - - virtual int Open(char* pFileName, int nTracks, int TicksPerQuarter); - virtual void Close(); - virtual int Write(JZEvent* Event, unsigned char *s, int len); - virtual void NextTrack(); - - private: - - tStdChunk* mpTracks; - int TrackNr; - int nTracks; - int TicksPerQuarter; + int mTicksPerQuarter; }; #endif // !defined(JZ_STANDARDFILE_H) Modified: trunk/jazz/src/Track.cpp =================================================================== --- trunk/jazz/src/Track.cpp 2008-03-30 13:41:19 UTC (rev 367) +++ trunk/jazz/src/Track.cpp 2008-03-30 14:35:30 UTC (rev 368) @@ -35,9 +35,9 @@ #include <cstdlib> #include <assert.h> -int tParam::Write(tWriteBase& io) +int tParam::Write(JZWriteBase& Io) { - return(Msb.Write(io) + Lsb.Write(io) + DataMsb.Write(io)); + return Msb.Write(Io) + Lsb.Write(Io) + DataMsb.Write(Io); } void tParam::SetCha(unsigned char cha) @@ -1271,69 +1271,69 @@ #endif -void tEventArray::Write(tWriteBase &io) +void tEventArray::Write(JZWriteBase& Io) { JZEvent *e; int WrittenBefore; Length2Keyoff(); - io.NextTrack(); + Io.NextTrack(); // Write copyright notice first (according to spec): if (Copyright) { - Copyright->Write(io); + Copyright->Write(Io); } // Write MTC offset before any transmittable events (spec) if (MtcOffset) { - MtcOffset->Write(io); + MtcOffset->Write(Io); } // Synth reset if (Reset) { - Reset->Write(io); + Reset->Write(Io); } // Rpn / Nrpn: // All these must be written in order (three tControl's in a row) if (VibRate) { - VibRate->Write(io); + VibRate->Write(Io); } if (VibDepth) { - VibDepth->Write(io); + VibDepth->Write(Io); } if (VibDelay) { - VibDelay->Write(io); + VibDelay->Write(Io); } if (Cutoff) { - Cutoff->Write(io); + Cutoff->Write(Io); } if (Resonance) { - Resonance->Write(io); + Resonance->Write(Io); } if (EnvAttack) { - EnvAttack->Write(io); + EnvAttack->Write(Io); } if (EnvDecay) { - EnvDecay->Write(io); + EnvDecay->Write(Io); } if (EnvRelease) { - EnvRelease->Write(io); + EnvRelease->Write(Io); } if (BendPitchSens) { - BendPitchSens->Write(io); + BendPitchSens->Write(Io); } tDrumInstrumentParameter *dpar = DrumParams.FirstElem(); @@ -1344,7 +1344,7 @@ { if (dpar->Get(index)) { - dpar->Get(index)->Write(io); + dpar->Get(index)->Write(Io); } } dpar = DrumParams.NextElem(dpar); @@ -1353,17 +1353,17 @@ // mpBank: Must be sure bank is written before program: if (mpBank) { - mpBank->Write(io); + mpBank->Write(Io); } if (mpBank2) { - mpBank2->Write(io); + mpBank2->Write(Io); } if (mPatch) { - mPatch->Write(io); + mPatch->Write(Io); } // write jazz track info @@ -1372,7 +1372,7 @@ jazz->SetTrackState(State); jazz->SetTrackDevice(Device); jazz->SetIntroLength(gpSong->GetIntroLength()); - jazz->Write(io); + jazz->Write(Io); for (int i = 0; i < nEvents; i++) { @@ -1416,15 +1416,13 @@ } if (!WrittenBefore) { - e->Write(io); + e->Write(Io); } } Keyoff2Length(); } - - -void tEventArray::Read(tReadBase &io) +void tEventArray::Read(JZReadBase& Io) { JZEvent *e; Channel = 0; @@ -1436,8 +1434,8 @@ bool NeedToDelete; - io.NextTrack(); - while ((e = io.Read()) != 0) + Io.NextTrack(); + while ((e = Io.Read()) != 0) { NeedToDelete = false; SpecialEvent = 0; Modified: trunk/jazz/src/Track.h =================================================================== --- trunk/jazz/src/Track.h 2008-03-30 13:41:19 UTC (rev 367) +++ trunk/jazz/src/Track.h 2008-03-30 14:35:30 UTC (rev 368) @@ -68,7 +68,7 @@ { } - virtual int Write(tWriteBase &io); + virtual int Write(JZWriteBase& Io); virtual void SetCha( unsigned char cha ); virtual int GetVal() { @@ -375,8 +375,8 @@ tEventArray(); virtual ~tEventArray(); - void Read(tReadBase &io); - void Write(tWriteBase &io); + void Read(JZReadBase& Io); + void Write(JZWriteBase& Io); int GetLastClock(); int IsEmpty(); @@ -386,9 +386,16 @@ public: - int GetAudioMode() const { return audio_mode; } - void SetAudioMode(int x) { audio_mode = x; } + int GetAudioMode() const + { + return audio_mode; + } + void SetAudioMode(int x) + { + audio_mode = x; + } + protected: int audio_mode; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 14:45:45
|
Revision: 369 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=369&view=rev Author: pstieber Date: 2008-03-30 07:45:43 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Removed the startup file name from the global variables because it was only used by the project class in one function. Modified Paths: -------------- trunk/jazz/src/Globals.cpp trunk/jazz/src/Globals.h trunk/jazz/src/Project.cpp Modified: trunk/jazz/src/Globals.cpp =================================================================== --- trunk/jazz/src/Globals.cpp 2008-03-30 14:35:30 UTC (rev 368) +++ trunk/jazz/src/Globals.cpp 2008-03-30 14:45:43 UTC (rev 369) @@ -31,8 +31,6 @@ using namespace std; -string gpStartUpSong; - tConfig* gpConfig = 0; JZSong* gpSong = 0; Modified: trunk/jazz/src/Globals.h =================================================================== --- trunk/jazz/src/Globals.h 2008-03-30 14:35:30 UTC (rev 368) +++ trunk/jazz/src/Globals.h 2008-03-30 14:45:43 UTC (rev 369) @@ -46,7 +46,6 @@ }; extern tConfig* gpConfig; -extern std::string gpStartUpSong; extern JZSong* gpSong; extern JZSynth* gpSynth; extern JZPlayer* gpMidiPlayer; Modified: trunk/jazz/src/Project.cpp =================================================================== --- trunk/jazz/src/Project.cpp 2008-03-30 14:35:30 UTC (rev 368) +++ trunk/jazz/src/Project.cpp 2008-03-30 14:45:43 UTC (rev 369) @@ -294,28 +294,25 @@ } } - // Attempt to load the song given on command line or the file specified in // the configuration file. + string StartUpSong; opt = GetOptionIndex( "-f" ) + 1; if (opt && (wxTheApp->argc > opt)) { - gpStartUpSong = wxTheApp->argv[opt]; + StartUpSong = wxTheApp->argv[opt]; } else { - gpStartUpSong = mpConfig->StrValue(C_StartUpSong); + StartUpSong = mpConfig->StrValue(C_StartUpSong); } - FILE* fd = fopen(gpStartUpSong.c_str(), "r"); - if (fd) + + FILE* pFd = fopen(StartUpSong.c_str(), "r"); + if (pFd) { - fclose(fd); + fclose(pFd); JZStandardRead Io; - Read(Io, gpStartUpSong.c_str()); -// if (gpStartUpSong == string("jazz.mid")) -// { -// lasts = gpStartUpSong; -// } + Read(Io, StartUpSong.c_str()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 14:55:53
|
Revision: 371 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=371&view=rev Author: pstieber Date: 2008-03-30 07:55:50 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Changed tFilter to JZFilter. Modified Paths: -------------- trunk/jazz/src/Command.cpp trunk/jazz/src/Command.h trunk/jazz/src/Dialogs.cpp trunk/jazz/src/Dialogs.h trunk/jazz/src/EventWindow.cpp trunk/jazz/src/EventWindow.h trunk/jazz/src/Filter.cpp trunk/jazz/src/Filter.h trunk/jazz/src/HarmonyBrowserAnalyzer.cpp trunk/jazz/src/HarmonyBrowserAnalyzer.h trunk/jazz/src/PianoWindow.cpp trunk/jazz/src/PianoWindow.h trunk/jazz/src/Project.h trunk/jazz/src/Rhythm.cpp trunk/jazz/src/TrackWindow.cpp trunk/jazz/src/TrackWindow.h Modified: trunk/jazz/src/Command.cpp =================================================================== --- trunk/jazz/src/Command.cpp 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/Command.cpp 2008-03-30 14:55:50 UTC (rev 371) @@ -39,7 +39,7 @@ //***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -tCommand::tCommand(tFilter* pFilter) +tCommand::tCommand(JZFilter* pFilter) : mpFilter(pFilter), mpSong(pFilter->mpSong), mReverse(0) @@ -112,7 +112,7 @@ { public: - tSelectedKeys(tFilter* pFilter); + tSelectedKeys(JZFilter* pFilter); void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); @@ -123,7 +123,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -tSelectedKeys::tSelectedKeys(tFilter* pFilter) +tSelectedKeys::tSelectedKeys(JZFilter* pFilter) : tCommand(pFilter) { int i; @@ -150,7 +150,7 @@ // c d e f g a b static const int CMajor[12] = { 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1 }; -void tScale::Init(int ScaleNr, tFilter *f) +void tScale::Init(int ScaleNr, JZFilter *f) { int i; @@ -190,7 +190,7 @@ } -int tScale::Analyze(tFilter *f) +int tScale::Analyze(JZFilter *f) { long keys[12]; for (int i = 0; i < 12; i++) @@ -289,7 +289,7 @@ // tCmdShift // *********************************************************************** -tCmdShift::tCmdShift(tFilter *f, long dclk) +tCmdShift::tCmdShift(JZFilter *f, long dclk) : tCommand(f) { DeltaClock = dclk; @@ -307,7 +307,7 @@ // tCmdErase // ************************************************************************ -tCmdErase::tCmdErase(tFilter *f, int lvsp) +tCmdErase::tCmdErase(JZFilter *f, int lvsp) : tCommand(f) { LeaveSpace = lvsp; @@ -318,7 +318,7 @@ tCommand::Execute(NewUndo); if (!LeaveSpace) { - tFilter f(mpFilter); + JZFilter f(mpFilter); f.FromClock = mpFilter->ToClock; f.ToClock = mpSong->GetLastClock() + 1; long DeltaClock = mpFilter->FromClock - mpFilter->ToClock; @@ -336,7 +336,7 @@ // tCmdQuantize // ************************************************************************ -tCmdQuantize::tCmdQuantize(tFilter *f, long clks, int grov, int dly) +tCmdQuantize::tCmdQuantize(JZFilter *f, long clks, int grov, int dly) : tCommand(f) { QntClocks = clks; @@ -380,7 +380,7 @@ // tCmdTranspose // ************************************************************************ -tCmdTranspose::tCmdTranspose(tFilter *f, int notes, int ScaleNr, int fit) +tCmdTranspose::tCmdTranspose(JZFilter *f, int notes, int ScaleNr, int fit) : tCommand(f) { Scale.Init(ScaleNr, mpFilter); @@ -426,7 +426,7 @@ // tCmdSetChannel // ************************************************************************ -tCmdSetChannel::tCmdSetChannel(tFilter *f, int chan) +tCmdSetChannel::tCmdSetChannel(JZFilter *f, int chan) : tCommand(f) { NewChannel = chan; @@ -449,7 +449,7 @@ // tCmdVelocity // ************************************************************************ -tCmdVelocity::tCmdVelocity(tFilter *f, int from, int to, int m) +tCmdVelocity::tCmdVelocity(JZFilter *f, int from, int to, int m) : tCommand(f) { FromValue = from; @@ -484,7 +484,7 @@ // tCmdLength // ************************************************************************ -tCmdLength::tCmdLength(tFilter *f, int from, int to, int m) +tCmdLength::tCmdLength(JZFilter *f, int from, int to, int m) : tCommand(f) { FromValue = from; @@ -524,7 +524,7 @@ // by factor "scale" from starting point "startClock" // ************************************************************************ -tCmdSeqLength::tCmdSeqLength(tFilter *f, double scale) +tCmdSeqLength::tCmdSeqLength(JZFilter *f, double scale) : tCommand(f) { this->scale=scale; @@ -559,7 +559,7 @@ // to a pitch bend/volume control sequence instead // ************************************************************************ -tCmdConvertToModulation::tCmdConvertToModulation(tFilter *f) +tCmdConvertToModulation::tCmdConvertToModulation(JZFilter *f) : tCommand(f) { } @@ -639,7 +639,7 @@ // JAVE this is a simple midi delay line // ************************************************************************ -tCmdMidiDelay::tCmdMidiDelay(tFilter *f, double scale, long clockDelay, int repeat) +tCmdMidiDelay::tCmdMidiDelay(JZFilter *f, double scale, long clockDelay, int repeat) : tCommand(f) { this->scale=scale; @@ -669,7 +669,7 @@ // tCmdCleanup // ************************************************************************ -tCmdCleanup::tCmdCleanup(tFilter *f, long clks, int so) +tCmdCleanup::tCmdCleanup(JZFilter *f, long clks, int so) : tCommand(f) { lengthLimit = clks; @@ -711,7 +711,7 @@ // tCmdSearchReplace // ************************************************************************ -tCmdSearchReplace::tCmdSearchReplace(tFilter *f, short sf, short st) +tCmdSearchReplace::tCmdSearchReplace(JZFilter *f, short sf, short st) : tCommand(f) { fr = sf; @@ -738,7 +738,7 @@ // ************************************************************************ tCmdCopyToBuffer::tCmdCopyToBuffer( - tFilter* pFilter, + JZFilter* pFilter, tEventArray* pBuffer) : tCommand(pFilter) { @@ -756,7 +756,7 @@ -tCmdCopy::tCmdCopy(tFilter *f, long dt, long dc) +tCmdCopy::tCmdCopy(JZFilter *f, long dt, long dc) : tCommand(f) { DestTrack = dt; @@ -893,7 +893,7 @@ // tCmdExchLeftRight // ************************************************************************ -tCmdExchLeftRight::tCmdExchLeftRight(tFilter *f) +tCmdExchLeftRight::tCmdExchLeftRight(JZFilter *f) : tCommand(f) { } @@ -914,7 +914,7 @@ // tCmdExchUpDown // ************************************************************************ -tCmdExchUpDown::tCmdExchUpDown(tFilter *f) +tCmdExchUpDown::tCmdExchUpDown(JZFilter *f) : tCommand(f) { } @@ -972,7 +972,7 @@ // ************************************************************************ //enum prop { veloc, length, key, rhythm, random, pan, modul, cc1, cc2, pitch, clock }; -tCmdMapper::tCmdMapper(tFilter *f, prop src, prop dst, JZRndArray &arr, int nb, int ad) +tCmdMapper::tCmdMapper(JZFilter *f, prop src, prop dst, JZRndArray &arr, int nb, int ad) : tCommand(f), array(arr) { Modified: trunk/jazz/src/Command.h =================================================================== --- trunk/jazz/src/Command.h 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/Command.h 2008-03-30 14:55:50 UTC (rev 371) @@ -23,7 +23,7 @@ #ifndef JZ_COMMAND_H #define JZ_COMMAND_H -class tFilter; +class JZFilter; class JZEvent; class JZTrack; class JZSong; @@ -35,7 +35,7 @@ class tScale { public: - void Init(int ScaleNr, tFilter *f = 0); + void Init(int ScaleNr, JZFilter *f = 0); int ScaleKeys[12]; int Member(int Key) @@ -47,7 +47,7 @@ int Prev(int Key); int Transpose(int Key, int Steps); int FitInto(int Key); - static int Analyze(tFilter *f); // returns ScaleNr + static int Analyze(JZFilter *f); // returns ScaleNr }; @@ -55,7 +55,7 @@ { public: - tCommand(tFilter* pFilter); + tCommand(JZFilter* pFilter); virtual ~tCommand(); @@ -69,7 +69,7 @@ public: - tFilter* mpFilter; + JZFilter* mpFilter; JZSong* mpSong; int mReverse; }; @@ -79,7 +79,7 @@ { long DeltaClock; public: - tCmdShift(tFilter *f, long DeltaClock); + tCmdShift(JZFilter *f, long DeltaClock); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -88,7 +88,7 @@ { public: int LeaveSpace; - tCmdErase(tFilter *f, int LeaveSpace = 1); + tCmdErase(JZFilter *f, int LeaveSpace = 1); virtual void Execute(int NewUndo = 1); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -97,7 +97,7 @@ { public: int FromValue, ToValue, Mode; - tCmdVelocity(tFilter *f, int From, int To, int Mode); + tCmdVelocity(JZFilter *f, int From, int To, int Mode); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -106,7 +106,7 @@ { public: int FromValue, ToValue, Mode; - tCmdLength(tFilter *f, int From, int To, int Mode); + tCmdLength(JZFilter *f, int From, int To, int Mode); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -116,7 +116,7 @@ public: double scale; long startClock; - tCmdSeqLength(tFilter *f, double scale); + tCmdSeqLength(JZFilter *f, double scale); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -129,7 +129,7 @@ long clockDelay; int repeat; - tCmdMidiDelay(tFilter *f, double scale, long clockDelay, int repeat); + tCmdMidiDelay(JZFilter *f, double scale, long clockDelay, int repeat); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -137,7 +137,7 @@ { public: - tCmdConvertToModulation(tFilter *f); + tCmdConvertToModulation(JZFilter *f); virtual void ExecuteTrack(JZTrack *t); }; @@ -151,7 +151,7 @@ int shortenOverlaps; tKeyOn *prev_note[16][128]; public: - tCmdCleanup(tFilter *f, long limitClocks, int shortenOverlaps); + tCmdCleanup(JZFilter *f, long limitClocks, int shortenOverlaps); virtual void ExecuteTrack(JZTrack *t); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -161,7 +161,7 @@ { short fr, to; public: - tCmdSearchReplace(tFilter *f, short fr, short to); + tCmdSearchReplace(JZFilter *f, short fr, short to); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -175,7 +175,7 @@ int NoteLength; // no int Delay; // zero int Groove; // zero - tCmdQuantize(tFilter *f, long QntClocks, int groove, int delay); + tCmdQuantize(JZFilter *f, long QntClocks, int groove, int delay); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -186,7 +186,7 @@ int Notes; int FitIntoScale; tScale Scale; - tCmdTranspose(tFilter *f, int Notes, int ScaleNr = 0, int FitIntoScale = 0); + tCmdTranspose(JZFilter *f, int Notes, int ScaleNr = 0, int FitIntoScale = 0); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -195,7 +195,7 @@ { public: int NewChannel; // 0 - tCmdSetChannel(tFilter *f, int NewChannel); + tCmdSetChannel(JZFilter *f, int NewChannel); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -204,7 +204,7 @@ { public: - tCmdCopyToBuffer(tFilter* pFilter, tEventArray *Buffer); + tCmdCopyToBuffer(JZFilter* pFilter, tEventArray *Buffer); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); @@ -226,7 +226,7 @@ int InsertSpace; // no long RepeatClock; // -1L - tCmdCopy(tFilter *f, long DestTrack, long DestClock); + tCmdCopy(JZFilter *f, long DestTrack, long DestClock); virtual void ExecuteTrack(JZTrack *t); }; @@ -235,14 +235,14 @@ class tCmdExchLeftRight : public tCommand { public: - tCmdExchLeftRight(tFilter *f); + tCmdExchLeftRight(JZFilter *f); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; class tCmdExchUpDown : public tCommand { public: - tCmdExchUpDown(tFilter *f); + tCmdExchUpDown(JZFilter *f); virtual void ExecuteTrack(JZTrack *t); }; @@ -250,7 +250,7 @@ { public: enum prop { veloc, length, key, rhythm, random, pan, modul, cc1, cc2, pitch, clock }; - tCmdMapper(tFilter *f, prop src, prop dst, JZRndArray &array, int nbars, int add); + tCmdMapper(JZFilter *f, prop src, prop dst, JZRndArray &array, int nbars, int add); ~tCmdMapper(); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); private: Modified: trunk/jazz/src/Dialogs.cpp =================================================================== --- trunk/jazz/src/Dialogs.cpp 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/Dialogs.cpp 2008-03-30 14:55:50 UTC (rev 371) @@ -52,7 +52,7 @@ //long tShiftDlg::Steps = 0; -tShiftDlg::tShiftDlg(JZEventFrame *w, tFilter *f, long unit) +tShiftDlg::tShiftDlg(JZEventFrame *w, JZFilter *f, long unit) : tPropertyListDlg( "Shift events left/right" ) { Filter = f; @@ -108,7 +108,7 @@ -tCleanupDlg::tCleanupDlg(JZEventFrame *w, tFilter *f) +tCleanupDlg::tCleanupDlg(JZEventFrame *w, JZFilter *f) : tPropertyListDlg( "Clean up events" ) { Filter = f; @@ -192,7 +192,7 @@ int tSearchReplaceDlg::frCtrl = 1; int tSearchReplaceDlg::toCtrl = 1; -tSearchReplaceDlg::tSearchReplaceDlg(JZEventFrame *w, tFilter *f) +tSearchReplaceDlg::tSearchReplaceDlg(JZEventFrame *w, JZFilter *f) : tPropertyListDlg("Search and replace controller types" ) { Filter = f; @@ -242,7 +242,7 @@ int tTransposeDlg::Scale = gScaleChromatic; bool tTransposeDlg::FitIntoScale = 0; -tTransposeDlg::tTransposeDlg(JZEventFrame *w, tFilter *f) +tTransposeDlg::tTransposeDlg(JZEventFrame *w, JZFilter *f) : tPropertyListDlg("Transpose") { EventWin = w; @@ -298,7 +298,7 @@ int tSetChannelDlg::NewChannel = 1; -tSetChannelDlg::tSetChannelDlg(tFilter *f) +tSetChannelDlg::tSetChannelDlg(JZFilter *f) : tPropertyListDlg("Set MIDI Channel") { Filter = f; @@ -349,7 +349,7 @@ int tVelocityDlg::Mode = 0; -tVelocityDlg::tVelocityDlg(tFilter *f) +tVelocityDlg::tVelocityDlg(JZFilter *f) : tPropertyListDlg( "Velocity" ) { Filter = f; @@ -400,7 +400,7 @@ int tLengthDlg::Mode; -tLengthDlg::tLengthDlg(JZEventFrame *w, tFilter *f) +tLengthDlg::tLengthDlg(JZEventFrame *w, JZFilter *f) : tPropertyListDlg("Length") { Filter = f; @@ -465,7 +465,7 @@ -tSeqLengthDlg::tSeqLengthDlg(JZEventFrame *w, tFilter *f) +tSeqLengthDlg::tSeqLengthDlg(JZEventFrame *w, JZFilter *f) : tPropertyListDlg("stretch/contract by scale from start of selected sequence" ) { Filter = f; @@ -511,7 +511,7 @@ long tMidiDelayDlg::clockDelay = 10; int tMidiDelayDlg::repeat = 6; -tMidiDelayDlg::tMidiDelayDlg(JZEventFrame *w, tFilter *f) +tMidiDelayDlg::tMidiDelayDlg(JZEventFrame *w, JZFilter *f) : tPropertyListDlg("MIDI delay line" ) { Filter = f; @@ -572,7 +572,7 @@ bool tDeleteDlg::LeaveSpace = 1; -tDeleteDlg::tDeleteDlg(JZEventFrame *w, tFilter *f) +tDeleteDlg::tDeleteDlg(JZEventFrame *w, JZFilter *f) : tPropertyListDlg("Delete" ) { Filter = f; @@ -665,7 +665,7 @@ int tQuantizeDlg::Delay = 0; int tQuantizeDlg::Groove = 0; -tQuantizeDlg::tQuantizeDlg(JZEventFrame *w, tFilter *f) +tQuantizeDlg::tQuantizeDlg(JZEventFrame *w, JZFilter *f) : tPropertyListDlg("Quantize" ) //, Steps("steps", gQntSteps, &gQntStep) { Modified: trunk/jazz/src/Dialogs.h =================================================================== --- trunk/jazz/src/Dialogs.h 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/Dialogs.h 2008-03-30 14:55:50 UTC (rev 371) @@ -26,7 +26,7 @@ #include "PropertyListDialog.h" class JZPianoWindow; -class tFilter; +class JZFilter; class JZSong; class JZEventFrame; class JZTrack; @@ -38,11 +38,11 @@ long Steps; // 0 was static long Unit; - tFilter* Filter; + JZFilter* Filter; JZSong* Song; JZEventFrame* EventWin; - tShiftDlg(JZEventFrame *w, tFilter *f, long Unit); + tShiftDlg(JZEventFrame *w, JZFilter *f, long Unit); void AddProperties(); bool OnClose(); void OnHelp(); @@ -55,11 +55,11 @@ static int lowLimit; // 1/32 static bool shortenOverlaps; - tFilter *Filter; + JZFilter *Filter; JZSong *Song; JZEventFrame *EventWin; - tCleanupDlg(JZEventFrame *w, tFilter *f); + tCleanupDlg(JZEventFrame *w, JZFilter *f); void AddProperties(); //tNamedChoice Steps; bool OnClose(); @@ -75,11 +75,11 @@ /* tNamedChoice frList; */ /* tNamedChoice toList; */ - tFilter *Filter; + JZFilter *Filter; JZSong *Song; JZEventFrame *EventWin; - tSearchReplaceDlg(JZEventFrame *w, tFilter *f); + tSearchReplaceDlg(JZEventFrame *w, JZFilter *f); void AddProperties(); bool OnClose(); void OnHelp(); @@ -95,11 +95,11 @@ static int Scale; JZEventFrame *EventWin; - tFilter *Filter; + JZFilter *Filter; JZSong *Song; //tNamedChoice ScaleDlg; - tTransposeDlg(JZEventFrame *w, tFilter *f); + tTransposeDlg(JZEventFrame *w, JZFilter *f); void AddProperties(); bool OnClose(); void OnHelp(); @@ -112,10 +112,10 @@ static int NewChannel; // 0 - tFilter *Filter; + JZFilter *Filter; JZSong *Song; - tSetChannelDlg(tFilter *f); + tSetChannelDlg(JZFilter *f); void AddProperties(); bool OnClose(); void OnHelp(); @@ -129,10 +129,10 @@ static int FromValue, ToValue, Mode; static char *mode_str; - tFilter *Filter; + JZFilter *Filter; JZSong *Song; - tVelocityDlg(tFilter *f); + tVelocityDlg(JZFilter *f); void AddProperties(); bool OnClose(); void OnHelp(); @@ -146,11 +146,11 @@ static int FromValue, ToValue, Mode; static char *mode_str; - tFilter *Filter; + JZFilter *Filter; JZSong *Song; JZEventFrame *EventWin; - tLengthDlg(JZEventFrame *win, tFilter *f); + tLengthDlg(JZEventFrame *win, JZFilter *f); void AddProperties(); bool OnClose(); void OnHelp(); @@ -164,11 +164,11 @@ static double scale; - tFilter *Filter; + JZFilter *Filter; JZSong *Song; JZEventFrame *EventWin; - tSeqLengthDlg(JZEventFrame *win, tFilter *f); + tSeqLengthDlg(JZEventFrame *win, JZFilter *f); void AddProperties(); bool OnClose(); void OnHelp(); @@ -183,11 +183,11 @@ static long clockDelay; static int repeat; - tFilter *Filter; + JZFilter *Filter; JZSong *Song; JZEventFrame *EventWin; - tMidiDelayDlg(JZEventFrame *win, tFilter *f); + tMidiDelayDlg(JZEventFrame *win, JZFilter *f); void AddProperties(); bool OnClose(); void OnHelp(); @@ -195,13 +195,13 @@ class tDeleteDlg : public tPropertyListDlg { - tFilter *Filter; + JZFilter *Filter; JZEventFrame *EventWin; public: static bool LeaveSpace; // 1 - tDeleteDlg(JZEventFrame *w, tFilter *f); + tDeleteDlg(JZEventFrame *w, JZFilter *f); void AddProperties(); bool OnClose(); void OnHelp(); @@ -239,13 +239,13 @@ static int Groove; // -x .. +x static int Delay; // -x .. +x - tFilter *Filter; + JZFilter *Filter; JZSong *Song; JZEventFrame *EventWin; long Quantize(long); - tQuantizeDlg(JZEventFrame *w, tFilter *f); + tQuantizeDlg(JZEventFrame *w, JZFilter *f); void AddProperties(); //tNamedChoice Steps; bool OnClose(); Modified: trunk/jazz/src/EventWindow.cpp =================================================================== --- trunk/jazz/src/EventWindow.cpp 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/EventWindow.cpp 2008-03-30 14:55:50 UTC (rev 371) @@ -190,7 +190,7 @@ #endif mpGreyBrush = new wxBrush(*mpGreyColor, wxSOLID); - mpFilter = new tFilter(Song); + mpFilter = new JZFilter(Song); } Modified: trunk/jazz/src/EventWindow.h =================================================================== --- trunk/jazz/src/EventWindow.h 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/EventWindow.h 2008-03-30 14:55:50 UTC (rev 371) @@ -87,7 +87,7 @@ JZSong* Song; - tFilter* mpFilter; + JZFilter* mpFilter; JZPianoFrame* NextWin; Modified: trunk/jazz/src/Filter.cpp =================================================================== --- trunk/jazz/src/Filter.cpp 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/Filter.cpp 2008-03-30 14:55:50 UTC (rev 371) @@ -47,7 +47,7 @@ -tFilter::tFilter(JZSong *s) +JZFilter::JZFilter(JZSong *s) { mpSong = s; FltEvents = new tFltEvent [nFltEvents]; @@ -67,24 +67,24 @@ } -tFilter::tFilter(tFilter *f) +JZFilter::JZFilter(JZFilter *f) { copy (*f); } -tFilter::tFilter(tFilter const &o) { +JZFilter::JZFilter(JZFilter const &o) { copy(o); } -tFilter& tFilter::operator=(tFilter const &o) { +JZFilter& JZFilter::operator=(JZFilter const &o) { delete FltEvents; copy(o); return *this; } -void tFilter::copy(tFilter const &o) +void JZFilter::copy(JZFilter const &o) { mpSong = o.mpSong; FromClock = o.FromClock; @@ -98,7 +98,7 @@ } -tFilter::~tFilter() +JZFilter::~JZFilter() { delete FltEvents; } @@ -112,11 +112,11 @@ class tFilterDlg : public tPropertyListDlg { - tFilter *Filter; + JZFilter *Filter; tClockDlg FromClockDlg, ToClockDlg; public: - tFilterDlg(tFilter *f, JZSong *s, int ShowEventStats); + tFilterDlg(JZFilter *f, JZSong *s, int ShowEventStats); void AddProperties(); bool OnClose(); void OnHelp(); @@ -124,7 +124,7 @@ }; -tFilterDlg::tFilterDlg(tFilter *f, JZSong *Song, int ShowEventStats) +tFilterDlg::tFilterDlg(JZFilter *f, JZSong *Song, int ShowEventStats) : tPropertyListDlg("Filter"), FromClockDlg(Song, "From Time: ", f->FromClock), ToClockDlg(Song, "To Time: ", f->ToClock) @@ -188,7 +188,7 @@ -void tFilter::Dialog(wxFrame *parent, int ShowEventStats) +void JZFilter::Dialog(wxFrame *parent, int ShowEventStats) { tFilterDlg *dlg; // DialogBox = new wxDialogBox(parent, "Event Filter", FALSE ); @@ -208,7 +208,7 @@ -tTrackIterator::tTrackIterator(tFilter *f, int rev) +tTrackIterator::tTrackIterator(JZFilter *f, int rev) { Filter = f; Song = Filter->mpSong; Modified: trunk/jazz/src/Filter.h =================================================================== --- trunk/jazz/src/Filter.h 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/Filter.h 2008-03-30 14:55:50 UTC (rev 371) @@ -53,11 +53,11 @@ -class tFilter : public wxObject +class JZFilter : public wxObject { friend class tFilterDlg; wxDialog *DialogBox; - void copy(tFilter const &o); + void copy(JZFilter const &o); public: @@ -72,11 +72,11 @@ void Dialog(wxFrame *parent, int ShowEventStats = 1); - tFilter(JZSong* pSong); - tFilter(tFilter* pOtherFilter); - tFilter(tFilter const &o); - tFilter& operator=(tFilter const &o); - virtual ~tFilter(); + JZFilter(JZSong* pSong); + JZFilter(JZFilter* pOtherFilter); + JZFilter(JZFilter const &o); + JZFilter& operator=(JZFilter const &o); + virtual ~JZFilter(); int IsSelected(JZEvent *e) { @@ -109,7 +109,7 @@ }; -// extern tFilter *GlobalFilter; +// extern JZFilter *GlobalFilter; // void GlobalFilterDlg(wxButton& but, wxMouseEvent& event); // void GlobalFilterDlgNoStats(wxButton& but, wxMouseEvent& event); @@ -122,12 +122,12 @@ class tTrackIterator { - tFilter *Filter; + JZFilter *Filter; JZSong *Song; int TrackNr; int Reverse; public: - tTrackIterator(tFilter *f, int Reverse = 0); + tTrackIterator(JZFilter *f, int Reverse = 0); JZTrack *First(); JZTrack *Next(); int Count() const; Modified: trunk/jazz/src/HarmonyBrowserAnalyzer.cpp =================================================================== --- trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2008-03-30 14:55:50 UTC (rev 371) @@ -51,7 +51,7 @@ } -void HBAnalyzer::Init(tFilter* pFilter, int epc) +void HBAnalyzer::Init(JZFilter* pFilter, int epc) { Exit(); // cleanup from previous run @@ -104,7 +104,7 @@ } -int HBAnalyzer::Analyze(tFilter* pFilter, int qbc) +int HBAnalyzer::Analyze(JZFilter* pFilter, int qbc) { Init(pFilter, qbc); if (mSteps < max_seq) @@ -116,7 +116,7 @@ return 0; } -int HBAnalyzer::Transpose(tFilter* pFilter, int qbc) +int HBAnalyzer::Transpose(JZFilter* pFilter, int qbc) { pFilter->mpSong->NewUndoBuffer(); Init(pFilter, qbc); Modified: trunk/jazz/src/HarmonyBrowserAnalyzer.h =================================================================== --- trunk/jazz/src/HarmonyBrowserAnalyzer.h 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/HarmonyBrowserAnalyzer.h 2008-03-30 14:55:50 UTC (rev 371) @@ -23,7 +23,7 @@ #ifndef JZ_HARMONYBROWSERANALYZER_H #define JZ_HARMONYBROWSERANALYZER_H -class tFilter; +class JZFilter; class JZTrack; class HBContext; class tKeyOn; @@ -37,11 +37,11 @@ ~HBAnalyzer(); - int Analyze(tFilter *f, int eighth_per_chord = 8); + int Analyze(JZFilter *f, int eighth_per_chord = 8); - int Transpose(tFilter *f, int eighth_per_chord = 8); + int Transpose(JZFilter *f, int eighth_per_chord = 8); - void Init(tFilter *f, int steps_per_bar); + void Init(JZFilter *f, int steps_per_bar); void Exit(); @@ -69,7 +69,7 @@ int start_clock, stop_clock; int eighths_per_chord; int mSteps; - tFilter* mpFilter; + JZFilter* mpFilter; JZTrack* mpTrack; int** count; Modified: trunk/jazz/src/PianoWindow.cpp =================================================================== --- trunk/jazz/src/PianoWindow.cpp 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/PianoWindow.cpp 2008-03-30 14:55:50 UTC (rev 371) @@ -601,7 +601,7 @@ { InitColors(); - mpFilter = new tFilter(mpSong); + mpFilter = new JZFilter(mpSong); mpTrack = mpSong->GetTrack(mTrackIndex); Modified: trunk/jazz/src/PianoWindow.h =================================================================== --- trunk/jazz/src/PianoWindow.h 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/PianoWindow.h 2008-03-30 14:55:50 UTC (rev 371) @@ -31,7 +31,7 @@ class JZSong; class JZTrack; class JZEvent; -class tFilter; +class JZFilter; class tCtrlEditBase; class tSnapSelection; class JZGuitarFrame; @@ -76,7 +76,7 @@ virtual ~JZPianoWindow(); - tFilter* GetFilter(); + JZFilter* GetFilter(); void CreateGuitarWindow(); @@ -321,7 +321,7 @@ int mTrackIndex; - tFilter* mpFilter; + JZFilter* mpFilter; tCtrlEditBase* mpCtrlEdit; @@ -379,7 +379,7 @@ }; inline -tFilter* JZPianoWindow::GetFilter() +JZFilter* JZPianoWindow::GetFilter() { return mpFilter; } Modified: trunk/jazz/src/Project.h =================================================================== --- trunk/jazz/src/Project.h 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/Project.h 2008-03-30 14:55:50 UTC (rev 371) @@ -25,7 +25,7 @@ class JZPlayer; class JZSynth; -class tFilter; +class JZFilter; #include "Song.h" #include "Metronome.h" @@ -65,7 +65,7 @@ bool mRecord; // Not yet sure what this does - tFilter *Filter; + JZFilter* Filter; // Stores metrome information tMetronomeInfo mMetronomeInfo; Modified: trunk/jazz/src/Rhythm.cpp =================================================================== --- trunk/jazz/src/Rhythm.cpp 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/Rhythm.cpp 2008-03-30 14:55:50 UTC (rev 371) @@ -1025,7 +1025,7 @@ if (!event_win->EventsSelected("please mark destination track in trackwin")) return; - tFilter* pFilter = event_win->mpFilter; + JZFilter* pFilter = event_win->mpFilter; if (pFilter->FromTrack != pFilter->ToTrack) { Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/TrackWindow.cpp 2008-03-30 14:55:50 UTC (rev 371) @@ -117,7 +117,7 @@ mpSnapSel = new tSnapSelection(this); - mpFilter = new tFilter(mpSong); + mpFilter = new JZFilter(mpSong); SetBackgroundColour(*wxWHITE); Modified: trunk/jazz/src/TrackWindow.h =================================================================== --- trunk/jazz/src/TrackWindow.h 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/TrackWindow.h 2008-03-30 14:55:50 UTC (rev 371) @@ -28,7 +28,7 @@ class JZSong; class JZTrack; -class tFilter; +class JZFilter; class tSnapSelection; class wxFont; @@ -54,7 +54,7 @@ { public: - tFilter* mpFilter; + JZFilter* mpFilter; tSnapSelection* mpSnapSel; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 15:21:55
|
Revision: 373 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=373&view=rev Author: pstieber Date: 2008-03-30 08:21:52 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Changed pString to pData. Modified Paths: -------------- trunk/jazz/src/Events.cpp trunk/jazz/src/Events.h Modified: trunk/jazz/src/Events.cpp =================================================================== --- trunk/jazz/src/Events.cpp 2008-03-30 15:07:26 UTC (rev 372) +++ trunk/jazz/src/Events.cpp 2008-03-30 15:21:52 UTC (rev 373) @@ -156,7 +156,7 @@ //***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tGetMidiBytes::Write(JZEvent* pEvent, unsigned char* pString, int Length) +int tGetMidiBytes::Write(JZEvent* pEvent, unsigned char* pData, int Length) { int Stat = pEvent->Stat; @@ -175,7 +175,7 @@ Buffer[nBytes++] = Stat | ((tChannelEvent *)pEvent)->Channel; while(Length--) { - Buffer[nBytes++] = *pString++; + Buffer[nBytes++] = *pData++; } return 0; Modified: trunk/jazz/src/Events.h =================================================================== --- trunk/jazz/src/Events.h 2008-03-30 15:07:26 UTC (rev 372) +++ trunk/jazz/src/Events.h 2008-03-30 15:21:52 UTC (rev 373) @@ -114,7 +114,7 @@ virtual int Write( JZEvent* pEvent, - unsigned char* pString, + unsigned char* pData, int Length) = 0; virtual void NextTrack(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-31 04:07:23
|
Revision: 377 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=377&view=rev Author: pstieber Date: 2008-03-30 21:07:20 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Removed some comments that mentioned JZEventFrame. Modified Paths: -------------- trunk/jazz/src/PianoFrame.cpp trunk/jazz/src/PianoFrame.h Modified: trunk/jazz/src/PianoFrame.cpp =================================================================== --- trunk/jazz/src/PianoFrame.cpp 2008-03-30 18:25:05 UTC (rev 376) +++ trunk/jazz/src/PianoFrame.cpp 2008-03-31 04:07:20 UTC (rev 377) @@ -742,10 +742,6 @@ mpPianoWindow->SetVisibleAllTracks(Value); } -/////////////////////////////////////////////////////////////////////////////// -// Function slurped from JZEventFrame -/////////////////////////////////////////////////////////////////////////////// - void JZPianoFrame::NewPlayPosition(int Clock) { mpPianoWindow->NewPlayPosition(Clock); Modified: trunk/jazz/src/PianoFrame.h =================================================================== --- trunk/jazz/src/PianoFrame.h 2008-03-30 18:25:05 UTC (rev 376) +++ trunk/jazz/src/PianoFrame.h 2008-03-31 04:07:20 UTC (rev 377) @@ -124,7 +124,6 @@ void OnVisibleAllTracks(wxCommandEvent& Event); void OnReset(wxCommandEvent& Event); - // Functions slurped from JZEventFrame public: void NewPlayPosition(int Clock); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-31 04:10:31
|
Revision: 378 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=378&view=rev Author: pstieber Date: 2008-03-30 21:10:22 -0700 (Sun, 30 Mar 2008) Log Message: ----------- 1. Prefixed shift dialog data members with m, and changed EventWin to mpEventWindow in every class. 2. Made some cosmetic changes. Modified Paths: -------------- trunk/jazz/src/Dialogs.cpp trunk/jazz/src/Dialogs.h Modified: trunk/jazz/src/Dialogs.cpp =================================================================== --- trunk/jazz/src/Dialogs.cpp 2008-03-31 04:07:20 UTC (rev 377) +++ trunk/jazz/src/Dialogs.cpp 2008-03-31 04:10:22 UTC (rev 378) @@ -48,57 +48,54 @@ // ************************************************************************** // Shift // ************************************************************************* - - -//long tShiftDlg::Steps = 0; - -tShiftDlg::tShiftDlg(JZEventFrame *w, JZFilter *f, long unit) -: tPropertyListDlg( "Shift events left/right" ) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +tShiftDlg::tShiftDlg(JZEventFrame* pEventWindow, JZFilter* pFilter, long unit) + : tPropertyListDlg("Shift events left/right"), + mSteps(0), + mUnit(unit), + mpEventWindow(pEventWindow), + mpFilter(pFilter), + mpSong(pFilter->mpSong) { - Filter = f; - Song = f->mpSong; - Unit = unit; - EventWin = w; - Steps=0; } - - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- bool tShiftDlg::OnClose() { - cout << "tShiftDlg::OnClose "<<Steps<<endl; - tCmdShift cmd(Filter, Steps * Unit); + cout << "tShiftDlg::OnClose " << mSteps << endl; + tCmdShift cmd(mpFilter, mSteps * mUnit); cmd.Execute(); - EventWin->Redraw(); - if (EventWin->NextWin) + mpEventWindow->Refresh(); + if (mpEventWindow->NextWin) { - EventWin->NextWin->Redraw(); + mpEventWindow->NextWin->Refresh(); } // wxForm::OnOk(); return false; } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void tShiftDlg::OnHelp() { gpHelpInstance->ShowTopic("Shift"); } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void tShiftDlg::AddProperties() { - //send wxPropertyValue REFERENCE not POINTER - sheet->AddProperty(new wxProperty("Snaps", wxPropertyValue(&Steps), "integer", new wxIntegerListValidator(-16, 16))); - sheet->AddProperty(new wxProperty("clocks per snap", (long)Unit, "integer"));//informational only - + sheet->AddProperty(new wxProperty("Snaps", wxPropertyValue(&mSteps), "integer", new wxIntegerListValidator(-16, 16))); + sheet->AddProperty(new wxProperty("clocks per snap", (long)mUnit, "integer"));//informational only } - // ************************************************************************** // Cleanup // ************************************************************************* @@ -113,7 +110,7 @@ { Filter = f; Song = f->mpSong; - EventWin = w; + mpEventWindow = w; } @@ -126,10 +123,10 @@ << endl; tCmdCleanup cln(Filter, limit, shortenOverlaps); cln.Execute(); - EventWin->Redraw(); - if (EventWin->NextWin) + mpEventWindow->Refresh(); + if (mpEventWindow->NextWin) { - EventWin->NextWin->Redraw(); + mpEventWindow->NextWin->Refresh(); } //wxForm::OnOk(); @@ -197,16 +194,18 @@ { Filter = f; Song = f->mpSong; - EventWin = w; + mpEventWindow = w; } bool tSearchReplaceDlg::OnClose() { tCmdSearchReplace sr(Filter, frCtrl - 1, toCtrl-1); sr.Execute(); - EventWin->Redraw(); - if (EventWin->NextWin) - EventWin->NextWin->Redraw(); + mpEventWindow->Refresh(); + if (mpEventWindow->NextWin) + { + mpEventWindow->NextWin->Refresh(); + } return false; } @@ -245,7 +244,7 @@ tTransposeDlg::tTransposeDlg(JZEventFrame *w, JZFilter *f) : tPropertyListDlg("Transpose") { - EventWin = w; + mpEventWindow = w; Filter = f; Song = f->mpSong; } @@ -255,13 +254,13 @@ { tCmdTranspose trn(Filter, Notes, Scale, FitIntoScale); trn.Execute(); - if (EventWin->NextWin) + if (mpEventWindow->NextWin) { - EventWin->NextWin->Redraw(); + mpEventWindow->NextWin->Refresh(); } else { - EventWin->Redraw(); + mpEventWindow->Refresh(); } return false; @@ -405,7 +404,7 @@ { Filter = f; Song = f->mpSong; - EventWin = w; + mpEventWindow = w; } @@ -414,10 +413,10 @@ tCmdLength cmd(Filter, FromValue, ToValue, Mode); cmd.Execute(); - EventWin->Redraw(); - if (EventWin->NextWin) + mpEventWindow->Refresh(); + if (mpEventWindow->NextWin) { - EventWin->NextWin->Redraw(); + mpEventWindow->NextWin->Refresh(); } //tPropertyListDlg::OnClose(); @@ -470,7 +469,7 @@ { Filter = f; Song = f->mpSong; - EventWin = w; + mpEventWindow = w; } @@ -478,11 +477,12 @@ { tCmdSeqLength cmd(Filter, scale); cmd.Execute(); - EventWin->Redraw(); - if (EventWin->NextWin) + mpEventWindow->Refresh(); + if (mpEventWindow->NextWin) { - EventWin->NextWin->Redraw(); + mpEventWindow->NextWin->Refresh(); } + //tPropertyListDlg::OnClose(); return false; } @@ -516,7 +516,7 @@ { Filter = f; Song = f->mpSong; - EventWin = w; + mpEventWindow = w; } @@ -525,9 +525,12 @@ tCmdMidiDelay cmd(Filter, scale,clockDelay,repeat); cmd.Execute(); - EventWin->Redraw(); - if (EventWin->NextWin) - EventWin->NextWin->Redraw(); + mpEventWindow->Refresh(); + if (mpEventWindow->NextWin) + { + mpEventWindow->NextWin->Refresh(); + } + //tPropertyListDlg::OnClose(); return false; } @@ -576,7 +579,7 @@ : tPropertyListDlg("Delete" ) { Filter = f; - EventWin = w; + mpEventWindow = w; } @@ -584,10 +587,10 @@ { tCmdErase cmd(Filter, LeaveSpace); cmd.Execute(); - EventWin->Redraw(); - if (EventWin->NextWin) + mpEventWindow->Refresh(); + if (mpEventWindow->NextWin) { - EventWin->NextWin->Redraw(); + mpEventWindow->NextWin->Refresh(); } // tPropertyListDlg::OnClose(); @@ -671,7 +674,7 @@ { Filter = f; Song = f->mpSong; - EventWin = w; + mpEventWindow = w; } @@ -684,16 +687,19 @@ qnt.NoteStart = NoteStart; qnt.NoteLength = NoteLength; qnt.Execute(); - EventWin->Redraw(); - if (EventWin->NextWin) - EventWin->NextWin->Redraw(); + mpEventWindow->Refresh(); + if (mpEventWindow->NextWin) + { + mpEventWindow->NextWin->Refresh(); + } + //tPropertyListDlg::OnClose(); return false; } void tQuantizeDlg::OnHelp() { - if (EventWin->NextWin) + if (mpEventWindow->NextWin) { gpHelpInstance->ShowTopic("Quantize"); } @@ -751,7 +757,7 @@ tEventDlg::tEventDlg(JZEvent *e, JZPianoWindow* w, JZTrack *t) : tPropertyListDlg( "Event" ), - ClockDlg(w->mpSong, "Time ", e->GetClock()) + ClockDlg(w->GetSong(), "Time ", e->GetClock()) { Win = w; Track = t; @@ -1497,7 +1503,7 @@ case StatSetTempo: str = "Set Tempo (for track 0)"; - dlg = new tSetTempoDlg(e->IsSetTempo(), pPianoWindow, pPianoWindow->mpSong->GetTrack(0) ); + dlg = new tSetTempoDlg(e->IsSetTempo(), pPianoWindow, pPianoWindow->GetSong()->GetTrack(0) ); break; case StatSysEx: Modified: trunk/jazz/src/Dialogs.h =================================================================== --- trunk/jazz/src/Dialogs.h 2008-03-31 04:07:20 UTC (rev 377) +++ trunk/jazz/src/Dialogs.h 2008-03-31 04:10:22 UTC (rev 378) @@ -29,23 +29,25 @@ class JZFilter; class JZSong; class JZEventFrame; +class JZEventWindow; class JZTrack; class JZEvent; class tShiftDlg : public tPropertyListDlg { - public: - long Steps; // 0 was static - long Unit; + public: + + long mSteps; // 0 was static + long mUnit; - JZFilter* Filter; - JZSong* Song; - JZEventFrame* EventWin; + JZEventFrame* mpEventWindow; + JZFilter* mpFilter; + JZSong* mpSong; - tShiftDlg(JZEventFrame *w, JZFilter *f, long Unit); - void AddProperties(); - bool OnClose(); - void OnHelp(); + tShiftDlg(JZEventFrame* pEventWindow, JZFilter* pFilter, long Unit); + void AddProperties(); + bool OnClose(); + void OnHelp(); }; class tCleanupDlg : public tPropertyListDlg @@ -57,7 +59,7 @@ JZFilter *Filter; JZSong *Song; - JZEventFrame *EventWin; + JZEventFrame* mpEventWindow; tCleanupDlg(JZEventFrame *w, JZFilter *f); void AddProperties(); @@ -77,7 +79,7 @@ JZFilter *Filter; JZSong *Song; - JZEventFrame *EventWin; + JZEventFrame* mpEventWindow; tSearchReplaceDlg(JZEventFrame *w, JZFilter *f); void AddProperties(); @@ -94,7 +96,7 @@ static bool FitIntoScale; static int Scale; - JZEventFrame *EventWin; + JZEventFrame* mpEventWindow; JZFilter *Filter; JZSong *Song; @@ -148,7 +150,7 @@ JZFilter *Filter; JZSong *Song; - JZEventFrame *EventWin; + JZEventFrame* mpEventWindow; tLengthDlg(JZEventFrame *win, JZFilter *f); void AddProperties(); @@ -166,7 +168,7 @@ JZFilter *Filter; JZSong *Song; - JZEventFrame *EventWin; + JZEventFrame* mpEventWindow; tSeqLengthDlg(JZEventFrame *win, JZFilter *f); void AddProperties(); @@ -185,7 +187,7 @@ JZFilter *Filter; JZSong *Song; - JZEventFrame *EventWin; + JZEventFrame* mpEventWindow; tMidiDelayDlg(JZEventFrame *win, JZFilter *f); void AddProperties(); @@ -196,7 +198,7 @@ class tDeleteDlg : public tPropertyListDlg { JZFilter *Filter; - JZEventFrame *EventWin; + JZEventFrame* mpEventWindow; public: static bool LeaveSpace; // 1 @@ -241,7 +243,7 @@ JZFilter *Filter; JZSong *Song; - JZEventFrame *EventWin; + JZEventFrame* mpEventWindow; long Quantize(long); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-31 04:12:47
|
Revision: 379 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=379&view=rev Author: pstieber Date: 2008-03-30 21:12:45 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Moved more data members and code from the track and piano window into the event window. This allowed the removal of the event frame class from other code. Modified Paths: -------------- trunk/jazz/src/ControlEdit.cpp trunk/jazz/src/EventWindow.cpp trunk/jazz/src/EventWindow.h trunk/jazz/src/MouseAction.cpp trunk/jazz/src/MouseAction.h trunk/jazz/src/PianoWindow.cpp trunk/jazz/src/PianoWindow.h trunk/jazz/src/Rhythm.cpp trunk/jazz/src/Rhythm.h trunk/jazz/src/TrackWindow.cpp trunk/jazz/src/TrackWindow.h Modified: trunk/jazz/src/ControlEdit.cpp =================================================================== --- trunk/jazz/src/ControlEdit.cpp 2008-03-31 04:10:22 UTC (rev 378) +++ trunk/jazz/src/ControlEdit.cpp 2008-03-31 04:12:45 UTC (rev 379) @@ -240,7 +240,7 @@ void tCtrlEditBase::OnApply() { wxBeginBusyCursor(); - mpPianoWindow->mpSong->NewUndoBuffer(); + mpPianoWindow->GetSong()->NewUndoBuffer(); // delete old events, but skip clock 0 to preserve track defaults: // (dirty but might work...) tEventIterator iter(track); @@ -360,7 +360,7 @@ // av: called by tArrayEdit::OnPaint void tCtrlEditBase::DrawBars(wxDC* dc) { - JZBarInfo BarInfo(mpPianoWindow->mpSong); + JZBarInfo BarInfo(mpPianoWindow->GetSong()); BarInfo.SetClock(from_clock); long gclk,x; int ii; @@ -515,7 +515,7 @@ static long from_clk, to_clk; wxBeginBusyCursor(); - mpPianoWindow->mpSong->NewUndoBuffer(); + mpPianoWindow->GetSong()->NewUndoBuffer(); tEventIterator iter(track); @@ -618,7 +618,7 @@ } wxBeginBusyCursor(); - mpPianoWindow->mpSong->NewUndoBuffer(); + mpPianoWindow->GetSong()->NewUndoBuffer(); tEventIterator iter(track); @@ -768,7 +768,7 @@ void tChannelAfterEdit::OnApply() { wxBeginBusyCursor(); - mpPianoWindow->mpSong->NewUndoBuffer(); + mpPianoWindow->GetSong()->NewUndoBuffer(); // delete old events, but skip clock 0 to preserve track defaults: // (dirty but might work...) Modified: trunk/jazz/src/EventWindow.cpp =================================================================== --- trunk/jazz/src/EventWindow.cpp 2008-03-31 04:10:22 UTC (rev 378) +++ trunk/jazz/src/EventWindow.cpp 2008-03-31 04:12:45 UTC (rev 379) @@ -34,113 +34,247 @@ using namespace std; -// ************************************************************************ -// tCanvas -// ************************************************************************ +//***************************************************************************** +// Description: +// This is the event window class definition. +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//BEGIN_EVENT_TABLE(JZEventWindow, wxScrolledWindow) +//END_EVENT_TABLE() -#define ScLine 50L +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +const int JZEventWindow::mScrollSize = 50; +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZEventWindow::JZEventWindow( + wxFrame* pParent, + JZSong* pSong, + const wxPoint& Position, + const wxSize& Size) + : wxScrolledWindow( + pParent, + wxID_ANY, + Position, + Size, + wxHSCROLL | wxVSCROLL | wxNO_FULL_REPAINT_ON_RESIZE), + mpSnapSel(0), + mpFilter(0), + mpSong(pSong), + mpGreyColor(0), + mpGreyBrush(0), + mTopInfoHeight(40), + mTrackHeight(10), + mLittleBit(2) +{ + mpSnapSel = new tSnapSelection(this); -//notice, there is a conflict between this and the subclass event tables that i dont know how to resolv -BEGIN_EVENT_TABLE(JZEventFrame, wxFrame) - EVT_SIZE(JZEventFrame::OnSize) -END_EVENT_TABLE() + mpFilter = new JZFilter(mpSong); +#ifdef __WXMSW__ + mpGreyColor = new wxColor(192, 192, 192); +#else + mpGreyColor = new wxColor(220, 220, 220); +#endif -//tCanvas::tCanvas(JZEventFrame *frame, int x, int y, int w, int h, int style) -// : wxScrolledWindow(frame, -1, wxPoint(x, y), wxSize(w, h), style) + mpGreyBrush = new wxBrush(*mpGreyColor, wxSOLID); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZEventWindow::~JZEventWindow() +{ + delete mpSnapSel; + delete mpFilter; + delete mpGreyColor; + delete mpGreyBrush; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZEventWindow::EventsSelected(const wxString& Message) const +{ + if (!mpSnapSel->Selected) + { + wxMessageBox(Message, "Error", wxOK); + return 0; + } + return 1; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//void JZEventWindow::SetScrollRanges() //{ -// EventWin = frame; +// int Width, Height; +// GetVirtualEventSize(Width, Height); +// SetScrollbars( +// mScrollSize, +// mScrollSize, +// Width / mScrollSize, +// Height / mScrollSize); +// EnableScrolling(false, false); //} -/** -JAVE seems to want to clip the paint area -calls the subclass paint routine +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventWindow::SetScrollPosition(int x, int y) +{ + x /= mScrollSize; + y /= mScrollSize; + Scroll(x, y); +} -onpaint seems never to get called -*/ +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZEventWindow::y2yLine(int y, int Up) +{ + if (Up) + { + y += mTrackHeight; + } + y -= mTopInfoHeight; + y -= y % mTrackHeight; + y += mTopInfoHeight; + return y; +} -//void tCanvas::OnDraw(wxDC& dc) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventWindow::LineText( + wxDC& Dc, + int x, + int y, + int Width, + const char* pString, + int Height, + bool Down) +{ + if (Height <= 0) + { + Height = mTrackHeight; + y = y2yLine(y); + } + if (Width && Height) + { + Dc.SetBrush(*mpGreyBrush); + Dc.SetPen(*wxGREY_PEN); +#ifdef __WXMSW__ + Dc.DrawRectangle(x, y, Width + 1, Height + 1); +#else + Dc.DrawRectangle(x, y, Width, Height); +#endif + x += 1; + y += 1; + Width -= 2; + Height -= 2; + if (Down) + { + Dc.SetPen(*wxBLACK_PEN); + Dc.DrawLine(x, y, x + Width, y); + Dc.DrawLine(x, y, x, y + Height); + Dc.SetPen(*wxWHITE_PEN); + Dc.DrawLine(x + Width, y, x + Width, y + Height); + Dc.DrawLine(x, y + Height, x + Width, y + Height); + } + else + { + Dc.SetPen(*wxWHITE_PEN); + Dc.DrawLine(x, y, x + Width, y); + Dc.DrawLine(x, y, x, y + Height); + Dc.SetPen(*wxBLACK_PEN); + Dc.DrawLine(x + Width, y, x + Width, y + Height); + Dc.DrawLine(x, y + Height, x + Width, y + Height); + } + Dc.SetPen(*wxBLACK_PEN); + x -= 2; + y -= 2; + } + + if (pString && strlen(pString) > 0) + { + wxColor TextBackgroundColor = Dc.GetTextBackground(); + Dc.SetTextBackground(*mpGreyColor); + int TextWidth, TextHeight; + Dc.GetTextExtent(pString, &TextWidth, &TextHeight); + int Margin = (Width - TextWidth) / 2; + if (Margin < mLittleBit) + { + Margin = mLittleBit; + } + Dc.DrawText(pString, x + Margin, y + mLittleBit); + Dc.SetTextBackground(TextBackgroundColor); + } +} + +//----------------------------------------------------------------------------- +// JAVE seems to want to clip the paint area +// calls the subclass paint routine +// +// OnPaint seems never to get called +//----------------------------------------------------------------------------- +//void JZEventWindow::OnDraw(wxDC& Dc) //{ // //onpaint never seems to get called, but ondraw does get called // int x = 0, y = 0; // GetViewStart(&x, &y); -// EventWin->OnPaintSub(&dc, x * ScLine, y * ScLine); -// cout << "tCanvas::OnDraw\n"; +// EventWin->OnPaintSub(Dc, x * mScrollSize, y * mScrollSize); +// cout << "JZEventWindow::OnDraw << endl; //} -//the canvas sends events to the subclassed window, i (might)filter the events a bit so as not get all mouse move events -//BEGIN_EVENT_TABLE(tCanvas, wxScrolledWindow) -// EVT_MOUSE_EVENTS(tCanvas::OnMouseEvent) -//// EVT_LEFT_DOWN(tCanvas::OnMouseEvent) -//// EVT_LEFT_UP(tCanvas::OnMouseEvent) -//// EVT_RIGHT_DOWN(tCanvas::OnMouseEvent) -//// EVT_RIGHT_UP(tCanvas::OnMouseEvent) -//END_EVENT_TABLE() - - /** - this mouse handler delegates to the subclased eventwin - */ -//void tCanvas::OnMouseEvent(wxMouseEvent &e) +//----------------------------------------------------------------------------- +// This mouse handler delegates to the subclased event window. +//----------------------------------------------------------------------------- +//void JZEventWindow::OnMouseEvent(wxMouseEvent& MouseEvent) //{ -// EventWin->OnMouseEvent(e); +// EventWin->OnMouseEvent(MouseEvent); //} -/** -probably never called in wx2 -*/ -// void tCanvas::OnEvent(wxMouseEvent &e) -// { -// EventWin->OnMouseEvent(e); -// } +// JAVE the OnChar method seems to be gone in wxwin232, but its documented, so +// I don't know what happened. The OnCharHook should do the same thing +// basically. It was there from the start. OnChar seemd redundant. -//JAVE the OnChar method seems to be gone in wxwin232, but its documented, so i dont know whats happened -//the OnCharHook should do the same thing basically(it was there from the start. OnChar seemd redundant) - -// void tCanvas::OnChar(wxKeyEvent &e) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +// void JZEventWindow::OnChar(wxKeyEvent& KeyEvent) // { -// if (!EventWin->OnKeyEvent(e)) -// wxWindow::OnChar(e); +// if (!EventWin->OnKeyEvent(KeyEvent)) +// { +// wxWindow::OnChar(KeyEvent); +// } // } -// void JZEventFrame::OnChar(wxKeyEvent& e) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +// void JZEventFrame::OnChar(wxKeyEvent& KeyEvent) // { -// if (!OnKeyEvent(e)) -// wxFrame::OnChar(e); +// if (!OnKeyEvent(KeyEvent)) +// { +// wxFrame::OnChar(KeyEvent); +// } // } -//bool tCanvas::OnCharHook(wxKeyEvent& e) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//bool JZEventWindow::OnCharHook(wxKeyEvent& KeyEvent) //{ -// return EventWin->OnKeyEvent(e); +// return EventWin->OnKeyEvent(KeyEvent); //} -bool JZEventFrame::OnCharHook(wxKeyEvent& e) -{ - return OnKeyEvent(e); -} +//***************************************************************************** +// Description: +// This is the event frame class definition. +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +BEGIN_EVENT_TABLE(JZEventFrame, wxFrame) + EVT_SIZE(JZEventFrame::OnSize) +END_EVENT_TABLE() - -//void tCanvas::SetScrollRanges() -//{ -// int Width, Height; -// EventWin->GetVirtualEventSize(Width, Height); -// SetScrollbars(ScLine, ScLine, Width / ScLine, Height / ScLine); -// EnableScrolling(false, false); -//} - -//void tCanvas::SetScrollPosition(int x, int y) -//{ -// x /= ScLine; -// y /= ScLine; -// Scroll(x, y); -//} - - -// ************************************************************************ -// JZEventFrame -// ************************************************************************ - -// default is 640x442 +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- JZEventFrame::JZEventFrame( wxWindow* pParent, const wxString& Title, @@ -151,7 +285,7 @@ Song(pSong), mpFilter(0), NextWin(0), -// Canvas(0), +// mpEventWindow(0), mpFont(0), mpFixedFont(0), hFixedFont(0), @@ -196,7 +330,6 @@ JZEventFrame::~JZEventFrame() { -// delete Canvas; delete SnapSel; delete mpGreyColor; @@ -219,13 +352,6 @@ void JZEventFrame::CreateMenu() { -#if 0 - wxMenu *menu = new wxMenu; - menu->Append(999, "&MenuItem"); - wxMenuBar *menu_bar = new wxMenuBar; - menu_bar->Append(menu, "&Debug"); - SetMenuBar(menu_bar); -#endif } @@ -236,10 +362,10 @@ */ //void JZEventFrame::CreateCanvas() //{ -// cout << "createcanvas\n"; -// int w, h; -// GetClientSize(&w, &h); -// Canvas = new tCanvas(this, 0, 0, w, h); +// cout << "CreateCanvas" << endl; +// int Width, Height; +// GetClientSize(&Width, &Height); +// mpEventWindow = new JZEventWindow(this, 0, 0, Width, Height); //} /** @@ -251,40 +377,38 @@ CreateMenu(); // CreateCanvas(); -// SnapSel = new tSnapSelection(Canvas); +// SnapSel = new tSnapSelection(mpEventWindow); Setup(); -// Canvas->SetScrollRanges(); -// Canvas->SetScrollPosition(0,0);//this wasnt here before wx2, why? +// mpEventWindow->SetScrollRanges(); +// mpEventWindow->SetScrollPosition(0, 0); //this wasnt here before wx2, why? } -/**initialize the constants used in drawing*/ +// Initialize the constants used in drawing. void JZEventFrame::Setup() { /* int x, y; - wxDC* dc = new wxClientDC(Canvas); - //dc is from Canvas - dc->SetFont(wxNullFont); + wxClientDC Dc(mpEventWindow); + Dc.SetFont(wxNullFont); delete mpFixedFont; mpFixedFont = new wxFont(12, wxSWISS, wxNORMAL, wxNORMAL); - dc->SetFont(*mpFixedFont); - dc->GetTextExtent("M", &x, &y); + Dc.SetFont(*mpFixedFont); + Dc.GetTextExtent("M", &x, &y); hFixedFont = (int)y; delete mpFont; mpFont = new wxFont(FontSize, wxSWISS, wxNORMAL, wxNORMAL); - dc->SetFont(*mpFont); + Dc.SetFont(*mpFont); - dc->GetTextExtent("M", &x, &y); + Dc.GetTextExtent("M", &x, &y); LittleBit = (int)(x/2); - dc->GetTextExtent("HXWjgi", &x, &y); + Dc.GetTextExtent("HXWjgi", &x, &y); mTrackHeight = (int)y + LittleBit; - delete dc; */ } @@ -295,50 +419,56 @@ */ void JZEventFrame::OnSize(wxSizeEvent& Event) { - // wxFrame::OnSize(Event); +// wxFrame::OnSize(Event); - //the below code is from the toolbar sample, the layoutchidlren function - wxSize size = GetClientSize(); + // The code below is from the toolbar sample, the layoutchidlren function + wxSize size = GetClientSize(); - int offset; -// if ( mpToolBar ) -// { -// mpToolBar->SetSize(-1, size.y); -// mpToolBar->Move(0, 0); + int offset; +// if (mpToolBar) +// { +// mpToolBar->SetSize(-1, size.y); +// mpToolBar->Move(0, 0); +// +// offset = mpToolBar->GetSize().x; +// } +// else +// { +// offset = 0; +// } -// offset = mpToolBar->GetSize().x; -// } -// else -// { -// offset = 0; -// } + // The step below should set the offset of the mpEventWindow + // m_textWindow->SetSize(offset, 0, size.x - offset, size.y); - //the step below should set the offset of the Canvas - //m_textWindow->SetSize(offset, 0, size.x - offset, size.y); +// float maxToolBarWidth = 0.0; +// float maxToolBarHeight = 0.0; +// if (mpToolBar) +// { +// mpToolBar->GetMaxSize(&maxToolBarWidth, &maxToolBarHeight); +// } - + offset = mpToolBar->GetSize().y; //get the height of the toolbar -// float maxToolBarWidth = 0.0; -// float maxToolBarHeight = 0.0; -// if (mpToolBar) -// mpToolBar->GetMaxSize(&maxToolBarWidth, &maxToolBarHeight); - - offset = mpToolBar->GetSize().y; //get the height of the toolbar - - int frameWidth, frameHeight; - GetClientSize(&frameWidth, &frameHeight); + int frameWidth, frameHeight; + GetClientSize(&frameWidth, &frameHeight); -// if (Canvas) -// // Canvas->SetSize(0, (int)offset, (int)frameWidth, (int)(frameHeight - offset)); -// Canvas->SetSize(0, (int)0, (int)frameWidth, (int)(frameHeight)); +// if (mpEventWindow) +// // mpEventWindow->SetSize(0, (int)offset, (int)frameWidth, (int)(frameHeight - offset)); +// mpEventWindow->SetSize(0, (int)0, (int)frameWidth, (int)(frameHeight)); // // if (mpToolBar) // // mpToolBar->SetSize(0, 0, (int)frameWidth, (int)maxToolBarHeight); - cout<<"JZEventFrame::OnSize "<<frameWidth<<" "<<frameHeight<<"\n"; + cout + << "JZEventFrame::OnSize " << frameWidth<< 'x' << frameHeight << endl; +} +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool JZEventFrame::OnCharHook(wxKeyEvent& e) +{ + return OnKeyEvent(e); +} - } - // ******************************************************************* // Coord-Functions // ******************************************************************* @@ -396,6 +526,7 @@ return Line * mTrackHeight + mTopInfoHeight; } +/* void JZEventFrame::LineText(wxDC *dc, int x, int y, int w, const char *str, int h, bool down) { if (h <= 0) @@ -417,7 +548,8 @@ y += 1; w -= 2; h -= 2; - if (down) { + if (down) + { dc->SetPen(*wxBLACK_PEN); dc->DrawLine(x, y, x+w, y); dc->DrawLine(x, y, x, y+h); @@ -425,7 +557,8 @@ dc->DrawLine(x+w, y, x+w, y+h); dc->DrawLine(x, y+h, x+w, y+h); } - else { + else + { dc->SetPen(*wxWHITE_PEN); dc->DrawLine(x, y, x+w, y); dc->DrawLine(x, y, x, y+h); @@ -441,8 +574,8 @@ dc->DrawText((char *)str, x + LittleBit, y + LittleBit); dc->SetTextBackground(*wxWHITE); } +*/ - // ******************************************************************* // Painting behavior // ******************************************************************* @@ -452,13 +585,13 @@ // wxDC* dc=new wxClientDC(this); // wxPaintEvent e; // cout<<"FIXME JZEventFrame::Redraw"<<endl; -// Canvas->OnDraw(*dc); //this will in turn call the eventwin onpaintsub +// mpEventWindow->OnDraw(*dc); //this will in turn call the eventwin onpaintsub // //the problem is that onpaint no longer tkes no argument, and is supposed to be called from the framework only, so it should be split // delete dc; -// Canvas->Refresh(); +// mpEventWindow->Refresh(); } @@ -468,7 +601,7 @@ it doesnt do any real drawing, instead it sets up some member vars, to be used by other parts of the class - it is now normally called from OnDraw in the Canvas class,and also overridden in the subclass. + it is now normally called from OnDraw in the mpEventWindow class,and also overridden in the subclass. so this one here just sets up constants @@ -603,7 +736,7 @@ if (Clock > FromClock && ToClock >= Song->MaxQuarters * Song->TicksPerQuarter) return; // int x = Clock2x(Clock); -// Canvas->SetScrollPosition(x - mLeftInfoWidth, CanvasY); +// mpEventWindow->SetScrollPosition(x - mLeftInfoWidth, CanvasY); } if (!SnapSel->Active) // sets clipping @@ -618,13 +751,13 @@ // invalidateRect.width=3; // invalidateRect.height= 100000000; // //DrawPlayPosition(); -// Canvas->Refresh(TRUE,&invalidateRect); +// mpEventWindow->Refresh(TRUE,&invalidateRect); // invalidateRect.x=Clock2x(PlayClock)-1; -// Canvas->Refresh(TRUE,&invalidateRect); +// mpEventWindow->Refresh(TRUE,&invalidateRect); //DrawPlayPosition(); -// Canvas->Refresh(); +// mpEventWindow->Refresh(); } } if (NextWin) @@ -945,10 +1078,10 @@ // int x = CanvasX * 2; // int y = CanvasY; -// wxDC* dc=new wxClientDC(Canvas); +// wxDC* dc=new wxClientDC(mpEventWindow); // JZEventFrame::OnPaintSub(dc, x, y); -// Canvas->SetScrollRanges(); -// Canvas->SetScrollPosition(x, y); +// mpEventWindow->SetScrollRanges(); +// mpEventWindow->SetScrollPosition(x, y); // if (x == 0) // Redraw(); @@ -965,10 +1098,10 @@ // int x = CanvasX / 2; // int y = CanvasY; - //wxDC* dc=new wxClientDC(Canvas); - //JZEventFrame::OnPaintSub(dc, x, y); -// Canvas->SetScrollRanges(); -// Canvas->SetScrollPosition(x, y); + //wxClientDC Dc(mpEventWindow); + //JZEventFrame::OnPaintSub(Dc, x, y); +// mpEventWindow->SetScrollRanges(); +// mpEventWindow->SetScrollPosition(x, y); //if (x == 0) // Redraw(); // } Modified: trunk/jazz/src/EventWindow.h =================================================================== --- trunk/jazz/src/EventWindow.h 2008-03-31 04:10:22 UTC (rev 378) +++ trunk/jazz/src/EventWindow.h 2008-03-31 04:12:45 UTC (rev 379) @@ -31,45 +31,99 @@ class JZToolBar; class JZPianoFrame; -/** -JAVE i dont get the meaning of this class -it seems to just fork out the method calls to its delegate, EventWin -*/ -/* -class tCanvas: public wxScrolledWindow +//***************************************************************************** +// Description: +// This class is derived from a wxWidgets scrolled window, and acts as the +// common base class for JZTrackWindow and JSPianoWindow. +//***************************************************************************** +class JZEventWindow : public wxScrolledWindow { public: - JZEventFrame *EventWin; - tCanvas(JZEventFrame *frame, int x, int y, int w, int h, int style = 0); - void OnPaint(wxPaintEvent& event); - // void OnEvent(wxMouseEvent& event); - void OnMouseEvent(wxMouseEvent& event); - void OnChar(wxKeyEvent& event); - bool OnCharHook(wxKeyEvent& event); - void SetScrollRanges(); + + tSnapSelection* mpSnapSel; + + JZFilter* mpFilter; + + JZEventWindow( + wxFrame* pParent, + JZSong* pSong, + const wxPoint& Position = wxDefaultPosition, + const wxSize& Size = wxDefaultSize); + + virtual ~JZEventWindow(); + + // WARNING: non-constant access. + JZSong* GetSong() const; + + int EventsSelected(const wxString& Message) const; + + void LineText( + wxDC& Dc, + int x, + int y, + int Width, + const char* pString, + int Height = -1, + bool Down = false); + +// void SetScrollRanges(); + void SetScrollPosition(int x, int y); - void OnDraw(wxDC& dc); - DECLARE_EVENT_TABLE() -}; -*/ + protected: -/** - * JZEventFrame - * - * A window with Panel, Canvas, Scrollbars, Menus, - * common baseclass for TrackWin and PianoWin. - * - *Panel, menu is administered by derived class - * Funktionen - * - Settings dialog - * - Selection via Snapsel - */ +// void OnPaint(wxPaintEvent& Event); +// void OnMouseEvent(wxMouseEvent& Event); +// void OnChar(wxKeyEvent& Event); +// bool OnCharHook(wxKeyEvent& Event); +// void OnDraw(wxDC& Dc); + int y2yLine(int y, int Up = 0); + protected: + + static const int mScrollSize; + + JZSong* mpSong; + +// JZEventFrame* mpEventFrame; + + wxColor* mpGreyColor; + wxBrush* mpGreyBrush; + + int mTopInfoHeight; + int mTrackHeight; + int mLittleBit; + + +// DECLARE_EVENT_TABLE() +}; + +//***************************************************************************** +// Description: +// These are the event window inline member functions. +//***************************************************************************** +//----------------------------------------------------------------------------- +// WARNING: non-constant access. +//----------------------------------------------------------------------------- +inline +JZSong* JZEventWindow::GetSong() const +{ + return mpSong; +} + +//***************************************************************************** +// Description: +// A frame window that containes a scrolled event window. Acts as the +// common base class for JZTrackFrame and JSPianoFrame. +// +// The panel and menu are administered by derived classes. +// Functionality: +// - Settings dialog +// - Selection via Snapsel +//***************************************************************************** class JZEventFrame : public wxFrame { - public: bool OnCharHook(wxKeyEvent& event); @@ -96,7 +150,7 @@ virtual void Create(); virtual void CreateMenu(); void CreateCanvas(); -// tCanvas* Canvas; +// JZEventWindow* mpEventWindow; // Setup() wxFont* mpFont; @@ -132,7 +186,7 @@ int y2Line(int y, int up = 0); int y2yLine(int y, int up = 0); int Line2y(int line); - void LineText(wxDC *dc, int x, int y, int w, const char *str, int h = -1, bool down = FALSE); +// void LineText(wxDC *dc, int x, int y, int w, const char *str, int h = -1, bool down = false); int x2Clock(int x); int Clock2x(int clk); int x2BarClock(int x, int Next = 0); Modified: trunk/jazz/src/MouseAction.cpp =================================================================== --- trunk/jazz/src/MouseAction.cpp 2008-03-31 04:10:22 UTC (rev 378) +++ trunk/jazz/src/MouseAction.cpp 2008-03-31 04:12:45 UTC (rev 379) @@ -22,10 +22,8 @@ #include "WxWidgets.h" -//#include "config.h" #include "MouseAction.h" #include "EventWindow.h" -#include "DeprecatedStringUtils.h" using namespace std; @@ -520,42 +518,75 @@ return 1; } -// ------------------------------------------------------------------------- +//***************************************************************************** // tMouseButton - simulate a 3D button -// ------------------------------------------------------------------------- - +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- tMouseButton::tMouseButton( - JZEventFrame *win, - JZRectangle* r, - const char *down, - const char *up) + JZEventWindow* pEventWindow, + JZRectangle* pRectangle, + const char* pDownString, + const char* pUpString) + : mpEventWindow(pEventWindow), + mRectangle(*pRectangle), + mDownString(), + mUpString() { - this->win = win; - this->r = *r; - if (up == 0) - up = down; - this->down = copystring(down); - this->up = copystring(up); - wxDC* dc=new wxClientDC(win); - win->LineText(dc, r->x, r->y, r->width, (char *)down, r->height, TRUE); + if (pDownString) + { + mDownString = pDownString; + } + + if (pUpString) + { + mUpString = pUpString; + } + else + { + mUpString = mDownString; + } + + wxClientDC Dc(mpEventWindow); + + mpEventWindow->LineText( + Dc, + mRectangle.x, + mRectangle.y, + mRectangle.GetWidth(), + mDownString.c_str(), + mRectangle.GetHeight(), + true); } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- tMouseButton::~tMouseButton() { - delete [] (char *)up; // msvc is buggy! - delete [] (char *)down; } -int tMouseButton::Event(wxMouseEvent &e) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int tMouseButton::Event(wxMouseEvent& MouseEvent) { - if (e.ButtonUp()) + if (MouseEvent.ButtonUp()) { Action(); - wxDC* dc=new wxClientDC(win); - win->LineText(dc, r.x, r.y, r.width, (char *)up, r.height, false); + + wxClientDC Dc(mpEventWindow); + + mpEventWindow->LineText( + Dc, + mRectangle.x, + mRectangle.y, + mRectangle.GetWidth(), + mUpString.c_str(), + mRectangle.GetHeight(), + false); + delete this; + return 1; } return 0; } - Modified: trunk/jazz/src/MouseAction.h =================================================================== --- trunk/jazz/src/MouseAction.h 2008-03-31 04:10:22 UTC (rev 378) +++ trunk/jazz/src/MouseAction.h 2008-03-31 04:12:45 UTC (rev 379) @@ -29,6 +29,8 @@ #include "Rectangle.h" +class JZEventWindow; + enum TEMousePlayMode { eMouse, @@ -38,9 +40,12 @@ eRecordButton }; +//***************************************************************************** +//***************************************************************************** class tMouseMapper { public: + // actions // 0..2 = left/middle/right down // 3..5 = left/middle/right down + shift @@ -50,57 +55,96 @@ tMouseMapper(const int actions[12]); tMouseMapper(); - enum Button { Left, Middle, Right }; - void SetAction(int code, Button but = Left, bool shift = FALSE, bool ctrl = FALSE); - int Action(wxMouseEvent &); - void SetLeftAction(int id = 0) { left_action = id; } + enum Button + { + Left, + Middle, + Right + }; + void SetAction( + int code, + Button but = Left, + bool shift = false, + bool ctrl = false); + + int Action(wxMouseEvent&); + + void SetLeftAction(int id = 0) + { + left_action = id; + } + private: + int actions[12]; + int left_action; }; -/** -base class for mouse actions. the classes are instantiated in the mousehandler of eventwin, for example, to keep state during mouse operations, like drag and drop and so on. - -the event() finction is used to determine what to do with an incoming event(normally, if the event is a drag event call the drag function of the class, and so on) -*/ +//***************************************************************************** +// Description: +// This is a base class for mouse actions. The classes are instantiated in +// the mouse handler of the event window, for example, to keep state during +// mouse operations, like drag and drop and so on. +// The Event() function is used to determine what to do with an incoming +// event. Normally, if the event is a drag event, call the drag function of +// the class, and so on. +//***************************************************************************** class tMouseAction { public: + virtual ~tMouseAction() {} - virtual int Dragging(wxMouseEvent &) { return 0; }; - virtual int LeftDown(wxMouseEvent &) { return 0; }; - virtual int LeftUp(wxMouseEvent &) { return 0; }; - virtual int RightDown(wxMouseEvent &) { return 0; }; - virtual int RightUp(wxMouseEvent &) { return 0; }; - virtual int MiddleDown(wxMouseEvent &) { return 0; }; - virtual int MiddleUp(wxMouseEvent &) { return 0; }; - virtual int Event(wxMouseEvent &e) + virtual int Dragging(wxMouseEvent &) { return 0; } + virtual int LeftDown(wxMouseEvent &) { return 0; } + virtual int LeftUp(wxMouseEvent &) { return 0; } + virtual int RightDown(wxMouseEvent &) { return 0; } + virtual int RightUp(wxMouseEvent &) { return 0; } + virtual int MiddleDown(wxMouseEvent &) { return 0; } + virtual int MiddleUp(wxMouseEvent &) { return 0; } + virtual int Event(wxMouseEvent& MouseEvent) { - if (e.Dragging()) return Dragging(e); - else if (e.LeftDown()) return LeftDown(e); - else if (e.LeftUp()) return LeftUp(e); - else if (e.MiddleDown()) return MiddleDown(e); - else if (e.MiddleUp()) return MiddleUp(e); - else if (e.RightDown()) return RightDown(e); - else if (e.RightUp()) return RightUp(e); + if (MouseEvent.Dragging()) + { + return Dragging(MouseEvent); + } + else if (MouseEvent.LeftDown()) + { + return LeftDown(MouseEvent); + } + else if (MouseEvent.LeftUp()) + { + return LeftUp(MouseEvent); + } + else if (MouseEvent.MiddleDown()) + { + return MiddleDown(MouseEvent); + } + else if (MouseEvent.MiddleUp()) + { + return MiddleUp(MouseEvent); + } + else if (MouseEvent.RightDown()) + { + return RightDown(MouseEvent); + } + else if (MouseEvent.RightUp()) + { + return RightUp(MouseEvent); + } return 0; } }; -/** - Selection - draw a rectangle with the mouse, selecting events - - this class needs to draw in the window, thus it needs acess to the device context of the -window. This was by storing a wxCanvas pointer in wxwin168, but wxCanvas is gone in wxwin2. -on the other hand we can now draw in all windows. - - -*/ - - +//***************************************************************************** +// Description: +// Selection - draw a rectangle with the mouse, selecting events +// This class needs to draw in the window, thus it needs access to the +// device context of the window. This was by storing a wxCanvas pointer +// in wxwin168, but wxCanvas is gone in wxwin2. +//***************************************************************************** class tSelection : public tMouseAction { public: @@ -125,30 +169,31 @@ private: wxScrolledWindow* win; + // wxCanvas *Canvas; wxBrush* mpBackgroundBrush; }; +//***************************************************************************** +//***************************************************************************** class tSnapSelection : public tSelection { -protected: - int *xCoords, nxCoords; - int *yCoords, nyCoords; - int xMin, xMax, xStep, yMin, yMax, yStep; + public: + tSnapSelection(wxScrolledWindow *c); + virtual void Snap(float &x, float &y, int up); + void SetXSnap(int ny, int *cx); + void SetYSnap(int ny, int *cy); + void SetXSnap(int xMin, int xMax, int xStep); + void SetYSnap(int yMin, int yMax, int yStep); -public: - tSnapSelection(wxScrolledWindow *c); - virtual void Snap(float &x, float &y, int up); - void SetXSnap(int ny, int *cx); - void SetYSnap(int ny, int *cy); - void SetXSnap(int xMin, int xMax, int xStep); - void SetYSnap(int yMin, int yMax, int yStep); + protected: + int *xCoords, nxCoords; + int *yCoords, nyCoords; + int xMin, xMax, xStep, yMin, yMax, yStep; }; -class JZEventFrame; - - +//***************************************************************************** /** tButtonLabelInterface @@ -158,6 +203,7 @@ indicates if the text should be displayed in a depressed button or a normal button. */ +//***************************************************************************** class tButtonLabelInterface { public: @@ -172,10 +218,12 @@ }; +//***************************************************************************** /** MouseCounter - let you enter numbers with left/right mouse button */ +//***************************************************************************** class tMouseCounter : public wxTimer, public tMouseAction { int Min, Max, Delta; @@ -196,10 +244,9 @@ }; -// ------------------------------------------------------------------------- +//***************************************************************************** // tMarkDestin - mark destination of some operation -// ------------------------------------------------------------------------- - +//***************************************************************************** class tMarkDestin : public tMouseAction { wxScrolledWindow *Canvas; @@ -215,23 +262,38 @@ tMarkDestin(wxScrolledWindow *canvas, wxFrame *frame, int left); }; -// ------------------------------------------------------------------------- +//***************************************************************************** // tMouseButton - simulate a 3D button -// ------------------------------------------------------------------------- - +//***************************************************************************** class tMouseButton : public tMouseAction { public: - tMouseButton(JZEventFrame *win, JZRectangle *r, const char *down, const char *up = 0); + + tMouseButton( + JZEventWindow* pEventWindow, + JZRectangle* pRectangle, + const char* pDownString, + const char* upUpString = 0); + virtual ~tMouseButton(); - virtual int Event(wxMouseEvent &e); + + virtual int Event(wxMouseEvent& MouseEvent); + protected: - virtual void Action() {} + + virtual void Action() + { + } + private: - JZEventFrame *win; - JZRectangle r; - const char *down; - const char *up; + + JZEventWindow* mpEventWindow; + + JZRectangle mRectangle; + + wxString mDownString; + + wxString mUpString; }; #endif // !defined(JZ_MOUSEACTION_H) Modified: trunk/jazz/src/PianoWindow.cpp =================================================================== --- trunk/jazz/src/PianoWindow.cpp 2008-03-31 04:10:22 UTC (rev 378) +++ trunk/jazz/src/PianoWindow.cpp 2008-03-31 04:12:45 UTC (rev 379) @@ -223,7 +223,7 @@ Win = w; // SN++ BUG FIX: undo/redo - Win->mpSong->NewUndoBuffer(); + Win->GetSong()->NewUndoBuffer(); wxClientDC Dc(Win); @@ -336,7 +336,7 @@ Win = w; // SN++ BUG FIX: undo/redo - Win->mpSong->NewUndoBuffer(); + Win->GetSong()->NewUndoBuffer(); // wxClientDC Dc(Win); Win->PrepareDC(Dc); @@ -412,7 +412,7 @@ mpKeyOn = pEvent; // SN++ BUG FIX: undo/redo - Win->mpSong->NewUndoBuffer(); + Win->GetSong()->NewUndoBuffer(); // wxClientDC Dc(Win); Dc.SetFont(*(Win->GetFixedFont())); @@ -528,7 +528,7 @@ //***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(JZPianoWindow, wxScrolledWindow) +BEGIN_EVENT_TABLE(JZPianoWindow, JZEventWindow) EVT_SIZE(JZPianoWindow::OnSize) @@ -538,10 +538,6 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -const int JZPianoWindow::mScrollSize = 50; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- JZListen JZPianoWindow::mListen; //----------------------------------------------------------------------------- @@ -550,18 +546,14 @@ JZPianoFrame* pPianoFrame, JZSong* pSong, const wxPoint& Position, - const wxSize& Size, - long WindowStyle) - : wxScrolledWindow(pPianoFrame, wxID_ANY, Position, Size, WindowStyle), + const wxSize& Size) + : JZEventWindow(pPianoFrame, pSong, Position, Size), mpPianoFrame(pPianoFrame), - mpSong(pSong), mPlayClock(-1), mSnapCount(0), mpMouseAction(0), - mpSnapSel(0), mpTrack(0), mTrackIndex(0), - mpFilter(0), mpCtrlEdit(0), mMousePlay(play_actions), mMouseEvent(evnt_actions), @@ -601,14 +593,10 @@ { InitColors(); - mpFilter = new JZFilter(mpSong); - mpTrack = mpSong->GetTrack(mTrackIndex); mFontSize = mPianoFontSizes[1]; // Must be an entry in the array. - mpSnapSel = new tSnapSelection(this); - for (int i = 0; i < eMaxTrackCount; i++) { mFromLines[i] = 64; @@ -627,7 +615,6 @@ delete mpFont; delete mpFixedFont; delete mpDrumFont; - delete mpSnapSel; delete mpGuitarFrame; } @@ -651,22 +638,17 @@ //----------------------------------------------------------------------------- void JZPianoWindow::Setup() { - // This section is from JZEventFrame::Setup() - - int Width, Height; - wxClientDC Dc(this); Dc.SetFont(wxNullFont); delete mpFixedFont; mpFixedFont = new wxFont(12, wxSWISS, wxNORMAL, wxNORMAL); - Dc.SetFont(*mpFixedFont); - Dc.GetTextExtent("M", &Width, &Height); - mFixedFontHeight = Height; - mTopInfoHeight = mFixedFontHeight + 2 * mLittleBit; + int Width, Height; + Dc.GetTextExtent("M", &Width, &mFixedFontHeight); + delete mpFont; mpFont = new wxFont(mFontSize, wxSWISS, wxNORMAL, wxNORMAL); Dc.SetFont(*mpFont); @@ -674,8 +656,10 @@ Dc.GetTextExtent("M", &Width, &Height); mLittleBit = Width / 2; + mTopInfoHeight = mFixedFontHeight + 2 * mLittleBit; + Dc.GetTextExtent("HXWjgi", &Width, &Height); - mTrackHeight = Height + mLittleBit; + mTrackHeight = Height + 2 * mLittleBit; delete mpDrumFont; mpDrumFont = new wxFont(mFontSize + 3, wxSWISS, wxNORMAL, wxNORMAL); @@ -1118,15 +1102,6 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZPianoWindow::SetScrollPosition(int x, int y) -{ - x /= mScrollSize; - y /= mScrollSize; - Scroll(x, y); -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- int JZPianoWindow::Line2y(int Line) { return Line * mTrackHeight + mTopInfoHeight; @@ -1587,7 +1562,6 @@ // ------------------------------------------------------------------------ // Snapper // ------------------------------------------------------------------------ - void JZPianoWindow::SnapSelStop(wxMouseEvent& Event) { if (mpSnapSel->Selected) Modified: trunk/jazz/src/PianoWindow.h =================================================================== --- trunk/jazz/src/PianoWindow.h 2008-03-31 04:10:22 UTC (rev 378) +++ trunk/jazz/src/PianoWindow.h 2008-03-31 04:12:45 UTC (rev 379) @@ -23,6 +23,7 @@ #ifndef JZ_PIANOWINDOW_H #define JZ_PIANOWINDOW_H +#include "EventWindow.h" #include "MouseAction.h" #include "Track.h" #include "Globals.h" @@ -36,10 +37,8 @@ class tSnapSelection; class JZGuitarFrame; -// ------------------------------------------------------------------------- -// MousePiano -// ------------------------------------------------------------------------- - +//***************************************************************************** +//***************************************************************************** class JZListen : public wxTimer { public: @@ -63,7 +62,9 @@ JZTrack* mpTrack; }; -class JZPianoWindow : public wxScrolledWindow, public tButtonLabelInterface +//***************************************************************************** +//***************************************************************************** +class JZPianoWindow : public JZEventWindow, public tButtonLabelInterface { public: @@ -71,8 +72,7 @@ JZPianoFrame* pFrame, JZSong* pSong, const wxPoint& Position = wxDefaultPosition, - const wxSize& Size = wxDefaultSize, - long WindowStyle = 0); + const wxSize& Size = wxDefaultSize); virtual ~JZPianoWindow(); @@ -201,8 +201,6 @@ public: - JZSong* mpSong; - int mFromLines[eMaxTrackCount]; int mPlayClock; @@ -220,12 +218,8 @@ tEventArray mPasteBuffer; - tSnapSelection* mpSnapSel; - public: - void SetScrollPosition(int x, int y); - void SetScrollRanges(const int& x, const int& y); void DrawEvent( @@ -313,16 +307,12 @@ private: - static const int mScrollSize; - static JZListen mListen; JZTrack* mpTrack; int mTrackIndex; - JZFilter* mpFilter; - tCtrlEditBase* mpCtrlEdit; tMouseMapper mMousePlay; Modified: trunk/jazz/src/Rhythm.cpp =================================================================== --- trunk/jazz/src/Rhythm.cpp 2008-03-31 04:10:22 UTC (rev 378) +++ trunk/jazz/src/Rhythm.cpp 2008-03-31 04:12:45 UTC (rev 379) @@ -492,7 +492,7 @@ //#include "Bitmaps/rrggen.xpm" //#include "Bitmaps/help.xpm" -tRhythmWin::tRhythmWin(JZEventFrame *e, JZSong *s) +tRhythmWin::tRhythmWin(JZEventWindow* pEventWindow, JZSong* pSong) : wxFrame( 0, wxID_ANY, @@ -501,11 +501,11 @@ gpConfig->GetValue(C_RhythmXpos), gpConfig->GetValue(C_RhythmYpos)), wxSize(640, 580)), - edit(0) + edit(0), + mpEventWindow(pEventWindow), + mpSong(pSong) { #ifdef OBSOLETE - event_win = e; - song = s; in_create = 1; n_instruments = 0; act_instrument = -1; @@ -1022,10 +1022,14 @@ void tRhythmWin::GenRhythm() { - if (!event_win->EventsSelected("please mark destination track in trackwin")) + if ( + !mpEventWindow->EventsSelected( + "Please mark the destination track in the track window")) + { return; + } - JZFilter* pFilter = event_win->mpFilter; + JZFilter* pFilter = mpEventWindow->mpFilter; if (pFilter->FromTrack != pFilter->ToTrack) { @@ -1035,8 +1039,8 @@ long fr_clock = pFilter->FromClock; long to_clock = pFilter->ToClock; - JZTrack *track = song->GetTrack(pFilter->FromTrack); - song->NewUndoBuffer(); + JZTrack *track = mpSong->GetTrack(pFilter->FromTrack); + mpSong->NewUndoBuffer(); // remove selection //if (wxMessageBox("Erase destination before generating?", "Replace", wxYES_NO) == wxYES) @@ -1048,7 +1052,7 @@ for (int i = 0; i < n_instruments; i++) instruments[i]->GenInit(fr_clock); - JZBarInfo bar_info(song); + JZBarInfo bar_info(mpSong); bar_info.SetClock(fr_clock); // for (int i = 0; i < n_instruments; i++) @@ -1063,7 +1067,7 @@ track->Cleanup(); - event_win->Redraw(); + mpEventWindow->Refresh(); } Modified: trunk/jazz/src/Rhythm.h =================================================================== --- trunk/jazz/src/Rhythm.h 2008-03-31 04:10:22 UTC (rev 378) +++ trunk/jazz/src/Rhythm.h 2008-03-31 04:12:45 UTC (rev 379) @@ -30,7 +30,7 @@ #include <iostream> class JZTrack; -class JZEventFrame; +class JZEventWindow; class JZSong; class JZBarInfo; @@ -113,6 +113,24 @@ class tRhythmWin : public wxFrame { + public: + + tRhythmWin(JZEventWindow* pEventWindow, JZSong* pSong); + + virtual ~tRhythmWin(); + + virtual void OnMenuCommand(int id); + + virtual void OnSize(int w, int h); + + void OnPaint(); + + void GenRhythm(); + + bool OnClose(); + + private: + friend std::ostream& operator << (std::ostream& os, tRhythmWin const &a); friend std::istream& operator >> (std::istream& is, tRhythmWin &a); @@ -164,8 +182,8 @@ void AddInstrument(tRhythm *r); void DelInstrument(); - JZEventFrame *event_win; - JZSong *song; + JZEventWindow* mpEventWindow; + JZSong* mpSong; void RndEnable(); @@ -178,15 +196,6 @@ void DownInstrument(); void InitInstrumentList(); - public: - - virtual void OnMenuCommand(int id); - virtual void OnSize(int w, int h); - tRhythmWin(JZEventFrame *parent, JZSong *song); - virtual ~tRhythmWin(); - void OnPaint(); - void GenRhythm(); - bool OnClose(); }; extern tRhythmWin *rhythm_win; Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2008-03-31 04:10:22 UTC (rev 378) +++ trunk/jazz/src/TrackWindow.cpp 2008-03-31 04:12:45 UTC (rev 379) @@ -40,42 +40,32 @@ //***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(JZTrackWindow, wxScrolledWindow) +BEGIN_EVENT_TABLE(JZTrackWindow, JZEventWindow) + EVT_SIZE(JZTrackWindow::OnSize) + EVT_ERASE_BACKGROUND(JZTrackWindow::OnEraseBackground) + + EVT_LEFT_DOWN(JZTrackWindow::OnLeftButtonDown) + EVT_LEFT_UP(JZTrackWindow::OnLeftButtonUp) + EVT_RIGHT_UP(JZTrackWindow::OnRightButtonUp) + END_EVENT_TABLE() //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -const int JZTrackWindow::mScrollSize = 50; - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- JZTrackWindow::JZTrackWindow( wxFrame* pParent, JZSong* pSong, const wxPoint& Position, const wxSize& Size) - : wxScrolledWindow( - pParent, - wxID_ANY, - Position, - Size, - wxHSCROLL | wxVSCROLL | wxNO_FULL_REPAINT_ON_RESIZE), - mpFilter(0), - mpSnapSel(0), - mpSong(pSong), - mpGreyColor(0), - mpGreyBrush(0), - mTrackHeight(10), - mTopInfoHeight(40), + : JZEventWindow(pParent, pSong, Position, Size), mLeftInfoWidth(100), mClocksPerPixel(36), mPlayClock(-1), mUseColors(true), - mLittleBit(2), mEventsX(), mEventsY(), mEventsWidth(), @@ -107,18 +97,6 @@ mDrawing(false), mpFrameBuffer(0) { -#ifdef __WXMSW__ - mpGreyColor = new wxColor(192, 192, 192); -#else - mpGreyColor = new wxColor(220, 220, 220); -#endif - - mpGreyBrush = new wxBrush(*mpGreyColor, wxSOLID); - - mpSnapSel = new tSnapSelection(this); - - mpFilter = new JZFilter(mpSong); - SetBackgroundColour(*wxWHITE); mpFrameBuffer = new wxBitmap; @@ -128,12 +106,8 @@ //----------------------------------------------------------------------------- JZTrackWindow::~JZTrackWindow() { - delete mpGreyColor; - delete mpGreyBrush; delete mpFixedFont; delete mpFont; - delete mpSnapSel; - delete mpFilter; delete mpFrameBuffer; } @@ -159,11 +133,11 @@ Dc.GetTextExtent("M", &Width, &Height); mLittleBit = Width / 2; + mTopInfoHeight = mFixedFontHeight + 2 * mLittleBit; + Dc.GetTextExtent("HXWjgi", &Width, &Height); mTrackHeight = Height + 2 * mLittleBit; - mTopInfoHeight = mFixedFontHeight + 2 * mLittleBit; - Dc.GetTextExtent("999", &Width, &Height); mNumberWidth = Width + 2 * mLittleBit; @@ -284,6 +258,20 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +void JZTrackWindow::OnLeftButtonDown(wxMouseEvent& Event) +{ + wxPoint Point = Event.GetPosition(); + + if ( + Point.x >= mEventsX && Point.x < mEventsX + mEventsWidth && + Point.y >= mEventsY && Point.y < mEventsY + mEventsHeight) + { + SnapSelectionStart(Event); + } +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void JZTrackWindow::OnLeftButtonUp(wxMouseEvent& Event) { wxPoint Point = Event.GetPosition(); @@ -353,6 +341,12 @@ { ToggleTrackState(Point); } + else if ( + Point.x >= mEventsX && Point.x < mEventsX + mEventsWidth && + Point.y >= mEventsY && Point.y < mEventsY + mEventsHeight) + { + SnapSelectionStop(Event); + } } //----------------------------------------------------------------------------- @@ -1098,20 +1092,6 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZTrackWindow::y2yLine(int y, int Up) -{ - if (Up) - { - y += mTrackHeight; - } - y -= mTopInfoHeight; - y -= y % mTrackHeight; - y += mTopInfoHeight; - return y; -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- int JZTrackWindow::x2Clock(int x) { return (x - mEventsX) * mClocksPerPixel + mFromClock; @@ -1191,15 +1171,6 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZTrackWindow::SetScrollPosition(int x, int y) -{ - x /= mScrollSize; - y /= mScrollSize; - Scroll(x, y); -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- void JZTrackWindow::MousePlay(wxMouseEvent& Event, TEMousePlayMode Mode) { if (Mode == eMouse && !Event.ButtonDown()) @@ -1367,3 +1338,30 @@ } } } + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZTrackWindow::SnapSelectionStart(wxMouseEvent& Event) +{ + mpSnapSel->SetXSnap(mBarCount, mBarX); + mpSnapSel->SetYSnap( + TrackIndex2y(mFromLine), + mEventsY + mEventsHeight, + mTrackHeight); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZTrackWindow::SnapSelectionStop(wxMouseEvent& Event) +{ + if (mpSnapSel->Selected) + { + mpFilter->FromTrack = y2TrackIndex(mpSnapSel->r.y); + mpFilter->ToTrack = y2TrackIndex( + mpSnapSel->r.y + mpSnapSel->r.GetHeight() - 1); + mpFilter->FromClock = x2BarClock(mpSnapSel->r.x + 1); + mpFilter->ToClock = x2BarClock( + mpSnapSel->r.x + mpSnapSel->r.GetWidth() + 1); +// NextWin->NewPosition(mpFilter->FromTrack, mpFilter->FromClock); + } +} Modified: trunk/jazz/src/TrackWindow.h =================================================================== --- trunk/jazz/src/TrackWindow.h 2008-03-31 04:10:22 UTC (rev 378) +++ trunk/jazz/src/TrackWindow.h 2008-03-31 04:12:45 UTC (rev 379) @@ -23,6 +23,7 @@ #ifndef JZ_TRACKWINDOW_H #define JZ_TRACKWINDOW_H +#include "EventWindow.h" #include "MouseAction.h" #include "Rectangle.h" @@ -50,14 +51,12 @@ eNmModes }; -class JZTrackWindow : public wxScrolledWindow +//***************************************************************************** +//***************************************************************************** +class JZTrackWindow : public JZEventWindow { public: - JZFilter* mpFilter; - - tSnapSelection* mpSnapSel; - enum TELimits { eMaxBars = 200 @@ -85,8 +84,6 @@ void SetScrollRanges(const int& x, const int& y); - void SetScrollPosition(int x, int y); - private: void GetVirtualEventSize(int& Width, int& Height) const; @@ -95,6 +92,8 @@ void OnEraseBackground(wxEraseEvent& Event); + void OnLeftButtonDown(wxMouseEvent& Event); + void OnLeftButtonUp(wxMouseEvent& Event); void OnRightButtonUp(wxMouseEvent& Event); @@ -132,6 +131,10 @@ const char* GetNumberString() const; + void SnapSelectionStart(wxMouseEvent& Event); + + void SnapSelectionStop(wxMouseEvent& Event); + // Was the VLine macro void DrawVerticalLine(wxDC& Dc, int XPosition) const; @@ -154,24 +157,12 @@ int x2BarClock(int x, int Next = 0); - int y2yLine(int y, int Up = 0); - private: - static const int mScrollSize; - - JZSong* mpSong; - - wxColor* mpGreyColor; - wxBrush* mpGreyBrush; - - int mTrackHeight; - int mTopInfoHeight; int mLeftInfoWidth; int mClocksPerPixel; int mPlayClock; bool mUseColors; - int mLittleBit; int mEventsX, mEventsY, mEventsWidth, mEventsHeight; int mScrolledX, mScrolledY; int mCanvasWidth, mCanvasHeight; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |