Skip to content

Commit

Permalink
Merge pull request #1087 from reupen/fix-buttons-command-poke
Browse files Browse the repository at this point in the history
Fix bug adding buttons or changing button commands
  • Loading branch information
reupen authored Jan 20, 2025
2 parents b377403 + be160a1 commit 4c79e98
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change log

## 3.0.0-alpha.3

### Bug fixes

- A bug where it wasn’t possible to add new buttons or change existing button
commands in the Buttons toolbar was fixed.
[[#1087](https://github.com/reupen/columns_ui/pull/1087)]

## 3.0.0-alpha.2

### Bug fixes
Expand Down
5 changes: 3 additions & 2 deletions foo_ui_columns/buttons_command_picker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ std::tuple<bool, CommandPickerData> CommandPickerDialog::open_modal(HWND wnd)
dark::DialogDarkModeConfig dark_mode_config{
.button_ids = {IDOK, IDCANCEL}, .list_box_ids = {IDC_GROUP, IDC_ITEM, IDC_COMMAND}};

const auto dialog_result = modal_dialog_box(IDD_BUTTON_COMMAND_PICKER, dark_mode_config, wnd,
[this](auto&&... args) { return on_message(std::forward<decltype(args)>(args)...); });
const auto dialog_result = modal_dialog_box(
IDD_BUTTON_COMMAND_PICKER, dark_mode_config, wnd,
[this](auto&&... args) { return on_message(std::forward<decltype(args)>(args)...); }, false);

return {dialog_result > 0, m_data};
}
Expand Down
8 changes: 5 additions & 3 deletions foo_ui_columns/dark_mode_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,16 +286,18 @@ void DialogDarkModeHelper::on_dark_mode_change()
} // namespace

INT_PTR modal_dialog_box(UINT resource_id, DialogDarkModeConfig dark_mode_config, HWND parent_window,
std::function<INT_PTR(HWND wnd, UINT msg, WPARAM wp, LPARAM lp)> on_message)
std::function<INT_PTR(HWND wnd, UINT msg, WPARAM wp, LPARAM lp)> on_message, bool poke)
{
return fbh::modal_dialog_box(resource_id, parent_window,
return fbh::modal_dialog_box(
resource_id, parent_window,
[helper = std::make_shared<DialogDarkModeHelper>(std::move(dark_mode_config)),
on_message{std::move(on_message)}](HWND wnd, UINT msg, WPARAM wp, LPARAM lp) {
if (const auto result = helper->handle_message(wnd, msg, wp, lp))
return *result;

return on_message(wnd, msg, wp, lp);
});
},
poke);
}

HWND modeless_dialog_box(UINT resource_id, DialogDarkModeConfig dark_mode_config, HWND parent_window,
Expand Down
2 changes: 1 addition & 1 deletion foo_ui_columns/dark_mode_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct DialogDarkModeConfig {
};

INT_PTR modal_dialog_box(UINT resource_id, DialogDarkModeConfig dark_mode_config, HWND parent_window,
std::function<INT_PTR(HWND wnd, UINT msg, WPARAM wp, LPARAM lp)> on_message);
std::function<INT_PTR(HWND wnd, UINT msg, WPARAM wp, LPARAM lp)> on_message, bool poke = true);

HWND modeless_dialog_box(UINT resource_id, DialogDarkModeConfig dark_mode_config, HWND parent_window,
std::function<INT_PTR(HWND wnd, UINT msg, WPARAM wp, LPARAM lp)> on_message);
Expand Down

0 comments on commit 4c79e98

Please sign in to comment.