GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Env.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004 by Olivier Stezowski *
3  * agata(AT)ipnl.in2p3.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
23 #ifndef ROOT_TString
24 #include <TString.h>
25 #endif
26 
27 #ifndef GW_CONFIG_H
28 #include "GwConfig.h"
29 #endif
30 
31 #ifndef GW_ENV_H
32 #include "Env.h"
33 #endif
34 
35 #include "GwLogMessage.h"
36 
37 #include "TGClient.h"
38 #include "TGMimeTypes.h"
39 
41 
42 using namespace Gw;
43 
44 const char *Env::GetVersion()
45  { return GW_Version;}
46 
47 const char *Env::GetPath(const char *whichpath)
48 {
49  TString which = whichpath;
50 
51  if ( which.Contains("Version",TString::kIgnoreCase) ) {
52  return GW_Version;
53  }
54  if ( which.Contains("LibraryPath",TString::kIgnoreCase) ) {
55  return GW_LibraryPath;
56  }
57  if ( which.Contains("BinaryPath",TString::kIgnoreCase) ) {
58  return GW_BinaryPath;
59  }
60  if ( which.Contains("IncludePath",TString::kIgnoreCase) ) {
61  return GW_IncludePath;
62  }
63  if ( which.Contains("IconsPath",TString::kIgnoreCase) ) {
64  return GW_IconsPath;
65  }
66  if ( which.Contains("NdbPath",TString::kIgnoreCase) ) {
67  return GW_NdbPath;
68  }
69  if ( which.Contains("MacrosPath",TString::kIgnoreCase) ) {
70  return GW_MacrosPath;
71  }
72 
73  return "NOT_DEFINED";
74 }
75 
76 void Env::SetDebug(short debug)
77 {
78  LogMessage::SetDebug(debug);
79 }
80 
82 {
83  static Bool_t has_done = false; TGMimeTypes* mineTypes = gClient->GetMimeTypeList();
84 
85  if ( has_done == false ) {
86  char action[256] = {0}; Int_t added = 0;
87  if ( !mineTypes->GetAction("Gw::GCond1D",action) ) {
88  mineTypes->AddType("[gw/gwgcond1d]"," Gw::GCond1D", "selection_t.xpm", "selection_t.xpm", "->Draw()");
89  added++;
90  }
91  if ( !mineTypes->GetAction("Gw::GCond2D",action) ) {
92  mineTypes->AddType("[gw/gwgcond2d]"," Gw::GCond2D", "cut.xpm", "cut.xpm", "->Draw()");
93  added++;
94  }
95  if ( !mineTypes->GetAction("*.spe",action) ) {
96  mineTypes->AddType("[root/file]"," *.eg *.spe *.s", "hdb_s.xpm", "hdb_t.xpm", "Gw::HistoConverter::DrawSpectrum(\"%s\")");
97  added++;
98  }
99  if ( added > 0 ) {
100  has_done = true;
101  mineTypes->SaveMimes();
102  }
103  }
104 }
105 
106 
107 
ClassImp(Gw::Env)
static const char * GetVersion()
to get the current gammaware version
Definition: Env.cpp:44
Definition: Env.h:49
static void AddRMimeType()
check mime type and add those proper to gw
Definition: Env.cpp:81
to set informations about the gammaware configuration
#define GW_MacrosPath
Definition: GwConfig.h:42
#define GW_Version
Definition: GwConfig.h:36
#define GW_BinaryPath
Definition: GwConfig.h:38
#define GW_IncludePath
Definition: GwConfig.h:39
static void SetDebug(short global_debug_level=0)
header file for GwLogMessage.cpp
#define GW_LibraryPath
Definition: GwConfig.h:37
LogMessage & debug(LogMessage &)
static void SetDebug(short)
change the global level
Definition: Env.cpp:76
to get information about the gammaware configuration
static const char * GetPath(const char *)
to get a particular GW environment variable
Definition: Env.cpp:47
#define GW_NdbPath
Definition: GwConfig.h:41
#define GW_IconsPath
Definition: GwConfig.h:40