Пример #1
0
        private void TitleTab_Load(object sender, EventArgs e)
        {
            db = new DbService();

            fontList = new List<string>();
            fontList = FontFamily.Families.Select(x => x.Name).Where(x => !x.Contains("Bahnschrift")).ToList();
            cboFont.DataSource = fontList;

            alignData = db.GetDocOptionData("Title Align");
            cboAlign.DataSource = alignData;
            cboAlign.DisplayMember = Constants.Name;
            cboAlign.ValueMember = Constants.Option;
            cboAlign.SelectedIndex = 0;

            nudFsize.Value = 16;

            MainService.ChangeControlsEnable(false,
               cboAlign, cboFont, nudFsize,
               bnColor, cbUnderline, cbItalic, cbBold);

            PreOption = "";
            PostOption = "";

            colorDialog1.Color = Color.Black;
            colorR = colorDialog1.Color.R.ToString();
            colorG = colorDialog1.Color.G.ToString();
            colorB = colorDialog1.Color.B.ToString();
            fontColor = String.Format("{0},{1},{2}", colorR, colorG, colorB);

            parentForm = this.ParentForm as DocStyleForm;

            isFormLoad = false;


        }
Пример #2
0
        private void btnSuffix_Click(object sender, EventArgs e)
        {
            isSuffixCilck = true;

            if (txtSuffix.Text.Contains(@"\") || txtSuffix.Text.Contains(@"{") || txtSuffix.Text.Contains(@"}"))
            {
                MessageBox.Show("This text has the character that can't be used in BibTeX style.");
                return;
            }
            txtSuffix.Text = txtSuffix.Text.Replace("\"", "''");
            txtSuffix.Text = txtSuffix.Text.Replace("&", "\\&");
            txtSuffix.Text = txtSuffix.Text.Replace("%", "\\%");
            txtSuffix.Text = txtSuffix.Text.Replace("#", "\\#");
            txtSuffix.Text = txtSuffix.Text.Replace("%", "\\$");

            RunFieldStylePreview();

            if (String.IsNullOrEmpty(txtSuffix.Text) || String.IsNullOrWhiteSpace(txtSuffix.Text))
            {
                MainService.ChangeControlsEnable(false, cbSuffixB, cbSuffixI, cbSuffixU);
            }
            else
            {
                MainService.ChangeControlsEnable(true, cbSuffixB, cbSuffixI, cbSuffixU);
            }
        }
Пример #3
0
 private void cbCustom_CheckedChanged(object sender, EventArgs e)
 {
     bool isChecked = cbCustom.Checked;
     MainService.ChangeControlsEnable(isChecked,
        btnHead, txtHead, cboFont, nudFsize, cboAlign,
        bnColor, cbUnderline, cbItalic, cbBold);
     runPreview(lbHead.Text);
 }
Пример #4
0
 private void cbCustom_CheckedChanged(object sender, EventArgs e)
 {
     bool isChecked = cbCustom.Checked;
     MainService.ChangeControlsEnable(isChecked,
        cboAlign, cboFont, nudFsize,
        bnColor, cbUnderline, cbItalic, cbBold);
     RunTitlePreview();
 }
Пример #5
0
        private void cbSetFont_CheckedChanged(object sender, EventArgs e)
        {
            bool isChecked = cbSetFont.Checked;

            MainService.ChangeControlsEnable(isChecked,
                                             cboFont, nudFsize, bnColor);

            RunLayoutPreview();
        }
Пример #6
0
        private void cbCustom_CheckedChanged(object sender, EventArgs e)
        {
            bool isChecked = cbCustom.Checked;

            MainService.ChangeControlsEnable(isChecked,
                                             cboTop, cboRight, cboLeft, cboBottom,
                                             nudTop, nudLeft, nudRight, nudBottom);

            RunLayoutPreview();
        }
Пример #7
0
        private void btnRight_Click(object sender, EventArgs e)
        {
            tmpRightText = txtRight.Text;
            runPreview("Text Above");

            if (String.IsNullOrEmpty(txtRight.Text) || String.IsNullOrWhiteSpace(txtRight.Text))
            {
                MainService.ChangeControlsEnable(false, cbBoldRight, cbItalicRight, cbUnderlineRight, cboRightFont, btnColorRight, nudRight);
            }
            else
            {
                MainService.ChangeControlsEnable(true, cbBoldRight, cbItalicRight, cbUnderlineRight, cboRightFont, btnColorRight, nudRight);
            }
        }
Пример #8
0
        private void btnLeft_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtLeft.Text) || String.IsNullOrWhiteSpace(txtLeft.Text))
            {
                MainService.ChangeControlsEnable(false, cbBoldLeft, cbItalicLeft, cbUnderlineLeft, cboLeftFont, btnColorLeft, nudLeft);
            }
            else
            {
                MainService.ChangeControlsEnable(true, cbBoldLeft, cbItalicLeft, cbUnderlineLeft, cboLeftFont, btnColorLeft, nudLeft);
            }

            tmpLeftText = txtLeft.Text;
            runPreview("Text Above");
        }
