Removing the redundant call next variable and replacing it with enqueueing custom functions on views!

master
Allen Webster 2019-11-06 17:40:15 -08:00
parent 2834583b98
commit 9bfcdc66a8
5 changed files with 17 additions and 38 deletions

View File

@ -151,10 +151,7 @@ get_next_view_after_active(Application_Links *app, Access_Flag access){
static void
call_after_ctx_shutdown(Application_Links *app, View_ID view, Custom_Command_Function *func){
Managed_Scope scope = view_get_managed_scope(app, view);
Custom_Command_Function **call_next =
scope_attachment(app, scope, view_call_next, Custom_Command_Function*);
*call_next = func;
view_enqueue_command_function(app, view, func);
}
function Fallback_Dispatch_Result
@ -457,7 +454,6 @@ default_4coder_initialize(Application_Links *app, String_Const_u8_Array file_nam
view_highlight_range = managed_id_declare(app, SCu8("DEFAULT.highlight" ));
view_highlight_buffer = managed_id_declare(app, SCu8("DEFAULT.highlight_buf" ));
view_render_hook = managed_id_declare(app, SCu8("DEFAULT.render" ));
view_call_next = managed_id_declare(app, SCu8("DEFAULT.call_next" ));
view_word_complete_menu = managed_id_declare(app, SCu8("DEFAULT.word_complete_menu"));
buffer_map_id = managed_id_declare(app, SCu8("DEFAULT.buffer_map_id" ));

View File

@ -40,7 +40,6 @@ global Managed_ID view_ui_data = 0;
global Managed_ID view_highlight_range = 0;
global Managed_ID view_highlight_buffer = 0;
global Managed_ID view_render_hook = 0;
global Managed_ID view_call_next = 0;
global Managed_ID view_word_complete_menu = 0;
global Managed_ID buffer_map_id = 0;

View File

@ -61,7 +61,7 @@ CUSTOM_DOC("Input consumption loop for default view behavior")
{
View_ID view = get_active_view(app, Access_Always);
View_ID view = get_this_ctx_view(app, Access_Always);
String_Const_u8 name = push_u8_stringf(scratch, "view %d", view);
Profile_Global_List *list = get_core_profile_list(app);
@ -87,7 +87,7 @@ CUSTOM_DOC("Input consumption loop for default view behavior")
continue;
}
View_ID view = get_active_view(app, Access_Always);
View_ID view = get_this_ctx_view(app, Access_Always);
Buffer_ID buffer = view_get_buffer(app, view, Access_Always);
Managed_Scope buffer_scope = buffer_get_managed_scope(app, buffer);
@ -101,12 +101,6 @@ CUSTOM_DOC("Input consumption loop for default view behavior")
Command_Binding binding = map_get_binding_recursive(&framework_mapping, map_id, &input.event);
Managed_Scope scope = view_get_managed_scope(app, view);
Custom_Command_Function** next_call = 0;
call_again:
next_call = scope_attachment(app, scope, view_call_next,
Custom_Command_Function*);
*next_call = 0;
if (binding.custom == 0){
// NOTE(allen): we don't have anything to do with this input,
@ -160,13 +154,6 @@ CUSTOM_DOC("Input consumption loop for default view behavior")
}
}
}
next_call = scope_attachment(app, scope, view_call_next,
Custom_Command_Function*);
if (next_call != 0 && *next_call != 0){
binding.custom = *next_call;
goto call_again;
}
}
}
}

View File

@ -582,10 +582,7 @@ CUSTOM_DOC("Opens an interactive list of all registered commands.")
Custom_Command_Function *func = get_command_from_user(app, "Command:");
if (func != 0){
View_ID view = get_this_ctx_view(app, Access_Always);
Managed_Scope scope = view_get_managed_scope(app, view);
Custom_Command_Function **call_next =
scope_attachment(app, scope, view_call_next, Custom_Command_Function*);
*call_next = func;
view_enqueue_command_function(app, view, func);
}
}

View File

@ -246,19 +246,19 @@ static Command_Metadata fcoder_metacmd_table[214] = {
{ PROC_LINKS(seek_end_of_line, 0), false, "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2175 },
{ PROC_LINKS(goto_beginning_of_file, 0), false, "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2181 },
{ PROC_LINKS(goto_end_of_file, 0), false, "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2189 },
{ PROC_LINKS(change_active_panel, 0), false, "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 282 },
{ PROC_LINKS(change_active_panel_backwards, 0), false, "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 288 },
{ PROC_LINKS(open_panel_vsplit, 0), false, "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 298 },
{ PROC_LINKS(open_panel_hsplit, 0), false, "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 308 },
{ PROC_LINKS(suppress_mouse, 0), false, "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 373 },
{ PROC_LINKS(allow_mouse, 0), false, "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 379 },
{ PROC_LINKS(toggle_mouse, 0), false, "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 385 },
{ PROC_LINKS(set_mode_to_original, 0), false, "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 391 },
{ PROC_LINKS(set_mode_to_notepad_like, 0), false, "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 397 },
{ PROC_LINKS(toggle_highlight_line_at_cursor, 0), false, "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 403 },
{ PROC_LINKS(toggle_highlight_enclosing_scopes, 0), false, "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 409 },
{ PROC_LINKS(toggle_paren_matching_helper, 0), false, "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 415 },
{ PROC_LINKS(toggle_fullscreen, 0), false, "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 421 },
{ PROC_LINKS(change_active_panel, 0), false, "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 279 },
{ PROC_LINKS(change_active_panel_backwards, 0), false, "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 285 },
{ PROC_LINKS(open_panel_vsplit, 0), false, "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 295 },
{ PROC_LINKS(open_panel_hsplit, 0), false, "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 305 },
{ PROC_LINKS(suppress_mouse, 0), false, "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 370 },
{ PROC_LINKS(allow_mouse, 0), false, "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 376 },
{ PROC_LINKS(toggle_mouse, 0), false, "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 382 },
{ PROC_LINKS(set_mode_to_original, 0), false, "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 388 },
{ PROC_LINKS(set_mode_to_notepad_like, 0), false, "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 394 },
{ PROC_LINKS(toggle_highlight_line_at_cursor, 0), false, "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 400 },
{ PROC_LINKS(toggle_highlight_enclosing_scopes, 0), false, "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 406 },
{ PROC_LINKS(toggle_paren_matching_helper, 0), false, "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 412 },
{ PROC_LINKS(toggle_fullscreen, 0), false, "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 418 },
{ PROC_LINKS(write_text_input, 0), false, "write_text_input", 16, "Inserts whatever character was used to trigger this command.", 60, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 59 },
{ PROC_LINKS(write_space, 0), false, "write_space", 11, "Inserts an underscore.", 22, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 67 },
{ PROC_LINKS(write_underscore, 0), false, "write_underscore", 16, "Inserts an underscore.", 22, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 73 },