From 351c9154e59b169fa7f0faa74080f9657fa55079 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 24 Jul 2007 20:12:56 +0000 Subject: [PATCH] fix systray icon size and "exit" command. --- wx/images/Makefile.am | 1 + wx/images/systray.xpm | 216 ++++++++++++++++++++++++++++++++++++++++++ wx/xmission.cc | 36 +++---- 3 files changed, 229 insertions(+), 24 deletions(-) create mode 100644 wx/images/systray.xpm diff --git a/wx/images/Makefile.am b/wx/images/Makefile.am index 7b36d981e..4b2acb5d6 100644 --- a/wx/images/Makefile.am +++ b/wx/images/Makefile.am @@ -9,5 +9,6 @@ EXTRA_DIST = \ gtk-remove.xpm \ stop.png \ stop.xpm \ + systray.xpm \ transmission.png \ transmission.xpm diff --git a/wx/images/systray.xpm b/wx/images/systray.xpm new file mode 100644 index 000000000..bcd0722b0 --- /dev/null +++ b/wx/images/systray.xpm @@ -0,0 +1,216 @@ +/* XPM */ +static char * systray_xpm[] = { +"24 24 189 2", +" c None", +". c #918989", +"+ c #C55643", +"@ c #CE634C", +"# c #D4674A", +"$ c #C9583A", +"% c #B1ACAB", +"& c #8F8F8F", +"* c #858585", +"= c #8E8E8E", +"- c #B47C6B", +"; c #C43F17", +"> c #BF3009", +", c #B72803", +"' c #911600", +") c #D07056", +"! c #B96E5A", +"~ c #BBB9B9", +"{ c #B7B7B7", +"] c #CBCBCB", +"^ c #CABAB7", +"/ c #B41E01", +"( c #AA1800", +"_ c #931300", +": c #750C00", +"< c #C75C46", +"[ c #D26E4D", +"} c #C64C25", +"| c #B32A05", +"1 c #BC9A97", +"2 c #ECECEC", +"3 c #F7F7F7", +"4 c #EDEDED", +"5 c #982E16", +"6 c #871000", +"7 c #6F0A00", +"8 c #B04029", +"9 c #C7502B", +"0 c #B52805", +"a c #BB2100", +"b c #B11B00", +"c c #8D473E", +"d c #E4E4E4", +"e c #C4C4C4", +"f c #999999", +"g c #672823", +"h c #AF746A", +"i c #B52803", +"j c #B52100", +"k c #A91900", +"l c #9A1700", +"m c #661A11", +"n c #9F9F9F", +"o c #686868", +"p c #525252", +"q c #444343", +"r c #424242", +"s c #8B8181", +"t c #801404", +"u c #750B00", +"v c #6A0700", +"w c #5F0600", +"x c #4E2D2C", +"y c #8D8D8D", +"z c #3B3B3B", +"A c #343434", +"B c #484848", +"C c #727272", +"D c #696969", +"E c #454545", +"F c #2A2A2A", +"G c #939393", +"H c #3D3D3D", +"I c #3C3C3C", +"J c #4A4A4A", +"K c #585858", +"L c #535353", +"M c #5C5C5C", +"N c #474747", +"O c #7D7D7D", +"P c #777777", +"Q c #6B6B6B", +"R c #7C7C7C", +"S c #BEBEBE", +"T c #949494", +"U c #5D5D5D", +"V c #787878", +"W c #909090", +"X c #545454", +"Y c #666666", +"Z c #A7A7A7", +"` c #9C9C9C", +" . c #969696", +".. c #C0C0C0", +"+. c #636363", +"@. c #6A6A6A", +"#. c #515151", +"$. c #3A3A3A", +"%. c #444444", +"&. c #848484", +"*. c #A3A3A3", +"=. c #9D9D9D", +"-. c #565656", +";. c #A2A2A2", +">. c #BBBBBB", +",. c #C9C9C9", +"'. c #BFBFBF", +"). c #434343", +"!. c #575757", +"~. c #282828", +"{. c #A9A9A9", +"]. c #CACACA", +"^. c #CCCCCC", +"/. c #151515", +"(. c #595959", +"_. c #838383", +":. c #717171", +"<. c #989898", +"[. c #CFCFCF", +"}. c #9A9A9A", +"|. c #898989", +"1. c #171717", +"2. c #4C4C4C", +"3. c #868686", +"4. c #D1D1D1", +"5. c #5F5F5F", +"6. c #555555", +"7. c #CDCDCD", +"8. c #E3E3E3", +"9. c #646464", +"0. c #99999A", +"a. c #ADADAD", +"b. c #494949", +"c. c #C7C7C7", +"d. c #D5D5D5", +"e. c #D6D6D6", +"f. c #B9B9B9", +"g. c #8C8C8C", +"h. c #A6A6A6", +"i. c #9B9B9B", +"j. c #EAEAEA", +"k. c #F0F0F0", +"l. c #E5E5E5", +"m. c #C2C2C2", +"n. c #313131", +"o. c #D7D7D7", +"p. c #DADADA", +"q. c #DBDBDB", +"r. c #B2B2B2", +"s. c #F5F5F5", +"t. c #F8F8F8", +"u. c #B8B8B8", +"v. c #D4D4D4", +"w. c #DEDEDE", +"x. c #E0E0E0", +"y. c #F1F1F1", +"z. c #A1A1A1", +"A. c #3F3F3F", +"B. c #6E6E6E", +"C. c #FCFCFC", +"D. c #F2F2F2", +"E. c #B6B6B6", +"F. c #C5C5C5", +"G. c #979797", +"H. c #F9F9F9", +"I. c #656565", +"J. c #272727", +"K. c #B4B4B4", +"L. c #BDBDBD", +"M. c #919191", +"N. c #FFFFFF", +"O. c #FAFAFA", +"P. c #E2E2E2", +"Q. c #B1B1B1", +"R. c #C3C3C3", +"S. c #AFAFAF", +"T. c #797979", +"U. c #B5B5B5", +"V. c #BCBCBC", +"W. c #393939", +"X. c #BABABA", +"Y. c #B3B3B3", +"Z. c #F6F6F6", +"`. c #B0B0B0", +" + c #A5A5A5", +".+ c #AEAEAE", +"++ c #6D6D6D", +"@+ c #5B5B5B", +"#+ c #1F1F1F", +" . + @ # $ ", +" % & * = - ; > , ' ", +" ) ! ~ { ] ^ / ( _ : ", +" < [ } | 1 2 3 4 5 6 7 ", +" 8 9 0 a b c d e f g ", +" * h i j k l m n o p q r r ", +" s t u v w x y z A B C D E ", +" F G H I J K L M N ", +" r H B O P Q R S T U p ", +" r N V W X Y Z ` ...e +.@.#. ", +" $.%.= &.*.=.-.;.*.T >.,.'.).@.!. ", +" ~.E {.].^.]./.(._.:.<.[.[.}.X :.|. ", +" 1.2.3.[.4.S ` 5.6.(.D 7.8.4 9.0.a. ", +" b.p c.d.e.e.f.g.'.h.i.j.k.l.).'.m. ", +" n.U & o.p.q.q...c.r.5.Y s.t.{.V u.v. ", +" o M ].w.x.y.8.z.& A.B.C.C.D.i.E.F. ", +" #.o G.8.H.3 y R I.J.K.s.o.L.{ e 3. ", +" M.=.d N.N.N.O.P.{.,.E.Q.R.S.5. ", +" T.U.R.C.N.N.H.e.r.r.u.V.T. ", +" W.X.Y.q.Z.e.U.`.{ '.G ", +" y U.S.S.S.K.m. +(. ", +" A.S r.r.'..+++ ", +" Q i.= @+ ", +" #+ "}; diff --git a/wx/xmission.cc b/wx/xmission.cc index 4d97f8e59..5b00f94e6 100755 --- a/wx/xmission.cc +++ b/wx/xmission.cc @@ -40,6 +40,7 @@ extern "C" #include #include #include + #include #include } @@ -65,7 +66,7 @@ public: virtual ~MyFrame(); public: - void OnQuit( wxCommandEvent& ); + void OnExit( wxCommandEvent& ); void OnAbout( wxCommandEvent& ); void OnOpen( wxCommandEvent& ); void OnRecheck( wxCommandEvent& ); @@ -83,9 +84,9 @@ protected: private: TorrentListCtrl * myTorrentList; wxListCtrl * myFilters; - wxTaskBarIcon * myTaskBarIcon; - wxIcon * myLogoIcon; - wxIcon * myTrayLogo; + wxTaskBarIcon myTrayIcon; + wxIcon myLogoIcon; + wxIcon myTrayIconIcon; torrents_v myTorrents; torrents_v mySelectedTorrents; @@ -153,7 +154,7 @@ bool MyApp::OnInit() frame->Connect( wxID_OPEN, wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction) &MyFrame::OnOpen ); frame->Connect( wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction) &MyFrame::OnAbout ); - frame->Connect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction) &MyFrame::OnQuit ); + frame->Connect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction) &MyFrame::OnExit ); frame->Connect( ID_Pulse, wxEVT_TIMER, (wxObjectEventFunction) &MyFrame::OnTimer ); frame->Show( true ); @@ -253,7 +254,7 @@ MyFrame :: OnTimer(wxTimerEvent& event) s += _T("\n"); s +=_("Upload: "); s += getReadableSpeed( ul ); - myTaskBarIcon->SetIcon( *myTrayLogo, s ); + myTrayIcon.SetIcon( myTrayIconIcon, s ); } MyFrame::~MyFrame() @@ -267,21 +268,10 @@ MyFrame::~MyFrame() MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size): wxFrame((wxFrame*)NULL,-1,title,pos,size), myConfig( new wxConfig( _T("xmission") ) ), - myPulseTimer( this, ID_Pulse ) + myPulseTimer( this, ID_Pulse ), + myLogoIcon( transmission_xpm ), + myTrayIconIcon( systray_xpm ) { - myLogoIcon = new wxIcon( transmission_xpm ); - SetIcon( *myLogoIcon ); - -/*#if wxCHECK_VERSION(2,8,0) - transmission_logo.Rescale( 24, 24, wxIMAGE_QUALITY_HIGH ); -#else - transmission_logo.Rescale( 24, 24 ); -#endif - myTrayLogo = new wxIcon; - myTrayLogo->CopyFromBitmap( wxBitmap( transmission_logo ) );*/ - myTrayLogo = myLogoIcon; - - /** *** Menu **/ @@ -396,8 +386,6 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size): myPulseTimer.Start( 1500 ); - myTaskBarIcon = new wxTaskBarIcon( ); - /** *** Load the torrents **/ @@ -414,9 +402,9 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size): OnTimer( dummy ); } -void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) +void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event)) { - Close( true ); + Destroy( ); } void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))