Fix console error

master
Eduardo Bart 12 years ago
parent 5232501ecf
commit 54f4e2b801

@ -4,7 +4,7 @@ UIWindow = extends(UIWidget)
function UIWindow.create() function UIWindow.create()
local window = UIWindow.internalCreate() local window = UIWindow.internalCreate()
window:setTextAlign(AlignTopCenter) window:setTextAlign(AlignTopCenter)
window:setDragable(true) window:setDraggable(true)
return window return window
end end

@ -59,7 +59,8 @@ ownPrivateName = nil
messageHistory = {} messageHistory = {}
currentMessageIndex = 0 currentMessageIndex = 0
ignoreNpcMessages = false ignoreNpcMessages = false
defaultTab = nil
serverTab = nil
function init() function init()
connect(g_game, { onTalk = onTalk, connect(g_game, { onTalk = onTalk,
@ -78,8 +79,8 @@ function init()
consoleTabBar:setContentWidget(consoleContentPanel) consoleTabBar:setContentWidget(consoleContentPanel)
channels = {} channels = {}
addTab(tr('Default'), true) defaultTab = addTab(tr('Default'), true)
addTab(tr('Server Log'), false) serverTab = addTab(tr('Server Log'), false)
g_keyboard.bindKeyPress('Shift+Up', function() navigateMessageHistory(1) end, consolePanel) g_keyboard.bindKeyPress('Shift+Up', function() navigateMessageHistory(1) end, consolePanel)
g_keyboard.bindKeyPress('Shift+Down', function() navigateMessageHistory(-1) end, consolePanel) g_keyboard.bindKeyPress('Shift+Down', function() navigateMessageHistory(-1) end, consolePanel)
@ -132,7 +133,7 @@ function terminate()
end end
function onTabChange(tabBar, tab) function onTabChange(tabBar, tab)
if tab:getText() == tr('Default') or tab:getText() == tr('Server Log') then if tab == defaultTab or tab == serverTab then
consolePanel:getChildById('closeChannelButton'):disable() consolePanel:getChildById('closeChannelButton'):disable()
else else
consolePanel:getChildById('closeChannelButton'):enable() consolePanel:getChildById('closeChannelButton'):enable()
@ -165,8 +166,8 @@ function clear()
end end
channels = {} channels = {}
consoleTabBar:getTab(tr('Default')).tabPanel:getChildById('consoleBuffer'):destroyChildren() defaultTab.tabPanel:getChildById('consoleBuffer'):destroyChildren()
consoleTabBar:getTab(tr('Server Log')).tabPanel:getChildById('consoleBuffer'):destroyChildren() serverTab.tabPanel:getChildById('consoleBuffer'):destroyChildren()
local npcTab = consoleTabBar:getTab('NPCs') local npcTab = consoleTabBar:getTab('NPCs')
if npcTab then if npcTab then
@ -198,7 +199,7 @@ function addTab(name, focus)
end end
if focus then if focus then
consoleTabBar:selectTab(tab) consoleTabBar:selectTab(tab)
elseif name ~= tr('Server Log') then elseif not serverTab or name ~= serverTab:getText() then
consoleTabBar:blinkTab(tab) consoleTabBar:blinkTab(tab)
end end
return tab return tab
@ -206,7 +207,7 @@ end
function removeCurrentTab() function removeCurrentTab()
local tab = consoleTabBar:getCurrentTab() local tab = consoleTabBar:getCurrentTab()
if tab:getText() == tr('Default') or tab:getText() == tr('Server Log') then return end if tab == defaultTab or tab == serverTab then return end
-- notificate the server that we are leaving the channel -- notificate the server that we are leaving the channel
if tab.channelId then if tab.channelId then
@ -251,7 +252,7 @@ function addPrivateText(text, speaktype, name, isPrivateCommand, creatureName)
local privateTab = getTab(name) local privateTab = getTab(name)
if privateTab == nil then if privateTab == nil then
if (Options.getOption('showPrivateMessagesInConsole') and not focus) or (isPrivateCommand and not privateTab) then if (Options.getOption('showPrivateMessagesInConsole') and not focus) or (isPrivateCommand and not privateTab) then
privateTab = getTab(tr('Default')) privateTab = defaultTab
else else
privateTab = addTab(name, focus) privateTab = addTab(name, focus)
channels[name] = name channels[name] = name
@ -368,14 +369,14 @@ function sendCurrentMessage()
-- when talking on server log, the message goes to default channel -- when talking on server log, the message goes to default channel
local name = tab:getText() local name = tab:getText()
if name == tr('Server Log') then if tab == serverTab then
tab = getTab(tr('Default')) tab = defaultTab
name = tr('Default') name = defaultTab:getText()
end end
local speaktypedesc local speaktypedesc
if (tab.channelId or name == tr('Default')) and not chatCommandPrivateReady then if (tab.channelId or tab == defaultTab) and not chatCommandPrivateReady then
if name == tr('Default') then if tab == defaultTab then
speaktypedesc = chatCommandSayMode or SayModes[consolePanel:getChildById('sayModeButton').sayMode].speakTypeDesc speaktypedesc = chatCommandSayMode or SayModes[consolePanel:getChildById('sayModeButton').sayMode].speakTypeDesc
if speaktypedesc ~= 'say' then sayModeChange(2) end -- head back to say mode if speaktypedesc ~= 'say' then sayModeChange(2) end -- head back to say mode
else else
@ -576,7 +577,7 @@ function onGameStart()
end end
end end
local tab = getTab(tr('Default')) local tab = defaultTab
if tab then if tab then
--[[ --[[
Known Issue: The server is calling to open channels after Known Issue: The server is calling to open channels after

@ -204,7 +204,7 @@ function addHotkey()
messageBox:setText(tr('Button Assign')) messageBox:setText(tr('Button Assign'))
messageBox:setWidth(420) messageBox:setWidth(420)
messageBox:setHeight(140) messageBox:setHeight(140)
messageBox:setDragable(false) messageBox:setDraggable(false)
widget = g_ui.createWidget('Label', messageBox) widget = g_ui.createWidget('Label', messageBox)
widget:setText(tr('Please, press the key you wish to add onto your hotkeys manager')) widget:setText(tr('Please, press the key you wish to add onto your hotkeys manager'))

@ -328,7 +328,7 @@ void Application::registerLuaFunctions()
g_lua.bindClassMemberFunction<UIWidget>("setChecked", &UIWidget::setChecked); g_lua.bindClassMemberFunction<UIWidget>("setChecked", &UIWidget::setChecked);
g_lua.bindClassMemberFunction<UIWidget>("setFocusable", &UIWidget::setFocusable); g_lua.bindClassMemberFunction<UIWidget>("setFocusable", &UIWidget::setFocusable);
g_lua.bindClassMemberFunction<UIWidget>("setPhantom", &UIWidget::setPhantom); g_lua.bindClassMemberFunction<UIWidget>("setPhantom", &UIWidget::setPhantom);
g_lua.bindClassMemberFunction<UIWidget>("setDragable", &UIWidget::setDragable); g_lua.bindClassMemberFunction<UIWidget>("setDraggable", &UIWidget::setDraggable);
g_lua.bindClassMemberFunction<UIWidget>("setFixedSize", &UIWidget::setFixedSize); g_lua.bindClassMemberFunction<UIWidget>("setFixedSize", &UIWidget::setFixedSize);
g_lua.bindClassMemberFunction<UIWidget>("setClipping", &UIWidget::setClipping); g_lua.bindClassMemberFunction<UIWidget>("setClipping", &UIWidget::setClipping);
g_lua.bindClassMemberFunction<UIWidget>("setLastFocusReason", &UIWidget::setLastFocusReason); g_lua.bindClassMemberFunction<UIWidget>("setLastFocusReason", &UIWidget::setLastFocusReason);
@ -378,7 +378,7 @@ void Application::registerLuaFunctions()
g_lua.bindClassMemberFunction<UIWidget>("isExplicitlyVisible", &UIWidget::isExplicitlyVisible); g_lua.bindClassMemberFunction<UIWidget>("isExplicitlyVisible", &UIWidget::isExplicitlyVisible);
g_lua.bindClassMemberFunction<UIWidget>("isFocusable", &UIWidget::isFocusable); g_lua.bindClassMemberFunction<UIWidget>("isFocusable", &UIWidget::isFocusable);
g_lua.bindClassMemberFunction<UIWidget>("isPhantom", &UIWidget::isPhantom); g_lua.bindClassMemberFunction<UIWidget>("isPhantom", &UIWidget::isPhantom);
g_lua.bindClassMemberFunction<UIWidget>("isDragable", &UIWidget::isDragable); g_lua.bindClassMemberFunction<UIWidget>("isDraggable", &UIWidget::isDraggable);
g_lua.bindClassMemberFunction<UIWidget>("isFixedSize", &UIWidget::isFixedSize); g_lua.bindClassMemberFunction<UIWidget>("isFixedSize", &UIWidget::isFixedSize);
g_lua.bindClassMemberFunction<UIWidget>("isClipping", &UIWidget::isClipping); g_lua.bindClassMemberFunction<UIWidget>("isClipping", &UIWidget::isClipping);
g_lua.bindClassMemberFunction<UIWidget>("isDestroyed", &UIWidget::isDestroyed); g_lua.bindClassMemberFunction<UIWidget>("isDestroyed", &UIWidget::isDestroyed);

@ -126,7 +126,7 @@ void UIManager::inputEvent(const InputEvent& event)
} }
case Fw::MouseMoveInputEvent: { case Fw::MouseMoveInputEvent: {
// start dragging when moving a pressed widget // start dragging when moving a pressed widget
if(m_pressedWidget && m_pressedWidget->isDragable() && m_draggingWidget != m_pressedWidget) { if(m_pressedWidget && m_pressedWidget->isDraggable() && m_draggingWidget != m_pressedWidget) {
// only drags when moving more than 4 pixels // only drags when moving more than 4 pixels
if((event.mousePos - m_pressedWidget->getLastClickPosition()).length() >= 4) if((event.mousePos - m_pressedWidget->getLastClickPosition()).length() >= 4)
updateDraggingWidget(m_pressedWidget, event.mousePos - event.mouseMoved); updateDraggingWidget(m_pressedWidget, event.mousePos - event.mouseMoved);

@ -937,9 +937,9 @@ void UIWidget::setPhantom(bool phantom)
m_phantom = phantom; m_phantom = phantom;
} }
void UIWidget::setDragable(bool dragable) void UIWidget::setDraggable(bool draggable)
{ {
m_dragable = dragable; m_draggable = draggable;
} }
void UIWidget::setFixedSize(bool fixed) void UIWidget::setFixedSize(bool fixed)

@ -66,7 +66,7 @@ protected:
stdext::boolean<true> m_focusable; stdext::boolean<true> m_focusable;
stdext::boolean<false> m_fixedSize; stdext::boolean<false> m_fixedSize;
stdext::boolean<false> m_phantom; stdext::boolean<false> m_phantom;
stdext::boolean<false> m_dragable; stdext::boolean<false> m_draggable;
stdext::boolean<false> m_destroyed; stdext::boolean<false> m_destroyed;
stdext::boolean<false> m_clipping; stdext::boolean<false> m_clipping;
UILayoutPtr m_layout; UILayoutPtr m_layout;
@ -125,7 +125,7 @@ public:
void setChecked(bool checked); void setChecked(bool checked);
void setFocusable(bool focusable); void setFocusable(bool focusable);
void setPhantom(bool phantom); void setPhantom(bool phantom);
void setDragable(bool dragable); void setDraggable(bool draggable);
void setFixedSize(bool fixed); void setFixedSize(bool fixed);
void setClipping(bool clipping) { m_clipping = clipping; } void setClipping(bool clipping) { m_clipping = clipping; }
void setLastFocusReason(Fw::FocusReason reason); void setLastFocusReason(Fw::FocusReason reason);
@ -237,7 +237,7 @@ public:
bool isExplicitlyVisible() { return m_visible; } bool isExplicitlyVisible() { return m_visible; }
bool isFocusable() { return m_focusable; } bool isFocusable() { return m_focusable; }
bool isPhantom() { return m_phantom; } bool isPhantom() { return m_phantom; }
bool isDragable() { return m_dragable; } bool isDraggable() { return m_draggable; }
bool isFixedSize() { return m_fixedSize; } bool isFixedSize() { return m_fixedSize; }
bool isClipping() { return m_clipping; } bool isClipping() { return m_clipping; }
bool isDestroyed() { return m_destroyed; } bool isDestroyed() { return m_destroyed; }

@ -111,7 +111,7 @@ void UIWidget::parseBaseStyle(const OTMLNodePtr& styleNode)
else if(node->tag() == "checked") else if(node->tag() == "checked")
setChecked(node->value<bool>()); setChecked(node->value<bool>());
else if(node->tag() == "dragable") else if(node->tag() == "dragable")
setDragable(node->value<bool>()); setDraggable(node->value<bool>());
else if(node->tag() == "on") else if(node->tag() == "on")
setOn(node->value<bool>()); setOn(node->value<bool>());
else if(node->tag() == "focusable") else if(node->tag() == "focusable")

@ -27,7 +27,7 @@
UIItem::UIItem() UIItem::UIItem()
{ {
m_dragable = true; m_draggable = true;
} }
void UIItem::drawSelf(Fw::DrawPane drawPane) void UIItem::drawSelf(Fw::DrawPane drawPane)

@ -30,7 +30,7 @@
UIMap::UIMap() UIMap::UIMap()
{ {
m_dragable = true; m_draggable = true;
m_mapView = MapViewPtr(new MapView); m_mapView = MapViewPtr(new MapView);
m_zoom = m_mapView->getVisibleDimension().height(); m_zoom = m_mapView->getVisibleDimension().height();
m_aspectRatio = 0.0f; m_aspectRatio = 0.0f;

Loading…
Cancel
Save