00001
00002
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00021
00030
00031
00032
00033
00034
00035
00036 #include "AIDA_InfoStyle.h"
00037 #include "AIDA_TextStyle.h"
00038 #include "GracePlotter/LegendBoxStyle.h"
00039
00040 #include <iostream>
00041
00042
00043
00044 namespace Anaphe {
00045 namespace AIDA_Plotter_Grace {
00046
00047
00048
00049
00051
00052
00053
00055
00056 AIDA_InfoStyle::AIDA_InfoStyle()
00057 : rep (0),
00058 ownRep(false)
00059 {
00060
00061 }
00062
00063
00064
00065 AIDA_InfoStyle::AIDA_InfoStyle(LegendBoxStyle* x, bool b)
00066 : rep (x),
00067 ownRep(b)
00068 {
00069
00070 }
00071
00072
00073
00074 AIDA_InfoStyle::~AIDA_InfoStyle()
00075 {
00076 if (ownRep) delete rep;
00077 }
00078
00079
00080
00081
00082
00084
00085
00086
00088
00089 void AIDA_InfoStyle::reset()
00090 {
00091 if (!rep) {
00092 crisis();
00093 return;
00094 }
00095 rep->reset();
00096 }
00097
00098
00099
00100
00101 bool AIDA_InfoStyle::setParameter(const std::string& paramName,
00102 const std::string& options)
00103 {
00104 if (!rep) {
00105 crisis();
00106 return false;
00107 }
00108 return rep->setParameter(paramName,options);
00109 }
00110
00111
00112
00113
00114 std::string AIDA_InfoStyle::parameterValue(const std::string& param) const
00115 {
00116 if (!rep) {
00117 crisis();
00118 return "";
00119 }
00120 return rep->parameterValue(param);
00121 }
00122
00123
00124
00125
00126 std::vector<std::string> AIDA_InfoStyle::availableParameters() const
00127 {
00128 if (!rep) {
00129 crisis();
00130 return std::vector<std::string>();
00131 }
00132 return rep->availableParameters();
00133 }
00134
00135
00136
00137
00138 std::vector<std::string>
00139 AIDA_InfoStyle::availableParameterOptions(const std::string& paramName) const
00140 {
00141 if (!rep) {
00142 crisis();
00143 return std::vector<std::string>();
00144 }
00145 return rep->availableOptions(paramName);
00146 }
00147
00148
00149
00150
00151 AIDA::ITextStyle& AIDA_InfoStyle::textStyle()
00152 {
00153 static AIDA_TextStyle pr;
00154 if (!rep) {
00155 crisis();
00156 return pr;
00157 }
00158 TextStyle& gts = rep->textStyle();
00159 pr.setRep(gts,false);
00160 return pr;
00161 }
00162
00163
00164
00165
00166 bool AIDA_InfoStyle::setTextStyle(const AIDA::ITextStyle& textStyle)
00167 {
00168 if (!rep) {
00169 crisis();
00170 return false;
00171 }
00172 const AIDA_TextStyle* pr = dynamic_cast<const AIDA_TextStyle*>(&textStyle);
00173 if (!pr) return false;
00174 AIDA_TextStyle* ncpr = const_cast<AIDA_TextStyle*>(pr);
00175 const TextStyle* tsrep = ncpr->theRep();
00176 if (tsrep == 0) return false;
00177 else {
00178 rep->setTextStyle(*tsrep);
00179 return true;
00180 }
00181 }
00182
00183
00184
00185
00186 void AIDA_InfoStyle::setRep(LegendBoxStyle& s, bool ownership)
00187 {
00188 if (ownRep) delete rep;
00189 rep = &s;
00190 ownRep = ownership;
00191 }
00192
00193
00194
00195 LegendBoxStyle* AIDA_InfoStyle::theRep()
00196 {
00197 return rep;
00198 }
00199
00200
00201
00203
00204
00205
00207
00208 void AIDA_InfoStyle::crisis() const
00209 {
00210 std::cout << "*** AIDA_Plotter_Grace SEVERE ERROR: proxy failure in AIDA_InfoStyle" << std::endl;
00211 }
00212
00213
00214
00215
00216 }
00217 }
00218