Browse Source

Updated docs more

Tig Kindel 1 year ago
parent
commit
e692a312fc
9 changed files with 185 additions and 221 deletions
  1. 0 28
      docfx/docs/color.md
  2. 6 6
      docfx/docs/config.md
  3. 65 0
      docfx/docs/drawing.md
  4. 54 47
      docfx/docs/index.md
  5. 11 6
      docfx/docs/keyboard.md
  6. 13 33
      docfx/docs/layout.md
  7. 28 87
      docfx/docs/mainloop.md
  8. 2 2
      docfx/docs/toc.yml
  9. 6 12
      docfx/index.md

+ 0 - 28
docfx/docs/color.md

@@ -1,28 +0,0 @@
-# Color
-
-## Tenets for Terminal.Gui Color Unless you know better ones...)
-
-Tenets higher in the list have precedence over tenets lower in the list.
-
-* **Gracefully Degrade** - 
-* ..
-
-## Color APIs
-
-...
-
-The [ColorScheme](~/api/Terminal.Gui.ColorScheme.yml) represents
-four values, the color used for Normal text, the color used for normal text when
-a view is focused an the colors for the hot-keys both in focused and unfocused modes.
-
-By using `ColorSchemes` you ensure that your application will work correctbly both
-in color and black and white terminals.
-
-Some views support setting individual color attributes, you create an
-attribute for a particular pair of Foreground/Background like this:
-
-```
-var myColor = Application.Driver.MakeAttribute (Color.Blue, Color.Red);
-var label = new Label (...);
-label.TextColor = myColor
-```

+ 6 - 6
docfx/docs/config.md

