예제 #1
0
    public static void SetRegeneRecover(BTL_DATA btl)
    {
        Int32 num = 0;

        if (!Status.checkCurStat(btl, BattleStatus.Petrify))
        {
            num = btl.max.hp >> 4;
            if (Status.checkCurStat(btl, BattleStatus.Zombie) || btl_util.CheckEnemyCategory(btl, 16))
            {
                btl.fig_stat_info |= 8;
                if (btl.cur.hp > num)
                {
                    POINTS expr_5C = btl.cur;
                    expr_5C.hp -= (UInt16)num;
                }
                else
                {
                    new BattleUnit(btl).Kill();
                }
            }
            else if (btl.cur.hp + num < btl.max.hp)
            {
                POINTS expr_9E = btl.cur;
                expr_9E.hp += (UInt16)num;
            }
            else
            {
                btl.cur.hp = btl.max.hp;
            }
        }
        btl.fig_stat_info |= 1;
        btl.fig_regene_hp  = (Int16)num;
    }
예제 #2
0
        public int ExecMarkerCommand(IVsTextMarker pMarker, int iItem)
        {
            var      tester   = new GTestRunner();
            TestList testList = TestPackage.GetTestList();

            tester.OnTestsUpdated += testList.UpdateTestResult;
            switch (iItem)
            {
            case (int)MarkerCommandValues2.mcvRightClickCommand:
                IVsUIShell uiShell = (IVsUIShell)TestPackage.GetGlobalService(typeof(SVsUIShell));
                Guid       context = GuidList.GUIDTestMarkerCmdSet;
                POINTS[]   menuPos = new POINTS[1];
                menuPos[0].x = (short)Cursor.Position.X;
                menuPos[0].y = (short)Cursor.Position.Y;
                var hr = uiShell.ShowContextMenu(0, ref context, (int)PkgCmdIDList.ContextMenu, menuPos, this as IOleCommandTarget);
                if (hr != VSConstants.S_OK)
                {
                    return(VSConstants.S_FALSE);
                }
                break;

            case (int)PkgCmdIDList.cmdRunTest:
                tester.RunTests(_projectMarkerBelongsTo, _testName, false);
                break;

            case (int)PkgCmdIDList.cmdDebugTest:
                tester.RunTests(_projectMarkerBelongsTo, _testName, true);
                break;

            default:

                return(VSConstants.S_FALSE);
            }
            return(VSConstants.S_OK);
        }
예제 #3
0
    public static void SetPoisonDamage(BTL_DATA btl)
    {
        Int32 num = 0;

        if (!Status.checkCurStat(btl, BattleStatus.Petrify))
        {
            num = btl.max.hp >> 4;
            if (!FF9StateSystem.Battle.isDebug)
            {
                if (btl.cur.hp > num)
                {
                    if (btl.bi.player == 0 || !FF9StateSystem.Settings.IsHpMpFull)
                    {
                        POINTS expr_61 = btl.cur;
                        expr_61.hp -= (UInt16)num;
                    }
                }
                else
                {
                    new BattleUnit(btl).Kill();
                }
            }
        }
        btl.fig_stat_info |= 2;
        btl.fig_poison_hp  = (Int16)num;
    }
예제 #4
0
 internal static void ShowContextMenu(CommandID commandId, int x, int y, IOleCommandTarget commandTarget) {
     var shell = CookiecutterPackage.GetGlobalService(typeof(SVsUIShell)) as IVsUIShell;
     var pts = new POINTS[1];
     pts[0].x = (short)x;
     pts[0].y = (short)y;
     shell.ShowContextMenu(0, commandId.Guid, commandId.ID, pts, commandTarget);
 }
      /// <summary>
      /// Displays the context menu. Redirects the call of a reference container node context menu.
      /// </summary>
      /// <param name="selectedNodes">list of selected nodes.</param>
      /// <param name="pointerToVariant">contains the location (x,y) at which to show the menu.</param>
      protected override int DisplayContextMenu(IList <HierarchyNode> selectedNodes, IntPtr pointerToVariant)
      {
          int retValue;   // return value

          int idmxStoredMenu = 0;
          var menuGuid       = VsMenus.guidSHLMainMenu;

          if (selectedNodes == null || selectedNodes.Count == 0 || pointerToVariant == IntPtr.Zero)
          {
              retValue = 0;
          }
          else
          {
              foreach (HierarchyNode node in selectedNodes)
              {
                  // We check here whether we have a multiple selection of
                  // nodes of differing type.
                  if (idmxStoredMenu == 0)
                  {
                      // First time through or single node case
                      idmxStoredMenu = node.MenuCommandId;
                  }
                  else if (idmxStoredMenu != node.MenuCommandId)
                  {
                      idmxStoredMenu = VsMenus.IDM_VS_CTXT_NOCOMMANDS;
                  }
              }

              if (idmxStoredMenu == PkgCmdIDList.TestCaseContextMenu)
              {
                  if (selectedNodes.Count > 1)
                  {
                      // special context menus do not make sense if multiple nodes are selected
                      idmxStoredMenu = VsMenus.IDM_VS_CTXT_XPROJ_MULTIITEM;
                  }
                  else   // one single test case node is selected
                  {
                      // CoDIA Studio specific context menus need a special GUID
                      menuGuid = GuidList.guidDTMstudioTestCmdSet;

                      // store selected nod in the package
                      package.SelectedNode = selectedNodes[0];
                  }
              }

              object variant      = Marshal.GetObjectForNativeVariant(pointerToVariant);
              var    pointsAsUint = (UInt32)variant;
              var    x            = (short)(pointsAsUint & 0x0000ffff);
              var    y            = (short)((pointsAsUint & 0xffff0000) / 0x10000);


              var points = new POINTS {
                  x = x, y = y
              };

              retValue = ShowContextMenu(idmxStoredMenu, menuGuid, points);
          }

          return(retValue);
      }
        private void frame_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            // Warning!!: Keep these values in sync with the .vsct file
             const string guidVSPackageContextMenuCmdSet = "c1a3a312-e25a-4cd1-b557-011428323a99";
             const int MyContextMenuId = 0x0200;

             System.IServiceProvider serviceProvider;
             IVsUIShell uiShell;
             System.Guid contextMenuGuid = new System.Guid(guidVSPackageContextMenuCmdSet);
             System.Windows.Point relativePoint;
             System.Windows.Point screenPoint;
             POINTS point;
             POINTS[] points;

             if (e.ChangedButton == System.Windows.Input.MouseButton.Right)
             {
            serviceProvider = (System.IServiceProvider)m_package;
            uiShell = serviceProvider.GetService(typeof(SVsUIShell)) as IVsUIShell;

            if (uiShell != null)
            {
               relativePoint = e.GetPosition(this);
               screenPoint = this.PointToScreen(relativePoint);

               point = new POINTS();
               point.x = (short)screenPoint.X;
               point.y = (short)screenPoint.Y;

               points = new[] { point };

               // TODO: error handling
               uiShell.ShowContextMenu(0, ref contextMenuGuid, MyContextMenuId, points, null);
            }
             }
        }
예제 #7
0
        private void ExecuteShowContextMenu(object sender, ExecutedRoutedEventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            Debug.Assert(CanShowContextMenu);

            var attributes = CurrentNode.Attributes;

            if (attributes == null || attributes.Count == 0)
            {
                return;
            }

            var uiShell = GetService <IVsUIShell, SVsUIShell>();

            var view          = _presenter.View;
            var relativePoint = Mouse.GetPosition(view);
            var screenPoint   = view.PointToScreen(relativePoint);

            var point = new POINTS();

            point.x = (short)screenPoint.X;
            point.y = (short)screenPoint.Y;

            var points = new[] { point };

            var commandSetGuid = CommandSetGuid;

            uiShell.ShowContextMenu(0, ref commandSetGuid, CommandId_ContextMenu, points, null);
        }
예제 #8
0
 public void ShowContextMenu(CommandId commandId, int x, int y, object commandTarget = null)
 {
     if (commandTarget == null)
     {
         var package = VsAppShell.EnsurePackageLoaded(RGuidList.RPackageGuid);
         if (package != null)
         {
             var sp          = (IServiceProvider)package;
             var menuService = (System.ComponentModel.Design.IMenuCommandService)sp
                               .GetService(typeof(System.ComponentModel.Design.IMenuCommandService));
             menuService.ShowContextMenu(new System.ComponentModel.Design.CommandID(commandId.Group, commandId.Id), x, y);
         }
     }
     else
     {
         var target = commandTarget as ICommandTarget;
         if (target == null)
         {
             throw new ArgumentException(Invariant($"{nameof(commandTarget)} must implement ICommandTarget"));
         }
         var pts = new POINTS[1];
         pts[0].x = (short)x;
         pts[0].y = (short)y;
         _uiShell.ShowContextMenu(0, commandId.Group, commandId.Id, pts, new CommandTargetToOleShim(null, target));
     }
 }
예제 #9
0
파일: btl_abil.cs 프로젝트: ArtReeX/memoria
 public static void CheckReactionAbility(BTL_DATA btl, AA_DATA aa)
 {
     if (!Status.checkCurStat(btl, BattleStatus.NoReaction))
     {
         if ((btl.sa[1] & 1048576u) != 0u && btl.cur.hp != 0 && Status.checkCurStat(btl, BattleStatus.LowHP))
         {
             if (btl.cur.hp + btl.max.hp / 2 < btl.max.hp)
             {
                 POINTS cur = btl.cur;
                 cur.hp = (UInt16)(cur.hp + (UInt16)(btl.max.hp / 2));
             }
             else
             {
                 btl.cur.hp = btl.max.hp;
             }
         }
         if ((btl.sa[1] & 8388608u) != 0u && aa.MP != 0)
         {
             if (btl.cur.mp + (Int16)aa.MP < btl.max.mp)
             {
                 POINTS cur2 = btl.cur;
                 cur2.mp = (Int16)(cur2.mp + (Int16)aa.MP);
             }
             else
             {
                 btl.cur.mp = btl.max.mp;
             }
         }
     }
 }
예제 #10
0
 public void ShowContextMenu(CommandID commandId, int x, int y, object commandTarget = null)
 {
     if (commandTarget == null)
     {
         var package = EnsurePackageLoaded(RGuidList.RPackageGuid);
         if (package != null)
         {
             var menuService = (IMenuCommandService)((IServiceProvider)package).GetService(typeof(IMenuCommandService));
             menuService.ShowContextMenu(commandId, x, y);
         }
     }
     else
     {
         var target = commandTarget as ICommandTarget;
         if (target == null)
         {
             throw new ArgumentException(Invariant($"{nameof(commandTarget)} must implement ICommandTarget"));
         }
         var shell = VsAppShell.Current.GetGlobalService <IVsUIShell>(typeof(SVsUIShell));
         var pts   = new POINTS[1];
         pts[0].x = (short)x;
         pts[0].y = (short)y;
         shell.ShowContextMenu(0, commandId.Guid, commandId.ID, pts, new CommandTargetToOleShim(null, target));
     }
 }
 public static POINT POINTSTOPOINT(POINTS pts)
 {
     return(new POINT {
         x = unchecked ((int)(short)LOWORD(*(int *)&pts)),
         y = unchecked ((int)(short)HIWORD(*(int *)&pts)),
     });
 }
예제 #12
0
 public static void CopyPoints(POINTS d, POINTS s)
 {
     d.hp   = s.hp;
     d.mp   = s.mp;
     d.at   = s.at;
     d.capa = s.capa;
 }
예제 #13
0
        public void DecorationMouseUp(HitTestValues hit, Point p)
        {
            NativeMethods.ReleaseCapture();
            var pt = new POINTS {
                X = (short)p.X, Y = (short)p.Y
            };

            NativeMethods.SendMessage(Handle, (int)WindowMessages.WM_NCLBUTTONUP, (int)hit, pt);
        }
 protected override void OnMouseDown(MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left) //按下的是鼠标左键
     {
         Capture = false;               //释放鼠标,使能够手动操作
         var p = new POINTS();
         SendMessage(Handle, WindowMessage.WM_NCLBUTTONDOWN, HitTestValues.HTCAPTION, ref p);
     }
 }
예제 #15
0
        void FormBorderMouseUp(HitTestValues hit, Point p)
        {
            UnsafeNativeMethods.ReleaseCapture();
            var pt = new POINTS {
                X = (short)p.X, Y = (short)p.Y
            };

            SafeNativeMethods.SendMessage(Handle, (int)WindowMessages.WM_NCLBUTTONUP, (int)hit, pt);
        }
        private static POINTS[] GetPointsFromMouseEvent(FrameworkElement frameworkElement, MouseButtonEventArgs mouseButtonEvent)
        {
            Point  relativePoint = mouseButtonEvent.GetPosition(frameworkElement);
            Point  screenPoint   = frameworkElement.PointToScreen(relativePoint);
            POINTS point         = new POINTS();

            point.x = (short)screenPoint.X;
            point.y = (short)screenPoint.Y;
            return(new[] { point });
        }
        private void HandleStyleLoaded(MapStyle obj)
        {
            var polygon = new Polygon(
                POINTS.Select(x => x.Select(y => new[] { y.Longitude, y.Latitude }))
                );

            map.Functions.AddSource(new GeoJsonSource("source-id", polygon));
            map.Functions.AddLayerBelow(new FillLayer("layer-id", "source-id")
            {
                FillColor = Color.FromHex("#3bb2d0")
            }, "settlement-label");
        }
        private void ShowContextMenu(NodeViewModel node, IntPtr variantIn)
        {
            // See https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.vsconstants.vsuihierarchywindowcmdids.aspx
            //
            // The UIHWCMDID_RightClick command is what tells the interface
            // IVsUIHierarchy in a IVsUIHierarchyWindow to display the context menu.
            // Since the mouse position may change between the mouse down and the
            // mouse up events and the right click command might even originate from
            // the keyboard Visual Studio provides the proper menu position into
            // pvaIn by performing a memory copy operation on a POINTS structure
            // into the VT_UI4 part of the pvaIn variant.
            //
            // To show the menu use the derived POINTS as the coordinates to show
            // the context menu, calling ShowContextMenu. To ensure proper command
            // handling you should pass a NULL command target into ShowContextMenu
            // menu so that the IVsUIHierarchyWindow will have the first chance to
            // handle commands like delete.
            object variant      = Marshal.GetObjectForNativeVariant(variantIn);
            var    pointsAsUint = (UInt32)variant;
            var    x            = (short)(pointsAsUint & 0xffff);
            var    y            = (short)(pointsAsUint >> 16);
            var    points       = new POINTS();

            points.x = x;
            points.y = y;

            var shell = _visualStudioPackageProvider.Package.ServiceProvider.GetService(typeof(SVsUIShell)) as IVsUIShell;

            if (shell == null)
            {
                Logger.LogError("Error accessing IVsUIShell service.");
                return;
            }

            var pointsIn = new POINTS[1];

            pointsIn[0].x = points.x;
            pointsIn[0].y = points.y;
            var groupGuid = VsMenus.guidSHLMainMenu;
            var menuId    = (node.IsRoot)
        ? VsMenus.IDM_VS_CTXT_PROJNODE
        : (node is DirectoryNodeViewModel)
          ? VsMenus.IDM_VS_CTXT_FOLDERNODE
          : VsMenus.IDM_VS_CTXT_ITEMNODE;
            int hresult = shell.ShowContextMenu(0, ref groupGuid, menuId, pointsIn, null);

            if (!ErrorHandler.Succeeded(hresult))
            {
                Logger.LogHResult(hresult, "Error showing context menu.");
                return;
            }
        }
예제 #19
0
        public virtual void ShowContextMenu(Guid cmdGroup, int menuId, IOleCommandTarget target)
        {
            IVsUIShell uiShell = GetService <IVsUIShell>(typeof(SVsUIShell));

            if (uiShell != null)
            {
                Point pt = Cursor.Position;
                POINTS[] where = new POINTS[1];
                where[0].x     = (short)pt.X;
                where[0].y     = (short)pt.Y;

                uiShell.ShowContextMenu(0, ref cmdGroup, menuId, where, target);
            }
        }
예제 #20
0
        private int ShowContextMenu(IntPtr pvaIn, int ctxMenu)
        {
            object variant      = Marshal.GetObjectForNativeVariant(pvaIn);
            UInt32 pointsAsUint = (UInt32)variant;
            short  x            = (short)(pointsAsUint & 0x0000ffff);
            short  y            = (short)((pointsAsUint & 0xffff0000) / 0x10000);

            POINTS points = new POINTS();

            points.x = x;
            points.y = y;

            return(ShowContextMenu(ctxMenu, VsMenus.guidSHLMainMenu, points));
        }
예제 #21
0
        /// <summary>
        /// Shows the specified context menu at a specified location.
        /// </summary>
        /// <param name="menuId">The context menu ID.</param>
        /// <param name="groupGuid">The GUID of the menu group.</param>
        /// <param name="points">The location at which to show the menu.</param>
        internal int ShowContextMenu(int menuId, Guid menuGroup, POINTS points)
        {
            IVsUIShell shell = _package.GetService(typeof(SVsUIShell)) as IVsUIShell;

            Debug.Assert(shell != null, "Could not get the UI shell from the project");
            if (shell == null)
            {
                return(VSConstants.E_FAIL);
            }
            POINTS[] pnts = new POINTS[1];
            pnts[0].x = points.x;
            pnts[0].y = points.y;
            return(shell.ShowContextMenu(0, ref menuGroup, menuId, pnts, (Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget) this));
        }
예제 #22
0
        /// <include file='doc\OleMenuCommandService.uex' path='docs/doc[@for="OleMenuCommandService.ShowContextMenu"]/*' />
        /// <devdoc>
        ///     Shows the context menu with the given command ID at the given
        ///     location.
        /// </devdoc>
        public override void ShowContextMenu(CommandID menuID, int x, int y)
        {
            IOleComponentUIManager cui = GetService(typeof(NativeMethods.OleComponentUIManager)) as IOleComponentUIManager;

            Debug.Assert(cui != null, "no component UI manager, so we can't display a context menu");
            if (cui != null)
            {
                POINTS[] pt = new POINTS[] { new POINTS() };
                pt[0].x = (short)x;
                pt[0].y = (short)y;

                Guid tmpGuid = menuID.Guid;
                NativeMethods.ThrowOnFailure(cui.ShowContextMenu(0, ref tmpGuid, menuID.ID, pt, this));
            }
        }
예제 #23
0
        private int ShowContextMenu(IntPtr pvaIn, int ctxMenu)
        {
            var variant      = Marshal.GetObjectForNativeVariant(pvaIn);
            var pointsAsUint = (uint)variant;
            var x            = (short)(pointsAsUint & 0x0000ffff);
            var y            = (short)((pointsAsUint & 0xffff0000) / 0x10000);

            var points = new POINTS
            {
                x = x,
                y = y
            };

            return(ShowContextMenu(ctxMenu, VsMenus.guidSHLMainMenu, points));
        }
예제 #24
0
    public static void InitATB(BTL_DATA btl)
    {
        SettingsState settings = (SettingsState)(Object)FF9StateSystem.Settings;

        btl.cur.at_coef = 10;
        if (settings.cfg.btl_speed == 0uL)
        {
            POINTS expr_29 = btl.cur;
            expr_29.at_coef = (SByte)(expr_29.at_coef - 2);
        }
        else if (settings.cfg.btl_speed == 2uL)
        {
            POINTS expr_55 = btl.cur;
            expr_55.at_coef = (SByte)(expr_55.at_coef + 4);
        }
    }
예제 #25
0
        /// <summary>
        /// Shows the context menu on the excluded items
        /// </summary>
        /// <param name="itemId"></param>
        /// <param name="pguidCmdGroup"></param>
        /// <param name="nCmdID"></param>
        /// <param name="nCmdexecopt"></param>
        /// <param name="pvaIn"></param>
        /// <param name="pvaOut"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        internal bool ExecCommand(uint itemId, ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut, out int result)
        {
            result = (int)OleConstants.OLECMDERR_E_NOTSUPPORTED;
            if (itemId < ItemList.ExcludedNodeStart || itemId == VSConstants.VSITEMID_ROOT || itemId == VSConstants.VSITEMID_SELECTION)
            {
                return(false);
            }

            var nodes = GetSelectedNodes();

            if (nodes.Count == 0 || pguidCmdGroup != VsMenus.guidVsUIHierarchyWindowCmds)
            {
                return(false);
            }

            switch (nCmdID)
            {
            case (uint)VSConstants.VsUIHierarchyWindowCmdIds.UIHWCMDID_RightClick:
                // The UIHWCMDID_RightClick is what tells an IVsUIHierarchy in a UIHierarchyWindow
                // to put up the context menu.  Since the mouse may have moved between the
                // mouse down and the mouse up, GetCursorPos won't tell you the right place
                // to put the context menu (especially if it came through the keyboard).
                // So we pack the proper menu position into pvaIn by
                // memcpy'ing a POINTS struct into the VT_UI4 part of the pvaIn variant.  The
                // code to unpack it looks like this:
                //			ULONG ulPts = V_UI4(pvaIn);
                //			POINTS pts;
                //			memcpy((void*)&pts, &ulPts, sizeof(POINTS));
                // You then pass that POINTS into DisplayContextMenu.

                object variant      = Marshal.GetObjectForNativeVariant(pvaIn);
                UInt32 pointsAsUint = (UInt32)variant;
                short  x            = (short)(pointsAsUint & 0x0000ffff);
                short  y            = (short)((pointsAsUint & 0xffff0000) / 0x10000);

                POINTS[] pnts = new POINTS[1];
                pnts[0].x = x;
                pnts[0].y = y;
                Guid menu = VsMenus.guidSHLMainMenu;    // Constants.guidProjectExtenderCmdSet;
                result = GlobalServices.shell.ShowContextMenu(0, ref menu, VsMenus.IDM_VS_CTXT_ITEMNODE, pnts,
                                                              (Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget)nodes[0]);
                return(true);

            default:
                return(false);
            }
        }
예제 #26
0
 public static void ShowContextMenu(Control control, int menuId, MouseEventArgs mouseArg, IOleCommandTarget commandTarget)
 {
     try
     {
         POINTS[] p = new POINTS[1]
         {
             new POINTS()
         };
         p[0].x = (short)mouseArg.X;
         p[0].y = (short)mouseArg.Y;
         Action action = (Action)(() => ShowContextMenuInternal(menuId, p, commandTarget));
         control.BeginInvoke((Delegate)action);
     }
     catch (Exception ex)
     {
         int num = (int)UIHost.ShowException(ex);
     }
 }
예제 #27
0
 public static void ShowContextMenu(System.Windows.Controls.Control control, int menuId, Point point, IOleCommandTarget commandTarget)
 {
     try
     {
         POINTS[] p = new POINTS[1]
         {
             new POINTS()
         };
         p[0].x = (short)point.X;
         p[0].y = (short)point.Y;
         Action action = (Action)(() => ShowContextMenuInternal(menuId, p, commandTarget));
         control.Dispatcher.BeginInvoke((Delegate)action);
     }
     catch (Exception ex)
     {
         int num = (int)UIHost.ShowException(ex);
     }
 }
예제 #28
0
        /// <include file='doc\LanguageService.uex' path='docs/doc[@for="ViewFilter.ShowContextMenu"]/*' />
        public virtual void ShowContextMenu(int menuId, Guid groupGuid, IOleCommandTarget target)
        {
            IVsUIShell uiShell = this.service.GetService(typeof(SVsUIShell)) as IVsUIShell;

            if (uiShell != null && !this.service.IsMacroRecordingOn())   // disable context menu while recording macros.
            {
                System.Drawing.Point pt   = System.Windows.Forms.Cursor.Position;
                POINTS[]             pnts = new POINTS[1];
                pnts[0].x = (short)pt.X;
                pnts[0].y = (short)pt.Y;
                int hr = uiShell.ShowContextMenu(0, ref groupGuid, menuId, pnts, target);
                if (!NativeMethods.Succeeded(hr))
                {
                    Debug.Assert(false, "uiShell.ShowContextMenu returned " + hr);
                }
            }
            uiShell = null;
        }
예제 #29
0
    public static void SetDamage(BTL_DATA btl, Int32 damage, Byte dmg_mot)
    {
        if (Status.checkCurStat(btl, 256u))
        {
            btl.fig_info = 32;
            return;
        }
        if (Status.checkCurStat(btl, 1u))
        {
            btl.fig = 0;
            return;
        }

        if (btl != FF9StateSystem.Battle.FF9Battle.cur_cmd.regist)
        {
            Int32 num = btl_mot.setDirection(btl);
            btl.evt.rotBattle.eulerAngles = new Vector3(btl.evt.rotBattle.eulerAngles.x, num, btl.evt.rotBattle.eulerAngles.z);
            btl.rot.eulerAngles           = new Vector3(btl.rot.eulerAngles.x, num, btl.rot.eulerAngles.z);
        }
        if (!FF9StateSystem.Battle.isDebug)
        {
            if (btl.cur.hp > damage)
            {
                if (btl.bi.player == 0 || !FF9StateSystem.Settings.IsHpMpFull)
                {
                    POINTS expr_116 = btl.cur;
                    expr_116.hp -= (UInt16)damage;
                }
            }
            else
            {
                btl.cur.hp = 0;
            }
        }
        btl.fig = (Int16)damage;
        if (dmg_mot != 0)
        {
            btl_mot.SetDamageMotion(btl);
        }
        else if (btl.cur.hp == 0)
        {
            new BattleUnit(btl).Kill();
        }
    }
예제 #30
0
        public static void LaunchWindowToolsContextMenu()
        {
            // Initialize(refresh) the OtherRecentWindows list here so that it doesn't have to be built repeatedly during each QueryStatus
            MostRecentWindowCommands.Instance.PopulateOtherRecentWindowsList();

            // Display Window manager menu
            IVsUIShell uiShell = Package.GetGlobalService(typeof(SVsUIShell)) as IVsUIShell;

            if (uiShell != null)
            {
                Rect position = viewModel.Position;

                POINTS[] p = new POINTS[1];
                p[0]   = new POINTS();
                p[0].x = (short)position.TopLeft.X;
                p[0].y = (short)position.TopLeft.Y;
                Guid guidSccDisplayInformationCommandSet = WindowManagerPackageCmdSetGuid;
                uiShell.ShowContextMenu(0, ref guidSccDisplayInformationCommandSet, WindowManagerMenuCmdId, p, null);
            }
        }
예제 #31
0
 private static void FF9FEqp_UpdateSA(PLAYER play)
 {
     Boolean[] array = new Boolean[64];
     if (!ff9abil.FF9Abil_HasAp(new Character(play)))
     {
         return;
     }
     for (Int32 i = 0; i < 5; i++)
     {
         if (play.equip[i] != 255)
         {
             FF9ITEM_DATA ff9ITEM_DATA = ff9item._FF9Item_Data[(Int32)play.equip[i]];
             for (Int32 j = 0; j < 3; j++)
             {
                 Int32 num;
                 if ((num = (Int32)ff9ITEM_DATA.ability[j]) != 0 && 192 <= num)
                 {
                     array[num - 192] = true;
                 }
             }
         }
     }
     CharacterAbility[] array2 = ff9abil._FF9Abil_PaData[play.PresetId];
     for (Int32 i = 0; i < 48; i++)
     {
         if (192 <= array2[i].Id && ff9abil.FF9Abil_GetEnableSA(play.Index, array2[i].Id) && !array[array2[i].Id - 192] && play.pa[i] < array2[i].Ap)
         {
             ff9abil.FF9Abil_SetEnableSA(play.Index, array2[i].Id, false);
             Int32 capa_val = ff9abil._FF9Abil_SaData[array2[i].Id - 192].GemsCount;
             if (play.max.capa - play.cur.capa >= capa_val)
             {
                 POINTS cur = play.cur;
                 cur.capa = (Byte)(cur.capa + (Byte)capa_val);
             }
             else
             {
                 play.cur.capa = play.max.capa;
             }
         }
     }
 }
        public async Task BranchUIClickedAsync(ISccUIClickedEventArgs args, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            Debug.Assert(args != null, "Branch UI coordinates were not received.");

            IVsUIShell uiShell = (IVsUIShell)_sccProvider.GetService(typeof(SVsUIShell));
            if (uiShell != null)
            {
                POINTS[] p = new POINTS[1];
                p[0] = new POINTS();
                p[0].x = (short)args.ClickedElementPosition.TopRight.X;
                p[0].y = (short)args.ClickedElementPosition.TopRight.Y;

                Guid commandSet = GuidList.guidSccProviderCmdSet;
                await _statusBarManager.RefreshBranches();
                uiShell.ShowContextMenu(0, ref commandSet, PackageIds.BranchMenu, p, _statusBarManager);
            }
        }
예제 #33
0
        public virtual void ShowContextMenu(Guid cmdGroup, int menuId, IOleCommandTarget target)
        {
            IVsUIShell uiShell = GetService<IVsUIShell>(typeof(SVsUIShell));

            if (uiShell != null)
            {
                Point pt = Cursor.Position;
                POINTS[] where = new POINTS[1];
                where[0].x = (short)pt.X;
                where[0].y = (short)pt.Y;

                uiShell.ShowContextMenu(0, ref cmdGroup, menuId, where, target);
            }
        }
예제 #34
0
        // Blatantly copied from core editor's handling of VSStd2KCmdID.SHOWCONTEXTMENU
        POINTS[] GetShortPositionFromInputArg(IntPtr location) {
            POINTS[] position = null;

            //the coordiantes are passed as variants containing short values. The y coordinate is an offset sizeof(variant)
            //from pvaIn (which is 16 bytes)
            object xCoordinateVariant = Marshal.GetObjectForNativeVariant(location);
            object yCoordinateVariant = Marshal.GetObjectForNativeVariant(new IntPtr(location.ToInt32() + 16));
            short? xCoordinate = xCoordinateVariant as short?;
            short? yCoordinate = yCoordinateVariant as short?;
            Debug.Assert(xCoordinate.HasValue, "Couldn't parse the provided x coordinate for show context command");
            Debug.Assert(yCoordinate.HasValue, "Couldn't parse the provided y coordinate for show context command");
            if (xCoordinate.HasValue && yCoordinate.HasValue) {
                position = new POINTS[1];
                position[0].x = xCoordinate.Value;
                position[0].y = yCoordinate.Value;
            }

            return position;
        }
        private void ShowContextMenu(object sender, EventArgs args)
        {
            // Get a reference to the UIShell.
            IVsUIShell uiShell = globalProvider.GetService(typeof(SVsUIShell)) as IVsUIShell;
            if (null == uiShell)
            {
                return;
            }

            // Get the position of the cursor.
            System.Drawing.Point pt = System.Windows.Forms.Cursor.Position;
            POINTS[] pnts = new POINTS[1];
            pnts[0].x = (short)pt.X;
            pnts[0].y = (short)pt.Y;

            // Show the menu.
            Guid menuGuid = ConsoleGuidList.guidIronPythonConsoleCmdSet;
            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(
                uiShell.ShowContextMenu(0, ref menuGuid, (int)PkgCmdIDList.IPConsoleContextMenu, pnts, textView as IOleCommandTarget));
        }
        /// <include file='doc\OleMenuCommandService.uex' path='docs/doc[@for="OleMenuCommandService.ShowContextMenu"]/*' />
        /// <devdoc>
        ///     Shows the context menu with the given command ID at the given
        ///     location.
        /// </devdoc>
        public override void ShowContextMenu(CommandID menuID, int x, int y)
        {
            IOleComponentUIManager cui = GetService(typeof(NativeMethods.OleComponentUIManager)) as IOleComponentUIManager;
            Debug.Assert(cui != null, "no component UI manager, so we can't display a context menu");
            if (cui != null) {
                POINTS[] pt = new POINTS[] { new POINTS() };
                pt[0].x = (short)x;
                pt[0].y = (short)y;

                Guid tmpGuid = menuID.Guid;
                NativeMethods.ThrowOnFailure( cui.ShowContextMenu(0, ref tmpGuid, menuID.ID, pt, this) );
            }
        }
예제 #37
0
        public PointF this[POINTS Key]
        {
            get
            {
                switch (Key) {
                        case POINTS.TopLeft: return this[0];
                        case POINTS.TopCenter: return this[1];
                        case POINTS.TopRight: return this[2];
                        case POINTS.MiddleLeft: return this[3];
                        case POINTS.MiddleCenter: return this[4];
                        case POINTS.MiddleRight: return this[5];
                        case POINTS.BottomLeft: return this[6];
                        case POINTS.BottomCenter: return this[7];

                        case POINTS.CornerMiddleTopLeft: return this[8];
                        case POINTS.CornerTopLeft: return this[9];
                        case POINTS.CornerTopRight: return this[10];
                        case POINTS.CornerMiddleTopRight: return this[11];
                        case POINTS.CornerMiddleBottomRight: return this[12];
                        case POINTS.CornerBottomRight: return this[13];
                        case POINTS.CornerBottomLeft: return this[14];
                        case POINTS.CornerMiddleBottomLeft: return this[15];
                        default: throw new ArgumentOutOfRangeException();
                }
            }
            set
            {
                switch (Key) {
                        case POINTS.TopLeft: this[0] = value; break;
                        case POINTS.TopCenter: this[1] = value; break;
                        case POINTS.TopRight: this[2] = value; break;
                        case POINTS.MiddleLeft: this[3] = value; break;
                        case POINTS.MiddleCenter: this[4] = value; break;
                        case POINTS.MiddleRight: this[5] = value; break;
                        case POINTS.BottomLeft: this[6] = value; break;
                        case POINTS.BottomCenter: this[7] = value; break;
                        default: throw new ArgumentOutOfRangeException();
                }
            }
        }
    private void ShowContextMenu(NodeViewModel node, IntPtr variantIn) {
      // See https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.vsconstants.vsuihierarchywindowcmdids.aspx
      //
      // The UIHWCMDID_RightClick command is what tells the interface
      // IVsUIHierarchy in a IVsUIHierarchyWindow to display the context menu.
      // Since the mouse position may change between the mouse down and the
      // mouse up events and the right click command might even originate from
      // the keyboard Visual Studio provides the proper menu position into
      // pvaIn by performing a memory copy operation on a POINTS structure
      // into the VT_UI4 part of the pvaIn variant.
      //
      // To show the menu use the derived POINTS as the coordinates to show
      // the context menu, calling ShowContextMenu. To ensure proper command
      // handling you should pass a NULL command target into ShowContextMenu
      // menu so that the IVsUIHierarchyWindow will have the first chance to
      // handle commands like delete.
      object variant = Marshal.GetObjectForNativeVariant(variantIn);
      var pointsAsUint = (UInt32)variant;
      var x = (short)(pointsAsUint & 0xffff);
      var y = (short)(pointsAsUint >> 16);
      var points = new POINTS();
      points.x = x;
      points.y = y;

      var shell = _visualStudioPackageProvider.Package.ServiceProvider.GetService(typeof(SVsUIShell)) as IVsUIShell;
      if (shell == null) {
        Logger.LogError("Error accessing IVsUIShell service.");
        return;
      }

      var pointsIn = new POINTS[1];
      pointsIn[0].x = points.x;
      pointsIn[0].y = points.y;
      var groupGuid = VsMenus.guidSHLMainMenu;
      var menuId = (node.IsRoot)
        ? VsMenus.IDM_VS_CTXT_PROJNODE
        : (node is DirectoryNodeViewModel)
          ? VsMenus.IDM_VS_CTXT_FOLDERNODE
          : VsMenus.IDM_VS_CTXT_ITEMNODE;
      int hresult = shell.ShowContextMenu(0, ref groupGuid, menuId, pointsIn, null);
      if (!ErrorHandler.Succeeded(hresult)) {
        Logger.LogHResult(hresult, "Error showing context menu.");
        return;
      }
    }
예제 #39
0
        /// <summary>
        /// Shows the context menu when a user right-mouse clicks on the node.
        /// </summary>
        public virtual void ShowContextMenu()
        {
            int menuId = (int)this.VisualStudioContextMenuId;

            if (menuId != VsMenus.IDM_VS_CTXT_NOCOMMANDS)
            {
                // Tell the Visual Studio shell to show the context menu.
                Point menuLocation = Cursor.Position;
                POINTS[] vsPoints = new POINTS[1];
                vsPoints[0].x = (short)menuLocation.X;
                vsPoints[0].y = (short)menuLocation.Y;
                Guid activeMenuGuid = VsMenus.SHLMainMenu;
                IVsUIShell uiShell = this.ServiceProvider.GetVsUIShell(classType, "ShowContextMenu");
                int hr = uiShell.ShowContextMenu(0, ref activeMenuGuid, menuId, vsPoints, this.Hierarchy);
                if (NativeMethods.Failed(hr))
                {
                    Tracer.Fail("Error in showing the context menu: 0x{0:x}", hr);
                    NativeMethods.ThrowOnFailure(hr);
                }
            }
        }
예제 #40
0
 public virtual int GetCntrContextMenu(uint dwRoleActiveObject, ref Guid clsidActiveObject, 
   int nMenuIdActiveObject,  POINTS[] pos, out Guid clsidCntr, OLEMENUID[] menuid, out uint pgrf){
   clsidCntr = Guid.Empty;
   pgrf = 0;
   return 0;
 }
