Ejemplo n.º 1
0
        private void btnClone_Click(object sender, Janus.Windows.Ribbon.CommandEventArgs e)
        {
            if (currentNewsPaperControl != null)
            {
                INewsPaperControl newcontrol = currentNewsPaperControl.clone();
                Point             p          = new Point(newcontrol.getAttList().getLocation().X *zoomDegree, newcontrol.getAttList().getLocation().Y *zoomDegree);
                Size s = new System.Drawing.Size(newcontrol.getAttList().getSize().Width *zoomDegree, newcontrol.getAttList().getSize().Height *zoomDegree);
                //newcontrol.getCtrl().Location = p;
                newcontrol.getCtrl().Size = s;

                newcontrol.getCtrl().MouseDown += new MouseEventHandler(MainProgram_MouseDown);
                newcontrol.getCtrl().MouseUp   += new MouseEventHandler(MainProgram_MouseUp);
                panelInnerScreen.Controls.Add(newcontrol.getCtrl());
                currentNewsPaperControl = newcontrol;

                iObjNumber++;
                currentNewsPaperControl.getAttList().setInstanceName("Obj" + iObjNumber.ToString());

                saveControlTraceAndSetRealLocationSize();

                //Xử lý marker
                if (currentNewsPaperControl.getName() == "NewsPaperMarker")
                {
                    lstMarker.Add(currentNewsPaperControl);
                    MarkerList.lstMarkerList = new List <string>();
                    foreach (INewsPaperControl c in lstMarker)
                    {
                        MarkerList.lstMarkerList.Add(c.getAttList().getInstanceName());
                    }
                }
            }
        }
Ejemplo n.º 2
0
 void MainProgram_MouseUp(object sender, MouseEventArgs e)
 {
     currentNewsPaperControl = (NewsPaperControlBase)sender;
     currentNewsPaperControl.getAttList().setLocation(currentNewsPaperControl.getCtrl().Location);
     currentNewsPaperControl.getAttList().setSize(currentNewsPaperControl.getCtrl().Size);
     loadProperties();
     preState.Add(currentNewsPaperControl.clone());
     currentState.Add(currentNewsPaperControl);
 }
Ejemplo n.º 3
0
        private void btnClone_Click(object sender, Janus.Windows.Ribbon.CommandEventArgs e)
        {
            INewsPaperControl newcontrol = currentNewsPaperControl.clone();

            newcontrol.getCtrl().MouseDown += new MouseEventHandler(MainProgram_MouseDown);
            newcontrol.getCtrl().MouseUp   += new MouseEventHandler(MainProgram_MouseUp);
            panelInnerScreen.Controls.Add(newcontrol.getCtrl());
            currentNewsPaperControl = newcontrol;
            preState.Add(currentNewsPaperControl.clone());
            currentState.Add(currentNewsPaperControl);
        }
Ejemplo n.º 4
0
 void MainProgram_MouseUp(object sender, MouseEventArgs e)
 {
     currentNewsPaperControl = (NewsPaperControlBase)sender;
     if (currentNewsPaperControl.getAttList().getLocation() != currentNewsPaperControl.getCtrl().Location ||
         currentNewsPaperControl.getAttList().getSize() != currentNewsPaperControl.getCtrl().Size)
     {
         saveControlTraceAndSetRealLocationSize();
     }
     loadProperties();
     btnClone.Enabled = true;
     //MessageBox.Show(currentNewsPaperControl.getAttList().getSize().Height.ToString());
 }
