Remove View_Summary from core API
parent
18b755c626
commit
3911eb2197
|
@ -646,41 +646,6 @@ STRUCT Marker{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* DOC(View_Summary acts as a handle to a view and describes the state of the view.)
|
|
||||||
DOC_SEE(Access_Flag)
|
|
||||||
DOC_SEE(Full_Cursor)
|
|
||||||
DOC_SEE(GUI_Scroll_Vars) */
|
|
||||||
STRUCT View_Summary{
|
|
||||||
/* DOC(This field indicates whether the View_Summary describes a view that is open in 4coder. When this field is false the summary is referred to as a "null summary". ) */
|
|
||||||
b32 exists;
|
|
||||||
/* DOC(This field is the id of the associated view. If this is a null summary then view_id is 0. ) */
|
|
||||||
i32 view_id;
|
|
||||||
/* DOC(Then this is the id of the buffer this view currently sees.) */
|
|
||||||
i32 buffer_id;
|
|
||||||
/* DOC(This field contains flags describing the protection status of the view.) */
|
|
||||||
Access_Flag lock_flags;
|
|
||||||
|
|
||||||
/* DOC(This describes the position of the cursor.) */
|
|
||||||
Full_Cursor cursor;
|
|
||||||
/* DOC(This describes the position of the mark.) */
|
|
||||||
Full_Cursor mark;
|
|
||||||
/* DOC(This is the x position that is maintained in vertical navigation.) */
|
|
||||||
float preferred_x;
|
|
||||||
/* DOC(This specifies the height of a line rendered in the view.) */
|
|
||||||
float line_height;
|
|
||||||
/* DOC(This indicates that the view is set to render with unwrapped lines.) */
|
|
||||||
b32 unwrapped_lines;
|
|
||||||
/* DOC(This indicates that the view is set to highlight white space.) */
|
|
||||||
b32 show_whitespace;
|
|
||||||
|
|
||||||
/* DOC(This describes the screen position in which this view is displayed.) */
|
|
||||||
i32_Rect view_region;
|
|
||||||
/* DOC(TODO) */
|
|
||||||
i32_Rect render_region;
|
|
||||||
/* DOC(This describes the scrolling position inside the view.) */
|
|
||||||
GUI_Scroll_Vars scroll_vars;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* DOC(The enumeration of types of managed objects.) */
|
/* DOC(The enumeration of types of managed objects.) */
|
||||||
ENUM(i32, Managed_Object_Type)
|
ENUM(i32, Managed_Object_Type)
|
||||||
{
|
{
|
||||||
|
@ -830,8 +795,8 @@ STRUCT Query_Bar_Ptr_Array{
|
||||||
i32 count;
|
i32 count;
|
||||||
};
|
};
|
||||||
|
|
||||||
TYPEDEF_FUNC void UI_Quit_Function_Type(struct Application_Links *app, View_Summary view);
|
TYPEDEF_FUNC void UI_Quit_Function_Type(struct Application_Links *app, View_ID view);
|
||||||
#define UI_QUIT_FUNCTION(name) void name(struct Application_Links *app, View_Summary view)
|
#define UI_QUIT_FUNCTION(name) void name(struct Application_Links *app, View_ID view)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
DOC(Theme_Color stores a style tag/color pair, for the purpose of setting and getting colors in the theme.)
|
DOC(Theme_Color stores a style tag/color pair, for the purpose of setting and getting colors in the theme.)
|
||||||
|
|
|
@ -57,6 +57,42 @@ get_buffer_summary(Application_Links *app, Buffer_ID buffer_id, Access_Flag acce
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static b32
|
||||||
|
get_view_summary(Application_Links *app, View_ID view_id, Access_Flag access, View_Summary *view){
|
||||||
|
b32 result = false;
|
||||||
|
if (view_exists(app, view_id)){
|
||||||
|
Buffer_ID buffer = 0;
|
||||||
|
if (view_get_buffer(app, view_id, access, &buffer)){
|
||||||
|
result = true;
|
||||||
|
|
||||||
|
Face_ID face_id = 0;
|
||||||
|
get_face_id(app, buffer, &face_id);
|
||||||
|
Face_Metrics metrics = {};
|
||||||
|
get_face_metrics(app, face_id, &metrics);
|
||||||
|
|
||||||
|
view->exists = true;
|
||||||
|
view->view_id = view_id;
|
||||||
|
view->line_height = metrics.line_height;
|
||||||
|
buffer_get_setting(app, buffer, BufferSetting_WrapLine, &view->unwrapped_lines);
|
||||||
|
view->unwrapped_lines = !view->unwrapped_lines;
|
||||||
|
view_get_setting(app, view_id, ViewSetting_ShowWhitespace, &view->show_whitespace);
|
||||||
|
view->buffer_id = buffer;
|
||||||
|
i32 pos = 0;
|
||||||
|
view_get_mark_pos(app, view_id, &pos);
|
||||||
|
view_compute_cursor(app, view_id, seek_pos(pos), &view->mark);
|
||||||
|
view_get_cursor_pos(app, view_id, &pos);
|
||||||
|
view_compute_cursor(app, view_id, seek_pos(pos), &view->cursor);
|
||||||
|
view_get_preferred_x(app, view_id, &view->preferred_x);
|
||||||
|
Rect_f32 screen_rect = {};
|
||||||
|
view_get_screen_rect(app, view_id, &screen_rect);
|
||||||
|
view->view_region = screen_rect;
|
||||||
|
view->render_region = f32R(0.f, 0.f, rect_width(screen_rect), rect_height(screen_rect));
|
||||||
|
view_get_scroll_vars(app, view_id, &view->scroll_vars);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
static b32
|
static b32
|
||||||
exec_system_command(Application_Links *app, View_Summary *view, Buffer_Identifier buffer_id,
|
exec_system_command(Application_Links *app, View_Summary *view, Buffer_Identifier buffer_id,
|
||||||
char *path, int32_t path_len, char *command, i32 command_len, Command_Line_Interface_Flag flags){
|
char *path, int32_t path_len, char *command, i32 command_len, Command_Line_Interface_Flag flags){
|
||||||
|
|
|
@ -65,6 +65,41 @@ STRUCT Buffer_Summary{
|
||||||
b32 unwrapped_lines;
|
b32 unwrapped_lines;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* DOC(View_Summary acts as a handle to a view and describes the state of the view.)
|
||||||
|
DOC_SEE(Access_Flag)
|
||||||
|
DOC_SEE(Full_Cursor)
|
||||||
|
DOC_SEE(GUI_Scroll_Vars) */
|
||||||
|
STRUCT View_Summary{
|
||||||
|
/* DOC(This field indicates whether the View_Summary describes a view that is open in 4coder. When this field is false the summary is referred to as a "null summary". ) */
|
||||||
|
b32 exists;
|
||||||
|
/* DOC(This field is the id of the associated view. If this is a null summary then view_id is 0. ) */
|
||||||
|
i32 view_id;
|
||||||
|
/* DOC(Then this is the id of the buffer this view currently sees.) */
|
||||||
|
i32 buffer_id;
|
||||||
|
/* DOC(This field contains flags describing the protection status of the view.) */
|
||||||
|
Access_Flag lock_flags;
|
||||||
|
|
||||||
|
/* DOC(This describes the position of the cursor.) */
|
||||||
|
Full_Cursor cursor;
|
||||||
|
/* DOC(This describes the position of the mark.) */
|
||||||
|
Full_Cursor mark;
|
||||||
|
/* DOC(This is the x position that is maintained in vertical navigation.) */
|
||||||
|
f32 preferred_x;
|
||||||
|
/* DOC(This specifies the height of a line rendered in the view.) */
|
||||||
|
f32 line_height;
|
||||||
|
/* DOC(This indicates that the view is set to render with unwrapped lines.) */
|
||||||
|
b32 unwrapped_lines;
|
||||||
|
/* DOC(This indicates that the view is set to highlight white space.) */
|
||||||
|
b32 show_whitespace;
|
||||||
|
|
||||||
|
/* DOC(This describes the screen position in which this view is displayed.) */
|
||||||
|
Rect_f32 view_region;
|
||||||
|
/* DOC(TODO) */
|
||||||
|
Rect_f32 render_region;
|
||||||
|
/* DOC(This describes the scrolling position inside the view.) */
|
||||||
|
GUI_Scroll_Vars scroll_vars;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// BOTTOM
|
// BOTTOM
|
||||||
|
|
|
@ -377,7 +377,7 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Rect_f32 r_cursor = f32R(view.render_region);
|
Rect_f32 r_cursor = view.render_region;
|
||||||
|
|
||||||
// NOTE(allen): Filebar
|
// NOTE(allen): Filebar
|
||||||
{
|
{
|
||||||
|
@ -724,7 +724,7 @@ default_buffer_render_caller(Application_Links *app, Frame_Info frame_info, View
|
||||||
history_animation_dt[wrapped_index] = frame_info.animation_dt;
|
history_animation_dt[wrapped_index] = frame_info.animation_dt;
|
||||||
history_frame_index[wrapped_index] = frame_info.index;
|
history_frame_index[wrapped_index] = frame_info.index;
|
||||||
|
|
||||||
Rect_f32 hud_rect = f32R(view.render_region);
|
Rect_f32 hud_rect = view.render_region;
|
||||||
hud_rect.y0 = hud_rect.y1 - view.line_height*(f32)(history_depth);
|
hud_rect.y0 = hud_rect.y1 - view.line_height*(f32)(history_depth);
|
||||||
draw_rectangle(app, hud_rect, 0xFF000000);
|
draw_rectangle(app, hud_rect, 0xFF000000);
|
||||||
draw_rectangle_outline(app, hud_rect, 0xFFFFFFFF);
|
draw_rectangle_outline(app, hud_rect, 0xFFFFFFFF);
|
||||||
|
@ -860,7 +860,7 @@ static void
|
||||||
default_ui_render_caller(Application_Links *app, View_ID view_id, Face_ID face_id){
|
default_ui_render_caller(Application_Links *app, View_ID view_id, Face_ID face_id){
|
||||||
View_Summary view = {};
|
View_Summary view = {};
|
||||||
if (get_view_summary(app, view_id, AccessAll, &view)){
|
if (get_view_summary(app, view_id, AccessAll, &view)){
|
||||||
Rect_f32 rect_f32 = f32R(view.render_region);
|
Rect_f32 rect_f32 = view.render_region;
|
||||||
default_ui_render_caller(app, view_id, rect_f32, face_id);
|
default_ui_render_caller(app, view_id, rect_f32, face_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -868,7 +868,7 @@ static void
|
||||||
default_ui_render_caller(Application_Links *app, View_ID view_id){
|
default_ui_render_caller(Application_Links *app, View_ID view_id){
|
||||||
View_Summary view = {};
|
View_Summary view = {};
|
||||||
if (get_view_summary(app, view_id, AccessAll, &view)){
|
if (get_view_summary(app, view_id, AccessAll, &view)){
|
||||||
Rect_f32 rect_f32 = f32R(view.render_region);
|
Rect_f32 rect_f32 = view.render_region;
|
||||||
Buffer_ID buffer_id = 0;
|
Buffer_ID buffer_id = 0;
|
||||||
view_get_buffer(app, view_id, AccessAll, &buffer_id);
|
view_get_buffer(app, view_id, AccessAll, &buffer_id);
|
||||||
Face_ID face_id = 0;
|
Face_ID face_id = 0;
|
||||||
|
@ -942,7 +942,7 @@ HOOK_SIG(default_view_adjust){
|
||||||
get_view_next(app, &view, AccessAll)){
|
get_view_next(app, &view, AccessAll)){
|
||||||
Buffer_ID buffer = 0;
|
Buffer_ID buffer = 0;
|
||||||
view_get_buffer(app, view.view_id, AccessAll, &buffer);
|
view_get_buffer(app, view.view_id, AccessAll, &buffer);
|
||||||
i32 view_width = view.render_region.x1 - view.render_region.x0;
|
f32 view_width = view.render_region.x1 - view.render_region.x0;
|
||||||
Face_ID face_id = get_default_font_for_view(app, view.view_id);
|
Face_ID face_id = get_default_font_for_view(app, view.view_id);
|
||||||
f32 em = get_string_advance(app, face_id, make_lit_string("m"));
|
f32 em = get_string_advance(app, face_id, make_lit_string("m"));
|
||||||
|
|
||||||
|
|
|
@ -43,11 +43,12 @@
|
||||||
#include "4coder_scope_commands.h"
|
#include "4coder_scope_commands.h"
|
||||||
#include "4coder_combined_write_commands.h"
|
#include "4coder_combined_write_commands.h"
|
||||||
|
|
||||||
|
#include "4coder_buffer_seek_constructors.cpp"
|
||||||
|
#include "4coder_hash_functions.cpp"
|
||||||
|
|
||||||
#include "4coder_api_transition_30_31.cpp"
|
#include "4coder_api_transition_30_31.cpp"
|
||||||
|
|
||||||
#include "4coder_hash_functions.cpp"
|
|
||||||
#include "4coder_default_framework_variables.cpp"
|
#include "4coder_default_framework_variables.cpp"
|
||||||
#include "4coder_buffer_seek_constructors.cpp"
|
|
||||||
#include "4coder_helper.cpp"
|
#include "4coder_helper.cpp"
|
||||||
#include "4coder_fancy.cpp"
|
#include "4coder_fancy.cpp"
|
||||||
#include "4coder_ui_helper.cpp"
|
#include "4coder_ui_helper.cpp"
|
||||||
|
|
|
@ -47,11 +47,14 @@ struct Application_Links;
|
||||||
#define BUFFER_GET_FILE_ATTRIBUTES_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, File_Attributes *attributes_out)
|
#define BUFFER_GET_FILE_ATTRIBUTES_SIG(n) b32 n(Application_Links *app, Buffer_ID buffer_id, File_Attributes *attributes_out)
|
||||||
#define GET_VIEW_NEXT_SIG(n) b32 n(Application_Links *app, View_ID view_id, Access_Flag access, View_ID *view_id_out)
|
#define GET_VIEW_NEXT_SIG(n) b32 n(Application_Links *app, View_ID view_id, Access_Flag access, View_ID *view_id_out)
|
||||||
#define GET_VIEW_PREV_SIG(n) b32 n(Application_Links *app, View_ID view_id, Access_Flag access, View_ID *view_id_out)
|
#define GET_VIEW_PREV_SIG(n) b32 n(Application_Links *app, View_ID view_id, Access_Flag access, View_ID *view_id_out)
|
||||||
#define GET_VIEW_SUMMARY_SIG(n) b32 n(Application_Links *app, View_ID view_id, Access_Flag access, View_Summary *view_summary_out)
|
|
||||||
#define GET_ACTIVE_VIEW_SIG(n) b32 n(Application_Links *app, Access_Flag access, View_ID *view_id_out)
|
#define GET_ACTIVE_VIEW_SIG(n) b32 n(Application_Links *app, Access_Flag access, View_ID *view_id_out)
|
||||||
#define GET_ACTIVE_PANEL_SIG(n) b32 n(Application_Links *app, Panel_ID *panel_id_out)
|
#define GET_ACTIVE_PANEL_SIG(n) b32 n(Application_Links *app, Panel_ID *panel_id_out)
|
||||||
|
#define VIEW_EXISTS_SIG(n) b32 n(Application_Links *app, View_ID view_id)
|
||||||
#define VIEW_GET_BUFFER_SIG(n) b32 n(Application_Links *app, View_ID view_id, Access_Flag access, Buffer_ID *buffer_id_out)
|
#define VIEW_GET_BUFFER_SIG(n) b32 n(Application_Links *app, View_ID view_id, Access_Flag access, Buffer_ID *buffer_id_out)
|
||||||
#define VIEW_GET_CURSOR_POS_SIG(n) b32 n(Application_Links *app, View_ID view_id, i32 *pos_out)
|
#define VIEW_GET_CURSOR_POS_SIG(n) b32 n(Application_Links *app, View_ID view_id, i32 *pos_out)
|
||||||
|
#define VIEW_GET_MARK_POS_SIG(n) b32 n(Application_Links *app, View_ID view_id, i32 *pos_out)
|
||||||
|
#define VIEW_GET_PREFERRED_X_SIG(n) b32 n(Application_Links *app, View_ID view_id, f32 *preferred_x_out)
|
||||||
|
#define VIEW_GET_SCREEN_RECT_SIG(n) b32 n(Application_Links *app, View_ID view_id, Rect_f32 *rect_out)
|
||||||
#define VIEW_GET_PANEL_SIG(n) b32 n(Application_Links *app, View_ID view_id, Panel_ID *panel_id_out)
|
#define VIEW_GET_PANEL_SIG(n) b32 n(Application_Links *app, View_ID view_id, Panel_ID *panel_id_out)
|
||||||
#define PANEL_GET_VIEW_SIG(n) b32 n(Application_Links *app, Panel_ID panel_id, View_ID *view_id_out)
|
#define PANEL_GET_VIEW_SIG(n) b32 n(Application_Links *app, Panel_ID panel_id, View_ID *view_id_out)
|
||||||
#define PANEL_IS_SPLIT_SIG(n) b32 n(Application_Links *app, Panel_ID panel_id)
|
#define PANEL_IS_SPLIT_SIG(n) b32 n(Application_Links *app, Panel_ID panel_id)
|
||||||
|
@ -229,11 +232,14 @@ typedef BUFFER_REOPEN_SIG(Buffer_Reopen_Function);
|
||||||
typedef BUFFER_GET_FILE_ATTRIBUTES_SIG(Buffer_Get_File_Attributes_Function);
|
typedef BUFFER_GET_FILE_ATTRIBUTES_SIG(Buffer_Get_File_Attributes_Function);
|
||||||
typedef GET_VIEW_NEXT_SIG(Get_View_Next_Function);
|
typedef GET_VIEW_NEXT_SIG(Get_View_Next_Function);
|
||||||
typedef GET_VIEW_PREV_SIG(Get_View_Prev_Function);
|
typedef GET_VIEW_PREV_SIG(Get_View_Prev_Function);
|
||||||
typedef GET_VIEW_SUMMARY_SIG(Get_View_Summary_Function);
|
|
||||||
typedef GET_ACTIVE_VIEW_SIG(Get_Active_View_Function);
|
typedef GET_ACTIVE_VIEW_SIG(Get_Active_View_Function);
|
||||||
typedef GET_ACTIVE_PANEL_SIG(Get_Active_Panel_Function);
|
typedef GET_ACTIVE_PANEL_SIG(Get_Active_Panel_Function);
|
||||||
|
typedef VIEW_EXISTS_SIG(View_Exists_Function);
|
||||||
typedef VIEW_GET_BUFFER_SIG(View_Get_Buffer_Function);
|
typedef VIEW_GET_BUFFER_SIG(View_Get_Buffer_Function);
|
||||||
typedef VIEW_GET_CURSOR_POS_SIG(View_Get_Cursor_Pos_Function);
|
typedef VIEW_GET_CURSOR_POS_SIG(View_Get_Cursor_Pos_Function);
|
||||||
|
typedef VIEW_GET_MARK_POS_SIG(View_Get_Mark_Pos_Function);
|
||||||
|
typedef VIEW_GET_PREFERRED_X_SIG(View_Get_Preferred_X_Function);
|
||||||
|
typedef VIEW_GET_SCREEN_RECT_SIG(View_Get_Screen_Rect_Function);
|
||||||
typedef VIEW_GET_PANEL_SIG(View_Get_Panel_Function);
|
typedef VIEW_GET_PANEL_SIG(View_Get_Panel_Function);
|
||||||
typedef PANEL_GET_VIEW_SIG(Panel_Get_View_Function);
|
typedef PANEL_GET_VIEW_SIG(Panel_Get_View_Function);
|
||||||
typedef PANEL_IS_SPLIT_SIG(Panel_Is_Split_Function);
|
typedef PANEL_IS_SPLIT_SIG(Panel_Is_Split_Function);
|
||||||
|
@ -413,11 +419,14 @@ Buffer_Reopen_Function *buffer_reopen;
|
||||||
Buffer_Get_File_Attributes_Function *buffer_get_file_attributes;
|
Buffer_Get_File_Attributes_Function *buffer_get_file_attributes;
|
||||||
Get_View_Next_Function *get_view_next;
|
Get_View_Next_Function *get_view_next;
|
||||||
Get_View_Prev_Function *get_view_prev;
|
Get_View_Prev_Function *get_view_prev;
|
||||||
Get_View_Summary_Function *get_view_summary;
|
|
||||||
Get_Active_View_Function *get_active_view;
|
Get_Active_View_Function *get_active_view;
|
||||||
Get_Active_Panel_Function *get_active_panel;
|
Get_Active_Panel_Function *get_active_panel;
|
||||||
|
View_Exists_Function *view_exists;
|
||||||
View_Get_Buffer_Function *view_get_buffer;
|
View_Get_Buffer_Function *view_get_buffer;
|
||||||
View_Get_Cursor_Pos_Function *view_get_cursor_pos;
|
View_Get_Cursor_Pos_Function *view_get_cursor_pos;
|
||||||
|
View_Get_Mark_Pos_Function *view_get_mark_pos;
|
||||||
|
View_Get_Preferred_X_Function *view_get_preferred_x;
|
||||||
|
View_Get_Screen_Rect_Function *view_get_screen_rect;
|
||||||
View_Get_Panel_Function *view_get_panel;
|
View_Get_Panel_Function *view_get_panel;
|
||||||
Panel_Get_View_Function *panel_get_view;
|
Panel_Get_View_Function *panel_get_view;
|
||||||
Panel_Is_Split_Function *panel_is_split;
|
Panel_Is_Split_Function *panel_is_split;
|
||||||
|
@ -596,11 +605,14 @@ Buffer_Reopen_Function *buffer_reopen_;
|
||||||
Buffer_Get_File_Attributes_Function *buffer_get_file_attributes_;
|
Buffer_Get_File_Attributes_Function *buffer_get_file_attributes_;
|
||||||
Get_View_Next_Function *get_view_next_;
|
Get_View_Next_Function *get_view_next_;
|
||||||
Get_View_Prev_Function *get_view_prev_;
|
Get_View_Prev_Function *get_view_prev_;
|
||||||
Get_View_Summary_Function *get_view_summary_;
|
|
||||||
Get_Active_View_Function *get_active_view_;
|
Get_Active_View_Function *get_active_view_;
|
||||||
Get_Active_Panel_Function *get_active_panel_;
|
Get_Active_Panel_Function *get_active_panel_;
|
||||||
|
View_Exists_Function *view_exists_;
|
||||||
View_Get_Buffer_Function *view_get_buffer_;
|
View_Get_Buffer_Function *view_get_buffer_;
|
||||||
View_Get_Cursor_Pos_Function *view_get_cursor_pos_;
|
View_Get_Cursor_Pos_Function *view_get_cursor_pos_;
|
||||||
|
View_Get_Mark_Pos_Function *view_get_mark_pos_;
|
||||||
|
View_Get_Preferred_X_Function *view_get_preferred_x_;
|
||||||
|
View_Get_Screen_Rect_Function *view_get_screen_rect_;
|
||||||
View_Get_Panel_Function *view_get_panel_;
|
View_Get_Panel_Function *view_get_panel_;
|
||||||
Panel_Get_View_Function *panel_get_view_;
|
Panel_Get_View_Function *panel_get_view_;
|
||||||
Panel_Is_Split_Function *panel_is_split_;
|
Panel_Is_Split_Function *panel_is_split_;
|
||||||
|
@ -787,11 +799,14 @@ app_links->buffer_reopen_ = Buffer_Reopen;\
|
||||||
app_links->buffer_get_file_attributes_ = Buffer_Get_File_Attributes;\
|
app_links->buffer_get_file_attributes_ = Buffer_Get_File_Attributes;\
|
||||||
app_links->get_view_next_ = Get_View_Next;\
|
app_links->get_view_next_ = Get_View_Next;\
|
||||||
app_links->get_view_prev_ = Get_View_Prev;\
|
app_links->get_view_prev_ = Get_View_Prev;\
|
||||||
app_links->get_view_summary_ = Get_View_Summary;\
|
|
||||||
app_links->get_active_view_ = Get_Active_View;\
|
app_links->get_active_view_ = Get_Active_View;\
|
||||||
app_links->get_active_panel_ = Get_Active_Panel;\
|
app_links->get_active_panel_ = Get_Active_Panel;\
|
||||||
|
app_links->view_exists_ = View_Exists;\
|
||||||
app_links->view_get_buffer_ = View_Get_Buffer;\
|
app_links->view_get_buffer_ = View_Get_Buffer;\
|
||||||
app_links->view_get_cursor_pos_ = View_Get_Cursor_Pos;\
|
app_links->view_get_cursor_pos_ = View_Get_Cursor_Pos;\
|
||||||
|
app_links->view_get_mark_pos_ = View_Get_Mark_Pos;\
|
||||||
|
app_links->view_get_preferred_x_ = View_Get_Preferred_X;\
|
||||||
|
app_links->view_get_screen_rect_ = View_Get_Screen_Rect;\
|
||||||
app_links->view_get_panel_ = View_Get_Panel;\
|
app_links->view_get_panel_ = View_Get_Panel;\
|
||||||
app_links->panel_get_view_ = Panel_Get_View;\
|
app_links->panel_get_view_ = Panel_Get_View;\
|
||||||
app_links->panel_is_split_ = Panel_Is_Split;\
|
app_links->panel_is_split_ = Panel_Is_Split;\
|
||||||
|
@ -970,11 +985,14 @@ static b32 buffer_reopen(Application_Links *app, Buffer_ID buffer_id, Buffer_Reo
|
||||||
static b32 buffer_get_file_attributes(Application_Links *app, Buffer_ID buffer_id, File_Attributes *attributes_out){return(app->buffer_get_file_attributes(app, buffer_id, attributes_out));}
|
static b32 buffer_get_file_attributes(Application_Links *app, Buffer_ID buffer_id, File_Attributes *attributes_out){return(app->buffer_get_file_attributes(app, buffer_id, attributes_out));}
|
||||||
static b32 get_view_next(Application_Links *app, View_ID view_id, Access_Flag access, View_ID *view_id_out){return(app->get_view_next(app, view_id, access, view_id_out));}
|
static b32 get_view_next(Application_Links *app, View_ID view_id, Access_Flag access, View_ID *view_id_out){return(app->get_view_next(app, view_id, access, view_id_out));}
|
||||||
static b32 get_view_prev(Application_Links *app, View_ID view_id, Access_Flag access, View_ID *view_id_out){return(app->get_view_prev(app, view_id, access, view_id_out));}
|
static b32 get_view_prev(Application_Links *app, View_ID view_id, Access_Flag access, View_ID *view_id_out){return(app->get_view_prev(app, view_id, access, view_id_out));}
|
||||||
static b32 get_view_summary(Application_Links *app, View_ID view_id, Access_Flag access, View_Summary *view_summary_out){return(app->get_view_summary(app, view_id, access, view_summary_out));}
|
|
||||||
static b32 get_active_view(Application_Links *app, Access_Flag access, View_ID *view_id_out){return(app->get_active_view(app, access, view_id_out));}
|
static b32 get_active_view(Application_Links *app, Access_Flag access, View_ID *view_id_out){return(app->get_active_view(app, access, view_id_out));}
|
||||||
static b32 get_active_panel(Application_Links *app, Panel_ID *panel_id_out){return(app->get_active_panel(app, panel_id_out));}
|
static b32 get_active_panel(Application_Links *app, Panel_ID *panel_id_out){return(app->get_active_panel(app, panel_id_out));}
|
||||||
|
static b32 view_exists(Application_Links *app, View_ID view_id){return(app->view_exists(app, view_id));}
|
||||||
static b32 view_get_buffer(Application_Links *app, View_ID view_id, Access_Flag access, Buffer_ID *buffer_id_out){return(app->view_get_buffer(app, view_id, access, buffer_id_out));}
|
static b32 view_get_buffer(Application_Links *app, View_ID view_id, Access_Flag access, Buffer_ID *buffer_id_out){return(app->view_get_buffer(app, view_id, access, buffer_id_out));}
|
||||||
static b32 view_get_cursor_pos(Application_Links *app, View_ID view_id, i32 *pos_out){return(app->view_get_cursor_pos(app, view_id, pos_out));}
|
static b32 view_get_cursor_pos(Application_Links *app, View_ID view_id, i32 *pos_out){return(app->view_get_cursor_pos(app, view_id, pos_out));}
|
||||||
|
static b32 view_get_mark_pos(Application_Links *app, View_ID view_id, i32 *pos_out){return(app->view_get_mark_pos(app, view_id, pos_out));}
|
||||||
|
static b32 view_get_preferred_x(Application_Links *app, View_ID view_id, f32 *preferred_x_out){return(app->view_get_preferred_x(app, view_id, preferred_x_out));}
|
||||||
|
static b32 view_get_screen_rect(Application_Links *app, View_ID view_id, Rect_f32 *rect_out){return(app->view_get_screen_rect(app, view_id, rect_out));}
|
||||||
static b32 view_get_panel(Application_Links *app, View_ID view_id, Panel_ID *panel_id_out){return(app->view_get_panel(app, view_id, panel_id_out));}
|
static b32 view_get_panel(Application_Links *app, View_ID view_id, Panel_ID *panel_id_out){return(app->view_get_panel(app, view_id, panel_id_out));}
|
||||||
static b32 panel_get_view(Application_Links *app, Panel_ID panel_id, View_ID *view_id_out){return(app->panel_get_view(app, panel_id, view_id_out));}
|
static b32 panel_get_view(Application_Links *app, Panel_ID panel_id, View_ID *view_id_out){return(app->panel_get_view(app, panel_id, view_id_out));}
|
||||||
static b32 panel_is_split(Application_Links *app, Panel_ID panel_id){return(app->panel_is_split(app, panel_id));}
|
static b32 panel_is_split(Application_Links *app, Panel_ID panel_id){return(app->panel_is_split(app, panel_id));}
|
||||||
|
@ -1153,11 +1171,14 @@ static b32 buffer_reopen(Application_Links *app, Buffer_ID buffer_id, Buffer_Reo
|
||||||
static b32 buffer_get_file_attributes(Application_Links *app, Buffer_ID buffer_id, File_Attributes *attributes_out){return(app->buffer_get_file_attributes_(app, buffer_id, attributes_out));}
|
static b32 buffer_get_file_attributes(Application_Links *app, Buffer_ID buffer_id, File_Attributes *attributes_out){return(app->buffer_get_file_attributes_(app, buffer_id, attributes_out));}
|
||||||
static b32 get_view_next(Application_Links *app, View_ID view_id, Access_Flag access, View_ID *view_id_out){return(app->get_view_next_(app, view_id, access, view_id_out));}
|
static b32 get_view_next(Application_Links *app, View_ID view_id, Access_Flag access, View_ID *view_id_out){return(app->get_view_next_(app, view_id, access, view_id_out));}
|
||||||
static b32 get_view_prev(Application_Links *app, View_ID view_id, Access_Flag access, View_ID *view_id_out){return(app->get_view_prev_(app, view_id, access, view_id_out));}
|
static b32 get_view_prev(Application_Links *app, View_ID view_id, Access_Flag access, View_ID *view_id_out){return(app->get_view_prev_(app, view_id, access, view_id_out));}
|
||||||
static b32 get_view_summary(Application_Links *app, View_ID view_id, Access_Flag access, View_Summary *view_summary_out){return(app->get_view_summary_(app, view_id, access, view_summary_out));}
|
|
||||||
static b32 get_active_view(Application_Links *app, Access_Flag access, View_ID *view_id_out){return(app->get_active_view_(app, access, view_id_out));}
|
static b32 get_active_view(Application_Links *app, Access_Flag access, View_ID *view_id_out){return(app->get_active_view_(app, access, view_id_out));}
|
||||||
static b32 get_active_panel(Application_Links *app, Panel_ID *panel_id_out){return(app->get_active_panel_(app, panel_id_out));}
|
static b32 get_active_panel(Application_Links *app, Panel_ID *panel_id_out){return(app->get_active_panel_(app, panel_id_out));}
|
||||||
|
static b32 view_exists(Application_Links *app, View_ID view_id){return(app->view_exists_(app, view_id));}
|
||||||
static b32 view_get_buffer(Application_Links *app, View_ID view_id, Access_Flag access, Buffer_ID *buffer_id_out){return(app->view_get_buffer_(app, view_id, access, buffer_id_out));}
|
static b32 view_get_buffer(Application_Links *app, View_ID view_id, Access_Flag access, Buffer_ID *buffer_id_out){return(app->view_get_buffer_(app, view_id, access, buffer_id_out));}
|
||||||
static b32 view_get_cursor_pos(Application_Links *app, View_ID view_id, i32 *pos_out){return(app->view_get_cursor_pos_(app, view_id, pos_out));}
|
static b32 view_get_cursor_pos(Application_Links *app, View_ID view_id, i32 *pos_out){return(app->view_get_cursor_pos_(app, view_id, pos_out));}
|
||||||
|
static b32 view_get_mark_pos(Application_Links *app, View_ID view_id, i32 *pos_out){return(app->view_get_mark_pos_(app, view_id, pos_out));}
|
||||||
|
static b32 view_get_preferred_x(Application_Links *app, View_ID view_id, f32 *preferred_x_out){return(app->view_get_preferred_x_(app, view_id, preferred_x_out));}
|
||||||
|
static b32 view_get_screen_rect(Application_Links *app, View_ID view_id, Rect_f32 *rect_out){return(app->view_get_screen_rect_(app, view_id, rect_out));}
|
||||||
static b32 view_get_panel(Application_Links *app, View_ID view_id, Panel_ID *panel_id_out){return(app->view_get_panel_(app, view_id, panel_id_out));}
|
static b32 view_get_panel(Application_Links *app, View_ID view_id, Panel_ID *panel_id_out){return(app->view_get_panel_(app, view_id, panel_id_out));}
|
||||||
static b32 panel_get_view(Application_Links *app, Panel_ID panel_id, View_ID *view_id_out){return(app->panel_get_view_(app, panel_id, view_id_out));}
|
static b32 panel_get_view(Application_Links *app, Panel_ID panel_id, View_ID *view_id_out){return(app->panel_get_view_(app, panel_id, view_id_out));}
|
||||||
static b32 panel_is_split(Application_Links *app, Panel_ID panel_id){return(app->panel_is_split_(app, panel_id));}
|
static b32 panel_is_split(Application_Links *app, Panel_ID panel_id){return(app->panel_is_split_(app, panel_id));}
|
||||||
|
|
|
@ -18,7 +18,7 @@ CUSTOM_DOC("A lister mode command that activates the list's action on the highli
|
||||||
Partition *scratch = &global_part;
|
Partition *scratch = &global_part;
|
||||||
Heap *heap = &global_heap;
|
Heap *heap = &global_heap;
|
||||||
View_Summary view = get_active_view(app, AccessAll);
|
View_Summary view = get_active_view(app, AccessAll);
|
||||||
Lister_State *state = view_get_lister_state(&view);
|
Lister_State *state = view_get_lister_state(view.view_id);
|
||||||
if (state->initialized){
|
if (state->initialized){
|
||||||
void *user_data = 0;
|
void *user_data = 0;
|
||||||
if (0 <= state->raw_item_index && state->raw_item_index < state->lister.data.options.count){
|
if (0 <= state->raw_item_index && state->raw_item_index < state->lister.data.options.count){
|
||||||
|
@ -32,7 +32,7 @@ CUSTOM_COMMAND_SIG(lister__write_character)
|
||||||
CUSTOM_DOC("A lister mode command that dispatches to the lister's write character handler.")
|
CUSTOM_DOC("A lister mode command that dispatches to the lister's write character handler.")
|
||||||
{
|
{
|
||||||
View_Summary view = get_active_view(app, AccessAll);
|
View_Summary view = get_active_view(app, AccessAll);
|
||||||
Lister_State *state = view_get_lister_state(&view);
|
Lister_State *state = view_get_lister_state(view.view_id);
|
||||||
if (state->lister.data.handlers.write_character != 0){
|
if (state->lister.data.handlers.write_character != 0){
|
||||||
state->lister.data.handlers.write_character(app);
|
state->lister.data.handlers.write_character(app);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ CUSTOM_COMMAND_SIG(lister__backspace_text_field)
|
||||||
CUSTOM_DOC("A lister mode command that dispatches to the lister's backspace text field handler.")
|
CUSTOM_DOC("A lister mode command that dispatches to the lister's backspace text field handler.")
|
||||||
{
|
{
|
||||||
View_Summary view = get_active_view(app, AccessAll);
|
View_Summary view = get_active_view(app, AccessAll);
|
||||||
Lister_State *state = view_get_lister_state(&view);
|
Lister_State *state = view_get_lister_state(view.view_id);
|
||||||
if (state->lister.data.handlers.backspace != 0){
|
if (state->lister.data.handlers.backspace != 0){
|
||||||
state->lister.data.handlers.backspace(app);
|
state->lister.data.handlers.backspace(app);
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ CUSTOM_COMMAND_SIG(lister__move_up)
|
||||||
CUSTOM_DOC("A lister mode command that dispatches to the lister's navigate up handler.")
|
CUSTOM_DOC("A lister mode command that dispatches to the lister's navigate up handler.")
|
||||||
{
|
{
|
||||||
View_Summary view = get_active_view(app, AccessAll);
|
View_Summary view = get_active_view(app, AccessAll);
|
||||||
Lister_State *state = view_get_lister_state(&view);
|
Lister_State *state = view_get_lister_state(view.view_id);
|
||||||
if (state->lister.data.handlers.navigate_up != 0){
|
if (state->lister.data.handlers.navigate_up != 0){
|
||||||
state->lister.data.handlers.navigate_up(app);
|
state->lister.data.handlers.navigate_up(app);
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ CUSTOM_COMMAND_SIG(lister__move_down)
|
||||||
CUSTOM_DOC("A lister mode command that dispatches to the lister's navigate down handler.")
|
CUSTOM_DOC("A lister mode command that dispatches to the lister's navigate down handler.")
|
||||||
{
|
{
|
||||||
View_Summary view = get_active_view(app, AccessAll);
|
View_Summary view = get_active_view(app, AccessAll);
|
||||||
Lister_State *state = view_get_lister_state(&view);
|
Lister_State *state = view_get_lister_state(view.view_id);
|
||||||
if (state->lister.data.handlers.navigate_down != 0){
|
if (state->lister.data.handlers.navigate_down != 0){
|
||||||
state->lister.data.handlers.navigate_down(app);
|
state->lister.data.handlers.navigate_down(app);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ CUSTOM_DOC("A lister mode command that scrolls the list in response to the mouse
|
||||||
Mouse_State mouse = get_mouse_state(app);
|
Mouse_State mouse = get_mouse_state(app);
|
||||||
scroll.target_y += mouse.wheel;
|
scroll.target_y += mouse.wheel;
|
||||||
view_set_scroll(app, &view, scroll);
|
view_set_scroll(app, &view, scroll);
|
||||||
Lister_State *state = view_get_lister_state(&view);
|
Lister_State *state = view_get_lister_state(view.view_id);
|
||||||
if (state->initialized){
|
if (state->initialized){
|
||||||
lister_update_ui(app, scratch, &view, state);
|
lister_update_ui(app, scratch, &view, state);
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ CUSTOM_DOC("A lister mode command that beings a click interaction with a list it
|
||||||
{
|
{
|
||||||
Partition *scratch = &global_part;
|
Partition *scratch = &global_part;
|
||||||
View_Summary view = get_active_view(app, AccessAll);
|
View_Summary view = get_active_view(app, AccessAll);
|
||||||
Lister_State *state = view_get_lister_state(&view);
|
Lister_State *state = view_get_lister_state(view.view_id);
|
||||||
if (state->initialized){
|
if (state->initialized){
|
||||||
UI_Item clicked = lister_get_clicked_item(app, view.view_id, scratch);
|
UI_Item clicked = lister_get_clicked_item(app, view.view_id, scratch);
|
||||||
state->hot_user_data = clicked.user_data;
|
state->hot_user_data = clicked.user_data;
|
||||||
|
@ -101,7 +101,7 @@ CUSTOM_DOC("A lister mode command that ends a click interaction with a list item
|
||||||
Partition *scratch = &global_part;
|
Partition *scratch = &global_part;
|
||||||
Heap *heap = &global_heap;
|
Heap *heap = &global_heap;
|
||||||
View_Summary view = get_active_view(app, AccessAll);
|
View_Summary view = get_active_view(app, AccessAll);
|
||||||
Lister_State *state = view_get_lister_state(&view);
|
Lister_State *state = view_get_lister_state(view.view_id);
|
||||||
if (state->initialized && state->hot_user_data != 0){
|
if (state->initialized && state->hot_user_data != 0){
|
||||||
UI_Item clicked = lister_get_clicked_item(app, view.view_id, scratch);
|
UI_Item clicked = lister_get_clicked_item(app, view.view_id, scratch);
|
||||||
if (state->hot_user_data == clicked.user_data){
|
if (state->hot_user_data == clicked.user_data){
|
||||||
|
@ -116,7 +116,7 @@ CUSTOM_DOC("A lister mode command that updates the lists UI data.")
|
||||||
{
|
{
|
||||||
Partition *scratch = &global_part;
|
Partition *scratch = &global_part;
|
||||||
View_Summary view = get_active_view(app, AccessAll);
|
View_Summary view = get_active_view(app, AccessAll);
|
||||||
Lister_State *state = view_get_lister_state(&view);
|
Lister_State *state = view_get_lister_state(view.view_id);
|
||||||
if (state->initialized){
|
if (state->initialized){
|
||||||
lister_update_ui(app, scratch, &view, state);
|
lister_update_ui(app, scratch, &view, state);
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ CUSTOM_DOC("A lister mode command that inserts a new character to the text field
|
||||||
{
|
{
|
||||||
Partition *scratch = &global_part;
|
Partition *scratch = &global_part;
|
||||||
View_Summary view = get_active_view(app, AccessAll);
|
View_Summary view = get_active_view(app, AccessAll);
|
||||||
Lister_State *state = view_get_lister_state(&view);
|
Lister_State *state = view_get_lister_state(view.view_id);
|
||||||
if (state->initialized){
|
if (state->initialized){
|
||||||
User_Input in = get_command_input(app);
|
User_Input in = get_command_input(app);
|
||||||
u8 character[4];
|
u8 character[4];
|
||||||
|
@ -147,7 +147,7 @@ CUSTOM_DOC("A lister mode command that backspaces one character from the text fi
|
||||||
{
|
{
|
||||||
Partition *scratch = &global_part;
|
Partition *scratch = &global_part;
|
||||||
View_Summary view = get_active_view(app, AccessAll);
|
View_Summary view = get_active_view(app, AccessAll);
|
||||||
Lister_State *state = view_get_lister_state(&view);
|
Lister_State *state = view_get_lister_state(view.view_id);
|
||||||
if (state->initialized){
|
if (state->initialized){
|
||||||
backspace_utf8(&state->lister.data.text_field);
|
backspace_utf8(&state->lister.data.text_field);
|
||||||
backspace_utf8(&state->lister.data.key_string);
|
backspace_utf8(&state->lister.data.key_string);
|
||||||
|
@ -162,7 +162,7 @@ CUSTOM_DOC("A lister mode command that moves the highlighted item one up in the
|
||||||
{
|
{
|
||||||
Partition *scratch = &global_part;
|
Partition *scratch = &global_part;
|
||||||
View_Summary view = get_active_view(app, AccessAll);
|
View_Summary view = get_active_view(app, AccessAll);
|
||||||
Lister_State *state = view_get_lister_state(&view);
|
Lister_State *state = view_get_lister_state(view.view_id);
|
||||||
if (state->initialized){
|
if (state->initialized){
|
||||||
state->item_index = state->item_index - 1;
|
state->item_index = state->item_index - 1;
|
||||||
if (state->item_index < 0){
|
if (state->item_index < 0){
|
||||||
|
@ -178,7 +178,7 @@ CUSTOM_DOC("A lister mode command that moves the highlighted item one down in th
|
||||||
{
|
{
|
||||||
Partition *scratch = &global_part;
|
Partition *scratch = &global_part;
|
||||||
View_Summary view = get_active_view(app, AccessAll);
|
View_Summary view = get_active_view(app, AccessAll);
|
||||||
Lister_State *state = view_get_lister_state(&view);
|
Lister_State *state = view_get_lister_state(view.view_id);
|
||||||
if (state->initialized){
|
if (state->initialized){
|
||||||
state->item_index = state->item_index + 1;
|
state->item_index = state->item_index + 1;
|
||||||
if (state->item_index > state->item_count_after_filter - 1){
|
if (state->item_index > state->item_count_after_filter - 1){
|
||||||
|
@ -194,7 +194,7 @@ CUSTOM_DOC("A lister mode command that inserts a character into the text field o
|
||||||
{
|
{
|
||||||
Partition *scratch = &global_part;
|
Partition *scratch = &global_part;
|
||||||
View_Summary view = get_active_view(app, AccessAll);
|
View_Summary view = get_active_view(app, AccessAll);
|
||||||
Lister_State *state = view_get_lister_state(&view);
|
Lister_State *state = view_get_lister_state(view.view_id);
|
||||||
if (state->initialized){
|
if (state->initialized){
|
||||||
User_Input in = get_command_input(app);
|
User_Input in = get_command_input(app);
|
||||||
u8 character[4];
|
u8 character[4];
|
||||||
|
@ -219,7 +219,7 @@ CUSTOM_DOC("A lister mode command that backspaces one character from the text fi
|
||||||
{
|
{
|
||||||
Partition *scratch = &global_part;
|
Partition *scratch = &global_part;
|
||||||
View_Summary view = get_active_view(app, AccessAll);
|
View_Summary view = get_active_view(app, AccessAll);
|
||||||
Lister_State *state = view_get_lister_state(&view);
|
Lister_State *state = view_get_lister_state(view.view_id);
|
||||||
if (state->initialized){
|
if (state->initialized){
|
||||||
if (state->lister.data.text_field.size > 0){
|
if (state->lister.data.text_field.size > 0){
|
||||||
char last_char = state->lister.data.text_field.str[state->lister.data.text_field.size - 1];
|
char last_char = state->lister.data.text_field.str[state->lister.data.text_field.size - 1];
|
||||||
|
@ -259,7 +259,7 @@ CUSTOM_DOC("A lister mode command that handles input for the fixed sure to kill
|
||||||
Partition *scratch = &global_part;
|
Partition *scratch = &global_part;
|
||||||
Heap *heap = &global_heap;
|
Heap *heap = &global_heap;
|
||||||
View_Summary view = get_active_view(app, AccessAll);
|
View_Summary view = get_active_view(app, AccessAll);
|
||||||
Lister_State *state = view_get_lister_state(&view);
|
Lister_State *state = view_get_lister_state(view.view_id);
|
||||||
if (state->initialized){
|
if (state->initialized){
|
||||||
User_Input in = get_command_input(app);
|
User_Input in = get_command_input(app);
|
||||||
u8 character[4];
|
u8 character[4];
|
||||||
|
@ -316,7 +316,7 @@ begin_integrated_lister__with_refresh_handler(Application_Links *app, char *quer
|
||||||
Heap *heap = &global_heap;
|
Heap *heap = &global_heap;
|
||||||
view_begin_ui_mode(app, view);
|
view_begin_ui_mode(app, view);
|
||||||
view_set_setting(app, view, ViewSetting_UICommandMap, default_lister_ui_map);
|
view_set_setting(app, view, ViewSetting_UICommandMap, default_lister_ui_map);
|
||||||
Lister_State *state = view_get_lister_state(view);
|
Lister_State *state = view_get_lister_state(view->view_id);
|
||||||
init_lister_state(app, state, heap);
|
init_lister_state(app, state, heap);
|
||||||
lister_first_init(app, &state->lister, user_data, user_data_size);
|
lister_first_init(app, &state->lister, user_data, user_data_size);
|
||||||
lister_set_query_string(&state->lister.data, query_string);
|
lister_set_query_string(&state->lister.data, query_string);
|
||||||
|
@ -354,7 +354,7 @@ begin_integrated_lister__basic_list(Application_Links *app, char *query_string,
|
||||||
Heap *heap = &global_heap;
|
Heap *heap = &global_heap;
|
||||||
view_begin_ui_mode(app, view);
|
view_begin_ui_mode(app, view);
|
||||||
view_set_setting(app, view, ViewSetting_UICommandMap, default_lister_ui_map);
|
view_set_setting(app, view, ViewSetting_UICommandMap, default_lister_ui_map);
|
||||||
Lister_State *state = view_get_lister_state(view);
|
Lister_State *state = view_get_lister_state(view->view_id);
|
||||||
init_lister_state(app, state, heap);
|
init_lister_state(app, state, heap);
|
||||||
lister_first_init(app, &state->lister, user_data, user_data_size);
|
lister_first_init(app, &state->lister, user_data, user_data_size);
|
||||||
for (i32 i = 0; i < option_count; i += 1){
|
for (i32 i = 0; i < option_count; i += 1){
|
||||||
|
@ -377,7 +377,7 @@ begin_integrated_lister__with_fixed_options(Application_Links *app, char *query_
|
||||||
Heap *heap = &global_heap;
|
Heap *heap = &global_heap;
|
||||||
view_begin_ui_mode(app, view);
|
view_begin_ui_mode(app, view);
|
||||||
view_set_setting(app, view, ViewSetting_UICommandMap, default_lister_ui_map);
|
view_set_setting(app, view, ViewSetting_UICommandMap, default_lister_ui_map);
|
||||||
Lister_State *state = view_get_lister_state(view);
|
Lister_State *state = view_get_lister_state(view->view_id);
|
||||||
init_lister_state(app, state, heap);
|
init_lister_state(app, state, heap);
|
||||||
lister_first_init(app, &state->lister, user_data, user_data_size);
|
lister_first_init(app, &state->lister, user_data, user_data_size);
|
||||||
for (i32 i = 0; i < option_count; i += 1){
|
for (i32 i = 0; i < option_count; i += 1){
|
||||||
|
@ -423,7 +423,7 @@ begin_integrated_lister__theme_list(Application_Links *app, char *query_string,
|
||||||
Heap *heap = &global_heap;
|
Heap *heap = &global_heap;
|
||||||
view_begin_ui_mode(app, view);
|
view_begin_ui_mode(app, view);
|
||||||
view_set_setting(app, view, ViewSetting_UICommandMap, default_lister_ui_map);
|
view_set_setting(app, view, ViewSetting_UICommandMap, default_lister_ui_map);
|
||||||
Lister_State *state = view_get_lister_state(view);
|
Lister_State *state = view_get_lister_state(view->view_id);
|
||||||
init_lister_state(app, state, heap);
|
init_lister_state(app, state, heap);
|
||||||
lister_first_init(app, &state->lister, user_data, user_data_size);
|
lister_first_init(app, &state->lister, user_data, user_data_size);
|
||||||
state->lister.data.theme_list = true;
|
state->lister.data.theme_list = true;
|
||||||
|
|
|
@ -260,12 +260,13 @@ panel_space_from_view_space(Vec2_i32 p, Vec2_i32 scroll_p){
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
|
// TODO(allen): VIEW_16_LIMIT
|
||||||
Lister_State global_lister_state_[16] = {};
|
Lister_State global_lister_state_[16] = {};
|
||||||
Lister_State *global_lister_state = global_lister_state_ - 1;
|
Lister_State *global_lister_state = global_lister_state_ - 1;
|
||||||
|
|
||||||
static Lister_State*
|
static Lister_State*
|
||||||
view_get_lister_state(View_Summary *view){
|
view_get_lister_state(View_ID view){
|
||||||
return(&global_lister_state[view->view_id]);
|
return(&global_lister_state[view]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static i32
|
static i32
|
||||||
|
@ -292,9 +293,9 @@ init_lister_state(Application_Links *app, Lister_State *state, Heap *heap){
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_QUIT_FUNCTION(lister_quit_function){
|
UI_QUIT_FUNCTION(lister_quit_function){
|
||||||
Lister_State *state = view_get_lister_state(&view);
|
Lister_State *state = view_get_lister_state(view);
|
||||||
state->initialized = false;
|
state->initialized = false;
|
||||||
view_clear_ui_data(app, view.view_id);
|
view_clear_ui_data(app, view);
|
||||||
}
|
}
|
||||||
|
|
||||||
static UI_Item
|
static UI_Item
|
||||||
|
@ -348,7 +349,7 @@ lister_update_ui(Application_Links *app, Partition *scratch, View_Summary *view,
|
||||||
b32 is_theme_list = state->lister.data.theme_list;
|
b32 is_theme_list = state->lister.data.theme_list;
|
||||||
|
|
||||||
i32 x0 = 0;
|
i32 x0 = 0;
|
||||||
i32 x1 = rect_width(view->view_region);
|
i32 x1 = (i32)(rect_width(view->view_region));
|
||||||
i32 line_height = lister_get_line_height(view);
|
i32 line_height = lister_get_line_height(view);
|
||||||
i32 block_height = lister_get_block_height(line_height, is_theme_list);
|
i32 block_height = lister_get_block_height(line_height, is_theme_list);
|
||||||
i32 text_field_height = lister_get_text_field_height(view);
|
i32 text_field_height = lister_get_text_field_height(view);
|
||||||
|
|
|
@ -16,52 +16,12 @@ access_test(u32 lock_flags, u32 access_flags){
|
||||||
return((lock_flags & ~access_flags) == 0);
|
return((lock_flags & ~access_flags) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
|
||||||
fill_view_summary(System_Functions *system, View_Summary *view, View *vptr, Live_Views *live_set, Working_Set *working_set){
|
|
||||||
block_zero_struct(view);
|
|
||||||
if (vptr->in_use){
|
|
||||||
Assert(vptr->file != 0);
|
|
||||||
|
|
||||||
view->exists = true;
|
|
||||||
view->view_id = (i32)(vptr - live_set->views) + 1;
|
|
||||||
view->line_height = (f32)(vptr->line_height);
|
|
||||||
view->unwrapped_lines = vptr->file->settings.unwrapped_lines;
|
|
||||||
view->show_whitespace = vptr->show_whitespace;
|
|
||||||
view->lock_flags = view_get_access_flags(vptr);
|
|
||||||
|
|
||||||
view->buffer_id = vptr->file->id.id;
|
|
||||||
|
|
||||||
File_Edit_Positions edit_pos = view_get_edit_pos(vptr);
|
|
||||||
view->mark = file_compute_cursor(system, vptr->file, seek_pos(vptr->mark));
|
|
||||||
view->cursor = file_compute_cursor(system, vptr->file, seek_pos(edit_pos.cursor_pos));
|
|
||||||
|
|
||||||
view->preferred_x = vptr->preferred_x;
|
|
||||||
|
|
||||||
Rect_i32 region = vptr->panel->rect_inner;
|
|
||||||
view->view_region = region;
|
|
||||||
view->render_region = i32R(0, 0, rect_width(region), rect_height(region));
|
|
||||||
if (vptr->ui_mode){
|
|
||||||
view->scroll_vars = vptr->ui_scroll;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
view->scroll_vars = edit_pos.scroll;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
|
||||||
fill_view_summary(System_Functions *system, View_Summary *view, View *vptr, Models *models){
|
|
||||||
fill_view_summary(system, view, vptr, &models->live_set, &models->working_set);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
view_quit_ui(System_Functions *system, Models *models, View *view){
|
view_quit_ui(System_Functions *system, Models *models, View *view){
|
||||||
Assert(view != 0);
|
Assert(view != 0);
|
||||||
view->ui_mode = false;
|
view->ui_mode = false;
|
||||||
if (view->ui_quit != 0){
|
if (view->ui_quit != 0){
|
||||||
View_Summary view_summary = {};
|
view->ui_quit(&models->app_links, view_get_id(&models->live_set, view));
|
||||||
fill_view_summary(system, &view_summary, view, models);
|
|
||||||
view->ui_quit(&models->app_links, view_summary);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,7 +210,7 @@ Child_Process_Set_Target_Buffer(Application_Links *app, Child_Process_ID child_p
|
||||||
|
|
||||||
b32 process_has_buffer = (child_process->out_file != 0);
|
b32 process_has_buffer = (child_process->out_file != 0);
|
||||||
b32 buffer_has_process = (file->state.attached_child_process != 0);
|
b32 buffer_has_process = (file->state.attached_child_process != 0);
|
||||||
|
|
||||||
if ((!process_has_buffer || okay_if_process_has_buffer) && (!buffer_has_process || okay_if_buffer_has_process)){
|
if ((!process_has_buffer || okay_if_process_has_buffer) && (!buffer_has_process || okay_if_buffer_has_process)){
|
||||||
if (process_has_buffer){
|
if (process_has_buffer){
|
||||||
child_process->out_file->state.attached_child_process = 0;
|
child_process->out_file->state.attached_child_process = 0;
|
||||||
|
@ -1807,11 +1767,11 @@ get_view_prev__inner(Layout *layout, View *view){
|
||||||
API_EXPORT b32
|
API_EXPORT b32
|
||||||
Get_View_Next(Application_Links *app, View_ID view_id, Access_Flag access, View_ID *view_id_out)
|
Get_View_Next(Application_Links *app, View_ID view_id, Access_Flag access, View_ID *view_id_out)
|
||||||
/*
|
/*
|
||||||
DOC_PARAM(view, The View_Summary pointed to by view is iterated to the next view or to a null summary if this is the last view.)
|
DOC_PARAM(view, The pointed to by view is iterated to the next view or to a null summary if this is the last view.)
|
||||||
DOC_PARAM(access, The access parameter determines what levels of protection this call can access. The view outputted will be the next view that is accessible.)
|
DOC_PARAM(access, The access parameter determines what levels of protection this call can access. The view outputted will be the next view that is accessible.)
|
||||||
DOC
|
DOC
|
||||||
(
|
(
|
||||||
This call steps a View_Summary to the next view in the global view order.
|
This call steps a to the next view in the global view order.
|
||||||
|
|
||||||
If the view outputted does not exist, the loop is finished.
|
If the view outputted does not exist, the loop is finished.
|
||||||
Views should not be closed or opened durring a view loop.
|
Views should not be closed or opened durring a view loop.
|
||||||
|
@ -1855,26 +1815,6 @@ Get_View_Prev(Application_Links *app, View_ID view_id, Access_Flag access, View_
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(allen): redocument
|
|
||||||
API_EXPORT b32
|
|
||||||
Get_View_Summary(Application_Links *app, View_ID view_id, Access_Flag access, View_Summary *view_summary_out)
|
|
||||||
/*
|
|
||||||
DOC_PARAM(view_id, The view_id specifies the view to try to get.)
|
|
||||||
DOC_PARAM(access, The access parameter determines what levels of protection this call can access.)
|
|
||||||
DOC_RETURN(This call returns a summary that describes the indicated view if it is open and accessible.)
|
|
||||||
DOC_SEE(Access_Flag)
|
|
||||||
*/{
|
|
||||||
Models *models = (Models*)app->cmd_context;
|
|
||||||
System_Functions *system = models->system;
|
|
||||||
View *view = imp_get_view(models, view_id);
|
|
||||||
b32 result = false;
|
|
||||||
if (view_api_check_view(view, access)){
|
|
||||||
fill_view_summary(system, view_summary_out, view, models);
|
|
||||||
result = true;
|
|
||||||
}
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(allen): redocument
|
// TODO(allen): redocument
|
||||||
API_EXPORT b32
|
API_EXPORT b32
|
||||||
Get_Active_View(Application_Links *app, Access_Flag access, View_ID *view_id_out)
|
Get_Active_View(Application_Links *app, Access_Flag access, View_ID *view_id_out)
|
||||||
|
@ -1913,6 +1853,17 @@ Get_Active_Panel(Application_Links *app, Panel_ID *panel_id_out){
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
API_EXPORT b32
|
||||||
|
View_Exists(Application_Links *app, View_ID view_id){
|
||||||
|
Models *models = (Models*)app->cmd_context;
|
||||||
|
View *view = imp_get_view(models, view_id);
|
||||||
|
b32 result = false;
|
||||||
|
if (view_api_check_view(view)){
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
API_EXPORT b32
|
API_EXPORT b32
|
||||||
View_Get_Buffer(Application_Links *app, View_ID view_id, Access_Flag access, Buffer_ID *buffer_id_out){
|
View_Get_Buffer(Application_Links *app, View_ID view_id, Access_Flag access, Buffer_ID *buffer_id_out){
|
||||||
Models *models = (Models*)app->cmd_context;
|
Models *models = (Models*)app->cmd_context;
|
||||||
|
@ -1941,13 +1892,48 @@ View_Get_Cursor_Pos(Application_Links *app, View_ID view_id, i32 *pos_out){
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
API_EXPORT b32
|
||||||
|
View_Get_Mark_Pos(Application_Links *app, View_ID view_id, i32 *pos_out){
|
||||||
|
Models *models = (Models*)app->cmd_context;
|
||||||
|
View *view = imp_get_view(models, view_id);
|
||||||
|
b32 result = false;
|
||||||
|
if (view_api_check_view(view)){
|
||||||
|
*pos_out = view->mark;
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
API_EXPORT b32
|
||||||
|
View_Get_Preferred_X(Application_Links *app, View_ID view_id, f32 *preferred_x_out){
|
||||||
|
Models *models = (Models*)app->cmd_context;
|
||||||
|
View *view = imp_get_view(models, view_id);
|
||||||
|
b32 result = false;
|
||||||
|
if (view_api_check_view(view)){
|
||||||
|
*preferred_x_out = view->preferred_x;
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
API_EXPORT b32
|
||||||
|
View_Get_Screen_Rect(Application_Links *app, View_ID view_id, Rect_f32 *rect_out){
|
||||||
|
Models *models = (Models*)app->cmd_context;
|
||||||
|
b32 result = false;
|
||||||
|
View *view = imp_get_view(models, view_id);
|
||||||
|
if (view_api_check_view(view)){
|
||||||
|
*rect_out = f32R(view->panel->rect_full);
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
API_EXPORT b32
|
API_EXPORT b32
|
||||||
View_Get_Panel(Application_Links *app, View_ID view_id, Panel_ID *panel_id_out){
|
View_Get_Panel(Application_Links *app, View_ID view_id, Panel_ID *panel_id_out){
|
||||||
Models *models = (Models*)app->cmd_context;
|
Models *models = (Models*)app->cmd_context;
|
||||||
Layout *layout = &models->layout;
|
Layout *layout = &models->layout;
|
||||||
b32 result = false;
|
b32 result = false;
|
||||||
View *view = imp_get_view(models, view_id);
|
View *view = imp_get_view(models, view_id);
|
||||||
*panel_id_out = 0;
|
|
||||||
if (view_api_check_view(view)){
|
if (view_api_check_view(view)){
|
||||||
Panel *panel = view->panel;
|
Panel *panel = view->panel;
|
||||||
*panel_id_out = panel_get_id(layout, panel);
|
*panel_id_out = panel_get_id(layout, panel);
|
||||||
|
@ -1961,7 +1947,6 @@ Panel_Get_View(Application_Links *app, Panel_ID panel_id, View_ID *view_id_out){
|
||||||
Models *models = (Models*)app->cmd_context;
|
Models *models = (Models*)app->cmd_context;
|
||||||
b32 result = false;
|
b32 result = false;
|
||||||
Panel *panel = imp_get_panel(models, panel_id);
|
Panel *panel = imp_get_panel(models, panel_id);
|
||||||
*view_id_out = 0;
|
|
||||||
if (panel_api_check_panel(panel)){
|
if (panel_api_check_panel(panel)){
|
||||||
if (panel->kind == PanelKind_Final){
|
if (panel->kind == PanelKind_Final){
|
||||||
View *view = panel->view;
|
View *view = panel->view;
|
||||||
|
@ -4711,7 +4696,7 @@ Compute_Render_Layout(Application_Links *app, View_ID view_id, Buffer_ID buffer_
|
||||||
b32 wrapped = !file->settings.unwrapped_lines;
|
b32 wrapped = !file->settings.unwrapped_lines;
|
||||||
Face_ID font_id = file->settings.font_id;
|
Face_ID font_id = file->settings.font_id;
|
||||||
Font_Pointers font = system->font.get_pointers_by_id(font_id);
|
Font_Pointers font = system->font.get_pointers_by_id(font_id);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
File_Edit_Positions edit_pos = view_get_edit_pos(view);
|
File_Edit_Positions edit_pos = view_get_edit_pos(view);
|
||||||
f32 scroll_x = edit_pos.scroll.scroll_x;
|
f32 scroll_x = edit_pos.scroll.scroll_x;
|
||||||
|
@ -4728,7 +4713,7 @@ Compute_Render_Layout(Application_Links *app, View_ID view_id, Buffer_ID buffer_
|
||||||
scroll_y += buffer_point.pixel_shift.y;
|
scroll_y += buffer_point.pixel_shift.y;
|
||||||
Full_Cursor render_cursor = file_get_render_cursor(system, file, scroll_y);
|
Full_Cursor render_cursor = file_get_render_cursor(system, file, scroll_y);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
i32 item_count = 0;
|
i32 item_count = 0;
|
||||||
i32 end_pos = 0;
|
i32 end_pos = 0;
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue