示例#1
0
        public static DialogResult EditWindowBounds()
        {
            Document      document = Globals.Root.CurrentDocument;
            Rectangle     rect     = document.IsPaletteWithin ? document.Page(0).Bounds.ToRectangle() : document.SAWHeader.MainWindowBounds;
            Screen        screen   = Screen.FromPoint(rect.Centre());
            frmEditBounds frm      = new frmEditBounds(rect, Globals.Root.CurrentPage.LockARToBackgroundImage);

            frm.Text = Strings.Item("Verb_EditWindowBounds");
            frm.lblOuterHeader.Text = Strings.Item("SAW_ItemBounds_Screen");
            frm.txtOuterX.Text      = screen.Bounds.X.ToString();
            frm.txtOuterY.Text      = screen.Bounds.Y.ToString();
            frm.txtOuterWidth.Text  = screen.Bounds.Width.ToString();
            frm.txtOuterHeight.Text = screen.Bounds.Height.ToString();
            DialogResult result = frm.ShowDialog();

            if (result == DialogResult.OK)
            {
                Globals.Root.StoreNewTransaction(SetBoundsInData(frm.Value, frm.chkAdjustContents.Checked), true);
                Globals.Root.Editor.MatchWindowToSet();
            }
            return(result);
        }
示例#2
0
        public static DialogResult EditItemBounds(Item item)
        {
            Rectangle rct  = item.Bounds.ToRectangle();
            Page      page = Globals.Root.CurrentPage;

            rct.Y = (int)(rct.Y - page.Bounds.Top);             // Y origin at top of page
            frmEditBounds frm = new frmEditBounds(rct);

            frm.Text = Strings.Item("Verb_EditItemBounds");
            frm.lblOuterHeader.Text       = Strings.Item("SAW_ItemBounds_Set");
            frm.txtOuterX.Visible         = false;
            frm.txtOuterY.Visible         = false;
            frm.txtOuterWidth.Text        = page.Bounds.Width.ToString("0");
            frm.txtOuterHeight.Text       = page.Bounds.Height.ToString("0");
            frm.chkAdjustContents.Visible = item.Contents.Any();
            DialogResult result = frm.ShowDialog();

            if (result == DialogResult.OK)
            {
                rct   = frm.Value;
                rct.Y = (int)(rct.Y + page.Bounds.Top);
                Transaction transaction = new Transaction();
                if (item.Parent is Scriptable scriptable)
                {
                    transaction.Edit(scriptable);
                }
                transaction.Edit(item);
                item.SetBounds(rct.ToRectangleF(), transaction);
                if (frm.chkAdjustContents.Checked)
                {
                    TransformContents(item.Contents, transaction, false, frm.Value, frm.m_OriginalValue);
                }
                Globals.Root.StoreNewTransaction(transaction, true);
                Globals.Root.CurrentPage.SelectOnly(item);
            }
            return(result);
        }