2018-02-22 15:45:46 +03:00
# #################################################
# Tcl/Tk Project Manager
# Distributed under GNU Public License
2018-02-18 15:01:56 +03:00
# Author: Serge Kalinin banzaj28@yandex.ru
# Copyright (c) "https://nuk-svk.ru", 2018,
# Home: https://bitbucket.org/svk28/projman
2018-02-22 15:45:46 +03:00
# #################################################
2018-02-18 15:01:56 +03:00
proc NewProj { type proj l} {
global fontNormal fontBold tree projDir workDir activeProject fileList noteBook imgDir prjDir
global openProjDir tclDir frm lang operType
set operType $type
if { $operType == " e d i t " && $proj == " " } {
set answer [ tk_messageBox \
-message " [ : : m s g c a t : : m c " N o t f o u n d a c t i v e p r o j e c t " ] " \
-type ok - icon warning - title [ : : msgcat : : mc " W a r n i n g " ] ]
case $answer {
ok { return 0 }
}
}
set typeProjects " T c l T c l / T k J a v a P e r l F o r t r a n O ' C a m l P H P R u b y E r l a n g "
set node [ $noteBook page [ $noteBook index newproj] ]
if { $node != " " } {
$noteBook raise newproj
return 0
} else {
set w [ $noteBook insert end newproj - text [ : : msgcat : : mc " N e w p r o j e c t " ] ]
}
set frm [ frame $w.frmProjSettings ]
pack $frm - fill both - expand true
image create photo imgFold - format gif - file [ file join $imgDir folder.gif]
variable frm_1
set frm_1 [ frame $frm.frmProjName ]
label $frm_1.lblProjName - text [ : : msgcat : : mc " P r o j e c t n a m e " ] - width 20 - anchor w
entry $frm_1.txtProjName - textvariable txtProjName - bd 0 - relief flat
pack $frm_1.lblProjName - side left
pack $frm_1.txtProjName - side left - fill x - expand true
# ##
set frm_lang [ frame $frm.frmLanguage ]
set lang " T c l "
label $frm_lang.lblLanguage - text [ : : msgcat : : mc " P r o j e c t t y p e " ] - width 20 - anchor w
set combo [
ComboBox $frm_lang.txtLocale \
-textvariable lang - editable false \
-autocomplete true - autopost true \
-selectbackground " # 5 5 c 4 d 1 " - selectborderwidth 0 \
-values $typeProjects
]
# $combo setvalues $lang
pack $frm_lang.lblLanguage - side left
pack $combo - fill x - expand true
bind $combo < ButtonRelease-1> { append txtFileName " . [ G e t E x t e n t i o n P r o j $ l a n g ] " }
# ##
set frm_2 [ frame $frm.frmFileName ]
label $frm_2.lblFileName - text [ : : msgcat : : mc " P r o j e c t f i l e " ] - width 20 - anchor w
entry $frm_2.txtFileName - textvariable txtFileName - bd 0 - relief flat
pack $frm_2.lblFileName - side left
pack $frm_2.txtFileName - side left - fill x - expand true
bind $frm_2.txtFileName < FocusIn> {
append txtFileName " . [ G e t E x t e n t i o n P r o j $ l a n g ] "
}
# $frm_2.txtFileName insert end $txtProjName
set frm_8 [ frame $frm.frmDirName ]
label $frm_8.lblDirName - text [ : : msgcat : : mc " P r o j e c t d i r " ] - width 20 - anchor w
entry $frm_8.txtDirName - textvariable txtDirName
button $frm_8.btnDirName - image imgFold - relief flat \
-command {
$frm.frmDirName.txtDirName configure - state normal
InsertEnt $frm.frmDirName.txtDirName [ tk_chooseDirectory - initialdir $projDir - title " [ : : m s g c a t : : m c " S e l e c t d i r e c t o r y " ] " - parent .]
$frm.frmDirName.txtDirName configure - state disable
}
pack $frm_8.lblDirName - side left
pack $frm_8.txtDirName - side left - fill x - expand true
pack $frm_8.btnDirName - side left
bind $frm_8.txtDirName < FocusIn> {
}
set frm_13 [ frame $frm.frmCompiler ]
label $frm_13.lblCompiler - text [ : : msgcat : : mc " C o m p i l e r " ] \
-width 20 - anchor w
entry $frm_13.txtCompiler - textvariable txtCompiler
button $frm_13.btnCompiler - image imgFold - relief flat\
-command {
InsertEnt $frm.frmCompiler.txtCompiler [ tk_getOpenFile - initialdir $tclDir - parent .]
}
pack $frm_13.lblCompiler - side left
pack $frm_13.txtCompiler - side left - fill x - expand true
pack $frm_13.btnCompiler - side left
set txtProjInterp [ GetInterp $lang ]
set frm_12 [ frame $frm.frmProjInterp ]
label $frm_12.lblProjInterp - text [ : : msgcat : : mc " I n t e r p e t a t o r " ] \
-width 20 - anchor w
entry $frm_12.txtProjInterp - textvariable txtProjInterp
button $frm_12.btnInterp - image imgFold - relief flat\
-command {
InsertEnt $frm.frmProjInterp.txtProjInterp [ tk_getOpenFile - initialdir $tclDir - parent .]
}
pack $frm_12.lblProjInterp - side left
pack $frm_12.txtProjInterp - side left - fill x - expand true
pack $frm_12.btnInterp - side left
bind $frm_12.txtProjInterp < FocusIn> {
set txtProjInterp [ GetInterp $lang ]
}
set frm_4 [ frame $frm.frmVersion ]
label $frm_4.lblProjVersion - text [ : : msgcat : : mc " V e r s i o n " ] - width 20 - anchor w
entry $frm_4.txtProjVersion - textvariable txtProjVersion - bd 0 - relief flat
pack $frm_4.lblProjVersion - side left
pack $frm_4.txtProjVersion - side left - fill x - expand true
InsertEnt $frm_4.txtProjVersion " 0 . 0 . 1 "
set frm_11 [ frame $frm.frmRelease ]
label $frm_11.lblProjRelease - text [ : : msgcat : : mc " R e l e a s e " ] - width 20 - anchor w
entry $frm_11.txtProjRelease - textvariable txtProjRelease - bd 0 - relief flat
pack $frm_11.lblProjRelease - side left
pack $frm_11.txtProjRelease - side left - fill x - expand true
InsertEnt $frm_11.txtProjRelease " 1 "
set frm_3 [ frame $frm.frmProjAuthor ]
label $frm_3.lblProjAuthor - text [ : : msgcat : : mc " A u t h o r " ] - width 20 - anchor w
entry $frm_3.txtProjAuthor - textvariable txtProjAuthor - bd 0 - relief flat
pack $frm_3.lblProjAuthor - side left
pack $frm_3.txtProjAuthor - side left - fill x - expand true
set frm_9 [ frame $frm.frmProjEmail ]
label $frm_9.lblProjEmail - text [ : : msgcat : : mc " E - m a i l " ] - width 20 - anchor w
entry $frm_9.txtProjEmail - textvariable txtProjEmail - bd 0 - relief flat
pack $frm_9.lblProjEmail - side left
pack $frm_9.txtProjEmail - side left - fill x - expand true
set frm_5 [ frame $frm.frmProjCompany ]
label $frm_5.lblProjCompany - text [ : : msgcat : : mc " C o m p a n y " ] - width 20 - anchor w
entry $frm_5.txtProjCompany - textvariable txtProjCompany - bd 0 - relief flat
pack $frm_5.lblProjCompany - side left
pack $frm_5.txtProjCompany - side left - fill x - expand true
set frm_10 [ frame $frm.frmProjHome ]
label $frm_10.lblProjHome - text [ : : msgcat : : mc " H o m e p a g e " ] - width 20 - anchor w
entry $frm_10.txtProjHome - textvariable txtProjHome
pack $frm_10.lblProjHome - side left
pack $frm_10.txtProjHome - side left - fill x - expand true
set frm_7 [ frame $frm.frmWinTitle ]
label $frm_7.lblWinTitle - text [ : : msgcat : : mc " C r e a t e n e w p r o j e c t " ] - height 2 - font $fontBold
pack $frm_7.lblWinTitle - fill x - expand true
set frm_6 [ frame $frm.frmBtn ]
if { $operType == " e d i t " && $proj != " " } {
$noteBook itemconfigure newproj - text [ : : msgcat : : mc " P r o j e c t s e t t i n g s " ]
button $frm_6.btnProjCreate - text [ : : msgcat : : mc " S a v e " ] - relief flat \
-font $fontNormal - command {
regsub - all { \ \ } $txtProjInterp { \ \ \ \ } $txtProjInterp
SaveProj " $ t x t F i l e N a m e " " $ l a n g " " $ t x t P r o j N a m e " " $ t x t F i l e N a m e " " $ t x t D i r N a m e " \
" $ t x t C o m p i l e r " " $ t x t P r o j I n t e r p " " $ t x t P r o j V e r s i o n " " $ t x t P r o j R e l e a s e " \
" $ t x t P r o j A u t h o r " " $ t x t P r o j E m a i l " " $ t x t P r o j C o m p a n y " " $ t x t P r o j H o m e "
$noteBook delete newproj
$noteBook raise [ $noteBook page end]
}
} else {
button $frm_6.btnProjCreate - text [ : : msgcat : : mc " C r e a t e " ] - relief flat \
-font $fontNormal - command {
CreateProj " $ o p e r T y p e " " $ l a n g " " $ t x t F i l e N a m e " " $ t x t P r o j N a m e " " $ t x t F i l e N a m e " " $ t x t D i r N a m e " \
" $ t x t C o m p i l e r " " $ t x t P r o j I n t e r p " " $ t x t P r o j V e r s i o n " " $ t x t P r o j R e l e a s e " \
" $ t x t P r o j A u t h o r " " $ t x t P r o j E m a i l " " $ t x t P r o j C o m p a n y " " $ t x t P r o j H o m e "
$noteBook delete newproj
$noteBook raise [ $noteBook page end]
}
}
button $frm_6.btnClose - text [ : : msgcat : : mc " C a n c e l " ] - relief flat - font $fontNormal - command {
$noteBook delete newproj
$noteBook raise [ $noteBook page end]
}
pack $frm_6.btnProjCreate $frm_6.btnClose - padx 10 - pady 20 - side right
pack $frm_7 $frm_1 $frm_lang $frm_2 $frm_8 $frm_13 $frm_12 $frm_4 $frm_11 $frm_3 $frm_9 $frm_5 $frm_10 $frm_6 \
-side top - fill x - padx 10 - pady 5
pack $frm_6 - side top - fill x - expand true - anchor n
bind $w < Escape> " $ n o t e B o o k d e l e t e n e w p r o j "
$noteBook raise newproj
# # EDIT PROJECT SETTINGS ##
if { $operType == " e d i t " && $proj != " " } {
$frm.frmDirName.txtDirName configure - state normal
$frm_7.lblWinTitle configure - text [ : : msgcat : : mc " P r o j e c t s e t t i n g s " ]
$frm_6.btnProjCreate configure - text " [ : : m s g c a t : : m c " S a v e " ] "
set file [ open [ file join $workDir $proj.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 " \" " ]
# regsub -all " " $string "_" project
puts $string
switch $keyWord {
ProjectName { InsertEnt $frm_1.txtProjName " $ s t r i n g " }
ProjectFileName { InsertEnt $frm_2.txtFileName " $ s t r i n g " }
ProjectLanguage { set lang " $ s t r i n g " }
ProjectDirName { InsertEnt $frm_8.txtDirName " $ s t r i n g " }
ProjectCompiler { InsertEnt $frm_13.txtCompiler " $ s t r i n g " }
ProjectInterp { InsertEnt $frm_12.txtProjInterp " $ s t r i n g " }
ProjectVersion { InsertEnt $frm_4.txtProjVersion " $ s t r i n g " }
ProjectRelease { InsertEnt $frm_11.txtProjRelease " $ s t r i n g " }
ProjectAuthor { InsertEnt $frm_3.txtProjAuthor " $ s t r i n g " }
ProjectEmail { InsertEnt $frm_9.txtProjEmail " $ s t r i n g " }
ProjectCompany { InsertEnt $frm_5.txtProjCompany " $ s t r i n g " }
ProjectHome { InsertEnt $frm_10.txtProjHome " $ s t r i n g " }
}
}
close $file
} elseif { $operType == " o p e n " } {
$frm_7.lblWinTitle configure - text [ : : msgcat : : mc " O p e n p r o j e c t " ]
InsertEnt $frm_1.txtProjName " $ p r o j "
InsertEnt $frm_2.txtFileName " $ p r o j "
# $combo setvalue $lang
InsertEnt $frm_8.txtDirName " $ p r o j "
$frm_8.txtDirName configure - state normal
puts $prjDir
InsertEnt $frm_8.txtDirName " $ p r j D i r "
InsertEnt $frm_13.txtCompiler " "
InsertEnt $frm_12.txtProjInterp " "
InsertEnt $frm_4.txtProjVersion " 0 . 0 . 1 "
InsertEnt $frm_11.txtProjRelease " 1 "
InsertEnt $frm_3.txtProjAuthor " "
InsertEnt $frm_9.txtProjEmail " "
InsertEnt $frm_5.txtProjCompany " "
InsertEnt $frm_10.txtProjHome " "
} else {
InsertEnt $frm_1.txtProjName " "
InsertEnt $frm_2.txtFileName " "
InsertEnt $frm_8.txtDirName " "
InsertEnt $frm_13.txtCompiler " "
InsertEnt $frm_12.txtProjInterp " "
InsertEnt $frm_4.txtProjVersion " 0 . 0 . 1 "
InsertEnt $frm_11.txtProjRelease " 1 "
InsertEnt $frm_3.txtProjAuthor " "
InsertEnt $frm_9.txtProjEmail " "
InsertEnt $frm_5.txtProjCompany " "
InsertEnt $frm_10.txtProjHome " "
}
# bind autocomlite dir only if new project
if { [ $frm_8.txtDirName get ] eq " " } {
bind $frm_1.txtProjName < KeyRelease> {
regsub - all - - { \ s } [ string tolower [ Translit [ $frm_1.txtProjName get ] ] ] " _ " txtFileName
set txtDirName [ file join $projDir $txtFileName ]
}
}
}
proc GetExtentionProj { lang } {
if { $lang == " T c l " || $lang == " T c l / T k " } {
set ext " t c l "
} elseif { $lang == " P e r l " } {
set ext pl
} elseif { $lang == " J a v a " } {
set ext " j a v a "
} elseif { $lang == " F o r t r a n " } {
set ext " f o r "
} elseif { $lang == " O ' C a m l " } {
set ext ml
} elseif { $lang == " R u b y " } {
set ext rb
} elseif { $lang == " P H P " } {
set ext php
} elseif { $lang == " E r l a n g " } {
set ext erl
}
return $ext
}
proc GetInterp { lang } {
global tcl_platform
if { $tcl_platform ( platform ) == " u n i x " } {
set interp [ GetInterp_unix $lang ]
} elseif { $tcl_platform ( platform ) == " w i n d o w s " } {
set interp [ GetInterp_windows $lang ]
} else {
set interp " "
}
return $interp
}
proc GetInterp_unix { lang } {
set searchCommand " w h i c h "
switch $lang {
Tcl { set interp " t c l s h " }
Tcl / Tk { set interp " w i s h " }
Perl { set interp " p e r l " }
Java { set interp " j a v a " }
Fortran { set interp " " }
O ' Caml { set interp " " }
Ruby { set interp " r u b y " }
PHP { set interp " p h p " }
Perl { set interp " p e r l " }
Erlang { set interp " " }
}
try {
set result [ exec $searchCommand $interp ]
} trap { } { } {
puts " E r r o r : d o n ' t f i n d i n t e r p f o r $ l a n g "
set result " "
}
return $result
}
proc GetInterp_windows { lang } {
set searchCommand " w h e r e "
switch $lang {
Tcl { set interp " t c l s h " }
Tcl / Tk { set interp " w i s h " }
Perl { set interp " p e r l " }
Java { set interp " j a v a " }
Fortran { set interp " " }
O ' Caml { set interp " " }
Ruby { set interp " r u b y " }
PHP { set interp " p h p " }
Perl { set interp " p e r l " }
Erlang { set interp " " }
}
try {
set result [ exec $searchCommand $interp ]
} trap { } { } {
puts " E r r o r : d o n ' t f i n d i n t e r p f o r $ l a n g "
set result " "
}
return $result
}
proc SaveProj { txtFileName lang txtProjName txtFileName txtDirName \
txtCompiler txtProjInterp txtProjVersion txtProjRelease txtProjAuthor \
txtProjEmail txtProjCompany txtProjHome} {
global projDir workDir dataDir
set file [ file tail $txtDirName ]
set projFile [ open [ file join $workDir $file.proj ] w]
puts $projFile " P r o j e c t N a m e \" $ t x t P r o j N a m e \" "
puts $projFile " P r o j e c t L a n g u a g e \" $ l a n g \" "
puts $projFile " P r o j e c t F i l e N a m e \" $ t x t F i l e N a m e \" "
puts $projFile " P r o j e c t D i r N a m e \" $ t x t D i r N a m e \" "
puts $projFile " P r o j e c t C o m p i l e r \" $ t x t C o m p i l e r \" "
puts $projFile " P r o j e c t I n t e r p \" $ t x t P r o j I n t e r p \" "
puts $projFile " P r o j e c t V e r s i o n \" $ t x t P r o j V e r s i o n \" "
puts $projFile " P r o j e c t R e l e a s e \" $ t x t P r o j R e l e a s e \" "
puts $projFile " P r o j e c t A u t h o r \" $ t x t P r o j A u t h o r \" "
puts $projFile " P r o j e c t E m a i l \" $ t x t P r o j E m a i l \" "
puts $projFile " P r o j e c t C o m p a n y \" $ t x t P r o j C o m p a n y \" "
puts $projFile " P r o j e c t H o m e \" $ t x t P r o j H o m e \" "
close $projFile
}
# # CREATING PROJECT PROCEDURE ##
proc CreateProj { type lang txtFileName txtProjName txtFileName txtDirName \
txtCompiler txtProjInterp txtProjVersion txtProjRelease txtProjAuthor txtProjEmail \
txtProjCompany txtProjHome} {
global projDir workDir tree fontNormal dataDir tcl_platform
puts " $ t y p e $ l a n g " ; # "$txtFileName" "$txtProjName" "$txtFileName" "$txtDirName"\
# "$txtCompiler" "$txtProjInterp" "$txtProjVersion" "$txtProjRelease"\
# "$txtProjAuthor" "$txtProjEmail" "$txtProjCompany" "$txtProjHome"
# # SAVING PROJECT SETTINGS ##
set projShortName [ file tail $txtDirName ]
set projFile [ open [ file join $workDir $projShortName.proj ] w]
puts $projFile " P r o j e c t N a m e \" $ t x t P r o j N a m e \" "
puts $projFile " P r o j e c t L a n g u a g e \" $ l a n g \" "
puts $projFile " P r o j e c t F i l e N a m e \" $ t x t F i l e N a m e \" "
puts $projFile " P r o j e c t D i r N a m e \" $ t x t D i r N a m e \" "
puts $projFile " P r o j e c t C o m p i l e r \" $ t x t C o m p i l e r \" "
puts $projFile " P r o j e c t I n t e r p \" $ t x t P r o j I n t e r p \" "
puts $projFile " P r o j e c t V e r s i o n \" $ t x t P r o j V e r s i o n \" "
puts $projFile " P r o j e c t R e l e a s e \" $ t x t P r o j R e l e a s e \" "
puts $projFile " P r o j e c t A u t h o r \" $ t x t P r o j A u t h o r \" "
puts $projFile " P r o j e c t E m a i l \" $ t x t P r o j E m a i l \" "
puts $projFile " P r o j e c t C o m p a n y \" $ t x t P r o j C o m p a n y \" "
puts $projFile " P r o j e c t H o m e \" $ t x t P r o j H o m e \" "
close $projFile
if { $type != " o p e n " } {
set dir [ file join $projDir $txtDirName ]
if { [ file exists " $ d i r " ] != 1 } {
file mkdir " $ d i r "
}
# file header
if { $lang == " T c l " || $lang == " T c l / T k " } {
set text " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # \n # \t $ t x t P r o j N a m e \n # \t D i s t r i b u t e d u n d e r G N U P u b l i c L i c e n s e \n # A u t h o r : $ t x t P r o j A u t h o r $ t x t P r o j E m a i l \n # H o m e p a g e : $ t x t P r o j H o m e \n # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # \n "
} elseif { $lang == " P e r l " } {
set lang pl
set text " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # \n # \t $ t x t P r o j N a m e \n # \t D i s t r i b u t e d u n d e r G N U P u b l i c L i c e n s e \n # A u t h o r : $ t x t P r o j A u t h o r $ t x t P r o j E m a i l \n # H o m e p a g e : $ t x t P r o j H o m e \n # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # \n "
} elseif { $lang == " J a v a " } {
set text " / * \n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n * \t $ t x t P r o j N a m e \n * \t D i s t r i b u t e d u n d e r G N U P u b l i c L i c e n s e \n * A u t h o r : $ t x t P r o j A u t h o r $ t x t P r o j E m a i l \n * H o m e p a g e : $ t x t P r o j H o m e \n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n * / \n "
} elseif { $lang == " F o r t r a n " } {
set text " \n c * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n c * \t $ t x t P r o j N a m e \n * c \t D i s t r i b u t e d u n d e r G N U P u b l i c L i c e n s e \n c * A u t h o r : $ t x t P r o j A u t h o r $ t x t P r o j E m a i l \n c * H o m e p a g e : $ t x t P r o j H o m e \n c * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n * / \n "
} elseif { $lang == " O ' C a m l " } {
set text " \( * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n * \t $ t x t P r o j N a m e \n * \t D i s t r i b u t e d u n d e r G N U P u b l i c L i c e n s e \n * A u t h o r : $ t x t P r o j A u t h o r $ t x t P r o j E m a i l \n * H o m e p a g e : $ t x t P r o j H o m e \n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \) \n "
set lang ml
} elseif { $lang == " R u b y " } {
set lang rb
set text " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # \n # \t $ t x t P r o j N a m e \n # \t D i s t r i b u t e d u n d e r G N U P u b l i c L i c e n s e \n # A u t h o r : $ t x t P r o j A u t h o r $ t x t P r o j E m a i l \n # H o m e p a g e : $ t x t P r o j H o m e \n # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # \n "
} elseif { $lang == " P H P " } {
set text " < ? \n / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / \n / / \t $ t x t P r o j N a m e \n / / \t D i s t r i b u t e d u n d e r G N U P u b l i c L i c e n s e \n / / A u t h o r : $ t x t P r o j A u t h o r $ t x t P r o j E m a i l \n / / H o m e p a g e : $ t x t P r o j H o m e \n / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / \n ? > "
set lang php
} elseif { $lang == " E r l a n g " } {
set text " \% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n % \t $ t x t P r o j N a m e \n % \t D i s t r i b u t e d u n d e r G N U P u b l i c L i c e n s e \n % A u t h o r : $ t x t P r o j A u t h o r $ t x t P r o j E m a i l \n * H o m e p a g e : $ t x t P r o j H o m e \n % * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \) \n "
set lang erl
}
if { [ file exists [ file join $dir $txtFileName ] ] == 0 } {
set file [ open [ file join $dir $txtFileName ] w]
puts $file $text
close $file
}
# file attributes "$dir/$txtFileName.tcl" -permissions "777"
# catch {chmod 744 "$dir/$txtFileName.tcl"} mes
foreach f { README TODO CHANGELOG COPYING INSTALL} {
if { [ file exists [ file join $dir $f ] ] != 1 } {
set file [ open [ file join $dir $f ] w]
puts $file " $ t e x t "
if { $f == " C H A N G E L O G " } {
if { $tcl_platform ( platform ) == " w i n d o w s " } {
set d [ clock format [ clock scan " n o w " - base [ clock seconds] ] - format % d/ % m/ % Y]
} elseif { $tcl_platform ( platform ) == " m a c " } {
set d " N e e d e d d a t e c o m m a n d f o r t h i s p l a t f o r m "
} elseif { $tcl_platform ( platform ) == " u n i x " } {
set d [ clock format [ clock scan " n o w " - base [ clock seconds] ] - format % d/ % m/ % Y]
}
puts $file " $ d \n \t - B e g i n n i n g t h e p r o j e c t "
}
close $file
}
}
} else {
# # Insert new project into tree ##
# $tree insert end root $projShortName -text "$txtProjName" -font $fontNormal \
# -data "prj_$projShortName" -open 0 -image [Bitmap::get folder]
# GetFiles $txtDirName $projShortName $tree
}
AddNewProjectIntoTree $projShortName.proj
}
# # OPEN EXISTING PROJECT AND ADDED INYO PROJMAN TREE ##
proc OpenProj { nbNode } {
global projDir workDir openProjDir prjDir prjName
# set prjDir [SelectDir $projDir]
# puts $nbNode
# what is a tree we clicked?
if { $nbNode eq " f i l e s " } {
set tree .frmBody.frmCat.noteBook.ffiles.frmTreeFiles.treeFiles
} elseif { $nbNode eq " p r o j e c t s " } {
set tree .frmBody.frmCat.noteBook.fprojects.frmTree.tree
}
set item [ $tree itemcget [ $tree selection get] - data]
puts $item
if { [ file isdirectory $item ] } {
set prjDir $item
} elseif { [ file isfile $item ] } {
tk_messageBox - type ok - icon error - message " F i l e w i l l n o t a d d e d l i k e p r o j e c t ! "
return
}
if { $prjDir != " " } {
set prjName " [ f i l e t a i l $ p r j D i r ] "
NewProj open " " " "
# file copy $prjDir $projDir
}
return
}
proc AddNewProjectIntoTree { proj } {
global workDir tree imgDir fontNormal
lappend rList [ list [ file join $workDir $proj ] ]
set projFile [ open [ file join $workDir $proj ] r]
set prjName [ file rootname $proj ]
while { [ gets $projFile line] >= 0 } {
scan $line " % s " keyWord
set string [ string range $line [ string first " \" " $line ] [ string last " \" " $line ] ]
set string [ string trim $string " \" " ]
if { $keyWord == " P r o j e c t N a m e " } {
regsub - all " " $string " _ " project
set projName " $ s t r i n g "
}
if { $keyWord == " P r o j e c t D i r N a m e " } {
set projList( $prjName ) [ file dirname $string ]
puts " $ p r o j L i s t ( $ p r j N a m e ) - $ s t r i n g "
$tree insert end root $prjName - text " $ p r o j N a m e " - font $fontNormal \
-data " p r j _ $ p r j N a m e " - open 0 \
-image [ Bitmap : : get [ file join $imgDir folder.gif] ]
GetFiles [ file join $string ] $prjName $tree
set dir $string
}
}
}
2018-02-22 15:45:46 +03:00
# # ADD FILE INTO PROJECTS ##
proc AddToProj { fileName mode workingTree} {
global projDir workDir activeProject noteBook fontNormal imgDir
2018-02-05 11:24:14 +03:00
set type [ string trim [ file extension $fileName ] { . } ]
destroy .addtoproj
2018-02-22 15:45:46 +03:00
set node [ $workingTree selection get]
# puts "$fileName $mode $workingTree $node"
set fullPath [ $workingTree itemcget $node - data]
2018-02-05 11:24:14 +03:00
if { [ file isdirectory $fullPath ] == 1 } {
set dir $fullPath
set parentNode $node
} else {
set dir [ file dirname $fullPath ]
2018-02-22 15:45:46 +03:00
set parentNode [ $workingTree parent $node ]
2018-02-05 11:24:14 +03:00
}
2018-02-22 15:45:46 +03:00
# puts "$node $parentNode $workingTree $fullPath"
2018-02-05 11:24:14 +03:00
if { $type == " t c l " } {
set img " t c l "
} elseif { $type == " t k " } {
set img " t k "
} elseif { $type == " t x t " } {
set img " f i l e "
} elseif { $type == " h t m l " } {
set img " h t m l "
} elseif { $type == " j a v a " } {
set img " j a v a "
} elseif { $type == " p l " || $type == " p e r l " } {
set img " p e r l "
} elseif { $type == " f o r " } {
set img " f o r t r a n "
} elseif { $type == " m l " || $type == " m l i " } {
set img " c a m l "
} elseif { $type == " p h p " || $type == " p h t m l " } {
set img " p h p "
} elseif { $type == " r b " } {
set img " r u b y "
} elseif { $type == " r b " } {
set img " e r l "
} else {
set img " f i l e "
}
if { $mode == " d i r e c t o r y " } {
set img " f o l d e r "
}
# set dir [file join $projDir $activeProject]
set dot " _ "
set name [ file rootname $fileName ]
set ext [ string range [ file extension $fileName ] 1 end]
set subNode " $ n a m e $ d o t $ e x t "
2018-02-22 15:45:46 +03:00
$workingTree insert end $parentNode $subNode - text $fileName \
2018-02-05 11:24:14 +03:00
-data [ file join $dir $fileName ] - open 1 \
-image [ Bitmap : : get [ file join $imgDir $img.gif ] ] \
-font $fontNormal
2018-02-22 15:45:46 +03:00
if { [ $workingTree itemcget $parentNode - open] == 0 } {
$workingTree itemconfigure $parentNode - open 1
2018-02-05 11:24:14 +03:00
}
set file [ file join $dir $fileName ]
2018-02-17 20:25:02 +03:00
2018-02-05 11:24:14 +03:00
if { $mode == " d i r e c t o r y " } {
file mkdir $file
return
}
InsertTitle $file $type
2018-02-17 20:25:02 +03:00
EditFile [ GetTreeForNode $subNode ] $subNode [ file join $dir $fileName ]
2018-02-05 11:24:14 +03:00
}
# # ADD FILE INTO PROJECT DIALOG##
2018-02-22 15:45:46 +03:00
proc AddToProjDialog { mode node} {
global projDir workDir activeProject imgDir mod workingTree
2018-02-05 11:24:14 +03:00
set mod $mode
2018-02-22 15:45:46 +03:00
if { $node eq " f i l e s " } {
set workingTree .frmBody.frmCat.noteBook.ffiles.frmTreeFiles.treeFiles
} elseif { $node eq " p r o j e c t s " } {
set workingTree .frmBody.frmCat.noteBook.fprojects.frmTree.tree
} else {
puts " E r r o r n o d e "
return
2018-02-05 11:24:14 +03:00
}
2018-02-22 15:45:46 +03:00
# if {$activeProject == ""} {
# set answer [tk_messageBox\
# -message "[::msgcat::mc "Not found active project"]"\
# -type ok -icon warning]
# case $answer {
# ok {return 0}
# }
# }
2018-02-05 11:24:14 +03:00
set w .addtoproj
if { [ winfo exists $w ] } {
destroy $w
}
# create the new "goto" window
toplevel $w
wm title $w [ : : msgcat : : mc " C r e a t e n e w $ m o d " ]
wm resizable $w 0 0
wm transient $w .
frame $w.frmCanv - border 1 - relief sunken
frame $w.frmBtn - border 1 - relief sunken
pack $w.frmCanv - side top - fill both - padx 1 - pady 1
pack $w.frmBtn - side top - fill x
label $w.frmCanv.lblImgTcl - text [ : : msgcat : : mc " I n p u t $ m o d n a m e " ]
entry $w.frmCanv.entImgTcl
pack $w.frmCanv.lblImgTcl $w.frmCanv.entImgTcl - expand true - padx 5 - pady 5 - side top
2018-02-22 15:45:46 +03:00
button $w.frmBtn.btnOk - text [ : : msgcat : : mc " C r e a t e " ] - relief groove \
-command { AddToProj [ .addtoproj.frmCanv.entImgTcl get] $mod $workingTree }
2018-02-05 11:24:14 +03:00
button $w.frmBtn.btnCancel - text [ : : msgcat : : mc " C l o s e " ] - command " d e s t r o y $ w " - relief groove
pack $w.frmBtn.btnOk $w.frmBtn.btnCancel - padx 2 - pady 2 - fill x - side left
bind $w < Escape> " d e s t r o y . a d d t o p r o j "
bind $w.frmCanv.entImgTcl < Return> {
2018-02-22 15:45:46 +03:00
AddToProj [ .addtoproj.frmCanv.entImgTcl get] $mod $workingTree
2018-02-05 11:24:14 +03:00
}
focus - force $w.frmCanv.entImgTcl
2018-02-22 15:45:46 +03:00
puts " $ n o d e $ w o r k i n g T r e e $ m o d e "
2018-02-05 11:24:14 +03:00
# unset type
}
proc AddToProjDialog_ { } {
global projDir workDir activeProject imgDir tree
if { $activeProject == " " } {
set answer [ tk_messageBox \
-message " [ : : m s g c a t : : m c " N o t f o u n d a c t i v e p r o j e c t " ] " \
-type ok - icon warning]
case $answer {
ok { return 0 }
}
}
set w .addtoproj
if { [ winfo exists $w ] } {
destroy $w
}
# create the new "goto" window
toplevel $w
wm title $w [ : : msgcat : : mc " C r e a t e n e w f i l e " ]
wm resizable $w 0 0
wm transient $w .
frame $w.frmCanv - border 1 - relief sunken
frame $w.frmBtn - border 1 - relief sunken
pack $w.frmCanv - side top - fill both - padx 1 - pady 1
pack $w.frmBtn - side top - fill x
label $w.frmCanv.lblImgTcl - text [ : : msgcat : : mc " I n p u t f i l e n a m e " ]
entry $w.frmCanv.entImgTcl
pack $w.frmCanv.lblImgTcl $w.frmCanv.entImgTcl - expand true - padx 5 - pady 5 - side top
button $w.frmBtn.btnOk - text [ : : msgcat : : mc " C r e a t e " ] - relief groove - command {
AddToProj [ .addtoproj.frmCanv.entImgTcl get]
}
button $w.frmBtn.btnCancel - text [ : : msgcat : : mc " C l o s e " ] - command " d e s t r o y $ w " - relief groove
pack $w.frmBtn.btnOk $w.frmBtn.btnCancel - padx 2 - pady 2 - fill x - side left
bind $w < Escape> " d e s t r o y . a d d t o p r o j "
bind $w.frmCanv.entImgTcl < Return> {
AddToProj [ .addtoproj.frmCanv.entImgTcl get]
}
focus - force $w.frmCanv.entImgTcl
}
# # DELETE FILE FROM PROJECT ##
proc DelFromProj { project } {
global projDir workDir
}
# # DELETEING PROJECT PROCEDURE ##
proc DelProj { } {
global workDir activeProject tree
if { $activeProject == " " } {
set answer [ tk_messageBox \
-message " [ : : m s g c a t : : m c " N o t f o u n d a c t i v e p r o j e c t " ] " \
-type ok - icon warning]
case $answer {
ok { return 0 }
}
}
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 == " P r o j e c t D i r N a m e " } {
set projDir " $ s t r i n g "
puts $projDir
}
}
close $file
2018-02-18 15:01:56 +03:00
set answer [ tk_messageBox \
-message " [ : : m s g c a t : : m c " D e l e t e p r o j e c t " ] \" $ a c t i v e P r o j e c t \" \
[ : : msgcat : : mc " w i t h a l l f i l e s " ] ? \ n \
[ : : msgcat : : mc " I f p r e s s \" Y e s \" w i l l d e l e t e d a l l f i l e s ! " ] \ n \
[ : : msgcat : : mc " I f p r e s s \" N o \" w i l l d e l e t e d o n l y p r o j - f i l e " ] " \
-type yesnocancel - icon question - default yes]
switch $answer {
2018-02-05 11:24:14 +03:00
yes {
2018-02-17 20:25:02 +03:00
FileDialog $tree close_all
2018-02-05 11:24:14 +03:00
file delete - force $projDir
file delete - force [ file join $workDir $activeProject.proj ]
file delete - force [ file join $workDir $activeProject.tags ]
$tree delete [ $tree selection get]
$tree configure - redraw 1
set activeProject " "
LabelUpdate .frmStatus.frmActive.lblActive " "
}
2018-02-18 15:01:56 +03:00
no {
file delete - force [ file join $workDir $activeProject.proj ]
file delete - force [ file join $workDir $activeProject.tags ]
$tree delete [ $tree selection get]
$tree configure - redraw 1
set activeProject " "
LabelUpdate .frmStatus.frmActive.lblActive " "
}
2018-02-05 11:24:14 +03:00
}
}
proc CompileOption { string } {
global fontNormal cmdCompile editor
set w .cmd
# destroy the find window if it already exists
if { [ winfo exists $w ] } {
destroy $w
}
toplevel $w
wm title $w [ : : msgcat : : mc " C o m m a n d o p t i o n s " ]
wm resizable $w 0 0
wm transient $w .
frame $w.frmCombo - borderwidth 1 - bg $editor ( bg )
frame $w.frmBtn - borderwidth 1 - bg $editor ( bg )
pack $w.frmCombo $w.frmBtn - side top - fill x
# set combo [entry $w.frmCombo.entFind]
label $w.frmCombo.lblModule - text " [ : : m s g c a t : : m c " C o n v e r t t o " ] " - bg $editor ( bg ) - fg $editor ( fg )
label $w.frmCombo.lblFile - text " [ : : m s g c a t : : m c " F i l e " ] " - bg $editor ( bg ) - fg $editor ( fg )
set combo [ entry $w.frmCombo.txtString - text " $ s t r i n g " ]
pack $w.frmCombo.lblModule $w.frmCombo.lblFile $combo - fill x - padx 2 - pady 2 - side top
button $w.frmBtn.btnFind - text [ : : msgcat : : mc " R u n " ] \
-font $fontNormal - width 12 - relief groove - bg $editor ( bg ) - fg $editor ( fg ) \
-command {
return [ .cmd.frmCombo.txtString get]
destroy .cmd
}
button $w.frmBtn.btnCancel - text [ : : msgcat : : mc " C l o s e " ] - bg $editor ( bg ) - fg $editor ( fg ) \
-relief groove - width 12 - font $fontNormal \
-command " d e s t r o y $ w "
pack $w.frmBtn.btnFind $w.frmBtn.btnCancel - fill x - padx 2 - pady 2 - side left
bind $w < Return> {
set cmdCompile [ .cmd.frmCombo.txtString get]
destroy .cmd
}
bind $w < Escape> " d e s t r o y $ w "
$combo insert end " $ s t r i n g "
focus - force $combo
}
# # MAKE PROJ PROCEDURE (RUNNING PROJECT) ##
proc MakeProj { action t} {
global activeProject projDir noteBook fontNormal fontBold workDir tree cmdCompile editor
if { $activeProject == " " } {
set answer [ tk_messageBox \
-message " [ : : m s g c a t : : m c " N o t f o u n d a c t i v e p r o j e c t " ] " \
-type ok - icon warning\
-title [ : : msgcat : : mc " W a r n i n g " ] ]
case $answer {
ok { return 0 }
}
}
2018-02-13 13:23:40 +03:00
FileDialog $tree save_all
2018-02-05 11:24:14 +03:00
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 == " P r o j e c t N a m e " } {
set projName " $ s t r i n g "
}
if { $keyWord == " P r o j e c t F i l e N a m e " } {
set projFileName " $ s t r i n g "
}
if { $keyWord == " P r o j e c t D i r N a m e " } {
set projDirName " $ s t r i n g "
}
if { $keyWord == " P r o j e c t C o m p i l e r " } {
set projCompiler " $ s t r i n g "
}
if { $keyWord == " P r o j e c t I n t e r p " } {
set projInterp " $ s t r i n g "
}
}
close $file
if { $action == " c o m p i l e " } {
if { $t == " p r o j " } {
set prog [ file join $projDirName $projFileName.java ]
} elseif { $t == " f i l e " } {
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 == " r u n " } {
if { $t == " p r o j " } {
2018-02-05 17:22:04 +03:00
set prog [ file join $projDirName $projFileName ]
2018-02-05 11:24:14 +03:00
} elseif { $t == " f i l e " } {
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 " d e b u g "
if { [ $noteBook index $node ] != -1 } {
$noteBook delete debug
}
set w [ $noteBook insert end $node - text [ : : msgcat : : mc " R u n n i n g p r o j e c t " ] ]
# create array with file names #
frame $w.frame - borderwidth 2 - relief ridge - background $editor ( bg )
pack $w.frame - side top - fill both - expand true
text $w.frame.text - yscrollcommand " $ w . f r a m e . y s c r o l l s e t " \
-bg $editor ( bg ) - fg $editor ( fg ) \
-relief sunken - wrap word - highlightthickness 0 - font $fontNormal \
-selectborderwidth 0 - selectbackground # 55 c4d1 - width 10 - height 10
scrollbar $w.frame.yscroll - relief sunken - borderwidth { 1 } - width { 10 } - takefocus 0 \
-command " $ w . f r a m e . t e x t y v i e w " - background $editor ( bg )
pack $w.frame.text - side left - fill both - expand true
pack $w.frame.yscroll - side left - fill y
frame $w.frmBtn - borderwidth 2 - relief ridge - bg $editor ( bg )
pack $w.frmBtn - side top - fill x
button $w.frmBtn.btnOk - text [ : : msgcat : : mc " C l o s e " ] - borderwidth { 1 } \
-bg $editor ( bg ) - fg $editor ( fg ) - 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.frmBtn.btnOk < Return> {
$noteBook delete debug
$noteBook raise [ $noteBook page end]
# return 0
}
focus - force $w.frmBtn.btnOk
$noteBook raise $node
# insert debug data into text widget #
$w.frame.text tag configure bold - font $fontBold
$w.frame.text tag configure error - font $fontNormal - foreground red
$w.frame.text tag add bold 0.0 0 .end
if { $action == " c o m p i l e " } {
$w.frame.text insert end " [ : : m s g c a t : : m c " C o m p i l e p r o j e c t " ] - $ a c t i v e P r o j e c t \n "
$w.frame.text insert end " [ : : m s g c a t : : m c " C o m p i l e " ] - $ p r o g \n \n "
} elseif { $action == " r u n " } {
$w.frame.text insert end " [ : : m s g c a t : : m c " R u n n i n g p r o j e c t " ] - $ a c t i v e P r o j e c t \n "
$w.frame.text insert end " [ : : m s g c a t : : m c " R u n " ] - $ p r o g \n \n "
}
set pos [ $w.frame.text index insert]
set lineNum [ lindex [ split $pos " . " ] 0 ]
$w.frame.text insert end " - - - - - - - - - - - - - - - - - [ : : m s g c a t : : m c " P r o g r a m m o u t p u t " ] - - - - - - - - - - - - - - - - - \n "
$w.frame.text tag add bold $lineNum.0 $lineNum.end
# open and manipulate executed program chanel #
if { $action == " c o m p i l e " } {
set cmdCompile " "
CompileOption " $ p r o j C o m p i l e r $ p r o g "
vwait cmdCompile
puts " s t r i n g - $ p r o j C o m p i l e r $ p r o g " ; # debug info
set pipe [ open " | $ c m d C o m p i l e 2 > [ f i l e j o i n $ p r o j D i r N a m e e r r o r s ] " " r " ]
set f [ open [ file join $projDirName errors] " r " ]
} elseif { $action == " r u n " } {
set pipe [ open " | $ p r o j I n t e r p $ p r o g 2 > [ f i l e j o i n $ p r o j D i r N a m e e r r o r s ] " " r " ]
set f [ open [ file join $projDirName 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 " [ : : m s g c a t : : m c " P r o g r a m f a i l e d " ] : $ m s g \n " ;
} else {
puts $msg
$widget insert end " \n - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n "
$widget insert end " [ : : m s g c a t : : m c " P r o g r a m f i n i s h e d s u c c e s s f u l l y " ] \n "
}
} else {
$widget insert end [ read $file ]
}
while { [ gets $f line] >= 0 } {
$widget insert end " $ l i n e \n "
puts $line
}
$widget see end
$widget tag add error 0.0 0 .end
$widget configure - state disabled
}
# # INSERT TITLE INTO NEW FILE ##
proc InsertTitle { newFile type} {
global activeProject projDir workDir ver
puts " $ n e w F i l e $ t y p e "
set year [ clock format [ clock scan " n o w " - base [ clock seconds] ] - format % Y]
if { $activeProject == " " } {
set answer [ tk_messageBox \
-message " [ : : m s g c a t : : m c " N o t f o u n d a c t i v e p r o j e c t " ] " \
-type ok - icon warning\
-title [ : : msgcat : : mc " W a r n i n g " ] ]
case $answer {
ok { return 0 }
}
}
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 == " P r o j e c t N a m e " } {
set txtProjName " $ s t r i n g "
}
if { $keyWord == " P r o j e c t F i l e N a m e " } {
set txtProjFileName " $ s t r i n g "
}
if { $keyWord == " P r o j e c t D i r N a m e " } {
set txtProjDirName " $ s t r i n g "
}
if { $keyWord == " P r o j e c t I n t e r p " } {
set txtProjInterp " $ s t r i n g "
}
if { $keyWord == " P r o j e c t V e r s i o n " } {
set txtProjVersion " $ s t r i n g "
}
if { $keyWord == " P r o j e c t R e l e a s e " } {
set txtProjRelease " $ s t r i n g "
}
if { $keyWord == " P r o j e c t A u t h o r " } {
set txtProjAuthor " $ s t r i n g "
}
if { $keyWord == " P r o j e c t E m a i l " } {
set txtProjEmail " $ s t r i n g "
}
if { $keyWord == " P r o j e c t C o m p a n y " } {
set txtProjCompany " $ s t r i n g "
}
if { $keyWord == " P r o j e c t H o m e " } {
set txtProjHome " $ s t r i n g "
}
}
if { $type == " h t m l " } {
set fileTitle " < H T M L > \n < H E A D > \n < M E T A h t t p - e q u i v = C o n t e n t - T y p e c o n t e n t = \" t e x t / h t m l ; c h a r s e t = k o i 8 - r \" > \n < M E T A N A M E = \" A u t h o r \" C O N T E N T = \" $ t x t P r o j A u t h o r \" > \n < M E T A N A M E = \" G E N E R A T O R \" C O N T E N T = \" C r e a t e d b y T c l / T k P r o j e c t M a n a g e r - $ v e r \" > \n < T I T L E > < / T I T L E > \n < / H E A D > \n < B O D Y > \n \n < / B O D Y > \n < / H T M L > "
} elseif { $type == " t c l " } {
set fileTitle " # ! $ t x t P r o j I n t e r p \n # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # \n # \t \t $ t x t P r o j N a m e \n # \t D i s t r i b u t e d u n d e r G N U P u b l i c L i c e n s e \n # A u t h o r : $ t x t P r o j A u t h o r $ t x t P r o j E m a i l \n # C o p y r i g h t ( c ) \" $ t x t P r o j C o m p a n y \" , $ y e a r , $ t x t P r o j H o m e \n # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # \n "
} elseif { $type == " p e r l " || $type == " p l " } {
set fileTitle " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # \n # \t \t $ t x t P r o j N a m e \n # \t D i s t r i b u t e d u n d e r G N U P u b l i c L i c e n s e \n # A u t h o r : $ t x t P r o j A u t h o r $ t x t P r o j E m a i l \n # C o p y r i g h t ( c ) \" $ t x t P r o j C o m p a n y \" , $ y e a r , $ t x t P r o j H o m e \n # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # \n "
} elseif { $type == " t x t " } {
set fileTitle " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # \n # \t \t $ t x t P r o j N a m e \n # \t D i s t r i b u t e d u n d e r G N U P u b l i c L i c e n s e \n # A u t h o r : $ t x t P r o j A u t h o r $ t x t P r o j E m a i l \n # C o p y r i g h t ( c ) \" $ t x t P r o j C o m p a n y \" , $ y e a r , $ t x t P r o j H o m e \n # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # \n "
} elseif { $type == " r b " } {
set fileTitle " # ! $ t x t P r o j I n t e r p \n # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # \n # \t \t $ t x t P r o j N a m e \n # \t D i s t r i b u t e d u n d e r G N U P u b l i c L i c e n s e \n # A u t h o r : $ t x t P r o j A u t h o r $ t x t P r o j E m a i l \n # C o p y r i g h t ( c ) \" $ t x t P r o j C o m p a n y \" , $ y e a r , $ t x t P r o j H o m e \n # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # \n "
} elseif { $type == " j a v a " } {
set fileTitle " / * \n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n * \t $ t x t P r o j N a m e \n * \t D i s t r i b u t e d u n d e r G N U P u b l i c L i c e n s e \n * A u t h o r : $ t x t P r o j A u t h o r $ t x t P r o j E m a i l \n * H o m e p a g e : $ t x t P r o j H o m e \n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n * / \n "
} elseif { $type == " f o r " } {
set fileTitle " * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n * \t $ t x t P r o j N a m e \n * \t D i s t r i b u t e d u n d e r G N U P u b l i c L i c e n s e \n * A u t h o r : $ t x t P r o j A u t h o r $ t x t P r o j E m a i l \n * H o m e p a g e : $ t x t P r o j H o m e \n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n "
} elseif { $type == " m l " || $type == " m l i " } {
set fileTitle " \( * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n * \t $ t x t P r o j N a m e \n * \t D i s t r i b u t e d u n d e r G N U P u b l i c L i c e n s e \n * A u t h o r : $ t x t P r o j A u t h o r $ t x t P r o j E m a i l \n * H o m e p a g e : $ t x t P r o j H o m e \n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \) \n "
} elseif { $type == " p h p " || $type == " p h t m l " } {
set fileTitle " < ? \n / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / \n / / \t $ t x t P r o j N a m e \n / / \t D i s t r i b u t e d u n d e r G N U P u b l i c L i c e n s e \n / / A u t h o r : $ t x t P r o j A u t h o r $ t x t P r o j E m a i l \n / / H o m e p a g e : $ t x t P r o j H o m e \n / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / \n \n \n \n \n ? > "
} elseif { $type == " t m l " } {
set fileTitle " < ! - - \n # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # \n # \t \t $ t x t P r o j N a m e \n # \t D i s t r i b u t e d u n d e r G N U P u b l i c L i c e n s e \n # A u t h o r : $ t x t P r o j A u t h o r $ t x t P r o j E m a i l \n # C o p y r i g h t ( c ) \" $ t x t P r o j C o m p a n y \" , $ y e a r , $ t x t P r o j H o m e \n # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # \n - - > \n "
} elseif { $type == " e r l " } {
set fileTitle " % * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n % \t $ t x t P r o j N a m e \n % \t D i s t r i b u t e d u n d e r G N U P u b l i c L i c e n s e \n % A u t h o r : $ t x t P r o j A u t h o r $ t x t P r o j E m a i l \n % H o m e p a g e : $ t x t P r o j H o m e \n % * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n "
} else {
set fileTitle " # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # \n # \t \t $ t x t P r o j N a m e \n # \t D i s t r i b u t e d u n d e r G N U P u b l i c L i c e n s e \n # A u t h o r : $ t x t P r o j A u t h o r $ t x t P r o j E m a i l \n # C o p y r i g h t ( c ) \" $ t x t P r o j C o m p a n y \" , $ y e a r , $ t x t P r o j H o m e \n # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # \n "
}
set pipe [ open $newFile w]
# puts "$newFile\n $fileTitle" ;# debuf info
puts $pipe $fileTitle
close $pipe
}