int button_released(dt_view_t *self, double x, double y, int which, uint32_t state) { dt_library_t *lib = (dt_library_t *)self->data; lib->pan = 0; if(which == 1) dt_control_change_cursor(GDK_LEFT_PTR); return 1; }
static gboolean _lib_histogram_leave_notify_callback(GtkWidget *widget, GdkEventCrossing *event, gpointer user_data) { dt_lib_module_t *self = (dt_lib_module_t *)user_data; dt_lib_histogram_t *d = (dt_lib_histogram_t *)self->data; d->dragging = 0; d->highlight = 0; dt_control_change_cursor(GDK_LEFT_PTR); gtk_widget_queue_draw(widget); return TRUE; }
void mouse_leave(dt_view_t *self) { // if we are not hovering over a thumbnail in the filmstrip -> show metadata of opened image. dt_develop_t *dev = (dt_develop_t *)self->data; int32_t mouse_over_id = dev->image_storage.id; DT_CTL_SET_GLOBAL(lib_image_mouse_over_id, mouse_over_id); // reset any changes the selected plugin might have made. dt_control_change_cursor(GDK_LEFT_PTR); }
int button_released(dt_view_t *self, double x, double y, int which, uint32_t state) { dt_camera_t *cam = (dt_camera_t *)darktable.camctl->active_camera; if(which == 1) { cam->live_view_pan = FALSE; dt_control_change_cursor(GDK_LEFT_PTR); return 1; } return 0; }
int button_released(dt_view_t *self, double x, double y, int which, uint32_t state) { const int32_t capwd = darktable.thumbnail_width; const int32_t capht = darktable.thumbnail_height; dt_develop_t *dev = darktable.develop; const int32_t width_i = self->width; const int32_t height_i = self->height; if(width_i > capwd) x += (capwd-width_i) *.5f; if(height_i > capht) y += (capht-height_i)*.5f; int handled = 0; if(dev->gui_module && dev->gui_module->button_released) handled = dev->gui_module->button_released(dev->gui_module, x, y, which, state); if(handled) return handled; if(which == 1) dt_control_change_cursor(GDK_LEFT_PTR); return 1; }
int button_pressed(dt_view_t *self, double x, double y, double pressure, int which, int type, uint32_t state) { dt_camera_t *cam = (dt_camera_t *)darktable.camctl->active_camera; dt_capture_t *lib = (dt_capture_t *)self->data; if(which == 1 && cam->is_live_viewing && cam->live_view_zoom) { cam->live_view_pan = TRUE; lib->live_view_zoom_cursor_x = x; lib->live_view_zoom_cursor_y = y; dt_control_change_cursor(GDK_HAND1); return 1; } else if((which == 2 || which == 3) && cam->is_live_viewing) // zoom the live view { cam->live_view_zoom = !cam->live_view_zoom; if(cam->live_view_zoom == TRUE) dt_camctl_camera_set_property_string(darktable.camctl, NULL, "eoszoom", "5"); else dt_camctl_camera_set_property_string(darktable.camctl, NULL, "eoszoom", "1"); return 1; } return 0; }
static gboolean _lib_histogram_enter_notify_callback(GtkWidget *widget, GdkEventCrossing *event, gpointer user_data) { dt_control_change_cursor(GDK_HAND1); return TRUE; }
static gboolean _lib_filmstrip_size_handle_cursor_callback(GtkWidget *w, GdkEventCrossing *e, gpointer user_data) { dt_control_change_cursor( (e->type==GDK_ENTER_NOTIFY)?GDK_SB_V_DOUBLE_ARROW:GDK_LEFT_PTR); return TRUE; }
int button_pressed(dt_view_t *self, double x, double y, int which, int type, uint32_t state) { dt_library_t *lib = (dt_library_t *)self->data; lib->modifiers = state; lib->button = which; lib->select_offset_x = lib->zoom_x; lib->select_offset_y = lib->zoom_y; lib->select_offset_x += x; lib->select_offset_y += y; lib->pan = 1; if(which == 1) dt_control_change_cursor(GDK_HAND1); if(which == 1 && type == GDK_2BUTTON_PRESS) return 0; // image button pressed? if(which == 1) { switch(lib->image_over) { case DT_VIEW_DESERT: break; case DT_VIEW_REJECT: case DT_VIEW_STAR_1: case DT_VIEW_STAR_2: case DT_VIEW_STAR_3: case DT_VIEW_STAR_4: case DT_VIEW_STAR_5: { int32_t mouse_over_id; DT_CTL_GET_GLOBAL(mouse_over_id, lib_image_mouse_over_id); const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, mouse_over_id); dt_image_t *image = dt_image_cache_write_get(darktable.image_cache, cimg); if(image) { if(lib->image_over == DT_VIEW_STAR_1 && ((image->flags & 0x7) == 1)) image->flags &= ~0x7; else if(lib->image_over == DT_VIEW_REJECT && ((image->flags & 0x7) == 6)) image->flags &= ~0x7; else { image->flags &= ~0x7; image->flags |= lib->image_over; } dt_image_cache_write_release(darktable.image_cache, image, DT_IMAGE_CACHE_SAFE); } dt_image_cache_read_release(darktable.image_cache, image); break; } case DT_VIEW_GROUP: { int32_t mouse_over_id; DT_CTL_GET_GLOBAL(mouse_over_id, lib_image_mouse_over_id); const dt_image_t *image = dt_image_cache_read_get(darktable.image_cache, mouse_over_id); if(!image) return 0; int group_id = image->group_id; int id = image->id; dt_image_cache_read_release(darktable.image_cache, image); if(state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) // just add the whole group to the selection. TODO: make this also work for collapsed groups. { sqlite3_stmt *stmt; DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "insert or ignore into selected_images select id from images where group_id = ?1", -1, &stmt, NULL); DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, group_id); sqlite3_step(stmt); sqlite3_finalize(stmt); } else if(group_id == darktable.gui->expanded_group_id) // the group is already expanded, so ... { if(id == darktable.gui->expanded_group_id) // ... collapse it darktable.gui->expanded_group_id = -1; else // ... make the image the new representative of the group darktable.gui->expanded_group_id = dt_grouping_change_representative(id); } else // expand the group darktable.gui->expanded_group_id = group_id; dt_collection_update_query(darktable.collection); break; } default: return 0; } } return 1; }
int button_pressed(dt_view_t *self, double x, double y, int which, int type, uint32_t state) { const int32_t capwd = darktable.thumbnail_width; const int32_t capht = darktable.thumbnail_height; dt_develop_t *dev = (dt_develop_t *)self->data; const int32_t width_i = self->width; const int32_t height_i = self->height; if(width_i > capwd) x += (capwd-width_i) *.5f; if(height_i > capht) y += (capht-height_i)*.5f; int handled = 0; if(dev->gui_module && dev->gui_module->request_color_pick && which == 1) { float zoom_x, zoom_y; dt_dev_get_pointer_zoom_pos(dev, x, y, &zoom_x, &zoom_y); if(darktable.lib->proxy.colorpicker.size) { dev->gui_module->color_picker_box[0] = .5f+zoom_x; dev->gui_module->color_picker_box[1] = .5f+zoom_y; dev->gui_module->color_picker_box[2] = .5f+zoom_x; dev->gui_module->color_picker_box[3] = .5f+zoom_y; } else { dev->gui_module->color_picker_point[0] = .5f+zoom_x; dev->gui_module->color_picker_point[1] = .5f+zoom_y; dev->preview_pipe->changed |= DT_DEV_PIPE_SYNCH; dt_dev_invalidate_all(dev); } dt_control_queue_redraw(); return 1; } if(dev->gui_module && dev->gui_module->button_pressed) handled = dev->gui_module->button_pressed(dev->gui_module, x, y, which, type, state); if(handled) return handled; if(which == 1 && type == GDK_2BUTTON_PRESS) return 0; if(which == 1) { dt_control_change_cursor(GDK_HAND1); return 1; } if(which == 2) { // zoom to 1:1 2:1 and back dt_dev_zoom_t zoom; int closeup, procw, proch; float zoom_x, zoom_y; DT_CTL_GET_GLOBAL(zoom, dev_zoom); DT_CTL_GET_GLOBAL(closeup, dev_closeup); DT_CTL_GET_GLOBAL(zoom_x, dev_zoom_x); DT_CTL_GET_GLOBAL(zoom_y, dev_zoom_y); dt_dev_get_processed_size(dev, &procw, &proch); const float scale = dt_dev_get_zoom_scale(dev, zoom, closeup ? 2 : 1, 0); zoom_x += (1.0/scale)*(x - .5f*dev->width )/procw; zoom_y += (1.0/scale)*(y - .5f*dev->height)/proch; if(zoom == DT_ZOOM_1) { if(!closeup) closeup = 1; else { zoom = DT_ZOOM_FIT; zoom_x = zoom_y = 0.0f; closeup = 0; } } else zoom = DT_ZOOM_1; dt_dev_check_zoom_bounds(dev, &zoom_x, &zoom_y, zoom, closeup, NULL, NULL); DT_CTL_SET_GLOBAL(dev_zoom, zoom); DT_CTL_SET_GLOBAL(dev_closeup, closeup); DT_CTL_SET_GLOBAL(dev_zoom_x, zoom_x); DT_CTL_SET_GLOBAL(dev_zoom_y, zoom_y); dt_dev_invalidate(dev); return 1; } return 0; }