From 8552305ecc560f53b594af99ddf8d735a9d34dbe Mon Sep 17 00:00:00 2001 From: PS Date: Sat, 10 Feb 2024 15:43:16 -0800 Subject: [PATCH] Modal cursor recoloring --- code/custom/4coder_draw.cpp | 24 +++++++++--------------- code/custom/4coder_modal.h | 2 ++ 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/code/custom/4coder_draw.cpp b/code/custom/4coder_draw.cpp index 784d8df9..1269ceab 100644 --- a/code/custom/4coder_draw.cpp +++ b/code/custom/4coder_draw.cpp @@ -850,21 +850,15 @@ draw_original_4coder_style_cursor_mark_highlight(Application_Links *app, View_ID i64 cursor_pos = view_get_cursor_pos(app, view_id); i64 mark_pos = view_get_mark_pos(app, view_id); if (is_active_view){ - draw_character_block(app, text_layout_id, cursor_pos, roundness, - fcolor_id(defcolor_cursor, cursor_sub_id)); - paint_text_color_pos(app, text_layout_id, cursor_pos, - fcolor_id(defcolor_at_cursor)); - draw_character_wire_frame(app, text_layout_id, mark_pos, - roundness, outline_thickness, - fcolor_id(defcolor_mark)); - } - else{ - draw_character_wire_frame(app, text_layout_id, mark_pos, - roundness, outline_thickness, - fcolor_id(defcolor_mark)); - draw_character_wire_frame(app, text_layout_id, cursor_pos, - roundness, outline_thickness, - fcolor_id(defcolor_cursor, cursor_sub_id)); + Modal_Mode* mode_curr = modal_get_mode_curr(); + FColor c0 = mode_curr->cursor_color; + FColor c1 = fcolor_id(defcolor_at_cursor); + draw_character_block(app, text_layout_id, cursor_pos, roundness, c0); + paint_text_color_pos(app, text_layout_id, cursor_pos, c1); + draw_character_wire_frame(app, text_layout_id, mark_pos, roundness, outline_thickness, c0); + } else { + draw_character_wire_frame(app, text_layout_id, mark_pos, roundness, outline_thickness, fcolor_id(defcolor_mark)); + draw_character_wire_frame(app, text_layout_id, cursor_pos, roundness, outline_thickness, fcolor_id(defcolor_cursor, cursor_sub_id)); } } } diff --git a/code/custom/4coder_modal.h b/code/custom/4coder_modal.h index f581e140..76c1991d 100644 --- a/code/custom/4coder_modal.h +++ b/code/custom/4coder_modal.h @@ -12,4 +12,6 @@ struct Modal_Mode typedef CUSTOM_COMMAND_SIG(custom_cmd); +function Modal_Mode* modal_get_mode_curr(); + #endif //FRED_MODAL_H