[DEBUG] correct parameter error and set back parameter activity

This commit is contained in:
2017-03-07 21:42:24 +01:00
parent 395ada4ec8
commit c4f59d8734
94 changed files with 142 additions and 3458 deletions

View File

@@ -177,21 +177,21 @@ void MainWindows::init() {
int32_t idMenuFile = myMenu->addTitle("_T{File}");
myMenu->add(idMenuFile, "_T{New}", "", "menu:new");
myMenu->addSpacer(idMenuFile);
myMenu->add(idMenuFile, "_T{Open}", "THEME:GUI:Load.edf", "menu:open");
myMenu->add(idMenuFile, "_T{Close}", "THEME:GUI:Close.edf", "menu:close");
myMenu->add(idMenuFile, "_T{Open}", "THEME:GUI:Load.svg", "menu:open");
myMenu->add(idMenuFile, "_T{Close}", "THEME:GUI:Close.svg", "menu:close");
myMenu->add(idMenuFile, "_T{Close (all)}", "", "menu:close-all");
myMenu->add(idMenuFile, "_T{Save}", "THEME:GUI:Save.edf", "menu:save");
myMenu->add(idMenuFile, "_T{Save}", "THEME:GUI:Save.svg", "menu:save");
myMenu->add(idMenuFile, "_T{Save As ...}", "", "menu:save-as");
myMenu->addSpacer(idMenuFile);
myMenu->add(idMenuFile, "_T{Properties}", "THEME:GUI:Parameter.edf", "menu:property");
myMenu->add(idMenuFile, "_T{Properties}", "THEME:GUI:Parameter.svg", "menu:property");
myMenu->addSpacer(idMenuFile);
myMenu->add(idMenuFile, "_T{Exit}", "", "menu:exit");
int32_t idMenuEdit = myMenu->addTitle("_T{Edit}");
myMenu->add(idMenuEdit, "_T{Goto line ...}","", "menu:goto-line");
myMenu->addSpacer();
int32_t idMenuSearch = myMenu->addTitle("_T{Search}");
myMenu->add(idMenuSearch, "_T{Search}", "THEME:GUI:Search.edf", "menu:search");
myMenu->add(idMenuSearch, "_T{Replace}", "THEME:GUI:Replace.edf", "menu:replace");
myMenu->add(idMenuSearch, "_T{Search}", "THEME:GUI:Search.svg", "menu:search");
myMenu->add(idMenuSearch, "_T{Replace}", "THEME:GUI:Replace.svg", "menu:replace");
myMenu->addSpacer(idMenuSearch);
myMenu->add(idMenuSearch, "_T{Find (previous)}","", "menu:find:previous");
myMenu->add(idMenuSearch, "_T{Find (next)}", "", "menu:find:next");

View File

@@ -20,26 +20,26 @@ appl::widget::Search::Search() :
}
void appl::widget::Search::init() {
ewol::widget::Composer::init();
loadFromFile("DATA:GUI-Search.xml");
loadFromFile("DATA:GUI-Search.xml", getId());
m_viewerManager = appl::ViewerManager::create();
// link event
subBind(ewol::widget::Button, "SEARCH:close", signalPressed, sharedFromThis(), &appl::widget::Search::OnCallbackHide);
subBind(ewol::widget::Entry, "SEARCH:search-entry", signalModify, sharedFromThis(), &appl::widget::Search::OnCallbackSearchValue);
subBind(ewol::widget::Entry, "SEARCH:search-entry", signalEnter, sharedFromThis(), &appl::widget::Search::OnCallbackSearchEntryValidate);
subBind(ewol::widget::Button, "SEARCH:search", signalPressed, sharedFromThis(), &appl::widget::Search::OnCallbackSearch);
subBind(ewol::widget::Entry, "SEARCH:replace-entry", signalModify, sharedFromThis(), &appl::widget::Search::OnCallbackReplaceValue);
subBind(ewol::widget::Entry, "SEARCH:replace-entry", signalEnter, sharedFromThis(), &appl::widget::Search::OnCallbackReplaceEntryValidate);
subBind(ewol::widget::Button, "SEARCH:replace", signalPressed, sharedFromThis(), &appl::widget::Search::OnCallbackReplace);
subBind(ewol::widget::Button, "SEARCH:case", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackCase);
subBind(ewol::widget::Button, "SEARCH:wrap", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackWrap);
subBind(ewol::widget::Button, "SEARCH:up-down", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackForward);
subBind(ewol::widget::Button, "[" + etk::to_string(getId()) + "]SEARCH:close", signalPressed, sharedFromThis(), &appl::widget::Search::OnCallbackHide);
subBind(ewol::widget::Entry, "[" + etk::to_string(getId()) + "]SEARCH:search-entry", signalModify, sharedFromThis(), &appl::widget::Search::OnCallbackSearchValue);
subBind(ewol::widget::Entry, "[" + etk::to_string(getId()) + "]SEARCH:search-entry", signalEnter, sharedFromThis(), &appl::widget::Search::OnCallbackSearchEntryValidate);
subBind(ewol::widget::Button, "[" + etk::to_string(getId()) + "]SEARCH:search", signalPressed, sharedFromThis(), &appl::widget::Search::OnCallbackSearch);
subBind(ewol::widget::Entry, "[" + etk::to_string(getId()) + "]SEARCH:replace-entry", signalModify, sharedFromThis(), &appl::widget::Search::OnCallbackReplaceValue);
subBind(ewol::widget::Entry, "[" + etk::to_string(getId()) + "]SEARCH:replace-entry", signalEnter, sharedFromThis(), &appl::widget::Search::OnCallbackReplaceEntryValidate);
subBind(ewol::widget::Button, "[" + etk::to_string(getId()) + "]SEARCH:replace", signalPressed, sharedFromThis(), &appl::widget::Search::OnCallbackReplace);
subBind(ewol::widget::Button, "[" + etk::to_string(getId()) + "]SEARCH:case", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackCase);
subBind(ewol::widget::Button, "[" + etk::to_string(getId()) + "]SEARCH:wrap", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackWrap);
subBind(ewol::widget::Button, "[" + etk::to_string(getId()) + "]SEARCH:up-down", signalValue, sharedFromThis(), &appl::widget::Search::OnCallbackForward);
// set default properties
propertySetOnWidgetNamed("SEARCH:case", "value", etk::to_string(m_caseSensitive));
propertySetOnWidgetNamed("SEARCH:wrap", "value", etk::to_string(m_wrap));
propertySetOnWidgetNamed("SEARCH:up-down", "value", etk::to_string(m_forward));
propertySetOnWidgetNamed("[" + etk::to_string(getId()) + "]SEARCH:case", "value", etk::to_string(m_caseSensitive));
propertySetOnWidgetNamed("[" + etk::to_string(getId()) + "]SEARCH:wrap", "value", etk::to_string(m_wrap));
propertySetOnWidgetNamed("[" + etk::to_string(getId()) + "]SEARCH:up-down", "value", etk::to_string(m_forward));
// get widget
m_searchEntry = ememory::dynamicPointerCast<ewol::widget::Entry>(getSubObjectNamed("SEARCH:search-entry"));
m_replaceEntry = ememory::dynamicPointerCast<ewol::widget::Entry>(getSubObjectNamed("SEARCH:replace-entry"));
m_searchEntry = ememory::dynamicPointerCast<ewol::widget::Entry>(getSubObjectNamed("[" + etk::to_string(getId()) + "]SEARCH:search-entry"));
m_replaceEntry = ememory::dynamicPointerCast<ewol::widget::Entry>(getSubObjectNamed("[" + etk::to_string(getId()) + "]SEARCH:replace-entry"));
// basicly hiden ...
propertyHide.set(true);
}

View File

@@ -270,7 +270,7 @@ void appl::TextViewer::onRegenerateDisplay() {
m_buffer->hightlightGenerateLines(displayLocalSyntax, startingIt, (m_size.y()/tmpLetterSize.y()) + 5);
float maxSizeX = 0;
appl::HighlightInfo * HLColor = nullptr;
bool DisplayCursorAndSelection = isSelectedLast();
bool displayCursorAndSelection = isSelectedLast();
appl::Buffer::Iterator it;
for (it = startingIt;
(bool)it == true;
@@ -287,13 +287,14 @@ void appl::TextViewer::onRegenerateDisplay() {
countColomn = 0;
maxSizeX = std::max(m_displayText.getPos().x(), maxSizeX);
// Display the end line position only if we have the focus ...
if (DisplayCursorAndSelection == true) {
if (it >= selectPosStart && it < selectPosStop) {
ewol::compositing::Drawing& draw = m_displayText.getDrawing();
draw.setColor(etk::Color<>(0xFF, 0x00, 0x00, 0xFF));
draw.setPos(m_displayText.getPos() + tmpLetterSize/4.0f);
draw.rectangle(m_displayText.getPos() + tmpLetterSize*3.0f/4.0f);
}
if ( ( displayCursorAndSelection == true
&& it >= selectPosStart
&& it < selectPosStop)
|| globals::isSetDisplayEndOfLine() == true) {
ewol::compositing::Drawing& draw = m_displayText.getDrawing();
draw.setColor(etk::Color<>(0xFF, 0x00, 0x00, 0xFF));
draw.setPos(m_displayText.getPos() + tmpLetterSize/4.0f);
draw.rectangle(m_displayText.getPos() + tmpLetterSize*3.0f/4.0f);
}
if (tmpCursorLenght == 0.0f) {
tmpCursorLenght = tmpLetterSize.x();
@@ -321,15 +322,17 @@ void appl::TextViewer::onRegenerateDisplay() {
m_displayText.setColor((*m_paintingProperties)[m_colorNormal].getForeground());
}
if (haveBackground == false) {
if (*it == u32char::Space) {
if ( *it == u32char::Space
&& globals::isSetDisplaySpaceChar() == true) {
m_displayText.setColorBg((*m_paintingProperties)[m_colorSpace].getForeground());
} else if (*it == u32char::Tabulation) {
} else if ( *it == u32char::Tabulation
&& globals::isSetDisplayTabChar() == true) {
m_displayText.setColorBg((*m_paintingProperties)[m_colorTabulation].getForeground());
}
}
m_buffer->expand(countColomn, *it, stringToDisplay);
// Display selection only if we have the focus ...
if (DisplayCursorAndSelection == true) {
if (displayCursorAndSelection == true) {
if (it >= selectPosStart && it < selectPosStop) {
m_displayText.setColor((*m_paintingProperties)[m_colorSelection].getForeground());
m_displayText.setColorBg((*m_paintingProperties)[m_colorSelection].getBackground());
@@ -394,7 +397,7 @@ bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
}
char32_t localValue = _event.getChar();
if (localValue == u32char::Return) {
if (true == _event.getSpecialKey().getShift()) {
if (_event.getSpecialKey().getShift() == true) {
localValue = u32char::CarrierReturn;
}
} else if (localValue == u32char::Suppress ) {
@@ -431,7 +434,7 @@ bool appl::TextViewer::onEventEntry(const ewol::event::Entry& _event) {
appl::Buffer::Iterator posEnd = pos;
++posEnd;
replace(output, pos, posEnd);
//TODO : choisce UTF ... replace(localValue, pos, posEnd);
//TODO : choice UTF ... replace(localValue, pos, posEnd);
} else {
std::string myString = output;
write(myString);

View File

@@ -6,6 +6,7 @@
#include <appl/TextPluginAutoIndent.hpp>
#include <gale/context/clipBoard.hpp>
#include <appl/Gui/TextViewer.hpp>
#include <appl/global.hpp>
appl::TextPluginAutoIndent::TextPluginAutoIndent() {
m_activateOnEventEntry = true;
@@ -18,6 +19,10 @@ bool appl::TextPluginAutoIndent::onEventEntry(appl::TextViewer& _textDrawer,
if (isEnable() == false) {
return false;
}
// The user disable with global parameter
if (globals::isSetAutoIndent() == false) {
return false;
}
//APPL_DEBUG("KB EVENT : " << _event);
// just forward event == > manage directly in the buffer
if (_event.getType() != gale::key::keyboard::character) {

View File

@@ -24,8 +24,8 @@ void appl::TextPluginHistory::onPluginEnable(appl::TextViewer& _textDrawer) {
if (menu != nullptr) {
m_menuIdTitle = menu->addTitle("Edit");
if (m_menuIdTitle != -1) {
m_menuIdUndo = menu->add(m_menuIdTitle, "Undo", "THEME:GUI:Undo.edf", "appl::TextPluginHistory::menu:undo");
m_menuIdRedo = menu->add(m_menuIdTitle, "Redo", "THEME:GUI:Redo.edf", "appl::TextPluginHistory::menu:redo");
m_menuIdUndo = menu->add(m_menuIdTitle, "Undo", "THEME:GUI:Undo.svg", "appl::TextPluginHistory::menu:undo");
m_menuIdRedo = menu->add(m_menuIdTitle, "Redo", "THEME:GUI:Redo.svg", "appl::TextPluginHistory::menu:redo");
}
}
// add event :

View File

@@ -9,6 +9,10 @@
#include <ewol/context/Context.hpp>
#include <gale/resource/Manager.hpp>
#include <etk/os/FSNode.hpp>
#include <ejson/ejson.hpp>
static std::string g_baseDBName = "USERDATA:genericConfig.json";
class myParamGlobal : public ewol::Object {
public:
@@ -24,6 +28,29 @@ class myParamGlobal : public ewol::Object {
m_displaySpaceChar(this, "display-space", true, "Display the space char") {
m_static = true; // Note : set the object static notification( Must be set or assert at the end of process)
propertyName.set("edn_global_param");
load();
}
void load() {
ejson::Document database;
bool ret = database.load(g_baseDBName);
if (ret == false) {
return;
}
ejson::Object obj = database["globals"].toObject();
m_displayEOL.set(obj["display-eol"].toBoolean().get());
m_AutoIndent.set(obj["auto-indent"].toBoolean().get());
m_displayTabChar.set(obj["display-tab-char"].toBoolean().get());
m_displaySpaceChar.set(obj["display-space-char"].toBoolean().get());
}
void store() {
ejson::Document database;
ejson::Object obj;
database.add("globals", obj);
obj.add("display-eol", ejson::Boolean(m_displayEOL.get()));
obj.add("auto-indent", ejson::Boolean(m_AutoIndent.get()));
obj.add("display-tab-char", ejson::Boolean(m_displayTabChar.get()));
obj.add("display-space-char", ejson::Boolean(m_displaySpaceChar.get()));
bool retGenerate = database.storeSafe(g_baseDBName);
}
};
@@ -34,12 +61,18 @@ static myParamGlobal& l_obj() {
}
void globals::init() {
//ewol::userConfig::addUserConfig(&l_obj());
myParamGlobal& tmpVal = l_obj();
// nothing to do ...
(void)tmpVal;
}
void globals::UnInit() {
// nothing to do ...
//ewol::userConfig::RmUserConfig(&l_obj());
}
void globals::store() {
l_obj().store();
}
// -----------------------------------------------------------
@@ -49,7 +82,7 @@ bool globals::isSetDisplayEndOfLine() {
void globals::setDisplayEndOfLine(bool newVal) {
l_obj().m_displayEOL.set(newVal);
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
ewol::getContext().forceRedrawAll();
}
// -----------------------------------------------------------
@@ -59,7 +92,7 @@ bool globals::isSetDisplaySpaceChar() {
void globals::setDisplaySpaceChar(bool _newVal) {
l_obj().m_displaySpaceChar.set(_newVal);
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
ewol::getContext().forceRedrawAll();
}
// -----------------------------------------------------------
bool globals::isSetDisplayTabChar() {
@@ -68,7 +101,7 @@ bool globals::isSetDisplayTabChar() {
void globals::setDisplayTabChar(bool _newVal) {
l_obj().m_displayTabChar.set(_newVal);
//ewol::widgetMessageMultiCast::Send(-1, ednMsgUserDisplayChange);
ewol::getContext().forceRedrawAll();
}
// -----------------------------------------------------------
@@ -103,69 +136,20 @@ globals::ParameterGlobalsGui::ParameterGlobalsGui() {
}
void globals::ParameterGlobalsGui::init() {
ewol::widget::Sizer::init();
propertyMode.set(ewol::widget::Sizer::modeVert);
ememory::SharedPtr<ewol::widget::CheckBox> myCheckbox;
ememory::SharedPtr<ewol::widget::Spacer> mySpacer;
ewol::widget::Composer::init();
loadFromFile("DATA:GUI-Parameter-global.xml", getId());
mySpacer = ewol::widget::Spacer::create();
if (mySpacer == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
mySpacer->propertyExpand.set(bvec2(true,true));
subWidgetAdd(mySpacer);
}
myCheckbox = ewol::widget::CheckBox::create();
if (myCheckbox == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
//TODO : myCheckbox->propertyLabel.set("Automatic Indentation");
myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->propertyValue.set(isSetAutoIndent());
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackIndentation);
subWidgetAdd(myCheckbox);
}
myCheckbox = ewol::widget::CheckBox::create();
if (myCheckbox == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
//TODO : myCheckbox->propertyLabel.set("Display space char (' ')");
myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->propertyValue.set(isSetDisplaySpaceChar());
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackSpace);
subWidgetAdd(myCheckbox);
}
myCheckbox = ewol::widget::CheckBox::create();
if (myCheckbox == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
//TODO : myCheckbox->propertyLabel.set("Display tabulation char ('\\t')");
myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->propertyValue.set(isSetDisplayTabChar());
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackTabulation);
subWidgetAdd(myCheckbox);
}
myCheckbox = ewol::widget::CheckBox::create();
if (myCheckbox == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
//TODO : myCheckbox->propertyLabel.set("Display end of line ('\\n')");
myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->propertyValue.set(isSetDisplayEndOfLine());
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackEndOfLine);
subWidgetAdd(myCheckbox);
}
myCheckbox = ewol::widget::CheckBox::create();
if (myCheckbox == nullptr) {
APPL_ERROR("Can not allocate widget == > display might be in error");
} else {
//TODO : myCheckbox->propertyLabel.set("switch Rounded/default");
myCheckbox->propertyExpand.set(bvec2(true,false));
myCheckbox->propertyValue.set(isSetDisplayEndOfLine());
myCheckbox->signalValue.connect(sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackRounded);
subWidgetAdd(myCheckbox);
}
propertySetOnWidgetNamed("[" + etk::to_string(getId()) + "]appl-param:auto-indent", "value", etk::to_string(isSetAutoIndent()));
propertySetOnWidgetNamed("[" + etk::to_string(getId()) + "]appl-param:display-space-char", "value", etk::to_string(isSetDisplaySpaceChar()));
propertySetOnWidgetNamed("[" + etk::to_string(getId()) + "]appl-param:display-tab", "value", etk::to_string(isSetDisplayTabChar()));
propertySetOnWidgetNamed("[" + etk::to_string(getId()) + "]appl-param:display-eol", "value", etk::to_string(isSetDisplayEndOfLine()));
propertySetOnWidgetNamed("[" + etk::to_string(getId()) + "]appl-param:display-shape", "value", etk::to_string(isSetDisplayEndOfLine()));
subBind(ewol::widget::CheckBox, "[" + etk::to_string(getId()) + "]appl-param:auto-indent", signalValue, sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackIndentation);
subBind(ewol::widget::CheckBox, "[" + etk::to_string(getId()) + "]appl-param:display-space-char", signalValue, sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackSpace);
subBind(ewol::widget::CheckBox, "[" + etk::to_string(getId()) + "]appl-param:display-tab", signalValue, sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackTabulation);
subBind(ewol::widget::CheckBox, "[" + etk::to_string(getId()) + "]appl-param:display-eol", signalValue, sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackEndOfLine);
subBind(ewol::widget::CheckBox, "[" + etk::to_string(getId()) + "]appl-param:display-shape", signalValue, sharedFromThis(), &globals::ParameterGlobalsGui::onCallbackRounded);
}
globals::ParameterGlobalsGui::~ParameterGlobalsGui() {
@@ -174,20 +158,25 @@ globals::ParameterGlobalsGui::~ParameterGlobalsGui() {
void globals::ParameterGlobalsGui::onCallbackEndOfLine(const bool& _value) {
APPL_INFO("property change 'EOL' : " << _value);
setDisplayEndOfLine(_value);
}
void globals::ParameterGlobalsGui::onCallbackIndentation(const bool& _value) {
APPL_INFO("property change 'display indent' : " << _value);
setAutoIndent(_value);
}
void globals::ParameterGlobalsGui::onCallbackSpace(const bool& _value) {
APPL_INFO("property change 'display space' : " << _value);
setDisplaySpaceChar(_value);
}
void globals::ParameterGlobalsGui::onCallbackTabulation(const bool& _value) {
APPL_INFO("property change 'display-tab' : " << _value);
setDisplayTabChar(_value);
}
void globals::ParameterGlobalsGui::onCallbackRounded(const bool& _value) {
APPL_INFO("property change 'shape mode' : " << _value);
if (_value == true) {
etk::theme::setName("GUI", "rounded");;
} else {

View File

@@ -5,11 +5,14 @@
*/
#pragma once
#include <appl/debug.hpp>
#include <ewol/widget/Sizer.hpp>
#include <ewol/widget/Composer.hpp>
namespace globals {
void init();
void UnInit();
void store();
int32_t getNbColoneBorder();
int32_t getNbLineBorder();
@@ -29,7 +32,7 @@ namespace globals {
bool OrderTheBufferList();
class ParameterGlobalsGui : public ewol::widget::Sizer {
class ParameterGlobalsGui : public ewol::widget::Composer {
protected:
ParameterGlobalsGui();
void init();