From 7b82ff31dd8f2022201ab588454af290a0ec0625 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Mon, 10 Aug 2015 22:29:49 +0300 Subject: [PATCH] more and meaningful tooltips --- app/main/assets/css/app.css.scss | 22 +++++++++++++++----- app/main/controllers/classes_controller.rb | 16 ++++++++++++++ app/main/controllers/registers_controller.rb | 20 ++++++++++++++++++ app/main/views/classes/index.html | 7 ++++++- app/main/views/registers/index.html | 7 ++----- 5 files changed, 61 insertions(+), 11 deletions(-) diff --git a/app/main/assets/css/app.css.scss b/app/main/assets/css/app.css.scss index f195755..bff022c 100644 --- a/app/main/assets/css/app.css.scss +++ b/app/main/assets/css/app.css.scss @@ -7,12 +7,19 @@ .tooltip span { z-index:10;display:none; padding:14px 20px; margin-top:-30px; margin-left:28px; - width:300px; line-height:16px; + width:150px; line-height:16px; } -.tooltip:hover span{ +.tooltip:hover span { display:inline; position:absolute; color:#111; - border:1px solid #DCA; background:#fffAF0;} -.callout {z-index:20;position:absolute;top:30px;border:0;left:-12px;} + border:1px solid #DCA; background:#fffAF0; +} +.callout { + z-index:20; + position:absolute; + top:30px; + border:0; + left:-12px; +} /*CSS3 extras*/ .tooltip span @@ -28,8 +35,13 @@ $susy: ( .debugger-view { @include container(90%); } -.classes { @include span(3); } +.classes { + @include span(3); +} +.one-class { + margin: 10px; +} .file-view { @include span(4); margin: span(1); diff --git a/app/main/controllers/classes_controller.rb b/app/main/controllers/classes_controller.rb index f4c530c..7628bc8 100644 --- a/app/main/controllers/classes_controller.rb +++ b/app/main/controllers/classes_controller.rb @@ -5,12 +5,28 @@ module Main super(*args) page._classes!.clear + all = [] Virtual.machine.space.classes.each do |name , claz| next if [:Kernel,:Module,:MetaClass,:BinaryCode].index name + all << name + end + all.sort.each do |name| c = Volt::Model.new :name => name page._classes << c end end + def variables(clas_model) + self.variables(clas_model.name) + end + + def self.variables(clas_name) + layout = Virtual.machine.space.get_class_by_name(clas_name).object_layout + vars = [] + layout.object_instance_names.each do |name| + vars << name + end + vars + end end end diff --git a/app/main/controllers/registers_controller.rb b/app/main/controllers/registers_controller.rb index d1d74e5..884371a 100644 --- a/app/main/controllers/registers_controller.rb +++ b/app/main/controllers/registers_controller.rb @@ -23,5 +23,25 @@ module Main var.class.name.split("::").last[0,2] end + def variables val + name = val.class.name.split("::").last + ClassesController.variables(name) + end + + def content(id) + object = Virtual.machine.objects[id] + fields = [] + if object and ! object.is_a?(String) + clazz = object.class.name.split("::").last + fields << "#{clazz}:#{object.internal_object_length}" + fields << "--------------------" + object.get_instance_variables.each do |variable| + f = object.get_instance_variable(variable) + fields << "#{f.class.name.split('::').last} : #{f.object_id}" + end + end + fields + end + end end diff --git a/app/main/views/classes/index.html b/app/main/views/classes/index.html index 309bb69..4e58293 100644 --- a/app/main/views/classes/index.html +++ b/app/main/views/classes/index.html @@ -5,8 +5,13 @@

Classes

{{page._classes.each do |clas| }} -
+
{{ clas._name }} + + {{clas._name}}
+ --------------
+ {{variables(clas).join("\n") }} +
{{end}}
diff --git a/app/main/views/registers/index.html b/app/main/views/registers/index.html index 13f0cb1..be1584d 100644 --- a/app/main/views/registers/index.html +++ b/app/main/views/registers/index.html @@ -20,16 +20,13 @@
{{index}}{{marker(attribute)}} - {{attribute.class}} + {{variables(attribute).join("\n")}}
{{attribute.object_id}} - long text with initlong text with initlong
- text with initlong text with initlong -

text with initlong

- text with initlong text with init + {{content(attribute.object_id).join("\n")}}