int MIOText_GetMaxRow (void) { MIO_CheckOuputIsToWindow ("maxrow"); MIO_CheckOuputWindowIsInGraphicsMode ("maxrow"); return MIOWin_GetInfo (MIO_selectedRunWindow) -> maxRow; } // MIOText_GetMaxRow
void MIOMouse_Where (OOTint *pmX, OOTint *pmY, OOTint *pmButtonUpDown) { int myButtonUpDown; MIO_CheckOuputIsToWindow ("Mouse.Where"); MIO_CheckOuputWindowIsInGraphicsMode ("Mouse.Where"); MIO_MakePopupWindowVisible (); MDIOWinGraph_GetMousePos (MIO_selectedRunWindow, pmX, pmY, &myButtonUpDown); // Convert the internal representation of the button to the Turing one. *pmButtonUpDown = 0; if (stMultiButtonMode) { if (myButtonUpDown & LEFT_BUTTON) *pmButtonUpDown += 1; else if (myButtonUpDown & MIDDLE_BUTTON) *pmButtonUpDown += 10; else if (myButtonUpDown & RIGHT_BUTTON) *pmButtonUpDown += 100; } else { if (myButtonUpDown != 0) *pmButtonUpDown = 1; } } // MIOMouse_Where
int MIOText_GetCurrentRow (void) { MIO_CheckOuputIsToWindow ("Text.WhatRow"); MIO_CheckOuputWindowIsInGraphicsMode ("Text.WhatRow"); return MIOWin_GetInfo (MIO_selectedRunWindow) -> actualRow + 1; } // MIOText_GetCurrentRow
int MIOText_GetCurrentColourBack (void) { MIO_CheckOuputIsToWindow ("Text.WhatColorBack"); MIO_CheckOuputWindowIsInGraphicsMode ("Text.WhatColorBack"); return MIOWin_GetInfo (MIO_selectedRunWindow) -> textBGColour; } // MIOText_GetCurrentColourBack
void MIOMouse_Show (void) { MIO_CheckOuputIsToWindow ("Mouse.Show"); MIO_CheckOuputWindowIsInGraphicsMode ("Mouse.Show"); MIO_MakePopupWindowVisible (); // TW Fill in } // MIOMouse_Show
void MIOMouse_SetPosition (OOTint pmX, OOTint pmY) { MIO_CheckOuputIsToWindow ("Mouse.SetPosition"); MIO_CheckOuputWindowIsInGraphicsMode ("Mouse.SetPosition"); MIO_MakePopupWindowVisible (); // TW Fill in } // MIOMouse_SetPosition
void MIOMouse_Hide (void) { MIO_CheckOuputIsToWindow ("Mouse.ButtonMoved"); MIO_CheckOuputWindowIsInGraphicsMode ("Mouse.ButtonMoved"); MIO_MakePopupWindowVisible (); // TW Fill in } // MIOMouse_Hide
int MIOMouse_ButtonMoved (OOTstring pmString) { MIO_CheckOuputIsToWindow ("Mouse.ButtonMoved"); MIO_CheckOuputWindowIsInGraphicsMode ("Mouse.ButtonMoved"); MIO_MakePopupWindowVisible (); return MIOMouse_ButtonMoved1 (MyConvertButtonString (pmString)); } // MIOMouse_ButtonMoved
void MIOText_SetColour (OOTint pmClr) { MIOWinInfoPtr myInfo = MIOWin_GetInfo (MIO_selectedRunWindow); MIO_CheckOuputIsToWindow ("Text.Color"); MIO_CheckOuputWindowIsInGraphicsMode ("Text.Color"); MIO_CheckColourRange (pmClr); myInfo -> textColour = pmClr; } // MIOText_SetColour
void MIOText_LocateXY (OOTint pmX, OOTint pmY) { MIOWinInfoPtr myInfo = MIOWin_GetInfo (MIO_selectedRunWindow); int myRow, myCol; MIO_CheckOuputIsToWindow ("Text.LocateXY"); MIO_CheckOuputWindowIsInGraphicsMode ("Text.LocateXY"); myRow = (myInfo -> height - pmY - 1) / myInfo -> fontCharHeight + 1; myCol = pmX / myInfo -> fontCharWidth + 1; MIOText_Locate (myRow, myCol); } // MIOText_LocateXY
void MIOMouse_ButtonWait (OOTstring pmString, OOTint *pmX, OOTint *pmY, OOTint *pmButtonNumber, OOTint *pmButtonUpDown) { int myMotionType = MyConvertButtonString (pmString); MIOWinInfoPtr myInfo = MIOWin_GetInfo (MIO_selectedRunWindow); MOUSEPOINT *myPtr; EventDescriptor myEvent; MIO_CheckOuputIsToWindow ("Mouse.ButtonWait"); MIO_CheckOuputWindowIsInGraphicsMode ("Mouse.ButtonWait"); MIO_MakePopupWindowVisible (); if (MIOMouse_ButtonMoved1 (myMotionType)) { while (myInfo -> mouseBufferTail != myInfo -> mouseBufferHead) { myPtr = &myInfo -> mouseBuffer [myInfo -> mouseBufferTail]; myInfo -> mouseBufferTail = INC(myInfo -> mouseBufferTail); if (myPtr -> buttonDirection & myMotionType) { *pmX = myPtr -> x; *pmY = myPtr -> y; *pmButtonNumber = 1; if (stMultiButtonMode) { if (myPtr -> button == LEFT_BUTTON) *pmButtonNumber = 1; else if (myPtr -> button == MIDDLE_BUTTON) *pmButtonNumber = 2; else if (myPtr -> button == RIGHT_BUTTON) *pmButtonNumber = 3; } if (myPtr -> buttonDirection = BUTTON_UP) *pmButtonUpDown = 1; else *pmButtonUpDown = 0; return; } // if (myPtr -> buttonDirection & myMotionType) } // while // TW - Internal Error! } // There is no mouse event in the queue. Wait for the event myEvent.mode = EventMode_MouseButton; myEvent.count = myMotionType; Language_Execute_EventQueueInsert ((int) NULL, &myEvent); } // MIOMouse_ButtonWait
OOTint MIOSprite_New (OOTint pmPicID, SRCPOS *pmSrcPos) { SpriteInfo *mySpriteInfo; char myAllocMessage [4096]; static int myStSpriteCount = 1; MIO_CheckOuputIsToWindow ("Sprite.New"); MIO_CheckOuputWindowIsInGraphicsMode ("Sprite.New"); MIO_MakePopupWindowVisible (); mySpriteInfo = (SpriteInfo *) malloc (sizeof (SpriteInfo)); if (mySpriteInfo == NULL) { SET_ERRNO (E_PIC_CANT_ALLOC_MEM_FOR_PIC); return 0; } // mySpriteInfo -> picID = pmPicID; MIOPic_GetInfoForSprite (pmPicID, &(mySpriteInfo -> picWidth), &(mySpriteInfo -> picHeight), &(mySpriteInfo -> picTransparentColour), &(mySpriteInfo -> picMDPicInfo)); mySpriteInfo -> x = MIO_selectedRunWindowInfo -> width / 2; mySpriteInfo -> y = MIO_selectedRunWindowInfo -> height / 2; mySpriteInfo -> spriteRect = MyGetSpriteRect (mySpriteInfo); mySpriteInfo -> spriteHeight = FOREGROUND_HEIGHT + myStSpriteCount; mySpriteInfo -> centered = FALSE; mySpriteInfo -> visible = FALSE; myStSpriteCount++; MDIO_sprintf (myAllocMessage, "Allocated from picture %d", pmPicID); mySpriteInfo -> spriteID = MIO_IDAdd (SPRITE_ID, mySpriteInfo, pmSrcPos, myAllocMessage, NULL); // Couldn't allocate an identifier. Return the default font ID. if (mySpriteInfo -> spriteID == 0) { MyFreeSprite (mySpriteInfo); return 0; } MIOPic_IncremementSpriteUse (pmPicID); MyAddToQueue (MIO_selectedRunWindowInfo, mySpriteInfo); return mySpriteInfo -> spriteID; } // MIOSprite_New
void MIOText_Locate (OOTint pmRow, OOTint pmCol) { MIOWinInfoPtr myInfo = MIOWin_GetInfo (MIO_selectedRunWindow); char myMessage [1024]; MIO_CheckOuputIsToWindow ("Text.Locate"); MIO_CheckOuputWindowIsInGraphicsMode ("Text.Locate"); if (pmRow < 1) { MDIO_sprintf (myMessage, "Row of %d is less than 1", pmRow); ABORT_WITH_ERRMSG (E_TEXT_ROW_TOO_SMALL, myMessage); } if (pmRow > myInfo -> maxRow) { MDIO_sprintf (myMessage, "Row of %d is greater than maxrow (%d)", pmRow, myInfo -> maxRow); ABORT_WITH_ERRMSG (E_TEXT_ROW_TOO_LARGE, myMessage); } if (pmCol < 1) { MDIO_sprintf (myMessage, "Column of %d is less than 1", pmCol); ABORT_WITH_ERRMSG (E_TEXT_COL_TOO_SMALL, myMessage); } if (pmCol > myInfo -> maxCol) { MDIO_sprintf (myMessage, "Column of %d is greater than maxcol (%d)", pmCol, myInfo -> maxCol); ABORT_WITH_ERRMSG (E_TEXT_COL_TOO_LARGE, myMessage); } myInfo -> row = pmRow - 1; myInfo -> col = pmCol - 1; myInfo -> actualRow = myInfo -> row; myInfo -> actualCol = myInfo -> col; // Display the caret, if appropriate MIOWin_CaretDisplay (MIO_selectedRunWindow); } // MIOText_Locate
xxx #endif /**********/ /* Macros */ /**********/ /*************/ /* Constants */ /*************/ /********************/ /* Global variables */ /********************/ /*********/ /* Types */ /*********/ /**********************/ /* External variables */ /**********************/ /********************/ /* Static constants */ /********************/ /********************/ /* Static variables */ /********************/ /******************************/ /* Static callback procedures */ /******************************/ /*********************/ /* Static procedures */ /*********************/ /***********************/ /* External procedures */ /***********************/ /************************************************************************/ /* MIOText_Cls */ /************************************************************************/ void MIOText_Cls (void) { MIOWinInfoPtr myInfo = MIOWin_GetInfo (MIO_selectedRunWindow); BOOL myOldXOR; MIO_CheckOuputIsToWindow ("Text.Cls"); MIO_CheckOuputWindowIsInGraphicsMode ("Text.Cls"); MIO_MakePopupWindowVisible (); // Implemented simply as a drawfillbox of the entire screen in the // text background color myOldXOR = myInfo -> xor; myInfo -> xor = FALSE; MIODraw_Box (0, 0, myInfo -> width - 1, myInfo -> height - 1, NO_STYLE, NORMAL_WIDTH, myInfo -> textBGColour, FILL); myInfo -> xor = myOldXOR; // Set the cursor positon to upper-left corner myInfo -> actualCol = 0; myInfo -> actualRow = 0; myInfo -> row = 0; myInfo -> col = 0; myInfo -> startInputRow = 0; myInfo -> startInputCol = 0; // Display the caret, if appropriate MIOWin_CaretDisplay (MIO_selectedRunWindow); } // MIOText_Cls