Ejemplo n.º 1
0
 internal SetPrintAreaDialog(MainFrame mainFrame, Controller controller, PrintAreaKind printAreaKind)
 {
     InitializeComponent();
     this.mainFrame     = mainFrame;
     this.controller    = controller;
     this.printAreaKind = printAreaKind;
     this.printArea     = PrintArea.DefaultPrintArea;
 }
Ejemplo n.º 2
0
 internal SetPrintAreaDialog(MainFrame mainFrame, Controller controller, PrintAreaKind printAreaKind)
 {
     InitializeComponent();
     this.mainFrame = mainFrame;
     this.controller = controller;
     this.printAreaKind = printAreaKind;
     this.printArea = PrintArea.DefaultPrintArea;
 }
Ejemplo n.º 3
0
        void SetPrintArea(int tabIndex, RectangleF expectedCurrent, RectangleF newPrintArea, PrintAreaKind printAreaKind)
        {
            Dictionary <int, RectangleF> printAreas = new Dictionary <int, RectangleF>();

            // Remember print areas for all tabs.
            for (int tab = 0; tab < controller.GetTabNames().Length; ++tab)
            {
                controller.SelectTab(tab);
                printAreas.Add(tab, controller.GetCurrentPrintAreaRectangle(PrintAreaKind.OneCourse));
            }

            controller.SelectTab(tabIndex);

            RectangleF rectangleCurrent = controller.GetCurrentPrintAreaRectangle(printAreaKind);

            TestUtil.AssertEqualRect(expectedCurrent, rectangleCurrent, 0.1, "initial print rectangle");

            controller.BeginSetPrintArea(printAreaKind, null);

            ChangeRectangle(expectedCurrent, newPrintArea);

            controller.EndSetPrintArea(printAreaKind, new PrintArea(false, false, new RectangleF()));

            rectangleCurrent = controller.GetCurrentPrintAreaRectangle(printAreaKind);
            TestUtil.AssertEqualRect(newPrintArea, rectangleCurrent, 0.1, "final print rectangle");

            // Check all other tabs.
            for (int tab = 0; tab < controller.GetTabNames().Length; ++tab)
            {
                controller.SelectTab(tab);
                RectangleF rect = controller.GetCurrentPrintAreaRectangle(PrintAreaKind.OneCourse);
                if (printAreaKind == PrintAreaKind.AllCourses || tab == tabIndex)
                {
                    TestUtil.AssertEqualRect(newPrintArea, rect, 0.1, "final print rectangle");
                }
                else
                {
                    TestUtil.AssertEqualRect(printAreas[tab], rect, 0.1, "original print rectangle  for that tab");
                }
            }
        }
Ejemplo n.º 4
0
        private void SetPrintArea(PrintAreaKind printAreaKind)
        {
            SetPrintAreaDialog dialog = new SetPrintAreaDialog(this, controller, printAreaKind);

            Point location = this.Location;
            location.Offset(10, 100);
            dialog.Location = location;

            dialog.Show(this);

            // Make sure the existing print area is fully visible, but hide the gray display.
            RectangleF rectangleCurrent = controller.GetCurrentPrintAreaRectangle(printAreaKind);
            if (!mapViewer.Viewport.Contains(rectangleCurrent)) {
                rectangleCurrent.Inflate(rectangleCurrent.Width * 0.05F, rectangleCurrent.Height * 0.05F);
                ShowRectangle(rectangleCurrent);
            }
            HidePrintArea = true;

            controller.BeginSetPrintArea(printAreaKind, dialog);
            dialog.PrintArea = controller.GetCurrentPrintArea(printAreaKind);
        }
Ejemplo n.º 5
0
        void SetPrintArea(int tabIndex, RectangleF expectedCurrent, RectangleF newPrintArea, PrintAreaKind printAreaKind)
        {
            Dictionary<int, RectangleF> printAreas = new Dictionary<int, RectangleF>();

            // Remember print areas for all tabs.
            for (int tab = 0; tab < controller.GetTabNames().Length; ++tab) {
                controller.SelectTab(tab);
                printAreas.Add(tab, controller.GetCurrentPrintAreaRectangle(PrintAreaKind.OneCourse));
            }

            controller.SelectTab(tabIndex);

            RectangleF rectangleCurrent = controller.GetCurrentPrintAreaRectangle(printAreaKind);

            TestUtil.AssertEqualRect(expectedCurrent, rectangleCurrent, 0.1, "initial print rectangle");

            controller.BeginSetPrintArea(printAreaKind, null);

            ChangeRectangle(expectedCurrent, newPrintArea);

            controller.EndSetPrintArea(printAreaKind, new PrintArea(false, false, new RectangleF()));

            rectangleCurrent = controller.GetCurrentPrintAreaRectangle(printAreaKind);
            TestUtil.AssertEqualRect(newPrintArea, rectangleCurrent, 0.1, "final print rectangle");

            // Check all other tabs.
            for (int tab = 0; tab < controller.GetTabNames().Length; ++tab) {
                controller.SelectTab(tab);
                RectangleF rect = controller.GetCurrentPrintAreaRectangle(PrintAreaKind.OneCourse);
                if (printAreaKind == PrintAreaKind.AllCourses || tab == tabIndex)
                    TestUtil.AssertEqualRect(newPrintArea, rect, 0.1, "final print rectangle");
                else
                    TestUtil.AssertEqualRect(printAreas[tab], rect, 0.1, "original print rectangle  for that tab");
            }
        }