Address Book with tabs instead of separate Your Address book,

with live update of default address in main window, 
New... button on main window for creating new receiving address, 
made receiving address labels more visible, 
ask user before paying transaction fee, 
when sending to bitcoin address also use a bitcoin address for the change, 
added some event.Skip() to fix UI glitches 
-- version 0.2.4

git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@68 1a98c847-1fd6-4fd8-948a-caf3550aa51b
This commit is contained in:
s_nakamoto 2010-02-20 21:59:59 +00:00
parent c6ab3cf6d9
commit 75199de534
10 changed files with 1012 additions and 620 deletions

View file

@ -2645,7 +2645,12 @@ void BitcoinMiner()
do do
{ {
pindexTmp = pindexBest; pindexTmp = pindexBest;
Sleep(10000); for (int i = 0; i < 10; i++)
{
Sleep(1000);
if (fShutdown)
return;
}
} }
while (pindexTmp != pindexBest); while (pindexTmp != pindexBest);
} }
@ -2852,10 +2857,13 @@ bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CK
if (keyRet.IsNull()) if (keyRet.IsNull())
keyRet.MakeNewKey(); keyRet.MakeNewKey();
// Fill a vout to ourself // Fill a vout to ourself, using same address type as the payment
CScript scriptPubKey; CScript scriptChange;
scriptPubKey << keyRet.GetPubKey() << OP_CHECKSIG; if (scriptPubKey.GetBitcoinAddressHash160() != 0)
wtxNew.vout.push_back(CTxOut(nValueIn - nTotalValue, scriptPubKey)); scriptChange.SetBitcoinAddress(keyRet.GetPubKey());
else
scriptChange << keyRet.GetPubKey() << OP_CHECKSIG;
wtxNew.vout.push_back(CTxOut(nValueIn - nTotalValue, scriptChange));
} }
// Fill a vout to the payee // Fill a vout to the payee
@ -2894,19 +2902,13 @@ bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CK
} }
// Call after CreateTransaction unless you want to abort // Call after CreateTransaction unless you want to abort
bool CommitTransactionSpent(const CWalletTx& wtxNew, const CKey& key) bool CommitTransaction(CWalletTx& wtxNew, const CKey& key)
{ {
CRITICAL_BLOCK(cs_main) CRITICAL_BLOCK(cs_main)
{
printf("CommitTransaction:\n%s", wtxNew.ToString().c_str());
CRITICAL_BLOCK(cs_mapWallet) CRITICAL_BLOCK(cs_mapWallet)
{ {
//// old: eventually should make this transactional, never want to add a
//// transaction without marking spent transactions, although the risk of
//// interruption during this step is remote.
//// update: This matters even less now that fSpent can get corrected
//// when transactions are seen in VerifySignature. The remote chance of
//// unmarked fSpent will be handled by that. Don't need to make this
//// transactional. Pls delete this comment block later.
// This is only to keep the database open to defeat the auto-flush for the // This is only to keep the database open to defeat the auto-flush for the
// duration of this scope. This is the only place where this optimization // duration of this scope. This is the only place where this optimization
// maybe makes sense; please don't do it anywhere else. // maybe makes sense; please don't do it anywhere else.
@ -2914,7 +2916,7 @@ bool CommitTransactionSpent(const CWalletTx& wtxNew, const CKey& key)
// Add the change's private key to wallet // Add the change's private key to wallet
if (!key.IsNull() && !AddKey(key)) if (!key.IsNull() && !AddKey(key))
throw runtime_error("CommitTransactionSpent() : AddKey failed\n"); throw runtime_error("CommitTransaction() : AddKey failed\n");
// Add tx to wallet, because if it has change it's also ours, // Add tx to wallet, because if it has change it's also ours,
// otherwise just for transaction history. // otherwise just for transaction history.
@ -2931,6 +2933,20 @@ bool CommitTransactionSpent(const CWalletTx& wtxNew, const CKey& key)
vWalletUpdated.push_back(pcoin->GetHash()); vWalletUpdated.push_back(pcoin->GetHash());
} }
} }
// Track how many getdata requests our transaction gets
CRITICAL_BLOCK(cs_mapRequestCount)
mapRequestCount[wtxNew.GetHash()] = 0;
// Broadcast
if (!wtxNew.AcceptTransaction())
{
// This must not fail. The transaction has already been signed and recorded.
printf("CommitTransaction() : Error: Transaction not valid");
return false;
}
wtxNew.RelayWalletTransaction();
}
MainFrameRepaint(); MainFrameRepaint();
return true; return true;
} }
@ -2938,7 +2954,7 @@ bool CommitTransactionSpent(const CWalletTx& wtxNew, const CKey& key)
string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew) string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, bool fAskFee)
{ {
CRITICAL_BLOCK(cs_main) CRITICAL_BLOCK(cs_main)
{ {
@ -2954,34 +2970,20 @@ string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew)
printf("SendMoney() : %s", strError.c_str()); printf("SendMoney() : %s", strError.c_str());
return strError; return strError;
} }
if (!CommitTransactionSpent(wtxNew, key))
{
printf("SendMoney() : Error finalizing transaction");
return _("Error finalizing transaction");
}
// Track how many getdata requests our transaction gets if (fAskFee && !ThreadSafeAskFee(nFeeRequired, _("Sending..."), NULL))
CRITICAL_BLOCK(cs_mapRequestCount) return "ABORTED";
mapRequestCount[wtxNew.GetHash()] = 0;
printf("SendMoney: %s\n", wtxNew.GetHash().ToString().substr(0,6).c_str()); if (!CommitTransaction(wtxNew, key))
// Broadcast
if (!wtxNew.AcceptTransaction())
{
// This must not fail. The transaction has already been signed and recorded.
printf("SendMoney() : Error: Transaction not valid");
return _("Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."); return _("Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.");
} }
wtxNew.RelayWalletTransaction();
}
MainFrameRepaint(); MainFrameRepaint();
return ""; return "";
} }
string SendMoneyToBitcoinAddress(string strAddress, int64 nValue, CWalletTx& wtxNew) string SendMoneyToBitcoinAddress(string strAddress, int64 nValue, CWalletTx& wtxNew, bool fAskFee)
{ {
// Check amount // Check amount
if (nValue <= 0) if (nValue <= 0)
@ -2994,5 +2996,5 @@ string SendMoneyToBitcoinAddress(string strAddress, int64 nValue, CWalletTx& wtx
if (!scriptPubKey.SetBitcoinAddress(strAddress)) if (!scriptPubKey.SetBitcoinAddress(strAddress))
return _("Invalid bitcoin address"); return _("Invalid bitcoin address");
return SendMoney(scriptPubKey, nValue, wtxNew); return SendMoney(scriptPubKey, nValue, wtxNew, fAskFee);
} }

7
main.h
View file

@ -67,9 +67,10 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv);
bool SendMessages(CNode* pto); bool SendMessages(CNode* pto);
int64 GetBalance(); int64 GetBalance();
bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CKey& keyRet, int64& nFeeRequiredRet); bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CKey& keyRet, int64& nFeeRequiredRet);
bool CommitTransactionSpent(const CWalletTx& wtxNew, const CKey& key); bool CommitTransaction(CWalletTx& wtxNew, const CKey& key);
string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew); bool BroadcastTransaction(CWalletTx& wtxNew);
string SendMoneyToBitcoinAddress(string strAddress, int64 nValue, CWalletTx& wtxNew); string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false);
string SendMoneyToBitcoinAddress(string strAddress, int64 nValue, CWalletTx& wtxNew, bool fAskFee=false);
void GenerateBitcoins(bool fGenerate); void GenerateBitcoins(bool fGenerate);
void ThreadBitcoinMiner(void* parg); void ThreadBitcoinMiner(void* parg);
void BitcoinMiner(); void BitcoinMiner();

View file