예제 #41
0
    private void _dataGrid_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
    {
      _dataGrid.EndEdit();
      if (e.Button == MouseButtons.Right)
      {
        if (_dataGrid.Rows[e.RowIndex].Selected == false)
        {
          switch (Control.ModifierKeys)
          {
            case Keys.Control:
              _dataGrid.Rows[e.RowIndex].Selected = true;
              break;
            case Keys.Shift:
              int min = Math.Min(_dataGrid.CurrentRow.Index, e.RowIndex);
              int max = Math.Max(_dataGrid.CurrentRow.Index, e.RowIndex);
              for (int n = 0; n < _dataGrid.Rows.Count; n++)
              {
                _dataGrid.Rows[n].Selected = (_dataGrid.Rows[n].Index <= min || _dataGrid.Rows[n].Index <= max);
              }
              break;
            default:
              for (int n = 0; n < _dataGrid.Rows.Count; n++)
              {
                _dataGrid.Rows[n].Selected = (e.RowIndex == n);
              }
              break;
          }
        }

        IVsUIShell shell = _serviceProvider.GetService(typeof(IVsUIShell)) as IVsUIShell;
        if (shell != null)
        {
          Guid guid;
          POINTS[] p = new POINTS[1];
          int ret;

          p[0].x = (short)Control.MousePosition.X;
          p[0].y = (short)Control.MousePosition.Y;

          guid = new Guid("732abe74-cd80-11d0-a2db-00aa00a3efff");

          ret = shell.ShowContextMenu(0, ref guid, 259, p, this);
        }
      }
    }
        /// <summary>
        /// Shows the specified context menu at a specified location.
        /// </summary>
        /// <param name="menuId">The context menu ID.</param>
        /// <param name="groupGuid">The GUID of the menu group.</param>
        /// <param name="points">The location at which to show the menu.</param>
        internal int ShowContextMenu(int menuId, Guid menuGroup, POINTS points) {
            IVsUIShell shell = _package.GetService(typeof(SVsUIShell)) as IVsUIShell;

            Debug.Assert(shell != null, "Could not get the ui shell from the project");
            if (shell == null) {
                return VSConstants.E_FAIL;
            }
            POINTS[] pnts = new POINTS[1];
            pnts[0].x = points.x;
            pnts[0].y = points.y;
            return shell.ShowContextMenu(0, ref menuGroup, menuId, pnts, (Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget)this);
        }
예제 #43
0
 /// <include file='doc\LanguageService.uex' path='docs/doc[@for="ViewFilter.ShowContextMenu"]/*' />
 public virtual void ShowContextMenu(int menuId, Guid groupGuid, IOleCommandTarget target, int x, int y)
 {
     IVsUIShell uiShell = this.service.GetService(typeof(SVsUIShell)) as IVsUIShell;
     if (uiShell != null && !this.service.IsMacroRecordingOn()) { // disable context menu while recording macros.
         POINTS[] pnts = new POINTS[1];
         pnts[0].x = (short)x;
         pnts[0].y = (short)y;
         int hr = uiShell.ShowContextMenu(0, ref groupGuid, menuId, pnts, target);
         if (!NativeMethods.Succeeded(hr)) {
             Debug.Assert(false, "uiShell.ShowContextMenu returned " + hr);
         }
     }
     uiShell = null;
 }
예제 #44
0
        /// <summary>
        /// Shows the context menu on the excluded items
        /// </summary>
        /// <param name="itemId"></param>
        /// <param name="pguidCmdGroup"></param>
        /// <param name="nCmdID"></param>
        /// <param name="nCmdexecopt"></param>
        /// <param name="pvaIn"></param>
        /// <param name="pvaOut"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        internal bool ExecCommand(uint itemId, ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut, out int result)
        {
            result = (int)OleConstants.OLECMDERR_E_NOTSUPPORTED;
            if (itemId < ItemList.ExcludedNodeStart || itemId == VSConstants.VSITEMID_ROOT || itemId == VSConstants.VSITEMID_SELECTION)
                return false;

            var nodes = GetSelectedNodes();
            if (nodes.Count == 0 || pguidCmdGroup != VsMenus.guidVsUIHierarchyWindowCmds)
                return false;

            switch (nCmdID)
            {
                case (uint)VSConstants.VsUIHierarchyWindowCmdIds.UIHWCMDID_RightClick:
                    // The UIHWCMDID_RightClick is what tells an IVsUIHierarchy in a UIHierarchyWindow
                    // to put up the context menu.  Since the mouse may have moved between the
                    // mouse down and the mouse up, GetCursorPos won't tell you the right place
                    // to put the context menu (especially if it came through the keyboard).
                    // So we pack the proper menu position into pvaIn by
                    // memcpy'ing a POINTS struct into the VT_UI4 part of the pvaIn variant.  The
                    // code to unpack it looks like this:
                    //			ULONG ulPts = V_UI4(pvaIn);
                    //			POINTS pts;
                    //			memcpy((void*)&pts, &ulPts, sizeof(POINTS));
                    // You then pass that POINTS into DisplayContextMenu.

                    object variant = Marshal.GetObjectForNativeVariant(pvaIn);
                    UInt32 pointsAsUint = (UInt32)variant;
                    short x = (short)(pointsAsUint & 0x0000ffff);
                    short y = (short)((pointsAsUint & 0xffff0000) / 0x10000);

                    POINTS[] pnts = new POINTS[1];
                    pnts[0].x = x;
                    pnts[0].y = y;
                    Guid menu = VsMenus.guidSHLMainMenu;// Constants.guidProjectExtenderCmdSet;
                    result = GlobalServices.Shell.ShowContextMenu(0, ref menu, VsMenus.IDM_VS_CTXT_ITEMNODE, pnts,
                        (Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget)nodes[0]);
                    return true;
                default:
                    return false;
            }
        }
예제 #45
0
 public int ShowContextMenu(uint dwCompRole, ref Guid rclsidActive, int nMenuId, POINTS[] pos, IOleCommandTarget pCmdTrgtActive) {
     return VSConstants.S_OK;
 }
        public async Task RepositoryUIClickedAsync(ISccUIClickedEventArgs args, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            Debug.Assert(args != null, "Repository UI coordinates were not received.");

            IVsUIShell uiShell = (IVsUIShell)_sccProvider.GetService(typeof(SVsUIShell));
            if (uiShell != null)
            {
                POINTS[] p = new POINTS[1];
                p[0] = new POINTS();
                p[0].x = (short)args.ClickedElementPosition.TopLeft.X;
                p[0].y = (short)args.ClickedElementPosition.TopLeft.Y;

                Guid commandSet = GuidList.guidSccProviderCmdSet;
                uiShell.ShowContextMenu(0, ref commandSet, PackageIds.RepositoryMenu, p, _statusBarManager);
            }
            //if (uiShell != null)
            //{
            //    int result;
            //    uiShell.ShowMessageBox(dwCompRole: 0,
            //                           rclsidComp: Guid.Empty,
            //                           pszTitle: Resources.ProviderName,
            //                           pszText: string.Format(CultureInfo.CurrentUICulture, "Clicked", args.ClickedElementPosition.ToString()),
            //                           pszHelpFile: string.Empty,
            //                           dwHelpContextID: 0,
            //                           msgbtn: OLEMSGBUTTON.OLEMSGBUTTON_OK,
            //                           msgdefbtn: OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST,
            //                           msgicon: OLEMSGICON.OLEMSGICON_INFO,
            //                           fSysAlert: 0,        // false = application modal; true would make it system modal
            //                           pnResult: out result);
            //}
        }
