2 // This file is part of the aMule Project.
4 // Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2002 Merkur ( devs@emule-project.net / http://www.emule-project.net )
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
30 #include <wx/archive.h>
31 #include <wx/filename.h>
32 #include <wx/frame.h> // Needed for wxFrame
33 #include <wx/imaglist.h>
35 #include <wx/wfstream.h>
36 #include <wx/zipstrm.h>
38 #include "Types.h" // Needed for uint32
47 class CSharedFilesWnd
;
52 class PrefsUnifiedDlg
;
58 #define MP_RESTORE 4001
59 #define MP_CONNECT 4002
60 #define MP_DISCONNECT 4003
64 #define DEFAULT_SIZE_X 800
65 #define DEFAULT_SIZE_Y 600
69 Client_Green_Smiley
= 0,
74 Client_ExtendedProtocol_Smiley
,
75 Client_SecIdent_Smiley
,
77 Client_CreditsGrey_Smiley
,
78 Client_CreditsYellow_Smiley
,
82 Client_mlDonkey_Smiley
,
83 Client_eDonkeyHybrid_Smiley
,
86 Client_Shareaza_Smiley
,
89 Client_InvalidRating_Smiley
,
90 Client_PoorRating_Smiley
,
91 Client_FairRating_Smiley
,
92 Client_GoodRating_Smiley
,
93 Client_ExcellentRating_Smiley
,
94 Client_CommentOnly_Smiley
,
95 Client_Encryption_Smiley
,
101 // CamuleDlg Dialogfeld
102 class CamuleDlg
: public wxFrame
106 wxWindow
*pParent
= NULL
,
107 const wxString
&title
= wxEmptyString
,
108 wxPoint where
= wxDefaultPosition
,
109 wxSize dlg_size
= wxSize(DEFAULT_SIZE_X
,DEFAULT_SIZE_Y
));
112 void AddLogLine(bool addtostatusbar
, const wxString
& line
);
113 void AddServerMessageLine(wxString
& message
);
114 void ResetLog(int id
);
116 void ShowUserCount(const wxString
& info
= wxEmptyString
);
117 void ShowConnectionState();
118 void ShowTransferRate();
120 bool StatisticsWindowActive()
121 { return (m_activewnd
== (wxWindow
*)m_statisticswnd
); }
123 /* Returns the active dialog. Needed to check what to redraw. */
131 DT_KAD_WND
// this one is still unused
133 DialogType
GetActiveDialog()
134 { return m_nActiveDialog
; }
135 void SetActiveDialog(DialogType type
, wxWindow
* dlg
);
138 * Helper function for deciding if a certian dlg is visible.
140 * @return True if the dialog is visible to the user, false otherwise.
142 bool IsDialogVisible( DialogType dlg
)
144 return m_nActiveDialog
== dlg
&& m_is_safe_state
/* && !IsIconized() */;
147 void ShowED2KLinksHandler( bool show
);
150 void OnClose(wxCloseEvent
& evt
);
151 void OnBnConnect(wxCommandEvent
& evt
);
153 void DoIconize(bool iconize
);
155 bool SafeState() { return m_is_safe_state
; }
157 void LaunchUrl(const wxString
&url
);
159 //! These are the currently known web-search providers
163 // websearch function
164 wxString
GenWebSearchUrl( const wxString
&filename
, WebSearch provider
);
166 void CreateSystray();
167 void RemoveSystray();
169 void StartGuiTimer() { gui_timer
->Start(100); }
170 void StopGuiTimer() { gui_timer
->Stop(); }
173 * This function ensures that _all_ list widgets are properly sorted.
177 void SetMessageBlink(bool state
) { m_BlinkMessages
= state
; }
178 void Create_Toolbar(bool orientation
);
180 #ifdef ENABLE_IP2COUNTRY
181 CIP2Country
* m_IP2Country
;
183 wxWindow
* m_activewnd
;
184 CTransferWnd
* m_transferwnd
;
185 CServerWnd
* m_serverwnd
;
186 CSharedFilesWnd
* m_sharedfileswnd
;
187 CSearchDlg
* m_searchwnd
;
189 CStatisticsDlg
* m_statisticswnd
;
190 CKadDlg
* m_kademliawnd
;
191 //! Pointer to the current preference dialog, if any.
192 PrefsUnifiedDlg
* m_prefsDialog
;
196 wxImageList m_imagelist
;
197 wxImageList m_tblist
;
200 void OnToolBarButton(wxCommandEvent
& ev
);
201 void OnAboutButton(wxCommandEvent
& ev
);
202 void OnPrefButton(wxCommandEvent
& ev
);
204 void OnImportButton(wxCommandEvent
& ev
);
206 void OnMinimize(wxIconizeEvent
& evt
);
207 void OnBnClickedFast(wxCommandEvent
& evt
);
208 void OnBnStatusText(wxCommandEvent
& evt
);
209 void OnGUITimer(wxTimerEvent
& evt
);
210 void OnMainGUISizeChange(wxSizeEvent
& evt
);
211 void OnExit(wxCommandEvent
& evt
);
214 //! Specifies if the prefs-dialog was shown before minimizing.
216 wxToolBar
*m_wndToolbar
;
218 CMuleTrayIcon
*m_wndTaskbarNotifier
;
219 DialogType m_nActiveDialog
;
220 bool m_is_safe_state
;
221 bool m_BlinkMessages
;
222 int m_CurrentBlinkBitmap
;
223 uint32 m_last_iconizing
;
224 wxFileName m_skinFileName
;
225 std::vector
<wxString
> m_clientSkinNames
;
227 WX_DECLARE_STRING_HASH_MAP(wxZipEntry
*, ZipCatalog
);
228 ZipCatalog::iterator it
;
237 void UpdateTrayIcon(int percent
);
239 void Apply_Clients_Skin();
240 void Apply_Toolbar_Skin(wxToolBar
*wndToolbar
);
241 bool Check_and_Init_Skin();
243 const wxString
&iconName
,
244 const wxBitmap
&stdIcon
,
246 void ToogleED2KLinksHandler();
247 void SetMessagesTool();
248 void OnKeyPressed(wxKeyEvent
& evt
);
250 DECLARE_EVENT_TABLE()
255 // File_checked_for_headers