@ -580,6 +580,11 @@ public:
*this << OP_DUP << OP_HASH160 << hash160 << OP_EQUALVERIFY << OP_CHECKSIG; *this << OP_DUP << OP_HASH160 << hash160 << OP_EQUALVERIFY << OP_CHECKSIG;
} }
void SetBitcoinAddress(const vector<unsigned char>& vchPubKey)
{
SetBitcoinAddress(Hash160(vchPubKey));
}
bool SetBitcoinAddress(const string& strAddress) bool SetBitcoinAddress(const string& strAddress)
{ {
this->clear(); this->clear();

View file

@ -19,7 +19,7 @@ class CScript;
class CDataStream; class CDataStream;
class CAutoFile; class CAutoFile;
static const int VERSION = 203; static const int VERSION = 204;
static const char* pszSubVer = ".0"; static const char* pszSubVer = ".0";

618
ui.cpp
View file

@ -35,13 +35,54 @@ int fMinimizeOnClose = true;
// Util // Util
// //
void ExitTimeout(void* parg)
{
#ifdef __WXMSW__
Sleep(5000);
ExitProcess(0);
#endif
}
void Shutdown(void* parg)
{
static CCriticalSection cs_Shutdown;
static bool fTaken;
bool fFirstThread;
CRITICAL_BLOCK(cs_Shutdown)
{
fFirstThread = !fTaken;
fTaken = true;
}
static bool fExit;
if (fFirstThread)
{
fShutdown = true;
nTransactionsUpdated++;
DBFlush(false);
StopNode();
DBFlush(true);
CreateThread(ExitTimeout, NULL);
Sleep(50);
printf("Bitcoin exiting\n\n");
fExit = true;
exit(0);
}
else
{
while (!fExit)
Sleep(500);
Sleep(100);
ExitThread(0);
}
}
void HandleCtrlA(wxKeyEvent& event) void HandleCtrlA(wxKeyEvent& event)
{ {
// Ctrl-a select all // Ctrl-a select all
event.Skip();
wxTextCtrl* textCtrl = (wxTextCtrl*)event.GetEventObject(); wxTextCtrl* textCtrl = (wxTextCtrl*)event.GetEventObject();
if (event.GetModifiers() == wxMOD_CONTROL && event.GetKeyCode() == 'A') if (event.GetModifiers() == wxMOD_CONTROL && event.GetKeyCode() == 'A')
textCtrl->SetSelection(-1, -1); textCtrl->SetSelection(-1, -1);
event.Skip();
} }
bool Is24HourTime() bool Is24HourTime()
@ -194,6 +235,35 @@ int ThreadSafeMessageBox(const string& message, const string& caption, int style
#endif #endif
} }
bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent)
{
if (nFeeRequired == 0 || fDaemon)
return true;
string strMessage = strprintf(
_("This transaction is over the size limit. You can still send it for a fee of %s, "
"which goes to the nodes that process your transaction and helps to support the network. "
"Do you want to pay the fee?"),
FormatMoney(nFeeRequired).c_str());
return (ThreadSafeMessageBox(strMessage, strCaption, wxYES_NO, parent) == wxYES);
}
void SetDefaultReceivingAddress(const string& strAddress)
{
// Update main window address and database
if (pframeMain == NULL)
return;
if (strAddress != pframeMain->m_textCtrlAddress->GetValue())
{
uint160 hash160;
if (!AddressToHash160(strAddress, hash160))
return;
if (!mapPubKeys.count(hash160))
return;
CWalletDB().WriteDefaultKey(mapPubKeys[hash160]);
pframeMain->m_textCtrlAddress->SetValue(strAddress);
}
}
@ -227,11 +297,6 @@ CMainFrame::CMainFrame(wxWindow* parent) : CMainFrameBase(parent)
fontTmp.SetFamily(wxFONTFAMILY_TELETYPE); fontTmp.SetFamily(wxFONTFAMILY_TELETYPE);
m_staticTextBalance->SetFont(fontTmp); m_staticTextBalance->SetFont(fontTmp);
m_staticTextBalance->SetSize(140, 17); m_staticTextBalance->SetSize(140, 17);
// & underlines don't work on the toolbar buttons on gtk
m_toolBar->ClearTools();
m_toolBar->AddTool(wxID_BUTTONSEND, _("Send Coins"), wxBitmap(send20_xpm), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString);
m_toolBar->AddTool(wxID_BUTTONRECEIVE, _("Address Book"), wxBitmap(addressbook20_xpm), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString);
m_toolBar->Realize();
// resize to fit ubuntu's huge default font // resize to fit ubuntu's huge default font
dResize = 1.20; dResize = 1.20;
SetSize((dResize + 0.02) * GetSize().GetWidth(), 1.09 * GetSize().GetHeight()); SetSize((dResize + 0.02) * GetSize().GetWidth(), 1.09 * GetSize().GetHeight());
@ -276,47 +341,6 @@ CMainFrame::~CMainFrame()
ptaskbaricon = NULL; ptaskbaricon = NULL;
} }
void ExitTimeout(void* parg)
{
#ifdef __WXMSW__
Sleep(5000);
ExitProcess(0);
#endif
}
void Shutdown(void* parg)
{
static CCriticalSection cs_Shutdown;
static bool fTaken;
bool fFirstThread;
CRITICAL_BLOCK(cs_Shutdown)
{
fFirstThread = !fTaken;
fTaken = true;
}
static bool fExit;
if (fFirstThread)
{
fShutdown = true;
nTransactionsUpdated++;
DBFlush(false);
StopNode();
DBFlush(true);
CreateThread(ExitTimeout, NULL);
Sleep(50);
printf("Bitcoin exiting\n\n");
fExit = true;
exit(0);
}
else
{
while (!fExit)
Sleep(500);
Sleep(100);
ExitThread(0);
}
}
void CMainFrame::OnClose(wxCloseEvent& event) void CMainFrame::OnClose(wxCloseEvent& event)
{ {
if (fMinimizeOnClose && event.CanVeto() && !IsIconized()) if (fMinimizeOnClose && event.CanVeto() && !IsIconized())
@ -335,6 +359,7 @@ void CMainFrame::OnClose(wxCloseEvent& event)
void CMainFrame::OnIconize(wxIconizeEvent& event) void CMainFrame::OnIconize(wxIconizeEvent& event)
{ {
event.Skip();
// Hide the task bar button when minimized. // Hide the task bar button when minimized.
// Event is sent when the frame is minimized or restored. // Event is sent when the frame is minimized or restored.
// wxWidgets 2.8.9 doesn't have IsIconized() so there's no way // wxWidgets 2.8.9 doesn't have IsIconized() so there's no way
@ -342,7 +367,7 @@ void CMainFrame::OnIconize(wxIconizeEvent& event)
if (!event.Iconized()) if (!event.Iconized())
fClosedToTray = false; fClosedToTray = false;
#ifndef __WXMSW__ #ifndef __WXMSW__
// Tray is not reliable on Linux gnome // Tray is not reliable on ubuntu 9.10 gnome
fClosedToTray = false; fClosedToTray = false;
#endif #endif
if (fMinimizeToTray && event.Iconized()) if (fMinimizeToTray && event.Iconized())
@ -353,6 +378,7 @@ void CMainFrame::OnIconize(wxIconizeEvent& event)
void CMainFrame::OnMouseEvents(wxMouseEvent& event) void CMainFrame::OnMouseEvents(wxMouseEvent& event)
{ {
event.Skip();
RandAddSeed(); RandAddSeed();
RAND_add(&event.m_x, sizeof(event.m_x), 0.25); RAND_add(&event.m_x, sizeof(event.m_x), 0.25);
RAND_add(&event.m_y, sizeof(event.m_y), 0.25); RAND_add(&event.m_y, sizeof(event.m_y), 0.25);
@ -363,6 +389,8 @@ void CMainFrame::OnListColBeginDrag(wxListEvent& event)
// Hidden columns not resizeable // Hidden columns not resizeable
if (event.GetColumn() <= 1 && !fDebug) if (event.GetColumn() <= 1 && !fDebug)
event.Veto(); event.Veto();
else
event.Skip();
} }
int CMainFrame::GetSortIndex(const string& strSort) int CMainFrame::GetSortIndex(const string& strSort)
@ -546,7 +574,7 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
if (wtx.IsCoinBase()) if (wtx.IsCoinBase())
{ {
// Coinbase // Generated
strDescription = _("Generated"); strDescription = _("Generated");
if (nCredit == 0) if (nCredit == 0)
{ {
@ -569,7 +597,7 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
} }
else if (!mapValue["from"].empty() || !mapValue["message"].empty()) else if (!mapValue["from"].empty() || !mapValue["message"].empty())
{ {
// Online transaction // Received by IP connection
if (!mapValue["from"].empty()) if (!mapValue["from"].empty())
strDescription += _("From: ") + mapValue["from"]; strDescription += _("From: ") + mapValue["from"];
if (!mapValue["message"].empty()) if (!mapValue["message"].empty())
@ -581,7 +609,7 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
} }
else else
{ {
// Offline transaction // Received by Bitcoin Address
foreach(const CTxOut& txout, wtx.vout) foreach(const CTxOut& txout, wtx.vout)
{ {
if (txout.IsMine()) if (txout.IsMine())
@ -590,21 +618,20 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
if (ExtractPubKey(txout.scriptPubKey, true, vchPubKey)) if (ExtractPubKey(txout.scriptPubKey, true, vchPubKey))
{ {
CRITICAL_BLOCK(cs_mapAddressBook) CRITICAL_BLOCK(cs_mapAddressBook)
{
string strAddress = PubKeyToAddress(vchPubKey);
if (mapAddressBook.count(strAddress))
{ {
//strDescription += _("Received payment to "); //strDescription += _("Received payment to ");
//strDescription += _("Received with address "); //strDescription += _("Received with address ");
strDescription += _("From: unknown, To: "); strDescription += _("From: unknown, Received with: ");
strDescription += strAddress; string strAddress = PubKeyToAddress(vchPubKey);
/// The labeling feature is just too confusing, so I hid it map<string, string>::iterator mi = mapAddressBook.find(strAddress);
/// by putting it at the end where it runs off the screen. if (mi != mapAddressBook.end() && !(*mi).second.empty())
/// It can still be seen by widening the column, or in the {
/// details dialog. string strLabel = (*mi).second;
if (!mapAddressBook[strAddress].empty()) strDescription += strAddress.substr(0,12) + "... ";
strDescription += " (" + mapAddressBook[strAddress] + ")"; strDescription += "(" + strLabel + ")";
} }
else
strDescription += strAddress;
} }
} }
break; break;
@ -659,12 +686,12 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
string strAddress; string strAddress;
if (!mapValue["to"].empty()) if (!mapValue["to"].empty())
{ {
// Online transaction // Sent to IP
strAddress = mapValue["to"]; strAddress = mapValue["to"];
} }
else else
{ {
// Offline transaction // Sent to Bitcoin Address
uint160 hash160; uint160 hash160;
if (ExtractHash160(txout.scriptPubKey, hash160)) if (ExtractHash160(txout.scriptPubKey, hash160))
strAddress = Hash160ToAddress(hash160); strAddress = Hash160ToAddress(hash160);
@ -683,8 +710,11 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
} }
int64 nValue = txout.nValue; int64 nValue = txout.nValue;
if (nOut == 0 && nTxFee > 0) if (nTxFee > 0)
{
nValue += nTxFee; nValue += nTxFee;
nTxFee = 0;
}
InsertLine(fNew, nIndex, hash, strprintf("%s-%d", strSort.c_str(), nOut), InsertLine(fNew, nIndex, hash, strprintf("%s-%d", strSort.c_str(), nOut),
strStatus, strStatus,
@ -846,12 +876,12 @@ void CMainFrame::RefreshStatusColumn()
void CMainFrame::OnPaint(wxPaintEvent& event) void CMainFrame::OnPaint(wxPaintEvent& event)
{ {
event.Skip();
if (fRefresh) if (fRefresh)
{ {
fRefresh = false; fRefresh = false;
Refresh(); Refresh();
} }
event.Skip();
} }
@ -903,6 +933,9 @@ void MainFrameRepaint()
void CMainFrame::OnPaintListCtrl(wxPaintEvent& event) void CMainFrame::OnPaintListCtrl(wxPaintEvent& event)
{ {
// Skip lets the listctrl do the paint, we're just hooking the message
event.Skip();
if (ptaskbaricon) if (ptaskbaricon)
ptaskbaricon->UpdateTooltip(); ptaskbaricon->UpdateTooltip();
@ -970,11 +1003,6 @@ void CMainFrame::OnPaintListCtrl(wxPaintEvent& event)
if (fDebug && GetTime() - nThreadSocketHandlerHeartbeat > 60) if (fDebug && GetTime() - nThreadSocketHandlerHeartbeat > 60)
m_statusBar->SetStatusText(" ERROR: ThreadSocketHandler has stopped", 0); m_statusBar->SetStatusText(" ERROR: ThreadSocketHandler has stopped", 0);
// Pass through to listctrl to actually do the paint, we're just hooking the message
m_listCtrl->Disconnect(wxEVT_PAINT, (wxObjectEventFunction)NULL, NULL, this);
m_listCtrl->GetEventHandler()->ProcessEvent(event);
m_listCtrl->Connect(wxEVT_PAINT, wxPaintEventHandler(CMainFrame::OnPaintListCtrl), NULL, this);
} }
@ -1033,8 +1061,10 @@ void CMainFrame::OnUpdateUIOptionsGenerate(wxUpdateUIEvent& event)
void CMainFrame::OnMenuOptionsChangeYourAddress(wxCommandEvent& event) void CMainFrame::OnMenuOptionsChangeYourAddress(wxCommandEvent& event)
{ {
// Options->Change Your Address // Options->Your Receiving Addresses
OnButtonChange(event); CAddressBookDialog dialog(this, "", CAddressBookDialog::RECEIVING, false);
if (!dialog.ShowModal())
return;
} }
void CMainFrame::OnMenuOptionsOptions(wxCommandEvent& event) void CMainFrame::OnMenuOptionsOptions(wxCommandEvent& event)
@ -1061,11 +1091,11 @@ void CMainFrame::OnButtonSend(wxCommandEvent& event)
void CMainFrame::OnButtonAddressBook(wxCommandEvent& event) void CMainFrame::OnButtonAddressBook(wxCommandEvent& event)
{ {
// Toolbar: Address Book // Toolbar: Address Book
CAddressBookDialog dialogAddr(this, "", false); CAddressBookDialog dialogAddr(this, "", CAddressBookDialog::SENDING, false);
if (dialogAddr.ShowModal() == 2) if (dialogAddr.ShowModal() == 2)
{ {
// Send // Send
CSendDialog dialogSend(this, dialogAddr.GetAddress()); CSendDialog dialogSend(this, dialogAddr.GetSelectedAddress());
dialogSend.ShowModal(); dialogSend.ShowModal();
} }
} }
@ -1073,35 +1103,36 @@ void CMainFrame::OnButtonAddressBook(wxCommandEvent& event)
void CMainFrame::OnSetFocusAddress(wxFocusEvent& event) void CMainFrame::OnSetFocusAddress(wxFocusEvent& event)
{ {
// Automatically select-all when entering window // Automatically select-all when entering window
event.Skip();
m_textCtrlAddress->SetSelection(-1, -1); m_textCtrlAddress->SetSelection(-1, -1);
fOnSetFocusAddress = true; fOnSetFocusAddress = true;
event.Skip();
} }
void CMainFrame::OnMouseEventsAddress(wxMouseEvent& event) void CMainFrame::OnMouseEventsAddress(wxMouseEvent& event)
{ {
event.Skip();
if (fOnSetFocusAddress) if (fOnSetFocusAddress)
m_textCtrlAddress->SetSelection(-1, -1); m_textCtrlAddress->SetSelection(-1, -1);
fOnSetFocusAddress = false; fOnSetFocusAddress = false;
event.Skip();
} }
void CMainFrame::OnButtonChange(wxCommandEvent& event) void CMainFrame::OnButtonNew(wxCommandEvent& event)
{ {
CYourAddressDialog dialog(this, string(m_textCtrlAddress->GetValue())); // Ask name
CGetTextFromUserDialog dialog(this,
_("New Receiving Address"),
_("It's good policy to use a new address for each payment you receive.\n\nLabel"),
"");
if (!dialog.ShowModal()) if (!dialog.ShowModal())
return; return;
string strAddress = (string)dialog.GetAddress(); string strName = dialog.GetValue();
if (strAddress != m_textCtrlAddress->GetValue())
{ // Generate new key
uint160 hash160; string strAddress = PubKeyToAddress(GenerateNewKey());
if (!AddressToHash160(strAddress, hash160))
return; // Save
if (!mapPubKeys.count(hash160)) SetAddressBookName(strAddress, strName);
return; SetDefaultReceivingAddress(strAddress);
CWalletDB().WriteDefaultKey(mapPubKeys[hash160]);
m_textCtrlAddress->SetValue(strAddress);
}
} }
void CMainFrame::OnButtonCopy(wxCommandEvent& event) void CMainFrame::OnButtonCopy(wxCommandEvent& event)
@ -1139,7 +1170,6 @@ void CMainFrame::OnListItemActivated(wxListEvent& event)
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// CTxDetailsDialog // CTxDetailsDialog
@ -1452,6 +1482,7 @@ void COptionsDialog::OnListBox(wxCommandEvent& event)
void COptionsDialog::OnKillFocusTransactionFee(wxFocusEvent& event) void COptionsDialog::OnKillFocusTransactionFee(wxFocusEvent& event)
{ {
event.Skip();
int64 nTmp = nTransactionFee; int64 nTmp = nTransactionFee;
ParseMoney(m_textCtrlTransactionFee->GetValue(), nTmp); ParseMoney(m_textCtrlTransactionFee->GetValue(), nTmp);
m_textCtrlTransactionFee->SetValue(FormatMoney(nTmp)); m_textCtrlTransactionFee->SetValue(FormatMoney(nTmp));
@ -1485,6 +1516,7 @@ CAddress COptionsDialog::GetProxyAddr()
void COptionsDialog::OnKillFocusProxy(wxFocusEvent& event) void COptionsDialog::OnKillFocusProxy(wxFocusEvent& event)
{ {
event.Skip();
m_textCtrlProxyIP->SetValue(GetProxyAddr().ToStringIP()); m_textCtrlProxyIP->SetValue(GetProxyAddr().ToStringIP());
m_textCtrlProxyPort->SetValue(GetProxyAddr().ToStringPort()); m_textCtrlProxyPort->SetValue(GetProxyAddr().ToStringPort());
} }
@ -1632,6 +1664,7 @@ CSendDialog::CSendDialog(wxWindow* parent, const wxString& strAddress) : CSendDi
void CSendDialog::OnTextAddress(wxCommandEvent& event) void CSendDialog::OnTextAddress(wxCommandEvent& event)
{ {
// Check mark // Check mark
event.Skip();
bool fBitcoinAddress = IsValidBitcoinAddress(m_textCtrlAddress->GetValue()); bool fBitcoinAddress = IsValidBitcoinAddress(m_textCtrlAddress->GetValue());
m_bitmapCheckMark->Show(fBitcoinAddress); m_bitmapCheckMark->Show(fBitcoinAddress);
@ -1660,6 +1693,7 @@ void CSendDialog::OnTextAddress(wxCommandEvent& event)
void CSendDialog::OnKillFocusAmount(wxFocusEvent& event) void CSendDialog::OnKillFocusAmount(wxFocusEvent& event)
{ {
// Reformat the amount // Reformat the amount
event.Skip();
if (m_textCtrlAmount->GetValue().Trim().empty()) if (m_textCtrlAmount->GetValue().Trim().empty())
return; return;
int64 nTmp; int64 nTmp;
@ -1670,9 +1704,9 @@ void CSendDialog::OnKillFocusAmount(wxFocusEvent& event)
void CSendDialog::OnButtonAddressBook(wxCommandEvent& event) void CSendDialog::OnButtonAddressBook(wxCommandEvent& event)
{ {
// Open address book // Open address book
CAddressBookDialog dialog(this, m_textCtrlAddress->GetValue(), true); CAddressBookDialog dialog(this, m_textCtrlAddress->GetValue(), CAddressBookDialog::SENDING, true);
if (dialog.ShowModal()) if (dialog.ShowModal())
m_textCtrlAddress->SetValue(dialog.GetAddress()); m_textCtrlAddress->SetValue(dialog.GetSelectedAddress());
} }
void CSendDialog::OnButtonPaste(wxCommandEvent& event) void CSendDialog::OnButtonPaste(wxCommandEvent& event)
@ -1723,11 +1757,11 @@ void CSendDialog::OnButtonSend(wxCommandEvent& event)
CScript scriptPubKey; CScript scriptPubKey;
scriptPubKey << OP_DUP << OP_HASH160 << hash160 << OP_EQUALVERIFY << OP_CHECKSIG; scriptPubKey << OP_DUP << OP_HASH160 << hash160 << OP_EQUALVERIFY << OP_CHECKSIG;
string strError = SendMoney(scriptPubKey, nValue, wtx); string strError = SendMoney(scriptPubKey, nValue, wtx, true);
if (strError != "") if (strError == "")
wxMessageBox(strError + " ", _("Sending..."));
else
wxMessageBox(_("Payment sent "), _("Sending...")); wxMessageBox(_("Payment sent "), _("Sending..."));
else if (strError != "ABORTED")
wxMessageBox(strError + " ", _("Sending..."));
} }
else else
{ {
@ -1846,6 +1880,7 @@ void CSendingDialog::OnButtonCancel(wxCommandEvent& event)
void CSendingDialog::OnPaint(wxPaintEvent& event) void CSendingDialog::OnPaint(wxPaintEvent& event)
{ {
event.Skip();
if (strlen(pszStatus) > 130) if (strlen(pszStatus) > 130)
m_textCtrlStatus->SetValue(string("\n") + pszStatus); m_textCtrlStatus->SetValue(string("\n") + pszStatus);
else else
@ -1869,7 +1904,6 @@ void CSendingDialog::OnPaint(wxPaintEvent& event)
Close(); Close();
wxMessageBox(_("Transfer cancelled "), _("Sending..."), wxOK, this); wxMessageBox(_("Transfer cancelled "), _("Sending..."), wxOK, this);
} }
event.Skip();
} }
@ -2016,6 +2050,13 @@ void CSendingDialog::OnReply2(CDataStream& vRecv)
return; return;
} }
// Transaction fee
if (!ThreadSafeAskFee(nFeeRequired, _("Sending..."), this))
{
Error(_("Transaction aborted"));
return;
}
// Make sure we're still connected // Make sure we're still connected
CNode* pnode = ConnectNode(addr, 2 * 60 * 60); CNode* pnode = ConnectNode(addr, 2 * 60 * 60);
if (!pnode) if (!pnode)
@ -2040,20 +2081,15 @@ void CSendingDialog::OnReply2(CDataStream& vRecv)
return; return;
// Commit // Commit
if (!CommitTransactionSpent(wtx, key)) if (!CommitTransaction(wtx, key))
{ {
Error(_("Error finalizing payment")); Error(_("The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."));
return; return;
} }
// Send payment tx to seller, with response going to OnReply3 via event handler // Send payment tx to seller, with response going to OnReply3 via event handler
pnode->PushRequest("submitorder", wtx, SendingDialogOnReply3, this); pnode->PushRequest("submitorder", wtx, SendingDialogOnReply3, this);
// Accept and broadcast transaction
if (!wtx.AcceptTransaction())
printf("ERROR: CSendingDialog : wtxNew.AcceptTransaction() %s failed\n", wtx.GetHash().ToString().c_str());
wtx.RelayWalletTransaction();
Status(_("Waiting for confirmation...")); Status(_("Waiting for confirmation..."));
MainFrameRepaint(); MainFrameRepaint();
} }
@ -2095,179 +2131,56 @@ void CSendingDialog::OnReply3(CDataStream& vRecv)
//////////////////////////////////////////////////////////////////////////////
//
// CYourAddressDialog
//
CYourAddressDialog::CYourAddressDialog(wxWindow* parent, const string& strInitSelected) : CYourAddressDialogBase(parent)
{
// Init column headers
m_listCtrl->InsertColumn(0, _("Label"), wxLIST_FORMAT_LEFT, 200);
m_listCtrl->InsertColumn(1, _("Bitcoin Address"), wxLIST_FORMAT_LEFT, 350);
m_listCtrl->SetFocus();
// Fill listctrl with address book data
CRITICAL_BLOCK(cs_mapKeys)
CRITICAL_BLOCK(cs_mapAddressBook)
{
foreach(const PAIRTYPE(string, string)& item, mapAddressBook)
{
string strAddress = item.first;
string strName = item.second;
uint160 hash160;
bool fMine = (AddressToHash160(strAddress, hash160) && mapPubKeys.count(hash160));
if (fMine)
{
int nIndex = InsertLine(m_listCtrl, strName, strAddress);
if (strAddress == strInitSelected)
m_listCtrl->SetItemState(nIndex, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
}
}
}
}
wxString CYourAddressDialog::GetAddress()
{
int nIndex = GetSelection(m_listCtrl);
if (nIndex == -1)
return "";
return GetItemText(m_listCtrl, nIndex, 1);
}
void CYourAddressDialog::OnListEndLabelEdit(wxListEvent& event)
{
// Update address book with edited name
if (event.IsEditCancelled())
return;
string strAddress = (string)GetItemText(m_listCtrl, event.GetIndex(), 1);
SetAddressBookName(strAddress, string(event.GetText()));
pframeMain->RefreshListCtrl();
}
void CYourAddressDialog::OnListItemSelected(wxListEvent& event)
{
}
void CYourAddressDialog::OnListItemActivated(wxListEvent& event)
{
// Doubleclick edits item
wxCommandEvent event2;
OnButtonRename(event2);
}
void CYourAddressDialog::OnButtonRename(wxCommandEvent& event)
{
// Ask new name
int nIndex = GetSelection(m_listCtrl);
if (nIndex == -1)
return;
string strName = (string)m_listCtrl->GetItemText(nIndex);
string strAddress = (string)GetItemText(m_listCtrl, nIndex, 1);
CGetTextFromUserDialog dialog(this, _("Edit Address Label"), _("New Label"), strName);
if (!dialog.ShowModal())
return;
strName = dialog.GetValue();
// Change name
SetAddressBookName(strAddress, strName);
m_listCtrl->SetItemText(nIndex, strName);
pframeMain->RefreshListCtrl();
}
void CYourAddressDialog::OnButtonNew(wxCommandEvent& event)
{
// Ask name
CGetTextFromUserDialog dialog(this, _("New Bitcoin Address"), _("Label"), "");
if (!dialog.ShowModal())
return;
string strName = dialog.GetValue();
// Generate new key
string strAddress = PubKeyToAddress(GenerateNewKey());
SetAddressBookName(strAddress, strName);
// Add to list and select it
int nIndex = InsertLine(m_listCtrl, strName, strAddress);
SetSelection(m_listCtrl, nIndex);
m_listCtrl->SetFocus();
}
void CYourAddressDialog::OnButtonCopy(wxCommandEvent& event)
{
// Copy address box to clipboard
if (wxTheClipboard->Open())
{
wxTheClipboard->SetData(new wxTextDataObject(GetAddress()));
wxTheClipboard->Close();
}
}
void CYourAddressDialog::OnButtonOK(wxCommandEvent& event)
{
// OK
EndModal(true);
}
void CYourAddressDialog::OnButtonCancel(wxCommandEvent& event)
{
// Cancel
EndModal(false);
}
void CYourAddressDialog::OnClose(wxCloseEvent& event)
{
// Close
EndModal(false);
}
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// CAddressBookDialog // CAddressBookDialog
// //
CAddressBookDialog::CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, bool fSendingIn) : CAddressBookDialogBase(parent) CAddressBookDialog::CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, int nPageIn, bool fDuringSendIn) : CAddressBookDialogBase(parent)
{ {
fSending = fSendingIn; // Set initially selected page
if (!fSending) wxNotebookEvent event;
m_buttonCancel->Show(false); event.SetSelection(nPageIn);
OnNotebookPageChanged(event);
m_notebook->ChangeSelection(nPageIn);
// Init column headers fDuringSend = fDuringSendIn;
m_listCtrl->InsertColumn(0, _("Name"), wxLIST_FORMAT_LEFT, 200); if (!fDuringSend)
m_listCtrl->InsertColumn(1, _("Address"), wxLIST_FORMAT_LEFT, 350); m_buttonCancel->Show(false);
m_listCtrl->SetFocus();
// Set Icon // Set Icon
wxIcon iconAddressBook; wxIcon iconAddressBook;
iconAddressBook.CopyFromBitmap(wxBitmap(addressbook16_xpm)); iconAddressBook.CopyFromBitmap(wxBitmap(addressbook16_xpm));
SetIcon(iconAddressBook); SetIcon(iconAddressBook);
// Init column headers
m_listCtrlSending->InsertColumn(0, _("Name"), wxLIST_FORMAT_LEFT, 200);
m_listCtrlSending->InsertColumn(1, _("Address"), wxLIST_FORMAT_LEFT, 350);
m_listCtrlSending->SetFocus();
m_listCtrlReceiving->InsertColumn(0, _("Label"), wxLIST_FORMAT_LEFT, 200);
m_listCtrlReceiving->InsertColumn(1, _("Bitcoin Address"), wxLIST_FORMAT_LEFT, 350);
m_listCtrlReceiving->SetFocus();
// Fill listctrl with address book data // Fill listctrl with address book data
CRITICAL_BLOCK(cs_mapKeys) CRITICAL_BLOCK(cs_mapKeys)
CRITICAL_BLOCK(cs_mapAddressBook) CRITICAL_BLOCK(cs_mapAddressBook)
{ {
string strDefaultReceiving = (string)pframeMain->m_textCtrlAddress->GetValue();
foreach(const PAIRTYPE(string, string)& item, mapAddressBook) foreach(const PAIRTYPE(string, string)& item, mapAddressBook)
{ {
string strAddress = item.first; string strAddress = item.first;
string strName = item.second; string strName = item.second;
uint160 hash160; uint160 hash160;
bool fMine = (AddressToHash160(strAddress, hash160) && mapPubKeys.count(hash160)); bool fMine = (AddressToHash160(strAddress, hash160) && mapPubKeys.count(hash160));
if (!fMine) wxListCtrl* plistCtrl = fMine ? m_listCtrlReceiving : m_listCtrlSending;
{ int nIndex = InsertLine(plistCtrl, strName, strAddress);
int nIndex = InsertLine(m_listCtrl, strName, strAddress); if (strAddress == (fMine ? strDefaultReceiving : strInitSelected))
if (strAddress == strInitSelected) plistCtrl->SetItemState(nIndex, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
m_listCtrl->SetItemState(nIndex, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
}
} }
} }
} }
wxString CAddressBookDialog::GetAddress() wxString CAddressBookDialog::GetSelectedAddress()
{ {
int nIndex = GetSelection(m_listCtrl); int nIndex = GetSelection(m_listCtrl);
if (nIndex == -1) if (nIndex == -1)
@ -2275,9 +2188,40 @@ wxString CAddressBookDialog::GetAddress()
return GetItemText(m_listCtrl, nIndex, 1); return GetItemText(m_listCtrl, nIndex, 1);
} }
wxString CAddressBookDialog::GetSelectedSendingAddress()
{
int nIndex = GetSelection(m_listCtrlSending);
if (nIndex == -1)
return "";
return GetItemText(m_listCtrlSending, nIndex, 1);
}
wxString CAddressBookDialog::GetSelectedReceivingAddress()
{
int nIndex = GetSelection(m_listCtrlReceiving);
if (nIndex == -1)
return "";
return GetItemText(m_listCtrlReceiving, nIndex, 1);
}
void CAddressBookDialog::OnNotebookPageChanged(wxNotebookEvent& event)
{
event.Skip();
nPage = event.GetSelection();
if (nPage == SENDING)
m_listCtrl = m_listCtrlSending;
else if (nPage == RECEIVING)
m_listCtrl = m_listCtrlReceiving;
m_buttonDelete->Show(nPage == SENDING);
m_buttonCopy->Show(nPage == RECEIVING);
this->Layout();
m_listCtrl->SetFocus();
}
void CAddressBookDialog::OnListEndLabelEdit(wxListEvent& event) void CAddressBookDialog::OnListEndLabelEdit(wxListEvent& event)
{ {
// Update address book with edited name // Update address book with edited name
event.Skip();
if (event.IsEditCancelled()) if (event.IsEditCancelled())
return; return;
string strAddress = (string)GetItemText(m_listCtrl, event.GetIndex(), 1); string strAddress = (string)GetItemText(m_listCtrl, event.GetIndex(), 1);
@ -2287,85 +2231,30 @@ void CAddressBookDialog::OnListEndLabelEdit(wxListEvent& event)
void CAddressBookDialog::OnListItemSelected(wxListEvent& event) void CAddressBookDialog::OnListItemSelected(wxListEvent& event)
{ {
event.Skip();
if (nPage == RECEIVING)
SetDefaultReceivingAddress((string)GetSelectedReceivingAddress());
} }
void CAddressBookDialog::OnListItemActivated(wxListEvent& event) void CAddressBookDialog::OnListItemActivated(wxListEvent& event)
{ {
if (fSending) event.Skip();
if (fDuringSend)
{ {
// Doubleclick returns selection // Doubleclick returns selection
EndModal(GetAddress() != "" ? 2 : 0); EndModal(GetSelectedAddress() != "" ? 2 : 0);
return;
} }
else
{
// Doubleclick edits item // Doubleclick edits item
wxCommandEvent event2; wxCommandEvent event2;
OnButtonEdit(event2); OnButtonEdit(event2);
}
}
bool CAddressBookDialog::CheckIfMine(const string& strAddress, const string& strTitle)
{
uint160 hash160;
bool fMine = (AddressToHash160(strAddress, hash160) && mapPubKeys.count(hash160));
if (fMine)
wxMessageBox(_("This is one of your own addresses for receiving payments and cannot be entered in the address book. "), strTitle);
return fMine;
}
void CAddressBookDialog::OnButtonEdit(wxCommandEvent& event)
{
// Ask new name
int nIndex = GetSelection(m_listCtrl);
if (nIndex == -1)
return;
string strName = (string)m_listCtrl->GetItemText(nIndex);
string strAddress = (string)GetItemText(m_listCtrl, nIndex, 1);
string strAddressOrg = strAddress;
do
{
CGetTextFromUserDialog dialog(this, _("Edit Address"), _("Name"), strName, _("Address"), strAddress);
if (!dialog.ShowModal())
return;
strName = dialog.GetValue1();
strAddress = dialog.GetValue2();
}
while (CheckIfMine(strAddress, _("Edit Address")));
// Change name
if (strAddress != strAddressOrg)
CWalletDB().EraseName(strAddressOrg);
SetAddressBookName(strAddress, strName);
m_listCtrl->SetItem(nIndex, 1, strAddress);
m_listCtrl->SetItemText(nIndex, strName);
pframeMain->RefreshListCtrl();
}
void CAddressBookDialog::OnButtonNew(wxCommandEvent& event)
{
// Ask name
string strName;
string strAddress;
do
{
CGetTextFromUserDialog dialog(this, _("New Address"), _("Name"), strName, _("Address"), strAddress);
if (!dialog.ShowModal())
return;
strName = dialog.GetValue1();
strAddress = dialog.GetValue2();
}
while (CheckIfMine(strAddress, _("New Address")));
// Add to list and select it
SetAddressBookName(strAddress, strName);
int nIndex = InsertLine(m_listCtrl, strName, strAddress);
SetSelection(m_listCtrl, nIndex);
m_listCtrl->SetFocus();
pframeMain->RefreshListCtrl();
} }
void CAddressBookDialog::OnButtonDelete(wxCommandEvent& event) void CAddressBookDialog::OnButtonDelete(wxCommandEvent& event)
{ {
if (nPage != SENDING)
return;
for (int nIndex = m_listCtrl->GetItemCount()-1; nIndex >= 0; nIndex--) for (int nIndex = m_listCtrl->GetItemCount()-1; nIndex >= 0; nIndex--)
{ {
if (m_listCtrl->GetItemState(nIndex, wxLIST_STATE_SELECTED)) if (m_listCtrl->GetItemState(nIndex, wxLIST_STATE_SELECTED))
@ -2383,15 +2272,107 @@ void CAddressBookDialog::OnButtonCopy(wxCommandEvent& event)
// Copy address box to clipboard // Copy address box to clipboard
if (wxTheClipboard->Open()) if (wxTheClipboard->Open())
{ {
wxTheClipboard->SetData(new wxTextDataObject(GetAddress())); wxTheClipboard->SetData(new wxTextDataObject(GetSelectedAddress()));
wxTheClipboard->Close(); wxTheClipboard->Close();
} }
} }
bool CAddressBookDialog::CheckIfMine(const string& strAddress, const string& strTitle)
{
uint160 hash160;
bool fMine = (AddressToHash160(strAddress, hash160) && mapPubKeys.count(hash160));
if (fMine)
wxMessageBox(_("This is one of your own addresses for receiving payments and cannot be entered in the address book. "), strTitle);
return fMine;
}
void CAddressBookDialog::OnButtonEdit(wxCommandEvent& event)
{
int nIndex = GetSelection(m_listCtrl);
if (nIndex == -1)
return;
string strName = (string)m_listCtrl->GetItemText(nIndex);
string strAddress = (string)GetItemText(m_listCtrl, nIndex, 1);
string strAddressOrg = strAddress;
if (nPage == SENDING)
{
// Ask name and address
do
{
CGetTextFromUserDialog dialog(this, _("Edit Address"), _("Name"), strName, _("Address"), strAddress);
if (!dialog.ShowModal())
return;
strName = dialog.GetValue1();
strAddress = dialog.GetValue2();
}
while (CheckIfMine(strAddress, _("Edit Address")));
}
else if (nPage == RECEIVING)
{
// Ask name
CGetTextFromUserDialog dialog(this, _("Edit Address Label"), _("Label"), strName);
if (!dialog.ShowModal())
return;
strName = dialog.GetValue();
}
// Write back
if (strAddress != strAddressOrg)
CWalletDB().EraseName(strAddressOrg);
SetAddressBookName(strAddress, strName);
m_listCtrl->SetItem(nIndex, 1, strAddress);
m_listCtrl->SetItemText(nIndex, strName);
pframeMain->RefreshListCtrl();
}
void CAddressBookDialog::OnButtonNew(wxCommandEvent& event)
{
string strName;
string strAddress;
if (nPage == SENDING)
{
// Ask name and address
do
{
CGetTextFromUserDialog dialog(this, _("Add Address"), _("Name"), strName, _("Address"), strAddress);
if (!dialog.ShowModal())
return;
strName = dialog.GetValue1();
strAddress = dialog.GetValue2();
}
while (CheckIfMine(strAddress, _("Add Address")));
}
else if (nPage == RECEIVING)
{
// Ask name
CGetTextFromUserDialog dialog(this,
_("New Receiving Address"),
_("It's good policy to use a new address for each payment you receive.\n\nLabel"),
"");
if (!dialog.ShowModal())
return;
strName = dialog.GetValue();
// Generate new key
strAddress = PubKeyToAddress(GenerateNewKey());
}
// Add to list and select it
SetAddressBookName(strAddress, strName);
int nIndex = InsertLine(m_listCtrl, strName, strAddress);
SetSelection(m_listCtrl, nIndex);
m_listCtrl->SetFocus();
if (nPage == SENDING)
pframeMain->RefreshListCtrl();
}
void CAddressBookDialog::OnButtonOK(wxCommandEvent& event) void CAddressBookDialog::OnButtonOK(wxCommandEvent& event)
{ {
// OK // OK
EndModal(GetAddress() != "" ? 1 : 0); EndModal(GetSelectedAddress() != "" ? 1 : 0);
} }
void CAddressBookDialog::OnButtonCancel(wxCommandEvent& event) void CAddressBookDialog::OnButtonCancel(wxCommandEvent& event)
@ -2947,7 +2928,6 @@ bool CMyApp::OnExceptionInMainLoop()
Sleep(1000); Sleep(1000);
throw; throw;
} }
return true; return true;
} }

62
ui.h
View file

@ -2,11 +2,9 @@
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php. // file license.txt or http://www.opensource.org/licenses/mit-license.php.
DECLARE_EVENT_TYPE(wxEVT_UITHREADCALL, -1) DECLARE_EVENT_TYPE(wxEVT_UITHREADCALL, -1)
extern map<string, string> mapArgs; extern map<string, string> mapArgs;
// Settings // Settings
@ -22,6 +20,7 @@ void UIThreadCall(boost::function0<void>);
void MainFrameRepaint(); void MainFrameRepaint();
void Shutdown(void* parg); void Shutdown(void* parg);
int ThreadSafeMessageBox(const string& message, const string& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1); int ThreadSafeMessageBox(const string& message, const string& caption="Message", int style=wxOK, wxWindow* parent=NULL, int x=-1, int y=-1);
bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent);
@ -51,7 +50,7 @@ protected:
void OnButtonAddressBook(wxCommandEvent& event); void OnButtonAddressBook(wxCommandEvent& event);
void OnSetFocusAddress(wxFocusEvent& event); void OnSetFocusAddress(wxFocusEvent& event);
void OnMouseEventsAddress(wxMouseEvent& event); void OnMouseEventsAddress(wxMouseEvent& event);
void OnButtonChange(wxCommandEvent& event); void OnButtonNew(wxCommandEvent& event);
void OnButtonCopy(wxCommandEvent& event); void OnButtonCopy(wxCommandEvent& event);
void OnListColBeginDrag(wxListEvent& event); void OnListColBeginDrag(wxListEvent& event);
void OnListItemActivated(wxListEvent& event); void OnListItemActivated(wxListEvent& event);
@ -205,53 +204,39 @@ 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 class CAddressBookDialog : public CAddressBookDialogBase
{ {
protected: protected:
// Event handlers // Event handlers
void OnNotebookPageChanged(wxNotebookEvent& event);
void OnListEndLabelEdit(wxListEvent& event); void OnListEndLabelEdit(wxListEvent& event);
void OnListItemSelected(wxListEvent& event); void OnListItemSelected(wxListEvent& event);
void OnListItemActivated(wxListEvent& event); void OnListItemActivated(wxListEvent& event);
void OnButtonEdit(wxCommandEvent& event);
void OnButtonDelete(wxCommandEvent& event); void OnButtonDelete(wxCommandEvent& event);
void OnButtonNew(wxCommandEvent& event);
void OnButtonCopy(wxCommandEvent& event); void OnButtonCopy(wxCommandEvent& event);
void OnButtonEdit(wxCommandEvent& event);
void OnButtonNew(wxCommandEvent& event);
void OnButtonOK(wxCommandEvent& event); void OnButtonOK(wxCommandEvent& event);
void OnButtonCancel(wxCommandEvent& event); void OnButtonCancel(wxCommandEvent& event);
void OnClose(wxCloseEvent& event); void OnClose(wxCloseEvent& event);
public: public:
/** Constructor */ /** Constructor */
CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, bool fSendingIn); CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, int nPageIn, bool fDuringSendIn);
// Custom // Custom
bool fSending; enum
{
SENDING = 0,
RECEIVING = 1,
};
int nPage;
wxListCtrl* m_listCtrl;
bool fDuringSend;
wxString GetAddress(); wxString GetAddress();
wxString GetSelectedAddress();
wxString GetSelectedSendingAddress();
wxString GetSelectedReceivingAddress();
bool CheckIfMine(const string& strAddress, const string& strTitle); bool CheckIfMine(const string& strAddress, const string& strTitle);
}; };
@ -282,18 +267,25 @@ public:
const string& strMessage2="", const string& strMessage2="",
const string& strValue2="") : CGetTextFromUserDialogBase(parent, wxID_ANY, strCaption) const string& strValue2="") : CGetTextFromUserDialogBase(parent, wxID_ANY, strCaption)
{ {
int x = GetSize().GetWidth();
int y = GetSize().GetHeight();
m_staticTextMessage1->SetLabel(strMessage1); m_staticTextMessage1->SetLabel(strMessage1);
m_textCtrl1->SetValue(strValue1); m_textCtrl1->SetValue(strValue1);
y += wxString(strMessage1).Freq('\n') * 14;
if (!strMessage2.empty()) if (!strMessage2.empty())
{ {
m_staticTextMessage2->Show(true); m_staticTextMessage2->Show(true);
m_staticTextMessage2->SetLabel(strMessage2); m_staticTextMessage2->SetLabel(strMessage2);
m_textCtrl2->Show(true); m_textCtrl2->Show(true);
m_textCtrl2->SetValue(strValue2); m_textCtrl2->SetValue(strValue2);
SetSize(wxDefaultCoord, 180); y += 46 + wxString(strMessage2).Freq('\n') * 14;
} }
if (!fWindows) if (!fWindows)
SetSize(1.14 * GetSize().GetWidth(), 1.14 * GetSize().GetHeight()); {
x *= 1.14;
y *= 1.14;
}
SetSize(x, y);
} }
// Custom // Custom

View file

@ -42,14 +42,14 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString&
m_menuOptions->Append( m_menuOptionsGenerateBitcoins ); m_menuOptions->Append( m_menuOptionsGenerateBitcoins );
wxMenuItem* m_menuOptionsChangeYourAddress; wxMenuItem* m_menuOptionsChangeYourAddress;
m_menuOptionsChangeYourAddress = new wxMenuItem( m_menuOptions, wxID_ANY, wxString( _("&Change Your Address...") ) , wxEmptyString, wxITEM_NORMAL ); m_menuOptionsChangeYourAddress = new wxMenuItem( m_menuOptions, wxID_ANY, wxString( _("&Your Receiving Addresses...") ) , wxEmptyString, wxITEM_NORMAL );
m_menuOptions->Append( m_menuOptionsChangeYourAddress ); m_menuOptions->Append( m_menuOptionsChangeYourAddress );
wxMenuItem* m_menuOptionsOptions; wxMenuItem* m_menuOptionsOptions;
m_menuOptionsOptions = new wxMenuItem( m_menuOptions, wxID_MENUOPTIONSOPTIONS, wxString( _("&Options...") ) , wxEmptyString, wxITEM_NORMAL ); m_menuOptionsOptions = new wxMenuItem( m_menuOptions, wxID_MENUOPTIONSOPTIONS, wxString( _("&Options...") ) , wxEmptyString, wxITEM_NORMAL );
m_menuOptions->Append( m_menuOptionsOptions ); m_menuOptions->Append( m_menuOptionsOptions );
m_menubar->Append( m_menuOptions, _("&Options") ); m_menubar->Append( m_menuOptions, _("&Settings") );
m_menuHelp = new wxMenu(); m_menuHelp = new wxMenu();
wxMenuItem* m_menuHelpAbout; wxMenuItem* m_menuHelpAbout;
@ -65,8 +65,8 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString&
m_toolBar->SetToolSeparation( 1 ); m_toolBar->SetToolSeparation( 1 );
m_toolBar->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxEmptyString ) ); m_toolBar->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxEmptyString ) );
m_toolBar->AddTool( wxID_BUTTONSEND, _("&Send Coins"), wxBitmap( send20_xpm ), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString ); m_toolBar->AddTool( wxID_BUTTONSEND, _("Send Coins"), wxBitmap( send20_xpm ), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString );
m_toolBar->AddTool( wxID_BUTTONRECEIVE, _("&Address Book"), wxBitmap( addressbook20_xpm ), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString ); m_toolBar->AddTool( wxID_BUTTONRECEIVE, _("Address Book"), wxBitmap( addressbook20_xpm ), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString );
m_toolBar->Realize(); m_toolBar->Realize();
m_statusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY ); m_statusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
@ -86,14 +86,10 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString&
bSizer85->Add( m_staticText32, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); bSizer85->Add( m_staticText32, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_textCtrlAddress = new wxTextCtrl( this, wxID_TEXTCTRLADDRESS, wxEmptyString, wxDefaultPosition, wxSize( 340,-1 ), wxTE_READONLY ); m_textCtrlAddress = new wxTextCtrl( this, wxID_TEXTCTRLADDRESS, wxEmptyString, wxDefaultPosition, wxSize( 340,-1 ), wxTE_READONLY );
m_textCtrlAddress->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_MENU ) );
bSizer85->Add( m_textCtrlAddress, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); bSizer85->Add( m_textCtrlAddress, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_buttonNew = new wxButton( this, wxID_BUTTONCHANGE, _("&New..."), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonNew = new wxButton( this, wxID_BUTTONNEW, _(" &New... "), wxDefaultPosition, wxSize( -1,-1 ), wxBU_EXACTFIT );
m_buttonNew->Hide(); bSizer85->Add( m_buttonNew, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
bSizer85->Add( m_buttonNew, 0, wxRIGHT, 5 );
m_buttonCopy = new wxButton( this, wxID_BUTTONCOPY, _(" &Copy to Clipboard "), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT ); m_buttonCopy = new wxButton( this, wxID_BUTTONCOPY, _(" &Copy to Clipboard "), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
bSizer85->Add( m_buttonCopy, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); bSizer85->Add( m_buttonCopy, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
@ -188,7 +184,7 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString&
m_textCtrlAddress->Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this ); m_textCtrlAddress->Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
m_textCtrlAddress->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this ); m_textCtrlAddress->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
m_textCtrlAddress->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( CMainFrameBase::OnSetFocusAddress ), NULL, this ); m_textCtrlAddress->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( CMainFrameBase::OnSetFocusAddress ), NULL, this );
m_buttonNew->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CMainFrameBase::OnButtonChange ), NULL, this ); m_buttonNew->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CMainFrameBase::OnButtonNew ), NULL, this );
m_buttonCopy->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CMainFrameBase::OnButtonCopy ), NULL, this ); m_buttonCopy->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CMainFrameBase::OnButtonCopy ), NULL, this );
m_listCtrl->Connect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this ); m_listCtrl->Connect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this );
m_listCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this ); m_listCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this );
@ -240,7 +236,7 @@ CMainFrameBase::~CMainFrameBase()
m_textCtrlAddress->Disconnect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this ); m_textCtrlAddress->Disconnect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
m_textCtrlAddress->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this ); m_textCtrlAddress->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( CMainFrameBase::OnMouseEventsAddress ), NULL, this );
m_textCtrlAddress->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( CMainFrameBase::OnSetFocusAddress ), NULL, this ); m_textCtrlAddress->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( CMainFrameBase::OnSetFocusAddress ), NULL, this );
m_buttonNew->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CMainFrameBase::OnButtonChange ), NULL, this ); m_buttonNew->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CMainFrameBase::OnButtonNew ), NULL, this );
m_buttonCopy->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CMainFrameBase::OnButtonCopy ), NULL, this ); m_buttonCopy->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CMainFrameBase::OnButtonCopy ), NULL, this );
m_listCtrl->Disconnect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this ); m_listCtrl->Disconnect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this );
m_listCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this ); m_listCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this );
@ -844,20 +840,53 @@ CAddressBookDialogBase::CAddressBookDialogBase( wxWindow* parent, wxWindowID id,
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizer58;
bSizer58 = new wxBoxSizer( wxVERTICAL );
m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_panelSending = new wxPanel( m_notebook, wxID_PANELSENDING, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer68; wxBoxSizer* bSizer68;
bSizer68 = new wxBoxSizer( wxVERTICAL ); bSizer68 = new wxBoxSizer( wxVERTICAL );
bSizer68->Add( 0, 5, 0, wxEXPAND, 5 ); bSizer68->Add( 0, 0, 0, wxEXPAND, 5 );
m_staticText55 = new wxStaticText( this, wxID_ANY, _("Bitcoin Address"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText55 = new wxStaticText( m_panelSending, wxID_ANY, _("Bitcoin Address"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText55->Wrap( -1 ); m_staticText55->Wrap( -1 );
m_staticText55->Hide(); m_staticText55->Hide();
bSizer68->Add( m_staticText55, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); bSizer68->Add( m_staticText55, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_listCtrl = new wxListCtrl( this, wxID_LISTCTRL, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_ASCENDING ); m_listCtrlSending = new wxListCtrl( m_panelSending, wxID_LISTCTRLSENDING, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_ASCENDING );
bSizer68->Add( m_listCtrl, 1, wxALL|wxEXPAND, 5 ); bSizer68->Add( m_listCtrlSending, 1, wxALL|wxEXPAND, 5 );
m_panelSending->SetSizer( bSizer68 );
m_panelSending->Layout();
bSizer68->Fit( m_panelSending );
m_notebook->AddPage( m_panelSending, _("Sending"), false );
m_panelReceiving = new wxPanel( m_notebook, wxID_PANELRECEIVING, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer681;
bSizer681 = new wxBoxSizer( wxVERTICAL );
bSizer681->Add( 0, 0, 0, wxEXPAND, 5 );
m_staticText45 = new wxStaticText( m_panelReceiving, wxID_ANY, _("These are your Bitcoin addresses for receiving payments. You can give a different one to each sender to keep track of who is paying you. The highlighted address will be displayed in the main window."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText45->Wrap( 570 );
bSizer681->Add( m_staticText45, 0, wxTOP|wxRIGHT|wxLEFT, 6 );
bSizer681->Add( 0, 2, 0, wxEXPAND, 5 );
m_listCtrlReceiving = new wxListCtrl( m_panelReceiving, wxID_LISTCTRLRECEIVING, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_ASCENDING );
bSizer681->Add( m_listCtrlReceiving, 1, wxALL|wxEXPAND, 5 );
m_panelReceiving->SetSizer( bSizer681 );
m_panelReceiving->Layout();
bSizer681->Fit( m_panelReceiving );
m_notebook->AddPage( m_panelReceiving, _("Receiving"), true );
bSizer58->Add( m_notebook, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizer69; wxBoxSizer* bSizer69;
bSizer69 = new wxBoxSizer( wxHORIZONTAL ); bSizer69 = new wxBoxSizer( wxHORIZONTAL );
@ -865,34 +894,42 @@ CAddressBookDialogBase::CAddressBookDialogBase( wxWindow* parent, wxWindowID id,
bSizer69->Add( 0, 0, 1, wxEXPAND, 5 ); bSizer69->Add( 0, 0, 1, wxEXPAND, 5 );
m_buttonDelete = new wxButton( this, wxID_BUTTONDELETE, _("&Delete"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer69->Add( m_buttonDelete, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_buttonCopy = new wxButton( this, wxID_BUTTONCOPY, _(" &Copy to Clipboard "), wxDefaultPosition, wxSize( -1,-1 ), 0 );
bSizer69->Add( m_buttonCopy, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_buttonEdit = new wxButton( this, wxID_BUTTONEDIT, _("&Edit..."), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonEdit = new wxButton( this, wxID_BUTTONEDIT, _("&Edit..."), wxDefaultPosition, wxDefaultSize, 0 );
bSizer69->Add( m_buttonEdit, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); bSizer69->Add( m_buttonEdit, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_buttonNew = new wxButton( this, wxID_BUTTONNEW, _(" &New Address... "), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonNew = new wxButton( this, wxID_BUTTONNEW, _(" &New Address... "), wxDefaultPosition, wxDefaultSize, 0 );
bSizer69->Add( m_buttonNew, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); bSizer69->Add( m_buttonNew, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_buttonDelete = new wxButton( this, wxID_BUTTONDELETE, _("&Delete"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer69->Add( m_buttonDelete, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
bSizer69->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); bSizer69->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
bSizer69->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); bSizer69->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
bSizer68->Add( bSizer69, 0, wxEXPAND, 5 ); bSizer58->Add( bSizer69, 0, wxEXPAND, 5 );
this->SetSizer( bSizer68 ); this->SetSizer( bSizer58 );
this->Layout(); this->Layout();
// Connect Events // Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CAddressBookDialogBase::OnClose ) ); this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CAddressBookDialogBase::OnClose ) );
m_listCtrl->Connect( wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEventHandler( CAddressBookDialogBase::OnListEndLabelEdit ), NULL, this ); m_notebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( CAddressBookDialogBase::OnNotebookPageChanged ), NULL, this );
m_listCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CAddressBookDialogBase::OnListItemActivated ), NULL, this ); m_listCtrlSending->Connect( wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEventHandler( CAddressBookDialogBase::OnListEndLabelEdit ), NULL, this );
m_listCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( CAddressBookDialogBase::OnListItemSelected ), NULL, this ); m_listCtrlSending->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CAddressBookDialogBase::OnListItemActivated ), NULL, this );
m_listCtrlSending->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( CAddressBookDialogBase::OnListItemSelected ), NULL, this );
m_listCtrlReceiving->Connect( wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEventHandler( CAddressBookDialogBase::OnListEndLabelEdit ), NULL, this );
m_listCtrlReceiving->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CAddressBookDialogBase::OnListItemActivated ), NULL, this );
m_listCtrlReceiving->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( CAddressBookDialogBase::OnListItemSelected ), NULL, this );
m_buttonDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonDelete ), NULL, this );
m_buttonCopy->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonCopy ), NULL, this );
m_buttonEdit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonEdit ), NULL, this ); m_buttonEdit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonEdit ), NULL, this );
m_buttonNew->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonNew ), NULL, this ); m_buttonNew->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonNew ), NULL, this );
m_buttonDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonDelete ), NULL, this );
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonOK ), NULL, this ); m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonOK ), NULL, this );
m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonCancel ), NULL, this ); m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonCancel ), NULL, this );
} }
@ -901,12 +938,17 @@ CAddressBookDialogBase::~CAddressBookDialogBase()
{ {
// Disconnect Events // Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CAddressBookDialogBase::OnClose ) ); this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CAddressBookDialogBase::OnClose ) );
m_listCtrl->Disconnect( wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEventHandler( CAddressBookDialogBase::OnListEndLabelEdit ), NULL, this ); m_notebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( CAddressBookDialogBase::OnNotebookPageChanged ), NULL, this );
m_listCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CAddressBookDialogBase::OnListItemActivated ), NULL, this ); m_listCtrlSending->Disconnect( wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEventHandler( CAddressBookDialogBase::OnListEndLabelEdit ), NULL, this );
m_listCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( CAddressBookDialogBase::OnListItemSelected ), NULL, this ); m_listCtrlSending->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CAddressBookDialogBase::OnListItemActivated ), NULL, this );
m_listCtrlSending->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( CAddressBookDialogBase::OnListItemSelected ), NULL, this );
m_listCtrlReceiving->Disconnect( wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEventHandler( CAddressBookDialogBase::OnListEndLabelEdit ), NULL, this );
m_listCtrlReceiving->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CAddressBookDialogBase::OnListItemActivated ), NULL, this );
m_listCtrlReceiving->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( CAddressBookDialogBase::OnListItemSelected ), NULL, this );
m_buttonDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonDelete ), NULL, this );
m_buttonCopy->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonCopy ), NULL, this );
m_buttonEdit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonEdit ), NULL, this ); m_buttonEdit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonEdit ), NULL, this );
m_buttonNew->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonNew ), NULL, this ); m_buttonNew->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonNew ), NULL, this );
m_buttonDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonDelete ), NULL, this );
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonOK ), NULL, this ); m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonOK ), NULL, this );
m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonCancel ), NULL, this ); m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonCancel ), NULL, this );
} }

