changeset 55:a71b4cffb922 draft

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
author s_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>
date Sat, 20 Feb 2010 21:59:59 +0000
parents f544cef2cd21
children f92369828f57
files main.cpp main.h script.h serialize.h ui.cpp ui.h uibase.cpp uibase.h uiproject.fbp util.cpp
diffstat 10 files changed, 1014 insertions(+), 622 deletions(-) [+]
line wrap: on
line diff
--- a/main.cpp
+++ b/main.cpp
@@ -2645,7 +2645,12 @@
                         do
                         {
                             pindexTmp = pindexBest;
-                            Sleep(10000);
+                            for (int i = 0; i < 10; i++)
+                            {
+                                Sleep(1000);
+                                if (fShutdown)
+                                    return;
+                            }
                         }
                         while (pindexTmp != pindexBest);
                     }
@@ -2852,10 +2857,13 @@
                     if (keyRet.IsNull())
                         keyRet.MakeNewKey();
 
-                    // Fill a vout to ourself
-                    CScript scriptPubKey;
-                    scriptPubKey << keyRet.GetPubKey() << OP_CHECKSIG;
-                    wtxNew.vout.push_back(CTxOut(nValueIn - nTotalValue, scriptPubKey));
+                    // Fill a vout to ourself, using same address type as the payment
+                    CScript scriptChange;
+                    if (scriptPubKey.GetBitcoinAddressHash160() != 0)
+                        scriptChange.SetBitcoinAddress(keyRet.GetPubKey());
+                    else
+                        scriptChange << keyRet.GetPubKey() << OP_CHECKSIG;
+                    wtxNew.vout.push_back(CTxOut(nValueIn - nTotalValue, scriptChange));
                 }
 
                 // Fill a vout to the payee
@@ -2894,42 +2902,50 @@
 }
 
 // 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_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
-        // duration of this scope.  This is the only place where this optimization
-        // maybe makes sense; please don't do it anywhere else.
-        CWalletDB walletdb("r");
-
-        // Add the change's private key to wallet
-        if (!key.IsNull() && !AddKey(key))
-            throw runtime_error("CommitTransactionSpent() : AddKey failed\n");
-
-        // Add tx to wallet, because if it has change it's also ours,
-        // otherwise just for transaction history.
-        AddToWallet(wtxNew);
-
-        // Mark old coins as spent
-        set<CWalletTx*> setCoins;
-        foreach(const CTxIn& txin, wtxNew.vin)
-            setCoins.insert(&mapWallet[txin.prevout.hash]);
-        foreach(CWalletTx* pcoin, setCoins)
+        printf("CommitTransaction:\n%s", wtxNew.ToString().c_str());
+        CRITICAL_BLOCK(cs_mapWallet)
         {
-            pcoin->fSpent = true;
-            pcoin->WriteToDisk();
-            vWalletUpdated.push_back(pcoin->GetHash());
+            // 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
+            // maybe makes sense; please don't do it anywhere else.
+            CWalletDB walletdb("r");
+
+            // Add the change's private key to wallet
+            if (!key.IsNull() && !AddKey(key))
+                throw runtime_error("CommitTransaction() : AddKey failed\n");
+
+            // Add tx to wallet, because if it has change it's also ours,
+            // otherwise just for transaction history.
+            AddToWallet(wtxNew);
+
+            // Mark old coins as spent
+            set<CWalletTx*> setCoins;
+            foreach(const CTxIn& txin, wtxNew.vin)
+                setCoins.insert(&mapWallet[txin.prevout.hash]);
+            foreach(CWalletTx* pcoin, setCoins)
+            {
+                pcoin->fSpent = true;
+                pcoin->WriteToDisk();
+                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();
     return true;
@@ -2938,7 +2954,7 @@
 
 
 
-string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew)
+string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, bool fAskFee)
 {
     CRITICAL_BLOCK(cs_main)
     {
@@ -2954,26 +2970,12 @@
             printf("SendMoney() : %s", strError.c_str());
             return strError;
         }
-        if (!CommitTransactionSpent(wtxNew, key))
-        {
-            printf("SendMoney() : Error finalizing transaction");
-            return _("Error finalizing transaction");
-        }
-
-        // Track how many getdata requests our transaction gets
-        CRITICAL_BLOCK(cs_mapRequestCount)
-            mapRequestCount[wtxNew.GetHash()] = 0;
-
-        printf("SendMoney: %s\n", wtxNew.GetHash().ToString().substr(0,6).c_str());
-
-        // Broadcast
-        if (!wtxNew.AcceptTransaction())
-        {
-            // This must not fail. The transaction has already been signed and recorded.
-            printf("SendMoney() : Error: Transaction not valid");
+
+        if (fAskFee && !ThreadSafeAskFee(nFeeRequired, _("Sending..."), NULL))
+            return "ABORTED";
+
+        if (!CommitTransaction(wtxNew, key))
             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();
     return "";
@@ -2981,7 +2983,7 @@
 
 
 
-string SendMoneyToBitcoinAddress(string strAddress, int64 nValue, CWalletTx& wtxNew)
+string SendMoneyToBitcoinAddress(string strAddress, int64 nValue, CWalletTx& wtxNew, bool fAskFee)
 {
     // Check amount
     if (nValue <= 0)
@@ -2994,5 +2996,5 @@
     if (!scriptPubKey.SetBitcoinAddress(strAddress))
         return _("Invalid bitcoin address");
 
-    return SendMoney(scriptPubKey, nValue, wtxNew);
+    return SendMoney(scriptPubKey, nValue, wtxNew, fAskFee);
 }
--- a/main.h
+++ b/main.h
@@ -67,9 +67,10 @@
 bool SendMessages(CNode* pto);
 int64 GetBalance();
 bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CKey& keyRet, int64& nFeeRequiredRet);
-bool CommitTransactionSpent(const CWalletTx& wtxNew, const CKey& key);
-string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew);
-string SendMoneyToBitcoinAddress(string strAddress, int64 nValue, CWalletTx& wtxNew);
+bool CommitTransaction(CWalletTx& wtxNew, const CKey& key);
+bool BroadcastTransaction(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 ThreadBitcoinMiner(void* parg);
 void BitcoinMiner();
--- a/script.h
+++ b/script.h
@@ -580,6 +580,11 @@
         *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)
     {
         this->clear();
--- a/serialize.h
+++ b/serialize.h
@@ -19,7 +19,7 @@
 class CDataStream;
 class CAutoFile;
 
-static const int VERSION = 203;
+static const int VERSION = 204;
 static const char* pszSubVer = ".0";
 
 
--- a/ui.cpp
+++ b/ui.cpp
@@ -35,13 +35,54 @@
 // 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)
 {
     // Ctrl-a select all
+    event.Skip();
     wxTextCtrl* textCtrl = (wxTextCtrl*)event.GetEventObject();
     if (event.GetModifiers() == wxMOD_CONTROL && event.GetKeyCode() == 'A')
         textCtrl->SetSelection(-1, -1);
-    event.Skip();
 }
 
 bool Is24HourTime()
@@ -194,6 +235,35 @@
 #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 @@
     fontTmp.SetFamily(wxFONTFAMILY_TELETYPE);
     m_staticTextBalance->SetFont(fontTmp);
     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
     dResize = 1.20;
     SetSize((dResize + 0.02) * GetSize().GetWidth(), 1.09 * GetSize().GetHeight());
@@ -276,47 +341,6 @@
     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)
 {
     if (fMinimizeOnClose && event.CanVeto() && !IsIconized())
@@ -335,6 +359,7 @@
 
 void CMainFrame::OnIconize(wxIconizeEvent& event)
 {
+    event.Skip();
     // Hide the task bar button when minimized.
     // Event is sent when the frame is minimized or restored.
     // wxWidgets 2.8.9 doesn't have IsIconized() so there's no way
@@ -342,7 +367,7 @@
     if (!event.Iconized())
         fClosedToTray = false;
 #ifndef __WXMSW__
-    // Tray is not reliable on Linux gnome
+    // Tray is not reliable on ubuntu 9.10 gnome
     fClosedToTray = false;
 #endif
     if (fMinimizeToTray && event.Iconized())
@@ -353,6 +378,7 @@
 
 void CMainFrame::OnMouseEvents(wxMouseEvent& event)
 {
+    event.Skip();
     RandAddSeed();
     RAND_add(&event.m_x, sizeof(event.m_x), 0.25);
     RAND_add(&event.m_y, sizeof(event.m_y), 0.25);
@@ -360,9 +386,11 @@
 
 void CMainFrame::OnListColBeginDrag(wxListEvent& event)
 {
-     // Hidden columns not resizeable
-     if (event.GetColumn() <= 1 && !fDebug)
+    // Hidden columns not resizeable
+    if (event.GetColumn() <= 1 && !fDebug)
         event.Veto();
+    else
+        event.Skip();
 }
 
 int CMainFrame::GetSortIndex(const string& strSort)
@@ -546,7 +574,7 @@
 
         if (wtx.IsCoinBase())
         {
-            // Coinbase
+            // Generated
             strDescription = _("Generated");
             if (nCredit == 0)
             {
@@ -569,7 +597,7 @@
         }
         else if (!mapValue["from"].empty() || !mapValue["message"].empty())
         {
-            // Online transaction
+            // Received by IP connection
             if (!mapValue["from"].empty())
                 strDescription += _("From: ") + mapValue["from"];
             if (!mapValue["message"].empty())
@@ -581,7 +609,7 @@
         }
         else
         {
-            // Offline transaction
+            // Received by Bitcoin Address
             foreach(const CTxOut& txout, wtx.vout)
             {
                 if (txout.IsMine())
@@ -591,20 +619,19 @@
                     {
                         CRITICAL_BLOCK(cs_mapAddressBook)
                         {
+                            //strDescription += _("Received payment to ");
+                            //strDescription += _("Received with address ");
+                            strDescription += _("From: unknown, Received with: ");
                             string strAddress = PubKeyToAddress(vchPubKey);
-                            if (mapAddressBook.count(strAddress))
+                            map<string, string>::iterator mi = mapAddressBook.find(strAddress);
+                            if (mi != mapAddressBook.end() && !(*mi).second.empty())
                             {
-                                //strDescription += _("Received payment to ");
-                                //strDescription += _("Received with address ");
-                                strDescription += _("From: unknown, To: ");
+                                string strLabel = (*mi).second;
+                                strDescription += strAddress.substr(0,12) + "... ";
+                                strDescription += "(" + strLabel + ")";
+                            }
+                            else
                                 strDescription += strAddress;
-                                /// The labeling feature is just too confusing, so I hid it
-                                /// by putting it at the end where it runs off the screen.
-                                /// It can still be seen by widening the column, or in the
-                                /// details dialog.
-                                if (!mapAddressBook[strAddress].empty())
-                                    strDescription += " (" + mapAddressBook[strAddress] + ")";
-                            }
                         }
                     }
                     break;
@@ -659,12 +686,12 @@
                 string strAddress;
                 if (!mapValue["to"].empty())
                 {
-                    // Online transaction
+                    // Sent to IP
                     strAddress = mapValue["to"];
                 }
                 else
                 {
-                    // Offline transaction
+                    // Sent to Bitcoin Address
                     uint160 hash160;
                     if (ExtractHash160(txout.scriptPubKey, hash160))
                         strAddress = Hash160ToAddress(hash160);
@@ -683,8 +710,11 @@
                 }
 
                 int64 nValue = txout.nValue;
-                if (nOut == 0 && nTxFee > 0)
+                if (nTxFee > 0)
+                {
                     nValue += nTxFee;
+                    nTxFee = 0;
+                }
 
                 InsertLine(fNew, nIndex, hash, strprintf("%s-%d", strSort.c_str(), nOut),
                            strStatus,
@@ -846,12 +876,12 @@
 
 void CMainFrame::OnPaint(wxPaintEvent& event)
 {
+    event.Skip();
     if (fRefresh)
     {
         fRefresh = false;
         Refresh();
     }
-    event.Skip();
 }
 
 
@@ -903,6 +933,9 @@
 
 void CMainFrame::OnPaintListCtrl(wxPaintEvent& event)
 {
+    // Skip lets the listctrl do the paint, we're just hooking the message
+    event.Skip();
+
     if (ptaskbaricon)
         ptaskbaricon->UpdateTooltip();
 
@@ -970,11 +1003,6 @@
 
     if (fDebug && GetTime() - nThreadSocketHandlerHeartbeat > 60)
         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::OnMenuOptionsChangeYourAddress(wxCommandEvent& event)
 {
-    // Options->Change Your Address
-    OnButtonChange(event);
+    // Options->Your Receiving Addresses
+    CAddressBookDialog dialog(this, "", CAddressBookDialog::RECEIVING, false);
+    if (!dialog.ShowModal())
+        return;
 }
 
 void CMainFrame::OnMenuOptionsOptions(wxCommandEvent& event)
@@ -1061,11 +1091,11 @@
 void CMainFrame::OnButtonAddressBook(wxCommandEvent& event)
 {
     // Toolbar: Address Book
-    CAddressBookDialog dialogAddr(this, "", false);
+    CAddressBookDialog dialogAddr(this, "", CAddressBookDialog::SENDING, false);
     if (dialogAddr.ShowModal() == 2)
     {
         // Send
-        CSendDialog dialogSend(this, dialogAddr.GetAddress());
+        CSendDialog dialogSend(this, dialogAddr.GetSelectedAddress());
         dialogSend.ShowModal();
     }
 }
@@ -1073,35 +1103,36 @@
 void CMainFrame::OnSetFocusAddress(wxFocusEvent& event)
 {
     // Automatically select-all when entering window
+    event.Skip();
     m_textCtrlAddress->SetSelection(-1, -1);
     fOnSetFocusAddress = true;
-    event.Skip();
 }
 
 void CMainFrame::OnMouseEventsAddress(wxMouseEvent& event)
 {
+    event.Skip();
     if (fOnSetFocusAddress)
         m_textCtrlAddress->SetSelection(-1, -1);
     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())
         return;
-    string strAddress = (string)dialog.GetAddress();
-    if (strAddress != m_textCtrlAddress->GetValue())
-    {
-        uint160 hash160;
-        if (!AddressToHash160(strAddress, hash160))
-            return;
-        if (!mapPubKeys.count(hash160))
-            return;
-        CWalletDB().WriteDefaultKey(mapPubKeys[hash160]);
-        m_textCtrlAddress->SetValue(strAddress);
-    }
+    string strName = dialog.GetValue();
+
+    // Generate new key
+    string strAddress = PubKeyToAddress(GenerateNewKey());
+
+    // Save
+    SetAddressBookName(strAddress, strName);
+    SetDefaultReceivingAddress(strAddress);
 }
 
 void CMainFrame::OnButtonCopy(wxCommandEvent& event)
@@ -1139,7 +1170,6 @@
 
 
 
-
 //////////////////////////////////////////////////////////////////////////////
 //
 // CTxDetailsDialog
@@ -1452,6 +1482,7 @@
 
 void COptionsDialog::OnKillFocusTransactionFee(wxFocusEvent& event)
 {
+    event.Skip();
     int64 nTmp = nTransactionFee;
     ParseMoney(m_textCtrlTransactionFee->GetValue(), nTmp);
     m_textCtrlTransactionFee->SetValue(FormatMoney(nTmp));
@@ -1485,6 +1516,7 @@
 
 void COptionsDialog::OnKillFocusProxy(wxFocusEvent& event)
 {
+    event.Skip();
     m_textCtrlProxyIP->SetValue(GetProxyAddr().ToStringIP());
     m_textCtrlProxyPort->SetValue(GetProxyAddr().ToStringPort());
 }
@@ -1632,6 +1664,7 @@
 void CSendDialog::OnTextAddress(wxCommandEvent& event)
 {
     // Check mark
+    event.Skip();
     bool fBitcoinAddress = IsValidBitcoinAddress(m_textCtrlAddress->GetValue());
     m_bitmapCheckMark->Show(fBitcoinAddress);
 
@@ -1660,6 +1693,7 @@
 void CSendDialog::OnKillFocusAmount(wxFocusEvent& event)
 {
     // Reformat the amount
+    event.Skip();
     if (m_textCtrlAmount->GetValue().Trim().empty())
         return;
     int64 nTmp;
@@ -1670,9 +1704,9 @@
 void CSendDialog::OnButtonAddressBook(wxCommandEvent& event)
 {
     // Open address book
-    CAddressBookDialog dialog(this, m_textCtrlAddress->GetValue(), true);
+    CAddressBookDialog dialog(this, m_textCtrlAddress->GetValue(), CAddressBookDialog::SENDING, true);
     if (dialog.ShowModal())
-        m_textCtrlAddress->SetValue(dialog.GetAddress());
+        m_textCtrlAddress->SetValue(dialog.GetSelectedAddress());
 }
 
 void CSendDialog::OnButtonPaste(wxCommandEvent& event)
@@ -1723,11 +1757,11 @@
         CScript scriptPubKey;
         scriptPubKey << OP_DUP << OP_HASH160 << hash160 << OP_EQUALVERIFY << OP_CHECKSIG;
 
-        string strError = SendMoney(scriptPubKey, nValue, wtx);
-        if (strError != "")
+        string strError = SendMoney(scriptPubKey, nValue, wtx, true);
+        if (strError == "")
+            wxMessageBox(_("Payment sent  "), _("Sending..."));
+        else if (strError != "ABORTED")
             wxMessageBox(strError + "  ", _("Sending..."));
-        else
-            wxMessageBox(_("Payment sent  "), _("Sending..."));
     }
     else
     {
@@ -1846,6 +1880,7 @@
 
 void CSendingDialog::OnPaint(wxPaintEvent& event)
 {
+    event.Skip();
     if (strlen(pszStatus) > 130)
         m_textCtrlStatus->SetValue(string("\n") + pszStatus);
     else
@@ -1869,7 +1904,6 @@
         Close();
         wxMessageBox(_("Transfer cancelled  "), _("Sending..."), wxOK, this);
     }
-    event.Skip();
 }
 
 
@@ -2016,6 +2050,13 @@
             return;
         }
 
+        // Transaction fee
+        if (!ThreadSafeAskFee(nFeeRequired, _("Sending..."), this))
+        {
+            Error(_("Transaction aborted"));
+            return;
+        }
+
         // Make sure we're still connected
         CNode* pnode = ConnectNode(addr, 2 * 60 * 60);
         if (!pnode)
@@ -2040,20 +2081,15 @@
             return;
 
         // 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;
         }
 
         // Send payment tx to seller, with response going to OnReply3 via event handler
         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..."));
         MainFrameRepaint();
     }
@@ -2097,37 +2133,54 @@
 
 //////////////////////////////////////////////////////////////////////////////
 //
-// CYourAddressDialog
+// CAddressBookDialog
 //
 
-CYourAddressDialog::CYourAddressDialog(wxWindow* parent, const string& strInitSelected) : CYourAddressDialogBase(parent)
+CAddressBookDialog::CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, int nPageIn, bool fDuringSendIn) : CAddressBookDialogBase(parent)
 {
+    // Set initially selected page
+    wxNotebookEvent event;
+    event.SetSelection(nPageIn);
+    OnNotebookPageChanged(event);
+    m_notebook->ChangeSelection(nPageIn);
+
+    fDuringSend = fDuringSendIn;
+    if (!fDuringSend)
+        m_buttonCancel->Show(false);
+
+    // Set Icon
+    wxIcon iconAddressBook;
+    iconAddressBook.CopyFromBitmap(wxBitmap(addressbook16_xpm));
+    SetIcon(iconAddressBook);
+
     // 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();
+    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
     CRITICAL_BLOCK(cs_mapKeys)
     CRITICAL_BLOCK(cs_mapAddressBook)
     {
+        string strDefaultReceiving = (string)pframeMain->m_textCtrlAddress->GetValue();
         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);
-            }
+            wxListCtrl* plistCtrl = fMine ? m_listCtrlReceiving : m_listCtrlSending;
+            int nIndex = InsertLine(plistCtrl, strName, strAddress);
+            if (strAddress == (fMine ? strDefaultReceiving : strInitSelected))
+                plistCtrl->SetItemState(nIndex, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
         }
     }
 }
 
-wxString CYourAddressDialog::GetAddress()
+wxString CAddressBookDialog::GetSelectedAddress()
 {
     int nIndex = GetSelection(m_listCtrl);
     if (nIndex == -1)
@@ -2135,149 +2188,40 @@
     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)
+wxString CAddressBookDialog::GetSelectedSendingAddress()
 {
-}
-
-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);
+    int nIndex = GetSelection(m_listCtrlSending);
     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();
-    }
+        return "";
+    return GetItemText(m_listCtrlSending, nIndex, 1);
 }
 
