Commit Graph

55 Commits

Author SHA1 Message Date
haven1433
a080dedbdb fix plural "best match" goto
plural worked for finding anchors, but didn't work for best-match
2022-09-29 00:13:36 -05:00
haven1433
10c1ab44b1 tab navigation improvements 2022-09-22 22:42:08 -05:00
haven1433
3a1f92f422 bugfix
allow pasting raw data to expand the data
don't keep trying to update selection if the selection stops changing
2022-09-22 21:15:49 -05:00
Haven1433
b19dda6701 fix header update during single-table mode 2022-08-19 22:13:46 -05:00
Haven1433
c4d39c6ab2 fix goto when typing ho-oh 2022-06-02 22:23:54 -05:00
Haven1433
159c22e31a improve goto resolution
THUNDER should go to THUNDER, not THUNDERPUNCH
2022-05-29 20:56:47 -05:00
Haven1433
5780a52a3a fix duplicate goto bug 2022-05-12 22:51:12 -05:00
Haven1433
676e98da90 Don't allow fields in the table tool to goto null
* update the TabView to use the MethodCommand and delete the explicit command in the FieldArrayElementViewModel
* Raise CanAcceptChanged whenever the viewmodel gets updated/copied
* CanAccept can return false, by calling Selection.Goto's CanExecute method.
* Selection.CanExecute can return false if asked to jump to null.
2022-04-17 22:10:37 -05:00
Haven1433
1a2c14b85d allow goto to have a '-' offset 2022-03-17 09:53:06 -05:00
Haven1433
15622ec82d fix selection bug
Changing the lower limit to 4 breaks some tests, because coercing multiple table elements into a single line no longer works correctly. Lower the limit to 1 and rely on the logic from the rest of the limit to force at least 4 elements per line.
2022-03-13 10:30:14 -05:00
Haven1433
e9ec1361c5 Limit preferredWidth to 4->256 2022-03-12 21:18:04 -06:00
Haven1433
1d65ed8032 Don't allow 'Goto' to go past the end of the data 2022-02-01 20:21:34 -06:00
Benjamin Popp
4733934ad8 During single-table-mode, only allow selecting within the table 2021-05-15 20:49:46 -05:00
Benjamin Popp
79120cbe9a Track both view start and selection start during back/forward movement
If the selection is on screen, restore both the scroll and the selection.
If the selection is not onscreen, restore the scroll but not the selection.
2021-05-01 22:17:14 -05:00
Benjamin Popp
370b27eb0c In Single Table Mode, don't let the user select before the start 2021-04-22 21:04:22 -05:00
Benjamin Popp
14aa655bd6 Improve paste performance
During paste operations, we don't actually need autocomplete. It's important to keep the options in mind, but we can delay evaluation until they're actually used.

Change autocomplete related methods to return lazy IEnumerable objects instead of returning a pre-populated read-only list. Add a LazyList<T> class that can handle the once-time evaluation logic. If no element of the list is ever checked, then the auto-complete code never runs.

Change ViewPort's UpdateToolsFromSelection tha happens when the selection changes. Only evaluate it after the edit operation is complete.
2021-04-07 14:48:23 -05:00
Benjamin Popp
268b8b6246 First pass at ScrollRegion.AllowSingleTableMode
When this flag is active (single instance for the entire app, but propagated down to the ScrollRegion for use), the scroll region will respond differently to questions about its min/max scroll and the data length. This makes it possible to focus in on a single table that you're editing.
* This hides the "hex" part of the hex editor for simple use cases, and makes the right scrollbar actually useful for editing tables.
* It also makes it easier to focus in on individual tables and streams when jumping around with pointers.
2021-03-12 21:17:27 -06:00
Benjamin Popp
e726dd1676 Paste-script improvements
Allow @anchor(length) to create a new anchor in a location with at least (length) freespace. Length is in hex.
Allow thumb branch instructions to include an offset.
Allow goto instructions to include an offset.
2021-02-17 19:47:47 -06:00
Benjamin Popp
274fea6a47 'Brock' should still goto brock 2020-11-28 23:01:40 -06:00
Benjamin Popp
9a73f4bb24 Bugfix
when checking for element names, keep the original list without element names, since it still matters.
2020-10-01 12:36:58 -05:00
Benjamin Popp
c3f4a5a345 improve matching for named elements
"eevee" or "brock" now work correctly
2020-10-01 10:59:06 -05:00
Benjamin Popp
a4c0301d8c Implement Home/End
If there's no data format, Home/End jump to the start/end of the line.
If there's a data format, Home/End jump to the start/ed of that format.

This is useful for quickly jumping to the end of a table, or selecting an entire table, or selecting an entire string/image/etc.
2020-08-30 22:18:40 -05:00
Benjamin Popp
f2b0489a27 Allow goto-autocomplete to work for members as well 2020-08-08 19:06:36 -05:00
Benjamin Popp
d4809baa9f Make auto-select auto-complete better
model.GetNewPointerAutocompleteOptions assumes that there's a leading character (probably `<` or `@`) that must be stripped off before looking for matches. So add a leading character, else the first character entered by the user doesn't count towards matching.
2020-07-20 21:33:18 -05:00
Benjamin Popp
34c6783d97 Allow "goto" to work based on autocomplete when there's only one completion option available. 2020-07-16 20:15:35 -05:00
Benjamin Popp
030d8187ed Fix Tests 2020-06-05 14:14:07 -05:00
Benjamin Popp
9bfcdacb8a Introduce Row Width controls
Add 3 new properties to the ViewModel:
* Auto Adjust Data Width, which allows the selection to adjust the width after a goto based on the width of the target data.
* Allow Multiple Elements per Line, which allows the selection to adjust the width in multiples of the desired width, to better utilize the availabe space.
* Stretch Data, which signals the view that it should make cells wider if possible, up to twice their normal width.

