?? peeperfrm.cpp
字號:
pPeeperWnd->SetEnableFlag(PL_ENABLE_MOUSE_LBUTTON, !bOld);
}
}
break ;
case ID_OPTION_MOUSE_RBUTTON:
{
if(pPeeperWnd)
{
BOOL bOld = pPeeperWnd->GetEnableFlag(PL_ENABLE_MOUSE_RBUTTON);
pPeeperWnd->SetEnableFlag(PL_ENABLE_MOUSE_RBUTTON, !bOld);
}
}
break ;
case ID_OPTION_MOUSE_LDBLCLK:
{
if(pPeeperWnd)
{
BOOL bOld = pPeeperWnd->GetEnableFlag(PL_ENABLE_MOUSE_LDBLCLK);
pPeeperWnd->SetEnableFlag(PL_ENABLE_MOUSE_LDBLCLK, !bOld);
}
}
break ;
case ID_OPTION_MOUSE_RDBLCLK:
{
if(pPeeperWnd)
{
BOOL bOld = pPeeperWnd->GetEnableFlag(PL_ENABLE_MOUSE_RDBLCLK);
pPeeperWnd->SetEnableFlag(PL_ENABLE_MOUSE_RDBLCLK, !bOld);
}
}
break ;
case ID_OPTION_KEY:
{
if(pPeeperWnd)
{
BOOL bOld = pPeeperWnd->GetEnableFlag(PL_ENABLE_KEY);
pPeeperWnd->SetEnableFlag(PL_ENABLE_KEY, !bOld);
}
}
break ;
case ID_OPTION_DIB:
{
if(pPeeperWnd)
{
BOOL bOld = pPeeperWnd->GetEnableFlag(PL_ENABLE_DIB);
pPeeperWnd->SetEnableFlag(PL_ENABLE_DIB, !bOld);
}
}
break ;
case ID_OPTION_1BITS:
case ID_OPTION_4BITS:
case ID_OPTION_8BITS:
case ID_OPTION_24BITS:
{
if(pPeeperWnd)
{
pPeeperWnd->SetColorType(PL_ColorType(nMenuID - ID_OPTION_1BITS));
}
}
break ;
case ID_OPTION_NOZIP:
case ID_OPTION_LZ77:
case ID_OPTION_LZW:
case ID_OPTION_JPEG:
case ID_OPTION_LZSS:
case ID_OPTION_ARI:
{
if(pPeeperWnd)
{
pPeeperWnd->SetZipType(PL_ZipType(nMenuID - ID_OPTION_NOZIP));
}
}
break ;
case IDC_BTN_COMMAND_EXEC:
{
OnExecCommand();
}
break ;
case IDC_BTN_COMPUTER_EXEC:
{
OnExecComputer();
}
break ;
case IDC_BTN_FILE_EXEC:
{
OnExecFile();
}
break ;
case IDC_BTN_FILE_SOURCE:
{
}
break ;
case IDC_BTN_FILE_TARGET:
{
}
break ;
case IDC_COMBO_FILE_TYPE:
{
;
}
break ;
case ID_HELP_HELP:
{
TCHAR chApp[255];
memset(chApp, 0, sizeof(TCHAR)*255);
GetModuleFileName(NULL, chApp, 255);
CString strApp = CString(chApp);
int nPos = strApp.ReverseFind(_T('\\'));
if(nPos > 0)
{
strApp = strApp.Left(nPos);
}
::ShellExecute(NULL, "open", "Readme.txt", NULL, strApp,
SW_SHOWNORMAL);
}
break ;
case ID_HELP_REGISTER:
{
CRegisterDlg dlgReg;
dlgReg.DoModal();
dlgReg.m_strUserName;
dlgReg.m_strCode;
}
break ;
default :
break ;
}
}
}
void CMainFrame::OnUpdateMenuCommand(CCmdUI* pCmdUI)
{
CPeeperWnd *pPeeperWnd = GetCurPeeperWnd();
switch(pCmdUI->m_nID)
{
case ID_VIEW_SEND:
{
if(!pPeeperWnd)
{
pCmdUI->Enable(FALSE);
}
pCmdUI->SetCheck(m_wndCommand.IsWindowVisible());
}
break ;
case ID_FILE_MANAGE:
{
if(!pPeeperWnd)
{
pCmdUI->Enable(FALSE);
}
pCmdUI->SetCheck(m_wndFile.IsWindowVisible());
}
break ;
case ID_VIEW_COMPUTER:
{
if(!pPeeperWnd)
{
pCmdUI->Enable(FALSE);
}
pCmdUI->SetCheck(m_wndComputer.IsWindowVisible());
}
break ;
case ID_TOOL_DIBVIEW_FULL:
{
if(!pPeeperWnd)
{
pCmdUI->Enable(FALSE);
ShowControlBar(&m_wndDibView, FALSE, FALSE);
}
else
{
pCmdUI->Enable(TRUE);
}
}
break ;
case ID_FILE_CLOSESERVER:
{
pCmdUI->Enable((pPeeperWnd && pPeeperWnd->GetState()));
}
break ;
case ID_OPTION_PAUSE:
{
if(pPeeperWnd)
{
BOOL bPause = pPeeperWnd->IsPause();
pCmdUI->SetCheck(!bPause);
}
else
{
pCmdUI->Enable(FALSE);
}
}
break ;
case ID_OPTION_MOUSE_MOVE:
{
if(pPeeperWnd)
{
BOOL bSet = pPeeperWnd->GetEnableFlag(PL_ENABLE_MOUSE_MOVE);
pCmdUI->SetCheck(bSet);
}
else
{
pCmdUI->Enable(FALSE);
}
}
break ;
case ID_OPTION_MOUSE_LBUTTON:
{
if(pPeeperWnd)
{
BOOL bSet = pPeeperWnd->GetEnableFlag(PL_ENABLE_MOUSE_LBUTTON);
pCmdUI->SetCheck(bSet);
}
else
{
pCmdUI->Enable(FALSE);
}
}
break ;
case ID_OPTION_MOUSE_RBUTTON:
{
if(pPeeperWnd)
{
BOOL bSet = pPeeperWnd->GetEnableFlag(PL_ENABLE_MOUSE_RBUTTON);
pCmdUI->SetCheck(bSet);
}
else
{
pCmdUI->Enable(FALSE);
}
}
break ;
case ID_OPTION_MOUSE_LDBLCLK:
{
if(pPeeperWnd)
{
BOOL bSet = pPeeperWnd->GetEnableFlag(PL_ENABLE_MOUSE_LDBLCLK);
pCmdUI->SetCheck(bSet);
}
else
{
pCmdUI->Enable(FALSE);
}
}
break ;
case ID_OPTION_MOUSE_RDBLCLK:
{
if(pPeeperWnd)
{
BOOL bSet = pPeeperWnd->GetEnableFlag(PL_ENABLE_MOUSE_RDBLCLK);
pCmdUI->SetCheck(bSet);
}
else
{
pCmdUI->Enable(FALSE);
}
}
break ;
case ID_OPTION_KEY:
{
if(pPeeperWnd)
{
BOOL bSet = pPeeperWnd->GetEnableFlag(PL_ENABLE_KEY);
pCmdUI->SetCheck(bSet);
}
else
{
pCmdUI->Enable(FALSE);
}
}
break ;
case ID_OPTION_DIB:
{
if(pPeeperWnd)
{
BOOL bSet = pPeeperWnd->GetEnableFlag(PL_ENABLE_DIB);
pCmdUI->SetCheck(bSet);
}
else
{
pCmdUI->Enable(FALSE);
}
}
break ;
case ID_OPTION_1BITS:
case ID_OPTION_4BITS:
case ID_OPTION_8BITS:
case ID_OPTION_24BITS:
{
if(pPeeperWnd)
{
if((UINT)(pPeeperWnd->GetColorType()+ID_OPTION_1BITS) == pCmdUI->m_nID)
{
pCmdUI->SetRadio(TRUE);
}
else
{
pCmdUI->SetRadio(FALSE);
}
}
else
{
pCmdUI->Enable(FALSE);
}
}
break ;
case ID_OPTION_NOZIP:
case ID_OPTION_LZ77:
case ID_OPTION_LZW:
case ID_OPTION_JPEG:
case ID_OPTION_LZSS:
case ID_OPTION_ARI:
{
if(pPeeperWnd)
{
if((UINT)(pPeeperWnd->GetZipType()+ID_OPTION_NOZIP) == pCmdUI->m_nID)
{
pCmdUI->SetRadio(TRUE);
}
else
{
pCmdUI->SetRadio(FALSE);
}
}
else
{
pCmdUI->Enable(FALSE);
}
}
break ;
case ID_STATUS_CONN_INFO:
{
CString strInfo;
if(pPeeperWnd)
{
strInfo = pPeeperWnd->GetClientInfo();
}
else
{
strInfo.LoadString(ID_STATUS_CONN_INFO);
}
m_wndStatusBar.SetPaneText(1, strInfo);
}
break ;
case ID_STATUS_TIME:
{
CString strInfo;
CString str;
strInfo.LoadString(ID_STATUS_TIME);
if(pPeeperWnd)
{
UINT nTime = pPeeperWnd->GetConnectTime();
str.Format(strInfo, nTime/60, nTime%60);
}
else
{
str.Format(strInfo, 0, 0);
}
m_wndStatusBar.SetPaneText(2, str);
}
break ;
default :
break ;
}
}
void CMainFrame::OnFullScreen()
{
CPeeperWnd *pPeeperWnd = GetCurPeeperWnd();
CChildFrame *pFrame = GetCurFrame();
if(pPeeperWnd && pFrame)
{
SIZE sz = ::PL_GetScreenSize();
CToolBarCtrl &bcCtrl = m_wndDibView.GetToolBarCtrl();
BOOL bCheck = bcCtrl.IsButtonChecked(ID_TOOL_DIBVIEW_FULL);
bcCtrl.CheckButton(ID_TOOL_DIBVIEW_FULL, !bCheck);
if(!bCheck)
{
if(pFrame->IsZoomed())
{
m_nOldCmdShow = SW_SHOWMAXIMIZED;
}
else
{
m_nOldCmdShow = SW_SHOWNORMAL;
}
pFrame->ShowWindow(SW_SHOWMAXIMIZED);
ShowControlBar(&m_wndDibView, TRUE, FALSE);
FloatControlBar(&m_wndDibView, CPoint(sz.cx - 60, 10));
RecalcLayout(); // must
CRect rc;
CRect rect;
GetWindowRect(&m_rcOldRect);
pPeeperWnd->GetWindowRect(&rc);
rect.left = m_rcOldRect.left - rc.left - 2;
rect.top = m_rcOldRect.top - rc.top - 2;
rect.right = sz.cx + m_rcOldRect.right - rc.right + 2;
rect.bottom = sz.cy + m_rcOldRect.bottom - rc.bottom + 2;
MoveWindow(rect);
m_bIsFullScreen = TRUE;
}
else
{
ShowControlBar(&m_wndDibView, FALSE, FALSE);
pFrame->ShowWindow(m_nOldCmdShow);
DockControlBar(&m_wndDibView);
MoveWindow(m_rcOldRect);
m_bIsFullScreen = FALSE;
}
}
}
void CMainFrame::OnExecCommand()
{
CPeeperWnd *pPeeperWnd = GetCurPeeperWnd();
if(pPeeperWnd)
{
char chData[1024];
ZeroMemory(chData, 1024);
m_wndCommand.GetDlgItemText(IDC_EDIT_COMMAND_INPUT, chData, 1024);
CComboBox *pCombo = (CComboBox *)(m_wndCommand.GetDlgItem(IDC_COMBO_COMMAND_TYPE));
if(pCombo)
{
int nCur = pCombo->GetCurSel();
if(nCur >= 0)
{
int nType = pCombo->GetItemData(nCur);
switch(nType)
{
case PL_MSG:
{
pPeeperWnd->T_SendMsg(chData, 0);
}
break ;
case PL_FUNC_EXEC:
{
pPeeperWnd->T_RunCommand(chData);
}
break ;
default :
break ;
}
}
}
}
}
void CMainFrame::OnExecComputer()
{
CPeeperWnd *pPeeperWnd = GetCurPeeperWnd();
if(pPeeperWnd)
{
CComboBox *pCombo = (CComboBox *)(m_wndComputer.GetDlgItem(IDC_COMBO_COMPUTER_TYPE));
if(pCombo)
{
int nCur = pCombo->GetCurSel();
if(nCur >= 0)
{
int nType = pCombo->GetItemData(nCur);
switch(nType)
{
case PL_FUNC_EXITWIN+0:
{
pPeeperWnd->T_ExitWindow(EWX_FORCE | EWX_LOGOFF);
}
break ;
case PL_FUNC_EXITWIN+1:
{
pPeeperWnd->T_ExitWindow(EWX_FORCE | EWX_REBOOT);
}
break ;
case PL_FUNC_EXITWIN+2:
{
pPeeperWnd->T_ExitWindow(EWX_FORCE | EWX_SHUTDOWN);
}
break ;
case PL_FUNC_EXITWIN+3:
{
pPeeperWnd->T_LockDesktop(TRUE);
}
break ;
case PL_FUNC_EXITWIN+4:
{
pPeeperWnd->T_LockDesktop(FALSE);
}
break ;
default :
break ;
}
}
}
}
}
void CMainFrame::OnExecFile()
{
CPeeperWnd *pPeeperWnd = GetCurPeeperWnd();
if(pPeeperWnd)
{
char chFile1[512];
char chFile2[512];
ZeroMemory(chFile1, 512);
ZeroMemory(chFile2, 512);
m_wndFile.GetDlgItemText(IDC_EDIT_FILE_SOURCE, chFile1, 512);
m_wndFile.GetDlgItemText(IDC_EDIT_FILE_TARGET, chFile2, 512);
CComboBox *pCombo = (CComboBox *)(m_wndFile.GetDlgItem(IDC_COMBO_FILE_TYPE));
if(pCombo)
{
int nCur = pCombo->GetCurSel();
if(nCur >= 0)
{
int nType = pCombo->GetItemData(nCur);
switch(nType)
{
case PL_FUNC_FILE_COPY_S:
{
pPeeperWnd->T_CopyFileToRemote(chFile1, chFile2, NULL);
}
break ;
case PL_FUNC_FILE_COPY_C:
{
pPeeperWnd->T_CopyFileFromRemote(chFile1, chFile2, NULL);
}
break ;
case PL_FUNC_FILE_DELETE:
{
pPeeperWnd->T_DeleteFile(chFile1);
}
break ;
case PL_FUNC_FILE_MOVE:
{
pPeeperWnd->T_MoveFile(chFile1, chFile2);
}
break ;
default :
break ;
}
}
}
}
}
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam == VK_RETURN)
{
CWnd *pFoucs = GetFocus();
if(pFoucs == m_wndCommand.GetDlgItem(IDC_EDIT_COMMAND_INPUT) ||
pFoucs == m_wndCommand.GetDlgItem(IDC_COMBO_COMMAND_TYPE))
{
OnExecCommand();
}
else if(pFoucs == m_wndComputer.GetDlgItem(IDC_COMBO_COMPUTER_TYPE))
{
OnExecComputer();
}
else if(pFoucs == m_wndFile.GetDlgItem(IDC_EDIT_FILE_SOURCE) ||
pFoucs == m_wndFile.GetDlgItem(IDC_EDIT_FILE_TARGET) ||
pFoucs == m_wndFile.GetDlgItem(IDC_COMBO_FILE_TYPE))
{
OnExecFile();
}
}
else if(m_bIsFullScreen && (pMsg->wParam == VK_ESCAPE || pMsg->wParam == VK_F11))
{
OnFullScreen();
}
else if(!m_bIsFullScreen && pMsg->wParam == VK_F11)
{
OnFullScreen();
}
}
return CMDIFrameWnd::PreTranslateMessage(pMsg);
}
void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
lpMMI->ptMaxSize.x = 3200;
lpMMI->ptMaxSize.y = 2400;
lpMMI->ptMaxTrackSize.x = 3200;
lpMMI->ptMaxTrackSize.y = 2400;
CMDIFrameWnd::OnGetMinMaxInfo(lpMMI);
}
void CMainFrame::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if(lpDrawItemStruct->CtlType == ODT_MENU)
{
m_hPeeperMenu.DrawItem(lpDrawItemStruct);
return ;
}
CMDIFrameWnd::OnDrawItem(nIDCtl, lpDrawItemStruct);
}
void CMainFrame::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
if(lpMeasureItemStruct->CtlType == ODT_MENU)
{
m_hPeeperMenu.MeasureItem(lpMeasureItemStruct);
return ;
}
CMDIFrameWnd::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -