Commit Graph

124 Commits

Author SHA1 Message Date
Brian Gianforcaro
a34ea51ca4 Fire: Use ElapsedTimer::start_new() 2021-09-12 17:24:44 +00:00
Brian Gianforcaro
ddfdfc2342 Cube: Use ElapsedTimer::start_new() 2021-09-12 17:24:44 +00:00
Mustafa Quraish
c545d4ffcb WidgetGallery: Add GUI::ValueSlider widget
This was a cool slider and was missing from the gallery completely.
Vertical mode for this isn't enabled, and it looked awfully crammed
in the bottom along with the other horizontal sliders, so for now
I've just added this to the top, and it controls the opacity of the
image along with the opacity slider.
2021-09-11 11:37:39 +02:00
Ben Wiederhake
f717008bde CatDog: Switch to new mouse-tracking method 2021-09-08 10:53:49 +02:00
Ben Wiederhake
c6546c7b03 Eyes: Switch to new mouse-tracking method 2021-09-08 10:53:49 +02:00
Mustafa Quraish
1da081bf86 Mandelbrot: Use the new Zoom cursor
It makes it really clear now that you can use the mouse to zoom
when you see the zoom cursor.
2021-09-04 03:35:23 +02:00
Andreas Kling
c915174563 Userland: Remove IRC Client
The IRC Client application made some sense while our main communication
hub was an IRC channel. Now that we've moved on, IRC is just a random
protocol with no particular relevance to this project.

This also has the benefit of removing one major client of the single-
process Web::InProcessWebView class.
2021-08-24 16:37:28 +02:00
sin-ack
b30b7de2d2 ModelGallery: Add the new Model Gallery application :^)
This is an application analogous to WidgetGallery, in that it tests
various capabilities of LibGUI models. Right now it is pretty bare, but
as more work towards LibGUI models is done regarding persistent model
indices, more demos will be added.
2021-08-23 12:25:26 +04:30
Maciej Zygmanowski
040a723f1f WindowServer: Add support for cursor themes
Now you can specify a CursorTheme key in /etc/WindowServer.ini. The
cursors are loaded from /res/cursor-themes/<name> directory. This
directory contains a Config.ini file with format similar to previous
Cursor section, except it uses relative paths.

This commit adds also Default theme, which uses cursors being
previously in /res/cursors.

The WidgetGallery is updated to match the new cursor path format.
2021-08-23 01:41:53 +02:00
Andreas Kling
20b104dead WidgetGallery: Remove menubar 2021-08-20 01:27:39 +02:00
sin-ack
e11d177618 Userland+LibGUI: Add shorthand versions of the Margins constructor
This allows for typing [8] instead of [8, 8, 8, 8] to specify the same
margin on all edges, for example. The constructors follow CSS' style of
specifying margins. The added constructors are:

- Margins(int all): Sets the same margin on all edges.
- Margins(int vertical, int horizontal): Sets the first argument to top
  and bottom margins, and the second argument to left and right margins.
- Margins(int top, int vertical, int bottom): Sets the first argument to
  the top margin, the second argument to the left and right margins,
  and the third argument to the bottom margin.
2021-08-18 10:30:50 +02:00
sin-ack
9c9a5c55cb Userland+LibGUI: Make Margins arguments match CSS ordering
Previously the argument order for Margins was (left, top, right,
bottom). To make it more familiar and closer to how CSS does it, the
argument order is now (top, right, bottom, left).
2021-08-18 10:30:50 +02:00
Nico Weber
5c3440c5db Mandelbrot: Add a View menu with zoom actions 2021-08-14 19:50:44 +02:00
Nico Weber
19068945de Mandelbrot: Extract reset() method 2021-08-14 19:50:44 +02:00
Nico Weber
ad7bfe017f Mandelbrot: Extract zoom() method 2021-08-14 19:50:44 +02:00
sin-ack
1be59d663a Mandelbrot: Only recalculate missing areas after panning
We can reuse the areas that we have from before and just recalculate
the areas that are fresh. This makes panning super smooth. :^)
2021-08-10 09:48:12 +02:00
sin-ack
d28802ad22 Mandelbrot: Add panning
Adds the ability to use the middle-mouse click to pan the current view.
2021-08-10 09:48:12 +02:00
sin-ack
faec8bbe45 Mandelbrot: Add mousewheel zooming
This allows the user to zoom in with a up scroll of the mousewheel and
zoom out with a down scroll.
2021-08-10 09:48:12 +02:00
sin-ack
a08dd5b99c Mandelbrot: Use a GUI::Frame to paint into
This allows us to have a frame border which looks nicer.
2021-08-10 09:48:12 +02:00
sin-ack
07f5e12568 WidgetGallery: Change model update() functions to invalidate()
These functions reload the whole model contents and thus can be moved to
invalidate(), which saves us from the need to manually call update() on
them.
2021-08-08 14:45:23 +02:00
sin-ack
ca2c81251a Everywhere: Replace Model::update() with Model::invalidate()
Most of the models were just calling did_update anyway, which is
pointless since it can be unified to the base Model class. Instead, code
calling update() will now call invalidate(), which functions identically
and is more obvious in what it does.

