Ticket #2028: fixed memory leak in mc_search__hex_translate_to_regex() function.
[kaloumi3.git] / lib / skin / lines.c
blob6330e1cc552e38209b6a4008b17020a88c99630f
1 /*
2 Skins engine.
3 Work with line draving chars.
5 Copyright (C) 2009 The Free Software Foundation, Inc.
7 Written by:
8 Slava Zanko <slavazanko@gmail.com>, 2009.
10 This file is part of the Midnight Commander.
12 The Midnight Commander is free software; you can redistribute it
13 and/or modify it under the terms of the GNU General Public License as
14 published by the Free Software Foundation; either version 2 of the
15 License, or (at your option) any later version.
17 The Midnight Commander is distributed in the hope that it will be
18 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
19 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
25 MA 02110-1301, USA.
28 #include <config.h>
29 #include <stdlib.h>
31 #include "internal.h"
32 #include "lib/tty/tty.h"
34 #include "src/args.h"
38 /*** global variables ****************************************************************************/
40 /*** file scope macro definitions ****************************************************************/
42 /*** file scope type declarations ****************************************************************/
44 /*** file scope variables ************************************************************************/
46 /*** file scope functions ************************************************************************/
48 static int
49 mc_skin_lines_load_frm (mc_skin_t * mc_skin, const char *name)
51 int ret;
52 char *frm_val = NULL;
53 frm_val = mc_config_get_string_raw (mc_skin->config, "Lines", name, " ");
54 ret = mc_tty_normalize_lines_char (frm_val);
56 g_free (frm_val);
58 switch (ret) {
59 case 0x80:
60 ret = ACS_HLINE;
61 break;
62 case 0x81:
63 ret = ACS_VLINE;
64 break;
65 case 0x82:
66 ret = ACS_ULCORNER;
67 break;
68 case 0x83:
69 ret = ACS_URCORNER;
70 break;
71 case 0x84:
72 ret = ACS_LLCORNER;
73 break;
74 case 0x85:
75 ret = ACS_LRCORNER;
76 break;
77 case 0x86:
78 ret = ACS_LTEE;
79 break;
80 case 0x87:
81 ret = ACS_RTEE;
82 break;
83 case 0x8a:
84 ret = ACS_PLUS;
85 break;
86 default:
87 break;
90 return ret;
93 /* --------------------------------------------------------------------------------------------- */
94 /*** public functions ****************************************************************************/
95 /* --------------------------------------------------------------------------------------------- */
97 void
98 mc_skin_lines_parse_ini_file (mc_skin_t * mc_skin)
100 if (mc_args__slow_terminal) {
101 mc_skin_hardcoded_space_lines (mc_skin);
102 } else if (mc_args__ugly_line_drawing) {
103 mc_skin_hardcoded_ugly_lines (mc_skin);
106 mc_tty_ugly_frm[MC_TTY_FRM_horiz] = mc_skin_lines_load_frm (mc_skin, "horiz");
107 mc_tty_ugly_frm[MC_TTY_FRM_vert] = mc_skin_lines_load_frm (mc_skin, "vert");
108 mc_tty_ugly_frm[MC_TTY_FRM_lefttop] = mc_skin_lines_load_frm (mc_skin, "lefttop");
109 mc_tty_ugly_frm[MC_TTY_FRM_righttop] = mc_skin_lines_load_frm (mc_skin, "righttop");
110 mc_tty_ugly_frm[MC_TTY_FRM_leftbottom] = mc_skin_lines_load_frm (mc_skin, "leftbottom");
111 mc_tty_ugly_frm[MC_TTY_FRM_rightbottom] = mc_skin_lines_load_frm (mc_skin, "rightbottom");
112 mc_tty_ugly_frm[MC_TTY_FRM_thinvert] = mc_skin_lines_load_frm (mc_skin, "thinvert");
113 mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz] = mc_skin_lines_load_frm (mc_skin, "thinhoriz");
114 mc_tty_ugly_frm[MC_TTY_FRM_rightmiddle] = mc_skin_lines_load_frm (mc_skin, "rightmiddle");
115 mc_tty_ugly_frm[MC_TTY_FRM_centertop] = mc_skin_lines_load_frm (mc_skin, "centertop");
116 mc_tty_ugly_frm[MC_TTY_FRM_centerbottom] = mc_skin_lines_load_frm (mc_skin, "centerbottom");
117 mc_tty_ugly_frm[MC_TTY_FRM_centermiddle] = mc_skin_lines_load_frm (mc_skin, "centermiddle");
118 mc_tty_ugly_frm[MC_TTY_FRM_leftmiddle] = mc_skin_lines_load_frm (mc_skin, "leftmiddle");
122 /* --------------------------------------------------------------------------------------------- */