mirror of
https://github.com/edubart/otclient.git
synced 2025-10-19 14:03:26 +02:00
BEAWARE all game functionality is disabled with this commit for a while
* rework client modules * hide main window when loading * remake top menu functions * rework modules autoload * improve path resolving for otml and lua * move core_widgets to core_lib * fix tooltip issues * split some styles * add bit32 lua library * fix assert issues * fix compilation on linux 32 systems * rework gcc compile options * renable and fix some warnings * remove unused constants * speedup sprite cache * move UIGame to lua (not funcional yet) * fix a lot of issues in x11 window * fix crash handler * add some warnings do uiwidget and much more...
This commit is contained in:
@@ -113,6 +113,8 @@ void UIManager::inputEvent(const InputEvent& event)
|
||||
case Fw::MouseWheelInputEvent:
|
||||
m_mouseReceiver->propagateOnMouseWheel(event.mousePos, event.wheelDirection);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
m_isOnInputEvent = false;
|
||||
}
|
||||
|
@@ -109,6 +109,11 @@ void UIWidget::addChild(const UIWidgetPtr& child)
|
||||
return;
|
||||
}
|
||||
|
||||
if(child->isDestroyed()) {
|
||||
logWarning("attemp to add a destroyed child into a UIWidget");
|
||||
return;
|
||||
}
|
||||
|
||||
if(hasChild(child)) {
|
||||
logWarning("attempt to add a child again into a UIWidget");
|
||||
return;
|
||||
@@ -145,7 +150,10 @@ void UIWidget::insertChild(int index, const UIWidgetPtr& child)
|
||||
|
||||
index = index <= 0 ? (m_children.size() + index) : index-1;
|
||||
|
||||
assert(index >= 0 && (uint)index <= m_children.size());
|
||||
if(!(index >= 0 && (uint)index <= m_children.size())) {
|
||||
logTraceError("attemp to insert a child in an invalid index");
|
||||
return;
|
||||
}
|
||||
|
||||
// retrieve child by index
|
||||
auto it = m_children.begin() + index;
|
||||
@@ -300,7 +308,11 @@ void UIWidget::lowerChild(UIWidgetPtr child)
|
||||
|
||||
// remove and push child again
|
||||
auto it = std::find(m_children.begin(), m_children.end(), child);
|
||||
assert(it != m_children.end());
|
||||
if(it == m_children.end()) {
|
||||
logTraceError("cannot find child");
|
||||
return;
|
||||
}
|
||||
|
||||
m_children.erase(it);
|
||||
m_children.push_front(child);
|
||||
updateChildrenIndexStates();
|
||||
@@ -316,7 +328,10 @@ void UIWidget::raiseChild(UIWidgetPtr child)
|
||||
|
||||
// remove and push child again
|
||||
auto it = std::find(m_children.begin(), m_children.end(), child);
|
||||
assert(it != m_children.end());
|
||||
if(it == m_children.end()) {
|
||||
logTraceError("cannot find child");
|
||||
return;
|
||||
}
|
||||
m_children.erase(it);
|
||||
m_children.push_back(child);
|
||||
updateChildrenIndexStates();
|
||||
@@ -332,7 +347,10 @@ void UIWidget::moveChildToIndex(const UIWidgetPtr& child, int index)
|
||||
|
||||
// remove and push child again
|
||||
auto it = std::find(m_children.begin(), m_children.end(), child);
|
||||
assert(it != m_children.end());
|
||||
if(it == m_children.end()) {
|
||||
logTraceError("cannot find child");
|
||||
return;
|
||||
}
|
||||
m_children.erase(it);
|
||||
m_children.insert(m_children.begin() + index - 1, child);
|
||||
updateChildrenIndexStates();
|
||||
@@ -346,7 +364,10 @@ void UIWidget::lockChild(const UIWidgetPtr& child)
|
||||
if(!child)
|
||||
return;
|
||||
|
||||
assert(hasChild(child));
|
||||
if(!hasChild(child)) {
|
||||
logTraceError("cannot find child");
|
||||
return;
|
||||
}
|
||||
|
||||
// prevent double locks
|
||||
if(isChildLocked(child))
|
||||
@@ -365,8 +386,6 @@ void UIWidget::lockChild(const UIWidgetPtr& child)
|
||||
// lock child focus
|
||||
if(child->isFocusable())
|
||||
focusChild(child, Fw::ActiveFocusReason);
|
||||
|
||||
raiseChild(child);
|
||||
}
|
||||
|
||||
void UIWidget::unlockChild(const UIWidgetPtr& child)
|
||||
@@ -377,7 +396,10 @@ void UIWidget::unlockChild(const UIWidgetPtr& child)
|
||||
if(!child)
|
||||
return;
|
||||
|
||||
assert(hasChild(child));
|
||||
if(!hasChild(child)) {
|
||||
logTraceError("cannot find child");
|
||||
return;
|
||||
}
|
||||
|
||||
auto it = std::find(m_lockedChildren.begin(), m_lockedChildren.end(), child);
|
||||
if(it == m_lockedChildren.end())
|
||||
@@ -408,8 +430,6 @@ void UIWidget::unlockChild(const UIWidgetPtr& child)
|
||||
if(lockedChild) {
|
||||
if(lockedChild->isFocusable())
|
||||
focusChild(lockedChild, Fw::ActiveFocusReason);
|
||||
|
||||
raiseChild(lockedChild);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -28,10 +28,8 @@
|
||||
void UIWidget::parseImageStyle(const OTMLNodePtr& styleNode)
|
||||
{
|
||||
for(const OTMLNodePtr& node : styleNode->children()) {
|
||||
if(node->tag() == "image")
|
||||
setImageSource(node->value());
|
||||
else if(node->tag() == "image-source")
|
||||
setImageSource(node->value());
|
||||
if(node->tag() == "image-source")
|
||||
setImageSource(Fw::resolvePath(node->value(), styleNode->source()));
|
||||
else if(node->tag() == "image-offset-x")
|
||||
setImageOffsetX(node->value<int>());
|
||||
else if(node->tag() == "image-offset-y")
|
||||
|
Reference in New Issue
Block a user