public void Init(IEnumerable <ToolPrototype> toolSpecs, string filePrefix, string initialCategory, BlockSpace blockSpace) { this.currentCategory = initialCategory; this.toolSpecs = toolSpecs; this.filePrefix = filePrefix; tools.Clear(); dummyFactory = new BlockViewFactory(textMetrics, textFont, blockSpace, new Dictionary <IBlock, IBlockView>(), delegate() { }); foreach (ToolPrototype spec in toolSpecs) { AddNewTool(blockSpace, spec); } }
public BlockController(Graphics textMetrics, Font textFont, Size canvasSize, Func<TextBox> textBoxMaker) { this.Modified += delegate(object sender) { }; blockSpace = new BlockSpace(); blockSpace.OnTopLevelAdded += new TopLevelEvent(blockSpace_OnTopLevelAdded); blockSpace.OnTopLevelDeleted += new TopLevelEvent(blockSpace_OnTopLevelDeleted); blockSpace.OnTopLevelMoved += new TopLevelEvent(blockSpace_OnTopLevelMoved); palette = new Palette(new Size(canvasSize.Width - 20, 60), textMetrics, textFont); palette.Modified += new PaletteModifiedEvent(palette_Modified); canvasView = new CanvasView(textMetrics, canvasSize, allViews, DropRegions, textFont, palette); this.canvasSize = canvasSize; state = CanvasState.Ready; viewFactory = new BlockViewFactory(textMetrics, textFont, blockSpace, blockViews, ()=>Modified(this)); this.textBoxMaker = textBoxMaker; }
public BlockController(Graphics textMetrics, Font textFont, Size canvasSize, Func <TextBox> textBoxMaker) { this.Modified += delegate(object sender) { }; blockSpace = new BlockSpace(); blockSpace.OnTopLevelAdded += new TopLevelEvent(blockSpace_OnTopLevelAdded); blockSpace.OnTopLevelDeleted += new TopLevelEvent(blockSpace_OnTopLevelDeleted); blockSpace.OnTopLevelMoved += new TopLevelEvent(blockSpace_OnTopLevelMoved); palette = new Palette(new Size(canvasSize.Width - 20, 60), textMetrics, textFont); palette.Modified += new PaletteModifiedEvent(palette_Modified); canvasView = new CanvasView(textMetrics, canvasSize, allViews, DropRegions, textFont, palette); this.canvasSize = canvasSize; state = CanvasState.Ready; viewFactory = new BlockViewFactory(textMetrics, textFont, blockSpace, blockViews, () => Modified(this)); this.textBoxMaker = textBoxMaker; }
public EditProcDefController(ProcDefView view, ProcDefBlock model, BlockViewFactory factory, Func<TextBox> textBoxMaker, Button eraseButton) { this.view = view; this.view.Changed += new ViewChangedEvent(view_Changed); this.model = model; this.factory = factory; this.textBoxMaker = textBoxMaker; this.eraseButton = eraseButton; this.eraseButton.Hide(); this.eraseButton.Click += new EventHandler(eraseButton_Click); this.Changed += delegate(object sender) { }; State = EditState.Ready; // I wish the view was dynamically centered, but there's some mismatch // between a label's textbox and the place where the text is drawn // for now we hide it by not constantly moving the view // strangely, the mistmatch disappears (text is drawn in the right place) // when view.RelativePos is not moved anymore. hmm... // Point origin = size.Center(b.Size); Point origin = new Point(15, 15); view.RelativePos = origin; }
public EditProcDefController(ProcDefView view, ProcDefBlock model, BlockViewFactory factory, Func <TextBox> textBoxMaker, Button eraseButton) { this.view = view; this.view.Changed += new ViewChangedEvent(view_Changed); this.model = model; this.factory = factory; this.textBoxMaker = textBoxMaker; this.eraseButton = eraseButton; this.eraseButton.Hide(); this.eraseButton.Click += new EventHandler(eraseButton_Click); this.Changed += delegate(object sender) { }; State = EditState.Ready; // I wish the view was dynamically centered, but there's some mismatch // between a label's textbox and the place where the text is drawn // for now we hide it by not constantly moving the view // strangely, the mistmatch disappears (text is drawn in the right place) // when view.RelativePos is not moved anymore. hmm... // Point origin = size.Center(b.Size); Point origin = new Point(15, 15); view.RelativePos = origin; }
public void Init(IEnumerable<ToolPrototype> toolSpecs, string filePrefix, string initialCategory, BlockSpace blockSpace) { this.currentCategory = initialCategory; this.toolSpecs = toolSpecs; this.filePrefix = filePrefix; tools.Clear(); dummyFactory = new BlockViewFactory(textMetrics, textFont, blockSpace, new Dictionary<IBlock, IBlockView>(), delegate() { }); foreach (ToolPrototype spec in toolSpecs) { AddNewTool(blockSpace, spec); } }