📄 odbuttons.cpp
字号:
o->oCircle(rec->right-13, iy-3, rec->right-17, iy+3);
o->oCircle(ix, iy+3, ix+6, iy+9);
o->oCircle(rec->left+12, iy+3, rec->left+18, iy+9);
o->oCircle(ix, rec->bottom-8, ix+6, rec->bottom-12);
#endif
break;
case 561:
o->SetFill(&FillG);
UtilBarDraw(pts, ix+1, rec->top +12, rec->bottom-10, o);
UtilBarDraw(pts, rec->left+16, iy+8, rec->bottom-8, o);
UtilBarDraw(pts, rec->right-12, iy+12, rec->bottom-8, o);
break;
case 562:
o->SetLine(&bLine);
pts[0].x = rec->left+20; pts[0].y = rec->bottom-10;
pts[1].x = rec->right-10; pts[1].y = rec->bottom-16;
o->oSolidLine(pts);
pts[0].x = pts[1].x; pts[0].y = pts[1].y;
pts[1].x -= 8; pts[1].y -= 12;
o->oSolidLine(pts);
pts[0].x = pts[1].x; pts[0].y = pts[1].y;
pts[1].x -= 18; pts[1].y += 3;
o->oSolidLine(pts);
pts[0].x = pts[1].x; pts[0].y = pts[1].y;
pts[1].x += 15; pts[1].y += 4;
o->oSolidLine(pts);
break;
case 563:
o->SetFill(&FillG);
o->oCircle(rec->left+12, rec->bottom-19, rec->left+18, rec->bottom-13);
o->oCircle(ix, iy-10, ix+14, iy+4);
o->oCircle(ix, rec->top+34, ix+10, rec->top+44);
break;
case 564:
o->SetFill(&FillY);
pts[0].x = rec->left+10; pts[0].y = rec->bottom-14;
pts[1].x = pts[0].x; pts[1].y = rec->top +16;
pts[2].x = ix-6; pts[2].y = iy+4;
pts[3].x = pts[2].x; pts[3].y = rec->bottom -10;
pts[4].x = pts[0].x; pts[4].y = pts[0].y;
o->oPolygon(pts, 5, 0L);
pts[0].x = pts[2].x; pts[0].y = pts[2].y;
pts[1].x = pts[3].x; pts[1].y = pts[3].y;
pts[2].x = ix + 3; pts[2].y = pts[1].y -2;
pts[3].x = pts[2].x; pts[3].y = pts[0].y +1;
pts[4].x = pts[0].x; pts[4].y = pts[0].y;
o->oPolygon(pts, 5, 0L);
pts[0].x = pts[2].x; pts[0].y = pts[2].y;
pts[1].x = pts[3].x; pts[1].y = pts[3].y;
pts[2].x = ix + 10; pts[2].y = pts[1].y +9;
pts[3].x = pts[2].x; pts[3].y = pts[0].y +3;
pts[4].x = pts[0].x; pts[4].y = pts[0].y;
o->oPolygon(pts, 5, 0L);
break;
case 565:
o->SetLine(&rLine);
pts[0].x = ix-16; pts[0].y = iy-2;
pts[1].x = ix+4; pts[1].y = iy+6;
for(i = 0; i < 4; i++) {
o->oSolidLine(pts);
pts[0].x += 4; pts[1].x += 4;
pts[0].y -= 4; pts[1].y -= 4;
}
pts[0].x = ix+4; pts[0].y = iy+6;
pts[1].x -= 2; pts[1].y += 4;
for(i = 0; i < 5; i++) {
o->oSolidLine(pts);
pts[0].x -= 5; pts[1].x -= 5;
pts[0].y -= 2; pts[1].y -= 2;
}
memcpy(&td, &o->TxtSet, sizeof(TextDEF));
memcpy(&otd, &o->TxtSet, sizeof(TextDEF));
td.Align = TXA_HCENTER | TXA_VTOP;
td.Style = TXS_NORMAL;
td.Mode = TXM_TRANSPARENT;
td.ColTxt = 0x00c00000L;
o->SetTextSpec(&td);
o->oTextOut(ix, iy+4, "f(x,z)", 0);
o->SetTextSpec(&otd);
break;
}
o->UpdateRect(rec, false);
break;
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Execute axis templates as owner drawn buttons
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void OD_AxisTempl(int cmd, void *par, RECT *rec, anyOutput *o,
void *data, int id)
{
LineDEF Line = {0.0, 1.0, 0x0L, 0x0L};
LineDEF Grid = {0.0, 1.0, 0x00c0c0c0, 0x0L};
FillDEF Fill = {FILL_NONE, 0x00ffffffL, 1.0, 0L};
POINT pts[5];
int i, ty, tx, sx;
switch(cmd) {
case OD_DRAWNORMAL:
case OD_DRAWSELECTED:
Line.color = cmd == OD_DRAWSELECTED ? 0x00000000L : 0x00e8e8e8L;
Fill.color = cmd == OD_DRAWSELECTED ? 0x00ffffffL : 0x00e8e8e8L;
o->SetLine(&Line);
pts[0].x = pts[3].x = pts[4].x = rec->left;
pts[0].y = pts[1].y = pts[4].y = rec->top;
pts[1].x = pts[2].x = rec->right-1;
pts[2].y = pts[3].y = rec->bottom-1;
o->oPolyline(pts, 5);
Line.color = 0x00000000L;
o->SetLine(&Line);
o->SetFill(&Fill);
o->oRectangle(rec->left+3, rec->top+3, rec->right-3, rec->bottom-3);
tx = ty = 0;
switch(id) {
case 310:
o->oRectangle(rec->left+10, rec->top+6, rec->right-6, rec->bottom-10);
ty = rec->bottom -10; tx = rec->left+8;
break;
case 311:
o->oRectangle(rec->left+10, rec->top+6, rec->right-6, rec->bottom-10);
pts[0].x = rec->left+10; pts[1].x = rec->right-6;
pts[0].y = pts[1].y = rec->bottom-32;
o->oSolidLine(pts);
pts[0].y = rec->top+6; pts[1].y = rec->bottom-10;
pts[0].x = pts[1].x = rec->left + 32;
o->oSolidLine(pts);
ty = rec->bottom -31; tx = rec->left+30;
break;
case 312:
pts[0].x = rec->left+10; pts[1].x = rec->right-6;
pts[0].y = pts[1].y = rec->bottom-11;
o->oSolidLine(pts);
pts[0].y = rec->top+6; pts[1].y = rec->bottom-10;
pts[0].x = pts[1].x = rec->left + 10;
o->oSolidLine(pts);
ty = rec->bottom -10; tx = rec->left+8;
break;
case 313:
pts[0].x = rec->left+10; pts[1].x = rec->right-6;
pts[0].y = pts[1].y = rec->top + 9;
o->oSolidLine(pts);
pts[0].y = rec->top+10; pts[1].y = rec->bottom-10;
pts[0].x = pts[1].x = rec->left + 10;
o->oSolidLine(pts);
ty = rec->top+7; tx = rec->left+8;
break;
case 314:
pts[0].x = rec->left+10; pts[1].x = rec->right-6;
pts[0].y = pts[1].y = rec->bottom-11;
o->oSolidLine(pts);
pts[0].y = rec->top+6; pts[1].y = rec->bottom-10;
pts[0].x = pts[1].x = rec->left + 27;
o->oSolidLine(pts);
ty = rec->bottom -10; tx = rec->left+25;
break;
}
if(ODtickstyle & 0x300) {
o->SetLine(&Grid);
pts[0].y = rec->top+7; pts[1].y = rec->bottom-11;
if(id == 313) pts[0].y +=3;
if(ODtickstyle & 0x100) for(i = rec->left+16; i < rec->right-6; i+=12) {
pts[0].x = pts[1].x = i;
o->oSolidLine(pts);
}
pts[0].x = rec->left+11; pts[1].x = rec->right-7;
if(ODtickstyle & 0x200)
for(i = rec->bottom- (id == 313 ? 11 : 17); i > rec->top+6; i -=12) {
pts[0].y = pts[1].y = i;
o->oSolidLine(pts);
}
o->SetLine(&Line);
}
if(tx != ty) {
sx = 2;
switch(ODtickstyle & 0x03){
case 1:
if(id == 313) ty += 3;
else ty -= 3;
tx += 3;
break;
case 2:
if(id == 313) ty += 1;
else ty -= 2;
tx += 1;
#ifdef _WINDOWS
sx = 3;
#endif
break;
default:
break;
}
pts[0].y = ty; pts[1].y = ty+sx;
for(i = rec->left+10; i < rec->right-6; i+=6) {
pts[0].x = pts[1].x = i;
o->oSolidLine(pts);
}
pts[0].x = tx; pts[1].x = tx+sx;
for(i = rec->bottom-11; i > rec->top+6; i -=6) {
pts[0].y = pts[1].y = i;
o->oSolidLine(pts);
}
}
o->UpdateRect(rec, false);
break;
}
}
void OD_AxisTempl3D(int cmd, void *par, RECT *rec, anyOutput *o,
void *data, int id)
{
LineDEF Line = {0.0, 1.0, 0x0L, 0x0L};
FillDEF Fill = {FILL_NONE, 0x00ffffffL, 1.0, 0L};
POINT pts[5];
int x, y;
switch(cmd) {
case OD_DRAWNORMAL:
case OD_DRAWSELECTED:
Line.color = cmd == OD_DRAWSELECTED ? 0x00000000L : 0x00e8e8e8L;
Fill.color = cmd == OD_DRAWSELECTED ? 0x00ffffffL : 0x00e8e8e8L;
o->SetLine(&Line);
pts[0].x = pts[3].x = pts[4].x = rec->left;
pts[0].y = pts[1].y = pts[4].y = rec->top;
pts[1].x = pts[2].x = rec->right-1;
pts[2].y = pts[3].y = rec->bottom-1;
o->oPolyline(pts, 5);
Line.color = 0x00000000L;
o->SetLine(&Line); o->SetFill(&Fill);
o->oRectangle(rec->left+3, rec->top+3, rec->right-3, rec->bottom-3);
Line.color = cmd == OD_DRAWSELECTED ? 0x00c0c0c0L : 0x0L;
o->SetLine(&Line); o->SetFill(&Fill);
switch(id) {
case 410: case 411:
pts[0].x = rec->left+20; pts[0].y = rec->bottom-14;
pts[1].x = rec->left+10; pts[1].y = rec->bottom-10;
o->oSolidLine(pts);
pts[1].x = rec->right-10; pts[1].y = pts[0].y + 3;
o->oSolidLine(pts);
pts[1].x = pts[0].x; pts[1].y = rec->top+8;
o->oSolidLine(pts);
if(id == 411) {
pts[0].x = rec->left+10; pts[0].y = rec->top+12;
o->oSolidLine(pts);
pts[0].x = rec->right-10; pts[0].y = pts[1].y + 3;
o->oSolidLine(pts);
pts[1].x = pts[0].x; pts[1].y = rec->bottom-11;
o->oSolidLine(pts);
pts[0].x = rec->right-20; pts[0].y = rec->bottom-7;
o->oSolidLine(pts);
pts[1].x = rec->left+10; pts[1].y = rec->bottom-10;
o->oSolidLine(pts);
pts[0].x = rec->left+10; pts[0].y = rec->top+12;
o->oSolidLine(pts);
}
break;
case 412:
x = (rec->right+rec->left)>>1; y = (rec->top+rec->bottom)>>1;
pts[0].x = rec->left+14; pts[0].y = y+4;
pts[1].x = rec->right-14; pts[1].y = y-2;
o->oSolidLine(pts);
pts[1].y += 6; pts[0].y -= 6; pts[1].x +=4; pts[0].x -=4;
o->oSolidLine(pts);
pts[0].x = pts[1].x = x; pts[0].y = y-15; pts[1].y = y+15;
o->oSolidLine(pts);
}
o->UpdateRect(rec, false);
Line.color = 0x00000000L; o->SetLine(&Line);
break;
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Execute axis templates for new axis as owner drawn buttons
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void OD_NewAxisTempl(int cmd, void *par, RECT *rec, anyOutput *o,
void *data, int id)
{
LineDEF Line = {0.0, 1.0, 0x0L, 0x0L};
FillDEF Fill = {FILL_NONE, 0x00ffffffL, 1.0, 0L};
POINT pts[5];
int i, ix, iy, step, d1, d2;
switch(cmd) {
case OD_DRAWNORMAL:
case OD_DRAWSELECTED:
Line.color = cmd == OD_DRAWSELECTED ? 0x00000000L : 0x00e8e8e8L;
Fill.color = cmd == OD_DRAWSELECTED ? 0x00ffffffL : 0x00e8e8e8L;
o->SetLine(&Line);
ix = (rec->right + rec->left)>>1;
iy = (rec->bottom + rec->top)>>1;
pts[0].x = pts[3].x = pts[4].x = rec->left;
pts[0].y = pts[1].y = pts[4].y = rec->top;
pts[1].x = pts[2].x = rec->right-1;
pts[2].y = pts[3].y = rec->bottom-1;
o->oPolyline(pts, 5);
Line.color = 0x00000000L;
o->SetLine(&Line);
o->SetFill(&Fill);
o->oRectangle(rec->left+3, rec->top+3, rec->right-3, rec->bottom-3);
d1 = d2 = 0;
switch(id) {
case 201: d1 = -6; d2 = -2;
case 202: d2 -= 14;
case 203: d1 += 6; d2 += 3;
case 204:
d1 = d1 + ix -3; d2 = d2 + ix +4;
pts[0].x = pts[1].x = ix;
pts[0].y = rec->top +9; pts[1].y = rec->bottom -9;
step = ((pts[1].y - pts[0].y)/5)+1;
o->oSolidLine(pts);
pts[0].x = d1; pts[1].x = ix;
for(i = rec->top +11; i <= rec->bottom-9; i += step) {
pts[0].y = pts[1].y = i;
o->oSolidLine(pts);
o->oRectangle(d2, i-1, d2+4, i+1);
}
break;
case 205: d1 = 6; d2 = 3;
case 206: d2 += 10;
case 207: d1 -= 6; d2 -= 3;
case 208:
d1 = d1 + iy +3; d2 = d2 + iy - 4;
pts[0].y = pts[1].y = iy;
pts[0].x = rec->left +9; pts[1].x = rec->right -9;
step = ((pts[1].x - pts[0].x)/4)+1;
o->oSolidLine(pts);
pts[0].y = d1; pts[1].y = iy;
for(i = rec->left +11; i <= rec->right-9; i += step) {
pts[0].x = pts[1].x = i;
o->oSolidLine(pts);
o->oRectangle(i-1, d2, i+2, d2+2);
}
break;
}
o->UpdateRect(rec, false);
break;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -