Example #1
0
/*
 * ReadConfig - read the configuration information
 */
void ReadConfig( void )
{
    char        msgfilter[MFILTER_LAST_MSG - MFILTER_FIRST_MSG + 2];
    char        cbfilter[CFILTER_LAST_MSG - CFILTER_FIRST_MSG + 2];
    char        buf[10];
    WORD        i;

    GetConfigFilePath( iniPath, sizeof( iniPath ) );
    strcat( iniPath, "\\" WATCOM_INI );

    setGlobalDefault();
    SetTrackWndDefault();
    SetMainWndDefault();

    Monitoring[MON_SENT_IND] = GetPrivateProfileInt( SECT_NAME, MONSENT, TRUE, iniPath );
    Monitoring[MON_POST_IND] = GetPrivateProfileInt( SECT_NAME, MONPOST, TRUE, iniPath );
    Monitoring[MON_CB_IND] = GetPrivateProfileInt( SECT_NAME, MONCB, TRUE, iniPath );
    Monitoring[MON_STR_IND] = GetPrivateProfileInt( SECT_NAME, MONSTR, TRUE, iniPath );
    Monitoring[MON_ERR_IND] = GetPrivateProfileInt( SECT_NAME, MONERR, TRUE, iniPath );
    Monitoring[MON_LNK_IND] = GetPrivateProfileInt( SECT_NAME, MONLNK, TRUE, iniPath );
    Monitoring[MON_CONV_IND] = GetPrivateProfileInt( SECT_NAME, MONCONV, TRUE, iniPath );

    /* global settings */

    ConfigInfo.scroll = GetPrivateProfileInt( SECT_NAME, CFG_SCROLL,
                                              ConfigInfo.scroll, iniPath );
    ConfigInfo.alias = GetPrivateProfileInt( SECT_NAME, CFG_ALIAS,
                                             ConfigInfo.alias, iniPath );
    ConfigInfo.screen_out = GetPrivateProfileInt( SECT_NAME, CFG_SCREEN,
                                                  ConfigInfo.screen_out, iniPath );
    ConfigInfo.show_tb = GetPrivateProfileInt( SECT_NAME, CFG_SHOW_TB,
                                               ConfigInfo.show_tb, iniPath );
    ConfigInfo.show_hints = GetPrivateProfileInt( SECT_NAME, CFG_SHOW_HINTS,
                                                  ConfigInfo.show_hints, iniPath );
    ConfigInfo.on_top = GetPrivateProfileInt( SECT_NAME, CFG_ON_TOP,
                                              ConfigInfo.on_top, iniPath );

    /* window size/pos info */
    for( i = 0; i < NO_TRK_WND; i++ ) {
        itoa( i, buf, 10 );
        readWindowInfo( Tracking + i, buf );
    }
    readWindowInfo( &MainWndConfig, MAIN_WND_EXT );

    /* filter info */
    memset( msgfilter, '1', sizeof( msgfilter ) );
    msgfilter[MFILTER_LAST_MSG - MFILTER_FIRST_MSG + 1] = '\0';
    memset( cbfilter, '1', sizeof( cbfilter ) );
    cbfilter[CFILTER_LAST_MSG - CFILTER_FIRST_MSG + 1] = '\0';
    GetPrivateProfileString( SECT_NAME, MSGFLTER, msgfilter, msgfilter,
                             MFILTER_LAST_MSG - MFILTER_FIRST_MSG + 2, iniPath );
    GetPrivateProfileString( SECT_NAME, CBFLTER, cbfilter, cbfilter,
                             CFILTER_LAST_MSG - CFILTER_FIRST_MSG + 2, iniPath );
    SetFilter( msgfilter, cbfilter );

    /* logging info */
    LoadLogConfig( iniPath, SECT_NAME );
    InitMonoFont( SECT_NAME, iniPath, SYSTEM_FIXED_FONT, Instance );

} /* ReadConfig */
Example #2
0
File: Config.cpp Project: imace/kkS
bool Config::Init(const CHAR* argv0)
{
__ENTER_FUNCTION_EX

	LoadLogConfig(argv0) ;

	return true ;

__LEAVE_FUNCTION_EX

	return false ;
}
Example #3
0
/*
 * LoadSpyConfig - get configuration from a profile file
 */
