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 Hide_aMule(bool iconize
= true);
154 void Show_aMule(bool uniconize
= true);
156 bool SafeState() { return m_is_safe_state
; }
158 void LaunchUrl(const wxString
&url
);
160 //! These are the currently known web-search providers
164 // websearch function
165 wxString
GenWebSearchUrl( const wxString
&filename
, WebSearch provider
);
167 void CreateSystray();
168 void RemoveSystray();
170 void StartGuiTimer() { gui_timer
->Start(100); }
171 void StopGuiTimer() { gui_timer
->Stop(); }
174 * This function ensures that _all_ list widgets are properly sorted.
178 void SetMessageBlink(bool state
) { m_BlinkMessages
= state
; }
179 void Create_Toolbar(bool orientation
);
181 #ifdef ENABLE_IP2COUNTRY
182 CIP2Country
* m_IP2Country
;
184 wxWindow
* m_activewnd
;
185 CTransferWnd
* m_transferwnd
;
186 CServerWnd
* m_serverwnd
;
187 CSharedFilesWnd
* m_sharedfileswnd
;
188 CSearchDlg
* m_searchwnd
;
190 CStatisticsDlg
* m_statisticswnd
;
191 CKadDlg
* m_kademliawnd
;
192 //! Pointer to the current preference dialog, if any.
193 PrefsUnifiedDlg
* m_prefsDialog
;
197 wxImageList m_imagelist
;
198 wxImageList m_tblist
;
201 void OnToolBarButton(wxCommandEvent
& ev
);
202 void OnAboutButton(wxCommandEvent
& ev
);
203 void OnPrefButton(wxCommandEvent
& ev
);
205 void OnImportButton(wxCommandEvent
& ev
);
207 void OnMinimize(wxIconizeEvent
& evt
);
208 void OnBnClickedFast(wxCommandEvent
& evt
);
209 void OnBnStatusText(wxCommandEvent
& evt
);
210 void OnGUITimer(wxTimerEvent
& evt
);
211 void OnMainGUISizeChange(wxSizeEvent
& evt
);
212 void OnExit(wxCommandEvent
& evt
);
215 //! Specifies if the prefs-dialog was shown before minimizing.
217 wxToolBar
*m_wndToolbar
;
219 CMuleTrayIcon
*m_wndTaskbarNotifier
;
220 DialogType m_nActiveDialog
;
221 bool m_is_safe_state
;
222 bool m_BlinkMessages
;
223 int m_CurrentBlinkBitmap
;
224 uint32 m_last_iconizing
;
225 wxFileName m_skinFileName
;
226 std::vector
<wxString
> m_clientSkinNames
;
228 WX_DECLARE_STRING_HASH_MAP(wxZipEntry
*, ZipCatalog
);
229 ZipCatalog::iterator it
;
238 void UpdateTrayIcon(int percent
);
240 void Apply_Clients_Skin();
241 void Apply_Toolbar_Skin(wxToolBar
*wndToolbar
);
242 bool Check_and_Init_Skin();
244 const wxString
&iconName
,
245 const wxBitmap
&stdIcon
,
247 void ToogleED2KLinksHandler();
248 void SetMessagesTool();
249 void OnKeyPressed(wxKeyEvent
& evt
);
251 DECLARE_EVENT_TABLE()
256 // File_checked_for_headers