fxruby 1.6.15-x86-mswin32-60

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