Ejemplo n.º 5
0
 public override void copy(INewsPaperControl control)
 {
     Attributs.setLocation(control.getAttList().getLocation());
     Attributs.setSize(control.getAttList().getSize());
     ((C3DObjectAtt)(Attributs)).Md2URL     = ((C3DObjectAtt)(control.getAttList())).Md2URL;
     ((C3DObjectAtt)(Attributs)).TextureURL = ((C3DObjectAtt)(control.getAttList())).TextureURL;
     try
     {
         Bitmap img = new Bitmap(((C3DObjectAtt)(Attributs)).TextureURL);
         ImgBackground        = img;
         Ctrl.BackgroundImage = ImgBackground;
     }
     catch { };
 }
        public override void copy(INewsPaperControl control)
        {
            Attributs.setLocation(control.getAttList().getLocation());
            Attributs.setSize(control.getAttList().getSize());
            ((CAudioAtt)(Attributs)).AudioURL = ((CAudioAtt)(control.getAttList())).AudioURL;

            /*try
             * {
             *  Bitmap img = new Bitmap(((CAudioAtt)(Attributs)).AudioURL);
             *  ImgBackground = img;
             *  Ctrl.BackgroundImage = ImgBackground;
             * }
             * catch { };*/
        }
 public override void copy(INewsPaperControl control)
 {
     Attributs.setLocation(control.getAttList().getLocation());
     Attributs.setSize(control.getAttList().getSize());
     //((CMarkerAtt)(Attributs)).MarkerURL = ((CMarkerAtt)(control.getAttList())).MarkerURL;
     //try
     //{
     //    Bitmap img = new Bitmap(((CMarkerAtt)(Attributs)).MarkerURL);
     //    ImgBackground = img;
     //    Ctrl.BackgroundImage = ImgBackground;
     //}
     //catch {
     //    loadBackgroundAndICO();
     //    Ctrl.BackgroundImage = ImgBackground;
     //};
 }
Ejemplo n.º 8
0
 public override void copy(INewsPaperControl control)
 {
     Attributs.setLocation(control.getAttList().getLocation());
     Attributs.setSize(control.getAttList().getSize());
     ((CVideoAtt)(Attributs)).VideoURL = ((CVideoAtt)(control.getAttList())).VideoURL;
     try
     {
         Bitmap img = new Bitmap(((CVideoAtt)(Attributs)).VideoURL);
         ImgBackground        = img;
         Ctrl.BackgroundImage = ImgBackground;
     }
     catch {
         loadBackgroundAndICO();
         Ctrl.BackgroundImage = ImgBackground;
     };
 }
Ejemplo n.º 9
0
        private void loadPaper(int pageNum)
        {
            pageNum--;
            this.panelInnerScreen.Controls.Clear();
            reInitZoomUndoRedo();
            CPage p = currentNews.LPages[pageNum];

            currentNews.AttBgk.BackgrHeight  = p.HeightP;
            currentNews.AttBgk.BackgrWidth   = p.WidthP;
            currentNews.AttBgk.BackgroundURL = p.StrBackground;
            this.panelInnerScreen.Size       = new Size(currentNews.AttBgk.BackgrWidth, currentNews.AttBgk.BackgrHeight);
            try
            {
                Bitmap img = new Bitmap(currentNews.AttBgk.BackgroundURL);
                this.panelInnerScreen.BackgroundImage = img;
            }
            catch {
                this.panelInnerScreen.BackgroundImage = null;
                this.panelInnerScreen.BackColor       = Color.White;
            };
            lstMarker = new List <INewsPaperControl>();
            MarkerList.lstMarkerList = new List <string>();
            for (int i = 0; i < p.lstNewsPaperControl.Count; i++)
            {
                currentNewsPaperControl = p.lstNewsPaperControl[i];

                //Xử lý marker
                if (currentNewsPaperControl.getName() == "NewsPaperMarker")
                {
                    lstMarker.Add(currentNewsPaperControl);
                }

                foreach (INewsPaperControl c in lstMarker)
                {
                    MarkerList.lstMarkerList.Add(c.getAttList().getInstanceName());
                }

                currentNewsPaperControl.getCtrl().MouseDown += new MouseEventHandler(MainProgram_MouseDown);
                currentNewsPaperControl.getCtrl().MouseUp   += new MouseEventHandler(MainProgram_MouseUp);
                panelInnerScreen.Controls.Add(currentNewsPaperControl.getCtrl());
                updateControlAccordingToAttribute();
                saveControlTraceAndSetRealLocationSize();
            }
            checkUndoButtonState();
            checkNextBackBtn();
        }
Ejemplo n.º 10
0
        private void RedoMethod()
        {
            if (lstNextState.Count > 0)
            {
                int index = lstNextState.Count - 1;
                if (index >= 0)
                {
                    if (lstNextState[index] == null)
                    {
                        currentNewsPaperControl.removeFromPanel();
                        lstPreState.Add(currentNewsPaperControl.clone());
                    }
                    else
                    {
                        lstNextPointerControl[index].copy(lstNextState[index]);
                        currentNewsPaperControl = lstNextPointerControl[index];
                        bool isNotAvaible = true;
                        foreach (INewsPaperControl contr in lstCurrentPointerControl)
                        {
                            if (lstNextPointerControl[index] == contr)
                            {
                                isNotAvaible = false;
                            }
                        }
                        if (isNotAvaible)
                        {
                            panelInnerScreen.Controls.Add(currentNewsPaperControl.getCtrl());
                        }

                        currentNewsPaperControl.getCtrl().Location = currentNewsPaperControl.getAttList().getLocation();
                        currentNewsPaperControl.getCtrl().Size     = currentNewsPaperControl.getAttList().getSize();

                        lstPreState.Add(lstNextState[index].clone());
                    }

                    lstNextState.RemoveAt(index);
                    lstCurrentPointerControl.Add(lstNextPointerControl[index]);
                    lstNextPointerControl.RemoveAt(index);
                }
            }
            checkRedoButtonState();
            checkUndoButtonState();
        }
Ejemplo n.º 11
0
 private void btnRedo_Click(object sender, Janus.Windows.Ribbon.CommandEventArgs e)
 {
     if (currentNewsPaperControl != null && panelInnerScreen.Controls.Count > 0 && nextState.Count > 0)
     {
         int index = nextState.Count - 1;
         if (index >= 0)
         {
             currentNewsPaperControl.removeFromPanel();
             INewsPaperControl newControl = nextState[index].clone();
             panelInnerScreen.Controls.Add((Control)newControl);
             preState.Add(nextState[index].clone());
             nextState.RemoveAt(index);
             newControl.getCtrl().Location   = newControl.getAttList().getLocation();
             newControl.getCtrl().MouseDown += new MouseEventHandler(MainProgram_MouseDown);
             newControl.getCtrl().MouseUp   += new MouseEventHandler(MainProgram_MouseUp);
             currentNewsPaperControl = newControl;
         }
     }
 }
Ejemplo n.º 12
0
        void buttonBarItem_Click(object sender, Janus.Windows.ButtonBar.ItemEventArgs e)
        {
            INewsPaperControl item = (INewsPaperControl)((Janus.Windows.ButtonBar.ButtonBarItem)(sender)).Tag;

            if (Directory.GetFiles(Path.Combine(Application.StartupPath, "Plugins"), "*.dll").Length > 0)
            {
                string   Filename = Path.Combine(Application.StartupPath, "Plugins") + @"\" + item.getName() + ".dll";
                Assembly Asm      = Assembly.LoadFile(Filename);
                foreach (Type AsmType in Asm.GetTypes())
                {
                    if (AsmType.GetInterface("INewsPaperControl") != null && AsmType.Name != "NewsPaperControlBase")
                    {
                        NewsPaperControlBase Plugin = (NewsPaperControlBase)Activator.CreateInstance(AsmType);
                        currentNewsPaperControl = Plugin;
                        Point p = new Point(currentNewsPaperControl.getAttList().getLocation().X *zoomDegree, currentNewsPaperControl.getAttList().getLocation().Y *zoomDegree);
                        Size  s = new System.Drawing.Size(currentNewsPaperControl.getAttList().getSize().Width *zoomDegree, currentNewsPaperControl.getAttList().getSize().Height *zoomDegree);
                        Plugin.getCtrl().Location = p;
                        Plugin.getCtrl().Size     = s;

                        iObjNumber++;
                        Plugin.getAttList().setInstanceName("Obj" + iObjNumber.ToString());

                        //Xử lý marker
                        if (Plugin.getName() == "NewsPaperMarker")
                        {
                            lstMarker.Add(Plugin);
                        }
                        MarkerList.lstMarkerList = new List <string>();
                        foreach (INewsPaperControl c in lstMarker)
                        {
                            MarkerList.lstMarkerList.Add(c.getAttList().getInstanceName());
                        }
                        break;
                    }
                }
            }

            ((Control)(currentNewsPaperControl)).MouseDown += new MouseEventHandler(MainProgram_MouseDown);
            ((Control)(currentNewsPaperControl)).MouseUp   += new MouseEventHandler(MainProgram_MouseUp);
            panelInnerScreen.Controls.Add((Control)currentNewsPaperControl);
            saveControlTraceAndSetRealLocationSize();
        }
