edit.tcl 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. ###########################################################
  2. # Name: edit.tcl
  3. # Author: Daniele Bonini (posta@elettronica.lol)
  4. # Date: 27/11/2023
  5. # Desc: Edit Menu namespace of RadXIDE.
  6. #
  7. # Edit Menu namespace scaffolding and most of code
  8. # here presented and distributed contain excerpts
  9. # from [alited](https://github.com/aplsimple/alited
  10. # by Alex Plotnikov and contributors to the project.
  11. # The original code of these excerpts could be
  12. # borrowed from other sources which the author
  13. # and the contributors to this RadXIDE have no
  14. # knowledge about.
  15. #
  16. # License: MIT. Copyrights 5 Mode (Last implementation and adaptations.)
  17. # Copyright (c) 2021-2023 Alex Plotnikov https://aplsimple.github.io (original scaffolding and excerpts.)
  18. #
  19. ###########################################################
  20. namespace eval edit {
  21. # ________________________ find _________________________ #
  22. proc find {win} {
  23. # Open the Find window to start a text search
  24. namespace upvar ::radxide dan dan project project
  25. set t $dan(TEXT)
  26. set args {}
  27. if {$project(CUR_FILE_PATH) ne {}} {
  28. #tk_textCopy $t
  29. #catch {clipboard get} clipcontent
  30. #set sel $clipcontent
  31. set sel [::radxide::win::InitFindInText 0 $t]
  32. #tk_messageBox -title $dan(TITLE) -icon info -message $sel
  33. set args "-buttons {butSearch SEARCH ::radxide::win::findTextOK butCANCEL CANCEL ::radxide::win::findTextCancel}"
  34. catch {lassign [::radxide::win::input "Find" {} "Find text" [list \
  35. ent "{} {} {-w 64}" "{$sel}"] \
  36. -head "Serach for:" {*}$args] res}
  37. }
  38. }
  39. # ________________________ makeCopy _________________________ #
  40. proc makeCopy {win} {
  41. # Copy from the textPane to the clipboard
  42. #clipboard clear
  43. #clipboard append $txt
  44. tk_textCopy $win
  45. }
  46. #_________________________ makeCut ________________________ #
  47. proc makeCut {win} {
  48. # Cut from the textPane to the clipboard
  49. #set canvas %W
  50. #eval [clipboard get -type TkCanvasItem]
  51. tk_textCut $win
  52. }
  53. #_________________________ makePaste ________________________ #
  54. proc makePaste {win} {
  55. # Paste from the clipboard to the textPane
  56. #set canvas %W
  57. #eval [clipboard get -type TkCanvasItem]
  58. tk_textPaste $win
  59. }
  60. #_________________________ setup ________________________ #
  61. proc setup {} {
  62. # Open the Options window
  63. namespace upvar ::radxide dan dan
  64. tk_messageBox -title $dan(TITLE) -icon info -message "Setup!"
  65. }
  66. #_______________________
  67. }
  68. # _________________________________ EOF _________________________________ #