Aiditemlist PMLFRM
Aiditemlist PMLFRM
--
-- Copyright 1974 to current year. AVEVA Solutions Limited and its subsidiaries.
All rights reserved in original code only.
--
-- File: aiditemlist.pmlfrm
-- Type: Form Definition
-- Group: Aid element handlers
-- Keyword: AID
-- Module: common
-- Replaces:
--
-- Author: N.Holmes
-- Created: Fri Feb 13 17:50:43 WAT 1998
--
--
-- Description:
-- Aid constructor control form.
--
------------------------------------------------------------------------
--
-- Methods defined:
--
-- Method call Return Description
-- =========== ====== ===========
-- aidItemList() - Constructor
-- delete(STRING) - Delete selected entries
-- edit() - Show graphic aid
definition form
-- initialise() - Initialisation for form
-- limits() - Set view limits to
selected entries from the list
-- load() - Load graphics from file
-- save() - Save graphics to file
-- select(GADGET,STRING) - Select entry
-- selectAll() - Select all elements in
current list
-- selectType() - Select aid type
-- setupMenus() - Setup menus
-- string() STRING Accessible description of
form
-- tag(BOOLEAN) - Tag passed item
-- tag(MENU,STRING) - Tag selection
-- unSelect() -
-- visible(BOOLEAN) - Remove selected entries
from the list
--
------------------------------------------------------------------------
-- Define form
setup form !!aidItemList
Import 'pmlfilebrowser'
handle any
endhandle
-- Bar menu
bar
exit
-- Options
option .type 'Aid type ' callback '!!aidItemList.selectType()' width 14
-- Available Items
list .aids at xmin ymax callback '!!aidItemList.select(' multiple width 40
length 10
-- Form Members
member .label is BOOLEAN
member .detail is BOOLEAN
exit
-- End of form definition for !!aidItemList
------------------------------------------------------------------------
--
-- Method: aidItemList
--
-- Description:
-- Constructor
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
-- Control menu
!menu = !this.newMenu('controlMenu')
!menu.add('CALLBACK', 'Save as...', '!this.save()')
!menu.add('CALLBACK', 'Load from...', 'call !!fileBrowser(|%AVEVA_DESIGN_USER
%|, ''*.pmldat'', ''Load Construction Graphics'', true, ''!!aidItemList.load()'')')
!menu.add('separator')
!menu.add('CALLBACK', 'Close', '!this.hide()')
-- Edit Menu
!menu = !this.newMenu('editMenu')
!menu.add('CALLBACK', 'Definition...', '!this.edit()')
!menu.add('separator')
!menu.add('CALLBACK', 'Select all', '!this.selectAll()')
!menu.add('CALLBACK', 'Unselect', '!this.unSelect()')
-- Display Menu
!menu = !this.newMenu('displayMenu')
!menu.add('CALLBACK', 'Show', '!this.visible(true)')
!menu.add('CALLBACK', 'Limits', '!this.limits()')
!menu.add('CALLBACK', 'Hide', '!this.visible(false)')
!menu.add('separator')
!menu.add('CALLBACK', 'Tag', '!this.tag(true)')
!menu.add('CALLBACK', 'Untag', '!this.tag(false)')
!menu = !this.newMenu('settingsMenu')
!menu.add('TOGGLE', 'Label', '!this.tag(')
!menu.add('TOGGLE', 'Detail', '!this.tag(')
-- Delete menu
!menu = !this.newMenu('deleteMenu')
!menu.add('CALLBACK', 'Selected', '!this.delete(''selected'')')
!menu.add('separator')
!menu.add('CALLBACK', 'All current aid type', '!this.delete(''alltype'')')
!menu.add('CALLBACK', 'All aid types', '!this.delete(''everything'')')
!this.label = true
!this.detail = false
!this.settingsMenu.select('Label', !this.label)
!this.settingsMenu.select('Detail', !this.detail)
endmethod
-- End of method definition for .aidItemList()
------------------------------------------------------------------------
--
-- Method: initialise
--
-- Description:
-- Initialisation for form
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
endmethod
-- End of method definition for .initialise()
------------------------------------------------------------------------
--
-- Method: setupMenus
--
-- Description:
-- Setup menus
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
!this.deleteMenu.setActive('Selected', false)
!this.editMenu.setActive('Unselect', false)
!this.editMenu.setActive('Definition...', false)
else
!this.deleteMenu.setActive('Selected', true)
!this.editMenu.setActive('Definition...', true)
!this.editMenu.setActive('Unselect', true)
endif
endif
endmethod
-- End of method definition for .setupMenus()
------------------------------------------------------------------------
--
-- Method: string
--
-- Description:
-- Accessible description of form
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- Return:
-- [Data Type] [Description]
-- STRING Return
--
------------------------------------------------------------------------
endmethod
-- End of method definition for .string() STRING
------------------------------------------------------------------------
--
-- Method: selectType
--
-- Description:
-- Select aid type
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
-- Initialise Variables
-- Elements selected
!rText = !!aidConstructors.definedText(!this.type.selection('RTEXT').upcase())
enddo
endif
!this.aids.dText = !dText
!this.aids.rText = !rText
-- Setup menus
!this.setupMenus()
endmethod
-- End of method definition for .selectType()
------------------------------------------------------------------------
--
-- Method: delete
--
-- Description:
-- Delete selected entries
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- 1 R STRING Option :
-- ALLTYPE - delete all for current type
-- SELECTED - delete all selected
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
-- Select all
if(!option.upcase() eq 'SELECTED') then
!!aidConstructors.remove(!this.type.selection('RTEXT').upcase(),!
this.aids.selection())
-- All aids
elseif (!option.upcase() eq 'EVERYTHING') then
!!aidConstructors.remove()
endif
-- Update list
!this.selectType()
endmethod
-- End of method definition for .delete(STRING)
------------------------------------------------------------------------
--
-- Method: select
--
-- Description:
-- Select entry
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
-- Initialise Variables
-- Setup menus
!this.setupMenus()
endmethod
-- End of method definition for .select(GADGET, STRING)
------------------------------------------------------------------------
--
-- Method: selectAll
--
-- Description:
-- Select all elements in current list
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
!this.aids.select('RTEXT', !array)
-- Setup menus
!this.setupMenus()
endmethod
-- End of method definition for .selectAll()
------------------------------------------------------------------------
--
-- Method: unselect
--
-- Description:
-- Unselected, selected entries
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
-- Unselect entries
!this.aids.clearSelection()
-- Setup menus
!this.setupMenus()
endmethod
-- End of method definition for .unSelect()
------------------------------------------------------------------------
--
-- Method: visible
--
-- Description:
-- Remove selected entries from the list
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- 1 R BOOLEAN Visible state
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
endmethod
-- End of method definition for .visible(BOOLEAN)
------------------------------------------------------------------------
--
-- Method: limits
--
-- Description:
-- Set view limits to selected entries from the list
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
!object = !!aidNumbers.numbers[!selection[!i].real()]
!objectType = !object.objectType()
if (!objectType inset ('GPHLINEARGRID','GPHRADIALGRID','GPHPLANTGRID')) then
-- Current Data
!position = !object.grid.position.wrt(world)
if (!i eq 1) then
!minumumEast = !position.east
!minumumNorth = !position.north
!minumumUp = !position.up
!maximumEast = !position.east
!maximumNorth = !position.north
!maximumUp = !position.up
endif
!fromPosition = !position
!fromPosition.east = (min((!fromPosition.east - !minValue), !minumumEast))
!fromPosition.north = (min((!fromPosition.north - !minValue), !minumumNorth))
!fromPosition.up = (min((!fromPosition.up - !minValue), !minumumUp))
!toPosition = !position
!toPosition.east = (max((!toPosition.east + !maxValue), !maximumEast))
!toPosition.north = (max((!toPosition.north + !maxValue), !maximumNorth))
!toPosition.up = (max((!toPosition.up + !maxValue), !maximumUp))
!minumumEast = !fromPosition.east
!minumumNorth = !fromPosition.north
!minumumUp = !fromPosition.up
!maximumEast = !toPosition.east
!maximumNorth = !toPosition.north
!maximumUp = !toPosition.up
endmethod
-- End of method definition for .limits()
------------------------------------------------------------------------
--
-- Method: tag
--
-- Description:
-- Tag passed item
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- 2 R BOOLEAN tag state
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
-- Select item
if(!state) then
!label = !this.label
!detail = !this.detail
-- Unselect item
else
!label = false
!detail = false
endif
endmethod
-- End of method definition for .tag(BOOLEAN)
------------------------------------------------------------------------
--
-- Method: tag
--
-- Description:
-- Tag selection
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- 1 R MENU Selected Menu
-- 2 R STRING Select State
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
-- Initialise Variables
!option = !menu.pickedField
-- State
if(!select eq 'SELECT') then
!state = true
else
!state = false
endif
endmethod
-- End of method definition for .tag(MENU, STRING)
------------------------------------------------------------------------
--
-- Method: edit
--
-- Description:
-- Show graphic aid definition form
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
-- Edit definition
!!aidNumbers.numbers[!selected].edit(!selected)
endmethod
-- End of method definition for .edit()
------------------------------------------------------------------------
--
-- Method: save
--
-- Description:
-- Save graphics to file
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
-- Initialise Variables
!file = !!file(!browser.file())
endmethod
-- End of method definition for .save()
------------------------------------------------------------------------
--
-- Method: load
--
-- Description:
-- Load graphics from file
--
-- Method Type: Function/Procedure
-- Arguments:
-- [#] [R/RW] [Data Type] [Description]
-- Return:
-- [Data Type] [Description]
--
------------------------------------------------------------------------
-- Initialise Variables
!file = !!fileBrowser.file
endmethod
-- End of method definition for .load()