Compare commits
17 Commits
3042b1c1c1
...
0b4d0dbf5c
Author | SHA1 | Date |
---|---|---|
svkalinin | 0b4d0dbf5c | |
svkalinin | 47e4e4e128 | |
svkalinin | fdba263d3e | |
svkalinin | d6fc490a05 | |
svkalinin | 970990bc54 | |
svkalinin | 934c3b1e4d | |
svkalinin | 049873d9ec | |
svkalinin | 37aa0e47a7 | |
svkalinin | 9a93d8fe26 | |
svkalinin | 2cbd7df913 | |
svkalinin | 3a792d7774 | |
svkalinin | 3cbc7c1f48 | |
svkalinin | 11c3dd2fb2 | |
svkalinin | 6f45460f1f | |
svkalinin | 796b0b73a0 | |
svkalinin | e03405dffb | |
svkalinin | 66a047b419 |
|
@ -117,4 +117,9 @@
|
|||
|
||||
20/10/200
|
||||
- Added Git support: add and commit changes, show git log, show each commit...
|
||||
|
||||
|
||||
11/11/2022
|
||||
- Added GoTo Line dialog
|
||||
- Fixed Git commit procedure
|
||||
- Added variable and procedure helper
|
||||
|
||||
|
|
|
@ -23,4 +23,6 @@ dpkg-buildpackage
|
|||
|
||||
#cp ../projman_${VERSION}-${RELEASE}_amd64.deb /files/
|
||||
|
||||
rm projman
|
||||
rm -v projman
|
||||
rm -r -v debian/{projman,.debhelper}
|
||||
|
||||
|
|
|
@ -28,6 +28,9 @@ editedFiles=
|
|||
searchCommand=/usr/bin/grep
|
||||
searchCommandOptions=-r -n -H
|
||||
gitCommand=/usr/bin/git
|
||||
# must return a mime type of file
|
||||
fileTypeCommand=/usr/bin/file
|
||||
fileTypeCommandOptions=-i -b
|
||||
\[GUI\]
|
||||
locale=$locale
|
||||
theme=dark
|
||||
|
|
208
lib/editor.tcl
208
lib/editor.tcl
|
@ -370,7 +370,6 @@ namespace eval Editor {
|
|||
set win .varhelper
|
||||
# if { [winfo exists $win] == 0 } { return }
|
||||
set ind [$win.lBox curselection]
|
||||
puts ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
|
||||
|
||||
switch -- $K {
|
||||
Prior {
|
||||
|
@ -430,6 +429,10 @@ namespace eval Editor {
|
|||
variable txt
|
||||
variable win
|
||||
# set txt $w.frmText.t
|
||||
# блокировка открытия диалога если запущен другой
|
||||
if [winfo exists .findVariables] {
|
||||
return
|
||||
}
|
||||
set txt $w
|
||||
set win .varhelper
|
||||
puts "$x $y $w $word $wordType"
|
||||
|
@ -588,7 +591,7 @@ namespace eval Editor {
|
|||
$txt tag remove lightSelected 1.0 end
|
||||
|
||||
if { [winfo exists .varhelper] } { destroy .varhelper }
|
||||
|
||||
puts $k
|
||||
switch $k {
|
||||
Return {
|
||||
regexp {^(\s*)} [$txt get [expr $lineNum - 1].0 [expr $lineNum - 1].end] -> spaceStart
|
||||
|
@ -608,13 +611,22 @@ namespace eval Editor {
|
|||
Right {
|
||||
return
|
||||
}
|
||||
Shift {
|
||||
# Shift_L {
|
||||
# return
|
||||
# }
|
||||
# Shift_R {
|
||||
# return
|
||||
# }
|
||||
Control_L {
|
||||
return
|
||||
}
|
||||
Controll {
|
||||
Control_R {
|
||||
return
|
||||
}
|
||||
Meta {
|
||||
Alt_L {
|
||||
return
|
||||
}
|
||||
Alt_R {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -715,59 +727,19 @@ namespace eval Editor {
|
|||
# set txt $w.frmText.t
|
||||
bind $txt <KeyRelease> "catch {Editor::ReleaseKey %K $txt $fileType}"
|
||||
bind $txt <KeyPress> "Editor::PressKey %K $txt"
|
||||
# bind $txt.t <KeyRelease> "Editor::ReleaseKey %K $txt.t $fileType"
|
||||
# bind $txt.t <KeyPress> "Editor::PressKey %K $txt.t"
|
||||
# bind $txt <KeyRelease> "Editor::Key %k %K"
|
||||
#$txt tag bind Sel <Control-/> {puts ">>>>>>>>>>>>>>>>>>>"}
|
||||
#bind $txt <Control-slash> {puts "/////////////////"}
|
||||
# #bind $txt <Control-g> GoToLine
|
||||
# bind $txt <Control-g> {focus .frmTool.frmGoto.entGoTo; .frmTool.frmGoto.entGoTo delete 0 end}
|
||||
bind $txt <Control-agrave> "Editor::FindDialog $w"
|
||||
bind $txt <Control-f> "Editor::FindDialog $txt"
|
||||
bind $txt <Control-F> "Editor::FindDialog $txt"
|
||||
# bind $txt <F3> {FindNext $w.text 1}
|
||||
# bind $txt <Control-ecircumflex> ReplaceDialog
|
||||
# bind $txt <Control-r> ReplaceDialog
|
||||
# bind $txt <F4> {ReplaceCommand $w.text 1}
|
||||
# bind $txt <Control-ucircumflex> {FileDialog [$noteBookFiles raise] save}
|
||||
# bind $txt <Control-s> {FileDialog [$noteBookFiles raise] save}
|
||||
# bind $txt <Control-ocircumflex> {FileDialog [$noteBookFiles raise] save_as}
|
||||
# bind $txt <Shift-Control-s> {FileDialog [$noteBookFiles raise] save_as}
|
||||
bind $txt <Control-odiaeresis> FileOper::Close
|
||||
bind $txt <Control-w> FileOper::Close
|
||||
# bind $txt <Control-division> "tk_textCut $w.text;break"
|
||||
# bind $txt <Control-x> "tk_textCut $w.text;break"
|
||||
# bind $txt <Control-ntilde> "tk_textCopy $txt"
|
||||
# bind $txt <Control-c> "tk_textCopy $txt"
|
||||
bind $txt <Control-igrave> "Editor::SelectionPaste $txt"
|
||||
bind $txt <Control-v> "Editor::SelectionPaste $txt"
|
||||
|
||||
#bind $txt <Control-adiaeresis> "auto_completition $txt"
|
||||
bind $txt <Control-l> "SearchVariable $txt"
|
||||
# bind $txt <Control-icircumflex> ""
|
||||
# bind $txt <Control-j> ""
|
||||
bind $txt <Control-l> "SearchVariable $txt; break"
|
||||
bind $txt <Control-i> "ImageBase64Encode $txt"
|
||||
|
||||
bind $txt <Control-bracketleft> "Editor::InsertTabular $txt"
|
||||
bind $txt <Control-bracketright> "Editor::DeleteTabular $txt"
|
||||
|
||||
bind $txt <Control-comma> "Editor::Comment $txt $fileType"
|
||||
bind $txt <Control-period> "Editor::Uncomment $txt $fileType"
|
||||
bind $txt <Control-eacute> Find
|
||||
#bind . <Control-m> PageTab
|
||||
#bind . <Control-udiaeresis> PageTab
|
||||
bind $txt <Insert> {OverWrite}
|
||||
bind $txt <ButtonRelease-1> "Editor::SearchBrackets $txt"
|
||||
# bind <Button-1> [bind sysAfter <Any-Key>]
|
||||
# bind $txt <Button-3> {catch [PopupMenuEditor %X %Y]}
|
||||
# bind $txt <Button-4> "%W yview scroll -3 units"
|
||||
# bind $txt <Button-5> "%W yview scroll 3 units"
|
||||
#bind $txt <Shift-Button-4> "%W xview scroll -2 units"
|
||||
#bind $txt <Shift-Button-5> "%W xview scroll 2 units"
|
||||
bind $txt <Button-1><ButtonRelease-1> "Editor::SelectionHighlight $txt"
|
||||
# bind $txt <<Selection>> "Editor::SelectionHighlight $txt"
|
||||
bind $txt <<Modified>> "SetModifiedFlag $w"
|
||||
# bind $txt <<Selection>> "Editor::SelectionGet $txt"
|
||||
bind $txt <Control-i> ImageBase64Encode
|
||||
bind $txt <Control-u> "Editor::SearchBrackets %W"
|
||||
bind $txt <Control-J> "catch {Editor::GoToFunction $txt}"
|
||||
|
@ -777,6 +749,12 @@ namespace eval Editor {
|
|||
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 <Control-g> "Editor::GoToLineNumberDialog $txt"
|
||||
bind $txt <Control-agrave> "Editor::FindDialog $w"
|
||||
bind $txt <Control-f> "Editor::FindDialog $txt"
|
||||
bind $txt <Control-F> "Editor::FindDialog $txt"
|
||||
bind $txt <Control-odiaeresis> FileOper::Close
|
||||
bind $txt <Control-w> FileOper::Close
|
||||
bind $txt <Control-o> {
|
||||
set filePath [FileOper::OpenDialog]
|
||||
if {$filePath != ""} {
|
||||
|
@ -791,6 +769,38 @@ namespace eval Editor {
|
|||
}
|
||||
break
|
||||
}
|
||||
# bind $txt.t <KeyRelease> "Editor::ReleaseKey %K $txt.t $fileType"
|
||||
# bind $txt.t <KeyPress> "Editor::PressKey %K $txt.t"
|
||||
# bind $txt <KeyRelease> "Editor::Key %k %K"
|
||||
#$txt tag bind Sel <Control-/> {puts ">>>>>>>>>>>>>>>>>>>"}
|
||||
#bind $txt <Control-slash> {puts "/////////////////"}
|
||||
# #bind $txt <Control-g> GoToLine
|
||||
# bind $txt <F3> {FindNext $w.text 1}
|
||||
# bind $txt <Control-ecircumflex> ReplaceDialog
|
||||
# bind $txt <Control-r> ReplaceDialog
|
||||
# bind $txt <F4> {ReplaceCommand $w.text 1}
|
||||
# bind $txt <Control-ucircumflex> {FileDialog [$noteBookFiles raise] save}
|
||||
# bind $txt <Control-s> {FileDialog [$noteBookFiles raise] save}
|
||||
# bind $txt <Control-ocircumflex> {FileDialog [$noteBookFiles raise] save_as}
|
||||
# bind $txt <Shift-Control-s> {FileDialog [$noteBookFiles raise] save_as}
|
||||
# bind $txt <Control-division> "tk_textCut $w.text;break"
|
||||
# bind $txt <Control-x> "tk_textCut $w.text;break"
|
||||
# bind $txt <Control-ntilde> "tk_textCopy $txt"
|
||||
# bind $txt <Control-c> "tk_textCopy $txt"
|
||||
|
||||
#bind $txt <Control-adiaeresis> "auto_completition $txt"
|
||||
# bind $txt <Control-icircumflex> ""
|
||||
# bind $txt <Control-j> ""
|
||||
#bind . <Control-m> PageTab
|
||||
#bind . <Control-udiaeresis> PageTab
|
||||
# bind <Button-1> [bind sysAfter <Any-Key>]
|
||||
# bind $txt <Button-3> {catch [PopupMenuEditor %X %Y]}
|
||||
# bind $txt <Button-4> "%W yview scroll -3 units"
|
||||
# bind $txt <Button-5> "%W yview scroll 3 units"
|
||||
#bind $txt <Shift-Button-4> "%W xview scroll -2 units"
|
||||
#bind $txt <Shift-Button-5> "%W xview scroll 2 units"
|
||||
# bind $txt <<Selection>> "Editor::SelectionHighlight $txt"
|
||||
# bind $txt <<Selection>> "Editor::SelectionGet $txt"
|
||||
}
|
||||
|
||||
proc SearchBrackets {txt} {
|
||||
|
@ -1303,6 +1313,57 @@ namespace eval Editor {
|
|||
$text see insert
|
||||
}
|
||||
|
||||
proc GoToLineNumberDialog {w} {
|
||||
global editors lexers
|
||||
variable txt
|
||||
variable win
|
||||
# set txt $w.frmText.t
|
||||
set txt $w
|
||||
set win .gotoline
|
||||
set box [$txt bbox insert]
|
||||
set x [expr [lindex $box 0] + [winfo rootx $txt] ]
|
||||
set y [expr [lindex $box 1] + [winfo rooty $txt] + [lindex $box 3] ]
|
||||
|
||||
if { [winfo exists $win] } { destroy $win }
|
||||
toplevel $win
|
||||
wm transient $win .
|
||||
wm overrideredirect $win 1
|
||||
|
||||
ttk::entry $win.ent
|
||||
pack $win.ent -expand true -fill y -side left -padx 3 -pady 3
|
||||
|
||||
bind $win <Escape> {
|
||||
destroy $Editor::win
|
||||
focus -force $Editor::txt.t
|
||||
break
|
||||
}
|
||||
bind $win.ent <Escape> {
|
||||
destroy $Editor::win
|
||||
focus -force $Editor::txt.t
|
||||
break
|
||||
}
|
||||
bind $win.ent <Return> {
|
||||
set lineNumber [.gotoline.ent get]
|
||||
# $txt see insert $lineNumber
|
||||
puts $Editor::txt
|
||||
$Editor::txt mark set insert $lineNumber.0
|
||||
$Editor::txt see insert
|
||||
focus $Editor::txt.t
|
||||
destroy .gotoline
|
||||
break
|
||||
}
|
||||
# Определям расстояние до края экрана (основного окна) и если
|
||||
# оно меньше размера окна со списком то сдвигаем его вверх
|
||||
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.ent
|
||||
}
|
||||
|
||||
proc EditorWidget {fr fileType} {
|
||||
global cfgVariables editors
|
||||
|
||||
|
@ -1356,6 +1417,17 @@ namespace eval Editor {
|
|||
|
||||
proc Editor {fileFullPath nb itemName} {
|
||||
global cfgVariables editors
|
||||
set imageType {
|
||||
PNG
|
||||
JPG
|
||||
JPEG
|
||||
WEBP
|
||||
GIF
|
||||
TIFF
|
||||
JP2
|
||||
ICO
|
||||
XPM
|
||||
}
|
||||
set fr $itemName
|
||||
if ![string match "*untitled*" $itemName] {
|
||||
set lblText $fileFullPath
|
||||
|
@ -1387,47 +1459,13 @@ namespace eval Editor {
|
|||
pack propagate $fr.panelTxt false
|
||||
pack $fr.panelTxt -side top -fill both -expand true
|
||||
|
||||
set frmText [Editor::EditorWidget $fr $fileType]
|
||||
|
||||
if {[lsearch -exact $imageType $fileType] != -1} {
|
||||
ImageViewer $fileFullPath $itemName $fr
|
||||
} else {
|
||||
set frmText [Editor::EditorWidget $fr $fileType]
|
||||
}
|
||||
$fr.panelTxt add $frmText -weight 0
|
||||
|
||||
return $fr
|
||||
}
|
||||
}
|
||||
|
||||
# ctextBindings.tcl
|
||||
#
|
||||
# Copyright (C) 2012 Sedat Serper
|
||||
# A similar script and functionality is implemented in tG² as of v1.06.01.41
|
||||
#
|
||||
# proc ctext_binding4Tag {w tags} {
|
||||
# # foreach tag $tags {
|
||||
# $w tag bind $tag <Enter> {%W config -cursor hand2}
|
||||
# $w tag bind $tag <Leave> {%W config -cursor xterm}
|
||||
# $w tag bind $tag <ButtonRelease-1> {
|
||||
# set cur [::tk::TextClosestGap %W %x %y]
|
||||
# if {[catch {%W index anchor}]} {%W mark set anchor $cur}
|
||||
# set anchor [%W index anchor]
|
||||
# set last [::tk::TextNextPos %W "$cur - 1c" tcl_wordBreakAfter]
|
||||
# set first [::tk::TextPrevPos %W anchor tcl_wordBreakBefore]
|
||||
# if {![catch {set tmp [%W get $first $last]}]} {
|
||||
# ctext_execTagCmd $tmp
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
#
|
||||
#
|
||||
# THE DEMO
|
||||
#
|
||||
# # ----------------------- demo -------------------------------------------
|
||||
# # Open a new wish console and copy/paste the following complete script.
|
||||
# # Clicking on parts that are highlighted and observe the console output...
|
||||
# # Adjust procedure 'ctext_execTagCmd' to customize the handling 4 your application.
|
||||
# package require ctext
|
||||
# pack [ctext .t] -fill both -expand 1
|
||||
# ctext::addHighlightClass .t bindings purple [list <Enter> <Leave> <ButtonRelease-1>]
|
||||
# ctext::addHighlightClass .t commands orange [list foreach proc if set catch]
|
||||
# .t fastinsert end [info body ctext_binding4Tag]
|
||||
# .t highlight 1.0 end
|
||||
# ctext_binding4Tag .t {bindings commands}
|
||||
|
|
110
lib/files.tcl
110
lib/files.tcl
|
@ -13,7 +13,95 @@ namespace eval FileOper {
|
|||
|
||||
set ::types {
|
||||
{"All files" *}
|
||||
}
|
||||
}
|
||||
|
||||
proc GetFileMimeType {fileFullPath {opt ""}} {
|
||||
global cfgVariables
|
||||
# Проверям наличие программы в системе, если есть то добавляем опции
|
||||
# если нет то используем тиклевый пакет
|
||||
if [file exists $cfgVariables(fileTypeCommand)] {
|
||||
set cmd exec
|
||||
lappend cmd $cfgVariables(fileTypeCommand)
|
||||
foreach _ [split $cfgVariables(fileTypeCommandOptions) " "] {
|
||||
lappend cmd $_
|
||||
}
|
||||
} else {
|
||||
set cmd [list eval ::fileutil::magic::filetype]
|
||||
}
|
||||
|
||||
# lappend cmd $activeProject
|
||||
lappend cmd $fileFullPath
|
||||
catch $cmd pipe
|
||||
# puts $pipe
|
||||
if [regexp -nocase -- {(\w+)/([[:alnum:]-]+); charset=([[:alnum:]-]+)} $pipe m fType fExt fCharset] {
|
||||
puts "$fType $fExt $fCharset"
|
||||
}
|
||||
switch $opt {
|
||||
"charset" {
|
||||
if [info exists fCharset] {
|
||||
return $fCharset
|
||||
}
|
||||
}
|
||||
}
|
||||
switch $fType {
|
||||
"application" {
|
||||
if {$fExt ne "json"} {
|
||||
return false
|
||||
}
|
||||
}
|
||||
"text" {
|
||||
return text
|
||||
}
|
||||
"image" {
|
||||
return false
|
||||
}
|
||||
default {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
## GETTING FILE ATTRIBUTES ##
|
||||
proc GetFileAttr {file {opt ""}} {
|
||||
global tcl_platform
|
||||
set fileAttribute ""
|
||||
# get file modify time
|
||||
switch $opt {
|
||||
attr {
|
||||
if {$tcl_platform(platform) == "windows"} {
|
||||
set unixTime [file mtime $file]
|
||||
set modifyTime [clock format $unixTime -format "%d/%m/%Y, %H:%M"]
|
||||
} elseif {$tcl_platform(platform) == "mac"} {
|
||||
|
||||
} elseif {$tcl_platform(platform) == "unix"} {
|
||||
set unixTime [file mtime $file]
|
||||
set modifyTime [clock format $unixTime -format "%d/%m/%Y, %H:%M"]
|
||||
}
|
||||
return $modifyTime
|
||||
}
|
||||
size {
|
||||
# get file size
|
||||
set size [file size $file]
|
||||
if {$size < 1024} {
|
||||
set fileSize "$size b"
|
||||
}
|
||||
if {$size >= 1024} {
|
||||
set s [expr ($size.0) / 1024]
|
||||
set dot [string first "\." $s]
|
||||
set int [string range $s 0 [expr $dot - 1]]
|
||||
set dec [string range $s [expr $dot + 1] [expr $dot + 2]]
|
||||
set fileSize "$int.$dec Kb"
|
||||
}
|
||||
if {$size >= 1048576} {
|
||||
set s [expr ($size.0) / 1048576]
|
||||
set dot [string first "\." $s]
|
||||
set int [string range $s 0 [expr $dot - 1]]
|
||||
set dec [string range $s [expr $dot + 1] [expr $dot + 2]]
|
||||
set fileSize "$int.$dec Mb"
|
||||
}
|
||||
return $fileSize
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc OpenDialog {} {
|
||||
global env project activeProject
|
||||
|
@ -132,6 +220,8 @@ namespace eval FileOper {
|
|||
}
|
||||
unset modified($nbItem)
|
||||
.frmStatus.lblPosition configure -text ""
|
||||
.frmStatus.lblEncoding configure -text ""
|
||||
.frmStatus.lblSize configure -text ""
|
||||
}
|
||||
|
||||
proc Save {} {
|
||||
|
@ -270,8 +360,21 @@ namespace eval FileOper {
|
|||
global nbEditor tree
|
||||
if {[file exists $fileFullPath] == 0} {
|
||||
return false
|
||||
} else {
|
||||
# puts [::fileutil::magic::filetype $fileFullPath]
|
||||
set fileType [FileOper::GetFileMimeType $fileFullPath]
|
||||
}
|
||||
switch $fileType {
|
||||
"text" {
|
||||
# return text
|
||||
}
|
||||
"image" {
|
||||
# return image
|
||||
}
|
||||
false {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
set filePath [file dirname $fileFullPath]
|
||||
set fileName [file tail $fileFullPath]
|
||||
regsub -all {\.|/|\\|\s} $fileFullPath "_" itemName
|
||||
|
@ -291,7 +394,8 @@ namespace eval FileOper {
|
|||
$itemName.frmText.t.t mark set insert 1.0
|
||||
$itemName.frmText.t.t see 1.0
|
||||
focus -force $itemName.frmText.t.t
|
||||
|
||||
.frmStatus.lblSize configure -text [GetFileAttr $fileFullPath "size"]
|
||||
.frmStatus.lblEncoding configure -text [GetFileMimeType $fileFullPath "charset"]
|
||||
return $itemName
|
||||
}
|
||||
|
||||
|
|
19
lib/git.tcl
19
lib/git.tcl
|
@ -159,16 +159,20 @@ namespace eval Git {
|
|||
|
||||
proc Commit {w} {
|
||||
global cfgVariables activeProject
|
||||
set txt [string trim [$w get 0.0 end]]
|
||||
puts $txt
|
||||
set txt $w.body.tCommit
|
||||
set listBox $w.body.lCommit
|
||||
set description [string trim [$txt get 0.0 end]]
|
||||
puts $description
|
||||
set cmd exec
|
||||
append cmd " $cfgVariables(gitCommand)"
|
||||
append cmd " commit"
|
||||
append cmd " -m"
|
||||
append cmd " \"$txt\""
|
||||
append cmd " \"$description\""
|
||||
append cmd " --"
|
||||
append cmd " $activeProject"
|
||||
if {$txt eq ""} {
|
||||
foreach item [$listBox get 0 [$listBox size]] {
|
||||
append cmd " [file join $activeProject $item]"
|
||||
}
|
||||
if {$description eq ""} {
|
||||
set answer [tk_messageBox -message [::msgcat::mc "Empty commit description"] \
|
||||
-icon info -type ok \
|
||||
-detail [::msgcat::mc "You must enter a commit description"]]
|
||||
|
@ -552,7 +556,7 @@ namespace eval Git {
|
|||
|
||||
ttk::button $fr.body.bCommit -image done_20x20 -compound left \
|
||||
-text "[::msgcat::mc "Commit changes"]" \
|
||||
-command "Git::Commit $fr.body.tCommit; Git::DialogUpdate $fr"
|
||||
-command "Git::Commit $fr; Git::DialogUpdate $fr"
|
||||
ttk::button $fr.body.bPush -image doneall_20x20 -compound left \
|
||||
-text "[::msgcat::mc "Push changes"]" \
|
||||
-command "Git::PushPrepare; Git::DialogUpdate $fr"
|
||||
|
@ -621,7 +625,7 @@ namespace eval Git {
|
|||
Git::DialogUpdate $Git::fr
|
||||
}
|
||||
bind $fr.body.lBox <Return> "Git::CommitAdd $fr"
|
||||
bind $fr.body.lBox <Double-Button-1> "catch {Git::CommitAdd $fr}"
|
||||
bind $fr.body.lBox <Double-Button-1> "catch {Git::CommitAdd $fr; $fr.body.t delete 0.0 end; $fr.body.tCommit delete 0.0 end}"
|
||||
bind $fr.body.lBox <Button-1><ButtonRelease-1> "Git::ListBoxPress $fr"
|
||||
bind $fr.body.lBox <KeyRelease> "Git::Key %K $fr"
|
||||
|
||||
|
@ -642,6 +646,7 @@ namespace eval Git {
|
|||
}
|
||||
# End Git commit history
|
||||
|
||||
ctext::addHighlightClassForRegexp $fr.body.t files yellow {^diff.*$}
|
||||
ctext::addHighlightClassForRegexp $fr.body.t paths #19a2a6 {@@.+@@}
|
||||
ctext::addHighlightClassForRegexp $fr.body.t add green {^\+.*$}
|
||||
ctext::addHighlightClassForRegexp $fr.body.t gremove grey {^\-.*$}
|
||||
|
|
|
@ -79,13 +79,15 @@ pack .frmStatus -side top -padx 1 -fill x
|
|||
# pack .panel -expand true -fill both
|
||||
# pack propagate .panel false
|
||||
#pack [label .frmMenu.lbl -text "ddd"]
|
||||
|
||||
pack [ttk::label .frmStatus.lblGitLogo -justify left] -side left
|
||||
pack [ttk::label .frmStatus.lblGit] -side left
|
||||
pack [ttk::label .frmStatus.lblGit] -side left -expand true -fill x
|
||||
bind .frmStatus.lblGit <Button-1><ButtonRelease-1> {
|
||||
Git::BranchDialog %X %Y
|
||||
}
|
||||
|
||||
pack [ttk::label .frmStatus.lblPosition -justify right] -side right
|
||||
pack [ttk::label .frmStatus.lblPosition -justify right] -side left -expand true -fill x
|
||||
pack [ttk::label .frmStatus.lblSize -justify center] -side right -fill x
|
||||
pack [ttk::label .frmStatus.lblEncoding -justify center] -side right -fill x
|
||||
|
||||
ttk::menubutton .frmMenu.mnuFile -text [::msgcat::mc "File"] -menu .frmMenu.mnuFile.m
|
||||
GetFileMenu [menu .frmMenu.mnuFile.m]
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
proc ImageViewer {f w node} {
|
||||
set factor($node) 1.0
|
||||
ttk::frame $w.f
|
||||
pack $w.f -side left -fill both -expand true
|
||||
canvas $w.f.c -xscrollcommand "$w.f.x set" -yscrollcommand "$w.y set"
|
||||
ttk::scrollbar $w.f.x -ori hori -command "$w.f.c xview"
|
||||
ttk::scrollbar $w.y -ori vert -command "$w.f.c yview"
|
||||
|
||||
pack $w.f.c -side top -fill both -expand true
|
||||
pack $w.f.x -side top -fill x
|
||||
pack $w.y -side left -fill y
|
||||
bind $w.f.c <Button-4> "%W yview scroll -3 units"
|
||||
bind $w.f.c <Button-5> "%W yview scroll 3 units"
|
||||
bind $w.f.c <Shift-Button-4> "%W xview scroll -2 units"
|
||||
bind $w.f.c <Shift-Button-5> "%W xview scroll 2 units"
|
||||
bind $w.f.c <Control-Button-4> "scale $w.f.c 0.5 $node"
|
||||
bind $w.f.c <Control-Button-5> "scale $w.f.c 2 $node"
|
||||
#$w.scrwin setwidget $w.scrwin.f
|
||||
openImg $f $w.f.c $node
|
||||
}
|
||||
|
||||
proc openImg {fn w node} {
|
||||
global im1
|
||||
set im1 [image create photo -file $fn]
|
||||
#scale $w
|
||||
list [file size $fn] bytes, [image width $im1]x[image height $im1]
|
||||
$w create image 1 1 -image $im1 -anchor nw -tag img
|
||||
}
|
||||
|
||||
proc scale {w {n 1} node} {
|
||||
global im1 im2 factor noteBook tab_label
|
||||
set factor($node) [expr {$factor($node) * $n}]
|
||||
$w delete img
|
||||
catch {image delete $im2}
|
||||
set im2 [image create photo]
|
||||
if {$factor($node)>=1} {
|
||||
set f [expr int($factor($node))]
|
||||
$im2 copy $im1 -zoom $f $f
|
||||
} else {
|
||||
set f [expr round(1./$factor($node))]
|
||||
$im2 copy $im1 -subsample $f $f
|
||||
}
|
||||
$w create image 1 1 -image $im2 -anchor nw -tag img
|
||||
$noteBook itemconfigure $node -text "$tab_label (size x$factor($node))"
|
||||
$w config -scrollregion [$w bbox all]
|
||||
}
|
||||
|
||||
proc ImageBase64Encode {text} {
|
||||
global env
|
||||
set types {
|
||||
{"PNG" {.png}}
|
||||
{"GIF" {.gif}}
|
||||
{"JPEG" {.jpg}}
|
||||
{"BMP" {.bmp}}
|
||||
{"All files" *}
|
||||
}
|
||||
set img [tk_getOpenFile -initialdir $env(HOME) -filetypes $types -parent .]
|
||||
if {$img ne ""} {
|
||||
set f [open $img]
|
||||
fconfigure $f -translation binary
|
||||
set data [base64::encode [read $f]]
|
||||
close $f
|
||||
# base name on root name of the image file
|
||||
set name [file root [file tail $img]]
|
||||
$text insert [Position] "image create photo $name -data {\n$data\n}"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -189,6 +189,9 @@ proc FindVariablesDialog {txt args} {
|
|||
set y [expr [lindex $box 1] + [winfo rooty $txt] + [lindex $box 3] ]
|
||||
|
||||
set win .findVariables
|
||||
if [winfo exists .varhelper] {
|
||||
destroy .varhelper
|
||||
}
|
||||
|
||||
if { [winfo exists $win] } { destroy $win }
|
||||
toplevel $win
|
||||
|
|
|
@ -10,7 +10,7 @@ exec wish "$0" -- "$@"
|
|||
######################################################
|
||||
# Version: 2.0.0
|
||||
# Release: alpha
|
||||
# Build: 08112022125307
|
||||
# Build: 11112022131048
|
||||
######################################################
|
||||
|
||||
# определим текущую версию, релиз и т.д.
|
||||
|
@ -47,6 +47,7 @@ package require ctext
|
|||
package require base64
|
||||
package require fileutil
|
||||
package require Thread
|
||||
package require fileutil::magic::filetype
|
||||
|
||||
# Устанавливаем текущий каталог
|
||||
set dir(root) [pwd]
|
||||
|
|
Loading…
Reference in New Issue