Commit Graph

21 Commits

Author SHA1 Message Date
Ali Mohammad Pur
5e1499d104 Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
2023-12-17 18:25:10 +03:30
kleines Filmröllchen
fc5cab5c21 Everywhere: Use MonotonicTime instead of Duration
This is easily identifiable by anyone who uses Duration::now_monotonic,
and any downstream users of that data.
2023-05-24 23:18:07 +02:00
kleines Filmröllchen
213025f210 AK: Rename Time to Duration
That's what this class really is; in fact that's what the first line of
the comment says it is.

This commit does not rename the main files, since those will contain
other time-related classes in a little bit.
2023-05-24 23:18:07 +02:00
Andreas Kling
21db2b7b90 Everywhere: Remove NonnullOwnPtr.h includes 2023-03-06 23:46:35 +01:00
Andreas Kling
359d6e7b0b Everywhere: Stop using NonnullOwnPtrVector
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
2023-03-06 23:46:35 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
thankyouverycool
510551bb4f LibGUI: Add fallible try_push() variant to UndoStack 2022-07-06 14:25:30 +02:00
Lenny Maiorani
fe3b846ac8 Libraries: Use default constructors/destructors in LibGUI
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-03-12 14:44:43 -08:00
Andreas Kling
c4cc796f86 LibGUI: Make GUI::UndoStack remember time it was last set to unmodified
This can be used to determine how much time has passed since a document
was saved. :^)
2022-01-04 21:49:44 +01:00
Andreas Kling
c670d8c56d LibGUI: Add UndoStack::{undo,redo}_action_text()
These return the action_text() for the current undo and redo commands,
if available.
2021-05-08 22:17:51 +02:00
Andreas Kling
161568103e LibGUI: Remove UndoStack's automatic command combo'ing
UndoStack will now merge adjacent commands *if they want to be merged*
instead of bundling everything you push onto it until you tell it
to "finalize the combo."

This uses less memory and gives applications full control over how
their undo stacks end up. :^)
2021-05-08 22:17:51 +02:00
Maciej Zygmanowski
ece300e1e3 LibGUI: Add missing <AK/Function.h> include 2021-05-08 13:19:24 +01:00
Andreas Kling
0cb6103928 LibGUI: Add UndoStack::on_state_change hook
This will allow clients to react to the undo stack changing state.
It's invoked when the stack or clean index are changed.
2021-05-08 13:49:34 +02:00
Andreas Kling
74a4571f02 LibGUI: Reverse internal direction of GUI::UndoStack
The undo stack was very difficult to understand as it grew by adding
new undo commands to the front of the internal vector. This meant we
had to keep updating indices as the stack grew and shrank.

This patch makes the internal vector grow by appending instead.
2021-05-08 13:49:34 +02:00
Andreas Kling
2ef4fbc5c1 Revert "LibGUI: Fix undo stack reporting wrong modified state"
This reverts commit 0b7e19e2bb.

Let's reverse the direction of the undo stack to fix the confusion.
2021-05-08 13:48:15 +02:00
Carlos César Neves Enumo
0b7e19e2bb LibGUI: Fix undo stack reporting wrong modified state
Since the `redo` action never goes back to `index: 0`,
we have to mark the clean index as being the current
non-empty index for the undo/redo navigation to work properly.

The problem is that if we never `undo`, the stack index stays at zero,
which is the empty container waiting for commands. In that situation,
if we save the document, it registers the clean index as being 1
(the non-empty index) but because the stack index has never left zero,
the document was being reported as modified, being out of sync with
the window modified state.
2021-05-08 09:55:45 +01:00
Andreas Kling
295cc123c7 LibGUI: Rename UndoStack internals
Since we keep a stack of command combos, let's call entries on the
stack "Combo" instead of "UndoCommandsContainer".

And since it has a vector of commands, let's call it "commands"
instead of "m_undo_vector".
2021-05-08 08:53:37 +02:00
Carlos César Neves Enumo
928f16d360 LibGUI: Remember modified state on undo/redo actions 2021-05-06 08:40:26 +02:00
Carlos César Neves Enumo
67537bfc80 LibGUI: Clear undo stack when opening a new document 2021-05-06 08:40:26 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00