BookmarkView refresh handling cleanup; reduce flicker and layout errors

This commit is contained in:
Charles J. Cliffe 2019-06-28 00:24:39 -04:00
parent 59687d7a0b
commit 14c546ef9e

View File

@ -721,18 +721,12 @@ void BookmarkView::hideProps(bool hidePanel) {
m_propPanel->Hide(); m_propPanel->Hide();
m_buttonPanel->Hide(); m_buttonPanel->Hide();
} }
refreshLayout();
} }
void BookmarkView::showProps() { void BookmarkView::showProps() {
m_propPanelDivider->Show(); m_propPanelDivider->Show();
m_propPanel->Show(); m_propPanel->Show();
m_propPanel->GetSizer()->Layout();
refreshLayout();
ensureSelectionInView();
} }
@ -740,22 +734,15 @@ void BookmarkView::clearButtons() {
m_buttonPanel->Hide(); m_buttonPanel->Hide();
m_buttonPanel->DestroyChildren(); m_buttonPanel->DestroyChildren();
bookmarkChoice = nullptr; bookmarkChoice = nullptr;
refreshLayout();
} }
void BookmarkView::showButtons() { void BookmarkView::showButtons() {
m_buttonPanel->Show(); m_buttonPanel->Show();
m_buttonPanel->GetSizer()->Layout();
refreshLayout();
ensureSelectionInView();
} }
void BookmarkView::refreshLayout() { void BookmarkView::refreshLayout() {
GetSizer()->Layout(); GetSizer()->Layout();
Update(); ensureSelectionInView();
Refresh();
} }
@ -878,8 +865,6 @@ void BookmarkView::activeSelection(DemodulatorInstancePtr dsel) {
if (dsel == nullptr) { if (dsel == nullptr) {
hideProps(); hideProps();
clearButtons(); clearButtons();
showProps();
showButtons();
refreshLayout(); refreshLayout();
return; return;
} }
@ -1060,7 +1045,6 @@ void BookmarkView::groupSelection(std::string groupName) {
void BookmarkView::rangeSelection(BookmarkRangeEntryPtr re) { void BookmarkView::rangeSelection(BookmarkRangeEntryPtr re) {
clearButtons(); clearButtons();
hideProps(false); hideProps(false);
m_labelText->SetValue(re->label); m_labelText->SetValue(re->label);
@ -1100,14 +1084,12 @@ void BookmarkView::bookmarkBranchSelection() {
void BookmarkView::recentBranchSelection() { void BookmarkView::recentBranchSelection() {
clearButtons(); clearButtons();
hideProps(false); hideProps();
addButton(m_buttonPanel, BOOKMARK_VIEW_STR_CLEAR_RECENT, wxCommandEventHandler( BookmarkView::onClearRecents )); addButton(m_buttonPanel, BOOKMARK_VIEW_STR_CLEAR_RECENT, wxCommandEventHandler( BookmarkView::onClearRecents ));
showButtons(); showButtons();
refreshLayout(); refreshLayout();
this->Layout();
} }
@ -1125,14 +1107,12 @@ void BookmarkView::rangeBranchSelection() {
showButtons(); showButtons();
refreshLayout(); refreshLayout();
this->Layout();
} }
void BookmarkView::activeBranchSelection() { void BookmarkView::activeBranchSelection() {
hideProps(); hideProps();
this->Layout(); refreshLayout();
} }
@ -1157,7 +1137,7 @@ void BookmarkView::onTreeSelect( wxTreeEvent& event ) {
rangeBranchSelection(); rangeBranchSelection();
} else { } else {
hideProps(); hideProps();
this->Layout(); refreshLayout();
} }
return; return;
@ -1180,7 +1160,7 @@ void BookmarkView::onTreeSelect( wxTreeEvent& event ) {
rangeSelection(tvi->rangeEnt); rangeSelection(tvi->rangeEnt);
} else { } else {
hideProps(); hideProps();
this->Layout(); refreshLayout();
} }
} }