This commit is contained in:
Jocelyn Fiat
2024-06-17 09:09:33 +02:00
commit 6dde6425c2
560 changed files with 81728 additions and 0 deletions

View File

@@ -0,0 +1,203 @@
note
description: "[
Helper class for manipulating an {EV_COLOR}. Specifically, it
gives a range of colors starting from `color' and fading toward
a darker or lighter color.
Black is at the "dark" end of the scale and a dark_grey (first
passing through a lighter color) is at the other end.
]"
author: "Jimmy J. Johnson"
revision: "$Revision: 33 $"
class
COLOR_FADER
inherit
ANY
redefine
default_create
end
create
default_create,
make_with_color,
make_with_color_and_count
feature {NONE} -- Initialization
default_create
-- Initialize with `color' rgb = [0.5, 0.5, 0.5] (a mid-tone grey)
-- and five steps.
do
create color.make_with_rgb (0.5, 0.5, 0.5)
count := 10
end
make_with_color (a_color: EV_COLOR)
-- Initialize with `a_color' and five steps
require
color_exists: a_color /= Void
do
create color.make_with_rgb (a_color.red, a_color.green, a_color.blue)
count := 10
end
make_with_color_and_count (a_color: EV_COLOR; a_count: INTEGER)
-- Set `color' and `count'
require
color_exists: a_color /= Void
count_large_enough: a_count >= 0
do
create color.make_with_rgb (a_color.red, a_color.green, a_color.blue)
count := a_count
end
feature -- Access
color: EV_COLOR
-- The original color on which results are based
count: INTEGER
-- The number of steps (or max distance) to go from the original color to full dark
distance: INTEGER
-- The current place in the range of colors
-- (Higher numbers are further away from `color'; a `step'
-- of zero gives the original color.)
i_th_darker (a_distance: INTEGER): EV_COLOR
-- The color a `a_distance' away from `color' toward the black
require
distance_large_enough: a_distance >= 0
distance_small_enough: a_distance <= count
local
r, g, b: REAL_32
r_dist, g_dist, b_dist: REAL_32
r_step, g_step, b_step: REAL_32
do
r_dist := Darkest - color.red
g_dist := Darkest - color.green
b_dist := Darkest - color.blue
r_step := r_dist / count
g_step := g_dist / count
b_step := b_dist / count
r := color.red + r_step * a_distance
g := color.green + g_step * a_distance
b := color.blue + b_step * a_distance
create Result.make_with_rgb (r, g, b)
end
darker: EV_COLOR
-- The color a `distance' away from `color' toward the `Darkest'
do
Result := i_th_darker (distance)
end
i_th_lighter (a_distance: INTEGER): EV_COLOR
-- The color a `a_distance' away from `color' toward the `Grey'
require
distance_large_enough: a_distance >= 0
distance_small_enough: a_distance <= count
local
r, g, b: REAL_32
r_dist, g_dist, b_dist: REAL_32
r_step, g_step, b_step: REAL_32
do
r_dist := Grey - color.red
g_dist := Grey - color.green
b_dist := Grey - color.blue
r_step := r_dist / count
g_step := g_dist / count
b_step := b_dist / count
r := color.red + r_step * a_distance
g := color.green + g_step * a_distance
b := color.blue + b_step * a_distance
create Result.make_with_rgb (r, g, b)
end
lighter: EV_COLOR
-- The color a `distance' away from `color' toward the lighter end
do
Result := i_th_lighter (distance)
end
feature -- Element change
set_color (a_color: EV_COLOR)
-- Make `color' have the same rgb values as `a_color' (copies the values)
require
color_exists: a_color /= Void
do
color.set_rgb (a_color.red, a_color.green, a_color.blue)
end
set_count (a_count: INTEGER)
-- Change the `count'
require
count_big_enough: a_count >= 0
do
count := a_count
end
feature -- Basic operations
forth
-- Increment the `step' up to a maximum of `count'
require
not_after: not is_after
do
distance := distance + 1
end
back
-- Decrement the `step' downn to a minimum of zero
require
not_before: not is_before
do
distance := distance - 1
end
finish
-- Move the the last position
do
distance := count
end
start
-- Move to the first position
do
distance := 1
end
feature -- Status report
is_before: BOOLEAN
-- Is the `step' before the range?
do
Result := distance = 0
end
is_after: BOOLEAN
-- Is the `step' greater than `count'
do
Result := distance > count
end
feature {NONE} -- Implementation
Lightest: REAL_32 = 0.8
-- The lightest value to which Current will fade
Darkest: REAL_32 = 0.2
-- The darkest value to which Current will fade
Grey: REAL_32 = 0.6
-- A medium value toward which Current can fade
invariant
color_exists: color /= Void
count_large_enough: count >= 0
end

View File

@@ -0,0 +1,61 @@
note
description: "[
Used by {VIEW_MANAGER} as a place holder when it has
no other views.
]"
date: "29 Aug 03"
author: "Jimmy J. Johnson"
copyright: "Copyright 2012, Jimmy J. Johnson"
license: "Eiffel Forum License v2 (see forum.txt)"
URL: "$URL: file:///F:/eiffel_repositories/jj_vision/trunk/interface/views/default_view.e $"
date: "$Date: 2015-10-24 07:32:40 -0700 (Sat, 24 Oct 2015) $"
revision: "$Revision: 23 $"
class
DEFAULT_VIEW
inherit
VIEW
undefine
-- default_create,
copy
redefine
create_interface_objects,
initialize
end
EV_LABEL
rename
object_id as ise_object_id
undefine
is_in_default_state
redefine
create_interface_objects,
initialize
end
create
default_create
feature {NONE} -- Initialization
create_interface_objects
-- Create objects to be used by `Current' in `initialize'
-- Implemented by descendants to create attached objects
-- in order to adhere to void-safety due to the implementation bridge pattern.
do
Precursor {VIEW}
Precursor {EV_LABEL}
end
initialize
-- Set up the view
do
Precursor {VIEW}
Precursor {EV_LABEL}
set_text ("Default view")
end
end

View File