Пример #9
0
        private void btnName_Click(object sender, EventArgs e)
        {
            tmpText = txtLabel.Text;
            RunPreview("Label");

            if (String.IsNullOrEmpty(txtLabel.Text) || String.IsNullOrWhiteSpace(txtLabel.Text))
            {
                MainService.ChangeControlsEnable(false,
                                                 cbBold, cbItalic);
            }
            else
            {
                MainService.ChangeControlsEnable(true,
                                                 cbBold, cbItalic);
            }
        }
Пример #10
0
        private void btnHead_Click(object sender, EventArgs e)
        {
            tmpText = txtHead.Text;
            runPreview(lbHead.Text);

            if (String.IsNullOrEmpty(txtHead.Text) || String.IsNullOrWhiteSpace(txtHead.Text))
            {
                MainService.ChangeControlsEnable(false,
              cboFont, nudFsize, cboAlign,
               bnColor, cbUnderline, cbItalic, cbBold);
            }
            else
            {
                MainService.ChangeControlsEnable(true,
              cboFont, nudFsize, cboAlign,
               bnColor, cbUnderline, cbItalic, cbBold);
            }
        }
Пример #11
0
        private void FieldStyleTab_Load(object sender, EventArgs e)
        {
            TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
            string   tmp      = fieldName + " style";

            lbTab.Text  = textInfo.ToTitleCase(tmp);
            txtEnd.Text = ". ";

            parentForm = this.ParentForm as BibStyleForm;

            MainService.ChangeControlsEnable(false, cbPrefixB, cbPrefixI, cbPrefixU, cbSuffixB, cbSuffixI, cbSuffixU);

            isEndClick    = false;
            isPrefixClick = false;
            isSuffixCilck = false;

            strPrefix = txtPrefix.Text;
            strSuffix = txtSuffix.Text;
            strEnd    = txtEnd.Text;
        }
Пример #12
0
        private void cbEnableLabel_CheckedChanged(object sender, EventArgs e)
        {
            if (cbEnableLabel.Checked)
            {
                MainService.ChangeControlsEnable(true,
                                                 txtLabel, btnName, cbBold, cbItalic,
                                                 cboSep, cboNumbering);
            }
            else
            {
                MainService.ChangeControlsEnable(false,
                                                 txtLabel, btnName, cbBold, cbItalic,
                                                 cboSep, cboNumbering);
            }

            if (!isFormLoad)
            {
                RunPreview("Label");
            }
        }
