From: <pst...@us...> - 2009-02-16 20:00:10
|
Revision: 699 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=699&view=rev Author: pstieber Date: 2009-02-16 19:59:58 +0000 (Mon, 16 Feb 2009) Log Message: ----------- 1. Fixed piano key mouse handling. The main problem was an improperly named virtual function in tMousePlay. I changed the the virtual function name to ProcessMouseEvent, and changed wxMouseEvent object instance names to MouseEvent. 2. Changed tMousePlay -> JZMousePlay and changed the way the class destroys itself. This is causing a leak, but it is better than the crash that was caused by clicking the mouse below the bass piano keys. 3. Moved the mpMouseAction data member from the piano window to the event window base class. Gave the event window base class a mouse handler. I'm still not confident about this design. 4. Created a virtual SnalSelStart in the event window. Modified Paths: -------------- trunk/jazz/src/EventFrame.cpp trunk/jazz/src/EventFrame.h trunk/jazz/src/EventWindow.cpp trunk/jazz/src/EventWindow.h trunk/jazz/src/GuitarWindow.cpp trunk/jazz/src/GuitarWindow.h trunk/jazz/src/Harmony.cpp trunk/jazz/src/Knob.cpp trunk/jazz/src/Knob.h trunk/jazz/src/MouseAction.cpp trunk/jazz/src/MouseAction.h trunk/jazz/src/PianoFrame.h trunk/jazz/src/PianoWindow.cpp trunk/jazz/src/PianoWindow.h trunk/jazz/src/Random.cpp trunk/jazz/src/Random.h trunk/jazz/src/SampleWindow.cpp trunk/jazz/src/TrackFrame.cpp trunk/jazz/src/TrackFrame.h trunk/jazz/src/TrackWindow.cpp trunk/jazz/src/TrackWindow.h Modified: trunk/jazz/src/EventFrame.cpp =================================================================== --- trunk/jazz/src/EventFrame.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/EventFrame.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -81,20 +81,21 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZEventFrame::SnapSelStart(wxMouseEvent& MouseEvent) -{ -} +//void JZEventFrame::SnapSelStart(wxMouseEvent& MouseEvent) +//{ +//} //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZEventFrame::SnapSelStop(wxMouseEvent& MouseEvent) -{ -} +//void JZEventFrame::SnapSelStop(wxMouseEvent& MouseEvent) +//{ +//} //----------------------------------------------------------------------------- // seems to handle the "selection" rectangle. normally called from the base // class onmouseevent handler //----------------------------------------------------------------------------- +/* int JZEventFrame::OnMouseEvent(wxMouseEvent& MouseEvent) { // cout << "JZEventFrame::OnMouseEvent" << endl; @@ -119,7 +120,7 @@ { Refresh(); //redraw the whole window instead(inefficient, we should rather invalidate a rect) } - SnapSel->Event(MouseEvent); + SnapSel->ProcessMouseEvent(MouseEvent); MouseAction = SnapSel; } } @@ -129,7 +130,7 @@ { // MouseAction active - if (MouseAction->Event(MouseEvent)) + if (MouseAction->ProcessMouseEvent(MouseEvent)) { // MouseAction finished @@ -146,6 +147,7 @@ } return 0; } +*/ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- Modified: trunk/jazz/src/EventFrame.h =================================================================== --- trunk/jazz/src/EventFrame.h 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/EventFrame.h 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 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 @@ -59,11 +59,11 @@ virtual void SetEventWindow(JZEventWindow* pEventWindow); - virtual void SnapSelStart(wxMouseEvent &e); - virtual void SnapSelStop(wxMouseEvent &e); +// virtual void SnapSelStart(wxMouseEvent &e); +// virtual void SnapSelStop(wxMouseEvent &e); // Events - virtual int OnMouseEvent(wxMouseEvent& Event); +// virtual int OnMouseEvent(wxMouseEvent& Event); virtual bool OnKeyEvent(wxKeyEvent& Event); // true = processed by eventwin virtual bool OnClose(); Modified: trunk/jazz/src/EventWindow.cpp =================================================================== --- trunk/jazz/src/EventWindow.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/EventWindow.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 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 @@ -44,8 +44,9 @@ //***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//BEGIN_EVENT_TABLE(JZEventWindow, wxScrolledWindow) -//END_EVENT_TABLE() +BEGIN_EVENT_TABLE(JZEventWindow, wxWindow) + EVT_MOUSE_EVENTS(JZEventWindow::OnMouseEvent) +END_EVENT_TABLE() //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- @@ -62,6 +63,7 @@ wxHSCROLL | wxVSCROLL | wxNO_FULL_REPAINT_ON_RESIZE), mpSnapSel(0), mpFilter(0), + mpMouseAction(0), mpSong(pSong), mpGreyColor(0), mpGreyBrush(0), @@ -401,13 +403,72 @@ } //----------------------------------------------------------------------------- -// This mouse handler delegates to the subclased event window. //----------------------------------------------------------------------------- -//void JZEventWindow::OnMouseEvent(wxMouseEvent& MouseEvent) -//{ -// EventWin->OnMouseEvent(MouseEvent); -//} +void JZEventWindow::SnapSelStart(wxMouseEvent& MouseEvent) +{ +} +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventWindow::SnapSelStop(wxMouseEvent& MouseEvent) +{ +} + +//----------------------------------------------------------------------------- +// Descriptions: +// This mouse handler delegates to the subclassed event window. +//----------------------------------------------------------------------------- +void JZEventWindow::OnMouseEvent(wxMouseEvent& MouseEvent) +{ + if (!mpMouseAction) + { + // create mpSnapSel? + + int x, y; + MouseEvent.GetPosition(&x, &y); + if ( + mEventsX < x && x < mEventsX + mEventsWidth && + mEventsY < y && y < mEventsY + mEventsHeight) + { + if (MouseEvent.LeftDown()) + { + { + SnapSelStart(MouseEvent); + +// if (mpSnapSel->IsSelected()) +// { + // Redraw the whole window instead (inefficient, we should rather + // invalidate a rect). + Refresh(); +// } + mpSnapSel->ProcessMouseEvent(MouseEvent); + mpMouseAction = mpSnapSel; + } + } + } + } + else + { + // mpMouseAction active + + if (mpMouseAction->ProcessMouseEvent(MouseEvent)) + { + // mpMouseAction finished + + if (mpMouseAction == mpSnapSel) + { + SnapSelStop(MouseEvent); + + // inefficient, invalidate rect first instead. + Refresh(); + } + + mpMouseAction = 0; + } + } +} + + // 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. Modified: trunk/jazz/src/EventWindow.h =================================================================== --- trunk/jazz/src/EventWindow.h 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/EventWindow.h 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 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 @@ -26,6 +26,7 @@ #include <wx/window.h> class JZFilter; +class tMouseAction; class JZSnapSelection; class JZSong; class wxDialog; @@ -83,10 +84,12 @@ protected: - virtual void SnapSelStop(wxMouseEvent& Event) - { - } + int SnapClock(int Clock, bool Up); + virtual void SnapSelStart(wxMouseEvent& MouseEvent); + + virtual void SnapSelStop(wxMouseEvent& MouseEvent); + void DrawVerticalLine(wxDC& Dc, int XPosition) const; void DrawHorizontalLine(wxDC& Dc, int YPosition) const; @@ -99,12 +102,16 @@ int y2yLine(int y, int Up = 0); + void OnMouseEvent(wxMouseEvent& MouseEvent); + public: JZSnapSelection* mpSnapSel; JZFilter* mpFilter; + tMouseAction* mpMouseAction; + protected: JZSong* mpSong; @@ -128,7 +135,7 @@ // Settings-Dialog wxDialog* mpSettingsDialog; -// DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() }; //***************************************************************************** Modified: trunk/jazz/src/GuitarWindow.cpp =================================================================== --- trunk/jazz/src/GuitarWindow.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/GuitarWindow.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 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 @@ -341,12 +341,12 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZGuitarWindow::OnMouseMove(wxMouseEvent& Event) +void JZGuitarWindow::OnMouseMove(wxMouseEvent& MouseEvent) { wxClientDC Dc(this); PrepareDC(Dc); - wxPoint Position = Event.GetPosition(); + wxPoint Position = MouseEvent.GetPosition(); int x = Dc.DeviceToLogicalX(Position.x); int y = Dc.DeviceToLogicalY(Position.y); Modified: trunk/jazz/src/GuitarWindow.h =================================================================== --- trunk/jazz/src/GuitarWindow.h 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/GuitarWindow.h 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 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 @@ -76,7 +76,7 @@ void OnPaint(wxPaintEvent& Event); - void OnMouseMove(wxMouseEvent& Event); + void OnMouseMove(wxMouseEvent& MouseEvent); private: Modified: trunk/jazz/src/Harmony.cpp =================================================================== --- trunk/jazz/src/Harmony.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/Harmony.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 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 Modified: trunk/jazz/src/Knob.cpp =================================================================== --- trunk/jazz/src/Knob.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/Knob.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -1,7 +1,7 @@ //***************************************************************************** // The JAZZ++ Midi Sequencer // -// Copyright (C) 2008 Peter J. Stieber +// Copyright (C) 2008-2009 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 @@ -317,11 +317,11 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZKnob::OnLeftButtonDown(wxMouseEvent& Event) +void JZKnob::OnLeftButtonDown(wxMouseEvent& MouseEvent) { SetFocus(); - mLastPoint = Event.GetPosition(); + mLastPoint = MouseEvent.GetPosition(); SetCursor(wxCursor(wxCURSOR_SIZENS)); @@ -332,18 +332,18 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZKnob::OnRightButtonDown(wxMouseEvent& Event) +void JZKnob::OnRightButtonDown(wxMouseEvent& MouseEvent) { SetFocus(); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZKnob::OnMouseMove(wxMouseEvent& Event) +void JZKnob::OnMouseMove(wxMouseEvent& MouseEvent) { if (mDragging) { - wxPoint Point = Event.GetPosition(); + wxPoint Point = MouseEvent.GetPosition(); int Delta = (mLastPoint.y - Point.y) / mSensitivity; @@ -361,7 +361,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZKnob::OnLeftButtonUp(wxMouseEvent& Event) +void JZKnob::OnLeftButtonUp(wxMouseEvent& MouseEvent) { if (HasCapture()) { @@ -372,7 +372,7 @@ mDragging = false; - wxPoint Point = Event.GetPosition(); + wxPoint Point = MouseEvent.GetPosition(); int Delta = (mLastPoint.y - Point.y) / mSensitivity; if (Delta) @@ -383,23 +383,23 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZKnob::OnLeftButtonDoubleClick(wxMouseEvent& Event) +void JZKnob::OnLeftButtonDoubleClick(wxMouseEvent& MouseEvent) { SetValueWithEvent(GetValue() + 1); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZKnob::OnRightButtonDoubleClick(wxMouseEvent& Event) +void JZKnob::OnRightButtonDoubleClick(wxMouseEvent& MouseEvent) { SetValueWithEvent(GetValue() - 1); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZKnob::OnMouseWheel(wxMouseEvent& Event) +void JZKnob::OnMouseWheel(wxMouseEvent& MouseEvent) { - int WheelRotation = Event.GetWheelRotation(); + int WheelRotation = MouseEvent.GetWheelRotation(); if (WheelRotation < 0) { Modified: trunk/jazz/src/Knob.h =================================================================== --- trunk/jazz/src/Knob.h 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/Knob.h 2009-02-16 19:59:58 UTC (rev 699) @@ -1,7 +1,7 @@ //***************************************************************************** // The JAZZ++ Midi Sequencer // -// Copyright (C) 2008 Peter J. Stieber +// Copyright (C) 2008-2009 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 @@ -148,19 +148,19 @@ void OnPaint(wxPaintEvent& Event); - void OnLeftButtonDown(wxMouseEvent& Event); + void OnLeftButtonDown(wxMouseEvent& MouseEvent); - void OnRightButtonDown(wxMouseEvent& Event); + void OnRightButtonDown(wxMouseEvent& MouseEvent); - void OnMouseMove(wxMouseEvent& Event); + void OnMouseMove(wxMouseEvent& MouseEvent); - void OnLeftButtonUp(wxMouseEvent& Event); + void OnLeftButtonUp(wxMouseEvent& MouseEvent); - void OnLeftButtonDoubleClick(wxMouseEvent& Event); + void OnLeftButtonDoubleClick(wxMouseEvent& MouseEvent); - void OnRightButtonDoubleClick(wxMouseEvent& Event); + void OnRightButtonDoubleClick(wxMouseEvent& MouseEvent); - void OnMouseWheel(wxMouseEvent& Event); + void OnMouseWheel(wxMouseEvent& MouseEvent); private: Modified: trunk/jazz/src/MouseAction.cpp =================================================================== --- trunk/jazz/src/MouseAction.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/MouseAction.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 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 @@ -69,37 +69,37 @@ actions[i] = code; } -int tMouseMapper::Action(wxMouseEvent& Event) +int tMouseMapper::Action(wxMouseEvent& MouseEvent) { - if (!Event.ButtonDown()) + if (!MouseEvent.ButtonDown()) { return 0; } if ( left_action > 0 && - Event.LeftDown() && - !Event.ShiftDown() && - !Event.ControlDown()) + MouseEvent.LeftDown() && + !MouseEvent.ShiftDown() && + !MouseEvent.ControlDown()) { return left_action; } int i = 0; // left down - if (Event.MiddleDown()) + if (MouseEvent.MiddleDown()) { i = 1; } - else if (Event.RightDown()) + else if (MouseEvent.RightDown()) { i = 2; } - if (Event.ShiftDown()) + if (MouseEvent.ShiftDown()) { i += 3; } - if (Event.ControlDown()) + if (MouseEvent.ControlDown()) { i += 6; } @@ -132,42 +132,42 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZSelection::Event(wxMouseEvent& Event) +int JZSelection::ProcessMouseEvent(wxMouseEvent& MouseEvent) { - if (Event.ButtonDown()) + if (MouseEvent.ButtonDown()) { - return ButtonDown(Event); + return ButtonDown(MouseEvent); } - else if (Event.ButtonUp()) + else if (MouseEvent.ButtonUp()) { - return ButtonUp(Event); + return ButtonUp(MouseEvent); } - else if (Event.Dragging()) + else if (MouseEvent.Dragging()) { - return Dragging(Event); + return Dragging(MouseEvent); } return 0; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZSelection::ButtonDown(wxMouseEvent& Event) +int JZSelection::ButtonDown(wxMouseEvent& MouseEvent) { if (!mActive) { mActive = true; - if (mSelected && Event.ShiftDown()) + if (mSelected && MouseEvent.ShiftDown()) { // Continue selection JZRectangle Rectangle = mRectangle; Rectangle.SetNormal(); - Dragging(Event); + Dragging(MouseEvent); } else { mSelected = false; - int x = Event.GetX(); - int y = Event.GetY(); + int x = MouseEvent.GetX(); + int y = MouseEvent.GetY(); Snap(x, y, 0); mRectangle.x = x; mRectangle.y = y; @@ -180,17 +180,17 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZSelection::Dragging(wxMouseEvent& Event) +int JZSelection::Dragging(wxMouseEvent& MouseEvent) { if (!mActive) { - ButtonDown(Event); + ButtonDown(MouseEvent); } if (mActive) { - int x = Event.GetX(); - int y = Event.GetY(); + int x = MouseEvent.GetX(); + int y = MouseEvent.GetY(); if (x < 0) { x = 0; @@ -210,7 +210,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZSelection::ButtonUp(wxMouseEvent& Event) +int JZSelection::ButtonUp(wxMouseEvent& MouseEvent) { if (mActive) { @@ -461,9 +461,9 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tMouseCounter::LeftDown(wxMouseEvent& Event) +int tMouseCounter::LeftDown(wxMouseEvent& MouseEvent) { - Delta = Event.ShiftDown() ? 10 : 1; + Delta = MouseEvent.ShiftDown() ? 10 : 1; Start(Timeout); if (Wait) { @@ -476,7 +476,9 @@ return 0; } -int tMouseCounter::LeftUp(wxMouseEvent& Event) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int tMouseCounter::LeftUp(wxMouseEvent& MouseEvent) { Stop(); ShowValue(FALSE); @@ -485,9 +487,9 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tMouseCounter::RightDown(wxMouseEvent& Event) +int tMouseCounter::RightDown(wxMouseEvent& MouseEvent) { - Delta = Event.ShiftDown() ? -10 : -1; + Delta = MouseEvent.ShiftDown() ? -10 : -1; Start(Timeout); if (Wait) { @@ -503,7 +505,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tMouseCounter::RightUp(wxMouseEvent& Event) +int tMouseCounter::RightUp(wxMouseEvent& MouseEvent) { Stop(); ShowValue(FALSE); @@ -556,7 +558,7 @@ //Frame->SetStatusText("Click Destination point"); } -int tMarkDestin::ButtonDown(wxMouseEvent& Event) +int tMarkDestin::ButtonDown(wxMouseEvent& MouseEvent) { wxCursor c = wxCursor(wxCURSOR_ARROW); Canvas->SetCursor(c); @@ -564,7 +566,7 @@ //converts physical coords to logical(scrolled) coords wxClientDC* scrolledDC=new wxClientDC(Canvas); Canvas->PrepareDC(*scrolledDC); - wxPoint point = Event.GetLogicalPosition(*scrolledDC); + wxPoint point = MouseEvent.GetLogicalPosition(*scrolledDC); delete scrolledDC; x=point.x; @@ -573,17 +575,17 @@ return 1; } -int tMarkDestin::RightDown(wxMouseEvent& Event) +int tMarkDestin::RightDown(wxMouseEvent& MouseEvent) { - ButtonDown(Event); + ButtonDown(MouseEvent); Aborted = 1; //Frame->SetStatusText("Operation aborted"); return 1; } -int tMarkDestin::LeftDown(wxMouseEvent& Event) +int tMarkDestin::LeftDown(wxMouseEvent& MouseEvent) { - ButtonDown(Event); + ButtonDown(MouseEvent); Aborted = 0; //Frame->SetStatusText(""); return 1; @@ -638,7 +640,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tMouseButton::Event(wxMouseEvent& MouseEvent) +int tMouseButton::ProcessMouseEvent(wxMouseEvent& MouseEvent) { if (MouseEvent.ButtonUp()) { Modified: trunk/jazz/src/MouseAction.h =================================================================== --- trunk/jazz/src/MouseAction.h 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/MouseAction.h 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 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 @@ -55,6 +55,7 @@ // 9..11 = left/middle/right down + ctrl + shift tMouseMapper(const int actions[12]); + tMouseMapper(); enum Button @@ -70,7 +71,7 @@ bool shift = false, bool ctrl = false); - int Action(wxMouseEvent&); + int Action(wxMouseEvent& MouseEvent); void SetLeftAction(int id = 0) { @@ -89,23 +90,23 @@ // 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. +// The ProcessMouseEvent() 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& MouseEvent) + virtual ~tMouseAction() {} + virtual int Dragging(wxMouseEvent& MouseEvent) { return 0; } + virtual int LeftDown(wxMouseEvent& MouseEvent) { return 0; } + virtual int LeftUp(wxMouseEvent& MouseEvent) { return 0; } + virtual int RightDown(wxMouseEvent& MouseEvent) { return 0; } + virtual int RightUp(wxMouseEvent& MouseEvent) { return 0; } + virtual int MiddleDown(wxMouseEvent& MouseEvent) { return 0; } + virtual int MiddleUp(wxMouseEvent& MouseEvent) { return 0; } + virtual int ProcessMouseEvent(wxMouseEvent& MouseEvent) { if (MouseEvent.Dragging()) { @@ -182,13 +183,13 @@ { } - virtual int Dragging(wxMouseEvent& Event); + virtual int Dragging(wxMouseEvent& MouseEvent); - virtual int Event(wxMouseEvent& Event); + virtual int ProcessMouseEvent(wxMouseEvent& MouseEvent); - virtual int ButtonDown(wxMouseEvent& Event); + virtual int ButtonDown(wxMouseEvent& MouseEvent); - virtual int ButtonUp(wxMouseEvent& Event); + virtual int ButtonUp(wxMouseEvent& MouseEvent); virtual void Draw(wxDC& Dc, int ScrolledX, int ScrolledY); @@ -313,10 +314,10 @@ int Wait; // don't inc/dec at Init tButtonLabelInterface *win; - virtual int LeftDown(wxMouseEvent &); - virtual int LeftUp(wxMouseEvent &); - virtual int RightDown(wxMouseEvent &); - virtual int RightUp(wxMouseEvent &); + virtual int LeftDown(wxMouseEvent& MouseEvent); + virtual int LeftUp(wxMouseEvent& MouseEvent); + virtual int RightDown(wxMouseEvent& MouseEvent); + virtual int RightUp(wxMouseEvent& MouseEvent); virtual void Notify(); virtual void ShowValue(bool down); }; @@ -327,17 +328,18 @@ //***************************************************************************** class tMarkDestin : public tMouseAction { - wxWindow *Canvas; - wxFrame *Frame; - int ButtonDown(wxMouseEvent &); + public: + int Aborted; + float x, y; -public: - int Aborted; - float x, y; + virtual int LeftDown(wxMouseEvent& MouseEvent); + virtual int RightDown(wxMouseEvent& MouseEvent); + tMarkDestin(wxWindow* canvas, wxFrame* frame, int left); - virtual int LeftDown(wxMouseEvent &); - virtual int RightDown(wxMouseEvent &); - tMarkDestin(wxWindow *canvas, wxFrame *frame, int left); + private: + wxWindow *Canvas; + wxFrame *Frame; + int ButtonDown(wxMouseEvent& MouseEvent); }; //***************************************************************************** @@ -355,7 +357,7 @@ virtual ~tMouseButton(); - virtual int Event(wxMouseEvent& MouseEvent); + virtual int ProcessMouseEvent(wxMouseEvent& MouseEvent); protected: Modified: trunk/jazz/src/PianoFrame.h =================================================================== --- trunk/jazz/src/PianoFrame.h 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/PianoFrame.h 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 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 @@ -76,7 +76,7 @@ int mTrackIndex; JZTrack* Track; - void MouseCutPaste(wxMouseEvent &e, bool cut); + void MouseCutPaste(wxMouseEvent& MouseEvent, bool cut); bool OnClose(); Modified: trunk/jazz/src/PianoWindow.cpp =================================================================== --- trunk/jazz/src/PianoWindow.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/PianoWindow.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 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 @@ -93,15 +93,16 @@ //***************************************************************************** // Description: -// tMousePlay - Click in pianoroll +// JZMousePlay - Click in pianoroll //***************************************************************************** -class tMousePlay : public tMouseAction +class JZMousePlay : public tMouseAction { public: - tMousePlay(JZPianoWindow* pPianoWindow, wxMouseEvent& Event); - int ProcessEvent(wxMouseEvent& Event); + JZMousePlay(JZPianoWindow* pPianoWindow); + virtual int ProcessMouseEvent(wxMouseEvent& MouseEvent); + private: int mPitch, mVeloc, mChannel; @@ -110,7 +111,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -tMousePlay::tMousePlay(JZPianoWindow* pPianoWindow, wxMouseEvent& Event) +JZMousePlay::JZMousePlay(JZPianoWindow* pPianoWindow) : mPitch(0), mVeloc(-1), mChannel(-1), @@ -118,39 +119,37 @@ { mChannel = mpPianoWindow->GetTrack()->Channel ? mpPianoWindow->GetTrack()->Channel - 1 : 0; - - ProcessEvent(Event); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tMousePlay::ProcessEvent(wxMouseEvent& Event) +int JZMousePlay::ProcessMouseEvent(wxMouseEvent& MouseEvent) { int x, y; - Event.GetPosition(&x, &y); + MouseEvent.GetPosition(&x, &y); int OldPitch = mPitch; - if (Event.LeftDown()) + if (MouseEvent.LeftDown()) { mPitch = mpPianoWindow->y2Pitch(y); mVeloc = 64; } - else if (Event.MiddleDown()) + else if (MouseEvent.MiddleDown()) { mPitch = mpPianoWindow->y2Pitch(y); mVeloc = 80; } - else if (Event.RightDown()) + else if (MouseEvent.RightDown()) { mPitch = mpPianoWindow->y2Pitch(y); mVeloc = 110; } - else if (Event.ButtonUp()) + else if (MouseEvent.ButtonUp()) { mPitch = 0; } - else if (Event.Dragging()) + else if (MouseEvent.Dragging()) { mPitch = mpPianoWindow->y2Pitch(y); } @@ -170,23 +169,21 @@ { if (OldPitch && OldPitch != mPitch) { - tKeyOff of(0, mChannel, OldPitch); - gpMidiPlayer->OutNow(mpPianoWindow->GetTrack(), &of); + tKeyOff KeyOff(0, mChannel, OldPitch); + gpMidiPlayer->OutNow(mpPianoWindow->GetTrack(), &KeyOff); OldPitch = 0; } if (mPitch && mPitch != OldPitch) { - tKeyOn on(0, mChannel, mPitch, mVeloc); - gpMidiPlayer->OutNow(mpPianoWindow->GetTrack(), &on); + tKeyOn KeyOn(0, mChannel, mPitch, mVeloc); + gpMidiPlayer->OutNow(mpPianoWindow->GetTrack(), &KeyOn); OldPitch = 0; } } if (!mPitch) { - mpPianoWindow->mpMouseAction = 0; - delete this; return 1; // done } return 0; @@ -202,11 +199,11 @@ tKeyLengthDragger(tKeyOn* pKeyOn, JZPianoWindow* pPianoWindow); - int Dragging(wxMouseEvent& Event); + int Dragging(wxMouseEvent& MouseEvent); - int ButtonUp(wxMouseEvent& Event); + int ButtonUp(wxMouseEvent& MouseEvent); - int Event(wxMouseEvent& Event); + int ProcessMouseEvent(wxMouseEvent& MouseEvent); private: @@ -240,28 +237,28 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tKeyLengthDragger::Event(wxMouseEvent& Event) +int tKeyLengthDragger::ProcessMouseEvent(wxMouseEvent& MouseEvent) { - if (Event.Dragging()) + if (MouseEvent.Dragging()) { - return Dragging(Event); + return Dragging(MouseEvent); } - else if (Event.ButtonUp()) + else if (MouseEvent.ButtonUp()) { - return ButtonUp(Event); + return ButtonUp(MouseEvent); } return 0; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tKeyLengthDragger::Dragging(wxMouseEvent& Event) +int tKeyLengthDragger::Dragging(wxMouseEvent& MouseEvent) { wxClientDC Dc(Win); Win->PrepareDC(Dc); //to translate scrolled coordinates Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 1, 1); int fx, fy; - Event.GetPosition(&fx, &fy); + MouseEvent.GetPosition(&fx, &fy); int Clock = Win->x2Clock(fx); int Length = Clock - Copy->GetClock(); if (Length <= 0) @@ -276,7 +273,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tKeyLengthDragger::ButtonUp(wxMouseEvent& Event) +int tKeyLengthDragger::ButtonUp(wxMouseEvent& MouseEvent) { // SN++ Key_Aftertouch if (Copy->GetEventLength() < mpKeyOn->GetEventLength()) @@ -330,16 +327,21 @@ //***************************************************************************** class tPlayTrackLengthDragger : public tMouseAction { + public: + + tPlayTrackLengthDragger(tPlayTrack* k, JZPianoWindow* pPianoWindow); + + int Dragging(wxMouseEvent& MouseEvent); + + int ButtonUp(wxMouseEvent& MouseEvent); + + int ProcessMouseEvent(wxMouseEvent& MouseEvent); + + private: tPlayTrack* mpKeyOn; tPlayTrack* Copy; JZPianoWindow* Win; JZTrack* mpTrack; - - public: - tPlayTrackLengthDragger(tPlayTrack* k, JZPianoWindow* pPianoWindow); - int Dragging(wxMouseEvent& Event); - int ButtonUp(wxMouseEvent& Event); - int Event(wxMouseEvent& Event); }; //----------------------------------------------------------------------------- @@ -363,28 +365,28 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tPlayTrackLengthDragger::Event(wxMouseEvent& Event) +int tPlayTrackLengthDragger::ProcessMouseEvent(wxMouseEvent& MouseEvent) { - if (Event.Dragging()) + if (MouseEvent.Dragging()) { - return Dragging(Event); + return Dragging(MouseEvent); } - else if (Event.ButtonUp()) + else if (MouseEvent.ButtonUp()) { - return ButtonUp(Event); + return ButtonUp(MouseEvent); } return 0; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tPlayTrackLengthDragger::Dragging(wxMouseEvent& Event) +int tPlayTrackLengthDragger::Dragging(wxMouseEvent& MouseEvent) { wxClientDC Dc(Win); Win->PrepareDC(Dc); Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 1, 1); int fx, fy; - Event.GetPosition(&fx, &fy); + MouseEvent.GetPosition(&fx, &fy); int Clock = Win->x2Clock(fx); int Length = Clock - Copy->GetClock(); if (Length <= 0) @@ -397,7 +399,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tPlayTrackLengthDragger::ButtonUp(wxMouseEvent& Event) +int tPlayTrackLengthDragger::ButtonUp(wxMouseEvent& MouseEvent) { wxClientDC Dc(Win); Win->PrepareDC(Dc); @@ -423,7 +425,6 @@ class tVelocCounter : public tMouseCounter { public: - int Event(wxMouseEvent& Event); tVelocCounter( JZPianoWindow* pPianoWindow, JZRectangle* pRectangle, @@ -440,6 +441,8 @@ Dc.SetFont(*(Win->GetFixedFont())); } + virtual int ProcessMouseEvent(wxMouseEvent& MouseEvent); + private: JZPianoWindow* Win; @@ -449,9 +452,9 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tVelocCounter::Event(wxMouseEvent& Event) +int tVelocCounter::ProcessMouseEvent(wxMouseEvent& MouseEvent) { - if (tMouseCounter::Event(Event)) + if (tMouseCounter::ProcessMouseEvent(MouseEvent)) { tKeyOn* pKeyOnCopy = (tKeyOn *)mpKeyOn->Copy(); pKeyOnCopy->SetVelocity(Value); @@ -591,7 +594,7 @@ mpPianoFrame(pPianoFrame), mPlayClock(-1), mSnapCount(0), - mpMouseAction(0), + mPasteBuffer(), mpTrack(0), mTrackIndex(0), mpCtrlEdit(0), @@ -1612,12 +1615,12 @@ // Descriptions: // This mouse handler delegates to the subclassed event window. //----------------------------------------------------------------------------- -void JZPianoWindow::OnMouseEvent(wxMouseEvent& Event) +void JZPianoWindow::OnMouseEvent(wxMouseEvent& MouseEvent) { - if (Event.Moving() && !Event.Dragging() && !mpMouseAction) + if (MouseEvent.Moving() && !MouseEvent.Dragging() && !mpMouseAction) { int fx, fy; - Event.GetPosition(&fx, &fy); + MouseEvent.GetPosition(&fx, &fy); int Pitch = y2Pitch(fy); JZProjectManager::Instance()->ShowPitch(Pitch); } @@ -1627,27 +1630,30 @@ if (!mpMouseAction) { int x, y; - Event.GetPosition(&x, &y); + MouseEvent.GetPosition(&x, &y); - if (y > mEventsY) // click in event area? + // Was the mouse event below the top line that indicates the measure? + if (y > mEventsY) { if (mPianoX < x && x < mPianoX + mPianoWidth) { - MousePiano(Event); + // The mouse event was in the piano keys area. + MousePiano(MouseEvent); } else if (mEventsX < x && x < mEventsX + mEventsWidth) { - MouseEvents(Event); + // The mouse event was in the MIDI event area. + MouseEvents(MouseEvent); } else { - OnEventWinMouseEvent(Event); + OnEventWinMouseEvent(MouseEvent); } } else if (x > mEventsX) { // click in top line - int action = mMousePlay.Action(Event); + int action = mMousePlay.Action(MouseEvent); if (action) { @@ -1685,7 +1691,8 @@ } else { - OnEventWinMouseEvent(Event); + MouseEvent.Skip(); +//NEW OnEventWinMouseEvent(MouseEvent); } } @@ -1820,7 +1827,7 @@ //----------------------------------------------------------------------------- // Snapper //----------------------------------------------------------------------------- -void JZPianoWindow::SnapSelStop(wxMouseEvent& Event) +void JZPianoWindow::SnapSelStop(wxMouseEvent& MouseEvent) { if (mpSnapSel->IsSelected()) { @@ -1865,8 +1872,21 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZPianoWindow::SnapSelStart(wxMouseEvent &) +int JZPianoWindow::SnapClock(int Clock, bool Up) { + int qnt = SnapClocks(); + Clock -= (Clock % qnt); + if (Up) + { + Clock += qnt; + } + return Clock; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZPianoWindow::SnapSelStart(wxMouseEvent& MouseEvent) +{ mSnapCount = 0; int clk = SnapClock(mFromClock, false); int qnt = SnapClocks(); @@ -1890,19 +1910,6 @@ } //----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -int JZPianoWindow::SnapClock(int Clock, bool Up) -{ - int qnt = SnapClocks(); - Clock -= (Clock % qnt); - if (Up) - { - Clock += qnt; - } - return Clock; -} - -//----------------------------------------------------------------------------- // Description: // Update the play position to the clock argument, and trigger a redraw so // the play bar will be drawn. @@ -2000,22 +2007,22 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZPianoWindow::OnEventWinMouseEvent(wxMouseEvent& Event) +int JZPianoWindow::OnEventWinMouseEvent(wxMouseEvent& MouseEvent) { if (!mpMouseAction) { // create mpSnapSel? int x, y; - Event.GetPosition(&x, &y); + MouseEvent.GetPosition(&x, &y); if ( mEventsX < x && x < mEventsX + mEventsWidth && mEventsY < y && y < mEventsY + mEventsHeight) { - if (Event.LeftDown()) + if (MouseEvent.LeftDown()) { { - SnapSelStart(Event); + SnapSelStart(MouseEvent); // if (mpSnapSel->IsSelected()) // { @@ -2023,7 +2030,7 @@ // invalidate a rect). Refresh(); // } - mpSnapSel->Event(Event); + mpSnapSel->ProcessMouseEvent(MouseEvent); mpMouseAction = mpSnapSel; } } @@ -2033,13 +2040,13 @@ { // mpMouseAction active - if (mpMouseAction->Event(Event)) + if (mpMouseAction->ProcessMouseEvent(MouseEvent)) { // mpMouseAction finished if (mpMouseAction == mpSnapSel) { - SnapSelStop(Event); + SnapSelStop(MouseEvent); // inefficient, invalidate rect first instead. Refresh(); @@ -2100,14 +2107,14 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZPianoWindow::MouseCutPaste(wxMouseEvent& Event, bool Cut) +void JZPianoWindow::MouseCutPaste(wxMouseEvent& MouseEvent, bool Cut) { wxClientDC Dc(this); PrepareDC(Dc); // Convert physical coordinates to logical (scrolled) coordinates. - wxPoint Point = Event.GetLogicalPosition(Dc); + wxPoint Point = MouseEvent.GetLogicalPosition(Dc); int x = Point.x; int y = Point.y; @@ -2130,14 +2137,14 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZPianoWindow::MouseEvents(wxMouseEvent& Event) +void JZPianoWindow::MouseEvents(wxMouseEvent& MouseEvent) { - int action = mMouseEvent.Action(Event); + int action = mMouseEvent.Action(MouseEvent); if (action) { int x, y; - Event.GetPosition(&x, &y); + MouseEvent.GetPosition(&x, &y); int Clock = x2Clock(x); int Pitch = y2Pitch(y); @@ -2153,11 +2160,11 @@ switch (action) { case MA_CUTPASTE: - MouseCutPaste(Event, 1); + MouseCutPaste(MouseEvent, 1); break; case MA_COPY: - MouseCutPaste(Event, 0); + MouseCutPaste(MouseEvent, 0); break; case MA_LENGTH: @@ -2198,12 +2205,12 @@ case MA_LISTEN: - MousePiano(Event); + MousePiano(MouseEvent); break; case MA_SELECT: case MA_CONTSEL: - OnEventWinMouseEvent(Event); + OnEventWinMouseEvent(MouseEvent); break; case MA_VELOCITY: @@ -2216,7 +2223,7 @@ r.SetHeight(mTopInfoHeight); tVelocCounter *VelocCounter = new tVelocCounter(this, &r, pKeyOn); - VelocCounter->Event(Event); + VelocCounter->ProcessMouseEvent(MouseEvent); mpMouseAction = VelocCounter; } break; @@ -2227,11 +2234,17 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZPianoWindow::MousePiano(wxMouseEvent& Event) +void JZPianoWindow::MousePiano(wxMouseEvent& MouseEvent) { - if (Event.ButtonDown()) + if (MouseEvent.ButtonDown()) { - mpMouseAction = new tMousePlay(this, Event); + mpMouseAction = new JZMousePlay(this); + int Status = mpMouseAction->ProcessMouseEvent(MouseEvent); + if (Status == 1) + { + delete mpMouseAction; + mpMouseAction = 0; + } } } Modified: trunk/jazz/src/PianoWindow.h =================================================================== --- trunk/jazz/src/PianoWindow.h 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/PianoWindow.h 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 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 @@ -111,12 +111,12 @@ int IsVisible(JZTrack* pTrack); - void SnapSelStart(wxMouseEvent& Event); - int SnapClock(int Clock, bool Up = false); - void SnapSelStop(wxMouseEvent& Event); + virtual void SnapSelStart(wxMouseEvent& MouseEvent); + virtual void SnapSelStop(wxMouseEvent& MouseEvent); + int SnapClocks(); void SetSnapDenom(int Value); @@ -208,8 +208,6 @@ int mSnapsX[eMaxSnaps]; - tMouseAction* mpMouseAction; - tEventArray mPasteBuffer; public: @@ -240,7 +238,7 @@ int y2TrackIndex(int y); int EventsSelected(const char *msg = 0); - int OnEventWinMouseEvent(wxMouseEvent &e); + int OnEventWinMouseEvent(wxMouseEvent& MouseEvent); void DrawEvents( wxDC& Dc, @@ -268,7 +266,7 @@ void OnPaint(wxPaintEvent& Event); - void OnMouseEvent(wxMouseEvent& Event); + void OnMouseEvent(wxMouseEvent& MouseEvent); void OnScroll(wxScrollWinEvent& Event); @@ -276,11 +274,11 @@ void VerticalScroll(wxScrollWinEvent& Event); - void MouseCutPaste(wxMouseEvent& Event, bool Cut); + void MouseCutPaste(wxMouseEvent& MouseEvent, bool Cut); - void MouseEvents(wxMouseEvent& Event); + void MouseEvents(wxMouseEvent& MouseEvent); - void MousePiano(wxMouseEvent& Event); + void MousePiano(wxMouseEvent& MouseEvent); bool OnCharHook(wxKeyEvent& Event); Modified: trunk/jazz/src/Random.cpp =================================================================== --- trunk/jazz/src/Random.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/Random.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 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 @@ -597,29 +597,33 @@ xmax = xma; } -int tArrayEdit::Index(wxMouseEvent &e) +int tArrayEdit::Index(wxMouseEvent& MouseEvent) { int ex, ey; - e.GetPosition(&ex, &ey); + MouseEvent.GetPosition(&ex, &ey); int i = (int)( ((short)ex - x) * n / w); i = i < 0 ? 0 : i; i = i >= n ? n-1 : i; return i; } -int tArrayEdit::Dragging(wxMouseEvent &e) +int tArrayEdit::Dragging(wxMouseEvent& MouseEvent) { if (!dragging) + { return 0; + } if (index < 0) - index = Index(e); + { + index = Index(MouseEvent); + } int val = nul; - if (e.LeftIsDown()) + if (MouseEvent.LeftIsDown()) { int ex, ey; - e.GetPosition(&ex, &ey); + MouseEvent.GetPosition(&ex, &ey); // $blk$ val = (int)( (y + h - (short)ey) * (max - min) / h + min); val = (int)( (double)(y + h - ey) * (max - min) / h + min + 0.5); val = val > max ? max : val; @@ -631,12 +635,12 @@ // in msw ex,ey are 65536 for negative values! wxDC *dc = new wxClientDC(this);//GetDC(); char buf[500]; - sprintf(buf, "x %4.0f, y %4.0f, sh %d", ex, ey, e.ShiftDown()); + sprintf(buf, "x %4.0f, y %4.0f, sh %d", ex, ey, MouseEvent.ShiftDown()); dc->DrawText(buf, 50, 50); } #endif wxDC *dc = new wxClientDC(this); // PORTING this is evil and shoud go - if (e.ShiftDown()) + if (MouseEvent.ShiftDown()) { int k; for (k = 0; k < n; k++) @@ -648,7 +652,7 @@ } } - else if (e.ControlDown()) + else if (MouseEvent.ControlDown()) { DrawBar(dc, index, 0); mArray[index] = val; @@ -656,7 +660,7 @@ } else { - int i = Index(e); + int i = Index(MouseEvent); int k = i; if (i < index) for (; i <= index; i++) @@ -678,18 +682,18 @@ return 0; } -int tArrayEdit::ButtonDown(wxMouseEvent &e) +int tArrayEdit::ButtonDown(wxMouseEvent& MouseEvent) { #ifdef __WXMSW__ CaptureMouse(); #endif dragging = 1; - index = Index(e); - Dragging(e); + index = Index(MouseEvent); + Dragging(MouseEvent); return 0; } -int tArrayEdit::ButtonUp(wxMouseEvent &e) +int tArrayEdit::ButtonUp(wxMouseEvent& MouseEvent) { #ifdef __WXMSW__ ReleaseMouse(); @@ -705,16 +709,24 @@ } -void tArrayEdit::OnMouseEvent(wxMouseEvent &e) +void tArrayEdit::OnMouseEvent(wxMouseEvent& MouseEvent) { if (!enabled) + { return; - if (e.ButtonDown()) - ButtonDown(e); - else if (e.Dragging()) - Dragging(e); - else if (e.ButtonUp()) - ButtonUp(e); + } + if (MouseEvent.ButtonDown()) + { + ButtonDown(MouseEvent); + } + else if (MouseEvent.Dragging()) + { + Dragging(MouseEvent); + } + else if (MouseEvent.ButtonUp()) + { + ButtonUp(MouseEvent); + } } void tArrayEdit::Enable(int e) Modified: trunk/jazz/src/Random.h =================================================================== --- trunk/jazz/src/Random.h 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/Random.h 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 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 @@ -145,7 +145,7 @@ virtual void DrawYTicks(wxDC* dc); virtual void DrawLabel(wxDC* dc); virtual void DrawNull(wxDC* dc); - int Index(wxMouseEvent &e); + int Index(wxMouseEvent& MouseEvent); int enabled; int style_bits; @@ -168,10 +168,10 @@ virtual void OnDraw(wxDC& indc); virtual void OnSize(wxSizeEvent& event); - virtual void OnMouseEvent(wxMouseEvent &e); - virtual int Dragging(wxMouseEvent &); - virtual int ButtonDown(wxMouseEvent &); - virtual int ButtonUp(wxMouseEvent &); + virtual void OnMouseEvent(wxMouseEvent& MouseEvent); + virtual int Dragging(wxMouseEvent& MouseEvent); + virtual int ButtonDown(wxMouseEvent& MouseEvent); + virtual int ButtonUp(wxMouseEvent& MouseEvent); virtual void SetLabel(char const *llabel); void Enable(int enable = 1); Modified: trunk/jazz/src/SampleWindow.cpp =================================================================== --- trunk/jazz/src/SampleWindow.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/SampleWindow.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 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 @@ -138,7 +138,7 @@ } virtual void OnPaint(); virtual void OnSize(int w, int h); - virtual void OnEvent(wxMouseEvent &evt); + virtual void OnEvent(wxMouseEvent& MouseEvent); void ClearSelection(); void SetInsertionPoint(int offs); void SetSelection(int fr, int to); @@ -311,7 +311,7 @@ -void tSampleCnvs::OnEvent(wxMouseEvent &e) +void tSampleCnvs::OnEvent(wxMouseEvent& MouseEvent) { // dont accept mouse events as long as the // array edit is up @@ -323,7 +323,7 @@ wxDC* pDc = new wxClientDC(this); // tSnapSel is strange. - if (e.LeftDown()) + if (MouseEvent.LeftDown()) { mouse_up_sets_insertion_point = 0; mouse_down = TRUE; @@ -340,12 +340,12 @@ { mouse_up_sets_insertion_point = 1; } - snapsel.Event(e); + snapsel.ProcessMouseEvent(MouseEvent); } - else if (e.LeftUp()) + else if (MouseEvent.LeftUp()) { mouse_down = FALSE; - snapsel.Event(e); + snapsel.ProcessMouseEvent(MouseEvent); if (snapsel.IsSelected()) { snapsel.Draw(*pDc, 0, 0); @@ -357,7 +357,7 @@ else if (mouse_up_sets_insertion_point) { int x, y; - e.GetPosition(&x, &y); + MouseEvent.GetPosition(&x, &y); sel_fr = sel_to = Pixel2Sample(x); inspt.Draw(x); } @@ -366,9 +366,9 @@ sel_fr = sel_to = -1; } } - else if (e.Dragging() && mouse_down) + else if (MouseEvent.Dragging() && mouse_down) { - snapsel.Event(e); + snapsel.ProcessMouseEvent(MouseEvent); } } Modified: trunk/jazz/src/TrackFrame.cpp =================================================================== --- trunk/jazz/src/TrackFrame.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/TrackFrame.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 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 @@ -665,7 +665,7 @@ // playing: // left+right: stop //----------------------------------------------------------------------------- -void JZTrackFrame::MousePlay(wxMouseEvent& Event, TEMousePlayMode Mode) +void JZTrackFrame::MousePlay(wxMouseEvent& MouseEvent, TEMousePlayMode Mode) { - mpTrackWindow->MousePlay(Event, Mode); + mpTrackWindow->MousePlay(MouseEvent, Mode); } Modified: trunk/jazz/src/TrackFrame.h =================================================================== --- trunk/jazz/src/TrackFrame.h 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/TrackFrame.h 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 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 @@ -102,7 +102,7 @@ void OnHelpAbout(wxCommandEvent& Event); - void MousePlay(wxMouseEvent& Event, TEMousePlayMode Mode); + void MousePlay(wxMouseEvent& MouseEvent, TEMousePlayMode Mode); private: Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2009-02-16 05:03:58 UTC (rev 698) +++ trunk/jazz/src/TrackWindow.cpp 2009-02-16 19:59:58 UTC (rev 699) @@ -3,7 +3,7 @@ // // Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. // Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber +// Modifications Copyright (C) 2008-2009 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 @@ -265,9 +265,9 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZTrackWindow::OnLeftButtonDown(wxMouseEvent& Event) +void JZTrackWindow::OnLeftButtonDown(wxMouseEvent& MouseEvent) { - wxPoint Point = Event.GetPosition(); + wxPoint Point = MouseEvent.GetPosition(); if (Point.x < mNumberWidth && Point.y >= mTopInfoHeight) { @@ -282,34 +282,34 @@ mEventsY, mEventsWidth, mEventsHeight); - SnapSelStop(Event); + SnapSelStop(MouseEvent); } else if ( Point.x >= mEventsX && Point.x < mEventsX + mEventsWidth && Point.y >= mEventsY && Point.y < mEventsY + mEventsHeight) { - SnapSelectionStart(Event); - mpSnapSel->ButtonDown(Event); + SnapSelectionStart(MouseEvent); + mpSnapSel->ButtonDown(MouseEvent); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZTrackWindow::OnMouseMove(wxMouseEvent& Event) +void JZTrackWindow::OnMouseMove(wxMouseEvent& MouseEvent) { - if (Event.LeftIsDown()) + if (MouseEvent.LeftIsDown()) { - mpSnapSel->Dragging(Event); -// SnapSelectionStop(Event); + mpSnapSel->Dragging(MouseEvent); +// SnapSelectionStop(MouseEvent); Refresh(false); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void JZTrackWindow::OnLeftButtonUp(wxMouseEvent& Event) +void JZTrackWindow::OnLeftButtonUp(wxMouseEvent& MouseEvent) { - wxPoint Point = Event.GetPosition(); + wxPoint Point = MouseEvent.GetPosition(); // Check to see if the mouse was clicked in the top header. if (Point.y < mTopInfoHeight) @@ -410,10 +410,10 @@ Point.x >= mEventsX && Point.x < mEventsX + mEventsWidth && Point.y >= mEventsY && Point.y < mEventsY + mEventsHeight) { - mpSnapSel->ButtonUp(Event); + mpSnapSel->ButtonUp(MouseEvent); // The point is in event area. - SnapSelectionStop(Event); + SnapSelectionStop(MouseEvent); } } } @@ -421,9 +421,9 @@ //----------------------------------------------------------------------------- //------------------------------------------------------------------------... [truncated message content] |