fxruby 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (692) hide show
  1. data/ANNOUNCE +25 -0
  2. data/ChangeLog +10606 -0
  3. data/INSTALL +50 -0
  4. data/LICENSE +456 -0
  5. data/README +39 -0
  6. data/doc/apes02.html +21 -0
  7. data/doc/apes03.html +39 -0
  8. data/doc/book.html +3 -0
  9. data/doc/build.html +144 -0
  10. data/doc/ch03s02.html +24 -0
  11. data/doc/ch03s03.html +53 -0
  12. data/doc/ch03s04.html +37 -0
  13. data/doc/ch03s05.html +61 -0
  14. data/doc/ch04s02.html +72 -0
  15. data/doc/ch04s03.html +37 -0
  16. data/doc/ch04s04.html +72 -0
  17. data/doc/ch05s02.html +262 -0
  18. data/doc/ch05s03.html +128 -0
  19. data/doc/changes.html +75 -0
  20. data/doc/clipboardtut.html +68 -0
  21. data/doc/cvs.html +35 -0
  22. data/doc/differences.html +11 -0
  23. data/doc/dragdroptut.html +266 -0
  24. data/doc/events.html +36 -0
  25. data/doc/examples.html +104 -0
  26. data/doc/gems.html +73 -0
  27. data/doc/goals.html +39 -0
  28. data/doc/images/babelfish.png +0 -0
  29. data/doc/images/browser.png +0 -0
  30. data/doc/images/button.png +0 -0
  31. data/doc/images/call-chain-example.png +0 -0
  32. data/doc/images/colordialog.png +0 -0
  33. data/doc/images/datatarget.png +0 -0
  34. data/doc/images/dialog.png +0 -0
  35. data/doc/images/dilbert.png +0 -0
  36. data/doc/images/dirlist.png +0 -0
  37. data/doc/images/dropsite-droprejected.png +0 -0
  38. data/doc/images/foursplit.png +0 -0
  39. data/doc/images/gltest.png +0 -0
  40. data/doc/images/glviewer.png +0 -0
  41. data/doc/images/groupbox.png +0 -0
  42. data/doc/images/header.png +0 -0
  43. data/doc/images/hello-with-button.png +0 -0
  44. data/doc/images/hello-with-icon-1.png +0 -0
  45. data/doc/images/hello-with-icon-2.png +0 -0
  46. data/doc/images/hello-with-icon-3.png +0 -0
  47. data/doc/images/hello-with-tooltip.png +0 -0
  48. data/doc/images/hello-without-button.png +0 -0
  49. data/doc/images/hello.png +0 -0
  50. data/doc/images/hello2.png +0 -0
  51. data/doc/images/iconlist-bigicons.png +0 -0
  52. data/doc/images/iconlist-details.png +0 -0
  53. data/doc/images/image.png +0 -0
  54. data/doc/images/imageviewer.png +0 -0
  55. data/doc/images/inheritance.png +0 -0
  56. data/doc/images/mditest.png +0 -0
  57. data/doc/images/raabrowser.png +0 -0
  58. data/doc/images/scribble.png +0 -0
  59. data/doc/images/shutter.png +0 -0
  60. data/doc/images/splitter.png +0 -0
  61. data/doc/images/tabbook.png +0 -0
  62. data/doc/images/table.png +0 -0
  63. data/doc/images/tutorial1.png +0 -0
  64. data/doc/implementation.html +16 -0
  65. data/doc/infosources.html +33 -0
  66. data/doc/library.html +30 -0
  67. data/doc/opengl.html +73 -0
  68. data/doc/pt01.html +3 -0
  69. data/doc/pt02.html +3 -0
  70. data/doc/scintilla.html +36 -0
  71. data/doc/todo.html +40 -0
  72. data/doc/tutorial1.html +97 -0
  73. data/examples/RAA.rb +25 -0
  74. data/examples/README +53 -0
  75. data/examples/babelfish.rb +107 -0
  76. data/examples/bounce.rb +159 -0
  77. data/examples/browser.rb +191 -0
  78. data/examples/button.rb +160 -0
  79. data/examples/datatarget.rb +223 -0
  80. data/examples/dctest.rb +702 -0
  81. data/examples/dialog.rb +148 -0
  82. data/examples/dilbert.rb +105 -0
  83. data/examples/dirlist.rb +63 -0
  84. data/examples/dragdrop.rb +101 -0
  85. data/examples/dragsource.rb +81 -0
  86. data/examples/dropsite.rb +61 -0
  87. data/examples/foursplit.rb +103 -0
  88. data/examples/gltest.rb +342 -0
  89. data/examples/glviewer.rb +579 -0
  90. data/examples/groupbox.rb +422 -0
  91. data/examples/header.rb +150 -0
  92. data/examples/hello.rb +12 -0
  93. data/examples/hello2.rb +51 -0
  94. data/examples/iRAA.rb +153 -0
  95. data/examples/iconlist.rb +104 -0
  96. data/examples/icons/AngryGuyInBunnySuit.ico +0 -0
  97. data/examples/icons/FatBot.ico +0 -0
  98. data/examples/icons/FlippedySwitch.ico +0 -0
  99. data/examples/icons/LeGoon.ico +0 -0
  100. data/examples/icons/Net.ico +0 -0
  101. data/examples/icons/RedMacOS.ico +0 -0
  102. data/examples/icons/SawBlade.ico +0 -0
  103. data/examples/icons/backview.png +0 -0
  104. data/examples/icons/big.png +0 -0
  105. data/examples/icons/bigfolder.png +0 -0
  106. data/examples/icons/bigpenguin.png +0 -0
  107. data/examples/icons/bottomview.png +0 -0
  108. data/examples/icons/camera.png +0 -0
  109. data/examples/icons/capbutt.png +0 -0
  110. data/examples/icons/capnotlast.png +0 -0
  111. data/examples/icons/capproj.png +0 -0
  112. data/examples/icons/capround.png +0 -0
  113. data/examples/icons/colorpal.png +0 -0
  114. data/examples/icons/copy.png +0 -0
  115. data/examples/icons/cut.png +0 -0
  116. data/examples/icons/delimit.png +0 -0
  117. data/examples/icons/dippy.png +0 -0
  118. data/examples/icons/double_dash.png +0 -0
  119. data/examples/icons/filenew.png +0 -0
  120. data/examples/icons/fileopen.png +0 -0
  121. data/examples/icons/filesave.png +0 -0
  122. data/examples/icons/filesaveas.png +0 -0
  123. data/examples/icons/fonts.png +0 -0
  124. data/examples/icons/fox.png +0 -0
  125. data/examples/icons/foxicon.png +0 -0
  126. data/examples/icons/frontview.png +0 -0
  127. data/examples/icons/gem_big.png +0 -0
  128. data/examples/icons/gem_small.png +0 -0
  129. data/examples/icons/hello2.png +0 -0
  130. data/examples/icons/help.png +0 -0
  131. data/examples/icons/indent.png +0 -0
  132. data/examples/icons/jbevel.png +0 -0
  133. data/examples/icons/jmiter.png +0 -0
  134. data/examples/icons/jround.png +0 -0
  135. data/examples/icons/kill.png +0 -0
  136. data/examples/icons/leftview.png +0 -0
  137. data/examples/icons/light.png +0 -0
  138. data/examples/icons/minidoc.png +0 -0
  139. data/examples/icons/minifolder.png +0 -0
  140. data/examples/icons/minifolderopen.png +0 -0
  141. data/examples/icons/newfolder.png +0 -0
  142. data/examples/icons/nolight.png +0 -0
  143. data/examples/icons/onoff_dash.png +0 -0
  144. data/examples/icons/palette.png +0 -0
  145. data/examples/icons/parallel.png +0 -0
  146. data/examples/icons/paste.png +0 -0
  147. data/examples/icons/pattern.png +0 -0
  148. data/examples/icons/penguin.png +0 -0
  149. data/examples/icons/perspective.png +0 -0
  150. data/examples/icons/printicon.png +0 -0
  151. data/examples/icons/prop.png +0 -0
  152. data/examples/icons/redo.png +0 -0
  153. data/examples/icons/rightview.png +0 -0
  154. data/examples/icons/saveas.png +0 -0
  155. data/examples/icons/shutter1.png +0 -0
  156. data/examples/icons/shutter2.png +0 -0
  157. data/examples/icons/small.png +0 -0
  158. data/examples/icons/smoothlight.png +0 -0
  159. data/examples/icons/solid_line.png +0 -0
  160. data/examples/icons/tbuplevel.png +0 -0
  161. data/examples/icons/topview.png +0 -0
  162. data/examples/icons/undo.png +0 -0
  163. data/examples/icons/winapp.png +0 -0
  164. data/examples/icons/zoom.png +0 -0
  165. data/examples/image.rb +281 -0
  166. data/examples/imageviewer.rb +513 -0
  167. data/examples/inputs.rb +84 -0
  168. data/examples/mditest.rb +180 -0
  169. data/examples/pig.rb +77 -0
  170. data/examples/raabrowser.rb +132 -0
  171. data/examples/scintilla-test.rb +81 -0
  172. data/examples/scribble-orig.rb +186 -0
  173. data/examples/scribble.rb +166 -0
  174. data/examples/shutter.rb +158 -0
  175. data/examples/splitter.rb +211 -0
  176. data/examples/styledtext.rb +92 -0
  177. data/examples/tabbook.rb +124 -0
  178. data/examples/table.rb +187 -0
  179. data/examples/textedit/commands.rb +117 -0
  180. data/examples/textedit/helpwindow.rb +295 -0
  181. data/examples/textedit/prefdialog.rb +235 -0
  182. data/examples/textedit/textedit.rb +1767 -0
  183. data/ext/fox12/FXRbApp.cpp +127 -0
  184. data/ext/fox12/FXRbDataTarget.cpp +106 -0
  185. data/ext/fox12/FXRbGLViewer.cpp +89 -0
  186. data/ext/fox12/FXRuby.cpp +1818 -0
  187. data/ext/fox12/MANIFEST +189 -0
  188. data/ext/fox12/core_wrap.cpp +10119 -0
  189. data/ext/fox12/dc_wrap.cpp +2638 -0
  190. data/ext/fox12/dialogs_wrap.cpp +6244 -0
  191. data/ext/fox12/extconf.rb +176 -0
  192. data/ext/fox12/frames_wrap.cpp +8274 -0
  193. data/ext/fox12/fx3d_wrap.cpp +9315 -0
  194. data/ext/fox12/iconlist_wrap.cpp +3742 -0
  195. data/ext/fox12/icons_wrap.cpp +4040 -0
  196. data/ext/fox12/image_wrap.cpp +4026 -0
  197. data/ext/fox12/impl.cpp +1064 -0
  198. data/ext/fox12/include/FXMemoryBuffer.h +52 -0
  199. data/ext/fox12/include/FXRb4Splitter.h +54 -0
  200. data/ext/fox12/include/FXRbAccelTable.h +46 -0
  201. data/ext/fox12/include/FXRbApp.h +137 -0
  202. data/ext/fox12/include/FXRbAppVirtuals.h +15 -0
  203. data/ext/fox12/include/FXRbArrowButton.h +51 -0
  204. data/ext/fox12/include/FXRbBMPIcon.h +54 -0
  205. data/ext/fox12/include/FXRbBMPImage.h +54 -0
  206. data/ext/fox12/include/FXRbBitmap.h +115 -0
  207. data/ext/fox12/include/FXRbBitmapFrame.h +56 -0
  208. data/ext/fox12/include/FXRbBitmapView.h +52 -0
  209. data/ext/fox12/include/FXRbBitmapVirtuals.h +27 -0
  210. data/ext/fox12/include/FXRbButton.h +51 -0
  211. data/ext/fox12/include/FXRbCURCursor.h +60 -0
  212. data/ext/fox12/include/FXRbCanvas.h +51 -0
  213. data/ext/fox12/include/FXRbCheckButton.h +51 -0
  214. data/ext/fox12/include/FXRbColorBar.h +51 -0
  215. data/ext/fox12/include/FXRbColorDialog.h +53 -0
  216. data/ext/fox12/include/FXRbColorSelector.h +51 -0
  217. data/ext/fox12/include/FXRbColorWell.h +51 -0
  218. data/ext/fox12/include/FXRbColorWheel.h +51 -0
  219. data/ext/fox12/include/FXRbComboBox.h +56 -0
  220. data/ext/fox12/include/FXRbCommon.h +86 -0
  221. data/ext/fox12/include/FXRbComposite.h +51 -0
  222. data/ext/fox12/include/FXRbCursor.h +87 -0
  223. data/ext/fox12/include/FXRbCursorVirtuals.h +6 -0
  224. data/ext/fox12/include/FXRbDC.h +385 -0
  225. data/ext/fox12/include/FXRbDCPrint.h +49 -0
  226. data/ext/fox12/include/FXRbDCVirtuals.h +166 -0
  227. data/ext/fox12/include/FXRbDCWindow.h +64 -0
  228. data/ext/fox12/include/FXRbDataTarget.h +65 -0
  229. data/ext/fox12/include/FXRbDebugTarget.h +46 -0
  230. data/ext/fox12/include/FXRbDelegator.h +46 -0
  231. data/ext/fox12/include/FXRbDial.h +51 -0
  232. data/ext/fox12/include/FXRbDialogBox.h +68 -0
  233. data/ext/fox12/include/FXRbDialogBoxVirtuals.h +3 -0
  234. data/ext/fox12/include/FXRbDict.h +46 -0
  235. data/ext/fox12/include/FXRbDirBox.h +51 -0
  236. data/ext/fox12/include/FXRbDirDialog.h +53 -0
  237. data/ext/fox12/include/FXRbDirList.h +79 -0
  238. data/ext/fox12/include/FXRbDirSelector.h +51 -0
  239. data/ext/fox12/include/FXRbDocument.h +46 -0
  240. data/ext/fox12/include/FXRbDragCorner.h +51 -0
  241. data/ext/fox12/include/FXRbDrawable.h +64 -0
  242. data/ext/fox12/include/FXRbDrawableVirtuals.h +3 -0
  243. data/ext/fox12/include/FXRbDriveBox.h +51 -0
  244. data/ext/fox12/include/FXRbFileDialog.h +56 -0
  245. data/ext/fox12/include/FXRbFileDict.h +104 -0
  246. data/ext/fox12/include/FXRbFileDictVirtuals.h +9 -0
  247. data/ext/fox12/include/FXRbFileList.h +81 -0
  248. data/ext/fox12/include/FXRbFileSelector.h +51 -0
  249. data/ext/fox12/include/FXRbFoldingItemVirtuals.h +45 -0
  250. data/ext/fox12/include/FXRbFoldingList.h +183 -0
  251. data/ext/fox12/include/FXRbFont.h +70 -0
  252. data/ext/fox12/include/FXRbFontDialog.h +53 -0
  253. data/ext/fox12/include/FXRbFontSelector.h +51 -0
  254. data/ext/fox12/include/FXRbFrame.h +51 -0
  255. data/ext/fox12/include/FXRbGIFCursor.h +60 -0
  256. data/ext/fox12/include/FXRbGIFIcon.h +54 -0
  257. data/ext/fox12/include/FXRbGIFImage.h +54 -0
  258. data/ext/fox12/include/FXRbGLCanvas.h +92 -0
  259. data/ext/fox12/include/FXRbGLCanvasVirtuals.h +13 -0
  260. data/ext/fox12/include/FXRbGLContext.h +58 -0
  261. data/ext/fox12/include/FXRbGLObject.h +103 -0
  262. data/ext/fox12/include/FXRbGLObjectVirtuals.h +22 -0
  263. data/ext/fox12/include/FXRbGLShape.h +81 -0
  264. data/ext/fox12/include/FXRbGLShapeVirtuals.h +8 -0
  265. data/ext/fox12/include/FXRbGLViewer.h +83 -0
  266. data/ext/fox12/include/FXRbGLViewerVirtuals.h +6 -0
  267. data/ext/fox12/include/FXRbGLVisual.h +56 -0
  268. data/ext/fox12/include/FXRbGradientBar.h +55 -0
  269. data/ext/fox12/include/FXRbGroupBox.h +51 -0
  270. data/ext/fox12/include/FXRbHeader.h +125 -0
  271. data/ext/fox12/include/FXRbHeaderItemVirtuals.h +22 -0
  272. data/ext/fox12/include/FXRbHorizontalFrame.h +51 -0
  273. data/ext/fox12/include/FXRbICOIcon.h +54 -0
  274. data/ext/fox12/include/FXRbICOImage.h +54 -0
  275. data/ext/fox12/include/FXRbIcon.h +57 -0
  276. data/ext/fox12/include/FXRbIconItemVirtuals.h +71 -0
  277. data/ext/fox12/include/FXRbIconList.h +266 -0
  278. data/ext/fox12/include/FXRbIconListVirtuals.h +21 -0
  279. data/ext/fox12/include/FXRbId.h +74 -0
  280. data/ext/fox12/include/FXRbIdVirtuals.h +9 -0
  281. data/ext/fox12/include/FXRbImage.h +162 -0
  282. data/ext/fox12/include/FXRbImageFrame.h +56 -0
  283. data/ext/fox12/include/FXRbImageView.h +52 -0
  284. data/ext/fox12/include/FXRbImageVirtuals.h +51 -0
  285. data/ext/fox12/include/FXRbInputDialog.h +53 -0
  286. data/ext/fox12/include/FXRbJPGIcon.h +54 -0
  287. data/ext/fox12/include/FXRbJPGImage.h +54 -0
  288. data/ext/fox12/include/FXRbLabel.h +51 -0
  289. data/ext/fox12/include/FXRbList.h +204 -0
  290. data/ext/fox12/include/FXRbListBox.h +56 -0
  291. data/ext/fox12/include/FXRbListItemVirtuals.h +36 -0
  292. data/ext/fox12/include/FXRbListVirtuals.h +18 -0
  293. data/ext/fox12/include/FXRbMDIButton.h +162 -0
  294. data/ext/fox12/include/FXRbMDIChild.h +82 -0
  295. data/ext/fox12/include/FXRbMDIChildVirtuals.h +12 -0
  296. data/ext/fox12/include/FXRbMDIClient.h +80 -0
  297. data/ext/fox12/include/FXRbMDIClientVirtuals.h +12 -0
  298. data/ext/fox12/include/FXRbMainWindow.h +54 -0
  299. data/ext/fox12/include/FXRbMatrix.h +51 -0
  300. data/ext/fox12/include/FXRbMenuBar.h +63 -0
  301. data/ext/fox12/include/FXRbMenuButton.h +51 -0
  302. data/ext/fox12/include/FXRbMenuCaption.h +51 -0
  303. data/ext/fox12/include/FXRbMenuCascade.h +51 -0
  304. data/ext/fox12/include/FXRbMenuCheck.h +49 -0
  305. data/ext/fox12/include/FXRbMenuCommand.h +49 -0
  306. data/ext/fox12/include/FXRbMenuPane.h +52 -0
  307. data/ext/fox12/include/FXRbMenuRadio.h +49 -0
  308. data/ext/fox12/include/FXRbMenuSeparator.h +51 -0
  309. data/ext/fox12/include/FXRbMenuTitle.h +51 -0
  310. data/ext/fox12/include/FXRbMessageBox.h +56 -0
  311. data/ext/fox12/include/FXRbObject.h +67 -0
  312. data/ext/fox12/include/FXRbObjectVirtuals.h +9 -0
  313. data/ext/fox12/include/FXRbOptionMenu.h +73 -0
  314. data/ext/fox12/include/FXRbPCXIcon.h +54 -0
  315. data/ext/fox12/include/FXRbPCXImage.h +54 -0
  316. data/ext/fox12/include/FXRbPNGIcon.h +54 -0
  317. data/ext/fox12/include/FXRbPNGImage.h +54 -0
  318. data/ext/fox12/include/FXRbPPMIcon.h +54 -0
  319. data/ext/fox12/include/FXRbPPMImage.h +54 -0
  320. data/ext/fox12/include/FXRbPacker.h +51 -0
  321. data/ext/fox12/include/FXRbPicker.h +51 -0
  322. data/ext/fox12/include/FXRbPopup.h +70 -0
  323. data/ext/fox12/include/FXRbPopupVirtuals.h +6 -0
  324. data/ext/fox12/include/FXRbPrintDialog.h +53 -0
  325. data/ext/fox12/include/FXRbProgressBar.h +51 -0
  326. data/ext/fox12/include/FXRbProgressDialog.h +53 -0
  327. data/ext/fox12/include/FXRbRGBIcon.h +54 -0
  328. data/ext/fox12/include/FXRbRGBImage.h +54 -0
  329. data/ext/fox12/include/FXRbRadioButton.h +51 -0
  330. data/ext/fox12/include/FXRbRealSlider.h +51 -0
  331. data/ext/fox12/include/FXRbRealSpinner.h +64 -0
  332. data/ext/fox12/include/FXRbRealSpinnerVirtuals.h +3 -0
  333. data/ext/fox12/include/FXRbRecentFiles.h +49 -0
  334. data/ext/fox12/include/FXRbRegistry.h +46 -0
  335. data/ext/fox12/include/FXRbReplaceDialog.h +53 -0
  336. data/ext/fox12/include/FXRbRootWindow.h +51 -0
  337. data/ext/fox12/include/FXRbRuler.h +56 -0
  338. data/ext/fox12/include/FXRbScintilla.h +52 -0
  339. data/ext/fox12/include/FXRbScrollArea.h +82 -0
  340. data/ext/fox12/include/FXRbScrollAreaVirtuals.h +13 -0
  341. data/ext/fox12/include/FXRbScrollBar.h +73 -0
  342. data/ext/fox12/include/FXRbScrollPane.h +52 -0
  343. data/ext/fox12/include/FXRbScrollWindow.h +52 -0
  344. data/ext/fox12/include/FXRbSearchDialog.h +53 -0
  345. data/ext/fox12/include/FXRbSeparator.h +95 -0
  346. data/ext/fox12/include/FXRbSettings.h +46 -0
  347. data/ext/fox12/include/FXRbShell.h +56 -0
  348. data/ext/fox12/include/FXRbShutter.h +86 -0
  349. data/ext/fox12/include/FXRbShutterVirtuals.h +3 -0
  350. data/ext/fox12/include/FXRbSlider.h +51 -0
  351. data/ext/fox12/include/FXRbSpinner.h +64 -0
  352. data/ext/fox12/include/FXRbSpinnerVirtuals.h +3 -0
  353. data/ext/fox12/include/FXRbSplitter.h +54 -0
  354. data/ext/fox12/include/FXRbSpring.h +51 -0
  355. data/ext/fox12/include/FXRbStatusBar.h +51 -0
  356. data/ext/fox12/include/FXRbStatusLine.h +51 -0
  357. data/ext/fox12/include/FXRbStream.h +101 -0
  358. data/ext/fox12/include/FXRbStreamVirtuals.h +9 -0
  359. data/ext/fox12/include/FXRbStringDict.h +46 -0
  360. data/ext/fox12/include/FXRbSwitcher.h +51 -0
  361. data/ext/fox12/include/FXRbTGAIcon.h +54 -0
  362. data/ext/fox12/include/FXRbTGAImage.h +54 -0
  363. data/ext/fox12/include/FXRbTIFIcon.h +54 -0
  364. data/ext/fox12/include/FXRbTIFImage.h +54 -0
  365. data/ext/fox12/include/FXRbTabBar.h +64 -0
  366. data/ext/fox12/include/FXRbTabBarVirtuals.h +3 -0
  367. data/ext/fox12/include/FXRbTabBook.h +52 -0
  368. data/ext/fox12/include/FXRbTabItem.h +51 -0
  369. data/ext/fox12/include/FXRbTable.h +416 -0
  370. data/ext/fox12/include/FXRbTableItemVirtuals.h +68 -0
  371. data/ext/fox12/include/FXRbTableVirtuals.h +73 -0
  372. data/ext/fox12/include/FXRbText.h +89 -0
  373. data/ext/fox12/include/FXRbTextField.h +51 -0
  374. data/ext/fox12/include/FXRbTextVirtuals.h +9 -0
  375. data/ext/fox12/include/FXRbToggleButton.h +51 -0
  376. data/ext/fox12/include/FXRbToolBar.h +80 -0
  377. data/ext/fox12/include/FXRbToolBarGrip.h +51 -0
  378. data/ext/fox12/include/FXRbToolBarShell.h +52 -0
  379. data/ext/fox12/include/FXRbToolBarTab.h +51 -0
  380. data/ext/fox12/include/FXRbToolBarVirtuals.h +6 -0
  381. data/ext/fox12/include/FXRbToolTip.h +51 -0
  382. data/ext/fox12/include/FXRbTopWindow.h +91 -0
  383. data/ext/fox12/include/FXRbTopWindowVirtuals.h +15 -0
  384. data/ext/fox12/include/FXRbTreeItemVirtuals.h +42 -0
  385. data/ext/fox12/include/FXRbTreeList.h +249 -0
  386. data/ext/fox12/include/FXRbTreeListBox.h +53 -0
  387. data/ext/fox12/include/FXRbTreeListVirtuals.h +30 -0
  388. data/ext/fox12/include/FXRbTriStateButton.h +51 -0
  389. data/ext/fox12/include/FXRbVerticalFrame.h +51 -0
  390. data/ext/fox12/include/FXRbVisual.h +56 -0
  391. data/ext/fox12/include/FXRbWindow.h +200 -0
  392. data/ext/fox12/include/FXRbWindowVirtuals.h +69 -0
  393. data/ext/fox12/include/FXRbWizard.h +60 -0
  394. data/ext/fox12/include/FXRbXBMIcon.h +54 -0
  395. data/ext/fox12/include/FXRbXBMImage.h +54 -0
  396. data/ext/fox12/include/FXRbXPMIcon.h +54 -0
  397. data/ext/fox12/include/FXRbXPMImage.h +54 -0
  398. data/ext/fox12/include/FXRuby.h +728 -0
  399. data/ext/fox12/include/impl.h +201 -0
  400. data/ext/fox12/include/inlinestubs.h +1063 -0
  401. data/ext/fox12/label_wrap.cpp +4945 -0
  402. data/ext/fox12/layout_wrap.cpp +5061 -0
  403. data/ext/fox12/librb.c +636 -0
  404. data/ext/fox12/list_wrap.cpp +2212 -0
  405. data/ext/fox12/markfuncs.cpp +1568 -0
  406. data/ext/fox12/mdi_wrap.cpp +4521 -0
  407. data/ext/fox12/menu_wrap.cpp +4673 -0
  408. data/ext/fox12/scintilla_wrap.cpp +2245 -0
  409. data/ext/fox12/table_wrap.cpp +3581 -0
  410. data/ext/fox12/text_wrap.cpp +3539 -0
  411. data/ext/fox12/treelist_wrap.cpp +5609 -0
  412. data/ext/fox12/ui_wrap.cpp +10017 -0
  413. data/index.html +14 -0
  414. data/lib/fox12/aliases.rb +5211 -0
  415. data/lib/fox12/calendar.rb +218 -0
  416. data/lib/fox12/chore.rb +51 -0
  417. data/lib/fox12/colors.rb +282 -0
  418. data/lib/fox12/core.rb +249 -0
  419. data/lib/fox12/dict.rb +35 -0
  420. data/lib/fox12/glgroup.rb +165 -0
  421. data/lib/fox12/glshapes.rb +457 -0
  422. data/lib/fox12/input.rb +56 -0
  423. data/lib/fox12/irb.rb +179 -0
  424. data/lib/fox12/iterators.rb +331 -0
  425. data/lib/fox12/keys.rb +1376 -0
  426. data/lib/fox12/missingdep.rb +16 -0
  427. data/lib/fox12/pseudokeyboard.rb +36 -0
  428. data/lib/fox12/pseudomouse.rb +84 -0
  429. data/lib/fox12/responder.rb +72 -0
  430. data/lib/fox12/responder2.rb +122 -0
  431. data/lib/fox12/scintilla.rb +2629 -0
  432. data/lib/fox12/settings.rb +18 -0
  433. data/lib/fox12/signal.rb +68 -0
  434. data/lib/fox12/timeout.rb +58 -0
  435. data/lib/fox12/undolist.rb +456 -0
  436. data/lib/fox12/version.rb +11 -0
  437. data/rdoc-sources/FX4Splitter.rb +138 -0
  438. data/rdoc-sources/FXAccelTable.rb +67 -0
  439. data/rdoc-sources/FXApp.rb +557 -0
  440. data/rdoc-sources/FXArrowButton.rb +69 -0
  441. data/rdoc-sources/FXBMPIcon.rb +45 -0
  442. data/rdoc-sources/FXBMPImage.rb +20 -0
  443. data/rdoc-sources/FXBitmap.rb +78 -0
  444. data/rdoc-sources/FXBitmapFrame.rb +29 -0
  445. data/rdoc-sources/FXBitmapView.rb +41 -0
  446. data/rdoc-sources/FXButton.rb +43 -0
  447. data/rdoc-sources/FXCURCursor.rb +13 -0
  448. data/rdoc-sources/FXCanvas.rb +18 -0
  449. data/rdoc-sources/FXCheckButton.rb +57 -0
  450. data/rdoc-sources/FXColorBar.rb +43 -0
  451. data/rdoc-sources/FXColorDialog.rb +36 -0
  452. data/rdoc-sources/FXColorSelector.rb +65 -0
  453. data/rdoc-sources/FXColorWell.rb +57 -0
  454. data/rdoc-sources/FXColorWheel.rb +35 -0
  455. data/rdoc-sources/FXComboBox.rb +153 -0
  456. data/rdoc-sources/FXComposite.rb +34 -0
  457. data/rdoc-sources/FXCursor.rb +67 -0
  458. data/rdoc-sources/FXDC.rb +667 -0
  459. data/rdoc-sources/FXDCPrint.rb +127 -0
  460. data/rdoc-sources/FXDCWindow.rb +37 -0
  461. data/rdoc-sources/FXDataTarget.rb +41 -0
  462. data/rdoc-sources/FXDebugTarget.rb +25 -0
  463. data/rdoc-sources/FXDelegator.rb +23 -0
  464. data/rdoc-sources/FXDial.rb +68 -0
  465. data/rdoc-sources/FXDialogBox.rb +36 -0
  466. data/rdoc-sources/FXDict.rb +79 -0
  467. data/rdoc-sources/FXDirBox.rb +49 -0
  468. data/rdoc-sources/FXDirDialog.rb +18 -0
  469. data/rdoc-sources/FXDirList.rb +143 -0
  470. data/rdoc-sources/FXDirSelector.rb +30 -0
  471. data/rdoc-sources/FXDocument.rb +29 -0
  472. data/rdoc-sources/FXDragCorner.rb +19 -0
  473. data/rdoc-sources/FXDrawable.rb +27 -0
  474. data/rdoc-sources/FXDriveBox.rb +46 -0
  475. data/rdoc-sources/FXFileDialog.rb +132 -0
  476. data/rdoc-sources/FXFileDict.rb +168 -0
  477. data/rdoc-sources/FXFileList.rb +163 -0
  478. data/rdoc-sources/FXFileSelector.rb +148 -0
  479. data/rdoc-sources/FXFileStream.rb +24 -0
  480. data/rdoc-sources/FXFoldingList.rb +453 -0
  481. data/rdoc-sources/FXFont.rb +345 -0
  482. data/rdoc-sources/FXFontDialog.rb +14 -0
  483. data/rdoc-sources/FXFontSelector.rb +37 -0
  484. data/rdoc-sources/FXFrame.rb +47 -0
  485. data/rdoc-sources/FXGIFCursor.rb +38 -0
  486. data/rdoc-sources/FXGIFIcon.rb +21 -0
  487. data/rdoc-sources/FXGIFImage.rb +19 -0
  488. data/rdoc-sources/FXGLCanvas.rb +45 -0
  489. data/rdoc-sources/FXGLContext.rb +41 -0
  490. data/rdoc-sources/FXGLObject.rb +75 -0
  491. data/rdoc-sources/FXGLShape.rb +75 -0
  492. data/rdoc-sources/FXGLViewer.rb +309 -0
  493. data/rdoc-sources/FXGLVisual.rb +94 -0
  494. data/rdoc-sources/FXGradientBar.rb +291 -0
  495. data/rdoc-sources/FXGroupBox.rb +33 -0
  496. data/rdoc-sources/FXHeader.rb +377 -0
  497. data/rdoc-sources/FXHorizontalFrame.rb +29 -0
  498. data/rdoc-sources/FXICOIcon.rb +50 -0
  499. data/rdoc-sources/FXICOImage.rb +21 -0
  500. data/rdoc-sources/FXIcon.rb +38 -0
  501. data/rdoc-sources/FXIconList.rb +418 -0
  502. data/rdoc-sources/FXId.rb +34 -0
  503. data/rdoc-sources/FXImage.rb +198 -0
  504. data/rdoc-sources/FXImageFrame.rb +22 -0
  505. data/rdoc-sources/FXImageView.rb +35 -0
  506. data/rdoc-sources/FXInputDialog.rb +62 -0
  507. data/rdoc-sources/FXJPGIcon.rb +52 -0
  508. data/rdoc-sources/FXJPGImage.rb +25 -0
  509. data/rdoc-sources/FXLabel.rb +66 -0
  510. data/rdoc-sources/FXList.rb +412 -0
  511. data/rdoc-sources/FXListBox.rb +158 -0
  512. data/rdoc-sources/FXMDIButton.rb +67 -0
  513. data/rdoc-sources/FXMDIChild.rb +145 -0
  514. data/rdoc-sources/FXMDIClient.rb +67 -0
  515. data/rdoc-sources/FXMainWindow.rb +20 -0
  516. data/rdoc-sources/FXMat4.rb +171 -0
  517. data/rdoc-sources/FXMatrix.rb +57 -0
  518. data/rdoc-sources/FXMemoryBuffer.rb +19 -0
  519. data/rdoc-sources/FXMemoryStream.rb +45 -0
  520. data/rdoc-sources/FXMenuBar.rb +23 -0
  521. data/rdoc-sources/FXMenuButton.rb +84 -0
  522. data/rdoc-sources/FXMenuCaption.rb +47 -0
  523. data/rdoc-sources/FXMenuCascade.rb +18 -0
  524. data/rdoc-sources/FXMenuCheck.rb +30 -0
  525. data/rdoc-sources/FXMenuCommand.rb +27 -0
  526. data/rdoc-sources/FXMenuPane.rb +13 -0
  527. data/rdoc-sources/FXMenuRadio.rb +30 -0
  528. data/rdoc-sources/FXMenuSeparator.rb +21 -0
  529. data/rdoc-sources/FXMenuTitle.rb +27 -0
  530. data/rdoc-sources/FXMessageBox.rb +77 -0
  531. data/rdoc-sources/FXObject.rb +22 -0
  532. data/rdoc-sources/FXOptionMenu.rb +76 -0
  533. data/rdoc-sources/FXPCXIcon.rb +48 -0
  534. data/rdoc-sources/FXPCXImage.rb +21 -0
  535. data/rdoc-sources/FXPNGIcon.rb +48 -0
  536. data/rdoc-sources/FXPNGImage.rb +21 -0
  537. data/rdoc-sources/FXPPMIcon.rb +21 -0
  538. data/rdoc-sources/FXPPMImage.rb +21 -0
  539. data/rdoc-sources/FXPacker.rb +62 -0
  540. data/rdoc-sources/FXPicker.rb +27 -0
  541. data/rdoc-sources/FXPopup.rb +53 -0
  542. data/rdoc-sources/FXPrintDialog.rb +36 -0
  543. data/rdoc-sources/FXProgressBar.rb +57 -0
  544. data/rdoc-sources/FXProgressDialog.rb +36 -0
  545. data/rdoc-sources/FXQuatd.rb +1 -0
  546. data/rdoc-sources/FXQuatf.rb +1 -0
  547. data/rdoc-sources/FXRGBIcon.rb +49 -0
  548. data/rdoc-sources/FXRGBImage.rb +21 -0
  549. data/rdoc-sources/FXRadioButton.rb +64 -0
  550. data/rdoc-sources/FXRanged.rb +97 -0
  551. data/rdoc-sources/FXRangef.rb +97 -0
  552. data/rdoc-sources/FXRealSlider.rb +99 -0
  553. data/rdoc-sources/FXRealSpinner.rb +133 -0
  554. data/rdoc-sources/FXRecentFiles.rb +73 -0
  555. data/rdoc-sources/FXRectangle.rb +137 -0
  556. data/rdoc-sources/FXRegion.rb +64 -0
  557. data/rdoc-sources/FXRegistry.rb +39 -0
  558. data/rdoc-sources/FXReplaceDialog.rb +56 -0
  559. data/rdoc-sources/FXRootWindow.rb +17 -0
  560. data/rdoc-sources/FXRuler.rb +60 -0
  561. data/rdoc-sources/FXScintilla.rb +121 -0
  562. data/rdoc-sources/FXScrollArea.rb +86 -0
  563. data/rdoc-sources/FXScrollBar.rb +101 -0
  564. data/rdoc-sources/FXScrollPane.rb +23 -0
  565. data/rdoc-sources/FXScrollWindow.rb +38 -0
  566. data/rdoc-sources/FXSearchDialog.rb +24 -0
  567. data/rdoc-sources/FXSeparator.rb +64 -0
  568. data/rdoc-sources/FXSettings.rb +222 -0
  569. data/rdoc-sources/FXShell.rb +7 -0
  570. data/rdoc-sources/FXShutter.rb +97 -0
  571. data/rdoc-sources/FXSize.rb +30 -0
  572. data/rdoc-sources/FXSlider.rb +96 -0
  573. data/rdoc-sources/FXSphered.rb +65 -0
  574. data/rdoc-sources/FXSpheref.rb +65 -0
  575. data/rdoc-sources/FXSpinner.rb +132 -0
  576. data/rdoc-sources/FXSplitter.rb +88 -0
  577. data/rdoc-sources/FXSpring.rb +61 -0
  578. data/rdoc-sources/FXStatusBar.rb +42 -0
  579. data/rdoc-sources/FXStatusLine.rb +60 -0
  580. data/rdoc-sources/FXStream.rb +115 -0
  581. data/rdoc-sources/FXStringDict.rb +38 -0
  582. data/rdoc-sources/FXSwitcher.rb +78 -0
  583. data/rdoc-sources/FXTGAIcon.rb +48 -0
  584. data/rdoc-sources/FXTGAImage.rb +21 -0
  585. data/rdoc-sources/FXTIFIcon.rb +52 -0
  586. data/rdoc-sources/FXTIFImage.rb +24 -0
  587. data/rdoc-sources/FXTabBar.rb +76 -0
  588. data/rdoc-sources/FXTabBook.rb +38 -0
  589. data/rdoc-sources/FXTabItem.rb +51 -0
  590. data/rdoc-sources/FXTable.rb +654 -0
  591. data/rdoc-sources/FXText.rb +533 -0
  592. data/rdoc-sources/FXTextField.rb +141 -0
  593. data/rdoc-sources/FXToggleButton.rb +69 -0
  594. data/rdoc-sources/FXToolBar.rb +121 -0
  595. data/rdoc-sources/FXToolBarGrip.rb +55 -0
  596. data/rdoc-sources/FXToolBarShell.rb +44 -0
  597. data/rdoc-sources/FXToolTip.rb +36 -0
  598. data/rdoc-sources/FXTopWindow.rb +92 -0
  599. data/rdoc-sources/FXTreeList.rb +503 -0
  600. data/rdoc-sources/FXTreeListBox.rb +182 -0
  601. data/rdoc-sources/FXTriStateButton.rb +49 -0
  602. data/rdoc-sources/FXVec.rb +97 -0
  603. data/rdoc-sources/FXVec4.rb +91 -0
  604. data/rdoc-sources/FXVerticalFrame.rb +29 -0
  605. data/rdoc-sources/FXVisual.rb +79 -0
  606. data/rdoc-sources/FXWindow.rb +633 -0
  607. data/rdoc-sources/FXWizard.rb +63 -0
  608. data/rdoc-sources/FXXBMIcon.rb +22 -0
  609. data/rdoc-sources/FXXBMImage.rb +22 -0
  610. data/rdoc-sources/FXXPMIcon.rb +50 -0
  611. data/rdoc-sources/FXXPMImage.rb +21 -0
  612. data/rdoc-sources/README.rdoc +53 -0
  613. data/rdoc-sources/fxdefs.rb +90 -0
  614. data/tests/README +19 -0
  615. data/tests/TC_FXAccelTable.rb +43 -0
  616. data/tests/TC_FXApp.rb +15 -0
  617. data/tests/TC_FXArc.rb +26 -0
  618. data/tests/TC_FXButton.rb +72 -0
  619. data/tests/TC_FXCheckButton.rb +57 -0
  620. data/tests/TC_FXComboBox.rb +36 -0
  621. data/tests/TC_FXDC.rb +372 -0
  622. data/tests/TC_FXDCPrint.rb +102 -0
  623. data/tests/TC_FXDCWindow.rb +23 -0
  624. data/tests/TC_FXDataTarget.rb +24 -0
  625. data/tests/TC_FXDirList.rb +30 -0
  626. data/tests/TC_FXFileAssoc.rb +62 -0
  627. data/tests/TC_FXFileStream.rb +90 -0
  628. data/tests/TC_FXFont.rb +59 -0
  629. data/tests/TC_FXFontDesc.rb +62 -0
  630. data/tests/TC_FXGLGroup.rb +32 -0
  631. data/tests/TC_FXGLShape.rb +28 -0
  632. data/tests/TC_FXGLViewer.rb +18 -0
  633. data/tests/TC_FXGradientBar.rb +89 -0
  634. data/tests/TC_FXHeader.rb +82 -0
  635. data/tests/TC_FXIconDict.rb +52 -0
  636. data/tests/TC_FXIconList.rb +192 -0
  637. data/tests/TC_FXId.rb +19 -0
  638. data/tests/TC_FXImage.rb +144 -0
  639. data/tests/TC_FXLight.rb +33 -0
  640. data/tests/TC_FXList.rb +116 -0
  641. data/tests/TC_FXListBox.rb +49 -0
  642. data/tests/TC_FXMat4f.rb +228 -0
  643. data/tests/TC_FXMaterial.rb +75 -0
  644. data/tests/TC_FXMemoryStream.rb +87 -0
  645. data/tests/TC_FXMenuCommand.rb +26 -0
  646. data/tests/TC_FXPoint.rb +57 -0
  647. data/tests/TC_FXQuatf.rb +77 -0
  648. data/tests/TC_FXRadioButton.rb +57 -0
  649. data/tests/TC_FXRangef.rb +48 -0
  650. data/tests/TC_FXRectangle.rb +88 -0
  651. data/tests/TC_FXRegion.rb +54 -0
  652. data/tests/TC_FXRegistry.rb +27 -0
  653. data/tests/TC_FXScrollArea.rb +28 -0
  654. data/tests/TC_FXScrollWindow.rb +28 -0
  655. data/tests/TC_FXSegment.rb +22 -0
  656. data/tests/TC_FXShell.rb +26 -0
  657. data/tests/TC_FXSize.rb +54 -0
  658. data/tests/TC_FXStream.rb +11 -0
  659. data/tests/TC_FXTable.rb +468 -0
  660. data/tests/TC_FXTableItem.rb +48 -0
  661. data/tests/TC_FXText.rb +81 -0
  662. data/tests/TC_FXTopWindow.rb +32 -0
  663. data/tests/TC_FXTreeList.rb +83 -0
  664. data/tests/TC_FXTreeListBox.rb +23 -0
  665. data/tests/TC_FXUndoList.rb +43 -0
  666. data/tests/TC_FXVec2d.rb +142 -0
  667. data/tests/TC_FXVec2f.rb +137 -0
  668. data/tests/TC_FXVec3d.rb +150 -0
  669. data/tests/TC_FXVec3f.rb +150 -0
  670. data/tests/TC_FXVec4f.rb +158 -0
  671. data/tests/TC_FXViewport.rb +30 -0
  672. data/tests/TC_Misc.rb +157 -0
  673. data/tests/TC_downcast.rb +15 -0
  674. data/tests/TS_All.rb +25 -0
  675. data/tests/blankpage.ps +166 -0
  676. data/tests/doit.rb +5 -0
  677. data/tests/howdypage.ps +181 -0
  678. data/tests/stress1.rb +94 -0
  679. data/tests/stress2.rb +51 -0
  680. data/tests/stress3.rb +117 -0
  681. data/tests/testcase.rb +38 -0
  682. data/web/art/fxrubylogo.png +0 -0
  683. data/web/art/fxrubylogo_small.png +0 -0
  684. data/web/art/line.gif +0 -0
  685. data/web/art/oul_grey.gif +0 -0
  686. data/web/art/our.gif +0 -0
  687. data/web/downloads.html +91 -0
  688. data/web/home.html +109 -0
  689. data/web/menu.html +50 -0
  690. data/web/styles.css +167 -0
  691. data/web/top.html +15 -0
  692. metadata +737 -0
