/[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 62018 - (hide annotations)
Sun Jul 30 06:14:56 2006 UTC (13 years, 6 months ago) by manus
File size: 5128 byte(s)
EiffelStudio docking branch. It only contains modified classes needed to get the docking version of EiffelStudio.
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     explain_dialog.show_modal_to_window (tool.development_window.window)
44     warned := True
45     end
46     if clu /= Void then
47     create clu_s.make (clu)
48     if clu_s.is_valid then
49     tool.tool.set_stone (clu_s)
50     end
51     elseif not warned then
52     create explain_dialog.make_with_text (Warning_messages.W_does_not_have_enclosing_cluster)
53     explain_dialog.show_modal_to_window (tool.development_window.window)
54     end
55 manus 26913 end
56    
57 xavier 27828 execute_with_class_stone (a_stone: CLASSI_STONE) is
58 manus 26913 -- Create a development window and process `a_stone'.
59     do
60 tedf 61577 if a_stone.is_valid then
61     was_dropped := True
62     tool.set_is_rebuild_world_needed (True)
63     tool.tool.launch_stone (a_stone)
64     end
65 manus 26913 end
66    
67 xavier 27828 execute_with_cluster_stone (a_stone: CLUSTER_STONE) is
68     -- Create a development window and process `a_stone'.
69     do
70 tedf 61577 if a_stone.is_valid then
71     was_dropped := True
72     tool.set_is_rebuild_world_needed (True)
73     tool.tool.launch_stone (a_stone)
74     end
75 xavier 27828 end
76    
77 king 56753 new_toolbar_item (display_text: BOOLEAN): EB_COMMAND_TOOL_BAR_BUTTON is
78 manus 26913 -- Create a new toolbar button for this command.
79     do
80 king 56753 Result := Precursor (display_text)
81 xavier 27828 Result.drop_actions.extend (agent execute_with_class_stone)
82     Result.drop_actions.extend (agent execute_with_cluster_stone)
83 tedf 60011 Result.drop_actions.set_veto_pebble_function (agent veto_pebble_fucntion)
84 etienne 27342 Result.set_pebble_function (agent pebble)
85 manus 26913 end
86    
87     feature {NONE} -- Implementation
88    
89 etienne 27342 pebble (x, y: INTEGER): STONE is
90     -- pebble corresponding to class or cluster currently
91     -- displayed in the context tool.
92     local
93     class_stone: CLASSI_STONE
94     cluster_stone: CLUSTER_STONE
95     tbi: EB_COMMAND_TOOL_BAR_BUTTON
96     do
97 bennob 47280 if not was_dropped then
98     Result := tool.tool.stone
99     tbi := managed_toolbar_items.first
100     class_stone ?= Result
101     cluster_stone ?= Result
102     if class_stone /= Void then
103     tbi.set_accept_cursor (cursors.Cur_class)
104     elseif cluster_stone /= Void then
105     tbi.set_accept_cursor (cursors.Cur_cluster)
106     end
107     else
108     was_dropped := False
109 etienne 27342 end
110     end
111 king 56753
112 tedf 60011 veto_pebble_fucntion (a_any: ANY): BOOLEAN is
113     -- Veto function
114     local
115     cluster_stone: CLUSTER_STONE
116     class_stone: CLASSI_STONE
117     do
118     cluster_stone ?= a_any
119     if cluster_stone /= Void then
120     Result := not cluster_stone.group.is_assembly
121     else
122     class_stone ?= a_any
123     Result := class_stone /= Void
124     end
125     end
126    
127 bennob 47280 was_dropped: BOOLEAN
128 etienne 27342
129 king 56753 pixmap: EV_PIXMAP is
130     -- Pixmap representing the command.
131 manus 26913 do
132 paulb 60267 Result := pixmaps.icon_pixmaps.diagram_target_cluster_or_class_icon
133 manus 26913 end
134    
135     tooltip: STRING is
136     -- Tooltip for the toolbar button.
137     do
138     Result := Interface_names.F_retarget_diagram
139     end
140    
141     name: STRING is "Center_diagram"
142     -- Name of the command. Used to store the command in the
143     -- preferences.
144    
145 manus 56535 explain_dialog: EB_INFORMATION_DIALOG;
146 manus 26913 -- Dialog explaining how to use `Current'.
147 king 56753
148 manus 56535 indexing
149     copyright: "Copyright (c) 1984-2006, Eiffel Software"
150 manus 58027 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
151 manus 56535 licensing_options: "http://www.eiffel.com/licensing"
152     copying: "[
153     This file is part of Eiffel Software's Eiffel Development Environment.
154    
155     Eiffel Software's Eiffel Development Environment is free
156     software; you can redistribute it and/or modify it under
157     the terms of the GNU General Public License as published
158     by the Free Software Foundation, version 2 of the License
159     (available at the URL listed under "license" above).
160    
161     Eiffel Software's Eiffel Development Environment is
162     distributed in the hope that it will be useful, but
163     WITHOUT ANY WARRANTY; without even the implied warranty
164     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
165     See the GNU General Public License for more details.
166    
167     You should have received a copy of the GNU General Public
168     License along with Eiffel Software's Eiffel Development
169     Environment; if not, write to the Free Software Foundation,
170     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
171     ]"
172     source: "[
173     Eiffel Software
174     356 Storke Road, Goleta, CA 93117 USA
175     Telephone 805-685-1006, Fax 805-685-6869
176     Website http://www.eiffel.com
177     Customer support http://support.eiffel.com
178     ]"
179    
180 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