From b9065e7cd372ec3eabfbaec77bb56848841c059c Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Fri, 28 Sep 2018 16:42:32 -0700 Subject: [PATCH] Upgrade to marker visuals API --- 4coder_API/types.h | 47 +++++++-- 4coder_base_commands.cpp | 7 +- 4coder_default_hooks.cpp | 23 +++-- 4coder_generated/app_functions.h | 63 ++++++++++-- 4coder_generated/command_metadata.h | 56 +++++------ 4coder_jump_sticky.cpp | 6 +- 4ed_api_implementation.cpp | 144 +++++++++++++++++++++++++++- 4ed_dynamic_variables.cpp | 103 ++++++++++++++++++++ 4ed_dynamic_variables.h | 30 +++++- 4ed_view.cpp | 90 ++++++++--------- 4ed_view.h | 2 +- todo.txt | 28 +++++- 12 files changed, 490 insertions(+), 109 deletions(-) diff --git a/4coder_API/types.h b/4coder_API/types.h index b0907236..72eff913 100644 --- a/4coder_API/types.h +++ b/4coder_API/types.h @@ -687,7 +687,20 @@ ENUM(int32_t, Managed_Object_Type) ManagedObjectType_COUNT = 3, }; -ENUM(int32_t, Managed_Buffer_Markers_Type) +TYPEDEF uint64_t Managed_Scope; +TYPEDEF int32_t Managed_Variable_ID; +TYPEDEF uint64_t Managed_Object; + +static Managed_Scope ManagedScope_NULL = 0; +static Managed_Variable_ID ManagedVariableIndex_ERROR = -1; +static Managed_Object ManagedObject_NULL = 0; + +STRUCT Marker_Visuals{ + Managed_Scope scope; + uint32_t slot_id; + uint32_t gen_id; +}; +ENUM(int32_t, Marker_Visuals_Type) { BufferMarkersType_Invisible = 0, BufferMarkersType_CharacterBlocks = 1, @@ -697,14 +710,30 @@ ENUM(int32_t, Managed_Buffer_Markers_Type) BufferMarkersType_CharacterIBars = 5, BufferMarkersType_COUNT = 6, }; - -TYPEDEF uint64_t Managed_Scope; -TYPEDEF int32_t Managed_Variable_ID; -TYPEDEF uint64_t Managed_Object; - -static Managed_Scope ManagedScope_NULL = 0; -static Managed_Variable_ID ManagedVariableIndex_ERROR = -1; -static Managed_Object ManagedObject_NULL = 0; +ENUM(uint32_t, Marker_Visuals_Symbolic_Color) +{ + SymbolicColor_Default = 0, + SymbolicColor_Transparent = 1, + SymbolicColor__StagColorFlag = 0x00800000, +}; +#define SymbolicColorFromPalette(x) ((x)|SymbolicColor__StagColorFlag) +ENUM(int32_t, Marker_Visuals_Text_Style) +{ + MARKER_TEXT_STYLE_NOT_YET_IMPLEMENTED, +}; +STRUCT Marker_Visuals_Take_Rule{ + int32_t first_index; + int32_t take_count_per_step; + int32_t step_stride_in_marker_count; + int32_t maximum_number_of_markers; +}; +ENUM(int32_t, Marker_Visuals_Priority_Level){ + VisualPriority_Lowest = 0, + VisualPriority_Low = 1000, + VisualPriority_Normal = 2000, + VisualPriority_High = 3000, + VisualPriority_Highest = 4000, +}; /* DOC(Query_Bar is a struct used to store information in the user's control that will be displayed as a drop down bar durring an interactive command.) */ STRUCT Query_Bar{ diff --git a/4coder_base_commands.cpp b/4coder_base_commands.cpp index a9ba3b8e..4c570293 100644 --- a/4coder_base_commands.cpp +++ b/4coder_base_commands.cpp @@ -696,9 +696,10 @@ isearch(Application_Links *app, bool32 start_reversed, String query_init, bool32 Managed_Scope view_scope = view_get_managed_scope(app, view.view_id); Managed_Object highlight = alloc_buffer_markers_on_buffer(app, buffer.buffer_id, 2, &view_scope); - Managed_Buffer_Markers_Type marker_type = BufferMarkersType_CharacterHighlightRanges; - buffer_markers_set_visuals(app, highlight, - marker_type, color.color, 0, view.view_id); + Marker_Visuals_Type marker_type = BufferMarkersType_CharacterHighlightRanges; + Marker_Visuals visuals = create_marker_visuals(app, highlight); + marker_visuals_set_look(app, visuals, marker_type, color.color, SymbolicColor_Default, 0); + marker_visuals_set_view_key(app, visuals, view.view_id); isearch__update_highlight(app, &view, highlight, match.start, match.end); int32_t original_cursor_render_mode = cursor_render_mode; cursor_render_mode = CursorRenderMode_Hidden; diff --git a/4coder_default_hooks.cpp b/4coder_default_hooks.cpp index dc17c355..bd94ff75 100644 --- a/4coder_default_hooks.cpp +++ b/4coder_default_hooks.cpp @@ -74,18 +74,20 @@ RENDER_CALLER_SIG(default_render_caller){ uint32_t mark_color = colors[1].color; { Managed_Object o = alloc_buffer_markers_on_buffer(app, buffer.buffer_id, 1, &render_scope); - Managed_Buffer_Markers_Type type = is_active_view?BufferMarkersType_CharacterBlocks:BufferMarkersType_CharacterWireFrames; - buffer_markers_set_visuals(app, o, type, cursor_color, 0, 0); Marker marker = {0}; marker.pos = view.cursor.pos; managed_object_store_data(app, o, 0, 1, &marker); + Marker_Visuals_Type type = is_active_view?BufferMarkersType_CharacterBlocks:BufferMarkersType_CharacterWireFrames; + Marker_Visuals visuals = create_marker_visuals(app, o); + marker_visuals_set_look(app, visuals, type, cursor_color, SymbolicColor_Default, 0); } { Managed_Object o = alloc_buffer_markers_on_buffer(app, buffer.buffer_id, 1, &render_scope); - buffer_markers_set_visuals(app, o, BufferMarkersType_CharacterWireFrames, mark_color, 0, 0); Marker marker = {0}; marker.pos = view.mark.pos; managed_object_store_data(app, o, 0, 1, &marker); + Marker_Visuals visuals = create_marker_visuals(app, o); + marker_visuals_set_look(app, visuals, BufferMarkersType_CharacterWireFrames, mark_color, SymbolicColor_Default, 0); } }break; @@ -99,19 +101,21 @@ RENDER_CALLER_SIG(default_render_caller){ uint32_t highlight_color = colors[1].color; { Managed_Object o = alloc_buffer_markers_on_buffer(app, buffer.buffer_id, 1, &render_scope); - buffer_markers_set_visuals(app, o, BufferMarkersType_CharacterIBars, cursor_color, 0, 0); Marker marker = {0}; marker.pos = view.cursor.pos; managed_object_store_data(app, o, 0, 1, &marker); + Marker_Visuals visuals = create_marker_visuals(app, o); + marker_visuals_set_look(app, visuals, BufferMarkersType_CharacterIBars, cursor_color, SymbolicColor_Default, 0); } if (view.cursor.pos != view.mark.pos){ Managed_Object o = alloc_buffer_markers_on_buffer(app, buffer.buffer_id, 2, &render_scope); - buffer_markers_set_visuals(app, o, BufferMarkersType_CharacterHighlightRanges, highlight_color, 0, 0); Range range = make_range(view.cursor.pos, view.mark.pos); Marker markers[2] = {0}; markers[0].pos = range.first; markers[1].pos = range.one_past_last; managed_object_store_data(app, o, 0, 2, markers); + Marker_Visuals visuals = create_marker_visuals(app, o); + marker_visuals_set_look(app, visuals, BufferMarkersType_CharacterHighlightRanges, highlight_color, SymbolicColor_Default, 0); } }break; } @@ -123,10 +127,11 @@ RENDER_CALLER_SIG(default_render_caller){ get_theme_colors(app, &color, 1); uint32_t line_color = color.color; Managed_Object o = alloc_buffer_markers_on_buffer(app, buffer.buffer_id, 1, &render_scope); - buffer_markers_set_visuals(app, o, BufferMarkersType_LineHighlights, line_color, 0, 0); Marker marker = {0}; marker.pos = view.cursor.pos; managed_object_store_data(app, o, 0, 1, &marker); + Marker_Visuals visuals = create_marker_visuals(app, o); + marker_visuals_set_look(app, visuals, BufferMarkersType_LineHighlights, line_color, SymbolicColor_Default, 0); } // NOTE(allen): Token highlight setup @@ -143,11 +148,12 @@ RENDER_CALLER_SIG(default_render_caller){ int32_t pos2 = buffer_boundary_seek(app, &buffer, pos1, DirRight, token_flags); Managed_Object token_highlight = alloc_buffer_markers_on_buffer(app, buffer.buffer_id, 2, &render_scope); - buffer_markers_set_visuals(app, token_highlight, BufferMarkersType_CharacterHighlightRanges, token_color, 0, 0); Marker range_markers[2] = {0}; range_markers[0].pos = pos1; range_markers[1].pos = pos2; managed_object_store_data(app, token_highlight, 0, 2, range_markers); + Marker_Visuals visuals = create_marker_visuals(app, token_highlight); + marker_visuals_set_look(app, visuals, BufferMarkersType_CharacterHighlightRanges, token_color, SymbolicColor_Default, 0); } // NOTE(allen): Matching enclosure highlight setup @@ -196,8 +202,9 @@ RENDER_CALLER_SIG(default_render_caller){ markers[j + 1].pos = range_ptr->one_past_last - 1; } Managed_Object m = alloc_buffer_markers_on_buffer(app, buffer.buffer_id, marker_count, &render_scope); - buffer_markers_set_visuals(app, m, BufferMarkersType_CharacterBlocks, enclosure_colors[i], 0, 0); managed_object_store_data(app, m, 0, marker_count, markers); + Marker_Visuals visuals = create_marker_visuals(app, m); + marker_visuals_set_look(app, visuals, BufferMarkersType_CharacterBlocks, enclosure_colors[i], SymbolicColor_Default, 0); end_temp_memory(marker_temp); } } diff --git a/4coder_generated/app_functions.h b/4coder_generated/app_functions.h index eccbd578..4c256dd4 100644 --- a/4coder_generated/app_functions.h +++ b/4coder_generated/app_functions.h @@ -63,7 +63,14 @@ struct Application_Links; #define MANAGED_VARIABLE_GET_SIG(n) bool32 n(Application_Links *app, Managed_Scope scope, Managed_Variable_ID location, uint64_t *value_out) #define ALLOC_MANAGED_MEMORY_IN_SCOPE_SIG(n) Managed_Object n(Application_Links *app, Managed_Scope scope, int32_t item_size, int32_t count) #define ALLOC_BUFFER_MARKERS_ON_BUFFER_SIG(n) Managed_Object n(Application_Links *app, Buffer_ID buffer_id, int32_t count, Managed_Scope *optional_extra_scope) -#define BUFFER_MARKERS_SET_VISUALS_SIG(n) bool32 n(Application_Links *app, Managed_Object object, Managed_Buffer_Markers_Type marker_type, uint32_t color, uint32_t text_color, View_ID key_view_id) +#define CREATE_MARKER_VISUALS_SIG(n) Marker_Visuals n(Application_Links *app, Managed_Object object) +#define MARKER_VISUALS_SET_LOOK_SIG(n) bool32 n(Application_Links *app, Marker_Visuals visuals, Marker_Visuals_Type type, int_color color, int_color text_color, Marker_Visuals_Text_Style text_style) +#define MARKER_VISUALS_SET_TAKE_RULE_SIG(n) bool32 n(Application_Links *app, Marker_Visuals visuals, Marker_Visuals_Take_Rule take_rule) +#define MARKER_VISUALS_SET_PRIORITY_SIG(n) bool32 n(Application_Links *app, Marker_Visuals visuals, Marker_Visuals_Priority_Level priority) +#define MARKER_VISUALS_SET_VIEW_KEY_SIG(n) bool32 n(Application_Links *app, Marker_Visuals visuals, View_ID key_view_id) +#define DESTROY_MARKER_VISUALS_SIG(n) bool32 n(Application_Links *app, Marker_Visuals visuals) +#define BUFFER_MARKERS_GET_ATTACHED_VISUALS_COUNT_SIG(n) int32_t n(Application_Links *app, Managed_Object object) +#define BUFFER_MARKERS_GET_ATTACHED_VISUALS_SIG(n) Marker_Visuals* n(Application_Links *app, Partition *part, Managed_Object object) #define MANAGED_OBJECT_GET_ITEM_SIZE_SIG(n) uint32_t n(Application_Links *app, Managed_Object object) #define MANAGED_OBJECT_GET_ITEM_COUNT_SIG(n) uint32_t n(Application_Links *app, Managed_Object object) #define MANAGED_OBJECT_GET_TYPE_SIG(n) Managed_Object_Type n(Application_Links *app, Managed_Object object) @@ -174,7 +181,14 @@ typedef MANAGED_VARIABLE_SET_SIG(Managed_Variable_Set_Function); 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 BUFFER_MARKERS_SET_VISUALS_SIG(Buffer_Markers_Set_Visuals_Function); +typedef CREATE_MARKER_VISUALS_SIG(Create_Marker_Visuals_Function); +typedef MARKER_VISUALS_SET_LOOK_SIG(Marker_Visuals_Set_Look_Function); +typedef MARKER_VISUALS_SET_TAKE_RULE_SIG(Marker_Visuals_Set_Take_Rule_Function); +typedef MARKER_VISUALS_SET_PRIORITY_SIG(Marker_Visuals_Set_Priority_Function); +typedef MARKER_VISUALS_SET_VIEW_KEY_SIG(Marker_Visuals_Set_View_Key_Function); +typedef DESTROY_MARKER_VISUALS_SIG(Destroy_Marker_Visuals_Function); +typedef BUFFER_MARKERS_GET_ATTACHED_VISUALS_COUNT_SIG(Buffer_Markers_Get_Attached_Visuals_Count_Function); +typedef BUFFER_MARKERS_GET_ATTACHED_VISUALS_SIG(Buffer_Markers_Get_Attached_Visuals_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); @@ -287,7 +301,14 @@ Managed_Variable_Set_Function *managed_variable_set; 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; -Buffer_Markers_Set_Visuals_Function *buffer_markers_set_visuals; +Create_Marker_Visuals_Function *create_marker_visuals; +Marker_Visuals_Set_Look_Function *marker_visuals_set_look; +Marker_Visuals_Set_Take_Rule_Function *marker_visuals_set_take_rule; +Marker_Visuals_Set_Priority_Function *marker_visuals_set_priority; +Marker_Visuals_Set_View_Key_Function *marker_visuals_set_view_key; +Destroy_Marker_Visuals_Function *destroy_marker_visuals; +Buffer_Markers_Get_Attached_Visuals_Count_Function *buffer_markers_get_attached_visuals_count; +Buffer_Markers_Get_Attached_Visuals_Function *buffer_markers_get_attached_visuals; 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; @@ -399,7 +420,14 @@ Managed_Variable_Set_Function *managed_variable_set_; 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_; -Buffer_Markers_Set_Visuals_Function *buffer_markers_set_visuals_; +Create_Marker_Visuals_Function *create_marker_visuals_; +Marker_Visuals_Set_Look_Function *marker_visuals_set_look_; +Marker_Visuals_Set_Take_Rule_Function *marker_visuals_set_take_rule_; +Marker_Visuals_Set_Priority_Function *marker_visuals_set_priority_; +Marker_Visuals_Set_View_Key_Function *marker_visuals_set_view_key_; +Destroy_Marker_Visuals_Function *destroy_marker_visuals_; +Buffer_Markers_Get_Attached_Visuals_Count_Function *buffer_markers_get_attached_visuals_count_; +Buffer_Markers_Get_Attached_Visuals_Function *buffer_markers_get_attached_visuals_; 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_; @@ -519,7 +547,14 @@ app_links->managed_variable_set_ = Managed_Variable_Set;\ 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->buffer_markers_set_visuals_ = Buffer_Markers_Set_Visuals;\ +app_links->create_marker_visuals_ = Create_Marker_Visuals;\ +app_links->marker_visuals_set_look_ = Marker_Visuals_Set_Look;\ +app_links->marker_visuals_set_take_rule_ = Marker_Visuals_Set_Take_Rule;\ +app_links->marker_visuals_set_priority_ = Marker_Visuals_Set_Priority;\ +app_links->marker_visuals_set_view_key_ = Marker_Visuals_Set_View_Key;\ +app_links->destroy_marker_visuals_ = Destroy_Marker_Visuals;\ +app_links->buffer_markers_get_attached_visuals_count_ = Buffer_Markers_Get_Attached_Visuals_Count;\ +app_links->buffer_markers_get_attached_visuals_ = Buffer_Markers_Get_Attached_Visuals;\ 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;\ @@ -631,7 +666,14 @@ static inline bool32 managed_variable_set(Application_Links *app, Managed_Scope static inline bool32 managed_variable_get(Application_Links *app, Managed_Scope scope, Managed_Variable_ID location, uint64_t *value_out){return(app->managed_variable_get(app, scope, location, value_out));} static inline Managed_Object alloc_managed_memory_in_scope(Application_Links *app, Managed_Scope scope, int32_t item_size, int32_t count){return(app->alloc_managed_memory_in_scope(app, scope, item_size, count));} static inline Managed_Object alloc_buffer_markers_on_buffer(Application_Links *app, Buffer_ID buffer_id, int32_t count, Managed_Scope *optional_extra_scope){return(app->alloc_buffer_markers_on_buffer(app, buffer_id, count, optional_extra_scope));} -static inline bool32 buffer_markers_set_visuals(Application_Links *app, Managed_Object object, Managed_Buffer_Markers_Type marker_type, uint32_t color, uint32_t text_color, View_ID key_view_id){return(app->buffer_markers_set_visuals(app, object, marker_type, color, text_color, key_view_id));} +static inline Marker_Visuals create_marker_visuals(Application_Links *app, Managed_Object object){return(app->create_marker_visuals(app, object));} +static inline bool32 marker_visuals_set_look(Application_Links *app, Marker_Visuals visuals, Marker_Visuals_Type type, int_color color, int_color text_color, Marker_Visuals_Text_Style text_style){return(app->marker_visuals_set_look(app, visuals, type, color, text_color, text_style));} +static inline bool32 marker_visuals_set_take_rule(Application_Links *app, Marker_Visuals visuals, Marker_Visuals_Take_Rule take_rule){return(app->marker_visuals_set_take_rule(app, visuals, take_rule));} +static inline bool32 marker_visuals_set_priority(Application_Links *app, Marker_Visuals visuals, Marker_Visuals_Priority_Level priority){return(app->marker_visuals_set_priority(app, visuals, priority));} +static inline bool32 marker_visuals_set_view_key(Application_Links *app, Marker_Visuals visuals, View_ID key_view_id){return(app->marker_visuals_set_view_key(app, visuals, key_view_id));} +static inline bool32 destroy_marker_visuals(Application_Links *app, Marker_Visuals visuals){return(app->destroy_marker_visuals(app, visuals));} +static inline int32_t buffer_markers_get_attached_visuals_count(Application_Links *app, Managed_Object object){return(app->buffer_markers_get_attached_visuals_count(app, object));} +static inline Marker_Visuals* buffer_markers_get_attached_visuals(Application_Links *app, Partition *part, Managed_Object object){return(app->buffer_markers_get_attached_visuals(app, part, object));} static inline uint32_t managed_object_get_item_size(Application_Links *app, Managed_Object object){return(app->managed_object_get_item_size(app, object));} static inline uint32_t managed_object_get_item_count(Application_Links *app, Managed_Object object){return(app->managed_object_get_item_count(app, object));} static inline Managed_Object_Type managed_object_get_type(Application_Links *app, Managed_Object object){return(app->managed_object_get_type(app, object));} @@ -743,7 +785,14 @@ static inline bool32 managed_variable_set(Application_Links *app, Managed_Scope static inline bool32 managed_variable_get(Application_Links *app, Managed_Scope scope, Managed_Variable_ID location, uint64_t *value_out){return(app->managed_variable_get_(app, scope, location, value_out));} static inline Managed_Object alloc_managed_memory_in_scope(Application_Links *app, Managed_Scope scope, int32_t item_size, int32_t count){return(app->alloc_managed_memory_in_scope_(app, scope, item_size, count));} static inline Managed_Object alloc_buffer_markers_on_buffer(Application_Links *app, Buffer_ID buffer_id, int32_t count, Managed_Scope *optional_extra_scope){return(app->alloc_buffer_markers_on_buffer_(app, buffer_id, count, optional_extra_scope));} -static inline bool32 buffer_markers_set_visuals(Application_Links *app, Managed_Object object, Managed_Buffer_Markers_Type marker_type, uint32_t color, uint32_t text_color, View_ID key_view_id){return(app->buffer_markers_set_visuals_(app, object, marker_type, color, text_color, key_view_id));} +static inline Marker_Visuals create_marker_visuals(Application_Links *app, Managed_Object object){return(app->create_marker_visuals_(app, object));} +static inline bool32 marker_visuals_set_look(Application_Links *app, Marker_Visuals visuals, Marker_Visuals_Type type, int_color color, int_color text_color, Marker_Visuals_Text_Style text_style){return(app->marker_visuals_set_look_(app, visuals, type, color, text_color, text_style));} +static inline bool32 marker_visuals_set_take_rule(Application_Links *app, Marker_Visuals visuals, Marker_Visuals_Take_Rule take_rule){return(app->marker_visuals_set_take_rule_(app, visuals, take_rule));} +static inline bool32 marker_visuals_set_priority(Application_Links *app, Marker_Visuals visuals, Marker_Visuals_Priority_Level priority){return(app->marker_visuals_set_priority_(app, visuals, priority));} +static inline bool32 marker_visuals_set_view_key(Application_Links *app, Marker_Visuals visuals, View_ID key_view_id){return(app->marker_visuals_set_view_key_(app, visuals, key_view_id));} +static inline bool32 destroy_marker_visuals(Application_Links *app, Marker_Visuals visuals){return(app->destroy_marker_visuals_(app, visuals));} +static inline int32_t buffer_markers_get_attached_visuals_count(Application_Links *app, Managed_Object object){return(app->buffer_markers_get_attached_visuals_count_(app, object));} +static inline Marker_Visuals* buffer_markers_get_attached_visuals(Application_Links *app, Partition *part, Managed_Object object){return(app->buffer_markers_get_attached_visuals_(app, part, object));} static inline uint32_t managed_object_get_item_size(Application_Links *app, Managed_Object object){return(app->managed_object_get_item_size_(app, object));} static inline uint32_t managed_object_get_item_count(Application_Links *app, Managed_Object object){return(app->managed_object_get_item_count_(app, object));} static inline Managed_Object_Type managed_object_get_type(Application_Links *app, Managed_Object object){return(app->managed_object_get_type_(app, object));} diff --git a/4coder_generated/command_metadata.h b/4coder_generated/command_metadata.h index f02b2a12..4bd0df2d 100644 --- a/4coder_generated/command_metadata.h +++ b/4coder_generated/command_metadata.h @@ -264,12 +264,12 @@ static Command_Metadata fcoder_metacmd_table[214] = { { 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, 551 }, { 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, 55 }, { 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, 492 }, -{ 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, 1102 }, -{ 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, 1352 }, +{ 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, 1103 }, +{ 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, 1353 }, { 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, 113 }, { 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, 1253 }, { PROC_LINKS(disable_highlight_line_at_cursor, 0), "disable_highlight_line_at_cursor", 32, "Disables the line highlight at the cursor.", 42, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 252 }, -{ 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, 1330 }, +{ 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, 1331 }, { PROC_LINKS(enable_highlight_line_at_cursor, 0), "enable_highlight_line_at_cursor", 31, "Enables the line highlight at the cursor.", 41, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 258 }, { 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, 604 }, { 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, 612 }, @@ -307,7 +307,7 @@ static Command_Metadata fcoder_metacmd_table[214] = { { PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 28, 881 }, { 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, 819 }, { PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 28, 730 }, -{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1522 }, +{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1523 }, { 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, 141 }, { 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, 358 }, { 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, 364 }, @@ -341,14 +341,14 @@ static Command_Metadata fcoder_metacmd_table[214] = { { 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, 193 }, { 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, 253 }, { 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, 1210 }, +{ 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, 1211 }, { 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, 231 }, { PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 293 }, { 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, 305 }, { 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, 311 }, { 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, 342 }, -{ 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, 1307 }, -{ 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, 1243 }, +{ 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, 1308 }, +{ 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, 1244 }, { 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, 351 }, { PROC_LINKS(move_up, 0), "move_up", 7, "Moves the cursor up one line.", 29, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 287 }, { 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, 299 }, @@ -359,12 +359,12 @@ static Command_Metadata fcoder_metacmd_table[214] = { { 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_color_tweaker, 0), "open_color_tweaker", 18, "Opens the 4coder theme selector list.", 37, "w:\\4ed\\code\\4coder_lists.cpp", 28, 897 }, -{ 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, 1429 }, -{ 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, 1580 }, +{ 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, 1430 }, +{ 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, 1581 }, { 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, 57 }, { 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, 73 }, { 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, 65 }, -{ 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, 1465 }, +{ 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, 1466 }, { 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, 173 }, { 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, 164 }, { 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, 331 }, @@ -377,23 +377,23 @@ static Command_Metadata fcoder_metacmd_table[214] = { { 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, 1529 }, { 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, 1115 }, -{ 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, 990 }, -{ 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, 1010 }, -{ 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, 1028 }, -{ PROC_LINKS(redo, 0), "redo", 4, "Advances forewards through the undo history.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1537 }, -{ PROC_LINKS(reload_themes, 0), "reload_themes", 13, "Loads all the theme files in the theme folder, replacing duplicates with the new theme data.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1557 }, +{ 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, 991 }, +{ 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, 1011 }, +{ 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, 1029 }, +{ PROC_LINKS(redo, 0), "redo", 4, "Advances forewards through the undo history.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1538 }, +{ PROC_LINKS(reload_themes, 0), "reload_themes", 13, "Loads all the theme files in the theme folder, replacing duplicates with the new theme data.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1558 }, { PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "w:\\4ed\\code\\4coder_default_framework.cpp", 40, 278 }, -{ 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, 1168 }, -{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1543 }, -{ 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, 888 }, -{ 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, 859 }, -{ 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, 877 }, -{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1549 }, -{ 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, 1072 }, -{ 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, 1128 }, +{ 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, 1169 }, +{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1544 }, +{ 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, 889 }, +{ 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, 860 }, +{ 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, 878 }, +{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1550 }, +{ 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, 1073 }, +{ 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, 1129 }, { 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, 743 }, -{ 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, 852 }, -{ 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, 866 }, +{ 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, 853 }, +{ 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, 867 }, { 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, 1227 }, { 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, 1239 }, { 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, 1233 }, @@ -427,7 +427,7 @@ static Command_Metadata fcoder_metacmd_table[214] = { { 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, 1265 }, { 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, 193 }, { 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, 234 }, -{ 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, 1489 }, +{ 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, 1490 }, { 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, 391 }, { 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, 371 }, { 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, 521 }, @@ -437,8 +437,8 @@ static Command_Metadata fcoder_metacmd_table[214] = { { 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, 246 }, { 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, 597 }, { 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, 586 }, -{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1531 }, -{ 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, 1479 }, +{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1532 }, +{ 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, 1480 }, { 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, 856 }, { 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, 745 }, diff --git a/4coder_jump_sticky.cpp b/4coder_jump_sticky.cpp index a44cdb66..2e3e7983 100644 --- a/4coder_jump_sticky.cpp +++ b/4coder_jump_sticky.cpp @@ -148,7 +148,7 @@ init_marker_list(Application_Links *app, Partition *scratch, Heap *heap, Buffer_ } } - Managed_Buffer_Markers_Type marker_type = 0; + Marker_Visuals_Type marker_type = 0; uint32_t marker_color = 0; if (is_compilation_buffer){ @@ -166,9 +166,9 @@ init_marker_list(Application_Links *app, Partition *scratch, Heap *heap, Buffer_ scope_array[1] = buffer_get_managed_scope(app, target_buffer_id); Managed_Scope scope = get_managed_scope_with_multiple_dependencies(app, scope_array, ArrayCount(scope_array)); Managed_Object marker_handle = alloc_buffer_markers_on_buffer(app, target_buffer_id, total_jump_count, &scope); - buffer_markers_set_visuals(app, marker_handle, - marker_type, marker_color, 0, 0); managed_object_store_data(app, marker_handle, 0, total_jump_count, markers); + Marker_Visuals visuals = create_marker_visuals(app, marker_handle); + marker_visuals_set_look(app, visuals, marker_type, marker_color, SymbolicColor_Default, 0); end_temp_memory(marker_temp); Assert(managed_object_get_item_size(app, marker_handle) == sizeof(Marker)); diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index 36522961..6680a0e5 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -2536,8 +2536,9 @@ Alloc_Buffer_Markers_On_Buffer(Application_Links *app, Buffer_ID buffer_id, int3 zdll_push_back(workspace->buffer_markers_list.first, workspace->buffer_markers_list.last, header); workspace->buffer_markers_list.count += 1; header->buffer_id = buffer_id; - header->marker_type = BufferMarkersType_Invisible; - header->color = 0; + header->visuals_first = 0; + header->visuals_last = 0; + header->visuals_count = 0; file->state.total_marker_count += count; u32 id = dynamic_workspace_store_pointer(heap, workspace, ptr); result = ((u64)markers_scope << 32) | (u64)id; @@ -2562,8 +2563,142 @@ get_dynamic_object_ptrs(Models *models, Managed_Object object){ return(result); } +API_EXPORT Marker_Visuals +Create_Marker_Visuals(Application_Links *app, Managed_Object object){ + Command_Data *cmd = (Command_Data*)app->cmd_context; + Models *models = cmd->models; + Managed_Object_Ptr_And_Workspace object_ptrs = get_dynamic_object_ptrs(models, object); + Marker_Visuals visuals = {0}; + if (object_ptrs.header != 0 && object_ptrs.header->type == ManagedObjectType_Markers){ + Heap *heap = &models->mem.heap; + Dynamic_Workspace *workspace = object_ptrs.workspace; + Marker_Visuals_Data *data = marker_visuals_alloc(heap, &workspace->mem_bank, &workspace->visuals_allocator); + + Managed_Buffer_Markers_Header *markers = (Managed_Buffer_Markers_Header*)object_ptrs.header; + zdll_push_back(markers->visuals_first, markers->visuals_last, data); + markers->visuals_count += 1; + data->owner_object = object; + marker_visuals_defaults(data); + + visuals.scope = workspace->scope_id; + visuals.slot_id = data->slot_id; + visuals.gen_id = data->gen_id; + } + return(visuals); +} + +internal Marker_Visuals_Data* +get_marker_visuals_pointer(Models *models, Marker_Visuals visuals){ + Dynamic_Workspace *workspace = get_dynamic_workspace(models, visuals.scope); + if (workspace != 0){ + return(dynamic_workspace_get_visuals_pointer(workspace, visuals.slot_id, visuals.gen_id)); + } + return(0); +} + API_EXPORT bool32 -Buffer_Markers_Set_Visuals(Application_Links *app, Managed_Object object, Managed_Buffer_Markers_Type marker_type, uint32_t color, uint32_t text_color, View_ID key_view_id){ +Marker_Visuals_Set_Look(Application_Links *app, Marker_Visuals visuals, Marker_Visuals_Type type, int_color color, int_color text_color, Marker_Visuals_Text_Style text_style){ + Command_Data *cmd = (Command_Data*)app->cmd_context; + Models *models = cmd->models; + Marker_Visuals_Data *data = get_marker_visuals_pointer(models, visuals); + if (data != 0){ + data->type = type; + data->color = color; + data->text_color = text_color; + data->text_style = text_style; + } + return(false); +} + +API_EXPORT bool32 +Marker_Visuals_Set_Take_Rule(Application_Links *app, Marker_Visuals visuals, Marker_Visuals_Take_Rule take_rule){ + Command_Data *cmd = (Command_Data*)app->cmd_context; + Models *models = cmd->models; + Marker_Visuals_Data *data = get_marker_visuals_pointer(models, visuals); + if (data != 0){ + data->take_rule = take_rule; + } + return(false); +} + +API_EXPORT bool32 +Marker_Visuals_Set_Priority(Application_Links *app, Marker_Visuals visuals, Marker_Visuals_Priority_Level priority){ + Command_Data *cmd = (Command_Data*)app->cmd_context; + Models *models = cmd->models; + Marker_Visuals_Data *data = get_marker_visuals_pointer(models, visuals); + if (data != 0){ + data->priority = priority; + } + return(false); +} + +API_EXPORT bool32 +Marker_Visuals_Set_View_Key(Application_Links *app, Marker_Visuals visuals, View_ID key_view_id){ + Command_Data *cmd = (Command_Data*)app->cmd_context; + Models *models = cmd->models; + Marker_Visuals_Data *data = get_marker_visuals_pointer(models, visuals); + if (data != 0){ + data->key_view_id = key_view_id; + } + return(false); +} + +API_EXPORT bool32 +Destroy_Marker_Visuals(Application_Links *app, Marker_Visuals visuals){ + Command_Data *cmd = (Command_Data*)app->cmd_context; + Models *models = cmd->models; + Dynamic_Workspace *workspace = get_dynamic_workspace(models, visuals.scope); + if (workspace != 0){ + Marker_Visuals_Data *data = dynamic_workspace_get_visuals_pointer(workspace, visuals.slot_id, visuals.gen_id); + if (data != 0){ + marker_visuals_free(&workspace->visuals_allocator, data); + } + } + return(false); +} + +API_EXPORT int32_t +Buffer_Markers_Get_Attached_Visuals_Count(Application_Links *app, Managed_Object object){ + Command_Data *cmd = (Command_Data*)app->cmd_context; + Models *models = cmd->models; + 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; + return(markers->visuals_count); + } + return(0); +} + +API_EXPORT Marker_Visuals* +Buffer_Markers_Get_Attached_Visuals(Application_Links *app, Partition *part, Managed_Object object){ + Command_Data *cmd = (Command_Data*)app->cmd_context; + Models *models = cmd->models; + 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->visuals_count; + Marker_Visuals *visuals = push_array(part, Marker_Visuals, count); + if (visuals != 0){ + Marker_Visuals *v = visuals; + Managed_Scope scope = object_ptrs.workspace->scope_id; + for (Marker_Visuals_Data *data = markers->visuals_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 == visuals + count); + } + return(visuals); + } + return(0); +} + +/* +#if 0 +API_EXPORT bool32 +Buffer_Markers_Set_Visuals(Application_Links *app, Managed_Object object, Marker_Visuals_Type marker_type, uint32_t color, uint32_t text_color, View_ID key_view_id){ Command_Data *cmd = (Command_Data*)app->cmd_context; Models *models = cmd->models; Managed_Object_Ptr_And_Workspace object_ptrs = get_dynamic_object_ptrs(models, object); @@ -2580,6 +2715,8 @@ Buffer_Markers_Set_Visuals(Application_Links *app, Managed_Object object, Manage } return(false); } +#endif +*/ internal u8* get_dynamic_object_memory_ptr(Managed_Object_Standard_Header *header){ @@ -2658,6 +2795,7 @@ Managed_Object_Free(Application_Links *app, Managed_Object object) Managed_Object_Type *type = (Managed_Object_Type*)object_ptr; if (*type == ManagedObjectType_Markers){ Managed_Buffer_Markers_Header *header = (Managed_Buffer_Markers_Header*)object_ptr; + marker_visuals_free_chain(&workspace->visuals_allocator, header->visuals_first, header->visuals_last, header->visuals_count); zdll_remove(workspace->buffer_markers_list.first, workspace->buffer_markers_list.last, header); workspace->buffer_markers_list.count -= 1; } diff --git a/4ed_dynamic_variables.cpp b/4ed_dynamic_variables.cpp index 43f1e490..50f56475 100644 --- a/4ed_dynamic_variables.cpp +++ b/4ed_dynamic_variables.cpp @@ -162,10 +162,97 @@ dynamic_memory_bank_free_all(Heap *heap, Dynamic_Memory_Bank *mem_bank){ //////////////////////////////// +internal void +insert_u32_Ptr_table(Heap *heap, Dynamic_Memory_Bank *mem_bank, u32_Ptr_Table *table, u32 key, void* val){ + if (at_max_u32_Ptr_table(table)){ + i32 new_max = (table->max + 1)*2; + i32 new_mem_size = max_to_memsize_u32_Ptr_table(new_max); + void *new_mem = dynamic_memory_bank_allocate(heap, mem_bank, new_mem_size); + u32_Ptr_Table new_table = make_u32_Ptr_table(new_mem, new_mem_size); + if (table->mem != 0){ + b32 result = move_u32_Ptr_table(&new_table, table); + Assert(result); + AllowLocal(result); + dynamic_memory_bank_free(mem_bank, table->mem); + } + *table = new_table; + } + b32 result = insert_u32_Ptr_table(table, &key, &val); + Assert(result); + AllowLocal(result); +} + +//////////////////////////////// + +internal void +marker_visuals_allocator_init(Marker_Visuals_Allocator *allocator){ + memset(allocator, 0, sizeof(*allocator)); +} + +internal Marker_Visuals_Data* +marker_visuals_alloc(Heap *heap, Dynamic_Memory_Bank *mem_bank, Marker_Visuals_Allocator *allocator){ + if (allocator->free_count == 0){ + i32 new_slots_count = clamp_bottom(16, allocator->total_visual_count); + i32 memsize = new_slots_count*sizeof(Marker_Visuals_Data); + void *new_slots_memory = dynamic_memory_bank_allocate(heap, mem_bank, memsize); + memset(new_slots_memory, 0, memsize); + Marker_Visuals_Data *new_slot = (Marker_Visuals_Data*)new_slots_memory; + allocator->free_count += new_slots_count; + allocator->total_visual_count += new_slots_count; + for (i32 i = 0; i < new_slots_count; i += 1, new_slot += 1){ + zdll_push_back(allocator->free_first, allocator->free_last, new_slot); + new_slot->slot_id = ++allocator->slot_id_counter; + insert_u32_Ptr_table(heap, mem_bank, &allocator->id_to_ptr_table, new_slot->slot_id, new_slot); + } + } + Marker_Visuals_Data *data = allocator->free_first; + zdll_remove(allocator->free_first, allocator->free_last, data); + allocator->free_count -= 1; + data->gen_id += 1; + return(data); +} + +internal void +marker_visuals_free(Marker_Visuals_Allocator *allocator, Marker_Visuals_Data *data){ + zdll_push_back(allocator->free_first, allocator->free_last, data); + allocator->free_count += 1; +} + +internal void +marker_visuals_free_chain(Marker_Visuals_Allocator *allocator, Marker_Visuals_Data *first, Marker_Visuals_Data *last, i32 count){ + if (allocator->free_first == 0){ + allocator->free_first = first; + allocator->free_last = last; + } + else{ + allocator->free_last->next = first; + first->prev = allocator->free_last; + allocator->free_last = last; + } + allocator->free_count += count; +} + +internal void +marker_visuals_defaults(Marker_Visuals_Data *data){ + data->type = BufferMarkersType_Invisible; + data->color = 0; + data->text_color = 0; + data->text_style = 0; + data->take_rule.first_index = 0; + data->take_rule.take_count_per_step = 1; + data->take_rule.step_stride_in_marker_count = 1; + data->take_rule.maximum_number_of_markers = max_i32; + data->priority = VisualPriority_Normal; + data->key_view_id = 0; +} + +//////////////////////////////// + internal void dynamic_workspace_init(Heap *heap, Lifetime_Allocator *lifetime_allocator, i32 user_type, void *user_back_ptr, Dynamic_Workspace *workspace){ dynamic_variables_block_init(heap, &workspace->var_block); dynamic_memory_bank_init(heap, &workspace->mem_bank); + marker_visuals_allocator_init(&workspace->visuals_allocator); if (lifetime_allocator->scope_id_counter == 0){ lifetime_allocator->scope_id_counter = 1; } @@ -188,6 +275,7 @@ dynamic_workspace_clear_contents(Heap *heap, Dynamic_Workspace *workspace){ dynamic_memory_bank_free_all(heap, &workspace->mem_bank); dynamic_variables_block_init(heap, &workspace->var_block); dynamic_memory_bank_init(heap, &workspace->mem_bank); + marker_visuals_allocator_init(&workspace->visuals_allocator); } internal u32 @@ -214,6 +302,21 @@ dynamic_workspace_get_pointer(Dynamic_Workspace *workspace, u32 id){ return(0); } +internal Marker_Visuals_Data* +dynamic_workspace_get_visuals_pointer(Dynamic_Workspace *workspace, u32 slot_id, u32 gen_id){ + void *data_ptr = 0; + if (lookup_u32_Ptr_table(&workspace->visuals_allocator.id_to_ptr_table, slot_id, &data_ptr)){ + Marker_Visuals_Data *data = (Marker_Visuals_Data*)data_ptr; + if (data->gen_id == gen_id){ + void *object_ptr = dynamic_workspace_get_pointer(workspace, data->owner_object&max_u32); + if (object_ptr != 0){ + return(data); + } + } + } + return(0); +} + //////////////////////////////// internal u64 diff --git a/4ed_dynamic_variables.h b/4ed_dynamic_variables.h index 700ab164..bb275cf0 100644 --- a/4ed_dynamic_variables.h +++ b/4ed_dynamic_variables.h @@ -30,12 +30,39 @@ struct Managed_Buffer_Markers_Header{ Managed_Buffer_Markers_Header *next; Managed_Buffer_Markers_Header *prev; Buffer_ID buffer_id; - Managed_Buffer_Markers_Type marker_type; + struct Marker_Visuals_Data *visuals_first; + struct Marker_Visuals_Data *visuals_last; + i32 visuals_count; +}; + +struct Marker_Visuals_Data{ + Marker_Visuals_Data *next; + Marker_Visuals_Data *prev; + Managed_Object owner_object; + u32 slot_id; + u32 gen_id; + // "Look" + Marker_Visuals_Type type; u32 color; u32 text_color; + Marker_Visuals_Text_Style text_style; + // "Take Rule" + Marker_Visuals_Take_Rule take_rule; + // "Priority" + Marker_Visuals_Priority_Level priority; + // "Key View ID" View_ID key_view_id; }; +struct Marker_Visuals_Allocator{ + Marker_Visuals_Data *free_first; + Marker_Visuals_Data *free_last; + i32 free_count; + i32 total_visual_count; + u32_Ptr_Table id_to_ptr_table; + u32 slot_id_counter; +}; + global_const i32 managed_header_type_sizes[ManagedObjectType_COUNT] = { 0, sizeof(Managed_Memory_Header), @@ -86,6 +113,7 @@ struct Dynamic_Memory_Bank{ struct Dynamic_Workspace{ Dynamic_Variable_Block var_block; Dynamic_Memory_Bank mem_bank; + Marker_Visuals_Allocator visuals_allocator; u32_Ptr_Table object_id_to_object_ptr; u32 object_id_counter; u32 scope_id; diff --git a/4ed_view.cpp b/4ed_view.cpp index f158590c..e5bd73c7 100644 --- a/4ed_view.cpp +++ b/4ed_view.cpp @@ -496,52 +496,56 @@ get_visual_markers(Partition *arena, Dynamic_Workspace *workspace, i32 *range_co for (Managed_Buffer_Markers_Header *node = workspace->buffer_markers_list.first; node != 0; node = node->next){ - if (node->marker_type == BufferMarkersType_Invisible) continue; if (node->buffer_id != buffer_id) continue; - if (node->key_view_id != 0 && node->key_view_id != view_id) continue; - - Managed_Buffer_Markers_Type marker_type = node->marker_type; - u32 color = node->color; - u32 text_color = node->text_color; - - Marker *markers = (Marker*)(node + 1); - Assert(sizeof(*markers) == node->std_header.item_size); - i32 count = node->std_header.count; - - if (marker_type != BufferMarkersType_CharacterHighlightRanges){ - Marker *marker = markers; - for (i32 i = 0; i < count; i += 1, marker += 1){ - if (range.first <= marker->pos && - marker->pos <= range.one_past_last){ - Render_Marker *render_marker = push_array(arena, Render_Marker, 1); - render_marker->type = marker_type; - render_marker->pos = marker->pos; - render_marker->color = color; - render_marker->text_color = text_color; - render_marker->range_id = -1; + for (Marker_Visuals_Data *data = node->visuals_first; + data != 0; + data = data->next){ + if (data->type == BufferMarkersType_Invisible) continue; + if (data->key_view_id != 0 && data->key_view_id != view_id) continue; + + Marker_Visuals_Type type = data->type; + u32 color = data->color; + u32 text_color = data->text_color; + + Marker *markers = (Marker*)(node + 1); + Assert(sizeof(*markers) == node->std_header.item_size); + i32 count = node->std_header.count; + + if (type != BufferMarkersType_CharacterHighlightRanges){ + Marker *marker = markers; + for (i32 i = 0; i < count; i += 1, marker += 1){ + if (range.first <= marker->pos && + marker->pos <= range.one_past_last){ + Render_Marker *render_marker = push_array(arena, Render_Marker, 1); + render_marker->type = type; + render_marker->pos = marker->pos; + render_marker->color = color; + render_marker->text_color = text_color; + render_marker->range_id = -1; + } } } - } - else{ - Marker *marker = markers; - for (i32 i = 0; i + 1 < count; i += 2, marker += 2){ - Range range_b = {0}; - range_b.first = marker[0].pos; - range_b.one_past_last = marker[1].pos; - - if (range_b.first >= range_b.one_past_last) continue; - if (!((range.min - range_b.max <= 0) && - (range.max - range_b.min >= 0))) continue; - - i32 range_id = *range_counter_ptr; - *range_counter_ptr += 2; - for (i32 j = 0; j < 2; j += 1){ - Render_Marker *render_marker = push_array(arena, Render_Marker, 1); - render_marker->type = marker_type; - render_marker->pos = marker[j].pos; - render_marker->color = color; - render_marker->text_color = text_color; - render_marker->range_id = range_id + j; + else{ + Marker *marker = markers; + for (i32 i = 0; i + 1 < count; i += 2, marker += 2){ + Range range_b = {0}; + range_b.first = marker[0].pos; + range_b.one_past_last = marker[1].pos; + + if (range_b.first >= range_b.one_past_last) continue; + if (!((range.min - range_b.max <= 0) && + (range.max - range_b.min >= 0))) continue; + + i32 range_id = *range_counter_ptr; + *range_counter_ptr += 2; + for (i32 j = 0; j < 2; j += 1){ + Render_Marker *render_marker = push_array(arena, Render_Marker, 1); + render_marker->type = type; + render_marker->pos = marker[j].pos; + render_marker->color = color; + render_marker->text_color = text_color; + render_marker->range_id = range_id + j; + } } } } diff --git a/4ed_view.h b/4ed_view.h index f2361366..008d1fe9 100644 --- a/4ed_view.h +++ b/4ed_view.h @@ -209,7 +209,7 @@ enum{ }; struct Render_Marker{ - Managed_Buffer_Markers_Type type; + Marker_Visuals_Type type; i32 pos; u32 color; u32 text_color; diff --git a/todo.txt b/todo.txt index a2de5976..8d29cf76 100644 --- a/todo.txt +++ b/todo.txt @@ -3,18 +3,40 @@ { Features { + [] Finalize visualizations API + { + [x] Add and remove visualizations, allow more than one on a single markers object + [x] Iterate visualizations + [] Take rule + [] Priority + [x] View key + [] Check it all + } + [] Better range handling (range contained inside range) + [] Range of line highlights + [] When clearing all dependent scopes, don't delete them, just clear them [] New Features with Visible Markers { [x] Customizable Highlight Line at Cursor All the Time [x] Customizable Highlight Token at Cursor All the Time [] Paren/Brace Matching (with color pallette expansion) - [] Figure out what to do with sticky jumps that would be helpful - [] isearch upgrade with full parse and all that + { + [x] Get ranges to mark and mark them + [] Works on parentheses + [] Colors pulled from color pallette + [] Optional modes: Off, Mark Delimters, Cover Ranges + } } [] Color Pallette Expansion For Keywords [] Reload all out of sync files - [] Doubly Linked List Node Managed Object [] Jump to Command Definition (useful for 4coder customization developers only) + [] I-Bar and Highlight Mode + { + [] Cursor navigation commands + [] Insert character + [] Paste + [] Backspace and delete + } } Bugs