mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-03 20:38:40 +00:00
further progress on undo
This commit is contained in:
+77
-70
@@ -4462,7 +4462,11 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
{
|
||||
if(ui_clicked(df_icon_buttonf(ws, DF_IconKind_Trash, 0, "Remove Color###color_toggle")))
|
||||
{
|
||||
entity->flags &= ~DF_EntityFlag_HasColor;
|
||||
DF_StateDeltaHistoryBatch(df_state_delta_history())
|
||||
{
|
||||
df_state_delta_history_push_struct_delta(df_state_delta_history(), &entity->flags, .guard_entity = entity);
|
||||
entity->flags &= ~DF_EntityFlag_HasColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4470,7 +4474,10 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
}
|
||||
if(!entity_has_color && ui_clicked(df_icon_buttonf(ws, DF_IconKind_Palette, 0, "Apply Color###color_toggle")))
|
||||
{
|
||||
df_entity_equip_color_rgba(entity, v4f32(1, 1, 1, 1));
|
||||
DF_StateDeltaHistoryBatch(df_state_delta_history())
|
||||
{
|
||||
df_entity_equip_color_rgba(entity, v4f32(1, 1, 1, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12325,7 +12332,7 @@ df_code_slice(DF_Window *ws, DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *m
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!mapped_special && token->kind == TXT_TokenKind_Identifier)
|
||||
{
|
||||
U64 local_num = e_num_from_string(e_parse_ctx->locals_map, token_string);
|
||||
@@ -12335,7 +12342,7 @@ df_code_slice(DF_Window *ws, DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *m
|
||||
new_color_kind = DF_ThemeColor_CodeLocal;
|
||||
mix_t = selected_thread_module->alive_t;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!mapped_special && token->kind == TXT_TokenKind_Identifier)
|
||||
{
|
||||
U64 member_num = e_num_from_string(e_parse_ctx->member_map, token_string);
|
||||
@@ -12345,7 +12352,7 @@ df_code_slice(DF_Window *ws, DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *m
|
||||
new_color_kind = DF_ThemeColor_CodeLocal;
|
||||
mix_t = selected_thread_module->alive_t;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!mapped_special)
|
||||
{
|
||||
U64 reg_num = e_num_from_string(e_parse_ctx->regs_map, token_string);
|
||||
@@ -12742,71 +12749,71 @@ df_do_txt_controls(TXT_TextInfo *info, String8 data, U64 line_count_per_page, Tx
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: UI Widgets: Fancy Labels
|
||||
|
||||
internal UI_Signal
|
||||
df_label(String8 string)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
typedef U32 StringPartFlags;
|
||||
enum
|
||||
{
|
||||
StringPartFlag_Code = (1<<0),
|
||||
StringPartFlag_Underline = (1<<1),
|
||||
StringPartFlag_Bright = (1<<2),
|
||||
};
|
||||
typedef struct StringPart StringPart;
|
||||
struct StringPart
|
||||
{
|
||||
StringPart *next;
|
||||
StringPartFlags flags;
|
||||
String8 string;
|
||||
};
|
||||
StringPart *first_part = 0;
|
||||
StringPart *last_part = 0;
|
||||
U64 active_part_start_idx = 0;
|
||||
StringPartFlags active_part_flags = 0;
|
||||
for(U64 idx = 0; idx <= string.size; idx += 1)
|
||||
{
|
||||
if(idx == string.size)
|
||||
{
|
||||
StringPart *p = push_array(scratch.arena, StringPart, 1);
|
||||
p->flags = active_part_flags;
|
||||
p->string = str8_substr(string, r1u64(active_part_start_idx, idx));
|
||||
SLLQueuePush(first_part, last_part, p);
|
||||
}
|
||||
else if(string.str[idx] == '`')
|
||||
{
|
||||
StringPart *p = push_array(scratch.arena, StringPart, 1);
|
||||
p->flags = active_part_flags;
|
||||
p->string = str8_substr(string, r1u64(active_part_start_idx, idx));
|
||||
SLLQueuePush(first_part, last_part, p);
|
||||
active_part_start_idx = idx+1;
|
||||
active_part_flags ^= StringPartFlag_Code;
|
||||
}
|
||||
}
|
||||
D_FancyStringList fstrs = {0};
|
||||
for(StringPart *p = first_part; p != 0; p = p->next)
|
||||
{
|
||||
D_FancyString fstr = {0};
|
||||
{
|
||||
fstr.font = ui_top_font();
|
||||
fstr.string = p->string;
|
||||
fstr.color = ui_top_palette()->colors[UI_ColorCode_Text];
|
||||
fstr.size = ui_top_font_size();
|
||||
if(p->flags & StringPartFlag_Code)
|
||||
{
|
||||
fstr.font = df_font_from_slot(DF_FontSlot_Code);
|
||||
fstr.color = df_rgba_from_theme_color(DF_ThemeColor_CodeDefault);
|
||||
}
|
||||
}
|
||||
d_fancy_string_list_push(scratch.arena, &fstrs, &fstr);
|
||||
}
|
||||
UI_Box *box = ui_build_box_from_key(UI_BoxFlag_DrawText, ui_key_zero());
|
||||
ui_box_equip_display_fancy_strings(box, &fstrs);
|
||||
UI_Signal sig = ui_signal_from_box(box);
|
||||
scratch_end(scratch);
|
||||
return sig;
|
||||
}
|
||||
|
||||
internal UI_Signal
|
||||
df_label(String8 string)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
typedef U32 StringPartFlags;
|
||||
enum
|
||||
{
|
||||
StringPartFlag_Code = (1<<0),
|
||||
StringPartFlag_Underline = (1<<1),
|
||||
StringPartFlag_Bright = (1<<2),
|
||||
};
|
||||
typedef struct StringPart StringPart;
|
||||
struct StringPart
|
||||
{
|
||||
StringPart *next;
|
||||
StringPartFlags flags;
|
||||
String8 string;
|
||||
};
|
||||
StringPart *first_part = 0;
|
||||
StringPart *last_part = 0;
|
||||
U64 active_part_start_idx = 0;
|
||||
StringPartFlags active_part_flags = 0;
|
||||
for(U64 idx = 0; idx <= string.size; idx += 1)
|
||||
{
|
||||
if(idx == string.size)
|
||||
{
|
||||
StringPart *p = push_array(scratch.arena, StringPart, 1);
|
||||
p->flags = active_part_flags;
|
||||
p->string = str8_substr(string, r1u64(active_part_start_idx, idx));
|
||||
SLLQueuePush(first_part, last_part, p);
|
||||
}
|
||||
else if(string.str[idx] == '`')
|
||||
{
|
||||
StringPart *p = push_array(scratch.arena, StringPart, 1);
|
||||
p->flags = active_part_flags;
|
||||
p->string = str8_substr(string, r1u64(active_part_start_idx, idx));
|
||||
SLLQueuePush(first_part, last_part, p);
|
||||
active_part_start_idx = idx+1;
|
||||
active_part_flags ^= StringPartFlag_Code;
|
||||
}
|
||||
}
|
||||
D_FancyStringList fstrs = {0};
|
||||
for(StringPart *p = first_part; p != 0; p = p->next)
|
||||
{
|
||||
D_FancyString fstr = {0};
|
||||
{
|
||||
fstr.font = ui_top_font();
|
||||
fstr.string = p->string;
|
||||
fstr.color = ui_top_palette()->colors[UI_ColorCode_Text];
|
||||
fstr.size = ui_top_font_size();
|
||||
if(p->flags & StringPartFlag_Code)
|
||||
{
|
||||
fstr.font = df_font_from_slot(DF_FontSlot_Code);
|
||||
fstr.color = df_rgba_from_theme_color(DF_ThemeColor_CodeDefault);
|
||||
}
|
||||
}
|
||||
d_fancy_string_list_push(scratch.arena, &fstrs, &fstr);
|
||||
}
|
||||
UI_Box *box = ui_build_box_from_key(UI_BoxFlag_DrawText, ui_key_zero());
|
||||
ui_box_equip_display_fancy_strings(box, &fstrs);
|
||||
UI_Signal sig = ui_signal_from_box(box);
|
||||
scratch_end(scratch);
|
||||
return sig;
|
||||
}
|
||||
|
||||
internal UI_Signal
|
||||
df_error_label(String8 string)
|
||||
|
||||
@@ -1273,7 +1273,11 @@ df_watch_view_cmds(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewSt
|
||||
DF_Entity *existing_watch = df_entity_from_name_and_kind(cmd->params.string, DF_EntityKind_Watch);
|
||||
if(df_entity_is_nil(existing_watch))
|
||||
{
|
||||
DF_Entity *watch = df_entity_alloc(df_entity_root(), DF_EntityKind_Watch);
|
||||
DF_Entity *watch = &df_g_nil_entity;
|
||||
DF_StateDeltaHistoryBatch(df_state_delta_history())
|
||||
{
|
||||
watch = df_entity_alloc(df_entity_root(), DF_EntityKind_Watch);
|
||||
}
|
||||
df_entity_equip_cfg_src(watch, DF_CfgSrc_Project);
|
||||
df_entity_equip_name(watch, cmd->params.string);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user