Class: AgEditorOutlineToolbar

Inherits:
Object
  • Object
show all
Defined in:
ext/ae-editor/ae-editor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_controller) ⇒ AgEditorOutlineToolbar

Returns a new instance of AgEditorOutlineToolbar.



779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
# File 'ext/ae-editor/ae-editor.rb', line 779

def initialize(_controller)
  @controller = _controller
  @panel = @controller.main_instance.frame(1).root.add_panel(@controller.main_instance.frame(1).name, "sync");
  @cb_sync = TkCheckButton.new(@panel, Arcadia.style('checkbox').update('background'=>@panel.background)){
    text  'Sync'
    justify  'left'
    indicatoron 0
    offrelief 'flat'
    image Arcadia.image_res(SYNC_GIF)
    pack
  }        
  Tk::BWidget::DynamicHelp::add(@cb_sync, 
    'text'=> Arcadia.text('ext.editor.button.link.hint'))

  do_check = proc {
    if @cb_sync.cget('onvalue')==@cb_sync.cget('variable').value.to_i
      sync_on
    else
      sync_off
    end
    #Arcadia.console(self, "msg"=>"@sync=#{@sync}" )

  }
  @sync = false
  @cb_sync.command(do_check)
  
  #----
  go_to_parent = proc{
    e = @controller.active_instance.raised
    if e
      no = e.outline.last_opened
      if no
        e.outline.tree_exp.see(no)
      else  
        _selected = e.outline.tree_exp.selected
        if _selected && e.outline.tree_exp.exist?(_selected)
          _parent = e.outline.tree_exp.parent(_selected)
          if _parent && _parent != 'root'
            e.outline.tree_exp.see(_parent)
          else
            e.outline.tree_exp.see(_selected)
          end
        end
      end
    end
     
  }
  
  @b_goto_p = @controller.main_instance.frame(1).root.add_button(@controller.main_instance.frame(1).name, Arcadia.text("ext.editor.button.up.hint"), go_to_parent, ARROW_UP_GIF)
  #----    
end

Instance Attribute Details

#syncObject

Returns the value of attribute sync.



778
779
780
# File 'ext/ae-editor/ae-editor.rb', line 778

def sync
  @sync
end

Instance Method Details

#is_sync_on?Boolean

Returns:

  • (Boolean)


844
845
846
# File 'ext/ae-editor/ae-editor.rb', line 844

def is_sync_on?
  @sync
end

#sync_offObject



840
841
842
# File 'ext/ae-editor/ae-editor.rb', line 840

def sync_off
  @sync = false
end

#sync_onObject



831
832
833
834
835
836
837
838
# File 'ext/ae-editor/ae-editor.rb', line 831

def sync_on
  @sync = true
  e = @controller.active_instance.raised
  if e
    #Arcadia.console(self, "msg"=>"@sync=#{@sync} file=#{e.file}" )
    e.outline.select_without_event(e.outline.last_row) if e.outline.last_row
  end
end