menu.tcl 4.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. ###########################################################
  2. # Name: menu.tcl
  3. # Author: Daniele Bonini (posta@elettronica.lol)
  4. # Date: 27/11/2023
  5. # Desc: Menu namespace of RadXIDE.
  6. #
  7. # Menu namespace 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 menu {
  21. # ________________________ MenuScaf _________________________ #
  22. proc menuScaf {} {
  23. namespace upvar ::radxide dan dan menu menu
  24. set aboutTEXT ""
  25. #set aboutTEXT "MIT Licence.\n\n\n"
  26. #set aboutTEXT "${aboutTEXT}Copyrights 5 Mode\n\n"
  27. #set aboutTEXT "${aboutTEXT}http://5mode.com\n\n\n"
  28. #set aboutTEXT "${aboutTEXT}Most of code here presented and distributed contain excerpts"
  29. #set aboutTEXT "${aboutTEXT}from Alited (https://github.com/aplsimple/alited"
  30. #set aboutTEXT "${aboutTEXT}by Alex Plotnikov and contributors to the project."
  31. #set aboutTEXT "${aboutTEXT}The original code of these excerpts could be"
  32. #set aboutTEXT "${aboutTEXT}borrowed from other sources which the author"
  33. #set aboutTEXT "${aboutTEXT}and the contributors to this RadXIDE have no"
  34. #set aboutTEXT "${aboutTEXT}knowledge about.\n\n\n"
  35. #set aboutTEXT "${aboutTEXT}For other rights and copyright see each file header."
  36. # menu
  37. set menu(ROOT) [set m [menu .mb]]
  38. $m add cascade -label File -menu $m.file
  39. set m1 [menu $m.file -tearoff 0]
  40. set menu(FILE) $m1
  41. $m1 add command -label "New project" -command { ::radxide::menu::file::newProject } -accelerator Ctrl+N
  42. $m1 add command -label "Open project" -command { ::radxide::menu::file::openProject } -accelerator Ctrl+O
  43. $m1 add command -label "Add file" -command { ::radxide::menu::file::addFile } -accelerator Ctrl+Shift+N -state disabled
  44. $m1 add separator
  45. $m1 add command -label "Save as.." -command { ::radxide::menu::file::saveFileAs } -accelerator Ctrl+Shift+S -state disabled
  46. $m1 add command -label "Save" -command { ::radxide::menu::file::saveFile } -accelerator Ctrl-S -state disabled
  47. $m1 add separator
  48. $m1 add command -label "Close" -command { ::radxide::menu::file::closeFile } -accelerator Ctrl+Shift+X -state disabled
  49. $m1 add command -label "Close project" -command { ::radxide::menu::file::closeProject } -accelerator Ctrl+Alt+X -state disabled
  50. $m1 add separator
  51. $m1 add command -label Exit -command { ::radxide::menu::file::quit } -accelerator Ctrl+Q
  52. $m add cascade -label Edit -menu $m.edit
  53. set m2 [menu $m.edit -tearoff 0]
  54. set menu(EDIT) $m2
  55. $m add cascade -label Help -menu $m.help
  56. $m2 add command -label Copy -command { ::radxide::menu::edit::makeCopy .danwin.fra.text } -accelerator Ctrl+C -state disabled
  57. $m2 add command -label Paste -command { ::radxide::menu::edit::makePaste .danwin.fra.text } -accelerator Ctrl+P -state disabled
  58. $m2 add command -label Cut -command { ::radxide::menu::edit::makeCut .danwin.fra.text } -accelerator Ctrl+X -state disabled
  59. $m2 add separator
  60. $m2 add command -label Find -command { ::radxide::menu::edit::find .danwin.fra.text } -accelerator Ctrl+F -state disabled
  61. $m2 add separator
  62. $m2 add command -label Options -command { ::radxide::menu::edit::setup }
  63. set m3 [menu $m.help -tearoff 0]
  64. $m3 add command -label About -command { tk_messageBox -title $dan(TITLE) -icon info -message "\n\nRADXIDE ver 1.0.5\n\n\nMIT Licence.\n\n\nCopyrights (c) 2023-2024 5 Mode http://5mode.com\n\nThe software is provided AS-IS.\n\nA great 'Thank you' to Alex Plotnikov and his Alited (copyrights notice are included in the single files of RADXIDE!)\n\n\n"}
  65. return $m
  66. }
  67. # ________________________ defMUShortcuts _________________________ #
  68. proc defWinShortcuts {ctrl canvas} {
  69. namespace upvar ::radxide dan dan
  70. bind $ctrl "<Control-n>" { ::radxide::menu::file::newProject }
  71. bind $ctrl "<Control-o>" { ::radxide::menu::file::openProject }
  72. bind $ctrl "<Control-Alt-x>" { ::radxide::menu::file::closeProject }
  73. bind $ctrl "<Control-q>" { ::radxide::menu::file::quit }
  74. bind $ctrl "<Control-c>" "::radxide::menu::edit::makeCopy $ctrl"
  75. bind $ctrl "<Control-p>" "::radxide::menu::edit::makePaste $ctrl"
  76. bind $ctrl "<Control-x>" "::radxide::menu::edit::makeCut $ctrl"
  77. bind $ctrl "<Control-f>" "::radxide::menu::edit::find $ctrl"
  78. }
  79. #_______________________
  80. source [file join . file.tcl]
  81. source [file join . edit.tcl]
  82. }
  83. # _________________________________ EOF _________________________________ #