Commit graph

414 commits

Author SHA1 Message Date
joshua stein ac25438d54 Build: clean up build system, use one shared Makefile
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-20 20:20:54 +01:00
Ohad Rau 3809da4abb ProfileViewer: Make initial invert checkbox match initial tree view
The "Invert tree" checkbox was accidentally defaulted to display true when the actual tree wasn't being inverted, causing the checkbox to say the opposite of the tree state initially. This change just brings the visual indicator in line with what the code is actually doing.
2019-12-17 07:25:50 +01:00
Andreas Kling 3b76f2502a ProfileViewer: Ignore empty samples
Sometimes we get empty samples in a profile. I'm not sure why that
happens, but let's just ignore them for now.
2019-12-16 20:38:30 +01:00
Andreas Kling fe421bd7b4 ProfileViewer: Add the ability to invert the profile tree
Inverting the tree turns all of the innermost stack frames into roots,
allowing them to accumulate their total sample counts with other
instances of the same frame being innermost. This is an essential
feature of any cool profiler, and now we have it. :^)
2019-12-16 18:26:24 +01:00
Andreas Kling 648ed76085 ProfileViewer: Add a basic menu bar to make it look proper 2019-12-15 22:55:11 +01:00
Andreas Kling be0b527cfc ProfileViewer: Scale the sample columns by stack depth
From a nice suggestion by Nagy Tibor. :^)
2019-12-15 18:11:10 +01:00
Andreas Kling 063fef312e ProfileViewer: Convert the JSON samples into a more efficient format
Only do the conversion from JSON once. This makes it much faster to do
time range filtering with the timeline widget. :^)
2019-12-15 17:26:54 +01:00
gla3dr 12cc518d1e ProfileViewer: Fix copy-paste error :^)
Saw this copy-paste mistake in the ProfileViewer Timeline video
2019-12-15 10:11:48 +01:00
Andreas Kling 4d6968f95d ProfileViewer: Precompute the timestamp and "in kernel?" per sample
Instead of fetching these from JSON in every paint event, we now have a
separate "SampleData" vector that can be iterated.

This optimization was made possible by profiling ProfileViewer and then
analyzing the profile with ProfileViewer! :^)
2019-12-14 19:25:33 +01:00
Andreas Kling 3fd2304dad ProfileViewer: Allow filtering samples in a specific time range
You can now select the time range you want on the profile timeline.
The tree view will update automatically as you alter the range.

Unfortunately this causes the treeview to collapse all of its nodes.
It would be nice to solve this somehow in the future so that nodes
can stay open.
2019-12-14 19:10:12 +01:00
Andreas Kling a3e7c99ffe ProfileViewer: Add a timeline widget for a visual view of the profile
Userspace stack frames are in blue, kernel stack frames in red :^)
2019-12-14 18:44:29 +01:00
Andreas Kling 46a57c7f59 IPCCompiler: Use const references for message constructor parameters 2019-12-14 16:17:00 +01:00
Andreas Kling e4267020c4 ProfileViewer: Show kernel frames with a red icon :^) 2019-12-14 16:16:53 +01:00
Andreas Kling 5cd4fb4db2 ProfileViewer: Use the new multi-column tree model support in GTreeView
Put the sample count into a separate column. This is so neat :^)
2019-12-13 23:42:29 +01:00
Andreas Kling 9150be4716 ProfileViewer: Make sure ProfileNodes have the correct parent pointer
We were forgetting to call ProfileNode::add_child() which is how the
parent node pointer gets set. This fixes the weird looking GTreeView.
2019-12-12 22:51:08 +01:00
Andreas Kling 19d8c675f1 ProfileViewer: Begin work on a visualization tool for profiles :^)
We begin with a simple treeview that shows a recorded profile.
To record and view a profile of a process with <PID>, simply do this:

$ profile <PID> on
... wait while PID does something interesting ...
$ profile <PID> off
$ cat /proc/profile > my-profile.prof
$ ProfileViewer my-profile.prof
2019-12-12 22:01:06 +01:00
Andreas Kling 7f8e9a0f55 HackStudio: Use a table view in the "find in files" widget
Make the results of a "find in files" operation look a lot nicer by
presenting them in a table format, instead of in a single-column list.

Since we don't yet support rich text in table view cells, use the
marker glyphs in the system default fixed-width font to show where the
matched text begins and ends on the line we found it on. :^)
2019-12-10 22:07:52 +01:00
Andreas Kling fd5eb79d19 LibGUI: Make GMenu inherit from CObject
This is primarily to make it possible to pass a GMenu* where a CObject*
is expected.
2019-12-09 21:05:44 +01:00
Andreas Kling 6f4c380d95 AK: Use size_t for the length of strings
Using int was a mistake. This patch changes String, StringImpl,
StringView and StringBuilder to use size_t instead of int for lengths.
Obviously a lot of code needs to change as a result of this.
2019-12-09 17:51:21 +01:00
Andreas Kling 8ae62c57ee LibIPC: Rename IMessage id/name to message_id/message_name
Hogging "id" and "name" makes it impossible to use these as message
parameter names, which seems silly. :^)
2019-12-02 11:11:05 +01:00
Andreas Kling 272d65e3e2 WindowServer: Port to the new IPC system
This patch introduces code generation for the WindowServer IPC with
its clients. The client/server endpoints are defined by the two .ipc
files in Servers/WindowServer/: WindowServer.ipc and WindowClient.ipc

It now becomes significantly easier to add features and capabilities
to WindowServer since you don't have to know nearly as much about all
the intricate paths that IPC messages take between LibGUI and WSWindow.

The new system also uses significantly less IPC bandwidth since we're
now doing packed serialization instead of passing fixed-sized structs
of ~600 bytes for each message.

Some repaint coalescing optimizations are lost in this conversion and
we'll need to look at how to implement those in the new world.

The old CoreIPC::Client::Connection and CoreIPC::Server::Connection
classes are removed by this patch and replaced by use of ConnectionNG,
which will be renamed eventually.

