#!/usr/bin/tclsh # Part of MCU 8051 IDE ( http://https://sourceforge.net/projects/mcu8051ide/ ) ############################################################################ # Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 by Martin Ošmera # # martin.osmera@gmail.com # # # # Copyright (C) 2014 by Moravia Microsystems, s.r.o. # # martin.osmera@gmail.com # # # # This program is free software; you can redistribute it and#or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 2 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the # # Free Software Foundation, Inc., # # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # ############################################################################ # >>> File inclusion guard if { ! [ info exists _FILELIST_TCL ] } { set _FILELIST_TCL _ # <<< File inclusion guard # -------------------------------------------------------------------------- # DESCRIPTION # Provides: # - List of opened files # - List of project files # - File system browser # - Management of opened files, project files and code editors # -------------------------------------------------------------------------- # Import nesesary sources source "${::LIB_DIRNAME}/leftpanel/fsbrowser.tcl" ;# File system browser source "${::LIB_DIRNAME}/leftpanel/sfrwatches.tcl" ;# SRF Watches class FileList { # Inherit content of some other clases inherit RightPanel SFRWatches FSBrowser ## COMMON # String: Textvariable for dialog "Open with ..." public common open_with ${::CONFIG(OPEN_WITH_DLG)} public common open_with_cnfr 0 ;# Bool: Confirm dialog "Open with ..." public common fl_lst_count 0 ;# Instances counter public common file_indexes {} ;# List of line indexes (auxiliary variable for opening multiple files) public common ac_index_in_fl ;# Index of actual editor filelist public common default_encoding {utf-8} ;# Default encoding public common default_eol {lf} ;# Default EOL public common bookmark 0 ;# Auxiliary variable for popup menu for Icon Borders public common pmenu_cline 0 ;# Auxiliary variable for popup menu for Icon Borders # Menu items to disable when entering simulator mode public common freezable_menu_items { {New} {Close} {Close All} {Open} } # Font for opened file in project files list public common opened_file_font [font create \ -weight normal \ -slant roman \ -size -12 \ -family $::DEFAULT_FIXED_FONT \ ] # Font for closed file in project files list public common closed_file_font [font create \ -weight normal \ -slant italic \ -size -12 \ -family $::DEFAULT_FIXED_FONT \ ] # Font for icon borders public common icon_border_font [font create \ -weight normal \ -slant roman \ -size -12 \ -family $::DEFAULT_FIXED_FONT \ ] public common filelist {} ;# List of files to open public common open_files_cur_file {} ;# Name of file currently being opened public common open_files_progress 0 ;# True if opening files in progress public common open_files_abort 0 ;# Abort variable for open files ProgressDialog public common filedetails_visible 0 ;# Bool: Is file details window visible public common filedetails_after_ID ;# ID of timeout for show window "file details" # Definition of popup menu for listbox of opened files public common OPENEDFILESMENU { {command {Append to project} {} 0 "filelist_append_to_prj" {add} "Append this file to the current project"} {separator} {command {New} {$edit:new} 0 "editor_new" {filenew} "Create new file and open its editor"} {separator} {command {Open} {$edit:open} 0 "editor_open" {fileopen} "Open an existing file"} {separator} {command {Save} {$edit:save} 0 "editor_save" {filesave} "Save this file"} {command {Save as} {$edit:save_as} 5 "editor_save_as" {filesaveas} "Save this file under different name"} {command {Save all} {$edit:save_all} 6 "editor_save_all" {save_all} "Save all file in the list"} {separator} {command {Close} {$edit:close} 0 "editor_close 1 {}" {fileclose} "Close this file"} {command {Close All} {$edit:close_all} 4 "editor_close_all 1 0" {cancel} "Close all files in the list"} {separator} {command {Bookmark} {} 4 "filelist_o_bookmark" {bookmark_add} "Add/Remove bookmark for this file"} {separator} {command {Move up} {} 5 "filelist_move_up" {1uparrow} "Move this file up in the list"} {command {Move down} {} 5 "filelist_move_down" {1downarrow} "Move this file down in the list"} {command {Move to top} {} 8 "filelist_move_top" {top} "Move this file to the top of the list"} {command {Move to bottom} {} 12 "filelist_move_bottom" {bottom} "Move this file to the bottom of the list"} {separator} {cascade "Sort items by" 11 "sort_incr" .sort_by false 1 { {command {Document Name} {} 9 "sort_file_list N 1" {} {}} {command {File URL} {} 5 "sort_file_list U 1" {} {}} {command {File Size in B} {} 5 "sort_file_list S 1" {} {}} }} {cascade "Open with" 6 "fileopen" .open_with false 1 { {command {gvim} {} 1 "filelist_open_with 1 gvim" {gvim} {}} {command {emacs} {} 1 "filelist_open_with 1 emacs" {emacs} {}} {command {kwrite} {} 0 "filelist_open_with 1 kwrite" {kwrite} {}} {command {gedit} {} 0 "filelist_open_with 1 gedit" {gedit} {}} {command {other} {} 0 "filelist_open_with 1 other" {exec} {}} }} {separator} {command {Hide the panel} {} 0 "filelist_show_hide" {2leftarrow} "Hide this panel"} } # Definition of popup menu for notebook with opened files public common FILETABSPUMENU { {command {Append to project} {} 0 "filelist_append_to_prj" {add} "Append this file to the current project"} {separator} {command {Save} {$edit:save} 0 "editor_save" {filesave} "Save this file"} {command {Save as} {$edit:save_as} 5 "editor_save_as" {filesaveas} "Save this file under different name"} {command {Save all} {$edit:save_all} 6 "editor_save_all" {save_all} "Save all file in the list"} {separator} {command {Close} {$edit:close} 0 "editor_close 1 {}" {fileclose} "Close this file"} {command {Close All} {$edit:close_all} 4 "editor_close_all 1 0" {cancel} "Close all files in the list"} {separator} {command {Bookmark} {} 4 "filelist_o_bookmark" {bookmark_add} "Add/Remove bookmark for this file"} {separator} {cascade "Open with" 6 "" .open_with false 1 { {command {gvim} {} 1 "filelist_open_with 1 gvim" {gvim} {}} {command {emacs} {} 1 "filelist_open_with 1 emacs" {emacs} {}} {command {kwrite} {} 0 "filelist_open_with 1 kwrite" {kwrite} {}} {command {gedit} {} 0 "filelist_open_with 1 gedit" {gedit} {}} {command {other} {} 0 "filelist_open_with 1 other" {exec} {}} }} } # Definition of popup menu for listbox of project files public common PROJECTFILESMENU { {command {Remove file from the project} {} 0 "filelist_remove_file_from_project" {editdelete} "Remove this file from the project"} {command {Close file} {$edit:close} 0 "filelist_project_file_close" {fileclose} "Close this file"} {command {Open file} {} 0 "filelist_project_file_open" {fileopen} "Open this file"} {separator} {command {Bookmark} {} 4 "filelist_p_bookmark" {bookmark_add} "Add/Remove bookmark for this file"} {separator} {command {Move up} {} 5 "filelist_prj_move_up" {1uparrow} "Move this item up"} {command {Move down} {} 5 "filelist_prj_move_down" {1downarrow} "Move this item down"} {command {Move to top} {} 8 "filelist_prj_move_top" {top} "Move this item to the top of the list"} {command {Move to bottom} {} 12 "filelist_prj_move_bottom" {bottom} "Move this item to the bottom of the list"} {separator} {cascade "Sort items by" 11 "" .sort_by false 1 { {command {Document Name} {} 9 "sort_file_list N 0" {} {}} {command {File URL} {} 5 "sort_file_list U 0" {} {}} {command {File Size in B} {} 5 "sort_file_list S 0" {} {}} }} {cascade "Open with" 6 "" .open_with false 1 { {command {gvim} {} 1 "filelist_open_with 0 gvim" {gvim} {}} {command {emacs} {} 1 "filelist_open_with 0 emacs" {emacs} {}} {command {kwrite} {} 0 "filelist_open_with 0 kwrite" {kwrite} {}} {command {gedit} {} 0 "filelist_open_with 0 gedit" {gedit} {}} {command {other} {} 0 "filelist_open_with 0 other" {exec} {}} }} {separator} {command {Hide the panel} {} 0 "filelist_show_hide" {2leftarrow} "Hide this panel"} } # Definition of popup menu icon border for list of of opened files public common OPENEDFILESIBMENU { {checkbutton "Bookmark" "" {::FileList::bookmark} 1 0 0 {opened_files_bookmark ${::FileList::pmenu_cline}}} } # Definition of popup menu icon border for list of of project files public common PROJECTFILESIBMENU { {checkbutton "Bookmark" "" {::FileList::bookmark} 1 0 0 {project_files_bookmark ${::FileList::pmenu_cline}}} } ## PUBLIC public variable actualEditor 0 ;# Object number of currently selected editor public variable actualEditor2 -2 ;# Object number of currently selected editor in the second view public variable ProjectDir ;# Reference to directory of actual project public variable editors {} ;# list of editor objects public variable iconBorder $::CONFIG(ICON_BORDER) ;# Bool: display Icon border public variable lineNumbers $::CONFIG(LINE_NUMBERS) ;# Bool: display Line numbers ## PRIVATE # Bool: procedure switchfile will not forget its frame (cleared by procedure switchfile) private variable do_not_forget_editor 0 private variable editor_close_in_progress 0 ;# Bool: Indicates than procedure editor_close is in progress private variable pwin_orient {} ;# String multiview orientaion (horizontal or vertical) private variable multiview_sash_pos 0 ;# Int: position of panedwindow sash for multiview private variable selectedView 0 ;# Int: 0 == left/top view; 1 == right/bottom view private variable splitted 0 ;# Bool: Editor is splitted private variable main_frame ;# Widget: frame containing $multiview_paned_win or $pagesManager private variable untitled_num -1 ;# Number of untitled entries in file list private variable leftPanel ;# ID of the left panel private variable notebook ;# ID of left panel Notebook private variable parent ;# ID of parent container widget private variable button_bar ;# ID of show/hide button (for listbox of files) private variable lastItem ;# Descriptor of the last selected file private variable obj_idx ;# Index of This object private variable pagesManager ;# ID of frame for packing editors private variable pagesManager2 ;# ID of frame for packing editors in second view private variable multiview_paned_win ;# ID of paned window for $pagesManager and $pagesManager2 private variable listbox_opened_files ;# ID of ListBox of currently opened files private variable listbox_opened_files_bm ;# ID of icon border for opened files private variable opened_files_bookmarks {} ;# List: Bookmarks for opened files private variable IB_o_menu ;# ID of popup menu for 'listbox_opened_files_bm' private variable listbox_project_files ;# ID of ListBox of currently opened files private variable listbox_project_files_bm ;# ID of icon border for project files private variable project_files_bookmarks {} ;# List: Bookmarks for project files private variable IB_p_menu ;# ID of popup menu for 'listbox_project_files_bm' private variable last_sash ;# Last position of the paned window sash private variable next_editor_button ;# ID of button "Next editor" -- tab "Opened files" private variable prev_editor_button ;# ID of button "Prev editor" -- tab "Opened files" private variable opened_files_scrollbar ;# ID of scrollbar for opened files visible private variable o_scrollbar_visible 0 ;# Bool: Scrollbar for opened files visible private variable project_files_scrollbar ;# ID of scrollbar for project files visible private variable p_scrollbar_visible 0 ;# Bool: Scrollbar for project files visible private variable opened_files_menu ;# ID of the popup menu asociated with list of opened files private variable project_files_menu ;# ID of the popup menu asociated with list of project files private variable filetabs_pu_menu private variable frozen 0 ;# Bool: Simulator mode flag private variable unsaved ;# List of editor objects with positive flag modified private variable listbox_opened_files_frame ;# Frame for list of opened files private variable listbox_project_files_frame ;# Frame for list of project files private variable fs_browser_frame ;# Frame for file system browser private variable sfr_watches_frame ;# Frame for SFR watches private variable opened_files_buttonBox ;# ID of buttonBox in list of opened files private variable project_files_buttonBox ;# ID of buttonBox in list of project files private variable listbox_opened_files_top_frame ;# Identifier of button frame above listbox of files private variable opened_search_entry ;# ID of search entry for opened files private variable opened_search_clear_button ;# ID of button "Clear" on search panel -- opened files private variable opened_files_highlighted_item {} ;# ID of currently highlighted item in opened files private variable opened_files_hg_item_fg_clr {} ;# Fg. color of currently highlighted item in opened files private variable project_search_entry ;# ID of search entry for project files private variable project_search_clear_button ;# ID of button "Clear" on search panel -- project files private variable project_files_highlighted_item {} ;# ID of currently highlighted item in project files private variable project_files_hg_item_fg_clr {} ;# Fg. color of currently highlighted item in project files private variable item_menu_invoked 0 ;# Bool: Item menu request private variable editor_command_line_on 0 ;# Bool: Editor command line visible private variable simulator_editor 0 ;# Int: Current file number (for simulator) private variable file_switching_enabled 1 ;# Bool: Automatic file switching enabled private variable simulator_editor_obj ;# Object: Code editor used by simulator private variable active_page $::CONFIG(LEFT_PANEL_ACTIVE_PAGE) ;# Active page in the left panel private variable PanelVisible $::CONFIG(LEFT_PANEL) ;# Bool: panel visible private variable PanelSize $::CONFIG(LEFT_PANEL_SIZE) ;# Panel width (in pixels) private variable editor_to_freeze_obj ;# Object: Editor to freeze after simulator start-up private variable filetabs_frm ;# Widget: Frame contaning the tab bar private variable filetabs_nb ;# Widget: Tab bar's notebook widget private variable switchfile_in_progress 0 ;# Bool: Method switchfile is in progress private variable last_selected_item {} ;# String: ID of the last selected opened file ## PROTECTED protected variable file_count 0 ;# counter of opened files protected variable editor_wdgs {} ;# list of editor widgets protected variable file_descriptors {} ;# list of descriptors of opened files protected variable file_eol {} ;# List of EOLs for opened editors protected variable file_encoding {} ;# List of encodings for opened editors protected variable file_ro_mode {} ;# List of read only flags for opened editors protected variable file_sh {} ;# List of syntax highlight id's for opened editors ## object constructor constructor {} { # increment instance counter incr fl_lst_count set obj_idx $fl_lst_count } ## Object destructor destructor { # Destroy editors foreach editor $editors { delete object $editor } # Unregister status bar tips for popup menus menu_Sbar_remove $opened_files_menu menu_Sbar_remove $project_files_menu menu_Sbar_remove $filetabs_pu_menu } ## Initialize GUI components # @parm String parentPane - Identifier of pane window in which it shoul be packed # @parm String projectDir - Directory of current project # @parm List filelist - List of files to open (full filenames including path) # @parm Bool editor_sw_lock - Enable aoutomatic file switching during simulation # @return void public method initalize_FileList {parentPane projectDir FileList editor_sw_lock} { # Object variables set parent $parentPane ;# ID of parent container widget set ProjectDir $projectDir ;# Reference to directory of actual project set file_switching_enabled $editor_sw_lock # Class variables set filelist $FileList ;# List of files to open # Create notebook frame set leftPanel [frame $parentPane.frm_FileList_leftPanel] # Create notebook set notebook [ModernNoteBook $leftPanel.nb_FileList] # Create tab "Hide" $notebook insert end "button_SH" -image ::ICONS::16::2leftarrow \ -raisecmd [list $this filelist_show_hide] \ -helptext [mc "Hide this panel"] # Create tab for list of opened files set listbox_opened_files_frame [$notebook insert end "opened_files" \ -image ::ICONS::16::fileopen \ -raisecmd [list $this Left_panel_set_active_page opened_files] \ -helptext [mc "Opened files"] \ ] # Create tab for list of project files set listbox_project_files_frame [$notebook insert end "project_files" \ -image ::ICONS::16::project_open \ -raisecmd [list $this Left_panel_set_active_page project_files] \ -helptext [mc "Files in the project"] \ ] # Create tab for file system browser set fs_browser_frame [$notebook insert end "fs_browser" \ -image ::ICONS::16::exec \ -raisecmd [list $this Left_panel_set_active_page fs_browser] \ -helptext [mc "File system browser"] \ -createcmd [list $this CreateFSBrowserGUI] \ ] # Create tab for SFR watches set sfr_watches_frame [$notebook insert end "sfr_watches" \ -image ::ICONS::16::kcmmemory \ -raisecmd [list $this Left_panel_set_active_page sfr_watches] \ -helptext [mc "List of SFR's"] \ -createcmd [list $this CreateSFRWatchesGUI] \ ] # Prepare panel componenets but do not create GUI elements PrepareFSBrowser $fs_browser_frame PrepareSFRWatches $sfr_watches_frame # Register notebook status bar tips notebook_Sbar_set {filelist} [list \ button_SH [mc "Hide the panel"] \ opened_files [mc "Opened files"] \ project_files [mc "Files of the current project"] \ fs_browser [mc "File system browser"] \ sfr_watches [mc "Special Function Registers"] \ ] $notebook bindtabs "notebook_Sbar filelist" $notebook bindtabs "Sbar {} ;#" # Create listbox of opened files set lsbox_frame [frame $listbox_opened_files_frame.lsbox_frame] set listbox_opened_files_bm [text $lsbox_frame.icon_border \ -font $icon_border_font \ -width 2 \ -bd 0 \ -pady 1 \ -highlightthickness 0 \ -bg {#DDDDDD} \ -exportselection 0 \ -takefocus 0 \ -cursor hand2 \ ] $listbox_opened_files_bm tag configure center -justify center $listbox_opened_files_bm delete 1.0 end setStatusTip -widget $listbox_opened_files_bm \ -text [mc "Bookmarks for opened files"] set listbox_opened_files [ListBox $lsbox_frame.listbox_opened_files \ -selectmode single \ -selectfill 0 \ -bg {#FFFFFF} \ -selectbackground {#FFFFFF} \ -highlightcolor {#BBBBFF} \ -selectforeground {#0000FF} \ -bd 1 \ -highlightthickness 0 \ -deltay 15 \ -padx 14 \ -yscrollcommand "$this filelist_o_scrollbar_set" \ ] setStatusTip -widget $listbox_opened_files \ -text [mc "List of opened files"] set opened_files_scrollbar [ttk::scrollbar \ $lsbox_frame.scrollbar \ -orient vertical \ -command "$this filelist_o_scroll" \ ] # Create popup menu for icon border set IB_o_menu $listbox_opened_files_bm.ib_o_menu menuFactory $OPENEDFILESIBMENU $IB_o_menu 0 "$this " 0 {} [namespace current] # Create bottom frame set listbox_opened_files_bottom_frame [frame $listbox_opened_files_frame.bottom_frame] set listbox_opened_files_bottom0_frame [frame $listbox_opened_files_bottom_frame.top] set listbox_opened_files_bottom1_frame [frame $listbox_opened_files_bottom_frame.bottom] # Create search panel set opened_search_entry [ttk::entry $listbox_opened_files_bottom0_frame.entry \ -validatecommand "$this filelist_opened_search %P" \ -validate all \ -width 0 \ ] DynamicHelp::add $opened_search_entry -text [mc "Search for file"] setStatusTip -widget $opened_search_entry \ -text [mc "Search for certain file name in list of opened files"] pack $opened_search_entry -side left -fill x -expand 1 set opened_search_clear_button [ttk::button \ $listbox_opened_files_bottom0_frame.clear_button \ -command "$opened_search_entry delete 0 end" \ -image ::ICONS::16::clear_left \ -state disabled \ -style Flat.TButton \ ] DynamicHelp::add $listbox_opened_files_bottom0_frame.clear_button -text [mc "Clear search entry box"] setStatusTip -widget $opened_search_clear_button \ -text [mc "Clear search entry box"] pack $opened_search_clear_button -side right -after $opened_search_entry # Create buttons "Previous" and "Next" set prev_editor_button [ttk::button \ $listbox_opened_files_bottom1_frame.prev \ -command {::X::__prev_editor} \ -image ::ICONS::16::1leftarrow \ -style Flat.TButton \ ] DynamicHelp::add $listbox_opened_files_bottom1_frame.prev \ -text [mc "Previous editor"] pack $prev_editor_button -side left setStatusTip -widget $prev_editor_button \ -text [mc "Switch to the previous editor"] set next_editor_button [ttk::button \ $listbox_opened_files_bottom1_frame.next \ -command {::X::__next_editor} \ -image ::ICONS::16::1rightarrow \ -style Flat.TButton \ ] DynamicHelp::add $listbox_opened_files_bottom1_frame.next \ -text [mc "Next editor"] pack $next_editor_button -side left setStatusTip -widget $next_editor_button \ -text [mc "Switch to the next editor"] # Frame for opened files set listbox_opened_files_top_frame [frame \ $listbox_opened_files_frame.listbox_opened_files_top_frame] pack [label $listbox_opened_files_top_frame.listbox_opened_files_label \ -text [mc "Opened Files:"] -anchor w \ ] -fill x -side top -anchor w -pady 5 # Button box for "Opened files" set opened_files_buttonBox [frame \ $listbox_opened_files_top_frame.opened_files_buttonBox] # Pages managers for editor(s), etc. set main_frame [frame $parentPane.main_frame] # Create filetabs notebook set filetabs_frm [frame $main_frame.filetabs_frm] pack [ttk::button $filetabs_frm.add_button \ -image ::ICONS::16::filenew \ -command {::X::__new} \ -style Flat.TButton \ ] -side left set filetabs_nb [ModernNoteBook $filetabs_frm.filetabs_nb -nomanager 1] pack [$filetabs_nb get_nb] -fill x -anchor sw -side left -expand 1 $filetabs_nb bindtabs [list $this file_details_win_create_from_ftnb] $filetabs_nb bindtabs [list $this file_details_win_hide] $filetabs_nb bindtabs [list $this file_details_win_move] $filetabs_nb bindtabs [list $this filetabs_nb_popup_menu %X %Y] pack [ttk::button $filetabs_frm.close_button \ -image ::ICONS::16::fileclose \ -command {::X::__close} \ -style Flat.TButton \ ] -side right set multiview_paned_win [panedwindow \ $main_frame.multiview_paned_win \ -sashwidth 2 \ -showhandle 0 \ -opaqueresize 1 \ -sashrelief flat \ ] set pagesManager [frame $main_frame.pagesManager] set pagesManager2 [frame $main_frame.pagesManager2] # Create icon bar for "Opened files" iconBarFactory $opened_files_buttonBox "$this " \ [string range $opened_files_buttonBox 1 end] ::ICONS::16:: { {bookmark "Bookmark" {bookmark_add} {filelist_o_bookmark} "Add/Remove bookmark"} {separator} {up "Move file up" {1uparrow} {filelist_move_up} "Move selected file up in the list"} {down "Move file down" {1downarrow} {filelist_move_down} "Move selected file down in the list"} {top "Move item to top" {top} {filelist_move_top} "Move selected file to the top of the list"} {bottom "Move item to bottom" {bottom} {filelist_move_bottom} "Move selected file to the bottom of the list"} } [namespace current] # Pack GUI components of tab "Opened files" pack $opened_files_buttonBox -side left pack $listbox_opened_files_top_frame -side top -anchor w pack $listbox_opened_files_bottom1_frame -side top pack $listbox_opened_files_bottom0_frame -side top -fill x pack $listbox_opened_files_bottom_frame -side bottom -fill x -pady 3 pack $lsbox_frame -side top -anchor nw -fill both -expand 1 pack $listbox_opened_files -side right -fill both -expand 1 pack $listbox_opened_files_bm -before $listbox_opened_files -fill y -side left # Create list of project files set ls_frame [frame $listbox_project_files_frame.ls_frame] set listbox_project_files_bm [text $ls_frame.icon_border \ -font $icon_border_font \ -width 2 \ -bd 0 \ -pady 1 \ -highlightthickness 0 \ -bg {#DDDDDD} \ -exportselection 0 \ -takefocus 0 \ -cursor hand2 \ ] $listbox_project_files_bm delete 1.0 end $listbox_project_files_bm tag configure center -justify center setStatusTip -widget $listbox_project_files_bm \ -text [mc "Bookmarks for project files"] set listbox_project_files [ListBox $ls_frame.listbox_project_files \ -selectmode single \ -highlightthickness 0 \ -bd 1 \ -padx 0 \ -selectbackground {#FFFFFF} \ -bg {#FFFFFF} \ -deltay 15 \ -selectforeground {#0000FF} \ -highlightcolor {#BBBBFF} \ -yscrollcommand "$this filelist_p_scrollbar_set" \ ] setStatusTip -widget $listbox_project_files \ -text [mc "List of project files"] set project_files_scrollbar [ttk::scrollbar \ $ls_frame.scrollbar \ -orient vertical \ -command "$this filelist_p_scroll" \ ] # Create popup menu for icon border set IB_p_menu $listbox_project_files.ib_o_menu menuFactory $PROJECTFILESIBMENU $IB_p_menu 0 "$this " 0 {} [namespace current] # Create search panel set search_panel [frame $listbox_project_files_frame.search_panel] set project_search_entry [ttk::entry $search_panel.entry \ -validatecommand "$this filelist_project_search %P" \ -validate all \ -width 0 \ ] DynamicHelp::add $project_search_entry -text [mc "Search for file"] setStatusTip -widget $project_search_entry \ -text [mc "Search for certain file name in list of project files"] pack $project_search_entry -side left -fill x -expand 1 set project_search_clear_button [ttk::button \ $search_panel.clear_button \ -command "$project_search_entry delete 0 end" \ -image ::ICONS::16::clear_left \ -state disabled \ -style Flat.TButton \ ] DynamicHelp::add $search_panel.clear_button \ -text [mc "Clear search entry box"] setStatusTip -widget $project_search_clear_button \ -text [mc "Clear search entry box"] pack $project_search_clear_button -side right -after $project_search_entry # Create header (label and icon bar) for tab "Project files" set topFrame [frame $listbox_project_files_frame.listbox_project_files_top_frame] pack [label $topFrame.listbox_project_files_label \ -text [mc "Project Files:"] -anchor w \ ] -fill x -side top -anchor w -pady 5 set project_files_buttonBox [frame $topFrame.listbox_project_files_buttonBox] pack $project_files_buttonBox -side bottom -anchor w -expand 0 # Create icon bar for tab "Project files" iconBarFactory $project_files_buttonBox "$this " \ [string range $project_files_buttonBox 1 end] ::ICONS::16:: { {bookmark "Bookmark" {bookmark_add} {filelist_p_bookmark} "Add/Remove bookmark"} {separator} {open "Open this file" {fileopen} {filelist_project_file_open} "Open this file and create its own editor"} {close "Close this file" {fileclose} {filelist_project_file_close} "Close this file and close its editor"} {separator} {remove "Remove this file from the project" {editdelete} {filelist_remove_file_from_project} "Exclude this file from list of files of this project"} } [namespace current] # Evaluate icon bars button states (tab "Project files") FileList_project_disEna_buttons # Pack frames of tab "Projet files" pack $topFrame -fill x -side top -anchor w pack $listbox_project_files -fill both -expand 1 -side right pack $listbox_project_files_bm -before $listbox_project_files -fill y -side left pack $search_panel -side bottom -fill x pack $ls_frame -fill both -expand 1 -side top ## Create button bar set button_bar [frame $leftPanel.button_bar] # Button "Show" pack [ttk::button $button_bar.but_show \ -image ::ICONS::16::2rightarrow \ -command "$this filelist_show_hide" \ -style ToolButton.TButton \ ] DynamicHelp::add $button_bar.but_show -text [mc "Show the panel"] setStatusTip -widget $button_bar.but_show \ -text [mc "Show the panel"] # Separator pack [ttk::separator $button_bar.sep -orient horizontal] -fill x -pady 2 # Button "Instruction details" pack [ttk::button $button_bar.but_opened \ -image ::ICONS::16::fileopen \ -style ToolButton.TButton \ -command "$this filelist_show_up opened_files" \ ] DynamicHelp::add $button_bar.but_opened -text [mc "Currently opened files"] setStatusTip -widget $button_bar.but_opened \ -text [mc "Currently opened files"] # Button "opened files" pack [ttk::button $button_bar.but_proj_open \ -image ::ICONS::16::project_open \ -style ToolButton.TButton \ -command "$this filelist_show_up project_files" \ ] DynamicHelp::add $button_bar.but_proj_open -text [mc "Files in the current project"] setStatusTip -widget $button_bar.but_proj_open \ -text [mc "Files of the current project"] # Button "File system browser" pack [ttk::button $button_bar.but_fs_browser \ -image ::ICONS::16::exec \ -style ToolButton.TButton \ -command "$this filelist_show_up fs_browser" \ ] DynamicHelp::add $button_bar.but_fs_browser -text [mc "File system browser"] setStatusTip -widget $button_bar.but_fs_browser \ -text [mc "File system browser"] # Button "SFR watches" pack [ttk::button $button_bar.but_sfr_watches \ -image ::ICONS::16::kcmmemory \ -style ToolButton.TButton \ -command "$this filelist_show_up sfr_watches" \ ] DynamicHelp::add $button_bar.but_sfr_watches -text [mc "SFR watches"] setStatusTip -widget $button_bar.but_sfr_watches \ -text [mc "SFR watches"] # Show the left panel if {$PanelVisible != 0} { pack [$notebook get_nb] -expand 1 -fill both -padx 5 -pady 5 # Raise active page in the panel notebook catch { $notebook raise $active_page } } else { set last_sash $PanelSize pack $button_bar -side top -anchor nw } # Insert left panel and editor pages manager into parent pane window $parentPane add $leftPanel $parentPane add $main_frame # Set bindings for file lists $listbox_opened_files bindText "$this fileList_opened_filelist_item_popup %X %Y" $listbox_opened_files bindText "$this file_details_win_create O" $listbox_opened_files bindText "$this file_details_win_hide" $listbox_opened_files bindText "$this file_details_win_move" bind $listbox_opened_files <> "$this switchfile; break" if {[winfo exists $listbox_opened_files.c]} { bind $listbox_opened_files.c {%W yview scroll +5 units; break} bind $listbox_opened_files.c {%W yview scroll -5 units; break} bind $listbox_opened_files.c "$this fileList_opened_filelist_popup %X %Y" } bind $listbox_opened_files_bm <> "false_selection $listbox_opened_files_bm" bind $listbox_opened_files_bm "$this filelist_opened_bookmark_xy %x %y" bind $listbox_opened_files_bm "$this filelist_opened_bm_popup_menu %X %Y %x %y" bindtags $listbox_opened_files_bm $listbox_opened_files_bm $listbox_project_files bindText "$this fileList_project_filelist_item_popup %X %Y" $listbox_project_files bindText "$this filelist_project_file_open" $listbox_project_files bindText "$this file_details_win_create P" $listbox_project_files bindText "$this file_details_win_hide" $listbox_project_files bindText "$this file_details_win_move" bind $listbox_project_files <> "$this project_files_listbox_select" if {[winfo exists $listbox_project_files.c]} { bind $listbox_project_files.c {%W yview scroll +5 units; break} bind $listbox_project_files.c {%W yview scroll -5 units; break} bind $listbox_project_files.c "$this fileList_project_filelist_popup %X %Y" } bind $listbox_project_files_bm <> "false_selection $listbox_project_files_bm" bind $listbox_project_files_bm "$this filelist_project_bookmark_xy %x %y" bind $listbox_project_files_bm "$this filelist_project_bm_popup_menu %X %Y %x %y" bindtags $listbox_project_files_bm $listbox_project_files_bm # Create popup menus set opened_files_menu $listbox_opened_files.opened_files_menu set project_files_menu $listbox_project_files.project_files_menu set filetabs_pu_menu [$filetabs_nb get_nb].filetabs_pu_menu filelist_makePopupMenu # Create Editor object for each file in $filelist and insert it into ListBox of opened files open_files $filelist # Initialize list of opened files set actualEditor [lindex $filelist {1 0}] set actualEditor2 [lindex $filelist {1 1}] set multiview_sash_pos [lindex $filelist {1 2}] set pwin_orient [lindex $filelist {1 3}] ## Validate index of current editor(s) if { ![string is digit -strict $actualEditor] || ($actualEditor >= [llength $editors]) || ($actualEditor < 0) } then { set actualEditor $actualEditor2 set splitted 0 } if { ![string is digit -strict $actualEditor2] || ($actualEditor2 >= [llength $editors]) || ($actualEditor2 < 0) || ($actualEditor2 == $actualEditor) } then { set actualEditor2 -1 set splitted 0 } else { set splitted 1 } ## Validate index of current editor in the first view if { [string is digit -strict $actualEditor] && $actualEditor < [llength $editors] && $actualEditor >= 0 } then { ;# Valid value $listbox_opened_files selection set [lindex [$listbox_opened_files items] $actualEditor] set actualEditor -1 switchfile } else { ;# Invalid value set actualEditor -1 if {![llength $editors]} { editor_new } else { $listbox_opened_files selection set [lindex [$listbox_opened_files items] 0] switchfile } } # Validate selected view, sash orient and sash position set selectedView [lindex $filelist {1 4}] if {![string is bool -strict $selectedView]} { set selectedView 0 } if {$pwin_orient != {horizontal} && $pwin_orient != {vertical}} { set pwin_orient {horizontal} } if {![string is digit -strict $multiview_sash_pos] || $multiview_sash_pos < 0} { set multiview_sash_pos 0 } # Pack editor pages manager if {$splitted} { pack $multiview_paned_win -fill both -expand 1 $multiview_paned_win configure -orient $pwin_orient $multiview_paned_win add $pagesManager $multiview_paned_win add $pagesManager2 -after $pagesManager if {$pwin_orient == {vertical}} { if {!$multiview_sash_pos} { set multiview_sash_pos [expr {[winfo height $pagesManager] / 2}] } set minsize 80 } else { if {!$multiview_sash_pos} { set multiview_sash_pos [expr {[winfo width $pagesManager] / 2}] } set minsize 300 } $multiview_paned_win paneconfigure $pagesManager -minsize $minsize $multiview_paned_win paneconfigure $pagesManager2 -minsize $minsize pack [[lindex $editors $actualEditor2] cget -ed_sc_frame] \ -in $pagesManager2 -fill both -expand 1 } else { pack $pagesManager -fill both -expand 1 } foreach editor $editors { $editor configure_statusbar_menu !$splitted $splitted {} {} } # Set panel width update idletasks if {$PanelVisible != 0} { $parent paneconfigure $leftPanel -minsize 155 $parent configure -sashwidth 2 $parent sash place 0 $PanelSize 0 } else { $parent paneconfigure $leftPanel -minsize 0 $parent configure -sashwidth 0 $parent sash place 0 25 2 bind $parent