Margins, moved file bar, moved query bars

master
Allen Webster 2019-02-26 21:49:35 -08:00
parent bc492e7bd4
commit 1907196035
24 changed files with 605 additions and 640 deletions

View File

@ -8,48 +8,47 @@ enum Style_Tag{
Stag_NOOP = 0,
Stag_Bar = 1,
Stag_Bar_Active = 2,
Stag_Base = 3,
Stag_Pop1 = 4,
Stag_Pop2 = 5,
Stag_Back = 6,
Stag_Margin = 7,
Stag_Margin_Hover = 8,
Stag_Margin_Active = 9,
Stag_List_Item = 10,
Stag_List_Item_Hover = 11,
Stag_List_Item_Active = 12,
Stag_Cursor = 13,
Stag_At_Cursor = 14,
Stag_Highlight_Cursor_Line = 15,
Stag_Highlight = 16,
Stag_At_Highlight = 17,
Stag_Mark = 18,
Stag_Default = 19,
Stag_Comment = 20,
Stag_Keyword = 21,
Stag_Str_Constant = 22,
Stag_Char_Constant = 23,
Stag_Int_Constant = 24,
Stag_Float_Constant = 25,
Stag_Bool_Constant = 26,
Stag_Preproc = 27,
Stag_Include = 28,
Stag_Special_Character = 29,
Stag_Ghost_Character = 30,
Stag_Highlight_Junk = 31,
Stag_Highlight_White = 32,
Stag_Paste = 33,
Stag_Undo = 34,
Stag_Back_Cycle_1 = 35,
Stag_Back_Cycle_2 = 36,
Stag_Back_Cycle_3 = 37,
Stag_Back_Cycle_4 = 38,
Stag_Text_Cycle_1 = 39,
Stag_Text_Cycle_2 = 40,
Stag_Text_Cycle_3 = 41,
Stag_Text_Cycle_4 = 42,
Stag_COUNT = 43
Stag_Base = 2,
Stag_Pop1 = 3,
Stag_Pop2 = 4,
Stag_Back = 5,
Stag_Margin = 6,
Stag_Margin_Hover = 7,
Stag_Margin_Active = 8,
Stag_List_Item = 9,
Stag_List_Item_Hover = 10,
Stag_List_Item_Active = 11,
Stag_Cursor = 12,
Stag_At_Cursor = 13,
Stag_Highlight_Cursor_Line = 14,
Stag_Highlight = 15,
Stag_At_Highlight = 16,
Stag_Mark = 17,
Stag_Default = 18,
Stag_Comment = 19,
Stag_Keyword = 20,
Stag_Str_Constant = 21,
Stag_Char_Constant = 22,
Stag_Int_Constant = 23,
Stag_Float_Constant = 24,
Stag_Bool_Constant = 25,
Stag_Preproc = 26,
Stag_Include = 27,
Stag_Special_Character = 28,
Stag_Ghost_Character = 29,
Stag_Highlight_Junk = 30,
Stag_Highlight_White = 31,
Stag_Paste = 32,
Stag_Undo = 33,
Stag_Back_Cycle_1 = 34,
Stag_Back_Cycle_2 = 35,
Stag_Back_Cycle_3 = 36,
Stag_Back_Cycle_4 = 37,
Stag_Text_Cycle_1 = 38,
Stag_Text_Cycle_2 = 39,
Stag_Text_Cycle_3 = 40,
Stag_Text_Cycle_4 = 41,
Stag_COUNT = 42
};
#define FirstCustomColor Stag_COUNT

View File

