#include <crtdbg.h>
#endif
+using namespace std;
+using namespace boost;
DEFINE_EVENT_TYPE(wxEVT_UITHREADCALL)
bool ThreadSafeAskFee(int64 nFeeRequired, const string& strCaption, wxWindow* parent)
{
- if (nFeeRequired < CENT || nFeeRequired <= nTransactionFee || fDaemon)
+ if (nFeeRequired < MIN_TX_FEE || nFeeRequired <= nTransactionFee || fDaemon)
return true;
string strMessage = strprintf(
_("This transaction is over the size limit. You can still send it for a fee of %s, "
dResize -= 0.01;
#endif
wxListCtrl* pplistCtrl[] = {m_listCtrlAll, m_listCtrlSentReceived, m_listCtrlSent, m_listCtrlReceived};
- foreach(wxListCtrl* p, pplistCtrl)
+ BOOST_FOREACH(wxListCtrl* p, pplistCtrl)
{
p->InsertColumn(0, "", wxLIST_FORMAT_LEFT, dResize * 0);
p->InsertColumn(1, "", wxLIST_FORMAT_LEFT, dResize * 0);
{
string strOut;
bool fOneSpace = false;
- foreach(unsigned char c, strIn)
+ BOOST_FOREACH(unsigned char c, strIn)
{
if (isspace(c))
{
if (nCredit == 0)
{
int64 nUnmatured = 0;
- foreach(const CTxOut& txout, wtx.vout)
+ BOOST_FOREACH(const CTxOut& txout, wtx.vout)
nUnmatured += txout.GetCredit();
if (wtx.IsInMainChain())
{
// Received by Bitcoin Address
if (!fShowReceived)
return false;
- foreach(const CTxOut& txout, wtx.vout)
+ BOOST_FOREACH(const CTxOut& txout, wtx.vout)
{
if (txout.IsMine())
{
else
{
bool fAllFromMe = true;
- foreach(const CTxIn& txin, wtx.vin)
+ BOOST_FOREACH(const CTxIn& txin, wtx.vin)
fAllFromMe = fAllFromMe && txin.IsMine();
bool fAllToMe = true;
- foreach(const CTxOut& txout, wtx.vout)
+ BOOST_FOREACH(const CTxOut& txout, wtx.vout)
fAllToMe = fAllToMe && txout.IsMine();
if (fAllFromMe && fAllToMe)
// Mixed debit transaction, can't break down payees
//
bool fAllMine = true;
- foreach(const CTxOut& txout, wtx.vout)
+ BOOST_FOREACH(const CTxOut& txout, wtx.vout)
fAllMine = fAllMine && txout.IsMine();
- foreach(const CTxIn& txin, wtx.vin)
+ BOOST_FOREACH(const CTxIn& txin, wtx.vin)
fAllMine = fAllMine && txin.IsMine();
InsertLine(fNew, nIndex, hash, strSort, colour,
string strTop;
if (m_listCtrl->GetItemCount())
strTop = (string)m_listCtrl->GetItemText(0);
- foreach(uint256 hash, vWalletUpdated)
+ BOOST_FOREACH(uint256 hash, vWalletUpdated)
{
map<uint256, CWalletTx>::iterator mi = mapWallet.find(hash);
if (mi != mapWallet.end())
Close(true);
}
-void CMainFrame::OnMenuOptionsGenerate(wxCommandEvent& event)
-{
- // Options->Generate Coins
- GenerateBitcoins(event.IsChecked());
-}
-
void CMainFrame::OnUpdateUIOptionsGenerate(wxUpdateUIEvent& event)
{
event.Check(fGenerateBitcoins);
if (nNet > 0)
{
// Credit
- foreach(const CTxOut& txout, wtx.vout)
+ BOOST_FOREACH(const CTxOut& txout, wtx.vout)
{
if (txout.IsMine())
{
// Coinbase
//
int64 nUnmatured = 0;
- foreach(const CTxOut& txout, wtx.vout)
+ BOOST_FOREACH(const CTxOut& txout, wtx.vout)
nUnmatured += txout.GetCredit();
strHTML += _("<b>Credit:</b> ");
if (wtx.IsInMainChain())
else
{
bool fAllFromMe = true;
- foreach(const CTxIn& txin, wtx.vin)
+ BOOST_FOREACH(const CTxIn& txin, wtx.vin)
fAllFromMe = fAllFromMe && txin.IsMine();
bool fAllToMe = true;
- foreach(const CTxOut& txout, wtx.vout)
+ BOOST_FOREACH(const CTxOut& txout, wtx.vout)
fAllToMe = fAllToMe && txout.IsMine();
if (fAllFromMe)
//
// Debit
//
- foreach(const CTxOut& txout, wtx.vout)
+ BOOST_FOREACH(const CTxOut& txout, wtx.vout)
{
if (txout.IsMine())
continue;
//
// Mixed debit transaction
//
- foreach(const CTxIn& txin, wtx.vin)
+ BOOST_FOREACH(const CTxIn& txin, wtx.vin)
if (txin.IsMine())
strHTML += _("<b>Debit:</b> ") + FormatMoney(-txin.GetDebit()) + "<br>";
- foreach(const CTxOut& txout, wtx.vout)
+ BOOST_FOREACH(const CTxOut& txout, wtx.vout)
if (txout.IsMine())
strHTML += _("<b>Credit:</b> ") + FormatMoney(txout.GetCredit()) + "<br>";
}
if (fDebug)
{
strHTML += "<hr><br>debug print<br><br>";
- foreach(const CTxIn& txin, wtx.vin)
+ BOOST_FOREACH(const CTxIn& txin, wtx.vin)
if (txin.IsMine())
strHTML += "<b>Debit:</b> " + FormatMoney(-txin.GetDebit()) + "<br>";
- foreach(const CTxOut& txout, wtx.vout)
+ BOOST_FOREACH(const CTxOut& txout, wtx.vout)
if (txout.IsMine())
strHTML += "<b>Credit:</b> " + FormatMoney(txout.GetCredit()) + "<br>";
strHTML += "<br><b>Inputs:</b><br>";
CRITICAL_BLOCK(cs_mapWallet)
{
- foreach(const CTxIn& txin, wtx.vin)
+ BOOST_FOREACH(const CTxIn& txin, wtx.vin)
{
COutPoint prevout = txin.prevout;
map<uint256, CWalletTx>::iterator mi = mapWallet.find(prevout.hash);
// Init values
m_textCtrlTransactionFee->SetValue(FormatMoney(nTransactionFee));
- m_checkBoxLimitProcessors->SetValue(fLimitProcessors);
- m_spinCtrlLimitProcessors->Enable(fLimitProcessors);
- m_spinCtrlLimitProcessors->SetValue(nLimitProcessors);
- int nProcessors = wxThread::GetCPUCount();
- if (nProcessors < 1)
- nProcessors = 999;
- m_spinCtrlLimitProcessors->SetRange(1, nProcessors);
m_checkBoxStartOnSystemStartup->SetValue(fTmpStartOnSystemStartup = GetStartOnSystemStartup());
m_checkBoxMinimizeToTray->SetValue(fMinimizeToTray);
m_checkBoxMinimizeOnClose->SetValue(fMinimizeOnClose);
m_textCtrlTransactionFee->SetValue(FormatMoney(nTmp));
}
-void COptionsDialog::OnCheckBoxLimitProcessors(wxCommandEvent& event)
-{
- m_spinCtrlLimitProcessors->Enable(event.IsChecked());
-}
-
void COptionsDialog::OnCheckBoxUseProxy(wxCommandEvent& event)
{
m_textCtrlProxyIP->Enable(event.IsChecked());
if (ParseMoney(m_textCtrlTransactionFee->GetValue(), nTransactionFee) && nTransactionFee != nPrevTransactionFee)
walletdb.WriteSetting("nTransactionFee", nTransactionFee);
- int nPrevMaxProc = (fLimitProcessors ? nLimitProcessors : INT_MAX);
- if (fLimitProcessors != m_checkBoxLimitProcessors->GetValue())
- {
- fLimitProcessors = m_checkBoxLimitProcessors->GetValue();
- walletdb.WriteSetting("fLimitProcessors", fLimitProcessors);
- }
- if (nLimitProcessors != m_spinCtrlLimitProcessors->GetValue())
- {
- nLimitProcessors = m_spinCtrlLimitProcessors->GetValue();
- walletdb.WriteSetting("nLimitProcessors", nLimitProcessors);
- }
- if (fGenerateBitcoins && (fLimitProcessors ? nLimitProcessors : INT_MAX) > nPrevMaxProc)
- GenerateBitcoins(fGenerateBitcoins);
-
if (fTmpStartOnSystemStartup != m_checkBoxStartOnSystemStartup->GetValue())
{
fTmpStartOnSystemStartup = m_checkBoxStartOnSystemStartup->GetValue();
m_bitmapCheckMark->Show(false);
fEnabledPrev = true;
m_textCtrlAddress->SetFocus();
+
//// todo: should add a display of your balance for convenience
#ifndef __WXMSW__
wxFont fontTmp = m_staticTextInstructions->GetFont();
m_staticTextInstructions->SetFont(fontTmp);
SetSize(725, 180);
#endif
-
+
// Set Icon
wxIcon iconSend;
iconSend.CopyFromBitmap(wxBitmap(send16noshadow_xpm));
{
wxMessageBox(strError + " ", _("Sending..."));
EndModal(false);
+ return;
}
}
}
CRITICAL_BLOCK(cs_mapAddressBook)
{
string strDefaultReceiving = (string)pframeMain->m_textCtrlAddress->GetValue();
- foreach(const PAIRTYPE(string, string)& item, mapAddressBook)
+ BOOST_FOREACH(const PAIRTYPE(string, string)& item, mapAddressBook)
{
string strAddress = item.first;
string strName = item.second;
enum
{
ID_TASKBAR_RESTORE = 10001,
+ ID_TASKBAR_SEND,
ID_TASKBAR_OPTIONS,
ID_TASKBAR_GENERATE,
ID_TASKBAR_EXIT,
BEGIN_EVENT_TABLE(CMyTaskBarIcon, wxTaskBarIcon)
EVT_TASKBAR_LEFT_DCLICK(CMyTaskBarIcon::OnLeftButtonDClick)
EVT_MENU(ID_TASKBAR_RESTORE, CMyTaskBarIcon::OnMenuRestore)
+ EVT_MENU(ID_TASKBAR_SEND, CMyTaskBarIcon::OnMenuSend)
EVT_MENU(ID_TASKBAR_OPTIONS, CMyTaskBarIcon::OnMenuOptions)
- EVT_MENU(ID_TASKBAR_GENERATE, CMyTaskBarIcon::OnMenuGenerate)
EVT_UPDATE_UI(ID_TASKBAR_GENERATE, CMyTaskBarIcon::OnUpdateUIGenerate)
EVT_MENU(ID_TASKBAR_EXIT, CMyTaskBarIcon::OnMenuExit)
END_EVENT_TABLE()
Restore();
}
+void CMyTaskBarIcon::OnMenuSend(wxCommandEvent& event)
+{
+ // Taskbar: Send
+ CSendDialog dialog(pframeMain);
+ dialog.ShowModal();
+}
+
void CMyTaskBarIcon::OnMenuOptions(wxCommandEvent& event)
{
// Since it's modal, get the main window to do it
pframeMain->Raise();
}
-void CMyTaskBarIcon::OnMenuGenerate(wxCommandEvent& event)
-{
- GenerateBitcoins(event.IsChecked());
-}
-
void CMyTaskBarIcon::OnUpdateUIGenerate(wxUpdateUIEvent& event)
{
event.Check(fGenerateBitcoins);
{
wxMenu* pmenu = new wxMenu;
pmenu->Append(ID_TASKBAR_RESTORE, _("&Open Bitcoin"));
+ pmenu->Append(ID_TASKBAR_SEND, _("&Send Bitcoins"));
pmenu->Append(ID_TASKBAR_OPTIONS, _("O&ptions..."));
- pmenu->AppendCheckItem(ID_TASKBAR_GENERATE, _("&Generate Coins"))->Check(fGenerateBitcoins);
#ifndef __WXMAC_OSX__ // Mac has built-in quit menu
pmenu->AppendSeparator();
pmenu->Append(ID_TASKBAR_EXIT, _("E&xit"));
extern int g_isPainting;
g_isPainting = 10000;
#endif
-#ifdef GUI
- wxImage::AddHandler(new wxPNGHandler);
-#endif
#if defined(__WXMSW__ ) || defined(__WXMAC_OSX__)
SetAppName("Bitcoin");
#else