diff --git a/Charu3.cpp b/Charu3.cpp index 411bd87..0750b18 100644 --- a/Charu3.cpp +++ b/Charu3.cpp @@ -302,6 +302,231 @@ bool CCharu3App::init() return true; } +void CCharu3App::BeForeground() +{ + Window::SetAbsoluteForegroundWindow(m_pMainFrame->m_hWnd); +} + +void CCharu3App::CheckFocusInfo(HWND hActiveWnd) +{ + if (hActiveWnd != m_focusInfo.m_hActiveWnd) { + Window::GetFocusInfo(&m_focusInfo); + } +} + +void CCharu3App::OnClick(HWND hActiveWnd) +{ + if (m_ini.m_nIconClick == 0) { + if (GetPhase() == PHASE_IDOL) { + // Pop-up Data Tree View Window at the mouse pointer. + POINT pos; + GetCursorPos(&pos); + pos.x -= m_ini.m_DialogSize.x; + pos.y -= m_ini.m_DialogSize.y; + adjustLocation(&pos); + // Window::GetFocusInfo(&theApp.m_focusInfo,hForeground); + popupTreeWindow(pos, m_ini.m_bKeepSelection); + } + } + else { + // Toggle Stock Mode + toggleStockMode(); + } +} + +void CCharu3App::RedrawDataTreeView() +{ + if (m_pTreeDlg->IsWindowVisible()) { + m_pTreeDlg->RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE); + } +} + +//--------------------------------------------------- +//関数名 popupTreeWindow +//機能 ポップアップを表示 +//--------------------------------------------------- +void CCharu3App::popupTreeWindow(POINT pos, bool keepSelection, HTREEITEM hOpenItem) +{ + if (m_nPhase != PHASE_IDOL) return; + m_nPhase = PHASE_POPUP; + m_ini.unHookKey(); + unregisterAdditionalHotkeys();//追加ホットキーを停止 + + // Window::GetFocusInfo(&m_focusInfo); + + if (m_focusInfo.m_hActiveWnd == this->m_pMainFrame->m_hWnd) { + m_nPhase = PHASE_IDOL; + return; + } + + if (m_isStockMode) KillTimer(m_pMainWnd->m_hWnd, TIMER_ACTIVE);//監視タイマー停止 + + if (m_ini.m_bDebug) { + LOG(_T("popupTreeWindow x=%d y=%d keep=%s"), pos.x, pos.y, keepSelection ? _T("true") : _T("false")); + } + + Window::SetAbsoluteForegroundWindow(m_pMainWnd->m_hWnd);//自分をアクティブに設定 + m_pTreeDlg->ShowWindowPos(pos, m_ini.m_DialogSize, SW_SHOW, keepSelection, hOpenItem); +} + +//--------------------------------------------------- +//関数名 adjustLocation(POINT pos) +//機能 ポップアップ位置を必ずデスクトップ内にする +//--------------------------------------------------- +void CCharu3App::adjustLocation(POINT* pos) +{ + RECT DeskTopSize; + int nMonCount = GetSystemMetrics(SM_CMONITORS); + + if (nMonCount <= 1) { + //デスクトップのサイズを取得 + int nDektopWidth = GetSystemMetrics(SM_CXSCREEN); + int nDesktopHeight = GetSystemMetrics(SM_CYFULLSCREEN); + //解像度の取得 + int nScreenWidth = GetSystemMetrics(SM_CXSCREEN); + int nScreenHeight = GetSystemMetrics(SM_CYSCREEN); + + if (m_ini.m_bDebug) { + LOG(_T("reviseWindowPos %d %d %d %d"), nDektopWidth, nDesktopHeight, nScreenWidth, nScreenHeight); + } + + HWND hDeskTop = GetDesktopWindow(); + if (hDeskTop) ::GetWindowRect(hDeskTop, &DeskTopSize); + else return; + } + else { + CArray arrayRect; + arrayRect.RemoveAll(); + EnumDisplayMonitors(NULL, NULL, (MONITORENUMPROC)MonitorEnumFunc, (LPARAM)&arrayRect); + + int nSize = arrayRect.GetSize(), nCurrentMon = 0, nWidth, nHeight; + CString strBuff; + double dDistance, dMinDistance = -1.0f; + for (int i = 0; i < nSize; i++) { + strBuff.Format(_T("left:%d top:%d right:%d bottom:%d"), arrayRect[i].left, arrayRect[i].top, arrayRect[i].right, arrayRect[i].bottom); + nWidth = abs((arrayRect[i].left + arrayRect[i].right) / 2 - pos->x); + nHeight = abs((arrayRect[i].top + arrayRect[i].bottom) / 2 - pos->y); + + dDistance = sqrt((nWidth * nWidth) + (nHeight * nHeight)); + if (dDistance < dMinDistance || i == 0) { + dMinDistance = dDistance; + nCurrentMon = i; + } + } + DeskTopSize = arrayRect[nCurrentMon]; + } + //ウィンドウ位置を補正 + if (pos->y + m_ini.m_DialogSize.y > DeskTopSize.bottom) + pos->y -= (pos->y + m_ini.m_DialogSize.y) - DeskTopSize.bottom; + if (pos->x + m_ini.m_DialogSize.x > DeskTopSize.right) + pos->x -= (pos->x + m_ini.m_DialogSize.x) - DeskTopSize.right; + + if (pos->y < DeskTopSize.top) + pos->y = DeskTopSize.top; + if (pos->x < DeskTopSize.left) + pos->x = DeskTopSize.left; +} + +//--------------------------------------------------- +//関数名 closeTreeWindow(int nRet) +//機能 ポップアップ隠蔽処理 +//--------------------------------------------------- +void CCharu3App::closeTreeWindow(int nRet) +{ + m_pTreeDlg->ShowWindow(SW_HIDE); + STRING_DATA data; + bool isPaste = true; + if (::GetAsyncKeyState(VK_SHIFT) < 0) isPaste = false; + + if (m_ini.m_bDebug) { + LOG(_T("closeTreeWindow %d"), nRet); + } + + //アクティブウィンドウを復帰 + if (nRet == IDOK) { + CString strClip, strSelect; + m_clipboard.GetClipboardText(strClip, m_ini.m_nClipboardRetryTimes, m_ini.m_nClipboardRetryInterval);//クリップボードを保存 + + setAppendKeyInit(m_focusInfo.m_hActiveWnd, &m_keySet);//キー設定を変更 + //キーが離されるのを待つ + while (::GetAsyncKeyState(VK_MENU) < 0 || ::GetAsyncKeyState(VK_CONTROL) < 0 || + ::GetAsyncKeyState(VK_SHIFT) < 0 || ::GetAsyncKeyState(VK_RETURN) < 0) Sleep(50); + Window::SetFocusInfo(&m_focusInfo);//ターゲットをフォーカス + + if (m_ini.m_bDebug) { + LOG(_T("setFocusInfo active:%p focus:%p"), m_focusInfo.m_hActiveWnd, m_focusInfo.m_hFocusWnd); + } + + //貼り付け処理 + if (m_pTree->m_ltCheckItems.size() > 0) {//複数選択データがある + strSelect = getSelectString(m_keySet, m_focusInfo.m_hFocusWnd); // TODO: Doing unconditional copy action. Does not consider the necessity. + + if (m_ini.m_bDebug) { + LOG(_T("closeTreeWindow sel:%s clip:%s"), strSelect.GetString(), strClip.GetString()); + } + + std::list::iterator it; + for (it = m_pTree->m_ltCheckItems.begin(); it != m_pTree->m_ltCheckItems.end(); it++) { + if (m_pTree->GetItemState(*it, TVIF_HANDLE)) { + data = m_pTree->getData(*it); + if (data.m_cKind & KIND_DATA_ALL) { + if (m_ini.m_bDebug) { + LOG(_T("closeTreeWindow check paste %s"), data.m_strTitle.GetString()); + } + playData(data, strClip, strSelect, isPaste, false); + } + } + } + //一時項目は消す + for (it = m_pTree->m_ltCheckItems.begin(); it != m_pTree->m_ltCheckItems.end(); it++) { + if (m_pTree->GetItemState(*it, TVIF_HANDLE)) { + HTREEITEM hItem = *it; + *it = NULL; + if (m_pTree->getDataPtr(hItem)->m_cKind & KIND_ONETIME) { + //m_hSelectItemBkup = NULL; + } + } + } + } + else if (m_pTreeDlg->m_selectDataPtr != nullptr) {//通常選択データ + bool requiresSelectionText = (m_pTreeDlg->m_selectDataPtr->m_strData.Find(_T("$SEL")) != -1); // TODO: This test is true even if $SEL is outside + strSelect = requiresSelectionText ? getSelectString(m_keySet, m_focusInfo.m_hFocusWnd) : ""; + data = *(m_pTreeDlg->m_selectDataPtr); + + if (m_ini.m_bDebug) { + LOG(_T("closeTreeWindow sel:%s clip:%s title:%s"), strSelect.GetString(), strClip.GetString(), data.m_strTitle.GetString()); + } + playData(data, strClip, strSelect, isPaste); + } + } + else if (::GetForegroundWindow() == m_focusInfo.m_hActiveWnd) { + Window::SetFocusInfo(&m_focusInfo); + } + if (m_hSelectItemBkup) { + m_pTree->SelectItem(m_hSelectItemBkup); + m_hSelectItemBkup = NULL; + } + + //データを保存 + SaveData(); + m_ini.writeEnvInitData();//環境設定を保存 + + //監視タイマーセット + if (m_isStockMode && m_ini.m_nWindowCheckInterval > 0) { + SetTimer(m_pMainWnd->m_hWnd, TIMER_ACTIVE, m_ini.m_nWindowCheckInterval, NULL); + } + + registerAdditionalHotkeys();//追加ホットキーを設定 + m_ini.setHookKey(m_hSelfWnd); + + if (m_pTree->GetStyle() & TVS_CHECKBOXES) { + resetTreeDialog(); + Window::SetFocusInfo(&m_focusInfo); + } + ASSERT(m_nPhase == PHASE_POPUP); + m_nPhase = PHASE_IDOL; +} + bool CCharu3App::SelectFile() { CString strDisplay, strPattern; @@ -365,6 +590,20 @@ bool CCharu3App::SelectFile() } } +void CCharu3App::SaveData() +{ + if (m_ini.m_bReadOnly) { + return; + } + if (m_pTree->saveDataToFile(m_ini.m_strDataPath, m_ini.m_strDataFormat, NULL)) { + return; + } + + CString strRes; + (void)strRes.LoadString(APP_MES_SAVE_FAILURE); + AfxMessageBox(strRes, MB_ICONEXCLAMATION, 0); +} + //--------------------------------------------------- //関数名 registerHotkeys() //機能 ホットキーを設定する @@ -612,220 +851,6 @@ bool CCharu3App::setAppendKeyInit(HWND hTopWindow, COPYPASTE_KEY* keySet) return isRet; } -//--------------------------------------------------- -//関数名 popupTreeWindow -//機能 ポップアップを表示 -//--------------------------------------------------- -void CCharu3App::popupTreeWindow(POINT pos, bool keepSelection, HTREEITEM hOpenItem) -{ - if (m_nPhase != PHASE_IDOL) return; - m_nPhase = PHASE_POPUP; - m_ini.unHookKey(); - unregisterAdditionalHotkeys();//追加ホットキーを停止 - - // Window::GetFocusInfo(&m_focusInfo); - - if (m_focusInfo.m_hActiveWnd == this->m_pMainFrame->m_hWnd) { - m_nPhase = PHASE_IDOL; - return; - } - - if (m_isStockMode) KillTimer(m_pMainWnd->m_hWnd, TIMER_ACTIVE);//監視タイマー停止 - - if (m_ini.m_bDebug) { - LOG(_T("popupTreeWindow x=%d y=%d keep=%s"), pos.x, pos.y, keepSelection ? _T("true") : _T("false")); - } - - Window::SetAbsoluteForegroundWindow(m_pMainWnd->m_hWnd);//自分をアクティブに設定 - m_pTreeDlg->ShowWindowPos(pos, m_ini.m_DialogSize, SW_SHOW, keepSelection, hOpenItem); -} - -//--------------------------------------------------- -//関数名 popupTreeWinMC(HWND hForeground) -//機能 ポップアップをマウスカーソル位置に表示 -//--------------------------------------------------- -void CCharu3App::popupTreeWinMC(HWND hForeground) -{ - POINT pos; - GetCursorPos(&pos); - pos.x -= m_ini.m_DialogSize.x; - pos.y -= m_ini.m_DialogSize.y; - adjustLocation(&pos); - // Window::GetFocusInfo(&theApp.m_focusInfo,hForeground); - popupTreeWindow(pos, m_ini.m_bKeepSelection); -} -//--------------------------------------------------- -//関数名 adjustLocation(POINT pos) -//機能 ポップアップ位置を必ずデスクトップ内にする -//--------------------------------------------------- -void CCharu3App::adjustLocation(POINT* pos) -{ - RECT DeskTopSize; - int nMonCount = GetSystemMetrics(SM_CMONITORS); - - if (nMonCount <= 1) { - //デスクトップのサイズを取得 - int nDektopWidth = GetSystemMetrics(SM_CXSCREEN); - int nDesktopHeight = GetSystemMetrics(SM_CYFULLSCREEN); - //解像度の取得 - int nScreenWidth = GetSystemMetrics(SM_CXSCREEN); - int nScreenHeight = GetSystemMetrics(SM_CYSCREEN); - - if (m_ini.m_bDebug) { - LOG(_T("reviseWindowPos %d %d %d %d"), nDektopWidth, nDesktopHeight, nScreenWidth, nScreenHeight); - } - - HWND hDeskTop = GetDesktopWindow(); - if (hDeskTop) ::GetWindowRect(hDeskTop, &DeskTopSize); - else return; - } - else { - CArray arrayRect; - arrayRect.RemoveAll(); - EnumDisplayMonitors(NULL, NULL, (MONITORENUMPROC)MonitorEnumFunc, (LPARAM)&arrayRect); - - int nSize = arrayRect.GetSize(), nCurrentMon = 0, nWidth, nHeight; - CString strBuff; - double dDistance, dMinDistance = -1.0f; - for (int i = 0; i < nSize; i++) { - strBuff.Format(_T("left:%d top:%d right:%d bottom:%d"), arrayRect[i].left, arrayRect[i].top, arrayRect[i].right, arrayRect[i].bottom); - nWidth = abs((arrayRect[i].left + arrayRect[i].right) / 2 - pos->x); - nHeight = abs((arrayRect[i].top + arrayRect[i].bottom) / 2 - pos->y); - - dDistance = sqrt((nWidth * nWidth) + (nHeight * nHeight)); - if (dDistance < dMinDistance || i == 0) { - dMinDistance = dDistance; - nCurrentMon = i; - } - } - DeskTopSize = arrayRect[nCurrentMon]; - } - //ウィンドウ位置を補正 - if (pos->y + m_ini.m_DialogSize.y > DeskTopSize.bottom) - pos->y -= (pos->y + m_ini.m_DialogSize.y) - DeskTopSize.bottom; - if (pos->x + m_ini.m_DialogSize.x > DeskTopSize.right) - pos->x -= (pos->x + m_ini.m_DialogSize.x) - DeskTopSize.right; - - if (pos->y < DeskTopSize.top) - pos->y = DeskTopSize.top; - if (pos->x < DeskTopSize.left) - pos->x = DeskTopSize.left; -} - -//--------------------------------------------------- -//関数名 closeTreeWindow(int nRet) -//機能 ポップアップ隠蔽処理 -//--------------------------------------------------- -void CCharu3App::closeTreeWindow(int nRet) -{ - m_pTreeDlg->ShowWindow(SW_HIDE); - STRING_DATA data; - bool isPaste = true; - if (::GetAsyncKeyState(VK_SHIFT) < 0) isPaste = false; - - if (m_ini.m_bDebug) { - LOG(_T("closeTreeWindow %d"), nRet); - } - - //アクティブウィンドウを復帰 - if (nRet == IDOK) { - CString strClip, strSelect; - m_clipboard.GetClipboardText(strClip, m_ini.m_nClipboardRetryTimes, m_ini.m_nClipboardRetryInterval);//クリップボードを保存 - - setAppendKeyInit(m_focusInfo.m_hActiveWnd, &m_keySet);//キー設定を変更 - //キーが離されるのを待つ - while (::GetAsyncKeyState(VK_MENU) < 0 || ::GetAsyncKeyState(VK_CONTROL) < 0 || - ::GetAsyncKeyState(VK_SHIFT) < 0 || ::GetAsyncKeyState(VK_RETURN) < 0) Sleep(50); - Window::SetFocusInfo(&m_focusInfo);//ターゲットをフォーカス - - if (m_ini.m_bDebug) { - LOG(_T("setFocusInfo active:%p focus:%p"), m_focusInfo.m_hActiveWnd, m_focusInfo.m_hFocusWnd); - } - - //貼り付け処理 - if (m_pTree->m_ltCheckItems.size() > 0) {//複数選択データがある - strSelect = getSelectString(m_keySet, m_focusInfo.m_hFocusWnd); // TODO: Doing unconditional copy action. Does not consider the necessity. - - if (m_ini.m_bDebug) { - LOG(_T("closeTreeWindow sel:%s clip:%s"), strSelect.GetString(), strClip.GetString()); - } - - std::list::iterator it; - for (it = m_pTree->m_ltCheckItems.begin(); it != m_pTree->m_ltCheckItems.end(); it++) { - if (m_pTree->GetItemState(*it, TVIF_HANDLE)) { - data = m_pTree->getData(*it); - if (data.m_cKind & KIND_DATA_ALL) { - if (m_ini.m_bDebug) { - LOG(_T("closeTreeWindow check paste %s"), data.m_strTitle.GetString()); - } - playData(data, strClip, strSelect, isPaste, false); - } - } - } - //一時項目は消す - for (it = m_pTree->m_ltCheckItems.begin(); it != m_pTree->m_ltCheckItems.end(); it++) { - if (m_pTree->GetItemState(*it, TVIF_HANDLE)) { - HTREEITEM hItem = *it; - *it = NULL; - if (m_pTree->getDataPtr(hItem)->m_cKind & KIND_ONETIME) { - //m_hSelectItemBkup = NULL; - } - } - } - } - else if (m_pTreeDlg->m_selectDataPtr != nullptr) {//通常選択データ - bool requiresSelectionText = (m_pTreeDlg->m_selectDataPtr->m_strData.Find(_T("$SEL")) != -1); // TODO: This test is true even if $SEL is outside - strSelect = requiresSelectionText ? getSelectString(m_keySet, m_focusInfo.m_hFocusWnd) : ""; - data = *(m_pTreeDlg->m_selectDataPtr); - - if (m_ini.m_bDebug) { - LOG(_T("closeTreeWindow sel:%s clip:%s title:%s"), strSelect.GetString(), strClip.GetString(), data.m_strTitle.GetString()); - } - playData(data, strClip, strSelect, isPaste); - } - } - else if (::GetForegroundWindow() == m_focusInfo.m_hActiveWnd) { - Window::SetFocusInfo(&m_focusInfo); - } - if (m_hSelectItemBkup) { - m_pTree->SelectItem(m_hSelectItemBkup); - m_hSelectItemBkup = NULL; - } - - //データを保存 - SaveData(); - m_ini.writeEnvInitData();//環境設定を保存 - - //監視タイマーセット - if (m_isStockMode && m_ini.m_nWindowCheckInterval > 0) { - SetTimer(m_pMainWnd->m_hWnd, TIMER_ACTIVE, m_ini.m_nWindowCheckInterval, NULL); - } - - registerAdditionalHotkeys();//追加ホットキーを設定 - m_ini.setHookKey(m_hSelfWnd); - - if (m_pTree->GetStyle() & TVS_CHECKBOXES) { - resetTreeDialog(); - Window::SetFocusInfo(&m_focusInfo); - } - ASSERT(m_nPhase == PHASE_POPUP); - m_nPhase = PHASE_IDOL; -} - -void CCharu3App::SaveData() -{ - if (m_ini.m_bReadOnly) { - return; - } - if (m_pTree->saveDataToFile(m_ini.m_strDataPath, m_ini.m_strDataFormat, NULL)) { - return; - } - - CString strRes; - (void)strRes.LoadString(APP_MES_SAVE_FAILURE); - AfxMessageBox(strRes, MB_ICONEXCLAMATION, 0); -} - //--------------------------------------------------- //関数名 playData(STRING_DATA data,CString strClip) //機能 データの展開処理をする diff --git a/Charu3.h b/Charu3.h index 2840f01..105dc4e 100644 --- a/Charu3.h +++ b/Charu3.h @@ -95,25 +95,19 @@ class CCharu3App : public CWinApp ~CCharu3App(); HWND GetAppWnd() { return m_hSelfWnd; } + void CheckFocusInfo(HWND hActiveWnd); + void OnClick(HWND hActiveWnd); int GetPhase() { return m_nPhase; } - bool isCloseKey() { return m_isCloseKey; } - void popupTreeWinMC(HWND hForeground); - void Record(CString text); - void toggleStockMode(); + void BeForeground(); + void RedrawDataTreeView(); - void RedrawDataTreeView() { - if (m_pTreeDlg->IsWindowVisible()) { - m_pTreeDlg->RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE); - } - } + void Record(CString text); CInit m_ini; CClipBoard m_clipboard; CCharu3Tree* m_pTree; - CMainFrame* m_pMainFrame; - FOCUS_INFO m_focusInfo; // オーバーライド // ClassWizard は仮想関数のオーバーライドを生成します。 @@ -126,6 +120,14 @@ class CCharu3App : public CWinApp // インプリメンテーション private: + bool init(); + + void popupTreeWindow(POINT pos, bool keepSelection, HTREEITEM hOpenItem = NULL); + void closeTreeWindow(int nRet); + void getPopupPos(POINT* pPos, int nPosType); + void adjustLocation(POINT* pos); + void toggleStockMode(); + void registerHotkeys(); void unregisterHotkeys(); void registerAdditionalHotkeys(); @@ -135,12 +137,6 @@ class CCharu3App : public CWinApp int getKeycode(TCHAR* szKeyName, bool scanLayout); bool setAppendKeyInit(HWND hTopWindow, COPYPASTE_KEY* keySet); - void getPopupPos(POINT* pPos, int nPosType); - void adjustLocation(POINT* pos); - - void popupTreeWindow(POINT pos, bool keepSelection, HTREEITEM hOpenItem = NULL); - void closeTreeWindow(int nRet); - void pasteData(CString strPaste, COPYPASTE_KEY key, HWND hWnd); void execData(CString strPaste, COPYPASTE_KEY key, HTREEITEM hTargetItem, HWND hWnd); void execKeyMacro(CString strKeyMacro); @@ -161,24 +157,25 @@ class CCharu3App : public CWinApp bool SelectFile(); void SaveData(); + HANDLE m_hMutex; //重複起動判別ハンドル + HINSTANCE m_hLangDll; HWND m_hSelfWnd; - CMyTreeDialog* m_pTreeDlg; - COPYPASTE_KEY m_keySet; + FOCUS_INFO m_focusInfo; + CMainFrame* m_pMainFrame; + bool m_isCloseKey, m_isStockMode; + BOOL m_isImeStatus; + int m_nPhase; + + CMyTreeDialog* m_pTreeDlg; HTREEITEM m_hSelectItemBkup; DWORD m_dwDoubleKeyPopTime, m_dwDoubleKeyFifoTime; + CString m_strSavedClipboard, m_strPreviousStocked, m_strPreviousRecordedToHistory; + COPYPASTE_KEY m_keySet; std::vector m_hotkeyVector; KEY_CODE_NAME m_keyStruct[256]; - bool init(); - HANDLE m_hMutex; //重複起動判別ハンドル HWND m_hActiveKeyWnd; - HINSTANCE m_hLangDll; - - bool m_isCloseKey, m_isStockMode; - BOOL m_isImeStatus; - int m_nPhase; - CString m_strSavedClipboard, m_strPreviousStocked, m_strPreviousRecordedToHistory; // 生成されたメッセージ マップ関数 public: diff --git a/MainFrm.cpp b/MainFrm.cpp index 8b58b2d..ecab79c 100644 --- a/MainFrm.cpp +++ b/MainFrm.cpp @@ -14,7 +14,6 @@ static char THIS_FILE[] = __FILE__; #include "MainFrm.h" #include "Charu3.h" -#include "window.h" #include "clipboard.h" #include "log.h" #include "resource.h" @@ -276,22 +275,11 @@ LRESULT CMainFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) return FALSE; // to suppress notification area menu } else if (WM_LBUTTONDOWN == lParam) { - if (theApp.m_ini.m_nIconClick == 0) { - // popup treeview - if (theApp.GetPhase() == PHASE_IDOL) { - theApp.popupTreeWinMC(m_hActive); - } - } - else { - // toggle stock mode - theApp.toggleStockMode(); - } + theApp.OnClick(m_hActive); } else if (CheckTrayPos()) { m_hActive = ::GetForegroundWindow(); - if (m_hActive != theApp.m_focusInfo.m_hActiveWnd) { - Window::GetFocusInfo(&theApp.m_focusInfo); - } + theApp.CheckFocusInfo(m_hActive); } } // clipboard update notification diff --git a/MyTreeDialog.cpp b/MyTreeDialog.cpp index a02488b..437f44e 100644 --- a/MyTreeDialog.cpp +++ b/MyTreeDialog.cpp @@ -19,7 +19,6 @@ static char THIS_FILE[] = __FILE__; #include "commonDialog.h" #include "Charu3.h" #include "color.h" -#include "window.h" #include "log.h" namespace { @@ -287,7 +286,7 @@ BOOL CMyTreeDialog::ShowWindowPos(POINT pos, POINT size, int nCmdShow, bool keep if (m_brBack.m_hObject == NULL) m_brBack.CreateSolidBrush(COLORREF(Color::Swap_RGB_BGR(theApp.m_ini.m_nBackgroundColor))); - Window::SetAbsoluteForegroundWindow(theApp.m_pMainFrame->m_hWnd); + theApp.BeForeground(); m_pTreeCtrl->SetFocus(); m_selectDataPtr = nullptr;