summaryrefslogtreecommitdiff
path: root/src/gui/widgets
AgeCommit message (Collapse)AuthorFilesLines
2024-10-26Fixed FPS limit being enabled by defaultThorbjørn Lindeijer2-2/+2
There were some inconsistencies between the values set up in `Client::initConfiguration` and those in `getConfigDefaults`. These duplicates have now been removed. For some of these settings the code getting the values had to be adjusted to use getBoolValue, to actually rely on the provided default instead of one provided as a parameter.
2024-10-18Added small grabbable margin to Shortcuts windowThorbjørn Lindeijer3-43/+19
The Shortcuts window could no longer be moved since adding support for resizing windows at the top edge. Now there is again a bit of space where the window can be grabbed. Included some related cleanups.
2024-10-18General code cleanupsThorbjørn Lindeijer1-3/+2
2024-10-08Do a single logic update each frameThorbjørn Lindeijer1-1/+1
The logic update now uses Time::deltaTimeMs() where needed to make it framerate-independent. This means there will no longer be multiple logic calls per frame (as was usually the case with logic ticking at 100 fps whereas the game would generally run at 60 fps). At the same time, the game can be more precise at higher framerates and should now run smoother at 144 Hz, for example. Previously the game would sometimes skip logic ticks at that rate. This change affects: * Updating of animations * Being movement speed * More moving of manual time variables to Timer Notoriously, the particle system still does 100 ticks/second.
2024-10-08Added convenient and efficient Timer classThorbjørn Lindeijer2-5/+7
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-09-28Removed getter/setter cruft from ItemInfoThorbjørn Lindeijer3-7/+7
Made the class and the code in general more readable by removing all the needless getters and setters.
2024-09-02Added a hand mouse cursor, used when hovering linksThorbjørn Lindeijer2-11/+16
InputEvent::mIsConsumed is used to tell the Window it should not change the mouse cursor as well. This change also adds a closed hand mouse cursor, though this is unused for now (might be useful when dragging stuff around). The new cursors are by meway.
2024-08-31Display "Mana" as part of the version in Setup windowThorbjørn Lindeijer1-1/+1
This was already done in the log, when responding to the --version parameter and for the label on the Desktop widget, but not in the Setup window. Now it is consistently part of the FULL_VERSION define.
2024-08-31BrowserBox: Make sure to start each line with the default colorThorbjørn Lindeijer1-1/+4
This was already the case for each newly added line, but when the entire layout was redone previous selected colors would spill over to the next line.
2024-08-31Some margin and indentation tweaks in news and NPC dialogsThorbjørn Lindeijer3-39/+37
* 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-08-28Fixed handling of consecutive text formatting markersThorbjørn Lindeijer1-11/+7
If a text contained for example "##3##B", expected behavior was to switch to blue color and bold font. Instead, due to there being no actual text in between the markers, the layouting code was aborting prematurely here: if (mMode == AUTO_WRAP && partWidth == 0) break; As far as I could judge, this check is actually not necessary anyway, but I've kept it for now since the wrapping code looks so problematic. Instead, a while loop now makes sure we process all consecutive formatting markers. Closes #75
2024-08-15Fixed resize border width on bottom and right sidesThorbjørn Lindeijer1-4/+4
2024-08-04Small code simplification in Button::initThorbjørn Lindeijer1-10/+7
2024-08-04Reuse Window::ensureOnScreenThorbjørn Lindeijer1-17/+7
Less code duplication.
2024-06-25Added online player list to Social windowDavid Athay2-19/+8
The online list refreshes every 18 seconds, which matches ManaVerse behavior. It's not ideal, but to improve this would mean diving into TMWA. The client version was bumped to 8 to get a SMSG_ONLINE_LIST reply. Further changes needed related to the client version are tracked by #71. This also changes the TabbedArea to take into account the frame size for its tab widgets, to make sure those frames are not clipped by the TabbedArea widget (as happened in the Social window). The horizontal scroll bar is now disabled in all social tabs, with the vertical one appearing only when necessary. Closes #61
2024-06-25Fixed spaces getting added to chat every 50 charactersThorbjørn Lindeijer2-25/+2
This reverts part of 087babc2525ddb89e5b31f240a08739d9a3029a9. It's unclear to me why big words should be split (chat window force-wraps when necessary anyway) and it's causing issues by adding spaces in the middle of links, for example.
2024-06-25Show item links with empty item name.npc-text-formattingAndrei Karas1-0/+11
(cherry picked from commit 0192d44d46dcf948ab26371862753f4baf5aae4e)
2024-06-22Added support for bold font markup to BrowserBoxThorbjørn Lindeijer2-39/+64
##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-06-09Enable resizing windows from all sidesThorbjørn Lindeijer2-5/+15
Previously, the top edge of windows could not be dragged. Now you can also resize windows by their top edge, as well as the top-left and top-right corners.
2024-04-08Added UI debug drawingThorbjørn Lindeijer2-0/+89
Shows outlines of visible widgets as well as highlighting modal focus, modal mouse focus and regular focus. Can currently only be toggled in the Debug window, so needs source code modification to be used during login sequence for now.
2024-04-08Use ResourceRef<Image> in more placesThorbjørn Lindeijer5-17/+19
Automatic reference counting of images is now used by Item, Icon, AnimatedSprite, ImageSprite, ParticleEmitter, Minimap, Desktop and Emote. Since ResourceManager::get automatically adds a reference, it needs to be explicitly subtracted when the resource is managed by ResourceRef. This is taken care of by the new ResourceManager::getImageRef. Also removed the apprently unused and duplicate "mDrawImage" from Item (which also didn't get decRef called on it). Fixes cleanup of emote ImageSet and ImageSprite instances, as well as particle images.
2024-04-02General code cleanupsThorbjørn Lindeijer4-22/+3
* Removed some unused includes * Removed unused ListBox::mFont * Removed wrong cast to SDL_Scancode * Removed superfluous .c_str() * Removed superfluous explicit std::string construction * Removed unused variable * Use more emplace_back * Turned FindBeingFunctor into a lambda * Avoid needless pointer references for ambient layers and use a vector
2024-03-28Fixed size and child positions for various popupsThorbjørn Lindeijer1-4/+5
Most prominently, fixes the tooltips on the window buttons being clipped due to their position being slightly outside of the clipping children area. And fixes NPC tooltips from having a lot of empty space below the NPC name. Also reduced the space between texts in the item tooltip to match the padding rather than being an entire empty line.
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 emotev0.6.1Thorbjø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