Skip to content

Commit

Permalink
fix: Add Cards toolbar submenu initial load content (fixes twanvl#153)
Browse files Browse the repository at this point in the history
This commit is what broke it, but it did so while referencing some cross platform incompatibility. I hope the method done by this fix avoids that compatibility issue.
  • Loading branch information
haganbmj committed Jul 17, 2022
1 parent 54be634 commit 30b9919
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ HEAD: new items added as changes are made

Features:

Bug fixes:
* Fix Add Cards toolbar not showing script multi-add functions on initial load (twanvl#153)

------------------------------------------------------------------------------
version 2.2.0 (Unofficial), 2022-07-16
------------------------------------------------------------------------------
Expand Down
10 changes: 6 additions & 4 deletions src/gui/set/cards_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@ void CardsPanel::onChangeSet() {
menuCard->Remove(ID_CARD_ADD_MULT);
((wxMenu*)menuCard)->Insert(4,insertManyCardsMenu); // HACK: the position is hardcoded
// also for the toolbar dropdown menu
if (toolAddCard) {
toolAddCard->SetDropdownMenu(makeAddCardsSubmenu(true));
if (toolAddCard) {
// Originally this was using the menu directly, but there are compatibility issues apparently.
// At this point it might be possible to just store a reference to the toolbar directly instead.
toolAddCard->GetToolBar()->SetDropdownMenu(ID_CARD_ADD, makeAddCardsSubmenu(true));
}
}

Expand Down Expand Up @@ -186,7 +188,7 @@ void CardsPanel::initUI(wxToolBar* tb, wxMenuBar* mb) {
add_tool_tr(tb, ID_FORMAT_SYMBOL, "symbol", "symbols", false, wxITEM_CHECK);
add_tool_tr(tb, ID_FORMAT_REMINDER, "reminder", "reminder_text", false, wxITEM_CHECK);
tb->AddSeparator();
add_tool_tr(tb, ID_CARD_ADD, "card_add", "add_card", false, wxITEM_DROPDOWN);
toolAddCard = add_tool_tr(tb, ID_CARD_ADD, "card_add", "add_card", false, wxITEM_DROPDOWN);
tb->SetDropdownMenu(ID_CARD_ADD, makeAddCardsSubmenu(true));
add_tool_tr(tb, ID_CARD_REMOVE, "card_del", "remove_card");
tb->AddSeparator();
Expand Down Expand Up @@ -492,4 +494,4 @@ void CardsPanel::selectFirstCard() {

void CardsPanel::getCardLists(vector<CardListBase*>& out) {
out.push_back(card_list);
}
}

0 comments on commit 30b9919

Please sign in to comment.