[DEV] start correct plugin interface
This commit is contained in:
parent
7e6f56a1cd
commit
668570cdc7
@ -180,6 +180,7 @@ void MainWindows::init() {
|
||||
mySizerVert->subWidgetAdd(mySizerHori);
|
||||
|
||||
myMenu = ewol::widget::Menu::create();
|
||||
myMenu->setName("appl-menu-interface");
|
||||
mySizerHori->subWidgetAdd(myMenu);
|
||||
int32_t idMenuFile = myMenu->addTitle("File");
|
||||
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, "Redo", "THEME:GUI:Redo.edf", "menu:redo");
|
||||
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, "Un-Select","", "menu:select-none");
|
||||
myMenu->add(idMenuEdit, "Goto line ...","", "menu:goto-line");
|
||||
|
@ -24,6 +24,10 @@ appl::TextViewerPlugin::TextViewerPlugin() :
|
||||
m_activateOnReceiveShortCut(false),
|
||||
m_activateOnCursorMove(false) {
|
||||
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() {
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <ewol/object/Object.h>
|
||||
#include <appl/Gui/TextViewer.h>
|
||||
#include <ewol/compositing/Text.h>
|
||||
#include <ewol/widget/Menu.h>
|
||||
|
||||
namespace appl {
|
||||
class TextViewerPlugin : public ewol::Object {
|
||||
@ -23,6 +24,8 @@ namespace appl {
|
||||
public:
|
||||
DECLARE_FACTORY(TextViewerPlugin);
|
||||
virtual ~TextViewerPlugin();
|
||||
protected:
|
||||
std::weak_ptr<ewol::widget::Menu> m_menuInterface;
|
||||
private:
|
||||
bool m_isEnable; //!< The plugin is enable or not (for all viewer).
|
||||
public:
|
||||
|
@ -25,7 +25,20 @@ void appl::TextPluginCopy::init() {
|
||||
}
|
||||
|
||||
void appl::TextPluginCopy::onPluginEnable(appl::TextViewer& _textDrawer) {
|
||||
APPL_ERROR("plop");
|
||||
// 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+c", "appl::TextPluginCopy::copy");
|
||||
_textDrawer.ext_shortCutAdd("ctrl+v", "appl::TextPluginCopy::Paste");
|
||||
|
@ -61,7 +61,6 @@ class MainApplication : public ewol::context::Application {
|
||||
|
||||
appl::highlightManager::init();
|
||||
appl::textPluginManager::init();
|
||||
appl::textPluginManager::addDefaultPlugin();
|
||||
|
||||
// Request load of the user configuration ...
|
||||
//ewol::userConfig::load();
|
||||
@ -84,6 +83,9 @@ class MainApplication : public ewol::context::Application {
|
||||
// create the specific windows
|
||||
_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
|
||||
APPL_INFO("show list of files : ");
|
||||
|
@ -102,9 +102,12 @@ def create(target):
|
||||
myModule.compile_flags_CC([
|
||||
"-DAPPL_VERSION=\"\\\"" + versionID + "\\\"\""
|
||||
])
|
||||
tagFile = tools.get_current_path(__file__) + "/tagCode"
|
||||
versionIDCode = tools.file_read_data(tagFile)
|
||||
|
||||
# set the package properties :
|
||||
myModule.pkg_set("VERSION", versionID)
|
||||
myModule.pkg_set("VERSION_CODE", versionIDCode)
|
||||
myModule.pkg_set("COMPAGNY_TYPE", "org")
|
||||
myModule.pkg_set("COMPAGNY_NAME", "Edouard DUPIN")
|
||||
myModule.pkg_set("MAINTAINER", ["Mr DUPIN Edouard <yui.heero@gmail.com>"])
|
||||
|
Loading…
x
Reference in New Issue
Block a user