예제 #1
0
        public void PasteObjects(XmlItem objects, float x, float y)
        {
            if (objects.Count > 0)
            {
                // get the top object's location
                float pastedY = (objects[0].GetProp("t") != "") ?
                                Converter.StringToFloat(objects[0].GetProp("t")) : 0;

                float deltaX = x;
                float deltaY = y - pastedY;

                while (objects.Count > 0)
                {
                    XmlItem obj = objects[0];

                    // shift the object's location
                    float objX = (obj.GetProp("l") != "") ?
                                 Converter.StringToFloat(obj.GetProp("l")) : 0;
                    float objY = (obj.GetProp("t") != "") ?
                                 Converter.StringToFloat(obj.GetProp("t")) : 0;
                    obj.SetProp("l", Converter.ToString(objX + deltaX));
                    obj.SetProp("t", Converter.ToString(objY + deltaY));

                    // add object to a page
                    xmlItem.AddItem(obj);
                }
            }
        }
예제 #2
0
        private void Done()
        {
            // update label parameters and report page layout
            XmlItem labelParameters = lbxLabels.SelectedItem as XmlItem;

            SetReportPageLayout(labelParameters, FReport.Pages[0] as ReportPage);

            // save user-defined labels to config file
            XmlItem customManufacturer = FLabels.Root[FLabels.Root.Count - 1];
            XmlItem configLabels       = Config.Root.FindItem("LabelWizard");

            configLabels.Clear();
            for (int i = 0; i < customManufacturer.Count; i++)
            {
                XmlItem addItem = configLabels.Add();
                addItem.Name = "CustomLabel";
                addItem.Text = customManufacturer[i].Text;
            }

            // write last used items
            configLabels.SetProp("Manufacturer", SelectedManufacturer);
            configLabels.SetProp("Label", SelectedLabelName);

            // tell the designer to reflect changes
            FReport.Designer.SetModified(null, "ChangeReport");
        }
예제 #3
0
        public override void SaveState()
        {
            XmlItem xi = Config.Root.FindItem("Designer").FindItem(Name);

            xi.SetProp("ShowGrid", DialogWorkspace.ShowGrid ? "1" : "0");
            xi.SetProp("SnapToGrid", DialogWorkspace.SnapToGrid ? "1" : "0");
            xi.SetProp("SnapSize", DialogWorkspace.Grid.SnapSize.ToString());
        }
예제 #4
0
 public void Add(string text, int pageNo, float offsetY)
 {
     curItem      = curItem.Add();
     curItem.Name = "item";
     curItem.SetProp("Text", text);
     curItem.SetProp("Page", pageNo.ToString());
     curItem.SetProp("Offset", Converter.ToString(offsetY));
 }
예제 #5
0
        public static void SaveState()
        {
            XmlItem xi = Config.Root.FindItem("Designer").FindItem("Code");

            xi.SetProp("EnableVirtualSpace", EnableVirtualSpace ? "1" : "0");
            xi.SetProp("UseSpaces", UseSpaces ? "1" : "0");
            xi.SetProp("AllowOutlining", AllowOutlining ? "1" : "0");
            xi.SetProp("TabSize", TabSize.ToString());
        }
예제 #6
0
        private void Done()
        {
            FExpandedNodes = tvData.ExpandedNodes;
            Config.SaveFormState(this);
            XmlItem xi = Config.Root.FindItem("Forms").FindItem("ExpressionEditorForm");

            xi.SetProp("Splitter", splitContainer1.SplitterDistance.ToString());
            xi.SetProp("DescriptionHeight", lblDescription.Height.ToString());
        }
예제 #7
0
        private void SaveState()
        {
            Clear();
            outlineControl.Hide();

            XmlItem xi = Config.Root.FindItem("Preview");

            xi.SetProp("Zoom", Converter.ToString(Zoom));
            xi.SetProp("OutlineWidth", outlineControl.Width.ToString());
        }
예제 #8
0
 public void Save(XmlItem rootItem)
 {
     rootItem.Clear();
     foreach (BookmarkItem item in FItems)
     {
         XmlItem xi = rootItem.Add();
         xi.Name = "item";
         xi.SetProp("Name", Converter.ToXml(item.Name));
         xi.SetProp("Page", item.PageNo.ToString());
         xi.SetProp("Offset", Converter.ToString(item.OffsetY));
     }
 }
예제 #9
0
        private void EnumItems(XmlItem item, float shift)
        {
            int   pageNo = int.Parse(item.GetProp("Page"));
            float offset = Converter.StringToFloat(item.GetProp("Offset"));

            item.SetProp("Page", Converter.ToString(pageNo + 1));
            item.SetProp("Offset", Converter.ToString(offset + shift));

            for (int i = 0; i < item.Count; i++)
            {
                EnumItems(item[i], shift);
            }
        }
예제 #10
0
        private void Done()
        {
            if (DialogResult == DialogResult.OK)
            {
                FRich.Text = rtbText.Rtf;
            }

            FExpandedNodes = tvData.ExpandedNodes;
            Config.SaveFormState(this);
            XmlItem xi = Config.Root.FindItem("Forms").FindItem("RichEditorForm");

            xi.SetProp("Splitter", splitContainer1.SplitterDistance.ToString());
            xi.SetProp("DescriptionHeight", lblDescription.Height.ToString());
            xi.SetProp("Zoom", cbxZoom.SelectedItem.ToString());
        }
예제 #11
0
        public void Process()
        {
            textObject.SaveState();
            try
            {
                textObject.GetData();
                string fill_clr = textObject.FillColor.IsNamedColor ? textObject.FillColor.Name :
                                  "#" + textObject.FillColor.Name;
                string txt_clr = textObject.TextColor.IsNamedColor ? textObject.TextColor.Name :
                                 "#" + textObject.TextColor.Name;

                xmlItem.SetProp("x", textObject.Text);
                xmlItem.SetProp("Fill.Color", fill_clr);
                xmlItem.SetProp("TextFill.Color", txt_clr);
                xmlItem.SetProp("Font.Name", textObject.Font.Name);
            }
            finally
            {
                textObject.RestoreState();
            }
        }
예제 #12
0
        private void Init()
        {
            // load standard labels
            FLabels = new XmlDocument();
            using (Stream labelStream = ResourceLoader.UnpackStream("labels.dat"))
            {
                FLabels.Load(labelStream);
            }

            // add user-defined labels
            XmlItem customManufacturer = FLabels.Root.Add();

            customManufacturer.SetProp("Name", Res.Get("Forms,LabelWizard,Custom"));

            // get the list of user labels from config file
            XmlItem configLabels = Config.Root.FindItem("LabelWizard");

            for (int i = 0; i < configLabels.Count; i++)
            {
                XmlItem addItem = customManufacturer.Add();
                addItem.Text = configLabels[i].Text;
            }

            // make a list of manufacturers
            lbxLabels.ItemHeight = DrawUtils.DefaultItemHeight;
            for (int i = 0; i < FLabels.Root.Count; i++)
            {
                cbxLabels.Items.Add(FLabels.Root[i].GetProp("Name"));
            }

            // position to last used items
            int index = cbxLabels.Items.IndexOf(configLabels.GetProp("Manufacturer"));

            if (index >= 0)
            {
                cbxLabels.SelectedIndex = index;

                for (int i = 0; i < lbxLabels.Items.Count; i++)
                {
                    XmlItem item = lbxLabels.Items[i] as XmlItem;
                    if (item.GetProp("Name") == configLabels.GetProp("Label"))
                    {
                        lbxLabels.SelectedIndex = i;
                        break;
                    }
                }
            }
            else
            {
                cbxLabels.SelectedIndex = 0;
            }
        }
예제 #13
0
 public void Process()
 {
     textObject.SaveState();
     try
     {
         textObject.GetData();
         xmlItem.SetProp("x", textObject.Text);
     }
     finally
     {
         textObject.RestoreState();
     }
 }
예제 #14
0
        public override void Done(DialogResult result)
        {
            if (result == DialogResult.OK)
            {
                FDesigner.UIStyle = (UIStyle)cbxUIStyle.SelectedIndex;
                Config.UIStyle    = FDesigner.UIStyle;

                XmlItem pluginsItem = Config.Root.FindItem("Plugins");
                pluginsItem.Clear();

                foreach (object item in lbPlugins.Items)
                {
                    XmlItem xi = pluginsItem.Add();
                    xi.Name = "Plugin";
                    xi.SetProp("Name", item.ToString());
                }
            }
        }
예제 #15
0
        public void Save(XmlItem rootItem)
        {
            rootItem.Clear();
            foreach (KeyValuePair <string, DictionaryItem> pair in names)
            {
                XmlItem xi = rootItem.Add();
                xi.Name = pair.Key;
                xi.ClearProps();
                xi.SetProp("name", pair.Value.SourceName);
                //xi.Text = String.Concat("name=\"", pair.Value.SourceName, "\"");
            }

            //for (int i = 0; i < FNames.Count; i++)
            //{
            //  XmlItem xi = rootItem.Add();
            //  xi.Name = FNames.Keys[i];
            //  xi.Text = "name=\"" + FNames.Values[i].SourceName + "\"";
            //}
        }