-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(wxWindow* parent, const wxString& strInitSelected, bool fSendingIn) : CAddressBookDialogBase(parent)
+wxString CAddressBookDialog::GetSelectedReceivingAddress()
 {
-    fSending = fSendingIn;
-    if (!fSending)
-        m_buttonCancel->Show(false);
-
-    // Init column headers
-    m_listCtrl->InsertColumn(0, _("Name"), wxLIST_FORMAT_LEFT, 200);
-    m_listCtrl->InsertColumn(1, _("Address"), wxLIST_FORMAT_LEFT, 350);
-    m_listCtrl->SetFocus();
-
-    // Set Icon
-    wxIcon iconAddressBook;
-    iconAddressBook.CopyFromBitmap(wxBitmap(addressbook16_xpm));
-    SetIcon(iconAddressBook);
-
-    // 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 CAddressBookDialog::GetAddress()
-{
-    int nIndex = GetSelection(m_listCtrl);
+    int nIndex = GetSelection(m_listCtrlReceiving);
     if (nIndex == -1)
         return "";
-    return GetItemText(m_listCtrl, nIndex, 1);
+    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)
 {
     // Update address book with edited name
+    event.Skip();
     if (event.IsEditCancelled())
         return;
     string strAddress = (string)GetItemText(m_listCtrl, event.GetIndex(), 1);
@@ -2287,85 +2231,30 @@
 
 void CAddressBookDialog::OnListItemSelected(wxListEvent& event)
 {
+    event.Skip();
+    if (nPage == RECEIVING)
+        SetDefaultReceivingAddress((string)GetSelectedReceivingAddress());
 }
 
 void CAddressBookDialog::OnListItemActivated(wxListEvent& event)
 {
-    if (fSending)
+    event.Skip();
+    if (fDuringSend)
     {
         // Doubleclick returns selection
-        EndModal(GetAddress() != "" ? 2 : 0);
-    }
-    else
-    {
-        // Doubleclick edits item
-        wxCommandEvent 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)
+        EndModal(GetSelectedAddress() != "" ? 2 : 0);
         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();
+
+    // Doubleclick edits item
+    wxCommandEvent event2;
+    OnButtonEdit(event2);
 }
 
 void CAddressBookDialog::OnButtonDelete(wxCommandEvent& event)
 {
+    if (nPage != SENDING)
+        return;
     for (int nIndex = m_listCtrl->GetItemCount()-1; nIndex >= 0; nIndex--)
     {
         if (m_listCtrl->GetItemState(nIndex, wxLIST_STATE_SELECTED))
@@ -2383,15 +2272,107 @@
     // Copy address box to clipboard
     if (wxTheClipboard->Open())
     {
-        wxTheClipboard->SetData(new wxTextDataObject(GetAddress()));
+        wxTheClipboard->SetData(new wxTextDataObject(GetSelectedAddress()));
         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)
 {
     // OK
-    EndModal(GetAddress() != "" ? 1 : 0);
+    EndModal(GetSelectedAddress() != "" ? 1 : 0);
 }
 
 void CAddressBookDialog::OnButtonCancel(wxCommandEvent& event)
@@ -2644,14 +2625,14 @@
         wxString strUsage = string() +
             _("Usage: bitcoin [options]") + "\t\t\t\t\t\t\n" +
             _("Options:\n") +
-            "  -gen            \t\t   " + _("Generate coins\n") +
-            "  -gen=0          \t\t   " + _("Don't generate coins\n") +
-            "  -min            \t\t   " + _("Start minimized\n") +
-            "  -datadir=<dir>  \t   "   + _("Specify data directory\n") +
-            "  -proxy=<ip:port>\t   "   + _("Connect through socks4 proxy\n") +
-            "  -addnode=<ip>   \t   "   + _("Add a node to connect to\n") +
-            "  -connect=<ip>   \t   "   + _("Connect only to the specified node\n") +
-            "  -?              \t\t   " + _("This help message\n");
+            "  -gen            \t\t  " + _("Generate coins\n") +
+            "  -gen=0          \t\t  " + _("Don't generate coins\n") +
+            "  -min            \t\t  " + _("Start minimized\n") +
+            "  -datadir=<dir>  \t  "   + _("Specify data directory\n") +
+            "  -proxy=<ip:port>\t  "   + _("Connect through socks4 proxy\n") +
+            "  -addnode=<ip>   \t  "   + _("Add a node to connect to\n") +
+            "  -connect=<ip>   \t  "   + _("Connect only to the specified node\n") +
+            "  -?              \t\t  " + _("This help message\n");
 
         if (fWindows)
         {
@@ -2947,7 +2928,6 @@
         Sleep(1000);
         throw;
     }
-
     return true;
 }
 
--- a/ui.h
+++ b/ui.h
@@ -2,11 +2,9 @@
 // Distributed under the MIT/X11 software license, see the accompanying
 // file license.txt or http://www.opensource.org/licenses/mit-license.php.
 
-
+DECLARE_EVENT_TYPE(wxEVT_UITHREADCALL, -1)
 
 
-DECLARE_EVENT_TYPE(wxEVT_UITHREADCALL, -1)
-
 extern map<string, string> mapArgs;
 
 // Settings
@@ -22,6 +20,7 @@
 void MainFrameRepaint();
 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);
+bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent);
 
 
 
@@ -51,7 +50,7 @@
     void OnButtonAddressBook(wxCommandEvent& event);
     void OnSetFocusAddress(wxFocusEvent& event);
     void OnMouseEventsAddress(wxMouseEvent& event);
-    void OnButtonChange(wxCommandEvent& event);
+    void OnButtonNew(wxCommandEvent& event);
     void OnButtonCopy(wxCommandEvent& event);
     void OnListColBeginDrag(wxListEvent& event);
     void OnListItemActivated(wxListEvent& event);
@@ -205,53 +204,39 @@
 
 
 
-class CYourAddressDialog : public CYourAddressDialogBase
+class CAddressBookDialog : public CAddressBookDialogBase
 {
 protected:
     // Event handlers
+    void OnNotebookPageChanged(wxNotebookEvent& event);
     void OnListEndLabelEdit(wxListEvent& event);
     void OnListItemSelected(wxListEvent& event);
     void OnListItemActivated(wxListEvent& event);
-    void OnButtonRename(wxCommandEvent& event);
+    void OnButtonDelete(wxCommandEvent& event);
+    void OnButtonCopy(wxCommandEvent& event);
+    void OnButtonEdit(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);
+    CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, int nPageIn, bool fDuringSendIn);
 
     // Custom
+    enum
+    {
+        SENDING = 0,
+        RECEIVING = 1,
+    };
+    int nPage;
+    wxListCtrl* m_listCtrl;
+    bool fDuringSend;
     wxString GetAddress();
-};
-
-
-
-class CAddressBookDialog : public CAddressBookDialogBase
-{
-protected:
-    // Event handlers
-    void OnListEndLabelEdit(wxListEvent& event);
-    void OnListItemSelected(wxListEvent& event);
-    void OnListItemActivated(wxListEvent& event);
-    void OnButtonEdit(wxCommandEvent& event);
-    void OnButtonDelete(wxCommandEvent& event);
-    void OnButtonNew(wxCommandEvent& event);
-    void OnButtonCopy(wxCommandEvent& event);
-    void OnButtonOK(wxCommandEvent& event);
-    void OnButtonCancel(wxCommandEvent& event);
-    void OnClose(wxCloseEvent& event);
-
-public:
-    /** Constructor */
-    CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, bool fSendingIn);
-
-    // Custom
-    bool fSending;
-    wxString GetAddress();
+    wxString GetSelectedAddress();
+    wxString GetSelectedSendingAddress();
+    wxString GetSelectedReceivingAddress();
     bool CheckIfMine(const string& strAddress, const string& strTitle);
 };
 
@@ -282,18 +267,25 @@
                            const string& strMessage2="",
                            const string& strValue2="") : CGetTextFromUserDialogBase(parent, wxID_ANY, strCaption)
     {
+        int x = GetSize().GetWidth();
+        int y = GetSize().GetHeight();
         m_staticTextMessage1->SetLabel(strMessage1);
         m_textCtrl1->SetValue(strValue1);
+        y += wxString(strMessage1).Freq('\n') * 14;
         if (!strMessage2.empty())
         {
             m_staticTextMessage2->Show(true);
             m_staticTextMessage2->SetLabel(strMessage2);
             m_textCtrl2->Show(true);
             m_textCtrl2->SetValue(strValue2);
-            SetSize(wxDefaultCoord, 180);
+            y += 46 + wxString(strMessage2).Freq('\n') * 14;
         }
         if (!fWindows)
-            SetSize(1.14 * GetSize().GetWidth(), 1.14 * GetSize().GetHeight());
+        {
+            x *= 1.14;
+            y *= 1.14;
+        }
+        SetSize(x, y);
     }
 
     // Custom
--- a/uibase.cpp
+++ b/uibase.cpp
@@ -42,14 +42,14 @@
 	m_menuOptions->Append( m_menuOptionsGenerateBitcoins );
 	
 	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 );
 	
 	wxMenuItem* m_menuOptionsOptions;
 	m_menuOptionsOptions = new wxMenuItem( m_menuOptions, wxID_MENUOPTIONSOPTIONS, wxString( _("&Options...") ) , wxEmptyString, wxITEM_NORMAL );
 	m_menuOptions->Append( m_menuOptionsOptions );
 	
