📄 eb_gcontext.h
字号:
<class>GContext</class>
<method>_removeData</method>
<java></java>
<cpp>void _removeData(long i)</cpp>
<descr>
<p></p>
</descr>
</api>
*/
#ifndef GSHASH
void _removeData(long i)
{ebContext->removeData(i);}
#endif
void* _takeData(const char* key)
{return ebContext->takeData((char*) key);}
/*
<api>
<class>GContext</class>
<method>_changeDataKey</method>
<java></java>
<cpp>void _changeDataKey(const char* key, char* newkey)</cpp>
<descr>
<p>Changes a record's key.</p>
</descr>
</api>
*/
#ifndef GSHASH
void _changeDataKey(const char* key, char* newkey)
{ebContext->changeDataKey((char*) key, newkey);}
#endif
/*
<api>
<class>GContext</class>
<method>dumpData</method>
<java></java>
<cpp>void dumpData()</cpp>
<descr>
<p>.</p>
</descr>
</api>
*/
#ifdef DEV_DEBUG
void dumpData()
{ebContext->dumpData();}
#endif // def DEV_DEBUG
// Browsing history
void _loadLayout(char* url,char* accept=0,char* userAgent=0)
{ebContext->loadLayout(url, accept, userAgent) ; }
void _backLayout()
{ebContext->backLayout(); }
void deleteHistory(int index, int keepValue)
{ebContext->deleteHistory(index, keepValue) ; }
void flushHistory()
{ebContext->flushHistory(); }
void unstackHistory()
{ebContext->unstackHistory(); }
void setCurrentStackValue(unsigned long val, unsigned long flag)
{ ebContext->setCurrentStackValue(val, flag); }
int getHistoryNum()
{ return ebContext->getHistoryNum();}
unsigned long getCurrentStackValue(unsigned long *flag=NULL)
{ return ebContext->getCurrentStackValue(flag) ; }
unsigned long getPreviousStackValue(unsigned long defValue, unsigned long *flag=NULL)
{ return ebContext->getPreviousStackValue(defValue, flag) ; }
void getStackContent( int index, char** newHistoryURLs, unsigned long* newHistoryVals, unsigned long* newHistoryFlags)
{ ebContext->getStackContent( index, newHistoryURLs, newHistoryVals, newHistoryFlags) ; }
void stackURL(char* url)
{ ebContext->stackURL(url) ; }
#ifdef DEV_DEBUG
void dumpHistory()
{ebContext->dumpHistory();}
#endif // def DEV_DEBUG
// Message processor
void setMessageProcessor(messageProcessor newMsgProcessor)
{ebContext->setMessageProcessor(newMsgProcessor);}
int processMessage(KRMessage* msg)
{return ebContext->processMessage(msg);}
// InstanciatorGetter
void setInstanciatorGetter(instanciatorGetter newInstanciatorGetter)
{ebContext->setInstanciatorGetter(newInstanciatorGetter);}
instanciatorGetter getInstanciatorGetter()
{return ebContext->getInstanciatorGetter();}
void setInstantiatorTables(SmallArrayList* instantiatorTables)
{ ebContext->setInstantiatorTables(instantiatorTables) ; }
SmallArrayList* getInstantiatorTables()
{ return ebContext->getInstantiatorTables() ; }
// Current time manager
void setCurrentTime(KALEIDO_TIME_TYPE newCurrentTime)
{ ebContext->setCurrentTime(newCurrentTime); }
KALEIDO_TIME_TYPE getCurrentTime()
{ return ebContext->getCurrentTime(); }
// Current Layout
void setLayoutSwitchHandler(layoutSwitchHandler newLayoutSwitchHandler)
{ebContext->setLayoutSwitchHandler(newLayoutSwitchHandler);}
boolean setCurrentLayout(Layout* newCurrentLayout)
{ return ebContext->setCurrentLayout(newCurrentLayout); }
Layout* getCurrentLayout()
{ return ebContext->getCurrentLayout(); }
// Current KeyProxy
void setCurrentKeyProxy(KeyProxy* newCurrentKeyProxy)
{ ebContext->setCurrentKeyProxy(newCurrentKeyProxy) ; }
KeyProxy* getCurrentKeyProxy()
{ return ebContext->getCurrentKeyProxy(); }
// Font caches
#ifdef FONT_CACHE
Font* getCachedFont(char* newFont)
{ return ebContext->getCachedFont(newFont); }
void putCachedFont(char* newFontName, Font* newFontData)
{ ebContext->putCachedFont(newFontName, newFontData); }
#endif // def FONT_CACHE
// Image pool
ObjectPool* getImagePool(void)
{ return ebContext->getImagePool(); }
Graphics* getPooledImage(unsigned char* src)
{ return ebContext->getPooledImage(src); }
void putPooledImage(unsigned char* src, Graphics* img, objectDestructor dtor)
{ ebContext->putPooledImage(src, img, dtor); }
int derefPooledImage(Graphics* img, boolean flushIfUnreferenced=false)
{ return ebContext->derefPooledImage(img, flushIfUnreferenced); }
// Current screen's Graphics
void setCurrentScreenGraphics(Graphics* newScreenGraphics)
{ ebContext->setCurrentScreenGraphics(newScreenGraphics) ; }
Graphics* getCurrentScreenGraphics()
{ return ebContext->getCurrentScreenGraphics() ; }
// Snapshots management
// Create a copy of the current screen content.
void makeSnapshot()
{ ebContext->makeSnapshot() ; }
//
PFWImage* getLastSnapshot()
{ return ebContext->getLastSnapshot() ; }
void checkPendingGraphics()
{ebContext->checkPendingGraphics() ;}
// PFWGraphics factory
virtual Graphics* createGraphics()
{ return ebContext->createGraphics(); }
virtual Graphics* createGraphics(int width, int height, int onScreen=0)
{ return ebContext->createGraphics(width, height, onScreen); }
virtual Graphics* createGraphics(unsigned char* src)
{ return ebContext->createGraphics(src); }
//
// KRContext related methods
//
// Message queues.
void processQueues()
{ krContext->processQueues(this); }
KRMessage* getCurrentMessage()
{ return krContext->getCurrentMessage(); }
KALEIDO_TIME_TYPE getNextMsgScheduledTime(KALEIDO_TIME_TYPE* schedTime=NULL)
{ return krContext->getNextMsgScheduledTime(this, schedTime); }
void emptyQueues()
{ krContext->emptyQueues(this); }
KRMessages* getScheduledQueue() { return krContext->getScheduledQueue() ; }
KRMessages* getQuickQueue() { return krContext->getQuickQueue() ; }
KRMessages* getSlowQueue() { return krContext->getSlowQueue() ; }
KPage* _loadPage(char* filename, Layout* layout)
{ return krContext->loadPage(this, filename, layout); }
KPage* _loadPage(ObjectReader* reader, int version, Layout* layout)
{ return krContext->loadPage(this, reader, version, layout); }
boolean _doAction(long actionid, char* value)
{ return krContext->doAction(this, actionid, value); }
void setJumpLink(long action, char* link)
{ krContext->setJumpLink(action, link); }
char* getJumpLink(long action)
{ return krContext->getJumpLink(action); }
LinksJumpMap* getJumpLinks()
{ return krContext->getJumpLinks(); }
int getNextIndex()
{ return krContext->getNextIndex(); }
#ifdef DEV_DEBUG
public :
void showQueues()
{
KALEIDO_TIME_TYPE nextCall = krContext->getNextMsgScheduledTime(this) ;
Verbose( VERB_LEV_DEBUG, (char*)"PRF: Queues levels Quick: %d Slow: %d Scheduled: %d (%lu)\n",
getQuickQueue()->getPending(),
getSlowQueue()->getPending(),
getScheduledQueue()->getPending(),
nextCall==KALEIDO_MAX_TIME_VALUE?0:nextCall-getCurrentTime()) ;
}
void analyzeLayout(int verbosity, int level=0, Layout* layout=NULL)
{ ebContext->analyzeLayout(verbosity, level, layout) ;}
#endif // def DEV_DEBUG
#ifdef DEV_PROFILE
private :
KALEIDO_TIME_TYPE profilingBeg[MAX_PROFILING_STAMPS] ;
KALEIDO_TIME_TYPE profilingEnd[MAX_PROFILING_STAMPS] ;
long profilingNum[MAX_PROFILING_STAMPS] ;
KALEIDO_TIME_TYPE profilingTot[MAX_PROFILING_STAMPS] ;
long stackCheckStart ;
long stackCheckMax ;
public :
inline void setProfiling(KALEIDO_TIME_TYPE* var)
{
*var = getHighperfTime() ;
}
inline void begProfiling(int index)
{
setProfiling(&profilingBeg[index]) ;
}
inline void endProfiling(int index)
{
setProfiling(&profilingEnd[index]) ;
profilingNum[index]++ ;
profilingTot[index] += profilingEnd[index]-profilingBeg[index] ;
}
const char* getProfilingStampLib(int index)
{
switch(index)
{
case LOAD_HTML:
return "Loading HTML" ;
case PARSE_HTML:
return "Parsing HTML" ;
case LOAD_BIN:
return "Loading BIN" ;
case RESTORE_BIN:
return "Restoring BIN" ;
case LOAD_BMP:
return "Loading BMP" ;
case ACCESS_BMP:
return "Accessing BMP" ;
case DRAW_STRING:
return "Drawing string" ;
case MODEL_ACTIVATE:
return "Activating model" ;
case MODEL_RENDER:
return "Rendering model" ;
case DRAW_SCREEN:
return "Drawing a full screen" ;
case DRAW_BITMAP:
return "Drawing a bitmap" ;
case PROF_USER1:
return "User testpoint1" ;
case PROF_USER2:
return "User testpoint2" ;
case PROF_USER3:
return "User testpoint3" ;
case PROF_USER4:
return "User testpoint4" ;
case PROF_USER5:
return "User testpoint5" ;
}
return NULL ;
}
void rstProfilingStamps()
{
for(int i=0; i<MAX_PROFILING_STAMPS; i++)
{
profilingBeg[i]= 0;
profilingEnd[i]= 0;
profilingNum[i]= 0;
profilingTot[i]= 0;
}
}
void dumpProfilingStamps()
{
for(int i=0; i<MAX_PROFILING_STAMPS; i++)
{
if(getProfilingStampLib(i))
Verbose( VERB_LEV_DEBUG, "PRF: %s %d/%d (%d ms for %d times)\n",
getProfilingStampLib(i),
profilingEnd[i]-profilingBeg[i],
profilingNum[i]?(profilingTot[i]/profilingNum[i]):0,
profilingTot[i],
profilingNum[i]) ;
}
}
// Stack analysis
inline void begStackChecking()
{
int tmp ;
stackCheckMax = 0 ;
GET_STACK_POINTER(tmp);
stackCheckStart = tmp;
}
inline void endStackChecking(char* moreInfo, int onlyIfMax=0)
{
int stackCheckLap;
GET_STACK_POINTER(stackCheckLap);
if((stackCheckStart-stackCheckLap)>stackCheckMax)
{
stackCheckMax = stackCheckStart-stackCheckLap ;
if((stackCheckStart-stackCheckLap) > STACK_PANIC)
{
Verbose(VERB_LEV_DEBUG, "STACK PANIC !!! Max stack used at '%s'= %d bytes.\n", moreInfo, stackCheckStart-stackCheckLap) ;
stackCheckMax *= 2 ;
return;
}
if((stackCheckStart-stackCheckLap) > STACK_WARNING)
{
Verbose(VERB_LEV_DEBUG, "STACK WARNING !!! Max stack used at '%s'= %d bytes.\n", moreInfo, stackCheckStart-stackCheckLap) ;
stackCheckMax = STACK_PANIC ;
return;
}
Verbose(VERB_LEV_DEBUG, "Max stack used at '%s'= %d bytes.\n", moreInfo, stackCheckStart-stackCheckLap) ;
}
else
{
if(!onlyIfMax)
Verbose(VERB_LEV_DEBUG, "Stack used at '%s'= %d/%d bytes.\n", moreInfo, stackCheckStart-stackCheckLap, stackCheckMax) ;
}
}
#endif // def DEV_PROFILE
inline void screenChanged() {screenHasChanged=TRUE;}
inline void screenUpdated() {screenHasChanged=FALSE;}
inline boolean isScreenToUpdate() { return screenHasChanged; }
} ;
#endif // ndef __EB_GCONTEXT__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -