Commit graph

769 commits

Author SHA1 Message Date
Andreas Kling
f76168a3ea FileManager: Make copying faster with ftruncate() and a bigger buffer
Apply the same techniques from "cp" to make copying files much faster.
2019-11-04 17:25:44 +01:00
Andreas Kling
b8bf998b61 LibGUI: Move text search functions from GTextEditor to GTextDocument
Also add a find_all() that retuns a Vector<GTextRange> and simply does
a find_next() loop, returning all the matching ranges.
2019-11-01 21:31:06 +01:00
Andreas Kling
fa69b9fbb7 IRCClient: Switch to using an HtmlView for the IRC window contents :^)
This seemed like a perfect fit for LibHTML. We can now style the IRC
channels and queries however we like with the power of HTML and CSS.

This patch doesn't do much in the way of styling, it just gets the
basic mechanism into place.
2019-10-28 20:53:19 +01:00
Brandon Scott
98e556fee9 HexEditor: Created has_selection() method.
Created has_selection() method and fixed a few small issues.
2019-10-27 00:44:42 +02:00
Brandon Scott
c77fe5161c HexEditor: Added fill selection action.
Added the ability to fill the current selection with a given byte.
2019-10-27 00:44:42 +02:00
Brandon Scott
f947353a56 HexEditor: Added new file action.
Added a new file action, allowing you to create a new file of a specific
size.
2019-10-27 00:44:42 +02:00
Brandon Scott
bddabad3d9 HexEditor: Fixed startup error
When attempting to open a file that doesnt exist or has permission
problems, the application would end after hitting OK on the message
box instead of starting up to an empty editor.

I believe this has something to do with the dialog event loop
interfering with the application event loop, or possibly the fact
that the window creation code is in the show() method.

To work around this I now call the open_file() method after the
show() method.
2019-10-24 09:57:27 +02:00
Brandon Scott
e3fbd2fe60 HexEditor: Added a multi-label status bar, and a new copy option.
Make use of the new multi-label status bar, and added a menu
option to allow you to copy generated C code from a selection
to the clipboard.
2019-10-24 09:57:27 +02:00
Andreas Kling
cd1eee6604 LibVT+Terminal: Give TerminalWidget a hook for EOF on the pty
Instead of quitting the application immediately when the pty gives an
EOF, fire an on_command_exit hook so the TerminalWidget client can
decide for himself what to do.
2019-10-22 21:57:53 +02:00
Andreas Kling
e9f6e1e287 LibVT+Terminal: Don't set window title directly from TerminalWidget
Instead, have TerminalWidget provide an on_title_change hook.
This allows embedders to decide for themselves what to do if we receive
a "set terminal title" escape sequence.
2019-10-21 22:07:59 +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
8b4903e733 LibVT: Move TerminalWidget from the Terminal app to here
It would be nice to be able to reuse this widget in other apps. :^)
2019-10-21 19:50:07 +02:00
Brandon Scott
465a33443c HexEditor: Fix half byte offset bug
If you had made a change to the first 4 bits of a byte and then changed
your offset via keyboard or menu option it would change the last 4 bits
of the new offset the next time you made a change and would not show that
the byte had been changed at the new offset.
2019-10-21 09:45:21 +02:00
Brandon Scott
a76b02f741 HexEditor: Added navigate to a hex offset
Added the ability to navigate to a specified hex offset.
2019-10-21 09:45:21 +02:00
Brandon Scott
443eda986a HexEditor: Fixed off-by-one copying bug
When copying as hex or text we missed the last byte.
2019-10-21 09:45:21 +02:00
Brandon Scott
5cc722cec4 HexEditor: Reverse selections
Added the ability to select text and hex in reverse.
2019-10-21 09:45:21 +02:00
Andreas Kling
c41bae3d54 LibHTML+Browser: Support scrolling to anchor with <a href="#foo">
This patch implements basic support for <a href="#foo"> fragment links.

To figure out where we actually want to scroll to, we have to do
something different based on the layout node's box type. So if it's a
regular LayoutBox we can just use the LayoutBox::position().

However, if it's an inline layout node, we use the position of the
first line box fragment in the containing block contributed by this
layout node or one of its descendants.
2019-10-20 10:07:26 +02:00
Andreas Kling
884ae80699 LibHTML+Browser: Show target URL of hovered links in Browser statusbar
HtmlView will now invoke the on_link_hover hook when the cursor enters
or leaves a DOM node that has an enclosing link element.

This patch also updates the meaning of Node::enclosing_link_element()
to find the nearest HTMLAnchorElementAncestor *with an href attribute*.
2019-10-19 21:25:49 +02:00
Andreas Kling
fbdd0def47 Terminal: Make Shift+PgUp/PgDown scroll the terminal up/down one page
I keep doing this out of habit, expecting it to scroll, and now it
actually will scroll. :^)
2019-10-19 20:54:47 +02:00
Andreas Kling
89aaae82a1 Browser: Add basic back/forward history 2019-10-17 23:39:31 +02:00
Chyza
36bb03b6dd PaintBrush: Use secondary color for eraser (like in ms_paint)
Comes with a checkbox to turn it off if you dislike it.
2019-10-15 19:18:04 +02:00
Kevin Murphy
10324bc574 TextEditor: suppress "Not found" window when searching for empty string
Minor patch, but I was watching one of your videos on YouTube and
thought that the pop-up was unecessary/annoying in this case.  Love
your enthusiasm for the project :^)
2019-10-15 09:10:10 +02:00
Andreas Kling
49ac0c2e24 LibHTML: Move layout root from HtmlView to Document
The layout root is now kept alive via Document::m_layout_root.
This will allow us to do more layout-related things inside the inner
layer of LibHTML without reaching out to the HtmlView.

I'd like to keep HtmlView at a slightly higher level, to prevent it
from getting too complex.

This patch also fixes accidental disconnection of the layout tree from
the DOM after doing a layout tree rebuild. ~LayoutNode() now only
unsets the DOM node's layout_node() if it's itself.
2019-10-13 12:43:31 +02:00
Brandon Scott
48ef1d1bd1 HexEditor: Initial application release
The very first release of the Hex Editor for Serenity.
2019-10-13 08:45:49 +02:00
Andreas Kling
2530378f59 LibHTML+Browser: Add debug option to draw borders around line boxes
This will be very useful when debugging line layout.
2019-10-12 15:02:53 +02:00
Andreas Kling
bf79b198f6 Browser: Add a debug menu with actions to dump DOM and Layout trees 2019-10-12 13:44:17 +02:00
Andreas Kling
06113b4ffe LibHTML+Browser: Show the number of pending resource loads
For now this is simply a counter+hook exposed by ResourceLoader and
shown in the Browser status bar.

This is not very nuanced, and it would be nice to expose more info so
we could eventually do something like a progress bar.
2019-10-10 22:07:08 +02:00
Andreas Kling
850955053f LibHTML: Rename Document::normalize() to fixup() and always do it
Node.normalize() is a standard DOM API that coalesces Text nodes.
To avoid clashing with that, rename it to fixup().

This patch also makes it happen automagically as part of parsing.
2019-10-09 18:54:34 +02:00
Andreas Kling
1ce8a175e1 FileManager: Add "Open in TextEditor..." action to context menu 2019-10-07 20:03:19 +02:00
Andreas Kling
5da385c16e Browser: Turn command-line path arguments into file:// URLs 2019-10-07 20:02:29 +02:00
Andreas Kling
90cd363a8e FileManager: Open .html files in Browser instead of "html" 2019-10-07 19:52:35 +02:00
Andreas Kling
b5a043cf42 Browser: Add a simple "Go home" button to the toolbar
Currently this just takes us to /home/anon/www/welcome.html :^)
2019-10-06 22:03:41 +02:00
Andreas Kling
ac3079b433 LibGUI: Add "Go home" to GCommonActions 2019-10-06 22:00:04 +02:00
Conrad Pankoff
15a016d3e3 Browser: Support opening a URL from the command line at startup 2019-10-06 14:25:58 +02:00
Andreas Kling
4173c77eb5 Browser: Show the page title in the window title bar :^) 2019-10-05 10:30:49 +02:00
Andreas Kling
31e361b827 Base: Add a little welcome page for the browser at ~/www/welcome.html 2019-10-05 10:29:52 +02:00
Andreas Kling
0a38e0028f Browser: Start working on a simple browser using LibHTML
This was inevitable. :^)
2019-10-05 10:20:17 +02:00
Andreas Kling
7dd03b7846 LibGUI: Add back/forward actions to GCommonActions 2019-10-05 09:21:55 +02:00
Andreas Kling
ee64d99a96 LibHTML: Make StyleResolver responsible for loading the default style
Instead of HtmlView clients having to worry about parsing and loading
the default CSS, just take care of it inside StyleResolver.

The default style is automatically inserted into the stylesheet list,
at the very start, so everyone else gets a chance to override it.
2019-10-05 09:02:29 +02:00
Sergey Bugaev
395e4210ef Help: Follow clicked links
This also adds a toolbar and a menu which allow you to
navigate back and forth through history ^)
2019-10-03 08:23:54 +02:00
Andreas Kling
9da121f837 SystemMonitor: Make all tabs except the process table lazily loaded
We now use GLazyWidget for all the secondary tabs, which makes the
program start up way faster than before.

