Fireworks
Core
src
FWViewBase.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: Core
4
// Class : FWViewBase
5
//
6
// Implementation:
7
// <Notes on implementation>
8
//
9
// Original Author: Chris Jones
10
// Created: Thu Feb 21 14:43:19 EST 2008
11
//
12
13
// system include files
14
#include <stdexcept>
15
#include <iostream>
16
#include "TGFileDialog.h"
17
18
// user include files
19
#include "
Fireworks/Core/interface/FWViewBase.h
"
20
21
//
22
// constants, enums and typedefs
23
//
24
25
//
26
// static data member definitions
27
//
28
29
//
30
// constructors and destructor
31
//
32
FWViewBase::FWViewBase
(
FWViewType::EType
type
,
unsigned
int
iVersion)
33
:
FWConfigurableParameterizable
(iVersion), m_type(
type
) {}
34
35
// FWViewBase::FWViewBase(const FWViewBase& rhs)
36
// {
37
// // do actual copying here;
38
// }
39
40
FWViewBase::~FWViewBase
() {}
41
42
//
43
// assignment operators
44
//
45
// const FWViewBase& FWViewBase::operator=(const FWViewBase& rhs)
46
// {
47
// //An exception safe implementation is
48
// FWViewBase temp(rhs);
49
// swap(rhs);
50
//
51
// return *this;
52
// }
53
54
//
55
// member functions
56
//
57
void
FWViewBase::destroy
() {
beingDestroyed_
(
this
); }
58
59
//
60
// const member functions
61
//
62
void
FWViewBase::promptForSaveImageTo
(TGFrame* iParent)
const
{
63
if
(
typeId
() <
FWViewType::kTable
) {
64
try
{
65
static
TString
dir
(
"."
);
66
const
char
* kImageExportTypes[] = {
"PNG"
,
67
"*.png"
,
68
"GIF"
,
69
"*.gif"
,
70
"JPEG"
,
71
"*.jpg"
,
72
"PDF"
,
73
"*.pdf"
,
74
"Encapsulated PostScript"
,
75
"*.eps"
,
76
nullptr
,
77
nullptr
};
78
79
TGFileInfo fi;
80
fi.fFileTypes = kImageExportTypes;
81
fi.fIniDir = StrDup(
dir
);
82
new
TGFileDialog(gClient->GetDefaultRoot(), iParent, kFDSave, &fi);
83
dir
= fi.fIniDir;
84
if
(fi.fFilename !=
nullptr
) {
85
std::string
name
= fi.fFilename;
86
// fi.fFileTypeIdx points to the name of the file type
87
// selected in the drop-down menu, so fi.fFileTypeIdx gives us
88
// the extension
89
std::string
ext
= kImageExportTypes[fi.fFileTypeIdx + 1] + 1;
90
if
(
name
.find(
ext
) ==
name
.npos)
91
name
+=
ext
;
92
saveImageTo
(
name
);
93
}
94
}
catch
(std::runtime_error&
e
) {
95
std::cout
<<
e
.what() << std::endl;
96
}
97
}
else
{
98
saveImageTo
(
"dummy"
);
99
}
100
}
101
102
FWViewContextMenuHandlerBase
*
FWViewBase::contextMenuHandler
()
const
{
return
nullptr
; }
103
104
//
105
// static member functions
106
//
107
const
std::string
&
FWViewBase::typeName
()
const
{
return
m_type
.
name
(); }
ext
Definition:
memstream.h:15
FWViewType::EType
EType
Definition:
FWViewType.h:31
FWViewBase::typeName
const std::string & typeName() const
Definition:
FWViewBase.cc:107
FWViewContextMenuHandlerBase
Definition:
FWViewContextMenuHandlerBase.h:29
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
FWViewBase::typeId
FWViewType::EType typeId() const
Definition:
FWViewBase.h:42
FWViewType::name
const std::string & name() const
Definition:
FWViewType.cc:66
FWViewBase::saveImageTo
virtual void saveImageTo(const std::string &iName) const =0
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
FWConfigurableParameterizable
Definition:
FWConfigurableParameterizable.h:29
FWViewBase::destroy
void destroy()
Definition:
FWViewBase.cc:57
FWViewBase::contextMenuHandler
virtual FWViewContextMenuHandlerBase * contextMenuHandler() const
Definition:
FWViewBase.cc:102
type
type
Definition:
HCALResponse.h:21
FWViewBase.h
FWViewBase::FWViewBase
FWViewBase(FWViewType::EType, unsigned int iVersion=1)
Definition:
FWViewBase.cc:32
Skims_PA_cff.name
name
Definition:
Skims_PA_cff.py:17
FWViewBase::~FWViewBase
~FWViewBase() override
Definition:
FWViewBase.cc:40
FWViewBase::promptForSaveImageTo
void promptForSaveImageTo(TGFrame *) const
Definition:
FWViewBase.cc:62
FWViewBase::m_type
FWViewType m_type
Definition:
FWViewBase.h:61
FWViewBase::beingDestroyed_
sigc::signal< void, const FWViewBase * > beingDestroyed_
Definition:
FWViewBase.h:56
DeadROC_duringRun.dir
dir
Definition:
DeadROC_duringRun.py:23
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
FWViewType::kTable
Definition:
FWViewType.h:39
Generated for CMSSW Reference Manual by
1.8.16