Goodbye, old WindowServer IPC. You served us well :^)
2019-12-02 11:11:05 +01:00
Sasan Hezarkhani 30db7813de HackStudio: Fixes CppLexer crashing on a comment block that does
not end.

CppLexer expected that `/*` always has `*/` at the end. This PR
fixes the issue and assumes the rest of file is a comment.
2019-12-02 09:23:47 +01:00
Andreas Kling 712ae73581 Kernel: Expose per-thread information in /proc/all
Previously it was not possible to see what each thread in a process was
up to, or how much CPU it was consuming. This patch fixes that.

SystemMonitor and "top" now show threads instead of just processes.
"ps" is gonna need some more fixing, but it at least builds for now.

Fixes #66.
2019-11-26 21:37:30 +01:00
Andreas Kling 0d2659c0a2 LibHTML: Use LibProtocol for HTTP requests :^)
This moves all of the browser networking to ProtocolServer.
2019-11-24 14:24:59 +01:00
Andreas Kling dc9d44d7b1 IPCCompiler: Add support for String parameters in messages 2019-11-23 21:44:00 +01:00
Andreas Kling 8f9a522c37 HackStudio: Highlight matching pairs of [ and ] as well
Also refactor the token pair matching code a little bit to not repeat
ourselves so much. :^)
2019-11-23 17:49:14 +01:00
Andreas Kling 630d5b3ffd LibIPC+AudioServer: Allow unsolicited server-to-client IPC messages
Client-side connection objects must now provide both client and server
endpoint types. When a message is received from the server side, we try
to decode it using both endpoint types and then send it to the right
place for handling.

This now makes it possible for AudioServer to send unsolicited messages
to its clients. This opens up a ton of possibilities :^)
2019-11-23 16:50:21 +01:00
Andreas Kling 15fb341eb4 HackStudio: Always re-match curlies/parens after a re-highlight
While you are typing in HackStudio, we re-lex the C++ as you type,
so this means we also need to keep re-checking for matching curlies and
parentheses at the cursor.

Fixes #769 (although it's not optional, because it's too cool. :^)
2019-11-18 19:21:18 +01:00
Andreas Kling d5afc58744 HackStudio: Highlight maching parentheses as well
This can just piggyback on the code I just wrote for curly braces.
2019-11-18 19:13:46 +01:00
Andreas Kling c8e02e60a6 HackStudio+LibGUI: Implement matching curly brace highlighting
This works for C++ syntax highlighted text documents by caching the C++
token type in a new "arbitrary data" member of GTextDocumentSpan.

When the cursor is placed immediately before a '{' or immediately after
a '}', we highlight both of these brace buddies by changing their
corresponding spans to have a different background color.

..and spans can also now have a custom background color. :^)
2019-11-18 19:10:06 +01:00
Andreas Kling 6685be36a0 LibDraw: Add Rect::from_two_points(Point, Point)
This returns the rectangle between two given Points. Thanks Owlinator
for suggesting this much easier way of doing it :^)
2019-11-17 16:37:42 +01:00
Andreas Kling 197ed1bb2a HackStudio: Move the rubber-banding state into CursorTool
I originally put it in FormWidget because CursorTool was clueless about
painting. This patch adds Tool::on_second_paint() which allows all the
tools to hook into the second paint pass.
2019-11-16 22:26:46 +01:00
Andreas Kling 5fc62bcf68 HackStudio: Fill the selection rubber-band with some nice alpha color
Make use of the new alpha support in Painter::fill_rect() to fill the
rubber band with some see-through color. :^)
2019-11-16 19:31:57 +01:00
Andreas Kling 69dee20761 HackStudio: Allow rubber-band selection of widgets
This patch implements basic rubber-banding. Perhaps this mechanism can
be generalized somehow, but it's not clear to me how that would work
at the moment.
2019-11-16 19:17:27 +01:00
Andreas Kling 834eff7983 HackStudio: Mark whitespace tokens as skippable GTextDocumentSpans
This makes Ctrl+Left/Right jump over whitespace, which feels nice :^)
2019-11-15 21:03:22 +01:00
Sergey Bugaev c6a8b95643 HackStudio: Add a Stop action to kill the current process
Also give the Run action a different icon that has the same style
as the stop icon that's now alongside it.

Closes https://github.com/SerenityOS/serenity/issues/771
2019-11-14 20:10:16 +01:00
Sergey Bugaev 1f5001c581 HackStudio: Do not spawn an intermediary shell
The Shell also puts each command into its own process group,
which interferes with us trying to do the same here. We don't
really need the shell here anyway, but it means we'll have to
do command splitting ourselves.
2019-11-14 20:10:16 +01:00
Sergey Bugaev 8484635920 HackStudio: Add TerminalWrapper::kill_running_command()
Also put our child process into a new process group in order to be
able to kill it along with its own children.
2019-11-14 20:10:16 +01:00
Sergey Bugaev cd11a8597a HackStudio: Add TerminalWrapper::on_command_exit 2019-11-14 20:10:16 +01:00
Andreas Kling 69ca9cfd78 LibPthread: Start working on a POSIX threading library
This patch adds pthread_create() and pthread_exit(), which currently
simply wrap our existing create_thread() and exit_thread() syscalls.

LibThread is also ported to using LibPthread.
2019-11-13 21:49:24 +01:00
Sergey Bugaev d3504b4f9b Terminal+HackStudio: Fix leaking PTM fd to child processes
The pseudoterminal *master* fd is not supposed to be inherited,
so make sure to open it with O_CLOEXEC.
2019-11-13 16:37:04 +01:00
Andreas Kling 2fea238675 HackStudio: Reflect widget selections in the form widget tree view
You can now manipulate the widget selection either by clicking and
dragging the widgets using the cursor tool, or by interacting with
the form widget tree view. :^)
2019-11-11 22:20:02 +01:00
Andreas Kling d5f735ecec HackStudio: Show the edited form widget's widget tree in the tree view
This patch introduces a simple WidgetTreeModel that models the widget
tree inside of a given root GWidget.
2019-11-11 22:20:02 +01:00
Andreas Kling 6dab257a45 HackStudio: Make the widget toolbar buttons checkable and exclusive
This way you can see which tool you've currently got selected, and it
doesn't let you select more than one at once.
2019-11-10 22:50:30 +01:00
Andreas Kling c8637e0206 HackStudio: Allow moving the selected widgets using the arrow keys
This is a nice complement to moving widgets with the mouse. :^)
2019-11-10 22:40:58 +01:00
Andreas Kling 567769eb2f HackStudio: Allow moving widgets around using the CursorTool
You can now move the widgets around, either by themselves or in group
selections, by dragging them with the cursor tool. :^)
2019-11-10 22:31:10 +01:00
Andreas Kling f6576c4b7c HackStudio: Start implementing basic widget selection in CursorTool
You can now select widgets by clicking on them with the CursorTool,
and toggle the selection state of a widget by Ctrl+clicking it.
2019-11-10 22:03:39 +01:00
Andreas Kling e87756424d HackStudio: Introduce a Tool class with subs CursorTool and WidgetTool
These will be used to draw out new widgets on a FormWidget, or in the
case of CursorTool, to select and manipulate existing widgets.
2019-11-10 21:45:32 +01:00
Andreas Kling a04ab219d1 HackStudio: Use a visually distinct icon for the cursor tool
Using the default cursor bitmap as the cursor tool icon in HackStudio
was predictably making it impossible to tell if it's the real cursor
or not. Replace it with a color-inverted cursor. :^)
2019-11-10 21:19:08 +01:00
Andreas Kling f92e0f7d80 HackStudio: Add placeholder code to test widget factory construction
We now use the magical widget registry to factory-construct widgets and
place them into the form.

This will need all kinds of work, but it's nice that the mechanism is
working as intended.
2019-11-10 12:57:37 +01:00
Andreas Kling 2da058c7f2 HackStudio: Use the GWidget class registry to populate the toolbar
This will allow HackStudio to learn about new GWidget types without
having to do anything in HackStudio :^)
2019-11-10 12:57:37 +01:00
Andreas Kling 3e84ea9a53 HackStudio: Add panes on the right hand side of the form editing mode
- Form's widget tree pane (GTreeView)
- Selected widget's properties pane (GTableView)
2019-11-09 00:41:00 +01:00
Andreas Kling c9fc34f5ff HackStudio: Tweak the inset of the FormWidget
This is not permanent by any means, just moving things around to get
a feel for how the GUI should look.
2019-11-09 00:41:00 +01:00
Andreas Kling 803ebdfe9c HackStudio: Make the FormEditorWidget have a MidGray background
This gives the form editor a VB6-like feeling :^)
2019-11-09 00:41:00 +01:00
Andreas Kling 489c6ac05c HackStudio: Add a widgets toolbar to the form editing mode 2019-11-09 00:41:00 +01:00
Andreas Kling d016d5e365 HackStudio: Start fleshing out the GUI for a GUI designer :^)
I'll be reconstructing parts of the VisualBuilder application here and
then we can retire VisualBuilder entirely once all the functionality
is available in HackStudio.
2019-11-09 00:41:00 +01:00
Andreas Kling d6c0d32b63 HackStudio: Make the project file list a little narrower by default 2019-11-07 21:06:31 +01:00
Andreas Kling 794f2d5645 LibHTML: Rename parse_html() => parse_html_document() 2019-11-06 20:52:18 +01:00
Andreas Kling f5cf8d4ad8 Revert "LibHTML: Rename parse_html() => parse_html_document()"
This reverts commit f6439789db.
Oops, I committed unrelated changes here, let me clean that up..
2019-11-06 20:51:07 +01:00
Andreas Kling f6439789db LibHTML: Rename parse_html() => parse_html_document() 2019-11-06 20:31:56 +01:00
Andreas Kling 2755184e11 HackStudio: Update the "remove current editor" action enabled state
This action should not be enabled when there is only one editor open,
since you are not allowed to be editor-less.
2019-11-05 21:08:17 +01:00
Andreas Kling cb627a3ada HackStudio: Allow removing the current editor with Alt+Shift+E
Note that you are not allowed to remove the very last editor.

These keybinds are all temporary while I figure out what the right ones
should be. I'm not exactly sure how, but it'll reveal itself. :^)
2019-11-05 21:02:31 +01:00
Andreas Kling 538d5f82c1 HackStudio: Allow switching between editors with Ctrl+E / Ctrl+Shift+E 2019-11-05 20:56:36 +01:00
Andreas Kling f844715106 HackStudio: Allow adding more editors by pressing Ctrl+Alt+E
We also now start out with a single editor, instead of two. :^)
2019-11-05 20:56:30 +01:00
Andreas Kling 0f81eaf8a2 HackStudio: Put annoying debug spam behind EDITOR_DEBUG 2019-11-05 20:09:06 +01:00
João Paulo Pulga 4d3be45ff4 HackStudio: Don't parse documentation if already parsed 2019-11-05 07:06:15 +01:00
Andreas Kling 390b219cd1 HackStudio: Use GTextDoument::find_all() to implement find-in-files
This fixes the bug seen in my monthly OS update video, where we'd look
through a stale copy of each file, instead of the potentially edited
version in the GTextDocument.

Search results are now also represented as a full GTextRange, and when
you jump to a search result, we select the whole matching range. :^)
2019-11-01 21:31:06 +01:00
Andreas Kling b81f6f2c43 HackStudio: Rename TextDocument => ProjectFile
TextDocument was not the right name, and got even more confusing with
the addition of GTextDocument in LibGUI.
2019-11-01 21:31:06 +01:00
Andreas Kling 7c71040ba9 HackStudio: Show documentation preview in tooltip on identifier hover
When hovering over a C++ token that we have a man page for, we now show
the man page in a tooltip window.

This feels rather bulky at the moment, but the basic mechanism is quite
neat and just needs a bunch of tuning.
2019-10-30 20:28:44 +01:00
Andreas Kling d24164ac6a HackStudio: Add little icons for ".cpp" and ".h" files
This makes it easier to tell them apart in locator suggestions. :^)
2019-10-28 19:08:48 +01:00
Andreas Kling 272c59e6d8 HackStudio: Remove unnecessary Locator::keydown_event() 2019-10-28 19:08:48 +01:00
Andreas Kling 990ca1a7a5 HackStudio: Allow opening a Locator suggestion by double-clicking it 2019-10-28 19:08:48 +01:00
Andreas Kling 29ac3e1477 HackStudio: Scroll the locator suggestions when navigating with arrows 2019-10-28 19:08:48 +01:00
Andreas Kling b4de5ac128 HackStudio: Start working on a "Locator", much like Qt Creator has
Pressing Ctrl+K will now open the little locator command line at the
bottom of the window. Right now it can only be used to jump quickly
to a file.
2019-10-28 19:08:48 +01:00
Andreas Kling fe83d5087b HackStudio: Show .h files with C++ syntax highlighting 2019-10-28 19:08:48 +01:00
Andreas Kling e2c74762ff HackStudio: Draw a brownish frame around the current editor widget
Also make the editor filename label bold only for the current editor.
2019-10-27 20:44:37 +01:00
Andreas Kling e2d7f585da HackStudio: Support opening the same file in both editors
Hey, it actually works! You can now edit the same file in both editors
and even the C++ highlighting updates correctly in both of them. :^)
2019-10-27 19:39:15 +01:00
Andreas Kling f1c6193d6d LibGUI: Move GTextDocument out of GTextEditor
The idea here is to decouple the document from the editor widget so you
could have multiple editors being views onto the same document.

This doesn't work yet, since the document and editor are coupled in
various ways still (including a per-line back-pointer to the editor.)
2019-10-27 16:44:16 +01:00
Andreas Kling 1bcbc3f827 HackStudio: Allow switching between the two editors with Ctrl+E :^)
This is very hackish and should be done differently, but the feature
feels pretty nice and does work for now.
2019-10-27 13:10:37 +01:00
Andreas Kling 1e5f4714c7 HackStudio: Tweak EditorWrapper layouts a bit to make things look nice 2019-10-27 13:06:30 +01:00
Andreas Kling e39b1f11f9 HackStudio: Support multiple editors on screen
This patch adds Editor (subclass of GTextEditor) and EditorWrapper.
An EditorWrapper is a composite widget that adds a little statusbar
above an Editor widget. The statusbar is used for showing the filename
and the current cursor position. More things can definitely be added.

To get to the currently active editor, call current_editor().
You can also get to the current editor's wrapper by calling..
current_editor_wrapper(). Which editor is current is determined by
which was was last focused by the user.
2019-10-27 12:55:10 +01:00
Andreas Kling 90c81d5c16 HackStudio: Tweak style of C++ identifiers
On second thought, let's not have bold identifiers, as this ended up
making most of the code bold. :^)
2019-10-26 21:47:51 +02:00
Andreas Kling dd74cb9c8f HackStudio: Focus the text editor after opening a file 2019-10-26 21:45:29 +02:00
Andreas Kling cea6506998 HackStudio: Implement adding an existing file to project 2019-10-26 21:43:46 +02:00
Andreas Kling 9129dbe0b9 HackStudio: Implement adding a new file to the project
You can now press Ctrl+N to create and add a new file to the project!
2019-10-26 21:28:31 +02:00
Andreas Kling bc2026d26d LibGUI: Make GTextEditor::Span have a range instead of two positions
A GTextRange is really just two GTextPositions (start and end) anyway.
This way we can say nice things like "if (range.contains(position))"
2019-10-26 15:33:19 +02:00
Andreas Kling df7f3ca604 HackStudio: "Hide" the action tabs (find in files, console) by default
By "hide" I really mean collapse them down to 24px height. We grow them
to a normal size when they're needed. The user is also free to resize
them at will.

This keeps them out of the way when you just want to do editing. :^)
2019-10-26 12:30:49 +02:00
Andreas Kling db353a06e5 HackStudio: Enable line wrapping and automatic indentation by default 2019-10-26 11:33:39 +02:00
Andreas Kling ed242d538a HackStudio: Assorted improvements to C++ highlighting
Add a list of hard-coded standard types (including AK types) and show
them in a different style.

Rehighligt the file whenever it changes. (This is very inefficient but
makes it much easier to experiment.)

Also keep tweaking the colors. :^)
2019-10-26 10:33:50 +02:00
Andreas Kling 2b19badd74 HackStudio: Make C++ keywords bold :^)
Now that we can specify the font of a GTextEditor::Span, use this to
make C++ keywords show up in bold text. Also tweak colors a bit.
2019-10-26 00:19:36 +02:00
Andreas Kling 5e5a7fbd40 HackStudio: Teach the C++ lexer about most C++ keywords
Also fix broken "/* */" comment handling.
2019-10-25 21:58:40 +02:00
Andreas Kling 6afe27b914 HackStudio: Lex C++ files and apply some basic syntax highlighting
When we open a file whose name ends in ".cpp", we now pass the contents
through CppLexer, which produces a CppToken stream.

Those CppTokens are then converted into GTextEditor::Spans and handed
over to GTextEditor which then colorizes the source code accordingly.

This is pretty neat. :^)
2019-10-25 21:09:16 +02:00
Andreas Kling 0604fcf9fd HackStudio: Make CppTokens have (line,column) positions
These are infinitely more useful than raw indices into the input text.
2019-10-25 21:07:45 +02:00
Andreas Kling 307cbf83c3 HackStudio: Start building a C++ lexer to help with syntax highlighting 2019-10-25 19:52:44 +02:00
Andreas Kling f256c55e8d HackStudio: Unbreak jumping to a search result
I broke this when factoring out the find-in-files widget into its own
class. This patch adds a main_editor() global getter for grabbing at
the main GTextEditor from wherever you are.
2019-10-25 10:25:42 +02:00
Andreas Kling 4e25d69dba HackStudio: Move the ProcessStateWidget below the TerminalWidget
This looks a bit less janky when hiding/unhiding.. :^)
2019-10-24 22:32:27 +02:00
Andreas Kling deabc7e13b HackStudio: Bring up the console when doing a "build" or "run"
We most likely want to see what comes out on the console when starting
one of these actions.
2019-10-24 22:28:36 +02:00
Andreas Kling 84a2208b5c HackStudio: Add some toolbar icons to liven up the UI a bit :^) 2019-10-24 22:25:26 +02:00
Andreas Kling f61622a501 HackStudio: Hide the ProcessStateWidget while no process is running 2019-10-24 21:04:13 +02:00
Andreas Kling bced810880 HackStudio: Show the slave pty's PGID in the ProcessStateWidget
This is the closest I could figure out how to get to what's actively
running on the terminal view at the moment.

