From d86e1a4998fdad8b6dafc92ebb0ab85c026c9a08 Mon Sep 17 00:00:00 2001 From: Antoine Cellerier Date: Sun, 10 Jun 2007 20:13:24 +0000 Subject: Add "Select All" button to the themes installer. Remove a bunch of tabs. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13610 a1c6a512-1295-4272-9138-f99709370657 --- rbutil/rbutilCtrls.cpp | 34 +++++++++++++++++++++++++--------- rbutil/rbutilCtrls.h | 23 ++++++++++++++--------- 2 files changed, 39 insertions(+), 18 deletions(-) (limited to 'rbutil') diff --git a/rbutil/rbutilCtrls.cpp b/rbutil/rbutilCtrls.cpp index aef37fd0d3..e8a3f9e320 100644 --- a/rbutil/rbutilCtrls.cpp +++ b/rbutil/rbutilCtrls.cpp @@ -54,6 +54,7 @@ wxSize ImageCtrl::DoGetBestSize() const BEGIN_EVENT_TABLE(ThemeCtrl, wxPanel) EVT_LISTBOX(ID_THEME_LST, ThemeCtrl::OnThemesLst) + EVT_BUTTON(ID_THEME_SELECT_ALL, ThemeCtrl::OnSelectAll) END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(ThemeCtrl, wxPanel) @@ -82,7 +83,7 @@ void ThemeCtrl::CreateControls() topSizer->Add(horizontalSizer, 0, wxALIGN_LEFT|wxALL, 5); //Device Selection - wxBoxSizer* wxBoxSizer7 = new wxBoxSizer(wxVERTICAL); + wxBoxSizer* wxBoxSizer7 = new wxBoxSizer(wxVERTICAL); horizontalSizer->Add(wxBoxSizer7,0,wxGROW | wxALL,0); wxStaticText* m_desc = new wxStaticText( this, wxID_STATIC, @@ -94,6 +95,10 @@ void ThemeCtrl::CreateControls() wxDefaultSize,0,NULL,wxLB_EXTENDED); wxBoxSizer7->Add(m_themeList, 0, wxALIGN_LEFT|wxALL, 5); + m_selectAllThemes = new wxButton(this, ID_THEME_SELECT_ALL, + wxT("Select All")); + wxBoxSizer7->Add(m_selectAllThemes, 0, wxALIGN_LEFT|wxALL, 5); + // Preview Picture wxBoxSizer* wxBoxSizer9 = new wxBoxSizer(wxVERTICAL); horizontalSizer->Add(wxBoxSizer9,0,wxGROW | wxALL,0); @@ -221,6 +226,11 @@ void ThemeCtrl::setDevice(wxString device) void ThemeCtrl::OnThemesLst(wxCommandEvent& event) +{ + ThemePreview(); +} + +void ThemeCtrl::ThemePreview() { // wxCriticalSectionLocker locker(m_ThemeSelectSection); @@ -261,7 +271,7 @@ void ThemeCtrl::OnThemesLst(wxCommandEvent& event) bmp.LoadFile(m_currentimage,wxBITMAP_TYPE_PNG); m_PreviewBitmap->SetBitmap(bmp); - Refresh(); + Refresh(); this->GetSizer()->Layout(); this->GetSizer()->Fit(this); this->GetSizer()->SetSizeHints(this); @@ -272,9 +282,15 @@ void ThemeCtrl::OnThemesLst(wxCommandEvent& event) } +void ThemeCtrl::OnSelectAll(wxCommandEvent& event) +{ + for(unsigned int i=0; i < m_themeList->GetCount(); i++) + m_themeList->Select(i); + ThemePreview(); +} - wxArrayString ThemeCtrl::getThemesToInstall() - { +wxArrayString ThemeCtrl::getThemesToInstall() +{ wxArrayString themes; wxArrayInt selected; int numSelected = m_themeList->GetSelections(selected); @@ -361,7 +377,7 @@ void DeviceSelectorCtrl::CreateControls() //Device Selection wxBoxSizer* horizontalSizer = new wxBoxSizer(wxHORIZONTAL); topSizer->Add(horizontalSizer, 0, wxALIGN_LEFT|wxALL, 5); - m_desc = new wxStaticText( this, wxID_STATIC, + m_desc = new wxStaticText( this, wxID_STATIC, wxT("Device:"), wxDefaultPosition, wxDefaultSize, 0 ); horizontalSizer->Add(m_desc, 0, wxALIGN_LEFT|wxALL, 5); @@ -405,9 +421,9 @@ void DeviceSelectorCtrl::OnComboBox(wxCommandEvent& event) if(index == -1) { - m_currentDevice = wxT(""); - return; - } + m_currentDevice = wxT(""); + return; + } gv->curplat = gv->plat_id[index]; } @@ -418,7 +434,7 @@ void DeviceSelectorCtrl::OnAutoDetect(wxCommandEvent& event) int n = ipod_scan(&ipod); if(n == 1) { - wxString temp(ipod.targetname,wxConvUTF8); + wxString temp(ipod.targetname,wxConvUTF8); int index = gv->plat_bootloadername.Index(temp); // use the bootloader names.. m_deviceCbx->SetValue(gv->plat_name[index]); gv->curplat=gv->plat_id[index]; diff --git a/rbutil/rbutilCtrls.h b/rbutil/rbutilCtrls.h index 1b084a88d9..53690a251e 100644 --- a/rbutil/rbutilCtrls.h +++ b/rbutil/rbutilCtrls.h @@ -45,11 +45,12 @@ DECLARE_DYNAMIC_CLASS(ThemeCtrl) DECLARE_EVENT_TABLE() public: enum { - ID_DESC = 10001, - ID_FILESIZE= 10002, - ID_INSTALLCHECKBOX= 10003, - ID_PREVIEW_BITMAP = 10004, - ID_THEME_LST = 10005, + ID_DESC = 10001, + ID_FILESIZE= 10002, + ID_INSTALLCHECKBOX= 10003, + ID_PREVIEW_BITMAP = 10004, + ID_THEME_LST = 10005, + ID_THEME_SELECT_ALL = 10006 }; //End of Enum public: @@ -77,17 +78,21 @@ public: void Init(); // Event handlers void OnThemesLst(wxCommandEvent& event); + void OnSelectAll(wxCommandEvent& event); void OnCheckBox(wxCommandEvent& event); void setDevice(wxString device); wxArrayString getThemesToInstall(); protected: + void ThemePreview(void); + wxString m_currentimage; wxString m_currentResolution; wxStaticText* m_desc; wxListBox* m_themeList; + wxButton* m_selectAllThemes; wxStaticText* m_size; wxTextCtrl* m_themedesc; ImageCtrl* m_PreviewBitmap; @@ -141,8 +146,8 @@ DECLARE_DYNAMIC_CLASS(DeviceSelectorCtrl) DECLARE_EVENT_TABLE() public: enum { - ID_DEVICE_CBX = 10001, - ID_AUTODETECT_BTN= 10002, + ID_DEVICE_CBX = 10001, + ID_AUTODETECT_BTN= 10002, }; //End of Enum public: @@ -187,7 +192,7 @@ DECLARE_DYNAMIC_CLASS(DevicePositionCtrl) DECLARE_EVENT_TABLE() public: enum { - ID_BROWSE_BTN = 10003, + ID_BROWSE_BTN = 10003, }; //End of Enum public: @@ -234,7 +239,7 @@ DECLARE_DYNAMIC_CLASS(FirmwarePositionCtrl) DECLARE_EVENT_TABLE() public: enum { - ID_BROWSE_BTN = 10004, + ID_BROWSE_BTN = 10004, }; //End of Enum public: -- cgit v1.2.3