1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-07-06 16:29:03 +00:00
Commit Graph

190 Commits

Author SHA1 Message Date
Andy McFadden
779566c236 Implement Find / Find Next
Also, tweaked Edit Label a bit.  I figured out how to make the
TextBox SelectAll+Focus work when the text is bound to a property.
2019-07-07 13:34:47 -07:00
Andy McFadden
741f7ef46a Implement Edit Label
The dialog is pretty straightforward.  This is the first editor that
can cause a partial update -- if you edit a label, only the lines
that refer to that label are regenerated -- so I added the code for
partial display list updates as well.

Also, while working on this I noticed that long comments were getting
ellipsized at a bad place.  The column width for the semi-hidden
column used for notes and long comments wasn't getting set.  After
fiddling with it a bit I determined that it really needed to be set to
the sum of the widths of the rightmost four columns, and updated
whenever column sizes change.  This was easier to do than I expected.
I may actually be getting the hang of WPF.
2019-07-06 17:24:42 -07:00
Andy McFadden
33c4b86b44 Implement "about" dialog 2019-07-06 15:51:57 -07:00
Andy McFadden
83fe70535b Port source generation test harness
I haven't figured out how to make the AppendText(text, color) extension
work right with the WPF version of RichTextBox, but I was able to work
around the issue, and it's not really worth sinking time into.
2019-07-06 14:20:51 -07:00
Andy McFadden
9aa8b5c9a7 Minor documentation updates
Also, placate consistency hobgoblins.
2019-07-06 10:58:24 -07:00
Andy McFadden
8d78ce028a Implement remaining properties tabs ("Symbol Files", "Extension Scripts")
Simple ListBox controls with strings.
2019-07-05 16:20:31 -07:00
Andy McFadden
9c6920ae68 Be a bit more WPF-ish on the OK button management 2019-07-05 15:05:42 -07:00
Andy McFadden
3cc4307484 Implement second project properties tab ("Project Symbols")
Implemented the symbol list, and the Edit Symbol dialog.
2019-07-05 14:53:45 -07:00
Andy McFadden
a23b048cb4 Implement first project properties tab ("General")
Also, added some whitespace to the layout.

Also, removed some redundant fields from the app settings editor.
2019-07-03 14:27:54 -07:00
Andy McFadden
758d95e331 Rough project properties layout 2019-07-01 14:07:30 -07:00
Andy McFadden
f4cb5cd8b8 Implement fourth settings tab ("Pseudo-Op")
Largely unchanged from WinForms version.  Creating and binding
properties for every field seemed tedious.
2019-06-30 13:54:50 -07:00
Andy McFadden
d65acc2121 Implement third settings tab ("Display Format") 2019-06-30 13:25:04 -07:00
Andy McFadden
8907197d58 Clean up clipboard format combo box
The order of items in XAML was tied to enum values, which isn't
great.  Since the value gets stored in the settings file, we want
the values to come from the code-behind.  So now we provide an
ItemsSource for the combo box from the code-behind instead of
defining the items in XAML.
2019-06-28 15:39:35 -07:00
Andy McFadden
7e0faf2800 Rework column width input
Took another swing at doing things WPF-style.  Ended up with TextBox
objects backed by integer fields, which worked pretty well but
didn't get the min/max values.  Set up validation instead, once I
figured out how to make it update in real time.
2019-06-28 15:17:48 -07:00
Andy McFadden
5beae8f926 Implement second settings tab ("Asm Config")
Relatively straightforward, thanks to the way WPF ComboBoxes work.
Spent some time fiddling with the column width text boxes, but
ended up with essentially the WinForms approach.
2019-06-27 15:15:58 -07:00
Andy McFadden
3616a26b01 Neglected to add a file
Font measurement helper functions.
2019-06-26 21:54:12 -07:00
Andy McFadden
c13daa7085 Implemented the first ("Code View") tab of settings
Notable items include the column show/hide buttons, which were
straightforward except for the "determine the default width" part,
and the font picker, which is no longer a standard dialog.  The
latter was complicated by the absence of a good way to detect
whether a font is mono-spaced or not without calling back into code
meant for WinForms font manipulation (with a dash of PInvoke).
Yay WPF.

Also, enabled character ellipsis for code list items.
2019-06-26 17:11:58 -07:00
Andy McFadden
0a96e014e2 Layout for app settings
Multi-tab dialog with tons of controls.

Also, fixed WorkProgress owner, and removed debug delay from source
gen dialog.
2019-06-24 17:32:53 -07:00
Andy McFadden
8d8112f5c9 Finish generate/assemble dialog
Added the progress dialog as a relatively generic thing (it was
implemented as a pair of dialogs in the WinForms version, for no
very good reason).  Generation and assembler execution works.
2019-06-24 14:41:08 -07:00
Andy McFadden
985eba804b First pass at Generate & Assemble dialog
Got the basic parts laid out and working, but it depends on the
progress dialogs to do actual work.
2019-06-23 17:24:51 -07:00
Andy McFadden
b91124999a Implement "new project"
WPF TreeViews are much different from WinForms.  Unexpectedly, they're
actually simpler and easier to work with.
2019-06-22 17:38:07 -07:00
Andy McFadden
6b29ce98f9 Implement "recents" feature
Add the list of recent projects to File > Recent Projects when the
sub-menu opens.  Make the buttons on the launch panel work correctly.
2019-06-22 14:41:09 -07:00
Andy McFadden
7d2fe51b41 Implement File > Exit 2019-06-22 13:20:31 -07:00
Andy McFadden
8f09cb2942 Rework Edit Status Flags layout
The Grid is a more natural fit.  Disabling M/X/E for 6502 is slightly
less convenient.
2019-06-22 13:09:49 -07:00
Andy McFadden
0041584d2e Rework NavStack
Instead of traversing a single dual-element stack, use separate
stacks for forward and backward.

