1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-07-07 07:28:57 +00:00
Commit Graph

20 Commits

Author SHA1 Message Date
Andy McFadden
1a9f99098a Wire up undo, redo, and F1 help
Also, fixed some crashiness in the can-execute tests for hints.
If you crash an a can-execute method you get a really unhelpful
failure message.  Asserts don't work there either.  Yay WPF.
2019-06-11 16:27:15 -07:00
Andy McFadden
41b6a97408 Populate toolbar icons
Extract some XAML icons from the VS2017 Image Library.  There's no
particular reason to prefer XAML over PNG, but somehow it feels
more forward-compatible.  (OTOH, defining images as ControlTemplate
instances is just weird.  Yay WPF.)
2019-06-11 14:38:08 -07:00
Andy McFadden
9c8afab2ea Restore selection and top position after change
Restoring the selection works pretty much like it used to, though
I'm capping the total size of the selection because it goes into
stupid-slow mode if you have too many elements.

Getting the item that is at the top of the ListView is astoundingly
obscure, due to the ListView's extreme generality.  I make a
simplifying assumption -- that we're using a VSP -- which allows us
to use a simple vertical offset once we've dug the appropriate
object out of the visual tree.  (The alternative is to walk through
the list of items and see what's on screen, or perform a hit test
calculation in the upper left corner.)  Yay WPF.
2019-06-10 15:46:35 -07:00
Andy McFadden
0c682e9cff Wire up References panel
Output to DataGrid is working.  Don't yet handle double-clicks or
preserve column widths.
2019-06-09 18:09:00 -07:00
Andy McFadden
814ab97c4d Wire up the Info panel 2019-06-09 14:24:46 -07:00
Andy McFadden
80ec6b6c78 Add selection analysis
The various items in the Actions menu are enabled or disabled based
on the current selection.  There's no SelectedIndices property in
WPF ListViews, so we have to do things slightly differently.

The SelectedItems list isn't kept sorted to match the list contents,
so finding first/last item requires a bit of scanning.

Also, rearranged some stuff.  I'm trying to keep the old and new
code somewhat parallel, to make it easier to walk through at the end
and see if I've missed something.
2019-06-08 16:13:04 -07:00
Andy McFadden
558f1e4350 Wire up selection tracking
Renamed VirtualListViewSelection to DisplayListSelection, because
it's now tied to the DisplayList implementation.  Hooked it up to
handle SelectionChanged events.

Also, tweaked the code list item style to remove the one-pixel gap
between items.  Somehow I manage to click on the dead zone with
surprising regularity.
2019-06-07 17:25:04 -07:00
Andy McFadden
fdbd5b89e9 More menu stuff
Create context menu as a clone of the Actions menu.  This is a bit
easier than it was in WinForms because the ICommand stuff provides
common routing and enable/disable logic for all instances.  (It's
one of the few places where WPF has made my life easier.  Yay WPF.)

Added CanExecute tests to existing items.  Currently they just
check to see if the project is open.

Wired up File > Close.
2019-06-07 14:03:34 -07:00
Andy McFadden
499d3478ba Add multi-key combo handling for hints
Doesn't work 100% correctly -- in some cases, using two different
combos in quick succession will fail -- but it's close.

Added stub methods for the four hint operations.
2019-06-04 16:10:55 -07:00
Andy McFadden
a7d66e67e0 Fiddle with selection
There was a bigger change here, but the approach turned out to
have some problems with large sets.  The current app saves and
restores the selected rows when you make an edit, retaining the set
of selected bytes even if the number of lines changes (maybe you
reformatted bytes into a string).  There's no way to do that quickly
with WPF when the number of selected items gets large (say 10K+).
I will probably just cap the selection, and refuse to restore it if
it exceeds a certain size.

The ListView SelectedItems management seems to use an O(n^2) (or
worse) algorithm.  It might be trying to verify that items being
added to SelectedItems actually exist in Items -- I can see it
calling Contains().  Whatever the case, it's a big step backward
performance-wise from WinForms.  Yay WPF.

See the DisasmUiTest project's Selection Test to see what I tried.
2019-05-29 17:39:36 -07:00
Andy McFadden
17af7efbbb Show formatted data in the code list
The disassembled lines are now shown in the custom-styled list view.
The DisplayList isn't being kept up to date on edits, but since we
can't edit anything yet that's not too limiting.

Pulled more code over, including the mostly-GUI-agnostic bits of the
source generation and assembler execution code.
2019-05-27 18:52:25 -07:00
Andy McFadden
c4a056bd0a Merge ListView style from DisasmUiTest project
Long comments and notes now occupy the correct columns.
2019-05-23 13:38:41 -07:00
Andy McFadden
7bed043869 Tweak code list view
Still not right, but it's at least you can tell which lines are
selected now.

I never thought I'd miss owner-drawn ListViews.  I was mistaken.
Yay WPF.
2019-05-12 16:27:28 -07:00
Andy McFadden
bca1585571 Experiment with a ListView style
I'm trying to make the ListView look like the old owner-drawn
WinForms UI.  The tricky bit is getting long comments and notes to
start in column 5 (label) and extend across multiple columns.

This approach sort of works, though it's currently incomplete, e.g.
the selection highlight style apparently gets dropped.
2019-05-12 14:30:10 -07:00
Andy McFadden
f3f4c44633 Refactor DisplayList to support data virtualization
In WinForms, if you want a virtual ListView, you set the "virtual"
property and define a couple of callbacks.  In WPF, there are
separate notions of "UI virtualization" and "data virtualization".
The former is done automatically (usually) by the ListView.  The
latter requires creating an implementation of IList, and relies on
behavior that I'm having trouble finding in official documentation.
Yay WPF.

This splits the source-generation stuff out into DisplayListGen,
leaving DisplayList as a list of stuff to display that can be bound
to WPF as a ListView ItemsSource.  The DisplayList instance will have
a hook back into DisplayListGen to perform the on-demand string
rendering.  (For now it's just generating test patterns.)
2019-05-11 10:16:54 -07:00
Andy McFadden
d830605f5e Add a place-holder code ListView
Set up a notifiable property to control whether the "launch panel"
(i.e. the thing you see when the app launches) or the code ListView
is visible.  Unearthed the magic required to left-justify the column
headers.
2019-05-09 16:13:20 -07:00
Andy McFadden
ce27ae720e Port project loader code
Created a file to hold the non-WPF parts of ProjectView.cs.
Pulled some code related to project loading into it.  Created a few
related dialogs.
2019-05-05 16:50:28 -07:00
Andy McFadden
c976b92f34 Show app version
Done with full WPF fanciness, including XAML string formatting and
property extraction, with a fallback value so I can see what it looks
like in the designer.

It took about half an hour to figure this out.  Yay WPF.
2019-05-03 15:43:16 -07:00
Andy McFadden
575f834b1d Copy some non-UI code over
Mostly a straight copy & paste of the files.  The only significant
change was to move the localizable strings from Properties/Resources
(RESX) to Res/Strings.xaml (Resource Dictionary).  I expect a
number of strings will no longer be needed, since WPF lets you put
more of the UI/UX logic into the design side.

I also renamed the namespace to SourceGenWPF, and put the app icon
into the Res directory so it can be a resource rather than a loose
file.  I'm merging the "Setup" directory contents into the main app
since there wasn't a whole lot going on there.

The WPF Color class lacks conversions to/from a 32-bit integer, so
I added those.

None of the stuff is wired up yet.
2019-05-02 15:45:40 -07:00
Andy McFadden
8ceae370cc Add WPF app skeleton
Just some XAML for the main work area.
2019-04-29 16:34:09 -07:00