📄 wbcview.c
字号:
edt_set(hwnd, DI_BLANK, fmtinfo.blanks); edt_set(hwnd, DI_FIELD, fmtinfo.fldseps); edt_set(hwnd, DI_RECORD, fmtinfo.recseps); edt_set(hwnd, DI_UNKNOWN, fmtinfo.uvchars); return 1; /* set defaults from parameter block */ case WM_COMMAND: /* command (button pressed etc.) */ switch (wp) { /* evaluate command code */ case IDOK: /* if 'Ok' button pressed */ fmtinfo.first = cmb_get(hwnd, DI_FIRST); edt_get(hwnd, DI_BLANK, fmtinfo.blanks, 80); edt_get(hwnd, DI_FIELD, fmtinfo.fldseps, 80); edt_get(hwnd, DI_RECORD, fmtinfo.recseps, 80); edt_get(hwnd, DI_UNKNOWN, fmtinfo.uvchars, 80); EndDialog(hwnd, 0); /* get inputs from edit controls */ return 1; /* return 'ok' */ case IDCANCEL: /* if 'Cancel' button pressed, */ EndDialog(hwnd, -1); return 1; /* terminate dialog */ } break; case WM_CLOSE: /* dialog box has been closed */ EndDialog(hwnd, -1); return 1; /* terminate dialog */ } return 0; /* everything else not handled */} /* dp_format() *//*--------------------------------------------------------------------*/BOOL CALLBACK dp_colors (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp){ /* --- colors dialog box procedure */ int clscnt; /* number of classes/clusters */ switch (msg) { /* evaluate message */ case WM_INITDIALOG: /* dialog initialization */ LoadString(hinst, CS_DT_PROB, buf, sizeof(buf)); cmb_add(hwnd, DI_DIST, buf); LoadString(hinst, CS_DT_FUZZY, buf, sizeof(buf)); cmb_add(hwnd, DI_DIST, buf); LoadString(hinst, CS_DT_POSS, buf, sizeof(buf)); cmb_add(hwnd, DI_DIST, buf); /* set distribution type */ cmb_set(hwnd, DI_DIST, colinfo.dist); LoadString(hinst, CS_SM_COLOR, buf, sizeof(buf)); cmb_add(hwnd, DI_SHDMODE, buf); LoadString(hinst, CS_SM_GREY, buf, sizeof(buf)); cmb_add(hwnd, DI_SHDMODE, buf); /* set shading mode */ cmb_set(hwnd, DI_SHDMODE, (colinfo.colcnt > 0) ? 0 : 1); sprintf(buf, "%g", colinfo.coloff); edt_set(hwnd, DI_COLOFF, buf); /* set color offset */ LoadString(hinst, CS_SB_BLACK, buf, sizeof(buf)); cmb_add(hwnd, DI_SHDBASE, buf); LoadString(hinst, CS_SB_WHITE, buf, sizeof(buf)); cmb_add(hwnd, DI_SHDBASE, buf); /* set shade base */ cmb_set(hwnd, DI_SHDBASE, (colinfo.shdbase == SHD_BLACK) ? 0 : 1); int_set(hwnd, DI_SHDCNT, colinfo.shdcnt); sprintf(buf, "%g", colinfo.ndwgt);/* set number of shades */ edt_set(hwnd, DI_NDWGT, buf); /* set weight of distribution */ return 1; case WM_COMMAND: /* command (button pressed etc.) */ switch (wp) { /* evaluate command code */ case IDOK: /* if 'Ok' button pressed */ colinfo.dist = cmb_get(hwnd, DI_DIST); if (nbc) clscnt = nbc_clscnt(nbc); else if (fbc) clscnt = fbc_clscnt(fbc); else clscnt = -1; /* get number of classes */ colinfo.colcnt = (cmb_get(hwnd, DI_SHDMODE) == 0) ? clscnt : 0; /* get shading mode */ edt_get(hwnd, DI_COLOFF, buf, 80); colinfo.coloff = atof(buf); /* get color offset (angle) */ colinfo.shdbase = (cmb_get(hwnd, DI_SHDBASE) == 0) ? SHD_BLACK : SHD_WHITE; /* get shade base */ colinfo.shdcnt = int_get(hwnd, DI_SHDCNT); if (colinfo.shdcnt < 1) colinfo.shdcnt = 1; if (colinfo.shdcnt > SHD_MAXCNT) colinfo.shdcnt = SHD_MAXCNT; /* get number of shades */ edt_get(hwnd, DI_NDWGT, buf, 80); colinfo.ndwgt = atof(buf); /* get weight of Gaussian */ if (colinfo.ndwgt < 0) colinfo.ndwgt = 0; if (colinfo.ndwgt > 1) colinfo.ndwgt = 1; colinfo.cowgt = 1 -colinfo.ndwgt; if (col_create() != 0)/* create new color shades */ error(E_COLOR); /* and marker colors */ EndDialog(hwnd, 0); /* and terminate the dialog */ return 1; case IDCANCEL: /* if 'Cancel' button pressed, */ EndDialog(hwnd, -1); return 1; /* terminate dialog */ } break; case WM_CLOSE: /* dialog box has been closed */ EndDialog(hwnd, -1); return 1; /* terminate dialog */ } return 0; /* everything else not handled */} /* dp_colors() *//*--------------------------------------------------------------------*/BOOL CALLBACK dp_marks (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp){ /* --- markers dialog box procedure */ switch (msg) { /* evaluate message */ case WM_INITDIALOG: /* dialog initialization */ chk_set(hwnd, DI_DATA, (mrkflgs & MRK_DATA) ? 1 : 0); chk_set(hwnd, DI_COLOR, (mrkflgs & MRK_COLOR) ? 1 : 0); chk_set(hwnd, DI_CENTER, (mrkflgs & MRK_CENTER) ? 1 : 0); chk_set(hwnd, DI_ELL1S, (mrkflgs & MRK_ELL1S) ? 1 : 0); chk_set(hwnd, DI_ELL2S, (mrkflgs & MRK_ELL2S) ? 1 : 0); chk_set(hwnd, DI_ELL3S, (mrkflgs & MRK_ELL3S) ? 1 : 0); sprintf(buf, "%d", mrksize); edt_set(hwnd, DI_SIZE, buf); return 1; /* set defaults from marker flags */ case WM_COMMAND: /* command (button pressed etc.) */ switch (wp) { /* evaluate command code */ case IDOK: /* if 'Ok' button pressed */ if (chk_get(hwnd, DI_DATA)) mrkflgs |= MRK_DATA; else mrkflgs &= ~MRK_DATA; if (chk_get(hwnd, DI_COLOR)) mrkflgs |= MRK_COLOR; else mrkflgs &= ~MRK_COLOR; if (chk_get(hwnd, DI_CENTER)) mrkflgs |= MRK_CENTER; else mrkflgs &= ~MRK_CENTER; if (chk_get(hwnd, DI_ELL1S)) mrkflgs |= MRK_ELL1S; else mrkflgs &= ~MRK_ELL1S; if (chk_get(hwnd, DI_ELL2S)) mrkflgs |= MRK_ELL2S; else mrkflgs &= ~MRK_ELL2S; if (chk_get(hwnd, DI_ELL3S)) mrkflgs |= MRK_ELL3S; else mrkflgs &= ~MRK_ELL3S; edt_get(hwnd, DI_SIZE, buf, 80); mrksize = atoi(buf); if (mrksize <= 0) mrksize = 1; EndDialog(hwnd, 0); /* get inputs from edit controls */ return 1; /* return 'ok' */ case IDCANCEL: /* if 'Cancel' button pressed, */ EndDialog(hwnd, -1); return 1; /* terminate dialog */ } break; case WM_CLOSE: /* dialog box has been closed */ EndDialog(hwnd, -1); return 1; /* terminate dialog */ } return 0; /* everything else not handled */} /* dp_marks() *//*--------------------------------------------------------------------*/BOOL CALLBACK dp_atts (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp){ /* --- attributes dialog box proc. */ int i; /* loop variable, buffer */ switch (msg) { /* evaluate message */ case WM_INITDIALOG: /* dialog initialization */ if (names) { /* if there are attribute names */ for (i = 0; i < attcnt; i++) cmb_add(hwnd, DI_H_ATT, names[i]); cmb_set(hwnd, DI_H_ATT, attinfo.h_att); } /* add them to the list box */ sprintf(buf, "%g", attinfo.h_rng.min); /* set minimal value */ edt_set(hwnd, DI_H_MIN, buf); /* for horizontal direction */ sprintf(buf, "%g", attinfo.h_rng.max); /* set maximal value */ edt_set(hwnd, DI_H_MAX, buf); /* for horizontal direction */ if (names) { /* if there are attribute names */ for (i = 0; i < attcnt; i++) cmb_add(hwnd, DI_V_ATT, names[i]); cmb_set(hwnd, DI_V_ATT, attinfo.v_att); } /* add them to the list box */ sprintf(buf, "%g", attinfo.v_rng.min); /* set minimal value */ edt_set(hwnd, DI_V_MIN, buf); /* for vertical direction */ sprintf(buf, "%g", attinfo.v_rng.max); /* set maximal value */ edt_set(hwnd, DI_V_MAX, buf); /* for vertical direction */ return 1; /* set defaults from parameter block */ case WM_COMMAND: /* command (button pressed etc.) */ switch (LOWORD(wp)) { /* evaluate command code */ case DI_H_ATT: /* if attribute for horizontal dir. */ if ((HIWORD(wp) != CBN_SELCHANGE) || !ranges) break; /* ignore anything but sel. change */ i = cmb_get(hwnd, DI_H_ATT); /* get new selection */ sprintf(buf, "%g", ranges[i].min); /* set minimal value */ edt_set(hwnd, DI_H_MIN, buf); /* for horizontal dir. */ sprintf(buf, "%g", ranges[i].max); /* set maximal value */ edt_set(hwnd, DI_H_MAX, buf); /* for horizontal dir. */ break; case DI_V_ATT: /* if attribute for vertical dir. */ if ((HIWORD(wp) != CBN_SELCHANGE) || !ranges) break; /* ignore anything but sel. change */ i = cmb_get(hwnd, DI_V_ATT); /* get new selection */ sprintf(buf, "%g", ranges[i].min); /* set minimal value */ edt_set(hwnd, DI_V_MIN, buf); /* for horizontal dir. */ sprintf(buf, "%g", ranges[i].max); /* set maximal value */ edt_set(hwnd, DI_V_MAX, buf); /* for horizontal dir. */ break; case IDOK: /* if 'Ok' button pressed */ attinfo.h_att = cmb_get(hwnd, DI_H_ATT); edt_get(hwnd, DI_H_MIN, buf, 80); /* get horz. min. */ ranges[attinfo.h_att].min = attinfo.h_rng.min = atof(buf); edt_get(hwnd, DI_H_MAX, buf, 80); /* get horz. max. */ ranges[attinfo.h_att].max = attinfo.h_rng.max = atof(buf); attinfo.v_att = cmb_get(hwnd, DI_V_ATT); edt_get(hwnd, DI_V_MIN, buf, 80); /* get vert. min. */ ranges[attinfo.v_att].min = attinfo.v_rng.min = atof(buf); edt_get(hwnd, DI_V_MAX, buf, 80); /* get vert. max. */ ranges[attinfo.v_att].max = attinfo.v_rng.max = atof(buf); EndDialog(hwnd, 0); /* get inputs from edit controls */ return 1; /* return 'ok' */ case IDCANCEL: /* if 'Cancel' button pressed, */ EndDialog(hwnd, -1); return 1; /* terminate dialog */ } break; case WM_CLOSE: /* dialog box has been closed */ EndDialog(hwnd, -1); return 1; /* terminate dialog */ } return 0; /* everything else not handled */} /* dp_atts() *//*--------------------------------------------------------------------*/BOOL CALLBACK dp_about (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp){ /* --- `about
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -