1
1

Merge branch '1648_single_boxes'

* 1648_single_boxes:
  Applied MC indentation policy.
  Merged tty_draw_double_box() function into tty_draw_box() one.
  Draw menu using double lines.
  Renamed frame symbol names.
  Added capability to draw single or double lines.
  Created new function: tty_draw_double_box().
  Fixed tty_print_alt_char() function for NCurses.
  Ticket #1648: implemented single-line boxes.
Этот коммит содержится в:
Andrew Borodin 2010-04-06 11:19:42 +04:00
родитель 3c19b9f002 a708b5c514
Коммит e1afcf372c
25 изменённых файлов: 3378 добавлений и 2957 удалений

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

@ -81,19 +81,29 @@ mc_skin_hardcoded_blackwhite_colors (mc_skin_t * mc_skin)
void void
mc_skin_hardcoded_space_lines (mc_skin_t * mc_skin) mc_skin_hardcoded_space_lines (mc_skin_t * mc_skin)
{ {
/* single lines */
set_lines ("vert", " ");
set_lines ("horiz", " ");
set_lines ("lefttop", " "); set_lines ("lefttop", " ");
set_lines ("righttop", " "); set_lines ("righttop", " ");
set_lines ("centertop", " ");
set_lines ("centerbottom", " ");
set_lines ("leftbottom", " "); set_lines ("leftbottom", " ");
set_lines ("rightbottom", " "); set_lines ("rightbottom", " ");
set_lines ("topmiddle", " ");
set_lines ("bottommiddle", " ");
set_lines ("leftmiddle", " "); set_lines ("leftmiddle", " ");
set_lines ("rightmiddle", " "); set_lines ("rightmiddle", " ");
set_lines ("centermiddle", " "); set_lines ("cross", " ");
set_lines ("horiz", " ");
set_lines ("vert", " "); set_lines ("dvert", " ");
set_lines ("thinhoriz", " "); set_lines ("dhoriz", " ");
set_lines ("thinvert", " "); set_lines ("dlefttop", " ");
set_lines ("drighttop", " ");
set_lines ("dleftbottom", " ");
set_lines ("drightbottom", " ");
set_lines ("dtopmiddle", " ");
set_lines ("dbottommiddle", " ");
set_lines ("dleftmiddle", " ");
set_lines ("drightmiddle", " ");
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
@ -101,19 +111,30 @@ mc_skin_hardcoded_space_lines (mc_skin_t * mc_skin)
void void
mc_skin_hardcoded_ugly_lines (mc_skin_t * mc_skin) mc_skin_hardcoded_ugly_lines (mc_skin_t * mc_skin)
{ {
/* single lines */
set_lines ("vert", "|");
set_lines ("horiz", "-");
set_lines ("lefttop", "+"); set_lines ("lefttop", "+");
set_lines ("righttop", "+"); set_lines ("righttop", "+");
set_lines ("centertop", "-");
set_lines ("centerbottom", "-");
set_lines ("leftbottom", "+"); set_lines ("leftbottom", "+");
set_lines ("rightbottom", "+"); set_lines ("rightbottom", "+");
set_lines ("topmiddle", "-");
set_lines ("bottommiddle", "-");
set_lines ("leftmiddle", "|"); set_lines ("leftmiddle", "|");
set_lines ("rightmiddle", "|"); set_lines ("rightmiddle", "|");
set_lines ("centermiddle", "+"); set_lines ("cross", "+");
set_lines ("horiz", "-");
set_lines ("vert", "|"); /* double lines */
set_lines ("thinhoriz", "-"); set_lines ("dvert", "|");
set_lines ("thinvert", "|"); set_lines ("dhoriz", "-");
set_lines ("dlefttop", "+");
set_lines ("drighttop", "+");
set_lines ("dleftbottom", "+");
set_lines ("drightbottom", "+");
set_lines ("dtopmiddle", "-");
set_lines ("dbottommiddle", "-");
set_lines ("dleftmiddle", "|");
set_lines ("drightmiddle", "|");
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */

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

@ -55,7 +55,9 @@ mc_skin_lines_load_frm (mc_skin_t * mc_skin, const char *name)
g_free (frm_val); g_free (frm_val);
switch (ret) { #if 0
switch (ret)
{
case 0x80: case 0x80:
ret = ACS_HLINE; ret = ACS_HLINE;
break; break;
@ -86,6 +88,7 @@ mc_skin_lines_load_frm (mc_skin_t * mc_skin, const char *name)
default: default:
break; break;
} }
#endif
return ret; return ret;
} }
@ -97,26 +100,35 @@ mc_skin_lines_load_frm (mc_skin_t * mc_skin, const char *name)
void void
mc_skin_lines_parse_ini_file (mc_skin_t * mc_skin) mc_skin_lines_parse_ini_file (mc_skin_t * mc_skin)
{ {
if (mc_args__slow_terminal) { if (mc_args__slow_terminal)
mc_skin_hardcoded_space_lines (mc_skin); mc_skin_hardcoded_space_lines (mc_skin);
} else if (mc_args__ugly_line_drawing) { else if (mc_args__ugly_line_drawing)
mc_skin_hardcoded_ugly_lines (mc_skin); mc_skin_hardcoded_ugly_lines (mc_skin);
}
mc_tty_ugly_frm[MC_TTY_FRM_horiz] = mc_skin_lines_load_frm (mc_skin, "horiz"); /* single lines */
mc_tty_ugly_frm[MC_TTY_FRM_vert] = mc_skin_lines_load_frm (mc_skin, "vert"); mc_tty_frm[MC_TTY_FRM_VERT] = mc_skin_lines_load_frm (mc_skin, "vert");
mc_tty_ugly_frm[MC_TTY_FRM_lefttop] = mc_skin_lines_load_frm (mc_skin, "lefttop"); mc_tty_frm[MC_TTY_FRM_HORIZ] = mc_skin_lines_load_frm (mc_skin, "horiz");
mc_tty_ugly_frm[MC_TTY_FRM_righttop] = mc_skin_lines_load_frm (mc_skin, "righttop"); mc_tty_frm[MC_TTY_FRM_LEFTTOP] = mc_skin_lines_load_frm (mc_skin, "lefttop");
mc_tty_ugly_frm[MC_TTY_FRM_leftbottom] = mc_skin_lines_load_frm (mc_skin, "leftbottom"); mc_tty_frm[MC_TTY_FRM_RIGHTTOP] = mc_skin_lines_load_frm (mc_skin, "righttop");
mc_tty_ugly_frm[MC_TTY_FRM_rightbottom] = mc_skin_lines_load_frm (mc_skin, "rightbottom"); mc_tty_frm[MC_TTY_FRM_LEFTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "leftbottom");
mc_tty_ugly_frm[MC_TTY_FRM_thinvert] = mc_skin_lines_load_frm (mc_skin, "thinvert"); mc_tty_frm[MC_TTY_FRM_RIGHTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "rightbottom");
mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz] = mc_skin_lines_load_frm (mc_skin, "thinhoriz"); mc_tty_frm[MC_TTY_FRM_TOPMIDDLE] = mc_skin_lines_load_frm (mc_skin, "topmiddle");
mc_tty_ugly_frm[MC_TTY_FRM_rightmiddle] = mc_skin_lines_load_frm (mc_skin, "rightmiddle"); mc_tty_frm[MC_TTY_FRM_BOTTOMMIDDLE] = mc_skin_lines_load_frm (mc_skin, "bottommiddle");
mc_tty_ugly_frm[MC_TTY_FRM_centertop] = mc_skin_lines_load_frm (mc_skin, "centertop"); mc_tty_frm[MC_TTY_FRM_LEFTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "leftmiddle");
mc_tty_ugly_frm[MC_TTY_FRM_centerbottom] = mc_skin_lines_load_frm (mc_skin, "centerbottom"); mc_tty_frm[MC_TTY_FRM_RIGHTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "rightmiddle");
mc_tty_ugly_frm[MC_TTY_FRM_centermiddle] = mc_skin_lines_load_frm (mc_skin, "centermiddle"); mc_tty_frm[MC_TTY_FRM_CROSS] = mc_skin_lines_load_frm (mc_skin, "cross");
mc_tty_ugly_frm[MC_TTY_FRM_leftmiddle] = mc_skin_lines_load_frm (mc_skin, "leftmiddle");
/* double lines */
mc_tty_frm[MC_TTY_FRM_DVERT] = mc_skin_lines_load_frm (mc_skin, "dvert");
mc_tty_frm[MC_TTY_FRM_DHORIZ] = mc_skin_lines_load_frm (mc_skin, "dhoriz");
mc_tty_frm[MC_TTY_FRM_DLEFTTOP] = mc_skin_lines_load_frm (mc_skin, "dlefttop");
mc_tty_frm[MC_TTY_FRM_DRIGHTTOP] = mc_skin_lines_load_frm (mc_skin, "drighttop");
mc_tty_frm[MC_TTY_FRM_DLEFTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "dleftbottom");
mc_tty_frm[MC_TTY_FRM_DRIGHTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "drightbottom");
mc_tty_frm[MC_TTY_FRM_DTOPMIDDLE] = mc_skin_lines_load_frm (mc_skin, "dtopmiddle");
mc_tty_frm[MC_TTY_FRM_DBOTTOMMIDDLE] = mc_skin_lines_load_frm (mc_skin, "dbottommiddle");
mc_tty_frm[MC_TTY_FRM_DLEFTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "dleftmiddle");
mc_tty_frm[MC_TTY_FRM_DRIGHTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "drightmiddle");
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */

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

@ -37,7 +37,7 @@
#include <signal.h> #include <signal.h>
#include "lib/global.h" #include "lib/global.h"
#include "lib/strutil.h" /* str_term_form */ #include "lib/strutil.h" /* str_term_form */
#include "src/main.h" #include "src/main.h"
@ -45,7 +45,7 @@
# define WANT_TERM_H # define WANT_TERM_H
#endif #endif
#include "tty-internal.h" /* slow_tty */ #include "tty-internal.h" /* slow_tty */
#include "tty.h" #include "tty.h"
#include "color-internal.h" #include "color-internal.h"
#include "win.h" #include "win.h"
@ -85,7 +85,8 @@ mc_tty_normalize_lines_char (const char *ch)
char *str2; char *str2;
int res; int res;
struct mc_tty_lines_struct { struct mc_tty_lines_struct
{
const char *line; const char *line;
int line_code; int line_code;
} const lines_codes[] = { } const lines_codes[] = {
@ -93,24 +94,24 @@ mc_tty_normalize_lines_char (const char *ch)
{"\342\224\220", ACS_LLCORNER}, /* ┐ */ {"\342\224\220", ACS_LLCORNER}, /* ┐ */
{"\342\224\224", ACS_URCORNER}, /* └ */ {"\342\224\224", ACS_URCORNER}, /* └ */
{"\342\224\230", ACS_ULCORNER}, /* ┘ */ {"\342\224\230", ACS_ULCORNER}, /* ┘ */
{"\342\224\234", ACS_LTEE}, /* ├ */ {"\342\224\234", ACS_LTEE}, /* ├ */
{"\342\224\244", ACS_RTEE}, /* ┤ */ {"\342\224\244", ACS_RTEE}, /* ┤ */
{"\342\224\254", ACS_TTEE}, /* ┬ */ {"\342\224\254", ACS_TTEE}, /* ┬ */
{"\342\224\264", ACS_BTEE}, /* ┴ */ {"\342\224\264", ACS_BTEE}, /* ┴ */
{"\342\224\200", ACS_HLINE}, /* ─ */ {"\342\224\200", ACS_HLINE}, /* ─ */
{"\342\224\202", ACS_VLINE}, /* │ */ {"\342\224\202", ACS_VLINE}, /* │ */
{"\342\224\274", ACS_PLUS}, /* ┼ */ {"\342\224\274", ACS_PLUS}, /* ┼ */
{"\342\225\235", ACS_LRCORNER | A_BOLD}, /* ╔ */ {"\342\225\235", ACS_LRCORNER | A_BOLD}, /* ╔ */
{"\342\225\232", ACS_LLCORNER | A_BOLD}, /* ╗ */ {"\342\225\232", ACS_LLCORNER | A_BOLD}, /* ╗ */
{"\342\225\227", ACS_URCORNER | A_BOLD}, /* ╚ */ {"\342\225\227", ACS_URCORNER | A_BOLD}, /* ╚ */
{"\342\225\224", ACS_ULCORNER | A_BOLD}, /* ╝ */ {"\342\225\224", ACS_ULCORNER | A_BOLD}, /* ╝ */
{"\342\225\237", ACS_LTEE | A_BOLD}, /* ╟ */ {"\342\225\237", ACS_LTEE | A_BOLD}, /* ╟ */
{"\342\225\242", ACS_RTEE | A_BOLD}, /* ╢ */ {"\342\225\242", ACS_RTEE | A_BOLD}, /* ╢ */
{"\342\225\244", ACS_TTEE | A_BOLD}, /* ╤ */ {"\342\225\244", ACS_TTEE | A_BOLD}, /* ╤ */
{"\342\225\247", ACS_BTEE | A_BOLD}, /* ╧ */ {"\342\225\247", ACS_BTEE | A_BOLD}, /* ╧ */
{"\342\225\220", ACS_HLINE | A_BOLD}, /* ═ */ {"\342\225\220", ACS_HLINE | A_BOLD}, /* ═ */
{"\342\225\221", ACS_VLINE | A_BOLD}, /* ║ */ {"\342\225\221", ACS_VLINE | A_BOLD}, /* ║ */
{NULL, 0} {NULL, 0}
}; };
@ -118,7 +119,8 @@ mc_tty_normalize_lines_char (const char *ch)
if (ch == NULL) if (ch == NULL)
return (int) ' '; return (int) ' ';
for (res = 0; lines_codes[res].line; res++) { for (res = 0; lines_codes[res].line; res++)
{
if (strcmp (ch, lines_codes[res].line) == 0) if (strcmp (ch, lines_codes[res].line) == 0)
return lines_codes[res].line_code; return lines_codes[res].line_code;
} }
@ -158,7 +160,7 @@ tty_init (gboolean slow, gboolean ugly_lines)
#endif /* HAVE_ESCDELAY */ #endif /* HAVE_ESCDELAY */
/* use Ctrl-g to generate SIGINT */ /* use Ctrl-g to generate SIGINT */
cur_term->Nttyb.c_cc[VINTR] = CTRL ('g'); /* ^g */ cur_term->Nttyb.c_cc[VINTR] = CTRL ('g'); /* ^g */
/* disable SIGQUIT to allow use Ctrl-\ key */ /* disable SIGQUIT to allow use Ctrl-\ key */
cur_term->Nttyb.c_cc[VQUIT] = NULL_VALUE; cur_term->Nttyb.c_cc[VQUIT] = NULL_VALUE;
tcsetattr (cur_term->Filedes, TCSANOW, &cur_term->Nttyb); tcsetattr (cur_term->Filedes, TCSANOW, &cur_term->Nttyb);
@ -193,14 +195,14 @@ tty_reset_shell_mode (void)
void void
tty_raw_mode (void) tty_raw_mode (void)
{ {
raw (); /* FIXME: uneeded? */ raw (); /* FIXME: uneeded? */
cbreak (); cbreak ();
} }
void void
tty_noraw_mode (void) tty_noraw_mode (void)
{ {
nocbreak (); /* FIXME: unneeded? */ nocbreak (); /* FIXME: unneeded? */
noraw (); noraw ();
} }
@ -269,7 +271,7 @@ void
tty_draw_hline (int y, int x, int ch, int len) tty_draw_hline (int y, int x, int ch, int len)
{ {
if ((chtype) ch == ACS_HLINE) if ((chtype) ch == ACS_HLINE)
ch = mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz]; ch = mc_tty_frm[MC_TTY_FRM_HORIZ];
if ((y >= 0) && (x >= 0)) if ((y >= 0) && (x >= 0))
move (y, x); move (y, x);
@ -281,7 +283,7 @@ void
tty_draw_vline (int y, int x, int ch, int len) tty_draw_vline (int y, int x, int ch, int len)
{ {
if ((chtype) ch == ACS_VLINE) if ((chtype) ch == ACS_VLINE)
ch = mc_tty_ugly_frm[MC_TTY_FRM_thinvert]; ch = mc_tty_frm[MC_TTY_FRM_VERT];
if ((y >= 0) && (x >= 0)) if ((y >= 0) && (x >= 0))
move (y, x); move (y, x);
@ -293,7 +295,8 @@ tty_fill_region (int y, int x, int rows, int cols, unsigned char ch)
{ {
int i; int i;
for (i = 0; i < rows; i++) { for (i = 0; i < rows; i++)
{
move (y + i, x); move (y + i, x);
hline (ch, cols); hline (ch, cols);
} }
@ -324,42 +327,44 @@ tty_print_anychar (int c)
{ {
unsigned char str[6 + 1]; unsigned char str[6 + 1];
if (utf8_display || c > 255) { if (utf8_display || c > 255)
{
int res = g_unichar_to_utf8 (c, (char *) str); int res = g_unichar_to_utf8 (c, (char *) str);
if (res == 0) { if (res == 0)
{
str[0] = '.'; str[0] = '.';
str[1] = '\0'; str[1] = '\0';
} else {
str[res] = '\0';
} }
else
str[res] = '\0';
addstr (str_term_form ((char *) str)); addstr (str_term_form ((char *) str));
} else {
addch (c);
} }
else
addch (c);
} }
void void
tty_print_alt_char (int c) tty_print_alt_char (int c, gboolean single)
{ {
if ((chtype) c == ACS_VLINE) if ((chtype) c == ACS_VLINE)
c = mc_tty_ugly_frm[MC_TTY_FRM_thinvert]; c = mc_tty_frm[single ? MC_TTY_FRM_VERT : MC_TTY_FRM_DVERT];
else if ((chtype) c == ACS_HLINE) else if ((chtype) c == ACS_HLINE)
c = mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz]; c = mc_tty_frm[single ? MC_TTY_FRM_HORIZ : MC_TTY_FRM_DHORIZ];
else if ((chtype) c == ACS_LTEE) else if ((chtype) c == ACS_LTEE)
c = mc_tty_ugly_frm[MC_TTY_FRM_leftmiddle]; c = mc_tty_frm[single ? MC_TTY_FRM_LEFTMIDDLE : MC_TTY_FRM_DLEFTMIDDLE];
else if ((chtype) c == ACS_RTEE) else if ((chtype) c == ACS_RTEE)
c = mc_tty_ugly_frm[MC_TTY_FRM_rightmiddle]; c = mc_tty_frm[single ? MC_TTY_FRM_RIGHTMIDDLE : MC_TTY_FRM_DRIGHTMIDDLE];
else if ((chtype) c == ACS_ULCORNER) else if ((chtype) c == ACS_ULCORNER)
c = mc_tty_ugly_frm[MC_TTY_FRM_lefttop]; c = mc_tty_frm[single ? MC_TTY_FRM_LEFTTOP : MC_TTY_FRM_DLEFTTOP];
else if ((chtype) c == ACS_LLCORNER) else if ((chtype) c == ACS_LLCORNER)
c = mc_tty_ugly_frm[MC_TTY_FRM_leftbottom]; c = mc_tty_frm[single ? MC_TTY_FRM_LEFTBOTTOM : MC_TTY_FRM_DLEFTBOTTOM];
else if ((chtype) c == ACS_URCORNER) else if ((chtype) c == ACS_URCORNER)
c = mc_tty_ugly_frm[MC_TTY_FRM_righttop]; c = mc_tty_frm[single ? MC_TTY_FRM_RIGHTTOP : MC_TTY_FRM_DRIGHTTOP];
else if ((chtype) c == ACS_LRCORNER) else if ((chtype) c == ACS_LRCORNER)
c = mc_tty_ugly_frm[MC_TTY_FRM_rightbottom]; c = mc_tty_frm[single ? MC_TTY_FRM_RIGHTBOTTOM : MC_TTY_FRM_DRIGHTBOTTOM];
else if ((chtype) c == ACS_PLUS) else if ((chtype) c == ACS_PLUS)
c = mc_tty_ugly_frm[MC_TTY_FRM_centermiddle]; c = mc_tty_frm[MC_TTY_FRM_CROSS];
addch (c); addch (c);
} }

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

@ -40,14 +40,14 @@
#include <signal.h> #include <signal.h>
#include "lib/global.h" #include "lib/global.h"
#include "lib/strutil.h" /* str_term_form */ #include "lib/strutil.h" /* str_term_form */
#include "tty-internal.h" /* slow_tty */ #include "tty-internal.h" /* slow_tty */
#include "tty.h" #include "tty.h"
#include "color-slang.h" #include "color-slang.h"
#include "color-internal.h" #include "color-internal.h"
#include "mouse.h" /* Gpm_Event is required in key.h */ #include "mouse.h" /* Gpm_Event is required in key.h */
#include "key.h" /* define_sequence */ #include "key.h" /* define_sequence */
#include "win.h" #include "win.h"
@ -83,44 +83,47 @@ static gboolean no_slang_delay;
/* This table describes which capabilities we want and which values we /* This table describes which capabilities we want and which values we
* assign to them. * assign to them.
*/ */
static const struct { static const struct
{
int key_code; int key_code;
const char *key_name; const char *key_name;
} key_table[] = { } key_table[] =
{ {
KEY_F (0), "k0"}, { /* *INDENT-OFF* */
KEY_F (1), "k1"}, { { KEY_F (0), "k0" },
KEY_F (2), "k2"}, { { KEY_F (1), "k1" },
KEY_F (3), "k3"}, { { KEY_F (2), "k2" },
KEY_F (4), "k4"}, { { KEY_F (3), "k3" },
KEY_F (5), "k5"}, { { KEY_F (4), "k4" },
KEY_F (6), "k6"}, { { KEY_F (5), "k5" },
KEY_F (7), "k7"}, { { KEY_F (6), "k6" },
KEY_F (8), "k8"}, { { KEY_F (7), "k7" },
KEY_F (9), "k9"}, { { KEY_F (8), "k8" },
KEY_F (10), "k;"}, { { KEY_F (9), "k9" },
KEY_F (11), "F1"}, { { KEY_F (10), "k;" },
KEY_F (12), "F2"}, { { KEY_F (11), "F1" },
KEY_F (13), "F3"}, { { KEY_F (12), "F2" },
KEY_F (14), "F4"}, { { KEY_F (13), "F3" },
KEY_F (15), "F5"}, { { KEY_F (14), "F4" },
KEY_F (16), "F6"}, { { KEY_F (15), "F5" },
KEY_F (17), "F7"}, { { KEY_F (16), "F6" },
KEY_F (18), "F8"}, { { KEY_F (17), "F7" },
KEY_F (19), "F9"}, { { KEY_F (18), "F8" },
KEY_F (20), "FA"}, { { KEY_F (19), "F9" },
KEY_IC, "kI"}, { { KEY_F (20), "FA" },
KEY_NPAGE, "kN"}, { { KEY_IC, "kI" },
KEY_PPAGE, "kP"}, { { KEY_NPAGE, "kN" },
KEY_LEFT, "kl"}, { { KEY_PPAGE, "kP" },
KEY_RIGHT, "kr"}, { { KEY_LEFT, "kl" },
KEY_UP, "ku"}, { { KEY_RIGHT, "kr" },
KEY_DOWN, "kd"}, { { KEY_UP, "ku" },
KEY_DC, "kD"}, { { KEY_DOWN, "kd" },
KEY_BACKSPACE, "kb"}, { { KEY_DC, "kD" },
KEY_HOME, "kh"}, { { KEY_BACKSPACE, "kb" },
KEY_END, "@7"}, { { KEY_HOME, "kh" },
0, NULL} { KEY_END, "@7" },
{ 0, NULL }
/* *INDENT-ON* */
}; };
/*** file scope functions **********************************************/ /*** file scope functions **********************************************/
@ -148,10 +151,12 @@ slang_reset_softkeys (void)
static const char display[] = " "; static const char display[] = " ";
char tmp[BUF_SMALL]; char tmp[BUF_SMALL];
for (key = 1; key < 9; key++) { for (key = 1; key < 9; key++)
{
g_snprintf (tmp, sizeof (tmp), "k%d", key); g_snprintf (tmp, sizeof (tmp), "k%d", key);
send = (char *) SLtt_tgetstr (tmp); send = (char *) SLtt_tgetstr (tmp);
if (send != NULL) { if (send != NULL)
{
g_snprintf (tmp, sizeof (tmp), "\033&f%dk%dd%dL%s%s", key, g_snprintf (tmp, sizeof (tmp), "\033&f%dk%dd%dL%s%s", key,
(int) (sizeof (display) - 1), (int) strlen (send), display, send); (int) (sizeof (display) - 1), (int) strlen (send), display, send);
SLtt_write_string (tmp); SLtt_write_string (tmp);
@ -188,7 +193,8 @@ mc_tty_normalize_lines_char (const char *str)
char *str2; char *str2;
int res; int res;
struct mc_tty_lines_struct { struct mc_tty_lines_struct
{
const char *line; const char *line;
int line_code; int line_code;
} const lines_codes[] = { } const lines_codes[] = {
@ -210,7 +216,8 @@ mc_tty_normalize_lines_char (const char *str)
if (!str) if (!str)
return (int) ' '; return (int) ' ';
for (res = 0; lines_codes[res].line; res++) { for (res = 0; lines_codes[res].line; res++)
{
if (strcmp (str, lines_codes[res].line) == 0) if (strcmp (str, lines_codes[res].line) == 0)
return lines_codes[res].line_code; return lines_codes[res].line_code;
} }
@ -242,7 +249,8 @@ tty_init (gboolean slow, gboolean ugly_lines)
* small, large and negative screen dimensions. * small, large and negative screen dimensions.
*/ */
if ((COLS < 10) || (LINES < 5) if ((COLS < 10) || (LINES < 5)
|| (COLS > SLTT_MAX_SCREEN_COLS) || (LINES > SLTT_MAX_SCREEN_ROWS)) { || (COLS > SLTT_MAX_SCREEN_COLS) || (LINES > SLTT_MAX_SCREEN_ROWS))
{
fprintf (stderr, fprintf (stderr,
_("Screen size %dx%d is not supported.\n" _("Screen size %dx%d is not supported.\n"
"Check the TERM environment variable.\n"), COLS, LINES); "Check the TERM environment variable.\n"), COLS, LINES);
@ -263,7 +271,8 @@ tty_init (gboolean slow, gboolean ugly_lines)
if (SLang_TT_Read_FD == fileno (stderr)) if (SLang_TT_Read_FD == fileno (stderr))
SLang_TT_Read_FD = fileno (stdin); SLang_TT_Read_FD = fileno (stdin);
if (tcgetattr (SLang_TT_Read_FD, &new_mode) == 0) { if (tcgetattr (SLang_TT_Read_FD, &new_mode) == 0)
{
#ifdef VDSUSP #ifdef VDSUSP
new_mode.c_cc[VDSUSP] = NULL_VALUE; /* to ignore ^Y */ new_mode.c_cc[VDSUSP] = NULL_VALUE; /* to ignore ^Y */
#endif #endif
@ -302,7 +311,8 @@ tty_shutdown (void)
* active when the program was started up * active when the program was started up
*/ */
op_cap = SLtt_tgetstr ((char *) "op"); op_cap = SLtt_tgetstr ((char *) "op");
if (op_cap != NULL) { if (op_cap != NULL)
{
fputs (op_cap, stdout); fputs (op_cap, stdout);
fflush (stdout); fflush (stdout);
} }
@ -379,7 +389,8 @@ tty_lowlevel_getch (void)
return -1; return -1;
c = SLang_getkey (); c = SLang_getkey ();
if (c == SLANG_GETKEY_ERROR) { if (c == SLANG_GETKEY_ERROR)
{
fprintf (stderr, fprintf (stderr,
"SLang_getkey returned SLANG_GETKEY_ERROR\n" "SLang_getkey returned SLANG_GETKEY_ERROR\n"
"Assuming EOF on stdin and exiting\n"); "Assuming EOF on stdin and exiting\n");
@ -420,12 +431,14 @@ void
tty_draw_hline (int y, int x, int ch, int len) tty_draw_hline (int y, int x, int ch, int len)
{ {
if (ch == ACS_HLINE) if (ch == ACS_HLINE)
ch = mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz]; ch = mc_tty_frm[MC_TTY_FRM_HORIZ];
if ((y < 0) || (x < 0)) { if ((y < 0) || (x < 0))
{
y = SLsmg_get_row (); y = SLsmg_get_row ();
x = SLsmg_get_column (); x = SLsmg_get_column ();
} else }
else
SLsmg_gotorc (y, x); SLsmg_gotorc (y, x);
if (ch == 0) if (ch == 0)
@ -445,12 +458,14 @@ void
tty_draw_vline (int y, int x, int ch, int len) tty_draw_vline (int y, int x, int ch, int len)
{ {
if (ch == ACS_VLINE) if (ch == ACS_VLINE)
ch = mc_tty_ugly_frm[MC_TTY_FRM_thinvert]; ch = mc_tty_frm[MC_TTY_FRM_VERT];
if ((y < 0) || (x < 0)) { if ((y < 0) || (x < 0))
{
y = SLsmg_get_row (); y = SLsmg_get_row ();
x = SLsmg_get_column (); x = SLsmg_get_column ();
} else }
else
SLsmg_gotorc (y, x); SLsmg_gotorc (y, x);
if (ch == 0) if (ch == 0)
@ -458,10 +473,12 @@ tty_draw_vline (int y, int x, int ch, int len)
if (ch == ACS_VLINE) if (ch == ACS_VLINE)
SLsmg_draw_vline (len); SLsmg_draw_vline (len);
else { else
{
int pos = 0; int pos = 0;
while (len-- != 0) { while (len-- != 0)
{
SLsmg_gotorc (y + pos, x); SLsmg_gotorc (y + pos, x);
tty_print_char (ch); tty_print_char (ch);
pos++; pos++;
@ -496,38 +513,39 @@ tty_print_char (int c)
} }
void void
tty_print_alt_char (int c) tty_print_alt_char (int c, gboolean single)
{ {
#define DRAW(x, y) (x == y) \ #define DRAW(x, y) (x == y) \
? SLsmg_draw_object (SLsmg_get_row(), SLsmg_get_column(), x) \ ? SLsmg_draw_object (SLsmg_get_row(), SLsmg_get_column(), x) \
: SLsmg_write_char ((unsigned int) y) : SLsmg_write_char ((unsigned int) y)
switch (c) { switch (c)
{
case ACS_VLINE: case ACS_VLINE:
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_thinvert]); DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_VERT : MC_TTY_FRM_DVERT]);
break; break;
case ACS_HLINE: case ACS_HLINE:
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz]); DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_HORIZ : MC_TTY_FRM_DHORIZ]);
break; break;
case ACS_LTEE: case ACS_LTEE:
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_leftmiddle]); DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_LEFTMIDDLE : MC_TTY_FRM_DLEFTMIDDLE]);
break; break;
case ACS_RTEE: case ACS_RTEE:
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_rightmiddle]); DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_RIGHTMIDDLE : MC_TTY_FRM_DRIGHTMIDDLE]);
break; break;
case ACS_ULCORNER: case ACS_ULCORNER:
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_lefttop]); DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_LEFTTOP : MC_TTY_FRM_DLEFTTOP]);
break; break;
case ACS_LLCORNER: case ACS_LLCORNER:
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_leftbottom]); DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_LEFTBOTTOM : MC_TTY_FRM_DLEFTBOTTOM]);
break; break;
case ACS_URCORNER: case ACS_URCORNER:
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_righttop]); DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_RIGHTTOP : MC_TTY_FRM_DRIGHTTOP]);
break; break;
case ACS_LRCORNER: case ACS_LRCORNER:
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_rightbottom]); DRAW (c, mc_tty_frm[single ? MC_TTY_FRM_RIGHTBOTTOM : MC_TTY_FRM_DRIGHTBOTTOM]);
break; break;
case ACS_PLUS: case ACS_PLUS:
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_centermiddle]); DRAW (c, mc_tty_frm[MC_TTY_FRM_CROSS]);
break; break;
default: default:
SLsmg_write_char ((unsigned int) c); SLsmg_write_char ((unsigned int) c);
@ -540,16 +558,22 @@ tty_print_anychar (int c)
{ {
char str[6 + 1]; char str[6 + 1];
if (c > 255) { if (c > 255)
{
int res = g_unichar_to_utf8 (c, str); int res = g_unichar_to_utf8 (c, str);
if (res == 0) { if (res == 0)
{
str[0] = '.'; str[0] = '.';
str[1] = '\0'; str[1] = '\0';
} else { }
else
{
str[res] = '\0'; str[res] = '\0';
} }
SLsmg_write_string ((char *) str_term_form (str)); SLsmg_write_string ((char *) str_term_form (str));
} else { }
else
{
SLsmg_write_char ((SLwchar_Type) ((unsigned int) c)); SLsmg_write_char ((SLwchar_Type) ((unsigned int) c));
} }
} }

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

