//////////////////////////////////////
// START of File: C0_TATB.CPP
//////////////////////////////////////

//===================================================================
//
// COPYRIGHT NOTICE:  This code is protected by Copyright!
//
// Copyright (c) 1994, 1995, 1996, 1997 by DPC Technology.
// All rights reserved.
//
// See files "cf_copyr.h" and "cf_licen.h" for details of
// copyright and license specifications, and contact information.
//
//===================================================================

#include    <cf_api/c0_tatb.hpp>

#include	<cf_api/bf_defs.h>
#include    <cf_api/cf_const.h>
            // defines degrees-to-radians conversion-const used below...

//
// Implement the Chart Framework "Auto-Scale Font Spec" class.
// All functions not implemented here are implemented
// in the *.hpp file.
//

//
// Use this ctor to set up a cf_AutoScaleFontSpec from
// a "regular" bf_FontSpec:
//
cf_AutoScaleFontSpec
    ::cf_AutoScaleFontSpec( bf_FontSpec    *p_bf_fspInitialFontSpec,
                                bf_Color       bf_clrInitialTextColor,
                                bf_Color       bf_clrInitialBackColor )
{
    // Init our encapsulated zFontSpec:
    this->bf_fspBaseFontSpec = *p_bf_fspInitialFontSpec;

    // Set the angles for this Font Spec:
    this->iOrientationAngle = 0;
    this->iEscapementAngle = 0;

    // Default will be to Auto-Scale -- after all, that's
    // why we've made this damn class in the first place!
    this->bDoWeAutoScaleFontSpec = TRUE;

    // Default will be to Auto-Scale from the bf_Display*
    // ->pdsp_getVisible( zRect ) member:
    this->useDisplayRect( TRUE );

    // The Default Scale Factor Values were determined empirically,
    // on VGA at Std and High Resolution.
    this->dPctFontDimToProjDim  = C0_TATB_PCT_FONT_TO_RECT;
    this->dPctFontWidthToHeight = C0_TATB_PCT_WIDTH_TO_HEIGHT;
    this->dSetupVHRatio         = C0_TATB_DISP_VH_RATIO;
    this->dSetupScaleFactor     = C0_TATB_DEFAULT_SCALE_FAC;

    return;
}


//
// Use this "default" ctor to set up a cf_AutoScaleFontSpec
// with a SystemVariable 10pt high by 5pt wide zFontSpec,
// black text on white background:
//
cf_AutoScaleFontSpec
    ::cf_AutoScaleFontSpec()
{
    // Construct a default zFontSpec:
    this->bf_fspBaseFontSpec
            = bf_FontSpec( "SystemVariable",
                            cf_2DRect( 0, 0, 5, 10 ),
                            500 );
            // Using remaining default c-tor params of:
            //          ffDontCare,
            //          VariablePitch,
            //          0 );
            //  where last zero param implies  "No extra style bits"

    // Set the default angles for this Font Spec:
    this->iOrientationAngle = 0;
    this->iEscapementAngle = 0;

    // Default will be to Auto-Scale -- after all, that's
    // why we've made this class in the first place!
    this->bDoWeAutoScaleFontSpec = TRUE;

    // Default will be to Auto-Scale from the zDisplay*
    // ->getVisible( zRect ) member:
    this->useDisplayRect( TRUE );

    // The Default Scale Factor Values were determined empirically,
    // on VGA at Std and High Resolution.
    this->dPctFontDimToProjDim  = C0_TATB_PCT_FONT_TO_RECT;
    this->dPctFontWidthToHeight = C0_TATB_PCT_WIDTH_TO_HEIGHT;
    this->dSetupVHRatio         = C0_TATB_DISP_VH_RATIO;
    this->dSetupScaleFactor     = C0_TATB_DEFAULT_SCALE_FAC;
    return;

}   // end of c-tor



cf_AutoScaleFontSpec
    ::~cf_AutoScaleFontSpec()
        {}