@@ -0,0 +1,443 @@
note
description: "[
A {VIEW} for displaying an {EDITABLE} using it's `schema'
]"
date: "30 Mar 04"
author: "Jimmy J. Johnson"
copyright: "Copyright 2012, Jimmy J. Johnson"
license: "Eiffel Forum License v2 (see forum.txt)"
URL: "$URL: file:///F:/eiffel_repositories/jj_vision/trunk/interface/views/dialog_editor_view.e $"
date: "$Date: 2012-05-31 14:05:35 -0400 (Thu, 31 May 2012) $"
revision: "$Revision: 10 $"
class
DIALOG_EDITOR_VIEW
inherit
EV_STOCK_COLORS
rename
implementation as colors_implementation
export
{NONE} all
undefine
default_create,
is_equal,
copy
end
VIEW
rename
target_imp as record_imp,
target as record,
set_target as set_record
undefine
-- default_create,
copy,
is_equal
redefine
create_interface_objects,
initialize,
record_imp,
set_record,
draw
end
-- EV_CELL
EV_FRAME
undefine
is_in_default_state
redefine
create_interface_objects,
initialize
-- data, -- to make it inaplicable
-- set_data -- to make it inaplicable
end
create
default_create
feature {NONE} -- Initialization
create_interface_objects
-- Create objects to be used by `Current' in `initialize'
-- Implemented by descendants to create attached objects
-- in order to adhere to void-safety due to the implementation bridge pattern.
do
Precursor {VIEW}
Precursor {EV_FRAME}
create changed_controls.make
create controls.make
create save_actions
create control_select_actions
create scrollable_area
create time_drawn.from_seconds (0)
end
initialize
-- Create an editor view.
do
Precursor {EV_FRAME}
Precursor {VIEW}
extend (scrollable_area)
set_save_on_change
set_actions
end
set_actions
-- Add actions to the widgets
do
scrollable_area.item.drop_actions.extend (agent on_drop_editable)
end
feature -- Access
scrollable_area: EDITOR_SCROLL_AREA
schema: SCHEMA
-- Current schema in use by the editor.
require
has_schema: has_schema
do
check attached schema_imp as s then
Result := s
end
end
save_actions: EV_NOTIFY_ACTION_SEQUENCE
-- Actions to be performed after the record is saved.
control_select_actions: EV_NOTIFY_ACTION_SEQUENCE
-- Actions to be performed when a control is clicked.
feature -- Element change
set_record (a_record: like record)
-- Change `record' to `a_record'
-- Reload the data into the controls
do
Precursor {VIEW} (a_record)
draw
end
set_schema (a_schema: like schema)
-- Change `schema' to `a_schema'.
-- Uses the pattern described in feature `set_target' from VIEW to
-- add `a_schema' to the `object_set' (the set of objects contained
-- in this view) and removes the old schema (if it had one) from
-- the `object_set'.
-- Also, removes old/add new fields contained in `a_schema'.
do
-- Save the old `record'
if attached schema_imp as s and then s /= a_schema then
-- target_set.prune (s)
schema_imp := a_schema
-- target_set.extend (s)
draw
end
ensure
schema_assigned: schema = a_schema
-- contains_schema: target_set.has (a_schema)
-- old_schema_removed: (old schema /= Void) and (old schema /= schema) implies not target_set.has (old schema)
end
feature -- Basic operations
draw
-- Rebuild and show the view.
do
if has_schema then
if is_rebuild_needed then
build_controls
end
if record /= Void then
fill_controls
if attached schema as s and then record.has_schema (s) then
enable_controls
else
disable_controls
end
else
disable_controls
end
end
end
disable
-- Make the controls unresponsive to input.
do
is_user_disabled := True
end
enable
-- Make the controls responsive to input.
do
is_user_disabled := False
end
feature -- Status report
is_user_disabled: BOOLEAN
-- Has the user requested the controls to be disabled?
is_save_on_change: BOOLEAN
-- Are changes made in the controls automatically
-- saved to `record'? In other words, is `record'
-- updated anytime a change is made, or must it
-- be done manually with a call to `save_record'?
has_schema: BOOLEAN
-- Is a `schema' assigned to Current?
do
Result := attached schema_imp
end
feature -- Status setting
set_save_on_change
-- Make automatic updates to `record' whenever
-- a change is made in any control.
do
is_save_on_change := True
end
set_save_on_request
-- Require `save_record' to be called in order to
-- accept any changes make in any control.
do
is_save_on_change := False
end
feature -- Basic operations
disable_controls
-- Disable all controls.
local
c: CONTROL
do
from controls.start
until controls.exhausted
loop
c := controls.item
c.disable_sensitive
check attached c.parent as p then
p.set_foreground_color (Red)
p.propagate_foreground_color
end
controls.forth
end
end
enable_controls
-- Enable all controls.
local
c: CONTROL
do
from controls.start
until controls.exhausted
loop
c := controls.item
c.enable_sensitive
check attached c.parent as p then
p.set_foreground_color (Black)
p.propagate_foreground_color
end
controls.forth
end
end
feature {NONE} -- Implementation
build_controls
-- Create controls for each FIELD in `schema'.
require
schema_exists: schema /= Void
local
f: FIELD
c: CONTROL
do
check attached {EDITOR_FIXED} scrollable_area.item as ef then
-- Because `scrollable_area' is an {EDITOR_SCROLL_AREA}
-- which *should* hold an {EDITOR_FIXED}.
ef.wipe_out
controls.wipe_out
if attached schema as s then
from s.start
until s.exhausted
loop
f := s.field
c := f.as_widget
-- add actions to each control as it is created
c.valid_change_actions.extend (agent on_control_changed (c))
c.select_actions.extend (agent on_control_selected (c))
-- c.display.pointer_button_press_actions.force_extend (agent on_control_selected (c))
-- c.label.pointer_button_press_actions.force_extend (agent on_control_selected (c))
-- put the control into the fixed
ef.extend (c)
-- place the control in the correct spot
scrollable_area.position_control (c)
-- keep track of the control
controls.extend (c)
if is_user_disabled then
disable_controls
end
s.forth
end
if not is_user_disabled then
enable_controls
end
end
end
check attached schema as s then
time_drawn := s.time_modified.twin
end
end
save_record
-- Get the data from each control and put it into the
-- the record if the data is valid.
require
record_exitsts: record /= Void
local
dat: ANY -- for testing
con: CONTROL -- control
c: EDIT_COMMAND
do
from changed_controls.start
until changed_controls.off
loop
con := changed_controls.item
if con.is_display_valid and then not con.field.is_calculated then
dat := con.value
c := new_edit_command (record, con.field, con.value)
-- Disable drawing to keep this control from being updated
-- when the EDIT_COMMAND is executed.
disable_drawing
command_manager.add_command (c)
enable_drawing
end
changed_controls.forth
end
save_actions.call ([])
changed_controls.wipe_out
end
new_edit_command (a_record: like record; a_field: FIELD; a_value: ANY): EDIT_COMMAND
-- Used by `save_record' to get an EDIT_COMMAND
require
record_exists: record /= Void
do
create Result.make (a_record, a_field, a_value)
end
fill_controls
-- Put the data from the record into the corresponding control
require
record_exists: record /= Void
local
key: STRING
con: CONTROL
do
from
controls.start
until
controls.exhausted
loop
key := controls.item.field.label
con := controls.item
if attached record.value (key) as dat then
con.set_data (dat)
end
con.refresh
controls.forth
end
end
feature {CONTROL} -- implementation
on_drop_editable (a_editable: EDITABLE)
-- React to drop of `a_editable' on Current except if
-- it is a FIELD. (FIELDs are handled by FIELD_EDITOR_VIEW.)
-- Fix me !!! This makes the interface inconsistent by allowing a drop
-- of a type that is really not allowed.
require
editable_exists: a_editable /= Void
do
-- The `parent_tool' (a EDIT_TOOL) takes care of the special
-- case, when `a_editable' is a FIELD.
if attached parent_tool as pt then
pt.set_target (a_editable)
end
end
on_control_changed (a_control: CONTROL)
-- A change has been made to value in `a_control'
require
control_exists: a_control /= Void
do
changed_controls.extend (a_control)
if is_save_on_change then
save_record
disable_drawing
draw_views (record)
enable_drawing
end
end
on_control_selected (a_control: CONTROL)
-- React to `a_control' being selected.
require
control_exists: a_control /= Void
do
control_select_actions.call ([a_control])
end
feature {NONE} -- Implementation
controls: LINKED_SET [CONTROL]
-- All the controls in the pages.
changed_controls: LINKED_SET [CONTROL]
-- Controls whose data has changed since last save
is_rebuild_needed: BOOLEAN
-- Used internally to let `draw' know that the controls
-- need to be rebuilt, because the schema has changed
-- since the last call to `draw'. This prevents calling
-- `build_controls' (and unnecessarily recreating the
-- controls again) on every call to `draw'.
require
schema_exists: schema /= Void
do
check attached schema as s then
Result := time_drawn < s.time_modified
end
end
time_drawn: YMDHMS_TIME
-- The time the controls were last drawn.
-- This is used to allow the controls for a schema to be
-- redrawn only after the `schema' has changed, not every
-- time a new `record' is set.
-- Updated by `build_controls'.
record_imp: detachable EDITABLE
-- Detachable implementation of `target' for void-safety
schema_imp: detachable like schema
-- Detachable implementation of `schema'
feature {NONE} -- Inaplicable
-- data: ANY
-- -- Not to be used
--
-- set_data (a_data: like data) is
-- -- Not to be used
-- do
-- check
-- False
-- end
-- end
end

View File

@@ -0,0 +1,191 @@
note
description: "[
A widget that can appear bright or dim
]"
author: "Jimmy J. Johnson"
deferred class
DIMABLE
inherit
ANY
redefine
default_create
end
feature -- Initialization
default_create
-- Set the default `dimming_level'
do
dimming_level := Dimmer
previous_dimming_level := Dimmest
end
feature -- Access
dimming_level: INTEGER_32
-- The amount colors will be dimmed
-- (One of `Dim', `Dimmer', or `Dimmest')
previous_dimming_level: INTEGER_32
-- Used to `restore' to the prior dimming level
Bright: INTEGER = 0
Normal: INTEGER_32 = 7
Dim: INTEGER = 10
Dimmer: INTEGER_32 = 15
Dimmest: INTEGER_32 = 20
feature -- Element change
set_dimming_level (a_level: like dimming_level)
-- Change the `dimming_level'
require
valid_level: a_level = Bright or a_level = Normal or a_level = Dim or
a_level = Dimmer or a_level = Dimmest
do
-- io.put_string ("DIMABLE.set_dimming_level -- ")
-- if attached {VITP_ITEM} Current as v then
-- io.put_string ("on " + v.name)
-- else
-- io.put_string (" on? " + generating_type)
-- end
-- io.put_string (" from " + previous_dimming_level.out)
-- io.put_string (" to " + dimming_level.out + "%N")
previous_dimming_level := dimming_level
dimming_level := a_level
end
feature -- Basic operations
restore_dimming_level
-- Set the `dimming_level' to the `previous_dimming_level'
do
set_dimming_level (previous_dimming_level)
end
feature -- Status report
is_bright: BOOLEAN
-- Should the resulting colors be "bright"?
do
Result := dimming_level = Bright
end
is_normal: BOOLEAN
-- Should the resulting colors be "normal"?
do
Result := dimming_level = Normal
end
is_dimmed: BOOLEAN
-- Should the resulting colors be "dim"?
do
Result := dimming_level = Dim
end
is_more_dimmed: BOOLEAN
-- Should the resulting colors be "dimmer"?
do
Result := dimming_level = Dimmer
end
is_completely_dimmed: BOOLEAN
-- Should the resulting colors be "dimmest"?
do
Result := dimming_level = Dimmest
end
feature -- Status setting
set_bright
-- Change the color dimming level to "bright
do
set_dimming_level (Bright)
end
set_normal
-- Change the `dimming_level' to "normal"
do
set_dimming_level (normal)
end
set_dimmed
-- Change the color dimming level to "dim"
do
set_dimming_level (Dim)
end
set_more_dimmed
-- Change the color dimming level to `Dimmer'
do
set_dimming_level (Dimmer)
end
set_completely_dimmed
-- Change the color dimming level to `Dimmest'
do
set_dimming_level (Dimmest)
end
feature -- Query
adjusted_color (a_color: EV_COLOR): EV_COLOR
-- A new color from `a_color' adjusted based on the `dimming_level'
require
color_exists: a_color /= Void
do
fader.set_color (a_color)
Result := fader.i_th_lighter (dimming_level)
end
dim_color (a_color: EV_COLOR): EV_COLOR
-- A new color based on `a_color' at a "faded" level
require
color_exists: a_color /= Void
do
fader.set_color (a_color)
Result := fader.i_th_lighter (Dim)
end
dimmer_color (a_color: EV_COLOR): EV_COLOR
-- A new color based on `a_color' at a "faded" level
require
color_exists: a_color /= Void
do
fader.set_color (a_color)
Result := fader.i_th_lighter (Dimmer)
end
dimmest_color (a_color: EV_COLOR): EV_COLOR
-- A new color based on `a_color' at a "faded" level
require
color_exists: a_color /= Void
do
fader.set_color (a_color)
Result := fader.i_th_lighter (Default_step_count)
end
feature {NONE} -- Implementation
fader: COLOR_FADER
-- Used to calculate a new color based on some initial color and dimming level
once
create Result
Result.set_count (Default_step_count)
end
Default_step_count: INTEGER_32 = 20
-- Number of variable color settings used in the `fader'
invariant
valid_dimming_level: dimming_level = Bright or
dimming_level = Normal or
dimming_level = Dim or
dimming_level = Dimmer or
dimming_level = Dimmest
end

View File

