Skip to content

V2 #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 628 commits into from
Closed

V2 #189

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
628 commits
Select commit Hold shift + click to select a range
74bf7ec
Test fixes
tznind Jan 1, 2024
cf17192
Make Create Slider<x> call generic method Create
tznind Jan 1, 2024
fe346fe
Mark slider supported
tznind Jan 1, 2024
d187bdc
Merge pull request #271 from gui-cs/add-generic-views-support
tznind Jan 1, 2024
30cb03a
Change delete key to DeleteChar
tznind Jan 1, 2024
4f182c7
Fix delete keybinding
tznind Jan 1, 2024
71c25d5
Merge pull request #279 from gui-cs/delete-fix
tznind Jan 1, 2024
7958413
Fixes #277
tznind Jan 1, 2024
ef5cd62
wip: Start working on TreeView<T>
tznind Jan 2, 2024
49695c5
Create 'test to beat' for round trip TreeView with file system T
tznind Jan 2, 2024
d5cb94f
Fix code generation and test expectations
tznind Jan 2, 2024
6961fc3
ValueFactory support for files/folders
tznind Jan 2, 2024
f70b1b3
When Treeview<T> is FileSystemInfo then create tree builder
tznind Jan 2, 2024
3deb197
TreeView<object> support
tznind Jan 2, 2024
16be2a9
Unit tests
tznind Jan 2, 2024
183d650
Various xml doc
tznind Jan 2, 2024
e3ae003
Do not offer Objects property on TreeView<object>
tznind Jan 2, 2024
1deb519
Fix for Objects property being optional now
tznind Jan 2, 2024
48f010a
Remove unused interface
tznind Jan 2, 2024
103daf0
Fix overrides for Lhs/Rhs in TreeObjectsProperty<T>
tznind Jan 2, 2024
e379421
Use helper method
tznind Jan 2, 2024
cd9c985
Much more efficient array insertion
dodexahedron Dec 29, 2023
669f4c6
Avoid allocating an iterator
dodexahedron Dec 29, 2023
2df4ebf
Add attribute for static analysis
dodexahedron Dec 29, 2023
9d54a66
Only allocate one dictionary and use it
dodexahedron Dec 29, 2023
7355375
This can't be null
dodexahedron Dec 29, 2023
f48c3cc
Collection expression
dodexahedron Dec 29, 2023
064dfd4
Eliminate more allocations
dodexahedron Dec 29, 2023
dc6918a
Deconstruct and make prettier
dodexahedron Dec 29, 2023
611ff02
This can now be private
dodexahedron Dec 29, 2023
0f9a62c
XmlDoc for this (mostly copied from the old method
dodexahedron Dec 29, 2023
5a57c56
Null propagation removes an indentation level here 🥳
dodexahedron Dec 29, 2023
634c51b
Simplify with collection expression
dodexahedron Dec 29, 2023
bdedcc4
OK Dependabot! We hear you!
dodexahedron Dec 30, 2023
52af593
Add an unregister method
dodexahedron Dec 31, 2023
890b1d1
Convert and improve this big test.
dodexahedron Dec 31, 2023
0bcab6a
Use using to dispose of this
dodexahedron Dec 31, 2023
3546422
First usage of the new unregister method
dodexahedron Dec 31, 2023
6959ee7
Sorted members by design guides ONLY
dodexahedron Dec 31, 2023
8a62886
Annotate this test method
dodexahedron Dec 31, 2023
ac7a087
A few pre-conditions
dodexahedron Dec 31, 2023
76f8145
Pre-condition has guaranteed this can't be null
dodexahedron Dec 31, 2023
7831e52
This is guaranteed by the pre-conditions
dodexahedron Dec 31, 2023
bf607b4
Test the operation itself is ok
dodexahedron Dec 31, 2023
d85a835
Convert and simplify conditions
dodexahedron Dec 31, 2023
0a4bd19
Track UndoStack and RedoStack
dodexahedron Dec 31, 2023
a576013
Finish up with the rest of the test
dodexahedron Dec 31, 2023
461943c
Annotate tested type
dodexahedron Dec 31, 2023
bb635df
Add disposal for this MenuBar and add a note for later
dodexahedron Dec 31, 2023
fea5fd8
Refactoring this guy to be clearer (WIP)
dodexahedron Dec 31, 2023
050a454
More refactoring to make this clearer
dodexahedron Dec 31, 2023
e3176a5
There we go
dodexahedron Dec 31, 2023
7ad50b8
And update the usages! (done)
dodexahedron Dec 31, 2023
81c45d2
These are actually pre-conditions
dodexahedron Dec 31, 2023
323298b
Be sure these don't throw
dodexahedron Dec 31, 2023
25e4eef
Finish converting and improving this test
dodexahedron Dec 31, 2023
a40b92d
Introduce a type so the menubars can be auto-disposed by usings
dodexahedron Dec 31, 2023
5a4e168
Convert these and change to pre-conditions
dodexahedron Dec 31, 2023
b3e06d8
Finish converting and improving this test
dodexahedron Dec 31, 2023
ee5d1f2
Convert MoveMenuItemLeft_CannotMoveRootItems
dodexahedron Dec 31, 2023
f0be03a
Convert these to pre-conditions
dodexahedron Dec 31, 2023
4fdd437
Make sure nothing throws and IsImpossible is false
dodexahedron Dec 31, 2023
df72088
Convert and add a reference check
dodexahedron Dec 31, 2023
4899df8
Convert and simplify
dodexahedron Dec 31, 2023
81047fa
Convert and simplify the rest of this test
dodexahedron Dec 31, 2023
3478184
Convert and upgrade this test.
dodexahedron Dec 31, 2023
a8bab3a
Convert this test
dodexahedron Dec 31, 2023
c9461c3
Add tests to ensure the helpers are valid and to reduce redundancy
dodexahedron Dec 31, 2023
7dc56f7
Remove code that is now redundant
dodexahedron Dec 31, 2023
38b2596
Some more code that can go away with the new tests
dodexahedron Dec 31, 2023
d9d9d0e
Convert the last test method
dodexahedron Dec 31, 2023
eb00a74
Silence warnings from static analysis about possible null dereferences
dodexahedron Dec 31, 2023
2ed8882
These can all be static lambdas
dodexahedron Dec 31, 2023
0832f9b
Re-ordering code after member name changes and new additions (just mo…
dodexahedron Dec 31, 2023
be599a6
One more rename/sort and make the record private sealed
dodexahedron Dec 31, 2023
2bcccd2
Collection expressions
dodexahedron Dec 31, 2023
2b37e12
Move this to namespace to match TGD
dodexahedron Dec 31, 2023
37d1c81
Annotate fixture
dodexahedron Jan 3, 2024
9bc95c6
(BUGS) Convert and improve this test
dodexahedron Jan 3, 2024
69bd63f
Convert this test
dodexahedron Jan 3, 2024
b3d9ac2
Convert another one
dodexahedron Jan 3, 2024
07821fb
Convert this one and make it test the cases combinatorially
dodexahedron Jan 3, 2024
88ed977
Convert the rest
dodexahedron Jan 3, 2024
2fa91d6
Sorted members
dodexahedron Jan 3, 2024
6bffb3e
Wrap some Assert.Multiples and a couple of renames
dodexahedron Jan 3, 2024
68fc504
Re-sort after name changes
dodexahedron Jan 3, 2024
ecebc97
Convert to a TestCaseSource like the rest
dodexahedron Jan 3, 2024
9e2ec20
Wrap a bunch of things in Assert.Multiple
dodexahedron Jan 3, 2024
80cbb79
Let's clean up after ourselves
dodexahedron Jan 3, 2024
12fb453
Can't put assumptions in assert.multiple
dodexahedron Jan 3, 2024
18bde8d
Collection expressions FTW
dodexahedron Jan 3, 2024
f6a7ced
Clean up usings
dodexahedron Jan 3, 2024
b06c161
Renames
dodexahedron Jan 3, 2024
8cdacfc
These lambdas can be static
dodexahedron Jan 3, 2024
b463a74
Use the types in preparation for test updates
dodexahedron Jan 3, 2024
6b9c51b
Sort
dodexahedron Jan 3, 2024
7e33505
Convert to constraint model
dodexahedron Jan 3, 2024
2a17ddb
Move helper to another class
dodexahedron Jan 3, 2024
df8f201
Move this by the other helper types
dodexahedron Jan 3, 2024
999b46e
Make it clear this isn't the standard dotnet ConfigurationManager
dodexahedron Jan 3, 2024
bf00422
Clean up after ourselves
dodexahedron Jan 3, 2024
fe4d921
String interpolation
dodexahedron Jan 3, 2024
2f14bc5
This one was hard-coded. Make it like the others
dodexahedron Jan 3, 2024
8508e72
Some extra (minor) checks and additional cases
dodexahedron Jan 3, 2024
224ce89
Parameterize to add a few more simple cases
dodexahedron Jan 3, 2024
13f9c41
Hoist the expected values to the top for scalar valued tests
dodexahedron Jan 3, 2024
6f96fc7
Merge branch '20-convert-propertytests-to-constraint-model' into conv…
dodexahedron Jan 3, 2024
6e73ea2
Clean up unnecessary usings and let a lambda be static
dodexahedron Jan 3, 2024
37f93aa
Use collection expressions for these
dodexahedron Jan 3, 2024
829e336
Remove unneeded usings
dodexahedron Jan 3, 2024
7cfb4db
Add nullability adornment
dodexahedron Jan 3, 2024
1d3cf3b
Remove two redundant tests
dodexahedron Jan 3, 2024
6e24544
Might as well let this test all combinations of the old inputs
dodexahedron Jan 3, 2024
741e842
usings for disposables
dodexahedron Jan 3, 2024
abfc994
Use nameof on this
dodexahedron Jan 3, 2024
b64d69b
Wrap these in assertions that they don't throw
dodexahedron Jan 3, 2024
edef839
Turn that into a switch
dodexahedron Jan 3, 2024
d423b20
Add Heya to the dictionary so it stops getting reported as an error
dodexahedron Jan 3, 2024
17c2652
Merge branch '19-convert-postests-to-constraint-model' into convert-u…
dodexahedron Jan 3, 2024
99c6b27
Annotate the fixture
dodexahedron Jan 3, 2024
8dbaef8
Statics and collection expressions
dodexahedron Jan 3, 2024
ba5aa8d
Convert these
dodexahedron Jan 3, 2024
2154b55
Merge branch '36-convert-radiogrouptests-to-constraint-model' into co…
dodexahedron Jan 3, 2024
09200cd
Ain't nobody got time for that
dodexahedron Jan 3, 2024
aadf758
fixture annotations
dodexahedron Jan 3, 2024
0e5d169
Convert the assertions
dodexahedron Jan 3, 2024
b8c445f
Minor cleanup and modernizing
dodexahedron Jan 3, 2024
0eee156
Merge branch '37-convert-scrollviewtests-to-constraint-model' into co…
dodexahedron Jan 3, 2024
8652252
Clean usings and switch to file-scoped namespace
dodexahedron Jan 3, 2024
f4ceb10
Annotations
dodexahedron Jan 3, 2024
732ac0a
Convert to constraints
dodexahedron Jan 3, 2024
d19f425
Dispose it before the last assertion
dodexahedron Jan 3, 2024
d74879d
Make these assumptions
dodexahedron Jan 3, 2024
fba852b
Use the standard style for this
dodexahedron Jan 3, 2024
e3305cf
Clean up after ourselves
dodexahedron Jan 3, 2024
55259a8
Merge branch '38-convert-spinnerviewtests-to-constraint-model' into c…
dodexahedron Jan 3, 2024
5e8d91e
Convert this fixture
dodexahedron Jan 3, 2024
cd6ec78
This one can safely run in parallel
dodexahedron Jan 3, 2024
4aa5590
Merge branch '39-convert-statusbartests-to-constraint-model' into con…
dodexahedron Jan 3, 2024
d8395f1
Annotate the fixture
dodexahedron Jan 3, 2024
a913d7a
Convert to constraints
dodexahedron Jan 3, 2024
c2abf9c
Feed them from TestCaseData collections
dodexahedron Jan 3, 2024
d73348e
Merge branch '40-convert-stringextensiontests-to-constraint-model' in…
dodexahedron Jan 3, 2024
befefc6
This can safely run in parallel
dodexahedron Jan 3, 2024
8a84bdf
Convert, clean up, annotate, and parallelize
dodexahedron Jan 4, 2024
df7be62
Merge branch '41-convert-tableviewtests-to-constraint-model' into con…
dodexahedron Jan 4, 2024
02dff5e
Annotations
dodexahedron Jan 4, 2024
2729ff7
Convert and improve this test
dodexahedron Jan 4, 2024
e9d5552
Use the generic method and add some assumptions for callers of this h…
dodexahedron Jan 4, 2024
fe6e2a1
Clear undo/redo after setting up the base view
dodexahedron Jan 4, 2024
282a822
Convert and improve this test
dodexahedron Jan 4, 2024
9d95d6c
Convert and improve this test
dodexahedron Jan 4, 2024
77d985e
Convert and improve this test
dodexahedron Jan 4, 2024
1623871
Convert and improve this test
dodexahedron Jan 4, 2024
b78811b
Convert and improve this test
dodexahedron Jan 4, 2024
3c7a93d
Convert the last two tests
dodexahedron Jan 4, 2024
1d23a92
Sort code and add one last missing using statement
dodexahedron Jan 4, 2024
84aecbd
Merge branch '42-convert-tabviewtests-to-constraint-model' into conve…
dodexahedron Jan 4, 2024
a9da7b7
Explicitly ask user if they want to add a Dir or a File.
tznind Jan 5, 2024
5ddd5f6
Support for adding directories that don't exist at design time (to Tr…
tznind Jan 5, 2024
ea3c0c4
Merge pull request #280 from gui-cs/treeview-t-support
tznind Jan 5, 2024
b0d0d4a
Merge pull request #283 from dodexahedron/convert-unit-tests-to-const…
tznind Jan 6, 2024
4d710a2
Disable key logic when no view loaded
tznind Jan 8, 2024
b827967
Creating a new view with an invalid class name now shows nicer error
tznind Jan 8, 2024
d019ba3
Exclude test project from code coverage
tznind Feb 10, 2024
dabb543
Fix null reference editing pos
tznind Mar 19, 2024
c9a20bb
Start working on updating to pre636 nuget package
tznind Mar 22, 2024
e1adf23
Work on handling more v2 changes
tznind Mar 29, 2024
8bd852a
Fix bugs around the removal of argumented constructors
tznind Mar 31, 2024
fbc6812
Main program now compiles
tznind Mar 31, 2024
5fb16c2
Unit tests compiling except Frame
tznind Mar 31, 2024
c738106
Remove references to Frame which has now been removed
tznind Mar 31, 2024
a2a24a5
Update to 2.0.0-pre.774
tznind Apr 14, 2024
b1bd27b
Start trying to repair mouse and key handling
tznind Apr 14, 2024
53626d9
Fix test around tab view
tznind Apr 14, 2024
a5946b5
Update to 2.0.0-pre.949
tznind May 8, 2024
66e26ec
Mouse point changes
tznind May 13, 2024
67f806e
Work with new dependencies
tznind May 13, 2024
03a2876
Fix ColorSchemeToCode to call constructor
tznind May 14, 2024
86ed9c1
Nuke fixed test, Dim now never null
tznind May 14, 2024
1219d0c
Start trying to fix PosView (relative to)
tznind May 14, 2024
be9427c
Fix not setting DisplayText on tab properly
tznind May 15, 2024
dbbdf07
More fixes of tabview display text
tznind May 15, 2024
234779c
Fix DisplayText on cloning TaabView.
BDisp May 15, 2024
fffc329
Fix ButtonRename unit test and keystroke.
BDisp May 15, 2024
dd6d775
Rename DeleteChar to Delete.
BDisp May 15, 2024
1f9036a
Fix unit test using ExpectedKeysYamlContent.
BDisp May 15, 2024
e57f598
Fix mouse drag views.
BDisp May 15, 2024
a04ad25
View dim cannot be null.
BDisp May 15, 2024
66d64f1
Trying to fix SupportedViewTypes.
BDisp May 15, 2024
95932a4
Fixing more Tab unit tests.
BDisp May 15, 2024
267ba6c
Merge pull request #290 from BDisp/tznind_pre636-support
tznind May 16, 2024
3719d46
Fix various dialogs that don't look or behave correct
tznind May 19, 2024
c05a7a1
Fix for v2 refactoring button to split MouseClick and Accept
tznind May 19, 2024
1343c45
Update to 2.0.0-pre.1322
tznind May 23, 2024
e8359c7
Less reflection in PosExtensions
tznind May 25, 2024
777bb88
Remove reflection in DimExtensions
tznind May 25, 2024
6959cf6
Remove 'f' now that Percent methods take int
tznind May 25, 2024
2907ce9
Switch float to int for Percent (Pos and Dim)
tznind May 27, 2024
374e3be
Use full namespace name for Color to avoid collision with System.Draw…
tznind May 27, 2024
03ed08b
Fixes for free Text modification
tznind May 27, 2024
05ebe72
Add IsDimAuto
tznind May 27, 2024
cbf093f
Support for file scoped namespace declarations
tznind May 27, 2024
d8e31eb
Designer support for DimAuto
tznind May 27, 2024
c7db195
Update to no ContentSize and new Dim.Auto
tznind May 31, 2024
f7553c1
Suppress Text on slider and radio
tznind Jun 1, 2024
6b5f7be
Keyboard handling fixes and ignore ContentSize
tznind Jun 1, 2024
51a3bb0
Suppress test equality check on DimAuto
tznind Jun 1, 2024
e4a66a3
Fix drag resizing TabView
tznind Jun 1, 2024
9cf4b15
Fix bug characters in direct Text typing changes
tznind Jun 1, 2024
718bfc2
Comment out failing test and fix rename tab operation
tznind Jun 15, 2024
2481c6c
Fix unit test
tznind Jun 15, 2024
86c83f8
Merge pull request #289 from gui-cs/pre636-support
tznind Jun 15, 2024
492ad36
Update to 1574 (broken)
tznind Jun 15, 2024
7f5cd22
Increase referenced version to 1829
tznind Aug 5, 2024
d0915b8
Prototype fix for StatusItem being renamed Shortcut and expanded
tznind Aug 7, 2024
ba178ef
WIP start dealing with ObservableCollection change
tznind Aug 7, 2024
3e65ee6
WIP more progress towards compiling with new breaking changes
tznind Aug 7, 2024
87b2e67
Main binary building
tznind Aug 7, 2024
d8b513f
Tests building
tznind Aug 7, 2024
c62857e
Remove `this.View.Arrangement` so it is now not designable (did not w…
tznind Aug 7, 2024
98295e9
Ensure ObservableCollection<> assembly and namespace are included in …
tznind Aug 7, 2024
8252001
Test fixes
tznind Aug 7, 2024
e95563a
Fixes Window being too wide/tall when added
tznind Aug 10, 2024
9cd862c
Make Arrangement a SuppressedProperty with fixed value `ViewArrangeme…
tznind Aug 10, 2024
2c0e967
Fix key handling in BigListBox
tznind Aug 10, 2024
769074e
As recommended switch to NewKeyDownEvent
tznind Aug 10, 2024
a6593e8
Updated to latest nuget package
tznind Aug 17, 2024
9930ec4
Ignore Shortcut, Bar and MenuBarv2 for now as they are unstable
tznind Aug 17, 2024
c850a58
Turn Bar back on again for tests
tznind Aug 17, 2024
4ce3259
Remove parallelize attribute on table view tests
tznind Aug 17, 2024
059d5dc
Explicitly mark not paralellizeable
tznind Aug 17, 2024
bfdab03
Fix set shortcut dialog
tznind Aug 17, 2024
380e282
Remove the Add/Remove hack in CreateSubControlDesign as causes more p…
tznind Aug 22, 2024
a10b73d
Fix TextField tab not working
tznind Aug 22, 2024
5455603
Fix not being able to exit when TextField highlighted
tznind Aug 22, 2024
05b2335
Fix default dimensions of Dialog to be percent again
tznind Aug 22, 2024
46e7578
Ensure Dim.Auto for width on relevant types created by ViewFactory
tznind Aug 22, 2024
247e384
Remove down keybindings on combo box
tznind Aug 22, 2024
502c7c7
Fix TextView default size and make AllowTab a suppressed property
tznind Aug 22, 2024
ce6233d
Merge pull request #292 from gui-cs/pre-1574
tznind Aug 22, 2024
f747ef2
Add title and assembly version in home screen
tznind Aug 23, 2024
cc5d3c1
Render small title if not enough space
tznind Aug 23, 2024
df1bcb0
Update nuget package and add legacy color pickers
tznind Aug 23, 2024
3704070
Update build yaml and csproj to allow pre releases to be shipped
tznind Aug 23, 2024
df51563
Merge pull request #295 from gui-cs/v2_true_color
tznind Aug 23, 2024
bf06e94
Add `--skip-duplicate`
tznind Aug 23, 2024
70606c5
Update README.md
tznind Aug 23, 2024
40f3d55
Update README.md
tznind Aug 23, 2024
b054d99
Update README.md
tznind Aug 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
root = true


19 changes: 12 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@ on: push

jobs:
package:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Build
run: cd src && dotnet build

- name: Test
run: |
cd tests && dotnet test --configuration Debug --verbosity normal --collect:'XPlat Code Coverage' --settings coverlet.runsettings

- name: Move test results to accessible directory
run: |
mkdir TestResults
mv -v tests/TestResults/*/*.* TestResults/
# Note: this step is currently not writing to the gist for some reason
mkdir -p TestResults
find tests/TestResults -type f -name "*.xml" -exec mv -v --backup=numbered {} TestResults/ \;

- name: Create Test Coverage Badge
uses: simon-k/dotnet-code-coverage-badge@v1.0.0
id: create_coverage_badge
Expand All @@ -33,8 +36,10 @@ jobs:
run: |
echo "Code coverage percentage: ${{steps.create_coverage_badge.outputs.percentage}}%"
echo "Badge data: ${{steps.create_coverage_badge.outputs.badge}}"

- name: Pack
run: cd src && dotnet pack
- name: Publish to Nuget
run: cd src && dotnet pack --configuration Debug --output ./nupkg

- name: Publish to NuGet
if: contains(github.ref, 'refs/tags/v')
run: dotnet nuget push ./src/nupkg/TerminalGuiDesigner.$(fgrep \<Version\> ./src/TerminalGuiDesigner.csproj | grep -oEi '[0-9.]+').nupkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json
run: dotnet nuget push ./src/nupkg/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
67 changes: 67 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: "CodeQL"

on:
push:
branches: [ "convert-tests-to-constraint-model","v2","v2_latest_changes_pre_220" ]


jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ 'ubuntu-latest' }}
timeout-minutes: ${{ 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]

steps:
- name: Set up .net 8 SDK
uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: 8.0

- name: Checkout repository
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
Empty file added .gitmodules
Empty file.
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Cross platform designer for [Terminal.Gui](https://github.com/migueldeicaza/gui.

Built with CodeDom and Roslyn, TerminalGuiDesigner lets you create complicated Views with drag and drop just like the WinForms designer you know and love (or hate).


## V1

Install the tool from NuGet or follow the [Hello World Tutorial](./README.md#usage):
```
dotnet tool install --global TerminalGuiDesigner
Expand All @@ -16,10 +19,19 @@ Update to the latest version using
```
dotnet tool update --global TerminalGuiDesigner
```

This project is in alpha. See the [feature list](./README.md#features) for progress.

![newdemo](https://user-images.githubusercontent.com/31306100/175789072-27fcacf0-e9f0-4543-818d-50058bb46a2f.gif)
## V2

If you are targetting Terminal.Gui version 2 (currently pre-alpha) then you will want to install version 2 of the designer
```
dotnet tool install --global TerminalGuiDesigner --prerelease
```
Ensure that you match the Terminal.Gui library version you reference to the designer version.

## Demo

![long-demo](https://github.com/gui-cs/TerminalGuiDesigner/assets/31306100/5df9f545-8c61-4655-bc0c-1e75d1c149d9)

### Building
----------------
Expand Down Expand Up @@ -62,7 +74,7 @@ You can add new code to `MyDialog.cs` but avoid making any changes to `MyDialog.
For example in `MyDialog.cs` after `InitializeComponent()` add the following:

```csharp
button1.Clicked += ()=>MessageBox.Query("Hello","Hello World","Ok");
button1.Accept += ()=>MessageBox.Query("Hello","Hello World","Ok");
```
Now when run clicking the button will trigger a message box.

Expand Down Expand Up @@ -207,6 +219,7 @@ italics are experimental and require passing the `-e` flag when starting applica
- [x] TimeField
- [x] TreeView
- [x] View
- [x] Slider

### Class Diagram
-------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Keys.yaml eol=lf
38 changes: 0 additions & 38 deletions src/ApplicationExtensions.cs

This file was deleted.

23 changes: 23 additions & 0 deletions src/ArrayExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
using System.Collections;
using System.Collections.ObjectModel;
using Terminal.Gui;

namespace TerminalGuiDesigner;

/// <summary>
Expand Down Expand Up @@ -26,4 +30,23 @@

return toReturn;
}

public static IListDataSource ToListDataSource(this IEnumerable enumerable)
{
// Get the type of the elements
var elementType = enumerable.GetType().GetElementType() ?? enumerable.GetType().GetGenericArguments().FirstOrDefault();
if (elementType == null)
{
throw new Exception("Unable to get element type for collection");
}

// Convert the enumerable to an ObservableCollection<T>
var observableCollectionType = typeof(ObservableCollection<>).MakeGenericType(elementType);
var list = Activator.CreateInstance(observableCollectionType, enumerable);

// Create an instance of ListWrapper<T>
var listWrapperType = typeof(ListWrapper<>).MakeGenericType(elementType);
return (IListDataSource)Activator.CreateInstance(listWrapperType, list);

Check warning on line 49 in src/ArrayExtensions.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Converting null literal or possible null value to non-nullable type.

Check warning on line 49 in src/ArrayExtensions.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Possible null reference return.
}

}
2 changes: 1 addition & 1 deletion src/AttributeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ public static class AttributeExtensions
/// <returns>Code construct <paramref name="a"/>.</returns>
public static string ToCode(this Terminal.Gui.Attribute a)
{
return $"Terminal.Gui.Attribute.Make(Color.{a.Foreground},Color.{a.Background})";
return $"new Terminal.Gui.Attribute(Terminal.Gui.Color.{a.Foreground},Terminal.Gui.Color.{a.Background})";
}
}
25 changes: 0 additions & 25 deletions src/ColorSchemeExtensions.cs

This file was deleted.

17 changes: 9 additions & 8 deletions src/ColorSchemeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void Remove(NamedColorScheme toDelete)
/// schemes.
/// </summary>
/// <param name="viewBeingEdited">View to find color schemes in, must be the root design (i.e. <see cref="Design.IsRoot"/>).</param>
/// <exception cref="ArgumentException">Thrown if passed a non root <see cref="Design"/>.</exception>
/// <exception cref="ArgumentException">Thrown if passed a non-root <see cref="Design"/>.</exception>
public void FindDeclaredColorSchemes(Design viewBeingEdited)
{
if (!viewBeingEdited.IsRoot)
Expand Down Expand Up @@ -94,7 +94,7 @@ public void FindDeclaredColorSchemes(Design viewBeingEdited)
/// <returns>The name of the scheme or null if it is not known.</returns>
public string? GetNameForColorScheme(ColorScheme s)
{
var match = this.colorSchemes.Where(kvp => s.AreEqual(kvp.Scheme)).ToArray();
var match = this.colorSchemes.Where(kvp => s.Equals(kvp.Scheme)).ToArray();

if (match.Length > 0)
{
Expand All @@ -114,16 +114,16 @@ public void FindDeclaredColorSchemes(Design viewBeingEdited)
/// Will become <see cref="NamedColorScheme.Name"/>.</param>
/// <param name="scheme">The new <see cref="ColorScheme"/> color values to use.</param>
/// <param name="rootDesign">The topmost <see cref="Design"/> the user is editing (see <see cref="Design.GetRootDesign"/>).</param>
public void AddOrUpdateScheme(string name, ColorScheme scheme, Design rootDesign)
/// <returns>A reference to the <see cref="ColorScheme"/> that was added or updated.</returns>
public ColorScheme AddOrUpdateScheme(string name, ColorScheme scheme, Design rootDesign)
{
var oldScheme = this.colorSchemes.FirstOrDefault(c => c.Name.Equals(name));

// if we don't currently know about this scheme
if (oldScheme == null)
if (this.colorSchemes.FirstOrDefault(c => c.Name.Equals(name)) is not { } oldScheme)
{
// simply record that we now know about it and exit
this.colorSchemes.Add(new NamedColorScheme(name, scheme));
return;
NamedColorScheme newColorScheme = new (name, scheme);
this.colorSchemes.Add(newColorScheme);
return newColorScheme.Scheme;
}

// we know about this color already and people may be using it!
Expand All @@ -138,6 +138,7 @@ public void AddOrUpdateScheme(string name, ColorScheme scheme, Design rootDesign
}

oldScheme.Scheme = scheme;
return scheme;
}

/// <summary>
Expand Down
66 changes: 36 additions & 30 deletions src/DefaultColorSchemes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,49 @@ public class DefaultColorSchemes
/// </summary>
public DefaultColorSchemes()
{
this.RedOnBlack = new NamedColorScheme("redOnBlack");
this.RedOnBlack.Scheme.Normal = new Terminal.Gui.Attribute(Terminal.Gui.Color.Red, Terminal.Gui.Color.Black);
this.RedOnBlack.Scheme.HotNormal = new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightRed, Terminal.Gui.Color.Black);
this.RedOnBlack.Scheme.Focus = new Terminal.Gui.Attribute(Terminal.Gui.Color.Red, Terminal.Gui.Color.Brown);
this.RedOnBlack.Scheme.HotFocus = new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightRed, Terminal.Gui.Color.Brown);
this.RedOnBlack.Scheme.Disabled = new Terminal.Gui.Attribute(Terminal.Gui.Color.Gray, Terminal.Gui.Color.Black);
this.RedOnBlack = new NamedColorScheme("redOnBlack",
new ColorScheme(
normal: new Terminal.Gui.Attribute(Terminal.Gui.Color.Red, Terminal.Gui.Color.Black),
hotNormal: new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightRed, Terminal.Gui.Color.Black),
focus: new Terminal.Gui.Attribute(Terminal.Gui.Color.Red, Terminal.Gui.Color.Yellow),
hotFocus: new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightRed, Terminal.Gui.Color.Yellow),
disabled: new Terminal.Gui.Attribute(Terminal.Gui.Color.Gray, Terminal.Gui.Color.Black)
));

this.GreenOnBlack = new NamedColorScheme("greenOnBlack");
this.GreenOnBlack.Scheme.Normal = new Terminal.Gui.Attribute(Terminal.Gui.Color.Green, Terminal.Gui.Color.Black);
this.GreenOnBlack.Scheme.HotNormal = new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightGreen, Terminal.Gui.Color.Black);
this.GreenOnBlack.Scheme.Focus = new Terminal.Gui.Attribute(Terminal.Gui.Color.Green, Terminal.Gui.Color.Magenta);
this.GreenOnBlack.Scheme.HotFocus = new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightGreen, Terminal.Gui.Color.Magenta);
this.GreenOnBlack.Scheme.Disabled = new Terminal.Gui.Attribute(Terminal.Gui.Color.Gray, Terminal.Gui.Color.Black);
this.GreenOnBlack = new NamedColorScheme("greenOnBlack",
new ColorScheme(
normal : new Terminal.Gui.Attribute(Terminal.Gui.Color.Green, Terminal.Gui.Color.Black),
hotNormal: new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightGreen, Terminal.Gui.Color.Black),
focus: new Terminal.Gui.Attribute(Terminal.Gui.Color.Green, Terminal.Gui.Color.Magenta),
hotFocus: new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightGreen, Terminal.Gui.Color.Magenta),
disabled : new Terminal.Gui.Attribute(Terminal.Gui.Color.Gray, Terminal.Gui.Color.Black)));

this.BlueOnBlack = new NamedColorScheme("blueOnBlack");
this.BlueOnBlack.Scheme.Normal = new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightBlue, Terminal.Gui.Color.Black);
this.BlueOnBlack.Scheme.HotNormal = new Terminal.Gui.Attribute(Terminal.Gui.Color.Cyan, Terminal.Gui.Color.Black);
this.BlueOnBlack.Scheme.Focus = new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightBlue, Terminal.Gui.Color.BrightYellow);
this.BlueOnBlack.Scheme.HotFocus = new Terminal.Gui.Attribute(Terminal.Gui.Color.Cyan, Terminal.Gui.Color.BrightYellow);
this.BlueOnBlack.Scheme.Disabled = new Terminal.Gui.Attribute(Terminal.Gui.Color.Gray, Terminal.Gui.Color.Black);
this.BlueOnBlack = new NamedColorScheme("blueOnBlack",
new ColorScheme(
normal : new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightBlue, Terminal.Gui.Color.Black),
hotNormal: new Terminal.Gui.Attribute(Terminal.Gui.Color.Cyan, Terminal.Gui.Color.Black),
focus: new Terminal.Gui.Attribute(Terminal.Gui.Color.BrightBlue, Terminal.Gui.Color.BrightYellow),
hotFocus: new Terminal.Gui.Attribute(Terminal.Gui.Color.Cyan, Terminal.Gui.Color.BrightYellow),
disabled: new Terminal.Gui.Attribute(Terminal.Gui.Color.Gray, Terminal.Gui.Color.Black)));

this.GrayOnBlack = new NamedColorScheme("greyOnBlack");
this.GrayOnBlack.Scheme.Normal = new Terminal.Gui.Attribute(Terminal.Gui.Color.DarkGray, Terminal.Gui.Color.Black);
this.GrayOnBlack.Scheme.HotNormal = new Terminal.Gui.Attribute(Terminal.Gui.Color.DarkGray, Terminal.Gui.Color.Black);
this.GrayOnBlack.Scheme.Focus = new Terminal.Gui.Attribute(Terminal.Gui.Color.Black, Terminal.Gui.Color.DarkGray);
this.GrayOnBlack.Scheme.HotFocus = new Terminal.Gui.Attribute(Terminal.Gui.Color.Black, Terminal.Gui.Color.DarkGray);
this.GrayOnBlack.Scheme.Disabled = new Terminal.Gui.Attribute(Terminal.Gui.Color.DarkGray, Terminal.Gui.Color.Black);
this.GrayOnBlack = new NamedColorScheme("greyOnBlack",
new ColorScheme(
normal : new Terminal.Gui.Attribute(Terminal.Gui.Color.DarkGray, Terminal.Gui.Color.Black),
hotNormal: new Terminal.Gui.Attribute(Terminal.Gui.Color.DarkGray, Terminal.Gui.Color.Black),
focus: new Terminal.Gui.Attribute(Terminal.Gui.Color.Black, Terminal.Gui.Color.DarkGray),
hotFocus: new Terminal.Gui.Attribute(Terminal.Gui.Color.Black, Terminal.Gui.Color.DarkGray),
disabled: new Terminal.Gui.Attribute(Terminal.Gui.Color.DarkGray, Terminal.Gui.Color.Black)));

this.TerminalGuiDefault = new NamedColorScheme("tgDefault");
this.TerminalGuiDefault.Scheme.Normal = new Terminal.Gui.Attribute(Color.White, Color.Blue);
this.TerminalGuiDefault.Scheme.HotNormal = new Terminal.Gui.Attribute(Color.BrightCyan, Color.Blue);
this.TerminalGuiDefault.Scheme.Focus = new Terminal.Gui.Attribute(Color.Black, Color.Gray);
this.TerminalGuiDefault.Scheme.HotFocus = new Terminal.Gui.Attribute(Color.BrightBlue, Color.Gray);
this.TerminalGuiDefault = new NamedColorScheme("tgDefault",
new ColorScheme(
normal : new Terminal.Gui.Attribute(Color.White, Color.Blue),
hotNormal : new Terminal.Gui.Attribute(Color.BrightCyan, Color.Blue),
focus : new Terminal.Gui.Attribute(Color.Black, Color.Gray),
hotFocus : new Terminal.Gui.Attribute(Color.BrightBlue, Color.Gray),

// HACK : Keeping this foreground as Brown because otherwise designer will think this is legit
// the real default and assume user has not chosen it. See: https://github.com/gui-cs/TerminalGuiDesigner/issues/133
this.TerminalGuiDefault.Scheme.Disabled = new Terminal.Gui.Attribute(Color.Brown, Color.Blue);
disabled: new Terminal.Gui.Attribute(Color.Yellow, Color.Blue)));
}

/// <summary>
Expand Down
Loading
Loading