There's a noticeable delay when you click on the "PCI Devices" tab
for the first time, but that's definitely better than always eating
that delay before seeing a window at all. :^)
2019-10-02 20:26:19 +02:00
Andreas Kling
da463d9b11 Terminal: Remove crashy assertion about line length
If we resize/maximize the window, we might end up with some lines in
history that had a different length than the current terminal width.
That's okay, so let's not crash because of it.

Fixes #620.
2019-10-02 17:12:46 +02:00
Andreas Kling
35138437ef Kernel+SystemMonitor: Add fault counters
This patch adds three separate per-process fault counters:

- Inode faults

    An inode fault happens when we've memory-mapped a file from disk
    and we end up having to load 1 page (4KB) of the file into memory.

- Zero faults

    Memory returned by mmap() is lazily zeroed out. Every time we have
    to zero out 1 page, we count a zero fault.

- CoW faults

    VM objects can be shared by multiple mappings that make their own
    unique copy iff they want to modify it. The typical reason here is
    memory shared between a parent and child process.
2019-10-02 14:13:49 +02:00
Brandon Scott
08a1fb8f1a LibGUI+PaintBrush: Fix to GFilePicker and PaintBrush enhancements.
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-10-01 09:17:56 +02:00
Larkin Nickle
3fb88cb76d Help+man.md: Add man sections
Also correct minor formatting mistake in TelnetServer.md.
2019-09-30 21:38:39 +02:00
Andreas Kling
1a279c5b2a GMessageBox: Hide the constructor and fix broken usages
We no longer support creating CObjects on the stack. Use construct().
2019-09-30 17:20:53 +02:00
Andreas Kling
8f45a259fc ByteBuffer: Remove pointer() in favor of data()
We had two ways to get the data inside a ByteBuffer. That was silly.
2019-09-30 08:57:01 +02:00
Andreas Kling
3900eebf15 FileManager+LibGUI+html: Add an icon to represent HTML files
This also becomes the app icon for the little "html" program. :^)
2019-09-29 21:00:41 +02:00
Sergey Bugaev
801fe7beac SystemMonitor: Display whether an fd is cloexec and blocking 2019-09-28 22:27:45 +02:00
Andreas Kling
09ad58f837 Help: Don't crash on startup when non-md man pages are present :^) 2019-09-28 18:38:27 +02:00
Sergey Bugaev
02ee8cbbe2 Applications: Add a new Help app
This is a neat simple app that can display the Serenity manual ^)
2019-09-28 18:29:42 +02:00
Sergey Bugaev
dd5541fefc Terminal: Add underline support 2019-09-28 18:29:42 +02:00
Andreas Kling
34d0e96aec LibCore+LibGUI: Remove GEventLoop and use CEventLoop everywhere
GEventLoop was just a dummy subclass of CEventLoop anyway. The only
thing it actually did was make sure a GWindowServerConnectionw was
instantiated. We now take care of that in GApplication instead.

CEventLoop is now non-virtual and a little less confusing. :^)
2019-09-22 20:50:39 +02:00
Andreas Kling
df837562ad Taskbar: Remove window buttons from the taskbar when appropriate 2019-09-22 00:41:52 +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
bc319d9e88 LibCore: Make CObject reference-counted
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-22 00:25:25 +02:00
Andreas Kling
8d550c174e LibCore: Convert CFile to ObjectPtr 2019-09-21 20:50:06 +02:00
Andreas Kling
31b38ed88f LibGUI: Don't create GMessageBox and GInputBox on the stack
We need to get rid of all instances of widgets-on-the-stack since that
will no longer work in the ref-counting world.
2019-09-21 20:32:31 +02:00
Andreas Kling
defafd72bc LibGUI: Convert custom widgets and subclasses to ObjectPtr 2019-09-21 20:04:00 +02:00
Andreas Kling
15a66dc8ab Welcome: Unbreak after ObjectPtr changes 2019-09-21 19:42:16 +02:00
Andreas Kling
409494193e LibGUI: Convert remaining random little things to ObjectPtr 2019-09-21 19:40:14 +02:00
Andreas Kling
60530a7cd9 Calculator: Convert to using ObjectPtr 2019-09-21 19:37:28 +02:00
Andreas Kling
45cfd57f6e GButton: Convert most code to using ObjectPtr for GButton 2019-09-21 19:28:28 +02:00
Andreas Kling
55a6e4ac0b LibGUI: Convert GFrame to ObjectPtr 2019-09-21 19:21:36 +02:00
Andreas Kling
f8d751440b LibGUI: Convert GRadioButton to ObjectPtr 2019-09-21 18:58:03 +02:00
Andreas Kling
7584480f62 LibGUI: Convert GWindow to ObjectPtr 2019-09-21 18:34:06 +02:00
Andreas Kling
70412c7d4f DisplayProperties: Remove all remaining naked "new" usage 2019-09-21 18:18:47 +02:00
Andreas Kling
f57cc5873c SystemMonitor: Remove all remaining naked "new" usage 2019-09-21 18:17:23 +02:00
Andreas Kling
f4b51a63ec LibCore: Remove CTimer::create() overloads in favor of construct() 2019-09-21 18:13:17 +02:00
Andreas Kling
0c4508c00d SystemMonitor: Unbreak after ObjectPtr<GWidget> changes 2019-09-21 17:36:52 +02:00
Andreas Kling
bdf23a3d23 LibCore: Make it possible to cancel pending CNetworkJobs
Subclasses of CNetworkJob handle this by overriding shutdown().
This patch implements it for CHttpJob by simply tearing down the
underlying socket.

