Code Monkey home page Code Monkey logo

flowsharp's Introduction

FlowSharp

FlowSharp

Documentation

Article describing object model, code, and example usage.

Requirements to build code

  • Visual Studio 2015 or better
  • .NET 4.6.1 or higher

Features

A short list of some of the features.

Virtual Surface

Virtual Surface

Efficient rendering of shapes

Rendering

Z-ordering

Z-order

Text for shapes

Text

Export diagram to PNG

PNG

Connection points and grips

Virtual Surface

Copy and paste between diagrams

Virtual Surface

Anchor drag snapping

Virtual Surface

Grouping

Grouping

What's not implemented:

Please contribute to working on this list!

  • Shape text:
    • Currently only centered in the shape.
    • Boundaries can be easily exceeded.
    • No justification.
    • Single line only - no auto-wrap.
  • Scrollbars for canvas - currently you drag the canvas to move it.
  • Zoom.
  • Shape rotation.
  • Custom defined connection points.
    • Including on connectors.
  • Adjust custom connection points intelligently when shape is resized.
  • True dynamic connectors.
  • Other line caps besides an arrow and diamond.
  • Ruler margins / page boundaries.
  • Snap shapes to centers and edges.
  • Printing (more or less easily implemented, actually) If you want to print, save the diagram as a PNG and use some other tool!
  • True drag-from-toolbox-onto-surface.
  • Undo/redo. That'll be fun!
  • Better property UX - PropertyGrid's are ok for developers, they are awful for users.

License

The Code Project Open License (CPOL) 1.02

flowsharp's People

Contributors

cliftonm 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  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

flowsharp's Issues

Snap shapes to centers and edges and grid

Similar to Visual Studio's form designer, be able to identify and snap a shape as it's being dragged to other shape centers and edges.
Ability to snap to grid spacing.

Zoom

Implement zoom.

Lines should not snap to connectors so eagerly.

I was drawing the diagram you can see on this screenshot:

The vertical lines are impossible to place after adding the text boxes ("Target", "Args[0]", etc.) because the vertical lines want very much to snap to the vertical edges of the (borderless) text boxes instead of to the outer box. It's probably best if

  • Vertical lines do not snap to horizontal connectors and vice-versa
  • Corner connectors should probably not exist on borderless text boxes
  • Lines do not snap to connectors unless the user is dragging the end of the line (i.e. doing a resize, not a move).

The exception in the screen shot is unrelated but caused me to lose some work, since clicking Continue seems to make the same exception again. I don't know what I did to cause it but here's the stack trace:

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentException: Parameter is not valid.
at System.Drawing.Pen.get_Width()
at FlowSharpLib.VerticalLine.get_UpdateRectangle()
at FlowSharpLib.GraphicElement.OnScreen()
at FlowSharpLib.BaseController.MoveElement(GraphicElement el, Point delta)
at FlowSharpLib.Line.MoveElementOrAnchor(GripType gt, Point delta)
at FlowSharpLib.CanvasController.<>c__DisplayClass8_0.b__0(Connection c)
at System.Collections.Generic.List1.ForEach(Action1 action)
at FlowSharpLib.CanvasController.DragSelectedElements(Point delta)
at FlowSharpLib.MouseController.DragShapes()
at FlowSharpLib.MouseController.b__66_21()
at FlowSharpLib.MouseController.<>c.b__67_1(MouseRouter r)
at System.Collections.Generic.List1.ForEach(Action1 action)
at FlowSharpLib.MouseController.HandleEvent(MouseAction action)
at FlowSharpLib.MouseController.b__64_2(Object sndr, MouseEventArgs args)
at System.Windows.Forms.Control.OnMouseMove(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Snap behavior

If connection points of the group box and the inner children are too close together, a connector
snaps to the wrong connection point. Need to snap to the nearest connection, not just the first near connection.

Replace PropertyGrid

Replace PropertyGrid with a user friendly toolbar.
Be able to show (enable) common properties of multiple selected shapes, disable properties not common to multiple selected shapes.

Implement shape plugins

Being able to plug in shapes defined by others is going to a be a really useful feature for customization.
Technically, even the built-in shapes should be organized as a core plugin.

Selected shape in groupbox dragging when it shouldn't

  1. Create 2 shapes
  2. Group one of the shapes.
  3. Select the shape in the groupbox
  4. Shift-clickdown-drag on the shape outside of the groupbox

Note how the shape inside the groupbox is dragged. This only happens when you start the dragging operation on the ungrouped shape without releasing the mouse button.

Allow snap to be ignored

The request has been made to be able to prevent auto-snapping, particularly when moving a line or connector manually via keyboard arrow keys.

This issue has been resolved by ignoring the snap check when the connector or line is moved while holding down the Ctrl key.

True "document changed"

If the document changes (shapes added / removed) or shape property changes, the document should be flagged as changed and should prompt user for saving changes before exit/new/load.

Bitmap() Parameter not valid upon window minimize

Minimizing the window with or without shapes on it is triggering this error from line 119 of Canvas.cs which is creating a new Bitmap with the height and width passed in. I noticed the height was set to 0 but this is not what is causing the exception as I hardcoded several other heights in which changed nothing. From what I've gathered on SO, it's most likely a memory issue, however, the SO questions I've located are really separate use cases of Bitmap() such as a file stream from a png file and an image size that was taking up like 1.3GB and the issue there was memory cap.

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentException: Parameter is not valid.
   at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
   at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
   at FlowSharpLib.Canvas.CreateBitmap() in D:\Downloaded-Projects\FlowSharp\FlowSharpLib\Canvas.cs:line 119
   at FlowSharpLib.Canvas.<Initialize>b__26_0(Object sndr, EventArgs args) in D:\Downloaded-Projects\FlowSharp\FlowSharpLib\Canvas.cs:line 64
   at System.Windows.Forms.Control.OnResize(EventArgs e)
   at System.Windows.Forms.Panel.OnResize(EventArgs eventargs)
   at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
   at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
   at System.Windows.Forms.Control.UpdateBounds()
   at System.Windows.Forms.Control.WmWindowPosChanged(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1586.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
FlowSharp
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///D:/Downloaded-Projects/FlowSharp/bin/Debug/FlowSharp.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1586.0 built by: NETFXREL2
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1586.0 built by: NETFXREL2
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1586.0 built by: NETFXREL2
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
FlowSharpLib
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///D:/Downloaded-Projects/FlowSharp/bin/Debug/FlowSharpLib.DLL
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1586.0 built by: NETFXREL2
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1586.0 built by: NETFXREL2
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1586.0 built by: NETFXREL2
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Drawing.Design
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1586.0 built by: NETFXREL2
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing.Design/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.Design.dll
----------------------------------------
Accessibility
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1586.0 built by: NETFXREL2
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Connector moves at double rate when canvas is dragged

Create two shapes and a connector attached to both shapes.
Group one of the shapes (without the connector)
Drag the surface.

Observe how the connector attached to the grouped shape disconnects and moves at 2x rate of canvas dragging.

Rulers

A nice to have feature when working on documents that need to fit on specific page sizes.

Image shape

Add a shape that auto-fits and image to the shape's dimensions.

Groups are broken if the group elements fill all space

In the update of about 20 hours ago, if you group together a box and anything else on top of that box, the group is impossible to move and impossible to duplicate, since clicking on the box selects the box, not the group. Even worse, it seems impossible to ungroup the group! The workaround is to select the box and delete it.

In fact, this problem occurs if you simply draw a box and group the box by itself.

Another comment: "Group" now has the unusual side-effect of creating an outer box. This is often useful for me, but it is not always useful. Perhaps there should be two grouping options, "Group in box" and just "Group" (which, consistent with other programs, does not create an outer box or creates an invisible outer box.)

Printing

Currently you have to save as a PNG and then print the PNG with a separate tool.
Dealing with multiple page layout, as well as centering on page, or shrinking to fit on page are must have features.

The selected object should take priority for drag operations

I'm drawing a diagram with boxes nested inside other boxes. While trying to resize the outer box, if an inner box is nearby then FlowSharp tends to prefer to drag that object instead, even if the resize handles of the selected box are closer to the mouse!

Change grid spacing

Related to snapping to grid spacing, changing the grid spacing would be useful.

Improve shape text features

DONE: Corners and justification would be nice.
Text should also be clipped to not exceed extents of shape.
Multi-line text.
Connectors don't support text.
Text location for connectors.

Rotate selected shape when shapes are on top of each other

Currently, only the first discovered shape is selected. For overlapping shapes, it would be nice to rotate the selection between all shapes that qualify as selectable. This requires figuring out how to display a shape underneath another shape.

Z-order not preserved when copy-pasting

Create a big box
Create a small box and drag it into the big box
Shift-click to select the big box
Ctrl+C
Ctrl+V

Notice that the big box is now on top, you have to move its z-order to the bottom for the little box to appear.

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.