summaryrefslogtreecommitdiff
path: root/Applications/PaintBrush
AgeCommit message (Collapse)Author
2020-02-02LibGUI: Put all classes in the GUI namespace and remove the leading GAndreas Kling
This took me a moment. Welcome to the new world of GUI::Widget! :^)
2020-02-02LibCore: Put all classes in the Core namespace and remove the leading CAndreas Kling
I've been wanting to do this for a long time. It's time we start being consistent about how this stuff works. The new convention is: - "LibFoo" is a userspace library that provides the "Foo" namespace. That's it :^) This was pretty tedious to convert and I didn't even start on LibGUI yet. But it's coming up next.
2020-02-02LibGUI: Add GHBoxLayout and GVBoxLayout convenience classesAndreas Kling
2020-01-21LibGUI: Import GColorPicker from the PaintBrush applicationAndreas Kling
2020-01-21PaintBrush: Show which line thickness is selected in the tool menusAndreas Kling
Put each tool's thickness altering actions into a GActionGroup and make them mutually exclusive so we get that nice radio button appearance. This all feel very clunky and we should move towards having something like a "tool settings" pane that gets populated by the currently active tool instead.
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2020-01-17Kernel: Add "accept" pledge promise for accepting incoming connectionsAndreas Kling
This patch adds a new "accept" promise that allows you to call accept() on an already listening socket. This lets programs set up a socket for for listening and then dropping "inet" and/or "unix" so that only incoming (and existing) connections are allowed from that point on. No new outgoing connections or listening server sockets can be created. In addition to accept() it also allows getsockopt() with SOL_SOCKET and SO_PEERCRED, which is used to find the PID/UID/GID of the socket peer. This is used by our IPC library when creating shared buffers that should only be accessible to a specific peer process. This allows us to drop "unix" in WindowServer and LookupServer. :^) It also makes the debugging/introspection RPC sockets in CEventLoop based programs work again.
2020-01-13Applications: Use pledge()Andreas Kling
Add some basic pledges to the following apps: - Calculator - DisplayProperties - FontEditor - HexEditor - PaintBrush
2020-01-02PaintBrush: Select tool button on context menu eventShannon Booth
This means that (for example) if you change the line width of the line tool, you now switch to the line tool, instead of sticking with the currently "checked" tool.
2019-12-29LibDraw+LibGUI: Allow changing individual colors in a PaletteAndreas Kling
Palette is now a value wrapper around a NonnullRefPtr<PaletteImpl>. A new function, set_color(ColorRole, Color) implements a simple copy-on-write mechanism so that we're sharing the PaletteImpl in the common case, but allowing you to create custom palettes if you like, by getting a GWidget's palette, modifying it, and then assigning the modified palette to the widget via GWidget::set_palette(). Use this to make PaintBrush show its palette colors once again. Fixes #943.
2019-12-27PaintBrush: Add an "ellipse tool"Shannon Booth
The tool currently supports drawing an elliptical line of a specified thickness. Further improvements can include adding a fill mode, and holding down shift to draw a perfect circle. Closes #375.
2019-12-26PaintBrush: Add a "rectangle tool"Shannon Booth
Fill, line, and gradient modes initially supported :^)
2019-12-25Build: support library and generator dependenciesjoshua stein
Instead of directly manipulating LDFLAGS, set LIB_DEPS in each subdirectory Makefile listing the libraries needed for building/linking such as "LIB_DEPS = Core GUI Draw IPC Core". This adds each library as an -L and -l argument in LDFLAGS, but also adds the library.a file as a link dependency on the current $(PROGRAM). This causes the given library to be (re)built before linking the current $(PROGRAM), but will also re-link any binaries depending on that library when it is modified, when running make from the root directory. Also turn generator tools like IPCCompiler into dependencies on the files they generate, so they are built on-demand when a particular directory needs them. This all allows the root Makefile to just list directories and not care about the order, as all of the dependency tracking will figure it out.
2019-12-24LibGUI+LibDraw: Add "Palette" concept for scoped color themingAndreas Kling
GApplication now has a palette. This palette contains all the system theme colors by default, and is inherited by a new top-level GWidget. New child widgets inherit their parents palette. It is possible to override the GApplication palette, and the palette of any GWidget. The Palette object contains a bunch of colors, each corresponding to a ColorRole. Each role has a convenience getter as well. Each GWidget now has a background_role() and foreground_role(), which are then looked up in their current palette when painting. This means that you no longer alter the background color of a widget by setting it directly, rather you alter either its background role, or the widget's palette.
2019-12-23WindowServer+LibGUI: Implement basic color themingAndreas Kling
Color themes are loaded from .ini files in /res/themes/ The theme can be switched from the "Themes" section in the system menu. The basic mechanism is that WindowServer broadcasts a SharedBuffer with all of the color values of the current theme. Clients receive this with the response to their initial WindowServer::Greet handshake. When the theme is changed, WindowServer tells everyone by sending out an UpdateSystemTheme message with a new SharedBuffer to use. This does feel somewhat bloated somehow, but I'm sure we can iterate on it over time and improve things. To get one of the theme colors, use the Color(SystemColor) constructor: painter.fill_rect(rect, SystemColor::HoverHighlight); Some things don't work 100% right without a reboot. Specifically, when constructing a GWidget, it will set its own background and foreground colors based on the current SystemColor::Window and SystemColor::Text. The widget is then stuck with these values, and they don't update on system theme change, only on app restart. All in all though, this is pretty cool. Merry Christmas! :^)
2019-12-20Build: clean up build system, use one shared Makefilejoshua stein
Allow everything to be built from the top level directory with just 'make', cleaned with 'make clean', and installed with 'make install'. Also support these in any particular subdirectory. Specifying 'make VERBOSE=1' will print each ld/g++/etc. command as it runs. Kernel and early host tools (IPCCompiler, etc.) are built as object.host.o so that they don't conflict with other things built with the cross-compiler.
2019-12-17PaintBrush: Shift key constrains LineTool angleZyper
Holding Shift key will constrain the LineTool's line angle to 15 degrees increments. Many graphics editors have similar feature.
2019-12-17PaintBrush: Tools can receive KeyUp eventsZyper
2019-12-09LibGUI: Make GMenu inherit from CObjectAndreas Kling
This is primarily to make it possible to pass a GMenu* where a CObject* is expected.
2019-11-29PaintBrush: Allow canceling a line by pressing the Escape keyAndreas Kling
Sometimes you change your mind mid-line, and just want to get out of the situation. You can now do that :^)
2019-11-29PaintBrush: Add a "line" tool for drawing straight linesAndreas Kling
This implements "preview" of the line by allowing tool subclasses to hook the second_paint_event on the PaintableWidget. Work towards #375.
2019-10-15PaintBrush: Use secondary color for eraser (like in ms_paint)Chyza
Comes with a checkbox to turn it off if you dislike it.
2019-10-01LibGUI+PaintBrush: Fix to GFilePicker and PaintBrush enhancements.Brandon Scott
GFilePicker - Fixed GFilePicker to use new ref-counted construct method to stop crashing on open dialog. - PaintBrush is still crashing on open dialog due to an unrelated issue. PaintBrush - Created 16x16 icon for PaintBrush - Moved Open option into App menu. - Changed help menu to make use of the standardized About dialog.
2019-09-30GMessageBox: Hide the constructor and fix broken usagesAndreas Kling
We no longer support creating CObjects on the stack. Use construct().
2019-09-22LibCore: Remove ObjectPtr in favor of RefPtrAndreas Kling
Now that CObject is fully ref-counted, just use RefPtr everywhere! :^)
2019-09-22LibCore: Make CObject reference-countedAndreas Kling
Okay, I've spent a whole day on this now, and it finally kinda works! With this patch, CObject and all of its derived classes are reference counted instead of tree-owned. The previous, Qt-like model was nice and familiar, but ultimately also outdated and difficult to reason about. CObject-derived types should now be stored in RefPtr/NonnullRefPtr and each class can be constructed using the forwarding construct() helper: auto widget = GWidget::construct(parent_widget); Note that construct() simply forwards all arguments to an existing constructor. It is inserted into each class by the C_OBJECT macro, see CObject.h to understand how that works. CObject::delete_later() disappears in this patch, as there is no longer a single logical owner of a CObject.
2019-09-21LibGUI: Convert custom widgets and subclasses to ObjectPtrAndreas Kling
2019-09-21GButton: Convert most code to using ObjectPtr for GButtonAndreas Kling
2019-09-21LibGUI: Convert GFrame to ObjectPtrAndreas Kling
2019-09-21LibGUI: Convert GWindow to ObjectPtrAndreas Kling
2019-09-21LibCore: Remove CTimer::create() overloads in favor of construct()Andreas Kling
2019-09-21LibGUI: Convert GWidget to ObjectPtrAndreas Kling
2019-09-21LibGUI: Convert GSpinBox to ObjectPtrAndreas Kling
2019-09-20GCommonActions: Add "Open..." actionAndreas Kling
Make use of this in PaintBrush and TextEditor. :^)
2019-09-20LibCore: Convert CTimer to ObjectPtrAndreas Kling
2019-09-14LibGUI: Simplify GCommonActions a bitAndreas Kling
Use the same callback signature as GAction so we can just forward it to GAction instead of chaining callbacks.
2019-09-13GMenu: Update apps now that you can create a nameless GMenuAndreas Kling
We had many context menus with names, simply because you were forced to give them names.
2019-09-12PaintBrush: Only send left and right mouse button events to toolsAndreas Kling
Tools don't know what to do with the middle mouse button anyway, so it's better if we just don't pass it along. Fixes #546.
2019-09-05PaintBrush: Added GCommonActionsrhin123
2019-07-25LibCore: Introduce a C_OBJECT macro.Andreas Kling
This macro goes at the top of every CObject-derived class like so: class SomeClass : public CObject { C_OBJECT(SomeClass) public: ... At the moment, all it does is create an override for the class_name() getter but in the future this will be used to automatically insert member functions into these classes.
2019-07-23LibGUI: Get rid of GWindow::should_exit_event_loop_on_close().Andreas Kling
This behavior and API was extremely counter-intuitive since our default behavior was for applications to never exit after you close all of their windows. Now that we exit the event loop by default when the very last GWindow is deleted, we don't have to worry about this.
2019-07-23PaintBrush: Exit the event loop on main window close.Andreas Kling
2019-07-20GWidget: Add set_preferred_size(width, height) overload.Andreas Kling
It was annoying to always write set_preferred_size({ width, height }). :^)
2019-07-18LibDraw: Introduce (formerly known as SharedGraphics.)Andreas Kling
Instead of LibGUI and WindowServer building their own copies of the drawing and graphics code, let's it in a separate LibDraw library. This avoids building the code twice, and will encourage better separation of concerns. :^)
2019-07-16LibGUI: Add input types to GMessageBox.Andreas Kling
Currently the two available input types are: - GMessageBox::InputType::OK (default) - GMessageBox::InputType::OKCancel Based on your choice, GMessageBox::exec() will return ExecOK or ExecCancel.
2019-07-08StringView: Rename characters() to characters_without_null_termination().Andreas Kling
This should make you think twice before trying to use the const char* from a StringView as if it's a null-terminated string.
2019-06-30Meta: Removed all gitignore in the source tree only keeping the root oneVAN BOSSUYT Nicolas
2019-06-30PaintBrush: Make a little icon for the eraser tool.Andreas Kling
2019-06-30GUI: Use Win2K-like "warm gray" color instead of the older colder gray.Andreas Kling
Someone suggested this a long time ago and I never got around to it. So here we go, here's the warm gray! I have to admit I like it better. :^)
2019-06-28PaintBrush: Add size context menu to SprayToolRobin Burchell