Compare commits
30 Commits
22bdd7b87e
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb6b2c6f53 | ||
|
|
aa9bb03cc2 | ||
|
|
bcc3460e06 | ||
|
|
1385c91255 | ||
|
|
ead8267d61 | ||
|
|
e534b27407 | ||
|
|
45cbd7845b | ||
|
|
b830838f8e | ||
|
|
ef87b88156 | ||
| 264368c61f | |||
| c38dffeeb9 | |||
| df1d9aa36d | |||
| cff798a9f1 | |||
| 64287f1a01 | |||
| 5e1c057bc5 | |||
| ab740f0be8 | |||
| 4c6713b2d3 | |||
| dc5fd60c0d | |||
| c3848566df | |||
| 961d597032 | |||
| 5d70d508cd | |||
| 8619e3e1f4 | |||
| 8834c0954e | |||
| 4e67dbfccf | |||
| e5b0468a44 | |||
| a9ac54ce54 | |||
| 297d0f7420 | |||
| 9b083515ba | |||
| 722bbc4e30 | |||
| bdb9b2db00 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -5,4 +5,6 @@ debian/projman.substvars
|
|||||||
debian/files
|
debian/files
|
||||||
debian/projman.debhelper.log
|
debian/projman.debhelper.log
|
||||||
debian/*.tmp
|
debian/*.tmp
|
||||||
*.tmp
|
debian/errors
|
||||||
|
*.tmp
|
||||||
|
errors
|
||||||
17
README.md
17
README.md
@@ -69,6 +69,17 @@ tcllib, tklib
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
- A pseudo-terminal for launching the edited file and other command
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- Image viewer
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
## Getting source code
|
## Getting source code
|
||||||
|
|
||||||
Download the source code https://git.nuk-svk.ru/svk/projman/
|
Download the source code https://git.nuk-svk.ru/svk/projman/
|
||||||
@@ -120,7 +131,6 @@ Or type "projman" into terminal, Or choose the name of the program "Projman" on
|
|||||||
- Ctrl-N - Create new file
|
- Ctrl-N - Create new file
|
||||||
- Ctrl-O - Open file
|
- Ctrl-O - Open file
|
||||||
- Ctrl-W - Close editor (file)
|
- Ctrl-W - Close editor (file)
|
||||||
- Ctrl-K - Open folder
|
|
||||||
- Ctrl-Q - Quit from ProjMan
|
- Ctrl-Q - Quit from ProjMan
|
||||||
- Ctrl-J - Show procedures (functions) list for navigation in open editor
|
- Ctrl-J - Show procedures (functions) list for navigation in open editor
|
||||||
- Ctrl-L - Find and display files where the variable is defined, the name of which is located under the cursor in the editor
|
- Ctrl-L - Find and display files where the variable is defined, the name of which is located under the cursor in the editor
|
||||||
@@ -134,6 +144,10 @@ Or type "projman" into terminal, Or choose the name of the program "Projman" on
|
|||||||
- Ctrl-G - Go to line dialog
|
- Ctrl-G - Go to line dialog
|
||||||
- Ctrl-C - Copy selected text into buffer
|
- Ctrl-C - Copy selected text into buffer
|
||||||
- Ctrl-V - Paste text from buffer
|
- Ctrl-V - Paste text from buffer
|
||||||
|
- Ctrl-R - Open terminal for edited file
|
||||||
|
- Ctrl-Z - Send SIGTSTP signal
|
||||||
|
- Ctrl-D - Send SIGINT signal
|
||||||
|
- Ctrl-C - Send SIGKILL signal
|
||||||
|
|
||||||
- Alt-P - Show/Hide the file tree panel
|
- Alt-P - Show/Hide the file tree panel
|
||||||
- Alt-W - Delete the current word
|
- Alt-W - Delete the current word
|
||||||
@@ -142,6 +156,7 @@ Or type "projman" into terminal, Or choose the name of the program "Projman" on
|
|||||||
- Alt-R - Delete current line
|
- Alt-R - Delete current line
|
||||||
- Alt-Y - Copy current line into buffer
|
- Alt-Y - Copy current line into buffer
|
||||||
- Alt-S - Split the edited window horizontally
|
- Alt-S - Split the edited window horizontally
|
||||||
|
- Alt-K - Open folder
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
|
|||||||
5
TODO
5
TODO
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
--- Ansible ---
|
--- Ansible ---
|
||||||
1. Определение всех переменных в отдельный список
|
1. Определение всех переменных в отдельный список
|
||||||
- внутри файла, конструкции вида:
|
- внутри файла, конструкции вида:
|
||||||
set_fact:
|
set_fact:
|
||||||
varName: value
|
varName: value
|
||||||
set_fact varName value
|
set_fact varName value
|
||||||
@@ -18,5 +18,4 @@
|
|||||||
- var1.yml
|
- var1.yml
|
||||||
- var2.yml
|
- var2.yml
|
||||||
|
|
||||||
3. Если используется роль и переменная не найдена в плэйбуке то искать в роли (не факт что требуется)
|
3. Если используется роль и переменная не найдена в плэйбуке
|
||||||
|
|
||||||
|
|||||||
71
debian/changelog
vendored
71
debian/changelog
vendored
@@ -1,8 +1,67 @@
|
|||||||
|
projman (2.0.0-alpha21) stable; urgency=medium
|
||||||
|
|
||||||
|
* Исправил ошибку
|
||||||
|
* Добавлены настройки путей к программам для выполнения редактируемых файлов для каждого поддержимаего типа. И использование этих настроек при выполнении файла.
|
||||||
|
|
||||||
|
-- Sergey Kalinin <svk@nuk-svk.ru> Wed, 3 Dec 2025 17:59:31 +0300
|
||||||
|
|
||||||
|
projman (2.0.0-alpha20) stable; urgency=medium
|
||||||
|
|
||||||
|
* Добавил вывод номера версии tcl/tl в О Программе
|
||||||
|
|
||||||
|
-- Sergey Kalinin <svk@nuk-svk.ru> Mon, 03 Dec 2025 17:22:44 +0300
|
||||||
|
|
||||||
|
projman (2.0.0-alpha19) stable; urgency=medium
|
||||||
|
|
||||||
|
* Исправил сохранение и закрытие нового файла. Теперь при сохранении файл будет переоткрыт под новым именем.
|
||||||
|
* Добавил проверку пакета Img. И поправил проверку типов изображений
|
||||||
|
* Переделал сигналы и сочетания
|
||||||
|
* Небольшие исправления
|
||||||
|
* Добавлен перевод фокуса ввода на прежнее окно после закрытия диалога выполнения.
|
||||||
|
* Добавлена передача сигналов для закрытия запущенного процесса
|
||||||
|
* Изменил виджет текста в окне псевдо-терминала. Добавил подстановку имени файла к командную строку по шаблону %f
|
||||||
|
* Добавлен диалог настроек
|
||||||
|
* Добавил псевдо-терминал
|
||||||
|
* Добавлен диалог при открытии файлов отличных от текстовых
|
||||||
|
* Поправил тему оформления
|
||||||
|
* Исправлена работа в windows
|
||||||
|
* Уменьшил колдичество выводимой отладочной информации
|
||||||
|
* Добавлено определение пути до git в зависимости от платформы.
|
||||||
|
* Исправлено создание файла конфигурации
|
||||||
|
* Исправлено создание файла конфигурации. Добавлены номера версий в вызов tclsh8.6 и wish8.6. Убрана зависимость на Threads.
|
||||||
|
* Исправлено чтение структуры проекта при открытии из меню 'Открыть недавнее'
|
||||||
|
* Bugfix release
|
||||||
|
* Bug fix with varhelper
|
||||||
|
* Added the "Open Recent" menu. The "recentlyEditedFolders" option in the configuration file contains a list of recently opened directories. The procedures for working with this list have also been added.
|
||||||
|
* Косметические изменения.
|
||||||
|
* Исправлены ошибки при вставке кавычек
|
||||||
|
|
||||||
|
-- Калинин Сергей Валерьевич <svk@nuk-svk.ru> Thu, 30 Jan 2025 12:19:56 +0300
|
||||||
|
|
||||||
|
projman (2.0.0-alpha19) stable; urgency=medium
|
||||||
|
|
||||||
|
* Переделал сигналы и сочетния
|
||||||
|
* Добавлен перевод фокуса ввода на прежнее окно после закрытия диалога выполнения.
|
||||||
|
* Добавлена передача сигналов для закрытия запущенного процесса
|
||||||
|
* Изменил виджет текста в окне псевдо-терминала. Добавил подстановку имени файла к командную строку по шаблону %f
|
||||||
|
* Добавлен диалог настроек
|
||||||
|
* Добавил псевдо-терминал
|
||||||
|
* Добавлен диалог при открытии файлов отличных от текстовых
|
||||||
|
* Добавлен просмотр файлов изображений (png, bmp, gif, ppm, pgm)
|
||||||
|
* Исправлена процедура опреления типа файла
|
||||||
|
* Добавлены диалоги для подтверждения открытия больших файлов, и двоичных файлов.
|
||||||
|
|
||||||
|
-- Sergey Kalinin <svk@nuk-svk.ru> Wed, 29 Oct 2025 13:10:31 +0300
|
||||||
|
|
||||||
projman (2.0.0-alpha18) stable; urgency=medium
|
projman (2.0.0-alpha18) stable; urgency=medium
|
||||||
|
|
||||||
* Исправлено создание файла конфигурации.
|
* Поправил тему оформления
|
||||||
|
* Исправлена работа в windows
|
||||||
|
* Уменьшил количество выводимой отладочной информации
|
||||||
|
* Добавлено определение пути до git в зависимости от платформы.
|
||||||
|
* Исправлено создание файла конфигурации
|
||||||
* Добавлены номера версий в вызов tclsh8.6 и wish8.6.
|
* Добавлены номера версий в вызов tclsh8.6 и wish8.6.
|
||||||
* Убрана зависимостить на Threads.
|
* Убрана зависимость на Threads.
|
||||||
* Исправлено чтение структуры проекта при открытии из меню 'Открыть недавнее'
|
* Исправлено чтение структуры проекта при открытии из меню 'Открыть недавнее'
|
||||||
* Исправление работы процедуры varhelper
|
* Исправление работы процедуры varhelper
|
||||||
|
|
||||||
@@ -366,3 +425,11 @@ projman (2.0.0-alfa0) stable; urgency=medium
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ set ::configDefault "\[General\]
|
|||||||
cfgModifyDate=''
|
cfgModifyDate=''
|
||||||
searchCommand=/usr/bin/grep
|
searchCommand=/usr/bin/grep
|
||||||
searchCommandOptions=-r -n -H
|
searchCommandOptions=-r -n -H
|
||||||
gitCommand=/usr/bin/git
|
gitCommand=
|
||||||
# must return a mime type of file
|
# must return a mime type of file
|
||||||
fileTypeCommand=/usr/bin/file
|
fileTypeCommand=/usr/bin/file
|
||||||
fileTypeCommandOptions=-i -b
|
fileTypeCommandOptions=-i -b
|
||||||
@@ -65,6 +65,16 @@ multilineComments=true
|
|||||||
opened=
|
opened=
|
||||||
editedFiles=
|
editedFiles=
|
||||||
recentFolder=
|
recentFolder=
|
||||||
|
\[Executor\]
|
||||||
|
TCL=tclsh
|
||||||
|
GO=go
|
||||||
|
PY=python3
|
||||||
|
SH=bash
|
||||||
|
PL=perl
|
||||||
|
RB=ruby
|
||||||
|
HTM=firefox
|
||||||
|
HTML=firefox
|
||||||
|
LUA=lua
|
||||||
"
|
"
|
||||||
proc Config::create {dir} {
|
proc Config::create {dir} {
|
||||||
set cfgFile [open [file join $dir projman.ini] "w+"]
|
set cfgFile [open [file join $dir projman.ini] "w+"]
|
||||||
|
|||||||
109
lib/editor.tcl
109
lib/editor.tcl
@@ -94,7 +94,7 @@ namespace eval Editor {
|
|||||||
# }
|
# }
|
||||||
set commentProcedure "GetComment"
|
set commentProcedure "GetComment"
|
||||||
|
|
||||||
puts "$fileType, $commentProcedure"
|
# puts "$fileType, $commentProcedure"
|
||||||
if {$selIndex != ""} {
|
if {$selIndex != ""} {
|
||||||
set lineBegin [lindex [split [lindex $selIndex 0] "."] 0]
|
set lineBegin [lindex [split [lindex $selIndex 0] "."] 0]
|
||||||
set lineEnd [lindex [split [lindex $selIndex 1] "."] 0]
|
set lineEnd [lindex [split [lindex $selIndex 1] "."] 0]
|
||||||
@@ -140,10 +140,10 @@ namespace eval Editor {
|
|||||||
|
|
||||||
set cmd "regexp -nocase -indices -- {(^|\s+)\\s*($symbol\\s*)(.*)} {$str} match v1 v2 v3"
|
set cmd "regexp -nocase -indices -- {(^|\s+)\\s*($symbol\\s*)(.*)} {$str} match v1 v2 v3"
|
||||||
|
|
||||||
puts $cmd
|
# puts $cmd
|
||||||
# puts [eval $cmd]
|
# puts [eval $cmd]
|
||||||
if [eval $cmd] {
|
if [eval $cmd] {
|
||||||
puts "$match, $v2, $v3"
|
# puts "$match, $v2, $v3"
|
||||||
return [list [lindex [split $v2] 0] [lindex [split $v3] 0]]
|
return [list [lindex [split $v2] 0] [lindex [split $v3] 0]]
|
||||||
} else {
|
} else {
|
||||||
return 0
|
return 0
|
||||||
@@ -253,7 +253,7 @@ namespace eval Editor {
|
|||||||
$txt highlight $lineBegin.0 $lineEnd.end
|
$txt highlight $lineBegin.0 $lineEnd.end
|
||||||
} else {
|
} else {
|
||||||
set str [$txt get $lineNum.0 $lineNum.end]
|
set str [$txt get $lineNum.0 $lineNum.end]
|
||||||
puts ">>>>> $str"
|
# puts ">>>>> $str"
|
||||||
if {[regexp -nocase -indices -- {(^\s*)(.*?)} $str match v1]} {
|
if {[regexp -nocase -indices -- {(^\s*)(.*?)} $str match v1]} {
|
||||||
set posBegin [lindex [split $v1] 0]
|
set posBegin [lindex [split $v1] 0]
|
||||||
set posEnd [lindex [split $v1] 1]
|
set posEnd [lindex [split $v1] 1]
|
||||||
@@ -277,7 +277,7 @@ namespace eval Editor {
|
|||||||
set pos [$txt index insert]
|
set pos [$txt index insert]
|
||||||
set lineNum [lindex [split $pos "."] 0]
|
set lineNum [lindex [split $pos "."] 0]
|
||||||
set posNum [lindex [split $pos "."] 1]
|
set posNum [lindex [split $pos "."] 1]
|
||||||
puts "$pos"
|
# puts "$pos"
|
||||||
if {$lineNum > 1} {
|
if {$lineNum > 1} {
|
||||||
# get current text
|
# get current text
|
||||||
set curText [$txt get $lineNum.0 "$lineNum.0 lineend"]
|
set curText [$txt get $lineNum.0 "$lineNum.0 lineend"]
|
||||||
@@ -398,7 +398,7 @@ namespace eval Editor {
|
|||||||
set win .varhelper
|
set win .varhelper
|
||||||
# if { [winfo exists $win] == 0 } { return }
|
# if { [winfo exists $win] == 0 } { return }
|
||||||
set ind [$win.lBox curselection]
|
set ind [$win.lBox curselection]
|
||||||
puts ">>>>>>>>>>>> VarHelperBind <<<<<<<<<<<<<<<<"
|
# puts ">>>>>>>>>>>> VarHelperBind <<<<<<<<<<<<<<<<"
|
||||||
|
|
||||||
switch -- $K {
|
switch -- $K {
|
||||||
Prior {
|
Prior {
|
||||||
@@ -443,7 +443,7 @@ namespace eval Editor {
|
|||||||
}
|
}
|
||||||
} ;# proc auto_completition_key
|
} ;# proc auto_completition_key
|
||||||
proc VarHelperEscape {w} {
|
proc VarHelperEscape {w} {
|
||||||
puts ">>>>>>>>>>>> VarHelperEscape <<<<<<<<<<<<<<<<"
|
# puts ">>>>>>>>>>>> VarHelperEscape <<<<<<<<<<<<<<<<"
|
||||||
# bindtags $w [list [winfo parent $w] $w Text sysAfter all]
|
# bindtags $w [list [winfo parent $w] $w Text sysAfter all]
|
||||||
bindtags $w [list [winfo toplevel $w] $w Ctext sysAfter all]
|
bindtags $w [list [winfo toplevel $w] $w Ctext sysAfter all]
|
||||||
catch { destroy .varhelper }
|
catch { destroy .varhelper }
|
||||||
@@ -464,7 +464,7 @@ namespace eval Editor {
|
|||||||
puts "You have selected text [$txt tag ranges sel]"
|
puts "You have selected text [$txt tag ranges sel]"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
puts "$x $y $w $word $wordType"
|
# puts "$x $y $w $word $wordType"
|
||||||
set fileType [dict get $editors $txt fileType]
|
set fileType [dict get $editors $txt fileType]
|
||||||
|
|
||||||
if {[dict exists $editors $txt variableList] != 0} {
|
if {[dict exists $editors $txt variableList] != 0} {
|
||||||
@@ -762,7 +762,7 @@ namespace eval Editor {
|
|||||||
}
|
}
|
||||||
## GET KEYS CODE ##
|
## GET KEYS CODE ##
|
||||||
proc Key {key str} {
|
proc Key {key str} {
|
||||||
puts "Pressed key code: $key, $str"
|
# puts "Pressed key code: $key, $str"
|
||||||
if {$key >= 10 && $key <= 22} {return "true"}
|
if {$key >= 10 && $key <= 22} {return "true"}
|
||||||
if {$key >= 24 && $key <= 36} {return "true"}
|
if {$key >= 24 && $key <= 36} {return "true"}
|
||||||
if {$key >= 38 && $key <= 50} {return "true"}
|
if {$key >= 38 && $key <= 50} {return "true"}
|
||||||
@@ -786,8 +786,11 @@ namespace eval Editor {
|
|||||||
bind $txt <Control-eacute> Quit
|
bind $txt <Control-eacute> Quit
|
||||||
bind $txt <Control-igrave> "Editor::SelectionPaste $txt"
|
bind $txt <Control-igrave> "Editor::SelectionPaste $txt"
|
||||||
bind $txt <Control-v> "Editor::SelectionPaste $txt"
|
bind $txt <Control-v> "Editor::SelectionPaste $txt"
|
||||||
|
bind $txt <Control-Cyrillic_em> "Editor::SelectionPaste $txt"
|
||||||
bind $txt <Control-l> "SearchVariable $txt; break"
|
bind $txt <Control-l> "SearchVariable $txt; break"
|
||||||
|
bind $txt <Control-Cyrillic_de> "SearchVariable $txt; break"
|
||||||
bind $txt <Control-i> "ImageBase64Encode $txt"
|
bind $txt <Control-i> "ImageBase64Encode $txt"
|
||||||
|
bind $txt <Control-Cyrillic_sha> "ImageBase64Encode $txt"
|
||||||
bind $txt <Control-bracketleft> "Editor::InsertTabular $txt"
|
bind $txt <Control-bracketleft> "Editor::InsertTabular $txt"
|
||||||
bind $txt <Control-bracketright> "Editor::DeleteTabular $txt"
|
bind $txt <Control-bracketright> "Editor::DeleteTabular $txt"
|
||||||
bind $txt <Control-comma> "Editor::Comment $txt $fileType"
|
bind $txt <Control-comma> "Editor::Comment $txt $fileType"
|
||||||
@@ -797,25 +800,35 @@ namespace eval Editor {
|
|||||||
bind $txt <ButtonRelease-1> "Editor::SearchBrackets $txt"
|
bind $txt <ButtonRelease-1> "Editor::SearchBrackets $txt"
|
||||||
bind $txt <Button-1><ButtonRelease-1> "Editor::SelectionHighlight $txt"
|
bind $txt <Button-1><ButtonRelease-1> "Editor::SelectionHighlight $txt"
|
||||||
bind $txt <<Modified>> "SetModifiedFlag $w $nb"
|
bind $txt <<Modified>> "SetModifiedFlag $w $nb"
|
||||||
bind $txt <Control-i> ImageBase64Encode
|
|
||||||
bind $txt <Control-u> "Editor::SearchBrackets %W"
|
bind $txt <Control-u> "Editor::SearchBrackets %W"
|
||||||
|
bind $txt <Control-Cyrillic_ghe> "Editor::SearchBrackets %W"
|
||||||
bind $txt <Control-J> "catch {Editor::GoToFunction $txt}"
|
bind $txt <Control-J> "catch {Editor::GoToFunction $txt}"
|
||||||
bind $txt <Control-j> "catch {Editor::GoToFunction $txt}; break"
|
bind $txt <Control-j> "catch {Editor::GoToFunction $txt}; break"
|
||||||
|
bind $txt <Control-Cyrillic_o> "catch {Editor::GoToFunction $txt}; break"
|
||||||
bind $txt <Alt-w> "$txt delete {insert wordstart} {insert wordend}"
|
bind $txt <Alt-w> "$txt delete {insert wordstart} {insert wordend}"
|
||||||
bind $txt <Alt-odiaeresis> "$txt delete {insert wordstart} {insert wordend}"
|
bind $txt <Alt-odiaeresis> "$txt delete {insert wordstart} {insert wordend}"
|
||||||
|
bind $txt <Alt-Cyrillic_tse> "$txt delete {insert wordstart} {insert wordend}"
|
||||||
bind $txt <Alt-r> "$txt delete {insert linestart} {insert lineend + 1char}"
|
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-ecircumflex> "$txt delete {insert linestart} {insert lineend + 1char}"
|
||||||
|
bind $txt <Alt-Cyrillic_er> "$txt delete {insert linestart} {insert lineend + 1char}"
|
||||||
bind $txt <Alt-b> "$txt delete {insert linestart} insert"
|
bind $txt <Alt-b> "$txt delete {insert linestart} insert"
|
||||||
|
bind $txt <Alt-Cyrillic_i> "$txt delete {insert linestart} insert"
|
||||||
bind $txt <Alt-e> "$txt delete insert {insert lineend}"
|
bind $txt <Alt-e> "$txt delete insert {insert lineend}"
|
||||||
|
bind $txt <Alt-Cyrillic_u> "$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-ucircumflex> "Editor::SplitEditorH $w $fileType"
|
||||||
|
bind $txt <Alt-Cyrillic_hardsign> "Editor::SplitEditorH $w $fileType"
|
||||||
bind $txt <Alt-y> "Editor::TextCopy $txt"
|
bind $txt <Alt-y> "Editor::TextCopy $txt"
|
||||||
|
bind $txt <Alt-Cyrillic_en> "Editor::TextCopy $txt"
|
||||||
bind $txt <Control-g> "Editor::GoToLineNumberDialog $txt"
|
bind $txt <Control-g> "Editor::GoToLineNumberDialog $txt"
|
||||||
|
bind $txt <Control-Cyrillic_pe> "Editor::GoToLineNumberDialog $txt"
|
||||||
bind $txt <Control-agrave> "Editor::FindDialog $w"
|
bind $txt <Control-agrave> "Editor::FindDialog $w"
|
||||||
bind $txt <Control-f> "Editor::FindDialog $txt"
|
bind $txt <Control-f> "Editor::FindDialog $txt"
|
||||||
|
bind $txt <Control-Cyrillic_a> "Editor::FindDialog $txt"
|
||||||
bind $txt <Control-F> "Editor::FindDialog $txt"
|
bind $txt <Control-F> "Editor::FindDialog $txt"
|
||||||
bind $txt <Control-odiaeresis> FileOper::Close
|
bind $txt <Control-odiaeresis> FileOper::Close
|
||||||
bind $txt <Control-w> FileOper::Close
|
bind $txt <Control-w> FileOper::Close
|
||||||
|
bind $txt <Control-Cyrillic_tse> FileOper::Close
|
||||||
bind $txt <Control-o> {
|
bind $txt <Control-o> {
|
||||||
set filePath [FileOper::OpenDialog]
|
set filePath [FileOper::OpenDialog]
|
||||||
if {$filePath != ""} {
|
if {$filePath != ""} {
|
||||||
@@ -830,6 +843,16 @@ namespace eval Editor {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
bind $txt <Control-Cyrillic_shcha> {
|
||||||
|
set filePath [FileOper::OpenDialog]
|
||||||
|
if {$filePath != ""} {
|
||||||
|
FileOper::Edit $filePath
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
bind $txt <Control-r> "Editor::SplitEditorForExecute $w $fileType $nb "
|
||||||
|
bind $txt <Control-Cyrillic_ka> "Editor::SplitEditorForExecute $w $fileType $nb "
|
||||||
|
|
||||||
# bind $txt.t <KeyRelease> "Editor::ReleaseKey %K $txt.t $fileType"
|
# bind $txt.t <KeyRelease> "Editor::ReleaseKey %K $txt.t $fileType"
|
||||||
# bind $txt.t <KeyPress> "Editor::PressKey %K $txt.t"
|
# bind $txt.t <KeyPress> "Editor::PressKey %K $txt.t"
|
||||||
# bind $txt <KeyRelease> "Editor::Key %k %K"
|
# bind $txt <KeyRelease> "Editor::Key %k %K"
|
||||||
@@ -890,7 +913,7 @@ namespace eval Editor {
|
|||||||
set lineNum [lindex [split $pos "."] 0]
|
set lineNum [lindex [split $pos "."] 0]
|
||||||
set posNum [lindex [split $pos "."] 1]
|
set posNum [lindex [split $pos "."] 1]
|
||||||
set symbol [string trim [string trimleft $symbol "\\"]]
|
set symbol [string trim [string trimleft $symbol "\\"]]
|
||||||
puts "Selindex : $selIndex, cursor position: $pos, Symbol: $symbol"
|
# puts "Selindex : $selIndex, cursor position: $pos, Symbol: $symbol"
|
||||||
if {$selIndex != ""} {
|
if {$selIndex != ""} {
|
||||||
set lineBegin [lindex [split [lindex $selIndex 0] "."] 0]
|
set lineBegin [lindex [split [lindex $selIndex 0] "."] 0]
|
||||||
set posBegin [lindex [split [lindex $selIndex 0] "."] 1]
|
set posBegin [lindex [split [lindex $selIndex 0] "."] 1]
|
||||||
@@ -898,7 +921,7 @@ namespace eval Editor {
|
|||||||
set posEnd [lindex [split [lindex $selIndex 1] "."] 1]
|
set posEnd [lindex [split [lindex $selIndex 1] "."] 1]
|
||||||
set selText [$txt get $lineBegin.$posBegin $lineEnd.$posEnd]
|
set selText [$txt get $lineBegin.$posBegin $lineEnd.$posEnd]
|
||||||
# set selText $selectionText
|
# set selText $selectionText
|
||||||
puts "Selected text: $selText, pos: $pos, lineBegin: $lineBegin, posBegin: $posBegin, pos end: $posEnd"
|
# puts "Selected text: $selText, pos: $pos, lineBegin: $lineBegin, posBegin: $posBegin, pos end: $posEnd"
|
||||||
if {$posNum == $posEnd} {
|
if {$posNum == $posEnd} {
|
||||||
$txt insert $lineBegin.$posBegin "$symbol"
|
$txt insert $lineBegin.$posBegin "$symbol"
|
||||||
}
|
}
|
||||||
@@ -939,7 +962,7 @@ namespace eval Editor {
|
|||||||
# set fileName untitled-$untitledNumber
|
# set fileName untitled-$untitledNumber
|
||||||
set fileFullPath untitled-$untitledNumber
|
set fileFullPath untitled-$untitledNumber
|
||||||
#puts [Tree::InsertItem $tree {} $fileFullPath "file" $fileName]
|
#puts [Tree::InsertItem $tree {} $fileFullPath "file" $fileName]
|
||||||
set nbEditorItem [NB::InsertItem $nbEditor $fileFullPath "file"]
|
set nbEditorItem [NB::InsertItem $nbEditor $fileFullPath "file"]
|
||||||
# puts "$nbEditorItem, $nbEditor"
|
# puts "$nbEditorItem, $nbEditor"
|
||||||
Editor $fileFullPath $nbEditor $nbEditorItem
|
Editor $fileFullPath $nbEditor $nbEditorItem
|
||||||
SetModifiedFlag $nbEditorItem $nbEditor
|
SetModifiedFlag $nbEditorItem $nbEditor
|
||||||
@@ -960,7 +983,7 @@ namespace eval Editor {
|
|||||||
if {[eval [dict get $lexers $fileType procRegexpCommand]]} {
|
if {[eval [dict get $lexers $fileType procRegexpCommand]]} {
|
||||||
set procName_ [string trim $procName]
|
set procName_ [string trim $procName]
|
||||||
if {$treeItemName ne ""} {
|
if {$treeItemName ne ""} {
|
||||||
puts [Tree::InsertItem $tree $treeItemName $procName_ "procedure" "$procName_ ($params)"]
|
Tree::InsertItem $tree $treeItemName $procName_ "procedure" "$procName_ ($params)"
|
||||||
}
|
}
|
||||||
lappend procList [list $procName_ $params]
|
lappend procList [list $procName_ $params]
|
||||||
unset procName_
|
unset procName_
|
||||||
@@ -984,7 +1007,7 @@ namespace eval Editor {
|
|||||||
} else {
|
} else {
|
||||||
set varType ""
|
set varType ""
|
||||||
}
|
}
|
||||||
puts "variable: $varName, value: $varValue, type: $varType"
|
# puts "variable: $varName, value: $varValue, type: $varType"
|
||||||
lappend varList [list $varName $varValue]
|
lappend varList [list $varName $varValue]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -994,7 +1017,7 @@ namespace eval Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc FindFunction {txt findString} {
|
proc FindFunction {txt findString} {
|
||||||
puts "txt: $txt, $findString"
|
# puts "txt: $txt, $findString"
|
||||||
set pos "0.0"
|
set pos "0.0"
|
||||||
$txt see $pos
|
$txt see $pos
|
||||||
set line [lindex [split $pos "."] 0]
|
set line [lindex [split $pos "."] 0]
|
||||||
@@ -1061,7 +1084,7 @@ namespace eval Editor {
|
|||||||
# Вызов диалога со списком процедур или функций присутствующих в тексте
|
# Вызов диалога со списком процедур или функций присутствующих в тексте
|
||||||
proc GoToFunction { w } {
|
proc GoToFunction { w } {
|
||||||
global tree editors
|
global tree editors
|
||||||
puts $w
|
# puts $w
|
||||||
# set txt $w.frmText.t
|
# set txt $w.frmText.t
|
||||||
set txt $w
|
set txt $w
|
||||||
set box [$txt bbox insert]
|
set box [$txt bbox insert]
|
||||||
@@ -1071,7 +1094,7 @@ namespace eval Editor {
|
|||||||
# puts "--$txt"
|
# puts "--$txt"
|
||||||
# puts $editors($txt)
|
# puts $editors($txt)
|
||||||
foreach item [dict get $editors $txt procedureList] {
|
foreach item [dict get $editors $txt procedureList] {
|
||||||
puts $item
|
# puts $item
|
||||||
lappend l [lindex $item 0]
|
lappend l [lindex $item 0]
|
||||||
}
|
}
|
||||||
if {$l ne ""} {
|
if {$l ne ""} {
|
||||||
@@ -1163,7 +1186,7 @@ namespace eval Editor {
|
|||||||
|
|
||||||
proc FindReplaceText {txt findString replaceString regexp} {
|
proc FindReplaceText {txt findString replaceString regexp} {
|
||||||
global nbEditor
|
global nbEditor
|
||||||
puts [focus]
|
# puts [focus]
|
||||||
# set txt [$nbEditor select].frmText.t
|
# set txt [$nbEditor select].frmText.t
|
||||||
$txt tag remove sel 1.0 end
|
$txt tag remove sel 1.0 end
|
||||||
# $txt see $pos
|
# $txt see $pos
|
||||||
@@ -1192,7 +1215,7 @@ namespace eval Editor {
|
|||||||
set lstFindIndex [$txt search -all -nocase -count matchIndexPair $findString $line.$x end]
|
set lstFindIndex [$txt search -all -nocase -count matchIndexPair $findString $line.$x end]
|
||||||
# set symNumbers [string length "$findString"]
|
# set symNumbers [string length "$findString"]
|
||||||
}
|
}
|
||||||
puts $lstFindIndex
|
# puts $lstFindIndex
|
||||||
# puts $matchIndexPair
|
# puts $matchIndexPair
|
||||||
# set lstFindIndex [$txt search -all "$selectionText" 0.0]
|
# set lstFindIndex [$txt search -all "$selectionText" 0.0]
|
||||||
|
|
||||||
@@ -1206,7 +1229,7 @@ namespace eval Editor {
|
|||||||
set selFindRow [lindex [split $ind "."] 1]
|
set selFindRow [lindex [split $ind "."] 1]
|
||||||
# set endInd "$selFindLine.[expr $selFindRow + $symNumbers]"
|
# set endInd "$selFindLine.[expr $selFindRow + $symNumbers]"
|
||||||
set endInd "$selFindLine.[expr [lindex $matchIndexPair $i] + $selFindRow]"
|
set endInd "$selFindLine.[expr [lindex $matchIndexPair $i] + $selFindRow]"
|
||||||
puts "$ind; $selFindLine, $selFindRow; $endInd "
|
# puts "$ind; $selFindLine, $selFindRow; $endInd "
|
||||||
if {$replaceString ne ""} {
|
if {$replaceString ne ""} {
|
||||||
$txt replace $ind $endInd $replaceString
|
$txt replace $ind $endInd $replaceString
|
||||||
# Вычисляем индекс вхождения строки после замены для выделения в тексте
|
# Вычисляем индекс вхождения строки после замены для выделения в тексте
|
||||||
@@ -1259,7 +1282,7 @@ namespace eval Editor {
|
|||||||
} else {
|
} else {
|
||||||
if {[$nbEditor select] ne ""} {
|
if {[$nbEditor select] ne ""} {
|
||||||
set txt [$nbEditor select].frmText.t
|
set txt [$nbEditor select].frmText.t
|
||||||
puts $txt
|
# puts $txt
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -1347,7 +1370,7 @@ namespace eval Editor {
|
|||||||
# Horizontal split the Editor text widget
|
# Horizontal split the Editor text widget
|
||||||
proc SplitEditorH {w fileType nb} {
|
proc SplitEditorH {w fileType nb} {
|
||||||
global cfgVariables
|
global cfgVariables
|
||||||
puts [$w.panelTxt panes]
|
# puts [$w.panelTxt panes]
|
||||||
if [winfo exists $w.frmText2] {
|
if [winfo exists $w.frmText2] {
|
||||||
$w.panelTxt forget $w.frmText2
|
$w.panelTxt forget $w.frmText2
|
||||||
destroy $w.frmText2
|
destroy $w.frmText2
|
||||||
@@ -1367,7 +1390,7 @@ namespace eval Editor {
|
|||||||
|
|
||||||
proc SplitEditorV {fileFullPath} {
|
proc SplitEditorV {fileFullPath} {
|
||||||
global cfgVariables
|
global cfgVariables
|
||||||
regsub -all {\.|/|\\|\s} $fileFullPath "_" itemName
|
regsub -all {\.|/|\\|\s|:} $fileFullPath "_" itemName
|
||||||
set itemName ".frmWork.nbEditor2.$itemName"
|
set itemName ".frmWork.nbEditor2.$itemName"
|
||||||
# puts $itemName
|
# puts $itemName
|
||||||
if {[winfo exists $itemName] == 1} {
|
if {[winfo exists $itemName] == 1} {
|
||||||
@@ -1390,8 +1413,6 @@ namespace eval Editor {
|
|||||||
# grid rowconfigure .frmWork .frmWork.nbEditor2 -weight 1
|
# grid rowconfigure .frmWork .frmWork.nbEditor2 -weight 1
|
||||||
.frmWork.panelNB add .frmWork.nbEditor2 -weight 0
|
.frmWork.panelNB add .frmWork.nbEditor2 -weight 0
|
||||||
puts [FileOper::Edit $fileFullPath .frmWork.nbEditor2]
|
puts [FileOper::Edit $fileFullPath .frmWork.nbEditor2]
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
proc GoToLineNumber {text lineNumber} {
|
proc GoToLineNumber {text lineNumber} {
|
||||||
@@ -1489,8 +1510,8 @@ namespace eval Editor {
|
|||||||
dict set editors $txt fileType $fileType
|
dict set editors $txt fileType $fileType
|
||||||
dict set editors $txt procedureList [list]
|
dict set editors $txt procedureList [list]
|
||||||
|
|
||||||
puts ">>[dict get $editors $txt fileType]"
|
# puts ">>[dict get $editors $txt fileType]"
|
||||||
puts ">>[dict get $editors $txt procedureList]"
|
# puts ">>[dict get $editors $txt procedureList]"
|
||||||
# puts ">>>>> $editors"
|
# puts ">>>>> $editors"
|
||||||
|
|
||||||
if {[info procs ::Highlight::$fileType] ne ""} {
|
if {[info procs ::Highlight::$fileType] ne ""} {
|
||||||
@@ -1515,6 +1536,7 @@ namespace eval Editor {
|
|||||||
ICO
|
ICO
|
||||||
XPM
|
XPM
|
||||||
}
|
}
|
||||||
|
# puts "$itemName"
|
||||||
set fr $itemName
|
set fr $itemName
|
||||||
if ![string match "*untitled*" $itemName] {
|
if ![string match "*untitled*" $itemName] {
|
||||||
set lblText $fileFullPath
|
set lblText $fileFullPath
|
||||||
@@ -1524,6 +1546,8 @@ namespace eval Editor {
|
|||||||
}
|
}
|
||||||
set fileType [string toupper [string trimleft [file extension $fileFullPath] "."]]
|
set fileType [string toupper [string trimleft [file extension $fileFullPath] "."]]
|
||||||
if {$fileType eq ""} {set fileType "Unknown"}
|
if {$fileType eq ""} {set fileType "Unknown"}
|
||||||
|
|
||||||
|
ExecutorCommandPathSetting $fileType
|
||||||
|
|
||||||
ttk::frame $fr.header
|
ttk::frame $fr.header
|
||||||
set lblName "lbl[string range $itemName [expr [string last "." $itemName] +1] end]"
|
set lblName "lbl[string range $itemName [expr [string last "." $itemName] +1] end]"
|
||||||
@@ -1536,9 +1560,13 @@ namespace eval Editor {
|
|||||||
-command "Editor::SplitEditorH $fr $fileType $nb"
|
-command "Editor::SplitEditorH $fr $fileType $nb"
|
||||||
ttk::button $fr.header.$btnSplitV -image split_vertical_11x11 \
|
ttk::button $fr.header.$btnSplitV -image split_vertical_11x11 \
|
||||||
-command "Editor::SplitEditorV $fileFullPath"
|
-command "Editor::SplitEditorV $fileFullPath"
|
||||||
|
|
||||||
|
set btnSplitExecute "btnSplitExec[string range $itemName [expr [string last "." $itemName] +1] end]"
|
||||||
|
ttk::button $fr.header.$btnSplitExecute -image execute_11x11 \
|
||||||
|
-command "Editor::SplitEditorForExecute $fr $fileType $nb $fileFullPath"
|
||||||
# pack $fr.$btnSplitH $fr.$btnSplitV -side right -anchor e
|
# pack $fr.$btnSplitH $fr.$btnSplitV -side right -anchor e
|
||||||
pack $fr.header.$lblName -side left -expand true -fill x
|
pack $fr.header.$lblName -side left -expand true -fill x
|
||||||
pack $fr.header.$btnSplitV $fr.header.$btnSplitH -side right
|
pack $fr.header.$btnSplitV $fr.header.$btnSplitH $fr.header.$btnSplitExecute -side right
|
||||||
|
|
||||||
pack $fr.header -side top -fill x
|
pack $fr.header -side top -fill x
|
||||||
|
|
||||||
@@ -1556,4 +1584,27 @@ namespace eval Editor {
|
|||||||
|
|
||||||
return $fr
|
return $fr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc SplitEditorForExecute {w fileType nb {fileFullPath ""}} {
|
||||||
|
global cfgVariables tree
|
||||||
|
if {$fileFullPath eq ""} {
|
||||||
|
set treeItem "file::[string range $w [expr [string last "." $w] +1] end ]"
|
||||||
|
set fileFullPath [Tree::GetItemID $tree $treeItem]
|
||||||
|
puts $fileFullPath
|
||||||
|
}
|
||||||
|
# puts [$w.panelTxt panes]
|
||||||
|
puts "$w $fileType $nb $fileFullPath"
|
||||||
|
if [winfo exists $w.frmText2] {
|
||||||
|
$w.panelTxt forget $w.frmText2
|
||||||
|
destroy $w.frmText2
|
||||||
|
focus -force $w.frmText.t.t
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
set frmText [ttk::frame $w.frmText2 -border 1]
|
||||||
|
$w.panelTxt add $frmText -weight 1
|
||||||
|
# focus -force $frmText.t.t
|
||||||
|
Execute $fileFullPath $frmText $w
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
170
lib/files.tcl
170
lib/files.tcl
@@ -9,12 +9,42 @@
|
|||||||
|
|
||||||
|
|
||||||
namespace eval FileOper {
|
namespace eval FileOper {
|
||||||
variable types
|
global packages
|
||||||
|
variable types
|
||||||
|
|
||||||
set ::types {
|
set ::types {
|
||||||
{"All files" *}
|
{"All files" *}
|
||||||
}
|
}
|
||||||
|
# Проверка поддерживаемых типов изображений
|
||||||
|
# в зависимости устновлен пакет или нет
|
||||||
|
proc SupportImageType {type} {
|
||||||
|
if {[PackagePresent Img] eq "true"} {
|
||||||
|
switch $type {
|
||||||
|
jpeg { return true }
|
||||||
|
png { return true }
|
||||||
|
gif { return true }
|
||||||
|
bmp { return true }
|
||||||
|
svg { return true }
|
||||||
|
ppm { return true }
|
||||||
|
pgm { return true }
|
||||||
|
tiff { return true }
|
||||||
|
xbm { return true }
|
||||||
|
xpm { return true }
|
||||||
|
default { return false}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch $type {
|
||||||
|
png { return true }
|
||||||
|
gif { return true }
|
||||||
|
bmp { return true }
|
||||||
|
svg { return true }
|
||||||
|
ppm { return true }
|
||||||
|
pgm { return true }
|
||||||
|
default { return false}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
proc GetFileMimeType {fileFullPath {opt ""}} {
|
proc GetFileMimeType {fileFullPath {opt ""}} {
|
||||||
global cfgVariables
|
global cfgVariables
|
||||||
# Проверям наличие программы в системе, если есть то добавляем опции
|
# Проверям наличие программы в системе, если есть то добавляем опции
|
||||||
@@ -48,16 +78,70 @@ namespace eval FileOper {
|
|||||||
# используем пакет из tcl
|
# используем пакет из tcl
|
||||||
lassign [::fileutil::fileType $fileFullPath] fType fBinaryType fBinaryInterp
|
lassign [::fileutil::fileType $fileFullPath] fType fBinaryType fBinaryInterp
|
||||||
puts "File type is $fType, $fBinaryType, $fBinaryInterp"
|
puts "File type is $fType, $fBinaryType, $fBinaryInterp"
|
||||||
|
set ext [string tolower [file extension $fileFullPath]]
|
||||||
|
|
||||||
|
# Установка корректного типа для svg
|
||||||
|
# Но для новых версий tcl
|
||||||
|
switch $ext {
|
||||||
|
".svg" {
|
||||||
|
set fType "binary"
|
||||||
|
set fBinaryInterp "svg"
|
||||||
|
set fBinaryType "graphic"
|
||||||
|
}
|
||||||
|
".torrent" {
|
||||||
|
set fType "binary"
|
||||||
|
set fBinaryInterp "torrent"
|
||||||
|
set fBinaryType "x-bittorrent"
|
||||||
|
}
|
||||||
|
".pdf" {
|
||||||
|
set fType "binary"
|
||||||
|
set fBinaryInterp "pdf"
|
||||||
|
set fBinaryType "binary"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
puts "File type is $fType, $fBinaryType, $fBinaryInterp, $ext"
|
||||||
|
|
||||||
switch $fType {
|
switch $fType {
|
||||||
"binary" {
|
"binary" {
|
||||||
return false
|
if {$fBinaryType ne ""} {
|
||||||
|
switch $fBinaryType {
|
||||||
|
"graphic" {
|
||||||
|
if {[SupportImageType $fBinaryInterp] eq "true"} {
|
||||||
|
return image
|
||||||
|
} else {
|
||||||
|
set answer [tk_messageBox -message [::msgcat::mc "The file looks like a image. Support not implemented yet."] -icon question -type ok]
|
||||||
|
switch $answer {
|
||||||
|
ok {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default {
|
||||||
|
return binary
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return binary
|
||||||
|
}
|
||||||
}
|
}
|
||||||
"text" {
|
"text" {
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
"image" {
|
"image" {
|
||||||
return false
|
if {[SupportImageType $fBinaryInterp] eq "true"} {
|
||||||
|
return image
|
||||||
|
} else {
|
||||||
|
set answer [tk_messageBox -message [::msgcat::mc "The file looks like a image. Support not implemented yet."] -icon question -type ok]
|
||||||
|
switch $answer {
|
||||||
|
ok {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"empty" {
|
||||||
|
return text
|
||||||
}
|
}
|
||||||
default {
|
default {
|
||||||
return false
|
return false
|
||||||
@@ -226,14 +310,16 @@ namespace eval FileOper {
|
|||||||
-icon question -type yesnocancel \
|
-icon question -type yesnocancel \
|
||||||
-detail [::msgcat::mc "Do you want to save it?"]]
|
-detail [::msgcat::mc "Do you want to save it?"]]
|
||||||
switch $answer {
|
switch $answer {
|
||||||
yes Save
|
yes {Save close}
|
||||||
no {}
|
no {}
|
||||||
cancel {return "cancel"}
|
cancel {return "cancel"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$nbEditor forget $nbItem
|
if {[$nbEditor select] eq $nbItem} {
|
||||||
destroy $nbItem
|
$nbEditor forget $nbItem
|
||||||
|
destroy $nbItem
|
||||||
|
}
|
||||||
set treeItem "file::[string range $nbItem [expr [string last "." $nbItem] +1] end ]"
|
set treeItem "file::[string range $nbItem [expr [string last "." $nbItem] +1] end ]"
|
||||||
if [$tree exists $treeItem] {
|
if [$tree exists $treeItem] {
|
||||||
# delete all functions from tree item
|
# delete all functions from tree item
|
||||||
@@ -258,19 +344,19 @@ namespace eval FileOper {
|
|||||||
NB::NextTab $nbEditor 0
|
NB::NextTab $nbEditor 0
|
||||||
}
|
}
|
||||||
|
|
||||||
proc Save {} {
|
proc Save {{type ""}} {
|
||||||
global nbEditor tree env activeProject
|
global nbEditor tree env activeProject dir
|
||||||
|
|
||||||
if [info exists activeProject] {
|
if [info exists activeProject] {
|
||||||
set dir $activeProject
|
set dirProject $activeProject
|
||||||
} else {
|
} else {
|
||||||
set dir $env(HOME)
|
set dirProject $env(HOME)
|
||||||
}
|
}
|
||||||
|
|
||||||
set nbEditorItem [$nbEditor select]
|
set nbEditorItem [$nbEditor select]
|
||||||
puts "Saved editor text: $nbEditorItem"
|
# puts "Saved editor text: $nbEditorItem"
|
||||||
if [string match "*untitled*" $nbEditorItem] {
|
if [string match "*untitled*" $nbEditorItem] {
|
||||||
set filePath [tk_getSaveFile -initialdir $dir -filetypes $::types -parent .]
|
set filePath [tk_getSaveFile -initialdir $dirProject -filetypes $::types -parent .]
|
||||||
if {$filePath eq ""} {
|
if {$filePath eq ""} {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -287,9 +373,18 @@ namespace eval FileOper {
|
|||||||
set editedText [$nbEditorItem.frmText.t get 0.0 end]
|
set editedText [$nbEditorItem.frmText.t get 0.0 end]
|
||||||
set f [open $filePath "w+"]
|
set f [open $filePath "w+"]
|
||||||
puts -nonewline $f $editedText
|
puts -nonewline $f $editedText
|
||||||
puts "$f was saved"
|
# puts "$f was saved"
|
||||||
close $f
|
close $f
|
||||||
ResetModifiedFlag $nbEditorItem $nbEditor
|
ResetModifiedFlag $nbEditorItem $nbEditor
|
||||||
|
if {[file tail $filePath] eq "projman.ini"} {
|
||||||
|
Config::read $dir(cfg)
|
||||||
|
}
|
||||||
|
if [string match "*untitled*" $nbEditorItem] {
|
||||||
|
FileOper::Close
|
||||||
|
if {$type ne "close"} {
|
||||||
|
FileOper::Edit $filePath
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proc SaveAll {} {
|
proc SaveAll {} {
|
||||||
@@ -316,7 +411,7 @@ namespace eval FileOper {
|
|||||||
|
|
||||||
proc ReadFolder {directory {parent ""}} {
|
proc ReadFolder {directory {parent ""}} {
|
||||||
global tree dir lexers project
|
global tree dir lexers project
|
||||||
puts "Read the folder $directory"
|
# puts "Read the folder $directory"
|
||||||
set rList ""
|
set rList ""
|
||||||
if {[catch {cd $directory}] != 0} {
|
if {[catch {cd $directory}] != 0} {
|
||||||
return ""
|
return ""
|
||||||
@@ -388,33 +483,58 @@ namespace eval FileOper {
|
|||||||
# Delete emty last line
|
# Delete emty last line
|
||||||
if {[$txt get {end-1 line} end] eq "\n" || [$txt get {end-1 line} end] eq "\r\n"} {
|
if {[$txt get {end-1 line} end] eq "\n" || [$txt get {end-1 line} end] eq "\r\n"} {
|
||||||
$txt delete {end-1 line} end
|
$txt delete {end-1 line} end
|
||||||
puts ">[$txt get {end-1 line} end]<"
|
# puts ">[$txt get {end-1 line} end]<"
|
||||||
}
|
}
|
||||||
$txt see 1.0
|
$txt see 1.0
|
||||||
}
|
}
|
||||||
|
|
||||||
proc Edit {fileFullPath {nbEditor .frmWork.nbEditor}} {
|
proc Edit {fileFullPath {nbEditor .frmWork.nbEditor}} {
|
||||||
global tree
|
global tree
|
||||||
|
puts "$fileFullPath"
|
||||||
if {[file exists $fileFullPath] == 0} {
|
if {[file exists $fileFullPath] == 0} {
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
puts "$fileFullPath File type [::fileutil::magic::filetype $fileFullPath]"
|
# puts "$fileFullPath File type [::fileutil::magic::filetype $fileFullPath]"
|
||||||
set fileType [FileOper::GetFileMimeType $fileFullPath]
|
set fileType [FileOper::GetFileMimeType $fileFullPath]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# puts "$fileType <<<<<<<<<<<"
|
||||||
|
|
||||||
switch $fileType {
|
switch $fileType {
|
||||||
"text" {
|
"text" {
|
||||||
# return text
|
# return text
|
||||||
}
|
}
|
||||||
"image" {
|
"image" {
|
||||||
# return image
|
}
|
||||||
|
"binary" {
|
||||||
|
set answer [tk_messageBox -message [::msgcat::mc "The file looks like a binary file. Open anyway?"] \
|
||||||
|
-icon question -type yesno]
|
||||||
|
switch $answer {
|
||||||
|
yes {}
|
||||||
|
no {return}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
false {
|
false {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
# Проверяем размер файла и если он больше 1мб вывести предупреждение
|
||||||
|
# puts " File size = [file size $fileFullPath]"
|
||||||
|
if {[file size $fileFullPath] > 1000000} {
|
||||||
|
set answer [tk_messageBox -message [::msgcat::mc "The file size to big. Open anyway?"] \
|
||||||
|
-detail [GetFileAttr $fileFullPath "size"] \
|
||||||
|
-icon question -type yesno]
|
||||||
|
switch $answer {
|
||||||
|
yes {}
|
||||||
|
no {return}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
set filePath [file dirname $fileFullPath]
|
set filePath [file dirname $fileFullPath]
|
||||||
set fileName [file tail $fileFullPath]
|
set fileName [file tail $fileFullPath]
|
||||||
regsub -all {\.|/|\\|\s} $fileFullPath "_" itemName
|
|
||||||
|
regsub -all {\.|/|\\|\s|:} $fileFullPath "_" itemName
|
||||||
|
set itemName [string tolower $itemName]
|
||||||
set itemName "$nbEditor.$itemName"
|
set itemName "$nbEditor.$itemName"
|
||||||
set treeItemName [Tree::InsertItem $tree {} $fileFullPath "file" $fileName]
|
set treeItemName [Tree::InsertItem $tree {} $fileFullPath "file" $fileName]
|
||||||
|
|
||||||
@@ -423,6 +543,11 @@ namespace eval FileOper {
|
|||||||
|
|
||||||
if {[winfo exists $itemName] == 0} {
|
if {[winfo exists $itemName] == 0} {
|
||||||
NB::InsertItem $nbEditor $fileFullPath "file"
|
NB::InsertItem $nbEditor $fileFullPath "file"
|
||||||
|
if {$fileType eq "image"} {
|
||||||
|
ImageViewer $fileFullPath $itemName $itemName
|
||||||
|
return $itemName
|
||||||
|
}
|
||||||
|
|
||||||
Editor::Editor $fileFullPath $nbEditor $itemName
|
Editor::Editor $fileFullPath $nbEditor $itemName
|
||||||
ReadFile $fileFullPath $itemName
|
ReadFile $fileFullPath $itemName
|
||||||
$itemName.frmText.t highlight 1.0 end
|
$itemName.frmText.t highlight 1.0 end
|
||||||
@@ -430,6 +555,11 @@ namespace eval FileOper {
|
|||||||
$itemName.frmText.t see 1.1
|
$itemName.frmText.t see 1.1
|
||||||
}
|
}
|
||||||
$nbEditor select $itemName
|
$nbEditor select $itemName
|
||||||
|
focus -force $itemName
|
||||||
|
if {$fileType eq "image"} {
|
||||||
|
# ImageViewer $fileFullPath $itemName $itemName
|
||||||
|
return $itemName
|
||||||
|
}
|
||||||
Editor::ReadStructure $itemName.frmText.t $treeItemName
|
Editor::ReadStructure $itemName.frmText.t $treeItemName
|
||||||
GetVariablesFromFile $fileFullPath
|
GetVariablesFromFile $fileFullPath
|
||||||
$itemName.frmText.t.t mark set insert 1.0
|
$itemName.frmText.t.t mark set insert 1.0
|
||||||
@@ -437,6 +567,8 @@ namespace eval FileOper {
|
|||||||
focus -force $itemName.frmText.t.t
|
focus -force $itemName.frmText.t.t
|
||||||
.frmStatus.lblSize configure -text [GetFileAttr $fileFullPath "size"]
|
.frmStatus.lblSize configure -text [GetFileAttr $fileFullPath "size"]
|
||||||
.frmStatus.lblEncoding configure -text [GetFileMimeType $fileFullPath "charset"]
|
.frmStatus.lblEncoding configure -text [GetFileMimeType $fileFullPath "charset"]
|
||||||
|
# puts ">> $itemName"
|
||||||
|
|
||||||
return $itemName
|
return $itemName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
50
lib/git.tcl
50
lib/git.tcl
@@ -11,7 +11,29 @@
|
|||||||
|
|
||||||
namespace eval Git {
|
namespace eval Git {
|
||||||
variable gitCommand
|
variable gitCommand
|
||||||
|
|
||||||
|
# Определим путь до команды git в зависимсти от платформы
|
||||||
|
proc CommandPathSetting {} {
|
||||||
|
global cfgVariables tcl_platform
|
||||||
|
if {$cfgVariables(gitCommand) == ""} {
|
||||||
|
if {$tcl_platform(platform) eq "windows"} {
|
||||||
|
set cmd {where git}
|
||||||
|
} else {
|
||||||
|
set cmd {which git}
|
||||||
|
}
|
||||||
|
if {[catch {exec {*}$cmd} git_path]} {
|
||||||
|
puts "Git не найден в системе"
|
||||||
|
set cfgVariables(gitCommand) ""
|
||||||
|
return
|
||||||
|
}
|
||||||
|
set git_path [string trim $git_path]
|
||||||
|
set first_path [lindex [split $git_path "\n"] 0]
|
||||||
|
|
||||||
|
# puts "Git найден: $first_path"
|
||||||
|
set cfgVariables(gitCommand) $first_path
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
proc GetConfig {option} {
|
proc GetConfig {option} {
|
||||||
global activeProject cfgVariables
|
global activeProject cfgVariables
|
||||||
set confOptions {
|
set confOptions {
|
||||||
@@ -69,8 +91,8 @@ namespace eval Git {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch $cmd pipe
|
catch $cmd pipe
|
||||||
puts $cmd
|
# puts $cmd
|
||||||
puts $pipe
|
# puts $pipe
|
||||||
if [regexp -nocase -- {^error:} $pipe match] {
|
if [regexp -nocase -- {^error:} $pipe match] {
|
||||||
ShowMessage "Command: '$cmd' error" $pipe
|
ShowMessage "Command: '$cmd' error" $pipe
|
||||||
return
|
return
|
||||||
@@ -100,7 +122,7 @@ namespace eval Git {
|
|||||||
} else {
|
} else {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
puts $activeProject
|
# puts $activeProject
|
||||||
lappend cmd $cfgVariables(gitCommand)
|
lappend cmd $cfgVariables(gitCommand)
|
||||||
lappend cmd "branch"
|
lappend cmd "branch"
|
||||||
# lappend cmd "-s"
|
# lappend cmd "-s"
|
||||||
@@ -145,7 +167,7 @@ namespace eval Git {
|
|||||||
lappend cmd "--"
|
lappend cmd "--"
|
||||||
lappend cmd $activeProject
|
lappend cmd $activeProject
|
||||||
catch $cmd pipe
|
catch $cmd pipe
|
||||||
puts $cmd
|
# puts $cmd
|
||||||
if [regexp -nocase -- {^fatal:} $pipe match] {
|
if [regexp -nocase -- {^fatal:} $pipe match] {
|
||||||
ShowMessage "Command: '$cmd' error" $pipe
|
ShowMessage "Command: '$cmd' error" $pipe
|
||||||
return
|
return
|
||||||
@@ -167,7 +189,7 @@ namespace eval Git {
|
|||||||
lappend cmd "--"
|
lappend cmd "--"
|
||||||
lappend cmd [file join $activeProject [string trimleft $f "../"]]
|
lappend cmd [file join $activeProject [string trimleft $f "../"]]
|
||||||
catch $cmd pipe
|
catch $cmd pipe
|
||||||
puts $cmd
|
# puts $cmd
|
||||||
if [regexp -nocase -- {^fatal:} $pipe match] {
|
if [regexp -nocase -- {^fatal:} $pipe match] {
|
||||||
ShowMessage "Command: '$cmd' error" $pipe
|
ShowMessage "Command: '$cmd' error" $pipe
|
||||||
return
|
return
|
||||||
@@ -228,7 +250,7 @@ namespace eval Git {
|
|||||||
# set cmd exec
|
# set cmd exec
|
||||||
cd $activeProject
|
cd $activeProject
|
||||||
set url [Git::GetConfig remote.origin.url]
|
set url [Git::GetConfig remote.origin.url]
|
||||||
puts $url
|
# puts $url
|
||||||
if [regexp -nocase -all -- {^(http|https)://(.+)} $url match proto address] {
|
if [regexp -nocase -all -- {^(http|https)://(.+)} $url match proto address] {
|
||||||
Git::AuthorizationDialog "[::msgcat::mc "Authorization required"] [::msgcat::mc "for"] Git" $url
|
Git::AuthorizationDialog "[::msgcat::mc "Authorization required"] [::msgcat::mc "for"] Git" $url
|
||||||
} else {
|
} else {
|
||||||
@@ -248,7 +270,7 @@ namespace eval Git {
|
|||||||
# lappend cmd "$activeProject"
|
# lappend cmd "$activeProject"
|
||||||
# puts "$cmd"
|
# puts "$cmd"
|
||||||
catch $cmd pipe
|
catch $cmd pipe
|
||||||
puts $pipe
|
# puts $pipe
|
||||||
if [regexp -nocase -- {^fatal:} $pipe match] {
|
if [regexp -nocase -- {^fatal:} $pipe match] {
|
||||||
ShowMessage "Command: '$cmd' error" $pipe
|
ShowMessage "Command: '$cmd' error" $pipe
|
||||||
return
|
return
|
||||||
@@ -301,7 +323,7 @@ namespace eval Git {
|
|||||||
$w.body.lCommit delete $itemNumber
|
$w.body.lCommit delete $itemNumber
|
||||||
}
|
}
|
||||||
catch $cmd pipe
|
catch $cmd pipe
|
||||||
puts $cmd
|
# puts $cmd
|
||||||
$w.body.t delete 1.0 end
|
$w.body.t delete 1.0 end
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,7 +379,7 @@ namespace eval Git {
|
|||||||
$w.body.t delete 1.0 end
|
$w.body.t delete 1.0 end
|
||||||
set i 0
|
set i 0
|
||||||
foreach line [Git::Diff $fileName] {
|
foreach line [Git::Diff $fileName] {
|
||||||
puts $line
|
# puts $line
|
||||||
if {$i > 3} {
|
if {$i > 3} {
|
||||||
$w.body.t inser end "$line\n"
|
$w.body.t inser end "$line\n"
|
||||||
}
|
}
|
||||||
@@ -381,7 +403,7 @@ namespace eval Git {
|
|||||||
$w.body.lBox delete $itemNumber
|
$w.body.lBox delete $itemNumber
|
||||||
}
|
}
|
||||||
catch $cmd pipe
|
catch $cmd pipe
|
||||||
puts $cmd
|
# puts $cmd
|
||||||
$w.body.t delete 1.0 end
|
$w.body.t delete 1.0 end
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -396,7 +418,7 @@ namespace eval Git {
|
|||||||
puts $cmd
|
puts $cmd
|
||||||
|
|
||||||
catch $cmd pipe
|
catch $cmd pipe
|
||||||
puts $pipe
|
# puts $pipe
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
proc Config {repo user email} {
|
proc Config {repo user email} {
|
||||||
@@ -407,7 +429,7 @@ namespace eval Git {
|
|||||||
lappend cmd "config"
|
lappend cmd "config"
|
||||||
lappend cmd $repo
|
lappend cmd $repo
|
||||||
lappend cmd $dir
|
lappend cmd $dir
|
||||||
puts $cmd
|
# puts $cmd
|
||||||
|
|
||||||
# catch $cmd pipe
|
# catch $cmd pipe
|
||||||
# puts $pipe
|
# puts $pipe
|
||||||
@@ -425,7 +447,7 @@ namespace eval Git {
|
|||||||
lappend cmd $cfgVariables(gitCommand)
|
lappend cmd $cfgVariables(gitCommand)
|
||||||
lappend cmd "init"
|
lappend cmd "init"
|
||||||
lappend cmd $activeProject
|
lappend cmd $activeProject
|
||||||
puts $cmd
|
# puts $cmd
|
||||||
|
|
||||||
catch $cmd pipe
|
catch $cmd pipe
|
||||||
if [regexp -nocase -- {^fatal:} $pipe match] {
|
if [regexp -nocase -- {^fatal:} $pipe match] {
|
||||||
|
|||||||
19
lib/gui.tcl
19
lib/gui.tcl
@@ -23,12 +23,14 @@ wm overrideredirect . 0
|
|||||||
|
|
||||||
bind . <Control-q> Quit
|
bind . <Control-q> Quit
|
||||||
bind . <Control-Q> Quit
|
bind . <Control-Q> Quit
|
||||||
|
bind . <Control-Cyrillic_shorti> Quit
|
||||||
bind . <Control-eacute> Quit
|
bind . <Control-eacute> Quit
|
||||||
bind . <Insert> Add
|
bind . <Insert> Add
|
||||||
bind . <Delete> Del
|
bind . <Delete> Del
|
||||||
bind . <F1> ShowHelpDialog
|
bind . <F1> ShowHelpDialog
|
||||||
bind . <Control-n> Editor::New
|
bind . <Control-n> Editor::New
|
||||||
bind . <Control-N> Editor::New
|
bind . <Control-N> Editor::New
|
||||||
|
bind . <Control-Cyrillic_te> Editor::New
|
||||||
bind . <Control-o> {
|
bind . <Control-o> {
|
||||||
set filePath [FileOper::OpenDialog]
|
set filePath [FileOper::OpenDialog]
|
||||||
if {$filePath != ""} {
|
if {$filePath != ""} {
|
||||||
@@ -41,21 +43,30 @@ bind . <Control-O> {
|
|||||||
FileOper::Edit $filePath
|
FileOper::Edit $filePath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bind . <Control-k> {
|
bind . <Alt-k> {
|
||||||
set folderPath [FileOper::OpenFolderDialog]
|
set folderPath [FileOper::OpenFolderDialog]
|
||||||
if {$folderPath != ""} {
|
if {$folderPath != ""} {
|
||||||
FileOper::ReadFolder $folderPath
|
FileOper::ReadFolder $folderPath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bind . <Control-K> {
|
bind . <Alt-K> {
|
||||||
set folderPath [FileOper::OpenFolderDialog]
|
set folderPath [FileOper::OpenFolderDialog]
|
||||||
if {$folderPath != ""} {
|
if {$folderPath != ""} {
|
||||||
FileOper::ReadFolder $folderPath
|
FileOper::ReadFolder $folderPath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bind . <Alt-Cyrillic_el> {
|
||||||
|
set folderPath [FileOper::OpenFolderDialog]
|
||||||
|
if {$folderPath != ""} {
|
||||||
|
FileOper::ReadFolder $folderPath
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bind . <Control-s> {FileOper::Save}
|
bind . <Control-s> {FileOper::Save}
|
||||||
bind . <Control-S> {FileOper::Save}
|
bind . <Control-S> {FileOper::Save}
|
||||||
|
bind . <Control-Cyrillic_hardsign> {FileOper::Save}
|
||||||
bind . <Alt-p> {ViewFilesTree true}
|
bind . <Alt-p> {ViewFilesTree true}
|
||||||
|
bind . <Alt-Cyrillic_ze> {ViewFilesTree true}
|
||||||
bind . <Button-3> {catch [PopupMenu %X %Y]}
|
bind . <Button-3> {catch [PopupMenu %X %Y]}
|
||||||
|
|
||||||
#ttk::style configure TPanedwindow -background blue
|
#ttk::style configure TPanedwindow -background blue
|
||||||
@@ -134,11 +145,15 @@ grid .frmBody.panel -row 0 -column 1 -sticky nesw
|
|||||||
grid columnconfigure .frmBody .frmBody.panel -weight 1
|
grid columnconfigure .frmBody .frmBody.panel -weight 1
|
||||||
grid rowconfigure .frmBody .frmBody.panel -weight 1
|
grid rowconfigure .frmBody .frmBody.panel -weight 1
|
||||||
|
|
||||||
|
# Панель инстурментов
|
||||||
ttk::button $frmTool.btn_tree -command ToolBtnTreePress -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_search -command FileOper::FindInFiles -image search_24x24
|
||||||
ttk::button $frmTool.btn_git -command Git::Dialog -image git_24x24
|
ttk::button $frmTool.btn_git -command Git::Dialog -image git_24x24
|
||||||
|
ttk::button $frmTool.btn_settings -command Settings -image settings_24x24
|
||||||
|
|
||||||
pack $frmTool.btn_tree $frmTool.btn_search $frmTool.btn_git -side top -padx 1 -pady 1
|
pack $frmTool.btn_tree $frmTool.btn_search $frmTool.btn_git -side top -padx 1 -pady 1
|
||||||
|
pack $frmTool.btn_settings -side bottom -padx 1 -pady 10
|
||||||
|
|
||||||
# #label $frmTool.lbl_logo -image tcl
|
# #label $frmTool.lbl_logo -image tcl
|
||||||
# pack $frmTool.btn_quit -side bottom -padx 5 -pady 5
|
# pack $frmTool.btn_quit -side bottom -padx 5 -pady 5
|
||||||
# #pack $frmTool.lbl_logo -side bottom -padx 5 -pady 5
|
# #pack $frmTool.lbl_logo -side bottom -padx 5 -pady 5
|
||||||
|
|||||||
@@ -190,5 +190,25 @@ namespace eval Highlight {} {
|
|||||||
ctext::addHighlightClassForRegexp $txt namespaces #0093ff {->|\+\+|::}
|
ctext::addHighlightClassForRegexp $txt namespaces #0093ff {->|\+\+|::}
|
||||||
ctext::addHighlightClass $txt bool #3e803b {null false true}
|
ctext::addHighlightClass $txt bool #3e803b {null false true}
|
||||||
}
|
}
|
||||||
|
proc ExecuteColorized {txt} {
|
||||||
|
# ctext::addHighlightClassForRegexp $txt flags orange {\s-[a-zA-Z]+}
|
||||||
|
# ctext::addHighlightClass $txt stackControl #19a2a6 [info commands]
|
||||||
|
# ctext::addHighlightClass $txt widgets #9d468d [list canvas ctext button entry label text labelframe frame toplevel scrollbar checkbutton canvas listbox menu menubar menubutton radiobutton scale entry message tk_chooseDir tk_getSaveFile tk_getOpenFile tk_chooseColor tk_optionMenu ttk::button ttk::checkbutton ttk::combobox ttk::entry ttk::frame ttk::intro ttk::label ttk::labelframe ttk::menubutton ttk::treeview ttk::notebook ttk::panedwindow ttk::progressbar ttk::radiobutton ttk::scale ttk::scrollbar ttk::separator ttk::sizegrip ttk::spinbox ]
|
||||||
|
# ctext::addHighlightClassWithOnlyCharStart $txt vars #4471ca "\$"
|
||||||
|
# ctext::addHighlightClass $txt variable_funcs gold {set global variable unset}
|
||||||
|
# # ctext::addHighlightClassForSpecialChars $txt brackets green {[]{}()}
|
||||||
|
# ctext::addHighlightClassForRegexp $txt namespaces #4f64ff {::}
|
||||||
|
# ctext::addHighlightClassForRegexp $txt qoute #b84a0c {("|'|`).+("|'|`)}
|
||||||
|
# ctext::addHighlightClassForRegexp $txt colors #68ceff {(#)(\w)+?(\s|$)}
|
||||||
|
# ctext::addHighlightClassForRegexp $txt comments #666666 {(^|;)\s*(#)[^\n\r]*}
|
||||||
|
# ctext::addHighlightClass $txt bool #3e803b {null false true}
|
||||||
|
# ctext::addHighlightClassForRegexp $txt paths lightblue {(\s)([\w]+)(=)}
|
||||||
|
# ctext::addHighlightClassForSpecialChars $txt tags lightgreen {<>/}
|
||||||
|
# ctext::addHighlightClassForRegexp $txt tags #199100 {/.+\s}
|
||||||
|
ctext::addHighlightClassForRegexp $txt gopaths lightblue {(.+?):(\d+):(\d+):}
|
||||||
|
ctext::addHighlightClassForRegexp $txt paths lightblue {(\\|/|\.|^)((\w)|(\.)|(/)|([\.\w]))+?\s}
|
||||||
|
ctext::addHighlightClass $txt compile_errors #ff5050 {error Error ERROR invalid undefined cannot}
|
||||||
|
ctext::addHighlightClassForRegexp $txt url lightblue {\w+://\w.+\w+}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1912,4 +1912,38 @@ image create photo j2_16x12 -data {
|
|||||||
waYDtkPwRhMJCQAAcy6XQBVVAwTH2sGQ25vNaAwYtjCvkcjhE5Ysd1Cwe/gmifh0nQMAwBvJ5H54
|
waYDtkPwRhMJCQAAcy6XQBVVAwTH2sGQ25vNaAwYtjCvkcjhE5Ysd1Cwe/gmifh0nQMAwBvJ5H54
|
||||||
5nEG7+28M9SARyoW37c7A72MxzFpr/Dd1sUKRxpZbJg7joMDAwDgDzlS9ta5m7mUAAAAAElFTkSu
|
5nEG7+28M9SARyoW37c7A72MxzFpr/Dd1sUKRxpZbJg7joMDAwDgDzlS9ta5m7mUAAAAAElFTkSu
|
||||||
QmCC
|
QmCC
|
||||||
}
|
}
|
||||||
|
image create photo execute_11x11 -data {
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAAAsAAAALCAYAAACprHcmAAABg2lDQ1BJQ0MgcHJvZmlsZQAAKJF9
|
||||||
|
kT1Iw1AUhU9TpVIqDnYQUclQneyiIo5ahSJUCLVCqw4mL/2DJg1Jiouj4Fpw8Gex6uDirKuDqyAI
|
||||||
|
/oC4C06KLlLifUmhRYwPLu/jvHcO990HCI0K06yuWUDTbTOdTIjZ3KoYekUYw1QjiMrMMuYkKQXf
|
||||||
|
9XWPAN/v4jzL/96fq1fNWwwIiMSzzDBt4g3i6U3b4LxPHGUlWSU+Jx43qUHiR64rHr9xLros8Myo
|
||||||
|
mUnPE0eJxWIHKx3MSqZGPEUcUzWd8oWsxyrnLc5apcZaffIXRvL6yjLXqYaQxCKWIEGEghrKqMBG
|
||||||
|
nHadFAtpOk/4+Addv0QuhVxlMHIsoAoNsusH/4Pfs7UKkxNeUiQBdL84zscoENoFmnXH+T52nOYJ
|
||||||
|
EHwGrvS2v9oAZj5Jr7e12BHQtw1cXLc1ZQ+43AEGngzZlF0pSCUUCsD7GX1TDui/BcJr3txa5zh9
|
||||||
|
ADI0q9QNcHAIjBUpe93n3T2dc/v3Tmt+P5frcrXBnzRwAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI
|
||||||
|
WXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH6QodCiMdxWTpZwAAABl0RVh0Q29tbWVudABDcmVhdGVk
|
||||||
|
IHdpdGggR0lNUFeBDhcAAABHSURBVBjTjY/BDQAwCAKNUzleux1b2Y+PxgiRJ7kjalYBkADSRLwX
|
||||||
|
SvCpZIKzlUlwdWMXJFw5Kzgi7mr5A/XyBI4wA9kzFHrskxvBNKQinAAAAABJRU5ErkJggg==
|
||||||
|
}
|
||||||
|
image create photo settings_24x24 -data {
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABg2lDQ1BJQ0MgcHJvZmlsZQAAKJF9
|
||||||
|
kT1Iw1AUhU9TpVIqDnYQUclQneyiIo5ahSJUCLVCqw4mL/2DJg1Jiouj4Fpw8Gex6uDirKuDqyAI
|
||||||
|
/oC4C06KLlLifUmhRYwPLu/jvHcO990HCI0K06yuWUDTbTOdTIjZ3KoYekUYw1QjiMrMMuYkKQXf
|
||||||
|
9XWPAN/v4jzL/96fq1fNWwwIiMSzzDBt4g3i6U3b4LxPHGUlWSU+Jx43qUHiR64rHr9xLros8Myo
|
||||||
|
mUnPE0eJxWIHKx3MSqZGPEUcUzWd8oWsxyrnLc5apcZaffIXRvL6yjLXqYaQxCKWIEGEghrKqMBG
|
||||||
|
nHadFAtpOk/4+Addv0QuhVxlMHIsoAoNsusH/4Pfs7UKkxNeUiQBdL84zscoENoFmnXH+T52nOYJ
|
||||||
|
EHwGrvS2v9oAZj5Jr7e12BHQtw1cXLc1ZQ+43AEGngzZlF0pSCUUCsD7GX1TDui/BcJr3txa5zh9
|
||||||
|
ADI0q9QNcHAIjBUpe93n3T2dc/v3Tmt+P5frcrXBnzRwAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI
|
||||||
|
WXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH6QodESQY6jzHvgAAABl0RVh0Q29tbWVudABDcmVhdGVk
|
||||||
|
IHdpdGggR0lNUFeBDhcAAAHySURBVEjHrZZPSFVREMZ/iomaBm1SApFHIEoL+6e7ROHTFkEbaWNb
|
||||||
|
95YgSFiLyECIoJXtIkEXZqSrIoYwQiEScVOCguQylCzKpyFBm3PjvcO5f8L3wV3cufPNnHNmvjO3
|
||||||
|
jAwws06gxTN/lTSfxq0gGx4BFz3bAVCdRizPmOBswFZlZg1HTmBm9UBVzOczafwyL9groAGYAJ4D
|
||||||
|
bcDDwPFE+AKMADPAdWAAaATOSfpdlMDM+oDZAvJPoC7jEf4CagveRySN/0tgZtXAKtBMabAH5CRt
|
||||||
|
RzUYyhj80D1pOA48KCzyQArhE9AlqVJSJXAeeJvC6TezY1GCXmAtxnEd6JD0LjJIWnWchRjOFtAj
|
||||||
|
6bDcETaAS8DLgPNdSXnfKOkPMBzw/wC0S1oq0oEL8jpAWIw7A0nLAfOypO3/UfKJBBGG+AdBJZtZ
|
||||||
|
DhgMEK4mJL8WsN0ws8tFSnYimwRqAoQfQJukLW/1jcB7oClmF7ckPYkSbAK5hJXmXV9HNWoH7gCn
|
||||||
|
U9R9KrquR4GpBOca4L57smJM0n7UptNuu6XCOvDY76KbntMC8C1DsDzwxrPdlrTv62AFuOeu6lZJ
|
||||||
|
3W5MPksIPgdckHTF1XAMeCrpRXAexPT6yYSddEj6eKSJJmk3IcFGqWby51AbSvpeqr+KPjcKC7GT
|
||||||
|
hfgXbteIc85F7RUAAAAASUVORK5CYII=
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
proc ImageViewer {f w node} {
|
proc ImageViewer {f w node} {
|
||||||
|
global factor cfgVariables
|
||||||
set factor($node) 1.0
|
set factor($node) 1.0
|
||||||
ttk::frame $w.f
|
ttk::frame $w.f
|
||||||
pack $w.f -side left -fill both -expand true
|
pack $w.f -side left -fill both -expand true
|
||||||
canvas $w.f.c -xscrollcommand "$w.f.x set" -yscrollcommand "$w.y set"
|
canvas $w.f.c -xscrollcommand "$w.f.x set" -yscrollcommand "$w.y set" -bg $cfgVariables(backGround)
|
||||||
ttk::scrollbar $w.f.x -ori hori -command "$w.f.c xview"
|
ttk::scrollbar $w.f.x -ori hori -command "$w.f.c xview"
|
||||||
ttk::scrollbar $w.y -ori vert -command "$w.f.c yview"
|
ttk::scrollbar $w.y -ori vert -command "$w.f.c yview"
|
||||||
|
|
||||||
@@ -20,15 +21,15 @@ proc ImageViewer {f w node} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc openImg {fn w node} {
|
proc openImg {fn w node} {
|
||||||
global im1
|
global im1 factor
|
||||||
set im1 [image create photo -file $fn]
|
set im1 [image create photo -file $fn]
|
||||||
#scale $w
|
scale $w $factor($node) $node
|
||||||
list [file size $fn] bytes, [image width $im1]x[image height $im1]
|
list [file size $fn] bytes, [image width $im1]x[image height $im1]
|
||||||
$w create image 1 1 -image $im1 -anchor nw -tag img
|
$w create image 1 1 -image $im1 -anchor nw -tag img
|
||||||
}
|
}
|
||||||
|
|
||||||
proc scale {w {n 1} node} {
|
proc scale {w {n 1} node} {
|
||||||
global im1 im2 factor noteBook tab_label
|
global im1 im2 factor tab_label
|
||||||
set factor($node) [expr {$factor($node) * $n}]
|
set factor($node) [expr {$factor($node) * $n}]
|
||||||
$w delete img
|
$w delete img
|
||||||
catch {image delete $im2}
|
catch {image delete $im2}
|
||||||
@@ -41,7 +42,8 @@ proc scale {w {n 1} node} {
|
|||||||
$im2 copy $im1 -subsample $f $f
|
$im2 copy $im1 -subsample $f $f
|
||||||
}
|
}
|
||||||
$w create image 1 1 -image $im2 -anchor nw -tag img
|
$w create image 1 1 -image $im2 -anchor nw -tag img
|
||||||
$noteBook itemconfigure $node -text "$tab_label (size x$factor($node))"
|
set noteBook [file extension $node]
|
||||||
|
# $noteBook itemconfigure $node -text "(size x$factor($node))"
|
||||||
$w config -scrollregion [$w bbox all]
|
$w config -scrollregion [$w bbox all]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,6 +54,7 @@ proc ImageBase64Encode {text} {
|
|||||||
{"GIF" {.gif}}
|
{"GIF" {.gif}}
|
||||||
{"JPEG" {.jpg}}
|
{"JPEG" {.jpg}}
|
||||||
{"BMP" {.bmp}}
|
{"BMP" {.bmp}}
|
||||||
|
{"SVG" {.svg}}
|
||||||
{"All files" *}
|
{"All files" *}
|
||||||
}
|
}
|
||||||
set img [tk_getOpenFile -initialdir $env(HOME) -filetypes $types -parent .]
|
set img [tk_getOpenFile -initialdir $env(HOME) -filetypes $types -parent .]
|
||||||
@@ -65,5 +68,3 @@ proc ImageBase64Encode {text} {
|
|||||||
$text insert [Position] "image create photo $name -data {\n$data\n}"
|
$text insert [Position] "image create photo $name -data {\n$data\n}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ proc GetFileMenu {m} {
|
|||||||
|
|
||||||
$m add separator
|
$m add separator
|
||||||
|
|
||||||
$m add command -label [::msgcat::mc "Open folder"] -accelerator "Ctrl+K" -command {
|
$m add command -label [::msgcat::mc "Open folder"] -accelerator "Alt+K" -command {
|
||||||
set folderPath [FileOper::OpenFolderDialog]
|
set folderPath [FileOper::OpenFolderDialog]
|
||||||
if {$folderPath != ""} {
|
if {$folderPath != ""} {
|
||||||
# set activeProject $folderPath
|
# set activeProject $folderPath
|
||||||
@@ -76,7 +76,8 @@ proc GetEditMenu {m} {
|
|||||||
$m add separator
|
$m add separator
|
||||||
$m add command -label [::msgcat::mc "Insert image"] -accelerator "Ctrl+I"\
|
$m add command -label [::msgcat::mc "Insert image"] -accelerator "Ctrl+I"\
|
||||||
-command ImageBase64Encode
|
-command ImageBase64Encode
|
||||||
|
$m add separator
|
||||||
|
$m add command -label [::msgcat::mc "Settings"] -command Settings
|
||||||
}
|
}
|
||||||
|
|
||||||
proc GetViewMenu {m} {
|
proc GetViewMenu {m} {
|
||||||
|
|||||||
@@ -59,12 +59,16 @@
|
|||||||
::msgcat::mcset en "Editor font bold"
|
::msgcat::mcset en "Editor font bold"
|
||||||
::msgcat::mcset en "Error open URL"
|
::msgcat::mcset en "Error open URL"
|
||||||
::msgcat::mcset en "Editor settings"
|
::msgcat::mcset en "Editor settings"
|
||||||
|
::msgcat::mcset en "Enter command for execute file"
|
||||||
::msgcat::mcset en "Exit"
|
::msgcat::mcset en "Exit"
|
||||||
::msgcat::mcset en "File"
|
::msgcat::mcset en "File"
|
||||||
::msgcat::mcset en "File already exists. Overwrite?"
|
::msgcat::mcset en "File already exists. Overwrite?"
|
||||||
::msgcat::mcset en "File modify"
|
::msgcat::mcset en "File modify"
|
||||||
::msgcat::mcset en "File was modifyed. Close?"
|
::msgcat::mcset en "File was modifyed. Close?"
|
||||||
::msgcat::mcset en "File was modifyed. Save?"
|
::msgcat::mcset en "File was modifyed. Save?"
|
||||||
|
::msgcat::mcset en "The file looks like a binary file. Open anyway?"
|
||||||
|
::msgcat::mcset en "The file looks like a image. Support not implemented yet."
|
||||||
|
::msgcat::mcset en "The file size to big. Open anyway?"
|
||||||
::msgcat::mcset en "File saved"
|
::msgcat::mcset en "File saved"
|
||||||
::msgcat::mcset en "Files"
|
::msgcat::mcset en "Files"
|
||||||
::msgcat::mcset en "Find"
|
::msgcat::mcset en "Find"
|
||||||
@@ -182,6 +186,3 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,7 @@
|
|||||||
::msgcat::mcset ru "Editor settings" "Настройки редактора"
|
::msgcat::mcset ru "Editor settings" "Настройки редактора"
|
||||||
::msgcat::mcset ru "Editor helpers" "Подсказки при вводе"
|
::msgcat::mcset ru "Editor helpers" "Подсказки при вводе"
|
||||||
::msgcat::mcset ru "Encode" "Перекодировка"
|
::msgcat::mcset ru "Encode" "Перекодировка"
|
||||||
|
::msgcat::mcset ru "Enter command for execute file" "Введите команду для запуска текущего файла"
|
||||||
::msgcat::mcset ru "Authorisation required" "Требуется авторизация"
|
::msgcat::mcset ru "Authorisation required" "Требуется авторизация"
|
||||||
::msgcat::mcset ru "Error open URL" "Ошибка открытия URL"
|
::msgcat::mcset ru "Error open URL" "Ошибка открытия URL"
|
||||||
::msgcat::mcset ru "Exit" "Выход"
|
::msgcat::mcset ru "Exit" "Выход"
|
||||||
@@ -88,6 +89,9 @@
|
|||||||
::msgcat::mcset ru "File was modifyed" "Файл был изменен"
|
::msgcat::mcset ru "File was modifyed" "Файл был изменен"
|
||||||
::msgcat::mcset ru "File modify" "Файл изменен"
|
::msgcat::mcset ru "File modify" "Файл изменен"
|
||||||
::msgcat::mcset ru "File saved" "Файл сохранен"
|
::msgcat::mcset ru "File saved" "Файл сохранен"
|
||||||
|
::msgcat::mcset ru "The file looks like a binary file. Open anyway?" "Файл похож на двоичный. Открыть все равно?"
|
||||||
|
::msgcat::mcset ru "The file looks like a image. Support not implemented yet." "Файл выглядит как изображение. Поддержка пока не реализована."
|
||||||
|
::msgcat::mcset ru "The file size to big. Open anyway?" "Файл большого размера. Открыть все равно?"
|
||||||
::msgcat::mcset ru "Find" "Найти"
|
::msgcat::mcset ru "Find" "Найти"
|
||||||
::msgcat::mcset ru "Found" "Найдено"
|
::msgcat::mcset ru "Found" "Найдено"
|
||||||
::msgcat::mcset ru "Find in files" "Найти в файлах"
|
::msgcat::mcset ru "Find in files" "Найти в файлах"
|
||||||
@@ -196,7 +200,7 @@
|
|||||||
::msgcat::mcset ru "Select directory" "Выбор директории"
|
::msgcat::mcset ru "Select directory" "Выбор директории"
|
||||||
::msgcat::mcset ru "Selected directory" "Директория"
|
::msgcat::mcset ru "Selected directory" "Директория"
|
||||||
::msgcat::mcset ru "Selection color" "Цвет выделения"
|
::msgcat::mcset ru "Selection color" "Цвет выделения"
|
||||||
::msgcat::mcset ru "Settings" "Установки"
|
::msgcat::mcset ru "Settings" "Настройки"
|
||||||
::msgcat::mcset ru "Statusbar" "Строка статуса"
|
::msgcat::mcset ru "Statusbar" "Строка статуса"
|
||||||
::msgcat::mcset ru "Show backup files" "Показывать временные файлы"
|
::msgcat::mcset ru "Show backup files" "Показывать временные файлы"
|
||||||
::msgcat::mcset ru "Show the Menu" "Показывать меню"
|
::msgcat::mcset ru "Show the Menu" "Показывать меню"
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ namespace eval NB {
|
|||||||
proc InsertItem {nb item type} {
|
proc InsertItem {nb item type} {
|
||||||
switch $type {
|
switch $type {
|
||||||
file {
|
file {
|
||||||
regsub -all {\.|/|\\|\s} $item "_" itemName
|
set item [string tolower $item]
|
||||||
|
regsub -all {\.|/|\\|\s|:} $item "_" itemName
|
||||||
|
# puts "$item -> $itemName"
|
||||||
if [winfo exists $nb.$itemName] {
|
if [winfo exists $nb.$itemName] {
|
||||||
set fm $nb.$itemName
|
set fm $nb.$itemName
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -254,11 +254,13 @@ proc FindImage {ext} {
|
|||||||
|
|
||||||
namespace eval Help {
|
namespace eval Help {
|
||||||
proc About {} {
|
proc About {} {
|
||||||
global projman
|
global projman tcl_version tk_version
|
||||||
set msg "Tcl/Tk project Manager\n\n"
|
set msg "Tcl/Tk project Manager\n\n"
|
||||||
append msg "Version: " $projman(Version) "\n" \
|
append msg "Version: " $projman(Version) "\n" \
|
||||||
"Release: " $projman(Release) "\n" \
|
"Release: " $projman(Release) "\n" \
|
||||||
"Build: " $projman(Build) "\n\n" \
|
"Build: " $projman(Build) "\n" \
|
||||||
|
"Tcl Version: " $tcl_version "\n" \
|
||||||
|
"Tk Version: " $tk_version "\n\n" \
|
||||||
"Author: " $projman(Author) "\n" \
|
"Author: " $projman(Author) "\n" \
|
||||||
"Home page: " $projman(Homepage)
|
"Home page: " $projman(Homepage)
|
||||||
# foreach name [array names projman] {
|
# foreach name [array names projman] {
|
||||||
@@ -277,17 +279,17 @@ namespace eval Help {
|
|||||||
proc SearchVariable {txt} {
|
proc SearchVariable {txt} {
|
||||||
global fileStructure project variables
|
global fileStructure project variables
|
||||||
set varName [$txt get {insert wordstart} {insert wordend}]
|
set varName [$txt get {insert wordstart} {insert wordend}]
|
||||||
puts ">>>$varName<<<"
|
# puts ">>>$varName<<<"
|
||||||
if {[info exists project] == 0} {return}
|
if {[info exists project] == 0} {return}
|
||||||
foreach f [array names project] {
|
foreach f [array names project] {
|
||||||
puts "--$f"
|
# puts "--$f"
|
||||||
puts "----"
|
# puts "----"
|
||||||
foreach a $project($f) {
|
foreach a $project($f) {
|
||||||
puts "-----$variables($a)"
|
# puts "-----$variables($a)"
|
||||||
foreach b $variables($a) {
|
foreach b $variables($a) {
|
||||||
puts "------$b -- [lindex $b 0]"
|
# puts "------$b -- [lindex $b 0]"
|
||||||
if {$varName eq [lindex $b 0]} {
|
if {$varName eq [lindex $b 0]} {
|
||||||
puts "УРААААААА $varName = $b в файле $a \n\t [lindex $b 0]"
|
# puts "УРААААААА $varName = $b в файле $a \n\t [lindex $b 0]"
|
||||||
# FindVariablesDialog $txt "$varName: \[...\][file tail $a]"
|
# FindVariablesDialog $txt "$varName: \[...\][file tail $a]"
|
||||||
lappend l [list $varName [lindex $b 1] $a]
|
lappend l [list $varName [lindex $b 1] $a]
|
||||||
}
|
}
|
||||||
@@ -355,7 +357,7 @@ proc FindVariablesDialog {txt args} {
|
|||||||
foreach { word } $args {
|
foreach { word } $args {
|
||||||
foreach lst $word {
|
foreach lst $word {
|
||||||
# set l [split $lst " "]
|
# set l [split $lst " "]
|
||||||
puts "[lindex $lst 0] -[lindex $lst 1] -[lindex $lst 2]"
|
# puts "[lindex $lst 0] -[lindex $lst 1] -[lindex $lst 2]"
|
||||||
# lappend l2 [lindex $l 0] [lindex $l 1] [file tail [lindex $l 2]]
|
# lappend l2 [lindex $l 0] [lindex $l 1] [file tail [lindex $l 2]]
|
||||||
# $win.lBox insert {} end -values $lst -text {1 2 3}
|
# $win.lBox insert {} end -values $lst -text {1 2 3}
|
||||||
$win.lBox insert end "[lindex $lst 0] > [lindex $lst 1] > [lindex $lst 2]\n"
|
$win.lBox insert end "[lindex $lst 0] > [lindex $lst 1] > [lindex $lst 2]\n"
|
||||||
@@ -441,7 +443,7 @@ proc SearchStringInFolder {str} {
|
|||||||
if {$tcl_platform(platform) == "windows"} {
|
if {$tcl_platform(platform) == "windows"} {
|
||||||
} elseif {$tcl_platform(platform) == "mac"} {
|
} elseif {$tcl_platform(platform) == "mac"} {
|
||||||
} elseif {$tcl_platform(platform) == "unix"} {
|
} elseif {$tcl_platform(platform) == "unix"} {
|
||||||
puts "$cfgVariables(searchCommand) $cfgVariables(searchCommandOptions) $str $activeProject"
|
# puts "$cfgVariables(searchCommand) $cfgVariables(searchCommandOptions) $str $activeProject"
|
||||||
# Составляем строку (точнее список) для запуска команды
|
# Составляем строку (точнее список) для запуска команды
|
||||||
set cmd exec
|
set cmd exec
|
||||||
regsub -all {\[} $str {\\[} str
|
regsub -all {\[} $str {\\[} str
|
||||||
@@ -714,3 +716,411 @@ proc AddRecentEditedFolder {path} {
|
|||||||
}
|
}
|
||||||
.frmMenu.mnuFile.m.openRecent add command -label $path -command [list OpenRecentProject $path]
|
.frmMenu.mnuFile.m.openRecent add command -label $path -command [list OpenRecentProject $path]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ================== OLD ====================
|
||||||
|
proc launchBrowser {url} {
|
||||||
|
global tcl_platform
|
||||||
|
if {$tcl_platform(platform) eq "windows"} {
|
||||||
|
set command [list {*}[auto_execok start] {}]
|
||||||
|
if {[file isdirectory $url]} {
|
||||||
|
set url [file nativename [file join $url .]]
|
||||||
|
}
|
||||||
|
} elseif {$tcl_platform(os) eq "Darwin"} {
|
||||||
|
set command [list open]
|
||||||
|
} else {
|
||||||
|
set command [list xdg-open]
|
||||||
|
}
|
||||||
|
exec {*}$command $url &
|
||||||
|
}
|
||||||
|
## EXEC EXTERNAL BROWSER AND GOTO URL ##
|
||||||
|
proc GoToURL {url} {
|
||||||
|
global env tcl_platform
|
||||||
|
if {$tcl_platform(platform) == "windows"} {
|
||||||
|
set pipe [open "|iexplore $url" "r"]
|
||||||
|
} elseif {$tcl_platform(platform) == "mac"} {
|
||||||
|
set pipe [open "|iexplore $url" "r"]
|
||||||
|
} elseif {$tcl_platform(platform) == "unix"} {
|
||||||
|
#$env(BROWSER)
|
||||||
|
#set pipe [open "|$env(BROWSER) $url" "r"]
|
||||||
|
launchBrowser $url
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fileevent $pipe readable
|
||||||
|
fconfigure $pipe -buffering none -blocking no
|
||||||
|
}
|
||||||
|
## MAKING TAR ARCHIVE ##
|
||||||
|
proc MakeTGZ {} {
|
||||||
|
global activeProject tgzDir tgzNamed workDir projDir env tcl_platform
|
||||||
|
if {$activeProject == ""} {
|
||||||
|
set answer [tk_messageBox\
|
||||||
|
-message [::msgcat::mc "Not found active project"]\
|
||||||
|
-type ok -icon warning\
|
||||||
|
-title [::msgcat::mc "Warning"]]
|
||||||
|
case $answer {
|
||||||
|
ok {return 0}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FileDialog tree save_all
|
||||||
|
set file [open [file join $workDir $activeProject.proj] r]
|
||||||
|
while {[gets $file line]>=0} {
|
||||||
|
scan $line "%s" keyWord
|
||||||
|
set string [string range $line [string first "\"" $line] [string last "\"" $line]]
|
||||||
|
set string [string trim $string "\""]
|
||||||
|
if {$keyWord == "ProjectDirName"} {
|
||||||
|
set dir "$string"
|
||||||
|
}
|
||||||
|
if {$keyWord == "ProjectVersion"} {
|
||||||
|
set version "$string"
|
||||||
|
}
|
||||||
|
if {$keyWord == "ProjectRelease"} {
|
||||||
|
set release "$string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close $file
|
||||||
|
set res [split $tgzNamed "-"]
|
||||||
|
set name [lindex $res 0]
|
||||||
|
set ver [lindex $res 1]
|
||||||
|
set rel [lindex $res 2]
|
||||||
|
if {$name == "projectName"} {
|
||||||
|
set name $activeProject
|
||||||
|
}
|
||||||
|
if {$ver == "version"} {
|
||||||
|
append name "-$version"
|
||||||
|
}
|
||||||
|
if {$rel == "release"} {
|
||||||
|
append name "-$release"
|
||||||
|
}
|
||||||
|
# multiplatform featuring #
|
||||||
|
if {$tcl_platform(platform) == "windows"} {
|
||||||
|
append name ".zip"
|
||||||
|
} elseif {$tcl_platform(platform) == "mac"} {
|
||||||
|
append name ".zip"
|
||||||
|
} elseif {$tcl_platform(platform) == "unix"} {
|
||||||
|
append name ".tar.gz"
|
||||||
|
}
|
||||||
|
catch {cd $projDir} res
|
||||||
|
if {[file exists [file join $tgzDir $name]] == 1} {
|
||||||
|
set answer [tk_messageBox\
|
||||||
|
-message "[::msgcat::mc "File already exists. Overwrite?"] \"$name\" ?"\
|
||||||
|
-type yesno -icon question -default yes\
|
||||||
|
-title [::msgcat::mc "Question"]]
|
||||||
|
case $answer {
|
||||||
|
yes {file delete [file join $tgzDir $name]}
|
||||||
|
no {return 0}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# multiplatform featuring #
|
||||||
|
if {$tcl_platform(platform) == "windows"} {
|
||||||
|
catch [exec pkzip -r -p [file join $tgzDir $name] [file join $activeProject *]] err
|
||||||
|
} elseif {$tcl_platform(platform) == "mac"} {
|
||||||
|
catch [exec zip -c [file join $tgzDir $name] $activeProject] err
|
||||||
|
} elseif {$tcl_platform(platform) == "unix"} {
|
||||||
|
catch [exec tar -czvf [file join $tgzDir $name] $activeProject] err
|
||||||
|
}
|
||||||
|
# message dialog #
|
||||||
|
set msg "[::msgcat::mc "Archive created in"] [file join $tgzDir $name]"
|
||||||
|
set icon info
|
||||||
|
set answer [tk_messageBox\
|
||||||
|
-message "$msg"\
|
||||||
|
-type ok -icon $icon]
|
||||||
|
case $answer {
|
||||||
|
ok {return 0}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Процедура для проверки, находится ли редактирование в последней строке
|
||||||
|
proc IsLastLine {widget} {
|
||||||
|
set current_line [lindex [split [$widget index insert] .] 0]
|
||||||
|
set last_line [lindex [split [$widget index end-1c] .] 0]
|
||||||
|
return [expr {$current_line == $last_line}]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Процедура для проверки выделения в последней строке
|
||||||
|
proc IsSelectionInLastLine {widget} {
|
||||||
|
if {![$widget tag ranges sel]} {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
set last_line [lindex [split [$widget index end-1c] .] 0]
|
||||||
|
set sel_start_line [lindex [split [$widget index sel.first] .] 0]
|
||||||
|
set sel_end_line [lindex [split [$widget index sel.last] .] 0]
|
||||||
|
|
||||||
|
return [expr {$sel_start_line == $last_line && $sel_end_line == $last_line}]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Процедура-обертка для проверки последней строки
|
||||||
|
proc CheckLastLineAndRun {txt w filePath} {
|
||||||
|
# Проверяем, находится ли курсор в последней строке
|
||||||
|
set current_line [lindex [split [$txt index insert] .] 0]
|
||||||
|
set last_line [lindex [split [$txt index end-1c] .] 0]
|
||||||
|
|
||||||
|
if {$current_line == $last_line} {
|
||||||
|
# Разрешаем выполнение в последней строке
|
||||||
|
$txt insert insert "\n"
|
||||||
|
Run $w $filePath
|
||||||
|
} else {
|
||||||
|
# Запрещаем в других строках
|
||||||
|
bell
|
||||||
|
$txt mark set insert end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
## MAKE PROJ PROCEDURE (RUNNING PROJECT) ##
|
||||||
|
proc Execute {filePath w activeEditor} {
|
||||||
|
global activeProject cfgVariables
|
||||||
|
if {$activeProject == ""} {
|
||||||
|
set answer [tk_messageBox\
|
||||||
|
-message "[::msgcat::mc "Not found active project"]"\
|
||||||
|
-type ok -icon warning\
|
||||||
|
-title [::msgcat::mc "Warning"]]
|
||||||
|
case $answer {
|
||||||
|
ok {return 0}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FileOper::Save
|
||||||
|
set file $filePath
|
||||||
|
set action run
|
||||||
|
# create array with file names #
|
||||||
|
frame $w.frame -borderwidth 2 -relief ridge -background $cfgVariables(backGround)
|
||||||
|
pack $w.frame -side top -fill both -expand true
|
||||||
|
|
||||||
|
set txt $w.frame.text
|
||||||
|
ctext $txt -yscrollcommand "$w.frame.yscroll set" -linemap 0 \
|
||||||
|
-bg $cfgVariables(backGround) -fg $cfgVariables(foreground) \
|
||||||
|
-relief sunken -wrap word -highlightthickness 0 -font $cfgVariables(font) \
|
||||||
|
-selectborderwidth 0 -selectbackground $cfgVariables(selectbg) -width 10 -height 10
|
||||||
|
|
||||||
|
scrollbar $w.frame.yscroll -relief sunken -borderwidth {1} -width {10} -takefocus 0 \
|
||||||
|
-command "$txt yview" -background $cfgVariables(backGround)
|
||||||
|
Highlight::ExecuteColorized $txt
|
||||||
|
|
||||||
|
pack $txt -side left -fill both -expand true
|
||||||
|
pack $w.frame.yscroll -side left -fill y
|
||||||
|
|
||||||
|
bind $txt <Return> [list Run $w $filePath]
|
||||||
|
bind $txt <Control-r> [list CloseExecuteDialog $w $activeEditor]
|
||||||
|
bind $txt <Control-Cyrillic_er> [list CloseExecuteDialog $w $activeEditor]
|
||||||
|
# focus -force $w.frmBtn.btnOk
|
||||||
|
# $noteBook raise $node
|
||||||
|
# insert debug data into text widget #
|
||||||
|
$txt tag configure bold -font $cfgVariables(fontBold)
|
||||||
|
$txt tag configure error -font $cfgVariables(fontBold) -foreground red
|
||||||
|
$txt tag add bold 0.0 0.end
|
||||||
|
|
||||||
|
$txt insert end "[::msgcat::mc "Enter command for execute file"] $filePath >\n"
|
||||||
|
set pos [$w.frame.text index insert]
|
||||||
|
set lineNum [lindex [split $pos "."] 0]
|
||||||
|
$w.frame.text insert 0.0 "======================================================================================\n"
|
||||||
|
|
||||||
|
# Added executor from config
|
||||||
|
set fileType [string toupper [string trimleft [file extension $filePath] "."]]
|
||||||
|
if {[info exists cfgVariables($fileType)] != 0 && $cfgVariables($fileType) ne ""} {
|
||||||
|
$w.frame.text insert end "$cfgVariables($fileType) %f"
|
||||||
|
}
|
||||||
|
unset fileType
|
||||||
|
# $w.frame.text insert end [string toupper [string trimleft [file extension $filePath] "."]]
|
||||||
|
# $w.frame.text insert end cfgVariables($fileType)
|
||||||
|
|
||||||
|
$w.frame.text tag add bold $lineNum.0 $lineNum.end
|
||||||
|
Highlight::ExecuteColorized $w.frame.text
|
||||||
|
|
||||||
|
# focus -force $w.frame.text
|
||||||
|
|
||||||
|
# Привязки событий для защиты от редактирования
|
||||||
|
# bind $txt <KeyPress> {
|
||||||
|
# if {![IsLastLine %W]} {
|
||||||
|
# break
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
# bind $txt <KeyPress-Return> {
|
||||||
|
# # Разрешаем Enter только в последней строке
|
||||||
|
# if {![IsLastLine %W]} {
|
||||||
|
# break
|
||||||
|
# } else {
|
||||||
|
# list Run $w $filePath
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
# bind $txt <KeyPress-Return> [list CheckLastLineAndRun $txt $w $filePath]
|
||||||
|
#
|
||||||
|
# bind $txt <BackSpace> {
|
||||||
|
# if {[%W tag ranges sel] ne ""} {
|
||||||
|
# if {![IsSelectionInLastLine %W]} {
|
||||||
|
# break
|
||||||
|
# }
|
||||||
|
# } else {
|
||||||
|
# if {![IsLastLine %W]} {
|
||||||
|
# break
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
# bind $txt <Delete> {
|
||||||
|
# if {[%W tag ranges sel] ne ""} {
|
||||||
|
# if {![IsSelectionInLastLine %W]} {
|
||||||
|
# break
|
||||||
|
# }
|
||||||
|
# } else {
|
||||||
|
# if {![IsLastLine %W]} {
|
||||||
|
# break
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
# # Защита от вставки
|
||||||
|
# bind $txt <<Paste>> {
|
||||||
|
# if {[%W tag ranges sel] ne ""} {
|
||||||
|
# if {![IsSelectionInLastLine %W]} {
|
||||||
|
# break
|
||||||
|
# }
|
||||||
|
# } else {
|
||||||
|
# if {![IsLastLine %W]} {
|
||||||
|
# break
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
# # Защита от вырезания
|
||||||
|
# bind $txt <<Cut>> {
|
||||||
|
# if {[%W tag ranges sel] ne ""} {
|
||||||
|
# if {![IsSelectionInLastLine %W]} {
|
||||||
|
# break
|
||||||
|
# }
|
||||||
|
# } else {
|
||||||
|
# break
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
|
||||||
|
focus -force $w.frame.text.t
|
||||||
|
}
|
||||||
|
|
||||||
|
proc CloseExecuteDialog {w activeEditor} {
|
||||||
|
destroy $w
|
||||||
|
focus $activeEditor.frmText.t.t
|
||||||
|
}
|
||||||
|
|
||||||
|
proc Run {w filePath} {
|
||||||
|
# Получаем индекс конца последней строки
|
||||||
|
set endIndex [$w.frame.text index "end-1c"]; # или "end-1l lineend"
|
||||||
|
|
||||||
|
# Получаем индекс начала последней строки
|
||||||
|
set startIndex [$w.frame.text index "end-1l linestart"]
|
||||||
|
|
||||||
|
set command [$w.frame.text get $startIndex $endIndex end]
|
||||||
|
# Заменяем знак %f на имя текущего файла
|
||||||
|
regsub -all "%f" $command "$filePath" fullCommand
|
||||||
|
$w.frame.text replace $startIndex $endIndex $fullCommand
|
||||||
|
|
||||||
|
# $w.frame.text insert "end-4l linestart"
|
||||||
|
cd [file dirname $filePath]
|
||||||
|
set pipe [open "|$fullCommand 2> [file join [file dirname $filePath] errors]" "r"]
|
||||||
|
set f [open [file join [file dirname $filePath] errors] "r"]
|
||||||
|
set processPID [pid $pipe]
|
||||||
|
|
||||||
|
bind $w.frame.text <Control-c> [list SendSignal $processPID "SIGINT"]
|
||||||
|
bind $w.frame.text <Control-z> [list SendSignal $processPID "SIGTSTP"]
|
||||||
|
bind $w.frame.text <Control-d> [list SendSignal $processPID "SIGKILL"]
|
||||||
|
|
||||||
|
# set pipe [open "|$command $filePath" "r"]
|
||||||
|
# set f [open [file join ~ tmp errors] "r"]
|
||||||
|
fileevent $pipe readable [list DebugInfo $w.frame.text $pipe $f]
|
||||||
|
fconfigure $pipe -buffering none -blocking no
|
||||||
|
}
|
||||||
|
|
||||||
|
## INSERT DEBUG INFORMATION INTO TEXT WIDGET ##
|
||||||
|
proc DebugInfo {widget file f} {
|
||||||
|
$widget configure -state normal
|
||||||
|
if {[eof $file]} {
|
||||||
|
catch [close $file] msg
|
||||||
|
if {$msg != ""} {
|
||||||
|
puts $msg
|
||||||
|
$widget insert "end-4l linestart" "[::msgcat::mc "Program failed"]: $msg\n";
|
||||||
|
} else {
|
||||||
|
# Highlight::ExecuteColorized $widget
|
||||||
|
puts $msg
|
||||||
|
$widget see "end-1l lineend"
|
||||||
|
$widget delete "end-1l lineend" end
|
||||||
|
# $widget insert end "\n-------------------------------------------------\n"
|
||||||
|
# $widget insert end "[::msgcat::mc "Program finished successfully"]\n"
|
||||||
|
}
|
||||||
|
Highlight::ExecuteColorized $widget
|
||||||
|
# close $f
|
||||||
|
} else {
|
||||||
|
# Highlight::ExecuteColorized $widget
|
||||||
|
$widget insert "end-4l linestart" "[read $file]"
|
||||||
|
}
|
||||||
|
while {[gets $f line]>=0} {
|
||||||
|
Highlight::ExecuteColorized $widget
|
||||||
|
$widget insert "end-4l linestart" "$line\n"
|
||||||
|
# puts $line
|
||||||
|
}
|
||||||
|
# close $f
|
||||||
|
$widget see end
|
||||||
|
$widget tag add error 0.0 0.end
|
||||||
|
# $widget configure -state disabled
|
||||||
|
}
|
||||||
|
|
||||||
|
# Функция для отправки сигнала процессу
|
||||||
|
proc SendSignal {pid signal} {
|
||||||
|
global tcl_platform
|
||||||
|
|
||||||
|
if {$tcl_platform(platform) eq "unix"} {
|
||||||
|
# На Unix-системах
|
||||||
|
switch -- $signal {
|
||||||
|
"SIGINT" { exec kill -INT $pid } ; # Ctrl+C
|
||||||
|
"SIGTERM" { exec kill -TERM $pid } ; # Завершение
|
||||||
|
"SIGTSTP" { exec kill -TSTP $pid } ; # Ctrl+Z (приостановка)
|
||||||
|
"SIGKILL" { exec kill -KILL $pid } ; # Принудительное завершение
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
# На Windows
|
||||||
|
switch -- $signal {
|
||||||
|
"SIGINT" - "SIGTERM" {
|
||||||
|
# Используем taskkill для завершения
|
||||||
|
catch {exec taskkill /PID $pid /T}
|
||||||
|
}
|
||||||
|
"SIGKILL" {
|
||||||
|
# Принудительное завершение на Windows
|
||||||
|
catch {exec taskkill /PID $pid /T /F}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Правка файла настроек
|
||||||
|
proc Settings {} {
|
||||||
|
global dir
|
||||||
|
|
||||||
|
FileOper::Edit [file join $dir(cfg) projman.ini]
|
||||||
|
# Config::read $dir(cfg)
|
||||||
|
}
|
||||||
|
|
||||||
|
# Определяем пути до программ для запуска исходников
|
||||||
|
proc ExecutorCommandPathSetting {fileType} {
|
||||||
|
global cfgVariables tcl_platform
|
||||||
|
# puts $cfgVariables($fileType)
|
||||||
|
if {[info exists cfgVariables($fileType)] == 1 && $cfgVariables($fileType) ne ""} {
|
||||||
|
if {$tcl_platform(platform) eq "windows"} {
|
||||||
|
set cmd "where $cfgVariables($fileType)"
|
||||||
|
} else {
|
||||||
|
set cmd "which $cfgVariables($fileType)"
|
||||||
|
}
|
||||||
|
puts "ExecutorCommandPathSetting $fileType"
|
||||||
|
puts [catch {exec {*}$cmd} executor_path]
|
||||||
|
puts "executor_path $executor_path"
|
||||||
|
if {[catch {exec {*}$cmd} executor_path]} {
|
||||||
|
puts "Программа $cfgVariables($fileType) для выполнения файлов $fileType не найдена в системе"
|
||||||
|
set cfgVariables($fileType) ""
|
||||||
|
return
|
||||||
|
}
|
||||||
|
set full_path [string trim $executor_path]
|
||||||
|
set first_path [lindex [split $executor_path "\n"] 0]
|
||||||
|
|
||||||
|
# puts "Git найден: $first_path"
|
||||||
|
set cfgVariables($fileType) $first_path
|
||||||
|
puts "first_path $first_path"
|
||||||
|
}
|
||||||
|
if {[info exists cfgVariables($fileType)] == 0} {
|
||||||
|
set cfgVariables($fileType) ""
|
||||||
|
puts $cfgVariables($fileType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ proc GetVariablesFromFile {fileName} {
|
|||||||
set varList ""
|
set varList ""
|
||||||
set params ""
|
set params ""
|
||||||
set varsBegin false
|
set varsBegin false
|
||||||
puts $fileName
|
# puts $fileName
|
||||||
set f [open "$fileName" r]
|
set f [open "$fileName" r]
|
||||||
if {[dict exists $lexers $fileType] == 0} {return}
|
if {[dict exists $lexers $fileType] == 0} {return}
|
||||||
while {[gets $f line] >=0 } {
|
while {[gets $f line] >=0 } {
|
||||||
@@ -32,7 +32,7 @@ proc GetVariablesFromFile {fileName} {
|
|||||||
set indentSize 0
|
set indentSize 0
|
||||||
}
|
}
|
||||||
set varsBegin true
|
set varsBegin true
|
||||||
puts "====== $varsBegin $indentSize"
|
# puts "$varsBegin $indentSize"
|
||||||
continue
|
continue
|
||||||
# lappend varList [list $varName $varValue]
|
# lappend varList [list $varName $varValue]
|
||||||
}
|
}
|
||||||
@@ -41,13 +41,13 @@ proc GetVariablesFromFile {fileName} {
|
|||||||
set l [GetVarFromLine $line $fileType]
|
set l [GetVarFromLine $line $fileType]
|
||||||
if {$line eq ""} {
|
if {$line eq ""} {
|
||||||
set varsBegin false
|
set varsBegin false
|
||||||
puts "====== $varsBegin $indentSize [lindex $l 3]"
|
# puts "$varsBegin $indentSize [lindex $l 3]"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if {[lindex $l 3] ne ""} {
|
if {[lindex $l 3] ne ""} {
|
||||||
if [expr [lindex $l 3] <= $indentSize] {
|
if [expr [lindex $l 3] <= $indentSize] {
|
||||||
set varsBegin false
|
set varsBegin false
|
||||||
puts "====== $varsBegin $indentSize >[lindex $l 3]<"
|
# puts "$varsBegin $indentSize >[lindex $l 3]<"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ proc GetVarFromLine {line fileType} {
|
|||||||
set varType ""
|
set varType ""
|
||||||
}
|
}
|
||||||
set indentLength [string length $indent]
|
set indentLength [string length $indent]
|
||||||
puts "variable: $varName, value: $varValue, type: $varType, indent: >$indent< $indentLength"
|
# puts "variable: $varName, value: $varValue, type: $varType, indent: >$indent< $indentLength"
|
||||||
return [list $varName $varValue $varType $indentLength]
|
return [list $varName $varValue $varType $indentLength]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ proc GetVariablesFromVarFile {fileName} {
|
|||||||
set procList ""
|
set procList ""
|
||||||
set varList ""
|
set varList ""
|
||||||
set params ""
|
set params ""
|
||||||
puts $fileName
|
# puts $fileName
|
||||||
set f [open "$fileName" r]
|
set f [open "$fileName" r]
|
||||||
if {[dict exists $lexers $fileType] == 0} {return}
|
if {[dict exists $lexers $fileType] == 0} {return}
|
||||||
while {[gets $f line] >=0 } {
|
while {[gets $f line] >=0 } {
|
||||||
@@ -122,7 +122,7 @@ proc ReadFilesFromDirectory {directory root {type ""}} {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
foreach fileName [glob -nocomplain *] {
|
foreach fileName [glob -nocomplain *] {
|
||||||
puts "Find file: $fileName [lsearch -exact -nocase $l $fileName]"
|
# puts "Find file: $fileName [lsearch -exact -nocase $l $fileName]"
|
||||||
if {[lsearch -exact $l $fileName] != -1 && [file isdirectory [file join $root $directory $fileName]] == 1} {
|
if {[lsearch -exact $l $fileName] != -1 && [file isdirectory [file join $root $directory $fileName]] == 1} {
|
||||||
# puts "--- $root $fileName"
|
# puts "--- $root $fileName"
|
||||||
ReadFilesFromDirectory [file join $directory $fileName] $root "var"
|
ReadFilesFromDirectory [file join $directory $fileName] $root "var"
|
||||||
@@ -179,8 +179,8 @@ proc ReadFilesFromDirectory {directory root {type ""}} {
|
|||||||
#
|
#
|
||||||
proc Accept { dirLib directory } {
|
proc Accept { dirLib directory } {
|
||||||
global dir
|
global dir
|
||||||
puts $dir(lib)
|
# puts $dir(lib)
|
||||||
puts $dirLib
|
# puts $dirLib
|
||||||
# переменная с указанием ваших действия перед порождением потока
|
# переменная с указанием ваших действия перед порождением потока
|
||||||
set threadinit {
|
set threadinit {
|
||||||
# если необходимо, загружаем исходный tcl код, расположенный в других файлах
|
# если необходимо, загружаем исходный tcl код, расположенный в других файлах
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ namespace eval Tree {
|
|||||||
# puts "$tree $parent $item $type $text"
|
# puts "$tree $parent $item $type $text"
|
||||||
switch $type {
|
switch $type {
|
||||||
file {
|
file {
|
||||||
regsub -all {\.|/|\\|\s} $item "_" subNode
|
regsub -all {\.|/|\\|\s|:} $item "_" subNode
|
||||||
|
set subNode [string tolower $subNode]
|
||||||
# puts "Inserted tree node: $subNode"
|
# puts "Inserted tree node: $subNode"
|
||||||
set fileExt [string trimleft [file extension $text] "."]
|
set fileExt [string trimleft [file extension $text] "."]
|
||||||
#set fileName [string trimleft [file extension $text] "."]
|
#set fileName [string trimleft [file extension $text] "."]
|
||||||
@@ -41,7 +42,8 @@ namespace eval Tree {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
directory {
|
directory {
|
||||||
regsub -all {\.|/|\\|\s} $item "_" subNode
|
regsub -all {\.|/|\\|\s|:} $item "_" subNode
|
||||||
|
set subNode [string tolower $subNode]
|
||||||
# puts $subNode
|
# puts $subNode
|
||||||
if {[string match {*debian*} [string tolower [file tail $item]]]} {
|
if {[string match {*debian*} [string tolower [file tail $item]]]} {
|
||||||
set image [::FindImage debian]
|
set image [::FindImage debian]
|
||||||
@@ -104,7 +106,7 @@ namespace eval Tree {
|
|||||||
set key [lindex [split $id "::"] 0]
|
set key [lindex [split $id "::"] 0]
|
||||||
if {$values eq "" || $key eq ""} {return}
|
if {$values eq "" || $key eq ""} {return}
|
||||||
|
|
||||||
# puts "$key $tree $values"
|
puts "$key $tree $values"
|
||||||
switch -regexp $key {
|
switch -regexp $key {
|
||||||
directory {
|
directory {
|
||||||
FileOper::ReadFolder $values
|
FileOper::ReadFolder $values
|
||||||
@@ -112,6 +114,7 @@ namespace eval Tree {
|
|||||||
}
|
}
|
||||||
file {
|
file {
|
||||||
set v [FileOper::Edit $values $nbEditor]
|
set v [FileOper::Edit $values $nbEditor]
|
||||||
|
puts $v
|
||||||
if {$v eq false} {
|
if {$v eq false} {
|
||||||
$tree delete $id
|
$tree delete $id
|
||||||
}
|
}
|
||||||
|
|||||||
24
projman.tcl
24
projman.tcl
@@ -9,8 +9,8 @@ exec wish8.6 "$0" -- "$@"
|
|||||||
# Home page: https://nuk-svk.ru
|
# Home page: https://nuk-svk.ru
|
||||||
######################################################
|
######################################################
|
||||||
# Version: 2.0.0
|
# Version: 2.0.0
|
||||||
# Release: alpha18
|
# Release: alpha21
|
||||||
# Build: 27102025140606
|
# Build: 03122025180445
|
||||||
######################################################
|
######################################################
|
||||||
|
|
||||||
# определим текущую версию, релиз и т.д.
|
# определим текущую версию, релиз и т.д.
|
||||||
@@ -43,6 +43,24 @@ package require fileutil
|
|||||||
# package require Thread
|
# package require Thread
|
||||||
package require fileutil::magic::filetype
|
package require fileutil::magic::filetype
|
||||||
|
|
||||||
|
# Определим установлен ли пакет Img для расширенной поддержки изображений
|
||||||
|
proc PackagePresent {pkg} {
|
||||||
|
# puts $pkg
|
||||||
|
foreach item [package names] {
|
||||||
|
# puts [string match -nocase Img $item]
|
||||||
|
if {[string match -nocase Img $item] == 1} {
|
||||||
|
puts "The $pkg package was found"
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if {[PackagePresent "Img"] eq "true"} {
|
||||||
|
package require Img
|
||||||
|
} else {
|
||||||
|
puts "Img not present"
|
||||||
|
}
|
||||||
|
|
||||||
# Устанавливаем текущий каталог
|
# Устанавливаем текущий каталог
|
||||||
set dir(root) [pwd]
|
set dir(root) [pwd]
|
||||||
set dir(doc) [file join $dir(root) doc]
|
set dir(doc) [file join $dir(root) doc]
|
||||||
@@ -112,6 +130,8 @@ puts "Setting the locale... [::msgcat::mclocale]"
|
|||||||
|
|
||||||
source [file join $dir(lib) gui.tcl]
|
source [file join $dir(lib) gui.tcl]
|
||||||
|
|
||||||
|
Git::CommandPathSetting
|
||||||
|
|
||||||
# Open the PATH if command line argument has been setting
|
# Open the PATH if command line argument has been setting
|
||||||
if [info exists opened] {
|
if [info exists opened] {
|
||||||
foreach path $opened {
|
foreach path $opened {
|
||||||
|
|||||||
149
theme/black.tcl
149
theme/black.tcl
@@ -6,8 +6,8 @@
|
|||||||
#
|
#
|
||||||
# $Id: black.tcl,v 1.2 2009/10/25 19:21:30 oberdorfer Exp $
|
# $Id: black.tcl,v 1.2 2009/10/25 19:21:30 oberdorfer Exp $
|
||||||
|
|
||||||
package require Tk 8.4; # minimum version for Tile
|
package require Tk; # minimum version for Tile
|
||||||
package require tile 0.8; # depends upon tile
|
package require tile; # depends upon tile
|
||||||
|
|
||||||
|
|
||||||
namespace eval ttk {
|
namespace eval ttk {
|
||||||
@@ -39,6 +39,7 @@ namespace eval ttk::theme::black {
|
|||||||
-lightest "#ffffff"
|
-lightest "#ffffff"
|
||||||
-selectbg "#4a6984"
|
-selectbg "#4a6984"
|
||||||
-selectfg "#ffffff"
|
-selectfg "#ffffff"
|
||||||
|
-font "#c8c8c8"
|
||||||
}
|
}
|
||||||
if {[info commands ::ttk::style] ne ""} {
|
if {[info commands ::ttk::style] ne ""} {
|
||||||
set styleCmd ttk::style
|
set styleCmd ttk::style
|
||||||
@@ -46,77 +47,83 @@ namespace eval ttk::theme::black {
|
|||||||
set styleCmd style
|
set styleCmd style
|
||||||
}
|
}
|
||||||
|
|
||||||
$styleCmd theme create black -parent clam -settings {
|
$styleCmd theme create black -parent clam -settings {
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
# Theme defaults
|
# Theme defaults
|
||||||
#
|
#
|
||||||
$styleCmd configure "." \
|
$styleCmd configure "." \
|
||||||
-background $colors(-frame) \
|
-background $colors(-frame) \
|
||||||
-foreground white \
|
-foreground white \
|
||||||
-bordercolor $colors(-darkest) \
|
-bordercolor $colors(-darkest) \
|
||||||
-darkcolor $colors(-dark) \
|
-darkcolor $colors(-dark) \
|
||||||
-lightcolor $colors(-lighter) \
|
-lightcolor $colors(-lighter) \
|
||||||
-troughcolor $colors(-darker) \
|
-troughcolor $colors(-darker) \
|
||||||
-selectbackground $colors(-selectbg) \
|
-selectbackground $colors(-selectbg) \
|
||||||
-selectforeground $colors(-selectfg) \
|
-selectforeground $colors(-selectfg) \
|
||||||
-selectborderwidth 0 \
|
-selectborderwidth 0 \
|
||||||
-font "{Droid Sans Mono} 9" \
|
-font "{Droid Sans Mono} 9" \
|
||||||
;
|
;
|
||||||
|
|
||||||
|
$styleCmd map "." \
|
||||||
|
-background [list disabled $colors(-frame) \
|
||||||
|
active $colors(-lighter)] \
|
||||||
|
-foreground [list disabled $colors(-disabledfg)] \
|
||||||
|
-selectbackground [list !focus $colors(-darkest)] \
|
||||||
|
-selectforeground [list !focus white] \
|
||||||
|
;
|
||||||
|
|
||||||
|
# ttk widgets.
|
||||||
|
$styleCmd configure TButton \
|
||||||
|
-width -8 -padding {5 1} -relief link
|
||||||
|
$styleCmd configure TMenubutton \
|
||||||
|
-relief flat -arrowsize 0
|
||||||
|
|
||||||
|
$styleCmd configure TCheckbutton \
|
||||||
|
-indicatorbackground $colors(-lighter) -indicatormargin {1 1 4 1}
|
||||||
|
$styleCmd configure TRadiobutton \
|
||||||
|
-indicatorbackground $colors(-lighter) -indicatormargin {1 1 4 1}
|
||||||
|
|
||||||
|
$styleCmd configure TEntry \
|
||||||
|
-fieldbackground gray20 -foreground $colors(-font) \
|
||||||
|
-padding {2 0} -border -1
|
||||||
|
$styleCmd configure TCombobox \
|
||||||
|
-fieldbackground white -foreground $colors(-font)\
|
||||||
|
-padding {2 0}
|
||||||
|
$styleCmd configure TSpinbox \
|
||||||
|
-fieldbackground white -foreground $colors(-font) \
|
||||||
|
-padding {2 0}
|
||||||
|
|
||||||
|
$styleCmd configure TNotebook \
|
||||||
|
-border -1
|
||||||
|
$styleCmd configure TNotebook.Tab \
|
||||||
|
-padding {6 2 6 2} \
|
||||||
|
-border -1
|
||||||
|
|
||||||
|
$styleCmd map TNotebook.Tab -background [list \
|
||||||
|
selected $colors(-lighter)]
|
||||||
|
|
||||||
|
# tk widgets.
|
||||||
|
$styleCmd map Menu \
|
||||||
|
-background [list active $colors(-dark)] \
|
||||||
|
-foreground [list disabled $colors(-lightest)] \
|
||||||
|
|
||||||
|
$styleCmd configure TreeCtrl \
|
||||||
|
-background gray30 -itembackground {gray60 gray50} \
|
||||||
|
-itemfill white -itemaccentfill yellow -border -1
|
||||||
|
|
||||||
|
$styleCmd map Treeview\
|
||||||
|
-background [list selected $colors(-lighter)] \
|
||||||
|
-foreground [list selected $colors(-selectfg)]
|
||||||
|
# -background [list selected $colors(-selectbg)] \
|
||||||
|
|
||||||
|
$styleCmd configure Treeview -fieldbackground gray25
|
||||||
|
|
||||||
$styleCmd map "." \
|
$styleCmd map Canvas \
|
||||||
-background [list disabled $colors(-frame) \
|
-background [list selected $colors(-lighter)] \
|
||||||
active $colors(-lighter)] \
|
-foreground [list selected $colors(-selectfg)] \
|
||||||
-foreground [list disabled $colors(-disabledfg)] \
|
-highlightbackground [list selected $colors(-lighter)]
|
||||||
-selectbackground [list !focus $colors(-darkest)] \
|
}
|
||||||
-selectforeground [list !focus white] \
|
|
||||||
;
|
|
||||||
|
|
||||||
# ttk widgets.
|
|
||||||
$styleCmd configure TButton \
|
|
||||||
-width -8 -padding {5 1} -relief link
|
|
||||||
$styleCmd configure TMenubutton\
|
|
||||||
-relief flat -arrowsize 0
|
|
||||||
$styleCmd configure TCheckbutton \
|
|
||||||
-indicatorbackground $colors(-lighter) -indicatormargin {1 1 4 1}
|
|
||||||
$styleCmd configure TRadiobutton \
|
|
||||||
-indicatorbackground $colors(-lighter) -indicatormargin {1 1 4 1}
|
|
||||||
|
|
||||||
$styleCmd configure TEntry \
|
|
||||||
-fieldbackground gray20 -foreground black \
|
|
||||||
-padding {2 0} -border -1
|
|
||||||
$styleCmd configure TCombobox \
|
|
||||||
-fieldbackground white -foreground black \
|
|
||||||
-padding {2 0}
|
|
||||||
$styleCmd configure TSpinbox \
|
|
||||||
-fieldbackground white -foreground black \
|
|
||||||
-padding {2 0}
|
|
||||||
|
|
||||||
$styleCmd configure TNotebook \
|
|
||||||
-border -1
|
|
||||||
$styleCmd configure TNotebook.Tab \
|
|
||||||
-padding {6 2 6 2} \
|
|
||||||
-border -1
|
|
||||||
|
|
||||||
$styleCmd map TNotebook.Tab -background [list \
|
|
||||||
selected $colors(-lighter)]
|
|
||||||
|
|
||||||
# tk widgets.
|
|
||||||
$styleCmd map Menu \
|
|
||||||
-background [list active $colors(-lighter)] \
|
|
||||||
-foreground [list disabled $colors(-disabledfg)]
|
|
||||||
|
|
||||||
$styleCmd configure TreeCtrl \
|
|
||||||
-background gray30 -itembackground {gray60 gray50} \
|
|
||||||
-itemfill white -itemaccentfill yellow -border -1
|
|
||||||
|
|
||||||
$styleCmd map Treeview\
|
|
||||||
-background [list selected $colors(-lighter)] \
|
|
||||||
-foreground [list selected $colors(-selectfg)]
|
|
||||||
# -background [list selected $colors(-selectbg)] \
|
|
||||||
|
|
||||||
$styleCmd configure Treeview -fieldbackground gray25
|
|
||||||
}
|
|
||||||
puts [ttk::style element names]
|
puts [ttk::style element names]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1365,5 +1365,3 @@ proc make-regexp::make-regexp {words} {
|
|||||||
set regexp
|
set regexp
|
||||||
}
|
}
|
||||||
#==============================================================================================
|
#==============================================================================================
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user