예제 #1
0
        private void OnPEDMenuOpening(object sender, EventArgs e)
        {
            ToolStripMenuItem tsmi = sender as ToolStripMenuItem;

            if (tsmi == null)
            {
                return;
            }
            if (tsmi.DropDown == null)
            {
                return;
            }
            PEDValue_QuickAction pqaActions = tsmi.DropDown.Tag as PEDValue_QuickAction;

            if (pqaActions == null)
            {
                return;
            }
            if ((tsmi == m_ContextMenuEntry) || (tsmi == m_MainMenuEntry))
            {
                PwEntry[]    pe         = m_host.MainWindow.GetSelectedEntries();
                PEDCalcValue pcvInherit = pe[0].GetPEDValueInherit();
                pqaActions.SetInheritValue(pcvInherit);
                pqaActions.SetValue(pe[0].GetPEDValue(false));
            }
            else if ((tsmi == m_ContextMenuGroup) || (tsmi == m_MainMenuGroup))
            {
                PwGroup      pg         = m_host.MainWindow.GetSelectedGroup();
                PEDCalcValue pcvInherit = pg.GetPEDValueInherit();
                pqaActions.SetInheritValue(pcvInherit);
                pqaActions.SetValue(pg.GetPEDValue(false));
            }
            else if (m_pweForm != null)
            {
                PwEntry pe = m_pweForm.EntryRef;
                m_pweForm.UpdateEntryStrings(true, true);
                PEDCalcValue currentValue = m_pweForm.EntryStrings.ReadPEDCString();
                if (currentValue == null)
                {
                    currentValue = pe.GetPEDValue(false);
                }
                pqaActions.SetInheritValue(pe.GetPEDValueInherit());
                pqaActions.SetValue(currentValue);
            }
        }
예제 #2
0
        private ToolStripMenuItem CreatePEDMenu(bool bGroup, bool bInEntryForm)
        {
            ToolStripMenuItem tsmi = new ToolStripMenuItem(PluginTranslate.PluginName + "...");

            tsmi.Image            = SmallIcon;
            tsmi.DropDownOpening += OnPEDMenuOpening;
            PEDValue_QuickAction qa = new PEDValue_QuickAction(bGroup);

            if (bInEntryForm)
            {
                qa.ItemOrButtonClick += OnPEDCalcEntryForm;
            }
            else
            {
                qa.ItemOrButtonClick += OnPerformPEDAction;
            }
            tsmi.DropDown = qa.DropDown;
            return(tsmi);
        }