Commit Graph

111 Commits

Author SHA1 Message Date
Benjamin Popp
af64d4aad2 implement find/goto for pointers 2018-12-09 13:07:14 -06:00
Benjamin Popp
40d70817a9 bugfixes. See ModelTests.cs
-> note that I had to remove EditOnlyNotifiesCollectionChangeOnceWhenScrolling(),
   that test is no longer true. Changes to pointers and anchors can change data
   elsewhere on screen.
2018-12-09 11:14:42 -06:00
Benjamin Popp
f74d38c012 first pass at making the UI work. 2018-12-08 22:07:02 -06:00
Benjamin Popp
f7d04c5b67 add ability to remove names from anchors 2018-12-08 21:26:01 -06:00
Benjamin Popp
408a56c91b first pass at adding backspace to the model 2018-12-08 21:01:31 -06:00
Benjamin Popp
ad9e3386d0 support for writing pointers/anchors over other ones, and how replacement works. 2018-12-08 16:18:47 -06:00
Benjamin Popp
25be2aa0fb basic support for writing pointers and writing anchors 2018-12-06 22:08:36 -06:00
Benjamin Popp
32a5c5759f implementing the first part of the model 2018-12-04 20:19:00 -06:00
Benjamin Popp
d6cd4cc689 first pass at adding model interfaces. The model will be in charge of parsing the data and listing data formats. The ViewModel can then ask the Model for the 'next format' from a given location. Note that there could be multiple implementations: the only thing the ViewModel knows is the interface. 2018-12-03 22:43:58 -06:00
Benjamin Popp
ae6571dba2 simplify confusing code 2018-12-03 19:26:12 -06:00
Benjamin Popp
ffb3f5410b Refactor: Moving things to a more organized file structure. 2018-12-02 19:47:23 -06:00
Benjamin Popp
242e7199b9 get version string from attributes, so that I can update it in only one place. 2018-12-02 12:59:18 -06:00
haven1433
e5d8a6c006 Merge pull request #13 from haven1433/dev-haven1433-12
fixing #12
2018-12-02 12:47:37 -06:00
haven1433
d141012de2 Merge pull request #10 from haven1433/dev
Fixing #7 and #11
2018-12-02 12:47:12 -06:00
Benjamin Popp
355d56eeb4 removing duplicate logic - we already know that the changed button was pressed. 2018-12-02 12:46:47 -06:00
Benjamin Popp
a3e88511e0 removing dead code 2018-12-01 23:25:51 -06:00
Benjamin Popp
32b26068da provide a default value for recentFindResults to avoid null checks. 2018-12-01 23:23:56 -06:00
Benjamin Popp
d0a0a2bbf1 fixing #12
- FindPrevious/FindNext logic for CanExecute was wrong.
- also updated when CanExecuteChanged gets called.
2018-12-01 19:22:21 -06:00
Benjamin Popp
a510e924d5 - EditorViewModel should update FileSystem watches when a ViewPort's FileName changes.
... This additionally requires that the FileName shares its oldValue when it changes.
- All TabContents are ViewModels
- ViewPort should notify when its FileName changes
2018-12-01 16:59:05 -06:00
Benjamin Popp
ee65fdb4d3 - Side mouse buttons map to back/forward
- call CanExecuteChanged on back/forward correctly
2018-11-30 19:56:20 -06:00
Benjamin Popp
0dc5a903de - click+shift should move the selection end, not the selection start
(see HexContent)
- add keybinding for delete
- fix keybinding for cut
- clearing data via cut or delete needs to go on the undo stack
2018-11-30 18:42:52 -06:00
Benjamin Popp
152f0cb548 - Add a FileSystem resource to the MainWindow, so that it can use it as
an argument for closing tabs
- don't do threading work in collection change callbacks. Instead,
  do thread switching as early as possible, as soon as I realize that work
  needs to be done (in WindowsFileSystem).
- if ConsiderReload is called because of a file change and the file is now
  missing, then do nothing.
- if ConsiderReload is called because the file got shorter, update the
  Selection.
