Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion res/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
#define IDC_TITLE_BAR_FORMAT 1052
#define IDC_SHRINK_BLIT_MODE_STATIC 1053
#define IDC_MAGNIFY_BLIT_MODE_STATIC 1054
#define IDC_ESCAPE_CLOSES_CHECKBOX 1067

// Next default values for new objects
//
Expand All @@ -98,7 +99,7 @@
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 130
#define _APS_NEXT_COMMAND_VALUE 40048
#define _APS_NEXT_CONTROL_VALUE 1055
#define _APS_NEXT_CONTROL_VALUE 1068
#define _APS_NEXT_SYMED_VALUE 109
#endif
#endif
5 changes: 3 additions & 2 deletions res/voidImageViewer.rc
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ BEGIN
COMBOBOX IDC_RIGHTCLICKACTION,74,17,119,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "&Mouse wheel action:",IDC_STATIC,0,36,72,8
COMBOBOX IDC_MOUSEWHEELACTION,74,34,119,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "&Commands:",IDC_STATIC,0,53,57,8
LISTBOX IDC_COMMANDS_LIST,0,64,193,78,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
CONTROL "Escape &key closes the viewer",IDC_ESCAPE_CLOSES_CHECKBOX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,0,53,193,10
LTEXT "&Commands:",IDC_STATIC,0,70,57,8
LISTBOX IDC_COMMANDS_LIST,0,81,193,61,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Settings for selected command",IDC_STATIC,0,148,193,67
LISTBOX IDC_KEYS_LIST,7,158,125,50,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Add...",IDC_ADD_KEY,138,158,50,14
Expand Down
3 changes: 3 additions & 0 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ BYTE config_prevent_sleep = 1;
BYTE config_loop_animations_once = 1;
BYTE config_mouse_wheel_action = 0; // 0 = zoom, 1 = next/prev, 2=prev/next
BYTE config_ctrl_mouse_wheel_action = 0; // 0 = zoom, 1 = next/prev, 2=prev/next
BYTE config_escape_closes = 1; // escape closes the viewer when there is nothing to cancel and we are not fullscreen.
BYTE config_left_click_action = 0; // 0 = scroll, 1 = play/pause slideshow, 2 = play/pause animation, 3=zoom in, 4=next, 5=1:1 scroll, 6=move-window
BYTE config_right_click_action = 0; // 0 = context menu, 1=zoom out, 2=prev,
BYTE config_xbutton_action = 2; // 1=zoom, 2=next
Expand Down Expand Up @@ -131,6 +132,7 @@ static void _config_load_settings_by_location(const wchar_t *path,int is_root)
config_frame_minus = ini_get_int(ini,(const utf8_t *)"frame_minus",config_frame_minus);
config_mouse_wheel_action = ini_get_int(ini,(const utf8_t *)"mouse_wheel_action",config_mouse_wheel_action);
config_ctrl_mouse_wheel_action = ini_get_int(ini,(const utf8_t *)"ctrl_mouse_wheel_action",config_ctrl_mouse_wheel_action);
config_escape_closes = ini_get_int(ini,(const utf8_t *)"escape_closes",config_escape_closes);
config_left_click_action = ini_get_int(ini,(const utf8_t *)"left_click_action",config_left_click_action);
config_right_click_action = ini_get_int(ini,(const utf8_t *)"right_click_action",config_right_click_action);
config_xbutton_action = ini_get_int(ini,(const utf8_t *)"xbutton_action",config_xbutton_action);
Expand Down Expand Up @@ -315,6 +317,7 @@ static void _config_save_settings_by_location(const wchar_t *path,int is_root)
_config_write_int(h,"frame_minus",config_frame_minus);
_config_write_int(h,"mouse_wheel_action",config_mouse_wheel_action);
_config_write_int(h,"ctrl_mouse_wheel_action",config_ctrl_mouse_wheel_action);
_config_write_int(h,"escape_closes",config_escape_closes);
_config_write_int(h,"left_click_action",config_left_click_action);
_config_write_int(h,"right_click_action",config_right_click_action);
_config_write_int(h,"xbutton_action",config_xbutton_action);
Expand Down
1 change: 1 addition & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ extern BYTE config_prevent_sleep;
extern BYTE config_loop_animations_once;
extern BYTE config_mouse_wheel_action;
extern BYTE config_ctrl_mouse_wheel_action;
extern BYTE config_escape_closes;
extern BYTE config_left_click_action;
extern BYTE config_right_click_action;
extern BYTE config_xbutton_action;
Expand Down
1 change: 1 addition & 0 deletions src/localization.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ enum
LOCALIZATION_ID_LEFT_CLICK_ACTION_STATIC,
LOCALIZATION_ID_RIGHT_CLICK_ACTION_STATIC,
LOCALIZATION_ID_MOUSE_WHEEL_ACTION_STATIC,
LOCALIZATION_ID_ESCAPE_CLOSES_CHECKBOX,
LOCALIZATION_ID_COMMANDS_STATIC,
LOCALIZATION_ID_SETTINGS_FOR_SELECTED_COMMAND,
LOCALIZATION_ID_ADD_KEY_BUTTON,
Expand Down
1 change: 1 addition & 0 deletions src/localization_en_us.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ static const utf8_t *_localization_string_array_en_us[LOCALIZATION_ID_COUNT] =
"&Left click action:", // LOCALIZATION_ID_LEFT_CLICK_ACTION_STATIC,
"&Right click action:", // LOCALIZATION_ID_RIGHT_CLICK_ACTION_STATIC,
"&Mouse wheel action:", // LOCALIZATION_ID_MOUSE_WHEEL_ACTION_STATIC,
"Escape &key closes the viewer", // LOCALIZATION_ID_ESCAPE_CLOSES_CHECKBOX,
"&Commands:", // LOCALIZATION_ID_COMMANDS_STATIC,
"Settings for selected command", // LOCALIZATION_ID_SETTINGS_FOR_SELECTED_COMMAND,
"&Add...", // LOCALIZATION_ID_ADD_KEY_BUTTON,
Expand Down
1 change: 1 addition & 0 deletions src/localization_zh_cn.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ static const utf8_t *_localization_string_array_zh_cn[LOCALIZATION_ID_COUNT] =
"左键操作(&L):", // LOCALIZATION_ID_LEFT_CLICK_ACTION_STATIC,
"右键操作(&R):", // LOCALIZATION_ID_RIGHT_CLICK_ACTION_STATIC,
"鼠标滚轮操作(&M):", // LOCALIZATION_ID_MOUSE_WHEEL_ACTION_STATIC,
"按 Esc 键关闭查看器(&K)", // LOCALIZATION_ID_ESCAPE_CLOSES_CHECKBOX,
"命令(&C):", // LOCALIZATION_ID_COMMANDS_STATIC,
"所选命令的设置", // LOCALIZATION_ID_SETTINGS_FOR_SELECTED_COMMAND,
"添加(&A)...", // LOCALIZATION_ID_ADD_KEY_BUTTON,
Expand Down
14 changes: 14 additions & 0 deletions src/viv.c
Original file line number Diff line number Diff line change
Expand Up @@ -6409,6 +6409,16 @@ static int _viv_is_msg(MSG *msg)
k = k->next;
}
}

