Ejemplo n.º 1
0
void ReloadOpenGL()
{
	InitOpenGL();
	ReloadGraphics();
	ReloadFonts();
	UI.Minimap.Reload();
}
Ejemplo n.º 2
0
CJabberInfoFrame::CJabberInfoFrame(CJabberProto *proto):
    m_pItems(3, CJabberInfoFrameItem::cmp), m_compact(false)
{
    m_proto = proto;
    m_clickedItem = -1;

    InitClass();

    CLISTFrame frame = { sizeof(frame) };
    HWND hwndClist = pcli->hwndContactList;
    frame.hWnd = CreateWindowEx(0, _T("JabberInfoFrameClass"), NULL, WS_CHILD|WS_VISIBLE, 0, 0, 100, 100, hwndClist, NULL, hInst, this);
    frame.align = alBottom;
    frame.height = 2 * SZ_FRAMEPADDING + GetSystemMetrics(SM_CYSMICON) + SZ_LINEPADDING; // compact height by default
    frame.Flags = F_VISIBLE|F_LOCKED|F_NOBORDER|F_TCHAR;
    frame.tname = mir_a2t(proto->m_szModuleName);
    frame.TBtname = proto->m_tszUserName;
    m_frameId = CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&frame, 0);
    mir_free(frame.tname);
    if (m_frameId == -1) {
        DestroyWindow(frame.hWnd);
        return;
    }

    m_hhkFontsChanged = HookEventMessage(ME_FONT_RELOAD, m_hwnd, WM_APP);
    ReloadFonts();

    m_hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
                                   WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
                                   CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
                                   m_hwnd, NULL, hInst, NULL);
    SetWindowPos(m_hwndToolTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);

    CreateInfoItem("$", true);
    UpdateInfoItem("$", proto->GetIconHandle(IDI_JABBER), proto->m_tszUserName);

    CreateInfoItem("$/JID", true);
    UpdateInfoItem("$/JID", Skin_GetIconHandle(SKINICON_OTHER_USERDETAILS), _T("Offline"));
    SetInfoItemCallback("$/JID", &CJabberProto::InfoFrame_OnSetup);
}
Ejemplo n.º 3
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;
}
Ejemplo n.º 4
0
int AlarmWinModulesLoaded(WPARAM, LPARAM)
{
	title_font_id.cbSize = sizeof(FontIDW);
	wcsncpy_s(title_font_id.group, LPGENW("Alarms"), _TRUNCATE);
	wcsncpy_s(title_font_id.name, LPGENW("Title"), _TRUNCATE);
	strncpy_s(title_font_id.dbSettingsGroup, MODULENAME, _TRUNCATE);
	strncpy_s(title_font_id.prefix, "FontTitle", _TRUNCATE);
	wcsncpy_s(title_font_id.backgroundGroup, LPGENW("Alarms"), _TRUNCATE);
	wcsncpy_s(title_font_id.backgroundName, LPGENW("Background"), _TRUNCATE);
	title_font_id.flags = 0;
	title_font_id.order = 0;
	g_plugin.addFont(&title_font_id);

	window_font_id.cbSize = sizeof(FontIDW);
	wcsncpy_s(window_font_id.group, LPGENW("Alarms"), _TRUNCATE);
	wcsncpy_s(window_font_id.name, LPGENW("Window"), _TRUNCATE);
	strncpy_s(window_font_id.dbSettingsGroup, MODULENAME, _TRUNCATE);
	strncpy_s(window_font_id.prefix, "FontWindow", _TRUNCATE);
	wcsncpy_s(window_font_id.backgroundGroup, LPGENW("Alarms"), _TRUNCATE);
	wcsncpy_s(window_font_id.backgroundName, LPGENW("Background"), _TRUNCATE);
	window_font_id.flags = 0;
	window_font_id.order = 1;
	g_plugin.addFont(&window_font_id);

	bk_colour_id.cbSize = sizeof(ColourIDW);
	strncpy_s(bk_colour_id.dbSettingsGroup, MODULENAME, _TRUNCATE);
	wcsncpy_s(bk_colour_id.group, LPGENW("Alarms"), _TRUNCATE);
	wcsncpy_s(bk_colour_id.name, LPGENW("Background"), _TRUNCATE);
	strncpy_s(bk_colour_id.setting, "BkColour", _TRUNCATE);
	bk_colour_id.defcolour = GetSysColor(COLOR_3DFACE);
	bk_colour_id.flags = 0;
	bk_colour_id.order = 0;

	g_plugin.addColor(&bk_colour_id);

	ReloadFonts(0, 0);
	HookEvent(ME_FONT_RELOAD, ReloadFonts);
	return 0;
}
Ejemplo n.º 5
0
LRESULT CJabberInfoFrame::WndProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch (msg) {
    case WM_APP:
        ReloadFonts();
        return 0;

    case WM_PAINT:
    {
        RECT rc;
        GetClientRect(m_hwnd, &rc);
        m_compact = rc.bottom < (2 * (GetSystemMetrics(SM_CYSMICON) + SZ_LINEPADDING) + SZ_LINESPACING + 2 * SZ_FRAMEPADDING);

        PAINTSTRUCT ps;
        HDC hdc = BeginPaint(m_hwnd, &ps);
        m_compact ? PaintCompact(hdc) : PaintNormal(hdc);
        EndPaint(m_hwnd, &ps);
        return 0;
    }

    case WM_RBUTTONUP:
    {
        POINT pt = { LOWORD(lParam), HIWORD(lParam) };
        MapWindowPoints(m_hwnd, NULL, &pt, 1);
        HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDFRAMECONTEXT, m_frameId, 0);
        int res = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, pcli->hwndContactList, NULL);
        CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(res, 0), m_frameId);
        return 0;
    }

    case WM_LBUTTONDOWN:
    {
        POINT pt = { LOWORD(lParam), HIWORD(lParam) };
        for (int i=0; i < m_pItems.getCount(); i++)
            if (m_pItems[i].m_onEvent && PtInRect(&m_pItems[i].m_rcItem, pt)) {
                m_clickedItem = i;
                return 0;
            }
    }
    return 0;

    case WM_LBUTTONUP:
    {
        POINT pt = { LOWORD(lParam), HIWORD(lParam) };
        if ((m_clickedItem >= 0) && (m_clickedItem < m_pItems.getCount()) && m_pItems[m_clickedItem].m_onEvent && PtInRect(&m_pItems[m_clickedItem].m_rcItem, pt))
        {
            CJabberInfoFrame_Event evt;
            evt.m_event = CJabberInfoFrame_Event::CLICK;
            evt.m_pszName = m_pItems[m_clickedItem].m_pszName;
            evt.m_pUserData = m_pItems[m_clickedItem].m_pUserData;
            (m_proto->*m_pItems[m_clickedItem].m_onEvent)(&evt);
            return 0;
        }

        m_clickedItem = -1;

        return 0;
    }

    case WM_LBUTTONDBLCLK:
        m_compact = !m_compact;
        UpdateSize();
        return 0;
    }

    return DefWindowProc(m_hwnd, msg, wParam, lParam);
}
Ejemplo n.º 6
0
static int FontsChanged(WPARAM, LPARAM)
{
	ReloadFonts();
	return 0;
}
Ejemplo n.º 7
0
static int FontsChanged(WPARAM wParam,LPARAM lParam)
{
	ReloadFonts();
	return 0;
}
Ejemplo n.º 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();
}
Ejemplo n.º 9
0
/**
**  Toggle full screen mode.
*/
void ToggleFullScreen(void)
{
#ifdef USE_WIN32
	long framesize;
	SDL_Rect clip;
	Uint32 flags;
	int w;
	int h;
	int bpp;
#ifndef USE_OPENGL
	unsigned char *pixels;
	SDL_Color *palette;
	int ncolors;
#endif

	if (!TheScreen) { // don't bother if there's no surface.
		return;
	}

	flags = TheScreen->flags;
	w = TheScreen->w;
	h = TheScreen->h;
	bpp = TheScreen->format->BitsPerPixel;

	if (!SDL_VideoModeOK(w, h, bpp,	flags ^ SDL_FULLSCREEN)) {
		return;
	}

	SDL_GetClipRect(TheScreen, &clip);

	// save the contents of the screen.
	framesize = w * h * TheScreen->format->BytesPerPixel;

#ifndef USE_OPENGL
	if (!(pixels = new unsigned char[framesize])) { // out of memory
		return;
	}
	SDL_LockSurface(TheScreen);
	memcpy(pixels, TheScreen->pixels, framesize);

#ifdef DEBUG
	// shut up compiler
	palette = NULL;
	ncolors=0;
#endif
	if (TheScreen->format->palette) {
		ncolors = TheScreen->format->palette->ncolors;
		if (!(palette = new SDL_Color[ncolors])) {
			delete[] pixels;
			return;
		}
		memcpy(palette, TheScreen->format->palette->colors,
			ncolors * sizeof(SDL_Color));
	}
	SDL_UnlockSurface(TheScreen);
#endif

	TheScreen = SDL_SetVideoMode(w, h, bpp, flags ^ SDL_FULLSCREEN);
	if (!TheScreen) {
		TheScreen = SDL_SetVideoMode(w, h, bpp, flags);
		if (!TheScreen) { // completely screwed.
#ifndef USE_OPENGL
			delete[] pixels;
			delete[] palette;
#endif
			fprintf(stderr, "Toggle to fullscreen, crashed all\n");
			Exit(-1);
		}
	}

	// Windows shows the SDL cursor when starting in fullscreen mode
	// then switching to window mode.  This hides the cursor again.
	SDL_ShowCursor(SDL_ENABLE);
	SDL_ShowCursor(SDL_DISABLE);

#ifdef USE_OPENGL
	InitOpenGL();
	ReloadGraphics();
	ReloadFonts();
	UI.Minimap.Reload();
#else
	SDL_LockSurface(TheScreen);
	memcpy(TheScreen->pixels, pixels, framesize);
	delete[] pixels;

	if (TheScreen->format->palette) {
		// !!! FIXME : No idea if that flags param is right.
		SDL_SetPalette(TheScreen, SDL_LOGPAL, palette, 0, ncolors);
		delete[] palette;
	}
	SDL_UnlockSurface(TheScreen);
#endif

	SDL_SetClipRect(TheScreen, &clip);

	Invalidate(); // Update display
#else // !USE_WIN32
	SDL_WM_ToggleFullScreen(TheScreen);
#endif

	Video.FullScreen = (TheScreen->flags & SDL_FULLSCREEN) ? 1 : 0;
}