Cleaned up listers; no scrolling yet
parent
eb47669f84
commit
13cda93f55
|
@ -1104,9 +1104,7 @@ 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, EventProperty_AnyKey,
|
||||
EventProperty_MouseLeft|
|
||||
EventProperty_MouseRight);
|
||||
in = get_user_input(app, EventProperty_AnyKey, EventProperty_MouseButton);
|
||||
if (in.abort || match_key_code(&in, KeyCode_Escape) || !is_unmodified_key(&in.event)){
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -196,12 +196,12 @@ static Snippet default_snippets[] = {
|
|||
};
|
||||
|
||||
static Lister_Activation_Code
|
||||
activate_snippet(Application_Links *app, Heap *heap, View_ID view, struct Lister_State *state, String_Const_u8 text_field, void *user_data, b32 activated_by_mouse){
|
||||
activate_snippet(Application_Links *app, View_ID view, Lister *lister, String_Const_u8 text_field, void *user_data, b32 activated_by_mouse){
|
||||
i32 index = (i32)PtrAsInt(user_data);
|
||||
Snippet_Array snippets = *(Snippet_Array*)state->lister.data.user_data;
|
||||
Snippet_Array snippets = *(Snippet_Array*)lister->data.user_data;
|
||||
if (0 <= index && index < snippets.count){
|
||||
Snippet snippet = snippets.snippets[index];
|
||||
lister_default(app, heap, view, state, ListerActivation_Finished);
|
||||
lister_default(app, view, lister, ListerActivation_Finished);
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessOpen);
|
||||
i64 pos = view_get_cursor_pos(app, view);
|
||||
buffer_replace_range(app, buffer, Ii64(pos), SCu8(snippet.text));
|
||||
|
@ -209,7 +209,7 @@ activate_snippet(Application_Links *app, Heap *heap, View_ID view, struct Lister
|
|||
view_set_mark(app, view, seek_pos(pos + snippet.mark_offset));
|
||||
}
|
||||
else{
|
||||
lister_default(app, heap, view, state, ListerActivation_Finished);
|
||||
lister_default(app, view, lister, ListerActivation_Finished);
|
||||
}
|
||||
return(ListerActivation_Finished);
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ snippet_lister__parameterized(Application_Links *app, Snippet_Array snippet_arra
|
|||
options[i].status = SCu8(snippet_array.snippets[i].text);
|
||||
options[i].user_data = IntAsPtr(i);
|
||||
}
|
||||
begin_integrated_lister__basic_list(app, "Snippet:", activate_snippet, &snippet_array, sizeof(snippet_array), options, option_count, 0, view);
|
||||
run_lister_with_options_array(app, "Snippet:", activate_snippet, &snippet_array, sizeof(snippet_array), options, option_count, 0, view);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(snippet_lister)
|
||||
|
|
|
@ -174,24 +174,19 @@ get_event_properties(Input_Event *event){
|
|||
flags |= EventProperty_AnyKey;
|
||||
}break;
|
||||
|
||||
case InputEventKind_KeyRelease:
|
||||
{
|
||||
flags |= EventProperty_AnyKeyRelease;
|
||||
}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;
|
||||
}
|
||||
flags |= EventProperty_MouseButton;
|
||||
}break;
|
||||
|
||||
case InputEventKind_MouseButtonRelease:
|
||||
{
|
||||
flags |= EventProperty_MouseRelease;
|
||||
}break;
|
||||
|
||||
case InputEventKind_MouseWheel:
|
||||
|
|
|
@ -88,9 +88,9 @@ typedef u32 Event_Property;
|
|||
enum{
|
||||
EventProperty_AnyKey = 0x1,
|
||||
EventProperty_Escape = 0x2,
|
||||
EventProperty_MouseLeft = 0x4,
|
||||
EventProperty_MouseMiddle = 0x8,
|
||||
EventProperty_MouseRight = 0x10,
|
||||
EventProperty_AnyKeyRelease = 0x4,
|
||||
EventProperty_MouseButton = 0x8,
|
||||
EventProperty_MouseRelease = 0x10,
|
||||
EventProperty_MouseWheel = 0x20,
|
||||
EventProperty_MouseMove = 0x40,
|
||||
EventProperty_Animate = 0x80,
|
||||
|
@ -101,13 +101,11 @@ enum{
|
|||
EventPropertyGroup_AnyKeyboardEvent =
|
||||
EventProperty_AnyKey|
|
||||
EventProperty_Escape|
|
||||
EventProperty_AnyKeyRelease|
|
||||
EventProperty_TextInsert,
|
||||
EventPropertyGroup_AnyMouseButton =
|
||||
EventProperty_MouseLeft|
|
||||
EventProperty_MouseMiddle|
|
||||
EventProperty_MouseRight,
|
||||
EventPropertyGroup_AnyMouseEvent =
|
||||
EventPropertyGroup_AnyMouseButton|
|
||||
EventProperty_MouseButton|
|
||||
EventProperty_MouseRelease|
|
||||
EventProperty_MouseWheel|
|
||||
EventProperty_MouseMove,
|
||||
EventPropertyGroup_AnyUserInput =
|
||||
|
|
|
@ -1305,9 +1305,7 @@ query_user_general(Application_Links *app, Query_Bar *bar, b32 force_number){
|
|||
// 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, EventPropertyGroup_AnyKeyboardEvent,
|
||||
EventProperty_Escape|
|
||||
EventProperty_MouseLeft|
|
||||
EventProperty_MouseRight);
|
||||
EventProperty_Escape|EventProperty_MouseButton);
|
||||
|
||||
// NOTE(allen|a3.4.4): The responsible thing to do on abort is to end the command
|
||||
// without waiting on get_user_input again.
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
// TOP
|
||||
|
||||
static Lister_Activation_Code
|
||||
activate_jump(Application_Links *app, Heap *heap,
|
||||
View_ID view, struct Lister_State *state,
|
||||
activate_jump(Application_Links *app,
|
||||
View_ID view, Lister *lister,
|
||||
String_Const_u8 text_field, void *user_data, b32 activated_by_mouse){
|
||||
Lister_Activation_Code result_code = ListerActivation_Finished;
|
||||
i32 list_index = (i32)PtrAsInt(user_data);
|
||||
Jump_Lister_Parameters *params = (Jump_Lister_Parameters*)state->lister.data.user_data;
|
||||
Jump_Lister_Parameters *params = (Jump_Lister_Parameters*)lister->data.user_data;
|
||||
Marker_List *list = get_marker_list_for_buffer(params->list_buffer_id);
|
||||
if (list != 0){
|
||||
View_ID target_view = {};
|
||||
|
@ -58,7 +58,7 @@ activate_jump(Application_Links *app, Heap *heap,
|
|||
}
|
||||
|
||||
}
|
||||
lister_default(app, heap, view, state, result_code);
|
||||
lister_default(app, view, lister, result_code);
|
||||
return(result_code);
|
||||
}
|
||||
|
||||
|
@ -91,11 +91,11 @@ open_jump_lister(Application_Links *app, Heap *heap, View_ID ui_view, Buffer_ID
|
|||
jump_lister_params.target_view_id = optional_target_view;
|
||||
}
|
||||
|
||||
begin_integrated_lister__basic_list(app, "Jump:", activate_jump,
|
||||
&jump_lister_params, sizeof(jump_lister_params),
|
||||
options, option_count,
|
||||
estimated_string_space_size,
|
||||
ui_view);
|
||||
run_lister_with_options_array(app, "Jump:", activate_jump,
|
||||
&jump_lister_params, sizeof(jump_lister_params),
|
||||
options, option_count,
|
||||
estimated_string_space_size,
|
||||
ui_view);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,97 +4,23 @@
|
|||
|
||||
// TOP
|
||||
|
||||
static Vec2_f32
|
||||
function Vec2_f32
|
||||
panel_space_from_screen_space(Vec2_f32 p, Vec2_f32 file_region_p0){
|
||||
return(p - file_region_p0);
|
||||
}
|
||||
|
||||
static Vec2_f32
|
||||
function Vec2_f32
|
||||
get_mouse_position_in_panel_space(Mouse_State mouse, Vec2_f32 file_region_p0){
|
||||
return(panel_space_from_screen_space(V2f32(mouse.p), file_region_p0));
|
||||
}
|
||||
|
||||
static Vec2_f32
|
||||
function Vec2_f32
|
||||
get_mouse_position_in_panel_space(Application_Links *app, Vec2_f32 file_region_p0){
|
||||
return(get_mouse_position_in_panel_space(get_mouse_state(app), file_region_p0));
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
#if 0
|
||||
internal void
|
||||
default_ui_render_caller(Application_Links *app, View_ID view_id, Rect_f32 rect, Face_ID face_id){
|
||||
UI_Data *ui_data = 0;
|
||||
Arena *ui_arena = 0;
|
||||
if (view_get_ui_data(app, view_id, ViewGetUIFlag_KeepDataAsIs, &ui_data, &ui_arena)){
|
||||
Basic_Scroll scroll = view_get_basic_scroll(app, view_id);
|
||||
|
||||
for (UI_Item *item = ui_data->list.first;
|
||||
item != 0;
|
||||
item = item->next){
|
||||
Rect_f32 item_rect = Rf32(item->rect_outer);
|
||||
item_rect.p0 += rect.p0;
|
||||
item_rect.p1 += rect.p0;
|
||||
|
||||
switch (item->coordinates){
|
||||
case UICoordinates_ViewSpace:
|
||||
{
|
||||
item_rect.p0 -= scroll.position;
|
||||
item_rect.p1 -= scroll.position;
|
||||
}break;
|
||||
case UICoordinates_PanelSpace:
|
||||
{}break;
|
||||
}
|
||||
|
||||
if (rect_overlap(item_rect, rect)){
|
||||
Rect_f32 inner = rect_inner(item_rect, (f32)item->inner_margin);
|
||||
|
||||
Face_Metrics metrics = get_face_metrics(app, face_id);
|
||||
f32 line_height = metrics.line_height;
|
||||
f32 info_height = (f32)item->line_count*line_height;
|
||||
|
||||
draw_rectangle(app, inner, 0.f, Stag_Back);
|
||||
Vec2_f32 p = V2f32(inner.x0 + 3.f, f32_round32((inner.y0 + inner.y1 - info_height)*0.5f));
|
||||
for (i32 i = 0; i < item->line_count; i += 1){
|
||||
draw_fancy_string(app, face_id, item->lines[i].first, p, Stag_Default, 0, 0, V2(1.f, 0));
|
||||
p.y += line_height;
|
||||
}
|
||||
if (item->inner_margin > 0){
|
||||
draw_margin(app, item_rect, inner, get_margin_color(item->activation_level));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
internal void
|
||||
default_ui_render_caller(Application_Links *app, View_ID view, Rect_f32 rect){
|
||||
Buffer_ID buffer = view_get_buffer(app, view, AccessAll);
|
||||
Face_ID face_id = get_face_id(app, buffer);
|
||||
default_ui_render_caller(app, view, rect, face_id);
|
||||
}
|
||||
#endif
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
Lister_State global_lister_state_[16] = {};
|
||||
Lister_State *global_lister_state = global_lister_state_ - 1;
|
||||
|
||||
static Lister_State*
|
||||
view_get_lister_state(View_ID view){
|
||||
return(&global_lister_state[view]);
|
||||
}
|
||||
|
||||
function void
|
||||
init_lister_state(Application_Links *app, Lister_State *state, Heap *heap){
|
||||
state->initialized = true;
|
||||
state->set_view_vertical_focus_to_item = false;
|
||||
state->highlighted_node = 0;
|
||||
state->hot_user_data = 0;
|
||||
state->item_index = 0;
|
||||
state->filter_restore_point_is_set = false;
|
||||
block_zero_struct(&state->scroll);
|
||||
}
|
||||
|
||||
function f32
|
||||
lister_get_text_field_height(f32 line_height){
|
||||
return(line_height);
|
||||
|
@ -106,43 +32,142 @@ lister_get_block_height(f32 line_height){
|
|||
}
|
||||
|
||||
function Lister_Top_Level_Layout
|
||||
lister_get_top_level_layout(Rect_f32 rect, f32 line_height){
|
||||
f32 text_field_height = lister_get_text_field_height(line_height);
|
||||
lister_get_top_level_layout(Rect_f32 rect, f32 text_field_height){
|
||||
Lister_Top_Level_Layout layout = {};
|
||||
layout.text_field_rect = Rf32(rect.x0, rect.y0,
|
||||
rect.x1, clamp_top(rect.y0 + text_field_height, rect.y1));
|
||||
layout.list_rect = Rf32(rect.x0, layout.text_field_rect.y0, rect.x1, rect.y1);
|
||||
layout.list_rect = Rf32(rect.x0, layout.text_field_rect.y1, rect.x1, rect.y1);
|
||||
return(layout);
|
||||
}
|
||||
|
||||
function void*
|
||||
lister_user_data_at_p(Application_Links *app, View_ID view, Lister_State *state, Vec2_f32 p){
|
||||
Rect_f32 region = view_get_buffer_region(app, view);
|
||||
p -= region.p0;
|
||||
p += state->scroll.position;
|
||||
////////////////////////////////
|
||||
|
||||
Lister *global_lister_state[16] = {};
|
||||
|
||||
function Lister*
|
||||
view_get_lister(View_ID view){
|
||||
return(global_lister_state[view - 1]);
|
||||
}
|
||||
|
||||
function Lister*
|
||||
begin_lister(Application_Links *app, Arena *arena, View_ID view, void *user_data, umem user_data_size){
|
||||
Lister *lister = push_array_zero(arena, Lister, 1);
|
||||
lister->arena = arena;
|
||||
lister->data.query = Su8(lister->data.query_space, 0, sizeof(lister->data.query_space));
|
||||
lister->data.text_field = Su8(lister->data.text_field_space, 0, sizeof(lister->data.text_field_space));
|
||||
lister->data.key_string = Su8(lister->data.key_string_space, 0, sizeof(lister->data.key_string_space));
|
||||
lister->data.user_data_size = user_data_size;
|
||||
if (user_data_size > 0){
|
||||
lister->data.user_data = push_array(lister->arena, u8, user_data_size);
|
||||
if (user_data != 0){
|
||||
block_copy(lister->data.user_data, user_data, user_data_size);
|
||||
}
|
||||
}
|
||||
global_lister_state[view - 1] = lister;
|
||||
lister->restore_all_point = begin_temp(lister->arena);
|
||||
return(lister);
|
||||
}
|
||||
|
||||
function void
|
||||
lister_render(Application_Links *app, View_ID view, Frame_Info frame_info, Rect_f32 inner){
|
||||
Scratch_Block scratch(app);
|
||||
|
||||
Lister *lister = view_get_lister(view);
|
||||
if (lister == 0){
|
||||
return;
|
||||
}
|
||||
|
||||
Basic_Scroll scroll = lister->data.scroll;
|
||||
(void)scroll;
|
||||
Rect_f32 region = view_get_screen_rect(app, view);
|
||||
// TODO(allen): eliminate this. bad bad bad bad :(
|
||||
region = rect_inner(region, 3.f);
|
||||
Mouse_State mouse = get_mouse_state(app);
|
||||
Vec2_f32 m_p = V2f32(mouse.p);
|
||||
|
||||
Face_ID face_id = get_face_id(app, 0);
|
||||
Face_Metrics metrics = get_face_metrics(app, face_id);
|
||||
f32 line_height = metrics.line_height;
|
||||
f32 block_height = lister_get_block_height(line_height);
|
||||
f32 text_field_height = lister_get_text_field_height(line_height);
|
||||
|
||||
Lister_Top_Level_Layout layout = lister_get_top_level_layout(region, line_height);
|
||||
Lister_Top_Level_Layout layout = lister_get_top_level_layout(region, text_field_height);
|
||||
|
||||
void *result = 0;
|
||||
if (rect_contains_point(layout.list_rect, p)){
|
||||
i32 index = (i32)((p.y - layout.list_rect.y0)/block_height);
|
||||
if (0 < index && index < state->filtered.count){
|
||||
Lister_Node *node = state->filtered.node_ptrs[index];
|
||||
result = node->user_data;
|
||||
}
|
||||
{
|
||||
Fancy_String_List text_field = {};
|
||||
push_fancy_string(scratch, &text_field, fancy_id(Stag_Pop1),
|
||||
lister->data.query.string);
|
||||
push_fancy_stringf(scratch, &text_field, fancy_id(Stag_Pop1), " ");
|
||||
push_fancy_string(scratch, &text_field, fancy_id(Stag_Default),
|
||||
lister->data.text_field.string);
|
||||
draw_fancy_string(app, face_id, text_field.first,
|
||||
V2f32(layout.text_field_rect.x0 + 3.f, layout.text_field_rect.y0),
|
||||
Stag_Default, Stag_Back, 0, V2f32(1.f, 0.f));
|
||||
}
|
||||
|
||||
Range_f32 x = rect_range_x(layout.list_rect);
|
||||
f32 y_pos = layout.list_rect.y0;
|
||||
|
||||
i32 count = lister->data.filtered.count;
|
||||
for (i32 i = 0; i < count; i += 1){
|
||||
Lister_Node *node = lister->data.filtered.node_ptrs[i];
|
||||
|
||||
Range_f32 y = If32(y_pos, y_pos + block_height);
|
||||
y_pos = y.max;
|
||||
|
||||
Rect_f32 item_rect = Rf32(x, y);
|
||||
Rect_f32 item_inner = rect_inner(item_rect, 3.f);
|
||||
|
||||
b32 hovered = rect_contains_point(item_rect, m_p);
|
||||
UI_Highlight_Level highlight = UIHighlight_None;
|
||||
if (node == lister->data.highlighted_node){
|
||||
highlight = UIHighlight_Active;
|
||||
}
|
||||
else if (node->user_data == lister->data.hot_user_data){
|
||||
if (hovered){
|
||||
highlight = UIHighlight_Active;
|
||||
}
|
||||
else{
|
||||
highlight = UIHighlight_Hover;
|
||||
}
|
||||
}
|
||||
else if (hovered){
|
||||
highlight = UIHighlight_Hover;
|
||||
}
|
||||
|
||||
draw_rectangle(app, item_rect, 3.f, get_margin_color(highlight));
|
||||
draw_rectangle(app, item_inner, 3.f, Stag_Back);
|
||||
|
||||
Fancy_String_List line = {};
|
||||
push_fancy_string(scratch, &line, fancy_id(Stag_Default), node->string);
|
||||
push_fancy_stringf(scratch, &line, fancy_id(Stag_Default), " ");
|
||||
push_fancy_string(scratch, &line, fancy_id(Stag_Pop2), node->status);
|
||||
|
||||
Vec2_f32 p = V2f32(item_inner.x0 + 3.f, item_inner.y0 + (block_height - line_height)*0.5f);
|
||||
draw_fancy_string(app, face_id, line.first, p, Stag_Default, 0, 0, V2(1.f, 0.f));
|
||||
}
|
||||
}
|
||||
|
||||
function void*
|
||||
lister_get_user_data(Lister *lister, i32 index){
|
||||
void *result = 0;
|
||||
if (0 <= index && index < lister->data.options.count){
|
||||
i32 counter = 0;
|
||||
for (Lister_Node *node = lister->data.options.first;
|
||||
node != 0;
|
||||
node = node->next, counter += 1){
|
||||
if (counter == index){
|
||||
result = node->user_data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
function Lister_Filtered
|
||||
lister_get_filtered(Arena *arena, Lister_State *state){
|
||||
i32 node_count = state->lister.data.options.count;
|
||||
lister_get_filtered(Arena *arena, Lister *lister){
|
||||
i32 node_count = lister->data.options.count;
|
||||
|
||||
Lister_Filtered filtered = {};
|
||||
filtered.exact_matches.node_ptrs = push_array(arena, Lister_Node*, 1);
|
||||
|
@ -151,7 +176,7 @@ lister_get_filtered(Arena *arena, Lister_State *state){
|
|||
|
||||
Temp_Memory_Block temp(arena);
|
||||
|
||||
String_Const_u8 key = state->lister.data.key_string.string;
|
||||
String_Const_u8 key = lister->data.key_string.string;
|
||||
key = push_string_copy(arena, key);
|
||||
string_mod_replace_character(key, '_', '*');
|
||||
string_mod_replace_character(key, ' ', '*');
|
||||
|
@ -163,7 +188,7 @@ lister_get_filtered(Arena *arena, Lister_State *state){
|
|||
string_list_push(&absolutes, &splits);
|
||||
string_list_push(arena, &absolutes, string_u8_litexpr(""));
|
||||
|
||||
for (Lister_Node *node = state->lister.data.options.first;
|
||||
for (Lister_Node *node = lister->data.options.first;
|
||||
node != 0;
|
||||
node = node->next){
|
||||
String_Const_u8 node_string = node->string;
|
||||
|
@ -186,11 +211,11 @@ lister_get_filtered(Arena *arena, Lister_State *state){
|
|||
return(filtered);
|
||||
}
|
||||
|
||||
static void
|
||||
lister_update_filtered_list(Application_Links *app, View_ID view, Lister_State *state){
|
||||
function void
|
||||
lister_update_filtered_list(Application_Links *app, View_ID view, Lister *lister){
|
||||
Scratch_Block scratch(app, Scratch_Share);
|
||||
|
||||
Lister_Filtered filtered = lister_get_filtered(scratch, state);
|
||||
Lister_Filtered filtered = lister_get_filtered(scratch, lister);
|
||||
|
||||
Lister_Node_Ptr_Array node_ptr_arrays[] = {
|
||||
filtered.exact_matches,
|
||||
|
@ -198,14 +223,8 @@ lister_update_filtered_list(Application_Links *app, View_ID view, Lister_State *
|
|||
filtered.substring_matches,
|
||||
};
|
||||
|
||||
Arena *arena = state->lister.arena;
|
||||
if (state->filter_restore_point_is_set){
|
||||
end_temp(state->filter_restore_point);
|
||||
}
|
||||
else{
|
||||
state->filter_restore_point = begin_temp(arena);
|
||||
state->filter_restore_point_is_set = true;
|
||||
}
|
||||
Arena *arena = lister->arena;
|
||||
end_temp(lister->data.filter_restore_point);
|
||||
|
||||
i32 total_count = 0;
|
||||
for (i32 array_index = 0; array_index < ArrayCount(node_ptr_arrays); array_index += 1){
|
||||
|
@ -214,11 +233,11 @@ lister_update_filtered_list(Application_Links *app, View_ID view, Lister_State *
|
|||
}
|
||||
|
||||
Lister_Node **node_ptrs = push_array(arena, Lister_Node*, total_count);
|
||||
state->filtered.node_ptrs = node_ptrs;
|
||||
state->filtered.count = total_count;
|
||||
lister->data.filtered.node_ptrs = node_ptrs;
|
||||
lister->data.filtered.count = total_count;
|
||||
|
||||
state->raw_item_index = -1;
|
||||
state->highlighted_node = 0;
|
||||
lister->data.raw_item_index = -1;
|
||||
lister->data.highlighted_node = 0;
|
||||
|
||||
i32 counter = 0;
|
||||
for (i32 array_index = 0; array_index < ArrayCount(node_ptr_arrays); array_index += 1){
|
||||
|
@ -226,9 +245,9 @@ lister_update_filtered_list(Application_Links *app, View_ID view, Lister_State *
|
|||
for (i32 node_index = 0; node_index < node_ptr_array.count; node_index += 1){
|
||||
Lister_Node *node = node_ptr_array.node_ptrs[node_index];
|
||||
node_ptrs[counter] = node;
|
||||
if (state->item_index == counter){
|
||||
state->highlighted_node = node;
|
||||
state->raw_item_index = node->raw_index;
|
||||
if (lister->data.item_index == counter){
|
||||
lister->data.highlighted_node = node;
|
||||
lister->data.raw_item_index = node->raw_index;
|
||||
}
|
||||
counter += 1;
|
||||
}
|
||||
|
@ -236,15 +255,50 @@ lister_update_filtered_list(Application_Links *app, View_ID view, Lister_State *
|
|||
}
|
||||
|
||||
function void
|
||||
lister_render(Application_Links *app, View_ID view, Frame_Info frame_info, Rect_f32 inner){
|
||||
Scratch_Block scratch(app);
|
||||
|
||||
Lister_State *state = view_get_lister_state(view);
|
||||
|
||||
Basic_Scroll scroll = state->scroll;
|
||||
Rect_f32 region = view_get_buffer_region(app, view);
|
||||
Vec2_f32 view_m = get_mouse_position_in_panel_space(app, region.p0);
|
||||
view_m += scroll.position;
|
||||
lister_call_refresh_handler(Application_Links *app, View_ID view, Lister *lister){
|
||||
if (lister->data.handlers.refresh != 0){
|
||||
lister->data.handlers.refresh(app, lister);
|
||||
lister->data.filter_restore_point = begin_temp(lister->arena);
|
||||
lister_update_filtered_list(app, view, lister);
|
||||
}
|
||||
}
|
||||
|
||||
function void
|
||||
lister_default(Application_Links *app, View_ID view, Lister *lister, Lister_Activation_Code code){
|
||||
switch (code){
|
||||
case ListerActivation_Finished:
|
||||
{}break;
|
||||
|
||||
case ListerActivation_Continue:
|
||||
{}break;
|
||||
|
||||
case ListerActivation_ContinueAndRefresh:
|
||||
{
|
||||
lister->data.item_index = 0;
|
||||
lister_call_refresh_handler(app, view, lister);
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
function Lister_Activation_Code
|
||||
lister_call_activate_handler(Application_Links *app, View_ID view, Lister *lister,
|
||||
void *user_data, b32 activated_by_mouse){
|
||||
Lister_Activation_Code result = ListerActivation_Finished;
|
||||
if (lister->data.handlers.activate != 0){
|
||||
result = lister->data.handlers.activate(app, view, lister, lister->data.text_field.string,
|
||||
user_data, activated_by_mouse);
|
||||
}
|
||||
else{
|
||||
lister_default(app, view, lister, ListerActivation_Finished);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
function void*
|
||||
lister_user_data_at_p(Application_Links *app, View_ID view, Lister *lister, Vec2_f32 m_p){
|
||||
Rect_f32 region = view_get_screen_rect(app, view);
|
||||
// TODO(allen): eliminate this. bad bad bad bad :(
|
||||
region = rect_inner(region, 3.f);
|
||||
|
||||
Face_ID face_id = get_face_id(app, 0);
|
||||
Face_Metrics metrics = get_face_metrics(app, face_id);
|
||||
|
@ -252,190 +306,192 @@ lister_render(Application_Links *app, View_ID view, Frame_Info frame_info, Rect_
|
|||
f32 block_height = lister_get_block_height(line_height);
|
||||
f32 text_field_height = lister_get_text_field_height(line_height);
|
||||
|
||||
Range_f32 x = rect_range_x(region);
|
||||
f32 y_pos = region.y0;
|
||||
Lister_Top_Level_Layout layout = lister_get_top_level_layout(region, text_field_height);
|
||||
|
||||
{
|
||||
Fancy_String_List text_field = {};
|
||||
push_fancy_string(scratch, &text_field, fancy_id(Stag_Pop1),
|
||||
state->lister.data.query.string);
|
||||
push_fancy_stringf(scratch, &text_field, fancy_id(Stag_Pop1), " ");
|
||||
push_fancy_string(scratch, &text_field, fancy_id(Stag_Default),
|
||||
state->lister.data.text_field.string);
|
||||
draw_fancy_string(app, face_id, text_field.first, V2f32(x.min, y_pos),
|
||||
Stag_Default, Stag_Back, 0, V2f32(1.f, 0.f));
|
||||
y_pos += text_field_height;
|
||||
}
|
||||
|
||||
i32 count = state->filtered.count;
|
||||
for (i32 i = 0; i < count; i += 1){
|
||||
Lister_Node *node = state->filtered.node_ptrs[i];
|
||||
(void)node;
|
||||
|
||||
Range_f32 y = If32(y_pos, y_pos + block_height);
|
||||
y_pos = y.max;
|
||||
|
||||
Rect_f32 item_rect = Rf32(x, y);
|
||||
Rect_f32 item_inner = rect_inner(item_rect, 3.f);
|
||||
|
||||
UI_Highlight_Level highlight = UIHighlight_None;
|
||||
draw_rectangle(app, item_rect, 3.f, get_margin_color(highlight));
|
||||
draw_rectangle(app, item_inner, 3.f, Stag_Back);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
i32 item_index_counter = 0;
|
||||
for (i32 array_index = 0; array_index < ArrayCount(node_ptr_arrays); array_index += 1){
|
||||
Lister_Node_Ptr_Array node_ptr_array = node_ptr_arrays[array_index];
|
||||
for (i32 node_index = 0; node_index < node_ptr_array.count; node_index += 1){
|
||||
Lister_Node *node = node_ptr_array.node_ptrs[node_index];
|
||||
|
||||
Rect_f32 item_rect = Rf32(x0, y_pos, x1, y_pos + block_height);
|
||||
y_pos = item_rect.y1;
|
||||
|
||||
UI_Item item = {};
|
||||
item.activation_level = UIActivation_None;
|
||||
item.coordinates = UICoordinates_ViewSpace;
|
||||
item.rect_outer = Ri32(item_rect);
|
||||
item.inner_margin = 3;
|
||||
|
||||
if (!is_theme_list){
|
||||
Fancy_String_List list = {};
|
||||
push_fancy_string (ui_arena, &list, fancy_id(Stag_Default), node->string);
|
||||
push_fancy_stringf(ui_arena, &list, fancy_id(Stag_Default), " ");
|
||||
push_fancy_string (ui_arena, &list, fancy_id(Stag_Pop2 ), node->status);
|
||||
item.lines[0] = list;
|
||||
item.line_count = 1;
|
||||
}
|
||||
else{
|
||||
//i32 style_index = node->index;
|
||||
|
||||
String_Const_u8 name = string_u8_litexpr("name");
|
||||
item.lines[0] = fancy_string_list_single(push_fancy_string(ui_arena, fancy_id(Stag_Default), name));
|
||||
|
||||
Fancy_String_List list = {};
|
||||
push_fancy_stringf(ui_arena, &list, fancy_id(Stag_Keyword ), "if ");
|
||||
push_fancy_stringf(ui_arena, &list, fancy_id(Stag_Default ), "(x < ");
|
||||
push_fancy_stringf(ui_arena, &list, fancy_id(Stag_Int_Constant), "0");
|
||||
push_fancy_stringf(ui_arena, &list, fancy_id(Stag_Default ), ") { x = ");
|
||||
push_fancy_stringf(ui_arena, &list, fancy_id(Stag_Int_Constant), "0");
|
||||
push_fancy_stringf(ui_arena, &list, fancy_id(Stag_Default ), "; } ");
|
||||
push_fancy_stringf(ui_arena, &list, fancy_id(Stag_Comment ), "// comment");
|
||||
item.lines[1] = list;
|
||||
|
||||
item.line_count = 2;
|
||||
}
|
||||
|
||||
item.user_data = node->user_data;
|
||||
|
||||
UI_Item *item_ptr = ui_list_add_item(ui_arena, &ui_data->list, item);
|
||||
if (rect_contains_point(item_rect, view_m)){
|
||||
hovered_item = item_ptr;
|
||||
}
|
||||
if (state->item_index == item_index_counter){
|
||||
highlighted_item = item_ptr;
|
||||
state->raw_item_index = node->raw_index;
|
||||
}
|
||||
item_index_counter += 1;
|
||||
if (node->user_data == state->hot_user_data && hot_item != 0){
|
||||
hot_item = item_ptr;
|
||||
}
|
||||
void *result = 0;
|
||||
if (rect_contains_point(layout.list_rect, m_p)){
|
||||
f32 y = m_p.y - layout.list_rect.y0 + lister->data.scroll.position.y;
|
||||
i32 index = (i32)(y/block_height);
|
||||
if (0 < index && index < lister->data.filtered.count){
|
||||
Lister_Node *node = lister->data.filtered.node_ptrs[index];
|
||||
result = node->user_data;
|
||||
}
|
||||
}
|
||||
state->item_count_after_filter = item_index_counter;
|
||||
|
||||
if (hovered_item != 0){
|
||||
hovered_item->activation_level = UIActivation_Hover;
|
||||
}
|
||||
if (hot_item != 0){
|
||||
if (hot_item == hovered_item){
|
||||
hot_item->activation_level = UIActivation_Active;
|
||||
}
|
||||
else{
|
||||
hot_item->activation_level = UIActivation_Hover;
|
||||
}
|
||||
}
|
||||
if (highlighted_item != 0){
|
||||
highlighted_item->activation_level = UIActivation_Active;
|
||||
}
|
||||
|
||||
if (state->set_view_vertical_focus_to_item){
|
||||
if (highlighted_item != 0){
|
||||
view_set_vertical_focus_basic(app, view,
|
||||
(f32)highlighted_item->rect_outer.y0,
|
||||
(f32)highlighted_item->rect_outer.y1);
|
||||
}
|
||||
state->set_view_vertical_focus_to_item = false;
|
||||
}
|
||||
|
||||
{
|
||||
// TODO(allen): switch to float
|
||||
Rect_i32 item_rect = {};
|
||||
item_rect.x0 = (i32)x0;
|
||||
item_rect.y0 = 0;
|
||||
item_rect.x1 = (i32)x1;
|
||||
item_rect.y1 = item_rect.y0 + (i32)text_field_height;
|
||||
y_pos = (f32)item_rect.y1;
|
||||
|
||||
UI_Item item = {};
|
||||
item.activation_level = UIActivation_Active;
|
||||
item.coordinates = UICoordinates_PanelSpace;
|
||||
item.rect_outer = item_rect;
|
||||
item.inner_margin = 0;
|
||||
{
|
||||
Fancy_String_List list = {};
|
||||
push_fancy_string (ui_arena, &list, fancy_id(Stag_Pop1 ), state->lister.data.query.string);
|
||||
push_fancy_stringf(ui_arena, &list, fancy_id(Stag_Pop1 ), " ");
|
||||
push_fancy_string (ui_arena, &list, fancy_id(Stag_Default), state->lister.data.text_field.string);
|
||||
item.lines[0] = list;
|
||||
item.line_count = 1;
|
||||
}
|
||||
item.user_data = 0;
|
||||
|
||||
|
||||
ui_list_add_item(ui_arena, &ui_data->list, item);
|
||||
}
|
||||
|
||||
ui_data_compute_bounding_boxes(ui_data);
|
||||
#endif
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
static Lister_Prealloced_String
|
||||
function void
|
||||
lister_run(Application_Links *app, View_ID view, Lister *lister){
|
||||
lister->data.filter_restore_point = begin_temp(lister->arena);
|
||||
lister_update_filtered_list(app, view, lister);
|
||||
|
||||
Managed_Scope scope = view_get_managed_scope(app, view);
|
||||
View_Render_Hook **hook = scope_attachment(app, scope, view_render_hook, View_Render_Hook*);
|
||||
*hook = lister_render;
|
||||
|
||||
for (;;){
|
||||
User_Input in = get_user_input(app, EventPropertyGroup_Any, EventProperty_Escape);
|
||||
if (in.abort){
|
||||
break;
|
||||
}
|
||||
|
||||
Lister_Activation_Code result = ListerActivation_Continue;
|
||||
b32 handled = true;
|
||||
switch (in.event.kind){
|
||||
case InputEventKind_TextInsert:
|
||||
{
|
||||
if (lister->data.handlers.write_character != 0){
|
||||
lister->data.handlers.write_character(app);
|
||||
}
|
||||
}break;
|
||||
|
||||
case InputEventKind_KeyStroke:
|
||||
{
|
||||
switch (in.event.key.code){
|
||||
case KeyCode_Return:
|
||||
case KeyCode_Tab:
|
||||
{
|
||||
void *user_data = 0;
|
||||
if (0 <= lister->data.raw_item_index &&
|
||||
lister->data.raw_item_index < lister->data.options.count){
|
||||
user_data = lister_get_user_data(lister, lister->data.raw_item_index);
|
||||
}
|
||||
result = lister_call_activate_handler(app, view, lister,
|
||||
user_data, false);
|
||||
}break;
|
||||
|
||||
case KeyCode_Backspace:
|
||||
{
|
||||
if (lister->data.handlers.backspace != 0){
|
||||
lister->data.handlers.backspace(app);
|
||||
}
|
||||
else if (lister->data.handlers.key_stroke != 0){
|
||||
result = lister->data.handlers.key_stroke(app);
|
||||
}
|
||||
else{
|
||||
handled = false;
|
||||
}
|
||||
}break;
|
||||
|
||||
case KeyCode_Up:
|
||||
{
|
||||
if (lister->data.handlers.navigate_up != 0){
|
||||
lister->data.handlers.navigate_up(app);
|
||||
}
|
||||
else{
|
||||
handled = false;
|
||||
}
|
||||
}break;
|
||||
|
||||
case KeyCode_Down:
|
||||
{
|
||||
if (lister->data.handlers.navigate_down != 0){
|
||||
lister->data.handlers.navigate_down(app);
|
||||
}
|
||||
else{
|
||||
handled = false;
|
||||
}
|
||||
}break;
|
||||
|
||||
default:
|
||||
{
|
||||
if (lister->data.handlers.key_stroke != 0){
|
||||
result = lister->data.handlers.key_stroke(app);
|
||||
}
|
||||
else{
|
||||
handled = false;
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}break;
|
||||
|
||||
case InputEventKind_MouseButton:
|
||||
{
|
||||
switch (in.event.mouse.code){
|
||||
case MouseCode_Left:
|
||||
{
|
||||
Vec2_f32 p = V2f32(in.event.mouse.p);
|
||||
void *clicked = lister_user_data_at_p(app, view, lister, p);
|
||||
lister->data.hot_user_data = clicked;
|
||||
}break;
|
||||
|
||||
default:
|
||||
{
|
||||
handled = false;
|
||||
}break;
|
||||
}
|
||||
}break;
|
||||
|
||||
case InputEventKind_MouseButtonRelease:
|
||||
{
|
||||
switch (in.event.mouse.code){
|
||||
case MouseCode_Left:
|
||||
{
|
||||
if (lister->data.hot_user_data != 0){
|
||||
Vec2_f32 p = V2f32(in.event.mouse.p);
|
||||
void *clicked = lister_user_data_at_p(app, view, lister, p);
|
||||
if (lister->data.hot_user_data == clicked){
|
||||
result = lister_call_activate_handler(app, view, lister,
|
||||
clicked, true);
|
||||
}
|
||||
}
|
||||
lister->data.hot_user_data = 0;
|
||||
}break;
|
||||
|
||||
default:
|
||||
{
|
||||
handled = false;
|
||||
}break;
|
||||
}
|
||||
}break;
|
||||
|
||||
case InputEventKind_MouseWheel:
|
||||
{
|
||||
Mouse_State mouse = get_mouse_state(app);
|
||||
lister->data.scroll.target.y += mouse.wheel;
|
||||
lister_update_filtered_list(app, view, lister);
|
||||
}break;
|
||||
|
||||
case InputEventKind_MouseMove:
|
||||
case InputEventKind_Core:
|
||||
{
|
||||
lister_update_filtered_list(app, view, lister);
|
||||
}break;
|
||||
|
||||
default:
|
||||
{
|
||||
handled = false;
|
||||
}break;
|
||||
}
|
||||
|
||||
if (result == ListerActivation_Finished){
|
||||
break;
|
||||
}
|
||||
if (!handled){
|
||||
leave_command_input_unhandled(app);
|
||||
}
|
||||
}
|
||||
|
||||
hook = scope_attachment(app, scope, view_render_hook, View_Render_Hook*);
|
||||
*hook = 0;
|
||||
}
|
||||
|
||||
function Lister_Prealloced_String
|
||||
lister_prealloced(String_Const_u8 string){
|
||||
Lister_Prealloced_String result = {};
|
||||
result.string = string;
|
||||
return(result);
|
||||
}
|
||||
|
||||
static void
|
||||
lister_first_init(Application_Links *app, Lister *lister, void *user_data, i32 user_data_size){
|
||||
if (lister->arena == 0) {
|
||||
lister->arena = reserve_arena(app, KB(16));
|
||||
}
|
||||
else{
|
||||
linalloc_clear(lister->arena);
|
||||
}
|
||||
block_zero_struct(&lister->data);
|
||||
lister->data.query = Su8(lister->data.query_space, 0, sizeof(lister->data.query_space));
|
||||
lister->data.text_field = Su8(lister->data.text_field_space, 0, sizeof(lister->data.text_field_space));
|
||||
lister->data.key_string = Su8(lister->data.key_string_space, 0, sizeof(lister->data.key_string_space));
|
||||
lister->data.user_data = push_array(lister->arena, char, user_data_size);
|
||||
lister->data.user_data_size = user_data_size;
|
||||
if (user_data != 0){
|
||||
block_copy(lister->data.user_data, user_data, user_data_size);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
function void
|
||||
lister_begin_new_item_set(Application_Links *app, Lister *lister){
|
||||
linalloc_clear(lister->arena);
|
||||
end_temp(lister->restore_all_point);
|
||||
block_zero_struct(&lister->data.options);
|
||||
block_zero_struct(&lister->data.filtered);
|
||||
}
|
||||
|
||||
static void*
|
||||
function void*
|
||||
lister_add_item(Lister *lister, Lister_Prealloced_String string, Lister_Prealloced_String status,
|
||||
void *user_data, umem extra_space){
|
||||
void *base_memory = push_array(lister->arena, u8, sizeof(Lister_Node) + extra_space);
|
||||
|
@ -450,21 +506,21 @@ lister_add_item(Lister *lister, Lister_Prealloced_String string, Lister_Prealloc
|
|||
return(result);
|
||||
}
|
||||
|
||||
static void*
|
||||
function void*
|
||||
lister_add_item(Lister *lister, Lister_Prealloced_String string, String_Const_u8 status,
|
||||
void *user_data, umem extra_space){
|
||||
return(lister_add_item(lister, string, lister_prealloced(push_string_copy(lister->arena, status)),
|
||||
user_data, extra_space));
|
||||
}
|
||||
|
||||
static void*
|
||||
function void*
|
||||
lister_add_item(Lister *lister, String_Const_u8 string, Lister_Prealloced_String status,
|
||||
void *user_data, umem extra_space){
|
||||
return(lister_add_item(lister, lister_prealloced(push_string_copy(lister->arena, string)), status,
|
||||
user_data, extra_space));
|
||||
}
|
||||
|
||||
static void*
|
||||
function void*
|
||||
lister_add_item(Lister *lister, String_Const_u8 string, String_Const_u8 status, void *user_data, umem extra_space){
|
||||
return(lister_add_item(lister,
|
||||
lister_prealloced(push_string_copy(lister->arena, string)),
|
||||
|
@ -472,7 +528,7 @@ lister_add_item(Lister *lister, String_Const_u8 string, String_Const_u8 status,
|
|||
user_data, extra_space));
|
||||
}
|
||||
|
||||
static void*
|
||||
function void*
|
||||
lister_add_theme_item(Lister *lister,
|
||||
Lister_Prealloced_String string, i32 index,
|
||||
void *user_data, i32 extra_space){
|
||||
|
@ -488,178 +544,71 @@ lister_add_theme_item(Lister *lister,
|
|||
return(result);
|
||||
}
|
||||
|
||||
static void*
|
||||
function void*
|
||||
lister_add_theme_item(Lister *lister, String_Const_u8 string, i32 index,
|
||||
void *user_data, i32 extra_space){
|
||||
return(lister_add_theme_item(lister, lister_prealloced(push_string_copy(lister->arena, string)), index,
|
||||
user_data, extra_space));
|
||||
}
|
||||
|
||||
static void*
|
||||
lister_get_user_data(Lister_Data *lister_data, i32 index){
|
||||
void *result = 0;
|
||||
if (0 <= index && index < lister_data->options.count){
|
||||
i32 counter = 0;
|
||||
for (Lister_Node *node = lister_data->options.first;
|
||||
node != 0;
|
||||
node = node->next, counter += 1){
|
||||
if (counter == index){
|
||||
result = node->user_data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
static void
|
||||
lister_call_refresh_handler(Application_Links *app, Lister *lister){
|
||||
if (lister->data.handlers.refresh != 0){
|
||||
lister->data.handlers.refresh(app, lister);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
lister_default(Application_Links *app, Heap *heap, View_ID view, Lister_State *state, Lister_Activation_Code code){
|
||||
switch (code){
|
||||
case ListerActivation_Finished:
|
||||
{
|
||||
|
||||
}break;
|
||||
|
||||
case ListerActivation_Continue:
|
||||
{}break;
|
||||
|
||||
case ListerActivation_ContinueAndRefresh:
|
||||
{
|
||||
state->item_index = 0;
|
||||
lister_call_refresh_handler(app, &state->lister);
|
||||
lister_update_filtered_list(app, view, state);
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
static Lister_Activation_Code
|
||||
lister_call_activate_handler(Application_Links *app, Heap *heap, View_ID view, Lister_State *state, void *user_data, b32 activated_by_mouse){
|
||||
Lister_Activation_Code result = ListerActivation_Finished;
|
||||
Lister_Data *lister = &state->lister.data;
|
||||
if (lister->handlers.activate != 0){
|
||||
result = lister->handlers.activate(app, heap, view, state, lister->text_field.string, user_data, activated_by_mouse);
|
||||
}
|
||||
else{
|
||||
lister_default(app, heap, view, state, ListerActivation_Finished);
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
static void
|
||||
function void
|
||||
lister_set_string(String_Const_u8 string, String_u8 *target){
|
||||
target->size = 0;
|
||||
string_append(target, string);
|
||||
}
|
||||
static void
|
||||
function void
|
||||
lister_append_string(String_Const_u8 string, String_u8 *target){
|
||||
string_append(target, string);
|
||||
}
|
||||
|
||||
static void
|
||||
lister_set_query(Lister_Data *lister, String_Const_u8 string){
|
||||
lister_set_string(string, &lister->query);
|
||||
}
|
||||
static void
|
||||
lister_set_query(Lister_Data *lister, char *string){
|
||||
lister_set_string(SCu8(string), &lister->query);
|
||||
}
|
||||
static void
|
||||
lister_set_text_field(Lister_Data *lister, String_Const_u8 string){
|
||||
lister_set_string(string, &lister->text_field);
|
||||
}
|
||||
static void
|
||||
lister_set_text_field(Lister_Data *lister, char *string){
|
||||
lister_set_string(SCu8(string), &lister->text_field);
|
||||
}
|
||||
static void
|
||||
lister_set_key(Lister_Data *lister, String_Const_u8 string){
|
||||
lister_set_string(string, &lister->key_string);
|
||||
}
|
||||
static void
|
||||
lister_set_key(Lister_Data *lister, char *string){
|
||||
lister_set_string(SCu8(string), &lister->key_string);
|
||||
}
|
||||
|
||||
static void
|
||||
function void
|
||||
lister_set_query(Lister *lister, String_Const_u8 string){
|
||||
lister_set_query(&lister->data, string);
|
||||
lister_set_string(string, &lister->data.query);
|
||||
}
|
||||
static void
|
||||
function void
|
||||
lister_set_query(Lister *lister, char *string){
|
||||
lister_set_query(&lister->data, string);
|
||||
lister_set_string(SCu8(string), &lister->data.query);
|
||||
}
|
||||
static void
|
||||
function void
|
||||
lister_set_text_field(Lister *lister, String_Const_u8 string){
|
||||
lister_set_text_field(&lister->data, string);
|
||||
lister_set_string(string, &lister->data.text_field);
|
||||
}
|
||||
static void
|
||||
function void
|
||||
lister_set_text_field(Lister *lister, char *string){
|
||||
lister_set_text_field(&lister->data, string);
|
||||
lister_set_string(SCu8(string), &lister->data.text_field);
|
||||
}
|
||||
static void
|
||||
function void
|
||||
lister_set_key(Lister *lister, String_Const_u8 string){
|
||||
lister_set_key(&lister->data, string);
|
||||
lister_set_string(string, &lister->data.key_string);
|
||||
}
|
||||
static void
|
||||
function void
|
||||
lister_set_key(Lister *lister, char *string){
|
||||
lister_set_key(&lister->data, string);
|
||||
lister_set_string(SCu8(string), &lister->data.key_string);
|
||||
}
|
||||
|
||||
static void
|
||||
lister_append_query(Lister_Data *lister, String_Const_u8 string){
|
||||
lister_append_string(string, &lister->query);
|
||||
}
|
||||
static void
|
||||
lister_append_query(Lister_Data *lister, char *string){
|
||||
lister_append_string(SCu8(string), &lister->query);
|
||||
}
|
||||
static void
|
||||
lister_append_text_field(Lister_Data *lister, String_Const_u8 string){
|
||||
lister_append_string(string, &lister->text_field);
|
||||
}
|
||||
static void
|
||||
lister_append_text_field(Lister_Data *lister, char *string){
|
||||
lister_append_string(SCu8(string), &lister->text_field);
|
||||
}
|
||||
static void
|
||||
lister_append_key(Lister_Data *lister, String_Const_u8 string){
|
||||
lister_append_string(string, &lister->key_string);
|
||||
}
|
||||
static void
|
||||
lister_append_key(Lister_Data *lister, char *string){
|
||||
lister_append_string(SCu8(string), &lister->key_string);
|
||||
}
|
||||
|
||||
static void
|
||||
function void
|
||||
lister_append_query(Lister *lister, String_Const_u8 string){
|
||||
lister_append_query(&lister->data, string);
|
||||
lister_append_string(string, &lister->data.query);
|
||||
}
|
||||
static void
|
||||
function void
|
||||
lister_append_query(Lister *lister, char *string){
|
||||
lister_append_query(&lister->data, string);
|
||||
lister_append_string(SCu8(string), &lister->data.query);
|
||||
}
|
||||
static void
|
||||
function void
|
||||
lister_append_text_field(Lister *lister, String_Const_u8 string){
|
||||
lister_append_text_field(&lister->data, string);
|
||||
lister_append_string(string, &lister->data.text_field);
|
||||
}
|
||||
static void
|
||||
function void
|
||||
lister_append_text_field(Lister *lister, char *string){
|
||||
lister_append_text_field(&lister->data, string);
|
||||
lister_append_string(SCu8(string), &lister->data.text_field);
|
||||
}
|
||||
static void
|
||||
function void
|
||||
lister_append_key(Lister *lister, String_Const_u8 string){
|
||||
lister_append_key(&lister->data, string);
|
||||
lister_append_string(string, &lister->data.key_string);
|
||||
}
|
||||
static void
|
||||
function void
|
||||
lister_append_key(Lister *lister, char *string){
|
||||
lister_append_key(&lister->data, string);
|
||||
lister_append_string(SCu8(string), &lister->data.key_string);
|
||||
}
|
||||
|
||||
// BOTTOM
|
||||
|
|
|
@ -14,8 +14,8 @@ enum{
|
|||
ListerActivation_ContinueAndRefresh = 2,
|
||||
};
|
||||
|
||||
typedef Lister_Activation_Code Lister_Activation_Type(Application_Links *app, Heap *heap,
|
||||
View_ID view, struct Lister_State *state,
|
||||
typedef Lister_Activation_Code Lister_Activation_Type(Application_Links *app,
|
||||
View_ID view, struct Lister *lister,
|
||||
String_Const_u8 text_field, void *user_data, b32 activated_by_mouse);
|
||||
|
||||
typedef void Lister_Regenerate_List_Function_Type(Application_Links *app, struct Lister *lister);
|
||||
|
@ -32,7 +32,7 @@ struct Lister_Node{
|
|||
i32 raw_index;
|
||||
};
|
||||
|
||||
struct Lister_Option_List{
|
||||
struct Lister_Node_List{
|
||||
Lister_Node *first;
|
||||
Lister_Node *last;
|
||||
i32 count;
|
||||
|
@ -55,39 +55,33 @@ struct Lister_Handlers{
|
|||
Lister_Key_Stroke_Function *key_stroke;
|
||||
};
|
||||
|
||||
struct Lister_Data{
|
||||
// Event Handlers
|
||||
Lister_Handlers handlers;
|
||||
|
||||
// List Data
|
||||
void *user_data;
|
||||
i32 user_data_size;
|
||||
u8 query_space[256];
|
||||
u8 text_field_space[256];
|
||||
u8 key_string_space[256];
|
||||
String_u8 query;
|
||||
String_u8 text_field;
|
||||
String_u8 key_string;
|
||||
Lister_Option_List options;
|
||||
};
|
||||
|
||||
struct Lister{
|
||||
Arena *arena;
|
||||
Lister_Data data;
|
||||
};
|
||||
|
||||
struct Lister_State{
|
||||
b32 initialized;
|
||||
Lister lister;
|
||||
b32 set_view_vertical_focus_to_item;
|
||||
Lister_Node *highlighted_node;
|
||||
void *hot_user_data;
|
||||
i32 item_index;
|
||||
i32 raw_item_index;
|
||||
b32 filter_restore_point_is_set;
|
||||
Temp_Memory filter_restore_point;
|
||||
Lister_Node_Ptr_Array filtered;
|
||||
Basic_Scroll scroll;
|
||||
Temp_Memory restore_all_point;
|
||||
|
||||
struct{
|
||||
Lister_Handlers handlers;
|
||||
|
||||
void *user_data;
|
||||
umem user_data_size;
|
||||
u8 query_space[256];
|
||||
u8 text_field_space[256];
|
||||
u8 key_string_space[256];
|
||||
String_u8 query;
|
||||
String_u8 text_field;
|
||||
String_u8 key_string;
|
||||
Lister_Node_List options;
|
||||
Temp_Memory filter_restore_point;
|
||||
Lister_Node_Ptr_Array filtered;
|
||||
|
||||
b32 set_view_vertical_focus_to_item;
|
||||
Lister_Node *highlighted_node;
|
||||
void *hot_user_data;
|
||||
i32 item_index;
|
||||
i32 raw_item_index;
|
||||
|
||||
Basic_Scroll scroll;
|
||||
} data;
|
||||
};
|
||||
|
||||
struct Lister_Prealloced_String{
|
||||
|
@ -120,12 +114,6 @@ struct Lister_Fixed_Option{
|
|||
void *user_data;
|
||||
};
|
||||
|
||||
struct Lister_UI_Option{
|
||||
char *string;
|
||||
i32 index;
|
||||
void *user_data;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// BOTTOM
|
||||
|
|
|
@ -5,143 +5,135 @@ such as open file, switch buffer, or kill buffer.
|
|||
|
||||
// TOP
|
||||
|
||||
CUSTOM_COMMAND_SIG(lister__write_string__default)
|
||||
CUSTOM_DOC("A lister mode command that inserts a new character to the text field.")
|
||||
{
|
||||
function void
|
||||
lister__write_string__default(Application_Links *app){
|
||||
View_ID view = get_active_view(app, AccessAll);
|
||||
Lister_State *state = view_get_lister_state(view);
|
||||
if (state->initialized){
|
||||
Lister *lister = view_get_lister(view);
|
||||
if (lister != 0){
|
||||
User_Input in = get_command_input(app);
|
||||
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;
|
||||
lister_append_text_field(lister, string);
|
||||
lister_append_key(lister, string);
|
||||
lister->data.item_index = 0;
|
||||
view_zero_scroll(app, view);
|
||||
lister_update_filtered_list(app, view, state);
|
||||
lister_update_filtered_list(app, view, lister);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(lister__backspace_text_field__default)
|
||||
CUSTOM_DOC("A lister mode command that backspaces one character from the text field.")
|
||||
{
|
||||
function void
|
||||
lister__backspace_text_field__default(Application_Links *app){
|
||||
View_ID view = get_active_view(app, AccessAll);
|
||||
Lister_State *state = view_get_lister_state(view);
|
||||
if (state->initialized){
|
||||
state->lister.data.text_field.string = backspace_utf8(state->lister.data.text_field.string);
|
||||
state->lister.data.key_string.string = backspace_utf8(state->lister.data.key_string.string);
|
||||
state->item_index = 0;
|
||||
Lister *lister = view_get_lister(view);
|
||||
if (lister != 0){
|
||||
lister->data.text_field.string = backspace_utf8(lister->data.text_field.string);
|
||||
lister->data.key_string.string = backspace_utf8(lister->data.key_string.string);
|
||||
lister->data.item_index = 0;
|
||||
view_zero_scroll(app, view);
|
||||
lister_update_filtered_list(app, view, state);
|
||||
lister_update_filtered_list(app, view, lister);
|
||||
}
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(lister__move_up__default)
|
||||
CUSTOM_DOC("A lister mode command that moves the highlighted item one up in the list.")
|
||||
{
|
||||
function void
|
||||
lister__move_up__default(Application_Links *app){
|
||||
View_ID view = get_active_view(app, AccessAll);
|
||||
Lister_State *state = view_get_lister_state(view);
|
||||
if (state->initialized){
|
||||
state->item_index = state->item_index - 1;
|
||||
if (state->item_index < 0){
|
||||
state->item_index = state->filtered.count - 1;
|
||||
Lister *lister = view_get_lister(view);
|
||||
if (lister != 0){
|
||||
lister->data.item_index = lister->data.item_index - 1;
|
||||
if (lister->data.item_index < 0){
|
||||
lister->data.item_index = lister->data.filtered.count - 1;
|
||||
}
|
||||
state->set_view_vertical_focus_to_item = true;
|
||||
lister_update_filtered_list(app, view, state);
|
||||
lister->data.set_view_vertical_focus_to_item = true;
|
||||
lister_update_filtered_list(app, view, lister);
|
||||
}
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(lister__move_down__default)
|
||||
CUSTOM_DOC("A lister mode command that moves the highlighted item one down in the list.")
|
||||
{
|
||||
function void
|
||||
lister__move_down__default(Application_Links *app){
|
||||
View_ID view = get_active_view(app, AccessAll);
|
||||
Lister_State *state = view_get_lister_state(view);
|
||||
if (state->initialized){
|
||||
state->item_index = state->item_index + 1;
|
||||
if (state->item_index > state->filtered.count - 1){
|
||||
state->item_index = 0;
|
||||
Lister *lister = view_get_lister(view);
|
||||
if (lister != 0){
|
||||
lister->data.item_index = lister->data.item_index + 1;
|
||||
if (lister->data.item_index > lister->data.filtered.count - 1){
|
||||
lister->data.item_index = 0;
|
||||
}
|
||||
state->set_view_vertical_focus_to_item = true;
|
||||
lister_update_filtered_list(app, view, state);
|
||||
lister->data.set_view_vertical_focus_to_item = true;
|
||||
lister_update_filtered_list(app, view, lister);
|
||||
}
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(lister__write_character__file_path)
|
||||
CUSTOM_DOC("A lister mode command that inserts a character into the text field of a file system list.")
|
||||
{
|
||||
function void
|
||||
lister__write_character__file_path(Application_Links *app){
|
||||
View_ID view = get_active_view(app, AccessAll);
|
||||
Lister_State *state = view_get_lister_state(view);
|
||||
if (state->initialized){
|
||||
Lister *lister = view_get_lister(view);
|
||||
if (lister != 0){
|
||||
User_Input in = get_command_input(app);
|
||||
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);
|
||||
lister_append_text_field(lister, string);
|
||||
String_Const_u8 front_name = string_front_of_path(lister->data.text_field.string);
|
||||
lister_set_key(lister, front_name);
|
||||
if (character_is_slash(string.str[0])){
|
||||
String_Const_u8 new_hot = state->lister.data.text_field.string;
|
||||
String_Const_u8 new_hot = lister->data.text_field.string;
|
||||
set_hot_directory(app, new_hot);
|
||||
lister_call_refresh_handler(app, &state->lister);
|
||||
lister_call_refresh_handler(app, view, lister);
|
||||
}
|
||||
state->item_index = 0;
|
||||
lister->data.item_index = 0;
|
||||
view_zero_scroll(app, view);
|
||||
lister_update_filtered_list(app, view, state);
|
||||
lister_update_filtered_list(app, view, lister);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(lister__backspace_text_field__file_path)
|
||||
CUSTOM_DOC("A lister mode command that backspaces one character from the text field of a file system list.")
|
||||
{
|
||||
function void
|
||||
lister__backspace_text_field__file_path(Application_Links *app){
|
||||
View_ID view = get_active_view(app, AccessAll);
|
||||
Lister_State *state = view_get_lister_state(view);
|
||||
if (state->initialized){
|
||||
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);
|
||||
Lister *lister = view_get_lister(view);
|
||||
if (lister != 0){
|
||||
if (lister->data.text_field.size > 0){
|
||||
char last_char = lister->data.text_field.str[lister->data.text_field.size - 1];
|
||||
lister->data.text_field.string = backspace_utf8(lister->data.text_field.string);
|
||||
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 text_field = lister->data.text_field.string;
|
||||
String_Const_u8 new_hot = string_remove_last_folder(text_field);
|
||||
b32 is_modified = has_modifier(&input, KeyCode_Control);
|
||||
b32 whole_word_backspace = (is_modified == global_config.lister_whole_word_backspace_when_modified);
|
||||
if (whole_word_backspace){
|
||||
state->lister.data.text_field.size = new_hot.size;
|
||||
lister->data.text_field.size = new_hot.size;
|
||||
}
|
||||
set_hot_directory(app, new_hot);
|
||||
// TODO(allen): We have to protect against lister_call_refresh_handler changing
|
||||
// the text_field here. Clean this up.
|
||||
String_u8 dingus = state->lister.data.text_field;
|
||||
lister_call_refresh_handler(app, &state->lister);
|
||||
state->lister.data.text_field = dingus;
|
||||
String_u8 dingus = lister->data.text_field;
|
||||
lister_call_refresh_handler(app, view, lister);
|
||||
lister->data.text_field = dingus;
|
||||
}
|
||||
else{
|
||||
String_Const_u8 text_field = state->lister.data.text_field.string;
|
||||
String_Const_u8 text_field = lister->data.text_field.string;
|
||||
String_Const_u8 new_key = string_front_of_path(text_field);
|
||||
lister_set_key(&state->lister, new_key);
|
||||
lister_set_key(lister, new_key);
|
||||
}
|
||||
|
||||
state->item_index = 0;
|
||||
lister->data.item_index = 0;
|
||||
view_zero_scroll(app, view);
|
||||
lister_update_filtered_list(app, view, state);
|
||||
lister_update_filtered_list(app, view, lister);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Lister_Activation_Code
|
||||
lister__key_stroke__fixed_list(Application_Links *app)
|
||||
{
|
||||
lister__key_stroke__fixed_list(Application_Links *app){
|
||||
Lister_Activation_Code result = ListerActivation_Continue;
|
||||
Heap *heap = &global_heap;
|
||||
View_ID view = get_active_view(app, AccessAll);
|
||||
Lister_State *state = view_get_lister_state(view);
|
||||
if (state->initialized){
|
||||
Lister *lister = view_get_lister(view);
|
||||
if (lister != 0){
|
||||
User_Input in = get_command_input(app);
|
||||
if (in.event.kind == InputEventKind_KeyStroke){
|
||||
void *user_data = 0;
|
||||
b32 did_shortcut_key = false;
|
||||
for (Lister_Node *node = state->lister.data.options.first;
|
||||
for (Lister_Node *node = lister->data.options.first;
|
||||
node != 0;
|
||||
node = node->next){
|
||||
Key_Code *key_code = (Key_Code*)(node + 1);
|
||||
|
@ -152,7 +144,7 @@ lister__key_stroke__fixed_list(Application_Links *app)
|
|||
}
|
||||
}
|
||||
if (did_shortcut_key){
|
||||
result = lister_call_activate_handler(app, heap, view, state, user_data, false);
|
||||
result = lister_call_activate_handler(app, view, lister, user_data, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,170 +153,7 @@ lister__key_stroke__fixed_list(Application_Links *app)
|
|||
|
||||
////////////////////////////////
|
||||
|
||||
function void
|
||||
lister_input_handling_loop(Application_Links *app, View_ID view){
|
||||
Heap *heap = &global_heap;
|
||||
Lister_State *state = view_get_lister_state(view);
|
||||
|
||||
Managed_Scope scope = view_get_managed_scope(app, view);
|
||||
View_Render_Hook **hook = scope_attachment(app, scope, view_render_hook, View_Render_Hook*);
|
||||
*hook = lister_render;
|
||||
|
||||
for (;;){
|
||||
User_Input in = get_user_input(app,
|
||||
EventPropertyGroup_Any,
|
||||
EventProperty_Escape);
|
||||
if (in.abort){
|
||||
break;
|
||||
}
|
||||
|
||||
Lister_Activation_Code result = ListerActivation_Continue;
|
||||
b32 handled = true;
|
||||
switch (in.event.kind){
|
||||
case InputEventKind_TextInsert:
|
||||
{
|
||||
if (state->lister.data.handlers.write_character != 0){
|
||||
state->lister.data.handlers.write_character(app);
|
||||
}
|
||||
}break;
|
||||
|
||||
case InputEventKind_KeyStroke:
|
||||
{
|
||||
switch (in.event.key.code){
|
||||
case KeyCode_Return:
|
||||
case KeyCode_Tab:
|
||||
{
|
||||
void *user_data = 0;
|
||||
if (0 <= state->raw_item_index &&
|
||||
state->raw_item_index < state->lister.data.options.count){
|
||||
user_data = lister_get_user_data(&state->lister.data,
|
||||
state->raw_item_index);
|
||||
}
|
||||
result = lister_call_activate_handler(app, heap, view, state,
|
||||
user_data, false);
|
||||
}break;
|
||||
|
||||
case KeyCode_Backspace:
|
||||
{
|
||||
if (state->lister.data.handlers.backspace != 0){
|
||||
state->lister.data.handlers.backspace(app);
|
||||
}
|
||||
else if (state->lister.data.handlers.key_stroke != 0){
|
||||
result = state->lister.data.handlers.key_stroke(app);
|
||||
}
|
||||
else{
|
||||
handled = false;
|
||||
}
|
||||
}break;
|
||||
|
||||
case KeyCode_Up:
|
||||
{
|
||||
if (state->lister.data.handlers.navigate_up != 0){
|
||||
state->lister.data.handlers.navigate_up(app);
|
||||
}
|
||||
else{
|
||||
handled = false;
|
||||
}
|
||||
}break;
|
||||
|
||||
case KeyCode_Down:
|
||||
{
|
||||
if (state->lister.data.handlers.navigate_down != 0){
|
||||
state->lister.data.handlers.navigate_down(app);
|
||||
}
|
||||
else{
|
||||
handled = false;
|
||||
}
|
||||
}break;
|
||||
|
||||
default:
|
||||
{
|
||||
if (state->lister.data.handlers.key_stroke != 0){
|
||||
result = state->lister.data.handlers.key_stroke(app);
|
||||
}
|
||||
else{
|
||||
handled = false;
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}break;
|
||||
|
||||
case InputEventKind_MouseButton:
|
||||
{
|
||||
switch (in.event.mouse.code){
|
||||
case MouseCode_Left:
|
||||
{
|
||||
Vec2_f32 p = V2f32(in.event.mouse.p);
|
||||
void *clicked = lister_user_data_at_p(app, view, state, p);
|
||||
state->hot_user_data = clicked;
|
||||
}break;
|
||||
|
||||
default:
|
||||
{
|
||||
handled = false;
|
||||
}break;
|
||||
}
|
||||
}break;
|
||||
|
||||
case InputEventKind_MouseButtonRelease:
|
||||
{
|
||||
switch (in.event.mouse.code){
|
||||
case MouseCode_Left:
|
||||
{
|
||||
if (state->hot_user_data != 0){
|
||||
Vec2_f32 p = V2f32(in.event.mouse.p);
|
||||
void *clicked = lister_user_data_at_p(app, view, state, p);
|
||||
if (state->hot_user_data == clicked){
|
||||
result = lister_call_activate_handler(app, heap, view, state,
|
||||
clicked, true);
|
||||
}
|
||||
}
|
||||
state->hot_user_data = 0;
|
||||
}break;
|
||||
|
||||
default:
|
||||
{
|
||||
handled = false;
|
||||
}break;
|
||||
}
|
||||
}break;
|
||||
|
||||
case InputEventKind_MouseWheel:
|
||||
{
|
||||
Mouse_State mouse = get_mouse_state(app);
|
||||
state->scroll.target.y += mouse.wheel;
|
||||
if (state->initialized){
|
||||
lister_update_filtered_list(app, view, state);
|
||||
}
|
||||
}break;
|
||||
|
||||
case InputEventKind_MouseMove:
|
||||
case InputEventKind_Core:
|
||||
{
|
||||
lister_update_filtered_list(app, view, state);
|
||||
}break;
|
||||
|
||||
default:
|
||||
{
|
||||
handled = false;
|
||||
}break;
|
||||
}
|
||||
|
||||
if (result == ListerActivation_Finished){
|
||||
break;
|
||||
}
|
||||
if (!handled){
|
||||
leave_command_input_unhandled(app);
|
||||
}
|
||||
}
|
||||
|
||||
hook = scope_attachment(app, scope, view_render_hook, View_Render_Hook*);
|
||||
*hook = 0;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
static Lister_Handlers
|
||||
function Lister_Handlers
|
||||
lister_get_default_handlers(void){
|
||||
Lister_Handlers handlers = {};
|
||||
handlers.write_character = lister__write_string__default;
|
||||
|
@ -334,7 +163,7 @@ lister_get_default_handlers(void){
|
|||
return(handlers);
|
||||
}
|
||||
|
||||
static Lister_Handlers
|
||||
function Lister_Handlers
|
||||
lister_get_fixed_list_handlers(void){
|
||||
Lister_Handlers handlers = {};
|
||||
handlers.navigate_up = lister__move_up__default;
|
||||
|
@ -343,25 +172,18 @@ lister_get_fixed_list_handlers(void){
|
|||
return(handlers);
|
||||
}
|
||||
|
||||
static void
|
||||
begin_integrated_lister__with_refresh_handler(Application_Links *app, char *query_string,
|
||||
Lister_Handlers handlers,
|
||||
void *user_data, i32 user_data_size,
|
||||
View_ID view){
|
||||
function void
|
||||
run_lister_with_refresh_handler(Application_Links *app, char *query_string,
|
||||
Lister_Handlers handlers,
|
||||
void *user_data, i32 user_data_size,
|
||||
View_ID view){
|
||||
if (handlers.refresh != 0){
|
||||
Heap *heap = &global_heap;
|
||||
Lister_State *state = view_get_lister_state(view);
|
||||
init_lister_state(app, state, heap);
|
||||
lister_first_init(app, &state->lister, user_data, user_data_size);
|
||||
lister_set_query(&state->lister, query_string);
|
||||
state->lister.data.handlers = handlers;
|
||||
handlers.refresh(app, &state->lister);
|
||||
lister_update_filtered_list(app, view, state);
|
||||
|
||||
lister_input_handling_loop(app, view);
|
||||
state->initialized = false;
|
||||
linalloc_clear(state->lister.arena);
|
||||
|
||||
Scratch_Block scratch(app);
|
||||
Lister *lister = begin_lister(app, scratch, view, user_data, user_data_size);
|
||||
lister_set_query(lister, query_string);
|
||||
lister->data.handlers = handlers;
|
||||
handlers.refresh(app, lister);
|
||||
lister_run(app, view, lister);
|
||||
}
|
||||
else{
|
||||
Scratch_Block scratch(app);
|
||||
|
@ -374,131 +196,73 @@ begin_integrated_lister__with_refresh_handler(Application_Links *app, char *quer
|
|||
}
|
||||
}
|
||||
|
||||
static const i32 default_string_size_estimation = 0;
|
||||
global_const i32 default_string_size_estimation = 0;
|
||||
|
||||
static i32
|
||||
function i32
|
||||
lister__get_arena_size_(i32 option_count, i32 user_data_size,
|
||||
i32 estimated_string_space_size){
|
||||
i32 arena_size = (user_data_size + 7 + option_count*sizeof(Lister_Node) + estimated_string_space_size);
|
||||
return(arena_size);
|
||||
}
|
||||
|
||||
static void
|
||||
begin_integrated_lister__basic_list(Application_Links *app, char *query_string,
|
||||
Lister_Activation_Type *activate,
|
||||
void *user_data, i32 user_data_size,
|
||||
Lister_Option *options, i32 option_count,
|
||||
i32 estimated_string_space_size,
|
||||
View_ID view){
|
||||
Heap *heap = &global_heap;
|
||||
Lister_State *state = view_get_lister_state(view);
|
||||
init_lister_state(app, state, heap);
|
||||
lister_first_init(app, &state->lister, user_data, user_data_size);
|
||||
function void
|
||||
run_lister_with_options_array(Application_Links *app, char *query_string,
|
||||
Lister_Activation_Type *activate,
|
||||
void *user_data, i32 user_data_size,
|
||||
Lister_Option *options, i32 option_count,
|
||||
i32 estimated_string_space_size,
|
||||
View_ID view){
|
||||
Scratch_Block scratch(app);
|
||||
Lister *lister = begin_lister(app, scratch, view, user_data, user_data_size);
|
||||
for (i32 i = 0; i < option_count; i += 1){
|
||||
lister_add_item(&state->lister, options[i].string, options[i].status, options[i].user_data, 0);
|
||||
lister_add_item(lister, options[i].string, options[i].status, options[i].user_data, 0);
|
||||
}
|
||||
lister_set_query(&state->lister, query_string);
|
||||
state->lister.data.handlers = lister_get_default_handlers();
|
||||
state->lister.data.handlers.activate = activate;
|
||||
lister_update_filtered_list(app, view, state);
|
||||
|
||||
lister_input_handling_loop(app, view);
|
||||
state->initialized = false;
|
||||
linalloc_clear(state->lister.arena);
|
||||
lister_set_query(lister, query_string);
|
||||
lister->data.handlers = lister_get_default_handlers();
|
||||
lister->data.handlers.activate = activate;
|
||||
lister_run(app, view, lister);
|
||||
}
|
||||
|
||||
static void
|
||||
begin_integrated_lister__with_fixed_options(Application_Links *app, char *query_string,
|
||||
Lister_Handlers handlers,
|
||||
void *user_data, i32 user_data_size,
|
||||
Lister_Fixed_Option *options, i32 option_count,
|
||||
i32 estimated_string_space_size,
|
||||
View_ID view){
|
||||
Heap *heap = &global_heap;
|
||||
Lister_State *state = view_get_lister_state(view);
|
||||
init_lister_state(app, state, heap);
|
||||
lister_first_init(app, &state->lister, user_data, user_data_size);
|
||||
function void
|
||||
run_lister_with_fixed_options(Application_Links *app, char *query_string,
|
||||
Lister_Handlers handlers,
|
||||
void *user_data, i32 user_data_size,
|
||||
Lister_Fixed_Option *options, i32 option_count,
|
||||
i32 estimated_string_space_size,
|
||||
View_ID view){
|
||||
Scratch_Block scratch(app);
|
||||
Lister *lister = begin_lister(app, scratch, view, user_data, user_data_size);
|
||||
for (i32 i = 0; i < option_count; i += 1){
|
||||
Key_Code code = options[i].key_code;
|
||||
void *extra = lister_add_item(&state->lister,
|
||||
SCu8(options[i].string),
|
||||
SCu8(options[i].status),
|
||||
options[i].user_data,
|
||||
sizeof(code));
|
||||
void *extra = lister_add_item(lister, SCu8(options[i].string), SCu8(options[i].status),
|
||||
options[i].user_data, sizeof(code));
|
||||
block_copy(extra, &code, sizeof(code));
|
||||
}
|
||||
lister_set_query(&state->lister, query_string);
|
||||
state->lister.data.handlers = handlers;
|
||||
state->lister.data.handlers.refresh = 0;
|
||||
lister_update_filtered_list(app, view, state);
|
||||
|
||||
lister_input_handling_loop(app, view);
|
||||
state->initialized = false;
|
||||
linalloc_clear(state->lister.arena);
|
||||
lister_set_query(lister, query_string);
|
||||
lister->data.handlers = handlers;
|
||||
lister->data.handlers.refresh = 0;
|
||||
lister_run(app, view, lister);
|
||||
}
|
||||
|
||||
static void
|
||||
begin_integrated_lister__with_fixed_options(Application_Links *app, char *query_string,
|
||||
Lister_Activation_Type *activate,
|
||||
void *user_data, i32 user_data_size,
|
||||
Lister_Fixed_Option *options, i32 option_count,
|
||||
i32 estimated_string_space_size,
|
||||
View_ID view){
|
||||
function void
|
||||
run_lister_with_fixed_options(Application_Links *app, char *query_string,
|
||||
Lister_Activation_Type *activate,
|
||||
void *user_data, i32 user_data_size,
|
||||
Lister_Fixed_Option *options, i32 option_count,
|
||||
i32 estimated_string_space_size,
|
||||
View_ID view){
|
||||
Lister_Handlers handlers = lister_get_fixed_list_handlers();
|
||||
handlers.activate = activate;
|
||||
begin_integrated_lister__with_fixed_options(app, query_string,
|
||||
handlers, user_data, user_data_size,
|
||||
options, option_count,
|
||||
estimated_string_space_size,
|
||||
view);
|
||||
}
|
||||
|
||||
static void
|
||||
begin_integrated_lister__theme_list(Application_Links *app, char *query_string,
|
||||
Lister_Handlers handlers,
|
||||
void *user_data, i32 user_data_size,
|
||||
Lister_UI_Option *options, i32 option_count,
|
||||
i32 estimated_string_space_size,
|
||||
View_ID view){
|
||||
Heap *heap = &global_heap;
|
||||
Lister_State *state = view_get_lister_state(view);
|
||||
init_lister_state(app, state, heap);
|
||||
lister_first_init(app, &state->lister, user_data, user_data_size);
|
||||
for (i32 i = 0; i < option_count; i += 1){
|
||||
lister_add_theme_item(&state->lister,
|
||||
SCu8(options[i].string),
|
||||
options[i].index,
|
||||
options[i].user_data, 0);
|
||||
}
|
||||
lister_set_query(&state->lister, query_string);
|
||||
state->lister.data.handlers = handlers;
|
||||
state->lister.data.handlers.refresh = 0;
|
||||
lister_update_filtered_list(app, view, state);
|
||||
|
||||
lister_input_handling_loop(app, view);
|
||||
state->initialized = false;
|
||||
linalloc_clear(state->lister.arena);
|
||||
}
|
||||
|
||||
static void
|
||||
begin_integrated_lister__theme_list(Application_Links *app, char *query_string,
|
||||
Lister_Activation_Type *activate,
|
||||
void *user_data, i32 user_data_size,
|
||||
Lister_UI_Option *options, i32 option_count,
|
||||
i32 estimated_string_space_size,
|
||||
View_ID view){
|
||||
Lister_Handlers handlers = lister_get_default_handlers();
|
||||
handlers.activate = activate;
|
||||
begin_integrated_lister__theme_list(app, query_string,
|
||||
handlers, user_data, user_data_size,
|
||||
options, option_count,
|
||||
estimated_string_space_size,
|
||||
view);
|
||||
run_lister_with_fixed_options(app, query_string,
|
||||
handlers, user_data, user_data_size,
|
||||
options, option_count,
|
||||
estimated_string_space_size,
|
||||
view);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
static void
|
||||
function void
|
||||
generate_all_buffers_list__output_buffer(Application_Links *app, Lister *lister, Buffer_ID buffer){
|
||||
Dirty_State dirty = buffer_get_dirty_state(app, buffer);
|
||||
String_Const_u8 status = {};
|
||||
|
@ -512,7 +276,7 @@ generate_all_buffers_list__output_buffer(Application_Links *app, Lister *lister,
|
|||
lister_add_item(lister, buffer_name, status, IntAsPtr(buffer), 0);
|
||||
}
|
||||
|
||||
static void
|
||||
function void
|
||||
generate_all_buffers_list(Application_Links *app, Lister *lister){
|
||||
lister_begin_new_item_set(app, lister);
|
||||
|
||||
|
@ -573,7 +337,7 @@ generate_all_buffers_list(Application_Links *app, Lister *lister){
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
function void
|
||||
generate_hot_directory_file_list(Application_Links *app, Lister *lister){
|
||||
Scratch_Block scratch(app);
|
||||
|
||||
|
@ -641,24 +405,24 @@ generate_hot_directory_file_list(Application_Links *app, Lister *lister){
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
begin_integrated_lister__buffer_list(Application_Links *app, char *query_string, Lister_Activation_Type *activate_procedure,
|
||||
void *user_data, i32 user_data_size, View_ID target_view){
|
||||
function void
|
||||
run_lister_buffer_list(Application_Links *app, char *query_string, Lister_Activation_Type *activate_procedure,
|
||||
void *user_data, i32 user_data_size, View_ID target_view){
|
||||
Lister_Handlers handlers = lister_get_default_handlers();
|
||||
handlers.activate = activate_procedure;
|
||||
handlers.refresh = generate_all_buffers_list;
|
||||
begin_integrated_lister__with_refresh_handler(app, query_string, handlers, user_data, user_data_size, target_view);
|
||||
run_lister_with_refresh_handler(app, query_string, handlers, user_data, user_data_size, target_view);
|
||||
}
|
||||
|
||||
static void
|
||||
begin_integrated_lister__file_system_list(Application_Links *app, char *query_string, Lister_Activation_Type *activate_procedure,
|
||||
void *user_data, i32 user_data_size, View_ID target_view){
|
||||
function void
|
||||
run_lister_file_system_list(Application_Links *app, char *query_string, Lister_Activation_Type *activate_procedure,
|
||||
void *user_data, i32 user_data_size, View_ID target_view){
|
||||
Lister_Handlers handlers = lister_get_default_handlers();
|
||||
handlers.activate = activate_procedure;
|
||||
handlers.refresh = generate_hot_directory_file_list;
|
||||
handlers.write_character = lister__write_character__file_path;
|
||||
handlers.backspace = lister__backspace_text_field__file_path;
|
||||
begin_integrated_lister__with_refresh_handler(app, query_string, handlers, user_data, user_data_size, target_view);
|
||||
run_lister_with_refresh_handler(app, query_string, handlers, user_data, user_data_size, target_view);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
@ -670,10 +434,11 @@ enum{
|
|||
SureToKill_Save = 3,
|
||||
};
|
||||
|
||||
static Lister_Activation_Code
|
||||
activate_confirm_kill(Application_Links *app, Heap *heap, View_ID view, Lister_State *state, String_Const_u8 text_field, void *user_data, b32 clicked){
|
||||
function Lister_Activation_Code
|
||||
activate_confirm_kill(Application_Links *app, View_ID view, Lister *lister,
|
||||
String_Const_u8 text_field, void *user_data, b32 clicked){
|
||||
i32 behavior = (i32)PtrAsInt(user_data);
|
||||
Buffer_ID buffer_id = *(Buffer_ID*)(state->lister.data.user_data);
|
||||
Buffer_ID buffer_id = *(Buffer_ID*)(lister->data.user_data);
|
||||
switch (behavior){
|
||||
case SureToKill_No:
|
||||
{}break;
|
||||
|
@ -697,11 +462,11 @@ activate_confirm_kill(Application_Links *app, Heap *heap, View_ID view, Lister_S
|
|||
}
|
||||
}break;
|
||||
}
|
||||
lister_default(app, heap, view, state, ListerActivation_Finished);
|
||||
lister_default(app, view, lister, ListerActivation_Finished);
|
||||
return(ListerActivation_Finished);
|
||||
}
|
||||
|
||||
static void
|
||||
function void
|
||||
do_gui_sure_to_kill(Application_Links *app, Buffer_ID buffer, View_ID view){
|
||||
Lister_Fixed_Option options[] = {
|
||||
{"(N)o" , "", KeyCode_N, IntAsPtr(SureToKill_No) },
|
||||
|
@ -709,15 +474,15 @@ do_gui_sure_to_kill(Application_Links *app, Buffer_ID buffer, View_ID view){
|
|||
{"(S)ave and Kill", "", KeyCode_S, IntAsPtr(SureToKill_Save)},
|
||||
};
|
||||
i32 option_count = sizeof(options)/sizeof(options[0]);
|
||||
begin_integrated_lister__with_fixed_options(app, "There are unsaved changes, close anyway?",
|
||||
activate_confirm_kill, &buffer, sizeof(buffer),
|
||||
options, option_count, default_string_size_estimation,
|
||||
view);
|
||||
run_lister_with_fixed_options(app, "There are unsaved changes, close anyway?",
|
||||
activate_confirm_kill, &buffer, sizeof(buffer),
|
||||
options, option_count, default_string_size_estimation,
|
||||
view);
|
||||
}
|
||||
|
||||
static Lister_Activation_Code
|
||||
activate_confirm_close_4coder(Application_Links *app, Heap *heap,
|
||||
View_ID view, Lister_State *state,
|
||||
function Lister_Activation_Code
|
||||
activate_confirm_close_4coder(Application_Links *app,
|
||||
View_ID view, Lister *lister,
|
||||
String_Const_u8 text_field, void *user_data, b32 clicked){
|
||||
i32 behavior = (i32)PtrAsInt(user_data);
|
||||
switch (behavior){
|
||||
|
@ -737,11 +502,11 @@ activate_confirm_close_4coder(Application_Links *app, Heap *heap,
|
|||
send_exit_signal(app);
|
||||
}break;
|
||||
}
|
||||
lister_default(app, heap, view, state, ListerActivation_Finished);
|
||||
lister_default(app, view, lister, ListerActivation_Finished);
|
||||
return(ListerActivation_Finished);
|
||||
}
|
||||
|
||||
static void
|
||||
function void
|
||||
do_gui_sure_to_close_4coder(Application_Links *app, View_ID view){
|
||||
Lister_Fixed_Option options[] = {
|
||||
{"(N)o" , "", KeyCode_N, (void*)SureToKill_No },
|
||||
|
@ -749,23 +514,23 @@ do_gui_sure_to_close_4coder(Application_Links *app, View_ID view){
|
|||
{"(S)ave All and Close", "", KeyCode_S, (void*)SureToKill_Save},
|
||||
};
|
||||
i32 option_count = sizeof(options)/sizeof(options[0]);
|
||||
begin_integrated_lister__with_fixed_options(app, "There are one or more buffers with unsave changes, close anyway?",
|
||||
activate_confirm_close_4coder, 0, 0,
|
||||
options, option_count, default_string_size_estimation,
|
||||
view);
|
||||
run_lister_with_fixed_options(app, "There are one or more buffers with unsave changes, close anyway?",
|
||||
activate_confirm_close_4coder, 0, 0,
|
||||
options, option_count, default_string_size_estimation,
|
||||
view);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
static Lister_Activation_Code
|
||||
activate_switch_buffer(Application_Links *app, Heap *heap,
|
||||
View_ID view, Lister_State *state,
|
||||
function Lister_Activation_Code
|
||||
activate_switch_buffer(Application_Links *app,
|
||||
View_ID view, Lister *lister,
|
||||
String_Const_u8 text_field, void *user_data, b32 activated_by_mouse){
|
||||
if (user_data != 0){
|
||||
Buffer_ID buffer_id = (Buffer_ID)(PtrAsInt(user_data));
|
||||
view_set_buffer(app, view, buffer_id, SetBuffer_KeepOriginalGUI);
|
||||
}
|
||||
lister_default(app, heap, view, state, ListerActivation_Finished);
|
||||
lister_default(app, view, lister, ListerActivation_Finished);
|
||||
return(ListerActivation_Finished);
|
||||
}
|
||||
|
||||
|
@ -773,14 +538,14 @@ CUSTOM_COMMAND_SIG(interactive_switch_buffer)
|
|||
CUSTOM_DOC("Interactively switch to an open buffer.")
|
||||
{
|
||||
View_ID view = get_active_view(app, AccessAll);
|
||||
begin_integrated_lister__buffer_list(app, "Switch:", activate_switch_buffer, 0, 0, view);
|
||||
run_lister_buffer_list(app, "Switch:", activate_switch_buffer, 0, 0, view);
|
||||
}
|
||||
|
||||
static Lister_Activation_Code
|
||||
activate_kill_buffer(Application_Links *app, Heap *heap,
|
||||
View_ID view, struct Lister_State *state,
|
||||
function Lister_Activation_Code
|
||||
activate_kill_buffer(Application_Links *app,
|
||||
View_ID view, Lister *lister,
|
||||
String_Const_u8 text_field, void *user_data, b32 activated_by_mouse){
|
||||
lister_default(app, heap, view, state, ListerActivation_Finished);
|
||||
lister_default(app, view, lister, ListerActivation_Finished);
|
||||
if (user_data != 0){
|
||||
Buffer_ID buffer = (Buffer_ID)(PtrAsInt(user_data));
|
||||
try_buffer_kill(app, buffer, view, 0);
|
||||
|
@ -792,10 +557,10 @@ CUSTOM_COMMAND_SIG(interactive_kill_buffer)
|
|||
CUSTOM_DOC("Interactively kill an open buffer.")
|
||||
{
|
||||
View_ID view = get_active_view(app, AccessAll);
|
||||
begin_integrated_lister__buffer_list(app, "Kill:", activate_kill_buffer, 0, 0, view);
|
||||
run_lister_buffer_list(app, "Kill:", activate_kill_buffer, 0, 0, view);
|
||||
}
|
||||
|
||||
static Lister_Activation_Code
|
||||
function Lister_Activation_Code
|
||||
activate_open_or_new__generic(Application_Links *app, View_ID view,
|
||||
String_Const_u8 path, String_Const_u8 file_name, b32 is_folder,
|
||||
Buffer_Create_Flag flags){
|
||||
|
@ -830,9 +595,9 @@ activate_open_or_new__generic(Application_Links *app, View_ID view,
|
|||
return(result);
|
||||
}
|
||||
|
||||
static Lister_Activation_Code
|
||||
activate_open_or_new(Application_Links *app, Heap *heap,
|
||||
View_ID view, struct Lister_State *state,
|
||||
function Lister_Activation_Code
|
||||
activate_open_or_new(Application_Links *app,
|
||||
View_ID view, Lister *lister,
|
||||
String_Const_u8 text_field, void *user_data, b32 clicked){
|
||||
Lister_Activation_Code result = 0;
|
||||
String_Const_u8 file_name = {};
|
||||
|
@ -846,7 +611,7 @@ activate_open_or_new(Application_Links *app, Heap *heap,
|
|||
result = ListerActivation_Finished;
|
||||
}
|
||||
else{
|
||||
String_Const_u8 path = state->lister.data.text_field.string;
|
||||
String_Const_u8 path = lister->data.text_field.string;
|
||||
if (!character_is_slash(string_get_character(path, path.size - 1))){
|
||||
path = string_remove_last_folder(path);
|
||||
}
|
||||
|
@ -855,7 +620,7 @@ activate_open_or_new(Application_Links *app, Heap *heap,
|
|||
Buffer_Create_Flag flags = 0;
|
||||
result = activate_open_or_new__generic(app, view, path, file_name, is_folder, flags);
|
||||
}
|
||||
lister_default(app, heap, view, state, result);
|
||||
lister_default(app, view, lister, result);
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
@ -863,12 +628,12 @@ CUSTOM_COMMAND_SIG(interactive_open_or_new)
|
|||
CUSTOM_DOC("Interactively open a file out of the file system.")
|
||||
{
|
||||
View_ID view = get_active_view(app, AccessAll);
|
||||
begin_integrated_lister__file_system_list(app, "Open:", activate_open_or_new, 0, 0, view);
|
||||
run_lister_file_system_list(app, "Open:", activate_open_or_new, 0, 0, view);
|
||||
}
|
||||
|
||||
static Lister_Activation_Code
|
||||
activate_new(Application_Links *app, Heap *heap,
|
||||
View_ID view, struct Lister_State *state,
|
||||
function Lister_Activation_Code
|
||||
activate_new(Application_Links *app,
|
||||
View_ID view, Lister *lister,
|
||||
String_Const_u8 text_field, void *user_data, b32 clicked){
|
||||
Lister_Activation_Code result = 0;
|
||||
String_Const_u8 file_name = string_front_of_path(text_field);
|
||||
|
@ -885,7 +650,7 @@ activate_new(Application_Links *app, Heap *heap,
|
|||
result = ListerActivation_Finished;
|
||||
}
|
||||
else{
|
||||
String_Const_u8 path = state->lister.data.text_field.string;
|
||||
String_Const_u8 path = lister->data.text_field.string;
|
||||
if (character_is_slash(string_get_character(path, path.size - 1))){
|
||||
path = string_remove_last_folder(path);
|
||||
}
|
||||
|
@ -894,7 +659,7 @@ activate_new(Application_Links *app, Heap *heap,
|
|||
Buffer_Create_Flag flags = BufferCreate_AlwaysNew;
|
||||
result = activate_open_or_new__generic(app, view, path, file_name, is_folder, flags);
|
||||
}
|
||||
lister_default(app, heap, view, state, result);
|
||||
lister_default(app, view, lister, result);
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
@ -902,12 +667,12 @@ CUSTOM_COMMAND_SIG(interactive_new)
|
|||
CUSTOM_DOC("Interactively creates a new file.")
|
||||
{
|
||||
View_ID view = get_active_view(app, AccessAll);
|
||||
begin_integrated_lister__file_system_list(app, "New:", activate_new, 0, 0, view);
|
||||
run_lister_file_system_list(app, "New:", activate_new, 0, 0, view);
|
||||
}
|
||||
|
||||
static Lister_Activation_Code
|
||||
activate_open(Application_Links *app, Heap *heap,
|
||||
View_ID view, struct Lister_State *state,
|
||||
function Lister_Activation_Code
|
||||
activate_open(Application_Links *app,
|
||||
View_ID view, Lister *lister,
|
||||
String_Const_u8 text_field, void *user_data, b32 clicked){
|
||||
Lister_Activation_Code result = 0;
|
||||
String_Const_u8 file_name = {};
|
||||
|
@ -918,7 +683,7 @@ activate_open(Application_Links *app, Heap *heap,
|
|||
result = ListerActivation_Finished;
|
||||
}
|
||||
else{
|
||||
String_Const_u8 path = state->lister.data.text_field.string;
|
||||
String_Const_u8 path = lister->data.text_field.string;
|
||||
if (!character_is_slash(string_get_character(path, path.size - 1))){
|
||||
path = string_remove_last_folder(path);
|
||||
}
|
||||
|
@ -927,7 +692,7 @@ activate_open(Application_Links *app, Heap *heap,
|
|||
Buffer_Create_Flag flags = BufferCreate_NeverNew;
|
||||
result = activate_open_or_new__generic(app, view, path, file_name, is_folder, flags);
|
||||
}
|
||||
lister_default(app, heap, view, state, result);
|
||||
lister_default(app, view, lister, result);
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
@ -935,52 +700,33 @@ CUSTOM_COMMAND_SIG(interactive_open)
|
|||
CUSTOM_DOC("Interactively opens a file.")
|
||||
{
|
||||
View_ID view = get_active_view(app, AccessAll);
|
||||
begin_integrated_lister__file_system_list(app, "Open:", activate_open, 0, 0, view);
|
||||
run_lister_file_system_list(app, "Open:", activate_open, 0, 0, view);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
activate_select_theme(Application_Links *app, Partition *scratch, Heap *heap,
|
||||
View_ID view, struct Lister_State *state,
|
||||
String_Const_u8 text_field, void *user_data, b32 clicked){
|
||||
function Lister_Activation_Code
|
||||
activate_select_theme(Application_Links *app,
|
||||
View_ID view, struct Lister *lister,
|
||||
String_Const_u8 text_field, void *user_data, b32 activated_by_mouse){
|
||||
change_theme_by_index(app, (i32)PtrAsInt(user_data));
|
||||
lister_default(app, scratch, heap, view, state, ListerActivation_Finished);
|
||||
lister_default(app, scratch, view, state, ListerActivation_Finished);
|
||||
return(ListerActivation_Finished);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(open_color_tweaker)
|
||||
CUSTOM_DOC("Opens the 4coder theme selector list.")
|
||||
{
|
||||
Partition *scratch = &global_part;
|
||||
Temp_Memory temp = begin_temp_memory(scratch);
|
||||
|
||||
View_ID view = get_active_view(app, AccessAll);
|
||||
view_end_ui_mode(app, view);
|
||||
i32 theme_count = get_theme_count(app);
|
||||
Lister_UI_Option *options = push_array(scratch, Lister_UI_Option, theme_count);
|
||||
for (i32 i = 0; i < theme_count; i += 1){
|
||||
String name = get_theme_name(app, scratch, i);
|
||||
options[i].string = name.str;
|
||||
options[i].index = i;
|
||||
options[i].user_data = IntAsPtr(i);
|
||||
}
|
||||
begin_integrated_lister__theme_list(app,
|
||||
"Select a theme:",
|
||||
activate_select_theme, 0, 0,
|
||||
options, theme_count,
|
||||
default_string_size_estimation,
|
||||
view);
|
||||
|
||||
end_temp_memory(temp);
|
||||
}
|
||||
#endif
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
static Lister_Activation_Code
|
||||
activate_command(Application_Links *app, Heap *heap,
|
||||
View_ID view, Lister_State *state,
|
||||
function Lister_Activation_Code
|
||||
activate_command(Application_Links *app,
|
||||
View_ID view, Lister *lister,
|
||||
String_Const_u8 text_field, void *user_data, b32 activated_by_mouse){
|
||||
lister_default(app, heap, view, state, ListerActivation_Finished);
|
||||
lister_default(app, view, lister, ListerActivation_Finished);
|
||||
if (user_data != 0){
|
||||
Custom_Command_Function *command = (Custom_Command_Function*)user_data;
|
||||
command(app);
|
||||
|
@ -988,7 +734,7 @@ activate_command(Application_Links *app, Heap *heap,
|
|||
return(ListerActivation_Finished);
|
||||
}
|
||||
|
||||
static void
|
||||
function void
|
||||
launch_custom_command_lister(Application_Links *app, i32 *command_ids, i32 command_id_count){
|
||||
if (command_ids == 0){
|
||||
command_id_count = command_one_past_last_id;
|
||||
|
@ -1007,7 +753,7 @@ launch_custom_command_lister(Application_Links *app, i32 *command_ids, i32 comma
|
|||
options[i].status = SCu8(fcoder_metacmd_table[j].description);
|
||||
options[i].user_data = (void*)fcoder_metacmd_table[j].proc;
|
||||
}
|
||||
begin_integrated_lister__basic_list(app, "Command:", activate_command, 0, 0, options, command_id_count, 0, view);
|
||||
run_lister_with_options_array(app, "Command:", activate_command, 0, 0, options, command_id_count, 0, view);
|
||||
}
|
||||
|
||||
CUSTOM_COMMAND_SIG(command_lister)
|
||||
|
|
|
@ -1328,10 +1328,10 @@ CUSTOM_DOC("Queries the user for several configuration options and initializes a
|
|||
///////////////////////////////
|
||||
|
||||
static Lister_Activation_Code
|
||||
activate_project_command(Application_Links *app, Heap *heap, View_ID view, Lister_State *state, String_Const_u8 text_field, void *user_data, b32 activated_by_mouse){
|
||||
activate_project_command(Application_Links *app, View_ID view, Lister *lister, String_Const_u8 text_field, void *user_data, b32 activated_by_mouse){
|
||||
i32 command_index = (i32)PtrAsInt(user_data);
|
||||
exec_project_command_by_index(app, command_index);
|
||||
lister_default(app, heap, view, state, ListerActivation_Finished);
|
||||
lister_default(app, view, lister, ListerActivation_Finished);
|
||||
return(ListerActivation_Finished);
|
||||
}
|
||||
|
||||
|
@ -1351,7 +1351,7 @@ CUSTOM_DOC("Open a lister of all commands in the currently loaded project.")
|
|||
options[i].status = push_string_copy(scratch, current_project.command_array.commands[i].cmd);
|
||||
options[i].user_data = IntAsPtr(i);
|
||||
}
|
||||
begin_integrated_lister__basic_list(app, "Command:", activate_project_command, 0, 0, options, option_count, 0, view);
|
||||
run_lister_with_options_array(app, "Command:", activate_project_command, 0, 0, options, option_count, 0, view);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define command_id(c) (fcoder_metacmd_ID_##c)
|
||||
#define command_metadata(c) (&fcoder_metacmd_table[command_id(c)])
|
||||
#define command_metadata_by_id(id) (&fcoder_metacmd_table[id])
|
||||
#define command_one_past_last_id 208
|
||||
#define command_one_past_last_id 202
|
||||
#if defined(CUSTOM_COMMAND_SIG)
|
||||
#define PROC_LINKS(x,y) x
|
||||
#else
|
||||
|
@ -126,12 +126,6 @@ CUSTOM_COMMAND_SIG(redo);
|
|||
CUSTOM_COMMAND_SIG(undo_all_buffers);
|
||||
CUSTOM_COMMAND_SIG(redo_all_buffers);
|
||||
CUSTOM_COMMAND_SIG(open_in_other);
|
||||
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);
|
||||
CUSTOM_COMMAND_SIG(lister__write_character__file_path);
|
||||
CUSTOM_COMMAND_SIG(lister__backspace_text_field__file_path);
|
||||
CUSTOM_COMMAND_SIG(interactive_switch_buffer);
|
||||
CUSTOM_COMMAND_SIG(interactive_kill_buffer);
|
||||
CUSTOM_COMMAND_SIG(interactive_open_or_new);
|
||||
|
@ -228,14 +222,14 @@ char *source_name;
|
|||
i32 source_name_len;
|
||||
i32 line_number;
|
||||
};
|
||||
static Command_Metadata fcoder_metacmd_table[208] = {
|
||||
static Command_Metadata fcoder_metacmd_table[202] = {
|
||||
{ PROC_LINKS(default_view_input_handler, 0), "default_view_input_handler", 26, "Input consumption loop for base view behavior", 45, "w:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 17 },
|
||||
{ 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, 1978 },
|
||||
{ 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, 1984 },
|
||||
{ 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, 1990 },
|
||||
{ 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, 1996 },
|
||||
{ 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, 2002 },
|
||||
{ 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, 2010 },
|
||||
{ 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, 1976 },
|
||||
{ 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, 1982 },
|
||||
{ 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, 1988 },
|
||||
{ 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, 1994 },
|
||||
{ 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, 2000 },
|
||||
{ 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, 2008 },
|
||||
{ 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 },
|
||||
|
@ -322,42 +316,36 @@ static Command_Metadata fcoder_metacmd_table[208] = {
|
|||
{ 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, 1059 },
|
||||
{ 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, 1068 },
|
||||
{ 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, 1077 },
|
||||
{ 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, 1169 },
|
||||
{ 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, 1190 },
|
||||
{ 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, 1206 },
|
||||
{ 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, 1241 },
|
||||
{ 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, 1266 },
|
||||
{ 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, 1310 },
|
||||
{ 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, 1343 },
|
||||
{ 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, 1381 },
|
||||
{ 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, 1415 },
|
||||
{ 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, 1421 },
|
||||
{ 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, 1427 },
|
||||
{ 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, 1441 },
|
||||
{ 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, 1506 },
|
||||
{ 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, 1538 },
|
||||
{ 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, 1551 },
|
||||
{ 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, 1563 },
|
||||
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1597 },
|
||||
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1605 },
|
||||
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1615 },
|
||||
{ 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, 1844 },
|
||||
{ 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, 1857 },
|
||||
{ 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, 1871 },
|
||||
{ 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, 1942 },
|
||||
{ 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, 2043 },
|
||||
{ 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, 8 },
|
||||
{ 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, 26 },
|
||||
{ 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, 40 },
|
||||
{ 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, 55 },
|
||||
{ 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, 70 },
|
||||
{ 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, 94 },
|
||||
{ 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, 772 },
|
||||
{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 791 },
|
||||
{ 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, 862 },
|
||||
{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 901 },
|
||||
{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 934 },
|
||||
{ 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, 1013 },
|
||||
{ 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, 1167 },
|
||||
{ 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, 1188 },
|
||||
{ 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, 1204 },
|
||||
{ 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, 1239 },
|
||||
{ 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, 1264 },
|
||||
{ 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, 1308 },
|
||||
{ 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, 1341 },
|
||||
{ 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, 1379 },
|
||||
{ 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, 1413 },
|
||||
{ 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, 1419 },
|
||||
{ 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, 1425 },
|
||||
{ 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, 1439 },
|
||||
{ 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, 1504 },
|
||||
{ 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, 1536 },
|
||||
{ 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, 1549 },
|
||||
{ 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, 1561 },
|
||||
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1595 },
|
||||
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1603 },
|
||||
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1613 },
|
||||
{ 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, 1842 },
|
||||
{ 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, 1855 },
|
||||
{ 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, 1869 },
|
||||
{ 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, 1940 },
|
||||
{ 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, 2041 },
|
||||
{ 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, 537 },
|
||||
{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 556 },
|
||||
{ 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, 627 },
|
||||
{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 666 },
|
||||
{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 699 },
|
||||
{ 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, 759 },
|
||||
{ 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, 356 },
|
||||
{ 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, 365 },
|
||||
{ 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, 375 },
|
||||
|
@ -555,95 +543,89 @@ static i32 fcoder_metacmd_ID_redo = 113;
|
|||
static i32 fcoder_metacmd_ID_undo_all_buffers = 114;
|
||||
static i32 fcoder_metacmd_ID_redo_all_buffers = 115;
|
||||
static i32 fcoder_metacmd_ID_open_in_other = 116;
|
||||
static i32 fcoder_metacmd_ID_lister__write_string__default = 117;
|
||||
static i32 fcoder_metacmd_ID_lister__backspace_text_field__default = 118;
|
||||
static i32 fcoder_metacmd_ID_lister__move_up__default = 119;
|
||||
static i32 fcoder_metacmd_ID_lister__move_down__default = 120;
|
||||
static i32 fcoder_metacmd_ID_lister__write_character__file_path = 121;
|
||||
static i32 fcoder_metacmd_ID_lister__backspace_text_field__file_path = 122;
|
||||
static i32 fcoder_metacmd_ID_interactive_switch_buffer = 123;
|
||||
static i32 fcoder_metacmd_ID_interactive_kill_buffer = 124;
|
||||
static i32 fcoder_metacmd_ID_interactive_open_or_new = 125;
|
||||
static i32 fcoder_metacmd_ID_interactive_new = 126;
|
||||
static i32 fcoder_metacmd_ID_interactive_open = 127;
|
||||
static i32 fcoder_metacmd_ID_command_lister = 128;
|
||||
static i32 fcoder_metacmd_ID_auto_indent_whole_file = 129;
|
||||
static i32 fcoder_metacmd_ID_auto_indent_line_at_cursor = 130;
|
||||
static i32 fcoder_metacmd_ID_auto_indent_range = 131;
|
||||
static i32 fcoder_metacmd_ID_write_text_and_auto_indent = 132;
|
||||
static i32 fcoder_metacmd_ID_list_all_locations = 133;
|
||||
static i32 fcoder_metacmd_ID_list_all_substring_locations = 134;
|
||||
static i32 fcoder_metacmd_ID_list_all_locations_case_insensitive = 135;
|
||||
static i32 fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 136;
|
||||
static i32 fcoder_metacmd_ID_list_all_locations_of_identifier = 137;
|
||||
static i32 fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 138;
|
||||
static i32 fcoder_metacmd_ID_list_all_locations_of_selection = 139;
|
||||
static i32 fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 140;
|
||||
static i32 fcoder_metacmd_ID_list_all_locations_of_type_definition = 141;
|
||||
static i32 fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 142;
|
||||
static i32 fcoder_metacmd_ID_word_complete = 143;
|
||||
static i32 fcoder_metacmd_ID_goto_jump_at_cursor = 144;
|
||||
static i32 fcoder_metacmd_ID_goto_jump_at_cursor_same_panel = 145;
|
||||
static i32 fcoder_metacmd_ID_goto_next_jump = 146;
|
||||
static i32 fcoder_metacmd_ID_goto_prev_jump = 147;
|
||||
static i32 fcoder_metacmd_ID_goto_next_jump_no_skips = 148;
|
||||
static i32 fcoder_metacmd_ID_goto_prev_jump_no_skips = 149;
|
||||
static i32 fcoder_metacmd_ID_goto_first_jump = 150;
|
||||
static i32 fcoder_metacmd_ID_goto_first_jump_same_panel_sticky = 151;
|
||||
static i32 fcoder_metacmd_ID_if_read_only_goto_position = 152;
|
||||
static i32 fcoder_metacmd_ID_if_read_only_goto_position_same_panel = 153;
|
||||
static i32 fcoder_metacmd_ID_view_jump_list_with_lister = 154;
|
||||
static i32 fcoder_metacmd_ID_show_the_log_graph = 155;
|
||||
static i32 fcoder_metacmd_ID_copy = 156;
|
||||
static i32 fcoder_metacmd_ID_cut = 157;
|
||||
static i32 fcoder_metacmd_ID_paste = 158;
|
||||
static i32 fcoder_metacmd_ID_paste_next = 159;
|
||||
static i32 fcoder_metacmd_ID_paste_and_indent = 160;
|
||||
static i32 fcoder_metacmd_ID_paste_next_and_indent = 161;
|
||||
static i32 fcoder_metacmd_ID_execute_previous_cli = 162;
|
||||
static i32 fcoder_metacmd_ID_execute_any_cli = 163;
|
||||
static i32 fcoder_metacmd_ID_build_search = 164;
|
||||
static i32 fcoder_metacmd_ID_build_in_build_panel = 165;
|
||||
static i32 fcoder_metacmd_ID_close_build_panel = 166;
|
||||
static i32 fcoder_metacmd_ID_change_to_build_panel = 167;
|
||||
static i32 fcoder_metacmd_ID_close_all_code = 168;
|
||||
static i32 fcoder_metacmd_ID_open_all_code = 169;
|
||||
static i32 fcoder_metacmd_ID_open_all_code_recursive = 170;
|
||||
static i32 fcoder_metacmd_ID_load_project = 171;
|
||||
static i32 fcoder_metacmd_ID_project_fkey_command = 172;
|
||||
static i32 fcoder_metacmd_ID_project_go_to_root_directory = 173;
|
||||
static i32 fcoder_metacmd_ID_setup_new_project = 174;
|
||||
static i32 fcoder_metacmd_ID_setup_build_bat = 175;
|
||||
static i32 fcoder_metacmd_ID_setup_build_sh = 176;
|
||||
static i32 fcoder_metacmd_ID_setup_build_bat_and_sh = 177;
|
||||
static i32 fcoder_metacmd_ID_project_command_lister = 178;
|
||||
static i32 fcoder_metacmd_ID_list_all_functions_current_buffer = 179;
|
||||
static i32 fcoder_metacmd_ID_list_all_functions_current_buffer_lister = 180;
|
||||
static i32 fcoder_metacmd_ID_list_all_functions_all_buffers = 181;
|
||||
static i32 fcoder_metacmd_ID_list_all_functions_all_buffers_lister = 182;
|
||||
static i32 fcoder_metacmd_ID_select_surrounding_scope = 183;
|
||||
static i32 fcoder_metacmd_ID_select_next_scope_absolute = 184;
|
||||
static i32 fcoder_metacmd_ID_select_next_scope_after_current = 185;
|
||||
static i32 fcoder_metacmd_ID_select_prev_scope_absolute = 186;
|
||||
static i32 fcoder_metacmd_ID_place_in_scope = 187;
|
||||
static i32 fcoder_metacmd_ID_delete_current_scope = 188;
|
||||
static i32 fcoder_metacmd_ID_open_long_braces = 189;
|
||||
static i32 fcoder_metacmd_ID_open_long_braces_semicolon = 190;
|
||||
static i32 fcoder_metacmd_ID_open_long_braces_break = 191;
|
||||
static i32 fcoder_metacmd_ID_if0_off = 192;
|
||||
static i32 fcoder_metacmd_ID_write_todo = 193;
|
||||
static i32 fcoder_metacmd_ID_write_hack = 194;
|
||||
static i32 fcoder_metacmd_ID_write_note = 195;
|
||||
static i32 fcoder_metacmd_ID_write_block = 196;
|
||||
static i32 fcoder_metacmd_ID_write_zero_struct = 197;
|
||||
static i32 fcoder_metacmd_ID_comment_line = 198;
|
||||
static i32 fcoder_metacmd_ID_uncomment_line = 199;
|
||||
static i32 fcoder_metacmd_ID_comment_line_toggle = 200;
|
||||
static i32 fcoder_metacmd_ID_snippet_lister = 201;
|
||||
static i32 fcoder_metacmd_ID_miblo_increment_basic = 202;
|
||||
static i32 fcoder_metacmd_ID_miblo_decrement_basic = 203;
|
||||
static i32 fcoder_metacmd_ID_miblo_increment_time_stamp = 204;
|
||||
static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp = 205;
|
||||
static i32 fcoder_metacmd_ID_miblo_increment_time_stamp_minute = 206;
|
||||
static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp_minute = 207;
|
||||
static i32 fcoder_metacmd_ID_interactive_switch_buffer = 117;
|
||||
static i32 fcoder_metacmd_ID_interactive_kill_buffer = 118;
|
||||
static i32 fcoder_metacmd_ID_interactive_open_or_new = 119;
|
||||
static i32 fcoder_metacmd_ID_interactive_new = 120;
|
||||
static i32 fcoder_metacmd_ID_interactive_open = 121;
|
||||
static i32 fcoder_metacmd_ID_command_lister = 122;
|
||||
static i32 fcoder_metacmd_ID_auto_indent_whole_file = 123;
|
||||
static i32 fcoder_metacmd_ID_auto_indent_line_at_cursor = 124;
|
||||
static i32 fcoder_metacmd_ID_auto_indent_range = 125;
|
||||
static i32 fcoder_metacmd_ID_write_text_and_auto_indent = 126;
|
||||
static i32 fcoder_metacmd_ID_list_all_locations = 127;
|
||||
static i32 fcoder_metacmd_ID_list_all_substring_locations = 128;
|
||||
static i32 fcoder_metacmd_ID_list_all_locations_case_insensitive = 129;
|
||||
static i32 fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 130;
|
||||
static i32 fcoder_metacmd_ID_list_all_locations_of_identifier = 131;
|
||||
static i32 fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 132;
|
||||
static i32 fcoder_metacmd_ID_list_all_locations_of_selection = 133;
|
||||
static i32 fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 134;
|
||||
static i32 fcoder_metacmd_ID_list_all_locations_of_type_definition = 135;
|
||||
static i32 fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 136;
|
||||
static i32 fcoder_metacmd_ID_word_complete = 137;
|
||||
static i32 fcoder_metacmd_ID_goto_jump_at_cursor = 138;
|
||||
static i32 fcoder_metacmd_ID_goto_jump_at_cursor_same_panel = 139;
|
||||
static i32 fcoder_metacmd_ID_goto_next_jump = 140;
|
||||
static i32 fcoder_metacmd_ID_goto_prev_jump = 141;
|
||||
static i32 fcoder_metacmd_ID_goto_next_jump_no_skips = 142;
|
||||
static i32 fcoder_metacmd_ID_goto_prev_jump_no_skips = 143;
|
||||
static i32 fcoder_metacmd_ID_goto_first_jump = 144;
|
||||
static i32 fcoder_metacmd_ID_goto_first_jump_same_panel_sticky = 145;
|
||||
static i32 fcoder_metacmd_ID_if_read_only_goto_position = 146;
|
||||
static i32 fcoder_metacmd_ID_if_read_only_goto_position_same_panel = 147;
|
||||
static i32 fcoder_metacmd_ID_view_jump_list_with_lister = 148;
|
||||
static i32 fcoder_metacmd_ID_show_the_log_graph = 149;
|
||||
static i32 fcoder_metacmd_ID_copy = 150;
|
||||
static i32 fcoder_metacmd_ID_cut = 151;
|
||||
static i32 fcoder_metacmd_ID_paste = 152;
|
||||
static i32 fcoder_metacmd_ID_paste_next = 153;
|
||||
static i32 fcoder_metacmd_ID_paste_and_indent = 154;
|
||||
static i32 fcoder_metacmd_ID_paste_next_and_indent = 155;
|
||||
static i32 fcoder_metacmd_ID_execute_previous_cli = 156;
|
||||
static i32 fcoder_metacmd_ID_execute_any_cli = 157;
|
||||
static i32 fcoder_metacmd_ID_build_search = 158;
|
||||
static i32 fcoder_metacmd_ID_build_in_build_panel = 159;
|
||||
static i32 fcoder_metacmd_ID_close_build_panel = 160;
|
||||
static i32 fcoder_metacmd_ID_change_to_build_panel = 161;
|
||||
static i32 fcoder_metacmd_ID_close_all_code = 162;
|
||||
static i32 fcoder_metacmd_ID_open_all_code = 163;
|
||||
static i32 fcoder_metacmd_ID_open_all_code_recursive = 164;
|
||||
static i32 fcoder_metacmd_ID_load_project = 165;
|
||||
static i32 fcoder_metacmd_ID_project_fkey_command = 166;
|
||||
static i32 fcoder_metacmd_ID_project_go_to_root_directory = 167;
|
||||
static i32 fcoder_metacmd_ID_setup_new_project = 168;
|
||||
static i32 fcoder_metacmd_ID_setup_build_bat = 169;
|
||||
static i32 fcoder_metacmd_ID_setup_build_sh = 170;
|
||||
static i32 fcoder_metacmd_ID_setup_build_bat_and_sh = 171;
|
||||
static i32 fcoder_metacmd_ID_project_command_lister = 172;
|
||||
static i32 fcoder_metacmd_ID_list_all_functions_current_buffer = 173;
|
||||
static i32 fcoder_metacmd_ID_list_all_functions_current_buffer_lister = 174;
|
||||
static i32 fcoder_metacmd_ID_list_all_functions_all_buffers = 175;
|
||||
static i32 fcoder_metacmd_ID_list_all_functions_all_buffers_lister = 176;
|
||||
static i32 fcoder_metacmd_ID_select_surrounding_scope = 177;
|
||||
static i32 fcoder_metacmd_ID_select_next_scope_absolute = 178;
|
||||
static i32 fcoder_metacmd_ID_select_next_scope_after_current = 179;
|
||||
static i32 fcoder_metacmd_ID_select_prev_scope_absolute = 180;
|
||||
static i32 fcoder_metacmd_ID_place_in_scope = 181;
|
||||
static i32 fcoder_metacmd_ID_delete_current_scope = 182;
|
||||
static i32 fcoder_metacmd_ID_open_long_braces = 183;
|
||||
static i32 fcoder_metacmd_ID_open_long_braces_semicolon = 184;
|
||||
static i32 fcoder_metacmd_ID_open_long_braces_break = 185;
|
||||
static i32 fcoder_metacmd_ID_if0_off = 186;
|
||||
static i32 fcoder_metacmd_ID_write_todo = 187;
|
||||
static i32 fcoder_metacmd_ID_write_hack = 188;
|
||||
static i32 fcoder_metacmd_ID_write_note = 189;
|
||||
static i32 fcoder_metacmd_ID_write_block = 190;
|
||||
static i32 fcoder_metacmd_ID_write_zero_struct = 191;
|
||||
static i32 fcoder_metacmd_ID_comment_line = 192;
|
||||
static i32 fcoder_metacmd_ID_uncomment_line = 193;
|
||||
static i32 fcoder_metacmd_ID_comment_line_toggle = 194;
|
||||
static i32 fcoder_metacmd_ID_snippet_lister = 195;
|
||||
static i32 fcoder_metacmd_ID_miblo_increment_basic = 196;
|
||||
static i32 fcoder_metacmd_ID_miblo_decrement_basic = 197;
|
||||
static i32 fcoder_metacmd_ID_miblo_increment_time_stamp = 198;
|
||||
static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp = 199;
|
||||
static i32 fcoder_metacmd_ID_miblo_increment_time_stamp_minute = 200;
|
||||
static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp_minute = 201;
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue