projman/lib/main.tcl
2018-03-15 16:22:57 +03:00

384 lines
20 KiB
Tcl

###########################################################
# Tcl/Tk Project Manager #
# Distrubuted under GPL #
# Copyright (c) "Sergey Kalinin", 2002, http://nuk-svk.ru #
# Author: Sergey Kalinin banzaj28@yandex.ru #
###########################################################
Modules
## MAIN INTERFACE ##
#
if {[info exists topLevelGeometry]} {
wm geometry . $topLevelGeometry
} else {
wm geometry . 1200x1024+0+0
}
wm title . "Tcl/Tk Project Manager $ver"
wm iconname . "Tcl/Tk Project Manager $ver"
#image create photo icon -format png -file [file join $imgDir icons large projman.png]
image create photo icon -data {
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI
WXMAAAsSAAALEgHS3X78AAAAB3RJTUUH1AoBATAgUp33UQAAE4hJREFUeJy1WmmQW9WV/t6T9KTW
rlarW+q92+72hgMYG6iAsQGzBsZJjMFZPZmaSWAqM1QWhsxUSM0kVYHJ/EgqVFKpVFIwIWAgTGKc
gMGGtIndbru9dWP3vqg37ct70tPblzs/JLW7jW2aUDlV94ek++79vnvOPdsT8FeIquKu/n4kLRZ8
FgBjmvh8Pg/9l7/E5JYt+AoA21+z7t9KKAD00sHz+PVjj+EdAFtyOXhZFrG77sIBAF8C0F6ZR61w
fCyxfghoS2WObemGsRj8r7yCkwDmamqw96c/xczhw3gJwOsApMqz1sqwVMZSsASAXhkGALPyHfnY
BJ544gm6o6PD19XVtba5ufkxv9//paW/nzlzBsePfzPqdIqjXq9Rl0gk/umHP8RrAN6rgKcA7ATw
o9tvv9337LPP1nav6bbksjmcPTuAH/znM8jMjw0WTP5JXpJZlIysCmQJBRUmtCVkViTLVPjkk0/S
27ZtC9fV1f2rjbE9mcllML8wD4parmkrPYixUTcY25F329uPt+zdS34A4A8A5Mrm9tdee23T/fff
v///eqJ1L74VhV1n0Ww7Q3bv3gVZ5Kif/+pHGJuc0YpT8YNF03xBJfQkVHpG0zQJWCTyoWJZ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qqOTAFAA7Y7fX14ZCm0Ynx5HnOEPQtEQ6kzmqKEqfaZpLbf5q4AEAN954o+ZyuT57
8ODBtwDwV5p3KQmO47KlUskbDAabmpqb7CPDI/jzu3/G+rXr0d7ezsiK7E+n0hcURcmjXHIaVQK0
y+WKudwuaWJiIioryhQo6myxWDxhmuYorm42H5Dh4eHCjh079h44cOAwgPzV5l6GRJplWV8kHGl2
1jiZrtVd2LlzJ9xeN+bn50NTk1MnJUlKoFzcL/ZGdUEQJqPR6POyojSomuawCIJaAZ0GwK4UPABE
o1E9GAyyAGqxvJ69khgon2hWEIQz58+fv4Zl2Zsfeugh982fvBklqYT3B9+HIimMaZp+AG6U8zjK
Wllc13Wd53l+GkDKNE2raZrVNzViZfGPUvoRr9c71tra2jw3N3caF2vqlZDIa5r2p9nZ2VW/+c1v
du3fv9/T1d2F6alptLa2ghBSfXlOAxffxlQ7ADyALIAUyqdf7R585LqV47gT99xzzydQ7umsVKrt
lBnTNH/W1NT0pizL4pGeI/B4PBgdHX2N5/kFlA9WBz6YC1Xt0cDHLLgpisomEolrpqenz1VArVSq
GKREInGuWCwe1jStJx6PHyoUCkOEkBkAMZQrOO1j/9niKkIBCOFibv9Rn2UAuFBupXtQ/r+GUlmP
Q6Up9rck8HGFwvI/m9CoBD8sqdr+H8azwnc3xO1JAAAAAElFTkSuQmCC
}
wm iconphoto . icon
wm protocol . WM_DELETE_WINDOW Quit
wm overrideredirect . 0
wm positionfrom . user
#wm resizable . 0 0
frame .frmMenu -border 1 -relief raised -background $editor(bg) -highlightthickness 0
frame .frmTool -border 1 -relief raised -background $editor(bg) -highlightthickness 0
frame .frmBody -border 1 -relief raised -background $editor(bg) -highlightthickness 0
frame .frmStatus -border 1 -relief sunken -bg $editor(bg)
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
########## 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)]
GetFileMenu $m
##.frmMenu 'Project' ##
menubutton .frmMenu.mnuProj -text [::msgcat::mc "Project"] -menu .frmMenu.mnuProj.m -font $fontNormal -bg $editor(bg) -fg $editor(fg)
set m [menu .frmMenu.mnuProj.m -bg $editor(bg) -fg $editor(fg)]
GetProjMenu $m
##.frmMenu 'Edit' ##
menubutton .frmMenu.mnuEdit -text [::msgcat::mc "Edit"] -menu .frmMenu.mnuEdit.m -font $fontNormal -bg $editor(bg) -fg $editor(fg)
## BUILDING EDIT-MENU FOR MAIN AND POP-UP MENU ##
GetMenu [menu .frmMenu.mnuEdit.m -bg $editor(bg) -fg $editor(fg)];# main edit menu
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)]
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)]
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)]
GetHelpMenu $m
pack .frmMenu.mnuFile .frmMenu.mnuProj .frmMenu.mnuEdit .frmMenu.mnuView .frmMenu.mnuCVS -side left
pack .frmMenu.mnuHelp -side right
## Bind command ##
bind . <F1> ShowHelp
bind . <F5> UpdateTree
bind . <F6> MakeRPM
bind . <F7> MakeTGZ
bind . <F8> {MakeProj compile proj}
bind . <Control-F8> {MakeProj compile file}
bind . <F9> {MakeProj run proj}
bind . <Control-F9> {MakeProj run file}
bind . <Control-ograve> {AddToProjDialog file [$noteBookFiles raise]}
bind . <Control-n> {AddToProjDialog file [$noteBookFiles raise]}
#bind . <Control-ocircumflex> AddToProjDialog
#bind . <Control-a> AddToProjDialog
bind . <Control-eacute> Quit
bind . <Control-q> Quit
bind . <Control-ccedilla> PrintDialog
bind . <Control-p> PrintDialog
set sepIndex 0
########## STATUS BAR ##########
set frm1 [frame .frmStatus.frmHelp -bg $editor(bg)]
set frm2 [frame .frmStatus.frmActive -bg $editor(bg)]
set frm3 [frame .frmStatus.frmProgress -relief sunken -bg $editor(bg)]
set frm4 [frame .frmStatus.frmLine -bg $editor(bg)]
set frm5 [frame .frmStatus.frmFile -bg $editor(bg)]
set frm6 [frame .frmStatus.frmOvwrt -bg $editor(bg)]
pack $frm1 $frm4 $frm6 $frm2 $frm5 -side left -fill x
pack $frm3 -side left -fill x -expand true
label $frm1.lblHelp -width 25 -relief sunken -font $fontNormal \
-anchor w -bg $editor(bg) -fg $editor(fg)
pack $frm1.lblHelp -fill x
label $frm4.lblLine -width 10 -relief sunken -font $fontNormal \
-anchor w -bg $editor(bg) -fg $editor(fg)
pack $frm4.lblLine -fill x
label $frm2.lblActive -width 25 -relief sunken -font $fontNormal \
-anchor center -bg $editor(bg) -fg $editor(fg)
pack $frm2.lblActive -fill x
label $frm3.lblProgress -relief sunken -font $fontNormal \
-anchor w -bg $editor(bg) -fg $editor(fg)
pack $frm3.lblProgress -fill x
label $frm5.lblFile -width 10 -relief sunken -font $fontNormal \
-anchor w -bg $editor(bg) -fg $editor(fg)
pack $frm5.lblFile -fill x
label $frm6.lblOvwrt -width 10 -relief sunken -font $fontNormal \
-anchor center -bg $editor(bg) -fg $editor(fg)
pack $frm6.lblOvwrt -fill x
########## PROJECT-FILE-FUNCTION TREE ##################
#set frmCat [frame .frmBody.frmCat -border 1 -relief sunken -bg $editor(bg)]
set frmCat [frame .frmBody.frmCat -border 0 -relief flat -highlightthickness 0]
pack $frmCat -side left -fill y -fill both
#set frmWork [frame .frmBody.frmWork -border 1 -relief sunken -bg $editor(bg)]
set frmWork [frame .frmBody.frmWork -border 0 -relief flat -highlightthickness 0]
pack $frmWork -side left -fill both -expand true
## CREATE PANE ##
pane::create .frmBody.frmCat .frmBody.frmWork -percent 0.20
# NoteBook - Projects and Files
#################### WORKING AREA ####################
set noteBookFiles [NoteBook $frmCat.noteBook -font $fontNormal -side top -bg $editor(bg) -fg $editor(fg) \
-activebackground $editor(bg) -activeforeground $editor(fg)]
pack $noteBookFiles -fill both -expand true -padx 2 -pady 2
set nbProjects [$noteBookFiles insert end projects -text [::msgcat::mc "Projects"] \
-activebackground $editor(bg) -activeforeground $editor(fg)]
set nbFiles [$noteBookFiles insert end files -text [::msgcat::mc "Files"] \
-activebackground $editor(bg) -activeforeground $editor(fg)]
#set frmButtonBoxTreeProj [frame $nbFiles.frmButtonBoxTreeProj]
#pack $frmButtonBoxTreeProj -side top -fill both -expand true
set bBoxProjectTree [ButtonBox $nbProjects.bboxProjectTree -spacing 0 -padx 1 -pady 1 -bg $editor(bg)]
#add_toolbar_button $bBoxProjectTree new_project.png {NewProj new "" ""} [::msgcat::mc "New project"]
#add_toolbar_button $bBoxProjectTree del_project.png DelProj [::msgcat::mc "Delete project"]
add_toolbar_button $bBoxProjectTree project_settings.png {NewProj edit $activeProject ""} [::msgcat::mc "Project settings"]
add_toolbar_button $bBoxProjectTree sort.png {SortTree [$noteBookFiles raise]} [::msgcat::mc "Sort tree"]
pack $bBoxProjectTree -side top -pady 4 -anchor w
# Create FileTree
#FileTree::create $nbFiles
set frmTreeFiles [ScrolledWindow $nbFiles.frmTreeFiles -bd 0 -bg $editor(bg) -background $editor(bg)]
set treeFiles [
Tree $frmTreeFiles.treeFiles \
-relief sunken -borderwidth 0 -width 5 -highlightthickness 1\
-redraw 0 -dropenabled 1 -dragenabled 1 -dragevent 3 \
-background $editor(bg) -selectbackground $editor(selectbg) -selectforeground white\
-droptypes {
TREE_NODE {copy {} move {} link {}}
LISTBOX_ITEM {copy {} move {} link {}}
} -opencmd {TreeOpen} \
-closecmd {TreeClose}
]
$frmTreeFiles setwidget $treeFiles
pack $frmTreeFiles -side top -fill both -expand true
$treeFiles bindText <ButtonPress-1> "TreeOneClick $treeFiles [$treeFiles selection get]"
$treeFiles bindImage <ButtonPress-1> "TreeOneClick $treeFiles [$treeFiles selection get]"
$treeFiles bindImage <Double-ButtonPress-1> "TreeDoubleClick $treeFiles [$treeFiles selection get]"
$treeFiles bindText <Double-ButtonPress-1> "TreeDoubleClick $treeFiles [$treeFiles selection get]"
GetAllDirs $treeFiles
$treeFiles bindText <Shift-Button-1> {$treeFiles selection add $treeFiles [$treeFiles selection get]}
# Added menu
GetMenuFileTree [menu .popMenuFileTree -bg $editor(bg) -fg $editor(fg)] ;# pop-up edit menu
bind $frmTreeFiles.treeFiles.c <Button-3> {catch [PopupMenuFileTree $treeFiles %X %Y]}
# Create Project tree
set frmTree [ScrolledWindow $nbProjects.frmTree -bd 0 -bg $editor(bg)]
global tree noteBook
set tree [Tree $frmTree.tree \
-relief sunken -borderwidth 0 -width 3 -height 5 -highlightthickness 1\
-redraw 0 -dropenabled 1 -dragenabled 1 -dragevent 3 \
-background $editor(bg) -selectbackground $editor(selectbg) -selectforeground white\
-droptypes {
TREE_NODE {copy {} move {} link {}}
LISTBOX_ITEM {copy {} move {} link {}}
} -opencmd {TreeOpen} -closecmd {TreeClose}]
$frmTree setwidget $tree
pack $frmTree -side top -fill both -expand true
$noteBookFiles raise projects
$tree bindText <Double-ButtonPress-1> "TreeDoubleClick $tree [$tree selection get]"
$tree bindText <ButtonPress-1> "TreeOneClick $tree [$tree selection get]"
$tree bindImage <Double-ButtonPress-1> "TreeDoubleClick $tree [$tree selection get]"
$tree bindImage <ButtonPress-1> "TreeOneClick $tree [$tree selection get]"
$tree bindText <Shift-Button-1> {$tree selection add [$tree selection get]}
bind $frmTree.tree.c <Control-acircumflex> {FileDialog [$noteBookFiles raise] delete}
bind $frmTree.tree.c <Control-d> {FileDialog [$noteBookFiles raise] delete}
bind $frmTree.tree.c <Return> {
set node [$tree selection get]
TreeOneClick $tree $node
TreeDoubleClick $tree $node
}
$noteBookFiles bindtabs <ButtonRelease-1> "FileNotePageRaise [$noteBookFiles raise]"
## POPUP FILE-MENU ##
set m .popupFile
menu $m -font $fontNormal -bg $editor(bg) -fg $editor(fg)
$m add command -label [::msgcat::mc "New file"] -command {AddToProjDialog file [$noteBookFiles raise]}\
-font $fontNormal -accelerator "Ctrl+N"
$m add command -label [::msgcat::mc "New directory"] -command {AddToProjDialog directory [$noteBookFiles raise]}\
-font $fontNormal -accelerator "Alt + Ctrl+N"
$m add command -label [::msgcat::mc "Open"] -command {FileDialog [$noteBookFiles raise] 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 -accelerator "Ctrl+A"
$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 "Add to existing project"] -command {AddToProjDialog "" [$noteBookFiles raise]} \
-font $fontNormal -state disable
$m add command -label [::msgcat::mc "Add as new project"] -command {OpenProj [$noteBookFiles raise]} -font $fontNormal
## POPUP PROJECT-MENU ##
set m [menu .popupProj -font $fontNormal -bg $editor(bg) -fg $editor(fg)]
GetProjMenu $m
## TABS popups ##
set m .popupTabs
menu $m -font $fontNormal -bg $editor(bg) -fg $editor(fg)
$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
bind $frmTree.tree.c <Button-3> {catch [PopupMenuTree %X %Y]}
######### DEDERER: bind Wheel Scroll ##################
bind $frmTree.tree.c <Button-4> "$tree yview scroll -3 units"
bind $frmTree.tree.c <Button-5> "$tree yview scroll 3 units"
bind $frmTree.tree.c <Shift-Button-4> "$tree xview scroll -2 units"
bind $frmTree.tree.c <Shift-Button-5> "$tree xview scroll 2 units"
#################### WORKING AREA ####################
set noteBook [NoteBook $frmWork.noteBook -font $fontNormal -side top -bg $editor(bg) -fg $editor(fg)]
pack $noteBook -fill both -expand true -padx 2 -pady 2
$noteBook bindtabs <ButtonRelease-1> "PageRaise $tree [$noteBook raise]"
$noteBook bindtabs <Button-3> {catch [PopupMenuTab .popupTabs %X %Y]}
#bind . <Control-udiaeresis> PageTab
#bind . <Control-M> PageTab
bind . <Control-Next> {PageTab 1}
bind . <Control-Prior> {PageTab -1}
##################################################
CreateToolBar
GetProj $tree
$tree configure -redraw 1
set activeProject ""
focus -force $tree
# Opened last active project
if {[info exists workingProject]} {
if {$workingProject ne ""} {
.frmBody.frmCat.noteBook.fprojects.frmTree.tree opentree $workingProject
}
}