1//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2/// Name:         AlcFrame Class
3///
4/// Purpose:      aMule ed2k link creator
5///
6/// Author:       ThePolish <thepolish@vipmail.ru>
7///
8/// Copyright (c) 2004-2011 ThePolish ( thepolish@vipmail.ru )
9///
10/// Copyright (c) 2004-2011 Marcelo Roberto Jimenez ( phoenix@amule.org )
11///
12/// Pixmaps from http://jimmac.musichall.cz/ikony.php3 | http://www.everaldo.com | http://www.icomania.com
13///
14/// This program is free software; you can redistribute it and/or modify
15/// it under the terms of the GNU General Public License as published by
16/// the Free Software Foundation; either version 2 of the License, or
17/// (at your option) any later version.
18///
19/// This program is distributed in the hope that it will be useful,
20/// but WITHOUT ANY WARRANTY; without even the implied warranty of
21/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22/// GNU General Public License for more details.
23///
24/// You should have received a copy of the GNU General Public License
25/// along with this program; if not, write to the
26/// Free Software Foundation, Inc.,
27/// 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
28//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
29
30#ifndef _ALCFRAME_H
31#define _ALCFRAME_H
32
33// For compilers that support precompilation, includes "wx/wx.h"
34
35#ifdef __BORLANDC__
36    #pragma hdrstop
37#endif
38
39// For all others, include the necessary headers
40#ifndef WX_PRECOMP
41    #include "wx/wx.h"
42#endif
43
44#include <wx/statline.h>
45#include <wx/progdlg.h>
46
47
48// Compute and display md4sum or not
49//#define WANT_MD4SUM 1
50
51
52/// Main Alc Frame
53class AlcFrame:public wxFrame
54  {
55  private:
56    wxToolBar *m_toolbar;
57    wxBitmap m_toolBarBitmaps[4];
58
59    wxBoxSizer *m_frameVBox;
60
61    wxPanel *m_mainPanel;
62    wxBoxSizer *m_mainPanelVBox;
63
64    wxStaticLine *m_staticLine;
65
66    wxStaticBox *m_inputSBox;
67    wxStaticBoxSizer* m_inputSBoxSizer;
68    wxFlexGridSizer *m_inputFlexSizer;
69    wxStaticText *m_inputFileStaticText;
70    wxTextCtrl *m_inputFileTextCtrl;
71    wxButton *m_inputFileBrowseButton ;
72    wxStaticText *m_inputAddStaticText;
73    wxTextCtrl *m_inputAddTextCtrl;
74    wxButton *m_inputAddButton ;
75    wxListBox *m_inputUrlListBox;
76    wxBoxSizer *m_buttonUrlVBox;
77    wxButton *m_removeButton;
78    wxButton *m_clearButton;
79    wxCheckBox *m_parthashesCheck;
80
81    wxProgressDialog *m_progressBar;
82    bool m_goAhead;
83
84
85#ifdef WANT_MD4SUM
86
87    wxStaticBox *m_md4HashSBox;
88    wxStaticBoxSizer* m_md4HashSBoxSizer;
89    wxTextCtrl *m_md4HashTextCtrl;
90#endif
91
92    wxStaticBox *m_e2kHashSBox;
93    wxStaticBoxSizer* m_e2kHashSBoxSizer;
94    wxTextCtrl *m_e2kHashTextCtrl;
95
96    wxStaticBox *m_ed2kSBox;
97    wxStaticBoxSizer* m_ed2kSBoxSizer;
98    wxTextCtrl *m_ed2kTextCtrl;
99
100    wxBoxSizer* m_buttonHBox;
101    wxButton *m_copyButton;
102    wxButton *m_startButton;
103    wxButton *m_saveButton;
104    wxButton *m_closeButton;
105
106    enum
107    {
108      ID_BAR_OPEN = 1000,
109      ID_BAR_SAVEAS,
110      ID_BAR_COPY,
111      ID_BAR_ABOUT,
112      ID_START_BUTTON,
113      ID_SAVEAS_BUTTON,
114      ID_COPY_BUTTON,
115      ID_EXIT_BUTTON,
116      ID_BROWSE_BUTTON,
117      ID_ADD_BUTTON,
118      ID_REMOVE_BUTTON,
119      ID_CLEAR_BUTTON,
120      ID_PARTHASHES_CHECK
121    };
122
123    /// Set File to hash in wxTextCtrl
124    void SetFileToHash();
125
126    /// Save computed Ed2k link to file
127    void SaveEd2kLinkToFile();
128
129    /// Copy Ed2k link to clip board
130    void CopyEd2kLinkToClipBoard();
131
132  protected:
133
134    /// Toolbar Open button
135    void OnBarOpen (wxCommandEvent & event);
136
137    /// Toolbar Save As button
138    void OnBarSaveAs (wxCommandEvent & event);
139
140    /// Toolbar Copy button
141    void OnBarCopy(wxCommandEvent & event);
142
143    /// Toolbar About button
144    void OnBarAbout (wxCommandEvent & event);
145
146    /// Close Button
147    void OnCloseButton (wxCommandEvent & event);
148
149    /// Save As button
150    void OnSaveAsButton(wxCommandEvent & event);
151
152    /// Copy button
153    void OnCopyButton(wxCommandEvent & event);
154
155    /// Compute Hashes on Start Button
156    void OnStartButton (wxCommandEvent & event);
157
158    /// Browse button to select file to hash
159    void OnBrowseButton (wxCommandEvent & event);
160
161    /// Add an URL to the URL list box
162    void OnAddUrlButton (wxCommandEvent & event);
163
164    /// Remove the selected URL from the URL list box
165    void OnRemoveUrlButton (wxCommandEvent & event);
166
167    /// Clear the URL list box
168    void OnClearUrlButton (wxCommandEvent & event);
169
170    DECLARE_EVENT_TABLE ()
171
172  public:
173    /// Constructor
174    AlcFrame (const wxString& title);
175
176    /// Destructor
177    ~AlcFrame ();
178
179    // Hook function for external update of the progress bar
180    static bool Hook(int percent);
181  };
182
183#endif /* _ALCFRAME_H */
184// File_checked_for_headers
185