/// <summary> /// Default constructor for the class /// </summary> /// <remarks> /// Parametrem by se mohlo predavat jmeno vystupniho konektoru. /// Problem bude s resenim vystupniho konenktoru, pro ktery vlastne /// neni socket ale pozaduje SVG (bud kreslit natvrdo, nebo udelat /// v IBoxModule pro to nejaky zvlastni socket /// </remarks> /// <param name="site">Interface of a graph site (control) /// </param> /// <param name="box">Box that is connected with this node</param> /// <param name="resM">Resource manager of the application</param> /// <param name="svgman">Provider of svg images</param> /// <param name="view">View where this box is located</param> public BoxNode(IGraphSite site, ModulesManager.IBoxModule box, SVGManager svgman, ProjectManager.View view, ResourceManager resM) : base(site) { FerdaConstants constants = new FerdaConstants(); //filling the node this.box = box; this.svgManager = svgman; this.ResManager = resM; //determining the size Rectangle = new RectangleF(0, 0, constants.KrabickaWidth, constants.KrabickaHeight); //adding the output connector //it is not a FerdaConnector, because the box has no socket defined outputConnector = new Connector(this, ResManager.GetString("PropertiesOutputConnector"), true); Connectors.Add(outputConnector); outputConnector.ConnectorLocation = ConnectorLocations.East; //adding the input connectors inputConnectors = new ConnectorCollection(); for (int i = 0; i < box.Sockets.Length; i++) { bool packed = view.IsAnyBoxPackedIn(box, box.Sockets[i].name); inputConnectors.Add( new FerdaConnector(this, svgManager, box.Sockets[i], packed)); Connectors.Add(inputConnectors[i]); inputConnectors[i].ConnectorLocation = ConnectorLocations.West; } //getting the bitmap bitmap = svgManager.GetBoxBitmap(box); //setting the view this.view = view; //adding the moving handler OnMouseDown += new MouseEventHandler(BoxNode_OnMouseDown); OnMouseUp += new MouseEventHandler(BoxNode_OnMouseUp); Resizable = false; this.Text = box.UserName; //using a smaller font - we have big labels mFont = new Font(mFontFamily, 7, FontStyle.Regular, GraphicsUnit.Point); }
///<summary> /// Default constructor for FerdaView class. ///</summary> ///<param name="locManager"> /// Interface that takes care of the ///localizacion in the application /// </param> ///<param name="svgMan"> /// Interface for providing SVG graphics ///</param> ///<param name="menuDisp">Menu displayer</param> ///<param name="view">The view thath should be connected to this desktop</param> ///<param name="pm">The project manager of the application</param> ///<param name="arch">Control that displays the archive</param> ///<param name="provider">Provider of the icons</param> ///<param name="toolBar">Toolbar control</param> public FerdaDesktop(Menu.ILocalizationManager locManager, SVGManager svgMan, IMenuDisplayer menuDisp, ProjectManager.View view, ProjectManager.ProjectManager pm, Archive.IArchiveDisplayer arch, IIconProvider provider, IMenuDisplayer toolBar) : base() { //setting the icon this.provider = provider; //adding the localization localizationManager = locManager; ResManager = localizationManager.ResManager; //adding the svgManager svgManager = svgMan; //setting the menu displayer menuDisplayer = menuDisp; archiveDisplayer = arch; this.toolBar = toolBar; //Current view this.view = view; projectManager = pm; //name of the desktop Name = view.Name; //properties od the GraphControl to work propertly AllowMoveShape = true; AllowAddConnection = true; AllowAddShape = true; AllowDeleteShape = true; AllowDrop = true; AutoScroll = true; EnableContextMenu = true; EnableLayout = false; ShowGrid = false; Zoom = 1; RestrictToCanvas = false; this.ImeMode = System.Windows.Forms.ImeMode.On; //for now trial stuff BackgroundType = Netron.GraphLib.CanvasBackgroundTypes.Gradient; GradientTop = System.Drawing.Color.SkyBlue; //EventHandlers GotFocus += new EventHandler(FerdaDesktop_GotFocus); OnContextMenu += new MouseEventHandler(FerdaDesktop_ContextMenu); OnNewConnection += new NewConnection(FerdaDesktop_OnNewConnection); KeyPress += new KeyPressEventHandler(FerdaDesktop_KeyPress); OnFerdaMouseUp += new MouseEventHandler(FerdaDesktop_OnFerdaMouseUp); OnFerdaDeleteConnection += new FerdaConnection(FerdaDesktop_OnFerdaDeleteConnection); OnShapeRemoved += new NewShape(FerdaDesktop_OnShapeRemoved); //Setting the arrow for connections DefaultLineEnd = ConnectionEnds.RightFilledArrow; //Creation of the boxes and connections Adapt(); }