Beispiel #1
0
        public void OnMenuItem(MNMenuItem mi, MNPage page)
        {
            Executor.SetVariable("page", page);
            GSScript os = new GSScript();

            os.readList(mi.ActionScript);
            Executor.ExecuteElement(os);
        }
Beispiel #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (p_editedMenu != null)
     {
         MNMenuItem mi = new MNMenuItem(MNNotificationCenter.CurrentDocument);
         p_editedMenu.Items.Add(mi);
         listBox1.Items.Add(mi);
         listBox1.SelectedIndex = listBox1.Items.Count - 1;
         SelectMenuItem(mi);
     }
 }
Beispiel #3
0
        private void SelectMenuItem(MNMenuItem mi)
        {
            p_editedItem      = mi;
            pictureBox1.Image = null;
            textBox3.Text     = "";
            richTextBox1.Text = "";

            if (mi != null)
            {
                if (mi.Image != null)
                {
                    pictureBox1.Image = mi.Image;
                }
                textBox3.Text     = mi.Text;
                richTextBox1.Text = mi.ActionScript;
            }
        }
Beispiel #4
0
        /// <summary>
        /// Pointer released
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PageView_MouseUp(object sender, MouseEventArgs e)
        {
            if (CurrentPage == null || MouseContext.State == PVDragContext.Status.RefusingDrop)
            {
                return;
            }
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                if (TemporaryMessageBoxVisible)
                {
                    Context.messageBox.Visible = false;
                }
                else if (p_displayedMenu != null)
                {
                    MouseContext.context    = Context;
                    MouseContext.lastPoint  = Context.PhysicalToLogical(new Point(e.X, e.Y));
                    MouseContext.endControl = null;

                    if (Context.selectedMenuItem == p_displayedMenu.TestHit(MouseContext) &&
                        Context.selectedMenuItem >= 0 && Context.selectedMenuItem < p_displayedMenu.Items.Count)
                    {
                        if (p_docexec != null)
                        {
                            MNMenuItem mi = p_displayedMenu.Items[Context.selectedMenuItem];
                            p_docexec.OnMenuItem(mi, CurrentPage);
                        }
                    }

                    p_displayedMenu          = null;
                    Context.selectedMenuItem = -1;
                }
                else if (Context.hitHeaderButton > 0)
                {
                    int test = TestHitHeaderButton(Context.PhysicalToLogical(new Point(e.X, e.Y)));
                    if (test == Context.hitHeaderButton)
                    {
                        ActivateHeaderButton(test);
                    }
                    Context.hitHeaderButton = 0;
                }
                else
                {
                    MouseContext.context    = Context;
                    MouseContext.lastPoint  = Context.PhysicalToLogical(new Point(e.X, e.Y));
                    MouseContext.endControl = CurrentPage.FindObjectContainingPoint(Context, MouseContext.lastPoint);

                    /*if (MouseContext.startControl != null)
                     *  MouseContext.startControl.OnTapEnd(MouseContext);*/
                    bool dropResult = true;

                    if (MouseContext.State == PVDragContext.Status.Dragging)
                    {
                        SenseTracking(true);

                        if (MouseContext.trackedControl != null)
                        {
                            dropResult = MouseContext.trackedControl.OnDropFinished(MouseContext);
                            //MouseContext.trackedControl.OnDragHotTrackEnded(MouseContext.draggedItem, MouseContext);
                            //Debugger.Log(0, "", "Dropping into control\n");
                        }
                        if (MouseContext.startControl != null)
                        {
                            MouseContext.startControl.OnDragFinished(MouseContext);
                        }
                    }
                    else if (MouseContext.State == PVDragContext.Status.ClickDown)
                    {
                        if (MouseContext.startControl != null)
                        {
                            MouseContext.startControl.OnClick(MouseContext);
                            MouseContext.startControl.OnTapEnd(MouseContext);
                        }
                        MouseContext.StartClicked = false;
                    }
                    else
                    {
                        if (MouseContext.startControl != null)
                        {
                            MouseContext.startControl.OnTapEnd(MouseContext);
                        }
                        MouseContext.StartClicked = false;
                    }

                    if (dropResult)
                    {
                        MouseContext.State       = PVDragContext.Status.None;
                        MouseContext.DragType    = SMDragResponse.None;
                        MouseContext.draggedItem = null;
                    }
                    else
                    {
                        MouseContext.State = PVDragContext.Status.RefusingDrop;
                        refusal_index      = 0;
                        refusal_step       = new Point((MouseContext.lastPoint.X - MouseContext.startPoint.X) / refusal_maximum,
                                                       (MouseContext.lastPoint.Y - MouseContext.startPoint.Y) / refusal_maximum);
                        refusal_timer.Interval = 30;
                        refusal_timer.Start();
                    }
                }

                Invalidate();
            }
            else if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
            }
        }