mirror of
https://git.sr.ht/~martijnbraam/megapixels
synced 2023-12-14 05:32:55 +01:00
Read slider value when changing from auto to manual
The user might have moved the slider while in Auto. When exiting Auto mode the value and the slider will be desynced. This change syncs the value with the slider position when entering Manual mode.
This commit is contained in:
parent
cd1d030886
commit
29ad14c78b
20
main.c
20
main.c
|
@ -454,6 +454,26 @@ on_control_auto_toggled(GtkToggleButton *widget, gpointer user_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_changed) {
|
if (has_changed) {
|
||||||
|
// The slider might have been moved while Auto mode is active. When entering
|
||||||
|
// Manual mode, first read the slider value to sync with those changes.
|
||||||
|
double value = gtk_adjustment_get_value(control_slider);
|
||||||
|
switch (current_control) {
|
||||||
|
case USER_CONTROL_ISO:
|
||||||
|
if (value != gain) {
|
||||||
|
gain = (int)value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case USER_CONTROL_SHUTTER: {
|
||||||
|
// So far all sensors use exposure time in number of sensor rows
|
||||||
|
int new_exposure =
|
||||||
|
(int)(value / 360.0 * camera->capture_mode.height);
|
||||||
|
if (new_exposure != exposure) {
|
||||||
|
exposure = new_exposure;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
update_io_pipeline();
|
update_io_pipeline();
|
||||||
draw_controls();
|
draw_controls();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue