示例#1
0
		private void Button_Click( object sender, EventArgs e )
		{
			var control = (KryptonRibbonGroupButton)sender;

			var action = control.Tag as EditorAction;
			if( action != null )
				EditorAPI.EditorActionClick( EditorAction.HolderEnum.RibbonQAT, action.Name );
		}
示例#2
0
		void RibbonSubGroupAddItemsRecursive( EditorRibbonDefaultConfiguration.Group subGroup, KryptonContextMenuCollection contextMenuItems )
		{
			var items = new List<KryptonContextMenuItemBase>();

			foreach( var child in subGroup.Children )
			{
				//!!!!impl
				////sub group
				//var subGroup = child as EditorRibbonDefaultConfiguration.Group;
				//if( subGroup != null )
				//{
				//	var tripple = new KryptonRibbonGroupTriple();
				//	ribbonGroup.Items.Add( tripple );

				//	var button = new KryptonRibbonGroupButton();
				//	//button.Tag = action;
				//	button.TextLine1 = subGroup.DropDownGroupText.Item1;
				//	button.TextLine2 = subGroup.DropDownGroupText.Item2;
				//	//button.ImageSmall = action.imageSmall;
				//	button.ImageLarge = subGroup.DropDownGroupImage;
				//	button.ToolTipBody = subGroup.Name;
				//	button.ButtonType = GroupButtonType.DropDown;

				//	button.KryptonContextMenu = new KryptonContextMenu();
				//	RibbonSubGroupAddItemsRecursive( subGroup, button.KryptonContextMenu.Items );

				//	tripple.Items.Add( button );
				//}

				//action
				var action = child as EditorAction;
				if( action != null )
				{
					EventHandler clickHandler = delegate ( object s, EventArgs e2 )
					{
						var item2 = (KryptonContextMenuItem)s;

						var action2 = item2.Tag as EditorAction;
						if( action2 != null )
							EditorAPI.EditorActionClick( EditorAction.HolderEnum.RibbonQAT, action2.Name );
					};

					var item = new KryptonContextMenuItem( action.GetContextMenuText(), null, clickHandler );
					//var item = new KryptonContextMenuItem( action.GetContextMenuText(), action.imageSmall, clickHandler );
					item.Tag = action;
					items.Add( item );
				}
				//separator
				else if( child == null )
					items.Add( new KryptonContextMenuSeparator() );
			}

			if( items.Count != 0 )
				contextMenuItems.Add( new KryptonContextMenuItems( items.ToArray() ) );
		}
示例#3
0
        public static void AddTransformToolToMenu(ICollection <KryptonContextMenuItemBase> items, TransformTool transformTool)
        //public static void AddTransformToolToMenu( ICollection<KryptonContextMenuItemBase> items, string workareaModeName )// TransformTool transformTool )
        {
            KryptonContextMenuItem item;
            string text;

            //Move
            text = Translate("Move");
            item = new KryptonContextMenuItem(text, null, delegate(object sender, EventArgs e)
            {
                EditorAPI.EditorActionClick(EditorAction.HolderEnum.ContextMenu, "Move");
            });
            item.Checked = transformTool.Mode == TransformTool.ModeEnum.Position;
            //item.Checked = workareaModeName == "Transform Move";
            item.Image = EditorResourcesCache.Move;
            item.ShortcutKeyDisplayString = EditorActions.GetFirstShortcutKeyString("Move");
            items.Add(item);

            //Rotate
            text = Translate("Rotate");
            item = new KryptonContextMenuItem(text, null, delegate(object sender, EventArgs e)
            {
                EditorAPI.EditorActionClick(EditorAction.HolderEnum.ContextMenu, "Rotate");
            });
            item.Checked = transformTool.Mode == TransformTool.ModeEnum.Rotation;
            //item.Checked = workareaModeName == "Transform Rotate";
            item.Image = EditorResourcesCache.Rotate;
            item.ShortcutKeyDisplayString = EditorActions.GetFirstShortcutKeyString("Rotate");
            items.Add(item);

            //Scale
            text = Translate("Scale");
            item = new KryptonContextMenuItem(text, null, delegate(object sender, EventArgs e)
            {
                EditorAPI.EditorActionClick(EditorAction.HolderEnum.ContextMenu, "Scale");
            });
            item.Checked = transformTool.Mode == TransformTool.ModeEnum.Scale;
            //item.Checked = workareaModeName == "Transform Scale";
            item.Image = EditorResourcesCache.Scale;
            item.ShortcutKeyDisplayString = EditorActions.GetFirstShortcutKeyString("Scale");
            items.Add(item);

            //Select
            text = Translate("Select");
            item = new KryptonContextMenuItem(text, null, delegate(object sender, EventArgs e)
            {
                EditorAPI.EditorActionClick(EditorAction.HolderEnum.ContextMenu, "Select");
            });
            item.Checked = transformTool.Mode == TransformTool.ModeEnum.None;
            //item.Checked = workareaModeName == "Transform Select";
            item.Image = EditorResourcesCache.Select;
            item.ShortcutKeyDisplayString = EditorActions.GetFirstShortcutKeyString("Select");
            items.Add(item);
        }
