Merge pull request #226 from jordanlewis/betterheaders
[novacoin.git] / src / ui.cpp
index f24449c..0a7d455 100644 (file)
@@ -22,6 +22,13 @@ CMyTaskBarIcon* ptaskbaricon = NULL;
 bool fClosedToTray = false;
 wxLocale g_locale;
 
+#ifdef __WXMSW__
+double nScaleX = 1.0;
+double nScaleY = 1.0;
+#else
+static const double nScaleX = 1.0;
+static const double nScaleY = 1.0;
+#endif
 
 
 
@@ -267,9 +274,10 @@ CMainFrame::CMainFrame(wxWindow* parent) : CMainFrameBase(parent)
     fOnSetFocusAddress = false;
     fRefresh = false;
     m_choiceFilter->SetSelection(0);
-    double dResize = 1.0;
+    double dResize = nScaleX;
 #ifdef __WXMSW__
     SetIcon(wxICON(bitcoin));
+    SetSize(dResize * GetSize().GetWidth(), nScaleY * GetSize().GetHeight());
 #else
     SetIcon(bitcoin80_xpm);
     SetBackgroundColour(m_toolBar->GetBackgroundColour());
@@ -1223,6 +1231,9 @@ void CMainFrame::OnListItemActivated(wxListEvent& event)
 
 CTxDetailsDialog::CTxDetailsDialog(wxWindow* parent, CWalletTx wtx) : CTxDetailsDialogBase(parent)
 {
+#ifdef __WXMSW__
+    SetSize(nScaleX * GetSize().GetWidth(), nScaleY * GetSize().GetHeight());
+#endif
     CRITICAL_BLOCK(cs_mapAddressBook)
     {
         string strHTML;
@@ -1637,6 +1648,8 @@ COptionsDialog::COptionsDialog(wxWindow* parent) : COptionsDialogBase(parent)
     SelectPage(0);
 #ifndef __WXMSW__
     SetSize(1.0 * GetSize().GetWidth(), 1.2 * GetSize().GetHeight());
+#else
+    SetSize(nScaleX * GetSize().GetWidth(), nScaleY * GetSize().GetHeight());
 #endif
 #if defined(__WXGTK__) || defined(__WXMAC_OSX__)
     m_checkBoxStartOnSystemStartup->SetLabel(_("&Start Bitcoin on window system startup"));
@@ -1807,6 +1820,8 @@ CAboutDialog::CAboutDialog(wxWindow* parent) : CAboutDialogBase(parent)
         fontTmp.SetPointSize(8);
     m_staticTextMain->SetFont(fontTmp);
     SetSize(GetSize().GetWidth() + 44, GetSize().GetHeight() + 10);
+#else
+    SetSize(nScaleX * GetSize().GetWidth(), nScaleY * GetSize().GetHeight());
 #endif
 }
 
@@ -1841,12 +1856,21 @@ CSendDialog::CSendDialog(wxWindow* parent, const wxString& strAddress) : CSendDi
         fontTmp.SetPointSize(9);
     m_staticTextInstructions->SetFont(fontTmp);
     SetSize(725, 180);
+#else
+    SetSize(nScaleX * GetSize().GetWidth(), nScaleY * GetSize().GetHeight());
 #endif
     
     // Set Icon
-    wxIcon iconSend;
-    iconSend.CopyFromBitmap(wxBitmap(send16noshadow_xpm));
-    SetIcon(iconSend);
+    if (nScaleX == 1.0 && nScaleY == 1.0) // We don't have icons of the proper size otherwise
+    {
+        wxIcon iconSend;
+        iconSend.CopyFromBitmap(wxBitmap(send16noshadow_xpm));
+        SetIcon(iconSend);
+    }
+#ifdef __WXMSW__
+    else
+        SetIcon(wxICON(bitcoin));
+#endif
 
     // Fixup the tab order
     m_buttonPaste->MoveAfterInTabOrder(m_buttonCancel);
@@ -1996,6 +2020,8 @@ CSendingDialog::CSendingDialog(wxWindow* parent, const CAddress& addrIn, int64 n
     fWorkDone = false;
 #ifndef __WXMSW__
     SetSize(1.2 * GetSize().GetWidth(), 1.08 * GetSize().GetHeight());
+#else
+    SetSize(nScaleX * GetSize().GetWidth(), nScaleY * GetSize().GetHeight());
 #endif
 
     SetTitle(strprintf(_("Sending %s to %s"), FormatMoney(nPrice).c_str(), wtx.mapValue["to"].c_str()));
@@ -2319,6 +2345,10 @@ void CSendingDialog::OnReply3(CDataStream& vRecv)
 
 CAddressBookDialog::CAddressBookDialog(wxWindow* parent, const wxString& strInitSelected, int nPageIn, bool fDuringSendIn) : CAddressBookDialogBase(parent)
 {
+#ifdef __WXMSW__
+    SetSize(nScaleX * GetSize().GetWidth(), nScaleY * GetSize().GetHeight());
+#endif
+
     // Set initially selected page
     wxNotebookEvent event;
     event.SetSelection(nPageIn);
@@ -2330,9 +2360,16 @@ CAddressBookDialog::CAddressBookDialog(wxWindow* parent, const wxString& strInit
         m_buttonCancel->Show(false);
 
     // Set Icon
-    wxIcon iconAddressBook;
-    iconAddressBook.CopyFromBitmap(wxBitmap(addressbook16_xpm));
-    SetIcon(iconAddressBook);
+    if (nScaleX == 1.0 && nScaleY == 1.0) // We don't have icons of the proper size otherwise
+    {
+        wxIcon iconAddressBook;
+        iconAddressBook.CopyFromBitmap(wxBitmap(addressbook16_xpm));
+        SetIcon(iconAddressBook);
+    }
+#ifdef __WXMSW__
+    else
+        SetIcon(wxICON(bitcoin));
+#endif
 
     // Init column headers
     m_listCtrlSending->InsertColumn(0, _("Name"), wxLIST_FORMAT_LEFT, 200);
@@ -2848,6 +2885,16 @@ bool CMyApp::OnInit()
     g_locale.AddCatalog("wxstd"); // wxWidgets standard translations, if any
     g_locale.AddCatalog("bitcoin");
 
+#ifdef __WXMSW__
+    HDC hdc = GetDC(NULL);
+    if (hdc)
+    {
+        nScaleX = GetDeviceCaps(hdc, LOGPIXELSX) / 96.0;
+        nScaleY = GetDeviceCaps(hdc, LOGPIXELSY) / 96.0;
+        ReleaseDC(NULL, hdc);
+    }
+#endif
+
     return AppInit(argc, argv);
 }