Commit Graph

3392 Commits

Author SHA1 Message Date
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
haven1433
ce2352aaef Merge pull request #5 from haven1433/dev
* Support for save / save as
* Support for multiple tabs (open, close, save all, close all, re-ordering)
* A tab will have a '*' in the title if it is different from when it was last saved.
* Menus to allow easy access to commands like New, Open, Save, Close, Undo, and Redo. Also included keyboard shortcuts.
2018-11-04 14:26:47 -06:00
Benjamin Popp
19967071cf updates from self-review. Minor code cleanup. 2018-11-04 07:29:32 -06:00
Benjamin Popp
59c08cd309 updates from self review. Refactoring code to make it a bit cleaner. Fixing a bug in Solarized that was preventing it from ever using night theme. Styling the TextBox foreground color. Improving comments. Added some missing tests and fixing the bugs. 2018-10-30 22:49:05 -05:00
Benjamin Popp
4acbd969f5 middle-click to close a tab. Drag tabs to re-order. 2018-10-30 20:57:23 -05:00
Benjamin Popp
8d8621a2e1 added styling for Separator. Added icon. 2018-10-29 23:07:52 -05:00
Benjamin Popp
b134d78d02 importing icons from another project. Added improvements for styles for MenuItem and TabControl. 2018-10-29 20:30:37 -05:00
Benjamin Popp
3bf17d41f8 styling menu and tabs. Still need to style the menu items. 2018-10-28 19:58:22 -05:00
Benjamin Popp
99935f5ba5 made the tab display a file name without path and extension. Made the tab have a * if the file is edited. Fixed some bugs with selection. Implemented drag-drop file support for opening files. 2018-10-28 12:54:11 -05:00
Benjamin Popp
1f1fcfb171 first pass at implementing the UI. Not sure that everything actually works yet, still needs more testing. 2018-10-27 23:05:25 -05:00
Benjamin Popp
211ff8399d moving ChangeHistory from the model to the viewmodel, since it now provides change notification. 2018-10-27 20:42:09 -05:00
Benjamin Popp
6a821d3741 finished the model, all tests now pass. Next I get to work on changes to expose these features in the UI. 2018-10-27 20:38:44 -05:00
Benjamin Popp
a2a0d9550b IFileSystem also needs to be able to handle opening files from the user. Added tests to show that the EditorViewModel works correctly with that. Also added a 'New' command, for creating a new file. 2018-10-27 19:43:42 -05:00
Benjamin Popp
361a9840d1 writing viewmodel for the editor. Basically, one view model to handle multiple tabs. 2018-10-27 14:06:15 -05:00
Benjamin Popp
1a7bd44228 get the code building to match what is needed for the tests. 2018-10-27 13:25:44 -05:00
Benjamin Popp
618beeaf2c added a new test for showing the functionality of the save all command 2018-10-27 10:33:50 -05:00
Benjamin Popp
8efe5bd490 adding tests for editor viewmodel and viewport saving 2018-10-26 23:28:24 -05:00
haven1433
b64354ec2b Merge pull request #4 from haven1433/dev
Minimal editing support
2018-10-26 20:33:22 -05:00
Benjamin Popp
cf2eaf0b78 updates from self review
+ ChangeHistory needs to do a better job of knowing if it's in the process of reverting a change.
- Include StubDisposable in HavenSoft
+ provide an extension method IDataFormat.Edit to singlesource the logic for transforming to the UnderEdit format.
2018-10-26 20:29:11 -05:00
Benjamin Popp
b012edcef8 remove newline 2018-10-19 21:51:43 -05:00