Added Menu button into tollbar and Hide/Show options into config
This commit is contained in:
@@ -144,7 +144,7 @@ proc FileDialog {nbNode operation} {
|
||||
} elseif {[$tree exists $node] == 0 && $tree eq ".frmBody.frmCat.noteBook.ffiles.frmTreeFiles.treeFiles" } {
|
||||
set tree .frmBody.frmCat.noteBook.fprojects.frmTree.tree
|
||||
} else {
|
||||
return
|
||||
#return
|
||||
}
|
||||
########## end ########
|
||||
|
||||
|
71
lib/main.tcl
71
lib/main.tcl
@@ -119,7 +119,9 @@ frame .frmMenu -border 1 -relief raised -background $editor(bg)
|
||||
frame .frmTool -border 1 -relief raised -background $editor(bg)
|
||||
frame .frmBody -border 1 -relief raised -background $editor(bg)
|
||||
frame .frmStatus -border 1 -relief sunken -bg $editor(bg)
|
||||
pack .frmMenu -side top -padx 1 -fill x
|
||||
if {[info exists menuShow]==1 && $menuShow eq "Yes"} {
|
||||
pack .frmMenu -side top -padx 1 -fill x
|
||||
}
|
||||
pack .frmTool -side top -padx 1 -fill x
|
||||
pack .frmBody -side top -padx 1 -fill both -expand true
|
||||
pack .frmStatus -side top -padx 1 -fill x
|
||||
@@ -127,39 +129,7 @@ pack .frmStatus -side top -padx 1 -fill x
|
||||
########## CREATE MENU LINE ##########
|
||||
menubutton .frmMenu.mnuFile -text [::msgcat::mc "File"] -menu .frmMenu.mnuFile.m -font $fontNormal -bg $editor(bg) -fg $editor(fg)
|
||||
set m [menu .frmMenu.mnuFile.m -bg $editor(bg) -fg $editor(fg)]
|
||||
$m add cascade -label [::msgcat::mc "New"] -menu $m.new -font $fontNormal
|
||||
set mn [menu $m.new -bg $editor(bg) -fg $editor(fg)]
|
||||
$mn add command -label [::msgcat::mc "New file"] -command {AddToProjDialog file [$noteBookFiles raise]}\
|
||||
-font $fontNormal -accelerator "Ctrl+N"
|
||||
$mn add command -label [::msgcat::mc "New directory"] -command {AddToProjDialog directory [$noteBookFiles raise]}\
|
||||
-font $fontNormal -accelerator "Ctrl+N"
|
||||
$mn add command -label [::msgcat::mc "New project"] -command {NewProjDialog "new"}\
|
||||
-font $fontNormal
|
||||
#$m add command -label [::msgcat::mc "Open"] -command {FileDialog $tree open}\
|
||||
#-font $fontNormal -accelerator "Ctrl+O" -state disable
|
||||
$m add command -label [::msgcat::mc "Save"] -command {FileDialog [$noteBookFiles raise] save}\
|
||||
-font $fontNormal -accelerator "Ctrl+S"
|
||||
$m add command -label [::msgcat::mc "Save as"] -command {FileDialog [$noteBookFiles raise] save_as}\
|
||||
-font $fontNormal
|
||||
$m add command -label [::msgcat::mc "Save all"] -command {FileDialog [$noteBookFiles raise] save_all}\
|
||||
-font $fontNormal
|
||||
$m add command -label [::msgcat::mc "Close"] -command {FileDialog [$noteBookFiles raise] close}\
|
||||
-font $fontNormal -accelerator "Ctrl+W"
|
||||
$m add command -label [::msgcat::mc "Close all"] -command {FileDialog [$noteBookFiles raise] close_all}\
|
||||
-font $fontNormal
|
||||
$m add command -label [::msgcat::mc "Delete"] -command {FileDialog [$noteBookFiles raise] delete}\
|
||||
-font $fontNormal -accelerator "Ctrl+D"
|
||||
$m add separator
|
||||
$m add command -label [::msgcat::mc "Compile file"] -command {MakeProj compile file} -font $fontNormal -accelerator "Ctrl+F8"
|
||||
$m add command -label [::msgcat::mc "Run file"] -command {MakeProj run file} -font $fontNormal -accelerator "Ctrl+F9"
|
||||
$m add separator
|
||||
$m add command -label [::msgcat::mc "Print"] -command PrintDialog\
|
||||
-font $fontNormal -accelerator "Ctrl+P"
|
||||
$m add separator
|
||||
$m add command -label [::msgcat::mc "Settings"] -command {Settings $noteBook} -font $fontNormal
|
||||
$m add separator
|
||||
$m add command -label [::msgcat::mc "Exit"] -command Quit -font $fontNormal -accelerator "Ctrl+Q"
|
||||
|
||||
GetFileMenu $m
|
||||
##.frmMenu 'Project' ##
|
||||
|
||||
|
||||
@@ -176,40 +146,17 @@ GetMenu [menu .popMnuEdit -bg $editor(bg) -fg $editor(fg)] ;# pop-up edit menu
|
||||
## VIEW MENU ##
|
||||
menubutton .frmMenu.mnuView -text [::msgcat::mc "View"] -menu .frmMenu.mnuView.m -font $fontNormal -bg $editor(bg) -fg $editor(fg)
|
||||
set m [menu .frmMenu.mnuView.m -bg $editor(bg) -fg $editor(fg)]
|
||||
$m add checkbutton -label [::msgcat::mc "Toolbar"] -font $fontNormal -state normal\
|
||||
-offvalue "No" -onvalue "Yes" -variable toolBar -command {ToolBar}
|
||||
$m add command -label [::msgcat::mc "Split edit window"] -font $fontNormal -accelerator "F4" -state disable\
|
||||
-command SplitWindow
|
||||
$m add separator
|
||||
$m add command -label [::msgcat::mc "Refresh"] -font $fontNormal -accelerator "F5" -state normal\
|
||||
-command UpdateTree
|
||||
|
||||
GetViewMenu $m
|
||||
##.frmMenu Settings ##
|
||||
menubutton .frmMenu.mnuCVS -text [::msgcat::mc "Modules"] -menu .frmMenu.mnuCVS.m \
|
||||
-font $fontNormal -state normal -bg $editor(bg) -fg $editor(fg)
|
||||
set m [menu .frmMenu.mnuCVS.m -bg $editor(bg) -fg $editor(fg)]
|
||||
if {[info exists module(tkcvs)]} {
|
||||
$m add command -label "TkCVS" -command {DoModule tkcvs} -font $fontNormal
|
||||
}
|
||||
if {[info exists module(tkdiff)]} {
|
||||
$m add command -label "TkDIFF+" -command {DoModule tkdiff} -font $fontNormal
|
||||
}
|
||||
if {[info exists module(tkregexp)]} {
|
||||
$m add command -label "TkREGEXP" -command {DoModule tkregexp} -font $fontNormal
|
||||
}
|
||||
if {[info exists module(gitk)]} {
|
||||
$m add command -label "Gitk" -font $fontNormal -command {
|
||||
DoModule gitk
|
||||
GetTagList [file join $workDir $activeProject.tags] ;# geting tag list
|
||||
}
|
||||
}
|
||||
GetModulesMenu $m
|
||||
|
||||
menubutton .frmMenu.mnuHelp -text [::msgcat::mc "Help"] -menu .frmMenu.mnuHelp.m \
|
||||
-underline 0 -font $fontNormal -bg $editor(bg) -fg $editor(fg)
|
||||
set m [menu .frmMenu.mnuHelp.m -bg $editor(bg) -fg $editor(fg)]
|
||||
$m add command -label [::msgcat::mc "Help"] -command ShowHelp \
|
||||
-accelerator F1 -font $fontNormal
|
||||
$m add command -label [::msgcat::mc "About ..."] -command AboutDialog \
|
||||
-font $fontNormal
|
||||
GetHelpMenu $m
|
||||
|
||||
pack .frmMenu.mnuFile .frmMenu.mnuProj .frmMenu.mnuEdit .frmMenu.mnuView .frmMenu.mnuCVS -side left
|
||||
pack .frmMenu.mnuHelp -side right
|
||||
@@ -420,3 +367,5 @@ if {[info exists workingProject]} {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
81
lib/menu.tcl
81
lib/menu.tcl
@@ -74,8 +74,8 @@ proc GetMenu {m} {
|
||||
unset nb
|
||||
}
|
||||
$m add command -label [::msgcat::mc "Comment selected"] -font $fontNormal -accelerator "Ctrl+,"\
|
||||
-command {TextOperation comment}
|
||||
$m add command -label [::msgcat::mc "Uncomment selected"] -font $fontNormal -accelerator "Ctrl+." \
|
||||
-command {TextOperation comment}
|
||||
$m add command -label [::msgcat::mc "Uncomment selected"] -font $fontNormal -accelerator "Ctrl+." \
|
||||
-command {TextOperation uncomment}
|
||||
|
||||
$m add separator
|
||||
@@ -91,3 +91,80 @@ proc GetMenu {m} {
|
||||
$me add command -label [::msgcat::mc "CP1251"] -command {TextEncode cp1251} -font $fontNormal
|
||||
$me add command -label [::msgcat::mc "CP866"] -command {TextEncode cp866} -font $fontNormal
|
||||
}
|
||||
|
||||
proc GetViewMenu {m} {
|
||||
global fontNormal fontBold imgDir editor
|
||||
$m add checkbutton -label [::msgcat::mc "Show the Menu"] -font $fontNormal -state normal\
|
||||
-offvalue "No" -onvalue "Yes" -variable showMenu -command {ToolBar}
|
||||
$m add checkbutton -label [::msgcat::mc "Toolbar"] -font $fontNormal -state normal\
|
||||
-offvalue "No" -onvalue "Yes" -variable toolBar -command {ToolBar}
|
||||
$m add command -label [::msgcat::mc "Split edit window"] -font $fontNormal -accelerator "F4" -state disable\
|
||||
-command SplitWindow
|
||||
$m add separator
|
||||
$m add command -label [::msgcat::mc "Refresh"] -font $fontNormal -accelerator "F5" -state normal\
|
||||
-command UpdateTree
|
||||
}
|
||||
|
||||
proc GetModulesMenu {m} {
|
||||
global fontNormal fontBold imgDir editor module activeProject
|
||||
if {[info exists module(tkcvs)]} {
|
||||
$m add command -label "TkCVS" -command {DoModule tkcvs} -font $fontNormal
|
||||
}
|
||||
if {[info exists module(tkdiff)]} {
|
||||
$m add command -label "TkDIFF+" -command {DoModule tkdiff} -font $fontNormal
|
||||
}
|
||||
if {[info exists module(tkregexp)]} {
|
||||
$m add command -label "TkREGEXP" -command {DoModule tkregexp} -font $fontNormal
|
||||
}
|
||||
if {[info exists module(gitk)]} {
|
||||
$m add command -label "Gitk" -font $fontNormal -command {
|
||||
DoModule gitk
|
||||
GetTagList [file join $workDir $activeProject.tags] ;# geting tag list
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc GetHelpMenu {m} {
|
||||
global fontNormal fontBold imgDir editor
|
||||
$m add command -label [::msgcat::mc "Help"] -command ShowHelp \
|
||||
-accelerator F1 -font $fontNormal
|
||||
$m add command -label [::msgcat::mc "About ..."] -command AboutDialog \
|
||||
-font $fontNormal
|
||||
}
|
||||
proc GetFileMenu {m} {
|
||||
global fontNormal fontBold imgDir editor noteBookFiles noteBook
|
||||
$m add cascade -label [::msgcat::mc "New"] -menu $m.new -font $fontNormal
|
||||
set mn [menu $m.new -bg $editor(bg) -fg $editor(fg)]
|
||||
$mn add command -label [::msgcat::mc "New file"] -command {AddToProjDialog file [$noteBookFiles raise]}\
|
||||
-font $fontNormal -accelerator "Ctrl+N"
|
||||
$mn add command -label [::msgcat::mc "New directory"] -command {AddToProjDialog directory [$noteBookFiles raise]}\
|
||||
-font $fontNormal -accelerator "Ctrl+N"
|
||||
$mn add command -label [::msgcat::mc "New project"] -command {NewProjDialog "new"}\
|
||||
-font $fontNormal
|
||||
#$m add command -label [::msgcat::mc "Open"] -command {FileDialog $tree open}\
|
||||
#-font $fontNormal -accelerator "Ctrl+O" -state disable
|
||||
$m add command -label [::msgcat::mc "Save"] -command {FileDialog [$noteBookFiles raise] save}\
|
||||
-font $fontNormal -accelerator "Ctrl+S"
|
||||
$m add command -label [::msgcat::mc "Save as"] -command {FileDialog [$noteBookFiles raise] save_as}\
|
||||
-font $fontNormal
|
||||
$m add command -label [::msgcat::mc "Save all"] -command {FileDialog [$noteBookFiles raise] save_all}\
|
||||
-font $fontNormal
|
||||
$m add command -label [::msgcat::mc "Close"] -command {FileDialog [$noteBookFiles raise] close}\
|
||||
-font $fontNormal -accelerator "Ctrl+W"
|
||||
$m add command -label [::msgcat::mc "Close all"] -command {FileDialog [$noteBookFiles raise] close_all}\
|
||||
-font $fontNormal
|
||||
$m add command -label [::msgcat::mc "Delete"] -command {FileDialog [$noteBookFiles raise] delete}\
|
||||
-font $fontNormal -accelerator "Ctrl+D"
|
||||
$m add separator
|
||||
$m add command -label [::msgcat::mc "Compile file"] -command {MakeProj compile file} -font $fontNormal -accelerator "Ctrl+F8"
|
||||
$m add command -label [::msgcat::mc "Run file"] -command {MakeProj run file} -font $fontNormal -accelerator "Ctrl+F9"
|
||||
$m add separator
|
||||
$m add command -label [::msgcat::mc "Print"] -command PrintDialog\
|
||||
-font $fontNormal -accelerator "Ctrl+P"
|
||||
$m add separator
|
||||
$m add command -label [::msgcat::mc "Settings"] -command {Settings $noteBook} -font $fontNormal
|
||||
$m add separator
|
||||
$m add command -label [::msgcat::mc "Exit"] -command Quit -font $fontNormal -accelerator "Ctrl+Q"
|
||||
}
|
||||
|
||||
|
||||
|
@@ -42,7 +42,7 @@ proc ConfigureEnt {col} {
|
||||
proc LoadSettings {} {
|
||||
global fontNormal imgDir workDir msgDir
|
||||
global editor color nb
|
||||
global main editFrm network
|
||||
global main editFrm network menuShow
|
||||
global toolBar autoFormat backUpDel backUpCreate backUpShow showDotFiles localeSet localeList wrapSet wrapList
|
||||
|
||||
## load .conf file ##
|
||||
@@ -68,7 +68,20 @@ proc LoadSettings {} {
|
||||
puts "$var.msg file not found into $msgDir"
|
||||
}
|
||||
}
|
||||
toolBar {if {$var == "Yes"} {set toolBar "true" } else {set toolBar "false"} }
|
||||
menuShow {
|
||||
if {$var == "Yes"} {
|
||||
set menuShow "true"
|
||||
} else {
|
||||
set menuShow "false"
|
||||
}
|
||||
}
|
||||
toolBar {
|
||||
if {$var == "Yes"} {
|
||||
set toolBar "true"
|
||||
} else {
|
||||
set toolBar "false"
|
||||
}
|
||||
}
|
||||
backUpFileShow {
|
||||
if {$var == "Yes"} {
|
||||
set backUpShow "true"
|
||||
@@ -175,6 +188,12 @@ proc SaveSettings {} {
|
||||
} else {
|
||||
puts $file "set toolBar \"Yes\"\n"
|
||||
}
|
||||
puts $file "# Menu on/off \(Yes/No\)"
|
||||
if {$menuShow == "false"} {
|
||||
puts $file "set menuShow \"No\"\n"
|
||||
} else {
|
||||
puts $file "set menuShow \"Yes\"\n"
|
||||
}
|
||||
if {$backUpShow == "false"} {
|
||||
puts $file "set backUpFileShow \"No\""
|
||||
} else {
|
||||
@@ -258,7 +277,7 @@ proc SaveSettings {} {
|
||||
proc Settings {nBook} {
|
||||
global fontNormal fontBold imgDir workDir
|
||||
global editor color nb topLevelGeometry
|
||||
global main editFrm network
|
||||
global main editFrm network menuShow
|
||||
global toolBar autoFormat backUpDel backUpCreate backUpShow showDotFiles localeSet localeList wrapSet wrapList
|
||||
set topLevelGeometry [winfo geometry .]
|
||||
if {[$nBook index settings] != -1} {
|
||||
@@ -302,6 +321,12 @@ proc Settings {nBook} {
|
||||
} else {
|
||||
puts $file "set toolBar \"Yes\"\n"
|
||||
}
|
||||
puts $file "# Menu on/off \(Yes/No\)"
|
||||
if {$menuShow == "false"} {
|
||||
puts $file "set menuShow \"No\"\n"
|
||||
} else {
|
||||
puts $file "set menuShow \"Yes\"\n"
|
||||
}
|
||||
if {$backUpShow == "false"} {
|
||||
puts $file "set backUpFileShow \"No\""
|
||||
} else {
|
||||
@@ -477,6 +502,7 @@ proc Settings {nBook} {
|
||||
|
||||
### BEGIN CheckBox widgets build ####
|
||||
set cbWidgets {
|
||||
MenuShow menuShow {Show the Menu}
|
||||
ToolBar toolBar {Toolbar}
|
||||
BackUpShow backUpShow {Show backup files}
|
||||
BackUpCreate backUpCreate {Create backup files}
|
||||
@@ -643,6 +669,3 @@ proc Settings {nBook} {
|
||||
# Read a config file #
|
||||
LoadSettings
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -20,7 +20,7 @@ proc Separator {} {
|
||||
}
|
||||
|
||||
proc CreateToolBar {} {
|
||||
global toolBar fontBold noteBook tree imgDir editor
|
||||
global toolBar fontNormal fontBold noteBook tree imgDir editor
|
||||
if {$toolBar == "Yes"} {
|
||||
set bboxFile [ButtonBox .frmTool.bboxFile -spacing 0 -padx 1 -pady 1 -bg $editor(bg)]
|
||||
add_toolbar_button $bboxFile new.png {AddToProjDialog file [$noteBookFiles raise]} [::msgcat::mc "Create new file"]
|
||||
@@ -51,6 +51,30 @@ proc CreateToolBar {} {
|
||||
GoToLineButton $frm
|
||||
pack $bboxFile [Separator] $bboxEdit [Separator] $bboxProj [Separator] $bboxHelp [Separator] $frm -side left -anchor w
|
||||
|
||||
# Create menubutton and menu
|
||||
image create photo menu.png -format png -file [file join $imgDir menu.png]
|
||||
menubutton .frmTool.menu -menu .frmTool.menu.m -font $fontNormal -bg $editor(bg) -fg $editor(fg) \
|
||||
-image menu.png
|
||||
set m [menu .frmTool.menu.m -bg $editor(bg) -fg $editor(fg)]
|
||||
GetFileMenu $m
|
||||
$m add separator
|
||||
$m add cascade -label [::msgcat::mc "Project"] -menu $m.project -font $fontNormal
|
||||
GetProjMenu [menu $m.project -bg $editor(bg) -fg $editor(fg)]
|
||||
|
||||
$m add cascade -label [::msgcat::mc "Edit"] -menu $m.edit -font $fontNormal
|
||||
GetMenu [menu $m.edit -bg $editor(bg) -fg $editor(fg)]
|
||||
|
||||
#$m add cascade -label [::msgcat::mc "View"] -menu $m.view -font $fontNormal
|
||||
#GetViewMenu [menu $m.view -bg $editor(bg) -fg $editor(fg)]
|
||||
|
||||
$m add cascade -label [::msgcat::mc "Modules"] -menu $m.modules -font $fontNormal
|
||||
GetModulesMenu [menu $m.modules -bg $editor(bg) -fg $editor(fg)]
|
||||
|
||||
$m add cascade -label [::msgcat::mc "Help"] -menu $m.help -font $fontNormal
|
||||
GetHelpMenu [menu $m.help -bg $editor(bg) -fg $editor(fg)]
|
||||
|
||||
pack .frmTool.menu -side right
|
||||
|
||||
}
|
||||
}
|
||||
## TOOLBAR ##
|
||||
@@ -73,3 +97,5 @@ proc GoToLineButton {w} {
|
||||
balloon $w.entGoTo set [::msgcat::mc "Goto line"]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -83,3 +83,4 @@ proc Translit {line} {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user