preferences.cpp 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319
  1. /*
  2. ktigcc - TIGCC IDE for KDE
  3. Copyright (C) 2004-2006 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. #include <cstdio>
  18. #include <cstdlib>
  19. #include <unistd.h>
  20. #include <sys/stat.h>
  21. #include <sys/dir.h>
  22. #include <kapplication.h>
  23. #include <kcmdlineargs.h>
  24. #include <kaboutdata.h>
  25. #include <qtextcodec.h>
  26. #include <qcolor.h>
  27. #include <qfont.h>
  28. #include <kconfig.h>
  29. #include "ktigcc.h"
  30. #include "preferences.h"
  31. #include "preferencesdlg.h"
  32. #include "tpr.h"
  33. TIGCCPrefs preferences;
  34. //these macros return 0 on success.
  35. #define syn_XMLStart(f) (fputs( \
  36. "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
  37. "<!DOCTYPE language SYSTEM \"language.dtd\">\n" \
  38. "<!-- Syntax highlighting information autogenerated by KTIGCC. -->\n" \
  39. "<language version=\"1.11\" kateversion=\"2.4\" name=\"Scheme\" section=\"Scripts\" extensions=\"*.scm;*.ss;*.scheme;*.guile\" mimetype=\"text/x-scheme\" author=\"KTIGCC\" license=\"LGPL\">\n" \
  40. ,(f))==EOF)
  41. #define syn_XMLEnd(f) (fputs("</language>\n",(f))==EOF)
  42. void stringReplaceItems(QString &dest,const QString &oldStr,const QString &newStr,unsigned long start,unsigned long maxoccurances)
  43. {
  44. unsigned long o;
  45. unsigned long len=oldStr.length();
  46. o=0;
  47. while ((start=dest.find(oldStr,start))!=0xFFFFFFFF&&(--maxoccurances))
  48. {
  49. dest.replace(start,len,newStr);
  50. start+=len;
  51. }
  52. }
  53. QString syn_encodeString(const QString &str)
  54. {
  55. QString ret=str;
  56. stringReplaceItems(ret,"&","&#38;",0,0xFFFFFFFF);
  57. stringReplaceItems(ret,"\n","&#10;",0,0xFFFFFFFF);
  58. stringReplaceItems(ret,"\r","&#13;",0,0xFFFFFFFF);
  59. stringReplaceItems(ret,"<","&#60;",0,0xFFFFFFFF);
  60. stringReplaceItems(ret,">","&#62;",0,0xFFFFFFFF);
  61. return ret;
  62. }
  63. //returns 0 on success
  64. int syn_XMLStrList(FILE *f,const QString &name,const QStringList &clist)
  65. {
  66. unsigned long i,e;
  67. if (fprintf(f,"<list name=\"%s\">\n",smartAscii(syn_encodeString(name)))==EOF)
  68. return 1;
  69. e=clist.count();
  70. for (i=0;i<e;i++)
  71. {
  72. if (fprintf(f,"<item> %s </item>\n",smartAscii(syn_encodeString(clist[i])))==EOF)
  73. return 1;
  74. }
  75. if (fputs("</list>\n",f)==EOF)
  76. return 1;
  77. return 0;
  78. }
  79. //returns 0 on success,-1 on file couldn't be created, and 1 if file couldn't be written to correctly.
  80. int SynToXML(Syn_SettingsForDoc &syn __attribute__((unused)),const QString &destFileName)
  81. {
  82. FILE *f=fopen(destFileName,"wb");
  83. if (!f)
  84. return -1;
  85. syn_XMLStart(f);
  86. if (fputs("<highlighting>\n",f)==EOF)
  87. return 1;
  88. if (fputs("<list name=\"symbols\">\n"
  89. "<item> &#60; </item>\n" //for '<'
  90. "<item> { </item>\n"
  91. "<item> [ </item>\n"
  92. "<item> ( </item>\n"
  93. "<item> ) </item>\n"
  94. "<item> ] </item>\n"
  95. "<item> } </item>\n"
  96. "<item> &#62; </item>\n" //for '>'
  97. "<item> ; </item>\n"
  98. "<item> : </item>\n"
  99. "<item> , </item>\n"
  100. "<item> . </item>\n"
  101. "<item> = </item>\n"
  102. "<item> + </item>\n"
  103. "<item> - </item>\n"
  104. "<item> * </item>\n"
  105. "<item> / </item>\n"
  106. "<item> \\ </item>\n"
  107. "<item> | </item>\n"
  108. "<item> \" </item>\n"
  109. "<item> \' </item>\n"
  110. "<item> ! </item>\n"
  111. "<item> ? </item>\n"
  112. "<item> &#38; </item>\n" //for '&'
  113. "<item> % </item>\n"
  114. "<item> # </item>\n"
  115. "<item> @ </item>\n"
  116. "<item> ^ </item>\n"
  117. "<item> ~ </item>\n"
  118. "</list>\n"
  119. ,f)==EOF)
  120. return 1;
  121. syn_XMLEnd(f);
  122. return 0;
  123. }
  124. Syn_Color syn_rgb(unsigned short r,unsigned short g,unsigned short b)
  125. {
  126. return (Syn_Color){r,g,b,0};
  127. }
  128. void defaultSynHighlight(TIGCCPrefs *prefs)
  129. {
  130. prefs->synC.enabled=true;
  131. prefs->synS.enabled=true;
  132. prefs->synASM.enabled=true;
  133. prefs->synQLL.enabled=true;
  134. prefs->synC.numberColor=syn_rgb(128,0,0);
  135. prefs->synS.numberColor=syn_rgb(128,0,0);
  136. prefs->synASM.numberColor=syn_rgb(128,0,0);
  137. prefs->synQLL.numberColor=syn_rgb(128,64,64);
  138. prefs->synC.symbolColor=syn_rgb(128,128,0);
  139. prefs->synS.symbolColor=syn_rgb(128,128,0);
  140. prefs->synASM.symbolColor=syn_rgb(128,128,0);
  141. prefs->synQLL.symbolColor=syn_rgb(128,128,0);
  142. prefs->synC.parenthesisColors.clear();
  143. prefs->synC.parenthesisColors << syn_rgb(128,0,128) << syn_rgb(0,128,192) << syn_rgb(255,128,128) << syn_rgb(0,128,0);
  144. prefs->synS.parenthesisColors=prefs->synC.parenthesisColors;
  145. prefs->synASM.parenthesisColors=prefs->synC.parenthesisColors;
  146. prefs->synQLL.parenthesisColors.clear();
  147. prefs->synQLL.parenthesisColors << syn_rgb(0,0,0) << syn_rgb(255,0,128);
  148. prefs->synC.numberStyle=0;
  149. prefs->synS.numberStyle=0;
  150. prefs->synASM.numberStyle=0;
  151. prefs->synQLL.numberStyle=0;
  152. prefs->synC.symbolStyle=SYNS_CUSTOM|SYNS_BOLD;
  153. prefs->synS.symbolStyle=SYNS_CUSTOM|SYNS_BOLD;
  154. prefs->synASM.symbolStyle=SYNS_CUSTOM|SYNS_BOLD;
  155. prefs->synQLL.symbolStyle=SYNS_CUSTOM|SYNS_BOLD;
  156. prefs->synC.parenthesisStyle=SYNS_CUSTOM|SYNS_BOLD;
  157. prefs->synS.parenthesisStyle=SYNS_CUSTOM|SYNS_BOLD;
  158. prefs->synASM.parenthesisStyle=SYNS_CUSTOM|SYNS_BOLD;
  159. prefs->synQLL.parenthesisStyle=SYNS_CUSTOM|SYNS_BOLD;
  160. Syn_CustomStyle Comment_Area;
  161. Comment_Area.name="Comment Area";
  162. Comment_Area.beginning="/*";
  163. Comment_Area.ending="*/";
  164. Comment_Area.ignoreEndingAfter=0;
  165. Comment_Area.switchable=false;
  166. Comment_Area.color=syn_rgb(0,128,0);
  167. Comment_Area.style=SYNS_CUSTOM|SYNS_ITALIC;
  168. Syn_CustomStyle Comment_Line;
  169. Comment_Line.name="Comment Line";
  170. Comment_Line.beginning="//";
  171. Comment_Line.ending="\n";
  172. Comment_Line.ignoreEndingAfter=0;
  173. Comment_Line.switchable=false;
  174. Comment_Line.color=syn_rgb(0,128,0);
  175. Comment_Line.style=SYNS_CUSTOM|SYNS_ITALIC;
  176. Syn_CustomStyle SCS_String;
  177. SCS_String.name="String";
  178. SCS_String.beginning="\"";
  179. SCS_String.ending="\"";
  180. SCS_String.ignoreEndingAfter='\\';
  181. SCS_String.switchable=false;
  182. SCS_String.color=syn_rgb(128,0,0);
  183. SCS_String.style=0;
  184. Syn_CustomStyle Character;
  185. Character.name="Character";
  186. Character.beginning="\'";
  187. Character.ending="\'";
  188. Character.ignoreEndingAfter='\\';
  189. Character.switchable=false;
  190. Character.color=syn_rgb(128,0,0);
  191. Character.style=0;
  192. Syn_CustomStyle Preprocessor_Directive;
  193. Preprocessor_Directive.name="Preprocessor Directive";
  194. Preprocessor_Directive.beginning="#";
  195. Preprocessor_Directive.ending=" ";
  196. Preprocessor_Directive.ignoreEndingAfter=0;
  197. Preprocessor_Directive.switchable=false;
  198. Preprocessor_Directive.color=syn_rgb(0,128,128);
  199. Preprocessor_Directive.style=SYNS_CUSTOM|SYNS_BOLD;
  200. Syn_CustomStyle Comment_Line_Pipe;
  201. Comment_Line_Pipe.name="Comment Line (|)";
  202. Comment_Line_Pipe.beginning="|";
  203. Comment_Line_Pipe.ending="\n";
  204. Comment_Line_Pipe.ignoreEndingAfter=0;
  205. Comment_Line_Pipe.switchable=false;
  206. Comment_Line_Pipe.color=syn_rgb(0,128,0);
  207. Comment_Line_Pipe.style=SYNS_CUSTOM|SYNS_ITALIC;
  208. Syn_CustomStyle Comment_Line_Pound;
  209. Comment_Line_Pound.name="Comment Line (#)";
  210. Comment_Line_Pound.beginning="#";
  211. Comment_Line_Pound.ending="\n";
  212. Comment_Line_Pound.ignoreEndingAfter=0;
  213. Comment_Line_Pound.switchable=false;
  214. Comment_Line_Pound.color=syn_rgb(0,128,0);
  215. Comment_Line_Pound.style=SYNS_CUSTOM|SYNS_ITALIC;
  216. Syn_CustomStyle Comment_Line_Semicolon;
  217. Comment_Line_Semicolon.name="Comment";
  218. Comment_Line_Semicolon.beginning=";";
  219. Comment_Line_Semicolon.ending="\n";
  220. Comment_Line_Semicolon.ignoreEndingAfter=0;
  221. Comment_Line_Semicolon.switchable=false;
  222. Comment_Line_Semicolon.color=syn_rgb(0,128,0);
  223. Comment_Line_Semicolon.style=SYNS_CUSTOM|SYNS_ITALIC;
  224. Syn_CustomStyle String_DoubleQuoted;
  225. String_DoubleQuoted.name="String (double-quoted)";
  226. String_DoubleQuoted.beginning="\"";
  227. String_DoubleQuoted.ending="\"";
  228. String_DoubleQuoted.ignoreEndingAfter=0;
  229. String_DoubleQuoted.switchable=false;
  230. String_DoubleQuoted.color=syn_rgb(128,0,0);
  231. String_DoubleQuoted.style=0;
  232. Syn_CustomStyle String_SingleQuoted;
  233. String_SingleQuoted.name="String (single-quoted)";
  234. String_SingleQuoted.beginning="\'";
  235. String_SingleQuoted.ending="\'";
  236. String_SingleQuoted.ignoreEndingAfter=0;
  237. String_SingleQuoted.switchable=false;
  238. String_SingleQuoted.color=syn_rgb(128,0,0);
  239. String_SingleQuoted.style=0;
  240. Syn_CustomStyle Compiler_Directive;
  241. Compiler_Directive.name="Compiler Directive";
  242. Compiler_Directive.beginning="#";
  243. Compiler_Directive.ending="\n";
  244. Compiler_Directive.ignoreEndingAfter='\\';
  245. Compiler_Directive.switchable=true;
  246. Compiler_Directive.color=syn_rgb(0,128,128);
  247. Compiler_Directive.style=SYNS_CUSTOM|SYNS_BOLD;
  248. prefs->synC.customStyles.clear();
  249. prefs->synS.customStyles.clear();
  250. prefs->synASM.customStyles.clear();
  251. prefs->synQLL.customStyles.clear();
  252. prefs->synC.customStyles << Comment_Area << Comment_Line << SCS_String << Character << Preprocessor_Directive;
  253. prefs->synS.customStyles << Comment_Area << Comment_Line_Pipe << Comment_Line_Pound << SCS_String << Character;
  254. prefs->synASM.customStyles << Comment_Line_Semicolon << String_DoubleQuoted << String_SingleQuoted;
  255. prefs->synQLL.customStyles << Comment_Area << Comment_Line << SCS_String << Character << Compiler_Directive;
  256. Syn_WordList C_Keywords;
  257. C_Keywords.name="C Keywords";
  258. C_Keywords.list="__alignof__\n"
  259. "__asm__\n"
  260. "__attribute__\n"
  261. "__complex__\n"
  262. "__const__\n"
  263. "__extension__\n"
  264. "__imag__\n"
  265. "__inline__\n"
  266. "__label__\n"
  267. "__real__\n"
  268. "__typeof__\n"
  269. "asm\n"
  270. "auto\n"
  271. "break\n"
  272. "case\n"
  273. "char\n"
  274. "const\n"
  275. "continue\n"
  276. "default\n"
  277. "do,double\n"
  278. "else\n"
  279. "enum\n"
  280. "extern\n"
  281. "float\n"
  282. "for,goto\n"
  283. "if,inline\n"
  284. "int,long\n"
  285. "register\n"
  286. "return\n"
  287. "short\n"
  288. "signed\n"
  289. "sizeof\n"
  290. "static\n"
  291. "struct\n"
  292. "switch\n"
  293. "typedef\n"
  294. "typeof\n"
  295. "union\n"
  296. "unsigned\n"
  297. "void\n"
  298. "volatile\n"
  299. "while\n";
  300. C_Keywords.color=syn_rgb(0,0,255);
  301. C_Keywords.style=SYNS_CUSTOM|SYNS_BOLD;
  302. C_Keywords.caseSensitive=true;
  303. Syn_WordList Data_Movement;
  304. Data_Movement.name="Data Movement";
  305. Data_Movement.list= "EXG\n"
  306. "LEA\n"
  307. "LINK\n"
  308. "MOV\n"
  309. "MOVE\n"
  310. "MOVEA\n"
  311. "MOVEM\n"
  312. "MOVEP\n"
  313. "MOVEQ\n"
  314. "MOVM\n"
  315. "MOVP\n"
  316. "MOVQ\n"
  317. "PEA\n"
  318. "UNLK\n";
  319. Data_Movement.color=syn_rgb(0,0,255);
  320. Data_Movement.style=0;
  321. Data_Movement.caseSensitive=false;
  322. Syn_WordList Integer_Arithmetic;
  323. Integer_Arithmetic.name="Integer Arithmetic";
  324. Integer_Arithmetic.list="ADD\n"
  325. "ADDA\n"
  326. "ADDI\n"
  327. "ADDQ\n"
  328. "ADDX\n"
  329. "CLR\n"
  330. "CMP\n"
  331. "CMPA\n"
  332. "CMPI\n"
  333. "CMPM\n"
  334. "DIVS\n"
  335. "DIVU\n"
  336. "EXT\n"
  337. "MULS\n"
  338. "MULU\n"
  339. "NEG\n"
  340. "NEGX\n"
  341. "SUB\n"
  342. "SUBA\n"
  343. "SUBI\n"
  344. "SUBQ\n"
  345. "SUBX\n";
  346. Integer_Arithmetic.color=syn_rgb(0,0,255);
  347. Integer_Arithmetic.style=0;
  348. Integer_Arithmetic.caseSensitive=false;
  349. Syn_WordList Logical_Instructions;
  350. Logical_Instructions.name="Logical Instructions";
  351. Logical_Instructions.list="AND\n"
  352. "ANDI\n"
  353. "EOR\n"
  354. "EORI\n"
  355. "NOT\n"
  356. "OR\n"
  357. "ORI\n";
  358. Logical_Instructions.color=syn_rgb(0,0,255);
  359. Logical_Instructions.style=0;
  360. Logical_Instructions.caseSensitive=false;
  361. Syn_WordList ShiftRotation_Instructions;
  362. ShiftRotation_Instructions.name="Shift/Rotation Instructions";
  363. ShiftRotation_Instructions.list="ASL\n"
  364. "ASR\n"
  365. "LSL\n"
  366. "LSR\n"
  367. "ROL\n"
  368. "ROR\n"
  369. "ROXL\n"
  370. "ROXR\n"
  371. "SWAP\n";
  372. ShiftRotation_Instructions.color=syn_rgb(0,0,255);
  373. ShiftRotation_Instructions.style=0;
  374. ShiftRotation_Instructions.caseSensitive=false;
  375. Syn_WordList Bit_Manipulation;
  376. Bit_Manipulation.name="Bit Manipulation";
  377. Bit_Manipulation.list="BCHG\n"
  378. "BCLR\n"
  379. "BSET\n"
  380. "BTST\n";
  381. Bit_Manipulation.color=syn_rgb(0,0,255);
  382. Bit_Manipulation.style=0;
  383. Bit_Manipulation.caseSensitive=false;
  384. Syn_WordList Program_Control;
  385. Program_Control.name="Program Control";
  386. Program_Control.list= "BCC\n"
  387. "BCS\n"
  388. "BEQ\n"
  389. "BGE\n"
  390. "BGT\n"
  391. "BHI\n"
  392. "BLE\n"
  393. "BLS\n"
  394. "BLT\n"
  395. "BMI\n"
  396. "BNE\n"
  397. "BPL\n"
  398. "BRA\n"
  399. "BSR\n"
  400. "BVC\n"
  401. "BVS\n"
  402. "JBCC\n"
  403. "JBCS\n"
  404. "JBEQ\n"
  405. "JBGE\n"
  406. "JBGT\n"
  407. "JBHI\n"
  408. "JBLE\n"
  409. "JBLS\n"
  410. "JBLT\n"
  411. "JBMI\n"
  412. "JBNE\n"
  413. "JBPL\n"
  414. "JBRA\n"
  415. "JBSR\n"
  416. "JBVC\n"
  417. "JBVS\n"
  418. "JSR\n"
  419. "JRA\n"
  420. "JMP\n"
  421. "NOP\n"
  422. "RTR\n"
  423. "RTS\n"
  424. "SCC\n"
  425. "SCS\n"
  426. "SEQ\n"
  427. "SF\n"
  428. "SGE\n"
  429. "SGT\n"
  430. "SHI\n"
  431. "SLE\n"
  432. "SLS\n"
  433. "SLT\n"
  434. "SMI\n"
  435. "SNE\n"
  436. "SPL\n"
  437. "ST\n"
  438. "SVC\n"
  439. "SVS\n"
  440. "TST\n"
  441. "JHI\n"
  442. "JLS\n"
  443. "JCC\n"
  444. "JCS\n"
  445. "JNE\n"
  446. "JEQ\n"
  447. "JVC\n"
  448. "JVS\n"
  449. "JPL\n"
  450. "JMI\n"
  451. "JGE\n"
  452. "JLT\n"
  453. "JGT\n"
  454. "JLE\n"
  455. "DBHI\n"
  456. "DBLS\n"
  457. "DBCC\n"
  458. "DBCS\n"
  459. "DBNE\n"
  460. "DBEQ\n"
  461. "DBVC\n"
  462. "DBVS\n"
  463. "DBPL\n"
  464. "DBMI\n"
  465. "DBGE\n"
  466. "DBLT\n"
  467. "DBGT\n"
  468. "DBLE\n"
  469. "DBF\n"
  470. "DBRA\n"
  471. "DBT\n"
  472. "FJNE\n"
  473. "FJEQ\n"
  474. "FJGE\n"
  475. "FJLT\n"
  476. "FJGT\n"
  477. "FJLE\n"
  478. "FJF\n"
  479. "FJT\n"
  480. "FJGL\n"
  481. "FJGLE\n"
  482. "FJNGE\n"
  483. "FJNGL\n"
  484. "FJNGLE\n"
  485. "FJNGT\n"
  486. "FJNLE\n"
  487. "FJNLT\n"
  488. "FJOGE\n"
  489. "FJOGL\n"
  490. "FJOGT\n"
  491. "FJOLE\n"
  492. "FJOLT\n"
  493. "FJOR\n"
  494. "FJSEQ\n"
  495. "FJSF\n"
  496. "FJSNE\n"
  497. "FJST\n"
  498. "FJUEQ\n"
  499. "FJUGE\n"
  500. "FJUGT\n"
  501. "FJULE\n"
  502. "FJULT\n"
  503. "FJUN\n";
  504. Program_Control.color=syn_rgb(0,0,255);
  505. Program_Control.style=0;
  506. Program_Control.caseSensitive=false;
  507. Syn_WordList System_Control;
  508. System_Control.name="System Control";
  509. System_Control.list="ILLEGAL\n"
  510. "RTE\n"
  511. "TRAP\n";
  512. System_Control.color=syn_rgb(0,0,255);
  513. System_Control.style=0;
  514. System_Control.caseSensitive=false;
  515. Syn_WordList SWL_Extensions;
  516. SWL_Extensions.name="Extensions";
  517. SWL_Extensions.list="B\n"
  518. "L\n"
  519. "S\n"
  520. "W\n";
  521. SWL_Extensions.color=syn_rgb(0,128,64);
  522. SWL_Extensions.style=0;
  523. SWL_Extensions.caseSensitive=false;
  524. Syn_WordList Assembler_Directives;
  525. Assembler_Directives.name="Assembler Directives";
  526. Assembler_Directives.list="abort\n"
  527. "align\n"
  528. "ascii\n"
  529. "asciz\n"
  530. "balign\n"
  531. "balignw\n"
  532. "balignl\n"
  533. "byte\n"
  534. "comm\n"
  535. "data\n"
  536. "def\n"
  537. "dim\n"
  538. "double\n"
  539. "eject\n"
  540. "else\n"
  541. "end\n"
  542. "elseif\n"
  543. "endef\n"
  544. "endfunc\n"
  545. "endif\n"
  546. "endm\n"
  547. "endr\n"
  548. "equ\n"
  549. "equiv\n"
  550. "err\n"
  551. "even\n"
  552. "exitm\n"
  553. "extern\n"
  554. "fail\n"
  555. "file\n"
  556. "fill\n"
  557. "float\n"
  558. "func\n"
  559. "global\n"
  560. "hword\n"
  561. "ident\n"
  562. "if\n"
  563. "include\n"
  564. "incbin\n"
  565. "int\n"
  566. "irp\n"
  567. "irpc\n"
  568. "lcomm\n"
  569. "lflags\n"
  570. "line\n"
  571. "ln\n"
  572. "list\n"
  573. "long\n"
  574. "macro\n"
  575. "mri\n"
  576. "nolist\n"
  577. "octa\n"
  578. "org\n"
  579. "p2align\n"
  580. "p2alignw\n"
  581. "p2alignl\n"
  582. "print\n"
  583. "psize\n"
  584. "purgem\n"
  585. "quad\n"
  586. "rept\n"
  587. "sbttl\n"
  588. "scl\n"
  589. "section\n"
  590. "set\n"
  591. "short\n"
  592. "single\n"
  593. "size\n"
  594. "sleb128\n"
  595. "skip\n"
  596. "space\n"
  597. "stabd\n"
  598. "stabn\n"
  599. "stabs\n"
  600. "string\n"
  601. "struct\n"
  602. "tag\n"
  603. "text\n"
  604. "title\n"
  605. "type\n"
  606. "uleb128\n"
  607. "val\n"
  608. "vtable_entry\n"
  609. "word\n";
  610. Assembler_Directives.color=syn_rgb(0,0,255);
  611. Assembler_Directives.style=SYNS_CUSTOM|SYNS_BOLD;
  612. Assembler_Directives.caseSensitive=true;
  613. Syn_WordList SWL_Registers;
  614. SWL_Registers.name="Registers";
  615. SWL_Registers.list= "a0\n"
  616. "a1\n"
  617. "a2\n"
  618. "a3\n"
  619. "a4\n"
  620. "a5\n"
  621. "a6\n"
  622. "a7\n"
  623. "d0\n"
  624. "d1\n"
  625. "d2\n"
  626. "d3\n"
  627. "d4\n"
  628. "d5\n"
  629. "d6\n"
  630. "d7\n"
  631. "fp\n"
  632. "pc\n"
  633. "sp\n"
  634. "sr\n";
  635. SWL_Registers.color=syn_rgb(255,0,0);
  636. SWL_Registers.style=SYNS_CUSTOM|SYNS_UNDERLINE;
  637. SWL_Registers.caseSensitive=false;
  638. Syn_WordList Data_Movement_a68k;
  639. Data_Movement_a68k.name="Data Movement";
  640. Data_Movement_a68k.list= "EXG\n"
  641. "LEA\n"
  642. "LINK\n"
  643. "MOVE\n"
  644. "MOVEA\n"
  645. "MOVEM\n"
  646. "MOVEP\n"
  647. "MOVEQ\n"
  648. "PEA\n"
  649. "UNLK\n";
  650. Data_Movement_a68k.color=syn_rgb(0,0,255);
  651. Data_Movement_a68k.style=0;
  652. Data_Movement_a68k.caseSensitive=false;
  653. Syn_WordList ShiftRotation_Instructions_a68k;
  654. ShiftRotation_Instructions_a68k.name="Shift/Rotation Instructions";
  655. ShiftRotation_Instructions_a68k.list="ASL\n"
  656. "ASR\n"
  657. "LSL\n"
  658. "LSR\n"
  659. "ROL\n"
  660. "ROLX\n"
  661. "ROR\n"
  662. "RORX\n"
  663. "ROXL\n"
  664. "ROXR\n"
  665. "SWAP\n";
  666. ShiftRotation_Instructions_a68k.color=syn_rgb(0,0,255);
  667. ShiftRotation_Instructions_a68k.style=0;
  668. ShiftRotation_Instructions_a68k.caseSensitive=false;
  669. Syn_WordList Program_Control_a68k;
  670. Program_Control_a68k.name="Program Control";
  671. Program_Control_a68k.list="BCC\n"
  672. "BCS\n"
  673. "BEQ\n"
  674. "BGE\n"
  675. "BGT\n"
  676. "BHI\n"
  677. "BHS\n"
  678. "BLE\n"
  679. "BLO\n"
  680. "BLS\n"
  681. "BLT\n"
  682. "BMI\n"
  683. "BNE\n"
  684. "BPL\n"
  685. "BRA\n"
  686. "BSR\n"
  687. "BVC\n"
  688. "BVS\n"
  689. "DBCC\n"
  690. "DBCS\n"
  691. "DBEQ\n"
  692. "DBF\n"
  693. "DBGE\n"
  694. "DBGT\n"
  695. "DBHI\n"
  696. "DBHS\n"
  697. "DBLE\n"
  698. "DBLO\n"
  699. "DBLS\n"
  700. "DBLT\n"
  701. "DBMI\n"
  702. "DBNE\n"
  703. "DBPL\n"
  704. "DBRA\n"
  705. "DBT\n"
  706. "DBVC\n"
  707. "DBVS\n"
  708. "JMP\n"
  709. "JSR\n"
  710. "NOP\n"
  711. "RTR\n"
  712. "RTS\n"
  713. "SCC\n"
  714. "SCS\n"
  715. "SEQ\n"
  716. "SF\n"
  717. "SGE\n"
  718. "SGT\n"
  719. "SHI\n"
  720. "SHS\n"
  721. "SLE\n"
  722. "SLO\n"
  723. "SLS\n"
  724. "SLT\n"
  725. "SMI\n"
  726. "SNE\n"
  727. "SPL\n"
  728. "ST\n"
  729. "SVC\n"
  730. "SVS\n"
  731. "TST\n";
  732. Program_Control_a68k.color=syn_rgb(0,0,255);
  733. Program_Control_a68k.style=0;
  734. Program_Control_a68k.caseSensitive=false;
  735. Syn_WordList Assembler_Directives_a68k;
  736. Assembler_Directives_a68k.name="Assembler Directives";
  737. Assembler_Directives_a68k.list= "BSS\n"
  738. "CNOP\n"
  739. "CSEG\n"
  740. "DSEG\n"
  741. "DC\n"
  742. "DCB\n"
  743. "DS\n"
  744. "END\n"
  745. "ENDC\n"
  746. "ENDIF\n"
  747. "ENDM\n"
  748. "EQU\n"
  749. "EQUR\n"
  750. "EVEN\n"
  751. "FAR\n"
  752. "IDNT\n"
  753. "IFC\n"
  754. "IFD\n"
  755. "IFEQ\n"
  756. "IFGE\n"
  757. "IFGT\n"
  758. "IFLE\n"
  759. "IFLT\n"
  760. "IFNC\n"
  761. "IFND\n"
  762. "IFNE\n"
  763. "INCBIN\n"
  764. "INCLUDE\n"
  765. "LIST\n"
  766. "MACRO\n"
  767. "NEAR\n"
  768. "NOLIST\n"
  769. "ORG\n"
  770. "PAGE\n"
  771. "PUBLIC\n"
  772. "REG\n"
  773. "RORG\n"
  774. "SECTION\n"
  775. "SET\n"
  776. "SPC\n"
  777. "TITLE\n"
  778. "TTL\n"
  779. "XDEF\n"
  780. "XREF\n";
  781. Assembler_Directives_a68k.color=syn_rgb(0,0,255);
  782. Assembler_Directives_a68k.style=SYNS_CUSTOM|SYNS_BOLD;
  783. Assembler_Directives_a68k.caseSensitive=false;
  784. Syn_WordList SWL_Sections;
  785. SWL_Sections.name="Sections";
  786. SWL_Sections.list="$$ACTIONS\n"
  787. "$$CONNECTIONS\n"
  788. "$$END\n"
  789. "$$END_TEST\n"
  790. "$$EVENTS\n"
  791. "$$EXTERN\n"
  792. "$$LOCATIONS\n"
  793. "$$MESSAGES\n"
  794. "$$OBJECTS\n"
  795. "$$OLDSTYLE_SYSTEM_MESSAGES\n"
  796. "$$PICTURES\n"
  797. "$$PICTURES_TEST\n"
  798. "$$SYSTEM_MESSAGES\n"
  799. "$$TITLE\n"
  800. "$$VOCABULARY\n";
  801. SWL_Sections.color=syn_rgb(255,0,0);
  802. SWL_Sections.style=SYNS_CUSTOM|SYNS_BOLD;
  803. SWL_Sections.caseSensitive=true;
  804. Syn_WordList Section_Specific_Keywords;
  805. Section_Specific_Keywords.name="Section-specific Keywords";
  806. Section_Specific_Keywords.list= "ACTION\n"
  807. "BITMAP\n"
  808. "CBLOCK\n"
  809. "CONN\n"
  810. "DEFINE\n"
  811. "DRAWING\n"
  812. "END_BITMAP\n"
  813. "END_CBLOCK\n"
  814. "END_DRAWING\n"
  815. "END_PACKED_BITMAP\n"
  816. "EVENT\n"
  817. "FROM\n"
  818. "LOC\n"
  819. "MSG\n"
  820. "OBJ\n"
  821. "PACKED_BITMAP\n"
  822. "WORD\n";
  823. Section_Specific_Keywords.color=syn_rgb(64,128,128);
  824. Section_Specific_Keywords.style=SYNS_CUSTOM|SYNS_BOLD;
  825. Section_Specific_Keywords.caseSensitive=true;
  826. Syn_WordList AdditionalKeywords;
  827. AdditionalKeywords.name="Additional Keywords";
  828. AdditionalKeywords.list="CONTINUE\n"
  829. "ELSE\n";
  830. AdditionalKeywords.color=syn_rgb(64,128,128);
  831. AdditionalKeywords.style=SYNS_CUSTOM|SYNS_BOLD;
  832. AdditionalKeywords.caseSensitive=true;
  833. Syn_WordList PredefinedAliases;
  834. PredefinedAliases.name="Predefined Aliases";
  835. PredefinedAliases.list= "$ALSOSEE\n"
  836. "$ARG\n"
  837. "$CARRIED\n"
  838. "$CENTER\n"
  839. "$CNT1\n"
  840. "$CNT2\n"
  841. "$CNT3\n"
  842. "$CNT4\n"
  843. "$CONT\n"
  844. "$CURLOC\n"
  845. "$DARK\n"
  846. "$DARKCNT\n"
  847. "$DESC\n"
  848. "$DESC_CNT\n"
  849. "$DESC_DARKCNT\n"
  850. "$DESC_NOLIGHTCNT\n"
  851. "$DONE\n"
  852. "$ENDGAME\n"
  853. "$EXIT\n"
  854. "$FAIL\n"
  855. "$FONT\n"
  856. "$FULLSCR\n"
  857. "$GCONTROL\n"
  858. "$LSOURCE\n"
  859. "$MAXCAR\n"
  860. "$NOLIGHTCNT\n"
  861. "$NOUN\n"
  862. "$NOWHERE\n"
  863. "$NULL\n"
  864. "$NUMCAR\n"
  865. "$PROMPT\n"
  866. "$RESTART\n"
  867. "$SCORE\n"
  868. "$SPECIAL\n"
  869. "$SUBROUTINE\n"
  870. "$TURNHI\n"
  871. "$TURNLO\n"
  872. "$VERB\n"
  873. "$WORN\n";
  874. PredefinedAliases.color=syn_rgb(128,0,128);
  875. PredefinedAliases.style=SYNS_CUSTOM|SYNS_BOLD;
  876. PredefinedAliases.caseSensitive=true;
  877. Syn_WordList SWL_Conditions;
  878. SWL_Conditions.name="Conditions";
  879. SWL_Conditions.list="ABSENT\n"
  880. "AT\n"
  881. "ATGT\n"
  882. "ATLT\n"
  883. "CARRIED\n"
  884. "CHANCE\n"
  885. "CREATED\n"
  886. "EQ\n"
  887. "EQWORD\n"
  888. "EXTWORD\n"
  889. "GT\n"
  890. "HERE\n"
  891. "ISAT\n"
  892. "ISDESC\n"
  893. "ISNOTAT\n"
  894. "ISNOTNULL\n"
  895. "ISNULL\n"
  896. "LT\n"
  897. "NEQWORD\n"
  898. "NOTAT\n"
  899. "NOTCARR\n"
  900. "NOTCREATED\n"
  901. "NOTEQ\n"
  902. "NOTHERE\n"
  903. "NOTSAME\n"
  904. "NOTWORN\n"
  905. "NOTZERO\n"
  906. "PRESENT\n"
  907. "SAME\n"
  908. "TRYMOVE\n"
  909. "WORN\n"
  910. "ZERO\n";
  911. SWL_Conditions.color=syn_rgb(0,0,255);
  912. SWL_Conditions.style=SYNS_CUSTOM|SYNS_BOLD;
  913. SWL_Conditions.caseSensitive=true;
  914. Syn_WordList SWL_Actions;
  915. SWL_Actions.name="Actions";
  916. SWL_Actions.list= "ADD\n"
  917. "ALSOSEE\n"
  918. "ANYKEY\n"
  919. "AUTOD\n"
  920. "AUTOG\n"
  921. "AUTOR\n"
  922. "AUTOW\n"
  923. "BIGFONT\n"
  924. "CANCEL\n"
  925. "CLEAR\n"
  926. "CLS\n"
  927. "COPYFF\n"
  928. "COPYFO\n"
  929. "COPYOF\n"
  930. "COPYOO\n"
  931. "CREATE\n"
  932. "DECCAR\n"
  933. "DESC\n"
  934. "DESTROY\n"
  935. "DONE\n"
  936. "DROP\n"
  937. "DROPALL\n"
  938. "END\n"
  939. "ENDDESC\n"
  940. "EXIT\n"
  941. "EXTERN\n"
  942. "GET\n"
  943. "GETWORD\n"
  944. "GOTO\n"
  945. "INCCAR\n"
  946. "INVEN\n"
  947. "LET\n"
  948. "LISTAT\n"
  949. "LISTOBJ\n"
  950. "LOAD\n"
  951. "MAXCAR\n"
  952. "MES\n"
  953. "MESFLAG\n"
  954. "MESSAGE\n"
  955. "MINUS\n"
  956. "NEWLINE\n"
  957. "NOTDONE\n"
  958. "OK\n"
  959. "PAUSE\n"
  960. "PICNORM\n"
  961. "PICOFF\n"
  962. "PICON\n"
  963. "PLACE\n"
  964. "PLUS\n"
  965. "PRINT\n"
  966. "PROMPT\n"
  967. "PUTO\n"
  968. "QUIT\n"
  969. "QVERSION\n"
  970. "RAMLOAD\n"
  971. "RAMSAVE\n"
  972. "RANDOM\n"
  973. "REDRAW\n"
  974. "REMOVE\n"
  975. "RESTART\n"
  976. "SAVE\n"
  977. "SCORE\n"
  978. "SET\n"
  979. "SETNOUN\n"
  980. "SETVERB\n"
  981. "SHOWLOC\n"
  982. "SMLFONT\n"
  983. "SUB\n"
  984. "SWAP\n"
  985. "SYSMESS\n"
  986. "TURNS\n"
  987. "WEAR\n"
  988. "WHATO\n"
  989. "WHEREO\n"
  990. "ZAPSCR\n";
  991. SWL_Actions.color=syn_rgb(0,0,160);
  992. SWL_Actions.style=SYNS_CUSTOM|SYNS_BOLD;
  993. SWL_Actions.caseSensitive=true;
  994. Syn_WordList Drawing_Primitives;
  995. Drawing_Primitives.name="Drawing primitives";
  996. Drawing_Primitives.list="AMOVE\n"
  997. "CALL,ELLIPSE\n"
  998. "FILL,INV_ELLIPSE\n"
  999. "INV_LINE\n"
  1000. "INV_PLOT\n"
  1001. "INV_RPLOT\n"
  1002. "LINE,MOVE\n"
  1003. "PLOT,RPLOT\n"
  1004. "SHADE,XOR_ELLIPSE\n"
  1005. "XOR_LINE\n"
  1006. "XOR_PLOT\n"
  1007. "XOR_RPLOT\n";
  1008. Drawing_Primitives.color=syn_rgb(0,64,128);
  1009. Drawing_Primitives.style=SYNS_CUSTOM|SYNS_BOLD;
  1010. Drawing_Primitives.caseSensitive=true;
  1011. Syn_WordList Drawing_Directions;
  1012. Drawing_Directions.name="Drawing directions";
  1013. Drawing_Directions.list="DOWN\n"
  1014. "DOWN_LEFT\n"
  1015. "DOWN_RIGHT\n"
  1016. "LEFT\n"
  1017. "LEFT_DOWN\n"
  1018. "LEFT_UP\n"
  1019. "RIGHT\n"
  1020. "RIGHT_DOWN\n"
  1021. "RIGHT_UP\n"
  1022. "UP\n"
  1023. "UP_LEFT\n"
  1024. "UP_RIGHT\n";
  1025. Drawing_Directions.color=syn_rgb(0,128,0);
  1026. Drawing_Directions.style=SYNS_CUSTOM|SYNS_BOLD;
  1027. Drawing_Directions.caseSensitive=true;
  1028. Syn_WordList Shading_Patterns;
  1029. Shading_Patterns.name="Shading patterns";
  1030. Shading_Patterns.list="$BKSLASHFILL\n"
  1031. "$BRICKFILL\n"
  1032. "$CHAINFILL\n"
  1033. "$CIRCLEFILL\n"
  1034. "$CLOSEDASHFILL\n"
  1035. "$CLOSEDOTFILL\n"
  1036. "$CLOSEWAVEFILL\n"
  1037. "$CROSSFILL\n"
  1038. "$DASHFILL\n"
  1039. "$DOTFILL\n"
  1040. "$HATCHFILL\n"
  1041. "$INTERLEAVEFILL\n"
  1042. "$LIGHTDOTFILL\n"
  1043. "$LIGHTLINEFILL\n"
  1044. "$LINEFILL\n"
  1045. "$SLASHFILL\n"
  1046. "$SOLIDFILL\n"
  1047. "$SQDOTFILL\n"
  1048. "$SQUAREFILL\n"
  1049. "$THICKBKSLASHFILL\n"
  1050. "$THICKHATCHFILL\n"
  1051. "$THICKLINEFILL\n"
  1052. "$THICKSLASHFILL\n"
  1053. "$VDASHFILL\n"
  1054. "$VINTERLEAVEFILL\n"
  1055. "$VLDOTFILL\n"
  1056. "$VLIGHTLINEFILL\n"
  1057. "$VLINEFILL\n"
  1058. "$VTHICKLINEFILL\n"
  1059. "$WAVEFILL\n"
  1060. "$WIDEDOTFILL\n"
  1061. "$XMARKFILL\n"
  1062. "$ZIGZAGFILL\n";
  1063. Shading_Patterns.color=syn_rgb(128,0,128);
  1064. Shading_Patterns.style=SYNS_CUSTOM|SYNS_BOLD;
  1065. Shading_Patterns.caseSensitive=true;
  1066. Syn_WordList NonFunctional_Keywords;
  1067. NonFunctional_Keywords.name="Non-functional keywords";
  1068. NonFunctional_Keywords.list="BEEP\n"
  1069. "BLOCK\n"
  1070. "BORDER\n"
  1071. "BRIGHT\n"
  1072. "FLASH\n"
  1073. "INK\n"
  1074. "PAPER\n";
  1075. NonFunctional_Keywords.color=syn_rgb(192,192,192);
  1076. NonFunctional_Keywords.style=SYNS_CUSTOM|SYNS_BOLD;
  1077. NonFunctional_Keywords.caseSensitive=true;
  1078. Syn_WordList External_Symbols;
  1079. External_Symbols.name="External symbols";
  1080. External_Symbols.list="$ACTIONS$\n"
  1081. "$ARG$\n"
  1082. "$BMPUT$\n"
  1083. "$BPCKPUT$\n"
  1084. "$BUFFER$\n"
  1085. "$CONNECTIONS$\n"
  1086. "$EVENTS$\n"
  1087. "$EXTERN$\n"
  1088. "$FLAGS$\n"
  1089. "$FLAGS_BACKUP$\n"
  1090. "$GDF$\n"
  1091. "$GETLINE$\n"
  1092. "$LOCATIONS$\n"
  1093. "$LQL$\n"
  1094. "$MAXCAR$\n"
  1095. "$MESSAGES$\n"
  1096. "$NFLAG$\n"
  1097. "$NLOC$\n"
  1098. "$NMSG$\n"
  1099. "$NOBJ$\n"
  1100. "$NSYSMSG$\n"
  1101. "$NWORD$\n"
  1102. "$OBJECTS$\n"
  1103. "$PDRAW$\n"
  1104. "$PICTURE$\n"
  1105. "$PRINT$\n"
  1106. "$RAM_SAVED$\n"
  1107. "$SCALEX$\n"
  1108. "$SCALEY$\n"
  1109. "$SSCR$\n"
  1110. "$SYSTEM_MESSAGES$\n"
  1111. "$WORDS$\n";
  1112. External_Symbols.color=syn_rgb(0,128,64);
  1113. External_Symbols.style=SYNS_CUSTOM|SYNS_BOLD;
  1114. External_Symbols.caseSensitive=true;
  1115. prefs->synC.wordLists.clear();
  1116. prefs->synS.wordLists.clear();
  1117. prefs->synASM.wordLists.clear();
  1118. prefs->synQLL.wordLists.clear();
  1119. prefs->synC.wordLists << C_Keywords;
  1120. prefs->synS.wordLists << Data_Movement << Integer_Arithmetic << Logical_Instructions << ShiftRotation_Instructions << Bit_Manipulation << Program_Control << System_Control << SWL_Extensions << Assembler_Directives << SWL_Registers;
  1121. prefs->synASM.wordLists << Data_Movement_a68k << Integer_Arithmetic << Logical_Instructions << ShiftRotation_Instructions_a68k << Bit_Manipulation << Program_Control_a68k << System_Control << SWL_Extensions << Assembler_Directives_a68k << SWL_Registers;
  1122. prefs->synQLL.wordLists << C_Keywords << SWL_Sections << Section_Specific_Keywords << AdditionalKeywords << PredefinedAliases << SWL_Conditions << SWL_Actions << Drawing_Primitives << Drawing_Directions << Shading_Patterns << NonFunctional_Keywords << External_Symbols;
  1123. }
  1124. // Update the Kate schema from our internal ones.
  1125. static void updateEditorPreferences(void)
  1126. {
  1127. KConfig kateschema("kateschemarc");
  1128. QColor color;
  1129. if (preferences.useBgColor) {
  1130. kateschema.setGroup("ktigcc - Normal");
  1131. kateschema.writeEntry("Color Background",preferences.bgColor);
  1132. kateschema.writeEntry("Color Highlighted Line",preferences.bgColor);
  1133. } else {
  1134. kateschema.setGroup("kate - Normal");
  1135. color=QColor(255,255,255);
  1136. color=kateschema.readColorEntry("Color Background",&color);
  1137. kateschema.setGroup("ktigcc - Normal");
  1138. kateschema.writeEntry("Color Background",color);
  1139. kateschema.setGroup("kate - Normal");
  1140. color=QColor(240,240,240);
  1141. color=kateschema.readColorEntry("Color Highlighted Line",&color);
  1142. kateschema.setGroup("ktigcc - Normal");
  1143. kateschema.writeEntry("Color Highlighted Line",color);
  1144. }
  1145. kateschema.setGroup("kate - Normal");
  1146. color=QColor(255,255,153);
  1147. color=kateschema.readColorEntry("Color Highlighted Bracket",&color);
  1148. kateschema.setGroup("ktigcc - Normal");
  1149. kateschema.writeEntry("Color Highlighted Bracket",color);
  1150. kateschema.setGroup("kate - Normal");
  1151. color=QColor(234,233,232);
  1152. color=kateschema.readColorEntry("Color Icon Bar",&color);
  1153. kateschema.setGroup("ktigcc - Normal");
  1154. kateschema.writeEntry("Color Icon Bar",color);
  1155. kateschema.setGroup("kate - Normal");
  1156. color=QColor(0,0,0);
  1157. color=kateschema.readColorEntry("Color Line Number",&color);
  1158. kateschema.setGroup("ktigcc - Normal");
  1159. kateschema.writeEntry("Color Line Number",color);
  1160. kateschema.setGroup("kate - Normal");
  1161. color=QColor(0,0,255);
  1162. color=kateschema.readColorEntry("Color MarkType1",&color);
  1163. kateschema.setGroup("ktigcc - Normal");
  1164. kateschema.writeEntry("Color MarkType1",color);
  1165. kateschema.setGroup("kate - Normal");
  1166. color=QColor(255,0,0);
  1167. color=kateschema.readColorEntry("Color MarkType2",&color);
  1168. kateschema.setGroup("ktigcc - Normal");
  1169. kateschema.writeEntry("Color MarkType2",color);
  1170. kateschema.setGroup("kate - Normal");
  1171. color=QColor(255,255,0);
  1172. color=kateschema.readColorEntry("Color MarkType3",&color);
  1173. kateschema.setGroup("ktigcc - Normal");
  1174. kateschema.writeEntry("Color MarkType3",color);
  1175. kateschema.setGroup("kate - Normal");
  1176. color=QColor(255,0,255);
  1177. color=kateschema.readColorEntry("Color MarkType4",&color);
  1178. kateschema.setGroup("ktigcc - Normal");
  1179. kateschema.writeEntry("Color MarkType4",color);
  1180. kateschema.setGroup("kate - Normal");
  1181. color=QColor(160,160,164);
  1182. color=kateschema.readColorEntry("Color MarkType5",&color);
  1183. kateschema.setGroup("ktigcc - Normal");
  1184. kateschema.writeEntry("Color MarkType5",color);
  1185. kateschema.setGroup("kate - Normal");
  1186. color=QColor(0,255,0);
  1187. color=kateschema.readColorEntry("Color MarkType6",&color);
  1188. kateschema.setGroup("ktigcc - Normal");
  1189. kateschema.writeEntry("Color MarkType6",color);
  1190. kateschema.setGroup("kate - Normal");
  1191. color=QColor(255,0,0);
  1192. color=kateschema.readColorEntry("Color MarkType7",&color);
  1193. kateschema.setGroup("ktigcc - Normal");
  1194. kateschema.writeEntry("Color MarkType7",color);
  1195. kateschema.setGroup("kate - Normal");
  1196. color=QColor(76,89,166);
  1197. color=kateschema.readColorEntry("Color Selection",&color);
  1198. kateschema.setGroup("ktigcc - Normal");
  1199. kateschema.writeEntry("Color Selection",color);
  1200. kateschema.setGroup("kate - Normal");
  1201. color=QColor(0,0,0);
  1202. color=kateschema.readColorEntry("Color Tab Marker",&color);
  1203. kateschema.setGroup("ktigcc - Normal");
  1204. kateschema.writeEntry("Color Tab Marker",color);
  1205. kateschema.setGroup("kate - Normal");
  1206. color=QColor(120,120,120);
  1207. color=kateschema.readColorEntry("Color Word Wrap Marker",&color);
  1208. kateschema.setGroup("ktigcc - Normal");
  1209. kateschema.writeEntry("Color Word Wrap Marker",color);
  1210. kateschema.writeEntry("Font",preferences.editorFont);
  1211. }
  1212. void loadPreferences(void)
  1213. {
  1214. pconfig->setGroup("Preferences");
  1215. // General
  1216. preferences.stopAtFirstError=pconfig->readBoolEntry("Stop at First Error",false);
  1217. preferences.jumpToError=pconfig->readBoolEntry("Jump to Error",true);
  1218. preferences.successMessage=pconfig->readBoolEntry("Success Message",true);
  1219. preferences.deleteAsmFiles=pconfig->readBoolEntry("Delete Asm Files",true);
  1220. preferences.deleteObjFiles=pconfig->readBoolEntry("Delete Object Files",false);
  1221. preferences.splitSourceFiles=pconfig->readBoolEntry("Split Source Files",true);
  1222. preferences.allowImplicitDeclaration=pconfig->readBoolEntry("Allow Implicit Declaration",true);
  1223. preferences.autoSave=pconfig->readBoolEntry("Auto Save",true);
  1224. preferences.downloadHeadlines=pconfig->readBoolEntry("Download Headlines",false);
  1225. preferences.deleteOverwrittenErrors=pconfig->readBoolEntry("Delete Overwritten Errors",true);
  1226. preferences.useSystemIcons=pconfig->readBoolEntry("Use System Icons",false);
  1227. // Transfer
  1228. preferences.linkTarget=(LinkTargets)pconfig->readNumEntry("Link Target",LT_NONE);
  1229. preferences.linkPort=(CablePort)pconfig->readNumEntry("Link Port",PORT_1);
  1230. preferences.linkCable=(CableModel)pconfig->readNumEntry("Link Cable",CABLE_GRY);
  1231. // Editor
  1232. preferences.tabWidthC=pconfig->readUnsignedNumEntry("Tab Width C",2);
  1233. preferences.tabWidthAsm=pconfig->readUnsignedNumEntry("Tab Width Asm",8);
  1234. preferences.useBgColor=pconfig->readBoolEntry("Use Background Color",false);
  1235. QColor white(255,255,255);
  1236. preferences.bgColor=pconfig->readColorEntry("Background Color",&white);
  1237. QFont defaultFont("Monospace",10);
  1238. preferences.editorFont=pconfig->readFontEntry("Editor Font",&defaultFont);
  1239. preferences.useCalcCharset=pconfig->readBoolEntry("Use Calc Charset",true);
  1240. preferences.lazyLoading=pconfig->readBoolEntry("Lazy Loading",true);
  1241. preferences.autoBlocks=pconfig->readBoolEntry("Auto Blocks",true);
  1242. preferences.removeTrailingSpaces=pconfig->readBoolEntry("Remove Trailing Spaces",false);
  1243. updateEditorPreferences();
  1244. }
  1245. void savePreferences(void)
  1246. {
  1247. pconfig->setGroup("Preferences");
  1248. // General
  1249. pconfig->writeEntry("Stop at First Error",(bool)preferences.stopAtFirstError);
  1250. pconfig->writeEntry("Jump to Error",(bool)preferences.jumpToError);
  1251. pconfig->writeEntry("Success Message",(bool)preferences.successMessage);
  1252. pconfig->writeEntry("Delete Asm Files",(bool)preferences.deleteAsmFiles);
  1253. pconfig->writeEntry("Delete Object Files",(bool)preferences.deleteObjFiles);
  1254. pconfig->writeEntry("Split Source Files",(bool)preferences.splitSourceFiles);
  1255. pconfig->writeEntry("Allow Implicit Declaration",(bool)preferences.allowImplicitDeclaration);
  1256. pconfig->writeEntry("Auto Save",(bool)preferences.autoSave);
  1257. pconfig->writeEntry("Download Headlines",(bool)preferences.downloadHeadlines);
  1258. pconfig->writeEntry("Delete Overwritten Errors",(bool)preferences.deleteOverwrittenErrors);
  1259. pconfig->writeEntry("Use System Icons",(bool)preferences.useSystemIcons);
  1260. // Transfer
  1261. pconfig->writeEntry("Link Target",(int)preferences.linkTarget);
  1262. pconfig->writeEntry("Link Port",(int)preferences.linkPort);
  1263. pconfig->writeEntry("Link Cable",(int)preferences.linkCable);
  1264. // Editor
  1265. pconfig->writeEntry("Tab Width C",(unsigned)preferences.tabWidthC);
  1266. pconfig->writeEntry("Tab Width Asm",(unsigned)preferences.tabWidthAsm);
  1267. pconfig->writeEntry("Use Background Color",(bool)preferences.useBgColor);
  1268. pconfig->writeEntry("Background Color",preferences.bgColor);
  1269. pconfig->writeEntry("Editor Font",preferences.editorFont);
  1270. pconfig->writeEntry("Use Calc Charset",(bool)preferences.useCalcCharset);
  1271. pconfig->writeEntry("Lazy Loading",(bool)preferences.lazyLoading);
  1272. pconfig->writeEntry("Auto Blocks",(bool)preferences.autoBlocks);
  1273. pconfig->writeEntry("Remove Trailing Spaces",(bool)preferences.removeTrailingSpaces);
  1274. updateEditorPreferences();
  1275. }
  1276. int showPreferencesDialog(QWidget *parent)
  1277. {
  1278. Preferences *prefdlg=new Preferences(parent);
  1279. prefdlg->exec();
  1280. int result=prefdlg->result();
  1281. delete prefdlg;
  1282. if (result==QDialog::Accepted)
  1283. savePreferences();
  1284. return result;
  1285. }