private void InternalAddDocument(IPanelModel document) { IPanelFactory factory = PluginFactory.FindPanelFactory(document); IPanelViewModel vm = factory.CreateViewModel(this, document); this.Documents.Add(vm); }
private void DoAfterAppendTab(IPanelModel info) { if (AfterAppendTab != null) { AfterAppendTab(this, new PanelModelEventArgs(info)); } }
private void UpdateThreadInvoked(IPanelModel model, PanelFillerResult fillerResult) { if (model != null) { model.SetFillerResult(fillerResult, m_ClearFilter); } }
public void Start(IPanelModel model, bool clearFilter) { m_SetTabImageThread = new Thread(SetTabImageThread); m_UpdateThread = new Thread(UpdateThread); m_ClearFilter = clearFilter; m_SetTabImageThread.Start(model); m_UpdateThread.Start(model); }
public void TestGetItem() { m_Model.AddTab(NewPanelModel()); IPanelModel item = m_Model.GetItem(0); Assert.NotNull(item); Assert.AreEqual(string.Empty, item.TabName); }
/// <summary>Returns the location and extent in hexes, as a <see cref="CoordsRect"/>, of the current clipping region.</summary> /// <param name="this">The current {HexBoard}.</param> /// <param name="visibleClipBounds"></param> /// <param name="boardSizeHexes"></param> public static CoordsRect GetClipInHexes(this IPanelModel @this, RectangleF visibleClipBounds, HexSize boardSizeHexes) { var left = Math.Max((int)visibleClipBounds.Left / @this.GridSize.Width - 1, 0); var top = Math.Max((int)visibleClipBounds.Top / @this.GridSize.Height - 1, 0); var right = Math.Min((int)visibleClipBounds.Right / @this.GridSize.Width + 1, boardSizeHexes.Width); var bottom = Math.Min((int)visibleClipBounds.Bottom / @this.GridSize.Height + 1, boardSizeHexes.Height); return(new CoordsRect(left, top, right - left, bottom - top)); }
private void Execute_NewPluginCommand(IPanelFactory factory) { IPanelModel model = factory.CreateModel(); if (string.IsNullOrEmpty(model.Title) || string.IsNullOrEmpty(model.FactoryReference)) { throw new InvalidOperationException("Invalid plugin plugin title or factory reference. Contact plugin author!"); } this.Project.ProjectModel.Documents.Add(model); }
private void SetMapBoard(IPanelModel mapBoard) { HexgridPanel.SetModel(MapBoard = mapBoard); MapBoard.ShowPathArrow = MenuBarToolStrip.ShowPathArrow; MapBoard.ShowFov = MenuBarToolStrip.ShowFieldOfView; MapBoard.FovRadius = MapBoard.RangeCutoff = MenuBarToolStrip.PathCutover; MenuBarToolStrip.LoadLandmarkMenu(MapBoard.Landmarks); CustomCoords = new CustomCoords(new IntMatrix2D(2, 0, 0, -2, 0, 2 * MapBoard.MapSizeHexes.Height - 1, 2)); HexgridPanel.Focus(); }
public bool AddTab(IPanelModel model) { // ommit duplicates //if (m_List.Contains(model)) // return false; m_List.Add(model); if (m_SelectedIndex == -1 && m_List.Count == 1) { m_SelectedIndex = 0; } DoAfterAppendTab(model); return(true); }
private static void SetTabImageInvoked(IPanelModel model, string imageName) { if (model == null) { return; } var pagesPresenter = App.MainPages; var index = pagesPresenter.IndexOf(model); if (index != -1) { pagesPresenter.View.SetTabImage(index, App.Images.IndexOf(imageName)); } }
public int IndexOf(IPanelModel model) { if (model == null) { return(-1); } for (int index = 0; index < m_Model.Count; index++) { if (m_Model.GetItem(index) == model) { return(index); } } return(-1); }
public TabPage CreateTabPageFromModel(IPanelModel model) { var tabPage = new TabPage(); //if (!SystemInformation.TerminalServerSession) //{ // System.Reflection.PropertyInfo aProp = // typeof (Control).GetProperty("DoubleBuffered", // System.Reflection.BindingFlags.NonPublic | // System.Reflection.BindingFlags.Instance); // aProp.SetValue(tabPage, true, null); //} tabPage.Padding = new Padding(0); tabPage.Text = model.TabName; tabPage.ImageIndex = App.Images.IndexOf(model.CurrentPath.Item[0].ImageName); tabPage.ToolTipText = model.ToolTipText; return(tabPage); }
public IPanelView CreatePanelView(IPanelModel info) { var panelView = (PanelView)App.Resolve <IPanelView>(); panelView.GridLines = App.Config.ShowGridLines; var listView = panelView.Controls[0] as ListView; if (listView != null) { App.Images.SetImagesTo(listView); listView.View = (View)info.CurrentView; } m_Presenter.SetupPanelViewEvents(panelView); // add new tab and insert panel into it var tabPage = CreateTabPageFromModel(info); panelView.Dock = DockStyle.Fill; tabPage.Controls.Add(panelView); Pages.Controls.Add(tabPage); return(panelView); }
/// <summary>Returns the translation transform-@this for the upper-left corner of the specified hex.</summary> /// <param name="this">The current {HexBoard}.</param> /// <param name="coords">Type: HexCoords - Coordinates of the hex to be tanslated.</param> public static Matrix TranslateToHex(this IPanelModel @this, HexCoords coords) { var offset = @this.UpperLeftOfHex(coords); return(new Matrix(1, 0, 0, 1, offset.X, offset.Y)); }
public PanelModelCopyHelper(IPanelModel model) { m_Model = model; m_Indexes = new List <int>(); }
/// <summary>Rectangular extent in pixels of the defined mapboard.</summary> /// <param name="this">The current {HexBoard}.</param> public static HexSize MapSizePixels(this IPanelModel @this) => @this.MapSizeHexes * @this.GridSizePixels;
/// <summary>Perform the supplied <paramref name="action"/> for every item in the enumeration.</summary> /// <param name="this">The current {HexBoard}.</param> /// <param name="action"></param> public static void ForEachHex <THex, TBoard>(this IPanelModel @this, Action <Maybe <THex> > action) where THex : class, IHex where TBoard : Storage.HexBoard <THex> => @this.ForEachHexSerial <IHex>(hex => action(from h in hex select h as THex));
public override IPanelViewModel CreateViewModel(IProjectViewModel project, IPanelModel model) { return(new MarkersPanelViewModel(this, (MarkerPaneModel)model)); }
/// <summary>Returns the location and extent in hexes, as a <see cref="CoordsRect"/>, of the current clipping region.</summary> /// <param name="this">The current {HexBoard}.</param> /// <param name="visibleClipBounds"></param> public static CoordsRect GetClipInHexes(this IPanelModel @this, RectangleF visibleClipBounds) => @this.GetClipInHexes(visibleClipBounds, @this.MapSizeHexes);
/// <summary>Returns pixel coordinates of centre of specified hex.</summary> /// <param name="this">The current {HexBoard}.</param> /// <param name="coords">The {HexCoords} of the hex of current interest.</param> /// <returns>A Point structure containing pixel coordinates for the (centre of the) specified hex.</returns> public static HexPoint CentreOfHex(this IPanelModel @this, HexCoords coords) => @this.UpperLeftOfHex(coords) + @this.HexCentreOffset;
public override IPanelViewModel CreateViewModel(IProjectViewModel project, IPanelModel model) { return(new TestPanelViewModel(this, (TestPanelModel)model)); }
public abstract IPanelViewModel CreateViewModel(IProjectViewModel project, IPanelModel model);
/// <summary>Returns pixel coordinates of upper-left corner of specified hex.</summary> /// <param name="this">The current {HexBoard}.</param> /// <param name="coords">The {HexCoords} of the hex of current interest.</param> /// <returns>A Point structure containing pixel coordinates for the (upper-left corner of the) specified hex.</returns> public static HexPoint UpperLeftOfHex(this IPanelModel @this, HexCoords coords) => new HexPoint( coords.User.X * @this.GridSize.Width, coords.User.Y * @this.GridSize.Height + (coords.User.X + 1) % 2 * @this.GridSize.Height / 2 );
public bool Equals(IPanelModel other) { return(String.Compare(TabName, other.TabName, StringComparison.OrdinalIgnoreCase) == 0); }
public override IPanelViewModel CreateViewModel(IProjectViewModel project, IPanelModel model) { return(new MapPlotPaneViewModel(project, this, model as TimePlotModel) as IPanelViewModel); }
/// <summary></summary> /// <param name="model">The map to be painted, as a <see cref="IMapDisplayWinForms{THex}"/>.</param> public AbstractModelDisplayPainter(IPanelModel model) => Model = model ?? throw new ArgumentNullException(nameof(model));
public int GetItemIndex(IPanelModel item) { return(m_List.IndexOf(item)); }
/// <summary>Returns the location and extent in hexes, as a <see cref="CoordsRect"/>, of the current clipping region.</summary> /// <param name="this">The current {HexBoard}.</param> /// <param name="point"></param> /// <param name="size"></param> /// <returns>A Point structure containing pixel coordinates for the (centre of the) specified hex.</returns> public static CoordsRect GetClipInHexes(this IPanelModel @this, HexPointF point, HexSizeF size) => @this.GetClipInHexes(new RectangleF(point, size), @this.MapSizeHexes);
public bool AddTab(IPanelModel info) { return(m_Model.AddTab(info)); }
/// <summary></summary> /// <param name="model">The map to be painted, as a <see cref="IMapDisplayWinForms{THex}"/>.</param> public MapDisplayPainter(IPanelModel model) : base(model) { }