static void _view_map_filmstrip_activate_callback(gpointer instance, gpointer user_data) { double longitude, latitude; int32_t imgid = 0; if ((imgid=dt_view_filmstrip_get_activated_imgid(darktable.view_manager))>0) { const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, imgid); longitude = cimg->longitude; latitude = cimg->latitude; dt_image_cache_read_release(darktable.image_cache, cimg); if(!isnan(longitude) && !isnan(latitude)) _view_map_center_on_location((dt_view_t*)user_data, longitude, latitude, 16); // TODO: is it better to keep the zoom level? } }
/* store current filmroll */ dt_conf_set_int("plugins/capture/current_filmroll",cv->film->id); } dt_control_log(_("new session initiated '%s'"),cv->jobcode,cv->film->id); } } const char *_capture_view_get_jobcode(const dt_view_t *view) { g_assert( view != NULL ); dt_capture_t *cv=(dt_capture_t *)view->data; return cv->jobcode; } void configure(dt_view_t *self, int wd, int ht) { //dt_capture_t *lib=(dt_capture_t*)self->data; } #define MARGIN 20 #define BAR_HEIGHT 18 /* see libs/camera.c */ void _expose_tethered_mode(dt_view_t *self, cairo_t *cr, int32_t width, int32_t height, int32_t pointerx, int32_t pointery) { dt_capture_t *lib=(dt_capture_t*)self->data; dt_camera_t *cam = (dt_camera_t*)darktable.camctl->active_camera; lib->image_over = DT_VIEW_DESERT; lib->image_id = dt_view_filmstrip_get_activated_imgid(darktable.view_manager); if( cam->is_live_viewing == TRUE) // display the preview { dt_pthread_mutex_lock(&cam->live_view_pixbuf_mutex); if(GDK_IS_PIXBUF(cam->live_view_pixbuf)) { gint pw = gdk_pixbuf_get_width(cam->live_view_pixbuf); gint ph = gdk_pixbuf_get_height(cam->live_view_pixbuf); float w = width-(MARGIN*2.0f); float h = height-(MARGIN*2.0f)-BAR_HEIGHT; float scale; if(cam->live_view_rotation%2 == 0) scale = fminf(w/pw, h/ph); else scale = fminf(w/ph, h/pw); scale = fminf(1.0, scale); cairo_translate(cr, width*0.5, (height+BAR_HEIGHT)*0.5); // origin to middle of canvas if(cam->live_view_flip == TRUE) cairo_scale(cr, -1.0, 1.0); // mirror image cairo_rotate(cr, -M_PI_2*cam->live_view_rotation); // rotate around middle if(cam->live_view_zoom == FALSE) cairo_scale(cr, scale, scale); // scale to fit canvas cairo_translate (cr, -0.5*pw, -0.5*ph); // origin back to corner gdk_cairo_set_source_pixbuf(cr, cam->live_view_pixbuf, 0, 0); cairo_paint(cr); } dt_pthread_mutex_unlock(&cam->live_view_pixbuf_mutex); } else if( lib->image_id >= 0 ) // First of all draw image if availble { cairo_translate(cr,MARGIN, MARGIN); dt_view_image_expose(&(lib->image_over), lib->image_id, cr, width-(MARGIN*2.0f), height-(MARGIN*2.0f), 1, pointerx, pointery, FALSE); } }
static void _view_map_filmstrip_activate_callback(gpointer instance, gpointer user_data) { dt_view_t *self = (dt_view_t*)user_data; dt_map_t *lib = (dt_map_t*)self->data; double longitude, latitude; int32_t imgid = 0; if ((imgid=dt_view_filmstrip_get_activated_imgid(darktable.view_manager))>0) { const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, imgid); longitude = cimg->longitude; latitude = cimg->latitude; dt_image_cache_read_release(darktable.image_cache, cimg); if(!isnan(longitude) && !isnan(latitude)) { int zoom; g_object_get(G_OBJECT(lib->map), "zoom", &zoom, NULL); _view_map_center_on_location(self, longitude, latitude, zoom); // TODO: is it better to keep the zoom level or to zoom in? 16 is a nice close up. } } }
static void _view_capture_filmstrip_activate_callback(gpointer instance, gpointer user_data) { if(dt_view_filmstrip_get_activated_imgid(darktable.view_manager) >= 0) dt_control_queue_redraw_center(); }
static void _view_print_filmstrip_activate_callback(gpointer instance,gpointer user_data) { int32_t imgid = 0; if ((imgid=dt_view_filmstrip_get_activated_imgid(darktable.view_manager))>0) _film_strip_activated(imgid,user_data); }