Virtual U.org
Get Personal Training on VU Today
    
Top shadow
 
 register/help
User Name:

Password:

Odept_if.cpp Source File
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Odept_if.cpp

Go to the documentation of this file.
00001 //Filename    : ODEPT_IF.CPP
00002 //Description : Modeling_academic (Modeling_academic Operation) class
00003 // owner                        : Kevin(Ho)
00004 // Notes:       Steps to introduce a new class of user interface
00005 //                              1.      construct the new class
00006 //                              2.      in sys.h, add the new MODE, e.g. MODE_ADMISSIONS_AND_FINANCIAL_OFFICE
00007 //                              3.      include the new header file in cc.cpp, osysdisp.cpp, osysdet.cpp
00008 //                              4.      in cc.cpp, declare a global object of the new class, with the name matching the 'extern' statement in the header file
00009 //                              5.      in osysdisp.cpp, under switch(view_mode), add the redirection to the display function
00010 //                              6.      in osysdet.cpp, under Sys::detect_view, add the redirection to the detect function
00011 //                              7.      in osysdet.cpp, under Sys::process_key, add the new hot key (optional)
00012 //                              8.      in osysdet.cpp, under Sys::detect_button, modify if necessary (see the comments there)
00013 //                              9.      the deinit function (AdmOffice::deinit()) can be called when the view_mode in 'sys' object is switched
00014 //                                      the function frees memory occupied by this object
00015 //                                      the report function would re-allocate memory when it is called (note the init_flag)
00016 //                                      notice the beginning section of Sys::disp_frame()
00017 // Kevin 0811
00018 
00019 #include <OSYS.H>
00020 #include <OSTR.H>
00021 #include <OMISC.H>
00022 #include <OGAMESET.H>
00023 #include <OWORLDMT.H>
00024 #include <ODEPT.H>
00025 #include <OVGA.H>
00026 #include <OIFACE.H>
00027 #include <OINFO.H>
00028 #include <COLOR.H>
00029 #include <OFONT.H>
00030 #include <OGAMESTR.H>
00031 #include <OMOUSE.H>
00032 #include <OBUTTON.H>
00033 #include <OTEXT.H>
00034 #include <OHELPIF.H>
00035 #include <OGRPHYR.H>
00036 #include <OGRPHMTH.H>
00037 #include <OGRPHTRI.H>
00038 #include <OGRPNFYR.H>
00039 #include <OGRPNFM.H>
00040 #include <OGRPNFT.H>
00041 #include <OGRPH_PY.H>
00042 #include <OGRPH_PT.H>
00043 #include <OGRPH_PM.H>
00044 #include <ORESTXT.H>
00045 #include <OVBROW98.H>
00046 #include <OVGALOCK.H>
00047 #include <OPRINT.H>
00048 #include <ODATE.H>
00049 #include <OPSCHOOL.H>
00050 #include <OAUDIO.H>
00051 #include <OCONFIG.H>
00052 
00053 //----------------- Departmental academic standing --------------------//
00054 //-------------------- Main screen Configuration ----------------------//
00055 
00056 enum {                                            // the bg image id
00057     BG_PIC_ID = 11
00058 };
00059 
00060 enum {                                            // screen coordinates
00061     REPORT_X1 = ZOOM_X1+15,
00062     REPORT_Y1 = ZOOM_Y1+25,
00063     REPORT_X2 = ZOOM_X2-15,
00064     REPORT_Y2 = ZOOM_Y2-25
00065 };
00066 
00067 enum {
00068     BUTTON_WIDTH = 50,
00069     BUTTON_HEIGHT = 25,
00070     BUTTON_DIST = 230,
00071     BUTTON_VDIST = 170
00072 };
00073 
00074 enum {
00075     MODE_DEPT_GRAPH_WIDTH = 215,
00076     MODE_DEPT_GRAPH_HEIGHT = 120,
00077 
00078     MODE_DEPT_TAB0 = 15,
00079     MODE_DEPT_TAB1 = 245,
00080     MODE_DEPT_TAB2 = 475,
00081     MODE_DEPT_TAB3 = 705,
00082 
00083     MODE_DEPT_VTAB1 = 10,
00084     MODE_DEPT_VTAB2 = 163,
00085     MODE_DEPT_VTAB3 = 397,
00086 };
00087 
00088 enum {
00089     MODE_INSTITUTION  = 0,
00090     MODE_DEPARTMENT = 1,
00091     MODE_RANK     = 2,
00092 };
00093 
00094 static Button help_button_array[9];
00095 static Button mode_dept_button[15];
00096 static short *mode_dept_button_up_bitmap[15];
00097 static short *mode_dept_button_down_bitmap[15];
00098 /*
00099 static GraphTrimester mode_dept_graph0;
00100 static GraphYear mode_dept_graph1;
00101 static GraphTrimester mode_dept_graph2;
00102 static GraphMonth mode_dept_graph3;
00103 static GraphMonth mode_dept_graph4;
00104 static GraphYear mode_dept_graph5;
00105 */
00106 static GraphNonFinancialTrimester mode_dept_graph0;
00107 static GraphNonFinancialYear mode_dept_graph1;
00108 static GraphNonFinancialTrimester mode_dept_graph2;
00109 static GraphNonFinancialMonth mode_dept_graph3;
00110 static GraphNonFinancialMonth mode_dept_graph4;
00111 static GraphNonFinancialYear mode_dept_graph5;
00112 
00113 static char *mode_dept_title = "Academic Operations";
00114 static char *mode_dept_str[] = {
00115     "Educational quality",
00116     "Departmental prestige",
00117     "Student morale",
00118     "Faculty research performance",
00119     "Faculty morale",
00120     "Faculty diversity index",
00121 };
00122 
00123 static char report_init_flag = 0;
00124 //------------------------------------------------------------------//
00125 
00126 //-------------------- sub-windows Configuration ----------------------//
00127 
00128 enum {
00129     MODE_DEPT_MAIN = 0,
00130     MODE_DEPT_EDUCATIONAL_QUALITY=1,
00131     MODE_DEPT_DEPARTMENTAL_ACADEMIC_STANDING=2,
00132     MODE_DEPT_STUDENT_MORALE=3,
00133     MODE_DEPT_FACULTY_RESEARCH_PERFORMANCE=4,
00134     MODE_DEPT_FACULTY_MORALE=5,
00135     MODE_DEPT_FACULTY_DIVERSITY_INDEX=6,
00136     MODE_DEPT_EDUCATIONAL_QUALITY2=7,
00137     MODE_DEPT_RANK=8,
00138 };
00139 
00140 //-------- define static functions ------//
00141 
00142 // Notes:       the deinit_x functions should deallocate memory used by the
00143 //                              GraphA, ValueSlider, RadioButton, etc. objects
00144 //                              the functions are called when a mode-switching is triggered
00145 //      Norris 0716
00146 
00147 static void report_main(int);
00148 static void report_educational_quality(int);
00149 static void report_educational_quality2(int);
00150 static void report_departmental_academic(int);
00151 static void report_student_morale(int);
00152 static void report_faculty_research_preformance(int);
00153 static void report_faculty_morale(int);
00154 static void report_diversity_index(int);
00155 static void report_rank(int);
00156 
00157 static int detect_main();
00158 static int detect_main2();
00159 static int detect_educational_quality();
00160 static int detect_educational_quality2();
00161 static int detect_departmental_academic();
00162 static int detect_student_morale();
00163 static int detect_faculty_research_preformance();
00164 static int detect_faculty_morale();
00165 static int detect_diversity_index();
00166 static int detect_rank();
00167 
00168 static void deinit_main();
00169 static void deinit_educational_quality();
00170 static void deinit_educational_quality2();
00171 static void deinit_departmental_academic();
00172 static void deinit_student_morale();
00173 static void deinit_faculty_research_preformance();
00174 static void deinit_faculty_morale();
00175 static void deinit_diversity_index();
00176 static void deinit_rank();
00177 
00178 static void eq_disp_rep_row(int recNo, int x, int y, int refreshFlag);
00179 static void da_disp_rep_row(int recNo, int x, int y, int refreshFlag);
00180 static void sm_disp_rep_row(int recNo, int x, int y, int refreshFlag);
00181 static void fp_disp_rep_row(int recNo, int x, int y, int refreshFlag);
00182 static void fm_disp_rep_row(int recNo, int x, int y, int refreshFlag);
00183 static void di_disp_rep_row(int recNo, int x, int y, int refreshFlag);
00184 static void rk_disp_rep_row(int recNo, int x, int y, int refreshFlag);
00185 
00186 typedef void (*ReportFP)(int refreshFlag);
00187 typedef int (*DetectFP)();
00188 typedef void (*DeinitFP)();
00189 
00190 static ReportFP report_func_ptr[] = {
00191     &report_main,
00192     &report_educational_quality,
00193     &report_departmental_academic,
00194     &report_student_morale,
00195     &report_faculty_research_preformance,
00196     &report_faculty_morale,
00197     &report_diversity_index,
00198     &report_educational_quality2,
00199     &report_rank,
00200 };
00201 
00202 static DetectFP detect_func_ptr[] = {
00203     &detect_main,
00204     &detect_educational_quality,
00205     &detect_departmental_academic,
00206     &detect_student_morale,
00207     &detect_faculty_research_preformance,
00208     &detect_faculty_morale,
00209     &detect_diversity_index,
00210     &detect_educational_quality2,
00211     &detect_rank,
00212 };
00213 
00214 static DeinitFP deinit_func_ptr[] = {
00215     &deinit_main,
00216     &deinit_educational_quality,
00217     &deinit_departmental_academic,
00218     &deinit_student_morale,
00219     &deinit_faculty_research_preformance,
00220     &deinit_faculty_morale,
00221     &deinit_diversity_index,
00222     &deinit_educational_quality2,
00223     &deinit_rank,
00224 };
00225 
00226 void Department::set_report_init_flag(int flag) {
00227     report_init_flag=flag;
00228 }
00229 
00230 //-------- Begin of function Department::main_report ---------//
00232 void Department::main_report(int refreshFlag) {
00233     (*report_func_ptr[department_array.current_screen_mode])(refreshFlag);
00234 }
00235 
00236 void Department::main_report_deinit() {
00237 
00238     //  (*deinit_func_ptr[department_array.current_screen_mode])();
00239 
00240     for(int i=0;i<9;i++)
00241         (*deinit_func_ptr[i])();
00242 
00243     report_init_flag = 0;
00244 }
00245 
00246 int Department::main_report_detect() {
00247     return (*detect_func_ptr[department_array.current_screen_mode])();
00248 }
00249 
00250 //-------- End of function Department::main_report ---------//
00251 
00252 //-------- Begin of function deinit_main ---------//
00254 void deinit_main() {
00255     if (report_init_flag==0)return;
00256 
00257     //--------- deallocate memory -------------//
00258     if (mode_dept_button_up_bitmap[0]) {
00259         for(int k=0;k<2;k++) {
00260             // ##### begin Gilbert 25/04/2001 ######//
00261             mode_dept_button[k].deinit();
00262             // ##### end Gilbert 25/04/2001 ######//
00263             mem_del(mode_dept_button_up_bitmap[k]);
00264             mem_del(mode_dept_button_down_bitmap[k]);
00265             mode_dept_button_up_bitmap[k] = NULL;
00266             mode_dept_button_down_bitmap[k] = NULL;
00267         }
00268     }
00269     if (mode_dept_button_up_bitmap[6]) {
00270         for(int k=6;k<15;k++) {
00271             // ##### begin Gilbert 25/04/2001 ######//
00272             mode_dept_button[k].deinit();
00273             // ##### end Gilbert 25/04/2001 ######//
00274             mem_del(mode_dept_button_up_bitmap[k]);
00275             mem_del(mode_dept_button_down_bitmap[k]);
00276             mode_dept_button_up_bitmap[k] = NULL;
00277             mode_dept_button_down_bitmap[k] = NULL;
00278         }
00279     }
00280     if (report_init_flag) {
00281         mode_dept_graph0.deinit();
00282         mode_dept_graph1.deinit();
00283         mode_dept_graph2.deinit();
00284         mode_dept_graph3.deinit();
00285         mode_dept_graph4.deinit();
00286         mode_dept_graph5.deinit();
00287     }
00288 
00289     if(department_array.current_screen_mode>0)
00290         (*deinit_func_ptr[department_array.current_screen_mode])();
00291     report_init_flag=0;
00292 }
00293 
00294 //
00295 //-------- End of function deinit_main ---------//
00296 
00297 //-------- Begin of function Department::main_report ---------//
00299 void report_main(int refreshFlag) {
00300 
00301     static int  numSeriesData36 = HISTORY_MONTH_COUNT;
00302     static int  numSeriesData24 = HISTORY_TRIMESTER_COUNT;
00303     static int  numSeriesData8 = HISTORY_YEAR_COUNT;
00304 
00305     static float xStart0,xEnd0;
00306     static int xStart1,xEnd1;
00307     static float xStart2,xEnd2;
00308     static float xStart3,xEnd3;
00309     static float xStart4,xEnd4;
00310     static int xStart5,xEnd5;
00311 
00312     static float *dataArray1;
00313     static float *dataArray2;
00314     static float *dataArray3;
00315     static float *dataArray4;
00316     static float *dataArray5;
00317     static float *dataArray0;
00318 
00319     int deptRecno = department_array.selected_recno;
00320     Department* cur_dept_ptr = department_array[deptRecno];
00321 
00322     if(department_array.current_data_mode==MODE_DEPARTMENT) {
00323         dataArray0=cur_dept_ptr->p_educational_quality_history;
00324         dataArray1=cur_dept_ptr->p_academic_standing_history;
00325         dataArray2=cur_dept_ptr->p_student_morale_history;
00326         dataArray3=cur_dept_ptr->p_faculty_research_history;
00327         dataArray4=cur_dept_ptr->p_faculty_morale_history;
00328         dataArray5=cur_dept_ptr->p_faculty_diversity_history;
00329         sys.is_institution_report=0;
00330     }
00331     else {
00332         dataArray0=department_array.p_educational_quality_history;
00333         dataArray1=department_array.p_academic_standing_history;
00334         dataArray2=department_array.p_student_morale_history;
00335         dataArray3=department_array.p_faculty_research_history;
00336         dataArray4=department_array.p_faculty_morale_history;
00337         dataArray5=department_array.p_faculty_diversity_history;
00338         sys.is_institution_report=1;
00339 
00340         // update institutional prestige as sub_score[] is updated monthly while p_academic_standing_history[] is updated yearly. We do this to sync the values.
00341 
00342         department_array.p_academic_standing_history[THIS_YEAR] = player_school.sub_score[S_PRESTIGE][THIS_MONTH];
00343     }
00344     //-----------initial data-----------//
00345 
00346     xEnd0 = float(info.game_year)+float(info.game_month)/12.0f;
00347     xStart0 = xEnd0-6.0f;
00348     xEnd1 = (info.game_year);
00349     xStart1 = (info.game_year-numSeriesData8+1);
00350     xEnd2 = float(info.game_year)+float(info.game_month)/12.0f;
00351     xStart2 = xEnd2-6.0f;
00352     xEnd3 = float(info.game_year)+float(info.game_month)/12.0f;
00353     xStart3 = xEnd3-3.0f;
00354     xEnd4 = float(info.game_year)+float(info.game_month)/12.0f;
00355     xStart4 = xEnd4-3.0f;
00356     xEnd5 = (info.game_year);
00357     xStart5 = (info.game_year-numSeriesData8+1);
00358 
00359     vga.use_back();
00360     if (refreshFlag == INFO_REPAINT) {
00361         if( report_init_flag )                        // deinit it first if it has already been initialized
00362             deinit_main();
00363 
00364         //------------- paint the background ----------------//
00365 
00366         //              static short callTime=0;
00367 
00368         //              if( ++callTime%2==0 )
00369         user_interface.bg_img(BG_PIC_ID, &vga_back);
00370         //              else
00371         //                      user_interface.bg_img(BG_PIC_ID-1, &vga_back);
00372 
00373         user_interface.brighten(REPORT_X1+100,REPORT_Y1-25,REPORT_X1+630,REPORT_Y1-4);
00374         user_interface.rect(REPORT_X1+100,REPORT_Y1-25,REPORT_X1+630,REPORT_Y1-4,1);
00375         if(department_array.current_data_mode==MODE_DEPARTMENT)
00376             font_charts.put(REPORT_X1+270,REPORT_Y1-19,"Departmental Performance");
00377         else
00378             font_charts.put(REPORT_X1+270,REPORT_Y1-19,"Institutional Performance");
00379 
00380         user_interface.brighten(REPORT_X1,REPORT_Y1-2,REPORT_X2,REPORT_Y2-20);
00381         user_interface.brighten(100,REPORT_Y2-10,250,REPORT_Y2-10+BUTTON_HEIGHT);
00382         user_interface.brighten(330,REPORT_Y2-10,480,REPORT_Y2-10+BUTTON_HEIGHT);
00383         user_interface.brighten(550,REPORT_Y2-10,700,REPORT_Y2-10+BUTTON_HEIGHT);
00384         user_interface.rect(REPORT_X1,REPORT_Y1-2,REPORT_X2,REPORT_Y2-20,1);
00385         //              font_chartsm.put(REPORT_X2/2-70,REPORT_Y1-25,mode_dept_title);
00386 
00387         //----- initialize the buttons and the graph -----//
00388         if (!report_init_flag) {
00389             for(int y = MODE_DEPT_VTAB1+REPORT_Y1+15,i=0,k=0;i<2;i++,y+=BUTTON_VDIST)
00390                 for(int x = MODE_DEPT_TAB0+REPORT_X1,j=0;j<3;j++,x+=BUTTON_DIST,k++) {
00391                     if((k>=0)&&(k<=1)) {
00392                         //## chea 200999 get rid of the "rank" and  "detail" same code but diff.pos. ORG.
00393                         /*
00394                           // detail button
00395                           mode_dept_button_up_bitmap[k] = NULL;
00396                           mode_dept_button_down_bitmap[k] = NULL;
00397 
00398                           user_interface.create_button_bitmap(
00399                           x+MODE_DEPT_GRAPH_WIDTH-BUTTON_WIDTH,
00400                           y+MODE_DEPT_GRAPH_HEIGHT+7,
00401                           x+MODE_DEPT_GRAPH_WIDTH,
00402                           y+MODE_DEPT_GRAPH_HEIGHT+BUTTON_HEIGHT+2,
00403                           "Detail", &mode_dept_button_up_bitmap[k],
00404                           &mode_dept_button_down_bitmap[k], &vga_back);
00405 
00406                           mode_dept_button[k].create_bitmapW(
00407                           x+MODE_DEPT_GRAPH_WIDTH-BUTTON_WIDTH,
00408                           y+MODE_DEPT_GRAPH_HEIGHT+7,
00409                           x+MODE_DEPT_GRAPH_WIDTH,
00410                           y+MODE_DEPT_GRAPH_HEIGHT+BUTTON_HEIGHT+2,
00411                           mode_dept_button_down_bitmap[k]+4);
00412 
00413                           if(department_array.current_data_mode==MODE_DEPARTMENT)
00414                           mode_dept_button[k].paint();
00415                           else
00416                           {
00417 
00418                           vga.blt_buf(
00419                           x+MODE_DEPT_GRAPH_WIDTH-BUTTON_WIDTH,
00420                           y+MODE_DEPT_GRAPH_HEIGHT+7,
00421                           x+MODE_DEPT_GRAPH_WIDTH,
00422                           y+MODE_DEPT_GRAPH_HEIGHT+BUTTON_HEIGHT+7,0);
00423                           vga.blt_buf(
00424                           x+MODE_DEPT_GRAPH_WIDTH-BUTTON_WIDTH,
00425                           y+MODE_DEPT_GRAPH_HEIGHT+7,
00426                           x+MODE_DEPT_GRAPH_WIDTH,
00427                           y+MODE_DEPT_GRAPH_HEIGHT+BUTTON_HEIGHT+7,0);
00428 
00429                           }
00430                         */
00431                         //## chea 200999 end get rid of the "rank" and  "detail" same code but diff.pos. ORG.
00432 
00433                         // detail button
00434                         mode_dept_button_up_bitmap[k] = NULL;
00435                         mode_dept_button_down_bitmap[k] = NULL;
00436 
00437                         user_interface.create_button_bitmap(
00438                             x+MODE_DEPT_GRAPH_WIDTH-5*BUTTON_WIDTH/2,
00439                             y+MODE_DEPT_GRAPH_HEIGHT+7,
00440                             x+MODE_DEPT_GRAPH_WIDTH-3*BUTTON_WIDTH/2,
00441                             y+MODE_DEPT_GRAPH_HEIGHT+BUTTON_HEIGHT+2,
00442                             "Detail", &mode_dept_button_up_bitmap[k],
00443                             &mode_dept_button_down_bitmap[k], &vga_back);
00444 
00445                         mode_dept_button[k].create_bitmapW(
00446                             x+MODE_DEPT_GRAPH_WIDTH-5*BUTTON_WIDTH/2,
00447                             y+MODE_DEPT_GRAPH_HEIGHT+7,
00448                             x+MODE_DEPT_GRAPH_WIDTH-3*BUTTON_WIDTH/2,
00449                             y+MODE_DEPT_GRAPH_HEIGHT+BUTTON_HEIGHT+2,
00450                             mode_dept_button_down_bitmap[k]+4);
00451 
00452                         if(department_array.current_data_mode==MODE_DEPARTMENT)
00453                             mode_dept_button[k].paint();
00454                         else {
00455 
00456                             vga.blt_buf(
00457                                 x+MODE_DEPT_GRAPH_WIDTH-5*BUTTON_WIDTH/2,
00458                                 y+MODE_DEPT_GRAPH_HEIGHT+7,
00459                                 x+MODE_DEPT_GRAPH_WIDTH-3*BUTTON_WIDTH/2,
00460                                 y+MODE_DEPT_GRAPH_HEIGHT+BUTTON_HEIGHT+2,
00461                                 0);
00462                             vga.blt_buf(
00463                                 x+MODE_DEPT_GRAPH_WIDTH-5*BUTTON_WIDTH/2,
00464                                 y+MODE_DEPT_GRAPH_HEIGHT+7,
00465                                 x+MODE_DEPT_GRAPH_WIDTH-3*BUTTON_WIDTH/2,
00466                                 y+MODE_DEPT_GRAPH_HEIGHT+BUTTON_HEIGHT+2,
00467                                 0);
00468 
00469                         }
00470 
00471                     }
00472 
00473                     // rank button
00474                     mode_dept_button_up_bitmap[k+6] = NULL;
00475                     mode_dept_button_down_bitmap[k+6] = NULL;
00476 
00477                     user_interface.create_button_bitmap(
00478                         x+MODE_DEPT_GRAPH_WIDTH-5*BUTTON_WIDTH/2,
00479                         y+MODE_DEPT_GRAPH_HEIGHT+7,
00480                         x+MODE_DEPT_GRAPH_WIDTH-3*BUTTON_WIDTH/2,
00481                         y+MODE_DEPT_GRAPH_HEIGHT+BUTTON_HEIGHT+2,
00482                         "Rank", &mode_dept_button_up_bitmap[k+6],
00483                         &mode_dept_button_down_bitmap[k+6], &vga_back);
00484 
00485                     mode_dept_button[k+6].create_bitmapW(
00486                         x+MODE_DEPT_GRAPH_WIDTH-5*BUTTON_WIDTH/2,
00487                         y+MODE_DEPT_GRAPH_HEIGHT+7,
00488                         x+MODE_DEPT_GRAPH_WIDTH-3*BUTTON_WIDTH/2,
00489                         y+MODE_DEPT_GRAPH_HEIGHT+BUTTON_HEIGHT+2,
00490                         mode_dept_button_down_bitmap[k+6]+4);
00491 
00492                     //                                  mode_dept_button[k+6].paint();  //## chea 200999 get rid of the "rank" and  "detail"
00493 
00494                     if(k==0)
00495                         mode_dept_graph0.init(
00496                             x, y,
00497                             x+MODE_DEPT_GRAPH_WIDTH, y+MODE_DEPT_GRAPH_HEIGHT,
00498                             1, &numSeriesData24, dataArray0, 0,
00499                             NULL, NULL, NULL, 1, 1, 1, 3);
00500 
00501                     if(k==1)
00502                         mode_dept_graph1.init(
00503                             x, y,
00504                             x+MODE_DEPT_GRAPH_WIDTH, y+MODE_DEPT_GRAPH_HEIGHT,
00505                             1, &numSeriesData8, dataArray1, 0,
00506                             NULL, NULL, NULL, 1, 1, 1, 3);
00507 
00508                     if(k==2)
00509                         mode_dept_graph2.init(
00510                             x, y,
00511                             x+MODE_DEPT_GRAPH_WIDTH, y+MODE_DEPT_GRAPH_HEIGHT,
00512                             1, &numSeriesData24, dataArray2, 0,
00513                             NULL, NULL, NULL, 1, 1, 1, 3);
00514 
00515                     if(k==3)
00516                         mode_dept_graph3.init(
00517                             x, y,
00518                             x+MODE_DEPT_GRAPH_WIDTH, y+MODE_DEPT_GRAPH_HEIGHT,
00519                             1, &numSeriesData36, dataArray3,
00520                             0,
00521                             NULL, NULL, NULL, 1,
00522                             1, 1, 3);
00523 
00524                     if(k==4)
00525                         mode_dept_graph4.init(
00526                             x, y,
00527                             x+MODE_DEPT_GRAPH_WIDTH, y+MODE_DEPT_GRAPH_HEIGHT,
00528                             1, &numSeriesData36, dataArray4,
00529                             0,
00530                             NULL, NULL, NULL, 1, 1, 1, 3);
00531 
00532                     if(k==5)
00533                         mode_dept_graph5.init(
00534                             x, y,
00535                             x+MODE_DEPT_GRAPH_WIDTH, y+MODE_DEPT_GRAPH_HEIGHT,
00536                             1, &numSeriesData8, dataArray5,
00537                             0,
00538                             NULL, NULL, NULL, 1, 1, 1, 3);
00539 
00540                 }
00541             report_init_flag = 1;
00542         }
00543 
00544         for(int k=0;k<3;k++) {
00545             mode_dept_button_up_bitmap[k+12] = NULL;
00546             mode_dept_button_down_bitmap[k+12] = NULL;
00547         }
00548 
00549         user_interface.create_button_bitmap(
00550             100,REPORT_Y2-10,
00551             250,REPORT_Y2-10+BUTTON_HEIGHT,
00552             "Institution", &mode_dept_button_up_bitmap[12],
00553             &mode_dept_button_down_bitmap[12], &vga_back);
00554 
00555         mode_dept_button[12].create_bitmapW(
00556             100,REPORT_Y2-10,
00557             250,REPORT_Y2-10+BUTTON_HEIGHT,
00558             mode_dept_button_down_bitmap[12]+4);
00559 
00560         user_interface.create_button_bitmap(
00561             330,REPORT_Y2-10,
00562             480,REPORT_Y2-10+BUTTON_HEIGHT,
00563             "Department", &mode_dept_button_up_bitmap[13],
00564             &mode_dept_button_down_bitmap[13], &vga_back);
00565 
00566         mode_dept_button[13].create_bitmapW(
00567             330,REPORT_Y2-10,
00568             480,REPORT_Y2-10+BUTTON_HEIGHT,
00569             mode_dept_button_down_bitmap[13]+4);
00570 
00571         user_interface.create_button_bitmap(
00572             550,REPORT_Y2-10,
00573             700,REPORT_Y2-10+BUTTON_HEIGHT,
00574             "Rank by department", &mode_dept_button_up_bitmap[14],
00575             &mode_dept_button_down_bitmap[14], &vga_back);
00576 
00577         mode_dept_button[14].create_bitmapW(
00578             550,REPORT_Y2-10,
00579             700,REPORT_Y2-10+BUTTON_HEIGHT,
00580             mode_dept_button_down_bitmap[14]+4);
00581 
00582         for(k=12;k<15;k++) {
00583             mode_dept_button[k].paint();
00584         }
00585 
00586         mode_dept_button[department_array.current_data_mode+12].body_ptr=(void*)(mode_dept_button_down_bitmap[department_array.current_data_mode+12]+4);
00587         mode_dept_button[department_array.current_data_mode+12].push();
00588 
00589         mode_dept_graph0.paint();
00590         mode_dept_graph1.paint();
00591         mode_dept_graph2.paint();
00592         mode_dept_graph3.paint();
00593         mode_dept_graph4.paint();
00594         mode_dept_graph5.paint();
00595     }
00596     else {
00597         //----repaint---///
00598         for(int k=0;k<15;k++) {
00599             //------------- paint the background ----------------//
00600 
00601             //## chea 200999 get rid of the "rank" and  "detail"
00602             /*
00603               if((k>=2)&&(k<=5))continue;
00604               if(department_array.current_data_mode==MODE_DEPARTMENT)
00605               mode_dept_button[k].paint();
00606               else
00607               {
00608 
00609               vga.blt_buf(
00610               mode_dept_button[0].x1,
00611               mode_dept_button[0].y1,
00612               mode_dept_button[0].x2,
00613               mode_dept_button[0].y2+5,0);
00614               vga.blt_buf(
00615               mode_dept_button[1].x1,
00616               mode_dept_button[1].y1,
00617               mode_dept_button[1].x2,
00618               mode_dept_button[1].y2+5,0);
00619 
00620               }
00621             */
00622         }
00623 
00624         mode_dept_button[department_array.current_data_mode+12].body_ptr=(void*)(mode_dept_button_down_bitmap[department_array.current_data_mode+12]+4);
00625         mode_dept_button[department_array.current_data_mode+12].push();
00626 
00627         mode_dept_graph0.refresh();
00628         mode_dept_graph1.refresh();
00629         mode_dept_graph2.refresh();
00630         mode_dept_graph3.refresh();
00631         mode_dept_graph4.refresh();
00632         mode_dept_graph5.refresh();
00633     }
00634     //---------------//
00635     for(int y = MODE_DEPT_VTAB1+REPORT_Y1+15,i=0,k=0;i<2;i++,y+=BUTTON_VDIST) {
00636         for(int x = MODE_DEPT_TAB0+REPORT_X1,j=0;j<3;j++,x+=BUTTON_DIST,k++) {
00637             char* str = mode_dept_str[k];
00638 
00639             // k==1 is Prestige display
00640             if( k==1 && department_array.current_data_mode==MODE_INSTITUTION )
00641                 str = "Institutional prestige";
00642 
00643             font_chartsm.center_put(x,y-BUTTON_HEIGHT+7,x+MODE_DEPT_GRAPH_WIDTH,y-BUTTON_HEIGHT+23,str);
00644         }
00645     }
00646 
00647     vga.blt_buf(ZOOM_X1, ZOOM_Y1, ZOOM_X2, ZOOM_Y2);
00648 
00649     //------- blt the back buffer to front buffer -------//
00650     vga.use_front();
00651 }
00652 
00653 //
00654 //-------- End of function Department::main_report ---------//
00655 
00656 //-------- Begin of function dept_rep_detect ---------//
00658 int detect_main() {
00659     vga.use_back();
00660 
00661     int rc = detect_main2();
00662 
00663     vga.use_front();
00664 
00665     return rc;
00666 }
00667 
00668 //
00669 //-------- End of function dept_rep_detect ---------//
00670 
00671 //-------- Begin of function dept_rep_detect2 ---------//
00673 int detect_main2() {
00674     vga.use_front();
00675 
00676     for(int k=0;k<15;k++) {
00677         //              if(k>=2&&k<=5)continue;    //## chea 200999 org.
00678         if(k>=2&&k<=11)continue;                      //## chea 200999 get rid of the "rank" and  "detail"
00679 
00680         //## chea 200999 get rid of the "rank" and  datail
00681         if(department_array.current_data_mode != MODE_DEPARTMENT && (k>=0 && k<=1))continue;
00682 
00683         if(mode_dept_button[k].detect()) {
00684 
00685             mode_dept_button[k].body_ptr=(void*)(mode_dept_button_down_bitmap[k]+4);
00686             mode_dept_button[k].push();
00687 
00688             (*deinit_func_ptr[department_array.current_screen_mode])();
00689 
00690             if((k>=0)&&(k<2)) {
00691                 department_array.current_screen_mode=k+1;
00692                 department_array.current_pref_report_type=k+1;
00693             }
00694 
00695             if((k>=6)&&(k<12)) {
00696                 department_array.current_screen_mode=MODE_DEPT_RANK;
00697                 department_array.current_pref_report_type=k-5;
00698             }
00699             if(k==12||k==13) {
00700                 department_array.current_screen_mode=MODE_DEPT_MAIN;
00701                 department_array.current_data_mode=k-12;
00702             }
00703 
00704             if(k==14) {
00705                 department_array.current_screen_mode=MODE_DEPT_RANK;
00706                 department_array.current_pref_report_type=1;
00707 #if(GAME_VERSION>=200)
00708                 sys.is_institution_report = 1;
00709 #endif
00710             }
00711 
00712             sys.redraw_all_flag = 1;
00713             return 1;
00714         }
00715     }
00716     return 0;
00717 }
00718 
00719 //
00720 //-------- End of function dept_rep_detect2 ---------//
00721 
00723 #define REC_HEIGHT 20
00724 #define REC_COUNT 15
00725 #define SHEET_COLOR Vga::active_buf->color_down
00726 
00727 static Button eq_button_para,button_back;
00728 static GraphPerformanceIndicatorTrimester eq_graphiconA;
00729 static GraphPerformanceIndicatorTrimester eq_graphicon[EDUCATIONAL_QUALITY_VAR_COUNT];
00730 static Text eq_text[EDUCATIONAL_QUALITY_VAR_COUNT],eq_textA;
00731 static Text eq_text2[EDUCATIONAL_QUALITY_VAR_COUNT];
00732 static Text eq_text_chg[EDUCATIONAL_QUALITY_VAR_COUNT],eq_text_chgA;
00733 
00734 static GraphPerformanceIndicatorYear as_graphiconA;
00735 static GraphPerformanceIndicatorYear as_graphicon[ACADEMIC_STANDING_VAR_COUNT];
00736 static Text da_text[ACADEMIC_STANDING_VAR_COUNT],da_textA;
00737 static Text da_text2[ACADEMIC_STANDING_VAR_COUNT];
00738 static Text da_text_chg[ACADEMIC_STANDING_VAR_COUNT],da_text_chgA;
00739 
00740 static GraphPerformanceIndicatorTrimester sm_graphiconA;
00741 static GraphPerformanceIndicatorTrimester sm_graphicon[4];
00742 static Text sm_text[4],sm_textA;
00743 static Text sm_text_chg[4],sm_text_chgA;
00744 
00745 static GraphPerformanceIndicatorMonth fp_graphiconA;
00746 static GraphPerformanceIndicatorMonth fp_graphicon;
00747 static Text fp_text,fp_textA;
00748 static Text fp_text_chg,fp_text_chgA;
00749 
00750 static GraphPerformanceIndicatorMonth fm_graphiconA;
00751 static GraphPerformanceIndicatorMonth fm_graphicon;
00752 static Text fm_text,fm_textA;
00753 static Text fm_text_chg,fm_text_chgA;
00754 
00755 static GraphPerformanceIndicatorYear di_graphiconA;
00756 static GraphPerformanceIndicatorYear di_graphicon;
00757 static Text di_text,di_textA;
00758 static Text di_text_chg,di_text_chgA;
00759 
00760 static VBrowse98  eq_browser;
00761 static VBrowse98  rk_browser;
00762 
00764 
00765 //-------- Begin of functions report/detect/deinit educational_quality ---------//
00767 static char* educational_quality_label[]= {
00768     "Faculty teaching performance rating",
00769     "Faculty educational development time (hours per week)",
00770     "Faculty scholarship performance",
00771     "Faculty research performance",
00772     "Use of information technology in teaching",
00773     "Deviation of class size from its norm",
00774     "Deviation of teaching method mix from its norm",
00775 };
00776 
00777 void report_educational_quality(int refreshFlag) {
00778 
00779     const static tab1=30,tab2=320,tab3=420,tab4=490;
00780     const static tab5=620,tab6=680,tab7=660,tab8=760;
00781     const static vtab1=32,vtab2=47,vtab3=210,vtab4=360,vtab5=320;
00782     static float v[EDUCATIONAL_QUALITY_VAR_COUNT];
00783     static float v2[EDUCATIONAL_QUALITY_VAR_COUNT];
00784     static float v3[EDUCATIONAL_QUALITY_VAR_COUNT];
00785     static int data_num=HISTORY_TRIMESTER_COUNT;
00786     static float * dataArray[EDUCATIONAL_QUALITY_VAR_COUNT];
00787     static float * dataArrayA;
00788     static float eq_chg;
00789 
00790     //-----communication with sim engine's Output-----//
00791     int deptRecno = department_array.selected_recno;
00792     Department* cur_dept_ptr = department_array[deptRecno];
00793 
00794     if(department_array.current_data_mode==MODE_DEPARTMENT) {
00795         sys.is_institution_report=0;
00796         dataArrayA=cur_dept_ptr->p_educational_quality_history;
00797         for(int i=0;i<EDUCATIONAL_QUALITY_VAR_COUNT;i++) {
00798             dataArray[i]=cur_dept_ptr->var_educational_quality_history[i];
00799             v[i]=dataArray[i][data_num-1];
00800             v3[i]=cur_dept_ptr->var_educational_quality_weight[i]*100;
00801             v2[i]=cur_dept_ptr->var_change_educational_quality[i];
00802         }
00803     }
00804     else {
00805         sys.is_institution_report=1;
00806         dataArrayA=department_array.p_educational_quality_history;
00807         for(int i=0;i<EDUCATIONAL_QUALITY_VAR_COUNT;i++) {
00808             // BUGHERE -- wait for Fred's preparation
00809             //                  dataArray[i]=department_array.var_educational_quality_history[i];
00810             dataArray[i]=cur_dept_ptr->var_educational_quality_history[i];
00811             //                  v[i]=(float)i;
00812             v[i]=dataArray[i][data_num-1];
00813             v3[i]=cur_dept_ptr->var_educational_quality_weight[i]*100;
00814             v2[i]=cur_dept_ptr->var_change_educational_quality[i];
00815         }
00816     }
00817 
00818     if(info.graph_trimester_passed>1) {
00819         eq_chg=(float)(100.0*((double)dataArrayA[data_num-1]-dataArrayA[data_num-2])/dataArrayA[data_num-2]);
00820         if((eq_chg<0.0)&&(eq_chg>-0.01))
00821             eq_chg=0.0;
00822     }
00823     else
00824         eq_chg=0.0;
00825 
00826     vga.use_back();
00827     if (refreshFlag == INFO_REPAINT) {
00828         //------------- paint the background ----------------//
00829         user_interface.bg_img(BG_PIC_ID, &vga_back);
00830         user_interface.brighten(REPORT_X1+100,REPORT_Y1-25,REPORT_X1+630,REPORT_Y1);
00831         user_interface.rect(REPORT_X1+100,REPORT_Y1-25,REPORT_X1+630,REPORT_Y1,1);
00832         font_charts.put(REPORT_X1+270,REPORT_Y1-19,"Departmental Performance");
00833         user_interface.brighten(REPORT_X1,REPORT_Y1+vtab1-30,REPORT_X2,REPORT_Y2-10);
00834         user_interface.rect(REPORT_X1,REPORT_Y1+vtab1-30,REPORT_X2,REPORT_Y1+vtab1-10);
00835         user_interface.rect(REPORT_X1,REPORT_Y1+vtab1-10,REPORT_X2,REPORT_Y1+vtab1+30);
00836         user_interface.rect( REPORT_X1,REPORT_Y1+vtab1+30,REPORT_X2,REPORT_Y2-10);
00837 
00838         //--------------Initialize buttons-------------------//
00839         button_back.create_text( REPORT_X1+tab1+250,
00840                                  REPORT_Y2-1, REPORT_X1+tab1+440, REPORT_Y2+19, "Back" );
00841         //              button_back.set_key( 'B' );
00842 
00843         //--------------Initialize eq_graph-------------------//
00844         eq_graphiconA.init(
00845             REPORT_X1+tab5-5,REPORT_Y1+vtab1-8,
00846             REPORT_X1+tab6+5,REPORT_Y1+vtab1+28,
00847             1 ,&data_num ,dataArrayA, 1, 0, 3);
00848 
00849         eq_textA.right_put(
00850             REPORT_X1+tab2+80,REPORT_Y1+vtab1+5,&(dataArrayA[data_num-1]),4);
00851 
00852         eq_text_chgA.right_put(
00853             REPORT_X1+tab4+85,REPORT_Y1+vtab1+5,
00854             eq_chg,4);
00855 
00856         font_chartsm.put(REPORT_X1+tab1,REPORT_Y1+vtab1+5,"E d u c a t i o n a l   q u a l i t y");
00857 
00858         for(int i=0;i<EDUCATIONAL_QUALITY_VAR_COUNT;i++) {
00859             eq_graphicon[i].init(
00860                 REPORT_X1+tab5,REPORT_Y1+vtab1+i*42+40,
00861                 REPORT_X1+tab6,REPORT_Y1+vtab1+i*42+68,
00862                 1 ,&data_num ,dataArray[i], 1, 0, 3);
00863         }
00864 
00865         for(i=0;i<EDUCATIONAL_QUALITY_VAR_COUNT;i++) {
00866 #if(GAME_VERSION>=200)
00867             font_chart_purple_sm.right_put( REPORT_X1+tab2+50, REPORT_Y1+vtab1+i*42+50, m.format(cur_dept_ptr->initial_education_equality[i],4) );
00868 #endif
00869 
00870             if(i==0||i>1&&i<5)
00871                 eq_text[i].right_put(REPORT_X1+tab2+80,REPORT_Y1+vtab1+i*42+50,v+i,4);
00872             else
00873                 eq_text[i].right_put(REPORT_X1+tab2+80,REPORT_Y1+vtab1+i*42+50,v+i,4);
00874 
00875             eq_text2[i].right_put(REPORT_X1+tab3+55,REPORT_Y1+vtab1+i*42+50,v3+i,3);
00876             eq_text_chg[i].right_put(REPORT_X1+tab4+85,REPORT_Y1+vtab1+i*42+50,v2+i,4);
00877 
00878             help_button_array[i].create_text(REPORT_X1+tab1-21,REPORT_Y1+vtab2+i*42+30,REPORT_X1+tab1-7,REPORT_Y1+vtab2+i*42+44,"?");
00879             image_interface.put_back(REPORT_X1+tab1-21,REPORT_Y1+vtab2+i*42+30,"QUEST_UP");
00880         }
00881 
00882         //-------------- Show Text --------------//
00883         //              font_chartsm.put(REPORT_X1+tab1,REPORT_Y1+vtab1-27,"Contributing factors");
00884         font_chartsm.put(REPORT_X1+tab2+15,REPORT_Y1+vtab1-25,"Current value");
00885         font_chartsm.put(REPORT_X1+tab3+15,REPORT_Y1+vtab1-25,"Weight");
00886         font_chartsm.put(REPORT_X1+tab4+5,REPORT_Y1+vtab1-25,"Last trimester change");
00887         font_chartsm.put(REPORT_X1+tab5+20,REPORT_Y1+vtab1-25,"Trend");
00888 
00889         for(i=0;i<EDUCATIONAL_QUALITY_VAR_COUNT;i++) {
00890             font_chartsm.put_paragraph(REPORT_X1+tab1+5,REPORT_Y1+vtab1+i*42+49,REPORT_X1+tab2+30,REPORT_Y1+vtab1+i*42+94,educational_quality_label[i]);
00891         }
00892         eq_graphiconA.paint();
00893         eq_textA.paint();
00894 
00895         for(i=0;i<EDUCATIONAL_QUALITY_VAR_COUNT;i++) {
00896             eq_graphicon[i].paint();
00897             eq_text[i].paint();
00898             eq_text2[i].paint();
00899             eq_text_chg[i].paint();
00900         }
00901     }
00902     else {
00903         eq_graphiconA.refresh();
00904         eq_textA.refresh();
00905         eq_text_chgA.refresh();
00906         for(int i=0;i<EDUCATIONAL_QUALITY_VAR_COUNT;i++) {
00907             eq_graphicon[i].refresh();
00908             eq_text[i].refresh();
00909             eq_text_chg[i].refresh();
00910         }
00911     }
00912 
00913     button_back.paint();
00914 
00915     vga.blt_buf(ZOOM_X1, ZOOM_Y1, ZOOM_X2, ZOOM_Y2);
00916     vga.use_front();
00917 };
00918 
00919 int detect_educational_quality() {
00920     const static tab1=30,tab2=320,tab3=420,tab4=490;
00921     const static tab5=620,tab6=680,tab7=660,tab8=760;
00922     const static vtab1=22,vtab2=37,vtab3=200,vtab4=350,vtab5=320;
00923     for(int i=0;i<EDUCATIONAL_QUALITY_VAR_COUNT;i++) {
00924         if(help_button_array[i].detect()) {
00925             // ## begin chwg1022  create the global ResTxt help_resource later //
00926             String str;
00927             str  = DIR_RES;
00928             str += "SCORE";
00929 
00930             ResTxt rs;
00931             rs.init(str);
00932             // ## chwg1022 end ////////////////////////
00933 
00934             image_interface.put_back(REPORT_X1+tab1-21,REPORT_Y1+vtab2+i*42+40,"QUEST_DN");
00935             vga.blt_buf(REPORT_X1+tab1-21,REPORT_Y1+vtab2+i*42+40,REPORT_X1+tab1-3,REPORT_Y1+vtab2+i*42+58);
00936             sys.back_view_mode=sys.view_mode;
00937             help_if.help_textlist.topic_id=rs.locate_topic(educational_quality_label[i]);
00938             if(help_if.help_textlist.topic_id>0) {
00939                 help_if.help_textlist.add_history(help_if.help_textlist.topic_id);
00940                 sys.set_view_mode(MODE_HELP_DESC);
00941                 sys.redraw_all_flag = 1;
00942                 audio.play_wav("BEEPS-1",audio.int_to_DsVolume(config.sound_effect_volume));
00943             }
00944             return 1;
00945 
00946         }
00947     }
00948 
00949     if(button_back.detect()) {
00950         (*deinit_func_ptr[department_array.current_screen_mode])();
00951         //-------- post display redraw flag -------//
00952         sys.redraw_all_flag = 1;
00953         department_array.current_screen_mode=MODE_DEPT_MAIN;
00954         return 1;
00955     }
00956     return 0;
00957 };
00958 
00959 void deinit_educational_quality() {
00960     for(int i=0;i<EDUCATIONAL_QUALITY_VAR_COUNT;i++)
00961         eq_graphicon[i].deinit();
00962     eq_graphiconA.deinit();
00963     eq_textA.deinit();
00964     eq_text_chgA.deinit();
00965     for(i=0;i<EDUCATIONAL_QUALITY_VAR_COUNT;i++) {
00966         eq_text[i].deinit();
00967         eq_text2[i].deinit();
00968         eq_text_chg[i].deinit();
00969         // ##### begin Gilbert 28/04/2001 ######//
00970         help_button_array[i].deinit();
00971         // ##### end Gilbert 28/04/2001 ######//
00972     }
00973     // ##### begin Gilbert 28/04/2001 ######//
00974     button_back.deinit();
00975     // ##### end Gilbert 28/04/2001 ######//
00976 };
00977 //
00978 //-------- End of functions report/detect/deinit educational_quality ---------//
00979 
00980 //-------- Begin of functions report/detect/deinit educational_quality2 page 2---------//
00982 
00983 void report_educational_quality2(int refreshFlag) {
00984     const static int tab1=10;
00985     const static int tab2=600;
00986     const static int tab3=650;
00987     const static int tab4=700;
00988     const static int vtab1=-20;
00989     const static int vtab2=200;
00990     const static int vtab3=225;
00991     const static int vtab4=360;
00992     int report_recno=1;
00993     static int reccount=REC_COUNT;
00994     vga.use_back();
00995     if (refreshFlag == INFO_REPAINT) {
00996         //------------- paint the background ----------------//
00997         user_interface.bg_img(BG_PIC_ID, &vga_back);
00998         user_interface.rect(REPORT_X1,REPORT_Y1+vtab1,REPORT_X2,REPORT_Y1+vtab4);
00999         user_interface.brighten(REPORT_X1,REPORT_Y1+vtab1,REPORT_X2,REPORT_Y1+vtab4);
01000 
01001         //--------------Initialize buttons-------------------//
01002         eq_button_para.create_text( REPORT_X1+tab1+200,
01003                                     REPORT_Y2+2, REPORT_X1+tab1+350, REPORT_Y2+22, "Variables" );
01004         //              eq_button_para.set_key( 'V' );
01005 
01006         button_back.create_text( REPORT_X1+tab1+450,
01007                                  REPORT_Y2+2, REPORT_X1+tab1+500, REPORT_Y2+22, "Back" );
01008 
01009         //              button_back.set_key( 'B' );
01010 
01011         //--------------Initialize Vbroswer-------------------//
01012         eq_browser.init(REPORT_X1,REPORT_Y1+vtab1,REPORT_X2,REPORT_Y1+vtab4,
01013                         0, REC_HEIGHT, reccount, eq_disp_rep_row,NULL,0);
01014         eq_browser.open(report_recno);
01015 
01016         //-------------- Show Text --------------//
01017     }
01018     else {
01019     }
01020 
01021     report_recno=eq_browser.recno();
01022 
01023     vga.use_back();
01024     eq_button_para.paint();
01025     button_back.paint();
01026 
01027     vga.blt_buf(ZOOM_X1, ZOOM_Y1, ZOOM_X2, ZOOM_Y2);
01028     eq_browser.update();
01029     vga.use_front();
01030 };
01031 
01032 int detect_educational_quality2() {
01033 
01034     vga.use_front();
01035     eq_browser.detect();
01036 
01037     if(eq_button_para.detect()) {
01038         (*deinit_func_ptr[department_array.current_screen_mode])();
01039         //-------- post display redraw flag -------//
01040         sys.redraw_all_flag = 1;
01041         department_array.current_screen_mode=MODE_DEPT_EDUCATIONAL_QUALITY;
01042         return 1;
01043     }
01044 
01045     if(button_back.detect()) {
01046         (*deinit_func_ptr[department_array.current_screen_mode])();
01047         //-------- post display redraw flag -------//
01048         sys.redraw_all_flag = 1;
01049         department_array.current_screen_mode=MODE_DEPT_MAIN;
01050         return 1;
01051     }
01052 
01053     return 0;
01054 };
01055 
01056 void deinit_educational_quality2() {
01057     // #### begin Gilbert 28/04/2001 #####//
01058     eq_browser.deinit();
01059     button_back.deinit();
01060     eq_button_para.deinit();
01061     // #### end Gilbert 28/04/2001 #####//
01062 };
01063 
01064 static void eq_disp_rep_row(int recNo, int x, int y, int refreshFlag) {
01065     //----- display financial report -----//
01066     if( refreshFlag == INFO_REPAINT ) {
01067         vga.use_back();
01068         //              user_interface.bar(x, y, REPORT_X2-40, y+REC_HEIGHT,SHEET_COLOR);
01069         //              vga.blt_buf( x, y, REPORT_X2-45, y+REC_HEIGHT-2, 0 );
01070     }
01071 
01072     if(recNo==1) {
01073         font_chartsm.put_paragraph
01074             (
01075                 x, y, REPORT_X2-45, y+REC_HEIGHT-2,
01076                 "Text here..."
01077                 );
01078     }
01079 
01080 };
01081 
01082 //
01083 //-------- End of functions report/detect/deinit educational_quality2 page 2 ---------//
01084 
01085 //-------- Begin of functions report/detect/deinit departmental_academic ---------//
01087 static char* departmental_academic_label[]= {
01088     "Faculty research performance",
01089     "Sponsored research",
01090     "Quality rating for doctoral students",
01091     "Doctoral students per regular faculty member"
01092 };
01093 
01094 void report_departmental_academic(int refreshFlag) {
01095     const static tab1=30,tab2=320,tab3=420,tab4=490;
01096     const static tab5=620,tab6=680,tab7=660,tab8=760;
01097     const static vtab1=32,vtab2=47,vtab3=210,vtab4=360,vtab5=320;
01098     static float v[ACADEMIC_STANDING_VAR_COUNT];
01099     static float v2[ACADEMIC_STANDING_VAR_COUNT];
01100     static float v3[ACADEMIC_STANDING_VAR_COUNT];
01101     static int data_num=HISTORY_YEAR_COUNT;
01102     static float *dataArray[ACADEMIC_STANDING_VAR_COUNT];
01103     static float *dataArrayA;
01104     static float da_chg;
01105 
01106     //-----communication with sim engine's Output-----//
01107     int deptRecno = department_array.selected_recno;
01108     Department* cur_dept_ptr = department_array[deptRecno];
01109 
01110     if(department_array.current_data_mode==MODE_DEPARTMENT) {
01111         sys.is_institution_report=0;
01112         dataArrayA=cur_dept_ptr->p_academic_standing_history;
01113         for(int i=0;i<ACADEMIC_STANDING_VAR_COUNT;i++) {
01114             dataArray[i]=cur_dept_ptr->var_academic_standing_history[i];
01115             v[i]=dataArray[i][data_num-1];
01116             v2[i]=cur_dept_ptr->var_change_academic_standing[i];
01117             v3[i]=cur_dept_ptr->var_academic_standing_weight[i]*100;
01118         }
01119     }
01120     else {
01121         sys.is_institution_report=1;
01122         dataArrayA=department_array.p_academic_standing_history;
01123         for(int i=0;i<ACADEMIC_STANDING_VAR_COUNT;i++) {
01124             // BUGHERE -- wait for Fred's preparation
01125             //                  dataArray[i]=department_array.var_educational_quality_history[i];
01126             //                  v[i]=dataArray[i][data_num-1];
01127             dataArray[i]=cur_dept_ptr->var_academic_standing_history[i];
01128             //                  v[i]=(float)i;
01129             //                  v2[i]=cur_dept_ptr->var_change_academic_standing[i];
01130             v[i]=dataArray[i][data_num-1];
01131             v2[i]=cur_dept_ptr->var_change_academic_standing[i];
01132             v3[i]=cur_dept_ptr->var_academic_standing_weight[i]*100;
01133         }
01134     }
01135 
01136     if(info.graph_trimester_passed>1) {
01137         da_chg=(float)(100.0*((double)dataArrayA[data_num-1]-dataArrayA[data_num-2])/dataArrayA[data_num-2]);
01138         if((da_chg<0.0)&&(da_chg>-0.01))
01139             da_chg=0.0;
01140     }
01141     else
01142         da_chg=0.0;
01143 
01144     vga.use_back();
01145     if (refreshFlag == INFO_REPAINT) {
01146         //------------- paint the background ----------------//
01147         user_interface.bg_img(BG_PIC_ID, &vga_back);
01148 
01149         user_interface.brighten(REPORT_X1+100,REPORT_Y1-25,REPORT_X1+630,REPORT_Y1-4);
01150         user_interface.rect(REPORT_X1+100,REPORT_Y1-25,REPORT_X1+630,REPORT_Y1-4,1);
01151         font_charts.put(REPORT_X1+270,REPORT_Y1-19,"Departmental Performance");
01152 
01153         user_interface.brighten(REPORT_X1,REPORT_Y1+vtab1-30,REPORT_X2,REPORT_Y2-10);
01154 
01155         user_interface.rect(REPORT_X1,REPORT_Y1+vtab1-30,REPORT_X2,REPORT_Y1+vtab1-10);
01156         user_interface.rect(REPORT_X1,REPORT_Y1+vtab1-10,REPORT_X2,REPORT_Y1+vtab1+30);
01157         user_interface.rect(REPORT_X1,REPORT_Y1+vtab1+30,REPORT_X2,REPORT_Y2-10);
01158 
01159         //--------------Initialize buttons-------------------//
01160         button_back.create_text( REPORT_X1+tab1+250,
01161                                  REPORT_Y2-1, REPORT_X1+tab1+440, REPORT_Y2+19, "Back" );
01162 
01163         //              button_back.set_key( 'B' );
01164 
01165         //--------------Initialize da_graph-------------------//
01166         as_graphiconA.init(
01167             REPORT_X1+tab5,REPORT_Y1+vtab1-8,
01168             REPORT_X1+tab6,REPORT_Y1+vtab1+28,
01169             1 ,&data_num ,dataArrayA, 1, 0, 3);
01170         da_textA.right_put(
01171             REPORT_X1+tab2+80,REPORT_Y1+vtab1+5,&(dataArrayA[data_num-1]),4);
01172 
01173         da_text_chgA.right_put(
01174             REPORT_X1+tab4+85,REPORT_Y1+vtab1+5,
01175             &da_chg,4);
01176 
01177         font_chartsm.put(REPORT_X1+tab1,REPORT_Y1+vtab1+5,
01178                          "D e p a r t m e n t a l   P r e s t i g e");
01179 
01180         for(int i=0;i<ACADEMIC_STANDING_VAR_COUNT;i++)
01181             as_graphicon[i].init(
01182                 REPORT_X1+tab5-5,REPORT_Y1+vtab1+i*56+40,
01183                 REPORT_X1+tab6+5,REPORT_Y1+vtab1+i*56+68,
01184                 1 ,&data_num ,dataArray[i], 1, 0, 3);
01185         for(i=0;i<ACADEMIC_STANDING_VAR_COUNT;i++) {
01186 #if(GAME_VERSION>=200)
01187             font_chart_purple_sm.right_put( REPORT_X1+tab2+20, REPORT_Y1+vtab1+i*56+50, m.format(cur_dept_ptr->initial_academic_standing[i],4) );
01188 #endif
01189 
01190             if(i==0||i>1&&i<5)
01191                 da_text[i].right_put(REPORT_X1+tab2+80,REPORT_Y1+vtab1+i*56+50,v+i,4);
01192             else
01193                 da_text[i].right_put(REPORT_X1+tab2+80,REPORT_Y1+vtab1+i*56+50,v+i,4);
01194 
01195             da_text2[i].right_put(REPORT_X1+tab3+55,REPORT_Y1+vtab1+i*56+50,v3+i,3);
01196             da_text_chg[i].right_put(REPORT_X1+tab4+85,REPORT_Y1+vtab1+i*56+50,v2+i,4);
01197             help_button_array[i].create_text(REPORT_X1+tab1-23,REPORT_Y1+vtab2+i*56+30,
01198                                              REPORT_X1+tab1-9,REPORT_Y1+vtab2+i*56+44,"?");
01199             image_interface.put_back(REPORT_X1+tab1-21,REPORT_Y1+vtab2+i*56+30,"QUEST_UP");
01200         }
01201 
01202         //-------------- Show Text --------------//
01203         //              font_chartsm.put(REPORT_X1+tab1,REPORT_Y1+vtab1-27,"Contributing factors");
01204         font_chartsm.put(REPORT_X1+tab2+15,REPORT_Y1+vtab1-25,"Current value");
01205         font_chartsm.put(REPORT_X1+tab3+15,REPORT_Y1+vtab1-25,"Weight");
01206         font_chartsm.put(REPORT_X1+tab4+5,REPORT_Y1+vtab1-25,"Last year change");
01207         font_chartsm.put(REPORT_X1+tab5+20,REPORT_Y1+vtab1-25,"Trend");
01208 
01209         for(i=0;i<ACADEMIC_STANDING_VAR_COUNT;i++) {
01210             font_chartsm.put_paragraph(REPORT_X1+tab1+5,REPORT_Y1+vtab1+i*56+48,REPORT_X1+tab2+30,REPORT_Y1+vtab1+i*56+94,departmental_academic_label[i]);
01211         }
01212 
01213         as_graphiconA.paint();
01214         da_textA.paint();
01215 
01216         for(i=0;i<ACADEMIC_STANDING_VAR_COUNT;i++) {
01217             as_graphicon[i].paint();
01218             da_text[i].paint();
01219             da_text2[i].paint();
01220             da_text_chg[i].paint();
01221         }
01222     }
01223     else {
01224         as_graphiconA.refresh();
01225         da_textA.refresh();
01226         da_text_chgA.refresh();
01227         for(int i=0;i<ACADEMIC_STANDING_VAR_COUNT;i++) {
01228             as_graphicon[i].refresh();
01229             da_text[i].refresh();
01230             da_text_chg[i].refresh();
01231         }
01232     }
01233 
01234     vga.use_back();
01235     button_back.paint();
01236 
01237     vga.blt_buf(ZOOM_X1, ZOOM_Y1, ZOOM_X2, ZOOM_Y2);
01238     vga.use_front();
01239 
01240 };
01241 
01242 int detect_departmental_academic() {
01243     const static tab1=30,tab2=320,tab3=420,tab4=490;
01244     const static tab5=620,tab6=680,tab7=660,tab8=760;
01245     const static vtab1=22,vtab2=37,vtab3=200,vtab4=350,vtab5=320;
01246     for(int i=0;i<ACADEMIC_STANDING_VAR_COUNT;i++) {
01247         if(help_button_array[i].detect()) {
01248             // ## begin chwg1022  create the global ResTxt help_resource later //
01249             String str;
01250             str  = DIR_RES;
01251             str += "SCORE";
01252 
01253             ResTxt rs;
01254             rs.init(str);
01255             // ## chwg1022 end ////////////////////////
01256             image_interface.put_back(REPORT_X1+tab1-21,REPORT_Y1+vtab2+i*56+40,"QUEST_DN");
01257             vga.blt_buf(REPORT_X1+tab1-21,REPORT_Y1+vtab2+i*56+40,REPORT_X1+tab1-3,REPORT_Y1+vtab2+i*56+58);
01258             sys.back_view_mode=sys.view_mode;
01259             help_if.help_textlist.topic_id=rs.locate_topic(departmental_academic_label[i]);
01260             if(help_if.help_textlist.topic_id>0) {
01261                 help_if.help_textlist.add_history(help_if.help_textlist.topic_id);
01262                 sys.set_view_mode(MODE_HELP_DESC);
01263                 sys.redraw_all_flag = 1;
01264                 audio.play_wav("BEEPS-1",audio.int_to_DsVolume(config.sound_effect_volume));
01265             }
01266             return 1;
01267         }
01268     }
01269     if(button_back.detect()) {
01270         (*deinit_func_ptr[department_array.current_screen_mode])();
01271         //-------- post display redraw flag -------//
01272         sys.redraw_all_flag = 1;
01273         department_array.current_screen_mode=MODE_DEPT_MAIN;
01274         return 1;
01275     }
01276     return 0;
01277 };
01278 
01279 void deinit_departmental_academic() {
01280     for(int i=0;i<ACADEMIC_STANDING_VAR_COUNT;i++)
01281         as_graphicon[i].deinit();
01282     as_graphiconA.deinit();
01283     da_textA.deinit();
01284     da_text_chgA.deinit();
01285     for(i=0;i<ACADEMIC_STANDING_VAR_COUNT;i++) {
01286         da_text[i].deinit();
01287         da_text2[i].deinit();
01288         da_text_chg[i].deinit();
01289         help_button_array[i].deinit();
01290     }
01291     // ###### begin Gilbert 28/04/2001 #####//
01292     button_back.deinit();
01293     // ###### end Gilbert 28/04/2001 #####//
01294 }
01295 
01296 static void da_disp_rep_row(int recNo, int x, int y, int refreshFlag) {
01297     //----- display financial report -----//
01298     if( refreshFlag == INFO_REPAINT ) {
01299         vga.use_back();
01300         //              user_interface.bar(x, y, REPORT_X2-40, y+REC_HEIGHT,SHEET_COLOR);
01301         //              vga.blt_buf( x, y, REPORT_X2-45, y+REC_HEIGHT-2, 0 );
01302     }
01303 
01304     if(recNo==1) {
01305         font_chartsm.put_paragraph
01306             (
01307