@@ -0,0 +1,69 @@
note
description: "[
An special {DIALOG_EDITOR_VIEW} used to edit a {FIELD}
A {FIELD_SCHEMA} can not be created when a {FIELD} is created,
because, as Manu from ISE described, both {FIELD} and {SCHEMA}
would rely on the creation of the other, and an object would
be referenced before the created object was ever assigned to
the `Result' in `default_create'.
]"
date: "27 Feb 04"
author: "Jimmy J. Johnson"
copyright: "Copyright 2012, Jimmy J. Johnson"
license: "Eiffel Forum License v2 (see forum.txt)"
URL: "$URL: file:///F:/eiffel_repositories/jj_vision/trunk/interface/views/field_editor_view.e $"
date: "$Date: 2012-03-16 14:05:07 -0400 (Fri, 16 Mar 2012) $"
revision: "$Revision: 7 $"
class
FIELD_EDITOR_VIEW
inherit
DIALOG_EDITOR_VIEW
redefine
record_imp,
set_record,
new_edit_command
end
create
default_create
feature -- Element change
set_record (a_record: like record)
-- Change the `record'.
do
-- Redefined to ensure the `schema' for `a_record' is set.
-- It may alread be here, but not always.
-- Note that `draw' is called by Precursor.
set_schema (a_record.schema)
Precursor {DIALOG_EDITOR_VIEW} (a_record)
end
feature {NONE} -- Implementation (actions)
parent_schema: SCHEMA
-- The schema being editted by the `parent_tool' which
-- must be a EDIT_TOOL.
do
check attached {EDIT_TOOL} parent_tool as pt then
Result := pt.get_schema
end
end
new_edit_command (a_record: like record; a_field: FIELD; a_value: ANY): EDIT_SCHEMA_COMMAND
-- Used by `save_record' to get the correct type of command.
-- It is special for this type as it is a field that is
-- changing but the command affects a SCHEMA.
do
create Result.make (a_record, a_field, a_value)
Result.set_schema (parent_schema)
end
record_imp: detachable FIELD
-- Detachable implementation of `target' for void-safety
end

View File

@@ -0,0 +1,151 @@
note
description: "[
A {VIEW} used to display the names of files as filtered
]"
date: "26 Jan 04"
author: "Jimmy J. Johnson"
copyright: "Copyright 2012, Jimmy J. Johnson"
license: "Eiffel Forum License v2 (see forum.txt)"
URL: "$URL: file:///F:/eiffel_repositories/jj_vision/trunk/interface/views/filename_view.e $"
date: "$Date: 2012-05-31 14:05:35 -0400 (Thu, 31 May 2012) $"
revision: "$Revision: 10 $"
class
FILENAME_VIEW
inherit
EV_VERTICAL_BOX
rename
object_id as ise_object_id
undefine
is_in_default_state
redefine
create_interface_objects,
initialize
end
VIEW
undefine
copy,
is_equal
redefine
create_interface_objects,
initialize,
draw
end
create
default_create
feature {NONE} -- Initialization
create_interface_objects
-- Create objects to be used by `Current' in `initialize'
-- Implemented by descendants to create attached objects
-- in order to adhere to void-safety due to the implementation bridge pattern.
do
Precursor {VIEW}
Precursor {EV_VERTICAL_BOX}
create browse_button
create directory_text
create file_list
browse_button.set_pixmap (create {EV_PIXMAP}.make_with_pixel_buffer (Icon_shell_color_buffer))
browse_button.set_tooltip ("{FILENAME_VIEW.Browse_button")
end
initialize
-- Create an editor view.
do
Precursor {EV_VERTICAL_BOX}
Precursor {VIEW}
extend (browse_button)
extend (directory_text)
extend (file_list)
disable_item_expand (browse_button)
disable_item_expand (directory_text)
set_actions
end
set_actions
-- Add actions to the widgets and view.
do
browse_button.select_actions.extend (agent on_browse_button_pressed)
directory_text.change_actions.extend (agent on_directory_text_changed)
end
feature {NONE} -- Actions
on_browse_button_pressed
-- React to a press of the browse button
do
directory_dialog.show_modal_to_window (parent_window)
end
on_directory_selected
-- React to a directory selection from the `directory_dialog'.
do
directory_text.set_text (directory_dialog.directory)
end
on_directory_text_changed
-- React to a change of the `directory_text'.
do
draw
end
feature -- Basic operations
draw
-- Redraw the view
local
d: DIRECTORY
lin: ARRAYED_LIST [STRING]
s, ext: STRING
i: EV_LIST_ITEM
p: EV_PIXMAP
do
file_list.wipe_out
create d.make_open_read (directory_text.text)
if d.exists then
lin := d.linear_representation
from lin.start
until lin.exhausted
loop
s := lin.item
ext := s.twin
ext.keep_tail (3)
if equal (ext, "ico") or equal (ext, "png") then
create p
p.set_with_named_file (directory_dialog.directory + "\" + s)
create i.make_with_text (s)
i.set_pixmap (p)
i.set_pebble (directory_dialog.directory + "\" + s)
file_list.extend (i)
end
lin.forth
end
end
d.close
end
feature {NONE} -- Implementation
browse_button: EV_BUTTON
-- To open a directory dialog
directory_text: EV_TEXT
-- To display the directory (or path).
file_list: EV_LIST
-- To display the filenames of the files
directory_dialog: EV_DIRECTORY_DIALOG
-- The standard direcory selection dialog.
once
create Result
Result.set_start_directory ("d:/eiffel54/studio/bitmaps/ico")
Result.ok_actions.extend (agent on_directory_selected)
end
end

View File

@@ -0,0 +1,59 @@
note
description: "[
An EV_FIXED which is also a {VIEW}
]"
date: "12 Sep 03"
author: "Jimmy J. Johnson"
copyright: "Copyright 2012, Jimmy J. Johnson"
license: "Eiffel Forum License v2 (see forum.txt)"
URL: "$URL: file:///F:/eiffel_repositories/jj_vision/trunk/interface/views/fixed_view.e $"
date: "$Date: 2015-10-24 07:32:40 -0700 (Sat, 24 Oct 2015) $"
revision: "$Revision: 23 $"
class
FIXED_VIEW
inherit
VIEW
undefine
-- default_create,
copy,
is_equal
redefine
create_interface_objects,
initialize
end
EV_FIXED
rename
object_id as ise_object_id
undefine
is_in_default_state
redefine
create_interface_objects,
initialize
end
create
default_create
feature {NONE} -- Initialization
create_interface_objects
-- Create objects to be used by `Current' in `initialize'
-- Implemented by descendants to create attached objects
-- in order to adhere to void-safety due to the implementation bridge pattern.
do
Precursor {VIEW}
Precursor {EV_FIXED}
end
initialize
-- Create an editor view.
do
Precursor {EV_FIXED}
Precursor {VIEW}
end
end

View File

@@ -0,0 +1,57 @@
note
description: "[
A {VIEW} that is also an {EV_HORIZONTAL_SPLIT_AREA}
]"
author: "Jimmy J. Johnson"
copyright: "Copyright 2012, Jimmy J. Johnson"
license: "Eiffel Forum License v2 (see forum.txt)"
URL: "$URL: file:///F:/eiffel_repositories/jj_vision/trunk/interface/views/horizontal_split_view.e $"
date: "$Date: 2015-10-24 07:32:40 -0700 (Sat, 24 Oct 2015) $"
revision: "$Revision: 23 $"
class
HORIZONTAL_SPLIT_VIEW
inherit
EV_HORIZONTAL_SPLIT_AREA
undefine
is_in_default_state
redefine
create_interface_objects,
initialize
end
VIEW
undefine
-- default_create,
copy
redefine
create_interface_objects,
initialize
-- draw
end
create
default_create
feature {NONE} -- Initialization
create_interface_objects
-- Create objects to be used by `Current' in `initialize'
-- Implemented by descendants to create attached objects
-- in order to adhere to void-safety due to the implementation bridge pattern.
do
Precursor {VIEW}
Precursor {EV_HORIZONTAL_SPLIT_AREA}
end
initialize
-- Set up the widget
do
Precursor {VIEW}
Precursor {EV_HORIZONTAL_SPLIT_AREA}
draw
end
end

View File

@@ -0,0 +1,62 @@
note
description: "[
A {VIEW} combined with an EV_DRAWING_AREA
]"
author: "Jimmy J. Johnson"
copyright: "Copyright 2012, Jimmy J. Johnson"
license: "Eiffel Forum License v2 (see forum.txt)"
URL: "$URL: file:///F:/eiffel_repositories/jj_vision/trunk/interface/views/jj_drawing_area_view.e $"
date: "$Date: 2012-11-27 20:19:38 -0500 (Tue, 27 Nov 2012) $"
revision: "$Revision: 13 $"
class
JJ_DRAWING_AREA_VIEW
inherit
EV_DRAWING_AREA
undefine
is_in_default_state
redefine
create_interface_objects,
initialize
end
VIEW
undefine
copy
redefine
create_interface_objects,
initialize,
add_actions
end
create
default_create
feature {NONE} -- Initialization
create_interface_objects
-- Create objects to be used by `Current' in `initialize'
-- Implemented by descendants to create attached objects
-- in order to adhere to void-safety due to the implementation bridge pattern.
do
Precursor {VIEW}
Precursor {EV_DRAWING_AREA}
end
initialize
-- Set up the widget
do
Precursor {VIEW}
Precursor {EV_DRAWING_AREA}
-- set_actions
end
add_actions
do
resize_actions.force_extend (agent draw)
expose_actions.force_extend (agent draw)
end
end

View File

@@ -0,0 +1,121 @@
note
description : "[
This class ties together the concept of EV_FIGURE_WORLD, EV_DRAWING_AREA,
and EV_DRAWING_AREA_PROJECTOR in a simpler interface.
In order to fake out Eiffel Vision to allow a widget to be decreased in
size (I call this the `set_minimum_size' problem'), the drawing
area is contained in an EV_FIXED allowing the drawing area's size
to follow that of the fixed, and thereby, indirectly the size of the
parent window.
While this worked for the editor classes it does not seem to work here.
I don't know why. Is the problem with `resize_fixed' or with the fact
that, in the graphics program where it is used, I am also using the
"jj_vision" classes. Perhaps the problem is there.???
]"
date: "27 Sep 03"
author: "Jimmy J. Johnson"
copyright: "Copyright 2012, Jimmy J. Johnson"
license: "Eiffel Forum License v2 (see forum.txt)"
URL: "$URL: file:///F:/eiffel_repositories/jj_vision/trunk/interface/views/jj_figure_world_view.e $"
date: "$Date: 2012-05-31 14:05:35 -0400 (Thu, 31 May 2012) $"
revision: "$Revision: 10 $"
class
JJ_FIGURE_WORLD_VIEW
inherit
EV_FRAME
undefine
is_in_default_state
redefine
create_interface_objects,
initialize
end
VIEW
undefine
-- default_create,
copy
redefine
create_interface_objects,
initialize,
draw
end
create
default_create
feature {NONE} -- Initialization
create_interface_objects
-- Create objects to be used by `Current' in `initialize'
-- Implemented by descendants to create attached objects
-- in order to adhere to void-safety due to the implementation bridge pattern.
do
Precursor {VIEW}
Precursor {EV_FRAME}
create fixed
create world
create drawing_area
create projector.make (world, drawing_area)
end
initialize
-- Set up the widget
do
Precursor {VIEW}
Precursor {EV_FRAME}
extend (drawing_area)
set_actions
-- draw
end
set_actions
do
resize_actions.force_extend (agent draw)
drawing_area.expose_actions.force_extend (agent draw)
end
feature -- Access
world: EV_FIGURE_WORLD
-- World which Current will manipulate.
drawing_area: EV_DRAWING_AREA
-- Area on which `world' will be projected.
-- It is contained within a `fixed' area of Current.
-- Exported to allow direct drawing on it.
feature -- Element change
set_world (a_world: EV_FIGURE_WORLD)
-- Change the `world' of figures to be displayed
require
world_exists: a_world /= Void
do
world := a_world
projector.set_world (a_world)
end
feature {NONE} -- Drawing / Refresh operations
draw
-- Build the view
do
drawing_area.clear
if projector /= Void then
projector.full_project
end
end
feature {NONE} -- Implementation
projector: EV_DRAWING_AREA_PROJECTOR
-- For projecting the world onto the drawing area.
fixed: EV_FIXED
-- Container placed in the EV_FRAME to control size of `drawing_area'.
end

