remove blocks view (superseded by source)

This commit is contained in:
Torsten Ruger 2015-10-29 23:06:24 +02:00
parent be76a57fde
commit e8b0a38478
4 changed files with 5 additions and 56 deletions

View File

@ -18,7 +18,7 @@ $susy: (
}
.source_view {
@include span(4);
@include span(7);
margin-left: span(1);
}

View File

@ -16,7 +16,6 @@ require "base/list_view"
require "views/switch_view"
require "views/status_view"
require "views/source_view"
require "views/blocks_view"
require "views/instruction_view"
require "views/registers_view"
@ -32,7 +31,6 @@ class MainView < ListView
@interpreter = Interpreter::Interpreter.new
super( [SwitchView.new(@interpreter) ,
SourceView.new(@interpreter) ,
BlocksView.new(@interpreter) ,
InstructionView.new(@interpreter) ,
StatusView.new(@interpreter) ,
RegistersView.new(@interpreter) ] )

View File

@ -1,52 +0,0 @@
class BlocksView < ListView
def initialize interpreter
@interpreter = interpreter
@interpreter.register_event(:instruction_changed, self)
@interpreter.register_event(:state_changed, self)
show = []
show << LabelView.new(@interpreter.instruction) if @interpreter.instruction.is_a?(Register::Label)
super(show)
end
def draw
super()
wrap_element div("div.labels_view") << div("h4" , "Method + Block " ) << div("h4.method" , @method_name)
return @element
end
def instruction_changed
return unless @interpreter.instruction.is_a?(Register::Label)
if @children.last
return if @interpreter.instruction.object_id == @children.last.label.object_id
@elements.last.at_css(".bright").remove_class("bright")
end
append_view( LabelView.new(@interpreter.instruction) )
remove_first if( @elements.length > 6)
end
def state_changed old , new_s
return unless new_s == :running
clear_view
end
end
class LabelView < ElementView
def initialize label
@label = label
end
attr_reader :label
def draw
@element = div("div") << div("span.bright" , label_name )
end
def label_name
return @label if @label.is_a? String
@label.name
end
end

View File

@ -8,13 +8,16 @@ class SourceView < ElementView
def draw
@text = div
@ticker = div
@element = div(".source_view") << div("h4" ,"Future") << @ticker << @text
@element = div(".source_view") << div("h4.source" , "Class.Method") << @ticker << @text
@element
end
def instruction_changed
i = @interpreter.instruction
return "" unless i
if( i.is_a?(Register::Label) and i.name.include?("."))
@element.at_css(".source").text = i.name
end
case i.source
when AST::Node
update_code