示例#4
0
        void QATButton_Click(object sender, EventArgs e)
        {
            var button = (KryptonRibbonQATButton)sender;

            var action = button.Tag as EditorAction;

            if (action != null)
            {
                EditorAPI.EditorActionClick(EditorAction.HolderEnum.RibbonQAT, action.Name);
            }
        }
示例#5
0
		private void Slider_ValueChanged( object sender, EventArgs e )
		{
			var control = (KryptonRibbonGroupSliderControl)sender;

			var action = control.Tag as EditorAction;
			if( action != null )
			{
				action.Slider.Value = control.GetValue();
				EditorAPI.EditorActionClick( EditorAction.HolderEnum.RibbonQAT, action.Name );
			}
		}
示例#6
0
		//private void ComboBox_SelectedIndexChanged( object sender, EventArgs e )
		//{
		//	var control = (KryptonRibbonGroupComboBox)sender;

		//	var action = control.Tag as EditorAction;
		//	if( action != null )
		//	{
		//		action.ComboBox.SelectedIndex = control.SelectedIndex;
		//		EditorAPI.EditorActionClick( EditorAction.HolderEnum.RibbonQAT, action.Name );
		//	}
		//}

		private void ListBrowser_ItemAfterSelect( ContentBrowser sender, IList<ContentBrowser.Item> items, bool selectedByUser, ref bool handled )
		{
			var action = sender.Tag as EditorAction;
			if( action != null )
			{
				if( sender.SelectedItems.Length != 0 )
					action.ListBox.SelectedIndex = (int)sender.SelectedItems[ 0 ].Tag;
				else
					action.ListBox.SelectedIndex = -1;

				action.ListBox.LastSelectedIndexChangedByUser = selectedByUser;

				EditorAPI.EditorActionClick( EditorAction.HolderEnum.RibbonQAT, action.Name );
			}
		}
示例#7
0
        public static void AddActionsToMenu(MenuTypeEnum menuType, ICollection <KryptonContextMenuItemBase> items)         //, DocumentWindow documentWindow )
        {
            bool firstItem = true;

            foreach (var action in EditorActions.Actions)
            {
                if (action.ContextMenuSupport != MenuTypeEnum.None && action.ContextMenuSupport == menuType)
                {
                    var state = EditorAPI.EditorActionGetState(EditorAction.HolderEnum.ContextMenu, action);
                    //bool enabled = false;
                    //action.PerformUpdateContextMenuEvent( documentWindow, ref enabled );

                    if (state.Enabled)
                    {
                        if (firstItem)
                        {
                            if (items.Count != 0)
                            {
                                items.Add(new KryptonContextMenuSeparator());
                            }

                            firstItem = false;
                        }

                        var image = EditorAPI.GetImageForDispalyScale(action.GetImageSmall(), action.GetImageBig());
                        var item  = new KryptonContextMenuItem(Translate(action.GetContextMenuText()), image, delegate(object s, EventArgs e2)
                        {
                            ////var a = (EditorAction)item.Tag;

                            ////!!!!так?
                            var state2 = EditorAPI.EditorActionGetState(EditorAction.HolderEnum.ContextMenu, action);
                            //check still enabled
                            if (state2.Enabled)
                            {
                                EditorAPI.EditorActionClick(EditorAction.HolderEnum.ContextMenu, action.Name);
                            }

                            //action.PerformClickContextMenuEvent( documentWindow );
                        });

                        if (action.ActionType == EditorAction.ActionTypeEnum.DropDown)
                        {
                            var args = new CancelEventArgs();
                            action.DropDownContextMenu.PerformOpening(args);
                            //!!!!?
                            //if( !args.Cancel)
                            //{

                            foreach (var child in action.DropDownContextMenu.Items)
                            {
                                item.Items.Add(child);
                            }
                        }

                        //!!!!
                        //item.Enabled = !rootNodeSelected;
                        item.Tag = action;
                        item.ShortcutKeyDisplayString = EditorActions.GetFirstShortcutKeyString(action.Name);
                        items.Add(item);
                    }
                }
            }
        }