Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv28594 Modified Files: MainDlg.cpp MainDlg.h Makefile ServerWnd.cpp wxInterface.wdr wxInterface_wdr.cpp wxInterface_wdr.h Removed Files: StatusBar.cpp StatusBar.h Log Message: New statusbar that works good and looks same on all platforms. Index: MainDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- MainDlg.cpp 24 Nov 2003 11:18:33 -0000 1.10 +++ MainDlg.cpp 24 Nov 2003 14:21:58 -0000 1.11 @@ -63,10 +63,6 @@ int height, width, posx, posy; start_up = true; - /* Create status bar */ - statusbar = new CStatusBar(this); - SetStatusBar(statusbar); - /* Set application icon */ wxIcon icon; icon.CopyFromBitmap(img->mule); @@ -101,12 +97,24 @@ Move(posx, posy); } + /* Create status bar */ + wxPanel *statusbar = new wxPanel(this, -1); + StatusBar(statusbar, true, true); + m_mainsizer->Add(statusbar, 0, wxGROW|wxEXPAND, 0); + wxASSERT_MSG(statusbar, wxT("CMainDlg::CMainDlg() - StatusBar object not ready for accessing.")); + + GetBmpStatusConnection()->SetBitmap(img->disconnected); + GetBmpStatusUsers()->SetBitmap(img->user); + GetBmpStatusFiles()->SetBitmap(img->files); + GetBmpStatusUpload()->SetBitmap(img->upload); + GetBmpStatusDload()->SetBitmap(img->download); + /* Load dialog pages */ LoadAndShowDialogPages(); /* Generate images for toolbar */ #if !defined(__WXGTK__) - img->MakeToolImages(); + img->MakeToolImages(); #endif /** @@ -200,7 +208,7 @@ activewnd->Show(FALSE); m_mainsizer->Remove(activewnd); } - m_mainsizer->Add(dlg,1,wxALIGN_LEFT|wxEXPAND|wxALL); + m_mainsizer->Prepend(dlg,1,wxALIGN_LEFT|wxEXPAND|wxALL); dlg->Show(TRUE); activewnd=dlg; Layout(); Index: MainDlg.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- MainDlg.h 23 Nov 2003 12:14:53 -0000 1.4 +++ MainDlg.h 24 Nov 2003 14:21:58 -0000 1.5 @@ -32,7 +32,6 @@ /* Include local headers */ #include "wxInterface_wdr.h" #include "defines.h" -#include "StatusBar.h" #include "ServerWnd.h" #include "TransferWnd.h" #include "SearchWnd.h" @@ -66,6 +65,29 @@ void CreateMyMenuBar(); wxLocale &m_locale; + + /** + * These need to be publically available, other classes + * might need to access them. + */ + wxStaticText* GetStatusText() { + return (wxStaticText*) FindWindow( ID_STATUS_TXT ); + } + wxStaticText* GetStatusUsers() { + return (wxStaticText*) FindWindow( ID_STATUS_USERS ); + } + wxStaticText* GetStatusFiles() { + return (wxStaticText*) FindWindow( ID_STATUS_FILES ); + } + wxStaticText* GetStatusUpload() { + return (wxStaticText*) FindWindow( ID_STATUS_UPLOAD ); + } + wxStaticText* GetStatusDload() { + return (wxStaticText*) FindWindow( ID_STATUS_DLOAD ); + } + wxStaticText* GetStatusConnection() { + return (wxStaticText*) FindWindow( ID_STATUS_CONNECTION ); + } private: DECLARE_EVENT_TABLE() @@ -91,6 +113,11 @@ wxMenuItem* GetViewToolBar() { return GetMenuBar()->FindItem(ID_VIEW_TOOLBAR); } + wxStaticBitmap* GetBmpStatusConnection() { return (wxStaticBitmap*) FindWindow( ID_BMP_STATUS_CONNECTION ); } + wxStaticBitmap* GetBmpStatusDload() { return (wxStaticBitmap*) FindWindow( ID_BMP_STATUS_DLOAD ); } + wxStaticBitmap* GetBmpStatusUpload() { return (wxStaticBitmap*) FindWindow( ID_BMP_STATUS_UPLOAD ); } + wxStaticBitmap* GetBmpStatusFiles() { return (wxStaticBitmap*) FindWindow( ID_BMP_STATUS_FILES ); } + wxStaticBitmap* GetBmpStatusUsers() { return (wxStaticBitmap*) FindWindow( ID_BMP_STATUS_USERS ); } /* Member variables */ bool show_tool; // Wether toolbar should be shown or not. Index: Makefile =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Makefile,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- Makefile 21 Nov 2003 09:08:11 -0000 1.29 +++ Makefile 24 Nov 2003 14:21:58 -0000 1.30 @@ -59,7 +59,7 @@ # Our own defines. Only one of meaning is -D__HAVE_REMOVE_GROWABLE_COL__, # which should only be enabled if you have patched wxWindows with # flexgridsizer.patch -DEFINES = -D__HAVE_REMOVE_GROWABLE_COL__ +#DEFINES = -D__HAVE_REMOVE_GROWABLE_COL__ # Output colours. Comment out to disable output colouring. DEFAULTCOLOR =\33[0;40;37;22m @@ -112,13 +112,12 @@ SharedFilesWnd.o \ StatisticsWnd.o \ StatisticsTreeCtrl.o \ - StatusBar.o \ SysTray.o \ TransferWnd.o \ UploadListCtrl.o \ wxInterface.o \ wxInterface_wdr.o \ -# $(RES) \ + $(RES) \ # File suffixes .SUFFIXES: .o .cpp .rc .res Index: ServerWnd.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/ServerWnd.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- ServerWnd.cpp 21 Nov 2003 12:46:10 -0000 1.38 +++ ServerWnd.cpp 24 Nov 2003 14:21:58 -0000 1.39 @@ -109,23 +109,23 @@ */ void CServerWnd::AddDebugLine(wxString text, bool status) { if (status) { - statusbar->SetLogText(text); + mainframe->GetStatusText()->SetLabel(text); } wxDateTime now = wxDateTime::Now(); text = wxString::Format( wxT("[%s] %s\n"), now.Format(wxT("%c")).c_str(), text.c_str() ); - + GetDebugLog()->AppendText(text); GetDebugLog()->ShowPosition(GetDebugLog()->GetLastPosition()); } void CServerWnd::AddLogLine(wxString text, bool status) { if (status) { - statusbar->SetLogText(text); + mainframe->GetStatusText()->SetLabel(text); } - + wxDateTime now = wxDateTime::Now(); text = wxString::Format( wxT("[%s] %s\n"), now.Format(wxT("%c")).c_str(), text.c_str() Index: wxInterface.wdr =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/wxInterface.wdr,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 Binary files /tmp/cvsiioOzg and /tmp/cvsADaqMm differ Index: wxInterface_wdr.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/wxInterface_wdr.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- wxInterface_wdr.cpp 23 Nov 2003 12:14:53 -0000 1.3 +++ wxInterface_wdr.cpp 24 Nov 2003 14:21:58 -0000 1.4 @@ -1321,6 +1321,80 @@ return item0; } +wxSizer *StatusBar( wxWindow *parent, bool call_fit, bool set_sizer ) +{ + wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL ); + + wxStaticLine *item1 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL ); + item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 ); + + wxFlexGridSizer *item2 = new wxFlexGridSizer( 1, 0, 0, 0 ); + item2->AddGrowableCol( 0 ); + + wxStaticText *item3 = new wxStaticText( parent, ID_STATUS_TXT, _("ShareDaemon wxInterface ready!"), wxDefaultPosition, wxDefaultSize, 0 ); + item2->Add( item3, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + wxStaticLine *item4 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(-1,20), wxLI_VERTICAL ); + item2->Add( item4, 0, wxALIGN_CENTER, 5 ); + + wxStaticBitmap *item5 = new wxStaticBitmap( parent, ID_BMP_STATUS_USERS, Icons( 0 ), wxDefaultPosition, wxDefaultSize ); + item2->Add( item5, 0, wxALIGN_CENTER, 5 ); + + wxStaticText *item6 = new wxStaticText( parent, ID_STATUS_USERS, _("0(0)"), wxDefaultPosition, wxDefaultSize, 0 ); + item2->Add( item6, 0, wxALIGN_CENTER, 5 ); + + wxStaticLine *item7 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(-1,20), wxLI_VERTICAL ); + item2->Add( item7, 0, wxALIGN_CENTER, 5 ); + + wxStaticBitmap *item8 = new wxStaticBitmap( parent, ID_BMP_STATUS_FILES, Icons( 0 ), wxDefaultPosition, wxDefaultSize ); + item2->Add( item8, 0, wxALIGN_CENTER, 5 ); + + wxStaticText *item9 = new wxStaticText( parent, ID_STATUS_FILES, _("0(0)"), wxDefaultPosition, wxDefaultSize, 0 ); + item2->Add( item9, 0, wxALIGN_CENTER, 5 ); + + wxStaticLine *item10 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(-1,20), wxLI_VERTICAL ); + item2->Add( item10, 0, wxALIGN_CENTER, 5 ); + + wxStaticBitmap *item11 = new wxStaticBitmap( parent, ID_BMP_STATUS_UPLOAD, Icons( 0 ), wxDefaultPosition, wxDefaultSize ); + item2->Add( item11, 0, wxALIGN_CENTER, 5 ); + + wxStaticText *item12 = new wxStaticText( parent, ID_STATUS_UPLOAD, _("0 kb/s"), wxDefaultPosition, wxDefaultSize, 0 ); + item2->Add( item12, 0, wxALIGN_CENTER, 5 ); + + wxStaticLine *item13 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(-1,20), wxLI_VERTICAL ); + item2->Add( item13, 0, wxALIGN_CENTER, 5 ); + + wxStaticBitmap *item14 = new wxStaticBitmap( parent, ID_BMP_STATUS_DLOAD, Icons( 0 ), wxDefaultPosition, wxDefaultSize ); + item2->Add( item14, 0, wxALIGN_CENTER, 5 ); + + wxStaticText *item15 = new wxStaticText( parent, ID_STATUS_DLOAD, _("0 kb/s"), wxDefaultPosition, wxDefaultSize, 0 ); + item2->Add( item15, 0, wxALIGN_CENTER, 5 ); + + wxStaticLine *item16 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(-1,20), wxLI_VERTICAL ); + item2->Add( item16, 0, wxALIGN_CENTER, 5 ); + + wxStaticBitmap *item17 = new wxStaticBitmap( parent, ID_BMP_STATUS_CONNECTION, Icons( 0 ), wxDefaultPosition, wxDefaultSize ); + item2->Add( item17, 0, wxALIGN_CENTER, 5 ); + + wxStaticText *item18 = new wxStaticText( parent, ID_STATUS_CONNECTION, _("Disconnected"), wxDefaultPosition, wxDefaultSize, 0 ); + item2->Add( item18, 0, wxALIGN_CENTER, 5 ); + + item0->Add( item2, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 ); + + if (set_sizer) + { + parent->SetAutoLayout( TRUE ); + parent->SetSizer( item0 ); + if (call_fit) + { + item0->Fit( parent ); + item0->SetSizeHints( parent ); + } + } + + return item0; +} + // Implement menubar functions // Implement toolbar functions Index: wxInterface_wdr.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/wxInterface_wdr.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- wxInterface_wdr.h 21 Nov 2003 12:46:10 -0000 1.2 +++ wxInterface_wdr.h 24 Nov 2003 14:21:58 -0000 1.3 @@ -158,13 +158,26 @@ #define ID_BTN_ADDICONSET_CANCEL 10088 wxSizer *Dlg_AddIconSet( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); +#define ID_STATUS_TXT 10089 +#define ID_BMP_STATUS_USERS 10090 +#define ID_STATUS_USERS 10091 +#define ID_BMP_STATUS_FILES 10092 +#define ID_STATUS_FILES 10093 +#define ID_BMP_STATUS_UPLOAD 10094 +#define ID_STATUS_UPLOAD 10095 +#define ID_BMP_STATUS_DLOAD 10096 +#define ID_STATUS_DLOAD 10097 +#define ID_BMP_STATUS_CONNECTION 10098 +#define ID_STATUS_CONNECTION 10099 +wxSizer *StatusBar( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); + // Declare menubar functions // Declare toolbar functions // Declare bitmap functions -#define ID_NULL_BMP 10089 +#define ID_NULL_BMP 10100 wxBitmap Icons( size_t index ); #endif --- StatusBar.cpp DELETED --- --- StatusBar.h DELETED --- |