common.bmx 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. ' Copyright (c) 2014-2020 Bruce A Henderson
  2. '
  3. ' Permission is hereby granted, free of charge, to any person obtaining a copy
  4. ' of this software and associated documentation files (the "Software"), to deal
  5. ' in the Software without restriction, including without limitation the rights
  6. ' to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. ' copies of the Software, and to permit persons to whom the Software is
  8. ' furnished to do so, subject to the following conditions:
  9. '
  10. ' The above copyright notice and this permission notice shall be included in
  11. ' all copies or substantial portions of the Software.
  12. '
  13. ' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. ' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. ' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. ' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. ' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. ' OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. ' THE SOFTWARE.
  20. '
  21. Strict
  22. ?linux
  23. Import "-lgmodule-2.0"
  24. ?macos
  25. ?win32
  26. Import "-lImm32"
  27. ?
  28. Import "source.bmx"
  29. Extern
  30. ?linux
  31. Function g_signal_cbsci:Int(gtkwidget:Byte Ptr, name:Byte Ptr, callback(widget:Byte Ptr, id:Int,notification:Byte Ptr,gadget:Object),gadget:Object,destroyhandler(data:Byte Ptr,user: Byte Ptr),flag:Int) = "g_signal_connect_data"
  32. Function scintilla_new:Byte Ptr()
  33. Function bmx_mgta_scintilla_getsci:Byte Ptr(handle:Byte Ptr, id:Int)
  34. ?win32
  35. Function bmx_mgta_scintilla_getsci:Byte Ptr(parent:Byte Ptr)
  36. ?
  37. Function bmx_mgta_scintilla_gettext:String(handle:Byte Ptr)
  38. Function bmx_mgta_scintilla_settext(handle:Byte Ptr, Text:String)
  39. Function bmx_mgta_scintilla_setfont(handle:Byte Ptr, name:String, size:Int)
  40. Function bmx_mgta_scintilla_positionfromline:Int(handle:Byte Ptr, line:Int, valueInBytes:Int)
  41. Function bmx_mgta_scintilla_setselectionstart(handle:Byte Ptr, pos:Int)
  42. Function bmx_mgta_scintilla_setselectionend(handle:Byte Ptr, pos:Int)
  43. Function bmx_mgta_scintilla_scrollcaret(handle:Byte Ptr)
  44. Function bmx_mgta_scintilla_setsel(handle:Byte Ptr, startPos:Int, endPos:Int)
  45. Function bmx_mgta_scintilla_replacesel(handle:Byte Ptr, Text:Byte Ptr)
  46. Function bmx_mgta_scintilla_stylesetback(handle:Byte Ptr, col:Int)
  47. Function bmx_mgta_scintilla_stylesetfore(handle:Byte Ptr, style:Int, color:Int)
  48. Function bmx_mgta_scintilla_stylesetitalic(handle:Byte Ptr, style:Int, value:Int)
  49. Function bmx_mgta_scintilla_stylesetbold(handle:Byte Ptr, style:Int, value:Int)
  50. Function bmx_mgta_scintilla_stylesetunderline(handle:Byte Ptr, style:Int, value:Int)
  51. Function bmx_mgta_scintilla_startstyling(handle:Byte Ptr, startPos:Int)
  52. Function bmx_mgta_scintilla_setstyling(handle:Byte Ptr, realLength:Int, style:Int)
  53. Function bmx_mgta_scintilla_gettextrange:String(handle:Byte Ptr, startPos:Int, endPos:Int)
  54. Function bmx_mgta_scintilla_getlinecount:Int(handle:Byte Ptr)
  55. Function bmx_mgta_scintilla_getlength:Int(handle:Byte Ptr)
  56. Function bmx_mgta_scintilla_getcurrentpos:Int(handle:Byte Ptr)
  57. Function bmx_mgta_scintilla_getcurrentline:Int(handle:Byte Ptr)
  58. Function bmx_mgta_scintilla_settabwidth(handle:Byte Ptr, tabs:Int)
  59. Function bmx_mgta_scintilla_settargetstart(handle:Byte Ptr, pos:Int)
  60. Function bmx_mgta_scintilla_settargetend(handle:Byte Ptr, pos:Int)
  61. Function bmx_mgta_scintilla_replacetarget(handle:Byte Ptr, Text:Byte Ptr)
  62. Function bmx_mgta_scintilla_cut(handle:Byte Ptr)
  63. Function bmx_mgta_scintilla_copy(handle:Byte Ptr)
  64. Function bmx_mgta_scintilla_paste(handle:Byte Ptr)
  65. Function bmx_mgta_scintilla_linefromposition:Int(handle:Byte Ptr, index:Int)
  66. Function bmx_mgta_scintilla_appendtext(handle:Byte Ptr, Text:String)
  67. Function bmx_mgta_scintilla_scrolltoend(handle:Byte Ptr)
  68. Function bmx_mgta_scintilla_getselectionlength:Int(handle:Byte Ptr, units:Int)
  69. Function bmx_mgta_scintilla_addtext(handle:Byte Ptr, Text:Byte Ptr)
  70. Function bmx_mgta_scintilla_textwidth:Int(handle:Byte Ptr, Text:String)
  71. Function bmx_mgta_scintilla_setlinedigits(handle:Byte Ptr, lineDigits:Int Ptr, show:Int)
  72. Function bmx_mgta_scintilla_setmarginleft(handle:Byte Ptr, leftmargin:Int)
  73. Function bmx_mgta_scintilla_setcaretwidth(handle:Byte Ptr, width:Int)
  74. Function bmx_mgta_scintilla_setcaretcolor(handle:Byte Ptr, r:Int, g:Int, b:Int)
  75. Function bmx_mgta_scintilla_startendfromchar(handle:Byte Ptr, pos:Int, length:Int, startPos:Int Var, endPos:Int Var)
  76. Function bmx_mgta_scintilla_setcaretlinevisible(handle:Byte Ptr, enable:Int)
  77. Function bmx_mgta_scintilla_getcaretlinevisible:Int(handle:Byte Ptr)
  78. Function bmx_mgta_scintilla_setcaretlineback:Int(handle:Byte Ptr, r:Int, g:Int, b:Int, a:Int)
  79. Function bmx_mgta_scintilla_getcaretlineback:Int(handle:Byte Ptr)
  80. Function bmx_mgta_scintilla_notifcation_update(obj:Object, handle:Byte Ptr)
  81. Function bmx_mgta_scintilla_enableundoredo(handle:Byte Ptr, enable:Int)
  82. Function bmx_mgta_scintilla_undoredoenabled:Int(handle:Byte Ptr)
  83. Function bmx_mgta_scintilla_undo(handle:Byte Ptr)
  84. Function bmx_mgta_scintilla_redo(handle:Byte Ptr)
  85. Function bmx_mgta_scintilla_canundo:Int(handle:Byte Ptr)
  86. Function bmx_mgta_scintilla_canredo:Int(handle:Byte Ptr)
  87. Function bmx_mgta_scintilla_clearundoredo(handle:Byte Ptr)
  88. Function bmx_mgta_scintilla_sethighlightlanguage(handle:Byte Ptr, lang:String)
  89. Function bmx_mgta_scintilla_sethighlightkeywords(handle:Byte Ptr, index:Int, keywords:String)
  90. Function bmx_mgta_scintilla_sethighlightstyle(handle:Byte Ptr, style:Int, flags:Int, color:Int)
  91. Function bmx_mgta_scintilla_highlight(handle:Byte Ptr)
  92. Function bmx_mgta_scintilla_clearhighlightstyles(handle:Byte Ptr, back:Int, fore:Int)
  93. Function bmx_mgta_scintilla_setlinenumberbackcolor(handle:Byte Ptr, color:Int)
  94. Function bmx_mgta_scintilla_setlinenumberforecolor(handle:Byte Ptr, color:Int)
  95. Function bmx_mgta_scintilla_beginundoaction(handle:Byte Ptr)
  96. Function bmx_mgta_scintilla_endundoaction(handle:Byte Ptr)
  97. Function bmx_mgta_scintilla_setbracketmatchingcolor(handle:Byte Ptr, r:Int, g:Int, b:Int, flags:Int)
  98. Function bmx_mgta_scintilla_matchbrackets(handle:Byte Ptr)
  99. Function bmx_mgta_scintilla_resetscrollwidth(handle:Byte Ptr)
  100. End Extern
  101. Type TSCNotification
  102. Field code:Int
  103. Field modificationType:Int
  104. Field updated:Int
  105. Function _update(n:TSCNotification, code:Int, modificationType:Int, updated:Int) { nomangle }
  106. n.code = code
  107. n.modificationType = modificationType
  108. n.updated = updated
  109. End Function
  110. End Type
  111. Const SCN_STYLENEEDED:Int = 2000
  112. Const SCN_CHARADDED:Int = 2001
  113. Const SCN_SAVEPOINTREACHED:Int = 2002
  114. Const SCN_SAVEPOINTLEFT:Int = 2003
  115. Const SCN_MODIFYATTEMPTRO:Int = 2004
  116. Const SCN_KEY:Int = 2005
  117. Const SCN_DOUBLECLICK:Int = 2006
  118. Const SCN_UPDATEUI:Int = 2007
  119. Const SCN_MODIFIED:Int = 2008
  120. Const SCN_MACRORECORD:Int = 2009
  121. Const SCN_MARGINCLICK:Int = 2010
  122. Const SCN_NEEDSHOWN:Int = 2011
  123. Const SCN_PAINTED:Int = 2013
  124. Const SCN_USERLISTSELECTION:Int = 2014
  125. Const SCN_URIDROPPED:Int = 2015
  126. Const SCN_DWELLSTART:Int = 2016
  127. Const SCN_DWELLEND:Int = 2017
  128. Const SCN_ZOOM:Int = 2018
  129. Const SCN_HOTSPOTCLICK:Int = 2019
  130. Const SCN_HOTSPOTDOUBLECLICK:Int = 2020
  131. Const SCN_CALLTIPCLICK:Int = 2021
  132. Const SCN_AUTOCSELECTION:Int = 2022
  133. Const SCN_INDICATORCLICK:Int = 2023
  134. Const SCN_INDICATORRELEASE:Int = 2024
  135. Const SCN_AUTOCCANCELLED:Int = 2025
  136. Const SCN_AUTOCCHARDELETED:Int = 2026
  137. Const SCN_HOTSPOTRELEASECLICK:Int = 2027
  138. Const SCN_FOCUSIN:Int = 2028
  139. Const SCN_FOCUSOUT:Int = 2029
  140. Const SC_MOD_INSERTTEXT:Int = $1
  141. Const SC_MOD_DELETETEXT:Int = $2
  142. Const SC_MOD_CHANGESTYLE:Int = $4
  143. Const SC_MOD_CHANGEFOLD:Int = $8
  144. Const SC_PERFORMED_USER:Int = $10
  145. Const SC_PERFORMED_UNDO:Int = $20
  146. Const SC_PERFORMED_REDO:Int = $40
  147. Const SC_MULTISTEPUNDOREDO:Int = $80
  148. Const SC_LASTSTEPINUNDOREDO:Int = $100
  149. Const SC_MOD_CHANGEMARKER:Int = $200
  150. Const SC_MOD_BEFOREINSERT:Int = $400
  151. Const SC_MOD_BEFOREDELETE:Int = $800
  152. Const SC_MULTILINEUNDOREDO:Int = $1000
  153. Const SC_STARTACTION:Int = $2000
  154. Const SC_MOD_CHANGEINDICATOR:Int = $4000
  155. Const SC_MOD_CHANGELINESTATE:Int = $8000
  156. Const SC_MOD_CHANGEMARGIN:Int = $10000
  157. Const SC_MOD_CHANGEANNOTATION:Int = $20000
  158. Const SC_MOD_CONTAINER:Int = $40000
  159. Const SC_MOD_LEXERSTATE:Int = $80000
  160. Const SC_MODEVENTMASKALL:Int = $FFFFF
  161. Const SC_UPDATE_CONTENT:Int = $1
  162. Const SC_UPDATE_SELECTION:Int = $2
  163. Const SC_UPDATE_V_SCROLL:Int = $4
  164. Const SC_UPDATE_H_SCROLL:Int = $8