[DEV] update new interface EWOL ewol::constext::Application
This commit is contained in:
parent
173e57342d
commit
55e05d24a3
@ -28,109 +28,107 @@
|
||||
#include <appl/ctags/readtags.h>
|
||||
#include <appl/globalMsg.h>
|
||||
|
||||
ewol::object::Shared<appl::BufferManager> bufferManager;
|
||||
|
||||
class MainApplication : public ewol::context::Application {
|
||||
public:
|
||||
bool init(ewol::Context& _context, size_t _initId) {
|
||||
APPL_INFO(" == > init APPL v" << APPL_VERSION << " (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")");
|
||||
|
||||
etk::theme::setName("COLOR", "color/black/");
|
||||
|
||||
// TODO : remove this : Move if in the windows properties
|
||||
_context.setSize(vec2(800, 600));
|
||||
|
||||
// select internal data for font ...
|
||||
_context.getFontDefault().setUseExternal(true);
|
||||
#ifdef __TARGET_OS__Android
|
||||
_context.getFontDefault().set("FreeSerif", 19);
|
||||
#else
|
||||
_context.getFontDefault().set("FreeSerif;DejaVuSansMono",14);
|
||||
#endif
|
||||
|
||||
// set the application icon ...
|
||||
_context.setIcon("DATA:icon.png");
|
||||
|
||||
// init internal global value
|
||||
globals::init();
|
||||
|
||||
// init ALL Singleton :
|
||||
//()CTagsManager::getInstance();
|
||||
bufferManager = appl::BufferManager::keep();
|
||||
|
||||
appl::highlightManager::init();
|
||||
appl::textPluginManager::init();
|
||||
appl::textPluginManager::addDefaultPlugin();
|
||||
|
||||
// Request load of the user configuration ...
|
||||
//ewol::userConfig::load();
|
||||
|
||||
char cCurrentPath[FILENAME_MAX];
|
||||
// get the curent program folder
|
||||
if (!getcwd(cCurrentPath, FILENAME_MAX)) {
|
||||
return false;
|
||||
}
|
||||
cCurrentPath[FILENAME_MAX - 1] = '\0';
|
||||
//APPL_INFO("The current working directory is " << cCurrentPath);
|
||||
|
||||
ewol::object::Shared<MainWindows> basicWindows = ewol::object::makeShared(new MainWindows());
|
||||
|
||||
if (basicWindows == nullptr) {
|
||||
APPL_ERROR("Can not allocate the basic windows");
|
||||
_context.stop();
|
||||
return false;
|
||||
}
|
||||
// create the specific windows
|
||||
_context.setWindows(basicWindows);
|
||||
|
||||
|
||||
// add files
|
||||
APPL_INFO("show list of files : ");
|
||||
bool ctagDetected = false;
|
||||
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
|
||||
std::string tmpppp = _context.getCmd().get(iii);
|
||||
if (tmpppp == "-t") {
|
||||
ctagDetected = true;
|
||||
} else if (true == ctagDetected) {
|
||||
etk::FSNode file(tmpppp);
|
||||
std::string name = file.getName();
|
||||
APPL_INFO("Load ctag file : \"" << name << "\"" );
|
||||
ctagDetected = false;
|
||||
_context.getEObjectManager().multiCast().anonymousSend(ednMsgCtagsLoadFile, name);
|
||||
} else {
|
||||
etk::FSNode file(tmpppp);
|
||||
std::string name = file.getName();
|
||||
APPL_INFO("need load file : \"" << name << "\"" );
|
||||
bufferManager->open(name);
|
||||
}
|
||||
}
|
||||
|
||||
APPL_INFO(" == > init " PROJECT_NAME " (END)");
|
||||
return true;
|
||||
}
|
||||
void unInit(ewol::Context& _context) {
|
||||
APPL_INFO(" == > Un-Init " PROJECT_NAME " (START)");
|
||||
appl::textPluginManager::unInit();
|
||||
APPL_INFO("Stop Hightlight");
|
||||
appl::highlightManager::unInit();
|
||||
//Kill all singleton
|
||||
bufferManager.reset();
|
||||
APPL_INFO(" == > Un-Init " PROJECT_NAME " (END)");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Main of the program (This can be set in every case, but it is not used in Andoid...).
|
||||
* @param std IO
|
||||
* @return std IO
|
||||
*/
|
||||
int main(int _argc, const char *_argv[]) {
|
||||
// only one things to do:
|
||||
return ewol::run(_argc, _argv);
|
||||
}
|
||||
ewol::object::Shared<appl::BufferManager> bufferManager = NULL;
|
||||
|
||||
/**
|
||||
* @brief main application function initialisation
|
||||
*/
|
||||
bool APP_Init(ewol::Context& _context, size_t _initId, size_t& _nbInitStep) {
|
||||
_nbInitStep = 1;
|
||||
APPL_INFO(" == > init APPL v" << APPL_VERSION << " (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")");
|
||||
|
||||
etk::theme::setName("COLOR", "color/black/");
|
||||
|
||||
// TODO : remove this : Move if in the windows properties
|
||||
_context.setSize(vec2(800, 600));
|
||||
|
||||
// select internal data for font ...
|
||||
_context.getFontDefault().setUseExternal(true);
|
||||
#ifdef __TARGET_OS__Android
|
||||
_context.getFontDefault().set("FreeSerif", 19);
|
||||
#else
|
||||
_context.getFontDefault().set("FreeSerif;DejaVuSansMono",14);
|
||||
#endif
|
||||
|
||||
// set the application icon ...
|
||||
_context.setIcon("DATA:icon.png");
|
||||
|
||||
// init internal global value
|
||||
globals::init();
|
||||
|
||||
// init ALL Singleton :
|
||||
//()CTagsManager::getInstance();
|
||||
bufferManager = appl::BufferManager::keep();
|
||||
|
||||
appl::highlightManager::init();
|
||||
appl::textPluginManager::init();
|
||||
appl::textPluginManager::addDefaultPlugin();
|
||||
|
||||
// Request load of the user configuration ...
|
||||
//ewol::userConfig::load();
|
||||
|
||||
char cCurrentPath[FILENAME_MAX];
|
||||
// get the curent program folder
|
||||
if (!getcwd(cCurrentPath, FILENAME_MAX)) {
|
||||
return false;
|
||||
}
|
||||
cCurrentPath[FILENAME_MAX - 1] = '\0';
|
||||
//APPL_INFO("The current working directory is " << cCurrentPath);
|
||||
|
||||
ewol::object::Shared<MainWindows> basicWindows = ewol::object::makeShared(new MainWindows());
|
||||
|
||||
if (basicWindows == nullptr) {
|
||||
APPL_ERROR("Can not allocate the basic windows");
|
||||
_context.stop();
|
||||
return false;
|
||||
}
|
||||
// create the specific windows
|
||||
_context.setWindows(basicWindows);
|
||||
|
||||
|
||||
// add files
|
||||
APPL_INFO("show list of files : ");
|
||||
bool ctagDetected = false;
|
||||
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
|
||||
std::string tmpppp = _context.getCmd().get(iii);
|
||||
if (tmpppp == "-t") {
|
||||
ctagDetected = true;
|
||||
} else if (true == ctagDetected) {
|
||||
etk::FSNode file(tmpppp);
|
||||
std::string name = file.getName();
|
||||
APPL_INFO("Load ctag file : \"" << name << "\"" );
|
||||
ctagDetected = false;
|
||||
_context.getEObjectManager().multiCast().anonymousSend(ednMsgCtagsLoadFile, name);
|
||||
} else {
|
||||
etk::FSNode file(tmpppp);
|
||||
std::string name = file.getName();
|
||||
APPL_INFO("need load file : \"" << name << "\"" );
|
||||
bufferManager->open(name);
|
||||
}
|
||||
}
|
||||
|
||||
APPL_INFO(" == > init " PROJECT_NAME " (END)");
|
||||
return true;
|
||||
// second possibility
|
||||
return ewol::run(new MainApplication(), _argc, _argv);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief main application function Un-Initialisation
|
||||
*/
|
||||
void APP_UnInit(ewol::Context& _context) {
|
||||
APPL_INFO(" == > Un-Init " PROJECT_NAME " (START)");
|
||||
appl::textPluginManager::unInit();
|
||||
APPL_INFO("Stop Hightlight");
|
||||
appl::highlightManager::unInit();
|
||||
//Kill all singleton
|
||||
bufferManager.reset();
|
||||
APPL_INFO(" == > Un-Init " PROJECT_NAME " (END)");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user