; 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.Mouse ;--------------------------------------------------------------------------- ; Mouse_Click ; ; In: r1 -> mouse data block ; Out: r0 corrupted ; ; Handle mouse clicks. ; Mouse_Click ENTRY "r1-r6" LDMIA r1, {r2-r6} ; Load x,y,buttons,window,icon. TST r4, #button_left + button_right BNE click_select TST r4, #button_middle EXIT EQ click_menu CMP r5, #-2 ; If it's the icon bar menu then ADREQ r1, m_iconbarmenu SUBEQ r2, r2, #64 ; adjust x position MOVEQ r3, #96 + 2*44 ; set y position BEQ show_menu ; and display it. LDR lr, display_handle TEQ r5, lr ; If it's not the main display window then EXIT NE ; nothing to do. TEQ r6, #ic_display_colbutton BLEQ set_icon_xy ADREQ r1, m_coloursmenu BEQ show_menu TEQ r6, #ic_display_resbutton BLEQ set_icon_xy LDREQ r1, m_resolutionmenu BEQ show_menu [ SelectFrameRate TEQ r6, #ic_display_ratebutton EXIT NE BL Menu_Rate EXIT VS LDRB lr, flags TST lr, #f_ratemenuvalid EXIT EQ BL set_icon_xy LDR r1, m_ratemenu | EXIT NE ] show_menu TEQ r1, #0 BLNE Menu_Show EXIT click_select CMP r5, #-2 ; If it's not the icon bar then BNE %FT10 ; must be on a window icon. BL Mode_Init ; Initialise for current mode. LDR r0, display_handle ; Open window at top of stack. STR r0, [r1] BL Window_Close MOV r1, #-1 SUB r2, r2, #64 ; Adjust x position. MOV r3, #136 ; Set y position. BL Window_OpenBehind EXIT 10 LDR lr, display_handle TEQ r5, lr ; If it's not the main display window then BNE %FT20 ; try another. TEQ r6, #ic_display_colbutton TSTEQ r4, #button_right ; Only show menu for select. BLEQ set_icon_xy ADREQ r1, m_coloursmenu BEQ show_menu TEQ r6, #ic_display_resbutton TSTEQ r4, #button_right ; Only show menu for select. BLEQ set_icon_xy LDREQ r1, m_resolutionmenu BEQ show_menu [ SelectFrameRate TEQ r6, #ic_display_ratebutton TSTEQ r4, #button_right ; Only show menu for select. BNE %FT15 BL Menu_Rate EXIT VS LDRB lr, flags TST lr, #f_ratemenuvalid EXIT EQ BL set_icon_xy LDR r1, m_ratemenu B show_menu 15 ] TEQ r6, #ic_display_ok ; If not OK then try next. BNE %FT18 BL Mode_ChangeMode ; Try to change mode. EXIT VS ; Always leave window open after error. TST r4, #button_right ADREQ r1, user_data ; If select used then close dialogue. STREQ r5, [r1] BLEQ Window_Close ; Preserves flags. EXIT 18 TEQ r6, #ic_display_cancel ; If not Cancel then don't care what it was. EXIT NE TST r4, #button_right ADREQ r1, user_data ; Select used on Cancel so close dialogue. STREQ r5, [r1] BLEQ Window_Close ; Preserves flags. EXIT EQ BL Mode_Init ; Adjust used on Cancel so restore icons. BLVC Icon_Refresh EXIT 20 LDR lr, mode_handle TEQ r5, lr ; If it's not the mode window TEQEQ r6, #ic_mode_ok ; or it is but it's not the OK button then EXIT NE ; give up. BL Mode_WimpCommand ; Change mode. TST r4, #button_right ; If adjust clicked then LDRNE r1, menu_handle ; show menu again MOVEQ r1, #0 ; else remove menu and dialogue. STREQ r1, menu_handle MOVEQ r1, #-1 SWI XWimp_CreateMenu EXIT ;--------------------------------------------------------------------------- ; set_icon_xy ; ; In: r5 = window ; r6 = icon ; ; Out: r2 = x coord of icon top right ; r3 = y coord of icon top right ; flags preserved ; ; Return x,y coords for pop up menu. ; set_icon_xy ENTRY "r0,r1,r4,r5" ADR r1, user_data STMIA r1, {r5,r6} SWI XWimp_GetIconState EXITS VS ADD r1, r1, #16 LDMIA r1, {r4,r5} ADR r1, user_data SWI XWimp_GetWindowInfo LDRVC r2, [r1, #4] LDRVC r3, [r1, #16] ADDVC r2, r2, r4 ADDVC r3, r3, r5 EXITS END