Additionally, a default implementation is provided, which removes the
need to add empty implementations of update() for each model subclass.

Co-Authored-By: Ali Mohammad Pur <ali.mpfard@gmail.com>
2021-08-06 19:14:31 +02:00
Timothy
73c1b1617a Everywhere: Replace most cases of exit() with Application::quit()
Application::quit() is nicer for most cases where exit() is used. Cases
where exit() is used intentionally for early termination are left
intact.
2021-08-03 18:55:52 +02:00
Brian Gianforcaro
4374e1e213 Demos: Remove unused header includes 2021-08-01 08:10:16 +02:00
Andreas Kling
687a12d7fb Userland: Add GUI::Window::add_menu() and use it everywhere
Applications previously had to create a GUI::Menubar object, add menus
to it, and then call GUI::Window::set_menubar().

This patch introduces GUI::Window::add_menu() which creates the menubar
automatically and adds items to it. Application code becomes slightly
simpler as a result. :^)
2021-07-21 21:24:26 +02:00
Andreas Kling
c7d891765c LibGfx: Use "try_" prefix for static factory functions
Also mark them as [[nodiscard]].
2021-07-21 18:02:15 +02:00
Hendiadyoin1
ed46d52252 Everywhere: Use AK/Math.h if applicable
AK's version should see better inlining behaviors, than the LibM one.
We avoid mixed usage for now though.

Also clean up some stale math includes and improper floatingpoint usage.
2021-07-19 16:34:21 +04:30
Marcus Nilsson
22611ca136 WidgetGallery: Pledge thread
This is needed to use the file picker dialog.
2021-07-17 23:30:58 +02:00
Marcus Nilsson
57fc6eb9be WidgetGallery: Remove unused include 2021-07-17 23:30:58 +02:00
Daniel Bertalan
c6fafd3e90 AK+Userland: Add generic AK::abs() function and use it
Previously, in LibGFX's `Point` class, calculated distances were passed
to the integer `abs` function, even if the stored type was a float. This
caused the value to unexpectedly be truncated. Luckily, this API was not
used with floating point types, but that can change in the future, so
why not fix it now :^)

Since we are in C++, we can use function overloading to make things
easy, and to automatically use the right version.

This is even better than the LibC/LibM functions, as using a bit of
hackery, they are able to be constant-evaluated. They use compiler
intrinsics, so they do not depend on external code and the compiler can
emit the most optimized code by default.

Since we aren't using the C++ standard library's trick of importing
everything into the `AK` namespace, this `abs` function cannot be
exported to the global namespace, as the names would clash.
2021-07-08 10:11:00 +02:00
Andreas Kling
36cc011ae4 Fire: Make the main widget a GUI::Frame 2021-07-05 02:38:31 +02:00
Andreas Kling
782a5c88ce WindowServer: Make most remaining WindowServer IPC calls async
The only remaining sync call from client to server is now the call
that switches a window's backing store. That one actually relies on
the synchronization to hand over ownership of the backing stores,
so it has to stay synchronous for now.
2021-07-04 23:15:16 +02:00
Gunnar Beutner
631d36fd98 Everywhere: Add component declarations
This adds component declarations so that users can select to not build
certain parts of the OS.
2021-06-17 11:03:51 +02:00
Brian Gianforcaro
06ea31d0d5 CatDog: Enhance the speech bubble artificial intelligence
Enable cat dog to greet you, and help you with yak shave sessions.
2021-06-07 21:52:16 +02:00
Ali Mohammad Pur
51c2c69357 AK+Everywhere: Disallow constructing Functions from incompatible types
Previously, AK::Function would accept _any_ callable type, and try to
call it when called, first with the given set of arguments, then with
zero arguments, and if all of those failed, it would simply not call the
function and **return a value-constructed Out type**.
This lead to many, many, many hard to debug situations when someone
forgot a `const` in their lambda argument types, and many cases of
people taking zero arguments in their lambdas to ignore them.
This commit reworks the Function interface to not include any such
surprising behaviour, if your function instance is not callable with
the declared argument set of the Function, it can simply not be
assigned to that Function instance, end of story.
2021-06-06 00:27:30 +04:30
Stephan Unverwerth
10ceeb092f Everywhere: Use s.unverwerth@serenityos.org :^) 2021-05-29 12:30:08 +01:00
Linus Groh
d60ebbbba6 Revert "Userland: static vs non-static constexpr variables"
This reverts commit 800ea8ea96.

Booting the system no longer worked after these changes.
2021-05-21 10:30:52 +01:00
Lenny Maiorani
800ea8ea96 Userland: static vs non-static constexpr variables
Problem:
- `static` variables consume memory and sometimes are less
  optimizable.
- `static const` variables can be `constexpr`, usually.
- `static` function-local variables require an initialization check
  every time the function is run.

Solution:
- If a global `static` variable is only used in a single function then
  move it into the function and make it non-`static` and `constexpr`.
- Make all global `static` variables `constexpr` instead of `const`.
- Change function-local `static const[expr]` variables to be just
  `constexpr`.
2021-05-21 10:07:06 +01:00
Linus Groh
9dd3203cc6 LibGfx: Add missing TextAlignment::BottomLeft 2021-05-21 08:04:31 +02:00
Andreas Kling
8a6c37deef LibGfx: Remove Gfx::FontDatabase::default_bold_fixed_width_font()
Ask for a bold_variant() of the default_fixed_width_font() instead.
2021-05-20 20:55:29 +02:00
Andreas Kling
6a012ad79f LibGfx: Remove Gfx::FontDatabase::default_bold_font()
Instead use default_font().bold_variant() in cases where we want a bold
variant of the default font. :^)
2021-05-20 20:55:29 +02:00
Marcus Nilsson
41e74d4d31 CatDog: Don't show context menu when clicking outside of widget
The context menu for CatDog was shown when right clicking anywhere on
the screen because of global cursor tracking being enabled.
Also fix event not being passed by reference.

Fixes #7285
2021-05-19 23:14:07 +02:00
Erik Biederstadt
585e7890cd 3DFileViewer: Move Demos/GLTeapot to Applications/3DFileViewer
Also changes the category to `Graphics`
2021-05-19 19:34:12 +01:00
Erik Biederstadt
132ecfc47b GLTeapot: Adds a help menu to the GLTeapot demo
Having a help menu maintains better consistency with the other GUI apps
 on the system.
2021-05-19 19:34:12 +01:00
Erik Biederstadt
d9dc42fab5 GLTeapot: Adds additional error checking when loading files
- If the 3D file contains no vertices then an error is raised
- If the file is not an OBJ file then an error is raised
2021-05-19 19:34:12 +01:00
Erik Biederstadt
01a5ffdae0 GLTeapot: Add the ability to open 3D files
This change makes it possible for the GLTeapot demo to open any OBJ
file.
2021-05-19 19:34:12 +01:00
Marcus Nilsson
e5367c13d8 CatDog: Remove global menu and add context menu
There was no way to close catdog since it relied on global menus, this
adds a context menu for opening the about dialog and quitting.

Fixes #7252
2021-05-18 18:59:18 +01:00
Gunnar Beutner
92879383fb Mandelbrot: Export images in a fixed resolution
This makes the exported image independent from the current window size
and just always exports it at 1920x1080.
2021-05-18 16:01:32 +02:00
Gunnar Beutner
f2f728d39a Mandelbrot: Keep the aspect ratio when (re-)sizing the window
Previously the initial aspect ratio was incorrect and there was
nothing to ensure that the aspect ratio is kept when resizing the
window.
2021-05-18 16:01:32 +02:00
Gunnar Beutner
77bd3f75ce Mandelbrot: Add support for exporting the current image
Unfortunately this means unveil() won't work - at least until we get
something like FilePickerServer.
2021-05-18 16:01:32 +02:00
Gunnar Beutner
b429ee88f8 Mandelbrot: Implement color smoothing with gradients
This removes the color banding that happens for some of the
"outer" areas which all have the same iteration count.
2021-05-18 16:01:32 +02:00