static LRESULT CALLBACK SetupAction(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { int wmId; int wmEvent; switch (message) { case WM_INITDIALOG: set_setup_defaults(hDlg); SetFocus(GetDlgItem(hDlg, IDC_OK)); return TRUE; case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); switch (wmId) { /* case IDC_RESIN_FILE: select_directory(hDlg, IDC_RESIN_HOME, "Resin Home"); return TRUE; case IDC_APACHE_FILE: select_directory(hDlg, IDC_APACHE_HOME, "Apache Home"); return TRUE; case IDC_IIS_FILE: select_directory(hDlg, IDC_IIS_HOME, "IIS Script Directory"); return TRUE; */ case IDC_APPLY: apply(hDlg); return TRUE; case IDC_REMOVE: remove(hDlg); return TRUE; case IDC_OK: if (apply(hDlg)) EndDialog(hDlg, LOWORD(wParam)); return TRUE; case IDC_CANCEL: case WM_DESTROY: EndDialog(hDlg, LOWORD(wParam)); return TRUE; } break; } return FALSE; }
Setup *fill_setup(Image *image, char *setupfile, int usefile, int autopars) { int no_error=1; /* Flag set to 0 on error */ Setup *setup=NULL; /* Container for plotting parameters */ /* * Allocate memory for Setup container */ if(!(setup = new_setup(1))) { fprintf(stderr,"ERROR: fill_setup\n"); return NULL; } /* * Set up image display parameters */ if(no_error) if(set_setup_defaults(image,setup)) no_error = 0; if(autopars) if(init_setup(image,setup,autopars)) no_error = 0; if(no_error && usefile) if(setup_file(image,setup,setupfile)) no_error = 0; if(no_error) setup_interact(image,setup); /* * Return filled setup container if no errors */ if(no_error) return setup; else { fprintf(stderr,"ERROR: fill_setup\n"); return del_setup(setup); } }