summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-09-15 13:58:49 +0000
committerFlorian Jung <flo@windfisch.org>2011-09-15 13:58:49 +0000
commit3db6cf944f795c7624feec34945051d9c0bf0aac (patch)
tree979800b1a75cc8468a7d5fc4b5133361c9d3dc28
parent6a5abb59003761e068212e6f3e185b480484e2d2 (diff)
added grand staff brace (akkolade) for score editor
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp65
-rw-r--r--muse2/muse/midiedit/scoreedit.h5
-rw-r--r--muse2/share/locale/muse_de.ts2
3 files changed, 60 insertions, 12 deletions
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index 7b458fad..491cbc3e 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -123,6 +123,9 @@ QString IntToQStr(int i);
+#define AKKOLADE_WIDTH 8
+#define AKKOLADE_LEFTMARGIN 0
+#define AKKOLADE_RIGHTMARGIN 2
#define STAFF_DISTANCE (10*YLEN)
#define GRANDSTAFF_DISTANCE (8*YLEN)
#define NOTE_YDIST 20
@@ -2125,6 +2128,29 @@ void ScoreCanvas::draw_tie (QPainter& p, int x1, int x4, int yo, bool up, QColor
p.drawPath(path);
}
+void ScoreCanvas::draw_akkolade (QPainter& p, int x, int y_)
+{
+ QPainterPath path;
+
+ qreal h = (2*2*YLEN+GRANDSTAFF_DISTANCE) /2.0 +3; //this is only the half height
+ qreal w = AKKOLADE_WIDTH;
+ int y = y_ -h;
+
+ const double X1 = 2.0 * w;
+ const double X2 = -0.7096 * w;
+ const double X3 = -1.234 * w;
+ const double X4 = 1.734 * w;
+
+ path.moveTo(x+ 0, y+ h);
+ path.cubicTo(x+ X1, y+ h + h * .3359, x+ X2, y+ h + h * .5089, x+ w, y+ 2 * h);
+ path.cubicTo(x+ X3, y+ h + h * .5025, x+ X4, y+ h + h * .2413, x+ 0, y+ h);
+ path.cubicTo(x+ X1, y+ h - h * .3359, x+ X2, y+ h - h * .5089, x+ w, y+ 0);
+ path.cubicTo(x+ X3, y+ h - h * .5025, x+ X4, y+ h - h * .2413, x+ 0, y+ h);
+
+ p.setBrush(Qt::black);
+ p.drawPath(path);
+}
+
void ScoreCanvas::draw_accidentials(QPainter& p, int x, int y_offset, const list<int>& acc_list, const QPixmap& pix)
{
int n_acc_drawn=0;
@@ -2757,14 +2783,15 @@ QRect FloItem::bbox() const
return bbox_center(x,y,pix->size());
}
-void ScoreCanvas::draw_note_lines(QPainter& p, int y)
+void ScoreCanvas::draw_note_lines(QPainter& p, int y, bool reserve_akkolade_space)
{
+ int xbegin = reserve_akkolade_space ? AKKOLADE_LEFTMARGIN+AKKOLADE_WIDTH+AKKOLADE_RIGHTMARGIN : 0;
int xend=width();
p.setPen(Qt::black);
for (int i=0;i<5;i++)
- p.drawLine(0,y + i*YLEN - 2*YLEN,xend,y + i*YLEN - 2*YLEN);
+ p.drawLine(xbegin, y + i*YLEN - 2*YLEN, xend, y + i*YLEN - 2*YLEN);
}
@@ -3272,18 +3299,30 @@ int clef_height(clef_t clef)
#define CLEF_LEFTMARGIN 5
#define CLEF_RIGHTMARGIN 5
-void ScoreCanvas::draw_preamble(QPainter& p, int y_offset, clef_t clef)
+void ScoreCanvas::draw_preamble(QPainter& p, int y_offset, clef_t clef, bool reserve_akkolade_space, bool with_akkolade)
{
int x_left_old=x_left;
int tick=x_to_tick(x_pos);
-
+
+ // maybe draw akkolade ----------------------------------------------
+ if (reserve_akkolade_space)
+ {
+ if (with_akkolade)
+ draw_akkolade(p, AKKOLADE_LEFTMARGIN, y_offset+GRANDSTAFF_DISTANCE/2);
+
+ x_left= AKKOLADE_LEFTMARGIN + AKKOLADE_WIDTH + AKKOLADE_RIGHTMARGIN;
+ }
+ else
+ x_left=0;
+
+
// draw clef --------------------------------------------------------
QPixmap* pix_clef= (clef==BASS) ? pix_clef_bass : pix_clef_violin;
int y_coord=2*YLEN - ( clef_height(clef) -2)*YLEN/2;
- draw_pixmap(p,CLEF_LEFTMARGIN + pix_clef->width()/2,y_offset + y_coord,*pix_clef);
+ draw_pixmap(p,x_left + CLEF_LEFTMARGIN + pix_clef->width()/2,y_offset + y_coord,*pix_clef);
- x_left= CLEF_LEFTMARGIN + pix_clef->width() + CLEF_RIGHTMARGIN;
+ x_left+= CLEF_LEFTMARGIN + pix_clef->width() + CLEF_RIGHTMARGIN;
// draw accidentials ------------------------------------------------
@@ -3373,11 +3412,19 @@ void ScoreCanvas::draw(QPainter& p, const QRect&)
p.setPen(Qt::black);
+ bool reserve_akkolade_space=false;
+ for (list<staff_t>::iterator it=staves.begin(); it!=staves.end(); it++)
+ if (it->type==GRAND_TOP)
+ {
+ reserve_akkolade_space=true;
+ break;
+ }
+
for (list<staff_t>::iterator it=staves.begin(); it!=staves.end(); it++)
{
//TODO: maybe only draw visible staves?
- draw_note_lines(p,it->y_draw - y_pos);
- draw_preamble(p,it->y_draw - y_pos, it->clef);
+ draw_note_lines(p,it->y_draw - y_pos, reserve_akkolade_space);
+ draw_preamble(p,it->y_draw - y_pos, it->clef, reserve_akkolade_space, (it->type==GRAND_TOP));
p.setClipRect(x_left+1,0,p.device()->width(),p.device()->height());
draw_items(p,it->y_draw - y_pos, *it);
p.setClipping(false);
@@ -4536,6 +4583,7 @@ void ScoreCanvas::add_new_parts(const std::map< Part*, std::set<Part*> >& param)
* changing "share" status, the changed state isn't stored
* ? pasting in editors sometimes fails oO? ( ERROR: reading eventlist
* from clipboard failed. ignoring this one... ) [ not reproducible ]
+ * o cakewalk-mode is ignored when saving config
*
* CURRENT TODO
* ! o fix sigedit boxes (see also "important todo")
@@ -4561,7 +4609,6 @@ void ScoreCanvas::add_new_parts(const std::map< Part*, std::set<Part*> >& param)
* > o investigate with valgrind
* o controller view in score editor
* o solo button
- * > o grand staff brace
* > o drum editor: channel-stuff
* > o do partial recalculating; recalculating can take pretty long
* (0,5 sec) when displaying a whole song in scores
diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h
index 709a26ee..046fbf73 100644
--- a/muse2/muse/midiedit/scoreedit.h
+++ b/muse2/muse/midiedit/scoreedit.h
@@ -613,6 +613,7 @@ class ScoreCanvas : public MusEWidget::View
static void init_pixmaps();
static void draw_pixmap(QPainter& p, int x, int y, const QPixmap& pm);
static void draw_tie (QPainter& p, int x1, int x4, int yo, bool up=true, QColor color=Qt::black);
+ static void draw_akkolade (QPainter& p, int x, int y);
static void draw_accidentials(QPainter& p, int x, int y_offset, const list<int>& acc_list, const QPixmap& pix);
@@ -632,8 +633,8 @@ class ScoreCanvas : public MusEWidget::View
- void draw_note_lines(QPainter& p, int y);
- void draw_preamble(QPainter& p, int y, clef_t clef);
+ void draw_note_lines(QPainter& p, int y, bool reserve_akkolade_space=false);
+ void draw_preamble(QPainter& p, int y, clef_t clef, bool reserve_akkolade_space=false, bool with_akkolade=false);
void draw_items(QPainter& p, int y, staff_t& staff, ScoreItemList::iterator from_it, ScoreItemList::iterator to_it);
void draw_items(QPainter& p, int y, staff_t& staff, int x1, int x2);
void draw_items(QPainter& p, int y, staff_t& staff);
diff --git a/muse2/share/locale/muse_de.ts b/muse2/share/locale/muse_de.ts
index 03a0d37b..48f16001 100644
--- a/muse2/share/locale/muse_de.ts
+++ b/muse2/share/locale/muse_de.ts
@@ -10846,7 +10846,7 @@ Right-click to show GUI.</source>
<message>
<location line="+3"/>
<source>all parts in one staff</source>
- <translation>alle Parts in einem System</translation>
+ <translation type="unfinished">alle Parts in ein System</translation>
</message>
<message>
<location line="+1"/>