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

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23