Perhaps we can bundle up every process with the same tty and sum it
all up somehow. I'm not sure.
2019-10-24 20:56:13 +02:00
Andreas Kling 272317bce2 HackStudio: Add a widget showing the state of console's running process
We now have a little widget that sits above the terminal view in the
build/application console. When a child process is running, we show its
PID, name, scheduling counter, and amount of resident memory in a live
little overview.

This is not working right just yet, since we don't know how to get to
the actually active PID on the TTY. Or, well, we find the active PID by
looking at the PGID of our fork()ed child.

This manages to find children spawned by Shell, but not children
spawned by make, for instance. I need to figure out how to find those.
2019-10-24 20:21:43 +02:00
Andreas Kling 2260190f39 HackStudio: Move "find in files" widget to its own file/class
Instead of clogging up main.cpp with find-in-files functionality,
put it in a FindInFilesWidget class in a separate file.
2019-10-23 21:13:08 +02:00
Andreas Kling 2d460b504f HackStudio: Make the "find in files" widget more keyboard-accessible
Have Ctrl+Shift+F open the find-in-files widget and focus the text box
so you can start entering text right away.

Also make it do a search when you press the return key.
2019-10-23 21:02:02 +02:00
Andreas Kling d3e81d2ba8 HackStudio: Start adding a "find in files" function
Projects now contain a set of TextDocument objects. Each TextDocument
represents a member file in the project. TextDocuments may not have
their file contents loaded at all times, but they will be loaded on
demand when calling TextDocument::contents().

"Find in files" works by iterating over the documents in the project
and calling find(needle) on each one. The return value from find() is
a vector of line numbers where the needle was found.

This is obviously going to need a bunch more work. :^)
2019-10-23 20:54:41 +02:00
Andreas Kling 5f5f837ec5 HackStudio: Put the console terminal wrapper in a GTabWidget
This will make it straightforward to add more things at this level.
2019-10-23 19:52:34 +02:00
Andreas Kling 29669ba661 HackStudio: Add a simple "Save" action
Pressing Ctrl+S now saves the currently open file to disk.
2019-10-22 22:25:05 +02:00
Andreas Kling 708543c3d6 HackStudio: Add a simple "Run" action
Ctrl+R will now execute "make run" in the project directory. :^)
2019-10-22 22:18:46 +02:00
Andreas Kling 654ffdef91 HackStudio: Add a simple "Build" action
Pressing Ctrl+B now invokes "make" in the project directory and routes
the output from the make command to the little terminal widget.
2019-10-22 22:15:43 +02:00
Andreas Kling a6b153abf1 HackStudio: Show the currently open file in bold (in the project list)
Also import a little default C++ project called "little" :^)
2019-10-22 21:38:58 +02:00
Andreas Kling 2638a94094 HackStudio: Add a simple app icon and some initial menus 2019-10-21 22:13:20 +02:00
Andreas Kling 3fa16dfae2 HackStudio: "Go to line" was mixed up about 0/1-based line numbers 2019-10-21 20:33:47 +02:00
Andreas Kling d1916700ea HackStudio: Restrict the "Go to line" shortcut to the text editor
We don't want Ctrl+L presses to be snatched while we're in the embedded
terminal, for example. :^)
2019-10-21 20:31:32 +02:00
Andreas Kling da0958a882 LibVT: Make TerminalWidget's automatic size policy updates optional
When embedding a TerminalWidget, you might not want it to automatically
update its own size policy based on the exact terminal buffer size.

This behavior is now passed as a flag to the TerminalWidget constructor
which makes it behave nicely both inside HackStudio and in Terminal.
2019-10-21 20:28:30 +02:00
Andreas Kling 43ccb28852 HackStudio: Embed a Terminal widget below the text editor
This will be very useful for running (and interacting with) programs
after we build them. :^)
2019-10-21 20:17:32 +02:00
Andreas Kling c1f72e0bbf HackStudio: Show line numbers in the text editor by default 2019-10-21 19:03:09 +02:00
Andreas Kling 7eed2e968c HackStudio: Show cursor line and column in the statusbar 2019-10-21 18:50:24 +02:00
Andreas Kling 0311e8d50a HackStudio: Start working on an IDE for SerenityOS
This will be fun. :^)
2019-10-21 18:46:55 +02:00
Andreas Kling 4bfd4dc6c7 AK: Remove empty files JsonArray.cpp and JsonObject.cpp 2019-10-01 11:24:54 +02:00
Andreas Kling d5f1c57fe2 Inspector: Fix bad RemoteObjectGraphModel::parent_index()
We were returning bogus indices and also failing to handle parents that
are roots.

