// BoundaryDialog1.cpp : implementation file // #include "stdafx.h" #include "BoundaryDialog.h" ///////////////////////////////////////////////////////////////////////////// // BoundaryDialog dialog IMPLEMENT_DYNAMIC(BoundaryDialog, CDialog) BoundaryDialog::BoundaryDialog(CWnd* pParent /*=NULL*/) : CDialog(BoundaryDialog::IDD, pParent) { } BoundaryDialog::~BoundaryDialog() { } void BoundaryDialog::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); /* SHARED (can copy and paste between dialogs) */ BindCommonInputFields(pDX); //sphere specific DDX_Control(pDX, IDC_CHECK_RUN_THICKNESS, check_run_thickness_dist); DDX_Control(pDX, IDC_CHECK_RUN_SURFACE_STRUCTURE, check_run_surface_volume_dist); DDX_Control(pDX, IDC_CHECK_RUN_TOP_CONTACT_FRACTION, check_run_contact_fraction_top); DDX_Control(pDX, IDC_CHECK_RUN_BOTTOM_CONTACT_FRACTION, check_run_contact_fraction_bottom); } BEGIN_MESSAGE_MAP(BoundaryDialog, CDialog) //messages similar to all dialogs ON_BN_CLICKED(IDC_BUTTON_INPUT_DIRECTORY, OnBnClickedButtonInputDirectory) ON_BN_CLICKED(IDC_BUTTON_WORK_DIRECTORY, OnBnClickedButtonWorkDirectory) ON_CBN_SELCHANGE(IDC_COMBO_THRESHOLDING_METHOD, OnCbnSelchangeComboThresholdingMethod) ON_EN_CHANGE(IDC_EDIT_MANUAL_THRESHOLD, OnEnChangeEditManualThreshold) ON_BN_CLICKED(IDSTOP, OnBnClickedStop) ON_EN_CHANGE(IDC_EDIT_WIDTH_SLICES, OnEnChangeEditWidthSlices) ON_EN_CHANGE(IDC_EDIT_END_SLICE, OnEnChangeEditEndSlice) ON_EN_CHANGE(IDC_EDIT_WIDTHX, OnEnChangeEditWidthx) ON_EN_CHANGE(IDC_EDIT_ENDX, OnEnChangeEditEndx) ON_EN_CHANGE(IDC_EDIT_WIDTHY, OnEnChangeEditWidthy) ON_EN_CHANGE(IDC_EDIT_ENDY, OnEnChangeEditEndy) ON_EN_CHANGE(IDC_EDIT_START_SLICE, OnEnChangeEditStartSlice) ON_EN_CHANGE(IDC_EDIT_STARTX, OnEnChangeEditStartx) ON_EN_CHANGE(IDC_EDIT_STARTY, OnEnChangeEditStarty) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // BoundaryDialog message handlers void BoundaryDialog::OnOK() { // TODO: Add extra validation here bool is_dataright=true; CString m_error; // have windows auto check the parameters, and fill out variables if (!UpdateData(TRUE)) return; /* no need to check: input directory, file need to check (in this order): valid output directory valid output file prefix at least one type of run is selected either number of runs specified (> 0), or 'run all' check box marked (for all 3 run types) end depth is <= appropriate planes depth distribution res >= 1 the rest is auto checked by UpdateData(TRUE) */ if ( field_directory_work_str.IsEmpty() ){ //make sure there is an output directory is_dataright=false; m_error = "You must select a valid output directory."; } else if ( field_name_output_str.IsEmpty() ){ //make sure there is a output file prefix is_dataright=false; m_error = "You must select a valid output file prefix."; } if(is_dataright) { //delete '[' and everything after it input_file_name_cut = input_file_name; if (left_bracket_indx > 0) input_file_name_cut.Delete(left_bracket_indx, input_file_name.GetLength() ); DisableCommonInputs(); pbar_simulation_progress.SetPos(0); //create a tortuosity work thread, which will also disable the restof the GUI, except for STOP button AfxBeginThread(BoundarySetup, this); } else AfxMessageBox(m_error); } void BoundaryDialog::OnCancel() { if(!DestroyWindow()) AfxMessageBox("Could not destroy this window!!!"); delete this; } BOOL BoundaryDialog::OnInitDialog() { program_generated = true; CDialog::OnInitDialog(); InitCommonInputFields(); program_generated = false; return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } /* The following are messages that are dealt in similar matter for all PoroMedia dialogs */ //when the stop button is pushed, initialize stop procedure void BoundaryDialog::OnBnClickedStop() { StopRequest(); } //when input directory button is pushed void BoundaryDialog::OnBnClickedButtonInputDirectory() { //grab file, do inits common to all poromedia dialogs ClickedInputDirectory(); } //when work directory button is pushed void BoundaryDialog::OnBnClickedButtonWorkDirectory() { ClickedWorkDirectory(); } //threshold stuff void BoundaryDialog::OnCbnSelchangeComboThresholdingMethod() { ChangeComboThresholding(); } void BoundaryDialog::OnEnChangeEditManualThreshold() { EditManualThreshold(); } //the rest deals with start/width/end field autocalcs void BoundaryDialog::OnEnChangeEditStartSlice() { EditStartSlice(); } void BoundaryDialog::OnEnChangeEditWidthSlices() { EditWidthSlices(); } void BoundaryDialog::OnEnChangeEditEndSlice() { EditEndSlice(); } void BoundaryDialog::OnEnChangeEditStartx() { EditStartx(); } void BoundaryDialog::OnEnChangeEditWidthx() { EditWidthx(); } void BoundaryDialog::OnEnChangeEditEndx() { EditEndx(); } void BoundaryDialog::OnEnChangeEditStarty() { EditStarty(); } void BoundaryDialog::OnEnChangeEditWidthy() { EditWidthy(); } void BoundaryDialog::OnEnChangeEditEndy() { EditEndy(); }