void CClipCompare::Compare(int leftId, int rightId) { CClip leftClip; if(leftClip.LoadFormats(leftId, true)) { CClip rightClip; if(rightClip.LoadFormats(rightId, true)) { bool saveW = true; bool saveA = true; if(leftClip.GetUnicodeTextFormat() == _T("") || rightClip.GetUnicodeTextFormat() == _T("")) { saveW = false; } if(leftClip.GetCFTextTextFormat() == "" || rightClip.GetCFTextTextFormat() == "") { saveA = false; } if(saveW || saveA) { CString leftFile = SaveToFile(leftId, &leftClip, saveW, saveA); CString rightFile = SaveToFile(rightId, &rightClip, saveW, saveA); CString path = GetComparePath(); if(path != _T("")) { SHELLEXECUTEINFO sei = { sizeof(sei) }; sei.lpFile = path; CString csParam; csParam.Format(_T("%s %s"), leftFile, rightFile); sei.lpParameters = csParam; sei.nShow = SW_NORMAL; Log(StrF(_T("Comparing two clips, left Id %d, right Id %d, Path: %s %s"), leftId, rightId, path, csParam)); if (!ShellExecuteEx(&sei)) { } } else { Log(StrF(_T("CClipCompare::Compare, No Valid compare apps, not doing compare"))); ShellExecute(NULL, _T("open"), _T("http://winmerge.org/"), NULL,NULL, SW_SHOW); } } else { Log(StrF(_T("CClipCompare::Compare, did not find valid text for both passed in clips"))); } } else { Log(StrF(_T("CClipCompare::Compare, Failed to load RIGHT clip formats Id: %d"), rightId)); } } else { Log(StrF(_T("CClipCompare::Compare, Failed to load LEFT clip formats Id: %d"), leftId)); } }
// トラック内の表示範囲内クリップをサーチして描画 int TimelineEditorView::DrawClipInTrack(const CDC& dcDC, TrackDataRect* pTrackDataRect, const int& iHeight, int iClipTotalCount) { //TODO: 毎回全サーチするのではなくてvectorとかに表示範囲のオブジェクトを設定しておいて操作のたびにvectorを更新する int iStartFrame = m_pTimelineDataOperator->GetOperatingLeftFrameNumber(); if (iStartFrame < 0) { iStartFrame = 0; } //ClipDataPositionMap mpClipDataMap; m_mpClipMap.clear(); int iClipCount = pTrackDataRect->GetTrackDataInfo()->GetClipDataInRange(iStartFrame, m_pTimelineDataOperator->GetOperatingRightFrameNumber(), m_mpClipMap); ClipDataRect* pClipData; ClipDataRect* pClipDataLeft; pClipDataLeft = nullptr; if (iClipCount > 0) { #ifdef _DEBUG CString strFrameNumber; double dPointX, dPointY; HFONT hfDrawFont; CreateDrawFont(13, 0, DEFAULT_FONTFACE, hfDrawFont); #endif ClipDataPositionMap::iterator itr = m_mpClipMap.begin(); while (itr != m_mpClipMap.end()) { pClipData = (*itr).second; m_pTimelineDataOperator->CalcClipRectDisplayPoint(static_cast<CRect&>(*pClipData), pClipData, static_cast<CRect>(pTrackDataRect)); pClipData->SetVert(iHeight); pClipData->DrawMyFillRect(); if (pClipDataLeft != nullptr) { // トランジション部分塗り替え if (pClipData->left < pClipDataLeft->right) { m_pTransitionRect->CopyRect(pClipData); m_pTransitionRect->right = pClipDataLeft->right; m_pTransitionRect->SetVert(iHeight); m_pTransitionRect->DrawMyFillRect(); m_pTransitionRect->DrawMyLeftLine(); m_pTransitionRect->DrawMyRightLine(); m_pTransitionRect->SetRectEmpty(); } else if (pClipData->left == pClipDataLeft->right) { pClipDataLeft->DrawMyRightLine(); } } pClipDataLeft = pClipData; ++itr; #ifdef _DEBUG strFrameNumber.Format(_T(" L:%d T:%d R:%d B:%d I:%d O:%d D:%d i:%d o:%d"), pClipData->left, pClipData->top, pClipData->right, pClipData->bottom, pClipData->GetTimelineInPoint(), pClipData->GetTimelineOutPoint(), pClipData->GetDuration(), pClipData->GetInPoint(), pClipData->GetOutPoint()); ChangeScreenPointToOpenGLPoint(5, 105 + (iClipTotalCount * 15), iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(pTrackDataRect->GetTrackName() + strFrameNumber), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); #endif ++iClipTotalCount; } m_mpClipMap.clear(); #ifdef _DEBUG DeleteObject(hfDrawFont); #endif } return iClipTotalCount; }
BOOL CPullFetchDlg::OnInitDialog() { CHorizontalResizableStandAloneDialog::OnInitDialog(); CAppUtils::MarkWindowAsUnpinnable(m_hWnd); AddAnchor(IDC_REMOTE_COMBO, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_OTHER, TOP_LEFT,TOP_RIGHT); AddAnchor(IDC_REMOTE_BRANCH, TOP_LEFT,TOP_RIGHT); AddAnchor(IDC_BUTTON_BROWSE_REF,TOP_RIGHT); AddAnchor(IDOK,BOTTOM_RIGHT); AddAnchor(IDCANCEL,BOTTOM_RIGHT); AddAnchor(IDC_GROUPT_REMOTE,TOP_LEFT,TOP_RIGHT); AddAnchor(IDC_GROUP_OPTION,TOP_LEFT,TOP_RIGHT); AddAnchor(IDC_PUTTYKEY_AUTOLOAD,BOTTOM_LEFT); AddAnchor(IDC_CHECK_PRUNE,BOTTOM_LEFT); AddAnchor(IDC_CHECK_REBASE,BOTTOM_LEFT); AddAnchor(IDC_REMOTE_MANAGE,BOTTOM_LEFT); AddAnchor(IDHELP, BOTTOM_RIGHT); AdjustControlSize(IDC_REMOTE_RD); AdjustControlSize(IDC_OTHER_RD); AdjustControlSize(IDC_CHECK_SQUASH); AdjustControlSize(IDC_CHECK_NOCOMMIT); AdjustControlSize(IDC_CHECK_NOFF); AdjustControlSize(IDC_CHECK_FFONLY); AdjustControlSize(IDC_CHECK_FETCHTAGS); AdjustControlSize(IDC_PUTTYKEY_AUTOLOAD); AdjustControlSize(IDC_CHECK_REBASE); AdjustControlSize(IDC_CHECK_PRUNE); CString WorkingDir=g_Git.m_CurrentDir; WorkingDir.Replace(_T(':'),_T('_')); m_RemoteReg = CRegString(CString(_T("Software\\TortoiseGit\\History\\PullRemote\\")+WorkingDir)); CString regkey; regkey.Format(_T("Software\\TortoiseGit\\TortoiseProc\\PullFetch\\%s_%d\\rebase"),WorkingDir,this->m_IsPull); m_regRebase=CRegDWORD(regkey,false); regkey.Format(_T("Software\\TortoiseGit\\TortoiseProc\\PullFetch\\%s_%d\\ffonly"), WorkingDir, m_IsPull); m_regFFonly = CRegDWORD(regkey, false); regkey.Format(_T("Software\\TortoiseGit\\TortoiseProc\\PullFetch\\%s_%d\\autoload"),WorkingDir,this->m_IsPull); m_regAutoLoadPutty = CRegDWORD(regkey,this->m_bAutoLoad); m_bAutoLoad = m_regAutoLoadPutty; if(!CAppUtils::IsSSHPutty()) m_bAutoLoad = false; if(m_bAllowRebase) { this->m_bRebase = m_regRebase; } else { GetDlgItem(IDC_CHECK_REBASE)->ShowWindow(SW_HIDE); this->m_bRebase = FALSE; } this->UpdateData(FALSE); this->AddOthersToAnchor(); this->GetDlgItem(IDC_PUTTYKEY_AUTOLOAD)->EnableWindow(m_bAutoLoadEnable); CheckRadioButton(IDC_REMOTE_RD,IDC_OTHER_RD,IDC_REMOTE_RD); m_Remote.EnableWindow(TRUE); m_Other.EnableWindow(FALSE); if(!m_IsPull) { m_RemoteBranch.EnableWindow(FALSE); GetDlgItem(IDC_BUTTON_BROWSE_REF)->EnableWindow(FALSE); } if(m_IsPull) { GetDlgItem(IDC_CHECK_REBASE)->ShowWindow(SW_HIDE); // check tags checkbox and make it a normal checkbox m_bFetchTags = 1; m_bFFonly = m_regFFonly; UpdateData(FALSE); ::SendMessage(GetDlgItem(IDC_CHECK_FETCHTAGS)->GetSafeHwnd(), BM_SETSTYLE, GetDlgItem(IDC_CHECK_FETCHTAGS)->GetStyle() & ~BS_AUTO3STATE | BS_AUTOCHECKBOX, 0); OnBnClickedCheckFfonly(); } else { this->GetDlgItem(IDC_GROUP_OPTION)->EnableWindow(FALSE); this->GetDlgItem(IDC_CHECK_SQUASH)->EnableWindow(FALSE); this->GetDlgItem(IDC_CHECK_NOFF)->EnableWindow(FALSE); this->GetDlgItem(IDC_CHECK_FFONLY)->EnableWindow(FALSE); this->GetDlgItem(IDC_CHECK_NOCOMMIT)->EnableWindow(FALSE); } if (g_GitAdminDir.IsBareRepo(g_Git.m_CurrentDir)) this->GetDlgItem(IDC_CHECK_REBASE)->EnableWindow(FALSE); m_Other.SetCaseSensitive(TRUE); m_Other.SetURLHistory(TRUE); m_Other.LoadHistory(_T("Software\\TortoiseGit\\History\\PullURLS"), _T("url")); m_RemoteBranch.LoadHistory(_T("Software\\TortoiseGit\\History\\PullRemoteBranch"), _T("br")); m_RemoteBranch.SetCurSel(0); CString sWindowTitle; if(m_IsPull) sWindowTitle = CString(MAKEINTRESOURCE(IDS_PROGRS_TITLE_PULL)); else sWindowTitle = CString(MAKEINTRESOURCE(IDS_PROGRS_TITLE_FETCH)); CAppUtils::SetWindowTitle(m_hWnd, g_Git.m_CurrentDir, sWindowTitle); Refresh(); EnableSaveRestore(_T("PullFetchDlg")); this->m_RemoteManage.SetURL(CString()); return TRUE; }
LRESULT CQuickSetupDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled){ TRC(IDC_FTPSETTINGSBUTTON, "Настройки FTP"); TRC(IDOK, "Продолжить"); TRC(IDCANCEL, "Отмена"); TRC(IDC_LOGINLABEL, "Логин:"); TRC(IDC_PASSWORDLABEL, "Пароль:"); TRC(IDC_SERVERLABEL, "На какой сервер будем загружать картинки?"); TRC(IDC_AUTOSTARTUPCHECKBOX, "Запуск программы при старте Windows"); TRC(IDC_CAPTUREPRINTSCREENCHECKBOX, "Перехватывать нажатия PrintScreen и Alt+PrintScreen"); TRC(IDC_EXPLORERINTEGRATION, "Добавить пункт в контекстное меню проводника Windows"); SetWindowText( APPNAME ); CString titleText; titleText.Format(TR("%s - быстрая настройка"), APPNAME ); SetDlgItemText(IDC_TITLE, titleText ); CenterWindow(); hIcon = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR); SetIcon(hIcon, TRUE); hIconSmall = GuiTools::LoadSmallIcon(IDR_MAINFRAME); SetIcon(hIconSmall, FALSE); serverComboBox_.Attach( GetDlgItem( IDC_SERVERCOMBOBOX ) ); if ( !Settings.IsPortable ) { SendDlgItemMessage( IDC_AUTOSTARTUPCHECKBOX, BM_SETCHECK, BST_CHECKED, 0); SendDlgItemMessage( IDC_CAPTUREPRINTSCREENCHECKBOX, BM_SETCHECK, BST_CHECKED, 0); SendDlgItemMessage( IDC_EXPLORERINTEGRATION, BM_SETCHECK, BST_CHECKED, 0); } LogoImage.SubclassWindow(GetDlgItem( IDC_STATICLOGO ) ); LogoImage.SetWindowPos(0, 0,0, 48, 48, SWP_NOMOVE ); LogoImage.LoadImage(0, 0, Settings.UseNewIcon ? IDR_ICONMAINNEW : IDR_PNG1, false, GetSysColor(COLOR_BTNFACE)); HFONT font = GetFont(); LOGFONT alf; bool ok = ::GetObject(font, sizeof(LOGFONT), &alf) == sizeof(LOGFONT); if(ok) { alf.lfWeight = FW_BOLD; NewFont=CreateFontIndirect(&alf); HDC dc = ::GetDC(0); alf.lfHeight = - MulDiv(11, GetDeviceCaps(dc, LOGPIXELSY), 72); ReleaseDC(dc); NewFont = CreateFontIndirect(&alf); SendDlgItemMessage(IDC_TITLE,WM_SETFONT,(WPARAM)(HFONT)NewFont,MAKELPARAM(false, 0)); } comboBoxImageList_.Create(16,16,ILC_COLOR32 | ILC_MASK,0,6); //serverComboBox_.AddItem( _T("<") + CString(TR("Случайный сервер")) + _T(">"), -1, -1, 0, static_cast<LPARAM>( -1 ) ); HICON hImageIcon = NULL, hFileIcon = NULL; int selectedIndex = 0; //CUploadEngineData *uploadEngine = _EngineList->byIndex( Settings.getServerID() ); std::string selectedServerName = "directupload.net" ; for( int i = 0; i < _EngineList->count(); i++) { CUploadEngineData * ue = _EngineList->byIndex( i ); if ( ue->Type != CUploadEngineData::TypeImageServer && ue->Type != CUploadEngineData::TypeFileServer ) { continue; } HICON hImageIcon = _EngineList->getIconForServer(ue->Name); int nImageIndex = -1; if ( hImageIcon) { nImageIndex = comboBoxImageList_.AddIcon( hImageIcon); } char *serverName = new char[ue->Name.length() + 1]; lstrcpyA( serverName, ue->Name.c_str() ); int itemIndex = serverComboBox_.AddItem( Utf8ToWCstring( ue->Name ), nImageIndex, nImageIndex, 1, reinterpret_cast<LPARAM>( serverName ) ); if ( ue->Name == selectedServerName ){ selectedIndex = itemIndex; } } serverComboBox_.SetImageList( comboBoxImageList_ ); serverComboBox_.SetCurSel( selectedIndex ); doAuthCheckboxChanged(); serverChanged(); return 1; }
HRESULT CSignalWatch_CAN::SW_GetConfigData(xmlNodePtr pNodePtr) { // Setting signal watch window placement and column width xmlNodePtr pWndPositn = xmlNewNode(nullptr, BAD_CAST DEF_WINDOW_POSITION); xmlAddChild(pNodePtr, pWndPositn); WINDOWPLACEMENT WndPlace; UINT nDebugSize = 0; //BYTE* pbyTemp = (BYTE*)pbyConfigData; if ((m_pouSigWnd != nullptr)) { m_pouSigWnd->GetWindowPlacement(&WndPlace); //COPY_DATA(pbyTemp, &WndPlace, sizeof (WINDOWPLACEMENT)); BOOL bIsWndwVisible = m_pouSigWnd->IsWindowVisible(); CString strWindwVisibility = ""; strWindwVisibility = xmlUtils::nSetWindowVisibility(WndPlace.showCmd); // Writing visibility in to xml xmlNodePtr pVisibility = xmlNewChild(pWndPositn, nullptr, BAD_CAST DEF_VISIBILITY, BAD_CAST strWindwVisibility.GetBuffer(strWindwVisibility.GetLength())); xmlAddChild(pWndPositn, pVisibility); UINT nFlag = WndPlace.flags; CString strWindPlcmnt = ""; strWindPlcmnt = xmlUtils::nSetWindowVisibility(nFlag); // Setting window Placement xmlNodePtr pWndwVisibility = xmlNewChild(pWndPositn, nullptr, BAD_CAST DEF_WINDOW_PLACEMENT, BAD_CAST strWindPlcmnt.GetBuffer(strWindPlcmnt.GetLength())); xmlAddChild(pWndPositn, pWndwVisibility); CString strBottomPos = "", strLeftPos = "", strTopPos = "", strRightPos = ""; strTopPos.Format("%d", WndPlace.rcNormalPosition.top); strLeftPos.Format("%d", WndPlace.rcNormalPosition.left); strRightPos.Format("%d", WndPlace.rcNormalPosition.right); strBottomPos.Format("%d", WndPlace.rcNormalPosition.bottom); // Writing co-ordinates of the window in to XML file xmlNodePtr pTopPos = xmlNewChild(pWndPositn, nullptr, BAD_CAST DEF_TOP, BAD_CAST strTopPos.GetBuffer(strTopPos.GetLength())); xmlAddChild(pWndPositn, pTopPos); xmlNodePtr pLeftPos = xmlNewChild(pWndPositn, nullptr, BAD_CAST DEF_Left,BAD_CAST strLeftPos.GetBuffer(strLeftPos.GetLength())); xmlAddChild(pWndPositn, pLeftPos); xmlNodePtr pRightPos = xmlNewChild(pWndPositn, nullptr, BAD_CAST DEF_Right,BAD_CAST strRightPos.GetBuffer(strRightPos.GetLength())); xmlAddChild(pWndPositn, pRightPos); xmlNodePtr pBottomPos = xmlNewChild(pWndPositn, nullptr, BAD_CAST DEF_Bottom,BAD_CAST strBottomPos.GetBuffer(strBottomPos.GetLength())); xmlAddChild(pWndPositn, pBottomPos); // Setting Column width in to the xml file xmlNodePtr pColWidthPtr = xmlNewNode(nullptr, BAD_CAST DEF_Columns_Width); xmlAddChild(pNodePtr, pColWidthPtr); for (UINT i = 0; i < defSW_LIST_COLUMN_COUNT; i++) { INT nWidth = m_pouSigWnd->m_omSignalList.GetColumnWidth(i); CString strWidth = ""; strWidth.Format("%d", nWidth); if(i == 0) { // Writing message column value in to xml xmlNodePtr pMsgClmnPtr = xmlNewChild(pColWidthPtr, nullptr, BAD_CAST DEF_Message_Column, BAD_CAST strWidth.GetBuffer(strWidth.GetLength())); xmlAddChild(pColWidthPtr, pMsgClmnPtr); } if(i == 1) { // Writing Raw value column value in to xml xmlNodePtr pRawValClmn = xmlNewChild(pColWidthPtr, nullptr, BAD_CAST DEF_Raw_Val_Column, BAD_CAST strWidth.GetBuffer(strWidth.GetLength())); xmlAddChild(pColWidthPtr, pRawValClmn); } if(i == 2) { // Writing Raw value column value in to xml xmlNodePtr pPhyalClmn = xmlNewChild(pColWidthPtr, nullptr, BAD_CAST DEF_Physical_Val_Column, BAD_CAST strWidth.GetBuffer(strWidth.GetLength())); xmlAddChild(pColWidthPtr, pPhyalClmn); } if(i == 3) { // Writing Raw value column value in to xml xmlNodePtr pSigValClmn = xmlNewChild(pColWidthPtr, nullptr, BAD_CAST DEF_Signal_Column, BAD_CAST strWidth.GetBuffer(strWidth.GetLength())); xmlAddChild(pColWidthPtr, pSigValClmn); } } } return S_OK; }
/********** Calibration a group of data successfully **********/ void RotorDiskDemarcateDialog::OnBnClickedDemarcatedSucBtn() { if (size >= 10 && demarcatedIdx == size) { AfxMessageBox(IDS_EXCEED_LIMIT, MB_OK | MB_ICONWARNING); return; } UpdateData(TRUE); CSingleton *instance = CSingleton::getInstance(); //TiltDiscData* tdd = &instance->getCurPHM()->tdd; copyTdd.CommandAngs[demarcatedIdx][1] = (float)/*dyPitch*/convertedPitch; copyTdd.CommandAngs[demarcatedIdx][0] = (float)/*dyRoll*/convertedRoll; copyTdd.CommandAngs[demarcatedIdx][2] = (float)/*dyCollective*/convertedCollective; copyTdd.MeansureAngs[demarcatedIdx][1] = (float)(stPitch / 180.0f * PI); copyTdd.MeansureAngs[demarcatedIdx][0] = (float)(stRoll / 180.0f * PI); copyTdd.MeansureAngs[demarcatedIdx][2] = (float)(stCollective / 180.0f * PI); // Add a row if (demarcatedIdx == size) { int nItem = addListRow(demarcatedIdx); CString text; text.Format("%.4g", convertedPitch); demarcatedResult.SetItemText(nItem, 1, text); text.Format("%.4g", convertedRoll); demarcatedResult.SetItemText(nItem, 2, text); text.Format("%.4g", convertedCollective); demarcatedResult.SetItemText(nItem, 3, text); text.Format("%.4g", stPitch); demarcatedResult.SetItemText(nItem, 4, text); text.Format("%.4g", stRoll); demarcatedResult.SetItemText(nItem, 5, text); text.Format("%.4g", stCollective); demarcatedResult.SetItemText(nItem, 6, text); } else { // Update a row int nItem = demarcatedIdx; CString text; text.Format("%.4g", convertedPitch); demarcatedResult.SetItemText(nItem, 1, text); text.Format("%.4g", convertedRoll); demarcatedResult.SetItemText(nItem, 2, text); text.Format("%.4g", convertedCollective); demarcatedResult.SetItemText(nItem, 3, text); text.Format("%.4g", stPitch); demarcatedResult.SetItemText(nItem, 4, text); text.Format("%.4g", stRoll); demarcatedResult.SetItemText(nItem, 5, text); text.Format("%.4g", stCollective); demarcatedResult.SetItemText(nItem, 6, text); } // Clear dyPitch = dyRoll = dyCollective = 0.0f; stPitch = stRoll = stCollective = 0.0f; UpdateData(FALSE); if (demarcatedIdx < size) { // Edit some line demarcatedIdx = size; } else { size++; demarcatedIdx = size; } }
BOOL CFileDiffDlg::OnInitDialog() { CResizableStandAloneDialog::OnInitDialog(); CString temp; CString sWindowTitle; GetWindowText(sWindowTitle); CAppUtils::SetWindowTitle(m_hWnd, g_Git.m_CurrentDir, sWindowTitle); this->m_ctrRev1Edit.Init(); this->m_ctrRev2Edit.Init(); m_tooltips.Create(this); m_tooltips.AddTool(IDC_SWITCHLEFTRIGHT, IDS_FILEDIFF_SWITCHLEFTRIGHT_TT); m_cFileList.SetRedraw(false); m_cFileList.DeleteAllItems(); DWORD exStyle = LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_INFOTIP; m_cFileList.SetExtendedStyle(exStyle); m_nIconFolder = SYS_IMAGE_LIST().GetDirIconIndex(); m_cFileList.SetImageList(&SYS_IMAGE_LIST(), LVSIL_SMALL); m_SwitchButton.SetImage((HICON)LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_SWITCHLEFTRIGHT), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR)); m_SwitchButton.Invalidate(); m_cFilter.SetCancelBitmaps(IDI_CANCELNORMAL, IDI_CANCELPRESSED); m_cFilter.SetInfoIcon(IDI_FILTEREDIT); temp.LoadString(IDS_FILEDIFF_FILTERCUE); temp = _T(" ")+temp; m_cFilter.SetCueBanner(temp); if (!m_sFilter.IsEmpty()) m_cFilter.SetWindowText(m_sFilter); int c = ((CHeaderCtrl*)(m_cFileList.GetDlgItem(0)))->GetItemCount()-1; while (c>=0) m_cFileList.DeleteColumn(c--); temp.LoadString(IDS_FILEDIFF_FILE); m_cFileList.InsertColumn(0, temp); temp.LoadString(IDS_FILEDIFF_EXT); m_cFileList.InsertColumn(1, temp); temp.LoadString(IDS_FILEDIFF_ACTION); m_cFileList.InsertColumn(2, temp); temp.LoadString(IDS_FILEDIFF_STATADD); m_cFileList.InsertColumn(3, temp); temp.LoadString(IDS_FILEDIFF_STATDEL); m_cFileList.InsertColumn(4, temp); int mincol = 0; int maxcol = ((CHeaderCtrl*)(m_cFileList.GetDlgItem(0)))->GetItemCount()-1; int col; for (col = mincol; col <= maxcol; col++) { m_cFileList.SetColumnWidth(col,LVSCW_AUTOSIZE_USEHEADER); } m_cFileList.SetRedraw(true); AddAnchor(IDC_DIFFSTATIC1, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_SWITCHLEFTRIGHT, TOP_RIGHT); AddAnchor(IDC_FIRSTURL, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_REV1BTN, TOP_RIGHT); //AddAnchor(IDC_DIFFSTATIC2, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_SECONDURL, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_REV2BTN, TOP_RIGHT); AddAnchor(IDC_FILTER, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_FILELIST, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_REV1GROUP,TOP_LEFT,TOP_RIGHT); AddAnchor(IDC_REV2GROUP,TOP_LEFT,TOP_RIGHT); AddAnchor(IDC_REV1EDIT,TOP_LEFT); AddAnchor(IDC_REV2EDIT,TOP_LEFT); EnableSaveRestore(_T("FileDiffDlg")); if(this->m_strRev1.IsEmpty()) this->m_ctrRev1Edit.SetWindowText(this->m_rev1.m_CommitHash.ToString()); else { if(m_rev1.GetCommit(this->m_strRev1)) { CString msg; msg.Format(IDS_PROC_REFINVALID, this->m_strRev1); this->m_FileListText += msg; } this->m_ctrRev1Edit.SetWindowText(m_strRev1); } if(this->m_strRev2.IsEmpty()) this->m_ctrRev2Edit.SetWindowText(this->m_rev2.m_CommitHash.ToString()); else { if(m_rev2.GetCommit(this->m_strRev2)) { CString msg; msg.Format(IDS_PROC_REFINVALID, this->m_strRev2); this->m_FileListText += msg; } this->m_ctrRev2Edit.SetWindowText(m_strRev2); } SetURLLabels(); InterlockedExchange(&m_bThreadRunning, TRUE); if (AfxBeginThread(DiffThreadEntry, this)==NULL) { InterlockedExchange(&m_bThreadRunning, FALSE); CMessageBox::Show(NULL, IDS_ERR_THREADSTARTFAILED, IDS_APPNAME, MB_OK | MB_ICONERROR); } InterlockedExchange(&m_bLoadingRef, TRUE); if (AfxBeginThread(LoadRefThreadEntry, this)==NULL) { InterlockedExchange(&m_bLoadingRef, FALSE); CMessageBox::Show(NULL, IDS_ERR_THREADSTARTFAILED, IDS_APPNAME, MB_OK | MB_ICONERROR); } this->m_cRev1Btn.AddEntry(CString(MAKEINTRESOURCE(IDS_REFBROWSE))); this->m_cRev1Btn.AddEntry(CString(MAKEINTRESOURCE(IDS_LOG))); this->m_cRev1Btn.AddEntry(CString(MAKEINTRESOURCE(IDS_REFLOG))); this->m_cRev2Btn.AddEntry(CString(MAKEINTRESOURCE(IDS_REFBROWSE))); this->m_cRev2Btn.AddEntry(CString(MAKEINTRESOURCE(IDS_LOG))); this->m_cRev2Btn.AddEntry(CString(MAKEINTRESOURCE(IDS_REFLOG))); // Start with focus on file list GetDlgItem(IDC_FILELIST)->SetFocus(); if(m_rev2.m_CommitHash.IsEmpty()) m_SwitchButton.EnableWindow(FALSE); KillTimer(IDT_INPUT); return FALSE; }
// 检查接收帧是否为重发帧 BOOL CADCDataRecThread::OnCheckFrameIsRetransmission(unsigned int uiInstrumentNb, unsigned int uiIPAim, unsigned short usDataPointNow) { CString str = _T(""); unsigned short usLostDataFrameCount = 0; // 丢失帧计数 unsigned short usADCDataNb = ReceiveDataSize; // ADC一帧的数据个数 unsigned short usDataPointMove = 0; // 记录指针偏移量 unsigned short usDataPointNb = 0; double dLostRecData[ReceiveDataSize]; memset(&dLostRecData, SndFrameBufInit, ReceiveDataSize*(sizeof(double))); // 接收到的ADC数据不是重发数据 hash_map<unsigned int, m_structADC>::iterator iter; iter = m_oADCLostMap[uiInstrumentNb].find(usDataPointNow); if (iter == m_oADCLostMap[uiInstrumentNb].end()) { // 索引中没找到 if (usDataPointNow > m_usDataPointPrevious[uiInstrumentNb]) { usDataPointMove = usDataPointNow - m_usDataPointPrevious[uiInstrumentNb]; } else { usDataPointMove = ADCFramePointLength + usDataPointNow - m_usDataPointPrevious[uiInstrumentNb]; } if (usDataPointMove/usADCDataNb == 0) { usLostDataFrameCount = 0; } else { usLostDataFrameCount = usDataPointMove/usADCDataNb - 1; } // 有ADC采集数据丢帧则加入ADC数据重发队列 if (usLostDataFrameCount > 0) { for (unsigned short m=0; m<usLostDataFrameCount; m++) { // ProcessMessages(); m_structADC ADCDataStruct; usDataPointNb = (m_usDataPointPrevious[uiInstrumentNb] + (m + 1) * usADCDataNb) % ADCFramePointLength; ADCDataStruct.uiDataCount = m_uiADCDataFrameCount[uiInstrumentNb] + m; ADCDataStruct.uiRetransmissionNum = 0; m_oADCLostMap[uiInstrumentNb].insert(hash_map<unsigned int, m_structADC>::value_type (usDataPointNb, ADCDataStruct)); TRACE(_T("丢失帧指针偏移量为%d"), usDataPointNb); if ((m_uiSampleTempNum[uiInstrumentNb] + ReceiveDataSize) > ADCDataTempDataSize) { CString str = _T(""); str.Format(_T("采集站%d丢失帧数%d"), uiInstrumentNb, usLostDataFrameCount); str += _T("ADC数据处理过程缓冲区大小不够2!"); AfxMessageBox(str); } else { memset(&m_dSampleTemp[uiInstrumentNb][m_uiSampleTempNum[uiInstrumentNb]], SndFrameBufInit, ReceiveDataSize*(sizeof(double))); m_uiSampleTempNum[uiInstrumentNb] += ReceiveDataSize; } if(uiIPAim == m_uiADCGraphIP[uiInstrumentNb]) { m_pOScopeCtrl[uiInstrumentNb]->AppendPoint(dLostRecData, ReceiveDataSize); } } m_uiADCDataFrameCount[uiInstrumentNb] += usLostDataFrameCount; } m_usDataPointPrevious[uiInstrumentNb] = usDataPointNow; return FALSE; } else { // 如果为重发数据则ADC应接收数据个数不变 m_uiADCDataFrameCount[uiInstrumentNb]--; m_uiADCRetransmissionNb = iter->second.uiDataCount; m_oADCLostMap[uiInstrumentNb].erase(iter); return TRUE; } }
void CInputDocView::addPanel(CResultStream* pStream, int id) #endif { CRect r;//(0,0, 100, 100); GetClientRect(&r); #ifndef rde270 // change the dimensions a little so we don't get the annoying non-repaint of m_tabCtrl // when we repaint the RECtrl after a chunk has been loaded offline. r.top = 21; AsyncLoadRichEditCtrl* pEC = new AsyncLoadRichEditCtrl; #else // rde270 r.top = 25; r.right -= 5; r.bottom -= 5; CRichEditCtrl* pEC = new CRichEditCtrl;//CPanelRichEditCtrl;// #endif // CEdit* pEC = new CEdit; m_pEditCtrls.Add(pEC); DWORD dwFlags = ECO_SAVESEL | ES_AUTOVSCROLL | ES_MULTILINE | ES_NOHIDESEL | WS_BORDER | WS_VSCROLL | WS_CHILD | WS_VISIBLE | ES_WANTRETURN; #ifndef jdhhab621 // a hack to get a scrollbar for pc-patr. This could be generalized or put in the user's // control, but not without work that seems unjustified if it's just for pcpatr. if (pStream->getDescriptor()->getTabLabel().Find(_T("PATR")) != -1) dwFlags |= WS_HSCROLL | ES_AUTOHSCROLL; #endif // jdhhab261 pEC->Create(dwFlags, (RECT&)r, &m_tabCtrl, id); CFont* test = pStream->getFont(); pEC->SetFont(test); #ifndef rde270 // delay StreamIn until after setting up of the associated tab (because during StreamIn // our callback must have the pStream which is stored in the tab's lParam member. #else // rde270 // NOTE: I'm not clear on whether StreamIn is done with the stream when it returns; // it doesn't seem to delete it, but you'd think it would need // to keep it around so it can get at large files when the user // scrolls down; maybe not. Why it matters is, what if the cwCOOKIE // member points to a CResultsStream that I've deleted? // For now, I'm going to go on the assumption that the whole // file is read right here. pEC->StreamIn(SF_TEXT, pStream->getEditStreamIn()); // icon may be set in here // Set editing flags and limit CInputDoc* pDoc = (CInputDoc*) GetDocument(); if(id==kBasePanelID && pDoc->m_bBaseIsEditable) { pEC->SetReadOnly(FALSE); const long kMaxAddableChars = 2000; long l = pEC->GetTextLength() + kMaxAddableChars; pEC->LimitText(l); pEC->SetEventMask( ENM_KEYEVENTS| ENM_CHANGE );// want to know when the user changes something } else pEC->SetReadOnly(TRUE); #endif // rde270 /* ALL THIS WAS FOR CEDIT, NOT CRICHEDIT EDITSTREAM es = pStream->getEditStreamIn(); long sz = pEC->GetLimitText()-10; LPTSTR buff = new char [sz+1]; ASSERTX(buff); long actual; (es.pfnCallback)((DWORD)(pStream), (unsigned char*)buff, sz, &actual); buff[actual] = '\0'; CString sOverflowMsg = pStream->getOverflowMsg(); if(actual > sz - sOverflowMsg.GetLength()) { buff[sz-sOverflowMsg.GetLength()] = '\0'; CString s = buff; s += sOverflowMsg; pEC->SetWindowText(s); } else pEC->SetWindowText(buff); // make it close (es.pfnCallback)((DWORD)(pStream), (unsigned char*)buff, 0, &actual); delete buff; */ // make the tab for this item TC_ITEM tie; tie.mask = TCIF_TEXT |TCIF_PARAM ; tie.lParam = (LPARAM)pStream; tie.pszText = (LPTSTR) LPCTSTR(pStream->getDescriptor()->getTabLabel()); int iconEnum = pStream->getTabIconEnum(); if(iconEnum>=0) { tie.mask |= TCIF_IMAGE; tie.iImage = iconEnum; } #ifndef rde270 // save the inserted tab's index (so it can be accessed by knowing the EC). int nIndex = m_tabCtrl.InsertItem(99, &tie ); ::SetWindowLong(pEC->GetSafeHwnd(),GWL_USERDATA,nIndex); if( -1 == nIndex ) #else // rde270 if (-1 == m_tabCtrl.InsertItem(99, &tie )) #endif // rde270 { ASSERTX(FALSE); } else { //CToolTipCtrl* pTip = new CToolTipCtrl; //pTip->Create(this); // <--- or should it be the tab bar? //pTip-> CToolTipCtrl* pTip = m_tabCtrl.GetToolTips(); ASSERT(pTip); CRect r; m_tabCtrl.GetItemRect(m_tabCtrl.GetItemCount()-1, &r); CString s; s.Format(_T("%s"), (LPCTSTR)pStream->getToolTipText()); pTip->AddTool(&m_tabCtrl, s, &r, id); } #ifndef rde270 // moved 'StreamIn' here because we want the tab already setup for when we get the // 'finished-a-chunk' callback. // use the 'AsyncLoadRichEdit' to stream it in [load asynchronously so we don't kill // the UI for minutes (on big files).] #pragma message("If you subclass CResultStream with something besides CResultStreamFile, this'll break!") CResultStreamFile* pStreamFile = (CResultStreamFile*)pStream; // ASSERT(pStreamFile->IsKindOf(RUNTIME_CLASS(CResultStreamFile))); // this assert is what *should* be, but the various streams are from the processor DLLs // and for some reason IsKindOf doesn't appear to work across DLL boundaries. pEC->StreamIn(pStreamFile->getPath(), bSyncStreamIn, CInputDocView::OnStreamInChunkComplete, (DWORD_PTR)this); // Set editing flags and limit CInputDoc* pDoc = (CInputDoc*) GetDocument(); if(id==kBasePanelID && pDoc->m_bBaseIsEditable) { pEC->SetReadOnly(FALSE); const long kMaxAddableChars = 2000; long l = pEC->GetTextLength() + kMaxAddableChars; pEC->LimitText(l); pEC->SetEventMask( ENM_KEYEVENTS| ENM_CHANGE );// want to know when the user changes something // if the editable file was imported as UTF-16, then we must make it 'modified' so // it'll be saved as UTF-8 before processing (Ample, et al., can deal with UTF-8, // but not UTF-16). if( (pEC->FileEncoding() != eUTF8) && (pEC->FileEncoding() != eAnsi) ) GetDocument()->SetModifiedFlag(); } else pEC->SetReadOnly(TRUE); #endif // rde270 }
UINT CGameAI::gameAIThread(LPVOID lpVoid) { int tmpX = 0; int tmpY = 0; CGameAI *ai = (CGameAI *) lpVoid; CGame* leader = ai->getLeader(); CString logTmp; int mapWindowCheckCount = 0; int currX = 0; int currY = 0; int lastX = 0, lastY = 0; int nextX = 0; int nextY = 0; int walkStep = 0; int checkCounter = 0; int notExistsCounter = 0; int walkSleepTime = 0; BOOL isMapOpened = FALSE; BOOL hasNextStep = TRUE; int runTotal = 0; BOOL isMousePressForWalk = FALSE; //统计 ai->saleCounter = 0; ai->healCounter = 0; ai->resetCounter = 0; ai->talkCounter = 0; ai->backToCityCounter = 0; ai->fightTimes = 0; ai->fightRound = 0; ai->isFighting = FALSE; //End统计 //leader->getScreen()->startAutoRefresh(); ai->script.command = CScript::UNKNOW; ai->script.resetPos(); ai->startTime = CTime::GetCurrentTime(); ai->writeLog(TEXT("开始脚本")); CSystem::resetCounter(); //ai->fuckingMouse(); while(ai->isAIStart && hasNextStep) { if(ai->script.command == CScript::UNKNOW) { hasNextStep = ai->script.nextStep(); } if(leader->getScreen()->isFocus() && ai->script.command != CScript::START_GAME && ai->script.command != CScript::TIME && ai->script.command != CScript::AGAIN && ai->isGameClosed == FALSE) { Sleep(500); TRACE("No focus... command[%d], is focus [%d], is game closed [%d].\n", ai->script.command, leader->getScreen()->isFocus(), ai->isGameClosed); continue; } if(ai->script.command != CScript::START_GAME && ai->script.command != CScript::CLOSE_GAME && ai->script.command != CScript::TIME && !isMapOpened && leader->topRightWindow->isExists()) { Sleep(500); ai->checkHPAndMP(); leader->topRightWindow->openMap(); Sleep(500); leader->topRightWindow->disablePets(); isMapOpened = TRUE; TRACE("Map is opened!\n"); Sleep(500); ai->writeLog(TEXT("打开地图窗口")); if(leader->topLeftWindow->isExists()) ai->writeLog(TEXT("检查左上窗口成功")); else ai->writeLog(TEXT("检查左上窗口失败")); Sleep(200); } else ai->writeLog(TEXT("不检查右上窗口")); if(ai->script.command == CScript::WALK || ai->script.command == CScript::CHANGE_MAP) { if(leader->mapWindow->isExists()) { if(ai->isFighting == TRUE) { ai->isFighting = FALSE; ++ai->fightTimes; isMousePressForWalk = FALSE; leader->mapWindow->leftClickCenter(); //防断线 ai->fuckingNP(); notExistsCounter = 0; Sleep(200); continue; } mapWindowCheckCount = 0; currX = leader->mapWindow->getX(); currY = leader->mapWindow->getY(); } else { if(leader->isOffline()) { logTmp.Format(TEXT("执行脚本命令[%d] 下一坐标(%d,%d) 目标坐标(%d,%d) 时断线, 断线前坐标(%d,%d)") , ai->script.command, ai->script.x, ai->script.y , ai->script.targetX, ai->script.targetY , lastX, lastY); ai->writeLog(logTmp); ai->isAIStart = FALSE; break; } ++mapWindowCheckCount; if(mapWindowCheckCount < 5) { ++notExistsCounter; Sleep(1000); continue; } } }// Travel switch(ai->script.command) { case CScript::CHANGE_MAP: if((abs(ai->script.targetX -currX) < 2 && abs(ai->script.targetY - currY) < 2) || (ai->script.targetX == 0 && ai->script.targetY == 0 && (abs(currX - ai->script.x) > 4 || abs(currY - ai->script.y) > 4))) { hasNextStep = ai->script.nextStep(); ai->writeLog(TEXT("转图完成")); break; } case CScript::WALK: if(mapWindowCheckCount > 0) break; if(currX == ai->script.x && currY == ai->script.y) { //leader->mapWindow->move2center(); logTmp.Format(TEXT("已经走到达目标坐标(%d,%d)"), ai->script.x, ai->script.y); ai->writeLog(logTmp); hasNextStep = ai->script.nextStep(); break; } nextX = ai->script.x - currX; nextY = ai->script.y - currY; walkStep = leader->mapWindow->goNext(nextX, nextY); walkSleepTime = 0; /*if((nextX != 0 && abs(nextX) < 8 && nextY == 0) || (nextY != 0 && abs(nextY) < 8 && nextX == 0)) { TRACE("Sleep more................................\n"); walkSleepTime = (WALK_INTERVAL - 80)*walkStep; }*/ walkSleepTime += walkStep*WALK_INTERVAL; if(walkStep < 2) walkSleepTime += (WALK_INTERVAL)*2; else if(walkStep < 4) walkSleepTime += (WALK_INTERVAL+100)*walkStep; TRACE("Walk Sleep Time: %d\n", walkSleepTime); Sleep(walkSleepTime); /* if(!isMousePressForWalk) { isMousePressForWalk = TRUE; CSystem::leftPress(0, 0); } if( (nextX != 0 && abs(nextX) < 5 ) || (nextY != 0 && abs(nextY) < 5 ) ) { Sleep(250); leader->mapWindow->centerXY(&tmpX, &tmpY); if(nextX < 0) { tmpX -= 10; tmpY += 10; } SetCursorPos(tmpX, tmpY); Sleep(walkStep*WALK_INTERVAL); } */ //重置机制 if(lastX == currX && lastY == currY) { ++checkCounter; //Sleep(500); } else checkCounter = 0; if(checkCounter > 20) { isMousePressForWalk = FALSE; ai->writeLog(TEXT("发现人物卡死,尝试重新开始")); ai->script.resetPos(); hasNextStep = ai->script.nextStep(); continue; } else if(checkCounter > 2) { isMousePressForWalk = FALSE; } lastX = currX; lastY = currY; //end 重置机制 continue; case CScript::HEAL: ai->doHeal(); ++ai->healCounter; hasNextStep = ai->script.nextStep(); break; case CScript::AGAIN: ai->writeLog(TEXT("脚本重来")); ai->script.resetPos(); hasNextStep = ai->script.nextStep(); TRACE("=============== Again ==================\n"); ++ai->resetCounter; break; case CScript::FIND_ENEMY: ai->doFindEnemy(); hasNextStep = ai->script.nextStep(); break; case CScript::TALK: ai->doTalk(); hasNextStep = ai->script.nextStep(); ++ai->talkCounter; break; case CScript::AUTO_FIGHT: TRACE("Start auto fight.\n"); ai->writeLog(TEXT("开始自动战斗")); while(ai->isAIStart) ai->autoFight(); break; case CScript::BACK_TO_CITY: ai->doBackToCity(); hasNextStep = ai->script.nextStep(); break; case CScript::SALE: ai->doSale(); hasNextStep = ai->script.nextStep(); ++ai->saleCounter; break; case CScript::TIME: ai->doTime(); hasNextStep = ai->script.nextStep(); break; case CScript::TEST: ai->doTest(); hasNextStep = ai->script.nextStep(); break; case CScript::CLOSE_GAME: ai->doCloseGame(); hasNextStep = ai->script.nextStep(); break; case CScript::START_GAME: ai->doStartGame(); hasNextStep = ai->script.nextStep(); isMapOpened = FALSE; break; } // end switch if(hasNextStep == FALSE) return 0; if(notExistsCounter > 1) ai->autoFight(); TRACE("command: %d, current (%d,%d), next: (%d,%d), target: (%d,%d)\n", ai->script.command, currX, currY, ai->script.x, ai->script.y, ai->script.targetX, ai->script.targetY); continue; } ai->endTime = CTime::GetCurrentTime(); runTotal = ai->endTime.GetTime() - ai->startTime.GetTime(); logTmp.Format(TEXT("结束脚本,总运行时间: %02d:%02d:%02d, 左键点击次数: %d, 右键点击次数: %d, 键盘按键次数: %d, 回城次数: %d, 治疗次数: %d, 对话次数: %d, 脚本重复次数: %d, 售卖次数: %d, 战斗数: %d, 回合数: %d\r\n\r\n") , runTotal / 3600, runTotal / 60 % 60, runTotal % 60, CSystem::getLeftClickCounter() , CSystem::getRightClickCounter(), CSystem::getSendKeyCounter() , ai->backToCityCounter, ai->healCounter, ai->talkCounter, ai->resetCounter, ai->saleCounter , ai->fightTimes, ai->fightRound); ai->writeLog(logTmp); return 0; }
void CGameAI::doFindEnemy() { CCgxMapWindow* pMap = leader->mapWindow; int lastX = 0; int lastY = 0; int endOfNorth = 0; int endOfSouth = 0; int walkStep = 0; BOOL stepFlag = TRUE; int currX = 0; int currY = 0; int notExistCounter = 0; BOOL isEndOfWest = FALSE; BOOL isPress = FALSE; int goodsCounter = 0; int nowMinu = 0; int failCounter = 0; CString logTmp; writeLog(TEXT("开始遇敌")); //统计 int fightingCounter = 0; int fightingRound = fightRound; //end 统计 while(isAIStart) { if(pMap->isExists()) { if(isFighting == TRUE) { isFighting = FALSE; // 到点重置 if(!isReseted && resetMinu != 0) { nowMinu = getMinu(); TRACE("Now is %d reset minu %d\n", nowMinu, resetMinu); if(resetMinu == nowMinu) { writeLog(TEXT("到达重置时间,重新开始。")); script.resetPos(); script.nextStep(); isReseted = TRUE; break; } } Sleep(300); pMap->leftClickCenter(); //防断线 fuckingNP(); notExistCounter = 0; Sleep(200); ++fightingCounter; ++fightTimes; //战斗超过10次才检查物品 if(fightingCounter > 10) { checkGoods(&goodsCounter); logTmp.Format(TEXT("战斗结束,检查物品有%d个"), goodsCounter); writeLog(logTmp); TRACE("==================Goods: %d\n", goodsCounter); if(goodsCounter == NUMBER_OF_GOODS) { if(isConfigYes(SCRIPT_CONTROLL, WHEN_FULL_GOODS_STOP_FIND_ENEMY)) { script.resetPos(); break; } } } if(!checkHPAndMP()) { break; } } currX = pMap->getX(); currY = pMap->getY(); //防止迷宫重置 if(script.lastX == currX && script.lastY == currY) { walkStep = pMap->goNext(0, 1); Sleep(walkStep* WALK_INTERVAL); } if(abs(script.lastX - currX) < 2 && abs(script.lastY - currY) < 2) { walkStep = pMap->goNext(script.lastX - currX, script.lastY - currY); Sleep(walkStep* WALK_INTERVAL); } // 无限制遇敌 if(script.x == 0 && script.y == 0) { if(!isEndOfWest) { if(lastX == currX) { isEndOfWest = TRUE; lastY = 0; continue; } walkStep = pMap->goNext(-10, 0); Sleep(walkStep* WALK_INTERVAL / 2); } else if(endOfSouth == 0) { if(lastY == currY) { endOfSouth = currY; lastY = 0; continue; } walkStep = pMap->goNext(0, 8); Sleep(walkStep* WALK_INTERVAL/ 2); } else if(endOfNorth == 0) { if(lastY == currY) { endOfNorth = currY; continue; } walkStep = pMap->goNext(0, -8); Sleep(walkStep* WALK_INTERVAL/ 2); } else { //TRACE("All found\n"); if(currY <= endOfNorth+1) walkStep = pMap->moveMouse(0, 8); else if(currY >= endOfSouth-1) walkStep = pMap->moveMouse(0, -8); else if(!isPress) walkStep = pMap->moveMouse(0, 8); if(!isPress) { isPress = TRUE; CSystem::leftPress(0, 0); } } } else // 限制遇敌 { if(stepFlag) { //TRACE("current: (%d,%d), target: (%d,%d)\n", currX, currY, script.x, script.y); if(currX == script.x && currY == script.y) stepFlag = FALSE; else walkStep = pMap->moveMouse(script.x-currX, script.y-currY); } else { if(currX == script.targetX && currY == script.targetY) stepFlag = TRUE; else walkStep = pMap->moveMouse(script.targetX-currX, script.targetY-currY); } if(!isPress) { isPress = TRUE; CSystem::leftPress(0, 0); } } // // end 限制遇敌 Sleep(WALK_INTERVAL*walkStep); //重置机制 if(lastX == currX && lastY == currY) ++failCounter; else failCounter = 0; if(failCounter > 10) { writeLog(TEXT("发现人物遇敌时卡死,尝试恢复")); isEndOfWest = FALSE; endOfNorth = 0; endOfSouth = 0; failCounter = 0; isPress = FALSE; } // end 重置机制 lastX = currX; lastY = currY; continue; } else { if(leader->isOffline()) { logTmp.Format(TEXT("执行脚本命令[%d] x: %d, y: %d 目标x: %d, 目标y: %d 时断线") , script.command, script.x, script.y, script.targetX, script.targetY); writeLog(logTmp); isAIStart = FALSE; break; } isPress = FALSE; ++notExistCounter; if(notExistCounter < 5) { Sleep(1000); continue; } } autoFight(); } logTmp.Format(TEXT("战斗结束,一共战斗%d次, %d回合"), fightingCounter, fightRound-fightingRound); writeLog(logTmp); }
void CGameAI::doStartGame() { int x = 0; int y = 0; RECT rect; DWORD pId = NULL; CString logStr; HWND ywtHWND = NULL; HWND crossGameHWND = NULL; //HWND ywtHWND = FindWindow(TEXT("#32770"), NULL); TRACE("game hwnd: %d\n", leader->getHWND()); if(leader->getHWND() != NULL) return; ywtHWND = FindWindow(NULL, TEXT("\u201c\u6613\u73a9\u901a\u201d\u5a31\u4e50\u5e73\u53f0")); if(ywtHWND != INVALID_HANDLE_VALUE) { TRACE("Doing start the game\n"); GetWindowThreadProcessId(ywtHWND, &pId); EnumWindows(EnumWindowCallBack, (LPARAM)&pId); ywtHWND = (HWND)pId; ShowWindow(ywtHWND, SW_SHOWNORMAL); Sleep(500); SetForegroundWindow(ywtHWND); Sleep(1000); CSystem::sendKey(VK_RETURN); Sleep(1000); if(script.x > 1 && script.x < 10) { for(int i = 1; i < script.x; ++i) { CSystem::sendKey(VK_DOWN); Sleep(1000); } } CSystem::sendKey(VK_RETURN); Sleep(4000); EnumWindows(FindCrossGateWindowsProc4Login, (LPARAM)&crossGameHWND); if(crossGameHWND) { isGameClosed = FALSE; leader->setHWND(crossGameHWND); SetForegroundWindow(ywtHWND); Sleep(500); rect.left = 140; rect.top = 140; rect.right = 170; rect.bottom = 154; while(leader->getScreen()->colorDeviation(&rect, RGB(99,36,33)) == 0) { leader->mapWindow->leftClickCenter(); Sleep(500); } rect.left = 136; rect.top = 172; rect.right = 166; rect.bottom = 186; fuckingMouse(); while(leader->getScreen()->colorDeviation(&rect, RGB(99,36,33)) == 0) { CSystem::leftClick(156, 148); Sleep(1000); } rect.left = 142; rect.top = 352; rect.right = 184; rect.bottom = 362; logStr.Format(TEXT("正在登录%d线"), script.y); writeLog(logStr); if(script.y < 1 || script.y > 10) script.y = 3; fuckingMouse(); while(leader->getScreen()->colorDeviation(&rect, RGB(255,255,255)) < 4) { if(script.y < 6) { x = 156; y = 116 + script.y*32; } else { x = 255; y = 116 + (script.y-5)*32; } CSystem::leftClick(x, y); Sleep(100); CSystem::leftClick(x, y); Sleep(100); CSystem::leftClick(x, y); Sleep(1000); } if(script.targetX != 2) CSystem::leftClick(162, 358); else CSystem::leftClick(480, 358); Sleep(8000); } } }
void CuDlgDBEventPane02::IncomingDBEvent ( CDbeventDoc* pDoc, LPCTSTR strNum, LPCTSTR strTime, LPCTSTR strDbe, LPCTSTR strOwner, LPCTSTR strText, LPCTSTR strExtra) { CString strLine; int diff, nCount, index; nCount = m_cListRaisedDBEvent.GetItemCount (); if (nCount >= pDoc->m_nMaxLine) { // // Special State ??? if (m_bSpecial) return; diff = nCount - pDoc->m_nMaxLine; if (pDoc->m_bClearFirst) { for (int i=0; i<=diff; i++) m_cListRaisedDBEvent.DeleteItem (i); } else { int answ; //"Cannot continue. DB Event Trace is interrupted until\n" //"you clear the list, change the max lines, or\n" //"check the 'Clear First When Max Reached' check box."; CString strMsg = VDBA_MfcResourceString(IDS_E_DB_EVENT_TRACE); // // DB Event is raised ... CTime time = CTime::GetCurrentTime(); CString strTf = time.Format ("%c"); if (lstrlen (strNum) > 0 && lstrcmpi (strNum, "r") == 0) { //"DB Event was raised, but the list is full. Clear first entry in the list ?"; CString msg = VDBA_MfcResourceString(IDS_E_DB_EVENT_RAISED); answ = BfxMessageBox (msg, MB_YESNO|MB_ICONQUESTION); if (answ == IDNO) { m_bSpecial = TRUE; BfxMessageBox (strMsg, MB_OK); strLine = ""; index = m_cListRaisedDBEvent.InsertItem (nCount, (LPTSTR)(LPCTSTR)strLine, 0); m_cListRaisedDBEvent.SetItemText (index, 1, (LPTSTR)(LPCTSTR)strTf); m_cListRaisedDBEvent.SetItemText (index, 2, VDBA_MfcResourceString(IDS_INTERRUPTED));//"<Interrupted>" return; } } // // User registers or unregisters DB Event... else if (lstrlen (strNum) > 0 && lstrcmpi (strNum, "?") == 0) {//"The list is full. Clear first entry in the list ?" CString msg = VDBA_MfcResourceString(IDS_E_DB_EVENT_LIST_FULL); answ = BfxMessageBox (msg, MB_YESNO|MB_ICONQUESTION); if (answ == IDNO) { BfxMessageBox (strMsg, MB_OK); m_bSpecial = TRUE; strLine = ""; index = m_cListRaisedDBEvent.InsertItem (nCount, (LPTSTR)(LPCTSTR)strLine, 0); m_cListRaisedDBEvent.SetItemText (index, 1, (LPTSTR)(LPCTSTR)strTf); m_cListRaisedDBEvent.SetItemText (index, 2, VDBA_MfcResourceString(IDS_INTERRUPTED));//"<Interrupted>" return; } } // // Fill up the list while loading .... else {//"The list is full. Clear first entry in the list ?" CString msg = VDBA_MfcResourceString(IDS_E_DB_EVENT_LIST_FULL); answ = BfxMessageBox (msg, MB_YESNO|MB_ICONQUESTION); if (answ == IDNO) { m_bSpecial = TRUE; BfxMessageBox (strMsg, MB_OK); } if (nCount == pDoc->m_nMaxLine) { // We have add the line "<Interrupted>" // We cannot add the line "<Restarted>" so we just return; return; } } if (answ == IDYES) { for (int i=0; i<=diff; i++) m_cListRaisedDBEvent.DeleteItem (i); } } } else { m_bSpecial = FALSE; } if (lstrlen (strNum) > 0) { if (lstrcmpi (strNum, "?") == 0 || lstrcmpi (strNum, "r") == 0) { // // Define the line number; pDoc->m_nCounter2++; if (pDoc->m_nCounter2 < 0) { pDoc->m_nCounter1++; pDoc->m_nCounter2 = 1; } if (pDoc->m_nCounter1 == 1) { strLine.Format ("%4d", pDoc->m_nCounter2); } else { strLine.Format ("%d/%d", pDoc->m_nCounter1, pDoc->m_nCounter2); } index = m_cListRaisedDBEvent.InsertItem (nCount, (LPTSTR)(LPCTSTR)strLine, 0); } else index = m_cListRaisedDBEvent.InsertItem (nCount, (LPTSTR)(LPCTSTR)strNum, 0); } else index = m_cListRaisedDBEvent.InsertItem (nCount, (LPTSTR)"", 0); // // Add the Time m_cListRaisedDBEvent.SetItemText (index, 1, (LPTSTR)strTime); // // Add the DBEvent if (strExtra) { CString strStar = strExtra; strStar += strDbe; m_cListRaisedDBEvent.SetItemText (index, 2, (LPTSTR)(LPCTSTR)strStar); } else m_cListRaisedDBEvent.SetItemText (index, 2, (LPTSTR)strDbe); // // Add the Owner m_cListRaisedDBEvent.SetItemText (index, 3, (LPTSTR)strOwner); // // Add the Text m_cListRaisedDBEvent.SetItemText (index, 4, (LPTSTR)strText); }
void FilterCutDialog::updateDisplayedCBError(float value){ CString a; a.Format(_T("%.2f"), value); CBError.SetWindowText(a); }
void CDialogMistakes::LoadMistakes(){ POSITION pos = m_plstMistakes->GetHeadPosition(); CMistake* pMistake = NULL; char* buf = new char[16]; int nItem = 0; CString strMistake; while (pos !=NULL){ pMistake = (CMistake*)m_plstMistakes->GetNext(pos); if (MistakeInList(pMistake, 0)){ continue; } buf = itoa(pMistake->m_Deck.m_nNumPlayed, buf, 10); m_listMistakes.InsertItem(nItem = 0, buf); GetMistakeType(pMistake, strMistake); if (pMistake->m_nMistake < 0){ m_dBetMistakes += pMistake->m_dLoss; m_dTotalMistakes += pMistake->m_dLoss; //bet } else{ m_dPlayMistakes += pMistake->m_dLoss*pMistake->m_nBet; m_dTotalMistakes += pMistake->m_dLoss*pMistake->m_nBet; //mistake play } m_listMistakes.SetItemText(nItem, 1, strMistake); strMistake.Format("%.4f", pMistake->m_dLoss); m_listMistakes.SetItemText(nItem, 2, strMistake); m_listMistakes.SetItemText(nItem, 3, pMistake->m_Date.Format("%m/%d %H:%M")); m_listMistakes.SetItemData(nItem, (DWORD)pMistake); } pos = m_plstStandardMistakes->GetHeadPosition(); while (pos !=NULL){ pMistake = (CMistake*)m_plstStandardMistakes->GetNext(pos); if (MistakeInList(pMistake, 1)){ continue; } buf = itoa(pMistake->m_Deck.m_nNumPlayed, buf, 10); m_listStandardMistakes.InsertItem(nItem = 0, buf); GetMistakeType(pMistake, strMistake); if (pMistake->m_nMistake < 0){ m_dBetMistakes2 += pMistake->m_dLoss; m_dTotalMistakes2 += pMistake->m_dLoss; //bet } else{ m_dPlayMistakes2 += pMistake->m_dLoss*pMistake->m_nBet; m_dTotalMistakes2 += pMistake->m_dLoss*pMistake->m_nBet; //mistake play } m_listStandardMistakes.SetItemText(nItem, 1, strMistake); strMistake.Format("%.4f", pMistake->m_dLoss); m_listStandardMistakes.SetItemText(nItem, 2, strMistake); m_listStandardMistakes.SetItemText(nItem, 3, pMistake->m_Date.Format("%m/%d %H:%M")); m_listStandardMistakes.SetItemData(nItem, (DWORD)pMistake); } UpdatePossible(); delete buf; //update the total mistakes, look at betting mistakes and others seperately. }
UINT CNav_ExportCustomsDlg::ExportData(LPVOID p) { HRESULT hRes; Excel::_ApplicationPtr appExcel; hRes = appExcel.CreateInstance( _T("Excel.Application")); CNav_ExportCustomsDlg *Dialog; Dialog = (CNav_ExportCustomsDlg*)p; if(Dialog != NULL) { CString sStart, sEnd; Dialog->m_EndDate.GetWindowText(sEnd); Dialog->m_StartDate.GetWindowText(sStart); CString sGTD; Dialog->m_EdGTDNUMBER.GetWindowText(sGTD); COleDateTime datStart,datEnd, cDate; datStart.ParseDateTime(sStart); datEnd.ParseDateTime(sEnd); CString sConnect; CString sServer, sDatabase; sServer = sReadFromIni(_T("DB"),_T("SERVER"),_T("svbyminssq3")); //sWriteToIni(_T("DB"),_T("SERVER"),sServer); sDatabase = sReadFromIni(_T("DB"),_T("DATABASE"),_T("SHATE-M-8")); //sWriteToIni(_T("DB"),_T("DATABASE"),sDatabase); Excel::WorkbooksPtr ExcelBooks; Excel::_WorkbookPtr ExcelBook; Excel::_WorksheetPtr ExcelSheet; Excel::RangePtr range; VARIANT bTRUE; bTRUE.vt = 11; bTRUE.boolVal = TRUE; appExcel->Visible[0] = FALSE; ExcelBook= appExcel->Workbooks->Add(); ExcelSheet = ExcelBook->Worksheets->Item[1]; sConnect.Format(_T("DRIVER=SQL Server;SERVER=%s;UID=;WSID=%s;Trusted_Connection=Yes;DATABASE=%s;LANGUAGE=русский"),sServer,GetWinUserName(),sDatabase); CDatabase* dBase; dBase = NULL; try { dBase = new(CDatabase); dBase->SetQueryTimeout(600); dBase->OpenEx(sConnect,CDatabase::noOdbcDialog); sConnect.Format(_T("EXEC [sp_setapprole] '%s', '%s', 'none', 0, 0"),_T("$ndo$shadow"),_T("FF5EC4E40F67BD4EDF3D04F8B84364DAD0")); dBase->ExecuteSQL(sConnect); } catch(CDBException *exsept) { appExcel->Visible[0] = TRUE; Dialog->m_stState.SetWindowTextW(exsept->m_strError); exsept->Delete(); if(dBase != NULL) { if(dBase->IsOpen()) { dBase->Close(); } delete(dBase); } dBase = NULL; Dialog->m_BtOK.ShowWindow(1); Dialog->SecondThread = NULL; return 0; } CString sSQL; try { CRecordset Query(dBase); int iField; CDBVariant dbValue; Dialog->m_stState.SetWindowTextW(_T("Формирование")); sGTD = sGTD + _T("'"); sSQL = _T("select distinct SIH.[Posting Date],(SIL.[TTN Series]+SIL.[TTN Number]) AS TTN,SIL.[Item No_ 2], SIH.[Bill-to Name] "); sSQL = sSQL + _T(" from [")+sDatabase; sSQL = sSQL + _T("$Sales Invoice Header] as SIH join ["); sSQL = sSQL + sDatabase; sSQL = sSQL + _T("$Sales Invoice Line] as SIL on SIL.[Document No_] = SIH.[No_] and SIL.[No_] is not null and SIL.[No_] <> '' and SIL.[TTN Series] <> '' and SIL.[TTN Number] <> '' join ["); sSQL = sSQL + sDatabase; sSQL = sSQL + _T("$Custom Declaration Relation] as CDR on CDR.[Item No_] = SIL.[No_] and CDR.[Document Type] = 5 and CDR.[CD No_] = '") + sGTD; sSQL = sSQL + _T(" where [Sales Process Type Code] = 'Б/Н_ДОСТАВКА' and Left(CONVERT ( nchar , SIH.[Posting Date], 112),8) >= '")+ datStart.Format(_T("%Y%m%d"))+_T("'"); sSQL = sSQL + _T(" and Left(CONVERT ( nchar , SIH.[Posting Date], 112),8) <= '")+ datEnd.Format(_T("%Y%m%d"))+_T("'"); //sSQL = sSQL + _T(" and CDR.[CD No_] = '") + sGTD; CString sDat; int iRow; iRow = 1; sDat = _T("Дата учета продажи"); ExcelSheet->Cells->Item[iRow,2] = sDat.AllocSysString(); sDat = _T("Номер ТТН, ТН"); ExcelSheet->Cells->Item[iRow,3] = sDat.AllocSysString(); sDat = _T("Код проданного товара (код товара2)"); ExcelSheet->Cells->Item[iRow,4] = sDat.AllocSysString(); sDat = _T("Клиент"); ExcelSheet->Cells->Item[iRow,5] = sDat.AllocSysString(); Query.Open(CRecordset::snapshot,sSQL, CRecordset::readOnly); while(!Query.IsEOF()) { iRow++; if((iRow -2) % 100 == 0) { sSQL.Format(_T("Обработанно %d"),iRow-2); Dialog->m_stState.SetWindowTextW(sSQL); } iField = 0; Query.GetFieldValue(iField, dbValue); sDat = GetValue(&dbValue); ExcelSheet->Cells->Item[iRow,2] = sDat.AllocSysString(); iField = 1; Query.GetFieldValue(iField, dbValue); sDat = GetValue(&dbValue); ExcelSheet->Cells->Item[iRow,3] = sDat.AllocSysString(); iField = 2; Query.GetFieldValue(iField, dbValue); sDat = GetValue(&dbValue); ExcelSheet->Cells->Item[iRow,4] = sDat.AllocSysString(); iField = 3; Query.GetFieldValue(iField, dbValue); sDat = GetValue(&dbValue); ExcelSheet->Cells->Item[iRow,5] = sDat.AllocSysString(); Query.MoveNext(); } Query.Close(); } catch(CDBException *exsept) { /*appExcel->Visible[0] = TRUE; appExcel = NULL;*/ appExcel->Visible[0] = TRUE; Dialog->m_stState.SetWindowTextW(exsept->m_strError); Dialog->m_EdError.SetWindowTextW(sSQL); exsept->Delete(); if(dBase != NULL) { if(dBase->IsOpen()) { dBase->Close(); } delete(dBase); } Dialog->m_BtOK.ShowWindow(1); Dialog->SecondThread = NULL; dBase = NULL; return 0; } Dialog->m_stState.SetWindowTextW(_T("Выполненно")); Dialog->m_BtOK.ShowWindow(1); } appExcel->Visible[0] = TRUE; Dialog->SecondThread = NULL; return 1; }
void CClientDlg::OnBnClickedStart() { CString strAddress; CString strPort; CString strTestTimes; CString strTestInterv; CString strThreadCount; CString strThreadInterv; CString strDataLen; m_Address.GetWindowText(strAddress); m_Port.GetWindowText(strPort); m_TestTimes.GetWindowText(strTestTimes); m_TestInterv.GetWindowText(strTestInterv); m_ThreadCount.GetWindowText(strThreadCount); m_ThreadInterv.GetWindowText(strThreadInterv); m_DataLen.GetWindowText(strDataLen); m_strAddress = strAddress.Trim(); m_usPort = (USHORT)_ttoi(strPort); m_iTestTimes = _ttoi(strTestTimes); m_iTestInterv = _ttoi(strTestInterv); m_iThreadCount = _ttoi(strThreadCount); m_iThreadInterv = _ttoi(strThreadInterv); m_iDataLen = _ttoi(strDataLen); if(!CheckParams()) return; SetAppState(ST_STARTING); m_dwBeginTickCount = 0; m_dwTimeconsuming = 0; m_llTotalReceived = 0; m_llTotalSent = 0; m_llExpectReceived = (LONGLONG)m_iTestTimes * (LONGLONG)m_iThreadCount * (LONGLONG)m_iDataLen; m_vtClients.Clear(); for(int i = 0; i < m_iThreadCount; i++) { smart_simple_ptr<CTcpClientWrapper> pSocket = new CTcpClientWrapper(this); if((*pSocket)->Start(m_strAddress, m_usPort)) m_vtClients->push_back(pSocket.release()); else { ::LogClientStartFail((*pSocket)->GetLastError(), (*pSocket)->GetLastErrorDesc()); m_vtClients.Clear(); SetAppState(ST_STOPED); return; } } ::LogClientStart(m_strAddress, m_usPort); DWORD dwSendDelay = 3; CString strMsg; strMsg.Format(_T(" *** willing to send data after %d seconds ..."), dwSendDelay); ::LogMsg(strMsg); ::WaitWithMessageLoop(dwSendDelay * 1000); m_sendBuffer.Malloc(m_iDataLen, true); SetAppState(ST_STARTED); ::LogMsg(_T(" *** Go Now !")); m_dwBeginTickCount = ::TimeGetTime(); BOOL bTerminated = FALSE; for(int i = 0; i < m_iTestTimes; i++) { for(int j = 0; j < m_iThreadCount; j++) { CTcpClientWrapper* pSocket = m_vtClients[j]; if(!(*pSocket)->Send(m_sendBuffer, (int)m_sendBuffer.Size())) { ::LogClientSendFail(i + 1, j + 1, ::SYS_GetLastError(), ::HP_GetSocketErrorDesc(SE_DATA_SEND)); bTerminated = TRUE; break; } if(m_iThreadInterv > 0 && j + 1 < m_iThreadCount) ::WaitWithMessageLoop(m_iThreadInterv); } if(bTerminated) break; if(m_iTestInterv > 0 && i + 1 < m_iTestTimes) ::WaitWithMessageLoop(m_iTestInterv); } m_sendBuffer.Free(); }
void CMySuperGrid::_DeleteAll() { DeleteAll();//call CSuperGridCtrl::DeleteAll(); //add some new data CItemInfo* lp = new CItemInfo(); lp->SetImage(4); //add item text lp->SetItemText(_T("New data")); //Create root item CTreeItem * pRoot = InsertRootItem(lp);//previous we call CreateTreeCtrl(lp) if( pRoot == NULL ) return; //insert items int nCol = GetNumCol(); for(int i=0; i < nCol; i++) { CItemInfo* lpItemInfo = new CItemInfo(); CString strItem; strItem.Format(_T("Item %d"),i); //add items text lpItemInfo->SetItemText(strItem); //add subitem text for(int y=0;y < nCol-1; y++) { CString str; str.Format(_T("subItem %d of %s"),y,lpItemInfo->GetItemText()); lpItemInfo->AddSubItemText(str); lpItemInfo->AddSubItemText(str); } //insert the iteminfo with ParentPtr CTreeItem* pParent = InsertItem(pRoot, lpItemInfo); //other nodes if(i%nCol) { CTreeItem* pParent1=NULL; CTreeItem* pParent2=NULL; for(int x=0; x < nCol; x++) { CItemInfo* lpItemInfo = new CItemInfo(); CString strItem; strItem.Format(_T("Item %d"),x); lpItemInfo->SetItemText(strItem); for(int z=0; z < nCol-1; z++) { CString str; str.Format(_T("subItem %d of %s"),z, lpItemInfo->GetItemText()); lpItemInfo->AddSubItemText(str); } pParent1 = InsertItem(pParent, lpItemInfo); } } } //expand one level Expand(pRoot, 0 /*listview index 0*/); UINT uflag = LVIS_SELECTED | LVIS_FOCUSED; SetItemState(0, uflag, uflag); }
BOOL CFlashManager::GetFlashElements(IHTMLDocument2* pDoc) { CFuncLog log(g_pLog, "CFlashManager::GetFlashElements()"); m_FlashElementList.clear(); CComQIPtr<IHTMLDocument2> spHTML(pDoc); if (!spHTML) { CString szMsg; szMsg.Format("CComQIPtr<IHTMLDocument2> spHTML(pDoc) FAILED: pDoc==%X", pDoc); GetError(szMsg); log.LogString(LOG_ERROR, szMsg.GetBuffer()); return FALSE; } CComPtr<IHTMLElementCollection> spAll; HRESULT hr = spHTML->get_all(&spAll); if (FAILED(hr) || !spAll) { CString szMsg; szMsg.Format("spHTML->get_all(&spAll) FAILED: HR == [%X], spAll == %X", hr, spAll); GetError(szMsg); log.LogString(LOG_ERROR, szMsg.GetBuffer()); return FALSE; } // Find all the OBJECT tags in the document CComPtr<IDispatch> spTagsDisp; hr = spAll->tags(CComVariant(CComBSTR("object")), &spTagsDisp); if (FAILED(hr) || !spTagsDisp) { CString szMsg; szMsg.Format("if (FAILED(hr) || !spTagsDisp) FAILED: hr==%X", hr, spTagsDisp); GetError(szMsg); log.LogString(LOG_ERROR, szMsg.GetBuffer()); return FALSE; } CComQIPtr<IHTMLElementCollection> spTags(spTagsDisp); if (!spTags) return FALSE; long nCnt = 0; hr = spTags->get_length(&nCnt); if (FAILED(hr)) { CString szMsg; szMsg.Format("spTags->get_length(&nCnt) FAILED: nCnt==%d", nCnt); log.LogString(LOG_WARNING, szMsg.GetBuffer()); return FALSE; } bool bSuccess = false; for (long i=0; i < nCnt; i++) { CComPtr<IDispatch> spTagDisp; hr = spTags->item(CComVariant(i), CComVariant(i), &spTagDisp); if (FAILED(hr) || !spTagDisp) continue; CComQIPtr<IHTMLObjectElement> spObject(spTagDisp); if (!spObject) continue; CComBSTR bsClassID; hr = spObject->get_classid(&bsClassID); CString szClassID(bsClassID); if (FAILED(hr) || !bsClassID) { CString szMsg; szMsg.Format("if (FAILED(hr) || !bsClassID) FAILED: hr==%X, bsClassID == %s", hr, bsClassID.m_str); log.LogString(LOG_ERROR, szMsg.GetBuffer()); continue; } szClassID.MakeUpper(); if (szClassID.Find(FLASH_PLAYER_CLASSID) >= 0) { log.LogString(LOG_INFO, "if (szClassID.Find(FLASH_PLAYER_CLASSID) >= 0) is TRUE"); ElementInfo ElemInfo; ElemInfo.Updated = FALSE; CComPtr<IDispatch> spFlashDisp; hr = spObject->get_object(&spFlashDisp); if (SUCCEEDED(hr) && spFlashDisp) { ElemInfo.pFlashDisp = spFlashDisp; log.LogString(LOG_INFO, "if (SUCCEEDED(hr) && spFlashDisp) Succeeded"); } ElemInfo.pTagDisp = spTagDisp; m_FlashElementList.push_back(ElemInfo); bSuccess = true; } } if (g_pLog) { CString szMsg; szMsg.Format("RESULTS: bSuccess == %X, nCnt==%d", bSuccess, nCnt); log.LogString(LOG_INFO, szMsg.GetBuffer()); } return bSuccess; }
// // See help text within for an explanation of the expected parameters. // void CGalileoCmdLine::ParseParam(const char *pszParam, BOOL bFlag, BOOL bLast) { static int param_count = 0; static char last_switch = 0; char temp_switch; param_count++; if (m_bFail) { // If command line parsing has failed before, don't // try to interpret the command line further. return; } if (bFlag && strlen(pszParam) != 1) { Fail("Exactly one letter must follow a switch character. " "Switch characters are \"/\" and \"-\"."); return; } if (pszParam[0] == '?') { // get Syntax display string from resource file CString version; CString syntax; version.Format(IDS_VERSION_OUTPUT, (LPCTSTR) theApp.GetVersionString(TRUE)); VERIFY(syntax.LoadString(IDS_CMDLINE_SYNTAX)); AfxMessageBox(version + "\n\n" + syntax); m_bFail = TRUE; return; } if (last_switch) { temp_switch = last_switch; last_switch = 0; // Previous switch expects another parameter. switch (temp_switch) { // Expecting the config file. case 'C': if (!m_sConfigFile.IsEmpty()) // has it already been set? { Fail("Config file parameter was specified more than once."); } else if (IsValidFilename(pszParam)) { if (VerifyReadable(pszParam)) m_sConfigFile = pszParam; else m_bFail = TRUE; } else { Fail("C switch should be followed by the name of a configuration file."); } return; // Expecting the result file. case 'R': if (!m_sResultFile.IsEmpty()) // has it already been set? { Fail("Result file parameter was specified more than once."); } else if (IsValidFilename(pszParam)) { if (VerifyWritable(pszParam)) m_sResultFile = pszParam; else m_bFail = TRUE; } else { Fail("R switch should be followed by the name of the desired result file."); } return; // Expecting the timeout value. case 'T': if (m_iTimeout >= 0) // has it already been set? { Fail("Timeout parameter was specified more than once."); } else if (IsValidInteger(pszParam)) { m_iTimeout = atoi(pszParam); } else { Fail("T switch should be followed by an integer timeout value."); } return; // Expecting the port number case 'P': if (m_iLoginportnumber > 0) // has it already been set? { Fail("Login port number parameter was specified more than once."); } else if (IsValidInteger(pszParam)) { m_iLoginportnumber = atoi(pszParam); if (m_iLoginportnumber < 1 || m_iLoginportnumber > 65535) Fail("P switch should be followed by a valid port value (1-65535)."); } else { Fail("P switch should be followed by a valid port value (1-65535)."); } return; // Check if need to show Bigmeter automatically case 'M': if (m_bShowBigmeter == TRUE) // has it already been set? { Fail("Show Bigmeter parameter was specified more than once."); } else { int i = atoi(pszParam); if (i == 1) m_bShowBigmeter = TRUE; } return; default: { char tmpary[2] = { last_switch, 0 }; Fail("Unrecognized switch: " + (CString) tmpary + "."); } return; } } if (bFlag) { m_bSwitches = TRUE; last_switch = toupper(pszParam[0]); ////////////////////////////////////////////////////////////////////// // This is an example of how to allow switches that have meaning on // their own, without any additional parameters. // // if ( last_switch == 'V' ) // spit out version number and exit // { // // Set BOOL member indicating that this switch was specified // // Make sure it's initialized in the constructor // m_bVersion = TRUE; // // last_switch = 0; // don't look for more parameters related to this switch // return; // don't allow it to reach the bLast checking // } ////////////////////////////////////////////////////////////////////// if (bLast) { Fail("An additional parameter was expected after the last switch."); return; } return; } // If switches haven't been used (so far)... if (!m_bSwitches) { switch (param_count) { // Expecting the config file. case 1: if (IsValidFilename(pszParam)) { if (VerifyReadable(pszParam)) m_sConfigFile = pszParam; else m_bFail = TRUE; } else { Fail("First parameter should be the name of a valid config file."); } return; // Expecting the result file. case 2: if (IsValidFilename(pszParam)) { if (VerifyWritable(pszParam)) m_sResultFile = pszParam; else m_bFail = TRUE; } else { Fail("Second parameter should be the name of the result file."); } return; // Expecting the timeout value. case 3: if (IsValidInteger(pszParam)) { m_iTimeout = atoi(pszParam); } else { Fail("Third parameter should be an integer timeout value."); } return; default: Fail("Too many parameters."); return; } } Fail("Didn't know what to do with this parameter:\n" + (CString) pszParam + "\nPlease report this as an Iometer bug."); }
void CFileDiffDlg::OnContextMenu(CWnd* pWnd, CPoint point) { if ((pWnd==0)||(pWnd != &m_cFileList)) return; if (m_cFileList.GetSelectedCount() == 0) return; // if the context menu is invoked through the keyboard, we have to use // a calculated position on where to anchor the menu on if ((point.x == -1) && (point.y == -1)) { CRect rect; m_cFileList.GetItemRect(m_cFileList.GetSelectionMark(), &rect, LVIR_LABEL); m_cFileList.ClientToScreen(&rect); point = rect.CenterPoint(); } CIconMenu popup; if (popup.CreatePopupMenu()) { CString menuText; popup.AppendMenuIcon(ID_COMPARE, IDS_LOG_POPUP_COMPARETWO, IDI_DIFF); popup.AppendMenuIcon(ID_GNUDIFFCOMPARE, IDS_LOG_POPUP_GNUDIFF, IDI_DIFF); popup.AppendMenu(MF_SEPARATOR, NULL); menuText.Format(IDS_FILEDIFF_POPREVERTTOREV, m_rev1.m_CommitHash.ToString().Left(g_Git.GetShortHASHLength())); popup.AppendMenuIcon(ID_REVERT1, menuText, IDI_REVERT); menuText.Format(IDS_FILEDIFF_POPREVERTTOREV, m_rev2.m_CommitHash.ToString().Left(g_Git.GetShortHASHLength())); popup.AppendMenuIcon(ID_REVERT2, menuText, IDI_REVERT); popup.AppendMenu(MF_SEPARATOR, NULL); popup.AppendMenuIcon(ID_LOG, IDS_FILEDIFF_LOG, IDI_LOG); popup.AppendMenuIcon(ID_BLAME, IDS_FILEDIFF_POPBLAME, IDI_BLAME); popup.AppendMenu(MF_SEPARATOR, NULL); popup.AppendMenuIcon(ID_EXPORT, IDS_FILEDIFF_POPEXPORT, IDI_EXPORT); popup.AppendMenu(MF_SEPARATOR, NULL); popup.AppendMenuIcon(ID_SAVEAS, IDS_FILEDIFF_POPSAVELIST, IDI_SAVEAS); popup.AppendMenuIcon(ID_CLIPBOARD_PATH, IDS_STATUSLIST_CONTEXT_COPY, IDI_COPYCLIP); popup.AppendMenuIcon(ID_CLIPBOARD_ALL, IDS_STATUSLIST_CONTEXT_COPYEXT, IDI_COPYCLIP); int cmd = popup.TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_NONOTIFY, point.x, point.y, this, 0); m_bCancelled = false; switch (cmd) { case ID_COMPARE: { POSITION pos = m_cFileList.GetFirstSelectedItemPosition(); while (pos) { int index = m_cFileList.GetNextSelectedItem(pos); DoDiff(index, false); } } break; case ID_GNUDIFFCOMPARE: { POSITION pos = m_cFileList.GetFirstSelectedItemPosition(); while (pos) { CTGitPath *fd2 = m_arFilteredList[m_cFileList.GetNextSelectedItem(pos)]; CTGitPath *fd1 = fd2; if (fd2->m_Action & CTGitPath::LOGACTIONS_REPLACED) fd1 = new CTGitPath(fd2->GetGitOldPathString()); CAppUtils::StartShowUnifiedDiff(m_hWnd, *fd2, m_rev2.m_CommitHash.ToString(), *fd1, m_rev1.m_CommitHash.ToString()); } } break; case ID_REVERT1: RevertSelectedItemToVersion(m_rev1.m_CommitHash.ToString()); break; case ID_REVERT2: RevertSelectedItemToVersion(m_rev2.m_CommitHash.ToString()); break; case ID_BLAME: { POSITION pos = m_cFileList.GetFirstSelectedItemPosition(); while (pos) { int index = m_cFileList.GetNextSelectedItem(pos); CAppUtils::LaunchTortoiseBlame(m_arFilteredList[index]->GetWinPathString(), m_rev1.m_CommitHash.ToString()); } } break; case ID_LOG: { POSITION pos = m_cFileList.GetFirstSelectedItemPosition(); while (pos) { int index = m_cFileList.GetNextSelectedItem(pos); CString cmd = _T("/command:log"); cmd += _T(" /path:\"")+m_arFilteredList[index]->GetWinPathString()+_T("\" "); cmd += _T(" /endrev:")+m_rev1.m_CommitHash.ToString(); CAppUtils::RunTortoiseGitProc(cmd); } } break; case ID_SAVEAS: { if (m_cFileList.GetSelectedCount() > 0) { CString temp; CTGitPath savePath; CString pathSave; if (!CAppUtils::FileOpenSave(pathSave, NULL, IDS_REPOBROWSE_SAVEAS, IDS_COMMONFILEFILTER, false, m_hWnd)) { break; } savePath = CTGitPath(pathSave); // now open the selected file for writing try { CStdioFile file(savePath.GetWinPathString(), CFile::typeBinary | CFile::modeReadWrite | CFile::modeCreate); // temp.Format(IDS_FILEDIFF_CHANGEDLISTINTRO, (LPCTSTR)m_path1.GetGitPathString(), (LPCTSTR)m_rev1.ToString(), (LPCTSTR)m_path2.GetGitPathString(), (LPCTSTR)m_rev2.ToString()); file.WriteString(temp + _T("\n")); POSITION pos = m_cFileList.GetFirstSelectedItemPosition(); while (pos) { int index = m_cFileList.GetNextSelectedItem(pos); CTGitPath* fd = m_arFilteredList[index]; file.WriteString(fd->GetGitPathString()); file.WriteString(_T("\n")); } file.Close(); } catch (CFileException* pE) { pE->ReportError(); } } } break; case ID_CLIPBOARD_PATH: { CopySelectionToClipboard(); } break; case ID_CLIPBOARD_ALL: { CopySelectionToClipboard(TRUE); } break; case ID_EXPORT: { // export all changed files to a folder CBrowseFolder browseFolder; browseFolder.m_style = BIF_EDITBOX | BIF_NEWDIALOGSTYLE | BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; if (browseFolder.Show(GetSafeHwnd(), m_strExportDir) == CBrowseFolder::OK) { POSITION pos = m_cFileList.GetFirstSelectedItemPosition(); while (pos) { int index = m_cFileList.GetNextSelectedItem(pos); CTGitPath* fd = m_arFilteredList[index]; // we cannot export directories or folders if (fd->m_Action == CTGitPath::LOGACTIONS_DELETED || fd->IsDirectory()) continue; CAppUtils::CreateMultipleDirectory(m_strExportDir + _T("\\") + fd->GetDirectory().GetWinPathString()); CString filename = m_strExportDir + _T("\\") + fd->GetWinPathString(); if(m_rev1.m_CommitHash.ToString() == GIT_REV_ZERO) { if(!CopyFile(g_Git.m_CurrentDir + _T("\\") + fd->GetWinPath(), filename, false)) { MessageBox(CFormatMessageWrapper(), _T("TortoiseGit"), MB_OK | MB_ICONERROR); return; } } else { if(g_Git.GetOneFile(m_rev1.m_CommitHash, *fd, filename)) { CString out; out.Format(IDS_STATUSLIST_CHECKOUTFILEFAILED, fd->GetGitPathString(), m_rev1.m_CommitHash.ToString(), filename); if (CMessageBox::Show(NULL, out, _T("TortoiseGit"), 2, IDI_WARNING, CString(MAKEINTRESOURCE(IDS_IGNOREBUTTON)), CString(MAKEINTRESOURCE(IDS_ABORTBUTTON))) == 2) return; } } } } } break; } } }
void ArticleWriter::CompleteFileParts() { debug("Completing file parts"); debug("ArticleFilename: %s", m_fileInfo->GetFilename()); bool directWrite = (g_Options->GetDirectWrite() || m_fileInfo->GetForceDirectWrite()) && m_fileInfo->GetOutputInitialized(); BString<1024> nzbName; BString<1024> nzbDestDir; BString<1024> filename; { GuardedDownloadQueue guard = DownloadQueue::Guard(); nzbName = m_fileInfo->GetNzbInfo()->GetName(); nzbDestDir = m_fileInfo->GetNzbInfo()->GetDestDir(); filename = m_fileInfo->GetFilename(); } BString<1024> infoFilename("%s%c%s", *nzbName, PATH_SEPARATOR, *filename); bool cached = m_fileInfo->GetCachedArticles() > 0; if (g_Options->GetRawArticle()) { detail("Moving articles for %s", *infoFilename); } else if (directWrite && cached) { detail("Writing articles for %s", *infoFilename); } else if (directWrite) { detail("Checking articles for %s", *infoFilename); } else { detail("Joining articles for %s", *infoFilename); } // Ensure the DstDir is created CString errmsg; if (!FileSystem::ForceDirectories(nzbDestDir, errmsg)) { m_fileInfo->GetNzbInfo()->PrintMessage(Message::mkError, "Could not create directory %s: %s", *nzbDestDir, *errmsg); return; } CString ofn; if (m_fileInfo->GetForceDirectWrite()) { ofn.Format("%s%c%s", *nzbDestDir, PATH_SEPARATOR, *filename); } else { ofn = FileSystem::MakeUniqueFilename(nzbDestDir, *filename); } DiskFile outfile; BString<1024> tmpdestfile("%s.tmp", *ofn); if (!g_Options->GetRawArticle() && !directWrite) { FileSystem::DeleteFile(tmpdestfile); if (!outfile.Open(tmpdestfile, DiskFile::omWrite)) { m_fileInfo->GetNzbInfo()->PrintMessage(Message::mkError, "Could not create file %s: %s", *tmpdestfile, *FileSystem::GetLastErrorMessage()); return; } } else if (directWrite && cached) { if (!outfile.Open(m_outputFilename, DiskFile::omReadWrite)) { m_fileInfo->GetNzbInfo()->PrintMessage(Message::mkError, "Could not open file %s: %s", *m_outputFilename, *FileSystem::GetLastErrorMessage()); return; } tmpdestfile = *m_outputFilename; } else if (g_Options->GetRawArticle()) { FileSystem::DeleteFile(tmpdestfile); if (!FileSystem::CreateDirectory(ofn)) { m_fileInfo->GetNzbInfo()->PrintMessage(Message::mkError, "Could not create directory %s: %s", *ofn, *FileSystem::GetLastErrorMessage()); return; } } if (outfile.Active()) { SetWriteBuffer(outfile, 0); } uint32 crc = 0; { std::unique_ptr<ArticleCache::FlushGuard> flushGuard; if (cached) { flushGuard = std::make_unique<ArticleCache::FlushGuard>(g_ArticleCache->GuardFlush()); } CharBuffer buffer; bool firstArticle = true; if (!g_Options->GetRawArticle() && !directWrite) { buffer.Reserve(1024 * 64); } for (ArticleInfo* pa : m_fileInfo->GetArticles()) { if (pa->GetStatus() != ArticleInfo::aiFinished) { continue; } if (!g_Options->GetRawArticle() && !directWrite && pa->GetSegmentOffset() > -1 && pa->GetSegmentOffset() > outfile.Position() && outfile.Position() > -1) { memset(buffer, 0, buffer.Size()); if (!g_Options->GetSkipWrite()) { while (pa->GetSegmentOffset() > outfile.Position() && outfile.Position() > -1 && outfile.Write(buffer, std::min((int)(pa->GetSegmentOffset() - outfile.Position()), buffer.Size()))); } } if (pa->GetSegmentContent()) { if (!g_Options->GetSkipWrite()) { outfile.Seek(pa->GetSegmentOffset()); outfile.Write(pa->GetSegmentContent(), pa->GetSegmentSize()); } pa->DiscardSegment(); } else if (!g_Options->GetRawArticle() && !directWrite && !g_Options->GetSkipWrite()) { DiskFile infile; if (pa->GetResultFilename() && infile.Open(pa->GetResultFilename(), DiskFile::omRead)) { int cnt = buffer.Size(); while (cnt == buffer.Size()) { cnt = (int)infile.Read(buffer, buffer.Size()); outfile.Write(buffer, cnt); } infile.Close(); } else { m_fileInfo->SetFailedArticles(m_fileInfo->GetFailedArticles() + 1); m_fileInfo->SetSuccessArticles(m_fileInfo->GetSuccessArticles() - 1); m_fileInfo->GetNzbInfo()->PrintMessage(Message::mkError, "Could not find file %s for %s [%i/%i]", pa->GetResultFilename(), *infoFilename, pa->GetPartNumber(), (int)m_fileInfo->GetArticles()->size()); } } else if (g_Options->GetRawArticle()) { BString<1024> dstFileName("%s%c%03i", *ofn, PATH_SEPARATOR, pa->GetPartNumber()); if (!FileSystem::MoveFile(pa->GetResultFilename(), dstFileName)) { m_fileInfo->GetNzbInfo()->PrintMessage(Message::mkError, "Could not move file %s to %s: %s", pa->GetResultFilename(), *dstFileName, *FileSystem::GetLastErrorMessage()); } } if (m_format == Decoder::efYenc) { crc = firstArticle ? pa->GetCrc() : Crc32::Combine(crc, pa->GetCrc(), pa->GetSegmentSize()); firstArticle = false; } } buffer.Clear(); } if (outfile.Active()) { outfile.Close(); if (!directWrite && !FileSystem::MoveFile(tmpdestfile, ofn)) { m_fileInfo->GetNzbInfo()->PrintMessage(Message::mkError, "Could not move file %s to %s: %s", *tmpdestfile, *ofn, *FileSystem::GetLastErrorMessage()); } } if (directWrite) { if (!FileSystem::SameFilename(m_outputFilename, ofn) && !FileSystem::MoveFile(m_outputFilename, ofn)) { m_fileInfo->GetNzbInfo()->PrintMessage(Message::mkError, "Could not move file %s to %s: %s", *m_outputFilename, *ofn, *FileSystem::GetLastErrorMessage()); } // if destination directory was changed delete the old directory (if empty) int len = strlen(nzbDestDir); if (!(!strncmp(nzbDestDir, m_outputFilename, len) && (m_outputFilename[len] == PATH_SEPARATOR || m_outputFilename[len] == ALT_PATH_SEPARATOR))) { debug("Checking old dir for: %s", *m_outputFilename); BString<1024> oldDestDir; oldDestDir.Set(m_outputFilename, (int)(FileSystem::BaseFileName(m_outputFilename) - m_outputFilename)); if (FileSystem::DirEmpty(oldDestDir)) { debug("Deleting old dir: %s", *oldDestDir); FileSystem::RemoveDirectory(oldDestDir); } } } if (!directWrite) { for (ArticleInfo* pa : m_fileInfo->GetArticles()) { if (pa->GetResultFilename()) { FileSystem::DeleteFile(pa->GetResultFilename()); } } } if (m_fileInfo->GetTotalArticles() == m_fileInfo->GetSuccessArticles()) { m_fileInfo->GetNzbInfo()->PrintMessage(Message::mkInfo, "Successfully downloaded %s", *infoFilename); } else if (m_fileInfo->GetMissedArticles() + m_fileInfo->GetFailedArticles() > 0) { m_fileInfo->GetNzbInfo()->PrintMessage(Message::mkWarning, "%i of %i article downloads failed for \"%s\"", m_fileInfo->GetMissedArticles() + m_fileInfo->GetFailedArticles(), m_fileInfo->GetTotalArticles(), *infoFilename); } else { m_fileInfo->GetNzbInfo()->PrintMessage(Message::mkInfo, "Partially downloaded %s", *infoFilename); } { GuardedDownloadQueue guard = DownloadQueue::Guard(); m_fileInfo->SetCrc(crc); m_fileInfo->SetOutputFilename(ofn); if (strcmp(m_fileInfo->GetFilename(), filename)) { // file was renamed during completion, need to move the file ofn = FileSystem::MakeUniqueFilename(nzbDestDir, m_fileInfo->GetFilename()); if (!FileSystem::MoveFile(m_fileInfo->GetOutputFilename(), ofn)) { m_fileInfo->GetNzbInfo()->PrintMessage(Message::mkError, "Could not rename file %s to %s: %s", m_fileInfo->GetOutputFilename(), *ofn, *FileSystem::GetLastErrorMessage()); } m_fileInfo->SetOutputFilename(ofn); } if (strcmp(m_fileInfo->GetNzbInfo()->GetDestDir(), nzbDestDir)) { // destination directory was changed during completion, need to move the file MoveCompletedFiles(m_fileInfo->GetNzbInfo(), nzbDestDir); } } }
UINT CAutomaticTrafficControl::GetBlkPosWay(TYP_FZDAT *pAGVData, int nDistIndex, bool bNCp) { UINT nBlkPosWay = 0; if(bNCp) { if(nDistIndex) { // BlkPosWay of next pdistance nBlkPosWay = (pAGVData->nmp == pAGVData->fzziel.nDest) ? GetPosWay(pAGVData->fzziel) : GetBlockWay(nDistIndex); } } else { // BlkPosWay of top distance if(IsAGVOnStation(pAGVData)) { /* PosWeg */ TYPE_STATION_DEF tZiel; if(pAGVData->fzziel.nDest != pAGVData->mp) { tZiel.nDest = pAGVData->mp; tZiel.nPos = pAGVData->mppos; tZiel.nLayer = 1; if(pAGVData->mplage) { tZiel.ucSide = pAGVData->mplage; nBlkPosWay = GetPosWay(tZiel); if(GetPosWay(tZiel) == 0) { tZiel.ucSide = (tZiel.ucSide == 'L') ? 'R' : 'L'; } } else { GetAnyStation(tZiel); } } else { tZiel = pAGVData->fzziel; tZiel.nPos = tZiel.nPos & 0x0F; tZiel.nLayer = tZiel.nLayer & 0x0F; } nBlkPosWay = GetPosWay(tZiel); if(nBlkPosWay == 0) { nBlkPosWay = GetPosWay(tZiel); // Syslog-Meldung: Kein Posweg gefunden! CString strMsg; strMsg.Format("PosWay not found Destination %d, Position %d",(int)tZiel.nDest,(int)tZiel.nPos); //SyslogKeinPosWeg(pFzDat, &tZiel); MSGERROR2 ("Next point not found for decision point. Destination: %d, Position: %d",(int)tZiel.nDest,(int)tZiel.nPos ); // TODO Michael 01.06.2011 AfxMessageBox (strMsg,MB_ICONQUESTION); } } else { nBlkPosWay = GetBlockWay(nDistIndex); } } return nBlkPosWay; }
BOOL CCopyDlg::OnInitDialog() { CResizableStandAloneDialog::OnInitDialog(); CAppUtils::MarkWindowAsUnpinnable(m_hWnd); ExtendFrameIntoClientArea(IDC_EXTGROUP); m_aeroControls.SubclassControl(this, IDC_DOSWITCH); m_aeroControls.SubclassControl(this, IDC_MAKEPARENTS); m_aeroControls.SubclassOkCancelHelp(this); m_bCancelled = false; DWORD exStyle = LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_CHECKBOXES; m_ExtList.SetExtendedStyle(exStyle); SetWindowTheme(m_ExtList.GetSafeHwnd(), L"Explorer", NULL); m_ExtList.ShowText(CString(MAKEINTRESOURCE(IDS_COPY_WAITFOREXTERNALS))); AdjustControlSize(IDC_COPYHEAD); AdjustControlSize(IDC_COPYREV); AdjustControlSize(IDC_COPYWC); AdjustControlSize(IDC_DOSWITCH); AdjustControlSize(IDC_MAKEPARENTS); CTSVNPath path(m_path); CString sWindowTitle; GetWindowText(sWindowTitle); CAppUtils::SetWindowTitle(m_hWnd, path.GetUIPathString(), sWindowTitle); m_History.SetMaxHistoryItems((LONG)CRegDWORD(L"Software\\TortoiseSVN\\MaxHistoryItems", 25)); SetRevision(m_CopyRev); m_tooltips.AddTool(IDC_HISTORY, IDS_COMMITDLG_HISTORY_TT); if (SVN::PathIsURL(path)) { DialogEnableWindow(IDC_COPYWC, FALSE); DialogEnableWindow(IDC_DOSWITCH, FALSE); SetDlgItemText(IDC_COPYSTARTLABEL, CString(MAKEINTRESOURCE(IDS_COPYDLG_FROMURL))); } SVN svn; CString sUUID; m_repoRoot = svn.GetRepositoryRootAndUUID(path, true, sUUID); m_repoRoot.TrimRight('/'); m_wcURL = svn.GetURLFromPath(path); if (m_wcURL.IsEmpty() || (!path.IsUrl() && !path.Exists())) { CString Wrong_URL=path.GetSVNPathString(); CString temp; temp.Format(IDS_ERR_NOURLOFFILE, (LPCTSTR)Wrong_URL); ::MessageBox(this->m_hWnd, temp, L"TortoiseSVN", MB_ICONERROR); this->EndDialog(IDCANCEL); //exit } m_URLCombo.LoadHistory(L"Software\\TortoiseSVN\\History\\repoPaths\\"+sUUID, L"url"); m_URLCombo.SetCurSel(0); CString relPath = m_wcURL.Mid(m_repoRoot.GetLength()); if (!m_URL.IsEmpty()) { // allow the use of urls relative to the repo root if (m_URL[0] != '^') relPath = m_URL.Mid(m_repoRoot.GetLength()); else relPath = m_URL.Mid(1); } CTSVNPath r = CTSVNPath(relPath); relPath = r.GetUIPathString(); relPath.Replace('\\', '/'); m_URLCombo.AddString(relPath, 0); m_URLCombo.SelectString(-1, relPath); m_URL = m_wcURL; SetDlgItemText(IDC_DESTURL, CPathUtils::CombineUrls(m_repoRoot, relPath)); SetDlgItemText(IDC_FROMURL, m_wcURL); CString reg; reg.Format(L"Software\\TortoiseSVN\\History\\commit%s", (LPCTSTR)sUUID); m_History.Load(reg, L"logmsgs"); m_ProjectProperties.ReadProps(m_path); if (CRegDWORD(L"Software\\TortoiseSVN\\AlwaysWarnIfNoIssue", FALSE)) m_ProjectProperties.bWarnIfNoIssue = TRUE; m_cLogMessage.Init(m_ProjectProperties); m_cLogMessage.SetFont((CString)CRegString(L"Software\\TortoiseSVN\\LogFontName", L"Courier New"), (DWORD)CRegDWORD(L"Software\\TortoiseSVN\\LogFontSize", 8)); GetDlgItem(IDC_BUGTRAQBUTTON)->ShowWindow(SW_HIDE); GetDlgItem(IDC_BUGTRAQBUTTON)->EnableWindow(FALSE); CBugTraqAssociations bugtraq_associations; bugtraq_associations.Load(m_ProjectProperties.GetProviderUUID(), m_ProjectProperties.sProviderParams); if (bugtraq_associations.FindProvider(CTSVNPathList(m_path), &m_bugtraq_association)) { CComPtr<IBugTraqProvider> pProvider; HRESULT hr = pProvider.CoCreateInstance(m_bugtraq_association.GetProviderClass()); if (SUCCEEDED(hr)) { m_BugTraqProvider = pProvider; ATL::CComBSTR temp; ATL::CComBSTR parameters; parameters.Attach(m_bugtraq_association.GetParameters().AllocSysString()); hr = pProvider->GetLinkText(GetSafeHwnd(), parameters, &temp); if (SUCCEEDED(hr)) { SetDlgItemText(IDC_BUGTRAQBUTTON, temp == 0 ? L"" : temp); GetDlgItem(IDC_BUGTRAQBUTTON)->EnableWindow(TRUE); GetDlgItem(IDC_BUGTRAQBUTTON)->ShowWindow(SW_SHOW); } } GetDlgItem(IDC_LOGMESSAGE)->SetFocus(); } if (m_ProjectProperties.sMessage.IsEmpty()) { GetDlgItem(IDC_BUGID)->ShowWindow(SW_HIDE); GetDlgItem(IDC_BUGIDLABEL)->ShowWindow(SW_HIDE); GetDlgItem(IDC_LOGMESSAGE)->SetFocus(); } else { GetDlgItem(IDC_BUGID)->ShowWindow(SW_SHOW); GetDlgItem(IDC_BUGIDLABEL)->ShowWindow(SW_SHOW); if (!m_ProjectProperties.sLabel.IsEmpty()) SetDlgItemText(IDC_BUGIDLABEL, m_ProjectProperties.sLabel); GetDlgItem(IDC_BUGID)->SetFocus(); } if (!m_sLogMessage.IsEmpty()) m_cLogMessage.SetText(m_sLogMessage); else m_cLogMessage.SetText(m_ProjectProperties.GetLogMsgTemplate(PROJECTPROPNAME_LOGTEMPLATEBRANCH)); OnEnChangeLogmessage(); m_linkControl.ConvertStaticToLink(m_hWnd, IDC_CHECKALL); m_linkControl.ConvertStaticToLink(m_hWnd, IDC_CHECKNONE); // line up all controls and adjust their sizes. #define LINKSPACING 9 RECT rc = AdjustControlSize(IDC_SELECTLABEL); rc.right -= 15; // AdjustControlSize() adds 20 pixels for the checkbox/radio button bitmap, but this is a label... rc = AdjustStaticSize(IDC_CHECKALL, rc, LINKSPACING); rc = AdjustStaticSize(IDC_CHECKNONE, rc, LINKSPACING); CAppUtils::SetAccProperty(m_cLogMessage.GetSafeHwnd(), PROPID_ACC_ROLE, ROLE_SYSTEM_TEXT); CAppUtils::SetAccProperty(m_cLogMessage.GetSafeHwnd(), PROPID_ACC_HELP, CString(MAKEINTRESOURCE(IDS_INPUT_ENTERLOG))); CAppUtils::SetAccProperty(m_cLogMessage.GetSafeHwnd(), PROPID_ACC_KEYBOARDSHORTCUT, L"Alt+"+CString(CAppUtils::FindAcceleratorKey(this, IDC_INVISIBLE))); CAppUtils::SetAccProperty(GetDlgItem(IDC_CHECKALL)->GetSafeHwnd(), PROPID_ACC_ROLE, ROLE_SYSTEM_LINK); CAppUtils::SetAccProperty(GetDlgItem(IDC_CHECKNONE)->GetSafeHwnd(), PROPID_ACC_ROLE, ROLE_SYSTEM_LINK); CAppUtils::SetAccProperty(m_URLCombo.GetSafeHwnd(), PROPID_ACC_KEYBOARDSHORTCUT, L"Alt+"+CString(CAppUtils::FindAcceleratorKey(this, IDC_TOURLLABEL))); CAppUtils::SetAccProperty(GetDlgItem(IDC_FROMURL)->GetSafeHwnd(), PROPID_ACC_KEYBOARDSHORTCUT, L"Alt+"+CString(CAppUtils::FindAcceleratorKey(this, IDC_COPYSTARTLABEL))); CAppUtils::SetAccProperty(GetDlgItem(IDC_DESTURL)->GetSafeHwnd(), PROPID_ACC_KEYBOARDSHORTCUT, L"Alt+"+CString(CAppUtils::FindAcceleratorKey(this, IDC_DESTLABEL))); AddAnchor(IDC_REPOGROUP, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_COPYSTARTLABEL, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_FROMURL, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_TOURLLABEL, TOP_LEFT); AddAnchor(IDC_URLCOMBO, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_BROWSE, TOP_RIGHT); AddAnchor(IDC_DESTLABEL, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_DESTURL, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_MSGGROUP, TOP_LEFT, MIDDLE_RIGHT); AddAnchor(IDC_HISTORY, TOP_LEFT); AddAnchor(IDC_BUGTRAQBUTTON, TOP_LEFT); AddAnchor(IDC_BUGIDLABEL, TOP_RIGHT); AddAnchor(IDC_BUGID, TOP_RIGHT); AddAnchor(IDC_INVISIBLE, TOP_RIGHT); AddAnchor(IDC_LOGMESSAGE, TOP_LEFT, MIDDLE_RIGHT); AddAnchor(IDC_FROMGROUP, MIDDLE_LEFT, MIDDLE_RIGHT); AddAnchor(IDC_COPYHEAD, MIDDLE_LEFT); AddAnchor(IDC_COPYREV, MIDDLE_LEFT); AddAnchor(IDC_COPYREVTEXT, MIDDLE_RIGHT); AddAnchor(IDC_BROWSEFROM, MIDDLE_RIGHT); AddAnchor(IDC_COPYWC, MIDDLE_LEFT); AddAnchor(IDC_EXTGROUP, MIDDLE_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_SELECTLABEL, MIDDLE_LEFT); AddAnchor(IDC_CHECKALL, MIDDLE_LEFT); AddAnchor(IDC_CHECKNONE, MIDDLE_LEFT); AddAnchor(IDC_EXTERNALSLIST, MIDDLE_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_DOSWITCH, BOTTOM_LEFT); AddAnchor(IDC_MAKEPARENTS, BOTTOM_LEFT); AddAnchor(IDOK, BOTTOM_RIGHT); AddAnchor(IDCANCEL, BOTTOM_RIGHT); AddAnchor(IDHELP, BOTTOM_RIGHT); if ((m_pParentWnd==NULL)&&(GetExplorerHWND())) CenterWindow(CWnd::FromHandle(GetExplorerHWND())); EnableSaveRestore(L"CopyDlg"); m_bSettingChanged = false; if (!m_path.IsUrl()) { // start a thread to obtain the highest revision number of the working copy // without blocking the dialog if ((m_pThread = AfxBeginThread(FindRevThreadEntry, this))==NULL) { OnCantStartThread(); } } return TRUE; }
//画面描画 void TimelineEditorView::DrawTimelineEditorView(const CDC& dcDC) { CRect rcRect; GetClientRect(&rcRect); int iHeight = rcRect.Height(); CString strPoint; // プレビューエリア枠線描画 m_pDebugInfoPanelRect->DrawMyBorderRect(3.0f); // タイムラインヘッダーコントロールパネル描画 DrawTimelineControlPanel(); // シークバーエリア描画 DrawSeekBar(dcDC, iHeight); // 静止クリップ描画 DrawClip(dcDC, iHeight); // 操作イメージ描画 if ((m_pTimelineDataOperator->IsSingleInTrim() || m_pTimelineDataOperator->IsSingleOutTrim() || m_pTimelineDataOperator->IsMove()) && (!(m_pOperatingClipData->GetOperatingRect()->IsRectEmpty()))) { DrawOperatingClip(dcDC, iHeight); } if (m_pTimelineDataOperator->IsDragAndDrop()) { DrawDragAndDropClip(dcDC, iHeight); } // トラックヘッダー描画 DrawTrackHeader(); // タイムラインデータエリア描画 DrawTimelineDataRect(); // トラック枠描画 DrawTrack(dcDC, iHeight); // タイムラインカーソル/シャトル操作補助線描画 DrawTimelineCursor(dcDC, iHeight); #ifdef _DEBUG CString strFrameNumber; double dPointX, dPointY; HFONT hfDrawFont; CreateDrawFont(13, 0, DEFAULT_FONTFACE, hfDrawFont); strFrameNumber.Format(_T("TLCursor %d"), m_pTimelineDataOperator->GetTimelineCursorFramePosition()); ChangeScreenPointToOpenGLPoint(5, 15, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strFrameNumber), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strFrameNumber.Format(_T("Frame Left %d Right %d"), m_pTimelineDataOperator->GetLeftFrameNumber(), m_pTimelineDataOperator->GetRightFrameNumber()); ChangeScreenPointToOpenGLPoint(5, 30, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strFrameNumber), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strFrameNumber.Format(_T("Operating TLCursor %d"), m_pTimelineDataOperator->GetOperatingTimelineCursorFramePosition()); ChangeScreenPointToOpenGLPoint(5, 45, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strFrameNumber), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strFrameNumber.Format(_T("Operating Left %d Right %d"), m_pTimelineDataOperator->GetOperatingLeftFrameNumber(), m_pTimelineDataOperator->GetOperatingRightFrameNumber()); ChangeScreenPointToOpenGLPoint(5, 60, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strFrameNumber), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strFrameNumber.Format(_T("CursorLine Point %d"), m_iTimelineCursorPoint); ChangeScreenPointToOpenGLPoint(5, 75, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strFrameNumber), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strFrameNumber.Format(_T("f/p %d p/f %d"), m_pTimelineDataOperator->GetFramePerPoint(), m_pTimelineDataOperator->GetPointPerFrame()); ChangeScreenPointToOpenGLPoint(5, 90, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strFrameNumber), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); DeleteObject(hfDrawFont); #endif }
void CCopyDlg::OnOK() { if (::IsWindow(m_pLogDlg->GetSafeHwnd())&&(m_pLogDlg->IsWindowVisible())) { m_pLogDlg->SendMessage(WM_CLOSE); return; } m_bCancelled = true; // check if the status thread has already finished if ((m_pThread)&&(m_bThreadRunning)) { WaitForSingleObject(m_pThread->m_hThread, 1000); if (m_bThreadRunning) { // we gave the thread a chance to quit. Since the thread didn't // listen to us we have to kill it. TerminateThread(m_pThread->m_hThread, (DWORD)-1); InterlockedExchange(&m_bThreadRunning, FALSE); } } CString id; GetDlgItemText(IDC_BUGID, id); CString sRevText; GetDlgItemText(IDC_COPYREVTEXT, sRevText); if (!m_ProjectProperties.CheckBugID(id)) { ShowEditBalloon(IDC_BUGID, IDS_COMMITDLG_ONLYNUMBERS, IDS_ERR_ERROR, TTI_ERROR); return; } m_sLogMessage = m_cLogMessage.GetText(); if ((m_ProjectProperties.bWarnIfNoIssue) && (id.IsEmpty() && !m_ProjectProperties.HasBugID(m_sLogMessage))) { CTaskDialog taskdlg(CString(MAKEINTRESOURCE(IDS_COMMITDLG_WARNNOISSUE_TASK1)), CString(MAKEINTRESOURCE(IDS_COMMITDLG_WARNNOISSUE_TASK2)), L"TortoiseSVN", 0, TDF_USE_COMMAND_LINKS | TDF_ALLOW_DIALOG_CANCELLATION | TDF_POSITION_RELATIVE_TO_WINDOW | TDF_SIZE_TO_CONTENT); taskdlg.AddCommandControl(1, CString(MAKEINTRESOURCE(IDS_COMMITDLG_WARNNOISSUE_TASK3))); taskdlg.AddCommandControl(2, CString(MAKEINTRESOURCE(IDS_COMMITDLG_WARNNOISSUE_TASK4))); taskdlg.SetCommonButtons(TDCBF_CANCEL_BUTTON); taskdlg.SetDefaultCommandControl(2); taskdlg.SetMainIcon(TD_WARNING_ICON); if (taskdlg.DoModal(m_hWnd) != 1) return; } UpdateData(TRUE); if (GetCheckedRadioButton(IDC_COPYHEAD, IDC_COPYREV) == IDC_COPYHEAD) m_CopyRev = SVNRev(SVNRev::REV_HEAD); else if (GetCheckedRadioButton(IDC_COPYHEAD, IDC_COPYREV) == IDC_COPYWC) m_CopyRev = SVNRev(SVNRev::REV_WC); else m_CopyRev = SVNRev(sRevText); if (!m_CopyRev.IsValid()) { ShowEditBalloon(IDC_COPYREVTEXT, IDS_ERR_INVALIDREV, IDS_ERR_ERROR, TTI_ERROR); return; } CString combourl = m_URLCombo.GetWindowString(); if (combourl.IsEmpty()) combourl = m_URLCombo.GetString(); if ((m_wcURL.CompareNoCase(combourl)==0)&&(m_CopyRev.IsHead())) { CString temp; temp.FormatMessage(IDS_ERR_COPYITSELF, (LPCTSTR)m_wcURL, (LPCTSTR)m_URLCombo.GetString()); ::MessageBox(this->m_hWnd, temp, L"TortoiseSVN", MB_ICONERROR); return; } m_URLCombo.SaveHistory(); m_URL = CPathUtils::CombineUrls(m_repoRoot, m_URLCombo.GetString()); if (!CTSVNPath(m_URL).IsValidOnWindows()) { CString sInfo; sInfo.Format(IDS_WARN_NOVALIDPATH_TASK1, (LPCTSTR)m_URL); CTaskDialog taskdlg(sInfo, CString(MAKEINTRESOURCE(IDS_WARN_NOVALIDPATH_TASK2)), L"TortoiseSVN", 0, TDF_ENABLE_HYPERLINKS | TDF_USE_COMMAND_LINKS | TDF_ALLOW_DIALOG_CANCELLATION | TDF_POSITION_RELATIVE_TO_WINDOW | TDF_SIZE_TO_CONTENT); taskdlg.AddCommandControl(1, CString(MAKEINTRESOURCE(IDS_WARN_NOVALIDPATH_TASK3))); taskdlg.AddCommandControl(2, CString(MAKEINTRESOURCE(IDS_WARN_NOVALIDPATH_TASK4))); taskdlg.SetCommonButtons(TDCBF_CANCEL_BUTTON); taskdlg.SetExpansionArea(CString(MAKEINTRESOURCE(IDS_WARN_NOVALIDPATH_TASK5))); taskdlg.SetDefaultCommandControl(2); taskdlg.SetMainIcon(TD_WARNING_ICON); if (taskdlg.DoModal(m_hWnd) != 1) return; } CStringUtils::WriteAsciiStringToClipboard(m_URL); // now let the bugtraq plugin check the commit message CComPtr<IBugTraqProvider2> pProvider2 = NULL; if (m_BugTraqProvider) { HRESULT hr = m_BugTraqProvider.QueryInterface(&pProvider2); if (SUCCEEDED(hr)) { ATL::CComBSTR temp; ATL::CComBSTR sourceURL; sourceURL.Attach(m_wcURL.AllocSysString()); ATL::CComBSTR parameters; parameters.Attach(m_bugtraq_association.GetParameters().AllocSysString()); ATL::CComBSTR targetURL; targetURL.Attach(m_URL.AllocSysString()); ATL::CComBSTR commitMessage; commitMessage.Attach(m_sLogMessage.AllocSysString()); CBstrSafeVector pathList(1); pathList.PutElement(0, m_path.GetSVNPathString()); hr = pProvider2->CheckCommit(GetSafeHwnd(), parameters, sourceURL, targetURL, pathList, commitMessage, &temp); if (FAILED(hr)) { OnComError(hr); } else { CString sError = temp == 0 ? L"" : temp; if (!sError.IsEmpty()) { CAppUtils::ReportFailedHook(m_hWnd, sError); return; } } } } CTSVNPathList checkedItems; checkedItems.AddPath(m_path); DWORD exitcode = 0; CString error; CHooks::Instance().SetProjectProperties(m_path, m_ProjectProperties); if (CHooks::Instance().CheckCommit(m_hWnd, checkedItems, m_sLogMessage, exitcode, error)) { if (exitcode) { CString sErrorMsg; sErrorMsg.Format(IDS_HOOK_ERRORMSG, (LPCWSTR)error); CTaskDialog taskdlg(sErrorMsg, CString(MAKEINTRESOURCE(IDS_HOOKFAILED_TASK2)), L"TortoiseSVN", 0, TDF_ENABLE_HYPERLINKS | TDF_USE_COMMAND_LINKS | TDF_ALLOW_DIALOG_CANCELLATION | TDF_POSITION_RELATIVE_TO_WINDOW | TDF_SIZE_TO_CONTENT); taskdlg.AddCommandControl(1, CString(MAKEINTRESOURCE(IDS_HOOKFAILED_TASK3))); taskdlg.AddCommandControl(2, CString(MAKEINTRESOURCE(IDS_HOOKFAILED_TASK4))); taskdlg.SetDefaultCommandControl(1); taskdlg.SetMainIcon(TD_ERROR_ICON); bool retry = (taskdlg.DoModal(GetSafeHwnd()) == 1); if (retry) return; } } if (!m_sLogMessage.IsEmpty()) { m_History.AddEntry(m_sLogMessage); m_History.Save(); } m_sBugID.Trim(); if (!m_sBugID.IsEmpty()) { m_sBugID.Replace(L", ", L","); m_sBugID.Replace(L" ,", L","); CString sBugID = m_ProjectProperties.sMessage; sBugID.Replace(L"%BUGID%", m_sBugID); if (m_ProjectProperties.bAppend) m_sLogMessage += L"\n" + sBugID + L"\n"; else m_sLogMessage = sBugID + L"\n" + m_sLogMessage; UpdateData(FALSE); } CResizableStandAloneDialog::OnOK(); }
// 操作中クリップの描画を行う BOOL TimelineEditorView::DrawOperatingClip(const CDC& dcDC, const int& iHeight) { // TODO: 元のクリップの色を変える 元々各タイミングで実施するよう変更 m_pOperatingClipData->DrawOperatingOldRect(iHeight); CRect* rcOperatingRect = m_pOperatingClipData->GetOperatingRect(); if (m_pTimelineDataOperator->IsSingleInTrim() || m_pTimelineDataOperator->IsSingleOutTrim()) { m_pOperatingClipData->DrawSingleTrimRect(iHeight, m_pTimelineDataOperator->IsSingleInTrim()); #ifdef _DEBUG //TODO: デバッグ CString strText; double dPointX, dPointY; int iPoint; int iDuration; if (m_pTimelineDataOperator->IsSingleInTrim()) { iPoint = m_pOperatingClipData->GetTimelineInPoint() + m_pTimelineDataOperator->GetOperatingClipFrameCount(); } else { iPoint = m_pOperatingClipData->GetTimelineInPoint(); } HFONT hfDrawFont; CreateDrawFont(13, 0, DEFAULT_FONTFACE, hfDrawFont); strText.Format(_T("TrimingClipInPoint %d"), iPoint); ChangeScreenPointToOpenGLPoint(700, 15, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strText.Format(_T("TrimingClipLeftPoint %d"), rcOperatingRect->left); ChangeScreenPointToOpenGLPoint(700, 30, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); if (m_pTimelineDataOperator->IsSingleInTrim()) { iPoint = m_pOperatingClipData->GetTimelineOutPoint(); iDuration = m_pOperatingClipData->GetDuration() - m_pTimelineDataOperator->GetOperatingClipFrameCount(); } else { iPoint = m_pOperatingClipData->GetTimelineOutPoint() + m_pTimelineDataOperator->GetOperatingClipFrameCount(); iDuration = m_pOperatingClipData->GetDuration() + m_pTimelineDataOperator->GetOperatingClipFrameCount(); } strText.Format(_T("TrimingClipOutPoint %d"), iPoint); ChangeScreenPointToOpenGLPoint(700, 45, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strText.Format(_T("TrimingClipRightPoint %d"), rcOperatingRect->right); ChangeScreenPointToOpenGLPoint(700, 60, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strText.Format(_T("TrimingClipDuration %d"), iDuration); ChangeScreenPointToOpenGLPoint(700, 75, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); DeleteObject(hfDrawFont); #endif } else { // ドロップ位置用 m_pOperatingClipData->DrawMovingRect(iHeight); #ifdef _DEBUG //TODO: デバッグ CString strText; double dPointX, dPointY; HFONT hfDrawFont; CreateDrawFont(13, 0, DEFAULT_FONTFACE, hfDrawFont); strText.Format(_T("MovingClipInPoint %d"), m_pOperatingClipData->GetTimelineInPoint() + m_pTimelineDataOperator->GetOperatingClipFrameCount()); ChangeScreenPointToOpenGLPoint(700, 15, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strText.Format(_T("MovingClipLeftPoint %d"), rcOperatingRect->left); ChangeScreenPointToOpenGLPoint(700, 30, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strText.Format(_T("MovingClipRightPoint %d"), rcOperatingRect->right); ChangeScreenPointToOpenGLPoint(700, 45, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); #endif // マウス位置追随用 CRect rcMousePointRect = m_pTimelineDataOperator->GetMousePointRect(); if (!(rcMousePointRect.EqualRect(rcOperatingRect))) { m_pOperatingClipData->SetOverlappingVert(static_cast<float>(rcMousePointRect.left), static_cast<float>(iHeight - rcMousePointRect.top), static_cast<float>(rcMousePointRect.right), static_cast<float>(iHeight - rcMousePointRect.bottom)); m_pOperatingClipData->DrawOverlappingRect(iHeight); #ifdef _DEBUG strText.Format(_T("MouseMoveClipLeftPoint %d"), rcMousePointRect.left); ChangeScreenPointToOpenGLPoint(700, 60, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strText.Format(_T("MouseMoveClipRightPoint %d"), rcMousePointRect.right); ChangeScreenPointToOpenGLPoint(700, 75, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); DeleteObject(hfDrawFont); #endif } } return TRUE; }
LPARAM CCopyDlg::OnRevFound(WPARAM /*wParam*/, LPARAM /*lParam*/) { // we have found the highest last-committed revision // in the working copy if ((!m_bSettingChanged)&&(m_maxrev != 0)&&(!m_bCancelled)) { // we only change the setting automatically if the user hasn't done so // already him/herself, if the highest revision is valid. And of course, // if the thread hasn't been stopped forcefully. if (GetCheckedRadioButton(IDC_COPYHEAD, IDC_COPYREV) == IDC_COPYHEAD) { if (m_bmodified) { // the working copy has local modifications. // show a warning balloon if the user has selected HEAD as the // source revision m_tooltips.ShowBalloon(IDC_COPYHEAD, IDS_WARN_COPYHEADWITHLOCALMODS, IDS_WARN_WARNING, TTI_WARNING); } else { // and of course, we only change it if the radio button for a REPO-to-REPO copy // is enabled for HEAD and if there are no local modifications CString temp; temp.Format(L"%ld", m_maxrev); SetDlgItemText(IDC_COPYREVTEXT, temp); CheckRadioButton(IDC_COPYHEAD, IDC_COPYREV, IDC_COPYREV); } } } if (m_externals.size()) m_ExtList.ClearText(); else m_ExtList.ShowText(CString(MAKEINTRESOURCE(IDS_COPY_NOEXTERNALSFOUND))); m_ExtList.SetRedraw(false); m_ExtList.DeleteAllItems(); int c = ((CHeaderCtrl*)(m_ExtList.GetDlgItem(0)))->GetItemCount()-1; while (c>=0) m_ExtList.DeleteColumn(c--); CString temp; temp.LoadString(IDS_STATUSLIST_COLFILE); m_ExtList.InsertColumn(0, temp); temp.LoadString(IDS_STATUSLIST_COLURL); m_ExtList.InsertColumn(1, temp); temp.LoadString(IDS_COPYEXTLIST_COLTAGGED); m_ExtList.InsertColumn(2, temp, LVCFMT_RIGHT); m_ExtList.SetItemCountEx((int)m_externals.size()); CRect rect; m_ExtList.GetClientRect(&rect); int cx = (rect.Width()-180)/2; m_ExtList.SetColumnWidth(0, cx); m_ExtList.SetColumnWidth(1, cx); m_ExtList.SetColumnWidth(2, 80); m_ExtList.SetRedraw(true); DialogEnableWindow(IDC_EXTERNALSLIST, true); return 0; }
void CfoodTrackListView::OnViewRefresh() { // TODO: Add your command handler code here CListCtrl *pListCtrl; pListCtrl = &this->GetListCtrl(); pListCtrl->DeleteAllItems(); while(pListCtrl->DeleteColumn(0)){} //LV_ITEM lvitem; CStudent *pStu; CItem *pItem; CString sTmp; CClass *pClass; int i=0,iPos=0,j=0; CfoodTrackDoc *pDoc=this->GetDocument(); switch(m_nDataType) { case dtStudent: pDoc->FillStudentsToListctrl(pListCtrl,_T(""),_T("")); break; case dtClass: pListCtrl->InsertColumn(0,"*",LVCFMT_LEFT,30,-1); pListCtrl->InsertColumn(1,"日期",LVCFMT_LEFT,80,-1); pListCtrl->InsertColumn(2,"时间",LVCFMT_LEFT,40,-1); pListCtrl->InsertColumn(3,"车号",LVCFMT_LEFT,80,-1); pListCtrl->InsertColumn(4,"教练",LVCFMT_LEFT,50,-1); pListCtrl->InsertColumn(5,"姓名",LVCFMT_LEFT,50,-1); pListCtrl->InsertColumn(6,"性别",LVCFMT_LEFT,40,-1); pListCtrl->InsertColumn(7,"身份证",LVCFMT_LEFT,100,-1); pListCtrl->InsertColumn(8,"联系地址",LVCFMT_LEFT,110,-1); pListCtrl->InsertColumn(9,"电话",LVCFMT_LEFT,80,-1); pListCtrl->InsertColumn(10,"上车时间",LVCFMT_LEFT,70,-1); pListCtrl->InsertColumn(11,"场考时间",LVCFMT_LEFT,70,-1); pListCtrl->InsertColumn(12,"路考时间",LVCFMT_LEFT,70,-1); pListCtrl->InsertColumn(13,"考试类型",LVCFMT_LEFT,70,-1); pListCtrl->InsertColumn(14,"发证日期",LVCFMT_LEFT,70,-1); if(pDoc->ReadClasss(0,0,_T(""),_T(""))<=0) return; for(i=0;i<pDoc->m_arrClass.GetSize();i++) { pClass = pDoc->m_arrClass[i]; for(j=0;j<pClass->m_arrStudent.GetSize();j++) { pStu = pClass->m_arrStudent[j]; sTmp.Format("%d",pListCtrl->GetItemCount()+1); iPos = pListCtrl->InsertItem(pListCtrl->GetItemCount(),sTmp,0); sTmp.Format("%d-%d-%d",pClass->m_F_Date.GetYear(),pClass->m_F_Date.GetMonth(),pClass->m_F_Date.GetDay()); pListCtrl->SetItemText(iPos,1,sTmp); if(pClass->m_F_NoonID==0) sTmp = "上午"; else sTmp = "下午"; pListCtrl->SetItemText(iPos,2,sTmp); pListCtrl->SetItemText(iPos,3,pClass->m_F_AutoNo); pListCtrl->SetItemText(iPos,4,pClass->m_F_Teacher); pListCtrl->SetItemText(iPos,5,pStu->m_F_ItemName); pListCtrl->SetItemText(iPos,6,pStu->m_F_Sex); pListCtrl->SetItemText(iPos,7,pStu->m_F_SN); pListCtrl->SetItemText(iPos,8,pStu->m_F_Address); pListCtrl->SetItemText(iPos,9,pStu->m_F_Tel); //*/日期/时间/车号/教练/姓名/性别/身份证/联系地址/电话/上车时间 //场考时间/路考时间/考试类型/发证日期 if(pStu->m_tmUpAuto>0) { sTmp.Format("%d-%d-%d",pStu->m_tmUpAuto.GetYear(),pStu->m_tmUpAuto.GetMonth(),pStu->m_tmUpAuto.GetDay()); pListCtrl->SetItemText(iPos,10,sTmp); } if(pStu->m_tmExamField>0) { sTmp.Format("%d-%d-%d",pStu->m_tmExamField.GetYear(),pStu->m_tmExamField.GetMonth(),pStu->m_tmExamField.GetDay()); pListCtrl->SetItemText(iPos,11,sTmp); } if(pStu->m_tmExamRoad>0) { sTmp.Format("%d-%d-%d",pStu->m_tmExamRoad.GetYear(),pStu->m_tmExamRoad.GetMonth(),pStu->m_tmExamRoad.GetDay()); pListCtrl->SetItemText(iPos,12,sTmp); } pItem = pDoc->GetItemByID(&pDoc->m_arrExamType,pStu->m_nExamTypeID); if(pItem) pListCtrl->SetItemText(iPos,13,pItem->m_F_ItemName); if(pStu->m_tmEnd>0) { sTmp.Format("%d-%d-%d",pStu->m_tmEnd.GetYear(),pStu->m_tmEnd.GetMonth(),pStu->m_tmEnd.GetDay()); pListCtrl->SetItemText(iPos,14,sTmp); } pListCtrl->SetItemData(iPos,pClass->m_F_ID); } } break; default: break; } }
void CuDlgEventSettingBottom::HandleActualMessage() { CWaitCursor doWaitCursor; CfEventSetting* pFrame = (CfEventSetting*)GetParentFrame(); ASSERT (pFrame); if (!pFrame) return; CaMessageEntry* pEntry = NULL; CaMessageManager* pMessageManager = pFrame->GetMessageManager(); if (!pMessageManager) return; ResizeControls(); EnableControls(); int nGroup = m_cGroupByMessageID.GetCheck(); if (m_nCurrentGroup == nGroup) return; m_nCurrentGroup = nGroup; int nIndex; Imsgclass nClass; CaLoggedEvent* pExistMessage = NULL; CaMessage* pMsg; CaLoggedEvent* pEv; CaIvmEvent& loggedEvent = theApp.GetEventData(); CTypedPtrList<CObList, CaLoggedEvent*>& le = loggedEvent.Get(); POSITION pos = le.GetHeadPosition(); // // Group by: BOOL bGroupBy = FALSE; if (m_nCurrentGroup == 1) { bGroupBy = TRUE; // // Messages have been queried and ready to be used: if (m_bActualMessageGroup) return; // // Initialize the Group Message: m_bActualMessageGroup = TRUE; m_cListCtrlGroupBy.LockWindowUpdate(); while (pos != NULL) { pEv = le.GetNext (pos); pEv->SetClassify(FALSE); // // Check to see if the list of Group By Event containts already // an event whose m_lCode = pEv->m_lCode. // If exist, just increase the count number !! pExistMessage = ExistMessage (pEv, nIndex); if (pExistMessage) { int iCount,iCountExtra; CString strCount; iCount = pExistMessage->GetCount(); iCountExtra = pExistMessage->GetExtraCount(); if (pEv->IsNotFirstLine()) { iCountExtra++; pExistMessage->SetExtraCount(iCountExtra); } else { iCount++; pExistMessage->SetCount(iCount); } if (iCountExtra == 0) strCount.Format (_T("%d"),iCount); else strCount.Format (_T("%d(+%d)"),iCount,iCountExtra); m_cListCtrlGroupBy.SetItemText (nIndex, 1, strCount); continue; } // // The event has not been yet added to the list of Group By Event. // Mark this event as classified or not due to the Entry of Message Manager: pEntry = pMessageManager->FindEntry (pEv->GetCatType()); ASSERT (pEntry); if (!pEntry) continue; pMsg = pEntry->Search(pEv->GetCode()); nClass = pEv->GetClass(); if (pMsg) pEv->SetClass (pMsg->GetClass()); else pEv->SetClass (pEntry->GetClass()); pEv->SetClassify(pMsg? TRUE: FALSE); if (pEv->IsNotFirstLine()) { pEv->SetCount(0); pEv->SetExtraCount(1); } else { pEv->SetCount(1); pEv->SetExtraCount(0); } AddEventToGroupByList(pEv); } m_cListCtrlGroupBy.SortItems(CompareSubItem, (LPARAM)&m_sortListCtrl3); m_cListCtrlGroupBy.UnlockWindowUpdate(); } // // Full description: if (m_nCurrentGroup != 1) { // // Messages have been queried and ready to be used: if (m_bActualMessageAll) return; // // Initialize the Full Description Message: m_bActualMessageAll = TRUE; if (!m_listLoggedEvent.IsEmpty()) m_listLoggedEvent.RemoveAll(); loggedEvent.GetAll (m_listLoggedEvent); INT_PTR nCount = m_listLoggedEvent.GetCount(); pos = m_listLoggedEvent.GetHeadPosition(); while (pos != NULL) { pEv = m_listLoggedEvent.GetNext (pos); pEv->SetClassify(FALSE); // // The event has not been yet added to the list of Group By Event. // Mark this event as classified or not due to the Entry of Message Manager: pEntry = pMessageManager->FindEntry (pEv->GetCatType()); ASSERT (pEntry); if (!pEntry) continue; pMsg = pEntry->Search(pEv->GetCode()); nClass = pEv->GetClass(); if (pMsg) pEv->SetClass (pMsg->GetClass()); else pEv->SetClass (pEntry->GetClass()); pEv->SetClassify(pMsg? TRUE: FALSE); } int nCountPerPage = m_cListCtrlFullDesc.GetCountPerPage(); if (nCount < theApp.GetScrollManagementLimit()) { m_cListCtrlFullDesc.SetListCtrlScrollManagement(FALSE); m_cVerticalScroll.SetScrollRange (0, 0); } else { m_cListCtrlFullDesc.SetListCtrlScrollManagement(TRUE); m_cVerticalScroll.SetScrollRange (0, 0); } ResizeControls(); EnableControls(); m_cVerticalScroll.SetListCtrl (&m_cListCtrlFullDesc); m_cVerticalScroll.SetScrollRange (0, (int)(nCount - nCountPerPage)); m_cVerticalScroll.SetScrollPos (0); m_cListCtrlFullDesc.SetListEvent(&m_listLoggedEvent); m_cListCtrlFullDesc.InitializeItems (GLAYOUT_NUMBER); } EnableButtonFind(); }