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

Contents of /branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/commands/eb_error_information_cmd.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62171 - (show annotations)
Tue Aug 1 01:27:17 2006 UTC (13 years, 4 months ago) by larryl
File size: 6313 byte(s)
First commit docking tabbed Eiffel Studio.
1 indexing
2 description: "Dialog used to display extended help concerning a compilation error."
3 legal: "See notice at end of class."
4 status: "See notice at end of class."
5 author: "Xavier Rousselot"
6 date: "$Date$"
7 revision: "$Revision$"
8
9 class
10 EB_ERROR_INFORMATION_CMD
11
12 inherit
13 EB_TOOLBARABLE_AND_MENUABLE_COMMAND
14 redefine
15 new_toolbar_item,
16 tooltext
17 end
18
19 EB_SHARED_WINDOW_MANAGER
20
21 create
22 make
23
24 feature {NONE} -- Initialization
25
26 make is
27 -- Initialize `Current'.
28 do
29 end
30
31 feature -- Status setting
32
33 execute is
34 -- Launch `Current'.
35 -- Pop up an error wizard relative to the last focused development window.
36 do
37 execute_with_text (Interface_names.e_Drop_an_error_stone)
38 end
39
40 execute_with_stone (st: ERROR_STONE) is
41 -- Pop up a new dialog and display the help text of `st' inside it.
42 do
43 execute_with_text (st.help_text)
44 end
45
46 feature -- Status report
47
48 description: STRING is
49 -- Explanatory text for this command.
50 do
51 Result := Interface_names.e_Display_error_help
52 end
53
54 tooltip: STRING is
55 -- Tooltip for `Current's toolbar button.
56 do
57 Result := Interface_names.e_Display_error_help
58 end
59
60 tooltext: STRING is
61 -- Text for `Current's toolbar button.
62 do
63 Result := Interface_names.b_Display_error_help
64 end
65
66 name: STRING is "Open_help_tool"
67 -- Internal textual representation.
68
69 pixmap: EV_PIXMAP is
70 -- Image used for `Current's toolbar buttons.
71 do
72 Result := pixmaps.icon_pixmaps.command_error_info_icon
73 end
74
75 pixel_buffer: EV_PIXEL_BUFFER is
76 -- Pixel buffer representing the command.
77 do
78 Result := pixmaps.icon_pixmaps.command_error_info_icon_buffer
79 end
80
81 menu_name: STRING is
82 -- Text used for menu items for `Current'.
83 do
84 Result := Interface_names.m_Display_error_help
85 end
86
87 new_toolbar_item (display_text: BOOLEAN): EB_COMMAND_TOOL_BAR_BUTTON is
88 -- Create a new toolbar button for this command.
89 --
90 -- Call `recycle' on the result when you don't need it anymore otherwise
91 -- it will never be garbage collected.
92 do
93 Result := Precursor {EB_TOOLBARABLE_AND_MENUABLE_COMMAND} (display_text)
94 Result.drop_actions.extend (agent execute_with_stone)
95 end
96
97 feature {NONE} -- Implementation
98
99 current_dialog: EV_DIALOG
100 -- Dialog used to display the error explanations.
101
102 current_editor: SELECTABLE_TEXT_PANEL
103 -- Text in which the explanation texts are put.
104
105 execute_with_text (a_text: STRING) is
106 -- Pop up a new dialog and display `a_text' inside it.
107 do
108 create_new_dialog
109 current_editor.load_text (a_text)
110 current_editor.disable_line_numbers
111 current_dialog.show_relative_to_window (Window_manager.last_focused_development_window.window)
112 current_dialog := Void
113 end
114
115 create_new_dialog is
116 -- Fill `current_dialog' with a newly created dialog.
117 local
118 but: EV_BUTTON
119 vb: EV_VERTICAL_BOX
120 hb: EV_HORIZONTAL_BOX
121 scr: EV_SCREEN
122 fs: INTEGER
123 ft: EV_FONT
124 f: EV_FRAME
125 do
126 -- Build the layout.
127 create vb
128 vb.set_padding (Layout_constants.small_padding_size)
129 vb.set_border_width (Layout_constants.small_border_size)
130 create hb
131 create current_dialog
132 current_dialog.set_title (Interface_names.t_Extended_explanation)
133 current_dialog.set_icon_pixmap (pixmaps.icon_pixmaps.general_dialog_icon)
134
135 create but.make_with_text (Interface_names.b_Close)
136 Layout_constants.set_default_size_for_button (but)
137 create current_editor
138 current_editor.set_cursors (create {EB_EDITOR_CURSORS})
139 current_editor.set_reference_window (current_dialog)
140 current_editor.widget.set_minimum_size (150, 100)
141
142 create f
143 f.extend (current_editor.widget)
144 hb.extend (create {EV_CELL})
145 hb.extend (but)
146 hb.disable_item_expand (but)
147 hb.extend (create {EV_CELL})
148 vb.extend (f)
149 vb.extend (hb)
150 vb.disable_item_expand (hb)
151
152 current_dialog.extend (vb)
153
154 -- Set up the event handlers.
155 current_dialog.set_default_cancel_button (but)
156 but.select_actions.extend (agent current_dialog.destroy)
157 current_editor.drop_actions.extend (agent set_stone (current_editor, ?))
158 create scr
159 --| + 1 to make sure there is enough room.
160 ft := (create {SHARED_EDITOR_FONT}).font
161 fs := (ft.maximum_width + ft.width) // 2
162 --| 60 is the number of characters in the error texts,
163 --| 56 is the overhead brought by the editor (margins),
164 --| 20 is an approximation of the overhead due to the window border.
165 current_dialog.set_size (Layout_constants.dialog_unit_to_pixels (60 * fs + 56 + 20).min (scr.width),
166 Layout_constants.dialog_unit_to_pixels (300).min (scr.height))
167 ensure
168 valid_dialog: current_dialog /= Void and then not current_dialog.is_destroyed
169 valid_editor: current_editor /= Void
170 end
171
172 set_stone (editor: SELECTABLE_TEXT_PANEL; st: ERROR_STONE) is
173 -- Display the help text associated with `st' in `editor'.
174 require
175 valid_stone: st /= Void
176 valid_editor: editor /= Void
177 do
178 editor.load_text (st.help_text)
179 end
180
181 indexing
182 copyright: "Copyright (c) 1984-2006, Eiffel Software"
183 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
184 licensing_options: "http://www.eiffel.com/licensing"
185 copying: "[
186 This file is part of Eiffel Software's Eiffel Development Environment.
187
188 Eiffel Software's Eiffel Development Environment is free
189 software; you can redistribute it and/or modify it under
190 the terms of the GNU General Public License as published
191 by the Free Software Foundation, version 2 of the License
192 (available at the URL listed under "license" above).
193
194 Eiffel Software's Eiffel Development Environment is
195 distributed in the hope that it will be useful, but
196 WITHOUT ANY WARRANTY; without even the implied warranty
197 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
198 See the GNU General Public License for more details.
199
200 You should have received a copy of the GNU General Public
201 License along with Eiffel Software's Eiffel Development
202 Environment; if not, write to the Free Software Foundation,
203 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
204 ]"
205 source: "[
206 Eiffel Software
207 356 Storke Road, Goleta, CA 93117 USA
208 Telephone 805-685-1006, Fax 805-685-6869
209 Website http://www.eiffel.com
210 Customer support http://support.eiffel.com
211 ]"
212
213 end -- class EB_ERROR_INFORMATION_DIALOG

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23