From 7ccd3eef1bed400917b350b2e70d4af6c5b4a91f Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Fri, 22 Apr 2011 15:50:07 +0000 Subject: corrected some coloring stuff --- muse2/muse/midiedit/scoreedit.cpp | 69 ++++++++++++++++++--------------------- muse2/muse/midiedit/scoreedit.h | 3 +- 2 files changed, 33 insertions(+), 39 deletions(-) diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 641f3b5f..13c35c1c 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -127,14 +127,14 @@ QString create_random_string(int len=8) -QPixmap *pix_whole, *pix_half, *pix_quarter; // arrays [NUM_PARTCOLORS+2] -QPixmap *pix_dot, *pix_b, *pix_sharp, *pix_noacc; // arrays [NUM_PARTCOLORS+2] +QPixmap *pix_whole, *pix_half, *pix_quarter; // arrays [NUM_MYCOLORS] +QPixmap *pix_dot, *pix_b, *pix_sharp, *pix_noacc; // arrays [NUM_MYCOLORS] QPixmap *pix_r1, *pix_r2, *pix_r4, *pix_r8, *pix_r16; // pointers QPixmap *pix_flag_up, *pix_flag_down; // arrays [4] QPixmap *pix_num; // array [10] QPixmap *pix_clef_violin, *pix_clef_bass; //pointers -bool pixmaps_loaded=false; - +bool pixmaps_initalized=false; +QColor* mycolors; // array [NUM_MYCOLORS] @@ -431,6 +431,7 @@ void ScoreCanvas::add_staves(PartList* pl, bool all_in_one) staff.parts.clear(); for (ciPart part_it=pl->begin(); part_it!=pl->end(); part_it++) staff.parts.insert(part_it->second); + staff.cleanup_parts(); staff.split_note=SPLIT_NOTE; @@ -455,7 +456,8 @@ void ScoreCanvas::add_staves(PartList* pl, bool all_in_one) for (ciPart part_it=pl->begin(); part_it!=pl->end(); part_it++) if (part_it->second->track() == *it) staff.parts.insert(part_it->second); - + staff.cleanup_parts(); + staff.split_note=SPLIT_NOTE; staff.type=GRAND_TOP; //FINDMICH @@ -483,7 +485,7 @@ ScoreCanvas::ScoreCanvas(MidiEditor* pr, QWidget* parent_widget, setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); - load_pixmaps(); + init_pixmaps(); x_pos=0; x_left=0; @@ -754,35 +756,36 @@ void load_colored_pixmaps(QString file, QPixmap* array) { QImage img(file); - color_image(img, Qt::black); - array[BLACK_PIXMAP]=QPixmap::fromImage(img); - - color_image(img, Qt::red); - array[HIGHLIGHTED_PIXMAP]=QPixmap::fromImage(img); - - - for (int color_index=0;color_indexisPlaying() && it->is_active) color_index=HIGHLIGHTED_PIXMAP; - - + draw_pixmap(p,it->x -x_pos+x_left,y_offset + it->y,it->pix[color_index]); //TODO FINDMICH maybe draw a margin around bright colors? //maybe draw the default color in black? @@ -2275,7 +2277,7 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte if (it->is_tie_dest) { cout << "drawing tie" << endl; - draw_tie(p,it->tie_from_x-x_pos+x_left,it->x -x_pos+x_left,y_offset + it->y, (it->len==0) ? true : (it->stem==DOWNWARDS) , config.partColors[color_index]); + draw_tie(p,it->tie_from_x-x_pos+x_left,it->x -x_pos+x_left,y_offset + it->y, (it->len==0) ? true : (it->stem==DOWNWARDS) , mycolors[color_index]); // in english: "if it's a whole note, tie is upwards (true). if not, tie is upwards if // stem is downwards and vice versa" } @@ -3326,8 +3328,6 @@ bool staff_t::cleanup_parts() /* BUGS and potential bugs - * o when color=black, then the tie has a wrong color, because - * partColors[BLACK_INDEX] is out of bounds * o when the keymap is not used, this will probably lead to a bug * o when adding a note, it's added to the first stave * the problem is: there's always the first part selected @@ -3337,7 +3337,6 @@ bool staff_t::cleanup_parts() * * IMPORTANT TODO * o support selections - * o check if "moving away" works for whole notes [seems to NOT work properly] * * less important stuff * o more fine-grained redrawing in song_changed: sometimes, @@ -3355,17 +3354,11 @@ bool staff_t::cleanup_parts() * o draw measure numbers * o when moving or resizing a note, so that its end is out-of-part, * there's strange behaviour - * o ties aren't always drawn correctly when the destination note - * is out of view * o tied notes don't work properly when there's a key-change in * between, for example, when a cis is tied to a des - * o let the user select whether the preamble should have - * a fixed length (?) - * > o use timesig_t in all timesig-stuff + * o use timesig_t in all timesig-stuff * o draw a margin around notes which are in a bright color - * o maybe override color 0 with "black"? * o use bars instead of flags over groups of 8ths / 16ths etc - * o (change ItemList into map< pos_t , mutable_stuff_t >) [no] * o deal with expanding parts or clip (expanding is better) * o refuse to resize so that width gets smaller or equal than x_left * o add tracks in correct order to score diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index 2c7cdaf0..d9a0c435 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -401,6 +401,7 @@ struct cumulative_t #define BLACK_PIXMAP (NUM_PARTCOLORS) #define HIGHLIGHTED_PIXMAP (NUM_PARTCOLORS+1) +#define NUM_MYCOLORS (NUM_PARTCOLORS+2) struct timesig_t { @@ -488,7 +489,7 @@ class ScoreCanvas : public View { Q_OBJECT private: - static void load_pixmaps(); + 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); -- cgit v1.2.3