* Updates the settings of the current job with the values currently being * entered by the user. This function is called every time the text in the * spin button changes but doesn't change the values currently displayed. * However, if the user starts the encode, the updated value will be used. */
| 3434 | * However, if the user starts the encode, the updated value will be used. |
| 3435 | */ |
| 3436 | static void |
| 3437 | ptop_update_bg (int side_changed, double new_val, gpointer data) |
| 3438 | { |
| 3439 | double start_val = 0.0, end_val = 0.0, min_val, max_val; |
| 3440 | int64_t start_int = 0, end_int = 0; |
| 3441 | GtkAdjustment *start_adj, *end_adj; |
| 3442 | signal_user_data_t *ud = ghb_ud(); |
| 3443 | GhbValue *range = ghb_get_job_range_settings(ud->settings); |
| 3444 | |
| 3445 | start_adj = GTK_ADJUSTMENT(ghb_builder_object("start_point_adj")); |
| 3446 | end_adj = GTK_ADJUSTMENT(ghb_builder_object("end_point_adj")); |
| 3447 | start_val = gtk_adjustment_get_value(start_adj); |
| 3448 | end_val = gtk_adjustment_get_value(end_adj); |
| 3449 | |
| 3450 | if (side_changed == PTOP_START) |
| 3451 | { |
| 3452 | min_val = gtk_adjustment_get_lower(start_adj); |
| 3453 | max_val = gtk_adjustment_get_upper(start_adj); |
| 3454 | |
| 3455 | if (new_val < min_val) start_val = min_val; |
| 3456 | else if (new_val > max_val) start_val = max_val; |
| 3457 | else start_val = new_val; |
| 3458 | |
| 3459 | end_val = (end_val > start_val) ? end_val : start_val; |
| 3460 | } |
| 3461 | else |
| 3462 | { |
| 3463 | min_val = gtk_adjustment_get_lower(end_adj); |
| 3464 | max_val = gtk_adjustment_get_upper(end_adj); |
| 3465 | |
| 3466 | if (new_val < min_val) end_val = min_val; |
| 3467 | else if (new_val > max_val) end_val = max_val; |
| 3468 | else end_val = new_val; |
| 3469 | |
| 3470 | start_val = (end_val > start_val) ? start_val : end_val; |
| 3471 | } |
| 3472 | |
| 3473 | if (ghb_settings_combo_int(ud->settings, "PtoPType") == 1) |
| 3474 | { |
| 3475 | start_int = (int64_t) nearbyint(start_val * 90000); |
| 3476 | end_int = (int64_t) nearbyint(end_val * 90000); |
| 3477 | |
| 3478 | if (start_int == end_int) |
| 3479 | { |
| 3480 | if (side_changed == PTOP_START && start_int > 0) |
| 3481 | start_int -= 1; |
| 3482 | else |
| 3483 | end_int += 1; |
| 3484 | } |
| 3485 | ghb_dict_set_double(ud->settings, "start_point", start_val); |
| 3486 | ghb_dict_set_double(ud->settings, "end_point", end_val); |
| 3487 | } |
| 3488 | else |
| 3489 | { |
| 3490 | start_int = (int64_t) nearbyint(start_val); |
| 3491 | end_int = (int64_t) nearbyint(end_val); |
| 3492 | |
| 3493 | ghb_dict_set_int(ud->settings, "start_point", start_int); |
no test coverage detected