add space to left view

show integer and word values
This commit is contained in:
Torsten Ruger 2018-04-07 19:44:47 +03:00
parent 509aff9552
commit 73643e4882
3 changed files with 13 additions and 6 deletions

View File

@ -14,7 +14,7 @@ require "risc/interpreter"
# the base, our own litle framework, allows for child and parent views and handles updates
require "base/list_view"
# each seperate view is in it's own class.
require "views/switch_view"
require "views/left_view"
require "views/status_view"
require "views/source_view"
require "views/instruction_view"
@ -42,7 +42,7 @@ class MainView < ListView
def initialize
Risc.machine.boot
@interpreter = Risc::Interpreter.new
super( [SwitchView.new(@interpreter) ,
super( [LeftView.new(@interpreter) ,
SourceView.new(@interpreter) ,
InstructionView.new(@interpreter) ,
StatusView.new(@interpreter) ,

View File

@ -1,16 +1,17 @@
require_relative "classes_view"
class SwitchView < ListView
class LeftView < ListView
def initialize interpreter
super([ SelectView.new(interpreter) , ClassesView.new(interpreter) ])
super([ SelectView.new(interpreter) ,
ObjectView.new( Parfait.object_space , interpreter , 16),
ClassesView.new(interpreter) ])
end
def draw
super(".classes")
end
end
# opal eval seems to get the scope wrong and evals in object (not where its called)
include AST::Sexp
class SelectView < ElementView

View File

@ -59,6 +59,12 @@ class ObjectView < ListView
index += 1
end
end
if( object.is_a?(Parfait::Integer) )
fields << RefView.new( 3.to_s , object.value , @z )
end
if( object.is_a?(Parfait::Word) )
fields << RefView.new( 3.to_s , object.to_string , @z )
end
end
fields
end