From 3ee36b6dbc51348d085055af468295a90b24fb3c Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Tue, 13 May 2025 12:40:37 -0500 Subject: [PATCH] highlight editor right button selected --- src/scenedit/scen.actions.cpp | 12 +++++++++++- src/scenedit/scen.graphics.cpp | 4 ++++ src/scenedit/scen.main.cpp | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/scenedit/scen.actions.cpp b/src/scenedit/scen.actions.cpp index 62adfc81..f30c3dc6 100644 --- a/src/scenedit/scen.actions.cpp +++ b/src/scenedit/scen.actions.cpp @@ -71,6 +71,7 @@ std::vector right_button_status; rectangle right_buttons[NRSONPAGE]; rectangle palette_buttons[10][6]; short current_rs_top = 0; +extern short right_button_hovered; ePalBtn out_buttons[6][10] = { {PAL_PENCIL, PAL_BRUSH_LG, PAL_BRUSH_SM, PAL_SPRAY_LG, PAL_SPRAY_SM, PAL_ERASER, PAL_RECT_HOLLOW, PAL_RECT_FILLED, PAL_BUCKET, PAL_DROPPER}, @@ -186,8 +187,17 @@ void update_mouse_spot(location the_point) { rectangle terrain_rect = ::terrain_rect; terrain_rect.inset(8,8); terrain_rect.right -= 4; - if(overall_mode >= MODE_MAIN_SCREEN) + if(overall_mode >= MODE_MAIN_SCREEN){ set_cursor(sword_curs); + + // Mouse over right-side buttons: highlight which is selected, because accidental misclicks are common + right_button_hovered = -1; + for(int i = 0; i < NRSONPAGE; i++){ + if(the_point.in(right_buttons[i])){ + right_button_hovered = i; + } + } + } else if(terrain_rect.contains(the_point)) { set_cursor(get_edit_cursor()); if(cur_viewing_mode == 0) { diff --git a/src/scenedit/scen.graphics.cpp b/src/scenedit/scen.graphics.cpp index 922f7f87..0769c0fd 100644 --- a/src/scenedit/scen.graphics.cpp +++ b/src/scenedit/scen.graphics.cpp @@ -64,6 +64,7 @@ short mini_map_scales[3] = {12, 6, 4}; //extern btn_t buttons[]; extern location cur_out, mouse_spot; extern ter_num_t current_ground; +extern short right_button_hovered; short num_ir[3] = {12,10,4}; @@ -511,6 +512,9 @@ void draw_rb_slot (short which,short mode) { TextStyle style; if(mode > 0) style.colour = Colours::RED; + else if(right_button_hovered == which - pos) + style.colour = Colours::GREEN; + style.lineHeight = 12; win_draw_string(mainPtr(),text_rect,right_button_status[which].label,eTextMode::WRAP,style); } diff --git a/src/scenedit/scen.main.cpp b/src/scenedit/scen.main.cpp index 82a2eafc..c2f094f5 100644 --- a/src/scenedit/scen.main.cpp +++ b/src/scenedit/scen.main.cpp @@ -60,6 +60,8 @@ short cen_x, cen_y; eScenMode overall_mode = MODE_INTRO_SCREEN; std::shared_ptr right_sbar, pal_sbar; short mode_count = 0; +short right_button_hovered = -1; + cOutdoors* current_terrain; std::string scenario_temp_dir_name = "ed_scenario";