home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Revista CD Expert 51
/
PCGamer51_17Demos.iso
/
games
/
CM
/
CyclingManagerDemoCangas.exe
/
CyclingManagerDemo
/
scripts
/
season
/
calendar
/
page_season_calendar.cnc
< prev
next >
Wrap
Text File
|
2001-06-05
|
29KB
|
867 lines
//
//----------------------------------------------------------------------------------------------------------------//
func void ShowRaceInfo(i32x _iRaceID,i32x _iStageID)
{
var component pOldComponent;
if(oPage_Season_Calendar.pThis)
{
pOldComponent = GetParserComponent();
var i32x iSubsetID,iPosX,iPosY,iW,iH;
var i32x iNameID;
var szx szName;
var i32x stagetime;
SetParserComponent(oCalendar_RaceInfo.pThis);
iNameID = Join_GetIntFromKey(oPage_Season_Calendar.m_jRaceFullNameId,_iRaceID);
szName = GetLocalizedFromKey(iNameID);
oPage_Season_Calendar.iInfoCount = oPage_Season_Calendar.iInfoCount + 1;
SetContainerText(oCalendar_RaceInfo.m_cRaceName,szName);
if(_iStageID>=0)
{
iNameID = Join_GetIntFromKey(oPage_Season_Calendar.m_jStageName,_iStageID);
szName = GetLocalizedFromKey(iNameID);
SetContainerText(oCalendar_RaceInfo.m_cStageName,szName);
}
ResizeComponent(oCalendar_RaceInfo.m_cRaceName);
ResizeComponent(oCalendar_RaceInfo.m_cStageName);
iW = GetComponentWidth(oCalendar_RaceInfo.m_cRaceName);
if(GetComponentWidth(oCalendar_RaceInfo.m_cStageName)>iW)
iW = GetComponentWidth(oCalendar_RaceInfo.m_cStageName);
SetCadreSize(oCalendar_RaceInfo.m_cBackground, iW + 16 ,40);
// Set page calendar context
SetParserComponent(oPage_Season_Calendar.pThis);
// Move Race info
iPosX = GetMousePosX()-(iW/2)-GetObjectPositionX();
iPosY = GetMousePosY() - 50 - GetObjectPositionY();
if(iPosX<0)
iPosX = 0;
if((iPosX+iW)>630)
iPosX=630-iW;
SetComponentPosition(oPage_Season_Calendar.iRaceInfoID,iPosX,iPosY);
// Show race info
SetComponentVisibleStatus(oPage_Season_Calendar.iRaceInfoID,1);
SetParserComponent(pOldComponent);
}
}
//
//----------------------------------------------------------------------------------------------------------------//
func void HideRaceInfo()
{
var component pOldComponent;
if(oPage_Season_Calendar.pThis)
{
if(oPage_Season_Calendar.iInfoCount>0)
{
oPage_Season_Calendar.iInfoCount =oPage_Season_Calendar.iInfoCount - 1;
if(oPage_Season_Calendar.iInfoCount == 0)
{
pOldComponent = GetParserComponent();
SetParserComponent(oPage_Season_Calendar.pThis);
SetComponentVisibleStatus(oPage_Season_Calendar.iRaceInfoID,0);
SetParserComponent(pOldComponent);
}
}
}
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Object_Season_Calendar Create func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Object_RaceInfo_Create ()
{
// Save context
oCalendar_RaceInfo.pThis = GetParserComponent();
//Components Init
SetComponentNumber(3);
// Background
oCalendar_RaceInfo.m_cBackground=Init_LibObject_FilledCadre(tFCadre7,128,40);
oCalendar_RaceInfo.m_cRaceName = InitContainer(tFontArialItalique);
SetComponentPosition(oCalendar_RaceInfo.m_cRaceName,5,5);
oCalendar_RaceInfo.m_cStageName = InitContainer(tFontArialItalique);
SetComponentPosition(oCalendar_RaceInfo.m_cStageName,5,18);
AutoResize();
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Object_Season_Calendar Event func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func i32x Object_RaceInfo_Event (i32x _iComponentID, i32x _iEvent)
{
if(_iComponentID == -1)
{
if(_iEvent == GUI_COMPONENT_DESTRUCTOR)
{
oPage_Season_Calendar.pThis = g_poNullComponent;
}
}
return 1;
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Object_Season_Calendar Init member
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Object_RaceInfo_InitMembers ()
{
oCalendar_RaceInfo.oFunc.pcreate = Object_RaceInfo_Create;
oCalendar_RaceInfo.oFunc.pevent = Object_RaceInfo_Event;
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func i32x LeapYear (i32x _iYear)
{
if ((_iYear % 400) == 0)
return true;
if ((_iYear > 1582) && ((_iYear % 100) == 0))
return false;
if ((_iYear % 4) == 0)
return true;
return false;
}
func void SelectMonth(i32x _month)
{
var i32x i;
// Must be in PageCalendar context
i=0;
while(i<12)
{
if(i!=_month)
SetTextRadioButtonCheckBox(oPage_Season_Calendar.cMonthsName[i],0);
else
SetTextRadioButtonCheckBox(oPage_Season_Calendar.cMonthsName[i],1);
i=i+1;
}
}
func void DrawMonth (i32x _iYDay,i32x _iStartDay, i32x _iNbDays, boolx _bSpecial)
{
var i32x subsetid;
var i32x iRaceRow,iRaceID,iFinish,iStart,iUCIclass,iStringID;
var i32x iStageNum,iRaceNumberOfStages,iStageID;
var i32x bRestDay;
var i32x iCol;
var szx szRaceName;
// Subset for stage and race link
subsetid = TEMP_DATABASE;
iCol = _iStartDay + 1;
var i32x iRow;
iRow = 2;
var i32x iX;
var i32x iY;
var i32x iLoop;
iLoop = 1;
while (iLoop <= _iNbDays)
{
if ((_bSpecial) && (iLoop == 5))
iLoop = iLoop + 10; // skip 10 days (Oct 5-14) in October, 1582
iX = (iCol - 1) * 90 + 20; // ColWidth = 90
iY = (iRow - 1) * 58 + 40; // RowHeight = 57
bRestDay = false;
iRaceID = -1;
iStart = 0;
iFinish = 0;
// Stage this day .
iStageID = Join_FindKeyFromIntData(oPage_Season_Calendar.m_jStageDate,_iYDay+iLoop);
if(iStageID<0)
{
// No stage : maybe a rest day ?
iStageID = Join_FindKeyFromIntData(oPage_Season_Calendar.m_jStageDate,_iYDay+iLoop-1);
if(iStageID>0)
{
bRestDay = Join_GetIntFromKey(oPage_Season_Calendar.m_jStageFollowedRestDay,iStageID);
if(!bRestDay)
iStageID = -1;
}
}
if(iStageID>0)
{
// Race of stage
iRaceID = Join_GetIntFromKey(oPage_Season_Calendar.m_jStageRaceID,iStageID);
// Stage number
iStageNum = Join_GetIntFromKey(oPage_Season_Calendar.m_jStageNum,iStageID);
// Total stage number
iRaceNumberOfStages = Join_GetIntFromKey(oPage_Season_Calendar.m_jRaceNumberOfStages,iRaceID);
// Race UCI class
iUCIclass = Join_GetIntFromKey(oPage_Season_Calendar.m_jRaceUCIClass,iRaceID);
}
if(iRaceNumberOfStages>1)
{
if(iStageNum == 1)
{
iStart = 1;
iFinish = 0;
}
else if(iStageNum == iRaceNumberOfStages)
{
iStart = 0;
iFinish = 1;
}
}
else
{
iStart = 1;
iFinish = 1;
}
// Create day object
oPage_Season_Calendar.iDayObject[iLoop - 1] = InitCalendarDay(iLoop,iRaceID,iStageID,iUCIclass,iStart,iFinish,bRestDay);
SetComponentPosition(oPage_Season_Calendar.iDayObject[iLoop - 1], iX, iY);
iCol = iCol + 1;
if (iCol > 7)
{
iCol = 1;
iRow = iRow + 1;
}
iLoop = iLoop + 1;
}
}
//Init calendar day
//----------------------------------------------------------------------------------------------------------------//
func i32x InitCalendarDay(i32x _iLoop,i32x _iRaceID,i32x _iStageID,i32x _iUCIclass,i32x _iStart,i32x _iFinish,i32x _bRestDay)
{
var i32x id;
oObject_Season_Calendar.iDay = _iLoop;
oObject_Season_Calendar.iRaceID = _iRaceID;
oObject_Season_Calendar.iStageID = _iStageID;
oObject_Season_Calendar.iClass = _iUCIclass;
oObject_Season_Calendar.iIsStart = _iStart;
oObject_Season_Calendar.iIsFinish = _iFinish;
oObject_Season_Calendar.bRestDay = _bRestDay;
id = InitObject(
oObject_Season_Calendar.szName,
oObject_Season_Calendar.oFunc.pcreate,
oObject_Season_Calendar.oFunc.pevent
);
SetStackEvents(id, GUI_Mouse);
return id;
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void DoMonth (i32x _iMonth, i32x _iYear)
{
var boolx bLeap;
var i32x iDaysInMonth;
var i32x iDaysInYear;
var i32x iStartOfMonth;
var i32x iLoop;
bLeap = LeapYear(_iYear);
iLoop = 0;
while (iLoop < 31)
{
if (oPage_Season_Calendar.iDayObject[iLoop] != ID_NOT_CREATED)
{
DeleteComponent(oPage_Season_Calendar.iDayObject[iLoop]);
oPage_Season_Calendar.iDayObject[iLoop] = ID_NOT_CREATED;
}
iLoop = iLoop + 1;
}
SelectMonth(_iMonth);
var i32x iY;
iY = _iYear - 1;
var boolx bSpecial; //september 1582
bSpecial = ((_iYear == 1582) && (_iMonth == 9));
iDaysInYear = 0;
var boolx bPre; //before september 1582
bPre = ((_iYear < 1582) || ((_iYear == 1582) && (_iMonth <= 9)));
if (bPre)
iStartOfMonth = 6 + iY + (iY / 4);
else
iStartOfMonth = 1 + iY + (iY / 4) - (iY / 100) + (iY / 400);
if (bLeap)
{
iDaysInMonth = oPage_Season_Calendar.iLeapDays[_iMonth];
iLoop = 0;
while (iLoop < _iMonth)
{
iDaysInYear = iDaysInYear + oPage_Season_Calendar.iLeapDays[iLoop];
iStartOfMonth = iStartOfMonth + oPage_Season_Calendar.iLeapDays[iLoop];
iLoop = iLoop + 1;
}
}
else
{
iDaysInMonth = oPage_Season_Calendar.iMonthDays[_iMonth];
iLoop = 0;
while (iLoop < _iMonth)
{
iDaysInYear = iDaysInYear + oPage_Season_Calendar.iMonthDays[iLoop];
iStartOfMonth = iStartOfMonth + oPage_Season_Calendar.iMonthDays[iLoop];
iLoop = iLoop + 1;
}
}
iStartOfMonth = iStartOfMonth % 7;
oPage_Season_Calendar.iStartOfMonth = iStartOfMonth;
DrawMonth (iDaysInYear,iStartOfMonth, iDaysInMonth, bSpecial);
}
//*********************************
//Destruct global join if any
//*********************************
func void vDestroyCalendarJoin()
{
if(oPage_Season_Calendar.m_jRaceFullNameId != 0)
{
Join_Destructor(oPage_Season_Calendar.m_jRaceFullNameId);
oPage_Season_Calendar.m_jRaceFullNameId = 0;
}
if(oPage_Season_Calendar.m_jRaceDate != 0)
{
Join_Destructor(oPage_Season_Calendar.m_jRaceDate);
oPage_Season_Calendar.m_jRaceDate = 0;
}
if(oPage_Season_Calendar.m_jRaceID != 0)
{
Join_Destructor(oPage_Season_Calendar.m_jRaceID);
oPage_Season_Calendar.m_jRaceID = 0;
}
if(oPage_Season_Calendar.m_jRaceNumberOfStages != 0)
{
Join_Destructor(oPage_Season_Calendar.m_jRaceNumberOfStages);
oPage_Season_Calendar.m_jRaceNumberOfStages = 0;
}
if(oPage_Season_Calendar.m_jRaceUCIClass != 0)
{
Join_Destructor(oPage_Season_Calendar.m_jRaceUCIClass);
oPage_Season_Calendar.m_jRaceUCIClass = 0;
}
if(oPage_Season_Calendar.m_jRaceNameID != 0)
{
Join_Destructor(oPage_Season_Calendar.m_jRaceNameID);
oPage_Season_Calendar.m_jRaceNameID = 0;
}
if(oPage_Season_Calendar.m_jStageID != 0)
{
Join_Destructor(oPage_Season_Calendar.m_jStageID);
oPage_Season_Calendar.m_jStageID = 0;
}
if(oPage_Season_Calendar.m_jStageDate != 0)
{
Join_Destructor(oPage_Season_Calendar.m_jStageDate);
oPage_Season_Calendar.m_jStageDate = 0;
}
if(oPage_Season_Calendar.m_jStageRaceID != 0)
{
Join_Destructor(oPage_Season_Calendar.m_jStageRaceID);
oPage_Season_Calendar.m_jStageRaceID = 0;
}
if(oPage_Season_Calendar.m_jStageNum != 0)
{
Join_Destructor(oPage_Season_Calendar.m_jStageNum);
oPage_Season_Calendar.m_jStageNum = 0;
}
if(oPage_Season_Calendar.m_jStageFollowedRestDay != 0)
{
Join_Destructor(oPage_Season_Calendar.m_jStageFollowedRestDay);
oPage_Season_Calendar.m_jStageFollowedRestDay = 0;
}
if(oPage_Season_Calendar.m_jStageName != 0)
{
Join_Destructor(oPage_Season_Calendar.m_jStageName);
oPage_Season_Calendar.m_jStageName = 0;
}
}
//*********************************
//Create calendar page join
//*********************************
func void vCreateCalendarJoins()
{
oPage_Season_Calendar.m_jRaceFullNameId = Join_Constructor(QUERY_GLOBAL_STAGES,"STA_race.gene_strID_race_name");
oPage_Season_Calendar.m_jRaceDate = Join_Constructor(QUERY_GLOBAL_STAGES,"STA_race.gene_i_date");
oPage_Season_Calendar.m_jRaceNumberOfStages = Join_Constructor(QUERY_GLOBAL_STAGES,"STA_race.gene_i_number_stages");
oPage_Season_Calendar.m_jRaceID = Join_Constructor(QUERY_GLOBAL_STAGES,"STA_race.IDrace");
oPage_Season_Calendar.m_jRaceUCIClass = Join_Constructor(QUERY_GLOBAL_STAGES,"STA_race.fkIDUCI_class");
oPage_Season_Calendar.m_jRaceNameID = Join_Constructor(QUERY_GLOBAL_STAGES,"STA_race.gene_strID_race_abbreviation");
oPage_Season_Calendar.m_jStageID = Join_Constructor(QUERY_GLOBAL_STAGES,"STA_stage.IDstage");
oPage_Season_Calendar.m_jStageRaceID = Join_Constructor(QUERY_GLOBAL_STAGES,"STA_stage.fkIDrace");
oPage_Season_Calendar.m_jStageDate = Join_Constructor(QUERY_GLOBAL_STAGES,"STA_stage.gene_i_day");
oPage_Season_Calendar.m_jStageNum = Join_Constructor(QUERY_GLOBAL_STAGES,"STA_stage.gene_i_stage_number");
oPage_Season_Calendar.m_jStageFollowedRestDay = Join_Constructor(QUERY_GLOBAL_STAGES,"STA_stage.gene_b_followed_rest_day");
oPage_Season_Calendar.m_jStageName = Join_Constructor(QUERY_GLOBAL_STAGES,"STA_stage.gene_strID_stage_name");
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Page_Season_Calendar Create func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Page_Season_Calendar_Create ()
{
var i32x i,id,iNumUCIClass,jUCIClassStrId,jUCIClassId,iIndex,iColor;
var szx szTmp;
// Save context
oPage_Season_Calendar.pThis = GetParserComponent();
// *** Update Title Bar ***
Set_Title_Bar_Text(GetLocalizedFromGMKey(149)); // page title
SetComponentNumber(92);
// Page Background
id = Init_LibObject_FilledCadre(tCadreDialbox,700,550);
SetEvents(id,0);
SetComponentHeight(id,500);
// Days text
i = 0;
while (i < 7)
{
var i32x iOffset;
id = InitContainer(tFontArialItalique);
SetContainerText(id, oPage_Season_Calendar.szDayNames[i]);
iOffset = (85 - GetTextSizeX(id,oPage_Season_Calendar.szDayNames[i]))/2;
SetComponentPosition(id, i * 90 + 17 + iOffset, 76);
i = i + 1;
}
// Title Line
id = InitContainer(t_Common_Color_White);
SetContainerSize(id,645,1);
SetComponentPosition(id,5,92);
// Months
i = 0;
while (i < 12)
{
// RadioButton
oPage_Season_Calendar.cMonthsName[i] =Init_LibObject_MultiRadioButtonWithText(tButton32Multi,0,oPage_Season_Calendar.szMonthNames[i],tFontArial,381+i);
SetTextButtonStateFunc(oPage_Season_Calendar.cMonthsName[i],CheckBoxMultiState,MultiRadioButtonWithText_TextState);
SetComponentPosition(oPage_Season_Calendar.cMonthsName[i], i * 54 + 3, 35);
ResizeComponent(oPage_Season_Calendar.cMonthsName[i]);
i = i + 1;
}
// UCI class
jUCIClassId = Join_Constructor(QUERY_GLOBAL_STAGES,"STA_UCI_class.IDUCI_class");
jUCIClassStrId = Join_Constructor(QUERY_GLOBAL_STAGES,"STA_UCI_class.gene_strID_UCI_class");
iNumUCIClass = Join_GetNumRows(jUCIClassStrId);
i = 0;
while (i < iNumUCIClass)
{
//iIndex = Join_GetIntFromIndex(jUCIClassId,i)-1;
iIndex = oPage_Season_Calendar.m_aUCIClassOrder[i];
if((i>=0)&&(i<oPage_Season_Calendar.m_iNumValidColor))
iColor = oPage_Season_Calendar.m_a16UCIColor[oPage_Season_Calendar.m_aUCIClassColor[iIndex]];
else
iColor = oPage_Season_Calendar.m_a16UCIColor[0];
szTmp = GetLocalizedFromKey(Join_GetIntFromKey(jUCIClassStrId,iIndex));
id = Init_LibObject_FilledCadre(tFCadre2,96,32);
SetComponentPosition(id,(i%5)*96+40,446+32*(i/5));
SetCadreColor(id, iColor);
id = InitContainer(tFontArialItalique);
SetComponentPosition(id,(i%5)*96+40,446+32*(i/5));
SetComponentSize(id,96,32);
SetContainerOffset(id,-1);
SetContainerTextJustify(id,szTmp);
i = i + 1;
}
Join_Destructor(jUCIClassId);
Join_Destructor(jUCIClassStrId);
// Init day object structure
Object_Season_Calendar_InitMembers();
// Create calendar joins
vCreateCalendarJoins();
// Draw month
DoMonth(oPage_Season_Calendar.iCurrentMonth, oPage_Season_Calendar.iCurrentYear);
// Race info cadre
// Title Line
id = InitContainer(t_Common_Color_White);
SetContainerSize(id,645,1);
SetComponentPosition(id,5,441);
// Dummy component
// To let 1 free index between day and race info
id = InitContainer(t_Common_Color_White);
Object_RaceInfo_InitMembers();
oPage_Season_Calendar.iRaceInfoID = InitObject("Race Info", oCalendar_RaceInfo.oFunc.pcreate, oCalendar_RaceInfo.oFunc.pevent);
SetComponentPosition(oPage_Season_Calendar.iRaceInfoID, 30, 480);
SetComponentVisibleStatus(oPage_Season_Calendar.iRaceInfoID,0);
SetEvents(oPage_Season_Calendar.iRaceInfoID,GUI_NoEvent);
DeleteComponent(id);
AutoResize();
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Page_Season_Calendar Event func
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func i32x Page_Season_Calendar_Event (i32x _iComponentID, i32x _iEvent)
{
if(_iEvent == GUI_RADIOBUTTON_CHANGED)
{
var i32x i;
PlaySound(0,sbClickSound[0]);
i=0;
while(i<12)
{
if(_iComponentID==oPage_Season_Calendar.cMonthsName[i])
{
oPage_Season_Calendar.iCurrentMonth = i;
}
else
{
SetTextRadioButtonCheckBox(oPage_Season_Calendar.cMonthsName[i],0);
}
i=i+1;
}
DoMonth(oPage_Season_Calendar.iCurrentMonth, oPage_Season_Calendar.iCurrentYear);
}
else if(_iEvent == GUI_COMPONENT_DESTRUCTOR)
{
if(_iComponentID == -1)
{
// Destroy global join
vDestroyCalendarJoin();
Reset_Tool_Bar_Text();
}
}
return 1;
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Page_Season_Calendar Constructor
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func i32x Page_Season_Calendar_Constructor ()
{
// Retrieve current date
oPage_Season_Calendar.iCurrentMonth = g_oGameConfig.m_iMonth-1; //1..12 to 0..11
oPage_Season_Calendar.iCurrentYear = g_oGameConfig.m_iYear;
oPage_Season_Calendar.szDayNames[0] = GetLocalizedFromGMKey(17);
oPage_Season_Calendar.szDayNames[1] = GetLocalizedFromGMKey(10);
oPage_Season_Calendar.szDayNames[2] = GetLocalizedFromGMKey(11);
oPage_Season_Calendar.szDayNames[3] = GetLocalizedFromGMKey(12);
oPage_Season_Calendar.szDayNames[4] = GetLocalizedFromGMKey(14);
oPage_Season_Calendar.szDayNames[5] = GetLocalizedFromGMKey(15);
oPage_Season_Calendar.szDayNames[6] = GetLocalizedFromGMKey(16);
oPage_Season_Calendar.szMonthNames[0] = strncpy(GetLocalizedFromGMKey(18),3);
oPage_Season_Calendar.szMonthNames[1] = strncpy(GetLocalizedFromGMKey(19),3);
oPage_Season_Calendar.szMonthNames[2] = strncpy(GetLocalizedFromGMKey(20),3);
oPage_Season_Calendar.szMonthNames[3] = strncpy(GetLocalizedFromGMKey(21),3);
oPage_Season_Calendar.szMonthNames[4] = strncpy(GetLocalizedFromGMKey(22),3);
oPage_Season_Calendar.szMonthNames[5] = strncpy(GetLocalizedFromGMKey(23),3);
oPage_Season_Calendar.szMonthNames[6] = strncpy(GetLocalizedFromGMKey(24),3);
oPage_Season_Calendar.szMonthNames[7] = strncpy(GetLocalizedFromGMKey(25),3);
oPage_Season_Calendar.szMonthNames[8] = strncpy(GetLocalizedFromGMKey(26),3);
oPage_Season_Calendar.szMonthNames[9] = strncpy(GetLocalizedFromGMKey(27),3);
oPage_Season_Calendar.szMonthNames[10] = strncpy(GetLocalizedFromGMKey(28),3);
oPage_Season_Calendar.szMonthNames[11] = strncpy(GetLocalizedFromGMKey(29),3);
// create page
oPage_Season_Calendar.iWindowID = InitObject(oPage_Season_Calendar.szName, oPage_Season_Calendar.oFunc.pcreate, oPage_Season_Calendar.oFunc.pevent);
SetStackEvents(oPage_Season_Calendar.iWindowID,GUI_Destroy| GUI_Char | GUI_KeyDown);
return oPage_Season_Calendar.iWindowID;
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Page_Season_Calendar Destructor
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Page_Season_Calendar_Destructor ()
{
var i32x iLoop;
Reset_Tool_Bar_Text();
// Destroy all page global join
vDestroyCalendarJoin();
// Reinit component index
iLoop = 0;
while (iLoop < 31)
{
oPage_Season_Calendar.iDayObject[iLoop] = ID_NOT_CREATED;
iLoop = iLoop + 1;
}
// Delete page
DeleteComponent(oPage_Season_Calendar.iWindowID);
oPage_Season_Calendar.iWindowID = ID_NOT_CREATED;
}
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
//Page_Season_Calendar Init member
//----------------------------------------------------------------------------------------------------------------//
//----------------------------------------------------------------------------------------------------------------//
func void Page_Season_Calendar_InitMembers ()
{
oPage_Season_Calendar.szName = "Page_Season_Calendar";
oPage_Season_Calendar.oFunc.pcreate = Page_Season_Calendar_Create;
oPage_Season_Calendar.oFunc.pevent = Page_Season_Calendar_Event;
// Join_Index init
oPage_Season_Calendar.m_jStageID = 0;
oPage_Season_Calendar.m_jStageDate = 0;
oPage_Season_Calendar.m_jStageNum = 0;
oPage_Season_Calendar.m_jStageFollowedRestDay = 0;
oPage_Season_Calendar.m_jRaceDate = 0;
oPage_Season_Calendar.m_jRaceID = 0;
oPage_Season_Calendar.m_jRaceUCIClass = 0;
oPage_Season_Calendar.m_jRaceNameID = 0;
oPage_Season_Calendar.m_jStageName = 0;
oPage_Season_Calendar.iMonthDays[0] = 31; // janvier
oPage_Season_Calendar.iMonthDays[1] = 28; // fevrier
oPage_Season_Calendar.iMonthDays[2] = 31; // mars
oPage_Season_Calendar.iMonthDays[3] = 30; // avril
oPage_Season_Calendar.iMonthDays[4] = 31; // mai
oPage_Season_Calendar.iMonthDays[5] = 30; // juin
oPage_Season_Calendar.iMonthDays[6] = 31; // juillet
oPage_Season_Calendar.iMonthDays[7] = 31; // aout
oPage_Season_Calendar.iMonthDays[8] = 30; // septembre
oPage_Season_Calendar.iMonthDays[9] = 31; // octobre
oPage_Season_Calendar.iMonthDays[10] = 30; // novembre
oPage_Season_Calendar.iMonthDays[11] = 31; // decembre
oPage_Season_Calendar.iLeapDays[0] = 31; // janvier
oPage_Season_Calendar.iLeapDays[1] = 29; // fevrier
oPage_Season_Calendar.iLeapDays[2] = 31; // mars
oPage_Season_Calendar.iLeapDays[3] = 30; // avril
oPage_Season_Calendar.iLeapDays[4] = 31; // mai
oPage_Season_Calendar.iLeapDays[5] = 30; // juin
oPage_Season_Calendar.iLeapDays[6] = 31; // juillet
oPage_Season_Calendar.iLeapDays[7] = 31; // aout
oPage_Season_Calendar.iLeapDays[8] = 30; // septembre
oPage_Season_Calendar.iLeapDays[9] = 31; // octobre
oPage_Season_Calendar.iLeapDays[10] = 30; // novembre
oPage_Season_Calendar.iLeapDays[11] = 31; // decembre
// UCI color
oPage_Season_Calendar.m_iNumValidColor = 12;
oPage_Season_Calendar.m_aUCIClassOrder[0] = 1;
oPage_Season_Calendar.m_aUCIClassOrder[1] = 8;
oPage_Season_Calendar.m_aUCIClassOrder[2] = 9;
oPage_Season_Calendar.m_aUCIClassOrder[3] = 10;
oPage_Season_Calendar.m_aUCIClassOrder[4] = 11;
oPage_Season_Calendar.m_aUCIClassOrder[5] = 2;
oPage_Season_Calendar.m_aUCIClassOrder[6] = 3;
oPage_Season_Calendar.m_aUCIClassOrder[7] = 4;
oPage_Season_Calendar.m_aUCIClassOrder[8] = 5;
oPage_Season_Calendar.m_aUCIClassOrder[9] = 6;
oPage_Season_Calendar.m_aUCIClassColor[0] = 0;
oPage_Season_Calendar.m_aUCIClassColor[1] = 0;
oPage_Season_Calendar.m_aUCIClassColor[2] = 5;
oPage_Season_Calendar.m_aUCIClassColor[3] = 6;
oPage_Season_Calendar.m_aUCIClassColor[4] = 7;
oPage_Season_Calendar.m_aUCIClassColor[5] = 8;
oPage_Season_Calendar.m_aUCIClassColor[6] = 9;
oPage_Season_Calendar.m_aUCIClassColor[7] = 0;
oPage_Season_Calendar.m_aUCIClassColor[8] = 1;
oPage_Season_Calendar.m_aUCIClassColor[9] = 2;
oPage_Season_Calendar.m_aUCIClassColor[10] = 3;
oPage_Season_Calendar.m_aUCIClassColor[11] = 4;
oPage_Season_Calendar.m_aUCIClassColor[12] = 0;
oPage_Season_Calendar.m_a16UCIColor[0] = MakeARGB(255,68,105,0);
oPage_Season_Calendar.m_a16UCIColor2[0] = MakeARGB(255,96,255,0);
oPage_Season_Calendar.m_a16UCIColor[1] = MakeARGB(255,68,136,0);
oPage_Season_Calendar.m_a16UCIColor2[1] = MakeARGB(255,96,255,0);
oPage_Season_Calendar.m_a16UCIColor[2] = MakeARGB(255,85,172,0);
oPage_Season_Calendar.m_a16UCIColor2[2] = MakeARGB(255,96,255,0);
oPage_Season_Calendar.m_a16UCIColor[3] = MakeARGB(255,107,216,0);
oPage_Season_Calendar.m_a16UCIColor2[3] = MakeARGB(255,96,255,0);
oPage_Season_Calendar.m_a16UCIColor[4] = MakeARGB(255,162,249,80);
oPage_Season_Calendar.m_a16UCIColor2[4] = MakeARGB(255,96,255,0);
oPage_Season_Calendar.m_a16UCIColor[5] = MakeARGB(255,231,101,26);
oPage_Season_Calendar.m_a16UCIColor2[5] = MakeARGB(255,255,255,0);
oPage_Season_Calendar.m_a16UCIColor[6] = MakeARGB(255,255,160,28);
oPage_Season_Calendar.m_a16UCIColor2[6] = MakeARGB(255,255,255,0);
oPage_Season_Calendar.m_a16UCIColor[7] = MakeARGB(255,255,190,55);
oPage_Season_Calendar.m_a16UCIColor2[7] = MakeARGB(255,255,255,0);
oPage_Season_Calendar.m_a16UCIColor[8] = MakeARGB(255,255,222,99);
oPage_Season_Calendar.m_a16UCIColor2[8] = MakeARGB(255,255,255,0);
oPage_Season_Calendar.m_a16UCIColor[9] = MakeARGB(255,251,232,161);
oPage_Season_Calendar.m_a16UCIColor2[9] = MakeARGB(255,255,255,0);
oPage_Season_Calendar.m_a16UCIColor[10] = MakeARGB(255,64,64,98);
oPage_Season_Calendar.m_a16UCIColor2[10] = MakeARGB(255,128,128,196);
oPage_Season_Calendar.m_a16UCIColor[11] = MakeARGB(255,64,64,98);
oPage_Season_Calendar.m_a16UCIColor2[11] = MakeARGB(255,128,128,196);
oPage_Season_Calendar.m_a16UCIColor[12] = MakeARGB(255,128,98,128);
oPage_Season_Calendar.m_a16UCIColor2[12] = MakeARGB(255,255,196,255);
var i32x iLoop;
iLoop = 0;
while (iLoop < 31)
{
oPage_Season_Calendar.iDayObject[iLoop] = ID_NOT_CREATED;
iLoop = iLoop + 1;
}
iLoop = 0;
while (iLoop < 12)
{
oPage_Season_Calendar.cMonthsName[iLoop] = ID_NOT_CREATED;
iLoop = iLoop + 1;
}
oPage_Season_Calendar.iWindowID = ID_NOT_CREATED;
oPage_Season_Calendar.iInfoCount = 0;
}