public void CreateImageAtXY(string imageKey, double x, double y) { PixbufRepository.AddOrUpdatePixbufByName(imageKey); var point = new Cairo.PointD(x / Zoom, y / Zoom); var sectionView = getSectionViewByXY(x, y); var localpoint = sectionView.PointInSectionByAbsolutePoint(point); ToolBoxService.SetToolByName("ImageTool"); SelectedTool.CreateNewControl(sectionView); var image = (SelectedControl.ControlModel as Image); image.ImageKey = imageKey; image.Location = new MonoReports.Model.Point(localpoint.X, localpoint.Y); SelectedTool.CreateMode = false; }
public void CreateTextBlockAtXY(string text, string fieldName, FieldKind fieldKind, double x, double y) { var point = new Cairo.PointD(x / Zoom, y / Zoom); var sectionView = getSectionViewByXY(x, y); if (sectionView != null) { var localpoint = sectionView.PointInSectionByAbsolutePoint(point); ToolBoxService.SetToolByName("TextBlockTool"); SelectedTool.CreateNewControl(sectionView); var textBlock = (SelectedControl.ControlModel as TextBlock); textBlock.Text = fieldName; textBlock.FieldName = fieldName; textBlock.FieldKind = fieldKind; textBlock.Location = new MonoReports.Model.Point(localpoint.X, localpoint.Y); SelectedTool.CreateMode = false; } }
public void ButtonPress(double x, double y, int clicks) { StartPressPoint = new Cairo.PointD(x / Zoom, y / Zoom); IsPressed = true; IsMoving = false; if (!IsMoving) { PreviousMousePoint = StartPressPoint; DeltaPoint = new PointD(0, 0); for (int i = 0; i < SectionViews.Count; i++) { var sectionView = SectionViews [i]; if (sectionView.AbsoluteBound.ContainsPoint(StartPressPoint.X, StartPressPoint.Y)) { if (sectionView.HeaderAbsoluteBound.ContainsPoint(StartPressPoint.X, StartPressPoint.Y)) { SelectedControl = sectionView; SelectedTool = null; continue; } else if (sectionView.GripperAbsoluteBound.ContainsPoint(StartPressPoint.X, StartPressPoint.Y)) { SelectedControl = sectionView; } else { if (SelectedTool != null && SelectedTool.CreateMode) { SelectedTool.CreateNewControl(sectionView); SelectedTool.CreateMode = false; } else { SelectedControl = null; for (int j = 0; j < sectionView.Controls.Count; j++) { var controlView = sectionView.Controls [j]; if (controlView.ContainsPoint(StartPressPoint.X, StartPressPoint.Y)) { SelectedControl = controlView; break; } } } } } } } if (SelectedTool != null) { if (clicks == 1) { SelectedTool.OnMouseDown(); } else { SelectedTool.OnDoubleClick(); } } WorkspaceService.InvalidateDesignArea(); }