📄 propertydlg.cpp
字号:
Dlg->GetValue(107, &n_lw); Dlg->GetColor(110, &n_col);
break;
}
}while (res <0);
switch (res) {
case 1: //new setting for current arrow
if(n_pos1.fx != o_pos1.fx || n_pos1.fy != o_pos1.fy ||
n_pos2.fx != o_pos2.fx || n_pos2.fy != o_pos2.fy){
Command(CMD_SAVEPOS, 0L, 0L); undo_flags |= UNDO_CONTINUE;
memcpy(&pos1, &n_pos1, sizeof(lfPOINT)); memcpy(&pos2, &n_pos2, sizeof(lfPOINT));
if(!(type & ARROW_UNITS)) parent->Command(CMD_MRK_DIRTY, 0L, 0L);
}
if((type & 0xff) != (tmptype & 0xff)){
Undo.ValInt(this, &type, undo_flags);
type &= ~0xff; type |= (tmptype & 0xff); undo_flags |= UNDO_CONTINUE;
}
undo_flags = CheckNewFloat(&cw, o_cw, n_cw, this, undo_flags);
undo_flags = CheckNewFloat(&cl, o_cl, n_cl, this, undo_flags);
undo_flags = CheckNewFloat(&LineDef.width, o_lw, n_lw, this, undo_flags);
undo_flags = CheckNewDword(&LineDef.color, o_col, n_col, this, undo_flags);
if(undo_flags & UNDO_CONTINUE) bModified = true;
bRet = true;
break;
case 2: //new settings to all arrows of plot
if(parent->Id >= GO_PLOT && parent->Id < GO_GRAPH) {
parent->Command(CMD_SAVE_ARROWS, 0L, 0L);
if(Dlg->GetCheck(308)) parent->Command(CMD_ARROW_ORG, &n_pos1, 0L);
parent->SetSize(SIZE_ARROW_LINE, n_lw);
parent->SetSize(SIZE_ARROW_CAPWIDTH, n_cw);
parent->SetSize(SIZE_ARROW_CAPLENGTH, n_cl);
parent->SetColor(COL_ARROW, n_col);
parent->Command(CMD_ARROW_TYPE, &tmptype, 0L);
bRet = true;
}
break;
case 3: //Cancel
Undo.SetDisp(cdisp);
if(*Undo.pcb > undo_level) { //restore plot order
while(*Undo.pcb > undo_level) Undo.Restore(false, 0L);
bRet = true;
}
break;
}
CloseDlgWnd(hDlg);
delete Dlg;
return bRet;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Box properties dialog
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bool
Box::PropertyDlg()
{
TabSHEET tab1 = {0, 50, 10, "Size & Color"};
TabSHEET tab2 = {50, 90, 10, "Edit"};
char sTxt1[20], sTxt2[20];
DlgInfo BoxDlg[] = {
{1, 2, 0, DEFAULT, PUSHBUTTON, (void*)"Apply to BOX", 130, 10, 55, 12},
{2, 3, 0, 0x0L, PUSHBUTTON, (void*)"Apply to PLOT", 130, 25, 55, 12},
{3, 4, 0, 0x0L, PUSHBUTTON, (void*)"Cancel", 130, 40, 55, 12},
{4, 0, 5, CHECKED | ISPARENT, GROUP, 0L, 138, 40, 55, 12},
{5, 6, 100, ISPARENT | CHECKED, SHEET, &tab1, 5, 10, 120, 115},
{6, 0, 300, ISPARENT, SHEET, &tab2, 5, 10, 120, 115},
{100, 105, 0, NOSELECT, ODBUTTON, (void*)OD_filldef, 8, 30, 90, 50},
{105, 0, 109, CHECKED | ISPARENT, GROUP, 0L, 0, 0, 0, 0},
{109, 110, 0, 0x0L, LTEXT, (void*)"bar width:", 10, 80, 45, 8},
{110, 111, 0, 0x0L, RADIO1, (void*)" fixed", 20, 92, 25, 8},
{111, 112, 0, 0x0L, EDTEXT, &sTxt1[1], 60, 92, 25, 10},
{112, 113, 0, 0x0L, LTEXT, (void *) Units[defs.cUnits].display, 87, 92, 20, 8},
{113, 114, 0, 0x0L, RADIO1, (void*)" relative", 20, 104, 25, 8},
{114, 115, 0, 0x0L, EDTEXT, &sTxt2[1], 60, 104, 25, 10},
{115, 0, 0, 0x0L, LTEXT, (void*)"%", 87, 104, 10, 8},
{300, 301, 0, 0x0L, RTEXT, (void*)"point 1 x", 15, 40, 28, 8},
{301, 302, 0, 0x0L, EDVAL1, &pos1.fx, 46, 40, 35, 10},
{302, 303, 0, 0x0L, RTEXT, (void*)"y", 15, 52, 28, 8},
{303, 304, 0, 0x0L, EDVAL1, &pos1.fy, 46, 52, 35, 10},
{304, 305, 0, 0x0L, RTEXT, (void*)"point 2 x", 15, 70, 28, 8},
{305, 306, 0, 0x0L, EDVAL1, &pos2.fx, 46, 70, 35, 10},
{306, 307, 0, 0x0L, RTEXT, (void*)"y", 15, 82, 28, 8},
{307, 308, 0, 0x0L, EDVAL1, &pos2.fy, 46, 82, 35, 10},
{308, 309, 0, HIDDEN, RTEXT, (void*)"box width", 15, 100, 28, 8},
{309, 0, 0, HIDDEN | LASTOBJ, EDVAL1, &size, 46, 100, 35, 10},
};
DlgRoot *Dlg;
void *hDlg;
int res, tmpType = type;
FillDEF newFill;
LineDEF newLine, newHatchLine;
DWORD undo_flags = 0L;
anyOutput *cdisp = Undo.cdisp;
lfPOINT n_pos;
double tmpVal, o_size, n_size;
bool bRet = false;
GraphObj *ppar = parent;
if(!parent) return false;
memcpy(&newHatchLine, &Hatchline, sizeof(LineDEF));
OD_filldef(OD_SETLINE, 0L, 0L, 0L, (void *)&Outline, 0);
OD_filldef(OD_SETFILL, 0L, 0L, 0L, (void *)&Fill, 0);
if(type & BAR_RELWIDTH) {
WriteNatFloatToBuff(sTxt2, size);
WriteNatFloatToBuff(sTxt1, defs.GetSize(SIZE_BAR));
}
else {
WriteNatFloatToBuff(sTxt1, size);
strcpy(sTxt2, " 50");
}
Dlg = new DlgRoot(BoxDlg);
if(type & BAR_WIDTHDATA) {
Dlg->ShowItem(105, false);
Dlg->ShowItem(308, true); Dlg->ShowItem(309, true);
}
if(type & BAR_RELWIDTH) Dlg->SetCheck(113, 0L, true);
else Dlg->SetCheck(110, 0L, true);
if(parent && parent->name) sprintf(TmpTxt, "Box of %s", parent->name);
else strcpy(TmpTxt, "Box properties");
Dlg->GetValue(309, &o_size);
hDlg = CreateDlgWnd(TmpTxt, 50, 50, 390, 290, Dlg, 0x0L);
do {
LoopDlgWnd();
res = Dlg->GetResult();
switch (res) {
case 1: //accept for this object
case 2: // or all objects of plot
Undo.SetDisp(cdisp);
OD_filldef(OD_GETLINE, 0L, 0L, 0L, (void *)&newLine, 0);
OD_filldef(OD_GETFILL, 0L, 0L, 0L, (void *)&newFill, 0);
if(newFill.hatch) memcpy(&newHatchLine, newFill.hatch, sizeof(LineDEF));
newFill.hatch = &newHatchLine;
if(type & BAR_WIDTHDATA) Dlg->GetValue(309, &n_size);
else {
if(Dlg->GetCheck(113)) {
tmpType |= BAR_RELWIDTH;
Dlg->GetValue(114, &n_size);
}
else {
tmpType &= ~BAR_RELWIDTH;
Dlg->GetValue(111, &n_size);
}
}
break;
}
}while (res < 0);
switch (res) {
case 1: //new setting for current box
if(cmpLineDEF(&Outline, &newLine)) {
Undo.Line(parent, &Outline, undo_flags); undo_flags |= UNDO_CONTINUE;
memcpy(&Outline, &newLine, sizeof(LineDEF));
}
if(newFill.type && cmpLineDEF(&Hatchline, &newHatchLine)) {
Undo.Line(parent, &Hatchline, undo_flags); undo_flags |= UNDO_CONTINUE;
memcpy(&Hatchline, &newHatchLine, sizeof(LineDEF));
}
if(cmpFillDEF(&Fill, &newFill)) {
Undo.Fill(parent, &Fill, undo_flags); undo_flags |= UNDO_CONTINUE;
memcpy(&Fill, &newFill, sizeof(FillDEF));
}
Fill.hatch = &Hatchline;
if(Dlg->GetValue(301, &tmpVal)) n_pos.fx = tmpVal;
else n_pos.fx = pos1.fx;
if(Dlg->GetValue(303, &tmpVal)) n_pos.fy = tmpVal;
else n_pos.fy = pos1.fy;
undo_flags = CheckNewLFPoint(&pos1, &pos1, &n_pos, parent, undo_flags);
if(Dlg->GetValue(305, &tmpVal)) n_pos.fx = tmpVal;
else n_pos.fx = pos2.fx;
if(Dlg->GetValue(307, &tmpVal)) n_pos.fy = tmpVal;
else n_pos.fy = pos2.fy;
undo_flags = CheckNewLFPoint(&pos2, &pos2, &n_pos, parent, undo_flags);
undo_flags = CheckNewFloat(&size, o_size, n_size, parent, undo_flags);
if(undo_flags & UNDO_CONTINUE) bRet = true;
break;
case 2: //new settings to all boxes of plot
if(type != tmpType || Outline.width != newLine.width || o_size != n_size) {
Undo.ValInt(this, &type, 0L); //dummy: all following have UNDO_CONTINUE
undo_flags |= UNDO_CONTINUE;
if(parent->parent && parent->parent->Id == GO_STACKBAR) ppar = parent->parent;
}
else if(newLine.color != Outline.color || cmpFillDEF(&Fill, &newFill)) {
Undo.ValInt(this, &type, 0L); //dummy: all following have UNDO_CONTINUE
}
ppar->Command(CMD_SAVE_BARS_CONT, 0L, 0L);
ppar->Command(CMD_BOX_TYPE, (void*)(& tmpType), 0L);
ppar->SetSize(SIZE_BOX_LINE, newLine.width);
ppar->SetSize(SIZE_BOX, n_size);
parent->SetColor(COL_BOX_LINE, newLine.color);
parent->Command(CMD_BOX_FILL, &newFill, 0L);
bRet = true;
break;
}
CloseDlgWnd(hDlg);
delete Dlg;
return bRet;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Whisker properties dialog
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bool
Whisker::PropertyDlg()
{
TabSHEET tab1 = {0, 38, 10, "Whisker"};
TabSHEET tab2 = {65, 90, 10, "Edit"};
TabSHEET tab3 = {38, 65, 10, "Style"};
DlgInfo ErrDlg[] = {
{1, 2, 0, DEFAULT, PUSHBUTTON, (void*)"Apply to WHISKER", 100, 10, 64, 12},
{2, 3, 0, 0x0L, PUSHBUTTON, (void*)"Apply to PLOT", 100, 25, 64, 12},
{3, 4, 0, 0x0L, PUSHBUTTON, (void*)"Cancel", 100, 40, 64, 12},
{4, 0, 5, ISPARENT | CHECKED, GROUP, 0L, 138, 40, 55, 12},
{5, 6, 100, ISPARENT | CHECKED, SHEET, &tab1, 5, 10, 90, 100},
{6, 7, 500, ISPARENT, SHEET, &tab3, 5, 10, 90, 100},
{7, 0, 300, ISPARENT, SHEET, &tab2, 5, 10, 90, 100},
{100, 101, 0, 0x0L, RTEXT, (void*)"cap width", 15, 40, 28, 8},
{101, 102, 0, 0x0L, EDVAL1, &size, 46, 40, 25, 10},
{102, 103, 0, 0x0L, LTEXT, (void *) Units[defs.cUnits].display, 73, 40, 20, 8},
{103, 104, 0, 0x0L, RTEXT, (void*)"line width", 15, 55, 28, 8},
{104, 105, 0, 0x0L, EDVAL1, &LineDef.width, 46, 55, 25, 10},
{105, 106, 0, 0x0L, LTEXT, (void *) Units[defs.cUnits].display, 73, 55, 20, 8},
{106, 107, 0, 0x0L, RTEXT, (void*)"line color", 15, 70, 28, 8},
{107, 0, 0, OWNDIALOG, COLBUTTON, (void *)LineDef.color, 46, 70, 25, 10},
{300, 301, 0, 0x0L, RTEXT, (void*)"point 1 x", 15, 40, 28, 8},
{301, 302, 0, 0x0L, EDVAL1, &pos1.fx, 46, 40, 35, 10},
{302, 303, 0, 0x0L, RTEXT, (void*)"y", 15, 52, 28, 8},
{303, 304, 0, 0x0L, EDVAL1, &pos1.fy, 46, 52, 35, 10},
{304, 305, 0, 0x0L, RTEXT, (void*)"point 2 x", 15, 70, 28, 8},
{305, 306, 0, 0x0L, EDVAL1, &pos2.fx, 46, 70, 35, 10},
{306, 307, 0, 0x0L, RTEXT, (void*)"y", 15, 82, 28, 8},
{307, 0, 0, 0x0L, EDVAL1, &pos2.fy, 46, 82, 35, 10},
{500, 501, 0, TOUCHEXIT | ISRADIO, ODBUTTON, (void*)(OD_WhiskerTempl),32,40,18,18},
{501, 502, 0, TOUCHEXIT | ISRADIO, ODBUTTON, (void*)(OD_WhiskerTempl), 14, 40, 18, 18},
{502, 503, 0, TOUCHEXIT | ISRADIO, ODBUTTON, (void*)(OD_WhiskerTempl), 50, 40, 18, 18},
{503, 504, 0, TOUCHEXIT | ISRADIO, ODBUTTON, (void*)(OD_WhiskerTempl), 68, 40, 18, 18},
{504, 0, 0, LASTOBJ, LTEXT, (void*)"select style:", 14, 30, 30, 9}};
DlgRoot *Dlg;
void *hDlg;
int res, tmp_type;
DWORD undo_flags = 0L, n_col = LineDef.color;
anyOutput *cdisp = Undo.cdisp;
lfPOINT n_pos;
double tmpVal, o_size, n_size, o_lw, n_lw;
bool bRet = false;
if(!parent) return false;
tmp_type = type;
Dlg = new DlgRoot(ErrDlg);
Dlg->SetCheck(500 + (tmp_type & 0x03), 0L, true);
Dlg->GetValue(101, &o_size); Dlg->GetValue(104, &o_lw);
if(parent && parent->name) sprintf(TmpTxt, "Whisker of %s", parent->name);
else strcpy(TmpTxt, "Whisker properties");
hDlg = CreateDlgWnd(TmpTxt, 50, 50, 339, 260, Dlg, 0x0L);
do {
LoopDlgWnd();
res = Dlg->GetResult();
switch (res) {
case 500: case 501: case 502: case 503:
tmp_type &= ~0x0f; tmp_type |= (res-500); res = -1;
break;
case 1: //accept for this object
case 2: // or all objects of plot
Undo.SetDisp(cdisp); Dlg->GetValue(101, &n_size);
Dlg->GetValue(104, &n_lw); Dlg->GetColor(107, &n_col);
break;
}
}while (res <0);
switch (res) {
case 1: //new setting for current whisker
if(Dlg->GetValue(301, &tmpVal)) n_pos.fx = tmpVal;
else n_pos.fx = pos1.fx;
if(Dlg->GetValue(303, &tmpVal)) n_pos.fy = tmpVal;
else n_pos.fy = pos1.fy;
undo_flags = CheckNewLFPoint(&pos1, &pos1, &n_pos, parent, undo_flags);
if(Dlg->GetValue(305, &tmpVal)) n_pos.fx = tmpVal;
else n_pos.fx = pos2.fx;
if(Dlg->GetValue(307, &tmpVal)) n_pos.fy = tmpVal;
else n_pos.fy = pos2.fy;
undo_flags = CheckNewLFPoint(&pos2, &pos2, &n_pos, parent, undo_flags);
undo_flags = CheckNewFloat(&size, o_size, n_size, parent, undo_flags);
undo_flags = CheckNewInt(&type, type, tmp_type, parent, undo_flags);
undo_flags = CheckNewFloat(&LineDef.width, o_lw, n_lw, parent, undo_flags);
undo_flags = CheckNewDword(&LineDef.color, LineDef.color, n_col, parent, undo_flags);
if(undo_flags & UNDO_CONTINUE) bRet = true;
break;
case 2: //new settings to all whiskers of plot
if(o_size == n_size && type == tmp_type && o_lw == n_lw
&& n_col == LineDef.color) break;
parent->Command(CMD_SAVE_ERRS, 0L, 0L);
parent->SetSize(SIZE_WHISKER, n_size);
parent->SetSize(SIZE_WHISKER_LINE, n_lw);
parent->SetColor(COL_WHISKER, n_col);
parent->Command(CMD_WHISKER_STYLE, &tmp_type, 0L);
bRet = true;
break;
}
CloseDlgWnd(hDlg);
delete Dlg;
return bRet;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -