2011-07-20 10:33:24 +02:00
|
|
|
/**
|
|
|
|
* @author Edouard DUPIN
|
2012-11-25 11:55:06 +01:00
|
|
|
*
|
|
|
|
* @copyright 2010, Edouard DUPIN, all right reserved
|
|
|
|
*
|
|
|
|
* @license GPL v3 (see license file)
|
2011-07-20 10:33:24 +02:00
|
|
|
*/
|
|
|
|
|
2012-11-25 11:55:06 +01:00
|
|
|
#include <etk/types.h>
|
2012-04-24 09:42:14 +02:00
|
|
|
#include <etk/UString.h>
|
|
|
|
#include <ewol/ewol.h>
|
2012-08-20 18:12:14 +02:00
|
|
|
#include <ewol/eObject/EObject.h>
|
|
|
|
#include <ewol/widget/WidgetManager.h>
|
2012-04-24 09:42:14 +02:00
|
|
|
|
2012-04-23 10:15:43 +02:00
|
|
|
#include <appl/Debug.h>
|
2012-04-24 09:42:14 +02:00
|
|
|
#include <appl/global.h>
|
2012-11-01 10:47:36 +01:00
|
|
|
#include <etk/os/FSNode.h>
|
2012-07-13 18:12:14 +02:00
|
|
|
#include <etk/tool.h>
|
2012-02-18 00:35:15 +01:00
|
|
|
#include <Gui/MainWindows.h>
|
2012-01-11 15:26:53 +01:00
|
|
|
#include <BufferManager.h>
|
|
|
|
#include <ColorizeManager.h>
|
|
|
|
#include <HighlightManager.h>
|
2012-02-18 00:35:15 +01:00
|
|
|
#include <Gui/Search.h>
|
2011-07-20 10:33:24 +02:00
|
|
|
#include <unistd.h>
|
2012-01-11 15:26:53 +01:00
|
|
|
#include <readtags.h>
|
|
|
|
#include <CTagsManager.h>
|
2012-04-24 09:42:14 +02:00
|
|
|
#include <globalMsg.h>
|
2012-11-25 11:55:06 +01:00
|
|
|
#include <ewol/config.h>
|
|
|
|
#include <ewol/commandLine.h>
|
2011-07-20 10:33:24 +02:00
|
|
|
|
2012-01-13 13:06:15 +01:00
|
|
|
MainWindows * basicWindows = NULL;
|
|
|
|
|
|
|
|
|
2012-11-22 21:39:15 +01:00
|
|
|
/**
|
|
|
|
* @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
|
|
|
|
*/
|
2012-11-25 11:55:06 +01:00
|
|
|
int main(int argc, const char *argv[])
|
2012-11-22 21:39:15 +01:00
|
|
|
{
|
|
|
|
// only one things to do :
|
|
|
|
return ewol::Run(argc, argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-07-20 10:33:24 +02:00
|
|
|
/**
|
2012-01-11 15:26:53 +01:00
|
|
|
* @brief main application function Initialisation
|
2011-07-20 10:33:24 +02:00
|
|
|
*/
|
2012-02-02 13:57:57 +01:00
|
|
|
void APP_Init(void)
|
2011-07-20 10:33:24 +02:00
|
|
|
{
|
2012-08-10 12:11:28 +02:00
|
|
|
#ifdef __TARGET_OS__Linux
|
2012-05-02 18:22:32 +02:00
|
|
|
#ifdef MODE_RELEASE
|
2012-05-10 16:01:03 +02:00
|
|
|
APPL_INFO("==> Init "PROJECT_NAME" (START) (Linux) (Release)");
|
2012-05-02 18:22:32 +02:00
|
|
|
#else
|
2012-05-10 16:01:03 +02:00
|
|
|
APPL_INFO("==> Init "PROJECT_NAME" (START) (Linux) (Debug)");
|
2012-05-02 18:22:32 +02:00
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#ifdef MODE_RELEASE
|
2012-05-10 16:01:03 +02:00
|
|
|
APPL_INFO("==> Init "PROJECT_NAME" (START) (Android) (Release)");
|
2012-05-02 18:22:32 +02:00
|
|
|
#else
|
2012-05-10 16:01:03 +02:00
|
|
|
APPL_INFO("==> Init "PROJECT_NAME" (START) (Android) (Debug)");
|
2012-05-02 18:22:32 +02:00
|
|
|
#endif
|
|
|
|
#endif
|
2012-12-03 10:00:43 +01:00
|
|
|
ewol::ChangeSize(ivec2(800, 600));
|
2012-05-13 09:44:18 +02:00
|
|
|
etk::InitDefaultFolder(PROJECT_NAME);
|
2012-08-10 12:11:28 +02:00
|
|
|
#ifdef __TARGET_OS__Android
|
2012-11-25 11:55:06 +01:00
|
|
|
ewol::config::FontSetDefault("FreeSerif", 19);
|
2012-02-17 18:25:38 +01:00
|
|
|
#else
|
2012-11-25 11:55:06 +01:00
|
|
|
ewol::config::FontSetDefault("FreeSerif", 14);
|
2012-02-17 18:25:38 +01:00
|
|
|
#endif
|
2011-07-20 10:33:24 +02:00
|
|
|
// init internal global value
|
|
|
|
globals::init();
|
|
|
|
|
|
|
|
|
|
|
|
// init ALL Singleton :
|
2012-02-20 20:30:26 +01:00
|
|
|
//(void)CTagsManager::getInstance();
|
|
|
|
BufferManager::Init();
|
2011-07-20 10:33:24 +02:00
|
|
|
|
|
|
|
// set color and other trucs...
|
2012-02-19 22:33:43 +01:00
|
|
|
ColorizeManager::Init();
|
2012-11-09 09:59:31 +01:00
|
|
|
ColorizeManager::LoadFile( "white" );
|
2012-02-19 22:33:43 +01:00
|
|
|
ColorizeManager::DisplayListOfColor();
|
2011-07-20 10:33:24 +02:00
|
|
|
|
2012-02-19 22:33:43 +01:00
|
|
|
HighlightManager::Init();
|
|
|
|
HighlightManager::loadLanguages();
|
2012-10-16 18:32:21 +02:00
|
|
|
cTagsManager::Init();
|
2011-07-20 10:33:24 +02:00
|
|
|
|
2012-05-13 09:44:18 +02:00
|
|
|
char cCurrentPath[FILENAME_MAX];
|
2011-07-20 10:33:24 +02:00
|
|
|
// get the curent program folder
|
|
|
|
if (!getcwd(cCurrentPath, FILENAME_MAX)) {
|
2012-01-11 15:26:53 +01:00
|
|
|
return ;
|
2011-07-20 10:33:24 +02:00
|
|
|
}
|
|
|
|
cCurrentPath[FILENAME_MAX - 1] = '\0';
|
2012-04-23 10:15:43 +02:00
|
|
|
//APPL_INFO("The current working directory is " << cCurrentPath);
|
2011-07-20 10:33:24 +02:00
|
|
|
|
2012-01-17 15:35:34 +01:00
|
|
|
basicWindows = new MainWindows();
|
2011-07-20 10:33:24 +02:00
|
|
|
|
2012-02-02 13:57:57 +01:00
|
|
|
if (NULL == basicWindows) {
|
2012-04-23 10:15:43 +02:00
|
|
|
APPL_ERROR("Can not allocate the basic windows");
|
2012-02-02 13:57:57 +01:00
|
|
|
ewol::Stop();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// create the specific windows
|
2012-11-25 11:55:06 +01:00
|
|
|
ewol::WindowsSet(basicWindows);
|
2012-10-16 18:32:21 +02:00
|
|
|
|
2012-02-24 12:45:39 +01:00
|
|
|
|
2011-07-20 10:33:24 +02:00
|
|
|
// add files
|
2012-04-23 10:15:43 +02:00
|
|
|
APPL_INFO("show list of files : ");
|
2012-10-17 10:24:23 +02:00
|
|
|
bool ctagDetected = false;
|
2012-11-25 11:55:06 +01:00
|
|
|
for( int32_t iii=0 ; iii<ewol::commandLine::Size(); iii++) {
|
|
|
|
etk::UString tmpppp = ewol::commandLine::Get(iii);
|
2012-10-17 10:24:23 +02:00
|
|
|
if (tmpppp == "-t") {
|
|
|
|
ctagDetected = true;
|
|
|
|
} else if (true == ctagDetected) {
|
|
|
|
APPL_INFO("Load ctag file : \"" << tmpppp << "\"" );
|
|
|
|
ctagDetected = false;
|
|
|
|
ewol::EObjectMessageMultiCast::AnonymousSend(ednMsgCtagsLoadFile, tmpppp);
|
|
|
|
} else {
|
|
|
|
APPL_INFO("need load file : \"" << tmpppp << "\"" );
|
|
|
|
ewol::EObjectMessageMultiCast::AnonymousSend(ednMsgOpenFile, tmpppp);
|
|
|
|
}
|
2012-01-26 18:13:43 +01:00
|
|
|
}
|
2012-02-24 12:45:39 +01:00
|
|
|
|
2012-04-23 10:15:43 +02:00
|
|
|
APPL_INFO("==> Init Edn (END)");
|
2012-01-11 15:26:53 +01:00
|
|
|
}
|
2011-07-20 10:33:24 +02:00
|
|
|
|
2012-01-11 15:26:53 +01:00
|
|
|
|
2012-11-26 23:07:40 +01:00
|
|
|
etk::UString APP_Icon(void)
|
2012-03-29 17:48:48 +02:00
|
|
|
{
|
2012-11-26 23:07:40 +01:00
|
|
|
etk::UString bitmapFile("DATA:iconEdn.bmp");
|
2012-03-29 17:48:48 +02:00
|
|
|
return bitmapFile;
|
|
|
|
}
|
|
|
|
|
2012-01-11 15:26:53 +01:00
|
|
|
/**
|
|
|
|
* @brief main application function Un-Initialisation
|
|
|
|
*/
|
|
|
|
void APP_UnInit(void)
|
|
|
|
{
|
2012-04-23 10:15:43 +02:00
|
|
|
APPL_INFO("==> Un-Init Edn (START)");
|
2012-12-02 20:34:00 +01:00
|
|
|
|
|
|
|
if (NULL != basicWindows) {
|
|
|
|
delete(basicWindows);
|
|
|
|
basicWindows = NULL;
|
|
|
|
}
|
2012-02-02 13:57:57 +01:00
|
|
|
|
2012-10-16 18:32:21 +02:00
|
|
|
cTagsManager::UnInit();
|
|
|
|
|
2012-04-23 10:15:43 +02:00
|
|
|
APPL_INFO("Stop Hightlight");
|
2012-02-19 22:33:43 +01:00
|
|
|
HighlightManager::UnInit();
|
2011-07-20 10:33:24 +02:00
|
|
|
//Kill all singleton
|
2012-04-23 10:15:43 +02:00
|
|
|
APPL_INFO("Stop BufferManager");
|
2012-02-20 20:30:26 +01:00
|
|
|
BufferManager::UnInit();
|
2012-04-23 10:15:43 +02:00
|
|
|
APPL_INFO("Stop ColorizeManager");
|
2012-02-19 22:33:43 +01:00
|
|
|
ColorizeManager::UnInit();
|
2012-04-23 10:15:43 +02:00
|
|
|
APPL_INFO("==> Un-Init Edn (END)");
|
2012-02-02 13:57:57 +01:00
|
|
|
}
|
2011-07-20 10:33:24 +02:00
|
|
|
|