We also automatically call shutdown() after the job finishes,
regardless of success or failure. :^)
2019-09-21 17:32:26 +02:00
Andreas Kling
ff6ce422dd LibGUI: Convert GWidget to ObjectPtr 2019-09-21 17:05:35 +02:00
Andreas Kling
e4e92980a1 LibGUI: Convert GComboBox to ObjectPtr 2019-09-21 16:35:11 +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
3476a63415 LibGUI: Convert GStatusBar to ObjectPtr 2019-09-21 16:29:47 +02:00
Andreas Kling
f4531c976c LibGUI: Convert GToolBar to ObjectPtr 2019-09-21 16:27:54 +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
c13b9e2214 LibGUI: Convert GItemView to ObjectPtr 2019-09-21 15:47:58 +02:00
Andreas Kling
93851c3832 LibGUI: Convert GTextBox, GTextEditor and GResizeCorner to ObjectPtr 2019-09-21 15:46:47 +02:00
Andreas Kling
4ea229accd LibCore: Convert CTCPServer to ObjectPtr
Also get rid of the custom CNotifier::create() in favor of construct().
2019-09-21 15:25:08 +02:00
Andreas Kling
bce58bbbca LibGUI: Convert GScrollBar to ObjectPtr 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
6b347747f2 LibCore: Convert CHttpJob to ObjectPtr 2019-09-21 15:25:08 +02:00
Andreas Kling
4298ba25c3 LibCore: Convert CTCPSocket to ObjectPtr, add construct() helper
The C_OBJECT macro now also inserts a static construct(...) helper into
the class. Now we can make the constructor(s) private and instead call:

    auto socket = CTCPSocket::construct(arguments);

construct() returns an ObjectPtr<T>, which we'll later switch to being
a NonnullRefPtr<T>, once everything else in in place for ref-counting.
2019-09-21 15:25:08 +02:00
Andreas Kling
74c4e62659 GCommonActions: Add "Open..." action
Make use of this in PaintBrush and TextEditor. :^)
2019-09-20 19:36:39 +02:00
Andreas Kling
d1bacb9885 LibCore: Convert CNotifier to ObjectPtr 2019-09-20 15:39:15 +02:00
Andreas Kling
50a6560413 LibCore: Convert CTimer to ObjectPtr 2019-09-20 15:20:10 +02:00
Andreas Kling
482d5295f1 FileManager: Allow deleting without confirmation via Shift+Delete
A powerful command for powerful users. :^)
2019-09-18 21:53:47 +02:00
Andreas Kling
33b8c807a6 FileManager: Implement basic file deletion
The delete action now actually deletes files (after asking the user for
confirmation, of course.) Deleting directories is not yet supported.

Fixes #541.
2019-09-18 21:46:14 +02:00
Andreas Kling
101b32236c SystemMonitor: Use GAboutDialog :^) 2019-09-18 18:43:23 +02:00
Brandon Scott
a4d52b122d FileManager+LibGUI: Fix two folder-related crashes (#569)
Fix a crash when opening a folder, and another one when trying to open
a newly created folder.

It was not safe to modify a GModelSelection while it's being iterated over.

Fixes #536.
2019-09-17 09:26:10 +02:00
Jesse
6557a31049 Terminal: Scroll cursor into view when typing (#568)
When the user has scrolled up and begins typing, the scrollbar will
automatically return them to the current cursor position so that they
can see what they're typing.
2019-09-16 07:52:27 +02:00
Jesse
444a4e4d39 DisplayProperties: Auto-resolution and graphical fix (#566)
The program will now automatically select the user's currently
chosen resolution when it is loaded up, however it is not
"visually selected" in the `GListView`

Moved the `resolution_list` list to be on the top to keep it consistent
with the wallpaper tab.
2019-09-16 07:50:47 +02:00
Conrad Pankoff
aa95bd7037 LibGUI: Fix move() of const StringView& 2019-09-16 07:49:43 +02:00
Conrad Pankoff
6fd096999e Applications: Add "Welcome" application, inspired by Windows 98 2019-09-16 07:49:43 +02:00