Record whether the jump was from a Note, so we select the right
set of lines when we return to it.

If nothing is selected, push the current top position on, instead
of doing nothing at all.

Correctly handle the case where somebody is trying to jump to the
current position.
2019-06-22 11:36:08 -07:00
Andy McFadden
c87d79ec9e Wire up Open, Save, and Save As
These just needed to have methods added to the command definitions.

Also, added a style to the toolbar buttons so they fade when not
enabled.

Also, fixed the DataFileLoadIssue dialog, which was seriously broken.
2019-06-21 16:27:58 -07:00
Andy McFadden
440deda743 Tweak header letter position
This feels like Doing It Wrong, but some of the letters just don't
look centered over their radio buttons.  Nudge them a pixel.
2019-06-21 15:31:14 -07:00
Andy McFadden
34e6a2a086 Fiddle with failure report dialogs
I was setting the window size and letting the contents fill to fit.
Now I'm setting the content size and letting the window size itself
to fit around it.  The latter feels like it'll hold up better as
things change.
2019-06-21 15:23:13 -07:00
Andy McFadden
007bf4e934 Rename ProjWin directory to WpfGui
"ProjWin" didn't really mean anything.  "WpfGui" emphasizes that
the contents are a WPF implementation of the GUI elements.

No substantive changes.
2019-06-21 15:17:04 -07:00
Andy McFadden
fdf53bdb34 Add status flag editing
Getting the layout just right got a little wordy in XAML.  There's
probably a way to make a Grid do what I want.  This'll do for now.

Also, fixed the labels on the buttons in DiscardChanges, which were
reversed.
2019-06-21 15:06:04 -07:00
Andy McFadden
ea6125ea82 Save and restore grid column widths
Now preserving column widths for the three DataGrids and the main
ListView.  In theory the various grids would conveniently auto-size
to the content, but in practice that doesn't work well with
virtualization.

There is, of course, no simple "the width has changed" event
provided by the control.  On the plus side, you can attach a
property-change event handler to pretty much anything, so once you
know the trick it's possible to make everything work.  Yay WPF.
2019-06-20 15:10:35 -07:00
Andy McFadden
96a92f0335 Load/save app settings
This change pulls in the settings file code, which is mostly
unchanged except when it comes to saving and restoring the window
location and size.

The old system has been replaced with a PInvoke-based version that
calls the underlying Win32 window placement code.  This is more
likely to be correct when multiple displays are in use, and can
record the un-maximized size of a maximized window.  It leaves a
nasty XML string embedded in the config file, but it's not really
meant to be human-readable anyway.

The sub-window dividers all work completely differently from the way
they did in WinForms, and some of the behavior is a bit obscure
(like noticing when a splitter moves due to keyboard input, and
setting the position in a way that doesn't break the auto-sizing).
Yay WPF.

Still need to preserve column widths.
2019-06-19 18:09:55 -07:00
Andy McFadden
7339d2a681 Move symbol sort comparison function into Symbol class 2019-06-17 12:44:02 -07:00
Andy McFadden
f32135e2c7 Set Owner for all modal dialogs
This turns out to be really important.  Otherwise the modal dialog
doesn't stay on top of the application's window stack, which can
make things awkward when ShowInTaskbar is set to false.  The easiest
way to ensure this is getting done is to make it part of the
constructor arguments.

The code now passes the parent window in explicitly.  WPF MessageBox
avoids this by calling UnsafeNativeMethods.GetActiveWindow(), but
that feels weird.  We could assume Application.Current.MainWindow
is the parent, but that seems like it could go quietly and horribly
wrong.
2019-06-16 16:55:40 -07:00
Andy McFadden
61ecb28d60 Add Edit Address
Pretty simple dialog, but it took a while to figure out the best
way to deal with input validation.  Works from the various menus as
well as double-clicking on .ORG and address column entries.

Also, moved some stuff around to places that made more sense.
2019-06-16 16:40:08 -07:00
Andy McFadden
d3230ef0d6 Add addr/label target highlight
When you select a line that references a label within the file, we
highlight the address and label fields of the target offset.
2019-06-16 09:29:54 -07:00
Andy McFadden
1a0a229b9b Wire up sub-window double-click handlers and list nav
Wired up the double-click handlers for References, Notes, and
Symbols.  These jump to the item at the offset that was double-
clicked.  Also hooked up the navigate forward/backward buttons
in the toolbar.

Except for the usual WPF gymnastics required to figure out what you
actually double-clicked on, this went smoothly.
2019-06-15 16:00:31 -07:00
Andy McFadden
0abc7a7587 Populate Notes panel
This was pretty easy to do with DataGrid, even with custom background
colors in some cells.  Score one for WPF.
2019-06-12 15:54:22 -07:00
Andy McFadden
9e525d1428 Populate symbol table, with filtering and sorting
The filtering uses the DataGrid View filtering mechanism.  The
built-in sorting only operates on a single column, and we really
want a secondary sort on label when the type is used as the key,
so we provide a custom sort method.
2019-06-12 15:14:21 -07:00
Andy McFadden
b45382d294 Add double-click handler
Doesn't really do anything yet.  The hard part in WPF is figuring
out which row and column were clicked.
2019-06-11 18:45:08 -07:00
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
fa386a0d03 Finish wiring up code hint commands 2019-06-08 17:13:11 -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
0f7e0e8d21 Fix multi-multi-key inputs
When we match a multi-key sequence, send an event to all other
multi-key handlers to tell them to reset.
2019-06-07 13:10:52 -07:00