27 |
include Fox |
include Fox |
28 |
extend FreeBASE::StandardPlugin |
extend FreeBASE::StandardPlugin |
29 |
ICON_PATH = "/system/ui/icons/Debugger" |
ICON_PATH = "/system/ui/icons/Debugger" |
30 |
|
@@debugRenderer = nil |
31 |
|
|
32 |
def DebuggerRenderFox.start(plugin) |
def DebuggerRenderFox.start(plugin) |
33 |
|
|
34 |
plugin[ICON_PATH].subscribe do |event, slot| |
plugin[ICON_PATH].subscribe do |event, slot| |
41 |
end |
end |
42 |
end |
end |
43 |
end |
end |
44 |
|
|
45 |
|
# Create a renderer for each new Debugger session |
46 |
|
plugin["/system/ui/components/Debugger"].subscribe do |event, slot| |
47 |
|
if (event == :notify_slot_add && slot.parent.name == 'Debugger') |
48 |
|
@@debugRenderer = Renderer.new(plugin, slot) |
49 |
|
end |
50 |
|
end |
51 |
|
|
52 |
# Add command |
plugin["/system/ui/components/Debugger"].each_slot do |slot| |
53 |
debugRenderer = Renderer.new(plugin) |
@@debugRenderer = Renderer.new(plugin, slot) |
54 |
|
end |
55 |
|
# @@debugRenderer = Renderer.new(plugin,slot) |
56 |
|
|
57 |
|
# Add command |
58 |
plugin["/system/ui/commands"].manager.add("App/View/Debugger","Debugger","View Debugger") do |cmd_slot| |
plugin["/system/ui/commands"].manager.add("App/View/Debugger","Debugger","View Debugger") do |cmd_slot| |
59 |
debugRenderer.toggle |
@@debugRenderer.toggle |
60 |
end |
end |
61 |
plugin["/system/ui/commands"].manager.command("App/View/Debugger").icon = "/system/ui/icons/Debugger/startDebugger" |
plugin["/system/ui/commands"].manager.command("App/View/Debugger").icon = "/system/ui/icons/Debugger/startDebugger" |
62 |
plugin["/system/ui/keys"].manager.bind("App/View/Debugger", :F8) |
plugin["/system/ui/keys"].manager.bind("App/View/Debugger", :F8) |
67 |
viewmenu = plugin["/system/ui/components/MenuPane/View_menu"].manager |
viewmenu = plugin["/system/ui/components/MenuPane/View_menu"].manager |
68 |
viewmenu.add_command("App/View/Debugger") |
viewmenu.add_command("App/View/Debugger") |
69 |
viewmenu.uncheck("App/View/Debugger") |
viewmenu.uncheck("App/View/Debugger") |
|
|
|
|
#plugin["/system/ui/components/Debugger"].subscribe do |event, slot| |
|
|
# if (event == :notify_slot_add && slot.parent.name == "Debugger") |
|
|
# Renderer.new(plugin, slot) |
|
|
# end |
|
|
#end |
|
70 |
|
|
71 |
# Now only is the plugin ready |
# Now only is the plugin ready |
72 |
plugin.transition(FreeBASE::RUNNING) |
plugin.transition(FreeBASE::RUNNING) |
81 |
include Fox |
include Fox |
82 |
attr_reader :plugin |
attr_reader :plugin |
83 |
|
|
84 |
def initialize(plugin) |
def initialize(plugin,slot) |
85 |
@docked = false |
@docked = false |
86 |
@plugin = plugin |
@plugin = plugin |
87 |
|
@slot = slot |
88 |
@cmd_mgr = plugin['/system/ui/commands'].manager |
@cmd_mgr = plugin['/system/ui/commands'].manager |
89 |
@viewmenu = plugin["/system/ui/components/MenuPane/View_menu"].manager |
@viewmenu = plugin["/system/ui/components/MenuPane/View_menu"].manager |
90 |
@icons = @plugin[ICON_PATH] |
@icons = @plugin[ICON_PATH] |
91 |
@app = plugin['/system/ui/fox/FXApp'].data |
@app = plugin['/system/ui/fox/FXApp'].data |
92 |
|
|
93 |
# Create the frame for this plugin, attach it to the main window. |
# Create the frame for this plugin, attach it to the main window. |
94 |
# It will be reparented later on when the debugger is inserted |
# It will be reparented later on when the debugger is inserted |
95 |
# in a dockpane. Also hide it because we don;t want to see it now. |
# in a dockpane. Also hide it because we don;t want to see it now. |
100 |
@frm.hide |
@frm.hide |
101 |
@frm.create |
@frm.create |
102 |
create_ui() |
create_ui() |
103 |
#@slot.subscribe do |event, slot| |
# @slot.subscribe do |event, slot| |
104 |
# update(event,slot) if event == :notify_data_set |
# update(event,slot) if event == :notify_data_set |
105 |
#end |
#end |
106 |
@dockpane_slot = plugin['/system/ui/components/DockPane'].manager.add("Debugger") |
@dockpane_slot = plugin['/system/ui/components/DockPane'].manager.add("Debugger") |
107 |
@dockpane_slot.data = @frm |
@dockpane_slot.data = @frm |
108 |
@debugger = nil |
@debugger = nil |
109 |
|
|
110 |
|
setup_actions() |
111 |
|
@plugin.log_info << "Debugger renderer created #{slot.path}" |
112 |
|
|
113 |
end |
end |
114 |
|
|
115 |
|
def setup_actions |
116 |
|
bind_action("attach_stderr", :attach_stderr) |
117 |
|
bind_action("attach_stdin", :attach_stdin) |
118 |
|
bind_action("attach_stdout", :attach_stdout) |
119 |
|
bind_action("detach_stderr", :detach_stderr) |
120 |
|
bind_action("detach_stdin", :detach_stdin) |
121 |
|
bind_action("detach_stdout", :detach_stdout) |
122 |
|
bind_action("update_thread_list", :update_thread_list) |
123 |
|
bind_action("update_frame_list", :update_frame_list) |
124 |
|
bind_action("start", :start) |
125 |
|
bind_action("stop", :stop) |
126 |
|
bind_action("toggle", :toggle) |
127 |
|
bind_action("hide", :hide) |
128 |
|
bind_action("show", :show) |
129 |
|
end |
130 |
|
|
131 |
|
def bind_action(name, meth) |
132 |
|
@slot["actions/#{name}"].set_proc method(meth) |
133 |
|
end |
134 |
|
|
135 |
def toggle |
def toggle |
136 |
unless @docked |
unless @docked |
137 |
@dockpane_slot.manager.dock('south') |
@dockpane_slot.manager.dock('south') |
153 |
#@plugin.properties["Open"] = true |
#@plugin.properties["Open"] = true |
154 |
end |
end |
155 |
end |
end |
156 |
end |
end |
157 |
|
|
158 |
|
|
159 |
## |
## |
160 |
# Create the debugger UI and put it in a top frame |
# Create the debugger UI and put it in a top frame |
161 |
# |
# |