View File

@@ -0,0 +1,77 @@
note
description : "[
A scrollable drawing area (i.e. an {EV_MODEL_WORLD_CELL} that
is a {VIEW}.
]"
author: "Jimmy J. Johnson"
class
JJ_MODEL_WORLD_CELL_VIEW
inherit
VIEW
undefine
-- default_create,
copy,
is_equal
redefine
create_interface_objects,
initialize,
draw
end
EV_MODEL_WORLD_CELL
undefine
is_in_default_state
redefine
create_interface_objects,
initialize
end
create
make
feature {NONE} -- Initialization
create_interface_objects
-- Create objects to be used by `Current' in `initialize'
-- Implemented by descendants to create attached objects
-- in order to adhere to void-safety due to the implementation bridge pattern.
do
-- Must create `world' because not calling `make_with_world'
create world
Precursor {EV_MODEL_WORLD_CELL}
Precursor {VIEW}
is_autoscroll_enabled := true
end
initialize
-- Set up by calling both precursor versions
do
Precursor {EV_MODEL_WORLD_CELL}
Precursor {VIEW}
end
feature -- Basic operations
add_model (a_model: JJ_MODEL_WORLD_VIEW)
-- Add `a_model' to the `world' and set
-- the `parent' of `a_model'
do
world.extend (a_model)
a_model.set_parent_view (Current)
end
feature {NONE} -- Drawing / Refresh operations
draw
-- Build the view
do
drawing_area.clear
if projector /= Void then
projector.full_project
end
end
end

View File

@@ -0,0 +1,100 @@
note
description: "[
An {EV_MODEL_WORLD} that is also a {VIEW}.
It is a group of figures that allow redraws through the {VIEW}
class interface (e.g. when the underlying object model changes,
the views displaying that object can be redrawn.)
]"
author: "Jimmy J. Johnson"
date: "$Date$"
revision: "$Revision$"
class
JJ_MODEL_WORLD_VIEW
inherit
VIEW
redefine
-- default_create,
create_interface_objects,
draw
end
EV_MODEL_WORLD
redefine
default_create,
create_interface_objects
end
create
make
create {JJ_MODEL_WORLD_VIEW}
list_make
feature {NONE} -- Initialization
default_create
-- Standard creation procedure, added to align with the pattern
-- used by `default_create' from {EV_ANY}.
-- Remember, `make' from {VIEW} calls `default_create', which
-- in {EV_ANY} calls both `create_interface_objects' and later
-- `initialize'. However, `default_create' from {EV_MODEL_WORLD}
-- does NOT call `initialize'.
do
-- Precursor eventually calls `create_interface_objects'
Precursor {EV_MODEL_WORLD}
-- now, also call `initialzie'
initialize
end
create_interface_objects
-- Create objects to be used by `Current' in `initialize'.
-- Called by `defult_create'.
-- Implemented by descendants to create attached objects
-- in order to adhere to void-safety due to the implementation
-- bridge pattern.
do
Precursor {VIEW}
Precursor {EV_MODEL_WORLD}
end
feature -- Element change
parent: detachable EV_CONTAINER
-- Parent of the current view.
-- To be effected by joining with an EV_ class.
-- An {EV_MODEL_WORLD} as a descendent of {EV_MODEL} is to be
-- extended into an {EV_MODEL_WORLD_CELL}, which is an {EV_CONTAINER},
-- but there seems to be no way to determine this container.
do
check
do_not_call: False then
-- because can not return what is expected.
end
end
is_destroyed: BOOLEAN
-- Has the view been destroyed?
-- This will be joined with an EV_WIDGET feature.
-- See comment for feature `parent'.
do
-- check
-- do_not_call: False then
-- -- because can not return what is expected.
-- end
Result := false
end
feature -- Basic operations
draw
-- Redraw the window
do
-- world.wipe_out
-- world.full_redraw
Precursor {VIEW}
end
end

View File

@@ -0,0 +1,210 @@
note
description : "[
This class ties together the concept of EV_MODEL_WORLD, EV_DRAWING_AREA,
and EV_MODEL_DRAWING_AREA_PROJECTOR in a simpler interface. The drawing
area is contained in an EV_FIXED within an EV_SCROLLABLE_AREA,
allowing the
]"
date: "18 Jul 03"
author: "Jimmy J. Johnson"
copyright: "Copyright 2012, Jimmy J. Johnson"
license: "Eiffel Forum License v2 (see forum.txt)"
URL: "$URL: file:///F:/eiffel_repositories/jj_vision/trunk/interface/views/jj_scrollable_drawing_area_view.e $"
date: "$Date: 2012-06-11 16:54:43 -0400 (Mon, 11 Jun 2012) $"
revision: "$Revision: 11 $"
class
JJ_SCROLLABLE_DRAWING_AREA_VIEW
inherit
VIEW
undefine
copy
redefine
create_interface_objects,
initialize,
draw
end
EV_SCROLLABLE_AREA
undefine
is_in_default_state
redefine
create_interface_objects,
initialize
end
create
default_create
feature {NONE} -- Initialization
create_interface_objects
-- Create objects to be used by `Current' in `initialize'
-- Implemented by descendants to create attached objects
-- in order to adhere to void-safety due to the implementation bridge pattern.
do
Precursor {VIEW}
Precursor {EV_SCROLLABLE_AREA}
create fixed
create world
create drawing_area
create projector.make (world, drawing_area)
end
initialize
-- Set up the widget
do
Precursor {VIEW}
Precursor {EV_SCROLLABLE_AREA}
extend (fixed)
fixed.extend (drawing_area)
set_actions
end
set_actions
do
resize_actions.force_extend (agent draw)
resize_actions.extend (agent resize_fixed)
end
feature -- Access
world: EV_FIGURE_WORLD
-- World which Current will manipulate.
drawing_area: EV_DRAWING_AREA
-- Area on which `world' will be projected.
-- It is contained within a `fixed' area of Current.
-- Exported to allow direct drawing on it.
feature -- Element change
set_world (a_world: EV_FIGURE_WORLD)
-- Change the `world' of figures to be displayed
require
world_exists: a_world /= Void
do
world := a_world
projector.set_world (a_world)
end
feature {NONE} -- Drawing / Refresh operations
resize_fixed (a_x, a_y, a_width, a_height: INTEGER)
-- Change the size of `drawing_area' to be at least as big as the
-- scroll area but no bigger, by removing the old one area re-
-- extending it into `fixed'.
-- The parameters are there so the feature has the correct
-- signature but are not used in the calculations.
local
big_x, big_y: INTEGER
f: like fixed
do
-- Must check for parent because `parent_window' makes no
-- since if Current is not contained in some container.
if parent_window /= Void then
-- This feature is ineficient as is because of all the
-- re-parenting that is going on.
-- Must `lock_update' from EV_WINDOW to prevent
-- severe flickering on all the re-parenting.
parent_window.lock_update
-- Block the actions so don't get infinite loop
resize_actions.block
-- Create a new fixed with the correct size to
-- replace the wrong sized one.
create f
-- Transfer all the `drawing_area' to the new fixed
-- For some reason the `drawing_area' does not always have
-- parent `fixed' as expected; hence all the checks and the
-- statement to make the parent of `drawing_area' call `prune'.
fixed.start
fixed.prune (drawing_area)
check
not fixed.has (drawing_area)
end
if attached {EV_CONTAINER} drawing_area.parent as p then
p.prune (drawing_area)
end
check
drawing_area.parent = Void
end
f.extend (drawing_area)
-- Put any actions in `fixed' into the new fixed `f'.
f.conforming_pick_actions.merge_right (fixed.conforming_pick_actions)
f.drop_actions.merge_right (fixed.drop_actions)
f.pick_actions.merge_right (fixed.pick_actions)
f.pick_ended_actions.merge_right (fixed.pick_ended_actions)
f.focus_in_actions.merge_right (fixed.focus_in_actions)
f.key_press_actions.merge_right (fixed.key_press_actions)
f.key_press_string_actions.merge_right (fixed.key_press_string_actions)
f.key_release_actions.merge_right (fixed.key_release_actions)
f.pointer_button_press_actions.merge_right (fixed.pointer_button_press_actions)
f.pointer_button_release_actions.merge_right (fixed.pointer_button_release_actions)
f.pointer_double_press_actions.merge_right (fixed.pointer_double_press_actions)
f.pointer_enter_actions.merge_right (fixed.pointer_enter_actions)
f.pointer_leave_actions.merge_right (fixed.pointer_leave_actions)
f.pointer_motion_actions.merge_right (fixed.pointer_motion_actions)
f.resize_actions.merge_right (fixed.resize_actions)
-- Replace `fixed' with the new fixed, `f'.
replace (f)
-- Make the size of `drawing_area' at least as big as Current.
f.set_item_size (drawing_area, client_width.max (world.bounding_box.width), client_height.max (world.bounding_box.height))
-- f.set_item_size (drawing_area, width.max (world.bounding_box.width), height.max (world.bounding_box.height))
resize_actions.resume
parent_window.unlock_update
end
-- From here down would be used if `set_item_size' from
-- VIEWPORT worked properly. As of 26 Nov 02 ISE can not
-- answer why I get a post-condition violation on the
-- feature even though it passes the pre-conditions.
-- The calls to `item.set_minimum_width (50) were there
-- for testing and probably not needed if `set_item_size'
-- ever works.
---- from item.start
---- until item.exhausted
---- loop
---- c := item.item
---- big_x := (c.x_position + c.width).max (big_x)
---- big_y := (c.y_position + c.height).max (big_y)
---- item.forth
---- end
-- item.set_minimum_width (50)
-- item.set_minimum_height (50)
-- item.set_minimum_width (25)
---- if big_x < client_width or big_y < client_height then
------ if big_x < client_width then
------ set_item_width (client_width)
------ end
---- if big_y < client_height then
---- set_item_height (client_height)
---- end
------ set_item_size (client_width, client_height)
---- item.set_minimum_size (client_width, client_height)
---- else
---- set_item_size (big_x, big_y)
------ item.set_minimum_size (big_x, big_y)
---- end
end
draw
-- Build the view
do
drawing_area.clear
if projector /= Void then
projector.full_project
end
end
feature {NONE} -- Implementation
projector: EV_DRAWING_AREA_PROJECTOR
-- For projecting the world onto the drawing area.
fixed: EV_FIXED
-- Container placed in the EV_FRAME to facilitate
-- the placement of scrollbars and other widgets.
end

