Simplify fade range code; make it update with buffer edits
parent
6dd43762c4
commit
886c70100d
|
@ -251,7 +251,7 @@ CUSTOM_DOC("Paste multiple entries from the clipboard at once")
|
||||||
view_set_cursor_and_preferred_x(app, view, seek_pos(range.max + insert_string.size));
|
view_set_cursor_and_preferred_x(app, view, seek_pos(range.max + insert_string.size));
|
||||||
|
|
||||||
ARGB_Color argb = fcolor_resolve(fcolor_id(defcolor_paste));
|
ARGB_Color argb = fcolor_resolve(fcolor_id(defcolor_paste));
|
||||||
view_post_fade(app, buffer, 0.667f, Ii64(range.max + 1, range.max + insert_string.size), argb);
|
buffer_post_fade(app, buffer, 0.667f, Ii64(range.max + 1, range.max + insert_string.size), argb);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
paste(app);
|
paste(app);
|
||||||
|
|
|
@ -717,15 +717,20 @@ buffer_post_fade(Application_Links *app, Buffer_ID buffer_id, f32 seconds, Range
|
||||||
}
|
}
|
||||||
|
|
||||||
function void
|
function void
|
||||||
view_post_fade(Application_Links *app, View_ID view_id, f32 seconds, Range_i64 range, ARGB_Color color){
|
buffer_shift_fade_ranges(Buffer_ID buffer_id, i64 shift_after_p, i64 shift_amount){
|
||||||
Fade_Range *fade_range = alloc_fade_range();
|
for (Fade_Range *node = buffer_fade_ranges.first;
|
||||||
sll_queue_push(view_fade_ranges.first, view_fade_ranges.last, fade_range);
|
node != 0;
|
||||||
view_fade_ranges.count += 1;
|
node = node->next){
|
||||||
fade_range->view_id = view_id;
|
if (node->buffer_id == buffer_id){
|
||||||
fade_range->t = seconds;
|
if (node->range.min >= shift_after_p){
|
||||||
fade_range->full_t = seconds;
|
node->range.min += shift_amount;
|
||||||
fade_range->range = range;
|
node->range.max += shift_amount;
|
||||||
fade_range->color= color;
|
}
|
||||||
|
else if (node->range.max >= shift_after_p){
|
||||||
|
node->range.max += shift_amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function b32
|
function b32
|
||||||
|
@ -742,29 +747,14 @@ tick_all_fade_ranges(f32 t){
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
prev_next = &node->next;
|
prev_next = &node->next;
|
||||||
|
buffer_fade_ranges.last = node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
prev_next = &view_fade_ranges.first;
|
|
||||||
for (Fade_Range *node = view_fade_ranges.first, *next = 0;
|
|
||||||
node != 0;
|
|
||||||
node = next){
|
|
||||||
next = node->next;
|
|
||||||
node->t -= t;
|
|
||||||
if (node->t <= 0.f){
|
|
||||||
*prev_next = next;
|
|
||||||
view_fade_ranges.count -= 1;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
prev_next = &node->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return(buffer_fade_ranges.count > 0 || view_fade_ranges.count > 0);
|
return(buffer_fade_ranges.count > 0 || view_fade_ranges.count > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function void
|
function void
|
||||||
paint_fade_ranges(Application_Links *app, Text_Layout_ID layout, Buffer_ID buffer, View_ID view){
|
paint_fade_ranges(Application_Links *app, Text_Layout_ID layout, Buffer_ID buffer){
|
||||||
for (Fade_Range *node = buffer_fade_ranges.first;
|
for (Fade_Range *node = buffer_fade_ranges.first;
|
||||||
node != 0;
|
node != 0;
|
||||||
node = node->next){
|
node = node->next){
|
||||||
|
@ -772,14 +762,6 @@ paint_fade_ranges(Application_Links *app, Text_Layout_ID layout, Buffer_ID buffe
|
||||||
paint_text_color_blend(app, layout, node->range, node->color, node->t/node->full_t);
|
paint_text_color_blend(app, layout, node->range, node->color, node->t/node->full_t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Fade_Range *node = view_fade_ranges.first;
|
|
||||||
node != 0;
|
|
||||||
node = node->next){
|
|
||||||
if (node->view_id == view){
|
|
||||||
paint_text_color_blend(app, layout, node->range, node->color, node->t/node->full_t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
|
@ -98,10 +98,7 @@ struct Buffer_Modified_Set{
|
||||||
|
|
||||||
struct Fade_Range{
|
struct Fade_Range{
|
||||||
Fade_Range *next;
|
Fade_Range *next;
|
||||||
union{
|
Buffer_ID buffer_id;
|
||||||
Buffer_ID buffer_id;
|
|
||||||
View_ID view_id;
|
|
||||||
};
|
|
||||||
f32 t;
|
f32 t;
|
||||||
f32 full_t;
|
f32 full_t;
|
||||||
Range_i64 range;
|
Range_i64 range;
|
||||||
|
|
|
@ -378,7 +378,7 @@ default_render_buffer(Application_Links *app, View_ID view_id, Face_ID face_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE(allen): Fade ranges
|
// NOTE(allen): Fade ranges
|
||||||
paint_fade_ranges(app, text_layout_id, buffer, view_id);
|
paint_fade_ranges(app, text_layout_id, buffer);
|
||||||
|
|
||||||
// NOTE(allen): put the actual text on the actual screen
|
// NOTE(allen): put the actual text on the actual screen
|
||||||
draw_text_layout_default(app, text_layout_id);
|
draw_text_layout_default(app, text_layout_id);
|
||||||
|
@ -919,6 +919,8 @@ BUFFER_EDIT_RANGE_SIG(default_buffer_edit_range){
|
||||||
|
|
||||||
Range_i64 old_range = Ii64(new_range.first, new_range.first + original_size);
|
Range_i64 old_range = Ii64(new_range.first, new_range.first + original_size);
|
||||||
|
|
||||||
|
buffer_shift_fade_ranges(buffer_id, old_range.max, (new_range.max - old_range.max));
|
||||||
|
|
||||||
{
|
{
|
||||||
code_index_lock();
|
code_index_lock();
|
||||||
Code_Index_File *file = code_index_get_file(buffer_id);
|
Code_Index_File *file = code_index_get_file(buffer_id);
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
+ Fix: no crash when a project file .cmd is not the right type
|
+ Fix: no crash when a project file .cmd is not the right type
|
||||||
+ Fix: windows layer now generates layout independent key stroke events
|
+ Fix: windows layer now generates layout independent key stroke events
|
||||||
+ Fix: notepad like mode scrolling does not snap mark to cursor
|
+ Fix: notepad like mode scrolling does not snap mark to cursor
|
||||||
|
+ Fix: special case colors from the theme override general case colors
|
||||||
|
+ Fix: Paste fade range is updated with buffer edits
|
||||||
|
|
||||||
4.1.4
|
4.1.4
|
||||||
+ MAJOR: The clipboard history is now a fully custom layer implemented system. Users maintaining a customization layer should try to update their call sites to the old clipboard API. #define FCODER_TRANSITION_TO 4001004 to disable the transitional function wrappers when you are ready to make the transition.
|
+ MAJOR: The clipboard history is now a fully custom layer implemented system. Users maintaining a customization layer should try to update their call sites to the old clipboard API. #define FCODER_TRANSITION_TO 4001004 to disable the transitional function wrappers when you are ready to make the transition.
|
||||||
|
|
|
@ -18,7 +18,7 @@ defcolor_comment_pop = {0xFF00C030, 0xFFF00000};
|
||||||
defcolor_keyword = 0xFF002255;
|
defcolor_keyword = 0xFF002255;
|
||||||
defcolor_str_constant = 0xFFE820E0;
|
defcolor_str_constant = 0xFFE820E0;
|
||||||
defcolor_char_constant = defcolor_str_constant;
|
defcolor_char_constant = defcolor_str_constant;
|
||||||
defcolor_int_constant = 0xFF20E8E0;
|
defcolor_int_constant = 0xFF109810;
|
||||||
defcolor_float_constant = defcolor_int_constant;
|
defcolor_float_constant = defcolor_int_constant;
|
||||||
defcolor_bool_constant = defcolor_int_constant;
|
defcolor_bool_constant = defcolor_int_constant;
|
||||||
defcolor_include = 0xFFF010F0;
|
defcolor_include = 0xFFF010F0;
|
||||||
|
|
Loading…
Reference in New Issue