From e86b600cd9b625ee312c589f0c8a04c8ee8cdffd Mon Sep 17 00:00:00 2001 From: svk Date: Fri, 30 Jan 2026 13:47:05 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B4=D0=B8=D0=B0=D0=BB=D0=BE=D0=B3=20'=D0=A1=D0=BE=D1=85?= =?UTF-8?q?=D1=80=D0=B0=D0=BD=D0=B8=D1=82=D1=8C=20=D0=BA=D0=B0=D0=BA'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/changelog | 1 + lib/editor.tcl | 2 ++ lib/files.tcl | 29 +++++++++++++++++++++++++++-- lib/helper.tcl | 1 - lib/menu.tcl | 2 ++ projman.tcl | 2 +- 6 files changed, 33 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index f7477d7..ff29f9b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ projman (2.0.0-beta3) stable; urgency=medium + * Добавил диалог вменю "Сохранить как" * Вынес код связанный с обработкой подсказок при вводе переменных и процедур в отдельный модуль. * Исправил работу со списком переменных из всплывающего окна. Теперь там можно выбрать из списка стрелками и вставить по Enter. Исправил обработку клавиш Вверх Вниз Ввод Отмена в окне со списком вариантов. diff --git a/lib/editor.tcl b/lib/editor.tcl index ff85af6..1a2ebc5 100644 --- a/lib/editor.tcl +++ b/lib/editor.tcl @@ -745,6 +745,8 @@ namespace eval Editor { } bind $txt "Editor::SplitEditorForExecute $w $fileType $nb " bind $txt "Editor::SplitEditorForExecute $w $fileType $nb " + # bind $txt FileOper::Close + # bind $txt "FileOper::Close saveas" # bind $txt.t "Editor::ReleaseKey %K $txt.t $fileType" # bind $txt.t "Editor::PressKey %K $txt.t" diff --git a/lib/files.tcl b/lib/files.tcl index df4cdb3..04db052 100644 --- a/lib/files.tcl +++ b/lib/files.tcl @@ -383,6 +383,8 @@ namespace eval FileOper { set filePath [Tree::GetItemID $tree $treeItem] } set editedText [$nbEditorItem.frmText.t get 0.0 end] + if {$type eq "saveas"} {set filePath [FileOper::SaveDialog]} + DebugPuts "FileOper::Save $filePath" set f [open $filePath "w+"] puts -nonewline $f $editedText # puts "$f was saved" @@ -397,7 +399,7 @@ namespace eval FileOper { Tools::GetMenu .popup.tools Tools::GetMenu .frmMenu.mnuTools.m } - if [string match "*untitled*" $nbEditorItem] { + if {[string match "*untitled*" $nbEditorItem] || $type eq "saveas"} { FileOper::Close if {$type ne "close"} { FileOper::Edit $filePath @@ -627,5 +629,28 @@ namespace eval FileOper { # set selEnd [lindex [$txt tag ranges sel] 1] # puts [$txt get [$txt tag ranges sel]] # } - + + proc SaveDialog {} { + global env project activeProject + if [info exists activeProject] { + set dir $activeProject + } else { + set dir $env(HOME) + } + set fileName [tk_getSaveFile -initialdir $dir -filetypes $::types -parent .] + set fullPath [file join $dir $fileName] + set file [string range $fullPath [expr [string last "/" $fullPath]+1] end] + DebugPuts "FileOper::SaveDialog $fullPath" + regsub -all "." $file "_" node + set dir [file dirname $fullPath] + set file [file tail $fullPath] + set name [file rootname $file] + set ext [string range [file extension $file] 1 end] + if {$fullPath != ""} { + # puts $fullPath + return $fullPath + } else { + return + } + } } diff --git a/lib/helper.tcl b/lib/helper.tcl index dadd7c1..64346f8 100644 --- a/lib/helper.tcl +++ b/lib/helper.tcl @@ -337,4 +337,3 @@ namespace eval Helper { puts "DEBUG: $msg" } } - diff --git a/lib/menu.tcl b/lib/menu.tcl index 92643ea..1993f14 100644 --- a/lib/menu.tcl +++ b/lib/menu.tcl @@ -20,6 +20,8 @@ proc GetFileMenu {m} { } $m add command -label [::msgcat::mc "Save file"] -command {FileOper::Save}\ -accelerator "Ctrl+S" + $m add command -label [::msgcat::mc "Save as"] -command {FileOper::Save saveas}\ + -accelerator "Shift+Ctrl+S" $m add command -label [::msgcat::mc "Close file"] -command {FileOper::Close}\ -accelerator "Ctrl+w" $m add command -label [::msgcat::mc "Close all"] -command {FileOper::CloseAll} diff --git a/projman.tcl b/projman.tcl index 519f949..badd6a2 100755 --- a/projman.tcl +++ b/projman.tcl @@ -10,7 +10,7 @@ exec wish8.6 "$0" -- "$@" ###################################################### # Version: 2.0.0 # Release: beta3 -# Build: 29012026155729 +# Build: 30012026134326 ###################################################### # определим текущую версию, релиз и т.д.