예제 #16
0
        /// <inheritdoc/>
        public override void SaveState()
        {
            XmlItem xi = Config.Root.FindItem("Designer").FindItem(Name);

            xi.SetProp("DescriptionHeight", lblDescription.Height.ToString());
        }
예제 #17
0
        public override void SaveState()
        {
            XmlItem xi    = Config.Root.FindItem("Designer").FindItem(Name);
            string  units = "";

            switch (ReportWorkspace.Grid.GridUnits)
            {
            case PageUnits.Millimeters:
                units = "Millimeters";
                break;

            case PageUnits.Centimeters:
                units = "Centimeters";
                break;

            case PageUnits.Inches:
                units = "Inches";
                break;

            case PageUnits.HundrethsOfInch:
                units = "HundrethsOfInch";
                break;
            }
            xi.SetProp("Units", units);
            xi.SetProp("SnapSizeMillimeters", ReportWorkspace.Grid.SnapSizeMillimeters.ToString());
            xi.SetProp("SnapSizeCentimeters", ReportWorkspace.Grid.SnapSizeCentimeters.ToString());
            xi.SetProp("SnapSizeInches", ReportWorkspace.Grid.SnapSizeInches.ToString());
            xi.SetProp("SnapSizeHundrethsOfInch", ReportWorkspace.Grid.SnapSizeHundrethsOfInch.ToString());
            xi.SetProp("ShowGrid", ReportWorkspace.ShowGrid ? "1" : "0");
            xi.SetProp("SnapToGrid", ReportWorkspace.SnapToGrid ? "1" : "0");
            xi.SetProp("DottedGrid", ReportWorkspace.Grid.Dotted ? "1" : "0");
            xi.SetProp("MarkerStyle", ReportWorkspace.MarkerStyle.ToString());
            xi.SetProp("BandStructureSplitter", RulerPanel.SplitterDistance.ToString());
            xi.SetProp("Scale", ReportWorkspace.Scale.ToString());
            xi.SetProp("AutoGuides", ReportWorkspace.AutoGuides ? "1" : "0");
            xi.SetProp("ClassicView", ReportWorkspace.ClassicView ? "1" : "0");
            xi.SetProp("EditAfterInsert", ReportWorkspace.EditAfterInsert ? "1" : "0");
        }
예제 #18
0
        private void UpdateSample()
        {
            float paperWidth  = ConvertUnitsToInches(tbPaperWidth.Text);
            float paperHeight = ConvertUnitsToInches(tbPaperHeight.Text);
            float leftMargin  = ConvertUnitsToInches(tbLeftMargin.Text);
            float topMargin   = ConvertUnitsToInches(tbTopMargin.Text);

            float labelWidth  = ConvertUnitsToInches(tbLabelWidth.Text);
            float labelHeight = ConvertUnitsToInches(tbLabelHeight.Text);
            int   rows        = (int)udRows.Value;
            int   columns     = (int)udColumns.Value;
            float rowGap      = ConvertUnitsToInches(tbRowGap.Text);
            float columnGap   = ConvertUnitsToInches(tbColumnGap.Text);

            FLabelParameters.Name = "";
            FLabelParameters.Text = "";

            FLabelParameters.SetProp("Name", Converter.ToXml(tbName.Text));
            FLabelParameters.SetProp("Width", ConvertToXml(labelWidth));
            FLabelParameters.SetProp("Height", ConvertToXml(labelHeight));
            FLabelParameters.SetProp("PaperWidth", ConvertToXml(paperWidth));
            FLabelParameters.SetProp("PaperHeight", ConvertToXml(paperHeight));
            if (cbLandscape.Checked)
            {
                FLabelParameters.SetProp("Landscape", "true");
            }
            FLabelParameters.SetProp("LeftMargin", ConvertToXml(leftMargin));
            FLabelParameters.SetProp("TopMargin", ConvertToXml(topMargin));
            FLabelParameters.SetProp("Rows", rows.ToString());
            FLabelParameters.SetProp("Columns", columns.ToString());
            FLabelParameters.SetProp("RowGap", ConvertToXml(rowGap));
            FLabelParameters.SetProp("ColumnGap", ConvertToXml(columnGap));

            ReportPage page = FSampleReport.Pages[0] as ReportPage;

            page.Clear();
            page.Landscape   = cbLandscape.Checked;
            page.PaperWidth  = paperWidth * 25.4f;
            page.PaperHeight = paperHeight * 25.4f;
            page.LeftMargin  = leftMargin * 25.4f;
            page.TopMargin   = topMargin * 25.4f;

            DataBand band = new DataBand();

            band.Parent = page;

            bool fit = true;

            for (int x = 0; x < columns; x++)
            {
                for (int y = 0; y < rows; y++)
                {
                    ShapeObject shape = new ShapeObject();
                    shape.Parent       = band;
                    shape.Shape        = ShapeKind.RoundRectangle;
                    shape.Border.Color = Color.Gray;
                    shape.Bounds       = new RectangleF(x * (labelWidth + columnGap) * 96,
                                                        y * (labelHeight + rowGap) * 96,
                                                        labelWidth * 96,
                                                        labelHeight * 96);
                    if (shape.Right / Units.Millimeters > page.PaperWidth - page.LeftMargin + 0.1f ||
                        shape.Bottom / Units.Millimeters > page.PaperHeight - page.TopMargin + 0.1f)
                    {
                        (shape.Fill as SolidFill).Color = Color.Red;
                        fit = false;
                    }
                }
            }

            rcSample.Report    = FSampleReport;
            lblWarning.Visible = !fit;
            btnOk.Enabled      = fit;
        }
