bool ewol::widget::ParameterList::onEventInput(const ewol::event::Input& _event) { if (true == WidgetScrolled::onEventInput(_event)) { keepFocus(); // nothing to do ... done on upper widet ... return true; } if (_event.getId() == 1 && _event.getStatus() == gale::key::status_single) { vec2 relativePos = relativePosition(_event.getPos()); // corection for the openGl abstraction relativePos.setY(m_size.y() - relativePos.y()); // TODO : Rework this ... /* int32_t fontId = getDefaultFontId(); //int32_t minWidth = ewol::getWidth(fontId, m_label.c_str()); int32_t minHeight = ewol::getHeight(fontId); */ int32_t minHeight = 20; int32_t rawID = (relativePos.y()+m_originScrooled.y()) / (minHeight + 2*m_paddingSizeY); // generate an event on a rawId if the element request change and Select it ... if (rawID >= 0 && (size_t)rawID < m_list.size()) { if (m_list[rawID]!=nullptr) { if (m_list[rawID]->m_refId >= 0) { signalSelect.emit(m_list[rawID]->m_refId); m_idSelected = rawID; markToRedraw(); return true; } } } } return false; }
bool ewol::widget::List::onEventInput(const ewol::event::Input& _event) { vec2 relativePos = relativePosition(_event.getPos()); if (true == WidgetScrolled::onEventInput(_event)) { keepFocus(); // nothing to do ... done on upper widet ... return true; } // parse all the loged row position to find the good one... int32_t rawID = -1; for (size_t iii=0; iii<m_lineSize.size()-1; iii++) { if( relativePos.y()<m_lineSize[iii].y() && relativePos.y() >= m_lineSize[iii+1].y() ) { // we find the raw : rawID = m_lineSize[iii].x(); break; } } //EWOL_DEBUG("List event : idInput=" << IdInput << " typeEvent=" << typeEvent << " raw=" << rawID << " pos=" << pos << ""); bool isUsed = onItemEvent(_event.getId(), _event.getStatus(), 0, rawID, _event.getPos().x(), _event.getPos().y()); if (true == isUsed) { // TODO : this generate bugs ... I did not understand why .. //ewol::WidgetSharedManager::focusKeep(this); } return isUsed; }
bool appl::TextViewer::onEventInput(const ewol::event::Input& _event) { if ( _event.getId() != 0 && _event.getStatus() == gale::key::status::down) { keepFocus(); } //tic(); if (m_buffer == nullptr) { return false; } // First call the scrolling widget : if (ewol::widget::WidgetScrolled::onEventInput(_event) == true) { markToRedraw(); return true; } // Second call plugin if (m_pluginManager->onEventInput(*this, _event) == true) { markToRedraw(); return true; } vec2 relativePos = relativePosition(_event.getPos()); // offset for the lineNumber: relativePos -= vec2(m_lastOffsetDisplay, 0); // offset for the scrolling: relativePos += vec2(m_originScrooled.x(), -m_originScrooled.y()); // invert for the buffer event ... relativePos.setY(m_size.y()-relativePos.y()); if (relativePos.x()<0) { relativePos.setX(0); } if ( _event.getId() == 12 && _event.getStatus() == gale::key::status::pressSingle) { APPL_TODO("RAT5 SAVE button ==> TODO implement"); // Rat5 save event //sendMultiCast(ednMsgGuiSave, "current"); return true; } // just forward event == > manage directly in the buffer if (_event.getId() == 1) { // mouse selection : //if (_event.getType() == gale::key::typeMouse) { if (_event.getStatus() == gale::key::status::down) { //if (_event.getSpecialKey().isSetShift() == false) { appl::Buffer::Iterator newPos = getMousePosition(relativePos); m_buffer->setSelectMode(false); moveCursor(newPos); m_buffer->setSelectMode(true); markToRedraw(); return true; //} } else if (_event.getStatus() == gale::key::status::up) { appl::Buffer::Iterator newPos = getMousePosition(relativePos); moveCursor(newPos); m_buffer->setSelectMode(false); // Copy selection : std::string value; m_buffer->copy(value); if (value.size() != 0) { gale::context::clipBoard::set(gale::context::clipBoard::clipboardSelection, value); } markToRedraw(); return true; } //} if (_event.getStatus() == gale::key::status::pressSingle) { if ( _event.getType() == gale::key::type::mouse || _event.getType() == gale::key::type::finger) { appl::Buffer::Iterator newPos = getMousePosition(relativePos); moveCursor(newPos); markToRedraw(); return true; } } else if (_event.getStatus() == gale::key::status::pressDouble) { mouseEventDouble(); // Copy selection : std::string value; m_buffer->copy(value); if (value.size() != 0) { gale::context::clipBoard::set(gale::context::clipBoard::clipboardSelection, value); } markToRedraw(); return true; } else if (_event.getStatus() == gale::key::status::pressTriple) { mouseEventTriple(); // Copy selection : std::string value; m_buffer->copy(value); if (value.size() != 0) { gale::context::clipBoard::set(gale::context::clipBoard::clipboardSelection, value); } markToRedraw(); return true; } else if (_event.getStatus() == gale::key::status::move) { if (m_buffer->getSelectMode() == true) { //int64_t timeStart = ewol::getTime(); appl::Buffer::Iterator newPos = getMousePosition(relativePos); //int64_t timeMedium1 = ewol::getTime(); moveCursor(newPos); //int64_t timeMedium2 = ewol::getTime(); markToRedraw(); /* int64_t timeStop = ewol::getTime(); APPL_DEBUG("Display selection=" << (timeStop-timeStart)/1000.0f << " ms"); APPL_DEBUG(" 1=" << (timeMedium1-timeStart)/1000.0f << " ms"); APPL_DEBUG(" 2=" << (timeMedium2-timeMedium1)/1000.0f << " ms"); */ return true; } } } else if (2 == _event.getId()) { if (gale::key::status::pressSingle == _event.getStatus()) { appl::Buffer::Iterator newPos = getMousePosition(relativePos); moveCursor(newPos); gale::context::clipBoard::request(gale::context::clipBoard::clipboardSelection); markToRedraw(); return true; } } return false; }