Fixing the frame opening with extremely small window size.
This commit is contained in:
parent
9ed4f0e796
commit
2c0c85e442
|
|
@ -36,14 +36,8 @@ MainFrame::MainFrame()
|
||||||
: wxFrame(NULL, wxID_ANY, "Sample Hive", wxDefaultPosition),
|
: wxFrame(NULL, wxID_ANY, "Sample Hive", wxDefaultPosition),
|
||||||
m_ConfigFilepath("config.yaml"), m_DatabaseFilepath("sample.hive")
|
m_ConfigFilepath("config.yaml"), m_DatabaseFilepath("sample.hive")
|
||||||
{
|
{
|
||||||
int height = 600, width = 800;
|
|
||||||
|
|
||||||
// Load default yaml config file.
|
// Load default yaml config file.
|
||||||
LoadConfigFile(height, width);
|
LoadConfigFile();
|
||||||
|
|
||||||
this->SetSize(width, height);
|
|
||||||
this->CenterOnScreen(wxBOTH);
|
|
||||||
this->SetIcon(wxIcon("../assets/icons/icon-hive_24x24.png", wxICON_DEFAULT_TYPE, -1, -1));
|
|
||||||
|
|
||||||
// Initializing BoxSizers
|
// Initializing BoxSizers
|
||||||
m_MainSizer = new wxBoxSizer(wxVERTICAL);
|
m_MainSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
@ -282,9 +276,8 @@ MainFrame::MainFrame()
|
||||||
|
|
||||||
// Sizer for the frame
|
// Sizer for the frame
|
||||||
this->SetSizer(m_MainSizer);
|
this->SetSizer(m_MainSizer);
|
||||||
m_MainSizer->Fit(this);
|
this->Layout();
|
||||||
m_MainSizer->SetSizeHints(this);
|
this->Center(wxBOTH);
|
||||||
m_MainSizer->Layout();
|
|
||||||
|
|
||||||
// Sizer for the main panel
|
// Sizer for the main panel
|
||||||
m_MainPanel->SetSizer(m_TopSizer);
|
m_MainPanel->SetSizer(m_TopSizer);
|
||||||
|
|
@ -1186,8 +1179,10 @@ void MainFrame::OnCancelSearch(wxCommandEvent& event)
|
||||||
m_SearchBox->Clear();
|
m_SearchBox->Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainFrame::LoadConfigFile(int& height, int& width)
|
void MainFrame::LoadConfigFile()
|
||||||
{
|
{
|
||||||
|
int height = 600, width = 800;
|
||||||
|
|
||||||
Settings settings(m_ConfigFilepath, m_DatabaseFilepath);
|
Settings settings(m_ConfigFilepath, m_DatabaseFilepath);
|
||||||
Serializer serialize(m_ConfigFilepath);
|
Serializer serialize(m_ConfigFilepath);
|
||||||
|
|
||||||
|
|
@ -1198,13 +1193,16 @@ void MainFrame::LoadConfigFile(int& height, int& width)
|
||||||
serialize.DeserializeBrowserControls("loop", bLoop);
|
serialize.DeserializeBrowserControls("loop", bLoop);
|
||||||
serialize.DeserializeBrowserControls("muted", bMuted);
|
serialize.DeserializeBrowserControls("muted", bMuted);
|
||||||
|
|
||||||
serialize.DeserializeWinSize("Height", height);
|
height = serialize.DeserializeWinSize("Height", height);
|
||||||
serialize.DeserializeWinSize("Width", width);
|
width = serialize.DeserializeWinSize("Width", width);
|
||||||
|
|
||||||
settings.GetFontType().SetFaceName(font_face);
|
settings.GetFontType().SetFaceName(font_face);
|
||||||
settings.GetFontType().SetPointSize(font_size);
|
settings.GetFontType().SetPointSize(font_size);
|
||||||
|
|
||||||
this->SetFont(settings.GetFontType());
|
this->SetFont(settings.GetFontType());
|
||||||
|
this->SetSize(width, height);
|
||||||
|
this->CenterOnScreen(wxBOTH);
|
||||||
|
this->SetIcon(wxIcon("../assets/icons/icon-hive_24x24.png", wxICON_DEFAULT_TYPE, -1, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainFrame::RefreshDatabase()
|
void MainFrame::RefreshDatabase()
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ class MainFrame : public wxFrame
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
void LoadDatabase();
|
void LoadDatabase();
|
||||||
void RefreshDatabase();
|
void RefreshDatabase();
|
||||||
void LoadConfigFile(int& height, int& width);
|
void LoadConfigFile();
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Getters
|
// Getters
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue