]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - tools/src/tools/configtool/common/win32/Thermometer.cpp
Initial revision
[karo-tx-redboot.git] / tools / src / tools / configtool / common / win32 / Thermometer.cpp
1 //####COPYRIGHTBEGIN####
2 //                                                                          
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5 //
6 // This program is part of the eCos host tools.
7 //
8 // This program is free software; you can redistribute it and/or modify it 
9 // under the terms of the GNU General Public License as published by the Free 
10 // Software Foundation; either version 2 of the License, or (at your option) 
11 // any later version.
12 // 
13 // This program is distributed in the hope that it will be useful, but WITHOUT 
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
15 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
16 // more details.
17 // 
18 // You should have received a copy of the GNU General Public License along with
19 // this program; if not, write to the Free Software Foundation, Inc., 
20 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21 //
22 // ----------------------------------------------------------------------------
23 //                                                                          
24 //####COPYRIGHTEND####
25 // Thermometer.cpp: implementation of the CThermometer class.
26 //
27 //////////////////////////////////////////////////////////////////////
28
29 #include "stdafx.h"
30 #include "Thermometer.h"
31 #include "ConfigTool.h"
32
33 #ifdef PLUGIN
34   #define INCLUDEFILE "ide.common.h"
35   #include "IncludeSTL.h"
36   #include "common/StatusBar.h"
37 #else
38   #include "MainFrm.h"
39 #endif
40
41 #ifdef _DEBUG
42 #undef THIS_FILE
43 static char THIS_FILE[]=__FILE__;
44 #define new DEBUG_NEW
45 #endif
46
47 //////////////////////////////////////////////////////////////////////
48 // Construction/Destruction
49 //////////////////////////////////////////////////////////////////////
50
51 CThermometer::CThermometer(int nMax,LPCTSTR psz)
52 {
53     TRACE(_T("Create thermometer nMax=%d string='%s'\n"),nMax,psz?psz:_T("<null>"));
54     #ifdef PLUGIN
55 #ifndef _AFXEXT
56   AFX_MANAGE_STATE(CConfigTool::CallerModuleState);
57 #endif
58     AppInstance::getAppManager()->getStatusBar()->showProgressBar(psz?psz:_T(""), 0, nMax);
59     #else
60         if(CConfigTool::GetMain()){
61                 CConfigTool::GetMain()->SetThermometerMax(nMax);
62         if(psz){
63                 CConfigTool::GetMain()->SetIdleMessage(psz);
64         }
65     }
66     #endif
67 }
68
69 CThermometer::~CThermometer()
70 {
71     TRACE(_T("Destroy thermometer\n"));
72     #ifdef PLUGIN
73 #ifndef _AFXEXT
74   AFX_MANAGE_STATE(CConfigTool::CallerModuleState);
75 #endif
76     AppInstance::getAppManager()->getStatusBar()->hideProgressBar();
77     #else
78         if(CConfigTool::GetMain()){
79                 CConfigTool::GetMain()->SetThermometerMax(0);
80                 CConfigTool::GetMain()->SetIdleMessage(NULL);
81     }
82     #endif
83 }
84
85 void CThermometer::Set(int n)
86 {
87     #ifdef PLUGIN
88 #ifndef _AFXEXT
89   AFX_MANAGE_STATE(CConfigTool::CallerModuleState);
90 #endif
91     AppInstance::getAppManager()->getStatusBar()->updateProgressBar(n);
92     #else
93         if(CConfigTool::GetMain()){
94                 CConfigTool::GetMain()->UpdateThermometer(n);
95         }
96     #endif
97 }
98