예제 #19
0
        public override void SaveState()
        {
            XmlItem xi = Config.Root.FindItem("Designer").FindItem(Name);

            xi.SetProp("MruFonts", cbxName.MruFonts);
        }
예제 #20
0
        private bool Done()
        {
            if (String.IsNullOrEmpty(tbAddressFrom.Text))
            {
                pageControl1.ActivePageIndex = 1;
                FRMessageBox.Error(Res.Get("Export,Email,AddressError"));
                tbAddressFrom.Focus();
                return(false);
            }
            if (String.IsNullOrEmpty(tbHost.Text))
            {
                pageControl1.ActivePageIndex = 1;
                FRMessageBox.Error(Res.Get("Export,Email,HostError"));
                tbHost.Focus();
                return(false);
            }
            if (String.IsNullOrEmpty(cbxAddressTo.Text))
            {
                pageControl1.ActivePageIndex = 0;
                FRMessageBox.Error(Res.Get("Export,Email,AddressError"));
                cbxAddressTo.Focus();
                return(false);
            }

            XmlItem xi = Config.Root.FindItem("EmailExport").FindItem("AccountSettings");

            // get account info
            FExport.Account.Address         = tbAddressFrom.Text;
            FExport.Account.Name            = tbName.Text;
            FExport.Account.MessageTemplate = tbTemplate.Text;
            FExport.Account.Host            = tbHost.Text;
            FExport.Account.Port            = (int)udPort.Value;
            FExport.Account.UserName        = tbUserName.Text;
            FExport.Account.Password        = tbPassword.Text;
            FExport.Account.EnableSSL       = cbEnableSSL.Checked;

            // save account info
            xi.SetProp("Address", FExport.Account.Address);
            xi.SetProp("Name", FExport.Account.Name);
            xi.SetProp("Template", FExport.Account.MessageTemplate);
            xi.SetProp("Host", FExport.Account.Host);
            xi.SetProp("Port", FExport.Account.Port.ToString());
            xi.SetProp("UserName", FExport.Account.UserName);
            xi.SetProp("Password", FExport.Account.Password);
            xi.SetProp("EnableSSL", FExport.Account.EnableSSL ? "1" : "0");

            // get email info
            FExport.Address     = cbxAddressTo.Text;
            FExport.Subject     = cbxSubject.Text;
            FExport.MessageBody = tbMessage.Text;
            FExport.Export      = FExports[cbxAttachment.SelectedIndex];

            // save email info
            string addresses = "\r" + cbxAddressTo.Text + "\r";

            foreach (object obj in cbxAddressTo.Items)
            {
                string address = obj.ToString();
                if (!addresses.Contains("\r" + address + "\r"))
                {
                    addresses += address + "\r";
                }
            }

            addresses = addresses.Substring(1, addresses.Length - 2);
            xi.SetProp("RecentAddresses", addresses);

            string subjects = "\r" + cbxSubject.Text + "\r";

            foreach (object obj in cbxSubject.Items)
            {
                string subject = obj.ToString();
                if (!subjects.Contains("\r" + subject + "\r"))
                {
                    subjects += subject + "\r";
                }
            }

            subjects = subjects.Substring(1, subjects.Length - 2);
            xi.SetProp("RecentSubjects", subjects);

            xi.SetProp("RecentExport", cbxAttachment.SelectedIndex.ToString());
            return(true);
        }
예제 #21
0
        /// <inheritdoc/>
        public override void SaveState()
        {
            XmlItem xi = Config.Root.FindItem("Designer").FindItem(Name);

            xi.SetProp("Sort", Grid.PropertySort.ToString());
        }