indexing
	cluster: "demangler"
	namespace: "candidate"
	description: "Edits a `DIRDUP_REPORT' object."
	original_author: "Justin Finnerty"
	original_date: "Oct 2005"
	current_date: "$Date: 2005/10/31 07:19:34 $"
	current_author: "$Author: finnerty $"
	revision: "$Revision: 2.1 $"	
	-- $Log: text_dirdup_view.e,v $
	-- Revision 2.1  2005/10/31 07:19:34  finnerty
	-- Added ability to create symlinks between directories as an alternative to merging. The major changes are in DIRDUP_REPORT with others adding/changing features as required.
	--
	--
	--

class TEXT_DIRDUP_VIEW
	-- Edits a `SYNC_REPORT' object.
	
inherit
	TEXT_REPORT_VIEW
		redefine
			report_show,
			display_report
		end

creation {ANY}
	-- Construction
	make

feature {REPORT_VIEW}
	-- Implementation features
	report_show is
			-- Display and possibly remove transforms from a report.
		local
			l_result: INTEGER
			l_k, l_l, l_i, l_r: CHARACTER
			l_title, l_msg, l_list: UC_STRING
			l_report: DIRDUP_REPORT
		do
			l_k := 'k'
			l_l := 'l'
			l_i := 'i'
			l_r := 'r'
			
			display_report ("Generated report", False)
			
			!!l_title.make_from_string ("** Report has actions **")
			!!l_msg.make_from_string ("merge directory <2> into <1> (note <1> appears more recent):link directory <2> to <1>:link directory <1> to <2>:ignore these directories and search for next pair:ignore report and continue to next report")
			!!l_list.make_from_string ("mlkri")

			l_result := query(l_title, l_msg, l_list)
			if l_result = l_i.code then
				view_state := Reset
			elseif l_result = l_r.code then
				view_state := Generate
			else
				l_report ?= current_report
				if l_report /= Void then
					if l_result = l_l.code then
						l_report.set_merge_directories (False)
					elseif l_result = l_k.code then
						l_report.set_merge_directories (False)
						l_report.set_merge_to_older (True)
					end
					view_state := Action
				else
					put_string ("Programming error: wrong report type for this view.")
				end
			end
		end

feature {NONE}
	-- SYNC_REPORT specific formatted output features
	display_report (a_title: STRING; a_title_only: BOOLEAN) is
			-- Print out the two root directories
		local
			l_line: STRING
			l_report: DIRDUP_REPORT
		do
			l_report ?= current_report
			!!l_line.make_filled('-',width)
			put_string (l_line)
			put_new_line
			put_string (a_title)
			put_string (": " )
			put_unicode_string (current_report.label)
			put_new_line
			put_string (l_line)
			put_new_line
			if not a_title_only then
				put_unicode_string (current_report.help)
				put_new_line
			end
			put_string (l_line)
			put_new_line
			if l_report /= Void then
				if l_report.red_root /= Void and then
					l_report.black_root /= Void then
					put_string ("<1> [")
					if l_report.is_red_later then
						put_string (l_report.red_root.name)
						put_string ("]")
						put_new_line
						put_string ("<2> [")
						put_string (l_report.black_root.name)
					else
						put_string (l_report.black_root.name)
						put_string ("]")
						put_new_line
						put_string ("<2> [")
						put_string (l_report.red_root.name)
					end
					put_string ("]")
				end
			else
				put_string ("Programming error: wrong report type for this view.")
			end
			put_new_line
		end

end -- class TEXT_DIRDUP_VIEW
