/[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 32944 - (show annotations)
Fri Jul 12 06:20:09 2002 UTC (17 years, 6 months ago) by manus
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/commands/eb_pretty_print_cmd.e
File size: 3629 byte(s)
Cosmetics.
Exported `accepts_stone' for EB_PRETTY_PRINT_DIALOG for assertion and PND support.

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