Commit Graph

4173 Commits

Author SHA1 Message Date
BDisp
4bde80cfb7 Fixes #2626. ScrollView contentBottomRightCorner isn't set to false if not needed. (#2627)
* Fixes #2626. ScrollView contentBottomRightCorner isn't set to false if not needed.

* Fix unit test errors.

* Prefix private members with underscore.
2023-05-12 18:20:09 +02:00
BDisp
800ae43877 Fixes #2623. ScrollBarView contentBottomRightCorner doesn't drawn on hosted views. (#2624)
* Fixes #2623. ScrollBarView contentBottomRightCorner doesn't drawn on hosted views.

* Prefix all the private members with underscore.
2023-05-11 19:23:22 +02:00
Thomas Nind
07c4c05729 Test fixes for tv-checkboxes merge (#2619)
* Add CheckBoxTableSourceWrapper

* Fix column offsets when there are checkboxes column

* Fix index

* Add CellToggledEventArgs and handle in CheckBoxTableSourceWrapper

* Add xmldoc for CheckBoxTableSourceWrapper

* Add tests and default keybinding for toggle to CheckBoxTableSourceWrapper

* Add unit tests for TableView checkboxes

* Split CheckBoxTableSource to two subclasses, one by index the other by object

* Add more tests for CheckBoxTableSourceWrapperByObject

* Refactor for readability

* Add UseRadioButtons

* Add test for radio buttons in table view

* Fix xmldoc

* Fix regression during radio refactoring

* Fix build errors for new glyph and draw method names

* Fix tests to expect new unicode glyphs

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2023-05-10 07:52:45 +02:00
Thomas Nind
6cd79ada3a Fixes #2587 - Add CheckBoxTableSourceWrapper for TableView checkboxes (#2589)
* Add CheckBoxTableSourceWrapper

* Fix column offsets when there are checkboxes column

* Fix index

* Add CellToggledEventArgs and handle in CheckBoxTableSourceWrapper

* Add xmldoc for CheckBoxTableSourceWrapper

* Add tests and default keybinding for toggle to CheckBoxTableSourceWrapper

* Add unit tests for TableView checkboxes

* Split CheckBoxTableSource to two subclasses, one by index the other by object

* Add more tests for CheckBoxTableSourceWrapperByObject

* Refactor for readability

* Add UseRadioButtons

* Add test for radio buttons in table view

* Fix xmldoc

* Fix regression during radio refactoring

* Fix build errors for new glyph and draw method names

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2023-05-10 07:33:19 +02:00
Thomas Nind
5317950928 Fixes #2601 - Adds ability to filter TreeView branches/leaves (v2) (#2604)
* Add ITreeViewFilter

* Fix for v2

* Fix for new private variable name
2023-05-10 07:32:45 +02:00
Nutzzz
5d1fe43362 Fixes #16 - Add ListTableSource for columned lists (#2603)
* Add ListTableSource for TableView to display an IList in a columned view

Also adds a global MinCellWidth to TableView

* Code style fixes

* Include padding in MinCellWidth calculation

* Unit Tests for Min/MaxCellWidth and ListTableSource

* Rename Redraw to Draw after refactor

* Rename Redraw to Draw after refactor

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2023-05-10 06:03:47 +02:00
Nutzzz
b3c0e1be72 Fix typo for thin vertical line glyph (#2618) 2023-05-10 06:02:36 +02:00
Nutzzz
440c529818 Some UICatalog scenario code style fixes (#2614) 2023-05-09 16:18:45 +02:00
Tig
dea5f0fe03 Fixes #2597. Enables standard glyphs to be set via ConfigurationManager (#2595)
* initial

* basically working

* removed test settings

* removed extra usings

* Improved API docs

* Renamed glyphs to be consistent and use unicode names; use char literals

* Refactored Glyphs class & Json format to not be static (startup perf)

* Refactored Glyphs class & Json format to not be static (startup perf)

* Fixed a bunch of API doc errors

* Switched checked/selected to glyhps from box drawing range

* Switched button glyphs to nicer looking ones that seem to work on standard fonts

* Upgraded LineDrawing scenario

* CrossHair->Cross

* Fixed unit tests

* Fixed unit tests; moved Glyphs from Application to ConfigurationManager; added CM global using alias

* Found and replaced all other special glyphs; fixed more unit tests
2023-05-07 07:34:02 +02:00
Thomas Nind
16e2fc2ac1 Make DataTable public in DataTableSource (#2591) 2023-05-07 07:32:11 +02:00
BDisp
7ffd4b8ab4 Fixes #2598. Run self-contained application on Linux. (#2600)
* Fixes #2598. Run self-contained application on Linux.

* Remove directive allowing always compile for single-file if PublishSingleFile is true.
2023-05-07 07:19:06 +02:00
BDisp
915af9b3ff Fixes #2558. MenuBar positions wrong in some situations. (#2567)
* Fixes #2558. MenuBar positions wrong in some situations.

* Replacing Application.Top with Application.Current.

* Fix typo.

* Fix shortcut tag overlapping help on smaller width and add more unit test.

* Resizing the console will close all opened menus.

* Resize first the console before show ContextMenu.

* Remove DriverFrame and DriverFrameOffset as not relevant.

* Replace _frame with Frame as requested.

* Fix xml document comment.

* Compare equality between Dialog and Application.Top.

* Move GetDriverLocationOffset and GetDriverLocationOffsetFromCurrent to the Menu.cs.

* Fix merge errors.

* Ensure menu is closed on click.

* Force Height always be 1 to avoid mouse events respond even outside bounds.

* Recovering UseSubMenusSingleFrame hope doesn't break again.

* Fix bugs and made requested changes.

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2023-05-05 15:10:14 -05:00
BDisp
ea24de3a27 Fixes #2482. Refactor Redraw - Non-virtual with the right set of virtual OnXXX methods. (#2577)
* Fixes #2482. Refactor Redraw - Non-virtual with the right set of virtual OnXXX methods.

* Change documentation comments.

* Fixes #2575 - TableView to use interface instead of System.Data.DataTable (#2576)

* WIP: Add ITableDataSource

* WIP: Refactor TableView

* WIP: Port CSVEditor

* WIP: Port TableEditor

* WIP: Port MultiColouredTable scenario

* Fix bug of adding duplicate column styles

* Update tests to use DataTableSource

* Tidy up

* Add EnumerableTableDataSource<T>

* Add test for EnumerableTableDataSource

* Add test for EnumerableTableDataSource

* Add code example to xmldoc

* Add ProcessTable scenario

* Rename ITableDataSource to ITableSource and update docs

* Rename EnumerableTableDataSource to EnumerableTableSource

* Fixed Frame != Bounds; changed UICat Scenarios list to use tableview!

* Fix scroll resetting in ProcessTable scenario

* Fix unit tests by setting Frame to same as Bounds

* Document why we have to measure our data for use with TableView

---------

Co-authored-by: Tig Kindel <tig@users.noreply.github.com>

* Fixes #2582 - Refactors FileDialog for cleaner data model (#2583)

* WIP: Add ITableDataSource

* WIP: Refactor TableView

* WIP: Port CSVEditor

* WIP: Port TableEditor

* WIP: Port MultiColouredTable scenario

* Fix bug of adding duplicate column styles

* Update tests to use DataTableSource

* Tidy up

* Add EnumerableTableDataSource<T>

* Add test for EnumerableTableDataSource

* Add test for EnumerableTableDataSource

* Add code example to xmldoc

* Add ProcessTable scenario

* Rename ITableDataSource to ITableSource and update docs

* Rename EnumerableTableDataSource to EnumerableTableSource

* Fixed Frame != Bounds; changed UICat Scenarios list to use tableview!

* Fix scroll resetting in ProcessTable scenario

* Fix unit tests by setting Frame to same as Bounds

* Document why we have to measure our data for use with TableView

* WIP: Simplify FileDialogs use of TableView

* WIP start migrating sorter

* WIP new filedialog table source mostly working

* WIP remove sorter class

* Refactor GetOrderByValue to be adjacent to GetColumnValue

* Fix collection navigator back so it ignores icon

* Fix unit tests

* Tidy up

* Fix UseColors

* Add test for UseColors

---------

Co-authored-by: Tig Kindel <tig@users.noreply.github.com>

* Fixes #2196. TextView: Setting Text places cursor at beginning, unlike TextField (#2572)

* Fixes #2196. TextView: Setting Text places cursor at beginning, unlike TextField

* Change all private members to have the _prefix.

* Renamed local member to prevLayoutStyle.

* Helper function for SetNeedsDisplay.

* Fixes #2569. Borders scenarios needed to be refactored. (#2570)

* Fixes #2569. Borders scenarios needed to be refactored.

* Fix border title with width equal to 4 and thickness top grater than 1.

* Improves border manipulation on borders scenarios.

* Prevents null value on the margin, border and padding thickness on the border scenarios.

* Remove NStack using dependence and fix prior commit.

* Refactoring the Frames scenario.

* Deleted borders scenarios.

* I did not realize that it was changed to SetSubViewNeedsDisplay.

* Re-layout; fixed colorpicker; fixed radio group

* Remove Thickness.IsEmpty as requested.

* Change the Frames scenario as requested.

---------

Co-authored-by: Tig Kindel <tig@users.noreply.github.com>

* Builds CollectionNavigator support into UI Catalog for TableView (#2584)

* Builds collectionnav support into UI cat for TableView

* Fixes keyboard mapping

* MultiSelect = false for TableView

* MultiSelect = false doesn't unbind ctrl-a

* Fixes #2581 Refactor CollectionNavigator so it supports TableView (#2586)

* Refactor CollectionNavigator to a base and a collection implementation

* Refactor CollectionNavigatorBase to look for first match smartly

* Add TableCollectionNavigator

* Make TableCollectionNavigator a core part of TableView

* Fix bad merge

* Added tests for tableview collection navigator

* Add FileDialogCollectionNavigator which ignores . and directory separator prefixes on file names

* whitespace fixes

---------

Co-authored-by: Tig <tig@users.noreply.github.com>

* Resolving merge conflicts.

* Fix merge errors.

* Fix merge errors.

* Add Command.Accept and snap to the selected glyph when ShowHorizontalScrollIndicator change to true.

* Reformat.

* Reformat again.

---------

Co-authored-by: Thomas Nind <31306100+tznind@users.noreply.github.com>
Co-authored-by: Tig Kindel <tig@users.noreply.github.com>
2023-05-04 13:17:59 +02:00
Thomas Nind
01544dc60c Fixes #2581 Refactor CollectionNavigator so it supports TableView (#2586)
* Refactor CollectionNavigator to a base and a collection implementation

* Refactor CollectionNavigatorBase to look for first match smartly

* Add TableCollectionNavigator

* Make TableCollectionNavigator a core part of TableView

* Fix bad merge

* Added tests for tableview collection navigator

* Add FileDialogCollectionNavigator which ignores . and directory separator prefixes on file names

* whitespace fixes

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2023-05-01 07:06:51 +02:00
Tig
5cf90b8bd0 Builds CollectionNavigator support into UI Catalog for TableView (#2584)
* Builds collectionnav support into UI cat for TableView

* Fixes keyboard mapping

* MultiSelect = false for TableView

* MultiSelect = false doesn't unbind ctrl-a
2023-05-01 07:04:11 +02:00
BDisp
105ff9ab54 Fixes #2569. Borders scenarios needed to be refactored. (#2570)
* Fixes #2569. Borders scenarios needed to be refactored.

* Fix border title with width equal to 4 and thickness top grater than 1.

* Improves border manipulation on borders scenarios.

* Prevents null value on the margin, border and padding thickness on the border scenarios.

* Remove NStack using dependence and fix prior commit.

* Refactoring the Frames scenario.

* Deleted borders scenarios.

* I did not realize that it was changed to SetSubViewNeedsDisplay.

* Re-layout; fixed colorpicker; fixed radio group

* Remove Thickness.IsEmpty as requested.

* Change the Frames scenario as requested.

---------

Co-authored-by: Tig Kindel <tig@users.noreply.github.com>
2023-05-01 07:00:51 +02:00
BDisp
be67e0f09f Fixes #2196. TextView: Setting Text places cursor at beginning, unlike TextField (#2572)
* Fixes #2196. TextView: Setting Text places cursor at beginning, unlike TextField

* Change all private members to have the _prefix.

* Renamed local member to prevLayoutStyle.

* Helper function for SetNeedsDisplay.
2023-04-29 23:42:53 +02:00
Thomas Nind
130fc5713d Fixes #2582 - Refactors FileDialog for cleaner data model (#2583)
* WIP: Add ITableDataSource

* WIP: Refactor TableView

* WIP: Port CSVEditor

* WIP: Port TableEditor

* WIP: Port MultiColouredTable scenario

* Fix bug of adding duplicate column styles

* Update tests to use DataTableSource

* Tidy up

* Add EnumerableTableDataSource<T>

* Add test for EnumerableTableDataSource

* Add test for EnumerableTableDataSource

* Add code example to xmldoc

* Add ProcessTable scenario

* Rename ITableDataSource to ITableSource and update docs

* Rename EnumerableTableDataSource to EnumerableTableSource

* Fixed Frame != Bounds; changed UICat Scenarios list to use tableview!

* Fix scroll resetting in ProcessTable scenario

* Fix unit tests by setting Frame to same as Bounds

* Document why we have to measure our data for use with TableView

* WIP: Simplify FileDialogs use of TableView

* WIP start migrating sorter

* WIP new filedialog table source mostly working

* WIP remove sorter class

* Refactor GetOrderByValue to be adjacent to GetColumnValue

* Fix collection navigator back so it ignores icon

* Fix unit tests

* Tidy up

* Fix UseColors

* Add test for UseColors

---------

Co-authored-by: Tig Kindel <tig@users.noreply.github.com>
2023-04-29 12:04:20 +02:00
Thomas Nind
038cf8aa45 Fixes #2575 - TableView to use interface instead of System.Data.DataTable (#2576)
* WIP: Add ITableDataSource

* WIP: Refactor TableView

* WIP: Port CSVEditor

* WIP: Port TableEditor

* WIP: Port MultiColouredTable scenario

* Fix bug of adding duplicate column styles

* Update tests to use DataTableSource

* Tidy up

* Add EnumerableTableDataSource<T>

* Add test for EnumerableTableDataSource

* Add test for EnumerableTableDataSource

* Add code example to xmldoc

* Add ProcessTable scenario

* Rename ITableDataSource to ITableSource and update docs

* Rename EnumerableTableDataSource to EnumerableTableSource

* Fixed Frame != Bounds; changed UICat Scenarios list to use tableview!

* Fix scroll resetting in ProcessTable scenario

* Fix unit tests by setting Frame to same as Bounds

* Document why we have to measure our data for use with TableView

---------

Co-authored-by: Tig Kindel <tig@users.noreply.github.com>
2023-04-28 14:21:06 -06:00
Nutzzz
f280ded145 Add many styles to SpinnerView (#2510)
* Add many styles to SpinnerView

* Add SpinnerStyles as a nested class

* Allow zero as valid spinner delay value

* Change from BorderStyle to LineStyle

* Rename SpinDelayInMilliseconds to just SpinDelay

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2023-04-17 09:36:53 -06:00
BDisp
962ccc6c0a Fixes #2559. BackgroundWorkerCollection scenario is broken. (#2560) 2023-04-17 09:32:35 -06:00
Nutzzz
1bc25900e7 Add additional LineStyles (#2533)
* Add additional LineStyles

* Fix WizardTests because of renamed runes

* BorderFrame -> Border

* Fix the layout of Border Scenarios

* Fix for LineCanvas clipping

Based on comment https://github.com/gui-cs/Terminal.Gui/pull/2533#issuecomment-1508982468

* Update LineCanvasTests.cs

* Rename Thick border to Heavy

(less confusion with "Thickness")
Also:
* Add a few more runes for potential future use
* Fix Unit Tests

* Fix LineDrawing scenario to use 1 unit longer lines (matching new LineCanvas API).

* Fix LineDrawing scenario to better match mouse cursor location

---------

Co-authored-by: tznind <tznind@dundee.ac.uk>
2023-04-17 09:31:45 -06:00
Thomas Nind
5cefd5bf0b Fixes #2553 - Fix HotFocus color when FullRowSelecting being used for VLines on left/right of TableView (#2557)
* Fix HotFocus color when FullRowSelecting being used for VLines on left/right of TableView

* Add AlwaysUseNormalColorForVerticalCellLines style setting

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2023-04-16 09:10:24 -06:00
Thomas Nind
f622eaf177 Tests and polish for FileDialog (#2522)
* Add dir selection tests

* Make tests work on windows or linux

* Fixed multi-selection issues

- ".." no longer a valid multi select item
- Pressing Alt+O (or clicking ok) now prefers completing multi
  selection (to completing text box path)
- Pressing Enter in text box still uses Path as selection (ignoring
  any multi selection)

* Allow toggling <space> then <enter> to perform single dir select

* FileDialogState now remembers Path
Makes back button smoother in some nieche situations

* Added Culture property to FileDialog

* Fix bad date/time format

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
2023-04-16 09:07:03 -06:00
Nutzzz
dcdb4f9b49 Add Style.ShowHeaders to TableView (#2514)
* Add Style.HideHeaders to TableView

* Revisions to TableView HideHeaders from review

Also add to UICatalog TableEditor Scenario

* Allow ShowHorizontalHeaderUnderline to draw top border even when HideHeaders is enabled; AlwaysShowHeader will keep it there on scroll

* Add Unit Tests for TableView.Style.HideHeaders

* Rename HideHeaders to ShowHeaders and simplify logic

---------

Co-authored-by: tznind <tznind@dundee.ac.uk>
2023-04-15 18:27:05 -06:00
BDisp
62746f8037 Fixes #2539. Add feature to draw menus with or without border. (#2556) 2023-04-15 18:26:14 -06:00
BDisp
c1de5e0dc6 Fixes #2545. ListView throw exception if click on the top border. (#2547) 2023-04-15 18:20:44 -06:00
Thomas Nind
bd2564cf01 Fixes #2554 FileDialog collection navigator now works on all fields (#2555)
* Fix FileDialog collection navigator only working on filename

* Improve collection navigator pattern matching
- Exclude Icon
- Works with .exe, .pdb etc
2023-04-15 18:19:38 -06:00
Thomas Nind
ba473ffe05 Adds ShowHorizontalBottomline (#2552) 2023-04-15 18:19:04 -06:00
Thomas Nind
22efb32549 Fix LineDrawing scenario to use 1 unit longer lines (matching new LineCanvas API). (#2549) 2023-04-15 18:18:20 -06:00
Thomas Nind
889e66a7c4 Fix Snake for new lengths in LineCanvas (#2548) 2023-04-15 18:17:58 -06:00
BDisp
9aaf84f96e Prevents WordBackward or WordForward throw null exception. (#2529) 2023-04-14 15:41:14 -06:00
BDisp
5ae8e98631 Fixes menu frame and unit test on the #2483. (#2542)
* Fixes menu frame and unit test on the #2483.

* Reverting some code. Only color on ScrollView is failing.

* Fixes for the unit test Draw_A_ContextManu_Over_A_Dialog pass.
2023-04-14 14:28:12 -06:00
Tig
b4552ee14b Fixes #2493. Move all layout code out of View (and Toplevel) into a layout helper class (#2544)
* Comment/warning clean up

* Moved Text and Drawing out

* Moved Layout out

* Removed extra lines

* Removed Mouse out

* Reorgainzed View

* API docs

* removed border.cs

* TopLevel.Resized -> TerminalResized

* Mdi -> Overlapped

* Removed confusing and un-needed WillPresent

* privates -> _

* Tweaked RunLoop API
2023-04-14 10:26:10 -06:00
Tig
8c59e8255f Partially Fixes #2483 - Removes old Border and leverages LineCanvas for Frames, etc... (#2527)
* POC

* View.DrawFrame now uses LineCanvas

* Fixes #2531. Toplevel should redraw only if it's needed.

* Fix toplevel when mdi is enabled preventing clear the screen twice.

* Massive LineCanvis updates

* Fixes #2534. Bounds isn't updating when the Frame is changed.

* Almost everything works!

* Had to disable a few tests but all unit test now pass again

* Deleted ConsoleDriver.DrawWindowFrame; hacked ProgressBar

* Deleted ConsoleDriver.DrawWindowTitle; moved to Frame.DrawTitle

* Renames BorderFrame to Border

* Removed old commented code

* Tweaked scenario

* Added auto convert \r\n to Enviornment.NewLine in TestHelpers.AssertEqual

* Fix merge errors.

* Fix AssertEqual newlines to platform-specific.

* Refactored frames drawing; view adds to its lineview, superview renders them

* New titlebar style based on Border.Top size; fixed bugs

* wzard bug

---------

Co-authored-by: BDisp <bd.bdisp@gmail.com>
2023-04-13 15:35:01 -06:00
BDisp
5317489a8b Fixes #2539. Menu should use Frame instead of DrawFrame. (#2540) 2023-04-13 14:35:56 -06:00
BDisp
91bf832ce4 Fixes #2531. Toplevel should redraw only if it's needed. (#2532)
* Fixes #2531. Toplevel should redraw only if it's needed.

* Fix toplevel when mdi is enabled preventing clear the screen twice.
2023-04-13 01:36:44 -06:00
Tigger Kindel
18e18f6a7f Cleaned up Application.cs 2023-04-10 17:50:31 -06:00
BDisp
8dbb345225 Fixes #2523. WordBackward and WordForward should be moved to the TextModel class. (#2524)
* Move WordBackward and WordForward to TextModel class.

* Improving code and changing unit tests.

* Remove commented code.

* Fix unit test.
2023-04-10 17:39:51 -06:00
Tig
a637f8a29c Fixes #2486 - Removes old Border and fixes a litany of related things (#2525)
* Added View.BorderStyle and renamed BorderStyle enum to LineStyle

* Fixed a lot of things and broke everything else

* Fixed things

* Updated DialogTests

* Updates including Rect unit tests

* Fixed Dialog & MessagBox tests

* Fixed AllviewsTester bug

* Fixed AllviewsTester bug

* Removed Border class

* Renamed View privates with _

* Removed comments in MessageBox.cs
2023-04-10 17:34:52 -06:00
Tigger Kindel
98aab602eb Merge branch 'v2_develop' of tig:gui-cs/Terminal.Gui into v2_develop 2023-04-10 17:05:11 -06:00
Tigger Kindel
0c67ad99c5 Updated Rect tests 2023-04-10 17:04:45 -06:00
BDisp
3c67eed22d Add some explanation to the TopologicalSort method. 2023-04-09 08:13:22 -06:00
BDisp
b4d5337fbb Done requested changes. 2023-04-09 08:13:22 -06:00
BDisp
30a87c849a Added the StringExtensions.cs file with a public class. 2023-04-09 08:13:22 -06:00
BDisp
0a48a9f20b Fix typo and private properties are read only. 2023-04-09 08:13:22 -06:00
BDisp
22e791bff4 Fixes #2512. Scrolling numeration is broke again. We need to create a unit test for this doesn't happens again. 2023-04-09 08:13:22 -06:00
BDisp
dd298d0e2e Fix more issue in the layout. 2023-04-09 08:13:22 -06:00
BDisp
da5249f043 Fix method names. 2023-04-09 08:13:22 -06:00
BDisp
16a6e581d1 Fixes #2503. PosCombine and DimCombine is wrongly looking into the from.InternalSubviews. 2023-04-09 08:13:22 -06:00