All 3 of these preference are stored at the Editor level.

Add default styles for Toggle Buttons, Expanders, and Tooltips, since all 3 of those are now needed.
2020-06-03 07:49:58 -05:00
Benjamin Popp
ffe37fa9f4 Fix failing test
Also use automated code review
2020-05-27 23:28:39 -05:00
Benjamin Popp
781a2939be Allow creating pointers inline 2020-05-12 09:33:10 -05:00
Benjamin Popp
9a76e2c295 Allow following existing pointers during paste-scripts 2020-05-12 08:23:09 -05:00
Benjamin Popp
8e2fff931b Fix goto bug
goto frontsprites/charizard should work
goto tutorcompatibility/bu~2 should jump to butterfree
2020-04-23 23:21:45 -05:00
Benjamin Popp
167c442853 Allow AMap to open HMA as a scripting editor 2020-04-16 22:17:37 -05:00
Benjamin Popp
ae2947087b Clip leading 0x off gotos 2020-03-27 10:31:06 -05:00
Benjamin Popp
6730df22f0 Bugfixes
* goto should align for tablestreams
* selection was wrong for tablestream end tokens
* format drawer wasn't drawing tablestream end tokens
2019-12-05 22:58:04 -06:00
Benjamin Popp
f39f3dba84 table selection in tool always aligns hex content
The hex content normally jumps to a table when you select the table with the table tool. However, it doesn't jump if the table is already selected. The user experienced confusion, wanting to jump to the start of the table using the table drop-down, but they couldn't because they were already looking at that table.
2019-11-08 22:14:48 -06:00
Benjamin Popp
05d197b11a Performance fix
in some cases, auto-moving runs and then updating the selection was really slow. For example, updating pokenames (and related tables). This was due to a bug where the scroll value was being updated incorrectly, resulting in excessive horizontal panning to align the data.
2019-11-05 16:05:40 -06:00
Benjamin Popp
c2af96e975 Improve auto-alignment
When jumping into a table backwards from a pointer, the table should still be aligned to the start of individual elements.
2019-11-05 12:21:58 -06:00
Benjamin Popp
91b150fb3f Merge branch 'master' into dev 2019-10-09 07:28:04 -05:00
Benjamin Popp
9d0ff53376 Reset Alignment
`Goto -> table` will currently adjust the data alignment to make the table rows line up in a useful way. However, getting the alignment back to normal after that requires doing another goto, which isn't intuitive.

make it possible to reset the alignment to default via a button.
2019-10-08 10:44:35 -05:00
Benjamin Popp
8759b14105 Performance fix
don't call getSpan multiple times within the selectionStart update. Makes debugging easier.
2019-09-26 21:54:15 -05:00
Benjamin Popp
aa728fa159 Bugfix - copy/paste bit arrays should work
* Introduced a base class for view model tests that includes some standard useful setup code. It can also be used via composition.
* Updated ViewPortEditTests to use the new utility to clean up the tests somewhat.
* Added a new test to express the desired behavior for copy/paste related to bit arrays.
* Fixed logic in ContinueCellEdit/BitArray to allow spaces in typed bit array text
* Fixed logic in CompleteEditOperation/BitArray to parse bit arrays correctly
* Fixed a selection bug where goto would format for table width even if you go to a location _before_ the start of that table.
2019-09-26 21:46:17 -05:00
Benjamin Popp
d84972e3bc "Append" button -> "Add New" 2019-07-01 19:56:09 -05:00
Benjamin Popp
ec3179f32c more cache scopes 2019-06-29 15:49:01 -05:00
Benjamin Popp
60be3bd7e6 Updates from review
* code quality improvements
* fix a crash when backspacing egg formats
* fix a crash when backspacing all the way to empty
* fix data corruption when edit-exiting multi-byte formats
*
2019-05-22 22:08:57 -05:00
Benjamin Popp
d31ba98efe Bug Fixes
* Don't offer table tool in context menu of loose text
* Yield buttons for IContextItems with commands
* Ctrl+Click on pointer out of range returns an error
* Auto-moving a parent table that's being extended notifies about the move.
2019-05-12 13:30:13 -05:00
haven1433
7190a434b4 Prep work to improve rombase compatibility 2019-05-04 14:11:37 -05:00
Benjamin Popp
ecb2ceb2fb update: make it impossible to select a single cell of a pointer/int/enum.
all the cells come together as a single package.
this clears up some confusion as to which byte you're editing... hopefully.
2019-04-26 07:10:59 -05:00
Benjamin Popp
82e2d3cb73 fix button X on tab -> was too small
array format element defaults to single byte '.'
update table headers as format updates
update table tool as format updates
2019-04-18 15:47:38 -05:00
Benjamin Popp
1b0c1ede25 only update the headers when scrolling left/right or when the width changes.
hide the start screen while there are any tabs
Allow Horizontal Scrolling of the data area insetad of wrapping for wide tables.
Notify on width change only after scrolling is complete when jumping to anchors.
Fix a bug where scrolled table headers didn't display correctly.
2019-04-07 00:02:41 -05:00
Benjamin Popp
585b203455 first round of usability feedback from UT4
- trying to edit a pointer but not starting with '<' now auto-inserts the leading '<'
- trying to complete a pointer without the closing '>' now auto-inserts the trailing '>'
- trying to make a pointer content with just two hex characters interprets as a hex byte
- goto with <> braces strips the braces
- goto with leading 8 or 9 (such as 8123456) subtracts 8000000
- right-click on text has a copy option
- enter, clicking off, or arrow keys now commit instead of reject
- copying an unnamed anchor names the anchor
- pasting an anchor with a used name renames the new anchor
2019-04-06 14:16:43 -05:00