Commit: d6fddd7a6178fad0e7cca5e9c57cbee1612f8815
Parent: 970d6962b259ea8656de7c82c7955ef6db12c7fb
Author: 0x766F6964
Date: Sun, 2 Aug 2020 22:27:09 -0600
remove gf_val() and LL macros
Diffstat:
M | bfu.c | | | 135 | ++++++++++++++++++++++++++++++++++++++++--------------------------------------- |
M | bookmark.c | | | 10 | +++------- |
M | html.c | | | 21 | +++++++++++---------- |
M | html_tbl.c | | | 33 | ++++++++++++++++++--------------- |
M | links.h | | | 8 | ++------ |
M | listedit.c | | | 21 | ++++++++++----------- |
M | menu.c | | | 66 | +++++++++++++++++++++++++++++++++--------------------------------- |
M | objreq.c | | | 16 | +++++++--------- |
M | session.c | | | 27 | ++++++++++++++------------- |
M | setup.h | | | 2 | +- |
M | types.c | | | 28 | ++++++++++++++-------------- |
M | view.c | | | 2 | +- |
12 files changed, 183 insertions(+), 186 deletions(-)
diff --git a/bfu.c b/bfu.c
@@ -180,19 +180,18 @@ static void count_menu_size(struct terminal *term, struct menu *menu)
{
int sx = term->x;
int sy = term->y;
- int mx = gf_val(4, 2 * (G_MENU_LEFT_BORDER + G_MENU_LEFT_INNER_BORDER));
+ int mx = 4;
int my;
for (my = 0; my < menu->ni; my++) {
int s;
- s = txtlen(term, get_text_translation(menu->items[my].text, term)) + txtlen(term, get_text_translation(get_rtext(menu->items[my].rtext), term)) + gf_val(MENU_HOTKEY_SPACE, G_MENU_HOTKEY_SPACE) * (get_text_translation(get_rtext(menu->items[my].rtext), term)[0] != 0);
- s += gf_val(4, 2 * (G_MENU_LEFT_BORDER + G_MENU_LEFT_INNER_BORDER));
+ s = txtlen(term, get_text_translation(menu->items[my].text, term)) + txtlen(term, get_text_translation(get_rtext(menu->items[my].rtext), term)) + MENU_HOTKEY_SPACE * (get_text_translation(get_rtext(menu->items[my].rtext), term)[0] != 0);
+ s += 4;
if (s > mx) mx = s;
}
- my = gf_val(my, my * G_BFU_FONT_SIZE);
- my += gf_val(2, 2 * G_MENU_TOP_BORDER);
+ my += 2;
if (mx > sx) mx = sx;
if (my > sy) my = sy;
- menu->nview = gf_val(my - 2, (my - 2 * G_MENU_TOP_BORDER) / G_BFU_FONT_SIZE);
+ menu->nview = my - 2;
menu->xw = mx;
menu->yw = my;
if ((menu->x = menu->xp) < 0) menu->x = 0;
@@ -306,7 +305,7 @@ static void menu_func(struct window *win, struct links_event *ev, int fwd)
xxx:
menu->selected--;
scroll_menu(menu, 1);
- draw_to_window(win, gf_val(display_menu_txt, display_menu_gfx), menu);
+ draw_to_window(win, display_menu_txt, menu);
break;
case EV_MOUSE:
if ((ev->b & BM_ACT) == B_MOVE) break;
@@ -326,7 +325,8 @@ static void menu_func(struct window *win, struct links_event *ev, int fwd)
foreachfrom(struct window, w1, w1l, win->term->windows, &win->list_entry) {
struct menu *m1;
if (w1->handler == mainmenu_func) {
- if (ev->y < LL) goto del;
+ if (ev->y < 1)
+ goto del;
break;
}
if (w1->handler != menu_func) break;
@@ -341,15 +341,15 @@ static void menu_func(struct window *win, struct links_event *ev, int fwd)
del: delete_window_ev(win, ev);
} else {
if (!(ev->x < menu->x || ev->x >= menu->x+menu->xw
- || ev->y < menu->y + gf_val(1, G_MENU_TOP_BORDER)
- || ev->y >= menu->y + menu->yw - gf_val(1, G_MENU_TOP_BORDER))) {
- int s = gf_val(ev->y - menu->y-1 + menu->view, (ev->y - menu->y - G_MENU_TOP_BORDER) / G_BFU_FONT_SIZE + menu->view);
+ || ev->y < menu->y + 1
+ || ev->y >= menu->y + menu->yw - 1)) {
+ int s = ev->y - menu->y - 1 + menu->view;
if (s >= 0 && s < menu->ni && menu->items[s].hotkey != M_BAR) {
menu_oldview = menu->view;
menu_oldsel = menu->selected;
menu->selected = s;
scroll_menu(menu, 0);
- draw_to_window(win, gf_val(display_menu_txt, display_menu_gfx), menu);
+ draw_to_window(win, display_menu_txt, menu);
menu_oldview = menu_oldsel = -1;
if ((ev->b & BM_ACT) == B_UP)
select_menu(win->term, menu);
@@ -398,14 +398,14 @@ static void menu_func(struct window *win, struct links_event *ev, int fwd)
scroll_menu(menu, -1);
} else if (ev->x == KBD_PAGE_UP || (upcase(ev->x) == 'B'
&& ev->y & KBD_CTRL)) {
- if ((menu->selected -= menu->yw / LL - 3) < -1) menu->selected = -1;
- if ((menu->view -= menu->yw / LL - 2) < 0) menu->view = 0;
+ if ((menu->selected -= menu->yw - 3) < -1) menu->selected = -1;
+ if ((menu->view -= menu->yw - 2) < 0) menu->view = 0;
scroll_menu(menu, -1);
}
else if (ev->x == KBD_PAGE_DOWN || (upcase(ev->x) == 'F'
&& ev->y & KBD_CTRL)) {
- if ((menu->selected += menu->yw / LL - 3) > menu->ni) menu->selected = menu->ni;
- if ((menu->view += menu->yw / LL - 2) >= menu->ni - menu->yw + 2) menu->view = menu->ni - menu->yw + 2;
+ if ((menu->selected += menu->yw - 3) > menu->ni) menu->selected = menu->ni;
+ if ((menu->view += menu->yw - 2) >= menu->ni - menu->yw + 2) menu->view = menu->ni - menu->yw + 2;
scroll_menu(menu, 1);
}
else if (ev->x > ' ') {
@@ -418,8 +418,7 @@ static void menu_func(struct window *win, struct links_event *ev, int fwd)
}
}
}
- draw_to_window(win, gf_val(display_menu_txt, display_menu_gfx),
- menu);
+ draw_to_window(win, display_menu_txt, menu);
if (s || ev->x == KBD_ENTER || ev->x == ' ') {
enter:
menu_oldview = menu_oldsel = -1;
@@ -541,7 +540,7 @@ static void mainmenu_func(struct window *win, struct links_event *ev, int fwd)
draw_to_window(win, display_mainmenu, menu);
break;
case EV_MOUSE:
- in_menu = ev->x >= 0 && ev->x < win->term->x && ev->y >= 0 && ev->y < LL;
+ in_menu = ev->x >= 0 && ev->x < win->term->x && ev->y >= 0 && ev->y < 1;
if ((ev->b & BM_ACT) == B_MOVE) break;
if ((ev->b & BM_BUTT) == B_FOURTH) {
if ((ev->b & BM_ACT) == B_DOWN) goto go_left;
@@ -558,11 +557,11 @@ static void mainmenu_func(struct window *win, struct links_event *ev, int fwd)
delete_window_ev(win, ev);
else if (in_menu) {
int i;
- int p = gf_val(2, G_MAINMENU_LEFT_BORDER);
+ int p = 2;
for (i = 0; i < menu->ni; i++) {
int o = p;
unsigned char *tmptext = get_text_translation(menu->items[i].text, win->term);
- p += txtlen(win->term, tmptext) + gf_val(4, 2 * G_MAINMENU_BORDER);
+ p += txtlen(win->term, tmptext) + 4;
if (ev->x >= o && ev->x < p) {
menu->selected = i;
draw_to_window(win, display_mainmenu, menu);
@@ -820,9 +819,9 @@ static int dlg_mouse(struct dialog_data *dlg, struct dialog_item_data *di, struc
{
switch (di->item->type) {
case D_BUTTON:
- if (gf_val(ev->y != di->y, ev->y < di->y
- || ev->y >= di->y + G_BFU_FONT_SIZE) || ev->x < di->x
- || ev->x >= di->x + gf_val(strlen((char *)get_text_translation(di->item->text, dlg->win->term)) + 4, di->l))
+ if (ev->y != di->y
+ || ev->x < di->x
+ || ev->x >= di->x + strlen((char *)get_text_translation(di->item->text, dlg->win->term)) + 4)
return 0;
if (dlg->selected != di - dlg->items) {
x_display_dlg_item(dlg, &dlg->items[dlg->selected], 0);
@@ -833,8 +832,8 @@ static int dlg_mouse(struct dialog_data *dlg, struct dialog_item_data *di, struc
return 1;
case D_FIELD:
case D_FIELD_PASS:
- if (gf_val(ev->y != di->y, ev->y < di->y
- || ev->y >= di->y + G_BFU_FONT_SIZE) || ev->x < di->x
+ if (ev->y != di->y
+ || ev->x < di->x
|| ev->x >= di->x + di->l)
return 0;
if (!is_utf_8(dlg->win->term)) {
@@ -861,9 +860,9 @@ static int dlg_mouse(struct dialog_data *dlg, struct dialog_item_data *di, struc
x_display_dlg_item(dlg, di, 1);
return 1;
case D_CHECKBOX:
- if (gf_val(ev->y != di->y, ev->y < di->y
- || ev->y >= di->y + G_BFU_FONT_SIZE) || ev->x < di->x
- || ev->x >= di->x + gf_val(3, di->l))
+ if (ev->y != di->y
+ || ev->x < di->x
+ || ev->x >= di->x + 3)
return 0;
if (dlg->selected != di - dlg->items) {
x_display_dlg_item(dlg, &dlg->items[dlg->selected], 0);
@@ -1531,10 +1530,10 @@ int dlg_format_text(struct dialog_data *dlg, struct terminal *term, unsigned cha
void max_buttons_width(struct terminal *term, struct dialog_item_data *butt, int n, int *width)
{
- int w = gf_val(-2, -G_DIALOG_BUTTON_SPACE);
+ int w = -2;
int i;
for (i = 0; i < n; i++)
- w += txtlen(term, get_text_translation((butt++)->item->text, term)) + gf_val(6, G_DIALOG_BUTTON_SPACE + txtlen(term, cast_uchar G_DIALOG_BUTTON_L) + txtlen(term, cast_uchar G_DIALOG_BUTTON_R));
+ w += txtlen(term, get_text_translation((butt++)->item->text, term)) + 6;
if (w > *width) *width = w;
}
@@ -1542,7 +1541,7 @@ void min_buttons_width(struct terminal *term, struct dialog_item_data *butt, int
{
int i;
for (i = 0; i < n; i++) {
- int w = txtlen(term, get_text_translation((butt++)->item->text, term)) + gf_val(4, txtlen(term, cast_uchar(G_DIALOG_BUTTON_L G_DIALOG_BUTTON_R)));
+ int w = txtlen(term, get_text_translation((butt++)->item->text, term)) + 4;
if (w > *width) *width = w;
}
}
@@ -1568,17 +1567,17 @@ void dlg_format_buttons(struct dialog_data *dlg, struct terminal *term, struct d
for (i = i1; i < i2; i++) {
butt[i].x = p;
butt[i].y = *y;
- p += (butt[i].l = txtlen(dlg->win->term, get_text_translation(butt[i].item->text, dlg->win->term)) + gf_val(4, txtlen(dlg->win->term, cast_uchar(G_DIALOG_BUTTON_L G_DIALOG_BUTTON_R)))) + gf_val(2, G_DIALOG_BUTTON_SPACE);
+ p += (butt[i].l = txtlen(dlg->win->term, get_text_translation(butt[i].item->text, dlg->win->term)) + 4) + 2;
}
}
- *y += 2 * LL;
+ *y += 2;
i1 = i2;
}
}
void dlg_format_checkbox(struct dialog_data *dlg, struct terminal *term, struct dialog_item_data *chkb, int x, int *y, int w, int *rw, unsigned char *text)
{
- int k = gf_val(4, txtlen(dlg->win->term, cast_uchar(G_DIALOG_CHECKBOX_L G_DIALOG_CHECKBOX_X G_DIALOG_CHECKBOX_R)) + G_DIALOG_CHECKBOX_SPACE);
+ int k = 4;
if (term) {
chkb->x = x;
chkb->y = *y;
@@ -1598,7 +1597,7 @@ void dlg_format_checkboxes(struct dialog_data *dlg, struct terminal *term, struc
void checkboxes_width(struct terminal *term, unsigned char * const *texts, int n, int *w, void (*fn)(struct terminal *, unsigned char *, int *, int))
{
- int k = gf_val(4, txtlen(term, cast_uchar(G_DIALOG_CHECKBOX_L G_DIALOG_CHECKBOX_X G_DIALOG_CHECKBOX_R)) + G_DIALOG_CHECKBOX_SPACE);
+ int k = 4;
while (n--) {
*w -= k;
fn(term, get_text_translation(texts[0], term), w, 0);
@@ -1615,7 +1614,7 @@ void dlg_format_field(struct dialog_data *dlg, struct terminal *term, struct dia
item->l = w;
if (rw && item->l > *rw) if ((*rw = item->l) > w) *rw = w;
}
- (*y) += gf_val(1, G_BFU_FONT_SIZE);
+ (*y)++;
}
void dlg_format_text_and_field(struct dialog_data *dlg, struct terminal *term, unsigned char *text, struct dialog_item_data *item, int x, int *y, int w, int *rw, unsigned char co, int align)
@@ -1640,11 +1639,12 @@ void max_group_width(struct terminal *term, unsigned char * const *texts, struct
{
int ww = 0;
while (n--) {
- int wx = item->item->type == D_CHECKBOX ? gf_val(4, txtlen(term, cast_uchar(G_DIALOG_CHECKBOX_L G_DIALOG_CHECKBOX_X G_DIALOG_CHECKBOX_R)) + G_DIALOG_CHECKBOX_SPACE) :
- item->item->type == D_BUTTON ? txtlen(term, get_text_translation(item->item->text, term)) + (gf_val(4, txtlen(term, cast_uchar(G_DIALOG_BUTTON_L G_DIALOG_BUTTON_R)))) :
- gf_val(item->item->dlen, item->item->dlen * G_DIALOG_FIELD_WIDTH);
- wx += txtlen(term, get_text_translation(texts[0], term)) + gf_val(1, G_DIALOG_GROUP_TEXT_SPACE);
- if (n) gf_val(wx++, wx += G_DIALOG_GROUP_SPACE);
+ int wx = item->item->type == D_CHECKBOX ? 4 :
+ item->item->type == D_BUTTON ? txtlen(term, get_text_translation(item->item->text, term)) + 4 :
+ item->item->dlen;
+ wx += txtlen(term, get_text_translation(texts[0], term)) + 1;
+ if (n)
+ wx++;
ww += wx;
texts++;
item++;
@@ -1655,9 +1655,9 @@ void max_group_width(struct terminal *term, unsigned char * const *texts, struct
void min_group_width(struct terminal *term, unsigned char * const *texts, struct dialog_item_data *item, int n, int *w)
{
while (n--) {
- int wx = item->item->type == D_CHECKBOX ? gf_val(4, txtlen(term, cast_uchar(G_DIALOG_CHECKBOX_L G_DIALOG_CHECKBOX_X G_DIALOG_CHECKBOX_R)) + G_DIALOG_CHECKBOX_SPACE) :
- item->item->type == D_BUTTON ? txtlen(term, get_text_translation(item->item->text, term)) + (gf_val(4, txtlen(term, cast_uchar(G_DIALOG_BUTTON_L G_DIALOG_BUTTON_R)))) :
- gf_val(item->item->dlen + 1, (item->item->dlen + 1) * G_DIALOG_FIELD_WIDTH);
+ int wx = item->item->type == D_CHECKBOX ? 4 :
+ item->item->type == D_BUTTON ? txtlen(term, get_text_translation(item->item->text, term)) + 4 :
+ item->item->dlen + 1;
wx += txtlen(term, get_text_translation(texts[0], term));
if (wx > *w) *w = wx;
texts++;
@@ -1669,29 +1669,32 @@ void dlg_format_group(struct dialog_data *dlg, struct terminal *term, unsigned c
{
int nx = 0;
while (n--) {
- int wx = item->item->type == D_CHECKBOX ? gf_val(3, txtlen(dlg->win->term, cast_uchar(G_DIALOG_CHECKBOX_L G_DIALOG_CHECKBOX_X G_DIALOG_CHECKBOX_R))) :
- item->item->type == D_BUTTON ? txtlen(dlg->win->term, get_text_translation(item->item->text, dlg->win->term)) + (gf_val(4, txtlen(dlg->win->term, cast_uchar(G_DIALOG_BUTTON_L G_DIALOG_BUTTON_R)))) :
- gf_val(item->item->dlen, item->item->dlen * G_DIALOG_FIELD_WIDTH);
+ int wx = item->item->type == D_CHECKBOX ? 3 :
+ item->item->type == D_BUTTON ? txtlen(dlg->win->term, get_text_translation(item->item->text, dlg->win->term)) + 4 :
+ item->item->dlen;
int sl;
- if (get_text_translation(texts[0], dlg->win->term)[0]) sl = txtlen(dlg->win->term, get_text_translation(texts[0], dlg->win->term)) + gf_val(1, G_DIALOG_GROUP_TEXT_SPACE);
- else sl = 0;
+ if (get_text_translation(texts[0], dlg->win->term)[0])
+ sl = txtlen(dlg->win->term, get_text_translation(texts[0], dlg->win->term)) + 1;
+ else
+ sl = 0;
wx += sl;
if (nx && nx + wx > w) {
nx = 0;
- (*y) += 2 * LL;
+ (*y) += 2;
}
if (term) {
print_text(term, x + nx + 4 * (item->item->type == D_CHECKBOX), *y, strlen((char *)get_text_translation(texts[0], dlg->win->term)), get_text_translation(texts[0], dlg->win->term), COLOR_DIALOG_TEXT);
item->x = x + nx + sl * (item->item->type != D_CHECKBOX);
item->y = *y;
- if (item->item->type == D_FIELD || item->item->type == D_FIELD_PASS) item->l = gf_val(item->item->dlen, item->item->dlen * G_DIALOG_FIELD_WIDTH);
+ if (item->item->type == D_FIELD || item->item->type == D_FIELD_PASS)
+ item->l = item->item->dlen;
}
if (rw && nx + wx > *rw) if ((*rw = nx + wx) > w) *rw = w;
- nx += wx + gf_val(1, G_DIALOG_GROUP_SPACE);
+ nx += wx + 1;
texts++;
item++;
}
- (*y) += LL;
+ (*y)++;
}
void checkbox_list_fn(struct dialog_data *dlg)
@@ -1714,16 +1717,16 @@ void checkbox_list_fn(struct dialog_data *dlg)
if (w < 5) w = 5;
rw = 0;
dlg_format_checkboxes(dlg, NULL, dlg->items, n_checkboxes, 0, &y, w, &rw, dlg->dlg->udata);
- y += LL;
+ y++;
dlg_format_buttons(dlg, NULL, dlg->items + n_checkboxes, dlg->n - n_checkboxes, 0, &y, w, &rw, AL_CENTER);
w = rw;
dlg->xw = rw + 2 * DIALOG_LB;
dlg->yw = y + 2 * DIALOG_TB;
center_dlg(dlg);
draw_dlg(dlg);
- y = dlg->y + DIALOG_TB + LL;
+ y = dlg->y + DIALOG_TB + 1;
dlg_format_checkboxes(dlg, term, dlg->items, n_checkboxes, dlg->x + DIALOG_LB, &y, w, NULL, dlg->dlg->udata);
- y += LL;
+ y++;
dlg_format_buttons(dlg, term, dlg->items + n_checkboxes, dlg->n - n_checkboxes, dlg->x + DIALOG_LB, &y, w, &rw, AL_CENTER);
}
@@ -1744,16 +1747,16 @@ void group_fn(struct dialog_data *dlg)
if (w < 1) w = 1;
rw = 0;
dlg_format_group(dlg, NULL, dlg->dlg->udata, dlg->items, dlg->n - 2, 0, &y, w, &rw);
- y += LL;
+ y++;
dlg_format_buttons(dlg, NULL, dlg->items + dlg->n - 2, 2, 0, &y, w, &rw, AL_CENTER);
w = rw;
dlg->xw = rw + 2 * DIALOG_LB;
dlg->yw = y + 2 * DIALOG_TB;
center_dlg(dlg);
draw_dlg(dlg);
- y = dlg->y + DIALOG_TB + LL;
+ y = dlg->y + DIALOG_TB + 1;
dlg_format_group(dlg, term, dlg->dlg->udata, dlg->items, dlg->n - 2, dlg->x + DIALOG_LB, &y, w, NULL);
- y += LL;
+ y++;
dlg_format_buttons(dlg, term, dlg->items + dlg->n - 2, 2, dlg->x + DIALOG_LB, &y, w, &rw, AL_CENTER);
}
@@ -1778,16 +1781,16 @@ void msg_box_fn(struct dialog_data *dlg)
if (w < 1) w = 1;
rw = 0;
dlg_format_text(dlg, NULL, text, 0, &y, w, &rw, COLOR_DIALOG_TEXT, dlg->dlg->align);
- y += LL;
+ y++;
dlg_format_buttons(dlg, NULL, dlg->items, dlg->n, 0, &y, w, &rw, AL_CENTER);
w = rw;
dlg->xw = rw + 2 * DIALOG_LB;
dlg->yw = y + 2 * DIALOG_TB;
center_dlg(dlg);
draw_dlg(dlg);
- y = dlg->y + DIALOG_TB + LL;
+ y = dlg->y + DIALOG_TB + 1;
dlg_format_text(dlg, term, text, dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, dlg->dlg->align);
- y += LL;
+ y++;
dlg_format_buttons(dlg, term, dlg->items, dlg->n, dlg->x + DIALOG_LB, &y, w, NULL, AL_CENTER);
free(text);
}
@@ -1927,7 +1930,7 @@ static void input_field_fn(struct dialog_data *dlg)
struct terminal *term = dlg->win->term;
int max = 0, min = 0;
int w, rw;
- int y = gf_val(-1, -G_BFU_FONT_SIZE);
+ int y = -1;
max_text_width(term, dlg->dlg->udata, &max, AL_LEFT);
min_text_width(term, dlg->dlg->udata, &min, AL_LEFT);
max_buttons_width(term, dlg->items + 1, dlg->n - 1, &max);
@@ -1939,7 +1942,7 @@ static void input_field_fn(struct dialog_data *dlg)
rw = w;
dlg_format_text_and_field(dlg, NULL, dlg->dlg->udata, dlg->items, 0,
&y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_buttons(dlg, NULL, dlg->items + 1, dlg->n - 1, 0, &y, w,
&rw, AL_CENTER);
w = rw;
@@ -1949,7 +1952,7 @@ static void input_field_fn(struct dialog_data *dlg)
draw_dlg(dlg);
y = dlg->y + DIALOG_TB;
dlg_format_text_and_field(dlg, term, dlg->dlg->udata, dlg->items, dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_buttons(dlg, term, dlg->items + 1, dlg->n - 1,
dlg->x + DIALOG_LB, &y, w, NULL, AL_CENTER);
}
diff --git a/bookmark.c b/bookmark.c
@@ -158,7 +158,7 @@ static void bookmark_edit_item_fn(struct dialog_data *dlg)
{
int max = 0, min = 0;
int w, rw;
- int y = gf_val(-1, -1 * G_BFU_FONT_SIZE);
+ int y = -1;
struct terminal *term;
int a;
@@ -177,12 +177,10 @@ static void bookmark_edit_item_fn(struct dialog_data *dlg)
rw = w;
- for (a = 0; a < dlg->n - 2; a++) {
+ for (a = 0; a < dlg->n - 2; a++, y++)
dlg_format_text_and_field(dlg, NULL, bm_add_msg[a],
&dlg->items[a], 0, &y, w, &rw, COLOR_DIALOG_TEXT,
AL_LEFT);
- y += gf_val(1, 1 * G_BFU_FONT_SIZE);
- }
dlg_format_buttons(dlg, NULL, dlg->items+dlg->n-2, 2, 0, &y, w, &rw,
AL_CENTER);
w = rw;
@@ -191,12 +189,10 @@ static void bookmark_edit_item_fn(struct dialog_data *dlg)
center_dlg(dlg);
draw_dlg(dlg);
y = dlg->y + DIALOG_TB;
- for (a = 0; a < dlg->n - 2; a++) {
+ for (a = 0; a < dlg->n - 2; a++, y++)
dlg_format_text_and_field(dlg, term, bm_add_msg[a],
&dlg->items[a], dlg->x + DIALOG_LB, &y, w, NULL,
COLOR_DIALOG_TEXT, AL_LEFT);
- y += gf_val(1, G_BFU_FONT_SIZE);
- }
dlg_format_buttons(dlg, term, &dlg->items[dlg->n-2], 2,
dlg->x + DIALOG_LB, &y, w, NULL, AL_CENTER);
}
diff --git a/html.c b/html.c
@@ -770,7 +770,7 @@ static int parse_width(const char *w, const int trunc)
int p = 0;
long s;
int l;
- int limit = par_format.width - (par_format.leftmargin + par_format.rightmargin) * gf_val(1, G_HTML_MARGIN);
+ int limit = par_format.width - par_format.leftmargin + par_format.rightmargin;
while (WHITECHAR(*w)) w++;
for (l = 0; w[l] && w[l] != ','; l++)
;
@@ -789,7 +789,9 @@ static int parse_width(const char *w, const int trunc)
s = s * limit / 100;
}
else return -1;
- } else s = (s + (gf_val(HTML_CHAR_WIDTH, 1) - 1) / 2) / gf_val(HTML_CHAR_WIDTH, 1);
+ } else {
+ s = (s + (HTML_CHAR_WIDTH - 1) / 2) / HTML_CHAR_WIDTH;
+ }
if (trunc == 1 && s > limit) s = limit;
if (s < 0) s = 0;
return (int)s;
@@ -1655,11 +1657,10 @@ put_text:
static void set_max_textarea_width(int *w)
{
int limit;
- if (!table_level) {
- limit = par_format.width - (par_format.leftmargin + par_format.rightmargin) * gf_val(1, G_HTML_MARGIN);
- } else {
- limit = gf_val(d_opt->xw - 2, d_opt->xw - G_SCROLL_BAR_WIDTH - 2 * G_HTML_MARGIN * d_opt->margin);
- }
+ if (!table_level)
+ limit = par_format.width - par_format.leftmargin + par_format.rightmargin;
+ else
+ limit = d_opt->xw - 2;
if (*w > limit) {
*w = limit;
if (*w < HTML_MINIMAL_TEXTAREA_WIDTH) *w = HTML_MINIMAL_TEXTAREA_WIDTH;
@@ -2367,7 +2368,7 @@ static void parse_frame_widths(unsigned char *a, int ww, int www, int **op, int
}
*op = o;
*olp = ol;
- q = gf_val(2 * ol - 1, ol);
+ q = 2 * ol - 1;
for (i = 0; i < ol; i++) if (o[i] > 0) q += o[i] - 1;
if (q >= ww) {
distribute:
@@ -2459,8 +2460,8 @@ static void html_frameset(unsigned char *a)
x = f->f[f->xp + f->yp * f->x].xw;
y = f->f[f->xp + f->yp * f->x].yw;
}
- parse_frame_widths(c, x, gf_val(HTML_FRAME_CHAR_WIDTH, 1), &fp.xw, &fp.x);
- parse_frame_widths(d, y, gf_val(HTML_FRAME_CHAR_HEIGHT, 1), &fp.yw, &fp.y);
+ parse_frame_widths(c, x, HTML_FRAME_CHAR_WIDTH, &fp.xw, &fp.x);
+ parse_frame_widths(d, y, HTML_FRAME_CHAR_HEIGHT, &fp.yw, &fp.y);
fp.parent = html_top.frameset;
if (fp.x && fp.y) {
html_top.frameset = special_f(ff, SP_FRAMESET, &fp);
diff --git a/html_tbl.c b/html_tbl.c
@@ -658,7 +658,7 @@ do { \
static void get_cell_widths(struct table *t)
{
- int nl = gf_val(t->p->link_num, t->gp->link_num);
+ int nl = t->p->link_num;
int i, j;
if (!d_opt->table_order)
for (j = 0; j < t->y; j++) for (i = 0; i < t->x; i++) g_c_w(CELL(t, i, j));
@@ -685,7 +685,6 @@ static void dst_width(int *p, int n, int w, int *lim)
}
}
if (w) {
- /*if (!lim) internal("bug in dst_width");*/
lim = NULL;
s = 0;
goto again;
@@ -829,7 +828,7 @@ static void distribute_widths(struct table *t, int width)
if (t->w_c[i] < t->max_c[i] && (om == 3 || t->xcols[i] == W_AUTO)) {
mx[i] = t->max_c[i] - t->w_c[i];
if (mmax_c)
- w[i] = safe_add(gf_val(5, 5 * HTML_CHAR_WIDTH), t->max_c[i] * 10 / mmax_c);
+ w[i] = safe_add(5, t->max_c[i] * 10 / mmax_c);
else w[i] = 1;
}
break;
@@ -1236,10 +1235,11 @@ void format_table(unsigned char *attr, unsigned char *html, unsigned char *eof,
html_top.dontkill = 1;
par_format.align = AL_LEFT;
if ((border = get_num(attr, cast_uchar "border")) == -1) border = has_attr(attr, cast_uchar "border") || has_attr(attr, cast_uchar "rules") || has_attr(attr, cast_uchar "frame");
- if ((cellsp = get_num(attr, cast_uchar "cellspacing")) == -1) cellsp = gf_val(1, 2);
+ if ((cellsp = get_num(attr, cast_uchar "cellspacing")) == -1)
+ cellsp = 1;
if ((cellpd = get_num(attr, cast_uchar "cellpadding")) == -1) {
- vcellpd = gf_val(0, 1);
- cellpd = gf_val(!!border, 1);
+ vcellpd = 0;
+ cellpd = !!border;
} else {
vcellpd = cellpd >= HTML_CHAR_HEIGHT / 2 + 1;
cellpd = cellpd >= HTML_CHAR_WIDTH / 2 + 1;
@@ -1297,16 +1297,17 @@ void format_table(unsigned char *attr, unsigned char *html, unsigned char *eof,
}
if (!border) frame = F_VOID;
wf = 0;
- if ((width = get_width(attr, cast_uchar "width", gf_val(p->data || p->xp, !!gp->data))) == -1) {
- width = par_format.width - safe_add(par_format.leftmargin, par_format.rightmargin) * gf_val(1, G_HTML_MARGIN);
+ if ((width = get_width(attr, cast_uchar "width", (p->data || p->xp))) == -1) {
+ width = par_format.width - safe_add(par_format.leftmargin, par_format.rightmargin);
if (width < 0) width = 0;
wf = 1;
}
- t = parse_table(html, eof, end, &bgcolor, gf_val(p->data || p->xp, !!gp->data), &bad_html, &bad_html_n);
+ t = parse_table(html, eof, end, &bgcolor, (p->data || p->xp), &bad_html, &bad_html_n);
for (i = 0; i < bad_html_n; i++) {
while (bad_html[i].s < bad_html[i].e && WHITECHAR(*bad_html[i].s)) bad_html[i].s++;
while (bad_html[i].s < bad_html[i].e && WHITECHAR(bad_html[i].e[-1])) bad_html[i].e--;
- if (bad_html[i].s < bad_html[i].e) parse_html(bad_html[i].s, bad_html[i].e, put_chars_f, line_break_f, special_f, gf_val((void *)p, (void *)gp), NULL);
+ if (bad_html[i].s < bad_html[i].e)
+ parse_html(bad_html[i].s, bad_html[i].e, put_chars_f, line_break_f, special_f, (void *)p, NULL);
}
free(bad_html);
t->p = p;
@@ -1327,11 +1328,13 @@ void format_table(unsigned char *attr, unsigned char *html, unsigned char *eof,
get_cell_widths(t);
if (get_column_widths(t)) goto ret2;
get_table_width(t);
- if (gf_val(!p->data && !p->xp, !gp->data)) {
+ if ((!p->data && !p->xp)) {
if (!wf && t->max_t > width) t->max_t = width;
if (t->max_t < t->min_t) t->max_t = t->min_t;
- if (safe_add(t->max_t, safe_add(par_format.leftmargin, par_format.rightmargin) * gf_val(1, G_HTML_MARGIN)) > gf_val(p->xmax, gp->xmax)) *gf_val(&p->xmax, &gp->xmax) = t->max_t + (par_format.leftmargin + par_format.rightmargin) * gf_val(1, G_HTML_MARGIN);
- if (safe_add(t->min_t, safe_add(par_format.leftmargin, par_format.rightmargin) * gf_val(1, G_HTML_MARGIN)) > gf_val(p->x, gp->x)) *gf_val(&p->x, &gp->x) = t->min_t + (par_format.leftmargin + par_format.rightmargin) * gf_val(1, G_HTML_MARGIN);
+ if (safe_add(t->max_t, safe_add(par_format.leftmargin, par_format.rightmargin)) > p->xmax)
+ p->xmax = t->max_t + par_format.leftmargin + par_format.rightmargin;
+ if (safe_add(t->min_t, safe_add(par_format.leftmargin, par_format.rightmargin)) > p->x)
+ p->x = t->min_t + par_format.leftmargin + par_format.rightmargin;
goto ret2;
}
if (!cpd_pass && t->min_t > width && t->cellpd) {
@@ -1384,8 +1387,8 @@ void format_table(unsigned char *attr, unsigned char *html, unsigned char *eof,
add_to_list(p->data->nodes, nn);
p->cy = cye;
- ret2:
- *gf_val(&p->link_num, &gp->link_num) = t->link_num;
+ ret2:
+ p->link_num = t->link_num;
if (p->cy > p->y)
p->y = p->cy;
if (t) free_table(t);
diff --git a/links.h b/links.h
@@ -72,8 +72,6 @@ do { \
(ret_) = (call_); \
} while (!(ret_) && errno == EINTR)
-#define gf_val(x, y) (x)
-
#define MAX_STR_LEN 1024
#define BIN_SEARCH(entries, eq, ab, key, result) \
@@ -1807,10 +1805,8 @@ struct memory_list *getml(void *, ...);
void add_to_ml(struct memory_list **, ...);
void freeml(struct memory_list *);
-#define DIALOG_LB gf_val(DIALOG_LEFT_BORDER + DIALOG_LEFT_INNER_BORDER + 1, G_DIALOG_LEFT_BORDER + G_DIALOG_VLINE_SPACE + 1 + G_DIALOG_LEFT_INNER_BORDER)
-#define DIALOG_TB gf_val(DIALOG_TOP_BORDER + DIALOG_TOP_INNER_BORDER + 1, G_DIALOG_TOP_BORDER + G_DIALOG_HLINE_SPACE + 1 + G_DIALOG_TOP_INNER_BORDER)
-
-#define LL gf_val(1, G_BFU_FONT_SIZE)
+#define DIALOG_LB DIALOG_LEFT_BORDER + DIALOG_LEFT_INNER_BORDER + 1
+#define DIALOG_TB DIALOG_TOP_BORDER + DIALOG_TOP_INNER_BORDER + 1
extern unsigned char m_bar;
diff --git a/listedit.c b/listedit.c
@@ -876,7 +876,7 @@ static void redraw_list(struct terminal *term, void *bla)
redraw_list_element(term, dlg, y, w, ld, l);
l = next_in_tree(ld, l);
a++;
- y += gf_val(1, G_BFU_FONT_SIZE);
+ y++;
if (l == ld->list) break;
}
fill_area(term, dlg->x + DIALOG_LB, y, w, ld->n_items-a, ' ', COLOR_MENU_TEXT);
@@ -892,14 +892,14 @@ static void redraw_list_line(struct terminal *term, void *bla)
struct dialog_data *dlg = rd->dlg;
int direction = rd->n;
int w = dlg->xw - 2 * DIALOG_LB;
- int y = dlg->y + DIALOG_TB + gf_val(ld->win_pos, ld->win_pos * G_BFU_FONT_SIZE);
+ int y = dlg->y + DIALOG_TB + ld->win_pos;
struct list *l;
redraw_list_element(term, dlg, y, w, ld, ld->current_pos);
if (!term->spec->block_cursor) {
set_cursor(term, dlg->x + DIALOG_LB, y, dlg->x + DIALOG_LB, y);
}
- y += gf_val(direction, direction * G_BFU_FONT_SIZE);
+ y += direction;
switch (direction) {
case 0:
l = NULL;
@@ -1211,12 +1211,12 @@ static int list_event_handler(struct dialog_data *dlg, struct links_event *ev)
if (
(ev->y)<(dlg->y+DIALOG_TB)||
- (ev->y)>=(dlg->y+DIALOG_TB+gf_val(ld->n_items,G_BFU_FONT_SIZE*(ld->n_items)))||
+ ev->y >= (dlg->y + DIALOG_TB + ld->n_items) ||
(ev->x)<(dlg->x+DIALOG_LB)||
(ev->x)>(dlg->x+dlg->xw-DIALOG_LB)
)break; /* out of the dialog */
- n=(ev->y-dlg->y-DIALOG_TB)/gf_val(1,G_BFU_FONT_SIZE);
+ n = ev->y - dlg->y - DIALOG_TB;
for (a=0;a<n;a++)
{
struct list *l1;
@@ -1224,7 +1224,6 @@ static int list_event_handler(struct dialog_data *dlg, struct links_event *ev)
if (l1==ld->list)goto break2;
else l=l1;
}
- /*a=ld->type?((l->depth)>=0?(l->depth)+1:0):(l->depth>=0);*/
l->type^=4;
ld->current_pos=l;
@@ -1243,12 +1242,12 @@ static int list_event_handler(struct dialog_data *dlg, struct links_event *ev)
if (
(ev->y)<(dlg->y+DIALOG_TB)||
- (ev->y)>=(dlg->y+DIALOG_TB+gf_val(ld->n_items,G_BFU_FONT_SIZE*(ld->n_items)))||
+ ev->y >= (dlg->y + DIALOG_TB + ld->n_items) ||
(ev->x)<(dlg->x+DIALOG_LB)||
(ev->x)>(dlg->x+dlg->xw-DIALOG_LB)
)goto skip_item_click; /* out of the dialog */
- n=(ev->y-dlg->y-DIALOG_TB)/gf_val(1,G_BFU_FONT_SIZE);
+ n = ev->y - dlg->y - DIALOG_TB;
for (a=0;a<n;a++)
{
struct list *l1;
@@ -1392,7 +1391,7 @@ static void create_list_window_fn(struct dialog_data *dlg)
dlg_format_buttons(dlg, NULL, dlg->items, a, 0, &y, w, &rw, AL_CENTER);
n_items = term->y - y;
- n_items -= gf_val(2, 3) * DIALOG_TB + gf_val(2, 2 * G_BFU_FONT_SIZE);
+ n_items -= 2 * DIALOG_TB + 2;
if (n_items < 2) n_items = 2;
ld->n_items = n_items;
@@ -1401,7 +1400,7 @@ static void create_list_window_fn(struct dialog_data *dlg)
ld->win_pos--;
}
- y += gf_val(ld->n_items,ld->n_items*G_BFU_FONT_SIZE);
+ y += ld->n_items;
rw=w;
dlg->xw=rw+2*DIALOG_LB;
@@ -1415,7 +1414,7 @@ static void create_list_window_fn(struct dialog_data *dlg)
draw_to_window(dlg->win,redraw_list,&rd);
- y=dlg->y+DIALOG_TB+gf_val(ld->n_items+1,(ld->n_items+1)*G_BFU_FONT_SIZE);
+ y = dlg->y + DIALOG_TB + ld->n_items + 1;
dlg_format_buttons(dlg, term, dlg->items, a, dlg->x+DIALOG_LB, &y, w, &rw, AL_CENTER);
}
diff --git a/menu.c b/menu.c
@@ -726,7 +726,7 @@ static void proxy_fn(struct dialog_data *dlg)
int max = 0, min = 0;
int w, rw;
int i;
- int y = gf_val(-1, -G_BFU_FONT_SIZE);
+ int y = -1;
for (i = 0; i < N_N; i++) {
max_text_width(term, proxy_msg[i], &max, AL_LEFT);
min_text_width(term, proxy_msg[i], &min, AL_LEFT);
@@ -743,10 +743,10 @@ static void proxy_fn(struct dialog_data *dlg)
rw = 0;
for (i = 0; i < N_N; i++) {
dlg_format_text_and_field(dlg, NULL, proxy_msg[i], &dlg->items[i], 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
}
dlg_format_group(dlg, NULL, proxy_msg + N_N, dlg->items + N_N, dlg->n - 2 - N_N, 0, &y, w, &rw);
- y += LL;
+ y++;
dlg_format_buttons(dlg, NULL, dlg->items + dlg->n - 2, 2, 0, &y, w, &rw, AL_CENTER);
w = rw;
dlg->xw = w + 2 * DIALOG_LB;
@@ -756,10 +756,10 @@ static void proxy_fn(struct dialog_data *dlg)
y = dlg->y + DIALOG_TB;
for (i = 0; i < N_N; i++) {
dlg_format_text_and_field(dlg, term, proxy_msg[i], &dlg->items[i], dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += gf_val(1, G_BFU_FONT_SIZE);
+ y++;
}
dlg_format_group(dlg, term, proxy_msg + N_N, &dlg->items[N_N], dlg->n - 2 - N_N, dlg->x + DIALOG_LB, &y, w, NULL);
- y += gf_val(1, G_BFU_FONT_SIZE);
+ y++;
dlg_format_buttons(dlg, term, &dlg->items[dlg->n - 2], 2, dlg->x + DIALOG_LB, &y, w, NULL, AL_CENTER);
}
@@ -1110,28 +1110,28 @@ static void ssl_options_fn(struct dialog_data *dlg)
if (w < 5) w = 5;
rw = 0;
dlg_format_checkboxes(dlg, NULL, dlg->items, dlg->n - 5, 0, &y, w, &rw, dlg->dlg->udata);
- y += LL;
+ y++;
dlg_format_text_and_field(dlg, NULL, ssl_labels[dlg->n - 5], dlg->items + dlg->n - 5, 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_text_and_field(dlg, NULL, ssl_labels[dlg->n - 4], dlg->items + dlg->n - 4, 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_text_and_field(dlg, NULL, ssl_labels[dlg->n - 3], dlg->items + dlg->n - 3, 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_buttons(dlg, NULL, dlg->items + dlg->n - 2, 2, 0, &y, w, &rw, AL_CENTER);
w = rw;
dlg->xw = rw + 2 * DIALOG_LB;
dlg->yw = y + 2 * DIALOG_TB;
center_dlg(dlg);
draw_dlg(dlg);
- y = dlg->y + DIALOG_TB + LL;
+ y = dlg->y + DIALOG_TB + 1;
dlg_format_checkboxes(dlg, term, dlg->items, dlg->n - 5, dlg->x + DIALOG_LB, &y, w, NULL, dlg->dlg->udata);
- y += LL;
+ y++;
dlg_format_text_and_field(dlg, term, ssl_labels[dlg->n - 5], dlg->items + dlg->n - 5, dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_text_and_field(dlg, term, ssl_labels[dlg->n - 4], dlg->items + dlg->n - 4, dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_text_and_field(dlg, term, ssl_labels[dlg->n - 3], dlg->items + dlg->n - 3, dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_buttons(dlg, term, dlg->items + dlg->n - 2, 2, dlg->x + DIALOG_LB, &y, w, &rw, AL_CENTER);
}
@@ -1221,28 +1221,28 @@ static void httpheadopt_fn(struct dialog_data *dlg)
if (w < 5) w = 5;
rw = 0;
dlg_format_checkboxes(dlg, NULL, dlg->items, dlg->n - 5, 0, &y, w, &rw, dlg->dlg->udata);
- y += LL;
+ y++;
dlg_format_text_and_field(dlg, NULL, http_header_labels[dlg->n - 5], dlg->items + dlg->n - 5, 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_text_and_field(dlg, NULL, http_header_labels[dlg->n - 4], dlg->items + dlg->n - 4, 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_text_and_field(dlg, NULL, http_header_labels[dlg->n - 3], dlg->items + dlg->n - 3, 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_buttons(dlg, NULL, dlg->items + dlg->n - 2, 2, 0, &y, w, &rw, AL_CENTER);
w = rw;
dlg->xw = rw + 2 * DIALOG_LB;
dlg->yw = y + 2 * DIALOG_TB;
center_dlg(dlg);
draw_dlg(dlg);
- y = dlg->y + DIALOG_TB + LL;
+ y = dlg->y + DIALOG_TB + 1;
dlg_format_checkboxes(dlg, term, dlg->items, dlg->n - 5, dlg->x + DIALOG_LB, &y, w, NULL, dlg->dlg->udata);
- y += LL;
+ y++;
dlg_format_text_and_field(dlg, term, http_header_labels[dlg->n - 5], dlg->items + dlg->n - 5, dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_text_and_field(dlg, term, http_header_labels[dlg->n - 4], dlg->items + dlg->n - 4, dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_text_and_field(dlg, term, http_header_labels[dlg->n - 3], dlg->items + dlg->n - 3, dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_buttons(dlg, term, dlg->items + dlg->n - 2, 2, dlg->x + DIALOG_LB, &y, w, &rw, AL_CENTER);
}
@@ -1458,7 +1458,7 @@ void dialog_html_options(struct session *ses)
d = mem_calloc(sizeof(struct dialog) + 14 * sizeof(struct dialog_item));
d->title = TEXT_(T_HTML_OPTIONS);
d->fn = group_fn;
- d->udata = (void *)gf_val(html_texts, html_texts_g);
+ d->udata = (void *)html_texts;
d->udata2 = ses;
d->refresh = html_refresh;
d->refresh_data = ses;
@@ -1577,7 +1577,7 @@ static void menu_color(struct terminal *term, void *xxx, void *ses_)
d = mem_calloc(sizeof(struct dialog) + 6 * sizeof(struct dialog_item));
d->title = TEXT_(T_COLOR);
d->fn = group_fn;
- d->udata = (void *)gf_val(color_texts, color_texts_g);
+ d->udata = (void *)color_texts;
d->udata2 = ses;
d->refresh = html_color_refresh;
d->refresh_data = ses;
@@ -1604,7 +1604,7 @@ static void menu_color(struct terminal *term, void *xxx, void *ses_)
d->items[2].dlen = sizeof(int);
d->items[3].type = D_CHECKBOX;
- d->items[3].data = (unsigned char *) gf_val(&ses->ds.t_ignore_document_color, &ses->ds.g_ignore_document_color);
+ d->items[3].data = (unsigned char *)(&ses->ds.t_ignore_document_color);
d->items[3].dlen = sizeof(int);
d->items[4].type = D_BUTTON;
@@ -1672,10 +1672,10 @@ static void miscopt_fn(struct dialog_data *dlg)
if (bmk) {
dlg_format_text_and_field(dlg, NULL, labels[0], dlg->items + dlg->n - 4 - a - bmk, 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
}
if (bmk) {
- y += LL;
+ y++;
dlg_format_buttons(dlg, NULL, dlg->items + dlg->n - 3 - a - bmk, 1, 0, &y, w, &rw, AL_LEFT);
}
if (a) dlg_format_buttons(dlg, NULL, dlg->items + dlg->n - 3 - bmk, 1, 0, &y, w, &rw, AL_LEFT);
@@ -1687,16 +1687,16 @@ static void miscopt_fn(struct dialog_data *dlg)
center_dlg(dlg);
draw_dlg(dlg);
y = dlg->y + DIALOG_TB;
- y += LL;
+ y++;
if (bmk) {
dlg_format_text_and_field(dlg, term, labels[0], dlg->items + dlg->n - 4 - a - bmk, dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_buttons(dlg, term, dlg->items + dlg->n - 3 - a - bmk, 1, dlg->x + DIALOG_LB, &y, w, NULL, AL_CENTER);
}
if (a) dlg_format_buttons(dlg, term, dlg->items + dlg->n - 3 - bmk, 1, dlg->x + DIALOG_LB, &y, w, NULL, AL_CENTER);
if (bmk) {
dlg_format_checkboxes(dlg, term, dlg->items + dlg->n - 3, 1, dlg->x + DIALOG_LB, &y, w, NULL, miscopt_checkbox_labels);
- y += LL;
+ y++;
}
dlg_format_buttons(dlg, term, dlg->items+dlg->n-2, 2, dlg->x + DIALOG_LB, &y, w, NULL, AL_CENTER);
}
@@ -2015,7 +2015,7 @@ static void do_setup_menu(struct terminal *term, void *xxx, void *ses_)
static void do_help_menu(struct terminal *term, void *xxx, void *ses_)
{
struct session *ses = (struct session *)ses_;
- do_menu(term, (struct menu_item *)gf_val(help_menu, help_menu_g), ses);
+ do_menu(term, (struct menu_item *)help_menu, ses);
}
@@ -2035,7 +2035,7 @@ void activate_bfu_technology(struct session *ses, int item)
{
struct terminal *term = ses->term;
struct menu_item *m = (struct menu_item *)main_menu;
- do_mainmenu(term, gf_val(m, mg), ses, item);
+ do_mainmenu(term, m, ses, item);
}
struct history goto_url_history = { 0, { &goto_url_history.items, &goto_url_history.items } };
diff --git a/objreq.c b/objreq.c
@@ -13,8 +13,6 @@ static void object_timer(void *);
static struct list_head requests = {&requests, &requests};
static tcount obj_req_count = 1;
-#define LL gf_val(1, G_BFU_FONT_SIZE)
-
#define MAX_UID_LEN 256
struct auth_dialog {
@@ -54,11 +52,11 @@ static void auth_fn(struct dialog_data *dlg)
if (w < min) w = min;
rw = w;
dlg_format_text(dlg, NULL, a->msg, 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_text_and_field(dlg, NULL, TEXT_(T_USERID), dlg->items, 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_text_and_field(dlg, NULL, TEXT_(T_PASSWORD), dlg->items + 1, 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_buttons(dlg, NULL, dlg->items + 2, 2, 0, &y, w, &rw, AL_CENTER);
w = rw;
dlg->xw = rw + 2 * DIALOG_LB;
@@ -66,13 +64,13 @@ static void auth_fn(struct dialog_data *dlg)
center_dlg(dlg);
draw_dlg(dlg);
y = dlg->y + DIALOG_TB;
- y += LL;
+ y++;
dlg_format_text(dlg, term, a->msg, dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_text_and_field(dlg, term, TEXT_(T_USERID), dlg->items, dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_text_and_field(dlg, term, TEXT_(T_PASSWORD), dlg->items + 1, dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += LL;
+ y++;
dlg_format_buttons(dlg, term, dlg->items + 2, 2, dlg->x + DIALOG_LB, &y, w, NULL, AL_CENTER);
}
diff --git a/session.c b/session.c
@@ -618,16 +618,17 @@ void download_window_function(struct dialog_data *dlg)
if (w < 1) w = 1;
y = 0;
dlg_format_text(dlg, NULL, u, 0, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += gf_val(1, G_BFU_FONT_SIZE);
- if (show_percentage) y += gf_val(2, 2 * G_BFU_FONT_SIZE);
+ y++;
+ if (show_percentage)
+ y += 2;
dlg_format_text(dlg, NULL, m, 0, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += gf_val(1, G_BFU_FONT_SIZE);
+ y++;
dlg_format_buttons(dlg, NULL, dlg->items, dlg->n, 0, &y, w, NULL, AL_CENTER);
dlg->xw = w + 2 * DIALOG_LB;
dlg->yw = y + 2 * DIALOG_TB;
center_dlg(dlg);
draw_dlg(dlg);
- y = dlg->y + DIALOG_TB + gf_val(1, G_BFU_FONT_SIZE);
+ y = dlg->y + DIALOG_TB + 1;
x = dlg->x + DIALOG_LB;
dlg_format_text(dlg, term, u, x, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
if (show_percentage) {
@@ -642,9 +643,9 @@ void download_window_function(struct dialog_data *dlg)
free(q);
y++;
}
- y += gf_val(1, G_BFU_FONT_SIZE);
+ y++;
dlg_format_text(dlg, term, m, x, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += gf_val(1, G_BFU_FONT_SIZE);
+ y++;
dlg_format_buttons(dlg, term, dlg->items, dlg->n, x, &y, w, NULL, AL_CENTER);
free(u);
free(m);
@@ -1549,11 +1550,11 @@ static void create_new_frames(struct f_data_c *fd, struct frameset_desc *fs, str
request_object(fd->ses->term, loc->url, rel->rq ? rel->rq->url : NULL, PRI_FRAME, NC_CACHE, rel->rq ? get_allow_flags(rel->rq->url) : 0, fd_loaded, nfdc, &nfdc->rq);
}
}
- xp += frm->xw + gf_val(1, 0);
+ xp += frm->xw + 1;
frm++;
if (!c_loc) lloc = lloc->next;
}
- yp += (frm - 1)->yw + gf_val(1, 0);
+ yp += (frm - 1)->yw + 1;
}
}
@@ -2661,12 +2662,12 @@ void reload(struct session *ses, int no_cache)
static void set_doc_view(struct session *ses)
{
ses->screen->xp = 0;
- ses->screen->yp = gf_val(1, G_BFU_FONT_SIZE);
+ ses->screen->yp = 1;
ses->screen->xw = ses->term->x;
- if (ses->term->y < gf_val(2, 2 * G_BFU_FONT_SIZE))
+ if (ses->term->y < 2)
ses->screen->yw = 0;
else
- ses->screen->yw = ses->term->y - gf_val(2, 2 * G_BFU_FONT_SIZE);
+ ses->screen->yw = ses->term->y - 2;
}
static struct session *create_session(struct window *win)
@@ -2682,8 +2683,8 @@ static struct session *create_session(struct window *win)
ses->id = session_id++;
ses->screen = create_f_data_c(ses, NULL);
ses->screen->xp = 0; ses->screen->xw = term->x;
- ses->screen->yp = gf_val(1, G_BFU_FONT_SIZE);
- ses->screen->yw = term->y - gf_val(2, 2 * G_BFU_FONT_SIZE);
+ ses->screen->yp = 1;
+ ses->screen->yw = term->y - 2;
memcpy(&ses->ds, &dds, sizeof(struct document_setup));
init_list(ses->format_cache);
add_to_list(sessions, ses);
diff --git a/setup.h b/setup.h
@@ -157,5 +157,5 @@
* BFU_ELEMENT_WIDTH is a size of one bfu element (doesn't depend on graphical/text mode)
*/
#define BFU_GRX_WIDTH (G_BFU_FONT_SIZE >> 1)
-#define BFU_ELEMENT_WIDTH (gf_val(5, 5 * BFU_GRX_WIDTH))
+#define BFU_ELEMENT_WIDTH 5
#define BFU_GRX_HEIGHT G_BFU_FONT_SIZE
diff --git a/types.c b/types.c
@@ -157,7 +157,7 @@ static void assoc_edit_item_fn(struct dialog_data *dlg)
struct terminal *term = dlg->win->term;
int max = 0, min = 0;
int w, rw;
- int y = gf_val(-1, -G_BFU_FONT_SIZE);
+ int y = -1;
int p = 3;
p++;
p += 2;
@@ -178,13 +178,13 @@ static void assoc_edit_item_fn(struct dialog_data *dlg)
if (w < 1) w = 1;
rw = 0;
dlg_format_text_and_field(dlg, NULL, get_text_translation(ct_msg[0], term), &dlg->items[0], 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
- y += gf_val(1, G_BFU_FONT_SIZE * 1);
+ y++;
dlg_format_text_and_field(dlg, NULL, get_text_translation(ct_msg[1], term), &dlg->items[1], 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
- y += gf_val(1, G_BFU_FONT_SIZE * 1);
+ y++;
dlg_format_text_and_field(dlg, NULL, get_text_translation(ct_msg[2], term), &dlg->items[2], 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
- y += gf_val(1, G_BFU_FONT_SIZE * 1);
+ y++;
dlg_format_group(dlg, NULL, ct_msg + 3, dlg->items + 3, p, 0, &y, w, &rw);
- y += gf_val(1, G_BFU_FONT_SIZE);
+ y++;
dlg_format_buttons(dlg, NULL, dlg->items + 3 + p, 2, 0, &y, w, &rw, AL_CENTER);
w = rw;
dlg->xw = w + 2 * DIALOG_LB;
@@ -193,13 +193,13 @@ static void assoc_edit_item_fn(struct dialog_data *dlg)
draw_dlg(dlg);
y = dlg->y + DIALOG_TB;
dlg_format_text_and_field(dlg, term, ct_msg[0], &dlg->items[0], dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += gf_val(1, G_BFU_FONT_SIZE);
+ y++;
dlg_format_text_and_field(dlg, term, ct_msg[1], &dlg->items[1], dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += gf_val(1, G_BFU_FONT_SIZE);
+ y++;
dlg_format_text_and_field(dlg, term, ct_msg[2], &dlg->items[2], dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += gf_val(1, G_BFU_FONT_SIZE);
+ y++;
dlg_format_group(dlg, term, ct_msg + 3, &dlg->items[3], p, dlg->x + DIALOG_LB, &y, w, NULL);
- y += gf_val(1, G_BFU_FONT_SIZE);
+ y++;
dlg_format_buttons(dlg, term, &dlg->items[3 + p], 2, dlg->x + DIALOG_LB, &y, w, NULL, AL_CENTER);
}
@@ -518,7 +518,7 @@ static void ext_edit_item_fn(struct dialog_data *dlg)
struct terminal *term = dlg->win->term;
int max = 0, min = 0;
int w, rw;
- int y = gf_val(-1, -G_BFU_FONT_SIZE);
+ int y = -1;
max_text_width(term, ext_msg[0], &max, AL_LEFT);
min_text_width(term, ext_msg[0], &min, AL_LEFT);
max_text_width(term, ext_msg[1], &max, AL_LEFT);
@@ -536,9 +536,9 @@ static void ext_edit_item_fn(struct dialog_data *dlg)
w = 1;
rw = 0;
dlg_format_text_and_field(dlg, NULL, ext_msg[0], &dlg->items[0], 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
- y += gf_val(1, G_BFU_FONT_SIZE * 1);
+ y++;
dlg_format_text_and_field(dlg, NULL, ext_msg[1], &dlg->items[1], 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT);
- y += gf_val(1, G_BFU_FONT_SIZE * 1);
+ y++;
dlg_format_buttons(dlg, NULL, dlg->items + 2, 2, 0, &y, w, &rw, AL_CENTER);
w = rw;
dlg->xw = w + 2 * DIALOG_LB;
@@ -547,9 +547,9 @@ static void ext_edit_item_fn(struct dialog_data *dlg)
draw_dlg(dlg);
y = dlg->y + DIALOG_TB;
dlg_format_text_and_field(dlg, term, ext_msg[0], &dlg->items[0], dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += gf_val(1, G_BFU_FONT_SIZE);
+ y++;
dlg_format_text_and_field(dlg, term, ext_msg[1], &dlg->items[1], dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT);
- y += gf_val(1, G_BFU_FONT_SIZE);
+ y++;
dlg_format_buttons(dlg, term, &dlg->items[2], 2, dlg->x + DIALOG_LB, &y, w, NULL, AL_CENTER);
}
diff --git a/view.c b/view.c
@@ -2924,7 +2924,7 @@ void send_event(struct session *ses, struct links_event *ev)
go_back(ses, -1);
goto x;
}
- if (ev->y >= 0 && ev->y < gf_val(1, G_BFU_FONT_SIZE) && ev->x >=0 && ev->x < ses->term->x && (ev->b & BM_ACT) == B_DOWN) {
+ if (ev->y >= 0 && ev->y < 1 && ev->x >=0 && ev->x < ses->term->x && (ev->b & BM_ACT) == B_DOWN) {
struct window *m;
activate_bfu_technology(ses, -1);
m = list_struct(ses->term->windows.next, struct window);