extened api to make Buffer_Summary redundant
This commit is contained in:
parent
362c3cea86
commit
028f96b633
|
@ -22,7 +22,16 @@ struct Application_Links;
|
||||||
#define BUFFER_SET_EDIT_HANDLER_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Buffer_Edit_Handler *handler)
|
#define BUFFER_SET_EDIT_HANDLER_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Buffer_Edit_Handler *handler)
|
||||||
#define BUFFER_COMPUTE_CURSOR_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Buffer_Seek seek, Partial_Cursor *cursor_out)
|
#define BUFFER_COMPUTE_CURSOR_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Buffer_Seek seek, Partial_Cursor *cursor_out)
|
||||||
#define BUFFER_BATCH_EDIT_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, char *str, i32 str_len, Buffer_Edit *edits, i32 edit_count, Buffer_Batch_Edit_Type type)
|
#define BUFFER_BATCH_EDIT_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, char *str, i32 str_len, Buffer_Edit *edits, i32 edit_count, Buffer_Batch_Edit_Type type)
|
||||||
|
#define BUFFER_EXISTS_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id)
|
||||||
|
#define BUFFER_READY_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id)
|
||||||
|
#define BUFFER_GET_ACCESS_FLAGS_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Access_Flag *access_flags_out)
|
||||||
|
#define BUFFER_GET_SIZE_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, i32 *size_out)
|
||||||
|
#define BUFFER_GET_LINE_COUNT_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, i32 *line_count_out)
|
||||||
#define BUFFER_GET_BASE_BUFFER_NAME_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, String *name_out, i32 *required_size_out)
|
#define BUFFER_GET_BASE_BUFFER_NAME_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, String *name_out, i32 *required_size_out)
|
||||||
|
#define BUFFER_GET_UNIQUE_BUFFER_NAME_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, String *name_out, i32 *required_size_out)
|
||||||
|
#define BUFFER_GET_FILE_NAME_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, String *name_out, i32 *required_size_out)
|
||||||
|
#define BUFFER_GET_DIRTY_STATE_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Dirty_State *dirty_state_out)
|
||||||
|
#define BUFFER_TOKENS_ARE_READY_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id)
|
||||||
#define BUFFER_GET_SETTING_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 *value_out)
|
#define BUFFER_GET_SETTING_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 *value_out)
|
||||||
#define BUFFER_SET_SETTING_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 value)
|
#define BUFFER_SET_SETTING_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 value)
|
||||||
#define BUFFER_GET_MANAGED_SCOPE_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Managed_Scope *scope_out)
|
#define BUFFER_GET_MANAGED_SCOPE_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, Managed_Scope *scope_out)
|
||||||
|
@ -181,7 +190,16 @@ typedef BUFFER_REPLACE_RANGE_SIG(Buffer_Replace_Range_Function);
|
||||||
typedef BUFFER_SET_EDIT_HANDLER_SIG(Buffer_Set_Edit_Handler_Function);
|
typedef BUFFER_SET_EDIT_HANDLER_SIG(Buffer_Set_Edit_Handler_Function);
|
||||||
typedef BUFFER_COMPUTE_CURSOR_SIG(Buffer_Compute_Cursor_Function);
|
typedef BUFFER_COMPUTE_CURSOR_SIG(Buffer_Compute_Cursor_Function);
|
||||||
typedef BUFFER_BATCH_EDIT_SIG(Buffer_Batch_Edit_Function);
|
typedef BUFFER_BATCH_EDIT_SIG(Buffer_Batch_Edit_Function);
|
||||||
|
typedef BUFFER_EXISTS_SIG(Buffer_Exists_Function);
|
||||||
|
typedef BUFFER_READY_SIG(Buffer_Ready_Function);
|
||||||
|
typedef BUFFER_GET_ACCESS_FLAGS_SIG(Buffer_Get_Access_Flags_Function);
|
||||||
|
typedef BUFFER_GET_SIZE_SIG(Buffer_Get_Size_Function);
|
||||||
|
typedef BUFFER_GET_LINE_COUNT_SIG(Buffer_Get_Line_Count_Function);
|
||||||
typedef BUFFER_GET_BASE_BUFFER_NAME_SIG(Buffer_Get_Base_Buffer_Name_Function);
|
typedef BUFFER_GET_BASE_BUFFER_NAME_SIG(Buffer_Get_Base_Buffer_Name_Function);
|
||||||
|
typedef BUFFER_GET_UNIQUE_BUFFER_NAME_SIG(Buffer_Get_Unique_Buffer_Name_Function);
|
||||||
|
typedef BUFFER_GET_FILE_NAME_SIG(Buffer_Get_File_Name_Function);
|
||||||
|
typedef BUFFER_GET_DIRTY_STATE_SIG(Buffer_Get_Dirty_State_Function);
|
||||||
|
typedef BUFFER_TOKENS_ARE_READY_SIG(Buffer_Tokens_Are_Ready_Function);
|
||||||
typedef BUFFER_GET_SETTING_SIG(Buffer_Get_Setting_Function);
|
typedef BUFFER_GET_SETTING_SIG(Buffer_Get_Setting_Function);
|
||||||
typedef BUFFER_SET_SETTING_SIG(Buffer_Set_Setting_Function);
|
typedef BUFFER_SET_SETTING_SIG(Buffer_Set_Setting_Function);
|
||||||
typedef BUFFER_GET_MANAGED_SCOPE_SIG(Buffer_Get_Managed_Scope_Function);
|
typedef BUFFER_GET_MANAGED_SCOPE_SIG(Buffer_Get_Managed_Scope_Function);
|
||||||
|
@ -342,7 +360,16 @@ Buffer_Replace_Range_Function *buffer_replace_range;
|
||||||
Buffer_Set_Edit_Handler_Function *buffer_set_edit_handler;
|
Buffer_Set_Edit_Handler_Function *buffer_set_edit_handler;
|
||||||
Buffer_Compute_Cursor_Function *buffer_compute_cursor;
|
Buffer_Compute_Cursor_Function *buffer_compute_cursor;
|
||||||
Buffer_Batch_Edit_Function *buffer_batch_edit;
|
Buffer_Batch_Edit_Function *buffer_batch_edit;
|
||||||
|
Buffer_Exists_Function *buffer_exists;
|
||||||
|
Buffer_Ready_Function *buffer_ready;
|
||||||
|
Buffer_Get_Access_Flags_Function *buffer_get_access_flags;
|
||||||
|
Buffer_Get_Size_Function *buffer_get_size;
|
||||||
|
Buffer_Get_Line_Count_Function *buffer_get_line_count;
|
||||||
Buffer_Get_Base_Buffer_Name_Function *buffer_get_base_buffer_name;
|
Buffer_Get_Base_Buffer_Name_Function *buffer_get_base_buffer_name;
|
||||||
|
Buffer_Get_Unique_Buffer_Name_Function *buffer_get_unique_buffer_name;
|
||||||
|
Buffer_Get_File_Name_Function *buffer_get_file_name;
|
||||||
|
Buffer_Get_Dirty_State_Function *buffer_get_dirty_state;
|
||||||
|
Buffer_Tokens_Are_Ready_Function *buffer_tokens_are_ready;
|
||||||
Buffer_Get_Setting_Function *buffer_get_setting;
|
Buffer_Get_Setting_Function *buffer_get_setting;
|
||||||
Buffer_Set_Setting_Function *buffer_set_setting;
|
Buffer_Set_Setting_Function *buffer_set_setting;
|
||||||
Buffer_Get_Managed_Scope_Function *buffer_get_managed_scope;
|
Buffer_Get_Managed_Scope_Function *buffer_get_managed_scope;
|
||||||
|
@ -502,7 +529,16 @@ Buffer_Replace_Range_Function *buffer_replace_range_;
|
||||||
Buffer_Set_Edit_Handler_Function *buffer_set_edit_handler_;
|
Buffer_Set_Edit_Handler_Function *buffer_set_edit_handler_;
|
||||||
Buffer_Compute_Cursor_Function *buffer_compute_cursor_;
|
Buffer_Compute_Cursor_Function *buffer_compute_cursor_;
|
||||||
Buffer_Batch_Edit_Function *buffer_batch_edit_;
|
Buffer_Batch_Edit_Function *buffer_batch_edit_;
|
||||||
|
Buffer_Exists_Function *buffer_exists_;
|
||||||
|
Buffer_Ready_Function *buffer_ready_;
|
||||||
|
Buffer_Get_Access_Flags_Function *buffer_get_access_flags_;
|
||||||
|
Buffer_Get_Size_Function *buffer_get_size_;
|
||||||
|
Buffer_Get_Line_Count_Function *buffer_get_line_count_;
|
||||||
Buffer_Get_Base_Buffer_Name_Function *buffer_get_base_buffer_name_;
|
Buffer_Get_Base_Buffer_Name_Function *buffer_get_base_buffer_name_;
|
||||||
|
Buffer_Get_Unique_Buffer_Name_Function *buffer_get_unique_buffer_name_;
|
||||||
|
Buffer_Get_File_Name_Function *buffer_get_file_name_;
|
||||||
|
Buffer_Get_Dirty_State_Function *buffer_get_dirty_state_;
|
||||||
|
Buffer_Tokens_Are_Ready_Function *buffer_tokens_are_ready_;
|
||||||
Buffer_Get_Setting_Function *buffer_get_setting_;
|
Buffer_Get_Setting_Function *buffer_get_setting_;
|
||||||
Buffer_Set_Setting_Function *buffer_set_setting_;
|
Buffer_Set_Setting_Function *buffer_set_setting_;
|
||||||
Buffer_Get_Managed_Scope_Function *buffer_get_managed_scope_;
|
Buffer_Get_Managed_Scope_Function *buffer_get_managed_scope_;
|
||||||
|
@ -670,7 +706,16 @@ app_links->buffer_replace_range_ = Buffer_Replace_Range;\
|
||||||
app_links->buffer_set_edit_handler_ = Buffer_Set_Edit_Handler;\
|
app_links->buffer_set_edit_handler_ = Buffer_Set_Edit_Handler;\
|
||||||
app_links->buffer_compute_cursor_ = Buffer_Compute_Cursor;\
|
app_links->buffer_compute_cursor_ = Buffer_Compute_Cursor;\
|
||||||
app_links->buffer_batch_edit_ = Buffer_Batch_Edit;\
|
app_links->buffer_batch_edit_ = Buffer_Batch_Edit;\
|
||||||
|
app_links->buffer_exists_ = Buffer_Exists;\
|
||||||
|
app_links->buffer_ready_ = Buffer_Ready;\
|
||||||
|
app_links->buffer_get_access_flags_ = Buffer_Get_Access_Flags;\
|
||||||
|
app_links->buffer_get_size_ = Buffer_Get_Size;\
|
||||||
|
app_links->buffer_get_line_count_ = Buffer_Get_Line_Count;\
|
||||||
app_links->buffer_get_base_buffer_name_ = Buffer_Get_Base_Buffer_Name;\
|
app_links->buffer_get_base_buffer_name_ = Buffer_Get_Base_Buffer_Name;\
|
||||||
|
app_links->buffer_get_unique_buffer_name_ = Buffer_Get_Unique_Buffer_Name;\
|
||||||
|
app_links->buffer_get_file_name_ = Buffer_Get_File_Name;\
|
||||||
|
app_links->buffer_get_dirty_state_ = Buffer_Get_Dirty_State;\
|
||||||
|
app_links->buffer_tokens_are_ready_ = Buffer_Tokens_Are_Ready;\
|
||||||
app_links->buffer_get_setting_ = Buffer_Get_Setting;\
|
app_links->buffer_get_setting_ = Buffer_Get_Setting;\
|
||||||
app_links->buffer_set_setting_ = Buffer_Set_Setting;\
|
app_links->buffer_set_setting_ = Buffer_Set_Setting;\
|
||||||
app_links->buffer_get_managed_scope_ = Buffer_Get_Managed_Scope;\
|
app_links->buffer_get_managed_scope_ = Buffer_Get_Managed_Scope;\
|
||||||
|
@ -830,7 +875,16 @@ static b32 buffer_replace_range(Application_Links *app, Buffer_ID buffer_id, i32
|
||||||
static b32 buffer_set_edit_handler(Application_Links *app, Buffer_ID buffer_id, Buffer_Edit_Handler *handler){return(app->buffer_set_edit_handler(app, buffer_id, handler));}
|
static b32 buffer_set_edit_handler(Application_Links *app, Buffer_ID buffer_id, Buffer_Edit_Handler *handler){return(app->buffer_set_edit_handler(app, buffer_id, handler));}
|
||||||
static b32 buffer_compute_cursor(Application_Links *app, Buffer_ID buffer_id, Buffer_Seek seek, Partial_Cursor *cursor_out){return(app->buffer_compute_cursor(app, buffer_id, seek, cursor_out));}
|
static b32 buffer_compute_cursor(Application_Links *app, Buffer_ID buffer_id, Buffer_Seek seek, Partial_Cursor *cursor_out){return(app->buffer_compute_cursor(app, buffer_id, seek, cursor_out));}
|
||||||
static b32 buffer_batch_edit(Application_Links *app, Buffer_ID buffer_id, char *str, i32 str_len, Buffer_Edit *edits, i32 edit_count, Buffer_Batch_Edit_Type type){return(app->buffer_batch_edit(app, buffer_id, str, str_len, edits, edit_count, type));}
|
static b32 buffer_batch_edit(Application_Links *app, Buffer_ID buffer_id, char *str, i32 str_len, Buffer_Edit *edits, i32 edit_count, Buffer_Batch_Edit_Type type){return(app->buffer_batch_edit(app, buffer_id, str, str_len, edits, edit_count, type));}
|
||||||
|
static b32 buffer_exists(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_exists(app, buffer_id));}
|
||||||
|
static b32 buffer_ready(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_ready(app, buffer_id));}
|
||||||
|
static b32 buffer_get_access_flags(Application_Links *app, Buffer_ID buffer_id, Access_Flag *access_flags_out){return(app->buffer_get_access_flags(app, buffer_id, access_flags_out));}
|
||||||
|
static b32 buffer_get_size(Application_Links *app, Buffer_ID buffer_id, i32 *size_out){return(app->buffer_get_size(app, buffer_id, size_out));}
|
||||||
|
static b32 buffer_get_line_count(Application_Links *app, Buffer_ID buffer_id, i32 *line_count_out){return(app->buffer_get_line_count(app, buffer_id, line_count_out));}
|
||||||
static b32 buffer_get_base_buffer_name(Application_Links *app, Buffer_ID buffer_id, String *name_out, i32 *required_size_out){return(app->buffer_get_base_buffer_name(app, buffer_id, name_out, required_size_out));}
|
static b32 buffer_get_base_buffer_name(Application_Links *app, Buffer_ID buffer_id, String *name_out, i32 *required_size_out){return(app->buffer_get_base_buffer_name(app, buffer_id, name_out, required_size_out));}
|
||||||
|
static b32 buffer_get_unique_buffer_name(Application_Links *app, Buffer_ID buffer_id, String *name_out, i32 *required_size_out){return(app->buffer_get_unique_buffer_name(app, buffer_id, name_out, required_size_out));}
|
||||||
|
static b32 buffer_get_file_name(Application_Links *app, Buffer_ID buffer_id, String *name_out, i32 *required_size_out){return(app->buffer_get_file_name(app, buffer_id, name_out, required_size_out));}
|
||||||
|
static b32 buffer_get_dirty_state(Application_Links *app, Buffer_ID buffer_id, Dirty_State *dirty_state_out){return(app->buffer_get_dirty_state(app, buffer_id, dirty_state_out));}
|
||||||
|
static b32 buffer_tokens_are_ready(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_tokens_are_ready(app, buffer_id));}
|
||||||
static b32 buffer_get_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 *value_out){return(app->buffer_get_setting(app, buffer_id, setting, value_out));}
|
static b32 buffer_get_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 *value_out){return(app->buffer_get_setting(app, buffer_id, setting, value_out));}
|
||||||
static b32 buffer_set_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 value){return(app->buffer_set_setting(app, buffer_id, setting, value));}
|
static b32 buffer_set_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 value){return(app->buffer_set_setting(app, buffer_id, setting, value));}
|
||||||
static b32 buffer_get_managed_scope(Application_Links *app, Buffer_ID buffer_id, Managed_Scope *scope_out){return(app->buffer_get_managed_scope(app, buffer_id, scope_out));}
|
static b32 buffer_get_managed_scope(Application_Links *app, Buffer_ID buffer_id, Managed_Scope *scope_out){return(app->buffer_get_managed_scope(app, buffer_id, scope_out));}
|
||||||
|
@ -990,7 +1044,16 @@ static b32 buffer_replace_range(Application_Links *app, Buffer_ID buffer_id, i32
|
||||||
static b32 buffer_set_edit_handler(Application_Links *app, Buffer_ID buffer_id, Buffer_Edit_Handler *handler){return(app->buffer_set_edit_handler_(app, buffer_id, handler));}
|
static b32 buffer_set_edit_handler(Application_Links *app, Buffer_ID buffer_id, Buffer_Edit_Handler *handler){return(app->buffer_set_edit_handler_(app, buffer_id, handler));}
|
||||||
static b32 buffer_compute_cursor(Application_Links *app, Buffer_ID buffer_id, Buffer_Seek seek, Partial_Cursor *cursor_out){return(app->buffer_compute_cursor_(app, buffer_id, seek, cursor_out));}
|
static b32 buffer_compute_cursor(Application_Links *app, Buffer_ID buffer_id, Buffer_Seek seek, Partial_Cursor *cursor_out){return(app->buffer_compute_cursor_(app, buffer_id, seek, cursor_out));}
|
||||||
static b32 buffer_batch_edit(Application_Links *app, Buffer_ID buffer_id, char *str, i32 str_len, Buffer_Edit *edits, i32 edit_count, Buffer_Batch_Edit_Type type){return(app->buffer_batch_edit_(app, buffer_id, str, str_len, edits, edit_count, type));}
|
static b32 buffer_batch_edit(Application_Links *app, Buffer_ID buffer_id, char *str, i32 str_len, Buffer_Edit *edits, i32 edit_count, Buffer_Batch_Edit_Type type){return(app->buffer_batch_edit_(app, buffer_id, str, str_len, edits, edit_count, type));}
|
||||||
|
static b32 buffer_exists(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_exists_(app, buffer_id));}
|
||||||
|
static b32 buffer_ready(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_ready_(app, buffer_id));}
|
||||||
|
static b32 buffer_get_access_flags(Application_Links *app, Buffer_ID buffer_id, Access_Flag *access_flags_out){return(app->buffer_get_access_flags_(app, buffer_id, access_flags_out));}
|
||||||
|
static b32 buffer_get_size(Application_Links *app, Buffer_ID buffer_id, i32 *size_out){return(app->buffer_get_size_(app, buffer_id, size_out));}
|
||||||
|
static b32 buffer_get_line_count(Application_Links *app, Buffer_ID buffer_id, i32 *line_count_out){return(app->buffer_get_line_count_(app, buffer_id, line_count_out));}
|
||||||
static b32 buffer_get_base_buffer_name(Application_Links *app, Buffer_ID buffer_id, String *name_out, i32 *required_size_out){return(app->buffer_get_base_buffer_name_(app, buffer_id, name_out, required_size_out));}
|
static b32 buffer_get_base_buffer_name(Application_Links *app, Buffer_ID buffer_id, String *name_out, i32 *required_size_out){return(app->buffer_get_base_buffer_name_(app, buffer_id, name_out, required_size_out));}
|
||||||
|
static b32 buffer_get_unique_buffer_name(Application_Links *app, Buffer_ID buffer_id, String *name_out, i32 *required_size_out){return(app->buffer_get_unique_buffer_name_(app, buffer_id, name_out, required_size_out));}
|
||||||
|
static b32 buffer_get_file_name(Application_Links *app, Buffer_ID buffer_id, String *name_out, i32 *required_size_out){return(app->buffer_get_file_name_(app, buffer_id, name_out, required_size_out));}
|
||||||
|
static b32 buffer_get_dirty_state(Application_Links *app, Buffer_ID buffer_id, Dirty_State *dirty_state_out){return(app->buffer_get_dirty_state_(app, buffer_id, dirty_state_out));}
|
||||||
|
static b32 buffer_tokens_are_ready(Application_Links *app, Buffer_ID buffer_id){return(app->buffer_tokens_are_ready_(app, buffer_id));}
|
||||||
static b32 buffer_get_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 *value_out){return(app->buffer_get_setting_(app, buffer_id, setting, value_out));}
|
static b32 buffer_get_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 *value_out){return(app->buffer_get_setting_(app, buffer_id, setting, value_out));}
|
||||||
static b32 buffer_set_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 value){return(app->buffer_set_setting_(app, buffer_id, setting, value));}
|
static b32 buffer_set_setting(Application_Links *app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i32 value){return(app->buffer_set_setting_(app, buffer_id, setting, value));}
|
||||||
static b32 buffer_get_managed_scope(Application_Links *app, Buffer_ID buffer_id, Managed_Scope *scope_out){return(app->buffer_get_managed_scope_(app, buffer_id, scope_out));}
|
static b32 buffer_get_managed_scope(Application_Links *app, Buffer_ID buffer_id, Managed_Scope *scope_out){return(app->buffer_get_managed_scope_(app, buffer_id, scope_out));}
|
||||||
|
|
|
@ -37,7 +37,7 @@ fill_buffer_summary(Buffer_Summary *buffer, Editing_File *file, Working_Set *wor
|
||||||
|
|
||||||
buffer->is_lexed = file->settings.tokens_exist;
|
buffer->is_lexed = file->settings.tokens_exist;
|
||||||
|
|
||||||
buffer->tokens_are_ready = (file->state.token_array.tokens && file->state.tokens_complete && !file->state.still_lexing);
|
buffer->tokens_are_ready = file_tokens_are_ready(file);
|
||||||
buffer->map_id = file->settings.base_map_id;
|
buffer->map_id = file->settings.base_map_id;
|
||||||
buffer->unwrapped_lines = file->settings.unwrapped_lines;
|
buffer->unwrapped_lines = file->settings.unwrapped_lines;
|
||||||
|
|
||||||
|
@ -141,6 +141,18 @@ imp_get_panel(Models *models, Panel_ID panel_id){
|
||||||
return(panel);
|
return(panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal b32
|
||||||
|
string_api_output(String val, String *out, i32 *required_size_out){
|
||||||
|
b32 result = false;
|
||||||
|
if (required_size_out != 0){
|
||||||
|
*required_size_out = val.size;
|
||||||
|
}
|
||||||
|
if (out != 0){
|
||||||
|
result = append(out, val);
|
||||||
|
}
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
internal b32
|
internal b32
|
||||||
panel_api_check_panel(Panel *panel){
|
panel_api_check_panel(Panel *panel){
|
||||||
b32 result = false;
|
b32 result = false;
|
||||||
|
@ -155,6 +167,26 @@ buffer_api_check_file(Editing_File *file){
|
||||||
return(file != 0 && !file->is_dummy);
|
return(file != 0 && !file->is_dummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal b32
|
||||||
|
buffer_api_check_file_and_tokens(Editing_File *file){
|
||||||
|
return(buffer_api_check_file(file) && file->state.token_array.tokens != 0 && file->state.tokens_complete);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal b32
|
||||||
|
buffer_api_check_file(Editing_File *file, Access_Flag access){
|
||||||
|
return(buffer_api_check_file(file) && access_test(file_get_access_flags(file), access));
|
||||||
|
}
|
||||||
|
|
||||||
|
internal b32
|
||||||
|
view_api_check_view(View *view){
|
||||||
|
return(view != 0 && view->in_use);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal b32
|
||||||
|
view_api_check_view(View *view, Access_Flag access){
|
||||||
|
return(view_api_check_view(view) && access_test(view_get_access_flags(view), access));
|
||||||
|
}
|
||||||
|
|
||||||
API_EXPORT b32
|
API_EXPORT b32
|
||||||
Global_Set_Setting(Application_Links *app, Global_Setting_ID setting, i32 value)
|
Global_Set_Setting(Application_Links *app, Global_Setting_ID setting, i32 value)
|
||||||
/*
|
/*
|
||||||
|
@ -662,26 +694,6 @@ DOC_SEE(get_buffer_first)
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal b32
|
|
||||||
buffer_api_check_file_and_tokens(Editing_File *file){
|
|
||||||
return(buffer_api_check_file(file) && file->state.token_array.tokens != 0 && file->state.tokens_complete);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
buffer_api_check_file(Editing_File *file, Access_Flag access){
|
|
||||||
return(buffer_api_check_file(file) && access_test(file_get_access_flags(file), access));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
view_api_check_view(View *view){
|
|
||||||
return(view != 0 && view->in_use);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal b32
|
|
||||||
view_api_check_view(View *view, Access_Flag access){
|
|
||||||
return(view_api_check_view(view) && access_test(view_get_access_flags(view), access));
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(allen): redocument
|
// TODO(allen): redocument
|
||||||
API_EXPORT b32
|
API_EXPORT b32
|
||||||
Get_Buffer_Summary(Application_Links *app, Buffer_ID buffer_id, Access_Flag access, Buffer_Summary *buffer_summary_out)
|
Get_Buffer_Summary(Application_Links *app, Buffer_ID buffer_id, Access_Flag access, Buffer_Summary *buffer_summary_out)
|
||||||
|
@ -937,20 +949,112 @@ DOC_SEE(Buffer_Batch_Edit_Type)
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
API_EXPORT b32
|
||||||
|
Buffer_Exists(Application_Links *app, Buffer_ID buffer_id){
|
||||||
|
Models *models = (Models*)app->cmd_context;
|
||||||
|
Editing_File *file = imp_get_file(models, buffer_id);
|
||||||
|
return(buffer_api_check_file(file));
|
||||||
|
}
|
||||||
|
|
||||||
|
API_EXPORT b32
|
||||||
|
Buffer_Ready(Application_Links *app, Buffer_ID buffer_id){
|
||||||
|
Models *models = (Models*)app->cmd_context;
|
||||||
|
Editing_File *file = imp_get_file(models, buffer_id);
|
||||||
|
b32 result = false;
|
||||||
|
if (buffer_api_check_file(file)){
|
||||||
|
result = file_is_ready(file);
|
||||||
|
}
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
API_EXPORT b32
|
||||||
|
Buffer_Get_Access_Flags(Application_Links *app, Buffer_ID buffer_id, Access_Flag *access_flags_out){
|
||||||
|
Models *models = (Models*)app->cmd_context;
|
||||||
|
Editing_File *file = imp_get_file(models, buffer_id);
|
||||||
|
b32 result = false;
|
||||||
|
if (buffer_api_check_file(file)){
|
||||||
|
*access_flags_out = file_get_access_flags(file);
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
API_EXPORT b32
|
||||||
|
Buffer_Get_Size(Application_Links *app, Buffer_ID buffer_id, i32 *size_out){
|
||||||
|
Models *models = (Models*)app->cmd_context;
|
||||||
|
Editing_File *file = imp_get_file(models, buffer_id);
|
||||||
|
b32 result = false;
|
||||||
|
if (buffer_api_check_file(file)){
|
||||||
|
*size_out = buffer_size(&file->state.buffer);
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
API_EXPORT b32
|
||||||
|
Buffer_Get_Line_Count(Application_Links *app, Buffer_ID buffer_id, i32 *line_count_out){
|
||||||
|
Models *models = (Models*)app->cmd_context;
|
||||||
|
Editing_File *file = imp_get_file(models, buffer_id);
|
||||||
|
b32 result = false;
|
||||||
|
if (buffer_api_check_file(file)){
|
||||||
|
*line_count_out = file->state.buffer.line_count;
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
API_EXPORT b32
|
API_EXPORT b32
|
||||||
Buffer_Get_Base_Buffer_Name(Application_Links *app, Buffer_ID buffer_id, String *name_out, i32 *required_size_out){
|
Buffer_Get_Base_Buffer_Name(Application_Links *app, Buffer_ID buffer_id, String *name_out, i32 *required_size_out){
|
||||||
Models *models = (Models*)app->cmd_context;
|
Models *models = (Models*)app->cmd_context;
|
||||||
Editing_File *file = imp_get_file(models, buffer_id);
|
Editing_File *file = imp_get_file(models, buffer_id);
|
||||||
b32 result = false;
|
b32 result = false;
|
||||||
if (buffer_api_check_file(file)){
|
if (buffer_api_check_file(file)){
|
||||||
if (required_size_out != 0){
|
result = string_api_output(file->base_name.name, name_out, required_size_out);
|
||||||
*required_size_out = file->base_name.name.size;
|
|
||||||
}
|
}
|
||||||
if (name_out != 0){
|
return(result);
|
||||||
if (append(name_out, file->base_name.name)){
|
}
|
||||||
|
|
||||||
|
API_EXPORT b32
|
||||||
|
Buffer_Get_Unique_Buffer_Name(Application_Links *app, Buffer_ID buffer_id, String *name_out, i32 *required_size_out){
|
||||||
|
Models *models = (Models*)app->cmd_context;
|
||||||
|
Editing_File *file = imp_get_file(models, buffer_id);
|
||||||
|
b32 result = false;
|
||||||
|
if (buffer_api_check_file(file)){
|
||||||
|
result = string_api_output(file->unique_name.name, name_out, required_size_out);
|
||||||
|
}
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
API_EXPORT b32
|
||||||
|
Buffer_Get_File_Name(Application_Links *app, Buffer_ID buffer_id, String *name_out, i32 *required_size_out){
|
||||||
|
Models *models = (Models*)app->cmd_context;
|
||||||
|
Editing_File *file = imp_get_file(models, buffer_id);
|
||||||
|
b32 result = false;
|
||||||
|
if (buffer_api_check_file(file)){
|
||||||
|
result = string_api_output(file->canon.name, name_out, required_size_out);
|
||||||
|
}
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
API_EXPORT b32
|
||||||
|
Buffer_Get_Dirty_State(Application_Links *app, Buffer_ID buffer_id, Dirty_State *dirty_state_out){
|
||||||
|
Models *models = (Models*)app->cmd_context;
|
||||||
|
Editing_File *file = imp_get_file(models, buffer_id);
|
||||||
|
b32 result = false;
|
||||||
|
if (buffer_api_check_file(file)){
|
||||||
|
*dirty_state_out = file->state.dirty;
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
API_EXPORT b32
|
||||||
|
Buffer_Tokens_Are_Ready(Application_Links *app, Buffer_ID buffer_id){
|
||||||
|
Models *models = (Models*)app->cmd_context;
|
||||||
|
Editing_File *file = imp_get_file(models, buffer_id);
|
||||||
|
b32 result = false;
|
||||||
|
if (buffer_api_check_file(file)){
|
||||||
|
result = file_tokens_are_ready(file);
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
@ -4704,37 +4808,17 @@ Find_All_In_Range_Insensitive(Application_Links *app, Buffer_ID buffer_id, i32 s
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// TODO(allen): remove
|
|
||||||
API_EXPORT Process_State
|
|
||||||
Get_Process_State(Application_Links *app, Buffer_ID buffer_id)
|
|
||||||
{
|
|
||||||
Process_State result = {};
|
|
||||||
|
|
||||||
Models *models = (Models*)app->cmd_context;
|
|
||||||
Editing_File *file = imp_get_file(models, buffer_id);
|
|
||||||
if(file != 0)
|
|
||||||
{
|
|
||||||
result.is_updating = file->is_updating;
|
|
||||||
result.return_code = file->return_code;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
API_EXPORT Range
|
API_EXPORT Range
|
||||||
Get_View_Visible_Range(Application_Links *app, View_ID view_id){
|
Get_View_Visible_Range(Application_Links *app, View_ID view_id){
|
||||||
Range result = {};
|
Range result = {};
|
||||||
// TODO(casey): Allen, I leave it to you to actually compute this the way you want. Hopefully all
|
|
||||||
// this sort of thing will get sorted out as the render/layout stuff becomes more disentangled.
|
|
||||||
Models *models = (Models*)app->cmd_context;
|
Models *models = (Models*)app->cmd_context;
|
||||||
View *view = imp_get_view(models, view_id);
|
View *view = imp_get_view(models, view_id);
|
||||||
if (view_api_check_view(view)){
|
if (view_api_check_view(view)){
|
||||||
i32 view_height = rect_height(view->panel->rect_inner);
|
i32 view_height = rect_height(view->panel->rect_inner);
|
||||||
|
i32 line_height = view->line_height;
|
||||||
Full_Cursor min_cursor = view_get_render_cursor(models->system, view);
|
Full_Cursor min_cursor = view_get_render_cursor(models->system, view);
|
||||||
Full_Cursor max_cursor;
|
Full_Cursor max_cursor;
|
||||||
view_compute_cursor(app, view_id, seek_xy(min_cursor.wrapped_x, min_cursor.wrapped_y + view_height, false, false), &max_cursor);
|
view_compute_cursor(app, view_id, seek_unwrapped_xy(0.f, min_cursor.wrapped_y + view_height + line_height, false), &max_cursor);
|
||||||
result.min = min_cursor.pos;
|
result.min = min_cursor.pos;
|
||||||
result.max = max_cursor.pos;
|
result.max = max_cursor.pos;
|
||||||
}
|
}
|
||||||
|
|
|
@ -541,5 +541,12 @@ file_get_current_record_index(Editing_File *file){
|
||||||
return(file->state.current_record_index);
|
return(file->state.current_record_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
|
||||||
|
internal b32
|
||||||
|
file_tokens_are_ready(Editing_File *file){
|
||||||
|
return(file->state.token_array.tokens != 0 && file->state.tokens_complete && !file->state.still_lexing);
|
||||||
|
}
|
||||||
|
|
||||||
// BOTTOM
|
// BOTTOM
|
||||||
|
|
||||||
|
|
|
@ -1329,7 +1329,7 @@ render_loaded_file_in_view(System_Functions *system, View *view, Models *models,
|
||||||
b32 do_wrap = false;
|
b32 do_wrap = false;
|
||||||
i32 wrap_unit_end = 0;
|
i32 wrap_unit_end = 0;
|
||||||
|
|
||||||
b32 first_wrap_determination = 1;
|
b32 first_wrap_determination = true;
|
||||||
i32 wrap_array_index = 0;
|
i32 wrap_array_index = 0;
|
||||||
|
|
||||||
do{
|
do{
|
||||||
|
@ -1348,7 +1348,7 @@ render_loaded_file_in_view(System_Functions *system, View *view, Models *models,
|
||||||
do_wrap = false;
|
do_wrap = false;
|
||||||
wrap_unit_end = file->state.wrap_positions[wrap_array_index];
|
wrap_unit_end = file->state.wrap_positions[wrap_array_index];
|
||||||
}
|
}
|
||||||
first_wrap_determination = 0;
|
first_wrap_determination = false;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Assert(stop.pos == wrap_unit_end);
|
Assert(stop.pos == wrap_unit_end);
|
||||||
|
|
Loading…
Reference in New Issue