lines.c 4.8 KB

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