示例#1
0
Error ThemeManager::GetDefaultTheme(string &oThemePath)
{
    map<string, string> oThemeList;

    GetThemeList(oThemeList);

    char *themeName = new char[strlen(BRANDING_DEFAULT_THEME) + 1];
    strcpy(themeName, BRANDING_DEFAULT_THEME);
    char *dot;

    if ((dot = strchr(themeName, '.')))
        *dot = '\0';

    string strName = themeName;
    oThemePath = oThemeList[strName];

    delete [] themeName;

    return kError_NoErr;
}
LRESULT PropPageTextStyles::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	memset(&m_Font, 0, sizeof(m_Font));
	m_Preview.disable_chat_cache();
	PropPage::translate((HWND)(*this), texts);
	PropPage::read((HWND)*this, items);
	
	m_maincolor_changed = false;
	m_tempfile = Text::toT(Util::getThemesPath() + "temp.dctmp");
	
	m_lsbList.Attach(GetDlgItem(IDC_TEXT_STYLES));
	m_lsbList.ResetContent();
	m_Preview.Attach(GetDlgItem(IDC_PREVIEW));
	
	Fonts::decodeFont(Text::toT(SETTING(TEXT_FONT)), m_Font);
	m_BackColor = SETTING(BACKGROUND_COLOR);
	m_ForeColor = SETTING(TEXT_COLOR);
	
	fg = SETTING(TEXT_COLOR);
	bg = SETTING(BACKGROUND_COLOR);
	
	TextStyles[ TS_GENERAL ].Init(
	    this, (char*)CSTRING(GENERAL_TEXT), (char*)CSTRING(GENERAL_TEXT),
	    SettingsManager::TEXT_GENERAL_BACK_COLOR, SettingsManager::TEXT_GENERAL_FORE_COLOR,
	    SettingsManager::TEXT_GENERAL_BOLD, SettingsManager::TEXT_GENERAL_ITALIC);
	    
	TextStyles[ TS_MYNICK ].Init(
	    this, (char*)CSTRING(MY_NICK), (char*)CSTRING(MY_NICK),
	    SettingsManager::TEXT_MYNICK_BACK_COLOR, SettingsManager::TEXT_MYNICK_FORE_COLOR,
	    SettingsManager::TEXT_MYNICK_BOLD, SettingsManager::TEXT_MYNICK_ITALIC);
	    
	TextStyles[ TS_MYMSG ].Init(
	    this, (char*)CSTRING(MY_MESSAGE), (char*)CSTRING(MY_MESSAGE),
	    SettingsManager::TEXT_MYOWN_BACK_COLOR, SettingsManager::TEXT_MYOWN_FORE_COLOR,
	    SettingsManager::TEXT_MYOWN_BOLD, SettingsManager::TEXT_MYOWN_ITALIC);
	    
	TextStyles[ TS_PRIVATE ].Init(
	    this, (char*)CSTRING(PRIVATE_MESSAGE), (char*)CSTRING(PRIVATE_MESSAGE),
	    SettingsManager::TEXT_PRIVATE_BACK_COLOR, SettingsManager::TEXT_PRIVATE_FORE_COLOR,
	    SettingsManager::TEXT_PRIVATE_BOLD, SettingsManager::TEXT_PRIVATE_ITALIC);
	    
	TextStyles[ TS_SYSTEM ].Init(
	    this, (char*)CSTRING(SYSTEM_MESSAGE), (char*)CSTRING(SYSTEM_MESSAGE),
	    SettingsManager::TEXT_SYSTEM_BACK_COLOR, SettingsManager::TEXT_SYSTEM_FORE_COLOR,
	    SettingsManager::TEXT_SYSTEM_BOLD, SettingsManager::TEXT_SYSTEM_ITALIC);
	    
	TextStyles[ TS_SERVER ].Init(
	    this, (char*)CSTRING(SERVER_MESSAGE), (char*)CSTRING(SERVER_MESSAGE),
	    SettingsManager::TEXT_SERVER_BACK_COLOR, SettingsManager::TEXT_SERVER_FORE_COLOR,
	    SettingsManager::TEXT_SERVER_BOLD, SettingsManager::TEXT_SERVER_ITALIC);
	    
	TextStyles[ TS_TIMESTAMP ].Init(
	    this, (char*)CSTRING(TIMESTAMP), (char*)CSTRING(TEXT_STYLE_TIME_SAMPLE),
	    SettingsManager::TEXT_TIMESTAMP_BACK_COLOR, SettingsManager::TEXT_TIMESTAMP_FORE_COLOR,
	    SettingsManager::TEXT_TIMESTAMP_BOLD, SettingsManager::TEXT_TIMESTAMP_ITALIC);
	    
	TextStyles[ TS_URL ].Init(
	    this, (char*)CSTRING(TEXT_STYLE_URL), (char*)CSTRING(TEXT_STYLE_URL_SAMPLE),
	    SettingsManager::TEXT_URL_BACK_COLOR, SettingsManager::TEXT_URL_FORE_COLOR,
	    SettingsManager::TEXT_URL_BOLD, SettingsManager::TEXT_URL_ITALIC);
	    
	TextStyles[ TS_FAVORITE ].Init(
	    this, (char*)CSTRING(FAV_USER), (char*)CSTRING(FAV_USER),
	    SettingsManager::TEXT_FAV_BACK_COLOR, SettingsManager::TEXT_FAV_FORE_COLOR,
	    SettingsManager::TEXT_FAV_BOLD, SettingsManager::TEXT_FAV_ITALIC);
	    
	TextStyles[ TS_FAV_ENEMY ].Init(
	    this, (char*)CSTRING(FAV_ENEMY_USER), (char*)CSTRING(FAV_ENEMY_USER),
	    SettingsManager::TEXT_ENEMY_BACK_COLOR, SettingsManager::TEXT_ENEMY_FORE_COLOR,
	    SettingsManager::TEXT_ENEMY_BOLD, SettingsManager::TEXT_ENEMY_ITALIC);
	    
	TextStyles[ TS_OP ].Init(
	    this, (char*)CSTRING(OPERATOR), (char*)CSTRING(OPERATOR),
	    SettingsManager::TEXT_OP_BACK_COLOR, SettingsManager::TEXT_OP_FORE_COLOR,
	    SettingsManager::TEXT_OP_BOLD, SettingsManager::TEXT_OP_ITALIC);
	    
	for (int i = 0; i < TS_LAST; i++)
	{
		TextStyles[ i ].LoadSettings();
		_tcscpy(TextStyles[i].szFaceName, m_Font.lfFaceName);
		TextStyles[ i ].bCharSet = m_Font.lfCharSet;
		TextStyles[ i ].yHeight = m_Font.lfHeight;
		m_lsbList.AddString(Text::toT(TextStyles[i].m_sText).c_str());
	}
	m_lsbList.SetCurSel(0);
	
	ctrlTabList.Attach(GetDlgItem(IDC_TABCOLOR_LIST));
	cmdResetTab.Attach(GetDlgItem(IDC_RESET_TAB_COLOR));
	cmdSetTabColor.Attach(GetDlgItem(IDC_SELECT_TAB_COLOR));
	ctrlTabExample.Attach(GetDlgItem(IDC_SAMPLE_TAB_COLOR));
	
	ctrlTabList.ResetContent();
	for (int i = 0; i < _countof(colours); i++)
	{
		ctrlTabList.AddString(Text::toT(ResourceManager::getString(colours[i].name)).c_str());
		onResetColor(i);
	}
	
	setForeColor(ctrlTabExample, GetSysColor(COLOR_3DFACE));
	
	ctrlTabList.SetCurSel(0);
	BOOL bTmp;
	onTabListChange(0, 0, 0, bTmp);
	
	ctrlTheme.Attach(GetDlgItem(IDC_THEME_COMBO2));
	GetThemeList();
	ctrlTheme.Detach();
	
	RefreshPreview();
	return TRUE;
}