00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "StdAfx.h"
00023 #include "Shareaza.h"
00024 #include "Settings.h"
00025 #include "LiveList.h"
00026 #include "PageSettingsTraffic.h"
00027 #include "Skin.h"
00028
00029 #ifdef _DEBUG
00030 #define new DEBUG_NEW
00031 #undef THIS_FILE
00032 static char THIS_FILE[] = __FILE__;
00033 #endif
00034
00035 IMPLEMENT_DYNCREATE(CAdvancedSettingsPage, CSettingsPage)
00036
00037 BEGIN_MESSAGE_MAP(CAdvancedSettingsPage, CSettingsPage)
00038
00039 ON_WM_DESTROY()
00040 ON_NOTIFY(LVN_ITEMCHANGED, IDC_PROPERTIES, OnItemChangedProperties)
00041 ON_EN_CHANGE(IDC_VALUE, OnChangeValue)
00042 ON_NOTIFY(LVN_COLUMNCLICK, IDC_PROPERTIES, OnColumnClickProperties)
00043
00044 END_MESSAGE_MAP()
00045
00046
00047
00049
00050
00051 CAdvancedSettingsPage::CAdvancedSettingsPage() : CSettingsPage(CAdvancedSettingsPage::IDD)
00052 {
00053
00054
00055 }
00056
00057 CAdvancedSettingsPage::~CAdvancedSettingsPage()
00058 {
00059 }
00060
00061 void CAdvancedSettingsPage::DoDataExchange(CDataExchange* pDX)
00062 {
00063 CSettingsPage::DoDataExchange(pDX);
00064
00065 DDX_Control(pDX, IDC_VALUE_SPIN, m_wndValueSpin);
00066 DDX_Control(pDX, IDC_VALUE, m_wndValue);
00067 DDX_Control(pDX, IDC_PROPERTIES, m_wndList);
00068
00069 }
00070
00072
00073
00074 BOOL CAdvancedSettingsPage::OnInitDialog()
00075 {
00076 CSettingsPage::OnInitDialog();
00077
00078 CRect rc;
00079 m_wndList.GetClientRect( &rc );
00080 rc.right -= GetSystemMetrics( SM_CXVSCROLL ) + 1;
00081
00082 m_wndList.InsertColumn( 0, _T("Setting"), LVCFMT_LEFT, rc.right - 80, 0 );
00083 m_wndList.InsertColumn( 1, _T("Value"), LVCFMT_LEFT, 80, 1 );
00084
00085 m_wndList.SendMessage( LVM_SETEXTENDEDLISTVIEWSTYLE,
00086 LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT );
00087
00088 AddSetting( &Settings.General.Debug, 1, 0, 1 );
00089 AddSetting( &Settings.General.DebugLog, 1, 0, 1 );
00090 AddSetting( &Settings.General.MaxDebugLogSize, 1024*1024, 0, 100, _T(" MB") );
00091 AddSetting( &Settings.General.UpdateCheck, 1, 0, 1 );
00092 AddSetting( &Settings.General.DiskSpaceWarning, 1, 5, 2000 , _T(" M") );
00093 AddSetting( &Settings.General.DiskSpaceStop, 1, 0, 1000 , _T(" M") );
00094 AddSetting( &Settings.General.HashIntegrity, 1, 0, 1 );
00095 AddSetting( &Settings.General.MinTransfersRest, 1, 1, 100, _T(" ms") );
00096
00097 AddSetting( &Settings.Community.ChatFilterED2K, 1, 0, 1 );
00098
00099 AddSetting( &Settings.Connection.IgnoreOwnIP, 1, 0, 1 );
00100 AddSetting( &Settings.Connection.SendBuffer, 1, 64, 10240 );
00101 AddSetting( &Settings.Connection.TimeoutTraffic, 1000, 10, 60*60, _T(" s") );
00102
00103 AddSetting( &Settings.Connection.RequireForTransfers, 1, 0, 1 );
00104 AddSetting( &Settings.Connection.ConnectThrottle, 1, 0, 500, _T(" ms") );
00105 AddSetting( &Settings.Connection.DetectConnectionLoss, 1, 0, 1 );
00106 AddSetting( &Settings.Connection.DetectConnectionReset, 1, 0, 1 );
00107 AddSetting( &Settings.Connection.ForceConnectedState, 1, 0, 1 );
00108 AddSetting( &Settings.Connection.SlowConnect, 1, 0, 1 );
00109
00110 AddSetting( &Settings.Gnutella.ConnectFactor, 1, 1, 20, _T("x") );
00111 AddSetting( &Settings.Gnutella.MaxResults, 1, 1, 1000 );
00112 AddSetting( &Settings.Gnutella.MaxHits, 1, 0, 4096 );
00113 AddSetting( &Settings.Gnutella.HitsPerPacket, 1, 0, 1024 );
00114 AddSetting( &Settings.Gnutella.RouteCache, 60, 1, 120, _T(" m") );
00115 AddSetting( &Settings.Gnutella.HostCacheSize, 1, 32, 16384 );
00116 AddSetting( &Settings.Gnutella.BlockBlankClients, 1, 0, 1 );
00117 AddSetting( &Settings.Gnutella.SpecifyProtocol, 1, 0, 1 );
00118
00119 AddSetting( &Settings.Gnutella1.PacketBufferSize, 1, 1, 1024 );
00120 AddSetting( &Settings.Gnutella1.PacketBufferTime, 1000, 10, 180, _T(" s") );
00121 AddSetting( &Settings.Gnutella1.DefaultTTL, 1, 1, 5 );
00122 AddSetting( &Settings.Gnutella1.SearchTTL, 1, 1, 4 );
00123 AddSetting( &Settings.Gnutella1.TranslateTTL, 1, 1, 2 );
00124 AddSetting( &Settings.Gnutella1.MaximumTTL, 1, 1, 10 );
00125 AddSetting( &Settings.Gnutella1.MaximumPacket, 1, 32, 262144 );
00126 AddSetting( &Settings.Gnutella1.MaximumQuery, 1, 32, 262144 );
00127 AddSetting( &Settings.Gnutella1.StrictPackets, 1, 0, 1 );
00128 AddSetting( &Settings.Gnutella1.EnableGGEP, 1, 0, 1 );
00129 AddSetting( &Settings.Gnutella1.VendorMsg, 1, 0, 1 );
00130 AddSetting( &Settings.Gnutella1.QueryThrottle, 60, 5, 2048, _T(" m") );
00131 AddSetting( &Settings.Gnutella1.RequeryDelay, 60, 45, 2048, _T(" m") );
00132 AddSetting( &Settings.Gnutella1.HostExpire, 24 * 60 * 60, 0, 100, _T(" d") );
00133 AddSetting( &Settings.Gnutella1.PingFlood, 1000, 0, 30, _T(" s") );
00134 AddSetting( &Settings.Gnutella1.PingRate, 1000, 5, 180, _T(" s") );
00135 AddSetting( &Settings.Gnutella1.PongCache, 1000, 1, 180, _T(" s") );
00136 AddSetting( &Settings.Gnutella1.PongCount, 1, 1, 64 );
00137 AddSetting( &Settings.Gnutella1.QuerySearchUTF8, 1, 0, 1 );
00138 AddSetting( &Settings.Gnutella1.QueryHitUTF8, 1, 0, 1 );
00139
00140 AddSetting( &Settings.Gnutella2.EnableAlways, 1, 0, 1 );
00141 AddSetting( &Settings.Gnutella2.PingRelayLimit, 1, 10, 30);
00142 AddSetting( &Settings.Gnutella2.UdpMTU, 1, 16, 10240 );
00143 AddSetting( &Settings.Gnutella2.UdpBuffers, 1, 16, 2048 );
00144 AddSetting( &Settings.Gnutella2.UdpInFrames, 1, 16, 2048 );
00145 AddSetting( &Settings.Gnutella2.UdpOutFrames, 1, 16, 2048 );
00146 AddSetting( &Settings.Gnutella2.UdpGlobalThrottle, 1, 0, 10000 );
00147 AddSetting( &Settings.Gnutella2.UdpOutExpire, 1000, 1, 300, _T(" s") );
00148 AddSetting( &Settings.Gnutella2.UdpOutResend, 1000, 1, 300, _T(" s") );
00149 AddSetting( &Settings.Gnutella2.UdpInExpire, 1000, 1, 300, _T(" s") );
00150 AddSetting( &Settings.Gnutella2.KHLPeriod, 1000, 1, 60 * 60, _T(" s") );
00151 AddSetting( &Settings.Gnutella2.KHLHubCount, 1, 1, 256 );
00152 AddSetting( &Settings.Gnutella2.HAWPeriod, 1000, 1, 60 * 60, _T(" s") );
00153 AddSetting( &Settings.Gnutella2.HostCurrent, 60, 1, 24*60, _T(" m") );
00154 AddSetting( &Settings.Gnutella2.HostExpire, 24 * 60 * 60, 0, 100, _T(" d") );
00155 AddSetting( &Settings.Gnutella2.QueryGlobalThrottle, 1, 1, 60*1000, _T(" ms") );
00156 AddSetting( &Settings.Gnutella2.QueryHostThrottle, 1, 1, 10*60, _T(" s") );
00157 AddSetting( &Settings.Gnutella2.QueryHostDeadline, 1, 1, 120*60, _T(" s") );
00158 AddSetting( &Settings.Gnutella2.RequeryDelay, 60*60, 1, 24, _T(" h") );
00159 AddSetting( &Settings.Gnutella2.HubHorizonSize, 1, 32, 512 );
00160 AddSetting( &Settings.Gnutella2.QueryLimit, 1, 0, 10000 );
00161
00162 AddSetting( &Settings.eDonkey.FastConnect, 1, 0, 1 );
00163 AddSetting( &Settings.eDonkey.MaxShareCount, 1, 0, 20000 );
00164 AddSetting( &Settings.eDonkey.StatsGlobalThrottle, 60*1000, 30, 120, _T(" m") );
00165 AddSetting( &Settings.eDonkey.QueryGlobalThrottle, 1, 1000, 20000, _T(" ms") );
00166 AddSetting( &Settings.eDonkey.StatsServerThrottle, 24*60*60, 7, 28, _T(" d") );
00167 AddSetting( &Settings.eDonkey.QueryServerThrottle, 60, 1, 300, _T(" m") );
00168 AddSetting( &Settings.eDonkey.QueryFileThrottle, 60*1000, 30, 120, _T(" m") );
00169 AddSetting( &Settings.eDonkey.GetSourcesThrottle, 60*60*1000, 1, 24, _T(" h") );
00170 AddSetting( &Settings.eDonkey.QueueRankThrottle, 1000, 60, 600, _T(" s") );
00171 AddSetting( &Settings.eDonkey.PacketThrottle, 1, 250, 5000, _T(" ms") );
00172 AddSetting( &Settings.eDonkey.SourceThrottle, 1, 250, 5000, _T(" ms") );
00173 AddSetting( &Settings.eDonkey.LearnNewServers, 1, 0, 1 );
00174 AddSetting( &Settings.eDonkey.LearnNewServersClient, 1, 0, 1 );
00175 AddSetting( &Settings.eDonkey.RequestPipe, 1, 1, 10 );
00176 AddSetting( &Settings.eDonkey.RequestSize, 1024, 10, 1000, _T(" KB") );
00177 AddSetting( &Settings.eDonkey.FrameSize, 1024, 1, 500, _T(" KB") );
00178 AddSetting( &Settings.eDonkey.ReAskTime, 60, 20, 360, _T(" m") );
00179 AddSetting( &Settings.eDonkey.DequeueTime, 60, 2, 512, _T(" m") );
00180 AddSetting( &Settings.eDonkey.ExtendedRequest, 1, 0, 1 );
00181 AddSetting( &Settings.eDonkey.MagnetSearch, 1, 0, 1 );
00182 AddSetting( &Settings.eDonkey.MinServerFileSize, 1, 0, 50, _T(" MB") );
00183 AddSetting( &Settings.eDonkey.TagNames, 1, 0, 1 );
00184 AddSetting( &Settings.eDonkey.Endgame, 1, 0, 1 );
00185
00186 AddSetting( &Settings.BitTorrent.DefaultTrackerPeriod, 60000, 5, 120, _T(" m") );
00187 AddSetting( &Settings.BitTorrent.MaxTrackerRetry, 1, 1, 8 );
00188 AddSetting( &Settings.BitTorrent.TorrentCodePage, 1, 0, 9999999 );
00189 AddSetting( &Settings.BitTorrent.TorrentExtraKeys, 1, 0, 1 );
00190 AddSetting( &Settings.BitTorrent.TorrentIgnoreErrors, 1, 0, 1 );
00191 AddSetting( &Settings.BitTorrent.LinkTimeout, 1000, 10, 60*10, _T(" s") );
00192 AddSetting( &Settings.BitTorrent.LinkPing, 1000, 10, 60*10, _T(" s") );
00193 AddSetting( &Settings.BitTorrent.RequestPipe, 1, 1, 10 );
00194 AddSetting( &Settings.BitTorrent.RequestSize, 1024, 8, 128, _T(" KB") );
00195 AddSetting( &Settings.BitTorrent.RequestLimit, 1024, 1, 1024, _T(" KB") );
00196 AddSetting( &Settings.BitTorrent.RandomPeriod, 1000, 1, 60*5, _T(" s") );
00197 AddSetting( &Settings.BitTorrent.SourceExchangePeriod, 1, 1, 60*5, _T(" m") );
00198 AddSetting( &Settings.BitTorrent.UploadCount, 1, 2, 16 );
00199 AddSetting( &Settings.BitTorrent.AutoSeed, 1, 0, 1 );
00200 AddSetting( &Settings.BitTorrent.BandwidthPercentage, 1, 50, 95, _T("%") );
00201 AddSetting( &Settings.BitTorrent.TrackerKey, 1, 0, 1 );
00202 AddSetting( &Settings.BitTorrent.StandardPeerID, 1, 0, 1 );
00203
00204 AddSetting( &Settings.Discovery.AccessThrottle, 60, 1, 180, _T(" m") );
00205 AddSetting( &Settings.Discovery.Lowpoint, 1, 1, 512 );
00206 AddSetting( &Settings.Discovery.FailureLimit, 1, 1, 512 );
00207 AddSetting( &Settings.Discovery.UpdatePeriod, 60, 1, 60 * 24, _T(" m") );
00208 AddSetting( &Settings.Discovery.DefaultUpdate, 60, 1, 60 * 24, _T(" m") );
00209 AddSetting( &Settings.Discovery.BootstrapCount, 1, 0, 20 );
00210 AddSetting( &Settings.Discovery.CacheCount, 1, 1, 256 );
00211
00212 AddSetting( &Settings.Search.HighlightNew, 1, 0, 1);
00213 AddSetting( &Settings.Search.SchemaTypes, 1, 0, 1 );
00214 AddSetting( &Settings.Search.ShowNames, 1, 0, 1 );
00215 AddSetting( &Settings.Search.MonitorQueue, 1, 1, 4096 );
00216 AddSetting( &Settings.Search.MaxPreviewLength, 1024, 1, 4096, _T(" KB") );
00217 AddSetting( &Settings.Search.AdvancedPanel, 1, 0, 1 );
00218 AddSetting( &Settings.Search.GeneralThrottle, 1, 200, 1000 );
00219
00220 AddSetting( &Settings.Downloads.BufferSize, 1024, 0, 512, _T(" KB") );
00221 AddSetting( &Settings.Downloads.SparseThreshold, 1024, 0, 256, _T(" MB") );
00222 AddSetting( &Settings.Downloads.MaxFileSearches, 1, 0, 5 );
00223 AddSetting( &Settings.Downloads.MaxConnectingSources, 1, 5, 50 );
00224 AddSetting( &Settings.Downloads.MinSources, 1, 0, 6 );
00225 AddSetting( &Settings.Downloads.ConnectThrottle, 1, 0, 5000, _T(" ms") );
00226 AddSetting( &Settings.Downloads.PushTimeout, 1000, 5, 180, _T(" s") );
00227 AddSetting( &Settings.Downloads.StarveTimeout, 60, 45, 1440, _T(" m") );
00228 AddSetting( &Settings.Downloads.StarveGiveUp, 1, 3, 120, _T(" h") );
00229 AddSetting( &Settings.Downloads.ChunkSize, 1024, 0, 10240, _T(" KB") );
00230 AddSetting( &Settings.Downloads.ChunkStrap, 1024, 0, 10240, _T(" KB") );
00231 AddSetting( &Settings.Downloads.AllowBackwards, 1, 0, 1 );
00232 AddSetting( &Settings.Downloads.NeverDrop, 1, 0, 1 );
00233 AddSetting( &Settings.Downloads.RequestHash, 1, 0, 1 );
00234 AddSetting( &Settings.Downloads.RequestHTTP11, 1, 0, 1 );
00235 AddSetting( &Settings.Downloads.RequestURLENC, 1, 0, 1 );
00236 AddSetting( &Settings.Downloads.SaveInterval, 1000, 1, 120, _T(" s") );
00237 AddSetting( &Settings.Downloads.FlushSD, 1, 0, 1 );
00238 AddSetting( &Settings.Downloads.ShowPercent, 1, 0, 1 );
00239 AddSetting( &Settings.Downloads.AutoClear, 1, 0, 1 );
00240 AddSetting( &Settings.Downloads.ClearDelay, 1000, 1, 1800, _T(" s") );
00241 AddSetting( &Settings.Downloads.RetryDelay, 1000, 120, 60*60, _T(" s") );
00242 AddSetting( &Settings.Downloads.SearchPeriod, 1000, 10, 4*60 );
00243 AddSetting( &Settings.Downloads.StaggardStart, 1, 0, 1 );
00244 AddSetting( &Settings.Downloads.VerifyFiles, 1, 0, 1 );
00245 AddSetting( &Settings.Downloads.VerifyTiger, 1, 0, 1 );
00246 AddSetting( &Settings.Downloads.Metadata, 1, 0, 1 );
00247 AddSetting( &Settings.Downloads.SortColumns, 1, 0, 1 );
00248 AddSetting( &Settings.Downloads.SortSources, 1, 0, 1 );
00249 AddSetting( &Settings.Downloads.MaxReviews, 1, 0, 256 );
00250
00251 AddSetting( &Settings.Uploads.FreeBandwidthValue, 128, 0, 4096, _T(" Kb/s") );
00252 AddSetting( &Settings.Uploads.FreeBandwidthFactor, 1, 0, 100, _T("%") );
00253 AddSetting( &Settings.Uploads.ClampdownFactor, 1, 0, 100, _T("%") );
00254 AddSetting( &Settings.Uploads.ClampdownFloor, 128, 0, 4096, _T(" Kb/s") );
00255 AddSetting( &Settings.Uploads.QueuePollMin, 1000, 0, 60, _T(" s") );
00256 AddSetting( &Settings.Uploads.QueuePollMax, 1000, 30, 180, _T(" s") );
00257 AddSetting( &Settings.Uploads.RotateChunkLimit, 1024, 0, 10240, _T(" KB") );
00258 AddSetting( &Settings.Uploads.AutoClear, 1, 0, 1 );
00259 AddSetting( &Settings.Uploads.ClearDelay, 1000, 1, 1800, _T(" s") );
00260 AddSetting( &Settings.Uploads.AllowBackwards, 1, 0, 1 );
00261 AddSetting( &Settings.Uploads.DynamicPreviews, 1, 0, 1 );
00262 AddSetting( &Settings.Uploads.PreviewQuality, 1, 0, 100, _T("%") );
00263 AddSetting( &Settings.Uploads.PreviewTransfers, 1, 1, 64 );
00264 AddSetting( &Settings.Uploads.RewardQueuePercentage, 1, 0, 99, _T("%") );
00265
00266 AddSetting( &Settings.Interface.LowResMode, 1, 0, 1 );
00267
00268 AddSetting( &Settings.Library.SourceExpire, 60, 60, 604800, _T(" m") );
00269 AddSetting( &Settings.Library.SourceMesh, 1, 0, 1);
00270 AddSetting( &Settings.Library.TigerHeight, 1, 1, 64 );
00271 AddSetting( &Settings.Library.QueryRouteSize, 1, 8, 24 );
00272 AddSetting( &Settings.Library.ThumbSize, 1, 16, 256 );
00273 AddSetting( &Settings.Library.VirtualFiles, 1, 0, 1);
00274 AddSetting( &Settings.Library.HashWindow, 1, 0, 1);
00275
00276 AddSetting( &Settings.Bandwidth.Request, 128, 0, 8192, _T(" Kb/s") );
00277 AddSetting( &Settings.Bandwidth.HubIn, 128, 0, 8192, _T(" Kb/s") );
00278 AddSetting( &Settings.Bandwidth.HubOut, 128, 0, 8192, _T(" Kb/s") );
00279 AddSetting( &Settings.Bandwidth.LeafIn, 128, 0, 8192, _T(" Kb/s") );
00280 AddSetting( &Settings.Bandwidth.LeafOut, 128, 0, 8192, _T(" Kb/s") );
00281 AddSetting( &Settings.Bandwidth.PeerIn, 128, 0, 8192, _T(" Kb/s") );
00282 AddSetting( &Settings.Bandwidth.PeerOut, 128, 0, 8192, _T(" Kb/s") );
00283 AddSetting( &Settings.Bandwidth.UdpOut, 128, 0, 8192, _T(" Kb/s") );
00284 AddSetting( &Settings.Bandwidth.HubUploads, 128, 0, 4096, _T(" Kb/s") );
00285
00286 CLiveList::Sort( &m_wndList, 0 );
00287 CLiveList::Sort( &m_wndList, 0 );
00288
00289 Skin.Translate( _T("CAdvancedSettingsList"), m_wndList.GetHeaderCtrl() );
00290 return TRUE;
00291 }
00292
00293 void CAdvancedSettingsPage::AddSetting(LPVOID pValue, DWORD nScale, DWORD nMin, DWORD nMax, LPCTSTR pszSuffix)
00294 {
00295 CSettings::Item* pItem = Settings.GetSetting( (DWORD*)pValue );
00296 if ( pItem == NULL ) return;
00297
00298 EditItem* pEdit = new EditItem( pItem, nScale, nMin, nMax, pszSuffix );
00299
00300 LV_ITEM pList;
00301
00302 ZeroMemory( &pList, sizeof(pList) );
00303
00304 pList.mask = LVIF_PARAM|LVIF_TEXT|LVIF_IMAGE;
00305 pList.iItem = m_wndList.GetItemCount();
00306 pList.lParam = (LPARAM)pEdit;
00307 pList.iImage = 0;
00308 pList.pszText = (LPTSTR)(LPCTSTR)pEdit->m_sName;
00309 pList.iItem = m_wndList.InsertItem( &pList );
00310
00311 UpdateItem( pList.iItem );
00312 }
00313
00314 void CAdvancedSettingsPage::UpdateItem(int nItem)
00315 {
00316 EditItem* pItem = (EditItem*)m_wndList.GetItemData( nItem );
00317 CString strValue;
00318
00319 if ( pItem->m_nMin == 0 && pItem->m_nMax == 1 )
00320 {
00321 strValue = pItem->m_nValue ? _T("True") : _T("False");
00322 }
00323 else
00324 {
00325 strValue.Format( _T("%lu"), pItem->m_nValue / pItem->m_nScale );
00326 if ( theApp.m_bRTL )
00327 strValue = _T("\x200E") + strValue + pItem->m_sSuffix;
00328 else
00329 strValue += pItem->m_sSuffix;
00330 }
00331
00332 m_wndList.SetItemText( nItem, 1, strValue );
00333 }
00334
00335 void CAdvancedSettingsPage::OnItemChangedProperties(NMHDR* pNMHDR, LRESULT* pResult)
00336 {
00337 NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
00338
00339 int nItem = m_wndList.GetNextItem( -1, LVNI_SELECTED );
00340
00341 if ( nItem >= 0 )
00342 {
00343 EditItem* pItem = (EditItem*)m_wndList.GetItemData( nItem );
00344 CString strValue;
00345
00346 m_wndValueSpin.SendMessage( WM_USER+111, pItem->m_nMin, pItem->m_nMax );
00347
00348 strValue.Format( _T("%lu"), pItem->m_nValue / pItem->m_nScale );
00349
00350 m_wndValue.SetWindowText( strValue );
00351 m_wndValue.EnableWindow( TRUE );
00352 m_wndValueSpin.EnableWindow( TRUE );
00353 }
00354 else
00355 {
00356 m_wndValue.SetWindowText( _T("") );
00357 m_wndValue.EnableWindow( FALSE );
00358 m_wndValueSpin.EnableWindow( FALSE );
00359 }
00360
00361 *pResult = 0;
00362 }
00363
00364 void CAdvancedSettingsPage::OnChangeValue()
00365 {
00366 if ( m_wndList.m_hWnd == NULL ) return;
00367
00368 int nItem = m_wndList.GetNextItem( -1, LVNI_SELECTED );
00369
00370 if ( nItem >= 0 )
00371 {
00372 EditItem* pItem = (EditItem*)m_wndList.GetItemData( nItem );
00373 CString strValue;
00374
00375 m_wndValue.GetWindowText( strValue );
00376
00377 if ( _stscanf( strValue, _T("%lu"), &pItem->m_nValue ) == 1 )
00378 {
00379 pItem->m_nValue = max( pItem->m_nMin, min( pItem->m_nMax, pItem->m_nValue ) );
00380 pItem->m_nValue *= pItem->m_nScale;
00381 UpdateItem( nItem );
00382 }
00383 }
00384 }
00385
00386 void CAdvancedSettingsPage::OnColumnClickProperties(NMHDR* pNMHDR, LRESULT* pResult)
00387 {
00388 NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
00389 CLiveList::Sort( &m_wndList, pNMListView->iSubItem );
00390 *pResult = 0;
00391 }
00392
00393 void CAdvancedSettingsPage::OnOK()
00394 {
00395 for ( int nItem = 0 ; nItem < m_wndList.GetItemCount() ; nItem++ )
00396 {
00397 EditItem* pItem = (EditItem*)m_wndList.GetItemData( nItem );
00398 pItem->Commit();
00399 }
00400
00401 CSettingsPage::OnOK();
00402 }
00403
00404 void CAdvancedSettingsPage::OnDestroy()
00405 {
00406 for ( int nItem = 0 ; nItem < m_wndList.GetItemCount() ; nItem++ )
00407 {
00408 delete (EditItem*)m_wndList.GetItemData( nItem );
00409 }
00410
00411 CSettingsPage::OnDestroy();
00412 }
00413
00414
00416
00417
00418 CAdvancedSettingsPage::EditItem::EditItem(CSettings::Item* pItem, DWORD nScale, DWORD nMin, DWORD nMax, LPCTSTR pszSuffix)
00419 {
00420 m_pItem = pItem;
00421 m_nValue = *pItem->m_pDword;
00422 m_sName = pItem->m_sName;
00423 m_nScale = nScale;
00424 m_nMin = nMin;
00425 m_nMax = nMax;
00426
00427 if ( m_sName.GetAt( 0 ) == '.' ) m_sName = _T("razacore") + m_sName;
00428
00429 if ( pszSuffix ) m_sSuffix = pszSuffix;
00430 }
00431
00432 CAdvancedSettingsPage::EditItem::~EditItem()
00433 {
00434 }
00435
00436 void CAdvancedSettingsPage::EditItem::Commit()
00437 {
00438 *(m_pItem->m_pDword) = m_nValue;
00439 }
00440