void CPPgConnection::Localize(void) { if (m_hWnd) { SetWindowText(GetResString(IDS_PW_CONNECTION)); GetDlgItem(IDC_CAPACITIES_FRM)->SetWindowText(GetResString(IDS_PW_CON_CAPFRM)); GetDlgItem(IDC_DCAP_LBL)->SetWindowText(GetResString(IDS_PW_CON_DOWNLBL)); GetDlgItem(IDC_UCAP_LBL)->SetWindowText(GetResString(IDS_PW_CON_UPLBL)); GetDlgItem(IDC_LIMITS_FRM)->SetWindowText(GetResString(IDS_PW_CON_LIMITFRM)); GetDlgItem(IDC_DLIMIT_LBL)->SetWindowText(GetResString(IDS_PW_DOWNL)); GetDlgItem(IDC_ULIMIT_LBL)->SetWindowText(GetResString(IDS_PW_UPL)); GetDlgItem(IDC_CONNECTION_NETWORK)->SetWindowText(GetResString(IDS_NETWORK)); GetDlgItem(IDC_KBS2)->SetWindowText(GetResString(IDS_KBYTESPERSEC)); GetDlgItem(IDC_KBS3)->SetWindowText(GetResString(IDS_KBYTESPERSEC)); ShowLimitValues(); GetDlgItem(IDC_MAXCONN_FRM)->SetWindowText(GetResString(IDS_PW_CONLIMITS)); GetDlgItem(IDC_MAXCONLABEL)->SetWindowText(GetResString(IDS_PW_MAXC)); GetDlgItem(IDC_SHOWOVERHEAD)->SetWindowText(GetResString(IDS_SHOWOVERHEAD)); GetDlgItem(IDC_CLIENTPORT_FRM)->SetWindowText(GetResString(IDS_PW_CLIENTPORT)); GetDlgItem(IDC_MAXSRC_FRM)->SetWindowText(GetResString(IDS_PW_MAXSOURCES)); GetDlgItem(IDC_AUTOCONNECT)->SetWindowText(GetResString(IDS_PW_AUTOCON)); GetDlgItem(IDC_RECONN)->SetWindowText(GetResString(IDS_PW_RECON)); GetDlgItem(IDC_MAXSRCHARD_LBL)->SetWindowText(GetResString(IDS_HARDLIMIT)); GetDlgItem(IDC_WIZARD)->SetWindowText(GetResString(IDS_WIZARD)); GetDlgItem(IDC_UDPDISABLE)->SetWindowText(GetResString(IDS_UDPDISABLED)); GetDlgItem(IDC_OPENPORTS)->SetWindowText(GetResString(IDS_FO_PREFBUTTON)); SetDlgItemText(IDC_STARTTEST, GetResString(IDS_STARTTEST) ); GetDlgItem(IDC_PREF_UPNPONSTART)->SetWindowText(GetResString(IDS_UPNPSTART)); } }
void CPPgConnection::OnLimiterChange() { m_ctlMaxDown.ShowWindow(IsDlgButtonChecked(IDC_DLIMIT_LBL) ? SW_SHOW : SW_HIDE); m_ctlMaxUp.ShowWindow(IsDlgButtonChecked(IDC_ULIMIT_LBL) ? SW_SHOW : SW_HIDE); ShowLimitValues(); SetModified(TRUE); }
void CPPgConnection::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { SetModified(TRUE); if (pScrollBar->GetSafeHwnd() == m_ctlMaxUp.m_hWnd) { uint32 maxup = m_ctlMaxUp.GetPos(); uint32 maxdown = m_ctlMaxDown.GetPos(); if (maxup < 4 && maxup*3 < maxdown) { m_ctlMaxDown.SetPos(maxup*3); } if (maxup < 10 && maxup*4 < maxdown) { m_ctlMaxDown.SetPos(maxup*4); } } else if (pScrollBar->GetSafeHwnd() == m_ctlMaxDown.m_hWnd) { uint32 maxup = m_ctlMaxUp.GetPos(); uint32 maxdown = m_ctlMaxDown.GetPos(); if (maxdown < 13 && maxup*3 < maxdown) { m_ctlMaxUp.SetPos((int)ceil((double)maxdown/3)); } if (maxdown < 41 && maxup*4 < maxdown) { m_ctlMaxUp.SetPos((int)ceil((double)maxdown/4)); } } ShowLimitValues(); UpdateData(false); CPropertyPage::OnHScroll(nSBCode, nPos, pScrollBar); }
void CPPgConnection::LoadSettings(void) { if (m_hWnd) { if (thePrefs.maxupload != 0) thePrefs.maxdownload = thePrefs.GetMaxDownload(); CString strBuffer; strBuffer.Format(_T("%d"), thePrefs.udpport); GetDlgItem(IDC_UDPPORT)->SetWindowText(strBuffer); CheckDlgButton(IDC_UDPDISABLE, (thePrefs.udpport == 0)); GetDlgItem(IDC_UDPPORT)->EnableWindow(thePrefs.udpport > 0); strBuffer.Format(_T("%d"), thePrefs.maxGraphDownloadRate); GetDlgItem(IDC_DOWNLOAD_CAP)->SetWindowText(strBuffer); m_ctlMaxDown.SetRange(1, thePrefs.maxGraphDownloadRate); SetRateSliderTicks(m_ctlMaxDown); if (thePrefs.maxGraphUploadRate != UNLIMITED) strBuffer.Format(_T("%d"), thePrefs.maxGraphUploadRate); else strBuffer = _T("0"); GetDlgItem(IDC_UPLOAD_CAP)->SetWindowText(strBuffer); m_ctlMaxUp.SetRange(1, thePrefs.GetMaxGraphUploadRate(true)); SetRateSliderTicks(m_ctlMaxUp); CheckDlgButton( IDC_DLIMIT_LBL, (thePrefs.maxdownload != UNLIMITED)); CheckDlgButton( IDC_ULIMIT_LBL, (thePrefs.maxupload != UNLIMITED)); m_ctlMaxDown.SetPos((thePrefs.maxdownload != UNLIMITED) ? thePrefs.maxdownload : thePrefs.maxGraphDownloadRate); m_ctlMaxUp.SetPos((thePrefs.maxupload != UNLIMITED) ? thePrefs.maxupload : thePrefs.GetMaxGraphUploadRate(true)); strBuffer.Format(_T("%d"), thePrefs.port); GetDlgItem(IDC_PORT)->SetWindowText(strBuffer); strBuffer.Format(_T("%d"), thePrefs.maxconnections); GetDlgItem(IDC_MAXCON)->SetWindowText(strBuffer); if (thePrefs.maxsourceperfile == 0xFFFF) GetDlgItem(IDC_MAXSOURCEPERFILE)->SetWindowText(_T("0")); else{ strBuffer.Format(_T("%d"), thePrefs.maxsourceperfile); GetDlgItem(IDC_MAXSOURCEPERFILE)->SetWindowText(strBuffer); } if (thePrefs.reconnect) CheckDlgButton(IDC_RECONN, 1); else CheckDlgButton(IDC_RECONN, 0); if (thePrefs.m_bshowoverhead) CheckDlgButton(IDC_SHOWOVERHEAD, 1); else CheckDlgButton(IDC_SHOWOVERHEAD, 0); if (thePrefs.autoconnect) CheckDlgButton(IDC_AUTOCONNECT, 1); else CheckDlgButton(IDC_AUTOCONNECT, 0); if (thePrefs.GetNetworkKademlia()) CheckDlgButton(IDC_NETWORK_KADEMLIA, 1); else CheckDlgButton(IDC_NETWORK_KADEMLIA, 0); GetDlgItem(IDC_NETWORK_KADEMLIA)->EnableWindow(thePrefs.GetUDPPort() > 0); if (thePrefs.networked2k) CheckDlgButton(IDC_NETWORK_ED2K, 1); else CheckDlgButton(IDC_NETWORK_ED2K, 0); // don't try on XP SP2 or higher, not needed there anymore if (thePrefs.GetWindowsVersion() == _WINVER_XP_ && IsRunningXPSP2() == 0 && theApp.m_pFirewallOpener->DoesFWConnectionExist()) GetDlgItem(IDC_OPENPORTS)->ShowWindow(SW_SHOW); else GetDlgItem(IDC_OPENPORTS)->ShowWindow(SW_HIDE); if (thePrefs.GetWindowsVersion() != _WINVER_95_ && thePrefs.GetWindowsVersion() != _WINVER_98_ && thePrefs.GetWindowsVersion() != _WINVER_NT4_) GetDlgItem(IDC_PREF_UPNPONSTART)->EnableWindow(true); else GetDlgItem(IDC_PREF_UPNPONSTART)->EnableWindow(false); if (thePrefs.IsUPnPEnabled()) CheckDlgButton(IDC_PREF_UPNPONSTART, 1); else CheckDlgButton(IDC_PREF_UPNPONSTART, 0); ShowLimitValues(); OnLimiterChange(); } }
void CPPgConnection::LoadSettings(void) { if (m_hWnd) { if (thePrefs.maxupload != 0) thePrefs.maxdownload = thePrefs.GetMaxDownload(); CString strBuffer; strBuffer.Format(_T("%d"), thePrefs.udpport); GetDlgItem(IDC_UDPPORT)->SetWindowText(strBuffer); CheckDlgButton(IDC_UDPDISABLE, (thePrefs.udpport == 0)); GetDlgItem(IDC_UDPPORT)->EnableWindow(thePrefs.udpport > 0); strBuffer.Format(_T("%d"), thePrefs.maxGraphDownloadRate); GetDlgItem(IDC_DOWNLOAD_CAP)->SetWindowText(strBuffer); m_ctlMaxDown.SetRange(1, thePrefs.maxGraphDownloadRate); SetRateSliderTicks(m_ctlMaxDown); strBuffer.Format(_T("%d"), thePrefs.maxGraphUploadRate); GetDlgItem(IDC_UPLOAD_CAP)->SetWindowText(strBuffer); m_ctlMaxUp.SetRange(1, thePrefs.maxGraphUploadRate); SetRateSliderTicks(m_ctlMaxUp); CheckDlgButton( IDC_DLIMIT_LBL, (thePrefs.maxdownload != UNLIMITED)); CheckDlgButton( IDC_ULIMIT_LBL, (thePrefs.maxupload != UNLIMITED)); m_ctlMaxDown.SetPos((thePrefs.maxdownload != UNLIMITED) ? thePrefs.maxdownload : thePrefs.maxGraphDownloadRate); m_ctlMaxUp.SetPos((thePrefs.maxupload != UNLIMITED) ? thePrefs.maxupload : thePrefs.maxGraphUploadRate); strBuffer.Format(_T("%d"), thePrefs.port); GetDlgItem(IDC_PORT)->SetWindowText(strBuffer); strBuffer.Format(_T("%d"), thePrefs.maxconnections); GetDlgItem(IDC_MAXCON)->SetWindowText(strBuffer); if (thePrefs.maxsourceperfile == 0xFFFF) GetDlgItem(IDC_MAXSOURCEPERFILE)->SetWindowText(_T("0")); else{ strBuffer.Format(_T("%d"), thePrefs.maxsourceperfile); GetDlgItem(IDC_MAXSOURCEPERFILE)->SetWindowText(strBuffer); } if (thePrefs.reconnect) CheckDlgButton(IDC_RECONN, 1); else CheckDlgButton(IDC_RECONN, 0); if (thePrefs.m_bshowoverhead) CheckDlgButton(IDC_SHOWOVERHEAD, 1); else CheckDlgButton(IDC_SHOWOVERHEAD, 0); if (thePrefs.autoconnect) CheckDlgButton(IDC_AUTOCONNECT, 1); else CheckDlgButton(IDC_AUTOCONNECT, 0); if (thePrefs.networkkademlia) CheckDlgButton(IDC_NETWORK_KADEMLIA, 1); else CheckDlgButton(IDC_NETWORK_KADEMLIA, 0); if (thePrefs.networked2k) CheckDlgButton(IDC_NETWORK_ED2K, 1); else CheckDlgButton(IDC_NETWORK_ED2K, 0); if (theApp.m_pFirewallOpener->DoesFWConnectionExist()) GetDlgItem(IDC_OPENPORTS)->EnableWindow(true); else GetDlgItem(IDC_OPENPORTS)->EnableWindow(false); ShowLimitValues(); OnLimiterChange(); } }