summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI
AgeCommit message (Collapse)Author
2020-12-18LibGUI: Don't assume main widget exists in Window::handle_resize_event()Linus Groh
Just like the other event handler functions, handle_resize_event() shouldn't assume that the window has a main widget (which is being resized in this case). Fixes #4450.
2020-12-18LibGUI: Make autoformatting performed on InsertTextCommand visible to ↵Sahan Fernando
on_edit_action
2020-12-17LibGUI: Table views with SelectRows should scroll entire rows into viewAndreas Kling
2020-12-17LibGUI: Move selection behavior from TableView up to AbstractViewAndreas Kling
Let's make SelectionBehavior a view concept where views can either select individual items (row, index) or whole rows. Maybe some day we'll do whole columns, but I don't think we need that now.
2020-12-16LibGUI: Don't fill IconView item text background unless actually wantedAndreas Kling
We were always filling the rect behind item texts, even when the widget had fill_with_background_color() == false.
2020-12-16LibGUI: Make the IconView cursor rect show up on the desktopAndreas Kling
It was getting lost in some bogus coordinate conversion math while trying to constrain unusually long item texts.
2020-12-16LibGUI: Add ScrollableWidget helpers for rect conversionAndreas Kling
to_content_rect() and to_widget_rect() help you convert rects from one coordinate space to the other.
2020-12-16FileManager+LibGUI: Draw the item text for desktop icons with shadowAndreas Kling
This makes it look nice regardless of wallpaper or background color.
2020-12-16LibGUI: Show app icons for executables with associated .af filesAndreas Kling
This is a rather ugly hack just to get app icons to show up in the FileManager. It would be a lot nicer to embed icons in executables instead but it's not obvious to me how to do that.
2020-12-16LibGUI: Generate nicer icons for symlinked filesAndreas Kling
Instead of symlinks showing up with the "filetype-symlink" icon, we now generate a new icon by taking the target file's icon and slapping a small arrow emblem on top of it. This looks rather nice. :^)
2020-12-16LibGUI: Add GUI::Icon::sizes()Andreas Kling
This gives you a Vector<int> with all the sizes contained in the Icon.
2020-12-14Loader: Stabilize loader & Use shared libraries everywhere :^)Itamar
The dynamic loader is now stable enough to be used everywhere in the system - so this commit does just that. No More .a Files, Long Live .so's!
2020-12-14LibGUI: Don't focus BreadcrumbBar segments on clickAndreas Kling
2020-12-14LibGUI: Add a basic BreadcrumbBar widget! :^)Andreas Kling
This can be used to implement segmented path bars in FileManager and wherever else wanted.
2020-12-14LibGUI: Protect GUI::Button across firing the on_click hookAndreas Kling
If a hook triggers the deletion of the GUI::Button, we would be unable to proceed in a well-defined manner here, so let's protect ourselves. This probably needs to be done in a whole lot of places, since GUI widgets are just ref-counted Core::Objects and running arbitrary code can mean that they get deleted.
2020-12-13LibGUI: Simplify ComboBox/TextEditor relationship a bitAndreas Kling
Instead of TextEditor knowing about the ComboBox button on the right hand side, we now make ComboBox inherit from GUI::Frame, and make the inner text editor widget frameless. This allows us to place the button ourselves inside ComboBox without any frame artifacts, and TextEditor no longer needs to keep track of the geometry of that button.
2020-12-11FileManager: focus_dependent_delete_action is correctly enabled/disabledZac
The focus_dependent_delete_action that sits in the file manager's toolbar would always remain enabled, even if nothing was selected, activating it if nothing was selected would then crash the application. The action is now correctly enabled/disabled, but due to the way selection works in TreeViews, something is always selected, what really matters is if the TreeView has something selected, and it has focus. As it currently stands, there is no way to know when the TreeView's is_focused status changes. In order for this to work I added a callback to the Widget class which fires when a widget receives or looses focus. In that callback, the focus_dependent_delete_action's enabled value is recalculated.
2020-12-09LibGUI: Show action shortcut in ToolBarButton tooltipSahan Fernando
2020-12-08Clipboard: Remove-unused bpp metadataBen Wiederhake
It's just more attack surface, and can be deduced from the format anyway.
2020-12-07LibGUI: Expose widget focus policy as a Core::Object propertyAndreas Kling
This makes focus policies show up in the inspector which is helpful.
2020-12-07LibGUI: Allow GUI::Action to swallow key events when disabledLinus Groh
Sometimes an action should be disabled and the KeyEvent not posted to the app's event loop nonetheless. In other words the action swallows the KeyEvent without being activated. Specific use-case: Terminal's Ctrl+Shift+{C,V}.
2020-12-03LibGUI: Optimize GUI::Variant move constructorSahan Fernando
2020-12-02Taskbar: Wait on all waitable children in SIGCHLD handlerTom
We need to call waitpid until no more waitable children are available. This is necessary because SIGCHLD signals may coalesce into one when multiple children terminate almost simultaneously. Also, switch to EventLoop's asynchronous signal handling mechanism, which allows more complex operations in the signal handler.
2020-11-30LibGUI: Add a ModelSelection::add_all(Vector) APIAnotherTest
Using add() is very slow due to the change notifications.
2020-11-30LibGUI: Throw less view state away in model_did_update()AnotherTest
When `DontInvalidIndexes` is passed, be optimistic and keep the old indices when the model validates them. This is currently fine, as the group of models that use DontInvalidateIndexes use it as "The old indices are still ok" (there's a note about this in ProcessModel.cpp).
2020-11-30LibGUI: Don't start editing with (just) modifier keys when AnyKeyPressedAnotherTest
This fixes the control key starting an edit on (and inserting a nul character into) a cell in Spreadsheet.
2020-11-30LibGUI: Remove `AbstractView::did_update_model()'AnotherTest
...and use `ModelClient::model_did_update()' instead. This makes AbstractView a ModelClient (which it always was anyway).
2020-11-28LibGUI/FileIconProvider: Initialize s_filetype_image_iconLinus Groh
This was accidentally removed in 1c90321. Fixes #4125.
2020-11-28LibGUI: Make GUI::Dialogs non-minimizable by defaultAndreas Kling
2020-11-28LibGUI: Don't assert when right clicking on a vertical HeaderViewAndreas Kling
Just log a debug message instead. We still need to actually implement vertical header context menus, but for now let's at least not crash.
2020-11-27TextEditor: Add button to match regular expression during searchEmanuel Sprung
2020-11-24LibGUI: Remove redundant set_title() call in FilePicker (#4153)Zac
2020-11-23LibGUI: Widget::action_for_key_event() should fail for invalid shortcuts (#4137)Jakub Berkop
Previously GUI::Actions which were constructed without initializing m_shortcut could be activated via an invalid GUI::Shortcut. Steps to reproduce: It was possible to enable TextEditor's markdown preview by pressing Ctrl or Alt (Cmd/Ctrl) keys, which should not happen, as this Action did not specify a shortcut. This fix should apply to all other cases where actions where declared without specifying a shortcut.
2020-11-23LibGUI: Set FilePicker window icon based on mode (#4148)Zac
2020-11-22LibGUI: Fix undo stackBenJilks
This would undo all commands at once instead of one at a time.
2020-11-19TextEditor: Change cursor behaviour when clicking empty spaceZac
When clicking empty space (beneath any used lines) in the TextEditor, the cursor would jump to the start of the last line, rather than the correct column, or the end of the line where appropriate. This was because in the for_each_visual_line callback would return IterationDecision::Continue if the clicked point wasn't in the line's rect. Thus the callback would continue on each iteration and at the end, would set the cursor to the default column of 0. To fix this I added a bool to the callback's signature which tells the callback if the for_each_visual_line method is on the last visual line. The callback now does not return IterationDecision:Continue if for_each_visual_line method is on the last line and the correct column is then calculated with the line passed.
2020-11-19LibGUI: Remove AbstractTableView::doubleclick_event()Andreas Kling
This work is already done (and more correctly) by the parent class (AbstractView) if we just let it take care of the event instead. Fixes the root cause of #4096.
2020-11-15LibGUI/FileIconProvider: Add config file and use patternsLinus Groh
This moves file extension to icon mappings from compile time macros to an INI config file (/etc/FileIconProvider.ini), so file icons can easily be customized and extended :^) I also switched the format from a static file extension (".foo") to glob-like patterns ("*.foo", using StringUtils::matches()), which allows us to assign icons to specific exactly matching file names, like many IDEs do - e.g. "CMakeLists.txt" or ".prettierrc".
2020-11-14LibGUI: Make FileIconProvider aware of all supported image formatsLinus Groh
By using Gfx::Bitmap::is_path_a_supported_image_format() we can automatically provide the image icon for all supported image formats, without keeping a second list of image file extensions.
2020-11-14LibGUI: Add more extensions to FileIconProviderLinus Groh
This adds the following: - cplusplus: .cxx, .cc, .c++ - header: .hpp, .hxx, .hh, .h++ - javascript: .mjs
2020-11-14LibGfx: Make Bitmap path handling case insensitiveLinus Groh
Bitmap::is_path_a_supported_image_format() and Bitmap::load_from_file() now check the file extension with CaseSensitivity::CaseInsensitive. This fixes a couple of inconsistencies, for example would FileSystemModel::icon_for() recognize image files uppercase extensions but couldn't create thumbnails for them (any attempt to create a bitmap from such files would fail).
2020-11-11LibGUI: Set vertical distance between icons relative to scroll valueAmusedNetwork
When calculating the vertical distance between icons, we should take into account the value of the vertical scrollbar. Fixes #4040
2020-11-10LibGUI: Ignore application-global shortcuts in modal windowsAndreas Kling
This is making me question the usefulness of application-global shortcuts, but for now let's just prevent them from triggering while you're looking at a modal message box..
2020-11-10AK: Make RefPtr, NonnullRefPtr, WeakPtr thread safeTom
This makes most operations thread safe, especially so that they can safely be used in the Kernel. This includes obtaining a strong reference from a weak reference, which now requires an explicit call to WeakPtr::strong_ref(). Another major change is that Weakable::make_weak_ref() may require the explicit target type. Previously we used reinterpret_cast in WeakPtr, assuming that it can be properly converted. But WeakPtr does not necessarily have the knowledge to be able to do this. Instead, we now ask the class itself to deliver a WeakPtr to the type that we want. Also, WeakLink is no longer specific to a target type. The reason for this is that we want to be able to safely convert e.g. WeakPtr<T> to WeakPtr<U>, and before this we just reinterpret_cast the internal WeakLink<T> to WeakLink<U>, which is a bold assumption that it would actually produce the correct code. Instead, WeakLink now operates on just a raw pointer and we only make those constructors/operators available if we can verify that it can be safely cast. In order to guarantee thread safety, we now use the least significant bit in the pointer for locking purposes. This also means that only properly aligned pointers can be used.
2020-11-10LibGUI: Limit the height of item text in IconViewAmusedNetwork
Set the max height of the text_rect to be the height difference between two icons. Calculate the number of text lines that can be displayed in this height, and display only that many.
2020-11-10TextEditor: Go-to-line now shows line in middle of view (#4008)Jack Byrne
2020-11-08LibGUI: Prevent multiple drag initiations while drag messages are passedAnotherTest
2020-11-08LibGUI+WindowServer: Make DragOperation hold a MimeData instanceAnotherTest
...instead of maybe bitmap + a single mime type and its corresponding data. This allows drag&drop operations to hold multiple different kinds of data, and the views/applications to choose between those. For instance, Spreadsheet can keep the structure of the dragged cells, and still provide text-only data to be passed to different unrelated editors.
2020-11-08LibGUI: Limit ScrollableWidget::available_size() width/height to 0Linus Groh
The current implementation is lying, it returns negative values if the inner rect has a zero width or height but also a scrollbar - which doesn't mean there's a "negative size" available though; it's still "no size available", i.e. 0.
2020-11-06LibGUI: Clip rubber band to IconView widget content areaJoseph Bywater
Add a clip rect for the rubber band painter of widget_inner_rect This ensures the rubber band is not drawn over the scrollbars. Fixes #3926