Skip to content

Commit 0235ffa

Browse files
committed
[gui] add BMP to canvas saveas options, and update docu
1 parent 1fbac62 commit 0235ffa

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

gui/gui/src/HelpText.cxx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ you can create as before the following graphics objects:\n\
236236
TCutG *cut = (TCutG*)gPad->FindObject(\"CUTG\").\n\n\
237237
";
238238

239-
240239
const char gHelpPullDownMenus[] = "\
241240
Each canvas has a menu bar with the following items:\n\
242241
\"File\" with the items:\n\
@@ -251,6 +250,9 @@ Each canvas has a menu bar with the following items:\n\
251250
<name.svg > makes a SVG file\n\
252251
<name.tex > makes a TeX file\n\
253252
<name.gif > makes a GIF file\n\
253+
<name.jpg > makes a JPEG file\n\
254+
<name.png > makes a PNG file\n\
255+
<name.bmp > makes a BMP file\n\
254256
<name.C > generates a C++ macro to reproduce the canvas\n\
255257
<name.root> saves canvas objects in a Root file\n\
256258
<Save As... > brings up the Save As... dialog\n\
@@ -265,7 +267,7 @@ Each canvas has a menu bar with the following items:\n\
265267
<Canvas> clears this canvas.\n\
266268
<Undo > not implemented\n\
267269
<Redo > not implemented\n\n"
268-
"\"View\" with the items:\n\
270+
"\"View\" with the items:\n\
269271
<Editor > toggles the pad editor\n\
270272
<Toolbar > toggles the tool bar\n\
271273
<Event Status> toggles the event status bar that shows the identification\n\
@@ -298,7 +300,6 @@ by clicking with the right mouse button in the regions closed to the canvas \n\
298300
borders. This will display a menu to perform operations on a canvas.\n\n\
299301
";
300302

301-
302303
const char gHelpCanvas[] = "\
303304
A canvas (see TCanvas) is a top level pad (See TPad).\n\
304305
A pad is a linked list of primitives of any type (graphics objects,\n\

gui/gui/src/TRootCanvas.cxx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ enum ERootCanvasCommands {
8787
kFileSaveAsGIF,
8888
kFileSaveAsJPG,
8989
kFileSaveAsPNG,
90+
kFileSaveAsBMP,
9091
kFileSaveAsTEX,
9192
kFilePrint,
9293
kFileCloseCanvas,
@@ -158,7 +159,7 @@ enum ERootCanvasCommands {
158159
kToolCutG
159160

160161
};
161-
162+
// clang-format off
162163
static const char *gOpenTypes[] = { "ROOT files", "*.root",
163164
"All files", "*",
164165
0, 0 };
@@ -171,6 +172,7 @@ static const char *gSaveAsTypes[] = { "PDF", "*.pdf",
171172
"PNG", "*.png",
172173
"JPEG", "*.jpg",
173174
"GIF", "*.gif",
175+
"BMP", "*.bmp",
174176
"ROOT macros", "*.C",
175177
"ROOT files", "*.root",
176178
"XML", "*.xml",
@@ -215,6 +217,7 @@ static ToolBarData_t gToolBarData1[] = {
215217
{ "cut.xpm", "Graphical Cut", kFALSE, kToolCutG, 0 },
216218
{ 0, 0, kFALSE, 0, 0 }
217219
};
220+
// clang-format on
218221

219222
//////////////////////////////////////////////////////////////////////////
220223
// //
@@ -360,6 +363,7 @@ void TRootCanvas::CreateCanvas(const char *name)
360363
if (img > 0) {
361364
fFileSaveMenu->AddEntry(Form("%s.&jpg",name), kFileSaveAsJPG);
362365
fFileSaveMenu->AddEntry(Form("%s.&png",name), kFileSaveAsPNG);
366+
fFileSaveMenu->AddEntry(Form("%s.&bmp", name), kFileSaveAsBMP);
363367
}
364368

365369
fFileSaveMenu->AddEntry(Form("%s.&C", name), kFileSaveAsC);
@@ -880,6 +884,7 @@ Bool_t TRootCanvas::ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t)
880884
Bool_t appendedType = kFALSE;
881885
TString fn = fi.fFilename;
882886
TString ft = fi.fFileTypes[fi.fFileTypeIdx+1];
887+
// clang-format off
883888
dir = fi.fIniDir;
884889
typeidx = fi.fFileTypeIdx;
885890
overwr = fi.fOverwrite;
@@ -891,6 +896,7 @@ Bool_t TRootCanvas::ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t)
891896
fn.EndsWith(".svg") ||
892897
fn.EndsWith(".tex") ||
893898
fn.EndsWith(".gif") ||
899+
fn.EndsWith(".bmp") ||
894900
fn.EndsWith(".xml") ||
895901
fn.EndsWith(".xpm") ||
896902
fn.EndsWith(".jpg") ||
@@ -910,16 +916,17 @@ Bool_t TRootCanvas::ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t)
910916
}
911917
Warning("ProcessMessage", "file %s cannot be saved with this extension", fi.fFilename);
912918
}
913-
for (int i=1;gSaveAsTypes[i];i+=2) {
919+
for (int i = 1; gSaveAsTypes[i]; i += 2) {
914920
TString ftype = gSaveAsTypes[i];
915921
ftype.ReplaceAll("*.", ".");
916922
if (fn.EndsWith(ftype.Data())) {
917-
typeidx = i-1;
923+
typeidx = i - 1;
918924
break;
919925
}
920926
}
921927
}
922928
break;
929+
// clang-format on
923930
case kFileSaveAsRoot:
924931
fCanvas->SaveAs(".root");
925932
break;
@@ -944,6 +951,7 @@ Bool_t TRootCanvas::ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t)
944951
case kFileSaveAsPNG:
945952
fCanvas->SaveAs(".png");
946953
break;
954+
case kFileSaveAsBMP: fCanvas->SaveAs(".bmp"); break;
947955
case kFileSaveAsTEX:
948956
fCanvas->SaveAs(".tex");
949957
break;

0 commit comments

Comments
 (0)