Ejemplo n.º 13
0
        public override void copy(INewsPaperControl control)
        {
            Attributs.setLocation(control.getAttList().getLocation());
            Attributs.setSize(control.getAttList().getSize());
            foreach (PictureList p in ((CPictureCollectionAtt)control.getAttList()).PictureURLList)
            {
                ((CPictureCollectionAtt)Attributs).PictureURLList.Add(p);
            }

            try
            {
                System.Drawing.Bitmap img = new System.Drawing.Bitmap(((CPictureCollectionAtt)Attributs).PictureURLList[0].PictureURL);
                ImgBackground        = img;
                Ctrl.BackgroundImage = ImgBackground;
            }
            catch {
                loadBackgroundAndICO();
                Ctrl.BackgroundImage = ImgBackground;
            };
        }
Ejemplo n.º 14
0
 private void btnUndo_Click(object sender, Janus.Windows.Ribbon.CommandEventArgs e)
 {
     if (currentNewsPaperControl != null && panelInnerScreen.Controls.Count > 0 && preState.Count > 0)
     {
         int index = preState.Count - 2;
         if (index >= 0)
         {
             (currentState[currentState.Count - 2]).copy(preState[index]);
             currentNewsPaperControl = currentState[currentState.Count - 1];
             currentState.RemoveAt(currentState.Count - 1);
             //INewsPaperControl newControl = preState[index].clone();
             //panelInnerScreen.Controls.Add((Control)newControl);
             currentNewsPaperControl.getCtrl().Location = currentNewsPaperControl.getAttList().getLocation();
             //currentNewsPaperControl.getCtrl().MouseDown += new MouseEventHandler(MainProgram_MouseDown);
             //newControl.getCtrl().MouseUp+=new MouseEventHandler(MainProgram_MouseUp);
             nextState.Add(preState[index + 1].clone());
             preState.RemoveAt(index + 1);
             //currentNewsPaperControl = newControl;
         }
     }
 }
Ejemplo n.º 15
0
        void MainProgram_MouseDown(object sender, MouseEventArgs e)
        {
            currentNewsPaperControl = (NewsPaperControlBase)sender;

            btnDelete.Enabled = true;
            btnClone.Enabled  = true;
            if (currentNewsPaperControl.getName() == "NewsPaperMarker")
            {
                MarkerList.lstMarkerList = new List <string>();
            }
            else
            {
                MarkerList.lstMarkerList = new List <string>();
                foreach (INewsPaperControl c in lstMarker)
                {
                    MarkerList.lstMarkerList.Add(c.getAttList().getInstanceName());
                }
            }

            lbObjectName.Text = currentNewsPaperControl.getDisplayName();
            loadProperties();
        }
Ejemplo n.º 16
0
        void buttonBarItem_Click(object sender, Janus.Windows.ButtonBar.ItemEventArgs e)
        {
            INewsPaperControl item = (INewsPaperControl)((Janus.Windows.ButtonBar.ButtonBarItem)(sender)).Tag;

            if (Directory.GetFiles(Path.Combine(Application.StartupPath, "Plugins"), "*.dll").Length > 0)
            {
                string   Filename = Path.Combine(Application.StartupPath, "Plugins") + @"\" + item.getName() + ".dll";
                Assembly Asm      = Assembly.LoadFile(Filename);
                foreach (Type AsmType in Asm.GetTypes())
                {
                    if (AsmType.GetInterface("INewsPaperControl") != null && AsmType.Name != "NewsPaperControlBase")
                    {
                        NewsPaperControlBase Plugin = (NewsPaperControlBase)Activator.CreateInstance(AsmType);
                        currentNewsPaperControl = Plugin;
                    }
                }
            }

            ((Control)(currentNewsPaperControl)).MouseDown += new MouseEventHandler(MainProgram_MouseDown);
            ((Control)(currentNewsPaperControl)).MouseUp   += new MouseEventHandler(MainProgram_MouseUp);
            panelInnerScreen.Controls.Add((Control)currentNewsPaperControl);
            preState.Add(currentNewsPaperControl.clone());
            currentState.Add(currentNewsPaperControl);
        }
