///////////////////////////////////////////////////////////////////////////// // CCmdGF message handlers void CCmdGF::OnGfExt() { UpdateData(TRUE); CMainFrame* main; main=(CMainFrame*)AfxGetMainWnd(); CFRTK* face = &((CSoftComputingWndDoc*)main->GetActiveDocument())->m_frtk; IPLIMAGE image = ((CSoftComputingWndDoc*)main->GetActiveDocument())->m_image; CFileDialog *pDlg = new CFileDialog( TRUE, NULL, NULL, OFN_READONLY, "얼굴모델 *.dat|*.dat|모든파일 *.*|*.*|", NULL ); if (pDlg->DoModal()) { CString filename = pDlg->GetFileName(); if (filename != "") { CFRTKface facecomp; facecomp.load(filename); face->FRTKgeofeat(image, NULL, m_source, m_result, facecomp); } } }
///////////////////////////////////////////////////////////////////////////// // CCmdAlu message handlers void CCmdAlu::OnActAlu() { UpdateData(TRUE); CMainFrame* main; main=(CMainFrame*)AfxGetMainWnd(); CFRTK* face = &((CSoftComputingWndDoc*)main->GetActiveDocument())->m_frtk; IPLIMAGE image = ((CSoftComputingWndDoc*)main->GetActiveDocument())->m_image; BOOL flag[3] = {m_Image1, m_Image2, m_Image3}; face->FRTKalu(image, NULL, m_Method, flag, (float)atof(m_Const)); }
CAuctionServerDoc * CAuctionServerDoc::GetDoc() { CMainFrame * pFrame = (CMainFrame *)AfxGetMainWnd(); if (!pFrame) return NULL; return (CAuctionServerDoc *)pFrame->GetActiveDocument(); }
void CTesterView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) { // TODO: Add your specialized code here and/or call the base class CMainFrame* pMain =(CMainFrame*)AfxGetMainWnd(); CTaskControlDoc* pDoc = (CTaskControlDoc*)pMain->GetActiveDocument(); m_TesterNo = pDoc->m_PartInfo.m_TesterNo; m_TesterName = pDoc->m_PartInfo.m_TesterName; CComboBox* m_TesterSexCom; m_TesterSexCom = (CComboBox*)GetDlgItem(IDC_TESTERSEX); m_TesterSexCom->ResetContent(); m_TesterSexCom->InsertString(0,"男"); m_TesterSexCom->InsertString(1,"女"); m_TesterSexCom->SetCurSel(0); m_TesterSex = pDoc->m_PartInfo.m_TesterSex; m_TesterAge = pDoc->m_PartInfo.m_TesterAge; m_Session = pDoc->m_PartInfo.m_Session; UpdateData(FALSE); if (!m_bSetting) { CButton* m_Button; m_Button = (CButton*)GetDlgItem(IDC_MAKESURE); m_Button->EnableWindow(TRUE); } }
void COptDlg::OnChkSupmod() { // TODO: Add your control notification handler code here CMainFrame *pMain = (CMainFrame*)::AfxGetApp()->GetMainWnd(); CTraDoc *pDoc = (CTraDoc*)pMain->GetActiveDocument(); if (pDoc->m_pf) { AfxMessageBox("You can not change this mode while you have trace opened, try to change it before opening trace file!"); CButton *pE=(CButton*)this->GetDlgItem(IDC_CHK_SUPMOD); pE->SetCheck(m_bSupMod); } if (m_bShowAll) { AfxMessageBox("Show All mode will be turn off if enabling super file mode!"); m_bShowAll = FALSE; m_bShowSingle = TRUE; CButton *pE=(CButton*)this->GetDlgItem(IDC_RAD_SHOWALL); pE->SetCheck(m_bShowAll); pE=(CButton*)this->GetDlgItem(IDC_RAD_SHOWSINGLE); pE->SetCheck(m_bShowSingle); } CButton *pE=(CButton*)this->GetDlgItem(IDC_CHK_SUPMOD); m_bSupMod = pE->GetCheck(); }
void CResultDialog::OnCancel() { CMainFrame* cFrame = (CMainFrame*) AfxGetApp()->GetMainWnd(); COCCDemoDoc* aDoc = (COCCDemoDoc*) cFrame->GetActiveDocument(); aDoc->IsShowResult() = FALSE; CDialog::OnCancel(); }
void CToolView::SourceInfoInput(int ref) { CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd(); pDoc = (CToolDoc*)pFrame->GetActiveDocument(); g_AudioEngine.SourceInput(ref); SourceListInput(); // 다이얼 로그에 추가 }
///////////////////////////////////////////////////////////////////////////// // CTesterView message handlers //保存被试者信息 void CTesterView::OnSave() { SetCurrentDirectory(g_szExePath); // TODO: Add your control notification handler code here UpdateData(TRUE); if(m_TesterNo=="") { MessageBox("请输入受试者编号!"); return; } if(m_TesterName=="") { MessageBox("请输入受试者姓名!"); return; } if(m_TesterAge<0) { MessageBox("请输入受试者年龄!"); return; } if(m_Session<0) { MessageBox("请输入第N次!"); return; } CMainFrame* pMain =(CMainFrame*)AfxGetMainWnd(); CTaskControlDoc* pDoc = (CTaskControlDoc*)pMain->GetActiveDocument(); sprintf_s(pDoc->m_PartInfo.m_TesterNo, m_TesterNo); sprintf_s(pDoc->m_PartInfo.m_TesterName, m_TesterName); sprintf_s(pDoc->m_PartInfo.m_TesterSex, m_TesterSex); pDoc->m_PartInfo.m_TesterAge = m_TesterAge; pDoc->m_PartInfo.m_Session = m_Session; _mkdir("PartInfo"); DWORD nBufferLength=256; // char lpBuffer[256]; // char lpSaveBuffer[256]; CString m_FileName; // GetCurrentDirectory(nBufferLength,lpBuffer); // sprintf(lpSaveBuffer,"%s\\PartInfo",lpBuffer); m_FileName.Format("PartInfo\\%s-%s.txt",m_TesterNo,m_TesterName); // m_FileName.Format("%s\\%s-%s.txt",lpSaveBuffer,m_TesterNo,m_TesterName); FILE *fp; fopen_s(&fp, m_FileName,"wt"); if(fp!=NULL) { fprintf_s(fp,"编号\t%s\n",m_TesterNo); fprintf_s(fp,"姓名\t%s\n",m_TesterName); fprintf_s(fp,"性别\t%s\n",m_TesterSex); fprintf_s(fp,"年龄\t%d\n",m_TesterAge); fprintf_s(fp,"第N次\t%d\n",m_Session); fclose(fp); } MessageBox("保存完毕!","提示"); }
CSkin::CSkin(CWnd* pParent /*=NULL*/) : CDialogEx(CSkin::IDD, pParent) , face_info(_T("")) { CMainFrame* pMain = (CMainFrame*)AfxGetApp()->m_pMainWnd; COpenCVPlatDoc *pDoc = (COpenCVPlatDoc*)pMain->GetActiveDocument(); old_img = pDoc->image.clone(); rub_img = old_img.clone(); }
void CChangePasswdDlg::OnBnClickedOk() { // TODO: Add your control notification handler code here CString cur_passwd, new_passwd, re_new_passwd; m_editCPW.GetWindowText(cur_passwd); if(cur_passwd.GetLength() <= 0) { AfxMessageBox("Please enter the current password!"); return; } m_editNewPW.GetWindowText(new_passwd); if(new_passwd.GetLength() <= 0) { AfxMessageBox("Please enter the new password!"); return; } m_editReNewPw.GetWindowText(re_new_passwd); if(re_new_passwd.GetLength() <= 0) { AfxMessageBox("Please re-enter the new password!"); return; } CMainFrame* frame = (CMainFrame*)AfxGetMainWnd(); CInquisitorDoc *pDoc = (CInquisitorDoc *)frame->GetActiveDocument(); if(cur_passwd != pDoc->passwd) { AfxMessageBox("The input of the current password is incorrect!"); return; } if(new_passwd != re_new_passwd) { AfxMessageBox("The new password does not match the re-typed one!"); return; } frame->BeginWaitCursor(); CString msg; int t = irodsWinChangePasswd(pDoc->conn, cur_passwd, new_passwd); if(t < 0) { CString msgHead = CString("Change Password error: "); pDoc->disp_err_msgbox(msgHead, t); } else { pDoc->passwd = new_passwd; msg = "Change Password succeeded."; frame->statusbar_msg(msg); AfxMessageBox(msg); } frame->EndWaitCursor(); OnOK(); }
CClientDoc* CMFCUtil::getActiveDoc() { CMainFrame* fram = CMFCUtil::getMainFrame(); if (fram != NULL) { CClientDoc* doc = (CClientDoc*)fram->GetActiveDocument(); return doc; } return NULL; }
void CCommentsDlg::OnBnClickedOk() { CMainFrame *pMainFrame = (CMainFrame*)GetParentFrame(); CFamiTrackerDoc *pDoc = (CFamiTrackerDoc*)pMainFrame->GetActiveDocument(); CString comment; GetDlgItemText(IDC_COMMENTS, comment); pDoc->SetComment(comment); EndDialog(0); }
void CSettingDlg7::setStartPos() { UpdateData(TRUE); CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd(); CTaskControlDoc* pDoc = (CTaskControlDoc*)pMain->GetActiveDocument(); pDoc->m_Setting7[m_DlgIdx].m_iBallStartPos = m_bStartPosTop * S_TOP; pDoc->m_Setting7[m_DlgIdx].m_iBallStartPos += m_bStartPosRight * S_RIGHT; pDoc->m_Setting7[m_DlgIdx].m_iBallStartPos += m_bStartPosBottom * S_BOTTOM; pDoc->m_Setting7[m_DlgIdx].m_iBallStartPos += m_bStartPosLeft * S_LEFT; }
void CWorkerLine::OnLButtonUp(UINT nFlags, CPoint point) { CGlobalAgent::showMessageOnStatusBar("CWorkerLine::OnLButtonUp"); CMainFrame *pFrame = (CMainFrame *)AfxGetMainWnd(); CDemo8Doc *pDoc = (CDemo8Doc *)pFrame->GetActiveDocument(); CProductionLine *p = new CProductionLine(); p->start = start; p->end = point; p->color = pDoc->current_color; pDoc->productions[pDoc->production_number++] = p; pDoc->UpdateAllViews(NULL); started = FALSE; }
BOOL COptDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CListBox *pLB = (CListBox *)GetDlgItem(IDC_LST_BEGIN); CListBox *pLE = (CListBox *)GetDlgItem(IDC_LST_END); for(long i = 0 ;i<this->begs.GetSize(); i++) { pLB->AddString(begs[i]); pLE->AddString(ends[i]); } CMainFrame *pMain = (CMainFrame*)::AfxGetApp()->GetMainWnd(); CTraDoc *pDoc = (CTraDoc*)pMain->GetActiveDocument(); for (int i = 0; i < _countof(_afxPropSheetButtons); i++) { HWND hWndButton = ::GetDlgItem(pDoc->m_pSheet->m_hWnd, _afxPropSheetButtons[i]); if (hWndButton != NULL && (_afxPropSheetButtons[i] == ID_APPLY_NOW || _afxPropSheetButtons[i] == IDHELP)) { ::ShowWindow(hWndButton, SW_HIDE); ::EnableWindow(hWndButton, FALSE); } else if (hWndButton != NULL) { CRect btnRt, sheetRt; ::GetWindowRect(hWndButton, &btnRt); ::GetWindowRect(pDoc->m_pSheet->m_hWnd, &sheetRt); CSize btnSz(100, 25); pDoc->m_pSheet->ScreenToClient(&btnRt); pDoc->m_pSheet->ScreenToClient(&sheetRt); btnSz.cx = (sheetRt.right - sheetRt.left) / 4; if (_afxPropSheetButtons[i] == IDOK) { ::MoveWindow(hWndButton, sheetRt.left + (sheetRt.right - sheetRt.left)/8, btnRt.top, btnSz.cx, btnSz.cy, false); } else if (_afxPropSheetButtons[i] == IDCANCEL) { ::MoveWindow(hWndButton, sheetRt.left + (sheetRt.right - sheetRt.left)*5/8, btnRt.top, btnSz.cx, btnSz.cy, false); } } } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CPlayerOptionsDlg :: OnInitDialog() { CMainFrame* pFrame = (CMainFrame*)(AfxGetApp()->GetMainWnd()); ASSERT_VALID (pFrame); CPenteDoc* pDoc = (CPenteDoc*)(pFrame->GetActiveDocument()); ASSERT_VALID(pDoc); UINT nSelection = (pDoc->GetPlayMode() == PLAYER_VS_PLAYER ? IDC_PLAYERVSPLAYER : IDC_PLAYERVSCOMPUTER); CheckDlgButton(nSelection, 1); return CDialog::OnInitDialog(); }
VOID CPlayerOptionsDlg :: OnOK() { CMainFrame* pFrame = (CMainFrame*)(AfxGetApp()->GetMainWnd()); ASSERT_VALID (pFrame); CPenteDoc* pDoc = (CPenteDoc*)(pFrame->GetActiveDocument()); ASSERT_VALID(pDoc); if (IsDlgButtonChecked(IDC_PLAYERVSPLAYER)) pDoc->SetPlayMode(PLAYER_VS_PLAYER); else pDoc->SetPlayMode(PLAYER_VS_COMPUTER); CDialog::OnOK(); }
void CToolView::OnForZ(NMHDR *pNMHDR, LRESULT *pResult) { LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR); CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd(); // Document 를 얻어온다 pDoc = (CToolDoc*)pFrame->GetActiveDocument(); m_ListenForward.z = ((float)(m_LForZ.GetPos()-65535)-2000.0f)/100.0f; CString temp; temp.Format("%.2f",m_ListenForward.z); SetDlgItemText(IDC_FORWARDZ,temp); g_AudioEngine.m_Listener.SetListenerOrien(&m_ListenForward, &m_ListenUp); g_AudioEngine.m_Listener.SetListener(); *pResult = 0; }
void CToolView::OnLVeloY(NMHDR *pNMHDR, LRESULT *pResult) { LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR); CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd(); // Document 를 얻어온다 pDoc = (CToolDoc*)pFrame->GetActiveDocument(); m_ListenVelo.y = ((float)(m_LVeloY.GetPos()-65535)-2000.0f)/100.0f; CString temp; temp.Format("%.2f",m_ListenVelo.y); SetDlgItemText(IDC_LVELOY,temp); g_AudioEngine.m_Listener.SetListenerVelo(&m_ListenVelo); g_AudioEngine.m_Listener.SetListener(); *pResult = 0; }
void CDialogStrVars::OnButtonDeleteStrvar() { CStringVar* pStrVarToDelete; CStringVar* pStrVarCur; CNLB_BldrDoc* pDoc; CMainFrame* pMainFrame = (CMainFrame*) AfxGetMainWnd(); POSITION pos; int nItem; int iStrVarCount; if (pMainFrame) { pDoc = (CNLB_BldrDoc*) pMainFrame->GetActiveDocument(); ASSERT_VALID(pDoc); if (pDoc) { CString strCaption; CString strMessage; strMessage.LoadString(IDS_CONFIRM_DEL_STRVAR); strCaption.LoadString(IDS_CONFIRM_MB_CAPT); if (MessageBox(strMessage, strCaption, MB_ICONQUESTION | MB_YESNO) == IDYES) { pos = m_lstStrVars.GetFirstSelectedItemPosition(); if (pos) { nItem = m_lstStrVars.GetNextSelectedItem(pos); pStrVarToDelete = (CStringVar*) m_lstStrVars.GetItemData(nItem); iStrVarCount = pDoc->m_lstStrVars.GetCount(); pos = pDoc->m_lstStrVars.GetHeadPosition(); for (int i = 0; i < iStrVarCount; i++) { pStrVarCur = pDoc->m_lstStrVars.GetAt(pos); if (pStrVarCur == pStrVarToDelete) { delete pStrVarToDelete; pDoc->m_lstStrVars.RemoveAt(pos); m_lstStrVars.DeleteItem(nItem); break; } pDoc->m_lstStrVars.GetNext(pos); } } } } } }
void CDialogStrVars::OnButtonAddStrvar() { CStringVar* pStrVarNew; CDialogStrVarProperties dlg; CNLB_BldrDoc* pDoc; CMainFrame* pMainFrame = (CMainFrame*) AfxGetMainWnd(); int ciItems; CString strVarBodyToSetInLV; CString strCR; CString strCRSymbolic; if (pMainFrame) { pDoc = (CNLB_BldrDoc*) pMainFrame->GetActiveDocument(); ASSERT_VALID(pDoc); if (pDoc) { dlg.m_strStrVarName = _T(""); // Новая Str Variable if (dlg.DoModal() == IDOK) { if ((pStrVarNew = new CStringVar) == NULL) ((CNLB_BldrApp*) AfxGetApp())->HandleError(IERR_OUT_OF_MEMORY); pStrVarNew->Get_strStrVarName() = dlg.m_strStrVarName; pStrVarNew->Get_strStrVarBody() = dlg.m_strStrVarBody; CStringVar::ListAssign(pStrVarNew->m_lstStrVarParameters, dlg.m_lstStrVarParameters); CStringVar::ListAssign(pStrVarNew->m_lstStrVarDependencies, dlg.m_lstStrVarDependencies); pStrVarNew->Get_fSaveInTheBookmarksFile() = dlg.m_fSaveInTheBookmarksFile; pDoc->m_lstStrVars.AddHead(pStrVarNew); ciItems = m_lstStrVars.GetItemCount(); m_lstStrVars.InsertItem(LVIF_IMAGE | LVIF_PARAM | LVIF_TEXT, ciItems, pStrVarNew->Get_strStrVarName(), 0, 0, m_iIconPos, (LPARAM) pStrVarNew); strVarBodyToSetInLV = pStrVarNew->Get_strStrVarBody(); strCR.LoadString(IDS_CR); strCRSymbolic.LoadString(IDS_CR_SYMBOLIC); strVarBodyToSetInLV.Replace(strCR, strCRSymbolic); m_lstStrVars.SetItemText(ciItems, 1, strVarBodyToSetInLV); } } } }
void CDialogWindType::OnBnClickedOk() { CLineComputeView* pView = (CLineComputeView*)((CMainFrame *)AfxGetMainWnd())->GetActiveView(); CString str; for(int i=0; i<pView->m_data->m_dxSpanNum; i++) { pView->m_data->m_windLength[i].id = _ttoi(m_windApplyLoc->GetItemText(i, 0)); pView->m_data->m_windLength[i].left = _ttof(m_windApplyLoc->GetItemText(i, 1)); pView->m_data->m_windLength[i].length = _ttof(m_windApplyLoc->GetItemText(i, 2)); } pView->m_data->m_windType = m_windType.GetCurSel(); pView->m_data->m_windApplyMethod = m_windApplyMehtod.GetCurSel(); pView->OnPaint(); CMainFrame *pmf = (CMainFrame *)AfxGetMainWnd(); CLineComputeDoc *doc = (CLineComputeDoc *)pmf->GetActiveDocument(); doc->isSaved = false;//改动数据需要保存 CDialog::OnOK(); }
BOOL CCommentsDlg::OnInitDialog() { CDialog::OnInitDialog(); CMainFrame *pMainFrame = (CMainFrame*)GetParentFrame(); CFamiTrackerDoc *pDoc = (CFamiTrackerDoc*)pMainFrame->GetActiveDocument(); CString comment = pDoc->GetComment(); SetDlgItemText(IDC_COMMENTS, comment); CEdit *pEdit = (CEdit*)GetDlgItem(IDC_COMMENTS); CFont *pFont = new CFont(); pFont->CreateFont(12, 0, 0, 0, 0,0, 0, 0, 0, 0, 0, 0, 0, FONT_FACE); pEdit->SetFont(pFont); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CTesterView::OnInitialUpdate() { CFormView::OnInitialUpdate(); // TODO: Add your specialized code here and/or call the base class CMainFrame* pMain =(CMainFrame*)AfxGetMainWnd(); CTaskControlDoc* pDoc = (CTaskControlDoc*)pMain->GetActiveDocument(); m_TesterNo = pDoc->m_PartInfo.m_TesterNo; m_TesterName = pDoc->m_PartInfo.m_TesterName; CComboBox* m_TesterSexCom; m_TesterSexCom = (CComboBox*)GetDlgItem(IDC_TESTERSEX); m_TesterSexCom->ResetContent(); m_TesterSexCom->InsertString(0,"男"); m_TesterSexCom->InsertString(1,"女"); m_TesterSexCom->SetCurSel(0); m_TesterSex = pDoc->m_PartInfo.m_TesterSex; m_TesterAge = pDoc->m_PartInfo.m_TesterAge; m_Session = pDoc->m_PartInfo.m_Session; UpdateData(FALSE); Resize(); }
void CBCGPOrganizerApp::UpdateGantt (BOOL bUpdateGantt /*= TRUE*/) { CMainFrame* pFrame = (CMainFrame*) AfxGetMainWnd (); ASSERT_VALID (pFrame); if (bUpdateGantt) { CBCGPOrganizerDoc* pDoc = (CBCGPOrganizerDoc*) pFrame->GetActiveDocument (); if (pDoc != NULL) { ASSERT_VALID (pDoc); pDoc->UpdateGantt (m_OptionsGantt); } pFrame->UpdateCalendar (); } else { //DR: //pFrame->GetPropBar ().Update (); } //------------------------ // Set tooltip parameters: //------------------------ CBCGPToolTipParams params; params.m_bVislManagerTheme = TRUE; globalData.m_nMaxToolTipWidth = 150; GetTooltipManager ()->SetTooltipParams ( BCGP_TOOLTIP_TYPE_GANTT, m_OptionsGantt.m_ShowToolTip == 2 ? RUNTIME_CLASS (CPlannerTooltipCtrl) : RUNTIME_CLASS (CBCGPToolTipCtrl), ¶ms); }
BOOL CColorPage::OnInitDialog() { CMainFrame* pFrame; pFrame = (CMainFrame*)AfxGetApp()->GetMainWnd(); ASSERT_VALID(pFrame); m_pDoc = (CPenteDoc*)pFrame->GetActiveDocument(); ASSERT_VALID(m_pDoc); m_lBackColor = m_pDoc->GetBackColor(); m_lGridColor = m_pDoc->GetGridColor(); m_fUseBackColor = m_pDoc->m_fUseBackColor; // Enable current option if (m_fUseBackColor) CheckDlgButton(IDC_USEBKGND, TRUE); else CheckDlgButton(IDC_USETHEME, TRUE); return CPropertyPage::OnInitDialog(); }
bool MainWindow::eventFilter(QObject *object, QEvent *event) { if ( object == ui->position && event->type() == QEvent::MouseButtonPress ) { m_bDraggingPosition = true; return false; } else if ( object == ui->position && event->type() == QEvent::MouseButtonRelease ) { m_bDraggingPosition = false; return false; } else if ( object == ui->sampleWindow && event->type() == QEvent::MouseButtonPress ) { CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd(); pMainFrame->GetSampleWindow()->SendMessage(WM_LBUTTONDOWN); } else if ( object == ui->sampleWindow && event->type() == QEvent::Paint ) { CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd(); CFamiTrackerDoc* pDoc = (CFamiTrackerDoc*)pMainFrame->GetActiveDocument(); CFamiTrackerView* pView = (CFamiTrackerView*)pMainFrame->GetActiveView(); QPainter p; QRect rect = pMainFrame->GetSampleWindow()->toQWidget()->rect().adjusted(3,2,-3,-3); QPixmap pixmap(rect.size()); p.begin(&pixmap); pMainFrame->GetSampleWindow()->toQWidget()->render(&p,QPoint(),QRegion(3,3,rect.width(),rect.height())); p.end(); p.begin(ui->sampleWindow); p.drawPixmap(0,0,pixmap.scaled(p.window().size(),Qt::IgnoreAspectRatio,Qt::FastTransformation)); p.end(); return true; } return false; }
BOOL CBibedtApp::OnDDECommand(LPTSTR lpszCommand) { // Server: bibedt // Topic: System if (CWinApp::OnDDECommand(lpszCommand)) return TRUE; // Handle any DDE commands recognized by your application // and return TRUE. See implementation of CWinApp::OnDDEComand // for example of parsing the DDE command string. CString strCommand(lpszCommand); CString strFileName(lpszCommand); CString itemKey; CMainFrame* main = dynamic_cast<CMainFrame*>(AfxGetMainWnd()); if (main == NULL) return FALSE; CBibedtDoc* doc = dynamic_cast<CBibedtDoc*>(main->GetActiveDocument()); if (doc == NULL) return FALSE; int nStart, nEnd; if (strCommand.Left(7).CompareNoCase(_T("[goto(\"")) == 0) { // handle goto command => [goto("filepath", "itemkey")] // get file name nStart = strCommand.Find(_T('"')); nEnd = strCommand.Find(_T('"'), nStart + 1); if (nStart == -1 || nEnd == -1 || nEnd - nStart <= 1) return FALSE; strFileName = strCommand.Mid(nStart + 1, nEnd - (nStart + 1)); // get key nStart = strCommand.Find(_T('"'), nEnd + 1); nEnd = strCommand.Find(_T('"'), nStart + 1); if (nStart == -1 || nEnd == -1 || nEnd - nStart <= 1) return FALSE; itemKey = strCommand.Mid(nStart + 1, nEnd - (nStart + 1)); // open the document OpenDocumentFile(strFileName); doc->SetSelected(itemKey); return TRUE; } else if (strCommand.Left(8).CompareNoCase(_T("[focus(\"")) == 0) { // [focus("key")] // get key nStart = strCommand.Find(_T('"')); nEnd = strCommand.Find(_T('"'), nStart + 1); if (nStart == -1 || nEnd == -1 || nEnd - nStart <= 1) return FALSE; itemKey = strCommand.Mid(nStart + 1, nEnd - (nStart + 1)); doc->SetSelected(itemKey); return TRUE; } else if (strCommand.Left(7).CompareNoCase(_T("[find(\"")) == 0) { // [find("str")] nStart = strCommand.Find(_T('"')); nEnd = strCommand.Find(_T('"'), nStart + 1); if (nStart == -1 || nEnd == -1 || nEnd - nStart <= 1) return FALSE; itemKey = strCommand.Mid(nStart + 1, nEnd - (nStart + 1)); main->SetQuicksearchText(itemKey); doc->DoQuickSearch(itemKey, main->GetQuicksearchFields(), TRUE); return TRUE; } else if (strCommand.Left(9).CompareNoCase(_T("[filter(\"")) == 0) { // [filter("name")] nStart = strCommand.Find(_T('"')); nEnd = strCommand.Find(_T('"'), nStart + 1); if (nStart == -1 || nEnd == -1 || nEnd - nStart <= 1) return FALSE; itemKey = strCommand.Mid(nStart + 1, nEnd - (nStart + 1)); CBibItem* filter = doc->m_BibFile->Find(STR_FILTER); if (filter) { CField* flt = filter->Find(itemKey); if (flt) { main->SelectFilter(flt); doc->SetFilter(flt); return TRUE; } } } // Return FALSE for any DDE commands you do not handle. return FALSE; }
void MainWindow::onIdleSlot() { CFamiTrackerApp* pApp = (CFamiTrackerApp*)AfxGetApp(); CMainFrame* pMainFrame = (CMainFrame*)pApp->m_pMainWnd; CFamiTrackerDoc* pDoc = (CFamiTrackerDoc*)pMainFrame->GetActiveDocument(); CFamiTrackerView* pView = (CFamiTrackerView*)pMainFrame->GetActiveView(); static int lastFrame = -1; ui->sampleWindow->update(); if ( m_bCheck ) { // Move to next song if playing and the current song has reached a stop. if ( m_bCheck && m_bPlaying && !m_bChangeSong ) { // Check if time is at time limit and if so, advance to next song. int timeLimit = m_pWndMFC->GetTimeLimit(); CString playTime; int totalPlayTime; pMainFrame->GetDescendantWindow(AFX_IDW_STATUS_BAR)->GetDlgItemText(ID_INDICATOR_TIME,playTime); totalPlayTime = m_pWndMFC->ConvertTime(playTime); if ( lastFrame != pView->GetPlayFrame() ) { lastFrame = pView->GetPlayFrame(); m_iFramesPlayed++; } if ( m_bTimeLimited && (timeLimit == totalPlayTime) ) { // Force stop... m_bPlaying = false; pApp->OnCmdMsg(ID_TRACKER_TOGGLE_PLAY,0,0,0); m_bChangeSong = true; // Create a bit of a delay between songs. m_pTimer->start(500); } else if ( m_bLoopLimited && m_iFramesPlayed > pDoc->ScanActualLength(pDoc->GetSelectedTrack(),m_pWndMFC->GetFrameLoopCount()) ) { // Force stop... m_bPlaying = false; pApp->OnCmdMsg(ID_TRACKER_TOGGLE_PLAY,0,0,0); m_bChangeSong = true; // Create a bit of a delay between songs. m_pTimer->start(500); } if ( !pApp->GetSoundGenerator()->IsPlaying() ) { m_bPlaying = false; m_bChangeSong = true; // Create a bit of a delay between songs. m_pTimer->start(500); } } // Wait until player starts playing before turning the above logic back on. else if ( m_bChangeSong ) { on_playStop_clicked(); if ( !ui->repeat->isChecked() ) { on_next_clicked(); } m_bChangeSong = false; ui->position->setValue((pView->GetPatternView()->GetPlayFrame()*pDoc->GetPatternLength())+pView->GetPatternView()->GetPlayRow()); startSettleTimer(); m_pTimer->start(0); } } if ( m_bDraggingPosition ) { // FF/RW m_bCheck = false; pView->PlayerCommand(CMD_JUMP_TO,(ui->position->value()/pDoc->GetPatternLength())-1); pView->GetPatternView()->JumpToRow(ui->position->value()%pDoc->GetPatternLength()); } else { m_bCheck = true; ui->frames->setText(QString::number(m_iFramesPlayed)+"/"+QString::number(pDoc->ScanActualLength(pDoc->GetSelectedTrack(),m_pWndMFC->GetFrameLoopCount()))); ui->position->setValue((pView->GetPatternView()->GetPlayFrame()*pDoc->GetPatternLength())+pView->GetPatternView()->GetPlayRow()); } }
//设为当前被试者信息 void CTesterView::OnMakesure() { // TODO: Add your control notification handler code here UpdateData(TRUE); if(m_TesterNo=="") { MessageBox("请输入受试者编号!"); return; } if(m_TesterName=="") { MessageBox("请输入受试者姓名!"); return; } if(m_TesterAge<0) { MessageBox("请输入受试者年龄!"); return; } if(m_Session<0) { MessageBox("请输入第N次!"); return; } CTaskControlApp* pApp =(CTaskControlApp*)AfxGetApp(); CMainFrame* pMain =(CMainFrame*)AfxGetMainWnd(); CTaskControlDoc* pDoc = (CTaskControlDoc*)pMain->GetActiveDocument(); sprintf_s(pDoc->m_PartInfo.m_TesterNo, m_TesterNo); sprintf_s(pDoc->m_PartInfo.m_TesterName, m_TesterName); sprintf_s(pDoc->m_PartInfo.m_TesterSex, m_TesterSex); pDoc->m_PartInfo.m_TesterAge = m_TesterAge; pDoc->m_PartInfo.m_Session = m_Session; _mkdir("PartInfo"); DWORD nBufferLength=256; // char lpBuffer[256]; // char lpSaveBuffer[256]; CString m_FileName; // GetCurrentDirectory(nBufferLength,lpBuffer); // sprintf(lpSaveBuffer,"%s\\PartInfo",lpBuffer); m_FileName.Format("PartInfo\\%s-%s.txt",m_TesterNo,m_TesterName); // m_FileName.Format("%s\\%s-%s.txt",lpSaveBuffer,m_TesterNo,m_TesterName); FILE *fp; fopen_s(&fp, m_FileName,"wt"); if(fp!=NULL) { fprintf_s(fp,"编号\t%s\n",m_TesterNo); fprintf_s(fp,"姓名\t%s\n",m_TesterName); fprintf_s(fp,"性别\t%s\n",m_TesterSex); fprintf_s(fp,"年龄\t%d\n",m_TesterAge); fprintf_s(fp,"第N次\t%d\n",m_Session); fclose(fp); } // SetCurrentDirectory(lpBuffer); sprintf_s(pDoc->m_CurPartInfo.m_TesterNo, m_TesterNo); sprintf_s(pDoc->m_CurPartInfo.m_TesterName, m_TesterName); sprintf_s(pDoc->m_CurPartInfo.m_TesterSex, m_TesterSex); pDoc->m_CurPartInfo.m_TesterAge = m_TesterAge; pDoc->m_CurPartInfo.m_Session = m_Session; CButton* m_Button; m_Button = (CButton*)GetDlgItem(IDC_MAKESURE); m_Button->EnableWindow(FALSE); m_bSetting = TRUE; pApp->SaveExe(); }