1 |
indexing |
2 |
description: "Command to enlarge the diagram" |
3 |
legal: "See notice at end of class." |
4 |
status: "See notice at end of class." |
5 |
date: "$Date$" |
6 |
revision: "$Revision$" |
7 |
|
8 |
class |
9 |
EB_ZOOM_IN_COMMAND |
10 |
|
11 |
inherit |
12 |
EB_CONTEXT_DIAGRAM_COMMAND |
13 |
redefine |
14 |
initialize |
15 |
end |
16 |
|
17 |
create |
18 |
make |
19 |
|
20 |
feature {NONE} -- Initialization |
21 |
|
22 |
initialize is |
23 |
-- Initialize default values. |
24 |
do |
25 |
create accelerator.make_with_key_combination ( |
26 |
create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.key_numpad_add), |
27 |
False, False, False) |
28 |
accelerator.actions.extend (agent execute) |
29 |
end |
30 |
|
31 |
feature -- Basic operations |
32 |
|
33 |
execute is |
34 |
-- Perform operation. |
35 |
local |
36 |
l_world: EIFFEL_WORLD |
37 |
new_scale_factor, l_scale_factor: DOUBLE |
38 |
l_zoom_selector: EB_ZOOM_SELECTOR |
39 |
new_scale, old_scale: INTEGER |
40 |
l_projector: EIFFEL_PROJECTOR |
41 |
do |
42 |
if is_sensitive then |
43 |
l_world := tool.world |
44 |
l_scale_factor := l_world.scale_factor |
45 |
new_scale_factor := (0.1 + l_scale_factor) / l_scale_factor |
46 |
old_scale := (l_world.scale_factor * 100).rounded |
47 |
l_world.scale (new_scale_factor) |
48 |
tool.crop_diagram |
49 |
l_projector := tool.projector |
50 |
l_projector.full_project |
51 |
new_scale := (l_world.scale_factor * 100).rounded |
52 |
l_zoom_selector := tool.zoom_selector |
53 |
l_zoom_selector.show_as_text (new_scale) |
54 |
history.register_named_undoable ( |
55 |
Interface_names.t_Diagram_zoom_in_cmd, |
56 |
[<<agent l_world.scale (new_scale_factor), agent tool.crop_diagram, agent l_zoom_selector.show_as_text (new_scale), agent l_projector.full_project>>], |
57 |
[<<agent l_world.scale (1/new_scale_factor), agent tool.crop_diagram, agent l_zoom_selector.show_as_text (old_scale), agent l_projector.full_project>>]) |
58 |
end |
59 |
end |
60 |
|
61 |
feature {NONE} -- Implementation |
62 |
|
63 |
pixmap: EV_PIXMAP is |
64 |
-- Pixmap representing the command. |
65 |
do |
66 |
Result := pixmaps.icon_pixmaps.diagram_zoom_in_icon |
67 |
end |
68 |
|
69 |
pixel_buffer: EV_PIXEL_BUFFER is |
70 |
-- Pixel buffer representing the command. |
71 |
do |
72 |
-- Currently there is no pixel buffer for this command. |
73 |
end |
74 |
|
75 |
tooltip: STRING is |
76 |
-- Tooltip for the toolbar button. |
77 |
do |
78 |
Result := Interface_names.f_diagram_zoom_in |
79 |
end |
80 |
|
81 |
name: STRING is "Zoom_in"; |
82 |
-- Name of the command. Used to store the command in the |
83 |
-- preferences. |
84 |
|
85 |
indexing |
86 |
copyright: "Copyright (c) 1984-2006, Eiffel Software" |
87 |
license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)" |
88 |
licensing_options: "http://www.eiffel.com/licensing" |
89 |
copying: "[ |
90 |
This file is part of Eiffel Software's Eiffel Development Environment. |
91 |
|
92 |
Eiffel Software's Eiffel Development Environment is free |
93 |
software; you can redistribute it and/or modify it under |
94 |
the terms of the GNU General Public License as published |
95 |
by the Free Software Foundation, version 2 of the License |
96 |
(available at the URL listed under "license" above). |
97 |
|
98 |
Eiffel Software's Eiffel Development Environment is |
99 |
distributed in the hope that it will be useful, but |
100 |
WITHOUT ANY WARRANTY; without even the implied warranty |
101 |
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
102 |
See the GNU General Public License for more details. |
103 |
|
104 |
You should have received a copy of the GNU General Public |
105 |
License along with Eiffel Software's Eiffel Development |
106 |
Environment; if not, write to the Free Software Foundation, |
107 |
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
108 |
]" |
109 |
source: "[ |
110 |
Eiffel Software |
111 |
356 Storke Road, Goleta, CA 93117 USA |
112 |
Telephone 805-685-1006, Fax 805-685-6869 |
113 |
Website http://www.eiffel.com |
114 |
Customer support http://support.eiffel.com |
115 |
]" |
116 |
|
117 |
end -- class EB_ZOOM_IN_COMMAND |