Ejemplo n.º 1
0
        public MNPage InsertPage(MNPage refPage, string newPageName, bool bShouldInsertAfter)
        {
            MNPage newPage = new MNPage(this);

            newPage.Title = newPageName;
            int index    = Data.Pages.IndexOf(refPage);
            int newIndex = Data.Pages.Count;

            if (index >= 0)
            {
                if (bShouldInsertAfter)
                {
                    newIndex = index + 1;
                }
                else
                {
                    newIndex = index;
                }
            }

            Data.Pages.Insert(newIndex, newPage);
            MNNotificationCenter.BroadcastMessage(this, "NewPageInserted", newPage);

            return(newPage);
        }
Ejemplo n.º 2
0
 private void FillPageStats(PageStats ps, MNPage p)
 {
     ps.checkboxes = 0;
     ps.selections = 0;
     ps.texts      = 0;
     ps.pictures   = 0;
     ps.textview   = 0;
     foreach (SMControl c in p.Objects)
     {
         if (c is SMImage)
         {
             ps.pictures++;
         }
         else if (c is SMLabel)
         {
             ps.texts++;
         }
         else if (c is SMCheckBox)
         {
             ps.checkboxes++;
         }
         else if (c is SMSelection)
         {
             ps.selections++;
         }
         else if (c is SMTextView)
         {
             ps.textview++;
         }
     }
 }
Ejemplo n.º 3
0
        private void testAction1ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MNDocument doc = MNNotificationCenter.CurrentDocument;

            if (doc == null)
            {
                return;
            }

            MNPage page = MNNotificationCenter.CurrentPage;

            if (page == null)
            {
                return;
            }

            foreach (SMControl c in page.Objects)
            {
                if (c is SMTextContainer)
                {
                    SMTextContainer tc = c as SMTextContainer;
                    tc.Text = "Here is text for dropping <drop text=\"______\" tag=\"word1\">. Be sure to place here correct word";
                }
            }
        }
Ejemplo n.º 4
0
 public SMFreeDrawing(MNPage p)
     : base(p)
 {
     Text            = "Free Paint";
     BackgroundImage = null;
     Draggable       = SMDragResponse.None;
 }
Ejemplo n.º 5
0
        private void checkTransitionPagesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogInsertTransPages dlg = new DialogInsertTransPages();
            MNDocument             doc = MNNotificationCenter.CurrentDocument;

            dlg.SetDocument(doc);
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                for (int i = 2; i >= 0; i--)
                {
                    int afterPage, pageType;
                    dlg.GetPageToInsert(i, out afterPage, out pageType);
                    MNPage p = null;
                    switch (pageType)
                    {
                    case 1:
                        doc.Data.Pages[afterPage].NextPage = "";
                        p = AddNewPage(doc, "End of Book", "EOPBook", 0, afterPage);
                        break;

                    case 2:
                        doc.Data.Pages[afterPage].NextPage = "";
                        p = AddNewPage(doc, "End of Exercises Before", "EOPExBefore", 0, afterPage);
                        break;

                    case 3:
                        doc.Data.Pages[afterPage].NextPage = "";
                        p = AddNewPage(doc, "End of Exercises After", "EOPExAfter", 0, afterPage);
                        break;
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public void SetPage(MNPage page)
        {
            pageEditView1.Page = page;
            pageEditView1.ClearSelection();
            if (!page.HasDimension(UserSelectedScreenDimension))
            {
                if (MessageBox.Show("Create new dimension?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    page.AvailableScreenDimensions.Add(UserSelectedScreenDimension);
                    page.CurrentScreenDimension = UserSelectedScreenDimension;
                    foreach (SMControl c in page.Objects)
                    {
                        SMRectangleArea area = c.Area;
                    }
                }
                else
                {
                    page.CurrentScreenDimension = SMScreen.Screen_1024_768__4_3;
                    DisplaySize = SMScreen.Screen_1024_768__4_3;
                    checkPagePlacement();
                    toolStripComboBox1.SelectedIndex = 0;
                }
            }
            page.CurrentScreenDimension = UserSelectedScreenDimension;

            MNNotificationCenter.CurrentPage = page;
        }
Ejemplo n.º 7
0
        private void PageScrollArea_DragEnter(object sender, DragEventArgs e)
        {
            string[] formats = e.Data.GetFormats();

            Point pt = this.PointToClient(new Point(e.X, e.Y));

            if (pageEditView1.Bounds.Contains(pt))
            {
                pageEditView1.PageEditView_DragEnter(sender, e);
            }
            else
            {
                if (e.Data.GetDataPresent(DataFormats.FileDrop))
                {
                    e.Effect = DragDropEffects.Copy;
                }
                else if (e.Data.GetDataPresent(typeof(PageEditDraggableItem)))
                {
                    e.Effect = DragDropEffects.Copy;
                }
                else if (e.Data.GetDataPresent(typeof(MNReferencedImage)) ||
                         e.Data.GetDataPresent(DataFormats.UnicodeText))
                {
                    e.Effect = DragDropEffects.Copy;
                }
                else if (e.Data.GetDataPresent(typeof(MNPage)))
                {
                    MNPage page = e.Data.GetData(typeof(MNPage)) as MNPage;
                    e.Effect = (page.IsTemplate ? DragDropEffects.Copy : DragDropEffects.None);
                }
            }
        }
Ejemplo n.º 8
0
        public void GoForward()
        {
            MNPage p = null;

            // displaying next page (page with index + 1)
            // store current page index to history
            if (View.CurrentPage != null)
            {
                if (View.CurrentPage.NextPage != null && View.CurrentPage.NextPage.Length > 0)
                {
                    p = View.CurrentDocument.FindPage(View.CurrentPage.NextPage);
                }
                else
                {
                    p = View.CurrentDocument.FindPageWithIndex(View.CurrentPage.Index + 1);
                }
            }
            if (p != null)
            {
                if (View.CurrentPage != null)
                {
                    PageHistory.Add(View.CurrentPage.Index);
                    Debugger.Log(0, "", "ADD HISTORY " + View.CurrentPage.Index.ToString() + "\n");
                    LogHistory();
                }
                View.CurrentPage = p;
            }
        }
Ejemplo n.º 9
0
        public void SetPage(int groupIndex, int pageNo, MNPage page)
        {
            switch (groupIndex)
            {
            case 0:
                groupBox1.Visible        = true;
                comboPage1.SelectedIndex = pageNo;
                comboType1.SelectedIndex = 1;
                pnum[groupIndex]         = pageNo;
                break;

            case 1:
                groupBox2.Visible        = true;
                comboPage2.SelectedIndex = pageNo;
                comboType2.SelectedIndex = 2;
                pnum[groupIndex]         = pageNo;
                break;

            case 2:
                groupBox3.Visible        = true;
                comboPage3.SelectedIndex = pageNo;
                comboType3.SelectedIndex = 3;
                pnum[groupIndex]         = pageNo;
                break;

            default:
                break;
            }
        }
Ejemplo n.º 10
0
        private void InitWithPage(MNPage p)
        {
            tabControl1.SelectedTab = tabPage;

            if (p_Book.Pages.ContainsKey(p.Id))
            {
                p_Page = p_Book.Pages[p.Id];
            }
            else
            {
                p_Page             = new ReviewPage();
                p_Book.Pages[p.Id] = p_Page;
                p_Page.PageTitle   = p.TextBRaw;
                p_Page.PageHelp    = p.MessageTextRaw;
            }

            richTextBox1.Text  = p_Page.PageTitle;
            richTextBox2.Text  = p_Page.PageHelp;
            richTextBox3.Text  = p_Page.PageNotes;
            textItemText.Text  = "";
            textItemNotes.Text = "";

            p_PageOrig = p;
            p_ItemOrig = null;

            UpdatePageHelpColor();
            UpdatePageTitleColor();
        }
Ejemplo n.º 11
0
        public void OnMenuItem(MNMenuItem mi, MNPage page)
        {
            Executor.SetVariable("page", page);
            GSScript os = new GSScript();

            os.readList(mi.ActionScript);
            Executor.ExecuteElement(os);
        }
Ejemplo n.º 12
0
 public SMLetterInput(MNPage page)
     : base(page)
 {
     Text                = "";
     Evaluation          = MNEvaluationType.Inherited;
     ContentCells        = "0,0,H,AB_,ABC|7,7,V,P___,PREV";
     HelpTextControlName = "";
 }
Ejemplo n.º 13
0
 public SMConnection(MNPage doc)
     : base()
 {
     Page            = doc;
     ConnectionStyle = SMConnectionStyle.DirectLine;
     Source          = null;
     Target          = null;
 }
Ejemplo n.º 14
0
 public SMControlGroup(MNPage p)
     : base(p)
 {
     Text         = "Label";
     GroupType    = SMGroupListLabelsType.Labels;
     Autosize     = false;
     GroupControl = true;
 }
Ejemplo n.º 15
0
 public void SetPage(MNPage p)
 {
     if (p != null)
     {
         InitWithPage(p);
     }
     Page = p;
 }
Ejemplo n.º 16
0
 public SMImageButton(MNPage p) : base(p)
 {
     ImgA              = new MNLazyImage(p.Document);
     Evaluation        = MNEvaluationType.None;
     ContentArangement = SMContentArangement.ImageOnly;
     Clickable         = true;
     rt = new SMRichText(this);
 }
Ejemplo n.º 17
0
 public SMCheckBox(MNPage p)
     : base(p)
 {
     Text          = "Check Box";
     Evaluation    = MNEvaluationType.Inherited;
     CheckBoxAtEnd = false;
     richText      = new SMRichText(this);
 }
Ejemplo n.º 18
0
 public SMTextEdit(MNPage page)
     : base(page)
 {
     Text          = "";
     LinesCount    = 2;
     Evaluation    = MNEvaluationType.Inherited;
     ExpectedValue = "";
 }
Ejemplo n.º 19
0
 public TVAction(TreeObjectView v, string t, MNPage p)
     : base(t)
 {
     Script   = "";
     View     = v;
     Page     = p;
     Document = null;
 }
Ejemplo n.º 20
0
 public SMLabel(MNPage p)
     : base(p)
 {
     Text          = "Label";
     RichContent   = true;
     RunningLine   = SMRunningLine.Natural;
     richText      = new SMRichText(this);
     Area.BackType = SMBackgroundType.None;
 }
Ejemplo n.º 21
0
        private static void SetControlsToPage(string templateName, MNPage np)
        {
            MNPage t = MNSharedObjects.internalDocument.FindTemplateName(templateName);

            if (t != null)
            {
                MNPage.CopyControlsFrom(t, np);
            }
        }
Ejemplo n.º 22
0
        public void WritePage(StringBuilder sb, MNPage p, int level)
        {
            WriteLS(sb, level);
            sb.AppendFormat("PAGE: {0}\n", p.Id);

            foreach (SMControl ctrl in p.Objects)
            {
                WriteControl(sb, ctrl, level + 1);
            }
        }
Ejemplo n.º 23
0
 public SMTextViewBase(MNPage p)
     : base(p)
 {
     Text                  = "Text Container";
     Evaluation            = MNEvaluationType.Inherited;
     Columns               = 1;
     ColumnSeparatorStyle  = SMLineStyle.Plain;
     ColumnSeparatorWidth  = 20;
     ShowNavigationButtons = false;
 }
Ejemplo n.º 24
0
        public void Set(MNDocument doc, MNPage page, MNPageTextObject obj)
        {
            Document = doc;
            Page     = page;
            Object   = obj;

            noupdate          = true;
            richTextBox1.Text = obj.Text;
            noupdate          = false;
        }
Ejemplo n.º 25
0
 public SMTextPuzzle(MNPage p)
     : base(p)
 {
     Text           = "Puzzle";
     Rows           = 6;
     Columns        = 6;
     Spacing        = 8;
     HighlightColor = Color.Green;
     Evaluation     = MNEvaluationType.Inherited;
 }
Ejemplo n.º 26
0
        public SMTitledMessage(MNPage p)
            : base(p)
        {
            Visible                 = true;
            titleRichText           = new SMRichText();
            titleRichText.Font.Size = 17;
            titleRichText.Font.Name = MNFontName.ChaparralPro;

            messageRichText           = new SMRichText(this);
            messageRichText.Font.Name = MNFontName.ChaparralPro;
            messageRichText.Font.Size = 14;
        }
Ejemplo n.º 27
0
 public void SetPage(MNPage p)
 {
     if (p != null)
     {
         InitWithPage(p);
     }
     Page = p;
     if (p != null && Page.Document != null)
     {
         Page.Document.Reviews = p_Book;
     }
     label9.Text = p.Id.ToString();
 }
Ejemplo n.º 28
0
        /// <summary>
        /// Creates new template
        /// </summary>
        /// <returns></returns>
        public MNPage CreateNewTemplate()
        {
            MNPage page = new MNPage(this);

            page.Title    = string.Format("<Template Title>");
            page.Document = this;
            page.Id       = Data.GetNextId();
            Data.Templates.Add(page);

            MNNotificationCenter.BroadcastMessage(this, "PageInserted", page);

            return(page);
        }
Ejemplo n.º 29
0
 public SMImage(MNPage p) : base(p)
 {
     Img               = new MNLazyImage(p.Document);
     ContentScaling    = SMContentScaling.Fit;
     Evaluation        = MNEvaluationType.Inherited;
     DroppedTag        = "";
     DroppedImage      = null;
     DroppedText       = "";
     ContentArangement = SMContentArangement.ImageOnly;
     SourceOffsetX     = 50;
     SourceOffsetY     = 50;
     rt = new SMRichText(this);
 }
Ejemplo n.º 30
0
 public SMTextContainer(MNPage p)
     : base(p)
 {
     Text             = "Text Container";
     Evaluation       = MNEvaluationType.Inherited;
     ItemLayout       = new SMStatusLayout();
     ItemMargin       = new SMContentPadding();
     ItemMargin.Left  = ItemMargin.Right = 8;
     ItemMargin.Top   = ItemMargin.Bottom = 8;
     ItemPadding      = new SMContentPadding();
     ItemPadding.Left = ItemPadding.Right = 8;
     ItemPadding.Top  = ItemPadding.Bottom = 8;
 }