Skip to content

Commit c92c055

Browse files
committed
Adjust TPaletteAxis::SavePrimitive
1 parent 7b7b3f7 commit c92c055

File tree

1 file changed

+22
-30
lines changed

1 file changed

+22
-30
lines changed

hist/histpainter/src/TPaletteAxis.cxx

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -622,41 +622,33 @@ void TPaletteAxis::Paint(Option_t *)
622622

623623
void TPaletteAxis::SavePrimitive(std::ostream &out, Option_t * /*= ""*/)
624624
{
625-
if (!fH) return;
626-
627-
char quote = '"';
625+
if (!fH)
626+
return;
628627

629-
out << " " << std::endl;
630-
if (gROOT->ClassSaved(TPaletteAxis::Class())) {
631-
out << " ";
632-
} else {
633-
out << " " << ClassName() << " *";
634-
}
635-
if (fOption.Contains("NDC")) {
636-
out << "palette = new " << ClassName() << "(" << fX1NDC << "," << fY1NDC << "," << fX2NDC << "," << fY2NDC
637-
<< "," << fH->GetName() << ");" << std::endl;
638-
} else {
639-
out << "palette = new " << ClassName() << "(" << fX1 << "," << fY1 << "," << fX2 << "," << fY2
640-
<< "," << fH->GetName() << ");" << std::endl;
641-
}
642-
out << " palette->SetNdivisions(" << fH->GetZaxis()->GetNdivisions() << ");" << std::endl;
643-
out << " palette->SetAxisColor(" << fH->GetZaxis()->GetAxisColor() << ");" << std::endl;
644-
out << " palette->SetLabelColor(" << fH->GetZaxis()->GetLabelColor() << ");" << std::endl;
645-
out << " palette->SetLabelFont(" << fH->GetZaxis()->GetLabelFont() << ");" << std::endl;
646-
out << " palette->SetLabelOffset(" << fH->GetZaxis()->GetLabelOffset() << ");" << std::endl;
647-
out << " palette->SetLabelSize(" << fH->GetZaxis()->GetLabelSize() << ");" << std::endl;
648-
out << " palette->SetMaxDigits(" << fH->GetZaxis()->GetMaxDigits() << ");" << std::endl;
649-
out << " palette->SetTickLength(" << fH->GetZaxis()->GetTickLength() << ");" << std::endl;
650-
out << " palette->SetTitleOffset(" << fH->GetZaxis()->GetTitleOffset() << ");" << std::endl;
651-
out << " palette->SetTitleSize(" << fH->GetZaxis()->GetTitleSize() << ");" << std::endl;
652-
out << " palette->SetTitleColor(" << fH->GetZaxis()->GetTitleColor() << ");" << std::endl;
653-
out << " palette->SetTitleFont(" << fH->GetZaxis()->GetTitleFont() << ");" << std::endl;
654-
out << " palette->SetTitle(" << quote << fH->GetZaxis()->GetTitle() << quote << ");" << std::endl;
628+
TString args;
629+
if (fOption.Contains("NDC"))
630+
args.Form("%g, %g, %g, %g, %s", fX1NDC, fY1NDC, fX2NDC, fY2NDC, fH->GetName());
631+
else
632+
args.Form("%g, %g, %g, %g, %s", fX1, fY1, fX2, fY2, fH->GetName());
633+
634+
SavePrimitiveConstructor(out, Class(), "palette", args);
635+
out << " palette->SetNdivisions(" << fH->GetZaxis()->GetNdivisions() << ");\n";
636+
out << " palette->SetAxisColor(" << fH->GetZaxis()->GetAxisColor() << ");\n";
637+
out << " palette->SetLabelColor(" << fH->GetZaxis()->GetLabelColor() << ");\n";
638+
out << " palette->SetLabelFont(" << fH->GetZaxis()->GetLabelFont() << ");\n";
639+
out << " palette->SetLabelOffset(" << fH->GetZaxis()->GetLabelOffset() << ");\n";
640+
out << " palette->SetLabelSize(" << fH->GetZaxis()->GetLabelSize() << ");\n";
641+
out << " palette->SetMaxDigits(" << fH->GetZaxis()->GetMaxDigits() << ");\n";
642+
out << " palette->SetTickLength(" << fH->GetZaxis()->GetTickLength() << ");\n";
643+
out << " palette->SetTitleOffset(" << fH->GetZaxis()->GetTitleOffset() << ");\n";
644+
out << " palette->SetTitleSize(" << fH->GetZaxis()->GetTitleSize() << ");\n";
645+
out << " palette->SetTitleColor(" << fH->GetZaxis()->GetTitleColor() << ");\n";
646+
out << " palette->SetTitleFont(" << fH->GetZaxis()->GetTitleFont() << ");\n";
647+
out << " palette->SetTitle(\"" << TString(fH->GetZaxis()->GetTitle()).ReplaceSpecialCppChars() << "\");\n";
655648
SaveFillAttributes(out, "palette", -1, -1);
656649
SaveLineAttributes(out, "palette", 1, 1, 1);
657650
}
658651

659-
660652
////////////////////////////////////////////////////////////////////////////////
661653
/// Unzoom the palette
662654

0 commit comments

Comments
 (0)