Compare commits
20 Commits
5d70d508cd
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb6b2c6f53 | ||
|
|
aa9bb03cc2 | ||
|
|
bcc3460e06 | ||
|
|
1385c91255 | ||
|
|
ead8267d61 | ||
|
|
e534b27407 | ||
|
|
45cbd7845b | ||
|
|
b830838f8e | ||
|
|
ef87b88156 | ||
| 264368c61f | |||
| c38dffeeb9 | |||
| df1d9aa36d | |||
| cff798a9f1 | |||
| 64287f1a01 | |||
| 5e1c057bc5 | |||
| ab740f0be8 | |||
| 4c6713b2d3 | |||
| dc5fd60c0d | |||
| c3848566df | |||
| 961d597032 |
2
.gitignore
vendored
2
.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
|
||||||
|
debian/errors
|
||||||
*.tmp
|
*.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
|
||||||
|
|
||||||
|
|||||||
60
debian/changelog
vendored
60
debian/changelog
vendored
@@ -1,19 +1,63 @@
|
|||||||
|
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
|
projman (2.0.0-alpha19) stable; urgency=medium
|
||||||
|
|
||||||
|
* Исправил сохранение и закрытие нового файла. Теперь при сохранении файл будет переоткрыт под новым именем.
|
||||||
|
* Добавил проверку пакета Img. И поправил проверку типов изображений
|
||||||
|
* Переделал сигналы и сочетания
|
||||||
|
* Небольшие исправления
|
||||||
|
* Добавлен перевод фокуса ввода на прежнее окно после закрытия диалога выполнения.
|
||||||
|
* Добавлена передача сигналов для закрытия запущенного процесса
|
||||||
|
* Изменил виджет текста в окне псевдо-терминала. Добавил подстановку имени файла к командную строку по шаблону %f
|
||||||
|
* Добавлен диалог настроек
|
||||||
* Добавил псевдо-терминал
|
* Добавил псевдо-терминал
|
||||||
* Исправлен changelog
|
* Добавлен диалог при открытии файлов отличных от текстовых
|
||||||
|
* Поправил тему оформления
|
||||||
|
* Исправлена работа в 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
|
-- 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
|
||||||
|
|
||||||
* Добавлен диалог при открытии файлов отличных от текстовых
|
|
||||||
* Добавлен просмотр файлов изображений (png, bmp, gif, ppm, pgm)
|
|
||||||
* Исправлена роцедура опреления типа файла
|
|
||||||
* Добавлены диалоги для подтверждения открытия больших файлов, и двоичных файлов.
|
|
||||||
* Поправил тему оформления
|
* Поправил тему оформления
|
||||||
* Исправлена работа в windows
|
* Исправлена работа в windows
|
||||||
* Уменьшил колдичество выводимой отладочной информации
|
* Уменьшил количество выводимой отладочной информации
|
||||||
* Добавлено определение пути до git в зависимости от платформы.
|
* Добавлено определение пути до git в зависимости от платформы.
|
||||||
* Исправлено создание файла конфигурации
|
* Исправлено создание файла конфигурации
|
||||||
* Добавлены номера версий в вызов tclsh8.6 и wish8.6.
|
* Добавлены номера версий в вызов tclsh8.6 и wish8.6.
|
||||||
@@ -385,3 +429,7 @@ projman (2.0.0-alfa0) stable; urgency=medium
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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+"]
|
||||||
|
|||||||
@@ -1547,6 +1547,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]"
|
||||||
ttk::label $fr.header.$lblName -text $lblText
|
ttk::label $fr.header.$lblName -text $lblText
|
||||||
@@ -1602,7 +1604,7 @@ namespace eval Editor {
|
|||||||
set frmText [ttk::frame $w.frmText2 -border 1]
|
set frmText [ttk::frame $w.frmText2 -border 1]
|
||||||
$w.panelTxt add $frmText -weight 1
|
$w.panelTxt add $frmText -weight 1
|
||||||
# focus -force $frmText.t.t
|
# focus -force $frmText.t.t
|
||||||
Execute $fileFullPath $frmText
|
Execute $fileFullPath $frmText $w
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,41 @@
|
|||||||
|
|
||||||
|
|
||||||
namespace eval FileOper {
|
namespace eval FileOper {
|
||||||
|
global packages
|
||||||
variable types
|
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
|
||||||
@@ -76,15 +106,15 @@ namespace eval FileOper {
|
|||||||
if {$fBinaryType ne ""} {
|
if {$fBinaryType ne ""} {
|
||||||
switch $fBinaryType {
|
switch $fBinaryType {
|
||||||
"graphic" {
|
"graphic" {
|
||||||
if {$fBinaryInterp ne "png" && $fBinaryInterp ne "gif" && $fBinaryInterp ne "ppm" && $fBinaryInterp ne "pgm"} {
|
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]
|
set answer [tk_messageBox -message [::msgcat::mc "The file looks like a image. Support not implemented yet."] -icon question -type ok]
|
||||||
switch $answer {
|
switch $answer {
|
||||||
ok {
|
ok {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return image
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default {
|
default {
|
||||||
@@ -99,14 +129,15 @@ namespace eval FileOper {
|
|||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
"image" {
|
"image" {
|
||||||
if {$fBinaryInterp ne "png" && $fBinaryInterp ne "gif" && $fBinaryInterp ne "ppm" && $fBinaryInterp ne "pgm" && $fBinaryInterp} {
|
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]
|
set answer [tk_messageBox -message [::msgcat::mc "The file looks like a image. Support not implemented yet."] -icon question -type ok]
|
||||||
switch $answer {
|
switch $answer {
|
||||||
ok {
|
ok {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return image
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"empty" {
|
"empty" {
|
||||||
@@ -279,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"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if {[$nbEditor select] eq $nbItem} {
|
||||||
$nbEditor forget $nbItem
|
$nbEditor forget $nbItem
|
||||||
destroy $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
|
||||||
@@ -311,7 +344,7 @@ namespace eval FileOper {
|
|||||||
NB::NextTab $nbEditor 0
|
NB::NextTab $nbEditor 0
|
||||||
}
|
}
|
||||||
|
|
||||||
proc Save {} {
|
proc Save {{type ""}} {
|
||||||
global nbEditor tree env activeProject dir
|
global nbEditor tree env activeProject dir
|
||||||
|
|
||||||
if [info exists activeProject] {
|
if [info exists activeProject] {
|
||||||
@@ -346,6 +379,12 @@ namespace eval FileOper {
|
|||||||
if {[file tail $filePath] eq "projman.ini"} {
|
if {[file tail $filePath] eq "projman.ini"} {
|
||||||
Config::read $dir(cfg)
|
Config::read $dir(cfg)
|
||||||
}
|
}
|
||||||
|
if [string match "*untitled*" $nbEditorItem] {
|
||||||
|
FileOper::Close
|
||||||
|
if {$type ne "close"} {
|
||||||
|
FileOper::Edit $filePath
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proc SaveAll {} {
|
proc SaveAll {} {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace eval Git {
|
|||||||
}
|
}
|
||||||
if {[catch {exec {*}$cmd} git_path]} {
|
if {[catch {exec {*}$cmd} git_path]} {
|
||||||
puts "Git не найден в системе"
|
puts "Git не найден в системе"
|
||||||
set cfgVariables(gitCommand) "Git not found"
|
set cfgVariables(gitCommand) ""
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
set git_path [string trim $git_path]
|
set git_path [string trim $git_path]
|
||||||
|
|||||||
@@ -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+}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ proc ImageBase64Encode {text} {
|
|||||||
{"GIF" {.gif}}
|
{"GIF" {.gif}}
|
||||||
{"JPEG" {.jpg}}
|
{"JPEG" {.jpg}}
|
||||||
{"BMP" {.bmp}}
|
{"BMP" {.bmp}}
|
||||||
# {"SVG" {.svg}}
|
{"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 .]
|
||||||
|
|||||||
@@ -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] {
|
||||||
@@ -826,8 +828,46 @@ proc MakeTGZ {} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Процедура для проверки, находится ли редактирование в последней строке
|
||||||
|
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) ##
|
## MAKE PROJ PROCEDURE (RUNNING PROJECT) ##
|
||||||
proc Execute {filePath w} {
|
proc Execute {filePath w activeEditor} {
|
||||||
global activeProject cfgVariables
|
global activeProject cfgVariables
|
||||||
if {$activeProject == ""} {
|
if {$activeProject == ""} {
|
||||||
set answer [tk_messageBox\
|
set answer [tk_messageBox\
|
||||||
@@ -841,102 +881,119 @@ proc Execute {filePath w} {
|
|||||||
FileOper::Save
|
FileOper::Save
|
||||||
set file $filePath
|
set file $filePath
|
||||||
set action run
|
set action run
|
||||||
# if {$action == "compile"} {
|
|
||||||
|
|
||||||
# if {$t == "proj"} {
|
|
||||||
# set prog [file join $projDirName $projFileName.java]
|
|
||||||
# } elseif {$t == "file"} {
|
|
||||||
# set node [$tree selection get]
|
|
||||||
# set fullPath [$tree itemcget $node -data]
|
|
||||||
# set dir [file dirname $fullPath]
|
|
||||||
# set file [file tail $fullPath]
|
|
||||||
# set prog $fullPath
|
|
||||||
# }
|
|
||||||
# } elseif {$action == "run"} {
|
|
||||||
# if {$t == "proj"} {
|
|
||||||
# set prog [file join $projDirName $projFileName]
|
|
||||||
# } elseif {$t == "file"} {
|
|
||||||
# set node [$tree selection get]
|
|
||||||
# set fullPath [$tree itemcget $node -data]
|
|
||||||
# set dir [file dirname $fullPath]
|
|
||||||
# set file [file tail $fullPath]
|
|
||||||
# set prog $fullPath
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
|
|
||||||
# set node "debug"
|
|
||||||
# if {[$noteBook index $node] != -1} {
|
|
||||||
# $noteBook delete debug
|
|
||||||
# }
|
|
||||||
# set w [$noteBook insert end $node -text [::msgcat::mc "Running project"]]
|
|
||||||
# create array with file names #
|
# create array with file names #
|
||||||
frame $w.frame -borderwidth 2 -relief ridge -background $cfgVariables(backGround)
|
frame $w.frame -borderwidth 2 -relief ridge -background $cfgVariables(backGround)
|
||||||
pack $w.frame -side top -fill both -expand true
|
pack $w.frame -side top -fill both -expand true
|
||||||
|
|
||||||
|
set txt $w.frame.text
|
||||||
text $w.frame.text -yscrollcommand "$w.frame.yscroll set" \
|
ctext $txt -yscrollcommand "$w.frame.yscroll set" -linemap 0 \
|
||||||
-bg $cfgVariables(backGround) -fg $cfgVariables(foreground) \
|
-bg $cfgVariables(backGround) -fg $cfgVariables(foreground) \
|
||||||
-relief sunken -wrap word -highlightthickness 0 -font $cfgVariables(font)\
|
-relief sunken -wrap word -highlightthickness 0 -font $cfgVariables(font) \
|
||||||
-selectborderwidth 0 -selectbackground $cfgVariables(selectbg) -width 10 -height 10
|
-selectborderwidth 0 -selectbackground $cfgVariables(selectbg) -width 10 -height 10
|
||||||
scrollbar $w.frame.yscroll -relief sunken -borderwidth {1} -width {10} -takefocus 0 \
|
|
||||||
-command "$w.frame.text yview" -background $cfgVariables(backGround)
|
|
||||||
|
|
||||||
pack $w.frame.text -side left -fill both -expand true
|
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
|
pack $w.frame.yscroll -side left -fill y
|
||||||
|
|
||||||
# frame $w.frmBtn -borderwidth 2 -relief ridge -bg $cfgVariables(backGround)
|
bind $txt <Return> [list Run $w $filePath]
|
||||||
# pack $w.frmBtn -side top -fill x
|
bind $txt <Control-r> [list CloseExecuteDialog $w $activeEditor]
|
||||||
# button $w.frmBtn.btnOk -text [::msgcat::mc "Close"] -borderwidth {1} \
|
bind $txt <Control-Cyrillic_er> [list CloseExecuteDialog $w $activeEditor]
|
||||||
# -bg $cfgVariables(backGround) -fg $cfgVariables(backGround) -command {
|
|
||||||
# $noteBook delete debug
|
|
||||||
# $noteBook raise [$noteBook page end]
|
|
||||||
# return 0
|
|
||||||
# }
|
|
||||||
# pack $w.frmBtn.btnOk -pady 2
|
|
||||||
# key bindings #
|
|
||||||
# bind $w.frmBtn.btnOk <Escape> {
|
|
||||||
# $noteBook delete debug
|
|
||||||
# $noteBook raise [$noteBook page end]
|
|
||||||
# # return 0
|
|
||||||
# }
|
|
||||||
|
|
||||||
bind $w.frame.text <Return> [list Run $w $filePath]
|
|
||||||
bind $w.frame.text <Control-r> [list destroy $w]
|
|
||||||
bind $w.frame.text <Control-Cyrillic_er> [list destroy $w]
|
|
||||||
# focus -force $w.frmBtn.btnOk
|
# focus -force $w.frmBtn.btnOk
|
||||||
# $noteBook raise $node
|
# $noteBook raise $node
|
||||||
# insert debug data into text widget #
|
# insert debug data into text widget #
|
||||||
$w.frame.text tag configure bold -font $cfgVariables(fontBold)
|
$txt tag configure bold -font $cfgVariables(fontBold)
|
||||||
$w.frame.text tag configure error -font $cfgVariables(fontBold) -foreground red
|
$txt tag configure error -font $cfgVariables(fontBold) -foreground red
|
||||||
$w.frame.text tag add bold 0.0 0.end
|
$txt tag add bold 0.0 0.end
|
||||||
# if {$action == "compile"} {
|
|
||||||
# $w.frame.text insert end "[::msgcat::mc "Compile project"] - $activeProject\n"
|
$txt insert end "[::msgcat::mc "Enter command for execute file"] $filePath >\n"
|
||||||
# $w.frame.text insert end "[::msgcat::mc "Compile"] - $prog\n\n"
|
|
||||||
# } elseif {$action == "run"} {
|
|
||||||
# $w.frame.text insert end "[::msgcat::mc "Running project"] - $activeProject\n"
|
|
||||||
# $w.frame.text insert end "[::msgcat::mc "Run"] - $prog\n\n"
|
|
||||||
# }
|
|
||||||
$w.frame.text insert end "[::msgcat::mc "Enter command for execute file"] $filePath >\n"
|
|
||||||
set pos [$w.frame.text index insert]
|
set pos [$w.frame.text index insert]
|
||||||
set lineNum [lindex [split $pos "."] 0]
|
set lineNum [lindex [split $pos "."] 0]
|
||||||
$w.frame.text insert 0.0 "^^^^^^^^^^^^^^^^^^^^^ [::msgcat::mc "Programm output"] ^^^^^^^^^^^^^^^^^\n"
|
$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
|
$w.frame.text tag add bold $lineNum.0 $lineNum.end
|
||||||
focus -force $w.frame.text
|
Highlight::ExecuteColorized $w.frame.text
|
||||||
# open and manipulate executed program chanel #
|
|
||||||
# cd $projDirName
|
# focus -force $w.frame.text
|
||||||
# if {$action == "compile"} {
|
|
||||||
# set cmdCompile ""
|
# Привязки событий для защиты от редактирования
|
||||||
# CompileOption "$projCompiler $prog"
|
# bind $txt <KeyPress> {
|
||||||
# vwait cmdCompile
|
# if {![IsLastLine %W]} {
|
||||||
# puts "string - $projCompiler $prog" ;# debug info
|
# break
|
||||||
# set pipe [open "|$cmdCompile 2> [file join $projDirName errors]" "r"]
|
# }
|
||||||
# set f [open [file join $projDirName errors] "r"]
|
# }
|
||||||
# } elseif {$action == "run"} {
|
# bind $txt <KeyPress-Return> {
|
||||||
# set pipe [open "|$command $filePath" "r"]
|
# # Разрешаем Enter только в последней строке
|
||||||
# set f [open [file join $projDirName errors] "r"]
|
# 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} {
|
proc Run {w filePath} {
|
||||||
@@ -947,8 +1004,19 @@ proc Run {w filePath} {
|
|||||||
set startIndex [$w.frame.text index "end-1l linestart"]
|
set startIndex [$w.frame.text index "end-1l linestart"]
|
||||||
|
|
||||||
set command [$w.frame.text get $startIndex $endIndex end]
|
set command [$w.frame.text get $startIndex $endIndex end]
|
||||||
set pipe [open "|$command $filePath 2> [file join [file dirname $filePath] errors]" "r"]
|
# Заменяем знак %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 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 pipe [open "|$command $filePath" "r"]
|
||||||
# set f [open [file join ~ tmp errors] "r"]
|
# set f [open [file join ~ tmp errors] "r"]
|
||||||
@@ -965,18 +1033,23 @@ proc DebugInfo {widget file f} {
|
|||||||
puts $msg
|
puts $msg
|
||||||
$widget insert "end-4l linestart" "[::msgcat::mc "Program failed"]: $msg\n";
|
$widget insert "end-4l linestart" "[::msgcat::mc "Program failed"]: $msg\n";
|
||||||
} else {
|
} else {
|
||||||
|
# Highlight::ExecuteColorized $widget
|
||||||
puts $msg
|
puts $msg
|
||||||
$widget see "end-1l lineend"
|
$widget see "end-1l lineend"
|
||||||
$widget delete "end-1l lineend" end
|
$widget delete "end-1l lineend" end
|
||||||
# $widget insert end "\n-------------------------------------------------\n"
|
# $widget insert end "\n-------------------------------------------------\n"
|
||||||
# $widget insert end "[::msgcat::mc "Program finished successfully"]\n"
|
# $widget insert end "[::msgcat::mc "Program finished successfully"]\n"
|
||||||
}
|
}
|
||||||
|
Highlight::ExecuteColorized $widget
|
||||||
|
# close $f
|
||||||
} else {
|
} else {
|
||||||
$widget insert "end-4l linestart" [read $file]
|
# Highlight::ExecuteColorized $widget
|
||||||
|
$widget insert "end-4l linestart" "[read $file]"
|
||||||
}
|
}
|
||||||
while {[gets $f line]>=0} {
|
while {[gets $f line]>=0} {
|
||||||
|
Highlight::ExecuteColorized $widget
|
||||||
$widget insert "end-4l linestart" "$line\n"
|
$widget insert "end-4l linestart" "$line\n"
|
||||||
puts $line
|
# puts $line
|
||||||
}
|
}
|
||||||
# close $f
|
# close $f
|
||||||
$widget see end
|
$widget see end
|
||||||
@@ -984,6 +1057,35 @@ proc DebugInfo {widget file f} {
|
|||||||
# $widget configure -state disabled
|
# $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 {} {
|
proc Settings {} {
|
||||||
global dir
|
global dir
|
||||||
@@ -991,3 +1093,34 @@ proc Settings {} {
|
|||||||
FileOper::Edit [file join $dir(cfg) projman.ini]
|
FileOper::Edit [file join $dir(cfg) projman.ini]
|
||||||
# Config::read $dir(cfg)
|
# 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
22
projman.tcl
22
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: alpha19
|
# Release: alpha21
|
||||||
# Build: 29102025200405
|
# 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]
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user