//
// Return either the Auto-Scaled zFontSpec OR the BASE zFontSpec
// for this cf_AutoScaleFontSpec, depending which way the user
// has autoScale.  The controling parameter is the zRect size
// of the zDisplay*'s getVisible() zRect, and the zDisplay* is 
// usually from the user's call to a zPane->canvas().
//
// This member works best for the "3D-Grid/Tick-Series" class...
//
// Note that the ctor sets Auto-Scaling ON by default!
// 
bf_FontSpec
    cf_AutoScaleFontSpec
        ::calcFontSpec( bf_Display *p_bf_dspOutputDisplay ) 
{
    // If they don't want the cool stuff -- don't give it to 'em!
    if ( this->bDoWeAutoScaleFontSpec != TRUE ) 
    {   // Due to the lack of setAttribute() members for the zFontSpec
        // class, we'll have to pull apart the this->bf_fspBaseFontSpec,
        // and re-assemble it...
        cf_String  cf_strCurrFontSpecName
                        = this->bf_fspBaseFontSpec.fsp_faceName();

        // To get the next items of info neccessary to construct the
        // output zFontSpec, we need to push a zFont created from our
        // current zFontSpec onto the zDisplay, so we can get a zFont
        // info to grab the info out of...  
        bf_Font    *p_bf_fonCurrFontSpecFont
                    = new bf_Font( this->bf_fspBaseFontSpec );
                
        p_bf_dspOutputDisplay->dsp_pushFont( p_bf_fonCurrFontSpecFont );

        bf_FontInfo bf_fnfoCurrFontSpecInfo( p_bf_dspOutputDisplay );
    
        int iCurrFontSpecHeight = bf_fnfoCurrFontSpecInfo.fnfo_height();
                    
        int iCurrFontSpecWidth = bf_fnfoCurrFontSpecInfo.fnfo_width();

        bf_DispLogFontDim
        bf_dlfdCurrFontSpecPrPoint(    iCurrFontSpecWidth * 10, 
                                        iCurrFontSpecHeight * 10,
                                        p_bf_dspOutputDisplay );

        int iCurrFontSpecWeight = bf_fnfoCurrFontSpecInfo.fnfo_weight();
    
        bf_FontFamily  bf_ffamCurrFontSpecFamily 
                        = bf_fnfoCurrFontSpecInfo.fnfo_family();

        bf_FontPitch   bf_fpitCurrFontSpecPitch 
                        = bf_fnfoCurrFontSpecInfo.fnfo_pitch();
    
        BOOL bIsItalic = bf_fnfoCurrFontSpecInfo.fnfo_isItalic();
        BOOL bIsUnderlined = bf_fnfoCurrFontSpecInfo.fnfo_isUnderlined();
        BOOL bIsStruckOut = bf_fnfoCurrFontSpecInfo.fnfo_isStruckOut();

        int     iCurrFontSpecStyle 
                = (int) ( bIsItalic | bIsUnderlined | bIsStruckOut );

        // We can finally generate a new zFontSpec, with current
        // rotation angle, to set our bf_fspBaseFont with:
        bf_FontSpec
        bf_fspOutputFontSpec(  cf_strCurrFontSpecName,
                                bf_dlfdCurrFontSpecPrPoint,
                                iCurrFontSpecWeight,
                                bf_ffamCurrFontSpecFamily,
                                bf_fpitCurrFontSpecPitch,
                                iCurrFontSpecStyle,
                                this->iOrientationAngle,
                                this->iEscapementAngle     );

        // Now that we've got the info on the User's ORIGINAL choice
        // of zFontSpec, and have created a NEW Output Font Spec,
        // we can get rid of the zFont which we had to push on the
        // zDisplay to get the other zFontSpec information elements:
        delete p_bf_dspOutputDisplay->dsp_popFont();

        return  bf_fspOutputFontSpec;
            
    } 
    //----------------------------------------------------------
    // Otherwise, impress the hell outta 'em w/ Auto-scaling!
    //----------------------------------------------------------
    else 
    {
        if ( this->bGetDimensionsFromDisplay == TRUE ) 
        {
            cf_2DRect  cf_2drWindowRect;

            p_bf_dspOutputDisplay->dsp_getVisible( cf_2drWindowRect );
            p_bf_dspOutputDisplay->dsp_devToLog( cf_2drWindowRect );
            this->cf_2drBoundingRect = cf_2drWindowRect;
        }
        else 
        {
            // We'll get the dimensions from the current Bounding Rect:
            cf_2DRect  cf_2drCurrBoundingRectangle
                        = this->cf_2drBoundingRect;

            p_bf_dspOutputDisplay->dsp_devToLog( cf_2drCurrBoundingRectangle );
            this->cf_2drBoundingRect = cf_2drCurrBoundingRectangle;
        }

        //
        // Get information from the currently specified zFontSpec 
        // member, bf_fspBaseFontSpec, along with metric information
        // from the current output zDisplay*, to construct a temporary,
        // "scratch" zFontSpec that will be adjusted to reflect 
        // current window size, etc...
        //
        // Since zApp does NOT have any zFontSpec query OR update
        // operators, we are gonna hafta go through some contortions
        // to create a scratch zFontSpec with a zDimension parameter
        // that is appropriate to the current output display size...
        //
        // The first two params we need are faceName and output 
        // zDimension, (or, more appropriately, a zPrPoint() ):
        // 
        cf_String  cf_strCurrFontSpecName
                        = this->bf_fspBaseFontSpec.fsp_faceName();
                
        // Determine which dimension is under constraint, then
        // determine a new "font dimension" height and width.
        // Convert any neg values to absolute vals:
        int iCurrRectHeight = this->cf_2drBoundingRect.height();
        if ( iCurrRectHeight < 0 )
            iCurrRectHeight = - iCurrRectHeight;

        int iCurrRectWidth = this->cf_2drBoundingRect.width();
        if ( iCurrRectWidth < 0 ) 
            iCurrRectWidth = - iCurrRectWidth;

        int iNewFontHeight = 0;
        int iNewFontWidth = 0;

        // If have a window that is "Taller" than it is "Wide"...
        if ( iCurrRectHeight > iCurrRectWidth )
        {   //...define a font width from the constrained width:
            iNewFontWidth 
            = (int) ( ( ((double)iCurrRectWidth)
                                * (this->dPctFontDimToProjDim) )
                        / ( this->dSetupScaleFactor 
                                        * this->dSetupVHRatio ) );

            // Then define a font height from the width:
            iNewFontHeight = (int) ( ( ((double) iNewFontWidth)
                            * 100 ) / this->dPctFontWidthToHeight );
                            // note we already screened div-by-zeros!
        }
        // But most windows are "Wider" than they are "Tall":
        else
        {   //...so we define a font height from the window height:
            iNewFontHeight 
            = (int) ( (iCurrRectHeight * this->dSetupVHRatio )
                        * ((int)this->dPctFontDimToProjDim)
                                            / this->dSetupScaleFactor);
            // Then define a font width from the height:
            iNewFontWidth = (int) ( iNewFontHeight
                            * this->dPctFontWidthToHeight / 100 );
                            
        }   // Font now sized to mimimum dimension constraint!


        // Now that we have our new font width and height,
        // generate a "logical font dimension":
        bf_DispLogFontDim
        bf_dlfdAutoScaleFontSpecPrPoint(   iNewFontWidth,
                                            iNewFontHeight,
                                            p_bf_dspOutputDisplay );
                
        // To get the next items of info neccessary to construct the
        // output zFontSpec, we need to push a zFont created from our
        // current zFontSpec onto the zDisplay, so we can get a zFont 
        // info.  
        bf_Font    *p_bf_fonCurrFontSpecFont
                    = new bf_Font( this->bf_fspBaseFontSpec );
                
        p_bf_dspOutputDisplay->dsp_pushFont( p_bf_fonCurrFontSpecFont );

        bf_FontInfo bf_fnfoCurrFontSpecInfo( p_bf_dspOutputDisplay );
    
        int         iCurrFontSpecWeight 
                    = bf_fnfoCurrFontSpecInfo.fnfo_weight();

        bf_FontFamily  bf_ffamCurrFontSpecFamily 
                        = bf_fnfoCurrFontSpecInfo.fnfo_family();

        bf_FontPitch   bf_fpitCurrFontSpecPitch 
                        = bf_fnfoCurrFontSpecInfo.fnfo_pitch();
    
        BOOL    bIsItalic 
                = bf_fnfoCurrFontSpecInfo.fnfo_isItalic();
        BOOL    bIsUnderlined 
                = bf_fnfoCurrFontSpecInfo.fnfo_isUnderlined();
        BOOL    bIsStruckOut 
                = bf_fnfoCurrFontSpecInfo.fnfo_isStruckOut();
    
        int     iCurrFontSpecStyle = (int) ( bIsItalic
                                            | bIsUnderlined 
                                            | bIsStruckOut );

        // We can finally generate our return val, the
        // Scaled Font Spec:
        bf_FontSpec
        bf_fspScaledFontSpec(  cf_strCurrFontSpecName,
                                bf_dlfdAutoScaleFontSpecPrPoint,
                                iCurrFontSpecWeight,
                                bf_ffamCurrFontSpecFamily,
                                bf_fpitCurrFontSpecPitch,
                                iCurrFontSpecStyle,
                                this->iOrientationAngle,
                                this->iEscapementAngle    );

        // Now that we've got the info on the User's ORIGINAL choice
        // of zFontSpec, and have created a NEW Output Font Spec,
        // we can get rid of the zFont which we had to push on the
        // zDisplay to get the other zFontSpec information elements:
        delete p_bf_dspOutputDisplay->dsp_popFont();

        return bf_fspScaledFontSpec;

    }

}   // end of ::calcFontSpec( bf_Display *p_bf_dspOutputDisplay ) 
    