-	m_menubar->Append( m_menuOptions, _("&Options") );
+	m_menubar->Append( m_menuOptions, _("&Settings") );
 	
 	m_menuHelp = new wxMenu();
 	wxMenuItem* m_menuHelpAbout;
@@ -65,8 +65,8 @@
 	m_toolBar->SetToolSeparation( 1 );
 	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_BUTTONRECEIVE, _("&Address Book"), wxBitmap( addressbook20_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->Realize();
 	
 	m_statusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
@@ -86,14 +86,10 @@
 	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->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_MENU ) );
-	
 	bSizer85->Add( m_textCtrlAddress, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
 	
-	m_buttonNew = new wxButton( this, wxID_BUTTONCHANGE, _("&New..."), wxDefaultPosition, wxDefaultSize, 0 );
-	m_buttonNew->Hide();
-	
-	bSizer85->Add( m_buttonNew, 0, wxRIGHT, 5 );
+	m_buttonNew = new wxButton( this, wxID_BUTTONNEW, _(" &New... "), wxDefaultPosition, wxSize( -1,-1 ), wxBU_EXACTFIT );
+	bSizer85->Add( m_buttonNew, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
 	
 	m_buttonCopy = new wxButton( this, wxID_BUTTONCOPY, _(" &Copy to Clipboard "), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
 	bSizer85->Add( m_buttonCopy, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
@@ -188,7 +184,7 @@
 	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_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_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 );
@@ -240,7 +236,7 @@
 	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_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_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 );
@@ -844,20 +840,53 @@
 {
 	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;
 	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->Hide();
 	
 	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 );
-	bSizer68->Add( m_listCtrl, 1, wxALL|wxEXPAND, 5 );
+	m_listCtrlSending = new wxListCtrl( m_panelSending, wxID_LISTCTRLSENDING, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_ASCENDING );
+	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;
 	bSizer69 = new wxBoxSizer( wxHORIZONTAL );
@@ -865,34 +894,42 @@
 	
 	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 );
 	bSizer69->Add( m_buttonEdit, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
 	
 	m_buttonNew = new wxButton( this, wxID_BUTTONNEW, _(" &New Address... "), wxDefaultPosition, wxDefaultSize, 0 );
 	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 );
 	bSizer69->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
 	
 	m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,-1 ), 0 );
 	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();
 	
 	// Connect Events
 	this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CAddressBookDialogBase::OnClose ) );
