mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-11 20:11:26 -07:00
auto-close universal ctx menus when entities/tabs invalidate; some visual fixes
This commit is contained in:
+23
-3
@@ -3141,6 +3141,16 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
|
||||
//- rjf: auto-close entity ctx menu
|
||||
if(ui_ctx_menu_is_open(ws->entity_ctx_menu_key))
|
||||
{
|
||||
DF_Entity *entity = df_entity_from_handle(ws->entity_ctx_menu_entity);
|
||||
if(df_entity_is_nil(entity))
|
||||
{
|
||||
ui_ctx_menu_close();
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: entity menu
|
||||
UI_CtxMenu(ws->entity_ctx_menu_key) UI_PrefWidth(ui_em(30.f, 1.f))
|
||||
{
|
||||
@@ -3654,6 +3664,16 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: auto-close tab ctx menu
|
||||
if(ui_ctx_menu_is_open(ws->tab_ctx_menu_key))
|
||||
{
|
||||
DF_View *tab = df_view_from_handle(ws->tab_ctx_menu_view);
|
||||
if(df_view_is_nil(tab))
|
||||
{
|
||||
ui_ctx_menu_close();
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: tab menu
|
||||
UI_CtxMenu(ws->tab_ctx_menu_key) UI_PrefWidth(ui_em(25.f, 1.f)) UI_CornerRadius(0)
|
||||
{
|
||||
@@ -10225,13 +10245,13 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
S64 column = cursor->column;
|
||||
Vec2F32 advance = f_dim_from_tag_size_string(line_box->font, line_box->font_size, str8_prefix(line_string, column-1));
|
||||
F32 cursor_off_pixels = advance.x;
|
||||
F32 cursor_thickness = Max(params->font_size*0.3f, 4.f);
|
||||
F32 cursor_thickness = ClampBot(4.f, line_box->font_size/6.f);
|
||||
Rng2F32 cursor_rect =
|
||||
{
|
||||
ui_box_text_position(line_box).x+cursor_off_pixels,
|
||||
line_box->rect.y0-params->font_size*0.55f,
|
||||
line_box->rect.y0-params->font_size*0.25f,
|
||||
ui_box_text_position(line_box).x+cursor_off_pixels+cursor_thickness,
|
||||
line_box->rect.y1+params->font_size*0.55f,
|
||||
line_box->rect.y1+params->font_size*0.25f,
|
||||
};
|
||||
Vec4F32 color = is_focused ? ui_top_text_cursor_color() : df_rgba_from_theme_color(DF_ThemeColor_FailureBackground);
|
||||
d_rect(cursor_rect, color, 1.f, 0, 1.f);
|
||||
|
||||
@@ -1183,7 +1183,8 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW
|
||||
//- rjf: draw start of cache lines in expansions
|
||||
if((row->eval.mode == EVAL_EvalMode_Addr || row->eval.mode == EVAL_EvalMode_NULL) &&
|
||||
row->eval.errors.count == 0 &&
|
||||
row->eval.offset%64 == 0 && row->depth > 0)
|
||||
row->eval.offset%64 == 0 && row->depth > 0 &&
|
||||
!row_expanded)
|
||||
{
|
||||
ui_set_next_fixed_x(0);
|
||||
ui_set_next_fixed_y(0);
|
||||
|
||||
@@ -141,18 +141,19 @@ internal UI_BOX_CUSTOM_DRAW(ui_line_edit_draw)
|
||||
TxtPt mark = draw_data->mark;
|
||||
F32 cursor_pixel_off = f_dim_from_tag_size_string(font, font_size, str8_prefix(edited_string, cursor.column-1)).x + font_size/8.f;
|
||||
F32 mark_pixel_off = f_dim_from_tag_size_string(font, font_size, str8_prefix(edited_string, mark.column-1)).x + font_size/8.f;
|
||||
F32 cursor_thickness = ClampBot(4.f, font_size/6.f);
|
||||
Rng2F32 cursor_rect =
|
||||
{
|
||||
text_position.x-ClampBot(2.f, font_size/4.f) + cursor_pixel_off,
|
||||
text_position.x-cursor_thickness*0.40f + cursor_pixel_off,
|
||||
box->rect.y0+4.f,
|
||||
text_position.x+ClampBot(2.f, font_size/4.f) + cursor_pixel_off,
|
||||
text_position.x+cursor_thickness*0.60f + cursor_pixel_off,
|
||||
box->rect.y1-4.f,
|
||||
};
|
||||
Rng2F32 mark_rect =
|
||||
{
|
||||
text_position.x-2.f + mark_pixel_off,
|
||||
text_position.x-cursor_thickness*0.40f + mark_pixel_off,
|
||||
box->rect.y0+2.f,
|
||||
text_position.x+2.f + mark_pixel_off,
|
||||
text_position.x+cursor_thickness*0.60f + mark_pixel_off,
|
||||
box->rect.y1-2.f,
|
||||
};
|
||||
Rng2F32 select_rect = union_2f32(cursor_rect, mark_rect);
|
||||
|
||||
Reference in New Issue
Block a user