//-------------------------------------------------
// Some derived & user classes will need to rotate
// the FontSpec DYNAMICALLY:
//-------------------------------------------------
/*
void
    cf_AutoScaleFontSpec
        ::displayAtAngle(   bf_Display *p_bf_dspOutputDisplay,
                            int         iAngleInClockwiseDegrees )
{
    //
    // Update necc. members:
    //
    this->iOrientationAngle = iAngleInClockwiseDegrees * 10;
    this->iEscapementAngle = iAngleInClockwiseDegrees * 10;
    
    //
    // Now -- the dynamicly auto-scaled font regenerates the
    // orientation and escapment angles every time, BUT
    // if the user does a autoScale( FALSE ) the BASE
    // font spec would not display with a font rotation.
    // So, we STILL have to update the bf_fspBaseFontSpec member,
    // to display non-autoscaled font specs properly...
    //
                    
    //
    // Due to the lack of setAttribute() members for the zFontSpec
    // class, we'll have to pull apart the this->bf_fspBaseFontSpec,
    // and re-assemble it...
    // 
    cf_String  cf_strCurrFontSpecName
                    = this->bf_fspBaseFontSpec.fsp_faceName();

    //
    // To get the next items of info neccessary to construct the
    // output zFontSpec, we need to push a zFont created from our
    // current zFontSpec onto the zDisplay, so we can get a zFont
    // info. 
    //
    bf_Font    *p_bf_fonCurrFontSpecFont
                = new bf_Font( this->bf_fspBaseFontSpec );
                
    p_bf_dspOutputDisplay->dsp_pushFont( p_bf_fonCurrFontSpecFont );

    bf_FontInfo    bf_fnfoCurrFontSpecInfo( p_bf_dspOutputDisplay );

    int         iCurrFontSpecHeight 
                = bf_fnfoCurrFontSpecInfo.fnfo_height();
    int         iCurrFontSpecWidth
                = bf_fnfoCurrFontSpecInfo.fnfo_width();
        
    bf_DispLogFontDim
    bf_dlfdCurrFontSpecPrPoint(    iCurrFontSpecWidth, 
                                    iCurrFontSpecHeight,  
                                    p_bf_dspOutputDisplay );

    int             iCurrFontSpecWeight 
                    = bf_fnfoCurrFontSpecInfo.fnfo_weight();
    
    bf_FontFamily  bf_ffamCurrFontSpecFamily
                    = bf_fnfoCurrFontSpecInfo.fnfo_family();

    bf_FontPitch   bf_fpitCurrFontSpecPitch
                    = bf_fnfoCurrFontSpecInfo.fnfo_pitch();
    
    BOOL            bIsItalic
                    = bf_fnfoCurrFontSpecInfo.fnfo_isItalic();
    BOOL            bIsUnderlined 
                    = bf_fnfoCurrFontSpecInfo.fnfo_isUnderlined();
    BOOL            bIsStruckOut 
                    = bf_fnfoCurrFontSpecInfo.fnfo_isStruckOut();
    
    int             iCurrFontSpecStyle = (int) ( bIsItalic 
                                                | bIsUnderlined 
                                                | bIsStruckOut );

    //
    // We can finally generate a new zFontSpec, with
    // the new rotation angle, to set our bf_fspBaseFont 
    // with:
    //
    bf_FontSpec    
        bf_fspRotatedFontSpec( cf_strCurrFontSpecName,
                                bf_dlfdCurrFontSpecPrPoint,
                                iCurrFontSpecWeight,
                                bf_ffamCurrFontSpecFamily,
                                bf_fpitCurrFontSpecPitch,
                                iCurrFontSpecStyle,
                                this->iOrientationAngle,
                                this->iEscapementAngle );

    //
    // Now that we've got the info on the User's ORIGINAL choice
    // of zFontSpec, and have created a NEW Output Font Spec,
    // we can get rid of the zFont which we had to push on the
    // zDisplay to get the other zFontSpec information elements:
    //
    delete p_bf_dspOutputDisplay->dsp_popFont();

    //
    // We'll now set our Base Font Spec to the newly
    // created (and soon to dissappear...) Rotated Font Spec;
    //
    this->bf_fspBaseFontSpec = bf_fspRotatedFontSpec;

    return;

}   // end of ::displayAtAngle( bf_Display *p_bf_dspOutputDisplay,

*/



