UI: Allow file number shortcuts ouside main region
Makes the numpad + and - type of shortcuts to increase/decrease the file number suffix work in the upper and lower bar of the file browser. Had to add keymap handlers to the execute region for this to work.
This commit is contained in:
@@ -1788,6 +1788,18 @@ def km_file_browser(_params):
|
||||
("file.directory_new", {"type": 'I', "value": 'PRESS'}, None),
|
||||
("file.smoothscroll", {"type": 'TIMER1', "value": 'ANY', "any": True}, None),
|
||||
("file.bookmark_add", {"type": 'B', "value": 'PRESS', "ctrl": True}, None),
|
||||
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS'},
|
||||
{"properties": [("increment", 1)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "shift": True},
|
||||
{"properties": [("increment", 10)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True},
|
||||
{"properties": [("increment", 100)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS'},
|
||||
{"properties": [("increment", -1)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "shift": True},
|
||||
{"properties": [("increment", -10)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True},
|
||||
{"properties": [("increment", -100)]}),
|
||||
])
|
||||
|
||||
return keymap
|
||||
@@ -1848,18 +1860,6 @@ def km_file_browser_main(params):
|
||||
("file.highlight", {"type": 'MOUSEMOVE', "value": 'ANY', "any": True}, None),
|
||||
("file.sort_column_ui_context", {"type": 'LEFTMOUSE', "value": 'PRESS', "any": True}, None),
|
||||
op_menu("FILEBROWSER_MT_context_menu", params.context_menu_event),
|
||||
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS'},
|
||||
{"properties": [("increment", 1)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "shift": True},
|
||||
{"properties": [("increment", 10)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True},
|
||||
{"properties": [("increment", 100)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS'},
|
||||
{"properties": [("increment", -1)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "shift": True},
|
||||
{"properties": [("increment", -10)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True},
|
||||
{"properties": [("increment", -100)]}),
|
||||
])
|
||||
|
||||
return keymap
|
||||
|
@@ -1181,6 +1181,18 @@ def km_file_browser(params):
|
||||
("file.smoothscroll", {"type": 'TIMER1', "value": 'ANY', "any": True}, None),
|
||||
("file.bookmark_toggle", {"type": 'T', "value": 'PRESS'}, None),
|
||||
("file.bookmark_add", {"type": 'B', "value": 'PRESS', "ctrl": True}, None),
|
||||
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS'},
|
||||
{"properties": [("increment", 1)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "shift": True},
|
||||
{"properties": [("increment", 10)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True},
|
||||
{"properties": [("increment", 100)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS'},
|
||||
{"properties": [("increment", -1)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "shift": True},
|
||||
{"properties": [("increment", -10)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True},
|
||||
{"properties": [("increment", -100)]}),
|
||||
])
|
||||
|
||||
return keymap
|
||||
@@ -1243,18 +1255,6 @@ def km_file_browser_main(params):
|
||||
("file.highlight", {"type": 'MOUSEMOVE', "value": 'ANY', "any": True}, None),
|
||||
("file.sort_column_ui_context", {"type": 'LEFTMOUSE', "value": 'PRESS', "any": True}, None),
|
||||
op_menu("FILEBROWSER_MT_context_menu", {"type": 'RIGHTMOUSE', "value": 'PRESS'}),
|
||||
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS'},
|
||||
{"properties": [("increment", 1)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "shift": True},
|
||||
{"properties": [("increment", 10)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True},
|
||||
{"properties": [("increment", 100)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS'},
|
||||
{"properties": [("increment", -1)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "shift": True},
|
||||
{"properties": [("increment", -10)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True},
|
||||
{"properties": [("increment", -100)]}),
|
||||
])
|
||||
|
||||
return keymap
|
||||
|
@@ -593,8 +593,14 @@ static void file_ui_region_draw(const bContext *C, ARegion *ar)
|
||||
|
||||
static void file_execution_region_init(wmWindowManager *wm, ARegion *ar)
|
||||
{
|
||||
wmKeyMap *keymap;
|
||||
|
||||
ED_region_panels_init(wm, ar);
|
||||
ar->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y;
|
||||
|
||||
/* own keymap */
|
||||
keymap = WM_keymap_ensure(wm->defaultconf, "File Browser", SPACE_FILE, 0);
|
||||
WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap);
|
||||
}
|
||||
|
||||
static void file_execution_region_draw(const bContext *C, ARegion *ar)
|
||||
|
Reference in New Issue
Block a user