コード例 #1
0
void
MessageLog_DoContextMenu(HWND hwndMessageLog)
	{	
	HMENU haMenu = ::CreatePopupMenu();
	Menu_AddItem(INOUT haMenu, IDM_PAUSE, "&Pause Log");
	::CheckMenuItem(haMenu, IDM_PAUSE, g_fMessageLogsPaused ? MF_CHECKED : MF_UNCHECKED);
	Menu_AddSeparator(INOUT haMenu);
	Menu_AddItem(INOUT haMenu, IDM_EDIT_COPY_SELECTION, "&Copy");
	Menu_AddItem(INOUT haMenu, IDM_EDIT_CUT_SELECTION, "C&ut");
	Menu_AddItem(INOUT haMenu, IDM_EDIT_SELECT_ALL, "Select &All");
	Menu_AddSeparator(INOUT haMenu);
	Menu_AddItem(INOUT haMenu, IDM_EDIT_CLEAR_ALL, "Clear &Log");

	HWND hwndRichEdit = MessageLog_HGetRichEdit(hwndMessageLog);
	int ichSelectionStart;
	int ichSelectionEnd;
	SendMessage(hwndRichEdit, EM_GETSEL, OUT (WPARAM)&ichSelectionStart, OUT (LPARAM)&ichSelectionEnd);
	const int cchSelection = ichSelectionEnd - ichSelectionStart;
	Menu_EnableItem(haMenu, IDM_EDIT_COPY_SELECTION, cchSelection);
	Menu_EnableItem(haMenu, IDM_EDIT_CUT_SELECTION, cchSelection);

	POINT pt;
	::GetCursorPos(OUT &pt);
	const int nCmdId = ::TrackPopupMenu(haMenu, TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD, pt.x + 2, pt.y + 2, d_zNA, g_hwndMainWindow, NULL);
	Verify( ::DestroyMenu(haMenu) );

	switch (nCmdId)
		{
	case 0:
		// The user selected nothing
		return;
	case IDM_EDIT_CUT_SELECTION:
		// Currint the selection cannot be achieved with the WM_CUT message because the RichEdit is in read-only.  Instead, the selection is copied, and the selection is replaced with an empty string.
		::SendMessage(hwndRichEdit, WM_COPY, d_zNA, d_zNA);
		::SendMessage(hwndRichEdit, EM_REPLACESEL, FALSE /* fCanUndo */, (LPARAM)NULL);
		break;
	case IDM_EDIT_COPY_SELECTION:
		::SendMessage(hwndRichEdit, WM_COPY, d_zNA, d_zNA);
		break;
	case IDM_EDIT_SELECT_ALL:
		::SendMessage(hwndRichEdit, EM_SETSEL, 0, -1);
		break;
	case IDM_EDIT_CLEAR_ALL:
		::SendMessage(hwndRichEdit, WM_SETTEXT, d_zNA, (LPARAM)NULL);
		break;
	case IDM_PAUSE:
		g_fMessageLogsPaused = ~g_fMessageLogsPaused;
		break;
		} // switch
	} // MessageLog_DoContextMenu()
コード例 #2
0
ファイル: jabber_menu.cpp プロジェクト: Seldom/miranda-ng
void CJabberProto::CheckMenuItems()
{
    bool bEnabled = (m_menuItemsStatus != 0);
    Menu_EnableItem(m_hMenuChangePassword, bEnabled);
    Menu_EnableItem(m_hMenuGroupchat, bEnabled);

    Menu_EnableItem(m_hMenuPrivacyLists, bEnabled);
    Menu_EnableItem(m_hMenuRosterControl, bEnabled);
    Menu_EnableItem(m_hMenuServiceDiscovery, bEnabled);
    Menu_EnableItem(m_hMenuSDMyTransports, bEnabled);
    Menu_EnableItem(m_hMenuSDTransports, bEnabled);
    Menu_EnableItem(m_hMenuSDConferences, bEnabled);

    bEnabled = m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE);
    Menu_ShowItem(m_hMenuNotes, bEnabled);
    Menu_ShowItem(m_hMenuBookmarks, bEnabled);

    Menu_ShowItem(m_hPrivacyMenuRoot, m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVACY_LISTS));

    Menu_ShowItem(m_hMenuPriorityRoot, m_menuItemsStatus != 0);

    for (int i = 0; i < m_pepServices.getCount(); i++)
        Menu_ShowItem(m_pepServices[i].GetMenu(), m_bPepSupported);

    JabberUpdateDialogs(m_menuItemsStatus);
}
コード例 #3
0
ファイル: QuoteInfoDlg.cpp プロジェクト: Seldom/miranda-ng
int Quotes_PrebuildContactMenu(WPARAM wp, LPARAM)
{
	Menu_EnableItem(g_hMenuEditSettings, false);
	Menu_EnableItem(g_hMenuOpenLogFile, false);
#ifdef CHART_IMPLEMENT
	Menu_EnableItem(g_hMenuChart,false);
#endif
	Menu_EnableItem(g_hMenuRefresh, false);

	MCONTACT hContact = MCONTACT(wp);
	if (NULL == hContact)
	{
		return 0;
	}

	Menu_EnableItem(g_hMenuEditSettings, true);

	Menu_EnableItem(g_hMenuRefresh, true);

	tstring sLogFileName;
	bool bThereIsLogFile = (true == get_log_file(hContact, sLogFileName))
		&& (false == sLogFileName.empty()) && (0 == _taccess(sLogFileName.c_str(), 04));
	if (true == bThereIsLogFile)
	{
#ifdef CHART_IMPLEMENT
		Menu_EnableItem(g_hMenuChart,true);
#endif
		Menu_EnableItem(g_hMenuOpenLogFile, true);
	}

	return 0;
}
コード例 #4
0
ファイル: boltun.cpp プロジェクト: Seldom/miranda-ng
static int MessagePrebuild(WPARAM hContact, LPARAM)
{
	if (!blInit || (db_get_b(hContact, "CList", "NotOnList", 0) == 1)) {
		Menu_EnableItem(hMenuItemAutoChat, false);
		Menu_EnableItem(hMenuItemNotToChat, false);
	}
	else {
		if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE))
			Menu_ModifyItem(hMenuItemAutoChat, NULL, Skin_LoadIcon(SKINICON_OTHER_TICK), CMIF_CHECKED);
		else
			Menu_ModifyItem(hMenuItemAutoChat, NULL, Skin_LoadIcon(SKINICON_OTHER_NOTICK), 0);

		if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE))
			Menu_ModifyItem(hMenuItemNotToChat, NULL, Skin_LoadIcon(SKINICON_OTHER_TICK), CMIF_CHECKED);
		else
			Menu_ModifyItem(hMenuItemNotToChat, NULL, Skin_LoadIcon(SKINICON_OTHER_NOTICK), 0);
	}
	return 0;
}
コード例 #5
0
ファイル: groupmenu.cpp プロジェクト: kxepal/miranda-ng
// wparam menu handle to pass to clc.c
// lparam WM_COMMAND HWND
static int OnBuildSubGroupMenu(WPARAM wParam, LPARAM)
{
	ClcGroup *group = (ClcGroup *)wParam;
	if (wParam == 0)
		return 0;

	if (MirandaExiting())
		return 0;

	bool showOfflineinGroup = CLCItems_IsShowOfflineGroup(group);
	bool gray2 = group->hideOffline == 0;

	Menu_EnableItem(hShowOfflineUsersHereMenuItem, gray2);
	Menu_SetChecked(hShowOfflineUsersHereMenuItem, showOfflineinGroup && gray2);
	return 0;
}
コード例 #6
0
ファイル: theme.cpp プロジェクト: wyrover/miranda-ng
void WhatsAppProto::ToggleStatusMenuItems(bool bEnable)
{
	Menu_EnableItem(m_hMenuCreateGroup, bEnable);
}