This was visible in the broken line trees drawn by GTreeView.
2019-09-23 20:29:03 +02:00
Andreas Kling d6abfbdc5a LibCore: Remove ObjectPtr in favor of RefPtr
Now that CObject is fully ref-counted, just use RefPtr everywhere! :^)
2019-09-22 00:31:54 +02:00
Andreas Kling 8d550c174e LibCore: Convert CFile to ObjectPtr 2019-09-21 20:50:06 +02:00
Andreas Kling defafd72bc LibGUI: Convert custom widgets and subclasses to ObjectPtr 2019-09-21 20:04:00 +02:00
Andreas Kling 409494193e LibGUI: Convert remaining random little things to ObjectPtr 2019-09-21 19:40:14 +02:00
Andreas Kling 45cfd57f6e GButton: Convert most code to using ObjectPtr for GButton 2019-09-21 19:28:28 +02:00
Andreas Kling 7584480f62 LibGUI: Convert GWindow to ObjectPtr 2019-09-21 18:34:06 +02:00
Andreas Kling ff6ce422dd LibGUI: Convert GWidget to ObjectPtr 2019-09-21 17:05:35 +02:00
Andreas Kling 7aaad27778 LibGUI: Convert GSlider to ObjectPtr 2019-09-21 16:33:53 +02:00
Andreas Kling ceb5508fea LibGUI: Convert GProgressBar to ObjectPtr 2019-09-21 16:31:12 +02:00
Andreas Kling b78225941d LibGUI: Convert GSpinBox to ObjectPtr 2019-09-21 16:15:11 +02:00
Andreas Kling 83b5f6c11a LibGUI: Convert GGroupBox to ObjectPtr 2019-09-21 16:13:33 +02:00
Andreas Kling 4f4438c04c LibGUI: Convert GSplitter to ObjectPtr 2019-09-21 16:11:02 +02:00
Andreas Kling efb8f9d538 LibGUI: Convert GTreeView to ObjectPtr 2019-09-21 16:06:43 +02:00
Andreas Kling e7b55037f4 LibGUI: Convert GTableView to ObjectPtr 2019-09-21 16:03:59 +02:00
Andreas Kling 93851c3832 LibGUI: Convert GTextBox, GTextEditor and GResizeCorner to ObjectPtr 2019-09-21 15:46:47 +02:00
Andreas Kling bce58bbbca LibGUI: Convert GScrollBar to ObjectPtr 2019-09-21 15:25:08 +02:00
Andreas Kling 2e76ac3aff FormCompiler: Generate code that uses ObjectPtr for widgets 2019-09-21 15:25:08 +02:00
Andreas Kling c7437f9caa LibGUI: Convert GLabel to ObjectPtr 2019-09-21 15:25:08 +02:00
Andreas Kling c83da29a9d LibCore: Convert CLocalSocket to ObjectPtr 2019-09-21 15:25:08 +02:00
Andreas Kling 664dff0581 VisualBuilder: Disallow moving managed widgets with the arrow keys 2019-09-17 22:41:42 +02:00
Andreas Kling 4f184114de VisualBuilder: Add icons for the layout menu actions 2019-09-17 22:39:48 +02:00
Andreas Kling 9d460d55d1 VisualBuilder: Don't allow moving/resizing widgets that are in a layout
Also paint these widgets' grabbers differently to make it stand out
visually which widgets have managed geometry. :^)
2019-09-17 22:17:28 +02:00
Andreas Kling 5e439bb3c8 VisualBuilder: Fix hit testing for composite widgets
When we ask LibGUI to hit test, it may return a subwidget of a widget
composed of many smaller widgets. In those cases we need to locate the
appropriate corresponding VBWidget for the composite widget.
2019-09-17 22:17:28 +02:00
Andreas Kling b37fc9f655 VisualBuilder: Make it possible to add a layout to a widget
This patch adds horizontal and vertical layout options to the widget
context menu.

This is going to need a lot of work, but it's a cool start. :^)
2019-09-17 22:17:28 +02:00
Andreas Kling 9acdf9bb0a VisualBuilder: Support nested widgets
This patch makes it possible to put widgets inside one another. The way
you do this right now is by having a (single) widget selected when you
insert a new widget. The new widget then becomes a child of the
selected widget. (In the future we'll make it possible to drag widgets
into each other, and things like that.)

I've also changed the grabber coordinates to be window-relative instead
of parent-relative in order to simplify things for myself. Maybe that's
not the ideal design and we can revisit that.
2019-09-17 22:17:28 +02:00
Andreas Kling a77814bdee VisualBuilder: Use GAboutDialog :^) 2019-09-17 22:17:28 +02:00
Andreas Kling d754ac5bcb LibGUI+VisualBuilder: Add move-to-front/back to GCommonActions
Also give them nice little icons. :^)
2019-09-14 22:42:39 +02:00
Andreas Kling 92b17eab23 VisualBuilder: Use GCommonActions::make_delete_action() 2019-09-14 22:32:56 +02:00
Andreas Kling e83390387c LibGUI: Simplify GCommonActions a bit
Use the same callback signature as GAction so we can just forward it
to GAction instead of chaining callbacks.
2019-09-14 22:10:44 +02:00
Andreas Kling 11f2e7cd5c GMenu: Update apps now that you can create a nameless GMenu
We had many context menus with names, simply because you were forced
to give them names.
2019-09-13 22:14:07 +02:00
Andreas Kling f89944e804 Inspector+LibCore+rpcdump: Rework the RPC stuff to be request/response
RPC clients now send JSON-encoded requests to the RPC server.
The connection also stays alive instead of disconnecting automatically
after the initial CObject graph dump.

JSON payloads are preceded by a single host-order encoded 32-bit int
containing the length of the payload.

So far, we have three RPC commands:

    - Identify
    - GetAllObjects
    - Disconnect

We'll be adding more of these as we go along. :^)
2019-09-11 21:19:23 +02:00
Andreas Kling 292b89b2e8 Inspector: Don't call CSocket::connect() before setting up hooks 2019-09-11 19:56:31 +02:00
Andreas Kling 73fdbba59c AK: Rename <AK/AKString.h> to <AK/String.h>
This was a workaround to be able to build on case-insensitive file
systems where it might get confused about <string.h> vs <String.h>.

Let's just not support building that way, so String.h can have an
objectively nicer name. :^)
2019-09-06 15:36:54 +02:00
rhin123 8fc2034ca1 VBForm: Fixed cursor not changing on resize /w multiple selections
We were resetting the cursor during multiple selections since our
mouse can only be over a single widget at a time.
2019-09-06 07:17:57 +02:00
rhin123 4f3812ad14 VisualBuilder: Added GCommonActions 2019-09-05 09:40:54 +02:00
Andreas Kling 16628d0f8f VisualBuilder: Remove empty "Edit" menu
There was nothing in there anyway. We can add it back when we have some
edit actions :^)
2019-09-01 13:25:54 +02:00
rhin123 e7d15ccca4 VBForm: Set mouse type relative to how we resize the VBWidget 2019-08-30 07:45:12 +02:00
Andreas Kling 4f3234148a Inspector: Show remote object properties in a table view
This patch expands the object model of this program quite a bit.
We now have a RemoteProcess object that contains a list of remote root
RemoteObject objects.

