diff --git a/Sources/Colorize/ColorizeManager.cpp b/Sources/Colorize/ColorizeManager.cpp index 232c52c..07ae93b 100644 --- a/Sources/Colorize/ColorizeManager.cpp +++ b/Sources/Colorize/ColorizeManager.cpp @@ -1,6 +1,6 @@ /** ******************************************************************************* - * @file ColoriseManager.cpp + * @file ColorizeManager.cpp * @brief Editeur De N'ours : Colorising Manager * @author Edouard DUPIN * @date 14/12/2010 @@ -57,19 +57,8 @@ void ColorizeManager::OnMessage(int32_t id, int32_t dataID) { case EDN_MSG__RELOAD_COLOR_FILE: { - // Remove all current color - int32_t i; - // clean all Element - for (i=0; i< listMyColor.Size(); i++) { - if (NULL != listMyColor[i]) { - delete(listMyColor[i]); - listMyColor[i] = NULL; - } - } - // clear the compleate list - listMyColor.Clear(); // Reaload File - // TODO : Check this : + // TODO : Check this : Pb in the recopy Edn::String element Edn::String plop = m_fileColor; LoadFile(plop.c_str()); } @@ -85,6 +74,18 @@ void ColorizeManager::LoadFile(Edn::String &xmlFilename) void ColorizeManager::LoadFile(const char * xmlFilename) { + // Remove all old color : + int32_t i; + // clean all Element + for (i=0; i< listMyColor.Size(); i++) { + if (NULL != listMyColor[i]) { + delete(listMyColor[i]); + listMyColor[i] = NULL; + } + } + // clear the compleate list + listMyColor.Clear(); + m_fileColor = xmlFilename; EDN_DEBUG("open file (COLOR) \"" << xmlFilename << "\" ? = \"" << m_fileColor << "\""); errorColor = new Colorize(); @@ -96,22 +97,17 @@ void ColorizeManager::LoadFile(const char * xmlFilename) // open the curent File XmlDocument.LoadFile(xmlFilename); TiXmlElement* root = XmlDocument.FirstChildElement( "EdnColor" ); - if (NULL == root ) - { + if (NULL == root ) { EDN_ERROR(PFX"(l ?) main node not find: \"EdnColor\" in \"" << xmlFilename << "\""); return; - } - else - { + } else { TiXmlNode * pNode = root->FirstChild(); - while(NULL != pNode) - { + while(NULL != pNode) { if (pNode->Type()==TiXmlNode::TINYXML_COMMENT) { // nothing to do, just proceed to next step } else if (!strcmp(pNode->Value(), "gui")) { TiXmlNode * pGuiNode = pNode->FirstChild(); - while(NULL != pGuiNode) - { + while(NULL != pGuiNode) { if (pGuiNode->Type()==TiXmlNode::TINYXML_COMMENT) { // nothing to do, just proceed to next step } else if (!strcmp(pGuiNode->Value(), "color")) { @@ -233,6 +229,7 @@ void ColorizeManager::LoadFile(const char * xmlFilename) } } SendMessage(EDN_MSG__COLOR_HAS_CHANGE); + SendMessage(EDN_MSG__USER_DISPLAY_CHANGE); } Colorize *ColorizeManager::Get(const char *colorName) diff --git a/Sources/Colorize/ColorizeManager.h b/Sources/Colorize/ColorizeManager.h index 61360d9..eafaaef 100644 --- a/Sources/Colorize/ColorizeManager.h +++ b/Sources/Colorize/ColorizeManager.h @@ -1,6 +1,6 @@ /** ******************************************************************************* - * @file ColoriseManager.h + * @file ColorizeManager.h * @brief Editeur De N'ours : Colorising Manager (header) * @author Edouard DUPIN * @date 14/12/2010 diff --git a/Sources/CustumWidget/BufferView/BufferView.cpp b/Sources/CustumWidget/BufferView/BufferView.cpp index 63b8fa0..ea44ba1 100644 --- a/Sources/CustumWidget/BufferView/BufferView.cpp +++ b/Sources/CustumWidget/BufferView/BufferView.cpp @@ -100,6 +100,10 @@ void BufferView::OnMessage(int32_t id, int32_t dataID) // change Title : gtk_widget_queue_draw(m_widget); break; + case EDN_MSG__USER_DISPLAY_CHANGE: + // Redraw all the display ... + gtk_widget_queue_draw(m_widget); + break; } } diff --git a/Sources/CustumWidget/CodeView/CodeView.cpp b/Sources/CustumWidget/CodeView/CodeView.cpp index 3a04169..b17feda 100644 --- a/Sources/CustumWidget/CodeView/CodeView.cpp +++ b/Sources/CustumWidget/CodeView/CodeView.cpp @@ -179,6 +179,9 @@ void CodeView::OnMessage(int32_t id, int32_t dataID) case EDN_MSG__CURRENT_SET_CHARSET: m_bufferManager->Get(m_bufferID)->SetCharset((charset_te)dataID); break; + case EDN_MSG__USER_DISPLAY_CHANGE: + // Redraw all the display ... Done under ... + break; } // Force redraw of the widget gtk_widget_queue_draw(m_widget); diff --git a/Sources/GuiTools/MainWindows/MenuBar.cpp b/Sources/GuiTools/MainWindows/MenuBar.cpp index fbd4f75..dd351e9 100644 --- a/Sources/GuiTools/MainWindows/MenuBar.cpp +++ b/Sources/GuiTools/MainWindows/MenuBar.cpp @@ -28,6 +28,7 @@ #include "MenuBar.h" #include "ClipBoard.h" #include "charset.h" +#include "ColorizeManager.h" #define MENU_MSG const char * MSG_TogleDisplayChar = "Request a Togle of char displaying"; @@ -36,6 +37,8 @@ const char * MSG_TogleAutoIndent = "Request a Togle of Auto Indent"; const char * MSG_SetCharsetIso559_1 = "Set ISO 5589-1"; const char * MSG_SetCharsetIso559_15 = "Set ISO 5589-15"; const char * MSG_SetCharsetUTF8 = "Set UTF 8"; +const char * MSG_LoadColorBlack = "Load Color Black"; +const char * MSG_LoadColorWhite = "Load Color White"; #define MSG_LINK(data) @@ -74,6 +77,26 @@ static void CB_menuInternal(GtkMenuItem *menu_item, gpointer data) GeneralSendMessage(EDN_MSG__CURRENT_SET_CHARSET, EDN_CHARSET_ISO_8859_15); } else if (myPointer == MSG_SetCharsetUTF8) { GeneralSendMessage(EDN_MSG__CURRENT_SET_CHARSET, EDN_CHARSET_UTF8); + } else if (myPointer == MSG_LoadColorWhite) { + ColorizeManager * myColorSystem = ColorizeManager::getInstance(); + Edn::String homedir; +# ifdef NDEBUG + homedir = "/usr/share/edn/"; +# else + homedir = "./data/"; +# endif + homedir += "color_white.xml"; + myColorSystem->LoadFile(homedir); + } else if (myPointer == MSG_LoadColorBlack) { + ColorizeManager * myColorSystem = ColorizeManager::getInstance(); + Edn::String homedir; +# ifdef NDEBUG + homedir = "/usr/share/edn/"; +# else + homedir = "./data/"; +# endif + homedir += "color_black.xml"; + myColorSystem->LoadFile(homedir); } } @@ -254,6 +277,9 @@ MenuBar::MenuBar(void) : MsgBroadcast("Menu bar", EDN_CAT_GUI) tmp->AddInternal("Set charset Internationnal (UTF 8)", NULL, MSG_SetCharsetUTF8, true); tmp->AddSeparator(); tmp->AddGen( "Reload Color File", NULL, EDN_MSG__RELOAD_COLOR_FILE, true); + tmp->AddSeparator(); + tmp->AddInternal("Set Color Black", NULL, MSG_LoadColorBlack, true); + tmp->AddInternal("Set Color White", NULL, MSG_LoadColorWhite, true); m_listMenu.PushBack(tmp); /* tmp = new MenuBarMain("Project", m_mainWidget); diff --git a/Sources/tools/MsgBroadcast/MsgBroadcast.cpp b/Sources/tools/MsgBroadcast/MsgBroadcast.cpp index 34ebc5b..7ca9529 100644 --- a/Sources/tools/MsgBroadcast/MsgBroadcast.cpp +++ b/Sources/tools/MsgBroadcast/MsgBroadcast.cpp @@ -81,6 +81,7 @@ static char * GetMessageChar(messageType_te Id) { MACRO_DISPLAY_MSG(EDN_MSG__QUIT) MACRO_DISPLAY_MSG(EDN_MSG__BUFFER_CHANGE_CURRENT) + MACRO_DISPLAY_MSG(EDN_MSG__USER_DISPLAY_CHANGE) MACRO_DISPLAY_MSG(EDN_MSG__GUI_SHOW_MAIN_WINDOWS) MACRO_DISPLAY_MSG(EDN_MSG__GUI_SHOW_SEARCH) diff --git a/Sources/tools/MsgBroadcast/MsgBroadcast.h b/Sources/tools/MsgBroadcast/MsgBroadcast.h index f669468..547a285 100644 --- a/Sources/tools/MsgBroadcast/MsgBroadcast.h +++ b/Sources/tools/MsgBroadcast/MsgBroadcast.h @@ -41,6 +41,7 @@ typedef enum { // Programm is Quitting... close all if needed ... EDN_MSG__QUIT, EDN_MSG__BUFFER_CHANGE_CURRENT, // set the new current BUFFER ... + EDN_MSG__USER_DISPLAY_CHANGE, // User change the display ==> need to reload all the display depending on color internal // DESTINATION : GUI_MANAGER MSG_TO_GUI_MANAGER__START, diff --git a/data/color_black.xml b/data/color_black.xml index 760549a..bdfa2d2 100644 --- a/data/color_black.xml +++ b/data/color_black.xml @@ -18,7 +18,7 @@ - +