mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
Merge branch '380_skins'
* 380_skins: Added new installed files into mc.spec.in Added Russian and English docs for skins. Add octets into array of lines instread of utf-8 string. Reidentation of code and changes for compile with CFLAGS="-pedantic -Wall -Wextra -Werror -Wno-long-long" Continue development of skins continue develop of skins. Add handle '-b' command line option. Box lines drawing. Now reading from skins. With ncurses don't work! Add hardcoded skins. Base support of skins.
This commit is contained in:
commit
b5c2386551
@ -556,12 +556,14 @@ contrib/dist/pkginfo
|
||||
contrib/dist/prototype
|
||||
|
||||
misc/Makefile
|
||||
misc/skins/Makefile
|
||||
misc/mc.ext
|
||||
|
||||
src/Makefile
|
||||
src/filehighlight/Makefile
|
||||
src/mcconfig/Makefile
|
||||
src/search/Makefile
|
||||
src/skin/Makefile
|
||||
src/tty/Makefile
|
||||
src/viewer/Makefile
|
||||
|
||||
|
1
contrib/dist/redhat/mc.spec.in
vendored
1
contrib/dist/redhat/mc.spec.in
vendored
@ -150,6 +150,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%dir %{_datadir}/mc
|
||||
%{_datadir}/mc/*
|
||||
%{_datadir}/mc/skins/*
|
||||
|
||||
%dir %{_libexecdir}/mc
|
||||
|
||||
|
376
doc/man/mc.1.in
376
doc/man/mc.1.in
@ -36,6 +36,14 @@ Colors
|
||||
.\"Colors"
|
||||
section.
|
||||
.TP
|
||||
.I \-S arg
|
||||
Specify a name of skin in the command line. Technology of skins is
|
||||
documented in the
|
||||
.\"LINK2"
|
||||
Skins\&.
|
||||
.\"Skins"
|
||||
section.
|
||||
.TP
|
||||
.I \-d, \-\-nomouse
|
||||
Disable mouse support.
|
||||
.TP
|
||||
@ -253,7 +261,7 @@ Thus C\-f would be: hold the Control key and type f.
|
||||
.B Alt\-<chr>
|
||||
means hold the Meta or Alt key down while typing <chr>.
|
||||
If there is no Meta or Alt key, type
|
||||
.IR ESC ,
|
||||
.IR ESC ,
|
||||
release it, then type the character <chr>.
|
||||
.TP
|
||||
.B S\-<chr>
|
||||
@ -299,7 +307,7 @@ the input lines in the query dialogs.
|
||||
.\"NODE " Miscellaneous Keys"
|
||||
.SH " Miscellaneous Keys"
|
||||
Here are some keys which don't fall into any of the other categories:
|
||||
.TP
|
||||
.TP
|
||||
.B Enter
|
||||
if there is some text in the command line (the one at the bottom of
|
||||
the panels), then that command is executed. If there is no text in the
|
||||
@ -324,7 +332,7 @@ run the
|
||||
Chmod
|
||||
.\"Chmod"
|
||||
command on a file or on the tagged files.
|
||||
.TP
|
||||
.TP
|
||||
.B C\-x o
|
||||
run the
|
||||
.\"LINK2"
|
||||
@ -407,14 +415,14 @@ selection bar moves from the old current panel to the new current
|
||||
panel.
|
||||
.TP
|
||||
.B Insert
|
||||
to tag files you may use the Insert key (the kich1 terminfo sequence).
|
||||
to tag files you may use the Insert key (the kich1 terminfo sequence).
|
||||
To untag files, just retag a tagged file.
|
||||
.TP
|
||||
.B C\-t
|
||||
to change charset of panel you may use C\-t (Control\-t).
|
||||
Recoding is made from selected codepage into system codepage. To
|
||||
cancel the recoding you may select "directory up" (..) in active panel.
|
||||
To cancel the charsets in all directories, select "No translation " in
|
||||
To cancel the charsets in all directories, select "No translation " in
|
||||
the dialog of encodings.
|
||||
.TP
|
||||
.B Alt\-g, Alt\-r, Alt\-j
|
||||
@ -978,7 +986,7 @@ if the use_internal_edit option is on.
|
||||
.PP
|
||||
Press F5 to pop up an input dialog to copy the currently selected file (or
|
||||
the tagged files, if there is at least one file tagged) to the
|
||||
directory/filename you specify in the input dialog. The destination
|
||||
directory/filename you specify in the input dialog. The destination
|
||||
defaults to the directory in the non\-selected panel. During this
|
||||
process, you can press C\-c or ESC to abort the operation. For details
|
||||
about source mask (which will be usually either * or ^\\(.*\\)$ depending
|
||||
@ -1033,7 +1041,7 @@ confusion that can be caused by hard links.
|
||||
.PP
|
||||
Press F6 to pop up an input dialog to copy the currently selected file (or
|
||||
the tagged files, if there is at least one file tagged) to the
|
||||
directory/filename you specify in the input dialog. The destination
|
||||
directory/filename you specify in the input dialog. The destination
|
||||
defaults to the directory in the non\-selected panel. For more details
|
||||
look at Copy (F5) operation above, most of the things are quite similar.
|
||||
.PP
|
||||
@ -1853,7 +1861,6 @@ according to rules described in /etc/mc/filehighlight.ini file. See
|
||||
Filenames Highlight
|
||||
.\"Filenames Highlight"
|
||||
for more info.
|
||||
|
||||
.PP
|
||||
If the
|
||||
.I Show Mini\-Status
|
||||
@ -1956,7 +1963,7 @@ a valid e\-mail address. On the other hand, you probably don't want to
|
||||
give your real e\-mail address to untrusted sites, especially if you are
|
||||
not using spam filtering.
|
||||
.PP
|
||||
ftpfs keeps the directory listing it fetches from a FTP server in a cache.
|
||||
ftpfs keeps the directory listing it fetches from a FTP server in a cache.
|
||||
The cache expire time is configurable with the
|
||||
.I ftpfs directory cache timeout
|
||||
option. A low value for this option may slow down every operation on
|
||||
@ -2358,7 +2365,7 @@ directory or whether would you like to copy their content.
|
||||
.PP
|
||||
determines the behavior when the source directory is about to be copied,
|
||||
but the target directory already exists. The default action is to copy
|
||||
the contents of the source directory into the target directory.
|
||||
the contents of the source directory into the target directory.
|
||||
Enabling this option causes copying the source directory itself into the
|
||||
target directory.
|
||||
.PP
|
||||
@ -2586,7 +2593,7 @@ Extension File Edit section
|
||||
.\"NODE "Internal File Editor"
|
||||
.SH "Internal File Editor"
|
||||
The internal file editor is a full\-featured full screen editor. It can
|
||||
edit files up to 64 megabytes. It is possible to edit binary files.
|
||||
edit files up to 64 megabytes. It is possible to edit binary files.
|
||||
The internal file editor is invoked using
|
||||
.B F4
|
||||
if the
|
||||
@ -3101,7 +3108,7 @@ The colors are optional, and the keywords are: normal, selected, marked,
|
||||
markselect, errors, input, reverse, gauge. Menu colors are: menu,
|
||||
menusel, menuhot, menuhotsel. Dialog colors are: dnormal, dfocus,
|
||||
dhotnormal, dhotfocus. Help colors are: helpnormal, helpitalic,
|
||||
helpbold, helplink, helpslink. Viewer color is: viewunderline. Editor
|
||||
helpbold, helplink, helpslink. Viewer color is: viewunderline. Editor
|
||||
colors are: editnormal, editbold, editmarked.
|
||||
.PP
|
||||
.I input
|
||||
@ -3150,13 +3157,347 @@ used for background color. Example:
|
||||
base_color=normal=white,default:marked=magenta,default
|
||||
.fi
|
||||
|
||||
.\"NODE "Skins"
|
||||
.SH "Skins"
|
||||
You can change the appearance of Midhight Commander.
|
||||
To do this, you must specify a file that contain descriptions of colors
|
||||
and lines to draw boxes. Redefining of the colors is entirely compatible
|
||||
with the assignment of colors, as described in Section
|
||||
.\"LINK2"
|
||||
Colors\&.
|
||||
.\"Colors"
|
||||
.PP
|
||||
A skin\-file is searched on the following algorithm (to the first one found):
|
||||
.IP
|
||||
.br
|
||||
1) command line option
|
||||
.BR \-S
|
||||
.BR \<skin\>
|
||||
or
|
||||
.BR \-\-skin=\<skin\>
|
||||
.br
|
||||
2) Environment variable
|
||||
.BR MC_SKIN
|
||||
.br
|
||||
3) In config file parameter
|
||||
.BR skin
|
||||
in section
|
||||
.BR \[Midhight
|
||||
.BR Commander\]
|
||||
.br
|
||||
4) File
|
||||
.BR /etc/mc/skins/default.ini
|
||||
.br
|
||||
5) File
|
||||
.BR @prefix@/share/mc/skins/default.ini
|
||||
|
||||
.PP
|
||||
Command line option, environment variable and parameter in config file may
|
||||
contain the absolute path to the skin\-file (with the extension \.ini
|
||||
or without it). Search of skin\-file will occur in (to the first one found):
|
||||
.IP
|
||||
1)
|
||||
.BR ~/.mc/skins/
|
||||
.br
|
||||
2)
|
||||
.BR /etc/mc/skins/
|
||||
.br
|
||||
3)
|
||||
.BR @prefix@/share/mc/skins/
|
||||
.br
|
||||
|
||||
.PP
|
||||
For getting extended info, refer to:
|
||||
.IP
|
||||
.\"LINK2"
|
||||
Description of section and parameters
|
||||
.\"Skins sections"
|
||||
.br
|
||||
.\"LINK2"
|
||||
Color pair definitions
|
||||
.\"Skins colors"
|
||||
.br
|
||||
.\"LINK2"
|
||||
Draw lines
|
||||
.\"Skins lines"
|
||||
.br
|
||||
.\"LINK2"
|
||||
Compability
|
||||
.\"Skins oldcolors"
|
||||
.br
|
||||
|
||||
.\"NODE " Skins sections"
|
||||
.SH " Description of section and parameters"
|
||||
|
||||
Section
|
||||
.BR [skin]
|
||||
contain metainfo for skin\-file. Paramter
|
||||
.I description
|
||||
contain short text about skin.
|
||||
|
||||
.PP
|
||||
Section
|
||||
.BR [filehighlight]
|
||||
contain descriptions of color pairs for filenames highlighting.
|
||||
Name of parameters must be equal to names of sections into
|
||||
filehighlight.ini file.
|
||||
See
|
||||
.\"LINK2"
|
||||
Filenames Highlight
|
||||
.\"Filenames Highlight"
|
||||
for getting more info.
|
||||
|
||||
.PP
|
||||
Section
|
||||
.BR [core]
|
||||
describes the elements that are used everywhere.
|
||||
.TP
|
||||
.I _default_
|
||||
Default color pair. Used in all other sections if they not contain
|
||||
color definitions
|
||||
.TP
|
||||
.I selected
|
||||
cursor
|
||||
.TP
|
||||
.I marked
|
||||
selected data
|
||||
.TP
|
||||
.I markselect
|
||||
cursor on selected data
|
||||
.TP
|
||||
.I gauge
|
||||
color of the filled part of the progress bar
|
||||
.TP
|
||||
.I input
|
||||
color of input lines used in query dialogs.
|
||||
.TP
|
||||
.I reverse
|
||||
reverse color
|
||||
|
||||
.PP
|
||||
Section
|
||||
.BR [dialog]
|
||||
describes the elements that are placed on dialog windows (except error dialogs).
|
||||
.TP
|
||||
.I _default_
|
||||
Default color for this section. Used [core]._default_ if not specified
|
||||
.TP
|
||||
.I dfocus
|
||||
Color of active element (in focus)
|
||||
.TP
|
||||
.I dhotnormal
|
||||
Color of hotkeys
|
||||
.TP
|
||||
.I dhotfocus
|
||||
Color of hotkeys in focused element
|
||||
|
||||
.PP
|
||||
Section
|
||||
.BR [error]
|
||||
describes the elements that are placed on error dialog windows
|
||||
.TP
|
||||
.I _default_
|
||||
Default color for this section. Used [core]._default_ if not specified
|
||||
.TP
|
||||
.I errdhotnormal
|
||||
Color of hotkeys
|
||||
.TP
|
||||
.I errdhotfocus
|
||||
Color of hotkeys in focused element
|
||||
|
||||
.PP
|
||||
Section
|
||||
.BR [menu]
|
||||
describes the elements that are placed on menu. This section describes
|
||||
system menu (called by F9) and user-defined menus (called by F2 in panels
|
||||
and by F11 in editor).
|
||||
.TP
|
||||
.I _default_
|
||||
Default color for this section. Used [core]._default_ if not specified
|
||||
.TP
|
||||
.I entry
|
||||
Color of menu items
|
||||
.TP
|
||||
.I menuhot
|
||||
Color of menu hotkeys
|
||||
.TP
|
||||
.I menusel
|
||||
Color of active menu item (in focus)
|
||||
.TP
|
||||
.I menuhotsel
|
||||
Color of menu hotkeys in focused menu item
|
||||
|
||||
.PP
|
||||
Section
|
||||
.BR [help]
|
||||
describes the elements that are placed on help window.
|
||||
.TP
|
||||
.I _default_
|
||||
Default color for this section. Used [core]._default_ if not specified
|
||||
.TP
|
||||
.I helpitalic
|
||||
Color pair for element with
|
||||
.BR italic
|
||||
attribute
|
||||
.TP
|
||||
.I helpbold
|
||||
Color pair for element with
|
||||
.BR bold
|
||||
attribute
|
||||
.TP
|
||||
.I helplink
|
||||
Color of links
|
||||
.TP
|
||||
.I helpslink
|
||||
Color of active link (on focus)
|
||||
|
||||
.PP
|
||||
Section
|
||||
.BR [editor]
|
||||
describes the colors of elements plased in editor.
|
||||
.TP
|
||||
.I _default_
|
||||
Default color for this section. Used [core]._default_ if not specified
|
||||
.TP
|
||||
.I editbold
|
||||
Color pair for element with
|
||||
.BR bold
|
||||
attribute
|
||||
.TP
|
||||
.I editmarked
|
||||
Color of selected text
|
||||
.TP
|
||||
.I editwhitespace
|
||||
Color of tabs and trailing spaces highlighting
|
||||
.TP
|
||||
.I linestate
|
||||
Color for line state area
|
||||
|
||||
.PP
|
||||
Section
|
||||
.BR [viewer]
|
||||
describes the colors of elements plased in viewer.
|
||||
.TP
|
||||
.I viewunderline
|
||||
Color pair for element with
|
||||
.BR underline
|
||||
attribute
|
||||
|
||||
.\"NODE " Skins colors"
|
||||
.SH " Color pair definitions"
|
||||
Any parameter in skin\-file contain definition of color pair.
|
||||
.PP
|
||||
Color pairs described as two color separated by ';'. First color
|
||||
sets the foreground color, second color sets background color.
|
||||
One of the colors may be omitted, in this case color will be
|
||||
taken from default color pair (global color pair or
|
||||
from default color pair of this section).
|
||||
.PP
|
||||
Example:
|
||||
.br
|
||||
.nf
|
||||
[core]
|
||||
# green on black
|
||||
_default_=green;black
|
||||
# green(default) on blue
|
||||
selected=;blue
|
||||
# yellow on black(default)
|
||||
marked=yellow;
|
||||
.fi
|
||||
|
||||
.PP
|
||||
Possible colors (names) described in
|
||||
.\"LINK2"
|
||||
Colors\&.
|
||||
.\"Colors"
|
||||
section.
|
||||
|
||||
.\"NODE " Skins lines"
|
||||
.SH " Draw lines"
|
||||
Lines sets in section
|
||||
.BR [Lines]
|
||||
into skin\-file. By default used single lines, but you may redefine
|
||||
to usage of any utf\-8 symbols (like to lines, for example).
|
||||
.PP
|
||||
.I WARNING!!!
|
||||
When you build Midnight Commander with the Ncurses screen library
|
||||
usage of drawing lines is limited!
|
||||
Possible only drawing a single lines.
|
||||
For all questions and comments please contact the developers of Ncurses.
|
||||
|
||||
.PP
|
||||
Descriptions of parameters
|
||||
.BR [Lines] :
|
||||
.TP
|
||||
.I lefttop
|
||||
left-top line fragment.
|
||||
.TP
|
||||
.I righttop
|
||||
right-top line fragment.
|
||||
.TP
|
||||
.I centertop
|
||||
down branch of horizontal line
|
||||
.TP
|
||||
.I centerbottom
|
||||
up branch of horizontal line
|
||||
.TP
|
||||
.I leftbottom
|
||||
left-bottom line fragment
|
||||
.TP
|
||||
.I rightbottom
|
||||
right-bottom line fragment
|
||||
.TP
|
||||
.I leftmiddle
|
||||
right branch of vertical line
|
||||
.TP
|
||||
.I rightmiddle
|
||||
left branch of vertical line
|
||||
.TP
|
||||
.I centermiddle
|
||||
cross of lines
|
||||
.TP
|
||||
.I horiz
|
||||
horizontal line
|
||||
.TP
|
||||
.I vert
|
||||
vertical line
|
||||
.TP
|
||||
.I thinhoriz
|
||||
thin horizontal line
|
||||
.TP
|
||||
.I thinvert
|
||||
thin vertical line
|
||||
|
||||
|
||||
.\"NODE " Skins oldcolors"
|
||||
.SH " Compability"
|
||||
|
||||
Appointment of color by skin\-files fully compatible with
|
||||
the appointment of the colors described in
|
||||
.\"LINK2"
|
||||
Colors\&.
|
||||
.\"Colors"
|
||||
section.
|
||||
.PP
|
||||
In this case, reassignment of colors has priority over the skin files and is
|
||||
complementary.
|
||||
|
||||
.\"NODE "Filenames Highlight"
|
||||
.SH "Filenames Highlight"
|
||||
Rules of filenames highlight placed in /etc/mc/filehighlight.ini file.
|
||||
Section [filehighlight] from current skin\-file contain key names as
|
||||
highlight groups and values as color pairs. Color pairs is documented
|
||||
into
|
||||
.\"LINK2"
|
||||
Skins
|
||||
.\"Skins"
|
||||
section.
|
||||
.PP
|
||||
Main section [filehighlight] contain key names as highlight groups and values as color pairs.
|
||||
Color pairs described as 'foreground;background'. 'background' may be omited.
|
||||
Other sections describe filegroup of highlight. Keys in these groups:
|
||||
Rules of filenames highlight placed in /etc/mc/filehighlight.ini file
|
||||
(~/.mc/filehighlight.ini).
|
||||
Name of section in this file must be equal to parameters names into
|
||||
[filehighlight] section (in current skin\-file)
|
||||
.PP
|
||||
Keys in these groups:
|
||||
.TP
|
||||
.I type
|
||||
file type. if present, all other option ignored
|
||||
@ -3185,6 +3526,7 @@ list of extensions of files. Separated by ';' sign.
|
||||
\- SPECIAL_FIFO
|
||||
\- SPECIAL_DOOR
|
||||
.fi
|
||||
.PP
|
||||
|
||||
.\"NODE "Special Settings"
|
||||
.SH "Special Settings"
|
||||
@ -3327,7 +3669,7 @@ insert=\\e[Op
|
||||
.fi
|
||||
|
||||
.PP
|
||||
Also now you can use
|
||||
Also now you can use
|
||||
.I extended learn keys.
|
||||
For example:
|
||||
|
||||
|
@ -40,6 +40,13 @@ UNIX\-подобных операционных системах.
|
||||
Цвета\&.
|
||||
.\"Colors"
|
||||
.TP
|
||||
.I \-S arg
|
||||
Используется для того, чтобы задать другой скин в командной
|
||||
строке. Технология скинов описана в разделе
|
||||
.\"LINK2"
|
||||
Внешний вид\&.
|
||||
.\"Skins"
|
||||
.TP
|
||||
.I \-d
|
||||
Отключает поддержку мыши.
|
||||
.TP
|
||||
@ -2003,13 +2010,13 @@ Commander. Вы можете вывести на экран или отмени
|
||||
.\"Listing Mode..."
|
||||
показывающие права пользователя, запустившего программу Midnight
|
||||
Commander, выделены цветом, определенным ключевым словом
|
||||
.I selected
|
||||
(смотрите раздел
|
||||
.I selected.
|
||||
Если разрешено, подсветка имён файлов производится на основании
|
||||
правил из файла /etc/mc/filehighlight.ini. Смотрите
|
||||
.\"LINK2"
|
||||
Цвета\&).
|
||||
.\"Colors"
|
||||
Если включено выделение цветом типов файлов, то разными цветами
|
||||
выделяются каталоги, дампы памяти (файлы core), исполняемые файлы и т.д.
|
||||
Подсветка имён файлов
|
||||
.\"Filenames Highlight"
|
||||
для получения большей информации.
|
||||
.PP
|
||||
При включенной опции
|
||||
.IR Линейка меню
|
||||
@ -3449,28 +3456,6 @@ editmarked.
|
||||
.I helpslink
|
||||
\- для выделения активной в данный момент гиперссылки.
|
||||
.PP
|
||||
Специальные цвета подсветки используются для отображения имен файлов
|
||||
разных типов и выделения цветом прав доступа (если выделение цветом этих
|
||||
элементов задано в настройках программы, смотрите раздел
|
||||
.\"LINK2"
|
||||
Внешний вид\&):
|
||||
.\"Layout"
|
||||
.I directory
|
||||
используется для каталогов и символических ссылок на каталоги;
|
||||
.I executable
|
||||
\- для исполняемых файлов;
|
||||
.I link
|
||||
\- для символических ссылок, которые указывает НЕ на каталоги или
|
||||
оборванные (stale) символические ссылки;
|
||||
.I stalelink
|
||||
\- для оборванных (stale) символических ссылок;
|
||||
.I device
|
||||
\- для файлов устройств;
|
||||
.I special
|
||||
\- для специальных файлов типа FIFO и IPC sockets;
|
||||
.I core
|
||||
\- для файлов с дампами (core).
|
||||
.PP
|
||||
Возможные цвета: black, gray, red, brightred, green, brightgreen, brown,
|
||||
yellow, blue, brightblue, magenta, brightmagenta, cyan, brightcyan,
|
||||
lightgray и white.
|
||||
@ -3483,6 +3468,373 @@ lightgray и white.
|
||||
[Colors]
|
||||
base_color=normal=white,default:marked=magenta,default
|
||||
.fi
|
||||
|
||||
.\"NODE "Skins"
|
||||
.SH "Внешний вид"
|
||||
Вы можете изменить внешний вид Midhight Commander'а. Для этого необходимо
|
||||
указать файл, в котором указаны цвета и линии для отрисовки рамок. Такой
|
||||
файл называется далее скин\-файл. переопределение внешнего вида полностью
|
||||
совместимо с заданием цветов, описанным в секции
|
||||
.\"LINK2"
|
||||
Цвета\&.
|
||||
.\"Colors"
|
||||
.PP
|
||||
|
||||
Поиск скин\-файла производится по следующему алгоритму (до
|
||||
первого нахождения файла):
|
||||
.IP
|
||||
.br
|
||||
1) параметр командной строки
|
||||
.BR \-S
|
||||
.BR \<скин\>
|
||||
или
|
||||
.BR \-\-skin=\<скин\>
|
||||
.br
|
||||
2) Переменная окружения
|
||||
.BR MC_SKIN
|
||||
.br
|
||||
3) В конфигурационном файле параметр
|
||||
.BR skin
|
||||
в секции
|
||||
.BR \[Midhight
|
||||
.BR Commander\]
|
||||
.br
|
||||
4) Файл
|
||||
.BR /etc/mc/skins/default.ini
|
||||
.br
|
||||
5) Файл
|
||||
.BR @prefix@/share/mc/skins/default.ini
|
||||
|
||||
.PP
|
||||
Параметры в трёх первых случаях могут содержать абсолютный путь к скин\-файлу
|
||||
либо просто название скина (с расширением \.ini либо без него). В данном
|
||||
случае поиск скин\-файла будет происходить по следующим каталогам (до первого
|
||||
нахождения):
|
||||
.IP
|
||||
1)
|
||||
.BR ~/.mc/skins/
|
||||
.br
|
||||
2)
|
||||
.BR /etc/mc/skins/
|
||||
.br
|
||||
3)
|
||||
.BR @prefix@/share/mc/skins/
|
||||
.br
|
||||
|
||||
.PP
|
||||
Для получения расширенной информации, обратитесь к подразделам:
|
||||
|
||||
.IP
|
||||
.\"LINK2"
|
||||
Описание секций и параметров
|
||||
.\"Skins sections"
|
||||
.br
|
||||
.\"LINK2"
|
||||
Опеределения цветовых пар
|
||||
.\"Skins colors"
|
||||
.br
|
||||
.\"LINK2"
|
||||
Линии для отрисовки рамок
|
||||
.\"Skins lines"
|
||||
.br
|
||||
.\"LINK2"
|
||||
Совместимость
|
||||
.\"Skins oldcolors"
|
||||
.br
|
||||
|
||||
.\"NODE " Skins sections"
|
||||
.SH " Описание секций"
|
||||
|
||||
Секция
|
||||
.BR [skin]
|
||||
содержит информацию, относящуюся к самому скин\-файлу. Параметр
|
||||
.I description
|
||||
кратко описывает скин.
|
||||
|
||||
|
||||
.PP
|
||||
Секция
|
||||
.BR [filehighlight]
|
||||
содержит описания цветовых пар для групп подсветок имен файлов.
|
||||
Названия параметров в секции должно совпадать с названиями секций в файле подсветки.
|
||||
Смотрите раздел
|
||||
.\"LINK2"
|
||||
Подсветка имён файлов
|
||||
.\"Filenames Highlight"
|
||||
для получения подробной информации.
|
||||
|
||||
.PP
|
||||
Секция
|
||||
.BR [core]
|
||||
содержит описание элементов, используемых повсеместно.
|
||||
.TP
|
||||
.I _default_
|
||||
Цвет по умолчанию. Используется во всех остальных секциях (глобальный параметр), если в них нет переопределения
|
||||
.TP
|
||||
.I selected
|
||||
курсор
|
||||
.TP
|
||||
.I marked
|
||||
отмеченные данные
|
||||
.TP
|
||||
.I markselect
|
||||
курсор на отмеченных данных
|
||||
.TP
|
||||
.I gauge
|
||||
цвет заполненной части полоски (progress bar)
|
||||
.TP
|
||||
.I input
|
||||
элемент ввода данных
|
||||
.TP
|
||||
.I reverse
|
||||
инвертированный цвет
|
||||
|
||||
|
||||
.PP
|
||||
Секция
|
||||
.BR [dialog]
|
||||
содержит описания элементов диалоговых окон (кроме сообщений об ошибках).
|
||||
.TP
|
||||
.I _default_
|
||||
Цвет по умолчанию для данной секции. Если не указан, то используется [core]._default_
|
||||
.TP
|
||||
.I dfocus
|
||||
Цвет элемента, находящегося в фокусе
|
||||
.TP
|
||||
.I dhotnormal
|
||||
Цвет хоткеев
|
||||
.TP
|
||||
.I dhotfocus
|
||||
Цвет хоткеев, находящихся в фокусе
|
||||
|
||||
.PP
|
||||
Секция
|
||||
.BR [error]
|
||||
содержит описания элементов диалога об ошибках.
|
||||
.TP
|
||||
.I _default_
|
||||
Цвет по умолчанию для данной секции. Если не указан, то используется [core]._default_
|
||||
.TP
|
||||
.I errdhotnormal
|
||||
Цвет хоткеев
|
||||
.TP
|
||||
.I errdhotfocus
|
||||
Цвет хоткеев, находящихся в фокусе
|
||||
|
||||
.PP
|
||||
Секция
|
||||
.BR [menu]
|
||||
содержит описание элементов, отображающихся в меню. Это касается как системного меню
|
||||
(вызываемого клавишей F9), так и пользовательских меню (F2 в панелях или F11 в редакторе).
|
||||
.TP
|
||||
.I _default_
|
||||
Цвет по умолчанию для данной секции. Если не указан, то используется [core]._default_
|
||||
.TP
|
||||
.I entry
|
||||
Цвет пунктов меню
|
||||
.TP
|
||||
.I menuhot
|
||||
Цвет хоткеев
|
||||
.TP
|
||||
.I menusel
|
||||
Цвет выделенного пункта меню
|
||||
.TP
|
||||
.I menuhotsel
|
||||
Цвет хоткеев, находящихся в фокусе
|
||||
|
||||
.PP
|
||||
Секция
|
||||
.BR [help]
|
||||
содержит описания цветов для окна отображения помощи.
|
||||
.TP
|
||||
.I _default_
|
||||
Цвет по умолчанию для данной секции. Если не указан, то используется [core]._default_
|
||||
.TP
|
||||
.I helpitalic
|
||||
Цветовыделение элементов с атрибутом
|
||||
.BR italic
|
||||
.TP
|
||||
.I helpbold
|
||||
Цветовыделение элементов с атрибутом
|
||||
.BR bold
|
||||
.TP
|
||||
.I helplink
|
||||
Цвет ссылок
|
||||
.TP
|
||||
.I helpslink
|
||||
Цвет ссылки, находящейся под курсором
|
||||
|
||||
.PP
|
||||
Секция
|
||||
.BR [editor]
|
||||
содержит описания элементов редактора
|
||||
.TP
|
||||
.I _default_
|
||||
Цвет по умолчанию для данной секции. Если не указан, то используется [core]._default_
|
||||
.TP
|
||||
.I editbold
|
||||
Цветовыделение элементов с атрибутом
|
||||
.BR bold
|
||||
.TP
|
||||
.I editmarked
|
||||
Цвет выделенного текста
|
||||
.TP
|
||||
.I editwhitespace
|
||||
Подсветка знаков табуляции и "висящих" пробелов
|
||||
.TP
|
||||
.I linestate
|
||||
Цвет области отображения состояния строки.
|
||||
|
||||
|
||||
.PP
|
||||
Секция
|
||||
.BR [viewer]
|
||||
содержит описания элементов редактора
|
||||
.TP
|
||||
.I viewunderline
|
||||
Цветовыделение элементов с атрибутом
|
||||
.BR underline
|
||||
|
||||
|
||||
.\"NODE " Skins colors"
|
||||
.SH " Цветовые пары"
|
||||
Каждый параметр в скин\-файле содержит цветовые пары
|
||||
.PP
|
||||
Цветовые пары описываются как два цвета, разделённых символом ';'
|
||||
первый цвет задаёт цвет написания символов, второй \- цвет фона.
|
||||
Один из цветов может быть пропущен, в этом случае будет взят цвет
|
||||
по умолчанию (глобальный или для данной секции).
|
||||
.PP
|
||||
Например:
|
||||
.br
|
||||
.nf
|
||||
[core]
|
||||
# зелёным по чёрному
|
||||
_default_=green;black
|
||||
# зелёным (умолч.) по синему
|
||||
selected=;blue
|
||||
# жёлтым по чёрному(умолч.)
|
||||
marked=yellow;
|
||||
.fi
|
||||
|
||||
.PP
|
||||
Возможные цвета (названия) описаны в секции
|
||||
.\"LINK2"
|
||||
Цвета\&.
|
||||
.\"Colors"
|
||||
|
||||
|
||||
.\"NODE " Skins lines"
|
||||
.SH " Линии для отрисовки рамок"
|
||||
Линии задаются в секции
|
||||
.BR [Lines]
|
||||
в скин\-файле. По умолчанию используются одинарные линии, но возможно
|
||||
переназначить на использование любых utf\-8 символов, похожих на линии
|
||||
.PP
|
||||
.I ВНИМАНИЕ!!!
|
||||
При сборке Midnight Commander с библиотекой Ncurses использование
|
||||
линий ограничено! Возможна только отрисовка одинарных линий. По всем
|
||||
вопросам и предложениям обращайтесь к разработчикам Ncurses.
|
||||
|
||||
.PP
|
||||
Описание параметров секции
|
||||
.BR [Lines] :
|
||||
.TP
|
||||
.I lefttop
|
||||
изображение левого верхнего угла рамки
|
||||
.TP
|
||||
.I righttop
|
||||
изображение правого верхнего угла рамки
|
||||
.TP
|
||||
.I centertop
|
||||
изображение ответвления горизонтальной линии вниз
|
||||
.TP
|
||||
.I centerbottom
|
||||
изображение ответвления горизонтальной линии вверх
|
||||
.TP
|
||||
.I leftbottom
|
||||
изображение левого нижнего угла рамки
|
||||
.TP
|
||||
.I rightbottom
|
||||
изображение правого нижнего угла рамки
|
||||
.TP
|
||||
.I leftmiddle
|
||||
изображение ответвления вертикальной линии вправо
|
||||
.TP
|
||||
.I rightmiddle
|
||||
изображение ответвления вертикальной линии влево
|
||||
.TP
|
||||
.I centermiddle
|
||||
изображение пересечения вертикальной и горизонтальной линий
|
||||
.TP
|
||||
.I horiz
|
||||
изображение горизонтальной линии
|
||||
.TP
|
||||
.I vert
|
||||
изображение вертикальной линии
|
||||
.TP
|
||||
.I thinhoriz
|
||||
изображение тонкой горизонтальной линии
|
||||
.TP
|
||||
.I thinvert
|
||||
изображение тонкой вертикальной линии
|
||||
|
||||
|
||||
.\"NODE " Skins oldcolors"
|
||||
.SH " Совместимость"
|
||||
Назначение цветов элементов посредством скин\-файлов полностью совместимо
|
||||
с назначением цветов, описанном в секции
|
||||
.\"LINK2"
|
||||
Цвета\&.
|
||||
.\"Colors"
|
||||
.PP
|
||||
В данном случае переназначение цветов имеет приоритет над скин-файлами и носит
|
||||
дополняющий характер.
|
||||
|
||||
|
||||
.\"NODE "Filenames Highlight"
|
||||
.SH "Подсветка имён файлов"
|
||||
Секция [filehighlight] из текущего скин\-файла содержит имена параметров
|
||||
(в качестве групп подсветки) и значения параметров как цветовые пары.
|
||||
Описания цветовых пар смотрите в разделе
|
||||
.\"LINK2"
|
||||
Внешний вид
|
||||
.\"Skins"
|
||||
.PP
|
||||
Правила подсветки находятся в файле /etc/mc/filehighlight.ini
|
||||
(~/.mc/filehighlight.ini).
|
||||
Названия групп должны совпадать с названиями параметров в секции
|
||||
[filehighlight] в текущем скин\-файле.
|
||||
.PP
|
||||
Ключи в группах могут принимать следующие значения:
|
||||
.TP
|
||||
.I type
|
||||
Тип файла. Если параметр присутствует, остальные опции игнорируются
|
||||
.TP
|
||||
.I regexp
|
||||
Регулярное выражение. Если присутствует, параметр 'extensions' игнорируется.
|
||||
.TP
|
||||
.I extensions
|
||||
Список расширений файлов. Раасширения разделяются символом ';'.
|
||||
.PP
|
||||
Параметр 'type' (тип файла) может принимать значения:
|
||||
.nf
|
||||
\- FILE (все файлы)
|
||||
\- FILE_EXE
|
||||
\- DIR (все каталоги)
|
||||
\- LINK_DIR
|
||||
\- LINK (все ссылки (линки), исключая "битые" линки)
|
||||
\- HARDLINK
|
||||
\- SYMLINK
|
||||
\- STALE_LINK
|
||||
\- DEVICE (все файлы устройств)
|
||||
\- DEVICE_BLOCK
|
||||
\- DEVICE_CHAR
|
||||
\- SPECIAL (все специальные файлы)
|
||||
\- SPECIAL_SOCKET
|
||||
\- SPECIAL_FIFO
|
||||
\- SPECIAL_DOOR
|
||||
.fi
|
||||
.\"NODE "Special Settings"
|
||||
.SH "Специальные установки (Special Settings)"
|
||||
Большинство установок Midnight Commander может быть изменено путем
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "../src/global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h" /* INPUT_COLOR */
|
||||
#include "../src/skin/skin.h" /* INPUT_COLOR */
|
||||
#include "../src/tty/key.h"
|
||||
|
||||
#include "../src/search/search.h"
|
||||
|
@ -46,7 +46,7 @@
|
||||
#define MAX_LINE_LEN 1024
|
||||
|
||||
#include "../src/tty/tty.h" /* tty_printf() */
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/key.h" /* is_idle() */
|
||||
|
||||
#include "../src/widget.h" /* buttonbar_redraw() */
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
#include "../src/search/search.h" /* search engine */
|
||||
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
|
||||
#include "edit-impl.h"
|
||||
#include "edit-widget.h"
|
||||
@ -504,7 +504,7 @@ void edit_get_syntax_color (WEdit * edit, long byte_index, int *color)
|
||||
option_syntax_highlighting && tty_use_colors ()) {
|
||||
translate_rule_to_color (edit, edit_get_rule (edit, byte_index), color);
|
||||
} else {
|
||||
*color = tty_use_colors () ? EDITOR_NORMAL_COLOR_INDEX : 0;
|
||||
*color = tty_use_colors () ? mc_skin_color_get("editor", "_default_") : 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1024,6 +1024,7 @@ void edit_free_syntax_rules (WEdit * edit)
|
||||
}
|
||||
|
||||
MC_PTR_FREE (edit->rules);
|
||||
tty_color_free_all_tmp();
|
||||
}
|
||||
|
||||
/* returns -1 on file error, line number on error in file syntax */
|
||||
|
@ -1,5 +1,7 @@
|
||||
## Process this file with automake to create Makefile.in.
|
||||
|
||||
SUBDIRS = skins
|
||||
|
||||
LIBFILES_OUT = mc.ext
|
||||
|
||||
noinst_DATA = xterm.ad
|
||||
|
@ -1,31 +1,15 @@
|
||||
[filehighlight]
|
||||
directory=white;
|
||||
executable=brightgreen;
|
||||
stalelink=brightred;
|
||||
symlink=lightgray;
|
||||
device=brightmagenta;
|
||||
special=black;
|
||||
core=red;
|
||||
|
||||
temp=gray;
|
||||
archive=brightmagenta;
|
||||
doc=brown;
|
||||
source=cyan;
|
||||
media=green;
|
||||
graph=brightcyan;
|
||||
database=brightred;
|
||||
|
||||
[executable]
|
||||
type=FILE_EXE
|
||||
|
||||
[directory]
|
||||
type=DIR
|
||||
|
||||
[stalelink]
|
||||
type=STALE_LINK
|
||||
|
||||
[symlink]
|
||||
type=SYMLINK
|
||||
|
||||
[stalelink]
|
||||
type=STALE_LINK
|
||||
|
||||
[device]
|
||||
type=DEVICE
|
||||
@ -43,9 +27,6 @@
|
||||
[archive]
|
||||
extensions=gz;bz2;tar;tgz;rpm;Z;rar;zip;arj;cab;lzh;lha;zoo;arc;ark;xz;tbz;tbz2;
|
||||
|
||||
[hidden]
|
||||
regexp=^\\..*
|
||||
|
||||
[doc]
|
||||
extensions=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;chm
|
||||
|
||||
|
6
misc/skins/Makefile.am
Normal file
6
misc/skins/Makefile.am
Normal file
@ -0,0 +1,6 @@
|
||||
skindir = $(pkgdatadir)/skins
|
||||
|
||||
skin_DATA = \
|
||||
default.ini \
|
||||
double-lines.ini
|
||||
|
78
misc/skins/default.ini
Normal file
78
misc/skins/default.ini
Normal file
@ -0,0 +1,78 @@
|
||||
[skin]
|
||||
description=Standart skin
|
||||
|
||||
[Lines]
|
||||
lefttop=┌
|
||||
righttop=┐
|
||||
centertop=─
|
||||
centerbottom=─
|
||||
leftbottom=└
|
||||
rightbottom=┘
|
||||
leftmiddle=├
|
||||
rightmiddle=┤
|
||||
centermiddle=┼
|
||||
horiz=─
|
||||
vert=│
|
||||
thinhoriz=─
|
||||
thinvert=│
|
||||
|
||||
[core]
|
||||
_default_=lightgray;blue
|
||||
selected=black;cyan
|
||||
marked=yellow;blue
|
||||
markselect=yellow;cyan;
|
||||
gauge=white;black
|
||||
input=black;cyan
|
||||
reverse=black;lightgray
|
||||
|
||||
[dialog]
|
||||
_default_=black;lightgray
|
||||
dfocus=black;cyan
|
||||
dhotnormal=blue;lightgray
|
||||
dhotfocus=blue;cyan
|
||||
|
||||
[error]
|
||||
_default_=white;red
|
||||
errdhotnormal=yellow;red
|
||||
errdhotfocus=yellow;lightgray
|
||||
|
||||
|
||||
[filehighlight]
|
||||
directory=white;
|
||||
executable=brightgreen;
|
||||
symlink=lightgray;
|
||||
stalelink=brightred;
|
||||
device=brightmagenta;
|
||||
special=black;
|
||||
core=red;
|
||||
temp=gray;
|
||||
archive=brightmagenta;
|
||||
doc=brown;
|
||||
source=cyan;
|
||||
media=green;
|
||||
graph=brightcyan;
|
||||
database=brightred;
|
||||
|
||||
[menu]
|
||||
_default_=white;cyan
|
||||
entry=white;cyan
|
||||
menuhot=yellow;cyan
|
||||
menusel=white;black
|
||||
menuhotsel=yellow;black
|
||||
|
||||
[help]
|
||||
_default_=black;lightgray
|
||||
helpitalic=red;lightgray
|
||||
helpbold=blue;lightgray
|
||||
helplink=black;cyan
|
||||
helpslink=yellow;blue
|
||||
|
||||
[editor]
|
||||
_default_=lightgray;blue
|
||||
editbold=yellow;blue
|
||||
editmarked=black;cyan
|
||||
editwhitespace=brightblue;blue
|
||||
linestate=white;cyan
|
||||
|
||||
[viewer]
|
||||
viewunderline=brightred;blue
|
78
misc/skins/double-lines.ini
Normal file
78
misc/skins/double-lines.ini
Normal file
@ -0,0 +1,78 @@
|
||||
[skin]
|
||||
description=Far-like skin
|
||||
|
||||
[Lines]
|
||||
lefttop=╔
|
||||
righttop=╗
|
||||
centertop=╤
|
||||
centerbottom=╧
|
||||
leftbottom=╚
|
||||
rightbottom=╝
|
||||
leftmiddle=╟
|
||||
rightmiddle=╢
|
||||
centermiddle=┼
|
||||
horiz=═
|
||||
vert=║
|
||||
thinhoriz=─
|
||||
thinvert=│
|
||||
|
||||
[core]
|
||||
_default_=lightgray;blue
|
||||
selected=black;cyan
|
||||
marked=yellow;blue
|
||||
markselect=yellow;cyan;
|
||||
gauge=white;black
|
||||
input=black;cyan
|
||||
reverse=black;lightgray
|
||||
|
||||
[dialog]
|
||||
_default_=black;lightgray
|
||||
dfocus=black;cyan
|
||||
dhotnormal=blue;lightgray
|
||||
dhotfocus=blue;cyan
|
||||
|
||||
[error]
|
||||
_default_=white;red
|
||||
errdhotnormal=yellow;red
|
||||
errdhotfocus=yellow;lightgray
|
||||
|
||||
|
||||
[filehighlight]
|
||||
directory=white;
|
||||
executable=brightgreen;
|
||||
symlink=lightgray;
|
||||
stalelink=brightred;
|
||||
device=brightmagenta;
|
||||
special=black;
|
||||
core=red;
|
||||
temp=gray;
|
||||
archive=brightmagenta;
|
||||
doc=brown;
|
||||
source=cyan;
|
||||
media=green;
|
||||
graph=brightcyan;
|
||||
database=brightred;
|
||||
|
||||
[menu]
|
||||
_default_=white;cyan
|
||||
entry=white;cyan
|
||||
menuhot=yellow;cyan
|
||||
menusel=white;black
|
||||
menuhotsel=yellow;black
|
||||
|
||||
[help]
|
||||
_default_=black;lightgray
|
||||
helpitalic=red;lightgray
|
||||
helpbold=blue;lightgray
|
||||
helplink=black;cyan
|
||||
helpslink=yellow;blue
|
||||
|
||||
[editor]
|
||||
_default_=lightgray;blue
|
||||
editbold=yellow;blue
|
||||
editmarked=black;cyan
|
||||
editwhitespace=brightblue;blue
|
||||
linestate=white;cyan
|
||||
|
||||
[viewer]
|
||||
viewunderline=brightred;blue
|
@ -1,4 +1,4 @@
|
||||
SUBDIRS = mcconfig search tty viewer filehighlight
|
||||
SUBDIRS = mcconfig search tty viewer filehighlight skin
|
||||
|
||||
AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) $(PCRE_CFLAGS)
|
||||
|
||||
@ -44,8 +44,9 @@ SEARCHLIB = search/libsearch.la
|
||||
TTYLIB = tty/libmctty.la
|
||||
VIEWERLIB = viewer/libmcviewer.la
|
||||
FILEHIGHLIGHTLIB=filehighlight/libmcfilehighlight.la
|
||||
SKINLIB = skin/libmcskin.la
|
||||
|
||||
mc_LDADD = $(EDITLIB) $(VFSLIB) $(FILEHIGHLIGHTLIB) \
|
||||
mc_LDADD = $(EDITLIB) $(VFSLIB) $(FILEHIGHLIGHTLIB) $(SKINLIB) \
|
||||
$(MCCONFIGLIB) $(SEARCHLIB) $(TTYLIB) $(VIEWERLIB) \
|
||||
$(INTLLIBS) $(MCLIBS) $(SLANGLIB) $(LIBICONV) $(GLIB_LIBS)
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/key.h" /* XCTRL and ALT macros */
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
|
||||
#include "dialog.h"
|
||||
#include "widget.h"
|
||||
|
10
src/args.c
10
src/args.c
@ -69,6 +69,9 @@ gboolean mc_args__disable_colors = FALSE;
|
||||
/* Force colors, only used by Slang */
|
||||
gboolean mc_args__force_colors = FALSE;
|
||||
|
||||
/* Show in specified skin */
|
||||
char *mc_args__skin = NULL;
|
||||
|
||||
char *mc_args__last_wd_file = NULL;
|
||||
|
||||
/* when enabled NETCODE, use folowing file as logfile */
|
||||
@ -246,6 +249,13 @@ static const GOptionEntry argument_color_table[] = {
|
||||
"<string>"
|
||||
},
|
||||
|
||||
{
|
||||
"skin", 'S', ARGS_COLOR_OPTIONS, G_OPTION_ARG_STRING,
|
||||
&mc_args__skin,
|
||||
N_("Show mc with specified skin"),
|
||||
"<string>"
|
||||
},
|
||||
|
||||
{NULL}
|
||||
};
|
||||
#undef ARGS_COLOR_OPTIONS
|
||||
|
@ -15,6 +15,7 @@ extern gboolean mc_args__slow_terminal;
|
||||
extern gboolean mc_args__ugly_line_drawing;
|
||||
extern gboolean mc_args__disable_colors;
|
||||
extern gboolean mc_args__force_colors;
|
||||
extern char *mc_args__skin;
|
||||
extern gboolean mc_args__version;
|
||||
extern char *mc_args__last_wd_file;
|
||||
extern char *mc_args__netfs_logfile;
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h" /* INPUT_COLOR */
|
||||
#include "../src/skin/skin.h" /* INPUT_COLOR */
|
||||
#include "../src/tty/key.h" /* XCTRL and ALT macros */
|
||||
|
||||
#include "../src/mcconfig/mcconfig.h" /* Load/save user formats */
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
|
||||
#include "dialog.h" /* add_widget() */
|
||||
#include "widget.h" /* NORMAL_BUTTON */
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
|
||||
#include "dialog.h"
|
||||
#include "widget.h"
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include "user.h" /* expand_format */
|
||||
#include "subshell.h" /* SUBSHELL_EXIT */
|
||||
#include "tree.h" /* for tree_chdir */
|
||||
#include "../src/tty/color.h" /* DEFAULT_COLOR */
|
||||
#include "../src/skin/skin.h" /* DEFAULT_COLOR */
|
||||
#include "execute.h" /* shell_execute */
|
||||
#include "../src/strescape.h"
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h" /* tty_set_normal_attrs */
|
||||
#include "../src/skin/skin.h" /* tty_set_normal_attrs */
|
||||
#include "../src/tty/win.h"
|
||||
|
||||
#include "cons.saver.h"
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/mouse.h"
|
||||
#include "../src/tty/key.h"
|
||||
|
||||
|
@ -89,7 +89,7 @@ mc_fhl_new (gboolean need_auto_fill)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!mc_fhl_parce_ini_file (fhl)) {
|
||||
if (!mc_fhl_parse_ini_file (fhl)) {
|
||||
mc_fhl_free (&fhl);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ void mc_fhl_free (mc_fhl_t **);
|
||||
int mc_fhl_get_color (mc_fhl_t *, file_entry *);
|
||||
|
||||
gboolean mc_fhl_read_ini_file (mc_fhl_t *, const gchar *);
|
||||
gboolean mc_fhl_parce_ini_file (mc_fhl_t *);
|
||||
gboolean mc_fhl_parse_ini_file (mc_fhl_t *);
|
||||
void mc_fhl_clear (mc_fhl_t *);
|
||||
|
||||
#endif
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#include "../src/global.h"
|
||||
#include "../src/util.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/filehighlight/fhl.h"
|
||||
#include "internal.h"
|
||||
|
||||
@ -225,7 +225,6 @@ mc_fhl_get_color (mc_fhl_t * fhl, file_entry * fe)
|
||||
mc_fhl_filter_t *mc_filter;
|
||||
int ret;
|
||||
|
||||
|
||||
if (fhl == NULL)
|
||||
return NORMAL_COLOR;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
File highlight plugin.
|
||||
Reading and parce rules from ini-files
|
||||
Reading and parse rules from ini-files
|
||||
|
||||
Copyright (C) 2009 The Free Software Foundation, Inc.
|
||||
|
||||
@ -31,12 +31,14 @@
|
||||
#include "../src/global.h"
|
||||
#include "../src/main.h"
|
||||
#include "../src/strescape.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "fhl.h"
|
||||
#include "internal.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
extern mc_skin_t mc_skin__default;
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
@ -47,37 +49,16 @@
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
mc_fhl_parce_fill_color_info (mc_fhl_filter_t * mc_filter, mc_fhl_t * fhl, const gchar * group_name)
|
||||
mc_fhl_parse_fill_color_info (mc_fhl_filter_t * mc_filter, mc_fhl_t * fhl, const gchar * group_name)
|
||||
{
|
||||
gchar **colors;
|
||||
gsize colors_size;
|
||||
|
||||
colors = mc_config_get_string_list (fhl->config, "filehighlight", group_name, &colors_size);
|
||||
|
||||
if (colors == NULL)
|
||||
return;
|
||||
|
||||
if (colors[0] == NULL) {
|
||||
g_strfreev (colors);
|
||||
return;
|
||||
}
|
||||
|
||||
mc_filter->fgcolor = g_strdup (colors[0]);
|
||||
|
||||
if (colors[1] == NULL)
|
||||
mc_filter->bgcolor = NULL;
|
||||
else
|
||||
mc_filter->bgcolor = g_strdup (colors[1]);
|
||||
|
||||
g_strfreev (colors);
|
||||
|
||||
mc_filter->color_pair_index = tty_try_alloc_color_pair (mc_filter->fgcolor, mc_filter->bgcolor);
|
||||
(void) fhl;
|
||||
mc_filter->color_pair_index = mc_skin_color_get("filehighlight", group_name);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static gboolean
|
||||
mc_fhl_parce_get_file_type_id (mc_fhl_t * fhl, const gchar * group_name)
|
||||
mc_fhl_parse_get_file_type_id (mc_fhl_t * fhl, const gchar * group_name)
|
||||
{
|
||||
mc_fhl_filter_t *mc_filter;
|
||||
|
||||
@ -109,7 +90,7 @@ mc_fhl_parce_get_file_type_id (mc_fhl_t * fhl, const gchar * group_name)
|
||||
mc_filter = g_new0 (mc_fhl_filter_t, 1);
|
||||
mc_filter->type = MC_FLHGH_T_FTYPE;
|
||||
mc_filter->file_type = (mc_flhgh_ftype_type) i;
|
||||
mc_fhl_parce_fill_color_info (mc_filter, fhl, group_name);
|
||||
mc_fhl_parse_fill_color_info (mc_filter, fhl, group_name);
|
||||
|
||||
g_ptr_array_add (fhl->filters, (gpointer) mc_filter);
|
||||
return TRUE;
|
||||
@ -118,7 +99,7 @@ mc_fhl_parce_get_file_type_id (mc_fhl_t * fhl, const gchar * group_name)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static gboolean
|
||||
mc_fhl_parce_get_regexp (mc_fhl_t * fhl, const gchar * group_name)
|
||||
mc_fhl_parse_get_regexp (mc_fhl_t * fhl, const gchar * group_name)
|
||||
{
|
||||
mc_fhl_filter_t *mc_filter;
|
||||
gchar *regexp = mc_config_get_string (fhl->config, group_name, "regexp", "");
|
||||
@ -134,7 +115,7 @@ mc_fhl_parce_get_regexp (mc_fhl_t * fhl, const gchar * group_name)
|
||||
mc_filter->search_condition->is_case_sentitive = TRUE;
|
||||
mc_filter->search_condition->search_type = MC_SEARCH_T_REGEX;
|
||||
|
||||
mc_fhl_parce_fill_color_info (mc_filter, fhl, group_name);
|
||||
mc_fhl_parse_fill_color_info (mc_filter, fhl, group_name);
|
||||
g_ptr_array_add (fhl->filters, (gpointer) mc_filter);
|
||||
g_free (regexp);
|
||||
return TRUE;
|
||||
@ -144,7 +125,7 @@ mc_fhl_parce_get_regexp (mc_fhl_t * fhl, const gchar * group_name)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static gboolean
|
||||
mc_fhl_parce_get_extensions (mc_fhl_t * fhl, const gchar * group_name)
|
||||
mc_fhl_parse_get_extensions (mc_fhl_t * fhl, const gchar * group_name)
|
||||
{
|
||||
mc_fhl_filter_t *mc_filter;
|
||||
gchar **exts, **exts_orig;
|
||||
@ -184,7 +165,7 @@ mc_fhl_parce_get_extensions (mc_fhl_t * fhl, const gchar * group_name)
|
||||
mc_filter->search_condition->is_case_sentitive = TRUE;
|
||||
mc_filter->search_condition->search_type = MC_SEARCH_T_REGEX;
|
||||
|
||||
mc_fhl_parce_fill_color_info (mc_filter, fhl, group_name);
|
||||
mc_fhl_parse_fill_color_info (mc_filter, fhl, group_name);
|
||||
g_ptr_array_add (fhl->filters, (gpointer) mc_filter);
|
||||
g_string_free (buf, TRUE);
|
||||
return TRUE;
|
||||
@ -258,43 +239,36 @@ mc_fhl_init_from_standart_files (mc_fhl_t * fhl)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
mc_fhl_parce_ini_file (mc_fhl_t * fhl)
|
||||
mc_fhl_parse_ini_file (mc_fhl_t * fhl)
|
||||
{
|
||||
gchar **ftype_names, **orig_ftype_names;
|
||||
gchar **group_names, **orig_group_names;
|
||||
gsize ftype_names_size;
|
||||
|
||||
|
||||
mc_fhl_array_free (fhl);
|
||||
fhl->filters = g_ptr_array_new ();
|
||||
|
||||
if (!mc_config_has_group (fhl->config, "filehighlight"))
|
||||
return FALSE;
|
||||
orig_group_names = group_names =
|
||||
mc_config_get_groups (fhl->config, &ftype_names_size);
|
||||
|
||||
orig_ftype_names = ftype_names =
|
||||
mc_config_get_keys (fhl->config, "filehighlight", &ftype_names_size);
|
||||
if (group_names == NULL)
|
||||
return FALSE;
|
||||
|
||||
while (*ftype_names) {
|
||||
while (*group_names) {
|
||||
|
||||
if (!mc_config_has_group (fhl->config, *ftype_names)) {
|
||||
ftype_names++;
|
||||
continue;
|
||||
if (mc_config_has_param (fhl->config, *group_names, "type")) {
|
||||
/* parse filetype filter */
|
||||
mc_fhl_parse_get_file_type_id (fhl, *group_names);
|
||||
} else if (mc_config_has_param (fhl->config, *group_names, "regexp")) {
|
||||
/* parse regexp filter */
|
||||
mc_fhl_parse_get_regexp (fhl, *group_names);
|
||||
} else if (mc_config_has_param (fhl->config, *group_names, "extensions")) {
|
||||
/* parse extensions filter */
|
||||
mc_fhl_parse_get_extensions (fhl, *group_names);
|
||||
}
|
||||
|
||||
if (mc_config_has_param (fhl->config, *ftype_names, "type")) {
|
||||
/* parce filetype filter */
|
||||
mc_fhl_parce_get_file_type_id (fhl, *ftype_names);
|
||||
} else if (mc_config_has_param (fhl->config, *ftype_names, "regexp")) {
|
||||
/* parce regexp filter */
|
||||
mc_fhl_parce_get_regexp (fhl, *ftype_names);
|
||||
} else if (mc_config_has_param (fhl->config, *ftype_names, "extensions")) {
|
||||
/* parce extensions filter */
|
||||
mc_fhl_parce_get_extensions (fhl, *ftype_names);
|
||||
}
|
||||
|
||||
ftype_names++;
|
||||
group_names++;
|
||||
}
|
||||
|
||||
g_strfreev (orig_ftype_names);
|
||||
g_strfreev (orig_group_names);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/key.h"
|
||||
|
||||
#include "../src/search/search.h"
|
||||
|
@ -54,7 +54,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/mouse.h"
|
||||
#include "../src/tty/key.h"
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h" /* COLS */
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/key.h" /* KEY_M_CTRL */
|
||||
|
||||
#include "dialog.h"
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/key.h" /* is_idle() */
|
||||
#include "../src/tty/mouse.h" /* Gpm_Event */
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
|
||||
#include "dialog.h"
|
||||
#include "widget.h" /* default_proc*/
|
||||
|
@ -49,7 +49,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/key.h"
|
||||
#include "../src/tty/mouse.h"
|
||||
#include "../src/tty/win.h" /* do_enter_ca_mode() */
|
||||
|
25
src/main.c
25
src/main.c
@ -42,13 +42,14 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/mouse.h"
|
||||
#include "../src/tty/key.h" /* For init_key() */
|
||||
#include "../src/tty/win.h" /* xterm_flag */
|
||||
|
||||
#include "../src/mcconfig/mcconfig.h"
|
||||
#include "../src/args.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/filehighlight/fhl.h"
|
||||
|
||||
#include "dir.h"
|
||||
@ -1666,13 +1667,11 @@ mc_maybe_editor_or_viewer (void)
|
||||
static void
|
||||
do_nc (void)
|
||||
{
|
||||
const int midnight_colors[DLG_COLOR_NUM] =
|
||||
{
|
||||
NORMAL_COLOR, /* NORMALC */
|
||||
REVERSE_COLOR, /* FOCUSC */
|
||||
INPUT_COLOR, /* HOT_NORMALC */
|
||||
NORMAL_COLOR /* HOT_FOCUSC */
|
||||
};
|
||||
int midnight_colors[DLG_COLOR_NUM];
|
||||
midnight_colors[0] = mc_skin_color_get("dialog", "_default_");
|
||||
midnight_colors[1] = mc_skin_color_get("dialog", "focus");
|
||||
midnight_colors[2] = mc_skin_color_get("dialog", "hotnormal");
|
||||
midnight_colors[3] = mc_skin_color_get("dialog", "hotfocus");
|
||||
|
||||
midnight_dlg = create_dlg (0, 0, LINES, COLS, midnight_colors, midnight_callback,
|
||||
"[main]", NULL, DLG_WANT_IDLE);
|
||||
@ -1959,6 +1958,10 @@ main (int argc, char *argv[])
|
||||
load_setup ();
|
||||
|
||||
tty_init_colors (mc_args__disable_colors, mc_args__force_colors);
|
||||
|
||||
mc_skin_init();
|
||||
mc_filehighlight = mc_fhl_new (TRUE);
|
||||
|
||||
dlg_set_default_colors ();
|
||||
|
||||
/* create home directory */
|
||||
@ -1998,12 +2001,11 @@ main (int argc, char *argv[])
|
||||
#endif /* HAVE_SUBSHELL_SUPPORT */
|
||||
prompt = (geteuid () == 0) ? "# " : "$ ";
|
||||
|
||||
mc_filehighlight = mc_fhl_new (TRUE);
|
||||
|
||||
/* Program main loop */
|
||||
if (!midnight_shutdown)
|
||||
do_nc ();
|
||||
|
||||
mc_fhl_free (&mc_filehighlight);
|
||||
/* Save the tree store */
|
||||
tree_store_save ();
|
||||
|
||||
@ -2012,6 +2014,9 @@ main (int argc, char *argv[])
|
||||
|
||||
flush_extension_file (); /* does only free memory */
|
||||
|
||||
mc_fhl_free (&mc_filehighlight);
|
||||
mc_skin_deinit();
|
||||
|
||||
tty_shutdown ();
|
||||
|
||||
if (console_flag && !(quit & SUBSHELL_EXIT))
|
||||
|
@ -87,6 +87,7 @@ mc_config_get_string (mc_config_t * mc_config, const gchar * group,
|
||||
GIConv conv;
|
||||
GString *buffer;
|
||||
gchar *ret;
|
||||
const char *_system_codepage = str_detect_termencoding();
|
||||
|
||||
if (!mc_config || !group || !param)
|
||||
return def ? g_strdup (def) : NULL;
|
||||
@ -102,10 +103,10 @@ mc_config_get_string (mc_config_t * mc_config, const gchar * group,
|
||||
if (!ret)
|
||||
ret = def ? g_strdup (def) : NULL;
|
||||
|
||||
if (utf8_display)
|
||||
if (str_isutf8 (_system_codepage))
|
||||
return ret;
|
||||
|
||||
conv = str_crt_conv_from ("UTF-8");
|
||||
conv = g_iconv_open (_system_codepage, "UTF-8");
|
||||
if (conv == INVALID_CONV)
|
||||
return ret;
|
||||
|
||||
@ -126,6 +127,31 @@ mc_config_get_string (mc_config_t * mc_config, const gchar * group,
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
gchar *
|
||||
mc_config_get_string_raw (mc_config_t * mc_config, const gchar * group,
|
||||
const gchar * param, const gchar * def)
|
||||
{
|
||||
gchar *ret;
|
||||
|
||||
if (!mc_config || !group || !param)
|
||||
return def ? g_strdup (def) : NULL;
|
||||
|
||||
if (! mc_config_has_param(mc_config, group, param))
|
||||
{
|
||||
mc_config_set_string (mc_config, group, param, def ? def : "");
|
||||
return def ? g_strdup (def) : NULL;
|
||||
}
|
||||
|
||||
ret = g_key_file_get_string (mc_config->handle, group, param, NULL);
|
||||
|
||||
if (!ret)
|
||||
ret = def ? g_strdup (def) : NULL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
gboolean
|
||||
mc_config_get_bool (mc_config_t * mc_config, const gchar * group,
|
||||
const gchar * param, gboolean def)
|
||||
|
@ -49,6 +49,9 @@ gchar **mc_config_get_keys (mc_config_t *, const gchar *, gsize *);
|
||||
gchar *mc_config_get_string (mc_config_t *, const gchar *, const gchar *,
|
||||
const gchar *);
|
||||
|
||||
gchar *mc_config_get_string_raw (mc_config_t *, const gchar *, const gchar *,
|
||||
const gchar *);
|
||||
|
||||
gboolean mc_config_get_bool (mc_config_t *, const gchar *, const gchar *,
|
||||
gboolean);
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/mouse.h"
|
||||
#include "../src/tty/key.h" /* key macros */
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
|
||||
#include "dialog.h"
|
||||
#include "widget.h"
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/mouse.h" /* For Gpm_Event */
|
||||
#include "../src/tty/key.h" /* XCTRL and ALT macros */
|
||||
#include "../src/filehighlight/fhl.h"
|
||||
|
45
src/setup.c
45
src/setup.c
@ -552,48 +552,6 @@ setup__move_panels_config_into_separate_file(const char*profile)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
setup_srt_to_char (char* str)
|
||||
{
|
||||
int res = -1;
|
||||
|
||||
if (!str)
|
||||
return (int) ' ';
|
||||
res = g_utf8_get_char_validated (str, -1);
|
||||
|
||||
if ( res < 0 ) {
|
||||
return (int) *str;
|
||||
} else {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
static inline int
|
||||
setup_load_lines_frm(const char *name)
|
||||
{
|
||||
int ret;
|
||||
char *frm_val = NULL;
|
||||
frm_val = mc_config_get_string(mc_main_config, "Lines", name, " ");
|
||||
ret = setup_srt_to_char (frm_val);
|
||||
g_free (frm_val);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
setup_load_lines_tty(void)
|
||||
{
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_horiz] = setup_load_lines_frm("horiz");
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_vert] = setup_load_lines_frm("vert");
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_lefttop] = setup_load_lines_frm("lefttop");
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_righttop] = setup_load_lines_frm("righttop");
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_leftbottom] = setup_load_lines_frm("leftbottom");
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_rightbottom] = setup_load_lines_frm("rightbottom");
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_thinvert] = setup_load_lines_frm("thinvert");
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz] = setup_load_lines_frm("thinhoriz");
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_rightmiddle] = setup_load_lines_frm("rightmiddle");
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_leftmiddle] = setup_load_lines_frm("leftmiddle");
|
||||
}
|
||||
|
||||
char *
|
||||
setup_init (void)
|
||||
{
|
||||
@ -724,9 +682,6 @@ load_setup (void)
|
||||
if ( get_codepage_id( display_codepage ) )
|
||||
utf8_display = str_isutf8 (get_codepage_id( display_codepage ));
|
||||
#endif /* HAVE_CHARSET */
|
||||
|
||||
if (!mc_args__ugly_line_drawing)
|
||||
setup_load_lines_tty();
|
||||
}
|
||||
|
||||
#if defined(USE_VFS) && defined (USE_NETCODE)
|
||||
|
17
src/skin/Makefile.am
Normal file
17
src/skin/Makefile.am
Normal file
@ -0,0 +1,17 @@
|
||||
noinst_LTLIBRARIES = libmcskin.la
|
||||
|
||||
libmcskin_la_SOURCES = \
|
||||
colors.c \
|
||||
colors-old.c \
|
||||
common.c \
|
||||
hc-skins.c \
|
||||
ini-file.c \
|
||||
lines.c \
|
||||
skin.h \
|
||||
internal.h
|
||||
|
||||
libmcskin_la_CFLAGS=-I../ -I$(top_srcdir)/src \
|
||||
$(GLIB_CFLAGS) $(PCRE_CFLAGS) \
|
||||
-DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\"
|
||||
|
||||
libmcskin_la_LIBADD = $(PCRE_LIBS)
|
162
src/skin/colors-old.c
Normal file
162
src/skin/colors-old.c
Normal file
@ -0,0 +1,162 @@
|
||||
/*
|
||||
Skins engine.
|
||||
Work with colors - backward compability
|
||||
|
||||
Copyright (C) 2009 The Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
The Midnight Commander is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Midnight Commander is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h> /* size_t */
|
||||
#include "../src/tty/color.h"
|
||||
|
||||
#include "../src/global.h"
|
||||
#include "../src/setup.h"
|
||||
#include "skin.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
typedef struct mc_skin_colors_old_struct {
|
||||
const char *old_color;
|
||||
const char *group;
|
||||
const char *key;
|
||||
} mc_skin_colors_old_t;
|
||||
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
||||
mc_skin_colors_old_t old_colors[] = {
|
||||
{"normal", "core", "_default_"},
|
||||
{"selected", "ore", "selected"},
|
||||
{"marked", "core", "marked"},
|
||||
{"markselect", "core", "markselect"},
|
||||
{"errors", "error", "_default_"},
|
||||
{"menu", "menu", "_default_"},
|
||||
{"reverse", "core", "reverse"},
|
||||
{"dnormal", "dialog", "_default_"},
|
||||
{"dfocus", "dialog", "dfocus"},
|
||||
{"dhotnormal", "dialog", "dhotnormal"},
|
||||
{"dhotfocus", "dialog", "dhotfocus"},
|
||||
{"viewunderline", "viewer", "viewunderline"},
|
||||
{"menuhot", "menu", "menuhot"},
|
||||
{"menusel", "menu", "menusel"},
|
||||
{"menuhotsel", "menu", "menuhotsel"},
|
||||
{"helpnormal", "help", "_default_"},
|
||||
{"helpitalic", "help", "helpitalic"},
|
||||
{"helpbold", "help", "helpbold"},
|
||||
{"helplink", "help", "helplink"},
|
||||
{"helpslink", "help", "helpslink"},
|
||||
{"gauge", "core", "gauge"},
|
||||
{"input", "core", "input"},
|
||||
{"editnormal", "editor", "_default_"},
|
||||
{"editbold", "editor", "editbold"},
|
||||
{"editmarked", "editor", "editmarked"},
|
||||
{"editwhitespace", "editor", "editwhitespace"},
|
||||
{"editlinestate", "editor", "linestate"},
|
||||
{"errdhotnormal", "error", "errdhotnormal"},
|
||||
{"errdhotfocus", "error", "errdhotfocus"},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
/*** file scope functions ************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static gboolean
|
||||
mc_skin_colors_old_transform (const char *old_color, const char **group, const char **key)
|
||||
{
|
||||
int index;
|
||||
|
||||
if (old_color != NULL)
|
||||
for (index = 0; old_colors[index].old_color; index++) {
|
||||
if (strcasecmp (old_color, old_colors[index].old_color) == 0) {
|
||||
if (group != NULL)
|
||||
*group = old_colors[index].group;
|
||||
if (key != NULL)
|
||||
*key = old_colors[index].key;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
mc_skin_colors_old_configure_one (mc_skin_t * mc_skin, const char *the_color_string)
|
||||
{
|
||||
gchar **colors, **orig_colors;
|
||||
gchar **key_val;
|
||||
const gchar *skin_group, *skin_key;
|
||||
gchar *skin_val;
|
||||
|
||||
if (the_color_string == NULL)
|
||||
return;
|
||||
|
||||
orig_colors = colors = g_strsplit (the_color_string, ":", -1);
|
||||
if (colors == NULL)
|
||||
return;
|
||||
|
||||
for (; *colors; colors++) {
|
||||
key_val = g_strsplit_set (*colors, "=,", 3);
|
||||
|
||||
if (!key_val)
|
||||
continue;
|
||||
|
||||
if (key_val[1] == NULL
|
||||
|| !mc_skin_colors_old_transform (key_val[0], &skin_group, &skin_key)) {
|
||||
g_strfreev (key_val);
|
||||
continue;
|
||||
}
|
||||
if (key_val[2] != NULL)
|
||||
skin_val = g_strdup_printf ("%s;%s", key_val[1], key_val[2]);
|
||||
else
|
||||
skin_val = g_strdup_printf ("%s;", key_val[1]);
|
||||
mc_config_set_string (mc_skin->config, skin_group, skin_key, skin_val);
|
||||
|
||||
g_free (skin_val);
|
||||
|
||||
g_strfreev (key_val);
|
||||
}
|
||||
g_strfreev (orig_colors);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
mc_skin_colors_old_configure (mc_skin_t * mc_skin)
|
||||
{
|
||||
mc_skin_colors_old_configure_one (mc_skin, setup_color_string);
|
||||
mc_skin_colors_old_configure_one (mc_skin, term_color_string);
|
||||
mc_skin_colors_old_configure_one (mc_skin, getenv ("MC_COLOR_TABLE"));
|
||||
mc_skin_colors_old_configure_one (mc_skin, command_line_colors);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
337
src/skin/colors.c
Normal file
337
src/skin/colors.c
Normal file
@ -0,0 +1,337 @@
|
||||
/*
|
||||
Skins engine.
|
||||
Work with colors
|
||||
|
||||
Copyright (C) 2009 The Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
The Midnight Commander is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Midnight Commander is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../src/global.h"
|
||||
#include "../src/args.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "skin.h"
|
||||
#include "internal.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
int mc_skin_color__cache[MC_SKIN_COLOR_CACHE_COUNT];
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
||||
/*** file scope functions ************************************************************************/
|
||||
|
||||
static mc_skin_color_t *
|
||||
mc_skin_color_get_from_hash (mc_skin_t * mc_skin, const gchar * group, const gchar * key)
|
||||
{
|
||||
gchar key_name[BUF_TINY];
|
||||
mc_skin_color_t *mc_skin_color;
|
||||
|
||||
if (group == NULL || key == NULL)
|
||||
return NULL;
|
||||
|
||||
if (mc_skin == NULL)
|
||||
mc_skin = &mc_skin__default;
|
||||
|
||||
g_snprintf (key_name, sizeof (key_name), "%s.%s", group, key);
|
||||
mc_skin_color = (mc_skin_color_t *) g_hash_table_lookup (mc_skin->colors, (gpointer) key_name);
|
||||
|
||||
return mc_skin_color;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
#if 0
|
||||
static void
|
||||
mc_skin_color_remove_from_hash (mc_skin_t * mc_skin, const gchar * group, const gchar * key)
|
||||
{
|
||||
gchar key_name[BUF_TINY];
|
||||
if (group == NULL || key == NULL)
|
||||
return;
|
||||
|
||||
if (mc_skin == NULL)
|
||||
mc_skin = &mc_skin__default;
|
||||
|
||||
g_snprintf (key_name, sizeof (key_name), "%s.%s", group, key);
|
||||
g_hash_table_remove (mc_skin->colors, (gpointer) key_name);
|
||||
}
|
||||
#endif
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
mc_skin_color_add_to_hash (mc_skin_t * mc_skin, const gchar * group, const gchar * key,
|
||||
mc_skin_color_t * mc_skin_color)
|
||||
{
|
||||
gchar *key_name;
|
||||
|
||||
key_name = g_strdup_printf ("%s.%s", group, key);
|
||||
if (key_name == NULL)
|
||||
return;
|
||||
|
||||
if (g_hash_table_lookup (mc_skin->colors, (gpointer) key_name) != NULL)
|
||||
g_hash_table_remove (mc_skin->colors, (gpointer) key_name);
|
||||
|
||||
g_hash_table_insert (mc_skin->colors, (gpointer) key_name, (gpointer) mc_skin_color);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static mc_skin_color_t *
|
||||
mc_skin_color_get_with_defaults (const gchar * group, const gchar * name)
|
||||
{
|
||||
mc_skin_color_t *mc_skin_color;
|
||||
|
||||
mc_skin_color = mc_skin_color_get_from_hash (NULL, group, name);
|
||||
if (mc_skin_color != NULL)
|
||||
return mc_skin_color;
|
||||
|
||||
mc_skin_color = mc_skin_color_get_from_hash (NULL, group, "_default_");
|
||||
if (mc_skin_color != NULL)
|
||||
return mc_skin_color;
|
||||
|
||||
mc_skin_color = mc_skin_color_get_from_hash (NULL, "core", "_default_");
|
||||
return mc_skin_color;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static mc_skin_color_t *
|
||||
mc_skin_color_get_from_ini_file (mc_skin_t * mc_skin, const gchar * group, const gchar * key)
|
||||
{
|
||||
gsize items_count;
|
||||
gchar **values;
|
||||
mc_skin_color_t *mc_skin_color, *tmp;
|
||||
|
||||
values = mc_config_get_string_list (mc_skin->config, group, key, &items_count);
|
||||
|
||||
if (values == NULL || *values == NULL) {
|
||||
if (values != NULL)
|
||||
g_strfreev (values);
|
||||
return NULL;
|
||||
}
|
||||
mc_skin_color = g_new0 (mc_skin_color_t, 1);
|
||||
if (mc_skin_color == NULL) {
|
||||
g_strfreev (values);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (items_count) {
|
||||
case 0:
|
||||
tmp = mc_skin_color_get_with_defaults (group, "_default_");
|
||||
if (tmp) {
|
||||
mc_skin_color->fgcolor = g_strdup (tmp->fgcolor);
|
||||
mc_skin_color->bgcolor = g_strdup (tmp->bgcolor);
|
||||
} else {
|
||||
g_strfreev (values);
|
||||
g_free (mc_skin_color);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
mc_skin_color->fgcolor = (values[0]) ? g_strdup (values[0]) : NULL;
|
||||
tmp = mc_skin_color_get_with_defaults (group, "_default_");
|
||||
mc_skin_color->bgcolor = (tmp != NULL) ? g_strdup (tmp->bgcolor) : NULL;
|
||||
break;
|
||||
case 2:
|
||||
mc_skin_color->fgcolor = (values[0]) ? g_strdup (values[0]) : NULL;
|
||||
mc_skin_color->bgcolor = (values[1]) ? g_strdup (values[1]) : NULL;
|
||||
break;
|
||||
}
|
||||
g_strfreev (values);
|
||||
|
||||
mc_skin_color->pair_index =
|
||||
tty_try_alloc_color_pair2 (mc_skin_color->fgcolor, mc_skin_color->bgcolor, FALSE);
|
||||
|
||||
return mc_skin_color;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
mc_skin_color_set_default_for_terminal (mc_skin_t * mc_skin)
|
||||
{
|
||||
mc_skin_color_t *mc_skin_color;
|
||||
mc_skin_color = g_new0 (mc_skin_color_t, 1);
|
||||
if (mc_skin_color == NULL)
|
||||
return;
|
||||
|
||||
mc_skin_color->fgcolor = g_strdup ("default");
|
||||
mc_skin_color->bgcolor = g_strdup ("default");
|
||||
mc_skin_color->pair_index =
|
||||
tty_try_alloc_color_pair2 (mc_skin_color->fgcolor, mc_skin_color->bgcolor, FALSE);
|
||||
mc_skin_color_add_to_hash (mc_skin, "skin", "terminal_default_color", mc_skin_color);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
static void
|
||||
mc_skin_color_cache_init (void)
|
||||
{
|
||||
DEFAULT_COLOR = mc_skin_color_get ("skin", "terminal_default_color");
|
||||
NORMAL_COLOR = mc_skin_color_get ("core", "_default_");
|
||||
MARKED_COLOR = mc_skin_color_get ("core", "marked");
|
||||
SELECTED_COLOR = mc_skin_color_get ("core", "selected");
|
||||
REVERSE_COLOR = mc_skin_color_get ("core", "reverse");
|
||||
MARKED_SELECTED_COLOR = mc_skin_color_get ("core", "markselect");
|
||||
ERROR_COLOR = mc_skin_color_get ("error", "_default_");
|
||||
MENU_ENTRY_COLOR = mc_skin_color_get ("menu", "_default_");
|
||||
|
||||
COLOR_NORMAL = mc_skin_color_get ("dialog", "_default_");
|
||||
COLOR_FOCUS = mc_skin_color_get ("dialog", "dfocus");
|
||||
COLOR_HOT_NORMAL = mc_skin_color_get ("dialog", "dhotnormal");
|
||||
COLOR_HOT_FOCUS = mc_skin_color_get ("dialog", "dhotfocus");
|
||||
|
||||
VIEW_UNDERLINED_COLOR = mc_skin_color_get ("viewer", "viewunderline");
|
||||
MENU_SELECTED_COLOR = mc_skin_color_get ("menu", "menusel");
|
||||
MENU_HOT_COLOR = mc_skin_color_get ("menu", "menuhot");
|
||||
MENU_HOTSEL_COLOR = mc_skin_color_get ("menu", "menuhotsel");
|
||||
|
||||
HELP_NORMAL_COLOR = mc_skin_color_get ("help", "_default_");
|
||||
HELP_ITALIC_COLOR = mc_skin_color_get ("help", "helpitalic");
|
||||
HELP_BOLD_COLOR = mc_skin_color_get ("help", "helpbold");
|
||||
HELP_LINK_COLOR = mc_skin_color_get ("help", "helplink");
|
||||
HELP_SLINK_COLOR = mc_skin_color_get ("help", "helpslink");
|
||||
|
||||
GAUGE_COLOR = mc_skin_color_get ("core", "gauge");
|
||||
INPUT_COLOR = mc_skin_color_get ("core", "input");
|
||||
|
||||
EDITOR_NORMAL_COLOR = mc_skin_color_get ("editor", "_default_");
|
||||
EDITOR_BOLD_COLOR = mc_skin_color_get ("editor", "editbold");
|
||||
EDITOR_MARKED_COLOR = mc_skin_color_get ("editor", "editmarked");
|
||||
EDITOR_WHITESPACE_COLOR = mc_skin_color_get ("editor", "editwhitespace");
|
||||
|
||||
ERROR_HOT_NORMAL = mc_skin_color_get ("error", "errdhotnormal");
|
||||
ERROR_HOT_FOCUS = mc_skin_color_get ("error", "errdhotfocus");
|
||||
|
||||
LINE_STATE_COLOR = mc_skin_color_get ("editor", "linestate");
|
||||
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static gboolean
|
||||
mc_skin_color_check_inisection (const gchar * group)
|
||||
{
|
||||
if ((strcasecmp ("skin", group) == 0)
|
||||
|| (strcasecmp ("lines", group) == 0))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
mc_skin_color_check_bw_mode (mc_skin_t * mc_skin)
|
||||
{
|
||||
gsize items_count;
|
||||
gchar **groups, **orig_groups;
|
||||
|
||||
if (!mc_args__disable_colors)
|
||||
return;
|
||||
|
||||
orig_groups = groups = mc_config_get_groups (mc_skin->config, &items_count);
|
||||
|
||||
if (groups == NULL)
|
||||
return;
|
||||
|
||||
for (; *groups != NULL; groups++) {
|
||||
if (mc_skin_color_check_inisection (*groups))
|
||||
mc_config_del_group (mc_skin->config, *groups);
|
||||
}
|
||||
g_strfreev (orig_groups);
|
||||
mc_skin_hardcoded_blackwhite_colors (mc_skin);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
mc_skin_color_parse_ini_file (mc_skin_t * mc_skin)
|
||||
{
|
||||
gsize items_count;
|
||||
gchar **groups, **orig_groups;
|
||||
gchar **keys, **orig_keys;
|
||||
mc_skin_color_t *mc_skin_color;
|
||||
|
||||
mc_skin_color_check_bw_mode (mc_skin);
|
||||
|
||||
orig_groups = groups = mc_config_get_groups (mc_skin->config, &items_count);
|
||||
|
||||
if (groups == NULL || *groups == NULL) {
|
||||
if (groups != NULL)
|
||||
g_strfreev (groups);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* as first, need to set up default colors */
|
||||
mc_skin_color_set_default_for_terminal (mc_skin);
|
||||
mc_skin_color = mc_skin_color_get_from_ini_file (mc_skin, "core", "_default_");
|
||||
if (mc_skin_color == NULL)
|
||||
return FALSE;
|
||||
|
||||
tty_color_set_defaults (mc_skin_color->fgcolor, mc_skin_color->bgcolor);
|
||||
mc_skin_color_add_to_hash (mc_skin, "core", "_default_", mc_skin_color);
|
||||
|
||||
for (; *groups != NULL; groups++) {
|
||||
if (!mc_skin_color_check_inisection (*groups))
|
||||
continue;
|
||||
|
||||
orig_keys = keys = mc_config_get_keys (mc_skin->config, *groups, &items_count);
|
||||
if (keys == NULL || *keys == NULL) {
|
||||
if (keys != NULL)
|
||||
g_strfreev (keys);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (; *keys; keys++) {
|
||||
mc_skin_color = mc_skin_color_get_from_ini_file (mc_skin, *groups, *keys);
|
||||
if (mc_skin_color != NULL)
|
||||
mc_skin_color_add_to_hash (mc_skin, *groups, *keys, mc_skin_color);
|
||||
}
|
||||
g_strfreev (orig_keys);
|
||||
}
|
||||
g_strfreev (orig_groups);
|
||||
|
||||
mc_skin_color_cache_init ();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
mc_skin_color_get (const gchar * group, const gchar * name)
|
||||
{
|
||||
mc_skin_color_t *mc_skin_color;
|
||||
|
||||
mc_skin_color = mc_skin_color_get_with_defaults (group, name);
|
||||
|
||||
return (mc_skin_color != NULL) ? mc_skin_color->pair_index : 0;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
150
src/skin/common.c
Normal file
150
src/skin/common.c
Normal file
@ -0,0 +1,150 @@
|
||||
/*
|
||||
Skins engine.
|
||||
Interface functions
|
||||
|
||||
Copyright (C) 2009 The Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
The Midnight Commander is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Midnight Commander is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../src/global.h"
|
||||
#include "../src/args.h"
|
||||
#include "skin.h"
|
||||
#include "internal.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
mc_skin_t mc_skin__default;
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
||||
static gboolean mc_skin_is_init = FALSE;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** file scope functions ************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static inline void
|
||||
mc_skin_hash_destroy_key (gpointer data)
|
||||
{
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
mc_skin_hash_destroy_value (gpointer data)
|
||||
{
|
||||
mc_skin_color_t *mc_skin_color = (mc_skin_color_t *) data;
|
||||
g_free (mc_skin_color->fgcolor);
|
||||
g_free (mc_skin_color->bgcolor);
|
||||
g_free (mc_skin_color);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static char *
|
||||
mc_skin_get_default_name (void)
|
||||
{
|
||||
char *tmp_str;
|
||||
|
||||
/* from command line */
|
||||
if (mc_args__skin != NULL)
|
||||
return g_strdup (mc_args__skin);
|
||||
|
||||
/* from envirovement variable */
|
||||
tmp_str = getenv ("MC_SKIN");
|
||||
if (tmp_str != NULL)
|
||||
return g_strdup (tmp_str);
|
||||
|
||||
/* from config. Or 'default' if no present in config */
|
||||
return mc_config_get_string (mc_main_config, CONFIG_APP_SECTION, "skin", "default");
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
mc_skin_reinit (void)
|
||||
{
|
||||
mc_skin_deinit ();
|
||||
mc_skin__default.name = mc_skin_get_default_name ();
|
||||
mc_skin__default.colors = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
mc_skin_hash_destroy_key,
|
||||
mc_skin_hash_destroy_value);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
mc_skin_init (void)
|
||||
{
|
||||
mc_skin__default.name = mc_skin_get_default_name ();
|
||||
mc_skin__default.colors = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
mc_skin_hash_destroy_key,
|
||||
mc_skin_hash_destroy_value);
|
||||
|
||||
if (!mc_skin_ini_file_load (&mc_skin__default)) {
|
||||
mc_skin_reinit ();
|
||||
mc_skin_set_hardcoded_skin (&mc_skin__default);
|
||||
}
|
||||
mc_skin_colors_old_configure (&mc_skin__default);
|
||||
|
||||
if (!mc_skin_ini_file_parse (&mc_skin__default)) {
|
||||
mc_skin_reinit ();
|
||||
mc_skin_set_hardcoded_skin (&mc_skin__default);
|
||||
mc_skin_colors_old_configure (&mc_skin__default);
|
||||
(void) mc_skin_ini_file_parse (&mc_skin__default);
|
||||
}
|
||||
mc_skin_is_init = TRUE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
mc_skin_deinit (void)
|
||||
{
|
||||
|
||||
g_free (mc_skin__default.name);
|
||||
mc_skin__default.name = NULL;
|
||||
g_hash_table_destroy (mc_skin__default.colors);
|
||||
mc_skin__default.colors = NULL;
|
||||
|
||||
g_free (mc_skin__default.description);
|
||||
mc_skin__default.description = NULL;
|
||||
|
||||
if (mc_skin__default.config) {
|
||||
mc_config_deinit (mc_skin__default.config);
|
||||
mc_skin__default.config = NULL;
|
||||
}
|
||||
|
||||
mc_skin_is_init = FALSE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
115
src/skin/hc-skins.c
Normal file
115
src/skin/hc-skins.c
Normal file
@ -0,0 +1,115 @@
|
||||
/*
|
||||
Skins engine.
|
||||
Set of hardcoded skins
|
||||
|
||||
Copyright (C) 2009 The Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
The Midnight Commander is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Midnight Commander is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "../src/global.h"
|
||||
|
||||
#include "skin.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
#define set_lines(x,y) mc_config_set_string(mc_skin->config, "Lines", x, y)
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
||||
/*** file scope functions ************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
mc_skin_hardcoded_blackwhite_colors (mc_skin_t * mc_skin)
|
||||
{
|
||||
mc_config_set_string (mc_skin->config, "core", "_default_", "default;default");
|
||||
mc_config_set_string (mc_skin->config, "core", "selected", "A_REVERSE");
|
||||
mc_config_set_string (mc_skin->config, "core", "marked", "A_BOLD");
|
||||
mc_config_set_string (mc_skin->config, "core", "markselect", "A_BOLD_REVERSE");
|
||||
mc_config_set_string (mc_skin->config, "core", "reverse", "A_REVERSE");
|
||||
mc_config_set_string (mc_skin->config, "dialog", "_default_", "A_REVERSE");
|
||||
mc_config_set_string (mc_skin->config, "dialog", "focus", "A_BOLD");
|
||||
mc_config_set_string (mc_skin->config, "menu", "entry", "A_REVERSE");
|
||||
mc_config_set_string (mc_skin->config, "menu", "selected", "A_BOLD");
|
||||
mc_config_set_string (mc_skin->config, "help", "_default_", "A_REVERSE");
|
||||
mc_config_set_string (mc_skin->config, "help", "italic", "A_REVERSE");
|
||||
mc_config_set_string (mc_skin->config, "help", "bold", "A_REVERSE");
|
||||
mc_config_set_string (mc_skin->config, "help", "slink", "A_BOLD");
|
||||
mc_config_set_string (mc_skin->config, "editor", "bold", "A_BOLD");
|
||||
mc_config_set_string (mc_skin->config, "editor", "marked", "A_REVERSE");
|
||||
mc_config_set_string (mc_skin->config, "viewer", "underline", "A_UNDERLINE");
|
||||
mc_config_set_string (mc_skin->config, "error", "_default_", "A_BOLD");
|
||||
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
mc_skin_hardcoded_space_lines (mc_skin_t * mc_skin)
|
||||
{
|
||||
set_lines ("lefttop", " ");
|
||||
set_lines ("righttop", " ");
|
||||
set_lines ("centertop", " ");
|
||||
set_lines ("centerbottom", " ");
|
||||
set_lines ("leftbottom", " ");
|
||||
set_lines ("rightbottom", " ");
|
||||
set_lines ("leftmiddle", " ");
|
||||
set_lines ("rightmiddle", " ");
|
||||
set_lines ("centermiddle", " ");
|
||||
set_lines ("horiz", " ");
|
||||
set_lines ("vert", " ");
|
||||
set_lines ("thinhoriz", " ");
|
||||
set_lines ("thinvert", " ");
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
mc_skin_hardcoded_ugly_lines (mc_skin_t * mc_skin)
|
||||
{
|
||||
set_lines ("lefttop", "+");
|
||||
set_lines ("righttop", "+");
|
||||
set_lines ("centertop", "-");
|
||||
set_lines ("centerbottom", "-");
|
||||
set_lines ("leftbottom", "+");
|
||||
set_lines ("rightbottom", "+");
|
||||
set_lines ("leftmiddle", "|");
|
||||
set_lines ("rightmiddle", "|");
|
||||
set_lines ("centermiddle", "+");
|
||||
set_lines ("horiz", "-");
|
||||
set_lines ("vert", "|");
|
||||
set_lines ("thinhoriz", "-");
|
||||
set_lines ("thinvert", "|");
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
137
src/skin/ini-file.c
Normal file
137
src/skin/ini-file.c
Normal file
@ -0,0 +1,137 @@
|
||||
/*
|
||||
Skins engine.
|
||||
Reading and parse ini-files
|
||||
|
||||
Copyright (C) 2009 The Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
The Midnight Commander is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Midnight Commander is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../src/global.h"
|
||||
#include "../src/main.h"
|
||||
#include "skin.h"
|
||||
#include "internal.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
||||
/*** file scope functions ************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static gboolean
|
||||
mc_skin_ini_file_load_search_in_dir (mc_skin_t * mc_skin, const gchar * base_dir)
|
||||
{
|
||||
char *file_name, *file_name2;
|
||||
|
||||
file_name = g_build_filename (base_dir, "skins", mc_skin->name, NULL);
|
||||
if (exist_file (file_name)) {
|
||||
mc_skin->config = mc_config_init (file_name);
|
||||
g_free (file_name);
|
||||
return (mc_skin->config != NULL);
|
||||
}
|
||||
g_free (file_name);
|
||||
|
||||
file_name2 = g_strdup_printf ("%s.ini", mc_skin->name);
|
||||
file_name = g_build_filename (base_dir, "skins", file_name2, NULL);
|
||||
g_free (file_name2);
|
||||
|
||||
if (exist_file (file_name)) {
|
||||
mc_skin->config = mc_config_init (file_name);
|
||||
g_free (file_name);
|
||||
return (mc_skin->config != NULL);
|
||||
}
|
||||
g_free (file_name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
mc_skin_ini_file_load (mc_skin_t * mc_skin)
|
||||
{
|
||||
char *file_name, *user_home_dir;
|
||||
|
||||
file_name = g_path_get_basename (mc_skin->name);
|
||||
|
||||
if (strcmp (file_name, mc_skin->name) != 0) {
|
||||
g_free (file_name);
|
||||
if (!g_path_is_absolute (mc_skin->name))
|
||||
return FALSE;
|
||||
mc_skin->config = mc_config_init (mc_skin->name);
|
||||
return (mc_skin->config != NULL);
|
||||
}
|
||||
g_free (file_name);
|
||||
|
||||
/* ~/.mc/skins/ */
|
||||
user_home_dir = concat_dir_and_file (home_dir, MC_BASE);
|
||||
if (mc_skin_ini_file_load_search_in_dir (mc_skin, user_home_dir)) {
|
||||
g_free (user_home_dir);
|
||||
return TRUE;
|
||||
}
|
||||
g_free (user_home_dir);
|
||||
|
||||
/* /etc/mc/skins/ */
|
||||
if (mc_skin_ini_file_load_search_in_dir (mc_skin, mc_home))
|
||||
return TRUE;
|
||||
|
||||
/* /usr/share/mc/skins/ */
|
||||
return mc_skin_ini_file_load_search_in_dir (mc_skin, mc_home_alt);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
mc_skin_ini_file_parse (mc_skin_t * mc_skin)
|
||||
{
|
||||
mc_skin->description =
|
||||
mc_config_get_string (mc_skin->config, "skin", "description", "- no description -");
|
||||
if (!mc_skin_color_parse_ini_file (mc_skin))
|
||||
return FALSE;
|
||||
|
||||
mc_skin_lines_parse_ini_file (mc_skin);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
mc_skin_set_hardcoded_skin (mc_skin_t * mc_skin)
|
||||
{
|
||||
mc_skin->config = mc_config_init (NULL);
|
||||
|
||||
mc_config_set_string (mc_skin->config, "skin", "description", "hardcoded skin");
|
||||
|
||||
mc_skin_hardcoded_ugly_lines (mc_skin);
|
||||
mc_skin_hardcoded_blackwhite_colors (mc_skin);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
39
src/skin/internal.h
Normal file
39
src/skin/internal.h
Normal file
@ -0,0 +1,39 @@
|
||||
#ifndef MC__SKIN_INTERNAL_H
|
||||
#define MC__SKIN_INTERNAL_H
|
||||
|
||||
#include "../../src/global.h"
|
||||
|
||||
#include "skin.h"
|
||||
|
||||
/*** typedefs(not structures) and defined constants **********************************************/
|
||||
|
||||
/*** enums ***************************************************************************************/
|
||||
|
||||
/*** structures declarations (and typedefs of structures)*****************************************/
|
||||
|
||||
typedef struct mc_skin_color_struct {
|
||||
gchar *fgcolor;
|
||||
gchar *bgcolor;
|
||||
int pair_index;
|
||||
} mc_skin_color_t;
|
||||
|
||||
/*** global variables defined in .c file *********************************************************/
|
||||
|
||||
extern mc_skin_t mc_skin__default;
|
||||
|
||||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
gboolean mc_skin_ini_file_load (mc_skin_t *);
|
||||
gboolean mc_skin_ini_file_parse (mc_skin_t *);
|
||||
void mc_skin_set_hardcoded_skin (mc_skin_t *);
|
||||
|
||||
gboolean mc_skin_ini_file_parse_colors (mc_skin_t *);
|
||||
gboolean mc_skin_color_parse_ini_file (mc_skin_t *);
|
||||
|
||||
void mc_skin_hardcoded_ugly_lines (mc_skin_t *);
|
||||
void mc_skin_hardcoded_space_lines (mc_skin_t *);
|
||||
void mc_skin_hardcoded_blackwhite_colors (mc_skin_t *);
|
||||
|
||||
void mc_skin_colors_old_configure (mc_skin_t *);
|
||||
|
||||
#endif
|
122
src/skin/lines.c
Normal file
122
src/skin/lines.c
Normal file
@ -0,0 +1,122 @@
|
||||
/*
|
||||
Skins engine.
|
||||
Work with line draving chars.
|
||||
|
||||
Copyright (C) 2009 The Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
The Midnight Commander is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Midnight Commander is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../src/global.h"
|
||||
#include "../src/args.h"
|
||||
#include "../src/tty/tty.h"
|
||||
#include "skin.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
||||
/*** file scope functions ************************************************************************/
|
||||
|
||||
static int
|
||||
mc_skin_lines_load_frm (mc_skin_t * mc_skin, const char *name)
|
||||
{
|
||||
int ret;
|
||||
char *frm_val = NULL;
|
||||
frm_val = mc_config_get_string_raw (mc_skin->config, "Lines", name, " ");
|
||||
ret = mc_tty_normalize_lines_char (frm_val);
|
||||
|
||||
g_free (frm_val);
|
||||
|
||||
switch (ret) {
|
||||
case 0x80:
|
||||
ret = ACS_HLINE;
|
||||
break;
|
||||
case 0x81:
|
||||
ret = ACS_VLINE;
|
||||
break;
|
||||
case 0x82:
|
||||
ret = ACS_ULCORNER;
|
||||
break;
|
||||
case 0x83:
|
||||
ret = ACS_URCORNER;
|
||||
break;
|
||||
case 0x84:
|
||||
ret = ACS_LLCORNER;
|
||||
break;
|
||||
case 0x85:
|
||||
ret = ACS_LRCORNER;
|
||||
break;
|
||||
case 0x86:
|
||||
ret = ACS_LTEE;
|
||||
break;
|
||||
case 0x87:
|
||||
ret = ACS_RTEE;
|
||||
break;
|
||||
case 0x8a:
|
||||
ret = ACS_PLUS;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
mc_skin_lines_parse_ini_file (mc_skin_t * mc_skin)
|
||||
{
|
||||
if (mc_args__slow_terminal) {
|
||||
mc_skin_hardcoded_space_lines (mc_skin);
|
||||
} else if (mc_args__ugly_line_drawing) {
|
||||
mc_skin_hardcoded_ugly_lines (mc_skin);
|
||||
}
|
||||
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_horiz] = mc_skin_lines_load_frm (mc_skin, "horiz");
|
||||
mc_tty_ugly_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_ugly_frm[MC_TTY_FRM_righttop] = mc_skin_lines_load_frm (mc_skin, "righttop");
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_leftbottom] = mc_skin_lines_load_frm (mc_skin, "leftbottom");
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_rightbottom] = mc_skin_lines_load_frm (mc_skin, "rightbottom");
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_thinvert] = mc_skin_lines_load_frm (mc_skin, "thinvert");
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz] = mc_skin_lines_load_frm (mc_skin, "thinhoriz");
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_rightmiddle] = mc_skin_lines_load_frm (mc_skin, "rightmiddle");
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_centertop] = mc_skin_lines_load_frm (mc_skin, "centertop");
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_centerbottom] = mc_skin_lines_load_frm (mc_skin, "centerbottom");
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_centermiddle] = mc_skin_lines_load_frm (mc_skin, "centermiddle");
|
||||
mc_tty_ugly_frm[MC_TTY_FRM_leftmiddle] = mc_skin_lines_load_frm (mc_skin, "leftmiddle");
|
||||
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
95
src/skin/skin.h
Normal file
95
src/skin/skin.h
Normal file
@ -0,0 +1,95 @@
|
||||
#ifndef MC__SKIN_H
|
||||
#define MC__SKIN_H
|
||||
|
||||
#include "../../src/global.h"
|
||||
|
||||
#include "../../src/mcconfig/mcconfig.h"
|
||||
|
||||
#include "../src/tty/color.h"
|
||||
|
||||
/*** typedefs(not structures) and defined constants **********************************************/
|
||||
|
||||
/* Beware! When using Slang with color, not all the indexes are free.
|
||||
See color-slang.h (A_*) */
|
||||
|
||||
/* cache often used colors*/
|
||||
#define DEFAULT_COLOR mc_skin_color__cache[0]
|
||||
#define NORMAL_COLOR mc_skin_color__cache[1]
|
||||
#define MARKED_COLOR mc_skin_color__cache[2]
|
||||
#define SELECTED_COLOR mc_skin_color__cache[3]
|
||||
#define MARKED_SELECTED_COLOR mc_skin_color__cache[4]
|
||||
#define REVERSE_COLOR mc_skin_color__cache[5]
|
||||
|
||||
/* Dialog colors */
|
||||
#define COLOR_NORMAL mc_skin_color__cache[6]
|
||||
#define COLOR_FOCUS mc_skin_color__cache[7]
|
||||
#define COLOR_HOT_NORMAL mc_skin_color__cache[8]
|
||||
#define COLOR_HOT_FOCUS mc_skin_color__cache[9]
|
||||
|
||||
/* Error dialog colors */
|
||||
#define ERROR_COLOR mc_skin_color__cache[10]
|
||||
#define ERROR_HOT_NORMAL mc_skin_color__cache[11]
|
||||
#define ERROR_HOT_FOCUS mc_skin_color__cache[12]
|
||||
|
||||
/* Menu colors */
|
||||
#define MENU_ENTRY_COLOR mc_skin_color__cache[13]
|
||||
#define MENU_SELECTED_COLOR mc_skin_color__cache[14]
|
||||
#define MENU_HOT_COLOR mc_skin_color__cache[15]
|
||||
#define MENU_HOTSEL_COLOR mc_skin_color__cache[16]
|
||||
|
||||
/*
|
||||
* This should be selectable independently. Default has to be black background
|
||||
* foreground does not matter at all.
|
||||
*/
|
||||
#define GAUGE_COLOR mc_skin_color__cache[17]
|
||||
#define INPUT_COLOR mc_skin_color__cache[18]
|
||||
|
||||
#define HELP_NORMAL_COLOR mc_skin_color__cache[19]
|
||||
#define HELP_ITALIC_COLOR mc_skin_color__cache[20]
|
||||
#define HELP_BOLD_COLOR mc_skin_color__cache[21]
|
||||
#define HELP_LINK_COLOR mc_skin_color__cache[22]
|
||||
#define HELP_SLINK_COLOR mc_skin_color__cache[23]
|
||||
|
||||
#define VIEW_UNDERLINED_COLOR mc_skin_color__cache[24]
|
||||
|
||||
/*
|
||||
* editor colors - only 4 for normal, search->found, select, and whitespace
|
||||
* respectively
|
||||
* Last is defined to view color.
|
||||
*/
|
||||
#define EDITOR_NORMAL_COLOR mc_skin_color__cache[25]
|
||||
#define EDITOR_BOLD_COLOR mc_skin_color__cache[26]
|
||||
#define EDITOR_MARKED_COLOR mc_skin_color__cache[27]
|
||||
#define EDITOR_WHITESPACE_COLOR mc_skin_color__cache[28]
|
||||
/* color of left 8 char status per line */
|
||||
#define LINE_STATE_COLOR mc_skin_color__cache[29]
|
||||
|
||||
#define MC_SKIN_COLOR_CACHE_COUNT 30
|
||||
|
||||
|
||||
/*** enums ***************************************************************************************/
|
||||
|
||||
/*** structures declarations (and typedefs of structures)*****************************************/
|
||||
|
||||
typedef struct mc_skin_struct {
|
||||
gchar *name;
|
||||
gchar *description;
|
||||
mc_config_t *config;
|
||||
GHashTable *colors;
|
||||
} mc_skin_t;
|
||||
|
||||
/*** global variables defined in .c file *********************************************************/
|
||||
|
||||
extern int mc_skin_color__cache[];
|
||||
extern mc_skin_t mc_skin__default;
|
||||
|
||||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
void mc_skin_init (void);
|
||||
void mc_skin_deinit (void);
|
||||
|
||||
int mc_skin_color_get (const gchar *, const gchar *);
|
||||
|
||||
void mc_skin_lines_parse_ini_file (mc_skin_t *);
|
||||
|
||||
#endif
|
@ -41,7 +41,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/mouse.h"
|
||||
#include "../src/tty/key.h"
|
||||
|
||||
|
@ -7,12 +7,12 @@ if USE_SCREEN_SLANG
|
||||
tty-slang.c tty-slang.h
|
||||
else
|
||||
TTY_SCREEN_SRC = \
|
||||
color-ncurses.c color-ncurses.h \
|
||||
color-ncurses.c \
|
||||
tty-ncurses.c tty-ncurses.h
|
||||
endif
|
||||
|
||||
TTY_SRC = \
|
||||
color-internal.c color-internal.h\
|
||||
color-internal.c color-internal.h \
|
||||
color.c color.h \
|
||||
key.c key.h keyxdef.c \
|
||||
mouse.c mouse.h \
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
Written by:
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2009.
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
|
||||
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
|
||||
@ -25,12 +26,27 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <sys/types.h> /* size_t */
|
||||
#include <string.h> /* strcmp */
|
||||
|
||||
#include "../../src/tty/color.h" /* colors and attributes */
|
||||
#include "../../src/tty/color.h" /* colors and attributes */
|
||||
#include "../../src/tty/color-internal.h"
|
||||
|
||||
struct color_table_s const color_table [] = {
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
gboolean mc_tty_color_disable;
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
typedef struct mc_tty_color_table_struct {
|
||||
const char *name;
|
||||
int value;
|
||||
} mc_tty_color_table_t;
|
||||
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
||||
mc_tty_color_table_t const color_table[] = {
|
||||
{ "black", COLOR_BLACK },
|
||||
{ "gray", COLOR_BLACK | A_BOLD },
|
||||
{ "red", COLOR_RED },
|
||||
@ -47,63 +63,46 @@ struct color_table_s const color_table [] = {
|
||||
{ "brightcyan", COLOR_CYAN | A_BOLD },
|
||||
{ "lightgray", COLOR_WHITE },
|
||||
{ "white", COLOR_WHITE | A_BOLD },
|
||||
{ "default", 0 } /* default color of the terminal */
|
||||
{ "default", -1 }, /* default color of the terminal */
|
||||
/* special colors */
|
||||
{ "A_REVERSE", SPEC_A_REVERSE },
|
||||
{ "A_BOLD", SPEC_A_BOLD},
|
||||
{ "A_BOLD_REVERSE", SPEC_A_BOLD_REVERSE },
|
||||
{ "A_UNDERLINE", SPEC_A_UNDERLINE },
|
||||
/* End of list */
|
||||
{ NULL, 0}
|
||||
};
|
||||
|
||||
struct colorpair color_map [] = {
|
||||
{ "normal=", 0, 0 }, /* normal */ /* 1 */
|
||||
{ "selected=", 0, 0 }, /* selected */
|
||||
{ "marked=", 0, 0 }, /* marked */
|
||||
{ "markselect=", 0, 0 }, /* marked/selected */
|
||||
{ "errors=", 0, 0 }, /* errors */
|
||||
{ "menu=", 0, 0 }, /* menu entry */
|
||||
{ "reverse=", 0, 0 }, /* reverse */
|
||||
/*** file scope functions ************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* Dialog colors */
|
||||
{ "dnormal=", 0, 0 }, /* Dialog normal */ /* 8 */
|
||||
{ "dfocus=", 0, 0 }, /* Dialog focused */
|
||||
{ "dhotnormal=", 0, 0 }, /* Dialog normal/hot */
|
||||
{ "dhotfocus=", 0, 0 }, /* Dialog focused/hot */
|
||||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
{ "viewunderline=", 0, 0 }, /* _\b? sequence in view, underline in editor */
|
||||
{ "menusel=", 0, 0 }, /* Menu selected color */ /* 13 */
|
||||
{ "menuhot=", 0, 0 }, /* Color for menu hotkeys */
|
||||
{ "menuhotsel=", 0, 0 }, /* Menu hotkeys/selected entry */
|
||||
|
||||
{ "helpnormal=", 0, 0 }, /* Help normal */ /* 16 */
|
||||
{ "helpitalic=", 0, 0 }, /* Italic in help */
|
||||
{ "helpbold=", 0, 0 }, /* Bold in help */
|
||||
{ "helplink=", 0, 0 }, /* Not selected hyperlink */
|
||||
{ "helpslink=", 0, 0 }, /* Selected hyperlink */
|
||||
|
||||
{ "gauge=", 0, 0 }, /* Color of the progress bar (percentage) *//* 21 */
|
||||
{ "input=", 0, 0 },
|
||||
|
||||
{ 0, 0, 0 }, /* not usable (DEFAULT_COLOR_INDEX) *//* 23 */
|
||||
{ 0, 0, 0 }, /* unused */
|
||||
{ 0, 0, 0 }, /* not usable (A_REVERSE) */
|
||||
{ 0, 0, 0 }, /* not usable (A_REVERSE_BOLD) */
|
||||
|
||||
/* editor colors start at 27 */
|
||||
{ "editnormal=", 0, 0 }, /* normal */ /* 27 */
|
||||
{ "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 32 */
|
||||
{ "errdhotnormal=", 0, 0 }, /* Error dialog normal/hot */ /* 32 */
|
||||
{ "errdhotfocus=", 0, 0 }, /* Error dialog focused/hot */
|
||||
};
|
||||
|
||||
size_t
|
||||
color_table_len (void)
|
||||
const char *
|
||||
tty_color_get_valid_name (const char *color_name)
|
||||
{
|
||||
return sizeof (color_table)/sizeof(color_table [0]);
|
||||
int i;
|
||||
|
||||
if (color_name != NULL)
|
||||
for (i = 0; color_table[i].name != NULL; i++)
|
||||
if (strcmp (color_name, color_table[i].name) == 0)
|
||||
return color_table[i].name;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t
|
||||
color_map_len (void)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
tty_color_get_index_by_name (const char *color_name)
|
||||
{
|
||||
return sizeof (color_map)/sizeof(color_map [0]);
|
||||
int i;
|
||||
|
||||
if (color_name != NULL)
|
||||
for (i = 0; color_table[i].name != NULL; i++)
|
||||
if (strcmp (color_name, color_table[i].name) == 0)
|
||||
return color_table[i].value;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifndef MC_COLOR_INTERNAL_H
|
||||
#define MC_COLOR_INTERNAL_H
|
||||
|
||||
#include <sys/types.h> /* size_t */
|
||||
#include <sys/types.h> /* size_t */
|
||||
|
||||
#include "../../src/global.h"
|
||||
|
||||
@ -14,91 +14,33 @@
|
||||
# include "../../src/tty/tty-slang.h"
|
||||
#else
|
||||
# include "../../src/tty/tty-ncurses.h"
|
||||
#endif /* HAVE_SLANG */
|
||||
#endif /* HAVE_SLANG */
|
||||
|
||||
extern gboolean use_colors;
|
||||
extern gboolean mc_tty_color_disable;
|
||||
|
||||
struct color_table_s {
|
||||
const char *name;
|
||||
int value;
|
||||
};
|
||||
typedef struct mc_color_pair_struct {
|
||||
const char *cfg;
|
||||
const char *cbg;
|
||||
int ifg;
|
||||
int ibg;
|
||||
int pair_index;
|
||||
gboolean is_temp;
|
||||
} tty_color_pair_t;
|
||||
|
||||
extern const struct color_table_s color_table [];
|
||||
typedef enum {
|
||||
SPEC_A_REVERSE = -100,
|
||||
SPEC_A_BOLD = -101,
|
||||
SPEC_A_BOLD_REVERSE = -102,
|
||||
SPEC_A_UNDERLINE = -103
|
||||
} tty_special_color_t;
|
||||
|
||||
#ifdef HAVE_SLANG
|
||||
# define CTYPE const char *
|
||||
#else
|
||||
# define CTYPE int
|
||||
#endif /* HAVE_SLANG */
|
||||
const char *tty_color_get_valid_name (const char *);
|
||||
int tty_color_get_index_by_name (const char *);
|
||||
|
||||
struct colorpair {
|
||||
const char *name; /* Name of the entry */
|
||||
CTYPE fg; /* foreground color */
|
||||
CTYPE bg; /* background color */
|
||||
};
|
||||
void tty_color_init_lib (gboolean, gboolean);
|
||||
void tty_color_deinit_lib (void);
|
||||
|
||||
extern struct colorpair color_map [];
|
||||
void tty_color_try_alloc_pair_lib (tty_color_pair_t *);
|
||||
|
||||
#ifdef HAVE_SLANG
|
||||
# define color_value(i) color_table [i].name
|
||||
# define color_name(i) color_table [i].name
|
||||
|
||||
# define color_map_fg(n) color_map [n].fg
|
||||
# define color_map_bg(n) color_map [n].bg
|
||||
#else
|
||||
# define color_value(i) color_table [i].value
|
||||
# define color_name(i) color_table [i].name
|
||||
|
||||
# define color_map_fg(n) (color_map [n].fg & COLOR_WHITE)
|
||||
# define color_map_bg(n) (color_map [n].bg & COLOR_WHITE)
|
||||
#endif /* HAVE_SLANG */
|
||||
|
||||
static const char default_colors[] = {
|
||||
"normal=lightgray,blue:"
|
||||
"selected=black,cyan:"
|
||||
"marked=yellow,blue:"
|
||||
"markselect=yellow,cyan:"
|
||||
"errors=white,red:"
|
||||
"menu=white,cyan:"
|
||||
"reverse=black,lightgray:"
|
||||
"dnormal=black,lightgray:"
|
||||
"dfocus=black,cyan:"
|
||||
"dhotnormal=blue,lightgray:"
|
||||
"dhotfocus=blue,cyan:"
|
||||
"viewunderline=brightred,blue:"
|
||||
"menuhot=yellow,cyan:"
|
||||
"menusel=white,black:"
|
||||
"menuhotsel=yellow,black:"
|
||||
"helpnormal=black,lightgray:"
|
||||
"helpitalic=red,lightgray:"
|
||||
"helpbold=blue,lightgray:"
|
||||
"helplink=black,cyan:"
|
||||
"helpslink=yellow,blue:"
|
||||
"gauge=white,black:"
|
||||
"input=black,cyan:"
|
||||
"editnormal=lightgray,blue:"
|
||||
"editbold=yellow,blue:"
|
||||
"editmarked=black,cyan:"
|
||||
"editwhitespace=brightblue,blue:"
|
||||
"editlinestate=white,cyan:"
|
||||
"errdhotnormal=yellow,red:"
|
||||
"errdhotfocus=yellow,lightgray"
|
||||
};
|
||||
|
||||
struct colors_avail {
|
||||
struct colors_avail *next;
|
||||
char *fg, *bg;
|
||||
int index;
|
||||
};
|
||||
|
||||
extern struct colors_avail c;
|
||||
extern int max_index;
|
||||
|
||||
size_t color_table_len (void);
|
||||
size_t color_map_len (void);
|
||||
|
||||
void configure_colors (void);
|
||||
void get_color (const char *cpp, CTYPE *colp);
|
||||
int alloc_color_pair (CTYPE foreground, CTYPE background);
|
||||
|
||||
#endif /* MC_COLOR_INTERNAL_H */
|
||||
#endif /* MC_COLOR_INTERNAL_H */
|
||||
|
@ -28,118 +28,179 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h> /* size_t*/
|
||||
#include <sys/types.h> /* size_t */
|
||||
|
||||
#include "../../src/global.h"
|
||||
|
||||
#include "../../src/tty/tty-ncurses.h"
|
||||
#include "../../src/tty/color.h" /* variables */
|
||||
#include "../../src/tty/color.h" /* variables */
|
||||
#include "../../src/tty/color-internal.h"
|
||||
|
||||
int attr_pairs [MAX_PAIRS];
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
||||
static GHashTable *mc_tty_color_color_pair_attrs = NULL;
|
||||
|
||||
/*** file scope functions ************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static inline void
|
||||
mc_tty_color_attr_destroy_cb (gpointer data)
|
||||
{
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
mc_tty_color_save_attr_lib (int color_pair, int color_attr)
|
||||
{
|
||||
int *attr, *key;
|
||||
attr = g_new0 (int, 1);
|
||||
if (attr == NULL)
|
||||
return color_attr;
|
||||
|
||||
key = g_new0 (int, 1);
|
||||
if (key == NULL) {
|
||||
g_free (attr);
|
||||
return color_attr;
|
||||
}
|
||||
memcpy (key, &color_pair, sizeof (int));
|
||||
|
||||
if (color_attr != -1)
|
||||
*attr = color_attr & (A_BOLD | A_REVERSE | A_UNDERLINE);
|
||||
g_hash_table_replace (mc_tty_color_color_pair_attrs, (gpointer) key, (gpointer) attr);
|
||||
return color_attr & (~(*attr));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
color_get_attr (int color_pair)
|
||||
{
|
||||
int *fnd;
|
||||
|
||||
if (mc_tty_color_color_pair_attrs == NULL)
|
||||
return 0;
|
||||
|
||||
fnd = (int *) g_hash_table_lookup (mc_tty_color_color_pair_attrs, (gpointer) & color_pair);
|
||||
return (fnd != NULL) ? *fnd : 0;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
mc_tty_color_pair_init_special (tty_color_pair_t * mc_color_pair,
|
||||
int fg1, int bg1, int fg2, int bg2, int mask)
|
||||
{
|
||||
if (has_colors ()) {
|
||||
if (!mc_tty_color_disable) {
|
||||
init_pair (mc_color_pair->pair_index,
|
||||
mc_tty_color_save_attr_lib (mc_color_pair->pair_index, fg1 | mask), bg1);
|
||||
} else {
|
||||
init_pair (mc_color_pair->pair_index,
|
||||
mc_tty_color_save_attr_lib (mc_color_pair->pair_index, fg2 | mask), bg2);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
else {
|
||||
SLtt_set_mono (mc_color_pair->pair_index, NULL, mask);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
tty_init_colors (gboolean disable, gboolean force)
|
||||
tty_color_init_lib (gboolean disable, gboolean force)
|
||||
{
|
||||
(void) force;
|
||||
|
||||
if (has_colors () && !disable) {
|
||||
const size_t map_len = color_map_len ();
|
||||
size_t i;
|
||||
|
||||
use_colors = TRUE;
|
||||
|
||||
start_color ();
|
||||
use_default_colors ();
|
||||
|
||||
configure_colors ();
|
||||
|
||||
if (map_len > MAX_PAIRS) {
|
||||
/* This message should only be seen by the developers */
|
||||
fprintf (stderr,
|
||||
"Too many defined colors, resize MAX_PAIRS on color.c");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* Use default terminal colors */
|
||||
mc_init_pair (DEFAULT_COLOR_INDEX, -1, -1);
|
||||
|
||||
for (i = 0; i < map_len; i++)
|
||||
if (color_map [i].name != NULL) {
|
||||
mc_init_pair (i + 1, color_map_fg (i), color_map_bg (i));
|
||||
/*
|
||||
* ncurses doesn't remember bold attribute in the color pairs,
|
||||
* so we should keep track of it in a separate array.
|
||||
*/
|
||||
attr_pairs [i + 1] = color_map [i].fg & A_BOLD;
|
||||
}
|
||||
use_colors = TRUE;
|
||||
start_color ();
|
||||
use_default_colors ();
|
||||
}
|
||||
|
||||
mc_tty_color_color_pair_attrs = g_hash_table_new_full
|
||||
(g_int_hash, g_int_equal, mc_tty_color_attr_destroy_cb, mc_tty_color_attr_destroy_cb);
|
||||
}
|
||||
|
||||
/* Functions necessary to implement syntax highlighting */
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
mc_init_pair (int index, CTYPE foreground, CTYPE background)
|
||||
tty_color_deinit_lib (void)
|
||||
{
|
||||
init_pair (index, foreground, background == 0 ? -1 : background);
|
||||
if (index > max_index)
|
||||
max_index = index;
|
||||
g_hash_table_destroy (mc_tty_color_color_pair_attrs);
|
||||
mc_tty_color_color_pair_attrs = NULL;
|
||||
}
|
||||
|
||||
int
|
||||
tty_try_alloc_color_pair (const char *fg, const char *bg)
|
||||
{
|
||||
int fg_index, bg_index;
|
||||
int bold_attr;
|
||||
struct colors_avail *p = &c;
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
c.index = EDITOR_NORMAL_COLOR_INDEX;
|
||||
for (;;) {
|
||||
if (((fg && p->fg) ? !strcmp (fg, p->fg) : fg == p->fg) != 0
|
||||
&& ((bg && p->bg) ? !strcmp (bg, p->bg) : bg == p->bg) != 0)
|
||||
return p->index;
|
||||
if (!p->next)
|
||||
break;
|
||||
p = p->next;
|
||||
void
|
||||
tty_color_try_alloc_pair_lib (tty_color_pair_t * mc_color_pair)
|
||||
{
|
||||
if (mc_color_pair->ifg <= (int) SPEC_A_REVERSE) {
|
||||
switch (mc_color_pair->ifg) {
|
||||
case SPEC_A_REVERSE:
|
||||
mc_tty_color_pair_init_special (mc_color_pair,
|
||||
COLOR_BLACK, COLOR_WHITE,
|
||||
COLOR_BLACK, COLOR_WHITE | A_BOLD, A_REVERSE);
|
||||
break;
|
||||
case SPEC_A_BOLD:
|
||||
mc_tty_color_pair_init_special (mc_color_pair,
|
||||
COLOR_WHITE, COLOR_BLACK,
|
||||
COLOR_WHITE, COLOR_BLACK, A_BOLD);
|
||||
break;
|
||||
case SPEC_A_BOLD_REVERSE:
|
||||
|
||||
mc_tty_color_pair_init_special (mc_color_pair,
|
||||
COLOR_WHITE, COLOR_WHITE,
|
||||
COLOR_WHITE, COLOR_WHITE, A_BOLD | A_REVERSE);
|
||||
break;
|
||||
case SPEC_A_UNDERLINE:
|
||||
mc_tty_color_pair_init_special (mc_color_pair,
|
||||
COLOR_WHITE, COLOR_BLACK,
|
||||
COLOR_WHITE, COLOR_BLACK, A_UNDERLINE);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
init_pair (mc_color_pair->pair_index,
|
||||
mc_tty_color_save_attr_lib (mc_color_pair->pair_index,
|
||||
mc_color_pair->ifg) & COLOR_WHITE,
|
||||
mc_color_pair->ibg & COLOR_WHITE);
|
||||
}
|
||||
p->next = g_new (struct colors_avail, 1);
|
||||
p = p->next;
|
||||
p->next = 0;
|
||||
p->fg = fg ? g_strdup (fg) : 0;
|
||||
p->bg = bg ? g_strdup (bg) : 0;
|
||||
if (!fg)
|
||||
/* Index in color_map array = COLOR_INDEX - 1 */
|
||||
fg_index = color_map[EDITOR_NORMAL_COLOR_INDEX - 1].fg;
|
||||
else
|
||||
get_color (fg, &fg_index);
|
||||
|
||||
if (!bg)
|
||||
bg_index = color_map[EDITOR_NORMAL_COLOR_INDEX - 1].bg;
|
||||
else
|
||||
get_color (bg, &bg_index);
|
||||
|
||||
bold_attr = fg_index & A_BOLD;
|
||||
fg_index = fg_index & COLOR_WHITE;
|
||||
bg_index = bg_index & COLOR_WHITE;
|
||||
|
||||
p->index = alloc_color_pair (fg_index, bg_index);
|
||||
attr_pairs [p->index] = bold_attr;
|
||||
return p->index;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
tty_setcolor (int color)
|
||||
{
|
||||
attrset (color);
|
||||
attrset (COLOR_PAIR (color) | color_get_attr (color));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
tty_lowlevel_setcolor (int color)
|
||||
{
|
||||
attrset (MY_COLOR_PAIR (color));
|
||||
attrset (COLOR_PAIR (color) | color_get_attr (color));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
tty_set_normal_attrs (void)
|
||||
{
|
||||
standend ();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -1,23 +0,0 @@
|
||||
|
||||
/** \file color-ncurses.h
|
||||
* \brief Header: NCurses-specific color setup
|
||||
*/
|
||||
|
||||
#ifndef MC_COLOR_NCURSES_H
|
||||
#define MC_COLOR_NCURSES_H
|
||||
|
||||
#include "../../src/tty/tty-ncurses.h" /* NCurses headers */
|
||||
|
||||
gboolean tty_use_colors ();
|
||||
|
||||
#define MAX_PAIRS 64
|
||||
extern int attr_pairs [MAX_PAIRS];
|
||||
|
||||
#define MY_COLOR_PAIR(x) (COLOR_PAIR (x) | attr_pairs [x])
|
||||
#define IF_COLOR(co, bw) (tty_use_colors () ? MY_COLOR_PAIR (co) : bw)
|
||||
|
||||
#define MARKED_SELECTED_COLOR IF_COLOR (4, A_REVERSE | A_BOLD)
|
||||
|
||||
void mc_init_pair (int index, int foreground, int background);
|
||||
|
||||
#endif /* MC_COLOR_NCURSES_H */
|
@ -28,153 +28,131 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h> /* size_t */
|
||||
#include <sys/types.h> /* size_t */
|
||||
|
||||
#include "../../src/global.h"
|
||||
|
||||
#include "../../src/tty/tty-slang.h"
|
||||
#include "../../src/tty/color.h" /* variables */
|
||||
#include "../../src/tty/color.h" /* variables */
|
||||
#include "../../src/tty/color-internal.h"
|
||||
|
||||
#include "../../src/setup.h" /* color_terminal_string */
|
||||
#include "../../src/setup.h" /* color_terminal_string */
|
||||
|
||||
static int
|
||||
has_colors (gboolean disable, gboolean force)
|
||||
{
|
||||
mc_tty_color_disable = disable;
|
||||
|
||||
if (force || (getenv ("COLORTERM") != NULL))
|
||||
SLtt_Use_Ansi_Colors = 1;
|
||||
SLtt_Use_Ansi_Colors = 1;
|
||||
|
||||
/* We want to allow overwriding */
|
||||
if (!disable) {
|
||||
const char *terminal = getenv ("TERM");
|
||||
const size_t len = strlen (terminal);
|
||||
if (!mc_tty_color_disable) {
|
||||
const char *terminal = getenv ("TERM");
|
||||
const size_t len = strlen (terminal);
|
||||
|
||||
char *cts = color_terminal_string;
|
||||
char *s;
|
||||
size_t i;
|
||||
char *cts = color_terminal_string;
|
||||
char *s;
|
||||
size_t i;
|
||||
|
||||
/* check color_terminal_string */
|
||||
while (*cts != '\0') {
|
||||
while (*cts == ' ' || *cts == '\t')
|
||||
cts++;
|
||||
s = cts;
|
||||
i = 0;
|
||||
/* check color_terminal_string */
|
||||
while (*cts != '\0') {
|
||||
while (*cts == ' ' || *cts == '\t')
|
||||
cts++;
|
||||
s = cts;
|
||||
i = 0;
|
||||
|
||||
while (*cts != '\0' && *cts != ',') {
|
||||
cts++;
|
||||
i++;
|
||||
}
|
||||
while (*cts != '\0' && *cts != ',') {
|
||||
cts++;
|
||||
i++;
|
||||
}
|
||||
|
||||
if ((i != 0) && (i == len) && (strncmp (s, terminal, i) == 0))
|
||||
SLtt_Use_Ansi_Colors = 1;
|
||||
if ((i != 0) && (i == len) && (strncmp (s, terminal, i) == 0))
|
||||
SLtt_Use_Ansi_Colors = 1;
|
||||
|
||||
if (*cts == ',')
|
||||
cts++;
|
||||
}
|
||||
if (*cts == ',')
|
||||
cts++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Setup emulated colors */
|
||||
if (SLtt_Use_Ansi_Colors != 0) {
|
||||
if (!disable) {
|
||||
mc_init_pair (A_REVERSE, "black", "white");
|
||||
mc_init_pair (A_BOLD, "white", "black");
|
||||
} else {
|
||||
mc_init_pair (A_REVERSE, "black", "lightgray");
|
||||
mc_init_pair (A_BOLD, "white", "black");
|
||||
mc_init_pair (A_BOLD_REVERSE, "white", "lightgray");
|
||||
}
|
||||
} else {
|
||||
SLtt_set_mono (A_BOLD, NULL, SLTT_BOLD_MASK);
|
||||
SLtt_set_mono (A_REVERSE, NULL, SLTT_REV_MASK);
|
||||
SLtt_set_mono (A_BOLD | A_REVERSE, NULL, SLTT_BOLD_MASK | SLTT_REV_MASK);
|
||||
}
|
||||
|
||||
return SLtt_Use_Ansi_Colors;
|
||||
}
|
||||
|
||||
static void
|
||||
mc_tty_color_pair_init_special (tty_color_pair_t * mc_color_pair,
|
||||
const char *fg1, const char *bg1,
|
||||
const char *fg2, const char *bg2, SLtt_Char_Type mask)
|
||||
{
|
||||
if (SLtt_Use_Ansi_Colors != 0) {
|
||||
if (!mc_tty_color_disable) {
|
||||
SLtt_set_color (mc_color_pair->pair_index, (char *) "", (char *) fg1, (char *) bg1);
|
||||
} else {
|
||||
SLtt_set_color (mc_color_pair->pair_index, (char *) "", (char *) fg2, (char *) bg2);
|
||||
}
|
||||
} else {
|
||||
SLtt_set_mono (mc_color_pair->pair_index, NULL, mask);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tty_init_colors (gboolean disable, gboolean force)
|
||||
tty_color_init_lib (gboolean disable, gboolean force)
|
||||
{
|
||||
/* FIXME: if S-Lang is used, has_colors() must be called regardless
|
||||
of whether we are interested in its result */
|
||||
if (has_colors (disable, force) && !disable) {
|
||||
const size_t map_len = color_map_len ();
|
||||
size_t i;
|
||||
|
||||
use_colors = TRUE;
|
||||
|
||||
configure_colors ();
|
||||
|
||||
/*
|
||||
* We are relying on undocumented feature of
|
||||
* S-Lang to make COLOR_PAIR(DEFAULT_COLOR_INDEX)
|
||||
* the default fg/bg of the terminal.
|
||||
* Hopefully, future versions of S-Lang will
|
||||
* document this feature.
|
||||
*/
|
||||
SLtt_set_color (DEFAULT_COLOR_INDEX, NULL, (char *) "default", (char *) "default");
|
||||
|
||||
for (i = 0; i < map_len; i++)
|
||||
if (color_map [i].name != NULL)
|
||||
mc_init_pair (i + 1, color_map_fg(i), color_map_bg(i));
|
||||
use_colors = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Functions necessary to implement syntax highlighting */
|
||||
void
|
||||
mc_init_pair (int index, CTYPE foreground, CTYPE background)
|
||||
tty_color_deinit_lib (void)
|
||||
{
|
||||
if (!background)
|
||||
background = "default";
|
||||
|
||||
if (!foreground)
|
||||
foreground = "default";
|
||||
|
||||
SLtt_set_color (index, (char *) "", (char *) foreground, (char *) background);
|
||||
if (index > max_index)
|
||||
max_index = index;
|
||||
}
|
||||
|
||||
int
|
||||
tty_try_alloc_color_pair (const char *fg, const char *bg)
|
||||
void
|
||||
tty_color_try_alloc_pair_lib (tty_color_pair_t * mc_color_pair)
|
||||
{
|
||||
struct colors_avail *p = &c;
|
||||
const char *fg, *bg;
|
||||
if (mc_color_pair->ifg <= (int) SPEC_A_REVERSE) {
|
||||
switch (mc_color_pair->ifg) {
|
||||
case SPEC_A_REVERSE:
|
||||
mc_tty_color_pair_init_special (mc_color_pair,
|
||||
"black", "white", "black", "lightgray", SLTT_REV_MASK);
|
||||
break;
|
||||
case SPEC_A_BOLD:
|
||||
mc_tty_color_pair_init_special (mc_color_pair,
|
||||
"white", "black", "white", "black", SLTT_BOLD_MASK);
|
||||
break;
|
||||
case SPEC_A_BOLD_REVERSE:
|
||||
|
||||
c.index = EDITOR_NORMAL_COLOR_INDEX;
|
||||
for (;;) {
|
||||
if (((fg && p->fg) ? (strcmp (fg, p->fg) == 0) : (fg == p->fg)) != 0
|
||||
&& ((bg && p->bg) ? (strcmp (bg, p->bg) == 0) : (bg == p->bg)) != 0)
|
||||
return p->index;
|
||||
if (p->next == NULL)
|
||||
break;
|
||||
p = p->next;
|
||||
mc_tty_color_pair_init_special (mc_color_pair,
|
||||
"white", "white",
|
||||
"white", "white", SLTT_BOLD_MASK | SLTT_REV_MASK);
|
||||
break;
|
||||
case SPEC_A_UNDERLINE:
|
||||
mc_tty_color_pair_init_special (mc_color_pair,
|
||||
"white", "black", "white", "black", SLTT_ULINE_MASK);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
fg = (mc_color_pair->cfg) ? mc_color_pair->cfg : "default";
|
||||
bg = (mc_color_pair->cbg) ? mc_color_pair->cbg : "default";
|
||||
SLtt_set_color (mc_color_pair->pair_index, (char *) "", (char *) fg, (char *) bg);
|
||||
}
|
||||
p->next = g_new (struct colors_avail, 1);
|
||||
p = p->next;
|
||||
p->next = NULL;
|
||||
p->fg = fg ? g_strdup (fg) : NULL;
|
||||
p->bg = bg ? g_strdup (bg) : NULL;
|
||||
if (fg == NULL)
|
||||
/* Index in color_map array = COLOR_INDEX - 1 */
|
||||
fg = color_map[EDITOR_NORMAL_COLOR_INDEX - 1].fg;
|
||||
if (bg == NULL)
|
||||
bg = color_map[EDITOR_NORMAL_COLOR_INDEX - 1].bg;
|
||||
p->index = alloc_color_pair (fg, bg);
|
||||
return p->index;
|
||||
}
|
||||
|
||||
void
|
||||
tty_setcolor (int color)
|
||||
{
|
||||
if (!SLtt_Use_Ansi_Colors)
|
||||
SLsmg_set_color (color);
|
||||
SLsmg_set_color (color);
|
||||
else if ((color & A_BOLD) != 0) {
|
||||
if (color == A_BOLD)
|
||||
SLsmg_set_color (A_BOLD);
|
||||
else
|
||||
SLsmg_set_color ((color & (~A_BOLD)) + 8);
|
||||
} else
|
||||
SLsmg_set_color (color);
|
||||
if (color == A_BOLD)
|
||||
SLsmg_set_color (A_BOLD);
|
||||
else
|
||||
SLsmg_set_color ((color & (~A_BOLD)) + 8);
|
||||
} else if (color == A_REVERSE)
|
||||
SLsmg_set_color (A_REVERSE);
|
||||
else
|
||||
SLsmg_set_color (color);
|
||||
}
|
||||
|
||||
/* Set colorpair by index, don't interpret S-Lang "emulated attributes" */
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifndef MC_COLOR_SLANG_H
|
||||
#define MC_COLOR_SLANG_H
|
||||
|
||||
#include "../../src/tty/tty-slang.h" /* S-Lang headers */
|
||||
#include "../../src/tty/tty-slang.h" /* S-Lang headers */
|
||||
|
||||
enum {
|
||||
COLOR_BLACK = 0,
|
||||
@ -31,14 +31,4 @@ enum {
|
||||
# define A_NORMAL 0x00
|
||||
#endif
|
||||
|
||||
gboolean tty_use_colors ();
|
||||
|
||||
#define COLOR_PAIR(x) x
|
||||
|
||||
#define IF_COLOR(co, bw) (tty_use_colors () ? COLOR_PAIR (co) : bw)
|
||||
|
||||
#define MARKED_SELECTED_COLOR IF_COLOR (4, (SLtt_Use_Ansi_Colors ? A_BOLD_REVERSE : A_REVERSE | A_BOLD))
|
||||
|
||||
void mc_init_pair (int index, const char *foreground, const char *background);
|
||||
|
||||
#endif /* MC_COLOR_SLANG_H */
|
||||
#endif /* MC_COLOR_SLANG_H */
|
||||
|
275
src/tty/color.c
275
src/tty/color.c
@ -1,9 +1,12 @@
|
||||
/* Color setup
|
||||
/* Color setup.
|
||||
Interface functions.
|
||||
|
||||
Copyright (C) 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||
2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2009.
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
|
||||
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
|
||||
@ -28,125 +31,225 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h> /* size_t */
|
||||
#include <sys/types.h> /* size_t */
|
||||
|
||||
#include "../../src/global.h"
|
||||
|
||||
#include "../../src/tty/tty.h"
|
||||
#include "../../src/tty/color.h"
|
||||
|
||||
#include "../../src/tty/color-internal.h"
|
||||
|
||||
#include "../../src/setup.h" /* setup_color_string, term_color_string */
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
char *command_line_colors = NULL;
|
||||
|
||||
static char *tty_color_defaults__fg = NULL;
|
||||
static char *tty_color_defaults__bg = NULL;
|
||||
|
||||
/* Set if we are actually using colors */
|
||||
gboolean use_colors = FALSE;
|
||||
|
||||
struct colors_avail c;
|
||||
int max_index = 0;
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
void
|
||||
get_color (const char *cpp, CTYPE *colp)
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
||||
static GHashTable *mc_tty_color__hashtable = NULL;
|
||||
|
||||
/*** file scope functions ************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static inline void
|
||||
color_hash_destroy_key (gpointer data)
|
||||
{
|
||||
const size_t table_len = color_table_len ();
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < table_len; i++)
|
||||
if (strcmp (cpp, color_name (i)) == 0) {
|
||||
*colp = color_value (i);
|
||||
break;
|
||||
}
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
configure_colors_string (const char *the_color_string)
|
||||
color_hash_destroy_value (gpointer data)
|
||||
{
|
||||
const size_t map_len = color_map_len ();
|
||||
|
||||
size_t i;
|
||||
char **color_strings, **p;
|
||||
|
||||
if (!the_color_string)
|
||||
return;
|
||||
|
||||
color_strings = g_strsplit (the_color_string, ":", -1);
|
||||
|
||||
p = color_strings;
|
||||
|
||||
while ((p != NULL) && (*p != NULL)) {
|
||||
char **cfb; /* color, fore, back */
|
||||
/* cfb[0] - entry name
|
||||
* cfb[1] - fore color
|
||||
* cfb[2] - back color
|
||||
*/
|
||||
char *e;
|
||||
|
||||
cfb = g_strsplit_set (*p, "=,", 3);
|
||||
p++;
|
||||
|
||||
if (cfb[0] == NULL) {
|
||||
g_strfreev (cfb);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* append '=' to the entry name */
|
||||
e = g_strdup_printf ("%s=", cfb[0]);
|
||||
g_free (cfb[0]);
|
||||
cfb[0] = e;
|
||||
|
||||
for (i = 0; i < map_len; i++)
|
||||
if (color_map [i].name != NULL) {
|
||||
size_t klen = strlen (color_map [i].name);
|
||||
|
||||
if (strncmp (cfb[0], color_map [i].name, klen) == 0) {
|
||||
if ((cfb[1] != NULL) && (*cfb[1] != '\0'))
|
||||
get_color (cfb[1], &color_map [i].fg);
|
||||
if ((cfb[2] != NULL) && (*cfb[2] != '\0'))
|
||||
get_color (cfb[2], &color_map [i].bg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_strfreev (cfb);
|
||||
}
|
||||
|
||||
g_strfreev (color_strings);
|
||||
tty_color_pair_t *mc_color_pair = (tty_color_pair_t *) data;
|
||||
g_free (mc_color_pair);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static gboolean
|
||||
tty_color_free_condition_cb (gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
gboolean is_temp_color;
|
||||
tty_color_pair_t *mc_color_pair;
|
||||
(void) key;
|
||||
|
||||
is_temp_color = (gboolean) user_data;
|
||||
mc_color_pair = (tty_color_pair_t *) value;
|
||||
return (mc_color_pair->is_temp == is_temp_color);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
tty_color_free_all (gboolean is_temp_color)
|
||||
{
|
||||
g_hash_table_foreach_remove (mc_tty_color__hashtable, tty_color_free_condition_cb,
|
||||
(gpointer) is_temp_color);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static gboolean
|
||||
tty_color_get_next_cpn_cb (gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
int cp;
|
||||
tty_color_pair_t *mc_color_pair;
|
||||
(void) key;
|
||||
|
||||
cp = (int) user_data;
|
||||
mc_color_pair = (tty_color_pair_t *) value;
|
||||
|
||||
if (cp == mc_color_pair->pair_index)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
tty_color_get_next__color_pair_number ()
|
||||
{
|
||||
int cp_count = g_hash_table_size (mc_tty_color__hashtable);
|
||||
int cp = 0;
|
||||
|
||||
for (cp = 0; cp < cp_count; cp++) {
|
||||
if (g_hash_table_find (mc_tty_color__hashtable, tty_color_get_next_cpn_cb, (gpointer) cp) ==
|
||||
NULL)
|
||||
return cp;
|
||||
}
|
||||
return cp;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
configure_colors (void)
|
||||
tty_init_colors (gboolean disable, gboolean force)
|
||||
{
|
||||
configure_colors_string (default_colors);
|
||||
configure_colors_string (setup_color_string);
|
||||
configure_colors_string (term_color_string);
|
||||
configure_colors_string (getenv ("MC_COLOR_TABLE"));
|
||||
configure_colors_string (command_line_colors);
|
||||
tty_color_init_lib (disable, force);
|
||||
mc_tty_color__hashtable = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
color_hash_destroy_key,
|
||||
color_hash_destroy_value);
|
||||
}
|
||||
|
||||
int
|
||||
alloc_color_pair (CTYPE foreground, CTYPE background)
|
||||
{
|
||||
mc_init_pair (++max_index, foreground, background);
|
||||
return max_index;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
tty_colors_done (void)
|
||||
{
|
||||
struct colors_avail *p, *next;
|
||||
tty_color_deinit_lib ();
|
||||
g_free (tty_color_defaults__fg);
|
||||
g_free (tty_color_defaults__bg);
|
||||
|
||||
for (p = c.next; p != NULL; p = next) {
|
||||
next = p->next;
|
||||
g_free (p->fg);
|
||||
g_free (p->bg);
|
||||
g_free (p);
|
||||
}
|
||||
c.next = NULL;
|
||||
g_hash_table_destroy (mc_tty_color__hashtable);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
tty_use_colors (void)
|
||||
{
|
||||
return use_colors;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
tty_try_alloc_color_pair2 (const char *fg, const char *bg, gboolean is_temp_color)
|
||||
{
|
||||
gchar *color_pair;
|
||||
tty_color_pair_t *mc_color_pair;
|
||||
const char *c_fg, *c_bg;
|
||||
|
||||
if (fg == NULL)
|
||||
fg = tty_color_defaults__fg;
|
||||
|
||||
if (bg == NULL) {
|
||||
bg = tty_color_defaults__bg;
|
||||
}
|
||||
c_fg = tty_color_get_valid_name (fg);
|
||||
c_bg = tty_color_get_valid_name (bg);
|
||||
|
||||
color_pair = g_strdup_printf ("%s.%s", c_fg, c_bg);
|
||||
if (color_pair == NULL)
|
||||
return 0;
|
||||
|
||||
mc_color_pair =
|
||||
(tty_color_pair_t *) g_hash_table_lookup (mc_tty_color__hashtable, (gpointer) color_pair);
|
||||
|
||||
if (mc_color_pair != NULL) {
|
||||
g_free (color_pair);
|
||||
return mc_color_pair->pair_index;
|
||||
}
|
||||
|
||||
mc_color_pair = g_new0 (tty_color_pair_t, 1);
|
||||
if (mc_color_pair == NULL) {
|
||||
g_free (color_pair);
|
||||
return 0;
|
||||
}
|
||||
|
||||
mc_color_pair->is_temp = is_temp_color;
|
||||
mc_color_pair->cfg = c_fg;
|
||||
mc_color_pair->cbg = c_bg;
|
||||
mc_color_pair->ifg = tty_color_get_index_by_name (c_fg);
|
||||
mc_color_pair->ibg = tty_color_get_index_by_name (c_bg);
|
||||
mc_color_pair->pair_index = tty_color_get_next__color_pair_number ();
|
||||
|
||||
tty_color_try_alloc_pair_lib (mc_color_pair);
|
||||
|
||||
g_hash_table_insert (mc_tty_color__hashtable, (gpointer) color_pair, (gpointer) mc_color_pair);
|
||||
|
||||
return mc_color_pair->pair_index;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
tty_try_alloc_color_pair (const char *fg, const char *bg)
|
||||
{
|
||||
return tty_try_alloc_color_pair2 (fg, bg, TRUE);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
tty_color_free_all_tmp (void)
|
||||
{
|
||||
tty_color_free_all (TRUE);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
tty_color_free_all_non_tmp (void)
|
||||
{
|
||||
tty_color_free_all (FALSE);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
tty_color_set_defaults (const char *fgcolor, const char *bgcolor)
|
||||
{
|
||||
g_free (tty_color_defaults__fg);
|
||||
g_free (tty_color_defaults__fg);
|
||||
|
||||
tty_color_defaults__fg = (fgcolor != NULL) ? g_strdup (fgcolor) : NULL;
|
||||
tty_color_defaults__bg = (bgcolor != NULL) ? g_strdup (bgcolor) : NULL;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -1,81 +1,43 @@
|
||||
|
||||
/** \file color.h
|
||||
* \brief Header: color setup
|
||||
*
|
||||
* PLEASE FORGOT ABOUT tty/color.h!
|
||||
* Use skin engine for getting needed color pairs.
|
||||
*
|
||||
* edit/syntax.c may use this file directly, I'm agree. :)
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MC_COLOR_H
|
||||
#define MC_COLOR_H
|
||||
|
||||
#include "../../src/global.h" /* glib.h */
|
||||
#include "../../src/global.h" /* glib.h */
|
||||
|
||||
#ifdef HAVE_SLANG
|
||||
# include "../../src/tty/color-slang.h"
|
||||
#else
|
||||
# include "../../src/tty/color-ncurses.h"
|
||||
# include "../../src/tty/tty-ncurses.h"
|
||||
#endif
|
||||
|
||||
/* Beware! When using Slang with color, not all the indexes are free.
|
||||
See color-slang.h (A_*) */
|
||||
#define NORMAL_COLOR IF_COLOR (1, 0)
|
||||
#define SELECTED_COLOR IF_COLOR (2, A_REVERSE)
|
||||
#define MARKED_COLOR IF_COLOR (3, A_BOLD)
|
||||
/* MARKED_SELECTED_COLOR is screen library specific */
|
||||
#define ERROR_COLOR IF_COLOR (5, A_BOLD)
|
||||
#define MENU_ENTRY_COLOR IF_COLOR (6, A_REVERSE)
|
||||
#define REVERSE_COLOR IF_COLOR (7, A_REVERSE)
|
||||
|
||||
/* Dialog colors */
|
||||
#define COLOR_NORMAL IF_COLOR (8, A_REVERSE)
|
||||
#define COLOR_FOCUS IF_COLOR (9, A_BOLD)
|
||||
#define COLOR_HOT_NORMAL IF_COLOR (10, 0)
|
||||
#define COLOR_HOT_FOCUS IF_COLOR (11, 0)
|
||||
|
||||
#define VIEW_UNDERLINED_COLOR IF_COLOR (12, A_UNDERLINE)
|
||||
#define MENU_SELECTED_COLOR IF_COLOR (13, A_BOLD)
|
||||
#define MENU_HOT_COLOR IF_COLOR (14, 0)
|
||||
#define MENU_HOTSEL_COLOR IF_COLOR (15, 0)
|
||||
|
||||
#define HELP_NORMAL_COLOR IF_COLOR (16, A_REVERSE)
|
||||
#define HELP_ITALIC_COLOR IF_COLOR (17, A_REVERSE)
|
||||
#define HELP_BOLD_COLOR IF_COLOR (18, A_REVERSE)
|
||||
#define HELP_LINK_COLOR IF_COLOR (19, 0)
|
||||
#define HELP_SLINK_COLOR IF_COLOR (20, A_BOLD)
|
||||
|
||||
/*
|
||||
* This should be selectable independently. Default has to be black background
|
||||
* foreground does not matter at all.
|
||||
*/
|
||||
#define GAUGE_COLOR IF_COLOR (21, 0)
|
||||
#define INPUT_COLOR IF_COLOR (22, 0)
|
||||
|
||||
/* For the default color any unused index may be chosen. */
|
||||
#define DEFAULT_COLOR_INDEX 23
|
||||
#define DEFAULT_COLOR IF_COLOR (DEFAULT_COLOR_INDEX, 0)
|
||||
|
||||
/*
|
||||
* editor colors - only 4 for normal, search->found, select, and whitespace
|
||||
* respectively
|
||||
* Last is defined to view color.
|
||||
*/
|
||||
#define EDITOR_NORMAL_COLOR_INDEX 27
|
||||
#define EDITOR_NORMAL_COLOR IF_COLOR (EDITOR_NORMAL_COLOR_INDEX, 0)
|
||||
#define EDITOR_BOLD_COLOR IF_COLOR (28, A_BOLD)
|
||||
#define EDITOR_MARKED_COLOR IF_COLOR (29, A_REVERSE)
|
||||
#define EDITOR_WHITESPACE_COLOR IF_COLOR (30, 0 /* irrelevant */)
|
||||
|
||||
/* color of left 8 char status per line */
|
||||
#define LINE_STATE_COLOR IF_COLOR (31, 0)
|
||||
|
||||
/* Error dialog colors */
|
||||
#define ERROR_HOT_NORMAL IF_COLOR (32, 0)
|
||||
#define ERROR_HOT_FOCUS IF_COLOR (43, 0)
|
||||
extern char *command_line_colors;
|
||||
|
||||
void tty_init_colors (gboolean disable, gboolean force);
|
||||
void tty_colors_done (void);
|
||||
|
||||
gboolean tty_use_colors (void);
|
||||
int tty_try_alloc_color_pair (const char *fg, const char *bg);
|
||||
int tty_try_alloc_color_pair (const char *, const char *);
|
||||
int tty_try_alloc_color_pair2 (const char *, const char *, gboolean);
|
||||
|
||||
void tty_color_free_all_tmp (void);
|
||||
void tty_color_free_all_non_tmp (void);
|
||||
|
||||
void tty_setcolor (int color);
|
||||
void tty_lowlevel_setcolor (int color);
|
||||
void tty_set_normal_attrs (void);
|
||||
|
||||
#endif /* MC_COLOR_H */
|
||||
void tty_color_set_defaults (const char *, const char *);
|
||||
|
||||
#define ALLOC_COLOR_PAIR_INDEX 1
|
||||
|
||||
#endif /* MC_COLOR_H */
|
||||
|
1720
src/tty/key.c
1720
src/tty/key.c
File diff suppressed because it is too large
Load Diff
@ -6,10 +6,10 @@
|
||||
#ifndef MC_KEY_H
|
||||
#define MC_KEY_H
|
||||
|
||||
#include "../../src/global.h" /* <glib.h> */
|
||||
#include "../../src/dialog.h" /* cb_ret_t */
|
||||
#include "../../src/global.h" /* <glib.h> */
|
||||
#include "../../src/dialog.h" /* cb_ret_t */
|
||||
|
||||
#include "../../src/tty/tty.h" /* KEY_F macro */
|
||||
#include "../../src/tty/tty.h" /* KEY_F macro */
|
||||
|
||||
gboolean define_sequence (int code, const char *seq, int action);
|
||||
|
||||
@ -20,8 +20,7 @@ void done_key (void);
|
||||
/* Keys management */
|
||||
typedef void (*move_fn) (void *data, int param);
|
||||
cb_ret_t check_movement_keys (int key, int page_size, void *data,
|
||||
move_fn backfn, move_fn forfn,
|
||||
move_fn topfn, move_fn bottomfn);
|
||||
move_fn backfn, move_fn forfn, move_fn topfn, move_fn bottomfn);
|
||||
int lookup_keyname (char *keyname);
|
||||
int lookup_key (char *keyname);
|
||||
|
||||
@ -31,7 +30,7 @@ typedef const struct {
|
||||
const char *longname;
|
||||
} key_code_name_t;
|
||||
|
||||
extern key_code_name_t key_name_conv_tab [];
|
||||
extern key_code_name_t key_name_conv_tab[];
|
||||
|
||||
/* mouse support */
|
||||
struct Gpm_Event;
|
||||
@ -62,7 +61,7 @@ extern int mou_auto_repeat;
|
||||
typedef int (*select_fn) (int fd, void *info);
|
||||
|
||||
/* Channel manipulation */
|
||||
void add_select_channel (int fd, select_fn callback, void *info);
|
||||
void add_select_channel (int fd, select_fn callback, void *info);
|
||||
void delete_select_channel (int fd);
|
||||
void remove_select_channel (int fd);
|
||||
|
||||
@ -77,7 +76,7 @@ static inline gboolean
|
||||
is_abort_char (int c)
|
||||
{
|
||||
return ((c == XCTRL ('c')) || (c == XCTRL ('g'))
|
||||
|| (c == ESC_CHAR) || (c == KEY_F (10)));
|
||||
|| (c == ESC_CHAR) || (c == KEY_F (10)));
|
||||
}
|
||||
|
||||
/* To define sequences and return codes */
|
||||
@ -101,4 +100,4 @@ int get_key_code (int nodelay);
|
||||
void numeric_keypad_mode (void);
|
||||
void application_keypad_mode (void);
|
||||
|
||||
#endif /* MC_KEY_H */
|
||||
#endif /* MC_KEY_H */
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include "../../src/global.h"
|
||||
|
||||
#include "../../src/tty/tty.h"
|
||||
#include "../../src/tty/mouse.h" /* required before key.h */
|
||||
#include "../../src/tty/mouse.h" /* required before key.h */
|
||||
#include "../../src/tty/key.h"
|
||||
|
||||
#if defined (__QNX__) && !defined (__QNXNTO__)
|
||||
@ -61,11 +61,11 @@
|
||||
|
||||
/* include QNX/term.h (not NCURSES/term.h!) */
|
||||
#if __WATCOMC__ > 1000
|
||||
#include <sys/term.h>
|
||||
#include <sys/term.h>
|
||||
#else
|
||||
#include <term.h>
|
||||
#include <term.h>
|
||||
#endif
|
||||
#include <stdlib.h> /* getenv() */
|
||||
#include <stdlib.h> /* getenv() */
|
||||
|
||||
/* fieldname -> index conversion */
|
||||
#define __QTISX(_qtisn) \
|
||||
@ -73,14 +73,14 @@
|
||||
|
||||
/* define the OS/implementation-specific __TK() format */
|
||||
#define __TK(_tis,_tcs,_tisx,_qtisn) __QTISX(_qtisn)
|
||||
|
||||
|
||||
#endif /* __USE_QNX_TI */
|
||||
|
||||
|
||||
#endif /* HAVE_QNX_KEYS */
|
||||
|
||||
|
||||
/* {{{ */
|
||||
|
||||
|
||||
/* general key definitions:
|
||||
*
|
||||
* format:
|
||||
@ -90,7 +90,7 @@
|
||||
* index in the terminfo string table (ncurses),
|
||||
* field name in the QNX terminfo strings struct
|
||||
*/
|
||||
|
||||
|
||||
#define Key_backspace __TK("kbs", "kb", 55, _ky_backspace )
|
||||
#define Key_catab __TK("ktbc", "ka", 56, _ky_catab )
|
||||
#define Key_clear __TK("kclr", "kC", 57, _ky_clear )
|
||||
@ -247,7 +247,7 @@
|
||||
|
||||
/* don't force pre-defining of base keys under QNX */
|
||||
#define FORCE_BASE_KEY_DEFS 0
|
||||
|
||||
|
||||
/* OS specific key aliases */
|
||||
#define Key_alt_a Key_clear
|
||||
#define Key_alt_b Key_stab
|
||||
@ -279,11 +279,11 @@
|
||||
#define Key_ctl_enter Key_enter
|
||||
#define Key_ctl_tab Key_ctab
|
||||
|
||||
#define Key_alt_tab Key_ctl_tab /* map ALT-TAB to CTRL-TAB */
|
||||
#define Key_alt_enter Key_ctl_enter /* map ALT-ENTER to CTRL-ENTER */
|
||||
#define Key_alt_tab Key_ctl_tab /* map ALT-TAB to CTRL-TAB */
|
||||
#define Key_alt_enter Key_ctl_enter /* map ALT-ENTER to CTRL-ENTER */
|
||||
|
||||
#ifdef __USE_QNX_TI
|
||||
|
||||
|
||||
/* OS/implementation specific key-define struct */
|
||||
typedef const struct qnx_key_define_s {
|
||||
int mc_code;
|
||||
@ -307,70 +307,70 @@ typedef const struct qnx_key_define_s {
|
||||
/* general key define table */
|
||||
xtra_key_define_t xtra_key_defines[] = {
|
||||
#if FORCE_BASE_KEY_DEFS
|
||||
{KEY_BACKSPACE,Key_backspace},
|
||||
{KEY_LEFT, Key_left },
|
||||
{KEY_RIGHT, Key_right },
|
||||
{KEY_UP, Key_up },
|
||||
{KEY_DOWN, Key_down },
|
||||
{KEY_NPAGE, Key_npage },
|
||||
{KEY_PPAGE, Key_ppage },
|
||||
{KEY_HOME, Key_home },
|
||||
{KEY_END, Key_end },
|
||||
{KEY_DC, Key_dc },
|
||||
{KEY_IC, Key_ic },
|
||||
{KEY_F(1), Key_f1 },
|
||||
{KEY_F(2), Key_f2 },
|
||||
{KEY_F(3), Key_f3 },
|
||||
{KEY_F(4), Key_f4 },
|
||||
{KEY_F(5), Key_f5 },
|
||||
{KEY_F(6), Key_f6 },
|
||||
{KEY_F(7), Key_f7 },
|
||||
{KEY_F(8), Key_f8 },
|
||||
{KEY_F(9), Key_f9 },
|
||||
{KEY_F(10), Key_f10 },
|
||||
{KEY_F(11), Key_f11 },
|
||||
{KEY_F(12), Key_f12 },
|
||||
{KEY_F(13), Key_f13 },
|
||||
{KEY_F(14), Key_f14 },
|
||||
{KEY_F(15), Key_f15 },
|
||||
{KEY_F(16), Key_f16 },
|
||||
{KEY_F(17), Key_f17 },
|
||||
{KEY_F(18), Key_f18 },
|
||||
{KEY_F(19), Key_f19 },
|
||||
{KEY_F(20), Key_f20 },
|
||||
{KEY_BACKSPACE, Key_backspace},
|
||||
{KEY_LEFT, Key_left},
|
||||
{KEY_RIGHT, Key_right},
|
||||
{KEY_UP, Key_up},
|
||||
{KEY_DOWN, Key_down},
|
||||
{KEY_NPAGE, Key_npage},
|
||||
{KEY_PPAGE, Key_ppage},
|
||||
{KEY_HOME, Key_home},
|
||||
{KEY_END, Key_end},
|
||||
{KEY_DC, Key_dc},
|
||||
{KEY_IC, Key_ic},
|
||||
{KEY_F (1), Key_f1},
|
||||
{KEY_F (2), Key_f2},
|
||||
{KEY_F (3), Key_f3},
|
||||
{KEY_F (4), Key_f4},
|
||||
{KEY_F (5), Key_f5},
|
||||
{KEY_F (6), Key_f6},
|
||||
{KEY_F (7), Key_f7},
|
||||
{KEY_F (8), Key_f8},
|
||||
{KEY_F (9), Key_f9},
|
||||
{KEY_F (10), Key_f10},
|
||||
{KEY_F (11), Key_f11},
|
||||
{KEY_F (12), Key_f12},
|
||||
{KEY_F (13), Key_f13},
|
||||
{KEY_F (14), Key_f14},
|
||||
{KEY_F (15), Key_f15},
|
||||
{KEY_F (16), Key_f16},
|
||||
{KEY_F (17), Key_f17},
|
||||
{KEY_F (18), Key_f18},
|
||||
{KEY_F (19), Key_f19},
|
||||
{KEY_F (20), Key_f20},
|
||||
#endif
|
||||
{ALT('a'), Key_alt_a },
|
||||
{ALT('b'), Key_alt_b },
|
||||
{ALT('c'), Key_alt_c },
|
||||
{ALT('d'), Key_alt_d },
|
||||
{ALT('e'), Key_alt_e },
|
||||
{ALT('f'), Key_alt_f },
|
||||
{ALT('g'), Key_alt_g },
|
||||
{ALT('h'), Key_alt_h },
|
||||
{ALT('i'), Key_alt_i },
|
||||
{ALT('j'), Key_alt_j },
|
||||
{ALT('k'), Key_alt_k },
|
||||
{ALT('l'), Key_alt_l },
|
||||
{ALT('m'), Key_alt_m },
|
||||
{ALT('n'), Key_alt_n },
|
||||
{ALT('o'), Key_alt_o },
|
||||
{ALT('p'), Key_alt_p },
|
||||
{ALT('q'), Key_alt_q },
|
||||
{ALT('r'), Key_alt_r },
|
||||
{ALT('s'), Key_alt_s },
|
||||
{ALT('t'), Key_alt_t },
|
||||
{ALT('u'), Key_alt_u },
|
||||
{ALT('v'), Key_alt_v },
|
||||
{ALT('w'), Key_alt_w },
|
||||
{ALT('x'), Key_alt_x },
|
||||
{ALT('y'), Key_alt_y },
|
||||
{ALT('z'), Key_alt_z },
|
||||
{ALT ('a'), Key_alt_a},
|
||||
{ALT ('b'), Key_alt_b},
|
||||
{ALT ('c'), Key_alt_c},
|
||||
{ALT ('d'), Key_alt_d},
|
||||
{ALT ('e'), Key_alt_e},
|
||||
{ALT ('f'), Key_alt_f},
|
||||
{ALT ('g'), Key_alt_g},
|
||||
{ALT ('h'), Key_alt_h},
|
||||
{ALT ('i'), Key_alt_i},
|
||||
{ALT ('j'), Key_alt_j},
|
||||
{ALT ('k'), Key_alt_k},
|
||||
{ALT ('l'), Key_alt_l},
|
||||
{ALT ('m'), Key_alt_m},
|
||||
{ALT ('n'), Key_alt_n},
|
||||
{ALT ('o'), Key_alt_o},
|
||||
{ALT ('p'), Key_alt_p},
|
||||
{ALT ('q'), Key_alt_q},
|
||||
{ALT ('r'), Key_alt_r},
|
||||
{ALT ('s'), Key_alt_s},
|
||||
{ALT ('t'), Key_alt_t},
|
||||
{ALT ('u'), Key_alt_u},
|
||||
{ALT ('v'), Key_alt_v},
|
||||
{ALT ('w'), Key_alt_w},
|
||||
{ALT ('x'), Key_alt_x},
|
||||
{ALT ('y'), Key_alt_y},
|
||||
{ALT ('z'), Key_alt_z},
|
||||
|
||||
{ALT('\n'), Key_alt_enter},
|
||||
{ALT('\t'), Key_alt_tab }
|
||||
{ALT ('\n'), Key_alt_enter},
|
||||
{ALT ('\t'), Key_alt_tab}
|
||||
};
|
||||
|
||||
#endif /* xtra_key_define_t */
|
||||
#endif /* xtra_key_define_t */
|
||||
|
||||
|
||||
#ifdef HAVE_QNX_KEYS
|
||||
@ -381,28 +381,25 @@ xtra_key_define_t xtra_key_defines[] = {
|
||||
#define __QTISOFFS(_qtisx) (((charoffset*)(&__CT->_strs))[_qtisx])
|
||||
#define __QTISSTR(_qtisx) (&__CT->_strtab[0]+__QTISOFFS(_qtisx))
|
||||
|
||||
void load_qnx_key_defines (void)
|
||||
void
|
||||
load_qnx_key_defines (void)
|
||||
{
|
||||
static int _qnx_keys_defined = 0;
|
||||
|
||||
if (!_qnx_keys_defined) {
|
||||
int idx, str_idx;
|
||||
int term_setup_ok;
|
||||
int idx, str_idx;
|
||||
int term_setup_ok;
|
||||
|
||||
__setupterm(NULL, fileno(stdout), &term_setup_ok);
|
||||
__setupterm (NULL, fileno (stdout), &term_setup_ok);
|
||||
if (term_setup_ok != 1)
|
||||
return;
|
||||
|
||||
for (idx = 0;
|
||||
idx < sizeof(xtra_key_defines) / sizeof(xtra_key_defines[0]);
|
||||
idx++) {
|
||||
for (idx = 0; idx < sizeof (xtra_key_defines) / sizeof (xtra_key_defines[0]); idx++) {
|
||||
str_idx = xtra_key_defines[idx].str_idx;
|
||||
if (__QTISOFFS(str_idx)) {
|
||||
if (*__QTISSTR(str_idx)) {
|
||||
define_sequence(
|
||||
xtra_key_defines[idx].mc_code,
|
||||
__QTISSTR(str_idx),
|
||||
MCKEY_NOACTION);
|
||||
if (__QTISOFFS (str_idx)) {
|
||||
if (*__QTISSTR (str_idx)) {
|
||||
define_sequence (xtra_key_defines[idx].mc_code,
|
||||
__QTISSTR (str_idx), MCKEY_NOACTION);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -416,11 +413,10 @@ void load_qnx_key_defines (void)
|
||||
|
||||
|
||||
/* called from key.c/init_key() */
|
||||
void load_xtra_key_defines (void)
|
||||
void
|
||||
load_xtra_key_defines (void)
|
||||
{
|
||||
#ifdef HAVE_QNX_KEYS
|
||||
load_qnx_key_defines();
|
||||
load_qnx_key_defines ();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
110
src/tty/mouse.c
110
src/tty/mouse.c
@ -34,9 +34,9 @@
|
||||
#include "../../src/global.h"
|
||||
|
||||
#include "../../src/tty/tty.h"
|
||||
#include "../../src/tty/tty-internal.h" /* mouse_enabled */
|
||||
#include "../../src/tty/tty-internal.h" /* mouse_enabled */
|
||||
#include "../../src/tty/mouse.h"
|
||||
#include "../../src/tty/key.h" /* define sequence */
|
||||
#include "../../src/tty/key.h" /* define sequence */
|
||||
|
||||
gboolean mouse_enabled = FALSE;
|
||||
const char *xmouse_seq;
|
||||
@ -46,7 +46,7 @@ show_mouse_pointer (int x, int y)
|
||||
{
|
||||
#ifdef HAVE_LIBGPM
|
||||
if (use_mouse_p == MOUSE_GPM)
|
||||
Gpm_DrawPointer (x, y, gpm_consolefd);
|
||||
Gpm_DrawPointer (x, y, gpm_consolefd);
|
||||
#endif /* HAVE_LIBGPM */
|
||||
}
|
||||
|
||||
@ -56,17 +56,17 @@ init_mouse (void)
|
||||
switch (use_mouse_p) {
|
||||
#ifdef HAVE_LIBGPM
|
||||
case MOUSE_NONE:
|
||||
use_mouse_p = MOUSE_GPM;
|
||||
break;
|
||||
use_mouse_p = MOUSE_GPM;
|
||||
break;
|
||||
#endif /* HAVE_LIBGPM */
|
||||
|
||||
case MOUSE_XTERM_NORMAL_TRACKING:
|
||||
case MOUSE_XTERM_BUTTON_EVENT_TRACKING:
|
||||
define_sequence (MCKEY_MOUSE, xmouse_seq, MCKEY_NOACTION);
|
||||
break;
|
||||
define_sequence (MCKEY_MOUSE, xmouse_seq, MCKEY_NOACTION);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
enable_mouse ();
|
||||
@ -76,54 +76,54 @@ void
|
||||
enable_mouse (void)
|
||||
{
|
||||
if (mouse_enabled)
|
||||
return;
|
||||
return;
|
||||
|
||||
switch (use_mouse_p) {
|
||||
#ifdef HAVE_LIBGPM
|
||||
case MOUSE_GPM:
|
||||
{
|
||||
int mouse_d;
|
||||
Gpm_Connect conn;
|
||||
{
|
||||
int mouse_d;
|
||||
Gpm_Connect conn;
|
||||
|
||||
conn.eventMask = ~GPM_MOVE;
|
||||
conn.defaultMask = GPM_MOVE;
|
||||
conn.minMod = 0;
|
||||
conn.maxMod = 0;
|
||||
conn.eventMask = ~GPM_MOVE;
|
||||
conn.defaultMask = GPM_MOVE;
|
||||
conn.minMod = 0;
|
||||
conn.maxMod = 0;
|
||||
|
||||
mouse_d = Gpm_Open (&conn, 0);
|
||||
if (mouse_d == -1) {
|
||||
use_mouse_p = MOUSE_NONE;
|
||||
return;
|
||||
}
|
||||
mouse_enabled = 1;
|
||||
}
|
||||
break;
|
||||
mouse_d = Gpm_Open (&conn, 0);
|
||||
if (mouse_d == -1) {
|
||||
use_mouse_p = MOUSE_NONE;
|
||||
return;
|
||||
}
|
||||
mouse_enabled = 1;
|
||||
}
|
||||
break;
|
||||
#endif /* HAVE_LIBGPM */
|
||||
|
||||
case MOUSE_XTERM_NORMAL_TRACKING:
|
||||
/* save old highlight mouse tracking */
|
||||
printf(ESC_STR "[?1001s");
|
||||
/* save old highlight mouse tracking */
|
||||
printf (ESC_STR "[?1001s");
|
||||
|
||||
/* enable mouse tracking */
|
||||
printf(ESC_STR "[?1000h");
|
||||
/* enable mouse tracking */
|
||||
printf (ESC_STR "[?1000h");
|
||||
|
||||
fflush (stdout);
|
||||
mouse_enabled = TRUE;
|
||||
break;
|
||||
fflush (stdout);
|
||||
mouse_enabled = TRUE;
|
||||
break;
|
||||
|
||||
case MOUSE_XTERM_BUTTON_EVENT_TRACKING:
|
||||
/* save old highlight mouse tracking */
|
||||
printf(ESC_STR "[?1001s");
|
||||
/* save old highlight mouse tracking */
|
||||
printf (ESC_STR "[?1001s");
|
||||
|
||||
/* enable mouse tracking */
|
||||
printf(ESC_STR "[?1002h");
|
||||
/* enable mouse tracking */
|
||||
printf (ESC_STR "[?1002h");
|
||||
|
||||
fflush (stdout);
|
||||
mouse_enabled = TRUE;
|
||||
break;
|
||||
fflush (stdout);
|
||||
mouse_enabled = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,35 +131,35 @@ void
|
||||
disable_mouse (void)
|
||||
{
|
||||
if (!mouse_enabled)
|
||||
return;
|
||||
return;
|
||||
|
||||
mouse_enabled = FALSE;
|
||||
|
||||
switch (use_mouse_p) {
|
||||
#ifdef HAVE_LIBGPM
|
||||
case MOUSE_GPM:
|
||||
Gpm_Close ();
|
||||
break;
|
||||
Gpm_Close ();
|
||||
break;
|
||||
#endif
|
||||
case MOUSE_XTERM_NORMAL_TRACKING:
|
||||
/* disable mouse tracking */
|
||||
printf(ESC_STR "[?1000l");
|
||||
/* disable mouse tracking */
|
||||
printf (ESC_STR "[?1000l");
|
||||
|
||||
/* restore old highlight mouse tracking */
|
||||
printf(ESC_STR "[?1001r");
|
||||
/* restore old highlight mouse tracking */
|
||||
printf (ESC_STR "[?1001r");
|
||||
|
||||
fflush (stdout);
|
||||
break;
|
||||
fflush (stdout);
|
||||
break;
|
||||
case MOUSE_XTERM_BUTTON_EVENT_TRACKING:
|
||||
/* disable mouse tracking */
|
||||
printf(ESC_STR "[?1002l");
|
||||
/* disable mouse tracking */
|
||||
printf (ESC_STR "[?1002l");
|
||||
|
||||
/* restore old highlight mouse tracking */
|
||||
printf(ESC_STR "[?1001r");
|
||||
/* restore old highlight mouse tracking */
|
||||
printf (ESC_STR "[?1001r");
|
||||
|
||||
fflush (stdout);
|
||||
break;
|
||||
fflush (stdout);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -26,25 +26,25 @@
|
||||
/* Xterm mouse support supports only GPM_DOWN and GPM_UP */
|
||||
/* If you use others make sure your code also works without them */
|
||||
enum Gpm_Etype {
|
||||
GPM_MOVE=1,
|
||||
GPM_DRAG=2, /* exactly one in four is active at a time */
|
||||
GPM_DOWN=4,
|
||||
GPM_UP= 8,
|
||||
GPM_MOVE = 1,
|
||||
GPM_DRAG = 2, /* exactly one in four is active at a time */
|
||||
GPM_DOWN = 4,
|
||||
GPM_UP = 8,
|
||||
|
||||
#define GPM_BARE_EVENTS(ev) ((ev)&0xF)
|
||||
|
||||
GPM_SINGLE=16, /* at most one in three is set */
|
||||
GPM_DOUBLE=32,
|
||||
GPM_TRIPLE=64,
|
||||
GPM_SINGLE = 16, /* at most one in three is set */
|
||||
GPM_DOUBLE = 32,
|
||||
GPM_TRIPLE = 64,
|
||||
|
||||
GPM_MFLAG=128, /* motion during click? */
|
||||
GPM_HARD=256 /* if set in the defaultMask, force an already
|
||||
used event to pass over to another handler */
|
||||
GPM_MFLAG = 128, /* motion during click? */
|
||||
GPM_HARD = 256 /* if set in the defaultMask, force an already
|
||||
used event to pass over to another handler */
|
||||
};
|
||||
|
||||
typedef struct Gpm_Event {
|
||||
int buttons, x, y;
|
||||
enum Gpm_Etype type;
|
||||
int buttons, x, y;
|
||||
enum Gpm_Etype type;
|
||||
} Gpm_Event;
|
||||
|
||||
#endif /* !HAVE_LIBGPM */
|
||||
@ -59,10 +59,10 @@ typedef int (*mouse_h) (Gpm_Event *, void *);
|
||||
|
||||
/* Type of mouse support */
|
||||
typedef enum {
|
||||
MOUSE_NONE, /* Not detected yet */
|
||||
MOUSE_DISABLED, /* Explicitly disabled by -d */
|
||||
MOUSE_GPM, /* Support using GPM on Linux */
|
||||
MOUSE_XTERM, /* Support using xterm-style mouse reporting */
|
||||
MOUSE_NONE, /* Not detected yet */
|
||||
MOUSE_DISABLED, /* Explicitly disabled by -d */
|
||||
MOUSE_GPM, /* Support using GPM on Linux */
|
||||
MOUSE_XTERM, /* Support using xterm-style mouse reporting */
|
||||
MOUSE_XTERM_NORMAL_TRACKING = MOUSE_XTERM,
|
||||
MOUSE_XTERM_BUTTON_EVENT_TRACKING
|
||||
} Mouse_Type;
|
||||
@ -88,4 +88,4 @@ void disable_mouse (void);
|
||||
|
||||
void show_mouse_pointer (int x, int y);
|
||||
|
||||
#endif /* MC_MOUSE_H */
|
||||
#endif /* MC_MOUSE_H */
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifndef MC_TTY_INTERNAL_H
|
||||
#define MC_TTY_INTERNAL_H
|
||||
|
||||
#include "../../src/global.h" /* include <glib.h> */
|
||||
#include "../../src/global.h" /* include <glib.h> */
|
||||
|
||||
/* If true lines are shown by spaces */
|
||||
extern gboolean slow_tty;
|
||||
@ -17,4 +17,4 @@ extern gboolean ugly_line_drawing;
|
||||
/* The mouse is currently: TRUE - enabled, FALSE - disabled */
|
||||
extern gboolean mouse_enabled;
|
||||
|
||||
#endif /* MC_TTY_INTERNAL_H */
|
||||
#endif /* MC_TTY_INTERNAL_H */
|
||||
|
@ -42,18 +42,17 @@
|
||||
# define WANT_TERM_H
|
||||
#endif
|
||||
|
||||
#include "../../src/tty/tty-internal.h" /* slow_tty */
|
||||
#include "../../src/tty/tty.h" /* tty_draw_box_slow */
|
||||
#include "../../src/tty/color-ncurses.h"
|
||||
#include "../../src/tty/tty-internal.h" /* slow_tty */
|
||||
#include "../../src/tty/tty.h"
|
||||
#include "../../src/tty/color-internal.h"
|
||||
#include "../../src/tty/win.h"
|
||||
|
||||
#include "../../src/strutil.h" /* str_term_form */
|
||||
#include "../../src/strutil.h" /* str_term_form */
|
||||
|
||||
/* include at last !!! */
|
||||
#ifdef WANT_TERM_H
|
||||
# include <term.h>
|
||||
#endif /* WANT_TERM_H*/
|
||||
#endif /* WANT_TERM_H */
|
||||
|
||||
/*** global variables **************************************************/
|
||||
|
||||
@ -65,32 +64,64 @@
|
||||
|
||||
/*** file scope variables **********************************************/
|
||||
|
||||
static const struct {
|
||||
int acscode;
|
||||
int character;
|
||||
} acs_approx [] = {
|
||||
{ 'q', '-' }, /* ACS_HLINE */
|
||||
{ 'x', '|' }, /* ACS_VLINE */
|
||||
{ 'l', '+' }, /* ACS_ULCORNER */
|
||||
{ 'k', '+' }, /* ACS_URCORNER */
|
||||
{ 'm', '+' }, /* ACS_LLCORNER */
|
||||
{ 'j', '+' }, /* ACS_LRCORNER */
|
||||
{ 'a', '#' }, /* ACS_CKBOARD */
|
||||
{ 'u', '+' }, /* ACS_RTEE */
|
||||
{ 't', '+' }, /* ACS_LTEE */
|
||||
{ 'w', '+' }, /* ACS_TTEE */
|
||||
{ 'v', '+' }, /* ACS_BTEE */
|
||||
{ 'n', '+' }, /* ACS_PLUS */
|
||||
{ 0, 0 } };
|
||||
|
||||
/*** file scope functions **********************************************/
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** public functions **************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
mc_tty_normalize_lines_char (const char *ch)
|
||||
{
|
||||
int i;
|
||||
struct mc_tty_lines_struct {
|
||||
const char *line;
|
||||
int line_code;
|
||||
} const lines_codes[] = {
|
||||
{"\342\224\214", ACS_LRCORNER}, /* ┌ */
|
||||
{"\342\224\220", ACS_LLCORNER}, /* ┐ */
|
||||
{"\342\224\224", ACS_URCORNER}, /* └ */
|
||||
{"\342\224\230", ACS_ULCORNER}, /* ┘ */
|
||||
{"\342\224\234", ACS_LTEE}, /* ├ */
|
||||
{"\342\224\244", ACS_RTEE}, /* ┤ */
|
||||
{"\342\224\254", ACS_TTEE}, /* ┬ */
|
||||
{"\342\224\264", ACS_BTEE}, /* ┴ */
|
||||
{"\342\224\200", ACS_HLINE}, /* ─ */
|
||||
{"\342\224\202", ACS_VLINE}, /* │ */
|
||||
{"\342\224\274", ACS_PLUS}, /* ┼ */
|
||||
{"\342\225\235", ACS_LRCORNER | A_BOLD}, /* ╔ */
|
||||
{"\342\225\232", ACS_LLCORNER | A_BOLD}, /* ╗ */
|
||||
{"\342\225\227", ACS_URCORNER | A_BOLD}, /* ╚ */
|
||||
{"\342\225\224", ACS_ULCORNER | A_BOLD}, /* ╝ */
|
||||
{"\342\225\237", ACS_LTEE | A_BOLD}, /* ╟ */
|
||||
{"\342\225\242", ACS_RTEE | A_BOLD}, /* ╢ */
|
||||
{"\342\225\244", ACS_TTEE | A_BOLD}, /* ╤ */
|
||||
{"\342\225\247", ACS_BTEE | A_BOLD}, /* ╧ */
|
||||
{"\342\225\220", ACS_HLINE | A_BOLD}, /* ═ */
|
||||
{"\342\225\221", ACS_VLINE | A_BOLD}, /* ║ */
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
if (ch == NULL)
|
||||
return (int) ' ';
|
||||
|
||||
for (i = 0; lines_codes[i].line; i++) {
|
||||
if (strcmp (ch, lines_codes[i].line) == 0)
|
||||
return lines_codes[i].line_code;
|
||||
}
|
||||
|
||||
return (int) ' ';
|
||||
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
void
|
||||
tty_init (gboolean slow, gboolean ugly_lines)
|
||||
{
|
||||
slow_tty = slow;
|
||||
(void) ugly_lines;
|
||||
|
||||
initscr ();
|
||||
|
||||
@ -115,11 +146,6 @@ tty_init (gboolean slow, gboolean ugly_lines)
|
||||
keypad (stdscr, TRUE);
|
||||
nodelay (stdscr, FALSE);
|
||||
|
||||
if (ugly_lines) {
|
||||
int i;
|
||||
for (i = 0; acs_approx[i].acscode != 0; i++)
|
||||
acs_map[acs_approx[i].acscode] = acs_approx[i].character;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -179,7 +205,7 @@ tty_nodelay (gboolean set)
|
||||
int
|
||||
tty_baudrate (void)
|
||||
{
|
||||
return baudrate();
|
||||
return baudrate ();
|
||||
}
|
||||
|
||||
int
|
||||
@ -216,9 +242,8 @@ tty_getyx (int *py, int *px)
|
||||
void
|
||||
tty_draw_hline (int y, int x, int ch, int len)
|
||||
{
|
||||
if (ch == ACS_HLINE && slow_tty) {
|
||||
ch = ugly_frm_thinhoriz;
|
||||
}
|
||||
if ((chtype) ch == ACS_HLINE)
|
||||
ch = mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz];
|
||||
|
||||
if ((y >= 0) && (x >= 0))
|
||||
move (y, x);
|
||||
@ -229,43 +254,22 @@ tty_draw_hline (int y, int x, int ch, int len)
|
||||
void
|
||||
tty_draw_vline (int y, int x, int ch, int len)
|
||||
{
|
||||
if ((chtype) ch == ACS_VLINE)
|
||||
ch = mc_tty_ugly_frm[MC_TTY_FRM_thinvert];
|
||||
|
||||
if ((y >= 0) && (x >= 0))
|
||||
move (y, x);
|
||||
move (y, x);
|
||||
vline (ch, len);
|
||||
}
|
||||
|
||||
void
|
||||
tty_draw_box (int y, int x, int rows, int cols)
|
||||
{
|
||||
if (slow_tty) {
|
||||
tty_draw_box_slow (y, x, rows, cols);
|
||||
} else {
|
||||
#define waddc(_y, _x, c) move (_y, _x); addch (c)
|
||||
waddc (y, x, ACS_ULCORNER);
|
||||
hline (ACS_HLINE, cols - 2);
|
||||
waddc (y + rows - 1, x, ACS_LLCORNER);
|
||||
hline (ACS_HLINE, cols - 2);
|
||||
|
||||
waddc (y, x + cols - 1, ACS_URCORNER);
|
||||
waddc (y + rows - 1, x + cols - 1, ACS_LRCORNER);
|
||||
|
||||
move (y + 1, x);
|
||||
vline (ACS_VLINE, rows - 2);
|
||||
|
||||
move (y + 1, x + cols - 1);
|
||||
vline (ACS_VLINE, rows - 2);
|
||||
#undef waddc
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tty_fill_region (int y, int x, int rows, int cols, unsigned char ch)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < rows; i++) {
|
||||
move (y + i, x);
|
||||
hline (ch, cols);
|
||||
move (y + i, x);
|
||||
hline (ch, cols);
|
||||
}
|
||||
|
||||
move (y, x);
|
||||
@ -294,23 +298,15 @@ tty_print_anychar (int c)
|
||||
{
|
||||
unsigned char str[6 + 1];
|
||||
|
||||
if (c == ACS_RTEE && (ugly_line_drawing || slow_tty)) {
|
||||
c = ugly_frm_rightmiddle;
|
||||
}
|
||||
|
||||
if (c == ACS_LTEE && (ugly_line_drawing || slow_tty)) {
|
||||
c = ugly_frm_leftmiddle;
|
||||
}
|
||||
|
||||
if ( c > 255 ) {
|
||||
int res = g_unichar_to_utf8 (c, (char *)str);
|
||||
if ( res == 0 ) {
|
||||
if (c > 255) {
|
||||
int res = g_unichar_to_utf8 (c, (char *) str);
|
||||
if (res == 0) {
|
||||
str[0] = '.';
|
||||
str[1] = '\0';
|
||||
} else {
|
||||
str[res] = '\0';
|
||||
}
|
||||
addstr (str_term_form (str));
|
||||
addstr (str_term_form ((char *) str));
|
||||
} else {
|
||||
addch (c);
|
||||
}
|
||||
@ -319,6 +315,25 @@ tty_print_anychar (int c)
|
||||
void
|
||||
tty_print_alt_char (int c)
|
||||
{
|
||||
if ((chtype) c == ACS_VLINE)
|
||||
c = mc_tty_ugly_frm[MC_TTY_FRM_thinvert];
|
||||
else if ((chtype) c == ACS_HLINE)
|
||||
c = mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz];
|
||||
else if ((chtype) c == ACS_LTEE)
|
||||
c = mc_tty_ugly_frm[MC_TTY_FRM_leftmiddle];
|
||||
else if ((chtype) c == ACS_RTEE)
|
||||
c = mc_tty_ugly_frm[MC_TTY_FRM_rightmiddle];
|
||||
else if ((chtype) c == ACS_ULCORNER)
|
||||
c = mc_tty_ugly_frm[MC_TTY_FRM_lefttop];
|
||||
else if ((chtype) c == ACS_LLCORNER)
|
||||
c = mc_tty_ugly_frm[MC_TTY_FRM_leftbottom];
|
||||
else if ((chtype) c == ACS_URCORNER)
|
||||
c = mc_tty_ugly_frm[MC_TTY_FRM_righttop];
|
||||
else if ((chtype) c == ACS_LRCORNER)
|
||||
c = mc_tty_ugly_frm[MC_TTY_FRM_rightbottom];
|
||||
else if ((chtype) c == ACS_PLUS)
|
||||
c = mc_tty_ugly_frm[MC_TTY_FRM_centermiddle];
|
||||
|
||||
addch (c);
|
||||
}
|
||||
|
||||
@ -362,9 +377,9 @@ tty_setup_sigwinch (void (*handler) (int))
|
||||
act.sa_flags = 0;
|
||||
#ifdef SA_RESTART
|
||||
act.sa_flags |= SA_RESTART;
|
||||
#endif /* SA_RESTART */
|
||||
#endif /* SA_RESTART */
|
||||
sigaction (SIGWINCH, &act, &oact);
|
||||
#endif /* SIGWINCH */
|
||||
#endif /* SIGWINCH */
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -12,12 +12,12 @@
|
||||
# else
|
||||
# include <curses.h>
|
||||
# endif
|
||||
#endif /* USE_NCURSES */
|
||||
#endif /* USE_NCURSES */
|
||||
|
||||
#ifdef USE_NCURSESW
|
||||
# include <ncursesw/curses.h>
|
||||
#endif /* USE_NCURSESW */
|
||||
#endif /* USE_NCURSESW */
|
||||
|
||||
void init_curses (void);
|
||||
|
||||
#endif /* MC_TTY_NCURSES_H */
|
||||
#endif /* MC_TTY_NCURSES_H */
|
||||
|
@ -37,21 +37,21 @@
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
#include <termios.h>
|
||||
#endif
|
||||
#include <sys/types.h> /* size_t */
|
||||
#include <sys/types.h> /* size_t */
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "../../src/global.h"
|
||||
|
||||
#include "../../src/tty/tty-internal.h" /* slow_tty */
|
||||
#include "../../src/tty/tty.h" /* tty_draw_box_slow */
|
||||
#include "../../src/tty/tty-internal.h" /* slow_tty */
|
||||
#include "../../src/tty/tty.h"
|
||||
#include "../../src/tty/color-slang.h"
|
||||
#include "../../src/tty/color-internal.h"
|
||||
#include "../../src/tty/mouse.h" /* Gpm_Event is required in key.h */
|
||||
#include "../../src/tty/key.h" /* define_sequence */
|
||||
#include "../../src/tty/mouse.h" /* Gpm_Event is required in key.h */
|
||||
#include "../../src/tty/key.h" /* define_sequence */
|
||||
#include "../../src/tty/win.h"
|
||||
|
||||
#include "../../src/strutil.h" /* str_term_form */
|
||||
#include "../../src/strutil.h" /* str_term_form */
|
||||
|
||||
/*** global variables **************************************************/
|
||||
extern int reset_hp_softkeys;
|
||||
@ -59,7 +59,7 @@ extern int reset_hp_softkeys;
|
||||
/*** file scope macro definitions **************************************/
|
||||
|
||||
/* Taken from S-Lang's slutty.c */
|
||||
#ifdef ultrix /* Ultrix gets _POSIX_VDISABLE wrong! */
|
||||
#ifdef ultrix /* Ultrix gets _POSIX_VDISABLE wrong! */
|
||||
# define NULL_VALUE -1
|
||||
#else
|
||||
# ifdef _POSIX_VDISABLE
|
||||
@ -67,7 +67,7 @@ extern int reset_hp_softkeys;
|
||||
# else
|
||||
# define NULL_VALUE 255
|
||||
# endif
|
||||
#endif /* ultrix */
|
||||
#endif /* ultrix */
|
||||
|
||||
#ifndef SA_RESTART
|
||||
# define SA_RESTART 0
|
||||
@ -97,42 +97,43 @@ static gboolean no_slang_delay;
|
||||
* assign to them.
|
||||
*/
|
||||
static const struct {
|
||||
int key_code;
|
||||
int key_code;
|
||||
const char *key_name;
|
||||
} key_table [] = {
|
||||
{ KEY_F(0), "k0" },
|
||||
{ KEY_F(1), "k1" },
|
||||
{ KEY_F(2), "k2" },
|
||||
{ KEY_F(3), "k3" },
|
||||
{ KEY_F(4), "k4" },
|
||||
{ KEY_F(5), "k5" },
|
||||
{ KEY_F(6), "k6" },
|
||||
{ KEY_F(7), "k7" },
|
||||
{ KEY_F(8), "k8" },
|
||||
{ KEY_F(9), "k9" },
|
||||
{ KEY_F(10), "k;" },
|
||||
{ KEY_F(11), "F1" },
|
||||
{ KEY_F(12), "F2" },
|
||||
{ KEY_F(13), "F3" },
|
||||
{ KEY_F(14), "F4" },
|
||||
{ KEY_F(15), "F5" },
|
||||
{ KEY_F(16), "F6" },
|
||||
{ KEY_F(17), "F7" },
|
||||
{ KEY_F(18), "F8" },
|
||||
{ KEY_F(19), "F9" },
|
||||
{ KEY_F(20), "FA" },
|
||||
{ KEY_IC, "kI" },
|
||||
{ KEY_NPAGE, "kN" },
|
||||
{ KEY_PPAGE, "kP" },
|
||||
{ KEY_LEFT, "kl" },
|
||||
{ KEY_RIGHT, "kr" },
|
||||
{ KEY_UP, "ku" },
|
||||
{ KEY_DOWN, "kd" },
|
||||
{ KEY_DC, "kD" },
|
||||
{ KEY_BACKSPACE, "kb" },
|
||||
{ KEY_HOME, "kh" },
|
||||
{ KEY_END, "@7" },
|
||||
{ 0, NULL }
|
||||
} key_table[] = {
|
||||
{
|
||||
KEY_F (0), "k0"}, {
|
||||
KEY_F (1), "k1"}, {
|
||||
KEY_F (2), "k2"}, {
|
||||
KEY_F (3), "k3"}, {
|
||||
KEY_F (4), "k4"}, {
|
||||
KEY_F (5), "k5"}, {
|
||||
KEY_F (6), "k6"}, {
|
||||
KEY_F (7), "k7"}, {
|
||||
KEY_F (8), "k8"}, {
|
||||
KEY_F (9), "k9"}, {
|
||||
KEY_F (10), "k;"}, {
|
||||
KEY_F (11), "F1"}, {
|
||||
KEY_F (12), "F2"}, {
|
||||
KEY_F (13), "F3"}, {
|
||||
KEY_F (14), "F4"}, {
|
||||
KEY_F (15), "F5"}, {
|
||||
KEY_F (16), "F6"}, {
|
||||
KEY_F (17), "F7"}, {
|
||||
KEY_F (18), "F8"}, {
|
||||
KEY_F (19), "F9"}, {
|
||||
KEY_F (20), "FA"}, {
|
||||
KEY_IC, "kI"}, {
|
||||
KEY_NPAGE, "kN"}, {
|
||||
KEY_PPAGE, "kP"}, {
|
||||
KEY_LEFT, "kl"}, {
|
||||
KEY_RIGHT, "kr"}, {
|
||||
KEY_UP, "ku"}, {
|
||||
KEY_DOWN, "kd"}, {
|
||||
KEY_DC, "kD"}, {
|
||||
KEY_BACKSPACE, "kb"}, {
|
||||
KEY_HOME, "kh"}, {
|
||||
KEY_END, "@7"}, {
|
||||
0, NULL}
|
||||
};
|
||||
|
||||
/*** file scope functions **********************************************/
|
||||
@ -161,14 +162,13 @@ slang_reset_softkeys (void)
|
||||
char tmp[BUF_SMALL];
|
||||
|
||||
for (key = 1; key < 9; key++) {
|
||||
g_snprintf (tmp, sizeof (tmp), "k%d", key);
|
||||
send = (char *) SLtt_tgetstr (tmp);
|
||||
if (send != NULL) {
|
||||
g_snprintf (tmp, sizeof (tmp), "\033&f%dk%dd%dL%s%s", key,
|
||||
(int) (sizeof (display) - 1), (int) strlen (send),
|
||||
display, send);
|
||||
SLtt_write_string (tmp);
|
||||
}
|
||||
g_snprintf (tmp, sizeof (tmp), "k%d", key);
|
||||
send = (char *) SLtt_tgetstr (tmp);
|
||||
if (send != NULL) {
|
||||
g_snprintf (tmp, sizeof (tmp), "\033&f%dk%dd%dL%s%s", key,
|
||||
(int) (sizeof (display) - 1), (int) strlen (send), display, send);
|
||||
SLtt_write_string (tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ do_define_key (int code, const char *strcap)
|
||||
|
||||
seq = (char *) SLtt_tgetstr ((char *) strcap);
|
||||
if (seq != NULL)
|
||||
define_sequence (code, seq, MCKEY_NOACTION);
|
||||
define_sequence (code, seq, MCKEY_NOACTION);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -187,12 +187,59 @@ load_terminfo_keys (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; key_table [i].key_code; i++)
|
||||
do_define_key (key_table [i].key_code, key_table [i].key_name);
|
||||
for (i = 0; key_table[i].key_code; i++)
|
||||
do_define_key (key_table[i].key_code, key_table[i].key_name);
|
||||
}
|
||||
|
||||
/*** public functions **************************************************/
|
||||
static char *
|
||||
mc_tty_normalize_from_utf8 (const char *str)
|
||||
{
|
||||
GIConv conv;
|
||||
GString *buffer;
|
||||
const char *_system_codepage = str_detect_termencoding ();
|
||||
|
||||
if (str_isutf8 (_system_codepage))
|
||||
return g_strdup (str);
|
||||
|
||||
conv = g_iconv_open (_system_codepage, "UTF-8");
|
||||
if (conv == INVALID_CONV)
|
||||
return g_strdup (str);
|
||||
|
||||
buffer = g_string_new ("");
|
||||
|
||||
if (str_convert (conv, str, buffer) == ESTR_FAILURE) {
|
||||
g_string_free (buffer, TRUE);
|
||||
str_close_conv (conv);
|
||||
return g_strdup (str);
|
||||
}
|
||||
str_close_conv (conv);
|
||||
|
||||
return g_string_free (buffer, FALSE);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** public functions **************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
mc_tty_normalize_lines_char (const char *str)
|
||||
{
|
||||
char *str2;
|
||||
int res;
|
||||
|
||||
if (!str)
|
||||
return (int) ' ';
|
||||
str2 = mc_tty_normalize_from_utf8 (str);
|
||||
res = g_utf8_get_char_validated (str2, -1);
|
||||
|
||||
if (res < 0)
|
||||
res = (unsigned char) str2[0];
|
||||
g_free (str2);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
void
|
||||
tty_init (gboolean slow, gboolean ugly_lines)
|
||||
{
|
||||
@ -201,44 +248,43 @@ tty_init (gboolean slow, gboolean ugly_lines)
|
||||
|
||||
SLtt_get_terminfo ();
|
||||
SLutf8_enable (-1);
|
||||
/*
|
||||
* If the terminal in not in terminfo but begins with a well-known
|
||||
* string such as "linux" or "xterm" S-Lang will go on, but the
|
||||
* terminal size and several other variables won't be initialized
|
||||
* (as of S-Lang 1.4.4). Detect it and abort. Also detect extremely
|
||||
* small, large and negative screen dimensions.
|
||||
*/
|
||||
/*
|
||||
* If the terminal in not in terminfo but begins with a well-known
|
||||
* string such as "linux" or "xterm" S-Lang will go on, but the
|
||||
* terminal size and several other variables won't be initialized
|
||||
* (as of S-Lang 1.4.4). Detect it and abort. Also detect extremely
|
||||
* small, large and negative screen dimensions.
|
||||
*/
|
||||
if ((COLS < 10) || (LINES < 5)
|
||||
|| (COLS > SLTT_MAX_SCREEN_COLS) || (LINES > SLTT_MAX_SCREEN_ROWS)) {
|
||||
fprintf (stderr,
|
||||
_("Screen size %dx%d is not supported.\n"
|
||||
"Check the TERM environment variable.\n"),
|
||||
COLS, LINES);
|
||||
exit (1);
|
||||
|| (COLS > SLTT_MAX_SCREEN_COLS) || (LINES > SLTT_MAX_SCREEN_ROWS)) {
|
||||
fprintf (stderr,
|
||||
_("Screen size %dx%d is not supported.\n"
|
||||
"Check the TERM environment variable.\n"), COLS, LINES);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
tcgetattr (fileno (stdin), &boot_mode);
|
||||
/* 255 = ignore abort char; XCTRL('g') for abort char = ^g */
|
||||
SLang_init_tty (XCTRL('c'), 1, 0);
|
||||
SLang_init_tty (XCTRL ('c'), 1, 0);
|
||||
|
||||
if (ugly_lines)
|
||||
SLtt_Has_Alt_Charset = 0;
|
||||
SLtt_Has_Alt_Charset = 0;
|
||||
|
||||
/* If SLang uses fileno(stderr) for terminal input MC will hang
|
||||
if we call SLang_getkey between calls to open_error_pipe and
|
||||
close_error_pipe, e.g. when we do a growing view of an gzipped
|
||||
file. */
|
||||
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) {
|
||||
#ifdef VDSUSP
|
||||
new_mode.c_cc[VDSUSP] = NULL_VALUE; /* to ignore ^Y */
|
||||
new_mode.c_cc[VDSUSP] = NULL_VALUE; /* to ignore ^Y */
|
||||
#endif
|
||||
#ifdef VLNEXT
|
||||
new_mode.c_cc[VLNEXT] = NULL_VALUE; /* to ignore ^V */
|
||||
new_mode.c_cc[VLNEXT] = NULL_VALUE; /* to ignore ^V */
|
||||
#endif
|
||||
tcsetattr (SLang_TT_Read_FD, TCSADRAIN, &new_mode);
|
||||
tcsetattr (SLang_TT_Read_FD, TCSADRAIN, &new_mode);
|
||||
}
|
||||
|
||||
tty_reset_prog_mode ();
|
||||
@ -270,9 +316,9 @@ tty_shutdown (void)
|
||||
* active when the program was started up
|
||||
*/
|
||||
op_cap = SLtt_tgetstr ((char *) "op");
|
||||
if (op_cap != NULL){
|
||||
fputs (op_cap, stdout);
|
||||
fflush (stdout);
|
||||
if (op_cap != NULL) {
|
||||
fputs (op_cap, stdout);
|
||||
fflush (stdout);
|
||||
}
|
||||
}
|
||||
|
||||
@ -311,7 +357,7 @@ tty_noecho (void)
|
||||
int
|
||||
tty_flush_input (void)
|
||||
{
|
||||
return 0; /* OK */
|
||||
return 0; /* OK */
|
||||
}
|
||||
|
||||
void
|
||||
@ -321,9 +367,9 @@ tty_keypad (gboolean set)
|
||||
|
||||
keypad_string = (char *) SLtt_tgetstr ((char *) (set ? "ks" : "ke"));
|
||||
if (keypad_string != NULL)
|
||||
SLtt_write_string (keypad_string);
|
||||
SLtt_write_string (keypad_string);
|
||||
if (set && reset_hp_softkeys)
|
||||
slang_reset_softkeys ();
|
||||
slang_reset_softkeys ();
|
||||
}
|
||||
|
||||
void
|
||||
@ -344,14 +390,14 @@ tty_lowlevel_getch (void)
|
||||
int c;
|
||||
|
||||
if (no_slang_delay && (SLang_input_pending (0) == 0))
|
||||
return -1;
|
||||
return -1;
|
||||
|
||||
c = SLang_getkey ();
|
||||
if (c == SLANG_GETKEY_ERROR) {
|
||||
fprintf (stderr,
|
||||
"SLang_getkey returned SLANG_GETKEY_ERROR\n"
|
||||
"Assuming EOF on stdin and exiting\n");
|
||||
exit (1);
|
||||
fprintf (stderr,
|
||||
"SLang_getkey returned SLANG_GETKEY_ERROR\n"
|
||||
"Assuming EOF on stdin and exiting\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
return c;
|
||||
@ -361,7 +407,7 @@ int
|
||||
tty_reset_screen (void)
|
||||
{
|
||||
SLsmg_reset_smg ();
|
||||
return 0; /* OK */
|
||||
return 0; /* OK */
|
||||
}
|
||||
|
||||
void
|
||||
@ -387,24 +433,23 @@ tty_getyx (int *py, int *px)
|
||||
void
|
||||
tty_draw_hline (int y, int x, int ch, int len)
|
||||
{
|
||||
if (ch == ACS_HLINE && (ugly_line_drawing || slow_tty)) {
|
||||
if (ch == ACS_HLINE)
|
||||
ch = mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz];
|
||||
}
|
||||
|
||||
if ((y < 0) || (x < 0)) {
|
||||
y = SLsmg_get_row ();
|
||||
x = SLsmg_get_column ();
|
||||
y = SLsmg_get_row ();
|
||||
x = SLsmg_get_column ();
|
||||
} else
|
||||
SLsmg_gotorc (y, x);
|
||||
SLsmg_gotorc (y, x);
|
||||
|
||||
if (ch == 0)
|
||||
ch = ACS_HLINE;
|
||||
ch = ACS_HLINE;
|
||||
|
||||
if (ch == ACS_HLINE)
|
||||
SLsmg_draw_hline (len);
|
||||
SLsmg_draw_hline (len);
|
||||
else
|
||||
while (len-- != 0)
|
||||
tty_print_char (ch);
|
||||
while (len-- != 0)
|
||||
tty_print_char (ch);
|
||||
|
||||
SLsmg_gotorc (y, x);
|
||||
}
|
||||
@ -413,40 +458,33 @@ tty_draw_hline (int y, int x, int ch, int len)
|
||||
void
|
||||
tty_draw_vline (int y, int x, int ch, int len)
|
||||
{
|
||||
if (ch == ACS_VLINE)
|
||||
ch = mc_tty_ugly_frm[MC_TTY_FRM_thinvert];
|
||||
|
||||
if ((y < 0) || (x < 0)) {
|
||||
y = SLsmg_get_row ();
|
||||
x = SLsmg_get_column ();
|
||||
y = SLsmg_get_row ();
|
||||
x = SLsmg_get_column ();
|
||||
} else
|
||||
SLsmg_gotorc (y, x);
|
||||
SLsmg_gotorc (y, x);
|
||||
|
||||
if (ch == 0)
|
||||
ch = ACS_VLINE;
|
||||
ch = ACS_VLINE;
|
||||
|
||||
if (ch == ACS_VLINE)
|
||||
SLsmg_draw_vline (len);
|
||||
SLsmg_draw_vline (len);
|
||||
else {
|
||||
int pos = 0;
|
||||
int pos = 0;
|
||||
|
||||
while (len-- != 0) {
|
||||
SLsmg_gotorc (y + pos, x);
|
||||
tty_print_char (ch);
|
||||
pos++;
|
||||
}
|
||||
while (len-- != 0) {
|
||||
SLsmg_gotorc (y + pos, x);
|
||||
tty_print_char (ch);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
SLsmg_gotorc (y, x);
|
||||
}
|
||||
|
||||
void
|
||||
tty_draw_box (int y, int x, int rows, int cols)
|
||||
{
|
||||
/* this fix slang drawing stickchars bug */
|
||||
if (ugly_line_drawing || slow_tty)
|
||||
tty_draw_box_slow (y, x, rows, cols);
|
||||
else
|
||||
SLsmg_draw_box (y, x, rows, cols);
|
||||
}
|
||||
|
||||
void
|
||||
tty_fill_region (int y, int x, int rows, int cols, unsigned char ch)
|
||||
{
|
||||
@ -474,18 +512,41 @@ tty_print_char (int c)
|
||||
void
|
||||
tty_print_alt_char (int c)
|
||||
{
|
||||
if (c == ACS_RTEE && (ugly_line_drawing || slow_tty)) {
|
||||
c = mc_tty_ugly_frm[MC_TTY_FRM_rightmiddle];
|
||||
}
|
||||
|
||||
if (c == ACS_LTEE && (ugly_line_drawing || slow_tty)) {
|
||||
c = mc_tty_ugly_frm[MC_TTY_FRM_leftmiddle];
|
||||
}
|
||||
if (ugly_line_drawing || slow_tty) {
|
||||
tty_print_char (c);
|
||||
} else {
|
||||
SLsmg_draw_object (SLsmg_get_row(), SLsmg_get_column(), c);
|
||||
#define DRAW(x, y) (x == y) \
|
||||
? SLsmg_draw_object (SLsmg_get_row(), SLsmg_get_column(), x) \
|
||||
: SLsmg_write_char ((unsigned int) y)
|
||||
switch (c) {
|
||||
case ACS_VLINE:
|
||||
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_thinvert]);
|
||||
break;
|
||||
case ACS_HLINE:
|
||||
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz]);
|
||||
break;
|
||||
case ACS_LTEE:
|
||||
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_leftmiddle]);
|
||||
break;
|
||||
case ACS_RTEE:
|
||||
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_rightmiddle]);
|
||||
break;
|
||||
case ACS_ULCORNER:
|
||||
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_lefttop]);
|
||||
break;
|
||||
case ACS_LLCORNER:
|
||||
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_leftbottom]);
|
||||
break;
|
||||
case ACS_URCORNER:
|
||||
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_righttop]);
|
||||
break;
|
||||
case ACS_LRCORNER:
|
||||
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_rightbottom]);
|
||||
break;
|
||||
case ACS_PLUS:
|
||||
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_centermiddle]);
|
||||
break;
|
||||
default:
|
||||
SLsmg_write_char ((unsigned int) c);
|
||||
}
|
||||
#undef DRAW
|
||||
}
|
||||
|
||||
void
|
||||
@ -493,9 +554,9 @@ tty_print_anychar (int c)
|
||||
{
|
||||
char str[6 + 1];
|
||||
|
||||
if ( c > 255 ) {
|
||||
if (c > 255) {
|
||||
int res = g_unichar_to_utf8 (c, str);
|
||||
if ( res == 0 ) {
|
||||
if (res == 0) {
|
||||
str[0] = '.';
|
||||
str[1] = '\0';
|
||||
} else {
|
||||
@ -545,9 +606,9 @@ tty_setup_sigwinch (void (*handler) (int))
|
||||
act.sa_flags = 0;
|
||||
#ifdef SA_RESTART
|
||||
act.sa_flags |= SA_RESTART;
|
||||
#endif /* SA_RESTART */
|
||||
#endif /* SA_RESTART */
|
||||
sigaction (SIGWINCH, &act, &oact);
|
||||
#endif /* SIGWINCH */
|
||||
#endif /* SIGWINCH */
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -6,7 +6,7 @@
|
||||
# include <slang/slang.h>
|
||||
#else
|
||||
# include <slang.h>
|
||||
#endif /* HAVE_SLANG_SLANG_H */
|
||||
#endif /* HAVE_SLANG_SLANG_H */
|
||||
|
||||
enum {
|
||||
KEY_BACKSPACE = 400,
|
||||
@ -25,8 +25,9 @@ enum {
|
||||
#define ACS_LLCORNER SLSMG_LLCORN_CHAR
|
||||
#define ACS_URCORNER SLSMG_URCORN_CHAR
|
||||
#define ACS_LRCORNER SLSMG_LRCORN_CHAR
|
||||
#define ACS_PLUS SLSMG_PLUS_CHAR
|
||||
|
||||
#define COLS SLtt_Screen_Cols
|
||||
#define LINES SLtt_Screen_Rows
|
||||
|
||||
#endif /* MC_TTY_SLANG_H */
|
||||
#endif /* MC_TTY_SLANG_H */
|
||||
|
@ -49,7 +49,7 @@ gboolean slow_tty = FALSE;
|
||||
/* If true use +, -, | for line drawing */
|
||||
gboolean ugly_line_drawing = FALSE;
|
||||
|
||||
int mc_tty_ugly_frm[] = { '|', '-', '|', '-', '+', '+', '+', '+', '+', '+'};
|
||||
int mc_tty_ugly_frm[MC_TTY_FRM_MAX];
|
||||
|
||||
/*** file scope macro definitions **************************************/
|
||||
|
||||
@ -62,7 +62,7 @@ static volatile sig_atomic_t got_interrupt = 0;
|
||||
/*** file scope functions **********************************************/
|
||||
|
||||
static void
|
||||
sigintr_handler(int signo)
|
||||
sigintr_handler (int signo)
|
||||
{
|
||||
(void) &signo;
|
||||
got_interrupt = 1;
|
||||
@ -77,7 +77,7 @@ tty_is_slow (void)
|
||||
}
|
||||
|
||||
extern void
|
||||
tty_start_interrupt_key(void)
|
||||
tty_start_interrupt_key (void)
|
||||
{
|
||||
struct sigaction act;
|
||||
|
||||
@ -88,7 +88,7 @@ tty_start_interrupt_key(void)
|
||||
}
|
||||
|
||||
extern void
|
||||
tty_enable_interrupt_key(void)
|
||||
tty_enable_interrupt_key (void)
|
||||
{
|
||||
struct sigaction act;
|
||||
|
||||
@ -100,7 +100,7 @@ tty_enable_interrupt_key(void)
|
||||
}
|
||||
|
||||
extern void
|
||||
tty_disable_interrupt_key(void)
|
||||
tty_disable_interrupt_key (void)
|
||||
{
|
||||
struct sigaction act;
|
||||
|
||||
@ -111,7 +111,7 @@ tty_disable_interrupt_key(void)
|
||||
}
|
||||
|
||||
extern gboolean
|
||||
tty_got_interrupt(void)
|
||||
tty_got_interrupt (void)
|
||||
{
|
||||
gboolean rv;
|
||||
|
||||
@ -123,34 +123,28 @@ tty_got_interrupt(void)
|
||||
void
|
||||
tty_print_one_hline (void)
|
||||
{
|
||||
if (ugly_line_drawing || slow_tty)
|
||||
tty_print_char (mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz]);
|
||||
else
|
||||
tty_print_alt_char (ACS_HLINE);
|
||||
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz]);
|
||||
}
|
||||
|
||||
void
|
||||
tty_print_one_vline (void)
|
||||
{
|
||||
if (ugly_line_drawing || slow_tty)
|
||||
tty_print_char (mc_tty_ugly_frm[MC_TTY_FRM_thinvert]);
|
||||
else
|
||||
tty_print_alt_char (ACS_VLINE);
|
||||
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_thinvert]);
|
||||
}
|
||||
|
||||
void
|
||||
tty_draw_box_slow (int y, int x, int ys, int xs)
|
||||
tty_draw_box (int y, int x, int ys, int xs)
|
||||
{
|
||||
tty_draw_vline (y, x, mc_tty_ugly_frm[MC_TTY_FRM_vert], ys);
|
||||
tty_draw_vline (y, x + xs - 1, mc_tty_ugly_frm[MC_TTY_FRM_vert], ys);
|
||||
tty_draw_hline (y, x, mc_tty_ugly_frm[MC_TTY_FRM_horiz], xs);
|
||||
tty_draw_hline (y + ys - 1, x, mc_tty_ugly_frm[MC_TTY_FRM_horiz], xs);
|
||||
tty_gotoyx (y, x);
|
||||
tty_print_char (mc_tty_ugly_frm[MC_TTY_FRM_lefttop]);
|
||||
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_lefttop]);
|
||||
tty_gotoyx (y + ys - 1, x);
|
||||
tty_print_char (mc_tty_ugly_frm[MC_TTY_FRM_leftbottom]);
|
||||
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_leftbottom]);
|
||||
tty_gotoyx (y, x + xs - 1);
|
||||
tty_print_char (mc_tty_ugly_frm[MC_TTY_FRM_righttop]);
|
||||
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_righttop]);
|
||||
tty_gotoyx (y + ys - 1, x + xs - 1);
|
||||
tty_print_char (mc_tty_ugly_frm[MC_TTY_FRM_rightbottom]);
|
||||
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_rightbottom]);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
#ifndef MC_TTY_H
|
||||
#define MC_TTY_H
|
||||
|
||||
#include "../../src/global.h" /* include <glib.h> */
|
||||
#include "../../src/global.h" /* include <glib.h> */
|
||||
|
||||
#ifdef HAVE_SLANG
|
||||
# include "../../src/tty/tty-slang.h"
|
||||
@ -26,10 +26,10 @@ extern void tty_shutdown (void);
|
||||
|
||||
extern gboolean tty_is_slow (void);
|
||||
|
||||
extern void tty_start_interrupt_key(void);
|
||||
extern void tty_enable_interrupt_key(void);
|
||||
extern void tty_disable_interrupt_key(void);
|
||||
extern gboolean tty_got_interrupt(void);
|
||||
extern void tty_start_interrupt_key (void);
|
||||
extern void tty_enable_interrupt_key (void);
|
||||
extern void tty_disable_interrupt_key (void);
|
||||
extern gboolean tty_got_interrupt (void);
|
||||
|
||||
extern void tty_reset_prog_mode (void);
|
||||
extern void tty_reset_shell_mode (void);
|
||||
@ -57,29 +57,28 @@ extern int tty_lowlevel_getch (void);
|
||||
extern int tty_reset_screen (void);
|
||||
extern void tty_touch_screen (void);
|
||||
|
||||
extern void tty_gotoyx(int y, int x);
|
||||
extern void tty_getyx(int *py, int *px);
|
||||
extern void tty_gotoyx (int y, int x);
|
||||
extern void tty_getyx (int *py, int *px);
|
||||
|
||||
extern void tty_set_alt_charset (gboolean alt_charset);
|
||||
|
||||
extern void tty_display_8bit (gboolean what);
|
||||
extern void tty_print_char(int c);
|
||||
extern void tty_print_alt_char(int c);
|
||||
extern void tty_print_anychar(int c);
|
||||
extern void tty_print_string(const char *s);
|
||||
extern void tty_printf(const char *s, ...);
|
||||
extern void tty_print_char (int c);
|
||||
extern void tty_print_alt_char (int c);
|
||||
extern void tty_print_anychar (int c);
|
||||
extern void tty_print_string (const char *s);
|
||||
extern void tty_printf (const char *s, ...);
|
||||
|
||||
extern void tty_print_one_vline (void);
|
||||
extern void tty_print_one_hline (void);
|
||||
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_box (int y, int x, int rows, int cols);
|
||||
extern void tty_draw_box_slow (int y, int x, int ys, int xs);
|
||||
extern void tty_fill_region (int y, int x, int rows, int cols, unsigned char ch);
|
||||
|
||||
extern int mc_tty_ugly_frm[];
|
||||
|
||||
typedef enum{
|
||||
typedef enum {
|
||||
MC_TTY_FRM_thinvert,
|
||||
MC_TTY_FRM_thinhoriz,
|
||||
MC_TTY_FRM_vert,
|
||||
@ -88,8 +87,12 @@ typedef enum{
|
||||
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_rightmiddle,
|
||||
MC_TTY_FRM_centermiddle,
|
||||
MC_TTY_FRM_MAX
|
||||
} mc_tty_frm_t;
|
||||
|
||||
extern char *tty_tgetstr (const char *name);
|
||||
@ -103,4 +106,6 @@ extern void tty_beep (void);
|
||||
extern void tty_refresh (void);
|
||||
extern void tty_setup_sigwinch (void (*handler) (int));
|
||||
|
||||
#endif /* MC_TTY_H */
|
||||
extern int mc_tty_normalize_lines_char (const char *);
|
||||
|
||||
#endif /* MC_TTY_H */
|
||||
|
@ -32,10 +32,10 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../../src/tty/tty.h" /* tty_gotoyx, tty_print_char */
|
||||
#include "../../src/tty/tty.h" /* tty_gotoyx, tty_print_char */
|
||||
#include "../../src/tty/win.h"
|
||||
|
||||
#include "../../src/cons.saver.h" /* console_flag */
|
||||
#include "../../src/cons.saver.h" /* console_flag */
|
||||
|
||||
/*** global variables **************************************************/
|
||||
|
||||
@ -62,13 +62,11 @@ rxvt_getc (void)
|
||||
int r;
|
||||
unsigned char c;
|
||||
|
||||
while (read (0, &c, 1) != 1)
|
||||
;
|
||||
while (read (0, &c, 1) != 1);
|
||||
if (c == '\n')
|
||||
return -1;
|
||||
return -1;
|
||||
r = (c - 'A') * 16;
|
||||
while (read (0, &c, 1) != 1)
|
||||
;
|
||||
while (read (0, &c, 1) != 1);
|
||||
r += (c - 'A');
|
||||
return r;
|
||||
}
|
||||
@ -92,8 +90,8 @@ void
|
||||
do_enter_ca_mode (void)
|
||||
{
|
||||
if (xterm_flag) {
|
||||
fprintf (stdout, /* ESC_STR ")0" */ ESC_STR "7" ESC_STR "[?47h");
|
||||
fflush (stdout);
|
||||
fprintf (stdout, /* ESC_STR ")0" */ ESC_STR "7" ESC_STR "[?47h");
|
||||
fflush (stdout);
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,8 +99,8 @@ void
|
||||
do_exit_ca_mode (void)
|
||||
{
|
||||
if (xterm_flag) {
|
||||
fprintf (stdout, ESC_STR "[?47l" ESC_STR "8" ESC_STR "[m");
|
||||
fflush (stdout);
|
||||
fprintf (stdout, ESC_STR "[?47l" ESC_STR "8" ESC_STR "[m");
|
||||
fflush (stdout);
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,38 +110,36 @@ show_rxvt_contents (int starty, unsigned char y1, unsigned char y2)
|
||||
unsigned char *k;
|
||||
int bytes, i, j, cols = 0;
|
||||
|
||||
y1 += (keybar_visible != 0); /* i don't knwo why we need this - paul */
|
||||
y1 += (keybar_visible != 0); /* i don't knwo why we need this - paul */
|
||||
y2 += (keybar_visible != 0);
|
||||
while (anything_ready ())
|
||||
tty_lowlevel_getch ();
|
||||
tty_lowlevel_getch ();
|
||||
|
||||
/* my own wierd protocol base 26 - paul */
|
||||
printf ("\033CL%c%c%c%c\n",
|
||||
(y1 / 26) + 'A', (y1 % 26) + 'A',
|
||||
(y2 / 26) + 'A', (y2 % 26) + 'A');
|
||||
printf ("\033CL%c%c%c%c\n", (y1 / 26) + 'A', (y1 % 26) + 'A', (y2 / 26) + 'A', (y2 % 26) + 'A');
|
||||
|
||||
bytes = (y2 - y1) * (COLS + 1) + 1; /* *should* be the number of bytes read */
|
||||
bytes = (y2 - y1) * (COLS + 1) + 1; /* *should* be the number of bytes read */
|
||||
j = 0;
|
||||
k = g_malloc (bytes);
|
||||
for (;;) {
|
||||
int c;
|
||||
c = rxvt_getc ();
|
||||
if (c < 0)
|
||||
break;
|
||||
if (j < bytes)
|
||||
k[j++] = c;
|
||||
for (cols = 1; ; cols++) {
|
||||
c = rxvt_getc ();
|
||||
if (c < 0)
|
||||
break;
|
||||
if (j < bytes)
|
||||
k[j++] = c;
|
||||
}
|
||||
int c;
|
||||
c = rxvt_getc ();
|
||||
if (c < 0)
|
||||
break;
|
||||
if (j < bytes)
|
||||
k[j++] = c;
|
||||
for (cols = 1;; cols++) {
|
||||
c = rxvt_getc ();
|
||||
if (c < 0)
|
||||
break;
|
||||
if (j < bytes)
|
||||
k[j++] = c;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < j; i++) {
|
||||
if ((i % cols) == 0)
|
||||
tty_gotoyx (starty + (i / cols), 0);
|
||||
tty_print_char (is_printable (k[i]) ? k[i] : ' ');
|
||||
if ((i % cols) == 0)
|
||||
tty_gotoyx (starty + (i / cols), 0);
|
||||
tty_print_char (is_printable (k[i]) ? k[i] : ' ');
|
||||
}
|
||||
g_free (k);
|
||||
}
|
||||
@ -154,13 +150,13 @@ look_for_rxvt_extensions (void)
|
||||
static gboolean been_called = FALSE;
|
||||
|
||||
if (!been_called) {
|
||||
const char *e = getenv ("RXVT_EXT");
|
||||
rxvt_extensions = ((e != NULL) && (strcmp (e, "1.0") == 0));
|
||||
been_called = TRUE;
|
||||
const char *e = getenv ("RXVT_EXT");
|
||||
rxvt_extensions = ((e != NULL) && (strcmp (e, "1.0") == 0));
|
||||
been_called = TRUE;
|
||||
}
|
||||
|
||||
if (rxvt_extensions)
|
||||
console_flag = 4;
|
||||
console_flag = 4;
|
||||
|
||||
return rxvt_extensions;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifndef MC_WIN_H
|
||||
#define MC_WIN_H
|
||||
|
||||
#include "../../src/global.h" /* <glib.h> */
|
||||
#include "../../src/global.h" /* <glib.h> */
|
||||
|
||||
extern int xterm_flag;
|
||||
|
||||
@ -16,4 +16,4 @@ void do_exit_ca_mode (void);
|
||||
void show_rxvt_contents (int starty, unsigned char y1, unsigned char y2);
|
||||
gboolean look_for_rxvt_extensions (void);
|
||||
|
||||
#endif /* MC_WIN_H */
|
||||
#endif /* MC_WIN_H */
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#ifndef HAVE_TEXTMODE_X11_SUPPORT
|
||||
typedef int dummy; /* C99 forbids empty compilation unit */
|
||||
typedef int dummy; /* C99 forbids empty compilation unit */
|
||||
#else
|
||||
|
||||
#include <setjmp.h>
|
||||
@ -51,14 +51,14 @@ typedef int (*mc_XIOErrorHandler_callback) (Display *);
|
||||
|
||||
#ifdef HAVE_GMODULE
|
||||
|
||||
static Display * (*func_XOpenDisplay) (_Xconst char *);
|
||||
static Display *(*func_XOpenDisplay) (_Xconst char *);
|
||||
static int (*func_XCloseDisplay) (Display *);
|
||||
static mc_XErrorHandler_callback (*func_XSetErrorHandler)
|
||||
(mc_XErrorHandler_callback);
|
||||
(mc_XErrorHandler_callback);
|
||||
static mc_XIOErrorHandler_callback (*func_XSetIOErrorHandler)
|
||||
(mc_XIOErrorHandler_callback);
|
||||
(mc_XIOErrorHandler_callback);
|
||||
static Bool (*func_XQueryPointer) (Display *, Window, Window *, Window *,
|
||||
int *, int *, int *, int *, unsigned int *);
|
||||
int *, int *, int *, int *, unsigned int *);
|
||||
|
||||
static GModule *x11_module;
|
||||
|
||||
@ -79,80 +79,80 @@ static gboolean handlers_installed = FALSE;
|
||||
* reconnect, as that would violate the X11 protocol. */
|
||||
static gboolean lost_connection = FALSE;
|
||||
|
||||
static jmp_buf x11_exception; /* FIXME: get a better name */
|
||||
static jmp_buf x11_exception; /* FIXME: get a better name */
|
||||
static gboolean longjmp_allowed = FALSE;
|
||||
|
||||
/*** file private functions ********************************************/
|
||||
|
||||
static int x_io_error_handler (Display *dpy)
|
||||
static int
|
||||
x_io_error_handler (Display * dpy)
|
||||
{
|
||||
(void) dpy;
|
||||
|
||||
lost_connection = TRUE;
|
||||
if (longjmp_allowed) {
|
||||
longjmp_allowed = FALSE;
|
||||
longjmp(x11_exception, 1);
|
||||
longjmp_allowed = FALSE;
|
||||
longjmp (x11_exception, 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int x_error_handler (Display *dpy, XErrorEvent *ee)
|
||||
static int
|
||||
x_error_handler (Display * dpy, XErrorEvent * ee)
|
||||
{
|
||||
(void) ee;
|
||||
(void) func_XCloseDisplay (dpy);
|
||||
return x_io_error_handler (dpy);
|
||||
}
|
||||
|
||||
static void install_error_handlers(void)
|
||||
static void
|
||||
install_error_handlers (void)
|
||||
{
|
||||
if (handlers_installed) return;
|
||||
if (handlers_installed)
|
||||
return;
|
||||
|
||||
(void) func_XSetErrorHandler (x_error_handler);
|
||||
(void) func_XSetIOErrorHandler (x_io_error_handler);
|
||||
handlers_installed = TRUE;
|
||||
}
|
||||
|
||||
static gboolean x11_available(void)
|
||||
static gboolean
|
||||
x11_available (void)
|
||||
{
|
||||
#ifdef HAVE_GMODULE
|
||||
gchar *x11_module_fname;
|
||||
|
||||
if (lost_connection)
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
if (x11_module != NULL)
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
|
||||
x11_module_fname = g_module_build_path (NULL, "X11");
|
||||
x11_module = g_module_open (x11_module_fname, G_MODULE_BIND_LAZY);
|
||||
if (x11_module == NULL)
|
||||
x11_module = g_module_open ("libX11.so.6", G_MODULE_BIND_LAZY);
|
||||
x11_module = g_module_open ("libX11.so.6", G_MODULE_BIND_LAZY);
|
||||
|
||||
g_free (x11_module_fname);
|
||||
|
||||
if (x11_module == NULL)
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
if (!g_module_symbol (x11_module, "XOpenDisplay",
|
||||
(void *) &func_XOpenDisplay))
|
||||
goto cleanup;
|
||||
if (!g_module_symbol (x11_module, "XCloseDisplay",
|
||||
(void *) &func_XCloseDisplay))
|
||||
goto cleanup;
|
||||
if (!g_module_symbol (x11_module, "XQueryPointer",
|
||||
(void *) &func_XQueryPointer))
|
||||
goto cleanup;
|
||||
if (!g_module_symbol (x11_module, "XSetErrorHandler",
|
||||
(void *) &func_XSetErrorHandler))
|
||||
goto cleanup;
|
||||
if (!g_module_symbol (x11_module, "XSetIOErrorHandler",
|
||||
(void *) &func_XSetIOErrorHandler))
|
||||
goto cleanup;
|
||||
if (!g_module_symbol (x11_module, "XOpenDisplay", (void *) &func_XOpenDisplay))
|
||||
goto cleanup;
|
||||
if (!g_module_symbol (x11_module, "XCloseDisplay", (void *) &func_XCloseDisplay))
|
||||
goto cleanup;
|
||||
if (!g_module_symbol (x11_module, "XQueryPointer", (void *) &func_XQueryPointer))
|
||||
goto cleanup;
|
||||
if (!g_module_symbol (x11_module, "XSetErrorHandler", (void *) &func_XSetErrorHandler))
|
||||
goto cleanup;
|
||||
if (!g_module_symbol (x11_module, "XSetIOErrorHandler", (void *) &func_XSetIOErrorHandler))
|
||||
goto cleanup;
|
||||
|
||||
install_error_handlers();
|
||||
install_error_handlers ();
|
||||
return TRUE;
|
||||
|
||||
cleanup:
|
||||
cleanup:
|
||||
func_XOpenDisplay = 0;
|
||||
func_XCloseDisplay = 0;
|
||||
func_XQueryPointer = 0;
|
||||
@ -162,58 +162,61 @@ cleanup:
|
||||
x11_module = NULL;
|
||||
return FALSE;
|
||||
#else
|
||||
install_error_handlers();
|
||||
install_error_handlers ();
|
||||
return !(lost_connection);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*** public functions **************************************************/
|
||||
|
||||
Display *mc_XOpenDisplay (const char *displayname)
|
||||
Display *
|
||||
mc_XOpenDisplay (const char *displayname)
|
||||
{
|
||||
Display *retval;
|
||||
|
||||
if (x11_available()) {
|
||||
if (setjmp(x11_exception) == 0) {
|
||||
longjmp_allowed = TRUE;
|
||||
retval = func_XOpenDisplay (displayname);
|
||||
longjmp_allowed = FALSE;
|
||||
return retval;
|
||||
}
|
||||
if (x11_available ()) {
|
||||
if (setjmp (x11_exception) == 0) {
|
||||
longjmp_allowed = TRUE;
|
||||
retval = func_XOpenDisplay (displayname);
|
||||
longjmp_allowed = FALSE;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int mc_XCloseDisplay (Display *display)
|
||||
int
|
||||
mc_XCloseDisplay (Display * display)
|
||||
{
|
||||
int retval;
|
||||
|
||||
if (x11_available()) {
|
||||
if (setjmp(x11_exception) == 0) {
|
||||
longjmp_allowed = TRUE;
|
||||
retval = func_XCloseDisplay (display);
|
||||
longjmp_allowed = FALSE;
|
||||
return retval;
|
||||
}
|
||||
if (x11_available ()) {
|
||||
if (setjmp (x11_exception) == 0) {
|
||||
longjmp_allowed = TRUE;
|
||||
retval = func_XCloseDisplay (display);
|
||||
longjmp_allowed = FALSE;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Bool mc_XQueryPointer (Display *display, Window win, Window *root_return,
|
||||
Window *child_return, int *root_x_return, int *root_y_return,
|
||||
int *win_x_return, int *win_y_return, unsigned int *mask_return)
|
||||
Bool
|
||||
mc_XQueryPointer (Display * display, Window win, Window * root_return,
|
||||
Window * child_return, int *root_x_return, int *root_y_return,
|
||||
int *win_x_return, int *win_y_return, unsigned int *mask_return)
|
||||
{
|
||||
Bool retval;
|
||||
|
||||
if (x11_available()) {
|
||||
if (setjmp(x11_exception) == 0) {
|
||||
longjmp_allowed = TRUE;
|
||||
retval = func_XQueryPointer (display, win, root_return,
|
||||
child_return, root_x_return, root_y_return,
|
||||
win_x_return, win_y_return, mask_return);
|
||||
longjmp_allowed = FALSE;
|
||||
return retval;
|
||||
}
|
||||
if (x11_available ()) {
|
||||
if (setjmp (x11_exception) == 0) {
|
||||
longjmp_allowed = TRUE;
|
||||
retval = func_XQueryPointer (display, win, root_return,
|
||||
child_return, root_x_return, root_y_return,
|
||||
win_x_return, win_y_return, mask_return);
|
||||
longjmp_allowed = FALSE;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
*root_return = None;
|
||||
*child_return = None;
|
||||
|
@ -23,6 +23,6 @@ extern Display *mc_XOpenDisplay (const char *);
|
||||
extern int mc_XCloseDisplay (Display *);
|
||||
|
||||
extern Bool mc_XQueryPointer (Display *, Window, Window *, Window *,
|
||||
int *, int *, int *, int *, unsigned int *);
|
||||
int *, int *, int *, int *, unsigned int *);
|
||||
|
||||
#endif
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include "global.h"
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "dir.h"
|
||||
#include "panel.h"
|
||||
#include "main.h"
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "../src/global.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/key.h"
|
||||
#include "../src/strutil.h"
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include "../src/global.h"
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/main.h"
|
||||
#include "../src/wtools.h"
|
||||
#include "../src/charsets.h"
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include "../src/main.h"
|
||||
#include "../src/charsets.h"
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include "../src/main.h"
|
||||
#include "../src/charsets.h"
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "internal.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/mouse.h"
|
||||
#include "../src/tty/key.h" /* XCTRL and ALT macros */
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h" /* INPUT_COLOR */
|
||||
#include "../src/skin/skin.h" /* INPUT_COLOR */
|
||||
#include "../src/tty/key.h" /* tty_getch() */
|
||||
|
||||
#include "dialog.h"
|
||||
|
Loading…
Reference in New Issue
Block a user