Exemplo n.º 1
0
 /// <summary>
 /// Initialisation de la form
 /// </summary>
 protected void initializeForm()
 {
     editorItemForm = getNewEditorItemForm();
     this.Content   = editorItemForm;
     InitializeRenameField();
     InitializeCustomDialog("");
 }
Exemplo n.º 2
0
        private void editor_KeyDown(object sender, KeyEventArgs e)
        {
            CurrentEvent.Event = e;
            this.lastKey       = e.KeyCode;
            switch (e.KeyCode)
            {
            case Keys.Enter:
                if (e.Modifiers == 0)
                {
                    e.SuppressKeyPress = true;
                    e.Handled          = true;
                    StartEndEdit(false);     // must be async!
                }
                break;

            case Keys.Escape:
                e.Handled = true;
                if (this._cset.ToolTipVisible)
                {
                    this._cset.HideToolTip();
                }
                else if (this._cset.Visible)
                {
                    this._cset.EndEdit(true);
                    this._currentEditor.Focus();
                }
                else
                {
                    StartEndEdit(true);
                }
                break;

            default:
                IEditableView v = this._parent as IEditableView;
                if (v != null)
                {
                    bool old = e.SuppressKeyPress;
                    e.SuppressKeyPress = true;
                    try
                    {
                        e.Handled = false;
                        v.BubbleKeyDown(e);
                    }
                    finally
                    {
                        e.SuppressKeyPress = old;
                    }
                }
                break;
            }
        }
Exemplo n.º 3
0
        public override void KeyUp(NSEvent theEvent)
        {
            base.KeyUp(theEvent);

            if (theEvent.KeyCode == (int)NSKey.Delete)
            {
                IEditableView view = (IEditableView)GetView(0, SelectedRow, false);
                if (!view.CanBeDeleted || view.IsBeingEdited)
                {
                    return;
                }

                OnDeletePressed(this, new DeletePressedEventArgs((int)this.SelectedRow));
            }
        }
        public FindResult FindNext(string expression, FindFlags flags, SearchFilter filter)
        {
            CheckCurrentState(expression, flags, filter);

            if (ev != null && ev.IsEditing)
            {
                start = ev.SelectionStart; // remember where we were in the editor.
                ev.EndEdit(false);
            }
            this.ev    = null;
            this.match = null;

            if (string.IsNullOrEmpty(expression))
            {
                return(FindResult.None);
            }

            if (this.list == null)
            {
                FindNodes();
            }

            // In case user changed the selection since the last find.
            int  pos          = FindSelectedNode();
            int  wrap         = -1;
            bool first        = true;
            bool hasSomething = this.list.Count > 0;

            while (this.list != null && hasSomething &&
                   (first || pos != wrap))
            {
                first = false;
                if (wrap == -1)
                {
                    wrap = pos;
                }
                if (this.Backwards)
                {
                    pos--;
                    if (pos < 0)
                    {
                        pos = list.Count - 1;
                    }
                }
                else
                {
                    pos++;
                    if (pos >= list.Count)
                    {
                        pos = 0;
                    }
                }

                XmlNodeMatch m    = list[pos] as XmlNodeMatch;
                XmlNode      node = m.Node;
                this.match = m;

                if (node != null)
                {
                    this.current = this.view.FindNode(node);
                    if (this.current == this.view.SelectedNode)
                    {
                        continue;
                    }
                    if (this.current != null)
                    {
                        this.view.SelectedNode = this.current;
                        if (m.IsName)
                        {
                            ev = this.view.TreeView;
                        }
                        else
                        {
                            ev = this.view.NodeTextView;
                        }
                        if (ev.BeginEdit(null))
                        {
                            ev.SelectText(m.Index, m.Length);
                        }
                    }
                }
                return(FindResult.Found);
            }
            return(hasSomething ? FindResult.NoMore : FindResult.None);
        }
Exemplo n.º 5
0
        public FindResult FindNext(string expression, FindFlags flags, SearchFilter filter)
        {
            CheckCurrentState(expression, flags, filter);

            this._match = null;

            if (string.IsNullOrEmpty(expression))
            {
                return(FindResult.None);
            }

            if (this._list == null)
            {
                FindNodes();
                this._position = -1;
                this._start    = -1; // we have not yet moved to one of the found nodes.
            }
            else if (this._resetPosition)
            {
                this._resetPosition = false;
                FindNodes();
                if (this._start >= _list.Count)
                {
                    this._start = _list.Count - 1;
                }

                if (this._position >= _list.Count)
                {
                    this._position = _list.Count - 1;
                }
            }

            int  s     = this._start;
            bool first = (this._start == -1);

            var  rc    = FindSelectedNode();
            int  pos   = rc.Item1;
            bool exact = rc.Item2;

            if (pos != this._position)
            {
                // user has moved the selection somewhere else, so start the find ring over again.
                first = true;
            }

            bool hasSomething = this._list != null && this._list.Count > 0;

            while (hasSomething)
            {
                if (this.Backwards)
                {
                    pos--;
                    if (pos < 0)
                    {
                        pos = _list.Count - 1;
                    }
                }
                else
                {
                    pos++;
                    if (pos >= _list.Count)
                    {
                        pos = 0;
                    }
                }

                if (first)
                {
                    this._start = s = pos;
                    first       = false;
                }
                else if (pos == this._start)
                {
                    // we have wrapped around!
                    break;
                }

                this._position = pos;

                XmlNodeMatch m = _list[pos] as XmlNodeMatch;
                if (m.Replaced)
                {
                    continue;
                }
                XmlNode node = m.Node;
                this._match = m;

                if (node != null)
                {
                    this._current = this._view.FindNode(node);
                    if (this._current != null)
                    {
                        this._view.SelectedNode = this._current;
                        if (m.IsName)
                        {
                            _ev = this._view.TreeView;
                        }
                        else
                        {
                            _ev = this._view.NodeTextView;
                        }
                        if (_ev.BeginEdit(null))
                        {
                            _ev.SelectText(m.Index, m.Length);
                        }
                    }
                }
                return(FindResult.Found);
            }

            this._start = -1; // get ready for another cycle around.
            return(hasSomething ? FindResult.NoMore : FindResult.None);
        }
Exemplo n.º 6
0
        public FindResult FindNext(string expression, FindFlags flags, SearchFilter filter)
        {
            CheckCurrentState(expression, flags, filter);

            if (ev != null && ev.IsEditing) {
                start = ev.SelectionStart; // remember where we were in the editor.
                ev.EndEdit(false);
            }
            this.ev = null;
            this.match = null;

            if (string.IsNullOrEmpty(expression))
                return FindResult.None;

            if (this.list == null) {
                FindNodes();
            }

            // In case user changed the selection since the last find.
            int pos = FindSelectedNode();
            int wrap = -1;
            bool first = true;
            bool hasSomething = this.list.Count > 0;
            while (this.list != null && hasSomething &&
                (first || pos != wrap)) {
                first = false;
                if (wrap == -1) wrap = pos;
                if (this.Backwards) {
                    pos--;
                    if (pos < 0) pos = list.Count - 1;
                } else {
                    pos++;
                    if (pos >= list.Count) pos = 0;
                }

                XmlNodeMatch m = list[pos] as XmlNodeMatch;
                XmlNode node = m.Node;
                this.match = m;

                if (node != null) {
                    this.current = this.view.FindNode(node);
                    if (this.current == this.view.SelectedNode) {
                        continue;
                    }
                    if (this.current != null) {
                        this.view.SelectedNode = this.current;
                        if (m.IsName) {
                            ev = this.view.TreeView;
                        } else {
                            ev = this.view.NodeTextView;
                        }
                        if (ev.BeginEdit(null)) {
                            ev.SelectText(m.Index, m.Length);
                        }
                    }
                }
                return FindResult.Found;
            }
            return hasSomething ? FindResult.NoMore : FindResult.None;
        }
Exemplo n.º 7
0
        protected virtual void OnTickedControllerToBeExecutedLoading(object sender, CancelEventArgs e)
        {
            IPluginController <RibbonModulePluginItem> currentRunningModulePluginController =
                this.PluginManager.PluginControllers.RunningPluginController;

            // If the current running plugin is UI screen based on user control or popup overlay form
            if (currentRunningModulePluginController != null &&
                currentRunningModulePluginController.PluginInstance != null &&
                currentRunningModulePluginController.PluginInstance is IView)
            {
                IView currentRunningModulePluginView = (IView)currentRunningModulePluginController.PluginInstance;

                IPluginUnloadingContextAction pluginUnloadingContextAction = null;

                if (currentRunningModulePluginView is IPluginUnloadingContextAction)
                {
                    pluginUnloadingContextAction = currentRunningModulePluginView as IPluginUnloadingContextAction;

                    if (pluginUnloadingContextAction != null)
                    {
                        pluginUnloadingContextAction.ExecuteActionBeforeUnloading(e);

                        if (e.Cancel)
                        {
                            return;
                        }
                    }
                }

                if (currentRunningModulePluginView is IEditableView)
                {
                    IEditableView currentRunningModulePluginEditableView = (IEditableView)currentRunningModulePluginView;

                    if (currentRunningModulePluginEditableView.ViewChanged)
                    {
                        DialogResult confirmationResult = MessageBox.Show(
                            @"You have not saved your changes on this screen yet.  
                             If you go to another screeb before saving your changes they will be discarded. 
                             Do you wish to save them now?", Application.ProductName,
                            MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

                        if (confirmationResult == DialogResult.Yes)
                        {
                            //Execute save
                        }
                        else if (confirmationResult == DialogResult.No)
                        {
                            // to do...
                        }
                        else if (confirmationResult == DialogResult.Cancel)
                        {
                            e.Cancel = true;

                            if (pluginUnloadingContextAction != null)
                            {
                                pluginUnloadingContextAction.ExecuteActionAfterUnloadCancelled();
                            }
                        }
                    }
                }
            }

            if (!e.Cancel)
            {
                // Havn't executed debug yet.

                //IPluginLoadingContextAction<XpressModulePluginItem> viewLoadingContextAction =
                //    EAppRuntime.Instance.App.ObjectContainer.Resolve<IPluginLoadingContextAction<XpressModulePluginItem>>
                //    (this.tickedControllerToBeExecuted.PluginItem.Name);

                //if (viewLoadingContextAction != null)
                //{
                //    viewLoadingContextAction.ExecuteActionOnLoading(currentRunningModulePluginController, this.tickedControllerToBeExecuted, e);

                //    if (e.Cancel)
                //    {
                //        return;
                //    }
                //}

                if (currentRunningModulePluginController != null)
                {
                    DetachSubPluginItems(currentRunningModulePluginController.PluginItem);
                }

                this.AttachSubPluginItems(this.tickedControllerToBeExecuted.PluginItem);
            }
        }