@ -54,7 +54,7 @@ gboolean slow_tty = FALSE;
/* If true use +, -, | for line drawing */ /* If true use +, -, | for line drawing */
gboolean ugly_line_drawing = FALSE; gboolean ugly_line_drawing = FALSE;
int mc_tty_ugly_frm[MC_TTY_FRM_MAX]; int mc_tty_frm[MC_TTY_FRM_MAX];
/*** file scope macro definitions **************************************/ /*** file scope macro definitions **************************************/
@ -126,32 +126,32 @@ tty_got_interrupt (void)
} }
void void
tty_print_one_hline (void) tty_print_one_hline (gboolean single)
{ {
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz]); tty_print_alt_char (ACS_HLINE, single);
} }
void void
tty_print_one_vline (void) tty_print_one_vline (gboolean single)
{ {
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_thinvert]); tty_print_alt_char (ACS_VLINE, single);
} }
void void
tty_draw_box (int y, int x, int ys, int xs) tty_draw_box (int y, int x, int ys, int xs, gboolean single)
{ {
tty_draw_vline (y, x, mc_tty_ugly_frm[MC_TTY_FRM_vert], ys); tty_draw_vline (y, x, mc_tty_frm[single ? MC_TTY_FRM_VERT : MC_TTY_FRM_DVERT], ys);
tty_draw_vline (y, x + xs - 1, mc_tty_ugly_frm[MC_TTY_FRM_vert], ys); tty_draw_vline (y, x + xs - 1, mc_tty_frm[single ? MC_TTY_FRM_VERT : MC_TTY_FRM_DVERT], ys);
tty_draw_hline (y, x, mc_tty_ugly_frm[MC_TTY_FRM_horiz], xs); tty_draw_hline (y, x, mc_tty_frm[single ? MC_TTY_FRM_HORIZ : MC_TTY_FRM_DHORIZ], xs);
tty_draw_hline (y + ys - 1, x, mc_tty_ugly_frm[MC_TTY_FRM_horiz], xs); tty_draw_hline (y + ys - 1, x, mc_tty_frm[single ? MC_TTY_FRM_HORIZ : MC_TTY_FRM_DHORIZ], xs);
tty_gotoyx (y, x); tty_gotoyx (y, x);
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_lefttop]); tty_print_alt_char (ACS_ULCORNER, single);
tty_gotoyx (y + ys - 1, x); tty_gotoyx (y + ys - 1, x);
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_leftbottom]); tty_print_alt_char (ACS_LLCORNER, single);
tty_gotoyx (y, x + xs - 1); tty_gotoyx (y, x + xs - 1);
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_righttop]); tty_print_alt_char (ACS_URCORNER, single);
tty_gotoyx (y + ys - 1, x + xs - 1); tty_gotoyx (y + ys - 1, x + xs - 1);
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_rightbottom]); tty_print_alt_char (ACS_LRCORNER, single);
} }
char * char *
@ -170,7 +170,8 @@ mc_tty_normalize_from_utf8 (const char *str)
buffer = g_string_new (""); buffer = g_string_new ("");
if (str_convert (conv, str, buffer) == ESTR_FAILURE) { if (str_convert (conv, str, buffer) == ESTR_FAILURE)
{
g_string_free (buffer, TRUE); g_string_free (buffer, TRUE);
str_close_conv (conv); str_close_conv (conv);
return g_strdup (str); return g_strdup (str);

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

@ -11,7 +11,7 @@
#ifndef MC_TTY_H #ifndef MC_TTY_H
#define MC_TTY_H #define MC_TTY_H
#include "lib/global.h" /* include <glib.h> */ #include "lib/global.h" /* include <glib.h> */
#ifdef HAVE_SLANG #ifdef HAVE_SLANG
# include "tty-slang.h" # include "tty-slang.h"
@ -51,9 +51,9 @@ extern int tty_lowlevel_getch (void);
/* {{{ Output }}} */ /* {{{ Output }}} */
/* /*
The output functions do not check themselves for screen overflows, The output functions do not check themselves for screen overflows,
so make sure that you never write more than what fits on the screen. so make sure that you never write more than what fits on the screen.
While SLang provides such a feature, ncurses does not. While SLang provides such a feature, ncurses does not.
*/ */
extern int tty_reset_screen (void); extern int tty_reset_screen (void);
@ -66,34 +66,47 @@ extern void tty_set_alt_charset (gboolean alt_charset);
extern void tty_display_8bit (gboolean what); extern void tty_display_8bit (gboolean what);
extern void tty_print_char (int c); extern void tty_print_char (int c);
extern void tty_print_alt_char (int c); extern void tty_print_alt_char (int c, gboolean single);
extern void tty_print_anychar (int c); extern void tty_print_anychar (int c);
extern void tty_print_string (const char *s); extern void tty_print_string (const char *s);
extern void tty_printf (const char *s, ...); extern void tty_printf (const char *s, ...);
extern void tty_print_one_vline (void); extern void tty_print_one_vline (gboolean single);
extern void tty_print_one_hline (void); extern void tty_print_one_hline (gboolean single);
extern void tty_draw_hline (int y, int x, int ch, int len); extern void tty_draw_hline (int y, int x, int ch, int len);
extern void tty_draw_vline (int y, int x, int ch, int len); extern void tty_draw_vline (int y, int x, int ch, int len);
extern void tty_draw_box (int y, int x, int rows, int cols); extern void tty_draw_box (int y, int x, int rows, int cols, gboolean single);
extern void tty_fill_region (int y, int x, int rows, int cols, unsigned char ch); extern void tty_fill_region (int y, int x, int rows, int cols, unsigned char ch);
extern int mc_tty_ugly_frm[]; extern int mc_tty_frm[];
typedef enum
{
/* single lines */
MC_TTY_FRM_VERT,
MC_TTY_FRM_HORIZ,
MC_TTY_FRM_LEFTTOP,
MC_TTY_FRM_RIGHTTOP,
MC_TTY_FRM_LEFTBOTTOM,
MC_TTY_FRM_RIGHTBOTTOM,
MC_TTY_FRM_TOPMIDDLE,
MC_TTY_FRM_BOTTOMMIDDLE,
MC_TTY_FRM_LEFTMIDDLE,
MC_TTY_FRM_RIGHTMIDDLE,
MC_TTY_FRM_CROSS,
/* double lines */
MC_TTY_FRM_DVERT,
MC_TTY_FRM_DHORIZ,
MC_TTY_FRM_DLEFTTOP,
MC_TTY_FRM_DRIGHTTOP,
MC_TTY_FRM_DLEFTBOTTOM,
MC_TTY_FRM_DRIGHTBOTTOM,
MC_TTY_FRM_DTOPMIDDLE,
MC_TTY_FRM_DBOTTOMMIDDLE,
MC_TTY_FRM_DLEFTMIDDLE,
MC_TTY_FRM_DRIGHTMIDDLE,
typedef enum {
MC_TTY_FRM_thinvert,
MC_TTY_FRM_thinhoriz,
MC_TTY_FRM_vert,
MC_TTY_FRM_horiz,
MC_TTY_FRM_lefttop,
MC_TTY_FRM_righttop,
MC_TTY_FRM_leftbottom,
MC_TTY_FRM_rightbottom,
MC_TTY_FRM_centertop,
MC_TTY_FRM_centerbottom,
MC_TTY_FRM_leftmiddle,
MC_TTY_FRM_rightmiddle,
MC_TTY_FRM_centermiddle,
MC_TTY_FRM_MAX MC_TTY_FRM_MAX
} mc_tty_frm_t; } mc_tty_frm_t;

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

@ -2,19 +2,27 @@
description=Dark Far skin description=Dark Far skin
[Lines] [Lines]
lefttop= horiz=
righttop= vert=
centertop= lefttop=
centerbottom= righttop=
leftbottom= leftbottom=
rightbottom= rightbottom=
leftmiddle= topmiddle=
rightmiddle= bottommiddle=
centermiddle= leftmiddle=
horiz= rightmiddle=
vert= cross=
thinhoriz= dhoriz=
thinvert= dvert=
dlefttop=
drighttop=
dleftbottom=
drightbottom=
dtopmiddle=
dbottommiddle=
dleftmiddle=
drightmiddle=
[core] [core]
_default_=lightgray;black _default_=lightgray;black

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

@ -2,19 +2,27 @@
description=Standart skin description=Standart skin
[Lines] [Lines]
lefttop=
righttop=
centertop=
centerbottom=
leftbottom=
rightbottom=
leftmiddle=
rightmiddle=
centermiddle=
horiz= horiz=
vert= vert=
thinhoriz= lefttop=
thinvert= righttop=
leftbottom=
rightbottom=
topmiddle=
bottommiddle=
leftmiddle=
rightmiddle=
cross=
dhoriz=
dvert=
dlefttop=
drighttop=
dleftbottom=
drightbottom=
dtopmiddle=
dbottommiddle=
dleftmiddle=
drightmiddle=
[core] [core]
_default_=lightgray;blue _default_=lightgray;blue
@ -36,7 +44,6 @@
errdhotnormal=yellow;red errdhotnormal=yellow;red
errdhotfocus=yellow;lightgray errdhotfocus=yellow;lightgray
[filehighlight] [filehighlight]
directory=white; directory=white;
executable=brightgreen; executable=brightgreen;

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

@ -2,19 +2,27 @@
description=Far-like skin description=Far-like skin
[Lines] [Lines]
lefttop= horiz=
righttop= vert=
centertop= lefttop=
centerbottom= righttop=
leftbottom= leftbottom=
rightbottom= rightbottom=
leftmiddle= topmiddle=
rightmiddle= bottommiddle=
centermiddle= leftmiddle=
horiz= rightmiddle=
vert= cross=
thinhoriz= dhoriz=
thinvert= dvert=
dlefttop=
drighttop=
dleftbottom=
drightbottom=
dtopmiddle=
dbottommiddle=
dleftmiddle=
drightmiddle=
[core] [core]
_default_=lightgray;blue _default_=lightgray;blue
@ -36,7 +44,6 @@
errdhotnormal=yellow;red errdhotnormal=yellow;red
errdhotfocus=yellow;lightgray errdhotfocus=yellow;lightgray
[filehighlight] [filehighlight]
directory=white; directory=white;
executable=brightgreen; executable=brightgreen;

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

@ -4,19 +4,27 @@
description=Enhanced standart skin description=Enhanced standart skin
[Lines] [Lines]
lefttop= horiz=
righttop= vert=
centertop= lefttop=
centerbottom= righttop=
leftbottom= leftbottom=
rightbottom= rightbottom=
leftmiddle= topmiddle=
rightmiddle= bottommiddle=
centermiddle= leftmiddle=
horiz= rightmiddle=
vert= cross=
thinhoriz= dhoriz=
thinvert= dvert=
dlefttop=
drighttop=
dleftbottom=
drightbottom=
dtopmiddle=
dbottommiddle=
dleftmiddle=
drightmiddle=
[core] [core]
_default_=lightgray;blue _default_=lightgray;blue
@ -38,7 +46,6 @@
errdhotnormal=yellow;red errdhotnormal=yellow;red
errdhotfocus=yellow;lightgray errdhotfocus=yellow;lightgray
[filehighlight] [filehighlight]
directory=white; directory=white;
executable=brightgreen; executable=brightgreen;
@ -96,4 +103,14 @@
history-prev-item-sign = « history-prev-item-sign = «
history-next-item-sign = » history-next-item-sign = »
history-show-list-sign = ^ history-show-list-sign = ^
horiz=
vert=
lefttop=
righttop=
leftbottom=
rightbottom=
topmiddle=
bottommiddle=
leftmiddle=
rightmiddle=
cross=

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

@ -2,19 +2,27 @@
description=GoTaR @PLD Linux description=GoTaR @PLD Linux
[Lines] [Lines]
lefttop=
righttop=
centertop=
centerbottom=
leftbottom=
rightbottom=
leftmiddle=
rightmiddle=
centermiddle=
horiz= horiz=
vert= vert=
thinhoriz= lefttop=
thinvert= righttop=
leftbottom=
rightbottom=
topmiddle=
bottommiddle=
leftmiddle=
rightmiddle=
cross=
dhoriz=
dvert=
dlefttop=
drighttop=
dleftbottom=
drightbottom=
dtopmiddle=
dbottommiddle=
dleftmiddle=
drightmiddle=
[core] [core]
_default_=lightgray;black _default_=lightgray;black

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

@ -2,19 +2,27 @@
description=Nice and Dark description=Nice and Dark
[Lines] [Lines]
lefttop=
righttop=
centertop=
centerbottom=
leftbottom=
rightbottom=
leftmiddle=
rightmiddle=
centermiddle=
horiz= horiz=
vert= vert=
thinhoriz= lefttop=
thinvert= righttop=
leftbottom=
rightbottom=
topmiddle=
bottommiddle=
leftmiddle=
rightmiddle=
cross=
dhoriz=
dvert=
dlefttop=
drighttop=
dleftbottom=
drightbottom=
dtopmiddle=
dbottommiddle=
dleftmiddle=
drightmiddle=
[core] [core]
_default_=lightgray;black _default_=lightgray;black
@ -36,7 +44,6 @@
errdhotnormal=yellow;red errdhotnormal=yellow;red
errdhotfocus=yellow;lightgray errdhotfocus=yellow;lightgray
[filehighlight] [filehighlight]
directory=blue; directory=blue;
executable=brightgreen; executable=brightgreen;
@ -92,4 +99,3 @@
history-prev-item-sign = « history-prev-item-sign = «
history-next-item-sign = » history-next-item-sign = »
history-show-list-sign = ^ history-show-list-sign = ^

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

@ -38,35 +38,35 @@
#include "lib/vfs/mc-vfs/vfs.h" #include "lib/vfs/mc-vfs/vfs.h"
#include "lib/strutil.h" #include "lib/strutil.h"
#include "dialog.h" /* add_widget() */ #include "dialog.h" /* add_widget() */
#include "widget.h" /* NORMAL_BUTTON */ #include "widget.h" /* NORMAL_BUTTON */
#include "wtools.h" /* message() */ #include "wtools.h" /* message() */
#include "panel.h" /* do_file_mark() */ #include "panel.h" /* do_file_mark() */
#include "main.h" /* update_panels() */ #include "main.h" /* update_panels() */
#include "layout.h" /* repaint_screen() */ #include "layout.h" /* repaint_screen() */
#include "chmod.h" #include "chmod.h"
static int single_set; static int single_set;
#define PX 5 #define PX 5
#define PY 2 #define PY 2
#define FX 40 #define FX 40
#define FY 2 #define FY 2
#define BX 6 #define BX 6
#define BY 17 #define BY 17
#define TX 40 #define TX 40
#define TY 12 #define TY 12
#define PERMISSIONS 12 #define PERMISSIONS 12
#define BUTTONS 6 #define BUTTONS 6
#define B_MARKED B_USER #define B_MARKED B_USER
#define B_ALL (B_USER+1) #define B_ALL (B_USER+1)
#define B_SETMRK (B_USER+2) #define B_SETMRK (B_USER+2)
#define B_CLRMRK (B_USER+3) #define B_CLRMRK (B_USER+3)
static int mode_change, need_update; static int mode_change, need_update;
static int c_file, end_chmod; static int c_file, end_chmod;
@ -81,41 +81,48 @@ static const char *c_fname, *c_fown, *c_fgrp;
static WLabel *statl; static WLabel *statl;
static struct { static struct
{
mode_t mode; mode_t mode;
const char *text; const char *text;
int selected; int selected;
WCheck *check; WCheck *check;
} check_perm[PERMISSIONS] = } check_perm[PERMISSIONS] =
{ {
{ S_IXOTH, N_("execute/search by others"), 0, 0, }, /* *INDENT-OFF* */
{ S_IWOTH, N_("write by others"), 0, 0, }, { S_IXOTH, N_("execute/search by others"), 0, 0 },
{ S_IROTH, N_("read by others"), 0, 0, }, { S_IWOTH, N_("write by others"), 0, 0 },
{ S_IXGRP, N_("execute/search by group"), 0, 0, }, { S_IROTH, N_("read by others"), 0, 0 },
{ S_IWGRP, N_("write by group"), 0, 0, }, { S_IXGRP, N_("execute/search by group"), 0, 0 },
{ S_IRGRP, N_("read by group"), 0, 0, }, { S_IWGRP, N_("write by group"), 0, 0 },
{ S_IXUSR, N_("execute/search by owner"), 0, 0, }, { S_IRGRP, N_("read by group"), 0, 0 },
{ S_IWUSR, N_("write by owner"), 0, 0, }, { S_IXUSR, N_("execute/search by owner"), 0, 0 },
{ S_IRUSR, N_("read by owner"), 0, 0, }, { S_IWUSR, N_("write by owner"), 0, 0 },
{ S_ISVTX, N_("sticky bit"), 0, 0, }, { S_IRUSR, N_("read by owner"), 0, 0 },
{ S_ISGID, N_("set group ID on execution"), 0, 0, }, { S_ISVTX, N_("sticky bit"), 0, 0 },
{ S_ISUID, N_("set user ID on execution"), 0, 0, }, { S_ISGID, N_("set group ID on execution"), 0, 0 },
{ S_ISUID, N_("set user ID on execution"), 0, 0 }
/* *INDENT-ON* */
}; };
static struct { static struct
{
int ret_cmd, flags, y, x; int ret_cmd, flags, y, x;
const char *text; const char *text;
} chmod_but[BUTTONS] = } chmod_but[BUTTONS] =
{ {
{ B_CANCEL, NORMAL_BUTTON, 2, 33, N_("&Cancel") }, /* *INDENT-OFF* */
{ B_ENTER, DEFPUSH_BUTTON, 2, 17, N_("&Set") }, { B_CANCEL, NORMAL_BUTTON, 2, 33, N_("&Cancel") },
{ B_CLRMRK, NORMAL_BUTTON, 0, 42, N_("C&lear marked") }, { B_ENTER, DEFPUSH_BUTTON, 2, 17, N_("&Set") },
{ B_SETMRK, NORMAL_BUTTON, 0, 27, N_("S&et marked") }, { B_CLRMRK, NORMAL_BUTTON, 0, 42, N_("C&lear marked") },
{ B_MARKED, NORMAL_BUTTON, 0, 12, N_("&Marked all") }, { B_SETMRK, NORMAL_BUTTON, 0, 27, N_("S&et marked") },
{ B_ALL, NORMAL_BUTTON, 0, 0, N_("Set &all") }, { B_MARKED, NORMAL_BUTTON, 0, 12, N_("&Marked all") },
{ B_ALL, NORMAL_BUTTON, 0, 0, N_("Set &all") }
/* *INDENT-ON* */
}; };
static void chmod_toggle_select (Dlg_head *h, int Id) static void
chmod_toggle_select (Dlg_head * h, int Id)
{ {
tty_setcolor (COLOR_NORMAL); tty_setcolor (COLOR_NORMAL);
check_perm[Id].selected ^= 1; check_perm[Id].selected ^= 1;
@ -125,14 +132,15 @@ static void chmod_toggle_select (Dlg_head *h, int Id)
dlg_move (h, PY + PERMISSIONS - Id, PX + 3); dlg_move (h, PY + PERMISSIONS - Id, PX + 3);
} }
static void chmod_refresh (Dlg_head *h) static void
chmod_refresh (Dlg_head * h)
{ {
common_dialog_repaint (h); common_dialog_repaint (h);
tty_setcolor (COLOR_NORMAL); tty_setcolor (COLOR_NORMAL);
draw_box (h, PY, PX, PERMISSIONS + 2, 33); draw_box (h, PY, PX, PERMISSIONS + 2, 33, TRUE);
draw_box (h, FY, FX, 10, 25); draw_box (h, FY, FX, 10, 25, TRUE);
dlg_move (h, FY + 1, FX + 2); dlg_move (h, FY + 1, FX + 2);
tty_print_string (_("Name")); tty_print_string (_("Name"));
@ -161,38 +169,40 @@ static void chmod_refresh (Dlg_head *h)
} }
static cb_ret_t static cb_ret_t
chmod_callback (Dlg_head *h, Widget *sender, chmod_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
dlg_msg_t msg, int parm, void *data)
{ {
char buffer[BUF_TINY]; char buffer[BUF_TINY];
int id = h->current->dlg_id - BUTTONS + single_set * 2; int id = h->current->dlg_id - BUTTONS + single_set * 2;
switch (msg) { switch (msg)
{
case DLG_ACTION: case DLG_ACTION:
if (id >= 0) { if (id >= 0)
c_stat ^= check_perm[id].mode; {
g_snprintf (buffer, sizeof (buffer), "%o", c_stat); c_stat ^= check_perm[id].mode;
label_set_text (statl, buffer); g_snprintf (buffer, sizeof (buffer), "%o", c_stat);
chmod_toggle_select (h, id); label_set_text (statl, buffer);
mode_change = 1; chmod_toggle_select (h, id);
} mode_change = 1;
return MSG_HANDLED; }
return MSG_HANDLED;
case DLG_KEY: case DLG_KEY:
if ((parm == 'T' || parm == 't' || parm == KEY_IC) && id > 0) { if ((parm == 'T' || parm == 't' || parm == KEY_IC) && id > 0)
chmod_toggle_select (h, id); {
if (parm == KEY_IC) chmod_toggle_select (h, id);
dlg_one_down (h); if (parm == KEY_IC)
return MSG_HANDLED; dlg_one_down (h);
} return MSG_HANDLED;
return MSG_NOT_HANDLED; }
return MSG_NOT_HANDLED;
case DLG_DRAW: case DLG_DRAW:
chmod_refresh (h); chmod_refresh (h);
return MSG_HANDLED; return MSG_HANDLED;
default: default:
return default_dlg_callback (h, sender, msg, parm, data); return default_dlg_callback (h, sender, msg, parm, data);
} }
} }
@ -207,178 +217,192 @@ init_chmod (void)
single_set = (current_panel->marked < 2) ? 2 : 0; single_set = (current_panel->marked < 2) ? 2 : 0;
ch_dlg = ch_dlg =
create_dlg (0, 0, 22 - single_set, 70, dialog_colors, create_dlg (0, 0, 22 - single_set, 70, dialog_colors,
chmod_callback, "[Chmod]", _("Chmod command"), chmod_callback, "[Chmod]", _("Chmod command"), DLG_CENTER | DLG_REVERSE);
DLG_CENTER | DLG_REVERSE);
for (i = 0; i < BUTTONS; i++) { for (i = 0; i < BUTTONS; i++)
if (i == 2 && single_set) {
break; if (i == 2 && single_set)
else break;
add_widget (ch_dlg, else
button_new (BY + chmod_but[i].y - single_set, add_widget (ch_dlg,
BX + chmod_but[i].x, button_new (BY + chmod_but[i].y - single_set,
chmod_but[i].ret_cmd, BX + chmod_but[i].x,
chmod_but[i].flags, chmod_but[i].ret_cmd,
_(chmod_but[i].text), 0)); chmod_but[i].flags, _(chmod_but[i].text), 0));
} }
for (i = 0; i < PERMISSIONS; i++) { for (i = 0; i < PERMISSIONS; i++)
check_perm[i].check = {
check_new (PY + (PERMISSIONS - i), PX + 2, 0, check_perm[i].check = check_new (PY + (PERMISSIONS - i), PX + 2, 0, _(check_perm[i].text));
_(check_perm[i].text)); add_widget (ch_dlg, check_perm[i].check);
add_widget (ch_dlg, check_perm[i].check);
} }
return ch_dlg; return ch_dlg;
} }
static void chmod_done (void) static void
chmod_done (void)
{ {
if (need_update) if (need_update)
update_panels (UP_OPTIMIZE, UP_KEEPSEL); update_panels (UP_OPTIMIZE, UP_KEEPSEL);
repaint_screen (); repaint_screen ();
} }
static char *next_file (void) static char *
next_file (void)
{ {
while (!current_panel->dir.list[c_file].f.marked) while (!current_panel->dir.list[c_file].f.marked)
c_file++; c_file++;
return current_panel->dir.list[c_file].fname; return current_panel->dir.list[c_file].fname;
} }
static void do_chmod (struct stat *sf) static void
do_chmod (struct stat *sf)
{ {
sf->st_mode &= and_mask; sf->st_mode &= and_mask;
sf->st_mode |= or_mask; sf->st_mode |= or_mask;
if (mc_chmod (current_panel->dir.list [c_file].fname, sf->st_mode) == -1) if (mc_chmod (current_panel->dir.list[c_file].fname, sf->st_mode) == -1)
message (D_ERROR, MSG_ERROR, _(" Cannot chmod \"%s\" \n %s "), message (D_ERROR, MSG_ERROR, _(" Cannot chmod \"%s\" \n %s "),
current_panel->dir.list [c_file].fname, unix_error_string (errno)); current_panel->dir.list[c_file].fname, unix_error_string (errno));
do_file_mark (current_panel, c_file, 0); do_file_mark (current_panel, c_file, 0);
} }
static void apply_mask (struct stat *sf) static void
apply_mask (struct stat *sf)
{ {
char *fname; char *fname;
need_update = end_chmod = 1; need_update = end_chmod = 1;
do_chmod (sf); do_chmod (sf);
do { do
fname = next_file (); {
if (mc_stat (fname, sf) != 0) fname = next_file ();
return; if (mc_stat (fname, sf) != 0)
c_stat = sf->st_mode; return;
c_stat = sf->st_mode;
do_chmod (sf); do_chmod (sf);
} while (current_panel->marked); }
while (current_panel->marked);
} }
void chmod_cmd (void) void
chmod_cmd (void)
{ {
char buffer [BUF_TINY]; char buffer[BUF_TINY];
char *fname; char *fname;
int i; int i;
struct stat sf_stat; struct stat sf_stat;
Dlg_head *ch_dlg; Dlg_head *ch_dlg;
do { /* do while any files remaining */ do
ch_dlg = init_chmod (); { /* do while any files remaining */
if (current_panel->marked) ch_dlg = init_chmod ();
fname = next_file (); /* next marked file */ if (current_panel->marked)
else fname = next_file (); /* next marked file */
fname = selection (current_panel)->fname; /* single file */ else
fname = selection (current_panel)->fname; /* single file */
if (mc_stat (fname, &sf_stat) != 0) { /* get status of file */ if (mc_stat (fname, &sf_stat) != 0)
destroy_dlg (ch_dlg); { /* get status of file */
break; destroy_dlg (ch_dlg);
} break;
}
c_stat = sf_stat.st_mode; c_stat = sf_stat.st_mode;
mode_change = 0; /* clear changes flag */ mode_change = 0; /* clear changes flag */
/* set check buttons */ /* set check buttons */
for (i = 0; i < PERMISSIONS; i++){ for (i = 0; i < PERMISSIONS; i++)
check_perm[i].check->state = (c_stat & check_perm[i].mode) ? 1 : 0; {
check_perm[i].selected = 0; check_perm[i].check->state = (c_stat & check_perm[i].mode) ? 1 : 0;
} check_perm[i].selected = 0;
}
/* Set the labels */ /* Set the labels */
c_fname = str_trunc (fname, 21); c_fname = str_trunc (fname, 21);
add_widget (ch_dlg, label_new (FY+2, FX+2, c_fname)); add_widget (ch_dlg, label_new (FY + 2, FX + 2, c_fname));
c_fown = str_trunc (get_owner (sf_stat.st_uid), 21); c_fown = str_trunc (get_owner (sf_stat.st_uid), 21);
add_widget (ch_dlg, label_new (FY+6, FX+2, c_fown)); add_widget (ch_dlg, label_new (FY + 6, FX + 2, c_fown));
c_fgrp = str_trunc (get_group (sf_stat.st_gid), 21); c_fgrp = str_trunc (get_group (sf_stat.st_gid), 21);
add_widget (ch_dlg, label_new (FY+8, FX+2, c_fgrp)); add_widget (ch_dlg, label_new (FY + 8, FX + 2, c_fgrp));
g_snprintf (buffer, sizeof (buffer), "%o", c_stat); g_snprintf (buffer, sizeof (buffer), "%o", c_stat);
statl = label_new (FY+4, FX+2, buffer); statl = label_new (FY + 4, FX + 2, buffer);
add_widget (ch_dlg, statl); add_widget (ch_dlg, statl);
run_dlg (ch_dlg); /* retrieve an action */ run_dlg (ch_dlg); /* retrieve an action */
/* do action */ /* do action */
switch (ch_dlg->ret_value){ switch (ch_dlg->ret_value)
case B_ENTER: {
if (mode_change) case B_ENTER:
if (mc_chmod (fname, c_stat) == -1) if (mode_change)
message (D_ERROR, MSG_ERROR, _(" Cannot chmod \"%s\" \n %s "), if (mc_chmod (fname, c_stat) == -1)
fname, unix_error_string (errno)); message (D_ERROR, MSG_ERROR, _(" Cannot chmod \"%s\" \n %s "),
need_update = 1; fname, unix_error_string (errno));
break; need_update = 1;
break;
case B_CANCEL: case B_CANCEL:
end_chmod = 1; end_chmod = 1;
break; break;
case B_ALL: case B_ALL:
case B_MARKED: case B_MARKED:
and_mask = or_mask = 0; and_mask = or_mask = 0;
and_mask = ~and_mask; and_mask = ~and_mask;
for (i = 0; i < PERMISSIONS; i++) { for (i = 0; i < PERMISSIONS; i++)
if (check_perm[i].selected || ch_dlg->ret_value == B_ALL) { {
if (check_perm[i].check->state & C_BOOL) if (check_perm[i].selected || ch_dlg->ret_value == B_ALL)
or_mask |= check_perm[i].mode; {
else if (check_perm[i].check->state & C_BOOL)
and_mask &= ~check_perm[i].mode; or_mask |= check_perm[i].mode;
} else
} and_mask &= ~check_perm[i].mode;
}
}
apply_mask (&sf_stat); apply_mask (&sf_stat);
break; break;
case B_SETMRK: case B_SETMRK:
and_mask = or_mask = 0; and_mask = or_mask = 0;
and_mask = ~and_mask; and_mask = ~and_mask;
for (i = 0; i < PERMISSIONS; i++) { for (i = 0; i < PERMISSIONS; i++)
if (check_perm[i].selected) {
or_mask |= check_perm[i].mode; if (check_perm[i].selected)
} or_mask |= check_perm[i].mode;
}
apply_mask (&sf_stat); apply_mask (&sf_stat);
break; break;
case B_CLRMRK: case B_CLRMRK:
and_mask = or_mask = 0; and_mask = or_mask = 0;
and_mask = ~and_mask; and_mask = ~and_mask;
for (i = 0; i < PERMISSIONS; i++) { for (i = 0; i < PERMISSIONS; i++)
if (check_perm[i].selected) {
and_mask &= ~check_perm[i].mode; if (check_perm[i].selected)
} and_mask &= ~check_perm[i].mode;
}
apply_mask (&sf_stat); apply_mask (&sf_stat);
break; break;
} }
if (current_panel->marked && ch_dlg->ret_value!=B_CANCEL) { if (current_panel->marked && ch_dlg->ret_value != B_CANCEL)
do_file_mark (current_panel, c_file, 0); {
need_update = 1; do_file_mark (current_panel, c_file, 0);
} need_update = 1;
destroy_dlg (ch_dlg); }
} while (current_panel->marked && !end_chmod); destroy_dlg (ch_dlg);
}
while (current_panel->marked && !end_chmod);
chmod_done (); chmod_done ();
} }

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