The RemoteProcess vends a RemoteObjectGraphModel&, and indices in that
model have internal_data() pointing to a corresponding RemoteObject.
RemoteObjects in turn vend a RemoteObjectPropertyModel&, which is what
we use to show the object properties.

This is pretty cool :^)
2019-08-19 20:29:52 +02:00
Andreas Kling 736dc5f6c0 Inspector: Add a missing "override" in RemoteObjectGraphModel 2019-08-19 19:46:40 +02:00
Andreas Kling a32123f221 Inspector: Show GWindows with a little window icon. 2019-08-19 16:34:53 +02:00
Andreas Kling 68e94f0a2e Inspector: Implement RemoteObjectGraphModel::parent_index()
This makes GTreeView paint the tree lines correctly. It's a bit weird
that this is needed, but straightforward to implement so meh.
2019-08-18 11:12:43 +02:00
Andreas Kling 2e4e4ad957 Inspector: Add a custom 16x16 icon to represent objects
Behold, my finest "1990's OOP cube icon" :^)
2019-08-18 10:49:38 +02:00
Andreas Kling 05cd178477 Inspector: Add a GUI tool for viewing a remote process's CObject graph
Here comes the foundation for a neat remote debugging tool.

Right now, it connects to a remote process's CEventLoop RPC socket and
retreives the remote object graph JSON dump. The remote object graph
is then reconstructed and exposed through a GModel subclass, which is
then displayed in a GTreeView.

It's pretty cool, I think. :^)
2019-08-18 10:19:13 +02:00
Andreas Kling 6b81d8de70 DevTools: Add CLocalServer to the host-side tool build dependencies 2019-08-17 11:08:10 +02:00
Andreas Kling c258c9a4b2 FormCompiler: Oops, need to use JsonValue::serialized() for properties
When assigning properties, we were relying on the JSON serialization
code to wrap strings in double-quotes ("). JsonValue::to_string() does
not wrap string values, so what we want here is serialized(). :^)
2019-08-07 22:09:33 +02:00
Andreas Kling f6998b1817 JSON: Templatize the JSON serialization code
This makes it possible to use something other than a StringBuilder for
serialization (and to produce something other than a String.) :^)
2019-08-07 21:29:32 +02:00
Andreas Kling 6311a617be GComboBox: Include the selected index with the on_change notification
This will be useful for clients that need to fetch additional data from
the model on selection change.
2019-08-05 18:42:51 +02:00
Andreas Kling 116d551f82 IPCCompiler: Don't generate "OwnPtr<void>" as a handle() return type
This was happening for async (response-less) messages, since they were
returning void and were were always just wrapping the return type in
an OwnPtr no matter what.
2019-08-03 21:34:08 +02:00
Andreas Kling 3100e8dee5 IPCCompiler+AudioServer: Accept "//"-style comments in IPC defintions 2019-08-03 21:29:09 +02:00
Andreas Kling 3519b6c201 IPCCompiler: More work towards AudioServer bringup
- Add IEndpoint::handle(IMessage), a big switch table on message type.
  handle() will return a response message for synchronous messages,
  and return nullptr otherwise.
- Use i32 instead of int for everything
- Make IMessage::encode() const
- Make IEndpoint::decode_message() static, this allows template code to
  decode messages without an endpoint instance on hand.
2019-08-03 19:24:08 +02:00
Andreas Kling 8dd07c3075 IPCCompiler: Emit message parameter getters
For simplicity's sake, they are all "const type& name() const"
2019-08-03 17:24:47 +02:00
Andreas Kling c255cedd7a IPCCompiler: Make decode_message() return nullptr for unknown messages 2019-08-03 17:06:24 +02:00
Andreas Kling 925c8f42f8 IPCCompiler: Generate message decoding functions
An endpoint now knows how to decode a ByteBuffer into an IMessage.
2019-08-03 17:03:44 +02:00
Andreas Kling 659ddddd20 IPCCompiler: Emit IEndpoint::name() overrides 2019-08-03 16:44:27 +02:00
Andreas Kling 36b352554e IPCCompiler: Emit message constructors + include ID in serialization 2019-08-03 16:35:49 +02:00
Andreas Kling 05e08afcd8 IPCCompiler: Generate getters for message ID's and message names
Each endpoint namespace will have an enum class MessageID where you can
find all of its messages.
2019-08-03 16:19:14 +02:00
Andreas Kling fae3091999 IPCCompiler: Typedef the response message types as "ResponseType"
Each message will now have a typedef called ResponseType as an alias
for the expected response type. This will aid in implementing the sync
messaging code.
2019-08-03 16:06:40 +02:00
Andreas Kling 016335edde IPCCompiler: Generate endpoint and message classes
These are not entirely finished but it's starting to take shape. :^)
2019-08-03 15:50:16 +02:00
Andreas Kling aa8a3d4a89 IPCCompiler: Start working on a simple IPC definition language
Instead of doing everything manually in C++, let's do some codegen.
This patch adds a crude but effective IPC definition parser, along
with two initial definition files for the AudioServer's client and
server endpoints.
2019-08-03 15:17:41 +02:00
Andreas Kling 5d83a049c2 FormCompiler: Add some more LibCore object files to host build. 2019-07-26 22:42:10 +02:00
Andreas Kling 1d0b464618 AK: Make HashMap::get(Key) return an Optional<Value>.
This allows HashMap::get() to be used for value types that cannot be default
constructed (e.g NonnullOwnPtr.)
2019-07-24 10:25:43 +02:00
Andreas Kling e2798d6208 VisualBuilder: Convert Vector<OwnPtr> to NonnullOwnPtrVector. 2019-07-24 09:40:11 +02:00
Andreas Kling 72a3f69df7 LibGUI: Get rid of GWindow::should_exit_event_loop_on_close().
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-23 18:20:00 +02:00
Andreas Kling c59b053ad6 GSlider: Add support for vertical sliders.
You now have to pass an Orientation to the GSlider constructor. It's not
possible to change the orientation after construction.

