/************************************************************************* * sbCore.h - application core * * author: Konstantin Maslyuk "Kalemas" mailto:kalemas@mail.ru * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation version 2. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. ************************************************************************/ #ifndef SBCORE_H #define SBCORE_H #include #include "sbTheme.h" #include "sbControl.h" #include "sbList.h" #include "sbFeatures.h" #include #include class sbCore { public: struct INPUT { INPUT () { memset (this,0,sizeof(INPUT)); } bool mousePressed; sbPoint start, last; bool leaveZone; int tapCounter; mutable bool block; int scrollDataY [2]; int scrollDataTicks [2]; }; enum TIMER { TIMER_SCROLL = 10010, TIMER_TAP, TIMER_BANNER, TIMER_REDRAW, TIMER_BEFORE_REDRAW, // send before redraw view TIMER_SLIDE, TIMER_SAVE_CONFIG, }; sbCore(); ~sbCore(); void onMouse ( int x, int y, const int state ); void onPaint ( sbSurface rc ); void onTimer ( const int timer ); void onChar ( TCHAR c ); void onKey ( int key , bool down ); void redraw (); sword::SWMgr * getSword () {return swordMgr;} sword::InstallMgr * getInstallMgr (); sword::SWConfig * getOptions () {return options;} const INPUT * getInput () {return &input;} const sbRect & getRect () {return rClient;} void initSword (); void switchList ( sbList::TYPE to ); void threadCreate ( sbList * list ); void threadDestroy ( ); void controlPressed ( sbControl::TYPE type ); const char * holdString ( const char * string ); private: sbThread backgroundThread; static void threadMain (bool * abort); static sbList *backgroundList; sbList::TYPE currentList; sbList::TYPE overlayList; std::map lists; int listShift; float cineticPower; INPUT input; bool requestedRedraw; bool redrawTimerOn; bool bScrollTimer; sbRect rClient; sbSurface drawSurface; bool stretchSurface; float stretchVertical; float stretchHorizontal; sword::SWMgr *swordMgr; sword::SWConfig *options; float cineticDamping; float cineticFactor; int refreshRate; bool showBanner; bool showFps; std::vector strings; sword::InstallMgr *installManager; public: sword::StatusReporter installStatus; sbFeatures features; //bool fadeSurface; unsigned int scrollStep; unsigned int versesMax; unsigned int versesOptimal; // Core shared data sword::SWModule *defaultModule; // base module for all new module views sword::SWModule *currentModule; // module of active list, null if module view was not activated sword::VerseKey currentVerse; // last place bool goVerse; // necessity of transition, with currentVerse and currentModule int goReading; // need attach reading on activate, default -1 bool changedGlobalOptions; // fixes : Global Options switch in one module cause switch in another time_t systemStarted; bool keypadController; // whether user control with keypad / touchscreen std::vector moduleOptions; // array of option names sword::ListKey searchRange; bool waitMode; const TCHAR *waitMessage; }; extern sbCore * Core; #endif