summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI
AgeCommit message (Collapse)Author
2021-10-17LibGUI: Remember the maximized value if a window hasn't been created yetKarol Kosek
d0fb511d75762e9d97fa80a01585381843b90a0a set the maximized window value in the File Manager before a window was created, which resulted in crash everytime you tried to open the program that was closed while it was maximized. ugh Here we do more-or-less what GUI::Window::set_rect() does, except we don't add it to the WindowServer::create_window() IPC call. That's because the Window Server knows nothing about menus at this point and just assumes they don't need to be visible. So if we try to maximize the window then, it could be slightly taller and a titlebar could be hidden. So even though it looks how it looks like, it does work and it doesn't show in the startup size, as described in the mentioned commit (the call is put a few lines before the initial update()). :^)
2021-10-15LibGUI: Make Ctrl-Right at the end of a span workBen Wiederhake
There used to be the silly bug that when the cursor was already at the end of a span (e.g. because the user just pressed Ctrl-Right), then Ctrl-Right had no effect. This bug does not appear with Ctrl-Left because due to the order in which the spans are iterated, the effective result is always correct. This patch also makes it more apparent that the algorithm is unnecessarily inefficient.
2021-10-15LibGUI: Don't update selection twice after Ctrl-RightBen Wiederhake
2021-10-15LibGUI: Make Ctrl-Shift-Home/-End work againBen Wiederhake
Previously, the initial call to update_selection() was missing, so if no text was already selected, then Ctrl-Shift-End would only move the cursor to the document end, but not select any text.
2021-10-15LibGUI: Convert always-valid pointer to referenceBen Wiederhake
The pointer is always assumed to be non-null, so let's change it to a reference.
2021-10-08Libraries: Fix -Wunreachable-code warnings from clangNico Weber
2021-10-07LibGUI: Support drag-to-reorder in TabWidgetPeter Elliott
2021-10-06LibGUI: Add missing headersBen Wiederhake
2021-09-29LibGUI: Implement automatic scrolling in AbstractViewMarcus Nilsson
This adds automatic scrolling when dragging items in TreeViews and other widgets that inherit from AbstractView when the overloaded accepts_drag() returns true. This is implemented in FileSystemModel to allow directories and files to be dragged.
2021-09-29LibGUI: Account for scrollbar width when calculating autoscroll deltaMarcus Nilsson
2021-09-29Browser: Use CommonActions where possible and various fixesMarcus Nilsson
This replaces some actions with CommonActions and also adds '...' to menu items that require user input.
2021-09-27LibGUI: Refine AbstractButton pressing behaviourFrHun
Previously the code couldn't handle leaving the AbstractButton through tab, while having it pressed through space or enter.
2021-09-27LibGUI: Add 'on_rename_successful' callback to FileSystemModelMarco Cutecchia
2021-09-24LibGUI: Categorize font families by variant instead of weightthankyouverycool
FontPickerWeightModel is no longer necessary as variants contain weight as part of a complete typeface description. This fixes fonts not inventorying correctly in picker when they contained more than bold and regular typefaces. Weight mapping has been moved into LibGfx/FontStyleMapping.h
2021-09-22LibGUI: Calculate unclamped_scrubber_size() as floatthankyouverycool
Large enough content ranges produced unclamped scrubbers sized zero, effectively clamped by their integer type. This led to zero sized page_increments and scrubbers which didn't budge on gutter events. This fixes broken gutters in FontEditor and TextEditor for large files.
2021-09-22LibGUI: Rename CallOnChange => AllowCallback and implement elsewherethankyouverycool
This is a helpful option to prevent unwanted side effects, distinguish between user and programmatic input, etc. Sliders and SpinBoxes were implementing it idiosyncratically, so let's generalize the API and give Buttons and TextEditors the same ability.
2021-09-20LibGUI: Update the window cursor if it was provided as a bitmapKarol Kosek
This condition rejected almost every bitmap cursor change.
2021-09-19LibGUI: Add option to disable on_change call for sliders set_value()David Isaksson
This makes it possible to avoid messy situations where a slider controlled value can be changed from multiple sources.
2021-09-19LibGUI: Add number_of_words() to TextEditorsthankyouverycool
Returns the total number of words in a document.
2021-09-18AK: Make Utf8View constructors inline and remove C string constructorAndreas Kling
Using StringView instead of C strings is basically always preferable. The only reason to use a C string is because you are calling a C API.
2021-09-16LibGUI: Add a AutoScroll timer to AbstractScrollableWidgetMarcus Nilsson
This commit adds a timer to AbstractScrollableWidget that can be used when implementing automatic scrolling. By overriding on_automatic_scrolling_timer_fired() we can calculate the scrolling delta when dragging objects, and redraw as needed. A helper function, automatic_scroll_delta_from_position() gives us a delta that we can use to calculate speed and direction. By default m_autoscroll_threshold is 20 pixels from the edge, and gives a linear change in scroll delta.
2021-09-16LibGUI: Implement is_min() & is_max() helpers to AbstractSliderMarcus Nilsson
2021-09-16LibGUI: Use default instead of an empty constructor/destructorBrian Gianforcaro
Default implementations allow for more optimizations. See: https://pvs-studio.com/en/docs/warnings/v832/
2021-09-12LibGUI: Remove Indices with dangling FileSystemModel::Node on deletionItamar
When a file deletion event happens, we now iterate over all views of the FileSystemModel and remove any selection & cursor indices that hold dangling references do the deleted filesystem node. This fixes #9602.
2021-09-12LibGUI: Make the Open button always active in the OpenFolder modeKarol Kosek
We can just use the current opened directory as a path in that mode. :^)
2021-09-12LibGUI: Enable/Disable the Open button on text change in FilePickerKarol Kosek
Prior this change, the button was updated on user selection change in the file view. This isn't quite right, as you could remove the text from the text box or (even worse) start typing a filename there and the button state wouldn't change.
2021-09-11LibGUI+TextEditor: Allow cursor line highlighting to be toggledthankyouverycool
2021-09-11ColorPicker: Add ability to select a color on the screenMustafa Quraish
This commit adds a `ColorSelectOverlay` class, and uses it to allow the user to pick a color from the screen. The API for `ColorSelectOverlay` is inspired from the `SelectableOverlay` in `Utilities/shot.cpp`. In particular, it opens up it's own window, so that we can have control over the cursor over the whole screen. There's one thing notably different: In addition to returning the final selected color from the `exec()` function, it also provides an `on_color_changed()` hook, which can be used to (optionally) get live updated as the mouse is moving around. This is a bit odd, but allows us to use the preview widget of the color picker to see the current color under the mouse (which will be selected upon clicking). When trying to select the color from text / other small elements, this is very useful.
2021-09-10AK+Everywhere: Reduce the number of template parameters of IntrusiveListAli Mohammad Pur
This makes the user-facing type only take the node member pointer, and lets the compiler figure out the other needed types from that.
2021-09-09LibGUI: Disable Open/Save button in FilePicker when nothing is selectedJohn Diamond
The existing behaviour is that filename_textbox is cleared if a node of the wrong type is selected. Here we reflect that state update in the state of the ok_button. This change helps the user to avoid confirming (and seeing an alert) if they press "Open" after clicking on an invalid node.
2021-09-08LibGUI: West Const to East Const refactorDawid Wolosowicz
2021-09-08LibGUI: Remove an unnecessarily specific inline capacityDawid Wolosowicz
2021-09-08LibGUI: Sync the highlighting after each model updateDawid Wolosowicz
Without this, the highlighting would stay on the initial index even if the matching row is no longer there.
2021-09-08LibGUI: Refactor AbstractView::do_search() into two standalone stepsDawid Wolosowicz
This change splits the do_search() into find_next_search_match() and highlight_search() to allow the given index be independently highlighted when needed.
2021-09-08LibGUI: Remove barely used AbstractView::is_searching()Dawid Wolosowicz
2021-09-08LibGUI: Unify naming of searching timer related membersDawid Wolosowicz
2021-09-08LibGUI: Rename AbstractView::m_searching => m_highlighted_searchDawid Wolosowicz
2021-09-08LibGUI: Remove barely used AbstractView::is_highlighting_searching()Dawid Wolosowicz
2021-09-08LibGUI: Remove barely used AbstractView::searching()Dawid Wolosowicz
2021-09-08LibGUI: Make AbstractView::is_searching protectedDawid Wolosowicz
2021-09-08LibGUI+WindowServer: Remove now-obsolete cursor tracking featureBen Wiederhake
This feature was problematic for several reasons: - Tracking *all* the user activity seems like a privacy nightmare. - LibGUI actually only supports one globally tracking widget per window, even if no window is necessary, or if multiple callbacks are desired. - Widgets can easily get confused whether an event is actually directed at it, or is actually just the result of global tracking. The third item caused an issue where right-clicking CatDog opened two context menus instead of one.
2021-09-08LibGUI+WindowServer: Introduce new mouse tracking mechanismBen Wiederhake
2021-09-07Everywhere: Behaviour => BehaviorAndreas Kling
2021-09-06LibGUI: Dynamically resize editing content rect in IconViewMarcus Nilsson
This makes IconView aware of the text width of the ModelEditingDelegate widget when editing an index and allows us to resize the content rect as needed. This also removes the border from the textbox since it could collide with the icon in ColumnsView. While editing we also skip painting the inactive selection rect since it would otherwise show when the content rect gets smaller.
2021-09-06LibGUI: Add Gfx::ColorRole to VariantKarol Kosek
For Theme Editor. :^)
2021-09-06Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safeAli Mohammad Pur
2021-09-04LibGUI: Fixes modified indicator behavior after savingluiz
Pior to this change when the user added text after having saved the file the Text Editor wouldn't enable the modified flag, unless this new text was a new line. This happened because the UndoStack was merging the Command added by the new text with the old text one, and when is_current_modified() was called, the m_stack_index would not have been incremented, and it would return false. In this change was added a condition to verify if the modified tag is active, and the merge is only done if the document is already modified.
2021-09-03Everywhere: Use my shiny new serenityos.org email :^)Sam Atkins
2021-09-03LibGUI: Set correct value on click with set jump_to_cursor() in SliderKarol Kosek
Prior this change, clicking on a slider with set jump_to_cursor() flag didn't exactly match the knob to the mouse position, and therefore the slider values were a bit off in the corners. The calculation used the whole widget size to set new values, which isn't correct as the track slider has margins on both ends. I noticed this while seeking in the Sound Player.
2021-09-03LibGUI: Add track_margin() to SlidersKarol Kosek
Less magic numbers! :^)