You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(102) |
Dec
(255) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(38) |
Feb
(16) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ma...@us...> - 2003-12-22 05:36:19
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv316 Modified Files: SBPanel.cpp SBPanel.h Log Message: Got rid of some extranous ifs regarding headerbtn id. Index: SBPanel.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SBPanel.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- SBPanel.cpp 22 Dec 2003 05:30:00 -0000 1.9 +++ SBPanel.cpp 22 Dec 2003 05:36:15 -0000 1.10 @@ -58,20 +58,22 @@ mainsizer = new wxStaticBoxSizer(box, wxVERTICAL); if (use_image) { - headerbmpbtn = new MBitmapButton( + MBitmapButton *headerbmpbtn = new MBitmapButton( this, -1, title, image ); headerbmpbtn->SetFont( wxFont(SB_BTN_FONT_SIZE, wxROMAN, wxNORMAL, wxBOLD) ); + header_btn_id = headerbmpbtn->GetId(); mainsizer->Add(headerbmpbtn, 0, wxGROW|wxADJUST_MINSIZE, 5); } else { - headerbtn = new wxButton( + wxButton *headerbtn = new wxButton( this, -1, title, wxDefaultPosition, wxDefaultSize, 0 ); headerbtn->SetFont( wxFont(SB_BTN_FONT_SIZE, wxROMAN, wxNORMAL, wxBOLD) ); + header_btn_id = headerbtn->GetId(); mainsizer->Add(headerbtn, 0, wxGROW|wxADJUST_MINSIZE, 5); } @@ -101,16 +103,9 @@ * Layout() as neccesery. */ void CSBPanel::Toggle(wxCommandEvent &event) { - if (use_image) { - if (event.GetId() != headerbmpbtn->GetId()) { - event.Skip(); - return; - } - } else { - if (event.GetId() != headerbtn->GetId()) { - event.Skip(); - return; - } + if (event.GetId() != header_btn_id) { + event.Skip(); + return; } if (shown) { @@ -154,11 +149,7 @@ */ if (!tmp) { wxCommandEvent nullevent; - if (use_image) { - nullevent.SetId(headerbmpbtn->GetId()); - } else { - nullevent.SetId(headerbtn->GetId()); - } + nullevent.SetId(header_btn_id); Toggle(nullevent); } } Index: SBPanel.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SBPanel.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- SBPanel.h 22 Dec 2003 05:30:00 -0000 1.5 +++ SBPanel.h 22 Dec 2003 05:36:15 -0000 1.6 @@ -65,8 +65,7 @@ wxStaticBoxSizer *mainsizer; wxSizer *content; - wxButton *headerbtn; - MBitmapButton *headerbmpbtn; + int header_btn_id; bool shown; bool use_image; }; |
From: <ma...@us...> - 2003-12-22 05:32:08
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv32257 Modified Files: Changelog Log Message: bitmap/multibuttons and such Index: Changelog =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/Changelog,v retrieving revision 1.109 retrieving revision 1.110 diff -u -d -r1.109 -r1.110 --- Changelog 20 Dec 2003 04:38:54 -0000 1.109 +++ Changelog 22 Dec 2003 05:32:04 -0000 1.110 @@ -25,6 +25,11 @@ # This also helps in backtracking changes, or reviewing development history. # ############################################################################### +2003/12/22 Alo Sarv + * Implemented button-with-text-and-image and multi-button controls. + * Populated toolbar with the above controls, now looks real cool :) + * Sidebar section buttons now also have images :) + 2003/12/19 Alo Sarv * Imported Hetfield's GTK systray. |
From: <ma...@us...> - 2003-12-22 05:30:04
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv31912 Modified Files: SBPanel.cpp SBPanel.h ServerWnd.cpp Log Message: Sidebar buttons now also have images :) Index: SBPanel.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SBPanel.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- SBPanel.cpp 21 Dec 2003 05:35:12 -0000 1.8 +++ SBPanel.cpp 22 Dec 2003 05:30:00 -0000 1.9 @@ -42,20 +42,38 @@ * and a "headerbutton" which will then provide us with toggling functionality. */ CSBPanel::CSBPanel( - wxWindow *parent, wxWindowID id, const - wxString &title, const wxString &name + wxWindow *parent, wxWindowID id, const wxString &title, + const wxString &name, const wxBitmap &image ) : wxPanel( parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, name) { + if (image != wxNullBitmap) { + use_image = true; + } else { + use_image = false; + } + wxStaticBox *box = new wxStaticBox(this, -1, wxT("")); mainsizer = new wxStaticBoxSizer(box, wxVERTICAL); - headerbtn = new wxButton( - this, -1, title, wxDefaultPosition, wxDefaultSize, 0 - ); - headerbtn->SetFont(wxFont(SB_BTN_FONT_SIZE, wxROMAN, wxNORMAL, wxBOLD)); - mainsizer->Add(headerbtn, 0, wxGROW|wxADJUST_MINSIZE, 5); + if (use_image) { + headerbmpbtn = new MBitmapButton( + this, -1, title, image + ); + headerbmpbtn->SetFont( + wxFont(SB_BTN_FONT_SIZE, wxROMAN, wxNORMAL, wxBOLD) + ); + mainsizer->Add(headerbmpbtn, 0, wxGROW|wxADJUST_MINSIZE, 5); + } else { + headerbtn = new wxButton( + this, -1, title, wxDefaultPosition, wxDefaultSize, 0 + ); + headerbtn->SetFont( + wxFont(SB_BTN_FONT_SIZE, wxROMAN, wxNORMAL, wxBOLD) + ); + mainsizer->Add(headerbtn, 0, wxGROW|wxADJUST_MINSIZE, 5); + } SetAutoLayout(true); SetSizer(mainsizer); @@ -83,9 +101,16 @@ * Layout() as neccesery. */ void CSBPanel::Toggle(wxCommandEvent &event) { - if (event.GetId() != headerbtn->GetId()) { - event.Skip(); - return; + if (use_image) { + if (event.GetId() != headerbmpbtn->GetId()) { + event.Skip(); + return; + } + } else { + if (event.GetId() != headerbtn->GetId()) { + event.Skip(); + return; + } } if (shown) { @@ -129,7 +154,11 @@ */ if (!tmp) { wxCommandEvent nullevent; - nullevent.SetId(headerbtn->GetId()); + if (use_image) { + nullevent.SetId(headerbmpbtn->GetId()); + } else { + nullevent.SetId(headerbtn->GetId()); + } Toggle(nullevent); } } Index: SBPanel.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SBPanel.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- SBPanel.h 21 Dec 2003 05:35:12 -0000 1.4 +++ SBPanel.h 22 Dec 2003 05:30:00 -0000 1.5 @@ -31,6 +31,8 @@ #endif #include "defines.h" +#include "MBitmapButton.h" +#include "Images.h" #if defined(__WXMSW__) || defined(__GTK2__) #define SB_BTN_FONT_SIZE 10 @@ -51,7 +53,8 @@ public: CSBPanel( wxWindow *parent, wxWindowID id, - const wxString &title, const wxString &name + const wxString &title, const wxString &name, + const wxBitmap &image = wxNullBitmap ); virtual ~CSBPanel(); @@ -63,7 +66,9 @@ wxStaticBoxSizer *mainsizer; wxSizer *content; wxButton *headerbtn; + MBitmapButton *headerbmpbtn; bool shown; + bool use_image; }; #endif Index: ServerWnd.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/ServerWnd.cpp,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- ServerWnd.cpp 17 Dec 2003 10:15:21 -0000 1.48 +++ ServerWnd.cpp 22 Dec 2003 05:30:00 -0000 1.49 @@ -186,25 +186,30 @@ /* Sidebar sections */ CSBPanel *addserver = new CSBPanel( - sidebar, -1, _("Add new server"), wxT("SideBar_AddServer") + sidebar, -1, _("Add new server"), wxT("SideBar_AddServer"), + img->GetImage(wxT("newserver")) ); addserver->SetContent(AddServerPanel(addserver, false, false)); sbmain->Add(addserver, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 0); CSBPanel *serversettings = new CSBPanel( - sidebar, -1, _("Server settings"), wxT("SideBar_ServerSettings") + sidebar, -1, _("Server settings"), + wxT("SideBar_ServerSettings"), + img->GetImage(wxT("updateservers")) ); serversettings->SetContent(SettingsPanel(serversettings, false, false)); sbmain->Add(serversettings, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 0); CSBPanel *portsettings = new CSBPanel( - sidebar, -1, _("Port settings"), wxT("SideBar_PortSettings") + sidebar, -1, _("Port settings"), wxT("SideBar_PortSettings"), + img->GetImage(wxT("server")) ); portsettings->SetContent(PortSettingsPanel(portsettings, false, false)); sbmain->Add(portsettings, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 0); CSBPanel *logoptions = new CSBPanel( - sidebar, -1, _("Log options"), wxT("SideBar_LoggingOptions") + sidebar, -1, _("Log options"), wxT("SideBar_LoggingOptions"), + img->GetImage(wxT("log")) ); logoptions->SetContent(LogOptionsPanel(logoptions, false, false)); sbmain->Add(logoptions, 0, wxGROW|wxALL|wxADJUST_MINSIZE, 0); |
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv28213 Modified Files: Images.cpp MainDlg.cpp MainDlg.h Makefile.am defines.h Added Files: MBitmapButton.cpp MBitmapButton.h MMultiButton.cpp MMultiButton.h Log Message: New MBitmapButton and MMultiButton controls - button-with-image-and-text and control-with-n-sub-buttons, respectivly. Now toolbar looks really cool :) --- NEW FILE: MBitmapButton.cpp --- /* * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef __GNUG__ #pragma implementation "MBitmapButton.cpp" #endif // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #include "MBitmapButton.h" #if defined(__WXMSW__) /* On wxMSW, use wxButton as base */ BEGIN_EVENT_TABLE(MBitmapButton, wxButton) EVT_BUTTON(-1, MBitmapButton::OnClick) END_EVENT_TABLE() /************************************************************** MBitmapButton */ /* This method constructs a bitmapbutton object by attaching a sizer to the */ /* wxButton and stuffing the wxStaticBitmap/wxStaticText in there. */ /* @parent Which wxWindow shall be this controls parent */ /* @id Identification code (int) for this control */ /* @name Name label to be shown on this button */ /* @image Image label to be shown on this button */ /* @pos Position to insert this control to */ /* @size Size of this control */ /* @style Style flag - see wxWindow/wxControl style flags in wxHelp */ /******************************************************************************/ MBitmapButton::MBitmapButton( wxWindow *parent, wxWindowID id, const wxString &name, const wxBitmap &image, const wxPoint &pos, const wxSize &size, long style ) : wxButton(parent, id, name, pos, size, style) { wxString imgname; imgname.Format(wxT("%simg_%s"), imgname.c_str(), name.c_str()); wxFlexGridSizer *s_main = new wxFlexGridSizer(0, 0); wxStaticBitmap *img = new wxStaticBitmap( this, 1000, image, wxDefaultPosition, wxSize(image.GetWidth(), image.GetHeight()), 5, imgname ); s_main->Add(img, 0, wxLEFT|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 5); /** * Dirty trick: * Create a hidden textctrl to force button take correct size. */ wxStaticText *txt = new wxStaticText( this, -1, name, wxDefaultPosition, wxDefaultSize, wxTRANSPARENT_WINDOW ); txt->Hide(); s_main->Add(txt, 1, wxALL|wxADJUST_MINSIZE, 5); SetSizer(s_main); SetAutoLayout(true); s_main->Fit(this); s_main->SetSizeHints(this); Layout(); } /******************************************************************** OnClick */ /* Redraws the bitmap and skips the event (to be handled in parent control. */ /******************************************************************************/ void MBitmapButton::OnClick(wxCommandEvent &event) { Refresh(); event.Skip(); } #else /* Use wxBitmapButton on other platforms */ BEGIN_EVENT_TABLE(MBitmapButton, wxBitmapButton) EVT_BUTTON(-1, MBitmapButton::OnClick) EVT_SIZE(MBitmapButton::OnSize) END_EVENT_TABLE() /************************************************************** MBitmapButton */ /* This method constructs a bitmapbutton control from the passed arguments by */ /* creating a new wxBitmap in memoryDC, drawing the passed name/image in it, */ /* and setting it as BitmapLabel. */ /* @parent Which wxWindow shall be this controls parent */ /* @id Identification code (int) for this control */ /* @name Name label to be shown on this button */ /* @image Image label to be shown on this button */ /* @pos Position to insert this control to */ /* @size Size of this control */ /* @style Style flag - see wxWindow/wxControl style flags in wxHelp */ /******************************************************************************/ MBitmapButton::MBitmapButton( wxWindow *parent, wxWindowID id, const wxString &name, const wxBitmap &image, const wxPoint &pos, const wxSize &size, long style, const wxValidator &val) : wxBitmapButton(parent, id, wxNullBitmap, pos, size, style, val, name) { wxMemoryDC mdc; wxBitmap *tmp; wxCoord x, y; mdc.SelectObject(wxBitmap(100, 100)); mdc.SetFont(wxFont(BTN_FONT_SIZE, wxDEFAULT, wxNORMAL, wxNORMAL)); mdc.GetTextExtent(name, &x, &y); x+=image.GetWidth()+10; image.GetHeight() > y ? y = image.GetHeight()+5 : y+=5; tmp = new wxBitmap(x, y); mdc.SelectObject(*tmp); #ifdef __WXMSW__ /* This gives transparent image on wxMSW */ mdc.SetPen(*wxTRANSPARENT_PEN); mdc.SetBrush(wxBrush(*wxLIGHT_GREY, wxSOLID)); #else /* Elsewhere, it will be done with wxMask later */ mdc.SetBrush(wxBrush(wxColour(0, 0, 0), wxSOLID)); #endif mdc.DrawRectangle(0, 0, tmp->GetWidth(), tmp->GetHeight()); mdc.DrawBitmap(image, 5, (y-image.GetHeight())/2, true); mdc.SetTextForeground(wxColour(1, 1, 1)); mdc.DrawText(name, image.GetWidth()+10, (tmp->GetHeight()-GetCharHeight())/2); #ifndef __WXMSW__ tmp->SetMask(new wxMask(*tmp, wxColour(0, 0, 0))); #endif SetBitmapLabel(*tmp); SetSize(wxSize(tmp->GetWidth()+5, tmp->GetHeight()+5)); delete tmp; } /********************************************************************* OnSize */ /* This method creates a new temporary bitmap with new control size, copies */ /* the currently set bitmap into the temporary bitmap and sets the new image */ /* as BitmapLabel. This is done to preserve the label left-alignment even */ /* after size change. */ /******************************************************************************/ void MBitmapButton::OnSize(wxSizeEvent &event) { wxMemoryDC mdc; wxBitmap tmp(GetSize().GetWidth(), GetSize().GetHeight()); mdc.SelectObject(tmp); #ifdef __WXMSW__ /* This gives transparent image on wxMSW */ mdc.SetPen(*wxTRANSPARENT_PEN); mdc.SetBrush(wxBrush(*wxLIGHT_GREY, wxSOLID)); #else /* Elsewhere, it will be done with wxMask later */ mdc.SetBrush(wxBrush(wxColour(0, 0, 0), wxSOLID)); #endif mdc.DrawRectangle(0, 0, tmp.GetWidth(), tmp.GetHeight()); mdc.DrawBitmap(GetBitmapLabel(), 0, 1, true); #ifndef __WXMSW__ tmp.SetMask(new wxMask(tmp, wxColour(0, 0, 0))); #endif SetBitmapLabel(tmp); event.Skip(); } #endif --- NEW FILE: MBitmapButton.h --- /* * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __MBitmapButton__ #define __MBitmapButton__ #ifdef __GNUG__ #pragma interface "MBitmapButton.cpp" #endif #ifndef WX_PRECOMP #include "wx/wx.h" #endif #if defined(__WXMSW__) || defined(__GTK2__) #define BTN_FONT_SIZE 10 #else #define BTN_FONT_SIZE 12 #endif #if defined(__WXMSW__) /* Need to use wxButton on MSW */ /******************************************************** class MBitmapButton */ /* This class provides functionality of having image AND text on the same */ /* button. This is done by attaching a sizer into the button, with */ /* wxStaticBitmap and wxStaticText controls in it. */ /******************************************************************************/ class MBitmapButton : public wxButton { public: MBitmapButton( /* Constructor */ wxWindow *parent, wxWindowID id, const wxString &title, const wxBitmap &image, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxNO_FULL_REPAINT_ON_RESIZE ); private: DECLARE_EVENT_TABLE() void OnClick(wxCommandEvent &event); /* Skips the events */ }; #else // !__WXMSW__ /* Use wxBitmapButton elsewhere */ /******************************************************** class MBitmapButton */ /* This class provides functionality of having image AND text on the same */ /* button. This is done by generating a new wxBitmap image from the arguments */ /* passed to us and setting it as this controls BitmapLabel. */ /******************************************************************************/ class MBitmapButton : public wxBitmapButton { public: MBitmapButton( /* Constructor */ wxWindow *parent, wxWindowID id, const wxString &title, const wxBitmap &image, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxBU_AUTODRAW, const wxValidator &val = wxDefaultValidator ); private: DECLARE_EVENT_TABLE() void OnClick(wxCommandEvent &event){ event.Skip(); } /* Skips events */ void OnSize(wxSizeEvent &event); /* Updates image */ }; #endif // ___WXMSW__ #endif // __MBITMAPBUTTON_H__ --- NEW FILE: MMultiButton.cpp --- /* * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef __GNUG__ #pragma implementation "MMultiButton.cpp" #endif // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #include "MMultiButton.h" #include <wx/listimpl.cpp> WX_DEFINE_LIST(MBitmapList); BEGIN_EVENT_TABLE(MMultiButton, wxControl) EVT_PAINT(MMultiButton::OnPaint) END_EVENT_TABLE() /*************************************************************** MMultiButton */ /* This constructor creates a multi-button control with normal wxButton type */ /* children. Derived from wxControl, it creates a sizer to contain the sub- */ /* controls, and adds them there. Finally, background colour is set to match */ /* parent's background colour. */ /* @parent Which wxWindow shall be this controls parent */ /* @id Identification code (int) for this control */ /* @count Number of buttons to be added to this control */ /* @names Array containing list of button names to be added */ /* @ids Array of integers containing ID codes for sub-buttons */ /* @pos Position to insert this control to */ /* @size Size of this control */ /* @style Style flag - see wxWindow/wxControl style flags in wxHelp */ /******************************************************************************/ MMultiButton::MMultiButton( wxWindow *parent, wxWindowID id, size_t count, const wxArrayString &names, int ids[], const wxPoint &pos, const wxSize &size, long style ) : wxControl(parent, id, pos, size, style) { wxASSERT(count <= names.GetCount()); wxFlexGridSizer *s_main = new wxFlexGridSizer(1); s_main->AddGrowableCol(0); for (size_t i=0;i<count;i++) { s_main->Add(new wxButton(this, ids[i], names[i]), 0, wxGROW, 0); } SetBackgroundColour(parent->GetBackgroundColour()); SetSizer(s_main); SetAutoLayout(true); s_main->Fit(this); s_main->SetSizeHints(this); Fit(); Layout(); } /*************************************************************** MMultiButton */ /* This constructor creates a multi-button control with MBitmapButton type */ /* children. Derived from wxControl, it creates a sizer to contain the sub- */ /* controls, and adds them there. Finally, background colour is set to match */ /* parent's background colour. */ /* @parent Which wxWindow shall be this controls parent */ /* @id Identification code (int) for this control */ /* @count Number of buttons to be added to this control */ /* @names Array containing list of button names to be added */ /* @ids Array of integers containing ID codes for sub-buttons */ /* @images List of images to be used for buttons */ /* @pos Position to insert this control to */ /* @size Size of this control */ /* @style Style flag - see wxWindow/wxControl style flags in wxHelp */ /******************************************************************************/ MMultiButton::MMultiButton( wxWindow *parent, wxWindowID id, size_t count, const wxArrayString &names, int ids[], const MBitmapList &images, const wxPoint &pos, const wxSize &size, long style ) : wxControl(parent, id, pos, size, style) { MBitmapButton *btn; wxASSERT(count <= names.GetCount()); wxASSERT(count <= images.GetCount()); wxFlexGridSizer *s_main = new wxFlexGridSizer(1); s_main->AddGrowableCol(0); for (size_t i=0;i<count;i++) { btn = new MBitmapButton(this, ids[i], names[i], *(images.Item(i)->GetData())); s_main->Add(btn, 0, wxGROW, 0); } SetBackgroundColour(parent->GetBackgroundColour()); SetSizer(s_main); SetAutoLayout(true); s_main->Fit(this); s_main->SetSizeHints(this); Fit(); Layout(); } /******************************************************************** OnPaint */ /* Paint events handler, usually called from Event table. This sets controls */ /* background colour to match parents background colour and updates size. */ /* This is needed to keep the control up-to-date even after system colours */ /* or fonts change. */ /* @event References to the event. */ /******************************************************************************/ void MMultiButton::OnPaint(wxPaintEvent &event) { SetBackgroundColour(GetParent()->GetBackgroundColour()); Fit(); event.Skip(); } --- NEW FILE: MMultiButton.h --- /* * This file is part of wxInterface. * Copyright (C) 2003 Alo Sarv <ma...@us...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __MMULTIBUTTON_H__ #define __MMULTIBUTTON_H__ #ifdef __GNUG__ #pragma interface "MMultiButton.cpp" #endif #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "MBitmapButton.h" WX_DECLARE_LIST(wxBitmap, MBitmapList); /*************************************************************** MMultiButton */ /* MMultiButton is a control with multiple buttons. The buttons can either be */ /* normal buttons, or MBitmapButtons. */ /******************************************************************************/ class MMultiButton : public wxControl { public: MMultiButton( /* Constructs a multi-button with normal wxButtons. */ wxWindow *parent, wxWindowID id, size_t count, const wxArrayString &names, int ids[], const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE ); MMultiButton( /* Constructs a multi-button with MBitmapButtons. */ wxWindow *parent, wxWindowID id, size_t count, const wxArrayString &names, int ids[], const MBitmapList &images, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxNO_BORDER| wxNO_FULL_REPAINT_ON_RESIZE ); private: DECLARE_EVENT_TABLE() void OnPaint(wxPaintEvent &event); /* Updates background colour */ }; #endif Index: Images.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Images.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- Images.cpp 22 Dec 2003 01:55:10 -0000 1.40 +++ Images.cpp 22 Dec 2003 05:04:15 -0000 1.41 @@ -229,6 +229,18 @@ wxT("rightarrow"), new wxBitmap(path+wxT("rightarrow.png"), wxBITMAP_TYPE_ANY) ); + images.Append( + wxT("options"), + new wxBitmap(path+wxT("options.png"), wxBITMAP_TYPE_ANY) + ); + images.Append( + wxT("help"), + new wxBitmap(path+wxT("help.png"), wxBITMAP_TYPE_ANY) + ); + images.Append( + wxT("quit"), + new wxBitmap(path+wxT("quit.png"), wxBITMAP_TYPE_ANY) + ); } /** Index: MainDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- MainDlg.cpp 21 Dec 2003 04:25:18 -0000 1.31 +++ MainDlg.cpp 22 Dec 2003 05:04:15 -0000 1.32 @@ -138,6 +138,8 @@ BEGIN_EVENT_TABLE(CMainDlg, wxFrame) EVT_CLOSE(CMainDlg::OnCloseWindow) /* Shutdown event */ EVT_TOOL(-1, CMainDlg::MenuOrToolEvent) /* Menu/Toolbar events */ + EVT_BUTTON(ID_BTN_GUISETTINGS, CMainDlg::ShowGUISettingsDlg) + EVT_BUTTON(ID_QUIT, CMainDlg::OnCloseWindow) END_EVENT_TABLE() #include <wx/listimpl.cpp> @@ -317,6 +319,11 @@ int tool_align; /* For storing values read from configuration */ bool show_tool; /* For storing values read from configuration */ unsigned int i; /* Loop counter */ +wxArrayString names; /* Names for multibutton controls */ +MBitmapList images; /* Images for multibutton controls */ +int ids[2]; /* Identifiers for multibutton controls */ + + images.DeleteContents(true); MyToolBar *toolbar = (MyToolBar*)GetToolBar(); delete toolbar; @@ -339,14 +346,12 @@ if (start_up) { wxArrayString names; - names.Add(_("Connect")); for (i=0;i<pages.GetCount();i++) { if (pages.IsEmpty()) { break; } names.Add(pages.Item(i)->GetData()->short_title); } - names.Add(_("Preferences")); img->CalcToolBitmapSize(names); } @@ -355,16 +360,16 @@ ); tb->SetMargins(2, 2); - if (gen_images) { - img->MakeToolImage(_("Connect"), wxT("btn_connect")); - } + names.Add(_("Connect")); + names.Add(_("Log")); + ids[1] = ID_BTN_CONNECT; + ids[1] = ID_BTN_LOG; + images.Append(new wxBitmap(img->GetImage(wxT("connection")))); + images.Append(new wxBitmap(img->GetImage(wxT("log")))); + tb->AddControl(new MMultiButton(tb, -1, 2, names, ids, images)); + images.Clear(); + names.Empty(); - tb->AddTool( - ID_BTN_CONNECT, _("Connect"), - img->GetImage(wxT("btn_connect")), - wxNullBitmap, wxITEM_NORMAL, _("Connect to any server") - ); - tb->AddSeparator(); for (i=0;i<pages.GetCount();i++) { if (pages.IsEmpty()){ break; @@ -385,15 +390,16 @@ pages.Item(i)->GetData()->content ); } - tb->AddSeparator(); - if (gen_images) { - img->MakeToolImage(_("Preferences"), wxT("btn_guisettings")); - } - tb->AddTool( - ID_BTN_GUISETTINGS, _("Preferences"), - img->GetImage(wxT("btn_guisettings")), - wxNullBitmap, wxITEM_NORMAL, _("Modify settings") - ); + + names.Add(_("Options")); + names.Add(_("Help")); + ids[0] = ID_BTN_GUISETTINGS; + ids[1] = ID_BTN_HELP; + images.Append(new wxBitmap(img->GetImage(wxT("options")))); + images.Append(new wxBitmap(img->GetImage(wxT("help")))); + tb->AddControl(new MMultiButton(tb, -1, 2, names, ids, images)); + images.Clear(); + names.Empty(); tb->Realize(); SetToolBar(tb); Index: MainDlg.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- MainDlg.h 20 Dec 2003 08:51:55 -0000 1.14 +++ MainDlg.h 22 Dec 2003 05:04:15 -0000 1.15 @@ -42,6 +42,7 @@ #include "SysTray.h" #include "Images.h" #include "GUISettingsDlg.h" +#include "MMultiButton.h" /* Constants for MainDlg */ #define ID_QUIT 100 Index: Makefile.am =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Makefile.am 20 Dec 2003 08:54:09 -0000 1.7 +++ Makefile.am 22 Dec 2003 05:04:15 -0000 1.8 @@ -7,7 +7,9 @@ KnownListCtrl.o \ MainDlg.o \ MessagesWnd.o \ + MBitmapButton.o \ MListCtrl.o \ + MMultiButton.o \ QueueListCtrl.o \ SBPanel.o \ SearchListCtrl.o \ @@ -67,10 +69,10 @@ false; \ fi; -.rc.res: - @echo -e -n "$(ACTIONCOLOR)Compiling $(INPUTCOLOR)$<$(ACTIONCOLOR) to " - @echo -e -n "$(OUTPUTCOLOR)$@$(ACTIONCOLOR): $(ATTENTIONCOLOR)" - @if windres -i $< -I rc -o $@ -O coff --include-dir=/local/include 2>.err; then \ +@RES@: + @echo -e -n "$(ACTIONCOLOR)Compiling $(INPUTCOLOR)$<$(ACTIONCOLOR) to "; + @echo -e -n "$(OUTPUTCOLOR)$@$(ACTIONCOLOR): $(ATTENTIONCOLOR)"; + @if windres -i wxInterface_private.rc -I rc -o $@ -O coff --include-dir=/local/include 2>.err; then \ if test -s .err; then \ echo -e "$(WARNINGCOLOR)ok, but warnings:"; \ cat .err; \ Index: defines.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/defines.h,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- defines.h 19 Dec 2003 03:01:14 -0000 1.43 +++ defines.h 22 Dec 2003 05:04:15 -0000 1.44 @@ -79,7 +79,8 @@ ID_BTN_CONNECT, /* Toolbar buttons */ ID_BTN_STATISTICS, ID_BTN_GUISETTINGS, - ID_BTN_CORESETTINGS, + ID_BTN_HELP, + ID_BTN_LOG, ID_TOOLBAR, /* Toolbar itself */ ID_DETACH, /* Deatch_Current_page menubar object */ ID_FULLSCREEN, /* Fullscreen switch (in menu) */ |
From: <ma...@us...> - 2003-12-22 02:09:24
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv1322 Modified Files: configure Log Message: fixes configure bug on mingw Index: configure =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/configure,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- configure 21 Dec 2003 05:01:09 -0000 1.10 +++ configure 22 Dec 2003 02:09:21 -0000 1.11 @@ -267,6 +267,7 @@ # Checks for availability of GTK headers (needed for GTK systray) # function check_gtkconfig() { +has_gtk=0; if $wxconfig --cppflags | grep -q 'gtk'; then echo -e -n "checking for gtk-config..."; if test -x $gtkconfig; then |
From: <ma...@us...> - 2003-12-22 01:55:13
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv31157 Modified Files: Images.cpp Images.h Log Message: Moved images path making code into separate function. Index: Images.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Images.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- Images.cpp 21 Dec 2003 05:35:12 -0000 1.39 +++ Images.cpp 22 Dec 2003 01:55:10 -0000 1.40 @@ -52,53 +52,15 @@ * This method loads all images into the global variables. */ void CImages::LoadImages() { - wxString path, apppath; - wxChar sep; + wxString path; tool_img_width = 32; /* Just in case theres anything in there, delete it */ images.DeleteContents(true); images.Clear(); - /** - * We get the application binary path from argv[0], remove the binary - * name from it, and use it as base for our resources. Needed if - * application startup path != application binary path, which would - * prevent us from accessing resources. - */ - apppath = wxTheApp->argv[0]; - #if defined(__WXMSW__) - sep = '\\'; - #else - sep = '/'; - #endif - while ((apppath.Last() != sep) && (apppath.Length()>1)) { - apppath.RemoveLast(); - } - - #if defined(__WXMAC__) && defined(__MACH__) - apppath.Append(wxT("../Resources/")); - #endif - - m_config->Read( - wxT("/General/IconSets/CurIconSet"), &path, wxT("Default") - ); - path.MakeLower(); - path = wxString::Format( - wxT("%simages/%s/"), apppath.c_str(), path.c_str() - ); - - /* - * Under wxMac, the separator is :, and relative paths must be prepended - * by :. We also prepend the path by ::Resources, as it is standard - * under wxMac to have resources there. - */ - #if defined(__WXMAC__) && !defined(__MACH__) - path.Replace(wxT("/"), wxT(":")); - path.Prepend(wxT(":")); - path.Prepend(wxT("::Resources")); - #endif - + path = MakePath(); + images.Append( wxT("friend"), new wxBitmap(path+wxT("friend.png"), wxBITMAP_TYPE_ANY) @@ -386,3 +348,62 @@ y>tool_img_height ? tool_img_height=y : y=tool_img_width; } } + +/****************************************************************** MakePath */ +/* This method creates a platform-dependant path string for accessing images */ +/* from. Since various platforms use various standard locations for resouce */ +/* locations, this method handles it as follows: */ +/* Win32 @executable_path@/images/@iconsetname@/ */ +/* Linux @executable_path@/images/@iconsetname@/ */ +/* Mac OS X */ +/* CodeWarrior :@executable_path@::Resources:images:@iconsetname@ */ +/* GNU gcc @executable_path@/images/@iconsetname@/ */ +/* */ +/* TODO: Use /usr/share area on Linux */ +/* Check various locations, detect if images can be found. */ +/*****************************************************************************/ +wxString CImages::MakePath() { + wxString path, apppath; + wxChar sep; + + /** + * We get the application binary path from argv[0], remove the binary + * name from it, and use it as base for our resources. Needed if + * application startup path != application binary path, which would + * prevent us from accessing resources. + */ + apppath = wxTheApp->argv[0]; + #if defined(__WXMSW__) + sep = '\\'; + #else + sep = '/'; + #endif + while ((apppath.Last() != sep) && (apppath.Length()>1)) { + apppath.RemoveLast(); + } + + #if defined(__WXMAC__) && defined(__MACH__) + apppath.Append(wxT("../Resources/")); + #endif + + m_config->Read( + wxT("/General/IconSets/CurIconSet"), &path, wxT("Default") + ); + path.MakeLower(); + path = wxString::Format( + wxT("%simages/%s/"), apppath.c_str(), path.c_str() + ); + + /* + * Under wxMac, the separator is :, and relative paths must be prepended + * by :. We also prepend the path by ::Resources, as it is standard + * under wxMac to have resources there. + */ + #if defined(__WXMAC__) && !defined(__MACH__) + path.Replace(wxT("/"), wxT(":")); + path.Prepend(wxT(":")); + path.Prepend(wxT("::Resources")); + #endif + + return path; +} Index: Images.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Images.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- Images.h 20 Dec 2003 08:51:54 -0000 1.18 +++ Images.h 22 Dec 2003 01:55:10 -0000 1.19 @@ -44,7 +44,8 @@ void UpdateImages(wxWindow *parent); void CalcToolBitmapSize(const wxArrayString &names); private: - ListOfBitmaps images; + ListOfBitmaps images; + wxString MakePath(); }; #endif /* __IMAGES_H__ */ |
From: <ma...@us...> - 2003-12-21 05:41:46
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv26316 Modified Files: TODO Log Message: Statusbar flickering is fixed, tbar flickering wont be fixed (at least not in near future) Index: TODO =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/TODO,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- TODO 21 Dec 2003 05:40:27 -0000 1.10 +++ TODO 21 Dec 2003 05:41:43 -0000 1.11 @@ -31,7 +31,6 @@ * Splitter windows don't resize correct after switching to fullscreen * Page detaching engine loses few wxMask/wxObject type objects during the process, probably the toolbar buttons images. -* Fix toolbar/statusbar flickering on wxMSW. * Hack wxToolBar to trigger EVT_LEFT_DOWN mouse events and use those for changing pages instead of EVT_LEFT_CLICK - makes it seem faster. |
From: <ma...@us...> - 2003-12-21 05:40:30
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv26192 Modified Files: TODO Log Message: Updated trayicon section. Index: TODO =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/TODO,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- TODO 19 Dec 2003 03:33:37 -0000 1.9 +++ TODO 21 Dec 2003 05:40:27 -0000 1.10 @@ -49,15 +49,14 @@ *********************** GTK SYSTRAY BUGS/TODO *********************** * Maintainer: Patrizio Bassi aka Hetfield <het...@us... * ********************************************************************* -* Fix GTK warnings/criticals -* Fix compilation against GTK2 (something with headers) -* Fix coding style (read ShareDaemon coding standards here: - "http://sourceforge.net/docman/display_doc.php?docid=20130&gr - oup_id=94958" and take a look at MainDlg.cpp/.h for example. +* Make it unicode compatible (TOP PRIORITY!). Compile wxWindows with + --with-gtk2 --enable-unicode --enable-debug for testing it. +* Make it compatible with ShareDaemon coding standards. + http://sharedaemon.sourceforge.net/staticpages/index.php?page=20031220110653863 +* Fix GTK/GTK2 warnings/criticals upon startup/shutdown. * Use PNG images instead of XPM. Get the PNG image from CImages class `img->GetImage(wxT("mule"));` -* Fix any compilations issues that arise when compiling against - wxgtk2ud (configure wx with --enable-gtk2 --enable-unicode - --enable-debug). -* Autodetect which WM is running and use the corresponding trayicon. - +* Autodetect which Window Manager is running and use the corresponding + trayicon. +* Make tray-icon have transparent background (shows grey background on + KDE 3.1.4). |
From: <ma...@us...> - 2003-12-21 05:35:15
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv25657 Modified Files: Images.cpp SBPanel.cpp SBPanel.h Log Message: Fixed remaining GTK2 issues. Index: Images.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Images.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- Images.cpp 21 Dec 2003 05:01:42 -0000 1.38 +++ Images.cpp 21 Dec 2003 05:35:12 -0000 1.39 @@ -344,7 +344,7 @@ mdc.SetTextForeground(wxColour(1,1,1)); mdc.GetTextExtent(name, &x, &y); mdc.DrawText(name, (tmp_new.GetWidth()-x)/2, 36); -#if !defined(__WXMSW__) && !defined(__GTK2__) /* Use wxMask for transparency */ +#ifndef __WXMSW__ /* Use wxMask for transparency */ wxMask *tmp_mask; tmp_mask = new wxMask(tmp_new, wxColour(0,0,0)); tmp_new.SetMask(tmp_mask); @@ -370,6 +370,8 @@ int x, y; /* For storing image size */ wxMemoryDC mdc; /* Memory drawing context */ + wxBitmap tmp(100, 100); + mdc.SelectObject(tmp); #ifdef __WXMAC__ mdc.SetFont(wxFont(10, wxDEFAULT, wxNORMAL, wxNORMAL)); #else Index: SBPanel.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SBPanel.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- SBPanel.cpp 21 Dec 2003 03:45:35 -0000 1.7 +++ SBPanel.cpp 21 Dec 2003 05:35:12 -0000 1.8 @@ -54,11 +54,7 @@ headerbtn = new wxButton( this, -1, title, wxDefaultPosition, wxDefaultSize, 0 ); -#if defined(__WXMSW__) - headerbtn->SetFont(wxFont(10, wxROMAN, wxNORMAL, wxBOLD)); -#else - headerbtn->SetFont(wxFont(12, wxROMAN, wxNORMAL, wxBOLD)); -#endif + headerbtn->SetFont(wxFont(SB_BTN_FONT_SIZE, wxROMAN, wxNORMAL, wxBOLD)); mainsizer->Add(headerbtn, 0, wxGROW|wxADJUST_MINSIZE, 5); SetAutoLayout(true); Index: SBPanel.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SBPanel.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- SBPanel.h 6 Dec 2003 00:18:37 -0000 1.3 +++ SBPanel.h 21 Dec 2003 05:35:12 -0000 1.4 @@ -32,6 +32,12 @@ #include "defines.h" +#if defined(__WXMSW__) || defined(__GTK2__) + #define SB_BTN_FONT_SIZE 10 +#else + #define SB_BTN_FONT_SIZE 12 +#endif + /** * SBPanel, or SideBar Panel is a panel with a button on top of it * that provides its "closing" and "opening" functionality. |
From: <ma...@us...> - 2003-12-21 05:01:45
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv22220/src Modified Files: Images.cpp Log Message: Fixes one endless loop on wxGTK2 Index: Images.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Images.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- Images.cpp 21 Dec 2003 04:25:18 -0000 1.37 +++ Images.cpp 21 Dec 2003 05:01:42 -0000 1.38 @@ -321,19 +321,19 @@ mdc.SelectObject(tmp_new); mdc.SetTextForeground(wxColour(10, 10, 10)); - #ifdef __WXMAC__ +#ifdef __WXMAC__ mdc.SetFont(wxFont(10, wxDEFAULT, wxNORMAL, wxNORMAL)); - #else +#else mdc.SetFont(wxFont(10, wxDECORATIVE, wxNORMAL, wxBOLD)); - #endif +#endif mdc.BeginDrawing(); - #ifdef __WXMSW__ /* This gives transparent image on wxMSW */ +#ifdef __WXMSW__ /* This gives transparent image on wxMSW */ mdc.SetPen(*wxTRANSPARENT_PEN); mdc.SetBrush(wxBrush(*wxLIGHT_GREY, wxSOLID)); - #else /* Elsewhere, it will be done with wxMask later */ +#else /* Elsewhere, it will be done with wxMask later */ mdc.SetBrush(wxBrush(wxColour(0, 0, 0), wxSOLID)); - #endif +#endif mdc.DrawRectangle( 0, 0, tmp_new.GetWidth(), tmp_new.GetHeight() ); @@ -344,11 +344,11 @@ mdc.SetTextForeground(wxColour(1,1,1)); mdc.GetTextExtent(name, &x, &y); mdc.DrawText(name, (tmp_new.GetWidth()-x)/2, 36); - #ifndef __WXMSW__ /* Use wxMask for transparency */ +#if !defined(__WXMSW__) && !defined(__GTK2__) /* Use wxMask for transparency */ wxMask *tmp_mask; tmp_mask = new wxMask(tmp_new, wxColour(0,0,0)); tmp_new.SetMask(tmp_mask); - #endif +#endif mdc.EndDrawing(); images.DeleteObject(&(GetImage(image))); |
From: <ma...@us...> - 2003-12-21 05:01:12
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv22162 Modified Files: configure Log Message: Now detects pkg-config correctly. Index: configure =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/configure,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- configure 20 Dec 2003 09:17:45 -0000 1.9 +++ configure 21 Dec 2003 05:01:09 -0000 1.10 @@ -25,6 +25,7 @@ # defaults wxconfig=wx-config; gtkconfig=gtk-config; + pkgconfig=pkg-config; prefix=/usr/local/bin; include=-I/local/include; include_dir=/local/include; @@ -164,7 +165,7 @@ echo -n -e "checking for wx-config... \t\t\t"; if test -x $wxconfig; then wxconfig=$wxconfig; - elif test -x `which wx-config 2>/dev/null`; then + elif `which wx-config 2>/dev/null`; then wxconfig=`which wx-config 2>/dev/null`; elif test -x /usr/local/bin/wx-config; then wxconfig=/usr/local/bin/wx-config; @@ -189,7 +190,7 @@ EOF exit 1; fi; - echo -e "${colour_yes}yes${colour_default}"; + echo -e "${colour_yes}$wxconfig${colour_default}"; } ## @@ -243,11 +244,12 @@ echo -e "${colour_no}yes${colour_default}"; echo -e "\t${colour_warning}Warning: GTK2 support in wxWindows is only experimental,${colour_default}"; echo -e "\t${colour_warning}thus it is not officially supported in this application${colour_default}"; - echo -e "\t${colour_warning}either. You have been warned, continue on your own risc.${colour_default}"; + echo -e "\t${colour_warning}either. You have been warned, continue on your own risk.${colour_default}"; cppflags="$cppflags -D__GTK2__" gtk2=1; else echo -e "${colour_yes}no${colour_default}"; + gtk2=0; fi; fi; } @@ -306,7 +308,7 @@ if test -x $pkgconfig; then pkgconfig=$pkgconfig; has_pkgconfig=1; - elif test -x `which pkg-config 2>/dev/null`; then + elif test `which pkg-config 2>/dev/null`; then pkgconfig=`which pkg-config 2>/dev/null`; has_pkgconfig=1; else @@ -319,14 +321,13 @@ EOF echo -e "$(default_color)"; has_gtk=0; + has_pkgconfig=0; fi; - fi; - if test $has_gtk = 1; then - if test $has_pkgconfig = 1; then - echo -e "$(colour_yes)\t\t\t$pkgconfig$(colour_default)"; + if test $has_gtk = 1 -a $has_pkgconfig = 1; then + echo -e "$colour_yes\t\t\t$pkgconfig$colour_default"; fi; fi; - + fi; } @@ -381,10 +382,14 @@ linkflags=`$wxconfig --libs`; - if $wxconfig --cppflags | grep -q 'gtk'; then - if test $has_gtk = 1; then - cppflags="$cppflags -D__HAS_GTK_CONFIG__"; - tray_objs="TrayCoreEngine.o"; + if test $has_gtk = 1; then + cppflags="$cppflags -D__HAS_GTK_CONFIG__"; + tray_objs="TrayCoreEngine.o"; + if test $gtk2 = 1 -a $has_pkgconfig = 1; then + cflags="`$pkgconfig --cflags gtk+-2.0`"; + cppflags="$cppflags `$pkgconfig --cflags gtk+-2.0`"; + linkflags="$linkflags `$pkgconfig --libs gtk+-2.0`"; + else cflags="`$gtkconfig --cflags`"; cppflags="$cppflags `$gtkconfig --cflags`"; linkflags="$linkflags `$gtkconfig --libs`"; |
From: <ma...@us...> - 2003-12-21 04:25:22
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv18365 Modified Files: Images.cpp MainDlg.cpp Log Message: Fixed two errors detected by valgrind. Index: Images.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Images.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- Images.cpp 21 Dec 2003 03:45:35 -0000 1.36 +++ Images.cpp 21 Dec 2003 04:25:18 -0000 1.37 @@ -36,6 +36,7 @@ /* Constructor for CImages class */ CImages::CImages() { images = ListOfBitmaps(wxKEY_STRING); + tool_img_height = tool_img_width = 0; LoadImages(); } Index: MainDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- MainDlg.cpp 20 Dec 2003 03:37:26 -0000 1.30 +++ MainDlg.cpp 21 Dec 2003 04:25:18 -0000 1.31 @@ -258,6 +258,9 @@ SetToolBar(NULL); delete tb; } + + pages.DeleteContents(true); + pages.Clear(); } /************************************************************** SetActivePage */ |
From: <ma...@us...> - 2003-12-21 03:45:40
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv13184 Modified Files: Images.cpp SBPanel.cpp Log Message: Fixes wxMac, wxGTK and wxX11 issues. Index: Images.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Images.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- Images.cpp 20 Dec 2003 03:37:26 -0000 1.35 +++ Images.cpp 21 Dec 2003 03:45:35 -0000 1.36 @@ -316,6 +316,9 @@ wxBitmap tmp, tmp_new; int x, y; + tmp_new = wxBitmap(tool_img_width, tool_img_height); + mdc.SelectObject(tmp_new); + mdc.SetTextForeground(wxColour(10, 10, 10)); #ifdef __WXMAC__ mdc.SetFont(wxFont(10, wxDEFAULT, wxNORMAL, wxNORMAL)); @@ -323,9 +326,6 @@ mdc.SetFont(wxFont(10, wxDECORATIVE, wxNORMAL, wxBOLD)); #endif - tmp_new = wxBitmap(tool_img_width, tool_img_height); - - mdc.SelectObject(tmp_new); mdc.BeginDrawing(); #ifdef __WXMSW__ /* This gives transparent image on wxMSW */ mdc.SetPen(*wxTRANSPARENT_PEN); Index: SBPanel.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SBPanel.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- SBPanel.cpp 20 Dec 2003 03:39:27 -0000 1.6 +++ SBPanel.cpp 21 Dec 2003 03:45:35 -0000 1.7 @@ -54,7 +54,11 @@ headerbtn = new wxButton( this, -1, title, wxDefaultPosition, wxDefaultSize, 0 ); +#if defined(__WXMSW__) headerbtn->SetFont(wxFont(10, wxROMAN, wxNORMAL, wxBOLD)); +#else + headerbtn->SetFont(wxFont(12, wxROMAN, wxNORMAL, wxBOLD)); +#endif mainsizer->Add(headerbtn, 0, wxGROW|wxADJUST_MINSIZE, 5); SetAutoLayout(true); |
From: <ma...@us...> - 2003-12-20 09:17:48
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv14725 Modified Files: configure Log Message: Checks for pkg-config now (needed for compilation against wxGTK2) Index: configure =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/configure,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- configure 20 Dec 2003 08:51:28 -0000 1.8 +++ configure 20 Dec 2003 09:17:45 -0000 1.9 @@ -51,6 +51,9 @@ --with-gtk-config=*) gtkconfig=$optarg; ;; + --with-pkg-config=*) + pkgconfig=$optarg; + ;; --prefix=*) prefix=$optarg; ;; @@ -162,7 +165,7 @@ if test -x $wxconfig; then wxconfig=$wxconfig; elif test -x `which wx-config 2>/dev/null`; then - wxconfig=`which wx-config`; + wxconfig=`which wx-config 2>/dev/null`; elif test -x /usr/local/bin/wx-config; then wxconfig=/usr/local/bin/wx-config; elif test -x /usr/bin/wx-config; then @@ -242,6 +245,7 @@ echo -e "\t${colour_warning}thus it is not officially supported in this application${colour_default}"; echo -e "\t${colour_warning}either. You have been warned, continue on your own risc.${colour_default}"; cppflags="$cppflags -D__GTK2__" + gtk2=1; else echo -e "${colour_yes}no${colour_default}"; fi; @@ -266,6 +270,9 @@ if test -x $gtkconfig; then gtkconfig=$gtkconfig; has_gtk=1; + elif test -x `which gtk-config 2>/dev/null`; then + gtkconfig=`which gtk-config 2>/dev/null`; + has_gtk=1; elif test -x /usr/local/bin/gtk-config; then gtkconfig=/usr/local/bin/gtk-config; has_gtk=1; @@ -291,8 +298,35 @@ has_gtk=0; fi; if test $has_gtk = 1; then - echo -e "${colour_yes}\t\t\tyes${colour_default}"; + echo -e "${colour_yes}\t\t\t$gtkconfig${colour_default}"; fi; + + if test $gtk2 = 1; then + echo -e -n "checking for pkg-config..."; + if test -x $pkgconfig; then + pkgconfig=$pkgconfig; + has_pkgconfig=1; + elif test -x `which pkg-config 2>/dev/null`; then + pkgconfig=`which pkg-config 2>/dev/null`; + has_pkgconfig=1; + else + echo -e "$(colour_no)no$(colour_warning)"; + cat << EOF +wxWindows was linked against GTK2, but GTK2 devel tools (pkg-config) +were not found. If you have GTK2 (pkg-config) installed in a custom +location, rerun configure with --with-pkg-config=PREFIX. +GTK systray will be disabled. +EOF + echo -e "$(default_color)"; + has_gtk=0; + fi; + fi; + if test $has_gtk = 1; then + if test $has_pkgconfig = 1; then + echo -e "$(colour_yes)\t\t\t$pkgconfig$(colour_default)"; + fi; + fi; + fi; } @@ -347,12 +381,14 @@ linkflags=`$wxconfig --libs`; - if test $has_gtk = 1; then - cppflags="$cppflags -D__HAS_GTK_CONFIG__"; - tray_objs="TrayCoreEngine.o"; - cflags="`$gtkconfig --cflags`"; - cppflags="$cppflags `$gtkconfig --cflags`"; - linkflags="$linkflags `$gtkconfig --libs`"; + if $wxconfig --cppflags | grep -q 'gtk'; then + if test $has_gtk = 1; then + cppflags="$cppflags -D__HAS_GTK_CONFIG__"; + tray_objs="TrayCoreEngine.o"; + cflags="`$gtkconfig --cflags`"; + cppflags="$cppflags `$gtkconfig --cflags`"; + linkflags="$linkflags `$gtkconfig --libs`"; + fi; fi; if test $show_flags = 1; then @@ -400,6 +436,7 @@ --help Print this message and return to shell --with-wx-config=DIR Specify the location of wx-config script --with-gtk-config=DIR Specify the location of gtk-config + --with-pkg-config=DIR Specify the location of pkg-config --enable-optimise Optimize code ( recommended for users) --enable-debug Enable debugging ( recommended for devs) --enable-profile Enable profiling ( recommended for devs) |
From: <ma...@us...> - 2003-12-20 08:54:12
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv11370/src Modified Files: Makefile.am Log Message: added tray objects to make clean Index: Makefile.am =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Makefile.am,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Makefile.am 19 Dec 2003 23:50:12 -0000 1.6 +++ Makefile.am 20 Dec 2003 08:54:09 -0000 1.7 @@ -107,10 +107,10 @@ clean: @echo -e -n "Cleaning up..." - @rm -f $(WXINTERFACE_OBJECTS) $(PROGRAM) $(PROGRAM).exe + @rm -f $(WXINTERFACE_OBJECTS) $(PROGRAM) $(PROGRAM).exe @TRAY_OBJECTS@ @echo -e "$(WELLCOLOR) ok.$(DEFAULTCOLOR)" distclean: @echo -e -n "Cleaning up..." - @rm -f $(WXINTERFACE_OBJECTS) $(PROGRAM) $(PROGRAM).exe Makefile + @rm -f $(WXINTERFACE_OBJECTS) $(PROGRAM) $(PROGRAM).exe Makefile @TRAY_OBJECTS@ @echo -e "$(WELLCOLOR) ok.$(DEFAULTCOLOR)" |
From: <ma...@us...> - 2003-12-20 08:51:58
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv11077/src Modified Files: Images.h MainDlg.h Log Message: Fixed bugged inlines Index: Images.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Images.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- Images.h 20 Dec 2003 03:37:26 -0000 1.17 +++ Images.h 20 Dec 2003 08:51:54 -0000 1.18 @@ -40,7 +40,7 @@ wxBitmap& MakeToolImage(const wxString &name, const wxString &image); int tool_img_width, tool_img_height; void LoadImages(); - inline wxBitmap& GetImage(const wxString &name); + wxBitmap& GetImage(const wxString &name); void UpdateImages(wxWindow *parent); void CalcToolBitmapSize(const wxArrayString &names); private: Index: MainDlg.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- MainDlg.h 19 Dec 2003 23:50:12 -0000 1.13 +++ MainDlg.h 20 Dec 2003 08:51:55 -0000 1.14 @@ -102,8 +102,8 @@ long style, wxLocale &m_locale ); /* Constructor */ ~CMainDlg(); /* Destructor */ - inline void CreateMyToolBar(bool gen_images = false); /* Creates tbar */ - inline void CreateMyMenuBar(); /* (re)Creates menubar */ + void CreateMyToolBar(bool gen_images = false); /* Creates tbar */ + void CreateMyMenuBar(); /* (re)Creates menubar */ void AddPage( /* Adds new page to frame */ wxPanel *page, const wxString &short_title, const wxString &long_title, const wxString &image, wxWindowID = -1, @@ -145,7 +145,7 @@ void CreateSysTray(); /* Creates system tray icon */ void LoadAndShowDialogPages(); /* Loads dialog pages */ void ConnectToAnyServer(); /* Sends "connect" command to core */ - inline bool SetActivePage(const wxString &to_show); /* Displays page */ + bool SetActivePage(const wxString &to_show); /* Displays page */ void ShowGUISettingsDlg(); /* Displays GUI settings dialog */ void UpdateToolBar(); /* Updates toolbar buttons */ void UpdateMenuBar(); /* Updates menubar objects */ |
From: <ma...@us...> - 2003-12-20 08:51:32
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv11028 Modified Files: configure Log Message: Fixed `which` output and added -D__GTK2__ if linkined against GTK2 Index: configure =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/configure,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- configure 19 Dec 2003 23:50:11 -0000 1.7 +++ configure 20 Dec 2003 08:51:28 -0000 1.8 @@ -161,7 +161,7 @@ echo -n -e "checking for wx-config... \t\t\t"; if test -x $wxconfig; then wxconfig=$wxconfig; - elif test -x `which wx-config`; then + elif test -x `which wx-config 2>/dev/null`; then wxconfig=`which wx-config`; elif test -x /usr/local/bin/wx-config; then wxconfig=/usr/local/bin/wx-config; @@ -241,6 +241,7 @@ echo -e "\t${colour_warning}Warning: GTK2 support in wxWindows is only experimental,${colour_default}"; echo -e "\t${colour_warning}thus it is not officially supported in this application${colour_default}"; echo -e "\t${colour_warning}either. You have been warned, continue on your own risc.${colour_default}"; + cppflags="$cppflags -D__GTK2__" else echo -e "${colour_yes}no${colour_default}"; fi; |
From: <ma...@us...> - 2003-12-20 04:38:57
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv13853 Modified Files: Changelog Log Message: `Purpose of this Changelog` and some missing dots :) Index: Changelog =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/Changelog,v retrieving revision 1.108 retrieving revision 1.109 diff -u -d -r1.108 -r1.109 --- Changelog 20 Dec 2003 04:32:11 -0000 1.108 +++ Changelog 20 Dec 2003 04:38:54 -0000 1.109 @@ -1,6 +1,6 @@ - ---------------------------------------- - |Changelog for ShareDaemon wxInterface | - ---------------------------------------- + ---------------------------------------- + |Changelog for ShareDaemon wxInterface | + ---------------------------------------- ############################################################################### # Notice about ShareDaemon wxInterface Changelog usage and formatting. # # # @@ -9,16 +9,20 @@ # * @CHANGE # # # # @DATE is date of commiting to CVS (changes that are not commited to # -# CVS should NEVER be added to Changelog). Local time is ok. # +# CVS should NEVER be added to Changelog). Local time is ok. # # @PERSON is the full REAL name of the one commiting to CVS (not necceserely # -# the code author). If you wish to add your nick/handle, add it after your # -# name in parenthesis. # +# the code author). If you wish to add your nick/handle, add it after # +# your name in parenthesis. # # @CHANGE is a short description of the modification done. If you are not # -# the author of parts/all of the code, add note about the original author # -# in parenthesis. # +# the author of parts/all of the code, add note about the original # +# author in parenthesis. # # # # ALWAYS keep line lenghts UNDER/AT 80 characters. # # ALL ChangeLog entries end with a dot. # +# # +# The purpose of this Changelog is not to keep track of all changes to CVS # +# (thats what CVS logs are for), but rather as a diary for code changing. # +# This also helps in backtracking changes, or reviewing development history. # ############################################################################### 2003/12/19 Alo Sarv @@ -29,12 +33,12 @@ separate frame. Not supported on wxMac. 2003/12/17 Alo Sarv - * Serverpage look enhancements + * Serverpage look enhancements. * Toolbar right-click popup menu (right-click on empty space in tbar). - * Fullscreen mode switch + * Fullscreen mode switch. 2003/12/13 Alo Sarv - * Configure script + * Configure script. 2003/12/08 Alo Sarv * Fixed frame size/position saving. @@ -120,8 +124,8 @@ * Finalized internationalization and added localization support. * Changed config object to global. -2003/09/06 Seneca - * Added german translation. +2003/09/06 Alo Sarv + * Added german translation by Seneca. 2003/09/06 Alo Sarv * Internationalization. |
From: <ma...@us...> - 2003-12-20 04:32:14
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv13092 Modified Files: Changelog Log Message: Fixed recent dates (month/day were reversed) Index: Changelog =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/Changelog,v retrieving revision 1.107 retrieving revision 1.108 diff -u -d -r1.107 -r1.108 --- Changelog 19 Dec 2003 03:01:12 -0000 1.107 +++ Changelog 20 Dec 2003 04:32:11 -0000 1.108 @@ -21,19 +21,19 @@ # ALL ChangeLog entries end with a dot. # ############################################################################### -2003/19/12 Alo Sarv +2003/12/19 Alo Sarv * Imported Hetfield's GTK systray. -2003/18/12 Alo Sarv +2003/12/18 Alo Sarv * Dialog pages can now be detached from main frame and displayed as separate frame. Not supported on wxMac. -2003/17/12 Alo Sarv +2003/12/17 Alo Sarv * Serverpage look enhancements * Toolbar right-click popup menu (right-click on empty space in tbar). * Fullscreen mode switch -2003/13/12 Alo Sarv +2003/12/13 Alo Sarv * Configure script 2003/12/08 Alo Sarv |
From: <ma...@us...> - 2003-12-20 03:39:30
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv5617/src Modified Files: SBPanel.cpp Log Message: Reduced sidebar headerbutton font size from 12 to 10. Index: SBPanel.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SBPanel.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- SBPanel.cpp 17 Dec 2003 04:05:41 -0000 1.5 +++ SBPanel.cpp 20 Dec 2003 03:39:27 -0000 1.6 @@ -54,8 +54,8 @@ headerbtn = new wxButton( this, -1, title, wxDefaultPosition, wxDefaultSize, 0 ); - headerbtn->SetFont( wxFont( 12, wxROMAN, wxNORMAL, wxBOLD ) ); - mainsizer->Add( headerbtn, 0, wxGROW|wxADJUST_MINSIZE, 5 ); + headerbtn->SetFont(wxFont(10, wxROMAN, wxNORMAL, wxBOLD)); + mainsizer->Add(headerbtn, 0, wxGROW|wxADJUST_MINSIZE, 5); SetAutoLayout(true); SetSizer(mainsizer); |
From: <ma...@us...> - 2003-12-20 03:37:29
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv5284/src Modified Files: Images.cpp Images.h MainDlg.cpp wxInterface.cpp Log Message: Fixed toolbar images Index: Images.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Images.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- Images.cpp 19 Dec 2003 23:50:11 -0000 1.34 +++ Images.cpp 20 Dec 2003 03:37:26 -0000 1.35 @@ -316,23 +316,14 @@ wxBitmap tmp, tmp_new; int x, y; - tmp = wxBitmap(100, 100); - mdc.SelectObject(tmp); - mdc.SetTextForeground(wxColour(10, 10, 10)); #ifdef __WXMAC__ mdc.SetFont(wxFont(10, wxDEFAULT, wxNORMAL, wxNORMAL)); #else mdc.SetFont(wxFont(10, wxDECORATIVE, wxNORMAL, wxBOLD)); #endif - mdc.GetTextExtent(name, &x, &y); - x+=6; - y+=36; - x>tool_img_width ? tool_img_width=x : x=tool_img_width; - y>tool_img_height ? tool_img_height=y : y=tool_img_width; - - tmp_new = wxBitmap(x, y); + tmp_new = wxBitmap(tool_img_width, tool_img_height); mdc.SelectObject(tmp_new); mdc.BeginDrawing(); @@ -349,7 +340,7 @@ GetImage(image), (tmp_new.GetWidth()-32)/2, 2, true ); - mdc.SetTextForeground( wxColour(1,1,1)); + mdc.SetTextForeground(wxColour(1,1,1)); mdc.GetTextExtent(name, &x, &y); mdc.DrawText(name, (tmp_new.GetWidth()-x)/2, 36); #ifndef __WXMSW__ /* Use wxMask for transparency */ @@ -363,4 +354,32 @@ wxBitmap *new_image = new wxBitmap(tmp_new); images.Append(image, new_image); return *new_image; +} + +/********************************************************* CalcToolBitmapSize */ +/* This method loops through the passed wxArrayString and calculates the text */ +/* length for each of the strings using memorydc and GetTextExtent method. If */ +/* calculated text length exceeds what is stored in global variables, update */ +/* the global variables with new values. All this is neccesery to do before */ +/* calling MakeToolImage(),otherwise the toolbar won't be correctly centered. */ +/* @names wxArrayString containing all toolbar button names. */ +/******************************************************************************/ +void CImages::CalcToolBitmapSize(const wxArrayString &names) { +unsigned int i=0; /* Loop counter */ +int x, y; /* For storing image size */ +wxMemoryDC mdc; /* Memory drawing context */ + +#ifdef __WXMAC__ + mdc.SetFont(wxFont(10, wxDEFAULT, wxNORMAL, wxNORMAL)); +#else + mdc.SetFont(wxFont(10, wxDECORATIVE, wxNORMAL, wxBOLD)); +#endif + + for (i=0;i<names.GetCount();i++) { + mdc.GetTextExtent(names.Item(i), &x, &y); + x+=6; + y+=36; + x>tool_img_width ? tool_img_width=x : x=tool_img_width; + y>tool_img_height ? tool_img_height=y : y=tool_img_width; + } } Index: Images.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Images.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- Images.h 18 Dec 2003 04:25:36 -0000 1.16 +++ Images.h 20 Dec 2003 03:37:26 -0000 1.17 @@ -42,6 +42,7 @@ void LoadImages(); inline wxBitmap& GetImage(const wxString &name); void UpdateImages(wxWindow *parent); + void CalcToolBitmapSize(const wxArrayString &names); private: ListOfBitmaps images; }; Index: MainDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- MainDlg.cpp 19 Dec 2003 23:50:11 -0000 1.29 +++ MainDlg.cpp 20 Dec 2003 03:37:26 -0000 1.30 @@ -165,9 +165,9 @@ icon.CopyFromBitmap(img->GetImage(wxT("mule"))); SetIcon(icon); - #ifdef wxHAS_TASK_BAR_ICON - systray = new CSysTray(); - #endif +#ifdef wxHAS_TASK_BAR_ICON + systray = new CSysTray(); +#endif m_mainsizer = new wxFlexGridSizer(1); m_mainsizer->AddGrowableCol(0); @@ -211,12 +211,11 @@ LoadAndShowDialogPages(); - img->MakeToolImage(_("Connect"), wxT("btn_connect")); - img->MakeToolImage(_("Preferences"), wxT("btn_guisettings")); - CreateMyToolBar(); + CreateMyToolBar(true); CreateMyMenuBar(); wxGetApp().mainframe_active = true; + start_up = false; } /****************************************************************** ~CMainDlg */ @@ -242,12 +241,12 @@ m_config->Write(wxT("Start Page"), GetCurPage()->short_title); } - #ifdef wxHAS_TASK_BAR_ICON - #ifdef __WXMSW__ - systray->RemoveIcon(); - #endif - delete systray; +#ifdef wxHAS_TASK_BAR_ICON + #ifdef __WXMSW__ + systray->RemoveIcon(); #endif + delete systray; +#endif wxMenuBar *mb = GetMenuBar(); if (mb != NULL) { @@ -296,7 +295,6 @@ new_page->content->Show(true); cur_page = new_page; Layout(); - start_up = false; UpdateToolBar(); UpdateMenuBar(); return true; @@ -333,9 +331,22 @@ MyToolBar *tb = new MyToolBar( this, ID_TOOLBAR, wxDefaultPosition, wxDefaultSize, - tool_align|wxNO_BORDER|wxTB_3DBUTTONS|wxTB_FLAT + tool_align|wxNO_BORDER|wxTB_3DBUTTONS|wxTB_FLAT|wxCLIP_CHILDREN ); + if (start_up) { + wxArrayString names; + names.Add(_("Connect")); + for (i=0;i<pages.GetCount();i++) { + if (pages.IsEmpty()) { + break; + } + names.Add(pages.Item(i)->GetData()->short_title); + } + names.Add(_("Preferences")); + img->CalcToolBitmapSize(names); + } + tb->SetToolBitmapSize( wxSize(img->tool_img_width, img->tool_img_height) ); @@ -886,6 +897,13 @@ m_config->Write( wxT("/General/Show MenuBar"), false ); + if (GetToolBar() == NULL) { + m_config->Write( + wxT("/General/Show ToolBar"), + true + ); + CreateMyToolBar(); + } } CreateMyMenuBar(); break; @@ -898,6 +916,13 @@ m_config->Write( wxT("/General/Show ToolBar"), false ); + if (GetMenuBar() == NULL) { + m_config->Write( + wxT("/General/Show MenuBar"), + true + ); + CreateMyMenuBar(); + } } CreateMyToolBar(); UpdateMenuBar(); @@ -1012,7 +1037,9 @@ newpage->image = image; newpage->id = id; - img->MakeToolImage(newpage->short_title, newpage->image); + if (!start_up) { + img->MakeToolImage(newpage->short_title, newpage->image); + } pages.Append(short_title, newpage); if (update_bars) { Index: wxInterface.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/wxInterface.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- wxInterface.cpp 18 Dec 2003 04:25:36 -0000 1.10 +++ wxInterface.cpp 20 Dec 2003 03:37:26 -0000 1.11 @@ -73,12 +73,11 @@ } // No need to delete splash - it will be deleted by wx Localize(); - /* Display the main dialog */ mainframe = new CMainDlg( NULL, -1, APPVER_LONG, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE| - wxNO_FULL_REPAINT_ON_RESIZE, + wxNO_FULL_REPAINT_ON_RESIZE, m_locale ); mainframe->Show( TRUE ); |
From: <ma...@us...> - 2003-12-19 23:50:16
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv5475 Modified Files: configure Log Message: wxMSW: Fixed registry issues, statusbar flickering, toolbar images and resource compilation. General: Now uses `which` to detect wx-config. Index: configure =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/configure,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- configure 19 Dec 2003 03:01:14 -0000 1.6 +++ configure 19 Dec 2003 23:50:11 -0000 1.7 @@ -19,22 +19,135 @@ ################################################################################ ## -# Checks for ccache (compiler cache) availability +# Parses command-line options and sets variables as needed. # -function check_ccache() { - echo -n -e "checking for ccache...\t\t\t\t"; - if test -x /usr/local/bin/ccache; then - ccache=/usr/local/bin/ccache; +function parse_cmdline() { + # defaults + wxconfig=wx-config; + gtkconfig=gtk-config; + prefix=/usr/local/bin; + include=-I/local/include; + include_dir=/local/include; + optimise=1; + debug=0; + profile=0; + show_flags=0; + patch_sizer=0; + colours=1; + + while test $# -gt 0; do + case $1 in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --help) + print_help; + ;; + --with-wx-config=*) + wxconfig=$optarg; + ;; + --with-gtk-config=*) + gtkconfig=$optarg; + ;; + --prefix=*) + prefix=$optarg; + ;; + --include-dir=*) + include="$include -I$optarg"; + include_dir="$include_dir $optarg" + ;; + --enable-optimise) + optimise=1; + ;; + --disable-optimise) + optimise=0; + ;; + --enable-debug) + debug=1; + ;; + --disable-debug) + debug=0; + ;; + --enable-profile) + profile=1; + ;; + --disable-profile) + profile=0; + ;; + --has-patched-wxsizer) + patch_sizer=1; + ;; + --show-flags) + show_flags=1; + ;; + --hide-flags) + show_flags=0; + ;; + --disable-colours) + colours=0; + ;; + --enable-colours) + colours=1; + ;; + *) + print_help; + ;; + esac; + shift; + done; + + echo -e -n "checking for --disable-colours\t\t\t"; + if test $colours = 1; then + colour_default="\33[0;2m" + colour_yes="\33[32;22m" + colour_no="\33[31;22m" + colour_output="\33[35;1m" + colour_warning="\33[36;1m" + echo -e "${colour_yes}no${colour_default}"; + else + echo -e "yes"; + fi; + + echo -e "checking for --with-wx-config\t\t\t$wxconfig"; + echo -e "checking for --prefix\t\t\t\t$prefix"; + echo -e "checking for --include-dir\t\t\t$include_dir"; + + echo -e -n "checking for --enable-optimise\t\t\t"; + if test $optimise = 1; then + echo -e "${colour_yes}yes${colour_default}"; + cppflags="$cppflags -O3" + else + echo -e "${colour_no}no${colour_default}"; + fi; + + echo -e -n "checking for --enable-debug\t\t\t"; + if test $debug = 1; then + echo -e "${colour_yes}yes${colour_default}"; + cppflags="$cppflags -g -ggdb -fno-inline -Wall" + else + echo -e "${colour_no}no${colour_default}"; + fi; + + echo -e -n "checking for --enable-profile\t\t\t"; + if test $profile = 1; then + echo -e "${colour_yes}yes${colour_default}"; + cppflags="$cppflags -pg" + else + echo -e "${colour_no}no${colour_default}"; + fi; + + echo -e -n "checking for --has-patched-wxsizer\t\t"; + if test $patch_sizer = 1; then + echo -e "${colour_yes}yes${colour_default}"; + else + echo -e "${colour_no}no${colour_default}"; + fi; + + echo -e -n "checking for --show-flags\t\t\t"; + if test $show_flags = 1; then echo -e "${colour_yes}yes${colour_default}"; - elif test -x /usr/bin/ccache; then - ccache=/usr/bin/ccache; - echo -e "${colour_yes}yes${colour_default}" - elif test -x /local/bin/ccache; then - ccache=/local/bin/ccache; - echo -e "${colour_yes}yes${colour_default}" - elif test -x /bin/ccache; then - ccache=/bin/ccache; - echo -e "${colour_yes}yes${colour_default}" else echo -e "${colour_no}no${colour_default}"; fi; @@ -48,6 +161,8 @@ echo -n -e "checking for wx-config... \t\t\t"; if test -x $wxconfig; then wxconfig=$wxconfig; + elif test -x `which wx-config`; then + wxconfig=`which wx-config`; elif test -x /usr/local/bin/wx-config; then wxconfig=/usr/local/bin/wx-config; elif test -x /usr/bin/wx-config; then @@ -119,6 +234,7 @@ # Checks if wxWindows library was linked against GTK2 # function check_wxgtk2() { +if $wxconfig --cppflags | grep -q 'gtk'; then echo -e -n "checking if wxWindows was linked against GTK2..."; if $wxconfig --cppflags | grep -q 'gtk2' ; then echo -e "${colour_no}yes${colour_default}"; @@ -128,19 +244,78 @@ else echo -e "${colour_yes}no${colour_default}"; fi; +fi; } ## -# Outputs error message about too old wxWindows library and exits with false. +# Checks if wxWindows was linked against MSW # -function wrong_version() { - cat<<EOF -wxWindows library was found, but is too old for usage (v$wxversion_major.\ -$wxversion_minor.$wxversion_patch). Please download -latest version for your platform ( wxGTK for Linux, wxMac for Mac OS, wxMSW for -MS Windows ) from http://www.wxwindows.org, install it and rerun configure. +function check_wxmsw() { + if $wxconfig --cppflags | grep -q 'msw'; then + res=wxInterface_private.res + fi; +} + +### +# Checks for availability of GTK headers (needed for GTK systray) +# +function check_gtkconfig() { +if $wxconfig --cppflags | grep -q 'gtk'; then + echo -e -n "checking for gtk-config..."; + if test -x $gtkconfig; then + gtkconfig=$gtkconfig; + has_gtk=1; + elif test -x /usr/local/bin/gtk-config; then + gtkconfig=/usr/local/bin/gtk-config; + has_gtk=1; + elif test -x /usr/bin/gtk-config; then + gtkconfig=/usr/bin/gtk-config; + has_gtk=1; + elif test -x /bin/gtk-config; then + gtkconfig=/bin/gtk-config; + has_gtk=1; + elif test -x /local/bin/gtk-config; then + gtkconfig=/local/bin/gtk-config; + has_gtk=1; + else + echo -e "${colour_no}no${colour_warning}"; + cat << EOF +gtk-config was not found in standard locations. This means that either +you do not have GTK installed, you are missing GTK developer packages, +or you have installed GTK into custom location. In the latter case, +please rerun configure with --with-gtk-config=PREFIX. +GTK systray will be disabled. EOF - exit 1; + echo -e "$(colour_default)"; + has_gtk=0; + fi; + if test $has_gtk = 1; then + echo -e "${colour_yes}\t\t\tyes${colour_default}"; + fi; +fi; +} + + +## +# Checks for ccache (compiler cache) availability +# +function check_ccache() { + echo -n -e "checking for ccache...\t\t\t\t"; + if test -x /usr/local/bin/ccache; then + ccache=/usr/local/bin/ccache; + echo -e "${colour_yes}yes${colour_default}"; + elif test -x /usr/bin/ccache; then + ccache=/usr/bin/ccache; + echo -e "${colour_yes}yes${colour_default}" + elif test -x /local/bin/ccache; then + ccache=/local/bin/ccache; + echo -e "${colour_yes}yes${colour_default}" + elif test -x /bin/ccache; then + ccache=/bin/ccache; + echo -e "${colour_yes}yes${colour_default}" + else + echo -e "${colour_no}no${colour_default}"; + fi; } ## @@ -194,144 +369,27 @@ s#@PRINT_CPP_FLAGS@#$print_cpp_flags#; \ s#@PRINT_LINK_FLAGS@#$print_link_flags#; \ s#@TRAY_OBJECTS@#$tray_objs#; \ + s#@RES@#$res#; \ " src/Makefile.am >> src/Makefile; } -## -# Parses command-line options and sets variables as needed. -# -parse_cmdline() { - # defaults - wxconfig=wx-config; - gtkconfig=gtk-config; - prefix=/usr/local/bin; - include=-I/local/include; - include_dir=/local/include; - optimise=1; - debug=0; - profile=0; - show_flags=0; - patch_sizer=0; - colours=1; - - while test $# -gt 0; do - case $1 in - -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - case $1 in - --help) - print_help; - ;; - --with-wx-config=*) - wxconfig=$optarg; - ;; - --with-gtk-config=*) - gtkconfig=$optarg; - ;; - --prefix=*) - prefix=$optarg; - ;; - --include-dir=*) - include="$include -I$optarg"; - include_dir="$include_dir $optarg" - ;; - --enable-optimise) - optimise=1; - ;; - --disable-optimise) - optimise=0; - ;; - --enable-debug) - debug=1; - ;; - --disable-debug) - debug=0; - ;; - --enable-profile) - profile=1; - ;; - --disable-profile) - profile=0; - ;; - --has-patched-wxsizer) - patch_sizer=1; - ;; - --show-flags) - show_flags=1; - ;; - --hide-flags) - show_flags=0; - ;; - --disable-colours) - colours=0; - ;; - --enable-colours) - colours=1; - ;; - *) - print_help; - ;; - esac; - shift; - done; - - echo -e -n "checking for --disable-colours\t\t\t"; - if test $colours = 1; then - colour_default="\33[0;2m" - colour_yes="\33[32;22m" - colour_no="\33[31;22m" - colour_output="\33[35;1m" - colour_warning="\33[36;1m" - echo -e "${colour_yes}no${colour_default}"; - else - echo -e "yes"; - fi; - - echo -e "checking for --with-wx-config\t\t\t$wxconfig"; - echo -e "checking for --prefix\t\t\t\t$prefix"; - echo -e "checking for --include-dir\t\t\t$include_dir"; - - echo -e -n "checking for --enable-optimise\t\t\t"; - if test $optimise = 1; then - echo -e "${colour_yes}yes${colour_default}"; - cppflags="$cppflags -O3" - else - echo -e "${colour_no}no${colour_default}"; - fi; - - echo -e -n "checking for --enable-debug\t\t\t"; - if test $debug = 1; then - echo -e "${colour_yes}yes${colour_default}"; - cppflags="$cppflags -g -ggdb -fno-inline -Wall" - else - echo -e "${colour_no}no${colour_default}"; - fi; - echo -e -n "checking for --enable-profile\t\t\t"; - if test $profile = 1; then - echo -e "${colour_yes}yes${colour_default}"; - cppflags="$cppflags -pg" - else - echo -e "${colour_no}no${colour_default}"; - fi; - echo -e -n "checking for --has-patched-wxsizer\t\t"; - if test $patch_sizer = 1; then - echo -e "${colour_yes}yes${colour_default}"; - else - echo -e "${colour_no}no${colour_default}"; - fi; - echo -e -n "checking for --show-flags\t\t\t"; - if test $show_flags = 1; then - echo -e "${colour_yes}yes${colour_default}"; - else - echo -e "${colour_no}no${colour_default}"; - fi; +## +# Outputs error message about too old wxWindows library and exits with false. +# +function wrong_version() { + cat<<EOF +wxWindows library was found, but is too old for usage (v$wxversion_major.\ +$wxversion_minor.$wxversion_patch). Please download +latest version for your platform ( wxGTK for Linux, wxMac for Mac OS, wxMSW for +MS Windows ) from http://www.wxwindows.org, install it and rerun configure. +EOF + exit 1; } + ## # Outputs a detailed help text on command-line options # @@ -354,44 +412,6 @@ exit 0; } -### -# Checks for availability of GTK headers (needed for GTK systray) -# -function check_gtkconfig() { -if $wxconfig --cppflags | grep -q 'gtk'; then - echo -e -n "checking for gtk-config..."; - if test -x $gtkconfig; then - gtkconfig=$gtkconfig; - has_gtk=1; - elif test -x /usr/local/bin/gtk-config; then - gtkconfig=/usr/local/bin/gtk-config; - has_gtk=1; - elif test -x /usr/bin/gtk-config; then - gtkconfig=/usr/bin/gtk-config; - has_gtk=1; - elif test -x /bin/gtk-config; then - gtkconfig=/bin/gtk-config; - has_gtk=1; - elif test -x /local/bin/gtk-config; then - gtkconfig=/local/bin/gtk-config; - has_gtk=1; - else - echo -e "${colour_no}no${colour_warning}"; - cat << EOF -gtk-config was not found in standard locations. This means that either -you do not have GTK installed, you are missing GTK developer packages, -or you have installed GTK into custom location. In the latter case, -please rerun configure with --with-gtk-config=PREFIX. -GTK systray will be disabled. -EOF - echo -e "$(colour_default)"; - has_gtk=0; - fi; - if test $has_gtk = 1; then - echo -e "${colour_yes}\t\t\tyes${colour_default}"; - fi; -fi; -} ## # Main script execution part. @@ -400,6 +420,7 @@ check_wxconfig; check_wxversion; check_wxgtk2; +check_wxmsw; check_gtkconfig; check_ccache; gen_makefile; |
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv5475/src Modified Files: GUISettingsDlg.cpp Images.cpp MainDlg.cpp MainDlg.h Makefile.am wxInterface_private.rc Log Message: wxMSW: Fixed registry issues, statusbar flickering, toolbar images and resource compilation. General: Now uses `which` to detect wx-config. Index: GUISettingsDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/GUISettingsDlg.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- GUISettingsDlg.cpp 19 Dec 2003 03:01:14 -0000 1.28 +++ GUISettingsDlg.cpp 19 Dec 2003 23:50:11 -0000 1.29 @@ -78,10 +78,10 @@ * Loads settings from config object and sets up dialog controls values. */ void CGUISettingsDlg::LoadSettings() { - int font, iconset, tool_align, startpage, numlang, numiconsets; + int font, iconset, tool_align, numlang, numiconsets; bool show_splash, prompt_exit, show_toolbar, show_menubar, remember_last; - wxString tmpname; + wxString tmpname, startpage; /* Read from config. If no value found, &<field> remains unchanged */ m_config->SetPath(wxT("/General")); @@ -92,7 +92,7 @@ m_config->Read(wxT("Show ToolBar"), &show_toolbar, true); m_config->Read(wxT("Toolbar Alignment"), &tool_align, wxTB_HORIZONTAL); m_config->Read(wxT("Show MenuBar"), &show_menubar, false); - m_config->Read(wxT("Start page"), &startpage, 0); + m_config->Read(wxT("Start Page"), &startpage, wxT("Servers")); m_config->Read(wxT("Remember last"), &remember_last, true); /* Load iconset data */ @@ -131,7 +131,7 @@ GetShowTool()->SetValue(show_toolbar); GetShowMenu()->SetValue(show_menubar); GetRememberLast()->SetValue(remember_last); - GetStartPage()->SetSelection(startpage); + GetStartPage()->SetStringSelection(startpage); switch (tool_align) { case wxTB_HORIZONTAL: tool_align = 0; break; @@ -194,7 +194,9 @@ m_config->Write(wxT("Show ToolBar"), GetShowTool()->GetValue()); m_config->Write(wxT("Toolbar Alignment"), tool_align); m_config->Write(wxT("Show MenuBar"), GetShowMenu()->GetValue()); - m_config->Write(wxT("Start page"), GetStartPage()->GetSelection()); + m_config->Write( + wxT("Start Page"), GetStartPage()->GetStringSelection() + ); m_config->Write(wxT("Remember last"), GetRememberLast()->GetValue()); /* Iconsets data */ @@ -484,9 +486,9 @@ wxStaticBoxSizer *item19 = new wxStaticBoxSizer( item20, wxVERTICAL ); wxString strs21[] = { - _("Server"), - _("Transfer"), + _("Servers"), _("Search"), + _("Transfer"), _("Shared Files"), _("Messages"), _("Statistics") Index: Images.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Images.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- Images.cpp 18 Dec 2003 04:25:36 -0000 1.33 +++ Images.cpp 19 Dec 2003 23:50:11 -0000 1.34 @@ -326,10 +326,15 @@ mdc.SetFont(wxFont(10, wxDECORATIVE, wxNORMAL, wxBOLD)); #endif mdc.GetTextExtent(name, &x, &y); + x+=6; + y+=36; - tmp_new = wxBitmap(x+6, y+36); - mdc.SelectObject(tmp_new); + x>tool_img_width ? tool_img_width=x : x=tool_img_width; + y>tool_img_height ? tool_img_height=y : y=tool_img_width; + + tmp_new = wxBitmap(x, y); + mdc.SelectObject(tmp_new); mdc.BeginDrawing(); #ifdef __WXMSW__ /* This gives transparent image on wxMSW */ mdc.SetPen(*wxTRANSPARENT_PEN); Index: MainDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- MainDlg.cpp 19 Dec 2003 03:01:14 -0000 1.28 +++ MainDlg.cpp 19 Dec 2003 23:50:11 -0000 1.29 @@ -96,7 +96,7 @@ s->AddGrowableCol(0); s->AddGrowableRow(0); cnt->content->Reparent(this); - s->Add(cnt->content, 0, wxGROW|wxEXPAND|wxALL, 5); + s->Add(cnt->content, 0, wxGROW|wxEXPAND); SetSizer(s); Layout(); Show(); @@ -186,7 +186,10 @@ Move(posx, posy); } - wxPanel *statusbar = new wxPanel(this, -1); + wxPanel *statusbar = new wxPanel( + this, -1, wxDefaultPosition, wxDefaultSize, + wxNO_FULL_REPAINT_ON_RESIZE + ); StatusBar(statusbar, true, true); m_mainsizer->Add(statusbar, 0, wxGROW|wxEXPAND, 0); wxASSERT_MSG( @@ -209,7 +212,7 @@ LoadAndShowDialogPages(); img->MakeToolImage(_("Connect"), wxT("btn_connect")); - img->MakeToolImage(_("Prefenreces"), wxT("btn_guisettings")); + img->MakeToolImage(_("Preferences"), wxT("btn_guisettings")); CreateMyToolBar(); CreateMyMenuBar(); @@ -236,7 +239,7 @@ m_config->SetPath(wxT("/General")); m_config->Read(wxT("Remember last"), &remember_last, true); if (remember_last) { - m_config->Write(wxT("Start page"), GetCurPage()->short_title); + m_config->Write(wxT("Start Page"), GetCurPage()->short_title); } #ifdef wxHAS_TASK_BAR_ICON @@ -266,12 +269,15 @@ /* full name of the page, eg "Servers" or "Transfer" */ /******************************************************************************/ bool CMainDlg::SetActivePage(const wxString &to_show) { - if (cur_page == NULL) { /* Assume startup */ - start_up = true; - } else if (cur_page->short_title == to_show) { /* Already shown */ - return false; + if (cur_page == NULL) { + start_up = true; /* Assume startup */ + } else if (to_show == wxEmptyString) { + return false; /* Nothing to show */ + } else if (to_show == wxT("")) { + return false; /* Nothing to show */ + } else if (cur_page->short_title == to_show) { + return false; /* Already shown */ } - Page *new_page = pages.Find(to_show)->GetData(); if (new_page == NULL) { wxFAIL_MSG(wxString::Format( @@ -316,6 +322,7 @@ SetToolBar(NULL); show_tool = true; + m_config->Read(wxT("/General/Show ToolBar"), &show_tool, true); if (!show_tool) { return; @@ -473,8 +480,7 @@ wxT("btn_statistics"), ID_STATISTICSWND ); - m_config->Read(wxT("/General/Start page"), &start_page, wxT("Servers")); - + m_config->Read(wxT("/General/Start Page"), &start_page, wxT("Servers")); if (start_page.ToLong(&tmp)) { /* Old_style (<0.2.0) conf file */ switch (tmp) { case 0: start_page = wxT("Servers"); break; @@ -485,7 +491,9 @@ case 5: start_page = wxT("Statistics"); break; default: start_page = wxT("Servers"); break; } - } + } else if (start_page == wxT("")) { /* Windows registry returns "" if */ + start_page = wxT("Servers"); /* int was stored but wxString */ + } /* was read */ SetActivePage(start_page); /* Error-checking is done there */ } Index: MainDlg.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- MainDlg.h 18 Dec 2003 04:25:36 -0000 1.12 +++ MainDlg.h 19 Dec 2003 23:50:12 -0000 1.13 @@ -68,7 +68,7 @@ ); /* Constructor */ private: DECLARE_EVENT_TABLE() /* Event table declaration */ - void RightClick(wxMouseEvent &event); + void RightClick(wxMouseEvent &event); /* Right mouse clicks events */ }; /* This very small class usually shows a frame with one dialog page as content*/ Index: Makefile.am =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Makefile.am 19 Dec 2003 03:01:14 -0000 1.5 +++ Makefile.am 19 Dec 2003 23:50:12 -0000 1.6 @@ -23,7 +23,7 @@ UploadListCtrl.o \ wxInterface.o \ wxInterface_wdr.o\ - $(RES) \ + @RES@ \ all: $(PROGRAM) @@ -47,7 +47,7 @@ false; \ fi; -.cpp.o : +.cpp.o: @echo -e -n "$(ACTIONCOLOR)Compiling $(INPUTCOLOR)$<$(ACTIONCOLOR) to " @echo -e -n "$(OUTPUTCOLOR)$@$(ACTIONCOLOR)@PRINT_CPP_FLAGS@: $(ATTENTIONCOLOR)" @if @CXX@ @CXX_FLAGS@ @CPP_FLAGS@ @INCLUDE@ -c -o $@ $< 2>.err; then \ @@ -70,9 +70,20 @@ .rc.res: @echo -e -n "$(ACTIONCOLOR)Compiling $(INPUTCOLOR)$<$(ACTIONCOLOR) to " @echo -e -n "$(OUTPUTCOLOR)$@$(ACTIONCOLOR): $(ATTENTIONCOLOR)" - @if @WINDRES@ -i $< -I rc -o $@ -O coff --include-dir=@INCLUDE@; then \ - echo -e "$(WELLCOLOR)ok.$(ACTIONCOLOR)"; \ + @if windres -i $< -I rc -o $@ -O coff --include-dir=/local/include 2>.err; then \ + if test -s .err; then \ + echo -e "$(WARNINGCOLOR)ok, but warnings:"; \ + cat .err; \ + rm -f .err; \ + echo -e "$(DEFAULTCOLOR)"; \ + else \ + echo -e "$(WELLCOLOR)ok.$(ACTIONCOLOR)"; \ + fi; \ else \ + echo -e "failed:"; \ + cat .err; \ + rm -f .err; \ + echo -e "$(DEFAULTCOLOR)"; \ false; \ fi; Index: wxInterface_private.rc =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/wxInterface_private.rc,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- wxInterface_private.rc 29 Nov 2003 09:16:40 -0000 1.3 +++ wxInterface_private.rc 19 Dec 2003 23:50:12 -0000 1.4 @@ -1,13 +1,9 @@ -// THIS FILE WILL BE OVERWRITTEN BY DEV-C++! -// DO NOT EDIT! - -//#include "xmule2-ui-wx_private.rc" -#include <wx/msw/wx.rc> -A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "wxInterface.ico" - -// -// SUPPORT FOR WINDOWS XP THEMES: -// THIS WILL MAKE THE PROGRAM USE THE COMMON CONTROLS -// LIBRARY VERSION 6.0 (IF IT IS AVAILABLE) -// -1 24 "wxInterface.Manifest" +#include <wx/msw/wx.rc> +A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "wxInterface.ico" + +// +// SUPPORT FOR WINDOWS XP THEMES: +// THIS WILL MAKE THE PROGRAM USE THE COMMON CONTROLS +// LIBRARY VERSION 6.0 (IF IT IS AVAILABLE) +// +1 24 "wxInterface.Manifest" |
From: <ma...@us...> - 2003-12-19 03:33:40
|
Update of /cvsroot/sharedaemon/ui-wx In directory sc8-pr-cvs1:/tmp/cvs-serv15697 Modified Files: TODO Log Message: Added GTKTray bugs Index: TODO =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/TODO,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- TODO 18 Dec 2003 09:26:48 -0000 1.8 +++ TODO 19 Dec 2003 03:33:37 -0000 1.9 @@ -1,45 +1,63 @@ -* Copy lists data (single line and complete list). +********************* Main application BUGS/TODO ********************* +* Maintainer: Alo Sarv aka Madcat <ma...@us...> * +********************************************************************** +* Copy lists data (single line and complete list) (ctrl+c/shift+ins). * Recommended sidebar sections for pages: - Server Page - - Add servers - - Update serverlist from URL - - Server settings (autoconnnect etc) - - Log settings - Search Page - - Search string, start/stop buttons - - Search result filters - - Searching options (jigle/server/global) - Transfer Page - - Add download from ed2k link - - Transfer settings (speed limits, source limits) - - Download settings a'la category, priority, a4af etc - - Upload settings a'la max slots and similar - Shared Files Page - - Shared directories (wxTreeCtrl) - - Shared files priorities etc - Messages Page - - Friends list - - Accept/refuse messages - - Nickname - Statistics Page - - Update rate - - Selection of graphs to display + Server Page + - Add servers + - Update serverlist from URL + - Server settings (autoconnnect etc) + - Log settings + Search Page + - Search string, start/stop buttons + - Search result filters + - Searching options (jigle/server/global) + Transfer Page + - Add download from ed2k link + - Transfer settings (speed limits, source limits) + - Download settings a'la category, priority, a4af etc + - Upload settings a'la max slots and similar + Shared Files Page + - Shared directories (wxTreeCtrl) + - Shared files priorities etc + Messages Page + - Friends list + - Accept/refuse messages + - Nickname + Statistics Page + - Update rate + - Selection of graphs to display * Find out what's the leaking `non-object data` that debug wx detects * Splitter windows don't resize correct after switching to fullscreen * Page detaching engine loses few wxMask/wxObject type objects during the process, probably the toolbar buttons images. * Fix toolbar/statusbar flickering on wxMSW. -* Hack wxToolBar to trigger EVT_LEFT_DOWN mouse events and use those - for changing pages instead of EVT_LEFT_CLICK - makes it seem +* Hack wxToolBar to trigger EVT_LEFT_DOWN mouse events and use those + for changing pages instead of EVT_LEFT_CLICK - makes it seem faster. * Detached frames aren't affected by iconset changing. * Listctrl's aren't affected by iconset changing. -* Remember toolbar buttons order between sessions, provide some nice +* Remember toolbar buttons order between sessions, provide some nice dialog for modifying it. -* Implement colour selection. Can use the same engine for runtime +* Implement colour selection. Can use the same engine for runtime updating as I used in CImages::UpdateImages(). -* Implement font selection. Can use the same engine for runtime +* Implement font selection. Can use the same engine for runtime updating as I used in CImages::UpdateImages(). -* Implement a wxMac version of detaching engine (will probably need +* Implement a wxMac version of detaching engine (will probably need to destroy the page and recreate in new frame). + +*********************** GTK SYSTRAY BUGS/TODO *********************** +* Maintainer: Patrizio Bassi aka Hetfield <het...@us... * +********************************************************************* +* Fix GTK warnings/criticals +* Fix compilation against GTK2 (something with headers) +* Fix coding style (read ShareDaemon coding standards here: + "http://sourceforge.net/docman/display_doc.php?docid=20130&gr + oup_id=94958" and take a look at MainDlg.cpp/.h for example. +* Use PNG images instead of XPM. Get the PNG image from CImages class + `img->GetImage(wxT("mule"));` +* Fix any compilations issues that arise when compiling against + wxgtk2ud (configure wx with --enable-gtk2 --enable-unicode + --enable-debug). +* Autodetect which WM is running and use the corresponding trayicon. |
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv11041/src Modified Files: GUISettingsDlg.cpp MainDlg.cpp Makefile.am SysTray.cpp SysTray.h defines.h Added Files: TrayCoreEngine.c TrayCoreEngine.h Log Message: Hetfields systray (Patch #845694) --- NEW FILE: TrayCoreEngine.c --- /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* eggtrayicon.c * Copyright (C) 2002 Anders Carlsson <and...@gn...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ [...1506 lines suppressed...] } gdk_error_trap_pop (); return stamp; } void egg_tray_icon_cancel_message (EggTrayIcon *icon, guint id) { g_return_if_fail (EGG_IS_TRAY_ICON (icon)); g_return_if_fail (id > 0); egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_CANCEL_MESSAGE, (Window)gtk_plug_xembed_get_id (GTK_PLUG_XEMBED (icon)), id, 0, 0); /*egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_CANCEL_MESSAGE, (Window)gtk_plug_get_id (GTK_PLUG (icon)), id, 0, 0);*/ } --- NEW FILE: TrayCoreEngine.h --- /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* eggtrayicon.h * Copyright (C) 2002 Anders Carlsson <and...@gn...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* THIS FILE IS A MERGE OF EGGTRAYICON AND GTKPLUGEXEMBED FROM XMULE THESE FILES WERE MODIFIED BY TIKU i've merged it for more integration and for compressing it. Hetfield aka Patrizio Bassi <he...@em...> */ #ifndef __EGG_TRAY_ICON_H__ #define __EGG_TRAY_ICON_H__ #include <gtk/gtkplug.h> #include <gdk/gdkx.h> #include <gtk/gtk.h> #include <gtk/gtkprivate.h> #include <gdk/gdkkeysyms.h> #include <string.h> #include <gdk/gdkx.h> #include <gdk/gdk.h> #include <gtk/gtksocket.h> #include <stdarg.h> #include <gtk/gtkwindow.h> typedef struct _tagSIZE { int cx,cy;} SIZE; typedef unsigned int UINT; typedef UINT* UINT_PTR; typedef char* LPCSTR; typedef unsigned char BYTE; typedef unsigned long DWORD; typedef unsigned long BOOL; typedef signed long LONG; typedef unsigned long ULONG; typedef unsigned long long ULONGLONG; typedef BYTE* LPBYTE; typedef int INT; typedef unsigned short WORD; typedef unsigned char* LPCTSTR; typedef DWORD COLORREF; typedef void VOID; typedef void* LPVOID; typedef void* PVOID; typedef struct _POINT { UINT x,y; } POINT; typedef struct _RECT1 { UINT left,top,right,bottom; } RECT1; //typedef RECT1* LPRECT1; typedef struct _WINDOWPLACEMENT { UINT length; UINT flags; UINT showCmd; POINT ptMinPosition; POINT ptMaxPosition; RECT1 rcNormalPosition; } WINDOWPLACEMENT; #define min(a,b) ((a)<(b)?(a):(b)) #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #define GTK_TYPE_PLUG_XEMBED (gtk_plug_xembed_get_type ()) #define GTK_PLUG_XEMBED(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_PLUG_XEMBED, GtkPlugXEmbed)) #define GTK_PLUG_XEMBED_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_PLUG_XEMBED, GtkPlugXEmbedClass)) #define GTK_IS_PLUG_XEMBED(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_PLUG_XEMBED)) #define GTK_IS_PLUG_XEMBED_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PLUG_XEMBED)) #define GTK_PLUG_XEMBED_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_PLUG_XEMBED, GtkPlugXEmbedClass)) typedef struct _GtkPlugXEmbed GtkPlugXEmbed; typedef struct _GtkPlugXEmbedClass GtkPlugXEmbedClass; typedef guint32 GtkPlugXEmbedNativeWindow; struct _GtkPlugXEmbed { GtkWindow window; GdkWindow *socket_window; #ifdef PORT_COMPLETE GtkWidget *modality_window; GtkWindowGroup *modality_group; #endif GHashTable *grabbed_keys; guint same_app : 1; }; struct _GtkPlugXEmbedClass { GtkWindowClass parent_class; void (*embedded) (GtkPlugXEmbed *plug); /* Padding for future expansion */ void (*_gtk_reserved1) (void); void (*_gtk_reserved2) (void); void (*_gtk_reserved3) (void); void (*_gtk_reserved4) (void); }; GtkType gtk_plug_xembed_get_type (void) G_GNUC_CONST; void gtk_plug_xembed_construct (GtkPlugXEmbed *plug, GtkPlugXEmbedNativeWindow socket_id); GtkWidget* gtk_plug_xembed_new (GtkPlugXEmbedNativeWindow socket_id); GtkPlugXEmbedNativeWindow gtk_plug_xembed_get_id (GtkPlugXEmbed *plug); void _gtk_plug_xembed_add_to_socket (GtkPlugXEmbed *plug, GtkSocket *socket); void _gtk_plug_xembed_remove_from_socket (GtkPlugXEmbed *plug, GtkSocket *socket); #define EGG_TYPE_TRAY_ICON (egg_tray_icon_get_type ()) #define EGG_TRAY_ICON(obj) (GTK_CHECK_CAST ((obj), EGG_TYPE_TRAY_ICON, EggTrayIcon)) #define EGG_TRAY_ICON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EGG_TYPE_TRAY_ICON, EggTrayIconClass)) #define EGG_IS_TRAY_ICON(obj) (GTK_CHECK_TYPE ((obj), EGG_TYPE_TRAY_ICON)) #define EGG_IS_TRAY_ICON_CLASS(klass) (GTK_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_TRAY_ICON)) #define EGG_TRAY_ICON_GET_CLASS(obj) (GTK_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_TRAY_ICON, EggTrayIconClass)) typedef struct _EggTrayIcon EggTrayIcon; typedef struct _EggTrayIconClass EggTrayIconClass; struct _EggTrayIcon { GtkPlugXEmbed parent_instance; // GtkPlug parent_instance; guint stamp; Atom selection_atom; Atom manager_atom; Atom system_tray_opcode_atom; Window manager_window; }; struct _EggTrayIconClass { GtkPlugXEmbedClass parent_class; //GtkPlugClass parent_class; }; GtkType egg_tray_icon_get_type (void); EggTrayIcon * egg_tray_icon_new_for_xscreen (Screen *xscreen, const char *name); #if EGG_TRAY_ENABLE_MULTIHEAD EggTrayIcon *egg_tray_icon_new_for_screen (GdkScreen *screen, const gchar *name); #endif EggTrayIcon *egg_tray_icon_new (const gchar *name); guint egg_tray_icon_send_message (EggTrayIcon *icon, gint timeout, const char *message, gint len); void egg_tray_icon_cancel_message (EggTrayIcon *icon, guint id); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __EGG_TRAY_ICON_H__ */ Index: GUISettingsDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/GUISettingsDlg.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- GUISettingsDlg.cpp 18 Dec 2003 04:25:36 -0000 1.27 +++ GUISettingsDlg.cpp 19 Dec 2003 03:01:14 -0000 1.28 @@ -255,7 +255,9 @@ icon.CopyFromBitmap(img->GetImage(wxT("mule"))); mainframe->SetIcon(icon); #ifdef wxHAS_TASK_BAR_ICON + #ifdef __WXMSW__ systray->SetIcon(icon); + #endif #endif } } Index: MainDlg.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/MainDlg.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- MainDlg.cpp 18 Dec 2003 04:25:36 -0000 1.27 +++ MainDlg.cpp 19 Dec 2003 03:01:14 -0000 1.28 @@ -240,7 +240,9 @@ } #ifdef wxHAS_TASK_BAR_ICON - systray->RemoveIcon(); + #ifdef __WXMSW__ + systray->RemoveIcon(); + #endif delete systray; #endif Index: Makefile.am =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Makefile.am 18 Dec 2003 04:25:36 -0000 1.4 +++ Makefile.am 19 Dec 2003 03:01:14 -0000 1.5 @@ -22,11 +22,31 @@ TransferWnd.o \ UploadListCtrl.o \ wxInterface.o \ - wxInterface_wdr.o \ + wxInterface_wdr.o\ $(RES) \ all: $(PROGRAM) +.c.o: + @echo -e -n "$(ACTIONCOLOR)Compiling $(INPUTCOLOR)$<$(ACTIONCOLOR) to " + @echo -e -n "$(OUTPUTCOLOR)$@$(ACTIONCOLOR) @PRINT_CPP_FLAGS@: $(ATTENTIONCOLOR)" + @if cc @CFLAGS@ @CPP_FLAGS@ @INCLUDE@ -c -o $@ $< 2>.err; then \ + if test -s .err; then \ + echo -e "$(WARNINGCOLOR)ok, but warnings:"; \ + cat .err; \ + rm -f .err; \ + echo -e "$(DEFAULTCOLOR)"; \ + else \ + echo -e "$(WELLCOLOR)ok.$(ACTIONCOLOR)"; \ + fi; \ + else \ + echo -e "failed:"; \ + cat .err; \ + rm -f .err; \ + echo -e "$(DEFAULTCOLOR)"; \ + false; \ + fi; + .cpp.o : @echo -e -n "$(ACTIONCOLOR)Compiling $(INPUTCOLOR)$<$(ACTIONCOLOR) to " @echo -e -n "$(OUTPUTCOLOR)$@$(ACTIONCOLOR)@PRINT_CPP_FLAGS@: $(ATTENTIONCOLOR)" @@ -56,11 +76,11 @@ false; \ fi; -wxInterface: $(WXINTERFACE_OBJECTS) - @echo -e -n "$(ACTIONCOLOR)Linking $(INPUTCOLOR)$(WXINTERFACE_OBJECTS)" +wxInterface: $(WXINTERFACE_OBJECTS) @TRAY_OBJECTS@ + @echo -e -n "$(ACTIONCOLOR)Linking $(INPUTCOLOR)$(WXINTERFACE_OBJECTS)@TRAY_OBJECTS@ " @echo -e -n "$(ACTIONCOLOR)to $(OUTPUTCOLOR)$@$(ACTIONCOLOR)@PRINT_LINK_FLAGS@: " @echo -e -n "$(ATTENTIONCOLOR)" - @if @CXX@ -o $(PROGRAM) $(WXINTERFACE_OBJECTS) @LIBS@ 2>.err; then \ + @if @CXX@ -o $(PROGRAM) $(WXINTERFACE_OBJECTS) @TRAY_OBJECTS@ @LIBS@ 2>.err; then \ echo -e "$(WELLCOLOR)ok."; \ echo -e -n "$(DEFAULTCOLOR)"; \ echo -e -n "$(WELLCOLOR)Successfully compiled "; \ Index: SysTray.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SysTray.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- SysTray.cpp 27 Nov 2003 08:23:12 -0000 1.11 +++ SysTray.cpp 19 Dec 2003 03:01:14 -0000 1.12 @@ -30,7 +30,8 @@ #include "SysTray.h" -#ifdef wxHAS_TASK_BAR_ICON + /* On wxMSW, we use wxWindows wxTaskBarIcon implementation */ +#if defined (__WXMSW__) BEGIN_EVENT_TABLE(CSysTray,wxTaskBarIcon) EVT_TASKBAR_RIGHT_DOWN(CSysTray::ShowContextMenu) @@ -107,5 +108,826 @@ HideShowGUI(); } +/* On wxGTK, we use GTK systray */ +#elif defined(__WXGTK__) + +//**************************************************** +//HERE STARTS THE UNIX&MAC SYSTRAY INTEGRATION CLASS +//**************************************************** + +/*************************************************************** +This tray has been taken from Tiku's xmule implementation, +changing events handling and adding some features. + +Hetfield aka Patrizio Bassi <het...@us...> +****************************************************************/ + +#include <sys/ioctl.h> +#include <net/if.h> +#include <arpa/inet.h> +#include <glib.h> +//icon +#include "images/default/mule.xpm" +//speed definition +#define UNLIMITED 0xFFFF + +//i have to patch it to mac it work with mac and freebsd. +gchar* getIP() +{ + + gchar* ip="Not Found"; + wxString interface; + int index; + index=0; + int sfd; + struct ifreq ifr; + struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr; + + memset(&ifr, 0, sizeof ifr); + sfd = socket(AF_INET, SOCK_STREAM, 0); + + strcpy(ifr.ifr_name, "ppp0"); + sin->sin_family = AF_INET; + if (0 == ioctl(sfd, SIOCGIFADDR, &ifr)) { + ip=inet_ntoa(sin->sin_addr); + return ip; + } + else { + +// printf("Not connected at network with ppp0 direct connection\n"); + do + { + interface="eth"+wxString::Format("%d", index); + strcpy(ifr.ifr_name, interface); + sin->sin_family = AF_INET; + if (0 == ioctl(sfd, SIOCGIFADDR, &ifr)) { + ip=inet_ntoa(sin->sin_addr); + index++; + } +// else printf(wxString("Not connected at network with ")+interface); + + } while (0 == ioctl(sfd, SIOCGIFADDR, &ifr)) ; +} + return ip; + +} + + +//same check of the connection tab. +void speed_check(){ + + /*if (theApp.glob_prefs->GetMaxGraphDownloadRate() < theApp.glob_prefs->GetMaxDownload()) theApp.glob_prefs->SetDownloadlimit(UNLIMITED); + if (theApp.glob_prefs->GetMaxGraphUploadRate() < theApp.glob_prefs->GetMaxUpload()) theApp.glob_prefs->SetUploadlimit(UNLIMITED); + + if( theApp.glob_prefs->GetMaxUpload() != UNLIMITED ){ + if( theApp.glob_prefs->GetMaxUpload() < 4 && ( theApp.glob_prefs->GetMaxUpload()*3 < theApp.glob_prefs->GetMaxDownload() ) ) + theApp.glob_prefs->SetDownloadlimit((theApp.glob_prefs->GetMaxUpload()*3)); + + if( theApp.glob_prefs->GetMaxUpload() < 10 && ( theApp.glob_prefs->GetMaxUpload()*4 < theApp.glob_prefs->GetMaxDownload() ) ) + theApp.glob_prefs->SetDownloadlimit((theApp.glob_prefs->GetMaxUpload()*4)) ; + }*/ +} + + +//set download and upload speed to max +void set_all_max() { + +/*theApp.glob_prefs->SetUploadlimit(theApp.glob_prefs->GetMaxGraphUploadRate()); +theApp.glob_prefs->SetDownloadlimit(theApp.glob_prefs->GetMaxGraphDownloadRate()); +*/ +} + +//set download and upload speed to min +void set_all_min() { +/* +theApp.glob_prefs->SetUploadlimit(2); +theApp.glob_prefs->SetDownloadlimit(2);*/ +speed_check(); +} + +//connect to a server +void connect_any_server() { +/* +if (theApp.serverconnect->IsConnected()) theApp.serverconnect->Disconnect(); +theApp.xmuledlg->AddLogLine(true, GetResString(IDS_CONNECTING)); +theApp.serverconnect->ConnectToAnyServer(); +theApp.xmuledlg->ShowConnectionState(false); +*/ +} + +//disconnect +void disconnect(){ +/*if (theApp.serverconnect->IsConnected()) {theApp.serverconnect->Disconnect();} +else printf("Already disconnected!\n");*/ +} + +//set download speed +void set_dl_speed(GtkWidget *widget, GdkEventButton *event, gpointer data) { + +/*int temp; +temp = atoi(g_strdup_printf("%s", gtk_object_get_data (GTK_OBJECT(widget), "label") )); +if (temp==0) theApp.glob_prefs->SetDownloadlimit(UNLIMITED); +else theApp.glob_prefs->SetDownloadlimit(temp);*/ +speed_check(); +} + +//set upload speed +void set_up_speed(GtkWidget *widget, GdkEventButton *event, gpointer data) { +/* +int temp; +temp = atoi(g_strdup_printf("%s", gtk_object_get_data (GTK_OBJECT(widget), "label") )); +if (temp==0) theApp.glob_prefs->SetUploadlimit(UNLIMITED); +else theApp.glob_prefs->SetUploadlimit(temp);*/ +speed_check(); +} + +//************* +void help_sharedaemon() { + + //ADD HELP PAGE WHEN READY + +} + +void gui_settings_sharedaemon() { + CGUISettingsDlg *guisettings = new CGUISettingsDlg( + NULL, -1, _("User Interface Settings"), + wxDefaultPosition, wxDefaultSize + ); + guisettings->ShowModal(); + delete guisettings; +} + +void close_sharedaemon() { + +// printf("Shutting down ShareDaemon...\n"); + if (mainframe!=NULL) delete mainframe; +// printf("Shutting down completed with success!\n"); + +} + +void hide_sharedaemon() { + + if (mainframe!=NULL){ + if (mainframe->IsShown()) {mainframe->Iconize(TRUE); mainframe->Show(FALSE);} + else printf("ShareDaemon is already hidden\n"); + } + +} + +void show_sharedaemon() { + + if (mainframe!=NULL){ + if (!mainframe->IsShown()) mainframe->Show(TRUE); + else printf("ShareDaemon is already shown\n"); + } +} + +void showgui(){ + + if (mainframe!=NULL){ + if (mainframe->IsShown()) {mainframe->Iconize(TRUE); mainframe->Show(FALSE);} + else mainframe->Show(TRUE); + } + + +} + +void CSysTray::Quit() { + + close_sharedaemon(); +} + +CSysTray::~CSysTray() { + +//when destroying the Systray you need to destroy GTK objects +gtk_widget_destroy(GTK_WIDGET(status_docklet)); +gtk_widget_destroy(GTK_WIDGET(status_image)); +gtk_widget_destroy(GTK_WIDGET(status_tooltips)); + +} + +//create menu linked to the tray icon +static gboolean +tray_menu (GtkWidget *widget, GdkEventButton *event, gpointer data) +{ + //sets gtk objects + GtkWidget *status_menu,*item,*down_speed,*dl_item,*up_speed,*up_item,*info_menu,*info_item; + wxString label; + wxString upl_speed,dl_speed; + gchar* temp,*tempstring; + int tempspeed; + int max_dl_speed=100; //temp settings change it! + int max_up_speed=10; + int actual_dl_speed=0; + int actual_up_speed=10; + + speed_check(); + + wxString version= "ShareDaemon CVS"; +/* + actual_up_speed=theApp.glob_prefs->GetMaxUpload(); + actual_dl_speed=theApp.glob_prefs->GetMaxDownload(); + max_up_speed=theApp.glob_prefs->GetMaxGraphUploadRate(); + max_dl_speed=theApp.glob_prefs->GetMaxGraphDownloadRate(); +*/ + + //what will be shown, very nice! + if (actual_dl_speed==UNLIMITED || actual_dl_speed==0) dl_speed="Unlimited"; + else { temp = g_strdup_printf("%d", actual_dl_speed ); dl_speed=temp;} + if (actual_up_speed==UNLIMITED || actual_up_speed==0) upl_speed="Unlimited"; + else { temp = g_strdup_printf("%d", actual_up_speed ); upl_speed=temp;} + + if (max_dl_speed==UNLIMITED || max_dl_speed==0) max_dl_speed=100; + if (max_up_speed==UNLIMITED || max_up_speed==0) max_up_speed=100; + + label="ShareDaemon "+wxString(version)+"\nActual Speed Limits:\nDL: "+dl_speed+" kb/s "+"UP: "+upl_speed+" kb/s"; + + //info menu + info_menu=gtk_menu_new(); + gtk_menu_set_title(GTK_MENU(info_menu),"ShareDaemon Tray Menu Info"); + + /*if (theApp.glob_prefs->GetUserNick()!=NULL) + info_item=gtk_menu_item_new_with_label(wxString("Nick: ")+theApp.glob_prefs->GetUserNick()); + else*/ + info_item=gtk_menu_item_new_with_label("Nick: Not Ready"); + gtk_container_add (GTK_CONTAINER (info_menu), info_item); + + + /*if (theApp.glob_prefs->GetUserHash()){ + CString hash; + hash=EncodeBase16((const unsigned char*)theApp.glob_prefs->GetUserHash(),16); + info_item=gtk_menu_item_new_with_label(wxString("Hash: ")+hash.GetBuffer()); + } + else*/ + info_item=gtk_menu_item_new_with_label("Hash: Not Ready"); + gtk_container_add (GTK_CONTAINER (info_menu), info_item); + + /*if (theApp.serverconnect->IsConnected()) { + info_item=gtk_menu_item_new_with_label(wxString("ClientID: ")+wxString::Format("%.0f",(float)theApp.serverconnect->GetClientID())); + } + else*/ + info_item=gtk_menu_item_new_with_label("ID: Not Connected"); + gtk_container_add (GTK_CONTAINER (info_menu), info_item); + + + + tempstring=getIP(); + info_item=gtk_menu_item_new_with_label(wxString("IP: ")+tempstring); + gtk_container_add (GTK_CONTAINER (info_menu), info_item); + + /*if (theApp.glob_prefs->GetPort()) { + tempstring = g_strdup_printf("%d", theApp.glob_prefs->GetPort() ); + info_item=gtk_menu_item_new_with_label(wxString("TCP Port: ")+tempstring); + } + else*/ + info_item=gtk_menu_item_new_with_label("TCP Port: Not Ready"); + gtk_container_add (GTK_CONTAINER (info_menu), info_item); + + /*if (theApp.glob_prefs->GetUDPPort()) { + tempstring = g_strdup_printf("%d", theApp.glob_prefs->GetUDPPort() ); + info_item=gtk_menu_item_new_with_label(wxString("UDP Port: ")+tempstring); + } + else*/ + info_item=gtk_menu_item_new_with_label("UDP Port: Not Ready"); + gtk_container_add (GTK_CONTAINER (info_menu), info_item); + + /*if (theApp.glob_prefs->IsOnlineSignatureEnabled()) info_item=gtk_menu_item_new_with_label("Online Signature: Enabled"); + else*/ + info_item=gtk_menu_item_new_with_label("Online Signature: Disabled"); + gtk_container_add (GTK_CONTAINER (info_menu), info_item); + + /*if (theApp.Start_time>0) { + DWORD running; + running=(GetTickCount()-theApp.Start_time)/1000; + tempstring=g_strdup_printf("%s", CastSecondsToHM(running).GetData() ); + info_item=gtk_menu_item_new_with_label(wxString("Uptime: ")+tempstring); + } + else*/ + info_item=gtk_menu_item_new_with_label("Uptime: None"); + gtk_container_add (GTK_CONTAINER (info_menu), info_item); + + /*if (theApp.serverconnect->GetCurrentServer()!=NULL) { + + info_item=gtk_menu_item_new_with_label(wxString("ServerName: ")+(theApp.serverconnect->GetCurrentServer()->GetListName())); + gtk_container_add (GTK_CONTAINER (info_menu), info_item); + + tempstring = g_strdup_printf("%d", theApp.serverconnect->GetCurrentServer()->GetPort() ); + info_item=gtk_menu_item_new_with_label(wxString("ServerIP: ")+(theApp.serverconnect->GetCurrentServer()->GetFullIP())+wxString(" : ")+tempstring ); + gtk_container_add (GTK_CONTAINER (info_menu), info_item); + + } + else*/ + { + info_item=gtk_menu_item_new_with_label("ServerName: Not Connected"); + gtk_container_add (GTK_CONTAINER (info_menu), info_item); + info_item=gtk_menu_item_new_with_label("ServerIP: Not Connected"); + gtk_container_add (GTK_CONTAINER (info_menu), info_item); + + } + + //tempstring = g_strdup_printf("%d", theApp.sharedfiles->GetCount() ); + info_item=gtk_menu_item_new_with_label(wxString("Shared Files: ")+tempstring); + gtk_container_add (GTK_CONTAINER (info_menu), info_item); + + //tempstring = g_strdup_printf("%d", theApp.uploadqueue->GetWaitingUserCount() ); + info_item=gtk_menu_item_new_with_label(wxString("Queued Clients: ")+tempstring); + gtk_container_add (GTK_CONTAINER (info_menu), info_item); + + //tempstring = g_strdup_printf("%.2f", ((float)(theApp.stat_sessionReceivedBytes+theApp.glob_prefs->GetTotalDownloaded()) / 1073741824) ); + info_item=gtk_menu_item_new_with_label(wxString("Total DL: ")+tempstring+wxString(" GB")); + gtk_container_add (GTK_CONTAINER (info_menu), info_item); + + //tempstring = g_strdup_printf("%.2f", ((float)(theApp.stat_sessionSentBytes+theApp.glob_prefs->GetTotalUploaded()) / 1073741824)); + info_item=gtk_menu_item_new_with_label(wxString("Total UP: ")+tempstring+wxString(" GB")); + gtk_container_add (GTK_CONTAINER (info_menu), info_item); + + + //main menu + status_menu = gtk_menu_new(); + gtk_menu_set_title(GTK_MENU(status_menu),"Sharedaemon Tray Menu"); + + //first item, not linked, only to show version and speed + item=gtk_menu_item_new_with_label(label); + gtk_container_add (GTK_CONTAINER (status_menu), item); + + //separator + item=gtk_menu_item_new(); + gtk_container_add (GTK_CONTAINER (status_menu), item); + + //download speed submenu + down_speed=gtk_menu_new(); + + temp="Unlimited"; + dl_item=gtk_menu_item_new_with_label(temp); + gtk_object_set_data_full(GTK_OBJECT(dl_item), "label", 0 , NULL); + gtk_container_add (GTK_CONTAINER (down_speed), dl_item); + gtk_signal_connect (GTK_OBJECT(dl_item), "activate",GTK_SIGNAL_FUNC (set_dl_speed),dl_item); + + tempspeed=max_dl_speed; + temp = g_strdup_printf("%d", tempspeed ); + dl_item=gtk_menu_item_new_with_label(wxString(temp)+" kb/s"); + gtk_object_set_data_full(GTK_OBJECT(dl_item), "label", temp , NULL); + gtk_container_add (GTK_CONTAINER (down_speed), dl_item); + gtk_signal_connect (GTK_OBJECT(dl_item), "activate",GTK_SIGNAL_FUNC (set_dl_speed),dl_item); + + tempspeed=(max_dl_speed/5)*4; + temp = g_strdup_printf("%d", tempspeed ); + dl_item=gtk_menu_item_new_with_label(wxString(temp)+" kb/s"); + gtk_container_add (GTK_CONTAINER (down_speed), dl_item); + gtk_object_set_data_full(GTK_OBJECT(dl_item), "label", temp, NULL); + gtk_signal_connect (GTK_OBJECT(dl_item), "activate",GTK_SIGNAL_FUNC (set_dl_speed),dl_item); + + tempspeed=(max_dl_speed/5)*3; + temp = g_strdup_printf("%d", tempspeed ); + dl_item=gtk_menu_item_new_with_label(wxString(temp)+" kb/s"); + gtk_container_add (GTK_CONTAINER (down_speed), dl_item); + gtk_object_set_data_full(GTK_OBJECT(dl_item), "label", temp, NULL); + gtk_signal_connect (GTK_OBJECT(dl_item), "activate",GTK_SIGNAL_FUNC (set_dl_speed),dl_item); + + tempspeed=(max_dl_speed/5)*2; + temp = g_strdup_printf("%d", tempspeed ); + dl_item=gtk_menu_item_new_with_label(wxString(temp)+" kb/s"); + gtk_container_add (GTK_CONTAINER (down_speed), dl_item); + gtk_object_set_data_full(GTK_OBJECT(dl_item), "label", temp, NULL); + gtk_signal_connect (GTK_OBJECT(dl_item), "activate",GTK_SIGNAL_FUNC (set_dl_speed),dl_item); + + tempspeed=(max_dl_speed/5); + temp = g_strdup_printf("%d", tempspeed ); + dl_item=gtk_menu_item_new_with_label(wxString(temp)+" kb/s"); + gtk_container_add (GTK_CONTAINER (down_speed), dl_item); + gtk_object_set_data_full(GTK_OBJECT(dl_item), "label", temp, NULL); + gtk_signal_connect (GTK_OBJECT(dl_item), "activate",GTK_SIGNAL_FUNC (set_dl_speed),dl_item); + + + //upload speed submenu + up_speed=gtk_menu_new(); + + temp="Unlimited"; + up_item=gtk_menu_item_new_with_label(temp); + gtk_object_set_data_full(GTK_OBJECT(up_item), "label", 0 , NULL); + gtk_container_add (GTK_CONTAINER (up_speed), up_item); + gtk_signal_connect (GTK_OBJECT(up_item), "activate",GTK_SIGNAL_FUNC (set_up_speed),up_item); + + tempspeed=max_up_speed; + temp = g_strdup_printf("%d", tempspeed ); + up_item=gtk_menu_item_new_with_label(wxString(temp)+" kb/s"); + gtk_object_set_data_full(GTK_OBJECT(up_item), "label", temp, NULL); + gtk_container_add (GTK_CONTAINER (up_speed), up_item); + gtk_signal_connect (GTK_OBJECT(up_item), "activate",GTK_SIGNAL_FUNC (set_up_speed),up_item); + + tempspeed=(max_up_speed/5)*4; + temp = g_strdup_printf("%d", tempspeed ); + up_item=gtk_menu_item_new_with_label(wxString(temp)+" kb/s"); + gtk_container_add (GTK_CONTAINER (up_speed), up_item); + gtk_object_set_data_full(GTK_OBJECT(up_item), "label", temp, NULL); + gtk_signal_connect (GTK_OBJECT(up_item), "activate",GTK_SIGNAL_FUNC (set_up_speed),up_item); + + tempspeed=(max_up_speed/5)*3; + temp = g_strdup_printf("%d", tempspeed ); + up_item=gtk_menu_item_new_with_label(wxString(temp)+" kb/s"); + gtk_container_add (GTK_CONTAINER (up_speed), up_item); + gtk_object_set_data_full(GTK_OBJECT(up_item), "label", temp, NULL); + gtk_signal_connect (GTK_OBJECT(up_item), "activate",GTK_SIGNAL_FUNC (set_up_speed),up_item); + + tempspeed=(max_up_speed/5)*2; + temp = g_strdup_printf("%d", tempspeed ); + up_item=gtk_menu_item_new_with_label(wxString(temp)+" kb/s"); + gtk_container_add (GTK_CONTAINER (up_speed), up_item); + gtk_object_set_data_full(GTK_OBJECT(up_item), "label", temp, NULL); + gtk_signal_connect (GTK_OBJECT(up_item), "activate",GTK_SIGNAL_FUNC (set_up_speed),up_item); + + tempspeed=(max_up_speed/5); + temp = g_strdup_printf("%d", tempspeed ); + up_item=gtk_menu_item_new_with_label(wxString(temp)+" kb/s"); + gtk_container_add (GTK_CONTAINER (up_speed), up_item); + gtk_object_set_data_full(GTK_OBJECT(up_item), "label", temp, NULL); + gtk_signal_connect (GTK_OBJECT(up_item), "activate",GTK_SIGNAL_FUNC (set_up_speed),up_item); + + + //Help item + item=gtk_menu_item_new_with_label(_("Help")); + gtk_container_add (GTK_CONTAINER (status_menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate",GTK_SIGNAL_FUNC (help_sharedaemon),NULL); + + //separator + item=gtk_menu_item_new(); + gtk_container_add (GTK_CONTAINER (status_menu), item); + + //gui settings item + item=gtk_menu_item_new_with_label(_("Gui Settings")); + gtk_container_add (GTK_CONTAINER (status_menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate",GTK_SIGNAL_FUNC (gui_settings_sharedaemon),NULL); + + //separator + item=gtk_menu_item_new(); + gtk_container_add (GTK_CONTAINER (status_menu), item); + + //personal infos item, not linked, only to show them + item=gtk_menu_item_new_with_label("Personal Infos"); + gtk_container_add (GTK_CONTAINER (status_menu), item); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(item),info_menu); + + //separator + item=gtk_menu_item_new(); + gtk_container_add (GTK_CONTAINER (status_menu), item); + + //show item + item=gtk_menu_item_new_with_label(_("Show")); + gtk_container_add (GTK_CONTAINER (status_menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate",GTK_SIGNAL_FUNC (show_sharedaemon),NULL); + + //separator + item=gtk_menu_item_new(); + gtk_container_add (GTK_CONTAINER (status_menu), item); + + //hide item + item=gtk_menu_item_new_with_label(_("Hide")); + gtk_container_add (GTK_CONTAINER (status_menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate",GTK_SIGNAL_FUNC (hide_sharedaemon),NULL); + + //separator + item=gtk_menu_item_new(); + gtk_container_add (GTK_CONTAINER (status_menu), item); + + //sets max speed + item=gtk_menu_item_new_with_label(_("All To Max Speed")); + gtk_container_add (GTK_CONTAINER (status_menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate",GTK_SIGNAL_FUNC (set_all_max),NULL); + + //separator + item=gtk_menu_item_new(); + gtk_container_add (GTK_CONTAINER (status_menu), item); + + //sets min speed + item=gtk_menu_item_new_with_label(_("All To Min Speed")); + gtk_container_add (GTK_CONTAINER (status_menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate",GTK_SIGNAL_FUNC (set_all_min),NULL); + + //separator + item=gtk_menu_item_new(); + gtk_container_add (GTK_CONTAINER (status_menu), item); + + //Download Speed item + item=gtk_menu_item_new_with_label(_("Download Limit")); + gtk_container_add (GTK_CONTAINER (status_menu), item); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(item),down_speed); + + //separator + item=gtk_menu_item_new(); + gtk_container_add (GTK_CONTAINER (status_menu), item); + + //Upload Speed item + item=gtk_menu_item_new_with_label(_("Upload Limit")); + gtk_container_add (GTK_CONTAINER (status_menu), item); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(item),up_speed); + + //separator + item=gtk_menu_item_new(); + gtk_container_add (GTK_CONTAINER (status_menu), item); + + //Connect item + item=gtk_menu_item_new_with_label(_("Connect to any server")); + gtk_container_add (GTK_CONTAINER (status_menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate",GTK_SIGNAL_FUNC (connect_any_server),NULL); + + //separator + item=gtk_menu_item_new(); + gtk_container_add (GTK_CONTAINER (status_menu), item); + + //Disconnection Speed item + item=gtk_menu_item_new_with_label(_("Disconnect from server")); + gtk_container_add (GTK_CONTAINER (status_menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate",GTK_SIGNAL_FUNC (disconnect),NULL); + + //separator + item=gtk_menu_item_new(); + gtk_container_add (GTK_CONTAINER (status_menu), item); + + //Exit item + item=gtk_menu_item_new_with_label(_("Exit")); + gtk_container_add (GTK_CONTAINER (status_menu), item); + gtk_signal_connect (GTK_OBJECT (item), "activate",GTK_SIGNAL_FUNC (close_sharedaemon),NULL); + + + //when the menu is popped-down, you need to destroy it + gtk_signal_connect (GTK_OBJECT (status_menu), "selection-done", + GTK_SIGNAL_FUNC (gtk_widget_destroy), &status_menu); + + //finalization + gtk_widget_show_all (status_menu); + gtk_menu_popup (GTK_MENU(status_menu), NULL, NULL,NULL, NULL,event->button, event->time); + + return TRUE; +} + +static gboolean tray_clicked (GtkWidget *event_box, GdkEventButton *event, gpointer data) { + + //mouse wheel or middle click + left double click + if ( (event->button == 1 && event->type == GDK_2BUTTON_PRESS) ||event->button == 2) { + showgui(); + return TRUE; + } + + //mouse right click + if (event->button == 3) { + return tray_menu (event_box, event, data); + } + + return FALSE; + +} + + +CSysTray::CSysTray(int mode) +{ + + GtkWidget *eventbox; + + gdk_rgb_init(); + + m_sDimensions.cx=16; + m_sDimensions.cy=16; + m_nSpacingWidth=1; + m_nNumBars=1; + m_nMaxVal=100; + m_pLimits=NULL; + m_pColors=NULL; + + desktopMode=mode; + + // not wanted, so don't show it. + if(desktopMode==4) return; + + bool use_legacy=false; + + // case 2 and 3 are KDE/other legacy system + if(desktopMode==2 || desktopMode==3) { + use_legacy=true; + } + + if(use_legacy) { + status_docklet=gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(status_docklet), "ShareDaemon"); + gtk_window_set_wmclass(GTK_WINDOW(status_docklet),"sharedaemon_StatusDocklet","ShareDaemon"); + gtk_widget_set_usize(status_docklet,22,22); + } else { + status_docklet=GTK_WIDGET(egg_tray_icon_new(_("ShareDaemon"))); + if(status_docklet==NULL) { + printf("**** WARNING: Can't create status docklet. Systray will not be created.\n"); + desktopMode=4; + return; + } + } + gtk_widget_realize(status_docklet); + + gtk_signal_connect(GTK_OBJECT(status_docklet),"destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed),&status_docklet); + + // set image + GdkBitmap* mask=NULL; + GdkPixmap* img=gdk_pixmap_create_from_xpm_d(status_docklet->window,&mask,NULL,mule_xpm); + status_image=gtk_pixmap_new(img,mask); + + eventbox = gtk_event_box_new (); + gtk_widget_show (eventbox); + gtk_container_add (GTK_CONTAINER (eventbox), status_image); + gtk_container_add (GTK_CONTAINER (status_docklet), eventbox); + gtk_signal_connect (GTK_OBJECT (eventbox), "button_press_event",GTK_SIGNAL_FUNC (tray_clicked), NULL ); + gtk_signal_connect (GTK_OBJECT(status_image),"destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed),&status_image); + + // set tooltips + status_tooltips=gtk_tooltips_new(); + gtk_tooltips_enable(status_tooltips); + gtk_tooltips_set_tip(status_tooltips,status_docklet,(_("ShareDaemon wxInterface")),"blind text"); + + // finalization + gtk_widget_show(status_image); + if(use_legacy) { + setupProperties(); + } + gtk_widget_show(GTK_WIDGET(status_docklet)); + gtk_widget_show_all (GTK_WIDGET (status_docklet)); + +} + + +void CSysTray::setupProperties() +{ + + GdkWindow* window=status_docklet->window; + + glong data[1]; + + GdkAtom kwm_dockwindow_atom; + GdkAtom kde_net_system_tray_window_for_atom; + + kwm_dockwindow_atom = gdk_atom_intern("KWM_DOCKWINDOW", FALSE); + kde_net_system_tray_window_for_atom = gdk_atom_intern("_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", FALSE); + + /* This is the old KDE 1.0 and GNOME 1.2 way... */ + data[0] = TRUE; + gdk_property_change(window, kwm_dockwindow_atom, + kwm_dockwindow_atom, 32, + GDK_PROP_MODE_REPLACE, (guchar *)&data, 1); + + /* This is needed to support KDE 2.0 */ + /* can be set to zero or the root win I think */ + data[0] = 0; + gdk_property_change(window, kde_net_system_tray_window_for_atom, + (GdkAtom)XA_WINDOW, 32, + GDK_PROP_MODE_REPLACE, (guchar *)&data, 1); + + + +} + +void CSysTray::Show(const wxChar* caption,int nMsgType,DWORD dwTimeToShow,DWORD dwTimeToStay,DWORD dwTimeTOHide) +{ + + if(desktopMode==4) + return; + + if(status_docklet==NULL) + return; + + /* this isn't exactly true. notifier must be a widget */ + gtk_tooltips_set_tip(status_tooltips,status_docklet,caption,NULL); + +} + +void CSysTray::TraySetToolTip(char* data) +{ + + if(desktopMode==4) + return; + + if(status_docklet==NULL) + return; + + gtk_tooltips_set_tip(status_tooltips,status_docklet,data,NULL); + +} + +COLORREF CSysTray::GetMeterColor(int nLevel) +// it the nLevel is greater than the values defined in m_pLimits the last value in the array is used +{ + +// begin GetMeterColor + for(int i = 0;i < m_nEntries;i++) + { + if(nLevel <= m_pLimits[i]) + { + return m_pColors[i]; + } + } + // default to the last entry + return m_pColors[m_nEntries-1]; + +}// end GetMeterColor + +void CSysTray::DrawIconMeter(GdkPixmap* pix,GdkBitmap* mask,int nLevel,int nPos) +{ + + GdkGC* gc=gdk_gc_new(pix); + + gdk_rgb_gc_set_background(gc,0); + // border color is black :) + gdk_rgb_gc_set_foreground(gc,GetMeterColor(nLevel)); + gdk_draw_rectangle(pix,gc,1,((m_sDimensions.cx-1)/m_nNumBars)*nPos+m_nSpacingWidth,m_sDimensions.cy-((nLevel*(m_sDimensions.cy-1)/m_nMaxVal)+1),((m_sDimensions.cx-1)/m_nNumBars)*(nPos+1)+1,m_sDimensions.cy); + // then draw to mask (look! it must be initialised even if it is not used!) + GdkGC* newgc=gdk_gc_new(mask); + gdk_rgb_gc_set_foreground(newgc,0x0); + gdk_draw_rectangle(mask,newgc,TRUE,0,0,22,22); + + if(nLevel>0) { + gdk_rgb_gc_set_foreground(newgc,0xffffff); + gdk_draw_rectangle(mask,newgc,1,m_sDimensions.cx-2,m_sDimensions.cy-((nLevel*(m_sDimensions.cy-1)/m_nMaxVal)+1), + m_sDimensions.cx,m_sDimensions.cy); + } + gdk_gc_unref(newgc); + gdk_gc_unref(gc); + +} + +void CSysTray::drawMeters(GdkPixmap* pix,GdkBitmap* mask,int* pBarData) +{ + + if(pBarData==NULL) + return; + + for(int i=0;i<m_nNumBars;i++) { + DrawIconMeter(pix,mask,pBarData[i],i); + } + +} + +void CSysTray::TraySetIcon(char** data,bool what,int* pVals) +{ + + if(desktopMode==4) + return; + + if(status_image==NULL) + return; // nothing you can do.. + GdkPixmap* oldpix,*oldbit; + GdkPixmap* newpix,*newbit; + + /* set new */ + gtk_pixmap_get(GTK_PIXMAP(status_image),&oldpix,&oldbit); + newpix=gdk_pixmap_create_from_xpm_d(status_docklet->window,&newbit,NULL,data); + /* create pixmap for meters */ + GdkPixmap *meterpix=gdk_pixmap_new(status_docklet->window,22,22,-1); + GdkBitmap* meterbit=gdk_pixmap_new(status_docklet->window,22,22,1); + /* draw meters */ + drawMeters(meterpix,meterbit,pVals); + /* then draw meters onto main pix */ + GdkGC* mygc=gdk_gc_new(newpix); + gdk_gc_set_clip_mask(mygc,meterbit); + gdk_draw_pixmap(newpix,mygc,meterpix,0,0,0,0,22,22); + gdk_gc_set_clip_mask(mygc,NULL); + gdk_gc_unref(mygc); + /* finally combine masks */ + mygc=gdk_gc_new(newbit); + gdk_gc_set_function(mygc,GDK_OR); + gdk_draw_pixmap(newbit,mygc,meterbit,0,0,0,0,22,22); + gdk_gc_unref(mygc); + gdk_pixmap_unref(meterpix); + gdk_bitmap_unref(meterbit); + gtk_pixmap_set(GTK_PIXMAP(status_image),newpix,newbit); + + /* free old */ + gdk_pixmap_unref(oldpix); + gdk_bitmap_unref(oldbit); + /* and force repaint */ + gtk_widget_draw(status_docklet,NULL); + +} + +bool CSysTray::SetColorLevels(int *pLimits, COLORREF *pColors,int nEntries) +// pLimits is an array of int that contain the upper limit for the corresponding color +{ + +// begin SetColorLevels + // free exsisting memory + if(m_pLimits) + delete []m_pLimits; + if(m_pColors) + delete []m_pColors; + // allocate new memory + m_pLimits = new int[nEntries]; + m_pColors = new COLORREF[nEntries]; + // copy values + for(int i = 0;i < nEntries;i++) + {// begin copy + m_pLimits[i] = pLimits[i]; + m_pColors[i] = pColors[i]; + }// end copy + m_nEntries = nEntries; + return true; + +}// end SetColorLevels + +#else /* not __WXMSW__ and not __WXGTK__ */ + #warning No native systray implemented for your port. #endif + Index: SysTray.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/SysTray.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- SysTray.h 20 Nov 2003 12:02:20 -0000 1.5 +++ SysTray.h 19 Dec 2003 03:01:14 -0000 1.6 @@ -31,7 +31,7 @@ #include "defines.h" #include "MainDlg.h" -#ifdef wxHAS_TASK_BAR_ICON +#ifdef __WXMSW__ class CSysTray: public wxTaskBarIcon { public: @@ -49,6 +49,97 @@ }; -#endif +#elif defined(__WXGTK__) + +//**************************************************** +//HERE STARTS THE UNIX&MAC SYSTRAY INTEGRATION CLASS +//**************************************************** + +/*************************************************************** +This tray has been taken from Tiku's xmule implementation, +changing events handling and adding some features. + +Hetfield aka Patrizio Bassi <het...@us...> +****************************************************************/ + +//WxWindows function +#include "wx/window.h" +//GTK Core functions +#include <gtk/gtk.h> +#include <gdk/gdk.h> +#include <gdk/gdkx.h> +#include <X11/Xatom.h> +//GTK Tray personalized from Tiku's one +#include "TrayCoreEngine.h" +//Value definition +#define GetRValue(rgb) (((rgb)>>16)&0xff) +#define GetGValue(rgb) (((rgb)>>8)&0xff) +#define GetBValue(rgb) ((rgb)&0xff) + +// SysTray Integration Class, provided for Unix&Mac Systems +class CSysTray { + +public: + + //Core functions + //Constructor + CSysTray(int=3); + //Distructor + ~CSysTray(); + + //Graphics functions + + //Show Tray, initialization. + void Show(const wxChar* caption,int nMsgType,DWORD dwTimeToShow=500,DWORD dwTimeToStay=4000,DWORD dwTimeTOHide=200); + //Sets Tray tooltips + void TraySetToolTip(char* data); + //Sets Tray icons + void TraySetIcon(char** data,bool what=false,int* pVals=NULL); + //Sets Colors + bool SetColorLevels(int* pLimits,COLORREF* pColors, int nEntries); + + +private: + + //these functions are provided for your convenience. Not used anymore. + void ShowContextMenu(); + void HideShowGUI(); + void ChangeGUISettings(); + void ChangeCoreSettings(); + void ShowHelp(); + void Quit(); + + //gtk functions for graphics + + //Sets the right values for differents Window Manager + void setupProperties(); + + //Draw speed bar + void drawMeters(GdkPixmap* pix,GdkBitmap* mask,int* pBarData); + void DrawIconMeter(GdkPixmap* pix,GdkBitmap* mask,int pBarData,int x); + + //private variables + + //Window Manager choice + int desktopMode; + + //GTK objects + GtkWidget* status_docklet; + GtkWidget* status_image; + GtkTooltips* status_tooltips; + + //Gtk Variables provided for graphics + COLORREF GetMeterColor(int level); + SIZE m_sDimensions; + int m_nSpacingWidth; + int m_nNumBars; + int m_nMaxVal; + int *m_pLimits; + COLORREF *m_pColors; + int m_nEntries; + +}; + +#endif /* __WXGTK__ */ #endif Index: defines.h =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/defines.h,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- defines.h 18 Dec 2003 04:25:36 -0000 1.42 +++ defines.h 19 Dec 2003 03:01:14 -0000 1.43 @@ -41,7 +41,7 @@ * wxWindows 2.4.2 does not define wxHAS_TASK_BAR_ICON even if it is * supported, so we define it here. */ -#ifdef __WXMSW__ +#if defined(__WXMSW__) || (defined(__WXGTK__) && defined(__HAS_GTK_CONFIG__)) #define wxHAS_TASK_BAR_ICON #endif |