finished renaming things
This commit is contained in:
12
src/edit.c
12
src/edit.c
@@ -11,7 +11,7 @@ void TimEditState_init(TimEditState* e, i32 capacity, cstr initial_content){
|
||||
e->s[byte_len] = 0;
|
||||
}
|
||||
|
||||
void edit_insert(TimEditState* e, cstr s) {
|
||||
void TimEditState_insert(TimEditState* e, cstr s) {
|
||||
i32 dst_size = tim_ztrlen(e->s);
|
||||
i32 src_size = tim_ztrlen(s);
|
||||
if (dst_size + src_size < e->capacity) {
|
||||
@@ -25,7 +25,7 @@ void edit_insert(TimEditState* e, cstr s) {
|
||||
}
|
||||
}
|
||||
|
||||
void edit_delete(TimEditState* e) {
|
||||
void TimEditState_delete(TimEditState* e) {
|
||||
i32 size = tim_ztrlen(e->s);
|
||||
i32 cur = tim_utf8_pos(e->s, e->cursor);
|
||||
i32 len = tim_utf8_pos(e->s + cur, 1);
|
||||
@@ -55,12 +55,12 @@ static i32 edit_event(TimEditState* e, TimRect r) {
|
||||
tim->focus = 0; // release focus
|
||||
break;
|
||||
case TimKey_Delete:
|
||||
edit_delete(e);
|
||||
TimEditState_delete(e);
|
||||
break;
|
||||
case TimKey_Backspace:
|
||||
if (e->cursor > 0) {
|
||||
e->cursor -= 1;
|
||||
edit_delete(e);
|
||||
TimEditState_delete(e);
|
||||
}
|
||||
break;
|
||||
case TimKey_Left:
|
||||
@@ -77,7 +77,7 @@ static i32 edit_event(TimEditState* e, TimRect r) {
|
||||
break;
|
||||
default:
|
||||
if (tim->event.key >= ' ') {
|
||||
edit_insert(e, tim->event.s);
|
||||
TimEditState_insert(e, tim->event.s);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ static i32 edit_event(TimEditState* e, TimRect r) {
|
||||
return tim->event.key;
|
||||
}
|
||||
|
||||
i32 edit(TimEditState* e, i32 x, i32 y, i32 w, u64 color) {
|
||||
i32 tim_edit(TimEditState* e, i32 x, i32 y, i32 w, u64 color) {
|
||||
TimRect r = tim_scope_rect_to_absolute(x, y, w, 3);
|
||||
|
||||
if (tim->event.type == TimEvent_Draw) {
|
||||
|
||||
@@ -68,7 +68,7 @@ bool parse_input(event* restrict e, i32 n) {
|
||||
if (n == 1 || s[0] != 27) {
|
||||
// regular key press
|
||||
e->type = TimEvent_Key;
|
||||
e->key = s[0] == 127 ? TimKey_Backspace : tim_utf8_to_i32(s);
|
||||
e->key = s[0] == 127 ? TimKey_Backspace : tim_utf8_to_i32(s);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ bool parse_input(event* restrict e, i32 n) {
|
||||
for (i32 i = 0; i < (i32)ARRAY_SIZE(key_table); i++) {
|
||||
if (!memcmp(s + 1, key_table[i].s, n - 1)) {
|
||||
e->type = TimEvent_Key;
|
||||
e->key = key_table[i].k;
|
||||
e->key = key_table[i].k;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ void tim_frame(i32 x, i32 y, i32 w, i32 h, u64 color) {
|
||||
}
|
||||
}
|
||||
|
||||
void label(cstr s, i32 x, i32 y, i32 w, i32 h, u64 color) {
|
||||
void tim_label(cstr s, i32 x, i32 y, i32 w, i32 h, u64 color) {
|
||||
if (tim->event.type == TimEvent_Draw) {
|
||||
TimText t = tim_scan_str(s);
|
||||
w = (w == A) ? t.width : w;
|
||||
@@ -22,7 +22,7 @@ void label(cstr s, i32 x, i32 y, i32 w, i32 h, u64 color) {
|
||||
}
|
||||
}
|
||||
|
||||
bool button(cstr txt, i32 x, i32 y, i32 w, i32 h, u64 color) {
|
||||
bool tim_button(cstr txt, i32 x, i32 y, i32 w, i32 h, u64 color) {
|
||||
i32 tw = tim_utf8_len(txt);
|
||||
w = (w == A) ? (tw + 4) : w;
|
||||
h = (h == A) ? 3 : h;
|
||||
@@ -35,7 +35,7 @@ bool button(cstr txt, i32 x, i32 y, i32 w, i32 h, u64 color) {
|
||||
return tim_is_mouse_click_over(r);
|
||||
}
|
||||
|
||||
bool check(cstr txt, i32* state, i32 x, i32 y, i32 w, u64 color) {
|
||||
bool tim_checkbox(cstr txt, i32* state, i32 x, i32 y, i32 w, u64 color) {
|
||||
w = (w == A) ? tim_utf8_len(txt) + 4 : w;
|
||||
TimRect r = tim_scope_rect_to_absolute(x, y, w, 1);
|
||||
|
||||
@@ -52,7 +52,7 @@ bool check(cstr txt, i32* state, i32 x, i32 y, i32 w, u64 color) {
|
||||
}
|
||||
|
||||
|
||||
bool radio(cstr txt, i32* state, i32 v, i32 x, i32 y, i32 w, u64 color) {
|
||||
bool tim_radiobutton(cstr txt, i32* state, i32 v, i32 x, i32 y, i32 w, u64 color) {
|
||||
w = (w == A) ? tim_utf8_len(txt) + 4 : w;
|
||||
TimRect r = tim_scope_rect_to_absolute(x, y, w, 1);
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ void tim_read_event(i32 timeout_ms) {
|
||||
}
|
||||
tim_update_screen_size(); // workaround, see WINDOW_BUFFER_SIZE_EVENT
|
||||
e->type = TimEvent_Mouse;
|
||||
e->key = TimKey_MouseButtonLeft;
|
||||
e->key = TimKey_MouseButtonLeft;
|
||||
e->x = rec.Event.MouseEvent.dwMousePosition.X - tim->window.Left;
|
||||
e->y = rec.Event.MouseEvent.dwMousePosition.Y - tim->window.Top;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user