/[eiffelstudio]/branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/commands/eb_pretty_print_cmd.e
ViewVC logotype

Contents of /branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/commands/eb_pretty_print_cmd.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 48524 - (show annotations)
Wed Feb 16 14:09:09 2005 UTC (14 years, 11 months ago) by jfiat
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/commands/eb_pretty_print_cmd.e
File size: 3497 byte(s)
there is no need to attach the Pretty command (Expanded display) to the Object tool

1 indexing
2 description: "Command that allows the user to have a nicer display for his object value %
3 %especially strings."
4 author: "Xavier Rousselot"
5 date: "$Date$"
6 revision: "$Revision$"
7
8 class
9 EB_PRETTY_PRINT_CMD
10
11 inherit
12 EB_TOOLBARABLE_AND_MENUABLE_COMMAND
13 redefine
14 mini_pixmap,
15 new_mini_toolbar_item
16 end
17
18 EB_CONSTANTS
19
20 EB_SHARED_DEBUG_TOOLS
21
22 create
23 make
24
25 feature {NONE} -- Initialization
26
27 make is
28 -- Initialize `Current' and associate it with `a_tool'.
29 do
30 create opened_dialogs.make (5)
31 end
32
33 feature -- Access
34
35 mini_pixmap: ARRAY [EV_PIXMAP] is
36 -- 8*8 pixmaps representing `Current'.
37 do
38 Result := Pixmaps.Icon_pretty_print_vsmall
39 end
40
41 tooltip: STRING is
42 -- Tooltip for Current.
43 do
44 Result := Interface_names.e_Pretty_print
45 end
46
47 description: STRING is
48 -- Tooltip for Current.
49 do
50 Result := Interface_names.e_Pretty_print
51 end
52
53 name: STRING is
54 -- Tooltip for Current.
55 do
56 Result := "Pretty_print"
57 end
58
59 pixmap: ARRAY [EV_PIXMAP] is
60 -- No big pixmap is necessary.
61 do
62
63 end
64
65 menu_name: STRING is
66 -- Menu name for `Current'.
67 do
68 Result := Interface_names.m_Pretty_print
69 end
70
71 new_mini_toolbar_item: EB_COMMAND_TOOL_BAR_BUTTON is
72 -- Create a new mini toolbar button for this command.
73 do
74 Result := Precursor
75 Result.drop_actions.extend (agent on_stone_dropped)
76 Result.drop_actions.set_veto_pebble_function (agent accepts_stone)
77 end
78
79 feature -- Status report
80
81 associated_window: EV_WINDOW is
82 -- Window to which the child dialogs will be modeless to.
83 do
84 Result := debugger_manager.debugging_window.window
85 end
86
87 feature {EB_PRETTY_PRINT_DIALOG} -- Status report
88
89 accepts_stone (st: OBJECT_STONE): BOOLEAN is
90 -- Can the user drop `st'?
91 do
92 Result := (create {DUMP_VALUE}.make_object (st.object_address, st.dynamic_class)).
93 has_formatted_output
94 end
95
96 feature -- Basic operations
97
98 execute is
99 -- Launch `Current' as a command.
100 -- Pop up a new empty dialog.
101 do
102 pop_up_new_dialog
103 end
104
105 refresh is
106 -- Update the state of all dialogs.
107 do
108 from
109 opened_dialogs.start
110 until
111 opened_dialogs.after
112 loop
113 opened_dialogs.item.refresh
114 opened_dialogs.forth
115 end
116 end
117
118 end_debug is
119 -- A debug session ended. We free the resources.
120 do
121 from
122 until
123 opened_dialogs.is_empty
124 loop
125 opened_dialogs.start
126 opened_dialogs.item.destroy
127 end
128 end
129
130 feature {EB_PRETTY_PRINT_DIALOG} -- Dialog
131
132 remove_dialog (d: EB_PRETTY_PRINT_DIALOG) is
133 -- Remove `d' from the list of displayed dialogs.
134 require
135 is_now_destroyed: d.is_destroyed
136 do
137 opened_dialogs.start
138 opened_dialogs.prune_all (d)
139 ensure
140 is_no_longer_known: not opened_dialogs.has (d)
141 end
142
143 feature {NONE} -- Implementation
144
145 on_stone_dropped (st: OBJECT_STONE) is
146 -- An object was dropped on the button, display it.
147 do
148 pop_up_new_dialog
149 last_opened_dialog.set_stone (st)
150 end
151
152 opened_dialogs: ARRAYED_LIST [EB_PRETTY_PRINT_DIALOG]
153 -- All pretty print dialogs that are appear on the screen (linked to `Current').
154
155 pop_up_new_dialog is
156 -- Create and display a new pretty print dialog.
157 local
158 nd: EB_PRETTY_PRINT_DIALOG
159 do
160 create nd.make (Current)
161 opened_dialogs.extend (nd)
162 last_opened_dialog := nd
163 nd.raise
164 ensure
165 added_a_dialog: opened_dialogs.count = (old opened_dialogs.count) + 1
166 end
167
168 last_opened_dialog: EB_PRETTY_PRINT_DIALOG
169 -- The last dialog that `Current' opened.
170
171 end -- class EB_PRETTY_PRINT_CMD

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23