Commit graph

13117 commits

Author SHA1 Message Date
AnotherTest
cd0ddf27f3 Shell: Allow builtins and functions as conditions for 'if' 2020-09-14 17:40:18 +02:00
AnotherTest
2b867ff555 Shell: Complete named function parameters inside the function body 2020-09-14 17:40:18 +02:00
AnotherTest
b4da45ab76 Shell: Add documentation for functions 2020-09-14 17:40:18 +02:00
AnotherTest
b7661dee46 Shell: Add some tests for functions 2020-09-14 17:40:18 +02:00
AnotherTest
d1550ea64f Shell: Add support for functions
This implementation does not have support for 'return' yet.
2020-09-14 17:40:18 +02:00
AnotherTest
519aa2048a Shell: Use a subshell instead of explicitly calling a shell binary in a test
This commit fixes a FIXME in a test, as we have subshells now.
2020-09-14 17:40:18 +02:00
AnotherTest
0b57cdff82 Shell: Add support for $0,$1,... 2020-09-14 17:40:18 +02:00
Andreas Kling
2f97590409 Meta: Make the text-to-cpp-string thingy pass shellcheck 2020-09-14 16:33:53 +02:00
Andreas Kling
22b03dd11b LibGUI: Add registration for GUI::TabWidget 2020-09-14 16:23:39 +02:00
Andreas Kling
f67c876df0 Build+TextEditor: Add a compile_json_gui() CMake helper
This makes it easier to include JSON GUI declarations in any app. :^)
2020-09-14 16:16:36 +02:00
Andreas Kling
119a0c5dee TextEditor: Move the find/replace buttons to JSON GUI 2020-09-14 16:16:36 +02:00
Andreas Kling
093de0e323 LibGUI: Use Core::Object::set_property() to handle JSON GUI properties
Piggyback on the existing mechanism to set individual properties.
This doesn't cover layouts or child widgets, but the per-widget own
properties can be set this way.

Any property can now be set in JSON GUI, all you need to do is handle
it in the relevant Core::Object::set_property() override. :^)
2020-09-14 16:16:36 +02:00
Andreas Kling
89822c5ae7 TextEditor: Set initial widget visibilities from JSON 2020-09-14 16:16:36 +02:00
Andreas Kling
6fc8dedd28 LibGUI: Allow setting widget visibility from JSON GUI spec 2020-09-14 16:16:36 +02:00
Andreas Kling
8a7935a29f TextEditor: Move the "find" and "replace" widget containers to JSON GUI 2020-09-14 16:16:36 +02:00
Andreas Kling
6590eb8eb7 LibGUI: Complain about malformed "layout" values in JSON GUI 2020-09-14 16:16:36 +02:00
Andreas Kling
aa3c28957a LibCore: Include object names in Object::dump_tree() output 2020-09-14 16:16:36 +02:00
Andreas Kling
2e547ce7a3 TextEditor: Move the main window UI to JSON
This is our first client of the new JSON GUI declaration thingy.
The skeleton of the TextEditor app GUI is now declared separately from
the C++ logic, and we use the Core::Object::name() of widgets to locate
them once they have been instantiated by the GUI builder.
2020-09-14 16:16:36 +02:00
Andreas Kling
40892ac72e Meta: Add helper for generating a C++ string from a text file 2020-09-14 16:16:36 +02:00
Andreas Kling
ea17b0cbb6 LibGUI: Start building a way to instantiate GUI from JSON
My original idea for GUI building tools was to have the "VisualBuilder"
app generate C++ code which in turn programmatically instantiated UI.
That never really materialized in any useful way beyond static UIs.

This is a fresh, new approach: using JSON to declare the UI and parsing
and constructing this UI at runtime. This will allow for way more
dynamic and flexible approaches to GUI development (I think.)

The basic idea is that you pass a JSON string to Widget::load_from_json
and it takes care of the rest.

This first version supports basic box layouts and instantiation of
arbitrary widgets, as long as those widgets have been registered.

This code has some pretty rough edges right now as it's evolving and
we need to figure out a lot of things about how it should work.
Nevertheless, it feels pretty cool. :^)
2020-09-14 16:16:36 +02:00
Andreas Kling
c7133bf081 LibWeb: Register the InProcessWebView widget 2020-09-14 16:16:36 +02:00
Andreas Kling
3c580233d1 LibGUI: Improve widget registration mechanism a bit
Allow registering widgets from namespaces other than GUI. :^)
Also add a few widgets.
2020-09-14 16:16:36 +02:00
Ben Wiederhake
3ab706cac3 Travis: Strip every executable
This cuts down the size of a Toolchain cache entry by another quarter.
(About 250 MiB to about 190 MiB).
2020-09-14 11:40:48 +02:00
Ben Wiederhake
f067fb0aef Travis: Switch to Ubuntu Focal 2020-09-14 11:40:48 +02:00
Tibor Nagy
bb22b143d5 Base: Move be.json to the correct subfolder 2020-09-14 11:40:03 +02:00
Tom
f5330304a4 Kernel: Stop back trace on a null base pointer
This silences some warnings trying to copy from null when capturing
a stack trace.
2020-09-14 11:31:12 +02:00
Andreas Kling
ad7030ce4a HackStudio: Tighten some unnecessarily broad lambda captures 2020-09-13 21:52:37 +02:00
Andreas Kling
67dca51f47 FileManager: Use the correct delete action in the treeview context menu 2020-09-13 21:48:16 +02:00
Andreas Kling
ef50e5aaee FileManager: Move delete and force-delete actions to DirectoryView
This is a little bit messy since the left-side treeview also has a
delete action. Because of that, we have to put a focus-dependent action
that delegates to the relevant view-specific action in the tool bar
and menu bar.

