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.



867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
# File 'ext/ae-editor/ae-editor.rb', line 867

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.



866
867
868
# File 'ext/ae-editor/ae-editor.rb', line 866

def sync
  @sync
end

Instance Method Details

#is_sync_on?Boolean

Returns:

  • (Boolean)


932
933
934
# File 'ext/ae-editor/ae-editor.rb', line 932

def is_sync_on?
  @sync
end

#sync_offObject



928
929
930
# File 'ext/ae-editor/ae-editor.rb', line 928

def sync_off
  @sync = false
end

#sync_onObject



919
920
921
922
923
924
925
926
# File 'ext/ae-editor/ae-editor.rb', line 919

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