Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug adding buttons or changing button commands #1087

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading