Exemplo n.º 1
0
HotKeyManager::~HotKeyManager()
{
	SetHotKey(HK_Play, 0, 0);
	SetHotKey(HK_Stop, 0, 0);
	SetHotKey(HK_Prev, 0, 0);
	SetHotKey(HK_Next, 0, 0);
	SetHotKey(HK_ToggleMiniPlayer, 0, 0);
	EnableMultimediaHotKeys(FALSE);
}
Exemplo n.º 2
0
/* 光标跟随 */
inline static int cursor_follow(Configure *c, void *a, int isread)
{
    if(isread)
        SetHotKey((char *)a, hkTrack);
    else
        fprintf((FILE *)a, "%s=%s\n", c->name, "CTRL_K");
    return 0;
}
Exemplo n.º 3
0
/* 隐藏主窗口 */
inline static int hide_main_window(Configure *c, void *a, int isread)
{
    if(isread)
        SetHotKey((char *)a, hkHideMainWindow);
    else
        fprintf((FILE *)a, "%s=%s\n", c->name, "CTRL_ALT_H");
    return 0;
}
Exemplo n.º 4
0
void HotKeyManager::Init()//HWND hWndTarget)
{
	PrgAPI* pAPI = PRGAPI();
	AppSettings* appSettings = pAPI->GetAppSettings();
	INT value = 0;
	m_hWnd = NULL;//hWndTarget;

	appSettings->Read(HotKeyManagerSettingsCategory, cHotkeyPlay, value, 0);
	SetHotKey(HK_Play, HIWORD(value), LOWORD(value));
	appSettings->Read(HotKeyManagerSettingsCategory, cHotkeyStop, value, 0);
	SetHotKey(HK_Stop, HIWORD(value), LOWORD(value));
	appSettings->Read(HotKeyManagerSettingsCategory, cHotkeyPrev, value, 0);
	SetHotKey(HK_Prev, HIWORD(value), LOWORD(value));
	appSettings->Read(HotKeyManagerSettingsCategory, cHotkeyNext, value, 0);
	SetHotKey(HK_Next, HIWORD(value), LOWORD(value));
	appSettings->Read(HotKeyManagerSettingsCategory, cHotkeyMiniPlayer, value, 0);
	SetHotKey(HK_ToggleMiniPlayer, HIWORD(value), LOWORD(value));
	appSettings->Read(HotKeyManagerSettingsCategory, cHotkeyTooltip, value, 0);
	SetHotKey(HK_Tooltip, HIWORD(value), LOWORD(value));
	appSettings->Read(HotKeyManagerSettingsCategory, cHotkeyQuickSearch, value, 0);
	SetHotKey(HK_QuickSearch, HIWORD(value), LOWORD(value));


	EnableMultimediaHotKeys(pAPI->GetOption(OPT_GEN_MultimediaKeysActive) == 1);

}
Exemplo n.º 5
0
/* GBK支持 */
inline static int gbk_support(Configure *c, void *a, int isread)
{
    if(isread)
        SetHotKey((char *)a, hkGBK);
    else
        fprintf((FILE *)a, "%s=%s\n", c->name, "CTRL_M");

    return 0;
}
Exemplo n.º 6
0
/* 删除拼音常用字 */
inline static int delete_pinyin_frequently_used_word(Configure *c, void *a, int isread)
{
    if(isread)
        SetHotKey((char *)a, hkPYDelFreq);
    else
        fprintf((FILE *)a, "%s=%s\n", c->name, "CTRL_7");

    return 0;
}
Exemplo n.º 7
0
/* 重置记录模式 */
inline static int reset_recording(Configure *c, void *a, int isread)
{
    if(isread)
        SetHotKey((char *)a, hkResetRecording);
    else
        fprintf((FILE *)a, "%s=%s\n", c->name, "CTRL_ALT_A");

    return 0;
}
Exemplo n.º 8
0
/* 删除拼音用户词组 */
inline static int delete_pinyin_user_create_phrase(Configure *c, void *a, int isread)
{
    if(isread)
        SetHotKey((char *)a, hkPYDelUserPhr);
    else
        fprintf((FILE *)a, "%s=%s\n", c->name, "CTRL_DELETE");

    return 0;
}
Exemplo n.º 9
0
/* 下一页 */
inline static int next_page(Configure *c, void *a, int isread)
{
    if(isread)
        SetHotKey((char *)a, hkNextPage);
    else
        fprintf((FILE *)a, "%s=%s\n", c->name, "=");

    return 0;
}
Exemplo n.º 10
0
/* 保存词库 */
inline static int save_all(Configure *c, void *a, int isread)
{
    if(isread)
        SetHotKey((char *)a, hkSaveAll);
    else
        fprintf((FILE *)a, "%s=%s\n", c->name, "CTRL_ALT_S");

    return 0;
}
Exemplo n.º 11
0
/* 全半角 */
inline static int sbc_dbc_switch(Configure *c, void *a, int isread)
{
    if(isread)
        SetHotKey((char *)a, hkCorner);
    else
        fprintf((FILE *)a, "%s=%s\n", c->name, "SHIFT_SPACE");

    return 0;
}
Exemplo n.º 12
0
/* 中文标点 */
inline static int chinese_punctuation(Configure *c, void *a, int isread)
{
    if(isread)
        SetHotKey((char *)a, hkPunc);
    else
        fprintf((FILE *)a, "%s=%s\n", c->name, "ALT_SPACE");

    return 0;
}
Exemplo n.º 13
0
/* 联想 */
inline static int association(Configure *c, void *a, int isread)
{
    if(isread)
        SetHotKey((char *)a, hkLegend);
    else
        fprintf((FILE *)a, "%s=%s\n", c->name, "CTRL_L");

    return 0;
}
Exemplo n.º 14
0
/* 反查拼音 */
inline static int lookup_pinyin(Configure *c, void *a, int isread)
{
    if(isread)
        SetHotKey((char *)a, hkGetPY);
    else
        fprintf((FILE *)a, "%s=%s\n", c->name, "CTRL_ALT_E");

    return 0;
}
Exemplo n.º 15
0
/* 切换虚拟键盘 */
inline static int switch_vk(Configure *c, void *a, int isread)
{
    if(isread)
        SetHotKey((char *)a, hkVK);
    else
        fprintf((FILE *)a, "%s=%s\n", c->name, "CTRL_ALT_K");

    return 0;
}
Exemplo n.º 16
0
/* GBK繁体切换键 */
inline static int gbk_traditional_simplified_switch(Configure *c, void *a, int isread)
{
    if(isread)
        SetHotKey((char *)a, hkGBT);
    else
        fprintf((FILE *)a, "%s=%s\n", c->name, "CTRL_ALT_F");

    return 0;
}
Exemplo n.º 17
0
/* 打开/关闭输入法 */
inline static int trigger_input_method(Configure *c, void *a, int isread)
{
    if(isread){
        if(bIsReloadConfig){
            SetTriggerKeys((char *)a);
            SetHotKey((char *)a, hkTrigger);
        }
    }else
        fprintf((FILE *)a, "%s=%s\n", c->name, "CTRL_SPACE");

    return 0;
}
Exemplo n.º 18
0
BOOL CSHCTHotKey::PreTranslateMessage(MSG* pMsg)
{
  // This is all to allow user to add special characters like ENTER, DELETE into
  // their assigned Hotkey
  if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP) {
    const UINT_PTR nChar = pMsg->wParam;
    if ((nChar == VK_RETURN && 
            (GetKeyState(VK_CONTROL) < 0 || GetKeyState(VK_MENU) < 0)) ||
        (nChar == VK_TAB &&
            (GetKeyState(VK_CONTROL) < 0 || GetKeyState(VK_MENU) < 0)) ||
        (nChar == VK_NUMLOCK &&
            (GetKeyState(VK_CONTROL) < 0 || GetKeyState(VK_MENU) < 0)) ||
        (nChar == VK_SCROLL &&
            (GetKeyState(VK_CONTROL) < 0 || GetKeyState(VK_MENU) < 0)) ||
        (nChar == VK_CANCEL &&
            (GetKeyState(VK_CONTROL) < 0 || GetKeyState(VK_MENU) < 0)) ||
        (nChar == VK_DELETE) ||
        (nChar == VK_SPACE)  ||
        (nChar == VK_BACK)) {
      if (pMsg->message == WM_KEYUP)
        return TRUE;

      WORD wVirtualKeyCode, wHKModifiers;
      GetHotKey(wVirtualKeyCode, wHKModifiers);

      // Enter sets the Hotkey unless user did Ctrl+Enter, or
      // Alt+Enter or Ctrl+Alt+Enter, in which is taken as a HotKey
      if (nChar == VK_RETURN && 
          ((wHKModifiers & HOTKEYF_CONTROL) != HOTKEYF_CONTROL &&
           (wHKModifiers & HOTKEYF_ALT    ) != HOTKEYF_ALT    )) {
        CHotKeyCtrl::PreTranslateMessage(pMsg);
      }

      // No current key means don't want to use the current modifiers.
      if (wVirtualKeyCode != 0)
        wHKModifiers = 0;

      // Set extended to make sure we get DEL and not NUM DECIMAL
      if (nChar == VK_DELETE)
        wHKModifiers |= HOTKEYF_EXT;

      wVirtualKeyCode = (WORD)nChar;
      SetHotKey(wVirtualKeyCode, wHKModifiers);

      // Just in case parent requires notification of a change
      m_pParent->SendMessage(WM_COMMAND, MAKEWPARAM(IDC_SHORTCUTHOTKEY, EN_CHANGE), 0);
      return TRUE;
    }
  }
  return CHotKeyCtrl::PreTranslateMessage(pMsg);
}
Exemplo n.º 19
0
BOOL CSHCTHotKey::PreTranslateMessage(MSG* pMsg)
{
  if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP) {
    const UINT_PTR nChar = pMsg->wParam;
    if ((nChar == VK_RETURN && 
            (GetKeyState(VK_CONTROL) < 0 || GetKeyState(VK_MENU) < 0)) ||
        (nChar == VK_TAB &&
            (GetKeyState(VK_CONTROL) < 0 || GetKeyState(VK_MENU) < 0)) ||
        (nChar == VK_NUMLOCK &&
            (GetKeyState(VK_CONTROL) < 0 || GetKeyState(VK_MENU) < 0)) ||
        (nChar == VK_SCROLL &&
            (GetKeyState(VK_CONTROL) < 0 || GetKeyState(VK_MENU) < 0)) ||
        (nChar == VK_CANCEL &&
            (GetKeyState(VK_CONTROL) < 0 || GetKeyState(VK_MENU) < 0)) ||
        (nChar == VK_DELETE) ||
        (nChar == VK_SPACE)  ||
        (nChar == VK_BACK)) {
    if (pMsg->message == WM_KEYUP)
      return TRUE;

      WORD wVK, wMod;
      GetHotKey(wVK, wMod);

      // Enter sets the Hotkey unless user did Ctrl+Enter, or
      // Alt+Enter or Ctrl+Alt+Enter, in which is taken as a HotKey
      if (nChar == VK_RETURN && 
          ((wMod & HOTKEYF_CONTROL) != HOTKEYF_CONTROL &&
           (wMod & HOTKEYF_ALT    ) != HOTKEYF_ALT    )) {
        CHotKeyCtrl::PreTranslateMessage(pMsg);
      }

      // No current key means don't want to use the current modifiers.
      if (wVK != 0)
        wMod = 0;

      // Set extended to make sure we get DEL and not NUM DECIMAL
      if (nChar == VK_DELETE)
        wMod |= HOTKEYF_EXT;

      wVK = (WORD)nChar;
      SetHotKey(wVK, wMod);

      m_pParent->SendMessage(WM_COMMAND, MAKEWPARAM(IDC_SHORTCUTHOTKEY, EN_CHANGE), 0);
      return TRUE;
    }
  }
  return CHotKeyCtrl::PreTranslateMessage(pMsg);
}
Exemplo n.º 20
0
__fastcall TTVPMainForm::TTVPMainForm(TComponent* Owner)
	: TForm(Owner)
{
	ContinuousEventCalling = false;
	AutoShowConsoleOnError = false;
	ApplicationStayOnTop = false;
	ApplicationActivating = true;
	ApplicationNotMinimizing = true;
	LastCloseClickedTick = 0;
	LastShowModalWindowSentTick = 0;
	LastRehashedTick = 0;
	Application->OnIdle = ApplicationIdle;
	Application->OnActivate = ApplicationActivate;
	Application->OnDeactivate = ApplicationDeactivate;
	Application->OnMinimize = ApplicationMinimize;
	Application->OnRestore = ApplicationRestore;

	// get command-line options which specifies global hot keys.
	SetHotKey(ShowControllerMenuItem, TJS_W("-hkcontroller"));
	SetHotKey(ShowScriptEditorMenuItem, TJS_W("-hkeditor"));
	SetHotKey(ShowWatchMenuItem, TJS_W("-hkwatch"));
	SetHotKey(ShowConsoleMenuItem, TJS_W("-hkconsole"));
	SetHotKey(ShowAboutMenuItem, TJS_W("-hkabout"));
	SetHotKey(CopyImportantLogMenuItem, TJS_W("-hkclipenvinfo"));


	// read previous state from environ profile
	tTVPProfileHolder *prof = TVPGetEnvironProfile();
	TVPEnvironProfileAddRef();
	static AnsiString section("controller");
	int n;
	n = prof->ReadInteger(section, "left", -1);
	if(n != -1) Left = n;
	n = prof->ReadInteger(section, "top", -1);
	if(n != -1) Top = n;
	n = prof->ReadInteger(section, "stayontop", 0);
	FormStyle = n ? fsStayOnTop : fsNormal;

	if(Left > Screen->Width) Left = Screen->Width - Width;
	if(Top > Screen->Height) Top = Screen->Height - Height;

	section = "console";
	n = prof->ReadInteger(section, "autoshowonerror", 0);
	AutoShowConsoleOnError = (bool)n;

	TVPMainFormAlive = true;
}
Exemplo n.º 21
0
	void CHotKeyWnd::Init(CHotKeyUI * pOwner)
	{
		m_pOwner = pOwner;
		do  {
			if (NULL == m_pOwner) {
				break;
			}
			RECT rcPos = CalPos();
			UINT uStyle = WS_CHILD | ES_AUTOHSCROLL;
			HWND hWnd = Create(m_pOwner->GetManager()->GetPaintWindow(), NULL, uStyle, 0, rcPos);
			if (!IsWindow(hWnd)) {
				break;
			}
			SetWindowFont(m_hWnd, m_pOwner->GetManager()->GetFontInfo(m_pOwner->GetFont())->hFont, TRUE);
			SetHotKey(m_pOwner->m_wVirtualKeyCode, m_pOwner->m_wModifiers);
			m_pOwner->m_sText = GetHotKeyName();
			::EnableWindow(m_hWnd, m_pOwner->IsEnabled() == true);
			::ShowWindow(m_hWnd, SW_SHOWNOACTIVATE);
			::SetFocus(m_hWnd);
			m_bInit = true;
		} while (0);
	}
Exemplo n.º 22
0
BOOL TSetupSheet::GetData()
{
	char	buf[MAX_PATH_U8];
	int		i;

	if (resId == SETUP_SHEET1) {
		BOOL	need_broadcast = FALSE;

		GetDlgItemTextU8(NICKNAME_EDIT, buf, MAX_NAMEBUF);
		if (strcmp(cfg->NickNameStr, buf)) {
			need_broadcast = TRUE;
			strcpy(cfg->NickNameStr, buf);
		}
		GetDlgItemTextU8(GROUP_COMBO, buf, MAX_NAMEBUF);
		if (strcmp(cfg->GroupNameStr, buf)) {
			need_broadcast = TRUE;
			strcpy(cfg->GroupNameStr, buf);
		}
		if (need_broadcast) {
			::PostMessage(GetMainWnd(), WM_IPMSG_BRNOTIFY, 0, IPMSG_DEFAULT_PORT);
		}

		if (SendDlgItemMessage(CLIPMODE_CHECK, BM_GETCHECK, 0, 0)) {
			cfg->ClipMode |=  CLIP_ENABLE;
		} else {
			cfg->ClipMode &= ~CLIP_ENABLE;
		}
		if (SendDlgItemMessage(CLIPCONFIRM_CHECK, BM_GETCHECK, 0, 0)) {
			cfg->ClipMode |=  CLIP_CONFIRM;
		} else {
			cfg->ClipMode &= ~CLIP_CONFIRM;
		}
		cfg->brList.Reset();

		for (i=0; SendDlgItemMessage(BROADCAST_LIST, LB_GETTEXT, i, (LPARAM)buf) != LB_ERR; i++)
			cfg->brList.SetHostRaw(buf, ResolveAddr(buf));

		cfg->DialUpCheck = (int)SendDlgItemMessage(DIALUP_CHECK, BM_GETCHECK, 0, 0);
	}
	else if (resId == SETUP_SHEET2) {
		cfg->BalloonNotify = (int)SendDlgItemMessage(BALLOONNOTIFY_CHECK, BM_GETCHECK, 0, 0);
		cfg->OpenCheck = (int)SendDlgItemMessage(OPEN_COMBO, CB_GETCURSEL, 0, 0);
//		cfg->OpenCheck = (int)SendDlgItemMessage(OPEN_CHECK, BM_GETCHECK, 0, 0);
		GetDlgItemTextU8(QUOTE_EDIT, cfg->QuoteStr, sizeof(cfg->QuoteStr));

		cfg->HotKeyCheck = (int)SendDlgItemMessage(HOTKEY_CHECK, BM_GETCHECK, 0, 0);
		cfg->AbnormalButton = (int)SendDlgItemMessage(ABNORMALBTN_CHECK, BM_GETCHECK, 0, 0);
		if (::IsWindowEnabled(GetDlgItem(LCID_CHECK))) {
			cfg->lcid = IsDlgButtonChecked(LCID_CHECK) ? 0x409 : -1;
		}

		cfg->ExtendBroadcast = (int)SendDlgItemMessage(EXTBROADCAST_COMBO, CB_GETCURSEL, 0, 0);
		GetDlgItemTextU8(MAINICON_EDIT, cfg->IconFile, sizeof(cfg->IconFile));
		GetDlgItemTextU8(REVICON_EDIT, cfg->RevIconFile, sizeof(cfg->RevIconFile));
		::SendMessage(GetMainWnd(), WM_IPMSG_INITICON, 0, 0);
		SetDlgIcon(hWnd);
		SetHotKey(cfg);
	}
	else if (resId == SETUP_SHEET3) {
		cfg->QuoteCheck = (int)SendDlgItemMessage(QUOTE_CHECK, BM_GETCHECK, 0, 0);
		cfg->SecretCheck = (int)SendDlgItemMessage(SECRET_CHECK, BM_GETCHECK, 0, 0);
		cfg->OneClickPopup = (int)SendDlgItemMessage(ONECLICK_CHECK, BM_GETCHECK, 0, 0);
		GetDlgItemTextU8(LRUUSER_EDIT, buf, sizeof(buf));
		cfg->lruUserMax = atoi(buf);
	// ControlIME ... 0:off, 1:senddlg on (finddlg:off), 2:always on
		cfg->ControlIME = (int)SendDlgItemMessage(CONTROLIME_CHECK, BM_GETCHECK, 0, 0);
		if (cfg->ControlIME && SendDlgItemMessage(FINDDLGIME_CHECK, BM_GETCHECK, 0, 0) == 0) {
			cfg->ControlIME = 2;
		}
		cfg->NoPopupCheck = (int)SendDlgItemMessage(NOPOPUP_CHECK, BM_GETCHECK, 0, 0);
		cfg->NoBeep = (int)SendDlgItemMessage(NOBEEP_CHECK, BM_GETCHECK, 0, 0);
		cfg->AbsenceNonPopup = (int)SendDlgItemMessage(ABSENCENONPOPUP_CHECK, BM_GETCHECK, 0, 0);
		cfg->RecvLogonDisp = (int)SendDlgItemMessage(RECVLOGON_CHECK, BM_GETCHECK, 0, 0);
		cfg->RecvIPAddr = (int)SendDlgItemMessage(RECVIPADDR_CHECK, BM_GETCHECK, 0, 0);
		cfg->NoErase = (int)SendDlgItemMessage(NOERASE_CHECK, BM_GETCHECK, 0, 0);

		GetDlgItemTextU8(SOUND_EDIT, cfg->SoundFile, sizeof(cfg->SoundFile));
	}
	else if (resId == SETUP_SHEET4) {
		cfg->LogCheck = (int)SendDlgItemMessage(LOG_CHECK, BM_GETCHECK, 0, 0);
		cfg->LogonLog = (int)SendDlgItemMessage(LOGONLOG_CHECK, BM_GETCHECK, 0, 0);
		cfg->IPAddrCheck = (int)SendDlgItemMessage(IPADDR_CHECK, BM_GETCHECK, 0, 0);

		if (SendDlgItemMessage(IMAGESAVE_CHECK, BM_GETCHECK, 0, 0)) {
			cfg->ClipMode |=  2;
		} else {
			cfg->ClipMode &= ~2;
		}
		cfg->LogUTF8 = (int)SendDlgItemMessage(LOGUTF8_CHECK, BM_GETCHECK, 0, 0);
		cfg->PasswdLogCheck = (int)SendDlgItemMessage(PASSWDLOG_CHECK, BM_GETCHECK, 0, 0);

		GetDlgItemTextU8(LOG_EDIT, cfg->LogFile, sizeof(cfg->LogFile));
		if (cfg->LogCheck) LogMng::StrictLogFile(cfg->LogFile);
	}
	else if (resId == SETUP_SHEET5) {
		char	buf[MAX_NAMEBUF];
		GetDlgItemTextU8(OLDPASSWORD_EDIT, buf, sizeof(buf));
		if (CheckPassword(cfg->PasswordStr, buf)) {
			GetDlgItemTextU8(NEWPASSWORD_EDIT, buf, sizeof(buf));
			MakePassword(buf, cfg->PasswordStr);
		}
	}
	else if (resId == SETUP_SHEET6) {
		cfg->DefaultUrl = (int)SendDlgItemMessage(DEFAULTURL_CHECK, BM_GETCHECK, 0, 0);
		for (UrlObj *tmp_obj = (UrlObj *)tmpUrlList.TopObj(); tmp_obj;
			tmp_obj = (UrlObj *)tmpUrlList.NextObj(tmp_obj)) {
			UrlObj *obj = SearchUrlObj(&cfg->urlList, tmp_obj->protocol);

			if (!obj) {
				obj = new UrlObj;
				cfg->urlList.AddObj(obj);
				strcpy(obj->protocol, tmp_obj->protocol);
			}
			strcpy(obj->program, tmp_obj->program);
		}
		cfg->ShellExec = (int)SendDlgItemMessage(SHELLEXEC_CHECK, BM_GETCHECK, 0, 0);
	}

	return	TRUE;
}