1
1

Added ability to show progressbars (when copy files) from right to left.

For activate this, need to add into ini-file:

[Layout]
progressbar_always_left2right=0

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Этот коммит содержится в:
Slava Zanko 2010-02-23 11:43:47 +02:00
родитель 804ca8e7b0
Коммит 88a374a432
3 изменённых файлов: 24 добавлений и 4 удалений

Просмотреть файл

@ -79,6 +79,7 @@
#include "lib/global.h"
#include "lib/tty/key.h" /* tty_get_event */
#include "lib/mcconfig.h"
#include "lib/search.h"
#include "lib/vfs/mc-vfs/vfs.h"
#include "lib/strescape.h"
@ -332,6 +333,14 @@ file_op_context_create_ui_without_init (FileOpContext *ctx, gboolean with_eta, g
label_new (3, FCOPY_GAUGE_X, sixty));
add_widget (ui->op_dlg, ui->file_label[0] =
label_new (3, FCOPY_LABEL_X, fifteen));
if (
! mc_config_get_bool (mc_main_config,"Layout", "progressbar_always_left2right", TRUE) &&
right_panel == current_panel
) {
ui->progress_gauge[0]->from_left_to_right = FALSE;
ui->progress_gauge[1]->from_left_to_right = FALSE;
}
}
void

Просмотреть файл

@ -885,10 +885,19 @@ gauge_callback (Widget *w, widget_msg_t msg, int parm)
percentage = (200 * done / total + 1) / 2;
columns = (2 * (gauge_len - 7) * done / total + 1) / 2;
tty_print_char ('[');
tty_setcolor (GAUGE_COLOR);
tty_printf ("%*s", (int) columns, "");
tty_setcolor (DLG_NORMALC (h));
tty_printf ("%*s] %3d%%", (int)(gauge_len - 7 - columns), "", (int) percentage);
if (g->from_left_to_right) {
tty_setcolor (GAUGE_COLOR);
tty_printf ("%*s", (int) columns, "");
tty_setcolor (DLG_NORMALC (h));
tty_printf ("%*s] %3d%%", (int)(gauge_len - 7 - columns), "", (int) percentage);
} else {
tty_setcolor (DLG_NORMALC (h));
tty_printf ("%*s", gauge_len - columns - 7, "");
tty_setcolor (GAUGE_COLOR);
tty_printf ("%*s", columns, "");
tty_setcolor (DLG_NORMALC (h));
tty_printf ("] %3d%%", 100 * columns / (gauge_len - 7), percentage);
}
}
return MSG_HANDLED;
}
@ -929,6 +938,7 @@ gauge_new (int y, int x, int shown, int max, int current)
max = 1; /* I do not like division by zero :) */
g->max = max;
g->current = current;
g->from_left_to_right = TRUE;
widget_want_cursor (g->widget, 0);
return g;
}

Просмотреть файл

@ -89,6 +89,7 @@ typedef struct WGauge {
int shown;
int max;
int current;
gboolean from_left_to_right;
} WGauge;
GList *history_get (const char *input_name);