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.


998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
# File 'ext/ae-editor/ae-editor.rb', line 998

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'))

  @cb_sync = Arcadia.wf.titlecontextcheckbutton(@panel){
    variable TkVariable.new
    image Arcadia.image_res(SYNC_GIF)
    pack
  }
  
  @cb_sync.hint=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


997
998
999
# File 'ext/ae-editor/ae-editor.rb', line 997

def sync
  @sync
end

Instance Method Details

#is_sync_on?Boolean

Returns:

  • (Boolean)

1072
1073
1074
# File 'ext/ae-editor/ae-editor.rb', line 1072

def is_sync_on?
  @sync
end

#sync_offObject


1068
1069
1070
# File 'ext/ae-editor/ae-editor.rb', line 1068

def sync_off
  @sync = false
end

#sync_onObject


1059
1060
1061
1062
1063
1064
1065
1066
# File 'ext/ae-editor/ae-editor.rb', line 1059

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