Пример #13
0
        private void btnPrefix_Click(object sender, EventArgs e)
        {
            isPrefixClick = true;

            if (txtPrefix.Text.Contains(@"\") || txtSuffix.Text.Contains(@"{") || txtSuffix.Text.Contains(@"}"))
            {
                MessageBox.Show("This text have the character that can't be used in BibTeX style.");
                return;
            }


            RunFieldStylePreview();

            if (String.IsNullOrEmpty(txtPrefix.Text) || String.IsNullOrWhiteSpace(txtPrefix.Text))
            {
                MainService.ChangeControlsEnable(false, cbPrefixB, cbPrefixI, cbPrefixU);
            }
            else
            {
                MainService.ChangeControlsEnable(true, cbPrefixB, cbPrefixI, cbPrefixU);
            }
        }
Пример #14
0
        private void TocTab_Load(object sender, EventArgs e)
            {
                db = new DbService();

                fontList = new List<string>();
                fontList = FontFamily.Families.Select(x => x.Name).Where(x => !x.Contains("Bahnschrift")).ToList();
                cboFont.DataSource = fontList;

                fontListL = new List<string>();
                fontListL = FontFamily.Families.Select(x => x.Name).Where(x => !x.Contains("Bahnschrift")).ToList();
                cboLeftFont.DataSource = fontListL;

                fontListR = new List<string>();
                fontListR = FontFamily.Families.Select(x => x.Name).Where(x => !x.Contains("Bahnschrift")).ToList();
                cboRightFont.DataSource = fontListR;

                fontList = new List<string>();
                fontList = FontFamily.Families.Select(x => x.Name).Where(x => !x.Contains("Bahnschrift")).ToList();
                cboFont.DataSource = fontList;

                alignData = db.GetDocOptionData("Title Align");
                cboAlign.DataSource = alignData;
                cboAlign.DisplayMember = Constants.Name;
                cboAlign.ValueMember = Constants.Name;
                cboAlign.SelectedIndex = 1;

                nudFsize.Value = 16;

                MainService.ChangeControlsEnable(false,
                   cboFont, nudFsize, txtHead, btnHead, cboAlign,
                    bnColor, cbUnderline, cbItalic, cbBold,
                    cboLeftFont, btnColorLeft, nudLeft,
                    cbBoldLeft, cbUnderlineLeft, cbItalicLeft,
                    cboRightFont, btnColorRight, nudRight,
                    cbBoldRight, cbUnderlineRight, cbItalicRight);

                colorDialog1.Color = Color.Black;
                colorR = colorDialog1.Color.R.ToString();
                colorG = colorDialog1.Color.G.ToString();
                colorB = colorDialog1.Color.B.ToString();

                cdLeft.Color = Color.Black;
                colorLeftR = cdLeft.Color.R.ToString();
                colorLeftG = cdLeft.Color.G.ToString();
                colorLeftB = cdLeft.Color.B.ToString();

                cdRight.Color = Color.Black;
                colorRightR = cdRight.Color.R.ToString();
                colorRightG = cdRight.Color.G.ToString();
                colorRightB = cdRight.Color.B.ToString();

                fontColor = String.Format("{0} ,{1} ,{2}", colorR, colorG, colorB);
                fontColorLeft = String.Format("{0} ,{1} ,{2}", colorLeftR, colorLeftG, colorLeftB);
                fontColorRight = String.Format("{0} ,{1} ,{2}", colorRightR, colorRightG, colorRightB);

                nudDepth.Value = 3;
                nudDepth.Minimum = 1;
                nudDepth.Maximum = 5;

                parentForm = this.ParentForm as DocStyleForm;
                isFormLoad = false;
            
        }
Пример #15
0
        private void LayoutTab_Load(object sender, EventArgs e)
        {
            db = new DbService();

            pageSizeData              = db.GetDocOptionData(lbPageSize.Text);
            cboPageSize.DataSource    = pageSizeData;
            cboPageSize.DisplayMember = Constants.Name;
            cboPageSize.ValueMember   = Constants.Option;
            cboPageSize.SelectedIndex = 0;

            orientationData              = db.GetDocOptionData(lbOrientation.Text);;
            cboOrientation.DataSource    = orientationData;
            cboOrientation.DisplayMember = Constants.Name;
            cboOrientation.ValueMember   = Constants.Option;
            cboOrientation.SelectedIndex = 0;

            columnData              = db.GetDocOptionData(lbColumn.Text);
            cboColumn.DataSource    = columnData;
            cboColumn.DisplayMember = Constants.Name;
            cboColumn.ValueMember   = Constants.Option;
            cboColumn.SelectedIndex = 0;

            clsData              = db.GetDocOptionData(lbCls.Text);
            cboCls.DataSource    = clsData;
            cboCls.DisplayMember = Constants.Name;
            cboCls.ValueMember   = Constants.Option;
            cboCls.SelectedIndex = 0;

            fontList           = new List <string>();
            fontList           = FontFamily.Families.Select(x => x.Name).Where(x => !x.Contains("Bahnschrift")).ToList();
            cboFont.DataSource = fontList;

            unitData = new List <LengthUnit>()
            {
                new LengthUnit {
                    name = "inch", unit = "in"
                },
                new LengthUnit {
                    name = "cm", unit = "cm"
                },
                new LengthUnit {
                    name = "mm", unit = "mm"
                }
            };

            BindingSource topData    = new BindingSource();
            BindingSource bottomData = new BindingSource();
            BindingSource leftData   = new BindingSource();
            BindingSource rightData  = new BindingSource();

            topData.DataSource    = unitData;
            bottomData.DataSource = unitData;
            leftData.DataSource   = unitData;
            rightData.DataSource  = unitData;

            cboTop.DataSource    = topData;
            cboTop.DisplayMember = Constants.Name;
            cboTop.ValueMember   = Constants.Unit;
            cboTop.SelectedIndex = 0;

            cboLeft.DataSource    = leftData;
            cboLeft.DisplayMember = Constants.Name;
            cboLeft.ValueMember   = Constants.Unit;
            cboLeft.SelectedIndex = 0;

            cboRight.DataSource    = rightData;
            cboRight.DisplayMember = Constants.Name;
            cboRight.ValueMember   = Constants.Unit;
            cboRight.SelectedIndex = 0;

            cboBottom.DataSource    = bottomData;
            cboBottom.DisplayMember = Constants.Name;
            cboBottom.ValueMember   = Constants.Unit;
            cboBottom.SelectedIndex = 0;


            nudTop.Value    = 1;
            nudBottom.Value = 1;
            nudLeft.Value   = 1;
            nudRight.Value  = 1;

            nudFsize.Value = 16;

            cbCustom.Checked  = false;
            cbSetFont.Checked = false;

            MainService.ChangeControlsEnable(false,
                                             cboTop, cboRight, cboLeft, cboBottom,
                                             nudTop, nudLeft, nudRight, nudBottom,
                                             cboFont, nudFsize, bnColor);


            geometryOption = "";
            clsOption      = "";

            colorDialog1.Color = Color.Black;
            colorR             = colorDialog1.Color.R.ToString();
            colorG             = colorDialog1.Color.G.ToString();
            colorB             = colorDialog1.Color.B.ToString();
            fontColor          = String.Format("{0},{1},{2}", colorR, colorG, colorB);

            parentForm = this.ParentForm as DocStyleForm;
            isFormLoad = false;

            RunLayoutPreview();
        }