preferences.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. ktigcc - TIGCC IDE for KDE
  3. Copyright (C) 2004-2007 Kevin Kofler
  4. Copyright (C) 2006 Joey Adams
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2, or (at your option)
  8. any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software Foundation,
  15. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  16. */
  17. #pragma once
  18. #include <qstring.h>
  19. #include <qstringlist.h>
  20. #include <q3valuelist.h>
  21. #include <qpair.h>
  22. #include <qcolor.h>
  23. #include <qfont.h>
  24. #include <ticables.h>
  25. class QWidget;
  26. class KConfig;
  27. #define SYNS_CUSTOM 1
  28. #define SYNS_BOLD 2
  29. #define SYNS_UNDERLINE 4
  30. #define SYNS_ITALIC 8
  31. #define SYNS_STRIKEOUT 16
  32. typedef unsigned short Syn_Style;
  33. typedef struct
  34. {
  35. QString name;
  36. QString beginning;
  37. QString ending;
  38. QChar ignoreEndingAfter;
  39. bool switchable;
  40. bool lineStartOnly;
  41. QColor color;
  42. Syn_Style style;
  43. } Syn_CustomStyle;
  44. typedef struct
  45. {
  46. QString name;
  47. QStringList list;
  48. QColor color;
  49. Syn_Style style;
  50. bool caseSensitive;
  51. } Syn_WordList;
  52. typedef struct
  53. {
  54. bool enabled;
  55. QColor numberColor;
  56. QColor symbolColor;
  57. Q3ValueList<QColor> parenthesisColors;
  58. Syn_Style numberStyle;
  59. Syn_Style symbolStyle;
  60. Syn_Style parenthesisStyle;
  61. Q3ValueList<Syn_CustomStyle> customStyles;
  62. Q3ValueList<Syn_WordList> wordLists;
  63. } Syn_SettingsForDoc;
  64. int SynToXML(Syn_SettingsForDoc &syn,const QString &destFileName);
  65. enum LinkTargets {LT_NONE, LT_TIEMU, LT_REALCALC};
  66. typedef struct
  67. {
  68. // General
  69. bool stopAtFirstError;
  70. bool jumpToError;
  71. bool successMessage;
  72. bool deleteAsmFiles;
  73. bool deleteObjFiles;
  74. bool splitSourceFiles;
  75. bool allowImplicitDeclaration;
  76. bool autoSave;
  77. bool downloadHeadlines;
  78. bool deleteOverwrittenErrors;
  79. bool useSystemIcons;
  80. // Transfer
  81. LinkTargets linkTarget;
  82. CablePort linkPort;
  83. CableModel linkCable;
  84. // Editor
  85. unsigned short tabWidthC;
  86. unsigned short tabWidthAsm;
  87. bool useBgColor;
  88. QColor bgColor;
  89. QFont editorFont;
  90. bool useCalcCharset;
  91. bool lazyLoading;
  92. bool autoBlocks;
  93. bool removeTrailingSpaces;
  94. // Syntax Highlighting
  95. Syn_SettingsForDoc synC;
  96. Syn_SettingsForDoc synS;
  97. Syn_SettingsForDoc synAsm;
  98. Syn_SettingsForDoc synQll;
  99. // Coding
  100. Q3ValueList<QPair<QString,QString> > templates;
  101. // Used internally by the Preferences dialog
  102. bool haveA68k;
  103. bool haveQuill;
  104. Syn_SettingsForDoc tempSynC;
  105. Syn_SettingsForDoc tempSynS;
  106. Syn_SettingsForDoc tempSynAsm;
  107. Syn_SettingsForDoc tempSynQll;
  108. Syn_SettingsForDoc *syn;
  109. } TIGCCPrefs;
  110. void resetSyntaxPreference(Syn_SettingsForDoc *syn);
  111. void loadPreferences(void);
  112. void savePreferences(void);
  113. int showPreferencesDialog(QWidget *parent, bool haveA68k, bool haveQuill);
  114. extern TIGCCPrefs preferences;
  115. #define C_ENABLED_HL_MODE ("TIGCC C")
  116. #define S_ENABLED_HL_MODE ("TIGCC GNU As")
  117. #define ASM_ENABLED_HL_MODE ("TIGCC A68k")
  118. #define QLL_ENABLED_HL_MODE ("TIGCC Quill")
  119. #define C_HL_MODE (preferences.synC.enabled?C_ENABLED_HL_MODE:"None")
  120. #define S_HL_MODE (preferences.synS.enabled?S_ENABLED_HL_MODE:"None")
  121. #define ASM_HL_MODE (preferences.synAsm.enabled?ASM_ENABLED_HL_MODE:"None")
  122. #define QLL_HL_MODE (preferences.synQll.enabled?QLL_ENABLED_HL_MODE:"None")