-	m_listCtrl->Connect( wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEventHandler( CAddressBookDialogBase::OnListEndLabelEdit ), NULL, this );
-	m_listCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CAddressBookDialogBase::OnListItemActivated ), NULL, this );
-	m_listCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( CAddressBookDialogBase::OnListItemSelected ), NULL, this );
+	m_notebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( CAddressBookDialogBase::OnNotebookPageChanged ), NULL, this );
+	m_listCtrlSending->Connect( wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEventHandler( CAddressBookDialogBase::OnListEndLabelEdit ), 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_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_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonCancel ), NULL, this );
 }
@@ -901,12 +938,17 @@
 {
 	// Disconnect Events
 	this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( CAddressBookDialogBase::OnClose ) );
-	m_listCtrl->Disconnect( wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEventHandler( CAddressBookDialogBase::OnListEndLabelEdit ), NULL, this );
-	m_listCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CAddressBookDialogBase::OnListItemActivated ), NULL, this );
-	m_listCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( CAddressBookDialogBase::OnListItemSelected ), NULL, this );
+	m_notebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( CAddressBookDialogBase::OnNotebookPageChanged ), NULL, this );
+	m_listCtrlSending->Disconnect( wxEVT_COMMAND_LIST_END_LABEL_EDIT, wxListEventHandler( CAddressBookDialogBase::OnListEndLabelEdit ), 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_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_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CAddressBookDialogBase::OnButtonCancel ), NULL, this );
 }
