Age | Commit message (Collapse) | Author |
|
|
|
These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.
|
|
...as well as the few remaining references to set_foreground_color().
These properties are not being used for rendering anymore, presumably
because they completely mess up theming - assigning random white and
gray backgrounds just doesn't work with dark themes.
I've chosen to not replace most of the few remaining uses of this
broken functionality with custom palette colors (the closest
replacement is background_role) for now (except for Minesweeper where
squares with mines are painted red again now), as no one has actually
complained about them being broken, so it must look somewhat decent
(some just look right anyway). :^)
Examples of this are the taskbar buttons, which apparently had a
DarkGray foreground color for minimized windows once - this has since
been replaced with bold/regular font. Another one is the Profiler's
ProfileTimelineWidget, which is supposed to have a white background -
which it didn't have for quite some time, it's grey now (with the
default theme, that is). Doesn't look bad either.
|
|
This patch removes size policies and preferred sizes, and replaces them
with min-size and max-size for each widget.
Box layout now works in 3 passes:
1) Set all items (widgets/spacers) to their min-size
2) Distribute remaining space evenly, respecting max-size
3) Place widgets one after the other, adding spacing in between
I've also added convenience helpers for setting a fixed size (which is
the same as setting min-size and max-size to the same value.)
This significantly reduces the verbosity of widget layout and makes GML
a bit more pleasant to write, too. :^)
|
|
|
|
This fits nicer with FloatRect,FloatPoint,FloatSize and gives a much
better visual clue about what type of metric is being used.
|
|
This will allow you us to implement special behavior when Ctrl+clicking
a button.
|
|
There was but a single user of this parameter and it's a bit tedious
to write it out every time, so let's get rid of it.
|
|
This addresses the issue found in #1261. Previously we weren't doing
any form of sanity checking on the values in the configuration file,
meaning that a user could input a ridiculous number of mines such that
the number of mines is larger than the number of squares on the field.
|
|
|
|
|
|
|
|
The overwhelming majority of GUI::Frame users set the same appearance,
so let's just make it the default.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
I started adding things to a Draw namespace, but it somehow felt really
wrong seeing Draw::Rect and Draw::Bitmap, etc. So instead, let's rename
the library to LibGfx. :^)
|
|
This took me a moment. Welcome to the new world of GUI::Widget! :^)
|
|
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.
|
|
|
|
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.
|
|
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.
|
|
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! :^)
|
|
|
|
|
|
We manage the checked state of these buttons manually in the code, and
we don't want the user to interfere with it, which would be possible if
we put them in checkable state.
|
|
Both on_square_clicked and flood_mark were very similar so I've
introduced the on_square_clicked_impl function which is now
called by on_square_clicked and flood_fill.
|
|
|
|
This change uses an iterative traversal to avoid stack overflows
in, the previously recursive, flood_fill.
|
|
It was annoying to always write set_preferred_size({ width, height }). :^)
|
|
|
|
Instead of manually doing String::format("%d"/"%u") everywhere, let's have
a String API for this. It's just a wrapper around format() for now, but it
could be made more efficient in the future.
|
|
This makes more sense as it's where configuration writing happens.
|
|
This is how other Minesweeper games I've played usually behave.
Single-click chording can be disabled from the menu or config file.
|
|
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. :^)
|
|
|
|
Rather than having the first click hit a bomb, if the first click would
hit a bomb, instead, reset the game board.
This is a (sort of) feature of Windows minesweeper, and IMO makes
playing a bit more fun :-)
|
|
|
|
Use a number of techniques to avoid freezing the UI for too long.
- Keep reusing the same widgets for the squares once they've been created.
- Temporarily disable widget updates.
- Avoid some redundant work on each run of reset().
|
|
This is useful in the harder modes, for trying out different possibilities.
|
|
Someone was playing this game and suggested a number of improvements so here
we go trying to address them:
- Add "chording" support, where you can click a numbered square using both
mouse buttons simultaneously to sweep all non-flagged adjacent squares.
- Mis-flagged squares are now revealed as such on game over, with a special
"bad flag" icon.
- The game timer now shows tenths of seconds. It also doesn't start until
you click the first square.
- Add the three difficulty modes from the classic Windows version.
|
|
|
|
|
|
You open the configuration for an app like so:
auto config = CConfigFile::get_for_app("MyApp");
This will then open ~/MyApp.ini and parse it for you.
Immediately start using it in Minesweeper to load the field size and mine
count from a config file.
|
|
|
|
|