@ -103,6 +103,16 @@ int InsertLine(wxListCtrl* listCtrl, void* pdata, const wxString& str0, const wx
return nIndex ;
return nIndex ;
}
}
void SetItemTextColour ( wxListCtrl * listCtrl , int nIndex , const wxColour & colour )
{
// Repaint on Windows is more flickery if the colour has ever been set,
// so don't want to set it unless it's different. Default colour has
// alpha 0 transparent, so our colours don't match using operator==.
wxColour c1 = listCtrl - > GetItemTextColour ( nIndex ) ;
if ( colour . Red ( ) ! = c1 . Red ( ) | | colour . Green ( ) ! = c1 . Green ( ) | | colour . Blue ( ) ! = c1 . Blue ( ) )
listCtrl - > SetItemTextColour ( nIndex , colour ) ;
}
void SetSelection ( wxListCtrl * listCtrl , int nIndex )
void SetSelection ( wxListCtrl * listCtrl , int nIndex )
{
{
int nSize = listCtrl - > GetItemCount ( ) ;
int nSize = listCtrl - > GetItemCount ( ) ;
@ -434,7 +444,7 @@ int CMainFrame::GetSortIndex(const string& strSort)
# endif
# endif
}
}
void CMainFrame : : InsertLine ( bool fNew , int nIndex , uint256 hashKey , string strSort , const wxString & str2 , const wxString & str3 , const wxString & str4 , const wxString & str5 , const wxString & str6 )
void CMainFrame : : InsertLine ( bool fNew , int nIndex , uint256 hashKey , string strSort , const wxColour & colour , const wx String & str2 , const wxString & str3 , const wxString & str4 , const wxString & str5 , const wxString & str6 )
{
{
strSort = " " + strSort ; // leading space to workaround wx2.9.0 ubuntu 9.10 bug
strSort = " " + strSort ; // leading space to workaround wx2.9.0 ubuntu 9.10 bug
long nData = * ( long * ) & hashKey ; // where first char of hidden column is displayed
long nData = * ( long * ) & hashKey ; // where first char of hidden column is displayed
@ -470,6 +480,7 @@ void CMainFrame::InsertLine(bool fNew, int nIndex, uint256 hashKey, string strSo
m_listCtrl - > SetItem ( nIndex , 5 , str5 ) ;
m_listCtrl - > SetItem ( nIndex , 5 , str5 ) ;
m_listCtrl - > SetItem ( nIndex , 6 , str6 ) ;
m_listCtrl - > SetItem ( nIndex , 6 , str6 ) ;
m_listCtrl - > SetItemData ( nIndex , nData ) ;
m_listCtrl - > SetItemData ( nIndex , nData ) ;
SetItemTextColour ( m_listCtrl , nIndex , colour ) ;
}
}
bool CMainFrame : : DeleteLine ( uint256 hashKey )
bool CMainFrame : : DeleteLine ( uint256 hashKey )
@ -489,9 +500,10 @@ bool CMainFrame::DeleteLine(uint256 hashKey)
return nIndex ! = - 1 ;
return nIndex ! = - 1 ;
}
}
string FormatTxStatus ( const CWalletTx & wtx )
string FormatTxStatus ( const CWalletTx & wtx , bool & fConfirmed )
{
{
// Status
// Status
fConfirmed = false ;
if ( ! wtx . IsFinal ( ) )
if ( ! wtx . IsFinal ( ) )
{
{
if ( wtx . nLockTime < 500000000 )
if ( wtx . nLockTime < 500000000 )
@ -502,6 +514,8 @@ string FormatTxStatus(const CWalletTx& wtx)
else
else
{
{
int nDepth = wtx . GetDepthInMainChain ( ) ;
int nDepth = wtx . GetDepthInMainChain ( ) ;
if ( nDepth > = 1 | | wtx . GetDebit ( ) > 0 )
fConfirmed = true ;
if ( GetAdjustedTime ( ) - wtx . nTimeReceived > 2 * 60 & & wtx . GetRequestCount ( ) = = 0 )
if ( GetAdjustedTime ( ) - wtx . nTimeReceived > 2 * 60 & & wtx . GetRequestCount ( ) = = 0 )
return strprintf ( _ ( " %d/offline? " ) , nDepth ) ;
return strprintf ( _ ( " %d/offline? " ) , nDepth ) ;
else if ( nDepth < 6 )
else if ( nDepth < 6 )
@ -511,6 +525,12 @@ string FormatTxStatus(const CWalletTx& wtx)
}
}
}
}
string FormatTxStatus ( const CWalletTx & wtx )
{
bool fConfirmed ;
return FormatTxStatus ( wtx , fConfirmed ) ;
}
string SingleLine ( const string & strIn )
string SingleLine ( const string & strIn )
{
{
string strOut ;
string strOut ;
@ -539,7 +559,10 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
int64 nDebit = wtx . GetDebit ( ) ;
int64 nDebit = wtx . GetDebit ( ) ;
int64 nNet = nCredit - nDebit ;
int64 nNet = nCredit - nDebit ;
uint256 hash = wtx . GetHash ( ) ;
uint256 hash = wtx . GetHash ( ) ;
string strStatus = FormatTxStatus ( wtx ) ;
bool fConfirmed ;
string strStatus = FormatTxStatus ( wtx , fConfirmed ) ;
wtx . fConfirmedDisplayed = fConfirmed ;
wxColour colour = ( fConfirmed ? wxColour ( 0 , 0 , 0 ) : wxColour ( 128 , 128 , 128 ) ) ;
map < string , string > mapValue = wtx . mapValue ;
map < string , string > mapValue = wtx . mapValue ;
wtx . nLinesDisplayed = 1 ;
wtx . nLinesDisplayed = 1 ;
nListViewUpdated + + ;
nListViewUpdated + + ;
@ -658,12 +681,16 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
}
}
}
}
InsertLine ( fNew , nIndex , hash , strSort ,
string strCredit = FormatMoney ( nNet , true ) ;
if ( ! fConfirmed )
strCredit = " [ " + strCredit + " ] " ;
InsertLine ( fNew , nIndex , hash , strSort , colour ,
strStatus ,
strStatus ,
nTime ? DateTimeStr ( nTime ) : " " ,
nTime ? DateTimeStr ( nTime ) : " " ,
SingleLine ( strDescription ) ,
SingleLine ( strDescription ) ,
" " ,
" " ,
FormatMoney ( nNet , true ) ) ;
strCredit ) ;
}
}
else
else
{
{
@ -679,7 +706,7 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
{
{
// Payment to self
// Payment to self
int64 nValue = wtx . vout [ 0 ] . nValue ;
int64 nValue = wtx . vout [ 0 ] . nValue ;
InsertLine ( fNew , nIndex , hash , strSort ,
InsertLine ( fNew , nIndex , hash , strSort , colour ,
strStatus ,
strStatus ,
nTime ? DateTimeStr ( nTime ) : " " ,
nTime ? DateTimeStr ( nTime ) : " " ,
_ ( " Payment to yourself " ) ,
_ ( " Payment to yourself " ) ,
@ -738,7 +765,7 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
nTxFee = 0 ;
nTxFee = 0 ;
}
}
InsertLine ( fNew , nIndex , hash , strprintf ( " %s-%d " , strSort . c_str ( ) , nOut ) ,
InsertLine ( fNew , nIndex , hash , strprintf ( " %s-%d " , strSort . c_str ( ) , nOut ) , colour ,
strStatus ,
strStatus ,
nTime ? DateTimeStr ( nTime ) : " " ,
nTime ? DateTimeStr ( nTime ) : " " ,
SingleLine ( strDescription ) ,
SingleLine ( strDescription ) ,
@ -758,7 +785,7 @@ bool CMainFrame::InsertTransaction(const CWalletTx& wtx, bool fNew, int nIndex)
foreach ( const CTxIn & txin , wtx . vin )
foreach ( const CTxIn & txin , wtx . vin )
fAllMine = fAllMine & & txin . IsMine ( ) ;
fAllMine = fAllMine & & txin . IsMine ( ) ;
InsertLine ( fNew , nIndex , hash , strSort ,
InsertLine ( fNew , nIndex , hash , strSort , colour ,
strStatus ,
strStatus ,
nTime ? DateTimeStr ( nTime ) : " " ,
nTime ? DateTimeStr ( nTime ) : " " ,
" " ,
" " ,
@ -885,13 +912,17 @@ void CMainFrame::RefreshStatusColumn()
continue ;
continue ;
}
}
CWalletTx & wtx = ( * mi ) . second ;
CWalletTx & wtx = ( * mi ) . second ;
if ( wtx . IsCoinBase ( ) | | wtx . GetTxTime ( ) ! = wtx . nTimeDisplayed )
bool fConfirmed ;
string strStatus = FormatTxStatus ( wtx , fConfirmed ) ;
if ( wtx . IsCoinBase ( ) | | wtx . GetTxTime ( ) ! = wtx . nTimeDisplayed | | fConfirmed ! = wtx . fConfirmedDisplayed )
{
{
if ( ! InsertTransaction ( wtx , false , nIndex ) )
if ( ! InsertTransaction ( wtx , false , nIndex ) )
m_listCtrl - > DeleteItem ( nIndex - - ) ;
m_listCtrl - > DeleteItem ( nIndex - - ) ;
}
}
else
else
m_listCtrl - > SetItem ( nIndex , 2 , FormatTxStatus ( wtx ) ) ;
{
m_listCtrl - > SetItem ( nIndex , 2 , strStatus ) ;
}
}
}
}
}
}
}
@ -1772,7 +1803,7 @@ void COptionsDialog::OnButtonApply(wxCommandEvent& event)
CAboutDialog : : CAboutDialog ( wxWindow * parent ) : CAboutDialogBase ( parent )
CAboutDialog : : CAboutDialog ( wxWindow * parent ) : CAboutDialogBase ( parent )
{
{
m_staticTextVersion - > SetLabel ( strprintf ( _ ( " version %d.%d.%d %s beta " ) , VERSION / 10000 , ( VERSION / 100 ) % 100 , VERSION % 100 , pszSubVer ) ) ;
m_staticTextVersion - > SetLabel ( strprintf ( _ ( " version %s %s beta " ) , FormatVersion ( VERSION ) . c_str ( ) , pszSubVer ) ) ;
// Change (c) into UTF-8 or ANSI copyright symbol
// Change (c) into UTF-8 or ANSI copyright symbol
wxString str = m_staticTextMain - > GetLabel ( ) ;
wxString str = m_staticTextMain - > GetLabel ( ) ;