[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paragui-cvs] CVS: paragui/src/core pgapplication.cpp,1.6,1.7 pgmessageo
From: |
Alexander Pipelka <address@hidden> |
Subject: |
[paragui-cvs] CVS: paragui/src/core pgapplication.cpp,1.6,1.7 pgmessageobject.cpp,1.5,1.6 |
Date: |
Tue, 30 Apr 2002 10:07:21 -0400 |
Update of /cvsroot/paragui/paragui/src/core
In directory subversions:/tmp/cvs-serv25287/src/core
Modified Files:
pgapplication.cpp pgmessageobject.cpp
Log Message:
moved functions and data members to PG_Application
Index: pgapplication.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/core/pgapplication.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** pgapplication.cpp 30 Apr 2002 10:18:39 -0000 1.6
--- pgapplication.cpp 30 Apr 2002 14:07:19 -0000 1.7
***************
*** 66,69 ****
--- 66,71 ----
int PG_Application::my_backmode;
bool PG_Application::my_quitEventLoop = false;
+ std::vector<PG_MessageObject*> PG_Application::objectList;
+ PG_Widget* PG_Application::lastwidget = NULL;
/**
***************
*** 1009,1012 ****
--- 1011,1044 ----
return processed;
}
+
+ bool PG_Application::RegisterObject(PG_MessageObject* obj) {
+ objectList.push_back(obj);
+ return true;
+ }
+
+ bool PG_Application::UnregisterObject(PG_MessageObject* obj) {
+
+ if (lastwidget == obj) {
+ lastwidget = NULL;
+ }
+
+ std::vector<PG_MessageObject*>::iterator list = objectList.begin();
+
+ // search the object
+ list = std::find(objectList.begin(), objectList.end(), obj);
+
+ // check if object was found
+ if(list == objectList.end()) {
+ PG_LogWRN("PG_MessageObject::RemoveObject(..)");
+ PG_LogWRN("Trying to remove non-existent object from the list
!!");
+ return false;
+ }
+
+ // remove the object from the chain
+ objectList.erase(list);
+
+ return true;
+ }
+
/*
Index: pgmessageobject.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/core/pgmessageobject.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** pgmessageobject.cpp 30 Apr 2002 10:18:39 -0000 1.5
--- pgmessageobject.cpp 30 Apr 2002 14:07:19 -0000 1.6
***************
*** 27,41 ****
*/
- #include <iostream>
#include "pgmessageobject.h"
- #include "pgwidget.h"
#include "pglog.h"
! #include <algorithm>
// static variables for message processing
- std::vector<PG_MessageObject*> PG_MessageObject::objectList;
PG_MessageObject* PG_MessageObject::captureObject = NULL;
PG_MessageObject* PG_MessageObject::inputFocusObject = NULL;
- PG_Widget* PG_MessageObject::lastwidget = NULL;
/** constructor */
--- 27,37 ----
*/
#include "pgmessageobject.h"
#include "pglog.h"
! #include "pgapplication.h"
// static variables for message processing
PG_MessageObject* PG_MessageObject::captureObject = NULL;
PG_MessageObject* PG_MessageObject::inputFocusObject = NULL;
/** constructor */
***************
*** 48,72 ****
my_oldFocus = NULL;
! objectList.push_back(this);
- // init mutexes
- //my_mutexReceiveMessage = SDL_CreateMutex();
}
/** destructor */
-
PG_MessageObject::~PG_MessageObject() {
! // destroy mutex
! //SDL_DestroyMutex(my_mutexReceiveMessage);
! //my_mutexReceiveMessage = NULL;
!
! RemoveObject(this);
if (inputFocusObject == this)
inputFocusObject = NULL;
- if (lastwidget == this)
- lastwidget = NULL;
}
--- 44,61 ----
my_oldFocus = NULL;
! // register object
! PG_Application::RegisterObject(this);
}
/** destructor */
PG_MessageObject::~PG_MessageObject() {
! // unregister object
! PG_Application::UnregisterObject(this);
if (inputFocusObject == this)
inputFocusObject = NULL;
}
***************
*** 83,92 ****
SDL_Event e;
- //if(SDL_mutexP(my_mutexReceiveMessage) == -1)
- // return false;
-
// check if we are able to process messages
if(!my_canReceiveMessages) {
- //SDL_mutexV(my_mutexReceiveMessage);
return false;
}
--- 72,77 ----
***************
*** 95,99 ****
if(captureObject != this)
if(!AcceptEvent(event)) {
- //SDL_mutexV(my_mutexReceiveMessage);
return false;
}
--- 80,83 ----
***************
*** 106,157 ****
while(SDL_PeepEvents(&e, 1, SDL_GETEVENT, SDL_MOUSEMOTIONMASK) > 0);
- bool rc = false;
-
// dispatch message
switch(event->type) {
case SDL_ACTIVEEVENT:
! rc = eventActive(&event->active);
! break;
case SDL_KEYDOWN:
! rc = eventKeyDown(&event->key);
! break;
case SDL_KEYUP:
! rc = eventKeyUp(&event->key);
! break;
case SDL_MOUSEMOTION:
! rc = eventMouseMotion(&event->motion);
! break;
case SDL_MOUSEBUTTONDOWN:
! rc = eventMouseButtonDown(&event->button);
! break;
case SDL_MOUSEBUTTONUP:
! rc = eventMouseButtonUp(&event->button);
! break;
case SDL_QUIT:
! rc = eventQuit(PG_IDAPPLICATION, NULL, (unsigned
long)&event->quit);
! break;
case SDL_SYSWMEVENT:
! rc = eventSysWM(&event->syswm);
! break;
case SDL_VIDEORESIZE:
! rc = eventResize(&event->resize);
! break;
default:
- rc = false;
break;
}
! //SDL_mutexV(my_mutexReceiveMessage);
!
! return rc;
}
--- 90,127 ----
while(SDL_PeepEvents(&e, 1, SDL_GETEVENT, SDL_MOUSEMOTIONMASK) > 0);
// dispatch message
switch(event->type) {
case SDL_ACTIVEEVENT:
! return eventActive(&event->active);
case SDL_KEYDOWN:
! return eventKeyDown(&event->key);
case SDL_KEYUP:
! return eventKeyUp(&event->key);
case SDL_MOUSEMOTION:
! return eventMouseMotion(&event->motion);
case SDL_MOUSEBUTTONDOWN:
! return eventMouseButtonDown(&event->button);
case SDL_MOUSEBUTTONUP:
! return eventMouseButtonUp(&event->button);
case SDL_QUIT:
! return eventQuit(PG_IDAPPLICATION, NULL, (unsigned
long)&event->quit);
case SDL_SYSWMEVENT:
! return eventSysWM(&event->syswm);
case SDL_VIDEORESIZE:
! return eventResize(&event->resize);
default:
break;
}
! return false;
}
***************
*** 253,277 ****
}
-
- /** Remove an object from the message queue */
-
- bool PG_MessageObject::RemoveObject(PG_MessageObject* obj) {
- std::vector<PG_MessageObject*>::iterator list = objectList.begin();
-
- // search the object
- list = std::find(objectList.begin(), objectList.end(), obj);
-
- // check if object was found
- if(list == objectList.end()) {
- PG_LogWRN("PG_MessageObject::RemoveObject(..)");
- PG_LogWRN("Trying to remove non-existent object from the list
!!");
- return false;
- }
-
- // remove the object from the chain
- objectList.erase(list);
-
- return true;
- }
void PG_MessageObject::TranslateNumpadKeys(SDL_KeyboardEvent *key) {
--- 223,226 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paragui-cvs] CVS: paragui/src/core pgapplication.cpp,1.6,1.7 pgmessageobject.cpp,1.5,1.6,
Alexander Pipelka <address@hidden> <=
- Prev by Date:
[paragui-cvs] CVS: paragui/src/widgets pgdropdown.cpp,1.4,1.5
- Next by Date:
[paragui-cvs] CVS: paragui/include pgapplication.h,1.8,1.9 pgwidget.h,1.9,1.10
- Previous by thread:
[paragui-cvs] CVS: paragui/src/widgets pgdropdown.cpp,1.4,1.5
- Next by thread:
[paragui-cvs] CVS: paragui/include pgapplication.h,1.8,1.9 pgwidget.h,1.9,1.10
- Index(es):