1 /* 2 FXiTe - The Free eXtensIble Text Editor 3 Copyright (c) 2009-2012 Jeffrey Pohlmeyer <yetanothergeek@gmail.com> 4 5 This program is free software; you can redistribute it and/or modify it 6 under the terms of the GNU General Public License version 3 as 7 published by the Free Software Foundation. 8 9 This software 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 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, write to the Free Software 16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 19 #ifndef LANG_H 20 #define LANG_H 21 22 #include "color_funcs.h" 23 24 typedef enum { 25 Normal=0, 26 Bold=1, 27 Italic=2, 28 Underline=4, 29 EOLFill=8 30 } SciDocFontStyle; 31 32 33 34 typedef struct _StyleDef { 35 const char* key; // Human-readable key name for config file 36 int id; // Numeric SCE_* identifier 37 ColorName fg; // Foreground color, in #RRGGBB format 38 ColorName bg; // Background color, in #RRGGBB format 39 SciDocFontStyle style; // Bitmask of Normal | Bold | Italic 40 } StyleDef; 41 42 typedef enum { 43 TABS_DEFAULT, // Decide by preferences setting 44 TABS_ALWAYS, // Always use tabs 45 TABS_NEVER, // Always use spaces 46 TABS_AUTO // Decide by document content, else fallback to TABS_DEFAULT 47 } TabPolicy; 48 49 50 #define LANGSTYLE_MASK_ALLOCD 1<<30 51 #define LANGSTYLE_APPS_ALLOCD 1<<29 52 53 typedef struct _LangStyle 54 { 55 const char *name; // Human-readable language name 56 int id; // Scintilla SCLEX_* identifier 57 StyleDef*styles; // Array of style definitions 58 char **words; // Array of space-delimited keyword lists 59 char *mask; // Pipe-delimited list of wildcards { mallocs bit is (1<<30) } 60 char *apps; // Pipe-delimited list of applications { mallocs bit is (1<<29) } 61 FXuint mallocs; // Bitmask to track which keyword lists are malloc'd 62 TabPolicy tabs; // How to determine use of tabs or spaces. 63 unsigned char tabwidth; // Language-specific tab width ( or zero to use global setting. ) 64 } LangStyle; 65 66 67 extern LangStyle languages[]; 68 69 70 LangStyle*GetLangByName(const char*name); 71 LangStyle*GetLangFromDocName(const char*filename); 72 LangStyle*GetLangFromAppName(const char*app); 73 void SetKeywordList(LangStyle*lang, int index, const FXString &keywords); 74 void FreeAllKeywordLists(); 75 76 77 StyleDef* GetStyleFromId(StyleDef*styles, int id); 78 79 #endif 80 81