View file

@ -36,6 +36,7 @@
#include <wx/spinctrl.h> #include <wx/spinctrl.h>
#include <wx/scrolwin.h> #include <wx/scrolwin.h>
#include <wx/statbmp.h> #include <wx/statbmp.h>
#include <wx/notebook.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -46,7 +47,7 @@
#define wxID_BUTTONSEND 1004 #define wxID_BUTTONSEND 1004
#define wxID_BUTTONRECEIVE 1005 #define wxID_BUTTONRECEIVE 1005
#define wxID_TEXTCTRLADDRESS 1006 #define wxID_TEXTCTRLADDRESS 1006
#define wxID_BUTTONCHANGE 1007 #define wxID_BUTTONNEW 1007
#define wxID_BUTTONCOPY 1008 #define wxID_BUTTONCOPY 1008
#define wxID_TRANSACTIONFEE 1009 #define wxID_TRANSACTIONFEE 1009
#define wxID_PROXYIP 1010 #define wxID_PROXYIP 1010
@ -58,10 +59,13 @@
#define wxID_CHOICETRANSFERTYPE 1016 #define wxID_CHOICETRANSFERTYPE 1016
#define wxID_LISTCTRL 1017 #define wxID_LISTCTRL 1017
#define wxID_BUTTONRENAME 1018 #define wxID_BUTTONRENAME 1018
#define wxID_BUTTONNEW 1019 #define wxID_PANELSENDING 1019
#define wxID_BUTTONEDIT 1020 #define wxID_LISTCTRLSENDING 1020
#define wxID_BUTTONDELETE 1021 #define wxID_PANELRECEIVING 1021
#define wxID_TEXTCTRL 1022 #define wxID_LISTCTRLRECEIVING 1022
#define wxID_BUTTONDELETE 1023
#define wxID_BUTTONEDIT 1024
#define wxID_TEXTCTRL 1025
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class CMainFrameBase /// Class CMainFrameBase
@ -79,7 +83,6 @@ class CMainFrameBase : public wxFrame
wxStatusBar* m_statusBar; wxStatusBar* m_statusBar;
wxStaticText* m_staticText32; wxStaticText* m_staticText32;
wxTextCtrl* m_textCtrlAddress;
wxButton* m_buttonNew; wxButton* m_buttonNew;
wxButton* m_buttonCopy; wxButton* m_buttonCopy;
@ -108,7 +111,7 @@ class CMainFrameBase : public wxFrame
virtual void OnKeyDown( wxKeyEvent& event ){ event.Skip(); } virtual void OnKeyDown( wxKeyEvent& event ){ event.Skip(); }
virtual void OnMouseEventsAddress( wxMouseEvent& event ){ event.Skip(); } virtual void OnMouseEventsAddress( wxMouseEvent& event ){ event.Skip(); }
virtual void OnSetFocusAddress( wxFocusEvent& event ){ event.Skip(); } virtual void OnSetFocusAddress( wxFocusEvent& event ){ event.Skip(); }
virtual void OnButtonChange( wxCommandEvent& event ){ event.Skip(); } virtual void OnButtonNew( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonCopy( wxCommandEvent& event ){ event.Skip(); } virtual void OnButtonCopy( wxCommandEvent& event ){ event.Skip(); }
virtual void OnListColBeginDrag( wxListEvent& event ){ event.Skip(); } virtual void OnListColBeginDrag( wxListEvent& event ){ event.Skip(); }
virtual void OnListItemActivated( wxListEvent& event ){ event.Skip(); } virtual void OnListItemActivated( wxListEvent& event ){ event.Skip(); }
@ -117,6 +120,7 @@ class CMainFrameBase : public wxFrame
public: public:
wxMenu* m_menuOptions; wxMenu* m_menuOptions;
wxTextCtrl* m_textCtrlAddress;
wxListCtrl* m_listCtrl; wxListCtrl* m_listCtrl;
CMainFrameBase( wxWindow* parent, wxWindowID id = wxID_MAINFRAME, const wxString& title = _("Bitcoin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 712,484 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL ); CMainFrameBase( wxWindow* parent, wxWindowID id = wxID_MAINFRAME, const wxString& title = _("Bitcoin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 712,484 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
~CMainFrameBase(); ~CMainFrameBase();
@ -343,23 +347,33 @@ class CAddressBookDialogBase : public wxDialog
private: private:
protected: protected:
wxNotebook* m_notebook;
wxPanel* m_panelSending;
wxStaticText* m_staticText55; wxStaticText* m_staticText55;
wxListCtrl* m_listCtrl; wxListCtrl* m_listCtrlSending;
wxPanel* m_panelReceiving;
wxStaticText* m_staticText45;
wxListCtrl* m_listCtrlReceiving;
wxButton* m_buttonDelete;
wxButton* m_buttonCopy;
wxButton* m_buttonEdit; wxButton* m_buttonEdit;
wxButton* m_buttonNew; wxButton* m_buttonNew;
wxButton* m_buttonDelete;
wxButton* m_buttonOK; wxButton* m_buttonOK;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } virtual void OnClose( wxCloseEvent& event ){ event.Skip(); }
virtual void OnNotebookPageChanged( wxNotebookEvent& event ){ event.Skip(); }
virtual void OnListEndLabelEdit( wxListEvent& event ){ event.Skip(); } virtual void OnListEndLabelEdit( wxListEvent& event ){ event.Skip(); }
virtual void OnListItemActivated( wxListEvent& event ){ event.Skip(); } virtual void OnListItemActivated( wxListEvent& event ){ event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ){ event.Skip(); } virtual void OnListItemSelected( wxListEvent& event ){ event.Skip(); }
virtual void OnButtonDelete( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonCopy( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonEdit( wxCommandEvent& event ){ event.Skip(); } virtual void OnButtonEdit( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonNew( wxCommandEvent& event ){ event.Skip(); } virtual void OnButtonNew( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDelete( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonOK( wxCommandEvent& event ){ event.Skip(); } virtual void OnButtonOK( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonCancel( wxCommandEvent& event ){ event.Skip(); } virtual void OnButtonCancel( wxCommandEvent& event ){ event.Skip(); }
@ -397,7 +411,7 @@ class CGetTextFromUserDialogBase : public wxDialog
public: public:
CGetTextFromUserDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 403,138 ), long style = wxDEFAULT_DIALOG_STYLE ); CGetTextFromUserDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 440,138 ), long style = wxDEFAULT_DIALOG_STYLE );
~CGetTextFromUserDialogBase(); ~CGetTextFromUserDialogBase();
}; };

View file

@ -155,7 +155,7 @@
</object> </object>
</object> </object>
<object class="wxMenu" expanded="1"> <object class="wxMenu" expanded="1">
<property name="label">&amp;Options</property> <property name="label">&amp;Settings</property>
<property name="name">m_menuOptions</property> <property name="name">m_menuOptions</property>
<property name="permission">public</property> <property name="permission">public</property>
<object class="wxMenuItem" expanded="1"> <object class="wxMenuItem" expanded="1">
@ -180,7 +180,7 @@
<property name="help"></property> <property name="help"></property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="kind">wxITEM_NORMAL</property> <property name="kind">wxITEM_NORMAL</property>
<property name="label">&amp;Change Your Address...</property> <property name="label">&amp;Your Receiving Addresses...</property>
<property name="name">m_menuOptionsChangeYourAddress</property> <property name="name">m_menuOptionsChangeYourAddress</property>
<property name="permission">none</property> <property name="permission">none</property>
<property name="shortcut"></property> <property name="shortcut"></property>
@ -276,7 +276,7 @@
<property name="bitmap">xpm/send20.xpm; Load From File</property> <property name="bitmap">xpm/send20.xpm; Load From File</property>
<property name="id">wxID_BUTTONSEND</property> <property name="id">wxID_BUTTONSEND</property>
<property name="kind">wxITEM_NORMAL</property> <property name="kind">wxITEM_NORMAL</property>
<property name="label">&amp;Send Coins</property> <property name="label">Send Coins</property>
<property name="name">m_tool1</property> <property name="name">m_tool1</property>
<property name="statusbar"></property> <property name="statusbar"></property>
<property name="tooltip"></property> <property name="tooltip"></property>
@ -290,7 +290,7 @@
<property name="bitmap">xpm/addressbook20.xpm; Load From File</property> <property name="bitmap">xpm/addressbook20.xpm; Load From File</property>
<property name="id">wxID_BUTTONRECEIVE</property> <property name="id">wxID_BUTTONRECEIVE</property>
<property name="kind">wxITEM_NORMAL</property> <property name="kind">wxITEM_NORMAL</property>
<property name="label">&amp;Address Book</property> <property name="label">Address Book</property>
<property name="name">m_tool2</property> <property name="name">m_tool2</property>
<property name="statusbar"></property> <property name="statusbar"></property>
<property name="tooltip"></property> <property name="tooltip"></property>
@ -426,7 +426,7 @@
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1"> <object class="wxTextCtrl" expanded="1">
<property name="bg">wxSYS_COLOUR_MENU</property> <property name="bg"></property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>
@ -437,7 +437,7 @@
<property name="maxlength">0</property> <property name="maxlength">0</property>
<property name="minimum_size">-1,-1</property> <property name="minimum_size">-1,-1</property>
<property name="name">m_textCtrlAddress</property> <property name="name">m_textCtrlAddress</property>
<property name="permission">protected</property> <property name="permission">public</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">340,-1</property> <property name="size">340,-1</property>
<property name="style">wxTE_READONLY</property> <property name="style">wxTE_READONLY</property>
@ -478,7 +478,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxRIGHT</property> <property name="flag">wxRIGHT|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxButton" expanded="1"> <object class="wxButton" expanded="1">
<property name="bg"></property> <property name="bg"></property>
@ -487,22 +487,22 @@
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>
<property name="font"></property> <property name="font"></property>
<property name="hidden">1</property> <property name="hidden">0</property>
<property name="id">wxID_BUTTONCHANGE</property> <property name="id">wxID_BUTTONNEW</property>
<property name="label">&amp;New...</property> <property name="label"> &amp;New... </property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_buttonNew</property> <property name="name">m_buttonNew</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size"></property> <property name="size">-1,-1</property>
<property name="style"></property> <property name="style">wxBU_EXACTFIT</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnButtonClick">OnButtonChange</event> <event name="OnButtonClick">OnButtonNew</event>
<event name="OnChar"></event> <event name="OnChar"></event>
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
@ -4388,7 +4388,7 @@
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bSizer69</property> <property name="name">bSizer69</property>
<property name="orient">wxHORIZONTAL</property> <property name="orient">wxHORIZONTAL</property>
@ -4719,6 +4719,107 @@
<event name="OnSetFocus"></event> <event name="OnSetFocus"></event>
<event name="OnSize"></event> <event name="OnSize"></event>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer58</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxNotebook" expanded="1">
<property name="bg"></property>
<property name="bitmapsize"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_notebook</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnNotebookPageChanged">OnNotebookPageChanged</event>
<event name="OnNotebookPageChanging"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Sending</property>
<property name="select">0</property>
<object class="wxPanel" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_PANELSENDING</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_panelSending</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bSizer68</property> <property name="name">bSizer68</property>
@ -4729,7 +4830,7 @@
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="spacer" expanded="1"> <object class="spacer" expanded="1">
<property name="height">5</property> <property name="height">0</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="width">0</property> <property name="width">0</property>
</object> </object>
@ -4796,10 +4897,10 @@
<property name="fg"></property> <property name="fg"></property>
<property name="font"></property> <property name="font"></property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_LISTCTRL</property> <property name="id">wxID_LISTCTRLSENDING</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_listCtrl</property> <property name="name">m_listCtrlSending</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size"></property> <property name="size"></property>
@ -4854,6 +4955,205 @@
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
</object>
</object>
</object>
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Receiving</property>
<property name="select">1</property>
<object class="wxPanel" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_PANELRECEIVING</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_panelReceiving</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer681</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">6</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">These are your Bitcoin addresses for receiving payments. You can give a different one to each sender to keep track of who is paying you. The highlighted address will be displayed in the main window.</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_staticText45</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">570</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">2</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxListCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_LISTCTRLRECEIVING</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_listCtrlReceiving</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_ASCENDING</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnListBeginDrag"></event>
<event name="OnListBeginLabelEdit"></event>
<event name="OnListBeginRDrag"></event>
<event name="OnListCacheHint"></event>
<event name="OnListColBeginDrag"></event>
<event name="OnListColClick"></event>
<event name="OnListColDragging"></event>
<event name="OnListColEndDrag"></event>
<event name="OnListColRightClick"></event>
<event name="OnListDeleteAllItems"></event>
<event name="OnListDeleteItem"></event>
<event name="OnListEndLabelEdit">OnListEndLabelEdit</event>
<event name="OnListInsertItem"></event>
<event name="OnListItemActivated">OnListItemActivated</event>
<event name="OnListItemDeselected"></event>
<event name="OnListItemFocused"></event>
<event name="OnListItemMiddleClick"></event>
<event name="OnListItemRightClick"></event>
<event name="OnListItemSelected">OnListItemSelected</event>
<event name="OnListKeyDown"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
@ -4873,6 +5173,110 @@
<property name="width">0</property> <property name="width">0</property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="default">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_BUTTONDELETE</property>
<property name="label">&amp;Delete</property>
<property name="maximum_size"></property>
<property name="minimum_size">-1,-1</property>
<property name="name">m_buttonDelete</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnButtonDelete</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="default">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_BUTTONCOPY</property>
<property name="label"> &amp;Copy to Clipboard </property>
<property name="maximum_size"></property>
<property name="minimum_size">-1,-1</property>
<property name="name">m_buttonCopy</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnButtonCopy</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property> <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
@ -4977,58 +5381,6 @@
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="default">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_BUTTONDELETE</property>
<property name="label">&amp;Delete</property>
<property name="maximum_size"></property>
<property name="minimum_size">-1,-1</property>
<property name="name">m_buttonDelete</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnButtonDelete</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property> <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
@ -5151,7 +5503,7 @@
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">CGetTextFromUserDialogBase</property> <property name="name">CGetTextFromUserDialogBase</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">403,138</property> <property name="size">440,138</property>
<property name="style">wxDEFAULT_DIALOG_STYLE</property> <property name="style">wxDEFAULT_DIALOG_STYLE</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="title"></property> <property name="title"></property>

View file

@ -445,10 +445,14 @@ const char* wxGetTranslation(const char* pszEnglish)
// wxWidgets translation // wxWidgets translation
const char* pszTranslated = wxGetTranslation(wxString(pszEnglish, wxConvUTF8)).utf8_str(); const char* pszTranslated = wxGetTranslation(wxString(pszEnglish, wxConvUTF8)).utf8_str();
// We don't cache unknown strings because caller might be passing in a
// dynamic string and we would keep allocating memory for each variation.
if (strcmp(pszEnglish, pszTranslated) == 0) if (strcmp(pszEnglish, pszTranslated) == 0)
return pszEnglish; return pszEnglish;
// Add to cache, memory doesn't need to be freed // Add to cache, memory doesn't need to be freed. We only cache because
// we must pass back a pointer to permanently allocated memory.
char* pszCached = new char[strlen(pszTranslated)+1]; char* pszCached = new char[strlen(pszTranslated)+1];
strcpy(pszCached, pszTranslated); strcpy(pszCached, pszTranslated);
mapCache[pszEnglish] = pszCached; mapCache[pszEnglish] = pszCached;