diff --git a/Engine/source/gui/controls/guiConsole.cpp b/Engine/source/gui/controls/guiConsole.cpp index 0a1e2459d..19cdf6b3d 100644 --- a/Engine/source/gui/controls/guiConsole.cpp +++ b/Engine/source/gui/controls/guiConsole.cpp @@ -50,6 +50,12 @@ IMPLEMENT_CALLBACK( GuiConsole, onMessageSelected, void, ( ConsoleLogEntry::Leve "@param level Diagnostic level of the message.\n" "@param message Message text.\n" ); +IMPLEMENT_CALLBACK(GuiConsole, onNewMessage, void, (U32 errorCount, U32 warnCount, U32 normalCount), (errorCount, warnCount, normalCount), + "Called when a new message is logged.\n\n" + "@param errorCount The number of error messages logged.\n" + "@param warnCount The number of warning messages logged.\n" + "@param normalCount The number of normal messages logged.\n"); + //----------------------------------------------------------------------------- @@ -58,6 +64,10 @@ GuiConsole::GuiConsole() setExtent(64, 64); mCellSize.set(1, 1); mSize.set(1, 0); + + mDisplayErrors = true; + mDisplayWarnings = true; + mDisplayNormalMessages = true; } //----------------------------------------------------------------------------- @@ -81,56 +91,98 @@ S32 GuiConsole::getMaxWidth(S32 startIndex, S32 endIndex) U32 size; ConsoleLogEntry *log; - Con::getLockLog(log, size); - - if(startIndex < 0 || (U32)endIndex >= size || startIndex > endIndex) + if (startIndex < 0 || (U32)endIndex >= mFilteredLog.size() || startIndex > endIndex) return 0; S32 result = 0; for(S32 i = startIndex; i <= endIndex; i++) - result = getMax(result, (S32)(mFont->getStrWidth((const UTF8 *)log[i].mString))); - - Con::unlockLog(); + result = getMax(result, (S32)(mFont->getStrWidth((const UTF8 *)mFilteredLog[i].mString))); return(result + 6); } +void GuiConsole::refreshLogText() +{ + U32 size; + ConsoleLogEntry *log; + + Con::getLockLog(log, size); + + if (mFilteredLog.size() != size) + { + mFilteredLog.clear(); + + U32 errorCount = 0; + U32 warnCount = 0; + U32 normalCount = 0; + + //Filter the log if needed + for (U32 i = 0; i < size; ++i) + { + ConsoleLogEntry &entry = log[i]; + + if (entry.mLevel == ConsoleLogEntry::Error) + { + errorCount++; + if (mDisplayErrors) + { + mFilteredLog.push_back(entry); + } + } + else if (entry.mLevel == ConsoleLogEntry::Warning) + { + warnCount++; + if (mDisplayWarnings) + { + mFilteredLog.push_back(entry); + } + } + else if (entry.mLevel == ConsoleLogEntry::Normal) + { + normalCount++; + if (mDisplayNormalMessages) + { + mFilteredLog.push_back(entry); + } + } + } + + onNewMessage_callback(errorCount, warnCount, normalCount); + } + + Con::unlockLog(); +} + //----------------------------------------------------------------------------- void GuiConsole::onPreRender() { //see if the size has changed U32 prevSize = getHeight() / mCellSize.y; - U32 size; - ConsoleLogEntry *log; - Con::getLockLog(log, size); - Con::unlockLog(); // we unlock immediately because we only use size here, not log. + refreshLogText(); - if(size != prevSize) - { - //first, find out if the console was scrolled up - bool scrolled = false; - GuiScrollCtrl *parent = dynamic_cast(getParent()); + //first, find out if the console was scrolled up + bool scrolled = false; + GuiScrollCtrl *parent = dynamic_cast(getParent()); - if(parent) - scrolled = parent->isScrolledToBottom(); + if(parent) + scrolled = parent->isScrolledToBottom(); - //find the max cell width for the new entries - S32 newMax = getMaxWidth(prevSize, size - 1); - if(newMax > mCellSize.x) - mCellSize.set(newMax, mFont->getHeight()); + //find the max cell width for the new entries + S32 newMax = getMaxWidth(prevSize, mFilteredLog.size() - 1); + if(newMax > mCellSize.x) + mCellSize.set(newMax, mFont->getHeight()); - //set the array size - mSize.set(1, size); + //set the array size + mSize.set(1, mFilteredLog.size()); - //resize the control - setExtent( Point2I(mCellSize.x, mCellSize.y * size)); + //resize the control + setExtent(Point2I(mCellSize.x, mCellSize.y * mFilteredLog.size())); - //if the console was not scrolled, make the last entry visible - if (scrolled) - scrollCellVisible(Point2I(0,mSize.y - 1)); - } + //if the console was not scrolled, make the last entry visible + if (scrolled) + scrollCellVisible(Point2I(0,mSize.y - 1)); } //----------------------------------------------------------------------------- @@ -139,10 +191,8 @@ void GuiConsole::onRenderCell(Point2I offset, Point2I cell, bool /*selected*/, b { U32 size; ConsoleLogEntry *log; - - Con::getLockLog(log, size); - - ConsoleLogEntry &entry = log[cell.y]; + + ConsoleLogEntry &entry = mFilteredLog[cell.y]; switch (entry.mLevel) { case ConsoleLogEntry::Normal: GFX->getDrawUtil()->setBitmapModulation(mProfile->mFontColor); break; @@ -151,8 +201,6 @@ void GuiConsole::onRenderCell(Point2I offset, Point2I cell, bool /*selected*/, b default: AssertFatal(false, "GuiConsole::onRenderCell - Unrecognized ConsoleLogEntry type, update this."); } GFX->getDrawUtil()->drawText(mFont, Point2I(offset.x + 3, offset.y), entry.mString, mProfile->mFontColors); - - Con::unlockLog(); } //----------------------------------------------------------------------------- @@ -164,10 +212,72 @@ void GuiConsole::onCellSelected( Point2I cell ) U32 size; ConsoleLogEntry* log; - Con::getLockLog(log, size); - - ConsoleLogEntry& entry = log[ cell.y ]; + ConsoleLogEntry& entry = mFilteredLog[cell.y]; onMessageSelected_callback( entry.mLevel, entry.mString ); - - Con::unlockLog(); } + +void GuiConsole::setDisplayFilters(bool errors, bool warns, bool normal) +{ + mDisplayErrors = errors; + mDisplayWarnings = warns; + mDisplayNormalMessages = normal; + + refreshLogText(); + + //find the max cell width for the new entries + S32 newMax = getMaxWidth(0, mFilteredLog.size() - 1); + mCellSize.set(newMax, mFont->getHeight()); + + //set the array size + mSize.set(1, mFilteredLog.size()); + + //resize the control + setExtent(Point2I(mCellSize.x, mCellSize.y * mFilteredLog.size())); + + scrollCellVisible(Point2I(0, mSize.y - 1)); +} + +DefineEngineMethod(GuiConsole, setDisplayFilters, void, (bool errors, bool warns, bool normal), (true, true, true), + "Sets the current display filters for the console gui. Allows you to indicate if it should display errors, warns and/or normal messages.\n\n" + "@param errors If true, the console gui will display any error messages that were emitted.\n\n" + "@param warns If true, the console gui will display any warning messages that were emitted.\n\n" + "@param normal If true, the console gui will display any regular messages that were emitted.\n\n") +{ + object->setDisplayFilters(errors, warns, normal); +} + +DefineEngineMethod(GuiConsole, getErrorFilter, bool, (), , + "Returns if the error filter is on or not.") +{ + return object->getErrorFilter(); +} + +DefineEngineMethod(GuiConsole, getWarnFilter, bool, (), , + "Returns if the warning filter is on or not.") +{ + return object->getWarnFilter(); +} + +DefineEngineMethod(GuiConsole, getNormalFilter, bool, (), , + "Returns if the normal message filter is on or not.") +{ + return object->getNormalFilter(); +} + +DefineEngineMethod(GuiConsole, toggleErrorFilter, void, (), , + "Toggles the error filter.") +{ + object->toggleErrorFilter(); +} + +DefineEngineMethod(GuiConsole, toggleWarnFilter, void, (), , + "Toggles the warning filter.") +{ + object->toggleWarnFilter(); +} + +DefineEngineMethod(GuiConsole, toggleNormalFilter, void, (), , + "Toggles the normal messages filter.") +{ + object->toggleNormalFilter(); +} \ No newline at end of file diff --git a/Engine/source/gui/controls/guiConsole.h b/Engine/source/gui/controls/guiConsole.h index 8f67573e1..217fe8d6a 100644 --- a/Engine/source/gui/controls/guiConsole.h +++ b/Engine/source/gui/controls/guiConsole.h @@ -39,14 +39,21 @@ class GuiConsole : public GuiArrayCtrl Resource mFont; + bool mDisplayErrors; + bool mDisplayWarnings; + bool mDisplayNormalMessages; + S32 getMaxWidth(S32 startIndex, S32 endIndex); + Vector mFilteredLog; + protected: /// @name Callbacks /// @{ DECLARE_CALLBACK( void, onMessageSelected, ( ConsoleLogEntry::Level level, const char* message ) ); + DECLARE_CALLBACK(void, onNewMessage, (U32 errorCount, U32 warnCount, U32 normalCount)); /// @} @@ -63,6 +70,26 @@ class GuiConsole : public GuiArrayCtrl virtual bool onWake(); virtual void onPreRender(); virtual void onRenderCell(Point2I offset, Point2I cell, bool selected, bool mouseOver); + + void setDisplayFilters(bool errors, bool warns, bool normal); + bool getErrorFilter() { return mDisplayErrors; } + bool getWarnFilter() { return mDisplayWarnings; } + bool getNormalFilter() { return mDisplayNormalMessages; } + + void toggleErrorFilter() + { + setDisplayFilters(!mDisplayErrors, mDisplayWarnings, mDisplayNormalMessages); + } + void toggleWarnFilter() + { + setDisplayFilters(mDisplayErrors, !mDisplayWarnings, mDisplayNormalMessages); + } + void toggleNormalFilter() + { + setDisplayFilters(mDisplayErrors, mDisplayWarnings, !mDisplayNormalMessages); + } + + void refreshLogText(); }; #endif diff --git a/Templates/BaseGame/game/core/console/console.gui b/Templates/BaseGame/game/core/console/console.gui index 8c6c7f63a..1286ed85c 100644 --- a/Templates/BaseGame/game/core/console/console.gui +++ b/Templates/BaseGame/game/core/console/console.gui @@ -1,51 +1,191 @@ -new GuiControl(ConsoleDlg) { - profile = "GuiDefaultProfile"; +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(ConsoleDlg) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 8"; horizSizing = "right"; vertSizing = "bottom"; - position = "0 0"; - extent = "640 480"; - minExtent = "8 8"; + profile = "GuiDefaultProfile"; visible = "1"; - helpTag = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + helpTag = "0"; new GuiConsoleEditCtrl(ConsoleEntry) { - profile = "ConsoleTextEditProfile"; - horizSizing = "width"; - vertSizing = "top"; - position = "0 462"; - extent = "640 18"; - minExtent = "8 8"; - visible = "1"; - altCommand = "ConsoleEntry::eval();"; - helpTag = "0"; - maxLength = "255"; + useSiblingScroller = "1"; historySize = "40"; - password = "0"; tabComplete = "0"; sinkAllKeyEvents = "1"; - useSiblingScroller = "1"; + password = "0"; + passwordMask = "*"; + maxLength = "255"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 750"; + extent = "1024 18"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "top"; + profile = "ConsoleTextEditProfile"; + visible = "1"; + active = "1"; + altCommand = "ConsoleEntry::eval();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiContainer() { + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "1 728"; + extent = "1024 22"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "top"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiBitmapCtrl() { + bitmap = "data/ui/art/hudfill.png"; + color = "255 255 255 255"; + wrap = "0"; + position = "0 0"; + extent = "1024 22"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiToggleButtonCtrl(ConsoleDlgErrorFilterBtn) { + text = "Errors"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "2 2"; + extent = "113 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiToggleButtonCtrl(ConsoleDlgWarnFilterBtn) { + text = "Warnings"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "119 2"; + extent = "113 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiToggleButtonCtrl(ConsoleDlgNormalFilterBtn) { + text = "Normal Messages"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "236 2"; + extent = "113 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; }; new GuiScrollCtrl() { - internalName = "Scroll"; - profile = "ConsoleScrollProfile"; - horizSizing = "width"; - vertSizing = "height"; - position = "0 0"; - extent = "640 462"; - minExtent = "8 8"; - visible = "1"; - helpTag = "0"; willFirstRespond = "1"; hScrollBar = "alwaysOn"; vScrollBar = "alwaysOn"; - lockHorizScroll = "false"; - lockVertScroll = "false"; + lockHorizScroll = "0"; + lockVertScroll = "0"; constantThumbHeight = "0"; childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 0"; + extent = "1024 730"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ConsoleScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "Scroll"; + canSave = "1"; + canSaveDynamicFields = "0"; - new GuiConsole( ConsoleMessageLogView ) { - profile = "GuiConsoleProfile"; - position = "0 0"; - }; + new GuiConsole(ConsoleMessageLogView) { + position = "1 1"; + extent = "622 324"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiConsoleProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; }; + }; }; +//--- OBJECT WRITE END --- \ No newline at end of file diff --git a/Templates/BaseGame/game/core/console/main.cs b/Templates/BaseGame/game/core/console/main.cs index b36dafd24..47894f7e4 100644 --- a/Templates/BaseGame/game/core/console/main.cs +++ b/Templates/BaseGame/game/core/console/main.cs @@ -99,6 +99,13 @@ function ConsoleDlg::showWindow(%this) %this-->Scroll.setVisible(true); } +function ConsoleDlg::onWake(%this) +{ + ConsoleDlgErrorFilterBtn.setStateOn(ConsoleMessageLogView.getErrorFilter()); + ConsoleDlgWarnFilterBtn.setStateOn(ConsoleMessageLogView.getWarnFilter()); + ConsoleDlgNormalFilterBtn.setStateOn(ConsoleMessageLogView.getNormalFilter()); +} + function ConsoleDlg::setAlpha( %this, %alpha) { if (%alpha $= "") @@ -106,3 +113,26 @@ function ConsoleDlg::setAlpha( %this, %alpha) else ConsoleScrollProfile.fillColor = getWords($ConsoleDefaultFillColor, 0, 2) SPC %alpha * 255.0; } + +function ConsoleDlgErrorFilterBtn::onClick(%this) +{ + ConsoleMessageLogView.toggleErrorFilter(); +} + +function ConsoleDlgWarnFilterBtn::onClick(%this) +{ + + ConsoleMessageLogView.toggleWarnFilter(); +} + +function ConsoleDlgNormalFilterBtn::onClick(%this) +{ + ConsoleMessageLogView.toggleNormalFilter(); +} + +function ConsoleMessageLogView::onNewMessage(%this, %errorCount, %warnCount, %normalCount) +{ + ConsoleDlgErrorFilterBtn.setText("(" @ %errorCount @ ") Errors"); + ConsoleDlgWarnFilterBtn.setText("(" @ %warnCount @ ") Warnings"); + ConsoleDlgNormalFilterBtn.setText("(" @ %normalCount @ ") Messages"); +} \ No newline at end of file diff --git a/Templates/Full/game/core/art/gui/console.gui b/Templates/Full/game/core/art/gui/console.gui index 70e5fb61b..c1627fafb 100644 --- a/Templates/Full/game/core/art/gui/console.gui +++ b/Templates/Full/game/core/art/gui/console.gui @@ -1,54 +1,192 @@ //--- OBJECT WRITE BEGIN --- %guiContent = new GuiControl(ConsoleDlg) { - profile = "GuiDefaultProfile"; + position = "0 0"; + extent = "1024 768"; + minExtent = "8 8"; horizSizing = "right"; vertSizing = "bottom"; - position = "0 0"; - extent = "640 480"; - minExtent = "8 8"; + profile = "GuiDefaultProfile"; visible = "1"; - helpTag = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + helpTag = "0"; new GuiConsoleEditCtrl(ConsoleEntry) { - profile = "ConsoleTextEditProfile"; - horizSizing = "width"; - vertSizing = "top"; - position = "0 462"; - extent = "640 18"; - minExtent = "8 8"; - visible = "1"; - altCommand = "ConsoleEntry::eval();"; - helpTag = "0"; - maxLength = "255"; + useSiblingScroller = "1"; historySize = "40"; - password = "0"; tabComplete = "0"; sinkAllKeyEvents = "1"; - useSiblingScroller = "1"; + password = "0"; + passwordMask = "*"; + maxLength = "255"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 750"; + extent = "1024 18"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "top"; + profile = "ConsoleTextEditProfile"; + visible = "1"; + active = "1"; + altCommand = "ConsoleEntry::eval();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiContainer() { + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "1 728"; + extent = "1024 22"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "top"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiBitmapCtrl() { + bitmap = "data/ui/art/hudfill.png"; + color = "255 255 255 255"; + wrap = "0"; + position = "0 0"; + extent = "1024 22"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiToggleButtonCtrl(ConsoleDlgErrorFilterBtn) { + text = "Errors"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "2 2"; + extent = "113 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiToggleButtonCtrl(ConsoleDlgWarnFilterBtn) { + text = "Warnings"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "119 2"; + extent = "113 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiToggleButtonCtrl(ConsoleDlgNormalFilterBtn) { + text = "Normal Messages"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "236 2"; + extent = "113 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; }; new GuiScrollCtrl() { - internalName = "Scroll"; - profile = "ConsoleScrollProfile"; - horizSizing = "width"; - vertSizing = "height"; - position = "0 0"; - extent = "640 462"; - minExtent = "8 8"; - visible = "1"; - helpTag = "0"; willFirstRespond = "1"; hScrollBar = "alwaysOn"; vScrollBar = "alwaysOn"; - lockHorizScroll = "false"; - lockVertScroll = "false"; + lockHorizScroll = "0"; + lockVertScroll = "0"; constantThumbHeight = "0"; childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 0"; + extent = "1024 730"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ConsoleScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "Scroll"; + canSave = "1"; + canSaveDynamicFields = "0"; - new GuiConsole( ConsoleMessageLogView ) { - profile = "GuiConsoleProfile"; - position = "0 0"; - }; + new GuiConsole(ConsoleMessageLogView) { + position = "1 1"; + extent = "622 324"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiConsoleProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; }; + }; }; //--- OBJECT WRITE END --- @@ -173,3 +311,33 @@ function ConsoleMessageLogView::onMessageSelected( %this, %level, %message ) EditorOpenFileInTorsion( %fileName, %lineNumber ); } + +function ConsoleDlg::onWake(%this) +{ + ConsoleDlgErrorFilterBtn.setStateOn(ConsoleMessageLogView.getErrorFilter()); + ConsoleDlgWarnFilterBtn.setStateOn(ConsoleMessageLogView.getWarnFilter()); + ConsoleDlgNormalFilterBtn.setStateOn(ConsoleMessageLogView.getNormalFilter()); +} + +function ConsoleDlgErrorFilterBtn::onClick(%this) +{ + ConsoleMessageLogView.toggleErrorFilter(); +} + +function ConsoleDlgWarnFilterBtn::onClick(%this) +{ + + ConsoleMessageLogView.toggleWarnFilter(); +} + +function ConsoleDlgNormalFilterBtn::onClick(%this) +{ + ConsoleMessageLogView.toggleNormalFilter(); +} + +function ConsoleMessageLogView::onNewMessage(%this, %errorCount, %warnCount, %normalCount) +{ + ConsoleDlgErrorFilterBtn.setText("(" @ %errorCount @ ") Errors"); + ConsoleDlgWarnFilterBtn.setText("(" @ %warnCount @ ") Warnings"); + ConsoleDlgNormalFilterBtn.setText("(" @ %normalCount @ ") Messages"); +} \ No newline at end of file