--- a/uibase.h
+++ b/uibase.h
@@ -36,6 +36,7 @@
 #include <wx/spinctrl.h>
 #include <wx/scrolwin.h>
 #include <wx/statbmp.h>
+#include <wx/notebook.h>
 
 ///////////////////////////////////////////////////////////////////////////
 
@@ -46,7 +47,7 @@
 #define wxID_BUTTONSEND 1004
 #define wxID_BUTTONRECEIVE 1005
 #define wxID_TEXTCTRLADDRESS 1006
-#define wxID_BUTTONCHANGE 1007
+#define wxID_BUTTONNEW 1007
 #define wxID_BUTTONCOPY 1008
 #define wxID_TRANSACTIONFEE 1009
 #define wxID_PROXYIP 1010
@@ -58,10 +59,13 @@
 #define wxID_CHOICETRANSFERTYPE 1016
 #define wxID_LISTCTRL 1017
 #define wxID_BUTTONRENAME 1018
-#define wxID_BUTTONNEW 1019
-#define wxID_BUTTONEDIT 1020
-#define wxID_BUTTONDELETE 1021
-#define wxID_TEXTCTRL 1022
+#define wxID_PANELSENDING 1019
+#define wxID_LISTCTRLSENDING 1020
+#define wxID_PANELRECEIVING 1021
+#define wxID_LISTCTRLRECEIVING 1022
+#define wxID_BUTTONDELETE 1023
+#define wxID_BUTTONEDIT 1024
+#define wxID_TEXTCTRL 1025
 
 ///////////////////////////////////////////////////////////////////////////////
 /// Class CMainFrameBase
@@ -79,7 +83,6 @@
 		wxStatusBar* m_statusBar;
 		
 		wxStaticText* m_staticText32;
-		wxTextCtrl* m_textCtrlAddress;
 		wxButton* m_buttonNew;
 		wxButton* m_buttonCopy;
 		