void LoadSpyConfig( char *fname )
{
    char        *str, *vals;
    int         i, j, k;
    int         x, y;
    int         check;

    str = alloca( TotalMessageArraySize + 1 );
    vals = alloca( TotalMessageArraySize + 1 );
    for( i = 0; i < FILTER_ENTRIES; i++ ) {
        Filters[i].flag[M_WATCH] = TRUE;
        Filters[i].flag[M_STOPON] = FALSE;
    }
    if( fname == NULL ) {
        GetConfigFilePath( iniPath, sizeof( iniPath ) );
        strcat( iniPath, "\\" WATCOM_INI );
        fname = iniPath;
        LoadLogConfig( fname, spyApp );
        InitMonoFont( spyApp, fname, SYSTEM_FIXED_FONT, Instance );

        x = GetSystemMetrics( SM_CXSCREEN );
        y = GetSystemMetrics( SM_CYSCREEN );

        /* set defaults */
        SpyMainWndInfo.xpos = x / 8 - x / 16;
        SpyMainWndInfo.ypos = y / 8;
        SpyMainWndInfo.xsize = 3 * (x / 4) + x / 8;
        SpyMainWndInfo.ysize = 3 * (y / 4);
        SpyMainWndInfo.on_top = false;
        SpyMainWndInfo.show_hints = true;
        SpyMainWndInfo.show_toolbar = true;

        /* load configured values */
        SpyMainWndInfo.xpos = GetPrivateProfileInt( spyApp, "wnd_xpos",
                                                    SpyMainWndInfo.xpos, fname );
        SpyMainWndInfo.ypos = GetPrivateProfileInt( spyApp, "wnd_ypos",
                                                    SpyMainWndInfo.ypos, fname );
        SpyMainWndInfo.xsize = GetPrivateProfileInt( spyApp, "wnd_xsize",
                                                     SpyMainWndInfo.xsize, fname );
        SpyMainWndInfo.ysize = GetPrivateProfileInt( spyApp, "wnd_ysize",
                                                     SpyMainWndInfo.ysize, fname );
        SpyMainWndInfo.on_top = GetPrivateProfileInt( spyApp, "wnd_topmost", SpyMainWndInfo.on_top, fname ) != 0;
        SpyMainWndInfo.show_hints = GetPrivateProfileInt( spyApp, "show_hint", SpyMainWndInfo.show_hints, fname ) != 0;
        SpyMainWndInfo.show_toolbar = GetPrivateProfileInt( spyApp, "show_toolbar", SpyMainWndInfo.show_toolbar, fname ) != 0;
    }

    /*
     * what specific messages to watch
     */
    memset( vals, '1', TotalMessageArraySize );
    vals[TotalMessageArraySize] = 0;
    GetPrivateProfileString( spyApp, "watch", vals, str,
                             TotalMessageArraySize + 1, fname );

    for( j = 0, i = 0; j < ClassMessagesSize; j++ ) {
        for( k = 0; k < ClassMessages[j].message_array_size; k++ ) {
            ClassMessages[j].message_array[k].bits[M_WATCH] = ( str[i++]  != '0');
        }
    }

    /*
     * what specific messages to stop on
     */
    memset( vals, '0', TotalMessageArraySize );
    GetPrivateProfileString( spyApp, "stopon", vals, str,
                             TotalMessageArraySize + 1, fname );
    for( j = 0, i = 0; j < ClassMessagesSize; j++ ) {
        for( k = 0; k < ClassMessages[j].message_array_size; k++ ) {
            ClassMessages[j].message_array[k].bits[M_STOPON] = ( str[i++]  == '1');
        }
    }

    /*
     * what message classes to watch
     */
    memset( vals, '1', FILTER_ENTRIES );
    vals[FILTER_ENTRIES] = 0;
    GetPrivateProfileString( spyApp, "watchclasses", vals, str,
                             FILTER_ENTRIES + 1, fname );
    for( i = 0; i < FILTER_ENTRIES; i++ ) {
        Filters[i].flag[M_WATCH] = ( str[i]  != '0');
    }

    /*
     * what message classes to stopon
     */
    memset( vals, '0', FILTER_ENTRIES );
    GetPrivateProfileString( spyApp, "stoponclasses", vals, str,
                             FILTER_ENTRIES + 1, fname );
    for( i = 0; i < FILTER_ENTRIES; i++ ) {
        Filters[i].flag[M_STOPON] = ( str[i] == '1' );
    }

    /*
     * get misc info
     */
    vals[0] = '1';
    vals[1] = 0;
    GetPrivateProfileString( spyApp, "autosavecfg", vals, str, 2, fname );
    AutoSaveConfig = ( str[0]  != '0');
    if( AutoSaveConfig ) {
        check = MF_CHECKED;
    } else {
        check = MF_UNCHECKED;
    }
    CheckMenuItem( SpyMenu, SPY_MESSAGES_ASCFG, check );

} /* LoadSpyConfig */