note
	description: "[
		Root class for the three order-of-appearance charts in
		the {VITP_GAME}.
		The position of the control points were obtained by measuring
		the phisical charts in millimeters from the edge or top.
		]"
	author:    "Jimmy J. Johnson"
	date:      "11/11/23"
	copyright: "Copyright (c) 2023, Jimmy J. Johnson"
	license:   "Eiffel Forum v2 (http://www.eiffel.com/licensing/forum.txt)"

deferred class
	ORDER_OF_APPEARANCE_VIEW

inherit

	VITP_CELL_VIEW
		redefine
			create_interface_objects,
			initialize,
			add_actions,
			draw,
			set_target
		end

	FONT_AND_COLOR_CONSTANTS
		undefine
			default_create,
			copy
		end

feature {NONE} -- Initialization

	create_interface_objects
			-- Create attributes
		do
			Precursor {VITP_CELL_VIEW}
			create widget_factory.make (game)
			create returning_air_widgets.make
			create returning_amphibious_widgets.make
			create flag.make (location)
			create big_marker.make (location)
			create little_marker.make (location)
			create background.make_with_points (top_left_cp, bottom_right_cp)
		end

	initialize
			-- Set up Current
		do
				-- Precursor creates the `world' and other previously-
				-- defined attributes
			Precursor {VITP_CELL_VIEW}
			set_minimum_size (ship_size * 14, ship_size * 16)
			build_flag
			build_markers
			add_widgets
		end

	build_flag
			-- Set `flag' characteristics
		do
			flag.set_flat
			flag.show_outline
		end

	build_markers
			-- Set the characteristics for `big_marker' and `little_marker'.	
		do
				-- `big_marker'
		 	big_marker.scale (0.08)
			big_marker.show_boarder
				-- `little_marker'
			little_marker.scale (0.05)
			little_marker.hide_anchor
			little_marker.show_boarder
		end

	add_actions
			-- Add a click event to the background
		do
			Precursor {VITP_CELL_VIEW}
				-- The next line does not work, I use the `background' to
				-- pick up the actions.  I bet the event loop does not
				-- call this actions or a {EV_CELL_VIEW}?
			pointer_button_press_actions.extend (agent on_pressed)
			background.pointer_button_press_actions.extend (agent on_pressed)
		end

	on_pressed (ax, ay, button: INTEGER;
					ax_tilt, ay_tilt, a_pressure: DOUBLE;
					a_screen_x, a_screen_y: INTEGER)
			-- Agent placed in the `background' retangle to allow the
			-- user to click, sending a message to the parent {CHART_TOOL}
			-- to set Current as the focused view.
		local
			pt: TOOL
		do
			io.put_string (generating_type.name + ".on_pressed:  " + generating_type.name + "%N")
			pt := parent_tool
			check attached {CHART_TOOL} parent_tool as t then
				t.set_focused_view (Current)
			end
		end

	add_widgets
			-- Add the attack widgets (e.g. Japanese attack widgets)
			-- to the view's `world' by calling the appropriate feature
			-- (e.g. `extend_allied_attack_unit_widgets', etc) from
			-- {WIDGET_FACTORY}.
		do
			add_background
			add_title
			add_top_markers
			add_turns
			add_return_boxes
			add_units
			add_returning_widgets
			add_miscellaneous_text
			add_starting_control_widgets
			add_copyright_text
		end

	add_background
			-- Put a rectangle representing the paper of the chart.
			-- This is an attempt to get button press actions to get
			-- called so that he zoom-in/zoom-out buttons can be applied
			-- the the correct view in the enclosing {CHART_TOOL}
		do
			background.set_background_color (Light_grey)
			world.extend (background)
		end

	add_title
			-- Put the title into Current
		local
			p: EV_COORDINATE
			t: EV_MODEL_TEXT
		do
			t := new_text (title, title_font)
			create p.make (middle_cp.x - t.width // 2 + 4, 4)
			t.set_point_position (p.x, p.y)
			world.extend (t)
		end

	add_top_markers
			-- Add the circles or stars to the top of the chart
		local
			s, s2: STAR
			e, e2: EV_MODEL_ELLIPSE
		do
			if nationality = {NATIONALITY_CONSTANTS}.japanese then
					-- Create the red circles
				create e.make_with_positions (0, 0, 9, 9)
				create e2.make_with_positions (0, 0, 9, 9)
				e.set_x_y (26, 8)
				e2.set_x_y (240, 8)
				e.set_background_color (color)
				e.set_foreground_color (color)
				e2.set_background_color (color)
				e2.set_foreground_color (color)
				world.extend (e)
				world.extend (e2)
			else
					-- Create the blue stars
				create s
				create s2
				s.scale (0.08)
				s2.scale (0.08)
				s.set_x_y (26, 8)
				s2.set_x_y (240, 8)
				s.set_foreground_color (color)
				s.set_background_color (color)
				s2.set_foreground_color (color)
				s2.set_background_color (color)
				world.extend (s)
				world.extend (s2)
			end
		end

	add_turns
			-- Add the "TURN X" and "TO x-date" text
		deferred
			-- Call `add_turn_text' a number of times
		end

	add_turn_text (a_turn: INTEGER)
			-- Add the "TURN X" and TO_date_text
		local
			p: EV_COORDINATE
			t: EV_MODEL_TEXT
			s: STRING
		do
			s := "Turn " + a_turn.out
			if a_turn = 9 then
				s := s + " (Optional)"
			end
			p := turn_x_cp (a_turn)
			t := new_text (s, Turn_font)
			t.set_point_position (p.x, p.y)
			world.extend (t)
			t := new_text (turn_x_date (a_turn), To_date_font)
			t.set_point_position (p.x + 2, p.y + 8)
			world.extend (t)
		end

	add_return_boxes
			-- Add the "Returning Air/Land Units" boxes
		do
			world.extend (new_box_widget ("Turn 1 Losses", Turn_1_losses_cp))
			world.extend (new_box_widget ("Turn 2 Losses", Turn_2_losses_cp))
			world.extend (new_box_widget ("Turn 3 Losses", Turn_3_losses_cp))
			world.extend (new_box_widget ("Turn 4 Losses", Turn_4_losses_cp))
			world.extend (new_box_widget ("Turn 5 Losses", Turn_5_losses_cp))
			world.extend (new_box_widget ("Turn 6 Losses", Turn_6_losses_cp))
			world.extend (new_box_widget ("Turn 7 Losses", Turn_7_losses_cp))
		end

	add_miscellaneous_text
			-- Add other texts as necessary
		do
		end

	add_starting_control_widgets
			-- Add the "Starting Control" text and markers if required
		do
				-- Add the markers, but hide them
			world.extend (flag)
			world.extend (big_marker)
			world.extend (little_marker)
		end

	add_copyright_text
			-- Add the copy-right notices to each chart
		do
		end

	new_text (a_text: STRING; a_font: EV_FONT): EV_MODEL_TEXT
			-- Create a new model from he parameters
		do
			create Result.make_with_text (a_text)
			Result.set_font (a_font)
			Result.set_foreground_color (color)
		end

	new_text_widget (a_text: STRING; a_font: EV_FONT; a_point: EV_COORDINATE): EV_MODEL_TEXT
			-- Create a new model from the parameters
		do
			create Result.make_with_text (a_text)
			Result.set_font (a_font)
			Result.set_foreground_color (color)
			Result.set_point_position (a_point.x, a_point.y)
		end

	new_box_widget (a_text: STRING; a_point: EV_COORDINATE): EV_MODEL_WORLD
			-- Create the "Returning Air/Land Units" box
		local
			w, mid: INTEGER
			lf, rt: INTEGER
			p1, p2: EV_COORDINATE
			rec: EV_MODEL_RECTANGLE
			mt, mt2: EV_MODEL_TEXT

			g: EV_MODEL_GROUP
			use_2: BOOLEAN
			ret_s, ret_s2: STRING
			may_s, may_s2: STRING
			mt_ret, mt_turn, mt_may: EV_MODEL_TEXT
			correction: INTEGER
		do
				-- Make the box relative to `ship_size' and don't
				-- go beyond the implied border of the `background'
			create Result
				-- Get an x-point that is relative to right border
			w := 3 * ship_size
			rt := (a_point.x + w).min (background.point_b.x - 3 * gap_size)
			lf := (rt - w).max (a_point.x)
			create p1.make (lf, a_point.y)
			create p2.make (rt, a_point.y + ship_size)
			create rec.make_with_points (p1, p2)
			rec.set_foreground_color (color)
			rec.set_background_color (lightened (color, 2.8))
			Result.extend (rec)
				-- Build a group to hold all the text and center that
				-- group in the `rec'

			ret_s := "RETURNING "
			ret_s2 := "AIR/LAND UNITS"
			may_s := "(may be placed in any friendly "
			may_s2 := "major port)"
			create g
			mt := new_text (ret_s + ret_s2, returning_units_font)
			if mt.width >= rec.width * 0.96 then
					-- Use two lines for some of the text
				use_2 := true
			end
			mt_turn := new_text (a_text, turn_x_losses_font)
			correction := 2
			if use_2 then
					-- Break text over two lines
				mt_ret := new_text ("    " + ret_s + "%N" + ret_s2, returning_units_font)
				mt_ret.set_x_y (rec.x, rec.y - mt_ret.height // 2)
				mt_turn.set_x_y (rec.x, rec.y + correction)
				mt_may := new_text (may_s + "%N             " + may_s2, may_be_placed_font)
				mt_may.set_x_y (rec.x - 2 * correction, mt_turn.y + mt_turn.height)
			else
					-- Use one line per text
				mt_ret := new_text (ret_s + ret_s2, returning_units_font)
				mt_ret.set_x_y (rec.x, rec.y - mt_ret.height)
				mt_turn.set_x_y (rec.x, rec.y + correction // 2)
				mt_may := new_text (may_s + may_s2, may_be_placed_font)
				mt_may.set_x_y (rec.x - 3 * correction, mt_turn.y + mt_turn.height)
			end
			Result.extend (mt_ret)
			Result.extend (mt_turn)
			Result.extend (mt_may)
		end

	new_jagged_box (a_text: STRING; a_count_1, a_count_2, a_count_3: INTEGER; a_angle: REAL_64): EV_MODEL_GROUP
			-- Builds a three-sided box with jagged lines centered around
			-- `a_text' (intended for port names) for placement
			-- around the the port names in the "Starting Control".
			-- Each side (clockwise from top) consists of the number
			-- of triangles given by the parameters, then rotated `a_angle'.
--		require
--			count_big_enough: a_count >= 1
--			count_small_enough: a_count <= 8
		local
			i: INTEGER
			a: ARRAY [EV_COORDINATE]
			poly: EV_MODEL_POLYGON
			t: EV_MODEL_TEXT
			p1, p2, p3: EV_COORDINATE
			w, h: INTEGER
		do
			create Result
--			create a.make_empty
				-- Build big trianges and then scale down.
			w := 60
			h := w // 2
			create p1
			create p2
			create p3
			a := <<p1, p2, p3>>
				-- Make the first (i.e. top) line
			from i := 1
			until i > a_count_1
			loop
				create p1.set (p2.x, p2.y)
				create p2.set (p1.x + w, p1.y)
				create p3.set (p1.x + h, p1.y - h)
				a := <<p1, p2, p3>>
				create poly.make_with_coordinates (a)
				poly.set_foreground_color (color)
				poly.set_background_color (color)
				Result.extend (poly)
				i := i + 1
			end
				-- Make the second (i.e. right) line
			from i := 1
			until i > a_count_2
			loop
				create p1.set (p2.x, p2.y)
				create p2.set (p1.x, p1.y + w)
				create p3.set (p1.x + h, p1.y + h)
				a := <<p1, p2, p3>>
				create poly.make_with_coordinates (a)
				poly.set_foreground_color (color)
				poly.set_background_color (color)
				Result.extend (poly)
				i := i + 1
			end
				-- Make the third (i.e. bottom) line
			from i := 1
			until i > a_count_3
			loop
				create p1.set (p2.x, p2.y)
				create p2.set (p1.x - w, p1.y)
				create p3.set (p1.x - h, p1.y + h)
				a := <<p1, p2, p3>>
				create poly.make_with_coordinates (a)
				poly.set_foreground_color (color)
				poly.set_background_color (color)
				Result.extend (poly)
				i := i + 1
			end
			Result.scale (0.05)
			Result.rotate (a_angle)
			t := new_text (a_text, may_be_placed_font)
				-- not quite centered so subtract a correction
			Result.set_x_y (t.x, t.y - gap_size)
			Result.extend (t)
		end

	add_units
			-- Add {ATTACK_UNIT_WIDGETS} to Current
		do
		end

	add_returning_widgets
			-- Adds an {AIR_UNIT_WIDGET} and an {AMPHIBIOUS_UNIT_WIDGET}
			-- to possibly hold a returning unit.  This widgets are NOT
			-- initially empty.  They are targetted, positioned and
			-- shown/hidden in feature `draw'.
		local
			i: INTEGER
			air_w: AIR_UNIT_WIDGET
			amp_w: AMPHIBIOUS_UNIT_WIDGET
		do
				-- There is a maximum of ten air units that can
				-- return on any given turn.
			from i := 1
			until i > 10
			loop
					-- Can not be empty
				create air_w.make (game.airflot_21)
				returning_air_widgets.extend (air_w)
				world.extend (air_w)
				air_w.hide
				i := i + 1
			end
				-- There is a maximum of four amphibious units that can
				-- return on any given turn.
			from i := 1
			until i > 4
			loop
					-- Can not be empty
				create amp_w.make (game.yokosuka)
				returning_amphibious_widgets.extend (amp_w)
				world.extend (amp_w)
				amp_w.hide
				i := i + 1
			end
		end

	positioned_widget (a_widget: ATTACK_UNIT_WIDGET; a_point: EV_COORDINATE): ATTACK_UNIT_WIDGET
			-- The `a_widget' after positioning it at `a_point'
		do
			Result := a_widget
			Result.set_point_position (a_point.x, a_point.y)
		end

feature -- Access

	widget_factory: WIDGET_FACTORY
			-- Creator and repository for widgets in this view

	location: LOCATION
			-- A {LOCATION} from the {VITP_GAME} used in `draw' to determine
			-- if a unit is on this chart or somewhere else (i.e. in the game.)
		deferred
		ensure
			valid_result: Result = game.japanese_oa_chart or
							Result = game.allied_oa_chart or
							Result = game.allied_starting_forces_chart
		end

	nationality: INTEGER
			-- The nationality of the unit on this chart

	color: EV_COLOR
			-- The main color used for the text in Current
		do
			if nationality = {NATIONALITY_CONSTANTS}.japanese then
				Result := (create {FONT_AND_COLOR_CONSTANTS}).Japanese_unit_color
			else
				Result := (create {FONT_AND_COLOR_CONSTANTS}).us_unit_color
			end
		end

	title: STRING
			-- The text at top of this chart
		deferred
		end

feature -- Element change

	set_target (a_item: like game)
			-- Associate `a_item' with Current.
		do
			Precursor (a_item)
			widget_factory.set_game (a_item)
				-- The unit widgets come from `game', so must wait
				-- until calling this feature to add them to Current.
				-- (i.e. do not add them in `initialize')
				-- NO, that is wrong.  We do not make new widget when
				-- targetting to a new game, we just repair the widgets
				-- to the new units.
				-- Make the flag color itself based on location's owner
			flag.set_location (location)
--			big_marker.set_target (location)
--			little_marker.set_target (location)
			big_marker.set_location (location)
			little_marker.set_location (location)
		end

feature -- Basic operations

	draw
			-- Redraw the view
		local
--			t: VITP_WIDGET_TABLE [ATTACK_UNIT_WIDGET, ATTACK_UNIT]
			w: ATTACK_UNIT_WIDGET
			u: ATTACK_UNIT
			i: INTEGER
		do
	-- Replace this with call to `notify_views'		
--			check attached {VITP_WIDGET_TABLE [ATTACK_UNIT_WIDGET, ATTACK_UNIT]} world.widgets as t then
--					-- because of select clause
----				t := world.widgets
--				from t.start
--				until t.after
--				loop
--					w := t.item_for_iteration
--					u := t.key_for_iteration
--					if u.location = location then
--						w.set_unflipped
--						w.set_raised
--					else
--						w.set_flipped
--						w.set_flat
--					end
--					t.forth
--				end
--			end
				-- Place any returning air & amphibious units
			if not is_view_empty then
				from i := 3
				until i > 9
				loop
					place_returning_air (i)
					place_returning_amphibious (i)
					i := i + 1
				end
			end
			flag.paint
			Precursor {VITP_CELL_VIEW}
		end

	place_returning_air (a_turn: INTEGER)
			-- Place any returning air units at proper place
		require
			turn_big_enough: a_turn >= 3
			turn_small_enough: a_turn <= 9
		local
			t: VITP_TABLE [AIR_UNIT]
			i: INTEGER
			u: AIR_UNIT
			w: AIR_UNIT_WIDGET
			cp: EV_COORDINATE
		do
			if nationality = {NATIONALITY_CONSTANTS}.japanese then
				t := game.returning_japanese_air_units (a_turn)
			else
				t := game.returning_allied_air_units (a_turn)
			end
			create cp
			i := 1
			from t.start
			until t.after
			loop
				u := t.item_for_iteration
				w := returning_air_widgets.i_th (i)
				w.set_target (u)
				w.show
					-- position the widget based on turn
				cp := turn_x_cp (a_turn)
				cp.set_position (cp.x + a_turn * air_size, cp.y + gap_size)
				w.set_point_position (cp.x, cp.y)
				t.forth
				i := i + 1
			end
				-- Now hide remaining (i.e. extra) widgets
			from
			until i > returning_air_widgets.count
			loop
				returning_air_widgets.i_th (i).hide
				i := i + 1
			end
		end

	place_returning_amphibious (a_turn: INTEGER)
			-- Place any returning amphibious units at proper place
		require
			turn_big_enough: a_turn >= 3
			turn_small_enough: a_turn <= 9
		local
			t: VITP_TABLE [AMPHIBIOUS_UNIT]
			i: INTEGER
			u: AMPHIBIOUS_UNIT
			w: AMPHIBIOUS_UNIT_WIDGET
			cp: EV_COORDINATE
		do
			if nationality = {NATIONALITY_CONSTANTS}.japanese then
				t := game.returning_japanese_amphibious_units (a_turn)
			else
				t := game.returning_allied_amphibious_units (a_turn)
			end
			create cp
			i := 1
			from t.start
			until t.after
			loop
				u := t.item_for_iteration
				w := returning_amphibious_widgets.i_th (i)
				w.set_target (u)
				w.show
					-- position the widget based on turn
				cp := turn_x_cp (a_turn)
				cp.set_position (cp.x + a_turn * air_size, cp.y + 2 * gap_size + air_size)
				w.set_point_position (cp.x, cp.y)
				t.forth
				i := i + 1
			end
				-- Now hide remaining (i.e. extra) widgets
			from
			until i > returning_amphibious_widgets.count
			loop
	--			returning_amphibious_widgets.item.hide
				i := i + 1
			end
		end

feature {NONE} -- Implementation

	flag: FLAG
			-- The flag that is one of the "Starting Control" widgets

	big_marker: CONTROL_MARKER
			-- The larger of the two port control markers, that is
			-- part the "Starting Control" widgets.	

	little_marker: CONTROL_MARKER
			-- The larger of the two port control markers, that is
			-- part the "Starting Control" widgets.	

feature {NONE} -- Implementation

	returning_air_widgets: LINKED_LIST [AIR_UNIT_WIDGET]
			-- List of widgets which can hold any returning air units
			-- Built up in `draw'

	returning_amphibious_widgets: LINKED_LIST [AMPHIBIOUS_UNIT_WIDGET]
			-- List of widgets which can hold any returning amphibious unit

	background: EV_MODEL_RECTANGLE --attribute create Result.make_with_points (top_left_cp, bottom_right_cp) end
			-- Represents the paper of the chart and provides a
			-- clickable area for selection of Current to pass on
			-- a click event to the containing {CHART_TOOL} so that
			-- the zoom-in/zoom-out buttons will work.

feature {NONE} -- Implementation

	turn_x_cp (a_turn: INTEGER): EV_COORDINATE
			-- The control point for the "TURN X" text for `a_turn'
		require
			turn_big_enough: a_turn >= 1
			turn_small_enough: a_turn <= 9
		do
			inspect a_turn
			when 1 then
				Result := Turn_1_cp
			when 2 then
				Result := Turn_2_cp
			when 3 then
				Result := Turn_3_cp
			when 4 then
				Result := Turn_4_cp
			when 5 then
				Result := Turn_5_cp
			when 6 then
				Result := Turn_6_cp
			when 7 then
				Result := Turn_7_cp
			when 8 then
				Result := Turn_8_cp
			when 9 then
				Result := Turn_9_cp
			else
				check
					should_not_happen: False
						-- because of precondition
				end
				create Result
			end
		end

	turn_x_date (a_turn: INTEGER): STRING
			-- The date (e.g. "TO DEMCEMBER 1941", etc) corresponding to
			-- turn number `a_turn
		require
			turn_big_enough: a_turn >= 1
			turn_small_enough: a_turn <= 9
		do
			inspect a_turn
			when 1 then
				Result := Turn_1_date
			when 2 then
				Result := Turn_2_date
			when 3 then
				Result := Turn_3_date
			when 4 then
				Result := Turn_4_date
			when 5 then
				Result := Turn_5_date
			when 6 then
				Result := Turn_6_date
			when 7 then
				Result := Turn_7_date
			when 8 then
				Result := Turn_8_date
			when 9 then
				Result := Turn_9_date
			else
				check
					should_not_happen: False
						-- because of precondition
				end
				Result := ""
			end
		end

feature -- Implementation

	title_font: EV_FONT
		once
			create Result
			Result.set_height (9)
			Result.set_weight ({EV_FONT_CONSTANTS}.Weight_bold)
		end

	turn_font: EV_FONT
		once
			create Result
			Result.set_height (9)
			Result.set_weight ({EV_FONT_CONSTANTS}.Weight_bold)
		end

	to_date_font: EV_FONT
		once
			create Result
			Result.set_height (3)
			Result.set_weight ({EV_FONT_CONSTANTS}.Weight_bold)
		end

	at_port_font: EV_FONT
		once
			create Result
			Result.set_height (5)
			Result.set_weight ({EV_FONT_CONSTANTS}.Weight_bold)
		end

	returning_units_font: EV_FONT
		once
			create Result
			Result.set_height (4)
			Result.set_weight ({EV_FONT_CONSTANTS}.Weight_bold)
		end

	turn_x_losses_font: EV_FONT
		once
			create Result
			Result.set_height (3)
			Result.set_weight ({EV_FONT_CONSTANTS}.Weight_bold)
		end

	may_be_placed_font: EV_FONT
		once
			create Result
			Result.set_height (3)
--			Result.set_weight ({EV_FONT_CONSTANTS}.Weight_bold)
		end

	may_be_placed_italic_font: EV_FONT
		once
			create Result
			Result.set_height (3)
			Result.set_shape ({EV_FONT_CONSTANTS}.shape_italic)
		end

	small_font: EV_FONT
		once
			create Result
			Result.set_height (2)
		end

	returning_units_box_color: EV_COLOR
			-- The [lighter] color used for the backgroun of the
			-- "Returning Air/Land Units" boxes
		do
			if nationality = {NATIONALITY_CONSTANTS}.japanese then
				Result := Japanese_unit_color_dim
			else
				Result := US_unit_color_dim
			end
		end

	Returning_units_text: STRING = "RETURNING AIR/LAND UNITS"
			-- Text placed in the returning units boxes

	May_be_placed_text: String = "may be placed in any friendly major port"
			-- More text for the returning units boxes

	turn_1_date: STRING = "TO DECEMBER 1941"
			-- Date placed near the "TURN 1" text

	turn_2_date: STRING = "TO MAY 1942"
			-- Date placed near the "TURN 1" text

	turn_3_date: STRING = "TO SEPTEMBER 1942"
			-- Date placed near the "TURN 1" text

	turn_4_date: STRING = "TO JANUARY 1943"
			-- Date placed near the "TURN 1" text

	turn_5_date: STRING = "TO JUNE 1943"
			-- Date placed near the "TURN 1" text

	turn_6_date: STRING = "TO JANUARY 1944"
			-- Date placed near the "TURN 1" text

	turn_7_date: STRING = "TO MAY 1944"
			-- Date placed near the "TURN 1" text

	turn_8_date: STRING = "TO OCTOBER 1944"
			-- Date placed near the "TURN 1" text

	turn_9_date: STRING = "TO JANUARY 1945"
			-- Date placed near the "TURN 1" text

feature {NONE} -- Implementation (control points in millimeters)

	top_left_cp: EV_COORDINATE once create Result.make (0, 0) end
	bottom_right_cp: EV_COORDINATE deferred end
	middle_cp: EV_COORDINATE do create Result.make (bottom_right_cp.x // 2, bottom_right_cp.y // 2) end
		-- Turn X text		
	turn_1_cp: EV_COORDINATE deferred end
	turn_2_cp: EV_COORDINATE deferred end
	turn_3_cp: EV_COORDINATE deferred end
	turn_4_cp: EV_COORDINATE deferred end
	turn_5_cp: EV_COORDINATE deferred end
	turn_6_cp: EV_COORDINATE deferred end
	turn_7_cp: EV_COORDINATE deferred end
	turn_8_cp: EV_COORDINATE deferred end
	turn_9_cp: EV_COORDINATE deferred end
		-- To some date text
	to_dec_41_cp: EV_COORDINATE deferred end
	to_may_42_cp: EV_COORDINATE deferred end
	to_sep_42_cp: EV_COORDINATE deferred end
	to_jan_43_cp: EV_COORDINATE deferred end
	to_jun_43_cp: EV_COORDINATE deferred end
	to_jan_44_cp: EV_COORDINATE deferred end
	to_may_44_cp: EV_COORDINATE deferred end
	to_oct_44_cp: EV_COORDINATE deferred end
	to_jan_45_cp: EV_COORDINATE deferred end
		-- Turn x losses
	turn_1_losses_cp: EV_COORDINATE deferred end
	turn_2_losses_cp: EV_COORDINATE deferred end
	turn_3_losses_cp: EV_COORDINATE deferred end
	turn_4_losses_cp: EV_COORDINATE deferred end
	turn_5_losses_cp: EV_COORDINATE deferred end
	turn_6_losses_cp: EV_COORDINATE deferred end
	turn_7_losses_cp: EV_COORDINATE deferred end

feature {NONE}  -- Implementation

	gap_size: INTEGER = 2
			-- To add a small gap between widgets

	ship_size: INTEGER
			-- Size of a [square] ship widget
		once
--			Result :=  {SHIP_WIDGET}.default_tile_size.rounded
			check attached {SHIP_WIDGET} widget_factory.widgets.item (game.akagi) as w then
				Result := w.tile_size.rounded
			end
		end

	air_size: INTEGER
			-- Size of a [square] air unit widget
		once
--			Result := ({SHIP_WIDGET}.default_tile_size * 0.7).rounded
			check attached {AIR_UNIT_WIDGET} widget_factory.widgets.item (game.airflot_21) as w then
				Result := w.tile_size.rounded
			end
		end

end
