Skip to content

Commit

Permalink
Add support for "Edit and Continue" on MSVC
Browse files Browse the repository at this point in the history
Add "Set selected to group" button
  • Loading branch information
crudelios committed Oct 27, 2024
1 parent 72738ba commit aece6f8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ if(${TARGET_PLATFORM} STREQUAL "emscripten" AND NOT DEFINED CMAKE_TOOLCHAIN_FILE
endif()
endif()

# Enable "Edit and Continue" for MSVC
if (POLICY CMP0141)
cmake_policy(SET CMP0141 NEW)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>")
endif()

set(SHORT_NAME augustus)
set(USER_FRIENDLY_NAME Augustus)
project(${SHORT_NAME} C)
Expand Down Expand Up @@ -794,6 +800,12 @@ if(MSVC)
set_source_files_properties(${SOURCE_FILES} PROPERTIES COMPILE_FLAGS "/W4")
set_source_files_properties(${PROJECT_SOURCE_DIR}/res/augustus.rc PROPERTIES COMPILE_FLAGS "")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8 /wd4100 /wd4244")
# message("${CMAKE_MSVC_DEBUG_INFORMATION_FORMAT}")
# message("CMAKE_C_FLAGS: ${CMAKE_C_FLAGS_DEBUG}")
# set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /ZI")
# set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "/SAFESEH:NO /debug /INCREMENTAL /LTCG:OFF")
# set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/SAFESEH:NO /debug /INCREMENTAL /LTCG:OFF")
# set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "/SAFESEH:NO /debug /INCREMENTAL /LTCG:OFF")
endif()

# Show debug info on crash on 32 bit builds compiled with MinGW
Expand Down
12 changes: 10 additions & 2 deletions src/window/editor/scenario_event_details.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ enum {

enum {
DO_NOT_DISABLE = 0,
DISABLE_ON_NO_REPEAT = 1
DISABLE_ON_NO_REPEAT = 1,
DISABLE_ON_NO_SELECTION = 2
};

enum {
Expand Down Expand Up @@ -153,6 +154,7 @@ static generic_button top_buttons[] = {
{222, 138, 190, 25, button_repeat_times},
{272, 166, 50, 25, button_repeat_between, 0, REPEAT_MIN, DISABLE_ON_NO_REPEAT},
{362, 166, 50, 25, button_repeat_between, 0, REPEAT_MAX, DISABLE_ON_NO_REPEAT},
{150, 203, 150, 20, 0, 0, 0, DISABLE_ON_NO_SELECTION}
};

static generic_button select_all_none_buttons[] = {
Expand Down Expand Up @@ -528,7 +530,8 @@ static void draw_foreground(void)

for (unsigned int i = 0; i < NUM_TOP_BUTTONS; i++) {
int focus = data.focus_button.top == i + 1;
if ((top_buttons[i].parameter2 == DISABLE_ON_NO_REPEAT && data.repeat_type == EVENT_REPEAT_NEVER)) {
if ((top_buttons[i].parameter2 == DISABLE_ON_NO_REPEAT && data.repeat_type == EVENT_REPEAT_NEVER) ||
(top_buttons[i].parameter2 == DISABLE_ON_NO_SELECTION && data.conditions.selection_type == CHECKBOX_NO_SELECTION)) {
focus = 0;
}
int width = i < 2 ? 20 : top_buttons[i].width;
Expand All @@ -550,6 +553,11 @@ static void draw_foreground(void)
data.focus_button.bottom == i + 1);
}

// "Set selected to group..." option label
color_t color = data.conditions.selection_type == CHECKBOX_NO_SELECTION ? COLOR_FONT_LIGHT_GRAY : 0;
text_draw_centered(string_from_ascii("Set selected to group..."), top_buttons[6].x, top_buttons[6].y + 5,
top_buttons[6].width, FONT_SMALL_PLAIN, color);

grid_box_draw(&conditions_grid_box);
grid_box_draw(&actions_grid_box);

Expand Down

0 comments on commit aece6f8

Please sign in to comment.