Allow draw a part of line if some coordinares are out of screen boundaries.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
140d4ea117
Коммит
62fc80f5f7
@ -330,31 +330,59 @@ tty_getyx (int *py, int *px)
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/* if x < 0 or y < 0, draw line starting from current position */
|
||||
|
||||
void
|
||||
tty_draw_hline (int y, int x, int ch, int len)
|
||||
{
|
||||
int x1;
|
||||
|
||||
if (y < 0 || y >= LINES || x >= COLS)
|
||||
return;
|
||||
|
||||
x1 = x;
|
||||
|
||||
if (x < 0)
|
||||
{
|
||||
len += x;
|
||||
if (len <= 0)
|
||||
return;
|
||||
x = 0;
|
||||
}
|
||||
|
||||
if ((chtype) ch == ACS_HLINE)
|
||||
ch = mc_tty_frm[MC_TTY_FRM_HORIZ];
|
||||
|
||||
if ((y >= 0) && (x >= 0))
|
||||
move (y, x);
|
||||
hline (ch, len);
|
||||
move (y, x1);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/* if x < 0 or y < 0, draw line starting from current position */
|
||||
|
||||
void
|
||||
tty_draw_vline (int y, int x, int ch, int len)
|
||||
{
|
||||
int y1;
|
||||
|
||||
if (x < 0 || x >= COLS || y >= LINES)
|
||||
return;
|
||||
|
||||
y1 = y;
|
||||
|
||||
if (y < 0)
|
||||
{
|
||||
len += y;
|
||||
if (len <= 0)
|
||||
return;
|
||||
y = 0;
|
||||
}
|
||||
|
||||
if ((chtype) ch == ACS_VLINE)
|
||||
ch = mc_tty_frm[MC_TTY_FRM_VERT];
|
||||
|
||||
if ((y >= 0) && (x >= 0))
|
||||
move (y, x);
|
||||
vline (ch, len);
|
||||
move (y1, x);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -509,54 +509,68 @@ tty_getyx (int *py, int *px)
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/* if x < 0 or y < 0, draw line staring from current position */
|
||||
|
||||
void
|
||||
tty_draw_hline (int y, int x, int ch, int len)
|
||||
{
|
||||
int x1;
|
||||
|
||||
if (y < 0 || y >= LINES || x >= COLS)
|
||||
return;
|
||||
|
||||
x1 = x;
|
||||
|
||||
if (x < 0)
|
||||
{
|
||||
len += x;
|
||||
if (len <= 0)
|
||||
return;
|
||||
x = 0;
|
||||
}
|
||||
|
||||
if (ch == ACS_HLINE)
|
||||
ch = mc_tty_frm[MC_TTY_FRM_HORIZ];
|
||||
|
||||
if ((y < 0) || (x < 0))
|
||||
{
|
||||
y = SLsmg_get_row ();
|
||||
x = SLsmg_get_column ();
|
||||
}
|
||||
else
|
||||
SLsmg_gotorc (y, x);
|
||||
|
||||
if (ch == 0)
|
||||
ch = ACS_HLINE;
|
||||
|
||||
SLsmg_gotorc (y, x);
|
||||
|
||||
if (ch == ACS_HLINE)
|
||||
SLsmg_draw_hline (len);
|
||||
else
|
||||
while (len-- != 0)
|
||||
tty_print_char (ch);
|
||||
|
||||
SLsmg_gotorc (y, x);
|
||||
SLsmg_gotorc (y, x1);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/* if x < 0 or y < 0, draw line staring from current position */
|
||||
|
||||
void
|
||||
tty_draw_vline (int y, int x, int ch, int len)
|
||||
{
|
||||
int y1;
|
||||
|
||||
if (x < 0 || x >= COLS || y >= LINES)
|
||||
return;
|
||||
|
||||
y1 = y;
|
||||
|
||||
if (y < 0)
|
||||
{
|
||||
len += y;
|
||||
if (len <= 0)
|
||||
return;
|
||||
y = 0;
|
||||
}
|
||||
|
||||
if (ch == ACS_VLINE)
|
||||
ch = mc_tty_frm[MC_TTY_FRM_VERT];
|
||||
|
||||
if ((y < 0) || (x < 0))
|
||||
{
|
||||
y = SLsmg_get_row ();
|
||||
x = SLsmg_get_column ();
|
||||
}
|
||||
else
|
||||
SLsmg_gotorc (y, x);
|
||||
|
||||
if (ch == 0)
|
||||
ch = ACS_VLINE;
|
||||
|
||||
SLsmg_gotorc (y, x);
|
||||
|
||||
if (ch == ACS_VLINE)
|
||||
SLsmg_draw_vline (len);
|
||||
else
|
||||
@ -571,7 +585,7 @@ tty_draw_vline (int y, int x, int ch, int len)
|
||||
}
|
||||
}
|
||||
|
||||
SLsmg_gotorc (y, x);
|
||||
SLsmg_gotorc (y1, x);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -177,20 +177,25 @@ tty_print_one_vline (gboolean single)
|
||||
void
|
||||
tty_draw_box (int y, int x, int ys, int xs, gboolean single)
|
||||
{
|
||||
int y2, x2;
|
||||
|
||||
ys--;
|
||||
xs--;
|
||||
|
||||
y2 = y + ys;
|
||||
x2 = x + xs;
|
||||
|
||||
tty_draw_vline (y, x, mc_tty_frm[single ? MC_TTY_FRM_VERT : MC_TTY_FRM_DVERT], ys);
|
||||
tty_draw_vline (y, x + xs, mc_tty_frm[single ? MC_TTY_FRM_VERT : MC_TTY_FRM_DVERT], ys);
|
||||
tty_draw_vline (y, x2, mc_tty_frm[single ? MC_TTY_FRM_VERT : MC_TTY_FRM_DVERT], ys);
|
||||
tty_draw_hline (y, x, mc_tty_frm[single ? MC_TTY_FRM_HORIZ : MC_TTY_FRM_DHORIZ], xs);
|
||||
tty_draw_hline (y + ys, x, mc_tty_frm[single ? MC_TTY_FRM_HORIZ : MC_TTY_FRM_DHORIZ], xs);
|
||||
tty_draw_hline (y2, x, mc_tty_frm[single ? MC_TTY_FRM_HORIZ : MC_TTY_FRM_DHORIZ], xs);
|
||||
tty_gotoyx (y, x);
|
||||
tty_print_alt_char (ACS_ULCORNER, single);
|
||||
tty_gotoyx (y + ys, x);
|
||||
tty_gotoyx (y2, x);
|
||||
tty_print_alt_char (ACS_LLCORNER, single);
|
||||
tty_gotoyx (y, x + xs);
|
||||
tty_gotoyx (y, x2);
|
||||
tty_print_alt_char (ACS_URCORNER, single);
|
||||
tty_gotoyx (y + ys, x + xs);
|
||||
tty_gotoyx (y2, x2);
|
||||
tty_print_alt_char (ACS_LRCORNER, single);
|
||||
}
|
||||
|
||||
|
@ -121,11 +121,14 @@ menubar_paint_idx (WMenuBar * menubar, unsigned int idx, int color)
|
||||
}
|
||||
else
|
||||
{
|
||||
int yt, xt;
|
||||
|
||||
/* menu text */
|
||||
tty_setcolor (color);
|
||||
widget_move (&menubar->widget, y, x);
|
||||
tty_print_char ((unsigned char) entry->first_letter);
|
||||
tty_draw_hline (-1, -1, ' ', menu->max_entry_len + 2); /* clear line */
|
||||
tty_getyx (&yt, &xt);
|
||||
tty_draw_hline (yt, xt, ' ', menu->max_entry_len + 2); /* clear line */
|
||||
tty_print_string (entry->text.start);
|
||||
|
||||
if (entry->text.hotkey != NULL)
|
||||
|
@ -864,7 +864,12 @@ format_file (char *dest, int limit, WPanel * panel, int file_index, int width, i
|
||||
}
|
||||
|
||||
if (length < width)
|
||||
tty_draw_hline (-1, -1, ' ', width - length);
|
||||
{
|
||||
int y, x;
|
||||
|
||||
tty_getyx (&y, &x);
|
||||
tty_draw_hline (y, x, ' ', width - length);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -1583,7 +1588,12 @@ paint_frame (WPanel * panel)
|
||||
g_string_free (format_txt, TRUE);
|
||||
|
||||
if (width > 0)
|
||||
tty_draw_hline (-1, -1, ' ', width);
|
||||
{
|
||||
int y, x;
|
||||
|
||||
tty_getyx (&y, &x);
|
||||
tty_draw_hline (y, x, ' ', width);
|
||||
}
|
||||
}
|
||||
|
||||
if (panel->list_type != list_long)
|
||||
|
@ -141,7 +141,7 @@ mcview_display_status (mcview_t * view)
|
||||
|
||||
tty_setcolor (STATUSBAR_COLOR);
|
||||
widget_move (view, top, left);
|
||||
tty_draw_hline (-1, -1, ' ', width);
|
||||
tty_draw_hline (top, left, ' ', width);
|
||||
|
||||
file_label =
|
||||
view->filename_vpath != NULL ?
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user