@@ -124,7 +124,7 @@ struct XWindow_t {
124124 std::vector<XPoint> markerShape; // /< marker shape points
125125 Int_t markerLineWidth = 0 ; // /< line width used for marker
126126 TAttText fAttText ; // /< current text attribute
127- Int_t textAlign = 0 ; // /< selected text align
127+ TGX11 ::EAlign textAlign = TGX11 :: kAlignNone ; // /< selected text align
128128 XFontStruct *textFont = nullptr ; // /< selected text font
129129};
130130
@@ -213,9 +213,6 @@ TGX11::TGX11()
213213 fDepth = 0 ;
214214 fHasTTFonts = kFALSE ;
215215 fHasXft = kFALSE ;
216- fTextAlignH = 1 ;
217- fTextAlignV = 1 ;
218- fTextAlign = 7 ;
219216 fTextMagnitude = 1 ;
220217 for (i = 0 ; i < kNumCursors ; i++) fCursors [i] = 0 ;
221218}
@@ -247,9 +244,6 @@ TGX11::TGX11(const char *name, const char *title) : TVirtualX(name, title)
247244 fDepth = 0 ;
248245 fHasTTFonts = kFALSE ;
249246 fHasXft = kFALSE ;
250- fTextAlignH = 1 ;
251- fTextAlignV = 1 ;
252- fTextAlign = 7 ;
253247 fTextMagnitude = 1 ;
254248 for (i = 0 ; i < kNumCursors ; i++)
255249 fCursors [i] = 0 ;
@@ -272,9 +266,6 @@ TGX11::TGX11(TGX11 &&org) : TVirtualX(org)
272266 fWhitePixel = org.fWhitePixel ;
273267 fHasTTFonts = org.fHasTTFonts ;
274268 fHasXft = org.fHasXft ;
275- fTextAlignH = org.fTextAlignH ;
276- fTextAlignV = org.fTextAlignV ;
277- fTextAlign = org.fTextAlign ;
278269 fTextMagnitude = org.fTextMagnitude ;
279270 fCharacterUpX = org.fCharacterUpX ;
280271 fCharacterUpY = org.fCharacterUpY ;
@@ -862,12 +853,12 @@ void TGX11::DrawTextW(WinContext_t wctxt, Int_t x, Int_t y, Float_t angle, Float
862853
863854 case kClear :
864855 XRotDrawAlignedString ((Display*)fDisplay , ctxt->textFont , angle,
865- ctxt->fDrawing , ctxt->fGClist [kGCtext ], x, y, (char *)text, ctxt->textAlign );
856+ ctxt->fDrawing , ctxt->fGClist [kGCtext ], x, y, (char *)text, ( int ) ctxt->textAlign );
866857 break ;
867858
868859 case kOpaque :
869860 XRotDrawAlignedImageString ((Display*)fDisplay , ctxt->textFont , angle,
870- ctxt->fDrawing , ctxt->fGClist [kGCtext ], x, y, (char *)text, ctxt->textAlign );
861+ ctxt->fDrawing , ctxt->fGClist [kGCtext ], x, y, (char *)text, ( int ) ctxt->textAlign );
871862 break ;
872863
873864 default :
@@ -1077,10 +1068,10 @@ void *TGX11::GetGCW(WinContext_t wctxt, Int_t which) const
10771068// / Return text align value for specified window context.
10781069// / Protected method used by TGX11TTF.
10791070
1080- Int_t TGX11::GetTextAlignW (WinContext_t wctxt) const
1071+ TGX11 ::EAlign TGX11::GetTextAlignW (WinContext_t wctxt) const
10811072{
10821073 auto ctxt = (XWindow_t *) wctxt;
1083- return ctxt ? ctxt->textAlign : 0 ;
1074+ return ctxt ? ctxt->textAlign : kAlignNone ;
10841075}
10851076
10861077// //////////////////////////////////////////////////////////////////////////////
@@ -2653,9 +2644,6 @@ void TGX11::SetTextAlign(Short_t talign)
26532644 arg.SetTextAlign (talign);
26542645
26552646 SetAttText ((WinContext_t) gCws , arg);
2656-
2657- // FIXME: member fTextAlign conflicts with TAttText::fTextAlign
2658- fTextAlign = gCws ->textAlign ;
26592647}
26602648
26612649// //////////////////////////////////////////////////////////////////////////////
@@ -3863,44 +3851,46 @@ void TGX11::SetAttText(WinContext_t wctxt, const TAttText &att)
38633851 Int_t txalh = att.GetTextAlign () / 10 ;
38643852 Int_t txalv = att.GetTextAlign () % 10 ;
38653853
3854+ ctxt->textAlign = kAlignNone ;
3855+
38663856 switch (txalh) {
38673857 case 0 :
38683858 case 1 :
38693859 switch (txalv) { // left
38703860 case 1 :
3871- ctxt->textAlign = 7 ; // bottom
3861+ ctxt->textAlign = kBLeft ; // bottom
38723862 break ;
38733863 case 2 :
3874- ctxt->textAlign = 4 ; // center
3864+ ctxt->textAlign = kMLeft ; // middle
38753865 break ;
38763866 case 3 :
3877- ctxt->textAlign = 1 ; // top
3867+ ctxt->textAlign = kTLeft ; // top
38783868 break ;
38793869 }
38803870 break ;
38813871 case 2 :
38823872 switch (txalv) { // center
38833873 case 1 :
3884- ctxt->textAlign = 8 ; // bottom
3874+ ctxt->textAlign = kBCenter ; // bottom
38853875 break ;
38863876 case 2 :
3887- ctxt->textAlign = 5 ; // center
3877+ ctxt->textAlign = kMCenter ; // middle
38883878 break ;
38893879 case 3 :
3890- ctxt->textAlign = 2 ; // top
3880+ ctxt->textAlign = kTCenter ; // top
38913881 break ;
38923882 }
38933883 break ;
38943884 case 3 :
38953885 switch (txalv) { // right
38963886 case 1 :
3897- ctxt->textAlign = 9 ; // bottom
3887+ ctxt->textAlign = kBRight ; // bottom
38983888 break ;
38993889 case 2 :
3900- ctxt->textAlign = 6 ; // center
3890+ ctxt->textAlign = kMRight ; // center
39013891 break ;
39023892 case 3 :
3903- ctxt->textAlign = 3 ; // top
3893+ ctxt->textAlign = kTRight ; // top
39043894 break ;
39053895 }
39063896 break ;
0 commit comments