Class: ObjiController

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

Overview

< ArcadiaExt

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_rad) ⇒ ObjiController

Returns a new instance of ObjiController.



1288
1289
1290
1291
1292
1293
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1288

def initialize(_rad)
  @rad = _rad
  ArcadiaContractListener.new(self, InspectorContract, :do_inspector_event)
  ArcadiaContractListener.new(self, WrapperContract, :do_wrapper_event)
  build
end

Instance Attribute Details

#activeObject (readonly)

Returns the value of attribute active.



1286
1287
1288
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1286

def active
  @active
end

Instance Method Details

#activate(me) ⇒ Object



1394
1395
1396
1397
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1394

def activate(me)
  @active = me
  self.main_frame.nb_base.raise(@objis[me])
end

#buildObject



1303
1304
1305
1306
1307
1308
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1303

def build
  #@main_frame = ObjiControllerView.new(self.frame)
  @objis = Hash.new
  @wrappers_obji = Hash.new
  @frames = Array.new
end

#del(_obji) ⇒ Object



1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1382

def del(_obji)
  _obji.free
  self.main_frame.nb_base.delete(@objis.delete(_obji))
  if @objis.length == 0
    @active = nil
    self.frame.free
    @main_frame = nil
  else
    activate(@objis.keys[@objis.length-1])
  end
end

#do_inspector_event(_event) ⇒ Object



1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1335

def do_inspector_event(_event)
   obji = @wrappers_obji[_event.context.wrapper] if _event.context
   
   case _event.signature 
   		when InspectorContract::SELECT_WRAPPER
   		  obji.select(_event.context.wrapper, false)
   		when InspectorContract::DELETE_WRAPPER
 		    obji.delete(_event.context.wrapper)
   		when InspectorContract::DELETE_INSPECTOR  
   		  self.del(obji)
   		when InspectorContract::RAISE_ACTIVE_TOPLEVEL  
   		  self.active.raise_toplevel if active
   		when InspectorContract::RAISE_LAST_WIDGET  
   		  self.active.select_last(true) if active
   end
end

#do_wrapper_event(_event) ⇒ Object



1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1310

def do_wrapper_event(_event)
	   obji = @wrappers_obji[_event.context.wrapper] if _event.context
    case _event.signature 
    		when WrapperContract::WRAPPER_AFTER_CREATE
    		  self.register(_event.context.wrapper)
    		when WrapperContract::PROPERTY_AFTER_UPDATE
    		  obji.inspect_core.update_property(_event.context.wrapper, _event.context.property_family, _event.context.property_name, _event.context.property_new_value)
    		  if (_event.context.property_family=='layout_man')
	       obji.inspect_core.tabs['Layout'].family=_event.context.property_new_value
	       obji.inspect_core.tabs['Layout'].updatelines(
	       		_event.context.wrapper, 
	       		_event.context.wrapper.props[_event.context.property_new_value]
	       )
    		  end
    		  
    end		
end

#frameObject

def on_before_build(_event)

 ArcadiaContractListener.new(self, InspectorContract, :do_inspector_event)
ArcadiaContractListener.new(self, WrapperContract, :do_wrapper_event)

end



1299
1300
1301
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1299

def frame
  @rad.frame(0)
end

#main_frameObject



1328
1329
1330
1331
1332
1333
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1328

def main_frame
		if !defined?(@main_frame) || @main_frame == nil
  		@main_frame = ObjiControllerView.new(self.frame.hinner_frame)
  end
  return @main_frame
end

#new_obji(_sender, _filename = nil) ⇒ Object



1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1366

def new_obji(_sender, _filename = nil)
  _fname = 'f'+@frames.length.to_s
  _frame = self.main_frame.nb_base.insert('end',_fname,'text'=>_sender.i_name)
  @frames << _frame

  _newobji = Obji.new(_frame, self, _sender, _filename)

  @objis[_newobji]=_fname

  activate(_newobji)

  #@arcadia.layout.raise_panel('_mosca_','Inspect')
  
  return _newobji
end

#register(_wrapper) ⇒ Object



1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
# File 'ext/ae-rad/ae-rad-inspector.rb', line 1352

def register(_wrapper)
  if _wrapper.ag_parent
  	 obji = @wrappers_obji[_wrapper.ag_parent]
  else
    obji = self.new_obji(_wrapper)
  end
  if obji
    obji.register(_wrapper) 

    @wrappers_obji[_wrapper]=obji
  end
  @last_registred = _wrapper
end