mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-24 00:55:00 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb420a1dfc | ||
|
|
0184604aaf | ||
|
|
75199de534 | ||
|
|
c6ab3cf6d9 |
@@ -70,7 +70,7 @@ ldconfig
|
||||
Boost
|
||||
-----
|
||||
If you want to build Boost yourself,
|
||||
cd /usr/local/boost_1_42_0
|
||||
cd /usr/local/boost_1_38_0
|
||||
su
|
||||
./bootstrap.sh
|
||||
./bjam install
|
||||
|
||||
2
db.cpp
2
db.cpp
@@ -599,7 +599,6 @@ bool CWalletDB::LoadWallet(vector<unsigned char>& vchDefaultKeyRet)
|
||||
ssKey >> strKey;
|
||||
|
||||
// Menu state
|
||||
if (strKey == "fShowGenerated") ssValue >> fShowGenerated;
|
||||
if (strKey == "fGenerateBitcoins") ssValue >> fGenerateBitcoins;
|
||||
|
||||
// Options
|
||||
@@ -618,7 +617,6 @@ bool CWalletDB::LoadWallet(vector<unsigned char>& vchDefaultKeyRet)
|
||||
}
|
||||
|
||||
printf("nFileVersion = %d\n", nFileVersion);
|
||||
printf("fShowGenerated = %d\n", fShowGenerated);
|
||||
printf("fGenerateBitcoins = %d\n", fGenerateBitcoins);
|
||||
printf("nTransactionFee = %"PRI64d"\n", nTransactionFee);
|
||||
printf("addrIncoming = %s\n", addrIncoming.ToString().c_str());
|
||||
|
||||
131
main.cpp
131
main.cpp
@@ -1315,11 +1315,10 @@ bool CBlock::AcceptBlock()
|
||||
if (nTime <= pindexPrev->GetMedianTimePast())
|
||||
return error("AcceptBlock() : block's timestamp is too early");
|
||||
|
||||
// Check that all transactions are finalized (starting around Mar 2010)
|
||||
if (nBestHeight > 36000)
|
||||
foreach(const CTransaction& tx, vtx)
|
||||
if (!tx.IsFinal(nTime))
|
||||
return error("AcceptBlock() : contains a non-final transaction");
|
||||
// Check that all transactions are finalized
|
||||
foreach(const CTransaction& tx, vtx)
|
||||
if (!tx.IsFinal(nTime))
|
||||
return error("AcceptBlock() : contains a non-final transaction");
|
||||
|
||||
// Check proof of work
|
||||
if (nBits != GetNextWorkRequired(pindexPrev))
|
||||
@@ -1335,7 +1334,9 @@ bool CBlock::AcceptBlock()
|
||||
if (!AddToBlockIndex(nFile, nBlockPos))
|
||||
return error("AcceptBlock() : AddToBlockIndex failed");
|
||||
|
||||
if (hashBestChain == hash && nBestHeight > 28000)
|
||||
// Don't relay old inventory during initial block download.
|
||||
// Please keep this number updated to a few thousand below current block count.
|
||||
if (hashBestChain == hash && nBestHeight > 40000)
|
||||
RelayInventory(CInv(MSG_BLOCK, hash));
|
||||
|
||||
// // Add atoms to user reviews for coins created
|
||||
@@ -1554,8 +1555,8 @@ bool LoadBlockIndex(bool fAllowNew)
|
||||
CTransaction txNew;
|
||||
txNew.vin.resize(1);
|
||||
txNew.vout.resize(1);
|
||||
txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
|
||||
txNew.vout[0].nValue = 50 * COIN;
|
||||
txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
|
||||
txNew.vout[0].nValue = 50 * COIN;
|
||||
CBigNum bnPubKey;
|
||||
bnPubKey.SetHex("0x5F1DF16B2B704C8A578D0BBAF74D385CDE12C11EE50455F3C438EF4C3FBCF649B6DE611FEAE06279A60939E028A8D65C10B73071A6F16719274855FEB0FD8A6704");
|
||||
txNew.vout[0].scriptPubKey = CScript() << bnPubKey << OP_CHECKSIG;
|
||||
@@ -2645,7 +2646,12 @@ void BitcoinMiner()
|
||||
do
|
||||
{
|
||||
pindexTmp = pindexBest;
|
||||
Sleep(10000);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
Sleep(1000);
|
||||
if (fShutdown)
|
||||
return;
|
||||
}
|
||||
}
|
||||
while (pindexTmp != pindexBest);
|
||||
}
|
||||
@@ -2852,10 +2858,13 @@ bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CK
|
||||
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 +2903,50 @@ bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, CK
|
||||
}
|
||||
|
||||
// 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 +2955,7 @@ bool CommitTransactionSpent(const CWalletTx& wtxNew, const CKey& key)
|
||||
|
||||
|
||||
|
||||
string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew)
|
||||
string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew, bool fAskFee)
|
||||
{
|
||||
CRITICAL_BLOCK(cs_main)
|
||||
{
|
||||
@@ -2954,26 +2971,12 @@ string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew)
|
||||
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;
|
||||
if (fAskFee && !ThreadSafeAskFee(nFeeRequired, _("Sending..."), NULL))
|
||||
return "ABORTED";
|
||||
|
||||
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 (!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 +2984,7 @@ string SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew)
|
||||
|
||||
|
||||
|
||||
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 +2997,5 @@ string SendMoneyToBitcoinAddress(string strAddress, int64 nValue, CWalletTx& wtx
|
||||
if (!scriptPubKey.SetBitcoinAddress(strAddress))
|
||||
return _("Invalid bitcoin address");
|
||||
|
||||
return SendMoney(scriptPubKey, nValue, wtxNew);
|
||||
return SendMoney(scriptPubKey, nValue, wtxNew, fAskFee);
|
||||
}
|
||||
|
||||
11
main.h
11
main.h
@@ -67,9 +67,10 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv);
|
||||
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();
|
||||
@@ -1383,6 +1384,9 @@ public:
|
||||
CPrivKey vchPrivKey;
|
||||
int64 nTimeCreated;
|
||||
int64 nTimeExpires;
|
||||
string strComment;
|
||||
//// todo: add something to note what created it (user, getnewaddress, change)
|
||||
//// maybe should have a map<string, string> property map
|
||||
|
||||
CWalletKey(int64 nTimeExpiresIn=0)
|
||||
{
|
||||
@@ -1397,6 +1401,7 @@ public:
|
||||
READWRITE(vchPrivKey);
|
||||
READWRITE(nTimeCreated);
|
||||
READWRITE(nTimeExpires);
|
||||
READWRITE(strComment);
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
136
rpc.cpp
136
rpc.cpp
@@ -66,6 +66,17 @@ Value getblocknumber(const Array& params)
|
||||
}
|
||||
|
||||
|
||||
Value getconnectioncount(const Array& params)
|
||||
{
|
||||
if (params.size() != 0)
|
||||
throw runtime_error(
|
||||
"getconnectioncount (no parameters)\n"
|
||||
"Returns the number of connections to other nodes.");
|
||||
|
||||
return (int)vNodes.size();
|
||||
}
|
||||
|
||||
|
||||
Value getdifficulty(const Array& params)
|
||||
{
|
||||
if (params.size() != 0)
|
||||
@@ -85,6 +96,71 @@ Value getdifficulty(const Array& params)
|
||||
}
|
||||
|
||||
|
||||
Value getbalance(const Array& params)
|
||||
{
|
||||
if (params.size() != 0)
|
||||
throw runtime_error(
|
||||
"getbalance (no parameters)\n"
|
||||
"Returns the server's available balance.");
|
||||
|
||||
return ((double)GetBalance() / (double)COIN);
|
||||
}
|
||||
|
||||
|
||||
Value getgenerate(const Array& params)
|
||||
{
|
||||
if (params.size() != 0)
|
||||
throw runtime_error(
|
||||
"getgenerate (no parameters)\n"
|
||||
"Returns true or false.");
|
||||
|
||||
return (bool)fGenerateBitcoins;
|
||||
}
|
||||
|
||||
|
||||
Value setgenerate(const Array& params)
|
||||
{
|
||||
if (params.size() < 1 || params.size() > 2)
|
||||
throw runtime_error(
|
||||
"setgenerate <generate> [genproclimit]\n"
|
||||
"<generate> is true or false to turn generation on or off.\n"
|
||||
"Generation is limited to [genproclimit] processors, -1 is unlimited.");
|
||||
|
||||
bool fGenerate = true;
|
||||
if (params.size() > 0)
|
||||
fGenerate = params[0].get_bool();
|
||||
|
||||
if (params.size() > 1)
|
||||
{
|
||||
int nGenProcLimit = params[1].get_int();
|
||||
fLimitProcessors = (nGenProcLimit != -1);
|
||||
CWalletDB().WriteSetting("fLimitProcessors", fLimitProcessors);
|
||||
if (nGenProcLimit != -1)
|
||||
CWalletDB().WriteSetting("nLimitProcessors", nLimitProcessors = nGenProcLimit);
|
||||
}
|
||||
|
||||
GenerateBitcoins(fGenerate);
|
||||
return Value::null;
|
||||
}
|
||||
|
||||
|
||||
Value getinfo(const Array& params)
|
||||
{
|
||||
if (params.size() != 0)
|
||||
throw runtime_error(
|
||||
"getinfo (no parameters)");
|
||||
|
||||
Object obj;
|
||||
obj.push_back(Pair("balance", (double)GetBalance() / (double)COIN));
|
||||
obj.push_back(Pair("blocks", (int)nBestHeight + 1));
|
||||
obj.push_back(Pair("connections", (int)vNodes.size()));
|
||||
obj.push_back(Pair("proxy", (fUseProxy ? addrProxy.ToStringIPPort() : string())));
|
||||
obj.push_back(Pair("generate", (bool)fGenerateBitcoins));
|
||||
obj.push_back(Pair("genproclimit", (int)(fLimitProcessors ? nLimitProcessors : -1)));
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
Value getnewaddress(const Array& params)
|
||||
{
|
||||
if (params.size() > 1)
|
||||
@@ -102,8 +178,7 @@ Value getnewaddress(const Array& params)
|
||||
// Generate a new key that is added to wallet
|
||||
string strAddress = PubKeyToAddress(GenerateNewKey());
|
||||
|
||||
if (params.size() > 0)
|
||||
SetAddressBookName(strAddress, strLabel);
|
||||
SetAddressBookName(strAddress, strLabel);
|
||||
return strAddress;
|
||||
}
|
||||
|
||||
@@ -214,10 +289,10 @@ Value getallreceived(const Array& params)
|
||||
"getallreceived [minconf=1]\n"
|
||||
"[minconf] is the minimum number of confirmations before payments are included.\n"
|
||||
"Returns an array of objects containing:\n"
|
||||
" \"address\" : bitcoin address\n"
|
||||
" \"address\" : receiving address\n"
|
||||
" \"amount\" : total amount received by the address\n"
|
||||
" \"conf\" : number of confirmations\n"
|
||||
" \"label\" : the label set for this address when it was created by getnewaddress");
|
||||
" \"confirmations\" : number of confirmations of the most recent transaction included\n"
|
||||
" \"label\" : the label of the receiving address");
|
||||
|
||||
// Minimum confirmations
|
||||
int nMinDepth = 1;
|
||||
@@ -235,18 +310,26 @@ Value getallreceived(const Array& params)
|
||||
continue;
|
||||
|
||||
int nDepth = wtx.GetDepthInMainChain();
|
||||
if (nDepth >= nMinDepth)
|
||||
{
|
||||
foreach(const CTxOut& txout, wtx.vout)
|
||||
{
|
||||
uint160 hash160 = txout.scriptPubKey.GetBitcoinAddressHash160();
|
||||
if (hash160 == 0 || !mapPubKeys.count(hash160))
|
||||
continue;
|
||||
if (nDepth < nMinDepth)
|
||||
continue;
|
||||
|
||||
tallyitem& item = mapTally[hash160];
|
||||
item.nAmount += txout.nValue;
|
||||
item.nConf = min(item.nConf, nDepth);
|
||||
}
|
||||
// Filter out debits and payments to self, which may have change return
|
||||
// we don't want to count.
|
||||
int64 nCredit = wtx.GetCredit(true);
|
||||
int64 nDebit = wtx.GetDebit();
|
||||
int64 nNet = nCredit - nDebit;
|
||||
if (nNet <= 0)
|
||||
continue;
|
||||
|
||||
foreach(const CTxOut& txout, wtx.vout)
|
||||
{
|
||||
uint160 hash160 = txout.scriptPubKey.GetBitcoinAddressHash160();
|
||||
if (hash160 == 0 || !mapPubKeys.count(hash160))
|
||||
continue;
|
||||
|
||||
tallyitem& item = mapTally[hash160];
|
||||
item.nAmount += txout.nValue;
|
||||
item.nConf = min(item.nConf, nDepth);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -264,10 +347,10 @@ Value getallreceived(const Array& params)
|
||||
strLabel = (*mi).second;
|
||||
|
||||
Object obj;
|
||||
obj.push_back(Pair("address", strAddress));
|
||||
obj.push_back(Pair("amount", (double)(*it).second.nAmount / (double)COIN));
|
||||
obj.push_back(Pair("conf", (*it).second.nConf));
|
||||
obj.push_back(Pair("label", strLabel));
|
||||
obj.push_back(Pair("address", strAddress));
|
||||
obj.push_back(Pair("amount", (double)(*it).second.nAmount / (double)COIN));
|
||||
obj.push_back(Pair("confirmations", (*it).second.nConf));
|
||||
obj.push_back(Pair("label", strLabel));
|
||||
ret.push_back(obj);
|
||||
}
|
||||
}
|
||||
@@ -290,7 +373,12 @@ pair<string, rpcfn_type> pCallTable[] =
|
||||
make_pair("stop", &stop),
|
||||
make_pair("getblockcount", &getblockcount),
|
||||
make_pair("getblocknumber", &getblocknumber),
|
||||
make_pair("getconnectioncount", &getconnectioncount),
|
||||
make_pair("getdifficulty", &getdifficulty),
|
||||
make_pair("getbalance", &getbalance),
|
||||
make_pair("getgenerate", &getgenerate),
|
||||
make_pair("setgenerate", &setgenerate),
|
||||
make_pair("getinfo", &getinfo),
|
||||
make_pair("getnewaddress", &getnewaddress),
|
||||
make_pair("sendtoaddress", &sendtoaddress),
|
||||
make_pair("listtransactions", &listtransactions),
|
||||
@@ -568,9 +656,13 @@ int CommandLineRPC(int argc, char *argv[])
|
||||
Array params;
|
||||
for (int i = 2; i < argc; i++)
|
||||
params.push_back(argv[i]);
|
||||
|
||||
// Special case other types
|
||||
int n = params.size();
|
||||
|
||||
//
|
||||
// Special case other types
|
||||
//
|
||||
if (strMethod == "setgenerate" && n > 0) ConvertTo<bool>(params[0]);
|
||||
if (strMethod == "setgenerate" && n > 1) ConvertTo<boost::int64_t>(params[1]);
|
||||
if (strMethod == "sendtoaddress" && n > 1) ConvertTo<double>(params[1]);
|
||||
if (strMethod == "listtransactions" && n > 0) ConvertTo<boost::int64_t>(params[0]);
|
||||
if (strMethod == "listtransactions" && n > 1) ConvertTo<bool>(params[1]);
|
||||
|
||||
5
script.h
5
script.h
@@ -580,6 +580,11 @@ public:
|
||||
*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();
|
||||
|
||||
@@ -19,7 +19,7 @@ class CScript;
|
||||
class CDataStream;
|
||||
class CAutoFile;
|
||||
|
||||
static const int VERSION = 202;
|
||||
static const int VERSION = 206;
|
||||
static const char* pszSubVer = ".0";
|
||||
|
||||
|
||||
|
||||
78
ui.h
78
ui.h
@@ -2,15 +2,12 @@
|
||||
// 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)
|
||||
|
||||
|
||||
extern map<string, string> mapArgs;
|
||||
|
||||
// Settings
|
||||
extern int fShowGenerated;
|
||||
extern int fMinimizeToTray;
|
||||
extern int fMinimizeOnClose;
|
||||
|
||||
@@ -22,6 +19,7 @@ void UIThreadCall(boost::function0<void>);
|
||||
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);
|
||||
|
||||
|
||||
|
||||
@@ -32,6 +30,7 @@ class CMainFrame : public CMainFrameBase
|
||||
{
|
||||
protected:
|
||||
// Event handlers
|
||||
void OnNotebookPageChanged(wxNotebookEvent& event);
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnIconize(wxIconizeEvent& event);
|
||||
void OnMouseEvents(wxMouseEvent& event);
|
||||
@@ -40,8 +39,6 @@ protected:
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnPaintListCtrl(wxPaintEvent& event);
|
||||
void OnMenuFileExit(wxCommandEvent& event);
|
||||
void OnMenuViewShowGenerated(wxCommandEvent& event);
|
||||
void OnUpdateUIViewShowGenerated(wxUpdateUIEvent& event);
|
||||
void OnMenuOptionsGenerate(wxCommandEvent& event);
|
||||
void OnUpdateUIOptionsGenerate(wxUpdateUIEvent& event);
|
||||
void OnMenuOptionsChangeYourAddress(wxCommandEvent& event);
|
||||
@@ -51,7 +48,7 @@ protected:
|
||||
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);
|
||||
@@ -65,6 +62,18 @@ public:
|
||||
~CMainFrame();
|
||||
|
||||
// Custom
|
||||
enum
|
||||
{
|
||||
ALL = 0,
|
||||
SENTRECEIVED = 1,
|
||||
SENT = 2,
|
||||
RECEIVED = 3,
|
||||
};
|
||||
int nPage;
|
||||
wxListCtrl* m_listCtrl;
|
||||
bool fShowGenerated;
|
||||
bool fShowSent;
|
||||
bool fShowReceived;
|
||||
bool fRefreshListCtrl;
|
||||
bool fRefreshListCtrlRunning;
|
||||
bool fOnSetFocusAddress;
|
||||
@@ -205,53 +214,39 @@ void SendingDialogOnReply3(void* parg, CDataStream& vRecv);
|
||||
|
||||
|
||||
|
||||
class CYourAddressDialog : public CYourAddressDialogBase
|
||||
{
|
||||
protected:
|
||||
// Event handlers
|
||||
void OnListEndLabelEdit(wxListEvent& event);
|
||||
void OnListItemSelected(wxListEvent& event);
|
||||
void OnListItemActivated(wxListEvent& event);
|
||||
void OnButtonRename(wxCommandEvent& event);
|
||||
void OnButtonNew(wxCommandEvent& event);
|
||||
void OnButtonCopy(wxCommandEvent& event);
|
||||
void OnButtonOK(wxCommandEvent& event);
|
||||
void OnButtonCancel(wxCommandEvent& event);
|
||||
void OnClose(wxCloseEvent& event);
|
||||
|
||||
public:
|
||||
/** Constructor */
|
||||
CYourAddressDialog(wxWindow* parent);
|
||||
CYourAddressDialog(wxWindow* parent, const string& strInitSelected);
|
||||
|
||||
// Custom
|
||||
wxString GetAddress();
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CAddressBookDialog : public CAddressBookDialogBase
|
||||
{
|
||||
protected:
|
||||
// Event handlers
|
||||
void OnNotebookPageChanged(wxNotebookEvent& event);
|
||||
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 OnButtonEdit(wxCommandEvent& event);
|
||||
void OnButtonNew(wxCommandEvent& event);
|
||||
void OnButtonOK(wxCommandEvent& event);
|
||||
void OnButtonCancel(wxCommandEvent& event);
|
||||
void OnClose(wxCloseEvent& event);
|
||||
|
||||
public:
|
||||
/** Constructor */
|
||||
CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, bool fSendingIn);
|
||||
CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, int nPageIn, bool fDuringSendIn);
|
||||
|
||||
// Custom
|
||||
bool fSending;
|
||||
enum
|
||||
{
|
||||
SENDING = 0,
|
||||
RECEIVING = 1,
|
||||
};
|
||||
int nPage;
|
||||
wxListCtrl* m_listCtrl;
|
||||
bool fDuringSend;
|
||||
wxString GetAddress();
|
||||
wxString GetSelectedAddress();
|
||||
wxString GetSelectedSendingAddress();
|
||||
wxString GetSelectedReceivingAddress();
|
||||
bool CheckIfMine(const string& strAddress, const string& strTitle);
|
||||
};
|
||||
|
||||
@@ -282,18 +277,25 @@ public:
|
||||
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
|
||||
|
||||
192
uibase.cpp
192
uibase.cpp
@@ -29,27 +29,20 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString&
|
||||
|
||||
m_menubar->Append( m_menuFile, _("&File") );
|
||||
|
||||
m_menuView = new wxMenu();
|
||||
wxMenuItem* m_menuViewShowGenerated;
|
||||
m_menuViewShowGenerated = new wxMenuItem( m_menuView, wxID_VIEWSHOWGENERATED, wxString( _("&Show Generated Coins") ) , wxEmptyString, wxITEM_CHECK );
|
||||
m_menuView->Append( m_menuViewShowGenerated );
|
||||
|
||||
m_menubar->Append( m_menuView, _("&View") );
|
||||
|
||||
m_menuOptions = new wxMenu();
|
||||
wxMenuItem* m_menuOptionsGenerateBitcoins;
|
||||
m_menuOptionsGenerateBitcoins = new wxMenuItem( m_menuOptions, wxID_OPTIONSGENERATEBITCOINS, wxString( _("&Generate Coins") ) , wxEmptyString, wxITEM_CHECK );
|
||||
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 +58,8 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString&
|
||||
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 +79,10 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString&
|
||||
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 );
|
||||
@@ -139,8 +128,53 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString&
|
||||
|
||||
bSizer2->Add( bSizer3, 0, wxEXPAND, 5 );
|
||||
|
||||
m_listCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING|wxVSCROLL );
|
||||
bSizer2->Add( m_listCtrl, 1, wxEXPAND, 5 );
|
||||
m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_panel9 = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizer11;
|
||||
bSizer11 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_listCtrlAll = new wxListCtrl( m_panel9, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING|wxVSCROLL );
|
||||
bSizer11->Add( m_listCtrlAll, 1, wxEXPAND, 5 );
|
||||
|
||||
m_panel9->SetSizer( bSizer11 );
|
||||
m_panel9->Layout();
|
||||
bSizer11->Fit( m_panel9 );
|
||||
m_notebook->AddPage( m_panel9, _("All Transactions"), true );
|
||||
m_panel91 = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizer111;
|
||||
bSizer111 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_listCtrlSentReceived = new wxListCtrl( m_panel91, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING|wxVSCROLL );
|
||||
bSizer111->Add( m_listCtrlSentReceived, 1, wxEXPAND, 5 );
|
||||
|
||||
m_panel91->SetSizer( bSizer111 );
|
||||
m_panel91->Layout();
|
||||
bSizer111->Fit( m_panel91 );
|
||||
m_notebook->AddPage( m_panel91, _("Sent/Received"), false );
|
||||
m_panel92 = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizer112;
|
||||
bSizer112 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_listCtrlSent = new wxListCtrl( m_panel92, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING|wxVSCROLL );
|
||||
bSizer112->Add( m_listCtrlSent, 1, wxEXPAND, 5 );
|
||||
|
||||
m_panel92->SetSizer( bSizer112 );
|
||||
m_panel92->Layout();
|
||||
bSizer112->Fit( m_panel92 );
|
||||
m_notebook->AddPage( m_panel92, _("Sent"), false );
|
||||
m_panel93 = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizer113;
|
||||
bSizer113 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_listCtrlReceived = new wxListCtrl( m_panel93, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SORT_DESCENDING|wxVSCROLL );
|
||||
bSizer113->Add( m_listCtrlReceived, 1, wxEXPAND, 5 );
|
||||
|
||||
m_panel93->SetSizer( bSizer113 );
|
||||
m_panel93->Layout();
|
||||
bSizer113->Fit( m_panel93 );
|
||||
m_notebook->AddPage( m_panel93, _("Received"), false );
|
||||
|
||||
bSizer2->Add( m_notebook, 1, wxEXPAND, 5 );
|
||||
|
||||
this->SetSizer( bSizer2 );
|
||||
this->Layout();
|
||||
@@ -164,8 +198,6 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString&
|
||||
this->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
|
||||
this->Connect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaint ) );
|
||||
this->Connect( m_menuFileExit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuFileExit ) );
|
||||
this->Connect( m_menuViewShowGenerated->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuViewShowGenerated ) );
|
||||
this->Connect( m_menuViewShowGenerated->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler( CMainFrameBase::OnUpdateUIViewShowGenerated ) );
|
||||
this->Connect( m_menuOptionsGenerateBitcoins->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuOptionsGenerate ) );
|
||||
this->Connect( m_menuOptionsGenerateBitcoins->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler( CMainFrameBase::OnUpdateUIOptionsGenerate ) );
|
||||
this->Connect( m_menuOptionsChangeYourAddress->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuOptionsChangeYourAddress ) );
|
||||
@@ -188,11 +220,21 @@ CMainFrameBase::CMainFrameBase( wxWindow* parent, wxWindowID id, const wxString&
|
||||
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 );
|
||||
m_listCtrl->Connect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaintListCtrl ), NULL, this );
|
||||
m_notebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( CMainFrameBase::OnNotebookPageChanged ), NULL, this );
|
||||
m_listCtrlAll->Connect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this );
|
||||
m_listCtrlAll->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this );
|
||||
m_listCtrlAll->Connect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaintListCtrl ), NULL, this );
|
||||
m_listCtrlSentReceived->Connect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this );
|
||||
m_listCtrlSentReceived->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this );
|
||||
m_listCtrlSentReceived->Connect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaintListCtrl ), NULL, this );
|
||||
m_listCtrlSent->Connect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this );
|
||||
m_listCtrlSent->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this );
|
||||
m_listCtrlSent->Connect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaintListCtrl ), NULL, this );
|
||||
m_listCtrlReceived->Connect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this );
|
||||
m_listCtrlReceived->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this );
|
||||
m_listCtrlReceived->Connect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaintListCtrl ), NULL, this );
|
||||
}
|
||||
|
||||
CMainFrameBase::~CMainFrameBase()
|
||||
@@ -216,8 +258,6 @@ CMainFrameBase::~CMainFrameBase()
|
||||
this->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( CMainFrameBase::OnMouseEvents ) );
|
||||
this->Disconnect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaint ) );
|
||||
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuFileExit ) );
|
||||
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuViewShowGenerated ) );
|
||||
this->Disconnect( wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler( CMainFrameBase::OnUpdateUIViewShowGenerated ) );
|
||||
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuOptionsGenerate ) );
|
||||
this->Disconnect( wxID_ANY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler( CMainFrameBase::OnUpdateUIOptionsGenerate ) );
|
||||
this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( CMainFrameBase::OnMenuOptionsChangeYourAddress ) );
|
||||
@@ -240,11 +280,21 @@ CMainFrameBase::~CMainFrameBase()
|
||||
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 );
|
||||
m_listCtrl->Disconnect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaintListCtrl ), NULL, this );
|
||||
m_notebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( CMainFrameBase::OnNotebookPageChanged ), NULL, this );
|
||||
m_listCtrlAll->Disconnect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this );
|
||||
m_listCtrlAll->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this );
|
||||
m_listCtrlAll->Disconnect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaintListCtrl ), NULL, this );
|
||||
m_listCtrlSentReceived->Disconnect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this );
|
||||
m_listCtrlSentReceived->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this );
|
||||
m_listCtrlSentReceived->Disconnect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaintListCtrl ), NULL, this );
|
||||
m_listCtrlSent->Disconnect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this );
|
||||
m_listCtrlSent->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this );
|
||||
m_listCtrlSent->Disconnect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaintListCtrl ), NULL, this );
|
||||
m_listCtrlReceived->Disconnect( wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, wxListEventHandler( CMainFrameBase::OnListColBeginDrag ), NULL, this );
|
||||
m_listCtrlReceived->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( CMainFrameBase::OnListItemActivated ), NULL, this );
|
||||
m_listCtrlReceived->Disconnect( wxEVT_PAINT, wxPaintEventHandler( CMainFrameBase::OnPaintListCtrl ), NULL, this );
|
||||
}
|
||||
|
||||
CTxDetailsDialogBase::CTxDetailsDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
@@ -844,20 +894,53 @@ CAddressBookDialogBase::CAddressBookDialogBase( wxWindow* parent, wxWindowID id,
|
||||
{
|
||||
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 +948,42 @@ CAddressBookDialogBase::CAddressBookDialogBase( wxWindow* parent, wxWindowID id,
|
||||
|
||||
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 +992,17 @@ CAddressBookDialogBase::~CAddressBookDialogBase()
|
||||
{
|
||||
// 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 );
|
||||
}
|
||||
|
||||
85
uibase.h
85
uibase.h
@@ -28,6 +28,7 @@
|
||||
#include <wx/panel.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/frame.h>
|
||||
#include <wx/html/htmlwin.h>
|
||||
#include <wx/dialog.h>
|
||||
@@ -40,28 +41,30 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define wxID_MAINFRAME 1000
|
||||
#define wxID_VIEWSHOWGENERATED 1001
|
||||
#define wxID_OPTIONSGENERATEBITCOINS 1002
|
||||
#define wxID_MENUOPTIONSOPTIONS 1003
|
||||
#define wxID_BUTTONSEND 1004
|
||||
#define wxID_BUTTONRECEIVE 1005
|
||||
#define wxID_TEXTCTRLADDRESS 1006
|
||||
#define wxID_BUTTONCHANGE 1007
|
||||
#define wxID_BUTTONCOPY 1008
|
||||
#define wxID_TRANSACTIONFEE 1009
|
||||
#define wxID_PROXYIP 1010
|
||||
#define wxID_PROXYPORT 1011
|
||||
#define wxID_TEXTCTRLPAYTO 1012
|
||||
#define wxID_BUTTONPASTE 1013
|
||||
#define wxID_BUTTONADDRESSBOOK 1014
|
||||
#define wxID_TEXTCTRLAMOUNT 1015
|
||||
#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_OPTIONSGENERATEBITCOINS 1001
|
||||
#define wxID_MENUOPTIONSOPTIONS 1002
|
||||
#define wxID_BUTTONSEND 1003
|
||||
#define wxID_BUTTONRECEIVE 1004
|
||||
#define wxID_TEXTCTRLADDRESS 1005
|
||||
#define wxID_BUTTONNEW 1006
|
||||
#define wxID_BUTTONCOPY 1007
|
||||
#define wxID_TRANSACTIONFEE 1008
|
||||
#define wxID_PROXYIP 1009
|
||||
#define wxID_PROXYPORT 1010
|
||||
#define wxID_TEXTCTRLPAYTO 1011
|
||||
#define wxID_BUTTONPASTE 1012
|
||||
#define wxID_BUTTONADDRESSBOOK 1013
|
||||
#define wxID_TEXTCTRLAMOUNT 1014
|
||||
#define wxID_CHOICETRANSFERTYPE 1015
|
||||
#define wxID_LISTCTRL 1016
|
||||
#define wxID_BUTTONRENAME 1017
|
||||
#define wxID_PANELSENDING 1018
|
||||
#define wxID_LISTCTRLSENDING 1019
|
||||
#define wxID_PANELRECEIVING 1020
|
||||
#define wxID_LISTCTRLRECEIVING 1021
|
||||
#define wxID_BUTTONDELETE 1022
|
||||
#define wxID_BUTTONEDIT 1023
|
||||
#define wxID_TEXTCTRL 1024
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class CMainFrameBase
|
||||
@@ -73,13 +76,11 @@ class CMainFrameBase : public wxFrame
|
||||
protected:
|
||||
wxMenuBar* m_menubar;
|
||||
wxMenu* m_menuFile;
|
||||
wxMenu* m_menuView;
|
||||
wxMenu* m_menuHelp;
|
||||
wxToolBar* m_toolBar;
|
||||
wxStatusBar* m_statusBar;
|
||||
|
||||
wxStaticText* m_staticText32;
|
||||
wxTextCtrl* m_textCtrlAddress;
|
||||
wxButton* m_buttonNew;
|
||||
wxButton* m_buttonCopy;
|
||||
|
||||
@@ -88,6 +89,11 @@ class CMainFrameBase : public wxFrame
|
||||
wxStaticText* m_staticTextBalance;
|
||||
|
||||
wxChoice* m_choiceFilter;
|
||||
wxNotebook* m_notebook;
|
||||
wxPanel* m_panel9;
|
||||
wxPanel* m_panel91;
|
||||
wxPanel* m_panel92;
|
||||
wxPanel* m_panel93;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnClose( wxCloseEvent& event ){ event.Skip(); }
|
||||
@@ -96,8 +102,6 @@ class CMainFrameBase : public wxFrame
|
||||
virtual void OnMouseEvents( wxMouseEvent& event ){ event.Skip(); }
|
||||
virtual void OnPaint( wxPaintEvent& event ){ event.Skip(); }
|
||||
virtual void OnMenuFileExit( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnMenuViewShowGenerated( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnUpdateUIViewShowGenerated( wxUpdateUIEvent& event ){ event.Skip(); }
|
||||
virtual void OnMenuOptionsGenerate( wxCommandEvent& event ){ event.Skip(); }
|
||||
virtual void OnUpdateUIOptionsGenerate( wxUpdateUIEvent& event ){ event.Skip(); }
|
||||
virtual void OnMenuOptionsChangeYourAddress( wxCommandEvent& event ){ event.Skip(); }
|
||||
@@ -108,8 +112,9 @@ class CMainFrameBase : public wxFrame
|
||||
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 OnNotebookPageChanged( wxNotebookEvent& event ){ event.Skip(); }
|
||||
virtual void OnListColBeginDrag( wxListEvent& event ){ event.Skip(); }
|
||||
virtual void OnListItemActivated( wxListEvent& event ){ event.Skip(); }
|
||||
virtual void OnPaintListCtrl( wxPaintEvent& event ){ event.Skip(); }
|
||||
@@ -117,8 +122,12 @@ class CMainFrameBase : public wxFrame
|
||||
|
||||
public:
|
||||
wxMenu* m_menuOptions;
|
||||
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 );
|
||||
wxTextCtrl* m_textCtrlAddress;
|
||||
wxListCtrl* m_listCtrlAll;
|
||||
wxListCtrl* m_listCtrlSentReceived;
|
||||
wxListCtrl* m_listCtrlSent;
|
||||
wxListCtrl* m_listCtrlReceived;
|
||||
CMainFrameBase( wxWindow* parent, wxWindowID id = wxID_MAINFRAME, const wxString& title = _("Bitcoin"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 723,484 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
|
||||
~CMainFrameBase();
|
||||
|
||||
};
|
||||
@@ -343,23 +352,33 @@ class CAddressBookDialogBase : public wxDialog
|
||||
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 +416,7 @@ class CGetTextFromUserDialogBase : public wxDialog
|
||||
|
||||
|
||||
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();
|
||||
|
||||
};
|
||||
|
||||
1213
uiproject.fbp
1213
uiproject.fbp
File diff suppressed because it is too large
Load Diff
37
util.cpp
37
util.cpp
@@ -13,6 +13,7 @@ bool fPrintToDebugger = false;
|
||||
char pszSetDataDir[MAX_PATH] = "";
|
||||
bool fShutdown = false;
|
||||
bool fDaemon = false;
|
||||
bool fCommandLine = false;
|
||||
|
||||
|
||||
|
||||
@@ -431,6 +432,39 @@ void ParseParameters(int argc, char* argv[])
|
||||
}
|
||||
|
||||
|
||||
const char* wxGetTranslation(const char* pszEnglish)
|
||||
{
|
||||
// Wrapper of wxGetTranslation returning the same const char* type as was passed in
|
||||
static CCriticalSection cs;
|
||||
CRITICAL_BLOCK(cs)
|
||||
{
|
||||
// Look in cache
|
||||
static map<string, char*> mapCache;
|
||||
map<string, char*>::iterator mi = mapCache.find(pszEnglish);
|
||||
if (mi != mapCache.end())
|
||||
return (*mi).second;
|
||||
|
||||
// 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. 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;
|
||||
return pszCached;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -467,7 +501,8 @@ void PrintException(std::exception* pex, const char* pszThread)
|
||||
char pszMessage[1000];
|
||||
FormatException(pszMessage, pex, pszThread);
|
||||
printf("\n\n************************\n%s\n", pszMessage);
|
||||
if (wxTheApp)
|
||||
fprintf(stderr, "\n\n************************\n%s\n", pszMessage);
|
||||
if (wxTheApp && !fDaemon)
|
||||
wxMessageBox(pszMessage, "Error", wxOK | wxICON_ERROR);
|
||||
throw;
|
||||
//DebugBreak();
|
||||
|
||||
10
util.h
10
util.h
@@ -121,6 +121,7 @@ extern bool fPrintToDebugger;
|
||||
extern char pszSetDataDir[MAX_PATH];
|
||||
extern bool fShutdown;
|
||||
extern bool fDaemon;
|
||||
extern bool fCommandLine;
|
||||
|
||||
void RandAddSeed();
|
||||
void RandAddSeedPerfmon();
|
||||
@@ -136,6 +137,7 @@ bool ParseMoney(const char* pszIn, int64& nRet);
|
||||
vector<unsigned char> ParseHex(const char* psz);
|
||||
vector<unsigned char> ParseHex(const std::string& str);
|
||||
void ParseParameters(int argc, char* argv[]);
|
||||
const char* wxGetTranslation(const char* psz);
|
||||
int GetFilesize(FILE* file);
|
||||
void GetDataDir(char* pszDirRet);
|
||||
string GetDataDir();
|
||||
@@ -340,11 +342,9 @@ void skipspaces(T& it)
|
||||
++it;
|
||||
}
|
||||
|
||||
inline const char* wxGetTranslation(const char* psz)
|
||||
{
|
||||
// Return translated UTF-8 const char*
|
||||
return wxGetTranslation(wxString(psz, wxConvUTF8)).utf8_str();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user