indexing description: "Window to search for a string in a text." legal: "See notice at end of class." status: "See notice at end of class."; date: "$Date$"; revision: "$Revision: " class SEARCH_W inherit COMMAND_W; NAMER; SEARCH_REPLACE_DIALOG rename make as srd_make end; WINDOW_ATTRIBUTES create make feature -- Initialization make (a_tool: TOOL_W) is -- Create a search and replace dialog. require a_tool_not_void: a_tool /= Void do tool := a_tool; srd_make (Interface_names.n_X_resource_name, a_tool.popup_parent); set_title (Interface_names.t_Search); add_find_action (Current, find_it); add_replace_action (Current, replace_it); add_replace_all_action (Current, replace_it_all); add_cancel_action (Current, cancel_it); set_composite_attributes (Current); set_default_position (False); hide_direction_request; realize; end; feature -- Closing close is do if is_popped_up then popdown end end; feature -- Access call is -- Record calling text_window `a_text_window' and popup current. local new_x, new_y: INTEGER; p: like parent do if tool.able_to_edit then set_replace else set_search end; p := parent; new_x := p.real_x + (p.width - width) // 2; new_y := p.real_y - (height // 2); if new_x + width > screen.width then new_x := screen.width - width elseif new_x < 0 then new_x := 0 end; if new_y + height > screen.height then new_y := screen.height - height elseif new_y < 0 then new_y := 0 end; set_x_y (new_x, new_y); popup end; feature {NONE} -- Properties find_it: ANY is -- Argument for `work' if find button pressed once create Result end; cancel_it: ANY is -- Argument for `work' if cancel button pressed once create Result end; replace_it: ANY is -- Argument for `work' if replace button pressed once create Result end; replace_it_all: ANY is -- Argument for `work' if replace all button pressed once create Result end; tool: TOOL_W -- Tool which popped up current feature {NONE} -- Implementation work (argument: ANY) is do if last_warner /= Void then last_warner.popdown end; if argument = cancel_it then popdown elseif not search_text.is_empty then if argument = find_it then tool.text_window.search_text (search_text, case_sensitive) elseif argument = replace_it then tool.text_window.replace_text (search_text, replace_text, False, case_sensitive) elseif argument = replace_it_all then tool.text_window.replace_text (search_text, replace_text, True, case_sensitive) end end end; indexing copyright: "Copyright (c) 1984-2006, 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 356 Storke Road, Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end -- class SEARCH_W