@ -454,7 +454,7 @@ STRUCT Parser_String_And_Type{
};
/* DOC(Microsecond_Time_Stamp is a typedef of an unsigned 64 bit integer used to signify that the value is an arbitrary for a moment in time.) */
TYPEDEF uint64_t Microsecond_Time_Stamp;
TYPEDEF u64 Microsecond_Time_Stamp;
/*
DOC(File_Info describes the name and type of a file.)
@ -603,8 +603,8 @@ TYPEDEF_FUNC b32 Buffer_Edit_Handler(struct Application_Links *app, Buffer_ID bu
// TODO(allen): what to do with batches???
STRUCT File_Attributes{
uint64_t size;
uint64_t last_write_time;
u64 size;
u64 last_write_time;
};
/* DOC(Buffer_Summary acts as a handle to a buffer and describes the state of the buffer.)
@ -694,8 +694,6 @@ STRUCT View_Summary{
i32_Rect view_region;
/* DOC(TODO) */
i32_Rect render_region;
/* DOC(This describes the screen position in which this view's buffer is displayed. This is different from view_region, because it does not include any fixed height GUI at the top of the view.) */
i32_Rect file_region;
/* DOC(This describes the scrolling position inside the view.) */
GUI_Scroll_Vars scroll_vars;
};
@ -718,13 +716,13 @@ A handle for a managed object can "go bad" when it's scope is cleared, or when i
};
/* DOC(A handle to a managed scope. A managed scope contains variables and objects all of which can be freed and reset in optimized bulk operations. Many managed scopes are created and destroyed by the core to track the lifetime of entities like buffers and views. Because a managed scope contains it's own copy of the managed variables, managed scopes can also be used as a keying mechanism to store and retrieve special information related to entities like buffers and views.) */
TYPEDEF uint64_t Managed_Scope;
TYPEDEF u64 Managed_Scope;
/* DOC(An id refering to a managed variable. Managed variables are created globally, but each managed scope has it's own set of values for the managed variables. Managed variables are created via a unique string. Attempting to create a variable with the same name as an existing variable fails. When naming variables it is recommended that you place a 'module name' followed by a '.' and then a descriptive variable name to distinguish your variables from variables written by other 4coder users that might someday need to work together in the same configuration. Example: "MyUniqueCustomization.variable_name"). The variable's id is used to set and get the value from managed scopes. */
TYPEDEF i32 Managed_Variable_ID;
/* DOC(A handle to a managed object. Managed objects have various behaviors and special uses depending on their type. All managed objects share the property of being tied to a managed scope, so that they are cleaned up and freed when that scope's contents are cleared or when the scope is destroyed, they all support store and load operations, although not all with the exact same meanings and implications, and they can all be freed individually instead of with the entire scope.) */
TYPEDEF uint64_t Managed_Object;
TYPEDEF u64 Managed_Object;
static Managed_Scope ManagedScope_NULL = 0;
static Managed_Variable_ID ManagedVariableIndex_ERROR = -1;
@ -844,6 +842,11 @@ STRUCT Query_Bar{
String string;
};
STRUCT Query_Bar_Ptr_Array{
Query_Bar **ptrs;
i32 count;
};
TYPEDEF_FUNC void UI_Quit_Function_Type(struct Application_Links *app, View_Summary view);
#define UI_QUIT_FUNCTION(name) void name(struct Application_Links *app, View_Summary view)
@ -1033,9 +1036,9 @@ DOC(Data is used for passing and returing pointer size pairs.)
*/
STRUCT Data{
/* DOC(A pointer to the data.) */
uint8_t *data;
u8 *data;
/* DOC(The size of the data in bytes.) */
uint64_t size;
u64 size;
};
STRUCT Frame_Info{
@ -1092,6 +1095,8 @@ ENUM(i32, Special_Hook_ID){
special_hook_buffer_name_resolver,
/* DOC(TODO) */
special_hook_modify_color_table,
/* DOC(TODO) */
special_hook_get_view_buffer_region,
};
TYPEDEF_FUNC i32 Command_Caller_Hook_Function(struct Application_Links *app, Generic_Command cmd);
@ -1124,6 +1129,9 @@ STRUCT Color_Table{
TYPEDEF_FUNC Color_Table Modify_Color_Table_Function(struct Application_Links *app, Frame_Info frame);
#define MODIFY_COLOR_TABLE_SIG(name) Color_Table name(struct Application_Links *app, Frame_Info frame)
TYPEDEF_FUNC Rect_i32 Get_View_Buffer_Region_Function(struct Application_Links *app, View_ID view_id, Rect_i32 sub_region);
#define GET_VIEW_BUFFER_REGION_SIG(name) Rect_i32 name(struct Application_Links *app, View_ID view_id, Rect_i32 sub_region)
STRUCT Buffer_Name_Conflict_Entry{
Buffer_ID buffer_id;
char *file_name;

View File

@ -408,16 +408,6 @@ view_set_split(Application_Links *app, View_Summary *view, View_Split_Kind kind,
return(result);
}
static i32_Rect
view_get_enclosure_rect(Application_Links *app, View_Summary *view){
i32_Rect result = {};
if (view != 0 && view->exists){
view_get_enclosure_rect(app, view->view_id, &result);
get_view_summary(app, view->view_id, AccessAll, view);
}
return(result);
}
static b32
view_compute_cursor(Application_Links *app, View_Summary *view, Buffer_Seek seek, Full_Cursor *cursor_out){
b32 result = false;

View File

@ -153,11 +153,12 @@ CUSTOM_DOC("Centers the view vertically on the line on which the cursor sits.")
{
View_Summary view = get_active_view(app, AccessProtected);
i32_Rect region = view.file_region;
Rect_i32 region = {};
view_get_buffer_region(app, view.view_id, &region);
GUI_Scroll_Vars scroll = view.scroll_vars;
float h = (float)(region.y1 - region.y0);
float y = get_view_y(&view);
f32 h = (f32)(rect_height(region));
f32 y = get_view_y(&view);
y = y - h*.5f;
scroll.target_y = (i32)(y + .5f);
view_set_scroll(app, &view, scroll);
@ -170,7 +171,7 @@ CUSTOM_DOC("Sets the left size of the view near the x position of the cursor.")
GUI_Scroll_Vars scroll = view.scroll_vars;
float x = get_view_x(&view) - 30.f;
f32 x = get_view_x(&view) - 30.f;
if (x < 0){
x = 0.f;
}
@ -198,7 +199,9 @@ CUSTOM_DOC("Sets the cursor position and mark to the mouse position.")
View_Summary view = get_active_view(app, AccessProtected);
Mouse_State mouse = get_mouse_state(app);
Vec2 p = {};
if (view_space_from_screen_space_checked(mouse.p, view.file_region, view.scroll_vars.scroll_p, &p)){
Rect_i32 region = {};
view_get_buffer_region(app, view.view_id, &region);
if (view_space_from_screen_space_checked(mouse.p, region, view.scroll_vars.scroll_p, &p)){
view_set_cursor(app, &view, seek_xy(p.x, p.y, true, view.unwrapped_lines), true);
view_set_mark(app, &view, seek_pos(view.cursor.pos));
}
@ -210,7 +213,9 @@ CUSTOM_DOC("Sets the cursor position to the mouse position.")
View_Summary view = get_active_view(app, AccessProtected);
Mouse_State mouse = get_mouse_state(app);
Vec2 p = {};
if (view_space_from_screen_space_checked(mouse.p, view.file_region, view.scroll_vars.scroll_p, &p)){
Rect_i32 region = {};
view_get_buffer_region(app, view.view_id, &region);
if (view_space_from_screen_space_checked(mouse.p, region, view.scroll_vars.scroll_p, &p)){
view_set_cursor(app, &view, seek_xy(p.x, p.y, true, view.unwrapped_lines), true);
}
no_mark_snap_to_cursor(app, view.view_id);
@ -223,7 +228,9 @@ CUSTOM_DOC("If the mouse left button is pressed, sets the cursor position to the
Mouse_State mouse = get_mouse_state(app);
if (mouse.l){
Vec2 p = {};
if (view_space_from_screen_space_checked(mouse.p, view.file_region, view.scroll_vars.scroll_p, &p)){
Rect_i32 region = {};
view_get_buffer_region(app, view.view_id, &region);
if (view_space_from_screen_space_checked(mouse.p, region, view.scroll_vars.scroll_p, &p)){
view_set_cursor(app, &view, seek_xy(p.x, p.y, true, view.unwrapped_lines), true);
}
}
@ -236,7 +243,9 @@ CUSTOM_DOC("Sets the mark position to the mouse position.")
View_Summary view = get_active_view(app, AccessProtected);
Mouse_State mouse = get_mouse_state(app);
Vec2 p = {};
if (view_space_from_screen_space_checked(mouse.p, view.file_region, view.scroll_vars.scroll_p, &p)){
Rect_i32 region = {};
view_get_buffer_region(app, view.view_id, &region);
if (view_space_from_screen_space_checked(mouse.p, region, view.scroll_vars.scroll_p, &p)){
view_set_mark(app, &view, seek_xy(p.x, p.y, true, view.unwrapped_lines));
}
no_mark_snap_to_cursor(app, view.view_id);
@ -257,19 +266,20 @@ CUSTOM_DOC("Reads the scroll wheel value from the mouse state and scrolls accord
////////////////////////////////
static void
move_vertical(Application_Links *app, float line_multiplier){
move_vertical(Application_Links *app, f32 line_multiplier){
u32 access = AccessProtected;
View_Summary view = get_active_view(app, access);
float delta_y = line_multiplier*view.line_height;
float new_y = get_view_y(&view) + delta_y;
float x = view.preferred_x;
f32 delta_y = line_multiplier*view.line_height;
f32 new_y = get_view_y(&view) + delta_y;
f32 x = view.preferred_x;
view_set_cursor(app, &view, seek_xy(x, new_y, 0, view.unwrapped_lines), 0);
float actual_new_y = get_view_y(&view);
f32 actual_new_y = get_view_y(&view);
if (actual_new_y < new_y){
i32_Rect file_region = view.file_region;
i32 height = file_region.y1 - file_region.y0;
Rect_i32 file_region = {};
view_get_buffer_region(app, view.view_id, &file_region);
i32 height = rect_height(file_region);
i32 full_scroll_y = (i32)actual_new_y - height/2;
if (view.scroll_vars.target_y < full_scroll_y){
GUI_Scroll_Vars new_scroll_vars = view.scroll_vars;
@ -284,15 +294,16 @@ move_vertical(Application_Links *app, float line_multiplier){
no_mark_snap_to_cursor_if_shift(app, view.view_id);
}
static float
get_page_jump(View_Summary *view){
i32_Rect region = view->file_region;
float page_jump = 1.f;
static f32
get_page_jump(Application_Links *app, View_Summary *view){
Rect_i32 region = {};
view_get_buffer_region(app, view->view_id, &region);
f32 page_jump = 1.f;
if (view->line_height > 0.f){
i32 height = region.y1 - region.y0;
float line_count = (float)(height)/view->line_height;
f32 line_count = (f32)(height)/view->line_height;
i32 line_count_rounded = (i32)line_count;
page_jump = (float)line_count_rounded - 3.f;
page_jump = (f32)line_count_rounded - 3.f;
if (page_jump <= 1.f){
page_jump = 1.f;
}
@ -340,7 +351,7 @@ CUSTOM_DOC("Scrolls the view up one view height and moves the cursor up one view
{
u32 access = AccessProtected;
View_Summary view = get_active_view(app, access);
float page_jump = get_page_jump(&view);
f32 page_jump = get_page_jump(app, &view);
move_vertical(app, -page_jump);
}
@ -349,7 +360,7 @@ CUSTOM_DOC("Scrolls the view down one view height and moves the cursor down one
{
u32 access = AccessProtected;
View_Summary view = get_active_view(app, access);
float page_jump = get_page_jump(&view);
f32 page_jump = get_page_jump(app, &view);
move_vertical(app, page_jump);
}

View File

@ -92,11 +92,11 @@ CUSTOM_DOC("If the previous command was paste or paste_next, replaces the paste
Managed_Scope scope = view_get_managed_scope(app, view.view_id);
no_mark_snap_to_cursor(app, scope);
uint64_t rewrite = 0;
u64 rewrite = 0;
managed_variable_get(app, scope, view_rewrite_loc, &rewrite);
if (rewrite == RewritePaste){
managed_variable_set(app, scope, view_next_rewrite_loc, RewritePaste);
uint64_t prev_paste_index = 0;
u64 prev_paste_index = 0;
managed_variable_get(app, scope, view_paste_index_loc, &prev_paste_index);
i32 paste_index = (i32)prev_paste_index + 1;
managed_variable_set(app, scope, view_paste_index_loc, paste_index);

View File

@ -62,13 +62,13 @@ new_view_settings(Application_Links *app, View_Summary *view){
static void
view_set_passive(Application_Links *app, View_Summary *view, b32 value){
Managed_Scope scope = view_get_managed_scope(app, view->view_id);
managed_variable_set(app, scope, view_is_passive_loc, (uint64_t)value);
managed_variable_set(app, scope, view_is_passive_loc, (u64)value);
}
static b32
view_get_is_passive(Application_Links *app, View_Summary *view){
Managed_Scope scope = view_get_managed_scope(app, view->view_id);
uint64_t is_passive = 0;
u64 is_passive = 0;
managed_variable_get(app, scope, view_is_passive_loc, &is_passive);
return(is_passive != 0);
}
@ -308,7 +308,7 @@ CUSTOM_DOC("Switch to a named key binding map.")
////////////////////////////////
static void
default_4coder_initialize(Application_Links *app, i32 override_font_size, b32 override_hinting){
default_4coder_initialize(Application_Links *app, char **command_line_files, i32 file_count, i32 override_font_size, b32 override_hinting){
i32 part_size = (32 << 20);
void *part_mem = memory_allocate(app, part_size);
global_part = make_part(part_mem, part_size);
@ -321,8 +321,8 @@ default_4coder_initialize(Application_Links *app, i32 override_font_size, b32 ov
static char message[] =
"Welcome to " VERSION "\n"
"If you're new to 4coder there are some tutorials at http://4coder.net/tutorials.html\n"
"Direct bug reports to editor@4coder.net for maximum reply speed\n"
"Questions or requests can go to editor@4coder.net or to 4coder.handmade.network\n"
"Direct bug reports and feature requests to https://github.com/4coder-editor/4coder/issues\n"
"Other questions and discussion can be directed to editor@4coder.net or 4coder.handmade.network\n"
"The change log can be found in CHANGES.txt\n"
"\n";
print_message(app, message, sizeof(message) - 1);
@ -338,12 +338,42 @@ default_4coder_initialize(Application_Links *app, i32 override_font_size, b32 ov
view_is_passive_loc = managed_variable_create_or_get_id(app, "DEFAULT.is_passive" , 0);
view_snap_mark_to_cursor = managed_variable_create_or_get_id(app, "DEFAULT.mark_to_cursor", 0);
view_ui_data = managed_variable_create_or_get_id(app, "DEFAULT.ui_data" , 0);
// open command line files
Temp_Memory temp = begin_temp_memory(&global_part);
char *space = push_array(&global_part, char, (32 << 10));
String file_name = make_string_cap(space, 0, (32 << 10));
i32 hot_directory_length = 0;
if (get_hot_directory(app, &file_name, &hot_directory_length)){
for (i32 i = 0; i < file_count; i += 1){
String input_name = make_string_slowly(command_line_files[i]);
file_name.size = hot_directory_length;
append(&file_name, input_name);
Buffer_ID ignore = 0;
if (!create_buffer(app, file_name, BufferCreate_NeverNew|BufferCreate_MustAttachToFile, &ignore)){
create_buffer(app, input_name, 0, &ignore);
}
}
}
end_temp_memory(temp);
}
static void
default_4coder_initialize(Application_Links *app, i32 override_font_size, b32 override_hinting){
default_4coder_initialize(app, 0, 0, override_font_size, override_hinting);
}
static void
default_4coder_initialize(Application_Links *app, char **command_line_files, i32 file_count){
Face_Description command_line_description = get_face_description(app, 0);
default_4coder_initialize(app, command_line_files, file_count, command_line_description.pt_size, command_line_description.hinting);
}
static void
default_4coder_initialize(Application_Links *app){
Face_Description command_line_description = get_face_description(app, 0);
default_4coder_initialize(app, command_line_description.pt_size, command_line_description.hinting);
default_4coder_initialize(app, 0, 0, command_line_description.pt_size, command_line_description.hinting);
}
static void

View File

@ -23,8 +23,7 @@ START_HOOK_SIG(default_start){
named_maps = named_maps_values;
named_map_count = ArrayCount(named_maps_values);
default_4coder_initialize(app);
default_4coder_initialize(app, files, file_count);
default_4coder_side_by_side_panels(app, files, file_count);
#if 0
@ -91,11 +90,9 @@ COMMAND_CALLER_HOOK(default_command_caller){
}
}
////
exec_command(app, cmd);
////
cmd.command(app);
uint64_t next_rewrite = 0;
u64 next_rewrite = 0;
managed_variable_get(app, scope, view_next_rewrite_loc, &next_rewrite);
managed_variable_set(app, scope, view_rewrite_loc, next_rewrite);
if (fcoder_mode == FCoderMode_NotepadLike){
@ -103,7 +100,7 @@ COMMAND_CALLER_HOOK(default_command_caller){
view_it.exists;
get_view_next(app, &view_it, AccessAll)){
Managed_Scope scope_it = view_get_managed_scope(app, view_it.view_id);
uint64_t val = 0;
u64 val = 0;
if (managed_variable_get(app, scope_it, view_snap_mark_to_cursor, &val)){
if (val != 0){
view_set_mark(app, &view_it, seek_pos(view_it.cursor.pos));
@ -253,7 +250,6 @@ MODIFY_COLOR_TABLE_SIG(default_modify_color_table){
default_colors[Stag_Highlight_White] = 0xFF003A3A;
default_colors[Stag_Bar] = 0xFF888888;
default_colors[Stag_Bar_Active] = 0xFF666666;
default_colors[Stag_Base] = 0xFF000000;
default_colors[Stag_Pop1] = 0xFF3C57DC;
default_colors[Stag_Pop2] = 0xFFFF0000;
@ -274,6 +270,35 @@ MODIFY_COLOR_TABLE_SIG(default_modify_color_table){
return(color_table);
}
GET_VIEW_BUFFER_REGION_SIG(default_view_buffer_region){
View_Summary view = {};
get_view_summary(app, view_id, AccessAll, &view);
i32 line_height = ceil32(view.line_height);
// file bar
{
b32 showing_file_bar = false;
if (view_get_setting(app, view_id, ViewSetting_ShowFileBar, &showing_file_bar)){
if (showing_file_bar){
sub_region.y0 += line_height + 2;
}
}
}
// query bar
{
Query_Bar *space[32];
Query_Bar_Ptr_Array query_bars = {};
query_bars.ptrs = space;
if (get_active_query_bars(app, view_id, ArrayCount(space), &query_bars)){
i32 widget_height = (line_height + 2)*query_bars.count;
sub_region.y0 += widget_height;
}
}
return(sub_region);
}
static void
default_buffer_render_caller(Application_Links *app, Render_Parameters render_params){
View_Summary view = get_view(app, render_params.view_id, AccessAll);
@ -281,6 +306,9 @@ default_buffer_render_caller(Application_Links *app, Render_Parameters render_pa
View_Summary active_view = get_active_view(app, AccessAll);
b32 is_active_view = (active_view.view_id == render_params.view_id);
f32 line_height = view.line_height;
Arena arena = make_arena(app);
static Managed_Scope render_scope = 0;
if (render_scope == 0){
render_scope = create_user_managed_scope(app);
@ -288,6 +316,108 @@ default_buffer_render_caller(Application_Links *app, Render_Parameters render_pa
Partition *scratch = &global_part;
{
f32 y_cursor = 0;
f32 x_min = (f32)view.render_region.x0;
f32 x_max = (f32)view.render_region.x1;
// NOTE(allen): Filebar
{
b32 showing_file_bar = false;
if (view_get_setting(app, render_params.view_id, ViewSetting_ShowFileBar, &showing_file_bar)){
if (showing_file_bar){
Rect_f32 bar = {};
bar.x0 = x_min;
bar.x1 = x_max;
bar.y0 = y_cursor;
bar.y1 = bar.y0 + line_height + 2.f;
y_cursor = bar.y1;
draw_rectangle(app, bar, Stag_Bar);
Fancy_Color base_color = fancy_id(Stag_Base);
Fancy_Color pop2_color = fancy_id(Stag_Pop2);
Temp_Memory_Arena temp = begin_temp_memory(&arena);
Fancy_String_List list = {};
push_fancy_string (&arena, &list, base_color, make_string(buffer.buffer_name, buffer.buffer_name_len));
push_fancy_stringf(&arena, &list, base_color, " - C#%d -", view.cursor.character);
b32 is_dos_mode = false;
if (buffer_get_setting(app, buffer.buffer_id, BufferSetting_Eol, &is_dos_mode)){
if (is_dos_mode){
push_fancy_string(&arena, &list, base_color, make_lit_string(" dos"));
}
else{
push_fancy_string(&arena, &list, base_color, make_lit_string(" nix"));
}
}
else{
push_fancy_string(&arena, &list, base_color, make_lit_string(" ???"));
}
{
Dirty_State dirty = buffer.dirty;
char space[3];
String str = make_fixed_width_string(space);
if (dirty != 0){
append(&str, " ");
}
if (HasFlag(dirty, DirtyState_UnsavedChanges)){
append(&str, "*");
}
if (HasFlag(dirty, DirtyState_UnloadedChanges)){
append(&str, "!");
}
push_fancy_string(&arena, &list, pop2_color, str);
}
Face_ID font_id = 0;
get_face_id(app, view.buffer_id, &font_id);
Vec2 p = bar.p0 + V2(0.f, 2.f);
draw_fancy_string(app, font_id, list.first, p, Stag_Default, 0);
end_temp_memory(temp);
}
}
}
// NOTE(allen): Query Bars
{
Query_Bar *space[32];
Query_Bar_Ptr_Array query_bars = {};
query_bars.ptrs = space;
if (get_active_query_bars(app, render_params.view_id, ArrayCount(space), &query_bars)){
for (i32 i = 0; i < query_bars.count; i += 1){
Query_Bar *query_bar = query_bars.ptrs[i];
Rect_f32 bar = {};
bar.x0 = x_min;
bar.x1 = x_max;
bar.y0 = y_cursor;
bar.y1 = bar.y0 + line_height + 2.f;
y_cursor = bar.y1;
Temp_Memory_Arena temp = begin_temp_memory(&arena);
Fancy_String_List list = {};
Fancy_Color default_color = fancy_id(Stag_Default);
Fancy_Color pop1_color = fancy_id(Stag_Pop1);
push_fancy_string(&arena, &list, pop1_color , query_bar->prompt);
push_fancy_string(&arena, &list, default_color, query_bar->string);
Face_ID font_id = 0;
get_face_id(app, view.buffer_id, &font_id);
Vec2 p = bar.p0 + V2(0.f, 2.f);
draw_fancy_string(app, font_id, list.first, p, Stag_Default, 0);
end_temp_memory(temp);
}
}
}
}
// NOTE(allen): Scan for TODOs and NOTEs
{
Temp_Memory temp = begin_temp_memory(scratch);
@ -493,7 +623,7 @@ default_buffer_render_caller(Application_Links *app, Render_Parameters render_pa
draw_rectangle_outline(app, hud_rect, 0xFFFFFFFF);
Face_ID font_id = 0;
get_face_id(app, 0, &font_id);
get_face_id(app, view.buffer_id, &font_id);
Vec2 p = hud_rect.p0;
@ -510,8 +640,6 @@ default_buffer_render_caller(Application_Links *app, Render_Parameters render_pa
dts[1] = history_animation_dt[j];
i32 frame_index = history_frame_index[j];
Arena arena = make_arena(app);
char space[256];
String str = make_fixed_width_string(space);
@ -538,11 +666,11 @@ default_buffer_render_caller(Application_Links *app, Render_Parameters render_pa
draw_fancy_string(app, font_id, list.first, p, Stag_Default, 0, 0, V2(1.f, 0.f));
arena_release_all(&arena);
}
}
}
arena_release_all(&arena);
managed_scope_clear_self_all_dependent_scopes(app, render_scope);
}
@ -1109,6 +1237,7 @@ set_all_default_hooks(Bind_Helper *context){
set_scroll_rule(context, smooth_scroll_rule);
set_buffer_name_resolver(context, default_buffer_name_resolution);
set_modify_color_table_hook(context, default_modify_color_table);
set_get_view_buffer_region_hook(context, default_view_buffer_region);
}
// BOTTOM

View File

@ -207,11 +207,11 @@ CUSTOM_COMMAND_SIG(multi_paste){
View_Summary view = get_active_view(app, access);
Managed_Scope scope = view_get_managed_scope(app, view.view_id);
uint64_t rewrite = 0;
u64 rewrite = 0;
managed_variable_get(app, scope, view_rewrite_loc, &rewrite);
if (rewrite == RewritePaste){
managed_variable_set(app, scope, view_next_rewrite_loc, RewritePaste);
uint64_t prev_paste_index = 0;
u64 prev_paste_index = 0;
managed_variable_get(app, scope, view_paste_index_loc, &prev_paste_index);
i32 paste_index = (i32)prev_paste_index + 1;
managed_variable_set(app, scope, view_paste_index_loc, paste_index);

View File

@ -178,8 +178,7 @@ fancy_string_list_single(Fancy_String *fancy_string){
}
static Vec2
draw_fancy_string(Application_Links *app, Face_ID font_id, Fancy_String *string, Vec2 P,
int_color fore, int_color back, u32 flags, Vec2 dP){
draw_fancy_string(Application_Links *app, Face_ID font_id, Fancy_String *string, Vec2 P, int_color fore, int_color back, u32 flags, Vec2 dP){
for (;string != 0;
string = string->next){
Face_ID use_font_id = (string->font_id) ? string->font_id : font_id;
@ -197,5 +196,10 @@ draw_fancy_string(Application_Links *app, Face_ID font_id, Fancy_String *string,
return(P);
}
static Vec2
draw_fancy_string(Application_Links *app, Face_ID font_id, Fancy_String *string, Vec2 P, int_color fore, int_color back){
return(draw_fancy_string(app, font_id, string, P, fore, back, 0, V2(1.f, 0.f)));
}
// BOTTOM

View File

@ -47,11 +47,11 @@ struct Application_Links;
#define PANEL_GET_MAX_SIG(n) b32 n(Application_Links *app, Panel_ID panel_id, Panel_ID *panel_id_out)
#define PANEL_GET_MARGIN_SIG(n) b32 n(Application_Links *app, Panel_ID panel_id, i32_Rect *margins_out)
#define VIEW_CLOSE_SIG(n) b32 n(Application_Links *app, View_ID view_id)
#define VIEW_GET_BUFFER_REGION_SIG(n) b32 n(Application_Links *app, View_ID view_id, Rect_i32 *region_out)
#define VIEW_SET_ACTIVE_SIG(n) b32 n(Application_Links *app, View_ID view_id)
#define VIEW_GET_SETTING_SIG(n) b32 n(Application_Links *app, View_ID view_id, View_Setting_ID setting, i32 *value_out)
#define VIEW_SET_SETTING_SIG(n) b32 n(Application_Links *app, View_ID view_id, View_Setting_ID setting, i32 value)
#define VIEW_GET_MANAGED_SCOPE_SIG(n) b32 n(Application_Links *app, View_ID view_id, Managed_Scope *scope)
#define VIEW_GET_ENCLOSURE_RECT_SIG(n) b32 n(Application_Links *app, View_ID view_id, i32_Rect *rect_out)
#define VIEW_COMPUTE_CURSOR_SIG(n) b32 n(Application_Links *app, View_ID view_id, Buffer_Seek seek, Full_Cursor *cursor_out)
#define VIEW_SET_CURSOR_SIG(n) b32 n(Application_Links *app, View_ID view_id, Buffer_Seek seek, b32 set_preferred_x)
#define VIEW_SET_SCROLL_SIG(n) b32 n(Application_Links *app, View_ID view_id, GUI_Scroll_Vars scroll)
@ -69,11 +69,11 @@ struct Application_Links;
#define GET_MANAGED_SCOPE_WITH_MULTIPLE_DEPENDENCIES_SIG(n) Managed_Scope n(Application_Links *app, Managed_Scope *scopes, i32 count)
#define MANAGED_SCOPE_CLEAR_CONTENTS_SIG(n) b32 n(Application_Links *app, Managed_Scope scope)
#define MANAGED_SCOPE_CLEAR_SELF_ALL_DEPENDENT_SCOPES_SIG(n) b32 n(Application_Links *app, Managed_Scope scope)
#define MANAGED_VARIABLE_CREATE_SIG(n) Managed_Variable_ID n(Application_Links *app, char *null_terminated_name, uint64_t default_value)
#define MANAGED_VARIABLE_CREATE_SIG(n) Managed_Variable_ID n(Application_Links *app, char *null_terminated_name, u64 default_value)
#define MANAGED_VARIABLE_GET_ID_SIG(n) Managed_Variable_ID n(Application_Links *app, char *null_terminated_name)
#define MANAGED_VARIABLE_CREATE_OR_GET_ID_SIG(n) Managed_Variable_ID n(Application_Links *app, char *null_terminated_name, uint64_t default_value)
#define MANAGED_VARIABLE_SET_SIG(n) b32 n(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, uint64_t value)
#define MANAGED_VARIABLE_GET_SIG(n) b32 n(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, uint64_t *value_out)
#define MANAGED_VARIABLE_CREATE_OR_GET_ID_SIG(n) Managed_Variable_ID n(Application_Links *app, char *null_terminated_name, u64 default_value)
#define MANAGED_VARIABLE_SET_SIG(n) b32 n(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, u64 value)
#define MANAGED_VARIABLE_GET_SIG(n) b32 n(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, u64 *value_out)
#define ALLOC_MANAGED_MEMORY_IN_SCOPE_SIG(n) Managed_Object n(Application_Links *app, Managed_Scope scope, i32 item_size, i32 count)
#define ALLOC_BUFFER_MARKERS_ON_BUFFER_SIG(n) Managed_Object n(Application_Links *app, Buffer_ID buffer_id, i32 count, Managed_Scope *optional_extra_scope)
#define ALLOC_MANAGED_ARENA_IN_SCOPE_SIG(n) Managed_Object n(Application_Links *app, Managed_Scope scope, i32 page_size)
@ -96,7 +96,7 @@ struct Application_Links;
#define GET_COMMAND_INPUT_SIG(n) User_Input n(Application_Links *app)
#define SET_COMMAND_INPUT_SIG(n) void n(Application_Links *app, Key_Event_Data key_data)
#define GET_MOUSE_STATE_SIG(n) Mouse_State n(Application_Links *app)
#define GET_ACTIVE_QUERY_BARS_SIG(n) i32 n(Application_Links *app, View_ID view_id, i32 max_result_count, Query_Bar **result_array)
#define GET_ACTIVE_QUERY_BARS_SIG(n) b32 n(Application_Links *app, View_ID view_id, i32 max_result_count, Query_Bar_Ptr_Array *array_out)
#define START_QUERY_BAR_SIG(n) b32 n(Application_Links *app, Query_Bar *bar, u32 flags)
#define END_QUERY_BAR_SIG(n) void n(Application_Links *app, Query_Bar *bar, u32 flags)
#define PRINT_MESSAGE_SIG(n) b32 n(Application_Links *app, String message)
@ -196,11 +196,11 @@ typedef PANEL_GET_CHILD_SIG(Panel_Get_Child_Function);
typedef PANEL_GET_MAX_SIG(Panel_Get_Max_Function);
typedef PANEL_GET_MARGIN_SIG(Panel_Get_Margin_Function);
typedef VIEW_CLOSE_SIG(View_Close_Function);
typedef VIEW_GET_BUFFER_REGION_SIG(View_Get_Buffer_Region_Function);
typedef VIEW_SET_ACTIVE_SIG(View_Set_Active_Function);
typedef VIEW_GET_SETTING_SIG(View_Get_Setting_Function);
typedef VIEW_SET_SETTING_SIG(View_Set_Setting_Function);
typedef VIEW_GET_MANAGED_SCOPE_SIG(View_Get_Managed_Scope_Function);
typedef VIEW_GET_ENCLOSURE_RECT_SIG(View_Get_Enclosure_Rect_Function);
typedef VIEW_COMPUTE_CURSOR_SIG(View_Compute_Cursor_Function);
typedef VIEW_SET_CURSOR_SIG(View_Set_Cursor_Function);
typedef VIEW_SET_SCROLL_SIG(View_Set_Scroll_Function);
@ -347,11 +347,11 @@ Panel_Get_Child_Function *panel_get_child;
Panel_Get_Max_Function *panel_get_max;
Panel_Get_Margin_Function *panel_get_margin;
View_Close_Function *view_close;
View_Get_Buffer_Region_Function *view_get_buffer_region;
View_Set_Active_Function *view_set_active;
View_Get_Setting_Function *view_get_setting;
View_Set_Setting_Function *view_set_setting;
View_Get_Managed_Scope_Function *view_get_managed_scope;
View_Get_Enclosure_Rect_Function *view_get_enclosure_rect;
View_Compute_Cursor_Function *view_compute_cursor;
View_Set_Cursor_Function *view_set_cursor;
View_Set_Scroll_Function *view_set_scroll;
@ -497,11 +497,11 @@ Panel_Get_Child_Function *panel_get_child_;
Panel_Get_Max_Function *panel_get_max_;
Panel_Get_Margin_Function *panel_get_margin_;
View_Close_Function *view_close_;
View_Get_Buffer_Region_Function *view_get_buffer_region_;
View_Set_Active_Function *view_set_active_;
View_Get_Setting_Function *view_get_setting_;
View_Set_Setting_Function *view_set_setting_;
View_Get_Managed_Scope_Function *view_get_managed_scope_;
View_Get_Enclosure_Rect_Function *view_get_enclosure_rect_;
View_Compute_Cursor_Function *view_compute_cursor_;
View_Set_Cursor_Function *view_set_cursor_;
View_Set_Scroll_Function *view_set_scroll_;
@ -655,11 +655,11 @@ app_links->panel_get_child_ = Panel_Get_Child;\
app_links->panel_get_max_ = Panel_Get_Max;\
app_links->panel_get_margin_ = Panel_Get_Margin;\
app_links->view_close_ = View_Close;\
app_links->view_get_buffer_region_ = View_Get_Buffer_Region;\
app_links->view_set_active_ = View_Set_Active;\
app_links->view_get_setting_ = View_Get_Setting;\
app_links->view_set_setting_ = View_Set_Setting;\
app_links->view_get_managed_scope_ = View_Get_Managed_Scope;\
app_links->view_get_enclosure_rect_ = View_Get_Enclosure_Rect;\
app_links->view_compute_cursor_ = View_Compute_Cursor;\
app_links->view_set_cursor_ = View_Set_Cursor;\
app_links->view_set_scroll_ = View_Set_Scroll;\
@ -805,11 +805,11 @@ static b32 panel_get_child(Application_Links *app, Panel_ID panel_id, Panel_Chil
static b32 panel_get_max(Application_Links *app, Panel_ID panel_id, Panel_ID *panel_id_out){return(app->panel_get_max(app, panel_id, panel_id_out));}
static b32 panel_get_margin(Application_Links *app, Panel_ID panel_id, i32_Rect *margins_out){return(app->panel_get_margin(app, panel_id, margins_out));}
static b32 view_close(Application_Links *app, View_ID view_id){return(app->view_close(app, view_id));}
static b32 view_get_buffer_region(Application_Links *app, View_ID view_id, Rect_i32 *region_out){return(app->view_get_buffer_region(app, view_id, region_out));}
static b32 view_set_active(Application_Links *app, View_ID view_id){return(app->view_set_active(app, view_id));}
static b32 view_get_setting(Application_Links *app, View_ID view_id, View_Setting_ID setting, i32 *value_out){return(app->view_get_setting(app, view_id, setting, value_out));}
static b32 view_set_setting(Application_Links *app, View_ID view_id, View_Setting_ID setting, i32 value){return(app->view_set_setting(app, view_id, setting, value));}
static b32 view_get_managed_scope(Application_Links *app, View_ID view_id, Managed_Scope *scope){return(app->view_get_managed_scope(app, view_id, scope));}
static b32 view_get_enclosure_rect(Application_Links *app, View_ID view_id, i32_Rect *rect_out){return(app->view_get_enclosure_rect(app, view_id, rect_out));}
static b32 view_compute_cursor(Application_Links *app, View_ID view_id, Buffer_Seek seek, Full_Cursor *cursor_out){return(app->view_compute_cursor(app, view_id, seek, cursor_out));}
static b32 view_set_cursor(Application_Links *app, View_ID view_id, Buffer_Seek seek, b32 set_preferred_x){return(app->view_set_cursor(app, view_id, seek, set_preferred_x));}
static b32 view_set_scroll(Application_Links *app, View_ID view_id, GUI_Scroll_Vars scroll){return(app->view_set_scroll(app, view_id, scroll));}
@ -827,11 +827,11 @@ static Managed_Scope get_global_managed_scope(Application_Links *app){return(app
static Managed_Scope get_managed_scope_with_multiple_dependencies(Application_Links *app, Managed_Scope *scopes, i32 count){return(app->get_managed_scope_with_multiple_dependencies(app, scopes, count));}
static b32 managed_scope_clear_contents(Application_Links *app, Managed_Scope scope){return(app->managed_scope_clear_contents(app, scope));}
static b32 managed_scope_clear_self_all_dependent_scopes(Application_Links *app, Managed_Scope scope){return(app->managed_scope_clear_self_all_dependent_scopes(app, scope));}
static Managed_Variable_ID managed_variable_create(Application_Links *app, char *null_terminated_name, uint64_t default_value){return(app->managed_variable_create(app, null_terminated_name, default_value));}
static Managed_Variable_ID managed_variable_create(Application_Links *app, char *null_terminated_name, u64 default_value){return(app->managed_variable_create(app, null_terminated_name, default_value));}
static Managed_Variable_ID managed_variable_get_id(Application_Links *app, char *null_terminated_name){return(app->managed_variable_get_id(app, null_terminated_name));}
static Managed_Variable_ID managed_variable_create_or_get_id(Application_Links *app, char *null_terminated_name, uint64_t default_value){return(app->managed_variable_create_or_get_id(app, null_terminated_name, default_value));}
static b32 managed_variable_set(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, uint64_t value){return(app->managed_variable_set(app, scope, id, value));}
static b32 managed_variable_get(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, uint64_t *value_out){return(app->managed_variable_get(app, scope, id, value_out));}
static Managed_Variable_ID managed_variable_create_or_get_id(Application_Links *app, char *null_terminated_name, u64 default_value){return(app->managed_variable_create_or_get_id(app, null_terminated_name, default_value));}
static b32 managed_variable_set(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, u64 value){return(app->managed_variable_set(app, scope, id, value));}
static b32 managed_variable_get(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, u64 *value_out){return(app->managed_variable_get(app, scope, id, value_out));}
static Managed_Object alloc_managed_memory_in_scope(Application_Links *app, Managed_Scope scope, i32 item_size, i32 count){return(app->alloc_managed_memory_in_scope(app, scope, item_size, count));}
static Managed_Object alloc_buffer_markers_on_buffer(Application_Links *app, Buffer_ID buffer_id, i32 count, Managed_Scope *optional_extra_scope){return(app->alloc_buffer_markers_on_buffer(app, buffer_id, count, optional_extra_scope));}
static Managed_Object alloc_managed_arena_in_scope(Application_Links *app, Managed_Scope scope, i32 page_size){return(app->alloc_managed_arena_in_scope(app, scope, page_size));}
@ -854,7 +854,7 @@ static User_Input get_user_input(Application_Links *app, Input_Type_Flag get_typ
static User_Input get_command_input(Application_Links *app){return(app->get_command_input(app));}
static void set_command_input(Application_Links *app, Key_Event_Data key_data){(app->set_command_input(app, key_data));}
static Mouse_State get_mouse_state(Application_Links *app){return(app->get_mouse_state(app));}
static i32 get_active_query_bars(Application_Links *app, View_ID view_id, i32 max_result_count, Query_Bar **result_array){return(app->get_active_query_bars(app, view_id, max_result_count, result_array));}
static b32 get_active_query_bars(Application_Links *app, View_ID view_id, i32 max_result_count, Query_Bar_Ptr_Array *array_out){return(app->get_active_query_bars(app, view_id, max_result_count, array_out));}
static b32 start_query_bar(Application_Links *app, Query_Bar *bar, u32 flags){return(app->start_query_bar(app, bar, flags));}
static void end_query_bar(Application_Links *app, Query_Bar *bar, u32 flags){(app->end_query_bar(app, bar, flags));}
static b32 print_message(Application_Links *app, String message){return(app->print_message(app, message));}
@ -955,11 +955,11 @@ static b32 panel_get_child(Application_Links *app, Panel_ID panel_id, Panel_Chil
static b32 panel_get_max(Application_Links *app, Panel_ID panel_id, Panel_ID *panel_id_out){return(app->panel_get_max_(app, panel_id, panel_id_out));}
static b32 panel_get_margin(Application_Links *app, Panel_ID panel_id, i32_Rect *margins_out){return(app->panel_get_margin_(app, panel_id, margins_out));}
static b32 view_close(Application_Links *app, View_ID view_id){return(app->view_close_(app, view_id));}
static b32 view_get_buffer_region(Application_Links *app, View_ID view_id, Rect_i32 *region_out){return(app->view_get_buffer_region_(app, view_id, region_out));}
static b32 view_set_active(Application_Links *app, View_ID view_id){return(app->view_set_active_(app, view_id));}
static b32 view_get_setting(Application_Links *app, View_ID view_id, View_Setting_ID setting, i32 *value_out){return(app->view_get_setting_(app, view_id, setting, value_out));}
static b32 view_set_setting(Application_Links *app, View_ID view_id, View_Setting_ID setting, i32 value){return(app->view_set_setting_(app, view_id, setting, value));}
static b32 view_get_managed_scope(Application_Links *app, View_ID view_id, Managed_Scope *scope){return(app->view_get_managed_scope_(app, view_id, scope));}
static b32 view_get_enclosure_rect(Application_Links *app, View_ID view_id, i32_Rect *rect_out){return(app->view_get_enclosure_rect_(app, view_id, rect_out));}
static b32 view_compute_cursor(Application_Links *app, View_ID view_id, Buffer_Seek seek, Full_Cursor *cursor_out){return(app->view_compute_cursor_(app, view_id, seek, cursor_out));}
static b32 view_set_cursor(Application_Links *app, View_ID view_id, Buffer_Seek seek, b32 set_preferred_x){return(app->view_set_cursor_(app, view_id, seek, set_preferred_x));}
static b32 view_set_scroll(Application_Links *app, View_ID view_id, GUI_Scroll_Vars scroll){return(app->view_set_scroll_(app, view_id, scroll));}
@ -977,11 +977,11 @@ static Managed_Scope get_global_managed_scope(Application_Links *app){return(app
static Managed_Scope get_managed_scope_with_multiple_dependencies(Application_Links *app, Managed_Scope *scopes, i32 count){return(app->get_managed_scope_with_multiple_dependencies_(app, scopes, count));}
static b32 managed_scope_clear_contents(Application_Links *app, Managed_Scope scope){return(app->managed_scope_clear_contents_(app, scope));}
static b32 managed_scope_clear_self_all_dependent_scopes(Application_Links *app, Managed_Scope scope){return(app->managed_scope_clear_self_all_dependent_scopes_(app, scope));}
static Managed_Variable_ID managed_variable_create(Application_Links *app, char *null_terminated_name, uint64_t default_value){return(app->managed_variable_create_(app, null_terminated_name, default_value));}
static Managed_Variable_ID managed_variable_create(Application_Links *app, char *null_terminated_name, u64 default_value){return(app->managed_variable_create_(app, null_terminated_name, default_value));}
static Managed_Variable_ID managed_variable_get_id(Application_Links *app, char *null_terminated_name){return(app->managed_variable_get_id_(app, null_terminated_name));}
static Managed_Variable_ID managed_variable_create_or_get_id(Application_Links *app, char *null_terminated_name, uint64_t default_value){return(app->managed_variable_create_or_get_id_(app, null_terminated_name, default_value));}
static b32 managed_variable_set(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, uint64_t value){return(app->managed_variable_set_(app, scope, id, value));}
static b32 managed_variable_get(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, uint64_t *value_out){return(app->managed_variable_get_(app, scope, id, value_out));}
static Managed_Variable_ID managed_variable_create_or_get_id(Application_Links *app, char *null_terminated_name, u64 default_value){return(app->managed_variable_create_or_get_id_(app, null_terminated_name, default_value));}
static b32 managed_variable_set(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, u64 value){return(app->managed_variable_set_(app, scope, id, value));}
static b32 managed_variable_get(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, u64 *value_out){return(app->managed_variable_get_(app, scope, id, value_out));}
static Managed_Object alloc_managed_memory_in_scope(Application_Links *app, Managed_Scope scope, i32 item_size, i32 count){return(app->alloc_managed_memory_in_scope_(app, scope, item_size, count));}
static Managed_Object alloc_buffer_markers_on_buffer(Application_Links *app, Buffer_ID buffer_id, i32 count, Managed_Scope *optional_extra_scope){return(app->alloc_buffer_markers_on_buffer_(app, buffer_id, count, optional_extra_scope));}
static Managed_Object alloc_managed_arena_in_scope(Application_Links *app, Managed_Scope scope, i32 page_size){return(app->alloc_managed_arena_in_scope_(app, scope, page_size));}
@ -1004,7 +1004,7 @@ static User_Input get_user_input(Application_Links *app, Input_Type_Flag get_typ
static User_Input get_command_input(Application_Links *app){return(app->get_command_input_(app));}
static void set_command_input(Application_Links *app, Key_Event_Data key_data){(app->set_command_input_(app, key_data));}
static Mouse_State get_mouse_state(Application_Links *app){return(app->get_mouse_state_(app));}
static i32 get_active_query_bars(Application_Links *app, View_ID view_id, i32 max_result_count, Query_Bar **result_array){return(app->get_active_query_bars_(app, view_id, max_result_count, result_array));}
static b32 get_active_query_bars(Application_Links *app, View_ID view_id, i32 max_result_count, Query_Bar_Ptr_Array *array_out){return(app->get_active_query_bars_(app, view_id, max_result_count, array_out));}
static b32 start_query_bar(Application_Links *app, Query_Bar *bar, u32 flags){return(app->start_query_bar_(app, bar, flags));}
static void end_query_bar(Application_Links *app, Query_Bar *bar, u32 flags){(app->end_query_bar_(app, bar, flags));}
static b32 print_message(Application_Links *app, String message){return(app->print_message_(app, message));}

View File

@ -260,41 +260,41 @@ static Command_Metadata fcoder_metacmd_table[233] = {
{ PROC_LINKS(auto_tab_whole_file, 0), "auto_tab_whole_file", 19, "Audo-indents the entire current buffer.", 39, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 619 },
{ PROC_LINKS(backspace_char, 0), "backspace_char", 14, "Deletes the character to the left of the cursor.", 48, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 101 },
{ PROC_LINKS(backspace_word, 0), "backspace_word", 14, "Delete characters between the cursor position and the first alphanumeric boundary to the left.", 94, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1257 },
{ PROC_LINKS(basic_change_active_panel, 0), "basic_change_active_panel", 25, "Change the currently active panel, moving to the panel with the next highest view_id. Will not skipe the build panel if it is open.", 132, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 495 },
{ PROC_LINKS(basic_change_active_panel, 0), "basic_change_active_panel", 25, "Change the currently active panel, moving to the panel with the next highest view_id. Will not skipe the build panel if it is open.", 132, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 506 },
{ PROC_LINKS(build_in_build_panel, 0), "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 187 },
{ PROC_LINKS(build_search, 0), "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 155 },
{ PROC_LINKS(center_view, 0), "center_view", 11, "Centers the view vertically on the line on which the cursor sits.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 151 },
{ 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\\4coder_default_framework.cpp", 40, 149 },
{ 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\\4coder_default_framework.cpp", 40, 159 },
{ PROC_LINKS(change_to_build_panel, 0), "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 209 },
{ PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 430 },
{ PROC_LINKS(click_set_cursor, 0), "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 207 },
{ PROC_LINKS(click_set_cursor_and_mark, 0), "click_set_cursor_and_mark", 25, "Sets the cursor position and mark to the mouse position.", 56, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 195 },
{ PROC_LINKS(click_set_cursor_if_lbutton, 0), "click_set_cursor_if_lbutton", 27, "If the mouse left button is pressed, sets the cursor position to the mouse position.", 84, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 219 },
{ PROC_LINKS(click_set_mark, 0), "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 233 },
{ PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 441 },
{ PROC_LINKS(click_set_cursor, 0), "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 210 },
{ PROC_LINKS(click_set_cursor_and_mark, 0), "click_set_cursor_and_mark", 25, "Sets the cursor position and mark to the mouse position.", 56, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 196 },
{ PROC_LINKS(click_set_cursor_if_lbutton, 0), "click_set_cursor_if_lbutton", 27, "If the mouse left button is pressed, sets the cursor position to the mouse position.", 84, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 224 },
{ PROC_LINKS(click_set_mark, 0), "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 240 },
{ PROC_LINKS(close_all_code, 0), "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1060 },
{ PROC_LINKS(close_build_panel, 0), "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "w:\\4ed\\code\\4coder_build_commands.cpp", 37, 203 },
{ PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 503 },
{ PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 514 },
{ PROC_LINKS(command_lister, 0), "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\4coder_lists.cpp", 28, 973 },
{ PROC_LINKS(comment_line, 0), "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 135 },
{ PROC_LINKS(comment_line_toggle, 0), "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 159 },
{ PROC_LINKS(copy, 0), "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 26 },
{ PROC_LINKS(cursor_mark_swap, 0), "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 129 },
{ PROC_LINKS(cut, 0), "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 35 },
{ PROC_LINKS(decrease_face_size, 0), "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 598 },
{ PROC_LINKS(decrease_line_wrap, 0), "decrease_line_wrap", 18, "Decrases the current buffer's width for line wrapping.", 54, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 575 },
{ PROC_LINKS(decrease_face_size, 0), "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 609 },
{ PROC_LINKS(decrease_line_wrap, 0), "decrease_line_wrap", 18, "Decrases the current buffer's width for line wrapping.", 54, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 586 },
{ PROC_LINKS(delete_char, 0), "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 83 },
{ PROC_LINKS(delete_current_scope, 0), "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 512 },
{ 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\\4coder_base_commands.cpp", 36, 1161 },
{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1413 },
{ PROC_LINKS(delete_current_scope, 0), "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 515 },
{ 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\\4coder_base_commands.cpp", 36, 1172 },
{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1424 },
{ PROC_LINKS(delete_range, 0), "delete_range", 12, "Deletes the text in the range between the cursor and the mark.", 62, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 139 },
{ PROC_LINKS(delete_word, 0), "delete_word", 11, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1263 },
{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1391 },
{ PROC_LINKS(eol_dosify, 0), "eol_dosify", 10, "Puts the buffer in DOS line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 645 },
{ PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 653 },
{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1402 },
{ PROC_LINKS(eol_dosify, 0), "eol_dosify", 10, "Puts the buffer in DOS line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 656 },
{ PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 664 },
{ PROC_LINKS(execute_any_cli, 0), "execute_any_cli", 15, "Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.", 133, "w:\\4ed\\code\\4coder_system_command.cpp", 37, 23 },
{ PROC_LINKS(execute_previous_cli, 0), "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "w:\\4ed\\code\\4coder_system_command.cpp", 37, 7 },
{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 661 },
{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 672 },
{ 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\\4coder_seek.cpp", 27, 1176 },
{ 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\\4coder_seek.cpp", 27, 1184 },
{ PROC_LINKS(goto_first_jump_direct, 0), "goto_first_jump_direct", 22, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 84 },
@ -304,7 +304,7 @@ static Command_Metadata fcoder_metacmd_table[233] = {
{ PROC_LINKS(goto_jump_at_cursor_same_panel_direct, 0), "goto_jump_at_cursor_same_panel_direct", 37, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list..", 168, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 29 },
{ PROC_LINKS(goto_jump_at_cursor_same_panel_sticky, 0), "goto_jump_at_cursor_same_panel_sticky", 37, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list.", 167, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 373 },
{ PROC_LINKS(goto_jump_at_cursor_sticky, 0), "goto_jump_at_cursor_sticky", 26, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 345 },
{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 669 },
{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 680 },
{ PROC_LINKS(goto_next_jump_direct, 0), "goto_next_jump_direct", 21, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 48 },
{ PROC_LINKS(goto_next_jump_no_skips_direct, 0), "goto_next_jump_no_skips_direct", 30, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 66 },
{ PROC_LINKS(goto_next_jump_no_skips_sticky, 0), "goto_next_jump_no_skips_sticky", 30, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 498 },
@ -313,19 +313,19 @@ static Command_Metadata fcoder_metacmd_table[233] = {
{ PROC_LINKS(goto_prev_jump_no_skips_direct, 0), "goto_prev_jump_no_skips_direct", 30, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 75 },
{ PROC_LINKS(goto_prev_jump_no_skips_sticky, 0), "goto_prev_jump_no_skips_sticky", 30, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 514 },
{ PROC_LINKS(goto_prev_jump_sticky, 0), "goto_prev_jump_sticky", 21, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 484 },
{ PROC_LINKS(hide_filebar, 0), "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 533 },
{ PROC_LINKS(hide_scrollbar, 0), "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 519 },
{ PROC_LINKS(hide_filebar, 0), "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 544 },
{ PROC_LINKS(hide_scrollbar, 0), "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 530 },
{ PROC_LINKS(if0_off, 0), "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 79 },
{ PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 586 },
{ PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 564 },
{ PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 597 },
{ PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 575 },
{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 28, 774 },
{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 28, 884 },
{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 916 },
{ 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\\4coder_lists.cpp", 28, 846 },
{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 755 },
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1583 },
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1594 },
{ PROC_LINKS(kill_rect, 0), "kill_rect", 9, "Delete characters in a rectangular region. Range testing is done by unwrapped-xy coordinates.", 93, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 26 },
{ PROC_LINKS(left_adjust_view, 0), "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 166 },
{ PROC_LINKS(left_adjust_view, 0), "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 167 },
{ PROC_LINKS(list_all_functions_all_buffers, 0), "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 332 },
{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), "list_all_functions_all_buffers_lister", 37, "Creates a lister of locations that look like function definitions and declarations all buffers.", 95, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 338 },
{ PROC_LINKS(list_all_functions_current_buffer, 0), "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "w:\\4ed\\code\\4coder_function_list.cpp", 36, 309 },
@ -358,24 +358,24 @@ static Command_Metadata fcoder_metacmd_table[233] = {
{ 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\\4coder_lists.cpp", 28, 192 },
{ PROC_LINKS(lister__write_character__fixed_list, 0), "lister__write_character__fixed_list", 35, "A lister mode command that handles input for the fixed sure to kill list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 28, 252 },
{ PROC_LINKS(load_project, 0), "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1083 },
{ 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\\4coder_base_commands.cpp", 36, 1271 },
{ 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\\4coder_base_commands.cpp", 36, 1282 },
{ PROC_LINKS(miblo_decrement_basic, 0), "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 110 },
{ PROC_LINKS(miblo_decrement_time_stamp, 0), "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 383 },
{ PROC_LINKS(miblo_decrement_time_stamp_minute, 0), "miblo_decrement_time_stamp_minute", 33, "Decrement a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 395 },
{ PROC_LINKS(miblo_increment_basic, 0), "miblo_increment_basic", 21, "Increment an integer under the cursor by one.", 45, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 94 },
{ PROC_LINKS(miblo_increment_time_stamp, 0), "miblo_increment_time_stamp", 26, "Increment a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 377 },
{ PROC_LINKS(miblo_increment_time_stamp_minute, 0), "miblo_increment_time_stamp_minute", 33, "Increment a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\4coder_miblo_numbers.cpp", 36, 389 },
{ PROC_LINKS(mouse_wheel_change_face_size, 0), "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 610 },
{ PROC_LINKS(mouse_wheel_scroll, 0), "mouse_wheel_scroll", 18, "Reads the scroll wheel value from the mouse state and scrolls accordingly.", 74, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 245 },
{ PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 309 },
{ PROC_LINKS(move_down_10, 0), "move_down_10", 12, "Moves the cursor down ten lines.", 32, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 321 },
{ PROC_LINKS(move_down_textual, 0), "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 327 },
{ PROC_LINKS(move_left, 0), "move_left", 9, "Moves the cursor one character to the left.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 358 },
{ 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\\4coder_base_commands.cpp", 36, 1368 },
{ 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\\4coder_base_commands.cpp", 36, 1304 },
{ PROC_LINKS(move_right, 0), "move_right", 10, "Moves the cursor one character to the right.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 368 },
{ PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 303 },
{ PROC_LINKS(move_up_10, 0), "move_up_10", 10, "Moves the cursor up ten lines.", 30, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 315 },
{ PROC_LINKS(mouse_wheel_change_face_size, 0), "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 621 },
{ PROC_LINKS(mouse_wheel_scroll, 0), "mouse_wheel_scroll", 18, "Reads the scroll wheel value from the mouse state and scrolls accordingly.", 74, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 254 },
{ PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 320 },
{ PROC_LINKS(move_down_10, 0), "move_down_10", 12, "Moves the cursor down ten lines.", 32, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 332 },
{ PROC_LINKS(move_down_textual, 0), "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 338 },
{ PROC_LINKS(move_left, 0), "move_left", 9, "Moves the cursor one character to the left.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 369 },
{ 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\\4coder_base_commands.cpp", 36, 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\\4coder_base_commands.cpp", 36, 1315 },
{ PROC_LINKS(move_right, 0), "move_right", 10, "Moves the cursor one character to the right.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 379 },
{ PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 314 },
{ PROC_LINKS(move_up_10, 0), "move_up_10", 10, "Moves the cursor up ten lines.", 30, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 326 },
{ PROC_LINKS(multi_line_edit, 0), "multi_line_edit", 15, "Begin multi-line mode. In multi-line mode characters are inserted at every line between the mark and cursor. All characters are inserted at the same character offset into the line. This mode uses line_char coordinates.", 221, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 117 },
{ PROC_LINKS(newline_or_goto_position_direct, 0), "newline_or_goto_position_direct", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 101 },
{ PROC_LINKS(newline_or_goto_position_same_panel_direct, 0), "newline_or_goto_position_same_panel_direct", 42, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\4coder_jump_direct.cpp", 34, 116 },
@ -383,43 +383,43 @@ static Command_Metadata fcoder_metacmd_table[233] = {
{ PROC_LINKS(newline_or_goto_position_sticky, 0), "newline_or_goto_position_sticky", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 570 },
{ PROC_LINKS(open_all_code, 0), "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1067 },
{ PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1074 },
{ 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\\4coder_base_commands.cpp", 36, 1490 },
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1809 },
{ 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\\4coder_base_commands.cpp", 36, 1501 },
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1820 },
{ PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 55 },
{ PROC_LINKS(open_long_braces_break, 0), "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 71 },
{ PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 63 },
{ 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\\4coder_base_commands.cpp", 36, 1526 },
{ 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\\4coder_base_commands.cpp", 36, 1537 },
{ PROC_LINKS(open_panel_hsplit, 0), "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 178 },
{ PROC_LINKS(open_panel_vsplit, 0), "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 169 },
{ PROC_LINKS(page_down, 0), "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 347 },
{ PROC_LINKS(page_up, 0), "page_up", 7, "Scrolls the view up one view height and moves the cursor up one view height.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 338 },
{ PROC_LINKS(page_down, 0), "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 358 },
{ PROC_LINKS(page_up, 0), "page_up", 7, "Scrolls the view up one view height and moves the cursor up one view height.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 349 },
{ PROC_LINKS(paste, 0), "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 46 },
{ PROC_LINKS(paste_and_indent, 0), "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 134 },
{ PROC_LINKS(paste_next, 0), "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 85 },
{ PROC_LINKS(paste_next_and_indent, 0), "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "w:\\4ed\\code\\4coder_clipboard.cpp", 32, 141 },
{ PROC_LINKS(place_in_scope, 0), "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 506 },
{ PROC_LINKS(place_in_scope, 0), "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 509 },
{ PROC_LINKS(project_command_lister, 0), "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1527 },
{ PROC_LINKS(project_fkey_command, 0), "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1090 },
{ PROC_LINKS(project_go_to_root_directory, 0), "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1113 },
{ 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\\4coder_base_commands.cpp", 36, 1045 },
{ 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\\4coder_base_commands.cpp", 36, 1069 },
{ 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\\4coder_base_commands.cpp", 36, 1087 },
{ PROC_LINKS(redo, 0), "redo", 4, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1706 },
{ PROC_LINKS(redo_this_buffer, 0), "redo_this_buffer", 16, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1620 },
{ 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\\4coder_base_commands.cpp", 36, 1056 },
{ 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\\4coder_base_commands.cpp", 36, 1080 },
{ 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\\4coder_base_commands.cpp", 36, 1098 },
{ PROC_LINKS(redo, 0), "redo", 4, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1717 },
{ PROC_LINKS(redo_this_buffer, 0), "redo_this_buffer", 16, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1631 },
{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 297 },
{ 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\\4coder_base_commands.cpp", 36, 1227 },
{ 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\\4coder_base_commands.cpp", 36, 1238 },
{ PROC_LINKS(rename_parameter, 0), "rename_parameter", 16, "If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.", 200, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 383 },
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1598 },
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1609 },
{ PROC_LINKS(replace_all_occurrences, 0), "replace_all_occurrences", 23, "Queries the user for two strings, and replaces all occurrences of the first string with the second string in all open buffers.", 126, "w:\\4ed\\code\\4coder_experiments.cpp", 34, 780 },
{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for two strings, and replaces all occurences of the first string in the range between the cursor and the mark with the second string.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 924 },
{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 895 },
{ PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 913 },
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1590 },
{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1131 },
{ 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\\4coder_base_commands.cpp", 36, 1187 },
{ PROC_LINKS(scope_absorb_down, 0), "scope_absorb_down", 17, "If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.", 143, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 747 },
{ PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 888 },
{ PROC_LINKS(search_identifier, 0), "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 902 },
{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for two strings, and replaces all occurences of the first string in the range between the cursor and the mark with the second string.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 935 },
{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 906 },
{ PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 924 },
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1601 },
{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1142 },
{ 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\\4coder_base_commands.cpp", 36, 1198 },
{ PROC_LINKS(scope_absorb_down, 0), "scope_absorb_down", 17, "If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.", 143, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 750 },
{ PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 899 },
{ PROC_LINKS(search_identifier, 0), "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 913 },
{ PROC_LINKS(seek_alphanumeric_left, 0), "seek_alphanumeric_left", 22, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1237 },
{ PROC_LINKS(seek_alphanumeric_or_camel_left, 0), "seek_alphanumeric_or_camel_left", 31, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1249 },
{ PROC_LINKS(seek_alphanumeric_or_camel_right, 0), "seek_alphanumeric_or_camel_right", 32, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1243 },
@ -438,10 +438,10 @@ static Command_Metadata fcoder_metacmd_table[233] = {
{ PROC_LINKS(seek_whitespace_right, 0), "seek_whitespace_right", 21, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1195 },
{ PROC_LINKS(seek_whitespace_up, 0), "seek_whitespace_up", 18, "Seeks the cursor up to the next blank line.", 43, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1090 },
{ PROC_LINKS(seek_whitespace_up_end_line, 0), "seek_whitespace_up_end_line", 27, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1154 },
{ PROC_LINKS(select_all, 0), "select_all", 10, "Puts the cursor at the top of the file, and the mark at the bottom of the file.", 79, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 378 },
{ PROC_LINKS(select_next_scope_absolute, 0), "select_next_scope_absolute", 26, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 387 },
{ PROC_LINKS(select_prev_scope_absolute, 0), "select_prev_scope_absolute", 26, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 407 },
{ PROC_LINKS(select_surrounding_scope, 0), "select_surrounding_scope", 24, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 371 },
{ PROC_LINKS(select_all, 0), "select_all", 10, "Puts the cursor at the top of the file, and the mark at the bottom of the file.", 79, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 389 },
{ PROC_LINKS(select_next_scope_absolute, 0), "select_next_scope_absolute", 26, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 390 },
{ PROC_LINKS(select_prev_scope_absolute, 0), "select_prev_scope_absolute", 26, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 410 },
{ PROC_LINKS(select_surrounding_scope, 0), "select_surrounding_scope", 24, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 374 },
{ PROC_LINKS(set_bindings_choose, 0), "set_bindings_choose", 19, "Remap keybindings using the 'choose' mapping rule.", 50, "w:\\4ed\\code\\4coder_remapping_commands.cpp", 41, 47 },
{ PROC_LINKS(set_bindings_default, 0), "set_bindings_default", 20, "Remap keybindings using the 'default' mapping rule.", 51, "w:\\4ed\\code\\4coder_remapping_commands.cpp", 41, 61 },
{ PROC_LINKS(set_bindings_mac_default, 0), "set_bindings_mac_default", 24, "Remap keybindings using the 'mac-default' mapping rule.", 55, "w:\\4ed\\code\\4coder_remapping_commands.cpp", 41, 75 },
@ -452,29 +452,29 @@ static Command_Metadata fcoder_metacmd_table[233] = {
{ PROC_LINKS(setup_build_bat_and_sh, 0), "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1510 },
{ PROC_LINKS(setup_build_sh, 0), "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1504 },
{ PROC_LINKS(setup_new_project, 0), "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "w:\\4ed\\code\\4coder_project_commands.cpp", 39, 1491 },
{ PROC_LINKS(show_filebar, 0), "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 526 },
{ PROC_LINKS(show_scrollbar, 0), "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 512 },
{ PROC_LINKS(show_filebar, 0), "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 537 },
{ PROC_LINKS(show_scrollbar, 0), "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 523 },
{ PROC_LINKS(snipe_token_or_word, 0), "snipe_token_or_word", 19, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1269 },
{ PROC_LINKS(snipe_token_or_word_right, 0), "snipe_token_or_word_right", 25, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1275 },
{ PROC_LINKS(snippet_lister, 0), "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 248 },
{ PROC_LINKS(suppress_mouse, 0), "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 241 },
{ 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\\4coder_base_commands.cpp", 36, 1550 },
{ PROC_LINKS(to_lowercase, 0), "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 410 },
{ PROC_LINKS(to_uppercase, 0), "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 390 },
{ PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 540 },
{ PROC_LINKS(toggle_fps_meter, 0), "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 558 },
{ 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\\4coder_base_commands.cpp", 36, 1561 },
{ PROC_LINKS(to_lowercase, 0), "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 421 },
{ PROC_LINKS(to_uppercase, 0), "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 401 },
{ PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 551 },
{ PROC_LINKS(toggle_fps_meter, 0), "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 569 },
{ PROC_LINKS(toggle_fullscreen, 0), "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 289 },
{ PROC_LINKS(toggle_highlight_enclosing_scopes, 0), "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 277 },
{ PROC_LINKS(toggle_highlight_line_at_cursor, 0), "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 271 },
{ PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 549 },
{ PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 560 },
{ PROC_LINKS(toggle_mouse, 0), "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 253 },
{ PROC_LINKS(toggle_paren_matching_helper, 0), "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 283 },
{ PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 638 },
{ PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 627 },
{ PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 649 },
{ PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 638 },
{ PROC_LINKS(uncomment_line, 0), "uncomment_line", 14, "If present, delete '//' at the beginning of the line after leading whitespace.", 78, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 46, 147 },
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1634 },
{ PROC_LINKS(undo_this_buffer, 0), "undo_this_buffer", 16, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1608 },
{ 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\\4coder_base_commands.cpp", 36, 1540 },
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1645 },
{ PROC_LINKS(undo_this_buffer, 0), "undo_this_buffer", 16, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1619 },
{ 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\\4coder_base_commands.cpp", 36, 1551 },
{ PROC_LINKS(view_jump_list_with_lister, 0), "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "w:\\4ed\\code\\4coder_jump_lister.cpp", 34, 108 },
{ PROC_LINKS(word_complete, 0), "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "w:\\4ed\\code\\4coder_search.cpp", 29, 958 },
{ PROC_LINKS(write_and_auto_tab, 0), "write_and_auto_tab", 18, "Inserts a character and auto-indents the line on which the cursor sits.", 71, "w:\\4ed\\code\\4coder_auto_indent.cpp", 34, 652 },

View File

@ -143,6 +143,15 @@ set_modify_color_table_hook(Bind_Helper *helper, Modify_Color_Table_Function *fu
write_unit(helper, unit);
}
static void
set_get_view_buffer_region_hook(Bind_Helper *helper, Get_View_Buffer_Region_Function *func){
Binding_Unit unit = {};
unit.type = unit_hook;
unit.hook.hook_id = special_hook_get_view_buffer_region;
unit.hook.func = (void*)func;
write_unit(helper, unit);
}
static void
set_new_file_hook(Bind_Helper *helper, Open_File_Hook_Function *func){
Binding_Unit unit = {};

View File

@ -337,8 +337,11 @@ view_set_to_region(Application_Links *app, View_Summary *view, i32 major_pos, i3
bottom_y = bottom.unwrapped_y;
}
Rect_i32 region = {};
view_get_buffer_region(app, view->view_id, &region);
GUI_Scroll_Vars scroll = view->scroll_vars;
f32 half_view_height = .5f*(f32)(view->file_region.y1 - view->file_region.y0);
f32 half_view_height = .5f*(f32)(rect_height(region));
f32 threshold = normalized_threshold * half_view_height;
f32 current_center_y = ((f32)scroll.target_y) + half_view_height;

View File

@ -968,7 +968,7 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with
Managed_Scope scope = view_get_managed_scope(app, view.view_id);
uint64_t rewrite = 0;
u64 rewrite = 0;
managed_variable_get(app, scope, view_rewrite_loc, &rewrite);
if (rewrite != RewriteWordComplete){
do_init = true;

View File

@ -176,11 +176,12 @@ view_zero_scroll(Application_Links *app, View_Summary *view){
}
static void
view_set_vertical_focus(Application_Links *app, View_Summary *view,
i32 y_top, i32 y_bot){
view_set_vertical_focus(Application_Links *app, View_Summary *view, i32 y_top, i32 y_bot){
Rect_i32 buffer_region = {};
view_get_buffer_region(app, view->view_id, &buffer_region);
GUI_Scroll_Vars scroll = view->scroll_vars;
i32 view_y_top = scroll.target_y;
i32 view_y_dim = view->file_region.y1 - view->file_region.y0;
i32 view_y_dim = rect_height(buffer_region);
i32 view_y_bot = view_y_top + view_y_dim;
i32 line_dim = (i32)view->line_height;
i32 hot_y_top = view_y_top + line_dim*3;
@ -298,7 +299,9 @@ lister_get_clicked_item(Application_Links *app, View_ID view_id, Partition *scra
View_Summary view = {};
get_view_summary(app, view_id, AccessAll, &view);
Mouse_State mouse = get_mouse_state(app);
Vec2_i32 region_p0 = view.file_region.p0;
Rect_i32 buffer_region = {};
view_get_buffer_region(app, view_id, &buffer_region);
Vec2_i32 region_p0 = buffer_region.p0;
Vec2_i32 m_view_space = get_mouse_position_in_view_space(mouse, region_p0, V2i32(view.scroll_vars.scroll_p));
Vec2_i32 m_panel_space = get_mouse_position_in_panel_space(mouse, region_p0);
UI_Item *clicked = ui_control_get_mouse_hit(ui_data, m_view_space, m_panel_space);
@ -337,17 +340,18 @@ lister_update_ui(Application_Links *app, Partition *scratch, View_Summary *view,
b32 is_theme_list = state->lister.data.theme_list;
i32 x0 = 0;
i32 x1 = view->view_region.x1 - view->view_region.x0;
i32 x1 = rect_width(view->view_region);
i32 line_height = lister_get_line_height(view);
i32 block_height = lister_get_block_height(line_height, is_theme_list);
i32 text_field_height = lister_get_text_field_height(view);
Temp_Memory full_temp = begin_temp_memory(scratch);
refresh_view(app, view);
Vec2_i32 view_m = get_mouse_position_in_view_space(app, view->file_region.p0,
V2i32(view->scroll_vars.scroll_p));
Rect_i32 buffer_region = {};
view_get_buffer_region(app, view->view_id, &buffer_region);
Vec2_i32 view_m = get_mouse_position_in_view_space(app, buffer_region.p0, V2i32(view->scroll_vars.scroll_p));
refresh_view(app, view);
i32 y_pos = text_field_height;
state->raw_item_index = -1;

42
4ed.cpp
View File

@ -78,11 +78,11 @@ file_cursor_to_end(System_Functions *system, Models *models, Editing_File *file)
panel != 0;
panel = layout_get_next_open_panel(layout, panel)){
View *view = panel->view;
if (view->file_data.file != file){
if (view->file != file){
continue;
}
Full_Cursor cursor = file_compute_cursor(system, file, seek_pos(pos));
view_set_cursor(system, view, cursor, true);
view_set_cursor(system, models, view, cursor, true);
view->mark = cursor.pos;
}
}
@ -397,6 +397,11 @@ interpret_binding_buffer(Models *models, void *buffer, i32 size){
models->modify_color_table = (Modify_Color_Table_Function*)unit->hook.func;
}break;
case special_hook_get_view_buffer_region:
{
models->get_view_buffer_region = (Get_View_Buffer_Region_Function*)unit->hook.func;
}break;
case special_hook_input_filter:
{
models->input_filter = (Input_Filter_Function*)unit->hook.func;
@ -502,7 +507,6 @@ fill_hardcode_default_style(Color_Table color_table){
color_table.vals[Stag_Highlight_White] = 0xff003a3a;
color_table.vals[Stag_Bar] = 0xFF888888;
color_table.vals[Stag_Bar_Active] = 0xFF666666;
color_table.vals[Stag_Base] = 0xFF000000;
color_table.vals[Stag_Pop1] = 0xFF3C57DC;
color_table.vals[Stag_Pop2] = 0xFFFF0000;
@ -918,9 +922,7 @@ App_Init_Sig(app_init){
// NOTE(allen): setup first panel
{
Panel *panel = layout_initialize(part, &models->layout);
View *new_view = live_set_alloc_view(&models->mem.heap, &models->lifetime_allocator, &models->live_set);
panel->view = new_view;
new_view->panel = panel;
View *new_view = live_set_alloc_view(&models->mem.heap, &models->lifetime_allocator, &models->live_set, panel);
view_set_file(system, models, new_view, models->scratch_buffer);
}
@ -1136,6 +1138,17 @@ App_Step_Sig(app_step){
// NOTE(allen): First frame initialization
if (input->first_step){
if (models->hook_start != 0){
char **files = models->settings.init_files;
i32 files_count = models->settings.init_files_count;
char **flags = models->settings.custom_flags;
i32 flags_count = models->settings.custom_flags_count;
models->hook_start(&models->app_links, files, files_count, flags, flags_count);
}
#if 0
// Open command line files.
char space[512];
String cl_file_name = make_fixed_width_string(space);
@ -1146,8 +1159,7 @@ App_Step_Sig(app_step){
String file_name = {};
Editing_File_Name canon_name = {};
if (get_canon_name(system, make_string_slowly(models->settings.init_files[i]),
&canon_name)){
if (get_canon_name(system, make_string_slowly(models->settings.init_files[i]), &canon_name)){
file_name = canon_name.name;
}
else{
@ -1158,17 +1170,7 @@ App_Step_Sig(app_step){
Buffer_ID id = 0;
create_buffer(&models->app_links, file_name, 0, &id);
}
if (models->hook_start != 0){
char **files = models->settings.init_files;
i32 files_count = models->settings.init_files_count;
char **flags = models->settings.custom_flags;
i32 flags_count = models->settings.custom_flags_count;
models->hook_start(&models->app_links, files, files_count, flags, flags_count);
}
#endif
}
// NOTE(allen): consume event stream
@ -1325,7 +1327,7 @@ App_Step_Sig(app_step){
if (memcmp(scroll_vars, &new_scroll, sizeof(*scroll_vars)) != 0){
if (file_scroll){
view_set_scroll(system, view, new_scroll);
view_set_scroll(system, models, view, new_scroll);
}
else{
*scroll_vars = new_scroll;

View File

@ -47,32 +47,28 @@ fill_buffer_summary(Buffer_Summary *buffer, Editing_File *file, Working_Set *wor
internal void
fill_view_summary(System_Functions *system, View_Summary *view, View *vptr, Live_Views *live_set, Working_Set *working_set){
File_Viewing_Data *data = &vptr->file_data;
block_zero_struct(view);
if (vptr->in_use){
Assert(vptr->file != 0);
view->exists = true;
view->view_id = (i32)(vptr - live_set->views) + 1;
view->line_height = (f32)(vptr->line_height);
view->unwrapped_lines = data->file->settings.unwrapped_lines;
view->show_whitespace = data->show_whitespace;
view->unwrapped_lines = vptr->file->settings.unwrapped_lines;
view->show_whitespace = vptr->show_whitespace;
view->lock_flags = view_get_access_flags(vptr);
view->buffer_id = vptr->file_data.file->id.id;
view->buffer_id = vptr->file->id.id;
Assert(data->file != 0);
File_Edit_Positions edit_pos = view_get_edit_pos(vptr);
view->mark = file_compute_cursor(system, data->file, seek_pos(vptr->mark));
view->cursor = file_compute_cursor(system, data->file, seek_pos(edit_pos.cursor_pos));
view->mark = file_compute_cursor(system, vptr->file, seek_pos(vptr->mark));
view->cursor = file_compute_cursor(system, vptr->file, seek_pos(edit_pos.cursor_pos));
view->preferred_x = vptr->preferred_x;
view->view_region = vptr->panel->rect_inner;
i32_Rect file_region = vptr->file_region;
view->file_region = file_region;
view->render_region = i32R(0, 0, rect_width(file_region), rect_height(file_region));
Rect_i32 region = vptr->panel->rect_inner;
view->view_region = region;
view->render_region = i32R(0, 0, rect_width(region), rect_height(region));
if (vptr->ui_mode){
view->scroll_vars = vptr->ui_scroll;
}
@ -1145,14 +1141,17 @@ Buffer_Get_Token_Range(Application_Links *app, Buffer_ID buffer_id, Cpp_Token **
Models *models = (Models*)app->cmd_context;
Editing_File *file = imp_get_file(models, buffer_id);
Cpp_Token_Array token_array = file->state.token_array;
b32 result = false;
if (file != 0 && token_array.tokens != 0 && file->state.tokens_complete){
*first_token_out = token_array.tokens;
*one_past_last_token_out = token_array.tokens + token_array.count;
return(true);
result = true;
}
*first_token_out = 0;
*one_past_last_token_out = 0;
return(false);
else{
*first_token_out = 0;
*one_past_last_token_out = 0;
}
return(result);
}
// TODO(allen): redocument
@ -1170,12 +1169,15 @@ DOC_SEE(cpp_get_token)
Models *models = (Models*)app->cmd_context;
Editing_File *file = imp_get_file(models, buffer_id);
Cpp_Token_Array token_array = file->state.token_array;
b32 result = false;
if (buffer_api_check_file_and_tokens(file)){
*get_result = cpp_get_token(token_array, pos);
return(true);
result = true;
}
block_zero_struct(get_result);
return(false);
else{
block_zero_struct(get_result);
}
return(result);
}
// TODO(allen): redocument
@ -1189,11 +1191,12 @@ This is useful in cases such as clearing a buffer and refilling it with new cont
*/{
Models *models = (Models*)app->cmd_context;
Editing_File *file = imp_get_file(models, buffer_id);
b32 result = false;
if (buffer_api_check_file(file)){
file_end_file(models, file);
return(true);
result = true;
}
return(false);
return(result);
}
// TODO(allen): redocument
@ -1429,9 +1432,9 @@ DOC_SEE(Buffer_Identifier)
panel != 0;
panel = layout_get_next_open_panel(layout, panel)){
View *view = panel->view;
if (view->file_data.file == file){
if (view->file == file){
Assert(file_node != used);
view->file_data.file = 0;
view->file = 0;
Editing_File *new_file = CastFromMember(Editing_File, main_chain_node, file_node);
view_set_file(system, models, view, new_file);
if (file_node->next != used){
@ -1490,15 +1493,15 @@ Buffer_Reopen(Application_Links *app, Buffer_ID buffer_id, Buffer_Reopen_Flag fl
panel != 0;
panel = layout_get_next_open_panel(layout, panel)){
View *view_it = panel->view;
if (view_it->file_data.file != file){
if (view_it->file != file){
continue;
}
vptrs[vptr_count] = view_it;
File_Edit_Positions edit_pos = view_get_edit_pos(view_it);
Full_Cursor cursor = file_compute_cursor(system, view_it->file_data.file, seek_pos(edit_pos.cursor_pos));
Full_Cursor cursor = file_compute_cursor(system, view_it->file, seek_pos(edit_pos.cursor_pos));
line_numbers[vptr_count] = cursor.line;
column_numbers[vptr_count] = cursor.character;
view_it->file_data.file = models->scratch_buffer;
view_it->file = models->scratch_buffer;
++vptr_count;
}
@ -1509,10 +1512,10 @@ Buffer_Reopen(Application_Links *app, Buffer_ID buffer_id, Buffer_Reopen_Flag fl
for (i32 i = 0; i < vptr_count; ++i){
view_set_file(system, models, vptrs[i], file);
vptrs[i]->file_data.file = file;
vptrs[i]->file = file;
Full_Cursor cursor = file_compute_cursor(system, file, seek_line_char(line_numbers[i], column_numbers[i]));
view_set_cursor(system, vptrs[i], cursor, true);
view_set_cursor(system, models, vptrs[i], cursor, true);
}
*result = BufferReopenResult_Reopened;
@ -1751,9 +1754,7 @@ Panel_Split(Application_Links *app, Panel_ID panel_id, Panel_Split_Orientation o
Panel *new_panel = 0;
if (layout_split_panel(layout, panel, (orientation == PanelSplit_LeftAndRight), &new_panel)){
Live_Views *live_set = &models->live_set;
View *new_view = live_set_alloc_view(&models->mem.heap, &models->lifetime_allocator, live_set);
new_panel->view = new_view;
new_view->panel = new_panel;
View *new_view = live_set_alloc_view(&models->mem.heap, &models->lifetime_allocator, live_set, new_panel);
view_set_file(models->system, models, new_view, models->scratch_buffer);
result = true;
}
@ -1914,6 +1915,18 @@ in the system, the call will fail.)
return(result);
}
API_EXPORT b32
View_Get_Buffer_Region(Application_Links *app, View_ID view_id, Rect_i32 *region_out){
Models *models = (Models*)app->cmd_context;
View *view = imp_get_view(models, view_id);
b32 result = false;
if (view_api_check_view(view)){
*region_out = view_get_file_region(models, view);
result = true;
}
return(result);
}
// TODO(allen): redocument
API_EXPORT b32
View_Set_Active(Application_Links *app, View_ID view_id)
@ -1953,7 +1966,7 @@ DOC_RETURN(returns non-zero on success)
switch (setting){
case ViewSetting_ShowWhitespace:
{
*value_out = view->file_data.show_whitespace;
*value_out = view->show_whitespace;
}break;
case ViewSetting_ShowScrollbar:
@ -1999,7 +2012,7 @@ DOC_SEE(View_Setting_ID)
switch (setting){
case ViewSetting_ShowWhitespace:
{
view->file_data.show_whitespace = value;
view->show_whitespace = value;
}break;
case ViewSetting_ShowScrollbar:
@ -2047,33 +2060,6 @@ If the view_id does not specify a valid view, the returned scope is null.)
return(false);
}
// TODO(allen): redocument
API_EXPORT b32
View_Get_Enclosure_Rect(Application_Links *app, View_ID view_id, i32_Rect *rect_out)
/*
DOC_PARAM(view, The view whose parent rent will be returned.)
DOC_RETURN(The rectangle of the panel containing this view.)
*/{
// TODO(allen): do(remove this from the API and put it in the custom helpers)
// we should just have full tree traversal API for the splits between views.
Models *models = (Models*)app->cmd_context;
View *view = imp_get_view(models, view_id);
if (view_api_check_view(view)){
Panel *panel = view->panel;
Assert(panel != 0);
Panel *parent = panel->parent;
if (parent != 0){
*rect_out = parent->rect_full;
}
else{
*rect_out = panel->rect_full;
}
return(true);
}
block_zero_struct(rect_out);
return(false);
}
// TODO(allen): redocument
API_EXPORT b32
View_Compute_Cursor(Application_Links *app, View_ID view_id, Buffer_Seek seek, Full_Cursor *cursor_out)
@ -2091,7 +2077,7 @@ DOC_SEE(Full_Cursor)
b32 result = false;
if (view_api_check_view(view)){
Editing_File *file = view->file_data.file;
Editing_File *file = view->file;
Assert(file != 0);
if (buffer_api_check_file(file)){
*cursor_out = file_compute_cursor(models->system, file, seek);
@ -2118,14 +2104,13 @@ DOC_SEE(Buffer_Seek)
*/{
Models *models = (Models*)app->cmd_context;
View *view = imp_get_view(models, view_id);
b32 result = false;
if (view_api_check_view(view)){
Editing_File *file = view->file_data.file;
Editing_File *file = view->file;
Assert(file != 0);
if (buffer_api_check_file(file)){
Full_Cursor cursor = file_compute_cursor(models->system, file, seek);
view_set_cursor(models->system, view, cursor, set_preferred_x);
view_set_cursor(models->system, models, view, cursor, set_preferred_x);
result = true;
}
}
@ -2143,14 +2128,13 @@ DOC_SEE(GUI_Scroll_Vars)
*/{
Models *models = (Models*)app->cmd_context;
View *view = imp_get_view(models, view_id);
b32 result = false;
if (view_api_check_view(view)){
Editing_File *file = view->file_data.file;
Editing_File *file = view->file;
Assert(file != 0);
if (buffer_api_check_file(file)){
if (!view->ui_mode){
view_set_scroll(models->system, view, scroll);
view_set_scroll(models->system, models, view, scroll);
}
else{
view->ui_scroll = scroll;
@ -2176,7 +2160,7 @@ DOC_SEE(Buffer_Seek)
b32 result = false;
if (view_api_check_view(view)){
Editing_File *file = view->file_data.file;
Editing_File *file = view->file;
Assert(file != 0);
if (buffer_api_check_file(file)){
if (seek.type != buffer_seek_pos){
@ -2210,7 +2194,7 @@ DOC_SEE(Set_Buffer_Flag)
if (view_api_check_view(view)){
Editing_File *file = working_set_get_active_file(&models->working_set, buffer_id);
if (buffer_api_check_file(file)){
if (file != view->file_data.file){
if (file != view->file){
view_set_file(models->system, models, view, file);
if (!(flags & SetBuffer_KeepOriginalGUI)){
view_quit_ui(models->system, models, view);
@ -2542,7 +2526,7 @@ https://4coder.handmade.network/blogs/p/3412-new_features_p3__memory_management_
}
API_EXPORT Managed_Variable_ID
Managed_Variable_Create(Application_Links *app, char *null_terminated_name, uint64_t default_value)
Managed_Variable_Create(Application_Links *app, char *null_terminated_name, u64 default_value)
/*
DOC_PARAM(null_terminated_name, The unique name for this managed variable.)
DOC_PARAM(default_value, The default value that this variable will have in a scope that has not set this variable.)
@ -2575,7 +2559,7 @@ DOC_SEE(managed_variable_create_or_get_id)
}
API_EXPORT Managed_Variable_ID
Managed_Variable_Create_Or_Get_ID(Application_Links *app, char *null_terminated_name, uint64_t default_value)
Managed_Variable_Create_Or_Get_ID(Application_Links *app, char *null_terminated_name, u64 default_value)
/*
DOC_PARAM(null_terminated_name, The unique name for this managed variable.)
DOC_PARAM(default_value, The default value that this variable will have in a scope that has not set this variable. This parameter is ignored if the variable already exists.)
@ -2593,7 +2577,7 @@ DOC_SEE(managed_variable_get_id)
}
internal b32
get_dynamic_variable__internal(Models *models, Managed_Scope handle, i32 location, uint64_t **ptr_out){
get_dynamic_variable__internal(Models *models, Managed_Scope handle, i32 location, u64 **ptr_out){
Heap *heap = &models->mem.heap;
Dynamic_Variable_Layout *layout = &models->variable_layout;
Dynamic_Workspace *workspace = get_dynamic_workspace(models, handle);
@ -2607,7 +2591,7 @@ get_dynamic_variable__internal(Models *models, Managed_Scope handle, i32 locatio
}
API_EXPORT b32
Managed_Variable_Set(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, uint64_t value)
Managed_Variable_Set(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, u64 value)
/*
DOC_PARAM(scope, A handle to the scope in which the value of the given variable will be set.)
DOC_PARAM(id, The id of the variable to set.)
@ -2625,7 +2609,7 @@ DOC_RETURN(Returns non-zero on success. This call fails if scope does not refer
}
API_EXPORT b32
Managed_Variable_Get(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, uint64_t *value_out)
Managed_Variable_Get(Application_Links *app, Managed_Scope scope, Managed_Variable_ID id, u64 *value_out)
/*
DOC_PARAM(scope, A handle to the scope from which the value of the given variable will be queried.)
DOC_PARAM(id, The id of the variable to get.)
@ -3208,32 +3192,33 @@ DOC_SEE(Mouse_State)
return(models->input->mouse);
}
API_EXPORT i32
Get_Active_Query_Bars(Application_Links *app, View_ID view_id, i32 max_result_count, Query_Bar **result_array)
API_EXPORT b32
Get_Active_Query_Bars(Application_Links *app, View_ID view_id, i32 max_result_count, Query_Bar_Ptr_Array *array_out)
/*
DOC_PARAM(view_id, Specifies the view for which query bars should be retrieved.)
DOC_PARAM(max_result_count, Specifies the number of Query_Bar pointers available in result_array.)
DOC_PARAM(result_array, User-supplied empty array of max_result_count Query_Bar pointers.)
DOC_RETURN(This call returns the number of Query_Bar pointers successfully placed in result_array.)
DOC
(
This call allows the customization layer to inspect the set of active Query_Bar slots for a given
DOC(This call allows the customization layer to inspect the set of active Query_Bar slots for a given
view_id. By convention, the most recent query will be entry 0, the next most recent 1, etc., such
that if you only care about the most recent query bar, you can call Get_Active_Query_Bars with a
max_result_count of 1 and be assured you will get the most recent bar if any exist.
)
max_result_count of 1 and be assured you will get the most recent bar if any exist.)
*/{
i32 result = 0;
Models *models = (Models*)app->cmd_context;
View *view = imp_get_view(models, view_id);
b32 result = false;
if (view != 0){
i32 count = 0;
Query_Bar **ptrs = array_out->ptrs;
for (Query_Slot *slot = view->query_set.used_slot;
slot != 0 && (result < max_result_count);
slot != 0 && (count < max_result_count);
slot = slot->next){
if (slot->query_bar != 0){
result_array[result++] = slot->query_bar;
ptrs[count++] = slot->query_bar;
}
}
array_out->count = count;
result = true;
}
return(result);
}
@ -3246,14 +3231,11 @@ until end_query_bar or the end of the command. It is commonly a good idea to ma
this a pointer to a Query_Bar stored on the stack.)
DOC_PARAM(flags, This parameter is not currently used and should be 0 for now.)
DOC_RETURN(This call returns non-zero on success.)
DOC
(
This call tells the active view to begin displaying a "Query_Bar" which is a small
DOC(This call tells the active view to begin displaying a "Query_Bar" which is a small
GUI element that can overlap a buffer or other 4coder GUI. The contents of the bar
can be changed after the call to start_query_bar and the query bar shown by 4coder
will reflect the change. Since the bar stops showing when the command exits the
only use for this call is in an interactive command that makes calls to get_user_input.
)
only use for this call is in an interactive command that makes calls to get_user_input.)
*/{
Models *models = (Models*)app->cmd_context;
Panel *active_panel = layout_get_active_panel(&models->layout);
@ -4212,7 +4194,7 @@ DOC(Returns a microsecond resolution timestamp.)
internal Vec2
draw_helper__view_space_to_screen_space(Models *models, Vec2 point){
i32_Rect region = models->render_rect;
i32_Rect region = models->render_view_rect;
point.x += (f32)region.x0;
point.y += (f32)region.y0;
return(point);
@ -4220,7 +4202,7 @@ draw_helper__view_space_to_screen_space(Models *models, Vec2 point){
internal f32_Rect
draw_helper__view_space_to_screen_space(Models *models, f32_Rect rect){
i32_Rect region = models->render_rect;
i32_Rect region = models->render_view_rect;
f32 x_corner = (f32)region.x0;
f32 y_corner = (f32)region.y0;
rect.x0 += x_corner;
@ -4245,8 +4227,6 @@ Draw_String(Application_Links *app, Face_ID font_id, String str, Vec2 point, int
}
else{
Color_Table color_table = models->color_table;
//Style *style = &models->styles.styles[0];
//Theme *theme_data = &style->theme;
point = draw_helper__view_space_to_screen_space(models, point);
u32 actual_color = finalize_color(color_table, color);
f32 width = draw_string(models->system, models->target, font_id, str, point, actual_color, flags, delta);
@ -4263,14 +4243,10 @@ Get_String_Advance(Application_Links *app, Face_ID font_id, String str)
}
API_EXPORT void
Draw_Rectangle(Application_Links *app, f32_Rect rect, int_color color)
{
Draw_Rectangle(Application_Links *app, f32_Rect rect, int_color color){
Models *models = (Models*)app->cmd_context;
if (models->render_view != 0){
Color_Table color_table = models->color_table;
//Style *style = &models->styles.styles[0];
//Theme *theme_data = &style->theme;
rect = draw_helper__view_space_to_screen_space(models, rect);
u32 actual_color = finalize_color(color_table, color);
draw_rectangle(models->target, rect, actual_color);
@ -4298,7 +4274,7 @@ Get_Default_Font_For_View(Application_Links *app, View_ID view_id)
{
Models *models = (Models*)app->cmd_context;
View *view = imp_get_view(models, view_id);
Editing_File *file = view->file_data.file;
Editing_File *file = view->file;
Assert(file != 0);
Face_ID face_id = file->settings.font_id;
return(face_id);

View File

@ -56,6 +56,7 @@ struct Models{
Scroll_Rule_Function *scroll_rule;
Buffer_Name_Resolver_Function *buffer_name_resolver;
Modify_Color_Table_Function *modify_color_table;
Get_View_Buffer_Region_Function *get_view_buffer_region;
Color_Table fallback_color_table;
Color_Table color_table;
@ -111,7 +112,8 @@ struct Models{
// Render Context
Render_Target *target;
View *render_view;
i32_Rect render_rect;
i32_Rect render_view_rect;
i32_Rect render_buffer_rect;
Full_Cursor render_cursor;
Range render_range;
Buffer_Render_Item *render_items;

View File

@ -26,7 +26,7 @@ edit_pre_state_change(System_Functions *system, Heap *heap, Models *models, Edit
panel != 0;
panel = layout_get_next_open_panel(layout, panel)){
View *view = panel->view;
if (view->file_data.file == file){
if (view->file == file){
Full_Cursor render_cursor = view_get_render_cursor(system, view);
Full_Cursor target_cursor = view_get_render_cursor_target(system, view);
view->temp_view_top_left_pos = render_cursor.pos;
@ -133,7 +133,7 @@ edit_fix_markers(System_Functions *system, Models *models, Editing_File *file, E
panel != 0;
panel = layout_get_next_open_panel(layout, panel)){
View *view = panel->view;
if (view->file_data.file == file){
if (view->file == file){
File_Edit_Positions edit_pos = view_get_edit_pos(view);
write_cursor_with_index(cursors, &cursor_count, edit_pos.cursor_pos);
write_cursor_with_index(cursors, &cursor_count, view->mark);
@ -180,7 +180,7 @@ edit_fix_markers(System_Functions *system, Models *models, Editing_File *file, E
panel != 0;
panel = layout_get_next_open_panel(layout, panel)){
View *view = panel->view;
if (view->file_data.file == file){
if (view->file == file){
i32 cursor_pos = cursors[cursor_count++].pos;
Full_Cursor new_cursor = file_compute_cursor(system, file, seek_pos(cursor_pos));
@ -215,7 +215,7 @@ edit_fix_markers(System_Functions *system, Models *models, Editing_File *file, E
scroll.target_y = edit_fix_markers__compute_scroll_y(line_height, scroll.target_y, new_y_val_aligned);
}
view_set_cursor_and_scroll(view, new_cursor, true, scroll);
view_set_cursor_and_scroll(models, view, new_cursor, true, scroll);
}
}
@ -461,12 +461,12 @@ edit_clear(System_Functions *system, Models *models, Editing_File *file){
panel != 0;
panel = layout_get_next_open_panel(layout, panel)){
View *view = panel->view;
if (view->file_data.file == file){
if (view->file == file){
Full_Cursor cursor = {};
cursor.line = 1;
cursor.character = 1;
cursor.wrap_line = 1;
view_set_cursor(system, view, cursor, true);
view_set_cursor(system, models, view, cursor, true);
no_views_see_file = false;
}
}

View File

@ -44,12 +44,12 @@ struct Panel{
union{
struct{
i32_Rect rect_full;
i32_Rect rect_inner;
Rect_i32 rect_full;
Rect_i32 rect_inner;
} screen_region;
struct{
i32_Rect rect_full;
i32_Rect rect_inner;
Rect_i32 rect_full;
Rect_i32 rect_inner;
};
};
};

View File

@ -15,7 +15,7 @@ view_get_map(View *view){
return(view->ui_map_id);
}
else{
return(view->file_data.file->settings.base_map_id);
return(view->file->settings.base_map_id);
}
}
@ -25,10 +25,7 @@ view_get_access_flags(View *view){
if (view->ui_mode){
result |= AccessHidden;
}
if (view->file_data.file_locked){
result |= AccessProtected;
}
result |= file_get_access_flags(view->file_data.file);
result |= file_get_access_flags(view->file);
return(result);
}
@ -43,18 +40,19 @@ view_get_id(Live_Views *live_set, View *view){
}
internal View*
live_set_alloc_view(Heap *heap, Lifetime_Allocator *lifetime_allocator, Live_Views *live_set){
live_set_alloc_view(Heap *heap, Lifetime_Allocator *lifetime_allocator, Live_Views *live_set, Panel *panel){
Assert(live_set->count < live_set->max);
++live_set->count;
View *result = live_set->free_sentinel.next;
result->next->prev = result->prev;
result->prev->next = result->next;
dll_remove(result);
block_zero_struct(result);
result->in_use = true;
init_query_set(&result->query_set);
result->lifetime_object = lifetime_alloc_object(heap, lifetime_allocator, DynamicWorkspace_View, result);
panel->view = result;
result->panel = panel;
return(result);
}
@ -83,27 +81,47 @@ view_get_edit_pos(View *view){
internal void
view_set_edit_pos(View *view, File_Edit_Positions edit_pos){
view->edit_pos_ = edit_pos;
view->file_data.file->state.edit_pos_most_recent = edit_pos;
view->file->state.edit_pos_most_recent = edit_pos;
}
////////////////////////////////
internal i32
view_width(View *view){
return(rect_width(view->file_region));
internal Rect_i32
view_get_file_region(Models *models, View *view){
Rect_i32 region = {};
if (models->get_view_buffer_region != 0){
Rect_i32 rect = view->panel->rect_inner;
Rect_i32 sub_region = i32R(0, 0, rect_width(rect), rect_height(rect));
sub_region = models->get_view_buffer_region(&models->app_links, view_get_id(&models->live_set, view), sub_region);
region.p0 = rect.p0 + sub_region.p0;
region.p1 = rect.p0 + sub_region.p1;
region.x1 = clamp_top(region.x1, rect.x1);
region.y1 = clamp_top(region.y1, rect.y1);
region.x0 = clamp_top(region.x0, region.x1);
region.y0 = clamp_top(region.y0, region.y1);
}
else{
region = view->panel->rect_inner;
}
return(region);
}
internal i32
view_height(View *view){
return(rect_height(view->file_region));
view_width(Models *models, View *view){
return(rect_width(view_get_file_region(models, view)));
}
internal i32
view_height(Models *models, View *view){
return(rect_height(view_get_file_region(models, view)));
}
internal Vec2_i32
view_get_cursor_xy(System_Functions *system, View *view){
File_Edit_Positions edit_pos = view_get_edit_pos(view);
Full_Cursor cursor = file_compute_cursor(system, view->file_data.file, seek_pos(edit_pos.cursor_pos));
Full_Cursor cursor = file_compute_cursor(system, view->file, seek_pos(edit_pos.cursor_pos));
Vec2_i32 result = {};
if (view->file_data.file->settings.unwrapped_lines){
if (view->file->settings.unwrapped_lines){
result = V2i32((i32)cursor.unwrapped_x, (i32)cursor.unwrapped_y);
}
else{
@ -113,9 +131,9 @@ view_get_cursor_xy(System_Functions *system, View *view){
}
internal Cursor_Limits
view_cursor_limits(View *view){
view_cursor_limits(Models *models, View *view){
i32 line_height = view->line_height;
i32 visible_height = view_height(view);
i32 visible_height = view_height(models, view);
Cursor_Limits limits = {};
limits.max = visible_height - line_height*3;
limits.min = line_height*2;
@ -135,32 +153,32 @@ view_cursor_limits(View *view){
}
internal i32
view_compute_max_target_y_from_bottom_y(View *view, f32 max_item_y){
view_compute_max_target_y_from_bottom_y(Models *models, View *view, f32 max_item_y){
i32 line_height = view->line_height;
f32 height = clamp_bottom((f32)line_height, view_height(view));
f32 height = clamp_bottom((f32)line_height, view_height(models, view));
f32 max_target_y = clamp_bottom(0.f, max_item_y - height*0.5f);
return(ceil32(max_target_y));
}
internal i32
view_compute_max_target_y(View *view){
view_compute_max_target_y(Models *models, View *view){
i32 line_height = view->line_height;
Editing_File *file = view->file_data.file;
Editing_File *file = view->file;
Gap_Buffer *buffer = &file->state.buffer;
i32 lowest_line = buffer->line_count;
if (!file->settings.unwrapped_lines){
lowest_line = file->state.wrap_line_index[buffer->line_count];
}
return(view_compute_max_target_y_from_bottom_y(view, (lowest_line + 0.5f)*(f32)line_height));
return(view_compute_max_target_y_from_bottom_y(models,view, (lowest_line + 0.5f)*(f32)line_height));
}
////////////////////////////////
internal b32
view_move_view_to_cursor(System_Functions *system, View *view, GUI_Scroll_Vars *scroll){
view_move_view_to_cursor(System_Functions *system, Models *models, View *view, GUI_Scroll_Vars *scroll){
b32 result = false;
i32 max_x = view_width(view);
i32 max_y = view_compute_max_target_y(view);
i32 max_x = view_width(models, view);
i32 max_y = view_compute_max_target_y(models, view);
Vec2_i32 cursor = view_get_cursor_xy(system, view);
@ -168,7 +186,7 @@ view_move_view_to_cursor(System_Functions *system, View *view, GUI_Scroll_Vars *
i32 target_x = scroll_vars.target_x;
i32 target_y = scroll_vars.target_y;
Cursor_Limits limits = view_cursor_limits(view);
Cursor_Limits limits = view_cursor_limits(models, view);
if (cursor.y > target_y + limits.max){
target_y = cursor.y - limits.max + limits.delta;
}
@ -195,8 +213,8 @@ view_move_view_to_cursor(System_Functions *system, View *view, GUI_Scroll_Vars *
}
internal b32
view_move_cursor_to_view(System_Functions *system, View *view, GUI_Scroll_Vars scroll, i32 *pos_in_out, f32 preferred_x){
Editing_File *file = view->file_data.file;
view_move_cursor_to_view(System_Functions *system, Models *models, View *view, GUI_Scroll_Vars scroll, i32 *pos_in_out, f32 preferred_x){
Editing_File *file = view->file;
Full_Cursor cursor = file_compute_cursor(system, file, seek_pos(*pos_in_out));
i32 line_height = view->line_height;
@ -208,9 +226,9 @@ view_move_cursor_to_view(System_Functions *system, View *view, GUI_Scroll_Vars s
old_cursor_y = cursor.wrapped_y;
}
f32 cursor_y = old_cursor_y;
f32 target_y = scroll.target_y + view->widget_height;
f32 target_y = (f32)scroll.target_y;
Cursor_Limits limits = view_cursor_limits(view);
Cursor_Limits limits = view_cursor_limits(models, view);
if (cursor_y > target_y + limits.max){
cursor_y = target_y + limits.max;
@ -238,7 +256,7 @@ view_move_cursor_to_view(System_Functions *system, View *view, GUI_Scroll_Vars s
internal b32
view_has_unwrapped_lines(View *view){
return(view->file_data.file->settings.unwrapped_lines);
return(view->file->settings.unwrapped_lines);
}
internal void
@ -254,12 +272,12 @@ view_set_preferred_x(View *view, Full_Cursor cursor){
internal void
view_set_preferred_x_to_current_position(System_Functions *system, View *view){
File_Edit_Positions edit_pos = view_get_edit_pos(view);
Full_Cursor cursor = file_compute_cursor(system, view->file_data.file, seek_pos(edit_pos.cursor_pos));
Full_Cursor cursor = file_compute_cursor(system, view->file, seek_pos(edit_pos.cursor_pos));
view_set_preferred_x(view, cursor);
}
internal void
view_set_cursor(System_Functions *system, View *view, Full_Cursor cursor, b32 set_preferred_x){
view_set_cursor(System_Functions *system, Models *models, View *view, Full_Cursor cursor, b32 set_preferred_x){
File_Edit_Positions edit_pos = view_get_edit_pos(view);
file_edit_positions_set_cursor(&edit_pos, cursor.pos);
if (set_preferred_x){
@ -267,40 +285,40 @@ view_set_cursor(System_Functions *system, View *view, Full_Cursor cursor, b32 se
}
view_set_edit_pos(view, edit_pos);
GUI_Scroll_Vars scroll = edit_pos.scroll;
if (view_move_view_to_cursor(system, view, &scroll)){
if (view_move_view_to_cursor(system, models, view, &scroll)){
edit_pos.scroll = scroll;
view_set_edit_pos(view, edit_pos);
}
}
internal void
view_set_scroll(System_Functions *system, View *view, GUI_Scroll_Vars scroll){
view_set_scroll(System_Functions *system, Models *models, View *view, GUI_Scroll_Vars scroll){
File_Edit_Positions edit_pos = view_get_edit_pos(view);
file_edit_positions_set_scroll(&edit_pos, scroll, view_compute_max_target_y(view));
file_edit_positions_set_scroll(&edit_pos, scroll, view_compute_max_target_y(models, view));
view_set_edit_pos(view, edit_pos);
i32 pos = edit_pos.cursor_pos;
if (view_move_cursor_to_view(system, view, edit_pos.scroll, &pos, view->preferred_x)){
Full_Cursor cursor = file_compute_cursor(system, view->file_data.file, seek_pos(pos));
if (view_move_cursor_to_view(system, models, view, edit_pos.scroll, &pos, view->preferred_x)){
Full_Cursor cursor = file_compute_cursor(system, view->file, seek_pos(pos));
edit_pos.cursor_pos = cursor.pos;
view_set_edit_pos(view, edit_pos);
}
}
internal void
view_set_cursor_and_scroll(View *view, Full_Cursor cursor, b32 set_preferred_x, GUI_Scroll_Vars scroll){
view_set_cursor_and_scroll(Models *models, View *view, Full_Cursor cursor, b32 set_preferred_x, GUI_Scroll_Vars scroll){
File_Edit_Positions edit_pos = view_get_edit_pos(view);
file_edit_positions_set_cursor(&edit_pos, cursor.pos);
if (set_preferred_x){
view_set_preferred_x(view, cursor);
}
file_edit_positions_set_scroll(&edit_pos, scroll, view_compute_max_target_y(view));
file_edit_positions_set_scroll(&edit_pos, scroll, view_compute_max_target_y(models, view));
edit_pos.last_set_type = EditPos_None;
view_set_edit_pos(view, edit_pos);
}
internal void
view_post_paste_effect(View *view, f32 seconds, i32 start, i32 size, u32 color){
Editing_File *file = view->file_data.file;
Editing_File *file = view->file;
file->state.paste_effect.start = start;
file->state.paste_effect.end = start + size;
file->state.paste_effect.color = color;
@ -314,14 +332,13 @@ internal void
view_set_file(System_Functions *system, Models *models, View *view, Editing_File *file){
Assert(file != 0);
Editing_File *old_file = view->file_data.file;
Editing_File *old_file = view->file;
if (old_file != 0){
file_touch(&models->working_set, old_file);
file_edit_positions_push(old_file, view_get_edit_pos(view));
}
block_zero(&view->file_data, sizeof(view->file_data));
view->file_data.file = file;
view->file = file;
File_Edit_Positions edit_pos = file_edit_positions_pop(file);
view_set_edit_pos(view, edit_pos);
@ -343,7 +360,7 @@ file_is_viewed(Layout *layout, Editing_File *file){
panel != 0;
panel = layout_get_next_open_panel(layout, panel)){
View *view = panel->view;
if (view->file_data.file == file){
if (view->file == file){
is_viewed = true;
break;
}
@ -358,10 +375,10 @@ adjust_views_looking_at_file_to_new_cursor(System_Functions *system, Models *mod
panel != 0;
panel = layout_get_next_open_panel(layout, panel)){
View *view = panel->view;
if (view->file_data.file == file){
if (view->file == file){
File_Edit_Positions edit_pos = view_get_edit_pos(view);
Full_Cursor cursor = file_compute_cursor(system, file, seek_pos(edit_pos.cursor_pos));
view_set_cursor(system, view, cursor, true);
view_set_cursor(system, models, view, cursor, true);
}
}
}
@ -378,7 +395,7 @@ file_full_remeasure(System_Functions *system, Models *models, Editing_File *file
panel != 0;
panel = layout_get_next_open_panel(layout, panel)){
View *view = panel->view;
if (view->file_data.file == file){
if (view->file == file){
view->line_height = font.metrics->height;
}
}
@ -781,7 +798,7 @@ internal void
render_loaded_file_in_view__inner(Models *models, Render_Target *target, View *view,
i32_Rect rect, Full_Cursor render_cursor, Range on_screen_range,
Buffer_Render_Item *items, i32 item_count){
Editing_File *file = view->file_data.file;
Editing_File *file = view->file;
Partition *part = &models->mem.part;
Color_Table color_table = models->color_table;
@ -975,7 +992,7 @@ render_loaded_file_in_view__inner(Models *models, Render_Target *target, View *v
char_color = ghost_color;
}
if (view->file_data.show_whitespace && highlight_color == 0 && codepoint_is_whitespace(item->codepoint)){
if (view->show_whitespace && highlight_color == 0 && codepoint_is_whitespace(item->codepoint)){
highlight_this_color = color_table.vals[Stag_Highlight_White];
}
else{
@ -1186,18 +1203,20 @@ do_core_render(Application_Links *app){
Models *models = (Models*)app->cmd_context;
Render_Target *target = models->target;
View *view = models->render_view;
i32_Rect rect = models->render_rect;
i32_Rect rect = models->render_buffer_rect;
Full_Cursor render_cursor = models->render_cursor;
Range on_screen_range = models->render_range;
Buffer_Render_Item *items = models->render_items;
i32 item_count = models->render_item_count;
draw_push_clip(target, rect);
render_loaded_file_in_view__inner(models, target, view, rect, render_cursor, on_screen_range, items, item_count);
draw_pop_clip(target);
}
internal Full_Cursor
view_get_render_cursor(System_Functions *system, View *view, f32 scroll_y){
Full_Cursor result = {};
Editing_File *file = view->file_data.file;
Editing_File *file = view->file;
if (file->settings.unwrapped_lines){
result = file_compute_cursor_hint(system, file, seek_unwrapped_xy(0, scroll_y, false));
}
@ -1211,10 +1230,7 @@ internal Full_Cursor
view_get_render_cursor(System_Functions *system, View *view){
File_Edit_Positions edit_pos = view_get_edit_pos(view);
f32 scroll_y = edit_pos.scroll.scroll_y;
// NOTE(allen): For now we will temporarily adjust scroll_y to try
// to prevent the view moving around until floating sections are added
// to the gui system.
scroll_y += view->widget_height;
//scroll_y += view->widget_height;
return(view_get_render_cursor(system, view, scroll_y));
}
@ -1222,10 +1238,7 @@ internal Full_Cursor
view_get_render_cursor_target(System_Functions *system, View *view){
File_Edit_Positions edit_pos = view_get_edit_pos(view);
f32 scroll_y = (f32)edit_pos.scroll.target_y;
// NOTE(allen): For now we will temporarily adjust scroll_y to try
// to prevent the view moving around until floating sections are added
// to the gui system.
scroll_y += view->widget_height;
//scroll_y += view->widget_height;
return(view_get_render_cursor(system, view, scroll_y));
}
@ -1236,7 +1249,8 @@ view_call_render_caller(Models *models, Render_Target *target, View *view,
if (models->render_caller != 0){
View_ID view_id = view_get_id(&models->live_set, view);
models->render_view = view;
models->render_rect = rect;
models->render_view_rect = view->panel->rect_inner;
models->render_buffer_rect = rect;
models->render_cursor = render_cursor;
models->render_range = on_screen_range;
models->render_items = items;
@ -1256,7 +1270,7 @@ view_call_render_caller(Models *models, Render_Target *target, View *view,
internal void
render_loaded_file_in_view(System_Functions *system, View *view, Models *models, i32_Rect rect, b32 is_active, Render_Target *target){
Editing_File *file = view->file_data.file;
Editing_File *file = view->file;
i32 line_height = view->line_height;
f32 max_x = (f32)file->settings.display_width;
@ -1284,18 +1298,8 @@ render_loaded_file_in_view(System_Functions *system, View *view, Models *models,
f32 scroll_x = edit_pos.scroll.scroll_x;
f32 scroll_y = edit_pos.scroll.scroll_y;
// NOTE(allen): For now we will temporarily adjust scroll_y to try
// to prevent the view moving around until floating sections are added
// to the gui system.
scroll_y += view->widget_height;
Full_Cursor render_cursor = view_get_render_cursor(system, view);
#if 0
// TODO(allen): do(eliminate scroll_i nonsense)
view->edit_pos_.scroll_i = render_cursor.pos;
#endif
i32 item_count = 0;
i32 end_pos = 0;
{
@ -1306,7 +1310,7 @@ render_loaded_file_in_view(System_Functions *system, View *view, Models *models,
params.count = &item_count;
params.port_x = (f32)rect.x0 + left_side_space;
params.port_y = (f32)rect.y0;
params.clip_w = view_width(view) - left_side_space;
params.clip_w = view_width(models, view) - left_side_space;
params.scroll_x = scroll_x;
params.scroll_y = scroll_y;
params.width = max_x;

View File

@ -12,25 +12,15 @@
#if !defined(FRED_VIEW_H)
#define FRED_VIEW_H
struct File_Viewing_Data{
Editing_File *file;
b32 show_whitespace;
b32 file_locked;
};
struct View{
struct View *next;
struct View *prev;
struct Panel *panel;
b32 in_use;
File_Viewing_Data file_data;
Editing_File *file;
Lifetime_Object *lifetime_object;
i32_Rect file_region_prev;
i32_Rect file_region;
i32_Rect scroll_region;
File_Edit_Positions edit_pos_;
i32 mark;
f32 preferred_x;
@ -47,6 +37,7 @@ struct View{
b32 hide_scrollbar;
b32 hide_file_bar;
b32 show_whitespace;
// misc
@ -55,7 +46,9 @@ struct View{
i32 line_height;
Query_Set query_set;
#if 0
f32 widget_height;
#endif
};
struct Live_Views{

View File

@ -11,43 +11,9 @@
////////////////////////////////
global_const Style_Color_Edit colors_to_edit[] = {
{Stag_Back, Stag_Default, Stag_Back, lit("Background")},
{Stag_Margin, Stag_Default, Stag_Margin, lit("Margin")},
{Stag_Margin_Hover, Stag_Default, Stag_Margin_Hover, lit("Margin Hover")},
{Stag_Margin_Active, Stag_Default, Stag_Margin_Active, lit("Margin Active")},
{Stag_Cursor, Stag_At_Cursor, Stag_Cursor, lit("Cursor")},
{Stag_At_Cursor, Stag_At_Cursor, Stag_Cursor, lit("Text At Cursor")},
{Stag_Mark, Stag_Mark, Stag_Back, lit("Mark")},
{Stag_Highlight, Stag_At_Highlight, Stag_Highlight, lit("Highlight")},
{Stag_At_Highlight, Stag_At_Highlight, Stag_Highlight, lit("Text At Highlight")},
{Stag_Default, Stag_Default, Stag_Back, lit("Text Default")},
{Stag_Comment, Stag_Comment, Stag_Back, lit("Comment")},
{Stag_Keyword, Stag_Keyword, Stag_Back, lit("Keyword")},
{Stag_Str_Constant, Stag_Str_Constant, Stag_Back, lit("String Constant")},
{Stag_Char_Constant, Stag_Char_Constant, Stag_Back, lit("Character Constant")},
{Stag_Int_Constant, Stag_Int_Constant, Stag_Back, lit("Integer Constant")},
{Stag_Float_Constant, Stag_Float_Constant, Stag_Back, lit("Float Constant")},
{Stag_Bool_Constant, Stag_Bool_Constant, Stag_Back, lit("Boolean Constant")},
{Stag_Preproc, Stag_Preproc, Stag_Back, lit("Preprocessor")},
{Stag_Special_Character, Stag_Special_Character, Stag_Back, lit("Special Character")},
{Stag_Highlight_Junk, Stag_Default, Stag_Highlight_Junk, lit("Junk Highlight")},
{Stag_Highlight_White, Stag_Default, Stag_Highlight_White, lit("Whitespace Highlight")},
{Stag_Paste, Stag_Paste, Stag_Back, lit("Paste Color")},
{Stag_Bar, Stag_Base, Stag_Bar, lit("Bar")},
{Stag_Base, Stag_Base, Stag_Bar, lit("Bar Text")},
{Stag_Pop1, Stag_Pop1, Stag_Bar, lit("Bar Pop 1")},
{Stag_Pop2, Stag_Pop2, Stag_Bar, lit("Bar Pop 2")},
};
internal GUI_Scroll_Vars
do_step_file_view(System_Functions *system, Models *models, View *view, i32_Rect rect, b32 is_active, f32 dt, GUI_Scroll_Vars scroll){
#if 0
i32 line_height = view->line_height;
if (!view->hide_file_bar){
@ -65,8 +31,9 @@ do_step_file_view(System_Functions *system, Models *models, View *view, i32_Rect
slot != 0;
slot = slot->next, ++bar_count);
view->widget_height = (f32)bar_count*(view->line_height + 2);
#endif
Editing_File *file = view->file_data.file;
Editing_File *file = view->file;
// TODO(allen): do(eliminate the built in paste_effect)
if (!file->is_loading && file->state.paste_effect.seconds_down > 0.f){
@ -128,7 +95,7 @@ draw_file_bar(System_Functions *system, Render_Target *target, View *view, Model
}
else{
File_Edit_Positions edit_pos = view_get_edit_pos(view);
Full_Cursor cursor = file_compute_cursor(system, view->file_data.file, seek_pos(edit_pos.cursor_pos));
Full_Cursor cursor = file_compute_cursor(system, view->file, seek_pos(edit_pos.cursor_pos));
char bar_space[526];
String bar_text = make_fixed_width_string(bar_space);
@ -173,77 +140,17 @@ draw_file_bar(System_Functions *system, Render_Target *target, View *view, Model
}
}
#if 0
internal u32
get_margin_color(Color_Table color_table, i32 level){
u32 margin = 0;
switch (level){
default:
case UIActivation_None:
{
margin = color_table.vals[Stag_List_Item];
}break;
case UIActivation_Hover:
{
margin = color_table.vals[Stag_List_Item_Hover];
}break;
case UIActivation_Active:
{
margin = color_table.vals[Stag_List_Item_Active];
}break;
}
return(margin);
}
#endif
internal void
do_render_file_view(System_Functions *system, View *view, Models *models, GUI_Scroll_Vars *scroll, View *active, i32_Rect rect, b32 is_active, Render_Target *target){
Editing_File *file = view->file_data.file;
Editing_File *file = view->file;
Assert(file != 0);
i32 line_height = view->line_height;
Color_Table color_table = models->color_table;
Face_ID font_id = file->settings.font_id;
char font_name_space[256];
String font_name = make_fixed_width_string(font_name_space);
font_name.size = system->font.get_name_by_id(font_id, font_name.str, font_name.memory_size);
if (!view->hide_file_bar){
i32_Rect top_bar_rect = {};
top_bar_rect.x0 = rect.x0;
top_bar_rect.y0 = rect.y0;
top_bar_rect.x1 = rect.x1;
top_bar_rect.y1 = rect.y0 + line_height + 2;
rect.y0 = top_bar_rect.y1;
draw_file_bar(system, target, view, models, file, top_bar_rect);
}
i32 bar_count = 0;
for (Query_Slot *slot = view->query_set.used_slot;
slot != 0;
slot = slot->next, ++bar_count){
i32_Rect query_bar_rect = {};
query_bar_rect.x0 = rect.x0;
query_bar_rect.y0 = rect.y0;
query_bar_rect.x1 = rect.x1;
query_bar_rect.y1 = rect.y0 + line_height + 2;
rect.y0 = query_bar_rect.y1;
u32 back_color = color_table.vals[Stag_Back];
u32 text1_color = color_table.vals[Stag_Default];
u32 text2_color = color_table.vals[Stag_Pop1];
Vec2 p = V2(query_bar_rect.p0);
p.y += 2.f;
draw_rectangle(target, query_bar_rect, back_color);
p.x += draw_string(system, target, font_id, slot->query_bar->prompt, p, text2_color);
draw_string(system, target, font_id, slot->query_bar->string, p, text1_color);
}
view->widget_height = (f32)bar_count*(view->line_height + 2);
draw_push_clip(target, rect);
if (!view->ui_mode){
if (file_is_ready(file)){
render_loaded_file_in_view(system, view, models, rect, is_active, target);
Rect_i32 file_region = view_get_file_region(models, view);
render_loaded_file_in_view(system, view, models, file_region, is_active, target);
}
}
else{
@ -252,112 +159,6 @@ do_render_file_view(System_Functions *system, View *view, Models *models, GUI_Sc
view_call_render_caller(models, target, view, rect, render_cursor, on_screen_range, 0, 0, dont_do_core_render);
}
#if 0
f32_Rect rect_f32 = f32R(rect);
i32 item_count = view->ui_control.count;
UI_Item *item = view->ui_control.items;
GUI_Scroll_Vars ui_scroll = view->ui_scroll;
for (i32 i = 0; i < item_count; ++i, item += 1){
f32_Rect item_rect = f32R(item->rectangle);
switch (item->coordinates){
case UICoordinates_ViewSpace:
{
item_rect.x0 += rect_f32.x0 - ui_scroll.scroll_x;
item_rect.y0 += rect_f32.y0 - ui_scroll.scroll_y;
item_rect.x1 += rect_f32.x0 - ui_scroll.scroll_x;
item_rect.y1 += rect_f32.y0 - ui_scroll.scroll_y;
}break;
case UICoordinates_PanelSpace:
{
item_rect.x0 += rect_f32.x0;
item_rect.y0 += rect_f32.y0;
item_rect.x1 += rect_f32.x0;
item_rect.y1 += rect_f32.y0;
}break;
}
if (rect_overlap(item_rect, rect_f32)){
switch (item->type){
case UIType_Option:
{
u32 back = color_table.vals[Stag_Back];
u32 text_color = color_table.vals[Stag_Default];
u32 pop_color = color_table.vals[Stag_Pop2];
u32 margin_color = get_margin_color(color_table, item->activation_level);
f32_Rect inner = get_inner_rect(item_rect, 3);
draw_rectangle(target, inner, back);
Vec2 p = V2(inner.p0) + V2(3.f, line_height*0.5f - 1.f);
p.x += draw_string(system, target, font_id, item->option.string, p, text_color);
p.x += font_string_width(system, target, font_id, make_lit_string(" "));
draw_string(system, target, font_id, item->option.status, p, pop_color);
draw_margin(target, item_rect, inner, margin_color);
}break;
case UIType_TextField:
{
u32 back = color_table.vals[Stag_Back];
u32 text1 = color_table.vals[Stag_Default];
u32 text2 = color_table.vals[Stag_Pop1];
draw_rectangle(target, item_rect, back);
Vec2 p = V2(item_rect.p0) + V2(0.f, 2.f);
p.x += draw_string(system, target, font_id, item->text_field.query, p, text2);
p.x += font_string_width(system, target, font_id, make_lit_string(" "));
p.x += draw_string(system, target, font_id, item->text_field.string, p, text1);
}break;
// TODO(allen): figure out how this should work again later
case UIType_ColorTheme:
{}break;
#if 0
case UIType_ColorTheme:
{
Style *style_preview = &models->styles.styles[item->color_theme.index];
u32 margin_color = get_margin_color(style_preview, item->activation_level);
u32 back = style_preview->theme.colors[Stag_Back];
u32 text_color = style_preview->theme.colors[Stag_Default];
u32 keyword_color = style_preview->theme.colors[Stag_Keyword];
u32 int_constant_color = style_preview->theme.colors[Stag_Int_Constant];
u32 comment_color = style_preview->theme.colors[Stag_Comment];
f32_Rect inner = get_inner_rect(item_rect, 3);
draw_margin(target, item_rect, inner, margin_color);
draw_rectangle(target, inner, back);
Vec2 p = V2(inner.p0);
String str = item->color_theme.string;
if (str.str == 0){
str = style_preview->name;
}
p.x += draw_string(system, target, font_id, str, p, text_color);
f32 font_x = inner.x1 - font_string_width(system, target, font_id, font_name);
if (font_x > p.x + 10.f){
draw_string(system, target, font_id, font_name, V2(font_x, p.y), text_color);
}
Font_Pointers font = system->font.get_pointers_by_id(font_id);
i32 height = font.metrics->height;
p = V2(inner.x0, p.y + (f32)height);
p.x += draw_string(system, target, font_id, "if", p, keyword_color);
p.x += draw_string(system, target, font_id, "(x < ", p, text_color);
p.x += draw_string(system, target, font_id, "0", p, int_constant_color);
p.x += draw_string(system, target, font_id, ") { x = ", p, text_color);
p.x += draw_string(system, target, font_id, "0", p, int_constant_color);
p.x += draw_string(system, target, font_id, "; } ", p, text_color);
p.x += draw_string(system, target, font_id, "// comment", p, comment_color);
p = V2(inner.x0, p.y + (f32)height);
draw_string(system, target, font_id, "[] () {}; * -> +-/ <>= ! && || % ^", p, text_color);
}break;
#endif
}
}
}
#endif
draw_pop_clip(target);
}

View File

@ -1595,7 +1595,7 @@ space in dest this call returns non-zero.) */{
}
API_EXPORT FSTRING_LINK i32_4tech
u64_to_str_size(uint64_t x)/*
u64_to_str_size(u64_4tech x)/*
DOC(This call returns the number of bytes required to represent x as a string.) */{
i32_4tech size = 1;
x /= 10;
@ -1607,7 +1607,7 @@ DOC(This call returns the number of bytes required to represent x as a string.)
}
API_EXPORT FSTRING_LINK b32_4tech
u64_to_str(String *dest, uint64_t x)/*
u64_to_str(String *dest, u64_4tech x)/*
DOC(This call writes a string representation of x into dest. If there is enough
space in dest this call returns non-zero.) */{
b32_4tech result = 1;
@ -1646,7 +1646,7 @@ space in dest this call returns non-zero.) */{
}
API_EXPORT FSTRING_LINK b32_4tech
append_u64_to_str(String *dest, uint64_t x)/*
append_u64_to_str(String *dest, u64_4tech x)/*
DOC(This call appends a string representation of x onto dest. If there is enough
space in dest this call returns non-zero.) */{
String last_part = tailstr(*dest);