lines.c 4.7 KB

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