@ -51,19 +51,19 @@
#include "chown.h" #include "chown.h"
#include "wtools.h" /* For init_box_colors */ #include "wtools.h" /* For init_box_colors */
#define UX 5 #define UX 5
#define UY 2 #define UY 2
#define GX 27 #define GX 27
#define GY 2 #define GY 2
#define BX 5 #define BX 5
#define BY 15 #define BY 15
#define TX 50 #define TX 50
#define TY 2 #define TY 2
#define BUTTONS 5 #define BUTTONS 5
#define B_SETALL B_USER #define B_SETALL B_USER
#define B_SETUSR (B_USER + 1) #define B_SETUSR (B_USER + 1)
@ -91,11 +91,11 @@ static struct {
int y, x; int y, x;
WLabel *l; WLabel *l;
} chown_label [LABELS] = { } chown_label [LABELS] = {
{ TY+2, TX+2, NULL }, { TY + 2, TX + 2, NULL },
{ TY+4, TX+2, NULL }, { TY + 4, TX + 2, NULL },
{ TY+6, TX+2, NULL }, { TY + 6, TX + 2, NULL },
{ TY+8, TX+2, NULL }, { TY + 8, TX + 2, NULL },
{ TY+10,TX+2, NULL } { TY + 10,TX + 2, NULL }
}; };
/* *INDENT-ON* */ /* *INDENT-ON* */
@ -106,9 +106,9 @@ chown_refresh (Dlg_head * h)
tty_setcolor (COLOR_NORMAL); tty_setcolor (COLOR_NORMAL);
draw_box (h, UY, UX, 12, 21); draw_box (h, UY, UX, 12, 21, TRUE);
draw_box (h, GY, GX, 12, 21); draw_box (h, GY, GX, 12, 21, TRUE);
draw_box (h, TY, TX, 12, 19); draw_box (h, TY, TX, 12, 19, TRUE);
dlg_move (h, TY + 1, TX + 1); dlg_move (h, TY + 1, TX + 1);
tty_print_string (_(" Name ")); tty_print_string (_(" Name "));

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -35,23 +35,25 @@
typedef struct Widget Widget; typedef struct Widget Widget;
/* Widget messages */ /* Widget messages */
typedef enum { typedef enum
WIDGET_INIT, /* Initialize widget */ {
WIDGET_FOCUS, /* Draw widget in focused state */ WIDGET_INIT, /* Initialize widget */
WIDGET_UNFOCUS, /* Draw widget in unfocused state */ WIDGET_FOCUS, /* Draw widget in focused state */
WIDGET_DRAW, /* Sent to widget to draw themselves */ WIDGET_UNFOCUS, /* Draw widget in unfocused state */
WIDGET_KEY, /* Sent to widgets on key press */ WIDGET_DRAW, /* Sent to widget to draw themselves */
WIDGET_HOTKEY, /* Sent to widget to catch preprocess key */ WIDGET_KEY, /* Sent to widgets on key press */
WIDGET_COMMAND, /* Send to widget to handle command */ WIDGET_HOTKEY, /* Sent to widget to catch preprocess key */
WIDGET_DESTROY, /* Sent to widget at destruction time */ WIDGET_COMMAND, /* Send to widget to handle command */
WIDGET_CURSOR, /* Sent to widget to position the cursor */ WIDGET_DESTROY, /* Sent to widget at destruction time */
WIDGET_IDLE, /* Sent to widgets with options & W_WANT_IDLE*/ WIDGET_CURSOR, /* Sent to widget to position the cursor */
WIDGET_RESIZED /* Sent after a widget has been resized */ WIDGET_IDLE, /* Sent to widgets with options & W_WANT_IDLE */
WIDGET_RESIZED /* Sent after a widget has been resized */
} widget_msg_t; } widget_msg_t;
typedef enum { typedef enum
MSG_NOT_HANDLED = 0, {
MSG_HANDLED = 1 MSG_NOT_HANDLED = 0,
MSG_HANDLED = 1
} cb_ret_t; } cb_ret_t;
/* Widgets are expected to answer to the following messages: /* Widgets are expected to answer to the following messages:
@ -60,69 +62,72 @@ typedef enum {
WIDGET_UNFOCUS: 1 if they accept to release the focus, 0 if they don't. WIDGET_UNFOCUS: 1 if they accept to release the focus, 0 if they don't.
WIDGET_KEY: 1 if they actually used the key, 0 if not. WIDGET_KEY: 1 if they actually used the key, 0 if not.
WIDGET_HOTKEY: 1 if they actually used the key, 0 if not. WIDGET_HOTKEY: 1 if they actually used the key, 0 if not.
*/ */
/* Dialog messages */ /* Dialog messages */
typedef enum { typedef enum
DLG_INIT = 0, /* Initialize dialog */ {
DLG_IDLE = 1, /* The idle state is active */ DLG_INIT = 0, /* Initialize dialog */
DLG_DRAW = 2, /* Draw dialog on screen */ DLG_IDLE = 1, /* The idle state is active */
DLG_FOCUS = 3, /* A widget has got focus */ DLG_DRAW = 2, /* Draw dialog on screen */
DLG_UNFOCUS = 4, /* A widget has been unfocused */ DLG_FOCUS = 3, /* A widget has got focus */
DLG_RESIZE = 5, /* Window size has changed */ DLG_UNFOCUS = 4, /* A widget has been unfocused */
DLG_KEY = 6, /* Key before sending to widget */ DLG_RESIZE = 5, /* Window size has changed */
DLG_HOTKEY_HANDLED = 7, /* A widget has got the hotkey */ DLG_KEY = 6, /* Key before sending to widget */
DLG_POST_KEY = 8, /* The key has been handled */ DLG_HOTKEY_HANDLED = 7, /* A widget has got the hotkey */
DLG_UNHANDLED_KEY = 9, /* Key that no widget handled */ DLG_POST_KEY = 8, /* The key has been handled */
DLG_ACTION = 10, /* State of check- and radioboxes has changed DLG_UNHANDLED_KEY = 9, /* Key that no widget handled */
* and listbox current entry has changed */ DLG_ACTION = 10, /* State of check- and radioboxes has changed
DLG_VALIDATE = 11, /* Dialog is to be closed */ * and listbox current entry has changed */
DLG_END = 12 /* Shut down dialog */ DLG_VALIDATE = 11, /* Dialog is to be closed */
DLG_END = 12 /* Shut down dialog */
} dlg_msg_t; } dlg_msg_t;
/* Dialog callback */ /* Dialog callback */
typedef struct Dlg_head Dlg_head; typedef struct Dlg_head Dlg_head;
typedef cb_ret_t (*dlg_cb_fn)(struct Dlg_head *h, Widget *sender, typedef cb_ret_t (*dlg_cb_fn) (struct Dlg_head * h, Widget * sender,
dlg_msg_t msg, int parm, void *data); dlg_msg_t msg, int parm, void *data);
/* get string representation of shortcut assigned with command */ /* get string representation of shortcut assigned with command */
/* as menu is a widget of dialog, ask dialog about shortcut string */ /* as menu is a widget of dialog, ask dialog about shortcut string */
typedef char * (*dlg_shortcut_str) (unsigned long command); typedef char *(*dlg_shortcut_str) (unsigned long command);
/* Dialog color constants */ /* Dialog color constants */
#define DLG_COLOR_NUM 4 #define DLG_COLOR_NUM 4
#define DLG_NORMALC(h) ((h)->color[0]) #define DLG_NORMALC(h) ((h)->color[0])
#define DLG_FOCUSC(h) ((h)->color[1]) #define DLG_FOCUSC(h) ((h)->color[1])
#define DLG_HOT_NORMALC(h) ((h)->color[2]) #define DLG_HOT_NORMALC(h) ((h)->color[2])
#define DLG_HOT_FOCUSC(h) ((h)->color[3]) #define DLG_HOT_FOCUSC(h) ((h)->color[3])
struct Dlg_head { struct Dlg_head
{
/* Set by the user */ /* Set by the user */
int flags; /* User flags */ int flags; /* User flags */
const char *help_ctx; /* Name of the help entry */ const char *help_ctx; /* Name of the help entry */
int *color; /* Color set. Unused in viewer and editor */ int *color; /* Color set. Unused in viewer and editor */
/*notconst*/ char *title; /* Title of the dialog */ /*notconst */ char *title;
/* Title of the dialog */
/* Set and received by the user */ /* Set and received by the user */
int ret_value; /* Result of run_dlg() */ int ret_value; /* Result of run_dlg() */
/* Geometry */ /* Geometry */
int x, y; /* Position relative to screen origin */ int x, y; /* Position relative to screen origin */
int cols, lines; /* Width and height of the window */ int cols, lines; /* Width and height of the window */
/* Internal flags */ /* Internal flags */
unsigned int running:1; /* The dialog is currently active */ unsigned int running:1; /* The dialog is currently active */
unsigned int fullscreen:1; /* Parents dialogs don't need refresh */ unsigned int fullscreen:1; /* Parents dialogs don't need refresh */
int mouse_status; /* For the autorepeat status of the mouse */ int mouse_status; /* For the autorepeat status of the mouse */
/* Internal variables */ /* Internal variables */
int count; /* Number of widgets */ int count; /* Number of widgets */
struct Widget *current; /* Curently active widget */ struct Widget *current; /* Curently active widget */
void *data; /* Data can be passed to dialog */ void *data; /* Data can be passed to dialog */
dlg_cb_fn callback; dlg_cb_fn callback;
dlg_shortcut_str get_shortcut; /* Shortcut string */ dlg_shortcut_str get_shortcut; /* Shortcut string */
struct Dlg_head *parent; /* Parent dialog */ struct Dlg_head *parent; /* Parent dialog */
}; };
/* Color styles for normal and error dialogs */ /* Color styles for normal and error dialogs */
@ -131,34 +136,37 @@ extern int alarm_colors[4];
/* Widget callback */ /* Widget callback */
typedef cb_ret_t (*callback_fn) (Widget *widget, widget_msg_t msg, int parm); typedef cb_ret_t (*callback_fn) (Widget * widget, widget_msg_t msg, int parm);
/* widget options */ /* widget options */
typedef enum { typedef enum
W_WANT_HOTKEY = (1 << 1), {
W_WANT_CURSOR = (1 << 2), W_WANT_HOTKEY = (1 << 1),
W_WANT_IDLE = (1 << 3), W_WANT_CURSOR = (1 << 2),
W_IS_INPUT = (1 << 4) W_WANT_IDLE = (1 << 3),
W_IS_INPUT = (1 << 4)
} widget_options_t; } widget_options_t;
/* Flags for widget repositioning on dialog resize */ /* Flags for widget repositioning on dialog resize */
typedef enum { typedef enum
WPOS_KEEP_LEFT = (1 << 0), /* keep widget distance to left border of dialog */ {
WPOS_KEEP_RIGHT = (1 << 1), /* keep widget distance to right border of dialog */ WPOS_KEEP_LEFT = (1 << 0), /* keep widget distance to left border of dialog */
WPOS_KEEP_TOP = (1 << 2), /* keep widget distance to top border of dialog */ WPOS_KEEP_RIGHT = (1 << 1), /* keep widget distance to right border of dialog */
WPOS_KEEP_BOTTOM = (1 << 3), /* keep widget distance to bottom border of dialog */ WPOS_KEEP_TOP = (1 << 2), /* keep widget distance to top border of dialog */
WPOS_KEEP_HORZ = WPOS_KEEP_LEFT | WPOS_KEEP_RIGHT, WPOS_KEEP_BOTTOM = (1 << 3), /* keep widget distance to bottom border of dialog */
WPOS_KEEP_VERT = WPOS_KEEP_TOP | WPOS_KEEP_BOTTOM, WPOS_KEEP_HORZ = WPOS_KEEP_LEFT | WPOS_KEEP_RIGHT,
WPOS_KEEP_ALL = WPOS_KEEP_HORZ | WPOS_KEEP_VERT WPOS_KEEP_VERT = WPOS_KEEP_TOP | WPOS_KEEP_BOTTOM,
WPOS_KEEP_ALL = WPOS_KEEP_HORZ | WPOS_KEEP_VERT
} widget_pos_flags_t; } widget_pos_flags_t;
/* Every Widget must have this as its first element */ /* Every Widget must have this as its first element */
struct Widget { struct Widget
{
int x, y; int x, y;
int cols, lines; int cols, lines;
widget_options_t options; widget_options_t options;
widget_pos_flags_t pos_flags; /* repositioning flags */ widget_pos_flags_t pos_flags; /* repositioning flags */
int dlg_id; /* Number of the widget, starting with 0 */ int dlg_id; /* Number of the widget, starting with 0 */
struct Widget *next; struct Widget *next;
struct Widget *prev; struct Widget *prev;
callback_fn callback; callback_fn callback;
@ -167,56 +175,55 @@ struct Widget {
}; };
/* draw box in window */ /* draw box in window */
void draw_box (Dlg_head *h, int y, int x, int ys, int xs); void draw_box (Dlg_head * h, int y, int x, int ys, int xs, gboolean single);
/* Flags for create_dlg: */ /* Flags for create_dlg: */
#define DLG_REVERSE (1 << 5) /* Tab order is opposite to the add order */ #define DLG_REVERSE (1 << 5) /* Tab order is opposite to the add order */
#define DLG_WANT_TAB (1 << 4) /* Should the tab key be sent to the dialog? */ #define DLG_WANT_TAB (1 << 4) /* Should the tab key be sent to the dialog? */
#define DLG_WANT_IDLE (1 << 3) /* Dialog wants idle events */ #define DLG_WANT_IDLE (1 << 3) /* Dialog wants idle events */
#define DLG_COMPACT (1 << 2) /* Suppress spaces around the frame */ #define DLG_COMPACT (1 << 2) /* Suppress spaces around the frame */
#define DLG_TRYUP (1 << 1) /* Try to move two lines up the dialog */ #define DLG_TRYUP (1 << 1) /* Try to move two lines up the dialog */
#define DLG_CENTER (1 << 0) /* Center the dialog */ #define DLG_CENTER (1 << 0) /* Center the dialog */
#define DLG_NONE (000000) /* No options */ #define DLG_NONE (000000) /* No options */
/* Creates a dialog head */ /* Creates a dialog head */
Dlg_head *create_dlg (int y1, int x1, int lines, int cols, Dlg_head *create_dlg (int y1, int x1, int lines, int cols,
const int *colors, dlg_cb_fn callback, const int *colors, dlg_cb_fn callback,
const char *help_ctx, const char *title, int flags); const char *help_ctx, const char *title, int flags);
void dlg_set_default_colors (void); void dlg_set_default_colors (void);
int add_widget_autopos (Dlg_head *dest, void *w, widget_pos_flags_t pos_flags); int add_widget_autopos (Dlg_head * dest, void *w, widget_pos_flags_t pos_flags);
int add_widget (Dlg_head *dest, void *w); int add_widget (Dlg_head * dest, void *w);
/* sets size of dialog, leaving positioning to automatic mehtods /* sets size of dialog, leaving positioning to automatic mehtods
according to dialog flags */ according to dialog flags */
void dlg_set_size (Dlg_head *h, int lines, int cols); void dlg_set_size (Dlg_head * h, int lines, int cols);
/* this function allows to set dialog position */ /* this function allows to set dialog position */
void dlg_set_position (Dlg_head *h, int y1, int x1, int y2, int x2); void dlg_set_position (Dlg_head * h, int y1, int x1, int y2, int x2);
/* Runs dialog d */ /* Runs dialog d */
int run_dlg (Dlg_head *d); int run_dlg (Dlg_head * d);
void dlg_run_done (Dlg_head *h); void dlg_run_done (Dlg_head * h);
void dlg_process_event (Dlg_head *h, int key, Gpm_Event *event); void dlg_process_event (Dlg_head * h, int key, Gpm_Event * event);
void init_dlg (Dlg_head *h); void init_dlg (Dlg_head * h);
/* To activate/deactivate the idle message generation */ /* To activate/deactivate the idle message generation */
void set_idle_proc (Dlg_head *d, int enable); void set_idle_proc (Dlg_head * d, int enable);
void dlg_redraw (Dlg_head *h); void dlg_redraw (Dlg_head * h);
void destroy_dlg (Dlg_head *h); void destroy_dlg (Dlg_head * h);
void widget_set_size (Widget *widget, int y, int x, int lines, int cols); void widget_set_size (Widget * widget, int y, int x, int lines, int cols);
void dlg_broadcast_msg (Dlg_head *h, widget_msg_t message, int reverse); void dlg_broadcast_msg (Dlg_head * h, widget_msg_t message, int reverse);
void init_widget (Widget *w, int y, int x, int lines, int cols, void init_widget (Widget * w, int y, int x, int lines, int cols,
callback_fn callback, mouse_h mouse_handler); callback_fn callback, mouse_h mouse_handler);
/* Default callback for dialogs */ /* Default callback for dialogs */
cb_ret_t default_dlg_callback (Dlg_head *h, Widget *sender, cb_ret_t default_dlg_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *data);
dlg_msg_t msg, int parm, void *data);
/* Default paint routine for dialogs */ /* Default paint routine for dialogs */
void common_dialog_repaint (struct Dlg_head *h); void common_dialog_repaint (struct Dlg_head *h);
@ -230,7 +237,7 @@ extern Dlg_head *current_dlg;
extern Hook *idle_hook; extern Hook *idle_hook;
static inline cb_ret_t static inline cb_ret_t
send_message (Widget *w, widget_msg_t msg, int parm) send_message (Widget * w, widget_msg_t msg, int parm)
{ {
return (*(w->callback)) (w, msg, parm); return (*(w->callback)) (w, msg, parm);
} }
@ -243,19 +250,19 @@ dlg_widget_active (void *w)
return (w1->parent->current == w1); return (w1->parent->current == w1);
} }
void dlg_replace_widget (Widget *old, Widget *new); void dlg_replace_widget (Widget * old, Widget * new);
int dlg_overlap (Widget *a, Widget *b); int dlg_overlap (Widget * a, Widget * b);
void widget_erase (Widget *); void widget_erase (Widget *);
void dlg_erase (Dlg_head *h); void dlg_erase (Dlg_head * h);
void dlg_stop (Dlg_head *h); void dlg_stop (Dlg_head * h);
/* Widget selection */ /* Widget selection */
void dlg_select_widget (void *widget); void dlg_select_widget (void *widget);
void dlg_one_up (Dlg_head *h); void dlg_one_up (Dlg_head * h);
void dlg_one_down (Dlg_head *h); void dlg_one_down (Dlg_head * h);
int dlg_focus (Dlg_head *h); int dlg_focus (Dlg_head * h);
Widget *find_widget_type (const Dlg_head *h, callback_fn callback); Widget *find_widget_type (const Dlg_head * h, callback_fn callback);
void dlg_select_by_id (const Dlg_head *h, int id); void dlg_select_by_id (const Dlg_head * h, int id);
/* Redraw all dialogs */ /* Redraw all dialogs */
void do_refresh (void); void do_refresh (void);
@ -268,6 +275,6 @@ void do_refresh (void);
#define widget_want_hotkey(w,i) widget_option(w, W_WANT_HOTKEY, i) #define widget_want_hotkey(w,i) widget_option(w, W_WANT_HOTKEY, i)
/* Used in load_prompt() */ /* Used in load_prompt() */
void update_cursor (Dlg_head *h); void update_cursor (Dlg_head * h);
#endif /* MC_DIALOG_H */ #endif /* MC_DIALOG_H */

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -27,19 +27,19 @@
#include "lib/global.h" #include "lib/global.h"
#include "lib/tty/tty.h" #include "lib/tty/tty.h"
#include "lib/tty/key.h" /* is_idle() */ #include "lib/tty/key.h" /* is_idle() */
#include "lib/tty/mouse.h" /* Gpm_Event */ #include "lib/tty/mouse.h" /* Gpm_Event */
#include "lib/skin.h" #include "lib/skin.h"
#include "lib/unixcompat.h" #include "lib/unixcompat.h"
#include "lib/strutil.h" #include "lib/strutil.h"
#include "dialog.h" #include "dialog.h"
#include "widget.h" /* default_proc*/ #include "widget.h" /* default_proc */
#include "main-widgets.h" /* the_menubar*/ #include "main-widgets.h" /* the_menubar */
#include "dir.h" /* required by panel */ #include "dir.h" /* required by panel */
#include "panel.h" /* for the panel structure */ #include "panel.h" /* for the panel structure */
#include "main.h" /* other_panel, current_panel definitions */ #include "main.h" /* other_panel, current_panel definitions */
#include "menu.h" /* menubar_visible */ #include "menu.h" /* menubar_visible */
#include "layout.h" #include "layout.h"
#include "mountlist.h" #include "mountlist.h"
#include "info.h" #include "info.h"
@ -48,7 +48,8 @@
# define VERSION "undefined" # define VERSION "undefined"
#endif #endif
struct WInfo { struct WInfo
{
Widget widget; Widget widget;
int ready; int ready;
}; };
@ -57,13 +58,13 @@ struct WInfo {
static gboolean initialized = FALSE; static gboolean initialized = FALSE;
static struct my_statfs myfs_stats; static struct my_statfs myfs_stats;
static void info_box (Dlg_head *h, struct WInfo *info) static void
info_box (Dlg_head * h, struct WInfo *info)
{ {
tty_set_normal_attrs (); tty_set_normal_attrs ();
tty_setcolor (NORMAL_COLOR); tty_setcolor (NORMAL_COLOR);
widget_erase (&info->widget); widget_erase (&info->widget);
draw_box (h, info->widget.y, info->widget.x, draw_box (h, info->widget.y, info->widget.x, info->widget.lines, info->widget.cols, FALSE);
info->widget.lines, info->widget.cols);
} }
static void static void
@ -75,209 +76,208 @@ info_show_info (struct WInfo *info)
struct stat st; struct stat st;
if (!is_idle ()) if (!is_idle ())
return; return;
info_box (info->widget.parent, info); info_box (info->widget.parent, info);
tty_setcolor (MARKED_COLOR); tty_setcolor (MARKED_COLOR);
widget_move (&info->widget, 1, 3); widget_move (&info->widget, 1, 3);
tty_printf (_("Midnight Commander %s"), VERSION); tty_printf (_("Midnight Commander %s"), VERSION);
tty_setcolor (NORMAL_COLOR); tty_setcolor (NORMAL_COLOR);
tty_draw_hline (info->widget.y + 2, info->widget.x + 1, tty_draw_hline (info->widget.y + 2, info->widget.x + 1, ACS_HLINE, info->widget.cols - 2);
ACS_HLINE, info->widget.cols - 2);
if (get_current_type () != view_listing) if (get_current_type () != view_listing)
return; return;
if (!info->ready) if (!info->ready)
return; return;
my_statfs (&myfs_stats, current_panel->cwd); my_statfs (&myfs_stats, current_panel->cwd);
st = current_panel->dir.list [current_panel->selected].st; st = current_panel->dir.list[current_panel->selected].st;
/* Print only lines which fit */ /* Print only lines which fit */
if (i18n_adjust == 0) { if (i18n_adjust == 0)
/* This printf pattern string is used as a reference for size */ {
file_label = _("File: %s"); /* This printf pattern string is used as a reference for size */
i18n_adjust = str_term_width1 (file_label) + 2; file_label = _("File: %s");
i18n_adjust = str_term_width1 (file_label) + 2;
} }
buff = g_string_new (""); buff = g_string_new ("");
switch (info->widget.lines-2){ switch (info->widget.lines - 2)
/* Note: all cases are fall-throughs */ {
/* Note: all cases are fall-throughs */
default: default:
case 16: case 16:
widget_move (&info->widget, 16, 3); widget_move (&info->widget, 16, 3);
if (myfs_stats.nfree >0 || myfs_stats.nodes > 0) if (myfs_stats.nfree > 0 || myfs_stats.nodes > 0)
tty_printf (_("Free nodes: %d (%d%%) of %d"), tty_printf (_("Free nodes: %d (%d%%) of %d"),
myfs_stats.nfree, myfs_stats.nfree,
myfs_stats.total myfs_stats.total
? 100 * myfs_stats.nfree / myfs_stats.nodes : 0, ? 100 * myfs_stats.nfree / myfs_stats.nodes : 0, myfs_stats.nodes);
myfs_stats.nodes); else
else tty_print_string (_("No node information"));
tty_print_string (_("No node information"));
case 15: case 15:
widget_move (&info->widget, 15, 3); widget_move (&info->widget, 15, 3);
if (myfs_stats.avail > 0 || myfs_stats.total > 0){ if (myfs_stats.avail > 0 || myfs_stats.total > 0)
char buffer1 [6], buffer2[6]; {
size_trunc_len (buffer1, 5, myfs_stats.avail, 1); char buffer1[6], buffer2[6];
size_trunc_len (buffer2, 5, myfs_stats.total, 1); size_trunc_len (buffer1, 5, myfs_stats.avail, 1);
tty_printf (_("Free space: %s (%d%%) of %s"), buffer1, myfs_stats.total ? size_trunc_len (buffer2, 5, myfs_stats.total, 1);
(int)(100 * (double)myfs_stats.avail / myfs_stats.total) : 0, tty_printf (_("Free space: %s (%d%%) of %s"), buffer1, myfs_stats.total ?
buffer2); (int) (100 * (double) myfs_stats.avail / myfs_stats.total) : 0, buffer2);
} else }
tty_print_string (_("No space information")); else
tty_print_string (_("No space information"));
case 14: case 14:
widget_move (&info->widget, 14, 3); widget_move (&info->widget, 14, 3);
tty_printf (_("Type: %s "), tty_printf (_("Type: %s "),
myfs_stats.typename ? myfs_stats.typename : _("non-local vfs")); myfs_stats.typename ? myfs_stats.typename : _("non-local vfs"));
if (myfs_stats.type != 0xffff && myfs_stats.type != -1) if (myfs_stats.type != 0xffff && myfs_stats.type != -1)
tty_printf (" (%Xh)", myfs_stats.type); tty_printf (" (%Xh)", myfs_stats.type);
case 13: case 13:
widget_move (&info->widget, 13, 3); widget_move (&info->widget, 13, 3);
str_printf (buff, _("Device: %s"), str_printf (buff, _("Device: %s"),
str_trunc (myfs_stats.device, info->widget.cols - i18n_adjust)); str_trunc (myfs_stats.device, info->widget.cols - i18n_adjust));
tty_print_string (buff->str); tty_print_string (buff->str);
g_string_set_size(buff, 0); g_string_set_size (buff, 0);
case 12: case 12:
widget_move (&info->widget, 12, 3); widget_move (&info->widget, 12, 3);
str_printf (buff, _("Filesystem: %s"), str_printf (buff, _("Filesystem: %s"),
str_trunc (myfs_stats.mpoint, info->widget.cols - i18n_adjust)); str_trunc (myfs_stats.mpoint, info->widget.cols - i18n_adjust));
tty_print_string (buff->str); tty_print_string (buff->str);
g_string_set_size(buff, 0); g_string_set_size (buff, 0);
case 11: case 11:
widget_move (&info->widget, 11, 3); widget_move (&info->widget, 11, 3);
str_printf (buff, _("Accessed: %s"), file_date (st.st_atime)); str_printf (buff, _("Accessed: %s"), file_date (st.st_atime));
tty_print_string (buff->str); tty_print_string (buff->str);
g_string_set_size(buff, 0); g_string_set_size (buff, 0);
case 10: case 10:
widget_move (&info->widget, 10, 3); widget_move (&info->widget, 10, 3);
str_printf (buff, _("Modified: %s"), file_date (st.st_mtime)); str_printf (buff, _("Modified: %s"), file_date (st.st_mtime));
tty_print_string (buff->str); tty_print_string (buff->str);
g_string_set_size(buff, 0); g_string_set_size (buff, 0);
case 9: case 9:
widget_move (&info->widget, 9, 3); widget_move (&info->widget, 9, 3);
/* TRANSLATORS: "Status changed", like in the stat(2) man page */ /* TRANSLATORS: "Status changed", like in the stat(2) man page */
str_printf (buff, _("Status: %s"), file_date (st.st_ctime)); str_printf (buff, _("Status: %s"), file_date (st.st_ctime));
tty_print_string (buff->str); tty_print_string (buff->str);
g_string_set_size(buff, 0); g_string_set_size (buff, 0);
case 8: case 8:
widget_move (&info->widget, 8, 3); widget_move (&info->widget, 8, 3);
#ifdef HAVE_STRUCT_STAT_ST_RDEV #ifdef HAVE_STRUCT_STAT_ST_RDEV
if (S_ISCHR (st.st_mode) || S_ISBLK(st.st_mode)) if (S_ISCHR (st.st_mode) || S_ISBLK (st.st_mode))
tty_printf (_("Dev. type: major %lu, minor %lu"), tty_printf (_("Dev. type: major %lu, minor %lu"),
(unsigned long) major (st.st_rdev), (unsigned long) major (st.st_rdev), (unsigned long) minor (st.st_rdev));
(unsigned long) minor (st.st_rdev)); else
else
#endif #endif
{ {
char buffer[10]; char buffer[10];
size_trunc_len(buffer, 9, st.st_size, 0); size_trunc_len (buffer, 9, st.st_size, 0);
tty_printf (_("Size: %s"), buffer); tty_printf (_("Size: %s"), buffer);
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
tty_printf (ngettext(" (%ld block)", " (%ld blocks)", tty_printf (ngettext (" (%ld block)", " (%ld blocks)",
(unsigned long int) st.st_blocks), (unsigned long int) st.st_blocks), (long int) st.st_blocks);
(long int) st.st_blocks);
#endif #endif
} }
case 7: case 7:
widget_move (&info->widget, 7, 3); widget_move (&info->widget, 7, 3);
tty_printf (_("Owner: %s/%s"), tty_printf (_("Owner: %s/%s"), get_owner (st.st_uid), get_group (st.st_gid));
get_owner (st.st_uid),
get_group (st.st_gid));
case 6: case 6:
widget_move (&info->widget, 6, 3); widget_move (&info->widget, 6, 3);
tty_printf (_("Links: %d"), (int) st.st_nlink); tty_printf (_("Links: %d"), (int) st.st_nlink);
case 5: case 5:
widget_move (&info->widget, 5, 3); widget_move (&info->widget, 5, 3);
tty_printf (_("Mode: %s (%04o)"), tty_printf (_("Mode: %s (%04o)"),
string_perm (st.st_mode), (unsigned) st.st_mode & 07777); string_perm (st.st_mode), (unsigned) st.st_mode & 07777);
case 4: case 4:
widget_move (&info->widget, 4, 3); widget_move (&info->widget, 4, 3);
tty_printf (_("Location: %Xh:%Xh"), (int)st.st_dev, (int)st.st_ino); tty_printf (_("Location: %Xh:%Xh"), (int) st.st_dev, (int) st.st_ino);
case 3: case 3:
{ {
const char *fname; const char *fname;
widget_move (&info->widget, 3, 2); widget_move (&info->widget, 3, 2);
fname = current_panel->dir.list [current_panel->selected].fname; fname = current_panel->dir.list[current_panel->selected].fname;
str_printf (buff, file_label, str_printf (buff, file_label, str_trunc (fname, info->widget.cols - i18n_adjust));
str_trunc (fname, info->widget.cols - i18n_adjust)); tty_print_string (buff->str);
tty_print_string (buff->str); }
}
case 2: case 2:
case 1: case 1:
case 0: case 0:
; ;
} /* switch */ } /* switch */
g_string_free (buff, TRUE); g_string_free (buff, TRUE);
} }
static void info_hook (void *data) static void
info_hook (void *data)
{ {
struct WInfo *info = (struct WInfo *) data; struct WInfo *info = (struct WInfo *) data;
Widget *other_widget; Widget *other_widget;
other_widget = get_panel_widget (get_current_index ()); other_widget = get_panel_widget (get_current_index ());
if (!other_widget) if (!other_widget)
return; return;
if (dlg_overlap (&info->widget, other_widget)) if (dlg_overlap (&info->widget, other_widget))
return; return;
info->ready = 1; info->ready = 1;
info_show_info (info); info_show_info (info);
} }
static cb_ret_t static cb_ret_t
info_callback (Widget *w, widget_msg_t msg, int parm) info_callback (Widget * w, widget_msg_t msg, int parm)
{ {
struct WInfo *info = (struct WInfo *) w; struct WInfo *info = (struct WInfo *) w;
switch (msg) { switch (msg)
{
case WIDGET_INIT: case WIDGET_INIT:
add_hook (&select_file_hook, info_hook, info); add_hook (&select_file_hook, info_hook, info);
info->ready = 0; info->ready = 0;
return MSG_HANDLED; return MSG_HANDLED;
case WIDGET_DRAW: case WIDGET_DRAW:
info_hook (info); info_hook (info);
info_show_info (info); info_show_info (info);
return MSG_HANDLED; return MSG_HANDLED;
case WIDGET_FOCUS: case WIDGET_FOCUS:
return MSG_NOT_HANDLED; return MSG_NOT_HANDLED;
case WIDGET_DESTROY: case WIDGET_DESTROY:
delete_hook (&select_file_hook, info_hook); delete_hook (&select_file_hook, info_hook);
return MSG_HANDLED; return MSG_HANDLED;
default: default:
return default_proc (msg, parm); return default_proc (msg, parm);
} }
} }
static int static int
info_event (Gpm_Event *event, void *data) info_event (Gpm_Event * event, void *data)
{ {
Widget *w = &((WInfo *) data)->widget; Widget *w = &((WInfo *) data)->widget;
/* rest of the upper frame, the menu is invisible - call menu */ /* rest of the upper frame, the menu is invisible - call menu */
if (event->type & GPM_DOWN && event->y == 1 && !menubar_visible) { if (event->type & GPM_DOWN && event->y == 1 && !menubar_visible)
event->x += w->x; {
return the_menubar->widget.mouse (event, the_menubar); event->x += w->x;
return the_menubar->widget.mouse (event, the_menubar);
} }
return MOU_NORMAL; return MOU_NORMAL;
@ -293,9 +293,10 @@ info_new (void)
/* We do not want the cursor */ /* We do not want the cursor */
widget_want_cursor (info->widget, 0); widget_want_cursor (info->widget, 0);
if (!initialized) { if (!initialized)
initialized = TRUE; {
init_my_statfs (); initialized = TRUE;
init_my_statfs ();
} }
return info; return info;

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -3,7 +3,7 @@
2007, 2009 Free Software Foundation, Inc. 2007, 2009 Free Software Foundation, Inc.
Written by: 1995 Janne Kukonlehto Written by: 1995 Janne Kukonlehto
1995 Jakub Jelinek 1995 Jakub Jelinek
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -37,16 +37,16 @@
#include "lib/skin.h" #include "lib/skin.h"
#include "lib/vfs/mc-vfs/vfs.h" #include "lib/vfs/mc-vfs/vfs.h"
#include "lib/mcconfig.h" /* Load/save directories panelize */ #include "lib/mcconfig.h" /* Load/save directories panelize */
#include "lib/strutil.h" #include "lib/strutil.h"
#include "dialog.h" #include "dialog.h"
#include "widget.h" #include "widget.h"
#include "wtools.h" /* For common_dialog_repaint() */ #include "wtools.h" /* For common_dialog_repaint() */
#include "setup.h" /* For profile_bname */ #include "setup.h" /* For profile_bname */
#include "dir.h" #include "dir.h"
#include "panel.h" /* current_panel */ #include "panel.h" /* current_panel */
#include "layout.h" /* repaint_screen() */ #include "layout.h" /* repaint_screen() */
#include "main.h" #include "main.h"
#include "panelize.h" #include "panelize.h"
#include "history.h" #include "history.h"
@ -67,21 +67,26 @@ static Dlg_head *panelize_dlg;
static int last_listitem; static int last_listitem;
static WInput *pname; static WInput *pname;
static struct { static struct
{
int ret_cmd, flags, y, x; int ret_cmd, flags, y, x;
const char *text; const char *text;
} panelize_but [BUTTONS] = { } panelize_but[BUTTONS] =
{ B_CANCEL, NORMAL_BUTTON, 0, 53, N_("&Cancel") }, {
{ B_ADD, NORMAL_BUTTON, 0, 28, N_("&Add new") }, /* *INDENT-OFF* */
{ B_REMOVE, NORMAL_BUTTON, 0, 16, N_("&Remove") }, { B_CANCEL, NORMAL_BUTTON, 0, 53, N_("&Cancel") },
{ B_ENTER, DEFPUSH_BUTTON, 0, 0, N_("Pane&lize") }, { B_ADD, NORMAL_BUTTON, 0, 28, N_("&Add new") },
{ B_REMOVE, NORMAL_BUTTON, 0, 16, N_("&Remove") },
{ B_ENTER, DEFPUSH_BUTTON, 0, 0, N_("Pane&lize") }
/* *INDENT-ON* */
}; };
static const char *panelize_section = "Panelize"; static const char *panelize_section = "Panelize";
static void do_external_panelize (char *command); static void do_external_panelize (char *command);
/* Directory panelize */ /* Directory panelize */
static struct panelize { static struct panelize
{
char *command; char *command;
char *label; char *label;
struct panelize *next; struct panelize *next;
@ -90,36 +95,37 @@ static struct panelize {
static void static void
update_command (void) update_command (void)
{ {
if (l_panelize->pos != last_listitem) { if (l_panelize->pos != last_listitem)
struct panelize *data = NULL; {
struct panelize *data = NULL;
last_listitem = l_panelize->pos; last_listitem = l_panelize->pos;
listbox_get_current (l_panelize, NULL, (void **) &data); listbox_get_current (l_panelize, NULL, (void **) &data);
assign_text (pname, data->command); assign_text (pname, data->command);
pname->point = 0; pname->point = 0;
update_input (pname, 1); update_input (pname, 1);
} }
} }
static cb_ret_t static cb_ret_t
panelize_callback (Dlg_head *h, Widget *sender, panelize_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
dlg_msg_t msg, int parm, void *data)
{ {
switch (msg) { switch (msg)
{
case DLG_INIT: case DLG_INIT:
case DLG_POST_KEY: case DLG_POST_KEY:
tty_setcolor (MENU_ENTRY_COLOR); tty_setcolor (MENU_ENTRY_COLOR);
update_command (); update_command ();
return MSG_HANDLED; return MSG_HANDLED;
case DLG_DRAW: case DLG_DRAW:
common_dialog_repaint (h); common_dialog_repaint (h);
tty_setcolor (COLOR_NORMAL); tty_setcolor (COLOR_NORMAL);
draw_box (h, UY, UX, h->lines - 10, h->cols - 10); draw_box (h, UY, UX, h->lines - 10, h->cols - 10, TRUE);
return MSG_HANDLED; return MSG_HANDLED;
default: default:
return default_dlg_callback (h, sender, msg, parm, data); return default_dlg_callback (h, sender, msg, parm, data);
} }
} }
@ -133,97 +139,99 @@ init_panelize (void)
static int i18n_flag = 0; static int i18n_flag = 0;
static int maxlen = 0; static int maxlen = 0;
if (!i18n_flag) { if (!i18n_flag)
i = sizeof (panelize_but) / sizeof (panelize_but[0]); {
while (i--) { i = sizeof (panelize_but) / sizeof (panelize_but[0]);
panelize_but[i].text = _(panelize_but[i].text); while (i--)
maxlen += str_term_width1 (panelize_but[i].text) + 5; {
} panelize_but[i].text = _(panelize_but[i].text);
maxlen += 10; maxlen += str_term_width1 (panelize_but[i].text) + 5;
}
maxlen += 10;
i18n_flag = 1; i18n_flag = 1;
} }
panelize_cols = max (panelize_cols, maxlen); panelize_cols = max (panelize_cols, maxlen);
panelize_but[2].x = panelize_but[2].x = panelize_but[3].x + str_term_width1 (panelize_but[3].text) + 7;
panelize_but[3].x + str_term_width1 (panelize_but[3].text) + 7; panelize_but[1].x = panelize_but[2].x + str_term_width1 (panelize_but[2].text) + 5;
panelize_but[1].x = panelize_but[0].x = panelize_cols - str_term_width1 (panelize_but[0].text) - 8 - BX;
panelize_but[2].x + str_term_width1 (panelize_but[2].text) + 5;
panelize_but[0].x =
panelize_cols - str_term_width1 (panelize_but[0].text) - 8 - BX;
#endif /* ENABLE_NLS */ #endif /* ENABLE_NLS */
last_listitem = 0; last_listitem = 0;
do_refresh (); do_refresh ();
panelize_dlg = panelize_dlg =
create_dlg (0, 0, 22, panelize_cols, dialog_colors, create_dlg (0, 0, 22, panelize_cols, dialog_colors,
panelize_callback, "[External panelize]", panelize_callback, "[External panelize]",
_("External panelize"), DLG_CENTER | DLG_REVERSE); _("External panelize"), DLG_CENTER | DLG_REVERSE);
for (i = 0; i < BUTTONS; i++) for (i = 0; i < BUTTONS; i++)
add_widget (panelize_dlg, add_widget (panelize_dlg,
button_new (BY + panelize_but[i].y, button_new (BY + panelize_but[i].y,
BX + panelize_but[i].x, BX + panelize_but[i].x,
panelize_but[i].ret_cmd, panelize_but[i].ret_cmd,
panelize_but[i].flags, panelize_but[i].flags, panelize_but[i].text, 0));
panelize_but[i].text, 0));
pname = pname =
input_new (UY + 14, UX, INPUT_COLOR, panelize_dlg->cols - 10, "", input_new (UY + 14, UX, INPUT_COLOR, panelize_dlg->cols - 10, "",
"in", INPUT_COMPLETE_DEFAULT); "in", INPUT_COMPLETE_DEFAULT);
add_widget (panelize_dlg, pname); add_widget (panelize_dlg, pname);
add_widget (panelize_dlg, label_new (UY + 13, UX, _("Command"))); add_widget (panelize_dlg, label_new (UY + 13, UX, _("Command")));
/* get new listbox */ /* get new listbox */
l_panelize = l_panelize = listbox_new (UY + 1, UX + 1, 10, panelize_dlg->cols - 12, FALSE, NULL);
listbox_new (UY + 1, UX + 1, 10, panelize_dlg->cols - 12, FALSE, NULL);
while (current) { while (current)
listbox_add_item (l_panelize, LISTBOX_APPEND_AT_END, 0, current->label, current); {
current = current->next; listbox_add_item (l_panelize, LISTBOX_APPEND_AT_END, 0, current->label, current);
current = current->next;
} }
/* add listbox to the dialogs */ /* add listbox to the dialogs */
add_widget (panelize_dlg, l_panelize); add_widget (panelize_dlg, l_panelize);
listbox_select_entry (l_panelize, listbox_select_entry (l_panelize, listbox_search_text (l_panelize, _("Other command")));
listbox_search_text (l_panelize,
_("Other command")));
} }
static void panelize_done (void) static void
panelize_done (void)
{ {
destroy_dlg (panelize_dlg); destroy_dlg (panelize_dlg);
repaint_screen (); repaint_screen ();
} }
static void add2panelize (char *label, char *command) static void
add2panelize (char *label, char *command)
{ {
struct panelize *current, *old; struct panelize *current, *old;
old = NULL; old = NULL;
current = panelize; current = panelize;
while (current && strcmp (current->label, label) <= 0){ while (current && strcmp (current->label, label) <= 0)
old = current; {
current = current->next; old = current;
current = current->next;
} }
if (old == NULL){ if (old == NULL)
panelize = g_new (struct panelize, 1); {
panelize->label = label; panelize = g_new (struct panelize, 1);
panelize->command = command; panelize->label = label;
panelize->next = current; panelize->command = command;
} else { panelize->next = current;
struct panelize *new; }
new = g_new (struct panelize, 1); else
new->label = label; {
new->command = command; struct panelize *new;
old->next = new; new = g_new (struct panelize, 1);
new->next = current; new->label = label;
new->command = command;
old->next = new;
new->next = current;
} }
} }
@ -232,39 +240,45 @@ add2panelize_cmd (void)
{ {
char *label; char *label;
if (pname->buffer && (*pname->buffer)) { if (pname->buffer && (*pname->buffer))
label = input_dialog (_(" Add to external panelize "), {
_(" Enter command label: "), label = input_dialog (_(" Add to external panelize "),
MC_HISTORY_FM_PANELIZE_ADD, _(" Enter command label: "), MC_HISTORY_FM_PANELIZE_ADD, "");
""); if (!label)
if (!label) return;
return; if (!*label)
if (!*label) { {
g_free (label); g_free (label);
return; return;
} }
add2panelize (label, g_strdup (pname->buffer)); add2panelize (label, g_strdup (pname->buffer));
} }
} }
static void remove_from_panelize (struct panelize *entry) static void
remove_from_panelize (struct panelize *entry)
{ {
if (strcmp (entry->label, _("Other command")) != 0) { if (strcmp (entry->label, _("Other command")) != 0)
if (entry == panelize) { {
panelize = panelize->next; if (entry == panelize)
} else { {
struct panelize *current = panelize; panelize = panelize->next;
while (current && current->next != entry) }
current = current->next; else
if (current) { {
current->next = entry->next; struct panelize *current = panelize;
} while (current && current->next != entry)
} current = current->next;
if (current)
{
current->next = entry->next;
}
}
g_free (entry->label); g_free (entry->label);
g_free (entry->command); g_free (entry->command);
g_free (entry); g_free (entry);
} }
} }
@ -273,10 +287,10 @@ external_panelize (void)
{ {
char *target = NULL; char *target = NULL;
if (!vfs_current_is_local ()){ if (!vfs_current_is_local ())
message (D_ERROR, MSG_ERROR, {
_(" Cannot run external panelize in a non-local directory ")); message (D_ERROR, MSG_ERROR, _(" Cannot run external panelize in a non-local directory "));
return; return;
} }
init_panelize (); init_panelize ();
@ -286,177 +300,196 @@ external_panelize (void)
run_dlg (panelize_dlg); run_dlg (panelize_dlg);
switch (panelize_dlg->ret_value) { switch (panelize_dlg->ret_value)
{
case B_CANCEL: case B_CANCEL:
break; break;
case B_ADD: case B_ADD:
add2panelize_cmd (); add2panelize_cmd ();
break; break;
case B_REMOVE: case B_REMOVE:
{ {
struct panelize *entry; struct panelize *entry;
listbox_get_current (l_panelize, NULL, (void **) &entry); listbox_get_current (l_panelize, NULL, (void **) &entry);
remove_from_panelize (entry); remove_from_panelize (entry);
break; break;
} }
case B_ENTER: case B_ENTER:
target = pname->buffer; target = pname->buffer;
if (target != NULL && *target) { if (target != NULL && *target)
char *cmd = g_strdup (target); {
destroy_dlg (panelize_dlg); char *cmd = g_strdup (target);
do_external_panelize (cmd); destroy_dlg (panelize_dlg);
g_free (cmd); do_external_panelize (cmd);
repaint_screen (); g_free (cmd);
return; repaint_screen ();
} return;
break; }
break;
} }
panelize_done (); panelize_done ();
} }
void load_panelize (void) void
load_panelize (void)
{ {
gchar **profile_keys, **keys; gchar **profile_keys, **keys;
gsize len; gsize len;
GIConv conv; GIConv conv;
GString *buffer; GString *buffer;
conv = str_crt_conv_from ("UTF-8"); conv = str_crt_conv_from ("UTF-8");
profile_keys = keys = mc_config_get_keys (mc_main_config, panelize_section,&len); profile_keys = keys = mc_config_get_keys (mc_main_config, panelize_section, &len);
add2panelize (g_strdup (_("Other command")), g_strdup ("")); add2panelize (g_strdup (_("Other command")), g_strdup (""));
if (!profile_keys || *profile_keys == NULL){ if (!profile_keys || *profile_keys == NULL)
add2panelize (g_strdup (_("Find rejects after patching")), g_strdup ("find . -name \\*.rej -print")); {
add2panelize (g_strdup (_("Find *.orig after patching")), g_strdup ("find . -name \\*.orig -print")); add2panelize (g_strdup (_("Find rejects after patching")),
add2panelize (g_strdup (_("Find SUID and SGID programs")), g_strdup ("find . \\( \\( -perm -04000 -a -perm +011 \\) -o \\( -perm -02000 -a -perm +01 \\) \\) -print")); g_strdup ("find . -name \\*.rej -print"));
return; add2panelize (g_strdup (_("Find *.orig after patching")),
g_strdup ("find . -name \\*.orig -print"));
add2panelize (g_strdup (_("Find SUID and SGID programs")),
g_strdup
("find . \\( \\( -perm -04000 -a -perm +011 \\) -o \\( -perm -02000 -a -perm +01 \\) \\) -print"));
return;
} }
while (*profile_keys){ while (*profile_keys)
{
if (utf8_display || conv == INVALID_CONV){ if (utf8_display || conv == INVALID_CONV)
{
buffer = g_string_new (*profile_keys); buffer = g_string_new (*profile_keys);
} else { }
else
{
buffer = g_string_new (""); buffer = g_string_new ("");
if (str_convert (conv, *profile_keys, buffer) == ESTR_FAILURE) if (str_convert (conv, *profile_keys, buffer) == ESTR_FAILURE)
{ {
g_string_free(buffer, TRUE); g_string_free (buffer, TRUE);
buffer = g_string_new (*profile_keys); buffer = g_string_new (*profile_keys);
} }
} }
add2panelize ( add2panelize (g_string_free (buffer, FALSE),
g_string_free(buffer, FALSE), mc_config_get_string (mc_main_config, panelize_section, *profile_keys, ""));
mc_config_get_string(mc_main_config,panelize_section,*profile_keys,"") profile_keys++;
);
profile_keys++;
} }
g_strfreev(keys); g_strfreev (keys);
str_close_conv (conv); str_close_conv (conv);
} }
void save_panelize (void) void
save_panelize (void)
{ {
struct panelize *current = panelize; struct panelize *current = panelize;
mc_config_del_group (mc_main_config, panelize_section); mc_config_del_group (mc_main_config, panelize_section);
for (;current; current = current->next){ for (; current; current = current->next)
if (strcmp (current->label, _("Other command"))) {
mc_config_set_string(mc_main_config, if (strcmp (current->label, _("Other command")))
panelize_section, mc_config_set_string (mc_main_config,
current->label, panelize_section, current->label, current->command);
current->command);
} }
mc_config_save_file (mc_main_config, NULL); mc_config_save_file (mc_main_config, NULL);
} }
void done_panelize (void) void
done_panelize (void)
{ {
struct panelize *current = panelize; struct panelize *current = panelize;
struct panelize *next; struct panelize *next;
for (; current; current = next){ for (; current; current = next)
next = current->next; {
g_free (current->label); next = current->next;
g_free (current->command); g_free (current->label);
g_free (current); g_free (current->command);
g_free (current);
} }
} }
static void do_external_panelize (char *command) static void
do_external_panelize (char *command)
{ {
int status, link_to_dir, stale_link; int status, link_to_dir, stale_link;
int next_free = 0; int next_free = 0;
struct stat st; struct stat st;
dir_list *list = &current_panel->dir; dir_list *list = &current_panel->dir;
char line [MC_MAXPATHLEN]; char line[MC_MAXPATHLEN];
char *name; char *name;
FILE *external; FILE *external;
open_error_pipe (); open_error_pipe ();
external = popen (command, "r"); external = popen (command, "r");
if (!external){ if (!external)
close_error_pipe (D_ERROR, _("Cannot invoke command.")); {
return; close_error_pipe (D_ERROR, _("Cannot invoke command."));
return;
} }
/* Clear the counters and the directory list */ /* Clear the counters and the directory list */
panel_clean_dir (current_panel); panel_clean_dir (current_panel);
while (1) { while (1)
clearerr(external); {
if (fgets (line, MC_MAXPATHLEN, external) == NULL) { clearerr (external);
if (ferror(external) && errno == EINTR) if (fgets (line, MC_MAXPATHLEN, external) == NULL)
continue; {
else if (ferror (external) && errno == EINTR)
break; continue;
} else
if (line[strlen(line)-1] == '\n') break;
line[strlen(line)-1] = 0; }
if (strlen(line) < 1) if (line[strlen (line) - 1] == '\n')
continue; line[strlen (line) - 1] = 0;
if (line [0] == '.' && line[1] == PATH_SEP) if (strlen (line) < 1)
name = line + 2; continue;
else if (line[0] == '.' && line[1] == PATH_SEP)
name = line; name = line + 2;
status = handle_path (list, name, &st, next_free, &link_to_dir, else
&stale_link); name = line;
if (status == 0) status = handle_path (list, name, &st, next_free, &link_to_dir, &stale_link);
continue; if (status == 0)
if (status == -1) continue;
break; if (status == -1)
list->list [next_free].fnamelen = strlen (name); break;
list->list [next_free].fname = g_strdup (name); list->list[next_free].fnamelen = strlen (name);
file_mark (current_panel, next_free, 0); list->list[next_free].fname = g_strdup (name);
list->list [next_free].f.link_to_dir = link_to_dir; file_mark (current_panel, next_free, 0);
list->list [next_free].f.stale_link = stale_link; list->list[next_free].f.link_to_dir = link_to_dir;
list->list [next_free].f.dir_size_computed = 0; list->list[next_free].f.stale_link = stale_link;
list->list [next_free].st = st; list->list[next_free].f.dir_size_computed = 0;
list->list[next_free].st = st;
list->list[next_free].sort_key = NULL; list->list[next_free].sort_key = NULL;
list->list[next_free].second_sort_key = NULL; list->list[next_free].second_sort_key = NULL;
next_free++; next_free++;
if (!(next_free & 32)) if (!(next_free & 32))
rotate_dash (); rotate_dash ();
} }
current_panel->is_panelized = 1; current_panel->is_panelized = 1;
if (next_free){ if (next_free)
current_panel->count = next_free; {
if (list->list [0].fname [0] == PATH_SEP){ current_panel->count = next_free;
strcpy (current_panel->cwd, PATH_SEP_STR); if (list->list[0].fname[0] == PATH_SEP)
chdir (PATH_SEP_STR); {
} strcpy (current_panel->cwd, PATH_SEP_STR);
} else { chdir (PATH_SEP_STR);
current_panel->count = set_zero_dir (list) ? 1 : 0; }
}
else
{
current_panel->count = set_zero_dir (list) ? 1 : 0;
} }
if (pclose (external) < 0) if (pclose (external) < 0)
message (D_NORMAL, _("External panelize"), _("Pipe close failed")); message (D_NORMAL, _("External panelize"), _("Pipe close failed"));
close_error_pipe (D_NORMAL, NULL); close_error_pipe (D_NORMAL, NULL);
try_to_select (current_panel, NULL); try_to_select (current_panel, NULL);
panel_re_sort (current_panel); panel_re_sort (current_panel);

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

@ -89,10 +89,11 @@ typedef struct format_e
const char *id; const char *id;
} format_e; } format_e;
enum { enum
QSEARCH_CASE_INSENSITIVE = 0, /* quick search in case insensitive mode */ {
QSEARCH_CASE_INSENSITIVE = 0, /* quick search in case insensitive mode */
QSEARCH_CASE_SENSITIVE = 1, /* quick search in case sensitive mode */ QSEARCH_CASE_SENSITIVE = 1, /* quick search in case sensitive mode */
QSEARCH_PANEL_CASE = 2 /* quick search get value from panel case_sensitive */ QSEARCH_PANEL_CASE = 2 /* quick search get value from panel case_sensitive */
}; };
int quick_search_case_sensitive = QSEARCH_PANEL_CASE; int quick_search_case_sensitive = QSEARCH_PANEL_CASE;
@ -747,7 +748,7 @@ format_file (char *dest, int limit, WPanel * panel, int file_index, int width, i
tty_setcolor (SELECTED_COLOR); tty_setcolor (SELECTED_COLOR);
else else
tty_setcolor (NORMAL_COLOR); tty_setcolor (NORMAL_COLOR);
tty_print_one_vline (); tty_print_one_vline (TRUE);
length++; length++;
} }
} }
@ -803,7 +804,7 @@ repaint_file (WPanel * panel, int file_index, int mv, int attr, int isstatus)
else else
{ {
tty_setcolor (NORMAL_COLOR); tty_setcolor (NORMAL_COLOR);
tty_print_one_vline (); tty_print_one_vline (TRUE);
} }
} }
} }
@ -984,14 +985,14 @@ show_dir (WPanel * panel)
gchar *tmp; gchar *tmp;
set_colors (panel); set_colors (panel);
draw_box (panel->widget.parent, draw_box (panel->widget.parent,
panel->widget.y, panel->widget.x, panel->widget.lines, panel->widget.cols); panel->widget.y, panel->widget.x, panel->widget.lines, panel->widget.cols, FALSE);
if (show_mini_info) if (show_mini_info)
{ {
widget_move (&panel->widget, llines (panel) + 2, 0); widget_move (&panel->widget, llines (panel) + 2, 0);
tty_print_alt_char (ACS_LTEE); tty_print_alt_char (ACS_LTEE, FALSE);
widget_move (&panel->widget, llines (panel) + 2, panel->widget.cols - 1); widget_move (&panel->widget, llines (panel) + 2, panel->widget.cols - 1);
tty_print_alt_char (ACS_RTEE); tty_print_alt_char (ACS_RTEE, FALSE);
} }
widget_move (&panel->widget, 0, 1); widget_move (&panel->widget, 0, 1);
@ -1515,7 +1516,7 @@ paint_frame (WPanel * panel)
if (side) if (side)
{ {
tty_setcolor (NORMAL_COLOR); tty_setcolor (NORMAL_COLOR);
tty_print_one_vline (); tty_print_one_vline (TRUE);
width = panel->widget.cols - panel->widget.cols / 2 - 1; width = panel->widget.cols - panel->widget.cols / 2 - 1;
} }
else if (panel->split) else if (panel->split)
@ -1551,7 +1552,7 @@ paint_frame (WPanel * panel)
else else
{ {
tty_setcolor (NORMAL_COLOR); tty_setcolor (NORMAL_COLOR);
tty_print_one_vline (); tty_print_one_vline (TRUE);
width--; width--;
} }
} }
@ -3214,7 +3215,7 @@ mouse_sort_col (Gpm_Event * event, WPanel * panel)
* If the event is redirected to the menu, *redir is set to TRUE. * If the event is redirected to the menu, *redir is set to TRUE.
*/ */
static int static int
do_panel_event (Gpm_Event * event, WPanel * panel, gboolean *redir) do_panel_event (Gpm_Event * event, WPanel * panel, gboolean * redir)
{ {
const int lines = llines (panel); const int lines = llines (panel);
const gboolean is_active = dlg_widget_active (panel); const gboolean is_active = dlg_widget_active (panel);

1043
src/tree.c

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -341,11 +341,7 @@ mcview_display_clean (mcview_t * view)
tty_setcolor (NORMAL_COLOR); tty_setcolor (NORMAL_COLOR);
widget_erase ((Widget *) view); widget_erase ((Widget *) view);
if (view->dpy_frame_size != 0) if (view->dpy_frame_size != 0)
{ tty_draw_box (view->widget.y, view->widget.x, view->widget.lines, view->widget.cols, FALSE);
tty_draw_box (view->widget.y, view->widget.x, view->widget.lines, view->widget.cols);
/* draw_double_box (view->widget.parent, view->widget.y,
view->widget.x, view->widget.lines, view->widget.cols); */
}
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */

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

@ -199,7 +199,7 @@ mcview_display_hex (mcview_t * view)
{ {
if (view->data_area.width >= 80 && col < width) if (view->data_area.width >= 80 && col < width)
{ {
tty_print_one_vline (); tty_print_one_vline (TRUE);
col += 1; col += 1;
} }
if (col < width) if (col < width)

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

@ -871,9 +871,9 @@ hline_callback (Widget * w, widget_msg_t msg, int parm)
if (l->auto_adjust_cols) if (l->auto_adjust_cols)
{ {
widget_move (w, 0, 0); widget_move (w, 0, 0);
tty_print_alt_char (ACS_LTEE); tty_print_alt_char (ACS_LTEE, FALSE);
widget_move (w, 0, w->cols - 1); widget_move (w, 0, w->cols - 1);
tty_print_alt_char (ACS_RTEE); tty_print_alt_char (ACS_RTEE, FALSE);
} }
return MSG_HANDLED; return MSG_HANDLED;
@ -2254,14 +2254,14 @@ listbox_drawscroll (WListbox * l)
/* Are we at the top? */ /* Are we at the top? */
widget_move (&l->widget, 0, l->widget.cols); widget_move (&l->widget, 0, l->widget.cols);
if (l->top == 0) if (l->top == 0)
tty_print_one_vline (); tty_print_one_vline (TRUE);
else else
tty_print_char ('^'); tty_print_char ('^');
/* Are we at the bottom? */ /* Are we at the bottom? */
widget_move (&l->widget, max_line, l->widget.cols); widget_move (&l->widget, max_line, l->widget.cols);
if ((l->top + l->widget.lines == l->count) || (l->widget.lines >= l->count)) if ((l->top + l->widget.lines == l->count) || (l->widget.lines >= l->count))
tty_print_one_vline (); tty_print_one_vline (TRUE);
else else
tty_print_char ('v'); tty_print_char ('v');
@ -2273,7 +2273,7 @@ listbox_drawscroll (WListbox * l)
{ {
widget_move (&l->widget, i, l->widget.cols); widget_move (&l->widget, i, l->widget.cols);
if (i != line) if (i != line)
tty_print_one_vline (); tty_print_one_vline (TRUE);
else else
tty_print_char ('*'); tty_print_char ('*');
} }
@ -3022,7 +3022,7 @@ groupbox_callback (Widget * w, widget_msg_t msg, int parm)
case WIDGET_DRAW: case WIDGET_DRAW:
tty_setcolor (COLOR_NORMAL); tty_setcolor (COLOR_NORMAL);
draw_box (g->widget.parent, g->widget.y - g->widget.parent->y, draw_box (g->widget.parent, g->widget.y - g->widget.parent->y,
g->widget.x - g->widget.parent->x, g->widget.lines, g->widget.cols); g->widget.x - g->widget.parent->x, g->widget.lines, g->widget.cols, TRUE);
tty_setcolor (COLOR_HOT_NORMAL); tty_setcolor (COLOR_HOT_NORMAL);
dlg_move (g->widget.parent, g->widget.y - g->widget.parent->y, dlg_move (g->widget.parent, g->widget.y - g->widget.parent->y,