diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-02 22:38:52 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-02 22:38:52 +0000 |
commit | 458efa7b0c935cbaafa2791021a5f8f7241aa876 (patch) | |
tree | 624583f2873febe23770bee3fa94b5c24bd59f4f /src/gui/general/LinedStaff.cpp | |
parent | 747037b72944ae2c02962b7c5c96e0a7f8852e38 (diff) | |
download | rosegarden-458efa7b0c935cbaafa2791021a5f8f7241aa876.tar.gz rosegarden-458efa7b0c935cbaafa2791021a5f8f7241aa876.zip |
Initial TQt4 port of Rosegarden
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/rosegarden@1230242 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/gui/general/LinedStaff.cpp')
-rw-r--r-- | src/gui/general/LinedStaff.cpp | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/src/gui/general/LinedStaff.cpp b/src/gui/general/LinedStaff.cpp index 5a4fbb6..5ca0c90 100644 --- a/src/gui/general/LinedStaff.cpp +++ b/src/gui/general/LinedStaff.cpp @@ -436,15 +436,15 @@ LinedStaff::getHeightAtCanvasCoords(double x, int y) const } } -QRect +TQRect LinedStaff::getBarExtents(double x, int y) const { int row = getRowForCanvasCoords(x, y); for (int i = 1; i < m_barLines.size(); ++i) { - double layoutX = m_barLines[i]->getLayoutX(); - int barRow = getRowForLayoutX(layoutX); + double tqlayoutX = m_barLines[i]->getLayoutX(); + int barRow = getRowForLayoutX(tqlayoutX); if (m_pageMode != LinearMode && (barRow < row)) continue; @@ -572,7 +572,7 @@ LinedStaff::getCanvasXForLeftOfRow(int row) const } void -LinedStaff::sizeStaff(HorizontalLayoutEngine &layout) +LinedStaff::sizeStaff(HorizontalLayoutEngine &tqlayout) { Profiler profiler("LinedStaff::sizeStaff", true); @@ -582,19 +582,19 @@ LinedStaff::sizeStaff(HorizontalLayoutEngine &layout) // RG_DEBUG << "LinedStaff::sizeStaff" << endl; - int lastBar = layout.getLastVisibleBarOnStaff(*this); + int lastBar = tqlayout.getLastVisibleBarOnStaff(*this); double xleft = 0, xright = 0; bool haveXLeft = false; - xright = layout.getBarPosition(lastBar) - 1; + xright = tqlayout.getBarPosition(lastBar) - 1; TimeSignature currentTimeSignature; - for (int barNo = layout.getFirstVisibleBarOnStaff(*this); + for (int barNo = tqlayout.getFirstVisibleBarOnStaff(*this); barNo <= lastBar; ++barNo) { - double x = layout.getBarPosition(barNo); + double x = tqlayout.getBarPosition(barNo); if (!haveXLeft) { xleft = x; @@ -603,7 +603,7 @@ LinedStaff::sizeStaff(HorizontalLayoutEngine &layout) double timeSigX = 0; TimeSignature timeSig; - bool isNew = layout.getTimeSignaturePosition(*this, barNo, timeSig, timeSigX); + bool isNew = tqlayout.getTimeSignaturePosition(*this, barNo, timeSig, timeSigX); if (isNew && barNo < lastBar) { currentTimeSignature = timeSig; @@ -619,8 +619,8 @@ LinedStaff::sizeStaff(HorizontalLayoutEngine &layout) insertBar(x, ((barNo == lastBar) ? 0 : - (layout.getBarPosition(barNo + 1) - x)), - layout.isBarCorrectOnStaff(*this, barNo - 1), + (tqlayout.getBarPosition(barNo + 1) - x)), + tqlayout.isBarCorrectOnStaff(*this, barNo - 1), currentTimeSignature, barNo, showBarNo); @@ -667,41 +667,41 @@ LinedStaff::deleteBars() } void -LinedStaff::insertBar(double layoutX, double width, bool isCorrect, +LinedStaff::insertBar(double tqlayoutX, double width, bool isCorrect, const TimeSignature &timeSig, int barNo, bool showBarNo) { - // RG_DEBUG << "insertBar: " << layoutX << ", " << width + // RG_DEBUG << "insertBar: " << tqlayoutX << ", " << width // << ", " << isCorrect << endl; int barThickness = m_lineThickness * 5 / 4; // hack to ensure the bar line appears on the correct row in - // notation page layouts, with a conditional to prevent us from + // notation page tqlayouts, with a conditional to prevent us from // moving the bar and beat lines in the matrix if (!showBeatLines()) { if (width > 0.01) { // not final bar in staff - layoutX += 1; + tqlayoutX += 1; } else { - layoutX -= 1; + tqlayoutX -= 1; } } - int row = getRowForLayoutX(layoutX); - double x = getCanvasXForLayoutX(layoutX); + int row = getRowForLayoutX(tqlayoutX); + double x = getCanvasXForLayoutX(tqlayoutX); int y = getCanvasYForTopLine(row); bool firstBarInRow = false, lastBarInRow = false; if (m_pageMode != LinearMode && - (getRowForLayoutX(layoutX) > - getRowForLayoutX(layoutX - getMargin() - 2))) + (getRowForLayoutX(tqlayoutX) > + getRowForLayoutX(tqlayoutX - getMargin() - 2))) firstBarInRow = true; if (m_pageMode != LinearMode && width > 0.01 && // width == 0 for final bar in staff - (getRowForLayoutX(layoutX) < - getRowForLayoutX(layoutX + width + getMargin() + 2))) + (getRowForLayoutX(tqlayoutX) < + getRowForLayoutX(tqlayoutX + width + getMargin() + 2))) lastBarInRow = true; BarStyle style = getBarStyle(barNo); @@ -710,7 +710,7 @@ LinedStaff::insertBar(double layoutX, double width, bool isCorrect, style = RepeatStartBar; if (firstBarInRow) - insertRepeatedClefAndKey(layoutX, barNo); + insertRepeatedClefAndKey(tqlayoutX, barNo); // If we're supposed to be hiding bar lines, we do just that -- // create them as normal, then hide them. We can't simply not @@ -725,7 +725,7 @@ LinedStaff::insertBar(double layoutX, double width, bool isCorrect, inset = getBarInset(barNo, firstBarInRow); } - BarLine *line = new BarLine(m_canvas, layoutX, + BarLine *line = new BarLine(m_canvas, tqlayoutX, getBarLineHeight(), barThickness, getLineSpacing(), (int)inset, style); @@ -745,7 +745,7 @@ LinedStaff::insertBar(double layoutX, double width, bool isCorrect, else line->show(); - // The bar lines have to be in order of layout-x (there's no + // The bar lines have to be in order of tqlayout-x (there's no // such interesting stipulation for beat or connecting lines) BarLineList::iterator insertPoint = lower_bound (m_barLines.begin(), m_barLines.end(), line, compareBars); @@ -758,7 +758,7 @@ LinedStaff::insertBar(double layoutX, double width, bool isCorrect, if (style == RepeatBothBar) style = RepeatEndBar; - BarLine *eline = new BarLine(m_canvas, layoutX, + BarLine *eline = new BarLine(m_canvas, tqlayoutX, getBarLineHeight(), barThickness, getLineSpacing(), 0, style); eline->moveBy(xe, y); @@ -782,7 +782,7 @@ LinedStaff::insertBar(double layoutX, double width, bool isCorrect, TQFont font; font.setPixelSize(m_resolution * 3 / 2); TQFontMetrics metrics(font); - TQString text = TQString("%1").arg(barNo + 1); + TQString text = TQString("%1").tqarg(barNo + 1); TQCanvasItem *barNoText = new TQCanvasText(text, font, m_canvas); barNoText->setX(x); @@ -814,7 +814,7 @@ LinedStaff::insertBar(double layoutX, double width, bool isCorrect, for (int gridLine = hidden ? 0 : 1; gridLine < gridLines; ++gridLine) { - rect = new QCanvasRectangle + rect = new TQCanvasRectangle (0, 0, barThickness, getBarLineHeight(), m_canvas); rect->moveBy(x + gridLine * dx, y); @@ -834,14 +834,14 @@ LinedStaff::insertBar(double layoutX, double width, bool isCorrect, rect->setZ( -1); rect->show(); // show beat lines even if the bar lines are hidden - LineRec beatLine(layoutX + gridLine * dx, rect); + LineRec beatLine(tqlayoutX + gridLine * dx, rect); m_beatLines.push_back(beatLine); } } if (m_connectingLineLength > 0) { - rect = new QCanvasRectangle + rect = new TQCanvasRectangle (0, 0, barThickness, m_connectingLineLength, m_canvas); rect->moveBy(x, y); @@ -854,7 +854,7 @@ LinedStaff::insertBar(double layoutX, double width, bool isCorrect, else rect->show(); - LineRec connectingLine(layoutX, rect); + LineRec connectingLine(tqlayoutX, rect); m_barConnectingLines.push_back(connectingLine); } } @@ -1009,7 +1009,7 @@ LinedStaff::resizeStaffLineRow(int row, double x, double length) // rather arbitrary (dup in insertBar) int barThickness = m_resolution / 12 + 1; y = getCanvasYForTopLine(row); - TQCanvasRectangle *line = new QCanvasRectangle + TQCanvasRectangle *line = new TQCanvasRectangle (int(x + length), y, barThickness, m_connectingLineLength, m_canvas); line->setPen(GUIPalette::getColour(GUIPalette::StaffConnectingTerminatingLine)); line->setBrush(GUIPalette::getColour(GUIPalette::StaffConnectingTerminatingLine)); @@ -1046,7 +1046,7 @@ LinedStaff::resizeStaffLineRow(int row, double x, double length) m_staffLines[row][lineIndex] = 0; if (m_lineThickness > 1) { - TQCanvasRectangle *rline = new QCanvasRectangle + TQCanvasRectangle *rline = new TQCanvasRectangle (int(x), y, int(length), m_lineThickness, m_canvas); rline->setPen(lineColour); rline->setBrush(lineColour); @@ -1110,10 +1110,10 @@ LinedStaff::getLayoutXOfInsertCursor() const } timeT -LinedStaff::getInsertCursorTime(HorizontalLayoutEngine &layout) const +LinedStaff::getInsertCursorTime(HorizontalLayoutEngine &tqlayout) const { if (m_insertCursorTimeValid) return m_insertCursorTime; - return layout.getTimeForX(getLayoutXOfInsertCursor()); + return tqlayout.getTimeForX(getLayoutXOfInsertCursor()); } void @@ -1141,16 +1141,16 @@ LinedStaff::setPointerPosition(double canvasX, int canvasY) } void -LinedStaff::setPointerPosition(HorizontalLayoutEngine &layout, +LinedStaff::setPointerPosition(HorizontalLayoutEngine &tqlayout, timeT time) { - setPointerPosition(layout.getXForTime(time)); + setPointerPosition(tqlayout.getXForTime(time)); } void -LinedStaff::setPointerPosition(double layoutX) +LinedStaff::setPointerPosition(double tqlayoutX) { - LinedStaffCoords coords = getCanvasCoordsForLayoutCoords(layoutX, 0); + LinedStaffCoords coords = getCanvasCoordsForLayoutCoords(tqlayoutX, 0); setPointerPosition(coords.first, coords.second); } @@ -1176,10 +1176,10 @@ LinedStaff::setInsertCursorPosition(double canvasX, int canvasY) } void -LinedStaff::setInsertCursorPosition(HorizontalLayoutEngine &layout, +LinedStaff::setInsertCursorPosition(HorizontalLayoutEngine &tqlayout, timeT time) { - double x = layout.getXForTime(time); + double x = tqlayout.getXForTime(time); LinedStaffCoords coords = getCanvasCoordsForLayoutCoords(x, 0); setInsertCursorPosition(coords.first, coords.second); m_insertCursorTime = time; |