📄 propertydlg.cpp
字号:
{4, 0, 5, CHECKED | ISPARENT, GROUP, NULL, 138, 40, 55, 12},
{5, 6, 100, ISPARENT | CHECKED, SHEET, &tab1, 5, 10, 120, 100},
{6, 7, 200, ISPARENT, SHEET, &tab2, 5, 10, 120, 100},
{7, 0, 300, ISPARENT, SHEET, &tab3, 5, 10, 120, 100},
{100, 109, 0, NOSELECT, ODBUTTON, (void*)OD_filldef, 18, 57, 90, 50},
{109, 110, 0, 0x0L, SYMRADIO, (void *)&syms[0], 30, 30, 20, 20},
{110, 111, 0, 0x0L, SYMRADIO, (void *)&syms[1], 50, 30, 20, 20},
{111, 112, 0, 0x0L, SYMRADIO, (void *)&syms[2], 70, 30, 20, 20},
{112, 0, 0, 0x0L, SYMRADIO, (void *)&syms[3], 90, 30, 20, 20},
{200, 201, 0, 0x0L, LTEXT, (void*)"Sizes are given as", 10, 30, 110, 8},
{201, 202, 210, ISPARENT | CHECKED, GROUP, NULL, 0, 0, 0, 0},
{202, 203, 0, 0x0L, LTEXT, (void*)"Proportionality (relative to circle)", 10, 64, 110, 8},
{203, 0, 220, ISPARENT | CHECKED, GROUP, NULL, 0, 0, 0, 0},
{210, 211, 0, 0x0L, RADIO1, (void *) Units[defs.cUnits].display, 40, 38, 45, 8},
{211, 212, 0, 0x0L, RADIO1, (void*)"scaling with X axis", 40, 46, 45, 8},
{212, 0, 0, 0x0L, RADIO1, (void*)"scaling with Y axis", 40, 54, 45, 8},
{220, 221, 0, 0x0L, RADIO1, (void*)"diameter", 40, 72, 45, 8},
{221, 222, 0, 0x0L, RADIO1, (void*)"circumference", 40, 80, 45, 8},
{222, 0, 0, 0x0L, RADIO1, (void*)"area", 40, 88, 45, 8},
{300, 301, 0, 0x0L, RTEXT, (void*)"x-value", 10, 40, 45, 8},
{301, 302, 0, 0x0L, EDVAL1, &fPos.fx, 60, 40, 35, 10},
{302, 303, 0, 0x0L, RTEXT, (void*)"y-value", 10, 60, 45, 8},
{303, 304, 0, 0x0L, EDVAL1, &fPos.fy, 60, 60, 35, 10},
{304, 305, 0, 0x0L, RTEXT, (void*)"size", 10, 80, 45, 8},
{305, 0, 0, LASTOBJ, EDVAL1, &fs, 60, 80, 35, 10}};
DlgRoot *Dlg;
void *hDlg;
int res, tmpType;
lfPOINT o_pos, n_pos;
LineDEF newLine, newFillLine;
FillDEF newFill;
DWORD undo_flags = 0L;
anyOutput *cdisp = Undo.cdisp;
double o_size, n_size;
bool bRet = false;
if(!parent) return false;
OD_filldef(OD_SETLINE, 0L, 0L, 0L, (void *)&BubbleLine, 0);
OD_filldef(OD_SETFILL, 0L, 0L, 0L, (void *)&BubbleFill, 0);
Dlg = new DlgRoot(BubDlg);
switch(type & 0x00f) {
case BUBBLE_SQUARE: Dlg->SetCheck(110, 0L, true); break;
case BUBBLE_UPTRIA: Dlg->SetCheck(111, 0L, true); break;
case BUBBLE_DOWNTRIA: Dlg->SetCheck(112, 0L, true); break;
default: Dlg->SetCheck(109, 0L, true); break;
}
switch(type & 0x0f0) {
case BUBBLE_XAXIS: Dlg->SetCheck(211, 0L, true); break;
case BUBBLE_YAXIS: Dlg->SetCheck(212, 0L, true); break;
default: Dlg->SetCheck(210, 0L, true); break;
}
switch(type & 0xf00) {
case BUBBLE_CIRCUM: Dlg->SetCheck(221, 0L, true); break;
case BUBBLE_AREA: Dlg->SetCheck(222, 0L, true); break;
default: Dlg->SetCheck(220, 0L, true); break;
}
if(!Dlg->GetValue(301, &o_pos.fx)) o_pos.fx = fPos.fx;
if(!Dlg->GetValue(303, &o_pos.fy)) o_pos.fy = fPos.fy;
if(!Dlg->GetValue(305, &o_size)) o_size = fs;
n_pos.fx = o_pos.fx; n_pos.fy = o_pos.fy; n_size = o_size;
if(parent->name) sprintf(TmpTxt, "Bubble of %s", parent->name);
else strcpy(TmpTxt, "Bubble properties");
hDlg = CreateDlgWnd(TmpTxt, 50, 50, 390, 260, Dlg, 0x0L);
do {
LoopDlgWnd();
res = Dlg->GetResult();
switch(res) {
case 1: //accept for current bubble only
case 2: //accept for plot
Undo.SetDisp(cdisp);
OD_filldef(OD_GETLINE, 0L, 0L, 0L, (void *)&newLine, 0);
OD_filldef(OD_GETFILL, 0L, 0L, 0L, (void *)&newFill, 0);
memcpy(&newFillLine, &BubbleFillLine, sizeof(LineDEF));
if(newFill.hatch) memcpy(&newFillLine, newFill.hatch, sizeof(LineDEF));
if(Dlg->GetCheck(110)) tmpType = BUBBLE_SQUARE;
else if(Dlg->GetCheck(111)) tmpType = BUBBLE_UPTRIA;
else if(Dlg->GetCheck(112)) tmpType = BUBBLE_DOWNTRIA;
else tmpType = BUBBLE_CIRCLE;
if(Dlg->GetCheck(211)) tmpType |= BUBBLE_XAXIS;
else if(Dlg->GetCheck(212)) tmpType |= BUBBLE_YAXIS;
if(Dlg->GetCheck(221)) tmpType |= BUBBLE_CIRCUM;
else if(Dlg->GetCheck(222)) tmpType |= BUBBLE_AREA;
break;
}
}while (res < 0);
switch (res) {
case 1: //new setting for current bubble only
Dlg->GetValue(301, &n_pos.fx); Dlg->GetValue(303, &n_pos.fy);
undo_flags = CheckNewLFPoint(&fPos, &o_pos, &n_pos, parent, undo_flags);
undo_flags = CheckNewInt(&type, type, tmpType, parent, undo_flags);
Dlg->GetValue(305, &n_size);
undo_flags = CheckNewFloat(&fs, o_size, n_size, parent, undo_flags);
if(cmpLineDEF(&BubbleLine, &newLine)) {
Undo.Line(parent, &BubbleLine, undo_flags); undo_flags |= UNDO_CONTINUE;
memcpy(&BubbleLine, &newLine, sizeof(LineDEF));
}
if(newFill.type && cmpLineDEF(&BubbleFillLine, &newFillLine)) {
Undo.Line(parent, &BubbleFillLine, undo_flags); undo_flags |= UNDO_CONTINUE;
memcpy(&BubbleFillLine, &newFillLine, sizeof(LineDEF));
}
if(cmpFillDEF(&BubbleFill, &newFill)) {
Undo.Fill(parent, &BubbleFill, undo_flags); undo_flags |= UNDO_CONTINUE;
memcpy(&BubbleFill, &newFill, sizeof(FillDEF));
}
BubbleFill.hatch = &BubbleFillLine;
if(undo_flags & UNDO_CONTINUE) bRet = true;
break;
case 2: //accept settings for plot
parent->Command(CMD_SAVE_SYMBOLS, 0L, 0L);
parent->Command(CMD_BUBBLE_TYPE, (void*)(& tmpType), 0L);
parent->Command(CMD_BUBBLE_ATTRIB, (void*)(& tmpType), 0L);
parent->Command(CMD_BUBBLE_FILL, (void*)&newFill, 0L);
parent->Command(CMD_BUBBLE_LINE, (void*)&newLine, 0L);
bRet = true;
break;
}
CloseDlgWnd(hDlg);
delete Dlg;
return bRet;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Bar properties dialog
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bool
Bar::PropertyDlg()
{
TabSHEET tab1 = {0, 50, 10, "Size & Color"};
TabSHEET tab2 = {50, 90, 10, "Baseline"};
TabSHEET tab3 = {90, 120, 10, "Edit"};
char sTxt1[20], sTxt2[20];
DlgInfo BarDlg[] = {
{1, 2, 0, DEFAULT, PUSHBUTTON, (void*)"Apply to BAR", 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, NULL, 138, 40, 55, 12},
{5, 6, 100, ISPARENT | CHECKED, SHEET, &tab1, 5, 10, 120, 120},
{6, 7, 200, ISPARENT, SHEET, &tab2, 5, 10, 120, 120},
{7, 0, 300, ISPARENT, SHEET, &tab3, 5, 10, 120, 120},
{100, 109, 0, NOSELECT, ODBUTTON, (void*)OD_filldef, 18, 30, 90, 50},
{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},
{200, 201, 0, TOUCHEXIT, RADIO2, (void*)"vertical bars", 20, 30, 45, 8},
{201, 205, 202, CHECKED | ISPARENT, GROUP, NULL, 0, 0, 0, 0},
{202, 203, 0, TOUCHEXIT, RADIO1, (void*)"bottom baseline", 30, 40, 35, 8},
{203, 204, 0, TOUCHEXIT, RADIO1, (void*)"top", 30, 48, 35, 8},
{204, 0, 0, TOUCHEXIT, RADIO1, (void*)"user y =", 30, 56, 35, 8},
{205, 206, 0, 0x0L, EDVAL1, &BarBase.fy, 65, 56, 35, 10},
{206, 207, 0, TOUCHEXIT, RADIO2, (void*)"horizontal bars", 20, 70, 45, 8},
{207, 211, 208, CHECKED | ISPARENT, GROUP, NULL, 0, 0, 0, 0},
{208, 209, 0, TOUCHEXIT, RADIO1, (void*)"left baseline", 30, 80, 35, 8},
{209, 210, 0, TOUCHEXIT, RADIO1, (void*)"right", 30, 88, 35, 8},
{210, 0, 0, TOUCHEXIT, RADIO1, (void*)"user x =", 30, 96, 35, 8},
{211, 212, 0, 0x0L, EDVAL1, &BarBase.fx, 65, 96, 35, 10},
{212, 0, 0, 0x0L, CHECKBOX, (void*)"bars centered across baseline", 20, 113, 50, 8},
{300, 301, 0, 0x0L, RTEXT, (void*)"x-value", 10, 50, 45, 8},
{301, 302, 0, 0x0L, EDVAL1, &fPos.fx, 60, 50, 40, 10},
{302, 303, 0, 0x0L, RTEXT, (void*)"y-value", 10, 75, 45, 8},
{303, 0, 0, LASTOBJ, EDVAL1, &fPos.fy, 60, 75, 40, 10}};
DlgRoot *Dlg;
void *hDlg;
double n_size;
int res, tmpType = type;
bool bRet = false;
LineDEF newLine, newFillLine;
FillDEF newFill;
DWORD undo_flags = 0L;
anyOutput *cdisp = Undo.cdisp;
lfPOINT o_bl, n_bl, o_pos, n_pos;
if(!parent) return false;
OD_filldef(OD_SETLINE, 0L, 0L, 0L, (void *)&BarLine, 0);
OD_filldef(OD_SETFILL, 0L, 0L, 0L, (void *)&BarFill, 0);
if(type & BAR_RELWIDTH) {
WriteNatFloatToBuff(sTxt2, size);
WriteNatFloatToBuff(sTxt1, defs.GetSize(SIZE_BAR));
}
else {
WriteNatFloatToBuff(sTxt1, size);
strcpy(sTxt2, " 50");
}
Dlg = new DlgRoot(BarDlg);
switch (type & 0xff) {
case BAR_VERTB: case BAR_VERTT: case BAR_VERTU:
Dlg->SetCheck(200, 0L, true);
Dlg->SetCheck(208, 0L, true);
switch(type & 0xff) {
case BAR_VERTT: Dlg->SetCheck(203, 0L, true); break;
case BAR_VERTU: Dlg->SetCheck(204, 0L, true); break;
default: Dlg->SetCheck(202, 0L, true); break;
}
break;
case BAR_HORL: case BAR_HORR: case BAR_HORU:
Dlg->SetCheck(206, 0L, true);
Dlg->SetCheck(202, 0L, true);
switch(type & 0xff) {
case BAR_HORR: Dlg->SetCheck(209, 0L, true); break;
case BAR_HORU: Dlg->SetCheck(210, 0L, true); break;
default: Dlg->SetCheck(208, 0L, true); break;
}
break;
}
if(type & BAR_RELWIDTH) Dlg->SetCheck(113, 0L, true);
else Dlg->SetCheck(110, 0L, true);
if(type & BAR_CENTERED) Dlg->SetCheck(212, 0L, true);
if(parent && parent->name) sprintf(TmpTxt, "Bar of %s", parent->name);
else strcpy(TmpTxt, "Bar properties");
if(!Dlg->GetValue(211, &o_bl.fx)) o_bl.fx = BarBase.fx;
if(!Dlg->GetValue(205, &o_bl.fy)) o_bl.fy = BarBase.fy;
if(!Dlg->GetValue(301, &o_pos.fx)) o_pos.fx = fPos.fx;
if(!Dlg->GetValue(303, &o_pos.fy)) o_pos.fy = fPos.fy;
n_bl.fx = o_bl.fx; n_bl.fy = o_bl.fy;
n_pos.fx = o_pos.fx; n_pos.fy = o_pos.fy;
n_size = size;
hDlg = CreateDlgWnd(TmpTxt, 50, 50, 390, 296, Dlg, 0x0L);
do {
LoopDlgWnd();
res = Dlg->GetResult();
switch(res) {
case 202: case 203: case 204:
Dlg->SetCheck(200, NULL, true);
tmpType = res == 202 ? BAR_VERTB : res == 203 ? BAR_VERTT : BAR_VERTU;
res = -1; //continue on radiobutton
break;
case 208: case 209: case 210:
Dlg->SetCheck(206, NULL, true);
tmpType = res == 208 ? BAR_HORL : res == 209 ? BAR_HORR : BAR_HORU;
res = -1; //continue on radiobutton
break;
case 200: //group of vertical bars
if(Dlg->GetCheck(203)) tmpType = BAR_VERTT;
else if(Dlg->GetCheck(204)) tmpType = BAR_VERTU;
else tmpType = BAR_VERTB;
res = -1;
break;
case 206: //group of horizontal bars
if(Dlg->GetCheck(209)) tmpType = BAR_HORR;
else if(Dlg->GetCheck(210)) tmpType = BAR_HORU;
else tmpType = BAR_HORL;
res = -1;
break;
case 1:
case 2:
Undo.SetDisp(cdisp);
OD_filldef(OD_GETLINE, 0L, 0L, 0L, (void *)&newLine, 0);
OD_filldef(OD_GETFILL, 0L, 0L, 0L, (void *)&newFill, 0);
memcpy(&newFillLine, &HatchLine, sizeof(LineDEF));
if(newFill.hatch) memcpy(&newFillLine, newFill.hatch, sizeof(LineDEF));
if(Dlg->GetCheck(113)) {
tmpType |= BAR_RELWIDTH; Dlg->GetValue(114, &n_size);
}
else {
tmpType &= ~BAR_RELWIDTH; Dlg->GetValue(111, &n_size);
}
if(Dlg->GetCheck(212))tmpType |= BAR_CENTERED;
else tmpType &= ~BAR_CENTERED;
Dlg->GetValue(211, &n_bl.fx); Dlg->GetValue(205, &n_bl.fy);
Dlg->GetValue(301, &n_pos.fx); Dlg->GetValue(303, &n_pos.fy);
break;
}
}while (res < 0);
switch (res) {
case 1: //new setting for current bar only
undo_flags = CheckNewInt(&type, type, tmpType, parent, undo_flags);
undo_flags = CheckNewLFPoint(&BarBase, &o_bl, &n_bl, parent, undo_flags);
undo_flags = CheckNewLFPoint(&fPos, &o_pos, &n_pos, parent, undo_flags);
if(undo_flags & UNDO_CONTINUE) parent->Command(CMD_MRK_DIRTY, 0L, 0L);
undo_flags = CheckNewFloat(&size, size, n_size, parent, undo_flags);
if(cmpLineDEF(&BarLine, &newLine)) {
Undo.Line(parent, &BarLine, undo_flags); undo_flags |= UNDO_CONTINUE;
memcpy(&BarLine, &newLine, sizeof(LineDEF));
}
if(newFill.type && cmpLineDEF(&HatchLine, &newFillLine)) {
Undo.Line(parent, &HatchLine, undo_flags); undo_flags |= UNDO_CONTINUE;
memcpy(&HatchLine, &newFillLine, sizeof(LineDEF));
}
if(cmpFillDEF(&BarFill, &newFill)) {
Undo.Fill(parent, &BarFill, undo_flags); undo_flags |= UNDO_CONTINUE;
memcpy(&BarFill, &newFill, sizeof(FillDEF));
}
BarFill.hatch = &HatchLine;
if(undo_flags & UNDO_CONTINUE) bRet = true;
break;
case 2: //new settings to all bars of plot
parent->Command(CMD_SAVE_BARS, 0L, 0L);
if(parent->Id == GO_PLOTSCATT && parent->parent
&& parent->parent->Id == GO_STACKBAR){
parent->parent->SetSize(SIZE_BAR, n_size);
parent->parent->Command(CMD_BAR_TYPE, (void *)(& tmpType), 0L);
}
else {
parent->SetSize(SIZE_BAR, n_size);
parent->Command(CMD_BAR_TYPE, (void *)(& tmpType), 0L);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -