lines.c 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. #include "src/args.h"
  26. /*** global variables ****************************************************************************/
  27. /*** file scope macro definitions ****************************************************************/
  28. /*** file scope type declarations ****************************************************************/
  29. /*** file scope variables ************************************************************************/
  30. /*** file scope functions ************************************************************************/
  31. static int
  32. mc_skin_lines_load_frm (mc_skin_t * mc_skin, const char *name)
  33. {
  34. int ret;
  35. char *frm_val = NULL;
  36. frm_val = mc_config_get_string_raw (mc_skin->config, "Lines", name, " ");
  37. ret = mc_tty_normalize_lines_char (frm_val);
  38. g_free (frm_val);
  39. #if 0
  40. switch (ret)
  41. {
  42. case 0x80:
  43. ret = ACS_HLINE;
  44. break;
  45. case 0x81:
  46. ret = ACS_VLINE;
  47. break;
  48. case 0x82:
  49. ret = ACS_ULCORNER;
  50. break;
  51. case 0x83:
  52. ret = ACS_URCORNER;
  53. break;
  54. case 0x84:
  55. ret = ACS_LLCORNER;
  56. break;
  57. case 0x85:
  58. ret = ACS_LRCORNER;
  59. break;
  60. case 0x86:
  61. ret = ACS_LTEE;
  62. break;
  63. case 0x87:
  64. ret = ACS_RTEE;
  65. break;
  66. case 0x8a:
  67. ret = ACS_PLUS;
  68. break;
  69. default:
  70. break;
  71. }
  72. #endif
  73. return ret;
  74. }
  75. /* --------------------------------------------------------------------------------------------- */
  76. /*** public functions ****************************************************************************/
  77. /* --------------------------------------------------------------------------------------------- */
  78. void
  79. mc_skin_lines_parse_ini_file (mc_skin_t * mc_skin)
  80. {
  81. if (mc_args__slow_terminal)
  82. mc_skin_hardcoded_space_lines (mc_skin);
  83. else if (mc_args__ugly_line_drawing)
  84. mc_skin_hardcoded_ugly_lines (mc_skin);
  85. /* single lines */
  86. mc_tty_frm[MC_TTY_FRM_VERT] = mc_skin_lines_load_frm (mc_skin, "vert");
  87. mc_tty_frm[MC_TTY_FRM_HORIZ] = mc_skin_lines_load_frm (mc_skin, "horiz");
  88. mc_tty_frm[MC_TTY_FRM_LEFTTOP] = mc_skin_lines_load_frm (mc_skin, "lefttop");
  89. mc_tty_frm[MC_TTY_FRM_RIGHTTOP] = mc_skin_lines_load_frm (mc_skin, "righttop");
  90. mc_tty_frm[MC_TTY_FRM_LEFTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "leftbottom");
  91. mc_tty_frm[MC_TTY_FRM_RIGHTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "rightbottom");
  92. mc_tty_frm[MC_TTY_FRM_TOPMIDDLE] = mc_skin_lines_load_frm (mc_skin, "topmiddle");
  93. mc_tty_frm[MC_TTY_FRM_BOTTOMMIDDLE] = mc_skin_lines_load_frm (mc_skin, "bottommiddle");
  94. mc_tty_frm[MC_TTY_FRM_LEFTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "leftmiddle");
  95. mc_tty_frm[MC_TTY_FRM_RIGHTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "rightmiddle");
  96. mc_tty_frm[MC_TTY_FRM_CROSS] = mc_skin_lines_load_frm (mc_skin, "cross");
  97. /* double lines */
  98. mc_tty_frm[MC_TTY_FRM_DVERT] = mc_skin_lines_load_frm (mc_skin, "dvert");
  99. mc_tty_frm[MC_TTY_FRM_DHORIZ] = mc_skin_lines_load_frm (mc_skin, "dhoriz");
  100. mc_tty_frm[MC_TTY_FRM_DLEFTTOP] = mc_skin_lines_load_frm (mc_skin, "dlefttop");
  101. mc_tty_frm[MC_TTY_FRM_DRIGHTTOP] = mc_skin_lines_load_frm (mc_skin, "drighttop");
  102. mc_tty_frm[MC_TTY_FRM_DLEFTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "dleftbottom");
  103. mc_tty_frm[MC_TTY_FRM_DRIGHTBOTTOM] = mc_skin_lines_load_frm (mc_skin, "drightbottom");
  104. mc_tty_frm[MC_TTY_FRM_DTOPMIDDLE] = mc_skin_lines_load_frm (mc_skin, "dtopmiddle");
  105. mc_tty_frm[MC_TTY_FRM_DBOTTOMMIDDLE] = mc_skin_lines_load_frm (mc_skin, "dbottommiddle");
  106. mc_tty_frm[MC_TTY_FRM_DLEFTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "dleftmiddle");
  107. mc_tty_frm[MC_TTY_FRM_DRIGHTMIDDLE] = mc_skin_lines_load_frm (mc_skin, "drightmiddle");
  108. }
  109. /* --------------------------------------------------------------------------------------------- */