Files
source/Laptop/florist Order Form.cpp
T
Overhaul 7a27e7105d New attack busy system
Added missing #includes

Added LUA scripting and console

Changed the way tracers are visualized, so they work more like real tracers instead of a light fountain

Fixed signedness of many grid variables used in GetMouseMapPos calls

Fixed enemy weapon choosing:  Sometimes a mortar is chosen but later rejected, but the grenade class was not reset.  Caused assertion failure

Added checks so enemies don't try to chuck RPG grenades with their hands

Now possible to shoot a someone in the head if he's in water

Fixed InitSightArrays to also clear soldier interrupt duel points.  This was causing an assertion failure elsewhere in the code because the interrupt list still had soldiers on it sometimes when this function was called.

Soldiers are much less willing to forfeit their turn over an attempt to use more APs than they have

Removed early setting of muzzle flash.  This would allow enemies to get an interrupt before you even fired.

Fixed item dropping by AI.  If AI tried to drop something while standing it would cause deadlock

Change to greatly speed up closing the sector inventory window in an unloaded sector

Added conditional compile flag to always give robot weapon ready advantage, even for 360 degree sighting


Check builddefines.h for the conditional flags.  Of greatest interest might be LUA_CONSOLE.  This will cause the game to bring up a command console when run.  However this console is severely lacking in many areas.  If anybody knows of an open-source terminal/console that could be used instead, it would be appreciated.  The existing console does bad things when you try to close it, and since it counts as a separate app, it pauses the game while it has focus.

