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

Contents of /branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/commands/eb_diagram_to_ps_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: 4576 byte(s)
First commit docking tabbed Eiffel Studio.
1 indexing
2 description: "Command to output diagram to a Postscript file"
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_DIAGRAM_TO_PS_COMMAND
10
11 inherit
12 EB_CONTEXT_DIAGRAM_COMMAND
13 redefine
14 menu_name,
15 initialize
16 end
17
18 EB_FILE_DIALOG_CONSTANTS
19 export
20 {NONE} all
21 end
22
23 EB_SHARED_PREFERENCES
24 export
25 {NONE} all
26 end
27
28 create
29 make
30
31 feature {NONE} -- Initialization
32
33 initialize is
34 -- Initialize default values.
35 do
36 create accelerator.make_with_key_combination (
37 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.key_s),
38 True, False, True)
39 accelerator.actions.extend (agent execute)
40 end
41
42 feature -- Basic operations
43
44 execute is
45 -- Perform operation
46 local
47 png_file: FILE_NAME
48 png_format: EV_PNG_FORMAT
49 p: EV_PIXMAP
50 dial: EB_FILE_SAVE_DIALOG
51 test_file: RAW_FILE
52 error: INTEGER
53 wd: EV_WARNING_DIALOG
54 do
55 if is_sensitive then
56 if error = 0 then
57 create dial.make_with_preference (preferences.dialog_data.last_saved_diagram_postscript_directory_preference)
58 set_dialog_filters_and_add_all (dial, <<Png_files_filter>>)
59
60 if tool.class_graph /= Void then
61 dial.set_file_name (tool.class_graph.center_class.name + ".png")
62 else
63 dial.set_file_name (tool.cluster_graph.center_cluster.name + ".png")
64 end
65 dial.show_modal_to_window (tool.develop_window.window)
66 if not dial.file_name.is_empty then
67 error := 1
68 p := tool.projector.world_as_pixmap (5)
69 if p /= Void then
70 create png_file.make_from_string (dial.file_name)
71 create test_file.make_open_write (png_file)
72 if test_file.is_writable then
73 test_file.close
74 create png_format
75 tool.develop_window.window.set_pointer_style (tool.Default_pixmaps.Wait_cursor)
76 p.save_to_named_file (png_format, png_file)
77 tool.develop_window.window.set_pointer_style (tool.Default_pixmaps.Standard_cursor)
78 error := 0
79 else
80 test_file.close
81 end
82 end
83 end
84 else
85 if error = 1 then
86 create wd.make_with_text (Warning_messages.w_cannot_save_png_file (dial.file_name))
87 elseif error = 2 then
88 create wd.make_with_text (Warning_messages.W_cannot_generate_png)
89 end
90 wd.show_modal_to_window (tool.develop_window.window)
91 end
92 end
93 rescue
94 if tool.projector.is_world_too_large then
95 error := 2
96 else
97 error := 1
98 end
99 tool.develop_window.window.set_pointer_style (tool.Default_pixmaps.Standard_cursor)
100 retry
101 end
102
103 pixmap: EV_PIXMAP is
104 -- Pixmap representing the command.
105 do
106 Result := pixmaps.icon_pixmaps.diagram_export_to_png_icon
107 end
108
109 pixel_buffer: EV_PIXEL_BUFFER is
110 -- Pixel buffer representing the command.
111 do
112 -- Currently there is no pixel buffer for this command.
113 end
114
115 tooltip: STRING is
116 -- Tooltip for the toolbar button.
117 do
118 Result := Interface_names.f_diagram_to_png
119 end
120
121 menu_name: STRING is
122 -- Name for the menu entry.
123 do
124 Result := Interface_names.m_diagram_to_png
125 end
126
127 name: STRING is "Diagram_to_png";
128 -- Name of the command. Used to store the command in the
129 -- preferences.
130
131
132 indexing
133 copyright: "Copyright (c) 1984-2006, Eiffel Software"
134 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
135 licensing_options: "http://www.eiffel.com/licensing"
136 copying: "[
137 This file is part of Eiffel Software's Eiffel Development Environment.
138
139 Eiffel Software's Eiffel Development Environment is free
140 software; you can redistribute it and/or modify it under
141 the terms of the GNU General Public License as published
142 by the Free Software Foundation, version 2 of the License
143 (available at the URL listed under "license" above).
144
145 Eiffel Software's Eiffel Development Environment is
146 distributed in the hope that it will be useful, but
147 WITHOUT ANY WARRANTY; without even the implied warranty
148 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
149 See the GNU General Public License for more details.
150
151 You should have received a copy of the GNU General Public
152 License along with Eiffel Software's Eiffel Development
153 Environment; if not, write to the Free Software Foundation,
154 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
155 ]"
156 source: "[
157 Eiffel Software
158 356 Storke Road, Goleta, CA 93117 USA
159 Telephone 805-685-1006, Fax 805-685-6869
160 Website http://www.eiffel.com
161 Customer support http://support.eiffel.com
162 ]"
163
164 end -- class EB_DIAGRAM_TO_PS_COMMAND

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23