GithubHelp home page GithubHelp logo

gui-cs / terminalguidesigner Goto Github PK

View Code? Open in Web Editor NEW
367.0 8.0 22.0 2.38 MB

Forms Designer for Terminal.Gui (aka gui.cs)

License: MIT License

C# 100.00%
terminal ui gui editor designer csharp curses dotnet toolkit

terminalguidesigner's People

Contributors

bdisp avatar dependabot[bot] avatar dodexahedron avatar tonyhenrique avatar tznind avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terminalguidesigner's Issues

Document `--usc` and `reset`

Some consoles need --usc to render properly out of the box (linux mostly, and without messing with $TERM variable). The README should be up front about this.

Also with best intentions in the world sometimes designer can hard crash. Telling user they can fix console by typing reset into borked console is friendly.

Undo/Redo for Add View creates duplicate fields in .Designer.cs

To reproduce:

  1. Add a view
  2. Undo
  3. Redo
  4. Save

Also undo/redo should force redraw, currently they sometimes don't for some activities.

Failed to open 'MyWindow.Designer.cs'
One or more errors occurred. (Could not compile ../../MyWindow.Designer.cs:
(19,36): error CS0102: The type 'MyWindow' already contains a definition for
 'label1'
(21,36): error CS0102: The type 'MyWindow' already contains a definition for
 'label1'
(23,36): error CS0102: The type 'MyWindow' already contains a definition for
 'label1'
(27,37): error CS0102: The type 'MyWindow' already contains a definition for
 'button1'

Prevent copying the root view

If you right click in the wrong place it is quite easy to Copy the root instead of the control you thought you were clicking. This can lead to duplicating the whole form. We should prevent copy/paste of the root.

Can drag but not move with ShiftArrow keys after setting Pos Relative

  1. Add a control
  2. Add another control and set it pos relative Below the first
  3. Attempt to move it with Shift+ Left/Right/Up/Down (fails)
  4. Drag it (works)

Value does not fall within the expected range.
Terminal.Gui.View.set_Y(Pos value)TerminalGuiDesigner.UI.Editor.MoveControl(Int32 deltaX, Int32 deltaY) in /home/runner/work/TerminalGuiDesigner/TerminalGuiDesigner/src/UI/Editor.cs:line 510 at TerminalGuiDesigner.UI.Editor.HandleKey(KeyEvent keyEvent) in /home/runner/work/TerminalGuiDesigner/TerminalGuiDesigner/src/UI/Editor.cs:line 438

Warn on unsaved changes

If user exits with Ctrl+Q warn the user if there are unsaved changes.

We can probably look at the undo stack size for that. Track it on save and watch for changes

Support for menu separators (null)

In gui.cs having a null in the Menu items of a MenuItemBar indicates that a horizontal separator line should be added.

We should let the user define such separators with an intuitive notation e.g. --- (or simply more than x hyphens).

Cannot cancel 'Clear Property Value' with Enter

image

When you press keyboard Enter key on the Cancel button it just moves to Ok. Maybe theres a handled state that needs set?

Also how about it says Clear Property 'Text' just so the user is absolutely clear on what is getting nuked (nah, its highlighted there in gray - thats fine, they can always undo anyway).

MenuBar improvements

The following issues need workarounds or additions

  • Deleting the last menu item from a root menu results in gui.cs throwing index out of bounds errors
  • There should be a way to rename root menus (change Title)

Other nice to haves

  • Reordering root menu headings
  • Move a menu item from one root menu to another (e.g. from File menu to View menu)

Dim.Percent is saving doubles instead of floats

This happened when I was setting up a FrameView. I set a width with a percent and it saved it as a double into the designer. This causes an exception when loading that form again later (TerminalGuiDesigner won't load it until it is corrected manually).

            this.FrameViewName.Width = Dim.Percent(60.000004);

I typed 60 in the field, so there is a precision issue as well.

Thanks for making an awesome tool!!

Danger situation from losing code if Ctrl+S isn't pressed before exit.

There is no way to avoid the console closing after user clicked the X icon or press Alt+F4. What I suggesting is always auto saving the changes to a temporary file. If the user unexpected close the console the changes already are in that temporary file. If the user saves the designer before exit that temporary file is deleted. When the user reopen the designer later if still exist the temporary file, the tool will ask to the user if he wants to save the unsaved changes and thus this tool will be more reliability for the user.

Cannot delete menu bars

Since you can't tab to a menu bar you cannot delete one once added.

Solution would be to allow delete via right click menu

image

ColorScheme pre launch issues

The following would be nice before releasing next version of software (which includes ColorScheme designing)

  • Changing the color scheme on a container doesn't change it for the children (until reloading the form)
    • If we are changing the children of a container manually on set new color scheme we need this to support undo
  • Should be possible to multi select and then change ColorScheme. See also the roadmap multi select->Edit shared property requirement
  • Template color schemes would be nice
  • Add ability to customise or auto compute a contrasting color so multi select always looks good (at the moment it is hard coded to green)

New 'green selection' system does not work for GraphView

GraphView respects only its GraphColor attribute and not ColorScheme so setting ColorScheme to the selection indication does not alter it's colors. Since we need to save/restore ColorScheme when editing for the purposes of selection to support GraphView we would need a Memento pattern and also set the GraphColor.

image

Trying to drag resize the root view when Dialog freezes app

Hangs at DragOperation.cs:107 (DropInto.Add(mem.Design.View);)

Seems like maybe it is trying to add the Top as a root view of its child. We should prevent dragging a control into one of it's own children as that will result in an infinite child loop I think.

Ultra low resolution support

Testing on Raspberry Pi lite with large font size shows several issues including the help box needing scroll support. Add that and review anything else and then document the minimum supported resolution.

Null reference in RunState.Dispose()

Triggered in Linux closing app with Ctrl+Q at random

Global Exception
Object reference not set to an instance of an object.
   at Terminal.Gui.View.set_CanFocus(Boolean value)
   at Terminal.Gui.MenuBar.CleanUp()
   at Terminal.Gui.MenuBar.OnLeave(View view)
   at Terminal.Gui.View.SetHasFocus(Boolean value, View view, Boolean force)
   at Terminal.Gui.View.set_CanFocus(Boolean value)
   at Terminal.Gui.View.Remove(View view)
   at Terminal.Gui.View.Dispose(Boolean disposing)
   at Terminal.Gui.View.Dispose(Boolean disposing)
   at Terminal.Gui.TabView.Dispose(Boolean disposing)
   at Terminal.Gui.View.Dispose(Boolean disposing)
   at Terminal.Gui.View.Dispose(Boolean disposing)
   at Terminal.Gui.View.Dispose(Boolean disposing)
   at Terminal.Gui.Responder.Dispose()
   at Terminal.Gui.Application.RunState.Dispose(Boolean disposing)
   at Terminal.Gui.Application.RunState.Dispose()
   at Terminal.Gui.Application.End(RunState runState)
   at Terminal.Gui.Application.Run(Toplevel view, Func`2 errorHandler)

TabView controls tab order is not consistent with main app tab order

Terminal.Gui tab order between controls is dependent on the sequence in which they are added to the parent view.

TerminalGuiDesigner outputs controls in order of Ascending Y then X so that tab order is from top left to lower right.

private void AddSubViewsToDesignerCs(View forView, CodeDomArgs args)
{
// TODO: we should detect RelativeTo etc here meaning one view depends
// on anothers position and therefore the dependant view should be output
// after
// order the controls top left to lower right so that tab order is good
foreach (var sub in forView.Subviews.OrderBy(v=>v.Frame.Y).ThenBy(v=>v.Frame.X))
{
// If the sub child has a Design (and is not an public part of another control,
// For example Contentview subview of Window
if (sub.Data is Design d)

Good code that outputs sensible tab order - btw we should remove this TODO it is no longer an issue thanks to #61

However when views are in a TabView this behaviour is not the same and controls are instead output in the order they are specified in .Designer.cs which is typically the order the user added them to the tab view. This becomes a problem when a user makes changes to an old tab view and inserts new controls in the middle of the View - these get a tab order of 'last'

We need to centralise the order and update the following to use the centralised Order delegate:

foreach(var v in Tab.View.Subviews)
{
// that is designable
if(v.Data is Design d)
{
var toCode = new DesignToCode(d);
toCode.ToCode(args,new CodeSnippetExpression($"{tabName}.View"));
}

Bad code that outputs in arbitrary tab order

To reproduce this issue

  • Create a tab view
  • Add 2 textfields with a bit of vertical space between them
  • Close designer
  • Reopen designer
  • Insert another TextField in the middle
  • Save
  • Close and reopen

You would expect tab order to be top to bottom but instead goes top,bottom,middle

Doing the same thing outside of a TabView works correctly.

PosRelative output order

The order in which items are output in InitializeComponent is important when considering PosRelative.

Currently designer declares controls in the order they appear (top left to lower right). This ensures that tab order is roughly correct when user loads/uses the form.

However if using PosRelative for X/Y we need to make sure the Dependant view is output before the Depender view. Otherwise you get this error: #59 (comment)

Updating LineView orientation should change rune

Updating the Orientation property of LineView should also update the line rune (if it is the default value of the previous orientation).

Currently if user creates a line it is vertical | and if they change Orientation to horizontal the line rune itself does not change. Also since the line rune is a unicode line symbol not a hyphen its hard for user to enter the horizontal pipe value in the UI.

Make F4 (edit properties) work for multi selection

Currently there are 2 ways to edit properties. You can right click something and access its 'Properties' submenu
image

Then there is F4 (which displays all properties and values).
image
View/edit all properties (default key F4 or click the view title in the context menu)

This is the Window ShowEditProperties. It currently only works for a singular Design. We should expand it to also work for multi selection in same way Context menu does (thanks to #42)

Deleting the last menu item in a menu causes 'Index was outside the bounds of array'

Create a new MenuBar
Press F9 to edit the menu
Press Delete

Global Exception
Index was outside the bounds of the array.
   at Terminal.Gui.Menu.MoveUp()
   at Terminal.Gui.Menu.<>c__DisplayClass5_0.<.ctor>b__0()
   at Terminal.Gui.View.InvokeKeybindings(KeyEvent keyEvent)
   at Terminal.Gui.Menu.ProcessKey(KeyEvent kb)
   at Terminal.Gui.View.ProcessHotKey(KeyEvent keyEvent)
   at Terminal.Gui.Application.ProcessKeyEvent(KeyEvent ke)
   at Terminal.Gui.WindowsDriver.ProcessInput(InputRecord inputEvent)
   at Terminal.Gui.WindowsMainLoop.Terminal.Gui.IMainLoopDriver.MainIteratio
n()
   at Terminal.Gui.MainLoop.MainIteration()
   at Terminal.Gui.Application.RunLoop(RunState state, Boolean wait)
   at Terminal.Gui.Application.Run(Toplevel view, Func`2 errorHandler)

Mouse 'sticky' and unresponsive in Linux

Workaround is to run with the command line parameter --usc

Running without this setting seems to result in the mouse getting 'attached' to things that you are trying to drag making them impossible to drop even after releasing the mouse button. Starting drags also seems sluggish without --usc.

Cannot delete menu separators

Since menu separators are in code a 'null' and in the gui unselectable it is not possible to remove them other than by manually editing the .Designer.cs file.

If you create a separator by typing --- as the name then you can undo it with Ctrl+Z but there is no way to revert it if opening an existing .Designer.cs that has separators you want to remove.

Maybe we could add a shortcut or if the separator is the last entry on the list then auto delete it or something?

Checkbox ticked when typing space

With keyboard space ticks Checkboxes. In designer however we support direct typing to provide Text when checkbox is focused (and other controls). This means that as the user types "My lovely checkbox" the tick appears and disapears each time they hit space.

As a 'design time' change (see CreateSubControlDesign) we should remove this keybinding (Space)

Root shortcut for setting keybindings

Some consoles are very restrictive about what key strikes are allowed. Some (Raspain Lite I'm looking at you) don't even report function keys (F2 etc).

Having a shortcut on the main page to wizard the user through all the keybindings the first time would be nice.

Maybe we should also store keybindings in User Settings / Home as alternative to the current directory

Incorrectly adding Border in .Designer.cs (e.g. to label)

Found this issue but was not able to reproduce how it occurs.

Tool produces the following (see below). Problem is this.label2.Border is null when trying to load/use the class the code is produced for.

this.label2 = new Terminal.Gui.Label();
this.label2.Width = 4;
this.label2.Height = 1;
this.label2.X = 17;
this.label2.Y = 7;
this.label2.Data = "label2";
this.label2.Text = "Heya";
this.label2.Border.BorderStyle = Terminal.Gui.BorderStyle.Double;
this.label2.Border.BorderBrush = Terminal.Gui.Color.Black;
this.label2.Border.Effect3D = false;
this.label2.TextAlignment = Terminal.Gui.TextAlignment.Left;
this.Add(this.label2);

Cannot multi delete PosRelative views

Multi delete is a composite command which prevents itself from running if an IsImpossible

Being a PosRelative target for another View prevents deleting (to prevent Exception from an orphaned reference). Normally you have to delete the PosRelative (dependant) first then you can delete the target.

However if you are multi deleting both at the same time it should be allowed.

Or we could just make Delete convert PosRelative to absolute on all Views pointing at the deleted View. This would have to support Undo

Duplicate/invalid fieldnames

It is currently possible to name 2 objects with the same name (Name). This should be detected at edit time, also we should validate the fieldname against leading numbers, spaces etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.