PabloDraw

repository·main·Indexed 19 days ago

https://github.com/cwensley/pablodraw

An Ansi/Ascii text and RIPscrip vector graphic art editor and viewer supporting multi-user capabilities. Built with .NET 6 and Eto.Forms, it provides tools for editing and viewing documents, including a comprehensive set of RIPscrip commands for drawing shapes like arcs, circles, Beziers, and rectangles.

Tokens
14.8K
Snippets
80
Records
97
Agent score
65%

What's inside PabloDraw

  1. Build PabloDraw from source

    main

    To build PabloDraw, you must have VS Code and the .NET 6 SDK installed. The project includes build tasks and launch configurations compatible with Windows, Linux, and MacOS.

    To build using the command line, run the dotnet build command against the project file.

    dotnet build Source\Pablodraw\PabloDraw.csproj
  2. Overview of PabloDraw

    main

    PabloDraw v3 is a cross-platform integrated viewer and editor for ANSI art and other character/vector formats. It is designed to provide a native user experience on all major operating systems by using platform-specific toolkits:

    • macOS: Uses Cocoa
    • Linux: Uses GTK
    • Windows: Uses Windows Forms

    Supported Formats

    Viewing

    • Character Formats: ANSI, ADF, ASCII, AVT, BIN, CG, IDF, XBIN, Tundra, CtrlA, ANSiMation
    • Vector Formats: RIP
    • Image Formats: JPEG, GIF, PNG, TIFF, BMP

    Note: Character and vector formats can be saved as any supported image format for web sharing or viewing.

    Editing and Creation

    PabloDraw can edit or create the following formats and save them as:

    • ANSI, ASCII (no colour), BIN, Tundra, CtrlA, XBIN, and RIP.
  3. Main class overview

    main
    The Main class is the central entrypoint and primary controller for the PabloDraw desktop application. It inherits from Eto.Forms.Form and implements IClientDelegate and IClientSource. It manages the application lifecycle, including window state, file loading, document editing modes, server/client connections, and the orchestration of UI components like the FileList, PadPanel, and Splitter.
  4. Server versioning and connection approval

    main

    The server enforces protocol versioning. When a client attempts to connect, the server checks the version provided in the ConnectionApproval message against Server.VERSION (currently 8). If they do not match, the connection is denied with a version mismatch error.

    Connection approval also validates:

    • Passwords: If Password is set on the server, clients must provide a matching password. If OperatorPassword is provided, it grants UserLevel.Operator.
  5. Manage application state via Main properties

    main

    The Main class exposes several key properties to control the application state:

    • Server: Sets or gets the current Server instance. Changing this triggers the ServerChanged event.
    • Client: Sets or gets the current Client instance. Changing this triggers the ClientChanged event and configures client-specific behaviors like user changes and disconnections.
    • EditMode: A boolean property that toggles whether the current document is in an editable state. Toggling this triggers OnEditModeChanged and adjusts UI layouts (e.g., splitter positions).
    • Document: Returns the currently active Document via the ViewHandler. Returns null if no document is loaded.
    • Settings: Accesses the application's Settings object for persistent configuration.
    • FileList: Accesses the FileList component used for navigating the file system.
    • ViewHandler: Returns the current Handler associated with the active document.
  6. Use ANSI Editing in PabloDraw

    main

    PabloDraw provides several shortcuts for ANSI editing:

    Cursor and Selection:

    • Arrows: Move cursor
    • Shift+Arrows: Move cursor and select block
    • Alt+B: Begin block selection
    • Ins: Toggle insert mode (use FN+Return on macOS)
    • Alt+Left: Delete column at cursor
    • Alt+Right: Insert column at cursor
    • Alt+Up: Delete row at cursor
    • Alt+Down: Insert row at cursor

    Color and Attributes:

    • Ctrl+0-7: Change Foreground color (repeat to change brightness)
    • Alt+0-7: Change Background color (repeat to change brightness)
    • Ctrl+Up: Previous foreground color
    • Ctrl+Down: Next foreground color
    • Ctrl+Left: Previous background color
    • Ctrl+Right: Next background color
    • Alt+U: Use attribute under cursor

    Character Selection:

    • F1-F10: Draw character from current character set
    • Alt+F1-F10: Select Character Sets 1-10
    • Ctrl+F1-F10: Select Character Sets 11-20
  7. Install PabloDraw on Windows

    main

    To install PabloDraw on Windows, run the PabloDraw.msi installer. The installer automatically handles the following:

    • Installs all necessary pre-requisites (such as .NET 4.8 or greater).
    • Sets up file associations.
    • Adds a shortcut to your Start menu for easy launching.
    Run PabloDraw.msi
  8. Install PabloDraw on macOS

    main

    To install PabloDraw on macOS, run the PabloDraw.dmg file and drag the PabloDraw application into your Applications folder.

    Requirements:

    • macOS 10.14 (Mojave) or greater.

    Note on Keyboard Usage: To use function keys (F1, F2, etc.) without having to press the FN key, change your settings in System Preferences > Keyboard > Use all F1, F2, etc. keys as standard function keys. To toggle INSERT mode on a Mac keyboard, use FN+Return.

    Run PabloDraw.dmg
  9. Configure application settings and window state

    main

    The application manages its configuration via an XML file.

    • Settings File Location: The configuration is stored in EtoEnvironment.GetFolderPath(EtoSpecialFolder.ApplicationSettings)/PabloDraw/PabloDraw.config.
    • Persistence: The WriteXml() method persists the current Settings, the current directory of the FileList, and the window's state (size, position, and visibility) to the configuration file.
    • Loading: The ReadXml() method (called during construction) restores settings and the last used directory.