/[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 51524 - (hide annotations)
Tue May 31 17:04:31 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: 3512 byte(s)
cosmetic

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 51524 create dv.make_object (st.object_address, st.dynamic_class)
95     Result := dv.has_formatted_output
96 manus 32944 end
97 manus 26913
98     feature -- Basic operations
99    
100     execute is
101     -- Launch `Current' as a command.
102     -- Pop up a new empty dialog.
103     do
104     pop_up_new_dialog
105     end
106    
107     refresh is
108     -- Update the state of all dialogs.
109     do
110     from
111     opened_dialogs.start
112     until
113     opened_dialogs.after
114     loop
115     opened_dialogs.item.refresh
116     opened_dialogs.forth
117     end
118     end
119    
120     end_debug is
121     -- A debug session ended. We free the resources.
122     do
123     from
124     until
125 manus 32276 opened_dialogs.is_empty
126 manus 26913 loop
127 manus 32276 opened_dialogs.start
128 manus 26913 opened_dialogs.item.destroy
129     end
130     end
131    
132     feature {EB_PRETTY_PRINT_DIALOG} -- Dialog
133    
134     remove_dialog (d: EB_PRETTY_PRINT_DIALOG) is
135     -- Remove `d' from the list of displayed dialogs.
136     require
137     is_now_destroyed: d.is_destroyed
138     do
139     opened_dialogs.start
140     opened_dialogs.prune_all (d)
141     ensure
142     is_no_longer_known: not opened_dialogs.has (d)
143     end
144    
145     feature {NONE} -- Implementation
146    
147     on_stone_dropped (st: OBJECT_STONE) is
148     -- An object was dropped on the button, display it.
149     do
150     pop_up_new_dialog
151     last_opened_dialog.set_stone (st)
152     end
153    
154     opened_dialogs: ARRAYED_LIST [EB_PRETTY_PRINT_DIALOG]
155     -- All pretty print dialogs that are appear on the screen (linked to `Current').
156    
157     pop_up_new_dialog is
158     -- Create and display a new pretty print dialog.
159     local
160     nd: EB_PRETTY_PRINT_DIALOG
161     do
162     create nd.make (Current)
163     opened_dialogs.extend (nd)
164     last_opened_dialog := nd
165     nd.raise
166     ensure
167     added_a_dialog: opened_dialogs.count = (old opened_dialogs.count) + 1
168     end
169    
170     last_opened_dialog: EB_PRETTY_PRINT_DIALOG
171     -- The last dialog that `Current' opened.
172    
173     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