2018-11-30 07:29:33 -06:00
Benjamin Popp
b88429873d improve comments after re-reading through the code changes. 2018-11-29 22:11:29 -06:00
Benjamin Popp
c77506d241 - make filesystem able to clear individual listeners per file, instead of all at once.
... because you can have the same file open in two tabs.
- Allow HexContent's ContentChanged to come from a background thread
  ... important for when the notification comes from a file change
- Allow MainWindow to track deferred work
- Allow Tabs to request delayed work
- Allow EditorViewModel to request delayed work
  ... because sometimes windows notifies about a file change before the
      other application lets go of the file handle.
- IViewPort should actually expose its FileName
  ... EditorViewModel needs to know a ViewPort's file to setup / tear down
      the file watch in IFileSystem
- Implement the reload in ViewPort
  ... note that the reload can fail if the file is still being edited.
      if this happens, then ask the app to retry next time the user clicks.
- 2 more unit tests to capture the desired behavior of requesting delayed work.
2018-11-29 21:54:13 -06:00
Benjamin Popp
0b60953ecc adding ability for IFileSystem to tell me when something changes on disk.
first pass at implementing the windows version of the new interface methods
IViewPort now has a public method to call whenever you want to notify it that its underlying file has been changed.
Added 3 tests showing how the Editor and ViewPort should behave with this new functionality.
- Editor should hook up ViewPorts whenever a new tab is opened
- Editor should clear out ViewPorts whenever a tab is closed
- ViewPort should reload when the file is changed and it is not.

Note that the model isn't implemented yet. This is just some failing tests.
2018-11-28 22:16:43 -06:00
haven1433
607ce508bc Merge pull request #9 from haven1433/dev
Find
2018-11-28 21:19:19 -06:00
Benjamin Popp
c8542fb32c fix bug when finding a result in a non-selected tab. Refactor Start/Stop pair into single disposable inside EditorViewModel to remove some code duplication. Use nameof for InlineData. 2018-11-28 21:18:12 -06:00
Benjamin Popp
2d3dc307cc Refactor EditorViewModel constructor.
Pull out command implementations into helper.
  Single-source the list of commands that need to be refreshed on tab change.
Refactor ViewPort constructor.
  Pull out command implemenatations into helper.
  Use CanAlwaysExecute instead of arg => true
Move CanAlwaysExecute to command extensions.
Change 'EditorNotifiesCanExecuteChangedOnTabChange' to a theory,
  so I can more easily add new commands to test for in the future.
Bug fix: EditorViewModel should notify copy/delete commands when tab changes.
2018-11-27 21:32:19 -06:00
Benjamin Popp
379d2059cc addressing review feedback. 2018-11-27 20:32:36 -06:00
Benjamin Popp
64d04feb8b future-proofing Find algorithm 2018-11-22 23:38:40 -06:00
Benjamin Popp
1852a86108 adding IChildViewPort interface so that IViewPort interface doesn't have a direct dependence on ViewPort concrete class. Also updated pre-build step to expect AutoImplement 1.1.0 2018-11-22 23:26:22 -06:00
Benjamin Popp
a49408cdb4 auto format 2018-11-22 23:13:15 -06:00
Benjamin Popp
4d2a6c0bba now that the autoimplement bug has been fixed, we don't have to check in a modified StubViewPort file anymore. 2018-11-22 22:58:52 -06:00
Benjamin Popp
fed4513c0e update to latest nugets 2018-11-22 22:55:44 -06:00
Benjamin Popp
ff2a36aafd make the search start from the cursor instead of the start of the file. 2018-11-17 20:50:44 -06:00
Benjamin Popp
c602660900 modified tests to pass given that CompositeViewPort actually cares about info from its children.
CompositeViewPort has correct headers
Find closes after run
CompositeViewPort can scroll now (max scroll is right, notifies work correctly)
Goto and Find Control Visibiilty notify change _after_ updating other control visibilities.
   so the control you care about (the one you actively chose to show/hide) gets notified last.
   this makes focus work as expected.
Double-clicking in a HexContent follows data links
   currently used to open full data when find-tab is double-clicked
added lots of keyboard / menuitem stuff to MainWindow.xaml
2018-11-17 20:33:40 -06:00
Benjamin Popp
282e889c78 commenting the parameters for the commands 2018-11-17 18:47:52 -06:00
Benjamin Popp
e4dec5e3f5 fixing FindPrev / FindNext to work as desired: don't switch tabs. 2018-11-17 18:09:17 -06:00
Benjamin Popp
146c1ffa16 Added a "childviewport", a view that knows about its parent.
This was needed so that a CompositeViewPort could follow links to the main view that created it.
Implemented CompositeViewPort
Implemented Find for the EditorViewModel
Implemented Find for the ViewPort
All tabs can now request that focus move from them to another tab, but they have to know that tab by reference.
All ViewPorts can now "follow link" at a chosen (x,y).
Added tests to show how the editor should behave for tab change requests.
2018-11-17 14:04:26 -06:00
Benjamin Popp
77c9d926cd make the tests compile
HACK adding StubViewPort to revision control (bug in AutoImplement keeps it from generating cleanly)
2018-11-16 21:30:33 -06:00
Benjamin Popp
ed402fbdb9 adding first pass unit tests for find feature 2018-11-16 20:12:21 -06:00
haven1433
129bc99f0e Merge pull request #8 from haven1433/dev
adding cut/copy/paste/delete
2018-11-15 20:00:59 -06:00
Benjamin Popp
7331ebd0c5 cleanup code: use Enumerable.Range and string.Join instead of a for loop 2018-11-15 20:00:06 -06:00
Benjamin Popp
b65f3eadfb adding cut/copy/paste/delete
adding 'help' to menu, with links to GitHub and credit to Solarized.
2018-11-11 15:57:30 -06:00
haven1433
a007ea0fa2 Merge pull request #6 from haven1433/dev
Add support for "Goto"
2018-11-10 22:06:13 -06:00
Benjamin Popp
67154009df fix visual styles to correctly toggle between dark/light.
cleanup on Button style
2018-11-10 21:51:13 -06:00
Benjamin Popp
042a589a97 fix typo, remove duplicate code. 2018-11-08 20:51:02 -06:00
Benjamin Popp
c57953c5cf fixing broken test (the test was wrong). Changing the implementation of Selection so that ScrollRegion.DataIndex doesn't need a public set. 2018-11-08 20:38:41 -06:00
Benjamin Popp
2f3d144e70 move goto/forward/back logic from ScrollRegion to Selection, since goto/forward/back needs to move the selection as well.
add style for button
add error display in the main window, with commands for hiding it
add OnError to ITabContent so tabs can bubble errors up to the main viewmodel.
fix a UI bug where hiding the goto when there are no tabs caused a crash (see MainWindow.xaml.cs)
add tests showing that selection moves during a goto
add tests showing that tab errors are shown/cleared by the EditorViewModel.
2018-11-07 21:03:31 -06:00
Benjamin Popp
ae4c73efc6 + change out app.xaml to use dynamicresource instead of directly using solarized:Theme.
-> allows us to change styles at will
+ Add style for TextBlock / TextBox
+ Add handler in App.xaml.cs to update styles when the theme changes
+ Change HexContent's constants from ints to doubles so we can use them in Xaml.
+ MainWindow: add shortcuts/menuitems for Goto, Back, and Forward.
+ MainWindow: add control for Goto
+ MainWindow: add control/logic for toggling the Theme
+ MainWindow: add control to show addresses
+ EditorViewModel: add commands for back, forward, goto, and showGoto
-> UI shortcut for Goto can't just immediately do a Goto: more info is needed.
   so instead, the first UI command just shows the box (and moves the focus)
   and a second command performs the action.
+ ScrollRegion: implement Goto/Back/Forward
+ ScrollRegion: own the logic for updating the address headers

This is the initial push for the goto feature. There are bugs / needs more tests.
2018-11-06 21:43:01 -06:00