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

Annotation 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 - (hide annotations)
Tue Aug 1 01:27:17 2006 UTC (13 years, 5 months ago) by larryl
File size: 5168 byte(s)
First commit docking tabbed Eiffel Studio.
1 manus 26913 indexing
2     description: "Command to center the diagram on a stone"
3 manus 56535 legal: "See notice at end of class."
4     status: "See notice at end of class."
5 manus 26913 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 king 56753
18 manus 26913 create
19     make
20    
21     feature -- Basic operations
22    
23     execute is
24     -- Display information about `Current'.
25 etienne 27342 local
26     cla_s: CLASSI_STONE
27     clu_s: CLUSTER_STONE
28 tedf 58518 clu: CONF_GROUP
29 etienne 27342 warned: BOOLEAN
30 manus 26913 do
31 etienne 27342 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 tedf 58518 clu := cla_s.class_i.group
35 etienne 27342 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 tedf 58518 clu := clu_s.group --.parent_cluster
40 etienne 27342 end
41     else
42     create explain_dialog.make_with_text (Interface_names.e_Diagram_hole)
43 larryl 62171 explain_dialog.show_modal_to_window (tool.develop_window.window)
44 etienne 27342 warned := True
45     end
46 larryl 62171 if clu /= Void and then not warned then
47 etienne 27342 create explain_dialog.make_with_text (Warning_messages.W_does_not_have_enclosing_cluster)
48 larryl 62171 explain_dialog.show_modal_to_window (tool.develop_window.window)
49 etienne 27342 end
50 manus 26913 end
51    
52 xavier 27828 execute_with_class_stone (a_stone: CLASSI_STONE) is
53 manus 26913 -- Create a development window and process `a_stone'.
54     do
55 tedf 61577 if a_stone.is_valid then
56 larryl 62171 was_dropped := True
57     tool.set_is_rebuild_world_needed (True)
58     tool.launch_stone (a_stone)
59 tedf 61577 end
60 manus 26913 end
61    
62 xavier 27828 execute_with_cluster_stone (a_stone: CLUSTER_STONE) is
63     -- Create a development window and process `a_stone'.
64     do
65 tedf 61577 if a_stone.is_valid then
66 larryl 62171 was_dropped := True
67     tool.set_is_rebuild_world_needed (True)
68     tool.launch_stone (a_stone)
69 tedf 61577 end
70 xavier 27828 end
71    
72 king 56753 new_toolbar_item (display_text: BOOLEAN): EB_COMMAND_TOOL_BAR_BUTTON is
73 manus 26913 -- Create a new toolbar button for this command.
74     do
75 king 56753 Result := Precursor (display_text)
76 xavier 27828 Result.drop_actions.extend (agent execute_with_class_stone)
77     Result.drop_actions.extend (agent execute_with_cluster_stone)
78 tedf 60011 Result.drop_actions.set_veto_pebble_function (agent veto_pebble_fucntion)
79 etienne 27342 Result.set_pebble_function (agent pebble)
80 manus 26913 end
81    
82     feature {NONE} -- Implementation
83    
84 etienne 27342 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 bennob 47280 if not was_dropped then
93 larryl 62171 Result := tool.develop_window.tools.stone
94 bennob 47280 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 etienne 27342 end
105     end
106 king 56753
107 tedf 60011 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 bennob 47280 was_dropped: BOOLEAN
123 etienne 27342
124 king 56753 pixmap: EV_PIXMAP is
125     -- Pixmap representing the command.
126 manus 26913 do
127 paulb 60267 Result := pixmaps.icon_pixmaps.diagram_target_cluster_or_class_icon
128 manus 26913 end
129    
130 larryl 62171 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 manus 26913 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 manus 56535 explain_dialog: EB_INFORMATION_DIALOG;
147 manus 26913 -- Dialog explaining how to use `Current'.
148 king 56753
149 manus 56535 indexing
150     copyright: "Copyright (c) 1984-2006, Eiffel Software"
151 manus 58027 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
152 manus 56535 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 manus 26913 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