From 0235ffac163a7ea93d927caa587fd5d5382f0e12 Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Mon, 6 Apr 2026 19:16:23 +0200 Subject: [PATCH 1/2] [gui] add BMP to canvas saveas options, and update docu --- gui/gui/src/HelpText.cxx | 7 ++++--- gui/gui/src/TRootCanvas.cxx | 14 +++++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/gui/gui/src/HelpText.cxx b/gui/gui/src/HelpText.cxx index d42f7c1a7090b..f48558095f3ec 100644 --- a/gui/gui/src/HelpText.cxx +++ b/gui/gui/src/HelpText.cxx @@ -236,7 +236,6 @@ you can create as before the following graphics objects:\n\ TCutG *cut = (TCutG*)gPad->FindObject(\"CUTG\").\n\n\ "; - const char gHelpPullDownMenus[] = "\ Each canvas has a menu bar with the following items:\n\ \"File\" with the items:\n\ @@ -251,6 +250,9 @@ Each canvas has a menu bar with the following items:\n\ makes a SVG file\n\ makes a TeX file\n\ makes a GIF file\n\ + makes a JPEG file\n\ + makes a PNG file\n\ + makes a BMP file\n\ generates a C++ macro to reproduce the canvas\n\ saves canvas objects in a Root file\n\ brings up the Save As... dialog\n\ @@ -265,7 +267,7 @@ Each canvas has a menu bar with the following items:\n\ clears this canvas.\n\ not implemented\n\ not implemented\n\n" -"\"View\" with the items:\n\ + "\"View\" with the items:\n\ toggles the pad editor\n\ toggles the tool bar\n\ 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\ borders. This will display a menu to perform operations on a canvas.\n\n\ "; - const char gHelpCanvas[] = "\ A canvas (see TCanvas) is a top level pad (See TPad).\n\ A pad is a linked list of primitives of any type (graphics objects,\n\ diff --git a/gui/gui/src/TRootCanvas.cxx b/gui/gui/src/TRootCanvas.cxx index db1bcf4b7ae84..04952acdd8197 100644 --- a/gui/gui/src/TRootCanvas.cxx +++ b/gui/gui/src/TRootCanvas.cxx @@ -87,6 +87,7 @@ enum ERootCanvasCommands { kFileSaveAsGIF, kFileSaveAsJPG, kFileSaveAsPNG, + kFileSaveAsBMP, kFileSaveAsTEX, kFilePrint, kFileCloseCanvas, @@ -158,7 +159,7 @@ enum ERootCanvasCommands { kToolCutG }; - +// clang-format off static const char *gOpenTypes[] = { "ROOT files", "*.root", "All files", "*", 0, 0 }; @@ -171,6 +172,7 @@ static const char *gSaveAsTypes[] = { "PDF", "*.pdf", "PNG", "*.png", "JPEG", "*.jpg", "GIF", "*.gif", + "BMP", "*.bmp", "ROOT macros", "*.C", "ROOT files", "*.root", "XML", "*.xml", @@ -215,6 +217,7 @@ static ToolBarData_t gToolBarData1[] = { { "cut.xpm", "Graphical Cut", kFALSE, kToolCutG, 0 }, { 0, 0, kFALSE, 0, 0 } }; +// clang-format on ////////////////////////////////////////////////////////////////////////// // // @@ -360,6 +363,7 @@ void TRootCanvas::CreateCanvas(const char *name) if (img > 0) { fFileSaveMenu->AddEntry(Form("%s.&jpg",name), kFileSaveAsJPG); fFileSaveMenu->AddEntry(Form("%s.&png",name), kFileSaveAsPNG); + fFileSaveMenu->AddEntry(Form("%s.&bmp", name), kFileSaveAsBMP); } fFileSaveMenu->AddEntry(Form("%s.&C", name), kFileSaveAsC); @@ -880,6 +884,7 @@ Bool_t TRootCanvas::ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t) Bool_t appendedType = kFALSE; TString fn = fi.fFilename; TString ft = fi.fFileTypes[fi.fFileTypeIdx+1]; + // clang-format off dir = fi.fIniDir; typeidx = fi.fFileTypeIdx; overwr = fi.fOverwrite; @@ -891,6 +896,7 @@ Bool_t TRootCanvas::ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t) fn.EndsWith(".svg") || fn.EndsWith(".tex") || fn.EndsWith(".gif") || + fn.EndsWith(".bmp") || fn.EndsWith(".xml") || fn.EndsWith(".xpm") || fn.EndsWith(".jpg") || @@ -910,16 +916,17 @@ Bool_t TRootCanvas::ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t) } Warning("ProcessMessage", "file %s cannot be saved with this extension", fi.fFilename); } - for (int i=1;gSaveAsTypes[i];i+=2) { + for (int i = 1; gSaveAsTypes[i]; i += 2) { TString ftype = gSaveAsTypes[i]; ftype.ReplaceAll("*.", "."); if (fn.EndsWith(ftype.Data())) { - typeidx = i-1; + typeidx = i - 1; break; } } } break; + // clang-format on case kFileSaveAsRoot: fCanvas->SaveAs(".root"); break; @@ -944,6 +951,7 @@ Bool_t TRootCanvas::ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t) case kFileSaveAsPNG: fCanvas->SaveAs(".png"); break; + case kFileSaveAsBMP: fCanvas->SaveAs(".bmp"); break; case kFileSaveAsTEX: fCanvas->SaveAs(".tex"); break; From 98939b8bf87388ac77c7dd324912ec4c3ddf1055 Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Mon, 6 Apr 2026 19:18:52 +0200 Subject: [PATCH 2/2] [nfc] align --- gui/gui/src/HelpText.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/gui/src/HelpText.cxx b/gui/gui/src/HelpText.cxx index f48558095f3ec..113bb145113e2 100644 --- a/gui/gui/src/HelpText.cxx +++ b/gui/gui/src/HelpText.cxx @@ -266,8 +266,8 @@ Each canvas has a menu bar with the following items:\n\ clears the last selected pad via middle mouse button)\n\ clears this canvas.\n\ not implemented\n\ - not implemented\n\n" - "\"View\" with the items:\n\ + not implemented\n\n\ +\"View\" with the items:\n\ toggles the pad editor\n\ toggles the tool bar\n\ toggles the event status bar that shows the identification\n\