LUA scripting is very limited, basically just proof of concept.  There is one global variable, the Soldiers array.  An array index gives you the soldier in that slot in the currently loaded sector.  The soldier has a few things that can be accessed:  name (short name); fullname (long name); grid (current grid #, can be changed); walkto(grid) (function to walk to another grid); runto(grid) (function to run to another grid)


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@924 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2007-06-09 09:01:04 +00:00

1325 lines
53 KiB
C++

#ifdef PRECOMPILEDHEADERS
#include "Laptop All.h"
#else
#include "laptop.h"
#include "florist.h"
#include "florist Order Form.h"
#include "WCheck.h"
#include "Utilities.h"
#include "WordWrap.h"
#include "Cursors.h"
#include "florist Gallery.h"
#include "stdio.h"
#include "Encrypted File.h"
#include "florist Cards.h"
#include "Text Input.h"
#include "Finances.h"
#include "Game clock.h"
#include "english.h"
#include "Text.h"
#include "LaptopSave.h"
#include "Random.h"
#endif
#include "meanwhile.h"
#define FLOWER_ORDEER_TINY_FONT FONT10ARIAL
#define FLOWER_ORDEER_SMALL_FONT FONT12ARIAL
#define FLOWER_ORDEER_BIG_FONT FONT12ARIAL
#define FLOWER_ORDEER_SMALL_COLOR FONT_MCOLOR_WHITE
#define FLOWER_ORDEER_LINK_COLOR FONT_MCOLOR_LTYELLOW
#define FLOWER_ORDEER_DROP_DOWN_FONT FONT12ARIAL
#define FLOWER_ORDEER_DROP_DOWN_COLOR FONT_MCOLOR_WHITE
#define FLOWER_ORDER_STATIC_TEXT_COLOR 76
#define FLOWER_ORDER_FLOWER_BOX_X LAPTOP_SCREEN_UL_X + 7
#define FLOWER_ORDER_FLOWER_BOX_Y LAPTOP_SCREEN_WEB_UL_Y + 63
#define FLOWER_ORDER_FLOWER_BOX_WIDTH 75
#define FLOWER_ORDER_FLOWER_BOX_HEIGHT 100
#define FLOWER_ORDER_SENTIMENT_BOX_X LAPTOP_SCREEN_UL_X + 14
#define FLOWER_ORDER_SENTIMENT_BOX_Y LAPTOP_SCREEN_WEB_UL_Y + 226
#define FLOWER_ORDER_SENTIMENT_BOX_WIDTH 468
#define FLOWER_ORDER_SENTIMENT_BOX_HEIGHT 27
#define FLOWER_ORDER_NAME_BOX_X LAPTOP_SCREEN_UL_X + 60
#define FLOWER_ORDER_NAME_BOX_Y LAPTOP_SCREEN_WEB_UL_Y + 314 - FLOWER_ORDER_SMALLER_PS_OFFSET_Y
#define FLOWER_ORDER_SMALLER_PS_OFFSET_Y 27
#define FLOWER_ORDER_DELIVERY_LOCATION_X LAPTOP_SCREEN_UL_X + 205
#define FLOWER_ORDER_DELIVERY_LOCATION_Y LAPTOP_SCREEN_WEB_UL_Y + 143
#define FLOWER_ORDER_DELIVERY_LOCATION_WIDTH 252
#define FLOWER_ORDER_DELIVERY_LOCATION_HEIGHT 20
#define FLOWER_ORDER_BACK_BUTTON_X LAPTOP_SCREEN_UL_X + 8
#define FLOWER_ORDER_BACK_BUTTON_Y LAPTOP_SCREEN_WEB_UL_Y + 12
#define FLOWER_ORDER_SEND_BUTTON_X LAPTOP_SCREEN_UL_X + 124
#define FLOWER_ORDER_SEND_BUTTON_Y LAPTOP_SCREEN_WEB_UL_Y + 364
#define FLOWER_ORDER_CLEAR_BUTTON_X LAPTOP_SCREEN_UL_X + 215
#define FLOWER_ORDER_CLEAR_BUTTON_Y FLOWER_ORDER_SEND_BUTTON_Y
#define FLOWER_ORDER_GALLERY_BUTTON_X LAPTOP_SCREEN_UL_X + 305
#define FLOWER_ORDER_GALLERY_BUTTON_Y FLOWER_ORDER_SEND_BUTTON_Y
#define FLOWER_ORDER_FLOWER_NAME_X LAPTOP_SCREEN_UL_X + 94
#define FLOWER_ORDER_FLOWER_NAME_Y LAPTOP_SCREEN_WEB_UL_Y + 68
#define FLOWER_ORDER_BOUQUET_NAME_X FLOWER_ORDER_FLOWER_NAME_X
#define FLOWER_ORDER_BOUQUET_NAME_Y FLOWER_ORDER_ORDER_NUM_NAME_Y + 15//FLOWER_ORDER_FLOWER_NAME_Y + 15
#define FLOWER_ORDER_ORDER_NUM_NAME_X FLOWER_ORDER_BOUQUET_NAME_X
#define FLOWER_ORDER_ORDER_NUM_NAME_Y FLOWER_ORDER_FLOWER_NAME_Y + 15//FLOWER_ORDER_BOUQUET_NAME_Y + 15
#define FLOWER_ORDER_DATE_X FLOWER_ORDER_FLOWER_NAME_X
#define FLOWER_ORDER_DATE_Y LAPTOP_SCREEN_WEB_UL_Y + 126
#define FLOWER_ORDER_LOCATION_X FLOWER_ORDER_FLOWER_NAME_X
#define FLOWER_ORDER_LOCATION_Y FLOWER_ORDER_DELIVERY_LOCATION_Y + 4
#define FLOWER_ORDER_ADDITIONAL_SERVICES_X FLOWER_ORDER_FLOWER_BOX_X
#define FLOWER_ORDER_ADDITIONAL_SERVICES_Y LAPTOP_SCREEN_WEB_UL_Y + 167
#define FLOWER_ORDER_PERSONAL_SENT_TEXT_X FLOWER_ORDER_ADDITIONAL_SERVICES_X
#define FLOWER_ORDER_PERSONAL_SENT_TEXT_Y LAPTOP_SCREEN_WEB_UL_Y + 212
#define FLOWER_ORDER_PERSONAL_SENT_BOX_X FLOWER_ORDER_SENTIMENT_BOX_X + 5
#define FLOWER_ORDER_PERSONAL_SENT_BOX_Y FLOWER_ORDER_SENTIMENT_BOX_Y + 5
#define FLOWER_ORDER_PERSONAL_SENT_TEXT_WIDTH 457
#define FLOWER_ORDER_PERSONAL_SENT_TEXT_HEIGHT 17//44
#define FLOWER_ORDER_BILLING_INFO_X FLOWER_ORDER_ADDITIONAL_SERVICES_X
#define FLOWER_ORDER_BILLING_INFO_Y LAPTOP_SCREEN_WEB_UL_Y + 296 - FLOWER_ORDER_SMALLER_PS_OFFSET_Y
#define FLOWER_ORDER_NAME_TEXT_X FLOWER_ORDER_ADDITIONAL_SERVICES_X
#define FLOWER_ORDER_NAME_TEXT_Y FLOWER_ORDER_NAME_BOX_Y+4
#define FLOWER_ORDER_NAME_TEXT_WIDTH 50
#define FLOWER_ORDER_NAME_TEXT_BOX_X FLOWER_ORDER_NAME_BOX_X + 3
#define FLOWER_ORDER_NAME_TEXT_BOX_Y FLOWER_ORDER_NAME_BOX_Y + 3
#define FLOWER_ORDER_NAME_TEXT_BOX_WIDTH 257
#define FLOWER_ORDER_NAME_TEXT_BOX_HEIGHT 15
#define FLOWER_ORDER_CHECK_WIDTH 20
#define FLOWER_ORDER_CHECK_HEIGHT 17
#define FLOWER_ORDER_CHECK_BOX_0_X LAPTOP_SCREEN_UL_X + 186
#define FLOWER_ORDER_CHECK_BOX_0_Y FLOWER_ORDER_DATE_Y - 3
#define FLOWER_ORDER_CHECK_BOX_1_X LAPTOP_SCREEN_UL_X + 270
#define FLOWER_ORDER_CHECK_BOX_1_Y FLOWER_ORDER_CHECK_BOX_0_Y
#define FLOWER_ORDER_CHECK_BOX_2_X LAPTOP_SCREEN_UL_X + 123
#define FLOWER_ORDER_CHECK_BOX_2_Y FLOWER_ORDER_ADDITIONAL_SERVICES_Y
#define FLOWER_ORDER_CHECK_BOX_3_X LAPTOP_SCREEN_UL_X + 269
#define FLOWER_ORDER_CHECK_BOX_3_Y FLOWER_ORDER_CHECK_BOX_2_Y
#define FLOWER_ORDER_CHECK_BOX_4_X FLOWER_ORDER_CHECK_BOX_2_X
#define FLOWER_ORDER_CHECK_BOX_4_Y FLOWER_ORDER_CHECK_BOX_2_Y + 25
#define FLOWER_ORDER_CHECK_BOX_5_X FLOWER_ORDER_CHECK_BOX_3_X
#define FLOWER_ORDER_CHECK_BOX_5_Y FLOWER_ORDER_CHECK_BOX_4_Y
#define FLOWER_ORDER_LINK_TO_CARD_GALLERY_X LAPTOP_SCREEN_UL_X + 190
#define FLOWER_ORDER_LINK_TO_CARD_GALLERY_Y LAPTOP_SCREEN_WEB_UL_Y + 284 - FLOWER_ORDER_SMALLER_PS_OFFSET_Y
#define FLOWER_ORDER_DROP_DOWN_LOCATION_X FLOWER_ORDER_DELIVERY_LOCATION_X
#define FLOWER_ORDER_DROP_DOWN_LOCATION_Y FLOWER_ORDER_DELIVERY_LOCATION_Y + 19
#define FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH 230
#define FLOWER_ORDER_DROP_DOWN_CITY_START_X FLOWER_ORDER_DROP_DOWN_LOCATION_X + 5
#define FLOWER_ORDER_DROP_DOWN_CITY_START_Y FLOWER_ORDER_DROP_DOWN_LOCATION_Y + 3
#define FLOWER_ORDER_PERSONEL_SENTIMENT_NUM_CHARS 75
#define FLOWER_ORDER_NAME_FIELD_NUM_CHARS 35
typedef struct
{
STR16 *psCityLoc;
UINT8 ubNextDayDeliveryCost;
UINT8 ubWhenItGetsThereCost;
} FlowerOrderLocationStruct;
#define FLOWER_ORDER_NUMBER_OF_DROP_DOWN_LOCATIONS 17
FlowerOrderLocationStruct FlowerOrderLocations[FLOWER_ORDER_NUMBER_OF_DROP_DOWN_LOCATIONS]={
{ &pDeliveryLocationStrings[0], 20, 15},
{ &pDeliveryLocationStrings[1], 95, 70},
{ &pDeliveryLocationStrings[2], 100, 75},
{ &pDeliveryLocationStrings[3], 50, 35},
{ &pDeliveryLocationStrings[4], 70, 50},
{ &pDeliveryLocationStrings[5], 45, 35},
{ &pDeliveryLocationStrings[6], 30, 25},
{ &pDeliveryLocationStrings[7], 100, 75},
{ &pDeliveryLocationStrings[8], 100, 75},
{ &pDeliveryLocationStrings[9], 30, 25},
{ &pDeliveryLocationStrings[10], 95, 70},
{ &pDeliveryLocationStrings[11], 30, 25},
{ &pDeliveryLocationStrings[12], 40, 30},
{ &pDeliveryLocationStrings[13], 45, 35},
{ &pDeliveryLocationStrings[14], 95, 70},
{ &pDeliveryLocationStrings[15], 50, 40},
{ &pDeliveryLocationStrings[16], 40, 30}
};
UINT32 guiDeliveryLocation;
UINT32 guiFlowerFrame;
UINT32 guiCurrentlySelectedFlowerImage;
UINT32 guiNameBox;
UINT32 guiPersonalSentiments;
UINT32 guiFlowerOrderCheckBoxButtonImage;
extern UINT32 guiDropDownBorder; // symbol already defined in BobbyRMailOrder.cpp (jonathanl)
BOOLEAN gfFLoristCheckBox0Down = FALSE; // next day delviery
BOOLEAN gfFLoristCheckBox1Down = TRUE; // when it gets there delivery
BOOLEAN gfFLoristCheckBox2Down = FALSE;
BOOLEAN gfFLoristCheckBox3Down = FALSE;
BOOLEAN gfFLoristCheckBox4Down = FALSE;
BOOLEAN gfFLoristCheckBox5Down = FALSE;
UINT32 guiFlowerPrice;
//drop down menu
enum
{
FLOWER_ORDER_DROP_DOWN_NO_ACTION,
FLOWER_ORDER_DROP_DOWN_CREATE,
FLOWER_ORDER_DROP_DOWN_DESTROY,
FLOWER_ORDER_DROP_DOWN_DISPLAY,
};
//the current mode of the drop down display
UINT8 gubFlowerDestDropDownMode;
UINT8 gubCurrentlySelectedFlowerLocation;
CHAR16 gsSentimentTextField[ FLOWER_ORDER_PERSONEL_SENTIMENT_NUM_CHARS ] = {0} ;
CHAR16 gsNameTextField[ FLOWER_ORDER_NAME_FIELD_NUM_CHARS ] = {0};
//buttons
INT32 guiFlowerOrderButtonImage;
UINT8 gubFlowerOrder_AdditioanalServicePrices[] = {10, 20, 10, 10};
void BtnFlowerOrderBackButtonCallback(GUI_BUTTON *btn,INT32 reason);
UINT32 guiFlowerOrderBackButton;
void BtnFlowerOrderSendButtonCallback(GUI_BUTTON *btn,INT32 reason);
UINT32 guiFlowerOrderSendButton;
void BtnFlowerOrderClearButtonCallback(GUI_BUTTON *btn,INT32 reason);
UINT32 guiFlowerOrderClearButton;
void BtnFlowerOrderGalleryButtonCallback(GUI_BUTTON *btn,INT32 reason);
UINT32 guiFlowerOrderGalleryButton;
//Clicking on OrderCheckBox
MOUSE_REGION gSelectedFloristCheckBoxRegion[ 6 ];
void SelectFlorsitCheckBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason );
//link to the card gallery
MOUSE_REGION gSelectedFloristCardGalleryLinkRegion;
void SelectFloristCardGalleryLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason );
//link to the flower gallery by clicking on the flower
MOUSE_REGION gSelectedFloristGalleryLinkRegion;
void SelectFloristGalleryLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason );
//the drop down for the city
MOUSE_REGION gSelectedFloristDropDownRegion;
void SelectFloristDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason );
//to disable the drop down window
MOUSE_REGION gSelectedFloristDisableDropDownRegion;
void SelectFloristDisableDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason );
//mouse region for the drop down city location area
MOUSE_REGION gSelectedFlowerDropDownRegion[ FLOWER_ORDER_NUMBER_OF_DROP_DOWN_LOCATIONS ];
void SelectFlowerDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason );
void SelectFlowerDropDownMovementCallBack(MOUSE_REGION * pRegion, INT32 iReason );
//to select typing in the personal sentiment box
//MOUSE_REGION gSelectedFloristPersonalSentimentBoxRegion;
//void SelectFloristPersonalSentimentBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason );
void DisplayFloristCheckBox();
void DisplayFlowerDynamicItems();
BOOLEAN CreateDestroyFlowerOrderDestDropDown( UINT8 ubDropDownMode );
void FlowerOrderDrawSelectedCity( UINT8 ubNumber );
void FlowerOrderDisplayShippingLocationCity();
void InitFlowerOrderTextInputBoxes();
void DestroyFlowerOrderTextInputBoxes();
void HandleFloristOrderKeyBoardInput();
void FlowerOrderUserTextFieldCallBack( UINT8 ubID, BOOLEAN fEntering);
void GameInitFloristOrderForm()
{
}
BOOLEAN EnterFloristOrderForm()
{
VOBJECT_DESC VObjectDesc;
UINT8 i;
char sTemp[40];
UINT16 usPosX, usWidth, usHeight;
InitFloristDefaults();
// load the DeliveryLocation graphic and add it
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
FilenameForBPP("LAPTOP\\DeliveryLocation.sti", VObjectDesc.ImageFile);
CHECKF(AddVideoObject(&VObjectDesc, &guiDeliveryLocation));
// load the Flower frame graphic and add it
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
FilenameForBPP("LAPTOP\\FlowerFrame.sti", VObjectDesc.ImageFile);
CHECKF(AddVideoObject(&VObjectDesc, &guiFlowerFrame));
// load the Personel sentiments graphic and add it
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
FilenameForBPP("LAPTOP\\PersonalSentiments.sti", VObjectDesc.ImageFile);
CHECKF(AddVideoObject(&VObjectDesc, &guiPersonalSentiments));
// load the Name Box graphic and add it
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
FilenameForBPP("LAPTOP\\NameBox.sti", VObjectDesc.ImageFile);
CHECKF(AddVideoObject(&VObjectDesc, &guiNameBox));
// load the Check Box graphic and add it
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
FilenameForBPP("LAPTOP\\OrderCheckBox.sti", VObjectDesc.ImageFile);
CHECKF(AddVideoObject(&VObjectDesc, &guiFlowerOrderCheckBoxButtonImage));
// load the currently selected flower bouquet
sprintf( sTemp, "LAPTOP\\Flower_%d.sti", guiCurrentlySelectedFlower);
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
FilenameForBPP( sTemp, VObjectDesc.ImageFile);
CHECKF(AddVideoObject(&VObjectDesc, &guiCurrentlySelectedFlowerImage));
// border
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
FilenameForBPP( "INTERFACE\\TactPopUp.sti", VObjectDesc.ImageFile );
CHECKF( AddVideoObject( &VObjectDesc, &guiDropDownBorder ) );
guiFlowerOrderButtonImage = LoadButtonImage("LAPTOP\\FloristButtons.sti", -1,0,-1,1,-1 );
guiFlowerOrderBackButton = CreateIconAndTextButton( guiFlowerOrderButtonImage, sOrderFormText[FLORIST_ORDER_BACK], FLORIST_BUTTON_TEXT_FONT,
FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR,
FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR,
TEXT_CJUSTIFIED,
FLOWER_ORDER_BACK_BUTTON_X, FLOWER_ORDER_BACK_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
DEFAULT_MOVE_CALLBACK, BtnFlowerOrderBackButtonCallback);
SetButtonCursor(guiFlowerOrderBackButton, CURSOR_WWW );
guiFlowerOrderSendButton = CreateIconAndTextButton( guiFlowerOrderButtonImage, sOrderFormText[FLORIST_ORDER_SEND], FLORIST_BUTTON_TEXT_FONT,
FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR,
FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR,
TEXT_CJUSTIFIED,
FLOWER_ORDER_SEND_BUTTON_X, FLOWER_ORDER_SEND_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
DEFAULT_MOVE_CALLBACK, BtnFlowerOrderSendButtonCallback);
SetButtonCursor(guiFlowerOrderSendButton, CURSOR_WWW );
guiFlowerOrderClearButton = CreateIconAndTextButton( guiFlowerOrderButtonImage, sOrderFormText[FLORIST_ORDER_CLEAR], FLORIST_BUTTON_TEXT_FONT,
FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR,
FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR,
TEXT_CJUSTIFIED,
FLOWER_ORDER_CLEAR_BUTTON_X, FLOWER_ORDER_CLEAR_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
DEFAULT_MOVE_CALLBACK, BtnFlowerOrderClearButtonCallback);
SetButtonCursor(guiFlowerOrderClearButton, CURSOR_WWW );
guiFlowerOrderGalleryButton = CreateIconAndTextButton( guiFlowerOrderButtonImage, sOrderFormText[FLORIST_ORDER_GALLERY], FLORIST_BUTTON_TEXT_FONT,
FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR,
FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR,
TEXT_CJUSTIFIED,
FLOWER_ORDER_GALLERY_BUTTON_X, FLOWER_ORDER_GALLERY_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH,
DEFAULT_MOVE_CALLBACK, BtnFlowerOrderGalleryButtonCallback);
SetButtonCursor(guiFlowerOrderGalleryButton, CURSOR_WWW );
//
// The check box mouse regions
//
i=0;
MSYS_DefineRegion( &gSelectedFloristCheckBoxRegion[i], FLOWER_ORDER_CHECK_BOX_0_X, FLOWER_ORDER_CHECK_BOX_0_Y, (UINT16)(FLOWER_ORDER_CHECK_BOX_0_X + FLOWER_ORDER_CHECK_WIDTH), (UINT16)(FLOWER_ORDER_CHECK_BOX_0_Y + FLOWER_ORDER_CHECK_HEIGHT), MSYS_PRIORITY_HIGH,
CURSOR_WWW, MSYS_NO_CALLBACK, SelectFlorsitCheckBoxRegionCallBack );
MSYS_AddRegion(&gSelectedFloristCheckBoxRegion[i]);
MSYS_SetRegionUserData( &gSelectedFloristCheckBoxRegion[i], 0, i );
i++;
MSYS_DefineRegion( &gSelectedFloristCheckBoxRegion[i], FLOWER_ORDER_CHECK_BOX_1_X, FLOWER_ORDER_CHECK_BOX_1_Y, (UINT16)(FLOWER_ORDER_CHECK_BOX_1_X + FLOWER_ORDER_CHECK_WIDTH), (UINT16)(FLOWER_ORDER_CHECK_BOX_1_Y + FLOWER_ORDER_CHECK_HEIGHT), MSYS_PRIORITY_HIGH,
CURSOR_WWW, MSYS_NO_CALLBACK, SelectFlorsitCheckBoxRegionCallBack );
MSYS_AddRegion(&gSelectedFloristCheckBoxRegion[i]);
MSYS_SetRegionUserData( &gSelectedFloristCheckBoxRegion[i], 0, i );
i++;
MSYS_DefineRegion( &gSelectedFloristCheckBoxRegion[i], FLOWER_ORDER_CHECK_BOX_2_X, FLOWER_ORDER_CHECK_BOX_2_Y, (UINT16)(FLOWER_ORDER_CHECK_BOX_2_X + FLOWER_ORDER_CHECK_WIDTH), (UINT16)(FLOWER_ORDER_CHECK_BOX_2_Y + FLOWER_ORDER_CHECK_HEIGHT), MSYS_PRIORITY_HIGH,
CURSOR_WWW, MSYS_NO_CALLBACK, SelectFlorsitCheckBoxRegionCallBack );
MSYS_AddRegion(&gSelectedFloristCheckBoxRegion[i]);
MSYS_SetRegionUserData( &gSelectedFloristCheckBoxRegion[i], 0, i );
i++;
MSYS_DefineRegion( &gSelectedFloristCheckBoxRegion[i], FLOWER_ORDER_CHECK_BOX_3_X, FLOWER_ORDER_CHECK_BOX_3_Y, (UINT16)(FLOWER_ORDER_CHECK_BOX_3_X + FLOWER_ORDER_CHECK_WIDTH), (UINT16)(FLOWER_ORDER_CHECK_BOX_3_Y + FLOWER_ORDER_CHECK_HEIGHT), MSYS_PRIORITY_HIGH,
CURSOR_WWW, MSYS_NO_CALLBACK, SelectFlorsitCheckBoxRegionCallBack );
MSYS_AddRegion(&gSelectedFloristCheckBoxRegion[i]);
MSYS_SetRegionUserData( &gSelectedFloristCheckBoxRegion[i], 0, i );
i++;
MSYS_DefineRegion( &gSelectedFloristCheckBoxRegion[i], FLOWER_ORDER_CHECK_BOX_4_X, FLOWER_ORDER_CHECK_BOX_4_Y, (UINT16)(FLOWER_ORDER_CHECK_BOX_4_X + FLOWER_ORDER_CHECK_WIDTH), (UINT16)(FLOWER_ORDER_CHECK_BOX_4_Y + FLOWER_ORDER_CHECK_HEIGHT), MSYS_PRIORITY_HIGH,
CURSOR_WWW, MSYS_NO_CALLBACK, SelectFlorsitCheckBoxRegionCallBack );
MSYS_AddRegion(&gSelectedFloristCheckBoxRegion[i]);
MSYS_SetRegionUserData( &gSelectedFloristCheckBoxRegion[i], 0, i );
i++;
MSYS_DefineRegion( &gSelectedFloristCheckBoxRegion[i], FLOWER_ORDER_CHECK_BOX_5_X, FLOWER_ORDER_CHECK_BOX_5_Y, (UINT16)(FLOWER_ORDER_CHECK_BOX_5_X + FLOWER_ORDER_CHECK_WIDTH), (UINT16)(FLOWER_ORDER_CHECK_BOX_5_Y + FLOWER_ORDER_CHECK_HEIGHT), MSYS_PRIORITY_HIGH,
CURSOR_WWW, MSYS_NO_CALLBACK, SelectFlorsitCheckBoxRegionCallBack );
MSYS_AddRegion(&gSelectedFloristCheckBoxRegion[i]);
MSYS_SetRegionUserData( &gSelectedFloristCheckBoxRegion[i], 0, i );
i++;
usPosX = StringPixLength( sOrderFormText[FLORIST_ORDER_SELECT_FROM_OURS], FLOWER_ORDEER_SMALL_FONT) + 2 + FLOWER_ORDER_LINK_TO_CARD_GALLERY_X;
usWidth = StringPixLength( sOrderFormText[FLORIST_ORDER_STANDARDIZED_CARDS], FLOWER_ORDEER_SMALL_FONT);
usHeight = GetFontHeight(FLOWER_ORDEER_SMALL_FONT);
MSYS_DefineRegion( &gSelectedFloristCardGalleryLinkRegion, usPosX, FLOWER_ORDER_LINK_TO_CARD_GALLERY_Y, (UINT16)(usPosX + usWidth), (UINT16)(FLOWER_ORDER_LINK_TO_CARD_GALLERY_Y + usHeight), MSYS_PRIORITY_HIGH,
CURSOR_WWW, MSYS_NO_CALLBACK, SelectFloristCardGalleryLinkRegionCallBack );
MSYS_AddRegion(&gSelectedFloristCardGalleryLinkRegion);
//flower link
MSYS_DefineRegion( &gSelectedFloristGalleryLinkRegion, FLOWER_ORDER_FLOWER_BOX_X, FLOWER_ORDER_FLOWER_BOX_Y, (UINT16)(FLOWER_ORDER_FLOWER_BOX_X + FLOWER_ORDER_FLOWER_BOX_WIDTH), (UINT16)(FLOWER_ORDER_FLOWER_BOX_Y + FLOWER_ORDER_FLOWER_BOX_HEIGHT), MSYS_PRIORITY_HIGH,
CURSOR_WWW, MSYS_NO_CALLBACK, SelectFloristGalleryLinkRegionCallBack );
MSYS_AddRegion(&gSelectedFloristGalleryLinkRegion);
//drop down city location
MSYS_DefineRegion( &gSelectedFloristDropDownRegion, FLOWER_ORDER_DELIVERY_LOCATION_X, FLOWER_ORDER_DELIVERY_LOCATION_Y, (UINT16)(FLOWER_ORDER_DELIVERY_LOCATION_X + FLOWER_ORDER_DELIVERY_LOCATION_WIDTH), (UINT16)(FLOWER_ORDER_DELIVERY_LOCATION_Y + FLOWER_ORDER_DELIVERY_LOCATION_HEIGHT), MSYS_PRIORITY_HIGH,
CURSOR_WWW, MSYS_NO_CALLBACK, SelectFloristDropDownRegionCallBack);
MSYS_AddRegion(&gSelectedFloristDropDownRegion);
//to disable the drop down city location
MSYS_DefineRegion( &gSelectedFloristDisableDropDownRegion, LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y, LAPTOP_SCREEN_LR_X, LAPTOP_SCREEN_WEB_LR_Y, MSYS_PRIORITY_HIGH+2,
CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, SelectFloristDisableDropDownRegionCallBack);
MSYS_AddRegion(&gSelectedFloristDisableDropDownRegion);
MSYS_DisableRegion(&gSelectedFloristDisableDropDownRegion);
//to select typing in the personal sentiment box
// MSYS_DefineRegion( &gSelectedFloristPersonalSentimentBoxRegion, FLOWER_ORDER_SENTIMENT_BOX_X, FLOWER_ORDER_SENTIMENT_BOX_Y, (UINT16)(FLOWER_ORDER_SENTIMENT_BOX_X + FLOWER_ORDER_SENTIMENT_BOX_WIDTH), (UINT16)(FLOWER_ORDER_SENTIMENT_BOX_Y + FLOWER_ORDER_SENTIMENT_BOX_HEIGHT), MSYS_PRIORITY_HIGH,
// CURSOR_WWW, MSYS_NO_CALLBACK, SelectFloristPersonalSentimentBoxRegionCallBack);
// MSYS_AddRegion( &gSelectedFloristPersonalSentimentBoxRegion );
InitFlowerOrderTextInputBoxes();
LaptopSaveInfo.uiFlowerOrderNumber += Random( 5 ) + 1;
RenderFloristOrderForm();
// guiFlowerPrice = 0;
// gubFlowerDestDropDownMode = FLOWER_ORDER_DROP_DOWN_NO_ACTION;
// gubCurrentlySelectedFlowerLocation = 0;
return(TRUE);
}
void InitFloristOrderFormVariables()
{
guiFlowerPrice = 0;
gubFlowerDestDropDownMode = FLOWER_ORDER_DROP_DOWN_NO_ACTION;
gubCurrentlySelectedFlowerLocation = 0;
}
void ExitFloristOrderForm()
{
UINT8 i;
RemoveFloristDefaults();
DeleteVideoObjectFromIndex( guiDeliveryLocation );
DeleteVideoObjectFromIndex( guiFlowerFrame );
DeleteVideoObjectFromIndex( guiNameBox );
DeleteVideoObjectFromIndex( guiPersonalSentiments );
DeleteVideoObjectFromIndex( guiFlowerOrderCheckBoxButtonImage );
DeleteVideoObjectFromIndex( guiCurrentlySelectedFlowerImage );
DeleteVideoObjectFromIndex(guiDropDownBorder);
for(i=0; i<6; i++)
MSYS_RemoveRegion( &gSelectedFloristCheckBoxRegion[i]);
//card gallery link
MSYS_RemoveRegion( &gSelectedFloristCardGalleryLinkRegion);
//flower link
MSYS_RemoveRegion( &gSelectedFloristGalleryLinkRegion);
//flower link
MSYS_RemoveRegion( &gSelectedFloristDropDownRegion);
//to select typing in the personal sentiment box
// MSYS_RemoveRegion( &gSelectedFloristPersonalSentimentBoxRegion);
//disable the drop down window
MSYS_RemoveRegion( &gSelectedFloristDisableDropDownRegion);
UnloadButtonImage( guiFlowerOrderButtonImage );
RemoveButton( guiFlowerOrderBackButton );
RemoveButton( guiFlowerOrderSendButton );
RemoveButton( guiFlowerOrderClearButton );
RemoveButton( guiFlowerOrderGalleryButton );
//Store the text fields
Get16BitStringFromField( 1, gsSentimentTextField );
Get16BitStringFromField( 2, gsNameTextField );
gbCurrentlySelectedCard = -1;
DestroyFlowerOrderTextInputBoxes();
}
void HandleFloristOrderForm()
{
if( gubFlowerDestDropDownMode != FLOWER_ORDER_DROP_DOWN_NO_ACTION )
{
CreateDestroyFlowerOrderDestDropDown( gubFlowerDestDropDownMode );
}
HandleFloristOrderKeyBoardInput();
RenderAllTextFields();
}
void RenderFloristOrderForm()
{
HVOBJECT hPixHandle;
UINT16 usPosX;
CHAR16 sTemp[ 640 ];
UINT32 uiStartLoc=0;
DisplayFloristDefaults();
//The flowe Delivery location
GetVideoObject(&hPixHandle, guiDeliveryLocation);
BltVideoObject(FRAME_BUFFER, hPixHandle, 0,FLOWER_ORDER_DELIVERY_LOCATION_X, FLOWER_ORDER_DELIVERY_LOCATION_Y, VO_BLT_SRCTRANSPARENCY,NULL);
//The flowe Flower Frame
GetVideoObject(&hPixHandle, guiFlowerFrame);
BltVideoObject(FRAME_BUFFER, hPixHandle, 0,FLOWER_ORDER_FLOWER_BOX_X, FLOWER_ORDER_FLOWER_BOX_Y, VO_BLT_SRCTRANSPARENCY,NULL);
//The currenltly selected flwoer
GetVideoObject(&hPixHandle, guiCurrentlySelectedFlowerImage);
BltVideoObject(FRAME_BUFFER, hPixHandle, 0,FLOWER_ORDER_FLOWER_BOX_X+5, FLOWER_ORDER_FLOWER_BOX_Y+5, VO_BLT_SRCTRANSPARENCY,NULL);
//The flowe Name Box
GetVideoObject(&hPixHandle, guiNameBox);
BltVideoObject(FRAME_BUFFER, hPixHandle, 0,FLOWER_ORDER_NAME_BOX_X, FLOWER_ORDER_NAME_BOX_Y, VO_BLT_SRCTRANSPARENCY,NULL);
//The flowe Personel sentiments
GetVideoObject(&hPixHandle, guiPersonalSentiments);
BltVideoObject(FRAME_BUFFER, hPixHandle, 0,FLOWER_ORDER_SENTIMENT_BOX_X, FLOWER_ORDER_SENTIMENT_BOX_Y, VO_BLT_SRCTRANSPARENCY,NULL);
//Bouquet name, price and order number,text
DrawTextToScreen(sOrderFormText[FLORIST_ORDER_NAME_BOUQUET], FLOWER_ORDER_FLOWER_NAME_X, FLOWER_ORDER_FLOWER_NAME_Y, 0, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDER_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
DrawTextToScreen(sOrderFormText[FLORIST_ORDER_PRICE], FLOWER_ORDER_BOUQUET_NAME_X, FLOWER_ORDER_BOUQUET_NAME_Y, 0, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDER_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
DrawTextToScreen(sOrderFormText[FLORIST_ORDER_ORDER_NUMBER], FLOWER_ORDER_ORDER_NUM_NAME_X, FLOWER_ORDER_ORDER_NUM_NAME_Y, 0, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDER_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
//The flower name
usPosX = StringPixLength( sOrderFormText[FLORIST_ORDER_NAME_BOUQUET], FLOWER_ORDEER_SMALL_FONT) + 5 + FLOWER_ORDER_FLOWER_NAME_X;
uiStartLoc = FLOR_GALLERY_TEXT_TOTAL_SIZE * guiCurrentlySelectedFlower;
LoadEncryptedDataFromFile(FLOR_GALLERY_TEXT_FILE, sTemp, uiStartLoc, FLOR_GALLERY_TEXT_TITLE_SIZE);
DrawTextToScreen( sTemp, usPosX, FLOWER_ORDER_FLOWER_NAME_Y, 0, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDEER_SMALL_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
//Deliverry Date
DrawTextToScreen(sOrderFormText[FLORIST_ORDER_DELIVERY_DATE], FLOWER_ORDER_ORDER_NUM_NAME_X, FLOWER_ORDER_DATE_Y, 0, FLOWER_ORDEER_BIG_FONT, FLOWER_ORDER_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
//Next day
DrawTextToScreen(sOrderFormText[FLORIST_ORDER_NEXT_DAY], FLOWER_ORDER_CHECK_BOX_0_X+FLOWER_ORDER_CHECK_WIDTH+3, FLOWER_ORDER_CHECK_BOX_0_Y+2, 0, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDEER_SMALL_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
//When it get there
DrawTextToScreen(sOrderFormText[FLORIST_ORDER_GETS_THERE], FLOWER_ORDER_CHECK_BOX_1_X+FLOWER_ORDER_CHECK_WIDTH+3, FLOWER_ORDER_CHECK_BOX_1_Y+2, 0, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDEER_SMALL_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
//Deliverry locatiuon
DrawTextToScreen(sOrderFormText[FLORIST_ORDER_DELIVERY_LOCATION], FLOWER_ORDER_ORDER_NUM_NAME_X, FLOWER_ORDER_LOCATION_Y, 0, FLOWER_ORDEER_BIG_FONT, FLOWER_ORDER_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
//Additional services
DrawTextToScreen(sOrderFormText[FLORIST_ORDER_ADDITIONAL_CHARGES], FLOWER_ORDER_ADDITIONAL_SERVICES_X, FLOWER_ORDER_ADDITIONAL_SERVICES_Y, 0, FLOWER_ORDEER_BIG_FONT, FLOWER_ORDER_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
//crushed bouquet
DrawTextToScreen(sOrderFormText[FLORIST_ORDER_CRUSHED], FLOWER_ORDER_CHECK_BOX_2_X+FLOWER_ORDER_CHECK_WIDTH+3, FLOWER_ORDER_CHECK_BOX_2_Y+2, 0, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDEER_SMALL_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
//black roses
DrawTextToScreen(sOrderFormText[FLORIST_ORDER_BLACK_ROSES], FLOWER_ORDER_CHECK_BOX_3_X+FLOWER_ORDER_CHECK_WIDTH+3, FLOWER_ORDER_CHECK_BOX_3_Y+2, 0, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDEER_SMALL_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
//wilted bouquet
DrawTextToScreen(sOrderFormText[FLORIST_ORDER_WILTED], FLOWER_ORDER_CHECK_BOX_4_X+FLOWER_ORDER_CHECK_WIDTH+3, FLOWER_ORDER_CHECK_BOX_4_Y+2, 0, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDEER_SMALL_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
//fruit cake
DrawTextToScreen(sOrderFormText[FLORIST_ORDER_FRUIT_CAKE], FLOWER_ORDER_CHECK_BOX_5_X+FLOWER_ORDER_CHECK_WIDTH+3, FLOWER_ORDER_CHECK_BOX_5_Y+2, 0, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDEER_SMALL_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
//Personal sentiment
usPosX = FLOWER_ORDER_PERSONAL_SENT_TEXT_X + StringPixLength( sOrderFormText[FLORIST_ORDER_PERSONAL_SENTIMENTS], FLOWER_ORDEER_BIG_FONT) + 5;
DrawTextToScreen(sOrderFormText[FLORIST_ORDER_PERSONAL_SENTIMENTS], FLOWER_ORDER_PERSONAL_SENT_TEXT_X, FLOWER_ORDER_PERSONAL_SENT_TEXT_Y, 0, FLOWER_ORDEER_BIG_FONT, FLOWER_ORDER_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
DrawTextToScreen(sOrderFormText[FLORIST_ORDER_CARD_LENGTH], usPosX, FLOWER_ORDER_PERSONAL_SENT_TEXT_Y+2, 0, FLOWER_ORDEER_TINY_FONT, FLOWER_ORDEER_SMALL_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
//Billing information
DrawTextToScreen(sOrderFormText[FLORIST_ORDER_BILLING_INFO], FLOWER_ORDER_BILLING_INFO_X, FLOWER_ORDER_BILLING_INFO_Y, 0, FLOWER_ORDEER_BIG_FONT, FLOWER_ORDER_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
//Billing Name
DrawTextToScreen(sOrderFormText[FLORIST_ORDER_NAME], FLOWER_ORDER_NAME_TEXT_X, FLOWER_ORDER_NAME_TEXT_Y, FLOWER_ORDER_NAME_TEXT_WIDTH, FLOWER_ORDEER_BIG_FONT, FLOWER_ORDER_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
//the text to link to the card gallery
DrawTextToScreen(sOrderFormText[FLORIST_ORDER_SELECT_FROM_OURS], FLOWER_ORDER_LINK_TO_CARD_GALLERY_X, FLOWER_ORDER_LINK_TO_CARD_GALLERY_Y, 0, FLOWER_ORDEER_BIG_FONT, FLOWER_ORDER_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
usPosX = StringPixLength( sOrderFormText[FLORIST_ORDER_SELECT_FROM_OURS], FLOWER_ORDEER_SMALL_FONT) + 5 + FLOWER_ORDER_LINK_TO_CARD_GALLERY_X;
DrawTextToScreen(sOrderFormText[FLORIST_ORDER_STANDARDIZED_CARDS], usPosX, FLOWER_ORDER_LINK_TO_CARD_GALLERY_Y, 0, FLOWER_ORDEER_BIG_FONT, FLOWER_ORDEER_LINK_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
DisplayFloristCheckBox();
//display all the things that change for the different bouquet collections
DisplayFlowerDynamicItems();
//Display the currently selected city
FlowerOrderDisplayShippingLocationCity();
MarkButtonsDirty( );
RenderWWWProgramTitleBar( );
InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y);
}
void BtnFlowerOrderBackButtonCallback(GUI_BUTTON *btn,INT32 reason)
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
btn->uiFlags |= BUTTON_CLICKED_ON;
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
}
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags &= (~BUTTON_CLICKED_ON );
guiCurrentLaptopMode = LAPTOP_MODE_FLORIST_FLOWER_GALLERY;
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
}
}
if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE)
{
btn->uiFlags &= (~BUTTON_CLICKED_ON );
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
}
}
void BtnFlowerOrderSendButtonCallback(GUI_BUTTON *btn,INT32 reason)
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
btn->uiFlags |= BUTTON_CLICKED_ON;
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
}
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags &= (~BUTTON_CLICKED_ON );
//add an entry in the finacial page for the medical deposit
AddTransactionToPlayersBook( PURCHASED_FLOWERS, 0, GetWorldTotalMin(), -(INT32)(guiFlowerPrice) );
if ( gubCurrentlySelectedFlowerLocation == 7 )
{
// sent to meduna!
if ( gfFLoristCheckBox0Down )
{
HandleFlowersMeanwhileScene( 0 );
}
else
{
HandleFlowersMeanwhileScene( 1 );
}
}
//increment the order number
LaptopSaveInfo.uiFlowerOrderNumber += ( 1 + Random( 2 ) );
guiCurrentLaptopMode = LAPTOP_MODE_FLORIST;
InitFloristOrderForm();
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
}
}
if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE)
{
btn->uiFlags &= (~BUTTON_CLICKED_ON );
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
}
}
void BtnFlowerOrderClearButtonCallback(GUI_BUTTON *btn,INT32 reason)
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
btn->uiFlags |= BUTTON_CLICKED_ON;
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
}
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags &= (~BUTTON_CLICKED_ON );
guiCurrentLaptopMode = LAPTOP_MODE_FLORIST;
InitFloristOrderForm();
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
}
}
if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE)
{
btn->uiFlags &= (~BUTTON_CLICKED_ON );
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
}
}
void BtnFlowerOrderGalleryButtonCallback(GUI_BUTTON *btn,INT32 reason)
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
btn->uiFlags |= BUTTON_CLICKED_ON;
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
}
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
if (btn->uiFlags & BUTTON_CLICKED_ON)
{
btn->uiFlags &= (~BUTTON_CLICKED_ON );
guiCurrentLaptopMode = LAPTOP_MODE_FLORIST_FLOWER_GALLERY;
//reset the gallery back to page 0
gubCurFlowerIndex = 0;
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
}
}
if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE)
{
btn->uiFlags &= (~BUTTON_CLICKED_ON );
InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY);
}
}
void SelectFlorsitCheckBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason )
{
if (iReason & MSYS_CALLBACK_REASON_INIT)
{
}
else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
UINT32 uiUserData;
uiUserData = MSYS_GetRegionUserData( pRegion, 0 );
switch( uiUserData )
{
case 0:
if( gfFLoristCheckBox0Down )
{
gfFLoristCheckBox0Down = FALSE;
gfFLoristCheckBox1Down = TRUE;
}
else
{
gfFLoristCheckBox0Down = TRUE;
gfFLoristCheckBox1Down = FALSE;
}
break;
case 1:
if( gfFLoristCheckBox1Down )
{
gfFLoristCheckBox1Down = FALSE;
gfFLoristCheckBox0Down = TRUE;
}
else
{
gfFLoristCheckBox1Down = TRUE;
gfFLoristCheckBox0Down = FALSE;
}
break;
case 2:
if( gfFLoristCheckBox2Down )
gfFLoristCheckBox2Down = FALSE;
else
gfFLoristCheckBox2Down = TRUE;
break;
case 3:
if( gfFLoristCheckBox3Down )
gfFLoristCheckBox3Down = FALSE;
else
gfFLoristCheckBox3Down = TRUE;
break;
case 4:
if( gfFLoristCheckBox4Down )
gfFLoristCheckBox4Down = FALSE;
else
gfFLoristCheckBox4Down = TRUE;
break;
case 5:
if( gfFLoristCheckBox5Down )
gfFLoristCheckBox5Down = FALSE;
else
gfFLoristCheckBox5Down = TRUE;
break;
}
DisplayFloristCheckBox();
fPausedReDrawScreenFlag = TRUE;
}
else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP)
{
}
}
void DisplayFloristCheckBox()
{
HVOBJECT hPixHandle;
//check box
GetVideoObject(&hPixHandle, guiFlowerOrderCheckBoxButtonImage);
if( gfFLoristCheckBox0Down )
BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_0_X, FLOWER_ORDER_CHECK_BOX_0_Y, VO_BLT_SRCTRANSPARENCY,NULL);
else
BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_0_X, FLOWER_ORDER_CHECK_BOX_0_Y, VO_BLT_SRCTRANSPARENCY,NULL);
//first check box
GetVideoObject(&hPixHandle, guiFlowerOrderCheckBoxButtonImage);
if( gfFLoristCheckBox1Down )
BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_1_X, FLOWER_ORDER_CHECK_BOX_1_Y, VO_BLT_SRCTRANSPARENCY,NULL);
else
BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_1_X, FLOWER_ORDER_CHECK_BOX_1_Y, VO_BLT_SRCTRANSPARENCY,NULL);
//second check box
GetVideoObject(&hPixHandle, guiFlowerOrderCheckBoxButtonImage);
if( gfFLoristCheckBox2Down )
BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_2_X, FLOWER_ORDER_CHECK_BOX_2_Y, VO_BLT_SRCTRANSPARENCY,NULL);
else
BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_2_X, FLOWER_ORDER_CHECK_BOX_2_Y, VO_BLT_SRCTRANSPARENCY,NULL);
//third check box
GetVideoObject(&hPixHandle, guiFlowerOrderCheckBoxButtonImage);
if( gfFLoristCheckBox3Down )
BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_3_X, FLOWER_ORDER_CHECK_BOX_3_Y, VO_BLT_SRCTRANSPARENCY,NULL);
else
BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_3_X, FLOWER_ORDER_CHECK_BOX_3_Y, VO_BLT_SRCTRANSPARENCY,NULL);
//Foiurth check box
GetVideoObject(&hPixHandle, guiFlowerOrderCheckBoxButtonImage);
if( gfFLoristCheckBox4Down )
BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_4_X, FLOWER_ORDER_CHECK_BOX_4_Y, VO_BLT_SRCTRANSPARENCY,NULL);
else
BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_4_X, FLOWER_ORDER_CHECK_BOX_4_Y, VO_BLT_SRCTRANSPARENCY,NULL);
//fifth check box
GetVideoObject(&hPixHandle, guiFlowerOrderCheckBoxButtonImage);
if( gfFLoristCheckBox5Down )
BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_5_X, FLOWER_ORDER_CHECK_BOX_5_Y, VO_BLT_SRCTRANSPARENCY,NULL);
else
BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_5_X, FLOWER_ORDER_CHECK_BOX_5_Y, VO_BLT_SRCTRANSPARENCY,NULL);
InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y);
}
void SelectFloristCardGalleryLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason )
{
if (iReason & MSYS_CALLBACK_REASON_INIT)
{
}
else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
guiCurrentLaptopMode = LAPTOP_MODE_FLORIST_CARD_GALLERY;
}
else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP)
{
}
}
//display the things that change on the screen
void DisplayFlowerDynamicItems()
{
UINT32 uiStartLoc=0;
UINT16 usPosX;
CHAR16 sTemp[ 640 ];
// CHAR16 sText[ 640 ];
UINT16 usPrice;
/*
//display the card saying
if( gbCurrentlySelectedCard != -1 )
{
//Get and display the card saying
//Display Flower Desc
uiStartLoc = FLOR_CARD_TEXT_TITLE_SIZE * + gbCurrentlySelectedCard;
LoadEncryptedDataFromFile( FLOR_CARD_TEXT_FILE, sTemp, uiStartLoc, FLOR_CARD_TEXT_TITLE_SIZE);
CleanOutControlCodesFromString(sTemp, sText);
DisplayWrappedString( (UINT16)(FLOWER_ORDER_SENTIMENT_BOX_X+10), (UINT16)(FLOWER_ORDER_SENTIMENT_BOX_Y+7), FLOWER_ORDER_PERSONAL_SENT_TEXT_WIDTH, 2, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDEER_SMALL_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
}
*/
//order number
usPosX = StringPixLength( sOrderFormText[FLORIST_ORDER_ORDER_NUMBER], FLOWER_ORDEER_SMALL_FONT) + 5 + FLOWER_ORDER_ORDER_NUM_NAME_X;
swprintf(sTemp, L"%d", LaptopSaveInfo.uiFlowerOrderNumber );
DrawTextToScreen( sTemp, usPosX, FLOWER_ORDER_ORDER_NUM_NAME_Y, 0, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDEER_SMALL_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
guiFlowerPrice = 0;
// the user selected crushed bouquet
if( gfFLoristCheckBox2Down )
guiFlowerPrice += gubFlowerOrder_AdditioanalServicePrices[0];
// the user selected blak roses
if( gfFLoristCheckBox3Down )
guiFlowerPrice += gubFlowerOrder_AdditioanalServicePrices[1];
// the user selected wilted bouquet
if( gfFLoristCheckBox4Down )
guiFlowerPrice += gubFlowerOrder_AdditioanalServicePrices[2];
// the user selected fruit cake
if( gfFLoristCheckBox5Down )
guiFlowerPrice += gubFlowerOrder_AdditioanalServicePrices[3];
//price
usPosX = StringPixLength( sOrderFormText[FLORIST_ORDER_PRICE], FLOWER_ORDEER_SMALL_FONT) + 5 + FLOWER_ORDER_BOUQUET_NAME_X;
uiStartLoc = FLOR_GALLERY_TEXT_TOTAL_SIZE * guiCurrentlySelectedFlower + FLOR_GALLERY_TEXT_TITLE_SIZE;
LoadEncryptedDataFromFile(FLOR_GALLERY_TEXT_FILE, sTemp, uiStartLoc, FLOR_GALLERY_TEXT_PRICE_SIZE);
swscanf( sTemp, L"%hu", &usPrice);
//if its the next day delivery
if( gfFLoristCheckBox0Down )
guiFlowerPrice += usPrice + FlowerOrderLocations[ gubCurrentlySelectedFlowerLocation ].ubNextDayDeliveryCost;
//else its the 'when it gets there' delivery
else
guiFlowerPrice += usPrice + FlowerOrderLocations[ gubCurrentlySelectedFlowerLocation ].ubWhenItGetsThereCost;
swprintf( sTemp, L"$%d.00 %s", guiFlowerPrice, pMessageStrings[ MSG_USDOLLAR_ABBREVIATION ] );
DrawTextToScreen( sTemp, usPosX, FLOWER_ORDER_BOUQUET_NAME_Y, 0, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDEER_SMALL_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
}
void SelectFloristGalleryLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason )
{
if (iReason & MSYS_CALLBACK_REASON_INIT)
{
}
else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
guiCurrentLaptopMode = LAPTOP_MODE_FLORIST_FLOWER_GALLERY;
}
else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP)
{
}
}
void SelectFloristDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason )
{
if (iReason & MSYS_CALLBACK_REASON_INIT)
{
}
else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
gubFlowerDestDropDownMode = FLOWER_ORDER_DROP_DOWN_CREATE;
}
}
void SelectFloristDisableDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason )
{
if (iReason & MSYS_CALLBACK_REASON_INIT)
{
}
else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
gubFlowerDestDropDownMode = FLOWER_ORDER_DROP_DOWN_DESTROY;
}
}
void SelectFlowerDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason )
{
if (iReason & MSYS_CALLBACK_REASON_INIT)
{
}
else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
gubCurrentlySelectedFlowerLocation = (UINT8)MSYS_GetRegionUserData( pRegion, 0 );
FlowerOrderDrawSelectedCity( gubCurrentlySelectedFlowerLocation );
gubFlowerDestDropDownMode = FLOWER_ORDER_DROP_DOWN_DESTROY;
}
}
void SelectFlowerDropDownMovementCallBack(MOUSE_REGION * pRegion, INT32 reason )
{
if( reason & MSYS_CALLBACK_REASON_LOST_MOUSE )
{
pRegion->uiFlags &= (~BUTTON_CLICKED_ON );
InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY);
}
else if( reason & MSYS_CALLBACK_REASON_GAIN_MOUSE )
{
pRegion->uiFlags |= BUTTON_CLICKED_ON ;
gubCurrentlySelectedFlowerLocation = (UINT8)MSYS_GetRegionUserData( pRegion, 0 );
FlowerOrderDrawSelectedCity( gubCurrentlySelectedFlowerLocation );
InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY);
}
}
BOOLEAN CreateDestroyFlowerOrderDestDropDown( UINT8 ubDropDownMode )
{
static UINT16 usHeight;
static BOOLEAN fMouseRegionsCreated=FALSE;
switch( ubDropDownMode )
{
case FLOWER_ORDER_DROP_DOWN_NO_ACTION:
{
}
break;
case FLOWER_ORDER_DROP_DOWN_CREATE:
{
UINT8 i;
UINT16 usPosX, usPosY;
UINT16 usTemp;
UINT16 usFontHeight = GetFontHeight( FLOWER_ORDEER_DROP_DOWN_FONT );
UINT8 ubTextFieldID;
if( fMouseRegionsCreated )
{
return(FALSE);
break;
}
//Get the current text from the text box
ubTextFieldID = (UINT8) GetActiveFieldID();
//if its the personel sentiment field
if( ubTextFieldID == 1 )
{
Get16BitStringFromField( ubTextFieldID, gsSentimentTextField );
}
else if( ubTextFieldID == 2 )
{
//else its the name field
Get16BitStringFromField( ubTextFieldID, gsNameTextField );
}
SetActiveField(0);
fMouseRegionsCreated = TRUE;
usPosX = FLOWER_ORDER_DROP_DOWN_CITY_START_X;
usPosY = FLOWER_ORDER_DROP_DOWN_CITY_START_Y;
for( i=0; i< FLOWER_ORDER_NUMBER_OF_DROP_DOWN_LOCATIONS; i++)
{
MSYS_DefineRegion( &gSelectedFlowerDropDownRegion[i], usPosX, (UINT16)(usPosY+4), (UINT16)(usPosX+FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH), (UINT16)(usPosY+usFontHeight), MSYS_PRIORITY_HIGH+3,
CURSOR_WWW, SelectFlowerDropDownMovementCallBack, SelectFlowerDropDownRegionCallBack);
MSYS_AddRegion(&gSelectedFlowerDropDownRegion[i]);
MSYS_SetRegionUserData( &gSelectedFlowerDropDownRegion[ i ], 0, i);
usPosY += usFontHeight + 2;
}
usTemp = FLOWER_ORDER_DROP_DOWN_CITY_START_Y;
usHeight = usPosY - usTemp + 10;
gubFlowerDestDropDownMode = FLOWER_ORDER_DROP_DOWN_DISPLAY;
MSYS_EnableRegion(&gSelectedFloristDisableDropDownRegion);
//disable the text entry fields
// DisableAllTextFields();
Get16BitStringFromField( 1, gsSentimentTextField );
KillTextInputMode();
//disable the clear order and accept order buttons, (their rendering interferes with the drop down graphics)
}
break;
case FLOWER_ORDER_DROP_DOWN_DESTROY:
{
UINT8 i;
if( !fMouseRegionsCreated )
break;
for( i=0; i< FLOWER_ORDER_NUMBER_OF_DROP_DOWN_LOCATIONS; i++)
MSYS_RemoveRegion( &gSelectedFlowerDropDownRegion[i]);
//display the name on the title bar
ColorFillVideoSurfaceArea( FRAME_BUFFER, FLOWER_ORDER_DROP_DOWN_LOCATION_X+3, FLOWER_ORDER_DELIVERY_LOCATION_Y+3, FLOWER_ORDER_DROP_DOWN_LOCATION_X+FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH, FLOWER_ORDER_DELIVERY_LOCATION_Y+FLOWER_ORDER_DELIVERY_LOCATION_HEIGHT-2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
DrawTextToScreen( *(FlowerOrderLocations[ gubCurrentlySelectedFlowerLocation ].psCityLoc), FLOWER_ORDER_DROP_DOWN_CITY_START_X+6, FLOWER_ORDER_DROP_DOWN_CITY_START_Y+3, 0, FLOWER_ORDEER_DROP_DOWN_FONT, FLOWER_ORDEER_DROP_DOWN_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
//enable the drop down region
MSYS_DisableRegion(&gSelectedFloristDisableDropDownRegion);
fPausedReDrawScreenFlag = TRUE;
fMouseRegionsCreated = FALSE;
gubFlowerDestDropDownMode = FLOWER_ORDER_DROP_DOWN_NO_ACTION;
//enable the text entry fields
InitFlowerOrderTextInputBoxes();
}
break;
case FLOWER_ORDER_DROP_DOWN_DISPLAY:
{
UINT8 i;
UINT16 usPosY, usPosX;
UINT16 usFontHeight = GetFontHeight( FLOWER_ORDEER_DROP_DOWN_FONT );
HVOBJECT hImageHandle;
//Display the background for the drop down window
ColorFillVideoSurfaceArea( FRAME_BUFFER, FLOWER_ORDER_DROP_DOWN_LOCATION_X, FLOWER_ORDER_DROP_DOWN_LOCATION_Y, FLOWER_ORDER_DROP_DOWN_LOCATION_X+FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH, FLOWER_ORDER_DROP_DOWN_LOCATION_Y+usHeight, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
//
// Place the border around the background
//
GetVideoObject(&hImageHandle, guiDropDownBorder);
usPosX = usPosY = 0;
//blit top row of images
for(i=10; i< FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH-10; i+=10)
{
//TOP ROW
BltVideoObject(FRAME_BUFFER, hImageHandle, 1,i+FLOWER_ORDER_DROP_DOWN_LOCATION_X, usPosY+FLOWER_ORDER_DROP_DOWN_LOCATION_Y, VO_BLT_SRCTRANSPARENCY,NULL);
//BOTTOM ROW
BltVideoObject(FRAME_BUFFER, hImageHandle, 6,i+FLOWER_ORDER_DROP_DOWN_LOCATION_X, usHeight-10+6+FLOWER_ORDER_DROP_DOWN_LOCATION_Y, VO_BLT_SRCTRANSPARENCY,NULL);
}
//blit the left and right row of images
usPosX = 0;
for(i=10; i< usHeight-10; i+=10)
{
BltVideoObject(FRAME_BUFFER, hImageHandle, 3,usPosX+FLOWER_ORDER_DROP_DOWN_LOCATION_X, i+FLOWER_ORDER_DROP_DOWN_LOCATION_Y, VO_BLT_SRCTRANSPARENCY,NULL);
BltVideoObject(FRAME_BUFFER, hImageHandle, 4,usPosX+FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH-4+FLOWER_ORDER_DROP_DOWN_LOCATION_X, i+FLOWER_ORDER_DROP_DOWN_LOCATION_Y, VO_BLT_SRCTRANSPARENCY,NULL);
}
//blt the corner images for the row
//top left
BltVideoObject(FRAME_BUFFER, hImageHandle, 0, 0+FLOWER_ORDER_DROP_DOWN_LOCATION_X, usPosY+FLOWER_ORDER_DROP_DOWN_LOCATION_Y, VO_BLT_SRCTRANSPARENCY,NULL);
//top right
BltVideoObject(FRAME_BUFFER, hImageHandle, 2, FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH-10+FLOWER_ORDER_DROP_DOWN_LOCATION_X, usPosY+FLOWER_ORDER_DROP_DOWN_LOCATION_Y, VO_BLT_SRCTRANSPARENCY,NULL);
//bottom left
BltVideoObject(FRAME_BUFFER, hImageHandle, 5, 0+FLOWER_ORDER_DROP_DOWN_LOCATION_X, usHeight-10+FLOWER_ORDER_DROP_DOWN_LOCATION_Y, VO_BLT_SRCTRANSPARENCY,NULL);
//bottom right
BltVideoObject(FRAME_BUFFER, hImageHandle, 7, FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH-10+FLOWER_ORDER_DROP_DOWN_LOCATION_X, usHeight-10+FLOWER_ORDER_DROP_DOWN_LOCATION_Y, VO_BLT_SRCTRANSPARENCY,NULL);
//Display the list of cities
usPosY = FLOWER_ORDER_DROP_DOWN_CITY_START_Y + 3;
for( i=0; i< FLOWER_ORDER_NUMBER_OF_DROP_DOWN_LOCATIONS; i++)
{
DrawTextToScreen( *(FlowerOrderLocations[i].psCityLoc), FLOWER_ORDER_DROP_DOWN_CITY_START_X+6, usPosY, 0, FLOWER_ORDEER_DROP_DOWN_FONT, FLOWER_ORDEER_DROP_DOWN_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
usPosY += usFontHeight + 2;
}
FlowerOrderDrawSelectedCity( gubCurrentlySelectedFlowerLocation );
InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y);
}
break;
}
return(TRUE);
}
void FlowerOrderDrawSelectedCity( UINT8 ubNumber )
{
UINT16 usPosY;
UINT16 usFontHeight = GetFontHeight( FLOWER_ORDEER_DROP_DOWN_FONT );
usPosY = (usFontHeight + 2) * ubNumber + FLOWER_ORDER_DROP_DOWN_CITY_START_Y;
//display the name in the list
ColorFillVideoSurfaceArea( FRAME_BUFFER, FLOWER_ORDER_DROP_DOWN_CITY_START_X, usPosY+2, FLOWER_ORDER_DROP_DOWN_CITY_START_X+FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH-9, usPosY+usFontHeight+4, Get16BPPColor( FROMRGB( 255, 255, 255 ) ) );
SetFontShadow(NO_SHADOW);
DrawTextToScreen( *(FlowerOrderLocations[ubNumber].psCityLoc), FLOWER_ORDER_DROP_DOWN_CITY_START_X+6, (UINT16)(usPosY+3), 0, FLOWER_ORDEER_DROP_DOWN_FONT, 2, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
SetFontShadow(DEFAULT_SHADOW);
FlowerOrderDisplayShippingLocationCity();
SetFontShadow(DEFAULT_SHADOW);
}
void FlowerOrderDisplayShippingLocationCity()
{
//display the name on the title bar
ColorFillVideoSurfaceArea( FRAME_BUFFER, FLOWER_ORDER_DROP_DOWN_LOCATION_X+3, FLOWER_ORDER_DELIVERY_LOCATION_Y+3, FLOWER_ORDER_DROP_DOWN_LOCATION_X+FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH, FLOWER_ORDER_DELIVERY_LOCATION_Y+FLOWER_ORDER_DELIVERY_LOCATION_HEIGHT-2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
DrawTextToScreen( *(FlowerOrderLocations[ gubCurrentlySelectedFlowerLocation ].psCityLoc), FLOWER_ORDER_DELIVERY_LOCATION_X+5, FLOWER_ORDER_DELIVERY_LOCATION_Y+5, 0, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDEER_SMALL_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
}
void InitFlowerOrderTextInputBoxes()
{
UINT32 uiStartLoc=0;
CHAR16 sTemp[ 640 ];
CHAR16 sText[ 640 ];
InitTextInputMode();
SetTextInputFont( (UINT16)FONT12ARIAL );
Set16BPPTextFieldColor( Get16BPPColor(FROMRGB( 255, 255, 255) ) );
SetBevelColors( Get16BPPColor(FROMRGB(136, 138, 135)), Get16BPPColor(FROMRGB(24, 61, 81)) );
SetTextInputRegularColors( 2, FONT_WHITE );
SetTextInputHilitedColors( FONT_WHITE, 2, 141 );
SetCursorColor( Get16BPPColor(FROMRGB(0, 0, 0) ) );
AddUserInputField( FlowerOrderUserTextFieldCallBack );
if( gbCurrentlySelectedCard != -1 )
{
//Get and display the card saying
//Display Flower Desc
uiStartLoc = FLOR_CARD_TEXT_TITLE_SIZE * + gbCurrentlySelectedCard;
LoadEncryptedDataFromFile( FLOR_CARD_TEXT_FILE, sTemp, uiStartLoc, FLOR_CARD_TEXT_TITLE_SIZE);
CleanOutControlCodesFromString(sTemp, sText);
wcsncpy( gsSentimentTextField, sText, FLOWER_ORDER_PERSONEL_SENTIMENT_NUM_CHARS - 1 );
gbCurrentlySelectedCard = -1;
}
if( wcslen( gsSentimentTextField ) >= FLOWER_ORDER_PERSONEL_SENTIMENT_NUM_CHARS - 2 )
{
gsSentimentTextField[ FLOWER_ORDER_PERSONEL_SENTIMENT_NUM_CHARS - 1] = L'\0';
}
//personal sentiment box
AddTextInputField( FLOWER_ORDER_PERSONAL_SENT_BOX_X, FLOWER_ORDER_PERSONAL_SENT_BOX_Y, FLOWER_ORDER_PERSONAL_SENT_TEXT_WIDTH, FLOWER_ORDER_PERSONAL_SENT_TEXT_HEIGHT, MSYS_PRIORITY_HIGH+2, gsSentimentTextField, FLOWER_ORDER_PERSONEL_SENTIMENT_NUM_CHARS, INPUTTYPE_ASCII );
//Name box
AddTextInputField( FLOWER_ORDER_NAME_TEXT_BOX_X, FLOWER_ORDER_NAME_TEXT_BOX_Y, FLOWER_ORDER_NAME_TEXT_BOX_WIDTH, FLOWER_ORDER_NAME_TEXT_BOX_HEIGHT, MSYS_PRIORITY_HIGH+2, gsNameTextField, FLOWER_ORDER_NAME_FIELD_NUM_CHARS, INPUTTYPE_ASCII );
}
void DestroyFlowerOrderTextInputBoxes()
{
KillTextInputMode();
}
void HandleFloristOrderKeyBoardInput()
{
InputAtom InputEvent;
while (DequeueEvent(&InputEvent) == TRUE)
{
if( !HandleTextInput( &InputEvent ) && InputEvent.usEvent == KEY_DOWN )
{
UINT8 ubTextFieldID;
switch (InputEvent.usParam)
{
case ENTER:
ubTextFieldID = (UINT8) GetActiveFieldID();
//if its the personel sentiment field
if( ubTextFieldID == 1 )
{
Get16BitStringFromField( ubTextFieldID, gsSentimentTextField );
}
else if( ubTextFieldID == 2 )
{
//else its the name field
Get16BitStringFromField( ubTextFieldID, gsNameTextField );
}
SetActiveField(0);
break;
case ESC:
SetActiveField(0);
break;
default:
HandleKeyBoardShortCutsForLapTop( InputEvent.usEvent, InputEvent.usParam, InputEvent.usKeyState );
break;
}
}
}
}
void FlowerOrderUserTextFieldCallBack( UINT8 ubID, BOOLEAN fEntering )
{
if( fEntering )
{
// SetActiveField(1);
}
}
//Initialize the Florsit Order Page (reset some variables)
void InitFloristOrderForm()
{
gsSentimentTextField[0] = 0;
gfFLoristCheckBox0Down = FALSE; // next day delviery
gfFLoristCheckBox1Down = TRUE; // when it gets there delivery
gfFLoristCheckBox2Down = FALSE;
gfFLoristCheckBox3Down = FALSE;
gfFLoristCheckBox4Down = FALSE;
gfFLoristCheckBox5Down = FALSE;
guiFlowerPrice = 0;
gubCurrentlySelectedFlowerLocation = 0;
gbCurrentlySelectedCard = -1;
gsSentimentTextField[0] = 0;
gsNameTextField[0] = 0;
}