gboolean ags_note_edit_drawing_area_expose_event(GtkWidget *widget, GdkEventExpose *event, AgsNoteEdit *note_edit) { AgsEditor *editor; editor = (AgsEditor *) gtk_widget_get_ancestor(GTK_WIDGET(note_edit), AGS_TYPE_EDITOR); if(editor->selected_machine != NULL){ AgsMachine *machine; machine = editor->selected_machine; if(machine != NULL){ cairo_t *cr; cr = gdk_cairo_create(widget->window); cairo_push_group(cr); if(AGS_IS_PANEL(machine)){ }else if(AGS_IS_MIXER(machine)){ }else if(AGS_IS_DRUM(machine)){ ags_note_edit_draw_segment(note_edit, cr); ags_note_edit_draw_notation(note_edit, cr); }else if(AGS_IS_MATRIX(machine)){ ags_note_edit_draw_segment(note_edit, cr); ags_note_edit_draw_notation(note_edit, cr); }else if(AGS_IS_SYNTH(machine)){ ags_note_edit_draw_segment(note_edit, cr); ags_note_edit_draw_notation(note_edit, cr); }else if(AGS_IS_FFPLAYER(machine)){ ags_note_edit_draw_segment(note_edit, cr); ags_note_edit_draw_notation(note_edit, cr); } if(editor->toolbar->selected_edit_mode == editor->toolbar->position){ ags_note_edit_draw_position(note_edit, cr); } cairo_pop_group_to_source(cr); cairo_paint(cr); } } return(TRUE); }
void ags_note_edit_reset_horizontally(AgsNoteEdit *note_edit, guint flags) { AgsEditor *editor; editor = (AgsEditor *) gtk_widget_get_ancestor(GTK_WIDGET(note_edit), AGS_TYPE_EDITOR); if(editor->selected_machine != NULL){ cairo_t *cr; gdouble value; double tact_factor, zoom_factor; double tact; value = GTK_RANGE(note_edit->hscrollbar)->adjustment->value; zoom_factor = 0.25; tact_factor = exp2(8.0 - (double) gtk_combo_box_get_active(editor->toolbar->zoom)); tact = exp2((double) gtk_combo_box_get_active(editor->toolbar->zoom) - 4.0); if((AGS_NOTE_EDIT_RESET_WIDTH & flags) != 0){ note_edit->control_unit.control_width = (guint) (((double) note_edit->control_width * zoom_factor * tact)); note_edit->control_current.control_count = (guint) ((double) note_edit->control_unit.control_count * tact); note_edit->control_current.control_width = (note_edit->control_width * zoom_factor * tact_factor * tact); note_edit->map_width = (guint) ((double) note_edit->control_current.control_count * (double) note_edit->control_current.control_width); } if((AGS_NOTE_EDIT_RESET_HSCROLLBAR & flags) != 0){ GtkWidget *widget; GtkAdjustment *adjustment; guint width; widget = GTK_WIDGET(note_edit->drawing_area); adjustment = GTK_RANGE(note_edit->hscrollbar)->adjustment; if(note_edit->map_width > widget->allocation.width){ width = widget->allocation.width; // gtk_adjustment_set_upper(adjustment, (double) (note_edit->map_width - width)); gtk_adjustment_set_upper(adjustment, (gdouble) (note_edit->map_width - width)); if(adjustment->value > adjustment->upper) gtk_adjustment_set_value(adjustment, adjustment->upper); }else{ width = note_edit->map_width; gtk_adjustment_set_upper(adjustment, 0.0); gtk_adjustment_set_value(adjustment, 0.0); } note_edit->width = width; } /* reset AgsNoteEditControlCurrent */ if(note_edit->map_width > note_edit->width){ note_edit->control_current.x0 = ((guint) round((double) value)) % note_edit->control_current.control_width; if(note_edit->control_current.x0 != 0){ note_edit->control_current.x0 = note_edit->control_current.control_width - note_edit->control_current.x0; } note_edit->control_current.x1 = (note_edit->width - note_edit->control_current.x0) % note_edit->control_current.control_width; note_edit->control_current.nth_x = (guint) ceil((double)(value) / (double)(note_edit->control_current.control_width)); }else{ note_edit->control_current.x0 = 0; note_edit->control_current.x1 = 0; note_edit->control_current.nth_x = 0; } /* reset AgsNoteEditControlUnit */ if(note_edit->map_width > note_edit->width){ note_edit->control_unit.x0 = ((guint)round((double) value)) % note_edit->control_unit.control_width; if(note_edit->control_unit.x0 != 0) note_edit->control_unit.x0 = note_edit->control_unit.control_width - note_edit->control_unit.x0; note_edit->control_unit.x1 = (note_edit->width - note_edit->control_unit.x0) % note_edit->control_unit.control_width; note_edit->control_unit.nth_x = (guint) ceil(round((double) value) / (double) (note_edit->control_unit.control_width)); note_edit->control_unit.stop_x = note_edit->control_unit.nth_x + (note_edit->width - note_edit->control_unit.x0 - note_edit->control_unit.x1) / note_edit->control_unit.control_width; }else{ note_edit->control_unit.x0 = 0; note_edit->control_unit.x1 = 0; note_edit->control_unit.nth_x = 0; } /* refresh display */ if(GTK_WIDGET_VISIBLE(editor)){ gdouble position; cr = gdk_cairo_create(GTK_WIDGET(note_edit->drawing_area)->window); cairo_push_group(cr); ags_note_edit_draw_segment(note_edit, cr); ags_note_edit_draw_notation(note_edit, cr); if(editor->toolbar->selected_edit_mode == editor->toolbar->position){ ags_note_edit_draw_position(note_edit, cr); } //TODO:JK: implement me // position = gtk_range_get_value(GTK_RANGE(note_edit->hscrollbar)); // position -= floor(position / note_edit->control_current.control_width); // ags_note_edit_draw_scroll(note_edit, cr, // position); cairo_pop_group_to_source(cr); cairo_paint(cr); } } }
void ags_note_edit_reset_vertically(AgsNoteEdit *note_edit, guint flags) { AgsEditor *editor; editor = (AgsEditor *) gtk_widget_get_ancestor(GTK_WIDGET(note_edit), AGS_TYPE_EDITOR); if(editor->selected_machine != NULL){ cairo_t *cr; gdouble value; value = GTK_RANGE(note_edit->vscrollbar)->adjustment->value; if((AGS_NOTE_EDIT_RESET_VSCROLLBAR & flags) != 0){ GtkWidget *widget; GtkAdjustment *adjustment; guint height; widget = GTK_WIDGET(note_edit->drawing_area); adjustment = GTK_RANGE(note_edit->vscrollbar)->adjustment; if(note_edit->map_height > widget->allocation.height){ height = widget->allocation.height; gtk_adjustment_set_upper(adjustment, (gdouble) (note_edit->map_height - height)); gtk_adjustment_set_value(adjustment, 0.0); }else{ height = note_edit->map_height; gtk_adjustment_set_upper(adjustment, 0.0); gtk_adjustment_set_value(adjustment, 0.0); } note_edit->height = height; } note_edit->y0 = ((guint) round((double) value)) % note_edit->control_height; if(note_edit->y0 != 0){ note_edit->y0 = note_edit->control_height - note_edit->y0; } note_edit->y1 = (note_edit->height - note_edit->y0) % note_edit->control_height; note_edit->nth_y = (guint) ceil(round((double) value) / (double)(note_edit->control_height)); note_edit->stop_y = note_edit->nth_y + (note_edit->height - note_edit->y0 - note_edit->y1) / note_edit->control_height; /* refresh display */ if(GTK_WIDGET_VISIBLE(editor)){ ags_meter_paint(editor->meter); cr = gdk_cairo_create(GTK_WIDGET(note_edit->drawing_area)->window); cairo_push_group(cr); ags_note_edit_draw_segment(note_edit, cr); ags_note_edit_draw_notation(note_edit, cr); if(editor->toolbar->selected_edit_mode == editor->toolbar->position){ ags_note_edit_draw_position(note_edit, cr); } cairo_pop_group_to_source(cr); cairo_paint(cr); } } }