Commit Graph

98 Commits

Author SHA1 Message Date
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
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
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
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
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
841b2e5d13 WindowServer+LibGUI: Pass window icons as shared buffers rather than paths.
Now that we support more than 2 clients per shared buffer, we can use them
for window icons. I didn't do that previously since it would have made the
Taskbar process unable to access the icons.

This opens up some nice possibilities for programmatically generated icons.
2019-07-28 10:18:49 +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
Andreas Kling
eda272eec8 TextEditor: Add back lost "Save as..." action. 2019-07-27 20:32:19 +02:00
Rhin
d6cd98cfa1 TextEditor: Fix nullptr refrence to save action & m_path (#364)
We forgot to persist our actions in the constructor for later reference, whoops.
Also use the correct path in the "open" action.
2019-07-26 06:48:39 +02:00
Andreas Kling
442256b5f8 TextEditor: Add "Save as..." action.
Add a basic "save as" action to the TextEditor app, and make "save" fall
back to using "save as" if there's no name already set.

Fixes #282.
2019-07-24 06:32:30 +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
rhin123
9724d540b6 TextEditor: Show window icon 2019-07-17 21:14:14 +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
rhin123
1f77fbb75c TextEditorWidget: Stop dbgprintf from printing null 2019-07-16 08:34:51 +02:00
rhin123
1bcf3968f2 TextEditor: Show window after text_widget loads 2019-07-16 08:34:51 +02:00
rhin123
82d9410226 TextEditorWidget: Added improved save feature.
Instead of saving to a temp file, the TextEditorWidget now saves
to a path returned by the improved GFilePicker.
2019-07-15 18:33:33 +02:00
Andreas Kling
d0a2668833 TextEditor: Fix build (copy_ref() in outdated PR changes.) 2019-07-11 21:30:49 +02:00
Rhin
d7b836858e TextEditor: Move the application UI into a dedicated TextEditorWidget. (#292)
Added a main widget for the text editor as a stepping stone to add new features.
2019-07-11 20:52:33 +02:00
Andreas Kling
323704c851 TextEditor: Remove use of copy_ref(). 2019-07-11 16:04:53 +02:00