Ejemplo n.º 1
0
 protected internal override Rectangle AdjustDockControlClientBounds(ControlLayoutSystem layoutSystem, DockControl control, Rectangle clientBounds)
 {
     if (layoutSystem is DocumentLayoutSystem)
     {
         clientBounds.Inflate(-4, -4);
         return clientBounds;
     }
     return base.AdjustDockControlClientBounds(layoutSystem, control, clientBounds);
 }
Ejemplo n.º 2
0
		public MainWindow()
		{
			InitializeComponent();

			DataContext = ShellViewModel.Instance;

			IoC.Get<ICommandKeyGestureService>().BindKeyGestures(this);
			this.AttachDevTools();

            _mainDock = this.Find<DockControl>("mainDock");
		}
Ejemplo n.º 3
0
		protected internal override Rectangle AdjustDockControlClientBounds(ControlLayoutSystem layoutSystem, DockControl control, Rectangle clientBounds)
		{
			if (layoutSystem is DocumentLayoutSystem)
			{
				clientBounds.X++;
				clientBounds.Width -= 2;
				clientBounds.Height--;
				return clientBounds;
			}
			return base.AdjustDockControlClientBounds(layoutSystem, control, clientBounds);
		}
Ejemplo n.º 4
0
        private static void x47161f81513f1258(
            DockControl x76b3d9d2638e5ecd,
            XmlTextWriter xbdfb620b7167944b,
            x129cb2a2bdfd0ab2 x592a8acce305e2d8,
            string x05bcae9c376a7a50)
        {
            TypeConverter converter = TypeDescriptor.GetConverter(typeof(int));

            xbdfb620b7167944b.WriteAttributeString(x05bcae9c376a7a50 + "WorkingSize", SandDockManager.ConvertSizeFToString(x592a8acce305e2d8.x3a4e0c379519d4a2));
            xbdfb620b7167944b.WriteAttributeString(x05bcae9c376a7a50 + "WindowGroupGuid", x592a8acce305e2d8.x703937d70a13725c.ToString());
            xbdfb620b7167944b.WriteAttributeString(x05bcae9c376a7a50 + "IndexInWindowGroup", converter.ConvertToString((ITypeDescriptorContext)null, CultureInfo.InvariantCulture, (object)x592a8acce305e2d8.x8c8f170696764fac));
            xbdfb620b7167944b.WriteAttributeString(x05bcae9c376a7a50 + "SplitPath", x245a5abec1c73d3a.x8c8bb4495a487cc5(x592a8acce305e2d8.x61743036ad30763d));
        }
Ejemplo n.º 5
0
        private static bool TryGetSourceTabControl(DockItem dockItem, out DockControl dockControl)
        {
            var sourceOfDockItemsControl =
                dockItem.GetSelfAndLogicalAncestors().OfType <ItemsControl>().FirstOrDefault() as DockItemsControl;

            if (sourceOfDockItemsControl == null)
            {
                throw new ApplicationException("Unable to determine source items control.");
            }

            dockControl = DockControl.GetOwnerOfHeaderItems(sourceOfDockItemsControl);

            return(dockControl != null);
        }
Ejemplo n.º 6
0
        internal static void x4229d31a884b2577(
            DockControl x76b3d9d2638e5ecd,
            XmlTextWriter xbdfb620b7167944b)
        {
            TypeConverter converter1 = TypeDescriptor.GetConverter(typeof(long));
            TypeConverter converter2 = TypeDescriptor.GetConverter(typeof(int));
            TypeConverter converter3 = TypeDescriptor.GetConverter(typeof(System.Drawing.Size));
            TypeConverter converter4 = TypeDescriptor.GetConverter(typeof(System.Drawing.Point));

            xbdfb620b7167944b.WriteStartElement("Window");
            xbdfb620b7167944b.WriteAttributeString("Guid", x76b3d9d2638e5ecd.Guid.ToString());
            do
            {
                xbdfb620b7167944b.WriteAttributeString("LastFocused", converter1.ConvertToString((ITypeDescriptorContext)null, CultureInfo.InvariantCulture, (object)x76b3d9d2638e5ecd.MetaData.LastFocused.ToFileTime()));
                do
                {
                    xbdfb620b7167944b.WriteAttributeString("DockedSize", converter2.ConvertToString((ITypeDescriptorContext)null, CultureInfo.InvariantCulture, (object)x76b3d9d2638e5ecd.MetaData.DockedContentSize));
                    xbdfb620b7167944b.WriteAttributeString("PopupSize", converter2.ConvertToString((ITypeDescriptorContext)null, CultureInfo.InvariantCulture, (object)x76b3d9d2638e5ecd.PopupSize));
                    xbdfb620b7167944b.WriteAttributeString("FloatingLocation", converter4.ConvertToString((ITypeDescriptorContext)null, CultureInfo.InvariantCulture, (object)x76b3d9d2638e5ecd.FloatingLocation));
                    xbdfb620b7167944b.WriteAttributeString("FloatingSize", converter3.ConvertToString((ITypeDescriptorContext)null, CultureInfo.InvariantCulture, (object)x76b3d9d2638e5ecd.FloatingSize));
                    xbdfb620b7167944b.WriteAttributeString("LastOpenDockSituation", x76b3d9d2638e5ecd.MetaData.LastOpenDockSituation.ToString());
                }while (false);
                xbdfb620b7167944b.WriteAttributeString("LastFixedDockSituation", x76b3d9d2638e5ecd.MetaData.LastFixedDockSituation.ToString());
                xbdfb620b7167944b.WriteAttributeString("LastFixedDockLocation", x76b3d9d2638e5ecd.MetaData.LastFixedDockSide.ToString());
                if (true)
                {
                    xbdfb620b7167944b.WriteAttributeString("LastFloatingWindowGuid", x76b3d9d2638e5ecd.MetaData.LastFloatingWindowGuid.ToString());
                }
                else
                {
                    goto label_2;
                }
            }while (false);
            goto label_4;
label_2:
            xbdfb620b7167944b.WriteEndElement();
            return;

label_4:
            xbdfb620b7167944b.WriteAttributeString("LastDockContainerCount", converter2.ConvertToString((ITypeDescriptorContext)null, CultureInfo.InvariantCulture, (object)x76b3d9d2638e5ecd.MetaData.xe62a3d24e0fde928.xd25c313925dc7d4e));
            xbdfb620b7167944b.WriteAttributeString("LastDockContainerIndex", converter2.ConvertToString((ITypeDescriptorContext)null, CultureInfo.InvariantCulture, (object)x76b3d9d2638e5ecd.MetaData.xe62a3d24e0fde928.x71a5d248534c8557));
            if (false)
            {
                return;
            }
            x245a5abec1c73d3a.x47161f81513f1258(x76b3d9d2638e5ecd, xbdfb620b7167944b, (x129cb2a2bdfd0ab2)x76b3d9d2638e5ecd.MetaData.xe62a3d24e0fde928, "Docked");
            x245a5abec1c73d3a.x47161f81513f1258(x76b3d9d2638e5ecd, xbdfb620b7167944b, x76b3d9d2638e5ecd.MetaData.x25e1dbd0e63329bf, "Document");
            x245a5abec1c73d3a.x47161f81513f1258(x76b3d9d2638e5ecd, xbdfb620b7167944b, x76b3d9d2638e5ecd.MetaData.xba74b873ae2f845a, "Floating");
            goto label_2;
        }