View File

@@ -0,0 +1,388 @@
note
description: "[
A {VIEW} which allows the editting of an {EDITABLE} in a
multi-column list.
]"
date: "24 Feb 04"
author: "Jimmy J. Johnson"
copyright: "Copyright 2012, Jimmy J. Johnson"
license: "Eiffel Forum License v2 (see forum.txt)"
URL: "$URL: file:///F:/eiffel_repositories/jj_vision/trunk/interface/views/list_editor_view.e $"
date: "$Date: 2012-05-31 14:05:35 -0400 (Thu, 31 May 2012) $"
revision: "$Revision: 10 $"
class
LIST_EDITOR_VIEW
inherit
EV_STOCK_COLORS
rename
implementation as colors_implementation
export
{NONE} all
undefine
default_create,
is_equal,
copy
end
EV_NOTEBOOK
rename
item as page,
selected_item as selected_page,
select_item as select_page,
set_item_text as set_page_text
undefine
is_in_default_state
redefine
create_interface_objects,
initialize
-- data,
-- set_data
end
VIEW
rename
target_imp as record_imp,
target as record,
set_target as set_record
undefine
-- default_create,
copy,
is_equal
redefine
create_interface_objects,
initialize,
record_imp
end
create
default_create
feature {NONE} -- Initialization
create_interface_objects
-- Create objects to be used by `Current' in `initialize'
-- Implemented by descendants to create attached objects
-- in order to adhere to void-safety due to the implementation bridge pattern.
do
Precursor {VIEW}
Precursor {EV_NOTEBOOK}
create changed_controls.make
create controls.make
create save_actions
create control_select_actions
end
initialize
-- Create an editor view.
do
Precursor {VIEW}
Precursor {EV_NOTEBOOK}
set_save_on_change
set_actions
end
set_actions
--
do
drop_actions.extend (agent on_drop_object)
-- selection_actions.extend (agent on_page_selected)
end
feature -- Access
-- record: EDITABLE
-- The object that contains the data to be editted.
-- Data in `record' is reached via feature `value (a_key)'.
schema: detachable SCHEMA
-- Describes how to build the controls which
-- will be used to edit `record'.
save_actions: EV_NOTIFY_ACTION_SEQUENCE
-- Actions to be performed after the record is saved.
control_select_actions: EV_NOTIFY_ACTION_SEQUENCE
-- Actions to be performed when a control is clicked.
feature -- Element change
set_schema (a_schema: like schema)
-- Change `schema' to `a_schema'.
require
schema_exists: a_schema /= Void
do
if schema /= a_schema then
schema := a_schema
build_pages
if record /= Void then
fill_controls
end
end
if record = Void then
disable_controls -- at least until user loads a record
end
ensure
schema_was_set: schema = a_schema
end
set_target (a_record: like record)
-- Change `record' to `a_record'
-- Reload the data into the controls
require
record_exists: a_record /= Void
do
record_imp := a_record
if not is_user_disabled then
enable_controls
end
fill_controls
ensure
record_was_set: record = a_record
end
feature -- Basic operations
disable
-- Make the controls unresponsive to input.
do
is_user_disabled := True
end
enable
-- Make the controls responsive to input.
do
is_user_disabled := False
end
feature -- Status report
is_user_disabled: BOOLEAN
-- Has the user requested the controls to be disabled?
is_save_on_change: BOOLEAN
-- Are changes made in the controls automatically
-- saved to `record'? In other words, is `record'
-- updated anytime a change is made, or must it
-- be done manually with a call to `save_record'?
feature -- Status setting
set_save_on_change
-- Make automatic updates to `record' whenever
-- a change is made in any control.
do
is_save_on_change := True
end
set_save_on_request
-- Require `save_record' to be called in order to
-- accept any changes make in any control.
do
is_save_on_change := False
end
feature -- Basic operations
disable_controls
-- Disable all controls.
local
c: CONTROL
do
from controls.start
until controls.exhausted
loop
c := controls.item
c.disable_sensitive
check attached c.parent as p then
p.set_foreground_color (Red)
p.propagate_foreground_color
end
controls.forth
end
end
enable_controls
-- Enable all controls.
local
c: CONTROL
do
from controls.start
until controls.exhausted
loop
c := controls.item
c.enable_sensitive
check attached c.parent as p then
p.set_foreground_color (Black)
p.propagate_foreground_color
end
controls.forth
end
end
feature {NONE} -- Implementation (actions)
on_drop_object (a_object: like record)
-- React to `a_object' dropping on Current.
require
object_exists: a_object /= Void
local
-- p: DATABASE_EDIT_TOOL
do
-- p ?= parent
-- if p /= Void then
-- parent_tool.set_object (a_object)
-- end
end
feature {NONE} -- Implementation
build_pages
-- Create a tab in the notebook for each schema_page in `schema'.
-- local
---- ep: EDITOR_PAGE
---- sa: EV_SCROLLABLE_AREA
-- sa: EDITOR_SCROLL_AREA
-- ef: EDITOR_FIXED
-- sp: SCHEMA_PAGE
-- f: FIELD
-- c: CONTROL
do
-- wipe_out
-- from schema.start
-- until schema.exhausted
-- loop
-- -- for each SCHEMA_PAGE in `schema', make a scroll
-- -- area and put it in Current (an EV_NOTEBOOK). This
-- -- will create a tabbed page for each page in the schema.
-- create sa
-- extend (sa)
-- select_page (sa)
-- sp := schema.item
-- set_page_text (sa, sp.name)
-- -- For each FIELD in the SCHEMA_PAGE create a CONTROL
-- -- and put it into the 'fixed' from EDITOR_SCROLL_AREA.
-- from sp.start
-- until sp.exhausted
-- loop
-- -- create a control from the field
-- f := sp.item
-- c := f.as_widget
-- -- add actions to each control as it is created
-- c.display.change_actions.extend (agent on_control_changed (c))
-- c.display.pointer_button_press_actions.force_extend (agent on_control_selected (c))
-- c.label.pointer_button_press_actions.force_extend (agent on_control_selected (c))
-- -- put the control into the fixed
-- sa.item.extend (c)
-- -- place the control in the correct spot
-- sa.position_control (c)
-- -- keep track of the control
-- controls.extend (c)
-- sp.forth
-- end
-- if is_user_disabled then
-- disable_controls
-- end
-- schema.forth
-- end
-- if record /= Void then
-- fill_controls
-- end
end
save_record
-- Get the data from each control and put it into the
-- the record if the data is valid.
require
record_exitsts: record /= Void
local
dat: ANY -- COMPARABLE -- data
con: CONTROL -- control
do
from changed_controls.start
until changed_controls.off
loop
con := changed_controls.item
if con.is_display_valid and then not con.field.is_calculated then
dat := con.value
record.extend_value (dat, con.field.id)
end
changed_controls.forth
end
save_actions.call ([])
changed_controls.wipe_out
end
fill_controls
-- Put the data from the record into the corresponding control
require
record_exists: record /= Void
local
key: STRING
con: CONTROL
do
from
controls.start
until
controls.exhausted
loop
key := controls.item.field.id
con := controls.item
if attached record.value (key) as dat then
con.set_data (dat)
end
con.refresh
controls.forth
end
end
feature {CONTROL} -- implementation
on_control_changed (a_control: CONTROL)
-- A change has been made to value in `a_control'
do
changed_controls.extend (a_control)
if is_save_on_change then
save_record
end
end
on_control_selected (a_control: CONTROL)
-- React to `a_control' being selected.
require
control_exists: a_control /= Void
do
control_select_actions.call ([a_control])
end
feature {NONE} -- Implementation
controls: LINKED_SET [CONTROL]
-- All the controls in the pages.
changed_controls: LINKED_SET [CONTROL]
-- Controls whose data has changed since last save
record_imp: detachable EDITABLE
-- Detachable implementation of `target' for void-safety
feature {NONE} -- Inaplicable
-- data: ANY
-- -- Not to be used
--
-- set_data (a_data: like data) is
-- -- Not to be used
-- do
-- check
-- False
-- end
-- end
invariant
invariant_clause: -- Your invariant here
end

View File

@@ -0,0 +1,52 @@
note
description: "[
A {VIEW} that can be split into multiple panes through calls
to feature `split_manager'. (See {SPLIT_MANAGER} or {TOOL}
for example.)
]"
author: "Jimmy J. Johnson"
date: "5/1/19"
deferred class
SPLIT_VIEW
inherit
-- VIEW
-- redefine
-- create_interface_objects
-- end
--feature {NONE} -- Initialization
-- create_interface_objects
-- -- Create objects to be used by `Current' in `initialize'
-- -- Implemented by descendants to create attached objects
-- -- in order to adhere to void-safety due to the implementation bridge pattern.
-- do
-- create split_manager
-- Precursor {VIEW}
-- end
feature -- Access
split_manager: SPLIT_MANAGER
-- Manages the placement of sub-views within current.
attribute
create Result
end
feature -- Element change
set_split_manager (a_manager: SPLIT_MANAGER)
-- Change `split_manager'
require
manager_exists: a_manager /= Void
do
split_manager := a_manager
ensure
manager_assigned: split_manager = a_manager
end
end

View File

@@ -0,0 +1,63 @@
note
description: "[
A {VIEW} in which to display text
]"
date: "4 Jan 08"
author: "Jimmy J. Johnson"
copyright: "Copyright 2012, Jimmy J. Johnson"
license: "Eiffel Forum License v2 (see forum.txt)"
URL: "$URL: file:///F:/eiffel_repositories/jj_vision/trunk/interface/views/text_view.e $"
date: "$Date: 2012-05-31 14:05:35 -0400 (Thu, 31 May 2012) $"
revision: "$Revision: 10 $"
class
TEXT_VIEW
inherit
EV_TEXT
undefine
is_in_default_state
redefine
create_interface_objects,
initialize
end
VIEW
undefine
copy
redefine
create_interface_objects,
initialize
end
create
default_create
feature {NONE} -- Initialization
create_interface_objects
-- Create objects to be used by `Current' in `initialize'
-- Implemented by descendants to create attached objects
-- in order to adhere to void-safety due to the implementation bridge pattern.
do
Precursor {VIEW}
Precursor {EV_TEXT}
end
initialize
-- Set up the widget
do
Precursor {VIEW}
Precursor {EV_TEXT}
set_actions
draw
end
set_actions
do
resize_actions.force_extend (agent draw)
end
end

