Input handling cleanup, new view_activate key, fix notepad-like click to new view problem
parent
e2655f24f3
commit
a1f240f04e
|
@ -353,10 +353,9 @@ STRUCT Key_Event_Data{
|
|||
/* DOC(This field is like the field character, except that the state of caps lock is ignored in the translation.) */
|
||||
Key_Code character_no_caps_lock;
|
||||
|
||||
/* DOC(This field is an array indicating the state of modifiers at the time of the key press. The array is indexed using the values of Key_Modifier_Index. 1 indicates that the corresponding modifier was held, and a 0 indicates that it was not held.)
|
||||
|
||||
DOC_SEE(Key_Modifier)
|
||||
*/
|
||||
/* DOC(This field is an array indicating the state of modifiers at the time of the key press. The array is indexed using the values of Key_Modifier_Index.
|
||||
1 indicates that the corresponding modifier was held, and a 0 indicates that it was not held.)
|
||||
DOC_SEE(Key_Modifier) */
|
||||
int8_t modifiers[MDFR_INDEX_COUNT];
|
||||
};
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ CUSTOM_DOC("Sets the left size of the view near the x position of the cursor.")
|
|||
view_set_scroll(app, &view, scroll);
|
||||
}
|
||||
|
||||
bool32
|
||||
static bool32
|
||||
global_point_to_view_point(View_Summary *view, int32_t x, int32_t y, float *x_out, float *y_out){
|
||||
bool32 result = false;
|
||||
|
||||
|
|
|
@ -18,22 +18,23 @@ key_mouse_right_release = 55311,
|
|||
key_mouse_wheel = 55312,
|
||||
key_mouse_move = 55313,
|
||||
key_animate = 55314,
|
||||
key_f1 = 55315,
|
||||
key_f2 = 55316,
|
||||
key_f3 = 55317,
|
||||
key_f4 = 55318,
|
||||
key_f5 = 55319,
|
||||
key_f6 = 55320,
|
||||
key_f7 = 55321,
|
||||
key_f8 = 55322,
|
||||
key_f9 = 55323,
|
||||
key_f10 = 55324,
|
||||
key_f11 = 55325,
|
||||
key_f12 = 55326,
|
||||
key_f13 = 55327,
|
||||
key_f14 = 55328,
|
||||
key_f15 = 55329,
|
||||
key_f16 = 55330,
|
||||
key_view_activate = 55315,
|
||||
key_f1 = 55316,
|
||||
key_f2 = 55317,
|
||||
key_f3 = 55318,
|
||||
key_f4 = 55319,
|
||||
key_f5 = 55320,
|
||||
key_f6 = 55321,
|
||||
key_f7 = 55322,
|
||||
key_f8 = 55323,
|
||||
key_f9 = 55324,
|
||||
key_f10 = 55325,
|
||||
key_f11 = 55326,
|
||||
key_f12 = 55327,
|
||||
key_f13 = 55328,
|
||||
key_f14 = 55329,
|
||||
key_f15 = 55330,
|
||||
key_f16 = 55331,
|
||||
};
|
||||
static char*
|
||||
global_key_name(uint32_t key_code, int32_t *size){
|
||||
|
@ -58,6 +59,7 @@ case key_mouse_right_release: result = "key_mouse_right_release"; *size = sizeof
|
|||
case key_mouse_wheel: result = "key_mouse_wheel"; *size = sizeof("key_mouse_wheel")-1; break;
|
||||
case key_mouse_move: result = "key_mouse_move"; *size = sizeof("key_mouse_move")-1; break;
|
||||
case key_animate: result = "key_animate"; *size = sizeof("key_animate")-1; break;
|
||||
case key_view_activate: result = "key_view_activate"; *size = sizeof("key_view_activate")-1; break;
|
||||
case key_f1: result = "key_f1"; *size = sizeof("key_f1")-1; break;
|
||||
case key_f2: result = "key_f2"; *size = sizeof("key_f2")-1; break;
|
||||
case key_f3: result = "key_f3"; *size = sizeof("key_f3")-1; break;
|
||||
|
|
|
@ -44,6 +44,7 @@ end_map(context);
|
|||
begin_map(context, mapid_file);
|
||||
bind_vanilla_keys(context, write_character);
|
||||
bind(context, key_mouse_left, MDFR_NONE, click_set_cursor_and_mark);
|
||||
bind(context, key_view_activate, MDFR_NONE, click_set_cursor_and_mark);
|
||||
bind(context, key_mouse_left_release, MDFR_NONE, click_set_cursor);
|
||||
bind(context, key_mouse_move, MDFR_NONE, click_set_cursor_if_lbutton);
|
||||
bind(context, key_del, MDFR_NONE, delete_char);
|
||||
|
@ -166,6 +167,7 @@ bind(context, key_down, MDFR_NONE, lister__move_down);
|
|||
bind(context, key_page_down, MDFR_NONE, lister__move_down);
|
||||
bind(context, key_mouse_wheel, MDFR_NONE, lister__wheel_scroll);
|
||||
bind(context, key_mouse_left, MDFR_NONE, lister__mouse_press);
|
||||
bind(context, key_view_activate, MDFR_NONE, lister__mouse_press);
|
||||
bind(context, key_mouse_left_release, MDFR_NONE, lister__mouse_release);
|
||||
bind(context, key_mouse_move, MDFR_NONE, lister__repaint);
|
||||
bind(context, key_animate, MDFR_NONE, lister__repaint);
|
||||
|
@ -217,6 +219,7 @@ begin_map(context, mapid_file);
|
|||
bind_vanilla_keys(context, write_character);
|
||||
bind_vanilla_keys(context, MDFR_ALT, write_character);
|
||||
bind(context, key_mouse_left, MDFR_NONE, click_set_cursor_and_mark);
|
||||
bind(context, key_view_activate, MDFR_NONE, click_set_cursor_and_mark);
|
||||
bind(context, key_mouse_left_release, MDFR_NONE, click_set_cursor);
|
||||
bind(context, key_mouse_move, MDFR_NONE, click_set_cursor_if_lbutton);
|
||||
bind(context, key_del, MDFR_NONE, delete_char);
|
||||
|
@ -337,6 +340,7 @@ bind(context, key_down, MDFR_NONE, lister__move_down);
|
|||
bind(context, key_page_down, MDFR_NONE, lister__move_down);
|
||||
bind(context, key_mouse_wheel, MDFR_NONE, lister__wheel_scroll);
|
||||
bind(context, key_mouse_left, MDFR_NONE, lister__mouse_press);
|
||||
bind(context, key_view_activate, MDFR_NONE, click_set_cursor_and_mark);
|
||||
bind(context, key_mouse_left_release, MDFR_NONE, lister__mouse_release);
|
||||
bind(context, key_mouse_move, MDFR_NONE, lister__repaint);
|
||||
bind(context, key_animate, MDFR_NONE, lister__repaint);
|
||||
|
@ -398,7 +402,6 @@ static Meta_Key_Bind fcoder_binds_for_default_mapid_global[39] = {
|
|||
{0, 88, 2, "project_command_lister", 22, LINK_PROCS(project_command_lister)},
|
||||
{0, 73, 1, "list_all_functions_current_buffer_lister", 40, LINK_PROCS(list_all_functions_current_buffer_lister)},
|
||||
{0, 69, 2, "exit_4coder", 11, LINK_PROCS(exit_4coder)},
|
||||
{0, 55315, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
|
||||
{0, 55316, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
|
||||
{0, 55317, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
|
||||
{0, 55318, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
|
||||
|
@ -414,11 +417,13 @@ static Meta_Key_Bind fcoder_binds_for_default_mapid_global[39] = {
|
|||
{0, 55328, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
|
||||
{0, 55329, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
|
||||
{0, 55330, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
|
||||
{0, 55331, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
|
||||
{0, 55312, 0, "mouse_wheel_scroll", 18, LINK_PROCS(mouse_wheel_scroll)},
|
||||
};
|
||||
static Meta_Key_Bind fcoder_binds_for_default_mapid_file[77] = {
|
||||
static Meta_Key_Bind fcoder_binds_for_default_mapid_file[78] = {
|
||||
{1, 0, 0, "write_character", 15, LINK_PROCS(write_character)},
|
||||
{0, 55308, 0, "click_set_cursor_and_mark", 25, LINK_PROCS(click_set_cursor_and_mark)},
|
||||
{0, 55315, 0, "click_set_cursor_and_mark", 25, LINK_PROCS(click_set_cursor_and_mark)},
|
||||
{0, 55310, 0, "click_set_cursor", 16, LINK_PROCS(click_set_cursor)},
|
||||
{0, 55313, 0, "click_set_cursor_if_lbutton", 27, LINK_PROCS(click_set_cursor_if_lbutton)},
|
||||
{0, 55301, 0, "delete_char", 11, LINK_PROCS(delete_char)},
|
||||
|
@ -528,7 +533,7 @@ static Meta_Key_Bind fcoder_binds_for_default_default_code_map[31] = {
|
|||
{0, 50, 2, "open_matching_file_cpp", 22, LINK_PROCS(open_matching_file_cpp)},
|
||||
{0, 48, 1, "write_zero_struct", 17, LINK_PROCS(write_zero_struct)},
|
||||
};
|
||||
static Meta_Key_Bind fcoder_binds_for_default_default_lister_ui_map[14] = {
|
||||
static Meta_Key_Bind fcoder_binds_for_default_default_lister_ui_map[15] = {
|
||||
{1, 0, 0, "lister__write_character", 23, LINK_PROCS(lister__write_character)},
|
||||
{0, 55307, 0, "lister__quit", 12, LINK_PROCS(lister__quit)},
|
||||
{0, 10, 0, "lister__activate", 16, LINK_PROCS(lister__activate)},
|
||||
|
@ -540,15 +545,16 @@ static Meta_Key_Bind fcoder_binds_for_default_default_lister_ui_map[14] = {
|
|||
{0, 55306, 0, "lister__move_down", 17, LINK_PROCS(lister__move_down)},
|
||||
{0, 55312, 0, "lister__wheel_scroll", 20, LINK_PROCS(lister__wheel_scroll)},
|
||||
{0, 55308, 0, "lister__mouse_press", 19, LINK_PROCS(lister__mouse_press)},
|
||||
{0, 55315, 0, "lister__mouse_press", 19, LINK_PROCS(lister__mouse_press)},
|
||||
{0, 55310, 0, "lister__mouse_release", 21, LINK_PROCS(lister__mouse_release)},
|
||||
{0, 55313, 0, "lister__repaint", 15, LINK_PROCS(lister__repaint)},
|
||||
{0, 55314, 0, "lister__repaint", 15, LINK_PROCS(lister__repaint)},
|
||||
};
|
||||
static Meta_Sub_Map fcoder_submaps_for_default[4] = {
|
||||
{"mapid_global", 12, "The following bindings apply in all situations.", 47, 0, 0, fcoder_binds_for_default_mapid_global, 39},
|
||||
{"mapid_file", 10, "The following bindings apply in general text files and most apply in code files, but some are overriden by other commands specific to code files.", 145, 0, 0, fcoder_binds_for_default_mapid_file, 77},
|
||||
{"mapid_file", 10, "The following bindings apply in general text files and most apply in code files, but some are overriden by other commands specific to code files.", 145, 0, 0, fcoder_binds_for_default_mapid_file, 78},
|
||||
{"default_code_map", 16, "The following commands only apply in files where the lexer (syntax highlighting) is turned on.", 94, "mapid_file", 10, fcoder_binds_for_default_default_code_map, 31},
|
||||
{"default_lister_ui_map", 21, "These commands apply in 'lister mode' such as when you open a file.", 67, 0, 0, fcoder_binds_for_default_default_lister_ui_map, 14},
|
||||
{"default_lister_ui_map", 21, "These commands apply in 'lister mode' such as when you open a file.", 67, 0, 0, fcoder_binds_for_default_default_lister_ui_map, 15},
|
||||
};
|
||||
static Meta_Key_Bind fcoder_binds_for_mac_default_mapid_global[39] = {
|
||||
{0, 44, 4, "change_active_panel", 19, LINK_PROCS(change_active_panel)},
|
||||
|
@ -573,7 +579,6 @@ static Meta_Key_Bind fcoder_binds_for_mac_default_mapid_global[39] = {
|
|||
{0, 88, 1, "project_command_lister", 22, LINK_PROCS(project_command_lister)},
|
||||
{0, 73, 4, "list_all_functions_current_buffer_lister", 40, LINK_PROCS(list_all_functions_current_buffer_lister)},
|
||||
{0, 69, 1, "exit_4coder", 11, LINK_PROCS(exit_4coder)},
|
||||
{0, 55315, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
|
||||
{0, 55316, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
|
||||
{0, 55317, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
|
||||
{0, 55318, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
|
||||
|
@ -589,12 +594,14 @@ static Meta_Key_Bind fcoder_binds_for_mac_default_mapid_global[39] = {
|
|||
{0, 55328, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
|
||||
{0, 55329, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
|
||||
{0, 55330, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
|
||||
{0, 55331, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
|
||||
{0, 55312, 0, "mouse_wheel_scroll", 18, LINK_PROCS(mouse_wheel_scroll)},
|
||||
};
|
||||
static Meta_Key_Bind fcoder_binds_for_mac_default_mapid_file[76] = {
|
||||
static Meta_Key_Bind fcoder_binds_for_mac_default_mapid_file[77] = {
|
||||
{1, 0, 0, "write_character", 15, LINK_PROCS(write_character)},
|
||||
{1, 0, 2, "write_character", 15, LINK_PROCS(write_character)},
|
||||
{0, 55308, 0, "click_set_cursor_and_mark", 25, LINK_PROCS(click_set_cursor_and_mark)},
|
||||
{0, 55315, 0, "click_set_cursor_and_mark", 25, LINK_PROCS(click_set_cursor_and_mark)},
|
||||
{0, 55310, 0, "click_set_cursor", 16, LINK_PROCS(click_set_cursor)},
|
||||
{0, 55313, 0, "click_set_cursor_if_lbutton", 27, LINK_PROCS(click_set_cursor_if_lbutton)},
|
||||
{0, 55301, 0, "delete_char", 11, LINK_PROCS(delete_char)},
|
||||
|
@ -702,7 +709,7 @@ static Meta_Key_Bind fcoder_binds_for_mac_default_default_code_map[31] = {
|
|||
{0, 50, 1, "open_matching_file_cpp", 22, LINK_PROCS(open_matching_file_cpp)},
|
||||
{0, 48, 4, "write_zero_struct", 17, LINK_PROCS(write_zero_struct)},
|
||||
};
|
||||
static Meta_Key_Bind fcoder_binds_for_mac_default_default_lister_ui_map[14] = {
|
||||
static Meta_Key_Bind fcoder_binds_for_mac_default_default_lister_ui_map[15] = {
|
||||
{1, 0, 0, "lister__write_character", 23, LINK_PROCS(lister__write_character)},
|
||||
{0, 55307, 0, "lister__quit", 12, LINK_PROCS(lister__quit)},
|
||||
{0, 10, 0, "lister__activate", 16, LINK_PROCS(lister__activate)},
|
||||
|
@ -714,15 +721,16 @@ static Meta_Key_Bind fcoder_binds_for_mac_default_default_lister_ui_map[14] = {
|
|||
{0, 55306, 0, "lister__move_down", 17, LINK_PROCS(lister__move_down)},
|
||||
{0, 55312, 0, "lister__wheel_scroll", 20, LINK_PROCS(lister__wheel_scroll)},
|
||||
{0, 55308, 0, "lister__mouse_press", 19, LINK_PROCS(lister__mouse_press)},
|
||||
{0, 55315, 0, "click_set_cursor_and_mark", 25, LINK_PROCS(click_set_cursor_and_mark)},
|
||||
{0, 55310, 0, "lister__mouse_release", 21, LINK_PROCS(lister__mouse_release)},
|
||||
{0, 55313, 0, "lister__repaint", 15, LINK_PROCS(lister__repaint)},
|
||||
{0, 55314, 0, "lister__repaint", 15, LINK_PROCS(lister__repaint)},
|
||||
};
|
||||
static Meta_Sub_Map fcoder_submaps_for_mac_default[4] = {
|
||||
{"mapid_global", 12, "The following bindings apply in all situations.", 47, 0, 0, fcoder_binds_for_mac_default_mapid_global, 39},
|
||||
{"mapid_file", 10, "The following bindings apply in general text files and most apply in code files, but some are overriden by other commands specific to code files.", 145, 0, 0, fcoder_binds_for_mac_default_mapid_file, 76},
|
||||
{"mapid_file", 10, "The following bindings apply in general text files and most apply in code files, but some are overriden by other commands specific to code files.", 145, 0, 0, fcoder_binds_for_mac_default_mapid_file, 77},
|
||||
{"default_code_map", 16, "The following commands only apply in files where the lexer (syntax highlighting) is turned on.", 94, "mapid_file", 10, fcoder_binds_for_mac_default_default_code_map, 31},
|
||||
{"default_lister_ui_map", 21, "These commands apply in 'lister mode' such as when you open a file.", 67, 0, 0, fcoder_binds_for_mac_default_default_lister_ui_map, 14},
|
||||
{"default_lister_ui_map", 21, "These commands apply in 'lister mode' such as when you open a file.", 67, 0, 0, fcoder_binds_for_mac_default_default_lister_ui_map, 15},
|
||||
};
|
||||
static Meta_Mapping fcoder_meta_maps[2] = {
|
||||
{"default", 7, "The default 4coder bindings - typically good for Windows and Linux", 66, fcoder_submaps_for_default, 4, LINK_PROCS(fill_keys_default)},
|
||||
|
|
97
4ed.cpp
97
4ed.cpp
|
@ -1561,12 +1561,12 @@ App_Step_Sig(app_step){
|
|||
|
||||
app_result.animating = true;
|
||||
|
||||
// TODO(allen): Should I somehow allow a view to clean up however it wants after a
|
||||
// command finishes, or after transfering to another view mid command?
|
||||
if (view != 0 && models->command_coroutine == 0){
|
||||
init_query_set(&view->transient.query_set);
|
||||
}
|
||||
if (models->command_coroutine == 0) break;
|
||||
if (models->command_coroutine == 0){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1574,19 +1574,7 @@ App_Step_Sig(app_step){
|
|||
}
|
||||
|
||||
// NOTE(allen): pass raw input to the panels
|
||||
Input_Summary dead_input = {};
|
||||
dead_input.mouse.x = input->mouse.x;
|
||||
dead_input.mouse.y = input->mouse.y;
|
||||
dead_input.dt = input->dt;
|
||||
|
||||
Input_Summary active_input = {};
|
||||
active_input.mouse.x = input->mouse.x;
|
||||
active_input.mouse.y = input->mouse.y;
|
||||
active_input.dt = input->dt;
|
||||
|
||||
active_input.keys = get_key_data(&vars->available_input);
|
||||
|
||||
Mouse_State mouse_state = get_mouse_state(&vars->available_input);
|
||||
f32 dt = input->dt;
|
||||
|
||||
{
|
||||
Command_Data *command = cmd;
|
||||
|
@ -1597,12 +1585,6 @@ App_Step_Sig(app_step){
|
|||
panel != &models->layout.used_sentinel;
|
||||
panel = panel->next){
|
||||
View *view = panel->view;
|
||||
b32 active = (panel == active_panel);
|
||||
Input_Summary summary = (active)?(active_input):(dead_input);
|
||||
|
||||
if (panel == mouse_panel && !input->mouse.out_of_window){
|
||||
summary.mouse = mouse_state;
|
||||
}
|
||||
|
||||
GUI_Scroll_Vars *scroll_vars = 0;
|
||||
i32 max_y = 0;
|
||||
|
@ -1619,17 +1601,12 @@ App_Step_Sig(app_step){
|
|||
file_scroll = false;
|
||||
}
|
||||
|
||||
Input_Process_Result ip_result = do_step_file_view(system, view, models, panel->inner, active, &summary, *scroll_vars, max_y);
|
||||
b32 active = (panel == active_panel);
|
||||
Input_Process_Result ip_result = do_step_file_view(system, view, models, panel->inner, active, dt, *scroll_vars, max_y);
|
||||
|
||||
if (ip_result.is_animating){
|
||||
app_result.animating = true;
|
||||
}
|
||||
if (ip_result.consumed_l){
|
||||
consume_input(&vars->available_input, Input_MouseLeftButton, "file view step");
|
||||
}
|
||||
if (ip_result.consumed_r){
|
||||
consume_input(&vars->available_input, Input_MouseRightButton, "file view step");
|
||||
}
|
||||
|
||||
if (memcmp(scroll_vars, &ip_result.scroll, sizeof(*scroll_vars)) != 0){
|
||||
if (file_scroll){
|
||||
|
@ -1666,7 +1643,7 @@ App_Step_Sig(app_step){
|
|||
i32 map = view_get_map(view);
|
||||
Command_Binding cmd_bind = map_extract_recursive(&models->mapping, map, key);
|
||||
|
||||
if (cmd_bind.function){
|
||||
if (cmd_bind.function != 0){
|
||||
if (key.keycode == key_esc){
|
||||
hit_esc = true;
|
||||
}
|
||||
|
@ -1748,7 +1725,7 @@ App_Step_Sig(app_step){
|
|||
i32 top = 0;
|
||||
divider_stack[top++] = div.id;
|
||||
|
||||
while (top > 0){
|
||||
for (;top > 0;){
|
||||
--top;
|
||||
Divider_And_ID other_div = layout_get_divider(&models->layout, divider_stack[top]);
|
||||
b32 divider_match = (other_div.divider->v_divider == mouse_divider_vertical);
|
||||
|
@ -1778,28 +1755,16 @@ App_Step_Sig(app_step){
|
|||
Panel_Divider *divider = vars->resizing.divider;
|
||||
i32 mouse_position = 0;
|
||||
|
||||
b32 do_absolute_positions = 1;
|
||||
if (do_absolute_positions){
|
||||
i32 absolute_positions[MAX_VIEWS];
|
||||
i32 min = 0, max = 0;
|
||||
i32 div_id = (i32)(divider - models->layout.dividers);
|
||||
|
||||
layout_compute_absolute_positions(&models->layout, absolute_positions);
|
||||
mouse_position = (divider->v_divider)?(mx):(my);
|
||||
layout_get_min_max(&models->layout, divider, absolute_positions, &min, &max);
|
||||
absolute_positions[div_id] = clamp(min, mouse_position, max);
|
||||
layout_update_all_positions(&models->layout, absolute_positions);
|
||||
}
|
||||
i32 absolute_positions[MAX_VIEWS];
|
||||
i32 min = 0;
|
||||
i32 max = 0;
|
||||
i32 div_id = (i32)(divider - models->layout.dividers);
|
||||
|
||||
else{
|
||||
if (divider->v_divider){
|
||||
mouse_position = clamp(0, mx, models->layout.full_width);
|
||||
}
|
||||
else{
|
||||
mouse_position = clamp(0, my, models->layout.full_height);
|
||||
}
|
||||
divider->pos = layout_compute_position(&models->layout, divider, mouse_position);
|
||||
}
|
||||
layout_compute_absolute_positions(&models->layout, absolute_positions);
|
||||
mouse_position = (divider->v_divider)?(mx):(my);
|
||||
layout_get_min_max(&models->layout, divider, absolute_positions, &min, &max);
|
||||
absolute_positions[div_id] = clamp(min, mouse_position, max);
|
||||
layout_update_all_positions(&models->layout, absolute_positions);
|
||||
|
||||
layout_fix_all_panels(&models->layout);
|
||||
}
|
||||
|
@ -1837,6 +1802,32 @@ App_Step_Sig(app_step){
|
|||
|
||||
models->layout.active_panel = new_panel_id;
|
||||
app_result.animating = true;
|
||||
|
||||
{
|
||||
Command_Data *command = cmd;
|
||||
Key_Event_Data key = {};
|
||||
key.keycode = key_view_activate;
|
||||
cmd->key = key;
|
||||
|
||||
USE_VIEW(view);
|
||||
|
||||
i32 map = view_get_map(view);
|
||||
Command_Binding cmd_bind = map_extract_recursive(&models->mapping, map, key);
|
||||
|
||||
if (cmd_bind.function != 0){
|
||||
Assert(models->command_coroutine == 0);
|
||||
Coroutine_Head *command_coroutine = system->create_coroutine(command_caller);
|
||||
models->command_coroutine = command_coroutine;
|
||||
|
||||
Command_In cmd_in;
|
||||
cmd_in.cmd = cmd;
|
||||
cmd_in.bind = cmd_bind;
|
||||
|
||||
models->command_coroutine = app_launch_coroutine(system, &models->app_links, Co_Command, models->command_coroutine, &cmd_in, models->command_coroutine_flags);
|
||||
|
||||
models->prev_command = cmd_bind;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1894,7 +1885,7 @@ App_Step_Sig(app_step){
|
|||
|
||||
GUI_Scroll_Vars *scroll_vars = &view->transient.edit_pos->scroll;
|
||||
|
||||
do_render_file_view(system, view, models, scroll_vars, active_view, panel->inner, active, target, &dead_input);
|
||||
do_render_file_view(system, view, models, scroll_vars, active_view, panel->inner, active, target);
|
||||
|
||||
u32 margin_color;
|
||||
if (active){
|
||||
|
|
|
@ -47,7 +47,7 @@ global_const Style_Color_Edit colors_to_edit[] = {
|
|||
};
|
||||
|
||||
internal Input_Process_Result
|
||||
do_step_file_view(System_Functions *system, View *view, Models *models, i32_Rect rect, b32 is_active, Input_Summary *user_input, GUI_Scroll_Vars scroll, i32 max_y){
|
||||
do_step_file_view(System_Functions *system, View *view, Models *models, i32_Rect rect, b32 is_active, f32 dt, GUI_Scroll_Vars scroll, i32 max_y){
|
||||
scroll.target_y = clamp(0, scroll.target_y, max_y);
|
||||
|
||||
Input_Process_Result result = {0};
|
||||
|
@ -70,10 +70,11 @@ do_step_file_view(System_Functions *system, View *view, Models *models, i32_Rect
|
|||
slot = slot->next, ++bar_count);
|
||||
view->transient.widget_height = (f32)bar_count*(view->transient.line_height + 2);
|
||||
|
||||
Editing_File *file = view->transient.file_data.file;
|
||||
|
||||
if (!view->transient.ui_mode){
|
||||
view->transient.file_region = rect;
|
||||
|
||||
Editing_File *file = view->transient.file_data.file;
|
||||
if (view->transient.reinit_scrolling){
|
||||
view->transient.reinit_scrolling = false;
|
||||
result.is_animating = true;
|
||||
|
@ -101,11 +102,11 @@ do_step_file_view(System_Functions *system, View *view, Models *models, i32_Rect
|
|||
result.scroll.scroll_x = (f32)target_x;
|
||||
result.scroll.prev_target_x = -1000;
|
||||
}
|
||||
|
||||
if (!file->is_loading && file->state.paste_effect.seconds_down > 0.f){
|
||||
file->state.paste_effect.seconds_down -= user_input->dt;
|
||||
result.is_animating = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!file->is_loading && file->state.paste_effect.seconds_down > 0.f){
|
||||
file->state.paste_effect.seconds_down -= dt;
|
||||
result.is_animating = true;
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -116,7 +117,7 @@ do_step_file_view(System_Functions *system, View *view, Models *models, i32_Rect
|
|||
f32 target_x = (f32)scroll_vars.target_x;
|
||||
f32 target_y = (f32)scroll_vars.target_y;
|
||||
|
||||
if (models->scroll_rule(target_x, target_y, &scroll_vars.scroll_x, &scroll_vars.scroll_y, (view->persistent.id) + 1, is_new_target, user_input->dt)){
|
||||
if (models->scroll_rule(target_x, target_y, &scroll_vars.scroll_x, &scroll_vars.scroll_y, (view->persistent.id) + 1, is_new_target, dt)){
|
||||
result.is_animating = true;
|
||||
}
|
||||
|
||||
|
@ -225,7 +226,7 @@ draw_file_bar(System_Functions *system, Render_Target *target, View *view, Model
|
|||
}
|
||||
|
||||
internal void
|
||||
do_render_file_view(System_Functions *system, View *view, Models *models, GUI_Scroll_Vars *scroll, View *active, i32_Rect rect, b32 is_active, Render_Target *target, Input_Summary *user_input){
|
||||
do_render_file_view(System_Functions *system, View *view, Models *models, GUI_Scroll_Vars *scroll, View *active, i32_Rect rect, b32 is_active, Render_Target *target){
|
||||
|
||||
Editing_File *file = view->transient.file_data.file;
|
||||
Assert(file != 0);
|
||||
|
|
|
@ -54,6 +54,7 @@ M(mouse_right_release) \
|
|||
M(mouse_wheel) \
|
||||
M(mouse_move) \
|
||||
M(animate) \
|
||||
M(view_activate) \
|
||||
M(f1) \
|
||||
M(f2) \
|
||||
M(f3) \
|
||||
|
@ -743,6 +744,7 @@ generate_remapping_code_and_data(){
|
|||
bind_vanilla_keys(mappings, MDFR_NONE, write_character);
|
||||
|
||||
bind(mappings, key_mouse_left, MDFR_NONE, click_set_cursor_and_mark);
|
||||
bind(mappings, key_view_activate, MDFR_NONE, click_set_cursor_and_mark);
|
||||
bind(mappings, key_mouse_left_release, MDFR_NONE, click_set_cursor);
|
||||
bind(mappings, key_mouse_move, MDFR_NONE, click_set_cursor_if_lbutton);
|
||||
|
||||
|
@ -892,6 +894,7 @@ generate_remapping_code_and_data(){
|
|||
bind(mappings, key_page_down, MDFR_NONE, lister__move_down);
|
||||
bind(mappings, key_mouse_wheel , MDFR_NONE, lister__wheel_scroll);
|
||||
bind(mappings, key_mouse_left , MDFR_NONE, lister__mouse_press);
|
||||
bind(mappings, key_view_activate , MDFR_NONE, lister__mouse_press);
|
||||
bind(mappings, key_mouse_left_release, MDFR_NONE, lister__mouse_release);
|
||||
bind(mappings, key_mouse_move, MDFR_NONE, lister__repaint);
|
||||
bind(mappings, key_animate , MDFR_NONE, lister__repaint);
|
||||
|
@ -964,6 +967,7 @@ generate_remapping_code_and_data(){
|
|||
bind_vanilla_keys(mappings, MDFR_ALT, write_character);
|
||||
|
||||
bind(mappings, key_mouse_left, MDFR_NONE, click_set_cursor_and_mark);
|
||||
bind(mappings, key_view_activate, MDFR_NONE, click_set_cursor_and_mark);
|
||||
bind(mappings, key_mouse_left_release, MDFR_NONE, click_set_cursor);
|
||||
bind(mappings, key_mouse_move, MDFR_NONE, click_set_cursor_if_lbutton);
|
||||
|
||||
|
@ -1111,6 +1115,7 @@ generate_remapping_code_and_data(){
|
|||
bind(mappings, key_page_down, MDFR_NONE, lister__move_down);
|
||||
bind(mappings, key_mouse_wheel , MDFR_NONE, lister__wheel_scroll);
|
||||
bind(mappings, key_mouse_left , MDFR_NONE, lister__mouse_press);
|
||||
bind(mappings, key_view_activate , MDFR_NONE, click_set_cursor_and_mark);
|
||||
bind(mappings, key_mouse_left_release, MDFR_NONE, lister__mouse_release);
|
||||
bind(mappings, key_mouse_move, MDFR_NONE, lister__repaint);
|
||||
bind(mappings, key_animate , MDFR_NONE, lister__repaint);
|
||||
|
|
Loading…
Reference in New Issue