2006-07-05 21:36:56 +00:00
|
|
|
#include "stdwx.h"
|
|
|
|
|
|
|
|
// Don't modify comment
|
|
|
|
#include "sg_DlgPreferences.h"
|
|
|
|
#include "sg_SkinClass.h"
|
|
|
|
//[inc]add your include files here
|
|
|
|
|
|
|
|
//[inc]end your include
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
ID_OPENBUTTON = 10001,
|
|
|
|
ID_SAVEBUTTON = 10002,
|
|
|
|
ID_CANCELBUTTON = 10003,
|
|
|
|
ID_SKINPICKERCMBBOX = 10004,
|
2006-07-11 23:19:53 +00:00
|
|
|
ID_DOWORKONLYBGNCMBBOX = 10005,
|
|
|
|
ID_DOCONNECTONLYBGNCMBBOX = 10006,
|
2006-07-05 21:36:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE( CDlgPreferences,wxDialog)
|
|
|
|
EVT_COMBOBOX(-1,CDlgPreferences::OnCmbSelected)
|
|
|
|
EVT_BUTTON(-1,CDlgPreferences::OnBtnClick)
|
|
|
|
EVT_ERASE_BACKGROUND(CDlgPreferences::OnEraseBackground)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
// end events
|
|
|
|
|
|
|
|
CDlgPreferences::CDlgPreferences(wxWindow* parent, wxString dirPref,wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,long style,const wxString& name)
|
|
|
|
{
|
|
|
|
m_SkinDirPrefix = dirPref;
|
|
|
|
OnPreCreate();
|
|
|
|
Create(parent,id,title,pos,size,style,name);
|
|
|
|
|
|
|
|
if((pos==wxDefaultPosition)&&(size==wxDefaultSize)){
|
|
|
|
SetSize(0,0,400,450);
|
|
|
|
}
|
|
|
|
|
|
|
|
if((pos!=wxDefaultPosition)&&(size==wxDefaultSize)){
|
|
|
|
SetSize(400,450);
|
|
|
|
}
|
|
|
|
initBefore();
|
|
|
|
// load images from skin file
|
|
|
|
LoadSkinImages();
|
|
|
|
//Create dialog
|
|
|
|
InitDialog();
|
|
|
|
initAfter();
|
|
|
|
}
|
|
|
|
CDlgPreferences::~CDlgPreferences()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CDlgPreferences::InitDialog()
|
|
|
|
{
|
|
|
|
SetBackgroundColour(appSkin->GetAppBgCol());
|
2006-07-11 23:19:53 +00:00
|
|
|
wxString itmsHourIntervals[]={wxT("Always"),wxT("12:00 AM"),wxT("1:00 AM"),wxT("2:00 AM"),wxT("3:00 AM"),wxT("4:00 AM"),wxT("5:00 AM"),wxT("6:00 AM"),wxT("7:00 AM"),wxT("8:00 AM"),wxT("9:00 AM"),wxT("10:00 AM"),wxT("11:00 AM"),wxT("12:00 PM"),
|
|
|
|
wxT("13:00 PM"),wxT("14:00 PM"),wxT("15:00 PM"),wxT("16:00 PM"),wxT("17:00 PM"),wxT("18:00 PM"),wxT("19:00 PM"),wxT("20:00 PM"),wxT("21:00 PM"),wxT("22:00 PM"),wxT("23:00 PM")};
|
|
|
|
wxString itmsHourIntervalsNoAlways[]={wxT("12:00 AM"),wxT("1:00 AM"),wxT("2:00 AM"),wxT("3:00 AM"),wxT("4:00 AM"),wxT("5:00 AM"),wxT("6:00 AM"),wxT("7:00 AM"),wxT("8:00 AM"),wxT("9:00 AM"),wxT("10:00 AM"),wxT("11:00 AM"),wxT("12:00 PM"),
|
|
|
|
wxT("13:00 PM"),wxT("14:00 PM"),wxT("15:00 PM"),wxT("16:00 PM"),wxT("17:00 PM"),wxT("18:00 PM"),wxT("19:00 PM"),wxT("20:00 PM"),wxT("21:00 PM"),wxT("22:00 PM"),wxT("23:00 PM")};
|
|
|
|
|
2006-07-05 21:36:56 +00:00
|
|
|
|
2006-07-11 23:19:53 +00:00
|
|
|
lblPref=new wxStaticText(this,-1,wxT(""),wxPoint(10,10),wxSize(84,18),wxST_NO_AUTORESIZE);
|
2006-07-05 21:36:56 +00:00
|
|
|
lblPref->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
|
|
|
lblPref->SetLabel(wxT("Preferences"));
|
|
|
|
lblPref->SetFont(wxFont(12,74,90,90,0,wxT("Tahoma")));
|
|
|
|
// Modify settings for this computer
|
2006-07-11 23:19:53 +00:00
|
|
|
lblModifySett=new wxStaticText(this,-1,wxT(""),wxPoint(15,60),wxSize(164,13),wxST_NO_AUTORESIZE);
|
2006-07-05 21:36:56 +00:00
|
|
|
lblModifySett->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
|
|
|
lblModifySett->SetLabel(wxT("Modify settings for this computer:"));
|
|
|
|
// Do work only between
|
2006-07-11 23:19:53 +00:00
|
|
|
lblDoWorkBtwn=new wxStaticText(this,-1,wxT(""),wxPoint(65,95),wxSize(114,13),wxST_NO_AUTORESIZE);
|
2006-07-05 21:36:56 +00:00
|
|
|
lblDoWorkBtwn->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
|
|
|
lblDoWorkBtwn->SetLabel(wxT("Do work only between:"));
|
2006-07-11 23:19:53 +00:00
|
|
|
cmbDWBtwnBgn=new wxComboBox(this,ID_DOWORKONLYBGNCMBBOX,wxT(""),wxPoint(180,90),wxSize(85,21),24,itmsHourIntervals,wxNO_BORDER | wxCB_READONLY);
|
2006-07-05 21:36:56 +00:00
|
|
|
cmbDWBtwnBgn->SetValue(wxT("Always"));
|
2006-07-11 23:19:53 +00:00
|
|
|
lblAnd1=new wxStaticText(this,-1,wxT(""),wxPoint(270,95),wxSize(19,13),wxST_NO_AUTORESIZE);
|
2006-07-05 21:36:56 +00:00
|
|
|
lblAnd1->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
|
|
|
lblAnd1->SetLabel(wxT("and"));
|
|
|
|
lblAnd1->Show(false);
|
2006-07-11 23:19:53 +00:00
|
|
|
cmbDWBtwnEnd=new wxComboBox(this,-1,wxT(""),wxPoint(295,90),wxSize(85,21),24,itmsHourIntervalsNoAlways,wxNO_BORDER | wxCB_READONLY);
|
|
|
|
cmbDWBtwnEnd->SetValue(wxT("12:00 AM"));
|
2006-07-05 21:36:56 +00:00
|
|
|
cmbDWBtwnEnd->Show(false);
|
|
|
|
///Connect to internet only between
|
2006-07-11 23:19:53 +00:00
|
|
|
lblConnToIntBtwn=new wxStaticText(this,-1,wxT(""),wxPoint(10,130),wxSize(169,13),wxST_NO_AUTORESIZE);
|
2006-07-05 21:36:56 +00:00
|
|
|
lblConnToIntBtwn->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
|
|
|
lblConnToIntBtwn->SetLabel(wxT("Connect to internet only between:"));
|
2006-07-11 23:19:53 +00:00
|
|
|
cmbCTIBtwnBgn=new wxComboBox(this,ID_DOCONNECTONLYBGNCMBBOX,wxT(""),wxPoint(180,125),wxSize(85,21),24,itmsHourIntervals,wxNO_BORDER | wxCB_READONLY);
|
2006-07-05 21:36:56 +00:00
|
|
|
cmbCTIBtwnBgn->SetValue(wxT("Always"));
|
2006-07-11 23:19:53 +00:00
|
|
|
lblAnd2=new wxStaticText(this,-1,wxT(""),wxPoint(270,130),wxSize(19,13),wxST_NO_AUTORESIZE);
|
2006-07-05 21:36:56 +00:00
|
|
|
lblAnd2->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
|
|
|
lblAnd2->SetLabel(wxT("and"));
|
|
|
|
lblAnd2->Show(false);
|
2006-07-11 23:19:53 +00:00
|
|
|
cmbCTIBtwnEnd=new wxComboBox(this,-1,wxT(""),wxPoint(295,125),wxSize(85,21),24,itmsHourIntervalsNoAlways,wxNO_BORDER | wxCB_READONLY);
|
|
|
|
cmbCTIBtwnEnd->SetValue(wxT("12:00 AM"));
|
2006-07-05 21:36:56 +00:00
|
|
|
cmbCTIBtwnEnd->Show(false);
|
|
|
|
///Use no more than
|
2006-07-11 23:19:53 +00:00
|
|
|
lblUseNoMoreGB=new wxStaticText(this,-1,wxT(""),wxPoint(85,165),wxSize(94,13),wxST_NO_AUTORESIZE);
|
2006-07-05 21:36:56 +00:00
|
|
|
lblUseNoMoreGB->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
|
|
|
lblUseNoMoreGB->SetLabel(wxT("Use no more than:"));
|
|
|
|
wxString itmsUseNoMoreGB[]={wxT("100MB"),wxT("200MB"),wxT("500MB"),wxT("1GB"),wxT("2GB"),wxT("5GB")};
|
2006-07-11 23:19:53 +00:00
|
|
|
cmbUseNoMoreGB=new wxComboBox(this,-1,wxT(""),wxPoint(180,160),wxSize(85,21),5,itmsUseNoMoreGB,wxNO_BORDER | wxCB_READONLY);
|
2006-07-05 21:36:56 +00:00
|
|
|
cmbUseNoMoreGB->SetValue(wxT("500MB"));
|
2006-07-11 23:19:53 +00:00
|
|
|
lblGB=new wxStaticText(this,-1,wxT(""),wxPoint(270,165),wxSize(14,13),wxST_NO_AUTORESIZE);
|
2006-07-05 21:36:56 +00:00
|
|
|
lblGB->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
|
|
|
lblGB->SetLabel(wxT("GB"));
|
|
|
|
/// Do work while computer is in use
|
2006-07-11 23:19:53 +00:00
|
|
|
lblDWWCInUse=new wxStaticText(this,-1,wxT(""),wxPoint(15,200),wxSize(164,13),wxST_NO_AUTORESIZE);
|
2006-07-05 21:36:56 +00:00
|
|
|
lblDWWCInUse->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
|
|
|
lblDWWCInUse->SetLabel(wxT("Do work while computer is in use?"));
|
|
|
|
wxString itmsDWWCInUse[]={wxT("Yes"),wxT("No")};
|
2006-07-11 23:19:53 +00:00
|
|
|
cmbDWWCInUse=new wxComboBox(this,-1,wxT(""),wxPoint(180,195),wxSize(45,21),2,itmsDWWCInUse,wxNO_BORDER | wxCB_READONLY);
|
2006-07-05 21:36:56 +00:00
|
|
|
cmbDWWCInUse->SetValue(wxT("Yes"));
|
|
|
|
///Do work after computer is idle for
|
2006-07-11 23:19:53 +00:00
|
|
|
lblDWACIdleFor=new wxStaticText(this,-1,wxT(""),wxPoint(15,235),wxSize(164,13),wxST_NO_AUTORESIZE);
|
2006-07-05 21:36:56 +00:00
|
|
|
lblDWACIdleFor->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
|
|
|
lblDWACIdleFor->SetLabel(wxT("Do work after computer is idle for:"));
|
|
|
|
wxString itmsDWACIdleFor[]={wxT("1"),wxT("5"),wxT("10"),wxT("15"),wxT("30"),wxT("60")};
|
2006-07-11 23:19:53 +00:00
|
|
|
cmbDWACIdleFor=new wxComboBox(this,-1,wxT(""),wxPoint(180,230),wxSize(85,21),5,itmsDWACIdleFor,wxNO_BORDER | wxCB_READONLY);
|
2006-07-05 21:36:56 +00:00
|
|
|
cmbDWACIdleFor->SetValue(wxT("5"));
|
2006-07-11 23:19:53 +00:00
|
|
|
lblMinutes=new wxStaticText(this,-1,wxT(""),wxPoint(270,235),wxSize(39,13),wxST_NO_AUTORESIZE);
|
2006-07-05 21:36:56 +00:00
|
|
|
lblMinutes->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
|
|
|
lblMinutes->SetLabel(wxT("minutes"));
|
|
|
|
////Skin XML file
|
2006-07-11 23:19:53 +00:00
|
|
|
lblSkinXML=new wxStaticText(this,-1,wxT(""),wxPoint(115,270),wxSize(64,13),wxST_NO_AUTORESIZE);
|
2006-07-05 21:36:56 +00:00
|
|
|
lblSkinXML->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BACKGROUND));
|
|
|
|
lblSkinXML->SetLabel(wxT("Skin XML file:"));
|
|
|
|
//skin picker control
|
|
|
|
wxString itmsSkinPicker[]={wxT("Default"),wxT("WorldCommunityGrid")};
|
2006-07-11 23:19:53 +00:00
|
|
|
cmbSkinPicker=new wxComboBox(this,ID_SKINPICKERCMBBOX,wxT(""),wxPoint(180,265),wxSize(140,21),2,itmsSkinPicker,wxNO_BORDER | wxCB_READONLY);
|
2006-07-05 21:36:56 +00:00
|
|
|
cmbSkinPicker->SetValue(wxT("Default"));
|
2006-07-11 23:19:53 +00:00
|
|
|
//tx30c=new wxTextCtrl(this,-1,wxT(""),wxPoint(180,265),wxSize(148,21),wxSIMPLE_BORDER);
|
|
|
|
//btnOpen=new wxBitmapButton(this,ID_OPENBUTTON,*btmpBtnAttProjL,wxPoint(331,265),wxSize(59,20));
|
2006-07-05 21:36:56 +00:00
|
|
|
// Btn Save and Cancel
|
2006-07-11 23:19:53 +00:00
|
|
|
btnSave=new wxBitmapButton(this,ID_SAVEBUTTON,*bti26cImg1,wxPoint(115,325),wxSize(59,20));
|
|
|
|
btnCancel=new wxBitmapButton(this,ID_CANCELBUTTON,*bti27cImg1,wxPoint(190,325),wxSize(59,20));
|
2006-07-05 21:36:56 +00:00
|
|
|
|
|
|
|
Refresh();
|
|
|
|
}
|
|
|
|
void CDlgPreferences::LoadSkinImages(){
|
|
|
|
//get skin class
|
|
|
|
appSkin = SkinClass::Instance();
|
|
|
|
wxString str1 = m_SkinDirPrefix + appSkin->GetDlgPrefBg();
|
|
|
|
fileImgBuf[0].LoadFile(m_SkinDirPrefix + appSkin->GetDlgPrefBg(),wxBITMAP_TYPE_BMP);
|
|
|
|
fileImgBuf[1].LoadFile(m_SkinDirPrefix + appSkin->GetBtnSave(),wxBITMAP_TYPE_BMP);
|
|
|
|
fileImgBuf[2].LoadFile(m_SkinDirPrefix + appSkin->GetBtnCancel(),wxBITMAP_TYPE_BMP);
|
|
|
|
fileImgBuf[3].LoadFile(m_SkinDirPrefix + appSkin->GetBtnOpen(),wxBITMAP_TYPE_BMP);
|
|
|
|
dlg10484fImg0=&fileImgBuf[0];
|
|
|
|
bti26cImg1=&fileImgBuf[1];
|
|
|
|
bti27cImg1=&fileImgBuf[2];
|
|
|
|
btmpBtnAttProjL=&fileImgBuf[3];
|
|
|
|
}
|
|
|
|
void CDlgPreferences::VwXDrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitMap,int opz){
|
|
|
|
event.Skip(false);wxDC *dc;
|
|
|
|
dc=event.GetDC();
|
|
|
|
dc->SetBackground(wxBrush(win->GetBackgroundColour(),wxSOLID));
|
|
|
|
dc->Clear();
|
|
|
|
switch (opz) {
|
|
|
|
case 0:{
|
|
|
|
dc->DrawBitmap(bitMap, 0, 0);
|
|
|
|
break;}
|
|
|
|
case 1:{
|
|
|
|
wxRect rec=win->GetClientRect();
|
|
|
|
rec.SetLeft((rec.GetWidth()-bitMap.GetWidth()) / 2);
|
|
|
|
rec.SetTop ((rec.GetHeight()-bitMap.GetHeight()) / 2);
|
|
|
|
dc->DrawBitmap(bitMap,rec.GetLeft(),rec.GetTop(),0);
|
|
|
|
break;}
|
|
|
|
case 2:{
|
|
|
|
wxRect rec=win->GetClientRect();
|
|
|
|
for(int y=0;y < rec.GetHeight();y+=bitMap.GetHeight()){
|
|
|
|
for(int x=0;x < rec.GetWidth();x+=bitMap.GetWidth()){
|
|
|
|
dc->DrawBitmap(bitMap,x,y,0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void CDlgPreferences::OnEraseBackground(wxEraseEvent& event){
|
|
|
|
wxObject *m_wxWin = event.GetEventObject();
|
|
|
|
if(m_wxWin==this){event.Skip(true);VwXDrawBackImg(event,this,*dlg10484fImg0,0);VwXEvOnEraseBackground(event) ;return;}
|
|
|
|
event.Skip(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDlgPreferences::OnBtnClick(wxCommandEvent& event){ //init function
|
|
|
|
wxObject *m_wxDlgBtnObj = event.GetEventObject();
|
|
|
|
int btnID = event.GetId();
|
|
|
|
if(btnID==ID_SAVEBUTTON){
|
|
|
|
//wxMessageBox("OnBtnClick - btnSave");
|
|
|
|
EndModal(wxID_CANCEL);
|
|
|
|
}
|
|
|
|
else if(btnID==ID_OPENBUTTON){
|
|
|
|
wxString fileName = wxFileSelector(_("Choose a file to open"), _(""), _(""), _("*.xml*"), _("*.xml*"), wxOPEN);
|
|
|
|
if(!fileName.IsEmpty()){
|
|
|
|
//tx30c->SetLabel(fileName);
|
|
|
|
//tx30c->Disable();
|
|
|
|
//tx30c->SetEditable(false);
|
|
|
|
//set the path value
|
|
|
|
//this->SetSkinPath(fileName); REPLACED WITH DROPDOWN
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
//wxMessageBox("OnBtnClick - btnCancel");
|
|
|
|
EndModal(wxID_CANCEL);
|
|
|
|
}
|
|
|
|
} //end function
|
|
|
|
|
|
|
|
void CDlgPreferences::OnCmbSelected(wxCommandEvent& event){ //init function
|
|
|
|
wxObject *m_wxDlgCmbObj = event.GetEventObject();
|
|
|
|
int cmbID = event.GetId();
|
|
|
|
if(cmbID==ID_SKINPICKERCMBBOX){
|
|
|
|
m_SkinName = event.GetString();
|
2006-07-11 23:19:53 +00:00
|
|
|
}else if(cmbID==ID_DOWORKONLYBGNCMBBOX){
|
|
|
|
if(event.GetString() == wxT("Always")){
|
|
|
|
cmbDWBtwnEnd->Show(false);
|
|
|
|
}else{
|
|
|
|
cmbDWBtwnEnd->Show(true);
|
|
|
|
}
|
|
|
|
}else if(cmbID==ID_DOCONNECTONLYBGNCMBBOX){
|
|
|
|
if(event.GetString() == wxT("Always")){
|
|
|
|
cmbCTIBtwnEnd->Show(false);
|
|
|
|
}else{
|
|
|
|
cmbCTIBtwnEnd->Show(true);
|
|
|
|
}
|
2006-07-05 21:36:56 +00:00
|
|
|
}
|
|
|
|
} //end function
|
|
|
|
|
|
|
|
void CDlgPreferences::VwXEvOnEraseBackground(wxEraseEvent& event){ //init function
|
|
|
|
//[29b]Code event VwX...Don't modify[29b]//
|
|
|
|
//add your code here
|
|
|
|
|
|
|
|
} //end function
|
|
|
|
|
|
|
|
void CDlgPreferences::OnPreCreate(){
|
|
|
|
//add your code here
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDlgPreferences::initBefore(){
|
|
|
|
//add your code here
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDlgPreferences::initAfter(){
|
|
|
|
//add your code here
|
|
|
|
Centre();
|
|
|
|
}
|
|
|
|
|
|
|
|
//[evtFunc]end your code
|