Пример #1
0
static int OnModulesLoaded(WPARAM, LPARAM)
{
	HookEvent(ME_TTB_MODULELOADED, g_OnToolbarInit);

	bSecureIM = (ServiceExists("SecureIM/IsContactSecured"));
	bMirOTR = (int)GetModuleHandle(_T("mirotr.dll"));
	bNewGPG = (int)GetModuleHandle(_T("new_gpg.dll"));
	#ifdef _WIN64
		bPlatform = 1;
	#else
		bPlatform = 0;
	#endif

	// file associations manager plugin support
	if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) {
		CreateServiceFunction("JABBER/*" JS_PARSE_XMPP_URI, g_SvcParseXmppUri);
		AssocMgr_AddNewUrlTypeT("xmpp:", TranslateT("Jabber Link Protocol"), hInst, IDI_JABBER, "JABBER/*" JS_PARSE_XMPP_URI, 0);
	}

	// init fontservice for info frame
	FontIDT fontid = {0};
	fontid.cbSize = sizeof(fontid);
	_tcsncpy(fontid.group, LPGENT("Jabber"), SIZEOF(fontid.group));
	strncpy(fontid.dbSettingsGroup, GLOBAL_SETTING_MODULE, SIZEOF(fontid.dbSettingsGroup));
	_tcsncpy(fontid.backgroundGroup, _T("Jabber"), SIZEOF(fontid.backgroundGroup));
	_tcsncpy(fontid.backgroundName,_T("Background"), SIZEOF(fontid.backgroundName));
	fontid.flags = FIDF_DEFAULTVALID;

	fontid.deffontsettings.charset = DEFAULT_CHARSET;
	fontid.deffontsettings.colour = GetSysColor(COLOR_WINDOWTEXT);
	fontid.deffontsettings.size = -11;
	lstrcpyn(fontid.deffontsettings.szFace, _T("MS Shell Dlg"), SIZEOF(fontid.deffontsettings.szFace));
	fontid.deffontsettings.style = 0;

	_tcsncpy(fontid.name, LPGENT("Frame title"), SIZEOF(fontid.name));
	strncpy(fontid.prefix, "fntFrameTitle", SIZEOF(fontid.prefix));
	fontid.deffontsettings.style = DBFONTF_BOLD;
	FontRegisterT(&fontid);

	_tcsncpy(fontid.name, LPGENT("Frame text"), SIZEOF(fontid.name));
	strncpy(fontid.prefix, "fntFrameClock", SIZEOF(fontid.prefix));
	fontid.deffontsettings.style = 0;
	FontRegisterT(&fontid);

	ColourIDT colourid = {0};
	colourid.cbSize = sizeof(colourid);
	_tcsncpy(colourid.group, _T("Jabber"), SIZEOF(colourid.group));
	strncpy(colourid.dbSettingsGroup, GLOBAL_SETTING_MODULE, SIZEOF(colourid.dbSettingsGroup));

	_tcsncpy(colourid.name, _T("Background"), SIZEOF(colourid.name));
	strncpy(colourid.setting, "clFrameBack", SIZEOF(colourid.setting));
	colourid.defcolour = GetSysColor(COLOR_WINDOW);
	ColourRegisterT(&colourid);

	// Init extra icons
	hExtraActivity = ExtraIcon_Register("activity", LPGEN("Jabber Activity"), "jabber_dancing");
	hExtraMood = ExtraIcon_Register("mood", LPGEN("Jabber Mood"), "jabber_contemplative");
	return 0;
}
Пример #2
0
int LoadFontserviceModule(void)
{
	code_page = Langpack_GetDefaultCodePage();

	CreateServiceFunction("Font/Register", RegisterFont);
	CreateServiceFunction("Font/RegisterW", RegisterFontW);
	CreateServiceFunction(MS_FONT_GET, GetFont);
	CreateServiceFunction(MS_FONT_GETW, GetFontW);

	CreateServiceFunction("Colour/Register", RegisterColour);
	CreateServiceFunction("Colour/RegisterW", RegisterColourW);
	CreateServiceFunction(MS_COLOUR_GET, GetColour);
	CreateServiceFunction(MS_COLOUR_GETW, GetColourW);

	CreateServiceFunction("Effect/Register", RegisterEffect);
	CreateServiceFunction("Effect/RegisterW", RegisterEffectW);
	CreateServiceFunction(MS_EFFECT_GET, GetEffect);
	CreateServiceFunction(MS_EFFECT_GETW, GetEffectW);

	CreateServiceFunction(MS_FONT_RELOAD, ReloadFonts);
	CreateServiceFunction(MS_COLOUR_RELOAD, ReloadColours);

	hFontReloadEvent = CreateHookableEvent(ME_FONT_RELOAD);
	hColourReloadEvent = CreateHookableEvent(ME_COLOUR_RELOAD);

	// create generic fonts
	FontIDT fontid = { sizeof(fontid) };
	strncpy(fontid.dbSettingsGroup, "Fonts", sizeof(fontid.dbSettingsGroup));
	_tcsncpy_s(fontid.group, LPGENT("General"), _TRUNCATE);

	_tcsncpy_s(fontid.name, LPGENT("Headers"), _TRUNCATE);
	fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSHEADER;
	strncpy(fontid.prefix, "Header", _countof(fontid.prefix));
	FontRegisterT(&fontid);

	_tcsncpy_s(fontid.name, LPGENT("Generic text"), _TRUNCATE);
	fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSGENERAL;
	strncpy(fontid.prefix, "Generic", _countof(fontid.prefix));
	FontRegisterT(&fontid);

	_tcsncpy_s(fontid.name, LPGENT("Small text"), _TRUNCATE);
	fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSSMALL;
	strncpy(fontid.prefix, "Small", _countof(fontid.prefix));
	FontRegisterT(&fontid);

	// do last for silly dyna plugin
	HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
	HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
	return 0;
}
Пример #3
0
int FontService_RegisterFont(const char *pszDbModule,const char *pszDbName,const TCHAR *pszSection,const TCHAR *pszDescription,const TCHAR* pszBackgroundGroup,const TCHAR* pszBackgroundName,int position,BOOL bAllowEffects,LOGFONT *plfDefault,COLORREF clrDefault)
{
	FontIDT fid;
	ZeroMemory(&fid,sizeof(fid));
	fid.cbSize=sizeof(fid);
	lstrcpynA(fid.dbSettingsGroup,pszDbModule,sizeof(fid.dbSettingsGroup)); /* buffer safe */
	lstrcpynA(fid.prefix,pszDbName,sizeof(fid.prefix)); /* buffer safe */
	lstrcpyn(fid.group,pszSection,SIZEOF(fid.group)); /* buffer safe */
	lstrcpyn(fid.name,pszDescription,SIZEOF(fid.name)); /* buffer safe */
	lstrcpyn(fid.backgroundGroup,pszBackgroundGroup,SIZEOF(fid.backgroundGroup)); /* buffer safe */
	lstrcpyn(fid.backgroundName,pszBackgroundName,SIZEOF(fid.backgroundName)); /* buffer safe */
	fid.flags=FIDF_ALLOWREREGISTER;
	if (bAllowEffects) fid.flags|=FIDF_ALLOWEFFECTS;
	fid.order=position;
	if (plfDefault != NULL) {
		fid.flags|=FIDF_DEFAULTVALID;
		fid.deffontsettings.colour=clrDefault;
		fid.deffontsettings.size=(char)plfDefault->lfHeight;
		if (plfDefault->lfItalic) fid.deffontsettings.style|=DBFONTF_ITALIC;
		if (plfDefault->lfWeight != FW_NORMAL) fid.deffontsettings.style|=DBFONTF_BOLD;
		if (plfDefault->lfUnderline) fid.deffontsettings.style|=DBFONTF_UNDERLINE;
		if (plfDefault->lfStrikeOut) fid.deffontsettings.style|=DBFONTF_STRIKEOUT;
		fid.deffontsettings.charset=plfDefault->lfCharSet;
		lstrcpyn(fid.deffontsettings.szFace,plfDefault->lfFaceName,SIZEOF(fid.deffontsettings.szFace)); /* buffer safe */
	}
	FontRegisterT(&fid);
	return 0;
}
Пример #4
0
void cfg::FS_RegisterFonts()
{
	ColourIDT 	colourid;
	FontIDT    	fid = {0};
	char 		szTemp[50];
	DBVARIANT 	dbv;
	int 		j = 0;

	fid.cbSize = sizeof(fid);
	wcsncpy(fid.group, L"Contact List", _countof(fid.group));
	strncpy(fid.dbSettingsGroup, "CLC", 5);
	fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS | FIDF_APPENDNAME | FIDF_SAVEPOINTSIZE;
	wcsncpy(fid.backgroundGroup, L"Contact List", _countof(fid.backgroundGroup));
	while(_tagFSINFO[j].name != 0) {
		if(FONTID_EVENTAREA == _tagFSINFO[j].id)
			wcsncpy(fid.backgroundName, L"Event area background", _countof(fid.backgroundName));
		else if(FONTID_FRAMETITLE == _tagFSINFO[j].id)
			wcsncpy(fid.backgroundName, L"Frame title background", _countof(fid.backgroundName));
		else if(FONTID_GROUPCOUNTS == _tagFSINFO[j].id || FONTID_GROUPS == _tagFSINFO[j].id)
			_tcsncpy(fid.backgroundName, L"Group header background", _countof(fid.backgroundName));
		else
			wcsncpy(fid.backgroundName, L"List background", _countof(fid.backgroundName));

		mir_snprintf(szTemp, sizeof(szTemp), "Font%d", _tagFSINFO[j].id);
		strncpy(fid.prefix, szTemp, sizeof(fid.prefix));
		fid.order = _tagFSINFO[j].id;
		wcsncpy(fid.name, _tagFSINFO[j].name, 60);
		_snprintf(szTemp, sizeof(szTemp), "Font%dCol", _tagFSINFO[j].id);
		fid.deffontsettings.colour = (COLORREF)cfg::getDword("CLC", szTemp, GetSysColor(COLOR_WINDOWTEXT));

		_snprintf(szTemp, sizeof(szTemp), "Font%dSize", _tagFSINFO[j].id);
		fid.deffontsettings.size = (BYTE)cfg::getByte("CLC", szTemp, 8);

		_snprintf(szTemp, sizeof(szTemp), "Font%dSty", _tagFSINFO[j].id);
		fid.deffontsettings.style = cfg::getByte("CLC", szTemp, 0);
		_snprintf(szTemp, sizeof(szTemp), "Font%dSet", _tagFSINFO[j].id);
		fid.deffontsettings.charset = cfg::getByte("CLC", szTemp, DEFAULT_CHARSET);
		_snprintf(szTemp, sizeof(szTemp), "Font%dName", _tagFSINFO[j].id);
		if(cfg::getString(NULL, "CLC", szTemp, &dbv))
			lstrcpyn(fid.deffontsettings.szFace, L"Tahoma", LF_FACESIZE);
		else {
			lstrcpyn(fid.deffontsettings.szFace, dbv.ptszVal, LF_FACESIZE);
			mir_free(dbv.ptszVal);
		}
		FontRegisterT(&fid);
		j++;
	}

	colourid.order = 0;
	strncpy(colourid.dbSettingsGroup, "CLC", sizeof(colourid.dbSettingsGroup));
	colourid.cbSize = sizeof(ColourIDT);
	mir_sntprintf(colourid.group, _countof(colourid.group), L"%s", L"Contact List");
	for (int i = 0; i < _countof(_clrs); i++) {
		colourid.order = _clrs[i].order;
		mir_snprintf(colourid.setting, sizeof(colourid.setting), "%s", _clrs[i].szSetting);
		mir_sntprintf(colourid.name, _countof(colourid.name), L"%s", _clrs[i].tszName);
		colourid.defcolour = (_clrs[i].def & 0xff000000 ? GetSysColor(_clrs[i].def & 0x00ffffff) : _clrs[i].def);
		ColourRegisterT(&colourid);
	}
}
Пример #5
0
int AlarmWinModulesLoaded(WPARAM, LPARAM)
{
	title_font_id.cbSize = sizeof(FontIDT);
	mir_tstrcpy(title_font_id.group, LPGENT("Alarms"));
	mir_tstrcpy(title_font_id.name, LPGENT("Title"));
	mir_strcpy(title_font_id.dbSettingsGroup, MODULE);
	mir_strcpy(title_font_id.prefix, "FontTitle");
	mir_tstrcpy(title_font_id.backgroundGroup,LPGENT("Alarms"));
	mir_tstrcpy(title_font_id.backgroundName,LPGENT("Background"));
	title_font_id.flags = 0;
	title_font_id.order = 0;
	FontRegisterT(&title_font_id);

	window_font_id.cbSize = sizeof(FontIDT);
	mir_tstrcpy(window_font_id.group, LPGENT("Alarms"));
	mir_tstrcpy(window_font_id.name, LPGENT("Window"));
	mir_strcpy(window_font_id.dbSettingsGroup, MODULE);
	mir_strcpy(window_font_id.prefix, "FontWindow");
	mir_tstrcpy(window_font_id.backgroundGroup,LPGENT("Alarms"));
	mir_tstrcpy(window_font_id.backgroundName,LPGENT("Background"));
	window_font_id.flags = 0;
	window_font_id.order = 1;
	FontRegisterT(&window_font_id);

	bk_colour_id.cbSize = sizeof(ColourIDT);
	mir_strcpy(bk_colour_id.dbSettingsGroup, MODULE);
	mir_tstrcpy(bk_colour_id.group, LPGENT("Alarms"));
	mir_tstrcpy(bk_colour_id.name, LPGENT("Background"));
	mir_strcpy(bk_colour_id.setting, "BkColour");
	bk_colour_id.defcolour = GetSysColor(COLOR_3DFACE);
	bk_colour_id.flags = 0;
	bk_colour_id.order = 0;

	ColourRegisterT(&bk_colour_id);

	ReloadFonts(0, 0);
	HookEvent(ME_FONT_RELOAD, ReloadFonts);
	return 0;
}
Пример #6
0
static void InitFonts()
{
    font_id_firstline.cbSize = sizeof(FontIDT);
    font_id_firstline.flags = FIDF_ALLOWEFFECTS;
    mir_tstrcpy(font_id_firstline.group, LPGENT("Popups"));
    mir_tstrcpy(font_id_firstline.name, LPGENT("First line"));
    mir_strcpy(font_id_firstline.dbSettingsGroup, MODULE);
    mir_strcpy(font_id_firstline.prefix, "FontFirst");
    mir_tstrcpy(font_id_firstline.backgroundGroup, _T("Popups"));
    mir_tstrcpy(font_id_firstline.backgroundName, _T("Background"));
    font_id_firstline.order = 0;
    FontRegisterT(&font_id_firstline);

    font_id_secondline.cbSize = sizeof(FontIDT);
    font_id_secondline.flags = FIDF_ALLOWEFFECTS;
    mir_tstrcpy(font_id_secondline.group, LPGENT("Popups"));
    mir_tstrcpy(font_id_secondline.name, LPGENT("Second line"));
    mir_strcpy(font_id_secondline.dbSettingsGroup, MODULE);
    mir_strcpy(font_id_secondline.prefix, "FontSecond");
    mir_tstrcpy(font_id_secondline.backgroundGroup, _T("Popups"));
    mir_tstrcpy(font_id_secondline.backgroundName, _T("Background"));
    font_id_secondline.order = 1;
    FontRegisterT(&font_id_secondline);

    font_id_time.cbSize = sizeof(FontIDT);
    font_id_time.flags = FIDF_ALLOWEFFECTS;
    mir_tstrcpy(font_id_time.group, LPGENT("Popups"));
    mir_tstrcpy(font_id_time.name, LPGENT("Time"));
    mir_strcpy(font_id_time.dbSettingsGroup, MODULE);
    mir_strcpy(font_id_time.prefix, "FontTime");
    mir_tstrcpy(font_id_time.backgroundGroup, _T("Popups"));
    mir_tstrcpy(font_id_time.backgroundName, _T("Background"));
    font_id_time.order = 2;
    FontRegisterT(&font_id_time);

    colour_id_bg.cbSize = sizeof(ColourIDT);
    mir_tstrcpy(colour_id_bg.group, LPGENT("Popups"));
    mir_tstrcpy(colour_id_bg.name, LPGENT("Background"));
    mir_strcpy(colour_id_bg.dbSettingsGroup, MODULE);
    mir_strcpy(colour_id_bg.setting, "ColourBg");
    colour_id_bg.defcolour = GetSysColor(COLOR_3DSHADOW);
    colour_id_bg.order = 0;
    ColourRegisterT(&colour_id_bg);

    colour_id_border.cbSize = sizeof(ColourIDT);
    mir_tstrcpy(colour_id_border.group, LPGENT("Popups"));
    mir_tstrcpy(colour_id_border.name, LPGENT("Border"));
    mir_strcpy(colour_id_border.dbSettingsGroup, MODULE);
    mir_strcpy(colour_id_border.setting, "ColourBorder");
    colour_id_border.defcolour = RGB(0, 0, 0);
    colour_id_border.order = 1;
    ColourRegisterT(&colour_id_border);

    colour_id_sidebar.cbSize = sizeof(ColourIDT);
    mir_tstrcpy(colour_id_sidebar.group, LPGENT("Popups"));
    mir_tstrcpy(colour_id_sidebar.name, LPGENT("Sidebar"));
    mir_strcpy(colour_id_sidebar.dbSettingsGroup, MODULE);
    mir_strcpy(colour_id_sidebar.setting, "ColourSidebar");
    colour_id_sidebar.defcolour = RGB(128, 128, 128);
    colour_id_sidebar.order = 2;
    ColourRegisterT(&colour_id_sidebar);

    colour_id_titleunderline.cbSize = sizeof(ColourIDT);
    mir_tstrcpy(colour_id_titleunderline.group, LPGENT("Popups"));
    mir_tstrcpy(colour_id_titleunderline.name, LPGENT("Title underline"));
    mir_strcpy(colour_id_titleunderline.dbSettingsGroup, MODULE);
    mir_strcpy(colour_id_titleunderline.setting, "ColourTitleUnderline");
    colour_id_titleunderline.defcolour = GetSysColor(COLOR_3DSHADOW);
    colour_id_titleunderline.order = 3;
    ColourRegisterT(&colour_id_titleunderline);

    ReloadFont(0, 0);
}
Пример #7
0
static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam)
{
	CreateServiceFunction(MS_CONSOLE_SHOW_HIDE, ShowHideConsole);

	FontIDT fid = {0};
	fid.cbSize = sizeof(fid);
	_tcscpy(fid.group,_T("Console"));
	_tcscpy(fid.name,TranslateT("Text"));
	strcpy(fid.dbSettingsGroup,"Console");
	strcpy(fid.prefix,"ConsoleFont");
	_tcscpy(fid.backgroundGroup,_T("Console"));
	_tcscpy(fid.backgroundName,_T("Background"));
	fid.flags = FIDF_DEFAULTVALID;
	fid.deffontsettings.charset = DEFAULT_CHARSET;
	fid.deffontsettings.colour = RGB(0, 0, 0);
	fid.deffontsettings.size = 10;
	fid.deffontsettings.style = 0;
	_tcsncpy(fid.deffontsettings.szFace, _T("Courier"), LF_FACESIZE);
	FontRegisterT(&fid);

	HookEvent(ME_FONT_RELOAD,OnFontChange);

	ColourIDT cid = {0};
	cid.cbSize=sizeof(cid);
	_tcscpy(cid.group,_T("Console"));
	_tcscpy(cid.name,_T("Background"));
	strcpy(cid.dbSettingsGroup,"Console");
	strcpy(cid.setting,"BgColor");
	cid.defcolour = RGB(255,255,255);
	ColourRegisterT(&cid);

	HookEvent(ME_COLOUR_RELOAD, OnColourChange);

	HOTKEYDESC hkd = {0};
	hkd.cbSize = sizeof(hkd);
	hkd.pszName = "Console_Show_Hide";
	hkd.pszDescription = LPGEN("Show/Hide Console");
	hkd.pszSection = "Main";
	hkd.pszService = MS_CONSOLE_SHOW_HIDE;
	hkd.DefHotKey = HOTKEYCODE(HOTKEYF_EXT, 'C');
	Hotkey_Register(&hkd);

	if (hwndConsole && IsWindow(hwndConsole))
	{
		HookEvent(ME_TTB_MODULELOADED, OnTTBLoaded);

		CLISTMENUITEM mi = { sizeof(mi) };
		mi.flags = CMIF_TCHAR;
		mi.hIcon = hIcons[0];
		mi.ptszPopupName = LPGENT("&Help");
		mi.popupPosition = 2000090000;
		mi.position = 1000000000;
		mi.ptszName = (IsWindowVisible(hwndConsole)) ? LPGENT("Hide Console") : LPGENT("Show Console");
		mi.pszService = MS_CONSOLE_SHOW_HIDE;
		hMenu = Menu_AddMainMenuItem(&mi);

		OnFontChange(0,0);
		OnColourChange(0,0);

		if (db_get_b(NULL,"Console","ShowAtStart",0) || db_get_b(NULL,"Console","Show",1))
			ShowConsole(1);
		else
			ShowConsole(0);
	}

	return 0;
}
Пример #8
0
void InitFonts() {
	// Fonts
	FontIDT fid = {0};
	fid.cbSize = sizeof(FontIDT);
	lstrcpyn(fid.group, _T(PU_FNT_AND_COLOR), SIZEOF(fid.group));
	strncpy(fid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, SIZEOF(fid.dbSettingsGroup));
	fid.flags = FIDF_DEFAULTVALID;
	fid.deffontsettings.charset = DEFAULT_CHARSET;
	fid.deffontsettings.size = -11;
	lstrcpyn(fid.backgroundGroup, _T(PU_FNT_AND_COLOR), SIZEOF(fid.backgroundGroup));
	lstrcpyn(fid.backgroundName, PU_COL_BACK_NAME, SIZEOF(fid.backgroundName));
	lstrcpyn(fid.deffontsettings.szFace, _T("Tahoma"), SIZEOF(fid.deffontsettings.szFace));

	lstrcpyn(fid.name, _T(PU_FNT_NAME_TITLE), SIZEOF(fid.name));
	mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TITLE);
	fid.deffontsettings.style  = DBFONTF_BOLD;
	fid.deffontsettings.colour = RGB(0, 0, 0);
	FontRegisterT(&fid);

	lstrcpyn(fid.name, _T(PU_FNT_NAME_CLOCK), SIZEOF(fid.name));
	mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_CLOCK);
	//fid.deffontsettings.style  = DBFONTF_BOLD;
	//fid.deffontsettings.colour = RGB(0, 0, 0);
	FontRegisterT(&fid);

	lstrcpyn(fid.name, _T(PU_FNT_NAME_TEXT), SIZEOF(fid.name));
	mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TEXT);
	fid.deffontsettings.style  = 0;
	//fid.deffontsettings.colour = RGB(0, 0, 0);
	FontRegisterT(&fid);

	lstrcpyn(fid.name, _T(PU_FNT_NAME_ACTION), SIZEOF(fid.name));
	mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_ACTION);
	fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS;
	//fid.deffontsettings.style = 0;
	fid.deffontsettings.colour = RGB(0, 0, 255);
	FontRegisterT(&fid);

	lstrcpyn(fid.name, _T(PU_FNT_NAME_HOVERED_ACTION), SIZEOF(fid.name));
	mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_HOVERED_ACTION);
	fid.deffontsettings.style = DBFONTF_UNDERLINE;
	//fid.deffontsettings.colour = RGB(0, 0, 255);
	FontRegisterT(&fid);

	ColourIDT cid = {0};
	cid.cbSize = sizeof(ColourIDT);
	lstrcpyn(cid.group, _T(PU_FNT_AND_COLOR), SIZEOF(cid.group));
	strncpy(cid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, SIZEOF(cid.dbSettingsGroup));

	lstrcpyn(cid.name, PU_COL_BACK_NAME, SIZEOF(cid.name));
	strncpy(cid.setting, PU_COL_BACK_SETTING, SIZEOF(cid.setting));
	cid.defcolour = SETTING_BACKCOLOUR_DEFAULT;
	ColourRegisterT(&cid);

	lstrcpyn(cid.name, PU_COL_AVAT_NAME, SIZEOF(cid.name));
	strncpy(cid.setting, PU_COL_AVAT_SETTING, SIZEOF(cid.setting));
	cid.defcolour = SETTING_TEXTCOLOUR_DEFAULT;
	ColourRegisterT(&cid);

	ReloadFonts();
}
Пример #9
0
void InitFonts()
{
	colourBg.cbSize = sizeof(ColourIDT);
	mir_tstrcpy(colourBg.group, LPGENT("Tooltips"));
	mir_tstrcpy(colourBg.name, LPGENT("Background"));
	mir_strcpy(colourBg.dbSettingsGroup, MODULE);
	mir_strcpy(colourBg.setting, "ColourBg");
	colourBg.defcolour = RGB(219, 219, 219);
	colourBg.order = 0;
	ColourRegisterT(&colourBg);

	colourBorder.cbSize = sizeof(ColourIDT);
	mir_tstrcpy(colourBorder.group, LPGENT("Tooltips"));
	mir_tstrcpy(colourBorder.name, LPGENT("Border"));
	mir_strcpy(colourBorder.dbSettingsGroup, MODULE);
	mir_strcpy(colourBorder.setting, "BorderCol");
	colourBorder.defcolour = 0;
	colourBorder.order = 0;
	ColourRegisterT(&colourBorder);

	colourAvatarBorder.cbSize = sizeof(ColourIDT);
	mir_tstrcpy(colourAvatarBorder.group, LPGENT("Tooltips"));
	mir_tstrcpy(colourAvatarBorder.name, LPGENT("Avatar border"));
	mir_strcpy(colourAvatarBorder.dbSettingsGroup, MODULE);
	mir_strcpy(colourAvatarBorder.setting, "AvBorderCol");
	colourAvatarBorder.defcolour = 0;
	colourAvatarBorder.order = 0;
	ColourRegisterT(&colourAvatarBorder);

	colourDivider.cbSize = sizeof(ColourIDT);
	mir_tstrcpy(colourDivider.group, LPGENT("Tooltips"));
	mir_tstrcpy(colourDivider.name, LPGENT("Dividers"));
	mir_strcpy(colourDivider.dbSettingsGroup, MODULE);
	mir_strcpy(colourDivider.setting, "DividerCol");
	colourDivider.defcolour = 0;
	colourDivider.order = 0;
	ColourRegisterT(&colourDivider);

	colourSidebar.cbSize = sizeof(ColourIDT);
	mir_tstrcpy(colourSidebar.group, LPGENT("Tooltips"));
	mir_tstrcpy(colourSidebar.name, LPGENT("Sidebar"));
	mir_strcpy(colourSidebar.dbSettingsGroup, MODULE);
	mir_strcpy(colourSidebar.setting, "SidebarCol");
	colourSidebar.defcolour = RGB(192, 192, 192);
	colourSidebar.order = 0;
	ColourRegisterT(&colourSidebar);

	fontTitle.cbSize = sizeof(FontIDT);
	fontTitle.flags = FIDF_ALLOWEFFECTS;
	mir_tstrcpy(fontTitle.group, LPGENT("Tooltips"));
	mir_tstrcpy(fontTitle.name, LPGENT("Title"));
	mir_strcpy(fontTitle.dbSettingsGroup, MODULE);
	mir_strcpy(fontTitle.prefix, "FontFirst");
	mir_tstrcpy(fontTitle.backgroundGroup, LPGENT("Tooltips"));
	mir_tstrcpy(fontTitle.backgroundName, LPGENT("Background"));
	fontTitle.order = 0;

	fontTitle.deffontsettings.charset = DEFAULT_CHARSET;
	fontTitle.deffontsettings.size = -14;
	fontTitle.deffontsettings.style = DBFONTF_BOLD;
	fontTitle.deffontsettings.colour = RGB(255, 0, 0);
	fontTitle.flags |= FIDF_DEFAULTVALID;

	fontLabels.cbSize = sizeof(FontIDT);
	fontLabels.flags = FIDF_ALLOWEFFECTS;
	mir_tstrcpy(fontLabels.group, LPGENT("Tooltips"));
	mir_tstrcpy(fontLabels.name, LPGENT("Labels"));
	mir_strcpy(fontLabels.dbSettingsGroup, MODULE);
	mir_strcpy(fontLabels.prefix, "FontLabels");
	mir_tstrcpy(fontLabels.backgroundGroup, LPGENT("Tooltips"));
	mir_tstrcpy(fontLabels.backgroundName, LPGENT("Background"));
	fontLabels.order = 1;

	fontLabels.deffontsettings.charset = DEFAULT_CHARSET;
	fontLabels.deffontsettings.size = -12;
	fontLabels.deffontsettings.style = DBFONTF_ITALIC;
	fontLabels.deffontsettings.colour = RGB(128, 128, 128);
	fontLabels.flags |= FIDF_DEFAULTVALID;

	fontValues.cbSize = sizeof(FontIDT);
	fontValues.flags = FIDF_ALLOWEFFECTS;
	mir_tstrcpy(fontValues.group, LPGENT("Tooltips"));
	mir_tstrcpy(fontValues.name, LPGENT("Values"));
	mir_strcpy(fontValues.dbSettingsGroup, MODULE);
	mir_strcpy(fontValues.prefix, "FontValues");
	mir_tstrcpy(fontValues.backgroundGroup, LPGENT("Tooltips"));
	mir_tstrcpy(fontValues.backgroundName, LPGENT("Background"));
	fontValues.order = 2;

	fontValues.deffontsettings.charset = DEFAULT_CHARSET;
	fontValues.deffontsettings.size = -12;
	fontValues.deffontsettings.style = 0;
	fontValues.deffontsettings.colour = RGB(0, 0, 0);
	fontValues.flags |= FIDF_DEFAULTVALID;

	fontTrayTitle.cbSize = sizeof(FontIDT);
	fontTrayTitle.flags = FIDF_ALLOWEFFECTS;
	mir_tstrcpy(fontTrayTitle.group, LPGENT("Tooltips"));
	mir_tstrcpy(fontTrayTitle.name, LPGENT("Tray title"));
	mir_strcpy(fontTrayTitle.dbSettingsGroup, MODULE);
	mir_strcpy(fontTrayTitle.prefix, "FontTrayTitle");
	mir_tstrcpy(fontTrayTitle.backgroundGroup, LPGENT("Tooltips"));
	mir_tstrcpy(fontTrayTitle.backgroundName, LPGENT("Background"));
	fontTrayTitle.order = 0;

	fontTrayTitle.deffontsettings.charset = DEFAULT_CHARSET;
	fontTrayTitle.deffontsettings.size = -14;
	fontTrayTitle.deffontsettings.style = DBFONTF_BOLD;
	fontTrayTitle.deffontsettings.colour = RGB(0, 0, 0);
	fontTrayTitle.flags |= FIDF_DEFAULTVALID;

	FontRegisterT(&fontTitle);
	FontRegisterT(&fontLabels);
	FontRegisterT(&fontValues);
	FontRegisterT(&fontTrayTitle);

	hReloadFonts = HookEvent(ME_FONT_RELOAD, ReloadFont);
}
Пример #10
0
void RegisterFontServiceFonts()
{
    char szTemp[100];
    LOGFONT lf;
    FontIDT fid = { 0 };
    ColourIDT cid = { 0 };

    fid.cbSize = sizeof(FontIDT);
    cid.cbSize = sizeof(ColourIDT);

    strncpy(fid.dbSettingsGroup, FONTMODULE, _countof(fid.dbSettingsGroup));

    for (int i = 0; i < _countof(IM_fontOptionsList); i++) {
        fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS;
        LoadMsgDlgFont(FONTSECTION_IM, i, &lf, &fontOptionsList[i].colour, FONTMODULE);
        mir_snprintf(szTemp, "Font%d", i);
        strncpy(fid.prefix, szTemp, _countof(fid.prefix));
        fid.order = i;
        _tcsncpy(fid.name, fontOptionsList[i].szDescr, _countof(fid.name));
        fid.deffontsettings.colour = fontOptionsList[i].colour;
        fid.deffontsettings.size = (char)lf.lfHeight;
        fid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? FONTF_BOLD : 0) | (lf.lfItalic ? FONTF_ITALIC : 0);
        fid.deffontsettings.charset = lf.lfCharSet;
        fid.flags = fid.flags & ~FIDF_CLASSMASK | (fid.deffontsettings.style&FONTF_BOLD ? FIDF_CLASSHEADER : FIDF_CLASSGENERAL);
        _tcsncpy(fid.deffontsettings.szFace, lf.lfFaceName, LF_FACESIZE);
        _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions") _T("/") LPGENT("Single Messaging"), _countof(fid.backgroundGroup));
        _tcsncpy(fid.group, LPGENT("Message Sessions") _T("/") LPGENT("Single Messaging"), _countof(fid.group));
        switch (i) {
        case MSGFONTID_MYMSG:
        case 1:
        case MSGFONTID_MYNAME:
        case MSGFONTID_MYTIME:
        case 21:
            _tcsncpy(fid.backgroundName, LPGENT("Outgoing background"), _countof(fid.backgroundName));
            break;
        case 8:
        case 9:
        case 12:
        case 13:
            _tcsncpy(fid.backgroundName, LPGENT("Outgoing background(old)"), _countof(fid.backgroundName));
            break;
        case 10:
        case 11:
        case 14:
        case 15:
            _tcsncpy(fid.backgroundName, LPGENT("Incoming background(old)"), _countof(fid.backgroundName));
            break;
        case MSGFONTID_MESSAGEAREA:
            _tcsncpy(fid.group, LPGENT("Message Sessions"), _countof(fid.group));
            _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions"), _countof(fid.backgroundGroup));
            _tcsncpy(fid.backgroundName, LPGENT("Input area background"), _countof(fid.backgroundName));
            fid.flags |= FIDF_DISABLESTYLES;
            fid.flags &= ~FIDF_ALLOWEFFECTS;
            break;
        case 17:
            _tcsncpy(fid.backgroundName, LPGENT("Status background"), _countof(fid.backgroundName));
            break;
        case 18:
            _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions"), _countof(fid.backgroundGroup));
            _tcsncpy(fid.backgroundName, LPGENT("Log background"), _countof(fid.backgroundName));
            break;
        case 19:
            _tcsncpy(fid.backgroundName, _T(""), _countof(fid.backgroundName));
            break;
        default:
            _tcsncpy(fid.backgroundName, LPGENT("Incoming background"), _countof(fid.backgroundName));
            break;
        }
        FontRegisterT(&fid);
    }

    fontOptionsList = IP_fontOptionsList;
    fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS;
    _tcsncpy(fid.group, LPGENT("Message Sessions") _T("/") LPGENT("Info Panel"), _countof(fid.group));
    _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions") _T("/") LPGENT("Info Panel"), _countof(fid.backgroundGroup));
    _tcsncpy(fid.backgroundName, LPGENT("Fields background"), _countof(fid.backgroundName));
    for (int i = 0; i < IPFONTCOUNT; i++) {
        LoadMsgDlgFont(FONTSECTION_IP, i + 100, &lf, &fontOptionsList[i].colour, FONTMODULE);
        mir_snprintf(szTemp, "Font%d", i + 100);
        strncpy(fid.prefix, szTemp, _countof(fid.prefix));
        fid.order = i + 100;
        _tcsncpy(fid.name, fontOptionsList[i].szDescr, _countof(fid.name));
        fid.deffontsettings.colour = fontOptionsList[i].colour;
        fid.deffontsettings.size = (char)lf.lfHeight;
        fid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? FONTF_BOLD : 0) | (lf.lfItalic ? FONTF_ITALIC : 0);
        fid.deffontsettings.charset = lf.lfCharSet;
        fid.flags = fid.flags & ~FIDF_CLASSMASK | (fid.deffontsettings.style&FONTF_BOLD ? FIDF_CLASSHEADER : FIDF_CLASSGENERAL);
        fid.deffontsettings.charset = lf.lfCharSet;
        _tcsncpy(fid.deffontsettings.szFace, lf.lfFaceName, LF_FACESIZE);
        if (i == IPFONTCOUNT - 1) {
            _tcsncpy(fid.backgroundGroup, _T(""), _countof(fid.backgroundGroup));
            _tcsncpy(fid.backgroundName, _T(""), _countof(fid.backgroundName));
            _tcsncpy(fid.group, LPGENT("Message Sessions"), _countof(fid.group));
        }
        FontRegisterT(&fid);
    }

    _tcsncpy(cid.group, LPGENT("Message Sessions") _T("/") LPGENT("Group chats"), _countof(cid.group));
    strncpy(cid.dbSettingsGroup, CHAT_MODULE, _countof(cid.dbSettingsGroup));
    for (int i = 0; i <= 7; i++) {
        mir_snprintf(szTemp, "NickColor%d", i);
        _tcsncpy(cid.name, chatcolorsnames[i], _countof(cid.name));
        cid.order = i + 1;
        strncpy(cid.setting, szTemp, _countof(cid.setting));
        switch (i) {
        case 5:
            cid.defcolour = GetSysColor(COLOR_HIGHLIGHT);
            break;
        case 6:
            cid.defcolour = GetSysColor(COLOR_HIGHLIGHTTEXT);
            break;
        default:
            cid.defcolour = RGB(0, 0, 0);
            break;
        }
        ColourRegisterT(&cid);
    }
    cid.order++;
    _tcsncpy_s(cid.name, LPGENT("Nick list background"), _TRUNCATE);
    strncpy_s(cid.setting, "ColorNicklistBG", _TRUNCATE);
    cid.defcolour = SRMSGDEFSET_BKGCOLOUR;
    ColourRegisterT(&cid);

    cid.order++;
    _tcsncpy_s(cid.name, LPGENT("Group chat log background"), _TRUNCATE);
    strncpy_s(cid.setting, "ColorLogBG", _TRUNCATE);
    ColourRegisterT(&cid);

    // static colors (info panel, tool bar background etc...)
    strncpy(fid.dbSettingsGroup, FONTMODULE, _countof(fid.dbSettingsGroup));
    strncpy(cid.dbSettingsGroup, FONTMODULE, _countof(fid.dbSettingsGroup));

    for (int i = 0; i < _countof(_clrs); i++) {
        cid.order = _clrs[i].order;
        _tcsncpy(cid.group, _clrs[i].tszGroup, _countof(fid.group));
        _tcsncpy(cid.name, _clrs[i].tszName, _countof(cid.name));
        strncpy(cid.setting, _clrs[i].szSetting, _countof(cid.setting));
        if (_clrs[i].def & 0xff000000)
            cid.defcolour = GetSysColor(_clrs[i].def & 0x000000ff);
        else
            cid.defcolour = _clrs[i].def;
        ColourRegisterT(&cid);
    }

    strncpy(cid.dbSettingsGroup, SRMSGMOD_T, _countof(fid.dbSettingsGroup));

    // text and background colors for tabs
    for (int i = 0; i < _countof(_tabclrs); i++) {
        cid.order = _tabclrs[i].order;
        _tcsncpy(cid.group, _tabclrs[i].tszGroup, _countof(fid.group));
        _tcsncpy(cid.name, _tabclrs[i].tszName, _countof(cid.name));
        strncpy(cid.setting, _tabclrs[i].szSetting, _countof(cid.setting));
        if (_tabclrs[i].def & 0xff000000)
            cid.defcolour = GetSysColor(_tabclrs[i].def & 0x000000ff);
        else
            cid.defcolour = _tabclrs[i].def;

        ColourRegisterT(&cid);
    }
}