mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-23 16:07:50 +00:00
first pass at new theme color table, scheme-based ui color specification
This commit is contained in:
@@ -17,12 +17,7 @@
|
||||
#define UI_FocusActive(v) DeferLoop(ui_push_focus_active(v), ui_pop_focus_active())
|
||||
#define UI_FastpathCodepoint(v) DeferLoop(ui_push_fastpath_codepoint(v), ui_pop_fastpath_codepoint())
|
||||
#define UI_Transparency(v) DeferLoop(ui_push_transparency(v), ui_pop_transparency())
|
||||
#define UI_BackgroundColor(v) DeferLoop(ui_push_background_color(v), ui_pop_background_color())
|
||||
#define UI_TextColor(v) DeferLoop(ui_push_text_color(v), ui_pop_text_color())
|
||||
#define UI_BorderColor(v) DeferLoop(ui_push_border_color(v), ui_pop_border_color())
|
||||
#define UI_OverlayColor(v) DeferLoop(ui_push_overlay_color(v), ui_pop_overlay_color())
|
||||
#define UI_TextSelectColor(v) DeferLoop(ui_push_text_select_color(v), ui_pop_text_select_color())
|
||||
#define UI_TextCursorColor(v) DeferLoop(ui_push_text_cursor_color(v), ui_pop_text_cursor_color())
|
||||
#define UI_Scheme(v) DeferLoop(ui_push_scheme(v), ui_pop_scheme())
|
||||
#define UI_Squish(v) DeferLoop(ui_push_squish(v), ui_pop_squish())
|
||||
#define UI_HoverCursor(v) DeferLoop(ui_push_hover_cursor(v), ui_pop_hover_cursor())
|
||||
#define UI_Font(v) DeferLoop(ui_push_font(v), ui_pop_font())
|
||||
@@ -49,12 +44,7 @@ internal UI_FocusKind ui_top_focus_hot(void) { UI_StackTopImpl(ui_state, FocusHo
|
||||
internal UI_FocusKind ui_top_focus_active(void) { UI_StackTopImpl(ui_state, FocusActive, focus_active) }
|
||||
internal U32 ui_top_fastpath_codepoint(void) { UI_StackTopImpl(ui_state, FastpathCodepoint, fastpath_codepoint) }
|
||||
internal F32 ui_top_transparency(void) { UI_StackTopImpl(ui_state, Transparency, transparency) }
|
||||
internal Vec4F32 ui_top_background_color(void) { UI_StackTopImpl(ui_state, BackgroundColor, background_color) }
|
||||
internal Vec4F32 ui_top_text_color(void) { UI_StackTopImpl(ui_state, TextColor, text_color) }
|
||||
internal Vec4F32 ui_top_border_color(void) { UI_StackTopImpl(ui_state, BorderColor, border_color) }
|
||||
internal Vec4F32 ui_top_overlay_color(void) { UI_StackTopImpl(ui_state, OverlayColor, overlay_color) }
|
||||
internal Vec4F32 ui_top_text_select_color(void) { UI_StackTopImpl(ui_state, TextSelectColor, text_select_color) }
|
||||
internal Vec4F32 ui_top_text_cursor_color(void) { UI_StackTopImpl(ui_state, TextCursorColor, text_cursor_color) }
|
||||
internal UI_ColorScheme* ui_top_scheme(void) { UI_StackTopImpl(ui_state, Scheme, scheme) }
|
||||
internal F32 ui_top_squish(void) { UI_StackTopImpl(ui_state, Squish, squish) }
|
||||
internal OS_Cursor ui_top_hover_cursor(void) { UI_StackTopImpl(ui_state, HoverCursor, hover_cursor) }
|
||||
internal F_Tag ui_top_font(void) { UI_StackTopImpl(ui_state, Font, font) }
|
||||
@@ -80,12 +70,7 @@ internal UI_FocusKind ui_bottom_focus_hot(void) { UI_StackBottomImpl(ui_state, F
|
||||
internal UI_FocusKind ui_bottom_focus_active(void) { UI_StackBottomImpl(ui_state, FocusActive, focus_active) }
|
||||
internal U32 ui_bottom_fastpath_codepoint(void) { UI_StackBottomImpl(ui_state, FastpathCodepoint, fastpath_codepoint) }
|
||||
internal F32 ui_bottom_transparency(void) { UI_StackBottomImpl(ui_state, Transparency, transparency) }
|
||||
internal Vec4F32 ui_bottom_background_color(void) { UI_StackBottomImpl(ui_state, BackgroundColor, background_color) }
|
||||
internal Vec4F32 ui_bottom_text_color(void) { UI_StackBottomImpl(ui_state, TextColor, text_color) }
|
||||
internal Vec4F32 ui_bottom_border_color(void) { UI_StackBottomImpl(ui_state, BorderColor, border_color) }
|
||||
internal Vec4F32 ui_bottom_overlay_color(void) { UI_StackBottomImpl(ui_state, OverlayColor, overlay_color) }
|
||||
internal Vec4F32 ui_bottom_text_select_color(void) { UI_StackBottomImpl(ui_state, TextSelectColor, text_select_color) }
|
||||
internal Vec4F32 ui_bottom_text_cursor_color(void) { UI_StackBottomImpl(ui_state, TextCursorColor, text_cursor_color) }
|
||||
internal UI_ColorScheme* ui_bottom_scheme(void) { UI_StackBottomImpl(ui_state, Scheme, scheme) }
|
||||
internal F32 ui_bottom_squish(void) { UI_StackBottomImpl(ui_state, Squish, squish) }
|
||||
internal OS_Cursor ui_bottom_hover_cursor(void) { UI_StackBottomImpl(ui_state, HoverCursor, hover_cursor) }
|
||||
internal F_Tag ui_bottom_font(void) { UI_StackBottomImpl(ui_state, Font, font) }
|
||||
@@ -111,12 +96,7 @@ internal UI_FocusKind ui_push_focus_hot(UI_FocusKind v) { UI_StackPushImpl(ui_st
|
||||
internal UI_FocusKind ui_push_focus_active(UI_FocusKind v) { UI_StackPushImpl(ui_state, FocusActive, focus_active, UI_FocusKind, v) }
|
||||
internal U32 ui_push_fastpath_codepoint(U32 v) { UI_StackPushImpl(ui_state, FastpathCodepoint, fastpath_codepoint, U32, v) }
|
||||
internal F32 ui_push_transparency(F32 v) { UI_StackPushImpl(ui_state, Transparency, transparency, F32, v) }
|
||||
internal Vec4F32 ui_push_background_color(Vec4F32 v) { UI_StackPushImpl(ui_state, BackgroundColor, background_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_push_text_color(Vec4F32 v) { UI_StackPushImpl(ui_state, TextColor, text_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_push_border_color(Vec4F32 v) { UI_StackPushImpl(ui_state, BorderColor, border_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_push_overlay_color(Vec4F32 v) { UI_StackPushImpl(ui_state, OverlayColor, overlay_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_push_text_select_color(Vec4F32 v) { UI_StackPushImpl(ui_state, TextSelectColor, text_select_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_push_text_cursor_color(Vec4F32 v) { UI_StackPushImpl(ui_state, TextCursorColor, text_cursor_color, Vec4F32, v) }
|
||||
internal UI_ColorScheme* ui_push_scheme(UI_ColorScheme* v) { UI_StackPushImpl(ui_state, Scheme, scheme, UI_ColorScheme*, v) }
|
||||
internal F32 ui_push_squish(F32 v) { UI_StackPushImpl(ui_state, Squish, squish, F32, v) }
|
||||
internal OS_Cursor ui_push_hover_cursor(OS_Cursor v) { UI_StackPushImpl(ui_state, HoverCursor, hover_cursor, OS_Cursor, v) }
|
||||
internal F_Tag ui_push_font(F_Tag v) { UI_StackPushImpl(ui_state, Font, font, F_Tag, v) }
|
||||
@@ -142,12 +122,7 @@ internal UI_FocusKind ui_pop_focus_hot(void) { UI_StackPopImpl(ui_state, FocusHo
|
||||
internal UI_FocusKind ui_pop_focus_active(void) { UI_StackPopImpl(ui_state, FocusActive, focus_active) }
|
||||
internal U32 ui_pop_fastpath_codepoint(void) { UI_StackPopImpl(ui_state, FastpathCodepoint, fastpath_codepoint) }
|
||||
internal F32 ui_pop_transparency(void) { UI_StackPopImpl(ui_state, Transparency, transparency) }
|
||||
internal Vec4F32 ui_pop_background_color(void) { UI_StackPopImpl(ui_state, BackgroundColor, background_color) }
|
||||
internal Vec4F32 ui_pop_text_color(void) { UI_StackPopImpl(ui_state, TextColor, text_color) }
|
||||
internal Vec4F32 ui_pop_border_color(void) { UI_StackPopImpl(ui_state, BorderColor, border_color) }
|
||||
internal Vec4F32 ui_pop_overlay_color(void) { UI_StackPopImpl(ui_state, OverlayColor, overlay_color) }
|
||||
internal Vec4F32 ui_pop_text_select_color(void) { UI_StackPopImpl(ui_state, TextSelectColor, text_select_color) }
|
||||
internal Vec4F32 ui_pop_text_cursor_color(void) { UI_StackPopImpl(ui_state, TextCursorColor, text_cursor_color) }
|
||||
internal UI_ColorScheme* ui_pop_scheme(void) { UI_StackPopImpl(ui_state, Scheme, scheme) }
|
||||
internal F32 ui_pop_squish(void) { UI_StackPopImpl(ui_state, Squish, squish) }
|
||||
internal OS_Cursor ui_pop_hover_cursor(void) { UI_StackPopImpl(ui_state, HoverCursor, hover_cursor) }
|
||||
internal F_Tag ui_pop_font(void) { UI_StackPopImpl(ui_state, Font, font) }
|
||||
@@ -173,12 +148,7 @@ internal UI_FocusKind ui_set_next_focus_hot(UI_FocusKind v) { UI_StackSetNextImp
|
||||
internal UI_FocusKind ui_set_next_focus_active(UI_FocusKind v) { UI_StackSetNextImpl(ui_state, FocusActive, focus_active, UI_FocusKind, v) }
|
||||
internal U32 ui_set_next_fastpath_codepoint(U32 v) { UI_StackSetNextImpl(ui_state, FastpathCodepoint, fastpath_codepoint, U32, v) }
|
||||
internal F32 ui_set_next_transparency(F32 v) { UI_StackSetNextImpl(ui_state, Transparency, transparency, F32, v) }
|
||||
internal Vec4F32 ui_set_next_background_color(Vec4F32 v) { UI_StackSetNextImpl(ui_state, BackgroundColor, background_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_set_next_text_color(Vec4F32 v) { UI_StackSetNextImpl(ui_state, TextColor, text_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_set_next_border_color(Vec4F32 v) { UI_StackSetNextImpl(ui_state, BorderColor, border_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_set_next_overlay_color(Vec4F32 v) { UI_StackSetNextImpl(ui_state, OverlayColor, overlay_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_set_next_text_select_color(Vec4F32 v) { UI_StackSetNextImpl(ui_state, TextSelectColor, text_select_color, Vec4F32, v) }
|
||||
internal Vec4F32 ui_set_next_text_cursor_color(Vec4F32 v) { UI_StackSetNextImpl(ui_state, TextCursorColor, text_cursor_color, Vec4F32, v) }
|
||||
internal UI_ColorScheme* ui_set_next_scheme(UI_ColorScheme* v) { UI_StackSetNextImpl(ui_state, Scheme, scheme, UI_ColorScheme*, v) }
|
||||
internal F32 ui_set_next_squish(F32 v) { UI_StackSetNextImpl(ui_state, Squish, squish, F32, v) }
|
||||
internal OS_Cursor ui_set_next_hover_cursor(OS_Cursor v) { UI_StackSetNextImpl(ui_state, HoverCursor, hover_cursor, OS_Cursor, v) }
|
||||
internal F_Tag ui_set_next_font(F_Tag v) { UI_StackSetNextImpl(ui_state, Font, font, F_Tag, v) }
|
||||
|
||||
+11
-66
@@ -19,12 +19,7 @@ typedef struct UI_FocusHotNode UI_FocusHotNode; struct UI_FocusHotNode{UI_FocusH
|
||||
typedef struct UI_FocusActiveNode UI_FocusActiveNode; struct UI_FocusActiveNode{UI_FocusActiveNode *next; UI_FocusKind v;};
|
||||
typedef struct UI_FastpathCodepointNode UI_FastpathCodepointNode; struct UI_FastpathCodepointNode{UI_FastpathCodepointNode *next; U32 v;};
|
||||
typedef struct UI_TransparencyNode UI_TransparencyNode; struct UI_TransparencyNode{UI_TransparencyNode *next; F32 v;};
|
||||
typedef struct UI_BackgroundColorNode UI_BackgroundColorNode; struct UI_BackgroundColorNode{UI_BackgroundColorNode *next; Vec4F32 v;};
|
||||
typedef struct UI_TextColorNode UI_TextColorNode; struct UI_TextColorNode{UI_TextColorNode *next; Vec4F32 v;};
|
||||
typedef struct UI_BorderColorNode UI_BorderColorNode; struct UI_BorderColorNode{UI_BorderColorNode *next; Vec4F32 v;};
|
||||
typedef struct UI_OverlayColorNode UI_OverlayColorNode; struct UI_OverlayColorNode{UI_OverlayColorNode *next; Vec4F32 v;};
|
||||
typedef struct UI_TextSelectColorNode UI_TextSelectColorNode; struct UI_TextSelectColorNode{UI_TextSelectColorNode *next; Vec4F32 v;};
|
||||
typedef struct UI_TextCursorColorNode UI_TextCursorColorNode; struct UI_TextCursorColorNode{UI_TextCursorColorNode *next; Vec4F32 v;};
|
||||
typedef struct UI_SchemeNode UI_SchemeNode; struct UI_SchemeNode{UI_SchemeNode *next; UI_ColorScheme* v;};
|
||||
typedef struct UI_SquishNode UI_SquishNode; struct UI_SquishNode{UI_SquishNode *next; F32 v;};
|
||||
typedef struct UI_HoverCursorNode UI_HoverCursorNode; struct UI_HoverCursorNode{UI_HoverCursorNode *next; OS_Cursor v;};
|
||||
typedef struct UI_FontNode UI_FontNode; struct UI_FontNode{UI_FontNode *next; F_Tag v;};
|
||||
@@ -53,12 +48,7 @@ UI_FocusHotNode focus_hot_nil_stack_top;\
|
||||
UI_FocusActiveNode focus_active_nil_stack_top;\
|
||||
UI_FastpathCodepointNode fastpath_codepoint_nil_stack_top;\
|
||||
UI_TransparencyNode transparency_nil_stack_top;\
|
||||
UI_BackgroundColorNode background_color_nil_stack_top;\
|
||||
UI_TextColorNode text_color_nil_stack_top;\
|
||||
UI_BorderColorNode border_color_nil_stack_top;\
|
||||
UI_OverlayColorNode overlay_color_nil_stack_top;\
|
||||
UI_TextSelectColorNode text_select_color_nil_stack_top;\
|
||||
UI_TextCursorColorNode text_cursor_color_nil_stack_top;\
|
||||
UI_SchemeNode scheme_nil_stack_top;\
|
||||
UI_SquishNode squish_nil_stack_top;\
|
||||
UI_HoverCursorNode hover_cursor_nil_stack_top;\
|
||||
UI_FontNode font_nil_stack_top;\
|
||||
@@ -86,12 +76,7 @@ state->focus_hot_nil_stack_top.v = UI_FocusKind_Null;\
|
||||
state->focus_active_nil_stack_top.v = UI_FocusKind_Null;\
|
||||
state->fastpath_codepoint_nil_stack_top.v = 0;\
|
||||
state->transparency_nil_stack_top.v = 0;\
|
||||
state->background_color_nil_stack_top.v = v4f32(1, 0, 1, 1);\
|
||||
state->text_color_nil_stack_top.v = v4f32(1, 0, 1, 1);\
|
||||
state->border_color_nil_stack_top.v = v4f32(1, 0, 1, 1);\
|
||||
state->overlay_color_nil_stack_top.v = v4f32(1, 0, 1, 1);\
|
||||
state->text_select_color_nil_stack_top.v = v4f32(1, 0, 1, 1);\
|
||||
state->text_cursor_color_nil_stack_top.v = v4f32(1, 0, 1, 1);\
|
||||
state->scheme_nil_stack_top.v = &ui_g_nil_color_scheme;\
|
||||
state->squish_nil_stack_top.v = 0;\
|
||||
state->hover_cursor_nil_stack_top.v = OS_Cursor_Pointer;\
|
||||
state->font_nil_stack_top.v = f_tag_zero();\
|
||||
@@ -121,12 +106,7 @@ struct { UI_FocusHotNode *top; UI_FocusKind bottom_val; UI_FocusHotNode *free; B
|
||||
struct { UI_FocusActiveNode *top; UI_FocusKind bottom_val; UI_FocusActiveNode *free; B32 auto_pop; } focus_active_stack;\
|
||||
struct { UI_FastpathCodepointNode *top; U32 bottom_val; UI_FastpathCodepointNode *free; B32 auto_pop; } fastpath_codepoint_stack;\
|
||||
struct { UI_TransparencyNode *top; F32 bottom_val; UI_TransparencyNode *free; B32 auto_pop; } transparency_stack;\
|
||||
struct { UI_BackgroundColorNode *top; Vec4F32 bottom_val; UI_BackgroundColorNode *free; B32 auto_pop; } background_color_stack;\
|
||||
struct { UI_TextColorNode *top; Vec4F32 bottom_val; UI_TextColorNode *free; B32 auto_pop; } text_color_stack;\
|
||||
struct { UI_BorderColorNode *top; Vec4F32 bottom_val; UI_BorderColorNode *free; B32 auto_pop; } border_color_stack;\
|
||||
struct { UI_OverlayColorNode *top; Vec4F32 bottom_val; UI_OverlayColorNode *free; B32 auto_pop; } overlay_color_stack;\
|
||||
struct { UI_TextSelectColorNode *top; Vec4F32 bottom_val; UI_TextSelectColorNode *free; B32 auto_pop; } text_select_color_stack;\
|
||||
struct { UI_TextCursorColorNode *top; Vec4F32 bottom_val; UI_TextCursorColorNode *free; B32 auto_pop; } text_cursor_color_stack;\
|
||||
struct { UI_SchemeNode *top; UI_ColorScheme* bottom_val; UI_SchemeNode *free; B32 auto_pop; } scheme_stack;\
|
||||
struct { UI_SquishNode *top; F32 bottom_val; UI_SquishNode *free; B32 auto_pop; } squish_stack;\
|
||||
struct { UI_HoverCursorNode *top; OS_Cursor bottom_val; UI_HoverCursorNode *free; B32 auto_pop; } hover_cursor_stack;\
|
||||
struct { UI_FontNode *top; F_Tag bottom_val; UI_FontNode *free; B32 auto_pop; } font_stack;\
|
||||
@@ -154,12 +134,7 @@ state->focus_hot_stack.top = &state->focus_hot_nil_stack_top; state->focus_hot_s
|
||||
state->focus_active_stack.top = &state->focus_active_nil_stack_top; state->focus_active_stack.bottom_val = UI_FocusKind_Null; state->focus_active_stack.free = 0; state->focus_active_stack.auto_pop = 0;\
|
||||
state->fastpath_codepoint_stack.top = &state->fastpath_codepoint_nil_stack_top; state->fastpath_codepoint_stack.bottom_val = 0; state->fastpath_codepoint_stack.free = 0; state->fastpath_codepoint_stack.auto_pop = 0;\
|
||||
state->transparency_stack.top = &state->transparency_nil_stack_top; state->transparency_stack.bottom_val = 0; state->transparency_stack.free = 0; state->transparency_stack.auto_pop = 0;\
|
||||
state->background_color_stack.top = &state->background_color_nil_stack_top; state->background_color_stack.bottom_val = v4f32(1, 0, 1, 1); state->background_color_stack.free = 0; state->background_color_stack.auto_pop = 0;\
|
||||
state->text_color_stack.top = &state->text_color_nil_stack_top; state->text_color_stack.bottom_val = v4f32(1, 0, 1, 1); state->text_color_stack.free = 0; state->text_color_stack.auto_pop = 0;\
|
||||
state->border_color_stack.top = &state->border_color_nil_stack_top; state->border_color_stack.bottom_val = v4f32(1, 0, 1, 1); state->border_color_stack.free = 0; state->border_color_stack.auto_pop = 0;\
|
||||
state->overlay_color_stack.top = &state->overlay_color_nil_stack_top; state->overlay_color_stack.bottom_val = v4f32(1, 0, 1, 1); state->overlay_color_stack.free = 0; state->overlay_color_stack.auto_pop = 0;\
|
||||
state->text_select_color_stack.top = &state->text_select_color_nil_stack_top; state->text_select_color_stack.bottom_val = v4f32(1, 0, 1, 1); state->text_select_color_stack.free = 0; state->text_select_color_stack.auto_pop = 0;\
|
||||
state->text_cursor_color_stack.top = &state->text_cursor_color_nil_stack_top; state->text_cursor_color_stack.bottom_val = v4f32(1, 0, 1, 1); state->text_cursor_color_stack.free = 0; state->text_cursor_color_stack.auto_pop = 0;\
|
||||
state->scheme_stack.top = &state->scheme_nil_stack_top; state->scheme_stack.bottom_val = &ui_g_nil_color_scheme; state->scheme_stack.free = 0; state->scheme_stack.auto_pop = 0;\
|
||||
state->squish_stack.top = &state->squish_nil_stack_top; state->squish_stack.bottom_val = 0; state->squish_stack.free = 0; state->squish_stack.auto_pop = 0;\
|
||||
state->hover_cursor_stack.top = &state->hover_cursor_nil_stack_top; state->hover_cursor_stack.bottom_val = OS_Cursor_Pointer; state->hover_cursor_stack.free = 0; state->hover_cursor_stack.auto_pop = 0;\
|
||||
state->font_stack.top = &state->font_nil_stack_top; state->font_stack.bottom_val = f_tag_zero(); state->font_stack.free = 0; state->font_stack.auto_pop = 0;\
|
||||
@@ -187,12 +162,7 @@ if(state->focus_hot_stack.auto_pop) { ui_pop_focus_hot(); state->focus_hot_stack
|
||||
if(state->focus_active_stack.auto_pop) { ui_pop_focus_active(); state->focus_active_stack.auto_pop = 0; }\
|
||||
if(state->fastpath_codepoint_stack.auto_pop) { ui_pop_fastpath_codepoint(); state->fastpath_codepoint_stack.auto_pop = 0; }\
|
||||
if(state->transparency_stack.auto_pop) { ui_pop_transparency(); state->transparency_stack.auto_pop = 0; }\
|
||||
if(state->background_color_stack.auto_pop) { ui_pop_background_color(); state->background_color_stack.auto_pop = 0; }\
|
||||
if(state->text_color_stack.auto_pop) { ui_pop_text_color(); state->text_color_stack.auto_pop = 0; }\
|
||||
if(state->border_color_stack.auto_pop) { ui_pop_border_color(); state->border_color_stack.auto_pop = 0; }\
|
||||
if(state->overlay_color_stack.auto_pop) { ui_pop_overlay_color(); state->overlay_color_stack.auto_pop = 0; }\
|
||||
if(state->text_select_color_stack.auto_pop) { ui_pop_text_select_color(); state->text_select_color_stack.auto_pop = 0; }\
|
||||
if(state->text_cursor_color_stack.auto_pop) { ui_pop_text_cursor_color(); state->text_cursor_color_stack.auto_pop = 0; }\
|
||||
if(state->scheme_stack.auto_pop) { ui_pop_scheme(); state->scheme_stack.auto_pop = 0; }\
|
||||
if(state->squish_stack.auto_pop) { ui_pop_squish(); state->squish_stack.auto_pop = 0; }\
|
||||
if(state->hover_cursor_stack.auto_pop) { ui_pop_hover_cursor(); state->hover_cursor_stack.auto_pop = 0; }\
|
||||
if(state->font_stack.auto_pop) { ui_pop_font(); state->font_stack.auto_pop = 0; }\
|
||||
@@ -219,12 +189,7 @@ internal UI_FocusKind ui_top_focus_hot(void);
|
||||
internal UI_FocusKind ui_top_focus_active(void);
|
||||
internal U32 ui_top_fastpath_codepoint(void);
|
||||
internal F32 ui_top_transparency(void);
|
||||
internal Vec4F32 ui_top_background_color(void);
|
||||
internal Vec4F32 ui_top_text_color(void);
|
||||
internal Vec4F32 ui_top_border_color(void);
|
||||
internal Vec4F32 ui_top_overlay_color(void);
|
||||
internal Vec4F32 ui_top_text_select_color(void);
|
||||
internal Vec4F32 ui_top_text_cursor_color(void);
|
||||
internal UI_ColorScheme* ui_top_scheme(void);
|
||||
internal F32 ui_top_squish(void);
|
||||
internal OS_Cursor ui_top_hover_cursor(void);
|
||||
internal F_Tag ui_top_font(void);
|
||||
@@ -250,12 +215,7 @@ internal UI_FocusKind ui_bottom_focus_hot(void);
|
||||
internal UI_FocusKind ui_bottom_focus_active(void);
|
||||
internal U32 ui_bottom_fastpath_codepoint(void);
|
||||
internal F32 ui_bottom_transparency(void);
|
||||
internal Vec4F32 ui_bottom_background_color(void);
|
||||
internal Vec4F32 ui_bottom_text_color(void);
|
||||
internal Vec4F32 ui_bottom_border_color(void);
|
||||
internal Vec4F32 ui_bottom_overlay_color(void);
|
||||
internal Vec4F32 ui_bottom_text_select_color(void);
|
||||
internal Vec4F32 ui_bottom_text_cursor_color(void);
|
||||
internal UI_ColorScheme* ui_bottom_scheme(void);
|
||||
internal F32 ui_bottom_squish(void);
|
||||
internal OS_Cursor ui_bottom_hover_cursor(void);
|
||||
internal F_Tag ui_bottom_font(void);
|
||||
@@ -281,12 +241,7 @@ internal UI_FocusKind ui_push_focus_hot(UI_FocusKind v);
|
||||
internal UI_FocusKind ui_push_focus_active(UI_FocusKind v);
|
||||
internal U32 ui_push_fastpath_codepoint(U32 v);
|
||||
internal F32 ui_push_transparency(F32 v);
|
||||
internal Vec4F32 ui_push_background_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_push_text_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_push_border_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_push_overlay_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_push_text_select_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_push_text_cursor_color(Vec4F32 v);
|
||||
internal UI_ColorScheme* ui_push_scheme(UI_ColorScheme* v);
|
||||
internal F32 ui_push_squish(F32 v);
|
||||
internal OS_Cursor ui_push_hover_cursor(OS_Cursor v);
|
||||
internal F_Tag ui_push_font(F_Tag v);
|
||||
@@ -312,12 +267,7 @@ internal UI_FocusKind ui_pop_focus_hot(void);
|
||||
internal UI_FocusKind ui_pop_focus_active(void);
|
||||
internal U32 ui_pop_fastpath_codepoint(void);
|
||||
internal F32 ui_pop_transparency(void);
|
||||
internal Vec4F32 ui_pop_background_color(void);
|
||||
internal Vec4F32 ui_pop_text_color(void);
|
||||
internal Vec4F32 ui_pop_border_color(void);
|
||||
internal Vec4F32 ui_pop_overlay_color(void);
|
||||
internal Vec4F32 ui_pop_text_select_color(void);
|
||||
internal Vec4F32 ui_pop_text_cursor_color(void);
|
||||
internal UI_ColorScheme* ui_pop_scheme(void);
|
||||
internal F32 ui_pop_squish(void);
|
||||
internal OS_Cursor ui_pop_hover_cursor(void);
|
||||
internal F_Tag ui_pop_font(void);
|
||||
@@ -343,12 +293,7 @@ internal UI_FocusKind ui_set_next_focus_hot(UI_FocusKind v);
|
||||
internal UI_FocusKind ui_set_next_focus_active(UI_FocusKind v);
|
||||
internal U32 ui_set_next_fastpath_codepoint(U32 v);
|
||||
internal F32 ui_set_next_transparency(F32 v);
|
||||
internal Vec4F32 ui_set_next_background_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_set_next_text_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_set_next_border_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_set_next_overlay_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_set_next_text_select_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_set_next_text_cursor_color(Vec4F32 v);
|
||||
internal UI_ColorScheme* ui_set_next_scheme(UI_ColorScheme* v);
|
||||
internal F32 ui_set_next_squish(F32 v);
|
||||
internal OS_Cursor ui_set_next_hover_cursor(OS_Cursor v);
|
||||
internal F_Tag ui_set_next_font(F_Tag v);
|
||||
|
||||
+26
-31
@@ -7,59 +7,54 @@
|
||||
UI_StackTable:
|
||||
{
|
||||
//- rjf: parents
|
||||
{ Parent parent `UI_Box *` `&ui_g_nil_box` }
|
||||
{ Parent parent `UI_Box *` `&ui_g_nil_box` }
|
||||
|
||||
//- rjf: layout params
|
||||
{ ChildLayoutAxis child_layout_axis Axis2 `Axis2_X` }
|
||||
{ ChildLayoutAxis child_layout_axis Axis2 `Axis2_X` }
|
||||
|
||||
//- rjf: size/position
|
||||
{ FixedX fixed_x F32 0 }
|
||||
{ FixedY fixed_y F32 0 }
|
||||
{ FixedWidth fixed_width F32 0 }
|
||||
{ FixedHeight fixed_height F32 0 }
|
||||
{ PrefWidth pref_width UI_Size `ui_px(250.f, 1.f)`}
|
||||
{ PrefHeight pref_height UI_Size `ui_px(30.f, 1.f)` }
|
||||
{ FixedX fixed_x F32 0 }
|
||||
{ FixedY fixed_y F32 0 }
|
||||
{ FixedWidth fixed_width F32 0 }
|
||||
{ FixedHeight fixed_height F32 0 }
|
||||
{ PrefWidth pref_width UI_Size `ui_px(250.f, 1.f)` }
|
||||
{ PrefHeight pref_height UI_Size `ui_px(30.f, 1.f)` }
|
||||
|
||||
//- rjf: flags
|
||||
{ Flags flags UI_BoxFlags 0 }
|
||||
{ Flags flags UI_BoxFlags 0 }
|
||||
|
||||
//- rjf: interaction
|
||||
{ FocusHot focus_hot UI_FocusKind UI_FocusKind_Null }
|
||||
{ FocusActive focus_active UI_FocusKind UI_FocusKind_Null }
|
||||
{ FastpathCodepoint fastpath_codepoint U32 0 }
|
||||
{ FocusHot focus_hot UI_FocusKind UI_FocusKind_Null }
|
||||
{ FocusActive focus_active UI_FocusKind UI_FocusKind_Null }
|
||||
{ FastpathCodepoint fastpath_codepoint U32 0 }
|
||||
|
||||
//- rjf: colors
|
||||
{ Transparency transparency F32 0 }
|
||||
{ BackgroundColor background_color Vec4F32 `v4f32(1, 0, 1, 1)`}
|
||||
{ TextColor text_color Vec4F32 `v4f32(1, 0, 1, 1)`}
|
||||
{ BorderColor border_color Vec4F32 `v4f32(1, 0, 1, 1)`}
|
||||
{ OverlayColor overlay_color Vec4F32 `v4f32(1, 0, 1, 1)`}
|
||||
{ TextSelectColor text_select_color Vec4F32 `v4f32(1, 0, 1, 1)`}
|
||||
{ TextCursorColor text_cursor_color Vec4F32 `v4f32(1, 0, 1, 1)`}
|
||||
{ Transparency transparency F32 0 }
|
||||
{ Scheme scheme `UI_ColorScheme*` `&ui_g_nil_color_scheme` }
|
||||
|
||||
//- rjf: squish
|
||||
{ Squish squish F32 0 }
|
||||
{ Squish squish F32 0 }
|
||||
|
||||
//- rjf: hover cursor
|
||||
{ HoverCursor hover_cursor OS_Cursor OS_Cursor_Pointer }
|
||||
{ HoverCursor hover_cursor OS_Cursor OS_Cursor_Pointer }
|
||||
|
||||
//- rjf: font
|
||||
{ Font font F_Tag `f_tag_zero()` }
|
||||
{ FontSize font_size F32 24.f }
|
||||
{ TabSize tab_size F32 `24.f*4.f` }
|
||||
{ Font font F_Tag `f_tag_zero()` }
|
||||
{ FontSize font_size F32 24.f }
|
||||
{ TabSize tab_size F32 `24.f*4.f` }
|
||||
|
||||
//- rjf: corner radii
|
||||
{ CornerRadius00 corner_radius_00 F32 0 }
|
||||
{ CornerRadius01 corner_radius_01 F32 0 }
|
||||
{ CornerRadius10 corner_radius_10 F32 0 }
|
||||
{ CornerRadius11 corner_radius_11 F32 0 }
|
||||
{ CornerRadius00 corner_radius_00 F32 0 }
|
||||
{ CornerRadius01 corner_radius_01 F32 0 }
|
||||
{ CornerRadius10 corner_radius_10 F32 0 }
|
||||
{ CornerRadius11 corner_radius_11 F32 0 }
|
||||
|
||||
//- rjf: blur size
|
||||
{ BlurSize blur_size F32 0 }
|
||||
{ BlurSize blur_size F32 0 }
|
||||
|
||||
//- rjf: text parameters
|
||||
{ TextPadding text_padding F32 2 }
|
||||
{ TextAlignment text_alignment UI_TextAlign UI_TextAlign_Left }
|
||||
{ TextPadding text_padding F32 2 }
|
||||
{ TextAlignment text_alignment UI_TextAlign UI_TextAlign_Left }
|
||||
}
|
||||
|
||||
//- rjf: declaring stack node types
|
||||
|
||||
@@ -120,8 +120,6 @@ typedef struct UI_LineEditDrawData UI_LineEditDrawData;
|
||||
struct UI_LineEditDrawData
|
||||
{
|
||||
String8 edited_string;
|
||||
Vec4F32 cursor_color;
|
||||
Vec4F32 select_color;
|
||||
TxtPt cursor;
|
||||
TxtPt mark;
|
||||
};
|
||||
@@ -132,9 +130,9 @@ internal UI_BOX_CUSTOM_DRAW(ui_line_edit_draw)
|
||||
F_Tag font = box->font;
|
||||
F32 font_size = box->font_size;
|
||||
F32 tab_size = box->tab_size;
|
||||
Vec4F32 cursor_color = draw_data->cursor_color;
|
||||
Vec4F32 cursor_color = box->scheme->colors[UI_ColorCode_Cursor];
|
||||
cursor_color.w *= box->parent->parent->focus_active_t;
|
||||
Vec4F32 select_color = draw_data->select_color;
|
||||
Vec4F32 select_color = box->scheme->colors[UI_ColorCode_Selection];
|
||||
select_color.w *= (box->parent->parent->focus_active_t*0.2f + 0.8f);
|
||||
Vec2F32 text_position = ui_box_text_position(box);
|
||||
String8 edited_string = draw_data->edited_string;
|
||||
@@ -261,8 +259,6 @@ ui_line_edit(TxtPt *cursor, TxtPt *mark, U8 *edit_buffer, U64 edit_buffer_size,
|
||||
draw_data->edited_string = push_str8_copy(ui_build_arena(), edit_string);
|
||||
draw_data->cursor = *cursor;
|
||||
draw_data->mark = *mark;
|
||||
draw_data->cursor_color = ui_top_text_cursor_color();
|
||||
draw_data->select_color = ui_top_text_select_color();
|
||||
ui_box_equip_display_string(editstr_box, edit_string);
|
||||
ui_box_equip_custom_draw(editstr_box, ui_line_edit_draw, draw_data);
|
||||
mouse_pt = txt_pt(1, 1+ui_box_char_pos_from_xy(editstr_box, ui_mouse()));
|
||||
@@ -403,37 +399,6 @@ ui_imagef(R_Handle texture, R_Tex2DSampleKind sample_kind, Rng2F32 region, Vec4F
|
||||
////////////////////////////////
|
||||
//~ rjf: Special Buttons
|
||||
|
||||
internal UI_Signal
|
||||
ui_close_button(String8 string)
|
||||
{
|
||||
ui_set_next_background_color(v4f32(0.6f, 0.2f, 0.1f, 1.f));
|
||||
ui_set_next_text_color(v4f32(1, 1, 1, 1));
|
||||
ui_set_next_hover_cursor(OS_Cursor_HandPoint);
|
||||
ui_set_next_text_alignment(UI_TextAlign_Center);
|
||||
UI_Box *box = ui_build_box_from_string(UI_BoxFlag_Clickable|
|
||||
UI_BoxFlag_DrawBackground|
|
||||
UI_BoxFlag_DrawBorder|
|
||||
UI_BoxFlag_DrawText|
|
||||
UI_BoxFlag_DrawHotEffects|
|
||||
UI_BoxFlag_DrawActiveEffects,
|
||||
string);
|
||||
UI_Signal interact = ui_signal_from_box(box);
|
||||
return interact;
|
||||
}
|
||||
|
||||
internal UI_Signal
|
||||
ui_close_buttonf(char *fmt, ...)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
String8 string = push_str8fv(scratch.arena, fmt, args);
|
||||
va_end(args);
|
||||
UI_Signal sig = ui_close_button(string);
|
||||
scratch_end(scratch);
|
||||
return sig;
|
||||
}
|
||||
|
||||
internal UI_Signal
|
||||
ui_expander(B32 is_expanded, String8 string)
|
||||
{
|
||||
@@ -513,7 +478,8 @@ ui_do_color_tooltip_hsv(Vec3F32 hsv)
|
||||
{
|
||||
UI_PrefWidth(ui_em(22.f, 1.f)) UI_PrefHeight(ui_em(6.f, 1.f)) UI_Row UI_Padding(ui_pct(1, 0))
|
||||
{
|
||||
UI_BackgroundColor(v4f32(rgb.x, rgb.y, rgb.z, 1)) UI_CornerRadius(4.f)
|
||||
UI_Scheme(ui_fork_top_color_scheme(.background = v4f32(rgb.x, rgb.y, rgb.z, 1.f)))
|
||||
UI_CornerRadius(4.f)
|
||||
UI_PrefWidth(ui_em(6.f, 1.f)) UI_PrefHeight(ui_em(6.f, 1.f))
|
||||
ui_build_box_from_string(UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawBackground, str8_lit(""));
|
||||
}
|
||||
@@ -551,7 +517,8 @@ ui_do_color_tooltip_hsva(Vec4F32 hsva)
|
||||
{
|
||||
UI_PrefWidth(ui_em(22.f, 1.f)) UI_PrefHeight(ui_em(6.f, 1.f)) UI_Row UI_Padding(ui_pct(1, 0))
|
||||
{
|
||||
UI_BackgroundColor(rgba) UI_CornerRadius(4.f)
|
||||
UI_Scheme(ui_fork_top_color_scheme(.background = rgba))
|
||||
UI_CornerRadius(4.f)
|
||||
UI_PrefWidth(ui_em(6.f, 1.f)) UI_PrefHeight(ui_em(6.f, 1.f))
|
||||
ui_build_box_from_string(UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawBackground, str8_lit(""));
|
||||
}
|
||||
|
||||
@@ -89,8 +89,6 @@ internal UI_Signal ui_imagef(R_Handle texture, R_Tex2DSampleKind sample_kind, Rn
|
||||
////////////////////////////////
|
||||
//~ rjf: Special Buttons
|
||||
|
||||
internal UI_Signal ui_close_button(String8 string);
|
||||
internal UI_Signal ui_close_buttonf(char *fmt, ...);
|
||||
internal UI_Signal ui_expander(B32 is_expanded, String8 string);
|
||||
internal UI_Signal ui_expanderf(B32 is_expanded, char *fmt, ...);
|
||||
internal UI_Signal ui_sort_header(B32 sorting, B32 ascending, String8 string);
|
||||
|
||||
+42
-68
@@ -1890,8 +1890,7 @@ ui_begin_ctx_menu(UI_Key key)
|
||||
ui_state->ctx_menu_root->flags |= UI_BoxFlag_Clip;
|
||||
ui_state->ctx_menu_root->flags |= UI_BoxFlag_Clickable;
|
||||
ui_state->ctx_menu_root->corner_radii[Corner_00] = ui_state->ctx_menu_root->corner_radii[Corner_01] = ui_state->ctx_menu_root->corner_radii[Corner_10] = ui_state->ctx_menu_root->corner_radii[Corner_11] = ui_top_font_size()*0.25f;
|
||||
ui_state->ctx_menu_root->background_color = ui_top_background_color();
|
||||
ui_state->ctx_menu_root->border_color = ui_top_border_color();
|
||||
ui_state->ctx_menu_root->scheme = ui_top_scheme();
|
||||
ui_state->ctx_menu_root->blur_size = ui_top_blur_size();
|
||||
}
|
||||
ui_push_pref_width(ui_bottom_pref_width());
|
||||
@@ -2037,6 +2036,41 @@ ui_set_auto_focus_hot_key(UI_Key key)
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: color scheme forming
|
||||
|
||||
internal UI_ColorScheme *
|
||||
ui_push_color_scheme_(UI_ColorScheme *params)
|
||||
{
|
||||
UI_ColorScheme *scheme = push_array(ui_build_arena(), UI_ColorScheme, 1);
|
||||
MemoryCopyStruct(scheme, params);
|
||||
return scheme;
|
||||
}
|
||||
|
||||
internal UI_ColorScheme *
|
||||
ui_fork_color_scheme_(UI_ColorScheme *scheme, UI_ColorScheme *overrides)
|
||||
{
|
||||
UI_ColorScheme *fork = push_array(ui_build_arena(), UI_ColorScheme, 1);
|
||||
MemoryCopyStruct(fork, scheme);
|
||||
for(EachEnumVal(UI_ColorCode, code))
|
||||
{
|
||||
if(overrides->colors[code].x != 0 ||
|
||||
overrides->colors[code].y != 0 ||
|
||||
overrides->colors[code].z != 0 ||
|
||||
overrides->colors[code].w != 0)
|
||||
{
|
||||
fork->colors[code] = overrides->colors[code];
|
||||
}
|
||||
}
|
||||
return fork;
|
||||
}
|
||||
|
||||
internal UI_ColorScheme *
|
||||
ui_fork_top_color_scheme_(UI_ColorScheme *params)
|
||||
{
|
||||
UI_ColorScheme *scheme = ui_fork_color_scheme_(ui_top_scheme(), params);
|
||||
return scheme;
|
||||
}
|
||||
|
||||
//- rjf: box node construction
|
||||
|
||||
internal UI_Box *
|
||||
@@ -2181,10 +2215,7 @@ ui_build_box_from_key(UI_BoxFlags flags, UI_Key key)
|
||||
|
||||
box->text_align = ui_state->text_alignment_stack.top->v;
|
||||
box->child_layout_axis = ui_state->child_layout_axis_stack.top->v;
|
||||
box->background_color = ui_state->background_color_stack.top->v;
|
||||
box->text_color = ui_state->text_color_stack.top->v;
|
||||
box->border_color = ui_state->border_color_stack.top->v;
|
||||
box->overlay_color = ui_state->overlay_color_stack.top->v;
|
||||
box->scheme = ui_state->scheme_stack.top->v;
|
||||
box->font = ui_state->font_stack.top->v;
|
||||
box->font_size = ui_state->font_size_stack.top->v;
|
||||
box->tab_size = ui_state->tab_size_stack.top->v;
|
||||
@@ -2274,7 +2305,7 @@ ui_box_equip_display_string(UI_Box *box, String8 string)
|
||||
if(box->flags & UI_BoxFlag_DrawText && (box->fastpath_codepoint == 0 || !(box->flags & UI_BoxFlag_DrawTextFastpathCodepoint)))
|
||||
{
|
||||
String8 display_string = ui_box_display_string(box);
|
||||
D_FancyStringNode fancy_string_n = {0, {box->font, display_string, box->text_color, box->font_size, 0, 0}};
|
||||
D_FancyStringNode fancy_string_n = {0, {box->font, display_string, box->scheme->colors[UI_ColorCode_Text], box->font_size, 0, 0}};
|
||||
D_FancyStringList fancy_strings = {&fancy_string_n, &fancy_string_n, 1};
|
||||
box->display_string_runs = d_fancy_run_list_from_fancy_string_list(ui_build_arena(), box->tab_size, &fancy_strings);
|
||||
}
|
||||
@@ -2287,15 +2318,15 @@ ui_box_equip_display_string(UI_Box *box, String8 string)
|
||||
U64 fpcp_pos = str8_find_needle(display_string, 0, fpcp, StringMatchFlag_CaseInsensitive);
|
||||
if(fpcp_pos < display_string.size)
|
||||
{
|
||||
D_FancyStringNode pst_fancy_string_n = {0, {box->font, str8_skip(display_string, fpcp_pos+fpcp.size), box->text_color, box->font_size, 0, 0}};
|
||||
D_FancyStringNode cdp_fancy_string_n = {&pst_fancy_string_n, {box->font, str8_substr(display_string, r1u64(fpcp_pos, fpcp_pos+fpcp.size)), box->text_color, box->font_size, 4.f, 0}};
|
||||
D_FancyStringNode pre_fancy_string_n = {&cdp_fancy_string_n, {box->font, str8_prefix(display_string, fpcp_pos), box->text_color, box->font_size, 0, 0}};
|
||||
D_FancyStringNode pst_fancy_string_n = {0, {box->font, str8_skip(display_string, fpcp_pos+fpcp.size), box->scheme->colors[UI_ColorCode_Text], box->font_size, 0, 0}};
|
||||
D_FancyStringNode cdp_fancy_string_n = {&pst_fancy_string_n, {box->font, str8_substr(display_string, r1u64(fpcp_pos, fpcp_pos+fpcp.size)), box->scheme->colors[UI_ColorCode_Text], box->font_size, 4.f, 0}};
|
||||
D_FancyStringNode pre_fancy_string_n = {&cdp_fancy_string_n, {box->font, str8_prefix(display_string, fpcp_pos), box->scheme->colors[UI_ColorCode_Text], box->font_size, 0, 0}};
|
||||
D_FancyStringList fancy_strings = {&pre_fancy_string_n, &pst_fancy_string_n, 3};
|
||||
box->display_string_runs = d_fancy_run_list_from_fancy_string_list(ui_build_arena(), box->tab_size, &fancy_strings);
|
||||
}
|
||||
else
|
||||
{
|
||||
D_FancyStringNode fancy_string_n = {0, {box->font, display_string, box->text_color, box->font_size, 0, 0}};
|
||||
D_FancyStringNode fancy_string_n = {0, {box->font, display_string, box->scheme->colors[UI_ColorCode_Text], box->font_size, 0, 0}};
|
||||
D_FancyStringList fancy_strings = {&fancy_string_n, &fancy_string_n, 1};
|
||||
box->display_string_runs = d_fancy_run_list_from_fancy_string_list(ui_build_arena(), box->tab_size, &fancy_strings);
|
||||
}
|
||||
@@ -2406,63 +2437,6 @@ ui_box_char_pos_from_xy(UI_Box *box, Vec2F32 xy)
|
||||
////////////////////////////////
|
||||
//~ rjf: Box Interaction
|
||||
|
||||
//- rjf: single-line string editing
|
||||
|
||||
internal B32
|
||||
ui_do_single_line_string_edits(TxtPt *cursor, TxtPt *mark, U64 string_max, String8 *out_string)
|
||||
{
|
||||
B32 change = 0;
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
UI_EventList *events = ui_events();
|
||||
for(UI_EventNode *n = events->first, *next = 0; n != 0; n = next)
|
||||
{
|
||||
next = n->next;
|
||||
|
||||
// rjf: do not consume anything that doesn't fit a single-line's operations
|
||||
if((n->v.kind != UI_EventKind_Edit && n->v.kind != UI_EventKind_Navigate && n->v.kind != UI_EventKind_Text) || n->v.delta_2s32.y != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// rjf: map this action to an op
|
||||
B32 taken = 0;
|
||||
UI_TxtOp op = ui_single_line_txt_op_from_event(scratch.arena, &n->v, *out_string, *cursor, *mark);
|
||||
|
||||
// rjf: perform replace range
|
||||
if(!txt_pt_match(op.range.min, op.range.max) || op.replace.size != 0)
|
||||
{
|
||||
taken = 1;
|
||||
String8 new_string = ui_push_string_replace_range(scratch.arena, *out_string, r1s64(op.range.min.column, op.range.max.column), op.replace);
|
||||
new_string.size = Min(string_max, new_string.size);
|
||||
MemoryCopy(out_string->str, new_string.str, new_string.size);
|
||||
out_string->size = new_string.size;
|
||||
}
|
||||
|
||||
// rjf: perform copy
|
||||
if(op.flags & UI_TxtOpFlag_Copy)
|
||||
{
|
||||
taken = 1;
|
||||
os_set_clipboard_text(op.copy);
|
||||
}
|
||||
|
||||
// rjf: commit op's changed cursor & mark to caller-provided state
|
||||
taken = taken || (!txt_pt_match(*cursor, op.cursor) || !txt_pt_match(*mark, op.mark));
|
||||
*cursor = op.cursor;
|
||||
*mark = op.mark;
|
||||
|
||||
// rjf: consume event
|
||||
if(taken)
|
||||
{
|
||||
ui_eat_event(events, n);
|
||||
change = 1;
|
||||
}
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return change;
|
||||
}
|
||||
|
||||
//- rjf: general box interaction path
|
||||
|
||||
internal UI_Signal
|
||||
ui_signal_from_box(UI_Box *box)
|
||||
{
|
||||
|
||||
+78
-58
@@ -195,6 +195,43 @@ struct UI_Size
|
||||
F32 strictness;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Color Schemes
|
||||
|
||||
typedef enum UI_ColorCode
|
||||
{
|
||||
UI_ColorCode_Null,
|
||||
UI_ColorCode_Background,
|
||||
UI_ColorCode_Text,
|
||||
UI_ColorCode_TextWeak,
|
||||
UI_ColorCode_Border,
|
||||
UI_ColorCode_Overlay,
|
||||
UI_ColorCode_Cursor,
|
||||
UI_ColorCode_Selection,
|
||||
UI_ColorCode_COUNT
|
||||
}
|
||||
UI_ColorCode;
|
||||
|
||||
typedef struct UI_ColorScheme UI_ColorScheme;
|
||||
struct UI_ColorScheme
|
||||
{
|
||||
union
|
||||
{
|
||||
Vec4F32 colors[UI_ColorCode_COUNT];
|
||||
struct
|
||||
{
|
||||
Vec4F32 null;
|
||||
Vec4F32 background;
|
||||
Vec4F32 text;
|
||||
Vec4F32 text_weak;
|
||||
Vec4F32 border;
|
||||
Vec4F32 overlay;
|
||||
Vec4F32 cursor;
|
||||
Vec4F32 selection;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Scroll Positions
|
||||
|
||||
@@ -275,20 +312,21 @@ typedef U64 UI_BoxFlags;
|
||||
# define UI_BoxFlag_DrawSideRight (UI_BoxFlags)(1ull<<33)
|
||||
# define UI_BoxFlag_DrawText (UI_BoxFlags)(1ull<<34)
|
||||
# define UI_BoxFlag_DrawTextFastpathCodepoint (UI_BoxFlags)(1ull<<35)
|
||||
# define UI_BoxFlag_DrawHotEffects (UI_BoxFlags)(1ull<<36)
|
||||
# define UI_BoxFlag_DrawActiveEffects (UI_BoxFlags)(1ull<<37)
|
||||
# define UI_BoxFlag_DrawOverlay (UI_BoxFlags)(1ull<<38)
|
||||
# define UI_BoxFlag_DrawBucket (UI_BoxFlags)(1ull<<39)
|
||||
# define UI_BoxFlag_Clip (UI_BoxFlags)(1ull<<40)
|
||||
# define UI_BoxFlag_AnimatePosX (UI_BoxFlags)(1ull<<41)
|
||||
# define UI_BoxFlag_AnimatePosY (UI_BoxFlags)(1ull<<42)
|
||||
# define UI_BoxFlag_DisableTextTrunc (UI_BoxFlags)(1ull<<43)
|
||||
# define UI_BoxFlag_DisableIDString (UI_BoxFlags)(1ull<<44)
|
||||
# define UI_BoxFlag_DisableFocusViz (UI_BoxFlags)(1ull<<45)
|
||||
# define UI_BoxFlag_RequireFocusBackground (UI_BoxFlags)(1ull<<46)
|
||||
# define UI_BoxFlag_HasDisplayString (UI_BoxFlags)(1ull<<47)
|
||||
# define UI_BoxFlag_HasFuzzyMatchRanges (UI_BoxFlags)(1ull<<48)
|
||||
# define UI_BoxFlag_RoundChildrenByParent (UI_BoxFlags)(1ull<<49)
|
||||
# define UI_BoxFlag_DrawTextWeak (UI_BoxFlags)(1ull<<36)
|
||||
# define UI_BoxFlag_DrawHotEffects (UI_BoxFlags)(1ull<<37)
|
||||
# define UI_BoxFlag_DrawActiveEffects (UI_BoxFlags)(1ull<<38)
|
||||
# define UI_BoxFlag_DrawOverlay (UI_BoxFlags)(1ull<<39)
|
||||
# define UI_BoxFlag_DrawBucket (UI_BoxFlags)(1ull<<40)
|
||||
# define UI_BoxFlag_Clip (UI_BoxFlags)(1ull<<41)
|
||||
# define UI_BoxFlag_AnimatePosX (UI_BoxFlags)(1ull<<42)
|
||||
# define UI_BoxFlag_AnimatePosY (UI_BoxFlags)(1ull<<43)
|
||||
# define UI_BoxFlag_DisableTextTrunc (UI_BoxFlags)(1ull<<44)
|
||||
# define UI_BoxFlag_DisableIDString (UI_BoxFlags)(1ull<<45)
|
||||
# define UI_BoxFlag_DisableFocusViz (UI_BoxFlags)(1ull<<46)
|
||||
# define UI_BoxFlag_RequireFocusBackground (UI_BoxFlags)(1ull<<47)
|
||||
# define UI_BoxFlag_HasDisplayString (UI_BoxFlags)(1ull<<48)
|
||||
# define UI_BoxFlag_HasFuzzyMatchRanges (UI_BoxFlags)(1ull<<49)
|
||||
# define UI_BoxFlag_RoundChildrenByParent (UI_BoxFlags)(1ull<<50)
|
||||
|
||||
//- rjf: bundles
|
||||
# define UI_BoxFlag_Clickable (UI_BoxFlag_MouseClickable|UI_BoxFlag_KeyboardClickable)
|
||||
@@ -330,10 +368,7 @@ struct UI_Box
|
||||
D_Bucket *draw_bucket;
|
||||
UI_BoxCustomDrawFunctionType *custom_draw;
|
||||
void *custom_draw_user_data;
|
||||
Vec4F32 background_color;
|
||||
Vec4F32 text_color;
|
||||
Vec4F32 border_color;
|
||||
Vec4F32 overlay_color;
|
||||
UI_ColorScheme *scheme;
|
||||
F_Tag font;
|
||||
F32 font_size;
|
||||
F32 tab_size;
|
||||
@@ -604,6 +639,11 @@ internal UI_Size ui_size(UI_SizeKind kind, F32 value, F32 strictness);
|
||||
#define ui_pct(value, strictness) ui_size(UI_SizeKind_ParentPct, value, strictness)
|
||||
#define ui_children_sum(strictness) ui_size(UI_SizeKind_ChildrenSum, 0.f, strictness)
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Color Scheme Type Functions
|
||||
|
||||
read_only global UI_ColorScheme ui_g_nil_color_scheme = {0};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Scroll Point Type Functions
|
||||
|
||||
@@ -720,6 +760,14 @@ internal B32 ui_is_key_auto_focus_hot(UI_Key key);
|
||||
internal void ui_set_auto_focus_active_key(UI_Key key);
|
||||
internal void ui_set_auto_focus_hot_key(UI_Key key);
|
||||
|
||||
//- rjf: color scheme forming
|
||||
internal UI_ColorScheme * ui_push_color_scheme_(UI_ColorScheme *params);
|
||||
internal UI_ColorScheme * ui_fork_color_scheme_(UI_ColorScheme *scheme, UI_ColorScheme *overrides);
|
||||
internal UI_ColorScheme * ui_fork_top_color_scheme_(UI_ColorScheme *params);
|
||||
#define ui_push_color_scheme(...) ui_push_color_scheme_(&(UI_ColorScheme){__VA_ARGS__})
|
||||
#define ui_fork_color_scheme(scheme, ...) ui_fork_color_scheme_((scheme), &(UI_ColorScheme){__VA_ARGS__})
|
||||
#define ui_fork_top_color_scheme(...) ui_fork_top_color_scheme_(&(UI_ColorScheme){__VA_ARGS__})
|
||||
|
||||
//- rjf: box node construction
|
||||
internal UI_Box * ui_build_box_from_key(UI_BoxFlags flags, UI_Key key);
|
||||
internal UI_Key ui_active_seed_key(void);
|
||||
@@ -742,10 +790,6 @@ internal U64 ui_box_char_pos_from_xy(UI_Box *box, Vec2F32 xy);
|
||||
////////////////////////////////
|
||||
//~ rjf: User Interaction
|
||||
|
||||
//- rjf: single-line string editing
|
||||
internal B32 ui_do_single_line_string_edits(TxtPt *cursor, TxtPt *mark, U64 string_max, String8 *out_string);
|
||||
|
||||
//- rjf: general box interaction path
|
||||
internal UI_Signal ui_signal_from_box(UI_Box *box);
|
||||
|
||||
////////////////////////////////
|
||||
@@ -765,16 +809,12 @@ internal UI_FocusKind ui_top_focus_hot(void);
|
||||
internal UI_FocusKind ui_top_focus_active(void);
|
||||
internal U32 ui_top_fastpath_codepoint(void);
|
||||
internal F32 ui_top_transparency(void);
|
||||
internal Vec4F32 ui_top_background_color(void);
|
||||
internal Vec4F32 ui_top_text_color(void);
|
||||
internal Vec4F32 ui_top_border_color(void);
|
||||
internal Vec4F32 ui_top_overlay_color(void);
|
||||
internal Vec4F32 ui_top_text_select_color(void);
|
||||
internal Vec4F32 ui_top_text_cursor_color(void);
|
||||
internal UI_ColorScheme* ui_top_scheme(void);
|
||||
internal F32 ui_top_squish(void);
|
||||
internal OS_Cursor ui_top_hover_cursor(void);
|
||||
internal F_Tag ui_top_font(void);
|
||||
internal F32 ui_top_font_size(void);
|
||||
internal F32 ui_top_tab_size(void);
|
||||
internal F32 ui_top_corner_radius_00(void);
|
||||
internal F32 ui_top_corner_radius_01(void);
|
||||
internal F32 ui_top_corner_radius_10(void);
|
||||
@@ -795,16 +835,12 @@ internal UI_FocusKind ui_bottom_focus_hot(void);
|
||||
internal UI_FocusKind ui_bottom_focus_active(void);
|
||||
internal U32 ui_bottom_fastpath_codepoint(void);
|
||||
internal F32 ui_bottom_transparency(void);
|
||||
internal Vec4F32 ui_bottom_background_color(void);
|
||||
internal Vec4F32 ui_bottom_text_color(void);
|
||||
internal Vec4F32 ui_bottom_border_color(void);
|
||||
internal Vec4F32 ui_bottom_overlay_color(void);
|
||||
internal Vec4F32 ui_bottom_text_select_color(void);
|
||||
internal Vec4F32 ui_bottom_text_cursor_color(void);
|
||||
internal UI_ColorScheme* ui_bottom_scheme(void);
|
||||
internal F32 ui_bottom_squish(void);
|
||||
internal OS_Cursor ui_bottom_hover_cursor(void);
|
||||
internal F_Tag ui_bottom_font(void);
|
||||
internal F32 ui_bottom_font_size(void);
|
||||
internal F32 ui_bottom_tab_size(void);
|
||||
internal F32 ui_bottom_corner_radius_00(void);
|
||||
internal F32 ui_bottom_corner_radius_01(void);
|
||||
internal F32 ui_bottom_corner_radius_10(void);
|
||||
@@ -825,16 +861,12 @@ internal UI_FocusKind ui_push_focus_hot(UI_FocusKind v);
|
||||
internal UI_FocusKind ui_push_focus_active(UI_FocusKind v);
|
||||
internal U32 ui_push_fastpath_codepoint(U32 v);
|
||||
internal F32 ui_push_transparency(F32 v);
|
||||
internal Vec4F32 ui_push_background_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_push_text_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_push_border_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_push_overlay_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_push_text_select_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_push_text_cursor_color(Vec4F32 v);
|
||||
internal UI_ColorScheme* ui_push_scheme(UI_ColorScheme* v);
|
||||
internal F32 ui_push_squish(F32 v);
|
||||
internal OS_Cursor ui_push_hover_cursor(OS_Cursor v);
|
||||
internal F_Tag ui_push_font(F_Tag v);
|
||||
internal F32 ui_push_font_size(F32 v);
|
||||
internal F32 ui_push_tab_size(F32 v);
|
||||
internal F32 ui_push_corner_radius_00(F32 v);
|
||||
internal F32 ui_push_corner_radius_01(F32 v);
|
||||
internal F32 ui_push_corner_radius_10(F32 v);
|
||||
@@ -855,16 +887,12 @@ internal UI_FocusKind ui_pop_focus_hot(void);
|
||||
internal UI_FocusKind ui_pop_focus_active(void);
|
||||
internal U32 ui_pop_fastpath_codepoint(void);
|
||||
internal F32 ui_pop_transparency(void);
|
||||
internal Vec4F32 ui_pop_background_color(void);
|
||||
internal Vec4F32 ui_pop_text_color(void);
|
||||
internal Vec4F32 ui_pop_border_color(void);
|
||||
internal Vec4F32 ui_pop_overlay_color(void);
|
||||
internal Vec4F32 ui_pop_text_select_color(void);
|
||||
internal Vec4F32 ui_pop_text_cursor_color(void);
|
||||
internal UI_ColorScheme* ui_pop_scheme(void);
|
||||
internal F32 ui_pop_squish(void);
|
||||
internal OS_Cursor ui_pop_hover_cursor(void);
|
||||
internal F_Tag ui_pop_font(void);
|
||||
internal F32 ui_pop_font_size(void);
|
||||
internal F32 ui_pop_tab_size(void);
|
||||
internal F32 ui_pop_corner_radius_00(void);
|
||||
internal F32 ui_pop_corner_radius_01(void);
|
||||
internal F32 ui_pop_corner_radius_10(void);
|
||||
@@ -885,16 +913,12 @@ internal UI_FocusKind ui_set_next_focus_hot(UI_FocusKind v);
|
||||
internal UI_FocusKind ui_set_next_focus_active(UI_FocusKind v);
|
||||
internal U32 ui_set_next_fastpath_codepoint(U32 v);
|
||||
internal F32 ui_set_next_transparency(F32 v);
|
||||
internal Vec4F32 ui_set_next_background_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_set_next_text_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_set_next_border_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_set_next_overlay_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_set_next_text_select_color(Vec4F32 v);
|
||||
internal Vec4F32 ui_set_next_text_cursor_color(Vec4F32 v);
|
||||
internal UI_ColorScheme* ui_set_next_scheme(UI_ColorScheme* v);
|
||||
internal F32 ui_set_next_squish(F32 v);
|
||||
internal OS_Cursor ui_set_next_hover_cursor(OS_Cursor v);
|
||||
internal F_Tag ui_set_next_font(F_Tag v);
|
||||
internal F32 ui_set_next_font_size(F32 v);
|
||||
internal F32 ui_set_next_tab_size(F32 v);
|
||||
internal F32 ui_set_next_corner_radius_00(F32 v);
|
||||
internal F32 ui_set_next_corner_radius_01(F32 v);
|
||||
internal F32 ui_set_next_corner_radius_10(F32 v);
|
||||
@@ -929,12 +953,7 @@ internal void ui_pop_corner_radius(void);
|
||||
#define UI_FocusActive(v) DeferLoop(ui_push_focus_active(v), ui_pop_focus_active())
|
||||
#define UI_FastpathCodepoint(v) DeferLoop(ui_push_fastpath_codepoint(v), ui_pop_fastpath_codepoint())
|
||||
#define UI_Transparency(v) DeferLoop(ui_push_transparency(v), ui_pop_transparency())
|
||||
#define UI_BackgroundColor(v) DeferLoop(ui_push_background_color(v), ui_pop_background_color())
|
||||
#define UI_TextColor(v) DeferLoop(ui_push_text_color(v), ui_pop_text_color())
|
||||
#define UI_BorderColor(v) DeferLoop(ui_push_border_color(v), ui_pop_border_color())
|
||||
#define UI_OverlayColor(v) DeferLoop(ui_push_overlay_color(v), ui_pop_overlay_color())
|
||||
#define UI_TextSelectColor(v) DeferLoop(ui_push_text_select_color(v), ui_pop_text_select_color())
|
||||
#define UI_TextCursorColor(v) DeferLoop(ui_push_text_cursor_color(v), ui_pop_text_cursor_color())
|
||||
#define UI_Scheme(v) DeferLoop(ui_push_scheme(v), ui_pop_scheme())
|
||||
#define UI_Squish(v) DeferLoop(ui_push_squish(v), ui_pop_squish())
|
||||
#define UI_HoverCursor(v) DeferLoop(ui_push_hover_cursor(v), ui_pop_hover_cursor())
|
||||
#define UI_Font(v) DeferLoop(ui_push_font(v), ui_pop_font())
|
||||
@@ -955,6 +974,7 @@ internal void ui_pop_corner_radius(void);
|
||||
#define UI_PrefSize(axis, v) DeferLoop(ui_push_pref_size((axis), (v)), ui_pop_pref_size(axis))
|
||||
#define UI_CornerRadius(v) DeferLoop(ui_push_corner_radius(v), ui_pop_corner_radius())
|
||||
#define UI_Focus(kind) DeferLoop((ui_push_focus_hot(kind), ui_push_focus_active(kind)), (ui_pop_focus_hot(), ui_pop_focus_active()))
|
||||
#define UI_FlagsAdd(v) DeferLoop(ui_push_flags(ui_top_flags()|v), ui_pop_flags())
|
||||
|
||||
//- rjf: tooltip
|
||||
#define UI_TooltipBase DeferLoop(ui_tooltip_begin_base(), ui_tooltip_end_base())
|
||||
|
||||
Reference in New Issue
Block a user