; Copyright 1996 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
;     http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
; > Sources.Front

;-----------------------------------------------------------------------------
;       Workspace layout.
;
workspace       RN      R12
                ^       0,workspace
wsorigin                #       0

task_handle             #       4       ; Must be first word of workspace.
private_word            #       4       ; Pointer to our private word.
pollword                #       4       ; Poll word for Wimp_Poll.

icon_handle             #       4       ; Icon bar icon handle.
info_handle             #       4       ; Info window handle.
mode_handle             #       4       ; Mode dialogue window handle.
display_handle          #       4       ; Main display window handle.
menu_handle             #       4       ; Last menu displayed.

indirected_data         #       4       ; Pointer to indirected window data.
mode_indirect           #       4       ; Pointer to indirect data for mode icon.
mode_size               #       4       ; Size of indirect data for mode icon.
resolution_indirect     #       4       ; Pointer to indirect data for resolution icon.
resolution_size         #       4       ; Size of indirect data for resolution icon.
colours_indirect        #       4       ; Pointer to indirect data for colours icon.
colours_size            #       4       ; Size of indirect data for colours icon.
 [ SelectFrameRate
rate_indirect           #       4       ; Pointer to indirect data for rate icon.
rate_size               #       4       ; Size of indirect data for rate icon.
 ]
title_indirect          #       4       ; Pointer to indirect data for title bar.
title_size              #       4       ; Size of indirect data for title bar.

mode_space              #       0       ; The following point into the same allocated space.
mode_sortedlist         #       4       ; Pointer to sorted list of mode pointers (into mode_table).
mode_classlist          #       4       ; Pointer to list of mode class pointers (into mode_sortedlist).
mode_menulist           #       4       ; Pointer to list of class list pointers (into mode_classlist).
mode_table              #       4       ; Pointer to table of available modes.
m_resolutionmenu        #       4       ; Pointer to resolution menu.
m_resolutionsize        #       4       ; Amount of space reserved for resolution menu.
 [ SelectFrameRate
m_ratemenu              #       4       ; Pointer to rate menu.
m_ratesize              #       4       ; Amount of space reserved for rate menu.
 ]

mode_count              #       4       ; Number of available modes.
selected_subclass       #       4       ; Pointer to currently selected subclass (into mode_sortedlist).
selected_mode           #       4       ; Pointer to currently selected mode descriptor.
 [ LoadModeFiles
scrap_ref               #       4       ; So we know when to delete scrap file.
 ]

message_file_block      #       4*4
wimp_palette            #       16

flags                   #       1       ; Module flags.
selected_colours        #       1       ; Menu item selected from colours menu.
selected_class          #       1       ; Index into mode_classlist for currently selected class.
resolution_count        #       1       ; Number of items in the resolution menu.
 [ SortOnPixelShape
class_count             #       1       ; Number of classes.
 ]
 [ SelectFrameRate
rate_count              #       1       ; Number of items in the rate menu.
 ]
menu_tick               #       1       ; Ticked item on current menu.

                        #       3:AND:(-:INDEX:@)

user_data_size          *       &100
user_data               #       user_data_size
stack_bottom            #       &100
stack_top               #       0

ram_menustart           #       0
m_iconbarmenu           #       m_headersize + mi_size * 2
mm_info                 *       m_iconbarmenu + m_headersize + mi_submenu + mi_size * 0
mm_mode                 *       m_iconbarmenu + m_headersize + mi_submenu + mi_size * 1
m_coloursmenu           #       m_headersize + mi_size * 8
ram_menuend             #       0

max_running_work   *       :INDEX:@

        ! 0, "Display Manager workspace is ":CC:(:STR:(:INDEX:@)):CC:" bytes"


;-----------------------------------------------------------------------------
;       Useful declarations.
;
max_banner_size *       60              ; Maximum length of module title string.
poll_mask       *       null_bit + pointerchange_bits + pollwordfast_enable

; Global flags.
f_greylevel     *       2_00000001      ; Current mode is grey level.
f_messagesopen  *       2_00000010      ; Messages file is open.
f_ratemenuvalid *       2_00000100      ; Rate menu is valid.

; Mode descriptor.
                        ^       0
mode_desc_size          #       4
mode_desc_flags         #       4
mode_desc_xres          #       4
mode_desc_yres          #       4
mode_desc_depth         #       4
mode_desc_rate          #       4
mode_desc_name          #       0       ; Null terminated, word aligned string.

; Mode specifier.
                        ^       0
mode_spec_flags         #       4
mode_spec_xres          #       4
mode_spec_yres          #       4
mode_spec_depth         #       4
mode_spec_rate          #       4
mode_spec_vars          #       0       ; Mode variables, terminated by word -1.

; Poll word non-zero flags.
pf_refreshicons         *       1:SHL:0
pf_modeinit             *       1:SHL:1
pf_settitle             *       1:SHL:2

 [ SortOnPixelShape
flags_squarepixel       *       1:SHL:31
 ]

bignum                  *       &0FFFFFFF

        END