Skip to content

Commit 67e5be1

Browse files
committed
[gui] add BMP to canvas saveas options, and update docu
[nfc] align ali
1 parent a53421f commit 67e5be1

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

gui/gui/src/HelpText.cxx

Lines changed: 5 additions & 4 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\
@@ -264,8 +266,8 @@ Each canvas has a menu bar with the following items:\n\
264266
<Pad > clears the last selected pad via middle mouse button)\n\
265267
<Canvas> clears this canvas.\n\
266268
<Undo > not implemented\n\
267-
<Redo > not implemented\n\n"
268-
"\"View\" with the items:\n\
269+
<Redo > not implemented\n\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: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ enum ERootCanvasCommands {
127127
kFileSaveAsGIF,
128128
kFileSaveAsJPG,
129129
kFileSaveAsPNG,
130+
kFileSaveAsBMP,
130131
kFileSaveAsTEX,
131132
kFilePrint,
132133
kFileCloseCanvas,
@@ -198,7 +199,7 @@ enum ERootCanvasCommands {
198199
kToolCutG
199200

200201
};
201-
202+
// clang-format off
202203
static const char *gOpenTypes[] = { "ROOT files", "*.root",
203204
"All files", "*",
204205
0, 0 };
@@ -211,6 +212,7 @@ static const char *gSaveAsTypes[] = { "PDF", "*.pdf",
211212
"PNG", "*.png",
212213
"JPEG", "*.jpg",
213214
"GIF", "*.gif",
215+
"BMP", "*.bmp",
214216
"ROOT macros", "*.C",
215217
"ROOT files", "*.root",
216218
"XML", "*.xml",
@@ -255,6 +257,7 @@ static ToolBarData_t gToolBarData1[] = {
255257
{ "cut.xpm", "Graphical Cut", kFALSE, kToolCutG, 0 },
256258
{ 0, 0, kFALSE, 0, 0 }
257259
};
260+
// clang-format on
258261

259262
//////////////////////////////////////////////////////////////////////////
260263
// //
@@ -400,8 +403,9 @@ void TRootCanvas::CreateCanvas(const char *name)
400403
gErrorIgnoreLevel = sav;
401404
}
402405
if (img > 0) {
403-
fFileSaveMenu->AddEntry(TString::Format("%s.&jpg",name), kFileSaveAsJPG);
404-
fFileSaveMenu->AddEntry(TString::Format("%s.&png",name), kFileSaveAsPNG);
406+
fFileSaveMenu->AddEntry(Form("%s.&jpg", name), kFileSaveAsJPG);
407+
fFileSaveMenu->AddEntry(Form("%s.&png", name), kFileSaveAsPNG);
408+
fFileSaveMenu->AddEntry(Form("%s.&bmp", name), kFileSaveAsBMP);
405409
}
406410

407411
fFileSaveMenu->AddEntry(TString::Format("%s.&C", name), kFileSaveAsC);
@@ -923,6 +927,7 @@ Bool_t TRootCanvas::ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t)
923927
Bool_t appendedType = kFALSE;
924928
TString fn = fi.fFilename;
925929
TString ft = fi.fFileTypes[fi.fFileTypeIdx+1];
930+
// clang-format off
926931
dir = fi.fIniDir;
927932
typeidx = fi.fFileTypeIdx;
928933
overwr = fi.fOverwrite;
@@ -934,6 +939,7 @@ Bool_t TRootCanvas::ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t)
934939
fn.EndsWith(".svg") ||
935940
fn.EndsWith(".tex") ||
936941
fn.EndsWith(".gif") ||
942+
fn.EndsWith(".bmp") ||
937943
fn.EndsWith(".xml") ||
938944
fn.EndsWith(".xpm") ||
939945
fn.EndsWith(".jpg") ||
@@ -953,11 +959,11 @@ Bool_t TRootCanvas::ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t)
953959
}
954960
Warning("ProcessMessage", "file %s cannot be saved with this extension", fi.fFilename);
955961
}
956-
for (int i=1;gSaveAsTypes[i];i+=2) {
962+
for (int i = 1; gSaveAsTypes[i]; i += 2) {
957963
TString ftype = gSaveAsTypes[i];
958964
ftype.ReplaceAll("*.", ".");
959965
if (fn.EndsWith(ftype.Data())) {
960-
typeidx = i-1;
966+
typeidx = i - 1;
961967
break;
962968
}
963969
}
@@ -990,6 +996,9 @@ Bool_t TRootCanvas::ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t)
990996
case kFileSaveAsPNG:
991997
fCanvas->SaveAs(".png");
992998
break;
999+
case kFileSaveAsBMP:
1000+
fCanvas->SaveAs(".bmp");
1001+
break;
9931002
case kFileSaveAsTEX:
9941003
fCanvas->SaveAs(".tex");
9951004
break;
@@ -1292,6 +1301,7 @@ Bool_t TRootCanvas::ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t)
12921301
hd->SetText(gHelpPostscript);
12931302
hd->Popup();
12941303
break;
1304+
// clang-format on
12951305
}
12961306
default:
12971307
break;

0 commit comments

Comments
 (0)