summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-04-22 12:54:22 +0000
committerFlorian Jung <flo@windfisch.org>2011-04-22 12:54:22 +0000
commit28e33a32c35775f73fe6fce4049ff76cc198c0ae (patch)
treee38d2e6d875a0768424cd64582d66965010d6d82 /muse2
parente544d366103630a39d72998bcef2e4970d0d0ea1 (diff)
the user can now set pixels_per_whole
Diffstat (limited to 'muse2')
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp29
-rw-r--r--muse2/muse/midiedit/scoreedit.h5
2 files changed, 31 insertions, 3 deletions
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index 143daac5..641f3b5f 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -247,6 +247,14 @@ ScoreEdit::ScoreEdit(PartList* pl, QWidget* parent, const char* name, unsigned i
quant_len_toolbar->addWidget(quant_combobox);
quant_combobox->setCurrentIndex(2);
+ quant_len_toolbar->addWidget(new QLabel(tr("Pixels per whole:"), quant_len_toolbar));
+ QSpinBox* px_per_whole_spinbox = new QSpinBox(this);
+ px_per_whole_spinbox->setRange(10, 1000);
+ px_per_whole_spinbox->setSingleStep(50);
+ connect(px_per_whole_spinbox, SIGNAL(valueChanged(int)), score_canvas, SLOT(set_pixels_per_whole(int)));
+ connect(score_canvas, SIGNAL(pixels_per_whole_changed(int)), px_per_whole_spinbox, SLOT(setValue(int)));
+ quant_len_toolbar->addWidget(px_per_whole_spinbox);
+ px_per_whole_spinbox->setValue(300);
QMenu* settings_menu = menuBar()->addMenu(tr("&Settings"));
@@ -492,6 +500,7 @@ ScoreCanvas::ScoreCanvas(MidiEditor* pr, QWidget* parent_widget,
set_quant(2); //this is actually unneccessary, as while
//initalizing the quant_combobox, this gets
//called again. but for safety...
+ set_pixels_per_whole(300); //same as above. but safety rocks
dragging_staff=false;
@@ -3215,7 +3224,11 @@ void ScoreCanvas::set_quant(int val)
if ((val>=0) && (val<signed(sizeof(quant_mapper)/sizeof(*quant_mapper))))
{
+ int old_len=quant_len();
+
_quant_power2=quant_mapper[val];
+
+ set_pixels_per_whole(pixels_per_whole() * quant_len() / old_len );
song_changed(SC_EVENT_INSERTED);
}
@@ -3225,6 +3238,19 @@ void ScoreCanvas::set_quant(int val)
}
}
+void ScoreCanvas::set_pixels_per_whole(int val)
+{
+ cout << "DEBUG: setting px per whole to " << val << endl;
+ _pixels_per_whole=val;
+
+ for (list<staff_t>::iterator it=staves.begin(); it!=staves.end(); it++)
+ it->calc_item_pos();
+
+ emit pixels_per_whole_changed(val);
+
+ redraw();
+}
+
void ScoreCanvas::cleanup_staves()
{
for (list<staff_t>::iterator it=staves.begin(); it!=staves.end();)
@@ -3307,10 +3333,9 @@ bool staff_t::cleanup_parts()
* the problem is: there's always the first part selected
*
* CURRENT TODO
- * o automatically set x-raster (by quant. strength)
+ * o let the user select the currently edited part
*
* IMPORTANT TODO
- * o let the user select the currently edited part
* o support selections
* o check if "moving away" works for whole notes [seems to NOT work properly]
*
diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h
index f512f7a0..2c7cdaf0 100644
--- a/muse2/muse/midiedit/scoreedit.h
+++ b/muse2/muse/midiedit/scoreedit.h
@@ -544,6 +544,7 @@ class ScoreCanvas : public View
// member variables ---------------------------------------------------
int _quant_power2;
+ int _pixels_per_whole;
std::map<int,int> pos_add_list;
@@ -632,6 +633,7 @@ class ScoreCanvas : public View
void menu_command(int);
void preamble_keysig_slot(bool);
void preamble_timesig_slot(bool);
+ void set_pixels_per_whole(int);
signals:
void xscroll_changed(int);
@@ -640,6 +642,7 @@ class ScoreCanvas : public View
void canvas_width_changed(int);
void viewport_height_changed(int);
void canvas_height_changed(int);
+ void pixels_per_whole_changed(int);
protected:
virtual void draw(QPainter& p, const QRect& rect);
@@ -664,7 +667,7 @@ class ScoreCanvas : public View
int quant_power2() { return _quant_power2; }
int quant_len() { return (1<<_quant_power2); }
int quant_ticks() { return TICKS_PER_WHOLE / (1<<_quant_power2); }
- int pixels_per_whole() { return 320; } //TODO FINDMICHJETZT
+ int pixels_per_whole() { return _pixels_per_whole; }
int note_x_indent() { return pixels_per_whole()/quant_len()/2; }
};