home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 March / PCpro_2005_03.ISO / files / systools / speedswitchxp / sswitchxp14.exe / Typical / SystemInfo.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2005-01-14  |  2.9 KB  |  119 lines

  1. /*
  2.    SpeedswitchXP V1.4
  3.    - Windows XP CPU Frequency Control for Notebooks -
  4.  
  5.    Copyright(c) 2002-2004 Christian Diefer
  6.  
  7.    This program is free software; you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License version 2 as 
  9.    published by the Free Software Foundation.
  10.    
  11.    This program is distributed in the hope that it will be useful,
  12.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.    GNU General Public License for more details.
  15.    
  16.    You should have received a copy of the GNU General Public License
  17.    along with this program; if not, write to the Free Software
  18.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20.  
  21. #include "stdafx.h"
  22. #include "SpeedswitchXP.h"
  23. #include "CPUData.h"
  24. #include "PowerCapabilities.h"
  25. #include "SystemInfo.h"
  26.  
  27. CCPUData cpuData;
  28. CPowerCapabilities powerCaps;
  29.  
  30. // CSystemInfo dialog
  31.  
  32. IMPLEMENT_DYNAMIC(CSystemInfo, CDialog)
  33. CSystemInfo::CSystemInfo(CWnd* pParent /*=NULL*/)
  34.     : CDialog(CSystemInfo::IDD, pParent)
  35. { }
  36.  
  37. CSystemInfo::~CSystemInfo()
  38. { }
  39.  
  40. void CSystemInfo::DoDataExchange(CDataExchange* pDX)
  41. {
  42.   CDialog::DoDataExchange(pDX);
  43.   DDX_Control(pDX, IDC_TAB3, tabCtrl);
  44.   DDX_Control(pDX, IDC_UPPERLEFT, m_cUpperLeft);
  45.   DDX_Control(pDX, IDC_LOWERRIGHT, m_cLowerRight);
  46. }
  47.  
  48.  
  49. BEGIN_MESSAGE_MAP(CSystemInfo, CDialog)
  50.   ON_NOTIFY(TCN_SELCHANGE, IDC_TAB3, OnTcnSelchangeTab3)
  51. END_MESSAGE_MAP()
  52.  
  53.  
  54. // CSystemInfo message handlers
  55.  
  56. BOOL CSystemInfo::OnInitDialog()
  57. {
  58.   CDialog::OnInitDialog();
  59.  
  60.     TC_ITEM TabCtrlItem;
  61.     TabCtrlItem.mask = TCIF_TEXT;
  62.     TabCtrlItem.pszText = "CPU Data";
  63.     tabCtrl.InsertItem( 0, &TabCtrlItem );
  64.     TabCtrlItem.pszText = "Power capabilities";
  65.     tabCtrl.InsertItem( 1, &TabCtrlItem );
  66.  
  67.   tabs[0] = &cpuData;
  68.   tabs[1] = &powerCaps;
  69.  
  70.   cpuData.Create( IDD_CPUDATA, this );
  71.   powerCaps.Create( IDD_POWERCAPS, this );
  72.  
  73.   cpuData.ShowWindow( SW_SHOW );
  74.   powerCaps.ShowWindow( SW_HIDE );
  75.  
  76.   // calculate overlay window position and size
  77.   RECT r1, r2;
  78.   m_cUpperLeft.GetWindowRect( &r1 );
  79.   ScreenToClient( &r1 );
  80.  
  81.   m_cLowerRight.GetWindowRect( &r2 );
  82.   ScreenToClient( &r2 );
  83.  
  84.   tabs[0]->SetWindowPos( &wndTop, r1.left, r1.top, r2.right-r1.left, r2.bottom-r1.top, SWP_SHOWWINDOW );
  85.  
  86.   for( int i=1; i<2; i++ )
  87.     tabs[i]->SetWindowPos( &wndTop, r1.left, r1.top, r2.right-r1.left, r2.bottom-r1.top, SWP_HIDEWINDOW );
  88.  
  89.   cpuData.UpdateData( FALSE );
  90.   powerCaps.UpdateData( FALSE );
  91.  
  92.   log( "OnInitDialog von Sysinfo zuende" );
  93.  
  94.   return TRUE;
  95. }
  96.  
  97. void CSystemInfo::OnTcnSelchangeTab3( NMHDR *pNMHDR, LRESULT *pResult )
  98. {
  99.   int i = tabCtrl.GetCurSel();
  100.  
  101.   for( int x=0; x<2; x++ )
  102.     tabs[x]->ShowWindow( x==i ? SW_SHOW : SW_HIDE );
  103.  
  104.   *pResult = 0;
  105. }
  106.  
  107. void CSystemInfo::OnOK()
  108. {
  109.   CDialog::OnOK();
  110. }
  111.  
  112. void CSystemInfo::setVars()
  113. {
  114.   cpuData.setVars();
  115.   powerCaps.setVars();
  116. }
  117.  
  118.  
  119.