Ejemplo n.º 7
0
        public BranchResult(Branch branch, DockControl dockControl)
        {
            if (branch == null)
            {
                throw new ArgumentNullException(nameof(branch));
            }
            if (dockControl == null)
            {
                throw new ArgumentNullException(nameof(dockControl));
            }

            _branch      = branch;
            _dockControl = dockControl;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Creates a new radio button.
        /// </summary>
        /// <param name="game">The game instance in that the control element is to be created.</param>
        /// <param name="dock">The location the control element should dock onto.</param>
        /// <param name="offset">The space in pixel between the control element and the dock location.</param>
        /// <param name="textureOff">The texture for the of/not checked state.</param>
        /// <param name="textureOn">The texture for the on/checked state.</param>
        /// <param name="group">A list of this type to group radio buttons together.</param>
        /// <param name="scale">The value for scaling the texture. 1.0 is no scaling.</param>
        public RadioButton(Game game, DockControl dock, Point offset, Texture2D textureOff, Texture2D textureOn, List <RadioButton> group, float scale = 1.0f) : base(game, dock, offset, scale)
        {
            this.textureOff = textureOff;
            this.textureOn  = textureOn;

            State   = false;
            Texture = this.textureOff;

            this.group = group;
            this.group.Add(this);

            SelectionColor = Color.LightGreen;
            Position       = CalculatePosition(dock, offset, Texture, scale);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Gets the relative position for the control element.
        /// </summary>
        /// <param name="dock">The location the control element should dock onto.</param>
        /// <param name="offset">The space in pixel between the control element and the dock location.</param>
        /// <param name="texture">The texture that determines the positioning.</param>
        /// <param name="scale">The scale of the texture.</param>
        /// <returns></returns>
        protected Vector2 CalculatePosition(DockControl dock, Point offset, Texture2D texture, float scale)
        {
            int width;
            int height;

            if (texture != null)
            {
                width  = texture.Width;
                height = texture.Height;
            }
            else
            {
                width  = 0;
                height = 0;
            }

            switch (dock)
            {
            case DockControl.Center:
                return(new Vector2((game.Window.ClientBounds.Width / 2.0f) - (width * scale / 2.0f) + offset.X, (game.Window.ClientBounds.Height / 2.0f) - (height * scale / 2.0f) + offset.Y));

            case DockControl.CornerTopLeft:
                return(new Vector2(offset.X, offset.Y));

            case DockControl.CornerTopRight:
                return(new Vector2(game.Window.ClientBounds.Width - (width * scale) + offset.X, offset.Y));

            case DockControl.CornerBottomLeft:
                return(new Vector2(offset.X, game.Window.ClientBounds.Height - (height * scale) + offset.Y));

            case DockControl.CornerBottomRight:
                return(new Vector2(game.Window.ClientBounds.Width - (width * scale) + offset.X, game.Window.ClientBounds.Height - (height * scale) + offset.Y));

            case DockControl.MiddleTop:
                return(new Vector2((game.Window.ClientBounds.Width / 2.0f) - (width / 2.0f * scale) + offset.X, offset.Y));

            case DockControl.MiddleBottom:
                return(new Vector2((game.Window.ClientBounds.Width / 2.0f) - (width / 2.0f * scale) + offset.X, game.Window.ClientBounds.Height - (height * scale) + offset.Y));

            case DockControl.MiddleLeft:
                return(new Vector2(offset.X, (game.Window.ClientBounds.Height / 2.0f) - (height / 2.0f * scale) + offset.Y));

            case DockControl.MiddleRight:
                return(new Vector2(game.Window.ClientBounds.Width - (width * scale) + offset.X, (game.Window.ClientBounds.Height / 2.0f) - (height / 2.0f * scale) + offset.Y));

            default:
                return(Vector2.Zero);
            }
        }
Ejemplo n.º 10
0
        private void PerformClose()
        {
            DockControl dockControl = DockPane.DockControl;

            dockControl.BeginUndoUnit();
            var visibleItems = DockPane.VisibleItems;

            DockItem[] dockItems = new DockItem[visibleItems.Count];
            visibleItems.CopyTo(dockItems, 0);
            foreach (DockItem dockItem in dockItems)
            {
                dockItem.PerformClose();
            }
            dockControl.EndUndoUnit();
        }
Ejemplo n.º 11
0
        // Notes:
        //  - An asset is a non-script geometry source.
        //  - This UI component manages a collection of assets
        //  - It's basically a 'ScriptUI' for binary files.

        public AssetListUI(Model model)
        {
            InitializeComponent();
            DockControl = new DockControl(this, $"AssetList")
            {
                ShowTitle      = false,
                TabText        = "Assets",
                DestroyOnClose = false,
            };
            Model  = model;
            Assets = CollectionViewSource.GetDefaultView(Model.Assets);

            AddAsset    = Command.Create(this, AddAssetInternal);
            DataContext = this;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Creates a new simple slider.
        /// </summary>
        /// <param name="game">The game instance in that the slider is to be created.</param>
        /// <param name="dock">The location the slider should dock onto.</param>
        /// <param name="offset">The space in pixel between the slider and the dock location.</param>
        /// <param name="minValue">The minimum value of the slider. (Inclusive)</param>
        /// <param name="maxValue">The maximum value of the slider. (Inclusive)</param>
        /// <param name="value">The current value of the slider. This value is clamped between minValue and maxValue.</param>
        /// <param name="width">The width of the slider bar in pixel. This have to be greater than zero.</param>
        /// <param name="height">The height of the slider bar in pixel. This have to be greater than zero.</param>
        /// <param name="textureHandle">The texture for the slider handle.</param>
        /// <param name="scale">The scale of the handle texture. 1.0 is no scaling.</param>
        public Slider(Game game, DockControl dock, Point offset, float minValue, float maxValue, float value, int width, int height, Texture2D textureHandle, float scale = 1.0f) : this(game, dock, offset, minValue, maxValue, value, scale)
        {
            BackgroundColor = Color.White;
            StatusColor     = Color.Black;

            Texture           = textureHandle;
            backgroundTexture = Tool.CreateTexture(game.GraphicsDevice, width, height, Color.White);
            StatusTexture     = Tool.CreateTexture(game.GraphicsDevice, width, height, Color.White);

            barScale  = 1.0f;
            Alignment = true;

            originalPosition = CalculatePosition(dock, offset, backgroundTexture, barScale);
            Position         = InitialHandlePosition();
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Creates a new slider with textures.
        /// </summary>
        /// <param name="game">The game instance in that the slider is to be created.</param>
        /// <param name="dock">The location the slider should dock onto.</param>
        /// <param name="offset">The space in pixel between the slider and the dock location.</param>
        /// <param name="minValue">The minimum value of the slider. (Inclusive)</param>
        /// <param name="maxValue">The maximum value of the slider. (Inclusive)</param>
        /// <param name="value">The current value of the slider. This value is clamped between minValue and maxValue.</param>
        /// <param name="textureBackground">The texture for the background bar.</param>
        /// <param name="textureStaus">The texture for the foreground bar.</param>
        /// <param name="textureHandle">The texture for the slider handle.</param>
        /// <param name="scale">The value for scaling the textures. 1.0 is no scaling.</param>
        public Slider(Game game, DockControl dock, Point offset, float minValue, float maxValue, float value, Texture2D textureBackground, Texture2D textureStaus, Texture2D textureHandle, float scale = 1.0f) : this(game, dock, offset, minValue, maxValue, value, scale)
        {
            BackgroundColor = Color.White;
            StatusColor     = Color.White;

            Texture           = textureHandle;
            backgroundTexture = textureBackground;
            StatusTexture     = textureStaus;

            barScale  = scale;
            Alignment = true;

            originalPosition = CalculatePosition(dock, offset, backgroundTexture, barScale);
            Position         = InitialHandlePosition();
        }
Ejemplo n.º 14
0
 public void Dispose()
 {
     if (_isDisposed)
     {
         return;
     }
     _container?.Detach(this);
     _dockControl = null;
     if (_content is IDockSource)
     {
         (_content as IDockSource).DockControl = null;
     }
     _content    = null;
     _container  = null;
     _isDisposed = true;
 }
        bool CheckDifference()
        {
            var list = dgInvStockStatus.GetVisibleRows() as IEnumerable <InvItemStorageCount>;

            if (list != null && list.Any(x => x != null && x.Difference != 0))
            {
                ShowCustomSaveCloseMessage = true;
                if (checkDiff == null)
                {
                    dock = dockCtrl;
                    dock.ClosingCancelled += DockCtrl_ClosingCancelled;
                }
                return(true);
            }
            return(false);
        }
Ejemplo n.º 16
0
            protected override void OnEndDrag(UIElement dragElement, bool abort)
            {
                Target target         = Target;
                bool   isShiftKeyDown = GetIsShiftKeyDown(DockControl);

                DockControl.ClearValue(IsShiftKeyDownPropertyKey);
                ShowsDockControlGuide = false;
                PaneWithGuide         = null;
                Target = Target.Empty;
                RestoreCursor(dragElement as FrameworkElement);
                WindowHandler.EndDrag();
                if (!abort)
                {
                    Drop(target, isShiftKeyDown);
                }
            }
Ejemplo n.º 17
0
        /// <exclude />
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            if (DockTreeSplit != null && DockTreeSplit.DockControl != null)
            {
                SetIsShiftKeyDown();
                if (IsShiftKeyDown)
                {
                    DockControl dockControl = DockTreeSplit.DockControl;
                    dockControl.DockTreeZOrder = dockControl.DockTreeZOrder.SendToBack(DockTreeSplit.Position);
                    e.Handled = true;
                    return;
                }
            }

            base.OnMouseLeftButtonDown(e);
        }
        private void RemoveCommandBindings(DockControl dockControl)
        {
            if (dockControl == null)
            {
                return;
            }

            foreach (var floatWindow in dockControl.FloatWindows)
            {
                RemoveCommandBindings(floatWindow);
            }

            foreach (var autoHideOverlay in dockControl.AutoHideOverlays)
            {
                RemoveCommandBindings(autoHideOverlay);
            }
        }
Ejemplo n.º 19
0
        public GridExchanges(Model model)
        {
            InitializeComponent();
            MouseRightButtonUp += DataGrid_.ColumnVisibility;
            DockControl         = new DockControl(this, "Exchanges");
            Exchanges           = CollectionViewSource.GetDefaultView(model.Exchanges);
            Model = model;

            // Commands
            ToggleEnabled       = Command.Create(this, ToggleEnabledInternal);
            TogglePublicAPIOnly = Command.Create(this, TogglePublicAPIOnlyInternal);
            SetApiKeys          = Command.Create(this, SetApiKeysInternal);
            RefreshTradePairs   = Command.Create(this, RefreshTradePairsInternal);

            ContextMenu.Opened += delegate { ContextMenu.Items.TidySeparators(); };
            DataContext         = this;
        }
Ejemplo n.º 20
0
        internal LocationReport(DockControl dockControl, Layout rootLayout, Branch parentBranch, bool isSecondLeaf)
        {
            if (dockControl == null)
            {
                throw new ArgumentNullException(nameof(dockControl));
            }
            if (rootLayout == null)
            {
                throw new ArgumentNullException(nameof(rootLayout));
            }

            _dockControl  = dockControl;
            _rootLayout   = rootLayout;
            _parentBranch = parentBranch;
            _isLeaf       = _parentBranch != null;
            _isSecondLeaf = isSecondLeaf;
        }
Ejemplo n.º 21
0
        private static void OnMakeFloatingExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            DockItem       dockItem       = ((DockWindowTab)sender).DockItem;
            DockControl    dockControl    = dockItem.DockControl;
            FloatingWindow floatingWindow = GetFloatingWindow(dockItem);
            Rect           floatingWindowBounds;

            if (floatingWindow != null)
            {
                floatingWindowBounds = new Rect(floatingWindow.Left, floatingWindow.Top, floatingWindow.Width, floatingWindow.Height);
            }
            else
            {
                floatingWindowBounds = new Rect(new Point(double.NaN, double.NaN), dockControl.DefaultFloatingWindowSize);
            }
            dockItem.Show(dockItem.DockControl, floatingWindowBounds);
        }
        private void AddInputBindings(DockControl dockControl)
        {
            if (dockControl == null)
            {
                return;
            }

            foreach (var floatWindow in dockControl.FloatWindows)
            {
                AddInputBindings(floatWindow);
            }

            foreach (var autoHideOverlay in dockControl.AutoHideOverlays)
            {
                AddInputBindings(autoHideOverlay);
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Creates a new drop-down list.
        /// </summary>
        /// <param name="game">The game instance in that the drop-down list is to be created.</param>
        /// <param name="dock">The location the drop-down list should dock onto.</param>
        /// <param name="offset">The space in pixel between the drop-down list and the dock location.</param>
        /// <param name="items">The selectable items for the drop-down list. The item at index 0 is the first active item.</param>
        /// <param name="textColor">The color of the text.</param>
        /// <param name="font">The font the text is using. The font size should match with the measurements of the drop-down list.</param>
        /// <param name="width">The total width of the drop-down list in pixel. This have to be greater than zero.</param>
        /// <param name="height">The height of the collapsed drop-down list in pixel. This have to be greater than zero.</param>
        public DropDownList(Game game, DockControl dock, Point offset, string[] items, Color textColor, SpriteFont font, int width = 180, int height = 25) : base(game, dock, offset, 1.0f)
        {
            this.items = items;
            this.font  = font;

            ActiveItem = items[0];
            TextColor  = textColor;

            ItemBackgroundColor = Color.LightGray;
            ItemSelectedColor   = Color.SlateGray;

            if (items != null && items.Length >= 1)
            {
                Texture  = Tool.CreateTexture(game.GraphicsDevice, width, height, Color.White);
                Position = CalculatePosition(dock, offset, Texture, 1.0f);
            }
        }
        private void InitializeComponent()
        {
            AvaloniaXamlLoader.Load(this);

            DockControl dock = this.FindControl <DockControl>("DockControl");

            SerializedDock?serializedDock = null;

            if (fileSystem.Exists(DockSettingsFile))
            {
                try
                {
                    serializedDock = JsonConvert.DeserializeObject <SerializedDock>(fileSystem.ReadAllText(DockSettingsFile));
                } catch {}
            }

            dock.Layout = avaloniaDockAdapter.Initialize(serializedDock);
        }
Ejemplo n.º 25
0
        private void x79a58a5d2c65c5a4(object xe0292b9ed559da7d, EventArgs xfbf34718e704c6bc)
        {
            this.x537a4001020fd4c7.Enabled = false;
            while (this.x297f71a96c16086c)
            {
                if (true)
                {
                    return;
                }
            }
            DockControl x43bec302f92080b9 = this.x37c93a224e23ba95(this.PointToClient(Cursor.Position));

            if (x43bec302f92080b9 == null)
            {
                return;
            }
            this.xe6ff614263a59ef9(x43bec302f92080b9, false, false);
        }
Ejemplo n.º 26
0
        public DuplicateResults(Model model)
        {
            InitializeComponent();
            DockControl = new DockControl(this, "Duplicates");
            m_model     = model;

            m_dups = new BindingSource <Model.FileInfo> {
                DataSource = m_model.Duplicates
            };
            m_copies = new BindingSource <Model.FileInfo>();

            m_grid_dups.AutoGenerateColumns = false;
            m_grid_dups.Columns.Add(new DataGridViewTextBoxColumn {
                HeaderText = "Duplicates", FillWeight = 1f, DataPropertyName = nameof(Model.FileInfo.Name)
            });
            m_grid_dups.Columns.Add(new DataGridViewTextBoxColumn {
                HeaderText = "Copies", FillWeight = 1f, DataPropertyName = nameof(Model.FileInfo.CopyCount)
            });
            m_grid_dups.Columns.Add(new DataGridViewTextBoxColumn {
                HeaderText = "Key", FillWeight = 1f, DataPropertyName = nameof(Model.FileInfo.Key)
            });
            m_grid_dups.DataSource = m_dups;

            m_grid_details.AutoGenerateColumns = false;
            m_grid_details.Columns.Add(new DataGridViewTextBoxColumn {
                HeaderText = "Location", FillWeight = 4f, DataPropertyName = nameof(Model.FileInfo.FullName)
            });
            m_grid_details.Columns.Add(new DataGridViewTextBoxColumn {
                HeaderText = "File Size", FillWeight = 1f, DataPropertyName = nameof(Model.FileInfo.Length)
            });
            m_grid_details.DataSource = m_copies;

            m_dups.PositionChanged += (s, a) =>
            {
                if (m_dups.Current != null)
                {
                    m_copies.DataSource = m_dups.Current.Duplicates;
                }
                else
                {
                    m_copies.DataSource = null;
                }
            };
        }
Ejemplo n.º 27
0
        /// <summary>
        /// The private constructor of the text box class.
        /// </summary>
        /// <param name="game">The game instance in that the text box is to be created.</param>
        /// <param name="dock">The location the text box should dock onto.</param>
        /// <param name="offset">The space in pixel between the text box and the dock location.</param>
        /// <param name="text">The initial text that is to be displayed in the text box.</param>
        /// <param name="textColor">The color of the text.</param>
        /// <param name="font">The font of the text. The font size should match with the measurements.</param>
        /// <param name="scale">The value for scaling the texture. 1.0 is no scaling.</param>
        private TextBox(Game game, DockControl dock, Point offset, string text, Color textColor, SpriteFont font, float scale = 1.0f) : base(game, dock, offset, scale)
        {
            game.Window.TextInput += EditText;
            textBuilder            = new StringBuilder(text);
            MaxCharacters          = ushort.MaxValue;
            Indentation            = 0;

            maxTextLineTime = 500;
            maxKeyTime      = 400;
            maxEditTime     = 25;

            this.font = font;
            TextColor = textColor;

            blinkingPipe = true;
            OverFlow     = false;

            textLine = Tool.CreateTexture(game.GraphicsDevice, 1, (int)font.MeasureString("|").Y, Color.Black);
        }
Ejemplo n.º 28
0
        private static IEnumerable <DockItem> GetActiveDocuments(DockControl dockControl)
        {
            DockPaneCollection panes = dockControl.Panes;

            for (int i = panes.Count - 1; i >= 0; i--)
            {
                DockPane     pane         = panes[i];
                DockPosition dockPosition = pane.DockPosition;
                if (dockPosition != DockPosition.Document)
                {
                    continue;
                }

                DockItemCollection activeItems = pane.ActiveItems;
                for (int j = activeItems.Count - 1; j >= 0; j--)
                {
                    yield return(activeItems[j]);
                }
            }
        }
Ejemplo n.º 29
0
        public LayoutAccessor(Layout layout)
        {
            if (layout == null)
            {
                throw new ArgumentNullException(nameof(layout));
            }

            _layout = layout;

            var branch = Layout.Content as Branch;

            if (branch != null)
            {
                _branchAccessor = new BranchAccessor(branch);
            }
            else
            {
                _dockControl = Layout.Content as DockControl;
            }
        }
Ejemplo n.º 30
0
        private static IEnumerable <DockItem> GetActiveToolWindows(DockControl dockControl)
        {
            DockPaneCollection panes = dockControl.Panes;

            for (int i = panes.Count - 1; i >= 0; i--)
            {
                DockPane     pane         = panes[i];
                DockPosition dockPosition = pane.DockPosition;
                Debug.Assert(dockPosition != DockPosition.Unknown);
                if (dockPosition == DockPosition.Hidden || dockPosition == DockPosition.Document)
                {
                    continue;
                }

                DockItemCollection activeItems = pane.ActiveItems;
                for (int j = activeItems.Count - 1; j >= 0; j--)
                {
                    yield return(activeItems[j]);
                }
            }
        }
Ejemplo n.º 31
0
            public Dockable(string text)
            {
                BorderStyle           = BorderStyle.None;
                Text                  = text;
                BackgroundImage       = SystemIcons.Error.ToBitmap();
                BackgroundImageLayout = ImageLayout.Stretch;
                DockControl           = new DockControl(this, text)
                {
                    TabIcon = SystemIcons.Exclamation.ToBitmap()
                };

                Controls.Add2(new TextBox {
                    Location = new Point(0, 0)
                });
                Controls.Add2(new TextBox {
                    Location = new Point(0, 24)
                });
                Controls.Add2(new TextBox {
                    Location = new Point(0, 48)
                });
            }
Ejemplo n.º 32
0
        /// <summary>Handle the list of log entries changing</summary>
        private void HandleLogEntriesChanging(object sender, ListChgEventArgs <LogEntry> e)
        {
            if (!e.After || !e.IsDataChanged)
            {
                return;
            }

            // Auto tail
            var auto_tail = m_view.CurrentCell?.RowIndex == m_view.RowCount - 1 || m_view.RowCount == 0;

            // Update the row count to the number of log entries
            m_view.RowCount = Math.Min(MaxLines, LogEntries.Count);

            // Auto scroll to the last row
            if (auto_tail)
            {
                TailScroll();
            }

            // If a log entry was added, pop-out.
            if (e.ChangeType == ListChg.ItemAdded && DockControl?.DockContainer != null)
            {
                if (PopOutOnNewMessages)
                {
                    DockControl.DockContainer.FindAndShow(this);
                }
                else
                {
                    DockControl.TabColoursActive.Text = Color.Red;
                    DockControl.InvalidateTab();
                }
            }

            // Prevent the LogEntries collection getting too big
            if (e.ChangeType == ListChg.ItemAdded && LogEntries.Count > 2 * MaxLines)
            {
                LogEntries.RemoveRange(0, LogEntries.Count - MaxLines);
            }
        }
Ejemplo n.º 33
0
        // Notes:
        //  - This chart is used to show comparitive account value over time.
        //  - The axes are common value vs. time.
        //  - Time0 = The bitcoin epoch. 1 unit = 1 day
        //  - Use current prices
        public EquityChart(Model model)
        {
            InitializeComponent();
            DockControl        = new DockControl(this, "Equity");
            Chart              = m_chart_equity;
            Equity             = new Equity(model);
            GfxEquity          = new GfxObjects.Equity(Equity);
            GfxCompletedOrders = new GfxObjects.Confetti();
            GfxTransfers       = new GfxObjects.Confetti();
            Model              = model;

            // Commands
            ShowChartOptions          = Command.Create(this, ShowChartOptionsInternal);
            ToggleIncludeTransfers    = Command.Create(this, ToggleIncludeTransfersInternal);
            ToggleShowCompletedOrders = Command.Create(this, ToggleShowCompletedOrdersInternal);
            ToggleShowTransfers       = Command.Create(this, ToggleShowTransfersInternal);
            AutoRange = Command.Create(this, AutoRangeInternal);

            IsVisibleChanged += delegate { AutoRangeIfNeeded(); };
            ModifyContextMenus();
            DataContext = this;
        }
Ejemplo n.º 34
0
		public override void ModifyDefaultWindowColors(DockControl window, ref Color backColor, ref Color borderColor)
		{
			borderColor = DockedWindowOuterBorder;
		}
Ejemplo n.º 35
0
 public virtual void ModifyDefaultWindowColors(DockControl window, ref Color backColor, ref Color borderColor)
 {
 }
Ejemplo n.º 36
0
 protected internal virtual Rectangle AdjustDockControlClientBounds(ControlLayoutSystem layoutSystem, DockControl control, Rectangle clientBounds) => clientBounds;