refactor font api
Some checks failed
pyrite-dev/milsko/pipeline/head There was a failure building this commit
Some checks failed
pyrite-dev/milsko/pipeline/head There was a failure building this commit
This commit is contained in:
parent
9fc659b652
commit
0de09207a4
31 changed files with 12209 additions and 6149 deletions
|
|
@ -77,7 +77,7 @@ static void draw(MwWidget handle) {
|
|||
point.x = r.x + r.width / 2;
|
||||
point.y = r.x + r.height / 2;
|
||||
|
||||
MwDrawText(handle, &point, str, 0, MwALIGNMENT_CENTER, text);
|
||||
MwDrawText(handle, NULL, &point, str, MwALIGNMENT_CENTER, text);
|
||||
}
|
||||
|
||||
MwLLFreeColor(text);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ static void draw(MwWidget handle) {
|
|||
p.x = MwDefaultBorderWidth(handle) * 2 + 4;
|
||||
p.y = MwGetInteger(handle, MwNheight) / 2;
|
||||
|
||||
MwDrawText(handle, &p, cb->list[MwGetInteger(handle, MwNvalue)], 0, MwALIGNMENT_BEGINNING, text);
|
||||
MwDrawText(handle, NULL, &p, cb->list[MwGetInteger(handle, MwNvalue)], MwALIGNMENT_BEGINNING, text);
|
||||
}
|
||||
|
||||
r = rc;
|
||||
|
|
@ -115,11 +115,11 @@ static void click(MwWidget handle) {
|
|||
MwLLSetCursor(handle->lowlevel, &MwCursorArrow, &MwCursorArrowMask);
|
||||
|
||||
for(i = 0; i < arrlen(cb->list); i++) {
|
||||
int l = MwTextWidth(handle, cb->list[i]) + MwDefaultBorderWidth(handle) * 2;
|
||||
int l = MwTextWidth(handle, NULL, cb->list[i]) + MwDefaultBorderWidth(handle) * 2;
|
||||
if(l > width) width = l;
|
||||
}
|
||||
|
||||
cb->listbox = MwVaCreateWidget(MwListBoxClass, "listbox", handle, 0, MwGetInteger(handle, MwNheight), width, MwTextHeight(handle, "M") * ent + MwDefaultBorderWidth(handle) * 2 + MwTextHeight(handle, "M") / 4,
|
||||
cb->listbox = MwVaCreateWidget(MwListBoxClass, "listbox", handle, 0, MwGetInteger(handle, MwNheight), width, MwTextHeight(handle, NULL, "M") * ent + MwDefaultBorderWidth(handle) * 2 + MwTextHeight(handle, NULL, "M") / 4,
|
||||
MwNsingleClickSelectable, 1,
|
||||
NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ static void draw(MwWidget handle) {
|
|||
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
|
||||
const char* str = MwGetText(handle, MwNtext);
|
||||
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||
MwFLFont font = MwFLBuildFont(MwFLFlagMonospace);
|
||||
if(str == NULL) str = "";
|
||||
|
||||
r.x = 0;
|
||||
|
|
@ -37,8 +38,8 @@ static void draw(MwWidget handle) {
|
|||
MwDrawWidgetBack(handle, &r, base, 1, 1);
|
||||
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
|
||||
if(str != NULL) {
|
||||
int w = MwTextWidth(handle, "M");
|
||||
int h = MwTextHeight(handle, "M");
|
||||
int w = MwTextWidth(handle, font, "M");
|
||||
int h = MwTextHeight(handle, font, "M");
|
||||
MwPoint p;
|
||||
char* show;
|
||||
int len;
|
||||
|
|
@ -53,7 +54,7 @@ static void draw(MwWidget handle) {
|
|||
|
||||
len = (r.width - p.x * 2) / w;
|
||||
|
||||
if(len >= 0) {
|
||||
if(len > 0) {
|
||||
show = malloc(len * 4 + 1);
|
||||
memset(show, 0, len * 4 + 1);
|
||||
|
||||
|
|
@ -65,13 +66,13 @@ static void draw(MwWidget handle) {
|
|||
for(i = 0; i < MwUTF8Length(str) - start; i++) show[i] = '*';
|
||||
}
|
||||
|
||||
MwDrawText(handle, &p, show, 0, MwALIGNMENT_BEGINNING, text);
|
||||
MwDrawText(handle, font, &p, show, MwALIGNMENT_BEGINNING, text);
|
||||
|
||||
textlen = (t->cursor - 1) % len + 1;
|
||||
for(i = 0; i < textlen; i++) show[i] = 'M';
|
||||
show[i] = 0;
|
||||
|
||||
currc.x = p.x + MwTextWidth(handle, show);
|
||||
currc.x = p.x + MwTextWidth(handle, font, show);
|
||||
currc.y = (r.height - h) / 2;
|
||||
currc.width = 1;
|
||||
currc.height = h;
|
||||
|
|
|
|||
|
|
@ -316,9 +316,9 @@ static void draw(MwWidget handle) {
|
|||
if(align == MwALIGNMENT_CENTER) {
|
||||
p.x = r.width / 2;
|
||||
} else if(align == MwALIGNMENT_BEGINNING) {
|
||||
p.x = MwTextWidth(handle, str) / 2;
|
||||
p.x = MwTextWidth(handle, NULL, str) / 2;
|
||||
} else if(align == MwALIGNMENT_END) {
|
||||
p.x = r.width - MwTextWidth(handle, str) / 2;
|
||||
p.x = r.width - MwTextWidth(handle, NULL, str) / 2;
|
||||
}
|
||||
p.y = r.height / 2;
|
||||
|
||||
|
|
@ -326,11 +326,11 @@ static void draw(MwWidget handle) {
|
|||
|
||||
p.x += 1;
|
||||
p.y += 1;
|
||||
MwDrawText(handle, &p, str, MwGetInteger(handle, MwNbold), MwALIGNMENT_CENTER, shadow);
|
||||
MwDrawText(handle, NULL, &p, str, MwALIGNMENT_CENTER, shadow);
|
||||
|
||||
p.x -= 1;
|
||||
p.y -= 1;
|
||||
MwDrawText(handle, &p, str, MwGetInteger(handle, MwNbold), MwALIGNMENT_CENTER, text);
|
||||
MwDrawText(handle, NULL, &p, str, MwALIGNMENT_CENTER, text);
|
||||
}
|
||||
|
||||
MwLLFreeColor(shadow);
|
||||
|
|
|
|||
|
|
@ -129,8 +129,8 @@ static void frame_mouse_down(MwWidget handle, void* user, void* call) {
|
|||
int h = MwGetInteger(handle, MwNheight);
|
||||
|
||||
st = get_first_entry(handle->parent, lb);
|
||||
for(i = 0; (st + i) < arrlen(lb->list) && i < (h - MwDefaultBorderWidth(handle) * 2) / (MwTextHeight(handle, "M") + Padding) + 2; i++) {
|
||||
if(y <= m->point.y && m->point.y <= (y + MwTextHeight(handle, "M") + Padding)) {
|
||||
for(i = 0; (st + i) < arrlen(lb->list) && i < (h - MwDefaultBorderWidth(handle) * 2) / (MwTextHeight(handle, NULL, "M") + Padding) + 2; i++) {
|
||||
if(y <= m->point.y && m->point.y <= (y + MwTextHeight(handle, NULL, "M") + Padding)) {
|
||||
unsigned long t;
|
||||
int old = MwGetInteger(handle->parent, MwNvalue);
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ static void frame_mouse_down(MwWidget handle, void* user, void* call) {
|
|||
|
||||
lb->click_time = t;
|
||||
}
|
||||
y += MwTextHeight(handle, "M") + Padding;
|
||||
y += MwTextHeight(handle, NULL, "M") + Padding;
|
||||
}
|
||||
|
||||
MwForceRender(lb->frame);
|
||||
|
|
@ -175,11 +175,11 @@ static void frame_mouse_move(MwWidget handle, void* user, void* call) {
|
|||
int h = MwGetInteger(handle, MwNheight);
|
||||
|
||||
st = get_first_entry(handle->parent, lb);
|
||||
for(i = 0; (st + i) < arrlen(lb->list) && i < (h - MwDefaultBorderWidth(handle) * 2) / (MwTextHeight(handle, "M") + Padding) + 2; i++) {
|
||||
if(y <= p->y && p->y <= (y + MwTextHeight(handle, "M") + Padding)) {
|
||||
for(i = 0; (st + i) < arrlen(lb->list) && i < (h - MwDefaultBorderWidth(handle) * 2) / (MwTextHeight(handle, NULL, "M") + Padding) + 2; i++) {
|
||||
if(y <= p->y && p->y <= (y + MwTextHeight(handle, NULL, "M") + Padding)) {
|
||||
MwSetInteger(handle->parent, MwNvalue, st + i);
|
||||
}
|
||||
y += MwTextHeight(handle, "M") + Padding;
|
||||
y += MwTextHeight(handle, NULL, "M") + Padding;
|
||||
}
|
||||
|
||||
MwForceRender(lb->frame);
|
||||
|
|
@ -216,7 +216,7 @@ static void frame_draw(MwWidget handle) {
|
|||
st = get_first_entry(handle->parent, lb);
|
||||
|
||||
area = r.height - MwDefaultBorderWidth(handle) * 2;
|
||||
ent = area / (MwTextHeight(handle, "M") + Padding) + 2;
|
||||
ent = area / (MwTextHeight(handle, NULL, "M") + Padding) + 2;
|
||||
|
||||
for(i = st; i < arrlen(lb->list) && i < st + ent; i++) {
|
||||
int selected = MwGetInteger(handle->parent, MwNvalue) == i ? 1 : 0;
|
||||
|
|
@ -227,20 +227,20 @@ static void frame_draw(MwWidget handle) {
|
|||
r2.x = MwDefaultBorderWidth(handle) + MwGetInteger(handle->parent, MwNleftPadding);
|
||||
r2.y = p.y;
|
||||
r2.width = r.width - r2.x;
|
||||
r2.height = MwTextHeight(handle, "M") + Padding;
|
||||
r2.height = MwTextHeight(handle, NULL, "M") + Padding;
|
||||
MwDrawRect(handle, &r2, text2);
|
||||
handle->bgcolor = text2;
|
||||
}
|
||||
if(lb->list[i].pixmap != NULL) {
|
||||
MwRect r2;
|
||||
int h = (lb->list[i].pixmap->common.height > (MwTextHeight(handle, "M") + Padding)) ? (MwTextHeight(handle, "M") + Padding) : lb->list[i].pixmap->common.height;
|
||||
int h = (lb->list[i].pixmap->common.height > (MwTextHeight(handle, NULL, "M") + Padding)) ? (MwTextHeight(handle, NULL, "M") + Padding) : lb->list[i].pixmap->common.height;
|
||||
r2.x = MwDefaultBorderWidth(handle);
|
||||
r2.y = p.y + (MwTextHeight(handle, "M") + Padding - h) / 2;
|
||||
r2.y = p.y + (MwTextHeight(handle, NULL, "M") + Padding - h) / 2;
|
||||
r2.width = h * lb->list[i].pixmap->common.width / lb->list[i].pixmap->common.height;
|
||||
r2.height = h;
|
||||
MwLLDrawPixmap(handle->lowlevel, &r2, lb->list[i].pixmap);
|
||||
}
|
||||
p.y += (MwTextHeight(handle, "M") + Padding) / 2;
|
||||
p.y += (MwTextHeight(handle, NULL, "M") + Padding) / 2;
|
||||
p.x = MwDefaultBorderWidth(handle) + MwGetInteger(handle->parent, MwNleftPadding);
|
||||
for(j = 0; j < arrlen(lb->list[i].name); j++) {
|
||||
char* t = lb->list[i].name[j];
|
||||
|
|
@ -250,8 +250,8 @@ static void frame_draw(MwWidget handle) {
|
|||
if(t == NULL) t = "";
|
||||
|
||||
str = MwStringDuplicate(t);
|
||||
if(MwUTF8Length(str) > (get_col_width(lb, j) - l) / MwTextWidth(handle, "M")) {
|
||||
int ind = (get_col_width(lb, j) - l) / MwTextWidth(handle, "M");
|
||||
if(MwUTF8Length(str) > (get_col_width(lb, j) - l) / MwTextWidth(handle, NULL, "M")) {
|
||||
int ind = (get_col_width(lb, j) - l) / MwTextWidth(handle, NULL, "M");
|
||||
str[ind] = 0;
|
||||
if(ind > 3) memset(str + ind - 3, '.', 3);
|
||||
}
|
||||
|
|
@ -259,26 +259,26 @@ static void frame_draw(MwWidget handle) {
|
|||
if(j == (arrlen(lb->list[i].name) - 1)) p.x -= MwDefaultBorderWidth(handle);
|
||||
if(arrlen(lb->alignment) <= j || lb->alignment[j] == MwALIGNMENT_BEGINNING) {
|
||||
p.x += 4;
|
||||
MwDrawText(handle, &p, str, 0, MwALIGNMENT_BEGINNING, selected ? base2 : text2);
|
||||
MwDrawText(handle, NULL, &p, str, MwALIGNMENT_BEGINNING, selected ? base2 : text2);
|
||||
p.x -= 4;
|
||||
p.x += get_col_width(lb, j);
|
||||
|
||||
} else if(lb->alignment[j] == MwALIGNMENT_CENTER) {
|
||||
p.x += (get_col_width(lb, j) - l) / 2;
|
||||
MwDrawText(handle, &p, str, 0, MwALIGNMENT_CENTER, selected ? base2 : text2);
|
||||
MwDrawText(handle, NULL, &p, str, MwALIGNMENT_CENTER, selected ? base2 : text2);
|
||||
p.x += (get_col_width(lb, j) - l) / 2;
|
||||
p.x += l;
|
||||
} else if(lb->alignment[j] == MwALIGNMENT_END) {
|
||||
p.x += get_col_width(lb, j);
|
||||
p.x -= 4;
|
||||
MwDrawText(handle, &p, str, 0, MwALIGNMENT_END, selected ? base2 : text2);
|
||||
MwDrawText(handle, NULL, &p, str, MwALIGNMENT_END, selected ? base2 : text2);
|
||||
p.x += 4;
|
||||
}
|
||||
free(str);
|
||||
|
||||
if(j == 0) p.x -= MwGetInteger(handle->parent, MwNleftPadding);
|
||||
}
|
||||
p.y += (MwTextHeight(handle, "M") + Padding) / 2;
|
||||
p.y += (MwTextHeight(handle, NULL, "M") + Padding) / 2;
|
||||
handle->bgcolor = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -297,7 +297,7 @@ static void resize(MwWidget handle) {
|
|||
int ih, y;
|
||||
int m = 0;
|
||||
|
||||
y = MwGetInteger(handle, MwNhasHeading) ? (MwTextHeight(handle, "M") + MwDefaultBorderWidth(handle) * 2) : 0;
|
||||
y = MwGetInteger(handle, MwNhasHeading) ? (MwTextHeight(handle, NULL, "M") + MwDefaultBorderWidth(handle) * 2) : 0;
|
||||
|
||||
if(lb->vscroll == NULL) {
|
||||
lb->vscroll = MwVaCreateWidget(MwScrollBarClass, "vscroll", handle, w - 16, 0, 16, h, NULL);
|
||||
|
|
@ -316,7 +316,7 @@ static void resize(MwWidget handle) {
|
|||
|
||||
h -= y;
|
||||
|
||||
if(ih <= (h / (MwTextHeight(handle, "M") + Padding))) {
|
||||
if(ih <= (h / (MwTextHeight(handle, NULL, "M") + Padding))) {
|
||||
MwLLShow(lb->vscroll->lowlevel, 0);
|
||||
} else {
|
||||
MwLLShow(lb->vscroll->lowlevel, 1);
|
||||
|
|
@ -340,7 +340,7 @@ static void resize(MwWidget handle) {
|
|||
h -= MwDefaultBorderWidth(handle) * 2;
|
||||
|
||||
MwVaApply(lb->vscroll,
|
||||
MwNareaShown, h / (MwTextHeight(handle, "M") + Padding),
|
||||
MwNareaShown, h / (MwTextHeight(handle, NULL, "M") + Padding),
|
||||
MwNmaxValue, ih,
|
||||
NULL);
|
||||
}
|
||||
|
|
@ -400,7 +400,7 @@ static void draw(MwWidget handle) {
|
|||
r.x = x;
|
||||
r.y = 0;
|
||||
r.width = get_col_width(lb, i);
|
||||
r.height = MwDefaultBorderWidth(handle) * 2 + MwTextHeight(handle, "M");
|
||||
r.height = MwDefaultBorderWidth(handle) * 2 + MwTextHeight(handle, NULL, "M");
|
||||
MwDrawFrame(handle, &r, base, 0, 0);
|
||||
|
||||
x += MwDefaultBorderWidth(handle);
|
||||
|
|
@ -408,15 +408,15 @@ static void draw(MwWidget handle) {
|
|||
if(arrlen(lb->alignment) <= i || lb->alignment[i] == MwALIGNMENT_BEGINNING) {
|
||||
p.x = 4 + x;
|
||||
p.y = r.y + r.height / 2;
|
||||
MwDrawText(handle, &p, lb->list[0].name[i], 0, MwALIGNMENT_BEGINNING, text);
|
||||
MwDrawText(handle, NULL, &p, lb->list[0].name[i], MwALIGNMENT_BEGINNING, text);
|
||||
} else if(lb->alignment[i] == MwALIGNMENT_CENTER) {
|
||||
p.x = x + r.width / 2;
|
||||
p.y = r.y + r.height / 2;
|
||||
MwDrawText(handle, &p, lb->list[0].name[i], 0, MwALIGNMENT_CENTER, text);
|
||||
MwDrawText(handle, NULL, &p, lb->list[0].name[i], MwALIGNMENT_CENTER, text);
|
||||
} else if(lb->alignment[i] == MwALIGNMENT_END) {
|
||||
p.x = x + r.width - 4;
|
||||
p.y = r.y + r.height / 2;
|
||||
MwDrawText(handle, &p, lb->list[0].name[i], 0, MwALIGNMENT_END, text);
|
||||
MwDrawText(handle, NULL, &p, lb->list[0].name[i], MwALIGNMENT_END, text);
|
||||
}
|
||||
|
||||
x += r.width;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ static void set_xywh(MwWidget handle) {
|
|||
int diff = MwDefaultBorderWidth(handle);
|
||||
diff = 0;
|
||||
|
||||
height = MwTextHeight(handle, "M") + 10;
|
||||
height = MwTextHeight(handle, NULL, "M") + 10;
|
||||
|
||||
MwVaApply(handle,
|
||||
MwNx, -diff,
|
||||
|
|
@ -71,8 +71,8 @@ static void destroy(MwWidget handle) {
|
|||
#define BEGIN_MENU_LOOP \
|
||||
for(i = 0; i < arrlen(m->sub); i++) { \
|
||||
int incr = m->sub[i]->name[0] == '?' ? 1 : 0; \
|
||||
int tw = MwTextWidth(handle, m->sub[i]->name + incr); \
|
||||
int th = MwTextHeight(handle, m->sub[i]->name + incr); \
|
||||
int tw = MwTextWidth(handle, NULL, m->sub[i]->name + incr); \
|
||||
int th = MwTextHeight(handle, NULL, m->sub[i]->name + incr); \
|
||||
int in_area; \
|
||||
\
|
||||
if(incr) { \
|
||||
|
|
@ -104,7 +104,7 @@ static void draw(MwWidget handle) {
|
|||
MwDrawWidgetBack(handle, &r, base, 0, MwFALSE);
|
||||
}
|
||||
|
||||
MwDrawText(handle, &p, m->sub[i]->name + incr, m->sub[i]->wsub != NULL || (in_area && handle->pressed) ? 1 : 0, MwALIGNMENT_BEGINNING, text);
|
||||
MwDrawText(handle, MwFLBuildFont((m->sub[i]->wsub != NULL || (in_area && handle->pressed)) ? MwFLFlagBold : 0), &p, m->sub[i]->name + incr, MwALIGNMENT_BEGINNING, text);
|
||||
END_MENU_LOOP;
|
||||
|
||||
MwLLFreeColor(text);
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ static void draw(MwWidget handle) {
|
|||
|
||||
p.y += 2 + 1;
|
||||
} else {
|
||||
int tw = MwTextWidth(handle, menu->sub[i]->name);
|
||||
int th = MwTextHeight(handle, menu->sub[i]->name);
|
||||
int tw = MwTextWidth(handle, NULL, menu->sub[i]->name);
|
||||
int th = MwTextHeight(handle, NULL, menu->sub[i]->name);
|
||||
|
||||
if(menu->sub[i]->wsub != NULL) {
|
||||
r.x = MwGetInteger(handle, MwNleftPadding);
|
||||
|
|
@ -77,7 +77,7 @@ static void draw(MwWidget handle) {
|
|||
p.x = 5 + tw / 2 + MwGetInteger(handle, MwNleftPadding);
|
||||
|
||||
p.y += th / 2;
|
||||
MwDrawText(handle, &p, menu->sub[i]->name, menu->sub[i]->wsub != NULL ? 1 : 0, MwALIGNMENT_CENTER, text);
|
||||
MwDrawText(handle, MwFLBuildFont(menu->sub[i]->wsub != NULL ? MwFLFlagBold : 0), &p, menu->sub[i]->name, MwALIGNMENT_CENTER, text);
|
||||
|
||||
if(arrlen(menu->sub[i]->sub) > 0) {
|
||||
MwRect tr;
|
||||
|
|
@ -110,13 +110,13 @@ static void click(MwWidget handle) {
|
|||
rc.x = 5;
|
||||
rc.y = 3;
|
||||
for(i = 0; i < arrlen(menu->sub); i++) {
|
||||
int tw = MwTextWidth(handle, menu->sub[i]->name);
|
||||
int tw = MwTextWidth(handle, NULL, menu->sub[i]->name);
|
||||
if(tw > ww) ww = tw;
|
||||
}
|
||||
|
||||
rc.width = ww + 15;
|
||||
for(i = 0; i < arrlen(menu->sub); i++) {
|
||||
int th = MwTextHeight(handle, menu->sub[i]->name);
|
||||
int th = MwTextHeight(handle, NULL, menu->sub[i]->name);
|
||||
rc.height = th;
|
||||
|
||||
if(strcmp(menu->sub[i]->name, "----") == 0) {
|
||||
|
|
@ -209,8 +209,8 @@ static void mwSubMenuGetSizeImpl(MwWidget handle, MwMenu menu, MwRect* rect) {
|
|||
if(strcmp(menu->sub[i]->name, "----") == 0) {
|
||||
rect->height += 2 + 2;
|
||||
} else {
|
||||
int tw = MwTextWidth(handle, menu->sub[i]->name);
|
||||
rect->height += MwTextHeight(handle, menu->sub[i]->name) + 3;
|
||||
int tw = MwTextWidth(handle, NULL, menu->sub[i]->name);
|
||||
rect->height += MwTextHeight(handle, NULL, menu->sub[i]->name) + 3;
|
||||
if(tw > rect->width) {
|
||||
rect->width = tw;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
|||
if((*skip) > 0) {
|
||||
(*skip)--;
|
||||
skipped = 1;
|
||||
if(p->y == MwDefaultBorderWidth(handle)) p->y -= MwTextHeight(handle, "M");
|
||||
} else if((*shared) < (MwGetInteger(handle, MwNheight) / MwTextHeight(handle, "M") + 2)) {
|
||||
if(p->y == MwDefaultBorderWidth(handle)) p->y -= MwTextHeight(handle, NULL, "M");
|
||||
} else if((*shared) < (MwGetInteger(handle, MwNheight) / MwTextHeight(handle, NULL, "M") + 2)) {
|
||||
MwRect r;
|
||||
p->x += shift;
|
||||
p->y += MwTextHeight(handle, "M") / 2 + LinePadding;
|
||||
p->y += MwTextHeight(handle, NULL, "M") / 2 + LinePadding;
|
||||
|
||||
if(tree->tree != NULL || shift > LineSpace) {
|
||||
l[0] = *p;
|
||||
|
|
@ -47,9 +47,9 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
|||
l[0] = *p;
|
||||
l[0].x -= LineSpace / 2;
|
||||
l[1] = l[0];
|
||||
l[0].y -= MwTextHeight(handle, "M") / 2 + LinePadding;
|
||||
l[0].y -= MwTextHeight(handle, NULL, "M") / 2 + LinePadding;
|
||||
if(next) {
|
||||
l[1].y += MwTextHeight(handle, "M") / 2;
|
||||
l[1].y += MwTextHeight(handle, NULL, "M") / 2;
|
||||
}
|
||||
if(draw) MwLLLine(handle->lowlevel, &l[0], text2);
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
|||
r.width = OpenerSize;
|
||||
r.height = OpenerSize;
|
||||
r.x = p->x - LineSpace + (LineSpace - r.width) / 2;
|
||||
r.y = p->y - MwTextHeight(handle, "M") / 2 + (MwTextHeight(handle, "M") - r.height) / 2;
|
||||
r.y = p->y - MwTextHeight(handle, NULL, "M") / 2 + (MwTextHeight(handle, NULL, "M") - r.height) / 2;
|
||||
if(draw) {
|
||||
MwLLColor col = tree->opened ? MwLightenColor(handle, base, -8, -8, -8) : base;
|
||||
MwRect r2 = r;
|
||||
|
|
@ -101,11 +101,11 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
|||
}
|
||||
}
|
||||
if(tree->pixmap != NULL) {
|
||||
r.height = MwTextHeight(handle, "M");
|
||||
r.height = MwTextHeight(handle, NULL, "M");
|
||||
r.width = r.height * tree->pixmap->common.width / tree->pixmap->common.height;
|
||||
|
||||
r.x = p->x;
|
||||
r.y = p->y - MwTextHeight(handle, "M") / 2;
|
||||
r.y = p->y - MwTextHeight(handle, NULL, "M") / 2;
|
||||
|
||||
if(draw) MwLLDrawPixmap(handle->lowlevel, &r, tree->pixmap);
|
||||
}
|
||||
|
|
@ -113,16 +113,16 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
|||
if(draw) {
|
||||
if(tree->selected) {
|
||||
r.x = p->x;
|
||||
r.y = p->y - MwTextHeight(handle, "M") / 2;
|
||||
r.y = p->y - MwTextHeight(handle, NULL, "M") / 2;
|
||||
r.width = MwGetInteger(handle, MwNwidth) - MwGetInteger(handle, MwNleftPadding) - shift;
|
||||
r.height = MwTextHeight(handle, "M");
|
||||
r.height = MwTextHeight(handle, NULL, "M");
|
||||
MwDrawRect(handle, &r, text2);
|
||||
}
|
||||
handle->bgcolor = tree->selected ? text2 : base2;
|
||||
MwDrawText(handle, p, tree->label, 0, MwALIGNMENT_BEGINNING, tree->selected ? base2 : text2);
|
||||
MwDrawText(handle, NULL, p, tree->label, MwALIGNMENT_BEGINNING, tree->selected ? base2 : text2);
|
||||
handle->bgcolor = NULL;
|
||||
} else {
|
||||
if(p->x <= mouse->x && mouse->x <= (p->x + MwTextWidth(handle, tree->label)) && (p->y - MwTextHeight(handle, "M") / 2) <= mouse->y && mouse->y <= (p->y + MwTextHeight(handle, "M") / 2)) {
|
||||
if(p->x <= mouse->x && mouse->x <= (p->x + MwTextWidth(handle, NULL, tree->label)) && (p->y - MwTextHeight(handle, NULL, "M") / 2) <= mouse->y && mouse->y <= (p->y + MwTextHeight(handle, NULL, "M") / 2)) {
|
||||
unsigned long t;
|
||||
|
||||
set_all(root, 0);
|
||||
|
|
@ -136,7 +136,7 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
|||
}
|
||||
p->x -= MwGetInteger(handle->parent, MwNleftPadding);
|
||||
|
||||
p->y += MwTextHeight(handle, "M") / 2;
|
||||
p->y += MwTextHeight(handle, NULL, "M") / 2;
|
||||
p->x -= shift;
|
||||
|
||||
(*shared)++;
|
||||
|
|
@ -145,7 +145,7 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
|
|||
for(i = 0; i < arrlen(tree->tree); i++) {
|
||||
l[0] = *p;
|
||||
l[0].x += shift + LineSpace / 2;
|
||||
l[0].y += MwTextHeight(handle, "M") - (MwTextHeight(handle, "M") - OpenerSize) / 2;
|
||||
l[0].y += MwTextHeight(handle, NULL, "M") - (MwTextHeight(handle, NULL, "M") - OpenerSize) / 2;
|
||||
if(tree->tree[i]->tree != NULL) {
|
||||
l[0].y += OpenerSize / 2;
|
||||
}
|
||||
|
|
@ -189,7 +189,7 @@ static void frame_draw(MwWidget handle) {
|
|||
r = r2;
|
||||
|
||||
for(i = 0; i < arrlen(tv->tree); i++) {
|
||||
if(shared > (r.height / MwTextHeight(handle, "M"))) break;
|
||||
if(shared > (r.height / MwTextHeight(handle, NULL, "M"))) break;
|
||||
recursion(handle, tv->tree[i], tv->tree, base, text, base2, text2, &p, 0, LineSpace, &skip, &shared, 1, NULL);
|
||||
}
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ static void frame_mouse_up(MwWidget handle, void* user, void* call) {
|
|||
p.x = MwDefaultBorderWidth(tv->frame);
|
||||
p.y = MwDefaultBorderWidth(tv->frame);
|
||||
for(i = 0; i < arrlen(tv->tree); i++) {
|
||||
if(shared > (MwGetInteger(tv->frame, MwNheight) / MwTextHeight(tv->frame, "M"))) break;
|
||||
if(shared > (MwGetInteger(tv->frame, MwNheight) / MwTextHeight(tv->frame, NULL, "M"))) break;
|
||||
recursion(tv->frame, tv->tree[i], tv->tree, NULL, NULL, NULL, NULL, &p, 0, LineSpace, &skip, &shared, 0, &tv->pressed);
|
||||
}
|
||||
resize(handle->parent);
|
||||
|
|
@ -267,7 +267,7 @@ static void resize(MwWidget handle) {
|
|||
ih = recursive_length(tv->tree);
|
||||
if(ih == 0) ih = 1;
|
||||
|
||||
if(ih <= (h / (LinePadding + MwTextHeight(handle, "M")))) {
|
||||
if(ih <= (h / (LinePadding + MwTextHeight(handle, NULL, "M")))) {
|
||||
MwLLShow(tv->vscroll->lowlevel, 0);
|
||||
} else {
|
||||
MwLLShow(tv->vscroll->lowlevel, 1);
|
||||
|
|
@ -292,7 +292,7 @@ static void resize(MwWidget handle) {
|
|||
}
|
||||
|
||||
MwVaApply(tv->vscroll,
|
||||
MwNareaShown, h / (LinePadding + MwTextHeight(handle, "M")),
|
||||
MwNareaShown, h / (LinePadding + MwTextHeight(handle, NULL, "M")),
|
||||
MwNmaxValue, ih,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue