CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CmsShowHelpPopup.cc
Go to the documentation of this file.
1 #include <stdexcept>
2 #include <cassert>
3 #include "TGClient.h"
4 #include "TGHtml.h"
5 #include "TGText.h"
6 #include "TSystem.h"
8 
10  const std::string &windowname,
11  const TGWindow* p, UInt_t w, UInt_t h)
12  : TGTransientFrame(gClient->GetDefaultRoot(), p, w, h),
13  m_helpHtml(new TGHtml(this, w, h))
14 {
15  AddFrame(m_helpHtml, new TGLayoutHints(kLHintsTop | kLHintsLeft |
16  kLHintsExpandX | kLHintsExpandY));
17  SetWindowName(windowname.c_str());
18  TGText text;
19  text.Load(helpFileName(filename).c_str());
20 
21  static TString path = Form("%s/src/Fireworks/Core/data/",gSystem->Getenv("CMSSW_BASE"));
22  if ( gSystem->AccessPathName(path.Data()) ){ // cannot find directory
23  assert(gSystem->Getenv("CMSSW_RELEASE_BASE"));
24  path = Form("%s/src/Fireworks/Core/data/",gSystem->Getenv("CMSSW_RELEASE_BASE"));
25  }
26  m_helpHtml->SetBaseUri(path.Data());
27  // printf("%s ... \n", m_helpHtml->GetBaseUri());
28 
29  m_helpHtml->ParseText((char *)text.AsString().Data());
30 
31  MapSubwindows();
32  m_helpHtml->Layout();
33 }
34 
36 {
37  delete m_helpHtml;
38 }
39 
40 std::string CmsShowHelpPopup::helpFileName (const std::string &filename)
41 {
42  const char* cmspath = gSystem->Getenv("CMSSW_BASE");
43  if(0 == cmspath) {
44  throw std::runtime_error("CMSSW_BASE environment variable not set");
45  }
46  return std::string(cmspath) + "/src/Fireworks/Core/data/" + filename;
47 }
int path() const
Definition: HLTadd.h:3
CmsShowHelpPopup(const std::string &filename, const std::string &windowname, const TGWindow *p=0, UInt_t w=1, UInt_t h=1)
tuple text
Definition: runonSM.py:42
static std::string helpFileName(const std::string &)
unsigned int UInt_t
Definition: FUTypes.h:12
tuple filename
Definition: lut2db_cfg.py:20
virtual ~CmsShowHelpPopup()
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4