|
From: <pst...@us...> - 2009-01-20 15:03:38
|
Revision: 695
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=695&view=rev
Author: pstieber
Date: 2009-01-20 15:03:32 +0000 (Tue, 20 Jan 2009)
Log Message:
-----------
1. Removed more code from the event frame that now is in the event Window and started using the
event window version of AreEventsSelected.
2. Changed up -> Up and made it a Boolean in JZPianoWindow::SnapClock.
Modified Paths:
--------------
trunk/jazz/src/EventFrame.cpp
trunk/jazz/src/EventFrame.h
trunk/jazz/src/PianoWindow.cpp
trunk/jazz/src/PianoWindow.h
Modified: trunk/jazz/src/EventFrame.cpp
===================================================================
--- trunk/jazz/src/EventFrame.cpp 2009-01-20 05:51:17 UTC (rev 694)
+++ trunk/jazz/src/EventFrame.cpp 2009-01-20 15:03:32 UTC (rev 695)
@@ -40,39 +40,19 @@
: wxFrame(pParent, wxID_ANY, Title, Position, Size, WindowStyle),
Song(pSong),
mpFilter(0),
- mTrackHeight(0),
mTopInfoHeight(40),
- FontSize(12),
- ClocksPerPixel(36),
mEventsX(),
mEventsY(mTopInfoHeight),
mEventsWidth(0),
mEventsHeight(0),
- CanvasX(0),
- CanvasY(0),
- CanvasW(0),
- CanvasH(0),
- FromClock(0),
- ToClock(0),
- FromLine(0),
- ToLine(0),
SnapSel(0),
MouseAction(0),
PlayClock(-1),
mpSettingsDialog(0),
MixerForm(0),
mpToolBar(0),
- mpGreyColor(0),
- mpGreyBrush(0),
mpEventWindow(0)
{
-#ifdef __WXMSW__
- mpGreyColor = new wxColor(192, 192, 192);
-#else
- mpGreyColor = new wxColor(220, 220, 220);
-#endif
- mpGreyBrush = new wxBrush(*mpGreyColor, wxSOLID);
-
mpFilter = new JZFilter(Song);
}
@@ -80,9 +60,6 @@
{
delete SnapSel;
- delete mpGreyColor;
- delete mpGreyBrush;
-
delete mpFilter;
delete mpToolBar;
@@ -135,77 +112,25 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-int JZEventFrame::y2Line(int y, int up)
-{
- if (up)
- {
- y += mTrackHeight;
- }
- y -= mTopInfoHeight;
- return y / mTrackHeight;
-}
+//int JZEventFrame::y2Line(int y, bool Up)
+//{
+// if (Up)
+// {
+// y += mTrackHeight;
+// }
+// y -= mTopInfoHeight;
+// return y / mTrackHeight;
+//}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-int JZEventFrame::Line2y(int Line)
-{
- return Line * mTrackHeight + mTopInfoHeight;
-}
+//int JZEventFrame::Line2y(int Line)
+//{
+// 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 = mTrackHeight;
- y = y2yLine(y);
- }
- if (w && h)
- {
- //dc->SetBrush(wxGREY_BRUSH);
- dc->SetBrush(*mpGreyBrush);
- dc->SetPen(*wxGREY_PEN);
- #ifdef __WXMSW__
- dc->DrawRectangle(x, y, w+1, h+1);
- #else
- dc->DrawRectangle(x, y, w, h);
- #endif
- x += 1;
- y += 1;
- w -= 2;
- h -= 2;
- if (down)
- {
- dc->SetPen(*wxBLACK_PEN);
- dc->DrawLine(x, y, x+w, y);
- dc->DrawLine(x, y, x, y+h);
- dc->SetPen(*wxWHITE_PEN);
- dc->DrawLine(x+w, y, x+w, y+h);
- dc->DrawLine(x, y+h, x+w, y+h);
- }
- else
- {
- dc->SetPen(*wxWHITE_PEN);
- dc->DrawLine(x, y, x+w, y);
- dc->DrawLine(x, y, x, y+h);
- dc->SetPen(*wxBLACK_PEN);
- dc->DrawLine(x+w, y, x+w, y+h);
- dc->DrawLine(x, y+h, x+w, y+h);
- }
- dc->SetPen(*wxBLACK_PEN);
- x -= 2;
- y -= 2;
- }
- dc->SetTextBackground(*mpGreyColor);
- dc->DrawText((char *)str, x + mLittleBit, y + mLittleBit);
- dc->SetTextBackground(*wxWHITE);
-}
-*/
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
void JZEventFrame::Redraw()
{
// wxDC* dc=new wxClientDC(this);
@@ -308,26 +233,13 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-int JZEventFrame::EventsSelected(const char* msg)
+void JZEventFrame::MenQuantize()
{
- if (!SnapSel->IsSelected())
+ if (!mpEventWindow || !mpEventWindow->AreEventsSelected())
{
- if (msg == 0)
- {
- msg = "please select some events first";
- }
- wxMessageBox((char *)msg, "Error", wxOK);
- return 0;
+ return;
}
- return 1;
-}
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void JZEventFrame::MenQuantize()
-{
- if (!EventsSelected())
- return;
// wxDialogBox *panel = new wxDialogBox(this, "Quantize", FALSE );
tQuantizeDlg * dlg = new tQuantizeDlg(this, mpFilter);
dlg->Create();
@@ -337,8 +249,11 @@
//-----------------------------------------------------------------------------
void JZEventFrame::MenCleanup()
{
- if (!EventsSelected())
- return;
+ if (!mpEventWindow || !mpEventWindow->AreEventsSelected())
+ {
+ return;
+ }
+
tCleanupDlg * dlg = new tCleanupDlg(this, mpFilter);
dlg->Create();
}
@@ -347,8 +262,11 @@
//-----------------------------------------------------------------------------
void JZEventFrame::MenSearchReplace()
{
- if (!EventsSelected())
- return;
+ if (!mpEventWindow || !mpEventWindow->AreEventsSelected())
+ {
+ return;
+ }
+
tSearchReplaceDlg * dlg = new tSearchReplaceDlg(this, mpFilter);
dlg->Create();
}
@@ -357,8 +275,11 @@
//-----------------------------------------------------------------------------
void JZEventFrame::MenSetChannel()
{
- if (!EventsSelected())
- return;
+ if (!mpEventWindow || !mpEventWindow->AreEventsSelected())
+ {
+ return;
+ }
+
tSetChannelDlg * dlg = new tSetChannelDlg(mpFilter);
dlg->Create();
}
@@ -367,8 +288,11 @@
//-----------------------------------------------------------------------------
void JZEventFrame::MenTranspose()
{
- if (!EventsSelected())
- return;
+ if (!mpEventWindow || !mpEventWindow->AreEventsSelected())
+ {
+ return;
+ }
+
tTransposeDlg * dlg = new tTransposeDlg(this, mpFilter);
dlg->Create();
}
@@ -377,8 +301,11 @@
//-----------------------------------------------------------------------------
void JZEventFrame::MenDelete()
{
- if (!EventsSelected())
- return;
+ if (!mpEventWindow || !mpEventWindow->AreEventsSelected())
+ {
+ return;
+ }
+
tDeleteDlg * dlg = new tDeleteDlg(this, mpFilter);
dlg->Create();
}
@@ -387,8 +314,11 @@
//-----------------------------------------------------------------------------
void JZEventFrame::MenVelocity()
{
- if (!EventsSelected())
- return;
+ if (!mpEventWindow || !mpEventWindow->AreEventsSelected())
+ {
+ return;
+ }
+
tVelocityDlg * dlg = new tVelocityDlg(mpFilter);
dlg->Create();
}
@@ -397,8 +327,11 @@
//-----------------------------------------------------------------------------
void JZEventFrame::MenLength()
{
- if (!EventsSelected())
- return;
+ if (!mpEventWindow || !mpEventWindow->AreEventsSelected())
+ {
+ return;
+ }
+
tLengthDlg * dlg = new tLengthDlg(this, mpFilter);
dlg->Create();
}
@@ -408,8 +341,11 @@
//-----------------------------------------------------------------------------
void JZEventFrame::MenConvertToModulation()
{
- if (!EventsSelected())
- return;
+ if (!mpEventWindow || !mpEventWindow->AreEventsSelected())
+ {
+ return;
+ }
+
tCmdConvertToModulation cmd(mpFilter);
cmd.Execute();
Redraw();
Modified: trunk/jazz/src/EventFrame.h
===================================================================
--- trunk/jazz/src/EventFrame.h 2009-01-20 05:51:17 UTC (rev 694)
+++ trunk/jazz/src/EventFrame.h 2009-01-20 15:03:32 UTC (rev 695)
@@ -63,27 +63,16 @@
virtual void SetEventWindow(JZEventWindow* pEventWindow);
- int mTrackHeight;
-
int mTopInfoHeight;
- int FontSize;
- int ClocksPerPixel;
int mEventsX, mEventsY, mEventsWidth, mEventsHeight;
- int CanvasX, CanvasY, CanvasW, CanvasH; // canvas coords
- int FromClock, ToClock;
- int FromLine, ToLine;
- // Mousehandling
+ // Mouse handling
JZSnapSelection* SnapSel;
tMouseAction* MouseAction;
virtual void SnapSelStart(wxMouseEvent &e);
virtual void SnapSelStop(wxMouseEvent &e);
- // methods
- int y2Line(int y, int up = 0);
- int Line2y(int line);
-
int PlayClock;
// Events
@@ -102,11 +91,6 @@
// Mixer-Dialog
wxDialog* MixerForm;
- // Edit-Menu
-
- // if selection active: TRUE, else: Errormessage + FALSE
- int EventsSelected(const char* msg = 0);
-
private:
void OnUpdateEditShift(wxUpdateUIEvent& Event);
@@ -132,8 +116,6 @@
protected:
JZToolBar* mpToolBar;
- wxColor* mpGreyColor;
- wxBrush* mpGreyBrush;
JZEventWindow* mpEventWindow;
Modified: trunk/jazz/src/PianoWindow.cpp
===================================================================
--- trunk/jazz/src/PianoWindow.cpp 2009-01-20 05:51:17 UTC (rev 694)
+++ trunk/jazz/src/PianoWindow.cpp 2009-01-20 15:03:32 UTC (rev 695)
@@ -1868,7 +1868,7 @@
void JZPianoWindow::SnapSelStart(wxMouseEvent &)
{
mSnapCount = 0;
- int clk = SnapClock(mFromClock, 0);
+ int clk = SnapClock(mFromClock, false);
int qnt = SnapClocks();
while (clk <= mToClock && mSnapCount < eMaxSnaps)
{
@@ -1891,11 +1891,11 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-int JZPianoWindow::SnapClock(int Clock, int up)
+int JZPianoWindow::SnapClock(int Clock, bool Up)
{
int qnt = SnapClocks();
Clock -= (Clock % qnt);
- if (up)
+ if (Up)
{
Clock += qnt;
}
Modified: trunk/jazz/src/PianoWindow.h
===================================================================
--- trunk/jazz/src/PianoWindow.h 2009-01-20 05:51:17 UTC (rev 694)
+++ trunk/jazz/src/PianoWindow.h 2009-01-20 15:03:32 UTC (rev 695)
@@ -113,7 +113,7 @@
void SnapSelStart(wxMouseEvent& Event);
- int SnapClock(int Clock, int up = 0);
+ int SnapClock(int Clock, bool Up = false);
void SnapSelStop(wxMouseEvent& Event);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|