# About drawN

Author:Perry Johnson
A basic drawing framework that includes:

- Drawings are saved as `*.drawN` files, which are SQLite databases.
- drag and drop file opening
- Vector file export to `.pdf`
- Raster file export to jpg, png, tif, and tga
- undo/redo
- layers
- multiple brush styles
  - basic line
  - cloudDraw
  - petalDraw
  - svgDraw - draw with an svg file
  - typeDraw - draw with type
- pen pressure
- save methods
- web accessible tools palette, localhost or by IP
- keyboard shortcuts
- drag and drop font installation - copies to "data/fonts" folder
- drag and drop svg installation - copies to "data/svg" folder
- server logging - initially created to keep versions current between machines on local network
- backup tool that zips the whole app and stores to an FTP server

# Keyboard/Mouse Shortcuts

- F1 - basic line tool
- F2 - cloudDraw tool
- F3 - petalDraw tool
- F4 - svgDraw - drag an SVG file onto the sketch to load the svgDraw brush
- F5 - rebuilds drawing from undoQ (shouldn't be necessary)
- F6 - typeDraw tool
- F7 - not currently used
- F8 - not currently used
- F9 - open netGUI in a web browser
- [ (left bracket) - decrease stroke size
- ] (right bracket) - increase stroke size

- CTRL+Z - undo stroke/group
- CTRL+ALT+Z - undo micro/within group
- CTRL+SHIFT+Z - redo stroke/group
- CTRL+ALT+SHIFT+Z - redo micro/within group
- CTRL+S - Save file - SQLite data storage with .drawN extension is default
- CTRL+E - Export file as PDF, using the filename as a base with timestamp added
- CTRL+C - Copy drawing to clipboard
- CTRL+O - Open a file through a dialog box - drag and drop also works
- CTRL+SHIFT+O - Sets the insertion point x,y to current mouse position

# Dependencies

You'll need the following Processing Libraries installed:

- JavaFX by The Processing Foundation
- Tablet by Andres Colubri
- Drop by Ramin Soleymani
- HTTP Requests for Processing by Rune Madsen, Daniel Shiffman
- UiBooster by Nick 'Milchreis' Muller

# Development & Testing

Primary development platform is Fedora/KDE but testing is also done on macOS and Windows 11.

It should be noted that the author is not a professional programmer. There are undoubtedly many bugs and outright mistakes in the code, along with the inconsistencies consistent with ignorance.

# Change Log

## 3.81

Uploading or downloading a zipped drawN update now shows the upload/download progress.

## 3.8

Updates can be pulled from the server by an item in the menubar `Tools->Update from Server`. This will download and extract a zip file into the sketch folder, overwriting the running sketch. Yeah, I was surprised this would work too!

Some changes to the webGUI, making it more phone friendly.

- Middle mouse click sets origin point for tools that use that, such as for making radiating lines.
- mouse wheel to control scale, distance, iterations, and stroke. Set which property the wheel changes by using SHIFT+Function keys.
  1. Iterations
  2. Distance
  3. Scale
  4. Stroke

webGUI port changed to 8855 because HPlip printer config is using port 8000

Added a function to copy the drawing to the clipboard (CTRL+C).

## 3.79

There's now a menu item under Tools to backup the sketch as a `.zip` file and send it to an FTP server, The server name and path are set in `settings` and the login credentials are requested at first run of the backup command, and saved in `app.properties`.

Added functionality to change canvas color. The canvas is created as a named object, `baseCanvas`, before being inserted into the `undoQ`. There's an added `set_fillColor` method in the `Canvas` class that we can call to change the fill color property of that object.

Cleaned up some things in zip and ftp functionality. After a successful upload, the `.zip` is deleted from the temporary directory.

Instance specific data is now in an `appData` folder. This includes:

- drawings folder
- exported folder
- app.properties
- qr_temp.gif
- recents.txt

drawN will check the user's home directory for a `drawN` folder. If it's present, the above app user data will be saved here.

## 3.78

The LAN IP tools dialog now shows a QR code that can be scanned to go to the tools interface, without typing an IP address and port.

There is a `zxing` QR code library for Processing, but it's not in the Contributions Manager, so the `.jar` files from that library have been placed into the `code` folder.

## 3.77

Added a `>mousePresent` check to check if mouse is in the window on `mouseDragged` to prevent rare situations where the mouse woud exit and then re-enter, glitching to a large stroke. This should be tested more.

## 3.76

Added petalDraw brush, based on cloudDraw. Changed keyboard shortcuts for Undo/Redo to make CTRL+SHIFT+Z perform redo. Keeping CTRL+Y. Micro undo/redo now uses ALT modifier.

## 3.74

Refactored the master server with a controller model. Created an `app.properties` file to hold the database row number associated with the running instance of the application. This allows persistent logging and prevents a situation where unintended rows could be deleted if hostNames were the same.

Right now, this `app.properties` file only has this one bit of data but could hold other variables meeting these conditions:

- Computer or instance specific
- Only determined once the app runs but must persist after it closes
- Cannot or should not be stored in the database

This file should be deleted when copying drawN to another computer or user account.

## 3.73

Changed the appName to drawN. Changed the SQLite table name from drawAppQ to drawQ. Added a mouse alternative to pressure - speed of mouse using `dist()`.

## 3.7

Added version checking and logging to a master server `http://perryjohnson.net/drawN/clients` (updated link after 3.74). Data is stored in a SQLite database and accessed/updated with a PHP script. It returns the version number and a table of client computers that have run drawN (drawApp). Version numbering will change from here out to be a float number.

## 3.6.5

LAN IP address for webGUI can now be found in the Tools menu as well as in Help->About. Bugs fixed on drawing open/import that were showing blank screen, needing a refresh. Drawing now refreshes correctly on window resize. Drawing file extension changed to .drawDB. Lots of bug fixes and cleanup. Windows bugs related to file path separator fixed.

This was sort of a rollback version because some edits were made that broke import/open, flashing the drawing, but requiring a force refreshDrawing to show the drawing. try/catch in refreshDrawing() to fix ConcurrentModificationException, and LAN IP detection were backported into this version from that fork, as was frameRate in setup.

## 3.6

Image place tool added.

## 3.5

Layers! The netGUI has been reworked, also to handle layers via drag-and-drop, double-click to edit name.

## 3.2

Drawing window now has menu bar with some buttons for web tools, fill/stroke colors. Swing dialogs for open/save as/export now replace the UiBooster versions. Open Recent, New, Open Export Folder, and Open Processing Sketch menu/menu items added.

## 3.1

Now working under Processing 4. Save and load operations now have progress indicators. Added typeDraw brush back. Pen now has tilt and side button support. Drag and drop works better now, saving to "fonts" and "svg" folders, with some regex for removing spaces from filenames. PNG thumbnails can be dropped onto drawing window to open the matching .drwDB file. Open/Save operations now have progress indicators.

## 3.0

Complete rewrite.
SQLite storage added so that drawings can be saved and opened, not simply exported to PDF. Code refactoring and restructuring. Most tools removed, may not return. Drag and drop, dialog boxes also added. Lots of UI enhancements, like drag and drop, better file open dialogs, thanks to a couple of Processing libraries - Drop and UiBooster.
Rewrite took about a week of on/off work.

## 2.5.2

Added svgBrush

## 2.5.1

Migrated webUI to Bootstrap 5 Cleaned up undo/redo, attempted consolidation of code into undo/redo methods

## 2.5

Code cleanup
Added documentation
Pen pressure on/off
Added inkDraw tool
Built-in web server for tools GUI, replacing G4P. Some concern for compatibility, as it's not in the repository, but github