diff options
author | Florian Jung <flo@windfisch.org> | 2011-09-10 17:06:00 +0000 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2011-09-10 17:06:00 +0000 |
commit | 24f84a489364741eb3fc126a3f83d91a86b65e27 (patch) | |
tree | 63a4e20aaf4a2ebd2462c91b574eddceeac31170 /muse2/muse/ctrl/ctrlcanvas.cpp | |
parent | 38c5cccc7273247353264bb7dc97f42296d8e259 (diff) | |
parent | 2120ea4f083228dde0d7307203391a4ec8f57e2d (diff) |
merged the first bunch of orcans changes
STILL WAIT WITH COMMITTING NEW STUFF! i have to merge the rest as well!
this is a bit buggy (connect errors, not tested much), but doesn't
segfault immediately
Diffstat (limited to 'muse2/muse/ctrl/ctrlcanvas.cpp')
-rw-r--r-- | muse2/muse/ctrl/ctrlcanvas.cpp | 69 |
1 files changed, 42 insertions, 27 deletions
diff --git a/muse2/muse/ctrl/ctrlcanvas.cpp b/muse2/muse/ctrl/ctrlcanvas.cpp index 68e29f20..7c77a836 100644 --- a/muse2/muse/ctrl/ctrlcanvas.cpp +++ b/muse2/muse/ctrl/ctrlcanvas.cpp @@ -3,6 +3,21 @@ // Linux Music Editor // $Id: ctrlcanvas.cpp,v 1.15.2.10 2009/11/14 03:37:48 terminator356 Exp $ // (C) Copyright 1999 Werner Schweer (ws@seh.de) +// +// 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 the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// //========================================================= #include <stdio.h> @@ -184,10 +199,10 @@ CtrlCanvas::CtrlCanvas(MidiEditor* e, QWidget* parent, int xmag, const char* name, CtrlPanel* pnl) : View(parent, xmag, 1, name) { setBg(Qt::white); - setFont(config.fonts[3]); + setFont(MusEConfig::config.fonts[3]); editor = e; drag = DRAG_OFF; - tool = PointerTool; + tool = MusEWidget::PointerTool; pos[0] = 0; pos[1] = 0; pos[2] = 0; @@ -212,7 +227,7 @@ CtrlCanvas::CtrlCanvas(MidiEditor* e, QWidget* parent, int xmag, setCurTrackAndPart(); } connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - connect(muse, SIGNAL(configChanged()), SLOT(configChanged())); + connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(configChanged())); curDrumInstrument = editor->curDrumInstrument(); //printf("CtrlCanvas::CtrlCanvas curDrumInstrument:%d\n", curDrumInstrument); @@ -457,7 +472,7 @@ void CtrlCanvas::songChanged(int type) return; if(type & SC_CONFIG) - setFont(config.fonts[3]); + setFont(MusEConfig::config.fonts[3]); bool changed = false; if(type & (SC_CONFIG | SC_PART_MODIFIED | SC_SELECTION)) @@ -663,7 +678,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) return; start = event->pos(); - Tool activeTool = tool; + MusEWidget::Tool activeTool = tool; bool ctrlKey = event->modifiers() & Qt::ControlModifier; int xpos = start.x(); @@ -672,7 +687,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) MidiController::ControllerType type = midiControllerType(_controller->num()); switch (activeTool) { - case PointerTool: + case MusEWidget::PointerTool: if(curPart) // p4.0.27 { drag = DRAG_LASSO_START; @@ -717,7 +732,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) break; - case PencilTool: + case MusEWidget::PencilTool: if ((!ctrlKey) && (type != MidiController::Velo)) { drag = DRAG_NEW; song->startUndo(); @@ -730,7 +745,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) } break; - case RubberTool: + case MusEWidget::RubberTool: if (type != MidiController::Velo) { drag = DRAG_DELETE; song->startUndo(); @@ -738,7 +753,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event) } break; - case DrawTool: + case MusEWidget::DrawTool: if (drawLineMode) { line2x = xpos; line2y = ypos; @@ -802,7 +817,7 @@ void CtrlCanvas::viewMouseMoveEvent(QMouseEvent* event) default: break; } - if (tool == DrawTool && drawLineMode) { + if (tool == MusEWidget::DrawTool && drawLineMode) { line2x = pos.x(); line2y = pos.y(); redraw(); @@ -915,8 +930,8 @@ void CtrlCanvas::newValRamp(int x1, int y1, int x2, int y2) int raster = editor->raster(); if (raster == 1) // set reasonable raster { - //raster = config.division/4; - raster = config.division/16; // Let's use 64th notes, for a bit finer resolution. p4.0.18 Tim. + //raster = MusEConfig::config.division/4; + raster = MusEConfig::config.division/16; // Let's use 64th notes, for a bit finer resolution. p4.0.18 Tim. useRaster = true; } @@ -1373,8 +1388,8 @@ void CtrlCanvas::newVal(int x1, int y1, int x2, int y2) int raster = editor->raster(); if (raster == 1) // set reasonable raster { - //raster = config.division/4; - raster = config.division/16; // Let's use 64th notes, for a bit finer resolution. p4.0.18 Tim. + //raster = MusEConfig::config.division/4; + raster = MusEConfig::config.division/16; // Let's use 64th notes, for a bit finer resolution. p4.0.18 Tim. useRaster = true; } @@ -1606,14 +1621,14 @@ void CtrlCanvas::deleteVal(int x1, int x2, int) void CtrlCanvas::setTool(int t) { - if (tool == Tool(t)) + if (tool == MusEWidget::Tool(t)) return; - tool = Tool(t); + tool = MusEWidget::Tool(t); switch(tool) { - case PencilTool: + case MusEWidget::PencilTool: setCursor(QCursor(*pencilIcon, 4, 15)); break; - case DrawTool: + case MusEWidget::DrawTool: drawLineMode = false; break; default: @@ -1658,7 +1673,7 @@ void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MidiPart* part //if(!event.empty() && event.selected()) p.setPen(QPen(Qt::blue, 3)); else - p.setPen(QPen(config.ctrlGraphFg, 3)); + p.setPen(QPen(MusEConfig::config.ctrlGraphFg, 3)); } else p.setPen(QPen(Qt::darkGray, 3)); @@ -1750,7 +1765,7 @@ void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MidiPart* part p.drawLine(x1, lval, tick, lval); } else - p.fillRect(x1, lval, tick - x1, wh - lval, selected ? Qt::blue : config.ctrlGraphFg); + p.fillRect(x1, lval, tick - x1, wh - lval, selected ? Qt::blue : MusEConfig::config.ctrlGraphFg); } @@ -1782,8 +1797,8 @@ void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MidiPart* part p.drawLine(x1, lval, x + w, lval); } else - //p.fillRect(x1, lval, (x+w) - x1, wh - lval, config.ctrlGraphFg); - p.fillRect(x1, lval, (x+w) - x1, wh - lval, selected ? Qt::blue : config.ctrlGraphFg); + //p.fillRect(x1, lval, (x+w) - x1, wh - lval, MusEConfig::config.ctrlGraphFg); + p.fillRect(x1, lval, (x+w) - x1, wh - lval, selected ? Qt::blue : MusEConfig::config.ctrlGraphFg); } } } @@ -1896,18 +1911,18 @@ void CtrlCanvas::drawOverlay(QPainter& p) { QString s(_controller ? _controller->name() : QString("")); - //p.setFont(config.fonts[3]); // Use widget font instead. + //p.setFont(MusEConfig::config.fonts[3]); // Use widget font instead. p.setFont(font()); p.setPen(Qt::black); - //QFontMetrics fm(config.fonts[3]); // Use widget font metrics instead. + //QFontMetrics fm(MusEConfig::config.fonts[3]); // Use widget font metrics instead. //int y = fm.lineSpacing() + 2; int y = fontMetrics().lineSpacing() + 2; p.drawText(2, y, s); if (noEvents) { - //p.setFont(config.fonts[3]); + //p.setFont(MusEConfig::config.fonts[3]); //p.setPen(Qt::black); //p.drawText(width()/2-100,height()/2-10, "Use shift + pencil or line tool to draw new events"); p.drawText(2 , y * 2, "Use shift + pencil or line tool to draw new events"); @@ -1921,7 +1936,7 @@ void CtrlCanvas::drawOverlay(QPainter& p) QRect CtrlCanvas::overlayRect() const { - //QFontMetrics fm(config.fonts[3]); // Use widget font metrics instead (and set a widget font) !!! + //QFontMetrics fm(MusEConfig::config.fonts[3]); // Use widget font metrics instead (and set a widget font) !!! QFontMetrics fm(fontMetrics()); QRect r(fm.boundingRect(_controller ? _controller->name() : QString(""))); @@ -1954,7 +1969,7 @@ void CtrlCanvas::draw(QPainter& p, const QRect& rect) // draw line tool //--------------------------------------------------- - if (drawLineMode && (tool == DrawTool)) { + if (drawLineMode && (tool == MusEWidget::DrawTool)) { p.setPen(Qt::black); p.drawLine(line1x, line1y, line2x, line2y); } |