summaryrefslogtreecommitdiff
path: root/src/gui/widgets
AgeCommit message (Collapse)AuthorFilesLines
2024-03-22Fixed the distribution of action events by DropDownThorbjørn Lindeijer1-1/+7
It did not distribute them when the value of the DropDown was changed by key events or mouse wheel.
2024-03-13Added SDL version check for SDL_OpenURLThorbjørn Lindeijer2-5/+20
Ubuntu 20.04 had SDL 2.0.10, and it is still supported. Also added error handling to the SDL_OpenURL call, just in case.
2024-03-12General code cleanupsThorbjørn Lindeijer9-45/+37
* Use default member initializers * Use range-based for loops * Avoid needless pointer references for ShopItem::mDuplicates * Removed type aliases that are only used once or twice * Removed more unused includes * Removed some unused functions * Removed superfluous .c_str() * Rely on default copy and assignment operators for Vector class * Use std::unique_ptr in some places * Removed duplicated mPlayerMoney updating in SellDialog * Removed duplicated Game::handleInput call * Removed unused SDLInput::mMouseInWindow * Removed remnant of manual widget positioning in HelpWindow * Removed superfluous initialization of static pointers
2024-03-11Implemented ability to open external links in news and chatThorbjørn Lindeijer5-14/+57
* 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-03-07Use the native TMX tile animation formatThorbjørn Lindeijer2-8/+7
Rewrote the tile animation loading code based on XML tags, replacing the code that loaded tile animations from tile properties. Also made a number of code simplifications and optimizations: * Replaced a number of pointer members with value members. * Pass around Animation and TileAnimation by value, using std::move to avoid allocating copies. * push -> emplace * push_front -> emplace_front * push_back -> emplace_back * Use range-based for loops * Use std::vector instead of std::list for storing affected tiles (less fragmentation) * Avoid string copies and allocations while parsing CSV layer data. * Replaced xmlNodeGetContent with directly accessing 'content'.
2024-03-02Updated mouse cursors to latest versionThorbjørn Lindeijer2-10/+10
The new cursor types are not used yet for now.
2024-02-22General code cleanupsThorbjørn Lindeijer7-14/+12
* Use default member initializers * Use range-based loops * Don't use 'else' after 'return' * Removed some unused includes * Construct empty strings with std::string() instead of "" * Clear strings with .clear() instead of assigning "" * Check whether strings are empty with .empty() instead of comparing to "" * Removed redundant initializations
2024-02-15Fix handling of non-consecutive emote IDsThorbjørn Lindeijer2-40/+23
Previous code was assuming there would be no gaps in the emote IDs. Also cleaned up some confusion where the "emote ID" being passed around in the code was often offset by 1. Now it is only offset in communication with tmwAthena and when saving the shortcuts.
2024-02-13General code cleanupsThorbjørn Lindeijer58-275/+169
* Removing unused includes * Use member initialization * Use range-based for loops * Use nullptr * Removed no longer used aliases * Use override * Don't use else after return * Use '= delete' to remove implicit members * Use std::string::empty instead of comparing to ""
2024-02-09Optimized BrowserBoxThorbjørn Lindeijer4-342/+325
* 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 Lindeijer2-141/+54
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 Lindeijer3-31/+24
This patch is not exhaustive.
2024-01-29Removed unused includes in various filesThorbjørn Lindeijer5-6/+0
2024-01-29Apply C++11 fixitsThorbjørn Lindeijer14-82/+54
modernize-loop-convert modernize-deprecated-headers
2024-01-26Apply C++11 fixitsThorbjørn Lindeijer70-289/+289
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using
2024-01-25Minor includes cleanupThorbjørn Lindeijer1-1/+0
2024-01-25Ported to SDL2Thorbjørn Lindeijer5-53/+24
2024-01-24Fixed compilation issues and use of deprecated C++ featuresThorbjørn Lindeijer7-9/+9
* Fixed compiler errors due to dynamic exception specifications * Replace std::auto_ptr with std::unique_ptr * Replace std::mem_fun with std::mem_fn * Prefix for_each with std:: (apparently not needed before) * Just use lambda instead of std::bind2nd * Removed usages of std::unary_function
2012-08-05Removed all the hardcoded sizes of the various setup tabsThorbjørn Lindeijer6-10/+51
Instead, support for dynamically adjusting layout was added to the Container class. Various other places were also adapted to use the new layout support in Container. Reviewed-by: Erik Schilling
2012-05-07Merge branch '0.6'Thorbjørn Lindeijer1-9/+9
2012-05-07Fixed wrong offset values for tab widget drawingjurkan1-9/+9
Mantis-Issue: 423 Reviewed-by: Thorbjørn Lindeijer
2012-05-05Merge branch '0.6'Thorbjørn Lindeijer2-1/+3
2012-05-05Fixed compilation errors and warnings with GCC 4.7Thorbjørn Lindeijer2-1/+3
Also, since GCC 4.7 there is a binary compatibility issue when linking with a Guichan that was not compiled in C++11 mode. This commit also allows compiling with GCC 4.7 with C++11 mode turned off. Reviewed-by: Erik Schilling
2012-04-02Merge branch '0.6'Thorbjørn Lindeijer2-4/+3
2012-04-02Fixed problems with using the last emoteThorbjørn Lindeijer1-3/+2
The tmwa/BeingHandler was adjusting the effect id rather than the emote id, causing it to not find the last emote (and the rest of the emotes only worked correctly because the effect ids were consecutive in the same order as the emote ids). Furthermore, the EmoteShortcutContainer refused to draw the icon for the last emote due to an off-by-one error in dealing with the 1-adjusted emote ids used by the EmoteShortcut class. Also cleaned up some old remains of a player ignore strategy that used to use the two balloon emotes (this had been their original purpose). Reviewed-by: Erik Schilling
2012-04-01Made changes to compile on Mac OSX 10.6 and laterDavid Athay1-1/+1
Also added Xcode project for others to compile for Mac OSX. Reviewed-by: Thorbjørn Lindeijer
2012-02-18Added notification sound on receiving whisperThorbjørn Lindeijer3-3/+32
One of the sound channels is reserved for notification sounds, of which the volume can be configured separately. Currently, the only notification sound that is played is for receiving whispers. That can be extended later. The newmessage.ogg sound used currently is the one for receiving a message with the Psi instant messenger. Parts of this patch are based on the new message notification in ManaPlus. Reviewed-by: Erik Schilling
2012-02-12Fixed inventory displayYohann Ferreira1-3/+6
The filter system added while ago used to override the item slot true order, even when being empty. I now made the draw ordering change only when the filter is in use. Reviewed-by: Thorbjørn Lindeijer
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-10Arbitrary small code cleanupsThorbjørn Lindeijer3-7/+5
Reviewed-by: Erik Schilling
2012-02-09Fixed wallpaper prescaling issuesThorbjørn Lindeijer1-17/+26
Image::SDLgetScaledImage was changed so that it tries to find an existing scaled version of the image first, and generates it when none exists. When it needs to generate one, this resource is added to the resource manager, partly to avoid duplicating the work later but mainly to keep memory management straightforward. This function also used to leak the scaled SDL_Surface since it wrongly assumed that Image::load would free it. To avoid filling up the memory with scaled wallpapers that are waiting 30 seconds until they will be deleted, the Resource::decRef function was extended with a parameter that allows telling it what to do with orphans. Calling decRef with Resource::DeleteImmediately will delete the resource immediately in case the resource is orphaned. Reviewed-by: Yohann Ferreira
2012-02-09Avoid a crash after selecting one's character linked to emotes.Yohann Ferreira1-3/+3
This happened when the emote shortcut config has got too high ids in it, i.e. when testing different client version on the same host. Reviewed-by: Erik Schilling
2012-02-07Made BrowserBox use the recommended line skip for its fontThorbjørn Lindeijer2-48/+61
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-02-06Some cleanups in the initialization of wallpaper pathsThorbjørn Lindeijer2-2/+2
The 'paths' configuration in client-data now overrides any configuration in 'branding', so that it will apply after the updates for a certain server have been downloaded. Also, some isDirectory checks have been removed. When the configuration is wrong, it's probably better to see that there is a problem. Reviewed-by: Yohann Ferreira
2012-02-05Fixed some layout issues with the chat windowThorbjørn Lindeijer1-30/+19
One pixel of the scroll bar wasn't visible since the mWidgetContainer is shifted by one pixel by gcn::TabbedArea::adjustSize, which wasn't being taken into account by our custom mWidgetContainer sizing code. Fixed that by just letting Guichan handle it. Another issue was that the tab scroll arrows were appearing before they were needed, since they took into account their own size when checking whether the tabs had enough space. Finally, a Layout has a default padding of 6 pixels but this is a little much for the chat window. I reduced it to 3 pixels now. Reviewed-by: Erik Schilling
2012-02-03Changed the setup button at login stage to use the icon.Yohann Ferreira2-4/+6
I also made the button not readjust its size when deleted to avoid a crash. Reviewed-by: Erik Schilling
2012-01-31Added missing copyright notices.Yohann Ferreira6-1/+7
Reviewed-by: Erik Schilling
2012-01-26Updated copyrights to 2012Thorbjørn Lindeijer85-85/+85
2012-01-26Removed 'inline' keyword where it's not of any valueThorbjørn Lindeijer3-10/+10
Members that are implemented inline are already inline, there is no need to mark them as such. Made two inline members of OpenGLGraphics private since because they are marked as inline, they can't be used from other classes. Reviewed-by: Erik Schilling
2012-01-22Allow resizing of the game in windowed modeThorbjørn Lindeijer4-57/+59
Window positions are semi-smartly corrected as a result of the resize. Not supported when using OpenGL on Windows for now. Reviewed-by: Yohann Ferreira
2012-01-20Made the ignore record parameter usefulErik Schilling1-1/+1
Reviewed-by: Bjorn.
2012-01-16Renamed some file names for consistency with the class namesThorbjørn Lindeijer4-4/+4
This was already done by ManaPlus. It's a good idea anyway and it makes comparing the code a little easier. Reviewed-by: Yohann Ferreira
2012-01-15Show item quantity in the shop listThorbjørn Lindeijer1-23/+40
Rather useful when selling items to quickly see what you have in abundance, rather than only seeing the quantity of the selected item. Reviewed-by: Yohann Ferreira
2012-01-10player_node -> local_playerYohann Ferreira2-2/+2
Reviewed-by: Ablu
2012-01-09Changed INT and DELETE enum names to fix C::B compilation.Yohann Ferreira2-2/+2
This was introduced since Crush updated his mana lib pack. I simply changed the names to avoid a collision. Reviewed-by: Ablu.
2012-01-09Made the chat text much more readable in every opacity case.Yohann Ferreira4-4/+94
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-11-12Removed hiding of button popup when setting the text to emptyYohann Ferreira2-8/+2
The text is never set to an empty string, especially not while the mouse is over the button. The popup will be updated or hidden by mouseMoved anyway. Reviewed-by: Thorbjorn Lindeijer
2011-11-12Removed some Channel and ChannelTab related sillinessThorbjørn Lindeijer1-5/+0
* Channel always has a ChannelTab, so need to check it for null * Removed duplicate handling of 'topic' command * No need to set Channel::mTab twice Reviewed-by: Yohann Ferreira
2011-11-12Fixed the button popup incorrectly shown when loading the window menu.Yohann Ferreira1-3/+1
This was due to a small logic error when setting the popup text. Reviewed-by: Erik Schilling
2011-10-23Fixed a certain class of Doxygen warningsThorbjørn Lindeijer6-20/+12
All cases of documentation for non-existing parameters are now fixed. Also marked a few getters as 'const', removed some superfluous 'inline' keywords and removed the unused 'forceQuantity' option from ItemContainer. Reviewed-by: Yohann Ferreira