View Raw SPL
/*****************************************************************************
*                                                                            *
*   WINCAPTION.SPL   Copyright (C) 2012 DSP Development Corporation          *
*                               All Rights Reserved                          *
*                                                                            *
*   Author:       Randy Race                                                 *
*                                                                            *
*   Synopsis:     Enables or disables the custom window caption font         *
*                                                                            *
*   Revisions:    28 Jun 2012  RRR  Creation                                 *
*                                                                            *
*****************************************************************************/


#if @HELP_WINCAPTION

    WINCAPTION

    Purpose: Enables or disables the custom window caption font.

    Syntax:  WINCAPTION(mode, redraw)

                mode - Optional. An integer, 0: use system caption font, 
                       1: use WINLABEL_FONT. If unspecified, the current
                       caption font mode is returned.

              redraw - Optional. An integer, redraw flag, 0: do not
                       redraw windows, 1: redraw all windows to adjust
                       caption (default).

    Returns: An integer, the previous caption mode.

    Example:
             wincaption(1)

             Enables custom window captions for all worksheet windows.
             The window caption font is set to the font specified by
             WINLABEL_FONT and the caption is adjusted to fit the font
             height.

    Example:
             wincaption(0)

             The window caption is defaulted to the system caption font.

    Remarks:
             WINCAPTION enables or disables the use of WINLABEL_FONT to
             specify the window caption and applies to all worksheet
             windows.

             WINLABEL_FONT still applies to the caption of hardcopy
             output even if the WINCAPTION mode is 0.

    See Also:
             Redrawall
#endif


/* enable or disable custom caption font */
wincaption(val, redraw)
{
        local prev;

        if (argc < 2)
        {
                if (argc < 1)
                {
                        /* just report state */
                        val = -1;
                }

                redraw = 1;
        }

        /* get previous caption font configuration parameter */
        prev = not(castint(getconf("gui_system_font_caption")));

        if (val >= 0)
        {
                /* set caption font configuration parameter */
                setconf("gui_system_font_caption", caststring(not(val)));

                if (redraw)
                {
                        /* update all windows */
                        redrawall(3);
                }
        }

        return(prev);
}