@@ -108,7 +111,7 @@
 		virtual void OnKeyDown( wxKeyEvent& event ){ event.Skip(); }
 		virtual void OnMouseEventsAddress( wxMouseEvent& 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 OnListColBeginDrag( wxListEvent& event ){ event.Skip(); }
 		virtual void OnListItemActivated( wxListEvent& event ){ event.Skip(); }
@@ -117,6 +120,7 @@
 	
 	public:
 		wxMenu* m_menuOptions;
+		wxTextCtrl* m_textCtrlAddress;
 		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();
@@ -343,23 +347,33 @@
 	private:
 	
 	protected:
+		wxNotebook* m_notebook;
+		wxPanel* m_panelSending;
 		
 		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_buttonNew;
-		wxButton* m_buttonDelete;
 		wxButton* m_buttonOK;
 		
 		// Virtual event handlers, overide them in your derived class
 		virtual void OnClose( wxCloseEvent& event ){ event.Skip(); }
+		virtual void OnNotebookPageChanged( wxNotebookEvent& event ){ event.Skip(); }
 		virtual void OnListEndLabelEdit( wxListEvent& event ){ event.Skip(); }
 		virtual void OnListItemActivated( 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 OnButtonNew( wxCommandEvent& event ){ event.Skip(); }
-		virtual void OnButtonDelete( wxCommandEvent& event ){ event.Skip(); }
 		virtual void OnButtonOK( wxCommandEvent& event ){ event.Skip(); }
 		virtual void OnButtonCancel( wxCommandEvent& event ){ event.Skip(); }
 		
@@ -397,7 +411,7 @@
 		
 	
 	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();
 	
 };
--- a/uiproject.fbp
+++ b/uiproject.fbp
@@ -155,7 +155,7 @@
                     </object>
                 </object>
                 <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="permission">public</property>
                     <object class="wxMenuItem" expanded="1">
@@ -180,7 +180,7 @@
                         <property name="help"></property>
                         <property name="id">wxID_ANY</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="permission">none</property>
                         <property name="shortcut"></property>
@@ -276,7 +276,7 @@
                     <property name="bitmap">xpm/send20.xpm; Load From File</property>
                     <property name="id">wxID_BUTTONSEND</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="statusbar"></property>
                     <property name="tooltip"></property>
@@ -290,7 +290,7 @@
                     <property name="bitmap">xpm/addressbook20.xpm; Load From File</property>
                     <property name="id">wxID_BUTTONRECEIVE</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="statusbar"></property>
                     <property name="tooltip"></property>
@@ -426,7 +426,7 @@
                             <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
                             <property name="proportion">0</property>
                             <object class="wxTextCtrl" expanded="1">
-                                <property name="bg">wxSYS_COLOUR_MENU</property>
+                                <property name="bg"></property>
                                 <property name="context_help"></property>
                                 <property name="enabled">1</property>
                                 <property name="fg"></property>
@@ -437,7 +437,7 @@
                                 <property name="maxlength">0</property>
                                 <property name="minimum_size">-1,-1</property>
                                 <property name="name">m_textCtrlAddress</property>
-                                <property name="permission">protected</property>
+                                <property name="permission">public</property>
                                 <property name="pos"></property>
                                 <property name="size">340,-1</property>
                                 <property name="style">wxTE_READONLY</property>
@@ -478,7 +478,7 @@
                         </object>
                         <object class="sizeritem" expanded="1">
                             <property name="border">5</property>
-                            <property name="flag">wxRIGHT</property>
+                            <property name="flag">wxRIGHT|wxALIGN_CENTER_VERTICAL</property>
                             <property name="proportion">0</property>
                             <object class="wxButton" expanded="1">
                                 <property name="bg"></property>
@@ -487,22 +487,22 @@
                                 <property name="enabled">1</property>
                                 <property name="fg"></property>
                                 <property name="font"></property>
-                                <property name="hidden">1</property>
-                                <property name="id">wxID_BUTTONCHANGE</property>
-                                <property name="label">&amp;New...</property>
+                                <property name="hidden">0</property>
+                                <property name="id">wxID_BUTTONNEW</property>
+                                <property name="label"> &amp;New... </property>
                                 <property name="maximum_size"></property>
                                 <property name="minimum_size"></property>
                                 <property name="name">m_buttonNew</property>
                                 <property name="permission">protected</property>
                                 <property name="pos"></property>
-                                <property name="size"></property>
-                                <property name="style"></property>
+                                <property name="size">-1,-1</property>
+                                <property name="style">wxBU_EXACTFIT</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">OnButtonChange</event>
+                                <event name="OnButtonClick">OnButtonNew</event>
                                 <event name="OnChar"></event>
                                 <event name="OnEnterWindow"></event>
                                 <event name="OnEraseBackground"></event>
@@ -4388,7 +4388,7 @@
                     <property name="border">5</property>
                     <property name="flag">wxEXPAND</property>
                     <property name="proportion">0</property>
-                    <object class="wxBoxSizer" expanded="0">
+                    <object class="wxBoxSizer" expanded="1">
                         <property name="minimum_size"></property>
                         <property name="name">bSizer69</property>
                         <property name="orient">wxHORIZONTAL</property>
@@ -4721,35 +4721,25 @@
             <event name="OnUpdateUI"></event>
             <object class="wxBoxSizer" expanded="1">
                 <property name="minimum_size"></property>
-                <property name="name">bSizer68</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</property>
-                    <property name="proportion">0</property>
-                    <object class="spacer" expanded="1">
-                        <property name="height">5</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">wxTOP|wxRIGHT|wxLEFT</property>
-                    <property name="proportion">0</property>
-                    <object class="wxStaticText" expanded="1">
+                    <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">1</property>
+                        <property name="hidden">0</property>
                         <property name="id">wxID_ANY</property>
-                        <property name="label">Bitcoin Address</property>
                         <property name="maximum_size"></property>
                         <property name="minimum_size"></property>
-                        <property name="name">m_staticText55</property>
+                        <property name="name">m_notebook</property>
                         <property name="permission">protected</property>
                         <property name="pos"></property>
                         <property name="size"></property>
@@ -4759,7 +4749,6 @@
                         <property name="window_extra_style"></property>
                         <property name="window_name"></property>
                         <property name="window_style"></property>
-                        <property name="wrap">-1</property>
                         <event name="OnChar"></event>
                         <event name="OnEnterWindow"></event>
                         <event name="OnEraseBackground"></event>
@@ -4776,6 +4765,8 @@
                         <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>
@@ -4783,75 +4774,384 @@
                         <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|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_LISTCTRL</property>
-                        <property name="maximum_size"></property>
-                        <property name="minimum_size"></property>
-                        <property name="name">m_listCtrl</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 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">
+                                    <property name="minimum_size"></property>
+                                    <property name="name">bSizer68</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">5</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">1</property>
+                                            <property name="id">wxID_ANY</property>
+                                            <property name="label">Bitcoin Address</property>
+                                            <property name="maximum_size"></property>
+                                            <property name="minimum_size"></property>
+                                            <property name="name">m_staticText55</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">-1</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">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_LISTCTRLSENDING</property>
+                                            <property name="maximum_size"></property>
+                                            <property name="minimum_size"></property>
+                                            <property name="name">m_listCtrlSending</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 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">
@@ -4885,6 +5185,110 @@
                                 <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">
+                            <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_BUTTONEDIT</property>
                                 <property name="label">&amp;Edit...</property>
                                 <property name="maximum_size"></property>
@@ -4989,58 +5393,6 @@
                                 <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_OK</property>
                                 <property name="label">OK</property>
                                 <property name="maximum_size"></property>
@@ -5151,7 +5503,7 @@
             <property name="minimum_size"></property>
             <property name="name">CGetTextFromUserDialogBase</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="subclass"></property>
             <property name="title"></property>
--- a/util.cpp
+++ b/util.cpp
@@ -445,10 +445,14 @@
 
         // wxWidgets translation
         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)
             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];
         strcpy(pszCached, pszTranslated);
         mapCache[pszEnglish] = pszCached;