Remove all markers visual code

master
Allen Webster 2019-07-31 20:28:43 -07:00
parent 1f81120343
commit e60f115ebe
9 changed files with 64 additions and 876 deletions

View File

@ -815,11 +815,6 @@ get_page_jump(Application_Links *app, View_Summary *view){
return(get_page_jump(app, view==0?0:view->view_id));
}
static void
isearch__update_highlight(Application_Links *app, View_Summary *view, Managed_Object highlight, i32 start, i32 end){
isearch__update_highlight(app, view==0?0:view->view_id, highlight, Ii64(start, end));
}
static void
get_view_prev(Application_Links *app, View_Summary *view, Access_Flag access){
View_ID new_id = get_view_prev(app, view->view_id, access);

View File

@ -871,14 +871,16 @@ CUSTOM_DOC("Queries the user for a number, and jumps the cursor to the correspon
CUSTOM_COMMAND_SIG(search);
CUSTOM_COMMAND_SIG(reverse_search);
#if 0
static void
isearch__update_highlight(Application_Links *app, View_ID view, Managed_Object highlight, Range_i64 range){
Marker markers[4] = {};
markers[0].pos = (i32)range.start;
markers[1].pos = (i32)range.end;
managed_object_store_data(app, highlight, 0, 2, markers);
view_set_cursor(app, view, seek_pos(range.start), false);
view_set_cursor(app, view, seek_pos(range.start), true);
}
#endif
static void
isearch(Application_Links *app, b32 start_reversed, String_Const_u8 query_init, b32 on_the_query_init_string){
@ -913,6 +915,8 @@ isearch(Application_Links *app, b32 start_reversed, String_Const_u8 query_init,
b32 first_step = true;
// TODO(allen): rewrite
#if 0
Managed_Scope view_scope = view_get_managed_scope(app, view);
Managed_Object highlight = alloc_buffer_markers_on_buffer(app, buffer, 2, &view_scope);
Marker_Visual visual = create_marker_visual(app, highlight);
@ -923,6 +927,7 @@ isearch(Application_Links *app, b32 start_reversed, String_Const_u8 query_init,
marker_visual_set_view_key(app, visual, view);
marker_visual_set_priority(app, visual, VisualPriority_Default + 1);
isearch__update_highlight(app, view, highlight, match);
#endif
cursor_is_hidden = true;
User_Input in = {};
@ -1059,11 +1064,15 @@ isearch(Application_Links *app, b32 start_reversed, String_Const_u8 query_init,
}
if (!suppress_highligh_update){
#if 0
isearch__update_highlight(app, view, highlight, match);
#endif
}
}
#if 0
managed_object_free(app, highlight);
#endif
cursor_is_hidden = false;
if (in.abort){
@ -1189,11 +1198,13 @@ query_replace_base(Application_Links *app, View_ID view, Buffer_ID buffer_id, i6
i64 new_pos = 0;
buffer_seek_string_forward(app, buffer_id, pos - 1, 0, r, &new_pos);
#if 0
Managed_Scope view_scope = view_get_managed_scope(app, view);
Managed_Object highlight = alloc_buffer_markers_on_buffer(app, buffer_id, 2, &view_scope);
Marker_Visual visual = create_marker_visual(app, highlight);
marker_visual_set_effect(app, visual, VisualType_CharacterHighlightRanges, Stag_Highlight, Stag_At_Highlight, 0);
marker_visual_set_view_key(app, visual, view);
#endif
cursor_is_hidden = true;
i64 buffer_size = buffer_get_size(app, buffer_id);
@ -1201,7 +1212,9 @@ query_replace_base(Application_Links *app, View_ID view, Buffer_ID buffer_id, i6
User_Input in = {};
for (;new_pos < buffer_size;){
Range_i64 match = Ii64(new_pos, new_pos + r.size);
#if 0
isearch__update_highlight(app, view, highlight, match);
#endif
in = get_user_input(app, EventOnAnyKey, EventOnMouseLeftButton|EventOnMouseRightButton);
if (in.abort || in.key.keycode == key_esc || !key_is_unmodified(&in.key)) break;
@ -1218,7 +1231,9 @@ query_replace_base(Application_Links *app, View_ID view, Buffer_ID buffer_id, i6
buffer_seek_string_forward(app, buffer_id, pos, 0, r, &new_pos);
}
#if 0
managed_object_free(app, highlight);
#endif
cursor_is_hidden = false;
if (in.abort){

View File

@ -98,14 +98,6 @@ struct Application_Links;
#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)
#define CREATE_MARKER_VISUAL_SIG(n) Marker_Visual n(Application_Links *app, Managed_Object object)
#define MARKER_VISUAL_SET_EFFECT_SIG(n) b32 n(Application_Links *app, Marker_Visual visual, Marker_Visual_Type type, int_color color, int_color text_color, Marker_Visual_Text_Style text_style)
#define MARKER_VISUAL_SET_TAKE_RULE_SIG(n) b32 n(Application_Links *app, Marker_Visual visual, Marker_Visual_Take_Rule take_rule)
#define MARKER_VISUAL_SET_PRIORITY_SIG(n) b32 n(Application_Links *app, Marker_Visual visual, Marker_Visual_Priority_Level priority)
#define MARKER_VISUAL_SET_VIEW_KEY_SIG(n) b32 n(Application_Links *app, Marker_Visual visual, View_ID key_view_id)
#define DESTROY_MARKER_VISUAL_SIG(n) b32 n(Application_Links *app, Marker_Visual visual)
#define BUFFER_MARKERS_GET_ATTACHED_VISUAL_COUNT_SIG(n) i32 n(Application_Links *app, Managed_Object object)
#define BUFFER_MARKERS_GET_ATTACHED_VISUAL_SIG(n) Marker_Visual* n(Application_Links *app, Arena *arena, Managed_Object object)
#define MANAGED_OBJECT_GET_ITEM_SIZE_SIG(n) u32 n(Application_Links *app, Managed_Object object)
#define MANAGED_OBJECT_GET_ITEM_COUNT_SIG(n) u32 n(Application_Links *app, Managed_Object object)
#define MANAGED_OBJECT_GET_TYPE_SIG(n) Managed_Object_Type n(Application_Links *app, Managed_Object object)
@ -280,14 +272,6 @@ typedef MANAGED_VARIABLE_GET_SIG(Managed_Variable_Get_Function);
typedef ALLOC_MANAGED_MEMORY_IN_SCOPE_SIG(Alloc_Managed_Memory_In_Scope_Function);
typedef ALLOC_BUFFER_MARKERS_ON_BUFFER_SIG(Alloc_Buffer_Markers_On_Buffer_Function);
typedef ALLOC_MANAGED_ARENA_IN_SCOPE_SIG(Alloc_Managed_Arena_In_Scope_Function);
typedef CREATE_MARKER_VISUAL_SIG(Create_Marker_Visual_Function);
typedef MARKER_VISUAL_SET_EFFECT_SIG(Marker_Visual_Set_Effect_Function);
typedef MARKER_VISUAL_SET_TAKE_RULE_SIG(Marker_Visual_Set_Take_Rule_Function);
typedef MARKER_VISUAL_SET_PRIORITY_SIG(Marker_Visual_Set_Priority_Function);
typedef MARKER_VISUAL_SET_VIEW_KEY_SIG(Marker_Visual_Set_View_Key_Function);
typedef DESTROY_MARKER_VISUAL_SIG(Destroy_Marker_Visual_Function);
typedef BUFFER_MARKERS_GET_ATTACHED_VISUAL_COUNT_SIG(Buffer_Markers_Get_Attached_Visual_Count_Function);
typedef BUFFER_MARKERS_GET_ATTACHED_VISUAL_SIG(Buffer_Markers_Get_Attached_Visual_Function);
typedef MANAGED_OBJECT_GET_ITEM_SIZE_SIG(Managed_Object_Get_Item_Size_Function);
typedef MANAGED_OBJECT_GET_ITEM_COUNT_SIG(Managed_Object_Get_Item_Count_Function);
typedef MANAGED_OBJECT_GET_TYPE_SIG(Managed_Object_Get_Type_Function);
@ -464,14 +448,6 @@ Managed_Variable_Get_Function *managed_variable_get;
Alloc_Managed_Memory_In_Scope_Function *alloc_managed_memory_in_scope;
Alloc_Buffer_Markers_On_Buffer_Function *alloc_buffer_markers_on_buffer;
Alloc_Managed_Arena_In_Scope_Function *alloc_managed_arena_in_scope;
Create_Marker_Visual_Function *create_marker_visual;
Marker_Visual_Set_Effect_Function *marker_visual_set_effect;
Marker_Visual_Set_Take_Rule_Function *marker_visual_set_take_rule;
Marker_Visual_Set_Priority_Function *marker_visual_set_priority;
Marker_Visual_Set_View_Key_Function *marker_visual_set_view_key;
Destroy_Marker_Visual_Function *destroy_marker_visual;
Buffer_Markers_Get_Attached_Visual_Count_Function *buffer_markers_get_attached_visual_count;
Buffer_Markers_Get_Attached_Visual_Function *buffer_markers_get_attached_visual;
Managed_Object_Get_Item_Size_Function *managed_object_get_item_size;
Managed_Object_Get_Item_Count_Function *managed_object_get_item_count;
Managed_Object_Get_Type_Function *managed_object_get_type;
@ -647,14 +623,6 @@ Managed_Variable_Get_Function *managed_variable_get_;
Alloc_Managed_Memory_In_Scope_Function *alloc_managed_memory_in_scope_;
Alloc_Buffer_Markers_On_Buffer_Function *alloc_buffer_markers_on_buffer_;
Alloc_Managed_Arena_In_Scope_Function *alloc_managed_arena_in_scope_;
Create_Marker_Visual_Function *create_marker_visual_;
Marker_Visual_Set_Effect_Function *marker_visual_set_effect_;
Marker_Visual_Set_Take_Rule_Function *marker_visual_set_take_rule_;
Marker_Visual_Set_Priority_Function *marker_visual_set_priority_;
Marker_Visual_Set_View_Key_Function *marker_visual_set_view_key_;
Destroy_Marker_Visual_Function *destroy_marker_visual_;
Buffer_Markers_Get_Attached_Visual_Count_Function *buffer_markers_get_attached_visual_count_;
Buffer_Markers_Get_Attached_Visual_Function *buffer_markers_get_attached_visual_;
Managed_Object_Get_Item_Size_Function *managed_object_get_item_size_;
Managed_Object_Get_Item_Count_Function *managed_object_get_item_count_;
Managed_Object_Get_Type_Function *managed_object_get_type_;
@ -838,14 +806,6 @@ app_links->managed_variable_get_ = Managed_Variable_Get;\
app_links->alloc_managed_memory_in_scope_ = Alloc_Managed_Memory_In_Scope;\
app_links->alloc_buffer_markers_on_buffer_ = Alloc_Buffer_Markers_On_Buffer;\
app_links->alloc_managed_arena_in_scope_ = Alloc_Managed_Arena_In_Scope;\
app_links->create_marker_visual_ = Create_Marker_Visual;\
app_links->marker_visual_set_effect_ = Marker_Visual_Set_Effect;\
app_links->marker_visual_set_take_rule_ = Marker_Visual_Set_Take_Rule;\
app_links->marker_visual_set_priority_ = Marker_Visual_Set_Priority;\
app_links->marker_visual_set_view_key_ = Marker_Visual_Set_View_Key;\
app_links->destroy_marker_visual_ = Destroy_Marker_Visual;\
app_links->buffer_markers_get_attached_visual_count_ = Buffer_Markers_Get_Attached_Visual_Count;\
app_links->buffer_markers_get_attached_visual_ = Buffer_Markers_Get_Attached_Visual;\
app_links->managed_object_get_item_size_ = Managed_Object_Get_Item_Size;\
app_links->managed_object_get_item_count_ = Managed_Object_Get_Item_Count;\
app_links->managed_object_get_type_ = Managed_Object_Get_Type;\
@ -1021,14 +981,6 @@ static b32 managed_variable_get(Application_Links *app, Managed_Scope scope, Man
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));}
static Marker_Visual create_marker_visual(Application_Links *app, Managed_Object object){return(app->create_marker_visual(app, object));}
static b32 marker_visual_set_effect(Application_Links *app, Marker_Visual visual, Marker_Visual_Type type, int_color color, int_color text_color, Marker_Visual_Text_Style text_style){return(app->marker_visual_set_effect(app, visual, type, color, text_color, text_style));}
static b32 marker_visual_set_take_rule(Application_Links *app, Marker_Visual visual, Marker_Visual_Take_Rule take_rule){return(app->marker_visual_set_take_rule(app, visual, take_rule));}
static b32 marker_visual_set_priority(Application_Links *app, Marker_Visual visual, Marker_Visual_Priority_Level priority){return(app->marker_visual_set_priority(app, visual, priority));}
static b32 marker_visual_set_view_key(Application_Links *app, Marker_Visual visual, View_ID key_view_id){return(app->marker_visual_set_view_key(app, visual, key_view_id));}
static b32 destroy_marker_visual(Application_Links *app, Marker_Visual visual){return(app->destroy_marker_visual(app, visual));}
static i32 buffer_markers_get_attached_visual_count(Application_Links *app, Managed_Object object){return(app->buffer_markers_get_attached_visual_count(app, object));}
static Marker_Visual* buffer_markers_get_attached_visual(Application_Links *app, Arena *arena, Managed_Object object){return(app->buffer_markers_get_attached_visual(app, arena, object));}
static u32 managed_object_get_item_size(Application_Links *app, Managed_Object object){return(app->managed_object_get_item_size(app, object));}
static u32 managed_object_get_item_count(Application_Links *app, Managed_Object object){return(app->managed_object_get_item_count(app, object));}
static Managed_Object_Type managed_object_get_type(Application_Links *app, Managed_Object object){return(app->managed_object_get_type(app, object));}
@ -1204,14 +1156,6 @@ static b32 managed_variable_get(Application_Links *app, Managed_Scope scope, Man
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));}
static Marker_Visual create_marker_visual(Application_Links *app, Managed_Object object){return(app->create_marker_visual_(app, object));}
static b32 marker_visual_set_effect(Application_Links *app, Marker_Visual visual, Marker_Visual_Type type, int_color color, int_color text_color, Marker_Visual_Text_Style text_style){return(app->marker_visual_set_effect_(app, visual, type, color, text_color, text_style));}
static b32 marker_visual_set_take_rule(Application_Links *app, Marker_Visual visual, Marker_Visual_Take_Rule take_rule){return(app->marker_visual_set_take_rule_(app, visual, take_rule));}
static b32 marker_visual_set_priority(Application_Links *app, Marker_Visual visual, Marker_Visual_Priority_Level priority){return(app->marker_visual_set_priority_(app, visual, priority));}
static b32 marker_visual_set_view_key(Application_Links *app, Marker_Visual visual, View_ID key_view_id){return(app->marker_visual_set_view_key_(app, visual, key_view_id));}
static b32 destroy_marker_visual(Application_Links *app, Marker_Visual visual){return(app->destroy_marker_visual_(app, visual));}
static i32 buffer_markers_get_attached_visual_count(Application_Links *app, Managed_Object object){return(app->buffer_markers_get_attached_visual_count_(app, object));}
static Marker_Visual* buffer_markers_get_attached_visual(Application_Links *app, Arena *arena, Managed_Object object){return(app->buffer_markers_get_attached_visual_(app, arena, object));}
static u32 managed_object_get_item_size(Application_Links *app, Managed_Object object){return(app->managed_object_get_item_size_(app, object));}
static u32 managed_object_get_item_count(Application_Links *app, Managed_Object object){return(app->managed_object_get_item_count_(app, object));}
static Managed_Object_Type managed_object_get_type(Application_Links *app, Managed_Object object){return(app->managed_object_get_type_(app, object));}

View File

@ -347,37 +347,37 @@ static Command_Metadata fcoder_metacmd_table[237] = {
{ 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, 840 },
{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 848 },
{ 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, 856 },
{ 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, 1078 },
{ 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, 1084 },
{ 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, 1090 },
{ 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, 1101 },
{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for a needle and string. Replaces all occurences of needle with string in the range between cursor and the mark in the active buffer.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1152 },
{ PROC_LINKS(replace_in_buffer, 0), "replace_in_buffer", 17, "Queries the user for a needle and string. Replaces all occurences of needle with string in the active buffer.", 109, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1161 },
{ PROC_LINKS(replace_in_all_buffers, 0), "replace_in_all_buffers", 22, "Queries the user for a needle and string. Replaces all occurences of needle with string in all editable buffers.", 112, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1170 },
{ 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, 1263 },
{ 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, 1283 },
{ 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, 1299 },
{ 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, 1334 },
{ 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, 1359 },
{ 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, 1397 },
{ 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, 1432 },
{ 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, 1472 },
{ 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, 1505 },
{ 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, 1511 },
{ 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, 1517 },
{ 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, 1531 },
{ 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, 1596 },
{ 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, 1628 },
{ 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, 1641 },
{ 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, 1653 },
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1687 },
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1695 },
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1707 },
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1765 },
{ PROC_LINKS(redo, 0), "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1778 },
{ PROC_LINKS(undo_all_buffers, 0), "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1792 },
{ PROC_LINKS(redo_all_buffers, 0), "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1866 },
{ 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, 1969 },
{ 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, 1087 },
{ 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, 1093 },
{ 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, 1099 },
{ 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, 1110 },
{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for a needle and string. Replaces all occurences of needle with string in the range between cursor and the mark in the active buffer.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1161 },
{ PROC_LINKS(replace_in_buffer, 0), "replace_in_buffer", 17, "Queries the user for a needle and string. Replaces all occurences of needle with string in the active buffer.", 109, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1170 },
{ PROC_LINKS(replace_in_all_buffers, 0), "replace_in_all_buffers", 22, "Queries the user for a needle and string. Replaces all occurences of needle with string in all editable buffers.", 112, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1179 },
{ 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, 1278 },
{ 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, 1298 },
{ 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, 1314 },
{ 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, 1349 },
{ 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, 1374 },
{ 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, 1412 },
{ 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, 1447 },
{ 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, 1487 },
{ 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, 1520 },
{ 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, 1526 },
{ 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, 1532 },
{ 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, 1546 },
{ 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, 1611 },
{ 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, 1643 },
{ 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, 1656 },
{ 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, 1668 },
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1702 },
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1710 },
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1722 },
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1780 },
{ PROC_LINKS(redo, 0), "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1793 },
{ PROC_LINKS(undo_all_buffers, 0), "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1807 },
{ PROC_LINKS(redo_all_buffers, 0), "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1881 },
{ 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, 1984 },
{ PROC_LINKS(lister__quit, 0), "lister__quit", 12, "A lister mode command that quits the list without executing any actions.", 72, "w:\\4ed\\code\\4coder_lists.cpp", 28, 8 },
{ PROC_LINKS(lister__activate, 0), "lister__activate", 16, "A lister mode command that activates the list's action on the highlighted item.", 79, "w:\\4ed\\code\\4coder_lists.cpp", 28, 15 },
{ PROC_LINKS(lister__write_character, 0), "lister__write_character", 23, "A lister mode command that dispatches to the lister's write character handler.", 78, "w:\\4ed\\code\\4coder_lists.cpp", 28, 30 },
@ -425,16 +425,16 @@ static Command_Metadata fcoder_metacmd_table[237] = {
{ 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, 88 },
{ 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, 103 },
{ 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, 120 },
{ 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, 365 },
{ 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, 392 },
{ PROC_LINKS(goto_next_jump_sticky, 0), "goto_next_jump_sticky", 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_sticky.cpp", 34, 491 },
{ 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, 508 },
{ 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, 521 },
{ 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, 538 },
{ PROC_LINKS(goto_first_jump_sticky, 0), "goto_first_jump_sticky", 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_sticky.cpp", 34, 552 },
{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 569 },
{ 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, 591 },
{ PROC_LINKS(newline_or_goto_position_same_panel_sticky, 0), "newline_or_goto_position_same_panel_sticky", 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_sticky.cpp", 34, 608 },
{ 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, 368 },
{ 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, 395 },
{ PROC_LINKS(goto_next_jump_sticky, 0), "goto_next_jump_sticky", 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_sticky.cpp", 34, 494 },
{ 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, 511 },
{ 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, 524 },
{ 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, 541 },
{ PROC_LINKS(goto_first_jump_sticky, 0), "goto_first_jump_sticky", 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_sticky.cpp", 34, 555 },
{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 34, 572 },
{ 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, 594 },
{ PROC_LINKS(newline_or_goto_position_same_panel_sticky, 0), "newline_or_goto_position_same_panel_sticky", 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_sticky.cpp", 34, 611 },
{ 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, 104 },
{ 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, 19 },
{ 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, 28 },

View File

@ -172,8 +172,11 @@ init_marker_list(Application_Links *app, Heap *heap, Buffer_ID buffer, Marker_Li
managed_object_store_data(app, marker_handle, 0, total_jump_count, markers);
if (is_compilation_buffer){
// TODO(allen): replace
#if 0
Marker_Visual visual = create_marker_visual(app, marker_handle);
marker_visual_set_effect(app, visual, VisualType_LineHighlights, Stag_Highlight_Junk, 0, 0);
#endif
}
end_temp(marker_temp);

View File

@ -2418,221 +2418,6 @@ get_dynamic_object_ptrs(Models *models, Managed_Object object){
return(result);
}
internal Marker_Visual_Data*
get_marker_visual_pointer(Models *models, Marker_Visual visual){
Dynamic_Workspace *workspace = get_dynamic_workspace(models, visual.scope);
Marker_Visual_Data *result = 0;
if (workspace != 0){
result = dynamic_workspace_get_visual_pointer(workspace, visual.slot_id, visual.gen_id);
}
return(result);
}
API_EXPORT Marker_Visual
Create_Marker_Visual(Application_Links *app, Managed_Object object)
/*
DOC_PARAM(object, A handle to the marker object on which the new visual will be attached.)
DOC_RETURN(Returns the handle to the newly created marker visual on success, and zero on failure. This call fails when object does not refer to a valid marker object.)
DOC(A marker visual adds graphical effects to markers such as cursors, highlight ranges, text colors, etc. A marker object can have any number of attached visuals. The memory in the 4coder core for visuals is stored in the same scope as the object.)
DOC_SEE(destroy_marker_visuals)
*/
{
Models *models = (Models*)app->cmd_context;
Managed_Object_Ptr_And_Workspace object_ptrs = get_dynamic_object_ptrs(models, object);
Marker_Visual visual = {};
if (object_ptrs.header != 0 && object_ptrs.header->type == ManagedObjectType_Markers){
Heap *heap = &models->mem.heap;
Dynamic_Workspace *workspace = object_ptrs.workspace;
Marker_Visual_Data *data = dynamic_workspace_alloc_visual(heap, &workspace->mem_bank, workspace);
Managed_Buffer_Markers_Header *markers = (Managed_Buffer_Markers_Header*)object_ptrs.header;
zdll_push_back(markers->visual_first, markers->visual_last, data);
markers->visual_count += 1;
data->owner_object = object;
marker_visual_defaults(data);
visual.scope = workspace->scope_id;
visual.slot_id = data->slot_id;
visual.gen_id = data->gen_id;
}
return(visual);
}
API_EXPORT b32
Marker_Visual_Set_Effect(Application_Links *app, Marker_Visual visual, Marker_Visual_Type type, int_color color, int_color text_color, Marker_Visual_Text_Style text_style)
/*
DOC_PARAM(visual, A handle to the marker visual to be modified by this call.)
DOC_PARAM(type, The new type of visual effect this marker visual will create.)
DOC_PARAM(color, The new color aspect of the effect, exact meaning depends on the type.)
DOC_PARAM(text_color, The new text color aspect of the effect, exact meaning depends on the type.)
DOC_PARAM(text_style, This feature is not yet implemented and the parameter should always be 0.)
DOC_RETURN(Returns non-zero on success, and zero on failure. This call fails when the visual handle does not refer to a valid marker visual.)
DOC(Each effect type uses the color and text_color aspects differently. These aspects can be specified as 32-bit colors, or as "symbolic coloes" which are special values small enough that their alpha channels would be zero as 32-bit color codes. Valid symbolic color values have special rules for evaluation, and sometimes their meaning depends on the effect type too.)
DOC_SEE(Marker_Visuals_Type)
DOC_SEE(Marker_Visuals_Symbolic_Color)
*/
{
Models *models = (Models*)app->cmd_context;
Marker_Visual_Data *data = get_marker_visual_pointer(models, visual);
b32 result = false;
if (data != 0){
data->type = type;
data->color = color;
data->text_color = text_color;
data->text_style = text_style;
result = true;
}
return(result);
}
API_EXPORT b32
Marker_Visual_Set_Take_Rule(Application_Links *app, Marker_Visual visual, Marker_Visual_Take_Rule take_rule)
/*
DOC_PARAM(visual, A handle to the marker visual to be modified by this call.)
DOC_PARAM(take_rule, The new take rule for the marker visual.)
DOC_RETURN(Returns non-zero on success, and zero on failure. This call fails when the visual handle does not refer to a valid marker visual.)
DOC(Marker visuals have take rules so that they do not necessarily effect every marker in the marker object they were created to visualize. The take rule can effect the start of the run of markers, the total number of markers, and the stride of the markers, "taken" by this visual when applying it's effect. The word "take" should not be thought of as reserving a marker to the particular marker visual, multiple visuals may add effects to a single marker. See the documentation for Marker_Visual_Take_Rule for specifics about how the take rule can be configured.)
DOC_SEE(Marker_Visual_Take_Rule)
*/
{
Models *models = (Models*)app->cmd_context;
Marker_Visual_Data *data = get_marker_visual_pointer(models, visual);
b32 result = false;
if (data != 0){
Assert(take_rule.take_count_per_step != 0);
take_rule.first_index = clamp_bot(0, take_rule.first_index);
take_rule.take_count_per_step = clamp_bot(1, take_rule.take_count_per_step);
take_rule.step_stride_in_marker_count = clamp_bot(take_rule.take_count_per_step, take_rule.step_stride_in_marker_count);
data->take_rule = take_rule;
if (data->take_rule.maximum_number_of_markers != 0){
i32 whole_steps = take_rule.maximum_number_of_markers/take_rule.take_count_per_step;
i32 extra_in_last = take_rule.maximum_number_of_markers%take_rule.take_count_per_step;
whole_steps = whole_steps + (extra_in_last > 0?1:0);
data->one_past_last_take_index = take_rule.first_index + whole_steps*take_rule.step_stride_in_marker_count + extra_in_last;
}
else{
data->one_past_last_take_index = max_i32;
}
result = true;
}
return(result);
}
API_EXPORT b32
Marker_Visual_Set_Priority(Application_Links *app, Marker_Visual visual, Marker_Visual_Priority_Level priority)
/*
DOC_PARAM(visual, A handle to the marker visual to be modified by this call.)
DOC_PARAM(priority, The new priority level for this marker visual.)
DOC_RETURN(Returns non-zero on success, and zero on failure. This call fails when the visual handle does not refer to a valid marker visual.)
DOC(Multiple visuals effecting the same position, whether they are on the same marker object, or different marker objects, are sorted by their priority level, so that higher priority levels are displayed when they are in conflict with lower priority levels. Some effects have implicit priorities over other effects which does not take priority level into account, other effects may occur in the same position without being considered "in conflict". See the documentation for each effect for more information these relationships.)
*/
{
Models *models = (Models*)app->cmd_context;
Marker_Visual_Data *data = get_marker_visual_pointer(models, visual);
b32 result = false;
if (data != 0){
data->priority = priority;
result = true;
}
return(result);
}
API_EXPORT b32
Marker_Visual_Set_View_Key(Application_Links *app, Marker_Visual visual, View_ID key_view_id)
/*
DOC_PARAM(visual, A handle to the marker visual to be modified by this call.)
DOC_PARAM(key_view_id, The new value of the marker visual's view keying.)
DOC_RETURN(Returns non-zero on success, and zero on failure. This call fails when the visual handle does notrefer to a valid marker visual.)
DOC(View keying allows a marker visual to declare that it only appears in one view. For instance, if a buffer is opened in two views side-by-side, and each view has it's own cursor position, this can be used to make sure that the cursor for one view does not appear in the other view.)
*/
{
Models *models = (Models*)app->cmd_context;
Marker_Visual_Data *data = get_marker_visual_pointer(models, visual);
b32 result = false;
if (data != 0){
data->key_view_id = key_view_id;
result = true;
}
return(result);
}
API_EXPORT b32
Destroy_Marker_Visual(Application_Links *app, Marker_Visual visual)
/*
DOC_PARAM(visual, A handle to the marker visual to be destroyed.)
DOC_RETURN(Returns non-zero on success, and zero on failure. This call fails when the visual handle does not refer to a valid marker visual.)
*/
{
Models *models = (Models*)app->cmd_context;
Dynamic_Workspace *workspace = get_dynamic_workspace(models, visual.scope);
b32 result = false;
if (workspace != 0){
Marker_Visual_Data *data = dynamic_workspace_get_visual_pointer(workspace, visual.slot_id, visual.gen_id);
if (data != 0){
void *ptr = dynamic_workspace_get_pointer(workspace, data->owner_object&max_u32);
Managed_Object_Standard_Header *header = (Managed_Object_Standard_Header*)ptr;
if (header != 0){
Assert(header->type == ManagedObjectType_Markers);
Managed_Buffer_Markers_Header *markers = (Managed_Buffer_Markers_Header*)header;
zdll_remove(markers->visual_first, markers->visual_last, data);
markers->visual_count -= 1;
marker_visual_free(&workspace->visual_allocator, data);
result = true;
}
}
}
return(result);
}
API_EXPORT i32
Buffer_Markers_Get_Attached_Visual_Count(Application_Links *app, Managed_Object object)
/*
DOC_PARAM(object, The handle to the marker object to be queried.)
DOC_RETURN(Returns the number of marker visuals that are currently attached to the given object. If the object handle does not refer to a valid marker object, then this call returns zero.)
*/
{
Models *models = (Models*)app->cmd_context;
Managed_Object_Ptr_And_Workspace object_ptrs = get_dynamic_object_ptrs(models, object);
i32 result = 0;
if (object_ptrs.header != 0 && object_ptrs.header->type == ManagedObjectType_Markers){
Managed_Buffer_Markers_Header *markers = (Managed_Buffer_Markers_Header*)object_ptrs.header;
result = markers->visual_count;
}
return(result);
}
// TODO(allen): redocument
API_EXPORT Marker_Visual*
Buffer_Markers_Get_Attached_Visual(Application_Links *app, Arena *arena, Managed_Object object)
/*
DOC_PARAM(part, The arena to be used to allocate the returned array.)
DOC_PARAM(object, The handle to the marker object to be queried.)
DOC_RETURN(Pushes an array onto part containing the handle to every marker visual attached to this object, and returns the pointer to it's base. If the object does not refer to a valid marker object or there is not enough space in part to allocate the array, then a null pointer is returned.)
*/
{
Models *models = (Models*)app->cmd_context;
Managed_Object_Ptr_And_Workspace object_ptrs = get_dynamic_object_ptrs(models, object);
if (object_ptrs.header != 0 && object_ptrs.header->type == ManagedObjectType_Markers){
Managed_Buffer_Markers_Header *markers = (Managed_Buffer_Markers_Header*)object_ptrs.header;
i32 count = markers->visual_count;
Marker_Visual *visual = push_array(arena, Marker_Visual, count);
if (visual != 0){
Marker_Visual *v = visual;
Managed_Scope scope = object_ptrs.workspace->scope_id;
for (Marker_Visual_Data *data = markers->visual_first;
data != 0;
data = data->next, v += 1){
v->scope = scope;
v->slot_id = data->slot_id;
v->gen_id = data->gen_id;
}
Assert(v == visual + count);
}
return(visual);
}
return(0);
}
API_EXPORT u32
Managed_Object_Get_Item_Size(Application_Links *app, Managed_Object object)
/*

View File

@ -462,263 +462,6 @@ finalize_color(Color_Table color_table, int_color color){
return(color_argb);
}
internal Render_Marker_List
get_visual_markers(Arena *arena, Dynamic_Workspace *workspace, Range range, Buffer_ID buffer_id, i32 view_index, Color_Table color_table){
Render_Marker_List list = {};
View_ID view_id = view_index + 1;
for (Managed_Buffer_Markers_Header *node = workspace->buffer_markers_list.first;
node != 0;
node = node->next){
if (node->buffer_id != buffer_id) continue;
for (Marker_Visual_Data *data = node->visual_first;
data != 0;
data = data->next){
if (data->type == VisualType_Invisible) continue;
if (data->key_view_id != 0 && data->key_view_id != view_id) continue;
Marker_Visual_Type type = data->type;
i32 take_count_per_step = data->take_rule.take_count_per_step;
i32 step_stride_in_marker_count = data->take_rule.step_stride_in_marker_count;
i32 stride_size_from_last = step_stride_in_marker_count - take_count_per_step;
i32 priority = data->priority;
Render_Marker_Brush brush = {};
brush.color_noop = (data->color == 0);
brush.text_color_noop = (data->text_color == 0);
if (!brush.color_noop){
brush.color = finalize_color(color_table, data->color);
}
if (!brush.text_color_noop){
brush.text_color = finalize_color(color_table, data->text_color);
}
Marker *markers = (Marker*)(node + 1);
Assert(sizeof(*markers) == node->std_header.item_size);
i32 count = node->std_header.count;
i32 one_past_last_index = clamp_top(data->one_past_last_take_index, count);
Marker *marker_one_past_last = markers + one_past_last_index;
Marker *marker = markers + data->take_rule.first_index;
switch (type){
default:
{
for (;marker < marker_one_past_last; marker += stride_size_from_last){
for (i32 i = 0;
i < take_count_per_step && marker < marker_one_past_last;
marker += 1, i += 1){
if (range.first <= marker->pos && marker->pos <= range.one_past_last){
Render_Marker_Node *new_node = push_array(arena, Render_Marker_Node, 1);
sll_queue_push(list.first, list.last, new_node);
list.count += 1;
new_node->render_marker.type = type;
new_node->render_marker.pos = marker->pos;
new_node->render_marker.brush = brush;
new_node->render_marker.one_past_last = marker->pos;
new_node->render_marker.priority = priority;
}
}
}
}break;
case VisualType_CharacterHighlightRanges:
case VisualType_LineHighlightRanges:
{
i32 pos_pair[2] = {};
i32 pair_index = 0;
for (;marker < marker_one_past_last; marker += stride_size_from_last){
for (i32 i = 0;
i < take_count_per_step && marker < marker_one_past_last;
marker += 1, i += 1){
pos_pair[pair_index++] = marker->pos;
if (pair_index == 2){
pair_index = 0;
Range range_b = {};
range_b.first = pos_pair[0];
range_b.one_past_last = pos_pair[1];
if (range_b.first == range_b.one_past_last) continue;
if (range_b.first > range_b.one_past_last){
Swap(i32, range_b.first, range_b.one_past_last);
}
if (!((range.min - range_b.max <= 0) && (range.max - range_b.min >= 0))) {
continue;
}
Render_Marker_Node *new_node = push_array(arena, Render_Marker_Node, 1);
sll_queue_push(list.first, list.last, new_node);
list.count += 1;
new_node->render_marker.type = type;
new_node->render_marker.pos = range_b.min;
new_node->render_marker.brush = brush;
new_node->render_marker.one_past_last = range_b.max;
new_node->render_marker.priority = priority;
}
}
}
}break;
}
}
}
return(list);
}
internal i32
marker_type_to_segment_rank(Marker_Visual_Type type){
switch (type){
case VisualType_LineHighlights:
{
return(1);
}break;
case VisualType_CharacterHighlightRanges:
{
return(2);
}break;
case VisualType_LineHighlightRanges:
{
return(3);
}break;
}
return(0);
}
global_const i32 max_visual_type_rank = 3;
internal i32
split_sort(Render_Marker *markers, i32 first, i32 one_past_last, i32 min_in_high_segment){
i32 i1 = first;
i32 i0 = one_past_last - 1;
for (;;){
for (;i1 < one_past_last &&
marker_type_to_segment_rank(markers[i1].type) < min_in_high_segment;
i1 += 1);
for (;i0 >= 0 &&
marker_type_to_segment_rank(markers[i0].type) >= min_in_high_segment;
i0 -= 1);
if (i1 < i0){
Swap(Render_Marker, markers[i0], markers[i1]);
}
else{
break;
}
}
return(i1);
}
internal void
visual_markers_segment_sort(Render_Marker *markers, i32 first, i32 one_past_last, Range *ranges_out){
i32 pos = first;
for (i32 i = 0; i < max_visual_type_rank; i += 1){
ranges_out[i].first = pos;
pos = split_sort(markers, pos, one_past_last, i + 1);
ranges_out[i].one_past_last = pos;
}
ranges_out[max_visual_type_rank].first = pos;
ranges_out[max_visual_type_rank].one_past_last = one_past_last;
}
internal void
visual_markers_quick_sort(Render_Marker *markers, i32 first, i32 one_past_last){
if (first + 1 < one_past_last){
i32 pivot_index = one_past_last - 1;
{
b32 go_left = false;
i32 pivot_key = markers[pivot_index].pos;
i32 j = first;
for (i32 i = first; i < pivot_index; i += 1){
i32 key = markers[i].pos;
b32 swap_in = false;
if (key < pivot_key){
swap_in = true;
}
else if (key == pivot_key){
if (go_left){
swap_in = true;
}
go_left = !go_left;
}
if (swap_in){
Swap(Render_Marker, markers[i], markers[j]);
j += 1;
}
}
Swap(Render_Marker, markers[j], markers[pivot_index]);
pivot_index = j;
}
visual_markers_quick_sort(markers, first, pivot_index);
visual_markers_quick_sort(markers, pivot_index + 1, one_past_last);
}
}
internal void
visual_markers_replace_pos_with_first_byte_of_line(Render_Marker_Array markers, i32 *line_starts, i32 line_count, i32 hint_line_index){
if (markers.count > 0){
Assert(0 <= hint_line_index && hint_line_index < line_count);
i32 marker_scan_index = 0;
for (i32 line_scan_index = hint_line_index;; line_scan_index += 1){
Assert(line_scan_index < line_count);
i32 look_ahead_line_index = line_scan_index + 1;
i32 first_byte_index_of_next_line = 0;
if (look_ahead_line_index < line_count){
first_byte_index_of_next_line = line_starts[look_ahead_line_index];
}
else{
first_byte_index_of_next_line = max_i32;
}
i32 first_byte_index_of_this_line = line_starts[line_scan_index];
for (;(marker_scan_index < markers.count &&
markers.markers[marker_scan_index].pos < first_byte_index_of_next_line);
marker_scan_index += 1){
markers.markers[marker_scan_index].pos = first_byte_index_of_this_line;
}
if (marker_scan_index == markers.count){
break;
}
}
}
}
internal i32
range_record_stack_get_insert_index(Render_Range_Record *records, i32 count, i32 priority){
i32 insert_pos = 0;
i32 first = 0;
i32 one_past_last = count + 1;
for (;;){
if (first + 1 >= one_past_last){
insert_pos = first;
break;
}
i32 mid = (first + one_past_last)/2;
// i - 1 is too big?
b32 too_big = false;
if (mid > 0){
if (records[mid - 1].priority > priority){
too_big = true;
}
}
// i is too small?
b32 too_small = false;
if (!too_big && mid < count){
if (records[mid].priority <= priority){
too_small = true;
}
}
// bisect
if (too_big){
one_past_last = mid;
}
else if (too_small){
first = mid + 1;
}
else{
insert_pos = mid;
break;
}
}
return(insert_pos);
}
internal u32
get_token_color(Color_Table color_table, Cpp_Token token){
u32 result = 0;
@ -768,26 +511,6 @@ get_token_color(Color_Table color_table, Cpp_Token token){
return(result);
}
internal Render_Marker_Brush
render__get_brush_from_range_stack(Render_Range_Record *stack, i32 stack_top){
Render_Marker_Brush brush = {true, true};
Render_Range_Record *record = &stack[stack_top];
for (i32 i = stack_top; i >= 0; i -= 1, record -= 1){
if (brush.color_noop && !record->brush.color_noop){
brush.color_noop = false;
brush.color = record->brush.color;
}
if (brush.text_color_noop && !record->brush.text_color_noop){
brush.text_color_noop = false;
brush.text_color = record->brush.text_color;
}
if (!brush.color_noop && !brush.text_color_noop){
break;
}
}
return(brush);
}
internal void
render_loaded_file_in_view__inner(Models *models, Render_Target *target, View *view,
Rect_i32 rect, Full_Cursor render_cursor, Range on_screen_range,
@ -806,76 +529,6 @@ render_loaded_file_in_view__inner(Models *models, Render_Target *target, View *v
b32 wrapped = !file->settings.unwrapped_lines;
Face_ID font_id = file->settings.font_id;
#if 0
// NOTE(allen): Get visual markers
Render_Marker_List markers_list = {};
{
Lifetime_Object *lifetime_object = file->lifetime_object;
Buffer_ID buffer_id = file->id.id;
i32 view_index = view_get_index(&models->live_set, view);
Render_Marker_List list = get_visual_markers(scratch, &lifetime_object->workspace, on_screen_range, buffer_id, view_index, color_table);
sll_queue_push_multiple(markers_list.first, markers_list.last, list.first, list.last);
markers_list.count += list.count;
i32 key_count = lifetime_object->key_count;
i32 key_index = 0;
for (Lifetime_Key_Ref_Node *node = lifetime_object->key_node_first;
node != 0;
node = node->next){
i32 local_count = clamp_top(lifetime_key_reference_per_node, key_count - key_index);
for (i32 i = 0; i < local_count; i += 1){
Lifetime_Key *key = node->keys[i];
list = get_visual_markers(scratch, &key->dynamic_workspace, on_screen_range, buffer_id, view_index, color_table);
sll_queue_push_multiple(markers_list.first, markers_list.last, list.first, list.last);
markers_list.count += list.count;
}
key_index += local_count;
}
}
Render_Marker_Array markers = {};
markers.count = markers_list.count;
markers.markers = push_array(scratch, Render_Marker, markers.count);
i32 marker_index = 0;
for (Render_Marker_Node *node = markers_list.first;
node != 0;
node = node->next){
markers.markers[marker_index] = node->render_marker;
marker_index += 1;
}
// NOTE(allen): Sort visual markers by position
Range marker_segments[4];
visual_markers_segment_sort(markers.markers, 0, markers.count, marker_segments);
for (i32 i = 0; i < ArrayCount(marker_segments); i += 1){
visual_markers_quick_sort(markers.markers, marker_segments[i].first, marker_segments[i].one_past_last);
}
Render_Marker_Array character_markers = {};
character_markers.markers = markers.markers + marker_segments[0].first;
character_markers.count = marker_segments[0].one_past_last - marker_segments[0].first;
Render_Marker_Array line_markers = {};
line_markers.markers = markers.markers + marker_segments[1].first;
line_markers.count = marker_segments[1].one_past_last - marker_segments[1].first;
Render_Marker_Array range_markers = {};
range_markers.markers = markers.markers + marker_segments[2].first;
range_markers.count = marker_segments[2].one_past_last - marker_segments[2].first;
Render_Marker_Array line_range_markers = {};
line_range_markers.markers = markers.markers + marker_segments[3].first;
line_range_markers.count = marker_segments[3].one_past_last - marker_segments[3].first;
Render_Range_Record *range_stack = push_array(scratch, Render_Range_Record, range_markers.count);
i32 range_stack_top = -1;
Render_Range_Record *line_range_stack = push_array(scratch, Render_Range_Record, line_range_markers.count);
i32 line_range_stack_top = -1;
#endif
i32 *line_starts = file->state.buffer.line_starts;
i32 line_count = file->state.buffer.line_count;
i32 line_scan_index = (i32)render_cursor.line - 1;
@ -901,11 +554,6 @@ render_loaded_file_in_view__inner(Models *models, Render_Target *target, View *v
first_byte_index_of_next_wrap = max_i32;
}
#if 0
visual_markers_replace_pos_with_first_byte_of_line(line_markers, line_starts, line_count, line_scan_index);
visual_markers_replace_pos_with_first_byte_of_line(line_range_markers, line_starts, line_count, line_scan_index);
#endif
i32 visual_markers_scan_index = 0;
i32 visual_line_markers_scan_index = 0;
@ -1018,183 +666,21 @@ render_loaded_file_in_view__inner(Models *models, Render_Target *target, View *v
highlight_this_color = highlight_color;
}
#if 0
// NOTE(allen): Line marker color
if (is_new_line){
visual_line_markers_color = 0;
// NOTE(allen): Line range marker color
for (;visual_line_range_markers_scan_index < line_range_markers.count &&
line_range_markers.markers[visual_line_range_markers_scan_index].pos <= ind;
visual_line_range_markers_scan_index += 1){
Render_Marker *marker = &line_range_markers.markers[visual_line_range_markers_scan_index];
Render_Range_Record range_record = {};
range_record.brush = marker->brush;
range_record.one_past_last = marker->one_past_last;
range_record.priority = marker->priority;
i32 insert_pos = range_record_stack_get_insert_index(line_range_stack, line_range_stack_top + 1, range_record.priority);
memmove(line_range_stack + insert_pos + 1, line_range_stack + insert_pos, sizeof(*line_range_stack)*(line_range_stack_top - insert_pos + 1));
line_range_stack[insert_pos] = range_record;
line_range_stack_top += 1;
}
for (;line_range_stack_top >= 0 && ind > line_range_stack[line_range_stack_top].one_past_last; line_range_stack_top -= 1);
Render_Marker_Brush brush = render__get_brush_from_range_stack(line_range_stack, line_range_stack_top);
if (!brush.color_noop){
visual_line_markers_color = brush.color;
}
// NOTE(allen): Single line marker color
i32 visual_line_markers_best_priority = min_i32;
for (;visual_line_markers_scan_index < line_markers.count &&
line_markers.markers[visual_line_markers_scan_index].pos <= ind;
visual_line_markers_scan_index += 1){
Render_Marker *marker = &line_markers.markers[visual_line_markers_scan_index];
Assert(marker->type == VisualType_LineHighlights);
if (marker->priority > visual_line_markers_best_priority){
if (!marker->brush.color_noop){
visual_line_markers_color = marker->brush.color;
visual_line_markers_best_priority = marker->priority;
}
}
}
}
u32 marker_line_highlight = 0;
if (is_new_line || is_new_wrap){
marker_line_highlight = visual_line_markers_color;
}
// NOTE(allen): Visual marker colors
i32 marker_highlight_best_priority = min_i32;
i32 marker_highlight_text_best_priority = min_i32;
u32 marker_highlight = 0;
u32 marker_highlight_text = 0;
i32 marker_wireframe_best_priority = min_i32;
u32 marker_wireframe = 0;
i32 marker_ibar_best_priority = min_i32;
u32 marker_ibar = 0;
// NOTE(allen): Highlight range marker color
for (;visual_range_markers_scan_index < range_markers.count &&
range_markers.markers[visual_range_markers_scan_index].pos <= ind;
visual_range_markers_scan_index += 1){
Render_Marker *marker = &range_markers.markers[visual_range_markers_scan_index];
Render_Range_Record range_record = {};
range_record.brush = marker->brush;
range_record.one_past_last = marker->one_past_last;
range_record.priority = marker->priority;
i32 insert_pos = range_record_stack_get_insert_index(range_stack, range_stack_top + 1, range_record.priority);
memmove(range_stack + insert_pos + 1, range_stack + insert_pos, sizeof(*range_stack)*(range_stack_top - insert_pos + 1));
range_stack[insert_pos] = range_record;
range_stack_top += 1;
}
for (;range_stack_top >= 0 && ind >= range_stack[range_stack_top].one_past_last; range_stack_top -= 1);
{
Render_Marker_Brush brush = render__get_brush_from_range_stack(range_stack, range_stack_top);
if (!brush.color_noop){
marker_highlight = brush.color;
}
if (!brush.text_color_noop){
marker_highlight_text = brush.text_color;
}
}
// NOTE(allen): Highlight single characters
for (;visual_markers_scan_index < character_markers.count &&
character_markers.markers[visual_markers_scan_index].pos <= ind;
visual_markers_scan_index += 1){
Render_Marker *marker = &character_markers.markers[visual_markers_scan_index];
switch (marker->type){
case VisualType_CharacterBlocks:
{
if (marker->priority > marker_highlight_best_priority){
if (!marker->brush.color_noop){
marker_highlight = marker->brush.color;
}
marker_highlight_best_priority = marker->priority;
}
if (marker->priority > marker_highlight_text_best_priority){
if (!marker->brush.text_color_noop){
marker_highlight_text = marker->brush.text_color;
}
marker_highlight_text_best_priority = marker->priority;
}
}break;
case VisualType_CharacterWireFrames:
{
if (marker->priority > marker_wireframe_best_priority){
if (!marker->brush.color_noop){
marker_wireframe = marker->brush.color;
marker_wireframe_best_priority = marker->priority;
}
}
}break;
case VisualType_CharacterIBars:
{
if (marker->priority > marker_ibar_best_priority){
if (!marker->brush.color_noop){
marker_ibar = marker->brush.color;
marker_ibar_best_priority = marker->priority;
}
}
}break;
default:
{
InvalidPath;
}break;
}
}
#endif
// NOTE(allen): Perform highlight, wireframe, and ibar renders
u32 color_highlight = 0;
u32 color_wireframe = 0;
u32 color_ibar = 0;
#if 0
if (marker_highlight != 0){
if (color_highlight == 0){
color_highlight = marker_highlight;
}
}
if (marker_wireframe != 0){
if (color_wireframe == 0){
color_wireframe = marker_wireframe;
}
}
if (marker_ibar != 0){
if (color_ibar == 0){
color_ibar = marker_ibar;
}
}
#endif
if (highlight_this_color != 0){
if (color_highlight == 0){
color_highlight = highlight_this_color;
}
}
#if 0
if (marker_line_highlight != 0){
f32_Rect line_rect = f32R((f32)rect.x0, char_rect.y0, (f32)rect.x1, char_rect.y1);
draw_rectangle(target, line_rect, marker_line_highlight);
}
#endif
if (color_highlight != 0){
draw_rectangle(target, char_rect, color_highlight);
}
#if 0
if (marker_highlight_text != SymbolicColor_Default){
char_color = marker_highlight_text;
}
#endif
u32 fade_color = 0xFFFF00FF;
f32 fade_amount = 0.f;
if (file->state.paste_effect.seconds_down > 0.f &&
@ -1212,12 +698,6 @@ render_loaded_file_in_view__inner(Models *models, Render_Target *target, View *v
if (color_wireframe != 0){
draw_rectangle_outline(target, char_rect, color_wireframe);
}
#if 0
if (color_ibar != 0){
f32_Rect ibar_rect = f32R(char_rect.x0, char_rect.y0, char_rect.x0 + 1, char_rect.y1);
draw_rectangle_outline(target, ibar_rect, color_ibar);
}
#endif
}
prev_ind = ind;

View File

@ -142,43 +142,6 @@ struct View_Step_Result{
b32 consume_esc;
};
struct Render_Marker_Brush{
b8 color_noop;
b8 text_color_noop;
argb_color color;
argb_color text_color;
};
struct Render_Marker{
Marker_Visual_Type type;
Render_Marker_Brush brush;
i32 pos;
i32 one_past_last;
i32 priority;
};
struct Render_Marker_Node{
Render_Marker_Node *next;
Render_Marker render_marker;
};
struct Render_Marker_List{
Render_Marker_Node *first;
Render_Marker_Node *last;
i32 count;
};
struct Render_Range_Record{
Render_Marker_Brush brush;
i32 one_past_last;
i32 priority;
};
struct Render_Marker_Array{
Render_Marker *markers;
i32 count;
};
#endif
// BOTTOM

View File

@ -45,4 +45,7 @@ get_existing_face_id_matching_name -> face_id_from_font_load_target
get_face_id_by_name
set_global_face_by_name -> set_buffer_face_by_font_load_location (with id = 0)
mark_enclosures -> draw_enclosures
mark_enclosures -> draw_enclosures
isearch__update_highlight