Compare commits

...

4 Commits

6 changed files with 161 additions and 51 deletions

View File

@ -672,7 +672,7 @@ namespace eval Editor {
}
proc PressKey {k txt} {
# puts [Editor::Key $k]
# puts [Editor::Key $k ""]
switch $k {
apostrophe {
QuotSelection $txt {'}
@ -719,7 +719,13 @@ namespace eval Editor {
if {$key >= 79 && $key <= 91} {return "true"}
if {$key == 63 || $key == 107 || $key == 108 || $key == 112} {return "true"}
}
proc TextCopy {txt} {
# $txt tag remove sel 1.0 end
$txt tag add sel {insert linestart} {insert lineend + 1char}
tk_textCopy $txt
$txt tag remove sel {insert linestart} {insert lineend + 1char}
return
}
proc BindKeys {w txt fileType} {
global cfgVariables
# variable txt
@ -743,11 +749,15 @@ namespace eval Editor {
bind $txt <Control-u> "Editor::SearchBrackets %W"
bind $txt <Control-J> "catch {Editor::GoToFunction $txt}"
bind $txt <Control-j> "catch {Editor::GoToFunction $txt}; break"
bind $txt <Alt-w> "$txt delete {insert wordstart} {insert wordend}"
bind $txt <Alt-r> "$txt delete {insert linestart} {insert lineend + 1char}"
bind $txt <Alt-w> "$txt delete {insert wordstart} {insert wordend}"
bind $txt <Alt-odiaeresis> "$txt delete {insert wordstart} {insert wordend}"
bind $txt <Alt-r> "$txt delete {insert linestart} {insert lineend + 1char}"
bind $txt <Alt-ecircumflex> "$txt delete {insert linestart} {insert lineend + 1char}"
bind $txt <Alt-b> "$txt delete {insert linestart} insert"
bind $txt <Alt-e> "$txt delete insert {insert lineend}"
bind $txt <Alt-s> "Editor::SplitEditorH $w $fileType"
bind $txt <Alt-s> "Editor::SplitEditorH $w $fileType"
bind $txt <Alt-ucircumflex> "Editor::SplitEditorH $w $fileType"
bind $txt <Alt-y> "Editor::TextCopy $txt"
bind $txt <Control-g> "Editor::GoToLineNumberDialog $txt"
bind $txt <Control-agrave> "Editor::FindDialog $w"
bind $txt <Control-f> "Editor::FindDialog $txt"

View File

@ -167,11 +167,26 @@ namespace eval FileOper {
Close
}
}
set nextProj [$tree next $treeItem]
# puts $nextProj
set prevProj [$tree prev $treeItem]
# puts $prevProj
if {$nextProj ne ""} {
set activeProject [$tree item $nextProj -values]
puts $activeProject
} elseif {$prevProj ne ""} {
set activeProject [$tree item $prevProj -values]
puts $activeProject
} else {
unset activeProject
.frmStatus.lblGitLogo configure -image pixel
.frmStatus.lblGit configure -text ""
}
$tree delete $treeItem
unset nextProj
unset prevProj
}
set activeProject ""
.frmStatus.lblGitLogo configure -image pixel
.frmStatus.lblGit configure -text ""
}
proc CloseAll {} {

View File

@ -74,14 +74,19 @@ ttk::frame .frmBody -border 0 -relief raised
ttk::frame .frmStatus -border 0 -relief raised
if {$cfgVariables(menuShow) eq "true"} {
pack .frmMenu -side top -padx 1 -fill x
# pack -side top -padx 1 -fill x
grid .frmMenu -row 0 -column 0 -sticky new
}
pack .frmBody -side top -padx 1 -fill both -expand true
# pack .frmBody -side top -padx 1 -fill both -expand true
grid .frmBody -row 1 -column 0 -sticky nsew
if {$cfgVariables(statusBarShow) eq "true"} {
pack .frmStatus -side top -padx 1 -fill x
# pack .frmStatus -side top -padx 1 -fill x
grid .frmStatus -row 2 -column 0 -sticky sew
}
grid columnconfigure . .frmBody -weight 1
grid rowconfigure . .frmBody -weight 1
# pack .panel -expand true -fill both
# pack propagate .panel false
@ -119,14 +124,18 @@ GetViewMenu .popup
set frmTool [ttk::frame .frmBody.frmTool]
ttk::panedwindow .frmBody.panel -orient horizontal -style TPanedwindow
pack propagate .frmBody.panel false
# pack propagate .frmBody.panel false
if {$cfgVariables(toolBarShow) eq "true"} {
pack .frmBody.frmTool -side left -fill y
# pack .frmBody.frmTool -side left -fill y
grid .frmBody.frmTool -row 0 -column 0 -sticky nsw
}
pack .frmBody.panel -side left -fill both -expand true
# pack .frmBody.panel -side left -fill both -expand true
grid .frmBody.panel -row 0 -column 1 -sticky nesw
grid columnconfigure .frmBody .frmBody.panel -weight 1
grid rowconfigure .frmBody .frmBody.panel -weight 1
ttk::button $frmTool.btn_tree -command ViewFilesTree -image tree_24x24
ttk::button $frmTool.btn_tree -command ToolBtnTreePress -image tree_24x24
ttk::button $frmTool.btn_search -command FileOper::FindInFiles -image search_24x24
ttk::button $frmTool.btn_git -command Git::Dialog -image git_24x24

View File

@ -79,7 +79,7 @@ proc GetViewMenu {m} {
$m.panelSide add radiobutton -label [::msgcat::mc "Right"] \
-variable cfgVariables(filesPanelPlace) -value right
$m add checkbutton -label [::msgcat::mc "Show the Menu"] -command ViewMenu \
$m add checkbutton -label [::msgcat::mc "Show the Menu"] -command ViewMenuBar \
-variable cfgVariables(menuShow) -onvalue true -offvalue false
$m add checkbutton -label [::msgcat::mc "Toolbar"] -command ViewToolBar \
-variable cfgVariables(toolBarShow) -onvalue true -offvalue false

View File

@ -30,7 +30,6 @@ proc ViewFilesTree {{hotkey "false"}} {
}
if {$cfgVariables(filesPanelShow) eq "false"} {
.frmBody.panel forget .frmBody.frmTree
# set cfgVariables(filesPanelShow) true
} else {
switch $cfgVariables(filesPanelPlace) {
"left" {
@ -43,46 +42,60 @@ proc ViewFilesTree {{hotkey "false"}} {
.frmBody.panel insert 0 .frmBody.frmTree
}
}
# set cfgVariables(filesPanelShow) false
}
}
proc ViewToolBar {} {
global cfgVariables
if {$cfgVariables(toolBarShow) eq "false"} {
pack forget .frmBody.frmTool
} else {
# pack
}
}
proc ViewStatusBar {} {
global cfgVariables
if {$cfgVariables(statusBarShow) eq "false"} {
pack forget .frmStatus
} else {
# pack
}
}
proc ViewMenu {} {
global cfgVariables
if {$cfgVariables(menuShow) eq "false"} {
pack forget .frmMenu
} else {
# pack
}
}
proc ViewMenuBar {{hotkey "false"}} {
global cfgVariables
if {$hotkey eq "true"} {
if {$cfgVariables(menuShow) eq "false"} {
set cfgVariables(menuShow) true
} else {
set cfgVariables(menuShow) false
}
}
if {$cfgVariables(menuShow) eq "false"} {
grid remove .frmMenu
} else {
grid .frmMenu -row 0 -column 0 -sticky new
}
}
proc ViewStatusBar {{hotkey "false"}} {
global cfgVariables
if {$hotkey eq "true"} {
if {$cfgVariables(statusBarShow) eq "false"} {
set cfgVariables(statusBarShow) true
} else {
set cfgVariables(statusBarShow) false
}
}
if {$cfgVariables(statusBarShow) eq "false"} {
grid remove .frmStatus
} else {
grid .frmStatus -row 2 -column 0 -sticky sew
}
}
proc ViewToolBar {{hotkey "false"}} {
global cfgVariables
if {$hotkey eq "true"} {
if {$cfgVariables(toolBarShow) eq "false"} {
set cfgVariables(toolBarShow) true
} else {
set cfgVariables(toolBarShow) false
}
}
if {$cfgVariables(toolBarShow) eq "false"} {
grid remove .frmBody.frmTool
} else {
grid .frmBody.frmTool -row 0 -column 0 -sticky nsw
}
}
# Enable/Disabled line numbers in editor
proc ViewLineNumbers {} {
global cfgVariables nbEditor
# Changed global settigs
# if {$cfgVariables(lineNumberShow) eq "true"} {
# set cfgVariables(lineNumberShow) false
# } else {
# set cfgVariables(lineNumberShow) true
# }
# apply changes for opened tabs
foreach node [$nbEditor tabs] {
if [winfo exists $node.frmText.t] {
$node.frmText.t configure -linemap $cfgVariables(lineNumberShow)
@ -99,6 +112,69 @@ proc ViewHelper {helper} {
set cfgVariables($helper) true
}
}
proc WelcomeDialog {} {
set win .welcome
set x [winfo rootx .frmWork]
set y [winfo rooty .frmWork]
if { [winfo exists $win] } {
destroy $win
return
}
toplevel $win
wm transient $win .
wm overrideredirect $win 1
ttk::button $win.btnOpenFolder -text [::msgcat::mc "Open folder"] -command {
destroy .welcome
set folderPath [FileOper::OpenFolderDialog]
if {$folderPath != ""} {
set activeProject $folderPath
FileOper::ReadFolder $folderPath
ReadFilesFromDirectory $folderPath $folderPath
}
}
ttk::button $win.btnOpenFile -text [::msgcat::mc "Open file"] -command {
destroy .welcome
set filePath [FileOper::OpenDialog]
if {$filePath != ""} {
FileOper::Edit $filePath
}
}
ttk::button $win.btnNewFile -compound center -text [::msgcat::mc "New file"] \
-command {
destroy .welcome
Editor::New
}
pack $win.btnOpenFolder -expand true -fill x -side top -padx 3 -pady 3
pack $win.btnOpenFile -expand true -fill x -side top -padx 3 -pady 3
pack $win.btnNewFile -expand true -fill x -side top -padx 3 -pady 3
bind $win <Escape> "destroy $win"
# Определям расстояние до края экрана (основного окна) и если
# оно меньше размера окна со списком то сдвигаем его вверх
set winGeom [winfo reqheight $win]
set topHeight [winfo height .]
# puts "$x, $y, $winGeom, $topHeight"
if [expr [expr $topHeight - $y] < $winGeom] {
set y [expr $topHeight - $winGeom]
}
wm geom $win +$x+$y
focus $win.btnOpenFolder
}
proc ToolBtnTreePress {} {
global cfgVariables activeProject
if [info exists activeProject] {
if {$activeProject ne ""} {
ViewFilesTree true
}
} else {
WelcomeDialog
}
}
proc Del {} {
return
}

View File

@ -10,7 +10,7 @@ exec wish "$0" -- "$@"
######################################################
# Version: 2.0.0
# Release: alpha
# Build: 18112022164357
# Build: 22112022145344
######################################################
# определим текущую версию, релиз и т.д.