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

📄 linedstaff.h

📁 LINUX下的混音软件
💻 H
📖 第 1 页 / 共 2 页
字号:
     * one staff) and that only one staff is current at once.     */    virtual void setCurrent(bool current);    /**     * Move the playback pointer to the layout-X coordinate     * corresponding to the given time, and show it.     */    virtual void setPointerPosition    (HorizontalLayoutEngine&, timeT);    /**     * Move the playback pointer to the layout-X coordinate     * corresponding to the given canvas coordinates, and show it.     */    virtual void setPointerPosition(double x, int y);    /**     * Move the playback pointer to the given layout-X     * coordinate, and show it.     */    virtual void setPointerPosition(double x);    /**     * Returns the layout-X coordinate corresponding to the current     * position of the playback pointer.     */    virtual double getLayoutXOfPointer() const;    /**     * Returns the canvas coordinates of the top of the playback     * pointer.     */    virtual void getPointerPosition(double &x, int &y) const;    /**     * Hide the playback pointer.     */    virtual void hidePointer();    /**     * Move the insertion cursor to the layout-X coordinate     * corresponding to the given time, and show it.     */    virtual void setInsertCursorPosition(HorizontalLayoutEngine&, timeT);    /**     * Move the insertion cursor to the layout-X coordinate     * corresponding to the given canvas coordinates, and show it.     */    virtual void setInsertCursorPosition(double x, int y);    /**     * Returns the layout-X coordinate corresponding to the current     * position of the insertion cursor.  Returns -1 if this staff     * is not current or there is some other problem.     */    virtual double getLayoutXOfInsertCursor() const;    /**     * Return the time of the insert cursor.     */    virtual timeT getInsertCursorTime(HorizontalLayoutEngine&) const;    /**     * Return the canvas coordinates of the top of the insert     * cursor.     */    virtual void getInsertCursorPosition(double &x, int &y) const;    /**     * Hide the insert cursor.     */    virtual void hideInsertCursor();    /**     * Query the given horizontal layout object (which is assumed to     * have just completed its layout procedure) to determine the     * required extents of the staff and the positions of the bars,     * and create the bars and staff lines accordingly.  It may be     * called either before or after renderElements and/or     * positionElements.     *      * No bars or staff lines will appear unless this method has     * been called.     */    virtual void sizeStaff(HorizontalLayoutEngine& layout);    /**     * Generate or re-generate sprites for all the elements between     * from and to.  See subclasses for specific detailed comments.     *     * A very simplistic staff subclass may choose not to     * implement this (the default implementation is empty) and to     * do all the rendering work in positionElements.  If rendering     * elements is slow, however, it makes sense to do it here     * because this method may be called less often.     */    virtual void renderElements(ViewElementList::iterator from,                                ViewElementList::iterator to);    /**     * Call renderElements(from, to) on the whole staff.     */    virtual void renderAllElements();    /**     * Assign suitable coordinates to the elements on the staff     * between the start and end times, based entirely on the layout     * X and Y coordinates they were given by the horizontal and     * vertical layout processes.     *     * The implementation is free to render any elements it     * chooses in this method as well.     */    virtual void positionElements(timeT from,                                  timeT to) = 0;     /**     * Call positionElements(from, to) on the whole staff.     */    virtual void positionAllElements();        /* Some optional methods for the subclass. */    /**     * Return an iterator pointing to the nearest view element to the     * given canvas coordinates.     *      * If notesAndRestsOnly is true, do not return any view element     * other than a note or rest.     *     * If the closest view element is further away than     * proximityThreshold pixels in either x or y axis, return end().     * If proximityThreshold is less than zero, treat it as infinite.     *     * Also return the clef and key in force at these coordinates.     *     * The default implementation should suit for subclasses that only     * show a single element per layout X coordinate.     */    virtual ViewElementList::iterator getClosestElementToCanvasCoords    (double x, int y,      Event *&clef, Event *&key,     bool notesAndRestsOnly = false, int proximityThreshold = 10) {        LinedStaffCoords layoutCoords = getLayoutCoordsForCanvasCoords(x, y);        return getClosestElementToLayoutX            (layoutCoords.first, clef, key,             notesAndRestsOnly, proximityThreshold);    }    /**     * Return an iterator pointing to the nearest view element to the     * given layout x-coordinate.     *      * If notesAndRestsOnly is true, do not return any view element     * other than a note or rest.     *     * If the closest view element is further away than     * proximityThreshold pixels in either x or y axis, return end().     * If proximityThreshold is less than zero, treat it as infinite.     *     * Also return the clef and key in force at these coordinates.     *     * The subclass may decide whether to implement this method or not     * based on the semantics and intended usage of the class.     */    virtual ViewElementList::iterator getClosestElementToLayoutX    (double x,     Event *&clef, Event *&key,     bool notesAndRestsOnly = false, int proximityThreshold = 10) {        return getViewElementList()->end();    }    /**     * Return an iterator pointing to the element "under" the given     * canvas coordinates.     *     * Return end() if there is no such element.     *     * Also return the clef and key in force at these coordinates.     *     *     * The default implementation should suit for subclasses that only     * show a single element per layout X coordinate.     */    virtual ViewElementList::iterator getElementUnderCanvasCoords    (double x, int y, Event *&clef, Event *&key) {        LinedStaffCoords layoutCoords = getLayoutCoordsForCanvasCoords(x, y);        return getElementUnderLayoutX(layoutCoords.first, clef, key);    }    /**     * Return an iterator pointing to the element "under" the given     * canvas coordinates.     *     * Return end() if there is no such element.     *     * Also return the clef and key in force at these coordinates.     *     * The subclass may decide whether to implement this method or not     * based on the semantics and intended usage of the class.     */    virtual ViewElementList::iterator getElementUnderLayoutX    (double x, Event *&clef, Event *&key) {        return getViewElementList()->end();    }    // The default implementation of the following is empty.  The    // subclass is presumed to know what the staff's name is and    // where to put it; this is simply called at some point during    // the staff-drawing process.    virtual void drawStaffName();public:    // This should not really be public -- it should be one of the    // protected methods below -- but we have some code that needs    // it and hasn't been supplied with a proper way to do without.    // Please try to avoid calling this method.    //!!! fix NotationView::doDeferredCursorMove    // This should not really be public -- it should be one of the    // protected methods below -- but we have some code that needs    // it and hasn't been supplied with a proper way to do without.    // Please try to avoid calling this method.    //!!! fix NotationView::getStaffForCanvasCoords    LinedStaffCoords    getLayoutCoordsForCanvasCoords(double x, int y) const;    // This should not really be public -- it should be one of the    // protected methods below -- but we have some code that needs    // it and hasn't been supplied with a proper way to do without.    // Please try to avoid calling this method.    //!!! fix NotationView::scrollToTime    LinedStaffCoords    getCanvasCoordsForLayoutCoords(double x, int y) const;//!!!    // This should not really be public -- it should be one of the    // protected methods below -- but we have some code that needs    // it and hasn't been supplied with a proper way to do without.    // Please try to avoid calling this method.    //!!! fix NotationView::print etc    int getRowSpacing() { return m_rowSpacing; }protected:    // Methods that the subclass may (indeed, should) use to convert    // between the layout coordinates of elements and their canvas    // coordinates.  These are deliberately not virtual.    // Note that even linear-layout staffs have multiple rows; their    // rows all have the same y coordinate but increasing x    // coordinates, instead of the other way around.  (The only reason    // for this is that it seems to be more efficient from the QCanvas    // perspective to create and manipulate many relatively short    // canvas lines rather than a smaller number of very long ones.)    int getTopLineOffset() const {        return getLineSpacing() * getLegerLineCount();    }    int getBarLineHeight() const {        return getLineSpacing() * (getLineCount() - 1) + m_lineThickness;    }    int getRowForLayoutX(double x) const {        return (int)(x / m_pageWidth);    }    int getRowForCanvasCoords(double x, int y) const;    int getCanvasYForTopOfStaff(int row = -1) const;    int getCanvasYForTopLine(int row = -1) const {        return getCanvasYForTopOfStaff(row) + getTopLineOffset();    }    double getCanvasXForLeftOfRow(int row) const;    double getCanvasXForRightOfRow(int row) const {        return getCanvasXForLeftOfRow(row) + m_pageWidth;    }    LinedStaffCoords    getCanvasOffsetsForLayoutCoords(double x, int y) const {        LinedStaffCoords cc = getCanvasCoordsForLayoutCoords(x, y);        return LinedStaffCoords(cc.first - x, cc.second - y);    }    double getCanvasXForLayoutX(double x) const;    int getRowsPerPage() const {        return m_rowsPerPage;    }protected:    // Actual implementation methods.  The default implementation    // shows staff lines, connecting lines (where appropriate) and bar    // lines, but does not show time signatures.  To see time    // signatures, override the deleteTimeSignatures and    // insertTimeSignature methods.  For repeated clefs and keys at    // the start of each row, override deleteRepeatedClefsAndKeys    // and insertRepeatedClefAndKey, but note that your layout class    // will need to allot the space for them separately.    virtual void resizeStaffLines();    virtual void clearStaffLineRow(int row);    virtual void resizeStaffLineRow(int row, double offset, double length);    virtual void deleteBars();    virtual void insertBar(double layoutX, double width, bool isCorrect,                           const TimeSignature &,                           int barNo, bool showBarNo);    // The default implementations of the following two are empty.    virtual void deleteTimeSignatures();    virtual void insertTimeSignature(double layoutX,                                     const TimeSignature &);    // The default implementations of the following two are empty.    virtual void deleteRepeatedClefsAndKeys();    virtual void insertRepeatedClefAndKey(double layoutX, int barNo);    void initCursors();protected:    //--------------- Data members ---------------------------------    QCanvas *m_canvas;    SnapGrid *m_snapGrid;    int      m_id;    double   m_x;    int      m_y;    double   m_margin;    int      m_titleHeight;    int      m_resolution;    int      m_lineThickness;        PageMode m_pageMode;    double   m_pageWidth;    int      m_rowsPerPage;    int      m_rowSpacing;    int      m_connectingLineLength;    double   m_startLayoutX;    double   m_endLayoutX;    bool     m_current;    typedef std::vector<QCanvasItem *> ItemList;    typedef std::vector<ItemList> ItemMatrix;    ItemMatrix m_staffLines;    ItemList m_staffConnectingLines;    typedef std::pair<double, QCanvasItem *> LineRec; // layout-x, line    typedef FastVector<LineRec> LineRecList;    typedef FastVector<BarLine *> BarLineList;//!!! should be multiset I reckon    static bool compareBars(const BarLine *, const BarLine *);    static bool compareBarToLayoutX(const BarLine *, int);    BarLineList m_barLines;    LineRecList m_beatLines;    LineRecList m_barConnectingLines;    ItemList m_barNumbers;    QCanvasLine *m_pointer;    QCanvasLine *m_insertCursor;    timeT m_insertCursorTime;    bool m_insertCursorTimeValid;};}#endif

⌨️ 快捷键说明

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