138 |
bind_action("update_frame_list", :update_frame_list) |
bind_action("update_frame_list", :update_frame_list) |
139 |
bind_action("update_local_var_list", :update_local_var_list) |
bind_action("update_local_var_list", :update_local_var_list) |
140 |
bind_action("update_global_var_list", :update_global_var_list) |
bind_action("update_global_var_list", :update_global_var_list) |
141 |
|
bind_action("list_watchpoints", :list_watchpoints) |
142 |
bind_action("start", :start) |
bind_action("start", :start) |
143 |
bind_action("stop", :stop) |
bind_action("stop", :stop) |
144 |
bind_action("close", :close) |
bind_action("close", :close) |
297 |
fconsole.padTop = 0; fconsole.padBottom = 0 |
fconsole.padTop = 0; fconsole.padBottom = 0 |
298 |
@console = FXText.new(fconsole, self, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y) |
@console = FXText.new(fconsole, self, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y) |
299 |
@console.connect(SEL_KEYPRESS, method(:onKeyPTextConsole)) |
@console.connect(SEL_KEYPRESS, method(:onKeyPTextConsole)) |
300 |
scons_frame = FXSplitter.new(fconsole, LAYOUT_FILL_X| |
scons_frame = FXHorizontalFrame.new(fconsole, LAYOUT_FILL_X) |
301 |
SPLITTER_TRACKING|SPLITTER_HORIZONTAL) |
scons_frame.padLeft = 0; scons_frame.padRight = 0 |
302 |
FXLabel.new(scons_frame, "Eval:", nil, JUSTIFY_LEFT|LAYOUT_FILL_X|LAYOUT_CENTER_Y) |
scons_frame.padTop = 0; scons_frame.padBottom = 0 |
303 |
@eval_tf = FXTextField.new(scons_frame, 2, nil, 0, (FRAME_SUNKEN|FRAME_THICK| |
|
304 |
|
FXLabel.new(scons_frame, "Eval:", nil, JUSTIFY_LEFT|LAYOUT_CENTER_Y) |
305 |
|
@eval_tf = FXTextField.new(scons_frame, 2, nil, 0, (FRAME_SUNKEN| |
306 |
LAYOUT_FILL_X|LAYOUT_CENTER_Y|LAYOUT_FILL_COLUMN)) |
LAYOUT_FILL_X|LAYOUT_CENTER_Y|LAYOUT_FILL_COLUMN)) |
307 |
@eval_tf.connect(SEL_COMMAND, method(:onCmdEvalExpr)) |
@eval_tf.connect(SEL_COMMAND, method(:onCmdEvalExpr)) |
308 |
|
|
340 |
hsin.activeBackColor = @console.activeBackColor |
hsin.activeBackColor = @console.activeBackColor |
341 |
hsin.style = FXText::STYLE_UNDERLINE |
hsin.style = FXText::STYLE_UNDERLINE |
342 |
|
|
343 |
|
# Define an output style for evaluated expressions |
344 |
|
hseval = FXHiliteStyle.new |
345 |
|
hseval.normalForeColor = FXColor::DarkSlateGray |
346 |
|
hseval.normalBackColor = @console.backColor |
347 |
|
hseval.selectForeColor = @console.selTextColor |
348 |
|
hseval.selectBackColor = @console.selBackColor |
349 |
|
hseval.hiliteForeColor = @console.hiliteTextColor |
350 |
|
hseval.hiliteBackColor = @console.hiliteBackColor |
351 |
|
hseval.activeBackColor = @console.activeBackColor |
352 |
|
|
353 |
|
|
354 |
@console.styled = true |
@console.styled = true |
355 |
@console.hiliteStyles = [hsout, hserr, hsin] |
@console.hiliteStyles = [hsout, hserr, hsin, hseval] |
356 |
|
|
357 |
# create the thread display tab |
# create the thread display tab |
358 |
tab_thread = FXTabItem.new(tb,"Threads",nil) |
tab_thread = FXTabItem.new(tb,"Threads",nil) |
384 |
frmc_frame = FXHorizontalFrame.new(frm_frame,FRAME_RIDGE|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y) |
frmc_frame = FXHorizontalFrame.new(frm_frame,FRAME_RIDGE|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y) |
385 |
@cbox_frame.width = split_frame.width/2 |
@cbox_frame.width = split_frame.width/2 |
386 |
@cbox_thread.width = split_frame.width/2 |
@cbox_thread.width = split_frame.width/2 |
387 |
@tbox_lvar = FXText.new(frmc_frame, self, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y) |
@tbox_lvar = FXText.new(frmc_frame, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y) |
388 |
|
@tbox_lvar.editable = false |
389 |
|
|
390 |
# create the watches display tab |
# create the watches display tab |
391 |
tab_watches = FXTabItem.new(tb,"Watches",nil) |
tab_watches = FXTabItem.new(tb,"Watches",nil) |
392 |
frm_watches = FXHorizontalFrame.new(tb,FRAME_RAISED|FRAME_THICK) |
frm_watches = FXVerticalFrame.new(tb,FRAME_RIDGE|FRAME_THICK) |
393 |
|
frm_watches.padLeft = 0; frm_watches.padRight = 0 |
394 |
|
frm_watches.padTop = 0; frm_watches.padBottom = 0 |
395 |
|
frm_listw = FXHorizontalFrame.new(frm_watches, LAYOUT_FILL_X|LAYOUT_FILL_Y) |
396 |
|
@watch_list = FXList.new(frm_listw,1, nil, 0, |
397 |
|
LIST_SINGLESELECT|LAYOUT_FILL_X|LAYOUT_FILL_Y) |
398 |
|
delw_button = FXButton.new(frm_listw,"Delete",nil,self, |
399 |
|
FRAME_RAISED|FRAME_THICK|LAYOUT_SIDE_LEFT|LAYOUT_CENTER_Y) |
400 |
|
delw_button.connect(SEL_COMMAND, method(:onCmdDeleteWatchPoint)) |
401 |
|
|
402 |
|
frm_addw = FXHorizontalFrame.new(frm_watches, LAYOUT_FILL_X) |
403 |
|
frm_addw.padLeft = 0; frm_addw.padRight = 0 |
404 |
|
frm_addw.padTop = 0; frm_addw.padBottom = 0 |
405 |
|
|
406 |
|
FXLabel.new(frm_addw, "Watch:", nil, JUSTIFY_LEFT|LAYOUT_CENTER_Y) |
407 |
|
@watch_tf = FXTextField.new(frm_addw, 2, nil, 0, (FRAME_SUNKEN| |
408 |
|
LAYOUT_FILL_X|LAYOUT_CENTER_Y|LAYOUT_FILL_COLUMN)) |
409 |
|
@watch_tf.connect(SEL_COMMAND, method(:onCmdAddWatchPoint)) |
410 |
|
addw_button = FXButton.new(frm_addw," Add ",nil,self, |
411 |
|
FRAME_RAISED|FRAME_THICK|LAYOUT_SIDE_LEFT|LAYOUT_CENTER_Y) |
412 |
|
addw_button.connect(SEL_COMMAND, method(:onCmdAddWatchPoint)) |
413 |
|
|
414 |
# create the global variables display tab |
# create the global variables display tab |
415 |
tab_globals = FXTabItem.new(tb,"Globals",nil) |
tab_globals = FXTabItem.new(tb,"Globals",nil) |
416 |
frm_globals = FXHorizontalFrame.new(tb,FRAME_RAISED|FRAME_THICK) |
frm_globals = FXHorizontalFrame.new(tb,FRAME_RAISED|FRAME_THICK) |
417 |
@tbox_gvar = FXText.new(frm_globals, self, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y) |
frm_globals.padLeft = 0; frm_globals.padRight = 0 |
418 |
|
frm_globals.padTop = 0; frm_globals.padBottom = 0 |
419 |
|
|
420 |
|
@table_gvar = FXTable.new(frm_globals, 20, 2, nil, 0, |
421 |
|
TABLE_COL_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y) |
422 |
|
#@tbox_gvar = FXText.new(frm_globals, self, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y) |
423 |
tb.create |
tb.create |
424 |
end |
end |
425 |
|
|
438 |
# Update the global var list (text box) |
# Update the global var list (text box) |
439 |
# |
# |
440 |
def update_global_var_list(gv_ary) |
def update_global_var_list(gv_ary) |
441 |
@tbox_gvar.text='' |
i=0 |
442 |
|
@table_gvar.setTableSize(gv_ary.size,2) |
443 |
gv_ary.keys.sort.each { |v| |
gv_ary.keys.sort.each { |v| |
444 |
@tbox_gvar.appendText("#{v} => #{gv_ary[v]}\n") |
@table_gvar.setItemText( i, 0, "#{v}") |
445 |
|
@table_gvar.setItemText( i, 1, "#{gv_ary[v]}") |
446 |
|
@table_gvar.getItem( i, 1).justify = 0x00004000 #left |
447 |
|
i += 1 |
448 |
} |
} |
449 |
|
@table_gvar.setColumnWidth(1,@table_gvar.width - @table_gvar.getColumnWidth(0)) |
450 |
end |
end |
451 |
|
|
452 |
## |
## |
479 |
@cbox_frame.setCurrentItem(f[0]-1) if f[4] |
@cbox_frame.setCurrentItem(f[0]-1) if f[4] |
480 |
end |
end |
481 |
end |
end |
482 |
|
|
483 |
|
## |
484 |
|
# Send a list of all watch point currently listed in the GUI |
485 |
|
# |
486 |
|
def list_watchpoints |
487 |
|
(0..@watch_list.getNumItems-1).collect { |i| @watch_list.getItemText(i) } |
488 |
|
end |
489 |
|
|
490 |
|
## |
491 |
|
# |
492 |
## |
## |
493 |
# The debugging session has just been started. Change |
# The debugging session has just been started. Change |
494 |
# the UI accordingly |
# the UI accordingly |
657 |
@console.appendStyledText(text, 1) |
@console.appendStyledText(text, 1) |
658 |
@console.bottomLine = @console.length |
@console.bottomLine = @console.length |
659 |
end |
end |
660 |
|
|
661 |
|
## |
662 |
|
# print debuggee stderr to text console |
663 |
|
# |
664 |
|
def print_eval(text) |
665 |
|
@console.appendStyledText(text, 4) |
666 |
|
@console.bottomLine = @console.length |
667 |
|
end |
668 |
|
|
669 |
## |
## |
670 |
# Return the FOX FXApp global variable |
# Return the FOX FXApp global variable |
856 |
end |
end |
857 |
|
|
858 |
def onCmdEvalExpr(sender, sel, ptr) |
def onCmdEvalExpr(sender, sel, ptr) |
859 |
# Get the expression from the text field |
# Get the expression from the text field and show the |
860 |
|
# output result |
861 |
expr = sender.text |
expr = sender.text |
862 |
val = @slot.manager.eval_expr(expr) if @slot.manager |
string_val = @slot.manager.eval_expr(expr) if @slot.manager |
863 |
print_stdout(val+"\n") |
print_eval("\neval> #{expr}\n#{string_val}\n") |
864 |
|
sender.setText('') |
865 |
|
return 1 |
866 |
|
end |
867 |
|
|
868 |
|
def onCmdAddWatchPoint(sender, sel, ptr) |
869 |
|
# Get the watch point expression from the text field |
870 |
|
expr = @watch_tf.text |
871 |
|
item = FXListItem.new(expr) |
872 |
|
@watch_list.appendItem(item) |
873 |
|
gui_idx = @watch_list.getNumItems-1 |
874 |
|
@slot.manager.add_watchpoint(expr,gui_idx) if @slot.manager |
875 |
|
#item.setData(idx) |
876 |
|
@watch_tf.setText('') |
877 |
|
return 1 |
878 |
|
end |
879 |
|
|
880 |
|
def onCmdDeleteWatchPoint(sender, sel, ptr) |
881 |
|
# Delete the selected watch point |
882 |
|
current = @watch_list.getCurrentItem |
883 |
|
return if current.nil? |
884 |
|
expr = @watch_list.getItemText(current) |
885 |
|
done = @slot.manager.delete_watchpoint(expr,current) if @slot.manager |
886 |
|
@watch_list.removeItem(current) |
887 |
return 1 |
return 1 |
888 |
end |
end |
889 |
|
|