1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Antoine Cellerier 2007-06-10 20:13:24 +00:00
parent 2cda994431
commit d86e1a4998
2 changed files with 39 additions and 18 deletions

View file

@ -54,6 +54,7 @@ wxSize ImageCtrl::DoGetBestSize() const
BEGIN_EVENT_TABLE(ThemeCtrl, wxPanel) BEGIN_EVENT_TABLE(ThemeCtrl, wxPanel)
EVT_LISTBOX(ID_THEME_LST, ThemeCtrl::OnThemesLst) EVT_LISTBOX(ID_THEME_LST, ThemeCtrl::OnThemesLst)
EVT_BUTTON(ID_THEME_SELECT_ALL, ThemeCtrl::OnSelectAll)
END_EVENT_TABLE() END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(ThemeCtrl, wxPanel) IMPLEMENT_DYNAMIC_CLASS(ThemeCtrl, wxPanel)
@ -82,7 +83,7 @@ void ThemeCtrl::CreateControls()
topSizer->Add(horizontalSizer, 0, wxALIGN_LEFT|wxALL, 5); topSizer->Add(horizontalSizer, 0, wxALIGN_LEFT|wxALL, 5);
//Device Selection //Device Selection
wxBoxSizer* wxBoxSizer7 = new wxBoxSizer(wxVERTICAL); wxBoxSizer* wxBoxSizer7 = new wxBoxSizer(wxVERTICAL);
horizontalSizer->Add(wxBoxSizer7,0,wxGROW | wxALL,0); horizontalSizer->Add(wxBoxSizer7,0,wxGROW | wxALL,0);
wxStaticText* m_desc = new wxStaticText( this, wxID_STATIC, wxStaticText* m_desc = new wxStaticText( this, wxID_STATIC,
@ -94,6 +95,10 @@ void ThemeCtrl::CreateControls()
wxDefaultSize,0,NULL,wxLB_EXTENDED); wxDefaultSize,0,NULL,wxLB_EXTENDED);
wxBoxSizer7->Add(m_themeList, 0, wxALIGN_LEFT|wxALL, 5); 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 // Preview Picture
wxBoxSizer* wxBoxSizer9 = new wxBoxSizer(wxVERTICAL); wxBoxSizer* wxBoxSizer9 = new wxBoxSizer(wxVERTICAL);
horizontalSizer->Add(wxBoxSizer9,0,wxGROW | wxALL,0); horizontalSizer->Add(wxBoxSizer9,0,wxGROW | wxALL,0);
@ -221,6 +226,11 @@ void ThemeCtrl::setDevice(wxString device)
void ThemeCtrl::OnThemesLst(wxCommandEvent& event) void ThemeCtrl::OnThemesLst(wxCommandEvent& event)
{
ThemePreview();
}
void ThemeCtrl::ThemePreview()
{ {
// wxCriticalSectionLocker locker(m_ThemeSelectSection); // wxCriticalSectionLocker locker(m_ThemeSelectSection);
@ -261,7 +271,7 @@ void ThemeCtrl::OnThemesLst(wxCommandEvent& event)
bmp.LoadFile(m_currentimage,wxBITMAP_TYPE_PNG); bmp.LoadFile(m_currentimage,wxBITMAP_TYPE_PNG);
m_PreviewBitmap->SetBitmap(bmp); m_PreviewBitmap->SetBitmap(bmp);
Refresh(); Refresh();
this->GetSizer()->Layout(); this->GetSizer()->Layout();
this->GetSizer()->Fit(this); this->GetSizer()->Fit(this);
this->GetSizer()->SetSizeHints(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; wxArrayString themes;
wxArrayInt selected; wxArrayInt selected;
int numSelected = m_themeList->GetSelections(selected); int numSelected = m_themeList->GetSelections(selected);
@ -361,7 +377,7 @@ void DeviceSelectorCtrl::CreateControls()
//Device Selection //Device Selection
wxBoxSizer* horizontalSizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* horizontalSizer = new wxBoxSizer(wxHORIZONTAL);
topSizer->Add(horizontalSizer, 0, wxALIGN_LEFT|wxALL, 5); 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, wxT("Device:"), wxDefaultPosition,
wxDefaultSize, 0 ); wxDefaultSize, 0 );
horizontalSizer->Add(m_desc, 0, wxALIGN_LEFT|wxALL, 5); horizontalSizer->Add(m_desc, 0, wxALIGN_LEFT|wxALL, 5);
@ -405,9 +421,9 @@ void DeviceSelectorCtrl::OnComboBox(wxCommandEvent& event)
if(index == -1) if(index == -1)
{ {
m_currentDevice = wxT(""); m_currentDevice = wxT("");
return; return;
} }
gv->curplat = gv->plat_id[index]; gv->curplat = gv->plat_id[index];
} }
@ -418,7 +434,7 @@ void DeviceSelectorCtrl::OnAutoDetect(wxCommandEvent& event)
int n = ipod_scan(&ipod); int n = ipod_scan(&ipod);
if(n == 1) if(n == 1)
{ {
wxString temp(ipod.targetname,wxConvUTF8); wxString temp(ipod.targetname,wxConvUTF8);
int index = gv->plat_bootloadername.Index(temp); // use the bootloader names.. int index = gv->plat_bootloadername.Index(temp); // use the bootloader names..
m_deviceCbx->SetValue(gv->plat_name[index]); m_deviceCbx->SetValue(gv->plat_name[index]);
gv->curplat=gv->plat_id[index]; gv->curplat=gv->plat_id[index];

View file

@ -45,11 +45,12 @@ DECLARE_DYNAMIC_CLASS(ThemeCtrl)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
public: public:
enum { enum {
ID_DESC = 10001, ID_DESC = 10001,
ID_FILESIZE= 10002, ID_FILESIZE= 10002,
ID_INSTALLCHECKBOX= 10003, ID_INSTALLCHECKBOX= 10003,
ID_PREVIEW_BITMAP = 10004, ID_PREVIEW_BITMAP = 10004,
ID_THEME_LST = 10005, ID_THEME_LST = 10005,
ID_THEME_SELECT_ALL = 10006
}; //End of Enum }; //End of Enum
public: public:
@ -77,17 +78,21 @@ public:
void Init(); void Init();
// Event handlers // Event handlers
void OnThemesLst(wxCommandEvent& event); void OnThemesLst(wxCommandEvent& event);
void OnSelectAll(wxCommandEvent& event);
void OnCheckBox(wxCommandEvent& event); void OnCheckBox(wxCommandEvent& event);
void setDevice(wxString device); void setDevice(wxString device);
wxArrayString getThemesToInstall(); wxArrayString getThemesToInstall();
protected: protected:
void ThemePreview(void);
wxString m_currentimage; wxString m_currentimage;
wxString m_currentResolution; wxString m_currentResolution;
wxStaticText* m_desc; wxStaticText* m_desc;
wxListBox* m_themeList; wxListBox* m_themeList;
wxButton* m_selectAllThemes;
wxStaticText* m_size; wxStaticText* m_size;
wxTextCtrl* m_themedesc; wxTextCtrl* m_themedesc;
ImageCtrl* m_PreviewBitmap; ImageCtrl* m_PreviewBitmap;
@ -141,8 +146,8 @@ DECLARE_DYNAMIC_CLASS(DeviceSelectorCtrl)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
public: public:
enum { enum {
ID_DEVICE_CBX = 10001, ID_DEVICE_CBX = 10001,
ID_AUTODETECT_BTN= 10002, ID_AUTODETECT_BTN= 10002,
}; //End of Enum }; //End of Enum
public: public:
@ -187,7 +192,7 @@ DECLARE_DYNAMIC_CLASS(DevicePositionCtrl)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
public: public:
enum { enum {
ID_BROWSE_BTN = 10003, ID_BROWSE_BTN = 10003,
}; //End of Enum }; //End of Enum
public: public:
@ -234,7 +239,7 @@ DECLARE_DYNAMIC_CLASS(FirmwarePositionCtrl)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
public: public:
enum { enum {
ID_BROWSE_BTN = 10004, ID_BROWSE_BTN = 10004,
}; //End of Enum }; //End of Enum
public: public: