paragui-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paragui-cvs] CVS: paragui/src/core pgapplication.cpp,1.1,1.1.2.1 pgfile


From: Alexander Pipelka <address@hidden>
Subject: [paragui-cvs] CVS: paragui/src/core pgapplication.cpp,1.1,1.1.2.1 pgfilearchive.cpp,1.1,1.1.2.1 pgmessageobject.cpp,1.1,1.1.2.1 pgrectlist.cpp,1.1,1.1.2.1
Date: Tue, 16 Apr 2002 14:06:44 -0400

Update of /cvsroot/paragui/paragui/src/core
In directory subversions:/tmp/cvs-serv11803/src/core

Modified Files:
      Tag: devel-1-1
        pgapplication.cpp pgfilearchive.cpp pgmessageobject.cpp 
        pgrectlist.cpp 
Log Message:
- opened "devel-1-1" (unstable) branch
- new PG_RectList implementation (uses the iterator as index)
- removed obsolete glmode flags
- removed obsolete bulkmode flags from PG_Application
- fixed ProcessEvent function (different signatures of the virtual function)



Index: pgapplication.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/core/pgapplication.cpp,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -C2 -r1.1 -r1.1.2.1
*** pgapplication.cpp   15 Apr 2002 14:53:56 -0000      1.1
--- pgapplication.cpp   16 Apr 2002 18:06:41 -0000      1.1.2.1
***************
*** 51,56 ****
  std::string PG_Application::app_path = "";
  PG_Theme* PG_Application::my_Theme = NULL;
! bool PG_Application::bulkMode = false;
! bool PG_Application::glMode = false;
  bool PG_Application::emergencyQuit = false;
  bool PG_Application::enableBackground = true;
--- 51,55 ----
  std::string PG_Application::app_path = "";
  PG_Theme* PG_Application::my_Theme = NULL;
! //bool PG_Application::bulkMode = false;
  bool PG_Application::emergencyQuit = false;
  bool PG_Application::enableBackground = true;
***************
*** 213,217 ****
  }
  
! void PG_Application::DrawCursor() {
        int x, y;
        PG_Rect saved;
--- 212,216 ----
  }
  
