--- ../denemo-cvs/denemo/src/mousing.c 2007-01-24 19:44:26.000000000 +0000 +++ denemo/src/mousing.c 2007-10-21 08:04:37.000000000 +0100 @@ -18,7 +18,7 @@ offset_from_height (gdouble height, enum clefs clef) { /* Offset from the top of the staff, in half-tones. */ - gint half_tone_offset = (gint) (height / HALF_LINE_SPACE + 0.5); + gint half_tone_offset = ((gint) (height / HALF_LINE_SPACE+((height>0)?0.5:-0.5))); #define R(x) return x - half_tone_offset @@ -60,8 +60,22 @@ gtk_widget_queue_draw (gui->scorearea); staffs_from_top = gui->si->currentstaffnum - gui->si->top_staff; + // this takes account of staff->space_above and below... + + GList *curstaff; + gint extra_space = 0; + for( curstaff = gui->si->thescore; curstaff;curstaff=curstaff->next) { + extra_space += ((DenemoStaff *) curstaff->data)->space_above + + ((DenemoStaff *) curstaff->data)->space_below; + if(curstaff == gui->si->currentstaff) + break; + } + extra_space -= ((DenemoStaff *) curstaff->data)->space_below; + // g_print("Check %p and %p\n", gui->si->currentstaff, g_list_nth(gui->si->thescore,gui->si->currentstaffnum - gui->si->top_staff)); + g_print("Extra space %d\n",extra_space); + click_height = - y - (gui->si->staffspace * staffs_from_top + gui->si->staffspace / 4); + y - (gui->si->staffspace * staffs_from_top + gui->si->staffspace / 4 + extra_space); gui->si->cursor_y = offset_from_height (click_height, (enum clefs) gui->si->cursorclef); gui->si->staffletter_y = offsettonumber (gui->si->cursor_y); @@ -91,6 +105,7 @@ /* Calculate pi->staff_number, but don't go past si->bottom_staff. (It can happen if there are too few staffs to fill the drawing area from top to bottom.) */ +//FIXME broken when space_above, below as it assumes si->staffspace for each staff pi->staff_number = MIN ((si->top_staff + ((gint) y) / si->staffspace), si->bottom_staff);