CodePageSettings.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. using FastReport.Utils;
  2. namespace FastReport.Design.PageDesigners.Code
  3. {
  4. internal class CodePageSettings
  5. {
  6. #region Fields
  7. private static bool FEnableCodeCompletion;
  8. private static bool FEnableVirtualSpace;
  9. private static bool FUseSpaces;
  10. private static bool FAllowOutlining;
  11. private static int FTabSize;
  12. private static bool FLineNumbers;
  13. private static Language FDefaultScriptLanguage;
  14. #endregion
  15. #region Properties
  16. public static bool EnableCodeCompletion
  17. {
  18. get { return FEnableCodeCompletion; }
  19. set { FEnableCodeCompletion = value; }
  20. }
  21. public static bool EnableVirtualSpace
  22. {
  23. get { return FEnableVirtualSpace; }
  24. set { FEnableVirtualSpace = value; }
  25. }
  26. public static bool UseSpaces
  27. {
  28. get { return FUseSpaces; }
  29. set { FUseSpaces = value; }
  30. }
  31. public static bool AllowOutlining
  32. {
  33. get { return FAllowOutlining; }
  34. set { FAllowOutlining = value; }
  35. }
  36. public static int TabSize
  37. {
  38. get { return FTabSize; }
  39. set { FTabSize = value; }
  40. }
  41. public static bool LineNumbers
  42. {
  43. get { return FLineNumbers; }
  44. set { FLineNumbers = value; }
  45. }
  46. public static Language DefaultScriptLanguage
  47. {
  48. get { return FDefaultScriptLanguage; }
  49. set
  50. {
  51. FDefaultScriptLanguage = value;
  52. Config.ReportSettings.DefaultLanguage = FDefaultScriptLanguage;
  53. }
  54. }
  55. #endregion
  56. #region Public Methods
  57. public static void SaveState()
  58. {
  59. var storage = new StorageService("Designer,Code");
  60. storage.SetBool("EnableCodeCompletion", EnableCodeCompletion);
  61. storage.SetBool("EnableVirtualSpace", EnableVirtualSpace);
  62. storage.SetBool("UseSpaces", UseSpaces);
  63. storage.SetBool("AllowOutlining", AllowOutlining);
  64. storage.SetInt("TabSize", TabSize);
  65. storage.SetBool("LineNumbers", LineNumbers);
  66. storage.SetEnum("DefaultScriptLanguage", DefaultScriptLanguage);
  67. }
  68. static CodePageSettings()
  69. {
  70. var storage = new StorageService("Designer,Code");
  71. EnableCodeCompletion = storage.GetBool("EnableCodeCompletion", true);
  72. EnableVirtualSpace = storage.GetBool("EnableVirtualSpace", true);
  73. UseSpaces = storage.GetBool("UseSpaces", true);
  74. AllowOutlining = storage.GetBool("AllowOutlining", true);
  75. TabSize = storage.GetInt("TabSize", 2);
  76. LineNumbers = storage.GetBool("LineNumbers", true);
  77. DefaultScriptLanguage = storage.GetEnum("DefaultScriptLanguage", Language.CSharp);
  78. }
  79. #endregion
  80. }
  81. }