mc/mc-utf8-look-and-feel.patch
Jindrich Novy d42c8bee89 - add vertical scrollbars to main panels and listboxes
- fix memleak in menu.c caused by UTF-8 patch
- display UTF-8 characters corectly in mcview (#172571)
- fix extensions patch
2005-11-08 12:52:55 +00:00

154 lines
4.2 KiB
Diff
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--- mc-4.6.1a/src/widget.c.laf 2005-11-06 08:49:25.000000000 +0100
+++ mc-4.6.1a/src/widget.c 2005-11-06 16:06:21.000000000 +0100
@@ -1948,52 +1948,74 @@ input_new (int y, int x, int color, int
return in;
}
-
-/* Listbox widget */
-
-/* Should draw the scrollbar, but currently draws only
- * indications that there is more information
- */
-static int listbox_cdiff (WLEntry *s, WLEntry *e);
+/* Vertical scrollbar widget */
-static void
-listbox_drawscroll (WListbox *l)
+void
+vscrollbar (Widget widget, int height, int width, int tpad, int bpad,
+ int selected, int count, gboolean color)
{
int line;
- int i, top;
- int max_line = l->height-1;
-
+ int i;
+
/* Are we at the top? */
- widget_move (&l->widget, 0, l->width);
- if (l->list == l->top)
- one_vline ();
+ widget_move (&widget, tpad, width);
+#ifndef UTF8
+ if (!selected)
+ one_vline ();
else
- addch ('^');
+ addch ('^');
+#else
+ if (color) attrset (MARKED_COLOR);
+ SLsmg_write_string("▲");
+ if (color) attrset (NORMAL_COLOR);
+#endif
/* Are we at the bottom? */
- widget_move (&l->widget, max_line, l->width);
- top = listbox_cdiff (l->list, l->top);
- if ((top + l->height == l->count) || l->height >= l->count)
- one_vline ();
+ widget_move (&widget, height-1-bpad, width);
+#ifndef UTF8
+ if (selected == count-1)
+ one_vline ();
else
- addch ('v');
+ addch ('v');
+#else
+ if (color) attrset (MARKED_COLOR);
+ SLsmg_write_string("▼");
+ if (color) attrset (NORMAL_COLOR);
+#endif
/* Now draw the nice relative pointer */
- if (l->count)
- line = 1+ ((l->pos * (l->height-2)) / l->count);
+ if (count > 1)
+ line = tpad + 1 + ((selected * (height-3-tpad-bpad)) / (count-1));
else
- line = 0;
-
- for (i = 1; i < max_line; i++){
- widget_move (&l->widget, i, l->width);
- if (i != line)
- one_vline ();
- else
- addch ('*');
+ line = 0;
+
+ for (i = tpad + 1; i < height-1-bpad; i++){
+ widget_move (&widget, i, width);
+ if (i != line)
+#ifndef UTF8
+ one_vline ();
+ else
+ addch ('*');
+#else
+ SLsmg_write_string("▒");
+ else {
+ if (color) attrset (MARKED_COLOR);
+ SLsmg_write_string("◌");
+ if (color) attrset (NORMAL_COLOR);
+ }
+#endif
}
}
-
-static void
+
+
+/* Listbox widget */
+
+/* Should draw the scrollbar, but currently draws only
+ * indications that there is more information
+ */
+static int listbox_cdiff (WLEntry *s, WLEntry *e);
+
+void
listbox_draw (WListbox *l, int focused)
{
WLEntry *e;
@@ -2034,7 +2056,7 @@ listbox_draw (WListbox *l, int focused)
if (!l->scrollbar)
return;
attrset (normalc);
- listbox_drawscroll (l);
+ vscrollbar (l->widget, l->height, l->width, 0, 0, l->pos, l->count, FALSE);
}
/* Returns the number of items between s and e,
--- mc-4.6.1a/src/screen.c.laf 2005-11-06 08:49:25.000000000 +0100
+++ mc-4.6.1a/src/screen.c 2005-11-06 16:04:59.000000000 +0100
@@ -887,6 +887,9 @@ show_dir (WPanel *panel)
}
#endif /* HAVE_SLANG */
+ vscrollbar (panel->widget, panel->widget.lines, panel->widget.cols-1, 2, 2,
+ panel->selected, panel->count, TRUE);
+
if (panel->active)
attrset (REVERSE_COLOR);
@@ -1503,7 +1506,7 @@ use_display_format (WPanel *panel, const
panel->dirty = 1;
/* Status needn't to be split */
- usable_columns = ((panel->widget.cols-2)/((isstatus)
+ usable_columns = ((panel->widget.cols-3)/((isstatus)
? 1
: (panel->split+1))) - (!isstatus && panel->split);
--- mc-4.6.1a/src/widget.h.laf 2005-11-06 08:49:25.000000000 +0100
+++ mc-4.6.1a/src/widget.h 2005-11-06 15:53:45.000000000 +0100
@@ -170,6 +170,10 @@ void button_set_text (WButton *b, const
/* Listbox manager */
WLEntry *listbox_get_data (WListbox *l, int pos);
+/* Vertical scrollbar */
+void vscrollbar (Widget widget, int height, int width, int tpad, int bpad,
+ int selected, int count, gboolean color);
+
/* search text int listbox entries */
WLEntry *listbox_search_text (WListbox *l, const char *text);
void listbox_select_entry (WListbox *l, WLEntry *dest);