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

Annotation 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 32276 - (hide annotations)
Thu May 30 03:55:45 2002 UTC (17 years, 7 months ago) by manus
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/commands/eb_pretty_print_cmd.e
File size: 3866 byte(s)
Fixed `end_debug' due to new implementation of `destroy' in EB_PRETTY_PRINT_DIALOG
so that all opened dialogs are closed at the end of the execution.

1 manus 26913 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 xavier 29952 Result.drop_actions.set_veto_pebble_function (~accepts_stone)
76 manus 26913 end
77    
78     feature -- Measurement
79    
80     feature -- Status report
81    
82     associated_window: EV_WINDOW is
83     -- Window to which the child dialogs will be modeless to.
84     do
85     Result := tool.debugger_manager.debugging_window.window
86     end
87    
88     feature -- Status setting
89    
90     feature -- Cursor movement
91    
92     feature -- Element change
93    
94     feature -- Removal
95    
96     feature -- Resizing
97    
98     feature -- Transformation
99    
100     feature -- Conversion
101    
102     feature -- Duplication
103    
104     feature -- Miscellaneous
105    
106     feature -- Basic operations
107    
108     execute is
109     -- Launch `Current' as a command.
110     -- Pop up a new empty dialog.
111     do
112     pop_up_new_dialog
113     end
114    
115     refresh is
116     -- Update the state of all dialogs.
117     do
118     from
119     opened_dialogs.start
120     until
121     opened_dialogs.after
122     loop
123     opened_dialogs.item.refresh
124     opened_dialogs.forth
125     end
126     end
127    
128     end_debug is
129     -- A debug session ended. We free the resources.
130     do
131     from
132     until
133 manus 32276 opened_dialogs.is_empty
134 manus 26913 loop
135 manus 32276 opened_dialogs.start
136 manus 26913 opened_dialogs.item.destroy
137     end
138     end
139    
140     feature -- Obsolete
141    
142     feature -- Inapplicable
143    
144     feature {EB_PRETTY_PRINT_DIALOG} -- Dialog
145    
146     remove_dialog (d: EB_PRETTY_PRINT_DIALOG) is
147     -- Remove `d' from the list of displayed dialogs.
148     require
149     is_now_destroyed: d.is_destroyed
150     do
151     opened_dialogs.start
152     opened_dialogs.prune_all (d)
153     ensure
154     is_no_longer_known: not opened_dialogs.has (d)
155     end
156    
157     feature {EB_PRETTY_PRINT_DIALOG} -- Implementation
158    
159     tool: EB_OBJECT_TOOL
160     -- Object tool `Current' is linked with.
161    
162     feature {NONE} -- Implementation
163    
164     on_stone_dropped (st: OBJECT_STONE) is
165     -- An object was dropped on the button, display it.
166     do
167     pop_up_new_dialog
168     last_opened_dialog.set_stone (st)
169     end
170    
171 xavier 29952 accepts_stone (st: OBJECT_STONE): BOOLEAN is
172     -- Can the user drop `st'?
173     do
174     Result := (create {DUMP_VALUE}.make_object (st.object_address, st.dynamic_class)).has_formatted_output
175     end
176    
177 manus 26913 opened_dialogs: ARRAYED_LIST [EB_PRETTY_PRINT_DIALOG]
178     -- All pretty print dialogs that are appear on the screen (linked to `Current').
179    
180     pop_up_new_dialog is
181     -- Create and display a new pretty print dialog.
182     local
183     nd: EB_PRETTY_PRINT_DIALOG
184     do
185     create nd.make (Current)
186     opened_dialogs.extend (nd)
187     last_opened_dialog := nd
188     nd.raise
189     ensure
190     added_a_dialog: opened_dialogs.count = (old opened_dialogs.count) + 1
191     end
192    
193     last_opened_dialog: EB_PRETTY_PRINT_DIALOG
194     -- The last dialog that `Current' opened.
195    
196     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