PageRenderTime 58ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/DBDiff.Scintilla NET-2.0/ScintillaNET/Configuration/ConfigurationManager.cs

https://bitbucket.org/vadim/sql-dbdiff
C# | 1589 lines | 1275 code | 282 blank | 32 comment | 438 complexity | 1eea2612e4de1c41e493c2fe280a4621 MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.IO;
  5. using System.Text.RegularExpressions;
  6. using System.Drawing;
  7. using System.ComponentModel;
  8. using System.Windows.Forms;
  9. namespace DBDiff.Scintilla.Configuration
  10. {
  11. [TypeConverterAttribute(typeof(System.ComponentModel.ExpandableObjectConverter))]
  12. public class ConfigurationManager : ScintillaHelperBase
  13. {
  14. private bool _useXmlReader = true;
  15. public bool UseXmlReader
  16. {
  17. get { return _useXmlReader; }
  18. set
  19. {
  20. _useXmlReader = value;
  21. }
  22. }
  23. internal ConfigurationManager(Scintilla scintilla) : base(scintilla) { }
  24. internal bool ShouldSerialize()
  25. {
  26. return ShouldSerializeClearKeyBindings() ||
  27. ShouldSerializeClearMargins() ||
  28. ShouldSerializeClearSnippets() ||
  29. ShouldSerializeClearStyles() ||
  30. ShouldSerializeCustomLocation() ||
  31. ShouldSerializeIsBuiltInEnabled() ||
  32. ShouldSerializeIsUserEnabled() ||
  33. ShouldSerializeLanguage() ||
  34. ShouldSerializeLoadOrder();
  35. }
  36. protected internal override void Initialize()
  37. {
  38. if (_language != null)
  39. Configure();
  40. }
  41. #region Language
  42. private string _language;
  43. public string Language
  44. {
  45. get
  46. {
  47. return _language;
  48. }
  49. set
  50. {
  51. _language = value;
  52. if (!Scintilla.IsDesignMode)
  53. Configure();
  54. }
  55. }
  56. private bool ShouldSerializeLanguage()
  57. {
  58. return !string.IsNullOrEmpty(_language);
  59. }
  60. private void ResetLanguage()
  61. {
  62. _language = null;
  63. }
  64. #endregion
  65. #region IsBuiltInEnabled
  66. private bool _isBuiltInEnabled = true;
  67. public bool IsBuiltInEnabled
  68. {
  69. get
  70. {
  71. return _isBuiltInEnabled;
  72. }
  73. set
  74. {
  75. _isBuiltInEnabled = value;
  76. }
  77. }
  78. private bool ShouldSerializeIsBuiltInEnabled()
  79. {
  80. return !_isBuiltInEnabled;
  81. }
  82. private void ResetIsBuiltInEnabled()
  83. {
  84. _isBuiltInEnabled = true;
  85. }
  86. #endregion
  87. #region IsUserEnabled
  88. private bool _isUserEnabled = true;
  89. public bool IsUserEnabled
  90. {
  91. get
  92. {
  93. return _isUserEnabled;
  94. }
  95. set
  96. {
  97. _isUserEnabled = value;
  98. }
  99. }
  100. private bool ShouldSerializeIsUserEnabled()
  101. {
  102. return !_isUserEnabled;
  103. }
  104. private void ResetIsUserEnabled()
  105. {
  106. _isUserEnabled = true;
  107. }
  108. #endregion
  109. #region CustomLocation
  110. private string _customLocation;
  111. public string CustomLocation
  112. {
  113. get
  114. {
  115. return _customLocation;
  116. }
  117. set
  118. {
  119. _customLocation = value;
  120. }
  121. }
  122. private bool ShouldSerializeCustomLocation()
  123. {
  124. return !string.IsNullOrEmpty(_customLocation);
  125. }
  126. private void ResetCustomLocation()
  127. {
  128. _customLocation = string.Empty;
  129. }
  130. #endregion
  131. #region ConfigurationLoadOrder
  132. private ConfigurationLoadOrder _loadOrder = ConfigurationLoadOrder.BuiltInCustomUser;
  133. public ConfigurationLoadOrder LoadOrder
  134. {
  135. get
  136. {
  137. return _loadOrder;
  138. }
  139. set
  140. {
  141. _loadOrder = value;
  142. }
  143. }
  144. private bool ShouldSerializeLoadOrder()
  145. {
  146. return _loadOrder != ConfigurationLoadOrder.BuiltInCustomUser;
  147. }
  148. private void ResetLoadOrder()
  149. {
  150. _loadOrder = ConfigurationLoadOrder.BuiltInCustomUser;
  151. }
  152. #endregion
  153. #region ClearKeyBindings
  154. private bool _clearKeyBindings = false;
  155. public bool ClearKeyBindings
  156. {
  157. get
  158. {
  159. return _clearKeyBindings;
  160. }
  161. set
  162. {
  163. _clearKeyBindings = value;
  164. }
  165. }
  166. private bool ShouldSerializeClearKeyBindings()
  167. {
  168. return _clearKeyBindings;
  169. }
  170. private void ResetClearKeyBindings()
  171. {
  172. _clearKeyBindings = false;
  173. }
  174. #endregion
  175. #region ClearStyles
  176. private bool _clearStyles = false;
  177. public bool ClearStyles
  178. {
  179. get
  180. {
  181. return _clearStyles;
  182. }
  183. set
  184. {
  185. _clearStyles = value;
  186. }
  187. }
  188. private bool ShouldSerializeClearStyles()
  189. {
  190. return _clearStyles;
  191. }
  192. private void ResetClearStyles()
  193. {
  194. _clearStyles = false;
  195. }
  196. #endregion
  197. #region ClearIndicators
  198. private bool _clearIndicators = false;
  199. public bool ClearIndicators
  200. {
  201. get
  202. {
  203. return _clearIndicators;
  204. }
  205. set
  206. {
  207. _clearIndicators = value;
  208. }
  209. }
  210. private bool ShouldSerializeClearIndicators()
  211. {
  212. return _clearIndicators;
  213. }
  214. private void ResetClearIndicators()
  215. {
  216. _clearIndicators = false;
  217. }
  218. #endregion
  219. #region ClearSnippets
  220. private bool _clearSnippets = false;
  221. public bool ClearSnippets
  222. {
  223. get
  224. {
  225. return _clearSnippets;
  226. }
  227. set
  228. {
  229. _clearSnippets = value;
  230. }
  231. }
  232. private bool ShouldSerializeClearSnippets()
  233. {
  234. return _clearSnippets;
  235. }
  236. private void ResetClearSnippets()
  237. {
  238. _clearSnippets = false;
  239. }
  240. #endregion
  241. #region ClearMargins
  242. private bool _clearMargins = false;
  243. public bool ClearMargins
  244. {
  245. get
  246. {
  247. return _clearMargins;
  248. }
  249. set
  250. {
  251. _clearMargins = value;
  252. }
  253. }
  254. private bool ShouldSerializeClearMargins()
  255. {
  256. return _clearMargins;
  257. }
  258. private void ResetClearMargins()
  259. {
  260. _clearMargins = true;
  261. }
  262. #endregion
  263. #region ClearMarkers
  264. private bool _clearMarkers = false;
  265. public bool ClearMarkers
  266. {
  267. get
  268. {
  269. return _clearMarkers;
  270. }
  271. set
  272. {
  273. _clearMarkers = value;
  274. }
  275. }
  276. private bool ShouldSerializeClearMarkers()
  277. {
  278. return _clearMarkers;
  279. }
  280. private void ResetClearMarkers()
  281. {
  282. _clearMarkers = false;
  283. }
  284. #endregion
  285. private string _appDataFolder;
  286. private string _userFolder;
  287. private string userFolder
  288. {
  289. get
  290. {
  291. if (_appDataFolder == null)
  292. _appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
  293. if (_userFolder == null)
  294. {
  295. Version v = GetType().Assembly.GetName().Version;
  296. _userFolder = Path.Combine(Path.Combine(_appDataFolder, "ScintillaNET"), v.Major.ToString() + "." + v.Minor.ToString());
  297. }
  298. return _userFolder;
  299. }
  300. }
  301. public void Configure()
  302. {
  303. if (Scintilla.IsDesignMode || Scintilla.IsInitializing)
  304. return;
  305. Configuration builtInDefault = null,
  306. builtInLang = null,
  307. customDefault = null,
  308. customLang = null,
  309. userDefault = null,
  310. userLang = null;
  311. if (_isBuiltInEnabled)
  312. {
  313. using (Stream s = GetType().Assembly.GetManifestResourceStream("DBDiff.Scintilla.Configuration.Builtin.default.xml"))
  314. builtInDefault = new Configuration(s, "default", _useXmlReader);
  315. if (!string.IsNullOrEmpty(_language))
  316. using (Stream s = GetType().Assembly.GetManifestResourceStream("DBDiff.Scintilla.Configuration.Builtin." + _language + ".xml"))
  317. if (s != null)
  318. builtInLang = new Configuration(s, _language, _useXmlReader);
  319. }
  320. if (_isUserEnabled)
  321. {
  322. string defPath = Path.Combine(userFolder, "default.xml");
  323. if (File.Exists(defPath))
  324. userDefault = new Configuration(defPath, "default", _useXmlReader);
  325. if (!string.IsNullOrEmpty(_language))
  326. {
  327. string langPath = Path.Combine(userFolder, _language + ".xml");
  328. if (File.Exists(langPath))
  329. userLang = new Configuration(langPath, _language, _useXmlReader);
  330. }
  331. }
  332. if (!string.IsNullOrEmpty(_customLocation))
  333. {
  334. string defPath = Path.Combine(_customLocation, "default.xml");
  335. if (File.Exists(defPath))
  336. customDefault = new Configuration(defPath, "default", _useXmlReader);
  337. if (!string.IsNullOrEmpty(_language))
  338. {
  339. string langPath = Path.Combine(_customLocation, _language + ".xml");
  340. if (File.Exists(langPath))
  341. customLang = new Configuration(langPath, _language, _useXmlReader);
  342. }
  343. }
  344. List<Configuration> configList = new List<Configuration>();
  345. if (_loadOrder == ConfigurationLoadOrder.BuiltInCustomUser)
  346. {
  347. if (builtInDefault != null)
  348. configList.Add(builtInDefault);
  349. if (builtInLang != null)
  350. configList.Add(builtInLang);
  351. if (customDefault != null)
  352. configList.Add(customDefault);
  353. if (customLang != null)
  354. configList.Add(customLang);
  355. if (userDefault != null)
  356. configList.Add(userDefault);
  357. if (userLang != null)
  358. configList.Add(userLang);
  359. }
  360. else if (_loadOrder == ConfigurationLoadOrder.BuiltInUserCustom)
  361. {
  362. if (builtInDefault != null)
  363. configList.Add(builtInDefault);
  364. if (builtInLang != null)
  365. configList.Add(builtInLang);
  366. if (userDefault != null)
  367. configList.Add(userDefault);
  368. if (userLang != null)
  369. configList.Add(userLang);
  370. if (customDefault != null)
  371. configList.Add(customDefault);
  372. if (customLang != null)
  373. configList.Add(customLang);
  374. }
  375. else if (_loadOrder == ConfigurationLoadOrder.CustomBuiltInUser)
  376. {
  377. if (customDefault != null)
  378. configList.Add(customDefault);
  379. if (customLang != null)
  380. configList.Add(customLang);
  381. if (builtInDefault != null)
  382. configList.Add(builtInDefault);
  383. if (builtInLang != null)
  384. configList.Add(builtInLang);
  385. if (userDefault != null)
  386. configList.Add(userDefault);
  387. if (userLang != null)
  388. configList.Add(userLang);
  389. }
  390. else if (_loadOrder == ConfigurationLoadOrder.CustomUserBuiltIn)
  391. {
  392. if (customDefault != null)
  393. configList.Add(customDefault);
  394. if (customLang != null)
  395. configList.Add(customLang);
  396. if (userDefault != null)
  397. configList.Add(userDefault);
  398. if (userLang != null)
  399. configList.Add(userLang);
  400. if (builtInDefault != null)
  401. configList.Add(builtInDefault);
  402. if (builtInLang != null)
  403. configList.Add(builtInLang);
  404. }
  405. else if (_loadOrder == ConfigurationLoadOrder.UserBuiltInCustom)
  406. {
  407. if (userDefault != null)
  408. configList.Add(userDefault);
  409. if (userLang != null)
  410. configList.Add(userLang);
  411. if (builtInDefault != null)
  412. configList.Add(builtInDefault);
  413. if (builtInLang != null)
  414. configList.Add(builtInLang);
  415. if (customDefault != null)
  416. configList.Add(customDefault);
  417. if (customLang != null)
  418. configList.Add(customLang);
  419. }
  420. else if (_loadOrder == ConfigurationLoadOrder.UserCustomBuiltIn)
  421. {
  422. if (userDefault != null)
  423. configList.Add(userDefault);
  424. if (userLang != null)
  425. configList.Add(userLang);
  426. if (customDefault != null)
  427. configList.Add(customDefault);
  428. if (customLang != null)
  429. configList.Add(customLang);
  430. if (builtInDefault != null)
  431. configList.Add(builtInDefault);
  432. if (builtInLang != null)
  433. configList.Add(builtInLang);
  434. }
  435. Configure(configList);
  436. }
  437. public void Configure(Configuration config)
  438. {
  439. Configure(new List<Configuration>(new Configuration[] { config }));
  440. }
  441. internal void Configure(List<Configuration> configList)
  442. {
  443. // So here is the general pattern: We go through each of
  444. // the configurations in the list (which has been ordered
  445. // by priority). If the configuration has a value we're
  446. // looking for it overwrites whatever was before it.
  447. // In the end if the value isn't null, we set the
  448. // corresponding Scintilla Value to this.
  449. bool? b = null;
  450. int? i = null;
  451. Color co = Color.Empty;
  452. char? ch = null;
  453. string s = null;
  454. b = null;
  455. ch = null;
  456. s = null;
  457. co = Color.Empty;
  458. foreach (Configuration c in configList)
  459. {
  460. if (c.CallTip_BackColor != Color.Empty)
  461. co = c.CallTip_BackColor;
  462. }
  463. if (co != Color.Empty)
  464. Scintilla.CallTip.BackColor = co;
  465. co = Color.Empty;
  466. foreach (Configuration c in configList)
  467. {
  468. if (c.CallTip_ForeColor != Color.Empty)
  469. co = c.CallTip_ForeColor;
  470. }
  471. if (co != Color.Empty)
  472. Scintilla.CallTip.ForeColor = co;
  473. co = Color.Empty;
  474. foreach (Configuration c in configList)
  475. {
  476. if (c.CallTip_HighlightTextColor != Color.Empty)
  477. co = c.CallTip_HighlightTextColor;
  478. }
  479. if (co != Color.Empty)
  480. Scintilla.CallTip.HighlightTextColor = co;
  481. i = null;
  482. foreach (Configuration c in configList)
  483. {
  484. if (c.Caret_BlinkRate.HasValue)
  485. i = c.Caret_BlinkRate;
  486. }
  487. if (i.HasValue)
  488. Scintilla.Caret.BlinkRate = i.Value;
  489. co = Color.Empty;
  490. foreach (Configuration c in configList)
  491. {
  492. if (c.Caret_Color != Color.Empty)
  493. co = c.Caret_Color;
  494. }
  495. if (co != Color.Empty)
  496. Scintilla.Caret.Color = co;
  497. i = null;
  498. foreach (Configuration c in configList)
  499. {
  500. if (c.Caret_CurrentLineBackgroundAlpha.HasValue)
  501. i = c.Caret_CurrentLineBackgroundAlpha;
  502. }
  503. if (i.HasValue)
  504. Scintilla.Caret.CurrentLineBackgroundAlpha = i.Value;
  505. co = Color.Empty;
  506. foreach (Configuration c in configList)
  507. {
  508. if (c.Caret_CurrentLineBackgroundColor != Color.Empty)
  509. co = c.Caret_CurrentLineBackgroundColor;
  510. }
  511. if (co != Color.Empty)
  512. Scintilla.Caret.CurrentLineBackgroundColor = co;
  513. b = null;
  514. foreach (Configuration c in configList)
  515. {
  516. if (c.Caret_HighlightCurrentLine.HasValue)
  517. b = c.Caret_HighlightCurrentLine;
  518. }
  519. if (b.HasValue)
  520. Scintilla.Caret.HighlightCurrentLine = b.Value;
  521. b = null;
  522. foreach (Configuration c in configList)
  523. {
  524. if (c.Caret_IsSticky.HasValue)
  525. b = c.Caret_IsSticky;
  526. }
  527. if (b.HasValue)
  528. Scintilla.Caret.IsSticky = b.Value;
  529. CaretStyle? caretStyle = null;
  530. foreach (Configuration c in configList)
  531. {
  532. if (c.Caret_Style.HasValue)
  533. caretStyle = c.Caret_Style;
  534. }
  535. if (caretStyle.HasValue)
  536. Scintilla.Caret.Style = caretStyle.Value;
  537. i = null;
  538. foreach (Configuration c in configList)
  539. {
  540. if (c.Caret_Width.HasValue)
  541. i = c.Caret_Width;
  542. }
  543. if (i.HasValue)
  544. Scintilla.Caret.Width = i.Value;
  545. b = null;
  546. foreach (Configuration c in configList)
  547. {
  548. if (c.Clipboard_ConvertEndOfLineOnPaste.HasValue)
  549. b = c.Clipboard_ConvertEndOfLineOnPaste;
  550. }
  551. if (b.HasValue)
  552. Scintilla.Clipboard.ConvertEndOfLineOnPaste = b.Value;
  553. b = null;
  554. foreach (Configuration c in configList)
  555. {
  556. if (c.Commands_KeyBindingList.AllowDuplicateBindings.HasValue)
  557. b = c.Commands_KeyBindingList.AllowDuplicateBindings;
  558. }
  559. if (b.HasValue)
  560. Scintilla.Commands.AllowDuplicateBindings = b.Value;
  561. if (_clearKeyBindings)
  562. Scintilla.Commands.RemoveAllBindings();
  563. CommandBindingConfigList cbcl = new CommandBindingConfigList();
  564. foreach (Configuration c in configList)
  565. {
  566. if (c.Commands_KeyBindingList.Inherit.HasValue && !c.Commands_KeyBindingList.Inherit.Value)
  567. cbcl.Clear();
  568. foreach (CommandBindingConfig cbc in c.Commands_KeyBindingList)
  569. cbcl.Add(cbc);
  570. }
  571. foreach (CommandBindingConfig cbc in cbcl)
  572. {
  573. // This indicates that we should clear out any
  574. // existing commands bound to this key combination
  575. if (cbc.ReplaceCurrent.HasValue && cbc.ReplaceCurrent.Value)
  576. Scintilla.Commands.RemoveBinding(cbc.KeyBinding.KeyCode, cbc.KeyBinding.Modifiers);
  577. Scintilla.Commands.AddBinding(cbc.KeyBinding.KeyCode, cbc.KeyBinding.Modifiers, cbc.BindableCommand);
  578. }
  579. s = null;
  580. foreach (Configuration c in configList)
  581. {
  582. if (c.DropMarkers_SharedStackName != null)
  583. s = c.DropMarkers_SharedStackName;
  584. }
  585. if (s != null)
  586. Scintilla.DropMarkers.SharedStackName = s;
  587. b = null;
  588. foreach (Configuration c in configList)
  589. {
  590. if (c.EndOfLine_ConvertOnPaste.HasValue)
  591. b = c.EndOfLine_ConvertOnPaste;
  592. }
  593. if (b.HasValue)
  594. Scintilla.EndOfLine.ConvertOnPaste = b.Value;
  595. b = null;
  596. foreach (Configuration c in configList)
  597. {
  598. if (c.EndOfLine_IsVisisble.HasValue)
  599. b = c.EndOfLine_IsVisisble;
  600. }
  601. if (b.HasValue)
  602. Scintilla.EndOfLine.IsVisible = b.Value;
  603. EndOfLineMode? endOfLineMode = null;
  604. foreach (Configuration c in configList)
  605. {
  606. if (c.EndOfLine_Mode.HasValue)
  607. endOfLineMode = c.EndOfLine_Mode;
  608. }
  609. if (endOfLineMode.HasValue)
  610. Scintilla.EndOfLine.Mode = endOfLineMode.Value;
  611. // FoldMarkerScheme moved to Markers section
  612. // becuase Markers need to come first as the
  613. // FoldMarkerScheme really just manipulates
  614. // Markers.
  615. b = null;
  616. co = Color.Empty;
  617. foreach (Configuration c in configList)
  618. {
  619. if (c.Hotspot_ActiveBackColor != Color.Empty)
  620. co = c.Hotspot_ActiveBackColor;
  621. }
  622. if (co != Color.Empty)
  623. Scintilla.HotspotStyle.ActiveBackColor = co;
  624. co = Color.Empty;
  625. foreach (Configuration c in configList)
  626. {
  627. if (c.Hotspot_ActiveForeColor != Color.Empty)
  628. co = c.Hotspot_ActiveForeColor;
  629. }
  630. if (co != Color.Empty)
  631. Scintilla.HotspotStyle.ActiveForeColor = co;
  632. b = null;
  633. foreach (Configuration c in configList)
  634. {
  635. if (c.Hotspot_ActiveUnderline.HasValue)
  636. b = c.Hotspot_ActiveUnderline;
  637. }
  638. if (b.HasValue)
  639. Scintilla.HotspotStyle.ActiveUnderline = b.Value;
  640. b = null;
  641. foreach (Configuration c in configList)
  642. {
  643. if (c.Hotspot_SingleLine.HasValue)
  644. b = c.Hotspot_SingleLine;
  645. }
  646. if (b.HasValue)
  647. Scintilla.HotspotStyle.SingleLine = b.Value;
  648. b = null;
  649. foreach (Configuration c in configList)
  650. {
  651. if (c.Hotspot_UseActiveBackColor.HasValue)
  652. b = c.Hotspot_UseActiveBackColor;
  653. }
  654. if (b.HasValue)
  655. Scintilla.HotspotStyle.UseActiveBackColor = b.Value;
  656. b = null;
  657. foreach (Configuration c in configList)
  658. {
  659. if (c.Hotspot_UseActiveForeColor.HasValue)
  660. b = c.Hotspot_UseActiveForeColor;
  661. }
  662. if (b.HasValue)
  663. Scintilla.HotspotStyle.UseActiveForeColor = b.Value;
  664. b = null;
  665. foreach (Configuration c in configList)
  666. {
  667. if (c.Indentation_BackspaceUnindents.HasValue)
  668. b = c.Indentation_BackspaceUnindents;
  669. }
  670. if (b.HasValue)
  671. Scintilla.Indentation.BackspaceUnindents = b.Value;
  672. i = null;
  673. foreach (Configuration c in configList)
  674. {
  675. if (c.Indentation_IndentWidth.HasValue)
  676. i = c.Indentation_IndentWidth;
  677. }
  678. if (i.HasValue)
  679. Scintilla.Indentation.IndentWidth = i.Value;
  680. b = null;
  681. foreach (Configuration c in configList)
  682. {
  683. if (c.Indentation_ShowGuides.HasValue)
  684. b = c.Indentation_ShowGuides;
  685. }
  686. if (b.HasValue)
  687. Scintilla.Indentation.ShowGuides = b.Value;
  688. b = null;
  689. foreach (Configuration c in configList)
  690. {
  691. if (c.Indentation_TabIndents.HasValue)
  692. b = c.Indentation_TabIndents;
  693. }
  694. if (b.HasValue)
  695. Scintilla.Indentation.TabIndents = b.Value;
  696. i = null;
  697. foreach (Configuration c in configList)
  698. {
  699. if (c.Indentation_TabWidth.HasValue)
  700. i = c.Indentation_TabWidth;
  701. }
  702. if (i.HasValue)
  703. Scintilla.Indentation.TabWidth = i.Value;
  704. b = null;
  705. foreach (Configuration c in configList)
  706. {
  707. if (c.Indentation_UseTabs.HasValue)
  708. b = c.Indentation_UseTabs;
  709. }
  710. if (b.HasValue)
  711. Scintilla.Indentation.UseTabs = b.Value;
  712. SmartIndent? si = null;
  713. foreach (Configuration c in configList)
  714. {
  715. if (c.Indentation_SmartIndentType.HasValue)
  716. si = c.Indentation_SmartIndentType;
  717. }
  718. if (si.HasValue)
  719. Scintilla.Indentation.SmartIndentType = si.Value;
  720. if (_clearIndicators)
  721. Scintilla.Indicators.Reset();
  722. IndicatorConfigList resolvedIndicators = new IndicatorConfigList();
  723. foreach (Configuration c in configList)
  724. {
  725. if (c.Indicator_List.Inherit.HasValue && !c.Indicator_List.Inherit.Value)
  726. resolvedIndicators.Clear();
  727. foreach (IndicatorConfig ic in c.Indicator_List)
  728. {
  729. if (!resolvedIndicators.Contains(ic.Number) || !(ic.Inherit.HasValue && ic.Inherit.Value))
  730. {
  731. resolvedIndicators.Remove(ic.Number);
  732. resolvedIndicators.Add(ic);
  733. }
  734. else
  735. {
  736. IndicatorConfig rc = resolvedIndicators[ic.Number];
  737. if (ic.Color != Color.Empty)
  738. rc.Color = ic.Color;
  739. if (ic.Style.HasValue)
  740. rc.Style = ic.Style;
  741. if (ic.IsDrawnUnder.HasValue)
  742. rc.IsDrawnUnder = ic.IsDrawnUnder;
  743. }
  744. }
  745. }
  746. foreach (IndicatorConfig ic in resolvedIndicators)
  747. {
  748. Indicator ind = Scintilla.Indicators[ic.Number];
  749. if (ic.Color != Color.Empty)
  750. ind.Color = ic.Color;
  751. if (ic.IsDrawnUnder.HasValue)
  752. ind.IsDrawnUnder = ic.IsDrawnUnder.Value;
  753. if (ic.Style.HasValue)
  754. ind.Style = ic.Style.Value;
  755. }
  756. foreach(Configuration c in configList)
  757. {
  758. foreach (KeyWordConfig kwc in c.Lexing_Keywords)
  759. {
  760. if (kwc.Inherit.HasValue && kwc.Inherit.Value)
  761. Scintilla.Lexing.Keywords[kwc.List] += kwc.Value;
  762. else
  763. Scintilla.Lexing.Keywords[kwc.List] = kwc.Value;
  764. }
  765. }
  766. // Hrm... unfortunately there's no way to clear
  767. // Scintilla's Lexing Properties. Guess we'll just
  768. // have to live with adding to the existing list
  769. // and/or just overriding with new values. This
  770. // means that the "Inherit" attribute is really
  771. // meaningless. Nevertheless I'm leaving it in
  772. // just in case it ever becomes useful.
  773. foreach (Configuration c in configList)
  774. {
  775. foreach (KeyValuePair<string,string> item in c.Lexing_Properties)
  776. {
  777. Scintilla.Lexing.SetProperty(item.Key, item.Value);
  778. }
  779. }
  780. s = null;
  781. foreach (Configuration c in configList)
  782. {
  783. if (c.Lexing_WhiteSpaceChars != null)
  784. s = c.Lexing_WhiteSpaceChars;
  785. }
  786. if (s != null)
  787. Scintilla.Lexing.WhiteSpaceChars = s;
  788. s = null;
  789. foreach (Configuration c in configList)
  790. {
  791. if (c.Lexing_WordChars != null)
  792. s = c.Lexing_WordChars;
  793. }
  794. if (s != null)
  795. Scintilla.Lexing.WordChars = s;
  796. s = null;
  797. foreach (Configuration c in configList)
  798. {
  799. if (c.Lexing_LineCommentPrefix != null)
  800. s = c.Lexing_LineCommentPrefix;
  801. }
  802. if (s != null)
  803. Scintilla.Lexing.LineCommentPrefix = s;
  804. s = null;
  805. foreach (Configuration c in configList)
  806. {
  807. if (c.Lexing_StreamCommentPrefix != null)
  808. s = c.Lexing_StreamCommentPrefix;
  809. }
  810. if (s != null)
  811. Scintilla.Lexing.StreamCommentPrefix = s;
  812. s = null;
  813. foreach (Configuration c in configList)
  814. {
  815. if (c.Lexing_StreamCommentSuffix != null)
  816. s = c.Lexing_StreamCommentSuffix;
  817. }
  818. if (s != null)
  819. Scintilla.Lexing.StreamCommentSufix = s;
  820. s = null;
  821. foreach (Configuration c in configList)
  822. {
  823. if (c.Lexing_Language != null)
  824. s = c.Lexing_Language;
  825. }
  826. if (s == null)
  827. {
  828. // None of the configs specified a lexer. First let's see if
  829. // we have a Language-Lexer map defined:
  830. if (Scintilla.Lexing.LexerLanguageMap.ContainsKey(_language))
  831. {
  832. s = Scintilla.Lexing.LexerLanguageMap[_language];
  833. }
  834. else
  835. {
  836. try
  837. {
  838. Enum.Parse(typeof(Lexer), _language, true);
  839. // If we made it here, the language matches one of
  840. // the lexer names, just use that.
  841. s = _language;
  842. }
  843. catch (ArgumentException)
  844. {
  845. // No match, oh well. Don't set the lexer.
  846. }
  847. }
  848. }
  849. Scintilla.Lexing.LexerName = s;
  850. LineCache? lc = null;
  851. foreach (Configuration c in configList)
  852. {
  853. if (c.LineWrap_LayoutCache.HasValue)
  854. lc = c.LineWrap_LayoutCache;
  855. }
  856. if (lc.HasValue)
  857. Scintilla.LineWrap.LayoutCache = lc.Value;
  858. WrapMode? wm = null;
  859. foreach (Configuration c in configList)
  860. {
  861. if (c.LineWrap_Mode.HasValue)
  862. wm = c.LineWrap_Mode;
  863. }
  864. if (wm.HasValue)
  865. Scintilla.LineWrap.Mode = wm.Value;
  866. i = null;
  867. foreach (Configuration c in configList)
  868. {
  869. if (c.LineWrap_PositionCacheSize.HasValue)
  870. i = c.LineWrap_PositionCacheSize;
  871. }
  872. if (i.HasValue)
  873. Scintilla.LineWrap.PositionCacheSize = i.Value;
  874. i = null;
  875. foreach (Configuration c in configList)
  876. {
  877. if (c.LineWrap_StartIndent.HasValue)
  878. i = c.LineWrap_StartIndent;
  879. }
  880. if (i.HasValue)
  881. Scintilla.LineWrap.StartIndent = i.Value;
  882. WrapVisualFlag? wvf = null;
  883. foreach (Configuration c in configList)
  884. {
  885. if (c.LineWrap_VisualFlags.HasValue)
  886. wvf = c.LineWrap_VisualFlags;
  887. }
  888. if (wvf.HasValue)
  889. Scintilla.LineWrap.VisualFlags = wvf.Value;
  890. WrapVisualLocation? wvl = null;
  891. foreach (Configuration c in configList)
  892. {
  893. if (c.LineWrap_VisualFlagsLocation.HasValue)
  894. wvl = c.LineWrap_VisualFlagsLocation;
  895. }
  896. if (wvl.HasValue)
  897. Scintilla.LineWrap.VisualFlagsLocation = wvl.Value;
  898. co = Color.Empty;
  899. foreach (Configuration c in configList)
  900. {
  901. if (c.LongLines_EdgeColor != Color.Empty)
  902. co = c.LongLines_EdgeColor;
  903. }
  904. if (co != Color.Empty)
  905. Scintilla.LongLines.EdgeColor = co;
  906. i = null;
  907. foreach (Configuration c in configList)
  908. {
  909. if (c.LongLines_EdgeColumn.HasValue)
  910. i = c.LongLines_EdgeColumn;
  911. }
  912. if (i.HasValue)
  913. Scintilla.LongLines.EdgeColumn = i.Value;
  914. EdgeMode? em = null;
  915. foreach (Configuration c in configList)
  916. {
  917. if (c.LongLines_EdgeMode.HasValue)
  918. em = c.LongLines_EdgeMode;
  919. }
  920. if (em.HasValue)
  921. Scintilla.LongLines.EdgeMode = em.Value;
  922. if (_clearMargins)
  923. Scintilla.Margins.Reset();
  924. Dictionary<int, MarginConfig> margins = new Dictionary<int, MarginConfig>();
  925. foreach (Configuration c in configList)
  926. {
  927. if (c.Margin_List.Inherit.HasValue && !c.Margin_List.Inherit.Value)
  928. margins.Clear();
  929. foreach (MarginConfig mc in c.Margin_List)
  930. {
  931. if (!margins.ContainsKey(mc.Number) || (mc.Inherit.HasValue && !mc.Inherit.Value))
  932. {
  933. margins.Remove(mc.Number);
  934. margins.Add(mc.Number, mc);
  935. }
  936. else
  937. {
  938. MarginConfig m = margins[mc.Number];
  939. if (mc.AutoToggleMarkerNumber.HasValue)
  940. m.AutoToggleMarkerNumber = mc.AutoToggleMarkerNumber.Value;
  941. if (mc.IsClickable.HasValue)
  942. m.IsClickable = mc.IsClickable.Value;
  943. if (mc.IsFoldMargin.HasValue)
  944. m.IsFoldMargin = mc.IsFoldMargin.Value;
  945. if (mc.IsMarkerMargin.HasValue)
  946. m.IsMarkerMargin = mc.IsMarkerMargin.Value;
  947. if (mc.Type.HasValue)
  948. m.Type = mc.Type.Value;
  949. if (mc.Width.HasValue)
  950. m.Width = mc.Width.Value;
  951. }
  952. }
  953. }
  954. foreach (MarginConfig mc in margins.Values)
  955. {
  956. Margin m = Scintilla.Margins[mc.Number];
  957. if (mc.AutoToggleMarkerNumber.HasValue)
  958. m.AutoToggleMarkerNumber = mc.AutoToggleMarkerNumber.Value;
  959. if (mc.IsClickable.HasValue)
  960. m.IsClickable = mc.IsClickable.Value;
  961. if (mc.IsFoldMargin.HasValue)
  962. m.IsFoldMargin = mc.IsFoldMargin.Value;
  963. if (mc.IsMarkerMargin.HasValue)
  964. m.IsMarkerMargin = mc.IsMarkerMargin.Value;
  965. if (mc.Type.HasValue)
  966. m.Type = mc.Type.Value;
  967. if (mc.Width.HasValue)
  968. m.Width = mc.Width.Value;
  969. }
  970. MarkersConfigList resolvedMarkers = new MarkersConfigList();
  971. foreach (Configuration c in configList)
  972. {
  973. if (c.Markers_List.Inherit.HasValue && !c.Markers_List.Inherit.Value)
  974. resolvedMarkers.Clear();
  975. foreach (MarkersConfig mc in c.Markers_List)
  976. {
  977. if (!resolvedMarkers.Contains(mc.Number.Value) || (mc.Inherit.HasValue && !mc.Inherit.Value))
  978. {
  979. resolvedMarkers.Remove(mc.Number.Value);
  980. resolvedMarkers.Add(mc);
  981. }
  982. else
  983. {
  984. if (!mc.Number.HasValue)
  985. mc.Number = (int)(MarkerOutline)Enum.Parse(typeof(MarkerOutline), mc.Name, true);
  986. MarkersConfig m = resolvedMarkers[mc.Number.Value];
  987. if (mc.Alpha.HasValue)
  988. m.Alpha = mc.Alpha;
  989. if (mc.BackColor != Color.Empty)
  990. m.BackColor = mc.BackColor;
  991. if (mc.ForeColor != Color.Empty)
  992. m.ForeColor = mc.ForeColor;
  993. if (mc.Symbol.HasValue)
  994. m.Symbol = mc.Symbol;
  995. }
  996. }
  997. }
  998. b = null;
  999. foreach (Configuration c in configList)
  1000. {
  1001. if (c.Scrolling_EndAtLastLine.HasValue)
  1002. b = c.Scrolling_EndAtLastLine;
  1003. }
  1004. if (b.HasValue)
  1005. Scintilla.Scrolling.EndAtLastLine = b.Value;
  1006. i = null;
  1007. foreach (Configuration c in configList)
  1008. {
  1009. if (c.Scrolling_HorizontalWidth.HasValue)
  1010. i = c.Scrolling_HorizontalWidth;
  1011. }
  1012. if (i.HasValue)
  1013. Scintilla.Scrolling.HorizontalWidth = i.Value;
  1014. ScrollBars? sb = null;
  1015. foreach (Configuration c in configList)
  1016. {
  1017. if (c.Scrolling_ScrollBars.HasValue)
  1018. sb = c.Scrolling_ScrollBars;
  1019. }
  1020. if (sb.HasValue)
  1021. Scintilla.Scrolling.ScrollBars = sb.Value;
  1022. i = null;
  1023. foreach (Configuration c in configList)
  1024. {
  1025. if (c.Scrolling_XOffset.HasValue)
  1026. i = c.Scrolling_XOffset;
  1027. }
  1028. if (i.HasValue)
  1029. Scintilla.Scrolling.XOffset = i.Value;
  1030. co = Color.Empty;
  1031. foreach (Configuration c in configList)
  1032. {
  1033. if (c.Selection_BackColor != Color.Empty)
  1034. co = c.Selection_BackColor;
  1035. }
  1036. if (co != Color.Empty)
  1037. Scintilla.Selection.BackColor = co;
  1038. co = Color.Empty;
  1039. foreach (Configuration c in configList)
  1040. {
  1041. if (c.Selection_BackColorUnfocused != Color.Empty)
  1042. co = c.Selection_BackColorUnfocused;
  1043. }
  1044. if (co != Color.Empty)
  1045. Scintilla.Selection.BackColorUnfocused = co;
  1046. co = Color.Empty;
  1047. foreach (Configuration c in configList)
  1048. {
  1049. if (c.Selection_ForeColor != Color.Empty)
  1050. co = c.Selection_ForeColor;
  1051. }
  1052. if (co != Color.Empty)
  1053. Scintilla.Selection.ForeColor = co;
  1054. co = Color.Empty;
  1055. foreach (Configuration c in configList)
  1056. {
  1057. if (c.Selection_ForeColorUnfocused != Color.Empty)
  1058. co = c.Selection_ForeColorUnfocused;
  1059. }
  1060. if (co != Color.Empty)
  1061. Scintilla.Selection.ForeColorUnfocused = co;
  1062. b = null;
  1063. foreach (Configuration c in configList)
  1064. {
  1065. if (c.Selection_Hidden.HasValue)
  1066. b = c.Selection_Hidden;
  1067. }
  1068. if (b.HasValue)
  1069. Scintilla.Selection.Hidden = b.Value;
  1070. b = null;
  1071. foreach (Configuration c in configList)
  1072. {
  1073. if (c.Selection_HideSelection.HasValue)
  1074. b = c.Selection_HideSelection;
  1075. }
  1076. if (b.HasValue)
  1077. Scintilla.Selection.HideSelection = b.Value;
  1078. SelectionMode? selectionMode = null;
  1079. foreach (Configuration c in configList)
  1080. {
  1081. if (c.Selection_Mode.HasValue)
  1082. selectionMode = c.Selection_Mode;
  1083. }
  1084. if (selectionMode.HasValue)
  1085. Scintilla.Selection.Mode = selectionMode.Value;
  1086. b = null;
  1087. foreach (Configuration c in configList)
  1088. {
  1089. if (c.UndoRedoIsUndoEnabled.HasValue)
  1090. b = c.UndoRedoIsUndoEnabled;
  1091. }
  1092. if (b.HasValue)
  1093. Scintilla.UndoRedo.IsUndoEnabled = b.Value;
  1094. co = Color.Empty;
  1095. foreach (Configuration c in configList)
  1096. {
  1097. if (c.WhiteSpace_BackColor != Color.Empty)
  1098. co = c.WhiteSpace_BackColor;
  1099. }
  1100. if (co != Color.Empty)
  1101. Scintilla.WhiteSpace.BackColor = co;
  1102. co = Color.Empty;
  1103. foreach (Configuration c in configList)
  1104. {
  1105. if (c.WhiteSpace_ForeColor != Color.Empty)
  1106. co = c.WhiteSpace_ForeColor;
  1107. }
  1108. if (co != Color.Empty)
  1109. Scintilla.WhiteSpace.ForeColor = co;
  1110. WhiteSpaceMode? wsm = null;
  1111. foreach (Configuration c in configList)
  1112. {
  1113. if (c.WhiteSpace_Mode.HasValue)
  1114. wsm = c.WhiteSpace_Mode;
  1115. }
  1116. if (wsm.HasValue)
  1117. Scintilla.WhiteSpace.Mode = wsm.Value;
  1118. b = null;
  1119. foreach (Configuration c in configList)
  1120. {
  1121. if (c.WhiteSpace_UseWhiteSpaceBackColor.HasValue)
  1122. b = c.WhiteSpace_UseWhiteSpaceBackColor.HasValue;
  1123. }
  1124. if (b.HasValue)
  1125. Scintilla.WhiteSpace.UseWhiteSpaceBackColor = b.Value;
  1126. b = null;
  1127. foreach (Configuration c in configList)
  1128. {
  1129. if (c.WhiteSpace_UseWhiteSpaceForeColor.HasValue)
  1130. b = c.WhiteSpace_UseWhiteSpaceForeColor.HasValue;
  1131. }
  1132. if (co != Color.Empty)
  1133. Scintilla.WhiteSpace.UseWhiteSpaceForeColor = b.Value;
  1134. // OK so we saved the best for last instead of going in
  1135. // strict lexical order. Styles! This is really the section
  1136. // that people care about most in the config, and is also
  1137. // the most complex.
  1138. if (_clearStyles)
  1139. Scintilla.Styles.Reset();
  1140. i = null;
  1141. foreach (Configuration c in configList)
  1142. {
  1143. if (c.Styles.Bits.HasValue)
  1144. i = c.Styles.Bits;
  1145. }
  1146. if (i.HasValue)
  1147. Scintilla.Styles.Bits = i.Value;
  1148. Dictionary<string, int> styleNameMap = Scintilla.Lexing.StyleNameMap;
  1149. ResolvedStyleList resolvedStyles = new ResolvedStyleList();
  1150. int _unmappedStyleNumber = -1;
  1151. Dictionary<string, int> _unmappedStyleMap = new Dictionary<string,int>();
  1152. foreach (Configuration c in configList)
  1153. {
  1154. if (c.Styles.Inherit.HasValue && !c.Styles.Inherit.Value)
  1155. resolvedStyles.Clear();
  1156. foreach (StyleConfig sc in c.Styles)
  1157. {
  1158. i = sc.Number;
  1159. if (!i.HasValue)
  1160. {
  1161. if (!styleNameMap.ContainsKey(sc.Name))
  1162. {
  1163. if (_unmappedStyleMap.ContainsKey(sc.Name))
  1164. {
  1165. i = _unmappedStyleMap[sc.Name];
  1166. sc.Number = i;
  1167. }
  1168. else
  1169. {
  1170. i = _unmappedStyleNumber--;
  1171. sc.Number = i;
  1172. _unmappedStyleMap[sc.Name] = sc.Number.Value;
  1173. }
  1174. }
  1175. else
  1176. {
  1177. i = styleNameMap[sc.Name];
  1178. sc.Number = i;
  1179. }
  1180. }
  1181. StyleConfig baseStyleConfig = null;
  1182. if (!string.IsNullOrEmpty(sc.Name) && sc.Name.Contains("."))
  1183. {
  1184. baseStyleConfig = resolvedStyles.FindByName(sc.Name.Substring(sc.Name.IndexOf(".") + 1));
  1185. }
  1186. if (!resolvedStyles.ContainsKey(i.Value) || (sc.Inherit.HasValue && !sc.Inherit.Value))
  1187. {
  1188. resolvedStyles.Remove(i.Value);
  1189. resolvedStyles.Add(i.Value, sc);
  1190. }
  1191. StyleConfig rs = resolvedStyles[i.Value];
  1192. if (sc.BackColor != Color.Empty)
  1193. rs.BackColor = sc.BackColor;
  1194. else if (baseStyleConfig != null && baseStyleConfig.BackColor != Color.Empty)
  1195. rs.BackColor = baseStyleConfig.BackColor;
  1196. if (sc.Bold.HasValue)
  1197. rs.Bold = sc.Bold.Value;
  1198. else if (baseStyleConfig != null && baseStyleConfig.Bold.HasValue)
  1199. rs.Bold = baseStyleConfig.Bold.Value;
  1200. if (sc.Case.HasValue)
  1201. rs.Case = sc.Case.Value;
  1202. else if (baseStyleConfig != null && baseStyleConfig.Case.HasValue)
  1203. rs.Case = baseStyleConfig.Case.Value;
  1204. if (sc.CharacterSet.HasValue)
  1205. rs.CharacterSet = sc.CharacterSet.Value;
  1206. else if (baseStyleConfig != null && baseStyleConfig.CharacterSet.HasValue)
  1207. rs.CharacterSet = baseStyleConfig.CharacterSet.Value;
  1208. if (sc.FontName != null)
  1209. rs.FontName = sc.FontName;
  1210. else if (baseStyleConfig != null && baseStyleConfig.FontName != null)
  1211. rs.FontName = baseStyleConfig.FontName;
  1212. if (sc.ForeColor != Color.Empty)
  1213. rs.ForeColor = sc.ForeColor;
  1214. else if (baseStyleConfig != null && baseStyleConfig.ForeColor != Color.Empty)
  1215. rs.ForeColor = baseStyleConfig.ForeColor;
  1216. if (sc.IsChangeable.HasValue)
  1217. rs.IsChangeable = sc.IsChangeable.Value;
  1218. else if (baseStyleConfig != null && baseStyleConfig.IsChangeable.HasValue)
  1219. rs.IsChangeable = baseStyleConfig.IsChangeable.Value;
  1220. if (sc.IsHotspot.HasValue)
  1221. rs.IsHotspot = sc.IsHotspot.Value;
  1222. else if (baseStyleConfig != null && baseStyleConfig.IsHotspot.HasValue)
  1223. rs.IsHotspot = baseStyleConfig.IsHotspot.Value;
  1224. if (sc.IsSelectionEolFilled.HasValue)
  1225. rs.IsSelectionEolFilled = sc.IsSelectionEolFilled.Value;
  1226. else if (baseStyleConfig != null && baseStyleConfig.IsSelectionEolFilled.HasValue)
  1227. rs.IsSelectionEolFilled = baseStyleConfig.IsSelectionEolFilled.Value;
  1228. if (sc.IsVisible.HasValue)
  1229. rs.IsVisible = sc.IsVisible.Value;
  1230. else if (baseStyleConfig != null && baseStyleConfig.IsVisible.HasValue)
  1231. rs.IsVisible = baseStyleConfig.IsVisible.Value;
  1232. if (sc.Italic.HasValue)
  1233. rs.Italic = sc.Italic.Value;
  1234. else if (baseStyleConfig != null && baseStyleConfig.Italic.HasValue)
  1235. rs.Italic = baseStyleConfig.Italic.Value;
  1236. if (sc.Size.HasValue)
  1237. rs.Size = sc.Size.Value;
  1238. else if (baseStyleConfig != null && baseStyleConfig.Size.HasValue)
  1239. rs.Size = baseStyleConfig.Size.Value;
  1240. if (sc.Underline.HasValue)
  1241. rs.Underline = sc.Underline.Value;
  1242. else if (baseStyleConfig != null && baseStyleConfig.Underline.HasValue)
  1243. rs.Underline = baseStyleConfig.Underline.Value;
  1244. }
  1245. }
  1246. // If a Default styles exist we want them at the top of the list because
  1247. // it needs to be applied first, then StyleClearAll() called so that all
  1248. // other styles will "inherit" this style. Then the other styles will
  1249. // override the default with any defined properties.
  1250. StyleConfig[] arr = new StyleConfig[resolvedStyles.Count];
  1251. resolvedStyles.Values.CopyTo(arr, 0);
  1252. Array.Sort<StyleConfig>(arr, new Comparison<StyleConfig>(delegate(StyleConfig sc1, StyleConfig sc2)
  1253. {
  1254. int v1 = sc1.Number.Value == Constants.STYLE_DEFAULT ? -1 : sc1.Number.Value;
  1255. int v2 = sc2.Number.Value == Constants.STYLE_DEFAULT ? -1 : sc2.Number.Value;
  1256. if (v1 < v2)
  1257. return -1;
  1258. else if (v2 < v1)
  1259. return 1;
  1260. return 0;
  1261. }));
  1262. foreach (StyleConfig sc in arr)
  1263. {
  1264. if (sc.Number < 0)
  1265. continue;
  1266. Style style = Scintilla.Styles[sc.Number.Value];
  1267. if (sc.BackColor != Color.Empty)
  1268. style.BackColor = sc.BackColor;
  1269. if (sc.Bold.HasValue)
  1270. style.Bold = sc.Bold.Value;
  1271. if (sc.Case.HasValue)
  1272. style.Case = sc.Case.Value;
  1273. if (sc.CharacterSet.HasValue)
  1274. style.CharacterSet = sc.CharacterSet.Value;
  1275. if (sc.FontName != null)
  1276. style.FontName = sc.FontName;
  1277. if (sc.ForeColor != Color.Empty)
  1278. style.ForeColor = sc.ForeColor;
  1279. if (sc.IsChangeable.HasValue)
  1280. style.IsChangeable = sc.IsChangeable.Value;
  1281. if (sc.IsHotspot.HasValue)
  1282. style.IsHotspot = sc.IsHotspot.Value;
  1283. if (sc.IsSelectionEolFilled.HasValue)
  1284. style.IsSelectionEolFilled = sc.IsSelectionEolFilled.Value;
  1285. if (sc.IsVisible.HasValue)
  1286. style.IsVisible = sc.IsVisible.Value;
  1287. if (sc.Italic.HasValue)
  1288. style.Italic = sc.Italic.Value;
  1289. if (sc.Size.HasValue)
  1290. style.Size = sc.Size.Value;
  1291. if (sc.Underline.HasValue)
  1292. style.Underline = sc.Underline.Value;
  1293. if (sc.Number == Constants.STYLE_DEFAULT)
  1294. Scintilla.Styles.ClearAll();
  1295. }
  1296. }
  1297. }
  1298. public enum ConfigurationLoadOrder
  1299. {
  1300. BuiltInCustomUser,
  1301. BuiltInUserCustom,
  1302. CustomBuiltInUser,
  1303. CustomUserBuiltIn,
  1304. UserBuiltInCustom,
  1305. UserCustomBuiltIn
  1306. }
  1307. }