diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 2c4b1051..ecca6342 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -1,4 +1,4 @@ - #include "Map Screen Interface.h" +#include "Map Screen Interface.h" #include "string.h" #include "Map Screen Interface Map.h" #include "Render Dirty.h" @@ -127,7 +127,7 @@ INT32 iUpdateBoxWaitingList[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ]; FASTHELPREGION pFastHelpMapScreenList[ MAX_MAPSCREEN_FAST_HELP ]; // the move menu region -MOUSE_REGION gMoveMenuRegion[ MAX_POPUP_BOX_STRING_COUNT ]; +MOUSE_REGION gMoveMenuRegion[ MAX_POPUP_BOX_COLUMNS*MAX_POPUP_BOX_STRING_COUNT ]; MOUSE_REGION gMapScreenHelpTextMask; @@ -3685,79 +3685,79 @@ void CreatePopUpBoxForMovementBox( void ) { SGPPoint MovePosition = { gMapViewRegion.MouseXPos, gMapViewRegion.MouseYPos }; SGPPoint Position; - SGPRect Dimensions; + SGPRect Dimensions = { 0,0, 100, 95 }; // create the pop up box and mouse regions for movement list // create basic box - CreatePopUpBox(&ghMoveBox, AssignmentDimensions, MovePosition, ( POPUP_BOX_FLAG_CLIP_TEXT|POPUP_BOX_FLAG_RESIZE )); + CreatePopUpBox( &ghMoveBox, Dimensions, MovePosition, (POPUP_BOX_FLAG_CLIP_TEXT | POPUP_BOX_FLAG_RESIZE) ); - // which buffer will box render to - SetBoxBuffer(ghMoveBox, FRAME_BUFFER); + // which buffer will box render to + SetBoxBuffer( ghMoveBox, FRAME_BUFFER ); - // border type? - SetBorderType(ghMoveBox,guiPOPUPBORDERS); + // border type? + SetBorderType( ghMoveBox, guiPOPUPBORDERS ); - // background texture - SetBackGroundSurface(ghMoveBox, guiPOPUPTEX); + // background texture + SetBackGroundSurface( ghMoveBox, guiPOPUPTEX ); - // margin sizes - SetMargins( ghMoveBox, 6, 6, 4, 4 ); + // margin sizes + SetMargins( ghMoveBox, 6, 6, 4, 4 ); - // space between lines - SetLineSpace(ghMoveBox, 2); + // space between lines + SetLineSpace( ghMoveBox, 2 ); - // set current box to this one - SetCurrentBox( ghMoveBox ); + // set current box to this one + SetCurrentBox( ghMoveBox ); - // add strings - AddStringsToMoveBox( ); + // add strings + AddStringsToMoveBox(); + // set font type + SetBoxFont( ghMoveBox, MAP_SCREEN_FONT ); - // set font type - SetBoxFont(ghMoveBox, MAP_SCREEN_FONT); + // set highlight color + SetBoxHighLight( ghMoveBox, FONT_WHITE ); - // set highlight color - SetBoxHighLight(ghMoveBox, FONT_WHITE); + // unhighlighted color + SetBoxForeground( ghMoveBox, FONT_LTGREEN ); - // unhighlighted color - SetBoxForeground(ghMoveBox, FONT_LTGREEN); + // make the header line WHITE + SetBoxLineForeground( ghMoveBox, 0, FONT_WHITE ); - // make the header line WHITE - SetBoxLineForeground( ghMoveBox, 0, FONT_WHITE ); - - // make the done and cancel lines YELLOW - SetBoxLineForeground( ghMoveBox, GetNumberOfLinesOfTextInBox( ghMoveBox ) - 1, FONT_YELLOW ); + // make the done and cancel lines YELLOW + SetBoxLineForeground( ghMoveBox, GetNumberOfLinesOfTextInBox( ghMoveBox ) - 1, FONT_YELLOW ); if ( IsAnythingSelectedForMoving() ) { SetBoxLineForeground( ghMoveBox, GetNumberOfLinesOfTextInBox( ghMoveBox ) - 2, FONT_YELLOW ); } - // background color - SetBoxBackground(ghMoveBox, FONT_BLACK); + // background color + SetBoxBackground( ghMoveBox, FONT_BLACK ); - // shaded color..for darkened text - SetBoxShade( ghMoveBox, FONT_BLACK ); + // shaded color..for darkened text + SetBoxShade( ghMoveBox, FONT_BLACK ); - SetBoxSecondColumnForeground(ghMoveBox, FONT_LTGREEN); - SetBoxSecondColumnBackground(ghMoveBox, FONT_BLACK); - SetBoxSecondColumnHighLight(ghMoveBox, FONT_WHITE); - SetBoxSecondColumnShade(ghMoveBox, FONT_BLACK); - SetBoxSecondColumnFont(ghMoveBox, MAP_SCREEN_FONT); - SetBoxSecondColumnMinimumOffset(ghMoveBox, 1); - SetBoxSecondColumnOffsetAdjustment(ghMoveBox, -50); + for ( size_t i = 1; i < MAX_POPUP_BOX_COLUMNS; i++ ) + { + SetBoxColumnForeground( ghMoveBox, FONT_LTGREEN, i ); + SetBoxColumnBackground( ghMoveBox, FONT_BLACK, i ); + SetBoxColumnHighLight( ghMoveBox, FONT_WHITE, i ); + SetBoxColumnShade( ghMoveBox, FONT_BLACK, i ); + SetBoxColumnFont( ghMoveBox, MAP_SCREEN_FONT, i ); + } - // resize box to text - ResizeBoxToText( ghMoveBox ); + ResizeBoxToText( ghMoveBox ); - GetBoxPosition( ghMoveBox, &Position); + GetBoxPosition( ghMoveBox, &Position ); GetBoxSize( ghMoveBox, &Dimensions ); + // adjust position to try to keep it in the map area as best as possible if ( Position.iX + Dimensions.iRight >= (UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width) ) { - Position.iX = max(UI_MAP.ViewRegion.x, (UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width) - Dimensions.iRight ); + Position.iX = max( UI_MAP.ViewRegion.x, (UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width) - Dimensions.iRight ); SetBoxPosition( ghMoveBox, Position ); } @@ -3769,6 +3769,7 @@ void CreatePopUpBoxForMovementBox( void ) } +UINT32 gColumnEntries[MAX_POPUP_BOX_COLUMNS]; void AddStringsToMoveBox( void ) { @@ -3776,9 +3777,15 @@ void AddStringsToMoveBox( void ) CHAR16 sString[ 128 ], sStringB[ 128 ]; UINT32 hStringHandle; BOOLEAN fFirstOne = TRUE; - const INT32 firstColumnMaxEntries = 4 * gGameOptions.ubSquadSize; + const INT32 columnMaxEntries = 5 * gGameOptions.ubSquadSize; INT32 entries = 0; bool isFirstColumnFull = false; + bool secondColumnFull = false; + bool thirdColumnFull = false; + for ( size_t i = 0; i < MAX_POPUP_BOX_COLUMNS; i++ ) + { + gColumnEntries[i] = 0; + } // set the current box SetCurrentBox( ghMoveBox ); @@ -3786,24 +3793,31 @@ void AddStringsToMoveBox( void ) // clear all the strings out of the box RemoveAllCurrentBoxStrings(); - // add title GetShortSectorString( sSelMapX, sSelMapY, sStringB ); swprintf( sString, L"%s %s", pMovementMenuStrings[ 0 ], sStringB ); - AddMonoString(&hStringHandle, sString ); - AddSecondColumnMonoString(&hStringHandle, L""); - + AddStringToBoxColumn(&hStringHandle, sString, 0 ); + // Add empty lines to other columns + for ( size_t i = 1; i < MAX_POPUP_BOX_COLUMNS; i++ ) + { + AddStringToBoxColumn( &hStringHandle, L"", i); + } // blank line - AddMonoString(&hStringHandle, L"" ); - AddSecondColumnMonoString(&hStringHandle, L""); + for ( size_t i = 0; i < MAX_POPUP_BOX_COLUMNS; i++ ) + { + AddStringToBoxColumn( &hStringHandle, L"", i ); + } // add Select all line if (giNumberOfSquadsInSectorMoving > 1) { swprintf(sString, L"%s", pMovementMenuStrings[4]); - AddMonoString(&hStringHandle, sString); - AddSecondColumnMonoString(&hStringHandle, L""); + AddStringToBoxColumn( &hStringHandle, sString, 0 ); + for ( size_t i = 1; i < MAX_POPUP_BOX_COLUMNS; i++ ) + { + AddStringToBoxColumn( &hStringHandle, L"", i ); + } } @@ -3825,13 +3839,25 @@ void AddStringsToMoveBox( void ) else swprintf( sString, L"%s", pSquadMenuStrings[iSquadMovingList[ iCount ] ] ); } + // Determine which column to add if (!isFirstColumnFull) { - AddMonoString(&hStringHandle, sString); + AddStringToBoxColumn( &hStringHandle, sString, 0 ); + } + else if ( !secondColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 1 ); + gColumnEntries[1] += 1; + } + else if ( !thirdColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 2 ); + gColumnEntries[2] += 1; } else { - AddMonoStringToSecondColumn(&hStringHandle, sString ); + AddStringToBoxColumn( &hStringHandle, sString, 3 ); + gColumnEntries[3] += 1; } entries += 1; @@ -3850,21 +3876,41 @@ void AddStringsToMoveBox( void ) swprintf( sString, L" %s", pSoldierMovingList[ iCountB ]->name ); } - if (!isFirstColumnFull) + if ( !isFirstColumnFull ) { - AddMonoString(&hStringHandle, sString); + AddStringToBoxColumn( &hStringHandle, sString, 0 ); + } + else if ( !secondColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 1 ); + gColumnEntries[1] += 1; + } + else if ( !thirdColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 2 ); + gColumnEntries[2] += 1; } else { - AddMonoStringToSecondColumn(&hStringHandle, sString); + AddStringToBoxColumn( &hStringHandle, sString, 3 ); + gColumnEntries[3] += 1; } entries += 1; } } - if (entries > firstColumnMaxEntries) + if (entries > columnMaxEntries && !isFirstColumnFull) { isFirstColumnFull = true; + gColumnEntries[0] = entries; + } + else if ( entries - gColumnEntries[0] > columnMaxEntries && !secondColumnFull ) + { + secondColumnFull = true; + } + else if ( entries - gColumnEntries[0] - gColumnEntries[1] > columnMaxEntries && !thirdColumnFull ) + { + thirdColumnFull = true; } } @@ -3875,15 +3921,33 @@ void AddStringsToMoveBox( void ) // add this vehicle if( fVehicleIsMoving[ iCount ] ) { - // swprintf( sString, L"*%s*", pVehicleStrings[ pVehicleList[ iVehicleMovingList[ iCount ] ].ubVehicleType ] ); swprintf( sString, L"*%s*", gNewVehicle[ pVehicleList[ iVehicleMovingList[ iCount ] ].ubVehicleType ].NewVehicleStrings ); } else { - // swprintf( sString, L"%s", pVehicleStrings[ pVehicleList[ iVehicleMovingList[ iCount ] ].ubVehicleType ] ); swprintf( sString, L"%s", gNewVehicle[ pVehicleList[ iVehicleMovingList[ iCount ] ].ubVehicleType ].NewVehicleStrings); } - AddMonoString(&hStringHandle, sString ); + + if ( !isFirstColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 0 ); + } + else if ( !secondColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 1 ); + gColumnEntries[1] += 1; + } + else if ( !thirdColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 2 ); + gColumnEntries[2] += 1; + } + else + { + AddStringToBoxColumn( &hStringHandle, sString, 3 ); + gColumnEntries[3] += 1; + } + entries += 1; // now add all the grunts in it for( iCountB = 0; iCountB < giNumberOfSoldiersInSectorMoving; iCountB++ ) @@ -3899,9 +3963,44 @@ void AddStringsToMoveBox( void ) { swprintf( sString, L" %s", pSoldierMovingList[ iCountB ]->name ); } - AddMonoString(&hStringHandle, sString ); + + if ( !isFirstColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 0 ); + } + else if ( !secondColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 1 ); + gColumnEntries[1] += 1; + } + else if ( !thirdColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 2 ); + gColumnEntries[2] += 1; + } + else + { + AddStringToBoxColumn( &hStringHandle, sString, 3 ); + gColumnEntries[3] += 1; + } + entries += 1; } } + + + if ( entries > columnMaxEntries && !isFirstColumnFull ) + { + isFirstColumnFull = true; + gColumnEntries[0] = entries; + } + else if ( entries - gColumnEntries[0] > columnMaxEntries && !secondColumnFull ) + { + secondColumnFull = true; + } + else if ( entries - gColumnEntries[0] - gColumnEntries[1] > columnMaxEntries && !thirdColumnFull ) + { + thirdColumnFull = true; + } } @@ -3999,7 +4098,6 @@ void BuildMouseRegionsForMoveBox( void ) SetCurrentBox( ghMoveBox ); - // box heading MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); @@ -4024,67 +4122,303 @@ void BuildMouseRegionsForMoveBox( void ) // calc total number of "moving" lines in the box iTotalNumberOfLines = giNumberOfSoldiersInSectorMoving + giNumberOfSquadsInSectorMoving + giNumberOfVehiclesInSectorMoving; - // add the blank lines + // add the blank line iTotalNumberOfLines += iCounter; // now add the strings + const UINT32 firstColumnWidth = GetBoxSecondColumnCurrentOffset( ghMoveBox ); + bool firstColumnFull = false; + bool secondColumnFull = false; + bool thirdColumnFull = false; + INT32 entries = 0; + // Take into account any possible entries in the columnns after 1st for entries that come after squads + const UINT32 rowOffset = gColumnEntries[1] + gColumnEntries[2] + gColumnEntries[3]; + while( iCounter < iTotalNumberOfLines ) { // define regions for squad lines for( iCount = 0; iCount < giNumberOfSquadsInSectorMoving; iCount++ ) { - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); + // First column coordinates + UINT16 tlx = iBoxXPosition; + UINT16 tly = iBoxYPosition + iFontHeight * iCounter; + UINT16 brx = iBoxXPosition + firstColumnWidth; + UINT16 bry = iBoxYPosition + iFontHeight * (iCounter + 1); + + if ( thirdColumnFull ) + { + tlx = iBoxXPosition + 3 * firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - (gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2])); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - (gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2])); + } + else if ( secondColumnFull ) + { + tlx = iBoxXPosition + 2*firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - (gColumnEntries[0] + gColumnEntries[1])); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - (gColumnEntries[0] + gColumnEntries[1])); + } + else if ( firstColumnFull ) + { + tlx = iBoxXPosition + firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - gColumnEntries[0]); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - gColumnEntries[0]); + } + + MSYS_DefineRegion( &gMoveMenuRegion[iCounter], tlx, tly, brx, bry, MSYS_PRIORITY_HIGHEST, + MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines - MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 0, iCounter ); + if ( thirdColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] - gColumnEntries[1] - gColumnEntries[2] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 3 ); // Column index + } + else if ( secondColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] - gColumnEntries[1]); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 2 ); + } + else if ( firstColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 1 ); + } + else + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 0 ); + } + MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 1, SQUAD_REGION ); MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 2, iCount ); - iCounter++; + + iCounter++; + entries += 1; + + // Squad soldiers for( iCountB = 0; iCountB < giNumberOfSoldiersInSectorMoving; iCountB++ ) { if( pSoldierMovingList[ iCountB ]->bAssignment == iSquadMovingList[ iCount ] ) { - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); + tlx = iBoxXPosition; + tly = iBoxYPosition + iFontHeight * iCounter; + brx = iBoxXPosition + firstColumnWidth; + bry = iBoxYPosition + iFontHeight * (iCounter + 1); + + if ( thirdColumnFull ) + { + tlx = iBoxXPosition + 3 * firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - (gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2])); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - (gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2])); + } + else if ( secondColumnFull ) + { + tlx = iBoxXPosition + 2 * firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - (gColumnEntries[0] + gColumnEntries[1])); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - (gColumnEntries[0] + gColumnEntries[1])); + } + else if ( firstColumnFull ) + { + tlx = iBoxXPosition + firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - gColumnEntries[0]); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - gColumnEntries[0]); + } + + + MSYS_DefineRegion( &gMoveMenuRegion[iCounter], tlx, tly, brx, bry, MSYS_PRIORITY_HIGHEST, + MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines - MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 0, iCounter ); + if ( thirdColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] - gColumnEntries[1] - gColumnEntries[2] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 3 ); + } + else if ( secondColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] - gColumnEntries[1] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 2 ); + } + else if ( firstColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 1 ); + } + else + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 0 ); + } MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 1, SOLDIER_REGION ); MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 2, iCountB ); + + iCounter++; + entries += 1; } } + + if ( entries >= gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2] && gColumnEntries[2] > 0 ) + { + thirdColumnFull = true; + } + else if ( entries >= gColumnEntries[0] + gColumnEntries[1] && gColumnEntries[1] > 0 ) + { + secondColumnFull = true; + } + else if ( entries >= gColumnEntries[0] && gColumnEntries[0] > 0 ) + { + firstColumnFull = true; + } } + + // Vehicles for( iCount = 0; iCount < giNumberOfVehiclesInSectorMoving; iCount++ ) { // define regions for vehicle lines - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); + UINT16 tlx = iBoxXPosition; + UINT16 tly = iBoxYPosition + iFontHeight * (iCounter); + UINT16 brx = iBoxXPosition + iBoxWidth; + UINT16 bry = iBoxYPosition + iFontHeight * (iCounter + 1); + + if ( thirdColumnFull ) + { + tlx = iBoxXPosition + 3 * firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - (gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2])); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - (gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2])); + } + else if ( secondColumnFull ) + { + tlx = iBoxXPosition + 2 * firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - (gColumnEntries[0] + gColumnEntries[1])); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - (gColumnEntries[0] + gColumnEntries[1])); + } + else if ( firstColumnFull ) + { + tlx = iBoxXPosition + firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - gColumnEntries[0]); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - gColumnEntries[0]); + } + + MSYS_DefineRegion( &gMoveMenuRegion[iCounter], tlx, tly, brx, bry, MSYS_PRIORITY_HIGHEST, + MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines - MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 0, iCounter ); + if ( thirdColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] - gColumnEntries[1] - gColumnEntries[2] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 3 ); + } + else if ( secondColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] - gColumnEntries[1] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 2 ); + } + else if ( firstColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 1 ); + } + else + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 0 ); + } + MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 1, VEHICLE_REGION ); MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 2, iCount ); iCounter++; + entries += 1; + // Soldiers inside a vehicle for( iCountB = 0; iCountB < giNumberOfSoldiersInSectorMoving; iCountB++ ) { if( ( pSoldierMovingList[ iCountB ]->bAssignment == VEHICLE ) &&( pSoldierMovingList[ iCountB ]->iVehicleId == iVehicleMovingList[ iCount ] ) ) { - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); + tlx = iBoxXPosition; + tly = iBoxYPosition + iFontHeight * iCounter; + brx = iBoxXPosition + firstColumnWidth; + bry = iBoxYPosition + iFontHeight * (iCounter + 1); + + if ( thirdColumnFull ) + { + tlx = iBoxXPosition + 3 * firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - (gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2])); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - (gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2])); + } + else if ( secondColumnFull ) + { + tlx = iBoxXPosition + 2 * firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - (gColumnEntries[0] + gColumnEntries[1])); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - (gColumnEntries[0] + gColumnEntries[1])); + } + else if ( firstColumnFull ) + { + tlx = iBoxXPosition + firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - gColumnEntries[0]); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - gColumnEntries[0]); + } + + + MSYS_DefineRegion( &gMoveMenuRegion[iCounter], tlx, tly, brx, bry, MSYS_PRIORITY_HIGHEST, + MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines - MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 0, iCounter ); + if ( thirdColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] - gColumnEntries[1] - gColumnEntries[2] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 3 ); + } + else if ( secondColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] - gColumnEntries[1] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 2 ); + } + else if ( firstColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 1 ); + } + else + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 0 ); + } + MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 1, SOLDIER_REGION ); MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 2, iCountB ); iCounter++; + entries += 1; } } + + if ( entries >= gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2] && gColumnEntries[2] > 0 ) + { + thirdColumnFull = true; + } + else if ( entries >= gColumnEntries[0] + gColumnEntries[1] && gColumnEntries[1] > 0 ) + { + secondColumnFull = true; + } + else if ( entries >= gColumnEntries[0] && gColumnEntries[0] > 0 ) + { + firstColumnFull = true; + } } @@ -4097,7 +4431,7 @@ void BuildMouseRegionsForMoveBox( void ) // this line gets place only once... if( !fDefinedOtherRegion ) { - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, + MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * (iCounter - rowOffset) ), ( INT16 )( iBoxXPosition + firstColumnWidth), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 - rowOffset) ), MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines @@ -4109,7 +4443,7 @@ void BuildMouseRegionsForMoveBox( void ) fDefinedOtherRegion = TRUE; } - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, + MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * (iCounter - rowOffset) ), ( INT16 )( iBoxXPosition + firstColumnWidth), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 - rowOffset) ), MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines @@ -4123,7 +4457,7 @@ void BuildMouseRegionsForMoveBox( void ) // blank line - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, + MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * (iCounter - rowOffset) ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 - rowOffset ) ), MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); iCounter++; @@ -4131,7 +4465,7 @@ void BuildMouseRegionsForMoveBox( void ) if ( IsAnythingSelectedForMoving() ) { // DONE line - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, + MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * (iCounter - rowOffset) ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 - rowOffset ) ), MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines @@ -4143,13 +4477,13 @@ void BuildMouseRegionsForMoveBox( void ) else { // blank line - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, + MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * (iCounter - rowOffset) ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 - rowOffset) ), MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); iCounter++; } // CANCEL line - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, + MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * (iCounter - rowOffset) ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 - rowOffset ) ), MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines @@ -4161,10 +4495,10 @@ void BuildMouseRegionsForMoveBox( void ) void ClearMouseRegionsForMoveBox( void ) { - INT32 iCounter = 0; - + UINT32 iCounter = 0; + UINT32 lines = GetTotalNumberOfLinesOfTextInBox( ghMoveBox ); // run through list of mouse regions - for( iCounter = 0; iCounter < ( INT32 )(GetNumberOfLinesOfTextInBox( ghMoveBox ) + GetNumberOfSecondaryLinesOfTextInBox(ghMoveBox)); iCounter++) + for( iCounter = 0; iCounter < lines; iCounter++) { // remove this region MSYS_RemoveRegion( &gMoveMenuRegion[ iCounter ] ); @@ -4182,11 +4516,12 @@ void MoveMenuMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) iValue = MSYS_GetRegionUserData( pRegion, 0 ); + INT32 column = MSYS_GetRegionUserData( pRegion, 3 ); if (iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) { // highlight string - HighLightBoxLine( ghMoveBox, iValue ); + HighLightBoxLine( ghMoveBox, iValue, column ); } else if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { diff --git a/Utils/PopUpBox.cpp b/Utils/PopUpBox.cpp index cc1225cd..168cad0a 100644 --- a/Utils/PopUpBox.cpp +++ b/Utils/PopUpBox.cpp @@ -1,4 +1,4 @@ - #include "PopUpBox.h" +#include "PopUpBox.h" #include "sysutil.h" @@ -18,13 +18,14 @@ BOOLEAN DrawBoxText(UINT32 uiCounter); void RemoveCurrentBoxPrimaryText( INT32 hStringHandle ); void RemoveCurrentBoxSecondaryText( INT32 hStringHandle ); +void RemoveCurrentBoxText( INT32 hStringHandle, UINT8 column ); void InitPopUpBoxList() { - memset(&PopUpBoxList, 0, sizeof(PopUpBoxPt)); - return; + memset( &PopUpBoxList, 0, sizeof( PopUpBoxPt ) ); + return; } @@ -113,10 +114,17 @@ BOOLEAN CreatePopUpBox(INT32 *phBoxHandle, SGPRect Dimensions, SGPPoint Position SetBoxSize(iCount, Dimensions); SetBoxFlags(iCount, uiFlags); - for(iCounter=0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++) + for ( UINT8 col = 0; col < MAX_POPUP_BOX_COLUMNS; ++col ) { - PopUpBoxList[iCount]->Text[iCounter]=NULL; - PopUpBoxList[iCount]->pSecondColumnString[iCounter]=NULL; + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; ++iCounter) + { + PopUpBoxList[iCount]->Text[col][iCounter] = NULL; + } + } + + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + { + PopUpBoxList[iCount]->pSecondColumnString[iCounter] = NULL; } SetCurrentBox(iCount); @@ -179,18 +187,18 @@ void ShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ) { // shade iLineNumber Line in box indexed by hBoxHandle - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[ hBoxHandle ] ); + Assert( PopUpBoxList[hBoxHandle] ); - if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) + if ( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber] != NULL ) { // set current box SetCurrentBox( hBoxHandle ); // shade line - PopUpBoxList[hBoxHandle]->Text[iLineNumber]->fShadeFlag = TRUE; + PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fShadeFlag = TRUE; } } @@ -203,13 +211,13 @@ void UnShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ) Assert( PopUpBoxList[ hBoxHandle ] ); - if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) + if( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]!=NULL) { // set current box SetCurrentBox( hBoxHandle ); // shade line - PopUpBoxList[hBoxHandle]->Text[iLineNumber]->fShadeFlag = FALSE; + PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fShadeFlag = FALSE; } } @@ -223,13 +231,13 @@ void SecondaryShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ) Assert( PopUpBoxList[ hBoxHandle ] ); - if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) + if( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]!=NULL) { // set current box SetCurrentBox( hBoxHandle ); // shade line - PopUpBoxList[hBoxHandle]->Text[iLineNumber]->fSecondaryShadeFlag = TRUE; + PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fSecondaryShadeFlag = TRUE; } } @@ -242,13 +250,13 @@ void UnSecondaryShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ) Assert( PopUpBoxList[ hBoxHandle ] ); - if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) + if( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]!=NULL) { // set current box SetCurrentBox( hBoxHandle ); // shade line - PopUpBoxList[hBoxHandle]->Text[iLineNumber]->fSecondaryShadeFlag = FALSE; + PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fSecondaryShadeFlag = FALSE; } } @@ -342,52 +350,50 @@ void SetBackGroundSurface(INT32 hBoxHandle, INT32 iBackGroundSurfaceIndex) // adds a FIRST column string to the CURRENT popup box -void AddMonoString(UINT32 *hStringHandle, STR16 pString) +void AddMonoString( UINT32 *hStringHandle, STR16 pString ) { - STR16 pLocalString=NULL; - POPUPSTRINGPTR pStringSt=NULL; - INT32 iCounter=0; + STR16 pLocalString = NULL; + POPUPSTRINGPTR pStringSt = NULL; + INT32 iCounter = 0; - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); - // find first free slot in list - for( iCounter = 0; ( iCounter < MAX_POPUP_BOX_STRING_COUNT ) && ( PopUpBoxList[guiCurrentBox]->Text[iCounter] != NULL ); iCounter++ ); + // find first free slot in list + for ( iCounter = 0; (iCounter < MAX_POPUP_BOX_STRING_COUNT) && (PopUpBoxList[guiCurrentBox]->Text[0][iCounter] != NULL); iCounter++ ); - if ( iCounter >= MAX_POPUP_BOX_STRING_COUNT ) - { - // using too many text lines, or not freeing them up properly - Assert(0); + if ( iCounter >= MAX_POPUP_BOX_STRING_COUNT ) + { + // using too many text lines, or not freeing them up properly + Assert( 0 ); + return; + } + + pStringSt = (POPUPSTRING *)(MemAlloc( sizeof( POPUPSTRING ) )); + if ( pStringSt == NULL ) + return; + + pLocalString = (STR16)MemAlloc( (wcslen( pString ) + 1) * sizeof( CHAR16 ) ); + if ( pLocalString == NULL ) + return; + + wcscpy( pLocalString, pString ); + + RemoveCurrentBoxPrimaryText( iCounter ); + + PopUpBoxList[guiCurrentBox]->Text[0][iCounter] = pStringSt; + PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->fColorFlag = FALSE; + PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->pString = pLocalString; + PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->fShadeFlag = FALSE; + PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->fHighLightFlag = FALSE; + PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->fSecondaryShadeFlag = FALSE; + + *hStringHandle = iCounter; + PopUpBoxList[guiCurrentBox]->fUpdated = FALSE; return; - } - - pStringSt=(POPUPSTRING *)(MemAlloc(sizeof(POPUPSTRING))); - if (pStringSt == NULL) - return; - - pLocalString=(STR16)MemAlloc((wcslen(pString)+1)*sizeof(CHAR16)); - if (pLocalString == NULL) - return; - - wcscpy(pLocalString, pString); - - RemoveCurrentBoxPrimaryText( iCounter ); - - PopUpBoxList[guiCurrentBox]->Text[iCounter]=pStringSt; - PopUpBoxList[guiCurrentBox]->Text[iCounter]->fColorFlag=FALSE; - PopUpBoxList[guiCurrentBox]->Text[iCounter]->pString=pLocalString; - PopUpBoxList[guiCurrentBox]->Text[iCounter]->fShadeFlag = FALSE; - PopUpBoxList[guiCurrentBox]->Text[iCounter]->fHighLightFlag = FALSE; - PopUpBoxList[guiCurrentBox]->Text[iCounter]->fSecondaryShadeFlag = FALSE; - - *hStringHandle=iCounter; - - PopUpBoxList[guiCurrentBox]->fUpdated = FALSE; - - return; } @@ -405,7 +411,7 @@ void AddSecondColumnMonoString( UINT32 *hStringHandle, STR16 pString ) Assert( PopUpBoxList[guiCurrentBox] != NULL ); // find the LAST USED text string index - for( iCounter = 0; ( iCounter + 1 < MAX_POPUP_BOX_STRING_COUNT ) && ( PopUpBoxList[guiCurrentBox]->Text[ iCounter + 1 ] != NULL ); iCounter++ ); + for( iCounter = 0; ( iCounter + 1 < MAX_POPUP_BOX_STRING_COUNT ) && ( PopUpBoxList[guiCurrentBox]->Text[0][ iCounter + 1 ] != NULL ); iCounter++ ); if ( iCounter >= MAX_POPUP_BOX_STRING_COUNT ) { @@ -483,6 +489,98 @@ void AddMonoStringToSecondColumn(UINT32* hStringHandle, STR16 pString) return; } +// Adds a string to the first available slot in the column +void AddStringToBoxColumn( UINT32 *hStringHandle, STR16 pString, UINT8 column ) +{ + STR16 pLocalString = NULL; + POPUPSTRINGPTR pStringSt = NULL; + INT32 iCounter = 0; + + + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) || column >= MAX_POPUP_BOX_COLUMNS ) + return; + + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + + // find first free slot in list + for ( iCounter = 0; (iCounter < MAX_POPUP_BOX_STRING_COUNT) && (PopUpBoxList[guiCurrentBox]->Text[column][iCounter] != NULL); iCounter++ ); + + if ( iCounter >= MAX_POPUP_BOX_STRING_COUNT ) + { + // using too many text lines, or not freeing them up properly + Assert( 0 ); + return; + } + + pStringSt = (POPUPSTRING *)(MemAlloc( sizeof( POPUPSTRING ) )); + if ( pStringSt == NULL ) + return; + + pLocalString = (STR16)MemAlloc( (wcslen( pString ) + 1) * sizeof( CHAR16 ) ); + if ( pLocalString == NULL ) + return; + + wcscpy( pLocalString, pString ); + + RemoveCurrentBoxText( iCounter, column ); + + PopUpBoxList[guiCurrentBox]->Text[column][iCounter] = pStringSt; + PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fColorFlag = FALSE; + PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->pString = pLocalString; + PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fShadeFlag = FALSE; + PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fHighLightFlag = FALSE; + PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fSecondaryShadeFlag = FALSE; + + *hStringHandle = iCounter; + PopUpBoxList[guiCurrentBox]->fUpdated = FALSE; + return; +} + +// Adds string to the current popup box column besides first. !!! String's position is the LAST used position in the 1st column !!! +void AddColumnMonoString( UINT32 *hStringHandle, STR16 pString, UINT8 column ) +{ + STR16 pLocalString = NULL; + POPUPSTRINGPTR pStringSt = NULL; + INT32 iCounter = 0; + + + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) || column < 1 || column >= MAX_POPUP_BOX_COLUMNS) + return; + + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + + // find the LAST USED text string index + for ( iCounter = 0; (iCounter + 1 < MAX_POPUP_BOX_STRING_COUNT) && (PopUpBoxList[guiCurrentBox]->Text[0][iCounter + 1] != NULL); iCounter++ ); + + if ( iCounter >= MAX_POPUP_BOX_STRING_COUNT ) + { + // using too many text lines, or not freeing them up properly + Assert( 0 ); + return; + } + + pStringSt = (POPUPSTRING *)(MemAlloc( sizeof( POPUPSTRING ) )); + if ( pStringSt == NULL ) + return; + + pLocalString = (STR16)MemAlloc( (wcslen( pString ) + 1) * sizeof( CHAR16 ) ); + if ( pLocalString == NULL ) + return; + + wcscpy( pLocalString, pString ); + + RemoveCurrentBoxText( iCounter, column ); + + PopUpBoxList[guiCurrentBox]->Text[column][iCounter] = pStringSt; + PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fColorFlag = FALSE; + PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->pString = pLocalString; + PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fShadeFlag = FALSE; + PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fHighLightFlag = FALSE; + + *hStringHandle = iCounter; + return; +} + // Adds a COLORED first column string to the CURRENT box void AddColorString(INT32 *hStringHandle, STR16 pString) @@ -498,7 +596,7 @@ void AddColorString(INT32 *hStringHandle, STR16 pString) Assert( PopUpBoxList[guiCurrentBox] != NULL ); // find first free slot in list - for( iCounter = 0; ( iCounter < MAX_POPUP_BOX_STRING_COUNT ) && ( PopUpBoxList[guiCurrentBox]->Text[iCounter] != NULL ); iCounter++ ); + for( iCounter = 0; ( iCounter < MAX_POPUP_BOX_STRING_COUNT ) && ( PopUpBoxList[guiCurrentBox]->Text[0][iCounter] != NULL ); iCounter++ ); if ( iCounter >= MAX_POPUP_BOX_STRING_COUNT ) { @@ -519,9 +617,9 @@ void AddColorString(INT32 *hStringHandle, STR16 pString) RemoveCurrentBoxPrimaryText( iCounter ); - PopUpBoxList[guiCurrentBox]->Text[iCounter]=pStringSt; - PopUpBoxList[guiCurrentBox]->Text[iCounter]->fColorFlag=TRUE; - PopUpBoxList[guiCurrentBox]->Text[iCounter]->pString=pLocalString; + PopUpBoxList[guiCurrentBox]->Text[0][iCounter]=pStringSt; + PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->fColorFlag=TRUE; + PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->pString=pLocalString; *hStringHandle=iCounter; @@ -550,9 +648,9 @@ void ResizeBoxForSecondStrings( INT32 hBoxHandle ) // check string sizes for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) { - if( pBox->Text[ iCounter ] ) + if( pBox->Text[0][ iCounter ] ) { - uiThisWidth = uiBaseWidth + StringPixLength( pBox->Text[ iCounter ]->pString, pBox->Text[ iCounter ]->uiFont ); + uiThisWidth = uiBaseWidth + StringPixLength( pBox->Text[0][ iCounter ]->pString, pBox->Text[0][ iCounter ]->uiFont ); if( uiThisWidth > pBox->uiSecondColumnCurrentOffset ) { @@ -562,6 +660,52 @@ void ResizeBoxForSecondStrings( INT32 hBoxHandle ) } } +static void ResizeStrategicMvtBoxForSecondStrings( INT32 hBoxHandle ) +{ + INT32 iCounter = 0; + PopUpBoxPt pBox; + UINT32 uiBaseWidth, uiThisWidth; + + + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + pBox = (PopUpBoxList[hBoxHandle]); + Assert( pBox ); + + // Determine last line for next loop + UINT8 last = MAX_POPUP_BOX_STRING_COUNT; + for ( iCounter = 1; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + { + if ( pBox->Text[0][iCounter] == nullptr ) + { + // Do not consider the last blank, "cancel" & "Plot Travel route" lines + last = iCounter - 3; + break; + } + } + + uiBaseWidth = pBox->uiLeftMargin + pBox->uiSecondColumnMinimunOffset; + + // check string sizes, skip title line + for ( iCounter = 1; iCounter < last; iCounter++ ) + { + if ( pBox->Text[0][iCounter] ) + { + uiThisWidth = uiBaseWidth + StringPixLength( pBox->Text[0][iCounter]->pString, pBox->Text[0][iCounter]->uiFont ); + + if ( uiThisWidth > pBox->uiSecondColumnCurrentOffset ) + { + // Maintain width if something is selected and the '*' characters have been added + if ( wcsncmp( pBox->Text[0][iCounter]->pString, L" *", 3 ) == 0 ) + { + uiThisWidth -= 10; + } + pBox->uiSecondColumnCurrentOffset = uiThisWidth; + } + } + } +} UINT32 GetNumberOfLinesOfTextInBox( INT32 hBoxHandle ) @@ -575,7 +719,7 @@ UINT32 GetNumberOfLinesOfTextInBox( INT32 hBoxHandle ) // check string size for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) { - if( PopUpBoxList[ hBoxHandle ]->Text[ iCounter ] == NULL ) + if( PopUpBoxList[ hBoxHandle ]->Text[0][ iCounter ] == NULL ) { break; } @@ -605,29 +749,51 @@ UINT32 GetNumberOfSecondaryLinesOfTextInBox(INT32 hBoxHandle) return(iCounter); } - - -void SetBoxFont(INT32 hBoxHandle, UINT32 uiFont) +UINT32 GetTotalNumberOfLinesOfTextInBox( INT32 hBoxHandle ) { - UINT32 uiCounter; + UINT32 lines = 0; + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return(0); - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + // count number of lines + // check string size + for ( size_t i = 0; i < MAX_POPUP_BOX_COLUMNS; i++ ) + { + for ( INT32 iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + { + if ( PopUpBoxList[hBoxHandle]->Text[i][iCounter] == NULL ) + { + break; + } + lines += 1; + } + } + + return(lines); +} + + +void SetBoxFont( INT32 hBoxHandle, UINT32 uiFont ) +{ + UINT32 uiCounter; + + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) - { - if ( PopUpBoxList[hBoxHandle]->Text[uiCounter] != NULL) + for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) { - PopUpBoxList[hBoxHandle]->Text[uiCounter]->uiFont=uiFont; + if ( PopUpBoxList[hBoxHandle]->Text[0][uiCounter] != NULL ) + { + PopUpBoxList[hBoxHandle]->Text[0][uiCounter]->uiFont = uiFont; + } } - } - // set up the 2nd column font - SetBoxSecondColumnFont( hBoxHandle, uiFont ); + // set up the 2nd column font + SetBoxSecondColumnFont( hBoxHandle, uiFont ); - PopUpBoxList[hBoxHandle]->fUpdated = FALSE; + PopUpBoxList[hBoxHandle]->fUpdated = FALSE; - return; + return; } void SetBoxSecondColumnMinimumOffset( INT32 hBoxHandle, UINT32 uiWidth ) @@ -657,36 +823,55 @@ void SetBoxSecondColumnOffsetAdjustment(INT32 hBoxHandle, INT16 x) return; } -void SetBoxSecondColumnFont(INT32 hBoxHandle, UINT32 uiFont) +void SetBoxSecondColumnFont( INT32 hBoxHandle, UINT32 uiFont ) { - UINT32 iCounter=0; + UINT32 iCounter = 0; - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) - { - if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) { - PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->uiFont=uiFont; + if ( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + { + PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->uiFont = uiFont; + } } - } - PopUpBoxList[hBoxHandle]->fUpdated = FALSE; + PopUpBoxList[hBoxHandle]->fUpdated = FALSE; - return; + return; } +void SetBoxColumnFont( INT32 hBoxHandle, UINT32 uiFont, UINT8 column ) +{ + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + for ( UINT32 uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) + { + if ( PopUpBoxList[hBoxHandle]->Text[column][uiCounter] != NULL ) + { + PopUpBoxList[hBoxHandle]->Text[column][uiCounter]->uiFont = uiFont; + } + } + + PopUpBoxList[hBoxHandle]->fUpdated = FALSE; + return; +} + + + UINT32 GetBoxFont( INT32 hBoxHandle ) { if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) return( 0 ); Assert( PopUpBoxList[ hBoxHandle ] ); - Assert( PopUpBoxList[ hBoxHandle ]->Text[ 0 ] ); + Assert( PopUpBoxList[ hBoxHandle ]->Text[0][ 0 ] ); // return font id of first line of text of box - return( PopUpBoxList[hBoxHandle]->Text[ 0 ]->uiFont ); + return( PopUpBoxList[hBoxHandle]->Text[0][ 0 ]->uiFont ); } @@ -697,9 +882,9 @@ void SetBoxLineForeground( INT32 iBox, INT32 iStringValue, UINT8 ubColor ) return; Assert( PopUpBoxList[ iBox ] ); - Assert( PopUpBoxList[ iBox ]->Text[iStringValue] ); + Assert( PopUpBoxList[ iBox ]->Text[0][iStringValue] ); - PopUpBoxList[iBox]->Text[iStringValue]->ubForegroundColor=ubColor; + PopUpBoxList[iBox]->Text[0][iStringValue]->ubForegroundColor=ubColor; return; } @@ -714,9 +899,9 @@ void SetBoxSecondaryShade( INT32 iBox, UINT8 ubColor ) for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) { - if (PopUpBoxList[iBox]->Text[uiCounter]!=NULL) + if (PopUpBoxList[iBox]->Text[0][uiCounter]!=NULL) { - PopUpBoxList[iBox]->Text[uiCounter]->ubSecondaryShade=ubColor; + PopUpBoxList[iBox]->Text[0][uiCounter]->ubSecondaryShade=ubColor; } } return; @@ -731,9 +916,9 @@ void SetPopUpStringFont(INT32 hStringHandle, UINT32 uiFont) return; Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->Text[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->uiFont=uiFont; + PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->uiFont=uiFont; return; } @@ -752,114 +937,114 @@ void SetPopUpSecondColumnStringFont(INT32 hStringHandle, UINT32 uiFont) -void SetStringSecondaryShade(INT32 hStringHandle, UINT8 ubColor) +void SetStringSecondaryShade( INT32 hStringHandle, UINT8 ubColor ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->Text[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->ubSecondaryShade=ubColor; - return; + PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->ubSecondaryShade = ubColor; + return; } -void SetStringForeground(INT32 hStringHandle, UINT8 ubColor) +void SetStringForeground( INT32 hStringHandle, UINT8 ubColor ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->Text[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->ubForegroundColor=ubColor; - return; + PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->ubForegroundColor = ubColor; + return; } -void SetStringBackground(INT32 hStringHandle, UINT8 ubColor) +void SetStringBackground( INT32 hStringHandle, UINT8 ubColor ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->Text[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->ubBackgroundColor=ubColor; - return; + PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->ubBackgroundColor = ubColor; + return; } -void SetStringHighLight(INT32 hStringHandle, UINT8 ubColor) +void SetStringHighLight( INT32 hStringHandle, UINT8 ubColor ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->Text[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->ubHighLight=ubColor; - return; + PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->ubHighLight = ubColor; + return; } -void SetStringShade(INT32 hStringHandle, UINT8 ubShade) +void SetStringShade( INT32 hStringHandle, UINT8 ubShade ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->Text[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->ubShade=ubShade; - return; + PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->ubShade = ubShade; + return; } -void SetStringSecondColumnForeground(INT32 hStringHandle, UINT8 ubColor) +void SetStringSecondColumnForeground( INT32 hStringHandle, UINT8 ubColor ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); - PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubForegroundColor=ubColor; - return; + PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubForegroundColor = ubColor; + return; } -void SetStringSecondColumnBackground(INT32 hStringHandle, UINT8 ubColor) +void SetStringSecondColumnBackground( INT32 hStringHandle, UINT8 ubColor ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); - PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubBackgroundColor=ubColor; - return; + PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubBackgroundColor = ubColor; + return; } -void SetStringSecondColumnHighLight(INT32 hStringHandle, UINT8 ubColor) +void SetStringSecondColumnHighLight( INT32 hStringHandle, UINT8 ubColor ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); - PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubHighLight=ubColor; - return; + PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubHighLight = ubColor; + return; } -void SetStringSecondColumnShade(INT32 hStringHandle, UINT8 ubShade) +void SetStringSecondColumnShade( INT32 hStringHandle, UINT8 ubShade ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); - PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubShade=ubShade; - return; + PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubShade = ubShade; + return; } @@ -875,9 +1060,9 @@ void SetBoxForeground(INT32 hBoxHandle, UINT8 ubColor) for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) { - if (PopUpBoxList[hBoxHandle]->Text[uiCounter]!=NULL) + if (PopUpBoxList[hBoxHandle]->Text[0][uiCounter]!=NULL) { - PopUpBoxList[hBoxHandle]->Text[uiCounter]->ubForegroundColor=ubColor; + PopUpBoxList[hBoxHandle]->Text[0][uiCounter]->ubForegroundColor=ubColor; } } return; @@ -894,9 +1079,9 @@ void SetBoxBackground(INT32 hBoxHandle, UINT8 ubColor) for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) { - if (PopUpBoxList[hBoxHandle]->Text[uiCounter]!=NULL) + if (PopUpBoxList[hBoxHandle]->Text[0][uiCounter]!=NULL) { - PopUpBoxList[hBoxHandle]->Text[uiCounter]->ubBackgroundColor=ubColor; + PopUpBoxList[hBoxHandle]->Text[0][uiCounter]->ubBackgroundColor=ubColor; } } return; @@ -913,9 +1098,9 @@ void SetBoxHighLight(INT32 hBoxHandle, UINT8 ubColor) for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) { - if (PopUpBoxList[hBoxHandle]->Text[uiCounter]!=NULL) + if (PopUpBoxList[hBoxHandle]->Text[0][uiCounter]!=NULL) { - PopUpBoxList[hBoxHandle]->Text[uiCounter]->ubHighLight=ubColor; + PopUpBoxList[hBoxHandle]->Text[0][uiCounter]->ubHighLight=ubColor; } } return; @@ -932,105 +1117,194 @@ void SetBoxShade(INT32 hBoxHandle, UINT8 ubColor) for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) { - if (PopUpBoxList[hBoxHandle]->Text[uiCounter]!=NULL) + if (PopUpBoxList[hBoxHandle]->Text[0][uiCounter]!=NULL) { - PopUpBoxList[hBoxHandle]->Text[uiCounter]->ubShade=ubColor; + PopUpBoxList[hBoxHandle]->Text[0][uiCounter]->ubShade=ubColor; } } return; } -void SetBoxSecondColumnForeground(INT32 hBoxHandle, UINT8 ubColor) +void SetBoxSecondColumnForeground( INT32 hBoxHandle, UINT8 ubColor ) { - UINT32 iCounter=0; + UINT32 iCounter = 0; - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; Assert( PopUpBoxList[hBoxHandle] != NULL ); - for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) - { - if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) { - PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubForegroundColor=ubColor; + if ( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + { + PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubForegroundColor = ubColor; + } } - } - return; -} - -void SetBoxSecondColumnBackground(INT32 hBoxHandle, UINT8 ubColor) -{ - UINT32 iCounter=0; - - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) - return; - - Assert( PopUpBoxList[hBoxHandle] != NULL ); - - for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) - { - if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) - { - PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubBackgroundColor=ubColor; - } - } - - return; -} - -void SetBoxSecondColumnHighLight(INT32 hBoxHandle, UINT8 ubColor) -{ - UINT32 iCounter=0; - - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) - return; - - Assert( PopUpBoxList[hBoxHandle] != NULL ); - - for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) - { - if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) - { - PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubHighLight=ubColor; - } - } - - return; -} - -void SetBoxSecondColumnShade(INT32 hBoxHandle, UINT8 ubColor) -{ - UINT32 iCounter=0; - - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) - return; - - Assert( PopUpBoxList[hBoxHandle] != NULL ); - - for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) - { - if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) - { - PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubShade=ubColor; - } - } - return; -} - - -void HighLightLine(INT32 hStringHandle) -{ - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) - return; - - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - - if(!PopUpBoxList[guiCurrentBox]->Text[hStringHandle]) return; - PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->fHighLightFlag=TRUE; - return; +} + +void SetBoxSecondColumnBackground( INT32 hBoxHandle, UINT8 ubColor ) +{ + UINT32 iCounter = 0; + + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + Assert( PopUpBoxList[hBoxHandle] != NULL ); + + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + { + if ( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + { + PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubBackgroundColor = ubColor; + } + } + + return; +} + +void SetBoxSecondColumnHighLight( INT32 hBoxHandle, UINT8 ubColor ) +{ + UINT32 iCounter = 0; + + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + Assert( PopUpBoxList[hBoxHandle] != NULL ); + + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + { + if ( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + { + PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubHighLight = ubColor; + } + } + + return; +} + +void SetBoxSecondColumnShade( INT32 hBoxHandle, UINT8 ubColor ) +{ + UINT32 iCounter = 0; + + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + Assert( PopUpBoxList[hBoxHandle] != NULL ); + + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + { + if ( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + { + PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubShade = ubColor; + } + } + return; +} + + +void SetBoxColumnForeground( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ) +{ + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + auto box = PopUpBoxList[hBoxHandle]; + Assert( box != NULL ); + + for ( UINT32 uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) + { + if ( box->Text[column][uiCounter] != NULL ) + { + box->Text[column][uiCounter]->ubForegroundColor = ubColor; + } + } + return; +} + +void SetBoxColumnBackground( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ) +{ + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + auto box = PopUpBoxList[hBoxHandle]; + Assert( box != NULL ); + + for ( UINT32 uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) + { + if ( box->Text[column][uiCounter] != NULL ) + { + box->Text[column][uiCounter]->ubBackgroundColor = ubColor; + } + } + return; +} + +void SetBoxColumnHighLight( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ) +{ + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + auto box = PopUpBoxList[hBoxHandle]; + Assert( box != NULL ); + + for ( UINT32 uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) + { + if ( box->Text[column][uiCounter] != NULL ) + { + box->Text[column][uiCounter]->ubHighLight = ubColor; + } + } + return; +} + +void SetBoxColumnShade( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ) +{ + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + auto box = PopUpBoxList[hBoxHandle]; + Assert( box != NULL ); + + for ( UINT32 uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) + { + if ( box->Text[column][uiCounter] != NULL ) + { + box->Text[column][uiCounter]->ubShade = ubColor; + } + } + return; +} + + + +void HighLightLine( INT32 hStringHandle, UINT8 column ) +{ + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) + return; + + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); + + if ( !box->Text[column][hStringHandle] ) + return; + box->Text[column][hStringHandle]->fHighLightFlag = TRUE; + return; +} + +void HighLight2ndLine( INT32 hStringHandle ) +{ + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) + return; + + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); + + if ( !box->pSecondColumnString[hStringHandle] ) + return; + box->pSecondColumnString[hStringHandle]->fHighLightFlag = TRUE; + return; } BOOLEAN GetShadeFlag( INT32 hStringHandle ) @@ -1040,10 +1314,10 @@ BOOLEAN GetShadeFlag( INT32 hStringHandle ) Assert( PopUpBoxList[guiCurrentBox] != NULL ); - if(!PopUpBoxList[guiCurrentBox]->Text[hStringHandle]) + if(!PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]) return( FALSE ); - return( PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->fShadeFlag); + return( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->fShadeFlag); } BOOLEAN GetSecondaryShadeFlag( INT32 hStringHandle ) @@ -1053,27 +1327,42 @@ BOOLEAN GetSecondaryShadeFlag( INT32 hStringHandle ) Assert( PopUpBoxList[guiCurrentBox] != NULL ); - if(!PopUpBoxList[guiCurrentBox]->Text[hStringHandle]) + if(!PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]) return( FALSE ); - return( PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->fSecondaryShadeFlag ); + return( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->fSecondaryShadeFlag ); } -void HighLightBoxLine( INT32 hBoxHandle, INT32 iLineNumber ) +void HighLightBoxLine( INT32 hBoxHandle, INT32 iLineNumber, UINT8 column ) { if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) return; // highlight iLineNumber Line in box indexed by hBoxHandle - if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) + if( PopUpBoxList[hBoxHandle]->Text[column][iLineNumber]!=NULL) { // set current box SetCurrentBox( hBoxHandle ); // highlight line - HighLightLine( iLineNumber ); + HighLightLine( iLineNumber, column ); + } + + return; +} + +void HighLight2ndBoxLine( INT32 hBoxHandle, INT32 iLineNumber ) +{ + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + // highlight iLineNumber Line in box indexed by hBoxHandle + if ( PopUpBoxList[hBoxHandle]->pSecondColumnString[iLineNumber] != NULL ) + { + SetCurrentBox( hBoxHandle ); + HighLight2ndLine( iLineNumber ); } return; @@ -1084,9 +1373,9 @@ BOOLEAN GetBoxShadeFlag( INT32 hBoxHandle, INT32 iLineNumber ) if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) return(FALSE); - if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) + if( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]!=NULL) { - return( PopUpBoxList[hBoxHandle]->Text[iLineNumber]->fShadeFlag ); + return( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fShadeFlag ); } @@ -1098,40 +1387,50 @@ BOOLEAN GetBoxSecondaryShadeFlag( INT32 hBoxHandle, INT32 iLineNumber ) if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) return(FALSE); - if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) + if( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]!=NULL) { - return( PopUpBoxList[hBoxHandle]->Text[iLineNumber]->fSecondaryShadeFlag ); + return( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fSecondaryShadeFlag ); } return( FALSE ); } -void UnHighLightLine(INT32 hStringHandle) +void UnHighLightLine( INT32 hStringHandle ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); - if(!PopUpBoxList[guiCurrentBox]->Text[hStringHandle]) + if ( !PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ) + return; + PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->fHighLightFlag = FALSE; return; - PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->fHighLightFlag=FALSE; - return; } -void UnHighLightBox(INT32 hBoxHandle) +void UnHighLightBox( INT32 hBoxHandle ) { - INT32 iCounter=0; + INT32 iCounter = 0; - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - for(iCounter=0; iCounter Text[iCounter]) - PopUpBoxList[hBoxHandle]->Text[iCounter]->fHighLightFlag=FALSE; - } + auto box = PopUpBoxList[hBoxHandle]; + for ( size_t i = 0; i < MAX_POPUP_BOX_COLUMNS; i++ ) + { + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + { + if ( box->Text[i][iCounter] ) + box->Text[i][iCounter]->fHighLightFlag = FALSE; + } + } + + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + { + if ( box->pSecondColumnString[iCounter] ) + box->pSecondColumnString[iCounter]->fHighLightFlag = FALSE; + } } void UnHighLightSecondColumnLine(INT32 hStringHandle) @@ -1180,7 +1479,7 @@ void RemoveOneCurrentBoxString(INT32 hStringHandle, BOOLEAN fFillGaps) // shuffle all strings down a slot to fill in the gap for ( uiCounter = hStringHandle; uiCounter < ( MAX_POPUP_BOX_STRING_COUNT - 1 ); uiCounter++ ) { - PopUpBoxList[guiCurrentBox]->Text[uiCounter]=PopUpBoxList[guiCurrentBox]->Text[uiCounter+1]; + PopUpBoxList[guiCurrentBox]->Text[0][uiCounter]=PopUpBoxList[guiCurrentBox]->Text[0][uiCounter+1]; PopUpBoxList[guiCurrentBox]->pSecondColumnString[uiCounter]=PopUpBoxList[guiCurrentBox]->pSecondColumnString[uiCounter+1]; } } @@ -1189,39 +1488,43 @@ void RemoveOneCurrentBoxString(INT32 hStringHandle, BOOLEAN fFillGaps) } - void RemoveAllCurrentBoxStrings( void ) { UINT32 uiCounter; - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) || !PopUpBoxList[guiCurrentBox] ) return; - for(uiCounter=0; uiCounter = MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - GetCurrentBox(&hOldBoxHandle); - SetCurrentBox(hBoxHandle); + GetCurrentBox( &hOldBoxHandle ); + SetCurrentBox( hBoxHandle ); - RemoveAllCurrentBoxStrings(); + RemoveAllCurrentBoxStrings(); - MemFree(PopUpBoxList[hBoxHandle]); - PopUpBoxList[hBoxHandle]=NULL; + MemFree( PopUpBoxList[hBoxHandle] ); + PopUpBoxList[hBoxHandle] = NULL; - if(hOldBoxHandle !=hBoxHandle) - SetCurrentBox(hOldBoxHandle); + if ( hOldBoxHandle != hBoxHandle ) + SetCurrentBox( hOldBoxHandle ); - return; + return; } @@ -1288,15 +1591,15 @@ void DisplayBoxes(UINT32 uiBuffer) void DisplayOnePopupBox( UINT32 uiIndex, UINT32 uiBuffer ) { - if ( ( uiIndex < 0 ) || ( uiIndex >= MAX_POPUP_BOX_COUNT ) ) + if ( (uiIndex < 0) || (uiIndex >= MAX_POPUP_BOX_COUNT) ) return; - if ( PopUpBoxList[ uiIndex ] != NULL ) + if ( PopUpBoxList[uiIndex] != NULL ) { - if( ( PopUpBoxList[ uiIndex ]->uiBuffer == uiBuffer) && ( PopUpBoxList[ uiIndex ]->fShowBox ) ) + if ( (PopUpBoxList[uiIndex]->uiBuffer == uiBuffer) && (PopUpBoxList[uiIndex]->fShowBox) ) { - DrawBox( uiIndex ); - DrawBoxText( uiIndex ); + DrawBox( uiIndex ); + DrawBoxText( uiIndex ); } } } @@ -1356,7 +1659,7 @@ BOOLEAN DrawBox(UINT32 uiCounter) usTopX=(UINT16)PopUpBoxList[uiCounter]->Position.iX; usTopY=(UINT16)PopUpBoxList[uiCounter]->Position.iY; - usWidth=((UINT16)(PopUpBoxList[uiCounter]->Dimensions.iRight-PopUpBoxList[uiCounter]->Dimensions.iLeft + PopUpBoxList[uiCounter]->usSecondColumnOffsetAdjustment)); + usWidth = ((UINT16)(PopUpBoxList[uiCounter]->Dimensions.iRight - PopUpBoxList[uiCounter]->Dimensions.iLeft + PopUpBoxList[uiCounter]->usSecondColumnOffsetAdjustment)); usHeight=((UINT16)(PopUpBoxList[uiCounter]->Dimensions.iBottom-PopUpBoxList[uiCounter]->Dimensions.iTop)); //CHRISL: Adjust position for screen limits @@ -1440,171 +1743,224 @@ BOOLEAN DrawBox(UINT32 uiCounter) -BOOLEAN DrawBoxText(UINT32 uiCounter) +BOOLEAN DrawBoxText( UINT32 uiCounter ) { - UINT32 uiCount=0; - INT16 uX, uY; - CHAR16 sString[100]; + UINT32 uiCount = 0; + INT16 uX, uY; + CHAR16 sString[100]; - if ( ( uiCounter < 0 ) || ( uiCounter >= MAX_POPUP_BOX_COUNT ) ) + if ( (uiCounter < 0) || (uiCounter >= MAX_POPUP_BOX_COUNT) ) return(FALSE); + Assert( PopUpBoxList[uiCounter] != NULL ); - Assert( PopUpBoxList[uiCounter] != NULL ); - - //clip text? - if(PopUpBoxList[uiCounter]->uiFlags & POPUP_BOX_FLAG_CLIP_TEXT) - { - SetFontDestBuffer(PopUpBoxList[uiCounter]->uiBuffer,PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin-1, PopUpBoxList[uiCounter]->Position.iY+PopUpBoxList[uiCounter]->uiTopMargin, PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->Dimensions.iRight-PopUpBoxList[uiCounter]->uiRightMargin,PopUpBoxList[uiCounter]->Position.iY+PopUpBoxList[uiCounter]->Dimensions.iBottom-PopUpBoxList[uiCounter]->uiBottomMargin, FALSE); - } - - for(uiCount=0; uiCount Text[uiCount]) + auto box = PopUpBoxList[uiCounter]; + //clip text? + if ( box->uiFlags & POPUP_BOX_FLAG_CLIP_TEXT ) { - // set font - SetFont(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont); + const auto x1 = box->Position.iX + box->uiLeftMargin - 1; + const auto y1 = box->Position.iY + box->uiTopMargin; + const auto x2 = box->Position.iX + box->Dimensions.iRight - box->uiRightMargin; + const auto y2 = box->Position.iY + box->Dimensions.iBottom - box->uiBottomMargin; + SetFontDestBuffer( box->uiBuffer, x1, y1, x2, y2, FALSE ); + } - // are we highlighting?...shading?..or neither - if( ( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fHighLightFlag == FALSE )&&( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fShadeFlag == FALSE) &&( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fSecondaryShadeFlag == FALSE ) ) - { - // neither - SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubForegroundColor); - } - else if( ( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fHighLightFlag == TRUE ) ) - { - // highlight - SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubHighLight); - } - else if( ( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fSecondaryShadeFlag == TRUE ) ) - { - SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubSecondaryShade); - } - else - { - //shading - SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubShade); - } + for ( size_t i = 0; i < MAX_POPUP_BOX_COLUMNS; i++ ) + { - // set background - SetFontBackground(PopUpBoxList[uiCounter]->Text[uiCount]->ubBackgroundColor); - - // copy string - wcsncpy(sString, PopUpBoxList[uiCounter]->Text[uiCount]->pString, wcslen(PopUpBoxList[uiCounter]->Text[uiCount]->pString)+1); - - // centering? - if(PopUpBoxList[uiCounter]->uiFlags & POPUP_BOX_FLAG_CENTER_TEXT) + for ( uiCount = 0; uiCount < MAX_POPUP_BOX_STRING_COUNT; uiCount++ ) { - FindFontCenterCoordinates(((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin)),((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)),((INT16)(PopUpBoxList[uiCounter]->Dimensions.iRight-(PopUpBoxList[uiCounter]->uiRightMargin+PopUpBoxList[uiCounter]->uiLeftMargin+2))),((INT16)GetFontHeight(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont)),(sString),((INT32)PopUpBoxList[uiCounter]->Text[uiCount]->uiFont) ,&uX, &uY); - } - else - { - uX=((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin)); - uY=((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)); - } + auto entry = box->Text[i][uiCount]; + // there is text in this line? + if ( entry ) + { + // set font + SetFont( entry->uiFont ); - // print - mprintf(uX,uY,PopUpBoxList[uiCounter]->Text[uiCount]->pString); + // are we highlighting?...shading?..or neither + if ( (entry->fHighLightFlag == FALSE) && (entry->fShadeFlag == FALSE) && (entry->fSecondaryShadeFlag == FALSE) ) + { + // neither + SetFontForeground( entry->ubForegroundColor ); + } + else if ( (entry->fHighLightFlag == TRUE) ) + { + // highlight + SetFontForeground( entry->ubHighLight ); + } + else if ( (entry->fSecondaryShadeFlag == TRUE) ) + { + SetFontForeground( entry->ubSecondaryShade ); + } + else + { + //shading + SetFontForeground( entry->ubShade ); + } + + // set background + SetFontBackground( entry->ubBackgroundColor ); + + // copy string + wcsncpy( sString, entry->pString, wcslen( entry->pString ) + 1 ); + + // centering? + if ( box->uiFlags & POPUP_BOX_FLAG_CENTER_TEXT ) + { + INT16 sLeft = box->Position.iX + box->uiLeftMargin; + INT16 sTop = box->Position.iY + uiCount * GetFontHeight( entry->uiFont ) + box->uiTopMargin + uiCount * box->uiLineSpace; + INT16 sWidth = box->Dimensions.iRight - (box->uiRightMargin + box->uiLeftMargin + 2); + INT16 sHeight = GetFontHeight( entry->uiFont ); + FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, (sString), ((INT32)entry->uiFont), &uX, &uY ); + } + else + { + uX = box->Position.iX + box->uiLeftMargin + box->uiSecondColumnCurrentOffset*i; + uY = ((INT16)(box->Position.iY + uiCount * GetFontHeight( entry->uiFont ) + box->uiTopMargin + uiCount * box->uiLineSpace)); + } + + // print + mprintf( uX, uY, entry->pString ); + } + } + } + + for ( uiCount = 0; uiCount < MAX_POPUP_BOX_STRING_COUNT; uiCount++ ) + { + // there is secondary text in this line? + if ( box->pSecondColumnString[uiCount] ) + { + // set font + SetFont( box->pSecondColumnString[uiCount]->uiFont ); + + // are we highlighting?...shading?..or neither + if ( (box->pSecondColumnString[uiCount]->fHighLightFlag == FALSE) && (box->pSecondColumnString[uiCount]->fShadeFlag == FALSE) ) + { + // neither + SetFontForeground( box->pSecondColumnString[uiCount]->ubForegroundColor ); + } + else if ( (box->pSecondColumnString[uiCount]->fHighLightFlag == TRUE) ) + { + // highlight + SetFontForeground( box->pSecondColumnString[uiCount]->ubHighLight ); + } + else + { + //shading + SetFontForeground( box->pSecondColumnString[uiCount]->ubShade ); + } + + // set background + SetFontBackground( box->pSecondColumnString[uiCount]->ubBackgroundColor ); + + // copy string + wcsncpy( sString, box->pSecondColumnString[uiCount]->pString, wcslen( box->pSecondColumnString[uiCount]->pString ) + 1 ); + + // centering? + if ( box->uiFlags & POPUP_BOX_FLAG_CENTER_TEXT ) + { + FindFontCenterCoordinates( ((INT16)(box->Position.iX + box->uiLeftMargin)), ((INT16)(box->Position.iY + uiCount * GetFontHeight( box->pSecondColumnString[uiCount]->uiFont ) + box->uiTopMargin + uiCount * box->uiLineSpace)), ((INT16)(box->Dimensions.iRight - (box->uiRightMargin + box->uiLeftMargin + 2))), ((INT16)GetFontHeight( box->pSecondColumnString[uiCount]->uiFont )), (sString), ((INT32)box->pSecondColumnString[uiCount]->uiFont), &uX, &uY ); + } + else + { + uX = ((INT16)(box->Position.iX + box->uiLeftMargin + box->uiSecondColumnCurrentOffset + box->usSecondColumnOffsetAdjustment)); + uY = ((INT16)(box->Position.iY + uiCount * GetFontHeight( box->pSecondColumnString[uiCount]->uiFont ) + box->uiTopMargin + uiCount * box->uiLineSpace)); + } + + // print + mprintf( uX, uY, box->pSecondColumnString[uiCount]->pString ); + } } - // there is secondary text in this line? - if(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]) + if ( box->uiBuffer != guiSAVEBUFFER ) { - // set font - SetFont(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont); - - // are we highlighting?...shading?..or neither - if( ( PopUpBoxList[ uiCounter ]->pSecondColumnString[ uiCount ]->fHighLightFlag == FALSE )&&( PopUpBoxList[ uiCounter ]->pSecondColumnString[ uiCount ]->fShadeFlag == FALSE) ) - { - // neither - SetFontForeground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubForegroundColor); - } - else if( ( PopUpBoxList[ uiCounter ]->pSecondColumnString[ uiCount ]->fHighLightFlag == TRUE ) ) - { - // highlight - SetFontForeground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubHighLight); - } - else - { - //shading - SetFontForeground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubShade); - } - - // set background - SetFontBackground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubBackgroundColor); - - // copy string - wcsncpy(sString, PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->pString, wcslen(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->pString)+1); - - // centering? - if(PopUpBoxList[uiCounter]->uiFlags & POPUP_BOX_FLAG_CENTER_TEXT) - { - FindFontCenterCoordinates(((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin)),((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)),((INT16)(PopUpBoxList[uiCounter]->Dimensions.iRight-(PopUpBoxList[uiCounter]->uiRightMargin+PopUpBoxList[uiCounter]->uiLeftMargin+2))),((INT16)GetFontHeight(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont)),(sString),((INT32)PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont) ,&uX, &uY); - } - else - { - uX=((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin + PopUpBoxList[uiCounter]->uiSecondColumnCurrentOffset + PopUpBoxList[uiCounter]->usSecondColumnOffsetAdjustment)); - uY=((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)); - } - - // print - mprintf(uX,uY,PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->pString); - } - } - - - if( PopUpBoxList[uiCounter]->uiBuffer != guiSAVEBUFFER ) - { - InvalidateRegion( PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin-1, PopUpBoxList[uiCounter]->Position.iY+PopUpBoxList[uiCounter]->uiTopMargin, PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->Dimensions.iRight-PopUpBoxList[uiCounter]->uiRightMargin,PopUpBoxList[uiCounter]->Position.iY+PopUpBoxList[uiCounter]->Dimensions.iBottom-PopUpBoxList[uiCounter]->uiBottomMargin ); + InvalidateRegion( box->Position.iX + box->uiLeftMargin - 1, box->Position.iY + box->uiTopMargin, box->Position.iX + box->Dimensions.iRight - box->uiRightMargin, box->Position.iY + box->Dimensions.iBottom - box->uiBottomMargin ); } - SetFontDestBuffer(FRAME_BUFFER, 0,0,SCREEN_WIDTH, SCREEN_HEIGHT,FALSE); + SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); - return TRUE; + return TRUE; } -void ResizeBoxToText(INT32 hBoxHandle) +void ResizeBoxToText( INT32 hBoxHandle ) { // run through lines of text in box and size box width to longest line plus margins // height is sum of getfontheight of each line+ spacing - INT32 iWidth=0; - INT32 iHeight=0; - INT32 iCurrString=0; + INT32 iWidth = 0; + INT32 iHeight = 0; + INT32 iCurrString = 0; INT32 iSecondColumnLength = 0; - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - if(!PopUpBoxList[hBoxHandle]) + if ( !PopUpBoxList[hBoxHandle] ) return; - ResizeBoxForSecondStrings( hBoxHandle ); + if ( hBoxHandle == ghMoveBox ) + { + ResizeStrategicMvtBoxForSecondStrings( hBoxHandle ); + } + else + { + ResizeBoxForSecondStrings( hBoxHandle ); + } - iHeight=PopUpBoxList[hBoxHandle]->uiTopMargin+PopUpBoxList[hBoxHandle]->uiBottomMargin; + auto box = PopUpBoxList[hBoxHandle]; + const UINT32 margins = box->uiLeftMargin + box->uiRightMargin; + + iHeight = box->uiTopMargin + box->uiBottomMargin; for ( iCurrString = 0; iCurrString < MAX_POPUP_BOX_STRING_COUNT; iCurrString++ ) { - if ( PopUpBoxList[hBoxHandle]->Text[iCurrString] != NULL) + if ( box->Text[0][iCurrString] != NULL ) { - if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCurrString] != NULL ) + + if ( box->Text[3][iCurrString] != NULL && wcscmp( box->Text[3][iCurrString]->pString, L"") != 0) { - iSecondColumnLength = StringPixLength( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCurrString]->pString,PopUpBoxList[ hBoxHandle]->pSecondColumnString[ iCurrString ]->uiFont ); - if( PopUpBoxList[hBoxHandle]->uiSecondColumnCurrentOffset + iSecondColumnLength + PopUpBoxList[hBoxHandle]->uiLeftMargin+PopUpBoxList[hBoxHandle]->uiRightMargin > ( ( UINT32 ) iWidth ) ) + iSecondColumnLength = StringPixLength( box->Text[3][iCurrString]->pString, box->Text[3][iCurrString]->uiFont ); + if ( 3*box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins > iWidth ) { - iWidth = PopUpBoxList[hBoxHandle]->uiSecondColumnCurrentOffset + iSecondColumnLength + PopUpBoxList[hBoxHandle]->uiLeftMargin+PopUpBoxList[hBoxHandle]->uiRightMargin; + iWidth = 3*box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins; + } + } + else if ( box->Text[2][iCurrString] != NULL && wcscmp( box->Text[2][iCurrString]->pString, L"" ) != 0 ) + { + iSecondColumnLength = StringPixLength( box->Text[2][iCurrString]->pString, box->Text[2][iCurrString]->uiFont ); + if ( 2*box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins > iWidth ) + { + iWidth = 2*box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins; + } + } + else if ( box->Text[1][iCurrString] != NULL && wcscmp( box->Text[1][iCurrString]->pString, L"" ) != 0 ) + { + iSecondColumnLength = StringPixLength( box->Text[1][iCurrString]->pString, box->Text[1][iCurrString]->uiFont ); + if ( box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins > iWidth ) + { + iWidth = box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins; } } - if( ( StringPixLength(PopUpBoxList[hBoxHandle]->Text[iCurrString]->pString,PopUpBoxList[hBoxHandle]->Text[iCurrString]->uiFont ) + PopUpBoxList[hBoxHandle]->uiLeftMargin+PopUpBoxList[hBoxHandle]->uiRightMargin ) > ( (UINT32) iWidth ) ) - iWidth=StringPixLength(PopUpBoxList[hBoxHandle]->Text[iCurrString]->pString,PopUpBoxList[hBoxHandle]->Text[iCurrString]->uiFont ) + PopUpBoxList[hBoxHandle]->uiLeftMargin+PopUpBoxList[hBoxHandle]->uiRightMargin; + + if ( box->pSecondColumnString[iCurrString] != NULL ) + { + iSecondColumnLength = StringPixLength( box->pSecondColumnString[iCurrString]->pString, box->pSecondColumnString[iCurrString]->uiFont ); + if ( box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins > iWidth ) + { + iWidth = box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins; + } + } + + INT32 iFirstColumnLength = StringPixLength( box->Text[0][iCurrString]->pString, box->Text[0][iCurrString]->uiFont ) + margins; + if ( iFirstColumnLength > iWidth ) + iWidth = iFirstColumnLength; //vertical - iHeight+=GetFontHeight(PopUpBoxList[hBoxHandle]->Text[iCurrString]->uiFont)+PopUpBoxList[hBoxHandle]->uiLineSpace; + iHeight += GetFontHeight( box->Text[0][iCurrString]->uiFont ) + box->uiLineSpace; } else { @@ -1614,14 +1970,14 @@ void ResizeBoxToText(INT32 hBoxHandle) } // Flugente we shouldn't have added more popup options than we can display anyway, but I have no idea where to stop that, so at least we can fix this - PopUpBoxList[hBoxHandle]->Dimensions.iBottom = min( iHeight, SCREEN_HEIGHT - PopUpBoxList[hBoxHandle]->Position.iY); - PopUpBoxList[hBoxHandle]->Dimensions.iRight = min( iWidth, SCREEN_WIDTH - PopUpBoxList[hBoxHandle]->Position.iX ); + box->Dimensions.iBottom = min( iHeight, SCREEN_HEIGHT - box->Position.iY ); + box->Dimensions.iRight = min( iWidth, SCREEN_WIDTH - box->Position.iX ); // Constrain popup box height to background graphics max height. Otherwise we get blue graphics glitches - const auto popupBoxHeight = PopUpBoxList[hBoxHandle]->Dimensions.iBottom - PopUpBoxList[hBoxHandle]->Dimensions.iTop; - if (popupBoxHeight > 480) + const auto popupBoxHeight = box->Dimensions.iBottom - box->Dimensions.iTop; + if ( popupBoxHeight > 480 ) { - PopUpBoxList[hBoxHandle]->Dimensions.iBottom = PopUpBoxList[hBoxHandle]->Dimensions.iTop + 480; + box->Dimensions.iBottom = box->Dimensions.iTop + 480; } } @@ -1666,7 +2022,6 @@ void HideAllBoxes( void ) } - void RemoveCurrentBoxPrimaryText( INT32 hStringHandle ) { if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) @@ -1676,15 +2031,15 @@ void RemoveCurrentBoxPrimaryText( INT32 hStringHandle ) Assert( hStringHandle < MAX_POPUP_BOX_STRING_COUNT ); // remove & release primary text - if(PopUpBoxList[guiCurrentBox]->Text[hStringHandle] != NULL) + if(PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] != NULL) { - if ( PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->pString ) + if ( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->pString ) { - MemFree(PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->pString); + MemFree(PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->pString); } - MemFree(PopUpBoxList[guiCurrentBox]->Text[hStringHandle]); - PopUpBoxList[guiCurrentBox]->Text[hStringHandle]=NULL; + MemFree(PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]); + PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]=NULL; } } @@ -1708,3 +2063,34 @@ void RemoveCurrentBoxSecondaryText( INT32 hStringHandle ) PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]=NULL; } } + +void RemoveCurrentBoxText( INT32 hStringHandle, UINT8 column ) +{ + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) || column >= MAX_POPUP_BOX_COLUMNS ) + return; + + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( hStringHandle < MAX_POPUP_BOX_STRING_COUNT ); + + // remove & release text + auto textColumn = PopUpBoxList[guiCurrentBox]->Text[column]; + + if ( textColumn[hStringHandle] != NULL ) + { + if ( textColumn[hStringHandle]->pString ) + { + MemFree( textColumn[hStringHandle]->pString ); + } + + MemFree( textColumn[hStringHandle] ); + textColumn[hStringHandle] = NULL; + } +} + +UINT32 GetBoxSecondColumnCurrentOffset( INT32 hBoxHandle ) +{ + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return 0; + + return PopUpBoxList[hBoxHandle]->uiSecondColumnCurrentOffset; +} diff --git a/Utils/PopUpBox.h b/Utils/PopUpBox.h index 4f3b6dd7..a140b179 100644 --- a/Utils/PopUpBox.h +++ b/Utils/PopUpBox.h @@ -9,6 +9,7 @@ #define MAX_POPUP_BOX_COUNT 32 #define MAX_POPUP_BOX_STRING_COUNT 128 // worst case = 45: move menu with 20 soldiers, each on different squad + overhead +#define MAX_POPUP_BOX_COLUMNS 4 // PopUpBox Flags #define POPUP_BOX_FLAG_CLIP_TEXT 1 @@ -51,7 +52,8 @@ struct popupbox{ BOOLEAN fUpdated; BOOLEAN fShowBox; - POPUPSTRINGPTR Text[ MAX_POPUP_BOX_STRING_COUNT ]; + POPUPSTRINGPTR Text[MAX_POPUP_BOX_COLUMNS][ MAX_POPUP_BOX_STRING_COUNT ]; + // TODO Remove pSecondColumnString POPUPSTRINGPTR pSecondColumnString[ MAX_POPUP_BOX_STRING_COUNT ]; }; @@ -76,6 +78,8 @@ void SetBoxPosition(INT32 hBoxHandle,SGPPoint Position); void GetBoxPosition( INT32 hBoxHandle, SGPPoint *Position ); UINT32 GetNumberOfLinesOfTextInBox( INT32 hBoxHandle ); UINT32 GetNumberOfSecondaryLinesOfTextInBox(INT32 hBoxHandle); +UINT32 GetTotalNumberOfLinesOfTextInBox( INT32 hBoxHandle ); +UINT32 GetBoxSecondColumnCurrentOffset( INT32 hBoxHandle ); void SetBoxSize( INT32 hBoxHandle, SGPRect Dimensions ); void GetBoxSize( INT32 hBoxHandle, SGPRect *Dimensions ); void SetBoxFlags( INT32 hBoxHandle, UINT32 uiFlags); @@ -96,8 +100,10 @@ void SetBoxHighLight(INT32 hBoxHandle, UINT8 ubColor); void SetBoxShade(INT32 hBoxHandle, UINT8 ubColor); void ShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ); void UnShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ); -void HighLightLine(INT32 hStringHandle); -void HighLightBoxLine( INT32 hBoxHandle, INT32 iLineNumber ); +void HighLightLine( INT32 hStringHandle, UINT8 column ); +void HighLight2ndLine( INT32 hStringHandle ); +void HighLightBoxLine( INT32 hBoxHandle, INT32 iLineNumber, UINT8 column = 0 ); +void HighLight2ndBoxLine( INT32 hBoxHandle, INT32 iLineNumber ); void UnHighLightLine(INT32 hStringHandle); void UnHighLightBox(INT32 hBoxHandle); void RemoveOneCurrentBoxString(INT32 hStringHandle, BOOLEAN fFillGaps); @@ -110,6 +116,9 @@ void DisplayOnePopupBox( UINT32 uiIndex, UINT32 uiBuffer ); void SetCurrentBox(INT32 hBoxHandle); void GetCurrentBox(INT32 *hBoxHandle); +void AddStringToBoxColumn( UINT32 *hStringHandle, STR16 pString, UINT8 column ); +void AddColumnMonoString( UINT32 *hStringHandle, STR16 pString, UINT8 column ); + // resize this box to the text it contains void ResizeBoxToText(INT32 hBoxHandle); @@ -162,6 +171,13 @@ void SetBoxSecondColumnShade(INT32 hBoxHandle, UINT8 ubColor); // Manual adjustment for 2nd column offset, eg. when 1st column has a title text that's wider than the rest and you want to move 2nd column texts towards the 1st column some. void SetBoxSecondColumnOffsetAdjustment(INT32 hBoxHandle, INT16 x); +// Set attributes by column +void SetBoxColumnForeground( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ); +void SetBoxColumnBackground( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ); +void SetBoxColumnHighLight( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ); +void SetBoxColumnShade( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ); +void SetBoxColumnFont( INT32 hBoxHandle, UINT32 uiFont, UINT8 column ); + // secondary shades for boxes void UnSecondaryShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ); @@ -172,4 +188,4 @@ void SetBoxSecondaryShade( INT32 iBox, UINT8 ubColor ); // min width for box void SpecifyBoxMinWidth( INT32 hBoxHandle, INT32 iMinWidth ); -#endif \ No newline at end of file +#endif