/[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 29952 - (hide annotations)
Thu Dec 27 23:35:40 2001 UTC (18 years, 1 month ago) by xavier
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/commands/eb_pretty_print_cmd.e
File size: 3940 byte(s)
Only allow to drop object stones that have a string representation.

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     opened_dialogs.start
133     until
134     opened_dialogs.after
135     loop
136     --| No need to call `forth', `destroy' removes the items automatically.
137     opened_dialogs.item.destroy
138     end
139     end
140    
141     feature -- Obsolete
142    
143     feature -- Inapplicable
144    
145     feature {EB_PRETTY_PRINT_DIALOG} -- Dialog
146    
147     remove_dialog (d: EB_PRETTY_PRINT_DIALOG) is
148     -- Remove `d' from the list of displayed dialogs.
149     require
150     is_now_destroyed: d.is_destroyed
151     do
152     opened_dialogs.start
153     opened_dialogs.prune_all (d)
154     ensure
155     is_no_longer_known: not opened_dialogs.has (d)
156     end
157    
158     feature {EB_PRETTY_PRINT_DIALOG} -- Implementation
159    
160     tool: EB_OBJECT_TOOL
161     -- Object tool `Current' is linked with.
162    
163     feature {NONE} -- Implementation
164    
165     on_stone_dropped (st: OBJECT_STONE) is
166     -- An object was dropped on the button, display it.
167     do
168     pop_up_new_dialog
169     last_opened_dialog.set_stone (st)
170     end
171    
172 xavier 29952 accepts_stone (st: OBJECT_STONE): BOOLEAN is
173     -- Can the user drop `st'?
174     do
175     Result := (create {DUMP_VALUE}.make_object (st.object_address, st.dynamic_class)).has_formatted_output
176     end
177    
178 manus 26913 opened_dialogs: ARRAYED_LIST [EB_PRETTY_PRINT_DIALOG]
179     -- All pretty print dialogs that are appear on the screen (linked to `Current').
180    
181     pop_up_new_dialog is
182     -- Create and display a new pretty print dialog.
183     local
184     nd: EB_PRETTY_PRINT_DIALOG
185     do
186     create nd.make (Current)
187     opened_dialogs.extend (nd)
188     last_opened_dialog := nd
189     nd.raise
190     ensure
191     added_a_dialog: opened_dialogs.count = (old opened_dialogs.count) + 1
192     end
193    
194     last_opened_dialog: EB_PRETTY_PRINT_DIALOG
195     -- The last dialog that `Current' opened.
196    
197     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