Commit Graph

62 Commits

Author SHA1 Message Date
Max Wipfli
915cce5b74 Spreadsheet: Remove usage of URL::set_path()
This replaces a call to URL::set_path() with URL::set_paths(), as
set_path() will be deprecated and removed.
2021-06-01 09:28:05 +02:00
Brandon Hamilton
6219c3ec3c Spreadsheet: Keep value when clicking out of a cell 2021-05-31 16:57:18 +04:30
Jelle Raaijmakers
2c772d1848 LibGUI/AbstractView: Remove on_selection
Since the introduction of multi-select, we have had both `on_selection`
and `on_selection_change`, the latter of which was only invoked when a
change in selection came in through the model.

This removes `AbstractView::on_selection` and replaces it usage with
the more explicit `on_selection_change` everywhere.
2021-05-26 17:39:13 +04:30
Max Wipfli
229414b002 Applications: Use titlecase and distinct underlined characters in menus
This changes (context) menus across the system to conform to titlecase
capitalization and to not underline the same character twice (for
accessing actions with Alt).
2021-05-21 18:41:28 +01:00
Linus Groh
9dd3203cc6 LibGfx: Add missing TextAlignment::BottomLeft 2021-05-21 08:04:31 +02:00
Andreas Kling
31d4bcf5bf Userland: Tighten a *lot* of pledges! :^)
Since applications using Core::EventLoop no longer need to create a
socket in /tmp/rpc/, and also don't need to listen for incoming
connections on this socket, we can remove a whole bunch of pledges!
2021-05-13 23:28:40 +02:00
Linus Groh
91eda22208 Everywhere: Add Alt shortcuts to remaining top-level menus
Not sure why some menus did have one and others didn't, even in the
same application - now they all do. :^)
I added character shortcuts to some menu actions as well.
2021-05-12 18:09:42 +01:00
Ali Mohammad Pur
a91a49337c LibCore+Everywhere: Move OpenMode out of IODevice
...and make it an enum class so people don't omit "OpenMode".
2021-05-12 11:00:45 +01:00
Andreas Kling
840b908c0b Applications: Convert StringBuilder::appendf() => AK::Format 2021-05-07 21:12:09 +02:00
Linus Groh
d9702ff561 Spreadsheet: Use shrink-to-fit for cell fg/bg color input layout
This fixes an issue where the bottom of both color inputs was cut off
due to insufficient, hardcoded height.
2021-05-05 15:30:45 +01:00
Andreas Kling
d47f15ab8b LibGUI: Rename ScrollableWidget => AbstractScrollableWidget 2021-05-03 21:03:13 +02:00
Andreas Kling
4b0098e52f Everywhere: Rename app_menu to file_menu or game_menu 2021-05-01 17:40:54 +02:00
Tobias Christiansen
ef8f97635e Spreadsheet: Use String::bijective_base_from for column name resolution
Updated Spreadsheet to use the new way of converting a number to a
String represenation using the alphabet.
The code responsible for this conversion now lives in AK/String, so it
gets deleted from Spreadsheet.cpp.
2021-05-01 01:19:40 +02:00
Andreas Kling
3d4afe7614 Everywhere: "indexes" => "indices"
I've wasted a silly amount of time in the past fretting over which
of these words to use. Let's just choose one and use it everywhere. :^)
2021-04-29 22:23:52 +02:00
Brian Gianforcaro
adcd56473c Tests: Enable Spreadsheet unit tests so they actually build 2021-04-29 10:37:26 +02:00
Andrew Kaster
35c0a6c54d AK+Userland: Move AK/TestSuite.h into LibTest and rework Tests' CMake
As many macros as possible are moved to Macros.h, while the
macros to create a test case are moved to TestCase.h. TestCase is now
the only user-facing header for creating a test case. TestSuite and its
helpers have moved into a .cpp file. Instead of requiring a TEST_MAIN
macro to be instantiated into the test file, a TestMain.cpp file is
provided instead that will be linked against each test. This has the
side effect that, if we wanted to have test cases split across multiple
files, it's as simple as adding them all to the same executable.

The test main should be portable to kernel mode as well, so if
there's a set of tests that should be run in self-test mode in kernel
space, we can accomodate that.

