chat line wrapping

* rework UIWidget text wrapping
* implement auto wrap
* fixes in console
This commit is contained in:
Eduardo Bart
2012-03-25 19:14:00 -03:00
parent ccf55132a1
commit 532e8e3e39
11 changed files with 65 additions and 32 deletions

View File

@@ -105,7 +105,6 @@ function ModuleManager.updateModuleInfo(moduleName)
moduleManagerWindow:recursiveGetChildById('moduleName'):setText(name)
moduleManagerWindow:recursiveGetChildById('moduleDescription'):setText(description)
moduleManagerWindow:recursiveGetChildById('moduleDescription'):wrapText()
moduleManagerWindow:recursiveGetChildById('moduleAuthor'):setText(author)
moduleManagerWindow:recursiveGetChildById('moduleWebsite'):setText(website)
moduleManagerWindow:recursiveGetChildById('moduleVersion'):setText(version)

View File

@@ -85,6 +85,7 @@ MainWindow
ModuleValueLabel
id: moduleDescription
height: 100
text-wrap: true
//ModuleInfoLabel
// text: Autoload

View File

@@ -16,6 +16,10 @@ function Mouse.restoreCursor()
g_window.restoreMouseCursor()
end
function Mouse.isPressed()
return g_ui.getPressedWidget() == nil
end
function Mouse.bindAutoPress(widget, callback)
connect(widget, { onMousePress = function(widget, mousePos, mouseButton)
callback()

View File

@@ -21,7 +21,7 @@ end
local function onWidgetHoverChange(widget, hovered)
if hovered then
if widget.tooltip then
if widget.tooltip and not Mouse.isPressed() then
ToolTip.display(widget.tooltip)
currentHoveredWidget = widget
end

View File

@@ -229,8 +229,14 @@ function Console.clear()
channels = {}
channels[0] = 'Default'
consoleTabBar:getTab('Default').tabPanel:destroyChildren()
consoleTabBar:getTab('Server Log').tabPanel:destroyChildren()
consoleTabBar:getTab('Default').tabPanel:getChildById('consoleBuffer'):destroyChildren()
consoleTabBar:getTab('Server Log').tabPanel:getChildById('consoleBuffer'):destroyChildren()
local npcTab = consoleTabBar:getTab('NPCs')
if npcTab then
consoleTabBar:removeTab(npcTab)
end
consoleLineEdit:clearText()
if channelsWindow then

View File

@@ -2,6 +2,9 @@ ConsoleLabel < UILabel
font: verdana-11px-antialised
height: 14
color: yellow
margin-left: 2
text-wrap: true
text-auto-resize: true
ConsoleTabBar < TabBar
ConsoleTabBarPanel < TabBarPanel

View File

@@ -37,7 +37,6 @@ local function displayMessage(msgtype, msg, time)
if msgtype.wrap then
label:setWidth(label:getParent():getWidth())
label:wrapText()
label:setHeight(label:getTextSize().height)
else
label:resizeToText()