Украшательства интерфейса - Реакция на нажатие кнопки в панели инструментов теперь зависит от контекста
This commit is contained in:
		| @@ -167,11 +167,26 @@ namespace eval FileOper { | ||||
|                     Close | ||||
|                 } | ||||
|             } | ||||
|             set nextProj [$tree next $treeItem] | ||||
|             # puts $nextProj | ||||
|             set prevProj [$tree prev $treeItem] | ||||
|             # puts $prevProj | ||||
|             if {$nextProj ne ""} { | ||||
|                 set activeProject [$tree item $nextProj -values] | ||||
|                 puts $activeProject | ||||
|             } elseif {$prevProj ne ""} { | ||||
|                 set activeProject [$tree item $prevProj -values] | ||||
|                 puts $activeProject | ||||
|             } else { | ||||
|                 unset activeProject | ||||
|                 .frmStatus.lblGitLogo configure -image pixel | ||||
|                 .frmStatus.lblGit configure -text "" | ||||
|             } | ||||
|             $tree delete $treeItem | ||||
|             unset nextProj | ||||
|             unset prevProj | ||||
|         } | ||||
|         set activeProject "" | ||||
|         .frmStatus.lblGitLogo configure -image pixel | ||||
|         .frmStatus.lblGit configure -text "" | ||||
|  | ||||
|     } | ||||
|  | ||||
|     proc CloseAll {} { | ||||
|   | ||||
| @@ -135,7 +135,7 @@ grid .frmBody.panel -row 0 -column 1 -sticky nesw | ||||
| grid columnconfigure .frmBody .frmBody.panel -weight 1 | ||||
| grid rowconfigure .frmBody .frmBody.panel -weight 1 | ||||
|  | ||||
| ttk::button $frmTool.btn_tree  -command  "ViewFilesTree true" -image tree_24x24 | ||||
| ttk::button $frmTool.btn_tree  -command ToolBtnTreePress -image tree_24x24 | ||||
| ttk::button $frmTool.btn_search  -command FileOper::FindInFiles -image search_24x24 | ||||
| ttk::button $frmTool.btn_git -command Git::Dialog -image git_24x24 | ||||
|  | ||||
|   | ||||
| @@ -112,6 +112,68 @@ proc ViewHelper {helper} { | ||||
|         set cfgVariables($helper) true | ||||
|     } | ||||
| } | ||||
| proc WelcomeDialog {} { | ||||
|     set win .welcome | ||||
|     set x [winfo rootx .frmWork] | ||||
|     set y [winfo rooty .frmWork] | ||||
|  | ||||
|     if { [winfo exists $win] } { | ||||
|         destroy $win | ||||
|         return | ||||
|     } | ||||
|     toplevel $win | ||||
|     wm transient $win . | ||||
|     wm overrideredirect $win 1 | ||||
|      | ||||
|     ttk::button $win.btnOpenFolder -text [::msgcat::mc "Open folder"] -command { | ||||
|         destroy .welcome | ||||
|         set folderPath [FileOper::OpenFolderDialog] | ||||
|         if {$folderPath != ""} { | ||||
|             set activeProject $folderPath | ||||
|             FileOper::ReadFolder $folderPath | ||||
|             ReadFilesFromDirectory $folderPath $folderPath | ||||
|         } | ||||
|     } | ||||
|     ttk::button $win.btnOpenFile -text [::msgcat::mc "Open file"] -command { | ||||
|         destroy .welcome | ||||
|         set filePath [FileOper::OpenDialog] | ||||
|         if {$filePath != ""} { | ||||
|             FileOper::Edit $filePath | ||||
|         } | ||||
|     } | ||||
|     ttk::button $win.btnNewFile -compound center -text [::msgcat::mc "New file"] \ | ||||
|         -command { | ||||
|             destroy .welcome | ||||
|             Editor::New | ||||
|         } | ||||
|      | ||||
|     pack $win.btnOpenFolder -expand true -fill x -side top -padx 3 -pady 3 | ||||
|     pack $win.btnOpenFile -expand true -fill x -side top -padx 3 -pady 3 | ||||
|     pack $win.btnNewFile -expand true -fill x -side top -padx 3 -pady 3 | ||||
|  | ||||
|     bind $win <Escape> "destroy $win" | ||||
|     # Определям расстояние до края экрана (основного окна) и если | ||||
|     # оно меньше размера окна со списком то сдвигаем его вверх | ||||
|     set winGeom [winfo reqheight $win] | ||||
|     set topHeight [winfo height .] | ||||
|     # puts "$x, $y, $winGeom, $topHeight" | ||||
|     if [expr [expr $topHeight - $y] < $winGeom] { | ||||
|         set y [expr $topHeight - $winGeom] | ||||
|     } | ||||
|     wm geom $win +$x+$y | ||||
|     focus $win.btnOpenFolder | ||||
| }     | ||||
|  | ||||
| proc ToolBtnTreePress {} { | ||||
|     global cfgVariables activeProject | ||||
|     if [info exists activeProject] { | ||||
|         if {$activeProject ne ""} { | ||||
|             ViewFilesTree true | ||||
|         } | ||||
|     } else { | ||||
|         WelcomeDialog | ||||
|     } | ||||
| } | ||||
|  | ||||
| proc Del {} { | ||||
|     return | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 svkalinin
					svkalinin