#include <Fireworks/Core/interface/CmsShowSearchFiles.h>
Public Member Functions | |
std::string | chooseFileFromURL () |
This opens the dialog window and returns once the user has choosen, returns an empty string if canceled. | |
ClassDef (CmsShowSearchFiles, 0) | |
CmsShowSearchFiles (const char *filename, const char *windowname, const TGWindow *p=0, UInt_t w=1, UInt_t h=1) | |
void | fileEntryChanged (const char *) |
void | hyperlinkClicked (const char *) |
void | openClicked () |
void | prefixChoosen (Int_t) |
void | showPrefixes () |
void | updateBrowser () |
virtual | ~CmsShowSearchFiles () |
Private Member Functions | |
void | sendToWebBrowser (const char *iWebFile) |
Private Attributes | |
TGTextButton * | m_choosePrefix |
TGTextEntry * | m_file |
TGTextButton * | m_openButton |
bool | m_openCalled |
std::vector< bool > | m_prefixComplete |
std::vector< std::string > | m_prefixes |
TGPopupMenu * | m_prefixMenu |
FWHtml * | m_webFile |
Description: <one line="" class="" summary>="">
Usage: <usage>
Definition at line 36 of file CmsShowSearchFiles.h.
CmsShowSearchFiles::CmsShowSearchFiles | ( | const char * | filename, |
const char * | windowname, | ||
const TGWindow * | p = 0 , |
||
UInt_t | w = 1 , |
||
UInt_t | h = 1 |
||
) |
Definition at line 81 of file CmsShowSearchFiles.cc.
References m_choosePrefix, m_file, m_openButton, m_prefixMenu, m_webFile, and sendToWebBrowser().
: TGTransientFrame(gClient->GetDefaultRoot(), p, w, h) { TGVerticalFrame* vf = new TGVerticalFrame(this); this->AddFrame(vf,new TGLayoutHints(kLHintsExpandX|kLHintsExpandY,5,5,5,5)); TGHorizontalFrame* urlFrame = new TGHorizontalFrame(this); vf->AddFrame(urlFrame,new TGLayoutHints(kLHintsExpandX,5,0,5,5)); TGLabel* urlLabel = new TGLabel(urlFrame,"URL"); urlFrame->AddFrame(urlLabel, new TGLayoutHints(kLHintsLeft|kLHintsCenterY,1,1,1,1)); m_choosePrefix = new TGTextButton(urlFrame,"Choose Prefix"); urlFrame->AddFrame(m_choosePrefix, new TGLayoutHints(kLHintsLeft,1,1,1,1)); m_file= new TGTextEntry(urlFrame); urlFrame->AddFrame(m_file, new TGLayoutHints(kLHintsExpandX,1,0,1,1)); m_file->Connect("TextChanged(const char*)", "CmsShowSearchFiles",this,"fileEntryChanged(const char*)"); m_file->Connect("ReturnPressed()", "CmsShowSearchFiles",this,"updateBrowser()"); m_webFile = new FWHtml(vf,1,1); m_webFile->Connect("MouseDown(const char*)","CmsShowSearchFiles",this,"hyperlinkClicked(const char*)"); vf->AddFrame(m_webFile, new TGLayoutHints(kLHintsExpandX|kLHintsExpandY,1,1,1,1)); TGHorizontalFrame* buttonFrame = new TGHorizontalFrame(vf); vf->AddFrame(buttonFrame, new TGLayoutHints(kLHintsExpandX,1,10,1,10)); m_openButton = new TGTextButton(buttonFrame,"Open"); buttonFrame->AddFrame(m_openButton, new TGLayoutHints(kLHintsRight,5,5,1,1)); m_openButton->SetEnabled(kFALSE); m_openButton->Connect("Clicked()","CmsShowSearchFiles",this,"openClicked()"); TGTextButton* cancel = new TGTextButton(buttonFrame,"Cancel"); buttonFrame->AddFrame(cancel, new TGLayoutHints(kLHintsRight,5,5,1,1)); cancel->Connect("Clicked()","CmsShowSearchFiles",this,"UnmapWindow()"); SetWindowName(windowname); sendToWebBrowser(""); MapSubwindows(); Layout(); m_prefixMenu=0; m_choosePrefix->Connect("Clicked()","CmsShowSearchFiles",this,"showPrefixes()"); }
CmsShowSearchFiles::~CmsShowSearchFiles | ( | ) | [virtual] |
Definition at line 125 of file CmsShowSearchFiles.cc.
References m_prefixMenu.
{ delete m_prefixMenu; }
std::string CmsShowSearchFiles::chooseFileFromURL | ( | ) |
This opens the dialog window and returns once the user has choosen, returns an empty string if canceled.
Definition at line 303 of file CmsShowSearchFiles.cc.
References m_file, and m_openCalled.
{ DontCallClose(); Connect("CloseWindow()","CmsShowSearchFiles",this,"UnmapWindow()"); m_openCalled = false; MapWindow(); gClient->WaitForUnmap(this); if(!m_openCalled) { return std::string(); } return m_file->GetText(); }
CmsShowSearchFiles::ClassDef | ( | CmsShowSearchFiles | , |
0 | |||
) |
void CmsShowSearchFiles::fileEntryChanged | ( | const char * | iFileName | ) |
Definition at line 148 of file CmsShowSearchFiles.cc.
References convertXMLtoSQLite_cfg::fileName, getHLTprescales::index, m_openButton, and s_rootPostfix().
{ std::string fileName =iFileName; size_t index = fileName.find_last_of("."); std::string postfix; if(index != std::string::npos) { postfix=fileName.substr(index,std::string::npos); } if(postfix ==s_rootPostfix) { m_openButton->SetEnabled(kTRUE); } else { m_openButton->SetEnabled(kFALSE); } }
void CmsShowSearchFiles::hyperlinkClicked | ( | const char * | iLink | ) |
Definition at line 171 of file CmsShowSearchFiles.cc.
References FWHtml::addToVisited(), convertXMLtoSQLite_cfg::fileName, getHLTprescales::index, m_file, m_webFile, openClicked(), s_rootPostfix(), and updateBrowser().
{ m_file->SetText(iLink,kTRUE); m_webFile->addToVisited(iLink); std::string fileName =iLink; size_t index = fileName.find_last_of("."); std::string postfix = fileName.substr(index,std::string::npos); if(postfix !=s_rootPostfix) { updateBrowser(); } else { openClicked(); } }
void CmsShowSearchFiles::openClicked | ( | ) |
Definition at line 188 of file CmsShowSearchFiles.cc.
References m_openCalled.
Referenced by hyperlinkClicked().
{ m_openCalled=true; this->UnmapWindow(); }
void CmsShowSearchFiles::prefixChoosen | ( | Int_t | iIndex | ) |
Definition at line 131 of file CmsShowSearchFiles.cc.
References m_choosePrefix, m_file, m_openButton, m_prefixComplete, m_prefixes, m_webFile, sendToWebBrowser(), and updateBrowser().
{ m_file->SetText(m_prefixes[iIndex].c_str(),kFALSE); m_openButton->SetEnabled(kFALSE); if(m_prefixComplete[iIndex]) { //gClient->NeedRedraw(this); gClient->NeedRedraw(m_choosePrefix); gClient->NeedRedraw(m_webFile); gClient->ProcessEventsFor(this); updateBrowser(); } else { sendToWebBrowser(""); } }
void CmsShowSearchFiles::sendToWebBrowser | ( | const char * | iWebFile | ) | [private] |
Definition at line 260 of file CmsShowSearchFiles.cc.
References convertXMLtoSQLite_cfg::fileName, i, getHLTprescales::index, m_webFile, prof2calltree::prefix, readRemote(), s_httpsPrefix(), s_noBrowserMessage, and s_readError.
Referenced by CmsShowSearchFiles(), prefixChoosen(), and updateBrowser().
{ const std::string fileName(iWebFile); size_t index = fileName.find_first_of(":"); if(index != std::string::npos) { ++index; } else { index = 0; } std::string prefix = fileName.substr(0,index); m_webFile->Clear(); if(prefix == s_httpsPrefix) { gVirtualX->SetCursor(GetId(),gVirtualX->CreateCursor(kWatch)); //If you clicked a hyperlink then the cursor is still a hand but we now // want it to be a watch gVirtualX->SetCursor(m_webFile->GetId(),gVirtualX->CreateCursor(kWatch)); //If we don't call ProcessEventsFor then the cursor will not be updated gClient->ProcessEventsFor(this); TUrl url(iWebFile); std::string buffer = readRemote(url.GetUrl()); if (buffer.size()) { m_webFile->SetBaseUri(url.GetUrl()); m_webFile->ParseText(const_cast<char*>(buffer.c_str())); } else { m_webFile->SetBaseUri(""); for (int i=0; s_readError[i]; i++) { m_webFile->ParseText(const_cast<char *>(s_readError[i])); } } gVirtualX->SetCursor(GetId(),gVirtualX->CreateCursor(kPointer)); gVirtualX->SetCursor(m_webFile->GetId(),gVirtualX->CreateCursor(kPointer)); } else { m_webFile->SetBaseUri(""); for (int i=0; s_noBrowserMessage[i]; i++) { m_webFile->ParseText((char *)s_noBrowserMessage[i]); } } m_webFile->Layout(); }
void CmsShowSearchFiles::showPrefixes | ( | ) |
Definition at line 196 of file CmsShowSearchFiles.cc.
References getHLTprescales::index, m_choosePrefix, m_prefixComplete, m_prefixes, m_prefixMenu, prof2calltree::prefix, s_columns, s_filePrefix(), s_httpsPrefix(), and s_prefixes.
{ if(0==m_prefixMenu) { m_prefixMenu = new TGPopupMenu(this); const char* const (*itEnd)[s_columns] = s_prefixes+sizeof(s_prefixes)/sizeof(const char*[3]); int index = 0; for(const char* const (*it)[s_columns] = s_prefixes; it != itEnd; ++it,++index) { //only add the protocols this version of the code actually can load std::string prefix = std::string((*it)[0]).substr(0,std::string((*it)[0]).find_first_of(":")+1); if(s_httpsPrefix==prefix || s_filePrefix==prefix || (gPluginMgr->FindHandler("TSystem",prefix.c_str()) && gPluginMgr->FindHandler("TSystem",prefix.c_str())->CheckPlugin() != -1)) { m_prefixMenu->AddEntry((std::string((*it)[0])+" ("+((*it)[1])+")").c_str(),index); m_prefixes.push_back((*it)[0]); m_prefixComplete.push_back(0!=(*it)[2]); } } m_prefixMenu->Connect("Activated(Int_t)","CmsShowSearchFiles",this,"prefixChoosen(Int_t)"); } m_prefixMenu->PlaceMenu(m_choosePrefix->GetX(),m_choosePrefix->GetY(),true,true); }
void CmsShowSearchFiles::updateBrowser | ( | ) |
Definition at line 164 of file CmsShowSearchFiles.cc.
References m_file, and sendToWebBrowser().
Referenced by hyperlinkClicked(), and prefixChoosen().
{ sendToWebBrowser(m_file->GetText()); }
TGTextButton* CmsShowSearchFiles::m_choosePrefix [private] |
Definition at line 61 of file CmsShowSearchFiles.h.
Referenced by CmsShowSearchFiles(), prefixChoosen(), and showPrefixes().
TGTextEntry* CmsShowSearchFiles::m_file [private] |
Definition at line 63 of file CmsShowSearchFiles.h.
Referenced by chooseFileFromURL(), CmsShowSearchFiles(), hyperlinkClicked(), prefixChoosen(), and updateBrowser().
TGTextButton* CmsShowSearchFiles::m_openButton [private] |
Definition at line 67 of file CmsShowSearchFiles.h.
Referenced by CmsShowSearchFiles(), fileEntryChanged(), and prefixChoosen().
bool CmsShowSearchFiles::m_openCalled [private] |
Definition at line 68 of file CmsShowSearchFiles.h.
Referenced by chooseFileFromURL(), and openClicked().
std::vector<bool> CmsShowSearchFiles::m_prefixComplete [private] |
Definition at line 66 of file CmsShowSearchFiles.h.
Referenced by prefixChoosen(), and showPrefixes().
std::vector<std::string> CmsShowSearchFiles::m_prefixes [private] |
Definition at line 65 of file CmsShowSearchFiles.h.
Referenced by prefixChoosen(), and showPrefixes().
TGPopupMenu* CmsShowSearchFiles::m_prefixMenu [private] |
Definition at line 62 of file CmsShowSearchFiles.h.
Referenced by CmsShowSearchFiles(), showPrefixes(), and ~CmsShowSearchFiles().
FWHtml* CmsShowSearchFiles::m_webFile [private] |
Definition at line 64 of file CmsShowSearchFiles.h.
Referenced by CmsShowSearchFiles(), hyperlinkClicked(), prefixChoosen(), and sendToWebBrowser().