00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "ExManagerObjectWindow.h"
00024
00025 bool ExManagerObjectWindow::m_flag = false;
00026 ExManagerObjectWindow* ExManagerObjectWindow::m_instance = NULL;
00027
00028 ExManagerObjectWindow* ExManagerObjectWindow::CreateSingleton(void){
00029 Guard(ExManagerObjectWindow* ExManagerObjectWindow::CreateSingleton(void))
00030 if(!m_flag)
00031 {
00032 m_flag = true;
00033 m_instance = new ExManagerObjectWindow;
00034 }else
00035 {
00036 std::cout<<"Error singleton already created"<<std::endl;
00037 }
00038 return m_instance;
00039 UnGuard
00040 }
00041
00042 ExManagerObjectWindow::ExManagerObjectWindow(void)
00043 {
00044 Guard(ExManagerObjectWindow::ExManagerObjectWindow(void))
00045
00046 UnGuard
00047 }
00048
00049
00050 ExManagerObjectWindow::~ExManagerObjectWindow(void)
00051 {
00052 Guard(ExManagerObjectWindow::~ExManagerObjectWindow(void))
00053 UnGuard
00054 }
00055
00056
00057 void ExManagerObjectWindow::Reset(void)
00058 {
00059 Guard(void ExManagerObjectWindow::Reset(void))
00060 ExManagerObject<ExCWindow>::Reset();
00061 Load("WindowMainMenu.ExW");
00062
00063 m_DrawAllWindow=true;
00064 UnGuard
00065 }
00066
00067
00068 void ExManagerObjectWindow::Init(void)
00069 {
00070 Guard(void ExManagerObjectWindow::Init(void))
00071 SetStatus(true);
00072 SetAskForCommand(true);
00073 SetAskForExclusifCommand(false);
00074 ExManagerObject<ExCWindow>::Init();
00075
00076
00077
00078
00079
00080
00081
00082
00083 Load("WindowMainMenu.ExW");
00084
00085
00086 m_MoveWindow=false;
00087 ModalWindow=NULL;
00088 m_SizeWhenMinimized=150;
00089 m_DrawAllWindow=true;
00090 UnGuard
00091 }
00092
00093 void ExManagerObjectWindow::Draw(void)
00094 {
00095 Guard(void ExManagerObjectWindow::Draw(void))
00096 glPushAttrib(GL_ALL_ATTRIB_BITS);
00097 glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
00098 if(m_DrawAllWindow)
00099 {
00100 for(m_ItMap=m_Map->begin();m_ItMap!=m_Map->end();m_ItMap++)
00101 {
00102 if(!m_ItMap->second.IsActive())
00103 {
00104 m_ItMap->second.Draw();
00105 }
00106 }
00107 if(m_CurrentObjectId!=-1)GetCurrentObject()->Draw();
00108 }
00109 if(ModalWindow!=NULL)
00110 {
00111 ModalWindow->Draw();
00112 if(ModalWindow->m_BeClosed)
00113 {
00114 delete ModalWindow;
00115 ModalWindow=NULL;
00116 }
00117 }
00118 glPopAttrib();
00119
00120 UnGuard
00121 }
00122
00123 ExCAction ExManagerObjectWindow::InputCommand(ExCCommand Command)
00124 {
00125 Guard(ExCAction ExManagerObjectWindow::InputCommand(ExCCommand Command))
00126
00127 if(ModalWindow!=NULL)
00128 {
00129 return InputAction(ModalWindow->InputCommand(Command));
00130 }
00131
00132 m_LastCommandReceived=Command;
00133 switch(Command.m_Command)
00134 {
00135
00136
00137
00138 case MOUSE_LEFT_BUTTON_DOWN:
00139
00140 if(!m_DrawAllWindow) return NOTHING;
00141 if(m_CurrentObjectId!=-1)
00142 {
00143 if(GetCurrentObject()->PointInWindow(ExCVec2D(Command.m_MousePosx,Command.m_MousePosy)))break;
00144 }
00145 for(m_ItMap=m_Map->begin();m_ItMap!=m_Map->end();m_ItMap++)
00146 {
00147 if(m_ItMap->second.PointInWindow(ExCVec2D(Command.m_MousePosx,Command.m_MousePosy)))
00148 {
00149
00150
00151
00152 if(m_CurrentObjectId!=-1)GetCurrentObject()->SetActive(false);
00153 SetCurrentObject(m_ItMap->second.GetId());
00154 GetCurrentObject()->SetActive(true);
00155
00156 }
00157 }
00158 break;
00159 case MOUSE_LEFT_BUTTON_UP:
00160 if(m_MoveWindow)
00161 {
00162 GetCurrentObject()->SetWindowPosition(ExCVec2D(Command.m_MousePosx,Command.m_MousePosy)-m_MovePointerShift);
00163 m_MoveWindow=false;
00164 }
00165 case MOUSE_MOTION:
00166 if(m_MoveWindow)
00167 {
00168 GetCurrentObject()->SetWindowPosition(ExCVec2D(Command.m_MousePosx,Command.m_MousePosy)-m_MovePointerShift);
00169
00170 }
00171 break;
00172 }
00173
00174 if(m_CurrentObjectId==-1)return NOTHING;
00175 for(m_ItMap=m_Map->begin();m_ItMap!=m_Map->end();m_ItMap++)
00176 {
00177 if(m_ItMap->second.IsActive())
00178 {
00179 if(m_ItMap->second.PointInWindow(ExCVec2D(Command.m_MousePosx,Command.m_MousePosy)))
00180 {
00181 return InputAction(m_ItMap->second.InputCommand(Command));
00182 }
00183 }
00184 }
00185
00186
00187 return NOTHING;
00188 UnGuard
00189 }
00190
00191 void ExManagerObjectWindow::OrganizeMinimizedWindow(void)
00192 {
00193 Guard(void ExManagerObjectWindow::OrganizeMinimizedWindow(void))
00194 int couterx=0,coutery=1;
00195 for(m_ItMap=m_Map->begin();m_ItMap!=m_Map->end();m_ItMap++)
00196 {
00197 if(m_ItMap->second.IsReduced())
00198 {
00199 m_ItMap->second.SetWindowSize(ExCVec2D((ManagerWindow->GetResolutionX()/(ManagerWindow->GetResolutionX()/m_SizeWhenMinimized)),GetCurrentObject()->GetTitleBarSize()));
00200 m_ItMap->second.SetWindowPosition(ExCVec2D((ManagerWindow->GetResolutionX()/(ManagerWindow->GetResolutionX()/m_SizeWhenMinimized))*couterx-1,(ManagerWindow->GetResolutionY()-(GetCurrentObject()->GetTitleBarSize()*coutery-1))));
00201 couterx++;
00202 }
00203 if(couterx>=(ManagerWindow->GetResolutionX()/m_SizeWhenMinimized)-1)
00204 {
00205 couterx=0;
00206 coutery++;
00207 }
00208 }
00209 UnGuard
00210 }
00211
00212
00213 ExCAction ExManagerObjectWindow::InputAction(ExCAction Action)
00214 {
00215 Guard(ExCAction ExManagerObjectWindow::InputAction(ExCAction Action))
00216
00217 ExCVec2D TmpSize,TmpPos;
00218 switch(Action.m_Action)
00219 {
00220 case CLOSE_OBJECT_WINDOW:
00221 if(ModalWindow!=NULL)
00222 {
00223 delete ModalWindow;
00224 ModalWindow=NULL;
00225 return NOTHING;
00226 }
00227
00228 if(m_CurrentObjectId==-1) return NOTHING;
00229 std::cout<<"Close window id:"<<m_CurrentObjectId<<std::endl;
00230 if(RemoveCurrentObject())
00231 {
00232 std::cout<<"Close window succes"<<std::endl;
00233 }else std::cout<<"Close window fail"<<std::endl;
00234 return NOTHING;
00235
00236 case MINIMIZE_OBJECT_WINDOW:
00237
00238
00239 if(!GetCurrentObject()->IsReduced())
00240 {
00241 if(!GetCurrentObject()->IsMaximized())
00242 {
00243 GetCurrentObject()->SetOldWindowSize(GetCurrentObject()->GetWindowSize());
00244 GetCurrentObject()->SetOldPosition(GetCurrentObject()->GetPosition());
00245 }
00246 if(GetCurrentObject()->IsShowWindowContent())
00247 {
00248
00249 }
00250 GetCurrentObject()->SetReduced(true);
00251 GetCurrentObject()->SetWindowOldTitle(GetCurrentObject()->GetWindowTitle());
00252 std::string ShortName(GetCurrentObject()->GetWindowTitle());
00253 ShortName.resize(10);
00254 ShortName.replace(6,4,"...");
00255 GetCurrentObject()->SetWindowTitle(ShortName);
00256 OrganizeMinimizedWindow();
00257 }else
00258 {
00259 GetCurrentObject()->SetWindowSize(ExCVec2D(GetCurrentObject()->GetOldWindowSize()));
00260 GetCurrentObject()->SetWindowPosition(ExCVec2D(GetCurrentObject()->GetOldPosition()));
00261 GetCurrentObject()->SetWindowTitle(GetCurrentObject()->GetWindowOldTitle());
00262 GetCurrentObject()->SetReduced(false);
00263 if(!GetCurrentObject()->IsShowWindowContent())
00264 {
00265 GetCurrentObject()->SetShowWindowContent(true);
00266 }
00267 }
00268
00269 return NOTHING;
00270 case MAXIMIZE_OBJECT_WINDOW:
00271
00272 if(!GetCurrentObject()->IsMaximized())
00273 {
00274 if(!GetCurrentObject()->IsReduced())
00275 {
00276 GetCurrentObject()->SetOldWindowSize(GetCurrentObject()->GetWindowSize());
00277 GetCurrentObject()->SetOldPosition(GetCurrentObject()->GetPosition());
00278 }
00279 GetCurrentObject()->SetWindowSize(ExCVec2D(ManagerWindow->GetResolutionX(),ManagerWindow->GetResolutionY()));
00280 GetCurrentObject()->SetWindowPosition(ExCVec2D(0,0));
00281 GetCurrentObject()->SetMaximized(true);
00282 if(!GetCurrentObject()->IsShowWindowContent())
00283 {
00284 GetCurrentObject()->SetShowWindowContent(true);
00285 }
00286 break;
00287 }else
00288 {
00289 GetCurrentObject()->SetWindowSize(ExCVec2D(GetCurrentObject()->GetOldWindowSize()));
00290 GetCurrentObject()->SetWindowPosition(ExCVec2D(GetCurrentObject()->GetOldPosition()));
00291 GetCurrentObject()->SetMaximized(false);
00292 }
00293 return NOTHING;
00294 case MINIMIZE_TO_BAR_OBJECT_WINDOW:
00295
00296 if(GetCurrentObject()->IsShowWindowContent())
00297 {
00298
00299 }else GetCurrentObject()->SetShowWindowContent(true);
00300 return NOTHING;
00301 case MOUVE_OBJECT_WINDOW:
00302 std::cout<<"Move window:"<<m_CurrentObjectId<<std::endl;
00303 m_MovePointerShift=((ExCVec2D(m_LastCommandReceived.m_MousePosx,m_LastCommandReceived.m_MousePosy)-GetCurrentObject()->GetPosition()));
00304 m_MoveWindow=true;
00305 return NOTHING;
00306 case MESSAGE_BOX:
00307 ModalWindow= new ExCWindowMessageBox(Action.m_Param);
00308 ModalWindow->SetManagerTexture(ManagerTexture);
00309 ModalWindow->SetManagerWindow(ManagerWindow);
00310 break;
00311 case MESSAGE_BOX_QUESTION:
00312 ModalWindow= new ExCWindowMessageBoxQuestion(Action.m_Param,Action.GetParamAsInt(1),Action.GetParamAsInt(2));
00313 ModalWindow->SetManagerTexture(ManagerTexture);
00314 ModalWindow->SetManagerWindow(ManagerWindow);
00315 break;
00316 case LOAD_OBJECT_WINDOW:
00317 Load(Action.m_Param);
00318
00319
00320
00321
00322
00323
00324 break;
00325 case ENABLE_WINDOW:
00326 m_DrawAllWindow=true;
00327 if(m_Map->size()==0)Load("WindowMainMenu.ExW");
00328
00329 break;
00330 case DISABLE_WINDOW:
00331 m_DrawAllWindow=false;
00332 break;
00333 case TOGGLE_WINDOW:
00334 m_DrawAllWindow ? m_DrawAllWindow=false :m_DrawAllWindow=true;
00335 break;
00336 default:
00337 return Action;
00338 }
00339 if(Action.m_NextAction){return *Action.m_NextAction;}
00340 else{return NOTHING;}
00341 UnGuard
00342 }
00343
00344 bool ExManagerObjectWindow::SetCurrentObject(ExNihilo::ExId id)
00345 {
00346 Guard(bool ExManagerObjectWindow::SetCurrentObject(ExNihilo::ExId id))
00347 ExManagerObject<ExCWindow>::SetCurrentObject(id);
00348 GetCurrentObject()->SetActive(true);
00349 return true;
00350 UnGuard
00351 }
00352
00353 bool ExManagerObjectWindow::Load(std::string FileName)
00354 {
00355 Guard(bool ExManagerObjectWindow::Load(std::string FileName))
00356
00357 char buffer[255],b[255];
00358 std::string buffstring;
00359 std::ifstream file,fileControl;
00360 #ifdef UNIX_SRC
00361 sprintf(buffer, PREFIX "/ExNihilo/Data/Window/%s", FileName.data());
00362 #else
00363 sprintf(buffer, "../Data/Window/%s", FileName.data());
00364 #endif
00365
00366 ExCWindow NewWindow;
00367 file.open(buffer,std::ios::in);
00368 if(file.is_open())
00369 {
00370
00371 memset(b,0,255);file.getline(b,256,'\n');
00372 try
00373 {
00374
00375 ExNihilo::ExtracValueFromSring(b,"<WindowHeader>","<#WindowHeader>");
00376 ReadWindowObject(&NewWindow,&file);
00377
00378 memset(b,0,255);file.getline(b,256,'\n');
00379 buffstring=ExNihilo::ExtracValueFromSring(b,"<FileForWindow>","<#FileForWindow>");
00380 ReadWindowSubObject(&NewWindow,buffstring);
00381
00382 memset(b,0,255);file.getline(b,256,'\n');
00383 buffstring=ExNihilo::ExtracValueFromSring(b,"<FileForBar>","<#FileForBar>");
00384 ReadWindowSubObject(&NewWindow,buffstring);
00385
00386 }catch(ExCExpStringNotFound){std::cout<<"Bad file type plok"<<buffer<<std::endl;}
00387 }else
00388 {
00389 std::cout<<"a pouet"<<buffer<<std::endl;
00390 throw ExCExpFileNotFound();
00391 }
00392 file.close();
00393 NewWindow.RefreshPosotion();
00394 NewWindow.RefreshSize();
00395 NewWindow.SetManagerTexture(ManagerTexture);
00396 NewWindow.SetManagerWindow(ManagerWindow);
00397 ExManagerObject<ExCWindow>::Add(NewWindow);
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407 return true;
00408 UnGuard
00409 }
00410
00411 void ExManagerObjectWindow::ReadWindowSubObject(ExCWindow *win,std::string FileName)
00412 {
00413 Guard(void ExManagerObjectWindow::ReadWindowSubObject(ExCWindow *win,std::string FileName))
00414 char buffer[255],b[255];
00415 std::string buffstring;
00416 std::ifstream file,fileButton,fileControl;
00417 #ifdef UNIX_SRC
00418 sprintf(buffer, PREFIX "/ExNihilo/Data/Window/%s", FileName.data());
00419 #else
00420 sprintf(buffer, "../Data/Window/%s", FileName.data());
00421 #endif
00422
00423 file.open(buffer,std::ios::in);
00424
00425 if(file.is_open())
00426 {
00427
00428 memset(b,0,255);file.getline(b,256,'\n');
00429 try
00430 {
00431 buffstring=ExNihilo::ExtracValueFromSring(b,"<WindowHeader>","<#WindowHeader>");
00432 if(strcmp(buffstring.data(),"WindowContent")==0)
00433 {
00434 ReadWindowObject(win->GetWindowContentPointer(),&file);
00435
00436 memset(b,0,255);file.getline(b,256,'\n');
00437 int numberofcontrol=ExNihilo::ExtractIntValueFromSring(b,"<NumberOfControl>","<#NumberOfControl>");
00438 for(int i=0;i<numberofcontrol;i++)
00439 {
00440 memset(b,0,255);file.getline(b,256,'\n');
00441 ReadWindowControlObject(win->GetWindowContentPointer(),ExNihilo::ExtracValueFromSring(b,"<FileControl>","<#FileControl>"));
00442 }
00443 }
00444 if(strcmp(buffstring.data(),"BarContent")==0)
00445 {
00446 ReadWindowObject(win->GetWindowBarPointer(),&file);
00447
00448 memset(b,0,255);file.getline(b,256,'\n');
00449 buffstring=ExNihilo::ExtracValueFromSring(b,"<FileForButtonClose>","<#FileForButtonClose>");
00450 #ifdef UNIX_SRC
00451 sprintf(buffer, PREFIX "/ExNihilo/Data/Window/%s", buffstring.data());
00452 #else
00453 sprintf(buffer, "../Data/Window/%s", buffstring.data());
00454 #endif
00455 fileButton.open(buffer,std::ios::in);
00456 if(fileButton.is_open())
00457 {
00458 memset(b,0,255);fileButton.getline(b,256,'\n');
00459 buffstring=ExNihilo::ExtracValueFromSring(b,"<WindowHeader>","<#WindowHeader>");
00460 ReadWindowObject(win->GetButtonClose(),&fileButton);
00461 win->GetButtonClose()->SetBackroundColor(ExCVec3D(1.0f,1.0f,1.0f));
00462 }fileButton.close();
00463
00464 memset(b,0,255);file.getline(b,256,'\n');
00465 buffstring=ExNihilo::ExtracValueFromSring(b,"<FileForButtonMaximize>","<#FileForButtonMaximize>");
00466 #ifdef UNIX_SRC
00467 sprintf(buffer, PREFIX "/ExNihilo/Data/Window/%s", buffstring.data());
00468 #else
00469 sprintf(buffer, "../Data/Window/%s", buffstring.data());
00470 #endif
00471 fileButton.open(buffer,std::ios::in);
00472 if(fileButton.is_open())
00473 {
00474 memset(b,0,255);fileButton.getline(b,256,'\n');
00475 buffstring=ExNihilo::ExtracValueFromSring(b,"<WindowHeader>","<#WindowHeader>");
00476 ReadWindowObject(win->GetButtonMaximize(),&fileButton);
00477 win->GetButtonMaximize()->SetBackroundColor(ExCVec3D(1.0f,1.0f,1.0f));
00478 }fileButton.close();
00479
00480 memset(b,0,255);file.getline(b,256,'\n');
00481 buffstring=ExNihilo::ExtracValueFromSring(b,"<FileForButtonMinimize>","<#FileForButtonMinimize>");
00482 #ifdef UNIX_SRC
00483 sprintf(buffer, PREFIX "/ExNihilo/Data/Window/%s", buffstring.data());
00484 #else
00485 sprintf(buffer, "../Data/Window/%s", buffstring.data());
00486 #endif
00487 fileButton.open(buffer,std::ios::in);
00488 if(fileButton.is_open())
00489 {
00490 memset(b,0,255);fileButton.getline(b,256,'\n');
00491 buffstring=ExNihilo::ExtracValueFromSring(b,"<WindowHeader>","<#WindowHeader>");
00492 ReadWindowObject(win->GetButtonMinimize(),&fileButton);
00493 win->GetButtonMinimize()->SetBackroundColor(ExCVec3D(1.0f,1.0f,1.0f));
00494 }fileButton.close();
00495
00496 memset(b,0,255);file.getline(b,256,'\n');
00497 buffstring=ExNihilo::ExtracValueFromSring(b,"<FileForButtonMinimizeToBar>","<#FileForButtonMinimizeToBar>");
00498 #ifdef UNIX_SRC
00499 sprintf(buffer, PREFIX "/ExNihilo/Data/Window/%s", buffstring.data());
00500 #else
00501 sprintf(buffer, "../Data/Window/%s", buffstring.data());
00502 #endif
00503 fileButton.open(buffer,std::ios::in);
00504 if(fileButton.is_open())
00505 {
00506 memset(b,0,255);fileButton.getline(b,256,'\n');
00507 buffstring=ExNihilo::ExtracValueFromSring(b,"<WindowHeader>","<#WindowHeader>");
00508 ReadWindowObject(win->GetButtonMinimizeToBar(),&fileButton);
00509 win->GetButtonMinimizeToBar()->SetBackroundColor(ExCVec3D(1.0f,1.0f,1.0f));
00510 }fileButton.close();
00511
00512 }
00513 }catch(ExCExpStringNotFound){std::cout<<"ReadWindowSubObject::ExCExpStringNotFound";}
00514 }else throw ExCExpFileNotFound();
00515 file.close();
00516 UnGuard
00517 }
00518
00519 ExCWindowControl * ExManagerObjectWindow::ReadWindowControlObject(ExCWindowObject *win,std::string FileName)
00520 {
00521 Guard(ExCWindowControl * ExManagerObjectWindow::ReadWindowControlObject(ExCWindowObject *win,std::string FileName))
00522 char buffer[255],b[255];
00523 std::string buffstring;
00524 std::ifstream fileControl;
00525 #ifdef UNIX_SRC
00526 sprintf(buffer, PREFIX "/ExNihilo/Data/Window/%s", FileName.data());
00527 #else
00528 sprintf(buffer, "../Data/Window/%s", FileName.data());
00529 #endif
00530 fileControl.open(buffer,std::ios::in);
00531 if(fileControl.is_open())
00532 {
00533 memset(b,0,255);fileControl.getline(b,256,'\n');
00534 buffstring=ExNihilo::ExtracValueFromSring(b,"<WindowHeader>","<#WindowHeader>");
00535
00536 if(strcmp(buffstring.data(),"ExCWindowLabel")==0)
00537 {
00538 ExCWindowLabel *NewLabel;
00539 NewLabel= new ExCWindowLabel;
00540 ReadWindowObject(NewLabel,&fileControl);
00541 win->AddObjectControl(NewLabel);
00542 }
00543
00544 if(strcmp(buffstring.data(),"ExCWindowButton")==0)
00545 {
00546 ExCWindowButton *NewButton;
00547 NewButton= new ExCWindowButton;
00548 ReadWindowObject(NewButton,&fileControl);
00549
00550 memset(b,0,255);fileControl.getline(b,256,'\n');
00551 buffstring=ExNihilo::ExtracValueFromSring(b,"<ActionCommand>","<#ActionCommand>");
00552 ExCAction Action=ExNihilo::ExtractIntValueFromSring(buffstring,"<Action>","<#Action>");
00553 ExCCommand Command=ExNihilo::ExtractIntValueFromSring(buffstring,"<Command>","<#Command>");
00554 Action.m_Param=ExNihilo::ExtracValueFromSring(buffstring,"<Param>","<#Param>");
00555 NewButton->AddActionCommand(Action,Command);
00556 win->AddObjectControl(NewButton);
00557 }
00558
00559 if(strcmp(buffstring.data(),"ExCWindowButtonSwitch")==0)
00560 {
00561 std::ifstream fileB1,fileB2;
00562 ExCWindowButtonSwitch *NewButton;
00563 NewButton= new ExCWindowButtonSwitch;
00564 ReadWindowObject(NewButton,&fileControl);
00565 ExCWindowButton * Butt1,*Butt2;
00566 Butt1=new ExCWindowButton;
00567 Butt2=new ExCWindowButton;
00568
00569
00570 memset(b,0,255);fileControl.getline(b,256,'\n');
00571 buffstring=ExNihilo::ExtracValueFromSring(b,"<Button1>","<#Button1>");
00572 ReadWindowObject(Butt1,buffstring,&fileB1);
00573 NewButton->m_Butt1=Butt1;
00574
00575
00576
00577 memset(b,0,255);fileControl.getline(b,256,'\n');
00578 buffstring=ExNihilo::ExtracValueFromSring(b,"<Button2>","<#Button2>");
00579 ReadWindowObject(Butt2,buffstring,&fileB2);
00580 NewButton->m_Butt2=Butt2;
00581
00582
00583 memset(b,0,255);fileB1.getline(b,256,'\n');
00584 buffstring=ExNihilo::ExtracValueFromSring(b,"<ActionCommand>","<#ActionCommand>");
00585 ExCAction Action=ExNihilo::ExtractIntValueFromSring(buffstring,"<Action>","<#Action>");
00586 ExCCommand Command=ExNihilo::ExtractIntValueFromSring(buffstring,"<Command>","<#Command>");
00587 Action.m_Param=ExNihilo::ExtracValueFromSring(buffstring,"<Param>","<#Param>");
00588 Butt1->AddActionCommand(Action,Command);
00589 fileB1.close();
00590
00591
00592 memset(b,0,255);fileB2.getline(b,256,'\n');
00593 buffstring=ExNihilo::ExtracValueFromSring(b,"<ActionCommand>","<#ActionCommand>");
00594 Action=ExNihilo::ExtractIntValueFromSring(buffstring,"<Action>","<#Action>");
00595 Command=ExNihilo::ExtractIntValueFromSring(buffstring,"<Command>","<#Command>");
00596 Action.m_Param=ExNihilo::ExtracValueFromSring(buffstring,"<Param>","<#Param>");
00597 Butt2->AddActionCommand(Action,Command);
00598 fileB2.close();
00599
00600 NewButton->SwitchValue();
00601
00602 win->AddObjectControl(NewButton);
00603 }
00604
00605 if(strcmp(buffstring.data(),"ExCWindowButtonSwitchOnMouse")==0)
00606 {
00607 std::ifstream fileB1,fileB2;
00608 ExCWindowButtonSwitchOnMouse *NewButton;
00609 NewButton= new ExCWindowButtonSwitchOnMouse;
00610 ReadWindowObject(NewButton,&fileControl);
00611 ExCWindowButton * Butt1,*Butt2;
00612 Butt1=new ExCWindowButton;
00613 Butt2=new ExCWindowButton;
00614
00615
00616 memset(b,0,255);fileControl.getline(b,256,'\n');
00617 buffstring=ExNihilo::ExtracValueFromSring(b,"<Button1>","<#Button1>");
00618 ReadWindowObject(Butt1,buffstring,&fileB1);
00619 NewButton->m_Butt1=Butt1;
00620
00621
00622
00623 memset(b,0,255);fileControl.getline(b,256,'\n');
00624 buffstring=ExNihilo::ExtracValueFromSring(b,"<Button2>","<#Button2>");
00625 ReadWindowObject(Butt2,buffstring,&fileB2);
00626 NewButton->m_Butt2=Butt2;
00627
00628
00629 memset(b,0,255);fileB1.getline(b,256,'\n');
00630 buffstring=ExNihilo::ExtracValueFromSring(b,"<ActionCommand>","<#ActionCommand>");
00631 ExCAction Action=ExNihilo::ExtractIntValueFromSring(buffstring,"<Action>","<#Action>");
00632 ExCCommand Command=ExNihilo::ExtractIntValueFromSring(buffstring,"<Command>","<#Command>");
00633 Action.m_Param=ExNihilo::ExtracValueFromSring(buffstring,"<Param>","<#Param>");
00634 Butt1->AddActionCommand(Action,Command);
00635 fileB1.close();
00636
00637
00638 memset(b,0,255);fileB2.getline(b,256,'\n');
00639 buffstring=ExNihilo::ExtracValueFromSring(b,"<ActionCommand>","<#ActionCommand>");
00640 Action=ExNihilo::ExtractIntValueFromSring(buffstring,"<Action>","<#Action>");
00641 Command=ExNihilo::ExtractIntValueFromSring(buffstring,"<Command>","<#Command>");
00642 Action.m_Param=ExNihilo::ExtracValueFromSring(buffstring,"<Param>","<#Param>");
00643 Butt2->AddActionCommand(Action,Command);
00644 fileB2.close();
00645
00646 NewButton->SwitchValue();
00647
00648 win->AddObjectControl(NewButton);
00649 }
00650 }
00651 fileControl.close();
00652 return NULL;
00653 UnGuard
00654 }
00655
00656 std::string ExManagerObjectWindow::ReadWindowObject(ExCWindowObject *win,std::string FileName)
00657 {
00658 Guard(std::string ExManagerObjectWindow::ReadWindowObject(ExCWindowObject *win,std::string FileName))
00659 char buffer[255],b[255];
00660 std::string buffstring;
00661 std::ifstream fileControl;
00662 #ifdef UNIX_SRC
00663 sprintf(buffer, PREFIX "/ExNihilo/Data/Window/%s", FileName.data());
00664 #else
00665 sprintf(buffer, "../Data/Window/%s", FileName.data());
00666 #endif
00667 fileControl.open(buffer,std::ios::in);
00668 if(fileControl.is_open())
00669 {
00670 memset(b,0,255);fileControl.getline(b,256,'\n');
00671 buffstring=ExNihilo::ExtracValueFromSring(b,"<WindowHeader>","<#WindowHeader>");
00672 ReadWindowObject(win,&fileControl);
00673 }
00674 fileControl.close();
00675 return buffstring;
00676 UnGuard
00677 }
00678
00679 std::string ExManagerObjectWindow::ReadWindowObject(ExCWindowObject *win,std::string FileName,std::ifstream *fileReturn)
00680 {
00681 Guard(std::string ExManagerObjectWindow::ReadWindowObject(ExCWindowObject *win,std::string FileName,std::ifstream *fileReturn))
00682 char buffer[255],b[255];
00683 std::string buffstring;
00684 #ifdef UNIX_SRC
00685 sprintf(buffer, PREFIX "/ExNihilo/Data/Window/%s", FileName.data());
00686 #else
00687 sprintf(buffer, "../Data/Window/%s", FileName.data());
00688 #endif
00689 fileReturn->open(buffer,std::ios::in);
00690 if(fileReturn->is_open())
00691 {
00692 memset(b,0,255);fileReturn->getline(b,256,'\n');
00693 buffstring=ExNihilo::ExtracValueFromSring(b,"<WindowHeader>","<#WindowHeader>");
00694 ReadWindowObject(win,fileReturn);
00695 }
00696 return buffstring;
00697 UnGuard
00698 }
00699 void ExManagerObjectWindow::ReadWindowObject(ExCWindowObject *win,std::ifstream *file)
00700 {
00701 Guard(void ExManagerObjectWindow::ReadWindowObject(ExCWindowObject *win,std::ifstream *file))
00702 char b[255];
00703 std::string buffstring;
00704 try
00705 {
00706
00707 memset(b,0,255);file->getline(b,256,'\n');
00708 try
00709 {
00710 buffstring=ExNihilo::ExtracValueFromSring(b,"<WindowPosition>","<#WindowPosition>");
00711 win->SetPosition(ExCVec2D(ExNihilo::ExtractFloatValueFromSring(buffstring,"<X>","<#X>"),
00712 ExNihilo::ExtractFloatValueFromSring(buffstring,"<Y>","<#Y>")));
00713 }catch(ExCExpStringNotFound){std::cout<<"Error Reading WindowPosition:"<<buffstring<<std::endl;}
00714
00715 memset(b,0,255);file->getline(b,256,'\n');
00716 try
00717 {
00718 buffstring=ExNihilo::ExtracValueFromSring(b,"<WindowSize>","<#WindowSize>");
00719 win->SetWindowSize(ExCVec2D(ExNihilo::ExtractFloatValueFromSring(buffstring,"<X>","<#X>"),
00720 ExNihilo::ExtractFloatValueFromSring(buffstring,"<Y>","<#Y>")));
00721 }catch(ExCExpStringNotFound){std::cout<<"Error Reading WindowSize"<<std::endl;}
00722
00723 memset(b,0,255);file->getline(b,256,'\n');
00724 try
00725 {
00726 win->SetTitleBarSize(ExNihilo::ExtractFloatValueFromSring(b,"<TitleBarSize>","<#TitleBarSize>"));
00727 }catch(ExCExpStringNotFound){std::cout<<"Error Reading TitleBarSize"<<std::endl;}
00728
00729 memset(b,0,255);file->getline(b,256,'\n');
00730 try
00731 {
00732 win->SetWindowTitle(ExNihilo::ExtracValueFromSring(b,"<WindowTitle>","<#WindowTitle>"));
00733 }catch(ExCExpStringNotFound){std::cout<<"Error Reading WindowTitle"<<std::endl;}
00734
00735 memset(b,0,255);file->getline(b,256,'\n');
00736 try
00737 {
00738 buffstring=ExNihilo::ExtracValueFromSring(b,"<WindowTitleColor>","<#WindowTitleColor>");
00739 win->SetWindowTitleColor(ExCVec3D(ExNihilo::ExtractFloatValueFromSring(buffstring,"<X>","<#X>"),
00740 ExNihilo::ExtractFloatValueFromSring(buffstring,"<Y>","<#Y>"),
00741 ExNihilo::ExtractFloatValueFromSring(buffstring,"<Z>","<#Z>")));
00742 }catch(ExCExpStringNotFound){std::cout<<"Error Reading WindowTitleColor"<<std::endl;}
00743
00744 memset(b,0,255);file->getline(b,256,'\n');
00745 try
00746 {
00747 if(0!=ExNihilo::ExtractIntValueFromSring(b,"<IsBackroundBlending>","<#IsBackroundBlending>"))
00748 {
00749 memset(b,0,255);file->getline(b,256,'\n');
00750 win->SetBackroundBlending(true,ExNihilo::ExtractFloatValueFromSring(b,"<BackroundBlendingValue>","<#BackroundBlendingValue>"));
00751 }else
00752 {
00753 memset(b,0,255);file->getline(b,256,'\n');
00754 win->SetBackroundBlending(false,ExNihilo::ExtractFloatValueFromSring(b,"<BackroundBlendingValue>","<#BackroundBlendingValue>"));
00755 }
00756 }catch(ExCExpStringNotFound){std::cout<<"Error Reading IsBackroundBlending"<<std::endl;}
00757
00758 memset(b,0,255);file->getline(b,256,'\n');
00759 try
00760 {
00761 buffstring=ExNihilo::ExtracValueFromSring(b,"<BackroundColor>","<#BackroundColor>");
00762 win->SetBackroundColor(ExCVec3D(ExNihilo::ExtractFloatValueFromSring(buffstring,"<X>","<#X>"),
00763 ExNihilo::ExtractFloatValueFromSring(buffstring,"<Y>","<#Y>"),
00764 ExNihilo::ExtractFloatValueFromSring(buffstring,"<Z>","<#Z>")));
00765 }catch(ExCExpStringNotFound){std::cout<<"Error Reading BackroundColor"<<std::endl;}
00766
00767 memset(b,0,255);file->getline(b,256,'\n');
00768 try
00769 {
00770 if(0!=ExNihilo::ExtractIntValueFromSring(b,"<ShowBorder>","<#ShowBorder>"))
00771 {
00772 win->SetShowBorder(true);
00773 }else
00774 {
00775 win->SetShowBorder(false);
00776 }
00777 }catch(ExCExpStringNotFound){std::cout<<"Error Reading ShowBorder"<<std::endl;}
00778
00779 memset(b,0,255);file->getline(b,256,'\n');
00780 try
00781 {
00782 buffstring=ExNihilo::ExtracValueFromSring(b,"<BorderColor>","<#BorderColor>");
00783 win->SetBorderColor(ExCVec3D(ExNihilo::ExtractFloatValueFromSring(buffstring,"<X>","<#X>"),
00784 ExNihilo::ExtractFloatValueFromSring(buffstring,"<Y>","<#Y>"),
00785 ExNihilo::ExtractFloatValueFromSring(buffstring,"<Z>","<#Z>")));
00786 }catch(ExCExpStringNotFound){std::cout<<"Error Reading BorderColor"<<std::endl;}
00787
00788 memset(b,0,255);file->getline(b,256,'\n');
00789 try
00790 {
00791 if(0!=ExNihilo::ExtractIntValueFromSring(b,"<BackroundIsTexturing1>","<#BackroundIsTexturing1>"))
00792 {
00793 memset(b,0,255);file->getline(b,256,'\n');
00794 win->SetBackroundTexturing1(true,ExNihilo::ExtracValueFromSring(b,"<BackroundTexture1>","<#BackroundTexture1>"));
00795 }else
00796 {
00797 memset(b,0,255);file->getline(b,256,'\n');
00798 win->SetBackroundTexturing1(false,ExNihilo::ExtracValueFromSring(b,"<BackroundTexture1>","<#BackroundTexture1>"));
00799 }
00800 }catch(ExCExpStringNotFound){std::cout<<"Error Reading BackroundIsTexturing1 :"<<buffstring<<std::endl;}
00801
00802 memset(b,0,255);file->getline(b,256,'\n');
00803 try
00804 {
00805 if(0!=ExNihilo::ExtractIntValueFromSring(b,"<BackroundIsTexturing2>","<#BackroundIsTexturing2>"))
00806 {
00807 memset(b,0,255);file->getline(b,256,'\n');
00808 win->SetBackroundTexturing2(true,ExNihilo::ExtracValueFromSring(b,"<BackroundTexture2>","<#BackroundTexture2>"));
00809 }else
00810 {
00811 memset(b,0,255);file->getline(b,256,'\n');
00812 win->SetBackroundTexturing2(false,ExNihilo::ExtracValueFromSring(b,"<BackroundTexture2>","<#BackroundTexture2>"));
00813 }
00814 }catch(ExCExpStringNotFound){std::cout<<"Error Reading BackroundIsTexturing2:"<<buffstring<<std::endl;}
00815
00816 memset(b,0,255);file->getline(b,256,'\n');
00817 try
00818 {
00819 if(0!=ExNihilo::ExtractIntValueFromSring(b,"<TextureIsMouving>","<#TextureIsMouving>"))
00820 {
00821 win->SetTextureIsMouving(true);
00822 }else
00823 {
00824 win->SetTextureIsMouving(false);
00825 }
00826 }catch(ExCExpStringNotFound){std::cout<<"Error Reading TextureIsMouving"<<std::endl;}
00827
00828 memset(b,0,255);file->getline(b,256,'\n');
00829 try
00830 {
00831 buffstring=ExNihilo::ExtracValueFromSring(b,"<TextureMouvingVec>","<#TextureMouvingVec>");
00832 win->SetTextureMouvingVec(ExCVec2D(ExNihilo::ExtractFloatValueFromSring(buffstring,"<X>","<#X>"),
00833 ExNihilo::ExtractFloatValueFromSring(buffstring,"<Y>","<#Y>")));
00834 }catch(ExCExpStringNotFound){std::cout<<"Error Reading TextureMouvingVec:"<<buffstring<<std::endl;}
00835 }catch(...){throw ExCExpFileReadError();}
00836 UnGuard
00837 }
00838