@@ -32,12 +32,12 @@ The `UI Catalog` application provides an example of how to use the [`Configurati
 
 
 (Note, this list may not be complete; search the source code for `SerializableConfigurationProperty` to find all settings that can be configured.)
 (Note, this list may not be complete; search the source code for `SerializableConfigurationProperty` to find all settings that can be configured.)
 
 
-    * [Application.QuitKey](~/api/Terminal.Gui.Application.yml#Terminal_Gui_Application_QuitKey)
-    * [Application.AlternateForwardKey](~/api/Terminal.Gui.Application.yml#Terminal_Gui_Application_AlternateForwardKey)
-    * [Application.AlternateBackwardKey](~/api/Terminal.Gui.Application.yml#Terminal_Gui_Application_AlternateBackwardKey)
-    * [Application.UseSystemConsole](~/api/Terminal.Gui.Application.yml#Terminal_Gui_Application_UseSystemConsole)
-    * [Application.IsMouseDisabled](~/api/Terminal.Gui.Application.yml#Terminal_Gui_Application_IsMouseDisabled)
-    * [Application.EnableConsoleScrolling](~/api/Terminal.Gui.Application.yml#Terminal_Gui_Application_EnableConsoleScrolling)
+  * [Application.QuitKey](~/api/Terminal.Gui.Application.yml#Terminal_Gui_Application_QuitKey)
+  * [Application.AlternateForwardKey](~/api/Terminal.Gui.Application.yml#Terminal_Gui_Application_AlternateForwardKey)
+  * [Application.AlternateBackwardKey](~/api/Terminal.Gui.Application.yml#Terminal_Gui_Application_AlternateBackwardKey)
+  * [Application.UseSystemConsole](~/api/Terminal.Gui.Application.yml#Terminal_Gui_Application_UseSystemConsole)
+  * [Application.IsMouseDisabled](~/api/Terminal.Gui.Application.yml#Terminal_Gui_Application_IsMouseDisabled)
+  * [Application.EnableConsoleScrolling](~/api/Terminal.Gui.Application.yml#Terminal_Gui_Application_EnableConsoleScrolling)
 
 
 ## Glyphs
 ## Glyphs
 
 

+ 65 - 0
docfx/docs/drawing.md

@@ -0,0 +1,65 @@
+# Drawing (Text and Color)
+
+Terminal.Gui supports color on all platforms, including Windows, Mac, and Linux. The default colors are 24-bit RGB colors, but the library will gracefully degrade to 16-colors if the terminal does not support 24-bit color, and black and white if the terminal does not support 16-colors.
+
+## Cell
+
+The `Cell` class represents a single cell on the screen. It contains a character and an attribute. The character is of type `Rune` and the attribute is of type `Attribute`. 
+
+Normally `Cell` is not exposed directly to the developer. Instead, the `ConsoleDriver` classes manage the `Cell` array that represents the screen.
+
+To draw a `Cell` to the screen, first use `View.Move` to specify the row and column coordinates and then use the `View.AddRune` method to draw a single glyph. To draw a string, use `View.AddStr`. 
+
+## Unicode
+
+Terminal.Gui supports the full range of Unicode/wide characters. This includes emoji, CJK characters, and other wide characters. For Unicode characters that require more than one cell, `AddRune` and the `ConsoleDriver` automatically manage the cells. Extension methods to `Rune` are provided to determine if a `Rune` is a wide character and to get the width of a `Rune`.
+
+See the Character Map sample app in the [UI Catalog](https://gui-cs.github.io/Terminal.GuiV2Docs/docs/overview.html#ui-catalog) for examples of Unicode characters.
+
+## Attribute 
+
+The `Attribute` class represents the formatting attributes of a `Cell`. It exposes properties for the foreground and background colors. The foreground and background colors are of type `Color`. In the future, it will expose properties for bold, underline, and other formatting attributes.
+
+## Color
+
+The `Color` class represents a color. It provides automatic mapping between the legacy 4-bit (16-color) system and 24-bit colors. It contains properties for the red, green, and blue components of the color. The red, green, and blue components are of type `byte`. The `Color` class also contains a static property for each of the 16 ANSI colors.
+
+## Color Schemes
+
+Terminal.Gui supports named collection of colors called `ColorScheme`s. Three built-in color schemes are provided: "Default", "Dark", and "Light". Additional color schemes can be defined via [Configuration Manager](). 
+
+Color schemes support defining colors for various states of a view. The following states are supported:
+
+* Normal - The color of normal text.
+* HotNormal - The color of text indicating a [Hotkey]().
+* Focus - The color of text that indicates the view has focus.
+* HotFocus - The color of text indicating a hot key, when the view has focus.
+* Disabled - The state of a view when it is disabled.
+
+## Text Formatting
+
+Terminal.Gui supports text formatting using the [TextFormatter]() class. The `TextFormatter` class provides methods for formatting text using the following formatting options:
+
+* Horizontal Alignment - Left, Center, Right
+* Vertical Alignment - Top, Middle, Bottom
+* Word Wrap - Enabled or Disabled
+* Formatting Hot Keys
+
+## Glyphs
+
+Terminal.Gui supports rendering glyphs using the `Glyph` class. The `Glyph` class represents a single glyph. It contains a character and an attribute. The character is of type `Rune` and the attribute is of type `Attribute`. A set of static properties are provided for the standard glyphs used for standard views (e.g. the default indicator for [Button](~/api/Terminal.Gui.Button.yml)) and line drawing (e.g. [LineCanvas](~/api/Terminal.Gui.LineCanvas.yml)).
+
+## Line Drawing
+
+Terminal.Gui supports drawing lines and shapes using box-drawing glyphs. The `LineCanvas` class provides *auto join*, a smart TUI drawing system that automatically selects the correct line/box drawing glyphs for intersections making drawing complex shapes easy. See [Line Canvas](https://gui-cs.github.io/Terminal.GuiV2Docs/docs/overview.html#line-canvas) for details. The `Snake` and `Line Drawing` Scenarios in the [UI Catalog](https://gui-cs.github.io/Terminal.GuiV2Docs/docs/overview.html#ui-catalog) sample app are both examples of the power of the `LineCanvas`.
+
+## Thickness
+
+Describes the thickness of a frame around a rectangle. The thickness is specified for each side of the rectangle using a `Thickness` object. The `Thickness` object contains properties for the left, top, right, and bottom thickness. The `Frame` class uses `Thickness` to support drawing the frame around a view. The `View` class contains three `Frame`-dervied properties: 
+
+* `Margin` - The space between the view and its peers (other views at the same level in the view hierarchy).
+* `Border` - The space between the view and its Padding. This is where the frame, title, and other "Adornments" are drawn.
+* `Padding` - The space between the view and its content. This is where the text, images, and other content is drawn. The inner rectangle of `Padding` is the `Bounds` of a view. 
+
+See [View](~/api/Terminal.Gui.View.yml) for details.
+

+ 54 - 47
docfx/docs/index.md

@@ -33,14 +33,11 @@ Application.Shutdown ();
 return n;
 return n;
 ```
 ```
 
 
-This example shows a prompt and returns an integer value depending on
-which value was selected by the user.
+This example shows a prompt and returns an integer value depending on which value was selected by the user.
 
 
-More interesting user interfaces can be created by composing some of
-the various `View` classes that are included. In the following sections, you
-will see how applications are put together.
+More interesting user interfaces can be created by composing some of the various `View` classes that are included. 
 
 
-In the example above, you can see that we have initialized the runtime by calling [Applicaton.Init](~/api/Terminal.Gui.Application.yml#Terminal_Gui_Application_Init_Terminal_Gui_ConsoleDriver_) - this sets up the environment, initializes the color schemes, and clears the screen to start the application.
+In the example above, [Applicaton.Init](~/api/Terminal.Gui.Application.yml#Terminal_Gui_Application_Init_Terminal_Gui_ConsoleDriver_) sets up the environment, initializes the color schemes, and clears the screen to start the application.
 
 
 The [Application](~/api/Terminal.Gui.Application.yml) class additionally creates an instance of the [Toplevel](~/api/Terminal.Gui.Toplevel.yml) View available in the `Application.Top` property, and can be used like this:
 The [Application](~/api/Terminal.Gui.Application.yml) class additionally creates an instance of the [Toplevel](~/api/Terminal.Gui.Toplevel.yml) View available in the `Application.Top` property, and can be used like this:
 
 
@@ -59,8 +56,7 @@ Application.Run ();
 Application.Shutdown ();
 Application.Shutdown ();
 ```
 ```
 
 
-Typically, you will want your application to have more than a label, you might
-want a menu and a button for example. the following code does this:
+This example includes a menu bar at the top of the screen and a button that shows a message box when clicked:
 
 
 ```csharp
 ```csharp
 using Terminal.Gui;
 using Terminal.Gui;
@@ -97,7 +93,7 @@ All visible elements in a Terminal.Gui application are implemented as
 
 
 See the full list of [Views provided by the Terminal.Gui library here](views.md).
 See the full list of [Views provided by the Terminal.Gui library here](views.md).
 
 
-Every view can contain an arbitrary number of children views, called `SubViews`.Call the
+Every view can contain an arbitrary number of child views, called `SubViews`. Call the
 [View.Add](~/api/Terminal.Gui.View.yml#Terminal_Gui_View_Add_Terminal_Gui_View_) method to add a couple of buttons to a UI:
 [View.Add](~/api/Terminal.Gui.View.yml#Terminal_Gui_View_Add_Terminal_Gui_View_) method to add a couple of buttons to a UI:
 
 
 ```csharp
 ```csharp
@@ -139,68 +135,79 @@ See the full [Layout documentation here](layout.md).
 
 
 Views can either be Modal or Non-modal. Modal views take over all user input until the user closes the View. Examples of Modal Views are Toplevel, Dialog, and Wizard. Non-modal views can be used to create a new experience in your application, one where you would have a new top-level menu for example. Setting the `Modal` property on a View to `true` makes it modal.
 Views can either be Modal or Non-modal. Modal views take over all user input until the user closes the View. Examples of Modal Views are Toplevel, Dialog, and Wizard. Non-modal views can be used to create a new experience in your application, one where you would have a new top-level menu for example. Setting the `Modal` property on a View to `true` makes it modal.
 
 
-### Windows
+To run any View (but especially Dialogs, Windows, or Toplevels) modally, invoke the `Application.Run` method on a Toplevel. Use the `Application.RequestStop()` method to terminate the modal execution.
+
+```csharp
+bool okpressed = false;
+var ok = new Button(3, 14, "Ok") { 
+    Clicked = () => { Application.RequestStop (); okpressed = true; }
+};
+var cancel = new Button(10, 14, "Cancel") {
+    Clicked = () => Application.RequestStop () 
+};
+var dialog = new Dialog ("Login", 60, 18, ok, cancel);
+
+var entry = new TextField () {
+    X = 1, 
+    Y = 1,
+    Width = Dim.Fill (),
+    Height = 1
+};
+dialog.Add (entry);
+Application.Run (dialog);
+if (okpressed)
+    Console.WriteLine ("The user entered: " + entry.Text);
+```
 
 
-[Window](~/api/Terminal.Gui.Window.yml) is a view used in Overlapped layouts, providing a frame and a title - and can be moved and sized with the keyboard or mouse.
+There is no return value from running modally, so the modal view must have a mechanism to indicate the reason the modal was closed. In the case above, the `okpressed` value is set to true if the user pressed or selected the `Ok` button.
 
 
-### Dialogs
+## Windows
+
+[Window](~/api/Terminal.Gui.Window.yml) is a view used in `Overlapped` layouts, providing a frame and a title - and can be moved and sized with the keyboard or mouse.
+
+## Dialogs
 
 
 [Dialogs](~/api/Terminal.Gui.Dialog.yml) are Modal [Windows](~/api/Terminal.Gui.Window.yml) that are centered in the middle of the screen and are intended to be used modally - that is, they run, and they are expected to return a result before resuming execution of the application.
 [Dialogs](~/api/Terminal.Gui.Dialog.yml) are Modal [Windows](~/api/Terminal.Gui.Window.yml) that are centered in the middle of the screen and are intended to be used modally - that is, they run, and they are expected to return a result before resuming execution of the application.
 
 
-Dialogs expose the 
-[`AddButton`](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui.Dialog.yml#Terminal_Gui_Dialog_AddButton_Terminal_Gui_Button_) API which manages the layout
-of any button passed to it, ensuring that the buttons are at the bottom of the dialog.
+Dialogs expose an API for adding buttons and managing the layout such that buttons are at the bottom of the dialog (e.g. [`AddButton`](https://migueldeicaza.github.io/gui.cs/api/Terminal.Gui.Dialog.yml#Terminal_Gui_Dialog_AddButton_Terminal_Gui_Button_)).
 
 
 Example:
 Example:
 ```csharp
 ```csharp
 bool okpressed = false;
 bool okpressed = false;
 var ok = new Button("Ok");
 var ok = new Button("Ok");
 var cancel = new Button("Cancel");
 var cancel = new Button("Cancel");
-var dialog = new Dialog ("Quit", 60, 7, ok, cancel);
+var dialog = new Dialog ("Quit", ok, cancel) { Text = "Are you sure you want to quit?" };
 ```
 ```
 
 
 Which will show something like this:
 Which will show something like this:
+
 ```
 ```
 +- Quit -----------------------------------------------+
 +- Quit -----------------------------------------------+
-|                                                      |
+|            Are you sure you want to quit?            |
 |                                                      |
 |                                                      |
 |                  [ Ok ] [ Cancel ]                   |
 |                  [ Ok ] [ Cancel ]                   |
 +------------------------------------------------------+
 +------------------------------------------------------+
 ```
 ```
 
 
-### Wizards
+## Wizards
 
 
 [Wizards](~/api/Terminal.Gui.Wizard.yml) are Dialogs that let users step through a series of steps to complete a task. 
 [Wizards](~/api/Terminal.Gui.Wizard.yml) are Dialogs that let users step through a series of steps to complete a task. 
 
 
-### Running Modally
-
-To run any View (but especially Dialogs, Windows, or Toplevels) modally, invoke the `Application.Run` method on a Toplevel. Use the `Application.RequestStop()` method to terminate the modal execution.
-
-```csharp
-bool okpressed = false;
-var ok = new Button(3, 14, "Ok") { 
-    Clicked = () => { Application.RequestStop (); okpressed = true; }
-};
-var cancel = new Button(10, 14, "Cancel") {
-    Clicked = () => Application.RequestStop () 
-};
-var dialog = new Dialog ("Login", 60, 18, ok, cancel);
-
-var entry = new TextField () {
-    X = 1, 
-    Y = 1,
-    Width = Dim.Fill (),
-    Height = 1
-};
-dialog.Add (entry);
-Application.Run (dialog);
-if (okpressed)
-    Console.WriteLine ("The user entered: " + entry.Text);
 ```
 ```
-
-There is no return value from running modally, so the modal view must have a mechanism
-of indicating the reason the modal was closed. In the 
-case above, the `okpressed` value is set to true if the user pressed or selected the Ok button.
+╔╡Gandolf - The last step╞════════════════════════════════════╗
+║                                     The wizard is complete! ║
+║☐ Enable Final Final Step                                    ║
+║                                     Press the Finish        ║
+║                                     button to continue.     ║
+║                                                             ║
+║                                     Pressing ESC will       ║
+║                                     cancel the wizard.      ║
+║                                                             ║
+║                                                             ║
+║─────────────────────────────────────────────────────────────║
+║⟦ Back ⟧                                         ⟦► Finish ◄⟧║
+╚═════════════════════════════════════════════════════════════╝
+```
 
 
 ## Input Handling
 ## Input Handling
 
 
@@ -250,7 +257,7 @@ var label = new Label (...);
 label.TextColor = myColor
 label.TextColor = myColor
 ```
 ```
 
 
-Learn more about colors in the [Color](color.md) overview.
+Learn more about colors in the [Drawing](drawing.md) overview.
 
 
 ## MainLoop, Threads and Input Handling
 ## MainLoop, Threads and Input Handling
 
 

+ 11 - 6
docfx/docs/keyboard.md

@@ -16,21 +16,26 @@ Tenets higher in the list have precedence over tenets lower in the list.
 
 
 *Terminal.Gui* provides the following APIs for handling keyboard input:
 *Terminal.Gui* provides the following APIs for handling keyboard input:
 
 
+### **[Key](~/api/Terminal.Gui.Key.yml)**
+
+The `Key` class provides a platform-independent abstraction for common keyboard operations. It is used for processing keyboard input and raising keyboard events. This class provides a high-level abstraction with helper methods and properties for common keyboard operations. Use this class instead of the low-level `KeyCode` enum when possible.
+
+See [Key](~/api/Terminal.Gui.Key.yml) for more details.
+
 ### **[Key Bindings](~/api/Terminal.Gui.KeyBindings.yml)**
 ### **[Key Bindings](~/api/Terminal.Gui.KeyBindings.yml)**
 
 
-The default key for activating a button is `Space`. You can change this using the 
-`ClearKeybinding` and `AddKeybinding` methods:
+The default key for activating a button is `Space`. You can change this using  
+`Keybindings.Clear` and `Keybinding.Add` methods:
 
 
 ```csharp
 ```csharp
 var btn = new Button ("Press Me");
 var btn = new Button ("Press Me");
-btn.ClearKeybinding (Command.Accept);
-btn.AddKeyBinding (Key.B, Command.Accept);
+btn.Keybinding.Remove (Command.Accept);
+btn.KeyBinding.Add (Key.B, Command.Accept);
 ```
 ```
 
 
 The [Command](~/api/Terminal.Gui.Command.yml) enum lists generic operations that are implemented by views. For example `Command.Accept` in a `Button` results in the `Clicked` event 
 The [Command](~/api/Terminal.Gui.Command.yml) enum lists generic operations that are implemented by views. For example `Command.Accept` in a `Button` results in the `Clicked` event 
 firing while in `TableView` it is bound to `CellActivated`. Not all commands
 firing while in `TableView` it is bound to `CellActivated`. Not all commands
-are implemented by all views (e.g. you cannot scroll in a `Button`). Use the `GetSupportedCommands()`
-method to determine which commands are implemented by a `View`. 
+are implemented by all views (e.g. you cannot scroll in a `Button`). Use the `GetSupportedCommands()` method to determine which commands are implemented by a `View`. 
 
 
 ### **[HotKey](~/api/Terminal.Gui.View.yml#Terminal_Gui_View_HotKey)** 
 ### **[HotKey](~/api/Terminal.Gui.View.yml#Terminal_Gui_View_HotKey)** 
 
 

+ 13 - 33
docfx/docs/layout.md

@@ -1,51 +1,31 @@
 # Layout
 # Layout
 
 
-## Tenets for Terminal.Gui View Layout (Unless you know better ones...)
+Terminal.Gui v2 supports the following View layout systems (controlled by the [View.LayoutStyle](~/api/Terminal.Gui.LayoutStyle.yml)):
 
 
-Tenets higher in the list have precedence over tenets lower in the list.
-
-* **Users Have Control** - *Terminal.Gui* provides default key bindings consistent with these tenets, but those defaults are configurable by the user. For example, `ConfigurationManager` allows users to redefine key bindings for the system, a user, or an application.
-
-* **More Editor than Command Line** - Once a *Terminal.Gui* app starts, the user is no longer using the command line. Users expect keyboard idioms in TUI apps to be consistent with GUI apps (such as VS Code, Vim, and Emacs). For example, in almost all GUI apps, `Ctrl-V` is `Paste`. But the Linux shells often use `Shift-Insert`. *Terminal.Gui* binds `Ctrl-V` by default.
-
-* **Be Consistent With the User's Platform** - Users get to choose the platform they run *Terminal.Gui* apps on and those apps should respond to keyboard input in a way that is consistent with the platform. For example, on Windows to erase a word to the left, users press `Ctrl-Backspace`. But on Linux, `Ctrl-W` is used.
-
-* **The Source of Truth is Wikipedia** - We use this [Wikipedia article](https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts) as our guide for default key bindings.
-
-
-
-Terminal.Gui supports two different layout systems, absolute and computed \
-(controlled by the [LayoutStyle](~/api/Terminal.Gui.LayoutStyle.yml)
-property on the view.
-
-The absolute system is used when you want the view to be positioned exactly in
-one location and want to manually control where the view is. This is done
-by invoking your View constructor with an argument of type [Rect](~/api/Terminal.Gui.Rect.yml). When you do this, to change the position of the View, you can change the `Frame` property on the View.
-
-The computed layout system offers a few additional capabilities, like automatic
-centering, expanding of dimensions and a handful of other features. To use
-this you construct your object without an initial `Frame`, but set the 
- `X`, `Y`, `Width` and `Height` properties after the object has been created.
+* **Absolute** - Used to have the View positioned exactly in a location, with a fixed size. Absolute layout is accomplished by constructing a View with an argument of type [Rect](~/api/Terminal.Gui.Rect.yml) or directly changing the `Frame` property on the View.
+* **Computed** - The Computed Layout system provides automatic aligning of Views with other Views, automatic centering, and automatic sizing. To use Computed layout set the 
+ `X`, `Y`, `Width` and `Height` properties after the object has been created. Views laid out using the Computed Layout system can be resized with the mouse or keyboard, enabling tiled window managers and dynamic terminal UIs.
+* **Overlapped** - New in V2 (But not yet) - Overlapped layout enables views to be positioned on top of each other. Overlapped Views are movable and sizable with both the keyboard and the mouse.
 
 
 Examples:
 Examples:
 
 
 ```csharp
 ```csharp
+// Absolute layout using a provided rectangle
+var label1 = new Label (new Rect (1, 1, 20, 1), "Hello")
 
 
-// Dynamically computed
-var label = new Label ("Hello") {
-    X = 1,
+// Computed Layout
+var label2 = new Label ("Hello") {
+    X = Pos.Right (label2),
     Y = Pos.Center (),
     Y = Pos.Center (),
     Width = Dim.Fill (),
     Width = Dim.Fill (),
     Height = 1
     Height = 1
 };
 };
 
 
-// Absolute position using the provided rectangle
-var label2 = new Label (new Rect (1, 2, 20, 1), "World")
 ```
 ```
 
 
-The computed layout system does not take integers, instead the `X` and `Y` properties are of type [Pos](~/api/Terminal.Gui.Pos.yml) and the `Width` and `Height` properties are of type [Dim](~/api/Terminal.Gui.Dim.yml) both which can be created implicitly from integer values.
+When using *Computed Layout* the `X` and `Y` properties are of type [Pos](~/api/Terminal.Gui.Pos.yml) and the `Width` and `Height` properties are of type [Dim](~/api/Terminal.Gui.Dim.yml) both of which can be created implicitly from integer values.
 
 
-### The `Pos` Type
+## The `Pos` Type
 
 
 The `Pos` type on `X` and `Y` offers a few options:
 The `Pos` type on `X` and `Y` offers a few options:
 * Absolute position, by passing an integer
 * Absolute position, by passing an integer
@@ -69,7 +49,7 @@ myView.X = Pos.X (view);
 myView.Y = Pos.Bottom (anotherView);
 myView.Y = Pos.Bottom (anotherView);
 ```
 ```
 
 
-### The `Dim` Type
+## The `Dim` Type
 
 
 The `Dim` type is used for the `Width` and `Height` properties on the View and offers
 The `Dim` type is used for the `Width` and `Height` properties on the View and offers
 the following options:
 the following options:

+ 28 - 87
docfx/docs/mainloop.md

@@ -2,64 +2,44 @@
 
 
 _See also [Cross-platform Driver Model](drivers.md)_
 _See also [Cross-platform Driver Model](drivers.md)_
 
 
-The method `Application.Run` that we covered before will wait for
-events from either the keyboard or mouse and route those events to the
-proper view.
+The method `Application.Run` will wait for events from either the keyboard or mouse and route those events to the proper view.
 
 
-The job of waiting for events and dispatching them in the
-`Application` is implemented by an instance of the
-[`MainLoop`]()
-class.
+The job of waiting for events and dispatching them in the `Application` is implemented by an instance of the Main Loop.
 
 
-Mainloops are a common idiom in many user interface toolkits so many
-of the concepts will be familiar to you if you have used other
-toolkits before.
+Main loops are a common idiom in many user interface toolkits so many of the concepts will be familiar to you if you have used other toolkits before.
 
 
 This class provides the following capabilities:
 This class provides the following capabilities:
 
 
 * Keyboard and mouse processing
 * Keyboard and mouse processing
 * .NET Async support
 * .NET Async support
 * Timers processing
 * Timers processing
-* Invoking of UI code from a background thread
 * Idle processing handlers
 * Idle processing handlers
-* Possibility of integration with other mainloops.
-* On Unix systems, it can monitor file descriptors for readability or writability.
+* Invoking UI code from a background thread
 
 
-The `MainLoop` property in the the
-[`Application`](~/api/Terminal.Gui.Application.yml)
+The `MainLoop` property in the the [`Application`](~/api/Terminal.Gui.Application.yml)
 provides access to these functions.
 provides access to these functions.
 
 
-When your code invokes `Application.Run (Toplevel)`, the application
-will prepare the current
-[`Toplevel`](~/api/Terminal.Gui.Toplevel.yml) instance by
-redrawing the screen appropriately and then calling the mainloop to
-run.   
+When `Application.Run (Toplevel)` is called, the application will prepare the current
+[`Toplevel`](~/api/Terminal.Gui.Toplevel.yml) instance by redrawing the screen appropriately and then starting the main loop.
 
 
-You can configure the Mainloop before calling Application.Run, or you
-can configure the MainLoop in response to events during the execution.
+Configure the Mainloop before calling Application.Run, or  configure the MainLoop in response to events during the execution.
 
 
-The keyboard inputs is dispatched by the application class to the
-current TopLevel window this is covered in more detail in the
+Keyboard input is dispatched by the Application class to the
+current TopLevel window. This is covered in more detail in the
 [Keyboard Event Processing](keyboard.md) document.
 [Keyboard Event Processing](keyboard.md) document.
 
 
 Async Execution
 Async Execution
 ---------------
 ---------------
 
 
-On startup, the `Application` class configured the .NET Asynchronous
-machinery to allow you to use the `await` keyword to run tasks in the
+On startup, the `Application` class configures the .NET Asynchronous
+machinery to allow the use of the `await` keyword to run tasks in the
 background and have the execution of those tasks resume on the context
 background and have the execution of those tasks resume on the context
 of the main thread running the main loop.
 of the main thread running the main loop.
 
 
-Once you invoke `Application.Main` the async machinery will be ready
-to use, and you can merely call methods using `await` from your main
-thread, and the awaited code will resume execution on the main
-thread. 
-
 Timers Processing
 Timers Processing
 -----------------
 -----------------
 
 
-You can register timers to be executed at specified intervals by
-calling the [`AddTimeout`]() method, like this:
+Timers can be set to be executed at specified intervals by calling the [`AddTimeout`]() method, like this:
 
 
 ```csharp
 ```csharp
 void UpdateTimer ()
 void UpdateTimer ()
@@ -70,8 +50,7 @@ void UpdateTimer ()
 var token = Application.MainLoop.AddTimeout (TimeSpan.FromSeconds (20), UpdateTimer);
 var token = Application.MainLoop.AddTimeout (TimeSpan.FromSeconds (20), UpdateTimer);
 ```
 ```
 
 
-The return value from AddTimeout is a token value that you can use if
-you desire to cancel the timer before it runs:
+The return value from AddTimeout is a token value that can be used to cancel the timer:
 
 
 ```csharup
 ```csharup
 Application.MainLoop.RemoveTimeout (token);
 Application.MainLoop.RemoveTimeout (token);
@@ -80,82 +59,44 @@ Application.MainLoop.RemoveTimeout (token);
 Idle Handlers
 Idle Handlers
 -------------
 -------------
 
 
-You can register code to be executed when the application is idling
-and there are no events to process by calling the
-[`AddIdle`]()
-method. This method takes as a parameter a function that will be
-invoked when the application is idling. 
-
-Idle functions should return `true` if they should be invoked again,
+[`AddIdle`]() registers a function to be executed when the application is idling and there are no events to process. Idle functions should return `true` if they should be invoked again,
 and `false` if the idle invocations should stop.
 and `false` if the idle invocations should stop.
 
 
-Like the timer APIs, the return value is a token that can be used to
-cancel the scheduled idle function from being executed.
+Like the timer APIs, the return value is a token that can be used to cancel the scheduled idle function from being executed.
 
 
 Threading
 Threading
 ---------
 ---------
 
 
-Like other UI toolkits, Terminal.Gui is generally not thread safe.
-You should avoid calling methods in the UI classes from a background
-thread as there is no guarantee that they will not corrupt the state
-of the UI application. 
-
-Generally, as there is not much state, you will get lucky, but the
-application will not behave properly.
+Like most UI toolkits, Terminal.Gui should be assumed to not be thread-safe. Avoid calling methods in the UI classes from a background thread as there is no guarantee they will not corrupt the state of the UI application. 
 
 
-You will be served better off by using C# async machinery and the
-various APIs in the `System.Threading.Tasks.Task` APIs.  But if you
-absolutely must work with threads on your own you should only invoke
-APIs in Terminal.Gui from the main thread.
+Instead, use C# async APIs (e.g. `await` and `System.Threading.Tasks.Task`). Only invoke
+APIs in Terminal.Gui from the main thread by using the `Application.Invoke`
+method to pass an `Action` that will be queued for execution on the main thread at an appropriate time.
 
 
-To make this simple, you can use the `Application.MainLoop.Invoke`
-method and pass an `Action`. This action will be queued for execution
-on the main thread at an appropriate time and will run your code
-there.
+For example, the following shows how to properly update a label from a background thread:
 
 
-For example, the following shows how to properly update a label from a
-background thread:
-
-```
+```cs
 void BackgroundThreadUpdateProgress ()
 void BackgroundThreadUpdateProgress ()
 {
 {
-	Application.MainLoop.Invoke (() => {
+	Application.Invoke (() => {
 		progress.Text = $"Progress: {bytesDownloaded/totalBytes}";
 		progress.Text = $"Progress: {bytesDownloaded/totalBytes}";
         });
         });
 }
 }
 ```
 ```
 
 
-Integration With Other Main Loop Drivers
+Low-Level Application APIs
 ----------------------------------------
 ----------------------------------------
 
 
-It is possible to run the main loop in a way that it does not take
-over control of your application, but rather in a cooperative way.
-
-To do this, you must use the lower-level APIs in `Application`: the
-`Begin` method to prepare a toplevel for execution, followed by calls
-to `MainLoop.EventsPending` to determine whether the events must be
-processed, and in that case, calling `RunLoop` method and finally
-completing the process  by calling `End`.
+It is possible to run the main loop in a cooperative way: Use the lower-level APIs in `Application`: the `Begin` method to prepare a toplevel for execution, followed by calls
+to `MainLoop.EventsPending` to determine whether the events must be processed, and in that case, calling `RunLoop` method and finally completing the process  by calling `End`.
 
 
 The method `Run` is implemented like this:
 The method `Run` is implemented like this:
 
 
-```
+```cs
 void Run (Toplevel top)
 void Run (Toplevel top)
 {
 {
 	var runToken = Begin (view);
 	var runToken = Begin (view);
 	RunLoop (runToken);
 	RunLoop (runToken);
 	End (runToken);
 	End (runToken);
 }
 }
-```
-
-Unix File Descriptor Monitoring
--------------------------------
-
-On Unix, it is possible to monitor file descriptors for input being
-available, or for the file descriptor being available for data to be
-written without blocking the application.
-
-To do this, you on Unix, you can cast the `MainLoop` instance to a
-[`UnixMainLoop`]()
-and use the `AddWatch` method to register an interest on a particular
-condition.
+```

+ 2 - 2
docfx/docs/toc.yml

@@ -8,8 +8,8 @@
   href: views.md
   href: views.md
 - name: Configuration
 - name: Configuration
   href: config.md
   href: config.md
-- name: Color
-  href: color.md
+- name: Drawing (Text and Color)
+  href: drawing.md
 - name: Cross-platform Driver Model
 - name: Cross-platform Driver Model
   href: drivers.md
   href: drivers.md
 - name: Keyboard Event Processing
 - name: Keyboard Event Processing

+ 6 - 12
docfx/index.md

@@ -1,25 +1,19 @@
 # Terminal.Gui v2 - Cross Platform Terminal UI toolkit for .NET
 # Terminal.Gui v2 - Cross Platform Terminal UI toolkit for .NET
 
 
-**NOTE** v2 is still in development (see the `v2_develop` branch). The current stable version of v1 is in the `develop` branch. 
+**NOTE** 
+>v2 is still in development (see the `v2_develop` branch). The current stable version of v1 is in the `develop` branch. 
+
+
+
 
 
 A toolkit for building rich console apps for .NET that run on Windows, the Mac, and Linux.
 A toolkit for building rich console apps for .NET that run on Windows, the Mac, and Linux.
 
 
 ![Sample](images/sample.gif)
 ![Sample](images/sample.gif)
 
 
-* [Terminal.Gui Project on GitHub](https://github.com/gui-cs/Terminal.Gui)
-
 ## Terminal.Gui API Documentation
 ## Terminal.Gui API Documentation
 
 
-* [What's new in v2](~/docs/newinv2.md)
+* [Conceptual Documentation](~/docs)
 * [API Reference](~/api/Terminal.Gui.yml)
 * [API Reference](~/api/Terminal.Gui.yml)
-* [Views and controls built into the Terminal.Gui library](~/docs/views.md)
-* [Terminal.Gui API Overview](~/docs/index.md)
-* [Keyboard Event Processing](~/docs/keyboard.md)
-* [Event Processing and the Application Main Loop](~/docs/mainloop.md)
-* [Cross-platform Driver Model](~/docs/drivers.md)
-* [Configuration and Theme Manager](~/docs/config.md)
-* [TableView Deep Dive](~/docs/tableview.md)
-* [TreeView Deep Dive](~/docs/treeview.md)
 
 
 ## UI Catalog
 ## UI Catalog