Layout tweaks, fixes

This commit is contained in:
Charles J. Cliffe 2016-11-14 23:16:08 -05:00
parent 1d1aa515de
commit 9c7ff0598c
4 changed files with 32 additions and 35 deletions

View File

@ -15,7 +15,7 @@ BookmarkPanel::BookmarkPanel( wxWindow* parent, wxWindowID id, const wxPoint& po
bSizer1 = new wxBoxSizer( wxVERTICAL );
m_treeView = new wxTreeCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE|wxTR_EDIT_LABELS|wxTR_HAS_VARIABLE_ROW_HEIGHT|wxTR_HIDE_ROOT|wxTR_SINGLE );
bSizer1->Add( m_treeView, 5, wxEXPAND, 5 );
bSizer1->Add( m_treeView, 1, wxEXPAND, 5 );
m_propPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxFlexGridSizer* fgPropSizer;
@ -59,7 +59,7 @@ BookmarkPanel::BookmarkPanel( wxWindow* parent, wxWindowID id, const wxPoint& po
m_propPanel->SetSizer( fgPropSizer );
m_propPanel->Layout();
fgPropSizer->Fit( m_propPanel );
bSizer1->Add( m_propPanel, 1, wxBOTTOM|wxEXPAND|wxTOP, 5 );
bSizer1->Add( m_propPanel, 0, wxALL|wxBOTTOM|wxEXPAND|wxTOP, 5 );
m_buttonPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* m_buttonPanelSizer;
@ -69,7 +69,7 @@ BookmarkPanel::BookmarkPanel( wxWindow* parent, wxWindowID id, const wxPoint& po
m_buttonPanel->SetSizer( m_buttonPanelSizer );
m_buttonPanel->Layout();
m_buttonPanelSizer->Fit( m_buttonPanel );
bSizer1->Add( m_buttonPanel, 1, wxEXPAND, 5 );
bSizer1->Add( m_buttonPanel, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( bSizer1 );

View File

@ -86,7 +86,7 @@
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">5</property>
<property name="proportion">1</property>
<object class="wxTreeCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -187,8 +187,8 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxTOP</property>
<property name="proportion">1</property>
<property name="flag">wxALL|wxBOTTOM|wxEXPAND|wxTOP</property>
<property name="proportion">0</property>
<object class="wxPanel" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -952,8 +952,8 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>

View File

@ -21,10 +21,8 @@ BookmarkView::BookmarkView( wxWindow* parent, wxWindowID id, const wxPoint& pos,
dragItemId = nullptr;
hideProps();
m_propPanel->Hide();
m_updateTimer.Start(500);
// m_treeView->SetDropEffectAboveItem();
mouseInView.store(false);
}
@ -52,7 +50,7 @@ void BookmarkView::updateTheme() {
wxColour btn(ThemeMgr::mgr.currentTheme->button);
wxColour btnHl(ThemeMgr::mgr.currentTheme->buttonHighlight);
this->SetBackgroundColour(ThemeMgr::mgr.currentTheme->generalBackground * 4.0);
SetBackgroundColour(bgColor);
m_treeView->SetBackgroundColour(bgColor);
m_treeView->SetForegroundColour(textColor);
@ -69,9 +67,6 @@ void BookmarkView::updateTheme() {
m_modulationLabel->SetForegroundColour(textColor);
m_buttonPanel->SetBackgroundColour(bgColor);
for (auto p : m_buttonPanel->GetChildren()) {
p->SetBackgroundColour(bgColor);
}
}
@ -266,21 +261,32 @@ void BookmarkView::hideProps() {
m_labelText->Hide();
m_labelLabel->Hide();
m_propPanel->Hide();
m_buttonPanel->Hide();
}
void BookmarkView::showProps() {
m_propPanel->Show();
m_propPanel->GetSizer()->Layout();
}
void BookmarkView::clearButtons() {
m_buttonPanel->DestroyChildren();
m_buttonPanel->Hide();
m_buttonPanel->DestroyChildren();
}
void BookmarkView::showButtons() {
m_buttonPanel->Show();
// m_buttonPanel->Layout();
m_buttonPanel->GetSizer()->Layout();
}
void BookmarkView::refreshLayout() {
GetSizer()->Layout();
Update();
}
wxButton *BookmarkView::makeButton(wxWindow *parent, std::string labelVal, wxObjectEventFunction handler) {
wxButton *nButton = new wxButton( m_buttonPanel, wxID_ANY, labelVal);
@ -325,9 +331,9 @@ void BookmarkView::activeSelection(DemodulatorInstance *dsel) {
addButton(m_buttonPanel, "Bookmark Active", wxCommandEventHandler( BookmarkView::onBookmarkActive ));
addButton(m_buttonPanel, "Remove Active", wxCommandEventHandler( BookmarkView::onRemoveActive ));
showProps();
showButtons();
this->Layout();
refreshLayout();
}
@ -373,9 +379,9 @@ void BookmarkView::bookmarkSelection(BookmarkEntry *bmSel) {
addButton(m_buttonPanel, "Activate Bookmark", wxCommandEventHandler( BookmarkView::onActivateBookmark ));
addButton(m_buttonPanel, "Remove Bookmark", wxCommandEventHandler( BookmarkView::onRemoveBookmark ));
showProps();
showButtons();
this->Layout();
refreshLayout();
}
@ -408,9 +414,9 @@ void BookmarkView::recentSelection(BookmarkEntry *bmSel) {
addButton(m_buttonPanel, "Activate Recent", wxCommandEventHandler( BookmarkView::onActivateRecent ));
addButton(m_buttonPanel, "Bookmark Recent", wxCommandEventHandler( BookmarkView::onBookmarkRecent ));
showProps();
showButtons();
this->Layout();
refreshLayout();
}
void BookmarkView::groupSelection(std::string groupName) {
@ -427,8 +433,7 @@ void BookmarkView::groupSelection(std::string groupName) {
addButton(m_buttonPanel, "Rename Group", wxCommandEventHandler( BookmarkView::onRenameGroup ));
showButtons();
this->Layout();
refreshLayout();
}
@ -438,26 +443,22 @@ void BookmarkView::bookmarkBranchSelection() {
bookmarkSel = nullptr;
clearButtons();
hideProps();
addButton(m_buttonPanel, "Add Group", wxCommandEventHandler( BookmarkView::onAddGroup ));
showButtons();
this->Layout();
refreshLayout();
}
void BookmarkView::recentBranchSelection() {
m_propPanel->Hide();
hideProps();
this->Layout();
}
void BookmarkView::activeBranchSelection() {
m_propPanel->Hide();
hideProps();
this->Layout();
}
@ -476,7 +477,6 @@ void BookmarkView::onTreeSelect( wxTreeEvent& event ) {
} else if (itm == recentBranch) {
recentBranchSelection();
} else {
m_propPanel->Hide();
hideProps();
this->Layout();
}
@ -485,20 +485,15 @@ void BookmarkView::onTreeSelect( wxTreeEvent& event ) {
}
if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
m_propPanel->Show();
activeSelection(tvi->demod);
wxGetApp().getDemodMgr().setActiveDemodulator(tvi->demod, false);
} else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RECENT) {
m_propPanel->Show();
recentSelection(tvi->bookmarkEnt);
} else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) {
m_propPanel->Show();
bookmarkSelection(tvi->bookmarkEnt);
} else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_GROUP) {
m_propPanel->Show();
groupSelection(tvi->groupName);
} else {
m_propPanel->Hide();
hideProps();
this->Layout();
}

View File

@ -50,6 +50,7 @@ public:
protected:
void hideProps();
void showProps();
void onUpdateTimer( wxTimerEvent& event );
void doUpdateActiveList();
@ -75,6 +76,7 @@ protected:
void clearButtons();
void showButtons();
void refreshLayout();
wxButton *makeButton(wxWindow *parent, std::string labelVal, wxObjectEventFunction handler);
wxButton *addButton(wxWindow *parent, std::string labelVal, wxObjectEventFunction handler);