2022-07-21 10:56:46 +03:00
|
|
|
#!/usr/bin/wish
|
|
|
|
######################################################
|
|
|
|
# ProjMan 2
|
2018-02-17 20:25:02 +03:00
|
|
|
# Distributed under GNU Public License
|
2022-07-21 10:56:46 +03:00
|
|
|
# Author: Sergey Kalinin svk@nuk-svk.ru
|
|
|
|
# Copyright (c) "", 2022, https://nuk-svk.ru
|
2018-02-17 20:25:02 +03:00
|
|
|
######################################################
|
2022-07-21 10:56:46 +03:00
|
|
|
# Generate menu module
|
2018-02-17 20:25:02 +03:00
|
|
|
######################################################
|
|
|
|
|
2022-07-21 10:56:46 +03:00
|
|
|
proc GetFileMenu {m} {
|
2022-09-15 16:51:11 +03:00
|
|
|
global activeProject
|
2022-07-21 10:56:46 +03:00
|
|
|
$m add command -label [::msgcat::mc "New file"] -command Editor::New\
|
|
|
|
-accelerator "Ctrl+N"
|
|
|
|
$m add command -label [::msgcat::mc "Open file"] -accelerator "Ctrl+O" -command {
|
|
|
|
set filePath [FileOper::OpenDialog]
|
|
|
|
if {$filePath != ""} {
|
|
|
|
FileOper::Edit $filePath
|
2018-02-17 20:25:02 +03:00
|
|
|
}
|
|
|
|
}
|
2022-08-30 16:44:28 +03:00
|
|
|
$m add command -label [::msgcat::mc "Save file"] -command {FileOper::Save}\
|
|
|
|
-accelerator "Ctrl+S"
|
|
|
|
$m add command -label [::msgcat::mc "Close file"] -command {FileOper::Close}\
|
|
|
|
-accelerator "Ctrl+w"
|
2022-11-23 13:20:18 +03:00
|
|
|
$m add command -label [::msgcat::mc "Close all"] -command {FileOper::CloseAll}
|
|
|
|
|
|
|
|
$m add separator
|
|
|
|
|
2022-07-21 10:56:46 +03:00
|
|
|
$m add command -label [::msgcat::mc "Open folder"] -accelerator "Ctrl+K" -command {
|
|
|
|
set folderPath [FileOper::OpenFolderDialog]
|
|
|
|
if {$folderPath != ""} {
|
2022-09-15 16:51:11 +03:00
|
|
|
set activeProject $folderPath
|
2022-07-21 10:56:46 +03:00
|
|
|
FileOper::ReadFolder $folderPath
|
2022-09-02 17:01:53 +03:00
|
|
|
ReadFilesFromDirectory $folderPath $folderPath
|
2018-03-12 16:59:32 +03:00
|
|
|
}
|
2022-07-21 10:56:46 +03:00
|
|
|
}
|
2022-08-30 16:44:28 +03:00
|
|
|
$m add command -label [::msgcat::mc "Close folder"] -command {FileOper::CloseFolder}
|
2022-11-23 12:46:55 +03:00
|
|
|
|
2022-07-21 10:56:46 +03:00
|
|
|
#$m add command -label [::msgcat::mc "Open"] -command {FileDialog $tree open}\
|
|
|
|
#-font $fontNormal -accelerator "Ctrl+O" -state disable
|
2018-03-06 14:11:37 +03:00
|
|
|
$m add separator
|
2022-07-21 10:56:46 +03:00
|
|
|
$m add command -label [::msgcat::mc "Exit"] -command Quit -accelerator "Ctrl+Q"
|
2018-03-06 14:11:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-07-21 10:56:46 +03:00
|
|
|
proc GetEditMenu {m} {
|
|
|
|
$m add command -label [::msgcat::mc "Undo"] -command Undo\
|
|
|
|
-accelerator "Ctrl+Z"
|
|
|
|
$m add command -label [::msgcat::mc "Redo"] -command Redo\
|
|
|
|
-accelerator "Ctrl+Y"
|
2018-03-06 14:11:37 +03:00
|
|
|
$m add separator
|
2022-07-21 10:56:46 +03:00
|
|
|
$m add command -label [::msgcat::mc "Copy"] -command Copy\
|
|
|
|
-accelerator "Ctrl+C"
|
|
|
|
$m add command -label [::msgcat::mc "Paste"] -command Paste\
|
|
|
|
-accelerator "Ctrl+V"
|
|
|
|
$m add command -label [::msgcat::mc "Cut"] -command Cut\
|
|
|
|
-accelerator "Ctrl+Z"
|
2018-03-06 14:11:37 +03:00
|
|
|
$m add separator
|
2022-09-23 12:33:22 +03:00
|
|
|
$m add command -label [::msgcat::mc "Find"] -command {Editor::FindDialog ""}\
|
2022-07-21 10:56:46 +03:00
|
|
|
-accelerator "Ctrl+F"
|
2022-09-23 12:33:22 +03:00
|
|
|
# $m add command -label [::msgcat::mc "Replace"] -command Replace\
|
|
|
|
# -accelerator "Ctrl+R"
|
2018-03-06 14:11:37 +03:00
|
|
|
$m add separator
|
2022-09-22 16:42:48 +03:00
|
|
|
$m add command -label [::msgcat::mc "Find in files"] -command "FileOper::FindInFiles"\
|
2022-07-21 10:56:46 +03:00
|
|
|
-accelerator "Ctrl+Shift+F"
|
2022-09-22 16:42:48 +03:00
|
|
|
$m add command -label [::msgcat::mc "Replace in files"] -command FileOper::ReplaceInFiles\
|
2022-07-21 10:56:46 +03:00
|
|
|
-accelerator "Ctrl+Shift+RV"
|
2022-08-01 16:24:42 +03:00
|
|
|
$m add separator
|
|
|
|
$m add command -label [::msgcat::mc "Insert image"] -accelerator "Ctrl+I"\
|
|
|
|
-command ImageBase64Encode
|
2022-07-21 10:56:46 +03:00
|
|
|
|
2018-03-06 14:11:37 +03:00
|
|
|
}
|
|
|
|
|
2022-07-21 10:56:46 +03:00
|
|
|
proc GetViewMenu {m} {
|
2022-08-17 16:52:22 +03:00
|
|
|
global cfgVariables
|
2022-11-18 16:44:55 +03:00
|
|
|
$m add checkbutton -label [::msgcat::mc "View panel"] -command ViewFilesTree \
|
|
|
|
-variable cfgVariables(filesPanelShow) -onvalue true -offvalue false \
|
|
|
|
-accelerator "Alt+P"
|
2022-08-17 16:52:22 +03:00
|
|
|
menu $m.panelSide
|
|
|
|
$m add cascade -label [::msgcat::mc "Panel side"] -menu $m.panelSide
|
2022-11-18 16:44:55 +03:00
|
|
|
$m.panelSide add radiobutton -label [::msgcat::mc "Left"] \
|
2022-11-23 10:29:53 +03:00
|
|
|
-variable cfgVariables(filesPanelPlace) -value left -command ViewFilesTree
|
2022-11-18 16:44:55 +03:00
|
|
|
$m.panelSide add radiobutton -label [::msgcat::mc "Right"] \
|
2022-11-23 10:29:53 +03:00
|
|
|
-variable cfgVariables(filesPanelPlace) -value right -command ViewFilesTree
|
2022-11-18 16:44:55 +03:00
|
|
|
|
2022-11-22 14:55:24 +03:00
|
|
|
$m add checkbutton -label [::msgcat::mc "Show the Menu"] -command ViewMenuBar \
|
2022-11-18 16:44:55 +03:00
|
|
|
-variable cfgVariables(menuShow) -onvalue true -offvalue false
|
|
|
|
$m add checkbutton -label [::msgcat::mc "Toolbar"] -command ViewToolBar \
|
|
|
|
-variable cfgVariables(toolBarShow) -onvalue true -offvalue false
|
|
|
|
$m add checkbutton -label [::msgcat::mc "Statusbar"] -command ViewStatusBar \
|
|
|
|
-variable cfgVariables(statusBarShow) -onvalue true -offvalue false
|
2022-08-30 16:44:28 +03:00
|
|
|
|
|
|
|
$m add separator
|
2022-11-18 16:44:55 +03:00
|
|
|
# $m add command -label [::msgcat::mc "View line numbers"] \
|
|
|
|
# -command ViewLineNumbers
|
|
|
|
$m add checkbutton -label [::msgcat::mc "View line numbers"] \
|
|
|
|
-variable cfgVariables(lineNumberShow) -onvalue true -offvalue false \
|
|
|
|
-command ViewLineNumbers
|
|
|
|
|
2022-08-30 16:44:28 +03:00
|
|
|
menu $m.editorWrap
|
|
|
|
$m add cascade -label [::msgcat::mc "Editors word wrapping"] -menu $m.editorWrap
|
2022-11-03 15:58:07 +03:00
|
|
|
$m.editorWrap add radiobutton -label [::msgcat::mc "None"] -variable cfgVariables(editorWrap) \
|
|
|
|
-value none -command "Editor::SetOption wrap $cfgVariables(editorWrap)"
|
|
|
|
$m.editorWrap add radiobutton -label [::msgcat::mc "Char"] -variable cfgVariables(editorWrap) \
|
|
|
|
-value char -command "Editor::SetOption wrap $cfgVariables(editorWrap)"
|
|
|
|
$m.editorWrap add radiobutton -label [::msgcat::mc "Word"] -variable cfgVariables(editorWrap) \
|
|
|
|
-value word -command "Editor::SetOption wrap $cfgVariables(editorWrap)"
|
|
|
|
|
|
|
|
$m add separator
|
|
|
|
menu $m.editorHelper
|
|
|
|
$m add cascade -label [::msgcat::mc "Editor helpers"] -menu $m.editorHelper
|
|
|
|
$m.editorHelper add checkbutton -label [::msgcat::mc "Variables"] \
|
|
|
|
-variable cfgVariables(variableHelper) -onvalue true -offvalue false
|
|
|
|
# -command "ViewHelper variableHelper"
|
|
|
|
|
|
|
|
$m.editorHelper add checkbutton -label [::msgcat::mc "Procedures"] \
|
|
|
|
-variable cfgVariables(procedureHelper) -onvalue true -offvalue false
|
|
|
|
# -command "ViewHelper procedureHelper"
|
|
|
|
|
2022-07-21 10:56:46 +03:00
|
|
|
}
|
2022-08-12 15:19:57 +03:00
|
|
|
|
|
|
|
proc GetHelpMenu {m} {
|
|
|
|
$m add command -label [::msgcat::mc "About ..."] -command Help::About
|
|
|
|
}
|
2022-11-18 16:44:55 +03:00
|
|
|
|
|
|
|
proc PopupMenu {x y} {
|
|
|
|
tk_popup .popup $x $y
|
|
|
|
}
|