Added some vertical GSliders to the WidgetGallery demo for testing. :^)
2019-07-20 19:32:12 +02:00
Andreas Kling 1c0669f010 LibDraw: Introduce (formerly known as SharedGraphics.)
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-18 10:18:16 +02:00
Andreas Kling a17fbd98e7 LibGUI: Add input types to GMessageBox.
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-16 21:41:13 +02:00
Andreas Kling 9c6fe21b49 FormCompiler: Build individual compilation units instead of all-at-a-time. 2019-07-10 21:28:04 +02:00
Andreas Kling f07649faba Build: Build the host-side FormCompiler before everything else.
Since we're gonna want to use this for building other apps, it should be
the very first thing we build.
2019-07-10 21:22:27 +02:00
Andreas Kling 3eb6a9a286 FormCompiler: Produce a C++ header file as output.
Also make sure the generated main widget has autofill turned on.
2019-07-10 21:14:25 +02:00
Andreas Kling 8d67aa1e59 FormCompiler: Generate a basic UI skeleton holder struct.
The basic idea is that you would use it like this:

MyWidget::MyWidget(GWidget* parent)
    : GWidget(parent)
{
    m_ui = new UI_MyWidget;
    set_main_widget(m_ui->main_widget);
    ...
}
2019-07-10 20:58:54 +02:00
Andreas Kling 2d3293dfbd FormCompiler: Start working on a C++ code generator for VisualBuilder forms. 2019-07-10 20:41:31 +02:00
Andreas Kling 69fea8d41d VisualBuilder: Expose the "name" property on all widgets. 2019-07-10 20:34:17 +02:00
VAN BOSSUYT Nicolas 802d4dcb6b Meta: Removed all gitignore in the source tree only keeping the root one 2019-06-30 10:41:26 +02:00
Andreas Kling 315716d193 GUI: Use Win2K-like "warm gray" color instead of the older colder gray.
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-30 09:23:16 +02:00
Andreas Kling b729b5fc64 VisualBuilder: Support loading a saved form from JSON.
The form to load is specified on the command line, e.g "vb test.frm".
2019-06-29 12:07:46 +02:00
Andreas Kling 65e470c90a VisualBuilder: Use NonnullRefPtrVector. 2019-06-27 13:49:26 +02:00
Andreas Kling 6a0011dcea LibGUI+VisualBuilder: Support custom editing widgets for property values.
Implemented this by letting GAbstractViews provide a GModelEditingDelegate
for a given index, which then knows how to create and setup a custom widget
appropriate for the data type being edited.
2019-06-23 08:18:28 +02:00
Andreas Kling 17acc1e0a8 VisualBuilder: Fix compiler warnings. 2019-06-22 16:16:39 +02:00
Andreas Kling d343fb2429 AK: Rename Retainable.h => RefCounted.h. 2019-06-21 18:58:45 +02:00
Andreas Kling 550b0b062b AK: Rename RetainPtr.h => RefPtr.h, Retained.h => NonnullRefPtr.h. 2019-06-21 18:45:59 +02:00
Andreas Kling 90b1354688 AK: Rename RetainPtr => RefPtr and Retained => NonnullRefPtr. 2019-06-21 18:37:47 +02:00
Andreas Kling 77b9fa89dd AK: Rename Retainable => RefCounted.
(And various related renames that go along with it.)
2019-06-21 15:30:03 +02:00
Andreas Kling aa3df518e7 AK: Rename JsonObject::to_string() and pals to serialized().
And the variant that serializes into a StringBuilder is called serialize().
2019-06-18 09:37:47 +02:00
Andreas Kling 3b9fcab1af VisualBuilder: Switch to JSON for the form output.
This makes widgets-within-widgets straightforward instead of confusing.
The UI doesn't actually let you put widgets inside one another just yet,
but at least now the output format won't be a problem. :^)
2019-06-17 19:50:30 +02:00
Andreas Kling 39d1a9ae66 Meta: Tweak .clang-format to not wrap braces after enums. 2019-06-07 17:13:23 +02:00
Andreas Kling 892acfb10d VisualBuilder: Run clang-format on everything. 2019-06-07 11:48:27 +02:00
Andreas Kling 40ca3b019f VisualBuilder: Add GRadioButton to the widget repertoire. 2019-06-01 00:23:31 +02:00
Robin Burchell 0dc9af5f7e Add clang-format file
Also run it across the whole tree to get everything using the One True Style.
We don't yet run this in an automated fashion as it's a little slow, but
there is a snippet to do so in makeall.sh.
2019-05-28 17:31:20 +02:00
Andreas Kling 677794f30d LibGUI: Make GCheckBox inherit from GAbstractButton. 2019-05-24 17:11:42 +02:00
Andreas Kling 21c56477b0 LibGUI: Add a GAbstractButton base class for button widgets.
This patch moves GButton and GRadioButton to inherit from it. This allows
them to share code for mouse event handling, etc.
2019-05-24 16:32:20 +02:00
Andreas Kling 852d648912 Fix "make clean" not deleting app binaries. 2019-05-13 14:56:18 +02:00
Andreas Kling 1ff7f76172 VisualBuilder: Tweak margins in properties window. 2019-05-11 02:35:55 +02:00
Andreas Kling de98b2770b GMessageBox: Add icons to message boxes with 3 standard ones to choose from. 2019-05-08 20:13:39 +02:00
Andreas Kling 758e926b99 GGroupBox: Rename "name" property to "title" 2019-05-08 14:32:46 +02:00
Andreas Kling 3ae9fc5d88 Move VisualBuilder into a new DevTools directory. 2019-05-08 13:53:34 +02:00