// close the viewer with escape.
// cancelling an action, leaving fullscreen and a command bound to escape all take priority.
// ignore key repeats so holding escape to leave fullscreen doesn't also close the viewer.
if ((config_escape_closes) && (key_flags == 0) && (msg->wParam == VK_ESCAPE) && (!(msg->lParam & 0x40000000)))
{
_viv_exit();

return 1;
}
}
}

Expand Down Expand Up @@ -8248,6 +8258,9 @@ static INT_PTR CALLBACK _viv_options_controls_proc(HWND hwnd,UINT msg,WPARAM wPa
os_ComboBox_AddString_localization_id(hwnd,IDC_MOUSEWHEELACTION_COMBOBOX,LOCALIZATION_ID_OPTIONS_ACTION_PREV_NEXT_COMBOBOXITEM);
ComboBox_SetCurSel(GetDlgItem(hwnd,IDC_MOUSEWHEELACTION_COMBOBOX),config_mouse_wheel_action);

os_SetDlgItemText_localization_id(hwnd,IDC_ESCAPE_CLOSES_CHECKBOX,LOCALIZATION_ID_ESCAPE_CLOSES_CHECKBOX);
CheckDlgButton(hwnd,IDC_ESCAPE_CLOSES_CHECKBOX,config_escape_closes ? BST_CHECKED : BST_UNCHECKED);

os_SetDlgItemText_localization_id(hwnd,IDC_COMMANDS_STATIC,LOCALIZATION_ID_COMMANDS_STATIC);
os_SetDlgItemText_localization_id(hwnd,IDC_SETTINGS_FOR_SELECTED_COMMAND_STATIC,LOCALIZATION_ID_SETTINGS_FOR_SELECTED_COMMAND);
os_SetDlgItemText_localization_id(hwnd,IDC_ADD_KEY_BUTTON,LOCALIZATION_ID_ADD_KEY_BUTTON);
Expand Down Expand Up @@ -8713,6 +8726,7 @@ static INT_PTR CALLBACK _viv_options_proc(HWND hwnd,UINT msg,WPARAM wParam,LPARA
config_left_click_action = ComboBox_GetCurSel(GetDlgItem(controls_page,IDC_LEFTCLICKACTION_COMBOBOX));
config_right_click_action = ComboBox_GetCurSel(GetDlgItem(controls_page,IDC_RIGHTCLICKACTION_COMBOBOX));
config_mouse_wheel_action = ComboBox_GetCurSel(GetDlgItem(controls_page,IDC_MOUSEWHEELACTION_COMBOBOX));
config_escape_closes = IsDlgButtonChecked(controls_page,IDC_ESCAPE_CLOSES_CHECKBOX) == BST_CHECKED ? 1 : 0;

if (ComboBox_GetCurSel(GetDlgItem(view_page,IDC_SHRINK_BLIT_MODE_COMBOBOX)) == 1)
{
Expand Down