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

Contents of /branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/commands/eb_center_diagram_command.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: 5168 byte(s)
First commit docking tabbed Eiffel Studio.
1 indexing
2 description: "Command to center the diagram on a stone"
3 legal: "See notice at end of class."
4 status: "See notice at end of class."
5 author: "Etienne Amodeo"
6 date: "$Date$"
7 revision: "$Revision$"
8
9 class
10 EB_CENTER_DIAGRAM_COMMAND
11
12 inherit
13 EB_CONTEXT_DIAGRAM_COMMAND
14 redefine
15 new_toolbar_item
16 end
17
18 create
19 make
20
21 feature -- Basic operations
22
23 execute is
24 -- Display information about `Current'.
25 local
26 cla_s: CLASSI_STONE
27 clu_s: CLUSTER_STONE
28 clu: CONF_GROUP
29 warned: BOOLEAN
30 do
31 if tool.class_view /= Void then
32 cla_s := tool.class_stone
33 if cla_s /= Void and then cla_s.is_valid then
34 clu := cla_s.class_i.group
35 end
36 elseif tool.cluster_view /= Void then
37 clu_s := tool.cluster_stone
38 if clu_s /= Void and then clu_s.is_valid then
39 clu := clu_s.group --.parent_cluster
40 end
41 else
42 create explain_dialog.make_with_text (Interface_names.e_Diagram_hole)
43 explain_dialog.show_modal_to_window (tool.develop_window.window)
44 warned := True
45 end
46 if clu /= Void and then not warned then
47 create explain_dialog.make_with_text (Warning_messages.W_does_not_have_enclosing_cluster)
48 explain_dialog.show_modal_to_window (tool.develop_window.window)
49 end
50 end
51
52 execute_with_class_stone (a_stone: CLASSI_STONE) is
53 -- Create a development window and process `a_stone'.
54 do
55 if a_stone.is_valid then
56 was_dropped := True
57 tool.set_is_rebuild_world_needed (True)
58 tool.launch_stone (a_stone)
59 end
60 end
61
62 execute_with_cluster_stone (a_stone: CLUSTER_STONE) is
63 -- Create a development window and process `a_stone'.
64 do
65 if a_stone.is_valid then
66 was_dropped := True
67 tool.set_is_rebuild_world_needed (True)
68 tool.launch_stone (a_stone)
69 end
70 end
71
72 new_toolbar_item (display_text: BOOLEAN): EB_COMMAND_TOOL_BAR_BUTTON is
73 -- Create a new toolbar button for this command.
74 do
75 Result := Precursor (display_text)
76 Result.drop_actions.extend (agent execute_with_class_stone)
77 Result.drop_actions.extend (agent execute_with_cluster_stone)
78 Result.drop_actions.set_veto_pebble_function (agent veto_pebble_fucntion)
79 Result.set_pebble_function (agent pebble)
80 end
81
82 feature {NONE} -- Implementation
83
84 pebble (x, y: INTEGER): STONE is
85 -- pebble corresponding to class or cluster currently
86 -- displayed in the context tool.
87 local
88 class_stone: CLASSI_STONE
89 cluster_stone: CLUSTER_STONE
90 tbi: EB_COMMAND_TOOL_BAR_BUTTON
91 do
92 if not was_dropped then
93 Result := tool.develop_window.tools.stone
94 tbi := managed_toolbar_items.first
95 class_stone ?= Result
96 cluster_stone ?= Result
97 if class_stone /= Void then
98 tbi.set_accept_cursor (cursors.Cur_class)
99 elseif cluster_stone /= Void then
100 tbi.set_accept_cursor (cursors.Cur_cluster)
101 end
102 else
103 was_dropped := False
104 end
105 end
106
107 veto_pebble_fucntion (a_any: ANY): BOOLEAN is
108 -- Veto function
109 local
110 cluster_stone: CLUSTER_STONE
111 class_stone: CLASSI_STONE
112 do
113 cluster_stone ?= a_any
114 if cluster_stone /= Void then
115 Result := not cluster_stone.group.is_assembly
116 else
117 class_stone ?= a_any
118 Result := class_stone /= Void
119 end
120 end
121
122 was_dropped: BOOLEAN
123
124 pixmap: EV_PIXMAP is
125 -- Pixmap representing the command.
126 do
127 Result := pixmaps.icon_pixmaps.diagram_target_cluster_or_class_icon
128 end
129
130 pixel_buffer: EV_PIXEL_BUFFER is
131 -- Pixel buffer representing the command.
132 do
133 -- Currently there is no pixel buffer for this command.
134 end
135
136 tooltip: STRING is
137 -- Tooltip for the toolbar button.
138 do
139 Result := Interface_names.F_retarget_diagram
140 end
141
142 name: STRING is "Center_diagram"
143 -- Name of the command. Used to store the command in the
144 -- preferences.
145
146 explain_dialog: EB_INFORMATION_DIALOG;
147 -- Dialog explaining how to use `Current'.
148
149 indexing
150 copyright: "Copyright (c) 1984-2006, Eiffel Software"
151 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
152 licensing_options: "http://www.eiffel.com/licensing"
153 copying: "[
154 This file is part of Eiffel Software's Eiffel Development Environment.
155
156 Eiffel Software's Eiffel Development Environment is free
157 software; you can redistribute it and/or modify it under
158 the terms of the GNU General Public License as published
159 by the Free Software Foundation, version 2 of the License
160 (available at the URL listed under "license" above).
161
162 Eiffel Software's Eiffel Development Environment is
163 distributed in the hope that it will be useful, but
164 WITHOUT ANY WARRANTY; without even the implied warranty
165 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
166 See the GNU General Public License for more details.
167
168 You should have received a copy of the GNU General Public
169 License along with Eiffel Software's Eiffel Development
170 Environment; if not, write to the Free Software Foundation,
171 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
172 ]"
173 source: "[
174 Eiffel Software
175 356 Storke Road, Goleta, CA 93117 USA
176 Telephone 805-685-1006, Fax 805-685-6869
177 Website http://www.eiffel.com
178 Customer support http://support.eiffel.com
179 ]"
180
181 end -- class EB_CENTER_DIAGRAM_COMMAND

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23