; ; tmsWS.sh ; ; Internal workspace layout for tearoff menus ; ; © 1994-1998 Straylight ; ;----- Licensing note ------------------------------------------------------- ; ; This file is part of Straylight's Sapphire library. ; ; Sapphire is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2, or (at your option) ; any later version. ; ; Sapphire is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with Sapphire. If not, write to the Free Software Foundation, ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ;----- Macros --------------------------------------------------------------- MACRO $label SKIP $mask,$size,$reg1,$reg2 $label TST $reg1,#$mask ADDNE $reg2,$reg2,#$size MEND MACRO $label SKPITEM $reg1,$reg2 $label SKIP mFlag_shade,4,$reg1,$reg2 SKIP mFlag_iShade,4,$reg1,$reg2 SKIP mFlag_switch,4,$reg1,$reg2 SKIP mFlag_radio,8,$reg1,$reg2 SKIP mFlag_sprite,8,$reg1,$reg2 SKIP mFlag_subMenu,8,$reg1,$reg2 MEND ;----- Useful values -------------------------------------------------------- mFlag_tearoff EQU (1<<1) ;Menu has a tearoff bar mFlag_makeMe EQU (1<<2) ;Recreate menu on adjust mFlag_maxHeight EQU (1<<3) ;Menu has a maximum height mFlag_global EQU (1<<4) ;Menu is `global' for app mFlag_indirect EQU (1<<0) ;Item text is indirected mFlag_shortcut EQU (1<<1) ;Item has a keyboard shortcut mFlag_iShortcut EQU (1<<2) ;Item has an indirected S/C mFlag_shade EQU (1<<3) ;Item is shadable mFlag_iShade EQU (1<<4) ;Item is inverse shadable mFlag_switch EQU (1<<5) ;Item is a switch mFlag_radio EQU (1<<6) ;Item is a radio item mFlag_sprite EQU (1<<7) ;Menu item has a sprite mFlag_halfSize EQU (1<<8) ;Sprite is halfsize mFlag_subWarn EQU (1<<9) ;Warn client if submenu warn mFlag_subMenu EQU (1<<10) ;Item has menu to be opened mFlag_R12 EQU (1<<16) ;Use R12 for runtime data mFlag_noWarn EQU (1<<17) ;Don't warn on shaded items mFlag_ruleOff EQU (1<<18) ;Put a ruleoff after item mFlag_end EQU (1<<31) ;No more items ; --- Event types --- mEvent_select EQU 0 ;Normal menu selection ; R1 == index of item mEvent_arrow EQU 1 ;Sub menu warning ; R1 == index of item mEvent_deleted EQU 2 ;Menu has been deleted mEvent_help EQU 3 ;Menu help requested ; R1 == ndex of item ; R2 == ptr to packed itmdef ;----- The TWIN global area ------------------------------------------------- ^ 0 twin_flags # 4 ;Various useful flags twin_trans # 4 ;The current transient window twin_tmsHook # 4 ;A hook to the TMS system twin_size # 0 ;The size of the global area twinFlag_recrt EQU (1<<0) ;Menu will be recreated ;----- Workspace ------------------------------------------------------------ ; --- Header definition for each menu --- ^ 0 hText # 4 ;Pointer to the text string hMaxHeight # 4 ;The maximum height of menu hHandler # 4 ;The handler to call hR10 # 4 ;The R10 value to use hR12 # 4 ;The R12 value to use hDefinition # 4 ;Pointer to packed definition hFlags # 4 ;The flags for the menu hHandle # 4 ;The window handle of menu hPrevMenu # 4 ;Pointer to the previous menu hSprWidth # 4 ;The width of widest sprite hTextWidth # 4 ;The width of the menu hKeyWidth # 4 ;Width of longest keystring hTitleWidth # 4 ;Width of the title hTotWidth # 4 ;The total width hHeight # 4 ;The height of the menu hSelected # 4 ;The currently selected item hSubMenu # 0 ;Pointer to current submenu hDbox # 4 ;Ooooo... a union hNextTorn # 4 ;Pointer to the next torn off hFromItem # 4 ;The item menu was from hItems # 4 ;Pointer to the items hSize # 0 ;Size of the header defn ; --- Header flags --- hFlag__tearable EQU (1<<0) ;The menu is tearable hFlag__torn EQU (1<<1) ;The menu has been torn off hFlag__folded EQU (1<<2) ;The menu has been folded hFlag__scrBar EQU (1<<3) ;The menu has a scrollbar hFlag__warned EQU (1<<4) ;Client's been warned submenu hFlag__tIndir EQU (1<<5) ;Title data is indirected hFlag__global EQU (1<<6) ;Menu is `global' for app hFlag__dbox EQU (1<<15) ;There is a dbox ; --- The item definition --- ^ 0 iNumber # 4 ;The number of items in group iDefinition # 4 ;Pointer to the icon defn iHandler # 4 ;Pointer to the event handler iR10 # 4 ;R10 value to use iR12 # 4 ;R12 value to use iItems # 4 ;Pointer to next grp of items iHdrSize # 0 ;Size of this structure ^ 0 iText # 4 ;Pointer to the text string iKeyCode # 4 ;Code of keyboard shortcut iFlags # 4 ;The item flags iyCoord # 4 ;The y coordinate of the item iSubMenu # 0 ;Menu handle of sub menu iDbox # 4 ;Exciting isn't it! iSprName # 4 ;Pointer to sprite name iSprArea # 4 ;And its sprite area iSprCsum # 4 ;Checksum of sprite name iItemSize # 0 ;Size of this structure ; --- Item flags --- iFlag__shaded EQU (1<<0) ;The item is shaded iFlag__ticked EQU (1<<1) ;The item is ticked iFlag__radio EQU (1<<2) ;The item is splodged iFlag__dotted EQU (1<<3) ;The item is folled by a line iFlag__arrow EQU (1<<4) ;The item has an arrow iFlag__sprite EQU (1<<5) ;The item has a sprite iFlag__halfSize EQU (1<<6) ;Display sprite at half size iFlag__noWarn EQU (1<<7) ;Don't warn on shaded items iFlag__dbox EQU (1<<15) ;Item has a dialogue box iFlag__newTick EQU (1<<27) ;Need to redraw ticks etc. iFlag__newSpr EQU (1<<28) ;Need to redraw sprite iFlag__newText EQU (1<<29) ;Text of item has changed iFlag__newKey EQU (1<<30) ;Key string has changed iFlag__newArrow EQU (1<<31) ;Need to redraw arrow thingy ; --- Miscellaneous values --- tms__barHeight EQU 24 ;The height of tearoff bar ; --- Program workspace --- ^ 0,R12 tms__wStart # 0 tms__flags # 4 ;The flags word tms__twin # 4 ;Address of the TWIN area tms__zInit # 0 ;Zero-inited part of wspace tms__current # 4 ;The current transient menu tms__tornoffs # 4 ;Pointer to list of torn offs tms__prevLevel # 4 ;Previous menu to opened from tms__orgTearoff # 4 ;The originating tearoff tms__itemOver # 4 ;Ptr into packed defn to item tms__itemBlock # 4 ;Ptr to item block of item tms__currItem # 4 ;Ptr to the current item tms__currDbox # 4 ;The current dbox handle tms__dboxPrev # 4 ;Menu that dbox came from tms__creating # 4 ;Ptr to header of new menu tms__lastItems # 4 ;Ptr to last item blk created tms__recreating # 4 ;Ptr to menu being recreated tms__coords # 8 ;(x,y) for menu tms__oldHandle # 4 ;Hnd passed to idle claimer tms__itemIndex # 4 ;Index into defn of item tms__alarmMenu # 4 ;Menu alarm is for tms__alarmItem # 4 ;Item alarm is for tms__zSize EQU {VAR}-tms__zInit ;Size of zero-inited bit tms__fHandle # 4 ;The current wimp font handle tms__R11 # 4 ;Address of the scratchpad tms__wSize EQU {VAR}-tms__wStart ; --- Program flags --- tFlag__inited EQU (1<<0) ;We are initialised tFlag__iBar EQU (1<<1) ;The click was on icon bar tFlag__riscos3 EQU (1<<2) ;We are on RISC OS 3 tFlag__overArrow EQU (1<<3) ;We are over RHS of a menu tFlag__close EQU (1<<4) ;Close the transient tFlag__newFont EQU (1<<5) ;There has been a font change tFlag__nActive EQU (1<<6) ;Menus are not active tFlag__subWait EQU (1<<7) ;We're waiting for a submenu tFlag__doFake EQU (1<<8) ;Fake a NULL event tFlag__faking EQU (1<<9) ;We are faking a NULL event ;----- That's all, folks ---------------------------------------------------- END