// GenDLG.cpp : implementation file // #include "stdafx.h" #include "KBEditors.h" #include "GenDLG.h" #include "KBEditorsDoc.h" #include "KBEditorsView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CGenDLG dialog CGenDLG::CGenDLG(CWnd* pParent /*=NULL*/) : CDialog(CGenDLG::IDD, pParent) { //{{AFX_DATA_INIT(CGenDLG) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void CGenDLG::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CGenDLG) DDX_Control(pDX, IDC_Diag_Out, m_diag); DDX_Control(pDX, IDC_COMBOONROOT, m_OnRoot); DDX_Control(pDX, IDC_COMBOONFRUIT, m_OnFruit); DDX_Control(pDX, IDC_COMBOONSTEM, m_OnStem); DDX_Control(pDX, IDC_COMBOONLEAVES, m_OnLeave); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CGenDLG, CDialog) //{{AFX_MSG_MAP(CGenDLG) ON_BN_CLICKED(IDOK, OnOk) ON_WM_PAINT() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CGenDLG message handlers void CGenDLG::SeeDoc(CKBEditorsView* m_View,CKBEditorsDoc* m_Doc) { pDoc = m_Doc ; pView =m_View ; } BOOL CGenDLG::OnInitDialog() { CDialog::OnInitDialog(); CenterWindow(GetDesktopWindow()); m_OnLeave.AddString("yes"); m_OnLeave.AddString("no"); m_OnRoot.AddString("yes"); m_OnRoot.AddString("no"); m_OnFruit.AddString("yes"); m_OnFruit.AddString("no"); m_OnStem.AddString("yes"); m_OnStem.AddString("no"); m_OnLeave.SetCurSel(0); m_OnRoot.SetCurSel(0); m_OnFruit.SetCurSel(0); m_OnStem.SetCurSel(0); DiagnosisRequired = FALSE; return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CGenDLG::OnOk() { if(m_OnLeave.GetCurSel() == 1 ||m_OnRoot.GetCurSel() == 1 ||m_OnFruit.GetCurSel() == 1 ||m_OnStem.GetCurSel() == 1 ){ DiagnosisRequired = TRUE; if((int)ShellExecute(GetSafeHwnd(),"open","DiagCuptex.exe",NULL,NULL,SW_SHOW)<32) AfxMessageBox(""); } } void CGenDLG::OnCancel() { CDialog::OnCancel(); } void CGenDLG::OnPaint() { CPaintDC dc(this); // device context for painting pDoc->InitDBWM(); pDoc->DB_Doc->OpenDBDoc("DBDoc.DB"); CValue *Value ; CValueList * Arr; POSITION pos = pDoc->DB_WM->GetStartPosition(); CString strCpt,strProp,String; while(pos) { pDoc->DB_WM->GetNextAssoc(pos,String, Arr); CRule * r = new CRule; r->DecomposeCptProp(String,strCpt,strProp); delete r; if(strProp == "confirm") { Value =(CValue*) Arr->m_CValueList.GetAt(0); if(Value->V == "most likely" || Value->V == "likely") m_diag.AddString(strCpt); } } }