A new serenity_test CMake function streamlines adding a new test with
arguments for the test source file, subdirectory under /usr/Tests to
install the test application and an optional list of libraries to link
against the test application. To accomodate future test where the
provided TestMain.cpp is not suitable (e.g. test-js), a CUSTOM_MAIN
parameter can be passed to the function to not link against the
boilerplate main function.
2021-04-25 09:36:49 +02:00
Linus Groh
97d49cb92b LibJS: Consolidate exception function names and source ranges
Instead of storing the function names (in a badly named Vector<String>)
and source ranges separately, consolidate them into a new struct:
TracebackFrame. This makes it both easier to use now and easier to
extend in the future.
Unlike before we now keep each call frame's current node source range
in the traceback frame next to the function name, meaning we can display
line and column numbers outside of the VM and after the call stack is
emptied.
2021-04-24 20:11:04 +02:00
Andreas Kling
b91c49364d AK: Rename adopt() to adopt_ref()
This makes it more symmetrical with adopt_own() (which is used to
create a NonnullOwnPtr from the result of a naked new.)
2021-04-23 16:46:57 +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
Lenny Maiorani
ece8aeaaf4 Everywhere: Remove redundant inline keyword with constexpr
Problem:
- `constexpr` functions are additionally decorated with `inline`
  keyword. This is redundant since `constexpr` implies `inline`.

Solution:
- Remove redundancies.
2021-04-21 20:49:49 +02:00
Andreas Kling
a2baab38fd Everywhere: It's now "Foobar", not "FooBar", and not "foo bar"
I hereby declare these to be full nouns that we don't split,
neither by space, nor by underscore:

- Breadcrumbbar
- Coolbar
- Menubar
- Progressbar
- Scrollbar
- Statusbar
- Taskbar
- Toolbar

This patch makes everything consistent by replacing every other variant
of these with the proper one. :^)
2021-04-13 16:58:15 +02:00
Linus Groh
da177c6517 LibJS: Make Errors fully spec compliant
The previous handling of the name and message properties specifically
was breaking websites that created their own error types and relied on
the error prototype working correctly - not assuming an JS::Error this
object, that is.

The way it works now, and it is supposed to work, is:

- Error.prototype.name and Error.prototype.message just have initial
  string values and are no longer getters/setters
- When constructing an error with a message, we create a regular
  property on the newly created object, so a lookup of the message
  property will either get it from the object directly or go though the
  prototype chain
- Internal m_name/m_message properties are no longer needed and removed

This makes printing errors slightly more complicated, as we can no
longer rely on the (safe) internal properties, and cannot trust a
property lookup either - get_without_side_effects() is used to solve
this, it's not perfect but something we can revisit later.

I did some refactoring along the way, there was some really old stuff in
there - accessing vm.call_frame().arguments[0] is not something we (have
to) do anymore :^)

Fixes #6245.
2021-04-12 09:38:57 +02:00
Dawid Wolosowicz
f05cca7a9a Spreadsheet: Declare the extern GML variable as an array, not a pointer
Part of #5906
Fixes #5943
2021-04-04 00:38:02 +02:00
Edgar Araújo
ca90a2029d Everywhere: Change font properties to be described in GML 2021-03-29 09:10:23 +02:00
Edgar Araújo
243d7d9ecf Everywhere: Remove empty {} from GML objects 2021-03-29 09:10:23 +02:00
AnotherTest
ccf84a4709 Spreadsheet: Ignore extra empty lines after the rows
We now ignore the last CRLF in e.g.
```csv
aaa,bbb,ccc CRLF
zzz,yyy,xxx CRLF
```
2021-03-28 11:46:47 +02:00
AnotherTest
894bfa30a2 Spreadsheet: Make the CSV reader more lenient
This adds an option "Lenient" that makes the reader conform to what
appears to be the norm in spreadsheet-land:
- Treat missing values as empty ones
- Update previously read rows if another row with more columns are seen
  afterwards
2021-03-28 11:46:47 +02:00
AnotherTest
102065a8a9 Spreadsheet: Show the error (if any) in csv import dialog's preview
...and don't try to read from a CSV that has errors.
Fixes #5942.
2021-03-28 11:46:47 +02:00
Andreas Kling
247717431d LibGUI: Make GUI::Widget::event() protected 2021-03-28 11:25:40 +02:00
Andreas Kling
78b12e1521 Userland: Turn all application menus into window menus :^) 2021-03-25 22:14:09 +01:00
David Isaksson
391d1ddfd8 Spreadsheet: Ensure that cell exists on drop event for text data
Fixes crash where we tried to get a cell to set text from the drop
event. We now create the cell if it does not already exists.

Fixes issue #5923
2021-03-24 20:36:41 +01:00
Linus Groh
40eab55e7d LibJS: Remove as_size_t()
Just like to_size_t() - which was already removed in f369229 - this is
non-standard, use to_length() instead. One remaining use was removed,
and I'm glad it's gone. :^)
2021-03-23 08:22:39 +01:00
AnotherTest
ba2df70eab Spreadsheet: Do not assume that a worksheet always exists
Fixes #5910.
Fixes #4822 (as far as I can tell).
2021-03-22 17:46:17 +01:00
AnotherTest
534626f917 Spreadsheet: Save the cells under the correct name
This broke in 6a6f19a72f, which replaced
the representation of columns with numbers.
As a result, the save logic would store cells as
"\x<column_index><row_number>", which is obviously wrong.
Fixes #5905.
Also simplifies the control flow in `import_worksheet` a bit.
2021-03-22 17:46:17 +01:00
AnotherTest
7b4fa860d2 Spreadsheet: Check for parse errors after parsing the source
There won't be any parse errors before we actually try to parse
something.
Fixes input like "=1+" crashing the spreadsheet instead of just causing
an error in the cell.
2021-03-22 17:46:17 +01:00
AnotherTest
fef165f1d2 Spreadsheet: Do not assume that user input has balanced parenthesis
Otherwise people with broken paren keys, or people with entertaining
ideas like "=9\b)" will cause an assert to trip.
Fixes #5909.
2021-03-22 17:46:17 +01:00
AnotherTest
9b68f91c0b Spreadsheet: Add an export wizard, and support for custom CSV exports
Fixes #4269.
2021-03-22 07:43:58 +01:00
AnotherTest
bba3a7a2cb Spreadsheet: Ignore empty cells when calculating data bounds
There's no reason to use extra rows/columns to represent empty cells
when exporting.
2021-03-22 07:43:58 +01:00
AnotherTest
8bd138cbbe Spreadsheet/XSV: Make the writer respect QuoteAll
Also make the header container type generic, and name an enum.
2021-03-22 07:43:58 +01:00
AnotherTest
3c151b3de6 Spreadsheet: Add an import wizard, and add support for custom CSV files
Fixes the import half of #4269.
2021-03-22 07:43:58 +01:00
AnotherTest
3bbcde9192 Spreadsheet/XSV: Add at() accessors
These are just aliases for operator[].
Also make the headers() getter return a vector of empty strings when the
csv file has no explicit headers.
2021-03-22 07:43:58 +01:00
AnotherTest
c1d67d6b17 Spreadsheet: Don't assume that the 'cells' field is an object
It might be missing, or not be an object.
Fixes #4821.
2021-03-22 07:43:58 +01:00
AnotherTest
9f8d518e82 Spreadsheet: Only append new columns/rows every 50ms
Fixes #5550.
2021-03-22 07:43:58 +01:00
thankyouverycool
7beae8042a Spreadsheet: Set default width for columns 2021-03-18 07:49:55 +01:00
Andreas Kling
d792200a55 LibJS: Rename GlobalObject::initialize() => initialize_global_object()
This function was shadowing Object::initialize() which cannot be called
on global objects and has a different set of parameters.
2021-03-17 16:53:35 +01:00
Andreas Kling
ef1e5db1d0 Everywhere: Remove klog(), dbg() and purge all LogStream usage :^)
Good-bye LogStream. Long live AK::Format!
2021-03-12 17:29:37 +01:00
Idan Horowitz
147d30ae4f Spreadsheet: Implement the cut operation for cells
This is done by adding another field to our custom
text/x-spreadsheet-data mime-type that specifies the
action (just copy/cut for now)
2021-03-01 11:37:02 +01:00
thankyouverycool
132ca7e37b Spreadsheet: Merge File menu into 'Spreadsheet' app menu
This is the common convention among the other apps. Also remove
a superfluous separator
2021-02-26 13:50:00 +01:00
Jelle Raaijmakers
9473c694dc Spreadsheet: Fix cell identifier label
Commit 6a6f19a72 broke the cell position display in the top left of the
Spreadsheet window and the title of the cell type dialog, causing the
application to crash when interacting with cells beyond column FE.
2021-02-25 23:32:22 +01:00
AnotherTest
6a6f19a72f Spreadsheet: Store the column index in a Position instead of its name
This will make constructing (and destructing) Positions a lot cheaper
(as it no longer needs to ref() and unref() a String).
Resulted from #5483, but doesn't fix it.
2021-02-24 21:02:02 +01:00