PageRenderTime 67ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/Addons/SpellChecker2/SpellChecker2_Options.lua

http://sarf-wow-addons.googlecode.com/
Lua | 149 lines | 140 code | 9 blank | 0 comment | 13 complexity | 3b01cd4126c54f41c2a3ed7af696dde8 MD5 | raw file
  1. SpellChecker2_Options_Khaos_Registered = nil;
  2. function SpellChecker2_Options_VariablesLoaded()
  3. SpellChecker2_Options_Register_Khaos();
  4. end
  5. function SpellChecker2_GetFeedback_Boolean(state, msg)
  6. local stateMsg = SPELLCHECKER2_STATE_BOOLEAN_TRUE;
  7. if ( not state ) then
  8. stateMsg = SPELLCHECKER2_STATE_BOOLEAN_FALSE;
  9. end
  10. return format(msg, stateMsg);
  11. end
  12. function SpellChecker2_SetEnabled(state)
  13. if ( state == nil ) then state = false; end
  14. SpellChecker2_Options.enabled = state;
  15. end
  16. function SpellChecker2_SetCorrectIncomingMessages(state)
  17. if ( state == nil ) then state = false; end
  18. SpellChecker2_Options.correctIncomingMessages = state;
  19. end
  20. function SpellChecker2_SetCorrectOutgoingMessages(state)
  21. if ( state == nil ) then state = false; end
  22. SpellChecker2_Options.correctOutgoingMessages = state;
  23. end
  24. function SpellChecker2_SetStartCapitalization(state)
  25. if ( state == nil ) then state = false; end
  26. SpellChecker2_Options.startCapitalization = state;
  27. end
  28. function SpellChecker2_SetOnTheFlyCorrection(state)
  29. if ( state == nil ) then state = false; end
  30. SpellChecker2_Options.onTheFlyCorrection = state;
  31. end
  32. function SpellChecker2_Options_Register_Khaos()
  33. if ( SpellChecker2_Options_Khaos_Registered ) then
  34. return true;
  35. end
  36. if ( Khaos ) and ( Khaos.registerOptionSet ) then
  37. SpellChecker2_Options_Khaos_Registered = true;
  38. local optionSetEasy = {
  39. id = SPELLCHECKER2_KHAOS_SET_ID;
  40. text = SPELLCHECKER2_CONFIG_HEADER;
  41. helptext = SPELLCHECKER2_CONFIG_HEADER_INFO;
  42. callback = function(state) SpellChecker2_SetEnabled(state); end;
  43. difficulty = 1;
  44. default = true;
  45. options = {
  46. {
  47. id = "SpellChecker2Header";
  48. key = "header";
  49. text = SPELLCHECKER2_CONFIG_HEADER;
  50. helptext = SPELLCHECKER2_CONFIG_HEADER_INFO;
  51. type = K_HEADER;
  52. callback = function () end;
  53. },
  54. {
  55. id = "SpellChecker2CheckBoxEnabled";
  56. key = "enabled";
  57. text = SPELLCHECKER2_CONFIG_ENABLED;
  58. helptext = SPELLCHECKER2_CONFIG_ENABLED_INFO;
  59. check = true;
  60. callback = function(state) SpellChecker2_SetEnabled(state.checked); end;
  61. type = K_TEXT;
  62. feedback = function(state) return SpellChecker2_GetFeedback_Boolean(state.checked, SPELLCHECKER2_MSG_STATE_ENABLED); end;
  63. default = {
  64. checked = SPELLCHECKER2_OPTIONS_DEFAULT.enabled;
  65. };
  66. disabled = {
  67. checked = false;
  68. };
  69. },
  70. {
  71. id = "SpellChecker2CheckBoxCorrectIncomingMessages";
  72. key = "correctIncomingMessages";
  73. text = SPELLCHECKER2_CONFIG_INCOMING_MSGS;
  74. helptext = SPELLCHECKER2_CONFIG_INCOMING_MSGS_INFO;
  75. check = true;
  76. callback = function(state) SpellChecker2_SetCorrectIncomingMessages(state.checked); end;
  77. type = K_TEXT;
  78. feedback = function(state) return SpellChecker2_GetFeedback_Boolean(state.checked, SPELLCHECKER2_MSG_STATE_INCOMING_MSGS); end;
  79. default = {
  80. checked = SPELLCHECKER2_OPTIONS_DEFAULT.correctIncomingMessages;
  81. };
  82. disabled = {
  83. checked = false;
  84. };
  85. },
  86. {
  87. id = "SpellChecker2CheckBoxCorrectOutgoingMessages";
  88. key = "correctOutgoingMessages";
  89. text = SPELLCHECKER2_CONFIG_OUTGOING_MSGS;
  90. helptext = SPELLCHECKER2_CONFIG_OUTGOING_MSGS_INFO;
  91. check = true;
  92. callback = function(state) SpellChecker2_SetCorrectOutgoingMessages(state.checked); end;
  93. type = K_TEXT;
  94. feedback = function(state) return SpellChecker2_GetFeedback_Boolean(state.checked, SPELLCHECKER2_MSG_STATE_OUTGOING_MSGS); end;
  95. default = {
  96. checked = SPELLCHECKER2_OPTIONS_DEFAULT.correctOutgoingMessages;
  97. };
  98. disabled = {
  99. checked = false;
  100. };
  101. },
  102. {
  103. id = "SpellChecker2CheckBoxStartCapitalization";
  104. key = "startCapitalization";
  105. text = SPELLCHECKER2_CONFIG_START_CAP;
  106. helptext = SPELLCHECKER2_CONFIG_START_CAP_INFO;
  107. check = true;
  108. callback = function(state) SpellChecker2_SetStartCapitalization(state.checked); end;
  109. type = K_TEXT;
  110. feedback = function(state) return SpellChecker2_GetFeedback_Boolean(state.checked, SPELLCHECKER2_MSG_STATE_START_CAP); end;
  111. default = {
  112. checked = SPELLCHECKER2_OPTIONS_DEFAULT.startCapitalization;
  113. };
  114. disabled = {
  115. checked = false;
  116. };
  117. },
  118. {
  119. id = "SpellChecker2CheckBoxOnTheFlyCorrection";
  120. key = "onTheFlyCorrection";
  121. text = SPELLCHECKER2_CONFIG_ON_THE_FLY;
  122. helptext = SPELLCHECKER2_CONFIG_ON_THE_FLY_INFO;
  123. check = true;
  124. callback = function(state) SpellChecker2_SetOnTheFlyCorrection(state.checked); end;
  125. type = K_TEXT;
  126. feedback = function(state) return SpellChecker2_GetFeedback_Boolean(state.checked, SPELLCHECKER2_MSG_STATE_ON_THE_FLY); end;
  127. default = {
  128. checked = SPELLCHECKER2_OPTIONS_DEFAULT.onTheFlyCorrection;
  129. };
  130. disabled = {
  131. checked = false;
  132. };
  133. }
  134. };
  135. };
  136. Khaos.registerOptionSet( "chat", optionSetEasy );
  137. else
  138. return false;
  139. end
  140. end