Commit 87a12505 authored by alex@thinkpad's avatar alex@thinkpad
Browse files

Zoom tweaks: updated for recent models

- option to disable the "x1" zoom (i.e. to go directly into x5/x10)
- compatibility with touch-screen models (still rough)
- api_test.lua updated (need to disable these tweaks in order to pass the zoom test)

--HG--
branch : lua_fix
parent 3a5bade997ca
......@@ -112,6 +112,9 @@
/** Touch screen support **/
#define CONFIG_TOUCHSCREEN
/** Intermediate "x1" zoom, before going into x5/x10 (what's the point?!) */
#define CONFIG_ZOOM_X1
/** Perfect sync using EVF_STATE **/
#define CONFIG_EVF_STATE_SYNC
......
......@@ -106,6 +106,9 @@
/** Touch screen support **/
#define CONFIG_TOUCHSCREEN
/** Intermediate "x1" zoom, before going into x5/x10 (what's the point?!) */
#define CONFIG_ZOOM_X1
/** Perfect sync using EVF_STATE **/
#define CONFIG_EVF_STATE_SYNC
......
......@@ -117,6 +117,9 @@
/** No additional_version stub on this DryOS version **/
#define CONFIG_NO_ADDITIONAL_VERSION
/** Intermediate "x1" zoom, before going into x5/x10 (what's the point?!) */
#define CONFIG_ZOOM_X1
/** Perfect sync using EVF_STATE **/
#define CONFIG_EVF_STATE_SYNC
......
......@@ -109,6 +109,9 @@
/** Touch screen support **/
#define CONFIG_TOUCHSCREEN
/** Intermediate "x1" zoom, before going into x5/x10 (what's the point?!) */
#define CONFIG_ZOOM_X1
/** Perfect sync using EVF_STATE **/
#define CONFIG_EVF_STATE_SYNC
......
......@@ -115,6 +115,9 @@
// Needs more hacking, I'll fix it once i get the EOSM - nanomad
#define CONFIG_TOUCHSCREEN
/** Intermediate "x1" zoom, before going into x5/x10 (what's the point?!) */
#define CONFIG_ZOOM_X1
/** Perfect sync using EVF_STATE **/
#define CONFIG_EVF_STATE_SYNC
......
......@@ -1224,6 +1224,10 @@ function test_lv()
sleep(2)
local old_x5 = menu.get("LiveView zoom tweaks", "Zoom x5")
local old_x10 = menu.get("LiveView zoom tweaks", "Zoom x10")
assert(menu.set("LiveView zoom tweaks", "Zoom x5", "ON"))
assert(menu.set("LiveView zoom tweaks", "Zoom x10", "ON"))
for i,z in pairs{1, 5, 10, 5, 1, 10, 1} do
printf("Setting zoom to x%d...\n", z)
lv.zoom = z
......@@ -1237,6 +1241,10 @@ function test_lv()
end
lv.wait(5)
end
assert(menu.set("LiveView zoom tweaks", "Zoom x5", old_x5))
assert(menu.set("LiveView zoom tweaks", "Zoom x10", old_x10))
assert(menu.get("LiveView zoom tweaks", "Zoom x5") == old_x5)
assert(menu.get("LiveView zoom tweaks", "Zoom x10") == old_x10)
printf("Pausing LiveView...\n")
lv.pause()
......
......@@ -310,7 +310,7 @@ PROP_HANDLER( PROP_COPYRIGHT_STRING )
char* get_video_mode_name(int include_fps)
{
static char zoom_msg[12];
snprintf(zoom_msg, sizeof(zoom_msg), "ZOOM-X%d", lv_dispsize);
snprintf(zoom_msg, sizeof(zoom_msg), "ZOOM-X%d", lv_dispsize & 0xF);
char* video_mode =
is_pure_play_photo_mode() ? "PLAY-PH" : /* Playback, reviewing a picture */
......
......@@ -158,6 +158,9 @@ static CONFIG_INT( "flash_and_no_flash", flash_and_no_flash, 0);
static CONFIG_INT( "lv_3rd_party_flash", lv_3rd_party_flash, 0);
//~ static CONFIG_INT( "zoom.enable.face", zoom_enable_face, 0);
#ifdef CONFIG_ZOOM_X1
static CONFIG_INT( "zoom.disable.x1", zoom_disable_x1, 0);
#endif
static CONFIG_INT( "zoom.disable.x5", zoom_disable_x5, 0);
static CONFIG_INT( "zoom.disable.x10", zoom_disable_x10, 0);
static CONFIG_INT( "zoom.sharpen", zoom_sharpen, 0);
......@@ -676,11 +679,44 @@ static int zoom_was_triggered_by_halfshutter = 0;
PROP_HANDLER(PROP_LV_DISPSIZE)
{
/* note: 129 is a special screen before zooming in, on newer cameras */
ASSERT(buf[0] == 1 || buf[0]==129 || buf[0] == 5 || buf[0] == 10);
/* note: 0x81 is a special screen before zooming in, on newer cameras */
int zoom = buf[0];
int new_zoom = zoom;
ASSERT(zoom == 1 || zoom == 0x81 || zoom == 5 || zoom == 10);
zoom_sharpen_step();
if (buf[0] == 1) zoom_was_triggered_by_halfshutter = 0;
if (zoom == 1) zoom_was_triggered_by_halfshutter = 0;
#ifdef FEATURE_LV_ZOOM_SETTINGS
#ifdef CONFIG_ZOOM_X1
/* FIXME: this duplicates functionality in handle_zoom_x5_x10
* that one works well, but only when triggered from the zoom button
* for touch-screen controls, this works reasonably well,
* but still stays in the disabled zoom mode for a split-second */
if (RECORDING) return;
if (zoom_disable_x1 && zoom == 0x81)
{
new_zoom = (zoom_disable_x5 ? 10 : 5);
}
if (zoom_disable_x5 && zoom == 5)
{
new_zoom = 10;
}
if (zoom_disable_x10 && zoom == 10)
{
new_zoom = 1;
}
if (new_zoom != zoom)
{
prop_request_change(PROP_LV_DISPSIZE, &new_zoom, 4);
}
#endif
#endif
}
#endif // FEATURE_LV_ZOOM_SETTINGS
......@@ -2490,15 +2526,58 @@ int handle_zoom_x5_x10(struct event * event)
if (!lv) return 1;
if (RECORDING) return 1;
if (!zoom_disable_x5 && !zoom_disable_x10) return 1;
#ifdef CONFIG_600D
if (get_disp_pressed()) return 1;
#endif
if (event->param == BGMT_PRESS_ZOOM_IN && liveview_display_idle() && !gui_menu_shown())
{
set_lv_zoom(lv_dispsize > 1 ? 1 : zoom_disable_x5 ? 10 : 5);
return 0;
/* this only covers zoom modes outside the normal sequence
* i.e. non-zoom -> x5 -> x10 or non-zoom -> x1 -> x5 -> x10 */
int new_zoom = 0;
switch (lv_dispsize)
{
case 1:
#ifdef CONFIG_ZOOM_X1
if (zoom_disable_x1) {
/* jump directly into x5/x10 (skip x1) */
new_zoom = (zoom_disable_x5 ? 10 : 5);
}
#else
if (zoom_disable_x5) {
/* jump directly into x10 (skip x5) */
new_zoom = 10;
}
#endif
break;
#ifdef CONFIG_ZOOM_X1
case 0x81:
if (zoom_disable_x5) {
/* jump from x1 to x10 (skip x5) */
new_zoom = 10;
}
break;
#endif
case 5:
if (zoom_disable_x10) {
/* skip x10, jump from x5 directly into non-zoom */
new_zoom = 1;
}
break;
case 10:
/* we never disable the non-zoom mode, nothing to do */
break;
}
if (new_zoom)
{
prop_request_change(PROP_LV_DISPSIZE, &new_zoom, 4);
return 0;
}
}
return 1;
}
......@@ -3960,6 +4039,18 @@ struct menu_entry tweak_menus_shoot[] = {
.help = "Disable x5 or x10, boost contrast/sharpness...",
.depends_on = DEP_LIVEVIEW,
.children = (struct menu_entry[]) {
#ifdef CONFIG_ZOOM_X1
{
.name = "Zoom x1",
.priv = &zoom_disable_x1,
.max = 1,
.choices = CHOICES("ON", "Disable"),
.select = zoom_x5_x10_toggle,
.help = "Disable the screen that lets you move the focus box before zooming",
.help2 = "(displayed as 'Zoom x1' on Canon' user interface)",
.icon_type = IT_DISABLE_SOME_FEATURE,
},
#endif
{
.name = "Zoom x5",
.priv = &zoom_disable_x5,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment