Fix saving "Show dot files" option

Fixed correctly highlightning procedure names
This commit is contained in:
Sergey Kalinin 2018-02-20 20:38:11 +03:00
parent 1f36044d66
commit 22c9a76f27
12 changed files with 108 additions and 29 deletions

View File

@ -9,6 +9,8 @@
20.02.2018 20.02.2018
- Refactoring auto update file structure (tree). Now structure updated when file was saving - Refactoring auto update file structure (tree). Now structure updated when file was saving
- Refactoring "Settings" dialog - Refactoring "Settings" dialog
- Fix saving "Show dot files" option
- Fixed correctly highlightning procedure names
19.02.2018 19.02.2018
- Fix "New file" ctrl+n hotkey - Fix "New file" ctrl+n hotkey
@ -384,3 +386,5 @@ characters to the right of the insertion cursor.

View File

@ -626,13 +626,22 @@ proc EditFile {tree node fileName} {
$noteBook raise $node $noteBook raise $node
return return
} }
# Textbox with line numbers
# text $w.textLines\
# -relief flat -highlightthickness 0 -font $editor(font) -blockcursor true\
# -selectborderwidth 0 -selectbackground $editor(selectbg) -width 5 \
# -background $editor(bg) -foreground $editor(fg)
# pack $w.textLines -side left -fill y -expand true
# Editor textbox
set scrwin [ScrolledWindow $w.scrwin -bg $editor(bg)] set scrwin [ScrolledWindow $w.scrwin -bg $editor(bg)]
pack $scrwin -fill both -expand true pack $scrwin -side left -fill both -expand true
text $w.text\ text $w.text -relief sunken -wrap $editor(wrap) -highlightthickness 0 \
-relief sunken -wrap $editor(wrap) -highlightthickness 0 -undo 1 -font $editor(font) -blockcursor true\ -undo 1 -font $editor(font) -blockcursor true -selectborderwidth 0 \
-selectborderwidth 0 -selectbackground $editor(selectbg) -width 10 -background $editor(bg) -foreground $editor(fg) -selectbackground $editor(selectbg) -width 10 -background $editor(bg) \
-foreground $editor(fg)
pack $w.text -side left -fill both -expand true pack $w.text -side left -fill both -expand true
#$scrwin setwidget $w.textLines
$scrwin setwidget $w.text $scrwin setwidget $w.text
if {$backUpFileCreate == "Yes"} {file copy -force $fileName "$fileName~"} if {$backUpFileCreate == "Yes"} {file copy -force $fileName "$fileName~"}
@ -972,3 +981,5 @@ proc ReadFileStructure {mod line lineNumber tree node} {
#################################### ####################################
GetOp GetOp

View File

@ -615,3 +615,5 @@ proc FileOperation::FileDialog {tree operation} {

View File

@ -51,13 +51,34 @@ proc HighLightTCL {text line lineNumber node} {
$text tag add bold $lineNumber.$startPos $lineNumber.$endPos $text tag add bold $lineNumber.$startPos $lineNumber.$endPos
} }
if {[string trim $word]=="proc"} { if {[string trim $word]=="proc"} {
$text tag add procName $lineNumber.[expr $startPos + $length] $lineNumber.[string wordend $line [expr $startPos + $length +2]] #$text tag add procName $lineNumber.[expr $startPos + $length] $lineNumber.[string wordend $line [expr $startPos + $length +2]]
} }
set startPos [expr $endPos + 1] set startPos [expr $endPos + 1]
} else { } else {
break break
} }
} }
# Procedure name highlight
set workLine $line
while {$workLine != ""} {
#regexp -nocase -all -line -- {proc (::|)(\w+)(::|)(\w+) \{(.*)\} \{} $workLine match v1 v2 v3 v4 params
set endPos [string first "\{" $workLine]
#puts $workLine
if {[regexp -nocase -all -line -- {proc (::|)(\w+)(::|-|_|)(\w+)(.+) \{(.*)\} \{} $workLine match v1 v2 v3 v4 v5 params]} {
set word "$v1$v2$v3$v4$v5"
puts $word
set length [string length $word]
set startPos [string first [string trim $word] $line]
#set endPos [expr $startPos + $length]
set workLine [string range $workLine $length end]
puts "$length $startPos $endPos\n$workLine"
$text tag add procName $lineNumber.$startPos $lineNumber.$endPos
set startPos [expr $endPos + 1]
} else {
break
}
}
set workLine $line set workLine $line
while {$workLine != ""} { while {$workLine != ""} {
if {[regexp {(\{|\[)[a-zA-Z\\_:]+} $workLine word v]} { if {[regexp {(\{|\[)[a-zA-Z\\_:]+} $workLine word v]} {
@ -213,4 +234,3 @@ proc HighLightTCL {text line lineNumber node} {
} }
} }

View File

@ -1008,5 +1008,6 @@ proc InsertTitle {newFile type} {

View File

@ -10,7 +10,7 @@ proc Settings {nBook} {
global fontNormal fontBold imgDir workDir global fontNormal fontBold imgDir workDir
global editor color nb topLevelGeometry global editor color nb topLevelGeometry
global main editFrm network global main editFrm network
global toolBar autoFormat backUpDel backUpCreate backUpShow localeSet localeList wrapSet wrapList global toolBar autoFormat backUpDel backUpCreate backUpShow showDotFiles localeSet localeList wrapSet wrapList
set topLevelGeometry [winfo geometry .] set topLevelGeometry [winfo geometry .]
if {[$nBook index settings] != -1} { if {[$nBook index settings] != -1} {
$nBook delete settings $nBook delete settings
@ -20,16 +20,17 @@ proc Settings {nBook} {
# destroy the find window if it already exists # destroy the find window if it already exists
frame $w.frmMain -borderwidth 1 frame $w.frmMain -borderwidth 1
pack $w.frmMain -side top -fill both -expand 1 pack $w.frmMain -side top -fill both -expand true
frame $w.frmBtn -borderwidth 1 frame $w.frmBtn -borderwidth 1
pack $w.frmBtn -side top -fill x pack $w.frmBtn -side top -fill x
set nb [NoteBook $w.frmMain.noteBook -font $fontBold -side bottom -bg $editor(bg) -fg $editor(fg)] set nb [NoteBook $w.frmMain.noteBook -font $fontBold \
-side bottom -bg $editor(bg) -fg $editor(fg)]
pack $nb -fill both -expand true -padx 2 -pady 2 pack $nb -fill both -expand true -padx 2 -pady 2
button $w.frmBtn.btnFind -text [::msgcat::mc "Save"] -font $fontNormal -width 12 -relief groove \ button $w.frmBtn.btnFind -text [::msgcat::mc "Save"] \
-bg $editor(bg) -fg $editor(fg) \ -font $fontNormal -width 12 -relief flat \
-command { -bg $editor(bg) -fg $editor(fg) -command {
file copy -force [file join $workDir projman.conf] [file join $workDir projman.conf.old] file copy -force [file join $workDir projman.conf] [file join $workDir projman.conf.old]
set file [open [file join $workDir projman.conf] w] set file [open [file join $workDir projman.conf] w]
puts $file "###########################################################" puts $file "###########################################################"
@ -67,7 +68,7 @@ proc Settings {nBook} {
} else { } else {
puts $file "set backUpFileDelete \"Yes\"" puts $file "set backUpFileDelete \"Yes\""
} }
if {$dotFileShow == "false"} { if {$showDotFiles == "false"} {
puts $file "set dotFileShow \"No\"" puts $file "set dotFileShow \"No\""
} else { } else {
puts $file "set dotFileShow \"Yes\"" puts $file "set dotFileShow \"Yes\""
@ -131,14 +132,14 @@ proc Settings {nBook} {
#destroy $w #destroy $w
.frmBody.frmWork.noteBook delete settings .frmBody.frmWork.noteBook delete settings
} }
button $w.frmBtn.btnCancel -text [::msgcat::mc "Close"] -relief groove -width 12\ button $w.frmBtn.btnCancel -text [::msgcat::mc "Close"] -relief flat -width 12\
-font $fontNormal -command "destroy $w; $nBook delete settings " -bg $editor(bg) -fg $editor(fg) -font $fontNormal -command "destroy $w; $nBook delete settings " -bg $editor(bg) -fg $editor(fg)
pack $w.frmBtn.btnFind $w.frmBtn.btnCancel -fill x -padx 5 -pady 5 -side right pack $w.frmBtn.btnFind $w.frmBtn.btnCancel -fill x -padx 5 -pady 5 -side right
################## MAIN PREF ########################## ################## MAIN PREF ##########################
set main [$nb insert end main -text "[::msgcat::mc "Main"]"] set main [$nb insert end main -text "[::msgcat::mc "Main"]"]
set scrwin [ScrolledWindow $main.scrwin -relief groove -bd 2 -bg $editor(bg)] set scrwin [ScrolledWindow $main.scrwin -relief flat -bd 2 -bg $editor(bg)]
#pack $scrwin -fill both -expand true #pack $scrwin -fill both -expand true
set scrfrm [ScrollableFrame $main.frm -bg $editor(bg)] set scrfrm [ScrollableFrame $main.frm -bg $editor(bg)]
pack $scrwin -fill both -expand true pack $scrwin -fill both -expand true
@ -146,7 +147,8 @@ proc Settings {nBook} {
$scrwin setwidget $scrfrm $scrwin setwidget $scrfrm
set main [$scrfrm getframe] set main [$scrfrm getframe]
label $main.lblWinTitle -text [::msgcat::mc "Main settings"] -height 2 -font $fontBold
pack $main.lblWinTitle -side top -fill x -expand true
set frm_1 [frame $main.frmFontNormal -bg $editor(bg)] set frm_1 [frame $main.frmFontNormal -bg $editor(bg)]
label $frm_1.lblFontNormal -text [::msgcat::mc "Font normal"] -width 30\ label $frm_1.lblFontNormal -text [::msgcat::mc "Font normal"] -width 30\
-anchor w -font $fontNormal -fg $editor(fg) -bg $editor(bg) -anchor w -font $fontNormal -fg $editor(fg) -bg $editor(bg)
@ -262,27 +264,30 @@ proc Settings {nBook} {
-font $fontNormal -onvalue true -offvalue false -font $fontNormal -onvalue true -offvalue false
pack $frm_12.lblBackUpDel -side left pack $frm_12.lblBackUpDel -side left
pack $frm_12.chkBackUpDel -side left pack $frm_12.chkBackUpDel -side left
set frm_13 [frame $main.frmDotFilesShow -bg $editor(bg)] set frm_13 [frame $main.frmDotFilesShow -bg $editor(bg)]
label $frm_13.lblDotFilesShow -text [::msgcat::mc "Show dot files"]\ label $frm_13.lblDotFilesShow -text [::msgcat::mc "Show dot files"]\
-width 30 -anchor w -font $fontNormal -fg $editor(fg) -width 30 -anchor w -font $fontNormal -fg $editor(fg)
checkbutton $frm_13.chkDotFilesShow -text "" -variable showDotFiles \ checkbutton $frm_13.chkDotFilesShow -text "" -variable showDotFiles \
-font $fontNormal -onvalue true -offvalue false -font $fontNormal -onvalue true -offvalue false
pack $frm_13.lblDotFilesShow -side left pack $frm_13.lblDotFilesShow -side left
pack $frm_13.chkDotFilesShow -side left pack $frm_13.chkDotFilesShow -side left
pack $frm_1 $frm_2 $frm_5 $frm_3 $frm_4 $frm_6 $frm_7 \ pack $frm_1 $frm_2 $frm_5 $frm_3 $frm_4 $frm_6 $frm_7 \
$frm_8 $frm_9 $frm_10 $frm_11 $frm_12 $frm_13 -side top -fill both -expand true $frm_8 $frm_9 $frm_10 $frm_11 $frm_12 $frm_13 -side top -fill both -expand true -padx 5 -pady 2
#################### EDITOR PREF ######################### #################### EDITOR PREF #########################
set editFrm [$nb insert end editor -text "[::msgcat::mc "Editor"]"] set editFrm [$nb insert end editor -text "[::msgcat::mc "Editor"]"]
set scrwin [ScrolledWindow $editFrm.scrwin -relief groove -bd 2 -bg $editor(bg)] set scrwin [ScrolledWindow $editFrm.scrwin -relief flat -bd 2 -bg $editor(bg)]
set scrfrm [ScrollableFrame $editFrm.frm -bg $editor(bg)] set scrfrm [ScrollableFrame $editFrm.frm -bg $editor(bg)]
pack $scrwin -fill both -expand true pack $scrwin -fill both -expand true -fill both
pack $scrfrm -fill both -expand true pack $scrfrm -fill both -expand true -fill both
$scrwin setwidget $scrfrm $scrwin setwidget $scrfrm
set editFrm [$scrfrm getframe] set editFrm [$scrfrm getframe]
label $editFrm.lblTitle -text [::msgcat::mc "Editor settings"] -height 2 -font $fontBold
pack $editFrm.lblTitle -side top -fill x -expand true
set frm_13 [frame $editFrm.frmEditorFont -bg $editor(bg)] set frm_13 [frame $editFrm.frmEditorFont -bg $editor(bg)]
label $frm_13.lblEditorFont -text [::msgcat::mc "Editor font"] -width 30\ label $frm_13.lblEditorFont -text [::msgcat::mc "Editor font"] -width 30\
@ -596,8 +601,10 @@ proc Settings {nBook} {
pack $frm_41.txtColorBraceQuad -side left -fill x -expand true pack $frm_41.txtColorBraceQuad -side left -fill x -expand true
pack $frm_41.btnColorBraceQuad -side left pack $frm_41.btnColorBraceQuad -side left
pack $frm_13 $frm_14 $frm_15 $frm_28 $frm_21 $frm_22 $frm_32 $frm_33 $frm_34 $frm_16 $frm_17 $frm_35 $frm_36 $frm_18 $frm_19 $frm_20\ pack $frm_13 $frm_14 $frm_15 $frm_28 $frm_21 $frm_22 $frm_32 \
$frm_23 $frm_41 $frm_24 $frm_25 $frm_26 $frm_27 $frm_37 $frm_38 $frm_39 $frm_40 -side top -fill x -expand true $frm_33 $frm_34 $frm_16 $frm_17 $frm_35 $frm_36 $frm_18 $frm_19 \
$frm_20 $frm_23 $frm_41 $frm_24 $frm_25 $frm_26 $frm_27 $frm_37 \
$frm_38 $frm_39 $frm_40 -side top -fill x -expand true -padx 5 -pady 2
################### NETWORK PREF ######################### ################### NETWORK PREF #########################
set network [$nb insert end network -text "[::msgcat::mc "Network"]" -state disabled] set network [$nb insert end network -text "[::msgcat::mc "Network"]" -state disabled]
@ -674,7 +681,7 @@ proc LoadSettings {} {
global fontNormal imgDir workDir msgDir global fontNormal imgDir workDir msgDir
global editor color nb global editor color nb
global main editFrm network global main editFrm network
global toolBar autoFormat backUpDel backUpCreate backUpShow localeSet localeList wrapSet wrapList global toolBar autoFormat backUpDel backUpCreate backUpShow showDotFiles localeSet localeList wrapSet wrapList
## load .conf file ## ## load .conf file ##
set file [open [file join $workDir projman.conf] r] set file [open [file join $workDir projman.conf] r]
@ -721,6 +728,13 @@ proc LoadSettings {} {
set backUpDel "false" set backUpDel "false"
} }
} }
dotFileShow {
if {$var == "Yes"} {
set showDotFiles "true"
} else {
set showDotFiles "false"
}
}
projDir {InsertEnt $main.frmProjDir.txtProjDir "$var"} projDir {InsertEnt $main.frmProjDir.txtProjDir "$var"}
rpmDir {InsertEnt $main.frmRpmDir.txtRpmDir "$var"} rpmDir {InsertEnt $main.frmRpmDir.txtRpmDir "$var"}
tgzDir {InsertEnt $main.frmTgzDir.txtTgzDir "$var"} tgzDir {InsertEnt $main.frmTgzDir.txtTgzDir "$var"}
@ -814,6 +828,11 @@ proc SaveSettings {} {
} else { } else {
puts $file "set backUpFileDelete \"Yes\"" puts $file "set backUpFileDelete \"Yes\""
} }
if {$showDotFiles == "false"} {
puts $file "set dotFileShow \"No\""
} else {
puts $file "set dotFileShow \"Yes\""
}
puts $file "\n# Don't edit this line" puts $file "\n# Don't edit this line"
puts $file "# Directorys Settings #" puts $file "# Directorys Settings #"
puts $file "set projDir \"[$main.frmProjDir.txtProjDir get]\"" puts $file "set projDir \"[$main.frmProjDir.txtProjDir get]\""
@ -873,3 +892,7 @@ proc SaveSettings {} {
$noteBook raise [$noteBook page end] $noteBook raise [$noteBook page end]
} }

View File

@ -385,3 +385,4 @@ proc supertext::text_index {w i} {

View File

@ -56,6 +56,7 @@
::msgcat::mcset en "Editor font" ::msgcat::mcset en "Editor font"
::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 "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?"
@ -86,6 +87,7 @@
::msgcat::mcset en "Make RPM" ::msgcat::mcset en "Make RPM"
::msgcat::mcset en "Make archive" ::msgcat::mcset en "Make archive"
::msgcat::mcset en "Make backup files" ::msgcat::mcset en "Make backup files"
::msgcat::mcset en "Main settings"
::msgcat::mcset en "Modifying the Registry..." ::msgcat::mcset en "Modifying the Registry..."
::msgcat::mcset en "Must be one file select!" ::msgcat::mcset en "Must be one file select!"
::msgcat::mcset en "Must be one or two file select!" ::msgcat::mcset en "Must be one or two file select!"
@ -152,6 +154,7 @@
::msgcat::mcset en "Selection color" ::msgcat::mcset en "Selection color"
::msgcat::mcset en "Settings" ::msgcat::mcset en "Settings"
::msgcat::mcset en "Show backup files" ::msgcat::mcset en "Show backup files"
::msgcat::mcset en "Show dot files"
::msgcat::mcset en "Split edit window" ::msgcat::mcset en "Split edit window"
::msgcat::mcset en "Interpretator" ::msgcat::mcset en "Interpretator"
::msgcat::mcset en "Text autoformat" ::msgcat::mcset en "Text autoformat"
@ -172,3 +175,5 @@
::msgcat::mcset en "Work dir" ::msgcat::mcset en "Work dir"

View File

@ -58,6 +58,7 @@
::msgcat::mcset ru "Editor foreground" "Цвет шрифта" ::msgcat::mcset ru "Editor foreground" "Цвет шрифта"
::msgcat::mcset ru "Editor font" "Шрифт редактора" ::msgcat::mcset ru "Editor font" "Шрифт редактора"
::msgcat::mcset ru "Editor font bold" "Шрифт редактора жирный" ::msgcat::mcset ru "Editor font bold" "Шрифт редактора жирный"
::msgcat::mcset ru "Editor settings" "Настройки редактора"
::msgcat::mcset ru "Encode" "Перекодировка" ::msgcat::mcset ru "Encode" "Перекодировка"
::msgcat::mcset ru "Error open URL" "Ошибка открытия URL" ::msgcat::mcset ru "Error open URL" "Ошибка открытия URL"
::msgcat::mcset ru "Exit" "Выход" ::msgcat::mcset ru "Exit" "Выход"
@ -91,6 +92,7 @@
::msgcat::mcset ru "Make archive" "Создать архив" ::msgcat::mcset ru "Make archive" "Создать архив"
::msgcat::mcset ru "Make backup files" "Создавать временные файлы" ::msgcat::mcset ru "Make backup files" "Создавать временные файлы"
::msgcat::mcset ru "Main" "Общие" ::msgcat::mcset ru "Main" "Общие"
::msgcat::mcset ru "Main settings" "Общие настройки"
::msgcat::mcset ru "Modules" "Модули" ::msgcat::mcset ru "Modules" "Модули"
::msgcat::mcset ru "Modifying the Registry..." "Внесение изменений в реестр" ::msgcat::mcset ru "Modifying the Registry..." "Внесение изменений в реестр"
::msgcat::mcset ru "Must be one file select!" "Вы должны выбрать только один файл" ::msgcat::mcset ru "Must be one file select!" "Вы должны выбрать только один файл"
@ -157,6 +159,7 @@
::msgcat::mcset ru "Selection color" "Цвет выделения" ::msgcat::mcset ru "Selection color" "Цвет выделения"
::msgcat::mcset ru "Settings" "Установки" ::msgcat::mcset ru "Settings" "Установки"
::msgcat::mcset ru "Show backup files" "Показывать временные файлы" ::msgcat::mcset ru "Show backup files" "Показывать временные файлы"
::msgcat::mcset ru "Show dot files" "Показывать скрытые файлы"
::msgcat::mcset ru "Split edit window" "Разделить окно редактора" ::msgcat::mcset ru "Split edit window" "Разделить окно редактора"
::msgcat::mcset ru "Text autoformat" "Автоформат текста" ::msgcat::mcset ru "Text autoformat" "Автоформат текста"
::msgcat::mcset ru "TGZ dir" "Каталог TGZ" ::msgcat::mcset ru "TGZ dir" "Каталог TGZ"
@ -177,3 +180,5 @@

View File

@ -75,3 +75,4 @@ set color(sql) "#ffff828f0000"
# Last active project (changed automaticaly) # Last active project (changed automaticaly)
set workingProject "" set workingProject ""

View File

@ -3,11 +3,12 @@
exec wish "$0" -- "$@" exec wish "$0" -- "$@"
############################################### ###############################################
# Tcl/Tk Project Manager # # Tcl/Tk Project Manager #
# Distrubuted under GPL # # Distrubuted under GPL #
# Copyright (c) "Sergey Kalinin", 2001, http://nuk-svk.ru # # Copyright (c) "Sergey Kalinin", 2001, #
# Author: Sergey Kalinin banzaj28@yandex.ru # # Home: http://nuk-svk.ru #
############################################## # Author: Sergey Kalinin banzaj28@yandex.ru #
###############################################
########## VERSION INFORMATION ########## ########## VERSION INFORMATION ##########
set ver "0.4.5" set ver "0.4.5"
@ -177,3 +178,5 @@ option add *Dialog.msg.background $editor(bg)
# #

View File

@ -1364,3 +1364,6 @@ proc make-regexp::make-regexp {words} {
} }
#============================================================================================== #==============================================================================================