Extended String_Match struct; regularized range and rect type code
This commit is contained in:
parent
f4b77f9c55
commit
41ac11cf98
|
@ -1133,39 +1133,12 @@ STRUCT Binding_Unit{
|
||||||
typedef i32 _Get_Version_Function(i32 maj, i32 min, i32 patch);
|
typedef i32 _Get_Version_Function(i32 maj, i32 min, i32 patch);
|
||||||
#define _GET_VERSION_SIG(n) i32 n(i32 maj, i32 min, i32 patch)
|
#define _GET_VERSION_SIG(n) i32 n(i32 maj, i32 min, i32 patch)
|
||||||
|
|
||||||
STRUCT color_picker{
|
STRUCT Color_Picker{
|
||||||
String_Const_u8 title;
|
String_Const_u8 title;
|
||||||
argb_color *dest;
|
argb_color *dest;
|
||||||
b32 *finished;
|
b32 *finished;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(allen): Remove these vvvvv ?
|
|
||||||
enum Found_String_Flag{
|
|
||||||
FoundString_Sensitive = 0x1,
|
|
||||||
FoundString_Insensitive = 0x2,
|
|
||||||
FoundString_CleanEdges = 0x4,
|
|
||||||
|
|
||||||
FoundString_Straddled = 0x10,
|
|
||||||
};
|
|
||||||
|
|
||||||
STRUCT Found_String{
|
|
||||||
Found_String *next;
|
|
||||||
Buffer_ID buffer_id;
|
|
||||||
|
|
||||||
u32 flags;
|
|
||||||
i32 string_id;
|
|
||||||
|
|
||||||
Range location;
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO(casey): If this sticks around, there should be a way to export add/remove/merge as inlines that are shared
|
|
||||||
STRUCT Found_String_List{
|
|
||||||
Found_String *first;
|
|
||||||
Found_String *last;
|
|
||||||
i32 count;
|
|
||||||
};
|
|
||||||
// TODO(allen): Remove these ^^^^^ ?
|
|
||||||
|
|
||||||
ENUM(u32, String_Match_Flag){
|
ENUM(u32, String_Match_Flag){
|
||||||
StringMatch_CaseSensitive = 1,
|
StringMatch_CaseSensitive = 1,
|
||||||
StringMatch_LeftSideSloppy = 2,
|
StringMatch_LeftSideSloppy = 2,
|
||||||
|
@ -1176,8 +1149,9 @@ ENUM(u32, String_Match_Flag){
|
||||||
STRUCT String_Match{
|
STRUCT String_Match{
|
||||||
String_Match *next;
|
String_Match *next;
|
||||||
Buffer_ID buffer;
|
Buffer_ID buffer;
|
||||||
|
i32 string_id;
|
||||||
String_Match_Flag flags;
|
String_Match_Flag flags;
|
||||||
u64 index;
|
Range_u64 range;
|
||||||
};
|
};
|
||||||
|
|
||||||
STRUCT String_Match_List{
|
STRUCT String_Match_List{
|
||||||
|
|
|
@ -678,7 +678,7 @@ execute_standard_build(Application_Links *app, View_Summary *view, Buffer_ID act
|
||||||
|
|
||||||
static b32
|
static b32
|
||||||
post_buffer_range_to_clipboard(Application_Links *app, i32 clipboard_index, Buffer_Summary *buffer, i32 first, i32 one_past_last){
|
post_buffer_range_to_clipboard(Application_Links *app, i32 clipboard_index, Buffer_Summary *buffer, i32 first, i32 one_past_last){
|
||||||
return(post_buffer_range_to_clipboard(app, clipboard_index, buffer==0?0:buffer->buffer_id, first, one_past_last));
|
return(post_buffer_range_to_clipboard(app, clipboard_index, buffer==0?0:buffer->buffer_id, first, one_past_last));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -995,7 +995,7 @@ scratch_read(Application_Links *app, Arena *arena, Buffer_ID buffer, Range range
|
||||||
}
|
}
|
||||||
|
|
||||||
static String_Const_u8
|
static String_Const_u8
|
||||||
scratch_read(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_umem range){
|
scratch_read(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_u64 range){
|
||||||
return(push_buffer_range(app, arena, buffer, range));
|
return(push_buffer_range(app, arena, buffer, range));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -701,16 +701,11 @@ CUSTOM_DOC("Converts all ascii text in the range between the cursor and the mark
|
||||||
Buffer_ID buffer = 0;
|
Buffer_ID buffer = 0;
|
||||||
view_get_buffer(app, view, AccessOpen, &buffer);
|
view_get_buffer(app, view, AccessOpen, &buffer);
|
||||||
Range range = get_view_range(app, view);
|
Range range = get_view_range(app, view);
|
||||||
i32 size = get_width(range);
|
Scratch_Block scratch(app);
|
||||||
if (size <= app->memory_size){
|
String_Const_u8 string = push_buffer_range(app, scratch, buffer, range);
|
||||||
char *mem = (char*)app->memory;
|
string = string_mod_upper(string);
|
||||||
buffer_read_range(app, buffer, range.min, range.max, mem);
|
buffer_replace_range(app, buffer, range, string);
|
||||||
for (i32 i = 0; i < size; ++i){
|
view_set_cursor(app, view, seek_pos(range.max), true);
|
||||||
mem[i] = character_to_upper(mem[i]);
|
|
||||||
}
|
|
||||||
buffer_replace_range(app, buffer, range, SCu8(mem, size));
|
|
||||||
view_set_cursor(app, view, seek_pos(range.max), true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CUSTOM_COMMAND_SIG(to_lowercase)
|
CUSTOM_COMMAND_SIG(to_lowercase)
|
||||||
|
@ -721,16 +716,11 @@ CUSTOM_DOC("Converts all ascii text in the range between the cursor and the mark
|
||||||
Buffer_ID buffer = 0;
|
Buffer_ID buffer = 0;
|
||||||
view_get_buffer(app, view, AccessOpen, &buffer);
|
view_get_buffer(app, view, AccessOpen, &buffer);
|
||||||
Range range = get_view_range(app, view);
|
Range range = get_view_range(app, view);
|
||||||
i32 size = get_width(range);
|
Scratch_Block scratch(app);
|
||||||
if (size <= app->memory_size){
|
String_Const_u8 string = push_buffer_range(app, scratch, buffer, range);
|
||||||
char *mem = (char*)app->memory;
|
string = string_mod_lower(string);
|
||||||
buffer_read_range(app, buffer, range.min, range.max, mem);
|
buffer_replace_range(app, buffer, range, string);
|
||||||
for (i32 i = 0; i < size; ++i){
|
view_set_cursor(app, view, seek_pos(range.max), true);
|
||||||
mem[i] = character_to_lower(mem[i]);
|
|
||||||
}
|
|
||||||
buffer_replace_range(app, buffer, range, SCu8(mem, size));
|
|
||||||
view_set_cursor(app, view, seek_pos(range.max), true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CUSTOM_COMMAND_SIG(clean_all_lines)
|
CUSTOM_COMMAND_SIG(clean_all_lines)
|
||||||
|
|
|
@ -1575,25 +1575,7 @@ hsla_to_rgba(Vec4 hsla){
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
static Interval_i8
|
internal Interval_i32
|
||||||
Ii8(i8 a, i8 b){
|
|
||||||
Interval_i8 interval = {a, b};
|
|
||||||
if (b < a){
|
|
||||||
interval.min = b;
|
|
||||||
interval.max = a;
|
|
||||||
}
|
|
||||||
return(interval);
|
|
||||||
}
|
|
||||||
static Interval_i16
|
|
||||||
Ii16(i16 a, i16 b){
|
|
||||||
Interval_i16 interval = {a, b};
|
|
||||||
if (b < a){
|
|
||||||
interval.min = b;
|
|
||||||
interval.max = a;
|
|
||||||
}
|
|
||||||
return(interval);
|
|
||||||
}
|
|
||||||
static Interval_i32
|
|
||||||
Ii32(i32 a, i32 b){
|
Ii32(i32 a, i32 b){
|
||||||
Interval_i32 interval = {a, b};
|
Interval_i32 interval = {a, b};
|
||||||
if (b < a){
|
if (b < a){
|
||||||
|
@ -1602,7 +1584,25 @@ Ii32(i32 a, i32 b){
|
||||||
}
|
}
|
||||||
return(interval);
|
return(interval);
|
||||||
}
|
}
|
||||||
static Interval_f32
|
internal Interval_i64
|
||||||
|
Ii64(i64 a, i64 b){
|
||||||
|
Interval_i64 interval = {a, b};
|
||||||
|
if (b < a){
|
||||||
|
interval.min = b;
|
||||||
|
interval.max = a;
|
||||||
|
}
|
||||||
|
return(interval);
|
||||||
|
}
|
||||||
|
internal Interval_u64
|
||||||
|
Iu64(u64 a, u64 b){
|
||||||
|
Interval_u64 interval = {a, b};
|
||||||
|
if (b < a){
|
||||||
|
interval.min = b;
|
||||||
|
interval.max = a;
|
||||||
|
}
|
||||||
|
return(interval);
|
||||||
|
}
|
||||||
|
internal Interval_f32
|
||||||
If32(f32 a, f32 b){
|
If32(f32 a, f32 b){
|
||||||
Interval_f32 interval = {a, b};
|
Interval_f32 interval = {a, b};
|
||||||
if (b < a){
|
if (b < a){
|
||||||
|
@ -1612,390 +1612,402 @@ If32(f32 a, f32 b){
|
||||||
return(interval);
|
return(interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Interval_i8
|
internal Interval_i32
|
||||||
range_margin(Interval_i8 range, i8 margin){
|
Ii32(i32 a){
|
||||||
range.min += margin;
|
Interval_i32 interval = {a, a};
|
||||||
range.max -= margin;
|
return(interval);
|
||||||
return(range);
|
|
||||||
}
|
}
|
||||||
static Interval_i16
|
internal Interval_i64
|
||||||
range_margin(Interval_i16 range, i16 margin){
|
Ii64(i64 a){
|
||||||
range.min += margin;
|
Interval_i64 interval = {a, a};
|
||||||
range.max -= margin;
|
return(interval);
|
||||||
return(range);
|
|
||||||
}
|
}
|
||||||
static Interval_i32
|
internal Interval_u64
|
||||||
|
Iu64(u64 a){
|
||||||
|
Interval_u64 interval = {a, a};
|
||||||
|
return(interval);
|
||||||
|
}
|
||||||
|
internal Interval_f32
|
||||||
|
If32(f32 a){
|
||||||
|
Interval_f32 interval = {a, a};
|
||||||
|
return(interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define make_range Ii32
|
||||||
|
#define make_range_i32 Ii32
|
||||||
|
#define make_range_i64 Ii64
|
||||||
|
#define make_range_u64 Iu64
|
||||||
|
#define make_range_f32 If32
|
||||||
|
|
||||||
|
internal Interval_i32
|
||||||
range_margin(Interval_i32 range, i32 margin){
|
range_margin(Interval_i32 range, i32 margin){
|
||||||
range.min += margin;
|
range.min += margin;
|
||||||
range.max -= margin;
|
range.max += margin;
|
||||||
return(range);
|
return(range);
|
||||||
}
|
}
|
||||||
static Interval_f32
|
internal Interval_i64
|
||||||
|
range_margin(Interval_i64 range, i64 margin){
|
||||||
|
range.min += margin;
|
||||||
|
range.max += margin;
|
||||||
|
return(range);
|
||||||
|
}
|
||||||
|
internal Interval_u64
|
||||||
|
range_margin(Interval_u64 range, u64 margin){
|
||||||
|
range.min += margin;
|
||||||
|
range.max += margin;
|
||||||
|
return(range);
|
||||||
|
}
|
||||||
|
internal Interval_f32
|
||||||
range_margin(Interval_f32 range, f32 margin){
|
range_margin(Interval_f32 range, f32 margin){
|
||||||
range.min += margin;
|
range.min += margin;
|
||||||
range.max -= margin;
|
range.max += margin;
|
||||||
return(range);
|
return(range);
|
||||||
}
|
}
|
||||||
|
|
||||||
static i8
|
internal b32
|
||||||
range_size(Interval_i8 range){
|
range_overlap(Interval_i32 a, Interval_i32 b){
|
||||||
return(range.max - range.min);
|
return(a.min < b.max && b.min < a.max);
|
||||||
}
|
}
|
||||||
static i16
|
internal b32
|
||||||
range_size(Interval_i16 range){
|
range_overlap(Interval_i64 a, Interval_i64 b){
|
||||||
return(range.max - range.min);
|
return(a.min < b.max && b.min < a.max);
|
||||||
}
|
}
|
||||||
static i32
|
internal b32
|
||||||
range_size(Interval_i32 range){
|
range_overlap(Interval_u64 a, Interval_u64 b){
|
||||||
return(range.max - range.min);
|
return(a.min < b.max && b.min < a.max);
|
||||||
}
|
}
|
||||||
static f32
|
internal b32
|
||||||
range_size(Interval_f32 range){
|
range_overlap(Interval_f32 a, Interval_f32 b){
|
||||||
return(range.max - range.min);
|
return(a.min < b.max && b.min < a.max);
|
||||||
}
|
}
|
||||||
|
|
||||||
static i32
|
internal b32
|
||||||
get_width(Range range){
|
range_contains(Interval_i32 a, i32 p){
|
||||||
i32 result = range.end - range.start;
|
return(a.min <= p && p < a.max);
|
||||||
if (result < 0){
|
}
|
||||||
result = 0;
|
internal b32
|
||||||
}
|
range_contains(Interval_i64 a, i64 p){
|
||||||
return(result);
|
return(a.min <= p && p < a.max);
|
||||||
|
}
|
||||||
|
internal b32
|
||||||
|
range_contains(Interval_u64 a, u64 p){
|
||||||
|
return(a.min <= p && p < a.max);
|
||||||
|
}
|
||||||
|
internal b32
|
||||||
|
range_contains(Interval_f32 a, f32 p){
|
||||||
|
return(a.min <= p && p < a.max);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Range_i8
|
internal i32
|
||||||
make_range_i8(i8 p1, i8 p2){
|
range_size(Interval_i32 a){
|
||||||
Range_i8 range;
|
i32 size = a.max - a.min;
|
||||||
if (p1 < p2){
|
size = clamp_bot(0, size);
|
||||||
range.min = p1;
|
return(size);
|
||||||
range.max = p2;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
range.min = p2;
|
|
||||||
range.max = p1;
|
|
||||||
}
|
|
||||||
return(range);
|
|
||||||
}
|
}
|
||||||
static Range_i16
|
internal i64
|
||||||
make_range_i16(i16 p1, i16 p2){
|
range_size(Interval_i64 a){
|
||||||
Range_i16 range;
|
i64 size = a.max - a.min;
|
||||||
if (p1 < p2){
|
size = clamp_bot(0, size);
|
||||||
range.min = p1;
|
return(size);
|
||||||
range.max = p2;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
range.min = p2;
|
|
||||||
range.max = p1;
|
|
||||||
}
|
|
||||||
return(range);
|
|
||||||
}
|
}
|
||||||
static Range_i32
|
internal u64
|
||||||
make_range_i32(i32 p1, i32 p2){
|
range_size(Interval_u64 a){
|
||||||
Range_i32 range;
|
u64 size = a.max - a.min;
|
||||||
if (p1 < p2){
|
size = clamp_bot(0, size);
|
||||||
range.min = p1;
|
return(size);
|
||||||
range.max = p2;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
range.min = p2;
|
|
||||||
range.max = p1;
|
|
||||||
}
|
|
||||||
return(range);
|
|
||||||
}
|
}
|
||||||
static Range_f32
|
internal f32
|
||||||
make_range_f32(f32 p1, f32 p2){
|
range_size(Interval_f32 a){
|
||||||
Range_f32 range;
|
f32 size = a.max - a.min;
|
||||||
if (p1 < p2){
|
size = clamp_bot(0, size);
|
||||||
range.min = p1;
|
return(size);
|
||||||
range.max = p2;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
range.min = p2;
|
|
||||||
range.max = p1;
|
|
||||||
}
|
|
||||||
return(range);
|
|
||||||
}
|
|
||||||
static Range_umem
|
|
||||||
make_range_umem(umem p1, umem p2){
|
|
||||||
Range_umem range;
|
|
||||||
if (p1 < p2){
|
|
||||||
range.min = p1;
|
|
||||||
range.max = p2;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
range.min = p2;
|
|
||||||
range.max = p1;
|
|
||||||
}
|
|
||||||
return(range);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Range_i8
|
internal Interval_i32
|
||||||
make_range_i8(i8 p){
|
rectify(Interval_i32 a){
|
||||||
Range_i8 range = {p, p};
|
return(Ii32(a.min, a.max));
|
||||||
return(range);
|
|
||||||
}
|
}
|
||||||
static Range_i16
|
internal Interval_i64
|
||||||
make_range_i16(i16 p){
|
rectify(Interval_i64 a){
|
||||||
Range_i16 range = {p, p};
|
return(Ii64(a.min, a.max));
|
||||||
return(range);
|
|
||||||
}
|
}
|
||||||
static Range_i32
|
internal Interval_u64
|
||||||
make_range_i32(i32 p){
|
rectify(Interval_u64 a){
|
||||||
Range_i32 range = {p, p};
|
return(Iu64(a.min, a.max));
|
||||||
return(range);
|
|
||||||
}
|
}
|
||||||
static Range_f32
|
internal Interval_f32
|
||||||
make_range_f32(f32 p){
|
rectify(Interval_f32 a){
|
||||||
Range_f32 range = {p, p};
|
return(If32(a.min, a.max));
|
||||||
return(range);
|
|
||||||
}
|
|
||||||
static Range_umem
|
|
||||||
make_range_umem(umem p){
|
|
||||||
Range_umem range = {p, p};
|
|
||||||
return(range);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define make_range make_range_i32
|
internal Interval_i32
|
||||||
|
range_clamp_size(Interval_i32 a, i32 max_size){
|
||||||
static Range
|
i32 max = a.min + max_size;
|
||||||
rectify(Range range) {
|
a.max = clamp_top(a.max, max);
|
||||||
return(make_range(range.min, range.max));
|
return(a);
|
||||||
|
}
|
||||||
|
internal Interval_i64
|
||||||
|
range_clamp_size(Interval_i64 a, i64 max_size){
|
||||||
|
i64 max = a.min + max_size;
|
||||||
|
a.max = clamp_top(a.max, max);
|
||||||
|
return(a);
|
||||||
|
}
|
||||||
|
internal Interval_u64
|
||||||
|
range_clamp_size(Interval_u64 a, u64 max_size){
|
||||||
|
u64 max = a.min + max_size;
|
||||||
|
a.max = clamp_top(a.max, max);
|
||||||
|
return(a);
|
||||||
|
}
|
||||||
|
internal Interval_f32
|
||||||
|
range_clamp_size(Interval_f32 a, f32 max_size){
|
||||||
|
f32 max = a.min + max_size;
|
||||||
|
a.max = clamp_top(a.max, max);
|
||||||
|
return(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static b32
|
internal b32
|
||||||
interval_overlap(i32 a0, i32 a1, i32 b0, i32 b1){
|
range_is_valid(Interval_i32 a){
|
||||||
return(a0 < b1 && b0 < a1);
|
return(a.min <= a.max);
|
||||||
}
|
}
|
||||||
|
internal b32
|
||||||
static b32
|
range_is_valid(Interval_i64 a){
|
||||||
interval_overlap(Range a, Range b){
|
return(a.min <= a.max);
|
||||||
return(interval_overlap(a.first, a.one_past_last, b.first, b.one_past_last));
|
|
||||||
}
|
}
|
||||||
|
internal b32
|
||||||
static i32
|
range_is_valid(Interval_u64 a){
|
||||||
interval_overlap(f32 a0, f32 a1, f32 b0, f32 b1){
|
return(a.min <= a.max);
|
||||||
return(a0 < b1 && b0 < a1);
|
|
||||||
}
|
}
|
||||||
|
internal b32
|
||||||
static b32
|
range_is_valid(Interval_f32 a){
|
||||||
interval_contains(i32 a0, i32 a1, i32 b){
|
return(a.min <= a.max);
|
||||||
return((a0 <= b) && (b < a1));
|
|
||||||
}
|
|
||||||
|
|
||||||
static b32
|
|
||||||
interval_contains(Range range, i32 b){
|
|
||||||
return(interval_contains(range.start, range.one_past_last, b));
|
|
||||||
}
|
|
||||||
|
|
||||||
static Range
|
|
||||||
clip_range_to_width(Range range, i32 max_width) {
|
|
||||||
i32 top = range.first + max_width;
|
|
||||||
range.end = clamp_top(range.end, top);
|
|
||||||
return(range);
|
|
||||||
}
|
|
||||||
|
|
||||||
static b32
|
|
||||||
interval_is_valid(Range range){
|
|
||||||
return(range.start <= range.one_past_last);
|
|
||||||
}
|
|
||||||
|
|
||||||
static i32
|
|
||||||
replace_range_compute_shift(i32 replace_length, i32 insert_length){
|
|
||||||
return(insert_length - replace_length);
|
|
||||||
}
|
|
||||||
|
|
||||||
static i32
|
|
||||||
replace_range_compute_shift(i32 replace_start, i32 replace_end, i32 insert_length){
|
|
||||||
return(insert_length - (replace_end - replace_start));
|
|
||||||
}
|
|
||||||
|
|
||||||
static i32
|
|
||||||
replace_range_compute_shift(Range range, i32 insert_length){
|
|
||||||
return(replace_range_compute_shift(range.first, range.one_past_last, insert_length));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
static i32_Rect
|
internal i32
|
||||||
i32R(i32 l, i32 t, i32 r, i32 b){
|
replace_range_compute_shift(i32 replace_length, i32 insert_length){
|
||||||
i32_Rect rect = {};
|
return(insert_length - replace_length);
|
||||||
rect.x0 = l;
|
}
|
||||||
rect.y0 = t;
|
internal i32
|
||||||
rect.x1 = r;
|
replace_range_compute_shift(i32 start, i32 end, i32 insert_length){
|
||||||
rect.y1 = b;
|
return(insert_length - (end - start));
|
||||||
|
}
|
||||||
|
internal i32
|
||||||
|
replace_range_compute_shift(Interval_i32 range, i32 insert_length){
|
||||||
|
return(insert_length - (range.end - range.start));
|
||||||
|
}
|
||||||
|
internal i64
|
||||||
|
replace_range_compute_shift(i64 replace_length, i64 insert_length){
|
||||||
|
return(insert_length - replace_length);
|
||||||
|
}
|
||||||
|
internal i64
|
||||||
|
replace_range_compute_shift(i64 start, i64 end, i64 insert_length){
|
||||||
|
return(insert_length - (end - start));
|
||||||
|
}
|
||||||
|
internal i64
|
||||||
|
replace_range_compute_shift(Interval_i64 range, i64 insert_length){
|
||||||
|
return(insert_length - (range.end - range.start));
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
|
||||||
|
internal Rect_i32
|
||||||
|
Ri32(i32 x0, i32 y0, i32 x1, i32 y1){
|
||||||
|
Rect_i32 rect = {x0, y0, x1, y1};
|
||||||
|
return(rect);
|
||||||
|
}
|
||||||
|
internal Rect_f32
|
||||||
|
Rf32(f32 x0, f32 y0, f32 x1, f32 y1){
|
||||||
|
Rect_f32 rect = {x0, y0, x1, y1};
|
||||||
return(rect);
|
return(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
static i32_Rect
|
internal Rect_i32
|
||||||
i32R_xy_wh(i32 x, i32 y, i32 w, i32 h){
|
Ri32(Vec2_i32 p0, Vec2_i32 p1){
|
||||||
return(i32R(x, y, x + w, y + h));
|
Rect_i32 rect = {p0.x, p0.y, p1.x, p1.y};
|
||||||
|
return(rect);
|
||||||
}
|
}
|
||||||
|
internal Rect_f32
|
||||||
static i32_Rect
|
Rf32(Vec2_f32 p0, Vec2_f32 p1){
|
||||||
i32R(f32_Rect r){
|
Rect_f32 rect = {p0.x, p0.y, p1.x, p1.y};
|
||||||
i32_Rect rect = {};
|
|
||||||
rect.x0 = (i32)r.x0;
|
|
||||||
rect.y0 = (i32)r.y0;
|
|
||||||
rect.x1 = (i32)r.x1;
|
|
||||||
rect.y1 = (i32)r.y1;
|
|
||||||
return(rect);
|
return(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
static f32_Rect
|
internal Rect_i32
|
||||||
f32R(f32 l, f32 t, f32 r, f32 b){
|
Ri32(Rect_f32 o){
|
||||||
f32_Rect rect = {};
|
Rect_i32 rect = {(i32)(o.x0), (i32)(o.y0), (i32)(o.x0), (i32)(o.y1)};
|
||||||
rect.x0 = l;
|
return(rect);
|
||||||
rect.y0 = t;
|
}
|
||||||
rect.x1 = r;
|
internal Rect_f32
|
||||||
rect.y1 = b;
|
Rf32(Rect_i32 o){
|
||||||
|
Rect_f32 rect = {(f32)(o.x0), (f32)(o.y0), (f32)(o.x0), (f32)(o.y1)};
|
||||||
return(rect);
|
return(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
static f32_Rect
|
#define i32R Ri32
|
||||||
f32R(Vec2 p0, Vec2 p1){
|
#define f32R Rf32
|
||||||
f32_Rect rect = {};
|
|
||||||
rect.p0 = p0;
|
internal Rect_i32
|
||||||
rect.p1 = p1;
|
Ri32_xy_wh(i32 x0, i32 y0, i32 w, i32 h){
|
||||||
|
Rect_i32 rect = {x0, y0, x0 + w, y0 + h};
|
||||||
|
return(rect);
|
||||||
|
}
|
||||||
|
internal Rect_f32
|
||||||
|
Rf32_xy_wh(f32 x0, f32 y0, f32 w, f32 h){
|
||||||
|
Rect_f32 rect = {x0, y0, x0 + w, y0 + h};
|
||||||
return(rect);
|
return(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
static f32_Rect
|
internal Rect_i32
|
||||||
f32R(i32_Rect r){
|
Ri32_xy_wh(Vec2_i32 p0, Vec2_i32 d){
|
||||||
f32_Rect rect = {};
|
Rect_i32 rect = {p0.x, p0.y, p0.x + d.x, p0.y + d.y};
|
||||||
rect.x0 = (f32)r.x0;
|
return(rect);
|
||||||
rect.y0 = (f32)r.y0;
|
}
|
||||||
rect.x1 = (f32)r.x1;
|
internal Rect_f32
|
||||||
rect.y1 = (f32)r.y1;
|
Rf32_xy_wh(Vec2_f32 p0, Vec2_f32 d){
|
||||||
|
Rect_f32 rect = {p0.x, p0.y, p0.x + d.x, p0.y + d.y};
|
||||||
return(rect);
|
return(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
static i32
|
#define i32R_xy_wh
|
||||||
rect_equal(i32_Rect r1, i32_Rect r2){
|
#define f32R_xy_wh
|
||||||
return(r1.x0 == r2.x0 && r1.y0 == r2.y0 && r1.x1 == r2.x1 && r1.y1 == r2.y1);
|
|
||||||
|
internal b32
|
||||||
|
rect_equals(Rect_i32 a, Rect_i32 b){
|
||||||
|
return(a.x0 == b.x0 && a.y0 == b.y0 && a.x1 == b.x1 && a.y1 == b.y1);
|
||||||
|
}
|
||||||
|
internal b32
|
||||||
|
rect_equals(Rect_f32 a, Rect_f32 b){
|
||||||
|
return(a.x0 == b.x0 && a.y0 == b.y0 && a.x1 == b.x1 && a.y1 == b.y1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static b32
|
internal b32
|
||||||
rect_contains_point(b32 BLAH, f32 x0, f32 y0, f32 x1, f32 y1, f32 x, f32 y){
|
rect_contains_point(Rect_i32 a, Vec2_i32 b){
|
||||||
return(x0 <= x && x < x1 && y0 <= y && y < y1);
|
return(a.x0 <= b.x && b.x < a.x1 && a.y0 <= b.y && b.y < a.y1);
|
||||||
|
}
|
||||||
|
internal b32
|
||||||
|
rect_contains_point(Rect_f32 a, Vec2_f32 b){
|
||||||
|
return(a.x0 <= b.x && b.x < a.x1 && a.y0 <= b.y && b.y < a.y1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static b32
|
internal Rect_i32
|
||||||
rect_contains_point(b32 BLAH, i32 x0, i32 y0, i32 x1, i32 y1, i32 x, i32 y){
|
rect_inner(Rect_i32 r, i32 m){
|
||||||
return(x0 <= x && x < x1 && y0 <= y && y < y1);
|
r.x0 += m;
|
||||||
|
r.y0 += m;
|
||||||
|
r.x1 -= m;
|
||||||
|
r.y1 -= m;
|
||||||
|
return(r);
|
||||||
}
|
}
|
||||||
|
internal Rect_f32
|
||||||
static b32
|
rect_inner(Rect_f32 r, f32 m){
|
||||||
rect_contains_point(Rect_f32 rect, Vec2_f32 p){
|
r.x0 += m;
|
||||||
return(rect_contains_point(false, rect.x0, rect.y0, rect.x1, rect.y1, p.x, p.y));
|
r.y0 += m;
|
||||||
}
|
r.x1 -= m;
|
||||||
|
r.y1 -= m;
|
||||||
static b32
|
|
||||||
rect_contains_point(Rect_i32 rect, Vec2_i32 p){
|
|
||||||
return(rect_contains_point(false, rect.x0, rect.y0, rect.x1, rect.y1, p.x, p.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
static i32_Rect
|
|
||||||
get_inner_rect(i32_Rect outer, i32 margin){
|
|
||||||
i32_Rect r = {};
|
|
||||||
r.x0 = outer.x0 + margin;
|
|
||||||
r.y0 = outer.y0 + margin;
|
|
||||||
r.x1 = outer.x1 - margin;
|
|
||||||
r.y1 = outer.y1 - margin;
|
|
||||||
return(r);
|
return(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
static f32_Rect
|
internal Vec2_i32
|
||||||
get_inner_rect(f32_Rect outer, f32 margin){
|
rect_dim(Rect_i32 r){
|
||||||
f32_Rect r = {};
|
Vec2_i32 v = {r.x1 - r.x0, r.y1 - r.y0};
|
||||||
r.x0 = outer.x0 + margin;
|
return(v);
|
||||||
r.y0 = outer.y0 + margin;
|
}
|
||||||
r.x1 = outer.x1 - margin;
|
internal i32
|
||||||
r.y1 = outer.y1 - margin;
|
rect_width(Rect_i32 r){
|
||||||
return(r);
|
return(r.x1 - r.x0);
|
||||||
|
}
|
||||||
|
internal i32
|
||||||
|
rect_height(Rect_i32 r){
|
||||||
|
return(r.y1 - r.y0);
|
||||||
|
}
|
||||||
|
internal Vec2_f32
|
||||||
|
rect_dim(Rect_f32 r){
|
||||||
|
Vec2_f32 v = {r.x1 - r.x0, r.y1 - r.y0};
|
||||||
|
return(v);
|
||||||
|
}
|
||||||
|
internal f32
|
||||||
|
rect_width(Rect_f32 r){
|
||||||
|
return(r.x1 - r.x0);
|
||||||
|
}
|
||||||
|
internal f32
|
||||||
|
rect_height(Rect_f32 r){
|
||||||
|
return(r.y1 - r.y0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static i32
|
internal Interval_i32
|
||||||
rect_height(i32_Rect rect){
|
rect_range_x(Rect_i32 r){
|
||||||
return(rect.y1 - rect.y0);
|
return(Ii32(r.x0, r.x1));
|
||||||
|
}
|
||||||
|
internal Interval_i32
|
||||||
|
rect_range_y(Rect_i32 r){
|
||||||
|
return(Ii32(r.y0, r.y1));
|
||||||
|
}
|
||||||
|
internal Interval_f32
|
||||||
|
rect_range_x(Rect_f32 r){
|
||||||
|
return(If32(r.x0, r.x1));
|
||||||
|
}
|
||||||
|
internal Interval_f32
|
||||||
|
rect_range_y(Rect_f32 r){
|
||||||
|
return(If32(r.y0, r.y1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static i32
|
internal b32
|
||||||
rect_width(i32_Rect rect){
|
rect_overlap(Rect_i32 a, Rect_i32 b){
|
||||||
return(rect.x1 - rect.x0);
|
return(range_overlap(rect_range_x(a), rect_range_x(b)) &&
|
||||||
|
range_overlap(rect_range_y(a), rect_range_y(b)));
|
||||||
|
}
|
||||||
|
internal b32
|
||||||
|
rect_overlap(Rect_f32 a, Rect_f32 b){
|
||||||
|
return(range_overlap(rect_range_x(a), rect_range_x(b)) &&
|
||||||
|
range_overlap(rect_range_y(a), rect_range_y(b)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static i32
|
internal Vec2_i32
|
||||||
fits_inside(i32_Rect rect, i32_Rect outer){
|
rect_center(Rect_i32 r){
|
||||||
return(rect.x0 >= outer.x0 && rect.x1 <= outer.x1 && rect.y0 >= outer.y0 && rect.y1 <= outer.y1);
|
return(rect_dim(r)/2);
|
||||||
}
|
}
|
||||||
|
internal Vec2_f32
|
||||||
static i32
|
rect_center(Rect_f32 r){
|
||||||
rect_overlap(f32_Rect a, f32_Rect b){
|
return(rect_dim(r)/2);
|
||||||
return(interval_overlap(a.x0, a.x1, b.x0, b.x1) &&
|
|
||||||
interval_overlap(a.y0, a.y1, b.y0, b.y1));
|
|
||||||
}
|
|
||||||
|
|
||||||
static f32
|
|
||||||
rect_height(f32_Rect rect){
|
|
||||||
return(rect.y1 - rect.y0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static f32
|
|
||||||
rect_width(f32_Rect rect){
|
|
||||||
return(rect.x1 - rect.x0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Vec2
|
|
||||||
rect_dim(f32_Rect rect){
|
|
||||||
return(V2(rect.x1 - rect.x0, rect.y1 - rect.y0));
|
|
||||||
}
|
|
||||||
|
|
||||||
static Vec2
|
|
||||||
rect_center(f32_Rect rect){
|
|
||||||
return(V2(0.5f*(rect.x0 + rect.x1), 0.5f*(rect.y0 + rect.y1)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define center_of rect_center
|
#define center_of rect_center
|
||||||
|
|
||||||
static i32_Rect
|
internal Rect_i32
|
||||||
intersection_of(i32_Rect a, i32_Rect b){
|
rect_intersect(Rect_i32 a, Rect_i32 b){
|
||||||
i32_Rect result;
|
a.x0 = Max(a.x0, b.x0);
|
||||||
result.x0 = Max(a.x0, b.x0);
|
a.y0 = Max(a.y0, b.y0);
|
||||||
result.y0 = Max(a.y0, b.y0);
|
a.x1 = Min(a.x1, b.x1);
|
||||||
result.x1 = Min(a.x1, b.x1);
|
a.y1 = Min(a.y1, b.y1);
|
||||||
result.y1 = Min(a.y1, b.y1);
|
return(a);
|
||||||
return(result);
|
}
|
||||||
|
internal Rect_i32
|
||||||
|
rect_union(Rect_i32 a, Rect_i32 b){
|
||||||
|
a.x0 = Min(a.x0, b.x0);
|
||||||
|
a.y0 = Min(a.y0, b.y0);
|
||||||
|
a.x1 = Max(a.x1, b.x1);
|
||||||
|
a.y1 = Max(a.y1, b.y1);
|
||||||
|
return(a);
|
||||||
|
}
|
||||||
|
internal Rect_f32
|
||||||
|
rect_intersect(Rect_f32 a, Rect_f32 b){
|
||||||
|
a.x0 = Max(a.x0, b.x0);
|
||||||
|
a.y0 = Max(a.y0, b.y0);
|
||||||
|
a.x1 = Min(a.x1, b.x1);
|
||||||
|
a.y1 = Min(a.y1, b.y1);
|
||||||
|
return(a);
|
||||||
|
}
|
||||||
|
internal Rect_f32
|
||||||
|
rect_union(Rect_f32 a, Rect_f32 b){
|
||||||
|
a.x0 = Min(a.x0, b.x0);
|
||||||
|
a.y0 = Min(a.y0, b.y0);
|
||||||
|
a.x1 = Max(a.x1, b.x1);
|
||||||
|
a.y1 = Max(a.y1, b.y1);
|
||||||
|
return(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static i32_Rect
|
#define intersection_of rect_intersect
|
||||||
union_of(i32_Rect a, i32_Rect b){
|
#define union_of rect_union
|
||||||
i32_Rect result;
|
|
||||||
result.x0 = Max(a.x0, b.x0);
|
|
||||||
result.y0 = Max(a.y0, b.y0);
|
|
||||||
result.x1 = Min(a.x1, b.x1);
|
|
||||||
result.y1 = Min(a.y1, b.y1);
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
static f32_Rect
|
|
||||||
intersection_of(f32_Rect a, f32_Rect b){
|
|
||||||
f32_Rect result;
|
|
||||||
result.x0 = Max(a.x0, b.x0);
|
|
||||||
result.y0 = Max(a.y0, b.y0);
|
|
||||||
result.x1 = Min(a.x1, b.x1);
|
|
||||||
result.y1 = Min(a.y1, b.y1);
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
static f32_Rect
|
|
||||||
union_of(f32_Rect a, f32_Rect b){
|
|
||||||
f32_Rect result;
|
|
||||||
result.x0 = Max(a.x0, b.x0);
|
|
||||||
result.y0 = Max(a.y0, b.y0);
|
|
||||||
result.x1 = Min(a.x1, b.x1);
|
|
||||||
result.y1 = Min(a.y1, b.y1);
|
|
||||||
return(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
|
@ -3299,7 +3311,7 @@ static umem
|
||||||
string_find_first_slash(String_Const_u16 str){
|
string_find_first_slash(String_Const_u16 str){
|
||||||
umem i = 0;
|
umem i = 0;
|
||||||
for (;i < str.size && !character_is_slash(str.str[i]); i += 1);
|
for (;i < str.size && !character_is_slash(str.str[i]); i += 1);
|
||||||
return(i);
|
return(i);
|
||||||
}
|
}
|
||||||
static umem
|
static umem
|
||||||
string_find_first_slash(String_Const_u32 str){
|
string_find_first_slash(String_Const_u32 str){
|
||||||
|
|
|
@ -628,34 +628,6 @@ union Vec4_f32{
|
||||||
f32 v[4];
|
f32 v[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
union Range_i8{
|
|
||||||
struct{
|
|
||||||
i8 min;
|
|
||||||
i8 max;
|
|
||||||
};
|
|
||||||
struct{
|
|
||||||
i8 start;
|
|
||||||
i8 end;
|
|
||||||
};
|
|
||||||
struct{
|
|
||||||
i8 first;
|
|
||||||
i8 one_past_last;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
union Range_i16{
|
|
||||||
struct{
|
|
||||||
i16 min;
|
|
||||||
i16 max;
|
|
||||||
};
|
|
||||||
struct{
|
|
||||||
i16 start;
|
|
||||||
i16 end;
|
|
||||||
};
|
|
||||||
struct{
|
|
||||||
i16 first;
|
|
||||||
i16 one_past_last;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
union Range_i32{
|
union Range_i32{
|
||||||
struct{
|
struct{
|
||||||
i32 min;
|
i32 min;
|
||||||
|
@ -670,6 +642,34 @@ union Range_i32{
|
||||||
i32 one_past_last;
|
i32 one_past_last;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
union Range_i64{
|
||||||
|
struct{
|
||||||
|
i64 min;
|
||||||
|
i64 max;
|
||||||
|
};
|
||||||
|
struct{
|
||||||
|
i64 start;
|
||||||
|
i64 end;
|
||||||
|
};
|
||||||
|
struct{
|
||||||
|
i64 first;
|
||||||
|
i64 one_past_last;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
union Range_u64{
|
||||||
|
struct{
|
||||||
|
u64 min;
|
||||||
|
u64 max;
|
||||||
|
};
|
||||||
|
struct{
|
||||||
|
u64 start;
|
||||||
|
u64 end;
|
||||||
|
};
|
||||||
|
struct{
|
||||||
|
u64 first;
|
||||||
|
u64 one_past_last;
|
||||||
|
};
|
||||||
|
};
|
||||||
union Range_f32{
|
union Range_f32{
|
||||||
struct{
|
struct{
|
||||||
f32 min;
|
f32 min;
|
||||||
|
@ -684,54 +684,13 @@ union Range_f32{
|
||||||
f32 one_past_last;
|
f32 one_past_last;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
union Range_umem{
|
|
||||||
struct{
|
|
||||||
umem min;
|
|
||||||
umem max;
|
|
||||||
};
|
|
||||||
struct{
|
|
||||||
umem start;
|
|
||||||
umem end;
|
|
||||||
};
|
|
||||||
struct{
|
|
||||||
umem first;
|
|
||||||
umem one_past_last;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef Range_i8 Interval_i8;
|
typedef Range_i32 Interval_i32;
|
||||||
typedef Range_i16 Interval_i16;
|
typedef Range_i64 Interval_i64;
|
||||||
typedef Range_i32 Interval_i32;
|
typedef Range_u64 Interval_u64;
|
||||||
typedef Range_f32 Interval_f32;
|
typedef Range_f32 Interval_f32;
|
||||||
typedef Range_umem Interval_umem;
|
|
||||||
typedef Range_i32 Range;
|
typedef Range_i32 Range;
|
||||||
|
|
||||||
union Rect_i8{
|
|
||||||
struct{
|
|
||||||
i8 x0;
|
|
||||||
i8 y0;
|
|
||||||
i8 x1;
|
|
||||||
i8 y1;
|
|
||||||
};
|
|
||||||
struct{
|
|
||||||
Vec2_i8 p0;
|
|
||||||
Vec2_i8 p1;
|
|
||||||
};
|
|
||||||
Vec2_i8 p[2];
|
|
||||||
};
|
|
||||||
union Rect_i16{
|
|
||||||
struct{
|
|
||||||
i16 x0;
|
|
||||||
i16 y0;
|
|
||||||
i16 x1;
|
|
||||||
i16 y1;
|
|
||||||
};
|
|
||||||
struct{
|
|
||||||
Vec2_i16 p0;
|
|
||||||
Vec2_i16 p1;
|
|
||||||
};
|
|
||||||
Vec2_i16 p[2];
|
|
||||||
};
|
|
||||||
union Rect_i32{
|
union Rect_i32{
|
||||||
struct{
|
struct{
|
||||||
i32 x0;
|
i32 x0;
|
||||||
|
|
|
@ -849,21 +849,21 @@ default_ui_render_caller(Application_Links *app, View_ID view_id, Rect_f32 rect_
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rect_overlap(item_rect, rect_f32)){
|
if (rect_overlap(item_rect, rect_f32)){
|
||||||
Rect_f32 inner_rect = get_inner_rect(item_rect, (f32)item->inner_margin);
|
Rect_f32 inner = rect_inner(item_rect, (f32)item->inner_margin);
|
||||||
|
|
||||||
Face_Metrics metrics = {};
|
Face_Metrics metrics = {};
|
||||||
get_face_metrics(app, face_id, &metrics);
|
get_face_metrics(app, face_id, &metrics);
|
||||||
f32 line_height = metrics.line_height;
|
f32 line_height = metrics.line_height;
|
||||||
f32 info_height = (f32)item->line_count*line_height;
|
f32 info_height = (f32)item->line_count*line_height;
|
||||||
|
|
||||||
draw_rectangle(app, inner_rect, Stag_Back);
|
draw_rectangle(app, inner, Stag_Back);
|
||||||
Vec2 p = V2(inner_rect.x0 + 3.f, (f32)(round32((inner_rect.y0 + inner_rect.y1 - info_height)*0.5f)));
|
Vec2 p = V2(inner.x0 + 3.f, (f32)(round32((inner.y0 + inner.y1 - info_height)*0.5f)));
|
||||||
for (i32 i = 0; i < item->line_count; i += 1){
|
for (i32 i = 0; i < item->line_count; i += 1){
|
||||||
draw_fancy_string(app, face_id, item->lines[i].first, p, Stag_Default, 0, 0, V2(1.f, 0));
|
draw_fancy_string(app, face_id, item->lines[i].first, p, Stag_Default, 0, 0, V2(1.f, 0));
|
||||||
p.y += line_height;
|
p.y += line_height;
|
||||||
}
|
}
|
||||||
if (item->inner_margin > 0){
|
if (item->inner_margin > 0){
|
||||||
draw_margin(app, item_rect, inner_rect, get_margin_color(item->activation_level));
|
draw_margin(app, item_rect, inner, get_margin_color(item->activation_level));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -902,7 +902,7 @@ static void
|
||||||
default_render_view(Application_Links *app, Frame_Info frame_info, View_ID view_id, b32 is_active){
|
default_render_view(Application_Links *app, Frame_Info frame_info, View_ID view_id, b32 is_active){
|
||||||
Rect_i32 view_rect = {};
|
Rect_i32 view_rect = {};
|
||||||
view_get_region(app, view_id, &view_rect);
|
view_get_region(app, view_id, &view_rect);
|
||||||
Rect_i32 inner = get_inner_rect(view_rect, 3);
|
Rect_i32 inner = rect_inner(view_rect, 3);
|
||||||
draw_rectangle(app, f32R(view_rect), get_margin_color(is_active?UIActivation_Active:UIActivation_None));
|
draw_rectangle(app, f32R(view_rect), get_margin_color(is_active?UIActivation_Active:UIActivation_None));
|
||||||
draw_rectangle(app, f32R(inner), Stag_Back);
|
draw_rectangle(app, f32R(inner), Stag_Back);
|
||||||
draw_clip_push(app, f32R(inner));
|
draw_clip_push(app, f32R(inner));
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
#include "4coder_api_transition_30_31.h"
|
#include "4coder_api_transition_30_31.h"
|
||||||
|
|
||||||
|
#include "4coder_string_match.cpp"
|
||||||
#include "4coder_helper.h"
|
#include "4coder_helper.h"
|
||||||
#include "4coder_insertion.h"
|
#include "4coder_insertion.h"
|
||||||
#include "4coder_fancy.h"
|
#include "4coder_fancy.h"
|
||||||
|
|
|
@ -180,9 +180,9 @@ struct Application_Links;
|
||||||
#define TEXT_LAYOUT_FREE_SIG(n) b32 n(Application_Links *app, Text_Layout_ID text_layout_id)
|
#define TEXT_LAYOUT_FREE_SIG(n) b32 n(Application_Links *app, Text_Layout_ID text_layout_id)
|
||||||
#define COMPUTE_RENDER_LAYOUT_SIG(n) b32 n(Application_Links *app, View_ID view_id, Buffer_ID buffer_id, Vec2 screen_p, Vec2 layout_dim, Buffer_Point buffer_point, i32 one_past_last, Text_Layout_ID *text_layout_id_out)
|
#define COMPUTE_RENDER_LAYOUT_SIG(n) b32 n(Application_Links *app, View_ID view_id, Buffer_ID buffer_id, Vec2 screen_p, Vec2 layout_dim, Buffer_Point buffer_point, i32 one_past_last, Text_Layout_ID *text_layout_id_out)
|
||||||
#define DRAW_RENDER_LAYOUT_SIG(n) void n(Application_Links *app, View_ID view_id)
|
#define DRAW_RENDER_LAYOUT_SIG(n) void n(Application_Links *app, View_ID view_id)
|
||||||
#define OPEN_COLOR_PICKER_SIG(n) void n(Application_Links *app, color_picker *picker)
|
#define OPEN_COLOR_PICKER_SIG(n) void n(Application_Links *app, Color_Picker *picker)
|
||||||
#define ANIMATE_IN_N_MILLISECONDS_SIG(n) void n(Application_Links *app, u32 n)
|
#define ANIMATE_IN_N_MILLISECONDS_SIG(n) void n(Application_Links *app, u32 n)
|
||||||
#define FIND_ALL_MATCHES_BUFFER_RANGE_SIG(n) String_Match_List n(Application_Links *app, Arena *arena, Buffer_ID buffer, Range range, String_Const_u8 needle, Character_Predicate *predicate, Scan_Direction direction)
|
#define FIND_ALL_MATCHES_BUFFER_RANGE_SIG(n) String_Match_List n(Application_Links *app, Arena *arena, Buffer_ID buffer, i32 string_id, Range range, String_Const_u8 needle, Character_Predicate *predicate, Scan_Direction direction)
|
||||||
#define GET_VIEW_VISIBLE_RANGE_SIG(n) Range n(Application_Links *app, View_ID view_id)
|
#define GET_VIEW_VISIBLE_RANGE_SIG(n) Range n(Application_Links *app, View_ID view_id)
|
||||||
typedef GLOBAL_SET_SETTING_SIG(Global_Set_Setting_Function);
|
typedef GLOBAL_SET_SETTING_SIG(Global_Set_Setting_Function);
|
||||||
typedef GLOBAL_SET_MAPPING_SIG(Global_Set_Mapping_Function);
|
typedef GLOBAL_SET_MAPPING_SIG(Global_Set_Mapping_Function);
|
||||||
|
@ -1118,9 +1118,9 @@ static b32 text_layout_get_height(Application_Links *app, Text_Layout_ID text_la
|
||||||
static b32 text_layout_free(Application_Links *app, Text_Layout_ID text_layout_id){return(app->text_layout_free(app, text_layout_id));}
|
static b32 text_layout_free(Application_Links *app, Text_Layout_ID text_layout_id){return(app->text_layout_free(app, text_layout_id));}
|
||||||
static b32 compute_render_layout(Application_Links *app, View_ID view_id, Buffer_ID buffer_id, Vec2 screen_p, Vec2 layout_dim, Buffer_Point buffer_point, i32 one_past_last, Text_Layout_ID *text_layout_id_out){return(app->compute_render_layout(app, view_id, buffer_id, screen_p, layout_dim, buffer_point, one_past_last, text_layout_id_out));}
|
static b32 compute_render_layout(Application_Links *app, View_ID view_id, Buffer_ID buffer_id, Vec2 screen_p, Vec2 layout_dim, Buffer_Point buffer_point, i32 one_past_last, Text_Layout_ID *text_layout_id_out){return(app->compute_render_layout(app, view_id, buffer_id, screen_p, layout_dim, buffer_point, one_past_last, text_layout_id_out));}
|
||||||
static void draw_render_layout(Application_Links *app, View_ID view_id){(app->draw_render_layout(app, view_id));}
|
static void draw_render_layout(Application_Links *app, View_ID view_id){(app->draw_render_layout(app, view_id));}
|
||||||
static void open_color_picker(Application_Links *app, color_picker *picker){(app->open_color_picker(app, picker));}
|
static void open_color_picker(Application_Links *app, Color_Picker *picker){(app->open_color_picker(app, picker));}
|
||||||
static void animate_in_n_milliseconds(Application_Links *app, u32 n){(app->animate_in_n_milliseconds(app, n));}
|
static void animate_in_n_milliseconds(Application_Links *app, u32 n){(app->animate_in_n_milliseconds(app, n));}
|
||||||
static String_Match_List find_all_matches_buffer_range(Application_Links *app, Arena *arena, Buffer_ID buffer, Range range, String_Const_u8 needle, Character_Predicate *predicate, Scan_Direction direction){return(app->find_all_matches_buffer_range(app, arena, buffer, range, needle, predicate, direction));}
|
static String_Match_List find_all_matches_buffer_range(Application_Links *app, Arena *arena, Buffer_ID buffer, i32 string_id, Range range, String_Const_u8 needle, Character_Predicate *predicate, Scan_Direction direction){return(app->find_all_matches_buffer_range(app, arena, buffer, string_id, range, needle, predicate, direction));}
|
||||||
static Range get_view_visible_range(Application_Links *app, View_ID view_id){return(app->get_view_visible_range(app, view_id));}
|
static Range get_view_visible_range(Application_Links *app, View_ID view_id){return(app->get_view_visible_range(app, view_id));}
|
||||||
#else
|
#else
|
||||||
static b32 global_set_setting(Application_Links *app, Global_Setting_ID setting, i32 value){return(app->global_set_setting_(app, setting, value));}
|
static b32 global_set_setting(Application_Links *app, Global_Setting_ID setting, i32 value){return(app->global_set_setting_(app, setting, value));}
|
||||||
|
@ -1304,8 +1304,8 @@ static b32 text_layout_get_height(Application_Links *app, Text_Layout_ID text_la
|
||||||
static b32 text_layout_free(Application_Links *app, Text_Layout_ID text_layout_id){return(app->text_layout_free_(app, text_layout_id));}
|
static b32 text_layout_free(Application_Links *app, Text_Layout_ID text_layout_id){return(app->text_layout_free_(app, text_layout_id));}
|
||||||
static b32 compute_render_layout(Application_Links *app, View_ID view_id, Buffer_ID buffer_id, Vec2 screen_p, Vec2 layout_dim, Buffer_Point buffer_point, i32 one_past_last, Text_Layout_ID *text_layout_id_out){return(app->compute_render_layout_(app, view_id, buffer_id, screen_p, layout_dim, buffer_point, one_past_last, text_layout_id_out));}
|
static b32 compute_render_layout(Application_Links *app, View_ID view_id, Buffer_ID buffer_id, Vec2 screen_p, Vec2 layout_dim, Buffer_Point buffer_point, i32 one_past_last, Text_Layout_ID *text_layout_id_out){return(app->compute_render_layout_(app, view_id, buffer_id, screen_p, layout_dim, buffer_point, one_past_last, text_layout_id_out));}
|
||||||
static void draw_render_layout(Application_Links *app, View_ID view_id){(app->draw_render_layout_(app, view_id));}
|
static void draw_render_layout(Application_Links *app, View_ID view_id){(app->draw_render_layout_(app, view_id));}
|
||||||
static void open_color_picker(Application_Links *app, color_picker *picker){(app->open_color_picker_(app, picker));}
|
static void open_color_picker(Application_Links *app, Color_Picker *picker){(app->open_color_picker_(app, picker));}
|
||||||
static void animate_in_n_milliseconds(Application_Links *app, u32 n){(app->animate_in_n_milliseconds_(app, n));}
|
static void animate_in_n_milliseconds(Application_Links *app, u32 n){(app->animate_in_n_milliseconds_(app, n));}
|
||||||
static String_Match_List find_all_matches_buffer_range(Application_Links *app, Arena *arena, Buffer_ID buffer, Range range, String_Const_u8 needle, Character_Predicate *predicate, Scan_Direction direction){return(app->find_all_matches_buffer_range_(app, arena, buffer, range, needle, predicate, direction));}
|
static String_Match_List find_all_matches_buffer_range(Application_Links *app, Arena *arena, Buffer_ID buffer, i32 string_id, Range range, String_Const_u8 needle, Character_Predicate *predicate, Scan_Direction direction){return(app->find_all_matches_buffer_range_(app, arena, buffer, string_id, range, needle, predicate, direction));}
|
||||||
static Range get_view_visible_range(Application_Links *app, View_ID view_id){return(app->get_view_visible_range_(app, view_id));}
|
static Range get_view_visible_range(Application_Links *app, View_ID view_id){return(app->get_view_visible_range_(app, view_id));}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -323,58 +323,58 @@ static Command_Metadata fcoder_metacmd_table[236] = {
|
||||||
{ PROC_LINKS(move_left_alpha_numeric_or_camel_boundary, 0), "move_left_alpha_numeric_or_camel_boundary", 41, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 659 },
|
{ PROC_LINKS(move_left_alpha_numeric_or_camel_boundary, 0), "move_left_alpha_numeric_or_camel_boundary", 41, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 659 },
|
||||||
{ PROC_LINKS(select_all, 0), "select_all", 10, "Puts the cursor at the top of the file, and the mark at the bottom of the file.", 79, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 680 },
|
{ PROC_LINKS(select_all, 0), "select_all", 10, "Puts the cursor at the top of the file, and the mark at the bottom of the file.", 79, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 680 },
|
||||||
{ PROC_LINKS(to_uppercase, 0), "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 696 },
|
{ PROC_LINKS(to_uppercase, 0), "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 696 },
|
||||||
{ PROC_LINKS(to_lowercase, 0), "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 716 },
|
{ PROC_LINKS(to_lowercase, 0), "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 711 },
|
||||||
{ PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 736 },
|
{ PROC_LINKS(clean_all_lines, 0), "clean_all_lines", 15, "Removes trailing whitespace from all lines in the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 726 },
|
||||||
{ PROC_LINKS(basic_change_active_panel, 0), "basic_change_active_panel", 25, "Change the currently active panel, moving to the panel with the next highest view_id. Will not skipe the build panel if it is open.", 132, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 777 },
|
{ PROC_LINKS(basic_change_active_panel, 0), "basic_change_active_panel", 25, "Change the currently active panel, moving to the panel with the next highest view_id. Will not skipe the build panel if it is open.", 132, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 767 },
|
||||||
{ PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 786 },
|
{ PROC_LINKS(close_panel, 0), "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 776 },
|
||||||
{ PROC_LINKS(show_scrollbar, 0), "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 796 },
|
{ PROC_LINKS(show_scrollbar, 0), "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 786 },
|
||||||
{ PROC_LINKS(hide_scrollbar, 0), "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 804 },
|
{ PROC_LINKS(hide_scrollbar, 0), "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 794 },
|
||||||
{ PROC_LINKS(show_filebar, 0), "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 812 },
|
{ PROC_LINKS(show_filebar, 0), "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 802 },
|
||||||
{ PROC_LINKS(hide_filebar, 0), "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 820 },
|
{ PROC_LINKS(hide_filebar, 0), "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 810 },
|
||||||
{ PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 828 },
|
{ PROC_LINKS(toggle_filebar, 0), "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 818 },
|
||||||
{ PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 838 },
|
{ PROC_LINKS(toggle_line_wrap, 0), "toggle_line_wrap", 16, "Toggles the current buffer's line wrapping status.", 50, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 828 },
|
||||||
{ PROC_LINKS(toggle_fps_meter, 0), "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 850 },
|
{ PROC_LINKS(toggle_fps_meter, 0), "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 840 },
|
||||||
{ PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 856 },
|
{ PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 846 },
|
||||||
{ PROC_LINKS(decrease_line_wrap, 0), "decrease_line_wrap", 18, "Decrases the current buffer's width for line wrapping.", 54, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 868 },
|
{ PROC_LINKS(decrease_line_wrap, 0), "decrease_line_wrap", 18, "Decrases the current buffer's width for line wrapping.", 54, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 858 },
|
||||||
{ PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 880 },
|
{ PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 870 },
|
||||||
{ PROC_LINKS(decrease_face_size, 0), "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 894 },
|
{ PROC_LINKS(decrease_face_size, 0), "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 884 },
|
||||||
{ PROC_LINKS(mouse_wheel_change_face_size, 0), "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 908 },
|
{ PROC_LINKS(mouse_wheel_change_face_size, 0), "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 898 },
|
||||||
{ PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 925 },
|
{ PROC_LINKS(toggle_virtual_whitespace, 0), "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 915 },
|
||||||
{ PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 937 },
|
{ PROC_LINKS(toggle_show_whitespace, 0), "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 927 },
|
||||||
{ PROC_LINKS(toggle_line_numbers, 0), "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 947 },
|
{ PROC_LINKS(toggle_line_numbers, 0), "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 937 },
|
||||||
{ PROC_LINKS(eol_dosify, 0), "eol_dosify", 10, "Puts the buffer in DOS line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 953 },
|
{ PROC_LINKS(eol_dosify, 0), "eol_dosify", 10, "Puts the buffer in DOS line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 943 },
|
||||||
{ PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 963 },
|
{ PROC_LINKS(eol_nixify, 0), "eol_nixify", 10, "Puts the buffer in NIX line ending mode.", 40, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 953 },
|
||||||
{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 973 },
|
{ PROC_LINKS(exit_4coder, 0), "exit_4coder", 11, "Attempts to close 4coder.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 963 },
|
||||||
{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 981 },
|
{ PROC_LINKS(goto_line, 0), "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 971 },
|
||||||
{ PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1209 },
|
{ PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1199 },
|
||||||
{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1215 },
|
{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1205 },
|
||||||
{ PROC_LINKS(search_identifier, 0), "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1221 },
|
{ PROC_LINKS(search_identifier, 0), "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1211 },
|
||||||
{ PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1236 },
|
{ PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1226 },
|
||||||
{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for two strings, and replaces all occurences of the first string in the range between the cursor and the mark with the second string.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1251 },
|
{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for two strings, and replaces all occurences of the first string in the range between the cursor and the mark with the second string.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1241 },
|
||||||
{ PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1360 },
|
{ PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1350 },
|
||||||
{ PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1383 },
|
{ PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1373 },
|
||||||
{ PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1402 },
|
{ PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1392 },
|
||||||
{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1446 },
|
{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1436 },
|
||||||
{ PROC_LINKS(delete_file_query, 0), "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1471 },
|
{ PROC_LINKS(delete_file_query, 0), "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1461 },
|
||||||
{ PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1511 },
|
{ PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1501 },
|
||||||
{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1549 },
|
{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1539 },
|
||||||
{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1592 },
|
{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1582 },
|
||||||
{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1628 },
|
{ PROC_LINKS(move_line_up, 0), "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1618 },
|
||||||
{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1634 },
|
{ PROC_LINKS(move_line_down, 0), "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1624 },
|
||||||
{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1640 },
|
{ PROC_LINKS(duplicate_line, 0), "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1630 },
|
||||||
{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1657 },
|
{ PROC_LINKS(delete_line, 0), "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1647 },
|
||||||
{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1726 },
|
{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1716 },
|
||||||
{ PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1764 },
|
{ PROC_LINKS(open_matching_file_cpp, 0), "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1754 },
|
||||||
{ PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1779 },
|
{ PROC_LINKS(view_buffer_other_panel, 0), "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1769 },
|
||||||
{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1794 },
|
{ PROC_LINKS(swap_buffers_between_panels, 0), "swap_buffers_between_panels", 27, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1784 },
|
||||||
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1839 },
|
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1829 },
|
||||||
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1849 },
|
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1839 },
|
||||||
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1863 },
|
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1853 },
|
||||||
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1927 },
|
{ PROC_LINKS(undo, 0), "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1917 },
|
||||||
{ PROC_LINKS(redo, 0), "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1943 },
|
{ PROC_LINKS(redo, 0), "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1933 },
|
||||||
{ PROC_LINKS(undo_all_buffers, 0), "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1961 },
|
{ PROC_LINKS(undo_all_buffers, 0), "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1951 },
|
||||||
{ PROC_LINKS(redo_all_buffers, 0), "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 2040 },
|
{ PROC_LINKS(redo_all_buffers, 0), "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 2030 },
|
||||||
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 2150 },
|
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 2140 },
|
||||||
{ PROC_LINKS(lister__quit, 0), "lister__quit", 12, "A lister mode command that quits the list without executing any actions.", 72, "w:\\4ed\\code\\4coder_lists.cpp", 28, 8 },
|
{ PROC_LINKS(lister__quit, 0), "lister__quit", 12, "A lister mode command that quits the list without executing any actions.", 72, "w:\\4ed\\code\\4coder_lists.cpp", 28, 8 },
|
||||||
{ PROC_LINKS(lister__activate, 0), "lister__activate", 16, "A lister mode command that activates the list's action on the highlighted item.", 79, "w:\\4ed\\code\\4coder_lists.cpp", 28, 16 },
|
{ PROC_LINKS(lister__activate, 0), "lister__activate", 16, "A lister mode command that activates the list's action on the highlighted item.", 79, "w:\\4ed\\code\\4coder_lists.cpp", 28, 16 },
|
||||||
{ PROC_LINKS(lister__write_character, 0), "lister__write_character", 23, "A lister mode command that dispatches to the lister's write character handler.", 78, "w:\\4ed\\code\\4coder_lists.cpp", 28, 32 },
|
{ PROC_LINKS(lister__write_character, 0), "lister__write_character", 23, "A lister mode command that dispatches to the lister's write character handler.", 78, "w:\\4ed\\code\\4coder_lists.cpp", 28, 32 },
|
||||||
|
|
|
@ -1096,7 +1096,7 @@ push_buffer_range(Application_Links *app, Arena *arena, Buffer_ID buffer, Range
|
||||||
}
|
}
|
||||||
|
|
||||||
static String_Const_u8
|
static String_Const_u8
|
||||||
push_buffer_range(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_umem range){
|
push_buffer_range(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_u64 range){
|
||||||
return(push_buffer_range(app, arena, buffer, range.first, range.one_past_last));
|
return(push_buffer_range(app, arena, buffer, range.first, range.one_past_last));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* Mr. 4th Dimention - Allen Webster
|
||||||
|
*
|
||||||
|
* 17.06.2019
|
||||||
|
*
|
||||||
|
* Routines for operating on the String_Match and String_Match_List types.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// TOP
|
||||||
|
|
||||||
|
internal void
|
||||||
|
string_match_list_push(Arena *arena, String_Match_List *list,
|
||||||
|
Buffer_ID buffer, i32 string_id, String_Match_Flag flags, Range_u64 range){
|
||||||
|
String_Match *match = push_array(arena, String_Match, 1);
|
||||||
|
sll_queue_push(list->first, list->last, match);
|
||||||
|
list->count += 1;
|
||||||
|
match->buffer = buffer;
|
||||||
|
match->string_id = string_id;
|
||||||
|
match->flags = flags;
|
||||||
|
match->range = range;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
string_match_list_push(Arena *arena, String_Match_List *list,
|
||||||
|
Buffer_ID buffer, i32 string_id, String_Match_Flag flags, u64 start, u64 length){
|
||||||
|
string_match_list_push(arena, list, buffer, string_id, flags,
|
||||||
|
make_range_u64(start, start + length));
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
string_match_list_join(String_Match_List *dst, String_Match_List *src){
|
||||||
|
if (dst->last != 0){
|
||||||
|
dst->last->next = src->first;
|
||||||
|
}
|
||||||
|
if (src->last != 0){
|
||||||
|
dst->last = src->last;
|
||||||
|
}
|
||||||
|
dst->count += src->count;
|
||||||
|
block_zero_struct(src);
|
||||||
|
}
|
||||||
|
|
||||||
|
// BOTTOM
|
|
@ -487,10 +487,10 @@ Buffer_Seek_String(Application_Links *app, Buffer_ID buffer, String_Const_u8 nee
|
||||||
Character_Predicate dummy = {};
|
Character_Predicate dummy = {};
|
||||||
String_Match_List list = find_all_matches(scratch, 1,
|
String_Match_List list = find_all_matches(scratch, 1,
|
||||||
chunks, needle, jump_table, &dummy, direction,
|
chunks, needle, jump_table, &dummy, direction,
|
||||||
range.min, 0);
|
range.min, 0, 0);
|
||||||
if (list.count == 1){
|
if (list.count == 1){
|
||||||
result = true;
|
result = true;
|
||||||
*pos_out = (i32)list.first->index;
|
*pos_out = (i32)list.first->range.first;
|
||||||
*case_sensitive_out = (HasFlag(list.first->flags, StringMatch_CaseSensitive));
|
*case_sensitive_out = (HasFlag(list.first->flags, StringMatch_CaseSensitive));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4257,13 +4257,11 @@ Draw_Render_Layout(Application_Links *app, View_ID view_id){
|
||||||
}
|
}
|
||||||
|
|
||||||
API_EXPORT void
|
API_EXPORT void
|
||||||
Open_Color_Picker(Application_Links *app, color_picker *picker)
|
Open_Color_Picker(Application_Links *app, Color_Picker *picker)
|
||||||
{
|
{
|
||||||
Models *models = (Models*)app->cmd_context;
|
Models *models = (Models*)app->cmd_context;
|
||||||
System_Functions *system = models->system;
|
System_Functions *system = models->system;
|
||||||
|
if (picker->finished){
|
||||||
if(picker->finished)
|
|
||||||
{
|
|
||||||
*picker->finished = false;
|
*picker->finished = false;
|
||||||
}
|
}
|
||||||
system->open_color_picker(picker);
|
system->open_color_picker(picker);
|
||||||
|
@ -4282,7 +4280,7 @@ Animate_In_N_Milliseconds(Application_Links *app, u32 n)
|
||||||
}
|
}
|
||||||
|
|
||||||
API_EXPORT String_Match_List
|
API_EXPORT String_Match_List
|
||||||
Find_All_Matches_Buffer_Range(Application_Links *app, Arena *arena, Buffer_ID buffer, Range range, String_Const_u8 needle, Character_Predicate *predicate, Scan_Direction direction)
|
Find_All_Matches_Buffer_Range(Application_Links *app, Arena *arena, Buffer_ID buffer, i32 string_id, Range range, String_Const_u8 needle, Character_Predicate *predicate, Scan_Direction direction)
|
||||||
{
|
{
|
||||||
Models *models = (Models*)app->cmd_context;
|
Models *models = (Models*)app->cmd_context;
|
||||||
Editing_File *file = imp_get_file(models, buffer);
|
Editing_File *file = imp_get_file(models, buffer);
|
||||||
|
@ -4301,7 +4299,7 @@ Find_All_Matches_Buffer_Range(Application_Links *app, Arena *arena, Buffer_ID bu
|
||||||
}
|
}
|
||||||
list = find_all_matches(arena, max_i32,
|
list = find_all_matches(arena, max_i32,
|
||||||
chunks, needle, jump_table, predicate, direction,
|
chunks, needle, jump_table, predicate, direction,
|
||||||
range.min, buffer);
|
range.min, buffer, string_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "4ed_system.h"
|
#include "4ed_system.h"
|
||||||
|
|
||||||
#include "4coder_base_types.cpp"
|
#include "4coder_base_types.cpp"
|
||||||
|
#include "4coder_string_match.cpp"
|
||||||
#include "4coder_stringf.cpp"
|
#include "4coder_stringf.cpp"
|
||||||
#include "4coder_app_links_allocator.cpp"
|
#include "4coder_app_links_allocator.cpp"
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ layout__free_panel(Layout *layout, Panel *panel){
|
||||||
internal void
|
internal void
|
||||||
layout__set_panel_rectangle(Layout *layout, Panel *panel, i32_Rect rect){
|
layout__set_panel_rectangle(Layout *layout, Panel *panel, i32_Rect rect){
|
||||||
panel->rect_full = rect;
|
panel->rect_full = rect;
|
||||||
panel->rect_inner = get_inner_rect(rect, layout->margin);
|
panel->rect_inner = rect_inner(rect, layout->margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal i32
|
internal i32
|
||||||
|
|
|
@ -94,7 +94,7 @@ draw_margin(Render_Target *target, f32_Rect outer, f32_Rect inner, u32 color){
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
draw_margin(Render_Target *target, f32_Rect outer, f32 width, u32 color){
|
draw_margin(Render_Target *target, f32_Rect outer, f32 width, u32 color){
|
||||||
f32_Rect inner = get_inner_rect(outer, width);
|
f32_Rect inner = rect_inner(outer, width);
|
||||||
draw_margin(target, outer, inner, color);
|
draw_margin(target, outer, inner, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ draw_margin(Render_Target *target, i32_Rect outer, i32_Rect inner, u32 color){
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
draw_margin(Render_Target *target, i32_Rect outer, i32 width, u32 color){
|
draw_margin(Render_Target *target, i32_Rect outer, i32 width, u32 color){
|
||||||
i32_Rect inner = get_inner_rect(outer, width);
|
i32_Rect inner = rect_inner(outer, width);
|
||||||
draw_margin(target, outer, inner, color);
|
draw_margin(target, outer, inner, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,11 +82,7 @@ Render_Change_Clip_Sig(render_change_clip, t, clip_box){
|
||||||
|
|
||||||
internal
|
internal
|
||||||
Render_Push_Clip_Sig(render_push_clip, t, clip_box){
|
Render_Push_Clip_Sig(render_push_clip, t, clip_box){
|
||||||
// NOTE(casey): Allen, I nerfed this assertion because really people should be able to push any clip region they want, it
|
if (t->clip_top != -1){
|
||||||
// should just be "restricted" to the previous clip regions, right?
|
|
||||||
// Assert(t->clip_top == -1 || fits_inside(clip_box, t->clip_boxes[t->clip_top]));
|
|
||||||
if(t->clip_top != -1)
|
|
||||||
{
|
|
||||||
clip_box = intersection_of(clip_box, t->clip_boxes[t->clip_top]);
|
clip_box = intersection_of(clip_box, t->clip_boxes[t->clip_top]);
|
||||||
}
|
}
|
||||||
Assert(t->clip_top + 1 < ArrayCount(t->clip_boxes));
|
Assert(t->clip_top + 1 < ArrayCount(t->clip_boxes));
|
||||||
|
|
|
@ -63,24 +63,13 @@ string_compute_needle_jump_table(Arena *arena, String_Const_u8 needle, Scan_Dire
|
||||||
return(string_compute_needle_jump_table(arena, prefix_table));
|
return(string_compute_needle_jump_table(arena, prefix_table));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
|
||||||
string_match_list_push(Arena *arena, String_Match_List *list,
|
|
||||||
u64 index, String_Match_Flag flags, Buffer_ID buffer){
|
|
||||||
String_Match *match = push_array(arena, String_Match, 1);
|
|
||||||
sll_queue_push(list->first, list->last, match);
|
|
||||||
list->count += 1;
|
|
||||||
match->buffer = buffer;
|
|
||||||
match->flags = flags;
|
|
||||||
match->index = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define character_predicate_check_character(p, c) (((p).b[(c)/8] & (1 << ((c)%8))) != 0)
|
#define character_predicate_check_character(p, c) (((p).b[(c)/8] & (1 << ((c)%8))) != 0)
|
||||||
|
|
||||||
internal String_Match_List
|
internal String_Match_List
|
||||||
find_all_matches_forward(Arena *arena, i32 maximum_output_count,
|
find_all_matches_forward(Arena *arena, i32 maximum_output_count,
|
||||||
String_Const_u8_Array chunks, String_Const_u8 needle,
|
String_Const_u8_Array chunks, String_Const_u8 needle,
|
||||||
u64_Array jump_table, Character_Predicate *predicate,
|
u64_Array jump_table, Character_Predicate *predicate,
|
||||||
u64 base_index, Buffer_ID buffer){
|
u64 base_index, Buffer_ID buffer, i32 string_id){
|
||||||
String_Match_List list = {};
|
String_Match_List list = {};
|
||||||
|
|
||||||
if (chunks.count > 0){
|
if (chunks.count > 0){
|
||||||
|
@ -155,7 +144,8 @@ find_all_matches_forward(Arena *arena, i32 maximum_output_count,
|
||||||
if (current_l){
|
if (current_l){
|
||||||
AddFlag(flags, StringMatch_LeftSideSloppy);
|
AddFlag(flags, StringMatch_LeftSideSloppy);
|
||||||
}
|
}
|
||||||
string_match_list_push(arena, &list, base_index + j, flags, buffer);
|
string_match_list_push(arena, &list, buffer, string_id, flags,
|
||||||
|
base_index + j, needle.size);
|
||||||
if (list.count >= maximum_output_count){
|
if (list.count >= maximum_output_count){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -192,7 +182,7 @@ internal String_Match_List
|
||||||
find_all_matches_backward(Arena *arena, i32 maximum_output_count,
|
find_all_matches_backward(Arena *arena, i32 maximum_output_count,
|
||||||
String_Const_u8_Array chunks, String_Const_u8 needle,
|
String_Const_u8_Array chunks, String_Const_u8 needle,
|
||||||
u64_Array jump_table, Character_Predicate *predicate,
|
u64_Array jump_table, Character_Predicate *predicate,
|
||||||
u64 base_index, Buffer_ID buffer){
|
u64 base_index, Buffer_ID buffer, i32 string_id){
|
||||||
String_Match_List list = {};
|
String_Match_List list = {};
|
||||||
|
|
||||||
if (chunks.count > 0){
|
if (chunks.count > 0){
|
||||||
|
@ -272,8 +262,8 @@ find_all_matches_backward(Arena *arena, i32 maximum_output_count,
|
||||||
if (current_r){
|
if (current_r){
|
||||||
AddFlag(flags, StringMatch_RightSideSloppy);
|
AddFlag(flags, StringMatch_RightSideSloppy);
|
||||||
}
|
}
|
||||||
string_match_list_push(arena, &list,
|
string_match_list_push(arena, &list, buffer, string_id, flags,
|
||||||
base_index + (j - (needle.size - 1)), flags, buffer);
|
base_index + (j - (needle.size - 1)), needle.size);
|
||||||
if (list.count >= maximum_output_count){
|
if (list.count >= maximum_output_count){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -314,21 +304,21 @@ find_all_matches(Arena *arena, i32 maximum_output_count,
|
||||||
String_Const_u8_Array chunks, String_Const_u8 needle,
|
String_Const_u8_Array chunks, String_Const_u8 needle,
|
||||||
u64_Array jump_table, Character_Predicate *predicate,
|
u64_Array jump_table, Character_Predicate *predicate,
|
||||||
Scan_Direction direction,
|
Scan_Direction direction,
|
||||||
u64 base_index, Buffer_ID buffer){
|
u64 base_index, Buffer_ID buffer, i32 string_id){
|
||||||
String_Match_List list = {};
|
String_Match_List list = {};
|
||||||
switch (direction){
|
switch (direction){
|
||||||
case Scan_Forward:
|
case Scan_Forward:
|
||||||
{
|
{
|
||||||
list = find_all_matches_forward(arena, maximum_output_count,
|
list = find_all_matches_forward(arena, maximum_output_count,
|
||||||
chunks, needle, jump_table, predicate,
|
chunks, needle, jump_table, predicate,
|
||||||
base_index, buffer);
|
base_index, buffer, string_id);
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case Scan_Backward:
|
case Scan_Backward:
|
||||||
{
|
{
|
||||||
list = find_all_matches_backward(arena, maximum_output_count,
|
list = find_all_matches_backward(arena, maximum_output_count,
|
||||||
chunks, needle, jump_table, predicate,
|
chunks, needle, jump_table, predicate,
|
||||||
base_index, buffer);
|
base_index, buffer, string_id);
|
||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
return(list);
|
return(list);
|
||||||
|
|
|
@ -128,7 +128,7 @@ typedef Sys_Yield_Coroutine_Sig(System_Yield_Coroutine);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
#define Sys_Open_Color_Picker_Sig(name) void name(color_picker *picker)
|
#define Sys_Open_Color_Picker_Sig(name) void name(Color_Picker *picker)
|
||||||
typedef Sys_Open_Color_Picker_Sig(System_Open_Color_Picker);
|
typedef Sys_Open_Color_Picker_Sig(System_Open_Color_Picker);
|
||||||
|
|
||||||
// thread
|
// thread
|
||||||
|
|
|
@ -140,7 +140,7 @@ interpret_render_buffer(Render_Target *t, Arena *scratch){
|
||||||
case RenCom_Outline:
|
case RenCom_Outline:
|
||||||
{
|
{
|
||||||
Render_Command_Rectangle *rectangle = (Render_Command_Rectangle*)header;
|
Render_Command_Rectangle *rectangle = (Render_Command_Rectangle*)header;
|
||||||
f32_Rect r = get_inner_rect(rectangle->rect, .5f);
|
f32_Rect r = rect_inner(rectangle->rect, .5f);
|
||||||
private_draw_set_color(t, rectangle->color);
|
private_draw_set_color(t, rectangle->color);
|
||||||
private_draw_bind_texture(t, 0);
|
private_draw_bind_texture(t, 0);
|
||||||
glBegin(GL_LINE_STRIP);
|
glBegin(GL_LINE_STRIP);
|
||||||
|
|
|
@ -475,10 +475,11 @@ color_picker_hook(HWND Window, UINT Message, WPARAM WParam, LPARAM LParam){
|
||||||
UINT_PTR result = 0;
|
UINT_PTR result = 0;
|
||||||
switch(Message)
|
switch(Message)
|
||||||
{
|
{
|
||||||
|
// TODO(allen): review
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
CHOOSECOLORW *win32_params = (CHOOSECOLORW *)LParam;
|
CHOOSECOLORW *win32_params = (CHOOSECOLORW *)LParam;
|
||||||
color_picker *picker = (color_picker *)win32_params->lCustData;
|
Color_Picker *picker = (Color_Picker*)win32_params->lCustData;
|
||||||
SetWindowLongPtr(Window, GWLP_USERDATA, (LONG_PTR)LParam);
|
SetWindowLongPtr(Window, GWLP_USERDATA, (LONG_PTR)LParam);
|
||||||
|
|
||||||
u16 Temp[256];
|
u16 Temp[256];
|
||||||
|
@ -509,7 +510,7 @@ color_picker_hook(HWND Window, UINT Message, WPARAM WParam, LPARAM LParam){
|
||||||
CHOOSECOLORW *win32_params = (CHOOSECOLORW *)GetWindowLongPtr(Window, GWLP_USERDATA);
|
CHOOSECOLORW *win32_params = (CHOOSECOLORW *)GetWindowLongPtr(Window, GWLP_USERDATA);
|
||||||
if(win32_params)
|
if(win32_params)
|
||||||
{
|
{
|
||||||
color_picker *picker = (color_picker *)win32_params->lCustData;
|
Color_Picker *picker = (Color_Picker*)win32_params->lCustData;
|
||||||
|
|
||||||
RECT rect;
|
RECT rect;
|
||||||
GetClientRect(swatch_window, &rect);
|
GetClientRect(swatch_window, &rect);
|
||||||
|
@ -540,10 +541,11 @@ color_picker_hook(HWND Window, UINT Message, WPARAM WParam, LPARAM LParam){
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(allen): review
|
||||||
internal DWORD WINAPI
|
internal DWORD WINAPI
|
||||||
color_picker_thread(LPVOID Param)
|
color_picker_thread(LPVOID Param)
|
||||||
{
|
{
|
||||||
color_picker *picker = (color_picker *)Param;
|
Color_Picker *picker = (Color_Picker*)Param;
|
||||||
|
|
||||||
int_color color = 0;
|
int_color color = 0;
|
||||||
if(picker->dest)
|
if(picker->dest)
|
||||||
|
@ -585,11 +587,11 @@ color_picker_thread(LPVOID Param)
|
||||||
|
|
||||||
internal
|
internal
|
||||||
Sys_Open_Color_Picker_Sig(system_open_color_picker){
|
Sys_Open_Color_Picker_Sig(system_open_color_picker){
|
||||||
|
// TODO(allen): review
|
||||||
// NOTE(casey): Because this is going to be used by a semi-permanent thread, we need to copy
|
// NOTE(casey): Because this is going to be used by a semi-permanent thread, we need to copy
|
||||||
// it to system memory where it can live as long as it wants, no matter what we do over here
|
// it to system memory where it can live as long as it wants, no matter what we do over here
|
||||||
// on the 4coder threads.
|
// on the 4coder threads.
|
||||||
color_picker *perm = (color_picker *)system_memory_allocate_extended(0, sizeof(color_picker));
|
Color_Picker *perm = (Color_Picker*)system_memory_allocate_extended(0, sizeof(Color_Picker));
|
||||||
*perm = *picker;
|
*perm = *picker;
|
||||||
|
|
||||||
HANDLE ThreadHandle = CreateThread(0, 0, color_picker_thread, perm, 0, 0);
|
HANDLE ThreadHandle = CreateThread(0, 0, color_picker_thread, perm, 0, 0);
|
||||||
|
|
Loading…
Reference in New Issue