Fixed render rectangle in command data, fixed unwrapped lines rendering, fixed 4ed line highlight color.

This commit is contained in:
Allen Webster 2018-09-24 16:33:26 -07:00
parent d2cf575ab0
commit 47220e60c1
5 changed files with 43 additions and 41 deletions

11
4ed.cpp
View File

@ -741,6 +741,7 @@ app_hardcode_default_style(Models *models){
style->main.mark_color = 0xFF494949;
style->main.default_color = 0xFF90B080;
style->main.at_cursor_color = style->main.back_color;
style->main.highlight_cursor_line_color = 0xFF1E1E1E;
style->main.at_highlight_color = 0xFFFF44DD;
style->main.comment_color = 0xFF2090F0;
style->main.keyword_color = 0xFFD08F20;
@ -979,7 +980,7 @@ App_Init_Sig(app_init){
app_links_init(system, &models->app_links, memory->user_memory, memory->user_memory_size);
models->config_api = api;
models->app_links.cmd_context = &vars->command_data;
models->app_links.cmd_context = &models->command_data;
Partition *partition = &models->mem.part;
@ -1086,7 +1087,7 @@ App_Init_Sig(app_init){
}
// NOTE(allen): init first panel
Command_Data *cmd = &vars->command_data;
Command_Data *cmd = &models->command_data;
cmd->models = models;
cmd->vars = vars;
@ -1382,7 +1383,7 @@ App_Step_Sig(app_step){
}
// NOTE(allen): prepare to start executing commands
Command_Data *cmd = &vars->command_data;
Command_Data *cmd = &models->command_data;
cmd->models = models;
cmd->vars = vars;
cmd->system = system;
@ -1887,10 +1888,6 @@ App_Step_Sig(app_step){
GUI_Scroll_Vars *scroll_vars = &view->transient.edit_pos->scroll;
cmd->render_view = view;
cmd->render_rect = panel->inner;
cmd->render_is_active = active;
do_render_file_view(system, view, models, scroll_vars, active_view, panel->inner, active, target, &dead_input);
u32 margin_color;

View File

@ -27,6 +27,24 @@ struct App_Settings{
b32 use_hinting;
};
struct Command_Data{
struct Models *models;
struct App_Vars *vars;
System_Functions *system;
Live_Views *live_set;
i32 screen_width;
i32 screen_height;
Key_Event_Data key;
// Render Context
View *render_view;
i32_Rect render_rect;
b32 render_is_active;
Render_Target *target;
};
struct Models{
Mem_Options mem;
App_Settings settings;
@ -60,6 +78,8 @@ struct Models{
Scroll_Rule_Function *scroll_rule;
Buffer_Name_Resolver_Function *buffer_name_resolver;
Command_Data command_data;
Style_Library styles;
u32 *palette;
@ -117,24 +137,6 @@ struct App_State_Resizing{
Panel_Divider *divider;
};
struct Command_Data{
Models *models;
struct App_Vars *vars;
System_Functions *system;
Live_Views *live_set;
i32 screen_width;
i32 screen_height;
Key_Event_Data key;
// Render Context
View *render_view;
i32_Rect render_rect;
b32 render_is_active;
Render_Target *target;
};
enum Input_Types{
Input_AnyKey,
Input_Esc,
@ -164,8 +166,6 @@ struct App_Vars{
App_State state;
App_State_Resizing resizing;
Command_Data command_data;
Available_Input available_input;
};

View File

@ -685,11 +685,11 @@ render_loaded_file_in_view(System_Functions *system, View *view, Models *models,
view->transient.edit_pos->scroll_i = render_cursor.pos;
b32 wrapped = !file->settings.unwrapped_lines;
i32 count = 0;
i32 end_pos = 0;
{
b32 wrapped = !file->settings.unwrapped_lines;
Buffer_Render_Params params;
params.buffer = &file->state.buffer;
params.items = items;
@ -891,17 +891,19 @@ render_loaded_file_in_view(System_Functions *system, View *view, Models *models,
// NOTE(allen): Wrap scanning
b32 is_new_wrap = false;
for (; wrap_scan_index < wrap_count;){
if (ind < first_byte_index_of_next_wrap){
break;
}
wrap_scan_index += 1;
is_new_wrap = true;
if (wrap_scan_index + 1 < wrap_count){
first_byte_index_of_next_wrap = wrap_starts[wrap_scan_index + 1];
}
else{
first_byte_index_of_next_wrap = max_i32;
if (wrapped){
for (; wrap_scan_index < wrap_count;){
if (ind < first_byte_index_of_next_wrap){
break;
}
wrap_scan_index += 1;
is_new_wrap = true;
if (wrap_scan_index + 1 < wrap_count){
first_byte_index_of_next_wrap = wrap_starts[wrap_scan_index + 1];
}
else{
first_byte_index_of_next_wrap = max_i32;
}
}
}

View File

@ -285,6 +285,9 @@ do_render_file_view(System_Functions *system, View *view, Models *models, GUI_Sc
if (!view->transient.ui_mode){
if (file_is_ready(file)){
if (models->render_caller != 0){
models->command_data.render_view = view;
models->command_data.render_rect = rect;
models->command_data.render_is_active = is_active;
models->render_caller(&models->app_links, view->persistent.id + 1, do_core_render);
}
else{

View File

@ -9,7 +9,7 @@ List_Item_Hover = Margin_Hover;
List_Item_Active = Margin_Active;
Cursor = 0xFF00EE00;
At_Cursor = Back;
Highlight_Cursor_Line = 0xff003a3a;
Highlight_Cursor_Line = 0xFF1E1E1E;
Highlight = 0xFFDDEE00;
Mark = 0xFF494949;
Default = 0xFF90B080;