Skip to content

Commit 2246943

Browse files
Rene BrunRene Brun
Rene Brun
authored and
Rene Brun
committed
From Ilka & Denis:
The Style Manager handles a list of styles in the ROOT session. It loads by default the five styles provided by ROOT: Default, Plain, Bold, Video, and Pub. If this list does not contain a style with the characteristics you want, you can create a new one and than apply it. The Style Manager interface is composed of two parts: - the top level interface that manages a list of styles; - the style editor, which deals with the current style settings. The combo box 'Available Styles' contains the list of available styles for the current ROOT session and the currently selected one. The field on the right shows the setting of the gStyle. You can set the global variable gStyle to the selected style by the button in the middle. The group frame 'Apply on' displays information for the currently selected canvas and object in the ROOT session. This selection might be changed by clicking on another object with the middle mouse button. You have a choice to apply the selected style on the selected object or on all available canvases. WARNING: You cannot undo the changes after applying the style! If you are not sure of that action, it may be better to see a preview of what you are going to apply.\n" If the check button 'Preview' is selected, a preview of the selected canvas according to the selected style will be shown. The selection of the next check button 'Run Time Preview' will apply updates of the preview any time a value of the selected style is changed. For drawings that take a time it is better to disable this option. Create a new style / delete a style: You can access these functionalities via the menu or the tool bar. If you create a style, a clone of the selected style will be created; you will have the opportunity to modify it later via the editor. Moreover, during the creation process, you will be asked for a name and a description for your brand new style. The name can obviously not be the same as another already existing style. When you choose 'delete', the selected style is removed from the ROOT session. The selected style will be lost if you didn't saved it in a C++ macro file before. Export a style (in a C++ macro file) / Import a style (from a macro): To store a style longer than for one session of ROOT or in order to share some styles with others, you can save it in a C++ macro file. This can be done via the menu and the tool bar. The selected style will be saved. The name of the macro must be 'Style_*.C', where * can be replaced by anything you want. A style macro can be imported at any time. The new imported style in ROOT will become the selected one. Apply a style (on an object) / Import a style (from an object): There is a specific button to apply a style on an object and its use has already been described in the overview. To import a style from a canvas, choose the 'Style / Import from... / Canvas' menu or the corresponding Tool bar button. A new style will be created in the ROOT session and will become the selected one. This style is a clone of gStyle where every style's information contained in the selected canvas (the canvas containing the current selected pad) is written. You can consequently import a style from a canvas and apply it later on another object. Preview a style: The predicted result when applying a style can be seen if the 'Preview' check button is selected. The preview includes the original canvas. Editor's buttons: Open / close the editor:\n" The button 'Edit >>' opens the style editor. Its label changes to 'Close <<'. For all details of what can be changed and how please see the provided Help on the right of the Style Manager menu bar. Reset a style (to a previously saved state): When the editor is opened, in the bottom of the main window of the style manager, a 'Reset' button enables you to reset the values of the selected style. So doing, you cancel all changes made since the last time you saved that style in a macro file. If the selected style is one of the five predefined styles of ROOT (Plain, Bold, Video, Pub or Default), it will be reset using the specific code in the ROOT files. Update the preview: The button 'Update Preview' is available when a preview is shown and the run time option is disabled. This button allows you to refresh the preview and to see how the edited style looks like. git-svn-id: http://root.cern.ch/svn/root/trunk@12688 27541ba8-7e3a-0410-8455-c3a389f83636
1 parent c3af369 commit 2246943

23 files changed

+8429
-34
lines changed

base/inc/TStyle.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @(#)root/base:$Name: $:$Id: TStyle.h,v 1.27 2005/08/18 11:12:58 brun Exp $
1+
// @(#)root/base:$Name: $:$Id: TStyle.h,v 1.28 2005/09/02 07:51:51 brun Exp $
22
// Author: Rene Brun 12/12/94
33

44
/*************************************************************************
@@ -396,8 +396,10 @@ class TStyle : public TNamed, public TAttLine, public TAttFill, public TAttMarke
396396
void ToggleToolBar() { fShowToolBar = fShowToolBar ? 0 : 1; }
397397
void SetIsReading(Bool_t reading=kTRUE);
398398
void SetPalette(Int_t ncolors=0, Int_t *colors=0);
399+
void SavePrimitive(ofstream &out, Option_t *);
400+
void SaveSource(const char *filename, Option_t *option=0);
399401

400-
ClassDef(TStyle,12) //A collection of all graphics attributes
402+
ClassDef(TStyle, 13) //A collection of all graphics attributes
401403
};
402404

403405

base/src/TStyle.cxx

+284-3
Large diffs are not rendered by default.

g3d/src/TAxis3D.cxx

+48-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @(#)root/g3d:$Name: $:$Id: TAxis3D.cxx,v 1.15 2003/07/12 08:08:37 brun Exp $
1+
// @(#)root/g3d:$Name: $:$Id: TAxis3D.cxx,v 1.16 2005/08/30 09:11:39 brun Exp $
22
// Author: Valery Fine([email protected]) 07/01/2000
33

44
// ***********************************************************************
@@ -35,6 +35,7 @@
3535
#include "TVirtualPad.h"
3636
#include "TVirtualX.h"
3737
#include "TBrowser.h"
38+
#include "TStyle.h"
3839

3940
//______________________________________________________________________________
4041
// The 3D axis painter class
@@ -486,14 +487,52 @@ void TAxis3D::UseCurrentStyle()
486487
//*-*-*-*-*-*Replace current attributes by current style*-*-*-*-*
487488
//*-* ===========================================
488489

489-
fAxis[0].ResetAttAxis("X");
490-
fAxis[1].ResetAttAxis("Y");
491-
fAxis[2].ResetAttAxis("Z");
492-
493-
fAxis[0].SetTitle("x"); fAxis[0].SetLabelColor(kRed); fAxis[0].SetAxisColor(kRed);
494-
fAxis[1].SetLabelColor(kGreen);fAxis[1].SetAxisColor(kGreen);
495-
fAxis[2].SetLabelColor(kBlue); fAxis[2].SetAxisColor(kBlue);
496-
490+
if (gStyle->IsReading()) {
491+
fAxis[0].ResetAttAxis("X");
492+
fAxis[1].ResetAttAxis("Y");
493+
fAxis[2].ResetAttAxis("Z");
494+
495+
fAxis[0].SetTitle("x");
496+
fAxis[0].SetLabelColor(kRed); fAxis[0].SetAxisColor(kRed);
497+
fAxis[1].SetLabelColor(kGreen); fAxis[1].SetAxisColor(kGreen);
498+
fAxis[2].SetLabelColor(kBlue); fAxis[2].SetAxisColor(kBlue);
499+
} else {
500+
gStyle->SetNdivisions (fAxis[0].GetNdivisions(), "x");
501+
gStyle->SetAxisColor (fAxis[0].GetAxisColor(), "x");
502+
gStyle->SetLabelColor (fAxis[0].GetLabelColor(), "x");
503+
gStyle->SetLabelFont (fAxis[0].GetLabelFont(), "x");
504+
gStyle->SetLabelOffset(fAxis[0].GetLabelOffset(),"x");
505+
gStyle->SetLabelSize (fAxis[0].GetLabelSize(), "x");
506+
gStyle->SetTickLength (fAxis[0].GetTickLength(), "x");
507+
gStyle->SetTitleOffset(fAxis[0].GetTitleOffset(),"x");
508+
gStyle->SetTitleSize (fAxis[0].GetTitleSize(), "x");
509+
gStyle->SetTitleColor (fAxis[0].GetTitleColor(), "x");
510+
gStyle->SetTitleFont (fAxis[0].GetTitleFont(), "x");
511+
512+
gStyle->SetNdivisions (fAxis[1].GetNdivisions(), "y");
513+
gStyle->SetAxisColor (fAxis[1].GetAxisColor(), "y");
514+
gStyle->SetLabelColor (fAxis[1].GetLabelColor(), "y");
515+
gStyle->SetLabelFont (fAxis[1].GetLabelFont(), "y");
516+
gStyle->SetLabelOffset(fAxis[1].GetLabelOffset(),"y");
517+
gStyle->SetLabelSize (fAxis[1].GetLabelSize(), "y");
518+
gStyle->SetTickLength (fAxis[1].GetTickLength(), "y");
519+
gStyle->SetTitleOffset(fAxis[1].GetTitleOffset(),"y");
520+
gStyle->SetTitleSize (fAxis[1].GetTitleSize(), "y");
521+
gStyle->SetTitleColor (fAxis[1].GetTitleColor(), "y");
522+
gStyle->SetTitleFont (fAxis[1].GetTitleFont(), "y");
523+
524+
gStyle->SetNdivisions (fAxis[2].GetNdivisions(), "z");
525+
gStyle->SetAxisColor (fAxis[2].GetAxisColor(), "z");
526+
gStyle->SetLabelColor (fAxis[2].GetLabelColor(), "z");
527+
gStyle->SetLabelFont (fAxis[2].GetLabelFont(), "z");
528+
gStyle->SetLabelOffset(fAxis[2].GetLabelOffset(),"z");
529+
gStyle->SetLabelSize (fAxis[2].GetLabelSize(), "z");
530+
gStyle->SetTickLength (fAxis[2].GetTickLength(), "z");
531+
gStyle->SetTitleOffset(fAxis[2].GetTitleOffset(),"z");
532+
gStyle->SetTitleSize (fAxis[2].GetTitleSize(), "z");
533+
gStyle->SetTitleColor (fAxis[2].GetTitleColor(), "z");
534+
gStyle->SetTitleFont (fAxis[2].GetTitleFont(), "z");
535+
}
497536
}
498537

499538
//______________________________________________________________________________

ged/inc/HelpSMText.h

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// @(#)root/ged:$Name: $:$Id: HelpSMText.h,v 1.0 2005/09/08
2+
// Author: Denis Favre-Miville 08/09/05
3+
4+
/*************************************************************************
5+
* Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6+
* All rights reserved. *
7+
* *
8+
* For the licensing terms see $ROOTSYS/LICENSE. *
9+
* For the list of contributors see $ROOTSYS/README/CREDITS. *
10+
*************************************************************************/
11+
12+
#ifndef ROOT_Rtypes
13+
#include "Rtypes.h"
14+
#endif
15+
16+
R__EXTERN const char gHelpSMTopLevel[];
17+
R__EXTERN const char gHelpSMGeneral[];
18+
R__EXTERN const char gHelpSMCanvas[];
19+
R__EXTERN const char gHelpSMPad[];
20+
R__EXTERN const char gHelpSMHistos[];
21+
R__EXTERN const char gHelpSMAxis[];
22+
R__EXTERN const char gHelpSMTitle[];
23+
R__EXTERN const char gHelpSMStats[];
24+
R__EXTERN const char gHelpSMPSPDF[];

ged/inc/LinkDef.h

+3
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,8 @@
4141
#pragma link C++ class TGedPatternSelect;
4242
#pragma link C++ class TGedMarkerSelect;
4343
#pragma link C++ class TGedMarkerPopup;
44+
#pragma link C++ class TStyleManager;
45+
#pragma link C++ class TStylePreview;
46+
#pragma link C++ class TStyleDialog;
4447

4548
#endif

ged/inc/TStyleDialog.h

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// @(#)root/ged:$Name: $:$Id: TStyleDialog.h,v 1.0 2005/09/08
2+
// Author: Denis Favre-Miville 08/09/05
3+
4+
/*************************************************************************
5+
* Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6+
* All rights reserved. *
7+
* *
8+
* For the licensing terms see $ROOTSYS/LICENSE. *
9+
* For the list of contributors see $ROOTSYS/README/CREDITS. *
10+
*************************************************************************/
11+
12+
#ifndef ROOT_TStyleDialog
13+
#define ROOT_TStyleDialog
14+
15+
//////////////////////////////////////////////////////////////////////////
16+
// //
17+
// TStyleDialog //
18+
// //
19+
// This small class is useful to ask the user for a name and a title, //
20+
// in order to rename a style, create a new style or import a //
21+
// style from a canvas. //
22+
// //
23+
//////////////////////////////////////////////////////////////////////////
24+
25+
#ifndef ROOT_TGButton
26+
#include "TGWidget.h"
27+
#endif
28+
#ifndef ROOT_TGFrame
29+
#include "TGFrame.h"
30+
#endif
31+
32+
class TGLabel;
33+
class TGTextButton;
34+
class TGTextEntry;
35+
class TGTransientFrame;
36+
class TList;
37+
class TStyle;
38+
class TStyleManager;
39+
class TVirtualPad;
40+
41+
class TStyleDialog : public TGTransientFrame {
42+
43+
private:
44+
TStyleManager *fStyleManager; // parent style manager
45+
TGTextEntry *fName; // TStyle name text entry
46+
TGLabel *fNameLabel; // name label
47+
TGTextEntry *fTitle; // TStyle title text entry
48+
TGLabel *fTitleLabel; // title label
49+
TGLabel *fWarnLabel; // label for warnings
50+
TGTextButton *fOK; // save button
51+
TGTextButton *fCancel; // cancel button
52+
TStyle *fCurStyle; // style to copy or to rename
53+
Int_t fMode; // 1=new, 2=rename, 3=import
54+
TVirtualPad *fCurPad; // current pad from which to import
55+
TList *fTrashListFrame; // to avoid memory leak
56+
TList *fTrashListLayout; // to avoid memory leak
57+
58+
public:
59+
TStyleDialog(TStyleManager *sm, TStyle *cur, Int_t mode,
60+
TVirtualPad *currentPad = 0);
61+
virtual ~TStyleDialog();
62+
63+
void DoCloseWindow(); // SLOT
64+
void DoCancel(); // SLOT
65+
void DoOK(); // SLOT
66+
void DoUpdate(); // SLOT
67+
68+
ClassDef(TStyleDialog, 0) // Dialog box used by the TStyleManager class
69+
};
70+
71+
#endif

0 commit comments

Comments
 (0)