mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
checkpoint on palettes, fix source view overlay margin building/drawing
This commit is contained in:
+103
-77
@@ -3450,8 +3450,16 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
icon_info.icon_kind_text_map[UI_IconKind_CheckFilled] = df_g_icon_kind_text_table[DF_IconKind_CheckFilled];
|
||||
}
|
||||
|
||||
// rjf: build widget palette info
|
||||
UI_WidgetPaletteInfo widget_palette_info = {0};
|
||||
{
|
||||
widget_palette_info.tooltip_palette = df_palette_from_code(DF_PaletteCode_Floating);
|
||||
widget_palette_info.ctx_menu_palette = df_palette_from_code(DF_PaletteCode_Floating);
|
||||
widget_palette_info.scrollbar_palette = df_palette_from_code(DF_PaletteCode_ScrollBarButton);
|
||||
}
|
||||
|
||||
// rjf: begin & push initial stack values
|
||||
ui_begin_build(ws->os, &events, &icon_info, df_dt(), df_dt());
|
||||
ui_begin_build(ws->os, &events, &icon_info, &widget_palette_info, df_dt(), df_dt());
|
||||
ui_push_font(main_font);
|
||||
ui_push_font_size(main_font_size);
|
||||
ui_push_pref_width(ui_em(20.f, 1));
|
||||
@@ -10570,6 +10578,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
UI_Palette *margin_palette = df_palette_from_code(DF_PaletteCode_Floating);
|
||||
UI_Palette *margin_contents_palette = ui_build_palette(df_palette_from_code(DF_PaletteCode_Floating));
|
||||
margin_contents_palette->background = v4f32(0, 0, 0, 0);
|
||||
F32 line_num_padding_px = ui_top_font_size()*1.f;
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: build top-level container
|
||||
@@ -10700,7 +10709,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
ui_set_next_pref_width(ui_px(params->priority_margin_width_px, 1));
|
||||
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
|
||||
ui_build_box_from_key(0, ui_key_zero());
|
||||
ui_set_next_fixed_x(params->margin_float_off_px);
|
||||
ui_set_next_fixed_x(floor_f32(params->margin_float_off_px));
|
||||
}
|
||||
ui_set_next_pref_width(ui_px(params->priority_margin_width_px, 1));
|
||||
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
|
||||
@@ -10862,7 +10871,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
ui_set_next_pref_width(ui_px(params->catchall_margin_width_px, 1));
|
||||
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
|
||||
ui_build_box_from_key(0, ui_key_zero());
|
||||
ui_set_next_fixed_x(params->margin_float_off_px + params->priority_margin_width_px);
|
||||
ui_set_next_fixed_x(floor_f32(params->margin_float_off_px + params->priority_margin_width_px));
|
||||
}
|
||||
ui_set_next_pref_width(ui_px(params->catchall_margin_width_px, 1));
|
||||
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
|
||||
@@ -11186,6 +11195,92 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: build line numbers
|
||||
//
|
||||
if(params->flags & DF_CodeSliceFlag_LineNums) UI_Parent(top_container_box) ProfScope("build line numbers") UI_Focus(UI_FocusKind_Off)
|
||||
{
|
||||
TxtRng select_rng = txt_rng(*cursor, *mark);
|
||||
Vec4F32 active_color = df_rgba_from_theme_color(DF_ThemeColor_CodeLineNumbersSelected);
|
||||
Vec4F32 inactive_color = df_rgba_from_theme_color(DF_ThemeColor_CodeLineNumbers);
|
||||
ui_set_next_fixed_x(floor_f32(params->margin_float_off_px + params->priority_margin_width_px + params->catchall_margin_width_px));
|
||||
ui_set_next_pref_width(ui_px(params->line_num_width_px, 1.f));
|
||||
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
|
||||
ui_set_next_flags(UI_BoxFlag_DrawSideLeft|UI_BoxFlag_DrawSideRight);
|
||||
UI_Column
|
||||
UI_PrefHeight(ui_px(params->line_height_px, 1.f))
|
||||
UI_Font(params->font)
|
||||
UI_FontSize(params->font_size)
|
||||
UI_CornerRadius(0)
|
||||
{
|
||||
U64 line_idx = 0;
|
||||
for(S64 line_num = params->line_num_range.min;
|
||||
line_num <= params->line_num_range.max;
|
||||
line_num += 1, line_idx += 1)
|
||||
{
|
||||
Vec4F32 text_color = (select_rng.min.line <= line_num && line_num <= select_rng.max.line) ? active_color : inactive_color;
|
||||
Vec4F32 bg_color = v4f32(0, 0, 0, 0);
|
||||
|
||||
// rjf: line info on this line -> adjust bg color to visualize
|
||||
B32 has_line_info = 0;
|
||||
{
|
||||
S64 line_info_line_num = 0;
|
||||
F32 line_info_t = 0;
|
||||
DF_TextLineSrc2DasmInfoList *src2dasm_list = ¶ms->line_src2dasm[line_idx];
|
||||
DF_TextLineDasm2SrcInfoList *dasm2src_list = ¶ms->line_dasm2src[line_idx];
|
||||
if(src2dasm_list->first != 0)
|
||||
{
|
||||
has_line_info = (src2dasm_list->first->v.remap_line == line_num);
|
||||
line_info_line_num = line_num;
|
||||
line_info_t = selected_thread_module->alive_t;
|
||||
}
|
||||
if(dasm2src_list->first != 0)
|
||||
{
|
||||
DF_TextLineDasm2SrcInfo *dasm2src_info = 0;
|
||||
U64 best_stamp = 0;
|
||||
for(DF_TextLineDasm2SrcInfoNode *n = dasm2src_list->first; n != 0; n = n->next)
|
||||
{
|
||||
if(n->v.file->timestamp > best_stamp)
|
||||
{
|
||||
dasm2src_info = &n->v;
|
||||
best_stamp = n->v.file->timestamp;
|
||||
}
|
||||
}
|
||||
if(dasm2src_info != 0)
|
||||
{
|
||||
has_line_info = 1;
|
||||
line_info_line_num = dasm2src_info->pt.line;
|
||||
line_info_t = selected_thread_module->alive_t;
|
||||
}
|
||||
}
|
||||
if(has_line_info)
|
||||
{
|
||||
Vec4F32 color = code_line_bgs[line_info_line_num % ArrayCount(code_line_bgs)];
|
||||
color.w *= line_info_t;
|
||||
bg_color = color;
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: build line num box
|
||||
ui_set_next_palette(ui_build_palette(ui_top_palette(), .text = text_color, .background = bg_color));
|
||||
ui_build_box_from_stringf(UI_BoxFlag_DrawText|(UI_BoxFlag_DrawBackground*!!has_line_info), "%I64u##line_num", line_num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: build background for line numbers & margins
|
||||
//
|
||||
{
|
||||
UI_Parent(top_container_box) DF_Palette(DF_PaletteCode_Floating)
|
||||
{
|
||||
ui_set_next_pref_width(ui_px(params->priority_margin_width_px + params->catchall_margin_width_px + params->line_num_width_px, 1));
|
||||
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
|
||||
ui_set_next_fixed_x(floor_f32(params->margin_float_off_px));
|
||||
ui_build_box_from_key(UI_BoxFlag_DrawBackgroundBlur|UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawDropShadow, ui_key_zero());
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: build main text container box, for mouse interaction on both lines & line numbers
|
||||
//
|
||||
@@ -11356,7 +11451,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
String8 line_string = (params->line_num_range.min <= line_num && line_num <= params->line_num_range.max) ? (params->line_text[mouse_y_line_idx]) : str8_zero();
|
||||
|
||||
// rjf: mouse x * string => column
|
||||
S64 column = f_char_pos_from_tag_size_string_p(params->font, params->font_size, 0, params->tab_size, line_string, mouse.x-text_container_box->rect.x0-params->line_num_width_px)+1;
|
||||
S64 column = f_char_pos_from_tag_size_string_p(params->font, params->font_size, 0, params->tab_size, line_string, mouse.x-text_container_box->rect.x0-params->line_num_width_px-line_num_padding_px)+1;
|
||||
|
||||
// rjf: bundle
|
||||
mouse_pt = txt_pt(line_num, column);
|
||||
@@ -11657,82 +11752,13 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: build line numbers
|
||||
//- rjf: build line numbers region (line number interaction should be basically identical to lines)
|
||||
//
|
||||
if(params->flags & DF_CodeSliceFlag_LineNums) UI_Parent(text_container_box) ProfScope("build line numbers") UI_Focus(UI_FocusKind_Off)
|
||||
if(params->flags & DF_CodeSliceFlag_LineNums) UI_Parent(text_container_box) ProfScope("build line number interaction box") UI_Focus(UI_FocusKind_Off)
|
||||
{
|
||||
TxtRng select_rng = txt_rng(*cursor, *mark);
|
||||
Vec4F32 active_color = df_rgba_from_theme_color(DF_ThemeColor_CodeLineNumbersSelected);
|
||||
Vec4F32 inactive_color = df_rgba_from_theme_color(DF_ThemeColor_CodeLineNumbers);
|
||||
if(params->margin_float_off_px != 0)
|
||||
{
|
||||
ui_set_next_pref_width(ui_px(params->line_num_width_px, 1.f));
|
||||
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
|
||||
ui_build_box_from_key(0, ui_key_zero());
|
||||
ui_set_next_fixed_x(params->margin_float_off_px);
|
||||
}
|
||||
ui_set_next_flags(UI_BoxFlag_DrawSideRight|UI_BoxFlag_DrawSideLeft);
|
||||
ui_set_next_pref_width(ui_px(params->line_num_width_px, 1.f));
|
||||
ui_set_next_pref_width(ui_px(params->line_num_width_px + line_num_padding_px, 1.f));
|
||||
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
|
||||
UI_Column
|
||||
UI_PrefHeight(ui_px(params->line_height_px, 1.f))
|
||||
UI_Font(params->font)
|
||||
UI_FontSize(params->font_size)
|
||||
UI_CornerRadius(0)
|
||||
{
|
||||
U64 line_idx = 0;
|
||||
for(S64 line_num = params->line_num_range.min;
|
||||
line_num <= params->line_num_range.max;
|
||||
line_num += 1, line_idx += 1)
|
||||
{
|
||||
Vec4F32 text_color = (select_rng.min.line <= line_num && line_num <= select_rng.max.line) ? active_color : inactive_color;
|
||||
Vec4F32 bg_color = v4f32(0, 0, 0, 0);
|
||||
|
||||
// rjf: line info on this line -> adjust bg color to visualize
|
||||
B32 has_line_info = 0;
|
||||
{
|
||||
S64 line_info_line_num = 0;
|
||||
F32 line_info_t = 0;
|
||||
DF_TextLineSrc2DasmInfoList *src2dasm_list = ¶ms->line_src2dasm[line_idx];
|
||||
DF_TextLineDasm2SrcInfoList *dasm2src_list = ¶ms->line_dasm2src[line_idx];
|
||||
if(src2dasm_list->first != 0)
|
||||
{
|
||||
has_line_info = (src2dasm_list->first->v.remap_line == line_num);
|
||||
line_info_line_num = line_num;
|
||||
line_info_t = selected_thread_module->alive_t;
|
||||
}
|
||||
if(dasm2src_list->first != 0)
|
||||
{
|
||||
DF_TextLineDasm2SrcInfo *dasm2src_info = 0;
|
||||
U64 best_stamp = 0;
|
||||
for(DF_TextLineDasm2SrcInfoNode *n = dasm2src_list->first; n != 0; n = n->next)
|
||||
{
|
||||
if(n->v.file->timestamp > best_stamp)
|
||||
{
|
||||
dasm2src_info = &n->v;
|
||||
best_stamp = n->v.file->timestamp;
|
||||
}
|
||||
}
|
||||
if(dasm2src_info != 0)
|
||||
{
|
||||
has_line_info = 1;
|
||||
line_info_line_num = dasm2src_info->pt.line;
|
||||
line_info_t = selected_thread_module->alive_t;
|
||||
}
|
||||
}
|
||||
if(has_line_info)
|
||||
{
|
||||
Vec4F32 color = code_line_bgs[line_info_line_num % ArrayCount(code_line_bgs)];
|
||||
color.w *= line_info_t;
|
||||
bg_color = color;
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: build line num box
|
||||
ui_set_next_palette(ui_build_palette(ui_top_palette(), .text = text_color, .background = bg_color));
|
||||
ui_build_box_from_stringf(UI_BoxFlag_DrawText|(UI_BoxFlag_DrawBackground*!!has_line_info), "%I64u##line_num", line_num);
|
||||
}
|
||||
}
|
||||
ui_build_box_from_key(0, ui_key_zero());
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
|
||||
+1
-19
@@ -5883,10 +5883,6 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
code_slice_params.line_text_max_width_px = (F32)line_size_x;
|
||||
code_slice_params.flash_ranges = df_push_entity_child_list_with_kind(scratch.arena, entity, DF_EntityKind_FlashMarker);
|
||||
code_slice_params.margin_float_off_px = view->scroll_pos.x.idx + view->scroll_pos.x.off;
|
||||
if(code_slice_params.margin_float_off_px < 1)
|
||||
{
|
||||
code_slice_params.margin_float_off_px = 0;
|
||||
}
|
||||
|
||||
// rjf: fill text info
|
||||
{
|
||||
@@ -6440,7 +6436,6 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
ui_set_next_fixed_y(code_area_dim.y);
|
||||
ui_set_next_fixed_width(panel_box_dim.x - scroll_bar_dim);
|
||||
ui_set_next_fixed_height(scroll_bar_dim);
|
||||
DF_Palette(DF_PaletteCode_ScrollBarButton)
|
||||
{
|
||||
view->scroll_pos.x = ui_scroll_bar(Axis2_X,
|
||||
ui_px(scroll_bar_dim, 1.f),
|
||||
@@ -6459,7 +6454,6 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
ui_set_next_fixed_y(0);
|
||||
ui_set_next_fixed_width(scroll_bar_dim);
|
||||
ui_set_next_fixed_height(panel_box_dim.y - bottom_bar_dim.y - scroll_bar_dim);
|
||||
DF_Palette(DF_PaletteCode_ScrollBarButton)
|
||||
{
|
||||
view->scroll_pos.y = ui_scroll_bar(Axis2_Y,
|
||||
ui_px(scroll_bar_dim, 1.f),
|
||||
@@ -6977,10 +6971,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
|
||||
code_slice_params.line_text_max_width_px = (F32)line_size_x;
|
||||
code_slice_params.flash_ranges = df_push_entity_child_list_with_kind(scratch.arena, process, DF_EntityKind_FlashMarker);
|
||||
code_slice_params.margin_float_off_px = view->scroll_pos.x.idx + view->scroll_pos.x.off;
|
||||
if(code_slice_params.margin_float_off_px < 1)
|
||||
{
|
||||
code_slice_params.margin_float_off_px = 0;
|
||||
}
|
||||
|
||||
di_key_list_push(scratch.arena, &code_slice_params.relevant_dbgi_keys, &dbgi_key);
|
||||
|
||||
// rjf: fill text info
|
||||
@@ -7341,7 +7332,6 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
|
||||
ui_set_next_fixed_y(code_area_dim.y);
|
||||
ui_set_next_fixed_width(panel_box_dim.x - scroll_bar_dim);
|
||||
ui_set_next_fixed_height(scroll_bar_dim);
|
||||
DF_Palette(DF_PaletteCode_ScrollBarButton)
|
||||
{
|
||||
view->scroll_pos.x = ui_scroll_bar(Axis2_X,
|
||||
ui_px(scroll_bar_dim, 1.f),
|
||||
@@ -7360,7 +7350,6 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
|
||||
ui_set_next_fixed_y(0);
|
||||
ui_set_next_fixed_width(scroll_bar_dim);
|
||||
ui_set_next_fixed_height(panel_box_dim.y - bottom_bar_dim.y - scroll_bar_dim);
|
||||
DF_Palette(DF_PaletteCode_ScrollBarButton)
|
||||
{
|
||||
view->scroll_pos.y = ui_scroll_bar(Axis2_Y,
|
||||
ui_px(scroll_bar_dim, 1.f),
|
||||
@@ -7822,10 +7811,6 @@ DF_VIEW_UI_FUNCTION_DEF(Output)
|
||||
code_slice_params.line_text_max_width_px = (F32)line_size_x;
|
||||
code_slice_params.flash_ranges = df_push_entity_child_list_with_kind(scratch.arena, entity, DF_EntityKind_FlashMarker);
|
||||
code_slice_params.margin_float_off_px = view->scroll_pos.x.idx + view->scroll_pos.x.off;
|
||||
if(code_slice_params.margin_float_off_px < 1)
|
||||
{
|
||||
code_slice_params.margin_float_off_px = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
@@ -8144,7 +8129,6 @@ DF_VIEW_UI_FUNCTION_DEF(Output)
|
||||
ui_set_next_fixed_y(code_area_dim.y);
|
||||
ui_set_next_fixed_width(panel_box_dim.x - scroll_bar_dim);
|
||||
ui_set_next_fixed_height(scroll_bar_dim);
|
||||
DF_Palette(DF_PaletteCode_ScrollBarButton)
|
||||
{
|
||||
view->scroll_pos.x = ui_scroll_bar(Axis2_X,
|
||||
ui_px(scroll_bar_dim, 1.f),
|
||||
@@ -8163,7 +8147,6 @@ DF_VIEW_UI_FUNCTION_DEF(Output)
|
||||
ui_set_next_fixed_y(0);
|
||||
ui_set_next_fixed_width(scroll_bar_dim);
|
||||
ui_set_next_fixed_height(panel_box_dim.y - bottom_bar_dim.y - scroll_bar_dim);
|
||||
DF_Palette(DF_PaletteCode_ScrollBarButton)
|
||||
{
|
||||
view->scroll_pos.y = ui_scroll_bar(Axis2_Y,
|
||||
ui_px(scroll_bar_dim, 1.f),
|
||||
@@ -8730,7 +8713,6 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
ui_set_next_fixed_y(content_rect.y0);
|
||||
ui_set_next_fixed_width(scroll_bar_dim);
|
||||
ui_set_next_fixed_height(dim_2f32(content_rect).y);
|
||||
DF_Palette(DF_PaletteCode_ScrollBarButton)
|
||||
{
|
||||
view->scroll_pos.y = ui_scroll_bar(Axis2_Y,
|
||||
ui_px(scroll_bar_dim, 1.f),
|
||||
|
||||
@@ -312,6 +312,7 @@ d_blur(Rng2F32 rect, F32 blur_size, F32 corner_radius)
|
||||
R_Pass *pass = r_pass_from_kind(arena, &bucket->passes, R_PassKind_Blur);
|
||||
R_PassParams_Blur *params = pass->params_blur;
|
||||
params->rect = rect;
|
||||
params->clip = d_top_clip();
|
||||
params->blur_size = blur_size;
|
||||
params->corner_radii[Corner_00] = corner_radius;
|
||||
params->corner_radii[Corner_01] = corner_radius;
|
||||
|
||||
@@ -1335,6 +1335,36 @@ r_window_submit(OS_Handle window, R_Handle window_equip, R_PassList *passes)
|
||||
{ sizeof(R_D3D11_Uniforms_BlurPass) / 16, sizeof(uniforms.kernel) / 16 },
|
||||
};
|
||||
|
||||
// rjf: setup scissor rect
|
||||
{
|
||||
Rng2F32 clip = params->clip;
|
||||
D3D11_RECT rect = {0};
|
||||
{
|
||||
if(clip.x0 == 0 && clip.y0 == 0 && clip.x1 == 0 && clip.y1 == 0)
|
||||
{
|
||||
rect.left = 0;
|
||||
rect.right = (LONG)wnd->last_resolution.x;
|
||||
rect.top = 0;
|
||||
rect.bottom = (LONG)wnd->last_resolution.y;
|
||||
}
|
||||
else if(clip.x0 > clip.x1 || clip.y0 > clip.y1)
|
||||
{
|
||||
rect.left = 0;
|
||||
rect.right = 0;
|
||||
rect.top = 0;
|
||||
rect.bottom = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
rect.left = (LONG)clip.x0;
|
||||
rect.right = (LONG)clip.x1;
|
||||
rect.top = (LONG)clip.y0;
|
||||
rect.bottom = (LONG)clip.y1;
|
||||
}
|
||||
}
|
||||
d_ctx->lpVtbl->RSSetScissorRects(d_ctx, 1, &rect);
|
||||
}
|
||||
|
||||
// rjf: for unsetting srv
|
||||
ID3D11ShaderResourceView* srv = 0;
|
||||
|
||||
|
||||
@@ -151,6 +151,7 @@ typedef struct R_PassParams_Blur R_PassParams_Blur;
|
||||
struct R_PassParams_Blur
|
||||
{
|
||||
Rng2F32 rect;
|
||||
Rng2F32 clip;
|
||||
F32 blur_size;
|
||||
F32 corner_radii[Corner_COUNT];
|
||||
};
|
||||
|
||||
@@ -4,16 +4,6 @@
|
||||
////////////////////////////////
|
||||
//~ rjf: Basic Widgets
|
||||
|
||||
internal UI_Signal
|
||||
ui_spacer(UI_Size size)
|
||||
{
|
||||
UI_Box *parent = ui_top_parent();
|
||||
ui_set_next_pref_size(parent->child_layout_axis, size);
|
||||
UI_Box *box = ui_build_box_from_key(0, ui_key_zero());
|
||||
UI_Signal interact = ui_signal_from_box(box);
|
||||
return interact;
|
||||
}
|
||||
|
||||
internal void
|
||||
ui_divider(UI_Size size)
|
||||
{
|
||||
@@ -1190,6 +1180,8 @@ ui_scroll_list_item_from_row(UI_ScrollListRowBlockArray *blocks, U64 row)
|
||||
internal UI_ScrollPt
|
||||
ui_scroll_bar(Axis2 axis, UI_Size off_axis_size, UI_ScrollPt pt, Rng1S64 idx_range, S64 view_num_indices)
|
||||
{
|
||||
ui_push_palette(ui_state->widget_palette_info.scrollbar_palette);
|
||||
|
||||
//- rjf: unpack
|
||||
S64 idx_range_dim = Max(dim_1s64(idx_range), 1);
|
||||
|
||||
@@ -1307,6 +1299,8 @@ ui_scroll_bar(Axis2 axis, UI_Size off_axis_size, UI_ScrollPt pt, Rng1S64 idx_ran
|
||||
ui_scroll_pt_target_idx(&new_pt, new_idx);
|
||||
}
|
||||
}
|
||||
|
||||
ui_pop_palette();
|
||||
return new_pt;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,6 @@ struct UI_ScrollListSignal
|
||||
////////////////////////////////
|
||||
//~ rjf: Basic Widgets
|
||||
|
||||
internal UI_Signal ui_spacer(UI_Size size);
|
||||
internal void ui_divider(UI_Size size);
|
||||
internal UI_Signal ui_label(String8 string);
|
||||
internal UI_Signal ui_labelf(char *fmt, ...);
|
||||
|
||||
+24
-3
@@ -720,7 +720,7 @@ ui_box_from_key(UI_Key key)
|
||||
//~ rjf: Top-Level Building API
|
||||
|
||||
internal void
|
||||
ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, F32 real_dt, F32 animation_dt)
|
||||
ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, UI_WidgetPaletteInfo *widget_palette_info, F32 real_dt, F32 animation_dt)
|
||||
{
|
||||
//- rjf: reset per-build ui state
|
||||
{
|
||||
@@ -758,6 +758,7 @@ ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, F
|
||||
{
|
||||
ui_state->icon_info.icon_kind_text_map[icon_kind] = push_str8_copy(ui_build_arena(), icon_info->icon_kind_text_map[icon_kind]);
|
||||
}
|
||||
MemoryCopyStruct(&ui_state->widget_palette_info, widget_palette_info);
|
||||
}
|
||||
|
||||
//- rjf: do default navigation
|
||||
@@ -1724,11 +1725,11 @@ ui_layout_position__in_place_rec(UI_Box *root, Axis2 axis)
|
||||
{
|
||||
child->fixed_position_animated = child->fixed_position;
|
||||
}
|
||||
child->rect.p0.v[axis] = root->rect.p0.v[axis] + child->fixed_position_animated.v[axis] - !(child->flags&(UI_BoxFlag_SkipViewOffX<<axis))*root->view_off.v[axis];
|
||||
child->rect.p0.v[axis] = root->rect.p0.v[axis] + child->fixed_position_animated.v[axis] - !(child->flags&(UI_BoxFlag_SkipViewOffX<<axis))*floor_f32(root->view_off.v[axis]);
|
||||
}
|
||||
else
|
||||
{
|
||||
child->rect.p0.v[axis] = root->rect.p0.v[axis] + child->fixed_position.v[axis] - !(child->flags&(UI_BoxFlag_SkipViewOffX<<axis))*root->view_off.v[axis];
|
||||
child->rect.p0.v[axis] = root->rect.p0.v[axis] + child->fixed_position.v[axis] - !(child->flags&(UI_BoxFlag_SkipViewOffX<<axis))*floor_f32(root->view_off.v[axis]);
|
||||
}
|
||||
child->rect.p1.v[axis] = child->rect.p0.v[axis] + child->fixed_size.v[axis];
|
||||
child->rect.p0.x = floorf(child->rect.p0.x);
|
||||
@@ -1772,6 +1773,18 @@ ui_layout_root(UI_Box *root, Axis2 axis)
|
||||
////////////////////////////////
|
||||
//~ rjf: Box Building API
|
||||
|
||||
//- rjf: spacers
|
||||
|
||||
internal UI_Signal
|
||||
ui_spacer(UI_Size size)
|
||||
{
|
||||
UI_Box *parent = ui_top_parent();
|
||||
ui_set_next_pref_size(parent->child_layout_axis, size);
|
||||
UI_Box *box = ui_build_box_from_key(0, ui_key_zero());
|
||||
UI_Signal interact = ui_signal_from_box(box);
|
||||
return interact;
|
||||
}
|
||||
|
||||
//- rjf: tooltips
|
||||
|
||||
internal void
|
||||
@@ -1781,11 +1794,15 @@ ui_tooltip_begin_base(void)
|
||||
ui_push_parent(ui_root_from_state(ui_state));
|
||||
ui_push_parent(ui_state->tooltip_root);
|
||||
ui_push_flags(0);
|
||||
ui_push_run_flags(0);
|
||||
ui_push_palette(ui_bottom_palette());
|
||||
}
|
||||
|
||||
internal void
|
||||
ui_tooltip_end_base(void)
|
||||
{
|
||||
ui_pop_palette();
|
||||
ui_pop_run_flags();
|
||||
ui_pop_flags();
|
||||
ui_pop_parent();
|
||||
ui_pop_parent();
|
||||
@@ -1795,6 +1812,7 @@ internal void
|
||||
ui_tooltip_begin(void)
|
||||
{
|
||||
ui_tooltip_begin_base();
|
||||
ui_push_palette(ui_state->widget_palette_info.tooltip_palette);
|
||||
ui_set_next_squish(0.25f-ui_state->tooltip_open_t*0.25f);
|
||||
ui_set_next_transparency(1-ui_state->tooltip_open_t);
|
||||
UI_Flags(UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawBackgroundBlur|UI_BoxFlag_DrawDropShadow)
|
||||
@@ -1826,6 +1844,7 @@ ui_tooltip_end(void)
|
||||
ui_row_end();
|
||||
UI_PrefWidth(ui_px(0, 1)) ui_spacer(ui_em(1.f, 1.f));
|
||||
ui_column_end();
|
||||
ui_pop_palette();
|
||||
ui_tooltip_end_base();
|
||||
}
|
||||
|
||||
@@ -1863,6 +1882,7 @@ ui_begin_ctx_menu(UI_Key key)
|
||||
ui_push_pref_height(ui_bottom_pref_height());
|
||||
ui_push_focus_hot(UI_FocusKind_Root);
|
||||
ui_push_focus_active(UI_FocusKind_Root);
|
||||
ui_push_palette(ui_state->widget_palette_info.ctx_menu_palette);
|
||||
B32 is_open = ui_key_match(key, ui_state->ctx_menu_key) && ui_state->ctx_menu_open;
|
||||
if(is_open != 0)
|
||||
{
|
||||
@@ -1891,6 +1911,7 @@ ui_end_ctx_menu(void)
|
||||
ui_state->is_in_open_ctx_menu = 0;
|
||||
ui_spacer(ui_em(1.f, 1.f));
|
||||
}
|
||||
ui_pop_palette();
|
||||
ui_pop_focus_active();
|
||||
ui_pop_focus_hot();
|
||||
ui_pop_pref_width();
|
||||
|
||||
+14
-2
@@ -196,7 +196,7 @@ struct UI_Size
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Color Schemes
|
||||
//~ rjf: Palettes
|
||||
|
||||
typedef enum UI_ColorCode
|
||||
{
|
||||
@@ -232,6 +232,14 @@ struct UI_Palette
|
||||
};
|
||||
};
|
||||
|
||||
typedef struct UI_WidgetPaletteInfo UI_WidgetPaletteInfo;
|
||||
struct UI_WidgetPaletteInfo
|
||||
{
|
||||
UI_Palette *tooltip_palette;
|
||||
UI_Palette *ctx_menu_palette;
|
||||
UI_Palette *scrollbar_palette;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Scroll Positions
|
||||
|
||||
@@ -565,6 +573,7 @@ struct UI_State
|
||||
|
||||
//- rjf: build parameters
|
||||
UI_IconInfo icon_info;
|
||||
UI_WidgetPaletteInfo widget_palette_info;
|
||||
OS_Handle window;
|
||||
UI_EventList *events;
|
||||
Vec2F32 mouse;
|
||||
@@ -729,7 +738,7 @@ internal UI_Box * ui_box_from_key(UI_Key key);
|
||||
////////////////////////////////
|
||||
//~ rjf: Top-Level Building API
|
||||
|
||||
internal void ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, F32 real_dt, F32 animation_dt);
|
||||
internal void ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, UI_WidgetPaletteInfo *widget_palette_info, F32 real_dt, F32 animation_dt);
|
||||
internal void ui_end_build(void);
|
||||
internal void ui_calc_sizes_standalone__in_place_rec(UI_Box *root, Axis2 axis);
|
||||
internal void ui_calc_sizes_upwards_dependent__in_place_rec(UI_Box *root, Axis2 axis);
|
||||
@@ -741,6 +750,9 @@ internal void ui_layout_root(UI_Box *root, Axis2 axis);
|
||||
////////////////////////////////
|
||||
//~ rjf: Box Tree Building API
|
||||
|
||||
//- rjf: spacers
|
||||
internal UI_Signal ui_spacer(UI_Size size);
|
||||
|
||||
//- rjf: tooltips
|
||||
internal void ui_tooltip_begin_base(void);
|
||||
internal void ui_tooltip_end_base(void);
|
||||
|
||||
Reference in New Issue
Block a user