⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 linedstaff.h

📁 LINUX下的混音软件
💻 H
📖 第 1 页 / 共 2 页
字号:
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: *//*    Rosegarden    A MIDI and audio sequencer and musical notation editor.    This program is Copyright 2000-2007        Guillaume Laurent   <glaurent@telegraph-road.org>,        Chris Cannam        <cannam@all-day-breakfast.com>,        Richard Bown        <richard.bown@ferventsoftware.com>    The moral rights of Guillaume Laurent, Chris Cannam, and Richard    Bown to claim authorship of this work have been asserted.    Other copyrights also apply to some parts of this work.  Please    see the AUTHORS file and individual file headers for details.    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; either version 2 of the    License, or (at your option) any later version.  See the file    COPYING included with this distribution for more information.*/#ifndef _RG_LINEDSTAFF_H_#define _RG_LINEDSTAFF_H_#include "base/Event.h"#include "base/FastVector.h"#include "base/Staff.h"#include "base/ViewElement.h"#include <qrect.h>#include <utility>#include <vector>class QCanvasLine;class QCanvasItem;class QCanvas;class isFirstBarInRow;class barNo;namespace Rosegarden{class BarLine;class TimeSignature;class SnapGrid;class Segment;class HorizontalLayoutEngine;class Event;/** * LinedStaff is a base class for implementations of Staff that * display the contents of a Segment on a set of horizontal lines * with optional vertical bar lines.   * Likely subclasses include the notation and piano-roll staffs. * * In general, this class handles x coordinates in floating-point, * but y-coordinates as integers because of the requirement that * staff lines be a precise integral distance apart. */class LinedStaff : public Staff{public:    typedef std::pair<double, int> LinedStaffCoords;    enum PageMode {        LinearMode = 0,        ContinuousPageMode,        MultiPageMode    };    enum BarStyle {        PlainBar = 0,        DoubleBar,        HeavyDoubleBar,        RepeatEndBar,        RepeatStartBar,        RepeatBothBar,        NoVisibleBar    };protected:    /**     * Create a new LinedStaff for the given Segment, with a     * linear layout.     *      * \a id is an arbitrary id for the staff in its view,     *    not used within the LinedStaff implementation but     *    queryable via getId     *     * \a resolution is the number of blank pixels between     *    staff lines     *     * \a lineThickness is the number of pixels thick a     *    staff line should be     */    LinedStaff(QCanvas *, Segment *, SnapGrid *,               int id, int resolution, int lineThickness);    /**     * Create a new LinedStaff for the given Segment, with a     * page layout.     *      * \a id is an arbitrary id for the staff in its view,     *    not used within the LinedStaff implementation but     *    queryable via getId     *     * \a resolution is the number of blank pixels between     *    staff lines     *     * \a lineThickness is the number of pixels thick a     *    staff line should be     *     * \a pageWidth is the width of a page, to determine     *    when to break lines for page layout     *     * \a rowsPerPage is the number of rows to a page, or zero     *    for a single continuous page     *     * \a rowSpacing is the distance in pixels between     *    the tops of consecutive rows on this staff     */    LinedStaff(QCanvas *, Segment *, SnapGrid *,               int id, int resolution, int lineThickness,               double pageWidth, int rowsPerPage, int rowSpacing);    /**     * Create a new LinedStaff for the given Segment, with     * either page or linear layout.     */    LinedStaff(QCanvas *, Segment *, SnapGrid *,               int id, int resolution, int lineThickness, PageMode pageMode,               double pageWidth, int rowsPerPage, int rowSpacing);public:    virtual ~LinedStaff();protected:    // Methods required to define the type of staff this is    /**     * Returns the number of visible staff lines     */    virtual int getLineCount() const = 0;    /**     * Returns the number of invisible staff lines     * to leave space for above (and below) the visible staff     */    virtual int getLegerLineCount() const = 0;    /**     * Returns the height-on-staff value for     * the bottom visible staff line (a shorthand means for     * referring to staff lines)     */    virtual int getBottomLineHeight() const = 0;    /**     * Returns the difference between the height-on-     * staff value of one visible staff line and the next one     * above it     */    virtual int getHeightPerLine() const = 0;    /**     * Returns the height-on-staff value for the top visible     * staff line.  This is deliberately not virtual.     */    int getTopLineHeight() const {        return getBottomLineHeight() +            (getLineCount() - 1) * getHeightPerLine();    }    /**     * Returns true if elements fill the spaces between lines,     * false if elements can fall on lines.  If true, the lines     * will be displaced vertically by half a line spacing.     */    virtual bool elementsInSpaces() const {        return false;    }    /**     * Returns true if the staff should draw a faint vertical line at     * each beat, in between the (darker) bar lines.     */    virtual bool showBeatLines() const {        return false;    }    /**     * Returns the number of bars between bar-line numbers, or zero if     * bar lines should not be numbered.  For example, if this     * function returns 5, every 5th bar (starting at bar 5) will be     * numbered.     */    virtual int showBarNumbersEvery() const {        return 0;    }    /**     * Returns the bar line / repeat style for the start of the given bar.     */    virtual BarStyle getBarStyle(int /* barNo */) const {        return PlainBar;    }    /**     * Returns the distance the opening (repeat) bar is inset from the     * nominal barline position.  This is to accommodate the situation     * where a repeat bar has to appear after the clef and key.     */    virtual double getBarInset(int /* barNo */, bool /* isFirstBarInRow */) const {        return 0;    }protected:    /// Subclass may wish to expose this    virtual void setResolution(int resolution);    /// Subclass may wish to expose this    virtual void setLineThickness(int lineThickness);    /// Subclass may wish to expose this    virtual void setPageMode(PageMode pageMode);    /// Subclass may wish to expose this    virtual void setPageWidth(double pageWidth);    /// Subclass may wish to expose this    virtual void setRowsPerPage(int rowsPerPage);    /// Subclass may wish to expose this    virtual void setRowSpacing(int rowSpacing);    /// Subclass may wish to expose this.  Default is zero    virtual void setConnectingLineLength(int length);public:    /**     * Return the id of the staff.  This is only useful to external     * agents, it isn't used by the LinedStaff itself.     */    virtual int getId() const;    /**     * Set the canvas x-coordinate of the left-hand end of the staff.     * This does not move any canvas items that have already been     * created; it should be called before the sizeStaff/positionElements     * procedure begins.     */    virtual void setX(double x);    /**     * Get the canvas x-coordinate of the left-hand end of the staff.     */    virtual double getX() const;    /**     * Set the canvas y-coordinate of the top of the first staff row.     * This does not move any canvas items that have already been     * created; it should be called before the sizeStaff/positionElements     * procedure begins.     */    virtual void setY(int y);    /**     * Get the canvas y-coordinate of the top of the first staff row.     */    virtual int getY() const;    /**     * Set the canvas width of the margin to left and right of the     * staff on each page (used only in MultiPageMode).  Each staff     * row will still be pageWidth wide (that is, the margin is in     * addition to the pageWidth, not included in it).  This does not     * move any canvas items that have already been created; it should     * be called before the sizeStaff/positionElements procedure     * begins.     */    virtual void setMargin(double m);        /**     * Get the canvas width of the left and right margins.     */    virtual double getMargin() const;    /**     * Set the canvas height of the area at the top of the first page     * reserved for the composition title and composer's name (used     * only in MultiPageMode).     */    virtual void setTitleHeight(int h);    /**     * Get the canvas height of the title area.     */    virtual int getTitleHeight() const;        /**     * Returns the width of the entire staff after layout.  Call     * this only after you've done the full sizeStaff/positionElements     * procedure.     */    virtual double getTotalWidth() const;    /**     * Returns the height of the entire staff after layout.  Call     * this only after you've done the full sizeStaff/positionElements     * procedure.  If there are multiple rows, this will be the     * height of all rows, including any space between rows that     * is used to display other staffs.     */    virtual int getTotalHeight() const;    /**     * Returns the total number of pages used by the staff.     */    int getPageCount() const {        if (m_pageMode != MultiPageMode) return 1;        else return 1 + (getRowForLayoutX(m_endLayoutX) / getRowsPerPage());    }    /**     * Returns the difference between the y coordinates of     * neighbouring visible staff lines.  Deliberately non-virtual     */    int getLineSpacing() const {        return m_resolution + m_lineThickness;    }    /**     * Returns the total height of a single staff row, including ruler     */    virtual int getHeightOfRow() const;        /**     * Returns true if the given canvas coordinates fall within     * (any of the rows of) this staff.  False if they fall in the     * gap between two rows.     */    virtual bool containsCanvasCoords(double canvasX, int canvasY) const;     /**     * Returns the canvas y coordinate of the specified line on the     * staff.  baseX/baseY are a canvas coordinates somewhere on the     * correct row, or -1 for the default row.     */    virtual int getCanvasYForHeight(int height, double baseX = -1, int baseY = -1) const;    /**     * Returns the y coordinate of the specified line on the     * staff, relative to the top of the row.     */    virtual int getLayoutYForHeight(int height) const;    /**     * Returns the height-on-staff value nearest to the given     * canvas coordinates.     */    virtual int getHeightAtCanvasCoords(double x, int y) const;    /**     * Return the full width, height and origin of the bar containing     * the given canvas cooordinates.     */    virtual QRect getBarExtents(double x, int y) const;    /**     * Set whether this is the current staff or not.  A staff that is     * current will differ visually from non-current staffs.     *      * The owner of the staffs should normally ensure that one staff     * is current (the default is non-current, even if there only is

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -