mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-21 13:55:43 +00:00
first pass of watch window macros; fix active-but-disabled line edit rendering; other minor fixes
This commit is contained in:
@@ -174,6 +174,8 @@ ui_line_edit(TxtPt *cursor, TxtPt *mark, U8 *edit_buffer, U64 edit_buffer_size,
|
||||
ui_push_focus_active(is_auto_focus_active ? UI_FocusKind_On : UI_FocusKind_Null);
|
||||
B32 is_focus_hot = ui_is_focus_hot();
|
||||
B32 is_focus_active = ui_is_focus_active();
|
||||
B32 is_focus_hot_disabled = (!is_focus_hot && ui_top_focus_hot() == UI_FocusKind_On);
|
||||
B32 is_focus_active_disabled = (!is_focus_active && ui_top_focus_active() == UI_FocusKind_On);
|
||||
|
||||
//- rjf: build top-level box
|
||||
ui_set_next_hover_cursor(is_focus_active ? OS_Cursor_IBar : OS_Cursor_HandPoint);
|
||||
@@ -183,7 +185,7 @@ ui_line_edit(TxtPt *cursor, TxtPt *mark, U8 *edit_buffer, U64 edit_buffer_size,
|
||||
UI_BoxFlag_ClickToFocus|
|
||||
((is_auto_focus_hot || is_auto_focus_active)*UI_BoxFlag_KeyboardClickable)|
|
||||
UI_BoxFlag_DrawHotEffects|
|
||||
is_focus_active*(UI_BoxFlag_Clip|UI_BoxFlag_AllowOverflowX|UI_BoxFlag_ViewClamp),
|
||||
(is_focus_active || is_focus_active_disabled)*(UI_BoxFlag_Clip|UI_BoxFlag_AllowOverflowX|UI_BoxFlag_ViewClamp),
|
||||
key);
|
||||
|
||||
//- rjf: take navigation actions for editing
|
||||
@@ -240,7 +242,7 @@ ui_line_edit(TxtPt *cursor, TxtPt *mark, U8 *edit_buffer, U64 edit_buffer_size,
|
||||
UI_Parent(box)
|
||||
{
|
||||
String8 edit_string = str8(edit_buffer, edit_string_size_out[0]);
|
||||
if(!is_focus_active)
|
||||
if(!is_focus_active && !is_focus_active_disabled)
|
||||
{
|
||||
String8 display_string = ui_display_part_from_key_string(string);
|
||||
if(pre_edit_value.size != 0)
|
||||
|
||||
+16
-11
@@ -1159,6 +1159,7 @@ ui_end_build(void)
|
||||
box->first_touched_build_index == box->first_disabled_build_index);
|
||||
B32 is_focus_hot = !!(box->flags & UI_BoxFlag_FocusHot) && !(box->flags & UI_BoxFlag_FocusHotDisabled);
|
||||
B32 is_focus_active = !!(box->flags & UI_BoxFlag_FocusActive) && !(box->flags & UI_BoxFlag_FocusActiveDisabled);
|
||||
B32 is_focus_active_disabled = !!(box->flags & UI_BoxFlag_FocusActiveDisabled);
|
||||
|
||||
// rjf: determine rates
|
||||
F32 hot_rate = fast_rate;
|
||||
@@ -1173,15 +1174,16 @@ ui_end_build(void)
|
||||
box_is_animating = (box_is_animating || abs_f32((F32)is_disabled - box->disabled_t) > 0.01f);
|
||||
box_is_animating = (box_is_animating || abs_f32((F32)is_focus_hot - box->focus_hot_t) > 0.01f);
|
||||
box_is_animating = (box_is_animating || abs_f32((F32)is_focus_active - box->focus_active_t) > 0.01f);
|
||||
box_is_animating = (box_is_animating || abs_f32((F32)is_focus_active_disabled - box->focus_active_disabled_t) > 0.01f);
|
||||
box_is_animating = (box_is_animating || abs_f32(box->view_off_target.x - box->view_off.x) > 0.5f);
|
||||
box_is_animating = (box_is_animating || abs_f32(box->view_off_target.y - box->view_off.y) > 0.5f);
|
||||
if(box->flags & UI_BoxFlag_AnimatePosX)
|
||||
{
|
||||
box_is_animating = (box_is_animating || fabsf(box->fixed_position_animated.x - box->fixed_position.x) > 0.5f);
|
||||
box_is_animating = (box_is_animating || abs_f32(box->fixed_position_animated.x - box->fixed_position.x) > 0.5f);
|
||||
}
|
||||
if(box->flags & UI_BoxFlag_AnimatePosY)
|
||||
{
|
||||
box_is_animating = (box_is_animating || fabsf(box->fixed_position_animated.y - box->fixed_position.y) > 0.5f);
|
||||
box_is_animating = (box_is_animating || abs_f32(box->fixed_position_animated.y - box->fixed_position.y) > 0.5f);
|
||||
}
|
||||
ui_state->is_animating = (ui_state->is_animating || box_is_animating);
|
||||
#if 0 // NOTE(rjf): enable to debug animation-causing-frames (or not)
|
||||
@@ -1193,21 +1195,22 @@ ui_end_build(void)
|
||||
#endif
|
||||
|
||||
// rjf: animate interaction transition states
|
||||
box->hot_t += hot_rate * ((F32)is_hot - box->hot_t);
|
||||
box->active_t += active_rate * ((F32)is_active - box->active_t);
|
||||
box->disabled_t += disabled_rate * ((F32)is_disabled - box->disabled_t);
|
||||
box->focus_hot_t += focus_rate * ((F32)is_focus_hot - box->focus_hot_t);
|
||||
box->focus_active_t += focus_rate * ((F32)is_focus_active - box->focus_active_t);
|
||||
box->hot_t += hot_rate * ((F32)is_hot - box->hot_t);
|
||||
box->active_t += active_rate * ((F32)is_active - box->active_t);
|
||||
box->disabled_t += disabled_rate * ((F32)is_disabled - box->disabled_t);
|
||||
box->focus_hot_t += focus_rate * ((F32)is_focus_hot - box->focus_hot_t);
|
||||
box->focus_active_t += focus_rate * ((F32)is_focus_active - box->focus_active_t);
|
||||
box->focus_active_disabled_t += focus_rate * ((F32)is_focus_active_disabled - box->focus_active_disabled_t);
|
||||
|
||||
// rjf: animate positions
|
||||
{
|
||||
box->fixed_position_animated.x += fast_rate * (box->fixed_position.x - box->fixed_position_animated.x);
|
||||
box->fixed_position_animated.y += fast_rate * (box->fixed_position.y - box->fixed_position_animated.y);
|
||||
if(fabsf(box->fixed_position.x - box->fixed_position_animated.x) < 1)
|
||||
if(abs_f32(box->fixed_position.x - box->fixed_position_animated.x) < 1)
|
||||
{
|
||||
box->fixed_position_animated.x = box->fixed_position.x;
|
||||
}
|
||||
if(fabsf(box->fixed_position.y - box->fixed_position_animated.y) < 1)
|
||||
if(abs_f32(box->fixed_position.y - box->fixed_position_animated.y) < 1)
|
||||
{
|
||||
box->fixed_position_animated.y = box->fixed_position.y;
|
||||
}
|
||||
@@ -1229,11 +1232,11 @@ ui_end_build(void)
|
||||
{
|
||||
box->view_off.x += fast_rate * (box->view_off_target.x - box->view_off.x);
|
||||
box->view_off.y += fast_rate * (box->view_off_target.y - box->view_off.y);
|
||||
if(fabsf(box->view_off.x - box->view_off_target.x) < 2)
|
||||
if(abs_f32(box->view_off.x - box->view_off_target.x) < 2)
|
||||
{
|
||||
box->view_off.x = box->view_off_target.x;
|
||||
}
|
||||
if(fabsf(box->view_off.y - box->view_off_target.y) < 2)
|
||||
if(abs_f32(box->view_off.y - box->view_off_target.y) < 2)
|
||||
{
|
||||
box->view_off.y = box->view_off_target.y;
|
||||
}
|
||||
@@ -1310,6 +1313,8 @@ ui_end_build(void)
|
||||
}
|
||||
|
||||
//- rjf: hovering possibly-truncated drawn text -> store text
|
||||
if(ui_key_match(ui_key_zero(), ui_state->active_box_key[Side_Min]) &&
|
||||
ui_key_match(ui_key_zero(), ui_state->active_box_key[Side_Max]))
|
||||
{
|
||||
B32 found = 0;
|
||||
for(UI_Box *box = ui_state->root, *next = 0; !ui_box_is_nil(box); box = next)
|
||||
|
||||
@@ -306,6 +306,7 @@ struct UI_Box
|
||||
F32 disabled_t;
|
||||
F32 focus_hot_t;
|
||||
F32 focus_active_t;
|
||||
F32 focus_active_disabled_t;
|
||||
Vec2F32 view_off;
|
||||
Vec2F32 view_off_target;
|
||||
Vec2F32 view_bounds;
|
||||
|
||||
Reference in New Issue
Block a user