Added binding mouse button: click on notebook tab highlight opened file name in tree

Change "Paste from Clipboard" function
Change popup editor menu (undo, redo, copy, paste, cut functions)
This commit is contained in:
Sergey Kalinin
2018-02-05 12:08:16 +03:00
parent cc7bbf9a59
commit 8cf4ded785
33 changed files with 69 additions and 9437 deletions

View File

@@ -964,31 +964,7 @@ proc EditFile {node fileName} {
bind $text <Control-c> "tk_textCopy $w.text;break"
bind $text <Control-igrave> "tk_textPaste $w.text;break"
#bind $text <Control-v> "tk_textPaste $w.text;break"
bind $text <Control-v> {
set startPos [Position]
set nodeEdit [$noteBook raise]
EditFlag $nodeEdit [lindex $fileList($nodeEdit) 0] 1
set fileList($nodeEdit) [list [lindex $fileList($nodeEdit) 0] 1]
puts "fuck - $fileList($nodeEdit)"
tk_textPaste $w.text
set endPos [Position]
set lineBegin [lindex [split $startPos "."] 0]
set lineEnd [lindex [split $endPos "."] 0]
for {set line $lineBegin} {$line <= $lineEnd} {incr line} {
if {$nodeEdit == "" || $nodeEdit == "newproj" || $nodeEdit == "settings" || $nodeEdit == "about" || $nodeEdit == "debug"} {
} else {
set textEdit "$noteBook.f$nodeEdit.text"
set editLine [$textEdit get $line.0 $line.end]
if {$autoFormat == "Yes"} {
if {$fileExt != "for"} {
TabIns $textEdit
}
}
HighLight $fileExt $textEdit $editLine $line $nodeEdit
}
}
break
}
bind $text <Control-v> {TextOperation paste; break}
bind $text <Control-adiaeresis> "auto_completition $text"
bind $text <Control-l> "auto_completition $text"
@@ -1155,14 +1131,45 @@ proc SelectAll {text} {
}
proc TextOperation {oper} {
global noteBook fileList autoFormat
set nb [$noteBook raise]
if {$nb == "" || $nb == "newproj" || $nb == "about" || $nb == "debug"} {
return
}
set nb "$noteBook.f$nb"
switch $oper {
"copy" {tk_textCopy $nb.text}
"paste" {
set startPos [Position]
set nodeEdit [$noteBook raise]
EditFlag $nodeEdit [lindex $fileList($nodeEdit) 0] 1
set fileList($nodeEdit) [list [lindex $fileList($nodeEdit) 0] 1]
set fileExt [string range [file extension [lindex $fileList($nodeEdit) 0]] 1 end]
tk_textPaste $noteBook.f$nodeEdit.text
set endPos [Position]
set lineBegin [lindex [split $startPos "."] 0]
set lineEnd [lindex [split $endPos "."] 0]
for {set line $lineBegin} {$line <= $lineEnd} {incr line} {
if {$nodeEdit == "" || $nodeEdit == "newproj" || $nodeEdit == "settings" || $nodeEdit == "about" || $nodeEdit == "debug"} {
} else {
set textEdit "$noteBook.f$nodeEdit.text"
set editLine [$textEdit get $line.0 $line.end]
if {$autoFormat == "Yes"} {
if {$fileExt != "for"} {
TabIns $textEdit
}
}
HighLight $fileExt $textEdit $editLine $line $nodeEdit
}
}
}
"cut" {tk_textCut $nb.text}
"redo" {$nb.text edit redo}
"undo" {$nb.text edit undo}
}
unset nb
}
####################################
GetOp

View File

@@ -92,9 +92,9 @@ menubutton .frmMenu.mnuEdit -text [::msgcat::mc "Edit"] -menu .frmMenu.mnuEdit.m
proc GetMenu {m} {
global fontNormal fontBold imgDir editor
$m add command -label [::msgcat::mc "Undo"] -font $fontNormal -accelerator "Ctrl+Z"\
-state normal -command Undo
$m add command -label [::msgcat::mc "Redo"] -font $fontNormal -accelerator "Ctrl+Z"\
-state normal -command Redo
-state normal -command {TextOperation undo}
$m add command -label [::msgcat::mc "Redo"] -font $fontNormal -accelerator "Ctrl+G"\
-state normal -command {TextOperation redo}
$m add separator
$m add command -label [::msgcat::mc "Procedure name complit"] -font $fontNormal -accelerator "Ctrl+J" -state normal\
-command {
@@ -104,23 +104,11 @@ proc GetMenu {m} {
}
$m add separator
$m add command -label [::msgcat::mc "Copy"] -font $fontNormal -accelerator "Ctrl+C"\
-command {
set nb "$noteBook.f[$noteBook raise]"
tk_textCopy $nb.text
unset nb
}
-command {TextOperation copy}
$m add command -label [::msgcat::mc "Paste"] -font $fontNormal -accelerator "Ctrl+V"\
-command {
set nb "$noteBook.f[$noteBook raise]"
tk_textPaste $nb.text
unset nb
}
-command {TextOperation paste}
$m add command -label [::msgcat::mc "Cut"] -font $fontNormal -accelerator "Ctrl+X"\
-command {
set nb "$noteBook.f[$noteBook raise]"
tk_textCut $nb.text
unset nb
}
-command {TextOperation cut}
$m add separator
$m add command -label [::msgcat::mc "Select all"] -font $fontNormal -accelerator "Ctrl+/"\
-command {
@@ -382,3 +370,4 @@ set activeProject ""
focus -force $tree

View File

@@ -1060,22 +1060,3 @@ proc GetExtention {node} {
return $ext
}
proc TextOperation {oper} {
global noteBook
set nb [$noteBook raise]
if {$nb == "" || $nb == "newproj" || $nb == "about" || $nb == "debug"} {
return
}
set nb "$noteBook.f$nb"
switch $oper {
"copy" {tk_textCopy $nb.text}
"paste" {tk_textPaste $nb.text}
"cut" {tk_textCut $nb.text}
"redo" {$nb.text edit redo}
"undo" {$nb.text edit undo}
}
unset nb
}

View File

@@ -1,9 +1,9 @@
#########################################################
# Tcl/Tk project Manager
# Distributed under GNU Public License
# Author: Sergey Kalinin banzaj28@yandex.ru
# Copyright (c) "Sergey Kalinin", 2002, http://nuk-svk.ru
#########################################################
###########################################################
# Tcl/Tk project Manager #
# Distributed under GNU Public License #
# Author: Sergey Kalinin banzaj28@yandex.ru #
# Copyright (c) "Sergey Kalinin", 2002, http://nuk-svk.ru #
###########################################################
proc NewProjDialog {type} {
global fontNormal tree projDir workDir activeProject fileList noteBook imgDir prjDir prjName
@@ -906,3 +906,5 @@ proc InsertTitle {newFile type} {