@@ -0,0 +1,1767 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fox12'
4
+ require 'fox12/responder'
5
+ require 'fox12/undolist'
6
+ require 'prefdialog'
7
+ require 'helpwindow'
8
+ require 'commands'
9
+
10
+ include Fox
11
+
12
+ class TextWindow < FXMainWindow
13
+
14
+ include Responder
15
+
16
+ MAXUNDOSIZE, KEEPUNDOSIZE = 1000000, 500000
17
+
18
+ # Define message identifiers recognized by this class
19
+ ID_ABOUT,
20
+ ID_FILEFILTER,
21
+ ID_OPEN,
22
+ ID_OPEN_SELECTED,
23
+ ID_REOPEN,
24
+ ID_SAVE,
25
+ ID_SAVEAS,
26
+ ID_NEW,
27
+ ID_TITLE,
28
+ ID_FONT,
29
+ ID_QUIT,
30
+ ID_PRINT,
31
+ ID_TREELIST,
32
+ ID_TEXT_BACK,
33
+ ID_TEXT_FORE,
34
+ ID_TEXT_SELBACK,
35
+ ID_TEXT_SELFORE,
36
+ ID_TEXT_CURSOR,
37
+ ID_DIR_BACK,
38
+ ID_DIR_FORE,
39
+ ID_DIR_SELBACK,
40
+ ID_DIR_SELFORE,
41
+ ID_DIR_LINES,
42
+ ID_RECENTFILE,
43
+ ID_TOGGLE_WRAP,
44
+ ID_FIXED_WRAP,
45
+ ID_SAVE_SETTINGS,
46
+ ID_TEXT,
47
+ ID_STRIP_CR,
48
+ ID_STRIP_SP,
49
+ ID_INCLUDE_PATH,
50
+ ID_SHOW_HELP,
51
+ ID_OVERSTRIKE,
52
+ ID_READONLY,
53
+ ID_FILETIME,
54
+ ID_PREFERENCES,
55
+ ID_TABCOLUMNS,
56
+ ID_WRAPCOLUMNS,
57
+ ID_DELIMITERS,
58
+ ID_INSERTTABS,
59
+ ID_AUTOINDENT,
60
+ ID_BRACEMATCH,
61
+ ID_NUMCHARS,
62
+ ID_INSERT_FILE,
63
+ ID_EXTRACT_FILE,
64
+ ID_WHEELADJUST,
65
+ ID_LAST = enum(FXMainWindow::ID_LAST, 47)
66
+
67
+ # Load the named icon from a file
68
+ def loadIcon(filename)
69
+ begin
70
+ filename = File.join("..", "icons", filename)
71
+ icon = nil
72
+ File.open(filename, "rb") { |f|
73
+ icon = FXPNGIcon.new(getApp(), f.read)
74
+ }
75
+ icon
76
+ rescue
77
+ raise RuntimeError, "Couldn't load icon: #{filename}"
78
+ end
79
+ end
80
+
81
+ def initialize(app)
82
+ # Call base class initialize first
83
+ super(app, "FOX Text Editor: - untitled", nil, nil, DECOR_ALL,
84
+ 0, 0, 850, 600, 0, 0)
85
+
86
+ # Set up the message map for this class
87
+ FXMAPFUNC(SEL_TIMEOUT, ID_FILETIME, :onCheckFile)
88
+ FXMAPFUNC(SEL_COMMAND, ID_ABOUT, :onCmdAbout)
89
+ FXMAPFUNC(SEL_COMMAND, ID_REOPEN, :onCmdReopen)
90
+ FXMAPFUNC(SEL_UPDATE, ID_REOPEN, :onUpdReopen)
91
+ FXMAPFUNC(SEL_COMMAND, ID_OPEN, :onCmdOpen)
92
+ FXMAPFUNC(SEL_COMMAND, ID_OPEN_SELECTED, :onCmdOpenSelected)
93
+ FXMAPFUNC(SEL_COMMAND, ID_SAVE, :onCmdSave)
94
+ FXMAPFUNC(SEL_UPDATE, ID_SAVE, :onUpdSave)
95
+ FXMAPFUNC(SEL_COMMAND, ID_SAVEAS, :onCmdSaveAs)
96
+ FXMAPFUNC(SEL_COMMAND, ID_NEW, :onCmdNew)
97
+ FXMAPFUNC(SEL_UPDATE, ID_TITLE, :onUpdTitle)
98
+ FXMAPFUNC(SEL_COMMAND, ID_FONT, :onCmdFont)
99
+ FXMAPFUNC(SEL_COMMAND, ID_QUIT, :onCmdQuit)
100
+ FXMAPFUNC(SEL_SIGNAL, ID_QUIT, :onCmdQuit)
101
+ FXMAPFUNC(SEL_CLOSE, ID_TITLE, :onCmdQuit)
102
+ FXMAPFUNC(SEL_COMMAND, ID_PRINT, :onCmdPrint)
103
+ FXMAPFUNC(SEL_COMMAND, ID_TREELIST, :onCmdTreeList)
104
+
105
+ FXMAPFUNC(SEL_COMMAND, ID_TEXT_BACK, :onCmdTextBackColor)
106
+ FXMAPFUNC(SEL_CHANGED, ID_TEXT_BACK, :onCmdTextBackColor)
107
+ FXMAPFUNC(SEL_UPDATE, ID_TEXT_BACK, :onUpdTextBackColor)
108
+ FXMAPFUNC(SEL_COMMAND, ID_TEXT_SELBACK, :onCmdTextSelBackColor)
109
+ FXMAPFUNC(SEL_CHANGED, ID_TEXT_SELBACK, :onCmdTextSelBackColor)
110
+ FXMAPFUNC(SEL_UPDATE, ID_TEXT_SELBACK, :onUpdTextSelBackColor)
111
+ FXMAPFUNC(SEL_COMMAND, ID_TEXT_FORE, :onCmdTextForeColor)
112
+ FXMAPFUNC(SEL_CHANGED, ID_TEXT_FORE, :onCmdTextForeColor)
113
+ FXMAPFUNC(SEL_UPDATE, ID_TEXT_FORE, :onUpdTextForeColor)
114
+ FXMAPFUNC(SEL_COMMAND, ID_TEXT_SELFORE, :onCmdTextSelForeColor)
115
+ FXMAPFUNC(SEL_CHANGED, ID_TEXT_SELFORE, :onCmdTextSelForeColor)
116
+ FXMAPFUNC(SEL_UPDATE, ID_TEXT_SELFORE, :onUpdTextSelForeColor)
117
+ FXMAPFUNC(SEL_COMMAND, ID_TEXT_CURSOR, :onCmdTextCursorColor)
118
+ FXMAPFUNC(SEL_CHANGED, ID_TEXT_CURSOR, :onCmdTextCursorColor)
119
+ FXMAPFUNC(SEL_UPDATE, ID_TEXT_CURSOR, :onUpdTextCursorColor)
120
+
121
+ FXMAPFUNC(SEL_COMMAND, ID_DIR_BACK, :onCmdDirBackColor)
122
+ FXMAPFUNC(SEL_CHANGED, ID_DIR_BACK, :onCmdDirBackColor)
123
+ FXMAPFUNC(SEL_UPDATE, ID_DIR_BACK, :onUpdDirBackColor)
124
+ FXMAPFUNC(SEL_COMMAND, ID_DIR_FORE, :onCmdDirForeColor)
125
+ FXMAPFUNC(SEL_CHANGED, ID_DIR_FORE, :onCmdDirForeColor)
126
+ FXMAPFUNC(SEL_UPDATE, ID_DIR_FORE, :onUpdDirForeColor)
127
+ FXMAPFUNC(SEL_COMMAND, ID_DIR_SELBACK, :onCmdDirSelBackColor)
128
+ FXMAPFUNC(SEL_CHANGED, ID_DIR_SELBACK, :onCmdDirSelBackColor)
129
+ FXMAPFUNC(SEL_UPDATE, ID_DIR_SELBACK, :onUpdDirSelBackColor)
130
+ FXMAPFUNC(SEL_COMMAND, ID_DIR_SELFORE, :onCmdDirSelForeColor)
131
+ FXMAPFUNC(SEL_CHANGED, ID_DIR_SELFORE, :onCmdDirSelForeColor)
132
+ FXMAPFUNC(SEL_UPDATE, ID_DIR_SELFORE, :onUpdDirSelForeColor)
133
+ FXMAPFUNC(SEL_COMMAND, ID_DIR_LINES, :onCmdDirLineColor)
134
+ FXMAPFUNC(SEL_CHANGED, ID_DIR_LINES, :onCmdDirLineColor)
135
+ FXMAPFUNC(SEL_UPDATE, ID_DIR_LINES, :onUpdDirLineColor)
136
+
137
+ FXMAPFUNC(SEL_COMMAND, ID_RECENTFILE, :onCmdRecentFile)
138
+ FXMAPFUNC(SEL_UPDATE, ID_TOGGLE_WRAP, :onUpdWrap)
139
+ FXMAPFUNC(SEL_COMMAND, ID_TOGGLE_WRAP, :onCmdWrap)
140
+ FXMAPFUNC(SEL_COMMAND, ID_SAVE_SETTINGS, :onCmdSaveSettings)
141
+ FXMAPFUNC(SEL_INSERTED, ID_TEXT, :onTextInserted)
142
+ FXMAPFUNC(SEL_REPLACED, ID_TEXT, :onTextReplaced)
143
+ FXMAPFUNC(SEL_DELETED, ID_TEXT, :onTextDeleted)
144
+ FXMAPFUNC(SEL_RIGHTBUTTONRELEASE, ID_TEXT, :onTextRightMouse)
145
+ FXMAPFUNC(SEL_UPDATE, ID_FIXED_WRAP, :onUpdWrapFixed)
146
+ FXMAPFUNC(SEL_COMMAND, ID_FIXED_WRAP, :onCmdWrapFixed)
147
+ FXMAPFUNC(SEL_DND_MOTION, ID_TEXT, :onEditDNDMotion)
148
+ FXMAPFUNC(SEL_DND_DROP, ID_TEXT, :onEditDNDDrop)
149
+ FXMAPFUNC(SEL_UPDATE, ID_STRIP_CR, :onUpdStripReturns)
150
+ FXMAPFUNC(SEL_COMMAND, ID_STRIP_CR, :onCmdStripReturns)
151
+ FXMAPFUNC(SEL_UPDATE, ID_STRIP_SP, :onUpdStripSpaces)
152
+ FXMAPFUNC(SEL_COMMAND, ID_STRIP_SP, :onCmdStripSpaces)
153
+ FXMAPFUNC(SEL_COMMAND, ID_INCLUDE_PATH, :onCmdIncludePaths)
154
+ FXMAPFUNC(SEL_COMMAND, ID_SHOW_HELP, :onCmdShowHelp)
155
+ FXMAPFUNC(SEL_COMMAND, ID_FILEFILTER, :onCmdFilter)
156
+ FXMAPFUNC(SEL_UPDATE, ID_OVERSTRIKE, :onUpdOverstrike)
157
+ FXMAPFUNC(SEL_UPDATE, ID_READONLY, :onUpdReadOnly)
158
+ FXMAPFUNC(SEL_UPDATE, ID_NUMCHARS, :onUpdNumChars)
159
+ FXMAPFUNC(SEL_COMMAND, ID_PREFERENCES, :onCmdPreferences)
160
+ FXMAPFUNC(SEL_COMMAND, ID_TABCOLUMNS, :onCmdTabColumns)
161
+ FXMAPFUNC(SEL_UPDATE, ID_TABCOLUMNS, :onUpdTabColumns)
162
+ FXMAPFUNC(SEL_COMMAND, ID_DELIMITERS, :onCmdDelimiters)
163
+ FXMAPFUNC(SEL_UPDATE, ID_DELIMITERS, :onUpdDelimiters)
164
+ FXMAPFUNC(SEL_COMMAND, ID_WRAPCOLUMNS, :onCmdWrapColumns)
165
+ FXMAPFUNC(SEL_UPDATE, ID_WRAPCOLUMNS, :onUpdWrapColumns)
166
+ FXMAPFUNC(SEL_COMMAND, ID_AUTOINDENT, :onCmdAutoIndent)
167
+ FXMAPFUNC(SEL_UPDATE, ID_AUTOINDENT, :onUpdAutoIndent)
168
+ FXMAPFUNC(SEL_COMMAND, ID_INSERTTABS, :onCmdInsertTabs)
169
+ FXMAPFUNC(SEL_UPDATE, ID_INSERTTABS, :onUpdInsertTabs)
170
+ FXMAPFUNC(SEL_COMMAND, ID_BRACEMATCH, :onCmdBraceMatch)
171
+ FXMAPFUNC(SEL_UPDATE, ID_BRACEMATCH, :onUpdBraceMatch)
172
+ FXMAPFUNC(SEL_UPDATE, ID_INSERT_FILE, :onUpdInsertFile)
173
+ FXMAPFUNC(SEL_COMMAND, ID_INSERT_FILE, :onCmdInsertFile)
174
+ FXMAPFUNC(SEL_UPDATE, ID_EXTRACT_FILE, :onUpdExtractFile)
175
+ FXMAPFUNC(SEL_COMMAND, ID_EXTRACT_FILE, :onCmdExtractFile)
176
+ FXMAPFUNC(SEL_UPDATE, ID_WHEELADJUST, :onUpdWheelAdjust)
177
+ FXMAPFUNC(SEL_COMMAND, ID_WHEELADJUST, :onCmdWheelAdjust)
178
+
179
+ # Undoable commands
180
+ @undolist = FXUndoList.new
181
+
182
+ # Default font
183
+ @font = nil
184
+
185
+ # Make some icons
186
+ @bigicon = loadIcon("big.png")
187
+ @smallicon = loadIcon("small.png")
188
+ @newicon = loadIcon("filenew.png")
189
+ @openicon = loadIcon("fileopen.png")
190
+ @saveicon = loadIcon("filesave.png")
191
+ @saveasicon = FXPNGIcon.new(getApp(), File.open(File.join("..", "icons", "saveas.png"), "rb").read(),
192
+ 0, IMAGE_ALPHAGUESS)
193
+ @printicon = loadIcon("printicon.png")
194
+ @cuticon = loadIcon("cut.png")
195
+ @copyicon = loadIcon("copy.png")
196
+ @pasteicon = loadIcon("paste.png")
197
+ @deleteicon = loadIcon("kill.png")
198
+ @undoicon = loadIcon("undo.png")
199
+ @redoicon = loadIcon("redo.png")
200
+ @fontsicon = loadIcon("fonts.png")
201
+ @helpicon = loadIcon("help.png")
202
+
203
+ # Application icons
204
+ setIcon(@bigicon)
205
+ setMiniIcon(@smallicon)
206
+
207
+ # Make main window; set myself as the target
208
+ setTarget(self)
209
+ setSelector(ID_TITLE)
210
+
211
+ # Help window
212
+ @helpwindow = HelpWindow.new(self)
213
+
214
+ # Make menu bar
215
+ dragshell1 = FXToolbarShell.new(self, FRAME_RAISED|FRAME_THICK)
216
+ menubar = FXMenubar.new(self, dragshell1, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
217
+ FXToolbarGrip.new(menubar, menubar, FXMenubar::ID_TOOLBARGRIP,
218
+ TOOLBARGRIP_DOUBLE)
219
+
220
+ # Tool bar
221
+ dragshell2 = FXToolbarShell.new(self, FRAME_RAISED|FRAME_THICK)
222
+ toolbar = FXToolbar.new(self, dragshell2,
223
+ LAYOUT_SIDE_TOP|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH|PACK_UNIFORM_HEIGHT)
224
+ FXToolbarGrip.new(toolbar, toolbar, FXToolbar::ID_TOOLBARGRIP,
225
+ TOOLBARGRIP_DOUBLE)
226
+
227
+ # Status bar
228
+ statusbar = FXStatusbar.new(self,
229
+ LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|STATUSBAR_WITH_DRAGCORNER)
230
+
231
+ # Info about the editor
232
+ FXButton.new(statusbar, "\tThe FOX Text Editor\tAbout the FOX Text Editor.",
233
+ @smallicon, self, ID_ABOUT, LAYOUT_FILL_Y|LAYOUT_RIGHT)
234
+
235
+ # File menu
236
+ filemenu = FXMenuPane.new(self)
237
+ FXMenuTitle.new(menubar, "&File", nil, filemenu)
238
+
239
+ # Edit Menu
240
+ editmenu = FXMenuPane.new(self)
241
+ FXMenuTitle.new(menubar, "&Edit", nil, editmenu)
242
+
243
+ # Goto Menu
244
+ gotomenu = FXMenuPane.new(self)
245
+ FXMenuTitle.new(menubar, "&Goto", nil, gotomenu)
246
+
247
+ # Search Menu
248
+ searchmenu = FXMenuPane.new(self)
249
+ FXMenuTitle.new(menubar, "&Search", nil, searchmenu)
250
+
251
+ # Options Menu
252
+ optionmenu = FXMenuPane.new(self)
253
+ FXMenuTitle.new(menubar, "&Options", nil, optionmenu)
254
+
255
+ # View menu
256
+ viewmenu = FXMenuPane.new(self)
257
+ FXMenuTitle.new(menubar, "&View", nil, viewmenu)
258
+
259
+ # Help menu
260
+ helpmenu = FXMenuPane.new(self)
261
+ FXMenuTitle.new(menubar, "&Help", nil, helpmenu, LAYOUT_RIGHT)
262
+
263
+ # Splitter
264
+ splitter = FXSplitter.new(self,
265
+ LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y|SPLITTER_TRACKING)
266
+
267
+ # Sunken border for tree
268
+ @treebox = FXVerticalFrame.new(splitter, LAYOUT_FILL_X|LAYOUT_FILL_Y,
269
+ 0, 0, 0, 0, 0, 0, 0, 0)
270
+
271
+ # Make tree
272
+ treeframe = FXHorizontalFrame.new(@treebox,
273
+ FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y,
274
+ 0, 0, 0, 0, 0, 0, 0, 0)
275
+ @dirlist = FXDirList.new(treeframe, 0, self, ID_TREELIST,
276
+ (DIRLIST_SHOWFILES|TREELIST_BROWSESELECT|TREELIST_SHOWS_LINES|
277
+ TREELIST_SHOWS_BOXES|LAYOUT_FILL_X|LAYOUT_FILL_Y))
278
+ filterframe = FXHorizontalFrame.new(@treebox, LAYOUT_FILL_X)
279
+ FXLabel.new(filterframe, "Filter:")
280
+ @filter = FXComboBox.new(filterframe, 25, 4, self, ID_FILEFILTER,
281
+ COMBOBOX_STATIC|LAYOUT_FILL_X|FRAME_SUNKEN|FRAME_THICK)
282
+
283
+ # Sunken border for text widget
284
+ textbox = FXHorizontalFrame.new(splitter,
285
+ FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,0,0, 0,0,0,0)
286
+
287
+ # Make editor window
288
+ @editor = FXText.new(textbox, self, ID_TEXT, LAYOUT_FILL_X|LAYOUT_FILL_Y)
289
+ @editor.hiliteMatchTime = 300000
290
+
291
+ # Show readonly state in status bar
292
+ readonly = FXLabel.new(statusbar, nil, nil, FRAME_SUNKEN|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
293
+ readonly.padLeft = 2
294
+ readonly.padRight = 2
295
+ readonly.padTop = 1
296
+ readonly.padBottom = 1
297
+ readonly.setTarget(self)
298
+ readonly.setSelector(ID_READONLY)
299
+
300
+ # Show insert mode in status bar
301
+ overstrike = FXLabel.new(statusbar, nil, nil, FRAME_SUNKEN|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
302
+ overstrike.padLeft = 2
303
+ overstrike.padRight = 2
304
+ overstrike.padTop = 1
305
+ overstrike.padBottom = 1
306
+ overstrike.setTarget(self)
307
+ overstrike.setSelector(ID_OVERSTRIKE)
308
+
309
+ # Show size of text in status bar
310
+ numchars = FXTextField.new(statusbar, 6, self, ID_NUMCHARS,
311
+ FRAME_SUNKEN|JUSTIFY_RIGHT|LAYOUT_RIGHT|LAYOUT_CENTER_Y,
312
+ 0, 0, 0, 0, 2, 2, 1, 1)
313
+ numchars.backColor = statusbar.backColor
314
+
315
+ # Caption before number
316
+ FXLabel.new(statusbar, " Size:", nil, LAYOUT_RIGHT|LAYOUT_CENTER_Y)
317
+
318
+ # Show column number in status bar
319
+ columnno = FXTextField.new(statusbar, 4, @editor, FXText::ID_CURSOR_COLUMN,
320
+ FRAME_SUNKEN|JUSTIFY_RIGHT|LAYOUT_RIGHT|LAYOUT_CENTER_Y,
321
+ 0, 0, 0, 0, 2, 2, 1, 1)
322
+ columnno.backColor = statusbar.backColor
323
+
324
+ # Caption before number
325
+ FXLabel.new(statusbar, " Col:", nil, LAYOUT_RIGHT|LAYOUT_CENTER_Y)
326
+
327
+ # Show line number in status bar
328
+ rowno = FXTextField.new(statusbar, 4, @editor, FXText::ID_CURSOR_ROW,
329
+ FRAME_SUNKEN|JUSTIFY_RIGHT|LAYOUT_RIGHT|LAYOUT_CENTER_Y,
330
+ 0, 0, 0, 0, 2, 2, 1, 1)
331
+ rowno.backColor = statusbar.backColor
332
+
333
+ # Caption before number
334
+ FXLabel.new(statusbar, " Line:", nil, LAYOUT_RIGHT|LAYOUT_CENTER_Y)
335
+
336
+ # Toobar buttons: File manipulation
337
+ FXButton.new(toolbar, "New\tNew\tCreate new document.", @newicon,
338
+ self, ID_NEW, (ICON_ABOVE_TEXT|BUTTON_TOOLBAR|FRAME_RAISED|
339
+ LAYOUT_TOP|LAYOUT_LEFT))
340
+ FXButton.new(toolbar, "Open\tOpen\tOpen document file.", @openicon,
341
+ self, ID_OPEN, (ICON_ABOVE_TEXT|BUTTON_TOOLBAR|FRAME_RAISED|
342
+ LAYOUT_TOP|LAYOUT_LEFT))
343
+ FXButton.new(toolbar, "Save\tSave\tSave document.", @saveicon,
344
+ self, ID_SAVE, (ICON_ABOVE_TEXT|BUTTON_TOOLBAR|FRAME_RAISED|
345
+ LAYOUT_TOP|LAYOUT_LEFT))
346
+ FXButton.new(toolbar, "Save as\tSave As\tSave document to another file.",
347
+ @saveasicon, self, ID_SAVEAS, (ICON_ABOVE_TEXT|BUTTON_TOOLBAR|
348
+ FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT))
349
+
350
+ # Toobar buttons: Print
351
+ FXFrame.new(toolbar,
352
+ LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT, 0, 0, 5, 5)
353
+ FXButton.new(toolbar, "Print\tPrint\tPrint document.", @printicon,
354
+ self, ID_PRINT, (ICON_ABOVE_TEXT|BUTTON_TOOLBAR|FRAME_RAISED|
355
+ LAYOUT_TOP|LAYOUT_LEFT))
356
+
357
+ # Toobar buttons: Editing
358
+ FXFrame.new(toolbar,
359
+ LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT, 0, 0, 5, 5)
360
+ FXButton.new(toolbar, "Cut\tCut\tCut selection to clipboard.", @cuticon,
361
+ @editor, FXText::ID_CUT_SEL, (ICON_ABOVE_TEXT|BUTTON_TOOLBAR|
362
+ FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT))
363
+ FXButton.new(toolbar, "Copy\tCopy\tCopy selection to clipboard.", @copyicon,
364
+ @editor, FXText::ID_COPY_SEL, (ICON_ABOVE_TEXT|BUTTON_TOOLBAR|
365
+ FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT))
366
+ FXButton.new(toolbar, "Paste\tPaste\tPaste clipboard.", @pasteicon,
367
+ @editor, FXText::ID_PASTE_SEL, (ICON_ABOVE_TEXT|BUTTON_TOOLBAR|
368
+ FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT))
369
+ FXButton.new(toolbar, "Undo\tUndo\tUndo last change.", @undoicon,
370
+ @undolist, FXUndoList::ID_UNDO, (ICON_ABOVE_TEXT|BUTTON_TOOLBAR|
371
+ FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT))
372
+ FXButton.new(toolbar, "Redo\tRedo\tRedo last undo.", @redoicon,
373
+ @undolist, FXUndoList::ID_REDO, (ICON_ABOVE_TEXT|BUTTON_TOOLBAR|
374
+ FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT))
375
+
376
+ # Color
377
+ FXFrame.new(toolbar,
378
+ LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT, 0, 0, 5, 5)
379
+ FXButton.new(toolbar, "Fonts\tFonts\tDisplay font dialog.", @fontsicon,
380
+ self, ID_FONT, (ICON_ABOVE_TEXT|BUTTON_TOOLBAR|FRAME_RAISED|
381
+ LAYOUT_TOP|LAYOUT_LEFT))
382
+
383
+ FXButton.new(toolbar, "Help\tHelp on editor\tDisplay help information.",
384
+ @helpicon, self, ID_SHOW_HELP, (ICON_ABOVE_TEXT|BUTTON_TOOLBAR|
385
+ FRAME_RAISED|LAYOUT_TOP|LAYOUT_RIGHT))
386
+
387
+ # File Menu entries
388
+ FXMenuCommand.new(filemenu, "&Open... \tCtl-O\tOpen document file.",
389
+ @openicon, self, ID_OPEN)
390
+ FXMenuCommand.new(filemenu,
391
+ "Open Selected... \tCtl-E\tOpen highlighted document file.", nil,
392
+ self, ID_OPEN_SELECTED)
393
+ FXMenuCommand.new(filemenu, "&Reopen...\t\tReopen file.", nil,
394
+ self, ID_REOPEN)
395
+ FXMenuCommand.new(filemenu, "&New...\tCtl-N\tCreate new document.",
396
+ @newicon, self, ID_NEW)
397
+ FXMenuCommand.new(filemenu, "&Save\tCtl-S\tSave changes to file.",
398
+ @saveicon, self, ID_SAVE)
399
+ FXMenuCommand.new(filemenu, "Save &As...\t\tSave document to another file.",
400
+ @saveasicon, self, ID_SAVEAS)
401
+ FXMenuSeparator.new(filemenu)
402
+ FXMenuCommand.new(filemenu, "Insert from file...\t\tInsert text from file.",
403
+ nil, self, ID_INSERT_FILE)
404
+ FXMenuCommand.new(filemenu, "Extract to file...\t\tExtract text to file.",
405
+ nil, self, ID_EXTRACT_FILE)
406
+ FXMenuCommand.new(filemenu, "&Print...\tCtl-P\tPrint document.", @printicon,
407
+ self, ID_PRINT)
408
+ FXMenuCommand.new(filemenu, "&Editable\t\tDocument editable.", nil,
409
+ @editor, FXText::ID_TOGGLE_EDITABLE)
410
+ FXMenuCommand.new(filemenu, "&Iconify...\t\tIconify editor.", nil,
411
+ self, FXTopWindow::ID_ICONIFY)
412
+
413
+ # Recent file menu; this automatically hides if there are no files
414
+ sep1 = FXMenuSeparator.new(filemenu)
415
+ sep1.setTarget(@mrufiles)
416
+ sep1.setSelector(FXRecentFiles::ID_ANYFILES)
417
+ FXMenuCommand.new(filemenu, nil, nil, @mrufiles, FXRecentFiles::ID_FILE_1)
418
+ FXMenuCommand.new(filemenu, nil, nil, @mrufiles, FXRecentFiles::ID_FILE_2)
419
+ FXMenuCommand.new(filemenu, nil, nil, @mrufiles, FXRecentFiles::ID_FILE_3)
420
+ FXMenuCommand.new(filemenu, nil, nil, @mrufiles, FXRecentFiles::ID_FILE_4)
421
+ FXMenuCommand.new(filemenu, nil, nil, @mrufiles, FXRecentFiles::ID_FILE_5)
422
+ FXMenuCommand.new(filemenu, nil, nil, @mrufiles, FXRecentFiles::ID_FILE_6)
423
+ FXMenuCommand.new(filemenu, nil, nil, @mrufiles, FXRecentFiles::ID_FILE_7)
424
+ FXMenuCommand.new(filemenu, nil, nil, @mrufiles, FXRecentFiles::ID_FILE_8)
425
+ FXMenuCommand.new(filemenu, nil, nil, @mrufiles, FXRecentFiles::ID_FILE_9)
426
+ FXMenuCommand.new(filemenu, nil, nil, @mrufiles, FXRecentFiles::ID_FILE_10)
427
+ FXMenuCommand.new(filemenu, "&Clear Recent Files", nil,
428
+ @mrufiles, FXRecentFiles::ID_CLEAR)
429
+ sep2 = FXMenuSeparator.new(filemenu)
430
+ sep2.setTarget(@mrufiles)
431
+ sep2.setSelector(FXRecentFiles::ID_ANYFILES)
432
+ FXMenuCommand.new(filemenu, "&Quit\tCtl-Q", nil, self, ID_QUIT)
433
+
434
+ # Edit Menu entries
435
+ FXMenuCommand.new(editmenu, "&Undo\tCtl-Z\tUndo last change.", @undoicon,
436
+ @undolist, FXUndoList::ID_UNDO)
437
+ FXMenuCommand.new(editmenu, "&Redo\tCtl-Y\tRedo last undo.", @redoicon,
438
+ @undolist, FXUndoList::ID_REDO)
439
+ FXMenuCommand.new(editmenu, "&Undo all\t\tUndo all.", nil,
440
+ @undolist, FXUndoList::ID_UNDO_ALL)
441
+ FXMenuCommand.new(editmenu, "&Redo all\t\tRedo all.", nil,
442
+ @undolist, FXUndoList::ID_REDO_ALL)
443
+ FXMenuCommand.new(editmenu, "&Revert to saved\t\tRevert to saved.", nil,
444
+ @undolist, FXUndoList::ID_REVERT)
445
+ FXMenuSeparator.new(editmenu)
446
+ FXMenuCommand.new(editmenu, "&Copy\tCtl-C\tCopy selection to clipboard.",
447
+ @copyicon, @editor, FXText::ID_COPY_SEL)
448
+ FXMenuCommand.new(editmenu, "Cu&t\tCtl-X\tCut selection to clipboard.",
449
+ @cuticon, @editor, FXText::ID_CUT_SEL)
450
+ FXMenuCommand.new(editmenu, "&Paste\tCtl-V\tPaste from clipboard.",
451
+ @pasteicon, @editor, FXText::ID_PASTE_SEL)
452
+ FXMenuCommand.new(editmenu, "&Delete\t\tDelete selection.", @deleteicon,
453
+ @editor, FXText::ID_DELETE_SEL)
454
+ FXMenuSeparator.new(editmenu)
455
+ FXMenuCommand.new(editmenu, "Lo&wer-case\tCtl-6\tChange to lower case.",
456
+ nil, @editor, FXText::ID_LOWER_CASE)
457
+ FXMenuCommand.new(editmenu,
458
+ "Upp&er-case\tShift-Ctl-^\tChange to upper case.", nil,
459
+ @editor, FXText::ID_UPPER_CASE)
460
+ FXMenuCommand.new(editmenu,
461
+ "Clean indent\t\tClean indentation to either all tabs or all spaces.",
462
+ nil, @editor, FXText::ID_CLEAN_INDENT)
463
+ FXMenuCommand.new(editmenu, "Shift left\tCtl-9\tShift text left.", nil,
464
+ @editor, FXText::ID_SHIFT_LEFT)
465
+ FXMenuCommand.new(editmenu, "Shift right\tCtl-0\tShift text right.", nil,
466
+ @editor, FXText::ID_SHIFT_RIGHT)
467
+ FXMenuCommand.new(editmenu,
468
+ "Shift tab left\t\tShift text left one tab position.", nil,
469
+ @editor, FXText::ID_SHIFT_TABLEFT)
470
+ FXMenuCommand.new(editmenu,
471
+ "Shift tab right\t\tShift text right one tab position.", nil,
472
+ @editor, FXText::ID_SHIFT_TABRIGHT)
473
+
474
+ # Goto Menu entries
475
+ FXMenuCommand.new(gotomenu,
476
+ "&Goto...\tCtl-G\tGoto line number.", nil,
477
+ @editor, FXText::ID_GOTO_LINE)
478
+ FXMenuCommand.new(gotomenu,
479
+ "Goto selected...\tCtl-L\tGoto selected line number.", nil,
480
+ @editor, FXText::ID_GOTO_SELECTED)
481
+ FXMenuSeparator.new(gotomenu)
482
+ FXMenuCommand.new(gotomenu,
483
+ "Goto {..\tShift-Ctl-{\tGoto start of enclosing block.", nil,
484
+ @editor, FXText::ID_LEFT_BRACE)
485
+ FXMenuCommand.new(gotomenu,
486
+ "Goto ..}\tShift-Ctl-}\tGoto end of enclosing block.", nil,
487
+ @editor, FXText::ID_RIGHT_BRACE)
488
+ FXMenuCommand.new(gotomenu,
489
+ "Goto (..\tShift-Ctl-(\tGoto start of enclosing expression.", nil,
490
+ @editor, FXText::ID_LEFT_PAREN)
491
+ FXMenuCommand.new(gotomenu,
492
+ "Goto ..)\tShift-Ctl-)\tGoto end of enclosing expression.", nil,
493
+ @editor, FXText::ID_RIGHT_PAREN)
494
+ FXMenuSeparator.new(gotomenu)
495
+ FXMenuCommand.new(searchmenu,
496
+ "Goto matching (..)\tCtl-M\tGoto matching brace or parenthesis.", nil,
497
+ @editor, FXText::ID_GOTO_MATCHING)
498
+
499
+ # Search Menu entries
500
+ FXMenuCommand.new(searchmenu,
501
+ "Select matching (..)\tShift-Ctl-M\tSelect matching brace or parenthesis.", nil,
502
+ @editor, FXText::ID_SELECT_MATCHING)
503
+ FXMenuCommand.new(searchmenu,
504
+ "Select block {..}\tShift-Alt-{\tSelect enclosing block.", nil,
505
+ @editor, FXText::ID_SELECT_BRACE)
506
+ FXMenuCommand.new(searchmenu,
507
+ "Select block {..}\tShift-Alt-}\tSelect enclosing block.", nil,
508
+ @editor, FXText::ID_SELECT_BRACE)
509
+ FXMenuCommand.new(searchmenu,
510
+ "Select expression (..)\tShift-Alt-(\tSelect enclosing parentheses.", nil,
511
+ @editor, FXText::ID_SELECT_PAREN)
512
+ FXMenuCommand.new(searchmenu,
513
+ "Select expression (..)\tShift-Alt-)\tSelect enclosing parentheses.", nil,
514
+ @editor, FXText::ID_SELECT_PAREN)
515
+ FXMenuSeparator.new(searchmenu)
516
+ FXMenuCommand.new(searchmenu,
517
+ "&Search sel. fwd\tCtl-H\tSearch for selection.", nil,
518
+ @editor, FXText::ID_SEARCH_FORW_SEL)
519
+ FXMenuCommand.new(searchmenu,
520
+ "&Search sel. bck\tShift-Ctl-H\tSearch for selection.", nil,
521
+ @editor, FXText::ID_SEARCH_BACK_SEL)
522
+ FXMenuCommand.new(searchmenu,
523
+ "&Search...\tCtl-F\tSearch for a string.", nil,
524
+ @editor, FXText::ID_SEARCH)
525
+ FXMenuCommand.new(searchmenu,
526
+ "R&eplace...\tCtl-R\tSearch for a string.", nil,
527
+ @editor, FXText::ID_REPLACE)
528
+
529
+ # Options menu
530
+ FXMenuCommand.new(optionmenu,
531
+ "Preferences...\t\tChange preferences.", nil,
532
+ self, TextWindow::ID_PREFERENCES)
533
+ FXMenuCommand.new(optionmenu,
534
+ "Font...\t\tChange text font.", @fontsicon, self, ID_FONT)
535
+ FXMenuCommand.new(optionmenu,
536
+ "Overstrike\t\tToggle overstrike mode.", nil,
537
+ @editor, FXText::ID_TOGGLE_OVERSTRIKE)
538
+ FXMenuCommand.new(optionmenu,
539
+ "Include path...\t\tDirectories to search for include files.", nil,
540
+ self, TextWindow::ID_INCLUDE_PATH)
541
+ FXMenuCommand.new(optionmenu,
542
+ "Save Settings...\t\tSave settings now.", nil,
543
+ self, TextWindow::ID_SAVE_SETTINGS)
544
+
545
+ # View Menu entries
546
+ FXMenuCommand.new(viewmenu,
547
+ "Hidden files\t\tShow hidden files and directories.", nil,
548
+ @dirlist, FXDirList::ID_TOGGLE_HIDDEN)
549
+ FXMenuCommand.new(viewmenu,
550
+ "File Browser\t\tDisplay file list.", nil,
551
+ @treebox,FXWindow::ID_TOGGLESHOWN)
552
+ FXMenuCommand.new(viewmenu, "Toolbar\t\tDisplay toolbar.", nil,
553
+ toolbar, FXWindow::ID_TOGGLESHOWN)
554
+ FXMenuCommand.new(viewmenu, "Status line\t\tDisplay status line.", nil,
555
+ statusbar, FXWindow::ID_TOGGLESHOWN)
556
+
557
+ # Help Menu entries
558
+ FXMenuCommand.new(helpmenu, "&Help...\t\tDisplay help information.",
559
+ @helpicon, self, ID_SHOW_HELP, 0)
560
+ FXMenuSeparator.new(helpmenu)
561
+ FXMenuCommand.new(helpmenu, "&About TextEdit...\t\tDisplay about panel.",
562
+ @smallicon, self, ID_ABOUT, 0)
563
+
564
+ # Make a tool tip
565
+ FXTooltip.new(getApp(), 0)
566
+
567
+ # Recent files
568
+ @mrufiles = FXRecentFiles.new
569
+ @mrufiles.setTarget(self)
570
+ @mrufiles.setSelector(ID_RECENTFILE)
571
+
572
+ # Add some alternative accelerators
573
+ if getAccelTable()
574
+ getAccelTable().addAccel(MKUINT(KEY_Z, CONTROLMASK|SHIFTMASK),
575
+ @undolist,
576
+ MKUINT(FXUndoList::ID_REDO, SEL_COMMAND))
577
+ end
578
+
579
+ # Initialize file name
580
+ @filename = "untitled"
581
+ @filetime = nil
582
+ @filenameset = false
583
+
584
+ # Initialize other stuff
585
+ @searchpath = "/usr/include"
586
+ setPatterns(["All Files (*)"])
587
+ setCurrentPattern(0)
588
+ @timer = nil
589
+ @stripcr = true
590
+ @stripsp = false
591
+ @undolist.mark
592
+ end
593
+
594
+
595
+ # Load file
596
+ def loadFile(file)
597
+ begin
598
+ getApp().beginWaitCursor()
599
+ text = File.open(file, "r").read
600
+ text.gsub!('\r', '') if @stripcr
601
+ @editor.text = text
602
+ ensure
603
+ getApp().endWaitCursor()
604
+ end
605
+
606
+ # Set stuff
607
+ @editor.modified = false
608
+ @editor.editable = File.stat(file).writable?
609
+ @dirlist.currentFile = file
610
+ @mrufiles.appendFile(file)
611
+ @filetime = File.mtime(file)
612
+ @filename = file
613
+ @filenameset = true
614
+ @undolist.clear
615
+ @undolist.mark
616
+ end
617
+
618
+
619
+ # Insert file
620
+ def insertFile(file)
621
+ begin
622
+ getApp().beginWaitCursor()
623
+ text = File.open(file, "r").read
624
+ text.gsub!('\r', '') if @stripcr
625
+ @editor.insertText(@editor.cursorPos, text, n, true)
626
+ @editor.modified = true
627
+ ensure
628
+ getApp().endWaitCursor()
629
+ end
630
+ end
631
+
632
+
633
+ # Save file
634
+ def saveFile(file)
635
+ # Set wait cursor
636
+ getApp().beginWaitCursor()
637
+
638
+ # Get text from editor
639
+ text = @editor.text
640
+
641
+ # Strip trailing spaces
642
+ if @stripsp
643
+ lines = text.split('\n')
644
+ lines.each { |line|
645
+ line.sub!(/ *$/, "")
646
+ }
647
+ text = lines.join('\n')
648
+ end
649
+
650
+ # Write the file
651
+ File.open(file, "w").write(text)
652
+
653
+ # Kill wait cursor
654
+ getApp().endWaitCursor()
655
+
656
+ # Set stuff
657
+ @editor.modified = false
658
+ @editor.editable = true
659
+ @dirlist.currentFile = file
660
+ @mrufiles.appendFile(file)
661
+ @filetime = File.mtime(file)
662
+ @filename = file
663
+ @filenameset = true
664
+ @undolist.mark
665
+ end
666
+
667
+
668
+ # Extract file
669
+ def extractFile(file)
670
+ # Set wait cursor
671
+ getApp().beginWaitCursor()
672
+
673
+ # Get text from editor
674
+ size = @editor.selEndPos - @editor.selStartPos
675
+ text = @editor.extractText(@editor.selStartPos, size)
676
+
677
+ # Strip trailing spaces
678
+ if @stripsp
679
+ lines = text.split('\n')
680
+ lines.each { |line|
681
+ line.sub!(/ *$/, "")
682
+ }
683
+ text = lines.join('\n')
684
+ end
685
+
686
+ # Write the file
687
+ File.open(file, "w").write(text)
688
+
689
+ # Kill wait cursor
690
+ getApp().endWaitCursor()
691
+ end
692
+
693
+
694
+ # Read settings from registry
695
+ def readRegistry
696
+ # Text colors
697
+ textback = getApp().reg().readColorEntry("SETTINGS", "textbackground", @editor.backColor)
698
+ textfore = getApp().reg().readColorEntry("SETTINGS", "textforeground", @editor.textColor)
699
+ textselback = getApp().reg().readColorEntry("SETTINGS", "textselbackground", @editor.selBackColor)
700
+ textselfore = getApp().reg().readColorEntry("SETTINGS", "textselforeground", @editor.selTextColor)
701
+ textcursor = getApp().reg().readColorEntry("SETTINGS", "textcursor", @editor.cursorColor)
702
+
703
+ # Directory colors
704
+ dirback = getApp().reg().readColorEntry("SETTINGS", "browserbackground", @dirlist.backColor)
705
+ dirfore = getApp().reg().readColorEntry("SETTINGS", "browserforeground", @dirlist.textColor)
706
+ dirselback = getApp().reg().readColorEntry("SETTINGS", "browserselbackground", @dirlist.selBackColor)
707
+ dirselfore = getApp().reg().readColorEntry("SETTINGS", "browserselforeground", @dirlist.selTextColor)
708
+ dirlines = getApp().reg().readColorEntry("SETTINGS", "browserlines", @dirlist.lineColor)
709
+
710
+ # Delimiters
711
+ delimiters = getApp().reg().readStringEntry("SETTINGS", "delimiters", '~.,/\\`\'!@#$%^&*()-=+{}|[]":;<>?')
712
+
713
+ # Font
714
+ fontspec = getApp().reg().readStringEntry("SETTINGS", "font", "")
715
+ if fontspec != ""
716
+ fontdesc = fxparsefontdesc(fontspec)
717
+ if fontdesc
718
+ font = FXFont.new(getApp(), fontdesc)
719
+ @editor.font = font
720
+ end
721
+ end
722
+
723
+ # Get size
724
+ xx = getApp().reg().readIntEntry("SETTINGS", "x", 5)
725
+ yy = getApp().reg().readIntEntry("SETTINGS", "y", 5)
726
+ ww = getApp().reg().readIntEntry("SETTINGS", "width", 600)
727
+ hh = getApp().reg().readIntEntry("SETTINGS", "height", 400)
728
+
729
+ # Hidden files shown
730
+ hiddenfiles = getApp().reg().readIntEntry("SETTINGS", "showhiddenfiles", 0)
731
+ @dirlist.hiddenFilesShown = (hiddenfiles != 0) ? true : false
732
+
733
+ # Showing the tree?
734
+ hidetree = getApp().reg().readIntEntry("SETTINGS", "hidetree", 1)
735
+
736
+ # Width of tree
737
+ treewidth = getApp().reg().readIntEntry("SETTINGS", "treewidth", 100)
738
+
739
+ # Word wrapping
740
+ wrapping = getApp().reg().readIntEntry("SETTINGS", "wordwrap", 0)
741
+ wrapcols = getApp().reg().readIntEntry("SETTINGS", "wrapcols", 80)
742
+ fixedwrap = getApp().reg().readIntEntry("SETTINGS", "fixedwrap", 1)
743
+
744
+ # Tab settings, autoindent
745
+ autoindent = getApp().reg().readIntEntry("SETTINGS", "autoindent", 0)
746
+ hardtabs = getApp().reg().readIntEntry("SETTINGS", "hardtabs", 1)
747
+ tabcols = getApp().reg().readIntEntry("SETTINGS", "tabcols", 8)
748
+
749
+ # Strip returns
750
+ @stripcr = getApp().reg().readIntEntry("SETTINGS", "stripreturn", 0)
751
+ @stripcr = (@stripcr != 0) ? true : false
752
+ @stripsp = getApp().reg().readIntEntry("SETTINGS", "stripspaces", 0)
753
+ @stripsp = (@stripsp != 0) ? true : false
754
+
755
+ # File patterns
756
+ patterns = getApp().reg().readStringEntry("SETTINGS", "filepatterns", "All Files (*)")
757
+ setPatterns(patterns.split("\n"))
758
+ setCurrentPattern(getApp().reg().readIntEntry("SETTINGS", "filepatternno", 0))
759
+
760
+ # Search path
761
+ searchpath = getApp().reg().readStringEntry("SETTINGS", "searchpath", "/usr/include")
762
+
763
+ # Change the colors
764
+ @editor.textColor = textfore
765
+ @editor.backColor = textback
766
+ @editor.selBackColor = textselback
767
+ @editor.selTextColor = textselfore
768
+ @editor.cursorColor = textcursor
769
+
770
+ @dirlist.textColor = dirfore
771
+ @dirlist.backColor = dirback
772
+ @dirlist.selBackColor = dirselback
773
+ @dirlist.selTextColor = dirselfore
774
+ @dirlist.lineColor = dirlines
775
+
776
+ # Change delimiters
777
+ @editor.delimiters = delimiters
778
+
779
+ # Hide tree if asked for
780
+ @treebox.hide if hidetree
781
+
782
+ # Set tree width
783
+ @treebox.width = treewidth
784
+
785
+ # Open toward file
786
+ @dirlist.currentFile = @filename
787
+
788
+ # Wrap mode
789
+ if wrapping
790
+ @editor.textStyle |= TEXT_WORDWRAP
791
+ else
792
+ @editor.textStyle &= ~TEXT_WORDWRAP
793
+ end
794
+
795
+ # Wrap fixed mode
796
+ if fixedwrap
797
+ @editor.textStyle |= TEXT_FIXEDWRAP
798
+ else
799
+ @editor.textStyle &= ~TEXT_FIXEDWRAP
800
+ end
801
+
802
+ # Autoindent
803
+ if autoindent
804
+ @editor.textStyle |= TEXT_AUTOINDENT
805
+ else
806
+ @editor.textStyle &= ~TEXT_AUTOINDENT
807
+ end
808
+
809
+ # Hard tabs
810
+ if hardtabs
811
+ @editor.textStyle &= ~TEXT_NO_TABS
812
+ else
813
+ @editor.textStyle |= TEXT_NO_TABS
814
+ end
815
+
816
+ # Wrap and tab columns
817
+ @editor.wrapColumns = wrapcols
818
+ @editor.tabColumns = tabcols
819
+
820
+ # Reposition window
821
+ position(xx, yy, ww, hh)
822
+ end
823
+
824
+
825
+ # Save settings to registry
826
+ def writeRegistry
827
+ # Colors of text
828
+ getApp().reg().writeColorEntry("SETTINGS", "textbackground", @editor.backColor)
829
+ getApp().reg().writeColorEntry("SETTINGS", "textforeground", @editor.textColor)
830
+ getApp().reg().writeColorEntry("SETTINGS", "textselbackground", @editor.selBackColor)
831
+ getApp().reg().writeColorEntry("SETTINGS", "textselforeground", @editor.selTextColor)
832
+ getApp().reg().writeColorEntry("SETTINGS", "textcursor", @editor.cursorColor)
833
+
834
+ # Colors of directory
835
+ getApp().reg().writeColorEntry("SETTINGS", "browserbackground", @dirlist.backColor)
836
+ getApp().reg().writeColorEntry("SETTINGS", "browserforeground", @dirlist.textColor)
837
+ getApp().reg().writeColorEntry("SETTINGS", "browserselbackground", @dirlist.selBackColor)
838
+ getApp().reg().writeColorEntry("SETTINGS", "browserselforeground", @dirlist.selTextColor)
839
+ getApp().reg().writeColorEntry("SETTINGS", "browserlines", @dirlist.lineColor)
840
+
841
+ # Delimiters
842
+ getApp().reg().writeStringEntry("SETTINGS", "delimiters", @editor.delimiters)
843
+
844
+ # Write new window size back to registry
845
+ getApp().reg().writeIntEntry("SETTINGS", "x", getX())
846
+ getApp().reg().writeIntEntry("SETTINGS", "y", getY())
847
+ getApp().reg().writeIntEntry("SETTINGS", "width", getWidth())
848
+ getApp().reg().writeIntEntry("SETTINGS", "height", getHeight())
849
+
850
+ # Were showing hidden files
851
+ getApp().reg().writeIntEntry("SETTINGS", "showhiddenfiles", @dirlist.hiddenFilesShown? ? 1 : 0)
852
+
853
+ # Was tree shown?
854
+ getApp().reg().writeIntEntry("SETTINGS", "hidetree", @treebox.shown() ? 0 : 1)
855
+
856
+ # Width of tree
857
+ getApp().reg().writeIntEntry("SETTINGS", "treewidth", @treebox.getWidth())
858
+
859
+ # Wrap mode
860
+ getApp().reg().writeIntEntry("SETTINGS", "wordwrap", (@editor.textStyle & TEXT_WORDWRAP) != 0 ? 1 : 0)
861
+ getApp().reg().writeIntEntry("SETTINGS", "fixedwrap", (@editor.textStyle & TEXT_FIXEDWRAP) != 0 ? 1 : 0)
862
+ getApp().reg().writeIntEntry("SETTINGS", "wrapcols", @editor.getWrapColumns())
863
+
864
+ # Tab settings, autoindent
865
+ getApp().reg().writeIntEntry("SETTINGS", "autoindent", (@editor.textStyle & TEXT_AUTOINDENT) != 0 ? 1 : 0)
866
+ getApp().reg().writeIntEntry("SETTINGS", "hardtabs", (@editor.textStyle & TEXT_NO_TABS) == 0 ? 1 : 0)
867
+ getApp().reg().writeIntEntry("SETTINGS", "tabcols", @editor.getTabColumns())
868
+
869
+ # Strip returns
870
+ getApp().reg().writeIntEntry("SETTINGS", "stripreturn", @stripcr ? 1 : 0)
871
+ getApp().reg().writeIntEntry("SETTINGS", "stripspaces", @stripsp ? 1 : 0)
872
+
873
+ # File patterns
874
+ getApp().reg().writeIntEntry("SETTINGS", "filepatternno", getCurrentPattern())
875
+ patterns = getPatterns().join("\n")
876
+ getApp().reg().writeStringEntry("SETTINGS", "filepatterns", patterns)
877
+
878
+ # Search path
879
+ getApp().reg().writeStringEntry("SETTINGS", "searchpath", @searchpath)
880
+
881
+ # Font
882
+ fontdesc = @editor.getFont().getFontDesc()
883
+ fontspec = fxunparsefontdesc(fontdesc)
884
+ getApp().reg().writeStringEntry("SETTINGS", "font", fontspec)
885
+ end
886
+
887
+ # About box
888
+ def onCmdAbout(sender, sel, ptr)
889
+ about = FXMessageBox.new(self, "FOX Text Editor",
890
+ "The FOX Text Editor\n\nUsing FOX Library Version #{fxversion[0]}.#{fxversion[1]}.#{fxversion[2]}\n\nCopyright (C) 2000,2001 Jeroen van der Zijp (jvz@cfdrc.com)", @bigicon, MBOX_OK|DECOR_TITLE|DECOR_BORDER)
891
+ about.execute
892
+ return 1
893
+ end
894
+
895
+
896
+ # Change font
897
+ def onCmdFont(sender, sel, ptr)
898
+ fontdlg = FXFontDialog.new(self, "Change Font", DECOR_BORDER|DECOR_TITLE)
899
+ fontdesc = @editor.font.fontDesc
900
+ fontdlg.fontSelection = fontdesc
901
+ if fontdlg.execute() != 0
902
+ fontdesc = fontdlg.fontSelection
903
+ font = FXFont.new(getApp(), fontdesc)
904
+ font.create
905
+ @editor.font = font
906
+ @editor.update
907
+ end
908
+ return 1
909
+ end
910
+
911
+
912
+ # Save settings
913
+ def onCmdSaveSettings(sender, sel, ptr)
914
+ writeRegistry();
915
+ getApp().reg().write
916
+ return 1
917
+ end
918
+
919
+
920
+ # Toggle wrap mode
921
+ def onCmdWrap(sender, sel, ptr)
922
+ @editor.textStyle ^= TEXT_WORDWRAP
923
+ return 1
924
+ end
925
+
926
+
927
+ # Update toggle wrap mode
928
+ def onUpdWrap(sender, sel, ptr)
929
+ if (@editor.textStyle & TEXT_WORDWRAP) != 0
930
+ sender.handle(self, MKUINT(ID_CHECK, SEL_COMMAND), nil)
931
+ else
932
+ sender.handle(self, MKUINT(ID_UNCHECK, SEL_COMMAND), nil)
933
+ end
934
+ return 1
935
+ end
936
+
937
+
938
+ # Toggle fixed wrap mode
939
+ def onCmdWrapFixed(sender, sel, ptr)
940
+ @editor.textStyle ^= TEXT_FIXEDWRAP
941
+ return 1
942
+ end
943
+
944
+
945
+ # Update toggle fixed wrap mode
946
+ def onUpdWrapFixed(sender, sel, ptr)
947
+ if (@editor.textStyle & TEXT_FIXEDWRAP) != 0
948
+ sender.handle(self, MKUINT(ID_CHECK, SEL_COMMAND), nil)
949
+ else
950
+ sender.handle(self, MKUINT(ID_UNCHECK, SEL_COMMAND), nil)
951
+ end
952
+ return 1
953
+ end
954
+
955
+ # Toggle strip returns mode
956
+ def onCmdStripReturns(sender, sel, ptr)
957
+ @stripcr = !@stripcr
958
+ return 1
959
+ end
960
+
961
+
962
+ # Update toggle strip returns mode
963
+ def onUpdStripReturns(sender, sel, ptr)
964
+ if @stripcr
965
+ sender.handle(self, MKUINT(ID_CHECK, SEL_COMMAND), nil)
966
+ else
967
+ sender.handle(self, MKUINT(ID_UNCHECK, SEL_COMMAND), nil)
968
+ end
969
+ return 1
970
+ end
971
+
972
+
973
+ # Toggle strip spaces mode
974
+ def onCmdStripSpaces(sender, sel, ptr)
975
+ @stripsp = !@stripsp
976
+ return 1
977
+ end
978
+
979
+
980
+ # Update toggle strip spaces mode
981
+ def onUpdStripSpaces(sender, sel, ptr)
982
+ if @stripsp
983
+ sender.handle(self, MKUINT(ID_CHECK, SEL_COMMAND), nil)
984
+ else
985
+ sender.handle(self, MKUINT(ID_UNCHECK, SEL_COMMAND), nil)
986
+ end
987
+ return 1
988
+ end
989
+
990
+
991
+ # Reopen file
992
+ def onCmdReopen(sender, sel, ptr)
993
+ if !@undolist.marked?
994
+ if FXMessageBox.question(self, MBOX_YES_NO, "Document was changed",
995
+ "Discard changes to this document?") == MBOX_CLICKED_NO
996
+ return 1
997
+ end
998
+ end
999
+ loadFile(@filename)
1000
+ return 1
1001
+ end
1002
+
1003
+
1004
+ # Update reopen file
1005
+ def onUpdReopen(sender, sel, ptr)
1006
+ if @filenameset
1007
+ sender.handle(self, MKUINT(ID_ENABLE, SEL_COMMAND), nil)
1008
+ else
1009
+ sender.handle(self, MKUINT(ID_DISABLE, SEL_COMMAND), nil)
1010
+ end
1011
+ return 1
1012
+ end
1013
+
1014
+
1015
+ # Save changes, prompt for new filename
1016
+ def saveChanges
1017
+ if !@undolist.marked?
1018
+ answer = FXMessageBox.question(self, MBOX_YES_NO_CANCEL,
1019
+ "Unsaved Document", "Save current document to file?")
1020
+ return false if (answer == MBOX_CLICKED_CANCEL)
1021
+ if answer == MBOX_CLICKED_YES
1022
+ file = @filename
1023
+ if !@filenameset
1024
+ savedialog = FXFileDialog.new(self, "Save Document")
1025
+ savedialog.selectMode = SELECTFILE_ANY
1026
+ savedialog.patternList = getPatterns()
1027
+ savedialog.currentPattern = getCurrentPattern()
1028
+ savedialog.filename = file
1029
+ return false if (savedialog.execute == 0)
1030
+ setCurrentPattern(savedialog.currentPattern)
1031
+ file = savedialog.filename
1032
+ if File.exists?(file)
1033
+ if MBOX_CLICKED_NO == FXMessageBox.question(self, MBOX_YES_NO,
1034
+ "Overwrite Document", "Overwrite existing document: #{file}?")
1035
+ return false
1036
+ end
1037
+ end
1038
+ end
1039
+ file = savedialog.filename
1040
+ saveFile(file)
1041
+ end
1042
+ end
1043
+ true
1044
+ end
1045
+
1046
+
1047
+ # Open
1048
+ def onCmdOpen(sender, sel, ptr)
1049
+ return 1 if !saveChanges()
1050
+ opendialog = FXFileDialog.new(self, "Open Document")
1051
+ opendialog.selectMode = SELECTFILE_EXISTING
1052
+ opendialog.patternList = getPatterns()
1053
+ opendialog.currentPattern = getCurrentPattern()
1054
+ opendialog.filename = @filename
1055
+ if opendialog.execute != 0
1056
+ setCurrentPattern(opendialog.currentPattern)
1057
+ loadFile(opendialog.filename)
1058
+ end
1059
+ return 1
1060
+ end
1061
+
1062
+
1063
+ # Insert file into buffer
1064
+ def onCmdInsertFile(sender, sel, ptr)
1065
+ opendialog = FXFileDialog.new(self, "Open Document")
1066
+ opendialog.selectMode = SELECTFILE_EXISTING
1067
+ opendialog.patternList = getPatterns()
1068
+ opendialog.currentPattern = getCurrentPattern()
1069
+ if opendialog.execute != 0
1070
+ setCurrentPattern(opendialog.currentPattern)
1071
+ insertFile(opendialog.filename)
1072
+ end
1073
+ return 1
1074
+ end
1075
+
1076
+
1077
+ # Update insert file
1078
+ def onUpdInsertFile(sender, sel, ptr)
1079
+ if @editor.editable?
1080
+ sender.handle(self, MKUINT(ID_ENABLE, SEL_COMMAND), nil)
1081
+ else
1082
+ sender.handle(self, MKUINT(ID_DISABLE, SEL_COMMAND), nil)
1083
+ end
1084
+ return 1
1085
+ end
1086
+
1087
+
1088
+ # Extract selection to file
1089
+ def onCmdExtractFile(sender, sel, ptr)
1090
+ savedialog = FXFileDialog.new(self, "Save Document")
1091
+ file = "untitled"
1092
+ savedialog.selectMode = SELECTFILE_ANY
1093
+ savedialog.patternList = getPatterns()
1094
+ savedialog.currentPattern = getCurrentPattern()
1095
+ savedialog.filename = file
1096
+ if savedialog.execute != 0
1097
+ setCurrentPattern(savedialog.currentPattern)
1098
+ file = savedialog.filename
1099
+ if File.exists?(file)
1100
+ if MBOX_CLICKED_NO == FXMessageBox.question(self, MBOX_YES_NO,
1101
+ "Overwrite Document", "Overwrite existing document: #{file}?")
1102
+ return 1
1103
+ end
1104
+ end
1105
+ extractFile(file)
1106
+ end
1107
+ return 1
1108
+ end
1109
+
1110
+
1111
+ # Update extract file
1112
+ def onUpdExtractFile(sender, sel, ptr)
1113
+ if @editor.hasSelection()
1114
+ sender.handle(self, MKUINT(ID_ENABLE, SEL_COMMAND), nil)
1115
+ else
1116
+ sender.handle(self, MKUINT(ID_DISABLE, SEL_COMMAND), nil)
1117
+ end
1118
+ return 1
1119
+ end
1120
+
1121
+
1122
+ # Open Selected
1123
+ def onCmdOpenSelected(sender, sel, ptr)
1124
+ string = getDNDData(FROM_SELECTION, stringType)
1125
+ return 1 if !string
1126
+
1127
+ if string.length < 1024
1128
+ # Where to look for this file?
1129
+ if @filename.empty?
1130
+ dir = Dir.getwd
1131
+ else
1132
+ dir = File.dirname(@filename) unless @filename.empty?
1133
+ end
1134
+
1135
+ # Strip leading and trailing spaces
1136
+ string.strip!
1137
+
1138
+ # Attempt to extract the file name from various forms
1139
+ if string =~ /#include \".*\"/
1140
+ file = File.expand_path(name, dir)
1141
+ if !File.exists?(file)
1142
+ Find.find(@searchpath) { |f| file = f if (f == name) }
1143
+ end
1144
+ elsif string =~ /#include <.*>/
1145
+ file = File.expand_path(name, dir)
1146
+ if !File.exists?(file)
1147
+ Find.find(@searchpath) { |f| file = f if (f == name) }
1148
+ end
1149
+ elsif string =~ /.*:.*:.*/
1150
+ file = File.expand_path(name, dir)
1151
+ if !File.exists?(file)
1152
+ Find.find(@searchpath) { |f| file = f if (f == name) }
1153
+ end
1154
+ else
1155
+ file = File.expand_path(string, dir)
1156
+ end
1157
+
1158
+ if File.exists?(file)
1159
+ # Different from current file?
1160
+ if file != @filename
1161
+ # Save old file first
1162
+ return 1 if !saveChanges()
1163
+
1164
+ # Open the new file
1165
+ loadFile(file)
1166
+ end
1167
+
1168
+ # Switch line number only
1169
+ if lineno != 0
1170
+ pos = @editor.nextLine(0, lineno - 1)
1171
+ @editor.cursorPos = pos
1172
+ @editor.centerLine = pos
1173
+ end
1174
+ return 1
1175
+ end
1176
+ else
1177
+ getApp().beep # string is too long to be a file name
1178
+ end
1179
+ return 1
1180
+ end
1181
+
1182
+
1183
+ # Open recent file
1184
+ def onCmdRecentFile(sender, sel, filename)
1185
+ return 1 if !saveChanges()
1186
+ loadFile(filename)
1187
+ return 1
1188
+ end
1189
+
1190
+
1191
+ # Save
1192
+ def onCmdSave(sender, sel, ptr)
1193
+ if !@filenameset
1194
+ return onCmdSaveAs(sender, sel, ptr)
1195
+ end
1196
+ saveFile(@filename)
1197
+ return 1
1198
+ end
1199
+
1200
+
1201
+ # Save Update
1202
+ def onUpdSave(sender, sel, ptr)
1203
+ msg = (!@undolist.marked?) ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE
1204
+ sender.handle(self, MKUINT(msg, SEL_COMMAND), nil)
1205
+ return 1
1206
+ end
1207
+
1208
+
1209
+ # Save As
1210
+ def onCmdSaveAs(sender, sel, ptr)
1211
+ savedialog = FXFileDialog.new(self, "Save Document")
1212
+ file = @filename
1213
+ savedialog.selectMode = SELECTFILE_ANY
1214
+ savedialog.patternList = getPatterns()
1215
+ savedialog.currentPattern = getCurrentPattern()
1216
+ savedialog.filename = file
1217
+ if savedialog.execute != 0
1218
+ setCurrentPattern(savedialog.currentPattern)
1219
+ file = savedialog.filename
1220
+ if File.exists?(file)
1221
+ if MBOX_CLICKED_NO == FXMessageBox.question(self, MBOX_YES_NO,
1222
+ "Overwrite Document", "Overwrite existing document: #{file}?")
1223
+ return 1
1224
+ end
1225
+ end
1226
+ saveFile(file)
1227
+ end
1228
+ return 1
1229
+ end
1230
+
1231
+
1232
+ # New
1233
+ def onCmdNew(sender, sel, ptr)
1234
+ return 1 if !saveChanges()
1235
+ @filename = "untitled"
1236
+ @filetime = nil
1237
+ @filenameset = false
1238
+ @editor.text = nil
1239
+ @editor.modified = false
1240
+ @editor.editable = true
1241
+ @undolist.clear
1242
+ @undolist.mark
1243
+ return 1
1244
+ end
1245
+
1246
+
1247
+ # Quit
1248
+ def onCmdQuit(sender, sel, ptr)
1249
+ return 1 if !saveChanges()
1250
+ writeRegistry()
1251
+ getApp().exit(0)
1252
+ return 1
1253
+ end
1254
+
1255
+
1256
+ # Update title
1257
+ def onUpdTitle(sender, sel, ptr)
1258
+ title = "FOX Text Editor:- " + @filename
1259
+ title += "*" if !@undolist.marked?
1260
+ sender.handle(self, MKUINT(FXWindow::ID_SETSTRINGVALUE, SEL_COMMAND), title)
1261
+ return 1
1262
+ end
1263
+
1264
+
1265
+ # Print the text
1266
+ def onCmdPrint(sender, sel, ptr)
1267
+ dlg = FXPrintDialog.new(self, "Print File")
1268
+ if dlg.execute != 0
1269
+ printer = dlg.printer
1270
+ end
1271
+ return 1
1272
+ end
1273
+
1274
+
1275
+ # Command from the tree list
1276
+ def onCmdTreeList(sender, sel, item)
1277
+ if !item || !@dirlist.isItemFile(item)
1278
+ return 1
1279
+ end
1280
+ if !saveChanges()
1281
+ return 1
1282
+ end
1283
+ file = @dirlist.getItemPathname(item)
1284
+ loadFile(file)
1285
+ return 1
1286
+ end
1287
+
1288
+
1289
+ # See if we can get it as a filename
1290
+ def onEditDNDDrop(sender, sel, ptr)
1291
+ urilist = getDNDData(FROM_DRAGNDROP, FXWindow.urilistType)
1292
+ if urilist
1293
+ file = FXURL.fileFromURL(urilist.before('\r'))
1294
+ return 1 if (file == "")
1295
+ return 1 if !saveChanges()
1296
+ loadFile(file)
1297
+ return 1
1298
+ end
1299
+ return 0
1300
+ end
1301
+
1302
+
1303
+ # See if a filename is being dragged over the window
1304
+ def onEditDNDMotion(sender, sel, ptr)
1305
+ if offeredDNDType(FROM_DRAGNDROP, FXWindow.urilistType)
1306
+ acceptDrop(DRAG_COPY)
1307
+ return 1
1308
+ end
1309
+ return 0
1310
+ end
1311
+
1312
+
1313
+ # Change both text background color
1314
+ def onCmdTextBackColor(sender, sel, color)
1315
+ @editor.backColor = color
1316
+ return 1
1317
+ end
1318
+
1319
+
1320
+ # Update background color
1321
+ def onUpdTextBackColor(sender, sel, ptr)
1322
+ sender.handle(self, MKUINT(ID_SETINTVALUE, SEL_COMMAND), @editor.backColor)
1323
+ return 1
1324
+ end
1325
+
1326
+
1327
+ # Change both text selected background color
1328
+ def onCmdTextSelBackColor(sender, sel, color)
1329
+ @editor.selBackColor = color
1330
+ return 1
1331
+ end
1332
+
1333
+
1334
+ # Update selected background color
1335
+ def onUpdTextSelBackColor(sender, sel, ptr)
1336
+ sender.handle(self, MKUINT(ID_SETINTVALUE, SEL_COMMAND), @editor.selBackColor)
1337
+ return 1
1338
+ end
1339
+
1340
+
1341
+ # Change both text and tree text color
1342
+ def onCmdTextForeColor(sender, sel, color)
1343
+ @editor.textColor = color
1344
+ return 1
1345
+ end
1346
+
1347
+
1348
+ # Forward GUI update to text widget
1349
+ def onUpdTextForeColor(sender, sel, ptr)
1350
+ sender.handle(self, MKUINT(ID_SETINTVALUE, SEL_COMMAND), @editor.textColor)
1351
+ return 1
1352
+ end
1353
+
1354
+
1355
+ # Change both text and tree text color
1356
+ def onCmdTextSelForeColor(sender, sel, color)
1357
+ @editor.selTextColor = color
1358
+ return 1
1359
+ end
1360
+
1361
+
1362
+ # Forward GUI update to text widget
1363
+ def onUpdTextSelForeColor(sender, sel, ptr)
1364
+ sender.handle(self, MKUINT(ID_SETINTVALUE, SEL_COMMAND), @editor.selTextColor)
1365
+ return 1
1366
+ end
1367
+
1368
+
1369
+ # Change cursor color
1370
+ def onCmdTextCursorColor(sender, sel, color)
1371
+ @editor.cursorColor = color
1372
+ return 1
1373
+ end
1374
+
1375
+
1376
+ # Update cursor color
1377
+ def onUpdTextCursorColor(sender, sel, ptr)
1378
+ sender.handle(self, MKUINT(FXWindow::ID_SETINTVALUE, SEL_COMMAND), @editor.cursorColor)
1379
+ return 1
1380
+ end
1381
+
1382
+
1383
+ # Change both tree background color
1384
+ def onCmdDirBackColor(sender, sel, color)
1385
+ @dirlist.backColor = color
1386
+ return 1
1387
+ end
1388
+
1389
+
1390
+ # Update background color
1391
+ def onUpdDirBackColor(sender, sel, ptr)
1392
+ sender.handle(self, MKUINT(ID_SETINTVALUE, SEL_COMMAND), @dirlist.backColor)
1393
+ return 1
1394
+ end
1395
+
1396
+
1397
+ # Change both text and tree selected background color
1398
+ def onCmdDirSelBackColor(sender, sel, color)
1399
+ @dirlist.selBackColor = color
1400
+ return 1
1401
+ end
1402
+
1403
+
1404
+ # Update selected background color
1405
+ def onUpdDirSelBackColor(sender, sel, ptr)
1406
+ sender.handle(self, MKUINT(ID_SETINTVALUE, SEL_COMMAND), @dirlist.selBackColor)
1407
+ return 1
1408
+ end
1409
+
1410
+
1411
+ # Change both text and tree text color
1412
+ def onCmdDirForeColor(sender, sel, color)
1413
+ @dirlist.textColor = color
1414
+ return 1
1415
+ end
1416
+
1417
+
1418
+ # Forward GUI update to text widget
1419
+ def onUpdDirForeColor(sender, sel, ptr)
1420
+ sender.handle(self, MKUINT(ID_SETINTVALUE, SEL_COMMAND), @dirlist.textColor)
1421
+ return 1
1422
+ end
1423
+
1424
+
1425
+ # Change both text and tree
1426
+ def onCmdDirSelForeColor(sender, sel, color)
1427
+ @dirlist.selTextColor = color
1428
+ return 1
1429
+ end
1430
+
1431
+
1432
+ # Forward GUI update to text widget
1433
+ def onUpdDirSelForeColor(sender, sel, ptr)
1434
+ sender.handle(sender, MKUINT(FXWindow::ID_SETINTVALUE, SEL_COMMAND), @dirlist.selTextColor)
1435
+ return 1
1436
+ end
1437
+
1438
+
1439
+ # Change both text and tree
1440
+ def onCmdDirLineColor(sender, sel, color)
1441
+ @dirlist.lineColor = color
1442
+ return 1
1443
+ end
1444
+
1445
+
1446
+ # Forward GUI update to text widget
1447
+ def onUpdDirLineColor(sender, sel, ptr)
1448
+ sender.handle(sender, MKUINT(FXWindow::ID_SETINTVALUE, SEL_COMMAND), @dirlist.lineColor)
1449
+ return 1
1450
+ end
1451
+
1452
+
1453
+ # Text inserted
1454
+ def onTextInserted(sender, sel, what)
1455
+ @undolist.add(FXTextInsert.new(@editor, what[0], what[1]))
1456
+
1457
+ # Keep the undo list in check by trimming it down to KEEPUNDOSIZE
1458
+ # whenever the amount of undo buffering exceeds MAXUNDOSIZE.
1459
+ @undolist.trimSize(KEEPUNDOSIZE) if (@undolist.undoSize() > MAXUNDOSIZE)
1460
+ return 1
1461
+ end
1462
+
1463
+
1464
+ # Text deleted
1465
+ def onTextDeleted(sender, sel, what)
1466
+ @undolist.add(FXTextDelete.new(@editor, what[0], what[1]))
1467
+
1468
+ # Keep the undo list in check by trimming it down to KEEPUNDOSIZE
1469
+ # whenever the amount of undo buffering exceeds MAXUNDOSIZE.
1470
+ @undolist.trimSize(KEEPUNDOSIZE) if (@undolist.undoSize() > MAXUNDOSIZE)
1471
+ return 1
1472
+ end
1473
+
1474
+
1475
+ # Text replaced
1476
+ def onTextReplaced(sender, sel, ptr)
1477
+ @undolist.add(FXTextReplace.new(@editor, what[0], what[1], what[2]))
1478
+
1479
+ # Keep the undo list in check by trimming it down to KEEPUNDOSIZE
1480
+ # whenever the amount of undo buffering exceeds MAXUNDOSIZE.
1481
+ @undolist.trimSize(KEEPUNDOSIZE) if (@undolist.undoSize() > MAXUNDOSIZE)
1482
+ return 1
1483
+ end
1484
+
1485
+
1486
+ # Released right button
1487
+ def onTextRightMouse(sender, sel, event)
1488
+ if !event.moved
1489
+ pane = FXMenuPane.new(self)
1490
+ FXMenuCommand.new(pane, "Undo", @undoicon, @undolist, FXUndoList::ID_UNDO)
1491
+ FXMenuCommand.new(pane, "Redo", @redoicon, @undolist, FXUndoList::ID_REDO)
1492
+ FXMenuSeparator.new(pane)
1493
+ FXMenuCommand.new(pane, "Cut", @cuticon, @editor, FXText::ID_CUT_SEL)
1494
+ FXMenuCommand.new(pane, "Copy", @copyicon, @editor, FXText::ID_COPY_SEL)
1495
+ FXMenuCommand.new(pane, "Paste", @pasteicon, @editor, FXText::ID_PASTE_SEL)
1496
+ FXMenuCommand.new(pane, "Select All", nil, @editor, FXText::ID_SELECT_ALL)
1497
+ pane.create
1498
+ pane.popup(nil, event.root_x, event.root_y)
1499
+ getApp().runModalWhileShown(pane)
1500
+ end
1501
+ return 1
1502
+ end
1503
+
1504
+
1505
+ # Set TextWindow path
1506
+ def onCmdIncludePaths(sender, sel, ptr)
1507
+ searchpath = FXInputDialog::getString(@searchpath, self,
1508
+ "Change include file search path",
1509
+ "Specify a list of directories separated by a `#{File::PATH_SEPARATOR}'" +
1510
+ " where include files are to be found.\nFor example:\n\n" +
1511
+ " /usr/include#{File::PATH_SEPARATOR}/usr/local/include\n\n" +
1512
+ "This list will be used to locate the selected file name.")
1513
+ @searchpath = searchpath if searchpath != nil
1514
+ return 1
1515
+ end
1516
+
1517
+
1518
+ # Change patterns
1519
+ def setPatterns(patterns)
1520
+ @filter.clearItems
1521
+ patterns.each { |pat| @filter.appendItem(pat) }
1522
+ if @filter.numItems == 0
1523
+ @filter.appendItem("All Files (*)")
1524
+ end
1525
+ setCurrentPattern(0)
1526
+ end
1527
+
1528
+
1529
+ # Return array of pattern strings
1530
+ def getPatterns()
1531
+ patterns = []
1532
+ @filter.each { |itemText, itemData| patterns.push(itemText) }
1533
+ patterns
1534
+ end
1535
+
1536
+
1537
+ # Strip pattern from text if present
1538
+ def patternFromText(pattern)
1539
+ if pattern =~ /\(.*\)/
1540
+ $&[1..2]
1541
+ else
1542
+ pattern
1543
+ end
1544
+ end
1545
+
1546
+
1547
+ # Set current pattern
1548
+ def setCurrentPattern(n)
1549
+ n = [[0, n].max, @filter.getNumItems() - 1].min
1550
+ @filter.currentItem = n
1551
+ @dirlist.pattern = patternFromText(@filter.getItemText(n))
1552
+ end
1553
+
1554
+
1555
+ # Return current pattern
1556
+ def getCurrentPattern()
1557
+ @filter.currentItem
1558
+ end
1559
+
1560
+
1561
+ # Change the pattern
1562
+ def onCmdFilter(sender, sel, ptr)
1563
+ @dirlist.pattern = patternFromText(ptr)
1564
+ return 1
1565
+ end
1566
+
1567
+
1568
+ # Show help window
1569
+ def onCmdShowHelp(sender, sel, ptr)
1570
+ @helpwindow.show(PLACEMENT_CURSOR)
1571
+ return 1
1572
+ end
1573
+
1574
+
1575
+ # Show preferences dialog
1576
+ def onCmdPreferences(sender, sel, ptr)
1577
+ preferences = PrefDialog.new(self)
1578
+ preferences.setPatterns(getPatterns())
1579
+ if preferences.execute != 0
1580
+ setPatterns(preferences.getPatterns())
1581
+ end
1582
+ return 1
1583
+ end
1584
+
1585
+
1586
+ # Change tab columns
1587
+ def onCmdTabColumns(sender, sel, ptr)
1588
+ @editor.tabColumns = sender.text.to_i # sender is an FXTextField
1589
+ return 1
1590
+ end
1591
+
1592
+
1593
+ # Update tab columns
1594
+ def onUpdTabColumns(sender, sel, ptr)
1595
+ sender.handle(self, MKUINT(ID_SETINTVALUE, SEL_COMMAND), @editor.tabColumns)
1596
+ return 1
1597
+ end
1598
+
1599
+
1600
+ # Change wrap columns
1601
+ def onCmdWrapColumns(sender, sel, ptr)
1602
+ @editor.wrapColumns sender.text.to_i # sender is an FXTextField
1603
+ return 1
1604
+ end
1605
+
1606
+
1607
+ # Update wrap columns
1608
+ def onUpdWrapColumns(sender, sel, ptr)
1609
+ sender.handle(self, MKUINT(ID_SETINTVALUE, SEL_COMMAND), @editor.wrapColumns)
1610
+ return 1
1611
+ end
1612
+
1613
+
1614
+ # Toggle insertion of tabs
1615
+ def onCmdInsertTabs(sender, sel, ptr)
1616
+ @editor.textStyle ^= TEXT_NO_TABS
1617
+ return 1
1618
+ end
1619
+
1620
+
1621
+ # Update insertion of tabs
1622
+ def onUpdInsertTabs(sender, sel, ptr)
1623
+ sender.handle(self, ((@editor.textStyle & TEXT_NO_TABS) != 0) ?
1624
+ MKUINT(ID_UNCHECK, SEL_COMMAND) : MKUINT(ID_CHECK, SEL_COMMAND), nil)
1625
+ return 1
1626
+ end
1627
+
1628
+
1629
+ # Toggle autoindent
1630
+ def onCmdAutoIndent(sender, sel, ptr)
1631
+ @editor.textStyle ^= TEXT_AUTOINDENT
1632
+ return 1
1633
+ end
1634
+
1635
+
1636
+ # Update autoindent
1637
+ def onUpdAutoIndent(sender, sel, ptr)
1638
+ sender.handle(self, ((@editor.textStyle & TEXT_AUTOINDENT) != 0) ?
1639
+ MKUINT(ID_CHECK, SEL_COMMAND) : MKUINT(ID_UNCHECK, SEL_COMMAND), nil)
1640
+ return 1
1641
+ end
1642
+
1643
+
1644
+ # Set brace match time
1645
+ def onCmdBraceMatch(sender, sel, ptr)
1646
+ @editor.hiliteMatchTime = sender.text.to_i # sender is an FXTextField
1647
+ return 1
1648
+ end
1649
+
1650
+
1651
+ # Update brace match time
1652
+ def onUpdBraceMatch(sender, sel, ptr)
1653
+ sender.handle(self, MKUINT(ID_SETINTVALUE, SEL_COMMAND), @editor.hiliteMatchTime)
1654
+ return 1
1655
+ end
1656
+
1657
+
1658
+ # Change word delimiters
1659
+ def onCmdDelimiters(sender, sel, ptr)
1660
+ @editor.delimiters = sender.text # sender is an FXTextField
1661
+ return 1
1662
+ end
1663
+
1664
+
1665
+ # Update word delimiters
1666
+ def onUpdDelimiters(sender, sel, ptr)
1667
+ sender.handle(self, MKUINT(ID_SETSTRINGVALUE, SEL_COMMAND), @editor.delimiters)
1668
+ return 1
1669
+ end
1670
+
1671
+
1672
+ # Update box for overstrike mode display
1673
+ def onUpdOverstrike(sender, sel, ptr)
1674
+ mode = ((@editor.textStyle & TEXT_OVERSTRIKE) != 0) ? "OVR" : "INS"
1675
+ sender.handle(self, MKUINT(ID_SETSTRINGVALUE, SEL_COMMAND), mode)
1676
+ return 1
1677
+ end
1678
+
1679
+
1680
+ # Update box for readonly display
1681
+ def onUpdReadOnly(sender, sel, ptr)
1682
+ rw = ((@editor.textStyle & TEXT_READONLY) != 0) ? "RO" : "RW"
1683
+ sender.handle(self, MKUINT(ID_SETSTRINGVALUE, SEL_COMMAND), rw)
1684
+ return 1
1685
+ end
1686
+
1687
+
1688
+ # Update box for size display
1689
+ def onUpdNumChars(sender, sel, ptr)
1690
+ sender.handle(self, MKUINT(ID_SETINTVALUE, SEL_COMMAND), @editor.length)
1691
+ return 1
1692
+ end
1693
+
1694
+
1695
+ # Update box for readonly display
1696
+ def onCheckFile(sender, sel, ptr)
1697
+ mtime = File.exists?(@filename) ? File.mtime(@filename) : nil
1698
+ if @filetime && mtime && mtime != @filetime
1699
+ @filetime = mtime
1700
+ if MBOX_CLICKED_OK == FXMessageBox.warning(self, MBOX_OK_CANCEL,
1701
+ "File Was Changed",
1702
+ "The file was changed by another program\nReload this file from disk?")
1703
+ loadFile(@filename)
1704
+ end
1705
+ end
1706
+ @timer = getApp().addTimeout(1000, self, ID_FILETIME)
1707
+ return 1
1708
+ end
1709
+
1710
+
1711
+ # Set scroll wheel lines
1712
+ def onCmdWheelAdjust(sender, sel, ptr)
1713
+ getApp().wheelLines = sender.value # sender is an FXSpinner
1714
+ return 1;
1715
+ end
1716
+
1717
+
1718
+ # Update wheel adjustment time
1719
+ def onUpdWheelAdjust(sender, sel, ptr)
1720
+ sender.handle(self, MKUINT(ID_SETINTVALUE, SEL_COMMAND), getApp().wheelLines)
1721
+ return 1
1722
+ end
1723
+
1724
+
1725
+ # Start the ball rolling
1726
+ def start(args)
1727
+ if args.length > 0
1728
+ loadFile(File.expand_path(args[1]))
1729
+ end
1730
+ end
1731
+
1732
+
1733
+ # Create and show window
1734
+ def create
1735
+ @urilistType = getApp().registerDragType(FXWindow.urilistTypeName) unless @urilistType
1736
+ readRegistry
1737
+ super
1738
+ show
1739
+ @timer = getApp().addTimeout(1000, self, ID_FILETIME)
1740
+ end
1741
+ end
1742
+
1743
+
1744
+ # Start the whole thing
1745
+ if __FILE__ == $0
1746
+ # Make application
1747
+ application = FXApp.new("TextEdit", "FoxTest")
1748
+ application.threadsEnabled = false
1749
+
1750
+ # Open display
1751
+ application.init(ARGV)
1752
+
1753
+ # Make window
1754
+ window = TextWindow.new(application)
1755
+
1756
+ # Handle interrupt to save stuff nicely
1757
+ application.addSignal("SIGINT", window, TextWindow::ID_QUIT)
1758
+
1759
+ # Create it
1760
+ application.create
1761
+
1762
+ # Start
1763
+ window.start(ARGV)
1764
+
1765
+ # Run
1766
+ application.run
1767
+ end