I'm not sure yet what a good abstraction would be for this. We'll see
what we can think of.
2020-09-13 21:41:45 +02:00
Andreas Kling
174527b580 KeyboardMapper: Avoid using [&] captures for persistent lambdas
These are not bugfixes, just improving the hygiene.
2020-09-13 21:41:45 +02:00
Andreas Kling
825fcb8292 FileManager: Move "Open Terminal here" action to DirectoryView 2020-09-13 21:41:45 +02:00
Andreas Kling
609108f6b3 LibGfx: Remove unused file FloatPoint.h 2020-09-13 21:41:45 +02:00
Andreas Kling
b78e13cf2e LibGUI: Make some GUI event getters return const references
There's no good reason to return rects/sizes/positions by value.
2020-09-13 21:41:45 +02:00
Tom
c8d9f1b9c9 Kernel: Make copy_to/from_user safe and remove unnecessary checks
Since the CPU already does almost all necessary validation steps
for us, we don't really need to attempt to do this. Doing it
ourselves doesn't really work very reliably, because we'd have to
account for other processors modifying virtual memory, and we'd
have to account for e.g. pages not being able to be allocated
due to insufficient resources.

So change the copy_to/from_user (and associated helper functions)
to use the new safe_memcpy, which will return whether it succeeded
or not. The only manual validation step needed (which the CPU
can't perform for us) is making sure the pointers provided by user
mode aren't pointing to kernel mappings.

To make it easier to read/write from/to either kernel or user mode
data add the UserOrKernelBuffer helper class, which will internally
either use copy_from/to_user or directly memcpy, or pass the data
through directly using a temporary buffer on the stack.

Last but not least we need to keep syscall params trivial as we
need to copy them from/to user mode using copy_from/to_user.
2020-09-13 21:19:15 +02:00
Tom
7d1b8417bd Kernel: Add safe_memcpy, safe_memset and safe_strnlen
These special functions can be used to safely copy/set memory or
determine the length of a string, e.g. provided by user mode.

In the event of a page fault, safe_memcpy/safe_memset will return
false and safe_strnlen will return -1.
2020-09-13 21:19:15 +02:00
Linus Groh
1c86ab0108 Base: Make I-Beam cursor 4px smaller
Fixes #3475.
2020-09-13 20:08:09 +02:00
Linus Groh
e9562e1920 Userland: Add {md5,sha1,sha256,sha512}sum 2020-09-13 11:37:56 +02:00
Nico Weber
a6734766ec Terminal: Make sure empty hrefs set a null string on Attribute
Else, we store an empty but allocated string for each Attribute after a
href was emitted (since it's ended by a non-null empty string), which
makes Line objects very expensive to destroy and to modify.

Reduces `disasm /bin/id` from 414ms to 380ms (min-of-5). There's
a lot more perf wins to be had with better href handling (most
lines don't have any hrefs, so instead of storing a string per
Attr, maybe we could have a vector of hrefs per line and int offsets
into that in each Attr for example), but this is a simple, obvious,
and effective improvement, so let's start with this.
2020-09-13 11:34:49 +02:00
AnotherTest
063fb02ef4 Shell: Move the first command in a pipeline to the pipeline pgid too
This process is supposed to be the session leader of the pipeline
process group, we can't *not* move it into that group :P
2020-09-12 21:18:24 +02:00
Peter Nelson
d366e996dd LibGfx: restructure Bitmap ctor to expect an alloc'd backing store
Moves Bitmap backing store creation to the static create() methods.
This backing store is then passed into the Bitmap constructor. This
allows us correctly return nullptr from create() in the event that
memory allocation fails.
2020-09-12 20:26:14 +02:00
Peter Nelson
06eea59a65 LibGfx: return clone from frame() instead of underlying framebuffer
This prevents frame() from modifying the contents of the same bitmap
that was returned from previous calls to frame()
2020-09-12 20:26:14 +02:00
Peter Nelson
9494b03a02 LibWeb: cache in-process decoded images in ImageResource
Otherwise cloned Bitmaps returned by the decoder will be prematurely
freed
2020-09-12 20:26:14 +02:00
Peter Nelson
16ebbde26f LibGfx: add Bitmap::clone() method 2020-09-12 20:26:14 +02:00
Andreas Kling
f470657d57 LibWeb: Fix layout of replaced with width:auto + no intrinsic ratio
We can't compute width based on the intrinsic ratio if we have no
intrinsic ratio! The comment was correct, the code was not.
2020-09-12 18:18:20 +02:00
Andreas Kling
cd5570670c LibWeb: Implement <input type=submit> without using LibGUI
Following in the footsteps of <input type=checkbox>, this patch adds
LayoutButton which implements a basic push button using LibGfx styling
primitives.
2020-09-12 18:18:20 +02:00
Andreas Kling
94c55d9e37 LibWeb: Two mouse event handling fixes
- After letting a LayoutNode handle a mouseup, re-do the hit test
  since things may have changed.
- Make sure we always update the document's hovered node.
2020-09-12 17:55:19 +02:00
AnotherTest
d103686261 Spreadsheet: Implement a specialised version of printf for formatting
Now all format values will format a single double, cast to the
appropriate types.
2020-09-12 15:01:19 +02:00
AnotherTest
c2228b669d Spreadsheet: Allow customising the cell foreground and background colors 2020-09-12 15:01:19 +02:00
AnotherTest
8fa385f774 Spreadsheet: Allow cells to optionally have static fg/bg colors 2020-09-12 15:01:19 +02:00
AnotherTest
1674903dcc AK: Fix PrintfImplementation "%x" handling for u32
This also fixes an issue with the color input value being messed up.
oops :P
2020-09-12 15:01:19 +02:00