//-------------------------------------------------------------
// The user also needs the ability to set the Scale Factors:
//-------------------------------------------------------------
void
    cf_AutoScaleFontSpec
        ::preferFontToProjRectPct( double   dNewVal )
{ 
    this->dPctFontDimToProjDim = dNewVal;
    // Screen for bogosities!
    if ( this->dPctFontDimToProjDim <= 0.0 )
        this->dPctFontDimToProjDim = C0_TATB_PCT_FONT_TO_RECT;
    // which will guard against foolishness (like div-by-zeros)!...
    return;
}

double
    cf_AutoScaleFontSpec
        ::preferFontToProjRectPct()
            { return this->dPctFontDimToProjDim; }

void
    cf_AutoScaleFontSpec
        ::preferWidthToHeightPct( double dNewVal )
{ 
    this->dPctFontWidthToHeight = dNewVal;
    // Screen for bogosities!
    if ( this->dPctFontWidthToHeight <= 0.0 )
        this->dPctFontWidthToHeight = C0_TATB_PCT_WIDTH_TO_HEIGHT;
    // which will guard against foolishness (like div-by-zeros)!...
    return;
}

double
    cf_AutoScaleFontSpec
        ::preferWidthToHeightPct()
            { return this->dPctFontWidthToHeight; }


