Hello, MC developers team ;-)
First of all, thanks for your product)
I have pretty patch for the MC, written by X-Stranger(x...@linux.by), but
for MC-4.6.1. I rewrite this patch for mc-4.7.0_pre2.
This patch adds files color highlighting by it`s type.
So maybe include it into the distribution?
PS. Sorry for my english, I am Russian ;-)
PPS. Here <http://img44.imageshack.us/img44/2412/mcscreenshot.jpg> is
screenshot of patched mc.
---
Best regards, Alexey Kaminsky
diff -urN mc-4.7.0-pre2-orig/doc/man/mc.1.in mc-4.7.0-pre2/doc/man/mc.1.in
--- mc-4.7.0-pre2-orig/doc/man/mc.1.in 2009-08-28 21:31:32.000000000 +0300
+++ mc-4.7.0-pre2/doc/man/mc.1.in 2009-08-31 15:37:04.000000000 +0300
@@ -3058,7 +3058,9 @@
dhotnormal, dhotfocus. Help colors are: helpnormal, helpitalic,
helpbold, helplink, helpslink. Viewer color is: viewunderline. Special
highlighting colors are: executable, directory, link, stalelink, device,
-special, core. Editor colors are: editnormal, editbold, editmarked.
+special, core. Filetype highlighting colors are: hidden, temp, doc,
+archive, source, media, graph, database. Editor colors are: editnormal,
+editbold, editmarked.
.PP
.I input
determines the color of input lines used in query dialogs.
@@ -3116,6 +3118,25 @@
.I core
is for core files.
.PP
+Also filetype highlight colors determine how files displayed depending
+on file type such as (below are colors named as filetypes):
+.I hidden
+is used for hidden files and directories that begin with dot;
+.I temp
+is used for temporary files;
+.I doc
+is used for document and text files;
+.I archive
+is used for archive files;
+.I source
+is used for files with source codes;
+.I media
+is used for multimedia files;
+.I graph
+is used for files with graphic data;
+.I database
+is used for database files.
+.PP
The possible colors are: black, gray, red, brightred, green,
brightgreen, brown, yellow, blue, brightblue, magenta, brightmagenta,
cyan, brightcyan, lightgray and white. And there is a special keyword
diff -urN mc-4.7.0-pre2-orig/doc/man/ru/mc.1.in mc-4.7.0-pre2/doc/man/ru/mc.1.in
--- mc-4.7.0-pre2-orig/doc/man/ru/mc.1.in 2009-08-28 21:31:32.000000000
+0300
+++ mc-4.7.0-pre2/doc/man/ru/mc.1.in 2009-08-31 15:36:05.000000000 +0300
@@ -3406,8 +3406,9 @@
dnormal, dfocus, dhotnormal, dhotfocus; ЦвеÑа в окне
подÑказки:
helpnormal, helpitalic, helpbold, helplink, helpslink; в окне
пÑогÑаммÑ
пÑоÑмоÑÑа: viewunderline; ÑпеÑиалÑнÑе подÑвеÑки:
executable, directory,
-link, device, special, core; в окне ÑедакÑоÑа: editnormal,
editbold,
-editmarked.
+link, device, special, core; подÑвеÑка Ñайлов по Ñипам:
hidden, temp,
+doc, archive, source, media, graph, database; в окне ÑедакÑоÑа:
+editnormal, editbold, editmarked.
.PP
ЦвеÑа задаваÑÑ Ð½Ðµ обÑзаÑелÑно. Ð¦Ð²ÐµÑ ÐºÐ°ÐºÐ¾Ð³Ð¾
именно Ð¿Ð¾Ð»Ñ Ð¾Ð¿ÑеделÑеÑÑÑ
каждÑм клÑÑевÑм Ñловом, можно понÑÑÑ Ð¸Ð·
пеÑевода ÑÑого клÑÑевого Ñлова.
@@ -3471,6 +3472,25 @@
.I core
\- Ð´Ð»Ñ Ñайлов Ñ Ð´Ð°Ð¼Ð¿Ð°Ð¼Ð¸ (core).
.PP
+ÐналогиÑно подÑвеÑка Ñайлов по Ñипам
иÑполÑзÑеÑÑÑ Ð´Ð»Ñ Ð¿Ð¾Ð´ÑвеÑки Ñайлов
+в завиÑимоÑÑи Ð¾Ñ Ð¸Ñ
ÑаÑÑиÑениÑ:
+.I hidden
+иÑполÑзÑеÑÑÑ Ð´Ð»Ñ ÑкÑÑÑÑÑ
Ñайлов и
каÑалогов, коÑоÑÑе наÑинаÑÑÑÑ Ñ ÑоÑки;
+.I temp
+\- Ð´Ð»Ñ Ð²ÑеменнÑÑ
Ñайлов;
+.I doc
+\- Ð´Ð»Ñ Ñайлов докÑменÑов;
+.I archive
+\- Ð´Ð»Ñ Ñайлов аÑÑ
ивов;
+.I source
+\- Ð´Ð»Ñ Ñайлов иÑÑ
однÑÑ
ÑекÑÑов;
+.I media
+\- Ð´Ð»Ñ Ð¼ÑлÑÑимедиа-Ñайлов;
+.I graph
+\- Ð´Ð»Ñ Ð³ÑаÑиÑеÑкиÑ
Ñайлов;
+.I database
+\- Ð´Ð»Ñ Ñайлов баз даннÑÑ
.
+.PP
ÐозможнÑе ÑвеÑа: black, gray, red, brightred, green,
brightgreen, brown,
yellow, blue, brightblue, magenta, brightmagenta, cyan, brightcyan,
lightgray и white.
diff -urN mc-4.7.0-pre2-orig/po/mc.pot mc-4.7.0-pre2/po/mc.pot
--- mc-4.7.0-pre2-orig/po/mc.pot 2009-08-28 23:31:11.000000000 +0300
+++ mc-4.7.0-pre2/po/mc.pot 2009-08-31 15:42:00.000000000 +0300
@@ -1213,6 +1213,42 @@
msgid "&Select"
msgstr ""
+#: src/boxes.c:681
+msgid "&Ok"
+msgstr ""
+
+#: src/boxes.c:683
+msgid "Databases"
+msgstr ""
+
+#: src/boxes.c:685
+msgid "Graphics"
+msgstr ""
+
+#: src/boxes.c:687
+msgid "Multimedia"
+msgstr ""
+
+#: src/boxes.c:689
+msgid "Sources"
+msgstr ""
+
+#: src/boxes.c:691
+msgid "Archives"
+msgstr ""
+
+#: src/boxes.c:693
+msgid "Text/Doc Files"
+msgstr ""
+
+#: src/boxes.c:695
+msgid "Temp Files"
+msgstr ""
+
+#: src/boxes.c:700
+msgid " File highlighting "
+msgstr ""
+
#: src/boxes.c:746
msgid "Use passive mode over pro&xy"
msgstr ""
@@ -2948,6 +2984,10 @@
msgid "&Display bits..."
msgstr ""
+#: src/main.c:920
+msgid "file &Highlighting..."
+msgstr ""
+
#: src/main.c:784
msgid "learn &Keys..."
msgstr ""
@@ -3070,8 +3110,9 @@
#: src/main.c:1863
msgid ""
" Help: helpnormal, helpitalic, helpbold, helplink, helpslink\n"
-" File types: directory, executable, link, stalelink, device, special, "
-"core\n"
+" File types: directory, executable, link, stalelink, device, special,\n"
+" core, hidden, temp, doc, archive, source, media, graph,\n"
+" database\n"
"\n"
"Colors:\n"
" black, gray, red, brightred, green, brightgreen, brown,\n"
diff -urN mc-4.7.0-pre2-orig/po/ru.po mc-4.7.0-pre2/po/ru.po
--- mc-4.7.0-pre2-orig/po/ru.po 2009-08-28 23:31:16.000000000 +0300
+++ mc-4.7.0-pre2/po/ru.po 2009-08-31 15:44:02.000000000 +0300
@@ -919,6 +919,33 @@
msgid "&Select"
msgstr "ÐÑбÑаÑÑ"
+msgid "&Ok"
+msgstr "&ÐалÑÑе"
+
+msgid "Databases"
+msgstr "Ð¤Ð°Ð¹Ð»Ñ Ð±Ð°Ð· даннÑÑ
"
+
+msgid "Graphics"
+msgstr "ÐÑаÑиÑеÑкие ÑайлÑ"
+
+msgid "Multimedia"
+msgstr "ÐÑлÑÑимедиа ÑайлÑ"
+
+msgid "Sources"
+msgstr "Ð¤Ð°Ð¹Ð»Ñ Ð¸ÑÑ
однÑÑ
ÑекÑÑов"
+
+msgid "Archives"
+msgstr "Ð¤Ð°Ð¹Ð»Ñ Ð°ÑÑ
ивов"
+
+msgid "Text/Doc Files"
+msgstr "ТекÑÑовÑе ÑÐ°Ð¹Ð»Ñ Ð¸ ÑÐ°Ð¹Ð»Ñ Ð´Ð¾ÐºÑменÑов"
+
+msgid "Temp Files"
+msgstr "ÐÑеменнÑе ÑайлÑ"
+
+msgid " File highlighting "
+msgstr " ÐодÑвеÑка Ñайлов "
+
msgid "Use passive mode over pro&xy"
msgstr "ÐÑполÑзоваÑÑ Ð¿Ð°ÑÑивнÑй Ñежим ÑеÑез
пÑокÑи"
@@ -2379,6 +2406,9 @@
msgid "&Display bits..."
msgstr "&ÐиÑÑ Ñимволов..."
+msgid "file &Highlighting..."
+msgstr "Ð&одÑвеÑка Ñайлов..."
+
msgid "learn &Keys..."
msgstr "&РаÑпознавание клавиÑ..."
@@ -2504,8 +2534,9 @@
msgid ""
" Help: helpnormal, helpitalic, helpbold, helplink, helpslink\n"
-" File types: directory, executable, link, stalelink, device, special, "
-"core\n"
+" File types: directory, executable, link, stalelink, device, special,\n"
+" core, hidden, temp, doc, archive, source, media, graph,\n"
+" database\n"
"\n"
"Colors:\n"
" black, gray, red, brightred, green, brightgreen, brown,\n"
diff -urN mc-4.7.0-pre2-orig/src/boxes.c mc-4.7.0-pre2/src/boxes.c
--- mc-4.7.0-pre2-orig/src/boxes.c 2009-08-13 00:05:16.000000000 +0300
+++ mc-4.7.0-pre2/src/boxes.c 2009-08-31 14:53:19.000000000 +0300
@@ -662,6 +662,71 @@
#endif /* HAVE_CHARSET */
+/*
+* File highlighting setup dialog
+*/
+#define FILEHLY 20
+#define FILEHLX 56
+
+static char *ret_ftmp;
+static char *ret_fdoc;
+static char *ret_farch;
+static char *ret_fsrc;
+static char *ret_fmedia;
+static char *ret_fgraph;
+static char *ret_fdbase;
+
+static QuickWidget filehl_widgets [] = {
+{ quick_button, 30, FILEHLX, FILEHLY - 3, FILEHLY, N_("&Cancel"), 0,
B_CANCEL, 0, 0, "button-cancel" },
+{ quick_button, 12, FILEHLX, FILEHLY - 3, FILEHLY, N_("&Ok"), 0, B_ENTER, 0,
0, "button-ok" },
+{ quick_input, 4, FILEHLX, 15, FILEHLY, "", 48, 0, 0, &ret_fdbase,
"input-ft-dbase"},
+{ quick_label, 4, FILEHLX, 14, FILEHLY, N_("Databases"), 0, 0, 0, 0,
"label-ft-dbase" },
+{ quick_input, 4, FILEHLX, 13, FILEHLY, "", 48, 0, 0, &ret_fgraph,
"input-ft-graph"},
+{ quick_label, 4, FILEHLX, 12, FILEHLY, N_("Graphics"), 0, 0, 0, 0,
"label-ft-graph" },
+{ quick_input, 4, FILEHLX, 11, FILEHLY, "", 48, 0, 0, &ret_fmedia,
"input-ft-media" },
+{ quick_label, 4, FILEHLX, 10, FILEHLY, N_("Multimedia"), 0, 0, 0, 0,
"label-ft-media" },
+{ quick_input, 4, FILEHLX, 9, FILEHLY, "", 48, 0, 0, &ret_fsrc,
"input-ft-src" },
+{ quick_label, 4, FILEHLX, 8, FILEHLY, N_("Sources"), 0, 0, 0, 0,
"label-ft-src" },
+{ quick_input, 4, FILEHLX, 7, FILEHLY, "", 48, 0, 0, &ret_farch,
"input-ft-arch" },
+{ quick_label, 4, FILEHLX, 6, FILEHLY, N_("Archives"), 0, 0, 0, 0,
"label-ft-arch" },
+{ quick_input, 4, FILEHLX, 5, FILEHLY, "", 48, 0, 0, &ret_fdoc,
"input-ft-doc" },
+{ quick_label, 4, FILEHLX, 4, FILEHLY, N_("Text/Doc Files"), 0, 0, 0,
0, "label-ft-doc" },
+{ quick_input, 4, FILEHLX, 3, FILEHLY, "", 48, 0, 0, &ret_ftmp,
"input-ft-tmp" },
+{ quick_label, 4, FILEHLX, 2, FILEHLY, N_("Temp Files"), 0, 0, 0, 0,
"label-ft-tmp" },
+{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+};
+
+static QuickDialog filehl_dlg =
+{ FILEHLX, FILEHLY, -1, -1, N_(" File highlighting "), "[File highlighting]",
filehl_widgets, 0 };
+
+void file_highlighting_box (void)
+{
+ filehl_widgets [2].text = file_types.fdbase;
+ filehl_widgets [4].text = file_types.fgraph;
+ filehl_widgets [6].text = file_types.fmedia;
+ filehl_widgets [8].text = file_types.fsrc;
+ filehl_widgets [10].text = file_types.farch;
+ filehl_widgets [12].text = file_types.fdoc;
+ filehl_widgets [14].text = file_types.ftmp;
+
+ if (quick_dialog (&filehl_dlg) != B_CANCEL) {
+ g_free(file_types.ftmp);
+ file_types.ftmp = ret_ftmp;
+ g_free(file_types.fdoc);
+ file_types.fdoc = ret_fdoc;
+ g_free(file_types.farch);
+ file_types.farch = ret_farch;
+ g_free(file_types.fsrc);
+ file_types.fsrc = ret_fsrc;
+ g_free(file_types.fmedia);
+ file_types.fmedia = ret_fmedia;
+ g_free(file_types.fgraph);
+ file_types.fgraph = ret_fgraph;
+ g_free(file_types.fdbase);
+ file_types.fdbase = ret_fdbase;
+ }
+}
+//end File highlighting setup dialog
#define TREE_Y 20
#define TREE_X 60
diff -urN mc-4.7.0-pre2-orig/src/boxes.h mc-4.7.0-pre2/src/boxes.h
--- mc-4.7.0-pre2-orig/src/boxes.h 2009-06-16 00:18:21.000000000 +0300
+++ mc-4.7.0-pre2/src/boxes.h 2009-08-31 14:54:04.000000000 +0300
@@ -15,6 +15,7 @@
int *case_sensitive, int *exec_first);
void confirm_box (void);
void display_bits_box (void);
+void file_highlighting_box (void);
void configure_vfs (void);
void jobs_cmd (void);
char *cd_dialog (void);
diff -urN mc-4.7.0-pre2-orig/src/main.c mc-4.7.0-pre2/src/main.c
--- mc-4.7.0-pre2-orig/src/main.c 2009-08-25 21:51:56.000000000 +0300
+++ mc-4.7.0-pre2/src/main.c 2009-08-31 15:09:32.000000000 +0300
@@ -782,6 +782,7 @@
{' ', N_("c&Onfirmation..."), NULL_HOTKEY, confirm_box},
{' ', N_("&Display bits..."), NULL_HOTKEY, display_bits_box},
{' ', N_("learn &Keys..."), NULL_HOTKEY, learn_keys},
+ {' ', N_("file &Highlighting..."), NULL_HOTKEY, file_highlighting_box},
#ifdef USE_VFS
{' ', N_("&Virtual FS..."), NULL_HOTKEY, configure_vfs},
#endif /* !USE_VFS */
@@ -1379,6 +1380,15 @@
}
done_screen ();
vfs_add_current_stamps ();
+
+ /* Free file highlighting variables */
+ g_free(file_types.ftmp);
+ g_free(file_types.fdoc);
+ g_free(file_types.farch);
+ g_free(file_types.fsrc);
+ g_free(file_types.fmedia);
+ g_free(file_types.fgraph);
+ g_free(file_types.fdbase);
}
/* This should be called after destroy_dlg since panel widgets
@@ -1861,7 +1871,9 @@
fputs (_
(
" Help: helpnormal, helpitalic, helpbold, helplink,
helpslink\n"
- " File types: directory, executable, link, stalelink, device,
special, core\n"
+ " File types: directory, executable, link, stalelink, device,
special,\n"
+ " core, hidden, temp, doc, archive, source, media,
graph,\n"
+ " database\n"
"\n" "Colors:\n"
" black, gray, red, brightred, green, brightgreen, brown,\n"
" yellow, blue, brightblue, magenta, brightmagenta, cyan,\n"
diff -urN mc-4.7.0-pre2-orig/src/screen.c mc-4.7.0-pre2/src/screen.c
--- mc-4.7.0-pre2-orig/src/screen.c 2009-08-23 23:17:14.000000000 +0300
+++ mc-4.7.0-pre2/src/screen.c 2009-08-31 15:27:18.000000000 +0300
@@ -104,6 +104,9 @@
/* The hook list for the select file function */
Hook *select_file_hook = 0;
+/* File Types for file highlighting */
+struct file_types_t file_types;
+
static cb_ret_t panel_callback (Widget *, widget_msg_t msg, int parm);
static int panel_event (Gpm_Event *event, void *);
static void paint_frame (WPanel *panel);
@@ -453,24 +456,71 @@
};
static int
+is_file_type(char *extension, char *file_type)
+{
+ char *ft;
+ char *buf;
+ char *ext;
+
+/* skip empty file types */
+ if (!file_type || !*file_type)
+ return 0;
+
+ buf = ft = g_strdup(file_type);
+ while (buf)
+ {
+ ext =
+#if defined(SUNOS) || defined(SOLARIS) || defined(SUNOS41x) ||
defined(SUNOS5x)
+ sunos_get_token(&buf, ",");
+#else
+ strsep(&buf, ",");
+#endif
+ if (!strcasecmp(extension, ext))
+ {
+ g_free(ft);
+ return 1;
+ }
+ }
+ g_free(ft);
+ return 0;
+}
+
+static int
file_compute_color (int attr, file_entry *fe)
{
+ int color;
+
switch (attr) {
case SELECTED:
- return (SELECTED_COLOR);
+ color = SELECTED_COLOR;
+ break;
case MARKED:
- return (MARKED_COLOR);
+ color = MARKED_COLOR;
+ break;
case MARKED_SELECTED:
- return (MARKED_SELECTED_COLOR);
+ color = MARKED_SELECTED_COLOR;
+ break;
case STATUS:
- return (NORMAL_COLOR);
+ color = NORMAL_COLOR;
+ break;
case NORMAL:
default:
- if (!filetype_mode)
- return (NORMAL_COLOR);
+ color = file_entry_color(fe);
}
+ return color;
+}
+
+int
+file_entry_color (file_entry *fe)
+{
+ char *ext = extension(fe->fname);
+ if (filetype_mode)
+ {
/* if filetype_mode == true */
+ if (fe->fname[0]=='.' && strcmp(fe->fname, ".."))
+ return (HIDDEN_COLOR);
+ else
if (S_ISDIR (fe->st.st_mode))
return (DIRECTORY_COLOR);
else if (S_ISLNK (fe->st.st_mode)) {
@@ -499,10 +549,44 @@
else if (fe->fname && (!strcmp (fe->fname, "core")
|| !strcmp (extension (fe->fname), "core")))
return (CORE_COLOR);
-
+ else
+ { /* file-extentions groups colorizing */
+ int tmpi;
+ char *new_ext = g_malloc(strlen(ext)+3);
+ for(tmpi=0;tmpi <= strlen(ext);tmpi++)
+ new_ext[tmpi] = tolower(ext[tmpi]);
+
+ if (is_file_type(new_ext, file_types.ftmp)) {
+ g_free(new_ext);
+ return (TEMP_COLOR);
+ } else if (is_file_type(new_ext, file_types.fdoc)) {
+ g_free(new_ext);
+ return (DOC_COLOR);
+ } else if (is_file_type(new_ext, file_types.farch)) {
+ g_free(new_ext);
+ return (ARCH_COLOR);
+ } else if (is_file_type(new_ext, file_types.fsrc)) {
+ g_free(new_ext);
+ return (SRC_COLOR);
+ } else if (is_file_type(new_ext, file_types.fmedia)) {
+ g_free(new_ext);
+ return (MEDIA_COLOR);
+ } else if (is_file_type(new_ext, file_types.fgraph)) {
+ g_free(new_ext);
+ return (GRAPH_COLOR);
+ } else if (is_file_type(new_ext, file_types.fdbase)) {
+ g_free(new_ext);
+ return (DBASE_COLOR);
+ }
+ g_free(new_ext);
+ }
return (NORMAL_COLOR);
+ }
+ return (NORMAL_COLOR);
+
}
+
/* Formats the file number file_index of panel in the buffer dest */
static void
format_file (char *dest, int limit, WPanel *panel, int file_index, int width,
int attr, int isstatus)
diff -urN mc-4.7.0-pre2-orig/src/setup.c mc-4.7.0-pre2/src/setup.c
--- mc-4.7.0-pre2-orig/src/setup.c 2009-08-25 21:51:56.000000000 +0300
+++ mc-4.7.0-pre2/src/setup.c 2009-08-31 15:58:35.000000000 +0300
@@ -47,6 +47,8 @@
#include "menu.h" /* menubar_visible declaration */
#include "cmd.h"
#include "file.h" /* safe_delete */
+#include "tty/color.h"
+
#ifdef USE_VFS
#include "../vfs/gc.h"
@@ -390,6 +392,16 @@
ftpfs_proxy_host);
#endif /* USE_VFS && USE_NETCODE */
+ /* Save file highlighting info */
+ mc_config_set_string(mc_main_config, "File Types", "temp",
file_types.ftmp);
+ mc_config_set_string(mc_main_config, "File Types", "doc", file_types.fdoc);
+ mc_config_set_string(mc_main_config, "File Types", "archive",
file_types.farch);
+ mc_config_set_string(mc_main_config, "File Types", "source",
file_types.fsrc);
+ mc_config_set_string(mc_main_config, "File Types", "media",
file_types.fmedia);
+ mc_config_set_string(mc_main_config, "File Types", "graphics",
file_types.fgraph);
+ mc_config_set_string(mc_main_config, "File Types", "database",
file_types.fdbase);
+
+
#ifdef HAVE_CHARSET
mc_config_set_string(mc_main_config, "Misc" , "display_codepage",
get_codepage_id( display_codepage ));
@@ -652,6 +664,22 @@
term_color_string = mc_config_get_string(mc_main_config, "Colors", getenv
("TERM"), "");
color_terminal_string = mc_config_get_string(mc_main_config, "Colors",
"color_terminals", "");
+ /* Load file highlighting info */
+ file_types.ftmp = mc_config_get_string(mc_main_config, "File Types",
"temp",
+ "tmp,$$$,~,bak");
+ file_types.fdoc = mc_config_get_string(mc_main_config, "File Types",
"doc",
+
"txt,doc,rtf,diz,ctl,me,ps,pdf,xml,xsd,xslt,dtd,html,shtml,htm,mail,msg,lsm,po,nroff,man,tex,sgml,css,text,letter");
+ file_types.farch = mc_config_get_string(mc_main_config, "File Types",
"archive",
+
"gz,bz2,tar,tgz,rpm,Z,rar,zip,arj,cab,lzh,lha,zoo,arc,ark");
+ file_types.fsrc = mc_config_get_string(mc_main_config, "File Types",
"source",
+
"c,h,cc,hh,cpp,hpp,asm,py,pl,pm,inc,cgi,php,phps,js,java,jav,jasm,sh,bash,diff,patch,pas,tcl,tk,awk,m4,st,mak,sl,ada,caml,ml,mli,mly,mll,mlp,sas,prg");
+ file_types.fmedia = mc_config_get_string(mc_main_config, "File Types",
"media",
+
"mp2,mp3,mpg,ogg,mpeg,wav,avi,asf,mov,mol,mpl,xm,mod,it,med,mid,midi,s3m,umx");
+ file_types.fgraph = mc_config_get_string(mc_main_config, "File Types",
"graphics",
+
"jpg,jpeg,gif,png,tif,pcx,bmp,xpm,xbm,eps,pic,rle,ico,wmf,omf,ai,cdr");
+ file_types.fdbase = mc_config_get_string(mc_main_config, "File Types",
"database",
+
"dbf,mdn,db,mdb,dat,fox,dbx,mdx,sql,mssql,msql,ssql,pgsql,xls,cdx,dbi");
+
/* Load the directory history */
/* directory_history_load (); */
/* Remove the temporal entries */
diff -urN mc-4.7.0-pre2-orig/src/tty/color.h mc-4.7.0-pre2/src/tty/color.h
--- mc-4.7.0-pre2-orig/src/tty/color.h 2009-08-13 00:05:16.000000000 +0300
+++ mc-4.7.0-pre2/src/tty/color.h 2009-08-31 15:57:19.000000000 +0300
@@ -57,9 +57,18 @@
#define SPECIAL_COLOR IF_COLOR (28, 0)
#define CORE_COLOR IF_COLOR (29, 0)
+/* colors for specific files */
+#define HIDDEN_COLOR IF_COLOR (30, 0)
+#define TEMP_COLOR IF_COLOR (31, 0)
+#define DOC_COLOR IF_COLOR (32, 0)
+#define ARCH_COLOR IF_COLOR (33, 0)
+#define SRC_COLOR IF_COLOR (34, 0)
+#define MEDIA_COLOR IF_COLOR (35, 0)
+#define GRAPH_COLOR IF_COLOR (36, 0)
+#define DBASE_COLOR IF_COLOR (37, 0)
/* For the default color any unused index may be chosen. */
-#define DEFAULT_COLOR_INDEX 30
+#define DEFAULT_COLOR_INDEX 38
#define DEFAULT_COLOR IF_COLOR (DEFAULT_COLOR_INDEX, 0)
/*
@@ -67,18 +76,31 @@
* respectively
* Last is defined to view color.
*/
-#define EDITOR_NORMAL_COLOR_INDEX 34
+#define EDITOR_NORMAL_COLOR_INDEX 42
#define EDITOR_NORMAL_COLOR IF_COLOR (EDITOR_NORMAL_COLOR_INDEX, 0)
-#define EDITOR_BOLD_COLOR IF_COLOR (35, A_BOLD)
-#define EDITOR_MARKED_COLOR IF_COLOR (36, A_REVERSE)
-#define EDITOR_WHITESPACE_COLOR IF_COLOR (37, 0 /* irrelevant */)
+#define EDITOR_BOLD_COLOR IF_COLOR (43, A_BOLD)
+#define EDITOR_MARKED_COLOR IF_COLOR (44, A_REVERSE)
+#define EDITOR_WHITESPACE_COLOR IF_COLOR (45, 0 /* irrelevant */)
/* color of left 8 char status per line */
-#define LINE_STATE_COLOR IF_COLOR (38, 0)
+#define LINE_STATE_COLOR IF_COLOR (46, 0)
/* Error dialog colors */
-#define ERROR_HOT_NORMAL IF_COLOR (39, 0)
-#define ERROR_HOT_FOCUS IF_COLOR (40, 0)
+#define ERROR_HOT_NORMAL IF_COLOR (47, 0)
+#define ERROR_HOT_FOCUS IF_COLOR (48, 0)
+
+/* File Types for file highlighting */
+struct file_types_t {
+ char *ftmp;
+ char *fdoc;
+ char *farch;
+ char *fsrc;
+ char *fmedia;
+ char *fgraph;
+ char *fdbase;
+};
+
+extern struct file_types_t file_types;
void tty_init_colors (gboolean disable, gboolean force);
void tty_colors_done (void);
diff -urN mc-4.7.0-pre2-orig/src/tty/color-internal.c
mc-4.7.0-pre2/src/tty/color-internal.c
--- mc-4.7.0-pre2-orig/src/tty/color-internal.c 2009-08-13 00:05:16.000000000
+0300
+++ mc-4.7.0-pre2/src/tty/color-internal.c 2009-08-31 15:00:03.000000000
+0300
@@ -88,20 +88,31 @@
{ "special=", 0, 0 }, /* sockets, fifo */
{ "core=", 0, 0 }, /* core files */ /* 29 */
- { 0, 0, 0 }, /* not usable (DEFAULT_COLOR_INDEX) *//* 30 */
+ /* colors for specific file types */
+
+ { "hidden=", 0, 0 }, /* hidden files *//*30*/
+ { "temp=", 0, 0 }, /* temp file type *//*31*/
+ { "doc=", 0, 0 }, /* doc file type *//*32*/
+ { "archive=", 0, 0 }, /* archive file type *//*33*/
+ { "source=", 0, 0 }, /* sources file type *//*34*/
+ { "media=", 0, 0 }, /* multimedia file type *//*35*/
+ { "graph=", 0, 0 }, /* graphics file type *//*36*/
+ { "database=", 0, 0 }, /* database file type *//*37*/
+
+ { 0, 0, 0 }, /* not usable (DEFAULT_COLOR_INDEX) *//* 38 */
{ 0, 0, 0 }, /* unused */
{ 0, 0, 0 }, /* not usable (A_REVERSE) */
{ 0, 0, 0 }, /* not usable (A_REVERSE_BOLD) */
- /* editor colors start at 34 */
- { "editnormal=", 0, 0 }, /* normal */ /* 34 */
+ /* editor colors start at 42 */
+ { "editnormal=", 0, 0 }, /* normal */ /* 42 */
{ "editbold=", 0, 0 }, /* search->found */
{ "editmarked=", 0, 0 }, /* marked/selected */
{ "editwhitespace=", 0, 0 }, /* whitespace */
{ "editlinestate=", 0, 0 }, /* line number bar*/
- /* error dialog colors start at 39 */
- { "errdhotnormal=", 0, 0 }, /* Error dialog normal/hot */ /* 38 */
+ /* error dialog colors start at 47 */
+ { "errdhotnormal=", 0, 0 }, /* Error dialog normal/hot */ /* 47 */
{ "errdhotfocus=", 0, 0 }, /* Error dialog focused/hot */
};
diff -urN mc-4.7.0-pre2-orig/src/tty/color-internal.h
mc-4.7.0-pre2/src/tty/color-internal.h
--- mc-4.7.0-pre2-orig/src/tty/color-internal.h 2009-08-25 21:51:56.000000000
+0300
+++ mc-4.7.0-pre2/src/tty/color-internal.h 2009-08-31 15:57:29.000000000
+0300
@@ -83,6 +83,14 @@
"device=brightmagenta,blue:"
"core=red,blue:"
"special=black,blue:"
+ "hidden=black,blue:"
+ "temp=gray,blue:"
+ "doc=brown,blue:"
+ "archive=brightmagenta,blue:"
+ "source=cyan,blue:"
+ "media=green,blue:"
+ "graph=brightcyan,blue:"
+ "database=brightred,blue:"
"editnormal=lightgray,blue:"
"editbold=yellow,blue:"
"editmarked=black,cyan:"
diff -urN mc-4.7.0-pre2-orig/src/tty/color-ncurses.h
mc-4.7.0-pre2/src/tty/color-ncurses.h
--- mc-4.7.0-pre2-orig/src/tty/color-ncurses.h 2009-08-13 00:05:16.000000000
+0300
+++ mc-4.7.0-pre2/src/tty/color-ncurses.h 2009-08-31 15:01:38.000000000
+0300
@@ -10,7 +10,7 @@
gboolean tty_use_colors ();
-#define MAX_PAIRS 64
+#define MAX_PAIRS 84
extern int attr_pairs [MAX_PAIRS];
#define MY_COLOR_PAIR(x) (COLOR_PAIR (x) | attr_pairs [x])
_______________________________________________
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel