/// <summary> /// Initializes a new instance of the <see cref="T:ConnectionBase"/> class. /// </summary> /// <param name="from">From.</param> /// <param name="to">To.</param> protected ConnectionBase(Point from, Point to) : base() { this.mFrom = new Connector(from); this.mFrom.Parent = this; this.mTo = new Connector(to); this.mTo.Parent = this; PenStyle = ArtPallet.GetDefaultPenStyle(); }
/// <summary> /// Called when the shape is added to the canvas. /// </summary> public void OnAddition() { Transform(new Rectangle(Rectangle.Location, new Size(150, FolderMaterial.constHeaderHeight + 20))); //use a light color rather than the random low saturation color to show off the connection lines PaintStyle = ArtPallet.GetDefaultSolidPaintStyle(); (PaintStyle as SolidPaintStyle).SolidColor = Color.WhiteSmoke; }
/// <summary> /// Inits this instance. /// </summary> private void Init() { mConnectors = new CollectionBase <IConnector>(); mConnectors.OnItemAdded += new EventHandler <CollectionEventArgs <IConnector> >(mConnectors_OnItemAdded); mRectangle = new Rectangle(0, 0, 100, 70); PaintStyle = ArtPallet.GetDefaultPaintStyle(); PenStyle = ArtPallet.GetDefaultPenStyle(); }
/// <summary> /// Initializes a new instance of the <see cref="T:TextLabel"/> class. /// </summary> public TextLabel() : base() { PaintStyle = ArtPallet.GetDefaultSolidPaintStyle(); Resizable = false; connector = new Connector(new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Bottom), Model); connector.Name = "Central connector"; connector.Parent = this; Connectors.Add(connector); }
/// <summary> /// Constructs a connection between the two given points /// </summary> /// <param name="mFrom">the starting point of the connection</param> /// <param name="mTo">the end-point of the connection</param> /// <param name="model">The model.</param> public Connection(Point mFrom, Point mTo, IModel model) : base(model) { this.From = new Connector(mFrom, model); this.From.Name = "From"; this.From.Parent = this; this.To = new Connector(mTo, model); this.To.Name = "To"; this.To.Parent = this; PenStyle = ArtPallet.GetDefaultPenStyle(); }
/// <summary> /// Default constructor /// </summary> protected ControllerBase(IDiagramControl surface) { //doesn't work if you supply a null reference if (surface == null) { throw new NullReferenceException("The diagram control assigned to the controller cannot be 'null'"); } //create the undo/redo manager mUndoManager = new UndoManager(15); mUndoManager.OnHistoryChange += new EventHandler(mUndoManager_OnHistoryChange); #region Instantiation of listeners mouseListeners = new CollectionBase <IMouseListener>(); keyboardListeners = new CollectionBase <IKeyboardListener>(); dragdropListeners = new CollectionBase <IDragDropListener>(); #endregion //keep a reference to the parent control parentControl = surface; AttachToSurface(parentControl); //Make sure the static selection class knows about the model Selection.Controller = this; //Initialize the colorscheme ArtPallet.Init(); #region Tools: the registration order matters! /* * The order in in which the tools are added matters, at least some of them. * The TransformTool should come before the HitToom and the MoveTool after the HitTool. * The order of the drawing tools does not matter. * It's also important to remark that the tools do not depend on the Model. */ registeredTools = new CollectionBase <ITool>(); this.AddTool(new TransformTool("Transform Tool")); this.AddTool(new HitTool("Hit Tool")); this.AddTool(new MoveTool("Move Tool")); this.AddTool(new RectangleTool("Rectangle Tool")); this.AddTool(new ComplexRectangleTool("ComplexRectangle Tool")); this.AddTool(new EllipseTool("Ellipse Tool")); this.AddTool(new SelectionTool("Selection Tool")); this.AddTool(new DragDropTool("DragDrop Tool")); this.AddTool(new ConnectionTool("Connection Tool")); this.AddTool(new ConnectorMoverTool("Connector Mover Tool")); this.AddTool(new GroupTool("Group Tool")); this.AddTool(new UngroupTool("Ungroup Tool")); this.AddTool(new SendToBackTool("SendToBack Tool")); this.AddTool(new SendBackwardsTool("SendBackwards Tool")); this.AddTool(new SendForwardsTool("SendForwards Tool")); this.AddTool(new SendToFrontTool("SendToFront Tool")); this.AddTool(new HoverTool("Hover Tool")); this.AddTool(new ContextTool("Context Tool")); this.AddTool(new CopyTool("Copy Tool")); this.AddTool(new PasteTool("Paste Tool")); this.AddTool(new ScribbleTool("Scribble Tool")); this.AddTool(new PolygonTool("Polygon Tool")); this.AddTool(new MultiLineTool("MultiLine Tool")); #endregion #region Hotkeys HotKeys keys = new HotKeys(this); this.keyboardListeners.Add(keys); #endregion #region Activities //this is in a way a waste of memory; the layouts should not necessarily be loaded //before they are actually requested. You could register only the (string) names instead. //But for just a few algorithms this is OK and the advantage of this registration is that //one can register actions from outside the library, in the hosting form for example. registeredActivity = new CollectionBase <IActivity>(); AddActivity(new RandomLayout(this)); AddActivity(new FruchtermanReingoldLayout(this)); AddActivity(new StandardTreeLayout(this)); AddActivity(new RadialTreeLayout(this)); AddActivity(new BalloonTreeLayout(this)); AddActivity(new ForceDirectedLayout(this)); #endregion }
/// <summary> /// Default ctor /// </summary> /// <param name="s"></param> public TextLabel(IModel s) : base(s) { PaintStyle = ArtPallet.GetDefaultSolidPaintStyle(); Resizable = false; }
/// <summary> /// Default constructor /// </summary> /// <param name="site"></param> protected ConnectionBase(IModel site) : base(site) { PenStyle = ArtPallet.GetDefaultPenStyle(); }
/// <summary> /// Default ctor /// </summary> /// <param name="s"></param> public TextOnly(IModel s) : base(s) { this.PaintStyle = ArtPallet.GetTransparentPaintStyle(); }