mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 03:54:54 +02:00
restore terminal, rework console
This commit is contained in:
@@ -63,7 +63,7 @@ public:
|
||||
|
||||
/// Returns the class name used in Lua
|
||||
virtual std::string getLuaObjectName() const {
|
||||
// this could later be cached for more performance
|
||||
// TODO: this could be cached for more performance
|
||||
return Fw::demangleName(typeid(*this).name());
|
||||
}
|
||||
|
||||
|
@@ -95,6 +95,13 @@ void OTMLNode::addChild(const OTMLNodePtr& newChild)
|
||||
for(const OTMLNodePtr& node : m_children) {
|
||||
if(node->tag() == newChild->tag() && (node->isUnique() || newChild->isUnique())) {
|
||||
newChild->setUnique(true);
|
||||
|
||||
if(node->hasChildren() && newChild->hasChildren()) {
|
||||
OTMLNodePtr tmpNode = node->clone();
|
||||
tmpNode->merge(newChild);
|
||||
newChild->copy(tmpNode);
|
||||
}
|
||||
|
||||
replaceChild(node, newChild);
|
||||
|
||||
// remove any other child with the same tag
|
||||
@@ -140,6 +147,18 @@ bool OTMLNode::replaceChild(const OTMLNodePtr& oldChild, const OTMLNodePtr& newC
|
||||
return false;
|
||||
}
|
||||
|
||||
void OTMLNode::copy(const OTMLNodePtr& node)
|
||||
{
|
||||
setTag(node->tag());
|
||||
setValue(node->value());
|
||||
setUnique(node->isUnique());
|
||||
setNull(node->isNull());
|
||||
setSource(node->source());
|
||||
clear();
|
||||
for(const OTMLNodePtr& child : node->m_children)
|
||||
addChild(child->clone());
|
||||
}
|
||||
|
||||
void OTMLNode::merge(const OTMLNodePtr& node)
|
||||
{
|
||||
for(const OTMLNodePtr& child : node->m_children)
|
||||
|
@@ -63,6 +63,7 @@ public:
|
||||
void addChild(const OTMLNodePtr& newChild);
|
||||
bool removeChild(const OTMLNodePtr& oldChild);
|
||||
bool replaceChild(const OTMLNodePtr& oldChild, const OTMLNodePtr& newChild);
|
||||
void copy(const OTMLNodePtr& node);
|
||||
void merge(const OTMLNodePtr& node);
|
||||
void clear();
|
||||
|
||||
|
@@ -411,6 +411,9 @@ void UILineEdit::onFocusChange(bool focused, Fw::FocusReason reason)
|
||||
|
||||
bool UILineEdit::onKeyPress(uchar keyCode, std::string keyText, int keyboardModifiers)
|
||||
{
|
||||
if(UIWidget::onKeyPress(keyCode, keyText, keyboardModifiers))
|
||||
return true;
|
||||
|
||||
if(keyCode == Fw::KeyDelete) // erase right character
|
||||
removeCharacter(true);
|
||||
else if(keyCode == Fw::KeyBackspace) // erase left character {
|
||||
@@ -433,8 +436,7 @@ bool UILineEdit::onKeyPress(uchar keyCode, std::string keyText, int keyboardModi
|
||||
} else if(!keyText.empty() && (keyboardModifiers == Fw::KeyboardNoModifier || keyboardModifiers == Fw::KeyboardShiftModifier))
|
||||
appendText(keyText);
|
||||
else
|
||||
return UIWidget::onKeyPress(keyCode, keyText, keyboardModifiers);
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -1116,8 +1116,12 @@ void UIWidget::onStyleApply(const std::string& styleName, const OTMLNodePtr& sty
|
||||
// anchors
|
||||
else if(boost::starts_with(node->tag(), "anchors.")) {
|
||||
UIWidgetPtr parent = getParent();
|
||||
if(!parent)
|
||||
throw OTMLException(node, "cannot create anchor, there is no parent widget!");
|
||||
if(!parent) {
|
||||
if(m_firstOnStyle)
|
||||
throw OTMLException(node, "cannot create anchor, there is no parent widget!");
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
UIAnchorLayoutPtr anchorLayout = parent->getLayout()->asUIAnchorLayout();
|
||||
if(!anchorLayout)
|
||||
@@ -1331,9 +1335,7 @@ void UIWidget::propagateOnMouseRelease(const Point& mousePos, Fw::MouseButton bu
|
||||
child->setPressed(false);
|
||||
}
|
||||
|
||||
// fire release events only when pressed
|
||||
if(isPressed())
|
||||
onMouseRelease(mousePos, button);
|
||||
onMouseRelease(mousePos, button);
|
||||
}
|
||||
|
||||
bool UIWidget::propagateOnMouseMove(const Point& mousePos, const Point& mouseMoved)
|
||||
|
Reference in New Issue
Block a user