menu.tcl 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 the code
  8. # here presented and distributed contains 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 } -accelerator Ctrl+C -state disabled
  57. $m2 add command -label Paste -command { ::radxide::menu::edit::makePaste } -accelerator Ctrl+P -state disabled
  58. $m2 add command -label Cut -command { ::radxide::menu::edit::makeCut } -accelerator Ctrl+X -state disabled
  59. $m2 add separator
  60. $m2 add command -label Find -command { ::radxide::menu::edit::find } -accelerator Ctrl+F -state disabled
  61. $m2 add command -label "Go to Line" -command { ::radxide::menu::edit::GotoLine } -accelerator Ctrl+G -state disabled
  62. $m2 add separator
  63. $m2 add command -label Options -command { ::radxide::menu::edit::setup }
  64. set m3 [menu $m.help -tearoff 0]
  65. $m3 add command -label About -command { tk_messageBox -title $dan(TITLE) -icon info -message "\n\nRADXIDE ver 1.1.5\n\n\nMIT Licence.\n\n\nCopyright (c) 5 Mode\n\nThe software is provided AS-IS.\n\nAuthors:\n2023-2024 RADXIDE, Daniele Bonini\n2021-2023 Alited, Alex Plotnikov\n\nhttps://5mode.com\n\n\n"}
  66. return $m
  67. }
  68. # ________________________ defMUShortcuts _________________________ #
  69. proc defWinShortcuts {ctrl canvas} {
  70. namespace upvar ::radxide dan dan
  71. bind $ctrl "<Control-n>" { ::radxide::menu::file::newProject }
  72. bind $ctrl "<Control-o>" { ::radxide::menu::file::openProject }
  73. bind $ctrl "<Control-Alt-x>" { ::radxide::menu::file::closeProject }
  74. bind $ctrl "<Control-q>" { ::radxide::menu::file::quit }
  75. bind $ctrl "<Control-c>" "::radxide::menu::edit::makeCopy"
  76. bind $ctrl "<Control-p>" "::radxide::menu::edit::makePaste"
  77. bind $ctrl "<Control-x>" "::radxide::menu::edit::makeCut"
  78. bind $ctrl "<Control-f>" "::radxide::menu::edit::find"
  79. bind $ctrl "<Control-g>" "::radxide::menu::edit::GotoLine"
  80. }
  81. #_______________________
  82. source [file join . file.tcl]
  83. source [file join . edit.tcl]
  84. }
  85. # _________________________________ EOF _________________________________ #