FILE TRANSFER; almost have new input events up and running, needs a few more blocks
parent
3f72512332
commit
aa565395e2
334
4ed.cpp
334
4ed.cpp
|
@ -114,16 +114,6 @@ DELTA_RULE_SIG(fallback_scroll_rule){
|
|||
#define DEFAULT_MAP_SIZE 10
|
||||
#define DEFAULT_UI_MAP_SIZE 32
|
||||
|
||||
internal void
|
||||
setup_file_commands(Command_Map *commands, Cursor *cursor, i32 parent){
|
||||
map_init(commands, cursor, DEFAULT_MAP_SIZE, parent);
|
||||
}
|
||||
|
||||
internal void
|
||||
setup_top_commands(Command_Map *commands, Cursor *cursor, i32 parent){
|
||||
map_init(commands, cursor, DEFAULT_MAP_SIZE, parent);
|
||||
}
|
||||
|
||||
// TODO(allen): REWRITE REWRITE REWRITE!
|
||||
internal b32
|
||||
interpret_binding_buffer(Models *models, void *buffer, i32 size){
|
||||
|
@ -133,6 +123,7 @@ interpret_binding_buffer(Models *models, void *buffer, i32 size){
|
|||
Scratch_Block scratch(models->tctx, Scratch_Share);
|
||||
|
||||
Mapping new_mapping = {};
|
||||
mapping_init(models->tctx, &new_mapping);
|
||||
|
||||
models->scroll_rule = fallback_scroll_rule;
|
||||
models->hook_open_file = 0;
|
||||
|
@ -153,14 +144,8 @@ interpret_binding_buffer(Models *models, void *buffer, i32 size){
|
|||
if (unit->type == unit_header && unit->header.error == 0){
|
||||
Binding_Unit *end = unit + unit->header.total_size;
|
||||
|
||||
i32 user_map_count = unit->header.user_map_count;
|
||||
new_mapping.user_map_count = user_map_count;
|
||||
|
||||
// Initialize Table and User Maps in Temp Buffer
|
||||
new_mapping.map_id_table = push_array(scratch, i32, user_map_count);
|
||||
block_fill_u32(new_mapping.map_id_table, user_map_count*sizeof(i32), (u32)(-1));
|
||||
|
||||
new_mapping.user_maps = push_array_zero(scratch, Command_Map, user_map_count);
|
||||
mapping_get_or_make_map(&new_mapping, mapid_global);
|
||||
mapping_get_or_make_map(&new_mapping, mapid_file);
|
||||
|
||||
// Find the Size of Each Map
|
||||
for (++unit; unit < end; ++unit){
|
||||
|
@ -172,79 +157,20 @@ interpret_binding_buffer(Models *models, void *buffer, i32 size){
|
|||
if (mapid == mapid_nomap){
|
||||
break;
|
||||
}
|
||||
else if (mapid == mapid_global){
|
||||
did_top = true;
|
||||
}
|
||||
else if (mapid == mapid_file){
|
||||
did_file = true;
|
||||
}
|
||||
|
||||
Command_Map *map = get_or_add_map(&new_mapping, mapid);
|
||||
i32 count = map->count;
|
||||
i32 new_count = 0;
|
||||
Command_Map *map = mapping_get_or_make_map(&new_mapping, mapid);
|
||||
if (unit->map_begin.replace){
|
||||
map->real_beginning = unit;
|
||||
new_count = unit->map_begin.bind_count;
|
||||
}
|
||||
else{
|
||||
if (map->real_beginning == 0){
|
||||
map->real_beginning = unit;
|
||||
}
|
||||
new_count = unit->map_begin.bind_count + count;
|
||||
}
|
||||
|
||||
map->count = new_count;
|
||||
if (map->max < new_count){
|
||||
map->max = new_count;
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
// Add up the Map Counts
|
||||
i32 count_global = DEFAULT_MAP_SIZE;
|
||||
if (did_top){
|
||||
count_global = clamp_bot(6, new_mapping.map_top.count*3/2);
|
||||
}
|
||||
|
||||
i32 count_file = DEFAULT_MAP_SIZE;
|
||||
if (did_file){
|
||||
count_file = clamp_bot(6, new_mapping.map_file.count*3/2);
|
||||
}
|
||||
|
||||
i32 count_ui = DEFAULT_UI_MAP_SIZE;
|
||||
|
||||
i32 count_user = 0;
|
||||
for (i32 i = 0; i < user_map_count; ++i){
|
||||
Command_Map *map = &new_mapping.user_maps[i];
|
||||
count_user += clamp_bot(6, map->max*3/2);
|
||||
}
|
||||
|
||||
i32 binding_memsize = (count_global + count_file + count_ui + count_user)*sizeof(Command_Binding);
|
||||
|
||||
// Allocate Needed Memory
|
||||
i32 map_id_table_memsize = user_map_count*sizeof(i32);
|
||||
i32 user_maps_memsize = user_map_count*sizeof(Command_Map);
|
||||
|
||||
i32 map_id_table_rounded_memsize = round_up_i32(map_id_table_memsize, 8);
|
||||
i32 user_maps_rounded_memsize = round_up_i32(user_maps_memsize, 8);
|
||||
|
||||
i32 binding_rounded_memsize = round_up_i32(binding_memsize, 8);
|
||||
|
||||
i32 needed_memsize = map_id_table_rounded_memsize + user_maps_rounded_memsize + binding_rounded_memsize;
|
||||
new_mapping.memory = heap_allocate(gen, needed_memsize);
|
||||
Cursor local_cursor = make_cursor(new_mapping.memory, needed_memsize);
|
||||
|
||||
// Move ID Table Memory and Pointer
|
||||
i32 *old_table = new_mapping.map_id_table;
|
||||
new_mapping.map_id_table = push_array(&local_cursor, i32, user_map_count);
|
||||
block_copy(new_mapping.map_id_table, old_table, map_id_table_memsize);
|
||||
|
||||
// Move User Maps Memory and Pointer
|
||||
Command_Map *old_maps = new_mapping.user_maps;
|
||||
new_mapping.user_maps = push_array(&local_cursor, Command_Map, user_map_count);
|
||||
block_copy(new_mapping.user_maps, old_maps, user_maps_memsize);
|
||||
|
||||
// Fill in Command Maps
|
||||
unit = (Binding_Unit*)buffer;
|
||||
for (++unit; unit < end; ++unit){
|
||||
|
@ -252,37 +178,18 @@ interpret_binding_buffer(Models *models, void *buffer, i32 size){
|
|||
case unit_map_begin:
|
||||
{
|
||||
i32 mapid = unit->map_begin.mapid;
|
||||
|
||||
if (mapid == mapid_nomap){
|
||||
map_ptr = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
Command_Map *map = get_or_add_map(&new_mapping, mapid);
|
||||
if (unit >= map->real_beginning){
|
||||
if (mapid == mapid_global){
|
||||
map_ptr = &new_mapping.map_top;
|
||||
}
|
||||
else if (mapid == mapid_file){
|
||||
map_ptr = &new_mapping.map_file;
|
||||
}
|
||||
else if (mapid < mapid_global){
|
||||
i32 index = get_or_add_map_index(&new_mapping, mapid);
|
||||
Assert(index < user_map_count);
|
||||
map_ptr = &new_mapping.user_maps[index];
|
||||
}
|
||||
else{
|
||||
map_ptr = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
Assert(map_ptr != 0);
|
||||
|
||||
// NOTE(allen): Map can begin multiple times, only alloc and clear when we first see it.
|
||||
if (map_ptr->commands == 0){
|
||||
i32 count = map->max;
|
||||
i32 table_max = clamp_bot(6, count*3/2);
|
||||
map_init(map_ptr, &local_cursor, table_max, mapid_global);
|
||||
else{
|
||||
Command_Map *map = mapping_get_or_make_map(&new_mapping, mapid);
|
||||
if (unit >= map->real_beginning){
|
||||
if (mapid == mapid_file || mapid <= mapid_global){
|
||||
map_ptr = map;
|
||||
}
|
||||
else{
|
||||
map_ptr = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}break;
|
||||
|
@ -290,7 +197,7 @@ interpret_binding_buffer(Models *models, void *buffer, i32 size){
|
|||
case unit_inherit:
|
||||
{
|
||||
if (map_ptr != 0){
|
||||
map_ptr->parent = unit->map_inherit.mapid;
|
||||
map_set_parent(&new_mapping, map_ptr, unit->map_inherit.mapid);
|
||||
}
|
||||
}break;
|
||||
|
||||
|
@ -299,13 +206,20 @@ interpret_binding_buffer(Models *models, void *buffer, i32 size){
|
|||
if (map_ptr != 0){
|
||||
Custom_Command_Function *custom = unit->callback.func;
|
||||
if (unit->callback.code == 0){
|
||||
u32 index = 0;
|
||||
if (map_get_modifiers_hash(unit->callback.modifiers, &index)){
|
||||
map_ptr->vanilla_keyboard_default[index].custom = custom;
|
||||
}
|
||||
map_set_binding_text_input(map_ptr, custom);
|
||||
}
|
||||
else{
|
||||
map_add(map_ptr, unit->callback.code, unit->callback.modifiers, custom);
|
||||
Key_Modifiers modifiers = {};
|
||||
modifiers.modifiers[MDFR_SHIFT_INDEX] =
|
||||
HasFlag(unit->callback.modifiers, MDFR_SHIFT);
|
||||
modifiers.modifiers[MDFR_CONTROL_INDEX] =
|
||||
HasFlag(unit->callback.modifiers, MDFR_CTRL);
|
||||
modifiers.modifiers[MDFR_ALT_INDEX] =
|
||||
HasFlag(unit->callback.modifiers, MDFR_ALT);
|
||||
modifiers.modifiers[MDFR_COMMAND_INDEX] =
|
||||
HasFlag(unit->callback.modifiers, MDFR_CMND);
|
||||
map_set_binding_key(&new_mapping, map_ptr, custom,
|
||||
unit->callback.code, &modifiers);
|
||||
}
|
||||
}
|
||||
}break;
|
||||
|
@ -399,13 +313,6 @@ interpret_binding_buffer(Models *models, void *buffer, i32 size){
|
|||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!did_top){
|
||||
setup_top_commands(&new_mapping.map_top, &local_cursor, mapid_global);
|
||||
}
|
||||
if (!did_file){
|
||||
setup_file_commands(&new_mapping.map_file, &local_cursor, mapid_global);
|
||||
}
|
||||
}
|
||||
else{
|
||||
// TODO(allen): do(Error report: bad binding units map.)
|
||||
|
@ -413,11 +320,7 @@ interpret_binding_buffer(Models *models, void *buffer, i32 size){
|
|||
InvalidPath;
|
||||
}
|
||||
|
||||
Mapping old_mapping = models->mapping;
|
||||
if (old_mapping.memory != 0){
|
||||
heap_free(gen, old_mapping.memory);
|
||||
}
|
||||
|
||||
mapping_release(models->tctx, &models->mapping);
|
||||
models->mapping = new_mapping;
|
||||
|
||||
return(result);
|
||||
|
@ -430,9 +333,7 @@ command_caller(Coroutine *coroutine){
|
|||
Command_In *cmd_in = (Command_In*)coroutine->in;
|
||||
Models *models = cmd_in->models;
|
||||
if (models->command_caller != 0){
|
||||
Generic_Command generic = {};
|
||||
generic.command = cmd_in->bind.custom;
|
||||
models->command_caller(&models->app_links, generic);
|
||||
models->command_caller(&models->app_links, cmd_in->bind.custom);
|
||||
}
|
||||
else{
|
||||
cmd_in->bind.custom(&models->app_links);
|
||||
|
@ -666,40 +567,6 @@ models_init(Thread_Context *tctx){
|
|||
return(models);
|
||||
}
|
||||
|
||||
internal u32
|
||||
get_event_flags(Key_Code keycode){
|
||||
u32 event_flags = 0;
|
||||
if (keycode == KeyCode_Escape){
|
||||
event_flags |= EventOnEsc;
|
||||
event_flags |= EventOnAnyKey;
|
||||
}
|
||||
else if (keycode == KeyCodeExt_MouseLeft ||
|
||||
keycode == KeyCodeExt_MouseLeftRelease){
|
||||
event_flags |= EventOnMouseLeftButton;
|
||||
}
|
||||
else if (keycode == KeyCodeExt_MouseRight ||
|
||||
keycode == KeyCodeExt_MouseRightRelease){
|
||||
event_flags |= EventOnMouseRightButton;
|
||||
}
|
||||
else if (keycode == KeyCodeExt_MouseWheel){
|
||||
event_flags |= EventOnMouseWheel;
|
||||
}
|
||||
else if (keycode == KeyCodeExt_MouseMove){
|
||||
event_flags |= EventOnMouseMove;
|
||||
}
|
||||
else if (keycode == KeyCodeExt_Animate){
|
||||
event_flags |= EventOnAnimate;
|
||||
}
|
||||
else if (keycode == KeyCodeExt_ClickActivateView ||
|
||||
keycode == KeyCodeExt_ClickDeactivateView){
|
||||
event_flags |= EventOnViewActivation;
|
||||
}
|
||||
else{
|
||||
event_flags |= EventOnAnyKey;
|
||||
}
|
||||
return(event_flags);
|
||||
}
|
||||
|
||||
internal void
|
||||
force_abort_coroutine(Models *models, View *view){
|
||||
User_Input user_in = {};
|
||||
|
@ -715,11 +582,11 @@ force_abort_coroutine(Models *models, View *view){
|
|||
}
|
||||
|
||||
internal void
|
||||
launch_command_via_event(Models *models, View *view, Key_Event_Data event){
|
||||
models->key = event;
|
||||
launch_command_via_event(Models *models, View *view, Input_Event *event){
|
||||
block_copy_struct(&models->event, event);
|
||||
|
||||
i32 map = view_get_map(view);
|
||||
Command_Binding cmd_bind = map_extract_recursive(&models->mapping, map, event);
|
||||
Command_Map_ID map = view_get_map(view);
|
||||
Command_Binding cmd_bind = map_get_binding_recursive(&models->mapping, map, event);
|
||||
|
||||
if (cmd_bind.custom != 0){
|
||||
Assert(models->command_coroutine == 0);
|
||||
|
@ -733,17 +600,18 @@ launch_command_via_event(Models *models, View *view, Key_Event_Data event){
|
|||
models->command_coroutine = app_coroutine_run(models, Co_Command, models->command_coroutine, &cmd_in, models->command_coroutine_flags);
|
||||
|
||||
models->prev_command = cmd_bind;
|
||||
if (event.keycode != KeyCodeExt_Animate){
|
||||
if (match_core_code(event, CoreCode_Animate)){
|
||||
models->animate_next_frame = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void
|
||||
launch_command_via_keycode(Models *models, View *view, Key_Code keycode){
|
||||
Key_Event_Data event = {};
|
||||
event.keycode = keycode;
|
||||
launch_command_via_event(models, view, event);
|
||||
launch_command_via_core_event(Models *models, View *view, Core_Code code){
|
||||
Input_Event event = {};
|
||||
event.kind = InputEventKind_Core;
|
||||
event.core.code = code;
|
||||
launch_command_via_event(models, view, &event);
|
||||
}
|
||||
|
||||
internal void
|
||||
|
@ -816,7 +684,7 @@ App_Init_Sig(app_init){
|
|||
|
||||
{
|
||||
Assert(models->config_api.get_bindings != 0);
|
||||
Scratch_Block scratch(models->tctx);
|
||||
Scratch_Block scratch(models->tctx, Scratch_Share);
|
||||
u8 *memory = push_array(scratch, u8, KB(64));
|
||||
i32 wanted_size = models->config_api.get_bindings(memory, KB(64));
|
||||
Assert(wanted_size <= KB(64));
|
||||
|
@ -911,6 +779,7 @@ App_Step_Sig(app_step){
|
|||
Models *models = (Models*)base_ptr;
|
||||
|
||||
Mutex_Lock file_order_lock(models->working_set.mutex);
|
||||
Scratch_Block scratch(models->tctx, Scratch_Share);
|
||||
|
||||
models->next_animate_delay = max_u32;
|
||||
models->animate_next_frame = false;
|
||||
|
@ -938,9 +807,9 @@ App_Step_Sig(app_step){
|
|||
// NOTE(allen): update child processes
|
||||
f32 dt = input->dt;
|
||||
if (dt > 0){
|
||||
Scratch_Block scratch(models->tctx, Scratch_Share);
|
||||
Child_Process_Container *child_processes = &models->child_processes;
|
||||
Temp_Memory_Block temp(scratch);
|
||||
|
||||
Child_Process_Container *child_processes = &models->child_processes;
|
||||
Child_Process **processes_to_free = push_array(scratch, Child_Process*, child_processes->active_child_process_count);
|
||||
i32 processes_to_free_count = 0;
|
||||
|
||||
|
@ -993,40 +862,60 @@ App_Step_Sig(app_step){
|
|||
models->input_filter(&input->mouse);
|
||||
}
|
||||
|
||||
|
||||
Key_Modifiers modifiers = system_get_modifiers();
|
||||
|
||||
Input_List input_list = input->events;
|
||||
Key_Modifiers modifiers = system_get_keyboard_modifiers();
|
||||
if (input->mouse.press_l){
|
||||
mouse_event.keycode = KeyCodeExt_MouseLeft;
|
||||
input->keys.keys[input->keys.count++] = mouse_event;
|
||||
Input_Event event = {};
|
||||
event.kind = InputEventKind_MouseButton;
|
||||
event.mouse.code = MouseCode_Left;
|
||||
event.mouse.p = input->mouse.p;
|
||||
push_input_event(scratch, &input_list, &event);
|
||||
}
|
||||
else if (input->mouse.release_l){
|
||||
mouse_event.keycode = KeyCodeExt_MouseLeftRelease;
|
||||
input->keys.keys[input->keys.count++] = mouse_event;
|
||||
Input_Event event = {};
|
||||
event.kind = InputEventKind_MouseButton;
|
||||
event.mouse.code = MouseCode_Left;
|
||||
event.mouse.p = input->mouse.p;
|
||||
event.mouse.release = true;
|
||||
push_input_event(scratch, &input_list, &event);
|
||||
}
|
||||
if (input->mouse.press_r){
|
||||
mouse_event.keycode = KeyCodeExt_MouseRight;
|
||||
input->keys.keys[input->keys.count++] = mouse_event;
|
||||
Input_Event event = {};
|
||||
event.kind = InputEventKind_MouseButton;
|
||||
event.mouse.code = MouseCode_Right;
|
||||
event.mouse.p = input->mouse.p;
|
||||
push_input_event(scratch, &input_list, &event);
|
||||
}
|
||||
else if (input->mouse.release_r){
|
||||
mouse_event.keycode = KeyCodeExt_MouseRightRelease;
|
||||
input->keys.keys[input->keys.count++] = mouse_event;
|
||||
Input_Event event = {};
|
||||
event.kind = InputEventKind_MouseButton;
|
||||
event.mouse.code = MouseCode_Right;
|
||||
event.mouse.p = input->mouse.p;
|
||||
event.mouse.release = true;
|
||||
push_input_event(scratch, &input_list, &event);
|
||||
}
|
||||
if (input->mouse.wheel != 0){
|
||||
mouse_event.keycode = KeyCodeExt_MouseWheel;
|
||||
input->keys.keys[input->keys.count++] = mouse_event;
|
||||
Input_Event event = {};
|
||||
event.kind = InputEventKind_MouseWheel;
|
||||
event.mouse_wheel.value = (f32)(input->mouse.wheel);
|
||||
event.mouse_wheel.p = input->mouse.p;
|
||||
push_input_event(scratch, &input_list, &event);
|
||||
}
|
||||
if (input->mouse.p != models->prev_p){
|
||||
b32 was_in_window = rect_contains_point(Ri32(0, 0, prev_dim.x, prev_dim.y), models->prev_p);
|
||||
b32 is_in_window = rect_contains_point(Ri32(0, 0, current_dim.x, current_dim.y), input->mouse.p);
|
||||
if (is_in_window || was_in_window){
|
||||
mouse_event.keycode = KeyCodeExt_MouseMove;
|
||||
input->keys.keys[input->keys.count++] = mouse_event;
|
||||
Input_Event event = {};
|
||||
event.kind = InputEventKind_MouseMove;
|
||||
event.mouse_move.p = input->mouse.p;
|
||||
push_input_event(scratch, &input_list, &event);
|
||||
}
|
||||
}
|
||||
if (models->animated_last_frame){
|
||||
mouse_event.keycode = KeyCodeExt_Animate;
|
||||
input->keys.keys[input->keys.count++] = mouse_event;
|
||||
Input_Event event = {};
|
||||
event.kind = InputEventKind_Core;
|
||||
event.core.code = CoreCode_Animate;
|
||||
push_input_event(scratch, &input_list, &event);
|
||||
}
|
||||
|
||||
// NOTE(allen): expose layout
|
||||
|
@ -1072,9 +961,11 @@ App_Step_Sig(app_step){
|
|||
}
|
||||
|
||||
// NOTE(allen): consume event stream
|
||||
Key_Event_Data *key_ptr = input->keys.keys;
|
||||
Key_Event_Data *key_end = key_ptr + input->keys.count;
|
||||
for (;key_ptr < key_end; key_ptr += 1){
|
||||
for (Input_Event_Node *node = input_list.first;
|
||||
node != 0;
|
||||
node = node->next){
|
||||
Input_Event *event = &node->event;
|
||||
|
||||
Panel *active_panel = layout_get_active_panel(layout);
|
||||
View *view = active_panel->view;
|
||||
Assert(view != 0);
|
||||
|
@ -1082,23 +973,24 @@ App_Step_Sig(app_step){
|
|||
switch (models->state){
|
||||
case APP_STATE_EDIT:
|
||||
{
|
||||
Key_Code keycode = key_ptr->keycode;
|
||||
|
||||
typedef i32 Event_Consume_Rule;
|
||||
enum{
|
||||
EventConsume_None,
|
||||
EventConsume_BeginResize,
|
||||
EventConsume_ClickChangeView,
|
||||
EventConsume_Command,
|
||||
EventConsume_CustomCommand,
|
||||
};
|
||||
i32 event_consume_mode = EventConsume_Command;
|
||||
if (keycode == KeyCodeExt_MouseLeft && input->mouse.press_l && (divider_panel != 0)){
|
||||
event_consume_mode = EventConsume_BeginResize;
|
||||
|
||||
Event_Consume_Rule consume_rule = EventConsume_CustomCommand;
|
||||
if (match_mouse_code(event, MouseCode_Left) && (divider_panel != 0)){
|
||||
consume_rule = EventConsume_BeginResize;
|
||||
}
|
||||
else if (keycode == KeyCodeExt_MouseLeft && input->mouse.press_l && mouse_panel != 0 && mouse_panel != active_panel){
|
||||
event_consume_mode = EventConsume_ClickChangeView;
|
||||
else if (match_mouse_code(event, MouseCode_Left) &&
|
||||
mouse_panel != 0 && mouse_panel != active_panel){
|
||||
consume_rule = EventConsume_ClickChangeView;
|
||||
}
|
||||
|
||||
switch (event_consume_mode){
|
||||
switch (consume_rule){
|
||||
case EventConsume_BeginResize:
|
||||
{
|
||||
models->state = APP_STATE_RESIZING;
|
||||
|
@ -1113,7 +1005,7 @@ App_Step_Sig(app_step){
|
|||
}
|
||||
|
||||
// NOTE(allen): run deactivate command
|
||||
launch_command_via_keycode(models, view, KeyCodeExt_ClickDeactivateView);
|
||||
launch_command_via_core_event(models, view, CoreCode_ClickDeactivateView);
|
||||
|
||||
// NOTE(allen): kill coroutine if we have one (again because we just launched a command)
|
||||
if (models->command_coroutine != 0){
|
||||
|
@ -1126,31 +1018,31 @@ App_Step_Sig(app_step){
|
|||
view = active_panel->view;
|
||||
|
||||
// NOTE(allen): run activate command
|
||||
launch_command_via_keycode(models, view, KeyCodeExt_ClickActivateView);
|
||||
launch_command_via_core_event(models, view, CoreCode_ClickActivateView);
|
||||
}break;
|
||||
|
||||
case EventConsume_Command:
|
||||
case EventConsume_CustomCommand:
|
||||
{
|
||||
// NOTE(allen): update command coroutine
|
||||
if (models->command_coroutine != 0){
|
||||
models->key = *key_ptr;
|
||||
block_copy_struct(&models->event, event);
|
||||
|
||||
Coroutine *command_coroutine = models->command_coroutine;
|
||||
u32 abort_flags = models->command_coroutine_flags[1];
|
||||
u32 get_flags = models->command_coroutine_flags[0] | abort_flags;
|
||||
Event_Property abort_flags = models->command_coroutine_flags[1];
|
||||
Event_Property get_flags = models->command_coroutine_flags[0] | abort_flags;
|
||||
|
||||
u32 event_flags = get_event_flags(key_ptr->keycode);
|
||||
Event_Property event_flags = get_event_properties(event);
|
||||
if ((get_flags & event_flags) != 0){
|
||||
i32 map = view_get_map(view);
|
||||
Command_Binding cmd_bind = map_extract_recursive(&models->mapping, map, *key_ptr);
|
||||
Command_Map_ID map = view_get_map(view);
|
||||
Command_Binding cmd_bind = map_get_binding_recursive(&models->mapping, map, event);
|
||||
|
||||
User_Input user_in = {};
|
||||
user_in.key = *key_ptr;
|
||||
user_in.command.command = cmd_bind.custom;
|
||||
user_in.event = *event;
|
||||
user_in.command = cmd_bind.custom;
|
||||
user_in.abort = ((abort_flags & event_flags) != 0);
|
||||
models->command_coroutine = app_coroutine_run(models, Co_Command, command_coroutine, &user_in, models->command_coroutine_flags);
|
||||
|
||||
if (user_in.key.keycode != KeyCodeExt_Animate){
|
||||
if (!HasFlag(event_flags, EventProperty_Animate)){
|
||||
models->animate_next_frame = true;
|
||||
}
|
||||
|
||||
|
@ -1159,10 +1051,8 @@ App_Step_Sig(app_step){
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(allen): launch command
|
||||
else{
|
||||
launch_command_via_event(models, view, *key_ptr);
|
||||
launch_command_via_event(models, view, event);
|
||||
}
|
||||
}break;
|
||||
}
|
||||
|
@ -1170,15 +1060,15 @@ App_Step_Sig(app_step){
|
|||
|
||||
case APP_STATE_RESIZING:
|
||||
{
|
||||
Key_Code keycode = key_ptr->keycode;
|
||||
u32 event_flags = get_event_flags(keycode);
|
||||
if (event_flags & EventOnAnyKey || keycode == KeyCodeExt_MouseLeftRelease){
|
||||
Event_Property event_flags = get_event_properties(event);
|
||||
if (HasFlag(event_flags, EventProperty_AnyKey) ||
|
||||
match_mouse_code_release(event, MouseCode_Left)){
|
||||
models->state = APP_STATE_EDIT;
|
||||
}
|
||||
else if (keycode == KeyCodeExt_MouseMove){
|
||||
else if (event->kind == InputEventKind_MouseMove){
|
||||
if (input->mouse.l){
|
||||
Panel *split = models->resizing_intermediate_panel;
|
||||
Range limits = layout_get_limiting_range_on_split(layout, split);
|
||||
Range_i32 limits = layout_get_limiting_range_on_split(layout, split);
|
||||
i32 mouse_position = (split->vertical_split)?(mouse.x):(mouse.y);
|
||||
mouse_position = clamp(limits.min, mouse_position, limits.max);
|
||||
layout_set_split_absolute_position(layout, split, mouse_position);
|
||||
|
|
2
4ed.h
2
4ed.h
|
@ -71,7 +71,7 @@ struct Application_Step_Input{
|
|||
b32 first_step;
|
||||
f32 dt;
|
||||
Mouse_State mouse;
|
||||
Input_List inputs;
|
||||
Input_List events;
|
||||
String_Const_u8 clipboard;
|
||||
b32 clipboard_changed;
|
||||
b32 trying_to_kill;
|
||||
|
|
|
@ -49,14 +49,14 @@ is_running_coroutine(Application_Links *app){
|
|||
}
|
||||
|
||||
api(custom) function b32
|
||||
global_set_setting(Application_Links *app, Global_Setting_ID setting, i32 value)
|
||||
global_set_setting(Application_Links *app, Global_Setting_ID setting, i64 value)
|
||||
{
|
||||
Models *models = (Models*)app->cmd_context;
|
||||
b32 result = true;
|
||||
switch (setting){
|
||||
case GlobalSetting_LAltLCtrlIsAltGr:
|
||||
{
|
||||
models->settings.lctrl_lalt_is_altgr = value;
|
||||
models->settings.lctrl_lalt_is_altgr = (b32)(value != 0);
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
|
@ -624,7 +624,7 @@ buffer_set_dirty_state(Application_Links *app, Buffer_ID buffer_id, Dirty_State
|
|||
}
|
||||
|
||||
api(custom) function b32
|
||||
buffer_get_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 *value_out)
|
||||
buffer_get_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i64 *value_out)
|
||||
{
|
||||
Models *models = (Models*)app->cmd_context;
|
||||
Editing_File *file = imp_get_file(models, buffer_id);
|
||||
|
@ -667,7 +667,7 @@ buffer_get_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_I
|
|||
}
|
||||
|
||||
api(custom) function b32
|
||||
buffer_set_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 value)
|
||||
buffer_set_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i64 value)
|
||||
{
|
||||
Models *models = (Models*)app->cmd_context;
|
||||
Editing_File *file = imp_get_file(models, buffer_id);
|
||||
|
@ -677,23 +677,15 @@ buffer_set_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_I
|
|||
switch (setting){
|
||||
case BufferSetting_MapID:
|
||||
{
|
||||
if (value < mapid_global){
|
||||
i32 new_mapid = get_map_index(&models->mapping, value);
|
||||
if (new_mapid < models->mapping.user_map_count){
|
||||
file->settings.base_map_id = value;
|
||||
}
|
||||
else{
|
||||
file->settings.base_map_id = mapid_file;
|
||||
}
|
||||
}
|
||||
else if (value <= mapid_nomap){
|
||||
file->settings.base_map_id = value;
|
||||
Command_Map_ID id = mapping_validate_id(&models->mapping, value);
|
||||
if (id != 0){
|
||||
file->settings.base_map_id = id;
|
||||
}
|
||||
}break;
|
||||
|
||||
case BufferSetting_Eol:
|
||||
{
|
||||
file->settings.dos_write_mode = value;
|
||||
file->settings.dos_write_mode = (b8)(value != 0);
|
||||
}break;
|
||||
|
||||
case BufferSetting_Unimportant:
|
||||
|
@ -1392,7 +1384,7 @@ view_set_active(Application_Links *app, View_ID view_id)
|
|||
}
|
||||
|
||||
api(custom) function b32
|
||||
view_get_setting(Application_Links *app, View_ID view_id, View_Setting_ID setting, i32 *value_out)
|
||||
view_get_setting(Application_Links *app, View_ID view_id, View_Setting_ID setting, i64 *value_out)
|
||||
{
|
||||
Models *models = (Models*)app->cmd_context;
|
||||
View *view = imp_get_view(models, view_id);
|
||||
|
@ -1431,7 +1423,7 @@ view_get_setting(Application_Links *app, View_ID view_id, View_Setting_ID settin
|
|||
}
|
||||
|
||||
api(custom) function b32
|
||||
view_set_setting(Application_Links *app, View_ID view_id, View_Setting_ID setting, i32 value)
|
||||
view_set_setting(Application_Links *app, View_ID view_id, View_Setting_ID setting, i64 value)
|
||||
{
|
||||
Models *models = (Models*)app->cmd_context;
|
||||
View *view = imp_get_view(models, view_id);
|
||||
|
@ -2084,15 +2076,15 @@ managed_object_load_data(Application_Links *app, Managed_Object object, u32 firs
|
|||
}
|
||||
|
||||
api(custom) function User_Input
|
||||
get_user_input(Application_Links *app, Input_Type_Flag get_type, Input_Type_Flag abort_type)
|
||||
get_user_input(Application_Links *app, Event_Property get_properties, Event_Property abort_properties)
|
||||
{
|
||||
Models *models = (Models*)app->cmd_context;
|
||||
User_Input result = {};
|
||||
if (app->type_coroutine == Co_Command){
|
||||
Coroutine *coroutine = (Coroutine*)app->current_coroutine;
|
||||
Assert(coroutine != 0);
|
||||
((u32*)coroutine->out)[0] = get_type;
|
||||
((u32*)coroutine->out)[1] = abort_type;
|
||||
((u32*)coroutine->out)[0] = get_properties;
|
||||
((u32*)coroutine->out)[1] = abort_properties;
|
||||
coroutine_yield(coroutine);
|
||||
result = *(User_Input*)coroutine->in;
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
|
||||
#include "4coder_base_types.h"
|
||||
#include "4coder_version.h"
|
||||
#include "generated/4coder_keycodes.h"
|
||||
#include "4coder_keycode_extension.h"
|
||||
#include "4coder_events.h"
|
||||
#include "4coder_default_colors.h"
|
||||
#include "4coder_types.h"
|
||||
#define STATIC_LINK_API
|
||||
|
@ -34,14 +33,6 @@
|
|||
|
||||
#include "4coder_string_match.h"
|
||||
|
||||
#include "4coder_base_types.cpp"
|
||||
#include "4coder_string_match.cpp"
|
||||
#include "4coder_stringf.cpp"
|
||||
#include "4coder_app_links_allocator.cpp"
|
||||
#include "4coder_system_allocator.cpp"
|
||||
#include "4coder_hash_functions.cpp"
|
||||
#include "4coder_table.cpp"
|
||||
|
||||
#include "4ed_render_target.h"
|
||||
#include "4ed.h"
|
||||
#include "4ed_buffer_model.h"
|
||||
|
@ -70,6 +61,20 @@
|
|||
#include "4ed_log.h"
|
||||
#include "4ed_app_models.h"
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
#include "4coder_base_types.cpp"
|
||||
#include "4coder_system_helpers.cpp"
|
||||
#include "4coder_events.cpp"
|
||||
#include "4coder_string_match.cpp"
|
||||
#include "4coder_stringf.cpp"
|
||||
#include "4coder_app_links_allocator.cpp"
|
||||
#include "4coder_system_allocator.cpp"
|
||||
#include "4coder_hash_functions.cpp"
|
||||
#include "4coder_table.cpp"
|
||||
#include "4coder_log.cpp"
|
||||
#include "4coder_buffer_seek_constructors.cpp"
|
||||
|
||||
#include "generated/custom_api.cpp"
|
||||
#define DYNAMIC_LINK_API
|
||||
#include "generated/system_api.cpp"
|
||||
|
@ -78,10 +83,8 @@
|
|||
#define DYNAMIC_LINK_API
|
||||
#include "generated/font_api.cpp"
|
||||
|
||||
#include "4coder_system_helpers.cpp"
|
||||
#include "4ed_allocator_models.cpp"
|
||||
#include "4ed_log.cpp"
|
||||
#include "4coder_log.cpp"
|
||||
#include "4ed_coroutine.cpp"
|
||||
#include "4ed_mem.cpp"
|
||||
#include "4ed_dynamic_variables.cpp"
|
||||
|
@ -99,7 +102,6 @@
|
|||
#include "4ed_cli.cpp"
|
||||
#include "4ed_gui.cpp"
|
||||
#include "4ed_layout.cpp"
|
||||
#include "4coder_buffer_seek_constructors.cpp"
|
||||
#include "4ed_view.cpp"
|
||||
#include "4ed_edit.cpp"
|
||||
#include "4ed_text_layout.cpp"
|
||||
|
|
528
4ed_command.cpp
528
4ed_command.cpp
|
@ -9,256 +9,310 @@
|
|||
|
||||
// TOP
|
||||
|
||||
internal i32
|
||||
get_or_add_map_index(Mapping *mapping, i32 mapid){
|
||||
i32 user_map_count = mapping->user_map_count;
|
||||
i32 *map_id_table = mapping->map_id_table;
|
||||
i32 result = 0;
|
||||
for (; result < user_map_count; ++result){
|
||||
if (map_id_table[result] == mapid){
|
||||
break;
|
||||
}
|
||||
if (map_id_table[result] == -1){
|
||||
map_id_table[result] = mapid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal i32
|
||||
get_map_index(Mapping *mapping, i32 mapid){
|
||||
i32 user_map_count = mapping->user_map_count;
|
||||
i32 *map_id_table = mapping->map_id_table;
|
||||
i32 result = 0;
|
||||
for (; result < user_map_count; ++result){
|
||||
if (map_id_table[result] == mapid){
|
||||
break;
|
||||
}
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal Command_Map*
|
||||
get_map_base(Mapping *mapping, i32 mapid, b32 add){
|
||||
Command_Map *map = 0;
|
||||
if (mapid < mapid_global){
|
||||
i32 map_index = 0;
|
||||
if (add){
|
||||
map_index = get_or_add_map_index(mapping, mapid);
|
||||
}
|
||||
else{
|
||||
map_index = get_map_index(mapping, mapid);
|
||||
}
|
||||
if (map_index < mapping->user_map_count){
|
||||
map = &mapping->user_maps[map_index];
|
||||
}
|
||||
}
|
||||
else if (mapid == mapid_global){
|
||||
map = &mapping->map_top;
|
||||
}
|
||||
else if (mapid == mapid_file){
|
||||
map = &mapping->map_file;
|
||||
}
|
||||
return(map);
|
||||
}
|
||||
|
||||
internal Command_Map*
|
||||
get_or_add_map(Mapping *mapping, i32 mapid){
|
||||
Command_Map *map = get_map_base(mapping, mapid, true);
|
||||
return(map);
|
||||
}
|
||||
|
||||
internal Command_Map*
|
||||
get_map(Mapping *mapping, i32 mapid){
|
||||
Command_Map *map = get_map_base(mapping, mapid, false);
|
||||
return(map);
|
||||
}
|
||||
|
||||
#define COMMAND_HASH_EMPTY 0
|
||||
#define COMMAND_HASH_ERASED max_u64
|
||||
|
||||
internal u64
|
||||
map_hash(Key_Code event_code, u8 modifiers){
|
||||
u64 result = (event_code << 8) | modifiers;
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal b32
|
||||
map_add(Command_Map *map, Key_Code event_code, u8 modifiers, Custom_Command_Function *custom){
|
||||
b32 result = false;
|
||||
Assert(map->count * 8 < map->max * 7);
|
||||
u64 hash = map_hash(event_code, modifiers);
|
||||
|
||||
u32 max = map->max;
|
||||
u32 index = hash % max;
|
||||
Command_Binding entry = map->commands[index];
|
||||
for (; entry.custom != 0 && entry.hash != COMMAND_HASH_ERASED;){
|
||||
if (entry.hash == hash){
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
index = (index + 1) % max;
|
||||
entry = map->commands[index];
|
||||
}
|
||||
|
||||
Command_Binding bind = {};
|
||||
bind.custom = custom;
|
||||
bind.hash = hash;
|
||||
map->commands[index] = bind;
|
||||
if (!result){
|
||||
++map->count;
|
||||
}
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal b32
|
||||
map_find_entry(Command_Map *map, Key_Code event_code, u8 modifiers, u32 *index_out){
|
||||
u64 hash = map_hash(event_code, modifiers);
|
||||
u32 max = map->max;
|
||||
u32 index = hash % max;
|
||||
b32 result = false;
|
||||
Command_Binding entry = map->commands[index];
|
||||
for (; entry.custom != 0;){
|
||||
if (entry.hash == hash){
|
||||
*index_out = index;
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
index = (index + 1) % max;
|
||||
entry = map->commands[index];
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal b32
|
||||
map_find(Command_Map *map, Key_Code event_code, u8 modifiers, Command_Binding *bind_out){
|
||||
u32 index = 0;
|
||||
b32 result = map_find_entry(map, event_code, modifiers, &index);
|
||||
if (result){
|
||||
*bind_out = map->commands[index];
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal b32
|
||||
map_drop(Command_Map *map, Key_Code event_code, u8 modifiers){
|
||||
u32 index = 0;
|
||||
b32 result = map_find_entry(map, event_code, modifiers, &index);
|
||||
if (result){
|
||||
map->commands[index].custom = 0;
|
||||
map->commands[index].hash = COMMAND_HASH_ERASED;
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal void
|
||||
map_init(Command_Map *map, Cursor *cursor, i32 max, i32 parent){
|
||||
Assert(max >= 6);
|
||||
Assert(map->commands == 0);
|
||||
map->parent = parent;
|
||||
map->commands = push_array_zero(cursor, Command_Binding, max);
|
||||
map->count = 0;
|
||||
map->max = max;
|
||||
block_zero_array(map->vanilla_keyboard_default);
|
||||
}
|
||||
|
||||
internal b32
|
||||
map_get_modifiers_hash(u8 modifiers, u32 *hash_out){
|
||||
b32 result = true;
|
||||
u32 hash = 0;
|
||||
if (modifiers & MDFR_SHIFT){
|
||||
hash += MDFR_SHIFT;
|
||||
}
|
||||
if (modifiers & MDFR_CTRL){
|
||||
hash += MDFR_CTRL;
|
||||
}
|
||||
if (modifiers & MDFR_CMND){
|
||||
hash += MDFR_CMND;
|
||||
}
|
||||
if (modifiers & MDFR_ALT){
|
||||
hash += MDFR_ALT;
|
||||
}
|
||||
*hash_out = hash;
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal void
|
||||
map_get_vanilla_keyboard_default(Command_Map *map, u8 command, Command_Binding *bind_out){
|
||||
u32 modifiers_hashed = 0;
|
||||
if (map_get_modifiers_hash(command, &modifiers_hashed)){
|
||||
*bind_out = map->vanilla_keyboard_default[modifiers_hashed];
|
||||
}
|
||||
}
|
||||
|
||||
internal Command_Binding
|
||||
map_extract(Command_Map *map, Key_Event_Data key){
|
||||
Command_Binding bind = {};
|
||||
|
||||
b32 ctrl = key.modifiers[MDFR_CONTROL_INDEX];
|
||||
b32 alt = key.modifiers[MDFR_ALT_INDEX];
|
||||
b32 command = key.modifiers[MDFR_COMMAND_INDEX];
|
||||
b32 shift = key.modifiers[MDFR_SHIFT_INDEX];
|
||||
|
||||
u8 mod_flags = MDFR_NONE;
|
||||
if (ctrl) mod_flags |= MDFR_CTRL;
|
||||
if (alt) mod_flags |= MDFR_ALT;
|
||||
if (command) mod_flags |= MDFR_CMND;
|
||||
if (shift) mod_flags |= MDFR_SHIFT;
|
||||
|
||||
Key_Code code = key.character_no_caps_lock;
|
||||
if (code == 0){
|
||||
code = key.keycode;
|
||||
map_find(map, code, mod_flags, &bind);
|
||||
mapping__alloc_map(Mapping *mapping){
|
||||
Command_Map *result = mapping->free_maps;
|
||||
if (result != 0){
|
||||
sll_stack_pop(mapping->free_maps);
|
||||
}
|
||||
else{
|
||||
if (code != '\n' && code != '\t' && code != ' '){
|
||||
mod_flags &= ~(MDFR_SHIFT);
|
||||
}
|
||||
map_find(map, code, mod_flags, &bind);
|
||||
if (bind.custom == 0){
|
||||
map_get_vanilla_keyboard_default(map, mod_flags, &bind);
|
||||
}
|
||||
result = push_array(mapping->node_arena, Command_Map, 1);
|
||||
}
|
||||
|
||||
return(bind);
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal void
|
||||
mapping__free_map(Mapping *mapping, Command_Map *map){
|
||||
sll_stack_push(mapping->free_maps, map);
|
||||
}
|
||||
|
||||
internal Command_Modified_Binding*
|
||||
mapping__alloc_modified_binding(Mapping *mapping){
|
||||
Command_Modified_Binding *result = mapping->free_bindings;
|
||||
if (result != 0){
|
||||
sll_stack_pop(mapping->free_bindings);
|
||||
}
|
||||
else{
|
||||
result = push_array(mapping->node_arena, Command_Modified_Binding, 1);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal void
|
||||
mapping__free_modified_binding(Mapping *mapping, Command_Modified_Binding *binding){
|
||||
sll_stack_push(mapping->free_bindings, binding);
|
||||
}
|
||||
|
||||
internal Command_Binding_List*
|
||||
mapping__alloc_binding_list(Mapping *mapping){
|
||||
Command_Binding_List *result = mapping->free_lists;
|
||||
if (result != 0){
|
||||
sll_stack_pop(mapping->free_lists);
|
||||
}
|
||||
else{
|
||||
result = push_array(mapping->node_arena, Command_Binding_List, 1);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal void
|
||||
mapping__free_binding_list(Mapping *mapping, Command_Binding_List *binding_list){
|
||||
sll_stack_push(mapping->free_lists, binding_list);
|
||||
}
|
||||
|
||||
internal Command_Binding_List*
|
||||
map__get_list(Command_Map *map, Key_Code code){
|
||||
Command_Binding_List *result = 0;
|
||||
Table_Lookup lookup = table_lookup(&map->key_code_to_binding_list, code);
|
||||
if (lookup.found_match){
|
||||
u64 val = 0;
|
||||
table_read(&map->key_code_to_binding_list, lookup, &val);
|
||||
result = (Command_Binding_List*)IntAsPtr(val);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal Command_Binding_List*
|
||||
map__get_or_make_list(Mapping *mapping, Command_Map *map, Key_Code code){
|
||||
Command_Binding_List *result = map__get_list(map, code);
|
||||
if (result == 0){
|
||||
result = mapping__alloc_binding_list(mapping);
|
||||
block_zero_struct(result);
|
||||
sll_queue_push(map->list_first, map->list_last, result);
|
||||
table_insert(&map->key_code_to_binding_list, code, (u64)PtrAsInt(result));
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
internal void
|
||||
mapping_init(Thread_Context *tctx, Mapping *mapping){
|
||||
block_zero_struct(mapping);
|
||||
mapping->node_arena = reserve_arena(tctx);
|
||||
heap_init(&mapping->heap, mapping->node_arena);
|
||||
mapping->heap_wrapper = base_allocator_on_heap(&mapping->heap);
|
||||
mapping->id_to_map = make_table_u64_u64(tctx->allocator, 100);
|
||||
mapping->id_counter = 1;
|
||||
}
|
||||
|
||||
internal void
|
||||
mapping_release(Thread_Context *tctx, Mapping *mapping){
|
||||
if (mapping->node_arena != 0){
|
||||
release_arena(tctx, mapping->node_arena);
|
||||
table_free(&mapping->id_to_map);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
internal Command_Map*
|
||||
mapping_begin_new_map(Mapping *mapping){
|
||||
Command_Map *map = mapping__alloc_map(mapping);
|
||||
block_zero_struct(map);
|
||||
map->id = mapping->id_counter;
|
||||
mapping->id_counter += 1;
|
||||
map->key_code_to_binding_list = make_table_u64_u64(&mapping->heap_wrapper, 8);
|
||||
table_insert(&mapping->id_to_map, map->id, (u64)PtrAsInt(map));
|
||||
return(map);
|
||||
}
|
||||
#endif
|
||||
|
||||
internal Command_Map*
|
||||
mapping_get_map(Mapping *mapping, Command_Map_ID id){
|
||||
Command_Map *result = 0;
|
||||
Table_Lookup lookup = table_lookup(&mapping->id_to_map, id);
|
||||
if (lookup.found_match){
|
||||
u64 val = 0;
|
||||
table_read(&mapping->id_to_map, lookup, &val);
|
||||
result = (Command_Map*)IntAsPtr(val);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal Command_Map_ID
|
||||
mapping_validate_id(Mapping *mapping, Command_Map_ID id){
|
||||
Table_Lookup lookup = table_lookup(&mapping->id_to_map, id);
|
||||
if (!lookup.found_match){
|
||||
id = 0;
|
||||
}
|
||||
return(id);
|
||||
}
|
||||
|
||||
internal Command_Map*
|
||||
mapping_get_or_make_map(Mapping *mapping, Command_Map_ID id){
|
||||
Command_Map *result = mapping_get_map(mapping, id);
|
||||
if (result == 0){
|
||||
result = mapping__alloc_map(mapping);
|
||||
block_zero_struct(result);
|
||||
result->id = id;
|
||||
result->key_code_to_binding_list = make_table_u64_u64(&mapping->heap_wrapper, 8);
|
||||
table_insert(&mapping->id_to_map, result->id, (u64)PtrAsInt(result));
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal void
|
||||
mapping_release_map(Mapping *mapping, Command_Map *map){
|
||||
table_erase(&mapping->id_to_map, map->id);
|
||||
if (map->binding_last != 0){
|
||||
map->binding_last->next = mapping->free_bindings;
|
||||
mapping->free_bindings = map->binding_first;
|
||||
}
|
||||
if (map->list_last != 0){
|
||||
map->list_last->next = mapping->free_lists;
|
||||
mapping->free_lists = map->list_first;
|
||||
}
|
||||
table_free(&map->key_code_to_binding_list);
|
||||
}
|
||||
|
||||
internal Command_Binding
|
||||
map_extract_recursive(Mapping *mapping, i32 map_id, Key_Event_Data key){
|
||||
Command_Map *map = get_map(mapping, map_id);
|
||||
if (map == 0){
|
||||
map = &mapping->map_top;
|
||||
}
|
||||
map_get_binding_non_recursive(Command_Map *map, Input_Event *event){
|
||||
Command_Binding result = {};
|
||||
|
||||
Command_Map *visited_maps[16] = {};
|
||||
i32 visited_top = 0;
|
||||
|
||||
Command_Binding cmd_bind = {};
|
||||
for (; map != 0; ){
|
||||
cmd_bind = map_extract(map, key);
|
||||
if (cmd_bind.custom == 0){
|
||||
if (visited_top < ArrayCount(visited_maps)){
|
||||
visited_maps[visited_top++] = map;
|
||||
map = get_map(mapping, map->parent);
|
||||
for (i32 i = 0; i < visited_top; ++i){
|
||||
if (map == visited_maps[i]){
|
||||
map = 0;
|
||||
break;
|
||||
if (map != 0){
|
||||
switch (event->kind){
|
||||
case InputEventKind_TextInsert:
|
||||
{
|
||||
result = map->text_input_command;
|
||||
}break;
|
||||
|
||||
case InputEventKind_KeyStroke:
|
||||
{
|
||||
Table_Lookup lookup = table_lookup(&map->key_code_to_binding_list, event->key.code);
|
||||
if (lookup.found_match){
|
||||
u64 val = 0;
|
||||
table_read(&map->key_code_to_binding_list, lookup, &val);
|
||||
Command_Binding_List *list = (Command_Binding_List*)IntAsPtr(val);
|
||||
Key_Modifiers *event_mods = &event->key.modifiers;
|
||||
for (SNode *node = list->first;
|
||||
node != 0;
|
||||
node = node->next){
|
||||
Command_Modified_Binding *mod_binding = CastFromMember(Command_Modified_Binding, order_node, node);
|
||||
Key_Modifiers *binding_mods = &mod_binding->modifiers;
|
||||
b32 is_a_match = true;
|
||||
for (i32 i = 0; i < ArrayCount(binding_mods->modifiers); i += 1){
|
||||
if (binding_mods->modifiers[i] &&
|
||||
!event_mods->modifiers[i]){
|
||||
is_a_match = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (is_a_match){
|
||||
result = mod_binding->binding;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
map = 0;
|
||||
}
|
||||
}
|
||||
else{
|
||||
map = 0;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
return(cmd_bind);
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal Command_Binding
|
||||
map_get_binding_recursive(Mapping *mapping, Command_Map *map, Input_Event *event){
|
||||
Command_Binding result = {};
|
||||
for (i32 safety_counter = 0;
|
||||
map != 0 && safety_counter < 40;
|
||||
safety_counter += 1){
|
||||
result = map_get_binding_non_recursive(map, event);
|
||||
if (result.custom != 0){
|
||||
break;
|
||||
}
|
||||
map = mapping_get_map(mapping, map->parent);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal void
|
||||
map_set_parent(Command_Map *map, Command_Map *parent){
|
||||
if (map != 0 && parent != 0){
|
||||
map->parent = parent->id;
|
||||
}
|
||||
}
|
||||
|
||||
internal void
|
||||
map_set_binding_text_input(Command_Map *map, Custom_Command_Function *custom){
|
||||
if (map != 0){
|
||||
map->text_input_command.custom = custom;
|
||||
}
|
||||
}
|
||||
|
||||
internal void
|
||||
map_set_binding_key(Mapping *mapping, Command_Map *map, Custom_Command_Function *custom,
|
||||
Key_Code code, Key_Modifiers *modifiers){
|
||||
if (map != 0){
|
||||
Command_Binding_List *list = map__get_or_make_list(mapping, map, code);
|
||||
Command_Modified_Binding *mod_binding = mapping__alloc_modified_binding(mapping);
|
||||
sll_stack_push(map->binding_first, mod_binding);
|
||||
if (map->binding_last == 0){
|
||||
map->binding_last = map->binding_first;
|
||||
}
|
||||
sll_stack_push(list->first, &mod_binding->order_node);
|
||||
if (list->last == 0){
|
||||
list->last= list->first;
|
||||
}
|
||||
list->count += 1;
|
||||
block_copy_struct(&mod_binding->modifiers, modifiers);
|
||||
mod_binding->binding.custom = custom;
|
||||
}
|
||||
}
|
||||
|
||||
internal Command_Binding_List*
|
||||
map_get_binding_list_on_key(Command_Map *map, Key_Code code){
|
||||
Command_Binding_List *result = 0;
|
||||
if (map != 0){
|
||||
result = map__get_list(map, code);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
internal void
|
||||
map_set_parent(Mapping *mapping, Command_Map_ID map_id, Command_Map_ID parent_id){
|
||||
Command_Map *map = mapping_get_map(mapping, map_id);
|
||||
Command_Map *parent = mapping_get_map(mapping, parent_id);
|
||||
map_set_parent(map, parent);
|
||||
}
|
||||
|
||||
internal void
|
||||
map_set_parent(Mapping *mapping, Command_Map *map, Command_Map_ID parent_id){
|
||||
Command_Map *parent = mapping_get_map(mapping, parent_id);
|
||||
map_set_parent(map, parent);
|
||||
}
|
||||
|
||||
internal void
|
||||
map_set_binding_text_input(Mapping *mapping, Command_Map_ID map_id, Custom_Command_Function *custom){
|
||||
Command_Map *map = mapping_get_map(mapping, map_id);
|
||||
map_set_binding_text_input(map, custom);
|
||||
}
|
||||
|
||||
internal void
|
||||
map_set_binding_key(Mapping *mapping, Command_Map_ID map_id, Custom_Command_Function *custom,
|
||||
Key_Code code, Key_Modifiers *modifiers){
|
||||
Command_Map *map = mapping_get_map(mapping, map_id);
|
||||
map_set_binding_key(mapping, map, custom, code, modifiers);
|
||||
}
|
||||
|
||||
internal Command_Binding_List*
|
||||
map_get_binding_list_on_key(Mapping *mapping, Command_Map_ID map_id, Key_Code code){
|
||||
Command_Map *map = mapping_get_map(mapping, map_id);
|
||||
return(map_get_binding_list_on_key(map, code));
|
||||
}
|
||||
|
||||
internal Command_Binding
|
||||
map_get_binding_non_recursive(Mapping *mapping, Command_Map_ID map_id, Input_Event *event){
|
||||
Command_Map *map = mapping_get_map(mapping, map_id);
|
||||
return(map_get_binding_non_recursive(map, event));
|
||||
}
|
||||
|
||||
internal Command_Binding
|
||||
map_get_binding_recursive(Mapping *mapping, Command_Map_ID map_id, Input_Event *event){
|
||||
Command_Map *map = mapping_get_map(mapping, map_id);
|
||||
return(map_get_binding_recursive(mapping, map, event));
|
||||
}
|
||||
|
||||
// BOTTOM
|
||||
|
|
|
@ -12,29 +12,47 @@
|
|||
#if !defined(FRED_COMMAND_H)
|
||||
#define FRED_COMMAND_H
|
||||
|
||||
struct Command_Binding{
|
||||
union Command_Binding{
|
||||
Custom_Command_Function *custom;
|
||||
u64 hash;
|
||||
};
|
||||
|
||||
struct Command_Modified_Binding{
|
||||
Command_Modified_Binding *next;
|
||||
SNode order_node;
|
||||
Key_Modifiers modifiers;
|
||||
Command_Binding binding;
|
||||
};
|
||||
|
||||
struct Command_Binding_List{
|
||||
Command_Binding_List *next;
|
||||
SNode *first;
|
||||
SNode *last;
|
||||
i32 count;
|
||||
};
|
||||
|
||||
struct Command_Map{
|
||||
i32 parent;
|
||||
Command_Binding vanilla_keyboard_default[1 << MDFR_INDEX_BINDABLE_COUNT];
|
||||
Command_Binding *commands;
|
||||
i32 count;
|
||||
i32 max;
|
||||
void *real_beginning;
|
||||
Command_Map *next;
|
||||
Command_Map_ID id;
|
||||
Command_Map_ID parent;
|
||||
Command_Binding text_input_command;
|
||||
Table_u64_u64 key_code_to_binding_list;
|
||||
Command_Modified_Binding *binding_first;
|
||||
Command_Modified_Binding *binding_last;
|
||||
Command_Binding_List *list_first;
|
||||
Command_Binding_List *list_last;
|
||||
|
||||
struct Binding_Unit *real_beginning;
|
||||
};
|
||||
|
||||
struct Mapping{
|
||||
void *memory;
|
||||
|
||||
Command_Map map_top;
|
||||
Command_Map map_file;
|
||||
|
||||
i32 *map_id_table;
|
||||
Command_Map *user_maps;
|
||||
i32 user_map_count;
|
||||
Arena *node_arena;
|
||||
Heap heap;
|
||||
Base_Allocator heap_wrapper;
|
||||
Table_u64_u64 id_to_map;
|
||||
Command_Map_ID id_counter;
|
||||
Command_Map *free_maps;
|
||||
Command_Modified_Binding *free_bindings;
|
||||
Command_Binding_List *free_lists;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -34,9 +34,9 @@ struct Text_Effect{
|
|||
};
|
||||
|
||||
struct Editing_File_Settings{
|
||||
i32 base_map_id;
|
||||
b32 dos_write_mode;
|
||||
Command_Map_ID base_map_id;
|
||||
Face_ID face_id;
|
||||
b8 dos_write_mode;
|
||||
b8 is_initialized;
|
||||
b8 unimportant;
|
||||
b8 read_only;
|
||||
|
|
|
@ -19,38 +19,46 @@
|
|||
|
||||
////////////////////////////////
|
||||
|
||||
struct Key{
|
||||
Key *next;
|
||||
struct Event_Code{
|
||||
Event_Code *next;
|
||||
String_Const_u8 name;
|
||||
};
|
||||
|
||||
struct Key_List{
|
||||
Key *first;
|
||||
Key *last;
|
||||
struct Event_Code_List{
|
||||
Event_Code *first;
|
||||
Event_Code *last;
|
||||
i32 count;
|
||||
|
||||
String_Const_u8 code_prefix;
|
||||
String_Const_u8 name_table;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
function void
|
||||
generate_keycodes(Arena *scratch, Key_List *list, FILE *out){
|
||||
generate_codes(Arena *scratch, Event_Code_List *list, FILE *out){
|
||||
String_Const_u8 code_prefix = list->code_prefix;
|
||||
String_Const_u8 name_table = list->name_table;
|
||||
|
||||
fprintf(out, "enum{\n");
|
||||
i32 counter = 1;
|
||||
for (Key *key = list->first;
|
||||
key != 0;
|
||||
key = key->next){
|
||||
fprintf(out, "KeyCode_%.*s = %d,\n", string_expand(key->name), counter);
|
||||
for (Event_Code *code = list->first;
|
||||
code != 0;
|
||||
code = code->next){
|
||||
fprintf(out, "%.*s_%.*s = %d,\n",
|
||||
string_expand(code_prefix), string_expand(code->name), counter);
|
||||
counter += 1;
|
||||
}
|
||||
fprintf(out, "KeyCode_COUNT = %d,\n", counter);
|
||||
fprintf(out, "%.*s_COUNT = %d,\n", string_expand(code_prefix), counter);
|
||||
fprintf(out, "};\n");
|
||||
|
||||
fprintf(out, "global char* key_code_name[KeyCode_COUNT] = {\n");
|
||||
fprintf(out, "\"None\"");
|
||||
for (Key *key = list->first;
|
||||
key != 0;
|
||||
key = key->next){
|
||||
fprintf(out, "\"%.*s\",\n", string_expand(key->name));
|
||||
fprintf(out, "global char* %.*s[%.*s_COUNT] = {\n",
|
||||
string_expand(name_table), string_expand(code_prefix));
|
||||
fprintf(out, "\"None\",\n");
|
||||
for (Event_Code *code = list->first;
|
||||
code != 0;
|
||||
code = code->next){
|
||||
fprintf(out, "\"%.*s\",\n", string_expand(code->name));
|
||||
counter += 1;
|
||||
}
|
||||
fprintf(out, "};\n");
|
||||
|
@ -58,80 +66,106 @@ generate_keycodes(Arena *scratch, Key_List *list, FILE *out){
|
|||
|
||||
////////////////////////////////
|
||||
|
||||
function Key*
|
||||
add_key(Arena *arena, Key_List *list, String_Const_u8 name){
|
||||
Key *key = push_array(arena, Key, 1);
|
||||
sll_queue_push(list->first, list->last, key);
|
||||
function Event_Code*
|
||||
add_code(Arena *arena, Event_Code_List *list, String_Const_u8 name){
|
||||
Event_Code *code = push_array(arena, Event_Code, 1);
|
||||
sll_queue_push(list->first, list->last, code);
|
||||
list->count;
|
||||
key->name = push_string_copy(arena, name);
|
||||
return(key);
|
||||
code->name = push_string_copy(arena, name);
|
||||
return(code);
|
||||
}
|
||||
|
||||
function Key_List
|
||||
function Event_Code_List
|
||||
make_key_list(Arena *arena){
|
||||
Key_List list = {};
|
||||
Event_Code_List list = {};
|
||||
list.code_prefix = string_u8_litexpr("KeyCode");
|
||||
list.name_table = string_u8_litexpr("key_code_name");
|
||||
for (u32 i = 'A'; i <= 'Z'; i += 1){
|
||||
u8 c = (u8)i;
|
||||
add_key(arena, &list, SCu8(&c, 1));
|
||||
add_code(arena, &list, SCu8(&c, 1));
|
||||
}
|
||||
for (u32 i = '0'; i <= '9'; i += 1){
|
||||
u8 c = (u8)i;
|
||||
add_key(arena, &list, SCu8(&c, 1));
|
||||
add_code(arena, &list, SCu8(&c, 1));
|
||||
}
|
||||
add_key(arena, &list, string_u8_litexpr("Space"));
|
||||
add_key(arena, &list, string_u8_litexpr("Tick"));
|
||||
add_key(arena, &list, string_u8_litexpr("Minus"));
|
||||
add_key(arena, &list, string_u8_litexpr("Equal"));
|
||||
add_key(arena, &list, string_u8_litexpr("LeftBracket"));
|
||||
add_key(arena, &list, string_u8_litexpr("RightBracket"));
|
||||
add_key(arena, &list, string_u8_litexpr("Semicolon"));
|
||||
add_key(arena, &list, string_u8_litexpr("Quote"));
|
||||
add_key(arena, &list, string_u8_litexpr("Comma"));
|
||||
add_key(arena, &list, string_u8_litexpr("Period"));
|
||||
add_key(arena, &list, string_u8_litexpr("ForwardSlash"));
|
||||
add_key(arena, &list, string_u8_litexpr("BackwardSlash"));
|
||||
add_key(arena, &list, string_u8_litexpr("Tab"));
|
||||
add_key(arena, &list, string_u8_litexpr("Escape"));
|
||||
add_key(arena, &list, string_u8_litexpr("Pause"));
|
||||
add_key(arena, &list, string_u8_litexpr("Up"));
|
||||
add_key(arena, &list, string_u8_litexpr("Down"));
|
||||
add_key(arena, &list, string_u8_litexpr("Left"));
|
||||
add_key(arena, &list, string_u8_litexpr("Right"));
|
||||
add_key(arena, &list, string_u8_litexpr("Backspace"));
|
||||
add_key(arena, &list, string_u8_litexpr("Return"));
|
||||
add_key(arena, &list, string_u8_litexpr("Delete"));
|
||||
add_key(arena, &list, string_u8_litexpr("Insert"));
|
||||
add_key(arena, &list, string_u8_litexpr("Home"));
|
||||
add_key(arena, &list, string_u8_litexpr("End"));
|
||||
add_key(arena, &list, string_u8_litexpr("PageUp"));
|
||||
add_key(arena, &list, string_u8_litexpr("PageDown"));
|
||||
add_key(arena, &list, string_u8_litexpr("CapsLock"));
|
||||
add_key(arena, &list, string_u8_litexpr("NumLock"));
|
||||
add_key(arena, &list, string_u8_litexpr("ScrollLock"));
|
||||
add_key(arena, &list, string_u8_litexpr("Menu"));
|
||||
add_key(arena, &list, string_u8_litexpr("Shift"));
|
||||
add_key(arena, &list, string_u8_litexpr("Control"));
|
||||
add_key(arena, &list, string_u8_litexpr("Alt"));
|
||||
add_key(arena, &list, string_u8_litexpr("Command"));
|
||||
add_code(arena, &list, string_u8_litexpr("Space"));
|
||||
add_code(arena, &list, string_u8_litexpr("Tick"));
|
||||
add_code(arena, &list, string_u8_litexpr("Minus"));
|
||||
add_code(arena, &list, string_u8_litexpr("Equal"));
|
||||
add_code(arena, &list, string_u8_litexpr("LeftBracket"));
|
||||
add_code(arena, &list, string_u8_litexpr("RightBracket"));
|
||||
add_code(arena, &list, string_u8_litexpr("Semicolon"));
|
||||
add_code(arena, &list, string_u8_litexpr("Quote"));
|
||||
add_code(arena, &list, string_u8_litexpr("Comma"));
|
||||
add_code(arena, &list, string_u8_litexpr("Period"));
|
||||
add_code(arena, &list, string_u8_litexpr("ForwardSlash"));
|
||||
add_code(arena, &list, string_u8_litexpr("BackwardSlash"));
|
||||
add_code(arena, &list, string_u8_litexpr("Tab"));
|
||||
add_code(arena, &list, string_u8_litexpr("Escape"));
|
||||
add_code(arena, &list, string_u8_litexpr("Pause"));
|
||||
add_code(arena, &list, string_u8_litexpr("Up"));
|
||||
add_code(arena, &list, string_u8_litexpr("Down"));
|
||||
add_code(arena, &list, string_u8_litexpr("Left"));
|
||||
add_code(arena, &list, string_u8_litexpr("Right"));
|
||||
add_code(arena, &list, string_u8_litexpr("Backspace"));
|
||||
add_code(arena, &list, string_u8_litexpr("Return"));
|
||||
add_code(arena, &list, string_u8_litexpr("Delete"));
|
||||
add_code(arena, &list, string_u8_litexpr("Insert"));
|
||||
add_code(arena, &list, string_u8_litexpr("Home"));
|
||||
add_code(arena, &list, string_u8_litexpr("End"));
|
||||
add_code(arena, &list, string_u8_litexpr("PageUp"));
|
||||
add_code(arena, &list, string_u8_litexpr("PageDown"));
|
||||
add_code(arena, &list, string_u8_litexpr("CapsLock"));
|
||||
add_code(arena, &list, string_u8_litexpr("NumLock"));
|
||||
add_code(arena, &list, string_u8_litexpr("ScrollLock"));
|
||||
add_code(arena, &list, string_u8_litexpr("Menu"));
|
||||
add_code(arena, &list, string_u8_litexpr("Shift"));
|
||||
add_code(arena, &list, string_u8_litexpr("Control"));
|
||||
add_code(arena, &list, string_u8_litexpr("Alt"));
|
||||
add_code(arena, &list, string_u8_litexpr("Command"));
|
||||
for (u32 i = 1; i <= 16; i += 1){
|
||||
add_key(arena, &list, push_u8_stringf(arena, "F%d", i));
|
||||
add_code(arena, &list, push_u8_stringf(arena, "F%d", i));
|
||||
}
|
||||
return(list);
|
||||
}
|
||||
|
||||
function Event_Code_List
|
||||
make_mouse_list(Arena *arena){
|
||||
Event_Code_List list = {};
|
||||
list.code_prefix = string_u8_litexpr("MouseCode");
|
||||
list.name_table = string_u8_litexpr("mouse_code_name");
|
||||
add_code(arena, &list, string_u8_litexpr("Left"));
|
||||
add_code(arena, &list, string_u8_litexpr("Middle"));
|
||||
add_code(arena, &list, string_u8_litexpr("Right"));
|
||||
return(list);
|
||||
}
|
||||
|
||||
function Event_Code_List
|
||||
make_core_list(Arena *arena){
|
||||
Event_Code_List list = {};
|
||||
list.code_prefix = string_u8_litexpr("CoreCode");
|
||||
list.name_table = string_u8_litexpr("core_code_name");
|
||||
add_code(arena, &list, string_u8_litexpr("Animate"));
|
||||
add_code(arena, &list, string_u8_litexpr("ClickActivateView"));
|
||||
add_code(arena, &list, string_u8_litexpr("ClickDeactivateView"));
|
||||
return(list);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
int
|
||||
main(void){
|
||||
Arena arena = make_arena_malloc();
|
||||
|
||||
Key_List key_list = make_key_list(&arena);
|
||||
Event_Code_List key_list = make_key_list(&arena);
|
||||
Event_Code_List mouse_list = make_mouse_list(&arena);
|
||||
Event_Code_List core_list = make_core_list(&arena);
|
||||
|
||||
String_Const_u8 path_to_self = string_u8_litexpr(__FILE__);
|
||||
path_to_self = string_remove_last_folder(path_to_self);
|
||||
String_Const_u8 file_name =
|
||||
push_u8_stringf(&arena, "%.*scustom/generated/4coder_keycodes.h",
|
||||
string_expand(path_to_self));
|
||||
push_u8_stringf(&arena, "%.*scustom/generated/4coder_event_codes.h",
|
||||
string_expand(path_to_self));
|
||||
|
||||
FILE *out = fopen((char*)file_name.str, "wb");
|
||||
if (out == 0){
|
||||
|
@ -139,7 +173,10 @@ main(void){
|
|||
exit(1);
|
||||
}
|
||||
|
||||
generate_keycodes(&arena, &key_list, out);
|
||||
generate_codes(&arena, &key_list, out);
|
||||
generate_codes(&arena, &mouse_list, out);
|
||||
generate_codes(&arena, &core_list, out);
|
||||
|
||||
fclose(out);
|
||||
return(0);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
// TOP
|
||||
|
||||
internal i32
|
||||
internal Command_Map_ID
|
||||
view_get_map(View *view){
|
||||
if (view->ui_mode){
|
||||
return(view->ui_map_id);
|
||||
|
|
|
@ -28,7 +28,7 @@ struct View{
|
|||
b8 new_scroll_target;
|
||||
|
||||
b8 ui_mode;
|
||||
i32 ui_map_id;
|
||||
Command_Map_ID ui_map_id;
|
||||
Basic_Scroll ui_scroll;
|
||||
UI_Quit_Function_Type *ui_quit;
|
||||
|
||||
|
|
|
@ -225,8 +225,8 @@ get_indentation_array(Application_Links *app, Arena *arena, Buffer_ID buffer, Ra
|
|||
|
||||
#define EMIT(N) \
|
||||
Stmnt(if (lines.first <= line_it){shifted_indentations[line_it]=N;} \
|
||||
if (line_it == lines.end){goto finished;} \
|
||||
actual_indent = N; )
|
||||
if (line_it == lines.end){goto finished;} \
|
||||
actual_indent = N; )
|
||||
|
||||
i64 line_it = line_last_indented;
|
||||
for (;line_it < line_where_token_starts;){
|
||||
|
@ -319,7 +319,7 @@ auto_indent_buffer(Application_Links *app, Buffer_ID buffer, Range_i64 pos){
|
|||
|
||||
////////////////////////////////
|
||||
|
||||
CUSTOM_COMMAND_SIG(auto_tab_whole_file)
|
||||
CUSTOM_COMMAND_SIG(auto_indent_whole_file)
|
||||
CUSTOM_DOC("Audo-indents the entire current buffer.")
|
||||
{
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
|
@ -328,7 +328,7 @@ CUSTOM_DOC("Audo-indents the entire current buffer.")
|
|||
auto_indent_buffer(app, buffer, Ii64(0, buffer_size));
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(auto_tab_line_at_cursor)
|
||||
CUSTOM_COMMAND_SIG(auto_indent_line_at_cursor)
|
||||
CUSTOM_DOC("Auto-indents the line on which the cursor sits.")
|
||||
{
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
|
@ -338,7 +338,7 @@ CUSTOM_DOC("Auto-indents the line on which the cursor sits.")
|
|||
move_past_lead_whitespace(app, view, buffer);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(auto_tab_range)
|
||||
CUSTOM_COMMAND_SIG(auto_indent_range)
|
||||
CUSTOM_DOC("Auto-indents the range between the cursor and the mark.")
|
||||
{
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
|
@ -348,20 +348,40 @@ CUSTOM_DOC("Auto-indents the range between the cursor and the mark.")
|
|||
move_past_lead_whitespace(app, view, buffer);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(write_and_auto_tab)
|
||||
CUSTOM_DOC("Inserts a character and auto-indents the line on which the cursor sits.")
|
||||
CUSTOM_COMMAND_SIG(write_text_and_auto_indent)
|
||||
CUSTOM_DOC("Inserts text and auto-indents the line on which the cursor sits if any of the text contains 'layout punctuation' such as ;:{}()[]# and new lines.")
|
||||
{
|
||||
write_character(app);
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
Indent_Flag flags = 0;
|
||||
User_Input in = get_command_input(app);
|
||||
if (in.key.character == '\n'){
|
||||
flags |= Indent_ExactAlignBlock;
|
||||
String_Const_u8 insert = to_writable(&in);
|
||||
if (insert.str != 0 && insert.size > 0){
|
||||
b32 do_auto_indent = false;
|
||||
for (umem i = 0; !do_auto_indent && i < insert.size; i += 1){
|
||||
switch (insert.str[i]){
|
||||
case ';': case ':':
|
||||
case '{': case '}':
|
||||
case '(': case ')':
|
||||
case '[': case ']':
|
||||
case '#':
|
||||
case '\n': case '\t':
|
||||
{
|
||||
do_auto_indent = true;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
if (do_auto_indent){
|
||||
View_ID view = get_active_view(app, AccessOpen);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
Range_i64 pos = {};
|
||||
pos.min = view_get_cursor_pos(app, view);
|
||||
write_text_input(app);
|
||||
pos.max= view_get_cursor_pos(app, view);
|
||||
auto_indent_buffer(app, buffer, pos, 0);
|
||||
move_past_lead_whitespace(app, view, buffer);
|
||||
}
|
||||
else{
|
||||
write_text_input(app);
|
||||
}
|
||||
}
|
||||
auto_indent_buffer(app, buffer, Ii64(pos), flags);
|
||||
move_past_lead_whitespace(app, view, buffer);
|
||||
}
|
||||
|
||||
// BOTTOM
|
||||
|
|
|
@ -11,8 +11,7 @@ typedef u32 Indent_Flag;
|
|||
enum{
|
||||
Indent_ClearLine = 0x1,
|
||||
Indent_UseTab = 0x2,
|
||||
Indent_ExactAlignBlock = 0x4,
|
||||
Indent_FullTokens = 0x8,
|
||||
Indent_FullTokens = 0x4,
|
||||
};
|
||||
|
||||
struct Nest{
|
||||
|
|
|
@ -679,7 +679,7 @@ CUSTOM_COMMAND_SIG(toggle_filebar)
|
|||
CUSTOM_DOC("Toggles the visibility status of the current view's filebar.")
|
||||
{
|
||||
View_ID view = get_active_view(app, AccessAll);
|
||||
b32 value = false;
|
||||
b64 value = false;
|
||||
view_get_setting(app, view, ViewSetting_ShowFileBar, &value);
|
||||
view_set_setting(app, view, ViewSetting_ShowFileBar, !value);
|
||||
}
|
||||
|
@ -742,7 +742,7 @@ CUSTOM_COMMAND_SIG(toggle_show_whitespace)
|
|||
CUSTOM_DOC("Toggles the current buffer's whitespace visibility status.")
|
||||
{
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
b32 show_whitespace;
|
||||
b64 show_whitespace = false;
|
||||
view_get_setting(app, view, ViewSetting_ShowWhitespace, &show_whitespace);
|
||||
view_set_setting(app, view, ViewSetting_ShowWhitespace, !show_whitespace);
|
||||
}
|
||||
|
@ -844,18 +844,18 @@ isearch(Application_Links *app, Scan_Direction start_scan, String_Const_u8 query
|
|||
}
|
||||
isearch__update_highlight(app, view, Ii64_size(pos, match_size));
|
||||
|
||||
in = get_user_input(app, EventOnAnyKey, EventOnEsc);
|
||||
in = get_user_input(app, EventProperty_AnyKey, EventProperty_Escape);
|
||||
if (in.abort){
|
||||
break;
|
||||
}
|
||||
|
||||
String_Const_u8 string = to_writable(&in);
|
||||
|
||||
|
||||
b32 string_change = false;
|
||||
if (input_match_key_code(&in, KeyCode_Return) ||
|
||||
input_match_key_code(&in, KeyCode_Tab)){
|
||||
if (in.key.modifiers[MDFR_CONTROL_INDEX]){
|
||||
if (match_key_code(&in, KeyCode_Return) ||
|
||||
match_key_code(&in, KeyCode_Tab)){
|
||||
Key_Modifiers *mods = &in.event.key.modifiers;
|
||||
if (mods->modifiers[MDFR_CONTROL_INDEX]){
|
||||
bar.string.size = cstring_length(previous_isearch_query);
|
||||
block_copy(bar.string.str, previous_isearch_query, bar.string.size);
|
||||
}
|
||||
|
@ -867,19 +867,19 @@ isearch(Application_Links *app, Scan_Direction start_scan, String_Const_u8 query
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if (length != 0 && key_is_unmodified(&in.key)){
|
||||
String_u8 string = Su8(bar.string, sizeof(bar_string_space));
|
||||
string_append(&string, SCu8(character, length));
|
||||
bar.string = string.string;
|
||||
else if (string.str != 0 && string.size > 0){
|
||||
String_u8 bar_string = Su8(bar.string, sizeof(bar_string_space));
|
||||
string_append(&bar_string, string);
|
||||
bar.string = bar_string.string;
|
||||
string_change = true;
|
||||
}
|
||||
else if (in.key.keycode == KeyCode_Backspace){
|
||||
if (key_is_unmodified(&in.key)){
|
||||
else if (match_key_code(&in, KeyCode_Backspace)){
|
||||
if (is_unmodified_key(&in.event)){
|
||||
umem old_bar_string_size = bar.string.size;
|
||||
bar.string = backspace_utf8(bar.string);
|
||||
string_change = (bar.string.size < old_bar_string_size);
|
||||
}
|
||||
else if (in.key.modifiers[MDFR_CONTROL_INDEX]){
|
||||
else if (in.event.key.modifiers.modifiers[MDFR_CONTROL_INDEX]){
|
||||
if (bar.string.size > 0){
|
||||
string_change = true;
|
||||
bar.string.size = 0;
|
||||
|
@ -890,20 +890,20 @@ isearch(Application_Links *app, Scan_Direction start_scan, String_Const_u8 query
|
|||
b32 do_scan_action = false;
|
||||
Scan_Direction change_scan = scan;
|
||||
if (!string_change){
|
||||
if (in.command.command == search ||
|
||||
in.key.keycode == KeyCode_PageDown ||
|
||||
in.key.keycode == KeyCode_Down){
|
||||
if (in.command == search ||
|
||||
match_key_code(&in, KeyCode_PageDown) ||
|
||||
match_key_code(&in, KeyCode_Down)){
|
||||
change_scan = Scan_Forward;
|
||||
do_scan_action = true;
|
||||
}
|
||||
if (in.command.command == reverse_search ||
|
||||
in.key.keycode == KeyCode_PageUp ||
|
||||
in.key.keycode == KeyCode_Up){
|
||||
if (in.command == reverse_search ||
|
||||
match_key_code(&in, KeyCode_PageUp) ||
|
||||
match_key_code(&in, KeyCode_Up)){
|
||||
change_scan = Scan_Backward;
|
||||
do_scan_action = true;
|
||||
}
|
||||
|
||||
if (in.command.command == mouse_wheel_scroll){
|
||||
if (in.command == mouse_wheel_scroll){
|
||||
mouse_wheel_scroll(app);
|
||||
}
|
||||
}
|
||||
|
@ -1092,13 +1092,16 @@ query_replace_base(Application_Links *app, View_ID view, Buffer_ID buffer_id, i6
|
|||
Range_i64 match = Ii64(new_pos, new_pos + r.size);
|
||||
isearch__update_highlight(app, view, match);
|
||||
|
||||
in = get_user_input(app, EventOnAnyKey, EventOnMouseLeftButton|EventOnMouseRightButton);
|
||||
if (in.abort ||
|
||||
in.key.keycode == KeyCode_Escape ||
|
||||
!key_is_unmodified(&in.key)) break;
|
||||
in = get_user_input(app, EventProperty_AnyKey,
|
||||
EventProperty_MouseLeft|
|
||||
EventProperty_MouseRight);
|
||||
if (in.abort || match_key_code(&in, KeyCode_Escape) || !is_unmodified_key(&in.event)){
|
||||
break;
|
||||
}
|
||||
|
||||
if (in.key.character == 'y' || in.key.character == 'Y' ||
|
||||
in.key.character == '\n' || in.key.character == '\t'){
|
||||
if (match_key_code(&in, KeyCode_Y) ||
|
||||
match_key_code(&in, KeyCode_Return) ||
|
||||
match_key_code(&in, KeyCode_Tab)){
|
||||
buffer_replace_range(app, buffer_id, match, w);
|
||||
pos = match.start + w.size;
|
||||
}
|
||||
|
@ -1260,8 +1263,8 @@ CUSTOM_DOC("Deletes the file of the current buffer if 4coder has the appropriate
|
|||
if (start_query_bar(app, &bar, 0) != 0){
|
||||
b32 cancelled = false;
|
||||
for (;!cancelled;){
|
||||
User_Input in = get_user_input(app, EventOnAnyKey, 0);
|
||||
switch (in.key.keycode){
|
||||
User_Input in = get_user_input(app, EventProperty_AnyKey, 0);
|
||||
switch (in.event.key.code){
|
||||
case KeyCode_Y:
|
||||
{
|
||||
delete_file_base(app, file_name, buffer);
|
||||
|
@ -1706,27 +1709,27 @@ multi_paste_interactive_up_down(Application_Links *app, i32 paste_count, i32 cli
|
|||
|
||||
User_Input in = {};
|
||||
for (;;){
|
||||
in = get_user_input(app, EventOnAnyKey, EventOnEsc);
|
||||
in = get_user_input(app, EventProperty_AnyKey, EventProperty_Escape);
|
||||
if (in.abort) break;
|
||||
|
||||
b32 did_modify = false;
|
||||
if (in.key.keycode == KeyCode_Up){
|
||||
if (match_key_code(&in, KeyCode_Up)){
|
||||
if (paste_count > 1){
|
||||
--paste_count;
|
||||
did_modify = true;
|
||||
}
|
||||
}
|
||||
else if (in.key.keycode == KeyCode_Down){
|
||||
else if (match_key_code(&in, KeyCode_Down)){
|
||||
if (paste_count < clip_count){
|
||||
++paste_count;
|
||||
did_modify = true;
|
||||
}
|
||||
}
|
||||
else if (in.key.keycode == KeyCode_R){
|
||||
else if (match_key_code(&in, KeyCode_R)){
|
||||
old_to_new = !old_to_new;
|
||||
did_modify = true;
|
||||
}
|
||||
else if (in.key.keycode == KeyCode_Return){
|
||||
else if (match_key_code(&in, KeyCode_Return)){
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -2909,6 +2909,15 @@ heap_init(Heap *heap, Base_Allocator *allocator){
|
|||
heap->total_space = 0;
|
||||
}
|
||||
|
||||
internal void
|
||||
heap_init(Heap *heap, Arena *arena){
|
||||
heap->arena = arena;
|
||||
heap__sent_init(&heap->in_order);
|
||||
heap__sent_init(&heap->free_nodes);
|
||||
heap->used_space = 0;
|
||||
heap->total_space = 0;
|
||||
}
|
||||
|
||||
internal Base_Allocator*
|
||||
heap_get_base_allocator(Heap *heap){
|
||||
return(heap->arena->base_allocator);
|
||||
|
@ -2916,7 +2925,9 @@ heap_get_base_allocator(Heap *heap){
|
|||
|
||||
internal void
|
||||
heap_free_all(Heap *heap){
|
||||
linalloc_clear(heap->arena);
|
||||
if (heap->arena == &heap->arena_){
|
||||
linalloc_clear(heap->arena);
|
||||
}
|
||||
block_zero_struct(heap);
|
||||
}
|
||||
|
||||
|
@ -6398,51 +6409,51 @@ string_u16_from_string_u32(Arena *arena, String_Const_u32 string, String_Fill_Te
|
|||
|
||||
internal String_char
|
||||
string_char_from_string_u8(Arena *arena, String_Const_u8 string){
|
||||
return(string_char_from_string_u8(arena, string, StringFill_NoTerminate));
|
||||
return(string_char_from_string_u8(arena, string, StringFill_NullTerminate));
|
||||
}
|
||||
internal String_char
|
||||
string_char_from_string_u16(Arena *arena, String_Const_u16 string){
|
||||
return(string_char_from_string_u16(arena, string, StringFill_NoTerminate));
|
||||
return(string_char_from_string_u16(arena, string, StringFill_NullTerminate));
|
||||
}
|
||||
internal String_char
|
||||
string_char_from_string_u32(Arena *arena, String_Const_u32 string){
|
||||
return(string_char_from_string_u32(arena, string, StringFill_NoTerminate));
|
||||
return(string_char_from_string_u32(arena, string, StringFill_NullTerminate));
|
||||
}
|
||||
internal String_u8
|
||||
string_u8_from_string_char(Arena *arena, String_Const_char string){
|
||||
return(string_u8_from_string_char(arena, string, StringFill_NoTerminate));
|
||||
return(string_u8_from_string_char(arena, string, StringFill_NullTerminate));
|
||||
}
|
||||
internal String_u8
|
||||
string_u8_from_string_u16(Arena *arena, String_Const_u16 string){
|
||||
return(string_u8_from_string_u16(arena, string, StringFill_NoTerminate));
|
||||
return(string_u8_from_string_u16(arena, string, StringFill_NullTerminate));
|
||||
}
|
||||
internal String_u8
|
||||
string_u8_from_string_u32(Arena *arena, String_Const_u32 string){
|
||||
return(string_u8_from_string_u32(arena, string, StringFill_NoTerminate));
|
||||
return(string_u8_from_string_u32(arena, string, StringFill_NullTerminate));
|
||||
}
|
||||
internal String_u16
|
||||
string_u16_from_string_char(Arena *arena, String_Const_char string){
|
||||
return(string_u16_from_string_char(arena, string, StringFill_NoTerminate));
|
||||
return(string_u16_from_string_char(arena, string, StringFill_NullTerminate));
|
||||
}
|
||||
internal String_u16
|
||||
string_u16_from_string_u8(Arena *arena, String_Const_u8 string){
|
||||
return(string_u16_from_string_u8(arena, string, StringFill_NoTerminate));
|
||||
return(string_u16_from_string_u8(arena, string, StringFill_NullTerminate));
|
||||
}
|
||||
internal String_u16
|
||||
string_u16_from_string_u32(Arena *arena, String_Const_u32 string){
|
||||
return(string_u16_from_string_u32(arena, string, StringFill_NoTerminate));
|
||||
return(string_u16_from_string_u32(arena, string, StringFill_NullTerminate));
|
||||
}
|
||||
internal String_u32
|
||||
string_u32_from_string_char(Arena *arena, String_Const_char string){
|
||||
return(string_u32_from_string_char(arena, string, StringFill_NoTerminate));
|
||||
return(string_u32_from_string_char(arena, string, StringFill_NullTerminate));
|
||||
}
|
||||
internal String_u32
|
||||
string_u32_from_string_u8(Arena *arena, String_Const_u8 string){
|
||||
return(string_u32_from_string_u8(arena, string, StringFill_NoTerminate));
|
||||
return(string_u32_from_string_u8(arena, string, StringFill_NullTerminate));
|
||||
}
|
||||
internal String_u32
|
||||
string_u32_from_string_u16(Arena *arena, String_Const_u16 string){
|
||||
return(string_u32_from_string_u16(arena, string, StringFill_NoTerminate));
|
||||
return(string_u32_from_string_u16(arena, string, StringFill_NullTerminate));
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
@ -6635,19 +6646,19 @@ string_replace(Arena *arena, String_Const_u32 source, String_Const_u32 needle, S
|
|||
|
||||
internal String_Const_char
|
||||
string_replace(Arena *arena, String_Const_char source, String_Const_char needle, String_Const_char replacement){
|
||||
return(string_replace(arena, source, needle, replacement, StringFill_NoTerminate));
|
||||
return(string_replace(arena, source, needle, replacement, StringFill_NullTerminate));
|
||||
}
|
||||
internal String_Const_u8
|
||||
string_replace(Arena *arena, String_Const_u8 source, String_Const_u8 needle, String_Const_u8 replacement){
|
||||
return(string_replace(arena, source, needle, replacement, StringFill_NoTerminate));
|
||||
return(string_replace(arena, source, needle, replacement, StringFill_NullTerminate));
|
||||
}
|
||||
internal String_Const_u16
|
||||
string_replace(Arena *arena, String_Const_u16 source, String_Const_u16 needle, String_Const_u16 replacement){
|
||||
return(string_replace(arena, source, needle, replacement, StringFill_NoTerminate));
|
||||
return(string_replace(arena, source, needle, replacement, StringFill_NullTerminate));
|
||||
}
|
||||
internal String_Const_u32
|
||||
string_replace(Arena *arena, String_Const_u32 source, String_Const_u32 needle, String_Const_u32 replacement){
|
||||
return(string_replace(arena, source, needle, replacement, StringFill_NoTerminate));
|
||||
return(string_replace(arena, source, needle, replacement, StringFill_NullTerminate));
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
|
|
@ -152,6 +152,7 @@ typedef uint64_t u64;
|
|||
|
||||
typedef i8 b8;
|
||||
typedef i32 b32;
|
||||
typedef i64 b64;
|
||||
|
||||
#if ARCH_32BIT
|
||||
typedef u32 umem;
|
||||
|
@ -1178,8 +1179,6 @@ struct Heap{
|
|||
umem total_space;
|
||||
};
|
||||
|
||||
//#define DO_HEAP_CHECKS
|
||||
|
||||
#endif
|
||||
|
||||
// BOTTOM
|
||||
|
|
|
@ -107,7 +107,7 @@ CUSTOM_DOC("If the previous command was paste or paste_next, replaces the paste
|
|||
view_post_fade(app, view, 0.667f, Ii64(pos, pos + string.size), paste.color);
|
||||
}
|
||||
else{
|
||||
exec_command(app, paste);
|
||||
paste(app);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,14 +116,14 @@ CUSTOM_COMMAND_SIG(paste_and_indent)
|
|||
CUSTOM_DOC("Paste from the top of clipboard and run auto-indent on the newly pasted text.")
|
||||
{
|
||||
paste(app);
|
||||
auto_tab_range(app);
|
||||
auto_indent_range(app);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(paste_next_and_indent)
|
||||
CUSTOM_DOC("Paste the next item on the clipboard and run auto-indent on the newly pasted text.")
|
||||
{
|
||||
paste_next(app);
|
||||
auto_tab_range(app);
|
||||
auto_indent_range(app);
|
||||
}
|
||||
|
||||
// BOTTOM
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#define FCODER_DEFAULT_FRAMEWORK_H
|
||||
|
||||
enum Default_Maps{
|
||||
default_code_map,
|
||||
default_code_map = 1,
|
||||
default_lister_ui_map,
|
||||
default_log_graph_map,
|
||||
default_maps_count,
|
||||
|
|
|
@ -31,6 +31,8 @@ START_HOOK_SIG(default_start){
|
|||
// NOTE(allen|a4.0.10): As of this version the word_complete command
|
||||
// also relies on this particular command caller hook.
|
||||
COMMAND_CALLER_HOOK(default_command_caller){
|
||||
// app, cmd
|
||||
|
||||
View_ID view = get_active_view(app, AccessAll);
|
||||
Managed_Scope scope = view_get_managed_scope(app, view);
|
||||
Rewrite_Type *next_rewrite = scope_attachment(app, scope, view_next_rewrite_loc, Rewrite_Type);
|
||||
|
@ -45,7 +47,7 @@ COMMAND_CALLER_HOOK(default_command_caller){
|
|||
}
|
||||
}
|
||||
|
||||
cmd.command(app);
|
||||
cmd(app);
|
||||
|
||||
next_rewrite = scope_attachment(app, scope, view_next_rewrite_loc, Rewrite_Type);
|
||||
if (next_rewrite != 0){
|
||||
|
@ -224,7 +226,7 @@ GET_VIEW_BUFFER_REGION_SIG(default_view_buffer_region){
|
|||
|
||||
// file bar
|
||||
{
|
||||
b32 showing_file_bar = false;
|
||||
b64 showing_file_bar = false;
|
||||
if (view_get_setting(app, view_id, ViewSetting_ShowFileBar, &showing_file_bar)){
|
||||
if (showing_file_bar){
|
||||
sub_region.y0 += line_height + 2;
|
||||
|
@ -568,7 +570,7 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
|
|||
Rect_f32 r_cursor = view_inner_rect;
|
||||
|
||||
// NOTE(allen): Filebar
|
||||
b32 showing_file_bar = false;
|
||||
b64 showing_file_bar = false;
|
||||
if (view_get_setting(app, view_id, ViewSetting_ShowFileBar, &showing_file_bar) && showing_file_bar){
|
||||
Rect_f32 bar = r_cursor;
|
||||
bar.y1 = bar.y0 + line_height + 2.f;
|
||||
|
@ -589,7 +591,7 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
|
|||
push_fancy_string(scratch, &list, base_color, unique_name);
|
||||
push_fancy_stringf(scratch, &list, base_color, " - Row: %3.lld Col: %3.lld -", cursor.line, cursor.col);
|
||||
|
||||
b32 is_dos_mode = false;
|
||||
b64 is_dos_mode = false;
|
||||
if (buffer_get_setting(app, buffer, BufferSetting_Eol, &is_dos_mode)){
|
||||
if (is_dos_mode){
|
||||
push_fancy_string(scratch, &list, base_color, string_u8_litexpr(" dos"));
|
||||
|
@ -1021,8 +1023,8 @@ BUFFER_HOOK_SIG(default_file_settings){
|
|||
}
|
||||
}
|
||||
|
||||
i32 map_id = (treat_as_code)?((i32)default_code_map):((i32)mapid_file);
|
||||
i32 map_id_query = 0;
|
||||
Command_Map_ID map_id = (treat_as_code)?(default_code_map):(mapid_file);
|
||||
Command_Map_ID map_id_query = 0;
|
||||
|
||||
buffer_set_setting(app, buffer_id, BufferSetting_MapID, default_lister_ui_map);
|
||||
buffer_get_setting(app, buffer_id, BufferSetting_MapID, &map_id_query);
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
|
||||
#include "4coder_base_types.h"
|
||||
#include "4coder_version.h"
|
||||
#include "generated/4coder_keycodes.h"
|
||||
#include "4coder_keycode_extension.h"
|
||||
#include "4coder_events.h"
|
||||
#include "4coder_default_colors.h"
|
||||
#include "4coder_types.h"
|
||||
#define DYNAMIC_LINK_API
|
||||
|
@ -54,6 +53,7 @@
|
|||
#define DYNAMIC_LINK_API
|
||||
#include "generated/system_api.cpp"
|
||||
#include "4coder_system_helpers.cpp"
|
||||
#include "4coder_events.cpp"
|
||||
#include "4coder_custom.cpp"
|
||||
#include "4coder_log.cpp"
|
||||
#include "4coder_hash_functions.cpp"
|
||||
|
|
|
@ -0,0 +1,152 @@
|
|||
/*
|
||||
* 4coder event helpers
|
||||
*/
|
||||
|
||||
// TOP
|
||||
|
||||
internal b32
|
||||
is_unmodified_key(Input_Event *event){
|
||||
b32 result = false;
|
||||
if (event->kind == InputEventKind_KeyStroke){
|
||||
b8 *mods = event->key.modifiers.modifiers;
|
||||
result = (!mods[MDFR_CONTROL_INDEX] && !mods[MDFR_ALT_INDEX]);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal b32
|
||||
is_modified(Input_Event *event){
|
||||
b8 *mods = 0;
|
||||
switch (event->kind){
|
||||
case InputEventKind_TextInsert:
|
||||
{
|
||||
mods = event->text.modifiers.modifiers;
|
||||
}break;
|
||||
case InputEventKind_KeyStroke:
|
||||
{
|
||||
mods = event->key.modifiers.modifiers;
|
||||
}break;
|
||||
case InputEventKind_MouseButton:
|
||||
{
|
||||
mods = event->mouse.modifiers.modifiers;
|
||||
}break;
|
||||
}
|
||||
b32 result = false;
|
||||
if (mods != 0){
|
||||
result = (mods[MDFR_CONTROL_INDEX] ||
|
||||
mods[MDFR_ALT_INDEX] ||
|
||||
mods[MDFR_SHIFT_INDEX] ||
|
||||
mods[MDFR_COMMAND_INDEX]);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal String_Const_u8
|
||||
to_writable(Input_Event *event){
|
||||
String_Const_u8 result = {};
|
||||
if (event->kind == InputEventKind_TextInsert){
|
||||
result = event->text.string;
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal b32
|
||||
match_key_code(Input_Event *event, Key_Code code){
|
||||
return(event->kind == InputEventKind_KeyStroke && event->key.code == code);
|
||||
}
|
||||
|
||||
internal b32
|
||||
match_mouse_code(Input_Event *event, Mouse_Code code){
|
||||
return(event->kind == InputEventKind_MouseButton &&
|
||||
event->mouse.code == code && !event->mouse.release);
|
||||
}
|
||||
|
||||
internal b32
|
||||
match_mouse_code_release(Input_Event *event, Mouse_Code code){
|
||||
return(event->kind == InputEventKind_MouseButton &&
|
||||
event->mouse.code == code && event->mouse.release);
|
||||
}
|
||||
|
||||
internal b32
|
||||
match_core_code(Input_Event *event, Core_Code code){
|
||||
return(event->kind == InputEventKind_Core && event->core.code == code);
|
||||
}
|
||||
|
||||
internal Event_Property
|
||||
get_event_properties(Input_Event *event){
|
||||
Event_Property flags = 0;
|
||||
|
||||
switch (event->kind){
|
||||
case InputEventKind_TextInsert:
|
||||
{
|
||||
flags |= EventProperty_TextInsert;
|
||||
}break;
|
||||
|
||||
case InputEventKind_KeyStroke:
|
||||
{
|
||||
if (event->key.code == KeyCode_Escape){
|
||||
flags |= EventProperty_Escape;
|
||||
}
|
||||
flags |= EventProperty_AnyKey;
|
||||
}break;
|
||||
|
||||
case InputEventKind_MouseButton:
|
||||
{
|
||||
switch (event->mouse.code){
|
||||
case MouseCode_Left:
|
||||
{
|
||||
flags |= EventProperty_MouseLeft;
|
||||
}break;
|
||||
|
||||
case MouseCode_Middle:
|
||||
{
|
||||
flags |= EventProperty_MouseMiddle;
|
||||
}break;
|
||||
|
||||
case MouseCode_Right:
|
||||
{
|
||||
flags |= EventProperty_MouseRight;
|
||||
}break;
|
||||
}
|
||||
}break;
|
||||
|
||||
case InputEventKind_MouseWheel:
|
||||
{
|
||||
flags |= EventProperty_MouseWheel;
|
||||
}break;
|
||||
|
||||
case InputEventKind_MouseMove:
|
||||
{
|
||||
flags |= EventProperty_MouseMove;
|
||||
}break;
|
||||
|
||||
case InputEventKind_Core:
|
||||
{
|
||||
switch (event->core.code){
|
||||
case CoreCode_Animate:
|
||||
{
|
||||
flags |= EventProperty_Animate;
|
||||
}break;
|
||||
|
||||
case CoreCode_ClickActivateView:
|
||||
case CoreCode_ClickDeactivateView:
|
||||
{
|
||||
flags |= EventProperty_ViewActivation;
|
||||
}break;
|
||||
}
|
||||
}break;
|
||||
}
|
||||
|
||||
return(flags);
|
||||
}
|
||||
|
||||
internal Input_Event*
|
||||
push_input_event(Arena *arena, Input_List *list, Input_Event *event){
|
||||
Input_Event_Node *node = push_array(arena, Input_Event_Node, 1);
|
||||
block_copy_struct(&node->event, event);
|
||||
sll_queue_push(list->first, list->last, node);
|
||||
list->count += 1;
|
||||
return(&node->event);
|
||||
}
|
||||
|
||||
// BOTTOM
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* 4coder event types
|
||||
*/
|
||||
|
||||
// TOP
|
||||
|
||||
#if !defined(FCODER_EVENTS_H)
|
||||
#define FCODER_EVENTS_H
|
||||
|
||||
typedef u32 Key_Code;
|
||||
typedef u32 Mouse_Code;
|
||||
typedef u32 Core_Code;
|
||||
#include "generated/4coder_event_codes.h"
|
||||
|
||||
typedef i32 Input_Event_Kind;
|
||||
enum{
|
||||
InputEventKind_TextInsert,
|
||||
InputEventKind_KeyStroke,
|
||||
InputEventKind_MouseButton,
|
||||
InputEventKind_MouseWheel,
|
||||
InputEventKind_MouseMove,
|
||||
InputEventKind_Core,
|
||||
};
|
||||
|
||||
typedef i32 Key_Modifier_Index;
|
||||
enum{
|
||||
MDFR_SHIFT_INDEX,
|
||||
MDFR_CONTROL_INDEX,
|
||||
MDFR_ALT_INDEX,
|
||||
MDFR_COMMAND_INDEX,
|
||||
|
||||
MDFR_INDEX_BINDABLE_COUNT,
|
||||
|
||||
MDFR_CAPS_INDEX = MDFR_INDEX_BINDABLE_COUNT,
|
||||
MDFR_HOLD_INDEX,
|
||||
|
||||
MDFR_INDEX_COUNT,
|
||||
};
|
||||
|
||||
struct Key_Modifiers{
|
||||
b8 modifiers[MDFR_INDEX_COUNT];
|
||||
};
|
||||
|
||||
struct Input_Event{
|
||||
Input_Event_Kind kind;
|
||||
union{
|
||||
struct{
|
||||
String_Const_u8 string;
|
||||
Key_Modifiers modifiers;
|
||||
} text;
|
||||
struct{
|
||||
Key_Code code;
|
||||
Key_Modifiers modifiers;
|
||||
} key;
|
||||
struct{
|
||||
Mouse_Code code;
|
||||
Key_Modifiers modifiers;
|
||||
Vec2_i32 p;
|
||||
b32 release;
|
||||
} mouse;
|
||||
struct{
|
||||
f32 value;
|
||||
Vec2_i32 p;
|
||||
} mouse_wheel;
|
||||
struct{
|
||||
Vec2_i32 p;
|
||||
} mouse_move;
|
||||
struct{
|
||||
Core_Code code;
|
||||
} core;
|
||||
};
|
||||
};
|
||||
|
||||
struct Input_Event_Node{
|
||||
Input_Event_Node *next;
|
||||
Input_Event event;
|
||||
};
|
||||
|
||||
struct Input_List{
|
||||
Input_Event_Node *first;
|
||||
Input_Event_Node *last;
|
||||
i32 count;
|
||||
};
|
||||
|
||||
typedef u32 Event_Property;
|
||||
enum{
|
||||
EventProperty_AnyKey = 0x1,
|
||||
EventProperty_Escape = 0x2,
|
||||
EventProperty_MouseLeft = 0x4,
|
||||
EventProperty_MouseMiddle = 0x8,
|
||||
EventProperty_MouseRight = 0x10,
|
||||
EventProperty_MouseWheel = 0x20,
|
||||
EventProperty_MouseMove = 0x40,
|
||||
EventProperty_Animate = 0x80,
|
||||
EventProperty_ViewActivation = 0x100,
|
||||
EventProperty_TextInsert = 0x200,
|
||||
};
|
||||
enum{
|
||||
EventPropertyGroup_AnyKeyboardEvent =
|
||||
EventProperty_AnyKey|
|
||||
EventProperty_Escape|
|
||||
EventProperty_TextInsert,
|
||||
EventPropertyGroup_AnyMouseButton =
|
||||
EventProperty_MouseLeft|
|
||||
EventProperty_MouseMiddle|
|
||||
EventProperty_MouseRight,
|
||||
EventPropertyGroup_AnyMouseEvent =
|
||||
EventPropertyGroup_AnyMouseButton|
|
||||
EventProperty_MouseWheel|
|
||||
EventProperty_MouseMove,
|
||||
EventPropertyGroup_AnyUserInput =
|
||||
EventPropertyGroup_AnyKeyboardEvent|
|
||||
EventPropertyGroup_AnyMouseEvent,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// BOTTOM
|
|
@ -69,7 +69,7 @@ end_map(Bind_Helper *helper){
|
|||
}
|
||||
|
||||
internal void
|
||||
bind(Bind_Helper *helper, Key_Code code, uint8_t modifiers, Custom_Command_Function *func){
|
||||
bind(Bind_Helper *helper, Key_Code code, u8 modifiers, Custom_Command_Function *func){
|
||||
if (helper->group == 0 && helper->error == 0){
|
||||
helper->error = BH_ERR_MISSING_BEGIN;
|
||||
}
|
||||
|
@ -87,17 +87,12 @@ bind(Bind_Helper *helper, Key_Code code, uint8_t modifiers, Custom_Command_Funct
|
|||
}
|
||||
|
||||
internal void
|
||||
bind(Bind_Helper *helper, Key_Code code, uint8_t modifiers, Generic_Command cmd){
|
||||
bind(helper, code, modifiers, cmd.command);
|
||||
}
|
||||
|
||||
internal void
|
||||
bind_vanilla_keys(Bind_Helper *helper, Custom_Command_Function *func){
|
||||
bind_text_input(Bind_Helper *helper, Custom_Command_Function *func){
|
||||
bind(helper, 0, 0, func);
|
||||
}
|
||||
|
||||
internal void
|
||||
bind_vanilla_keys(Bind_Helper *helper, unsigned char modifiers, Custom_Command_Function *func){
|
||||
bind_text_input(Bind_Helper *helper, unsigned char modifiers, Custom_Command_Function *func){
|
||||
bind(helper, 0, modifiers, func);
|
||||
}
|
||||
|
||||
|
@ -1505,33 +1500,9 @@ find_all_matches_all_buffers(Application_Links *app, Arena *arena, String_Const_
|
|||
|
||||
////////////////////////////////
|
||||
|
||||
internal void
|
||||
exec_command(Application_Links *app, Custom_Command_Function *func){
|
||||
func(app);
|
||||
}
|
||||
|
||||
internal void
|
||||
exec_command(Application_Links *app, Generic_Command cmd){
|
||||
exec_command(app, cmd.command);
|
||||
}
|
||||
|
||||
internal b32
|
||||
is_unmodified_key(Input_Event *event){
|
||||
b32 result = false;
|
||||
if (event->kind == InputEventKind_KeyStroke){
|
||||
b8 *mods = event->key.modifiers.modifiers;
|
||||
result = (!mods[MDFR_CONTROL_INDEX] && !mods[MDFR_ALT_INDEX]);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal String_Const_u8
|
||||
to_writable(Input_Event *event){
|
||||
String_Const_u8 result = {};
|
||||
if (event->kind != InputEventKind_TextInsert){
|
||||
result = event->text.string;
|
||||
}
|
||||
return(result);
|
||||
is_modified(User_Input *input){
|
||||
return(is_modified(&input->event));
|
||||
}
|
||||
|
||||
internal String_Const_u8
|
||||
|
@ -1539,6 +1510,16 @@ to_writable(User_Input *in){
|
|||
return(to_writable(&in->event));
|
||||
}
|
||||
|
||||
internal b32
|
||||
match_key_code(User_Input *in, Key_Code key_code){
|
||||
return(match_key_code(&in->event, key_code));
|
||||
}
|
||||
|
||||
internal b32
|
||||
match_core_code(User_Input *in, Key_Code core_code){
|
||||
return(match_core_code(&in->event, core_code));
|
||||
}
|
||||
|
||||
internal String_Const_u8
|
||||
backspace_utf8(String_Const_u8 string){
|
||||
if (string.size > 0){
|
||||
|
@ -1571,7 +1552,10 @@ query_user_general(Application_Links *app, Query_Bar *bar, b32 force_number){
|
|||
// types specified in the flags. The first set of flags are inputs you'd like to intercept
|
||||
// that you don't want to abort on. The second set are inputs that you'd like to cause
|
||||
// the command to abort. If an event satisfies both flags, it is treated as an abort.
|
||||
User_Input in = get_user_input(app, EventOnAnyKey, EventOnEsc|EventOnMouseLeftButton|EventOnMouseRightButton);
|
||||
User_Input in = get_user_input(app, EventProperty_AnyKey,
|
||||
EventProperty_Escape|
|
||||
EventProperty_MouseLeft|
|
||||
EventProperty_MouseRight);
|
||||
|
||||
// NOTE(allen|a3.4.4): The responsible thing to do on abort is to end the command
|
||||
// without waiting on get_user_input again.
|
||||
|
|
|
@ -559,15 +559,12 @@ CUSTOM_DOC("If a buffer containing jump locations has been locked in, goes to th
|
|||
// Insert Newline or Tigger Jump on Read Only Buffer
|
||||
//
|
||||
|
||||
CUSTOM_COMMAND_SIG(newline_or_goto_position)
|
||||
CUSTOM_COMMAND_SIG(if_read_only_goto_position)
|
||||
CUSTOM_DOC("If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.")
|
||||
{
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
if (buffer != 0){
|
||||
write_character(app);
|
||||
}
|
||||
else{
|
||||
if (buffer == 0){
|
||||
buffer = view_get_buffer(app, view, AccessProtected);
|
||||
if (buffer != 0){
|
||||
goto_jump_at_cursor(app);
|
||||
|
@ -576,15 +573,12 @@ CUSTOM_DOC("If the buffer in the active view is writable, inserts a character, o
|
|||
}
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(newline_or_goto_position_same_panel)
|
||||
CUSTOM_COMMAND_SIG(if_read_only_goto_position_same_panel)
|
||||
CUSTOM_DOC("If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.")
|
||||
{
|
||||
View_ID view = get_active_view(app, AccessProtected);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
if (buffer != 0){
|
||||
write_character(app);
|
||||
}
|
||||
else{
|
||||
if (buffer == 0){
|
||||
buffer = view_get_buffer(app, view, AccessProtected);
|
||||
if (buffer != 0){
|
||||
goto_jump_at_cursor_same_panel(app);
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* Mr. 4th Dimention - Allen Webster
|
||||
*
|
||||
* 09.10.2019
|
||||
*
|
||||
* Temporary file for making the transition to a new event API easier.
|
||||
*
|
||||
*/
|
||||
|
||||
// TOP
|
||||
|
||||
enum{
|
||||
KeyCodeExt_MouseLeft = KeyCode_COUNT,
|
||||
KeyCodeExt_MouseRight,
|
||||
KeyCodeExt_MouseLeftRelease,
|
||||
KeyCodeExt_MouseRightRelease,
|
||||
KeyCodeExt_MouseWheel,
|
||||
KeyCodeExt_MouseMove,
|
||||
KeyCodeExt_Animate,
|
||||
KeyCodeExt_ClickActivateView,
|
||||
KeyCodeExt_ClickDeactivateView,
|
||||
KeyCodeExt_TextInput,
|
||||
};
|
||||
|
||||
// BOTOTM
|
||||
|
|
@ -117,18 +117,17 @@ CUSTOM_DOC("A lister mode command that updates the lists UI data.")
|
|||
}
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(lister__write_character__default)
|
||||
CUSTOM_COMMAND_SIG(lister__write_string__default)
|
||||
CUSTOM_DOC("A lister mode command that inserts a new character to the text field.")
|
||||
{
|
||||
View_ID view = get_active_view(app, AccessAll);
|
||||
Lister_State *state = view_get_lister_state(view);
|
||||
if (state->initialized){
|
||||
User_Input in = get_command_input(app);
|
||||
u8 character[4];
|
||||
u32 length = to_writable_character(in, character);
|
||||
if (length > 0){
|
||||
lister_append_text_field(&state->lister, SCu8(character, length));
|
||||
lister_append_key(&state->lister, SCu8(character, length));
|
||||
String_Const_u8 string = to_writable(&in);
|
||||
if (string.str != 0 && string.size > 0){
|
||||
lister_append_text_field(&state->lister, string);
|
||||
lister_append_key(&state->lister, string);
|
||||
state->item_index = 0;
|
||||
view_zero_scroll(app, view);
|
||||
lister_update_ui(app, view, state);
|
||||
|
@ -187,13 +186,12 @@ CUSTOM_DOC("A lister mode command that inserts a character into the text field o
|
|||
Lister_State *state = view_get_lister_state(view);
|
||||
if (state->initialized){
|
||||
User_Input in = get_command_input(app);
|
||||
u8 character[4];
|
||||
u32 length = to_writable_character(in, character);
|
||||
if (length > 0){
|
||||
lister_append_text_field(&state->lister, SCu8(character, length));
|
||||
String_Const_u8 string = to_writable(&in);
|
||||
if (string.str != 0 && string.size > 0){
|
||||
lister_append_text_field(&state->lister, string);
|
||||
String_Const_u8 front_name = string_front_of_path(state->lister.data.text_field.string);
|
||||
lister_set_key(&state->lister, front_name);
|
||||
if (character[0] == '/' || character[0] == '\\'){
|
||||
if (character_is_slash(string.str[0])){
|
||||
String_Const_u8 new_hot = state->lister.data.text_field.string;
|
||||
set_hot_directory(app, new_hot);
|
||||
lister_call_refresh_handler(app, &state->lister);
|
||||
|
@ -214,15 +212,12 @@ CUSTOM_DOC("A lister mode command that backspaces one character from the text fi
|
|||
if (state->lister.data.text_field.size > 0){
|
||||
char last_char = state->lister.data.text_field.str[state->lister.data.text_field.size - 1];
|
||||
state->lister.data.text_field.string = backspace_utf8(state->lister.data.text_field.string);
|
||||
if (last_char == '/' || last_char == '\\'){
|
||||
if (character_is_slash(last_char)){
|
||||
User_Input input = get_command_input(app);
|
||||
String_Const_u8 text_field = state->lister.data.text_field.string;
|
||||
String_Const_u8 new_hot = string_remove_last_folder(text_field);
|
||||
b32 is_modified = (input.key.modifiers[MDFR_SHIFT_INDEX] ||
|
||||
input.key.modifiers[MDFR_CONTROL_INDEX] ||
|
||||
input.key.modifiers[MDFR_ALT_INDEX] ||
|
||||
input.key.modifiers[MDFR_COMMAND_INDEX]);
|
||||
b32 whole_word_backspace = (is_modified == global_config.file_lister_per_character_backspace);
|
||||
b32 input_is_modified = is_modified(&input);
|
||||
b32 whole_word_backspace = (input_is_modified == global_config.file_lister_per_character_backspace);
|
||||
if (whole_word_backspace){
|
||||
state->lister.data.text_field.size = new_hot.size;
|
||||
}
|
||||
|
@ -254,9 +249,8 @@ CUSTOM_DOC("A lister mode command that handles input for the fixed sure to kill
|
|||
Lister_State *state = view_get_lister_state(view);
|
||||
if (state->initialized){
|
||||
User_Input in = get_command_input(app);
|
||||
u8 character[4];
|
||||
u32 length = to_writable_character(in, character);
|
||||
if (length > 0){
|
||||
String_Const_u8 string = to_writable(&in);
|
||||
if (string.str != 0 && string.size > 0){
|
||||
void *user_data = 0;
|
||||
b32 did_shortcut_key = false;
|
||||
for (Lister_Node *node = state->lister.data.options.first;
|
||||
|
@ -264,7 +258,7 @@ CUSTOM_DOC("A lister mode command that handles input for the fixed sure to kill
|
|||
node = node->next){
|
||||
char *hotkeys = (char*)(node + 1);
|
||||
String_Const_u8 hot_key_string = SCu8(hotkeys);
|
||||
if (string_find_first(hot_key_string, SCu8(character, length)) < hot_key_string.size){
|
||||
if (string_find_first(hot_key_string, string) < hot_key_string.size){
|
||||
user_data = node->user_data;
|
||||
did_shortcut_key = true;
|
||||
break;
|
||||
|
@ -282,7 +276,7 @@ CUSTOM_DOC("A lister mode command that handles input for the fixed sure to kill
|
|||
static Lister_Handlers
|
||||
lister_get_default_handlers(void){
|
||||
Lister_Handlers handlers = {};
|
||||
handlers.write_character = lister__write_character__default;
|
||||
handlers.write_character = lister__write_string__default;
|
||||
handlers.backspace = lister__backspace_text_field__default;
|
||||
handlers.navigate_up = lister__move_up__default;
|
||||
handlers.navigate_down = lister__move_down__default;
|
||||
|
|
|
@ -1024,9 +1024,9 @@ internal void
|
|||
fill_log_graph_command_map(Bind_Helper *context){
|
||||
begin_map(context, default_log_graph_map);
|
||||
bind(context, KeyCode_Escape, MDFR_NONE, log_graph__escape);
|
||||
bind(context, KeyCodeExt_MouseWheel, MDFR_NONE, log_graph__scroll_wheel);
|
||||
bind(context, KeyCodeExt_MouseLeft, MDFR_NONE, log_graph__click_jump_to_event_source);
|
||||
bind(context, KeyCodeExt_MouseRight, MDFR_NONE, log_graph__click_select_event);
|
||||
//bind(context, KeyCodeExt_MouseWheel, MDFR_NONE, log_graph__scroll_wheel);
|
||||
//bind(context, KeyCodeExt_MouseLeft, MDFR_NONE, log_graph__click_jump_to_event_source);
|
||||
//bind(context, KeyCodeExt_MouseRight, MDFR_NONE, log_graph__click_select_event);
|
||||
bind(context, KeyCode_PageUp, MDFR_NONE, log_graph__page_up);
|
||||
bind(context, KeyCode_PageDown, MDFR_NONE, log_graph__page_down);
|
||||
end_map(context);
|
||||
|
|
|
@ -947,20 +947,22 @@ CUSTOM_DOC("Run an 'fkey command' configured in a project.4coder file. Determin
|
|||
User_Input input = get_command_input(app);
|
||||
b32 got_ind = false;
|
||||
i32 ind = 0;
|
||||
if (input.key.keycode >= KeyCode_F1 && input.key.keycode <= KeyCode_F16){
|
||||
ind = (input.key.keycode - KeyCode_F1);
|
||||
got_ind = true;
|
||||
}
|
||||
else if (input.key.character_no_caps_lock >= '1' && input.key.character_no_caps_lock >= '9'){
|
||||
ind = (input.key.character_no_caps_lock - '1');
|
||||
got_ind = true;
|
||||
}
|
||||
else if (input.key.character_no_caps_lock == '0'){
|
||||
ind = 9;
|
||||
got_ind = true;
|
||||
}
|
||||
if (got_ind){
|
||||
exec_project_fkey_command(app, ind);
|
||||
if (input.event.kind == InputEventKind_KeyStroke){
|
||||
if (KeyCode_F1 <= input.event.key.code && input.event.key.code <= KeyCode_F16){
|
||||
ind = (input.event.key.code - KeyCode_F1);
|
||||
got_ind = true;
|
||||
}
|
||||
else if (KeyCode_1 <= input.event.key.code && input.event.key.code <= KeyCode_9){
|
||||
ind = (input.event.key.code - '1');
|
||||
got_ind = true;
|
||||
}
|
||||
else if (input.event.key.code == KeyCode_0){
|
||||
ind = 9;
|
||||
got_ind = true;
|
||||
}
|
||||
if (got_ind){
|
||||
exec_project_fkey_command(app, ind);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,20 +62,6 @@ ENUM(u32, Child_Process_Set_Target_Flags){
|
|||
ChildProcessSet_CursorAtEnd = 4,
|
||||
};
|
||||
|
||||
ENUM(i32, Key_Modifier_Index){
|
||||
MDFR_SHIFT_INDEX,
|
||||
MDFR_CONTROL_INDEX,
|
||||
MDFR_ALT_INDEX,
|
||||
MDFR_COMMAND_INDEX,
|
||||
|
||||
MDFR_INDEX_BINDABLE_COUNT,
|
||||
|
||||
MDFR_CAPS_INDEX = MDFR_INDEX_BINDABLE_COUNT,
|
||||
MDFR_HOLD_INDEX,
|
||||
|
||||
MDFR_INDEX_COUNT
|
||||
};
|
||||
|
||||
ENUM(u32, Key_Modifier_Flag){
|
||||
MDFR_NONE = 0x0,
|
||||
MDFR_CTRL = 0x1,
|
||||
|
@ -179,18 +165,6 @@ ENUM(u32, Set_Buffer_Flag){
|
|||
SetBuffer_KeepOriginalGUI = 0x1
|
||||
};
|
||||
|
||||
ENUM(u32, Input_Type_Flag){
|
||||
EventOnAnyKey = 0x1,
|
||||
EventOnEsc = 0x2,
|
||||
EventOnMouseLeftButton = 0x4,
|
||||
EventOnMouseRightButton = 0x8,
|
||||
EventOnMouseWheel = 0x10,
|
||||
EventOnMouseMove = 0x20,
|
||||
EventOnAnimate = 0x40,
|
||||
EventOnViewActivation = 0x80,
|
||||
EventAll = 0xFFFFFFFF,
|
||||
};
|
||||
|
||||
ENUM(i32, Mouse_Cursor_Show_Type){
|
||||
MouseCursorShow_Never,
|
||||
MouseCursorShow_Always,
|
||||
|
@ -220,69 +194,6 @@ ENUM(i32, Panel_Child){
|
|||
PanelChild_Max = 1,
|
||||
};
|
||||
|
||||
typedef u32 Key_Code;
|
||||
typedef u32 Mouse_Code;
|
||||
typedef u32 Core_Event_Code;
|
||||
enum{
|
||||
CoreEventCode_Animate,
|
||||
CoreEventCode_ClickActivateView,
|
||||
CoreEventCode_ClickDeactivateView,
|
||||
};
|
||||
|
||||
typedef i32 Input_Event_Kind;
|
||||
enum{
|
||||
InputEventKind_TextInsert,
|
||||
InputEventKind_KeyStroke,
|
||||
InputEventKind_MouseButton,
|
||||
InputEventKind_MouseWheel,
|
||||
InputEventKind_MouseMove,
|
||||
InputEventKind_Core,
|
||||
};
|
||||
|
||||
struct Key_Modifiers{
|
||||
b8 modifiers[MDFR_INDEX_COUNT];
|
||||
};
|
||||
|
||||
struct Input_Event{
|
||||
Input_Event_Kind kind;
|
||||
union{
|
||||
struct{
|
||||
String_Const_u8 string;
|
||||
Key_Modifiers modifiers;
|
||||
} text;
|
||||
struct{
|
||||
Key_Code code;
|
||||
Key_Modifiers modifiers;
|
||||
} key;
|
||||
struct{
|
||||
Key_Code code;
|
||||
Key_Modifiers modifiers;
|
||||
Vec2_i32 p;
|
||||
} mouse;
|
||||
struct{
|
||||
f32 value;
|
||||
Vec2_i32 p;
|
||||
} mouse_wheel;
|
||||
struct{
|
||||
Vec2_i32 p;
|
||||
} mouse_move;
|
||||
struct{
|
||||
Core_Event_Code code;
|
||||
} core;
|
||||
};
|
||||
};
|
||||
|
||||
struct Input_Event_Node{
|
||||
Input_Event_Node *next;
|
||||
Input_Event event;
|
||||
};
|
||||
|
||||
struct Input_List{
|
||||
Input_Event_Node *first;
|
||||
Input_Event_Node *last;
|
||||
i32 count;
|
||||
};
|
||||
|
||||
TYPEDEF u8 Key_Modifier;
|
||||
|
||||
STRUCT Mouse_State{
|
||||
|
@ -544,14 +455,9 @@ TYPEDEF void Custom_Command_Function(struct Application_Links *app);
|
|||
#define CUSTOM_ALIAS(x) CUSTOM_ALIAS(x)
|
||||
#endif
|
||||
|
||||
UNION Generic_Command{
|
||||
Custom_Command_Function *command;
|
||||
};
|
||||
|
||||
|
||||
STRUCT User_Input{
|
||||
Input_Event event;
|
||||
Generic_Command command;
|
||||
Custom_Command_Function *command;
|
||||
b32 abort;
|
||||
};
|
||||
|
||||
|
@ -590,8 +496,8 @@ ENUM(i32, Special_Hook_ID){
|
|||
special_hook_get_view_buffer_region,
|
||||
};
|
||||
|
||||
TYPEDEF_FUNC i32 Command_Caller_Hook_Function(struct Application_Links *app, Generic_Command cmd);
|
||||
#define COMMAND_CALLER_HOOK(name) i32 name(struct Application_Links *app, Generic_Command cmd)
|
||||
TYPEDEF_FUNC i32 Command_Caller_Hook_Function(struct Application_Links *app, Custom_Command_Function *cmd);
|
||||
#define COMMAND_CALLER_HOOK(name) i32 name(struct Application_Links *app, Custom_Command_Function *cmd)
|
||||
|
||||
TYPEDEF_FUNC void Render_Caller_Function(struct Application_Links *app, Frame_Info frame_info);
|
||||
#define RENDER_CALLER_SIG(name) void name(struct Application_Links *app, Frame_Info frame_info)
|
||||
|
@ -652,6 +558,8 @@ i32 name(struct Application_Links *app, char **files, i32 file_count, char **fla
|
|||
TYPEDEF_FUNC i32 Get_Binding_Data_Function(void *data, i32 size);
|
||||
#define GET_BINDING_DATA(name) i32 name(void *data, i32 size)
|
||||
|
||||
typedef i64 Command_Map_ID;
|
||||
|
||||
// NOTE(allen): Definitions for the format that Get_Binding_Data uses to launch 4coder.
|
||||
// TODO(allen): Transition to a more dynamic Command_Map system.
|
||||
|
||||
|
|
|
@ -0,0 +1,189 @@
|
|||
enum{
|
||||
KeyCode_A = 1,
|
||||
KeyCode_B = 2,
|
||||
KeyCode_C = 3,
|
||||
KeyCode_D = 4,
|
||||
KeyCode_E = 5,
|
||||
KeyCode_F = 6,
|
||||
KeyCode_G = 7,
|
||||
KeyCode_H = 8,
|
||||
KeyCode_I = 9,
|
||||
KeyCode_J = 10,
|
||||
KeyCode_K = 11,
|
||||
KeyCode_L = 12,
|
||||
KeyCode_M = 13,
|
||||
KeyCode_N = 14,
|
||||
KeyCode_O = 15,
|
||||
KeyCode_P = 16,
|
||||
KeyCode_Q = 17,
|
||||
KeyCode_R = 18,
|
||||
KeyCode_S = 19,
|
||||
KeyCode_T = 20,
|
||||
KeyCode_U = 21,
|
||||
KeyCode_V = 22,
|
||||
KeyCode_W = 23,
|
||||
KeyCode_X = 24,
|
||||
KeyCode_Y = 25,
|
||||
KeyCode_Z = 26,
|
||||
KeyCode_0 = 27,
|
||||
KeyCode_1 = 28,
|
||||
KeyCode_2 = 29,
|
||||
KeyCode_3 = 30,
|
||||
KeyCode_4 = 31,
|
||||
KeyCode_5 = 32,
|
||||
KeyCode_6 = 33,
|
||||
KeyCode_7 = 34,
|
||||
KeyCode_8 = 35,
|
||||
KeyCode_9 = 36,
|
||||
KeyCode_Space = 37,
|
||||
KeyCode_Tick = 38,
|
||||
KeyCode_Minus = 39,
|
||||
KeyCode_Equal = 40,
|
||||
KeyCode_LeftBracket = 41,
|
||||
KeyCode_RightBracket = 42,
|
||||
KeyCode_Semicolon = 43,
|
||||
KeyCode_Quote = 44,
|
||||
KeyCode_Comma = 45,
|
||||
KeyCode_Period = 46,
|
||||
KeyCode_ForwardSlash = 47,
|
||||
KeyCode_BackwardSlash = 48,
|
||||
KeyCode_Tab = 49,
|
||||
KeyCode_Escape = 50,
|
||||
KeyCode_Pause = 51,
|
||||
KeyCode_Up = 52,
|
||||
KeyCode_Down = 53,
|
||||
KeyCode_Left = 54,
|
||||
KeyCode_Right = 55,
|
||||
KeyCode_Backspace = 56,
|
||||
KeyCode_Return = 57,
|
||||
KeyCode_Delete = 58,
|
||||
KeyCode_Insert = 59,
|
||||
KeyCode_Home = 60,
|
||||
KeyCode_End = 61,
|
||||
KeyCode_PageUp = 62,
|
||||
KeyCode_PageDown = 63,
|
||||
KeyCode_CapsLock = 64,
|
||||
KeyCode_NumLock = 65,
|
||||
KeyCode_ScrollLock = 66,
|
||||
KeyCode_Menu = 67,
|
||||
KeyCode_Shift = 68,
|
||||
KeyCode_Control = 69,
|
||||
KeyCode_Alt = 70,
|
||||
KeyCode_Command = 71,
|
||||
KeyCode_F1 = 72,
|
||||
KeyCode_F2 = 73,
|
||||
KeyCode_F3 = 74,
|
||||
KeyCode_F4 = 75,
|
||||
KeyCode_F5 = 76,
|
||||
KeyCode_F6 = 77,
|
||||
KeyCode_F7 = 78,
|
||||
KeyCode_F8 = 79,
|
||||
KeyCode_F9 = 80,
|
||||
KeyCode_F10 = 81,
|
||||
KeyCode_F11 = 82,
|
||||
KeyCode_F12 = 83,
|
||||
KeyCode_F13 = 84,
|
||||
KeyCode_F14 = 85,
|
||||
KeyCode_F15 = 86,
|
||||
KeyCode_F16 = 87,
|
||||
KeyCode_COUNT = 88,
|
||||
};
|
||||
global char* key_code_name[KeyCode_COUNT] = {
|
||||
"None""A",
|
||||
"B",
|
||||
"C",
|
||||
"D",
|
||||
"E",
|
||||
"F",
|
||||
"G",
|
||||
"H",
|
||||
"I",
|
||||
"J",
|
||||
"K",
|
||||
"L",
|
||||
"M",
|
||||
"N",
|
||||
"O",
|
||||
"P",
|
||||
"Q",
|
||||
"R",
|
||||
"S",
|
||||
"T",
|
||||
"U",
|
||||
"V",
|
||||
"W",
|
||||
"X",
|
||||
"Y",
|
||||
"Z",
|
||||
"0",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"8",
|
||||
"9",
|
||||
"Space",
|
||||
"Tick",
|
||||
"Minus",
|
||||
"Equal",
|
||||
"LeftBracket",
|
||||
"RightBracket",
|
||||
"Semicolon",
|
||||
"Quote",
|
||||
"Comma",
|
||||
"Period",
|
||||
"ForwardSlash",
|
||||
"BackwardSlash",
|
||||
"Tab",
|
||||
"Escape",
|
||||
"Pause",
|
||||
"Up",
|
||||
"Down",
|
||||
"Left",
|
||||
"Right",
|
||||
"Backspace",
|
||||
"Return",
|
||||
"Delete",
|
||||
"Insert",
|
||||
"Home",
|
||||
"End",
|
||||
"PageUp",
|
||||
"PageDown",
|
||||
"CapsLock",
|
||||
"NumLock",
|
||||
"ScrollLock",
|
||||
"Menu",
|
||||
"Shift",
|
||||
"Control",
|
||||
"Alt",
|
||||
"Command",
|
||||
"F1",
|
||||
"F2",
|
||||
"F3",
|
||||
"F4",
|
||||
"F5",
|
||||
"F6",
|
||||
"F7",
|
||||
"F8",
|
||||
"F9",
|
||||
"F10",
|
||||
"F11",
|
||||
"F12",
|
||||
"F13",
|
||||
"F14",
|
||||
"F15",
|
||||
"F16",
|
||||
};
|
||||
enum{
|
||||
MouseCode_Left = 1,
|
||||
MouseCode_Middle = 2,
|
||||
MouseCode_Right = 3,
|
||||
};
|
||||
enum{
|
||||
CoreCode_Animate = 1,
|
||||
CoreCode_ClickActivateView = 2,
|
||||
CoreCode_ClickDeactivateView = 3,
|
||||
};
|
|
@ -1,179 +0,0 @@
|
|||
enum{
|
||||
KeyCode_A = 1,
|
||||
KeyCode_B = 2,
|
||||
KeyCode_C = 3,
|
||||
KeyCode_D = 4,
|
||||
KeyCode_E = 5,
|
||||
KeyCode_F = 6,
|
||||
KeyCode_G = 7,
|
||||
KeyCode_H = 8,
|
||||
KeyCode_I = 9,
|
||||
KeyCode_J = 10,
|
||||
KeyCode_K = 11,
|
||||
KeyCode_L = 12,
|
||||
KeyCode_M = 13,
|
||||
KeyCode_N = 14,
|
||||
KeyCode_O = 15,
|
||||
KeyCode_P = 16,
|
||||
KeyCode_Q = 17,
|
||||
KeyCode_R = 18,
|
||||
KeyCode_S = 19,
|
||||
KeyCode_T = 20,
|
||||
KeyCode_U = 21,
|
||||
KeyCode_V = 22,
|
||||
KeyCode_W = 23,
|
||||
KeyCode_X = 24,
|
||||
KeyCode_Y = 25,
|
||||
KeyCode_Z = 26,
|
||||
KeyCode_0 = 27,
|
||||
KeyCode_1 = 28,
|
||||
KeyCode_2 = 29,
|
||||
KeyCode_3 = 30,
|
||||
KeyCode_4 = 31,
|
||||
KeyCode_5 = 32,
|
||||
KeyCode_6 = 33,
|
||||
KeyCode_7 = 34,
|
||||
KeyCode_8 = 35,
|
||||
KeyCode_9 = 36,
|
||||
KeyCode_Space = 37,
|
||||
KeyCode_Tick = 38,
|
||||
KeyCode_Minus = 39,
|
||||
KeyCode_Equal = 40,
|
||||
KeyCode_LeftBracket = 41,
|
||||
KeyCode_RightBracket = 42,
|
||||
KeyCode_Semicolon = 43,
|
||||
KeyCode_Quote = 44,
|
||||
KeyCode_Comma = 45,
|
||||
KeyCode_Period = 46,
|
||||
KeyCode_ForwardSlash = 47,
|
||||
KeyCode_BackwardSlash = 48,
|
||||
KeyCode_Tab = 49,
|
||||
KeyCode_Escape = 50,
|
||||
KeyCode_Pause = 51,
|
||||
KeyCode_Up = 52,
|
||||
KeyCode_Down = 53,
|
||||
KeyCode_Left = 54,
|
||||
KeyCode_Right = 55,
|
||||
KeyCode_Backspace = 56,
|
||||
KeyCode_Return = 57,
|
||||
KeyCode_Delete = 58,
|
||||
KeyCode_Insert = 59,
|
||||
KeyCode_Home = 60,
|
||||
KeyCode_End = 61,
|
||||
KeyCode_PageUp = 62,
|
||||
KeyCode_PageDown = 63,
|
||||
KeyCode_CapsLock = 64,
|
||||
KeyCode_NumLock = 65,
|
||||
KeyCode_ScrollLock = 66,
|
||||
KeyCode_Menu = 67,
|
||||
KeyCode_Shift = 68,
|
||||
KeyCode_Control = 69,
|
||||
KeyCode_Alt = 70,
|
||||
KeyCode_Command = 71,
|
||||
KeyCode_F1 = 72,
|
||||
KeyCode_F2 = 73,
|
||||
KeyCode_F3 = 74,
|
||||
KeyCode_F4 = 75,
|
||||
KeyCode_F5 = 76,
|
||||
KeyCode_F6 = 77,
|
||||
KeyCode_F7 = 78,
|
||||
KeyCode_F8 = 79,
|
||||
KeyCode_F9 = 80,
|
||||
KeyCode_F10 = 81,
|
||||
KeyCode_F11 = 82,
|
||||
KeyCode_F12 = 83,
|
||||
KeyCode_F13 = 84,
|
||||
KeyCode_F14 = 85,
|
||||
KeyCode_F15 = 86,
|
||||
KeyCode_F16 = 87,
|
||||
KeyCode_COUNT = 88,
|
||||
};
|
||||
global char* key_code_name[] = {
|
||||
"A",
|
||||
"B",
|
||||
"C",
|
||||
"D",
|
||||
"E",
|
||||
"F",
|
||||
"G",
|
||||
"H",
|
||||
"I",
|
||||
"J",
|
||||
"K",
|
||||
"L",
|
||||
"M",
|
||||
"N",
|
||||
"O",
|
||||
"P",
|
||||
"Q",
|
||||
"R",
|
||||
"S",
|
||||
"T",
|
||||
"U",
|
||||
"V",
|
||||
"W",
|
||||
"X",
|
||||
"Y",
|
||||
"Z",
|
||||
"0",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"8",
|
||||
"9",
|
||||
"Space",
|
||||
"Tick",
|
||||
"Minus",
|
||||
"Equal",
|
||||
"LeftBracket",
|
||||
"RightBracket",
|
||||
"Semicolon",
|
||||
"Quote",
|
||||
"Comma",
|
||||
"Period",
|
||||
"ForwardSlash",
|
||||
"BackwardSlash",
|
||||
"Tab",
|
||||
"Escape",
|
||||
"Pause",
|
||||
"Up",
|
||||
"Down",
|
||||
"Left",
|
||||
"Right",
|
||||
"Backspace",
|
||||
"Return",
|
||||
"Delete",
|
||||
"Insert",
|
||||
"Home",
|
||||
"End",
|
||||
"PageUp",
|
||||
"PageDown",
|
||||
"CapsLock",
|
||||
"NumLock",
|
||||
"ScrollLock",
|
||||
"Menu",
|
||||
"Shift",
|
||||
"Control",
|
||||
"Alt",
|
||||
"Command",
|
||||
"F1",
|
||||
"F2",
|
||||
"F3",
|
||||
"F4",
|
||||
"F5",
|
||||
"F6",
|
||||
"F7",
|
||||
"F8",
|
||||
"F9",
|
||||
"F10",
|
||||
"F11",
|
||||
"F12",
|
||||
"F13",
|
||||
"F14",
|
||||
"F15",
|
||||
"F16",
|
||||
};
|
|
@ -137,7 +137,7 @@ CUSTOM_COMMAND_SIG(lister__wheel_scroll);
|
|||
CUSTOM_COMMAND_SIG(lister__mouse_press);
|
||||
CUSTOM_COMMAND_SIG(lister__mouse_release);
|
||||
CUSTOM_COMMAND_SIG(lister__repaint);
|
||||
CUSTOM_COMMAND_SIG(lister__write_character__default);
|
||||
CUSTOM_COMMAND_SIG(lister__write_string__default);
|
||||
CUSTOM_COMMAND_SIG(lister__backspace_text_field__default);
|
||||
CUSTOM_COMMAND_SIG(lister__move_up__default);
|
||||
CUSTOM_COMMAND_SIG(lister__move_down__default);
|
||||
|
@ -150,10 +150,10 @@ CUSTOM_COMMAND_SIG(interactive_open_or_new);
|
|||
CUSTOM_COMMAND_SIG(interactive_new);
|
||||
CUSTOM_COMMAND_SIG(interactive_open);
|
||||
CUSTOM_COMMAND_SIG(command_lister);
|
||||
CUSTOM_COMMAND_SIG(auto_tab_whole_file);
|
||||
CUSTOM_COMMAND_SIG(auto_tab_line_at_cursor);
|
||||
CUSTOM_COMMAND_SIG(auto_tab_range);
|
||||
CUSTOM_COMMAND_SIG(write_and_auto_tab);
|
||||
CUSTOM_COMMAND_SIG(auto_indent_whole_file);
|
||||
CUSTOM_COMMAND_SIG(auto_indent_line_at_cursor);
|
||||
CUSTOM_COMMAND_SIG(auto_indent_range);
|
||||
CUSTOM_COMMAND_SIG(write_text_and_auto_indent);
|
||||
CUSTOM_COMMAND_SIG(list_all_locations);
|
||||
CUSTOM_COMMAND_SIG(list_all_substring_locations);
|
||||
CUSTOM_COMMAND_SIG(list_all_locations_case_insensitive);
|
||||
|
@ -173,8 +173,8 @@ CUSTOM_COMMAND_SIG(goto_next_jump_no_skips);
|
|||
CUSTOM_COMMAND_SIG(goto_prev_jump_no_skips);
|
||||
CUSTOM_COMMAND_SIG(goto_first_jump);
|
||||
CUSTOM_COMMAND_SIG(goto_first_jump_same_panel_sticky);
|
||||
CUSTOM_COMMAND_SIG(newline_or_goto_position);
|
||||
CUSTOM_COMMAND_SIG(newline_or_goto_position_same_panel);
|
||||
CUSTOM_COMMAND_SIG(if_read_only_goto_position);
|
||||
CUSTOM_COMMAND_SIG(if_read_only_goto_position_same_panel);
|
||||
CUSTOM_COMMAND_SIG(view_jump_list_with_lister);
|
||||
CUSTOM_COMMAND_SIG(log_graph__escape);
|
||||
CUSTOM_COMMAND_SIG(log_graph__scroll_wheel);
|
||||
|
@ -249,12 +249,12 @@ i32 line_number;
|
|||
};
|
||||
static Command_Metadata fcoder_metacmd_table[227] = {
|
||||
{ PROC_LINKS(set_bindings_default, 0), "set_bindings_default", 20, "Remap keybindings using the 'default' mapping rule.", 51, "w:\\4ed\\code\\custom\\4coder_remapping_commands.cpp", 48, 44 },
|
||||
{ PROC_LINKS(seek_beginning_of_textual_line, 0), "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2237 },
|
||||
{ PROC_LINKS(seek_end_of_textual_line, 0), "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2243 },
|
||||
{ PROC_LINKS(seek_beginning_of_line, 0), "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2249 },
|
||||
{ PROC_LINKS(seek_end_of_line, 0), "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2255 },
|
||||
{ PROC_LINKS(goto_beginning_of_file, 0), "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2261 },
|
||||
{ PROC_LINKS(goto_end_of_file, 0), "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2269 },
|
||||
{ PROC_LINKS(seek_beginning_of_textual_line, 0), "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2221 },
|
||||
{ PROC_LINKS(seek_end_of_textual_line, 0), "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2227 },
|
||||
{ PROC_LINKS(seek_beginning_of_line, 0), "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2233 },
|
||||
{ PROC_LINKS(seek_end_of_line, 0), "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2239 },
|
||||
{ PROC_LINKS(goto_beginning_of_file, 0), "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2245 },
|
||||
{ PROC_LINKS(goto_end_of_file, 0), "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "w:\\4ed\\code\\custom\\4coder_helper.cpp", 36, 2253 },
|
||||
{ PROC_LINKS(change_active_panel, 0), "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, 196 },
|
||||
{ PROC_LINKS(change_active_panel_backwards, 0), "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, 206 },
|
||||
{ PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 216 },
|
||||
|
@ -335,37 +335,37 @@ static Command_Metadata fcoder_metacmd_table[227] = {
|
|||
{ PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 764 },
|
||||
{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 772 },
|
||||
{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 780 },
|
||||
{ PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 970 },
|
||||
{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 976 },
|
||||
{ PROC_LINKS(search_identifier, 0), "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 982 },
|
||||
{ PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 993 },
|
||||
{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for a needle and string. Replaces all occurences of needle with string in the range between cursor and the mark in the active buffer.", 150, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1044 },
|
||||
{ PROC_LINKS(replace_in_buffer, 0), "replace_in_buffer", 17, "Queries the user for a needle and string. Replaces all occurences of needle with string in the active buffer.", 109, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1053 },
|
||||
{ PROC_LINKS(replace_in_all_buffers, 0), "replace_in_all_buffers", 22, "Queries the user for a needle and string. Replaces all occurences of needle with string in all editable buffers.", 112, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1062 },
|
||||
{ PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1152 },
|
||||
{ PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1172 },
|
||||
{ PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1188 },
|
||||
{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1223 },
|
||||
{ PROC_LINKS(delete_file_query, 0), "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1248 },
|
||||
{ PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1286 },
|
||||
{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1318 },
|
||||
{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1355 },
|
||||
{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1388 },
|
||||
{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1394 },
|
||||
{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1400 },
|
||||
{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1414 },
|
||||
{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1479 },
|
||||
{ PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1511 },
|
||||
{ PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1524 },
|
||||
{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1536 },
|
||||
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1572 },
|
||||
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1580 },
|
||||
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1590 },
|
||||
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1817 },
|
||||
{ PROC_LINKS(redo, 0), "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1830 },
|
||||
{ PROC_LINKS(undo_all_buffers, 0), "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1844 },
|
||||
{ PROC_LINKS(redo_all_buffers, 0), "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1915 },
|
||||
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 2016 },
|
||||
{ PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 972 },
|
||||
{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 978 },
|
||||
{ PROC_LINKS(search_identifier, 0), "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 984 },
|
||||
{ PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 995 },
|
||||
{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for a needle and string. Replaces all occurences of needle with string in the range between cursor and the mark in the active buffer.", 150, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1046 },
|
||||
{ PROC_LINKS(replace_in_buffer, 0), "replace_in_buffer", 17, "Queries the user for a needle and string. Replaces all occurences of needle with string in the active buffer.", 109, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1055 },
|
||||
{ PROC_LINKS(replace_in_all_buffers, 0), "replace_in_all_buffers", 22, "Queries the user for a needle and string. Replaces all occurences of needle with string in all editable buffers.", 112, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1064 },
|
||||
{ PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1157 },
|
||||
{ PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1177 },
|
||||
{ PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1193 },
|
||||
{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1228 },
|
||||
{ PROC_LINKS(delete_file_query, 0), "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1253 },
|
||||
{ PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1291 },
|
||||
{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1323 },
|
||||
{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1360 },
|
||||
{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1393 },
|
||||
{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1399 },
|
||||
{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1405 },
|
||||
{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1419 },
|
||||
{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1484 },
|
||||
{ PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1516 },
|
||||
{ PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1529 },
|
||||
{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1541 },
|
||||
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1577 },
|
||||
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1585 },
|
||||
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1595 },
|
||||
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1822 },
|
||||
{ PROC_LINKS(redo, 0), "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1835 },
|
||||
{ PROC_LINKS(undo_all_buffers, 0), "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1849 },
|
||||
{ PROC_LINKS(redo_all_buffers, 0), "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1920 },
|
||||
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 2021 },
|
||||
{ PROC_LINKS(lister__quit, 0), "lister__quit", 12, "A lister mode command that quits the list without executing any actions.", 72, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 8 },
|
||||
{ PROC_LINKS(lister__activate, 0), "lister__activate", 16, "A lister mode command that activates the list's action on the highlighted item.", 79, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 15 },
|
||||
{ PROC_LINKS(lister__write_character, 0), "lister__write_character", 23, "A lister mode command that dispatches to the lister's write character handler.", 78, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 30 },
|
||||
|
@ -376,23 +376,23 @@ static Command_Metadata fcoder_metacmd_table[227] = {
|
|||
{ PROC_LINKS(lister__mouse_press, 0), "lister__mouse_press", 19, "A lister mode command that beings a click interaction with a list item under the mouse.", 87, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 84 },
|
||||
{ PROC_LINKS(lister__mouse_release, 0), "lister__mouse_release", 21, "A lister mode command that ends a click interaction with a list item under the mouse, possibly activating it.", 109, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 95 },
|
||||
{ PROC_LINKS(lister__repaint, 0), "lister__repaint", 15, "A lister mode command that updates the lists UI data.", 53, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 110 },
|
||||
{ PROC_LINKS(lister__write_character__default, 0), "lister__write_character__default", 32, "A lister mode command that inserts a new character to the text field.", 69, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 120 },
|
||||
{ PROC_LINKS(lister__backspace_text_field__default, 0), "lister__backspace_text_field__default", 37, "A lister mode command that backspaces one character from the text field.", 72, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 139 },
|
||||
{ PROC_LINKS(lister__move_up__default, 0), "lister__move_up__default", 24, "A lister mode command that moves the highlighted item one up in the list.", 73, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 153 },
|
||||
{ PROC_LINKS(lister__move_down__default, 0), "lister__move_down__default", 26, "A lister mode command that moves the highlighted item one down in the list.", 75, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 168 },
|
||||
{ PROC_LINKS(lister__write_character__file_path, 0), "lister__write_character__file_path", 34, "A lister mode command that inserts a character into the text field of a file system list.", 89, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 183 },
|
||||
{ PROC_LINKS(lister__backspace_text_field__file_path, 0), "lister__backspace_text_field__file_path", 39, "A lister mode command that backspaces one character from the text field of a file system list.", 94, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 208 },
|
||||
{ PROC_LINKS(lister__write_character__fixed_list, 0), "lister__write_character__fixed_list", 35, "A lister mode command that handles input for the fixed sure to kill list.", 73, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 249 },
|
||||
{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 718 },
|
||||
{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 737 },
|
||||
{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 808 },
|
||||
{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 847 },
|
||||
{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 880 },
|
||||
{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 960 },
|
||||
{ PROC_LINKS(auto_tab_whole_file, 0), "auto_tab_whole_file", 19, "Audo-indents the entire current buffer.", 39, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 322 },
|
||||
{ PROC_LINKS(auto_tab_line_at_cursor, 0), "auto_tab_line_at_cursor", 23, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 331 },
|
||||
{ PROC_LINKS(auto_tab_range, 0), "auto_tab_range", 14, "Auto-indents the range between the cursor and the mark.", 55, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 341 },
|
||||
{ PROC_LINKS(write_and_auto_tab, 0), "write_and_auto_tab", 18, "Inserts a character and auto-indents the line on which the cursor sits.", 71, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 351 },
|
||||
{ PROC_LINKS(lister__write_string__default, 0), "lister__write_string__default", 29, "A lister mode command that inserts a new character to the text field.", 69, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 120 },
|
||||
{ PROC_LINKS(lister__backspace_text_field__default, 0), "lister__backspace_text_field__default", 37, "A lister mode command that backspaces one character from the text field.", 72, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 138 },
|
||||
{ PROC_LINKS(lister__move_up__default, 0), "lister__move_up__default", 24, "A lister mode command that moves the highlighted item one up in the list.", 73, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 152 },
|
||||
{ PROC_LINKS(lister__move_down__default, 0), "lister__move_down__default", 26, "A lister mode command that moves the highlighted item one down in the list.", 75, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 167 },
|
||||
{ PROC_LINKS(lister__write_character__file_path, 0), "lister__write_character__file_path", 34, "A lister mode command that inserts a character into the text field of a file system list.", 89, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 182 },
|
||||
{ PROC_LINKS(lister__backspace_text_field__file_path, 0), "lister__backspace_text_field__file_path", 39, "A lister mode command that backspaces one character from the text field of a file system list.", 94, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 206 },
|
||||
{ PROC_LINKS(lister__write_character__fixed_list, 0), "lister__write_character__fixed_list", 35, "A lister mode command that handles input for the fixed sure to kill list.", 73, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 244 },
|
||||
{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 712 },
|
||||
{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 731 },
|
||||
{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 802 },
|
||||
{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 841 },
|
||||
{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 874 },
|
||||
{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 954 },
|
||||
{ PROC_LINKS(auto_indent_whole_file, 0), "auto_indent_whole_file", 22, "Audo-indents the entire current buffer.", 39, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 322 },
|
||||
{ PROC_LINKS(auto_indent_line_at_cursor, 0), "auto_indent_line_at_cursor", 26, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 331 },
|
||||
{ PROC_LINKS(auto_indent_range, 0), "auto_indent_range", 17, "Auto-indents the range between the cursor and the mark.", 55, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 341 },
|
||||
{ PROC_LINKS(write_text_and_auto_indent, 0), "write_text_and_auto_indent", 26, "Inserts text and auto-indents the line on which the cursor sits if any of the text contains 'layout punctuation' such as ;:{}()[]# and new lines.", 145, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 351 },
|
||||
{ PROC_LINKS(list_all_locations, 0), "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 166 },
|
||||
{ PROC_LINKS(list_all_substring_locations, 0), "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 172 },
|
||||
{ PROC_LINKS(list_all_locations_case_insensitive, 0), "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 178 },
|
||||
|
@ -412,8 +412,8 @@ static Command_Metadata fcoder_metacmd_table[227] = {
|
|||
{ PROC_LINKS(goto_prev_jump_no_skips, 0), "goto_prev_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 509 },
|
||||
{ PROC_LINKS(goto_first_jump, 0), "goto_first_jump", 15, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 523 },
|
||||
{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 540 },
|
||||
{ PROC_LINKS(newline_or_goto_position, 0), "newline_or_goto_position", 24, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 562 },
|
||||
{ PROC_LINKS(newline_or_goto_position_same_panel, 0), "newline_or_goto_position_same_panel", 35, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 579 },
|
||||
{ PROC_LINKS(if_read_only_goto_position, 0), "if_read_only_goto_position", 26, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 562 },
|
||||
{ PROC_LINKS(if_read_only_goto_position_same_panel, 0), "if_read_only_goto_position_same_panel", 37, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 576 },
|
||||
{ PROC_LINKS(view_jump_list_with_lister, 0), "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "w:\\4ed\\code\\custom\\4coder_jump_lister.cpp", 41, 102 },
|
||||
{ PROC_LINKS(log_graph__escape, 0), "log_graph__escape", 17, "Ends the log grapher", 20, "w:\\4ed\\code\\custom\\4coder_log_parser.cpp", 40, 906 },
|
||||
{ PROC_LINKS(log_graph__scroll_wheel, 0), "log_graph__scroll_wheel", 23, "Scrolls the log graph", 21, "w:\\4ed\\code\\custom\\4coder_log_parser.cpp", 40, 915 },
|
||||
|
@ -439,12 +439,12 @@ static Command_Metadata fcoder_metacmd_table[227] = {
|
|||
{ PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 929 },
|
||||
{ PROC_LINKS(load_project, 0), "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 937 },
|
||||
{ PROC_LINKS(project_fkey_command, 0), "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 944 },
|
||||
{ PROC_LINKS(project_go_to_root_directory, 0), "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 967 },
|
||||
{ PROC_LINKS(setup_new_project, 0), "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1299 },
|
||||
{ PROC_LINKS(setup_build_bat, 0), "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1306 },
|
||||
{ PROC_LINKS(setup_build_sh, 0), "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1312 },
|
||||
{ PROC_LINKS(setup_build_bat_and_sh, 0), "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1318 },
|
||||
{ PROC_LINKS(project_command_lister, 0), "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1333 },
|
||||
{ PROC_LINKS(project_go_to_root_directory, 0), "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 969 },
|
||||
{ PROC_LINKS(setup_new_project, 0), "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1301 },
|
||||
{ PROC_LINKS(setup_build_bat, 0), "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1308 },
|
||||
{ PROC_LINKS(setup_build_sh, 0), "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1314 },
|
||||
{ PROC_LINKS(setup_build_bat_and_sh, 0), "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1320 },
|
||||
{ PROC_LINKS(project_command_lister, 0), "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 1335 },
|
||||
{ PROC_LINKS(list_all_functions_current_buffer, 0), "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "w:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 267 },
|
||||
{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), "list_all_functions_current_buffer_lister", 40, "Creates a lister of locations that look like function definitions and declarations in the buffer.", 97, "w:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 277 },
|
||||
{ PROC_LINKS(list_all_functions_all_buffers, 0), "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "w:\\4ed\\code\\custom\\4coder_function_list.cpp", 43, 289 },
|
||||
|
@ -604,7 +604,7 @@ static i32 fcoder_metacmd_ID_lister__wheel_scroll = 124;
|
|||
static i32 fcoder_metacmd_ID_lister__mouse_press = 125;
|
||||
static i32 fcoder_metacmd_ID_lister__mouse_release = 126;
|
||||
static i32 fcoder_metacmd_ID_lister__repaint = 127;
|
||||
static i32 fcoder_metacmd_ID_lister__write_character__default = 128;
|
||||
static i32 fcoder_metacmd_ID_lister__write_string__default = 128;
|
||||
static i32 fcoder_metacmd_ID_lister__backspace_text_field__default = 129;
|
||||
static i32 fcoder_metacmd_ID_lister__move_up__default = 130;
|
||||
static i32 fcoder_metacmd_ID_lister__move_down__default = 131;
|
||||
|
@ -617,10 +617,10 @@ static i32 fcoder_metacmd_ID_interactive_open_or_new = 137;
|
|||
static i32 fcoder_metacmd_ID_interactive_new = 138;
|
||||
static i32 fcoder_metacmd_ID_interactive_open = 139;
|
||||
static i32 fcoder_metacmd_ID_command_lister = 140;
|
||||
static i32 fcoder_metacmd_ID_auto_tab_whole_file = 141;
|
||||
static i32 fcoder_metacmd_ID_auto_tab_line_at_cursor = 142;
|
||||
static i32 fcoder_metacmd_ID_auto_tab_range = 143;
|
||||
static i32 fcoder_metacmd_ID_write_and_auto_tab = 144;
|
||||
static i32 fcoder_metacmd_ID_auto_indent_whole_file = 141;
|
||||
static i32 fcoder_metacmd_ID_auto_indent_line_at_cursor = 142;
|
||||
static i32 fcoder_metacmd_ID_auto_indent_range = 143;
|
||||
static i32 fcoder_metacmd_ID_write_text_and_auto_indent = 144;
|
||||
static i32 fcoder_metacmd_ID_list_all_locations = 145;
|
||||
static i32 fcoder_metacmd_ID_list_all_substring_locations = 146;
|
||||
static i32 fcoder_metacmd_ID_list_all_locations_case_insensitive = 147;
|
||||
|
@ -640,8 +640,8 @@ static i32 fcoder_metacmd_ID_goto_next_jump_no_skips = 160;
|
|||
static i32 fcoder_metacmd_ID_goto_prev_jump_no_skips = 161;
|
||||
static i32 fcoder_metacmd_ID_goto_first_jump = 162;
|
||||
static i32 fcoder_metacmd_ID_goto_first_jump_same_panel_sticky = 163;
|
||||
static i32 fcoder_metacmd_ID_newline_or_goto_position = 164;
|
||||
static i32 fcoder_metacmd_ID_newline_or_goto_position_same_panel = 165;
|
||||
static i32 fcoder_metacmd_ID_if_read_only_goto_position = 164;
|
||||
static i32 fcoder_metacmd_ID_if_read_only_goto_position_same_panel = 165;
|
||||
static i32 fcoder_metacmd_ID_view_jump_list_with_lister = 166;
|
||||
static i32 fcoder_metacmd_ID_log_graph__escape = 167;
|
||||
static i32 fcoder_metacmd_ID_log_graph__scroll_wheel = 168;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define custom_global_set_setting_sig() b32 custom_global_set_setting(Application_Links* app, Global_Setting_ID setting, i32 value)
|
||||
#define custom_global_set_setting_sig() b32 custom_global_set_setting(Application_Links* app, Global_Setting_ID setting, i64 value)
|
||||
#define custom_global_set_mapping_sig() b32 custom_global_set_mapping(Application_Links* app, void* data, i32 size)
|
||||
#define custom_global_get_screen_rectangle_sig() Rect_f32 custom_global_get_screen_rectangle(Application_Links* app)
|
||||
#define custom_get_thread_context_sig() Thread_Context* custom_get_thread_context(Application_Links* app)
|
||||
|
@ -41,8 +41,8 @@
|
|||
#define custom_push_buffer_file_name_sig() String_Const_u8 custom_push_buffer_file_name(Application_Links* app, Arena* arena, Buffer_ID buffer_id)
|
||||
#define custom_buffer_get_dirty_state_sig() Dirty_State custom_buffer_get_dirty_state(Application_Links* app, Buffer_ID buffer_id)
|
||||
#define custom_buffer_set_dirty_state_sig() b32 custom_buffer_set_dirty_state(Application_Links* app, Buffer_ID buffer_id, Dirty_State dirty_state)
|
||||
#define custom_buffer_get_setting_sig() b32 custom_buffer_get_setting(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32* value_out)
|
||||
#define custom_buffer_set_setting_sig() b32 custom_buffer_set_setting(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 value)
|
||||
#define custom_buffer_get_setting_sig() b32 custom_buffer_get_setting(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i64* value_out)
|
||||
#define custom_buffer_set_setting_sig() b32 custom_buffer_set_setting(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i64 value)
|
||||
#define custom_buffer_get_managed_scope_sig() Managed_Scope custom_buffer_get_managed_scope(Application_Links* app, Buffer_ID buffer_id)
|
||||
#define custom_buffer_send_end_signal_sig() b32 custom_buffer_send_end_signal(Application_Links* app, Buffer_ID buffer_id)
|
||||
#define custom_create_buffer_sig() Buffer_ID custom_create_buffer(Application_Links* app, String_Const_u8 file_name, Buffer_Create_Flag flags)
|
||||
|
@ -78,8 +78,8 @@
|
|||
#define custom_view_get_buffer_scroll_sig() Buffer_Scroll custom_view_get_buffer_scroll(Application_Links* app, View_ID view_id)
|
||||
#define custom_view_get_basic_scroll_sig() Basic_Scroll custom_view_get_basic_scroll(Application_Links* app, View_ID view_id)
|
||||
#define custom_view_set_active_sig() b32 custom_view_set_active(Application_Links* app, View_ID view_id)
|
||||
#define custom_view_get_setting_sig() b32 custom_view_get_setting(Application_Links* app, View_ID view_id, View_Setting_ID setting, i32* value_out)
|
||||
#define custom_view_set_setting_sig() b32 custom_view_set_setting(Application_Links* app, View_ID view_id, View_Setting_ID setting, i32 value)
|
||||
#define custom_view_get_setting_sig() b32 custom_view_get_setting(Application_Links* app, View_ID view_id, View_Setting_ID setting, i64* value_out)
|
||||
#define custom_view_set_setting_sig() b32 custom_view_set_setting(Application_Links* app, View_ID view_id, View_Setting_ID setting, i64 value)
|
||||
#define custom_view_get_managed_scope_sig() Managed_Scope custom_view_get_managed_scope(Application_Links* app, View_ID view_id)
|
||||
#define custom_buffer_compute_cursor_sig() Buffer_Cursor custom_buffer_compute_cursor(Application_Links* app, Buffer_ID buffer, Buffer_Seek seek)
|
||||
#define custom_view_compute_cursor_sig() Buffer_Cursor custom_view_compute_cursor(Application_Links* app, View_ID view_id, Buffer_Seek seek)
|
||||
|
@ -114,7 +114,7 @@
|
|||
#define custom_managed_object_free_sig() b32 custom_managed_object_free(Application_Links* app, Managed_Object object)
|
||||
#define custom_managed_object_store_data_sig() b32 custom_managed_object_store_data(Application_Links* app, Managed_Object object, u32 first_index, u32 count, void* mem)
|
||||
#define custom_managed_object_load_data_sig() b32 custom_managed_object_load_data(Application_Links* app, Managed_Object object, u32 first_index, u32 count, void* mem_out)
|
||||
#define custom_get_user_input_sig() User_Input custom_get_user_input(Application_Links* app, Input_Type_Flag get_type, Input_Type_Flag abort_type)
|
||||
#define custom_get_user_input_sig() User_Input custom_get_user_input(Application_Links* app, Event_Property get_properties, Event_Property abort_properties)
|
||||
#define custom_get_command_input_sig() User_Input custom_get_command_input(Application_Links* app)
|
||||
#define custom_set_command_input_sig() void custom_set_command_input(Application_Links* app, Input_Event* event)
|
||||
#define custom_get_mouse_state_sig() Mouse_State custom_get_mouse_state(Application_Links* app)
|
||||
|
@ -168,7 +168,7 @@
|
|||
#define custom_open_color_picker_sig() void custom_open_color_picker(Application_Links* app, Color_Picker* picker)
|
||||
#define custom_animate_in_n_milliseconds_sig() void custom_animate_in_n_milliseconds(Application_Links* app, u32 n)
|
||||
#define custom_buffer_find_all_matches_sig() String_Match_List custom_buffer_find_all_matches(Application_Links* app, Arena* arena, Buffer_ID buffer, i32 string_id, Range_i64 range, String_Const_u8 needle, Character_Predicate* predicate, Scan_Direction direction)
|
||||
typedef b32 custom_global_set_setting_type(Application_Links* app, Global_Setting_ID setting, i32 value);
|
||||
typedef b32 custom_global_set_setting_type(Application_Links* app, Global_Setting_ID setting, i64 value);
|
||||
typedef b32 custom_global_set_mapping_type(Application_Links* app, void* data, i32 size);
|
||||
typedef Rect_f32 custom_global_get_screen_rectangle_type(Application_Links* app);
|
||||
typedef Thread_Context* custom_get_thread_context_type(Application_Links* app);
|
||||
|
@ -211,8 +211,8 @@ typedef String_Const_u8 custom_push_buffer_unique_name_type(Application_Links* a
|
|||
typedef String_Const_u8 custom_push_buffer_file_name_type(Application_Links* app, Arena* arena, Buffer_ID buffer_id);
|
||||
typedef Dirty_State custom_buffer_get_dirty_state_type(Application_Links* app, Buffer_ID buffer_id);
|
||||
typedef b32 custom_buffer_set_dirty_state_type(Application_Links* app, Buffer_ID buffer_id, Dirty_State dirty_state);
|
||||
typedef b32 custom_buffer_get_setting_type(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32* value_out);
|
||||
typedef b32 custom_buffer_set_setting_type(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 value);
|
||||
typedef b32 custom_buffer_get_setting_type(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i64* value_out);
|
||||
typedef b32 custom_buffer_set_setting_type(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i64 value);
|
||||
typedef Managed_Scope custom_buffer_get_managed_scope_type(Application_Links* app, Buffer_ID buffer_id);
|
||||
typedef b32 custom_buffer_send_end_signal_type(Application_Links* app, Buffer_ID buffer_id);
|
||||
typedef Buffer_ID custom_create_buffer_type(Application_Links* app, String_Const_u8 file_name, Buffer_Create_Flag flags);
|
||||
|
@ -248,8 +248,8 @@ typedef Rect_f32 custom_view_get_buffer_region_type(Application_Links* app, View
|
|||
typedef Buffer_Scroll custom_view_get_buffer_scroll_type(Application_Links* app, View_ID view_id);
|
||||
typedef Basic_Scroll custom_view_get_basic_scroll_type(Application_Links* app, View_ID view_id);
|
||||
typedef b32 custom_view_set_active_type(Application_Links* app, View_ID view_id);
|
||||
typedef b32 custom_view_get_setting_type(Application_Links* app, View_ID view_id, View_Setting_ID setting, i32* value_out);
|
||||
typedef b32 custom_view_set_setting_type(Application_Links* app, View_ID view_id, View_Setting_ID setting, i32 value);
|
||||
typedef b32 custom_view_get_setting_type(Application_Links* app, View_ID view_id, View_Setting_ID setting, i64* value_out);
|
||||
typedef b32 custom_view_set_setting_type(Application_Links* app, View_ID view_id, View_Setting_ID setting, i64 value);
|
||||
typedef Managed_Scope custom_view_get_managed_scope_type(Application_Links* app, View_ID view_id);
|
||||
typedef Buffer_Cursor custom_buffer_compute_cursor_type(Application_Links* app, Buffer_ID buffer, Buffer_Seek seek);
|
||||
typedef Buffer_Cursor custom_view_compute_cursor_type(Application_Links* app, View_ID view_id, Buffer_Seek seek);
|
||||
|
@ -284,7 +284,7 @@ typedef Managed_Scope custom_managed_object_get_containing_scope_type(Applicatio
|
|||
typedef b32 custom_managed_object_free_type(Application_Links* app, Managed_Object object);
|
||||
typedef b32 custom_managed_object_store_data_type(Application_Links* app, Managed_Object object, u32 first_index, u32 count, void* mem);
|
||||
typedef b32 custom_managed_object_load_data_type(Application_Links* app, Managed_Object object, u32 first_index, u32 count, void* mem_out);
|
||||
typedef User_Input custom_get_user_input_type(Application_Links* app, Input_Type_Flag get_type, Input_Type_Flag abort_type);
|
||||
typedef User_Input custom_get_user_input_type(Application_Links* app, Event_Property get_properties, Event_Property abort_properties);
|
||||
typedef User_Input custom_get_command_input_type(Application_Links* app);
|
||||
typedef void custom_set_command_input_type(Application_Links* app, Input_Event* event);
|
||||
typedef Mouse_State custom_get_mouse_state_type(Application_Links* app);
|
||||
|
@ -511,7 +511,7 @@ custom_animate_in_n_milliseconds_type *animate_in_n_milliseconds;
|
|||
custom_buffer_find_all_matches_type *buffer_find_all_matches;
|
||||
};
|
||||
#if defined(STATIC_LINK_API)
|
||||
internal b32 global_set_setting(Application_Links* app, Global_Setting_ID setting, i32 value);
|
||||
internal b32 global_set_setting(Application_Links* app, Global_Setting_ID setting, i64 value);
|
||||
internal b32 global_set_mapping(Application_Links* app, void* data, i32 size);
|
||||
internal Rect_f32 global_get_screen_rectangle(Application_Links* app);
|
||||
internal Thread_Context* get_thread_context(Application_Links* app);
|
||||
|
@ -554,8 +554,8 @@ internal String_Const_u8 push_buffer_unique_name(Application_Links* app, Arena*
|
|||
internal String_Const_u8 push_buffer_file_name(Application_Links* app, Arena* arena, Buffer_ID buffer_id);
|
||||
internal Dirty_State buffer_get_dirty_state(Application_Links* app, Buffer_ID buffer_id);
|
||||
internal b32 buffer_set_dirty_state(Application_Links* app, Buffer_ID buffer_id, Dirty_State dirty_state);
|
||||
internal b32 buffer_get_setting(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32* value_out);
|
||||
internal b32 buffer_set_setting(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 value);
|
||||
internal b32 buffer_get_setting(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i64* value_out);
|
||||
internal b32 buffer_set_setting(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i64 value);
|
||||
internal Managed_Scope buffer_get_managed_scope(Application_Links* app, Buffer_ID buffer_id);
|
||||
internal b32 buffer_send_end_signal(Application_Links* app, Buffer_ID buffer_id);
|
||||
internal Buffer_ID create_buffer(Application_Links* app, String_Const_u8 file_name, Buffer_Create_Flag flags);
|
||||
|
@ -591,8 +591,8 @@ internal Rect_f32 view_get_buffer_region(Application_Links* app, View_ID view_id
|
|||
internal Buffer_Scroll view_get_buffer_scroll(Application_Links* app, View_ID view_id);
|
||||
internal Basic_Scroll view_get_basic_scroll(Application_Links* app, View_ID view_id);
|
||||
internal b32 view_set_active(Application_Links* app, View_ID view_id);
|
||||
internal b32 view_get_setting(Application_Links* app, View_ID view_id, View_Setting_ID setting, i32* value_out);
|
||||
internal b32 view_set_setting(Application_Links* app, View_ID view_id, View_Setting_ID setting, i32 value);
|
||||
internal b32 view_get_setting(Application_Links* app, View_ID view_id, View_Setting_ID setting, i64* value_out);
|
||||
internal b32 view_set_setting(Application_Links* app, View_ID view_id, View_Setting_ID setting, i64 value);
|
||||
internal Managed_Scope view_get_managed_scope(Application_Links* app, View_ID view_id);
|
||||
internal Buffer_Cursor buffer_compute_cursor(Application_Links* app, Buffer_ID buffer, Buffer_Seek seek);
|
||||
internal Buffer_Cursor view_compute_cursor(Application_Links* app, View_ID view_id, Buffer_Seek seek);
|
||||
|
@ -627,7 +627,7 @@ internal Managed_Scope managed_object_get_containing_scope(Application_Links* ap
|
|||
internal b32 managed_object_free(Application_Links* app, Managed_Object object);
|
||||
internal b32 managed_object_store_data(Application_Links* app, Managed_Object object, u32 first_index, u32 count, void* mem);
|
||||
internal b32 managed_object_load_data(Application_Links* app, Managed_Object object, u32 first_index, u32 count, void* mem_out);
|
||||
internal User_Input get_user_input(Application_Links* app, Input_Type_Flag get_type, Input_Type_Flag abort_type);
|
||||
internal User_Input get_user_input(Application_Links* app, Event_Property get_properties, Event_Property abort_properties);
|
||||
internal User_Input get_command_input(Application_Links* app);
|
||||
internal void set_command_input(Application_Links* app, Input_Event* event);
|
||||
internal Mouse_State get_mouse_state(Application_Links* app);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
api(custom) function b32 global_set_setting(Application_Links* app, Global_Setting_ID setting, i32 value);
|
||||
api(custom) function b32 global_set_setting(Application_Links* app, Global_Setting_ID setting, i64 value);
|
||||
api(custom) function b32 global_set_mapping(Application_Links* app, void* data, i32 size);
|
||||
api(custom) function Rect_f32 global_get_screen_rectangle(Application_Links* app);
|
||||
api(custom) function Thread_Context* get_thread_context(Application_Links* app);
|
||||
|
@ -41,8 +41,8 @@ api(custom) function String_Const_u8 push_buffer_unique_name(Application_Links*
|
|||
api(custom) function String_Const_u8 push_buffer_file_name(Application_Links* app, Arena* arena, Buffer_ID buffer_id);
|
||||
api(custom) function Dirty_State buffer_get_dirty_state(Application_Links* app, Buffer_ID buffer_id);
|
||||
api(custom) function b32 buffer_set_dirty_state(Application_Links* app, Buffer_ID buffer_id, Dirty_State dirty_state);
|
||||
api(custom) function b32 buffer_get_setting(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32* value_out);
|
||||
api(custom) function b32 buffer_set_setting(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 value);
|
||||
api(custom) function b32 buffer_get_setting(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i64* value_out);
|
||||
api(custom) function b32 buffer_set_setting(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i64 value);
|
||||
api(custom) function Managed_Scope buffer_get_managed_scope(Application_Links* app, Buffer_ID buffer_id);
|
||||
api(custom) function b32 buffer_send_end_signal(Application_Links* app, Buffer_ID buffer_id);
|
||||
api(custom) function Buffer_ID create_buffer(Application_Links* app, String_Const_u8 file_name, Buffer_Create_Flag flags);
|
||||
|
@ -78,8 +78,8 @@ api(custom) function Rect_f32 view_get_buffer_region(Application_Links* app, Vie
|
|||
api(custom) function Buffer_Scroll view_get_buffer_scroll(Application_Links* app, View_ID view_id);
|
||||
api(custom) function Basic_Scroll view_get_basic_scroll(Application_Links* app, View_ID view_id);
|
||||
api(custom) function b32 view_set_active(Application_Links* app, View_ID view_id);
|
||||
api(custom) function b32 view_get_setting(Application_Links* app, View_ID view_id, View_Setting_ID setting, i32* value_out);
|
||||
api(custom) function b32 view_set_setting(Application_Links* app, View_ID view_id, View_Setting_ID setting, i32 value);
|
||||
api(custom) function b32 view_get_setting(Application_Links* app, View_ID view_id, View_Setting_ID setting, i64* value_out);
|
||||
api(custom) function b32 view_set_setting(Application_Links* app, View_ID view_id, View_Setting_ID setting, i64 value);
|
||||
api(custom) function Managed_Scope view_get_managed_scope(Application_Links* app, View_ID view_id);
|
||||
api(custom) function Buffer_Cursor buffer_compute_cursor(Application_Links* app, Buffer_ID buffer, Buffer_Seek seek);
|
||||
api(custom) function Buffer_Cursor view_compute_cursor(Application_Links* app, View_ID view_id, Buffer_Seek seek);
|
||||
|
@ -114,7 +114,7 @@ api(custom) function Managed_Scope managed_object_get_containing_scope(Applicati
|
|||
api(custom) function b32 managed_object_free(Application_Links* app, Managed_Object object);
|
||||
api(custom) function b32 managed_object_store_data(Application_Links* app, Managed_Object object, u32 first_index, u32 count, void* mem);
|
||||
api(custom) function b32 managed_object_load_data(Application_Links* app, Managed_Object object, u32 first_index, u32 count, void* mem_out);
|
||||
api(custom) function User_Input get_user_input(Application_Links* app, Input_Type_Flag get_type, Input_Type_Flag abort_type);
|
||||
api(custom) function User_Input get_user_input(Application_Links* app, Event_Property get_properties, Event_Property abort_properties);
|
||||
api(custom) function User_Input get_command_input(Application_Links* app);
|
||||
api(custom) function void set_command_input(Application_Links* app, Input_Event* event);
|
||||
api(custom) function Mouse_State get_mouse_state(Application_Links* app);
|
||||
|
|
|
@ -39,15 +39,15 @@ void fill_keys_default(Bind_Helper *context){
|
|||
bind(context, KeyCode_F14, MDFR_NONE, project_fkey_command);
|
||||
bind(context, KeyCode_F15, MDFR_NONE, project_fkey_command);
|
||||
bind(context, KeyCode_F16, MDFR_NONE, project_fkey_command);
|
||||
bind(context, KeyCodeExt_MouseWheel, MDFR_NONE, mouse_wheel_scroll);
|
||||
bind(context, KeyCodeExt_MouseWheel, MDFR_CTRL, mouse_wheel_change_face_size);
|
||||
//bind(context, KeyCodeExt_MouseWheel, MDFR_NONE, mouse_wheel_scroll);
|
||||
//bind(context, KeyCodeExt_MouseWheel, MDFR_CTRL, mouse_wheel_change_face_size);
|
||||
end_map(context);
|
||||
begin_map(context, mapid_file);
|
||||
bind_vanilla_keys(context, write_character);
|
||||
bind(context, KeyCodeExt_MouseLeft, MDFR_NONE, click_set_cursor_and_mark);
|
||||
bind(context, KeyCodeExt_ClickActivateView, MDFR_NONE, click_set_cursor_and_mark);
|
||||
bind(context, KeyCodeExt_MouseLeftRelease, MDFR_NONE, click_set_cursor);
|
||||
bind(context, KeyCodeExt_MouseMove, MDFR_NONE, click_set_cursor_if_lbutton);
|
||||
bind_text_input(context, write_text_input);
|
||||
//bind(context, KeyCodeExt_MouseLeft, MDFR_NONE, click_set_cursor_and_mark);
|
||||
//bind(context, KeyCodeExt_ClickActivateView, MDFR_NONE, click_set_cursor_and_mark);
|
||||
//bind(context, KeyCodeExt_MouseLeftRelease, MDFR_NONE, click_set_cursor);
|
||||
//bind(context, KeyCodeExt_MouseMove, MDFR_NONE, click_set_cursor_if_lbutton);
|
||||
bind(context, KeyCode_Delete, MDFR_NONE, delete_char);
|
||||
bind(context, KeyCode_Delete, MDFR_SHIFT, delete_char);
|
||||
bind(context, KeyCode_Backspace, MDFR_NONE, backspace_char);
|
||||
|
@ -117,13 +117,14 @@ void fill_keys_default(Bind_Helper *context){
|
|||
bind(context, KeyCode_Z, MDFR_CTRL, undo);
|
||||
bind(context, KeyCode_1, MDFR_CTRL, view_buffer_other_panel);
|
||||
bind(context, KeyCode_2, MDFR_CTRL, swap_buffers_between_panels);
|
||||
bind(context, KeyCode_Return, MDFR_NONE, newline_or_goto_position);
|
||||
bind(context, KeyCode_Return, MDFR_SHIFT, newline_or_goto_position_same_panel);
|
||||
bind(context, KeyCode_Return, MDFR_NONE, if_read_only_goto_position);
|
||||
bind(context, KeyCode_Return, MDFR_SHIFT, if_read_only_goto_position_same_panel);
|
||||
bind(context, KeyCode_Period, MDFR_CTRL|MDFR_SHIFT, view_jump_list_with_lister);
|
||||
bind(context, KeyCode_Space, MDFR_SHIFT, write_space);
|
||||
end_map(context);
|
||||
begin_map(context, default_code_map);
|
||||
inherit_map(context, mapid_file);
|
||||
bind_text_input(context, write_text_and_auto_indent);
|
||||
bind(context, KeyCode_Left, MDFR_CTRL, move_left_alpha_numeric_boundary);
|
||||
bind(context, KeyCode_Left, MDFR_CTRL|MDFR_SHIFT, move_left_alpha_numeric_boundary);
|
||||
bind(context, KeyCode_Right, MDFR_CTRL, move_right_alpha_numeric_boundary);
|
||||
|
@ -131,17 +132,10 @@ void fill_keys_default(Bind_Helper *context){
|
|||
bind(context, KeyCode_Left, MDFR_ALT, move_left_alpha_numeric_or_camel_boundary);
|
||||
bind(context, KeyCode_Left, MDFR_ALT|MDFR_SHIFT, move_left_alpha_numeric_or_camel_boundary);
|
||||
bind(context, KeyCode_Right, MDFR_ALT|MDFR_SHIFT, move_right_alpha_numeric_or_camel_boundary);
|
||||
bind(context, KeyCode_Return, MDFR_NONE, write_and_auto_tab);
|
||||
bind(context, KeyCode_Return, MDFR_SHIFT, write_and_auto_tab);
|
||||
bind(context, KeyCode_RightBracket, MDFR_SHIFT, write_and_auto_tab);
|
||||
bind(context, KeyCode_0, MDFR_SHIFT, write_and_auto_tab);
|
||||
bind(context, KeyCode_RightBracket, MDFR_NONE, write_and_auto_tab);
|
||||
bind(context, KeyCode_Semicolon, MDFR_NONE, write_and_auto_tab);
|
||||
bind(context, KeyCode_3, MDFR_SHIFT, write_and_auto_tab);
|
||||
bind(context, KeyCode_Semicolon, MDFR_CTRL, comment_line_toggle);
|
||||
bind(context, KeyCode_Tab, MDFR_NONE, word_complete);
|
||||
bind(context, KeyCode_Tab, MDFR_CTRL, auto_tab_range);
|
||||
bind(context, KeyCode_Tab, MDFR_SHIFT, auto_tab_line_at_cursor);
|
||||
bind(context, KeyCode_Tab, MDFR_CTRL, auto_indent_range);
|
||||
bind(context, KeyCode_Tab, MDFR_SHIFT, auto_indent_line_at_cursor);
|
||||
bind(context, KeyCode_R, MDFR_ALT, write_block);
|
||||
bind(context, KeyCode_T, MDFR_ALT, write_todo);
|
||||
bind(context, KeyCode_Y, MDFR_ALT, write_note);
|
||||
|
@ -162,7 +156,7 @@ void fill_keys_default(Bind_Helper *context){
|
|||
bind(context, KeyCode_0, MDFR_CTRL, write_zero_struct);
|
||||
end_map(context);
|
||||
begin_map(context, default_lister_ui_map);
|
||||
bind_vanilla_keys(context, lister__write_character);
|
||||
bind_text_input(context, lister__write_character);
|
||||
bind(context, KeyCode_Escape, MDFR_NONE, lister__quit);
|
||||
bind(context, KeyCode_Return, MDFR_NONE, lister__activate);
|
||||
bind(context, KeyCode_Tab, MDFR_NONE, lister__activate);
|
||||
|
@ -180,11 +174,11 @@ void fill_keys_default(Bind_Helper *context){
|
|||
bind(context, KeyCode_Down, MDFR_NONE, lister__move_down);
|
||||
bind(context, KeyCode_J, MDFR_ALT, lister__move_down);
|
||||
bind(context, KeyCode_PageDown, MDFR_NONE, lister__move_down);
|
||||
bind(context, KeyCodeExt_MouseWheel, MDFR_NONE, lister__wheel_scroll);
|
||||
bind(context, KeyCodeExt_MouseLeft, MDFR_NONE, lister__mouse_press);
|
||||
bind(context, KeyCodeExt_MouseLeftRelease, MDFR_NONE, lister__mouse_release);
|
||||
bind(context, KeyCodeExt_MouseMove, MDFR_NONE, lister__repaint);
|
||||
bind(context, KeyCodeExt_Animate, MDFR_NONE, lister__repaint);
|
||||
//bind(context, KeyCodeExt_MouseWheel, MDFR_NONE, lister__wheel_scroll);
|
||||
//bind(context, KeyCodeExt_MouseLeft, MDFR_NONE, lister__mouse_press);
|
||||
//bind(context, KeyCodeExt_MouseLeftRelease, MDFR_NONE, lister__mouse_release);
|
||||
//bind(context, KeyCodeExt_MouseMove, MDFR_NONE, lister__repaint);
|
||||
//bind(context, KeyCodeExt_Animate, MDFR_NONE, lister__repaint);
|
||||
end_map(context);
|
||||
}
|
||||
#endif
|
||||
|
@ -266,7 +260,7 @@ static Meta_Key_Bind fcoder_binds_for_default_mapid_global[43] = {
|
|||
{0, 55321, 1, "mouse_wheel_change_face_size", 28, LINK_PROCS(mouse_wheel_change_face_size)},
|
||||
};
|
||||
static Meta_Key_Bind fcoder_binds_for_default_mapid_file[78] = {
|
||||
{1, 0, 0, "write_character", 15, LINK_PROCS(write_character)},
|
||||
{1, 0, 0, "write_text_input", 15, LINK_PROCS(write_text_input)},
|
||||
{0, 55317, 0, "click_set_cursor_and_mark", 25, LINK_PROCS(click_set_cursor_and_mark)},
|
||||
{0, 55324, 0, "click_set_cursor_and_mark", 25, LINK_PROCS(click_set_cursor_and_mark)},
|
||||
{0, 55319, 0, "click_set_cursor", 16, LINK_PROCS(click_set_cursor)},
|
||||
|
@ -340,27 +334,27 @@ static Meta_Key_Bind fcoder_binds_for_default_mapid_file[78] = {
|
|||
{0, 122, 1, "undo", 4, LINK_PROCS(undo)},
|
||||
{0, 49, 1, "view_buffer_other_panel", 23, LINK_PROCS(view_buffer_other_panel)},
|
||||
{0, 50, 1, "swap_buffers_between_panels", 27, LINK_PROCS(swap_buffers_between_panels)},
|
||||
{0, 10, 0, "newline_or_goto_position", 24, LINK_PROCS(newline_or_goto_position)},
|
||||
{0, 10, 8, "newline_or_goto_position_same_panel", 35, LINK_PROCS(newline_or_goto_position_same_panel)},
|
||||
{0, 10, 0, "newline_or_goto_position", 24, LINK_PROCS(if_read_only_goto_position)},
|
||||
{0, 10, 8, "newline_or_goto_position_same_panel", 35, LINK_PROCS(if_read_only_goto_position_same_panel)},
|
||||
{0, 62, 1, "view_jump_list_with_lister", 26, LINK_PROCS(view_jump_list_with_lister)},
|
||||
{0, 32, 8, "write_character", 15, LINK_PROCS(write_character)},
|
||||
{0, 32, 8, "write_text_input", 15, LINK_PROCS(write_text_input)},
|
||||
};
|
||||
static Meta_Key_Bind fcoder_binds_for_default_default_code_map[33] = {
|
||||
{0, 55299, 1, "move_left_alpha_numeric_or_camel_boundary", 41, LINK_PROCS(move_left_alpha_numeric_or_camel_boundary)},
|
||||
{0, 55300, 1, "move_right_alpha_numeric_or_camel_boundary", 42, LINK_PROCS(move_right_alpha_numeric_or_camel_boundary)},
|
||||
{0, 55299, 2, "move_left_alpha_numeric_boundary", 32, LINK_PROCS(move_left_alpha_numeric_boundary)},
|
||||
{0, 55300, 2, "move_right_alpha_numeric_boundary", 33, LINK_PROCS(move_right_alpha_numeric_boundary)},
|
||||
{0, 10, 0, "write_and_auto_tab", 18, LINK_PROCS(write_and_auto_tab)},
|
||||
{0, 10, 8, "write_and_auto_tab", 18, LINK_PROCS(write_and_auto_tab)},
|
||||
{0, 125, 0, "write_and_auto_tab", 18, LINK_PROCS(write_and_auto_tab)},
|
||||
{0, 41, 0, "write_and_auto_tab", 18, LINK_PROCS(write_and_auto_tab)},
|
||||
{0, 93, 0, "write_and_auto_tab", 18, LINK_PROCS(write_and_auto_tab)},
|
||||
{0, 59, 0, "write_and_auto_tab", 18, LINK_PROCS(write_and_auto_tab)},
|
||||
{0, 35, 0, "write_and_auto_tab", 18, LINK_PROCS(write_and_auto_tab)},
|
||||
{0, 10, 0, "write_and_auto_tab", 18, LINK_PROCS(write_text_and_auto_indent)},
|
||||
{0, 10, 8, "write_and_auto_tab", 18, LINK_PROCS(write_text_and_auto_indent)},
|
||||
{0, 125, 0, "write_text_and_auto_indent", 18, LINK_PROCS(write_text_and_auto_indent)},
|
||||
{0, 41, 0, "write_text_and_auto_indent", 18, LINK_PROCS(write_text_and_auto_indent)},
|
||||
{0, 93, 0, "write_text_and_auto_indent", 18, LINK_PROCS(write_text_and_auto_indent)},
|
||||
{0, 59, 0, "write_text_and_auto_indent", 18, LINK_PROCS(write_text_and_auto_indent)},
|
||||
{0, 35, 0, "write_text_and_auto_indent", 18, LINK_PROCS(write_text_and_auto_indent)},
|
||||
{0, 59, 1, "comment_line_toggle", 19, LINK_PROCS(comment_line_toggle)},
|
||||
{0, 9, 0, "word_complete", 13, LINK_PROCS(word_complete)},
|
||||
{0, 9, 1, "auto_tab_range", 14, LINK_PROCS(auto_tab_range)},
|
||||
{0, 9, 8, "auto_tab_line_at_cursor", 23, LINK_PROCS(auto_tab_line_at_cursor)},
|
||||
{0, 9, 1, "auto_tab_range", 14, LINK_PROCS(auto_indent_range)},
|
||||
{0, 9, 8, "auto_tab_line_at_cursor", 23, LINK_PROCS(auto_indent_line_at_cursor)},
|
||||
{0, 114, 2, "write_block", 11, LINK_PROCS(write_block)},
|
||||
{0, 116, 2, "write_todo", 10, LINK_PROCS(write_todo)},
|
||||
{0, 121, 2, "write_note", 10, LINK_PROCS(write_note)},
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "4coder_lib/4coder_utf8.h"
|
||||
|
||||
#if defined(FRED_SUPER)
|
||||
# include "4coder_API/4coder_keycodes.h"
|
||||
#include "4coder_keycode_extension.h"
|
||||
# include "4coder_API/4coder_style.h"
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
# define FSTRING_IMPLEMENTATION
|
||||
# include "4coder_lib/4coder_string.h"
|
||||
|
||||
# include "4coder_API/4coder_keycodes.h"
|
||||
#include "4coder_keycode_extension.h"
|
||||
# include "4coder_API/4coder_style.h"
|
||||
# include "4coder_API/4coder_types.h"
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "4coder_base_types.h"
|
||||
|
||||
#include "4coder_API/4coder_version.h"
|
||||
#include "4coder_API/4coder_keycodes.h"
|
||||
|
||||
#include "4ed_cursor_codes.h"
|
||||
#include "4ed_linked_node_macros.h"
|
||||
|
|
|
@ -14,11 +14,10 @@
|
|||
#define frame_useconds (1000000 / FPS)
|
||||
|
||||
#include "4coder_base_types.h"
|
||||
#include "4coder_table.h"
|
||||
#include "4coder_version.h"
|
||||
#include "4coder_events.h"
|
||||
|
||||
#include "generated/4coder_keycodes.h"
|
||||
#include "4coder_keycode_extension.h"
|
||||
#include "4coder_table.h"
|
||||
#include "4coder_default_colors.h"
|
||||
#include "4coder_types.h"
|
||||
|
||||
|
@ -43,6 +42,7 @@
|
|||
|
||||
#include "4coder_base_types.cpp"
|
||||
#include "4coder_stringf.cpp"
|
||||
#include "4coder_events.cpp"
|
||||
#include "4coder_hash_functions.cpp"
|
||||
#include "4coder_table.cpp"
|
||||
#include "4coder_log.cpp"
|
||||
|
@ -77,10 +77,9 @@ struct Control_Keys{
|
|||
b8 l_alt;
|
||||
b8 r_alt;
|
||||
};
|
||||
global Control_Keys null_control_keys = {};
|
||||
|
||||
struct Win32_Input_Chunk_Transient{
|
||||
Key_Input_Data key_data;
|
||||
Input_List event_list;
|
||||
b8 mouse_l_press;
|
||||
b8 mouse_l_release;
|
||||
b8 mouse_r_press;
|
||||
|
@ -89,7 +88,6 @@ struct Win32_Input_Chunk_Transient{
|
|||
i8 mouse_wheel;
|
||||
b8 trying_to_kill;
|
||||
};
|
||||
global Win32_Input_Chunk_Transient null_input_chunk_transient = {};
|
||||
|
||||
struct Win32_Input_Chunk_Persistent{
|
||||
Vec2_i32 mouse;
|
||||
|
@ -147,6 +145,7 @@ struct Win32_Object{
|
|||
struct Win32_Vars{
|
||||
Thread_Context *tctx;
|
||||
|
||||
Arena *frame_arena;
|
||||
Win32_Input_Chunk input_chunk;
|
||||
b8 lctrl_lalt_is_altgr;
|
||||
b8 got_useful_event;
|
||||
|
@ -340,6 +339,13 @@ system_is_fullscreen_sig(){
|
|||
return(result);
|
||||
}
|
||||
|
||||
internal
|
||||
system_get_keyboard_modifiers_sig(){
|
||||
Key_Modifiers result = {};
|
||||
block_copy_array(result.modifiers, win32vars.input_chunk.pers.control_keys);
|
||||
return(result);
|
||||
}
|
||||
|
||||
//
|
||||
// Clipboard
|
||||
//
|
||||
|
@ -699,129 +705,6 @@ win32_resize(i32 width, i32 height){
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
internal void
|
||||
win32_init_gl(HDC hdc){
|
||||
//LOG("trying to load wgl extensions...\n");
|
||||
|
||||
#define GLInitFail(s) system_error_box(file_name_line_number "\nOpenGL init fail - " s )
|
||||
|
||||
// Init First Context
|
||||
WNDCLASSA wglclass = {};
|
||||
wglclass.lpfnWndProc = DefWindowProcA;
|
||||
wglclass.hInstance = GetModuleHandle(0);
|
||||
wglclass.lpszClassName = "4ed-wgl-loader";
|
||||
if (RegisterClassA(&wglclass) == 0){
|
||||
GLInitFail("RegisterClassA");
|
||||
}
|
||||
|
||||
HWND hwglwnd = CreateWindowExA(0, wglclass.lpszClassName, "", 0, 0, 0, 0, 0, 0, 0, wglclass.hInstance, 0);
|
||||
if (hwglwnd == 0){
|
||||
GLInitFail("CreateWindowExA");
|
||||
}
|
||||
|
||||
HDC hwgldc = GetDC(hwglwnd);
|
||||
|
||||
PIXELFORMATDESCRIPTOR format = {};
|
||||
format.nSize = sizeof(format);
|
||||
format.nVersion = 1;
|
||||
//format.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER;
|
||||
format.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW;
|
||||
format.iPixelType = PFD_TYPE_RGBA;
|
||||
format.cColorBits = 32;
|
||||
format.cAlphaBits = 8;
|
||||
format.cDepthBits = 24;
|
||||
format.iLayerType = PFD_MAIN_PLANE;
|
||||
i32 suggested_format_index = ChoosePixelFormat(hwgldc, &format);
|
||||
if (suggested_format_index == 0){
|
||||
win32_output_error_string(ErrorString_UseErrorBox);
|
||||
GLInitFail("ChoosePixelFormat");
|
||||
}
|
||||
|
||||
DescribePixelFormat(hwgldc, suggested_format_index, sizeof(format), &format);
|
||||
if (!SetPixelFormat(hwgldc, suggested_format_index, &format)){
|
||||
win32_output_error_string(ErrorString_UseErrorBox);
|
||||
GLInitFail("SetPixelFormat");
|
||||
}
|
||||
|
||||
HGLRC wglcontext = wglCreateContext(hwgldc);
|
||||
if (wglcontext == 0){
|
||||
win32_output_error_string(ErrorString_UseErrorBox);
|
||||
GLInitFail("wglCreateContext");
|
||||
}
|
||||
|
||||
if (!wglMakeCurrent(hwgldc, wglcontext)){
|
||||
win32_output_error_string(ErrorString_UseErrorBox);
|
||||
GLInitFail("wglMakeCurrent");
|
||||
}
|
||||
|
||||
// Load wgl Extensions
|
||||
#define LoadWGL(f, s) f = (f##_Function*)wglGetProcAddress(#f); b32 got_##f = GLFuncGood(f); \
|
||||
if (!got_##f) { if (s) { GLInitFail(#f " missing"); } else { f = 0; } }
|
||||
LoadWGL(wglCreateContextAttribsARB, true);
|
||||
LoadWGL(wglChoosePixelFormatARB, true);
|
||||
LoadWGL(wglGetExtensionsStringEXT, true);
|
||||
|
||||
//LOG("got wgl functions\n");
|
||||
|
||||
char *extensions_c = wglGetExtensionsStringEXT();
|
||||
String extensions = make_string_slowly(extensions_c);
|
||||
if (has_substr(extensions, make_lit_string("WGL_EXT_swap_interval"))){
|
||||
LoadWGL(wglSwapIntervalEXT, false);
|
||||
if (wglSwapIntervalEXT != 0){
|
||||
//LOG("got wglSwapIntervalEXT\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Init the Second Context
|
||||
int pixel_attrib_list[] = {
|
||||
WGL_DRAW_TO_WINDOW_ARB, TRUE,
|
||||
WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
|
||||
WGL_SUPPORT_OPENGL_ARB, TRUE,
|
||||
//WGL_DOUBLE_BUFFER_ARB, TRUE,
|
||||
WGL_DOUBLE_BUFFER_ARB, FALSE,
|
||||
WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
|
||||
0,
|
||||
};
|
||||
|
||||
u32 ignore = 0;
|
||||
if (!wglChoosePixelFormatARB(hdc, pixel_attrib_list, 0, 1, &suggested_format_index, &ignore)){
|
||||
GLInitFail("wglChoosePixelFormatARB");
|
||||
}
|
||||
|
||||
DescribePixelFormat(hdc, suggested_format_index, sizeof(format), &format);
|
||||
if (!SetPixelFormat(hdc, suggested_format_index, &format)){
|
||||
GLInitFail("SetPixelFormat");
|
||||
}
|
||||
|
||||
i32 context_attrib_list[] = {
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, 2,
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, 1,
|
||||
WGL_CONTEXT_FLAGS_ARB, 0,
|
||||
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
|
||||
0
|
||||
};
|
||||
|
||||
HGLRC context = wglCreateContextAttribsARB(hdc, 0, context_attrib_list);
|
||||
if (context == 0){
|
||||
GLInitFail("wglCreateContextAttribsARB");
|
||||
}
|
||||
|
||||
wglMakeCurrent(hdc, context);
|
||||
|
||||
if (wglSwapIntervalEXT != 0){
|
||||
//LOGF("setting swap interval %d\n", 1);
|
||||
wglSwapIntervalEXT(1);
|
||||
}
|
||||
|
||||
ReleaseDC(hwglwnd, hwgldc);
|
||||
DestroyWindow(hwglwnd);
|
||||
wglDeleteContext(wglcontext);
|
||||
|
||||
//LOG("successfully enabled opengl\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
internal void
|
||||
Win32SetCursorFromUpdate(Application_Mouse_Cursor cursor){
|
||||
switch (cursor){
|
||||
|
@ -1115,18 +998,12 @@ win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
|
|||
if (down){
|
||||
Key_Code key = keycode_lookup_table[(u8)wParam];
|
||||
if (key != 0){
|
||||
i32 *count = &win32vars.input_chunk.trans.key_data.count;
|
||||
Key_Event_Data *data = win32vars.input_chunk.trans.key_data.keys;
|
||||
b8 *control_keys = win32vars.input_chunk.pers.control_keys;
|
||||
i32 control_keys_size = sizeof(win32vars.input_chunk.pers.control_keys);
|
||||
|
||||
if (*count < KEY_INPUT_BUFFER_SIZE){
|
||||
data[*count].character = 0;
|
||||
data[*count].character_no_caps_lock = 0;
|
||||
data[*count].keycode = key;
|
||||
memcpy(data[*count].modifiers, control_keys, control_keys_size);
|
||||
++(*count);
|
||||
}
|
||||
Key_Modifiers modifiers = system_get_keyboard_modifiers();
|
||||
Input_Event event = {};
|
||||
event.kind = InputEventKind_KeyStroke;
|
||||
event.key.code = key;
|
||||
block_copy_struct(&event.key.modifiers, &modifiers);
|
||||
push_input_event(win32vars.frame_arena, &win32vars.input_chunk.trans.event_list, &event);
|
||||
|
||||
win32vars.got_useful_event = true;
|
||||
}
|
||||
|
@ -1147,31 +1024,15 @@ win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
|
|||
break;
|
||||
}
|
||||
|
||||
u16 character_no_caps_lock = character;
|
||||
String_Const_u16 str_16 = SCu16(&character, 1);
|
||||
String_Const_u8 str_8 = string_u8_from_string_u16(win32vars.frame_arena, str_16).string;
|
||||
|
||||
i32 *count = &win32vars.input_chunk.trans.key_data.count;
|
||||
Key_Event_Data *data = win32vars.input_chunk.trans.key_data.keys;
|
||||
b8 *control_keys = win32vars.input_chunk.pers.control_keys;
|
||||
i32 control_keys_size = sizeof(win32vars.input_chunk.pers.control_keys);
|
||||
|
||||
BYTE state[256];
|
||||
GetKeyboardState(state);
|
||||
if (state[VK_CAPITAL]){
|
||||
if (character_no_caps_lock >= 'a' && character_no_caps_lock <= 'z'){
|
||||
character_no_caps_lock -= (u8)('a' - 'A');
|
||||
}
|
||||
else if (character_no_caps_lock >= 'A' && character_no_caps_lock <= 'Z'){
|
||||
character_no_caps_lock += (u8)('a' - 'A');
|
||||
}
|
||||
}
|
||||
|
||||
if (*count < KEY_INPUT_BUFFER_SIZE){
|
||||
data[*count].character = character;
|
||||
data[*count].character_no_caps_lock = character_no_caps_lock;
|
||||
data[*count].keycode = character_no_caps_lock;
|
||||
memcpy(data[*count].modifiers, control_keys, control_keys_size);
|
||||
++(*count);
|
||||
}
|
||||
Key_Modifiers modifiers = system_get_keyboard_modifiers();
|
||||
Input_Event event = {};
|
||||
event.kind = InputEventKind_TextInsert;
|
||||
event.text.string = str_8;
|
||||
block_copy_struct(&event.text.modifiers, &modifiers);
|
||||
push_input_event(win32vars.frame_arena, &win32vars.input_chunk.trans.event_list, &event);
|
||||
|
||||
win32vars.got_useful_event = true;
|
||||
}break;
|
||||
|
@ -1200,41 +1061,41 @@ win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
|
|||
case WM_LBUTTONDOWN:
|
||||
{
|
||||
win32vars.got_useful_event = true;
|
||||
win32vars.input_chunk.trans.mouse_l_press = 1;
|
||||
win32vars.input_chunk.pers.mouse_l = 1;
|
||||
win32vars.input_chunk.trans.mouse_l_press = true;
|
||||
win32vars.input_chunk.pers.mouse_l = true;
|
||||
}break;
|
||||
|
||||
case WM_RBUTTONDOWN:
|
||||
{
|
||||
win32vars.got_useful_event = true;
|
||||
win32vars.input_chunk.trans.mouse_r_press = 1;
|
||||
win32vars.input_chunk.pers.mouse_r = 1;
|
||||
win32vars.input_chunk.trans.mouse_r_press = true;
|
||||
win32vars.input_chunk.pers.mouse_r = true;
|
||||
}break;
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
{
|
||||
win32vars.got_useful_event = true;
|
||||
win32vars.input_chunk.trans.mouse_l_release = 1;
|
||||
win32vars.input_chunk.pers.mouse_l = 0;
|
||||
win32vars.input_chunk.trans.mouse_l_release = true;
|
||||
win32vars.input_chunk.pers.mouse_l = false;
|
||||
}break;
|
||||
|
||||
case WM_RBUTTONUP:
|
||||
{
|
||||
win32vars.got_useful_event = true;
|
||||
win32vars.input_chunk.trans.mouse_r_release = 1;
|
||||
win32vars.input_chunk.pers.mouse_r = 0;
|
||||
win32vars.input_chunk.trans.mouse_r_release = true;
|
||||
win32vars.input_chunk.pers.mouse_r = false;
|
||||
}break;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
case WM_SETFOCUS:
|
||||
{
|
||||
win32vars.got_useful_event = true;
|
||||
win32vars.input_chunk.pers.mouse_l = 0;
|
||||
win32vars.input_chunk.pers.mouse_r = 0;
|
||||
win32vars.input_chunk.pers.mouse_l = false;
|
||||
win32vars.input_chunk.pers.mouse_r = false;
|
||||
for (i32 i = 0; i < MDFR_INDEX_COUNT; ++i){
|
||||
win32vars.input_chunk.pers.control_keys[i] = 0;
|
||||
win32vars.input_chunk.pers.control_keys[i] = false;
|
||||
}
|
||||
win32vars.input_chunk.pers.controls = null_control_keys;
|
||||
block_zero_struct(&win32vars.input_chunk.pers.controls);
|
||||
}break;
|
||||
|
||||
case WM_SIZE:
|
||||
|
@ -1542,7 +1403,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
|
|||
i32 argc = __argc;
|
||||
char **argv = __argv;
|
||||
|
||||
// NOTE(allen): memory
|
||||
// NOTE(allen): context setup
|
||||
Thread_Context _tctx = {};
|
||||
thread_ctx_init(&_tctx, get_base_allocator_system());
|
||||
|
||||
|
@ -1558,6 +1419,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
|
|||
API_VTable_font font_vtable = {};
|
||||
font_api_fill_vtable(&font_vtable);
|
||||
|
||||
// NOTE(allen): memory
|
||||
win32vars.frame_arena = reserve_arena(win32vars.tctx);
|
||||
// TODO(allen): *arena;
|
||||
target.arena = make_arena_system();
|
||||
|
||||
|
@ -1791,10 +1654,12 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
|
|||
SetActiveWindow(win32vars.window_handle);
|
||||
ShowWindow(win32vars.window_handle, SW_SHOW);
|
||||
|
||||
//LOG("Beginning main loop\n");
|
||||
u64 timer_start = system_now_time();
|
||||
MSG msg;
|
||||
for (;keep_running;){
|
||||
linalloc_clear(win32vars.frame_arena);
|
||||
block_zero_struct(&win32vars.input_chunk.trans);
|
||||
|
||||
// TODO(allen): Find a good way to wait on a pipe
|
||||
// without interfering with the reading process.
|
||||
// NOTE(allen): Looks like we can ReadFile with a
|
||||
|
@ -1897,7 +1762,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
|
|||
|
||||
// TODO(allen): CROSS REFERENCE WITH LINUX SPECIAL CODE "TIC898989"
|
||||
Win32_Input_Chunk input_chunk = win32vars.input_chunk;
|
||||
win32vars.input_chunk.trans = null_input_chunk_transient;
|
||||
|
||||
input_chunk.pers.control_keys[MDFR_CAPS_INDEX] = GetKeyState(VK_CAPITAL) & 0x1;
|
||||
|
||||
|
@ -1905,9 +1769,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
|
|||
|
||||
input.first_step = win32vars.first;
|
||||
input.dt = frame_useconds/1000000.f;
|
||||
|
||||
input.keys = input_chunk.trans.key_data;
|
||||
memcpy(input.keys.modifiers, input_chunk.pers.control_keys, sizeof(input.keys.modifiers));
|
||||
input.events = input_chunk.trans.event_list;
|
||||
|
||||
input.mouse.out_of_window = input_chunk.trans.out_of_window;
|
||||
|
||||
|
|
Loading…
Reference in New Issue