// amstuff.cpp Functions for controlling Amulet GUI Library objects /******************************************************************************* // MODULE NAME: AmStuff // INTERFACE FILE: amstuff.h // IMPLEMENTATION FILE: amstff.cpp // // PURPOSE: To provide the functions which control the Amulet GUI objects used // in the implementation of the BAM program // // FUNCTIONS: Name Purpose // DoAmuletStuff Create objects & start Amulet code // InitMenus Create menu bar object // InitTopFields Create screen field object // InitBottomFields Create screen field object // InitScoresTable Create screen table object // UpdateAllObjects Re-evaluate contents of screen objects // ClearAllObjects Empty contents of screen objects // // REVISED: 4/29/1999 by Amy Langill *2B *******************************************************************************/ #pragma warning (disable:4800) #include "amstuff.h" // For function prototypes #include // For amulet definitions & macros & the like #include // For strings #include "driver.h" // For driver functions using namespace std; // File-scoped stuff Am_Object my_win, about_win; // Windows const int LINE_HEIGHT=18; // Named constants to control size of various const int FIELD_HEIGHT=14; // components const int CHAR_WIDTH=7; // const int BORDER_OFFSET=2; // const int BORDER_WIDTH=4; // const int BETWEEN_FIELDS=6; // const int TWENTY_CHAR = 140; // const int EIGHT_CHAR = 56; // const int SEVEN_CHAR = 49; // const int SIX_CHAR = 42; // // Slot keys for referencing individual objects on the screen Am_Slot_Key IO_PART = Am_Register_Slot_Name("io_part"); Am_Slot_Key BORDER_PART = Am_Register_Slot_Name("border_part"); Am_Slot_Key MESSAGE_PART = Am_Register_Slot_Name("message_part"); Am_Slot_Key MENU_PART = Am_Register_Slot_Name("menu_part"); Am_Slot_Key SCORES = Am_Register_Slot_Name("scores"); Am_Slot_Key TOP_FIELDS = Am_Register_Slot_Name("top_fields"); Am_Slot_Key BOTTOM_FIELDS = Am_Register_Slot_Name("bottom_fields"); Am_Slot_Key TEXT_PART = Am_Register_Slot_Name("TEXT_PART"); Am_Slot_Key LABEL_PART = Am_Register_Slot_Name("LABEL_PART"); Am_Slot_Key RECT_PART = Am_Register_Slot_Name("RECT_PART"); Am_Slot_Key LEFT_FIELD = Am_Register_Slot_Name("LEFT_FIELD"); Am_Slot_Key CENTER_FIELD = Am_Register_Slot_Name("CENTER_FIELD"); Am_Slot_Key RIGHT_FIELD = Am_Register_Slot_Name("RIGHT_FIELD"); Am_Slot_Key LABEL_ROW = Am_Register_Slot_Name("label_row"); Am_Slot_Key MARKS_ROW = Am_Register_Slot_Name("marks_row"); Am_Slot_Key SCORE_ROW = Am_Register_Slot_Name("score_row"); Am_Slot_Key FRAME_1 = Am_Register_Slot_Name("frame_1"); Am_Slot_Key FRAME_2 = Am_Register_Slot_Name("frame_2"); Am_Slot_Key FRAME_3 = Am_Register_Slot_Name("frame_3"); Am_Slot_Key FRAME_4 = Am_Register_Slot_Name("frame_4"); Am_Slot_Key FRAME_5 = Am_Register_Slot_Name("frame_5"); Am_Slot_Key FRAME_6 = Am_Register_Slot_Name("frame_6"); Am_Slot_Key FRAME_7 = Am_Register_Slot_Name("frame_7"); Am_Slot_Key FRAME_8 = Am_Register_Slot_Name("frame_8"); Am_Slot_Key FRAME_9 = Am_Register_Slot_Name("frame_9"); Am_Slot_Key FRAME_10 = Am_Register_Slot_Name("frame_10"); Am_Slot_Key BORDER_RECT = Am_Register_Slot_Name("border_part"); Am_Slot_Key DATA_PART = Am_Register_Slot_Name("data_part"); /******************************************************************************* // FORMULA NAME: title_left_formula // // DESCRIPTION OF FORMULA: Used for centering an object within its parent // // USED BY: io_area, title_text // // AUTHOR: Amy Langill *2B DATE: 4/30/1999 *******************************************************************************/ Am_Define_Formula(int, title_left_formula) { Am_Object owner = self.Get_Owner(); int owner_Width = owner.Get(Am_WIDTH); int self_Width = self.Get(Am_WIDTH); return (owner_Width - self_Width)/2; } /******************************************************************************* // FORMULA NAME: center_formula // // DESCRIPTION OF FORMULA: Used for centering an object within its parent // // USED BY: InitBottomFields, InitTopFields // // AUTHOR: Amy Langill *2B DATE: 4/30/1999 *******************************************************************************/ Am_Define_Formula(int, center_formula) { Am_Object owner = self.Get_Owner(); int owner_Width = owner.Get(Am_WIDTH); int self_Width = self.Get(Am_WIDTH); return (owner_Width - self_Width)/2; } /******************************************************************************* // METHOD NAME: file_open_do // // DESCRIPTION OF METHOD: If a file is currently open, queries the user to see // if she wants to close the current BAM file. If so, it closes the current // file and prompts her for the name of a new file to open. If she chooses not // to close the current BAM file, it simply returns // // DESCRIPTION OF ALGORITHM: Checks to see if a file is currently open using // noRecords(). If a file is open, uses Am_Get_Choice_From_Dialog to query the // user about wishing to quit. Depending on the response, either quits or // uses Am_Get_Input_From_Dialog to get the name of a new file to open // // INVOKED BY: my_menu_bar Open_Command // CALLS: noRecords(),Am_Get_Choice_From_Dialog,closeFile,ClearAllObjects, // Am_Get_Input_From_Dialog,UpdateAllObjects // // AUTHOR: Amy Langill *2B DATE: 5/1/1999 *******************************************************************************/ Am_Define_Method(Am_Object_Method, void, file_open_do, (Am_Object self)) { Am_Object io_line=my_win.Get_Object(IO_PART).Get_Object(MESSAGE_PART); io_line.Set(Am_TEXT, ""); if (!noRecords()) { Am_Value selection; Am_Value_List openPrompt; openPrompt.Add("Do you want to close the currently open file?"); int xcoor = Am_AT_CENTER_SCREEN; //ints to set up int ycoor = Am_AT_CENTER_SCREEN ; //input dialog location selection = Am_Get_Choice_From_Dialog(openPrompt,xcoor,ycoor,true); if (selection == "Cancel") return; else { closeFile(); ClearAllObjects(); } } //setup dialog box prompts Am_Value_List prompts; prompts.Add("Please enter the name of an existing file.") .Add("Enter full path name, if file is NOT in the current directory.") .Add("(Be sure to enter the file extension)"); Am_String InFileName ; //define return value from input dialog int xcoor = Am_AT_CENTER_SCREEN; //ints to set up int ycoor = Am_AT_CENTER_SCREEN ; //input dialog location //call Amulet input dialog box - Dialog is Modal InFileName = Am_Get_Input_From_Dialog(prompts, "filename.ext", xcoor, ycoor, true); if (InFileName == Am_No_Value) //cancel button pressed io_line.Set(Am_TEXT, "No File Was Specified"); else { //convert entered Amulet string to string object char* fstr = InFileName ; string filestring(fstr); string message="Opened file..."; string badMessage="Couldn't open file..."; badMessage += filestring; message += filestring; if (openFile(filestring)) // If we were able to open the file { io_line.Set(Am_TEXT, message.c_str()); UpdateAllObjects(); } else // Weren't able to open the file io_line.Set(Am_TEXT, badMessage.c_str()); } return; } /******************************************************************************* // METHOD NAME: file_saveas_do // // DESCRIPTION OF METHOD: If a file is not open, warns the user that there is // no file open. Otherwise, prompts the user for the name of a file to save // the current data as, then writes out a new file under the specified name // // DESCRIPTION OF ALGORITHM: Calls noRecords() to determine if a file is // currently open. If not, warns the user that no file is open and returns. // If a file is open, uses Am_Get_Input_From_Dialog to get the new file name to // save the current data under, then uses writeFile() to write out the new // file // // INVOKED BY: my_menu_bar SaveAs_Command // CALLS: noRecords, Am_Get_Input_From_Dialog, writeFile // // AUTHOR: Amy Langill *2B DATE: 5/1/1999 *******************************************************************************/ Am_Define_Method(Am_Object_Method, void, file_saveas_do, (Am_Object self)) { Am_Object io_line = my_win.Get_Object(IO_PART).Get_Object(MESSAGE_PART); if (noRecords()) { io_line.Set(Am_TEXT, "Please open a BAM file to perform this operation"); } else { //setup dialog box prompts Am_Value_List prompts; prompts.Add("Please enter the new name you wish to save the file under.") .Add("(Be sure to enter the file extension)"); Am_String OutFileName ; //define return value from input dialog int xcoor = Am_AT_CENTER_SCREEN; //ints to set up int ycoor = Am_AT_CENTER_SCREEN ; //input dialog location //call Amulet input dialog box - Dialog is Modal OutFileName = Am_Get_Input_From_Dialog(prompts, "filename.ext", xcoor, ycoor, true); if (OutFileName == Am_No_Value) //cancel button pressed io_line.Set(Am_TEXT, "File save cancelled"); else { //convert entered Amulet string to string object char* fstr = OutFileName ; string filestring(fstr); string message="File saved as..."; message += filestring; writeFile(filestring); io_line.Set(Am_TEXT, message.c_str()); } } return; } /******************************************************************************* // METHOD NAME: file_quit_do // // DESCRIPTION OF METHOD: Queries the user to be sure she really wants to exit // the program, and quits if she answers yes. // // DESCRIPTION OF ALGORITHM: Uses Am_Get_Choice_From_Dialog to query the user // about whether she really wants to quit, and calls Am_Exit_Main_Event_Loop if // she does want to quit BAM // // INVOKED BY: my_menu_bar Quit_Command // CALLS: Am_Get_Choice_From_Dialog, Am_Exit_Main_Event_Loop // // AUTHOR: Amy Langill *2B DATE: 5/1/1999 *******************************************************************************/ Am_Define_Method(Am_Object_Method, void, file_quit_do, (Am_Object self)) { Am_Value selection; Am_Value_List quitPrompt; quitPrompt.Add("Do you want to quit BAM?"); int xcoor = Am_AT_CENTER_SCREEN; //ints to set up int ycoor = Am_AT_CENTER_SCREEN ; //input dialog location selection = Am_Get_Choice_From_Dialog(quitPrompt,xcoor,ycoor,true); if (selection == "OK") Am_Exit_Main_Event_Loop(); return; } /******************************************************************************* // METHOD NAME: file_close_do // // DESCRIPTION OF METHOD: If no file is open, warns the user that she should // open a valid file before trying to close it, otherwise closes the file and // empties the contents of the appropriate screen obejcts. // // DESCRIPTION OF ALGORITHM: If noRecords() indicates that there isn't a file // currently open, warns the user. Otherwise, the method calls closeFile() and // ClearAllObjects() // // INVOKED BY: my_menu_bar Close_Command // CALLS: closeFile, ClearAllObjects // // AUTHOR: Amy Langill *2B DATE: 5/1/1999 *******************************************************************************/ Am_Define_Method(Am_Object_Method, void, file_close_do, (Am_Object self)) { if (noRecords()) { Am_Object io_line = my_win.Get_Object(IO_PART).Get_Object(MESSAGE_PART); io_line.Set(Am_TEXT, "Please open a BAM file to perform this operation"); } else { closeFile(); ClearAllObjects(); } return; } /******************************************************************************* // METHOD NAME: games_first_do // // DESCRIPTION OF METHOD: If a file is currently open, attempts to retrieve the // first record of the list and refresh the screen. If that fails, it warns // the user of its failure. // // DESCRIPTION OF ALGORITHM: Calls noRecords() to determine if no file is open, // and if a file is open, calls getFirstRecord(). If getFirstRecord() succeeds, // calls UpdateAllObjects() to display the first record. Otherwise, it beeps // to warn that user that it couldn't get the first record // // INVOKED BY: my_menu_bar First_Command // CALLS: noRecords,getFirstRecord,UpdateAllObjects,Am_Beep // // AUTHOR: Amy Langill *2B DATE: 5/1/1999 *******************************************************************************/ Am_Define_Method(Am_Object_Method, void, games_first_do, (Am_Object self)) { Am_Object io_line = my_win.Get_Object(IO_PART).Get_Object(MESSAGE_PART); if (noRecords()) io_line.Set(Am_TEXT, "Please open a BAM file to perform this operation"); else if (getFirstRecord()) { UpdateAllObjects(); io_line.Set(Am_TEXT, ""); } else { Am_Beep(my_win); io_line.Set(Am_TEXT, "Unable to retrieve first record"); } return; } /******************************************************************************* // METHOD NAME: games_prev_do // // DESCRIPTION OF METHOD: If a file is currently open, attempts to retrieve the // previous record in the list and refresh the screen. If that fails, it warns // the user of its failure. // // DESCRIPTION OF ALGORITHM: Calls noRecords() to determine if no file is open, // and if a file is open, calls getPrevRecord(). If getPrevRecord() succeeds, // calls UpdateAllObjects() to display the record. Otherwise, it beeps // to warn that user that it couldn't get the previous record // // INVOKED BY: my_menu_bar Prev_Command // CALLS: noRecords,getPrevRecord,UpdateAllObjects,Am_Beep // // AUTHOR: Amy Langill *2B DATE: 5/1/1999 *******************************************************************************/ Am_Define_Method(Am_Object_Method, void, games_prev_do, (Am_Object self)) { Am_Object io_line = my_win.Get_Object(IO_PART).Get_Object(MESSAGE_PART); if (noRecords()) io_line.Set(Am_TEXT, "Please open a BAM file to perform this operation"); else if (getPrevRecord()) { UpdateAllObjects(); io_line.Set(Am_TEXT, ""); } else { Am_Beep(my_win); io_line.Set(Am_TEXT, "Unable to retrieve previous record"); } return; } /******************************************************************************* // METHOD NAME: games_next_do // // DESCRIPTION OF METHOD: If a file is currently open, attempts to retrieve the // next record in the list and refresh the screen. If that fails, it warns // the user of its failure. // // DESCRIPTION OF ALGORITHM: Calls noRecords() to determine if no file is open, // and if a file is open, calls getNextRecord(). If getNextRecord() succeeds, // calls UpdateAllObjects() to display the record. Otherwise, it beeps // to warn that user that it couldn't get the next record // // INVOKED BY: my_menu_bar Next_Command // CALLS: noRecords,getNextRecord,UpdateAllObjects,Am_Beep // // AUTHOR: Amy Langill *2B DATE: 5/1/1999 *******************************************************************************/ Am_Define_Method(Am_Object_Method, void, games_next_do, (Am_Object self)) { Am_Object io_line = my_win.Get_Object(IO_PART).Get_Object(MESSAGE_PART); if (noRecords()) io_line.Set(Am_TEXT, "Please open a BAM file to perform this operation"); else if (getNextRecord()) { UpdateAllObjects(); io_line.Set(Am_TEXT, ""); } else { Am_Beep(my_win); io_line.Set(Am_TEXT, "Unable to retrieve next record"); } return; } /******************************************************************************* // METHOD NAME: games_last_do // // DESCRIPTION OF METHOD: If a file is currently open, attempts to retrieve the // last record of the list and refresh the screen. If that fails, it warns // the user of its failure. // // DESCRIPTION OF ALGORITHM: Calls noRecords() to determine if no file is open, // and if a file is open, calls getLastRecord(). If getLastRecord() succeeds, // calls UpdateAllObjects() to display the record. Otherwise, it beeps // to warn that user that it couldn't get the last record // // INVOKED BY: my_menu_bar Last_Command // CALLS: noRecords,getLastRecord,UpdateAllObjects,Am_Beep // // AUTHOR: Amy Langill *2B DATE: 5/1/1999 *******************************************************************************/ Am_Define_Method(Am_Object_Method, void, games_last_do, (Am_Object self)) { Am_Object io_line = my_win.Get_Object(IO_PART).Get_Object(MESSAGE_PART); if (noRecords()) io_line.Set(Am_TEXT, "Please open a BAM file to perform this operation"); else if (getLastRecord()) { UpdateAllObjects(); io_line.Set(Am_TEXT, ""); } else { Am_Beep(my_win); io_line.Set(Am_TEXT, "Unable to retrieve last record"); } return; } /******************************************************************************* // METHOD NAME: search_alley_do // // DESCRIPTION OF METHOD: If there are any active records, uses a dialog box // to get the alley string the user wants to search for, then calls the // searching function to find a record with that value and updates all of the // objects // // DESCRIPTION OF ALGORITHM: If noRecords() returns false, creates a dialog // box and uses Am_Get_Input_From_Dialog_Box to get the string to search for, // then calls searchByAlley() to search for a matching record. If one is found, // calls UpdateAllObjects() // // INVOKED BY: my_menu_bar Alley_Command // CALLS: noRecords,Am_Get_Input_From_Dialog,searchByAlley,UpdateAllObjects // // AUTHOR: Amy Langill *2B DATE: 5/1/1999 *******************************************************************************/ Am_Define_Method(Am_Object_Method, void, search_alley_do, (Am_Object self)) { Am_Object io_line = my_win.Get_Object(IO_PART).Get_Object(MESSAGE_PART); if (noRecords()) io_line.Set(Am_TEXT, "Please open a BAM file to perform this operation"); else { //setup dialog box prompts Am_Value_List prompts; prompts.Add("Please enter the alley name you wish to search for.") .Add("BAM will attempt to match the entire string to the") .Add("beginning of an alley name. This search is case sensitive"); Am_String AlleyName ; //define return value from input dialog int xcoor = Am_AT_CENTER_SCREEN; //ints to set up int ycoor = Am_AT_CENTER_SCREEN ; //input dialog location //call Amulet input dialog box - Dialog is Modal AlleyName = Am_Get_Input_From_Dialog(prompts, Alley().c_str(), xcoor, ycoor, true); if (AlleyName == Am_No_Value) //cancel button pressed io_line.Set(Am_TEXT, "Search was cancelled"); else { //convert entered Amulet string to string object char* astr = AlleyName ; string alleyString(astr); if (searchByAlley(alleyString)) { UpdateAllObjects(); io_line.Set(Am_TEXT, "Matching record(s) found."); } else io_line.Set(Am_TEXT, "No matching records found."); } } return; } /******************************************************************************* // METHOD NAME: search_event_do // // DESCRIPTION OF METHOD: If there are any active records, uses a dialog box // to get the event string the user wants to search for, then calls the // searching function to find a record with that value and updates all of the // objects // // DESCRIPTION OF ALGORITHM: If noRecords() returns false, creates a dialog // box and uses Am_Get_Input_From_Dialog_Box to get the string to search for, // then calls searchByEvent() to search for a matching record. If one is found, // calls UpdateAllObjects() // // INVOKED BY: my_menu_bar Event_Command // CALLS: noRecords,Am_Get_Input_From_Dialog,searchByEvent,UpdateAllObjects // // AUTHOR: Amy Langill *2B DATE: 5/1/1999 *******************************************************************************/ Am_Define_Method(Am_Object_Method, void, search_event_do, (Am_Object self)) { Am_Object io_line = my_win.Get_Object(IO_PART).Get_Object(MESSAGE_PART); if (noRecords()) io_line.Set(Am_TEXT, "Please open a BAM file to perform this operation"); else { //setup dialog box prompts Am_Value_List prompts; prompts.Add("Please enter the Event name you wish to search for.") .Add("BAM will attempt to match the entire string to the") .Add("beginning of an Event name. This search is case sensitive"); Am_String EventName ; //define return value from input dialog int xcoor = Am_AT_CENTER_SCREEN; //ints to set up int ycoor = Am_AT_CENTER_SCREEN ; //input dialog location //call Amulet input dialog box - Dialog is Modal EventName = Am_Get_Input_From_Dialog(prompts, Event().c_str(), xcoor, ycoor, true); if (EventName == Am_No_Value) //cancel button pressed io_line.Set(Am_TEXT, "Search was cancelled"); else { //convert entered Amulet string to string object char* estr = EventName ; string eventString(estr); if (searchByEvent(eventString)) { UpdateAllObjects(); io_line.Set(Am_TEXT, "Matching record(s) found."); } else io_line.Set(Am_TEXT, "No matching records found."); } } return; } /******************************************************************************* // METHOD NAME: search_date_do // // DESCRIPTION OF METHOD: If there are any active records, uses a dialog box // to get the date string the user wants to search for, then calls the // searching function to find a record with that value and updates all of the // objects // // DESCRIPTION OF ALGORITHM: If noRecords() returns false, creates a dialog // box and uses Am_Get_Input_From_Dialog_Box to get the string to search for, // then calls searchByDate() to search for a matching record. If one is found, // calls UpdateAllObjects() // // INVOKED BY: my_menu_bar Date_Command // CALLS: noRecords,Am_Get_Input_From_Dialog,searchByDate,UpdateAllObjects // // AUTHOR: Amy Langill *2B DATE: 5/1/1999 *******************************************************************************/ Am_Define_Method(Am_Object_Method, void, search_date_do, (Am_Object self)) { Am_Object io_line = my_win.Get_Object(IO_PART).Get_Object(MESSAGE_PART); if (noRecords()) io_line.Set(Am_TEXT, "Please open a BAM file to perform this operation"); else { //setup dialog box prompts Am_Value_List prompts; prompts.Add("Please enter the Date you wish to search for.") .Add("BAM will attempt to match the entire value to the") .Add("beginning of a Date."); Am_String GameDate ; //define return value from input dialog int xcoor = Am_AT_CENTER_SCREEN; //ints to set up int ycoor = Am_AT_CENTER_SCREEN ; //input dialog location //call Amulet input dialog box - Dialog is Modal GameDate = Am_Get_Input_From_Dialog(prompts, Date().c_str(), xcoor, ycoor, true); if (GameDate == Am_No_Value) //cancel button pressed io_line.Set(Am_TEXT, "Search was cancelled"); else { //convert entered Amulet string to string object char* dstr = GameDate ; string dateString(dstr); if (searchByDate(dateString)) { UpdateAllObjects(); io_line.Set(Am_TEXT, "Matching record(s) found."); } else io_line.Set(Am_TEXT, "No matching records found."); } } return; } /******************************************************************************* // METHOD NAME: about_BAM_do // // DESCRIPTION OF METHOD: Pops up the splash screen // // DESCRIPTION OF ALGORITHM: Uses Am_Pop_Up_Window_And_Wait to display the // splash screen // // INVOKED BY: DoAmuletStuff,my_menu_bar About_Command // CALLS: Am_Pop_Up_Window_And_Wait // // AUTHOR: Amy Langill *2B DATE: 5/1/1999 *******************************************************************************/ Am_Define_Method(Am_Object_Method, void, about_BAM_do, (Am_Object self)) { Am_Object io_line = my_win.Get_Object(IO_PART).Get_Object(MESSAGE_PART); io_line.Set(Am_TEXT, "Left-click the box to continue"); Am_Pop_Up_Window_And_Wait(about_win,Am_No_Value,true); } Am_Define_Method(Am_Object_Method, void, about_win_do, (Am_Object self)) { Am_Finish_Pop_Up_Waiting(about_win, Am_No_Value); Am_Object io_line = my_win.Get_Object(IO_PART).Get_Object(MESSAGE_PART); io_line.Set(Am_TEXT, ""); } /******************************************************************************* // FUNCTION NAME: DoAmuletStuff // // DESCRIPTION OF FUNCTION: Controls the main Amulet execution, calling other // functions to initialize some parts // // CALLED BY: main // CALLS: InitMenus,InitTopFields,InitBottomFields,InitScoresTable, // Am_Initialize, Am_Main_Event_Loop, Am_Cleanup // // PARAMETERS: none // // PRECONDITIONS: none // // POSTCONDITIONS: none // // AUTHOR: Amy Langill *2B DATE: 4/29/1999 *******************************************************************************/ void DoAmuletStuff() { Am_Initialize(); Am_Object my_menu_bar; Am_Object top_fields; Am_Object bottom_fields; Am_Object scores; Am_Object prev_button; Am_Object next_button; Am_Object io_area; Am_Object bitmap; void InitMenus(Am_Object& my_menu_bar); void InitTopFields(Am_Object& fields); void InitBottomFields(Am_Object& fields); void InitScoresTable(Am_Object& scores_table); InitMenus(my_menu_bar); InitTopFields(top_fields); InitBottomFields(bottom_fields); InitScoresTable(scores); my_win = Am_Window.Create("my_window") .Set(Am_LEFT, Am_Center_X_Is_Center_Of_Owner) .Set(Am_TOP, Am_Center_Y_Is_Center_Of_Owner) .Set(Am_WIDTH, 600) .Set(Am_HEIGHT, 400) .Set(Am_TITLE, "Bowling Analysis Manger"); about_win = Am_Window.Create("about_win") .Set(Am_DESTROY_WINDOW_METHOD, Am_Default_Pop_Up_Window_Destroy_Method) .Set(Am_LEFT, Am_Center_X_Is_Center_Of_Owner) .Set(Am_TOP, Am_Center_Y_Is_Center_Of_Owner) .Set(Am_WIDTH, Am_Width_Of_Parts) .Set(Am_HEIGHT, Am_Height_Of_Parts) .Set(Am_FILL_STYLE, Am_Motif_Gray) .Set(Am_TITLE, "About BAM") .Set(Am_VISIBLE, false); bitmap = Am_Bitmap.Create("bitmap") .Set(Am_LEFT, Am_Center_X_Is_Center_Of_Owner) .Set(Am_TOP, Am_Center_Y_Is_Center_Of_Owner); about_win.Add_Part(bitmap); Am_Image_Array image = Am_Image_Array("bamscrn.bmp"); bitmap.Set (Am_IMAGE, image); Am_Object about_win_com = Am_Command.Create() .Set(Am_DO_METHOD, about_win_do); Am_Object about_win_inter = Am_One_Shot_Interactor.Create("about_win_inter") .Set_Part(Am_COMMAND, about_win_com); about_win.Add_Part(about_win_inter); prev_button = Am_Button.Create("prev_button") .Set(Am_LEFT, 80) .Set(Am_TOP, 220) .Set(Am_FILL_STYLE, Am_Motif_Gray) .Get_Object(Am_COMMAND) .Set(Am_LABEL, "Prev") .Set(Am_ACTIVE, true) .Set(Am_DO_METHOD, games_prev_do) .Get_Owner(); next_button = Am_Button.Create("next_button") .Set(Am_LEFT, 80) .Set(Am_TOP, 250) .Set(Am_FILL_STYLE, Am_Motif_Gray) .Get_Object(Am_COMMAND) .Set(Am_LABEL, "Next") .Set(Am_ACTIVE, true) .Set(Am_DO_METHOD, games_next_do) .Get_Owner(); io_area = Am_Group.Create("io_area") .Set(Am_TOP, 320) .Set(Am_LEFT, title_left_formula) .Set(Am_WIDTH, Am_Width_Of_Parts) .Set(Am_HEIGHT, Am_Height_Of_Parts) .Add_Part(BORDER_PART, Am_Rectangle.Create("io_rect") .Set(Am_WIDTH, 504) .Set(Am_HEIGHT, 18) .Set(Am_LINE_STYLE, Am_Motif_Gray) .Set(Am_FILL_STYLE, Am_White)) .Add_Part(MESSAGE_PART, Am_Text.Create("io_text") .Set(Am_LEFT, Am_From_Sibling(BORDER_PART,Am_LEFT,2)) .Set(Am_TOP, Am_From_Sibling(BORDER_PART,Am_TOP,2)) .Set(Am_WIDTH, 500) .Set(Am_HEIGHT, 14) .Set(Am_TEXT, "")); Am_Object title_text = Am_Text.Create("title_text") .Set(Am_LEFT, title_left_formula) .Set(Am_TOP, 40) .Set(Am_TEXT, " BAM: Bowling Analysis Manager ") .Set(Am_FONT, Am_Font(Am_FONT_SERIF, true,false,false,Am_FONT_VERY_LARGE)) .Set(Am_FILL_STYLE, Am_Motif_Gray) .Set(Am_LINE_STYLE, Am_White); my_win.Add_Part(MENU_PART,my_menu_bar); my_win.Add_Part(title_text); my_win.Add_Part(TOP_FIELDS,top_fields); my_win.Add_Part(BOTTOM_FIELDS,bottom_fields); my_win.Add_Part(SCORES,scores); my_win.Add_Part(prev_button); my_win.Add_Part(next_button); my_win.Add_Part(IO_PART,io_area); Am_Screen.Add_Part(about_win); Am_Pop_Up_Window_And_Wait(about_win,Am_No_Value, true); Am_Screen.Add_Part(my_win); UpdateAllObjects(); Am_Main_Event_Loop(); Am_Cleanup(); } /******************************************************************************* // FUNCTION NAME: InitMenus // // DESCRIPTION OF FUNCTION: Creates a menu_bar object with menu options // appropriate for the BAM program // // DESCRIPTION OF ALGORITHM: Uses .Add and .Set to build a series of nested // lists to contain the menu commands. // // CALLED BY: DoAmuletStuff // CALLS: Am_Menu_Bar.Create,.Set,Am_Value_List,.Add,Am_Command.Create, // Am_Menu_Line_Command.Create // // PARAMETERS: / inout / my_menu_bar - Am_Object that is being initialized as // a BAM menu bar // // AUTHOR: Amy Langill *2B DATE: 4/29/1999 *******************************************************************************/ void InitMenus(Am_Object& my_menu_bar) { my_menu_bar = Am_Menu_Bar.Create("my_menu_bar") .Set(Am_FILL_STYLE, Am_Motif_Gray) .Set(Am_ITEMS, Am_Value_List() .Add(Am_Command.Create("File_Command") .Set(Am_LABEL, "File") .Set(Am_IMPLEMENTATION_PARENT, true) .Set(Am_ITEMS, Am_Value_List() .Add(Am_Command.Create("New_Command") .Set(Am_LABEL, "New...") .Set(Am_ACCELERATOR, "^n") .Set(Am_ACTIVE, false) .Set(Am_IMPLEMENTATION_PARENT, true)) .Add(Am_Command.Create("Open_Command") .Set(Am_LABEL, "Open...") .Set(Am_ACCELERATOR, "^o") .Set(Am_ACTIVE, true) .Set(Am_DO_METHOD, file_open_do)) .Add(Am_Menu_Line_Command.Create("my menu line")) .Add(Am_Command.Create("Save_Command") .Set(Am_LABEL, "Save") .Set(Am_ACCELERATOR, "^s") .Set(Am_ACTIVE, false) .Set(Am_IMPLEMENTATION_PARENT, true)) .Add(Am_Command.Create("SaveAs_Command") .Set(Am_LABEL, "Save As...") .Set(Am_ACCELERATOR, "^a") .Set(Am_ACTIVE, true) .Set(Am_DO_METHOD, file_saveas_do)) .Add(Am_Command.Create("Close_Command") .Set(Am_LABEL, "Close") .Set(Am_ACCELERATOR, "^w") .Set(Am_ACTIVE, true) .Set(Am_DO_METHOD, file_close_do)) .Add(Am_Menu_Line_Command.Create("menu line")) .Add(Am_Command.Create("Quit_Command") .Set(Am_LABEL, "Quit") .Set(Am_ACCELERATOR, "^q") .Set(Am_ACTIVE, true) .Set(Am_DO_METHOD, file_quit_do)))) .Add(Am_Command.Create("Edit_Command") .Set(Am_LABEL, "Edit") .Set(Am_IMPLEMENTATION_PARENT, true)) .Add(Am_Command.Create("BAM_Command") .Set(Am_LABEL, "BAM") .Set(Am_IMPLEMENTATION_PARENT, true)) .Add(Am_Command.Create("Games_Command") .Set(Am_LABEL, "Games") .Set(Am_IMPLEMENTATION_PARENT, true) .Set(Am_ITEMS, Am_Value_List() .Add(Am_Command.Create("First_Command") .Set(Am_LABEL, "First") .Set(Am_ACCELERATOR, "^1") .Set(Am_ACTIVE, true) .Set(Am_DO_METHOD, games_first_do)) .Add(Am_Command.Create("Prev_Command") .Set(Am_LABEL, "Prev") .Set(Am_ACCELERATOR, "^2") .Set(Am_ACTIVE, true) .Set(Am_DO_METHOD, games_prev_do)) .Add(Am_Command.Create("Next_Command") .Set(Am_LABEL, "Next") .Set(Am_ACCELERATOR, "^3") .Set(Am_ACTIVE, true) .Set(Am_DO_METHOD, games_next_do)) .Add(Am_Command.Create("Last_Command") .Set(Am_LABEL, "Last") .Set(Am_ACCELERATOR, "^4") .Set(Am_ACTIVE, true) .Set(Am_DO_METHOD, games_last_do)))) .Add(Am_Command.Create("Search_Command") .Set(Am_LABEL, "Search") .Set(Am_IMPLEMENTATION_PARENT, true) .Set(Am_ITEMS, Am_Value_List() .Add(Am_Command.Create("Alley_Command") .Set(Am_LABEL, "Alley...") .Set(Am_ACCELERATOR, "^l") .Set(Am_ACTIVE, true) .Set(Am_DO_METHOD, search_alley_do)) .Add(Am_Command.Create("Event_Command") .Set(Am_LABEL, "Event...") .Set(Am_ACCELERATOR, "^e") .Set(Am_ACTIVE, true) .Set(Am_DO_METHOD, search_event_do)) .Add(Am_Command.Create("Date_Command") .Set(Am_LABEL, "Date...") .Set(Am_ACCELERATOR, "^d") .Set(Am_ACTIVE, true) .Set(Am_DO_METHOD, search_date_do)))) .Add(Am_Command.Create("Help_Command") .Set(Am_LABEL, "Help") .Set(Am_IMPLEMENTATION_PARENT, true) .Set(Am_ITEMS, Am_Value_List() .Add(Am_Command.Create("Manual_Command") .Set(Am_LABEL, "Manual") .Set(Am_ACCELERATOR, "^m") .Set(Am_ACTIVE, false) .Set(Am_IMPLEMENTATION_PARENT, true)) .Add(Am_Menu_Line_Command.Create("third line")) .Add(Am_Command.Create("About_Command") .Set(Am_LABEL, "About BAM") .Set(Am_ACTIVE, true) .Set(Am_DO_METHOD, about_BAM_do))))); } /******************************************************************************* // FUNCTION NAME: InitBottomFields // // DESCRIPTION OF FUNCTION: Creates a group of 3 text fields with borders // // DESCRIPTION OF ALGORITHM: Uses Amulet Group macros to create the group // // CALLED BY: DoAmuletStuff // // PARAMETERS: / inout / fields - Am_Object that is being initialized // // AUTHOR: Amy Langill *2B DATE: 4/30/1999 *******************************************************************************/ void InitBottomFields(Am_Object& fields) { fields = Am_Group.Create("bottom_fields") .Set(Am_TOP, 140) .Set(Am_LEFT, center_formula) .Set(Am_HEIGHT, LINE_HEIGHT) .Set(Am_WIDTH,Am_Width_Of_Parts) .Add_Part(LEFT_FIELD, Am_Group.Create("left_field") .Set(Am_WIDTH, Am_Width_Of_Parts) .Set(Am_HEIGHT, LINE_HEIGHT) .Add_Part(LABEL_PART, Am_Text.Create("rect_label") .Set(Am_TOP, BORDER_OFFSET) .Set(Am_TEXT, " Ball:") .Set(Am_WIDTH, SIX_CHAR) .Set(Am_HEIGHT,FIELD_HEIGHT)) .Add_Part(RECT_PART, Am_Rectangle.Create("my_rectangle") .Set(Am_LINE_STYLE,Am_Motif_Gray) .Set(Am_FILL_STYLE,Am_White) .Set(Am_HEIGHT, Am_From_Owner(Am_HEIGHT)) .Set(Am_WIDTH, Am_From_Sibling(TEXT_PART,Am_WIDTH,BORDER_WIDTH)) .Set(Am_LEFT, Am_From_Sibling(LABEL_PART,Am_WIDTH,BORDER_OFFSET))) .Add_Part(TEXT_PART, Am_Text.Create("rect_text") .Set(Am_TEXT, "") .Set(Am_TOP, BORDER_OFFSET) .Set(Am_LEFT, Am_From_Sibling(RECT_PART,Am_LEFT,BORDER_OFFSET)) .Set(Am_WIDTH, TWENTY_CHAR) .Set(Am_HEIGHT,FIELD_HEIGHT))) .Add_Part(CENTER_FIELD, Am_Group.Create("center_field") .Set(Am_WIDTH, Am_Width_Of_Parts) .Set(Am_LEFT, Am_From_Sibling(LEFT_FIELD,Am_WIDTH,BETWEEN_FIELDS)) .Set(Am_HEIGHT, LINE_HEIGHT) .Add_Part(LABEL_PART, Am_Text.Create("center_label") .Set(Am_TOP, BORDER_OFFSET) .Set(Am_TEXT, "Lift:") .Set(Am_HEIGHT, FIELD_HEIGHT)) .Add_Part(RECT_PART, Am_Rectangle.Create("center_rect") .Set(Am_LINE_STYLE, Am_Motif_Gray) .Set(Am_FILL_STYLE, Am_White) .Set(Am_HEIGHT, Am_From_Owner(Am_HEIGHT)) .Set(Am_WIDTH, Am_From_Sibling(TEXT_PART,Am_WIDTH,BORDER_WIDTH)) .Set(Am_LEFT, Am_From_Sibling(LABEL_PART,Am_WIDTH,BETWEEN_FIELDS))) .Add_Part(TEXT_PART, Am_Text.Create("center_text") .Set(Am_TEXT, "") .Set(Am_TOP, BORDER_OFFSET) .Set(Am_LEFT, Am_From_Sibling(RECT_PART,Am_LEFT,BORDER_OFFSET)) .Set(Am_WIDTH, SIX_CHAR) .Set(Am_HEIGHT, FIELD_HEIGHT))) .Add_Part(RIGHT_FIELD, Am_Group.Create("right_field") .Set(Am_WIDTH, Am_Width_Of_Parts) .Set(Am_LEFT, Am_From_Sibling(CENTER_FIELD,Am_WIDTH,200)) .Set(Am_HEIGHT, LINE_HEIGHT) .Add_Part(LABEL_PART, Am_Text.Create("right_label") .Set(Am_TOP, BORDER_OFFSET) .Set(Am_TEXT, "Conditions:") .Set(Am_HEIGHT, FIELD_HEIGHT) .Set(Am_WIDTH, (11*CHAR_WIDTH))) .Add_Part(RECT_PART, Am_Rectangle.Create("right_rect") .Set(Am_LINE_STYLE, Am_Motif_Gray) .Set(Am_FILL_STYLE, Am_White) .Set(Am_HEIGHT, LINE_HEIGHT) .Set(Am_WIDTH, Am_From_Sibling(TEXT_PART,Am_WIDTH,BORDER_WIDTH)) .Set(Am_LEFT, Am_From_Sibling(LABEL_PART,Am_WIDTH,BORDER_OFFSET))) .Add_Part(TEXT_PART, Am_Text.Create("right_text") .Set(Am_TEXT, "") .Set(Am_TOP, BORDER_OFFSET) .Set(Am_LEFT, Am_From_Sibling(RECT_PART,Am_LEFT, BORDER_OFFSET)) .Set(Am_HEIGHT, FIELD_HEIGHT) .Set(Am_WIDTH, SEVEN_CHAR))); } /******************************************************************************* // FUNCTION NAME: InitTopFields // // DESCRIPTION OF FUNCTION: Creates a group of 3 text fields with borders // // DESCRIPTION OF ALGORITHM: Uses Amulet Group macros to create the group // // CALLED BY: DoAmuletStuff // // PARAMETERS: / inout / fields - Am_Object that is being initialized // // AUTHOR: Amy Langill *2B DATE: 4/30/1999 *******************************************************************************/ void InitTopFields(Am_Object& fields) { fields = Am_Group.Create("top_fields") .Set(Am_TOP, 100) .Set(Am_LEFT, center_formula) .Set(Am_HEIGHT, LINE_HEIGHT) .Set(Am_WIDTH,Am_Width_Of_Parts) .Add_Part(LEFT_FIELD, Am_Group.Create("left_field") .Set(Am_WIDTH, Am_Width_Of_Parts) .Set(Am_HEIGHT, LINE_HEIGHT) .Add_Part(LABEL_PART, Am_Text.Create("rect_label") .Set(Am_TOP, BORDER_OFFSET) .Set(Am_TEXT, "Alley:") .Set(Am_HEIGHT,FIELD_HEIGHT)) .Add_Part(RECT_PART, Am_Rectangle.Create("my_rectangle") .Set(Am_LINE_STYLE,Am_Motif_Gray) .Set(Am_FILL_STYLE,Am_White) .Set(Am_HEIGHT, LINE_HEIGHT) .Set(Am_WIDTH, 144) .Set(Am_LEFT, 50)) .Add_Part(TEXT_PART, Am_Text.Create("rect_text") .Set(Am_TEXT, "") .Set(Am_TOP, 2) .Set(Am_LEFT, 52) .Set(Am_WIDTH, 140) .Set(Am_HEIGHT,14))) .Add_Part(CENTER_FIELD, Am_Group.Create("center_field") .Set(Am_WIDTH, 194) .Set(Am_LEFT, 200) .Set(Am_HEIGHT, Am_From_Owner(Am_HEIGHT)) .Add_Part(LABEL_PART, Am_Text.Create("center_label") .Set(Am_TOP, 2) .Set(Am_TEXT, "Event:") .Set(Am_HEIGHT, 14)) .Add_Part(RECT_PART, Am_Rectangle.Create("center_rect") .Set(Am_LINE_STYLE, Am_Motif_Gray) .Set(Am_FILL_STYLE, Am_White) .Set(Am_HEIGHT, Am_From_Owner(Am_HEIGHT)) .Set(Am_WIDTH, 144) .Set(Am_LEFT, 50)) .Add_Part(TEXT_PART, Am_Text.Create("center_text") .Set(Am_TEXT, "") .Set(Am_TOP, 2) .Set(Am_LEFT, 52) .Set(Am_WIDTH, 140) .Set(Am_HEIGHT, 14))) .Add_Part(RIGHT_FIELD, Am_Group.Create("right_field") .Set(Am_WIDTH, 110) .Set(Am_LEFT, 400) .Set(Am_HEIGHT, Am_From_Owner(Am_HEIGHT)) .Add_Part(LABEL_PART, Am_Text.Create("right_label") .Set(Am_TOP, 2) .Set(Am_TEXT, "Date:") .Set(Am_HEIGHT, 14)) .Add_Part(RECT_PART, Am_Rectangle.Create("right_rect") .Set(Am_LINE_STYLE, Am_Motif_Gray) .Set(Am_FILL_STYLE, Am_White) .Set(Am_HEIGHT, Am_From_Owner(Am_HEIGHT)) .Set(Am_WIDTH, 68) .Set(Am_LEFT, Am_From_Sibling(LABEL_PART,Am_WIDTH,6))) .Add_Part(TEXT_PART, Am_Text.Create("right_text") .Set(Am_TEXT, "") .Set(Am_TOP, 2) .Set(Am_LEFT, Am_From_Sibling(RECT_PART,Am_LEFT, 2)) .Set(Am_HEIGHT, 14) .Set(Am_WIDTH, 56))); } /******************************************************************************* // FUNCTION NAME: InitScoresTable // // DESCRIPTION OF FUNCTION: Creates an Amulet Group object for displaying the // scores of a bowling game // // DESCRIPTION OF ALGORITHM: Uses Am_Group.Set and Am_Group.Add_Part commands // to build up a table-like structure // // CALLED BY: DoAmuletStuff // // PARAMETERS: / inout / scores_table - Am_Object being intialized into this // weird form // // AUTHOR: Amy Langill *2B DATE: 4/30/1999 *******************************************************************************/ void InitScoresTable(Am_Object& scores_table) { int CELL_WIDTH=40; int CELL_HEIGHT=30; int INNER_LEFT=10; int INNER_WIDTH=38; int INNER_HEIGHT=26; int LABEL_HEIGHT=16; int INIT_LEFT=150; int COLUMN_HEIGHT=76; Am_Object text_part = Am_Text.Create("text_part") .Set(Am_WIDTH, INNER_WIDTH) .Set(Am_HEIGHT, INNER_HEIGHT) .Set(Am_TEXT, ""); Am_Object border_part = Am_Rectangle.Create("border_part") .Set(Am_WIDTH, CELL_WIDTH) .Set(Am_HEIGHT,CELL_HEIGHT) .Set(Am_LINE_STYLE, Am_Motif_Gray) .Set(Am_FILL_STYLE, Am_White); Am_Object mark_text = text_part.Create("mark_text") .Set(Am_FONT, Am_Font(Am_FONT_FIXED,true,false,false,Am_FONT_MEDIUM)); Am_Object table_cell = Am_Group.Create("table_cell") .Set(Am_WIDTH, CELL_WIDTH) .Set(Am_HEIGHT, CELL_WIDTH) .Add_Part(BORDER_RECT, border_part.Create("border_rect")); Am_Object label_cell = Am_Text.Create("label_cell") .Set(Am_WIDTH, CELL_WIDTH) .Set(Am_HEIGHT, LABEL_HEIGHT); Am_Object mark_cell = table_cell.Create("mark_cell") .Add_Part(DATA_PART,mark_text.Create("mark_text") .Set(Am_TOP, Am_From_Sibling(BORDER_PART,Am_TOP,10)) .Set(Am_LEFT, Am_From_Sibling(BORDER_PART,Am_LEFT,INNER_LEFT))); Am_Object score_cell = table_cell.Create("score_cell") .Add_Part(DATA_PART,text_part.Create("score_text") .Set(Am_TOP, Am_From_Sibling(BORDER_RECT,Am_TOP,10)) .Set(Am_LEFT, Am_From_Sibling(BORDER_RECT,Am_LEFT,INNER_LEFT))); Am_Object table_column = Am_Group.Create("table_column") .Set(Am_WIDTH, CELL_WIDTH) .Set(Am_HEIGHT, COLUMN_HEIGHT); scores_table = Am_Group.Create("scores_table") .Set(Am_TOP, 200) .Set(Am_LEFT, INIT_LEFT) .Set(Am_WIDTH, Am_Width_Of_Parts) .Set(Am_HEIGHT,Am_Height_Of_Parts) .Add_Part(FRAME_1, table_column.Create("frame_1") .Add_Part(LABEL_ROW, label_cell.Create("label_1") .Set(Am_TEXT, " 1")) .Add_Part(MARKS_ROW, mark_cell.Create("mark_1") .Set(Am_TOP, LABEL_HEIGHT)) .Add_Part(SCORE_ROW, score_cell.Create("score_1") .Set(Am_TOP, CELL_HEIGHT+LABEL_HEIGHT))) .Add_Part(FRAME_2, table_column.Create("frame_2") .Set(Am_LEFT, CELL_WIDTH) .Add_Part(LABEL_ROW, label_cell.Create("label_2") .Set(Am_TEXT, " 2")) .Add_Part(MARKS_ROW, mark_cell.Create("mark_2") .Set(Am_TOP, LABEL_HEIGHT)) .Add_Part(SCORE_ROW, score_cell.Create("score_2") .Set(Am_TOP, LABEL_HEIGHT+CELL_HEIGHT))) .Add_Part(FRAME_3, table_column.Create("frame_3") .Set(Am_LEFT, CELL_WIDTH*2) .Add_Part(LABEL_ROW, label_cell.Create("label_3") .Set(Am_TEXT, " 3")) .Add_Part(MARKS_ROW, mark_cell.Create("mark_3") .Set(Am_TOP, LABEL_HEIGHT)) .Add_Part(SCORE_ROW, score_cell.Create("score_3") .Set(Am_TOP, LABEL_HEIGHT+CELL_HEIGHT))) .Add_Part(FRAME_4, table_column.Create("frame_4") .Set(Am_LEFT, CELL_WIDTH*3) .Add_Part(LABEL_ROW, label_cell.Create("label_4") .Set(Am_TEXT, " 4")) .Add_Part(MARKS_ROW, mark_cell.Create("mark_4") .Set(Am_TOP, LABEL_HEIGHT)) .Add_Part(SCORE_ROW, score_cell.Create("score_4") .Set(Am_TOP, LABEL_HEIGHT+CELL_HEIGHT))) .Add_Part(FRAME_5, table_column.Create("frame_5") .Set(Am_LEFT, CELL_WIDTH*4) .Add_Part(LABEL_ROW, label_cell.Create("label_5") .Set(Am_TEXT, " 5")) .Add_Part(MARKS_ROW, mark_cell.Create("mark_5") .Set(Am_TOP, LABEL_HEIGHT)) .Add_Part(SCORE_ROW, score_cell.Create("score_5") .Set(Am_TOP, LABEL_HEIGHT+CELL_HEIGHT))) .Add_Part(FRAME_6, table_column.Create("frame_6") .Set(Am_LEFT, CELL_WIDTH*5) .Add_Part(LABEL_ROW, label_cell.Create("label_6") .Set(Am_TEXT, " 6")) .Add_Part(MARKS_ROW, mark_cell.Create("mark_6") .Set(Am_TOP, LABEL_HEIGHT)) .Add_Part(SCORE_ROW, score_cell.Create("score_6") .Set(Am_TOP, LABEL_HEIGHT+CELL_HEIGHT))) .Add_Part(FRAME_7, table_column.Create("frame_7") .Set(Am_LEFT, CELL_WIDTH*6) .Add_Part(LABEL_ROW, label_cell.Create("label_7") .Set(Am_TEXT, " 7")) .Add_Part(MARKS_ROW, mark_cell.Create("mark_7") .Set(Am_TOP, LABEL_HEIGHT)) .Add_Part(SCORE_ROW, score_cell.Create("score_5") .Set(Am_TOP, LABEL_HEIGHT+CELL_HEIGHT))) .Add_Part(FRAME_8, table_column.Create("frame_8") .Set(Am_LEFT, CELL_WIDTH*7) .Add_Part(LABEL_ROW, label_cell.Create("label_8") .Set(Am_TEXT, " 8")) .Add_Part(MARKS_ROW, mark_cell.Create("mark_8") .Set(Am_TOP, LABEL_HEIGHT)) .Add_Part(SCORE_ROW, score_cell.Create("score_8") .Set(Am_TOP, LABEL_HEIGHT+CELL_HEIGHT))) .Add_Part(FRAME_9, table_column.Create("frame_9") .Set(Am_LEFT, CELL_WIDTH*8) .Add_Part(LABEL_ROW, label_cell.Create("label_9") .Set(Am_TEXT, " 9")) .Add_Part(MARKS_ROW, mark_cell.Create("mark_9") .Set(Am_TOP, LABEL_HEIGHT)) .Add_Part(SCORE_ROW, score_cell.Create("score_9") .Set(Am_TOP, LABEL_HEIGHT+CELL_HEIGHT))) .Add_Part(FRAME_10, table_column.Create("frame_10") .Set(Am_LEFT, CELL_WIDTH*9) .Add_Part(LABEL_ROW, label_cell.Create("label_10") .Set(Am_TEXT, " 10")) .Add_Part(MARKS_ROW, mark_cell.Create("mark_10") .Set(Am_TOP, LABEL_HEIGHT)) .Add_Part(SCORE_ROW, score_cell.Create("score_10") .Set(Am_TOP, LABEL_HEIGHT+CELL_HEIGHT))); return; } /******************************************************************************* // FUNCTION NAME: UpdateAllObjects // // DESCRIPTION OF FUNCTION: Sets the text of each of the display fields to the // appropriate current value for that field. // // DESCRIPTION OF ALGORITHM: References each part to be updated, then uses // .Set(Am_TEXT) with a driver function specifying what the text should be set // to // // CALLED BY: DoAmuletStuff // CALLS: Alley,Event,Date,Ball,Lift,Conditions,Mark_1,Score_1,Mark_2,Score_2, // Mark_3,Score_3,Mark_4,Score_4,Mark_5,Score_5,Mark_6,Score_6,Mark_7,Score_7, // Mark_8,Score_8,Mark_9,Score_9,Mark_10,Score_10 // // PARAMETERS: none // // AUTHOR: Amy Langill *2B DATE: 4/30/1999 *******************************************************************************/ void UpdateAllObjects() { my_win.Get_Object(TOP_FIELDS).Get_Object(LEFT_FIELD).Get_Object(TEXT_PART) .Set(Am_TEXT, (Alley().c_str())); my_win.Get_Object(TOP_FIELDS).Get_Object(CENTER_FIELD).Get_Object(TEXT_PART) .Set(Am_TEXT, (Event().c_str())); my_win.Get_Object(TOP_FIELDS).Get_Object(RIGHT_FIELD).Get_Object(TEXT_PART) .Set(Am_TEXT, (Date().c_str())); my_win.Get_Object(BOTTOM_FIELDS).Get_Object(LEFT_FIELD).Get_Object(TEXT_PART) .Set(Am_TEXT, (Ball().c_str())); my_win.Get_Object(BOTTOM_FIELDS).Get_Object(CENTER_FIELD).Get_Object(TEXT_PART) .Set(Am_TEXT, (Lift().c_str())); my_win.Get_Object(BOTTOM_FIELDS).Get_Object(RIGHT_FIELD).Get_Object(TEXT_PART) .Set(Am_TEXT, (Conditions().c_str())); my_win.Get_Object(SCORES).Get_Object(FRAME_1).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, (Mark_1().c_str())) .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, (Score_1().c_str())); my_win.Get_Object(SCORES).Get_Object(FRAME_2).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, (Mark_2().c_str())) .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, (Score_2().c_str())); my_win.Get_Object(SCORES).Get_Object(FRAME_3).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, (Mark_3().c_str())) .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, (Score_3().c_str())); my_win.Get_Object(SCORES).Get_Object(FRAME_4).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, (Mark_4().c_str())) .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, (Score_4().c_str())); my_win.Get_Object(SCORES).Get_Object(FRAME_5).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, (Mark_5().c_str())) .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, (Score_5().c_str())); my_win.Get_Object(SCORES).Get_Object(FRAME_6).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, (Mark_6().c_str())) .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, (Score_6().c_str())); my_win.Get_Object(SCORES).Get_Object(FRAME_7).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, (Mark_7().c_str())) .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, (Score_7().c_str())); my_win.Get_Object(SCORES).Get_Object(FRAME_8).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, (Mark_8().c_str())) .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, (Score_8().c_str())); my_win.Get_Object(SCORES).Get_Object(FRAME_9).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, (Mark_9().c_str())) .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, (Score_9().c_str())); my_win.Get_Object(SCORES).Get_Object(FRAME_10).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, (Mark_10().c_str())) .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, (Score_10().c_str())); return; } /******************************************************************************* // FUNCTION NAME: ClearAllObjects // // DESCRIPTION OF FUNCTION: Sets the text of each of the display fields to a // blank string // // DESCRIPTION OF ALGORITHM: For each display field, uses .Set(Am_TEXT,"") to // set the text to a NULL value // // CALLED BY: DoAmuletStuff // // PARAMETERS: none // // AUTHOR: Amy Langill *2B DATE: 4/30/1999 *******************************************************************************/ void ClearAllObjects() { my_win.Get_Object(TOP_FIELDS).Get_Object(LEFT_FIELD).Get_Object(TEXT_PART) .Set(Am_TEXT, ""); my_win.Get_Object(TOP_FIELDS).Get_Object(CENTER_FIELD).Get_Object(TEXT_PART) .Set(Am_TEXT, ""); my_win.Get_Object(TOP_FIELDS).Get_Object(RIGHT_FIELD).Get_Object(TEXT_PART) .Set(Am_TEXT, ""); my_win.Get_Object(BOTTOM_FIELDS).Get_Object(LEFT_FIELD).Get_Object(TEXT_PART) .Set(Am_TEXT, ""); my_win.Get_Object(BOTTOM_FIELDS).Get_Object(CENTER_FIELD).Get_Object(TEXT_PART) .Set(Am_TEXT, ""); my_win.Get_Object(BOTTOM_FIELDS).Get_Object(RIGHT_FIELD).Get_Object(TEXT_PART) .Set(Am_TEXT, ""); my_win.Get_Object(SCORES).Get_Object(FRAME_1).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, "") .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, ""); my_win.Get_Object(SCORES).Get_Object(FRAME_2).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, "") .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, ""); my_win.Get_Object(SCORES).Get_Object(FRAME_3).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, "") .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, ""); my_win.Get_Object(SCORES).Get_Object(FRAME_4).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, "") .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, ""); my_win.Get_Object(SCORES).Get_Object(FRAME_5).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, "") .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, ""); my_win.Get_Object(SCORES).Get_Object(FRAME_6).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, "") .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, ""); my_win.Get_Object(SCORES).Get_Object(FRAME_7).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, "") .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, ""); my_win.Get_Object(SCORES).Get_Object(FRAME_8).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, "") .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, ""); my_win.Get_Object(SCORES).Get_Object(FRAME_9).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, "") .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, ""); my_win.Get_Object(SCORES).Get_Object(FRAME_10).Get_Object(MARKS_ROW) .Get_Object(DATA_PART).Set(Am_TEXT, "") .Get_Owner().Get_Owner().Get_Object(SCORE_ROW).Get_Object(DATA_PART) .Set(Am_TEXT, ""); my_win.Get_Object(IO_PART).Get_Object(MESSAGE_PART).Set(Am_TEXT, ""); return; }