int button_pressed(dt_view_t *self, double x, double y, 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(darktable.camctl, NULL, "eoszoom", "5"); else dt_camctl_camera_set_property(darktable.camctl, NULL, "eoszoom", "1"); return 1; } return 0; }
gboolean dt_camctl_camera_start_live_view(const dt_camctl_t *c) { dt_camctl_t *camctl = (dt_camctl_t*)c; dt_camera_t *cam = (dt_camera_t*)camctl->active_camera; if( cam == NULL ) { dt_print(DT_DEBUG_CAMCTL,"[camera_control] Failed to start live view, camera==NULL\n"); return FALSE; } else dt_print(DT_DEBUG_CAMCTL,"[camera_control] Starting live view\n"); if(cam->can_live_view == FALSE) { dt_print(DT_DEBUG_CAMCTL,"[camera_control] Camera does not support live view\n"); return FALSE; } cam->is_live_viewing = TRUE; dt_camctl_camera_set_property(darktable.camctl, NULL, "eosviewfinder", "1"); pthread_create(&cam->live_view_thread, NULL, &dt_camctl_camera_get_live_view, (void*)camctl); return TRUE; }
void mouse_moved(dt_view_t *self, double x, double y, int which) { dt_capture_t *lib = (dt_capture_t*)self->data; dt_camera_t *cam = (dt_camera_t*)darktable.camctl->active_camera; // pan the zoomed live view if(cam->live_view_pan && cam->live_view_zoom && cam->is_live_viewing) { gint delta_x, delta_y; switch(cam->live_view_rotation) { case 0: delta_x = lib->live_view_zoom_cursor_x - x; delta_y = lib->live_view_zoom_cursor_y - y; break; case 1: delta_x = y - lib->live_view_zoom_cursor_y; delta_y = lib->live_view_zoom_cursor_x - x; break; case 2: delta_x = x - lib->live_view_zoom_cursor_x; delta_y = y - lib->live_view_zoom_cursor_y; break; case 3: delta_x = lib->live_view_zoom_cursor_y - y; delta_y = x - lib->live_view_zoom_cursor_x; break; default: // can't happen delta_x = delta_y = 0; } cam->live_view_zoom_x = MAX(0, cam->live_view_zoom_x + delta_x); cam->live_view_zoom_y = MAX(0, cam->live_view_zoom_y + delta_y); lib->live_view_zoom_cursor_x = x; lib->live_view_zoom_cursor_y = y; gchar str[20]; sprintf(str, "%u,%u", cam->live_view_zoom_x, cam->live_view_zoom_y); dt_camctl_camera_set_property(darktable.camctl, NULL, "eoszoomposition", str); } dt_control_queue_redraw_center(); }
static void _focus_button_clicked(GtkWidget *widget, gpointer user_data) { long int focus = (long int) user_data; if(focus >= 0 && focus <= 5) dt_camctl_camera_set_property(darktable.camctl, NULL, "manualfocusdrive", g_dgettext("libgphoto2-2", focus_array[focus])); }
/** Property changed*/ void property_changed_callback(GtkComboBox *cb,gpointer data) { dt_lib_camera_property_t *prop=(dt_lib_camera_property_t *)data; dt_camctl_camera_set_property(darktable.camctl,NULL,prop->property_name,gtk_combo_box_get_active_text(prop->values)); }
int32_t dt_camera_capture_job_run(dt_job_t *job) { dt_camera_capture_t *t=(dt_camera_capture_t*)job->param; int total = t->brackets ? t->count * t->brackets : t->count; char message[512]= {0}; double fraction=0; snprintf(message, 512, ngettext ("capturing %d image", "capturing %d images", total), total ); /* try to get exp program mode for nikon */ char *expprogram = (char *)dt_camctl_camera_get_property(darktable.camctl, NULL, "expprogram"); /* if fail, lets try fetching mode for cannon */ if(!expprogram) expprogram = (char *)dt_camctl_camera_get_property(darktable.camctl, NULL, "autoexposuremode"); /* Fetch all values for shutterspeed and initialize current value */ GList *values=NULL; gconstpointer orginal_value=NULL; const char *cvalue = dt_camctl_camera_get_property(darktable.camctl, NULL, "shutterspeed"); const char *value = dt_camctl_camera_property_get_first_choice(darktable.camctl, NULL, "shutterspeed"); /* get values for bracketing */ if (t->brackets && expprogram && expprogram[0]=='M' && value && cvalue) { do { // Add value to list values = g_list_append(values, g_strdup(value)); // Check if current values is the same as orginal value, then lets store item ptr if (strcmp(value,cvalue) == 0) orginal_value = g_list_last(values)->data; } while ((value = dt_camctl_camera_property_get_next_choice(darktable.camctl, NULL, "shutterspeed")) != NULL); } else { /* if this was an itended bracket capture bail out */ if(t->brackets) { dt_control_log(_("please set your camera to manual mode first!")); return 1; } } /* create the bgjob plate */ const guint *jid = dt_control_backgroundjobs_create(darktable.control, 0, message); GList *current_value = g_list_find(values,orginal_value); for(int i=0; i<t->count; i++) { // Delay if active if(t->delay) g_usleep(t->delay*G_USEC_PER_SEC); for(int b=0; b<(t->brackets*2)+1; b++) { // If bracket capture, lets set change shutterspeed if (t->brackets) { if (b == 0) { // First bracket, step down time with (steps*brackets), also check so we never set the longest shuttertime which would be bulb mode for(int s=0; s<(t->steps*t->brackets); s++) if (g_list_next(current_value) && g_list_next(g_list_next(current_value))) current_value = g_list_next(current_value); } else { // Step up with (steps) for(int s=0; s<t->steps; s++) if(g_list_previous(current_value)) current_value = g_list_previous(current_value); } } // set the time property for bracked capture if (t->brackets && current_value) dt_camctl_camera_set_property(darktable.camctl, NULL, "shutterspeed", current_value->data); // Capture image dt_camctl_camera_capture(darktable.camctl,NULL); fraction += 1.0/total; dt_control_backgroundjobs_progress(darktable.control, jid, fraction); } // lets reset to orginal value before continue if (t->brackets) { current_value = g_list_find(values,orginal_value); dt_camctl_camera_set_property(darktable.camctl, NULL, "shutterspeed", current_value->data); } } dt_control_backgroundjobs_destroy(darktable.control, jid); // free values if(values) { for(int i=0; i<g_list_length(values); i++) g_free(g_list_nth_data(values,i)); g_list_free(values); } return 0; }