Changeset 2787 for trunk/MagicSoft
- Timestamp:
- 01/13/04 16:29:46 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2784 r2787 79 79 * mbase/MLogPlugin.[h,cc], mbase/MLogHtml.[h,cc]: 80 80 - added 81 82 * mbase/MStatusDisplay.[h,cc]: 83 - added a Save-As dialog 81 84 82 85 -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
r2773 r2787 87 87 #include <TGTextView.h> // TGTextView 88 88 #include <TGStatusBar.h> // TGStatusBar 89 #include <TGFileDialog.h> // TGFileDialog 89 90 #include <TGProgressBar.h> // TGHProgressBar 90 91 91 #include <TRootEmbeddedCanvas.h> // TRootEmbeddedCanvas 92 92 … … 190 190 filemenu->AddEntry("Save As status.&root", kFileSaveAsRoot); 191 191 filemenu->AddSeparator(); 192 filemenu->AddEntry("Save &As...", kFileSaveAs); 193 filemenu->AddSeparator(); 192 194 filemenu->AddEntry("Re&set", kFileReset); 193 195 filemenu->AddSeparator(); … … 203 205 // 204 206 MGPopupMenu *tabmenu = new MGPopupMenu(gClient->GetRoot()); 205 // tabmenu->AddEntry("Save &As...", kFileSaveAs);206 207 tabmenu->AddEntry("Next [&+]", kTabNext); 207 208 tabmenu->AddEntry("Previous [&-]", kTabPrevious); … … 211 212 tabmenu->AddEntry("Save As tab-i.&C", kTabSaveAsC); 212 213 tabmenu->AddEntry("Save As tab-i.&root", kTabSaveAsRoot); 214 tabmenu->AddSeparator(); 215 tabmenu->AddEntry("Save &As...", kTabSaveAs); 213 216 tabmenu->AddSeparator(); 214 217 tabmenu->AddEntry("Re&move", kTabRemove); … … 1084 1087 Reset(); 1085 1088 return kTRUE; 1086 /*1087 case kFileSave:1088 cout << "Save..." << endl;1089 return kTRUE;1090 1089 1091 1090 case kFileSaveAs: 1092 cout << "SaveAs..." << endl;1093 return kTRUE; 1094 */ 1091 SaveAs(); 1092 return kTRUE; 1093 1095 1094 case kFileSaveAsPS: 1096 1095 SaveAsPS(); … … 1111 1110 case kFilePrint: 1112 1111 PrintToLpr(); 1112 return kTRUE; 1113 1114 case kTabSaveAs: 1115 SaveAs(fTab->GetCurrent()); 1113 1116 return kTRUE; 1114 1117 … … 2138 2141 } 2139 2142 2143 // -------------------------------------------------------------------------- 2144 // 2145 // Opens a save as dialog 2146 // 2147 Int_t MStatusDisplay::SaveAs(Int_t num) 2148 { 2149 static const char *gSaveAsTypes[] = 2150 { 2151 "PostScript", "*.ps", 2152 // "Encapsulated PostScript", "*.eps", 2153 "Gif files", "*.gif", 2154 "Macro files", "*.C", 2155 "ROOT files", "*.root", 2156 "All files", "*", 2157 NULL, NULL 2158 }; 2159 2160 static TString dir("."); 2161 2162 TGFileInfo fi; // fFileName and fIniDir deleted in ~TGFileInfo 2163 2164 fi.fFileTypes = (const char**)gSaveAsTypes; 2165 fi.fIniDir = StrDup(dir); 2166 2167 new TGFileDialog(fClient->GetRoot(), this, kFDSave, &fi); 2168 2169 if (!fi.fFilename) 2170 return 0; 2171 2172 dir = fi.fIniDir; 2173 2174 const TString name(fi.fFilename); 2175 2176 if (name.EndsWith(".root")) return SaveAsRoot(num, name); 2177 if (name.EndsWith(".ps")) return SaveAsPS(num, name); 2178 if (name.EndsWith(".gif")) return SaveAsGIF(num, name); 2179 if (name.EndsWith(".C")) return SaveAsC(num, name); 2180 2181 Warning("MStatusDisplay::SaveAs", "Unknown Extension: %s", fi.fFilename); 2182 return 0; 2183 } 2184 2140 2185 Bool_t MStatusDisplay::HandleConfigureNotify(Event_t *evt) 2141 2186 { … … 2211 2256 return rc; 2212 2257 } 2213 2214 /*2215 // --------------------------------------------------------------------------2216 //2217 // Opens a save as dialog, and tries to store the canvas2218 // in the given output format2219 //2220 void MGEvtDisplay::SaveAsDialog() const2221 {2222 static const char *gSaveAsTypes[] =2223 {2224 "PostScript", "*.ps",2225 "Encapsulated PostScript", "*.eps",2226 "Gif files", "*.gif",2227 "Macro files", "*.C",2228 "ROOT files", "*.root",2229 "All files", "*",2230 NULL, NULL2231 };2232 2233 static TString dir(".");2234 2235 TGFileInfo fi; // fFileName and fIniDir deleted in ~TGFileInfo2236 2237 fi.fFileTypes = (const char**)gSaveAsTypes;2238 fi.fIniDir = StrDup(dir);2239 2240 new TGFileDialog(fClient->GetRoot(), this, kFDSave, &fi);2241 2242 if (!fi.fFilename)2243 return;2244 2245 dir = fi.fIniDir;2246 2247 if (strstr(fi.fFilename, ".root") ||2248 strstr(fi.fFilename, ".ps") ||2249 strstr(fi.fFilename, ".eps") ||2250 strstr(fi.fFilename, ".gif"))2251 {2252 fCanvas->SaveAs(fi.fFilename);2253 return;2254 }2255 if (strstr(fi.fFilename, ".C"))2256 {2257 fCanvas->SaveSource(fi.fFilename);2258 return;2259 }2260 Warning("SaveAsDialog", "Unknown Extension: %s", fi.fFilename);2261 }2262 */ -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.h
r2773 r2787 182 182 Int_t PrintToLpr(Int_t num); 183 183 184 Int_t SaveAs(Int_t num=-1); 185 184 186 Status_t CheckStatus() const { return fStatus; } 185 187 void ClearStatus() { fStatus = kLoopNone; }
Note:
See TracChangeset
for help on using the changeset viewer.