1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
|
// Copyright (c) 2009 Satoshi Nakamoto
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
DECLARE_EVENT_TYPE(wxEVT_CROSSTHREADCALL, -1)
DECLARE_EVENT_TYPE(wxEVT_REPLY1, -1)
DECLARE_EVENT_TYPE(wxEVT_REPLY2, -1)
DECLARE_EVENT_TYPE(wxEVT_REPLY3, -1)
DECLARE_EVENT_TYPE(wxEVT_TABLEADDED, -1)
DECLARE_EVENT_TYPE(wxEVT_TABLEUPDATED, -1)
DECLARE_EVENT_TYPE(wxEVT_TABLEDELETED, -1)
enum
{
UICALL_ADDORDER = 1,
UICALL_UPDATEORDER,
};
extern map<string, string> mapArgs;
// Settings
extern int fShowGenerated;
extern int fMinimizeToTray;
extern int fMinimizeOnClose;
extern void HandleCtrlA(wxKeyEvent& event);
extern string DateTimeStr(int64 nTime);
extern string FormatTxStatus(const CWalletTx& wtx);
extern void CrossThreadCall(int nID, void* pdata);
extern void MainFrameRepaint();
extern void Shutdown(void* parg);
class CMainFrame : public CMainFrameBase
{
protected:
// Event handlers
void OnClose(wxCloseEvent& event);
void OnIconize(wxIconizeEvent& event);
void OnMouseEvents(wxMouseEvent& event);
void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
void OnIdle(wxIdleEvent& event);
void OnPaint(wxPaintEvent& event);
void OnPaintListCtrl(wxPaintEvent& event);
void OnMenuFileExit(wxCommandEvent& event);
void OnMenuViewShowGenerated(wxCommandEvent& event);
void OnUpdateUIViewShowGenerated(wxUpdateUIEvent& event);
void OnMenuOptionsGenerate(wxCommandEvent& event);
void OnUpdateUIOptionsGenerate(wxUpdateUIEvent& event);
void OnMenuOptionsChangeYourAddress(wxCommandEvent& event);
void OnMenuOptionsOptions(wxCommandEvent& event);
void OnMenuHelpAbout(wxCommandEvent& event);
void OnButtonSend(wxCommandEvent& event);
void OnButtonAddressBook(wxCommandEvent& event);
void OnSetFocusAddress(wxFocusEvent& event);
void OnMouseEventsAddress(wxMouseEvent& event);
void OnButtonCopy(wxCommandEvent& event);
void OnButtonChange(wxCommandEvent& event);
void OnListColBeginDrag(wxListEvent& event);
void OnListItemActivatedAllTransactions(wxListEvent& event);
void OnListItemActivatedProductsSent(wxListEvent& event);
void OnListItemActivatedOrdersSent(wxListEvent& event);
void OnListItemActivatedOrdersReceived(wxListEvent& event);
public:
/** Constructor */
CMainFrame(wxWindow* parent);
~CMainFrame();
// Custom
bool fRefreshListCtrl;
bool fRefreshListCtrlRunning;
bool fOnSetFocusAddress;
unsigned int nListViewUpdated;
void OnCrossThreadCall(wxCommandEvent& event);
void InsertLine(bool fNew, int nIndex, uint256 hashKey, string strSort, const wxString& str1, const wxString& str2, const wxString& str3, const wxString& str4, const wxString& str5);
bool DeleteLine(uint256 hashKey);
bool InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex=-1);
void RefreshListCtrl();
void RefreshStatusColumn();
};
class CTxDetailsDialog : public CTxDetailsDialogBase
{
protected:
// Event handlers
void OnButtonOK(wxCommandEvent& event);
public:
/** Constructor */
CTxDetailsDialog(wxWindow* parent, CWalletTx wtx);
// State
CWalletTx wtx;
};
class COptionsDialog : public COptionsDialogBase
{
protected:
// Event handlers
void OnListBox(wxCommandEvent& event);
void OnKillFocusTransactionFee(wxFocusEvent& event);
void OnCheckBoxLimitProcessors(wxCommandEvent& event);
void OnCheckBoxMinimizeToTray(wxCommandEvent& event);
void OnCheckBoxUseProxy(wxCommandEvent& event);
void OnKillFocusProxy(wxFocusEvent& event);
void OnButtonOK(wxCommandEvent& event);
void OnButtonCancel(wxCommandEvent& event);
void OnButtonApply(wxCommandEvent& event);
public:
/** Constructor */
COptionsDialog(wxWindow* parent);
// Custom
bool fTmpStartOnSystemStartup;
bool fTmpMinimizeOnClose;
void SelectPage(int nPage);
CAddress GetProxyAddr();
};
class CAboutDialog : public CAboutDialogBase
{
protected:
// Event handlers
void OnButtonOK(wxCommandEvent& event);
public:
/** Constructor */
CAboutDialog(wxWindow* parent);
};
class CSendDialog : public CSendDialogBase
{
protected:
// Event handlers
void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
void OnTextAddress(wxCommandEvent& event);
void OnKillFocusAmount(wxFocusEvent& event);
void OnButtonAddressBook(wxCommandEvent& event);
void OnButtonPaste(wxCommandEvent& event);
void OnButtonSend(wxCommandEvent& event);
void OnButtonCancel(wxCommandEvent& event);
public:
/** Constructor */
CSendDialog(wxWindow* parent, const wxString& strAddress="");
// Custom
bool fEnabledPrev;
string strFromSave;
string strMessageSave;
};
class CSendingDialog : public CSendingDialogBase
{
public:
// Event handlers
void OnClose(wxCloseEvent& event);
void OnButtonOK(wxCommandEvent& event);
void OnButtonCancel(wxCommandEvent& event);
void OnPaint(wxPaintEvent& event);
public:
/** Constructor */
CSendingDialog(wxWindow* parent, const CAddress& addrIn, int64 nPriceIn, const CWalletTx& wtxIn);
~CSendingDialog();
// State
CAddress addr;
int64 nPrice;
CWalletTx wtx;
wxDateTime start;
char pszStatus[10000];
bool fCanCancel;
bool fAbort;
bool fSuccess;
bool fUIDone;
bool fWorkDone;
void Close();
void Repaint();
bool Status();
bool Status(const string& str);
bool Error(const string& str);
void StartTransfer();
void OnReply2(CDataStream& vRecv);
void OnReply3(CDataStream& vRecv);
};
void SendingDialogStartTransfer(void* parg);
void SendingDialogOnReply2(void* parg, CDataStream& vRecv);
void SendingDialogOnReply3(void* parg, CDataStream& vRecv);
class CYourAddressDialog : public CYourAddressDialogBase
{
protected:
// Event handlers
void OnListEndLabelEdit(wxListEvent& event);
void OnListItemSelected(wxListEvent& event);
void OnListItemActivated(wxListEvent& event);
void OnButtonRename(wxCommandEvent& event);
void OnButtonNew(wxCommandEvent& event);
void OnButtonCopy(wxCommandEvent& event);
void OnButtonOK(wxCommandEvent& event);
void OnButtonCancel(wxCommandEvent& event);
void OnClose(wxCloseEvent& event);
public:
/** Constructor */
CYourAddressDialog(wxWindow* parent);
CYourAddressDialog(wxWindow* parent, const string& strInitSelected);
// Custom
wxString GetAddress();
};
class CAddressBookDialog : public CAddressBookDialogBase
{
protected:
// Event handlers
void OnListEndLabelEdit(wxListEvent& event);
void OnListItemSelected(wxListEvent& event);
void OnListItemActivated(wxListEvent& event);
void OnButtonEdit(wxCommandEvent& event);
void OnButtonDelete(wxCommandEvent& event);
void OnButtonNew(wxCommandEvent& event);
void OnButtonCopy(wxCommandEvent& event);
void OnButtonOK(wxCommandEvent& event);
void OnButtonCancel(wxCommandEvent& event);
void OnClose(wxCloseEvent& event);
public:
/** Constructor */
CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, bool fSendingIn);
// Custom
bool fSending;
wxString GetAddress();
bool CheckIfMine(const string& strAddress, const string& strTitle);
};
class CProductsDialog : public CProductsDialogBase
{
protected:
// Event handlers
void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
void OnCombobox(wxCommandEvent& event);
void OnButtonSearch(wxCommandEvent& event);
void OnListItemActivated(wxListEvent& event);
public:
/** Constructor */
CProductsDialog(wxWindow* parent);
// Custom
vector<CProduct> m_vProduct;
};
class CEditProductDialog : public CEditProductDialogBase
{
protected:
// Event handlers
void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
void OnButtonDel0(wxCommandEvent& event);
void OnButtonDel1(wxCommandEvent& event);
void OnButtonDel2(wxCommandEvent& event);
void OnButtonDel3(wxCommandEvent& event);
void OnButtonDel4(wxCommandEvent& event);
void OnButtonDel5(wxCommandEvent& event);
void OnButtonDel6(wxCommandEvent& event);
void OnButtonDel7(wxCommandEvent& event);
void OnButtonDel8(wxCommandEvent& event);
void OnButtonDel9(wxCommandEvent& event);
void OnButtonDel10(wxCommandEvent& event);
void OnButtonDel11(wxCommandEvent& event);
void OnButtonDel12(wxCommandEvent& event);
void OnButtonDel13(wxCommandEvent& event);
void OnButtonDel14(wxCommandEvent& event);
void OnButtonDel15(wxCommandEvent& event);
void OnButtonDel16(wxCommandEvent& event);
void OnButtonDel17(wxCommandEvent& event);
void OnButtonDel18(wxCommandEvent& event);
void OnButtonDel19(wxCommandEvent& event);
void OnButtonAddField(wxCommandEvent& event);
void OnButtonSend(wxCommandEvent& event);
void OnButtonPreview(wxCommandEvent& event);
void OnButtonCancel(wxCommandEvent& event);
public:
/** Constructor */
CEditProductDialog(wxWindow* parent);
// Custom
enum { FIELDS_MAX = 20 };
wxTextCtrl* m_textCtrlLabel[FIELDS_MAX];
wxTextCtrl* m_textCtrlField[FIELDS_MAX];
wxButton* m_buttonDel[FIELDS_MAX];
void LayoutAll();
void ShowLine(int i, bool fShow=true);
void OnButtonDel(wxCommandEvent& event, int n);
void SetProduct(const CProduct& productIn);
void GetProduct(CProduct& product);
};
class CViewProductDialog : public CViewProductDialogBase
{
protected:
// Event handlers
void OnButtonSubmitForm(wxCommandEvent& event);
void OnButtonCancelForm(wxCommandEvent& event);
void OnButtonBack(wxCommandEvent& event);
void OnButtonNext(wxCommandEvent& event);
void OnButtonCancel(wxCommandEvent& event);
public:
/** Constructor */
CViewProductDialog(wxWindow* parent, const CProduct& productIn);
~CViewProductDialog();
// Custom
CProduct product;
enum { FIELDS_MAX = 20 };
wxStaticText* m_staticTextLabel[FIELDS_MAX];
wxTextCtrl* m_textCtrlField[FIELDS_MAX];
wxChoice* m_choiceField[FIELDS_MAX];
void GetOrder(CWalletTx& order);
void UpdateProductDisplay(bool fDetails);
void OnReply1(wxCommandEvent& event);
};
class CViewOrderDialog : public CViewOrderDialogBase
{
protected:
// Event handlers
void OnButtonOK(wxCommandEvent& event);
public:
/** Constructor */
CViewOrderDialog(wxWindow* parent, CWalletTx order, bool fReceived);
// Custom
bool fReceived;
};
class CEditReviewDialog : public CEditReviewDialogBase
{
protected:
// Event handlers
void OnKeyDown(wxKeyEvent& event) { HandleCtrlA(event); }
void OnButtonSubmit(wxCommandEvent& event);
void OnButtonCancel(wxCommandEvent& event);
public:
/** Constructor */
CEditReviewDialog(wxWindow* parent);
// Custom
void GetReview(CReview& review);
};
class CGetTextFromUserDialog : public CGetTextFromUserDialogBase
{
protected:
// Event handlers
void OnButtonOK(wxCommandEvent& event) { EndModal(true); }
void OnButtonCancel(wxCommandEvent& event) { EndModal(false); }
void OnClose(wxCloseEvent& event) { EndModal(false); }
void OnKeyDown(wxKeyEvent& event)
{
if (event.GetKeyCode() == '\r' || event.GetKeyCode() == WXK_NUMPAD_ENTER)
EndModal(true);
else
HandleCtrlA(event);
}
public:
/** Constructor */
CGetTextFromUserDialog(wxWindow* parent,
const string& strCaption,
const string& strMessage1,
const string& strValue1="",
const string& strMessage2="",
const string& strValue2="") : CGetTextFromUserDialogBase(parent, wxID_ANY, strCaption)
{
m_staticTextMessage1->SetLabel(strMessage1);
m_textCtrl1->SetValue(strValue1);
if (!strMessage2.empty())
{
m_staticTextMessage2->Show(true);
m_staticTextMessage2->SetLabel(strMessage2);
m_textCtrl2->Show(true);
m_textCtrl2->SetValue(strValue2);
SetSize(wxDefaultCoord, 180);
}
}
// Custom
string GetValue() { return (string)m_textCtrl1->GetValue(); }
string GetValue1() { return (string)m_textCtrl1->GetValue(); }
string GetValue2() { return (string)m_textCtrl2->GetValue(); }
};
class CMyTaskBarIcon : public wxTaskBarIcon
{
protected:
// Event handlers
void OnLeftButtonDClick(wxTaskBarIconEvent& event);
void OnMenuRestore(wxCommandEvent& event);
void OnUpdateUIGenerate(wxUpdateUIEvent& event);
void OnMenuGenerate(wxCommandEvent& event);
void OnMenuExit(wxCommandEvent& event);
public:
CMyTaskBarIcon() : wxTaskBarIcon()
{
Show(true);
}
void Show(bool fShow=true);
void Hide();
void Restore();
void UpdateTooltip();
virtual wxMenu* CreatePopupMenu();
DECLARE_EVENT_TABLE()
};
|