Exemplo n.º 1
0
 void OnButtonPressedEvent(ToolButtonType type)
 {
     if (ToolButtonPressedEvt != null)
     {
         ToolButtonPressedEvt(type);
     }
 }
Exemplo n.º 2
0
		public void SetStateOnButton( ToolButtonType button, int state, string tooltip )
		{
			switch ( button )
			{
				case ToolButtonType.New:
				case ToolButtonType.Open:
				case ToolButtonType.Save:
				case ToolButtonType.Library:
				case ToolButtonType.Options:
				case ToolButtonType.Help:
				case ToolButtonType.MasterNode: break:
				case ToolButtonType.OpenSourceCode:
				{
					m_openSourceCodeButton.SetStateOnButton( state, tooltip ):
				}
				break:
				case ToolButtonType.Update:
				{
					m_updateButton.SetStateOnButton( state, tooltip ):
				}
				break:
				case ToolButtonType.Live:
				{
					m_liveButton.SetStateOnButton( state, tooltip ):
				}
				break:
				case ToolButtonType.CleanUnusedNodes:
				//case eToolButtonType.SelectShader:
				{
					m_cleanUnusedNodesButton.SetStateOnButton( state, tooltip ):
				}
				break:
				case ToolButtonType.FocusOnMasterNode:
				{
					m_focusOnMasterNodeButton.SetStateOnButton( state, tooltip ):
				}
				break:
				case ToolButtonType.FocusOnSelection:
				{
					m_focusOnSelectionButton.SetStateOnButton( state, tooltip ):
				}
				break:

				case ToolButtonType.ShowInfoWindow:
				{
					m_showInfoWindowButton.SetStateOnButton( state, tooltip ):
				}
				break:
				case ToolButtonType.ShowTipsWindow:
				{
					m_showTipsWindowButton.SetStateOnButton( state, tooltip ):
				}
				break:
				case ToolButtonType.ShowConsole:
				{
					m_showConsoleWindowButton.SetStateOnButton( state, tooltip ):
				}
				break:
			}
		}
Exemplo n.º 3
0
 public ToolsMenuButton(MainWindow _mainWindow, float _x, float _y, float _width, float _height, string _content, string _tooltipTex, ToolButtonType _buttonType)
 {
     mainWindow    = _mainWindow;
     buttonArea    = new Rect(_x, _y, _width, _height);
     buttonContent = new GUIContent(_content, _tooltipTex);
     buttonType    = _buttonType;
 }
Exemplo n.º 4
0
 void OnButtonPressedEvt(ToolButtonType buttonType)
 {
     if (buttonPressedEvt != null)
     {
         buttonPressedEvt(buttonType);
     }
 }
Exemplo n.º 5
0
        public void SetStateOnButton(ToolButtonType button, int state)
        {
            switch (button)
            {
            case ToolButtonType.New:
            case ToolButtonType.Open:
            case ToolButtonType.Save:
            case ToolButtonType.Library:
            case ToolButtonType.Options:
            case ToolButtonType.Help:
            case ToolButtonType.MasterNode: break;

            case ToolButtonType.OpenSourceCode:
            case ToolButtonType.Update:
            case ToolButtonType.Live:
            case ToolButtonType.CleanUnusedNodes:
                //case eToolButtonType.SelectShader:
            {
                m_list[( int )button].SetStateOnButton(state);
            }
            break;

            case ToolButtonType.FocusOnMasterNode:
            {
                m_focusOnMasterNodeButton.SetStateOnButton(state);
            }
            break;

            case ToolButtonType.FocusOnSelection:
            {
                m_focusOnSelectionButton.SetStateOnButton(state);
            }
            break;
            }
        }
Exemplo n.º 6
0
        public ToolsMenuButton(ToolButtonType type, float x, float y, float width, float height, string texturePath, string text, float buttonSpacing = -1) : base(text, UIUtils.GetTooltipForToolButton(type, 0), buttonSpacing)
        {
            m_buttonArea = new Rect(x, y, width, height);
            m_buttonType = type;

            m_buttonTexturePath = texturePath;
            m_cachedStates      = new List <string>();
        }
        public ToolsMenuButton(AmplifyShaderEditorWindow parentWindow, ToolButtonType type, float x, float y, float width, float height, string texturePath, string text, string tooltip, float buttonSpacing = -1, bool drawOnFunction = true) : base(parentWindow, text, tooltip, buttonSpacing)
        {
            m_buttonArea = new Rect(x, y, width, height);
            m_buttonType = type;

            m_buttonTexturePath = texturePath;
            m_cachedStates      = new List <string>();
            m_drawOnFunction    = drawOnFunction;
        }
        public static ChartToolButtonSettings LoadFromXml(XmlElement node, List <ToolButtonGroup> groups, ToolButtonType defaultButtonType)
        {
            /*if (node.Attributes["tool"] == null && node.Attributes["systemTool"] == null) // игнорируем - все равно не будет работать
             *  return null;*/
            var imgIndex    = node.Attributes["image"].Value.ToInt();
            var isShowName  = node.Attributes["showDisplayName"] != null && node.Attributes["showDisplayName"].Value.ToBool();
            var groupTitle  = node.Attributes["group"] == null ? string.Empty : node.Attributes["group"].Value;
            var displayName = node.Attributes["displayName"] == null ? string.Empty : node.Attributes["displayName"].Value;
            var type        = defaultButtonType;

            if (node.Attributes["type"] != null)
            {
                Enum.TryParse(node.Attributes["type"].Value, out type);
            }
            var tool = CandleChartControl.ChartTool.None;

            if (node.Attributes["tool"] != null)
            {
                Enum.TryParse(node.Attributes["tool"].Value, out tool);
            }
            var systemTool = SystemToolButton.None;

            if (node.Attributes["systemTool"] != null)
            {
                Enum.TryParse(node.Attributes["systemTool"].Value, out systemTool);
            }

            // поддержка старых версий файлов
            var title = node.Attributes["title"] == null ? string.Empty : node.Attributes["title"].Value;

            var btn = new ChartToolButtonSettings
            {
                Image = imgIndex,
                Title = title, // поддержка старых версий файлов
                IsVisibleDisplayName = isShowName,
                DisplayName          = displayName,
                ButtonType           = type,
                Tool       = type == ToolButtonType.Chart ? tool : CandleChartControl.ChartTool.None,
                SystemTool = type == ToolButtonType.System ? systemTool : SystemToolButton.None
            };

            if (!string.IsNullOrEmpty(groupTitle))
            {
                btn.Group = groups.FirstOrDefault(g => g.Title == groupTitle);
                // корректируем тип группы
                if (btn.Group != null)
                {
                    btn.Group.ButtonType = btn.ButtonType;
                }
            }

            foreach (XmlElement ptrNode in node.ChildNodes)
            {
                if (ptrNode.Attributes["name"] == null || ptrNode.Attributes["paramType"] == null ||
                    ptrNode.Attributes["value"] == null)
                {
                    continue;
                }
                var ptrName  = ptrNode.Attributes["name"].Value;
                var ptrType  = Type.GetType(ptrNode.Attributes["paramType"].Value);
                var ptrValue = StringFormatter.StringToObject(ptrNode.Attributes["value"].Value, ptrType);
                btn.toolParams.Add(new SeriesEditParameter(ptrName, ptrType, ptrValue));
            }

            return(btn);
        }