465
465
} else if(!_wcsnicmp(start, L"b", c - start)) {
466
format_push(s,d, HTW_DEFAULT, FV_BOLD, HTW_DEFAULT);
466
format_push(s,d, HTW_DEFAULT, FV_BOLD, (COLORREF) HTW_DEFAULT);
467
467
} else if(!_wcsnicmp(start, L"/b", c - start)) {
469
469
} else if(!_wcsnicmp(start, L"u", c - start)) {
470
format_push(s,d, HTW_DEFAULT, FV_UNDERLINE, HTW_DEFAULT);
470
format_push(s,d, HTW_DEFAULT, FV_UNDERLINE, (COLORREF) HTW_DEFAULT);
471
471
} else if(!_wcsnicmp(start, L"/u", c - start)) {
473
473
} else if(!_wcsnicmp(start, L"i", c - start)) {
474
format_push(s,d, HTW_DEFAULT, FV_ITALIC, HTW_DEFAULT);
474
format_push(s,d, HTW_DEFAULT, FV_ITALIC, (COLORREF) HTW_DEFAULT);
475
475
} else if(!_wcsnicmp(start, L"/i", c - start)) {
477
477
} else if(!_wcsnicmp(start, L"large", c - start)) {
478
format_push(s,d,-MulDiv(HTW_LARGE_SIZE, d->l_pixel_y, 72), HTW_DEFAULT, HTW_DEFAULT);
478
format_push(s,d,-MulDiv(HTW_LARGE_SIZE, d->l_pixel_y, 72), HTW_DEFAULT, (COLORREF) HTW_DEFAULT);
479
479
} else if(!_wcsnicmp(start, L"/large", c - start)) {
481
481
} else if(!_wcsnicmp(start, L"huge", c - start)) {
482
format_push(s,d,-MulDiv(HTW_HUGE_SIZE, d->l_pixel_y, 72), HTW_DEFAULT, HTW_DEFAULT);
482
format_push(s,d,-MulDiv(HTW_HUGE_SIZE, d->l_pixel_y, 72), HTW_DEFAULT, (COLORREF) HTW_DEFAULT);
483
483
} else if(!_wcsnicmp(start, L"/huge", c - start)) {
485
485
} else if(!_wcsnicmp(start, L"center", c - start)) {
610
610
lf.lfEscapement = 0;
611
611
lf.lfOrientation = 0;
612
612
lf.lfWeight = (d->styles[style].variation & FV_BOLD)? FW_BOLD: FW_NORMAL;
613
lf.lfItalic = !!(d->styles[style].variation & FV_ITALIC);
614
lf.lfUnderline = !!(d->styles[style].variation & FV_UNDERLINE);
615
lf.lfStrikeOut = !!(d->styles[style].variation & FV_STRIKEOUT);
613
lf.lfItalic = (BYTE) !!(d->styles[style].variation & FV_ITALIC);
614
lf.lfUnderline = (BYTE) !!(d->styles[style].variation & FV_UNDERLINE);
615
lf.lfStrikeOut = (BYTE) !!(d->styles[style].variation & FV_STRIKEOUT);
616
616
lf.lfCharSet = DEFAULT_CHARSET;
617
617
lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
618
618
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
661
663
DrawEdge(hdc, &r, EDGE_SUNKEN, BF_ADJUST | BF_RECT | BF_FLAT);
664
hbk = CreateSolidBrush(RGB(255,255,255));
666
hbk = GetSysColorBrush(COLOR_WINDOW);
665
667
FillRect(hdc, &r, hbk);
668
hbk = NULL; /* We don't need to destroy system
668
671
/* push the default format */
669
672
format_init(&s_stack);
671
674
d->l_pixel_y = GetDeviceCaps(hdc, LOGPIXELSY);
672
675
format_push(&s_stack,d, -MulDiv(HTW_NORMAL_SIZE, d->l_pixel_y, 72), FV_NONE, RGB(0,0,0));
674
y = d->scroll_top + r.top;
677
y = r.top - d->scroll_top;
676
679
par_start = text;
733
736
x = r.left - d->scroll_left;
735
if(align == ALIGN_CENTER)
736
x += (r.right - r.left)/2 - p_width / 2;
737
else if(align == ALIGN_RIGHT)
738
x += (r.right - r.left) - p_width;
738
if(align == ALIGN_CENTER) {
739
if (r.right - r.left > p_width)
740
x += (r.right - r.left)/2 - p_width / 2;
743
else if(align == ALIGN_RIGHT) {
744
if (r.right - r.left > p_width)
745
x += (r.right - r.left) - p_width;
740
748
/* begin wet run */
777
785
SetTextColor(hdc, format_color(&s_stack));
779
787
GetTextExtentPoint32(hdc, p, (int)(c - p), &s);
780
rd.left = x + p_width - d->scroll_left;
781
rd.top = y - d->scroll_top;
782
rd.right = x + p_width + s.cx - d->scroll_left;
783
rd.bottom = y + l_height - d->scroll_top;
788
rd.left = x + p_width;
790
rd.right = rd.left + s.cx;
791
rd.bottom = rd.top + l_height;
785
if(IntersectRect(&rt, &rd, &r)) {
786
DrawText(hdc, p, (int)(c - p), &rd,
787
DT_BOTTOM | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX);
793
DrawText(hdc, p, (int)(c - p), &rd,
794
DT_BOTTOM | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX);
975
985
d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
981
for(i=0;i<d->max_links;i++) {
992
for(i=0;i<d->max_links;i++) {
1002
SetWindowLongPtr(hwnd, 0, 0);
994
1007
case WM_ERASEBKGND:
1009
HDC hdc = (HDC) wParam;
996
1010
khui_htwnd_data * d;
997
1014
d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);
999
if(d->flags & KHUI_HTWND_TRANSPARENT)
1018
GetClientRect(hwnd, &r);
1019
hbr = GetSysColorBrush(COLOR_WINDOW);
1020
FillRect(hdc, &r, hbr);
1022
/* no need to destroy the brush since it's a system
1030
khui_htwnd_data * d;
1032
d = (khui_htwnd_data *) (LONG_PTR) GetWindowLongPtr(hwnd, 0);
1006
1042
htw_paint(hwnd, uMsg, wParam, lParam);
1009
1045
case WM_SETCURSOR:
1180
1235
if(d->active_link != nl) {
1181
1236
if(d->active_link >= 0) {
1182
if(d->flags & KHUI_HTWND_TRANSPARENT)
1184
HWND parent = GetParent(hwnd);
1186
InvalidateRect(parent, NULL, TRUE);
1237
if(d->flags & KHUI_HTWND_TRANSPARENT) {
1238
HWND parent = GetParent(hwnd);
1240
RECT rdest = d->links[d->active_link]->r;
1242
MapWindowPoints(hwnd, parent, (LPPOINT) &rdest, 2);
1243
InvalidateRect(parent, &rdest, TRUE);
1189
1246
/* although we are invalidating the rect before setting active_link,
1190
1247
WM_PAINT will not be issued until wndproc returns */
1191
1248
InvalidateRect(hwnd, &(d->links[d->active_link]->r), TRUE);
1194
1251
if(d->active_link >= 0) {
1195
1252
/* although we are invalidating the rect before setting active_link,
1196
1253
WM_PAINT will not be issued until wndproc returns */
1197
if(d->flags & KHUI_HTWND_TRANSPARENT)
1199
HWND parent = GetParent(hwnd);
1201
InvalidateRect(parent, NULL, TRUE);
1254
if(d->flags & KHUI_HTWND_TRANSPARENT) {
1255
HWND parent = GetParent(hwnd);
1257
RECT rdest = d->links[d->active_link]->r;
1259
MapWindowPoints(hwnd, parent, (LPPOINT) &rdest, 2);
1260
InvalidateRect(parent, &rdest, TRUE);
1204
1263
InvalidateRect(hwnd, &(d->links[d->active_link]->r), TRUE);