//------------------------------------------------------------
// Get/set division factor against projected rectangle
// dimensions to yield auto-scaled font dinensions.
// For expert use only. "Normal" users should rely on
// c-tor init value of C0_TATB_DEFAULT_SCALE_FAC.
//------------------------------------------------------------
void
    cf_AutoScaleFontSpec
        ::setupScaleFactor( double dNewVal )
{
    this->dSetupScaleFactor = dNewVal;
    // Screen for bogosities!
    if ( this->dSetupScaleFactor <= 0.0 )
        this->dSetupScaleFactor = C0_TATB_DEFAULT_SCALE_FAC;
    return;
}

double
    cf_AutoScaleFontSpec
        ::setupScaleFactor()
            { return this->dSetupScaleFactor; }

//------------------------------------------------------------
// Get/set the ratio of vertical to horizontal pixels
// (e.g. for typical VGA monitors == 640/480 or 1024/768 ).  
// For expert use only. "Normal" users should rely on
// c-tor init value of C0_TATB_DISP_VH_RATIO.
//------------------------------------------------------------
void
    cf_AutoScaleFontSpec
        ::setupVHRatio( double dNewVal )
{
    this->dSetupVHRatio = dNewVal; 
    // Screen for bogosities!
    if ( this->dSetupVHRatio <= 0.0 )
        this->dSetupVHRatio = C0_TATB_DISP_VH_RATIO;
    return;
}

double
    cf_AutoScaleFontSpec
        ::setupVHRatio()
            { return this->dSetupVHRatio; }




//-------------------------------------------------------------
// Set the mode of the AutoFontSpec calc to use one of:
// 1) A Bounding Rect specified by a zRect,
// 2) A Bounding Rect specified by a zDimension,
// 3) The zDisplay*->getVisible( zRect ) member:
//
//-------------------------------------------------------------
void    
    cf_AutoScaleFontSpec
        ::useBoundingRect( cf_2DRect cf_2drUseThisRect )
{
    this->cf_2drBoundingRect = cf_2drUseThisRect;
    this->bGetDimensionsFromDisplay = FALSE;
}


void
    cf_AutoScaleFontSpec
        ::useDisplayRect( BOOL bNewState )
            { this->bGetDimensionsFromDisplay = bNewState; }


BOOL
    cf_AutoScaleFontSpec
        ::useDisplayRectIs()
            { return this->bGetDimensionsFromDisplay; }

//
// END of cf_AutoScaleFontSpec Implementation.
//



//=============================================
// Implement the Text-Attrib Collection Object:
//=============================================
cf_TextAttribs::cf_TextAttribs()
        : cf_AutoScaleFontSpec()
{
    ctorInit();
}


cf_TextAttribs::cf_TextAttribs
                (   bf_Color    bf_clrTextForeground,
                    bf_Color    bf_clrTextBackground )
{
    ctorInit();
    bf_clrTextForeground_ = bf_clrTextForeground;
    bf_clrTextBackground_ = bf_clrTextBackground;
}


void
cf_TextAttribs::ctorInit()
{
    shiftVertCtr();
    shiftHorzCtr();
    bf_clrTextForeground_ = CF_BLACK;
    bf_clrTextBackground_ = CF_WHITE;
    cf_strPreferredNumFormat_ = "%g";
}


cf_TextAttribs::~cf_TextAttribs()
{
}


//-------------------------------------------------------------
// The user also needs the ability to set the "static" angles:
//-------------------------------------------------------------
void
cf_TextAttribs::angleRotationPrefer
                    ( int  iAngleInClockwiseDegrees )
{
    // Update necc. members:
    this->iOrientationAngle = iAngleInClockwiseDegrees * 10;
    this->iEscapementAngle = iAngleInClockwiseDegrees * 10;
}

int
cf_TextAttribs::angleRotationDegrees()
{
    return ( this->iOrientationAngle / 10 );
}

double
cf_TextAttribs::angleRotationRadians()
{
    return( ( (double) (iOrientationAngle / 10 ) ) * CF_PI_OVER_180 );
}



//
// The user MUST have the ability to turn the Auto-Scale
// feature on or off...
//
BOOL
    cf_TextAttribs
        ::autoScale()
            { return this->bDoWeAutoScaleFontSpec; }


void
    cf_TextAttribs
        ::autoScale( BOOL bNewState )
            { this->bDoWeAutoScaleFontSpec = bNewState; }


//
// The User should be able to get the Base Font Spec,
// so they can use zFontSelDialogs. etc:
//
bf_FontSpec*
    cf_TextAttribs
        ::baseFontSpec()
            { return &(this->bf_fspBaseFontSpec); }

//
// The user should also be able to SET the Base Font Spec,
// with the typical return vals from a zFontSelDialog, etc.
//
void
    cf_TextAttribs
        ::baseFontSpec( bf_FontSpec    *p_bf_fspNewFontSpec )
            { this->bf_fspBaseFontSpec = *p_bf_fspNewFontSpec; }  
//------------------------------------------
// Methods to control Auto-Scaling Behavior:
//------------------------------------------
void
cf_TextAttribs::autoScalePercent
                ( double dUsingMinimumChartDimensionXY )
{
    autoScale( TRUE );
    preferFontToProjRectPct( dUsingMinimumChartDimensionXY );
}


double
cf_TextAttribs::autoScalePercent()
{
    return( preferFontToProjRectPct() );
}


//-----------------------------------------
// Methods to manipulate Color-Attributes:
//-----------------------------------------
bf_Color
cf_TextAttribs::colorTextFore()
{
    return( bf_clrTextForeground_ );
}

BOOL
cf_TextAttribs::colorTextFore
                ( bf_Color bf_clrNew )
{
    bf_clrTextForeground_ = bf_clrNew;
    return( TRUE );
}

bf_Color
cf_TextAttribs::colorTextBack()
{
    return( bf_clrTextBackground_ );
}

BOOL
cf_TextAttribs::colorTextBack
                ( bf_Color bf_clrNew )
{
    bf_clrTextBackground_ = bf_clrNew;
    return( TRUE );
}



//------------------------------------------------
// Methods to manipulate String Output Format(s):
//------------------------------------------------
cf_String
cf_TextAttribs::formatNumPrefer()
{
    return( cf_strPreferredNumFormat_  );
}

void
cf_TextAttribs::formatNumPrefer( const char *p_strSprintfFormatString )
{
    cf_strPreferredNumFormat_ = p_strSprintfFormatString;
}


//------------------------------------------------------
// Methods to manipulate Text-Attrib Position-Shift(s):
//------------------------------------------------------
void
cf_TextAttribs::shiftVertUp()
{
    bVertShiftUp_ = TRUE;
    bVertShiftDown_ = FALSE;
    bVertCentered_ = FALSE;

    bStaggerUpDown_ = FALSE;
    bStaggerDownUp_ = FALSE;
}

BOOL
cf_TextAttribs::shiftVertUpIs()
{
    return bVertShiftUp_;
}



void
cf_TextAttribs::shiftVertDown()
{
    bVertShiftUp_ = FALSE;
    bVertShiftDown_ = TRUE;
    bVertCentered_ = FALSE;

    bStaggerUpDown_ = FALSE;
    bStaggerDownUp_ = FALSE;
}

BOOL
cf_TextAttribs::shiftVertDownIs()
{
    return bVertShiftDown_;
}



void
cf_TextAttribs::shiftVertCtr()
{
    bVertShiftUp_ = FALSE;
    bVertShiftDown_ = FALSE;
    bVertCentered_ = TRUE;

    bStaggerUpDown_ = FALSE;
    bStaggerDownUp_ = FALSE;
}


BOOL
cf_TextAttribs::shiftVertCtrIs()
{
    return bVertCentered_;
}



void
cf_TextAttribs::shiftHorzLeft()
{
    bHorizShiftLeft_ = TRUE;
    bHorizShiftRight_ = FALSE;
    bHorizCentered_ = FALSE;
}


BOOL
cf_TextAttribs::shiftHorzLeftIs()
{
    return bHorizShiftLeft_;
}



void
cf_TextAttribs::shiftHorzRight()
{
    bHorizShiftLeft_ = FALSE;
    bHorizShiftRight_ = TRUE;
    bHorizCentered_ = FALSE;
}

BOOL
cf_TextAttribs::shiftHorzRightIs()
{
    return bHorizShiftRight_;
}



void
cf_TextAttribs::shiftHorzCtr()
{
    bHorizShiftLeft_ = FALSE;
    bHorizShiftRight_ = FALSE;
    bHorizCentered_ = TRUE;
}

BOOL
cf_TextAttribs::shiftHorzCtrIs()
{
    return bHorizCentered_;
}




void
cf_TextAttribs::staggerUpDown()
{
    bStaggerUpDown_ = TRUE;
    bStaggerDownUp_ = FALSE;
}

BOOL
cf_TextAttribs::staggerUpDownIs()
{
    return bStaggerUpDown_;
}

void
cf_TextAttribs::staggerDownUp()
{
    bStaggerUpDown_ = FALSE;
    bStaggerDownUp_ = TRUE;
}

BOOL
cf_TextAttribs::staggerDownUpIs()
{
    return bStaggerDownUp_;
}

//
// END of class cf_TextAttribs Implementation
//


//////////////////////////////////////
// END of File: C0_TATB.CPP
//////////////////////////////////////