예제 #47
0
 /// <include file='doc\Hierarchy.uex' path='docs/doc[@for="HierarchyNode.ShowContextMenu"]/*' />
 public virtual void ShowContextMenu(int menuID, Guid groupGuid){
     Point pt = Cursor.Position;
     POINTS[] pnts = new POINTS[1];
     pnts[0].x = (short)pt.X;
     pnts[0].y = (short)pt.Y;
     this.projectMgr.UIShell.ShowContextMenu(0, ref groupGuid, menuID, pnts, (Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget)this);
 }
예제 #48
0
 internal static void ShowContextMenu(CommandID commandId, int x, int y, IOleCommandTarget commandTarget) {
     var shell = CookiecutterPackage.GetGlobalService(typeof(SVsUIShell)) as IVsUIShell;
     var pts = new POINTS[1];
     pts[0].x = (short)x;
     pts[0].y = (short)y;
     shell.ShowContextMenu(0, commandId.Guid, commandId.ID, pts, commandTarget);
 }
예제 #49
0
 /// <include file='doc\LanguageService.uex' path='docs/doc[@for="ViewFilter.ShowContextMenu"]/*' />
 public virtual void ShowContextMenu(int menuId, Guid groupGuid, IOleCommandTarget target) {
     IVsUIShell uiShell = this.service.GetService(typeof(SVsUIShell)) as IVsUIShell;
     if (uiShell != null && !this.service.IsMacroRecordingOn()) { // disable context menu while recording macros.
         System.Drawing.Point pt = System.Windows.Forms.Cursor.Position;
         POINTS[] pnts = new POINTS[1];
         pnts[0].x = (short)pt.X;
         pnts[0].y = (short)pt.Y;
         int hr = uiShell.ShowContextMenu(0, ref groupGuid, menuId, pnts, target);
         if (!NativeMethods.Succeeded(hr)) {
             Debug.Assert(false, "uiShell.ShowContextMenu returned " + hr);
         }
     }
     uiShell = null;
 }
 int IVsUIShell.ShowContextMenu(uint dcompRole, ref Guid rclsidActive, int menuId, POINTS[] pos, Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget cmdTrgtActive)
 {
     throw new NotImplementedException();
 }
예제 #51
0
 public virtual void ShowContextMenu(int menuID, Guid groupGuid){     
   IVsUIShell uiShell = GetUIShell();
   if (uiShell != null && ! IsMacroRecordingOn()){ // disable context menu while recording macros.
     System.Drawing.Point pt = System.Windows.Forms.Cursor.Position;        
     POINTS[] pnts = new POINTS[1];
     pnts[0].x = (short)pt.X;
     pnts[0].y = (short)pt.Y;
     try {
       uiShell.ShowContextMenu(0, ref groupGuid, menuID, pnts, (IOleCommandTarget)this);
     } catch (Exception){
       // no need to bubble these up to VS...
     }
   }
   uiShell = null;
 }
예제 #52
0
        private void TreeViewItem_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            // Make sure dragging is not initiated
            this.isDragging = false;

            // Make sure that the clicks has selected the item
            TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject);

            if (treeViewItem != null)
            {
                treeViewItem.Focus();
                e.Handled = true;
            }

            /* Show Context Menu */
            IVsUIShell uiShell = (IVsUIShell)((IServiceProvider)VSMacrosPackage.Current).GetService(typeof(SVsUIShell));

            if (uiShell != null)
            {
                // Get context menu id
                int menuID;
                MacroFSNode selectedNode = this.MacroTreeView.SelectedItem as MacroFSNode;

                if (selectedNode.IsDirectory)
                {
                    if (selectedNode == MacroFSNode.RootNode)
                    {
                        menuID = PkgCmdIDList.BrowserContextMenu;
                    }
                    else if (this.InSamples(selectedNode))
                    {
                        menuID = PkgCmdIDList.SampleFolderContextMenu;
                    }
                    else
                    {
                        menuID = PkgCmdIDList.FolderContextMenu;
                    }
                }
                else
                {
                    if (selectedNode.FullPath == Manager.CurrentMacroPath)
                    {
                        menuID = PkgCmdIDList.CurrentContextMenu;
                    }
                    else if (this.InSamples(selectedNode))
                    {
                        menuID = PkgCmdIDList.SampleMacroContextMenu;
                    }
                    else
                    {
                        menuID = PkgCmdIDList.MacroContextMenu;
                    }
                }

                // Show right context menu
                System.Drawing.Point pt = System.Windows.Forms.Cursor.Position;
                POINTS[] pnts = new POINTS[1];
                pnts[0].x = (short)pt.X;
                pnts[0].y = (short)pt.Y;

                uiShell.ShowContextMenu(0, GuidList.GuidVSMacrosCmdSet, menuID, pnts, null);
            }
        }
 int IVsUIShell.ShowContextMenu(uint dwCompRole, ref Guid rclsidActive, int nMenuId, POINTS[] pos, IOleCommandTarget pCmdTrgtActive)
 {
     throw new NotImplementedException();
 }
예제 #54
0
        /// <summary>
        /// Display the context menu for the snippet codeWindowHost where the user clicks
        /// </summary>
        public void ShowContextMenu()
        {
            // Get a reference to the UIShell.
            IVsUIShell uiShell = Package.GetGlobalService(typeof (SVsUIShell)) as IVsUIShell;
            if (null == uiShell)
            {
                return;
            }

            // Get the position of the cursor.
            Point currentCursorPosition = Cursor.Position;
            POINTS[] pnts = new POINTS[1];
            pnts[0].x = (short) currentCursorPosition.X;
            pnts[0].y = (short) currentCursorPosition.Y;

            // Show the menu.
            Guid menuGuid = GuidList.SnippetDesignerCmdSet;
            //tell the ui shell to show the context menu
            uiShell.ShowContextMenu(0, ref menuGuid, (int) PkgCmdIDList.SnippetContextMenu, pnts, snippetCodeWindow.TextViewAdapter as IOleCommandTarget);
        }
        private int ShowContextMenu(IntPtr pvaIn, int ctxMenu) {
            object variant = Marshal.GetObjectForNativeVariant(pvaIn);
            UInt32 pointsAsUint = (UInt32)variant;
            short x = (short)(pointsAsUint & 0x0000ffff);
            short y = (short)((pointsAsUint & 0xffff0000) / 0x10000);

            POINTS points = new POINTS();
            points.x = x;
            points.y = y;

            return ShowContextMenu(ctxMenu, VsMenus.guidSHLMainMenu, points);
        }