View File

@@ -0,0 +1,56 @@
note
description: "[
A {VIEW} that is also an {EV_VERTICAL_SPLIT_AREA}
]"
author: "Jimmy J. Johnson"
copyright: "Copyright 2012, Jimmy J. Johnson"
license: "Eiffel Forum License v2 (see forum.txt)"
URL: "$URL: file:///F:/eiffel_repositories/jj_vision/trunk/interface/views/vertical_split_view.e $"
date: "$Date: 2015-10-24 07:32:40 -0700 (Sat, 24 Oct 2015) $"
revision: "$Revision: 23 $"
class
VERTICAL_SPLIT_VIEW
inherit
VIEW
undefine
-- default_create,
copy
redefine
create_interface_objects,
initialize
end
EV_VERTICAL_SPLIT_AREA
undefine
is_in_default_state
redefine
create_interface_objects,
initialize
end
create
default_create
feature {NONE} -- Initialization
create_interface_objects
-- Create objects to be used by `Current' in `initialize'
-- Implemented by descendants to create attached objects
-- in order to adhere to void-safety due to the implementation bridge pattern.
do
Precursor {VIEW}
Precursor {EV_VERTICAL_SPLIT_AREA}
end
initialize
-- Set up the widget
do
Precursor {VIEW}
Precursor {EV_VERTICAL_SPLIT_AREA}
draw
end
end

View File