Ejemplo n.º 17
0
 void MainProgram_MouseDown(object sender, MouseEventArgs e)
 {
     currentNewsPaperControl = (NewsPaperControlBase)sender;
     loadProperties();
 }
 public abstract void copy(INewsPaperControl control);
Ejemplo n.º 19
0
        private void UndoMethod()
        {
            if (lstPreState.Count > 0)
            {
                int index = lstPreState.Count - 2;
                if (index >= 0)
                {
                    //Nếu bị del]
                    bool bIsDel = true;
                    foreach (Control c in panelInnerScreen.Controls)
                    {
                        if (c == lstCurrentPointerControl[index])
                        {
                            bIsDel = false;
                        }
                    }
                    if (bIsDel)
                    {
                        INewsPaperControl lastControl = lstCurrentPointerControl[lstCurrentPointerControl.Count - 1];
                        int iFoundControlIndex;
                        for (iFoundControlIndex = lstCurrentPointerControl.Count - 2; iFoundControlIndex >= 0; iFoundControlIndex--)
                        {
                            if (lastControl == lstCurrentPointerControl[iFoundControlIndex])
                            {
                                break;
                            }
                        }
                        if (iFoundControlIndex > 0)
                        {
                            lstCurrentPointerControl[iFoundControlIndex].copy(lstPreState[index]);
                            panelInnerScreen.Controls.Add((Control)(lstCurrentPointerControl[iFoundControlIndex]));
                            currentNewsPaperControl = lstCurrentPointerControl[iFoundControlIndex];
                        }
                    }
                    else
                    {
                        INewsPaperControl lastControl = lstCurrentPointerControl[lstCurrentPointerControl.Count - 1];
                        int iFoundControlIndex;
                        for (iFoundControlIndex = lstCurrentPointerControl.Count - 2; iFoundControlIndex >= 0; iFoundControlIndex--)
                        {
                            if (lastControl == lstCurrentPointerControl[iFoundControlIndex])
                            {
                                break;
                            }
                        }
                        if (iFoundControlIndex < 0)
                        {
                            lstCurrentPointerControl[lstCurrentPointerControl.Count - 1].removeFromPanel();
                        }
                        else
                        {
                            (lstCurrentPointerControl[iFoundControlIndex]).copy(lstPreState[iFoundControlIndex]);
                            currentNewsPaperControl = lstCurrentPointerControl[iFoundControlIndex];
                        }

                        //Check xem control đó có còn tồn tại hay k sau khi undo
                        //bool isNotValid = false;
                        //for (int i = 0; i < lstCurrentPointerControl.Count - 1; i++)
                        //{
                        //    if (lstCurrentPointerControl[i] == lstCurrentPointerControl[lstCurrentPointerControl.Count - 1])
                        //    {
                        //        isNotValid = true;
                        //        break;
                        //    }
                        //}
                        //if (!isNotValid)
                        //    lstCurrentPointerControl[lstCurrentPointerControl.Count - 1].removeFromPanel();
                    }


                    lstNextPointerControl.Add(lstCurrentPointerControl[lstCurrentPointerControl.Count - 1]);
                    lstCurrentPointerControl.RemoveAt(lstCurrentPointerControl.Count - 1);
                    currentNewsPaperControl.getCtrl().Location = currentNewsPaperControl.getAttList().getLocation();
                    currentNewsPaperControl.getCtrl().Size     = currentNewsPaperControl.getAttList().getSize();
                    if (bIsDel)
                    {
                        lstNextState.Add(null);
                    }
                    else
                    {
                        lstNextState.Add(lstPreState[index + 1].clone());
                    }
                    lstPreState.RemoveAt(index + 1);
                }
                else if (currentNewsPaperControl != null)
                {
                    currentNewsPaperControl.removeFromPanel();
                    lstNextState.Add(lstPreState[index + 1].clone());
                    lstPreState.RemoveAt(index + 1);
                    lstNextPointerControl.Add(lstCurrentPointerControl[index + 1]);
                    lstCurrentPointerControl.RemoveAt(index + 1);
                }
            }
            checkUndoButtonState();
            checkRedoButtonState();
        }