auto tabs

This commit is contained in:
Ryan Fleury
2025-02-20 10:04:48 -08:00
parent 1a84f1cedd
commit 6653a0e437
5 changed files with 62 additions and 20 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ load_paths =
commands =
{
//- rjf: fkey command slots (change locally but do not commit)
.f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.f1 = { .win = "raddbg_stable --ipc kill_all && build no_meta raddbg telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.f2 = { .win = "build rdi_from_pdb", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.f3 = { .win = "raddbg_stable --ipc run", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f3 = { .win = "pushd build && raddbg.exe --user:local_dev.raddbg_user --project:local_dev.raddbg_project --xuto_run && popd",.linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
+1 -1
View File
@@ -813,7 +813,7 @@ str8_lit_comp("far_manager"),
String8 rd_theme_preset_cfg_string_table[9] =
{
str8_lit_comp("theme:\n{\n background: 0x1b1b1bff,\n alt: background: 0x222222ff,\n pop: background: 0x355b6eff,\n fresh: background: 0x31393dff,\n match: background: 0x31393dff,\n border: 0x404040ff,\n text: 0xe5e5e5ff,\n weak: text: 0xa4a4a4ff,\n good: text: 0x32a852ff,\n bad: text: 0xcf5242ff,\n hover: 0xffffffff,\n focus: 0xfda200ff,\n cursor: 0x8aff00ff,\n selection: 0x99ccffff,\n inactive: background: 0x0000002f,\n drop_shadow: 0x0000007f,\n\n good_pop:\n {\n background: 0x2c5b36ff,\n border: 0x568761ff,\n hover: 0xe3f5d3ff,\n weak: text: 0xe3f5d3ff,\n }\n\n bad_pop:\n {\n background: 0x803425ff,\n hover: 0xff825cff,\n }\n\n code_default: 0xcbcbcbff,\n code_symbol: 0x42a2cfff,\n code_type: 0xfec746ff,\n code_local: 0x98bc80ff,\n code_register: 0xb7afd5ff,\n code_keyword: 0xb38d4cff,\n code_delimiter_or_operator: 0x767676ff,\n code_numeric: 0x98abb1ff,\n code_numeric_alt_digit_group: 0x738287ff,\n code_string: 0x98abb1ff,\n code_meta: 0xd96759ff,\n code_comment: 0x717171ff,\n line_info_0: 0x633112ff,\n line_info_1: 0x754e1aff,\n line_info_2: 0x75721aff,\n line_info_3: 0x48751bff,\n line_info_4: 0x732112ff,\n line_info_5: 0x754e1aff,\n line_info_6: 0x75721aff,\n line_info_7: 0x48751bff,\n thread_0: 0xffcb7fff,\n thread_1: 0xb2ff65ff,\n thread_2: 0xff99e5ff,\n thread_3: 0x6598ffff,\n thread_4: 0x65ffcbff,\n thread_5: 0xff9819ff,\n thread_6: 0x9932ffff,\n thread_7: 0x65ff4cff,\n thread_unwound: 0xb2ccd8ff,\n thread_error: 0xb23219ff,\n breakpoint: 0xa72911ff,\n\n floating:\n {\n background: 0x1b1b1baf,\n background: alt: 0x0000005f,\n background: fresh: 0x31393d5f,\n border: 0xbfbfbf1f,\n scroll_bar:\n {\n background: 0x3b3b3b5f,\n border: 0x5f5f5f5f,\n }\n }\n\n menu_bar:\n {\n background: 0x2b3740ff,\n border: 0x3e4c57ff,\n }\n\n scroll_bar:\n {\n background: 0x2b2b2bff,\n border: 0x3f3f3fff,\n }\n\n implicit:\n {\n background: 0x00000000,\n border: 0x00000000,\n }\n\n hollow:\n {\n background: 0x00000000,\n border: 0xffffff1f,\n }\n\n tab:\n {\n background: 0x6f5135ff,\n border: 0x8a6e54ff,\n inactive:\n {\n background: 0x2b3740ff,\n border: 0x3e4c57ff,\n }\n }\n\n drop_site:\n {\n background: 0xffffff05,\n border: 0xffffff0f,\n }\n}\n"),
str8_lit_comp("theme:\n{\n background: 0x1b1b1bff,\n alt: background: 0x222222ff,\n pop: background: 0x355b6eff,\n fresh: background: 0x31393dff,\n match: background: 0x31393dff,\n border: 0x404040ff,\n text: 0xe5e5e5ff,\n weak: text: 0xa4a4a4ff,\n good: text: 0x32a852ff,\n bad: text: 0xcf5242ff,\n hover: 0xffffffff,\n focus: 0xfda200ff,\n cursor: 0x8aff00ff,\n selection: 0x99ccffff,\n inactive: background: 0x0000002f,\n drop_shadow: 0x0000007f,\n\n good_pop:\n {\n background: 0x2c5b36ff,\n border: 0x568761ff,\n hover: 0xe3f5d3ff,\n weak: text: 0xe3f5d3ff,\n }\n\n bad_pop:\n {\n background: 0x803425ff,\n hover: 0xff825cff,\n }\n\n code_default: 0xcbcbcbff,\n code_symbol: 0x42a2cfff,\n code_type: 0xfec746ff,\n code_local: 0x98bc80ff,\n code_register: 0xb7afd5ff,\n code_keyword: 0xb38d4cff,\n code_delimiter_or_operator: 0x767676ff,\n code_numeric: 0x98abb1ff,\n code_numeric_alt_digit_group: 0x738287ff,\n code_string: 0x98abb1ff,\n code_meta: 0xd96759ff,\n code_comment: 0x717171ff,\n line_info_0: 0x633112ff,\n line_info_1: 0x754e1aff,\n line_info_2: 0x75721aff,\n line_info_3: 0x48751bff,\n line_info_4: 0x732112ff,\n line_info_5: 0x754e1aff,\n line_info_6: 0x75721aff,\n line_info_7: 0x48751bff,\n thread_0: 0xffcb7fff,\n thread_1: 0xb2ff65ff,\n thread_2: 0xff99e5ff,\n thread_3: 0x6598ffff,\n thread_4: 0x65ffcbff,\n thread_5: 0xff9819ff,\n thread_6: 0x9932ffff,\n thread_7: 0x65ff4cff,\n thread_unwound: 0xb2ccd8ff,\n thread_error: 0xb23219ff,\n breakpoint: 0xa72911ff,\n\n floating:\n {\n background: 0x1b1b1baf,\n background: alt: 0x0000005f,\n background: fresh: 0x31393d5f,\n border: 0xbfbfbf1f,\n scroll_bar:\n {\n background: 0x3b3b3b5f,\n border: 0x5f5f5f5f,\n }\n }\n\n menu_bar:\n {\n background: 0x2b3740ff,\n border: 0x3e4c57ff,\n }\n\n scroll_bar:\n {\n background: 0x2b2b2bff,\n border: 0x3f3f3fff,\n }\n\n implicit:\n {\n background: 0x00000000,\n border: 0x00000000,\n }\n\n hollow:\n {\n background: 0x00000000,\n border: 0xffffff1f,\n }\n\n tab:\n {\n background: 0x6f5135ff,\n border: 0x8a6e54ff,\n inactive:\n {\n background: 0x2b3740ff,\n border: 0x3e4c57ff,\n }\n auto:\n {\n background: 0x693847ff,\n border: 0x9e6274ff,\n inactive:\n {\n background: 0x442f4dff,\n border: 0x685073ff,\n }\n }\n }\n\n drop_site:\n {\n background: 0xffffff05,\n border: 0xffffff0f,\n }\n}\n"),
str8_lit_comp(""),
str8_lit_comp(""),
str8_lit_comp(""),
+10
View File
@@ -1112,6 +1112,16 @@ RD_ThemePresetTable:
background: 0x2b3740ff,
border: 0x3e4c57ff,
}
auto:
{
background: 0x693847ff,
border: 0x9e6274ff,
inactive:
{
background: 0x442f4dff,
border: 0x685073ff,
}
}
}
drop_site:
+49 -18
View File
@@ -6051,7 +6051,7 @@ rd_window_frame(void)
//
ProfScope("build hover eval")
{
B32 build_hover_eval = hover_eval_is_open;
B32 build_hover_eval = hover_eval_is_open && !rd_drag_is_active();
// rjf: disable hover eval if hovered view is actively scrolling
if(hover_eval_is_open)
@@ -7129,6 +7129,7 @@ rd_window_frame(void)
{
// rjf: gather info for this tab
B32 tab_is_selected = (tab == panel->selected_tab);
B32 tab_is_auto = (rd_cfg_child_from_string(tab, str8_lit("auto")) != &rd_nil_cfg);
// rjf: begin vertical region for this tab
ui_set_next_child_layout_axis(Axis2_Y);
@@ -7147,6 +7148,7 @@ rd_window_frame(void)
UI_PrefHeight(ui_px(tab_bar_vheight, 1))
UI_TagF(omit_name ? "hollow" : "")
UI_TagF(!tab_is_selected ? "inactive" : "")
UI_TagF(tab_is_auto ? "auto" : "")
{
if(panel->tab_side == Side_Max)
{
@@ -7930,7 +7932,7 @@ rd_window_frame(void)
color.w *= ws->error_t;
Rng2F32 rect = os_client_rect_from_window(ws->os);
dr_rect(pad_2f32(rect, 24.f), color, 0, 16.f, 12.f);
dr_rect(rect, v4f32(color.x, color.y, color.z, color.w*0.05f), 0, 0, 0);
dr_rect(rect, v4f32(color.x, color.y, color.z, color.w*0.025f), 0, 0, 0);
}
scratch_end(scratch);
@@ -11877,7 +11879,7 @@ rd_frame(void)
RD_Cfg *recent_project = &rd_nil_cfg;
for(RD_CfgNode *n = recent_projects.first; n != 0; n = n->next)
{
if(path_match_normalized(n->v->string, file_path))
if(path_match_normalized(rd_path_from_cfg(n->v), file_path))
{
recent_project = n->v;
break;
@@ -12817,11 +12819,11 @@ rd_frame(void)
{
String8 path = path_normalized_from_string(scratch.arena, rd_regs()->file_path);
RD_Cfg *project = rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("project"));
RD_CfgList recent_files = rd_cfg_child_list_from_string(scratch.arena, project, str8_lit("recent_files"));
RD_CfgList recent_files = rd_cfg_child_list_from_string(scratch.arena, project, str8_lit("recent_file"));
RD_Cfg *recent_file = &rd_nil_cfg;
for(RD_CfgNode *n = recent_files.first; n != 0; n = n->next)
{
if(path_match_normalized(n->v->string, path))
if(path_match_normalized(rd_path_from_cfg(n->v), path))
{
recent_file = n->v;
break;
@@ -12835,7 +12837,7 @@ rd_frame(void)
}
rd_cfg_unhook(project, recent_file);
rd_cfg_insert_child(project, &rd_nil_cfg, recent_file);
recent_files = rd_cfg_child_list_from_string(scratch.arena, project, str8_lit("recent_files"));
recent_files = rd_cfg_child_list_from_string(scratch.arena, project, str8_lit("recent_file"));
if(recent_files.count > 256)
{
rd_cfg_release(recent_files.last->v);
@@ -13412,24 +13414,45 @@ Z(getting_started)
{
RD_Cfg *tab = tab_n->v;
if(rd_cfg_is_project_filtered(tab)) { continue; }
RD_RegsScope(.view = tab->id)
String8 tab_expr = rd_expr_from_cfg(tab);
String8 tab_file_path = rd_file_path_from_eval_string(scratch.arena, tab_expr);
if((str8_match(tab->string, str8_lit("text"), 0) || str8_match(tab->string, str8_lit("pending"), 0)) &&
path_match_normalized(tab_file_path, file_path))
{
String8 tab_expr = rd_expr_from_cfg(tab);
String8 tab_file_path = rd_file_path_from_eval_string(scratch.arena, tab_expr);
if((str8_match(tab->string, str8_lit("text"), 0) || str8_match(tab->string, str8_lit("pending"), 0)) &&
path_match_normalized(tab_file_path, file_path))
panel_w_this_src_code = panel;
view_w_this_src_code = tab;
if(tab == panel->selected_tab)
{
panel_w_this_src_code = panel;
view_w_this_src_code = tab;
if(tab == panel->selected_tab)
{
break;
}
break;
}
}
}
}
// rjf: try to find panel/view pair that has any *auto* source code tab open
RD_PanelNode *panel_w_auto = &rd_nil_panel_node;
RD_Cfg *view_w_auto = &rd_nil_cfg;
for(RD_PanelNode *panel = panel_tree.root;
panel != &rd_nil_panel_node;
panel = rd_panel_node_rec__depth_first_pre(panel_tree.root, panel).next)
{
if(panel->first != &rd_nil_panel_node)
{
continue;
}
for(RD_CfgNode *tab_n = panel->tabs.first; tab_n != 0; tab_n = tab_n->next)
{
RD_Cfg *tab = tab_n->v;
if(rd_cfg_is_project_filtered(tab)) { continue; }
if(str8_match(tab->string, str8_lit("text"), 0) &&
rd_cfg_child_from_string(tab, str8_lit("auto")) != &rd_nil_cfg)
{
panel_w_auto = panel;
view_w_auto = tab;
}
}
}
// rjf: find a panel that already has *any* code open (prioritize largest)
RD_PanelNode *panel_w_any_src_code = &rd_nil_panel_node;
{
@@ -13565,6 +13588,7 @@ Z(getting_started)
if(file_path.size != 0)
{
if(src_code_dst_panel == &rd_nil_panel_node) { src_code_dst_panel = panel_w_this_src_code; }
if(src_code_dst_panel == &rd_nil_panel_node) { src_code_dst_panel = panel_w_auto; }
if(src_code_dst_panel == &rd_nil_panel_node) { src_code_dst_panel = panel_w_any_src_code; }
if(src_code_dst_panel == &rd_nil_panel_node) { src_code_dst_panel = biggest_empty_panel; }
if(src_code_dst_panel == &rd_nil_panel_node) { src_code_dst_panel = biggest_panel; }
@@ -13618,11 +13642,18 @@ Z(getting_started)
// rjf: construct new view if needed
RD_Cfg *dst_tab = view_w_this_src_code;
if(dst_panel != &rd_nil_panel_node && dst_tab == &rd_nil_cfg)
if(dst_tab == &rd_nil_cfg && dst_panel == panel_w_auto && view_w_auto != &rd_nil_cfg)
{
dst_tab = view_w_auto;
RD_Cfg *expr = rd_cfg_child_from_string_or_alloc(dst_tab, str8_lit("expression"));
rd_cfg_new_replace(expr, rd_eval_string_from_file_path(scratch.arena, file_path));
}
else if(dst_panel != &rd_nil_panel_node && dst_tab == &rd_nil_cfg)
{
dst_tab = rd_cfg_new(dst_panel->cfg, str8_lit("text"));
RD_Cfg *expr = rd_cfg_new(dst_tab, str8_lit("expression"));
rd_cfg_new(expr, rd_eval_string_from_file_path(scratch.arena, file_path));
rd_cfg_new(dst_tab, str8_lit("auto"));
}
// rjf: determine if we need a contain or center
+1
View File
@@ -2186,6 +2186,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
DR_BucketScope(bucket)
{
Vec4F32 color = line_drag_drop_color;
color.w *= 0.2f;
Rng2F32 drop_line_rect = r2f32p(top_container_box->rect.x0,
top_container_box->rect.y0 + (mouse_pt.line - params->line_num_range.min) * params->line_height_px,
top_container_box->rect.x1,