📄 notationstaff.h
字号:
/* -*- 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_NOTATIONSTAFF_H_#define _RG_NOTATIONSTAFF_H_#include "base/FastVector.h"#include "base/Staff.h"#include "base/ViewElement.h"#include "gui/general/LinedStaff.h"#include "gui/general/ProgressReporter.h"#include <map>#include <set>#include <string>#include <utility>#include "base/Event.h"#include "NotationElement.h"class QPainter;class QCanvasPixmap;class QCanvasItem;class QCanvas;class LinedStaffCoords;namespace Rosegarden{class ViewElement;class TimeSignature;class SnapGrid;class Segment;class QCanvasSimpleSprite;class NotePixmapParameters;class NotePixmapFactory;class Note;class NotationView;class NotationProperties;class Key;class Event;class Clef;/** * The Staff is a repository for information about the notation * representation of a single Segment. This includes all of the * NotationElements representing the Events on that Segment, the staff * lines, as well as basic positional and size data. This class * used to be in gui/staff.h, but it's been moved and renamed * following the introduction of the core Staff base class, and * much of the functionality has been extracted into the LinedStaff * base class. */class NotationStaff : public ProgressReporter, public LinedStaff{public: /** * Creates a new NotationStaff for the specified Segment * \a id is the id of the staff in the NotationView */ NotationStaff(QCanvas *, Segment *, SnapGrid *, int id, NotationView *view, std::string fontName, int resolution); virtual ~NotationStaff(); /** * Changes the resolution of the note pixmap factory and the * staff lines, etc */ virtual void changeFont(std::string fontName, int resolution); void setLegerLineCount(int legerLineCount) { if (legerLineCount == -1) m_legerLineCount = 8; else m_legerLineCount = legerLineCount; } void setBarNumbersEvery(int barNumbersEvery) { m_barNumbersEvery = barNumbersEvery; } LinedStaff::setPageMode; LinedStaff::setPageWidth; LinedStaff::setRowsPerPage; LinedStaff::setRowSpacing; LinedStaff::setConnectingLineLength; /** * Gets a read-only reference to the pixmap factory used by the * staff. (For use by NotationHLayout, principally.) This * reference isn't const because the NotePixmapFactory maintains * too much state for its methods to be const, but you should * treat the returned reference as if it were const anyway. */ virtual NotePixmapFactory& getNotePixmapFactory(bool grace) { return grace ? *m_graceNotePixmapFactory : *m_notePixmapFactory; } /** * Generate or re-generate sprites for all the elements between * from and to. Call this when you've just made a change, * specifying the extents of the change in the from and to * parameters. * * This method does not reposition any elements outside the given * range -- so after any edit that may change the visible extents * of a range, you will then need to call positionElements for the * changed range and the entire remainder of the staff. */ virtual void renderElements(NotationElementList::iterator from, NotationElementList::iterator to); /** * Assign suitable coordinates to the elements on the staff, * based entirely on the layout X and Y coordinates they were * given by the horizontal and vertical layout processes. * * This is necessary because the sprites that are being positioned * may have been created either after the layout process completed * (by renderElements) or before (by the previous renderElements * call, if the sprites are unchanged but have moved) -- so * neither the layout nor renderElements can authoritatively set * their final positions. * * This method also updates the selected-ness of any elements it * sees (i.e. it turns the selected ones blue and the unselected * ones black), and re-generates sprites for any elements for * which it seems necessary. In general it will only notice a * element needs regenerating if its position has changed, not if * the nature of the element has changed, so this is no substitute * for calling renderElements. * * The from and to arguments are used to indicate the extents of a * changed area within the staff. The actual area within which the * elements end up being repositioned will begin at the start of * the bar containing the changed area's start, and will end at the * start of the next bar whose first element hasn't moved, after * the changed area's end. * * Call this after renderElements, or after changing the selection, * passing from and to arguments corresponding to the times of those * passed to renderElements. */ virtual void positionElements(timeT from, timeT to); /** * Re-render and position elements as necessary, based on the * given extents and any information obtained from calls to * markChanged(). This provides a render-on-demand mechanism. If * you are going to use this rendering mechanism, it's generally * wise to avoid explicitly calling * renderElements/positionElements as well. * * Returns true if something needed re-rendering. */ virtual bool checkRendered(timeT from, timeT to); /** * Find something between the given times that has not yet been * rendered, and render a small amount of it. Return true if it * found something to do. This is to be used as a background work * procedure for rendering not-yet-visible areas of notation. */ virtual bool doRenderWork(timeT from, timeT to); /** * Mark a region of staff as changed, for use by the on-demand * rendering mechanism. If fromBar == toBar == -1, mark the * entire staff as changed (and recover the memory used for its * elements). Pass movedOnly as true to indicate that elements * have not changed but only been repositioned, for example as a * consequence of a modification on another staff that caused a * relayout. */ virtual void markChanged(timeT from = 0, timeT to = 0, bool movedOnly = false); /** * Set a painter as the printer output. If this painter is * non-null, subsequent renderElements calls will only render * those elements that cannot be rendered directly to a print * painter; those that can, will be rendered by renderPrintable() * instead. */ virtual void setPrintPainter(QPainter *painter); /** * Render to the current print painter those elements that can be * rendered directly to a print painter. If no print painter is * set, do nothing. */ virtual void renderPrintable(timeT from, timeT to); /** * Insert time signature at x-coordinate \a x. */ virtual void insertTimeSignature(double layoutX, const TimeSignature &timeSig); /** * Delete all time signatures */ virtual void deleteTimeSignatures(); /** * Insert repeated clef and key at start of new line, at x-coordinate \a x. */ virtual void insertRepeatedClefAndKey(double layoutX, int barNo);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -