[DEV] start correct plugin interface
This commit is contained in:
parent
7e6f56a1cd
commit
668570cdc7
@ -180,6 +180,7 @@ void MainWindows::init() {
|
|||||||
mySizerVert->subWidgetAdd(mySizerHori);
|
mySizerVert->subWidgetAdd(mySizerHori);
|
||||||
|
|
||||||
myMenu = ewol::widget::Menu::create();
|
myMenu = ewol::widget::Menu::create();
|
||||||
|
myMenu->setName("appl-menu-interface");
|
||||||
mySizerHori->subWidgetAdd(myMenu);
|
mySizerHori->subWidgetAdd(myMenu);
|
||||||
int32_t idMenuFile = myMenu->addTitle("File");
|
int32_t idMenuFile = myMenu->addTitle("File");
|
||||||
myMenu->add(idMenuFile, "New", "", "menu:new");
|
myMenu->add(idMenuFile, "New", "", "menu:new");
|
||||||
@ -197,11 +198,6 @@ void MainWindows::init() {
|
|||||||
myMenu->add(idMenuEdit, "Undo", "THEME:GUI:Undo.edf", "menu:undo");
|
myMenu->add(idMenuEdit, "Undo", "THEME:GUI:Undo.edf", "menu:undo");
|
||||||
myMenu->add(idMenuEdit, "Redo", "THEME:GUI:Redo.edf", "menu:redo");
|
myMenu->add(idMenuEdit, "Redo", "THEME:GUI:Redo.edf", "menu:redo");
|
||||||
myMenu->addSpacer();
|
myMenu->addSpacer();
|
||||||
myMenu->add(idMenuEdit, "Copy", "", "menu:copy");
|
|
||||||
myMenu->add(idMenuEdit, "Cut", "", "menu:cut");
|
|
||||||
myMenu->add(idMenuEdit, "Paste", "", "menu:past");
|
|
||||||
myMenu->add(idMenuEdit, "Remove", "", "menu:remove");
|
|
||||||
myMenu->addSpacer();
|
|
||||||
myMenu->add(idMenuEdit, "Select All","", "menu:select-all");
|
myMenu->add(idMenuEdit, "Select All","", "menu:select-all");
|
||||||
myMenu->add(idMenuEdit, "Un-Select","", "menu:select-none");
|
myMenu->add(idMenuEdit, "Un-Select","", "menu:select-none");
|
||||||
myMenu->add(idMenuEdit, "Goto line ...","", "menu:goto-line");
|
myMenu->add(idMenuEdit, "Goto line ...","", "menu:goto-line");
|
||||||
|
@ -24,6 +24,10 @@ appl::TextViewerPlugin::TextViewerPlugin() :
|
|||||||
m_activateOnReceiveShortCut(false),
|
m_activateOnReceiveShortCut(false),
|
||||||
m_activateOnCursorMove(false) {
|
m_activateOnCursorMove(false) {
|
||||||
addObjectType("appl::TextViewerPlugin");
|
addObjectType("appl::TextViewerPlugin");
|
||||||
|
m_menuInterface = std::dynamic_pointer_cast<ewol::widget::Menu>(getObjectNamed("appl-menu-interface"));
|
||||||
|
if (m_menuInterface.expired() == true) {
|
||||||
|
APPL_ERROR("Can not acces to the Menu interface");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextViewerPlugin::init() {
|
void appl::TextViewerPlugin::init() {
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include <ewol/object/Object.h>
|
#include <ewol/object/Object.h>
|
||||||
#include <appl/Gui/TextViewer.h>
|
#include <appl/Gui/TextViewer.h>
|
||||||
#include <ewol/compositing/Text.h>
|
#include <ewol/compositing/Text.h>
|
||||||
|
#include <ewol/widget/Menu.h>
|
||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
class TextViewerPlugin : public ewol::Object {
|
class TextViewerPlugin : public ewol::Object {
|
||||||
@ -23,6 +24,8 @@ namespace appl {
|
|||||||
public:
|
public:
|
||||||
DECLARE_FACTORY(TextViewerPlugin);
|
DECLARE_FACTORY(TextViewerPlugin);
|
||||||
virtual ~TextViewerPlugin();
|
virtual ~TextViewerPlugin();
|
||||||
|
protected:
|
||||||
|
std::weak_ptr<ewol::widget::Menu> m_menuInterface;
|
||||||
private:
|
private:
|
||||||
bool m_isEnable; //!< The plugin is enable or not (for all viewer).
|
bool m_isEnable; //!< The plugin is enable or not (for all viewer).
|
||||||
public:
|
public:
|
||||||
|
@ -25,7 +25,20 @@ void appl::TextPluginCopy::init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void appl::TextPluginCopy::onPluginEnable(appl::TextViewer& _textDrawer) {
|
void appl::TextPluginCopy::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||||
|
APPL_ERROR("plop");
|
||||||
// add event :
|
// add event :
|
||||||
|
std::shared_ptr<ewol::widget::Menu> menu = m_menuInterface.lock();
|
||||||
|
if (menu != nullptr) {
|
||||||
|
APPL_ERROR("plop 1");
|
||||||
|
int32_t idMenuEdit = menu->addTitle("Edit");
|
||||||
|
if (idMenuEdit != -1) {
|
||||||
|
APPL_ERROR("plop 2 ");
|
||||||
|
menu->add(idMenuEdit, "Copy", "", "appl::TextPluginCopy::menu:copy");
|
||||||
|
menu->add(idMenuEdit, "Cut", "", "appl::TextPluginCopy::menu:cut");
|
||||||
|
menu->add(idMenuEdit, "Paste", "", "appl::TextPluginCopy::menu:past");
|
||||||
|
menu->add(idMenuEdit, "Remove", "", "appl::TextPluginCopy::menu:remove");
|
||||||
|
}
|
||||||
|
}
|
||||||
_textDrawer.ext_shortCutAdd("ctrl+x", "appl::TextPluginCopy::cut");
|
_textDrawer.ext_shortCutAdd("ctrl+x", "appl::TextPluginCopy::cut");
|
||||||
_textDrawer.ext_shortCutAdd("ctrl+c", "appl::TextPluginCopy::copy");
|
_textDrawer.ext_shortCutAdd("ctrl+c", "appl::TextPluginCopy::copy");
|
||||||
_textDrawer.ext_shortCutAdd("ctrl+v", "appl::TextPluginCopy::Paste");
|
_textDrawer.ext_shortCutAdd("ctrl+v", "appl::TextPluginCopy::Paste");
|
||||||
|
@ -61,7 +61,6 @@ class MainApplication : public ewol::context::Application {
|
|||||||
|
|
||||||
appl::highlightManager::init();
|
appl::highlightManager::init();
|
||||||
appl::textPluginManager::init();
|
appl::textPluginManager::init();
|
||||||
appl::textPluginManager::addDefaultPlugin();
|
|
||||||
|
|
||||||
// Request load of the user configuration ...
|
// Request load of the user configuration ...
|
||||||
//ewol::userConfig::load();
|
//ewol::userConfig::load();
|
||||||
@ -84,6 +83,9 @@ class MainApplication : public ewol::context::Application {
|
|||||||
// create the specific windows
|
// create the specific windows
|
||||||
_context.setWindows(basicWindows);
|
_context.setWindows(basicWindows);
|
||||||
|
|
||||||
|
// need to add default plugin, because they depend on the Menu widget wich might be named : "appl-menu-interface"
|
||||||
|
appl::textPluginManager::addDefaultPlugin();
|
||||||
|
|
||||||
|
|
||||||
// add files
|
// add files
|
||||||
APPL_INFO("show list of files : ");
|
APPL_INFO("show list of files : ");
|
||||||
|
@ -102,9 +102,12 @@ def create(target):
|
|||||||
myModule.compile_flags_CC([
|
myModule.compile_flags_CC([
|
||||||
"-DAPPL_VERSION=\"\\\"" + versionID + "\\\"\""
|
"-DAPPL_VERSION=\"\\\"" + versionID + "\\\"\""
|
||||||
])
|
])
|
||||||
|
tagFile = tools.get_current_path(__file__) + "/tagCode"
|
||||||
|
versionIDCode = tools.file_read_data(tagFile)
|
||||||
|
|
||||||
# set the package properties :
|
# set the package properties :
|
||||||
myModule.pkg_set("VERSION", versionID)
|
myModule.pkg_set("VERSION", versionID)
|
||||||
|
myModule.pkg_set("VERSION_CODE", versionIDCode)
|
||||||
myModule.pkg_set("COMPAGNY_TYPE", "org")
|
myModule.pkg_set("COMPAGNY_TYPE", "org")
|
||||||
myModule.pkg_set("COMPAGNY_NAME", "Edouard DUPIN")
|
myModule.pkg_set("COMPAGNY_NAME", "Edouard DUPIN")
|
||||||
myModule.pkg_set("MAINTAINER", ["Mr DUPIN Edouard <yui.heero@gmail.com>"])
|
myModule.pkg_set("MAINTAINER", ["Mr DUPIN Edouard <yui.heero@gmail.com>"])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user