! void PG_Application::DrawCursor(bool bRestoreOld) {
        int x, y;
        PG_Rect saved;
***************
*** 226,230 ****
        SDL_GetMouseState(&x, &y);
        saved = my_mouse_position;
!       if(!GetBulkMode()) {
                ClearOldMousePosition();
        }
--- 225,229 ----
        SDL_GetMouseState(&x, &y);
        saved = my_mouse_position;
!       if(bRestoreOld) {
                ClearOldMousePosition();
        }
***************
*** 232,236 ****
        my_mouse_position.my_ypos = y;
        SDL_BlitSurface(my_mouse_pointer, 0, screen, &my_mouse_position);
!       if(!GetBulkMode()) {
                SDL_UpdateRects(screen, 1, &saved);
                SDL_UpdateRects(screen, 1, &my_mouse_position);
--- 231,235 ----
        my_mouse_position.my_ypos = y;
        SDL_BlitSurface(my_mouse_pointer, 0, screen, &my_mouse_position);
!       if(bRestoreOld) {
                SDL_UpdateRects(screen, 1, &saved);
                SDL_UpdateRects(screen, 1, &my_mouse_position);
***************
*** 334,339 ****
        PG_Application::screen = surf;
  
-       glMode = (surf->flags & SDL_OPENGLBLIT);
- 
        SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 
SDL_DEFAULT_REPEAT_INTERVAL);
        SDL_EnableUNICODE(true);
--- 333,336 ----
***************
*** 395,399 ****
        static PG_Rect screenrect(0,0,screen->w,screen->h);
  
!       if(GetBulkMode() || !enableBackground) {
                return;
        }
--- 392,396 ----
        static PG_Rect screenrect(0,0,screen->w,screen->h);
  
!       if(!enableBackground) {
                return;
        }
***************
*** 613,619 ****
  
  bool PG_Application::eventQuit(int id, PG_MessageObject* widget, unsigned 
long data) {
!       if(GetBulkMode()) {
                return false;
!       }
  
        my_quitEventLoop = true;
--- 610,616 ----
  
  bool PG_Application::eventQuit(int id, PG_MessageObject* widget, unsigned 
long data) {
!       /*if(GetBulkMode()) {
                return false;
!       }*/
  
        my_quitEventLoop = true;
***************
*** 628,634 ****
  }
  
! void PG_Application::SetBulkMode(bool bulk) {
        bulkMode = bulk;
! }
  
  void PG_Application::Shutdown() {
--- 625,631 ----
  }
  
! /*void PG_Application::SetBulkMode(bool bulk) {
        bulkMode = bulk;
! }*/
  
  void PG_Application::Shutdown() {
***************
*** 900,910 ****
  }
  
! bool PG_Application::GetBulkMode() {
        return bulkMode;
! }
! 
! bool PG_Application::GetGLMode() {
!               return glMode;
! }
  
  void PG_Application::EnableBackground(bool enable) {
--- 897,903 ----
  }
  
! /*bool PG_Application::GetBulkMode() {
        return bulkMode;
! }*/
  
  void PG_Application::EnableBackground(bool enable) {

Index: pgfilearchive.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/core/pgfilearchive.cpp,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -C2 -r1.1 -r1.1.2.1
*** pgfilearchive.cpp   15 Apr 2002 14:53:56 -0000      1.1
--- pgfilearchive.cpp   16 Apr 2002 18:06:41 -0000      1.1.2.1
***************
*** 247,251 ****
        delete srfdata;
        
!       if(convert && !PG_Application::GetGLMode()) {
                SDL_Surface* tmpsrf = SDL_DisplayFormat(surface);
                if(tmpsrf) {
--- 247,251 ----
        delete srfdata;
        
!       if(convert) {
                SDL_Surface* tmpsrf = SDL_DisplayFormat(surface);
                if(tmpsrf) {

Index: pgmessageobject.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/core/pgmessageobject.cpp,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -C2 -r1.1 -r1.1.2.1
*** pgmessageobject.cpp 15 Apr 2002 14:53:56 -0000      1.1
--- pgmessageobject.cpp 16 Apr 2002 18:06:41 -0000      1.1.2.1
***************
*** 88,92 ****
  /** message dispatcher */
  
! bool PG_MessageObject::ProcessEvent(const SDL_Event* event) {
        MSG_MESSAGE* msg = NULL;
        SDL_Event e;
--- 88,92 ----
  /** message dispatcher */
  
! bool PG_MessageObject::ProcessEvent(const SDL_Event* event, bool bModal) {
        MSG_MESSAGE* msg = NULL;
        SDL_Event e;

Index: pgrectlist.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/core/pgrectlist.cpp,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -C2 -r1.1 -r1.1.2.1
*** pgrectlist.cpp      15 Apr 2002 14:53:56 -0000      1.1
--- pgrectlist.cpp      16 Apr 2002 18:06:41 -0000      1.1.2.1
***************
*** 38,56 ****
  PG_RectList::~PG_RectList() {}
  
! PG_RectList PG_RectList::Intersect(PG_Rect* rect, int first, int last) {
        PG_RectList result;
-       int s = (last == -1) ? size() : last;
  
        PG_Widget* testwidget;
        PG_Rect* testrect;
  
-       // clear previous list
-       result.clear();
- 
        // loop through all rects
!       for(int i=first; i<s; i++) {
  
                // get the next rectangle to test
!               testwidget = (*this)[i];
  
                if(!testwidget->IsVisible()) {
--- 38,52 ----
  PG_RectList::~PG_RectList() {}
  
! PG_RectList PG_RectList::Intersect(PG_Rect* rect, PG_RectList::iterator 
first, PG_RectList::iterator last) {
        PG_RectList result;
  
        PG_Widget* testwidget;
        PG_Rect* testrect;
  
        // loop through all rects
!       for(PG_RectList::iterator i=first; i != last; i++) {
  
                // get the next rectangle to test
!               testwidget = (*i);
  
                if(!testwidget->IsVisible()) {
***************
*** 59,63 ****
  
                testrect = testwidget->GetClipRect();
!               if(rect->OverlapRect(*testrect)) {
                        // append the matching rectangle
                        result.Add(testwidget);
--- 55,59 ----
  
                testrect = testwidget->GetClipRect();
!               if(rect->OverlapRect(testrect)) {
                        // append the matching rectangle
                        result.Add(testwidget);
***************
*** 73,79 ****
  
        // loop down all rects till we find a match
!       for(int i=size()-1; i>=0; i--) {
  
!               testrect = (*this)[i];
  
                // check if the tested rect is visible
--- 69,75 ----
  
        // loop down all rects till we find a match
!       for(reverse_iterator i=rbegin(); i != rend(); i++) {
  
!               testrect = (*i);
  
                // check if the tested rect is visible
***************
*** 93,150 ****
  
  void PG_RectList::Add(PG_Widget* rect) {
-       indexmap[rect] = size();
-       
-       /*iterator i = find(begin(), end(), rect);
-               
-       if(i != end()) {
-               PG_LogWRN("Trying to add an existing entry to the rectlist!");
-               return;
-       }*/
-       
        push_back(rect);
! }
! 
! void PG_RectList::UpdateIndexMap() {
!       indexmap.clear();
! 
!       int index = 0;
!       for(iterator i = begin(); i != end(); i++) {
!               indexmap[(*i)] = index;
!               index++;
!       }
  }
  
  bool PG_RectList::Remove(PG_Rect* rect) {
!       iterator mark = end();
! 
!       int index = 0;
!       for(iterator i = begin(); i != end(); i++) {
!               indexmap.erase((*i));
!               if(*i == rect) {
!                       mark = i;
!               } else {
!                       indexmap[(*i)] = index;
!                       index++;
!               }
!       }
! 
!       if(mark != end()) {
!               erase(mark);
!               return true;
        }
! 
!       return false;
  }
  
! int PG_RectList::FindIndexOf(PG_Rect* rect) {
!       int index = -1;
! 
        PG_RectListMap::iterator im = indexmap.find(rect);
  
        if(im != indexmap.end()) {
!               index = (*im).second;
        }
  
!       return index;
  }
  
--- 89,115 ----
  
  void PG_RectList::Add(PG_Widget* rect) {
        push_back(rect);
!       indexmap[rect] = --end(); //find(begin(), end(), rect);
  }
  
  bool PG_RectList::Remove(PG_Rect* rect) {
!       if(FindIndexOf(rect) == end()) {
!               return false;
        }
!       
!       PG_RectList::iterator i = indexmap[rect];
!       indexmap.erase(rect);
!       erase(i);
!       return true;
  }
  
! PG_RectList::iterator PG_RectList::FindIndexOf(PG_Rect* rect) {
        PG_RectListMap::iterator im = indexmap.find(rect);
  
        if(im != indexmap.end()) {
!               return (*im).second;
        }
  
!       return end();
  }
  
***************
*** 166,171 ****
                // calculate the clipping rectangle
                // cliprect = blittingregion / widgetcliprect
!               PG_Rect* cr = (*i)->GetClipRect();
!               PG_Rect c = cr->IntersectRect(rect);
                SDL_SetClipRect(screen, &c);
  
--- 131,135 ----
                // calculate the clipping rectangle
                // cliprect = blittingregion / widgetcliprect
!               PG_Rect c = (*i)->GetClipRect()->IntersectRect(rect);
                SDL_SetClipRect(screen, &c);
  
***************
*** 214,218 ****
  
        insert(begin(), rect);
!       UpdateIndexMap();
  
        return true;
--- 178,182 ----
  
        insert(begin(), rect);
!       indexmap[rect] = begin();
  
        return true;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]