note description: "Objects that represent an EV_TITLED_WINDOW.% %The original version of this class was generated by EiffelBuild." generator: "EiffelBuild" date: "$Date$" revision: "$Revision$" class ER_MAIN_WINDOW inherit ER_MAIN_WINDOW_IMP feature {NONE} -- Initialization user_initialization -- Called by `initialize'. -- Any custom user initialization that -- could not be performed in `initialize', -- (due to regeneration of implementation class) -- can be added here. do set_size (1280, 600) -- We have wipe out EiffelBuild generated `close_request_actions' first, -- otherwise, docking library cannot save widget's state since some widgets -- already destroyed by the generated `close_request_actions' close_request_actions.wipe_out close_request_actions.extend (agent on_exit_selected) show_actions.extend_kamikaze (agent init_after_shown) show_actions.extend_kamikaze (agent local l_env: EV_ENVIRONMENT do create l_env if attached l_env.application as l_app then l_app.destroy_actions.extend (agent save_tool_info_when_exit) end end) new_project_command.set_main_window (Current) open_project_command.set_main_window (Current) recent_project_command.set_main_window (Current) gen_code_command.set_main_window (Current) new_ribbon_command.set_main_window (Current) save_project_command.set_main_window (Current) shared_singleton.main_window_cell.put (Current) restore_tool_info_from_disk end init_after_shown -- Initialization after GUI displayed local l_docking_manager: like docking_manager l_tool_bar: SD_TOOL_BAR_CONTENT type_selector: ER_TYPE_SELECTOR layout_constructor: ER_LAYOUT_CONSTRUCTOR -- FIXME: remove this and only use {ER_SHARED_SINGLETON}.layout_constructor_list ? size_definition_editor: ER_SIZE_DEFINITION_EDITOR object_editor: ER_OBJECT_EDITOR output_tool: ER_OUTPUT_TOOL do create l_docking_manager.make (Current, Current) docking_manager := l_docking_manager create type_selector.make (l_docking_manager) create layout_constructor.make (l_docking_manager) create object_editor.make (l_docking_manager) shared_singleton.object_editor_cell.put (object_editor) create size_definition_editor.make (l_docking_manager) shared_singleton.put_size_definition (size_definition_editor) create output_tool.make (l_docking_manager) shared_singleton.put_output_tool (output_tool) l_tool_bar := build_tool_bar l_docking_manager.tool_bar_manager.contents.extend (l_tool_bar) l_tool_bar.set_top ({SD_ENUMERATION}.top) save_project_command.disable gen_code_command.disable restore_tools_layout end user_create_interface_objects -- local l_project_info: ER_PROJECT_INFO do -- Initialize before calling Precursor all the attached attributes -- from the current class. -- Proceed with vision2 objects creation. create shared_singleton create l_project_info.make shared_singleton.project_info_cell.put (l_project_info) create new_project_command.make (new_project_menu) create open_project_command.make (open_project_menu) create save_project_command.make (save_project_menu) create gen_code_command.make create recent_project_command.make (recent_projects) create new_ribbon_command.make create using_application_mode_command.make (using_application_mode) end build_tool_bar: SD_TOOL_BAR_CONTENT -- Build tool bar local l_list: ARRAYED_SET [SD_TOOL_BAR_ITEM] l_item: SD_TOOL_BAR_BUTTON do create l_list.make (10) l_item := open_project_command.new_menu_item l_list.extend (l_item) l_item := save_project_command.new_menu_item l_list.extend (l_item) l_item := gen_code_command.new_tool_bar_item l_list.extend (l_item) create Result.make_with_items ("MAIN_TOOL_BAR", l_list) end feature {NONE} -- Agents on_new_project_selected -- do new_project_command.execute end on_open_project_selected -- do open_project_command.execute end on_new_ribbon_selected -- do new_ribbon_command.execute end on_save_project_selected -- do save_project_command.execute end on_exit_selected -- local l_env: EV_ENVIRONMENT do save_tools_layout -- GUI is not visible when saving create l_env if attached l_env.application as l_app then l_app.destroy end end on_using_application_mode_selected -- do using_application_mode_command.execute end feature {ER_UICC_MANAGER, ER_GENERATE_CODE_COMMAND} -- Implementation restore_tools_layout -- Restore docking tool's layout local l_result: BOOLEAN do if attached docking_manager as l_manager then l_result := l_manager.open_tools_config_with_path ((create {ER_MISC_CONSTANTS}).docking_tools_layout_file_name) end end save_tools_layout -- Save docking tool's layout local l_result: BOOLEAN do if attached docking_manager as l_manager then l_result := l_manager.save_tools_data_with_path ((create {ER_MISC_CONSTANTS}).docking_tools_layout_file_name) end end restore_tool_info_from_disk -- Restore tool info from file local l_tool_info: detachable ER_TOOL_INFO l_file: RAW_FILE l_reader: SED_MEDIUM_READER_WRITER l_facility: SED_STORABLE_FACILITIES l_constants: ER_MISC_CONSTANTS do create l_constants create l_file.make_with_path (l_constants.tool_info_file_name) if l_file.exists then l_file.open_read create l_reader.make (l_file) l_reader.set_for_reading create l_facility if attached {ER_TOOL_INFO} l_facility.retrieved (l_reader, False) as l_tool_info_attached then l_tool_info := l_tool_info_attached end l_file.close end if l_tool_info = Void then create l_tool_info.make end shared_singleton.tool_info_cell.put (l_tool_info) recent_project_command.restore_recent_item_menu if attached shared_singleton.main_window_cell.item as l_main_window then l_main_window.using_application_mode_command.update_gui end end save_tool_info_when_exit -- Save tool info when exiting local l_file: RAW_FILE l_writer: SED_MEDIUM_READER_WRITER l_facility: SED_STORABLE_FACILITIES l_constants: ER_MISC_CONSTANTS do if attached shared_singleton.tool_info_cell.item as l_tool_info then create l_constants create l_file.make_with_path(l_constants.tool_info_file_name) l_file.create_read_write create l_writer.make (l_file) l_writer.set_for_writing create l_facility l_facility.store (l_tool_info, l_writer) l_file.close end end shared_singleton: ER_SHARED_TOOLS -- shared singleton feature -- Commands new_project_command: ER_NEW_PROJECT_COMMAND -- New project command open_project_command: ER_OPEN_PROJECT_COMMAND -- Open project command save_project_command: ER_SAVE_PROJECT_COMMAND -- Save project command gen_code_command: ER_GENERATE_CODE_COMMAND -- Generate code command recent_project_command: ER_RECENT_PROJECT_COMMAND -- Recent project command new_ribbon_command: ER_NEW_RIBBON_COMMAND -- New ribbon command using_application_mode_command: ER_USING_APPLICATION_MODE_COMMAND -- Using application mode command feature -- Query docking_manager: detachable SD_DOCKING_MANAGER -- Docking manager ;note copyright: "Copyright (c) 1984-2017, Eiffel Software" license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)" licensing_options: "http://www.eiffel.com/licensing" copying: "[ This file is part of Eiffel Software's Eiffel Development Environment. Eiffel Software's Eiffel Development Environment is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2 of the License (available at the URL listed under "license" above). Eiffel Software's Eiffel Development Environment is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Eiffel Software's Eiffel Development Environment; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ]" source: "[ Eiffel Software 5949 Hollister Ave., Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end