Commit Graph

58 Commits

Author SHA1 Message Date
Andreas Kling
2d39da5405 LibCore: Put all classes in the Core namespace and remove the leading C
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-02 15:15:30 +01:00
Andreas Kling
d67da8c101 LibGUI: Add GHBoxLayout and GVBoxLayout convenience classes 2020-02-02 15:09:48 +01:00
Andreas Kling
7c74d3a657 TextEditor: Focus the editor after opening a new file 2020-01-23 21:33:15 +01:00
Andreas Kling
ebfb3d91e2 TextEditor: Various UI text tweaks 2020-01-23 21:33:15 +01:00
Andreas Kling
94ca55cefd Meta: Add license header to source files
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-18 09:45:54 +01:00
0xtechnobabble
49e8d34f0e TextEditor: Replace text in find textbox with selection
This patch makes it so that if the find/replace widget is opened while
some text is selected, the find textbox's content is overrided with the
selected text.
2020-01-12 01:41:36 +01:00
0xtechnobabble
ecf58ddd4f TextEditor: Implement replacement functionality
This patch adds a new replace widget that cooperates with the find
widget, the replace widget takes the input in the find textbox, searches
for occurences of that input, and replaces them with the input provied
in the replace textbox.
2020-01-12 01:41:36 +01:00
Jami Kettunen
cece0d230d Applications: Add new keyboard shortcuts & update few existing ones 2020-01-01 01:23:27 +01:00
Jami Kettunen
33b8d37dd3 Applications: Space out SystemMonitor & TextEditor in AboutDialogs 2019-12-31 01:46:42 +01:00
Paweł Cholewa
e2dcf27a2e TextEditor: Ask before opening a file if current document is dirty
This commit should be a fix of issue #892
2019-12-22 09:10:26 +01:00
Andreas Kling
6425b8714a TextEditor: Handle drop events
We now handle drop events with data type "url-list". This makes it
possible to drop a file from FileManager on TextEditor to open it.
2019-12-20 20:07:10 +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
Sasan Hezarkhani
8cea5c053d TextEditor: `Fix bug when document is marked dirty on open.
Currently, when `set_text()` is called on GTextDocument a change is
triggered and all clients registered get a document_did_set_text
call. This in turn causes the TextEditorWidget to mark the document
as dirty even on the first open, which makes for a weird experience.
2019-12-06 19:45:13 +01:00
Andreas Kling
f8703d44cc TextEditor: Focus the editor widget on startup 2019-11-30 15:35:19 +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
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
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
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
45cfd57f6e GButton: Convert most code to using ObjectPtr for GButton 2019-09-21 19:28:28 +02:00
Andreas Kling
ff6ce422dd LibGUI: Convert GWidget to ObjectPtr 2019-09-21 17:05:35 +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
93851c3832 LibGUI: Convert GTextBox, GTextEditor and GResizeCorner to ObjectPtr 2019-09-21 15:46:47 +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
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
9d2c4d223a TextEditor+Base: Add an icon for the "Find" action :^) 2019-09-13 23:56:37 +02:00
Andrew Weller
16aba5100d TextEditor: Implement File/New Action
The user is asked if they want to save a dirty file before they create
a new one.
2019-09-06 18:38:26 +02:00
rhin123
f468634494 TextEditorWidget: Added GCommonActions 2019-09-05 09:40:54 +02:00
Andreas Kling
841f1276e6 TextEditor: Use GAboutDialog :^) 2019-09-02 19:48:47 +02:00
Andreas Kling
cfe09784a4 TextEditor: Clear the dirty flag in newly opened documents 2019-08-29 18:54:06 +02:00
Andreas Kling
72950f93a3 TextEditor: Move the Font menu inside the View menu
This will be our first user of the nested menus feature. :^)
2019-08-29 06:36:35 +02:00
Andreas Kling
b1763238d7 TextEditor: Ask the user before closing a dirty (modified) document
It's a little unfortunate that we have two separate code paths that can
lead to asking the user about this. Longer-term we should find a way to
unify these things.

Fixes #491.
2019-08-27 20:39:01 +02:00
Andreas Kling
ecbedda34c TextEditor: Add a "document dirty" flag and show it in the window title
This lets you know if the document has been modified since last save.
2019-08-27 20:18:19 +02:00
Andreas Kling
07933d0b46 TextEditor: Let's enable line wrapping by default 2019-08-27 17:05:01 +02:00
Andreas Kling
b6de723eb3 TextEditor: Move line wrapping setting to a new "View" menu 2019-08-27 17:01:52 +02:00
Andreas Kling
cef2c04952 TextEditor: Move all "File" menu entries into the app menu instead
It felt weird to have both the app menu *and* a "File" menu.
2019-08-26 17:59:05 +02:00
Andreas Kling
d5f3487203 TextEditor: Select everything in the find textbox when pressing Ctrl+F
This allows you to press Ctrl+F and immediately start typing a new
search string, instead of having to remove the old one first. :^)
2019-08-25 21:46:39 +02:00
Andreas Kling
e8e8741c88 LibGUI+TextEditor: Make GButton activate its action if present
Previously even if you assigned a GAction to a GButton, you still had
to activate() the action manually by hooking the GButton::on_click
callback.
2019-08-25 21:46:39 +02:00
Andreas Kling
ded005500d TextEditor: Add actions for find next/previous (Ctrl+G, Ctrl+Shift+G) 2019-08-25 21:46:39 +02:00
Andreas Kling
d88c40568f TextEditor: Add search-related actions to the text editor context menu
Using the new GTextEditor::add_custom_context_menu_action() mechanism.

Fixes #478.
2019-08-25 21:46:28 +02:00
Andreas Kling
97a695403b TextEditor: Add a menu action for turning line-wrapping on/off 2019-08-25 12:23:34 +02:00
Andrew Weller
e75e33eb46 TextEditor: Replaced 'Find' button with 'Prev' and 'Next' buttons. 2019-08-24 21:57:42 +02:00
Andreas Kling
b1bc7a1b5d TextEditor: Don't try to load contents of files we didn't even open
If the CFile::open() call fails, we shouldn't continue with trying to
load the file.
2019-08-23 19:11:56 +02:00
Andreas Kling
d56786ccd8 TextEditor: Avoid an unnecessary whole-file copy when opening something
This was left over from before we had the StringView(const ByteBuffer&)
constructor to help us.
2019-08-23 19:05:34 +02:00
Andreas Kling
fae379b1f0 TextEditor: Search box should find on return, close itself on escape
This patch adds basic keyboard access to the search box. We also yield
focus back gracefully to the text document when the search box is no
longer wanted.

Focus should probably move automatically when an ancestor of the
currently focused widget if made invisible..
2019-08-22 11:11:48 +02:00
Andreas Kling
96c5c9ce12 TextEditor: Hide the search bar until the user asks for it
You can get to it via Edit/Find, or by pressing Ctrl+F.
2019-08-22 11:02:03 +02:00
Andreas Kling
bb74832dd6 TextEditor: Add a search bar that allows you to search for text
If the text is not found, we show a friendly message box that says we
didn't find the text! :^)
2019-08-21 21:30:20 +02:00
rhin123
a175e76948 TextEditor: Include extension during SaveAs
When we save-as in the text editor we now auto-populate GFilePicker /w
the current name & extension.
2019-07-29 20:46:31 +02:00
Andreas Kling
b98c77229d TextEditor: Let's have line numbers starting at 1.
Thanks to Dan for pointing this out on IRC:

<danboid> I see TextEditor still numbers its lines from 0. You're too much of a programmer sometimes kling! :)
<  kling> that might be the most extreme form of "programmer design" I've seen in serenity
2019-07-27 21:20:38 +02:00