예제 #1
0
void CDComView::DoSerialMenu(CDComDoc *pDoc, CPoint point)
{
    TgtSerialIntf::TgtConnection sTgtConfig;
    TgtSerialIntf *pTgtIntf;
    CMenu mnuContext;
    CMenu *mnuPopupMenu;
    CMenu *mnuSubmenu;

    mnuContext.LoadMenu(IDR_SERIAL_CONTEXT);
    mnuPopupMenu = mnuContext.GetSubMenu(0);

    pTgtIntf = (TgtSerialIntf*)pDoc->m_pTgtIntf;

    sTgtConfig = pTgtIntf->TgtGetConfig();

    mnuSubmenu = mnuPopupMenu->GetSubMenu(0);
    CheckMenuItems(mnuSubmenu, g_baudMap, sizeof(g_baudMap) / sizeof(SMyMap), sTgtConfig.m_dwBaudRate);

    mnuSubmenu = mnuPopupMenu->GetSubMenu(1);
    CheckMenuItems(mnuSubmenu, g_parityMap, sizeof(g_parityMap) / sizeof(SMyMap), sTgtConfig.m_byParity);

    mnuSubmenu = mnuPopupMenu->GetSubMenu(2);
    CheckMenuItems(mnuSubmenu, g_byteSizeMap, sizeof(g_byteSizeMap) / sizeof(SMyMap), sTgtConfig.m_byByteSize);

    mnuSubmenu = mnuPopupMenu->GetSubMenu(3);
    CheckMenuItems(mnuSubmenu, g_stopBitsMap, sizeof(g_stopBitsMap) / sizeof(SMyMap), sTgtConfig.m_byStopBits);

    mnuPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
}
예제 #2
0
파일: main.cpp 프로젝트: Seldom/miranda-ng
int SystemModulesLoaded(WPARAM, LPARAM)
{
	//Insert "Check mail (YAMN)" item to Miranda's menu
	CMenuItem mi;
	
	SET_UID(mi, 0xa01ff3d9, 0x53cb, 0x4406, 0x85, 0xd9, 0xf1, 0x90, 0x3a, 0x94, 0xed, 0xf4);
	mi.position = 0xb0000000;
	mi.hIcolibItem = g_GetIconHandle(0);
	mi.name.a = LPGEN("Check &mail (All Account)");
	mi.pszService = MS_YAMN_FORCECHECK;
	hMenuItemMain = Menu_AddMainMenuItem(&mi);

	SET_UID(mi, 0xfe22191f, 0x40c8, 0x479f, 0x93, 0x5d, 0xa5, 0x17, 0x1f, 0x57, 0x2f, 0xcb);
	mi.name.a = LPGEN("Check &mail (This Account)");
	mi.pszService = MS_YAMN_CLISTCONTEXT;
	hMenuItemCont = Menu_AddContactMenuItem(&mi, YAMN_DBMODULE);

	SET_UID(mi, 0x147c7800, 0x12d0, 0x4209, 0xab, 0xcc, 0xfa, 0x64, 0xc6, 0xb0, 0xa6, 0xeb);
	mi.hIcolibItem = g_GetIconHandle(1);
	mi.name.a = LPGEN("Launch application");
	mi.pszService = MS_YAMN_CLISTCONTEXTAPP;
	hMenuItemContApp = Menu_AddContactMenuItem(&mi, YAMN_DBMODULE);

	CheckMenuItems();

	if (hAccountFolder = FoldersRegisterCustomPathT(LPGEN("YAMN"), LPGEN("YAMN Account Folder"), UserDirectory))
		FoldersGetCustomPathT(hAccountFolder, UserDirectory, MAX_PATH, UserDirectory);

	RegisterPOP3Plugin(0, 0);
	return 0;
}
예제 #3
0
파일: main.cpp 프로젝트: martok/miranda-ng
int SystemModulesLoaded(WPARAM, LPARAM)
{
	//Insert "Check mail (YAMN)" item to Miranda's menu
	CLISTMENUITEM mi = { sizeof(mi) };
	mi.position = 0xb0000000;
	mi.icolibItem = g_GetIconHandle(0);
	mi.pszName = LPGEN("Check &mail (All Account)");
	mi.pszPopupName = NULL;//YAMN_DBMODULE;
	mi.pszService = MS_YAMN_FORCECHECK;
	hMenuItemMain = Menu_AddMainMenuItem(&mi);

	mi.pszName = LPGEN("Check &mail (This Account)");
	mi.pszContactOwner = YAMN_DBMODULE;
	mi.pszService = MS_YAMN_CLISTCONTEXT;
	hMenuItemCont = Menu_AddContactMenuItem(&mi);

	mi.icolibItem = g_GetIconHandle(1);
	mi.pszName = LPGEN("Launch application");
	mi.pszContactOwner = YAMN_DBMODULE;
	mi.pszService = MS_YAMN_CLISTCONTEXTAPP;
	hMenuItemContApp = Menu_AddContactMenuItem(&mi);

	CheckMenuItems();

	if (hAccountFolder = FoldersRegisterCustomPathT(LPGEN("YAMN"), LPGEN("YAMN Account Folder"), UserDirectory))
		FoldersGetCustomPathT(hAccountFolder, UserDirectory, MAX_PATH, UserDirectory);

	RegisterPOP3Plugin(0, 0);
	return 0;
}
예제 #4
0
void CJabberProto::EnableMenuItems(BOOL bEnable)
{
    m_menuItemsStatus = bEnable;
    CheckMenuItems();
}
예제 #5
0
void CJabberProto::MenuInit()
{
    CMenuItem mi;
    mi.root = m_hMenuRoot = Menu_GetProtocolRoot(this);
    mi.flags = CMIF_UNMOVABLE;

    // "Bookmarks..."
    mi.pszService = "/Bookmarks";
    CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleBookmarks);
    mi.name.a = LPGEN("Bookmarks");
    mi.position = 200001;
    mi.hIcolibItem = GetIconHandle(IDI_BOOKMARKS);
    m_hMenuBookmarks = Menu_AddProtoMenuItem(&mi, m_szModuleName);

    // "Services..."
    mi.pszService = NULL;
    mi.name.a = LPGEN("Services...");
    mi.position = 200003;
    mi.hIcolibItem = GetIconHandle(IDI_SERVICE_DISCOVERY);
    HGENMENU hMenuServicesRoot = Menu_AddProtoMenuItem(&mi, m_szModuleName);

    // "Service Discovery..."
    mi.root = hMenuServicesRoot;
    mi.pszService = "/ServiceDiscovery";
    CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleServiceDiscovery);
    mi.name.a = LPGEN("Service Discovery");
    mi.position = 2000050001;
    mi.hIcolibItem = GetIconHandle(IDI_SERVICE_DISCOVERY);
    m_hMenuServiceDiscovery = Menu_AddProtoMenuItem(&mi, m_szModuleName);

    mi.pszService = "/SD/MyTransports";
    CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleServiceDiscoveryMyTransports);
    mi.name.a = LPGEN("Registered Transports");
    mi.position = 2000050003;
    mi.hIcolibItem = GetIconHandle(IDI_TRANSPORTL);
    m_hMenuSDMyTransports = Menu_AddProtoMenuItem(&mi, m_szModuleName);

    mi.pszService = "/SD/Transports";
    CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleServiceDiscoveryTransports);
    mi.name.a = LPGEN("Local Server Transports");
    mi.position = 2000050004;
    mi.hIcolibItem = GetIconHandle(IDI_TRANSPORT);
    m_hMenuSDTransports = Menu_AddProtoMenuItem(&mi, m_szModuleName);

    mi.pszService = "/SD/Conferences";
    CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleServiceDiscoveryConferences);
    mi.name.a = LPGEN("Browse chatrooms");
    mi.position = 2000050005;
    mi.hIcolibItem = GetIconHandle(IDI_GROUP);
    m_hMenuSDConferences = Menu_AddProtoMenuItem(&mi, m_szModuleName);

    mi.pszService = "/Groupchat";
    CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleJoinGroupchat);
    mi.name.a = LPGEN("Create/Join group chat");
    mi.position = 2000050006;
    mi.hIcolibItem = GetIconHandle(IDI_GROUP);
    m_hMenuGroupchat = Menu_AddProtoMenuItem(&mi, m_szModuleName);

    // "Change Password..."
    mi.pszService = "/ChangePassword";
    CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleChangePassword);
    mi.name.a = LPGEN("Change Password");
    mi.position = 2000050007;
    mi.hIcolibItem = GetIconHandle(IDI_KEYS);
    m_hMenuChangePassword = Menu_AddProtoMenuItem(&mi, m_szModuleName);

    // "Roster editor"
    mi.pszService = "/RosterEditor";
    CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleRosterControl);
    mi.name.a = LPGEN("Roster editor");
    mi.position = 2000050009;
    mi.hIcolibItem = GetIconHandle(IDI_AGENTS);
    m_hMenuRosterControl = Menu_AddProtoMenuItem(&mi, m_szModuleName);

    // "XML Console"
    mi.pszService = "/XMLConsole";
    CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleConsole);
    mi.name.a = LPGEN("XML Console");
    mi.position = 2000050010;
    mi.hIcolibItem = GetIconHandle(IDI_CONSOLE);
    Menu_AddProtoMenuItem(&mi, m_szModuleName);

    mi.pszService = "/Notes";
    CreateProtoService(mi.pszService, &CJabberProto::OnMenuHandleNotes);
    mi.name.a = LPGEN("Notes");
    mi.position = 2000050011;
    mi.hIcolibItem = GetIconHandle(IDI_NOTES);
    m_hMenuNotes = Menu_AddProtoMenuItem(&mi, m_szModuleName);

    BuildPrivacyMenu();
    if (m_menuItemsStatus)
        BuildPrivacyListsMenu(false);

    //////////////////////////////////////////////////////////////////////////////////////
    // build priority menu

    m_priorityMenuVal = 0;
    m_priorityMenuValSet = false;

    mi.pszService = NULL;
    mi.position = 200006;
    mi.root = m_hMenuRoot;
    mi.name.a = LPGEN("Resource priority");
    mi.flags = CMIF_UNMOVABLE | CMIF_HIDDEN;
    m_hMenuPriorityRoot = Menu_AddProtoMenuItem(&mi);

    TCHAR szName[128];
    char srvFce[MAX_PATH + 64];
    mi.pszService = srvFce;
    mi.name.t = szName;
    mi.position = 2000040000;
    mi.flags = CMIF_UNMOVABLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
    mi.root = m_hMenuPriorityRoot;

    mir_snprintf(srvFce, "/menuSetPriority/%d", 0);
    bool needServices = !ProtoServiceExists(m_szModuleName, srvFce);
    if (needServices)
        CreateProtoServiceParam(srvFce, &CJabberProto::OnMenuSetPriority, 0);

    int steps[] = { 10, 5, 1, 0, -1, -5, -10 };
    for (int i = 0; i < _countof(steps); i++) {
        if (!steps[i]) {
            mi.position += 100000;
            continue;
        }

        mir_snprintf(srvFce, "/menuSetPriority/%d", steps[i]);
        if (steps[i] > 0) {
            mir_sntprintf(szName, TranslateT("Increase priority by %d"), steps[i]);
            mi.hIcolibItem = GetIconHandle(IDI_ARROW_UP);
        }
        else {
            mir_sntprintf(szName, TranslateT("Decrease priority by %d"), -steps[i]);
            mi.hIcolibItem = GetIconHandle(IDI_ARROW_DOWN);
        }

        if (needServices)
            CreateProtoServiceParam(srvFce, &CJabberProto::OnMenuSetPriority, (LPARAM)steps[i]);

        mi.position++;
        Menu_AddProtoMenuItem(&mi, m_szModuleName);
    }

    UpdatePriorityMenu((short)getWord("Priority", 0));

    //////////////////////////////////////////////////////////////////////////////////////
    // finalize status menu

    m_pepServices.RebuildMenu();
    CheckMenuItems();

    NotifyFastHook(hStatusMenuInit, (WPARAM)m_hMenuRoot, (LPARAM)(IJabberInterface*)this);
}
예제 #6
0
int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
{
    MSG     msg;
    DWORD   lastTime,newTime;

    /* Detect if we have support for TrueColor */
    haveTrueColor = DetectTrueColor();

    /* Save instance handle for dialog boxes */
    hInstApp = hInst;

    if (!hPrev) {
        /* Register a class for the main application window */
        WNDCLASS cls;
        cls.hCursor        = LoadCursor(NULL,IDC_ARROW);
        cls.hIcon          = LoadIcon(hInst,"AppIcon");
        cls.lpszMenuName   = "AppMenu";
        cls.lpszClassName  = szAppName;
        cls.hbrBackground  = NULL;
        cls.hInstance      = hInst;
        cls.style          = CS_BYTEALIGNCLIENT | CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
        cls.lpfnWndProc    = (LPVOID)AppWndProc;
        cls.cbWndExtra     = 0;
        cls.cbClsExtra     = 0;
        if (!RegisterClass(&cls))
            return FALSE;
        }

    /* Register the ISV license file if desired */
#ifdef  ISV_LICENSE
    GA_registerLicense(OemLicense,false);
#endif

    /* Initialise the MGL */
    InitMGL();

    /* Create the main window and display it */
    hwndApp = CreateWindow(szAppName,szAppName,WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT,0,400,400,NULL,NULL,hInst,NULL);
    ShowWindow(hwndApp,sw);
    CheckMenuItems(hwndApp);

    /* Polling messages from event queue */
    lastTime = timeGetTime();
    while (1) {
        if (PeekMessage(&msg, NULL, 0, 0,PM_REMOVE)) {
            if (msg.message == WM_QUIT)
                break;
            TranslateMessage(&msg);
            DispatchMessage(&msg);
            }
        else if (animatePalette) {
            newTime = timeGetTime();
            if ((newTime - lastTime) > 100) {
                int palsize;

                /* Rotate the hardware palette */
                palsize = MGL_getPaletteSize(winDC);
                MGL_rotatePalette(winDC,palsize-2,1,MGL_ROTATE_UP);
                MGL_realizePalette(winDC,palsize,0,true);
                lastTime = newTime;
                }
            }
        }

    /* Clean up the MGL before exit */
    MGL_exit();
    return msg.wParam;
}
예제 #7
0
LONG CALLBACK AppWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
/****************************************************************************
*
* Function:     AppWndProc
*
* Description:  Main window proc for application.
*
****************************************************************************/
{
    PAINTSTRUCT ps;
    HDC         hdc;

    switch (msg) {
        case WM_ACTIVATEAPP:
            fAppActive = (BOOL)wParam;
            if (!includeStatic) {
                AppActivate(fAppActive);
                }
            break;
        case WM_COMMAND:
            switch (wParam) {
                case MENU_OPEN:
                    OpenBitmapFile(hwnd);
                    break;
                case MENU_ABOUT:
                    DialogBox(hInstApp,"AppAbout",hwnd,(DLGPROC)AppAbout);
                    break;
                case MENU_EXIT:
                    PostMessage(hwnd,WM_CLOSE,0,0L);
                    break;
                case MENU_STRETCH_TOWINDOW:
                    stretchBlt = !stretchBlt;
                    CheckMenuItems(hwnd);
                    InvalidateRect(hwnd, NULL, FALSE);
                    break;
                case MENU_STATIC_COLORS:
                    if (includeStatic) {
                        /* Enable use of static colors */
                        includeStatic = false;
                        AppActivate(true);
                        }
                    else {
                        /* Remap the system colors to normal */
                        includeStatic = true;
                        AppActivate(false);
                        }
                    CheckMenuItems(hwnd);

                    /* Rebuild the MGL device context to re-build the
                     * palette for the loaded bitmap.
                     */
                    CreateMGLDeviceContexts(hwnd);
                    InvalidateRect(hwnd, NULL, FALSE);
                    break;
                case MENU_ANIMATE_PALETTE:
                    animatePalette = !animatePalette;
                    CheckMenuItems(hwnd);
                    break;
                }
            return 0;
        case WM_CREATE:
            CreateMGLDeviceContexts(hwnd);
            break;
        case WM_DESTROY:
            PostQuitMessage(0);
            break;
        case WM_PALETTECHANGED:
            if ((HWND)wParam == hwnd)
                break;
            /* Fall through to WM_QUERYNEWPALETTE */
        case WM_QUERYNEWPALETTE:
            if (winDC && memDC) {
                LoadBitmapPalette(winDC,memDC);
                InvalidateRect(hwnd,NULL,TRUE);
                return 1;
                }
            return 0;
        case WM_PAINT:
            if (!winDC)
                break;
            hdc = BeginPaint(hwnd,&ps);
            PatBlt(hdc,0,0,MGL_sizex(winDC)+1,MGL_sizey(winDC)+1,WHITENESS);
            if (memDC) {
                if (stretchBlt) {
                    MGL_stretchBltCoord(winDC,memDC,
                        0,0,MGL_sizex(memDC)+1,MGL_sizey(memDC)+1,
                        0,0,MGL_sizex(winDC)+1,MGL_sizey(winDC)+1,MGL_REPLACE_MODE);
                    }
                else {
                    MGL_bitBltCoord(winDC,memDC,
                        0,0,MGL_sizex(memDC)+1,MGL_sizey(memDC)+1,
                        0,0,MGL_REPLACE_MODE);
                    }
                }
            EndPaint(hwnd,&ps);
            return 0;
        }
    return DefWindowProc(hwnd,msg,wParam,lParam);
}