@@ -0,0 +1,747 @@
note
description: "[
Used as common ancestor to all "windows" in a system built using the
"jj_vision" cluster. It provides a way through feature `draw_views'
for updating all the views which contain that `target'.
Alternatively, the view
can force the redraw of views containing any of several objects by passing
a set of changed objects to feature `draw_views_with_set'.
The class should be an ancestor ancestor along with
some effected EV_WIDGET.
NOTE: Views which are `is_destroyed' are removed from the global `views' set
in feature `draw_views'.
]"
date: "18 Jul 03"
author: "Jimmy J. Johnson"
copyright: "Copyright 2012, Jimmy J. Johnson"
license: "Eiffel Forum License v2 (see forum.txt)"
URL: "$URL: file:///F:/eiffel_repositories/jj_vision/trunk/interface/views/view.e $"
date: "$Date: 2015-10-24 07:32:40 -0700 (Sat, 24 Oct 2015) $"
revision: "$Revision: 23 $"
deferred class
VIEW
inherit
DIMABLE
undefine
default_create
redefine
set_dimming_level
end
SHARED
undefine
default_create
end
PIXEL_BUFFERS
undefine
default_create
end
--create
-- make
feature {NONE} -- Initialization
make (a_target: like target)
-- Create a new view to display `a_target'
do
-- This assignment is required to avoid violating a
-- precondition "not_empty" later when calling
-- feature `create_interface_objects".
target_imp := a_target
-- `default_create from:
-- 1) {EV_ANY} calls `create_interface_objects', later `initialize'
-- 2) {EV_MODEL calls only `create_interface_objects'
default_create
set_target (a_target) -- calls `draw'
-- draw
end
create_interface_objects
-- Create objects to be used by `Current' in `initialize'
-- Implemented by descendants to create attached objects
-- in order to adhere to void-safety due to the implementation
-- bridge pattern.
-- Called by `default_create' from {EV_ANY} or {EV_MODEL}
require
not_interface_objects_created: not is_interface_objects_created
do
create pixmap.make_with_pixel_buffer (Icon_new_class_color_buffer)
is_interface_objects_created := true
ensure
interface_objects_created: is_interface_objects_created
end
initialize
-- Initialize the view and insert it into a global list of views.
require
view_not_initialized: not is_view_initialized
do
-- initialize_dimable
dimming_level := Dim
previous_dimming_level := Dimmer
add_actions
is_view_initialized := True
ensure
initialized: is_view_initialized
end
add_actions
-- Add any actions to Current.
require
not_initialized: not is_view_initialized
do
pointer_button_press_actions.extend (agent on_prepick_right_click)
pick_actions.extend (agent on_picked)
pointer_motion_actions.extend (agent on_postput_move)
end
feature -- Status report
is_interface_objects_created: BOOLEAN
-- Has `create_interface_objects' been called?
is_view_initialized: BOOLEAN
-- Has `initialize' been called?
is_pick_notifiable: BOOLEAN
-- Should Current be notified by other views (normally
-- a view contained in Current) that some event has
-- occurred?
-- Feature `set_parent_view' must have been called on
-- the child view for this to take effect.
has_parent_view: BOOLEAN
-- Does Current know the view in which it resides?
do
Result := attached parent_view_imp
end
feature -- Access
application: JJ_APPLICATION
-- The application in which Current resides.
do
check attached {JJ_APPLICATION} (create {EV_ENVIRONMENT}).application as app then
-- because this class is for use in a {JJ_APPLICATION}.
Result := app
end
end
pixmap: EV_PIXMAP
-- The pixmap associated with this view
-- application: JJ_APPLICATION is
-- -- Convience feature for obtaining the current application.
-- local
-- app: JJ_APPLICATION
-- once
-- app ?= (create {EV_ENVIRONMENT}).application
-- check
-- jj_application_exists: app /= Void
-- -- Because VIEWs are used in JJ_APPLICATIONs.
-- end
-- ensure
-- result_exists: Result /= Void
-- end
-- command_manager: COMMAND_MANAGER is
-- -- Manages the COMMAND's called by the system to allow undo/redo capabilities.
-- -- (This is a handle to the `command_manager' from a JJ_APPLICATION; putting it
-- -- here instead of in SHARED allows redefinition of the `command_manager' in
-- -- descendents of JJ_APPLICATION.
-- once
-- Result := application.command_manager
-- end
frozen target: attached like target_imp
-- The primary target in this view. This feature along with
-- `set_target' allows the view to handle one target specially.
require
not_empty: not is_view_empty
do
check attached target_imp as t then
Result := t
end
end
parent_window: JJ_MAIN_WINDOW
-- The {JJ_MAIN_WINDOW} if any which contains this view.
-- Must redefine to change type.
do
check attached {EV_CONTAINABLE} Current as c then
Result := recursive_parent_window (c)
end
ensure
valid_result: Result /= Void
end
parent_tool: detachable TOOL
-- The TOOL, if any, in which Current resides.
local
con: detachable EV_CONTAINER
do
from con := parent
until Result /= Void or else con = Void
loop
if attached {TOOL} con as t then
Result := t
else
con := con.parent
end
end
end
parent_view: attached like parent_view_imp
-- The view in which Current resides.
-- Provides a way for a model view to notify a parent
-- container of changes
require
has_parent_view: has_parent_view
do
check attached parent_view_imp as p then
Result := p
end
end
parent: detachable EV_CONTAINER
-- Parent of the current view.
-- To be effected by joining with an EV_ class
deferred
end
state: VIEW_STATE
-- A snapshot of the current look of the view
do
create Result.make (Current)
end
feature -- Element change
set_target (a_target: like target)
-- Change the value of `target' and realign the table or list
-- of views in which `a_target' is displayed.
do
-- print ("VIEW.set_target: a_target = " + target.out + "%N")
-- Remove the old association
if attached target_imp and then target /= a_target then
check
has_associated_view: views_table.has (target)
-- because `target_imp' not Void and `make'
end
views_table.prune (Current)
target_imp := Void
end
if target_imp = Void then
-- the expected case, except of initial creation
-- print ("VIEW.set_target: if statement target_imp = Void %N")
target_imp := a_target
views_table.extend (Current)
elseif not views_table.has_view (Current) then
-- print ("VIEW.set_target: not views_table.has (Current) %N")
check
same_object: target_imp = a_target
-- because of assignment statement in `make'
end
views_table.extend (Current)
end
draw
ensure
has_target: has_target (a_target)
end
set_parent_view (a_view: VIEW)
-- Set `parent_view' to `a_view', allowing Current to
-- notify `a_view' of some event (e.g. right click).
do
parent_view_imp := a_view
end
set_dimming_level (a_level: like dimming_level)
-- Change the `dimming_level'
do
Precursor (a_level)
-- paint
end
feature -- Basic operations
-- paint
-- -- Draw the current view when some property like
-- -- background color changes
-- do
-- end
draw
-- Draw the current view.
-- Default does nothing
require
view_is_drawable: not is_draw_disabled
do
end
draw_other_views (a_target: ANY)
-- Draw all views that contain `a_target' except Current
-- This also cleans any "destroyed" views from the `views' set.
require
target_exists: a_target /= Void
local
b: BOOLEAN
do
b := is_draw_disabled
disable_drawing
draw_views (a_target)
if not b then
enable_drawing
end
end
draw_views (a_target: ANY)
-- Draw the views which contain `a_target'.
local
lin: LINEAR [VIEW]
marks: LINKED_SET [VIEW] -- Views marked for removal.
v: VIEW
do
create marks.make
lin := views_table.linear (a_target)
from lin.start
until lin.after
loop
v := lin.item
if v.is_destroyed then
marks.extend (v)
elseif not v.is_draw_disabled then
v.draw
end
lin.forth
end
-- Clean out any views that are no longer usable.
from marks.start
until marks.exhausted
loop
views_table.prune (marks.item)
marks.forth
end
end
draw_views_with_set (a_set: LINEAR [ANY])
-- Draw the views which contain any of the objects in `a_set'.
-- This also cleans any "destroyed" views from the `views' set.
require
set_exists: a_set /= Void
local
lin: LINEAR [VIEW]
marks: LINKED_SET [VIEW] -- Views marked for removal.
v: VIEW
do
create marks.make
lin := views_table.linear_with_set (a_set)
from lin.start
until lin.after
loop
v := lin.item
if v.is_destroyed then
marks.extend (v)
elseif not v.is_draw_disabled then
v.draw
end
lin.forth
end
-- Clean out any views that are no longer usable.
from marks.start
until marks.exhausted
loop
views_table.prune (marks.item)
marks.forth
end
end
draw_all_views
-- Draw *all* the views in the system.
-- Also cleans any "destroyed" views for the `views' set.
local
lin: LINEAR [VIEW]
marks: LINKED_SET [VIEW] -- Views marked for removal.
v: VIEW
do
create marks.make
lin := views_table.linear_representation
from lin.start
until lin.after
loop
v := lin.item
if v.is_destroyed then
marks.extend (v)
elseif not v.is_draw_disabled then
v.draw
end
lin.forth
end
-- Clean out any views that are no longer usable.
from marks.start
until marks.exhausted
loop
views_table.prune (marks.item)
marks.forth
end
end
feature -- Status report
is_in_default_state: BOOLEAN = true
-- Is `Current' in its default state?
-- The intent of this class is to be joined with an EV_WIDGET.
-- The default state of a descendent is most likely not the same
-- as the default state of the parent EV_WIDGET (after all, a
-- new type widget is being defined that, by definition looks
-- different from the parent.)
-- This silly feature is the post-condition of `default_create'
-- from EV_WIDGET, which required a choice--either redefine this
-- feature in every EV_WIDGET descendant or, as chosen here, use
-- this version (the EV_WIDGET version is irrelavent anyway) and
-- undefine it in the inherit class of the EV_WIDGET parent.
is_destroyed: BOOLEAN
-- Has the view been destroyed?
-- This will be joined with an EV_WIDGET feature
deferred
end
is_view_empty: BOOLEAN
-- Are there no objects in this VIEW?
do
Result := target_imp = Void
end
is_draw_disabled: BOOLEAN
-- Can the view be drawn using 'draw'?
feature -- Status setting
disable_drawing
-- Block the view from being redrawn by calling draw.
-- Used to reduce number of calls to draw.
do
is_draw_disabled := True
ensure
drawing_not_allowed: is_draw_disabled
end
enable_drawing
-- Allow the view to be redrawn on a call to draw.
do
is_draw_disabled := False
ensure
drawing_allowed: not is_draw_disabled
end
feature -- Query
has_target (a_target: like target): BOOLEAN
-- Does Current contain `a_target'?
do
Result := target_imp = a_target
end
display_name (a_object: ANY): STRING
-- An identifying "out" value corresponding to `a_object'.
require
object_exists: a_object /= Void
do
if attached {EDITABLE} a_object as e then
Result := e.display_name
else
Result := "fix me"
print ("VIEW.display_name -- get from once table?")
end
ensure
result_exists: Result /= Void
end
yes_cursor (a_target: ANY): EV_POINTER_STYLE
-- Cursor for `a_target'.
do
create Result.make_with_pixel_buffer (Icon_new_class_color_buffer, 0, 0)
end
no_cursor (a_target: ANY): EV_CURSOR
-- Cursor for `a_target'.
do
create Result
end
linear (a_object: ANY): LINEAR [VIEW]
-- List of views in which `a_object' is displayed. The
-- resulting list could be empty.
do
Result := views_table.linear (a_object)
end
linear_with_set (a_set: LINEAR [ANY]): LINEAR [VIEW]
-- List of views in which any of the objects in `a_set'
-- is displayed.
do
Result := views_table.linear_with_set (a_set)
end
frozen post_pick_move_agent: PROCEDURE [TUPLE [a_x, a_y: INTEGER;
a_x_tilt, a_y_tilt, a_pressure: DOUBLE;
a_screen_x, a_screen_y: INTEGER]]
-- Creates an agent out of `on_postput_move' which is added to
-- the `pointer_motion_actions' of *ALL* views when a pick occurs
-- (see `on_picked'). Holding on to this agent as a once feature
-- allows `on_postput_move' to remove this agent from *ALL* the
-- views after the pick has ended and the mouse is moved [in one
-- of the views].
once
Result := agent on_postput_move
end
feature -- Basic operations
target_changed_operations
-- This feature is called by `notify_views' to perform
-- actions when that view's `target' was modified.
do
print ("{VIEW}.target_changed_operations %N")
end
pick_notified_operations (a_target: ANY)
-- React to the pick of `a_target' from some view
do
print ("{VIEW}.pick_notified_operations on {" + generating_type.name + "}%N")
end
pick_ended_operations
-- React to the end of a pick and drop operation
do
print ("{VIEW}.pick_ended_operations on {" + generating_type.name + "} %N")
end
feature {NONE} -- Agents and support (actions)
frozen on_prepick_right_click (x, y, button: INTEGER;
x_tilt, y_tilt, pressure: DOUBLE;
screen_x, screen_y: INTEGER)
-- Notify the parent of all views that contain `target'
-- that a pick event occurred involving `target'.
local
lin: LINEAR [VIEW]
marks: LINKED_SET [VIEW] -- Views marked for removal.
v: VIEW
do
-- is_picking.set_item (true)
create marks.make
lin := views_table.linear (target)
from lin.start
until lin.after
loop
v := lin.item
if v.is_destroyed then
marks.extend (v)
elseif v.has_parent_view then
-- Notifiy the parent view of the pick
v.parent_view.pick_notified_operations (target)
-- Save the view for notification when pick ends
pick_notified_views.extend (v.parent_view)
end
lin.forth
end
-- Clean out any views that are no longer usable.
from marks.start
until marks.exhausted
loop
views_table.prune (marks.item)
marks.forth
end
end
frozen on_picked (a_x, a_y: INTEGER)
-- Notify the parent of all views that contain `target'
-- that a pick event occurred involving `target'.
local
lin: LINEAR [VIEW]
marks: LINKED_SET [VIEW] -- Views marked for removal.
v: VIEW
do
is_picking.set_item (true)
-- create marks.make
-- lin := views_table.linear (target)
-- from lin.start
-- until lin.after
-- loop
-- v := lin.item
-- if v.is_destroyed then
-- marks.extend (v)
-- elseif v.has_parent_view then
-- -- Notifiy the parent view of the pick
-- v.parent_view.pick_notified_operations (target)
-- -- Save the view for notification when pick ends
-- pick_notified_views.extend (v.parent_view)
-- end
-- lin.forth
-- end
-- -- Clean out any views that are no longer usable.
-- from marks.start
-- until marks.exhausted
-- loop
-- views_table.prune (marks.item)
-- marks.forth
-- end
end
frozen on_postput_move (a_x, a_y: INTEGER;
a_x_tilt, a_y_tilt, a_pressure: DOUBLE;
a_screen_x, a_screen_y: INTEGER)
-- Feature added as agent to `pointer_motion_actions'
-- to react after a pnp operations has ended. It calls
-- feature `postput_operations'.
-- Redefine `postput_operations' to clean up any operations
-- that occurred in `do_prepick_operations'.
-- See index clause for information on pick-and-put.
local
v: VIEW
do
print ("{VIEW}.on_postput_move on " + generating_type.name + "%N")
-- Notify views when a transport has ended.
if is_picking.item and then not application.transport_in_progress then
print ("%T `is_picking and not transport_in_progress pick_notified_views.count = " + pick_notified_views.count.out + "%N")
is_picking.set_item (false)
-- Inform any parent views that the pick has ended
from pick_notified_views.start
until pick_notified_views.after
loop
v := pick_notified_views.item
v.pick_ended_operations
pick_notified_views.forth
end
pick_notified_views.wipe_out
end
end
notify_changed (a_target: ANY)
-- Inform the views that have `a_target' that `a_target'
-- has changed (i.e. call `on_target_changed' for those
-- views).
-- This also cleans any "destroyed" views from the `views' set.
local
lin: LINEAR [VIEW]
marks: LINKED_SET [VIEW] -- Views marked for removal.
v: VIEW
do
create marks.make
lin := views_table.linear (a_target)
from lin.start
until lin.after
loop
v := lin.item
if v.is_destroyed then
marks.extend (v)
elseif not v.is_draw_disabled then
v.target_changed_operations
end
lin.forth
end
-- Clean out any views that are no longer usable.
from marks.start
until marks.exhausted
loop
views_table.prune (marks.item)
marks.forth
end
end
frozen is_picking: BOOLEAN_REF
-- Is a pick-and-put (PNP) operation in progress?
-- It seems the PNP operations intercepts events system-
-- wide, so this is a global reference.
-- See index clause for information on pick-and-put.
once
create Result
end
pick_notified_views: LINKED_SET [VIEW]
-- List of views that were notfied by `on_picked'
once
create Result.make
end
feature -- Action sequences
pointer_button_press_actions: EV_POINTER_BUTTON_ACTION_SEQUENCE
-- Actions to be performed when screen pointer button is pressed.
-- Defined here as place-holder to be undefined (i.e. joined) to
-- the version from {EV_WIDGET} or {EV_MODEL}.
-- See index clause for information on pick-and-put.
deferred
end
pointer_motion_actions: EV_POINTER_MOTION_ACTION_SEQUENCE
-- Actions to be performed when screen pointer moves.
-- Defined here as place-holder to be undefined (i.e. joined) to
-- the version from {EV_WIDGET} or {EV_MODEL}.
-- See index clause for information on pick-and-put.
deferred
end
pick_actions: EV_PND_START_ACTION_SEQUENCE
-- Actions to be performed when `pebble' is picked up.
-- Defined here as place-holder to be undefined by some
-- {EV_WIDGET} or {EV_MODEL}.
deferred
end
drop_actions: EV_PND_ACTION_SEQUENCE --EV_PND_START_ACTION_SEQUENCE
-- Actions to be performed when a pebble is dropped here.
deferred
end
feature {NONE} -- Implementation
recursive_parent_window (a_containable: EV_CONTAINABLE): JJ_MAIN_WINDOW
-- The {JJ_MAIN_WINDOW} which contains this tool.
-- This procedure was provided by Julian Rodgers from the Eiffel
-- users group.
do
check attached {EV_CONTAINER} a_containable.parent as cur_parent then
-- because parent of EV_CONTAINABLE must be an EV_CONTAINER
if attached {JJ_MAIN_WINDOW} cur_parent as w then
Result := w
else
check attached {EV_CONTAINABLE} cur_parent as con_parent then
-- because, if `cur_parent' is not a {JJ_MAIN_WINDOW} it must be EV_CONTAINABLE
Result := recursive_parent_window (con_parent)
end
end
end
ensure
result_exists: Result /= Void
end
feature {NONE} -- Implemetation
target_imp: detachable ANY
-- Detachable implementation of `target' for void safety
views_table: VIEW_TARGET_TABLE
-- Global table associating objects to views
once
create Result
end
parent_view_imp: detachable VIEW
-- Detachable implementation of `parent_view'
invariant
-- not_empty: target_imp /= Void
end

View File

@@ -0,0 +1,290 @@
note
description: "[
A {VIEW} placed in a {PREFERENCES_WINDOW} for setting the
startup and appearance attributes of a {JJ_MAIN_WINDOW}
]"
date: "12 Sep 03"
author: "Jimmy J. Johnson"
copyright: "Copyright 2012, Jimmy J. Johnson"
license: "Eiffel Forum License v2 (see forum.txt)"
URL: "$URL: file:///F:/eiffel_repositories/jj_vision/trunk/interface/views/window_preferences_view.e $"
date: "$Date: 2015-10-24 07:32:40 -0700 (Sat, 24 Oct 2015) $"
revision: "$Revision: 23 $"
class
WINDOW_PREFERENCES_VIEW
inherit
SHARED
undefine
default_create,
is_equal
end
FIXED_VIEW
undefine
copy
redefine
create_interface_objects,
initialize
end
create
default_create
feature {NONE} -- Initialization
create_interface_objects
-- Create objects to be used by `Current' in `initialize'
-- Implemented by descendants to create attached objects
-- in order to adhere to void-safety due to the implementation bridge pattern.
do
Precursor {FIXED_VIEW}
create apply_to_label
create apply_to_combo_box
create hide_menu_check_button
create hide_button_text_check_button
create button_size_label
create button_size_spin_button.make_with_value_range (create
{INTEGER_INTERVAL}.make (Minimum_pixmap_size, Maximum_pixmap_size))
create language_combo_box
create start_up_options_label
create height_label
create height_spin_button
create width_label
create width_spin_button
create x_position_label
create x_position_spin_button
create y_position_label
create y_position_spin_button
create mode_label
create mode_combo_box
end
initialize
-- Set up the dialog
do
Precursor {FIXED_VIEW}
hide_menu_check_button.align_text_left
hide_button_text_check_button.align_text_right
-- height_spin_button.align_text_left
-- width_spin_button.align_text_left
-- x_position_spin_button.align_text_left
-- y_position_spin_button.align_text_left
extend (apply_to_label)
extend (apply_to_combo_box)
extend (hide_menu_check_button)
extend (hide_button_text_check_button)
extend (button_size_label)
extend (button_size_spin_button)
extend (language_combo_box)
extend (start_up_options_label)
extend (height_label)
extend (height_spin_button)
extend (width_label)
extend (width_spin_button)
extend (x_position_label)
extend (x_position_spin_button)
extend (y_position_label)
extend (y_position_spin_button)
extend (mode_label)
extend (mode_combo_box)
build_widgets
set_actions
end
feature {NONE} -- Basic operations
build_widgets
-- Set the apperance and location of all the controls
local
do
-- Fix so it looks up these interface items
apply_to_label.set_text ("Apply these changes to")
apply_to_combo_box.extend (create {EV_LIST_ITEM}.make_with_text ("All"))
apply_to_combo_box.extend (create {EV_LIST_ITEM}.make_with_text ("New"))
hide_menu_check_button.set_text ("Hide menu bar")
hide_button_text_check_button.set_text ("Hide button text")
language_combo_box.set_text ("English")
start_up_options_label.set_text ("Start-up options")
height_label.set_text ("Height")
width_label.set_text ("Width")
x_position_label.set_text ("X position")
y_position_label.set_text ("Y position")
mode_label.set_text ("Select mode")
button_size_label.set_text ("Button size")
set_item_position (apply_to_label, Spacing, Spacing)
set_item_position (apply_to_combo_box,
apply_to_label.x_position + apply_to_label.width + Spacing,
apply_to_label.y_position)
set_item_position (hide_menu_check_button,
Spacing,
apply_to_combo_box.y_position + apply_to_combo_box.height + Spacing)
set_item_position (hide_button_text_check_button,
Spacing,
hide_menu_check_button.y_position + hide_menu_check_button.height + Spacing)
set_item_position (button_size_label,
Spacing,
hide_button_text_check_button.y_position + hide_button_text_check_button.height + Spacing)
set_item_position (button_size_spin_button,
button_size_label.x_position + button_size_label.width + Spacing,
button_size_label.y_position)
set_item_position (language_combo_box,
Spacing,
button_size_spin_button.y_position + button_size_spin_button.height + Spacing)
set_item_position (start_up_options_label,
Spacing,
language_combo_box.y_position + language_combo_box.height + Spacing)
set_item_position (height_label,
Spacing + Spacing,
start_up_options_label.y_position + start_up_options_label.height + 2)
set_item_position (height_spin_button,
height_label.x_position + height_label.width + Spacing,
height_label.y_position)
set_item_position (width_label,
Spacing + Spacing,
height_spin_button.y_position + height_spin_button.height + Spacing)
set_item_position (width_spin_button,
height_spin_button.x_position,
width_label.y_position)
set_item_position (x_position_label,
height_spin_button.x_position + height_spin_button.width + Spacing + Spacing,
height_label.y_position)
set_item_position (x_position_spin_button,
x_position_label.x_position + x_position_label.width + Spacing,
x_position_label.y_position)
set_item_position (y_position_label,
x_position_label.x_position,
width_label.y_position)
set_item_position (y_position_spin_button,
y_position_label.x_position + y_position_label.width + Spacing,
y_position_label.y_position)
set_item_position (mode_label,
Spacing,
width_label.y_position + width_label.height + Spacing + Spacing)
set_item_position (mode_combo_box,
mode_label.x_position + mode_label.width + Spacing,
mode_label.y_position)
end
set_actions
-- Add agents to the controls
do
hide_menu_check_button.select_actions.extend (agent on_hide_menu_option_changed)
hide_button_text_check_button.select_actions.extend (agent on_hide_button_text_check_button_changed)
button_size_spin_button.change_actions.extend (agent on_button_size_spin_button_changed)
end
feature {NONE} -- Basic operations
on_hide_menu_option_changed
-- React to a change of the `hide_menu_check_button' by showing ro hiding
-- the menu bar in all the main windows in the system
local
mw: JJ_MAIN_WINDOW
do
from main_windows.start
until main_windows.exhausted
loop
mw := main_windows.item
if not hide_menu_check_button.is_selected and then mw.menu_bar = Void then
mw.show_menu
else
mw.hide_menu
end
main_windows.forth
end
end
on_hide_button_text_check_button_changed
-- React to a change of the `hide_button_text_check_button' by showing or hiding
-- text on all the buttons in the systems `main_windows'.
local
mw: JJ_MAIN_WINDOW
do
from main_windows.start
until main_windows.exhausted
loop
mw := main_windows.item
if hide_button_text_check_button.is_selected then
mw.hide_button_text
else
mw.show_button_text
end
main_windows.forth
end
end
on_button_size_spin_button_changed (a_value: INTEGER)
-- React to a change of the `button_size_spin_button' by changing the
-- size of the toolbar buttons in the system's `main_window'.
do
io.put_string ("Fix me! WINDOW_PREFERENCES_VIEW.on_button_size_spin_button_changed %N")
end
feature {NONE} -- Implementation
apply_to_label: EV_LABEL
-- Label to go with `apply_to_combo_box'
apply_to_combo_box: EV_COMBO_BOX
-- Apply settings to one or all windows in system
hide_menu_check_button: EV_CHECK_BUTTON
-- Check to show main menu
hide_button_text_check_button: EV_CHECK_BUTTON
-- Check to display text along with the pixmaps on buttons.
button_size_label: EV_LABEL
-- Label to go with `button_size_spin_button'.
button_size_spin_button: EV_SPIN_BUTTON
-- Sets the size of the pixmaps (and consequently the size of the buttons).
language_combo_box: EV_COMBO_BOX
-- Select the language to use
start_up_options_label: EV_LABEL
-- Simply a heading saying "Start up options".
height_label: EV_LABEL
-- Label to go with `height_spin_button'
height_spin_button: EV_SPIN_BUTTON
-- Sets the start-up height of a MAIN_WINDOW
width_label: EV_LABEL
-- Label to go with `height_spin_button'
width_spin_button: EV_SPIN_BUTTON
-- Sets the start-up width of a MAIN_WINDOW
x_position_label: EV_LABEL
-- Label to to with `x_position_spin_button
x_position_spin_button: EV_SPIN_BUTTON
-- Sets the start-up `x_position' of a MAIN_WINDOW
y_position_label: EV_LABEL
-- Label to to with `y_position_spin_button
y_position_spin_button: EV_SPIN_BUTTON
-- Sets the start-up `y_position' of a MAIN_WINDOW
mode_label: EV_LABEL
-- Label to go with `mode_combo_box'
mode_combo_box: EV_COMBO_BOX
-- Select the start-up mode of a MAIN_WINDOW
feature {NONE} -- Implementation (constants)
Spacing: INTEGER = 10
end