root/lib/skin/lines.c

/* [previous][next][first][last][top][bottom][index][help]  */

DEFINITIONS

This source file includes following definitions.
  1. mc_skin_lines_load_frm
  2. mc_skin_lines_parse_ini_file

   1 /*
   2    Skins engine.
   3    Work with line draving chars.
   4 
   5    Copyright (C) 2009-2019
   6    Free Software Foundation, Inc.
   7 
   8    Written by:
   9    Slava Zanko <slavazanko@gmail.com>, 2009.
  10 
  11    This file is part of the Midnight Commander.
  12 
  13    The Midnight Commander is free software: you can redistribute it
  14    and/or modify it under the terms of the GNU General Public License as
  15    published by the Free Software Foundation, either version 3 of the License,
  16    or (at your option) any later version.
  17 
  18    The Midnight Commander is distributed in the hope that it will be useful,
  19    but WITHOUT ANY WARRANTY; without even the implied warranty of
  20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21    GNU General Public License for more details.
  22 
  23    You should have received a copy of the GNU General Public License
  24    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  25  */
  26 
  27 #include <config.h>
  28 #include <stdlib.h>
  29 
  30 #include "internal.h"
  31 #include "lib/tty/tty.h"
  32 
  33 /*** global variables ****************************************************************************/
  34 
  35 /*** file scope macro definitions ****************************************************************/
  36 
  37 /*** file scope type declarations ****************************************************************/
  38 
  39 /*** file scope variables ************************************************************************/
  40 
  41 /*** file scope functions ************************************************************************/
  42 
  43 static int
  44 mc_skin_lines_load_frm (mc_skin_t * mc_skin, const char *name)
     /* [previous][next][first][last][top][bottom][index][help]  */
  45 {
  46     int ret;
  47     char *frm_val = NULL;
  48     frm_val = mc_config_get_string_raw (mc_skin->config, "Lines", name, " ");
  49     ret = mc_tty_normalize_lines_char (frm_val);
  50 
  51     g_free (frm_val);
  52 
  53 #if 0
  54     switch (ret)
  55     {
  56     case 0x80:
  57         ret = ACS_HLINE;
  58         break;
  59     case 0x81:
  60         ret = ACS_VLINE;
  61         break;
  62     case 0x82:
  63         ret = ACS_ULCORNER;
  64         break;
  65     case 0x83:
  66         ret = ACS_URCORNER;
  67         break;
  68     case 0x84:
  69         ret = ACS_LLCORNER;
  70         break;
  71     case 0x85:
  72         ret = ACS_LRCORNER;
  73         break;
  74     case 0x86:
  75         ret = ACS_LTEE;
  76         break;
  77     case 0x87:
  78         ret = ACS_RTEE;
  79         break;
  80     case 0x8a:
  81         ret = ACS_PLUS;
  82         break;
  83     default:
  84         break;
  85     }
  86 #endif
  87 
  88     return ret;
  89 }
  90 
  91 /* --------------------------------------------------------------------------------------------- */
  92 /*** public functions ****************************************************************************/
  93 /* --------------------------------------------------------------------------------------------- */
  94 
  95 void
  96 mc_skin_lines_parse_ini_file (mc_skin_t * mc_skin)
     /* [previous][next][first][last][top][bottom][index][help]  */
  97 {
  98     if (mc_global.tty.slow_terminal)
  99         mc_skin_hardcoded_space_lines (mc_skin);
 100     else if (mc_global.tty.ugly_line_drawing)
 101         mc_skin_hardcoded_ugly_lines (mc_skin);
 102 
 103     /* single lines */
 104     mc_tty_frm[MC_TTY_FRM_VERT] = mc_skin_lines_load_frm (mc_skin, "vert");
 105     mc_tty_frm[MC_TTY_FRM_HORIZ] = mc_skin_lines_load_frm (mc_skin, "horiz");
 106     mc_tty_frm[MC_TTY_FRM_LEFTTOP] = mc_skin_lines_load_frm (mc_skin, "lefttop");
 107     mc_tty_frm[MC_TTY_FRM_RIGHTTOP] = mc_skin_lines_load_frm (mc_skin, "righttop");
 108     mc_tty_frm[MC_TTY_FRM_LEFTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "leftbottom");
 109     mc_tty_frm[MC_TTY_FRM_RIGHTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "rightbottom");
 110     mc_tty_frm[MC_TTY_FRM_TOPMIDDLE] = mc_skin_lines_load_frm (mc_skin, "topmiddle");
 111     mc_tty_frm[MC_TTY_FRM_BOTTOMMIDDLE] = mc_skin_lines_load_frm (mc_skin, "bottommiddle");
 112     mc_tty_frm[MC_TTY_FRM_LEFTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "leftmiddle");
 113     mc_tty_frm[MC_TTY_FRM_RIGHTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "rightmiddle");
 114     mc_tty_frm[MC_TTY_FRM_CROSS] = mc_skin_lines_load_frm (mc_skin, "cross");
 115 
 116     /* double lines */
 117     mc_tty_frm[MC_TTY_FRM_DVERT] = mc_skin_lines_load_frm (mc_skin, "dvert");
 118     mc_tty_frm[MC_TTY_FRM_DHORIZ] = mc_skin_lines_load_frm (mc_skin, "dhoriz");
 119     mc_tty_frm[MC_TTY_FRM_DLEFTTOP] = mc_skin_lines_load_frm (mc_skin, "dlefttop");
 120     mc_tty_frm[MC_TTY_FRM_DRIGHTTOP] = mc_skin_lines_load_frm (mc_skin, "drighttop");
 121     mc_tty_frm[MC_TTY_FRM_DLEFTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "dleftbottom");
 122     mc_tty_frm[MC_TTY_FRM_DRIGHTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "drightbottom");
 123     mc_tty_frm[MC_TTY_FRM_DTOPMIDDLE] = mc_skin_lines_load_frm (mc_skin, "dtopmiddle");
 124     mc_tty_frm[MC_TTY_FRM_DBOTTOMMIDDLE] = mc_skin_lines_load_frm (mc_skin, "dbottommiddle");
 125     mc_tty_frm[MC_TTY_FRM_DLEFTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "dleftmiddle");
 126     mc_tty_frm[MC_TTY_FRM_DRIGHTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "drightmiddle");
 127 }
 128 
 129 /* --------------------------------------------------------------------------------------------- */

/* [previous][next][first][last][top][bottom][index][help]  */