summaryrefslogtreecommitdiff
path: root/src/gui/widgets/browserbox.h
AgeCommit message (Collapse)AuthorFilesLines
2025-04-26GUI: Added support for explicit outline color per palette entryThorbjørn Lindeijer1-0/+1
This enables customized outlines for each text color as well as adding outlines for specific palettes, as done by the Jewelry theme. Merged PARTY_CHAT_TAB and PARTY_SOCIAL_TAB into just PARTY_TAB since we should probably be using the same color there anyway. Split off WHISPER_TAB as separate color from WHISPER.
2025-04-25GUI: Added support for multiple color palettes to ThemeThorbjørn Lindeijer1-23/+3
Each Skin can point to a different palette, which can be used to tweak text colors where necessary. For now there is no generic solution for this, instead a number of locations have been adjusted to take the palette into account: * ChatWindow sets its palette on the BrowserBox used in its tabs. * Popup sets its palette on child widgets when they are added (covering BrowserBox, Label and TextBox). * ItemPopup now uses its palette when looking up colors. The BrowserBox now retrieves its numbered text colors from the theme. Also added OLDCHAT, AWAYCHAT and GLOBAL theme colors, with ##g, ##o and ##a to choose these colors respectively. Fixed ImageRect move constructor. TextPreview class was cleaned up from unused functionality. Being name colors are no longer different between the name shown on the being and the name shown in the SpeechDialog.
2025-03-11Implemented replacement of key names in NPC dialogThorbjørn Lindeijer1-0/+6
Now when NPCs text includes "###MoveUp;", it will get replaced by "Up", or whatever key is currently bound to that action. For compatibility reasons the key name can optionally have a "key" prefix, for example "###keyMoveUp;". Closes #73
2025-02-17Further ResourceManager and PhysFS cleanupsThorbjørn Lindeijer1-1/+6
* Wrapped remaining PhysFS API calls and set PHYSFS_DEPRECATED to suppress deprecation warnings for PHYSFS_getUserDir, since no alternative is available for now. * Removed support for decompressing .gz files, since it has been unused for years and doesn't seem useful when updates are anyway served in an archive. * Use SDL_LoadFile and SDL_LoadFile_RW convenience functions (raises minimum SDL version to 2.0.10). * Removed ResourceManager::copyFile, since it was unused and will likely stay unused. * Removed ResourceManager::loadTextFile. Instead, split up the string in BrowserBox::addRows without making additional copies.
2025-01-21Replaced include guards with #pragma onceThorbjørn Lindeijer1-4/+1
Thanks to https://github.com/cgmb/guardonce and a follow-up replace to remove duplicated newlines at end of file: find src -type f -name '*.h' -exec \ sed --in-place -e :a -e '/^\n*$/{$d;N;};/\n$/ba' {} \; Source: https://unix.stackexchange.com/questions/81685/how-to-remove-multiple-newlines-at-eof Fixes compile on macOS, which appears to have been due to the EVENT_H include guard.
2024-10-08Added convenient and efficient Timer classThorbjørn Lindeijer1-1/+3
The Timer is efficient because it does not depend on incrementing a counter to keep track of time, nor does it call SDL_GetTicks every time its state is checked (this happens once per frame instead). Along with global functions Time::absoluteTimeMs() and Time::deltaTimeMs(), this replaces previous globals tick_time, cur_time and get_elapsed_time(). For now, there is still a fixed 100 times per second logic call rate, but the new Time::deltaTimeMs() function should allow getting rid of this.
2024-08-31Some margin and indentation tweaks in news and NPC dialogsThorbjørn Lindeijer1-13/+20
* Apply indentation after wrapping only in NPC dialogs and chat window, since we don't want this in the updater window / news. * Added some margin around the text in the updater window and NPC dialogs, using gcn::Widget::setFrameSize. * Cosmetic changes to BrowserBox implementation.
2024-06-22Added support for bold font markup to BrowserBoxThorbjørn Lindeijer1-0/+1
##B switches font to bold, ##b switches font to normal. Each line starts with the normal font. This change is roughly based on ManaPlus commit 6c4c6ca877c336e17c0378131a0a139792012a99.
2024-03-11Implemented ability to open external links in news and chatThorbjørn Lindeijer1-0/+1
* Use ConfirmDialog to confirm the opening of the external link. * ConfirmDialog now centers on its parent window when provided. * Reset hovered link when mouse exits the BrowserBox.
2024-02-09Optimized BrowserBoxThorbjørn Lindeijer1-26/+28
* Introduced a LayoutContext that conveniently allows for relayouting all rows, or just a single one when it is added. BrowserBox::addRow no longer relayouts all the rows. * BrowserLink and LinePart are now merged into a new TextRow struct, so they can be conveniently dropped when the row limit has been reached. * Removed "opaque" option, which was enabled by default but disabled for all BrowserBox instances. * Removed "always update" option, and instead start delaying relayouting automatically when there are a lot of rows (> 100 currently). * Update window now also has text wrapping enabled. Closes #50
2024-02-09Some cleanups in UpdaterWindow and BrowserBoxThorbjørn Lindeijer1-43/+14
Doing some cleanups before working towards optimizing this code. Removed needless additional wrapping code in BrowserBox::addRow, since the text will be relayouted anyway. Simplified layouting code a little. For example, there's no need to keep track of the number of wrapped lines. Use more optimal data structures, like an std::deque for the text rows and a plain std::vector for the line parts. Both have less fragmentation than an std::list.
2024-02-09C++11: Use default member initializersThorbjørn Lindeijer1-12/+12
This patch is not exhaustive.
2024-01-26Apply C++11 fixitsThorbjørn Lindeijer1-10/+10
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using
2012-02-11Fixed issues with the help texts and small NEWS file updatesThorbjørn Lindeijer1-6/+0
* Changes were made to the way BrowserBox does colors that the help files were not adapted to. For example, there is no more ##P for choosing the previous color and applying a color changes it persistently rather than returning to default text color after each line wrap. Rather than changing the behavior of BrowserBox back I've just adapted the help files. * Set a monospace font on the Help window because this was originally the case and the text still relies on that for its layout. * zlib and CSV support was already cherry-picked into 0.5.1 so it is removed from the 0.6.0 changelog. Reviewed-by: Erik Schilling
2012-02-07Made BrowserBox use the recommended line skip for its fontThorbjørn Lindeijer1-3/+3
SDL_ttf provides a separate function for getting the recommended line skip, or the spacing between two lines of text. When rendering multiple lines of text this should be used rather than the visual height of the font. Since the information is only available for TrueTypeFont, a dynamic_cast was used with a fallback on gcn::Font::getHeight. Also made some small tweaks but nothing that really affects performance. Reviewed-by: Yohann Ferreira
2012-01-26Updated copyrights to 2012Thorbjørn Lindeijer1-1/+1
2012-01-09Made the chat text much more readable in every opacity case.Yohann Ferreira1-0/+12
I added text shadow and outline support to the browserbox, and made it adapt the text for the chattabs depending on the GUI opacity. Reviewed-by: Ablu.
2011-04-09Removed a lot of useless "documentation"Thorbjørn Lindeijer1-6/+0
I have to admit I contributed a large part of these. Sorry for that. Less empty space, more attention to the code. Acked-by: Jared Adams
2010-09-29Improve chat speed.Andrei Karas1-10/+50
Parse chat lines in BrowserBox once after changes. Reviewed-by: Thorbjorn
2010-02-22Modify copyright headersFreeyorp1-1/+2
2010-02-20License header update for The Mana ClientThorbjørn Lindeijer1-4/+3
2010-02-07Updated Copyright year to 2010!Bertram1-1/+1
Also added the update copyright tool from the Wormux Team. ( And not forgetting credit's due. :P )
2010-01-12Standardize header orderJared Adams1-3/+3
Also remove some extra new lines and fix eAthena's PartyTab define guards.
2010-01-12Improve chat speed.Andrei Karas1-1/+19
For improve chat speed this patch add some hacks to BrowserBox class, split big words in ChatTab. Also fix DoS in chat.
2009-04-20Drop current target on deathBjørn Lindeijer1-1/+1
2009-04-18Restored support for build-in colors to BrowserBoxBjørn Lindeijer1-5/+0
Now the BrowserBox can again display 9 build-in (non configurable) colors, used for example in the client news and the help window.
2009-04-07Moved basic widgets into the gui/widgets directoryBjørn Lindeijer1-0/+164
In an attempt to make the GUI code a little more structured, basic widgets are now put in gui/widgets. Many includes were also cleaned up.