Class: Obji

Inherits:
Object
  • Object
show all
Includes:
Observable
Defined in:
ext/ae-rad/ae-rad-inspector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_frame, _controller, _agobj_start, _filename = nil) ⇒ Obji

Returns a new instance of Obji.



1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1124

def initialize(_frame, _controller, _agobj_start, _filename = nil)
  @agobj_start = _agobj_start
  @agobj_last = nil
  @controller = _controller
  @filename = _filename
  @frame = _frame
  @pmainwind = AGTkOSplittedFrames.new(@frame,@frame,20)
  @f_top =  @pmainwind.top_frame
  @f_bottom =  @pmainwind.bottom_frame
  @lb = TkMenuButtonObjBoard.new(@f_top, self)
  @ojts = Tk::BWidget::NoteBook.new(@f_bottom, Arcadia.style('tabpanel')){
    tabbevelsize 0
    internalborderwidth 0
    side $arcadia['conf']['inspectors.inspector.tabs.side']
    #font $arcadia['conf']['inspectors.inspector.tabs.font']
    pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
  }
  #@inspect_core = _agobj_start.class.class_inspector.new(@ojts, _agobj_start)
  @inspect_core = Inspector.iclass(_agobj_start.class).new(@ojts, _agobj_start)
  #@requires = Hash.new
  @renderer = @inspect_core.class.class_inspector_renderer.new(self)
  select(_agobj_start)
end

Instance Attribute Details

#active_objectObject (readonly)

Returns the value of attribute active_object.



1115
1116
1117
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1115

def active_object
  @active_object
end

#agobj_startObject (readonly)

Returns the value of attribute agobj_start.



1121
1122
1123
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1121

def agobj_start
  @agobj_start
end

#editorObject (readonly)

Returns the value of attribute editor.



1120
1121
1122
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1120

def editor
  @editor
end

#filenameObject

Returns the value of attribute filename.



1116
1117
1118
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1116

def filename
  @filename
end

#inspect_coreObject (readonly)

Returns the value of attribute inspect_core.



1119
1120
1121
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1119

def inspect_core
  @inspect_core
end

#lbObject (readonly)

Returns the value of attribute lb.



1113
1114
1115
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1113

def lb
  @lb
end

#rendererObject (readonly)

Returns the value of attribute renderer.



1122
1123
1124
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1122

def renderer
  @renderer
end

#requiresObject (readonly)

Returns the value of attribute requires.



1118
1119
1120
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1118

def requires
  @requires
end

#tlbObject (readonly)

Returns the value of attribute tlb.



1114
1115
1116
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1114

def tlb
  @tlb
end

Instance Method Details

#activateObject



1190
1191
1192
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1190

def activate
  @controller.activate(self)
end

#activeObject



1161
1162
1163
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1161

def active
  @controller.active
end

#change_name(_agobj, _newname) ⇒ Object



1153
1154
1155
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1153

def change_name(_agobj, _newname)
  @lb.change_name(_agobj, _newname)
end

#code2file(_objects_file = nil) ⇒ Object

def objects2code

  code_rb = ''
  @requires.each_key do |key|
    code_rb = code_rb, "require '",key,"'\n"
  end
  code_rb = code_rb, "\n", @inspect_core.objects2text(@lb.objectsList)
end


1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1225

def code2file(_objects_file = nil)
  @filename = _objects_file
  if !@filename
    exit
  end

  File.open(_objects_file, "w") do |aFile|
    aFile.print  @renderer.code
  end
end

#delete(_agobj) ⇒ Object

def del_require(_require)

  @requires[_require] -= 1
  if @requires[_require] == 0
    @requires[_require] = nil
  end
end


1180
1181
1182
1183
1184
1185
1186
1187
1188
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1180

def delete(_agobj)
  _agobj.obj.destroy if defined? _agobj.obj
  if _agobj==agobj_start
    @controller.del(self)
  else
    @lb.delete(_agobj)
    select(@lb.objectsList[@lb.objectsList.length - 1]) if @lb.objectsList.length > 0
  end
end

#dumpObjectstoFile(_objects_file = 'sample\objects.rb') ⇒ Object

def saveObjectsCreationtoFile(_objects_file = ‘sampleobjects.rb’)

  @filename = _objects_file
  code_rb = ''
  code_rbd = ''
  code_form = ''
  code_form = code_form, "class ", File.basename(_objects_file, ".rb"),"\n"
  code_rbd = code_rbd, "require '",_objects_file,"'\n"
  @requires.each_key do |key|
    code_rb = code_rb, "require '",key,"'\n"
  end
  @lb.objectsList.each{|object|
    code_rb = code_rb, object.get_class_code
    code_rbd = code_rbd,"\n", object.get_implementation_code
  }
  File.open(_objects_file, "w") do |aFile|
    aFile.print code_rb
  end
  File.open(_objects_file+'d', "w") do |aFile|
    aFile.print code_rbd
  end
end


1258
1259
1260
1261
1262
1263
1264
1265
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1258

def dumpObjectstoFile(_objects_file = 'sample\objects.rb')
  @filename = _objects_file
  File.open(_objects_file, "w") do |aFile|
    @lb.objectsList.each{|object|
      Marshal.dump(object.obj, aFile)
    }
  end
end

#freeObject



1148
1149
1150
1151
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1148

def free
  #@agobj_start.delete
  @inspect_core.clear
end

#raise_toplevelObject



1157
1158
1159
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1157

def raise_toplevel
  @agobj_start.obj.raise
end

#register(me) ⇒ Object



1194
1195
1196
1197
1198
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1194

def register(me)
  @lb.insert(me)
  @agobj_last = me
  return self
end

#select(me, _activate_me = true) ⇒ Object



1207
1208
1209
1210
1211
1212
1213
1214
1215
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1207

def select(me, _activate_me=true)
  return if @active_object == me
  me.activate #if _activate_me
  @active_object = me
  @inspect_core.recicle_inspects(me)
  @lb.select(me)
  changed
  notify_observers('SELECT', me)
end

#select_last(_activate = true) ⇒ Object



1200
1201
1202
1203
1204
1205
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1200

def select_last(_activate=true)
  #Tk.messageBox('message'=>'select last')
  if @agobj_last != nil
    select(@agobj_last, _activate)
  end
end