Method: FileH#on_build

Defined in:
ext/ae-file-history/ae-file-history.rb

#on_build(_event) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'ext/ae-file-history/ae-file-history.rb', line 65

def on_build(_event)
   @h_stack = Array.new
   do_select_item = proc{|_self|
     if _self.selection_get[0].length >0
     	_selected = ""
     	_self.selection_get[0].each{|_block|
      	 _selected = _selected + _block.to_s + "\s" 
     	}
     	_selected = _selected.strip
     else
       _selected = _self.selection_get[0]
     end
     _dir, _file = _selected.split('@@@')
     if _file
       _file = File.expand_path( _file  , _dir ) 
   else
      _file = Tk.getOpenFile('initialdir'=>_dir)
   end
   if _file
     Arcadia.process_event(OpenBufferEvent.new(self,'file'=>_file))
       #EditorContract.instance.open_file(self,'file'=>_file)
     end
   }
   _background = conf('color.background')
   _foreground = conf('color.foreground')
   @font =  conf('font')
   @font_b = conf('font.bold')

  @htree = Tk::BWidget::Tree.new(self.frame){
     relief 'flat'
     showlines false
     deltay 18
     background _background
     crossfill _foreground
     #dragenabled true
     selectcommand proc{ do_select_item.call(self) } 
     place('relwidth' => 1,'relx' => 0,'x' => '0','y' => '0','relheight' => '1')
   }
   _scrollcommand = proc{|*args| @htree.yview(*args)}
   _scrollbar = TkScrollbar.new(self.frame){|s|
     width 8
     command _scrollcommand
   }.pack('side'=>'right', 'fill'=>'y')
   @htree.yscrollcommand proc{|first,last| _scrollbar.set(first,last)}
   
  self.build_tree
end