/[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 52056 - (hide annotations)
Mon Jun 13 15:22:41 2005 UTC (14 years, 7 months ago) by jfiat
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/commands/eb_pretty_print_cmd.e
File size: 3651 byte(s)
added feature `set_stone (st)' to be able to open the dialog directly by providing the object stone
+ a Void object is not a valid stone for this command

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 jfiat 48524 EB_SHARED_DEBUG_TOOLS
21    
22 manus 26913 create
23     make
24    
25     feature {NONE} -- Initialization
26    
27 jfiat 48524 make is
28 manus 26913 -- 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 julieng 37681 Result.drop_actions.extend (agent on_stone_dropped)
76     Result.drop_actions.set_veto_pebble_function (agent accepts_stone)
77 manus 26913 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 jfiat 48524 Result := debugger_manager.debugging_window.window
85 manus 26913 end
86    
87 manus 32944 feature {EB_PRETTY_PRINT_DIALOG} -- Status report
88 manus 26913
89 manus 32944 accepts_stone (st: OBJECT_STONE): BOOLEAN is
90     -- Can the user drop `st'?
91 jfiat 51524 local
92     dv: DUMP_VALUE
93 manus 32944 do
94 jfiat 52056 if st /= Void then
95     create dv.make_object (st.object_address, st.dynamic_class)
96     Result := dv.has_formatted_output
97     end
98 manus 32944 end
99 manus 26913
100     feature -- Basic operations
101    
102 jfiat 52056 set_stone (st: OBJECT_STONE) is
103     do
104     if accepts_stone (st) then
105     on_stone_dropped (st)
106     end
107     end
108    
109 manus 26913 execute is
110     -- Launch `Current' as a command.
111     -- Pop up a new empty dialog.
112     do
113     pop_up_new_dialog
114     end
115    
116     refresh is
117     -- Update the state of all dialogs.
118     do
119     from
120     opened_dialogs.start
121     until
122     opened_dialogs.after
123     loop
124     opened_dialogs.item.refresh
125     opened_dialogs.forth
126     end
127     end
128    
129     end_debug is
130     -- A debug session ended. We free the resources.
131     do
132     from
133     until
134 manus 32276 opened_dialogs.is_empty
135 manus 26913 loop
136 manus 32276 opened_dialogs.start
137 manus 26913 opened_dialogs.item.destroy
138     end
139     end
140    
141     feature {EB_PRETTY_PRINT_DIALOG} -- Dialog
142    
143     remove_dialog (d: EB_PRETTY_PRINT_DIALOG) is
144     -- Remove `d' from the list of displayed dialogs.
145     require
146     is_now_destroyed: d.is_destroyed
147     do
148     opened_dialogs.start
149     opened_dialogs.prune_all (d)
150     ensure
151     is_no_longer_known: not opened_dialogs.has (d)
152     end
153    
154     feature {NONE} -- Implementation
155    
156     on_stone_dropped (st: OBJECT_STONE) is
157     -- An object was dropped on the button, display it.
158     do
159     pop_up_new_dialog
160     last_opened_dialog.set_stone (st)
161     end
162    
163     opened_dialogs: ARRAYED_LIST [EB_PRETTY_PRINT_DIALOG]
164     -- All pretty print dialogs that are appear on the screen (linked to `Current').
165    
166     pop_up_new_dialog is
167     -- Create and display a new pretty print dialog.
168     local
169     nd: EB_PRETTY_PRINT_DIALOG
170     do
171     create nd.make (Current)
172     opened_dialogs.extend (nd)
173     last_opened_dialog := nd
174     nd.raise
175     ensure
176     added_a_dialog: opened_dialogs.count = (old opened_dialogs.count) + 1
177     end
178    
179     last_opened_dialog: EB_PRETTY_PRINT_DIALOG
180     -- The last dialog that `Current' opened.
181    
182     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