예제 #1
0
        private void OpenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.PromptSave() == false)
            {
                return;
            }

            // show a file open dialog
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter           = "Command Files (*.xml;*.lst)|*.xml;*.lst|All files (*.*)|*.*";
            dlg.FilterIndex      = 1;
            dlg.RestoreDirectory = true;
            dlg.FileName         = this.currentFile;

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                this.merger.Load(dlg.FileName);
                this.mergerOrig = (SplitMergeCmdFile)this.merger.Clone();
                this.mruMenu.AddFile(dlg.FileName);
                this.currentFile = dlg.FileName;
            }

            dlg.Dispose();
            this.UpdateGrid();
        }
예제 #2
0
        public static string ProcessCommandLine(string[] arguments, out bool showGui, out string cmdfile, out string outfile)
        {
            showGui = false;

            bool createTestInfo = false;

            if (arguments.Length > 3)
            {
                for (int iArg = 3; iArg < arguments.Length; ++iArg)
                {
                    if (arguments[iArg].ToUpper() == "/CREATETESTINFO")
                    {
                        createTestInfo = true;
                    }
                }
            }

            SplitMergeCmdFile splitmerge = new SplitMergeCmdFile();

            cmdfile = arguments[1];
            outfile = arguments[2];
            string err = splitmerge.DoSplitMerge(cmdfile, outfile, null, 1, false, null, PaginationFormatting.PaginationFormats.PF_Page_1_of_N, createTestInfo);

            if (err.Length > 0)
            {
                return(err);
            }

            // process any additional argments
            if (arguments.Length > 3)
            {
                for (int iArg = 3; iArg < arguments.Length; ++iArg)
                {
                    if (arguments[iArg].ToUpper() == "/SHOWPDF")
                    {
                        string v = GetViewer();

                        if (v.Length == 0)
                        {
                            System.Diagnostics.Process.Start("\"" + outfile + "\"");
                        }
                        else
                        {
                            System.Diagnostics.Process.Start(v, "\"" + outfile + "\"");
                        }
                    }

                    if (arguments[iArg].ToUpper() == "/SHOWGUI")
                    {
                        showGui = true;
                    }
                }
            }

            return(string.Empty);
        }
예제 #3
0
        private void NewToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.PromptSave() == false)
            {
                return;
            }

            this.merger.MergeListFileArray = new List <MergeListFiles>();
            this.currentFile = string.Empty;
            this.merger      = new SplitMergeCmdFile();
            this.UpdateGrid();
        }
예제 #4
0
        private void OnMruFile(int number, string filename)
        {
            // open the selected command file
            if (File.Exists(filename) == false)
            {
                return;
            }

            this.merger.Load(filename);
            this.mergerOrig  = (SplitMergeCmdFile)this.merger.Clone();
            this.currentFile = filename;
            this.UpdateGrid();
        }
예제 #5
0
        private void Merge_Click(object sender, EventArgs e)
        {
            this.UpdateFromGrid();

            int startPageNum = 1;

            try
            {
                startPageNum = int.Parse(this.textBoxStartPage.Text);
            }
            catch
            {
            }

            try
            {
                this.status.Visible = true;
                this.status.Show();
                this.status.Items.Clear();

                while (true)
                {
                    string            err;
                    SplitMergeCmdFile splitmerge = new SplitMergeCmdFile();
                    err = this.merger.DoSplitMerge(
                        null,
                        this.outBox.Text,
                        this.status,
                        startPageNum,
                        this.checkBoxNumberPages.Checked,
                        this.textBoxAnnotate.Text,
                        this.PaginationFormat);
                    if (err.Length == 0)
                    {
                        break;
                    }

                    DialogResult res = MessageBox.Show(err, "Error", MessageBoxButtons.RetryCancel);
                    if (res != DialogResult.Retry)
                    {
                        break;
                    }
                }
            }
            finally
            {
                this.status.Hide();
                this.status.Visible = false;
            }
        }
예제 #6
0
        private void SaveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.currentFile == string.Empty)
            {
                this.SaveAsToolStripMenuItem_Click(null, null);
                return;
            }

            this.UpdateFromGrid();
            this.merger.Save(this.currentFile);
            this.saveCompleted = true;
            this.mergerOrig    = (SplitMergeCmdFile)this.merger.Clone();
            this.UpdateGrid();
        }
예제 #7
0
        private bool PromptSave()
        {
            this.UpdateFromGrid();
            if (this.merger.MergeListFileArray.Count == 0)
            {
                return(true);
            }

            if (SplitMergeCmdFile.Compare(this.merger, this.mergerOrig) == false)
            {
                DialogResult res = MessageBox.Show("Save changes?", "The merge information has been modified", MessageBoxButtons.YesNo);
                if (res == DialogResult.Yes)
                {
                    this.saveCompleted = false;
                    this.SaveToolStripMenuItem_Click(null, null);
                    return(this.saveCompleted);
                }
            }

            return(true);
        }
예제 #8
0
        private void SaveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.UpdateFromGrid();

            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter           = "Command Files (*.xml;*.lst)|*.xml;*.lst|All files (*.*)|*.*";
            dlg.FilterIndex      = 1;
            dlg.RestoreDirectory = true;
            dlg.FileName         = this.currentFile;

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                this.merger.Save(dlg.FileName);
                this.saveCompleted = true;
                this.mergerOrig    = (SplitMergeCmdFile)this.merger.Clone();
                this.mruMenu.AddFile(dlg.FileName);
                this.currentFile = dlg.FileName;
            }

            dlg.Dispose();
            this.UpdateGrid();
        }
예제 #9
0
        public PdfMergeForm(string cmdFile, string outFile)
        {
            this.InitializeComponent();

            this.outBox.Text = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "merged.pdf");

            this.dataGrid.AllowDrop = true;

            this.mruMenu = new MruStripMenuInline(this.fileToolStripMenuItem1, this.recentToolStripMenuItem, new MruStripMenu.ClickedHandler(this.OnMruFile), Program.MruRegKey);

            // initialize item level array;
            this.rowcolors.Add(new ItemLevel(Color.White, this.rowcolors.Count));
            this.rowcolors.Add(new ItemLevel(Color.LightGray, this.rowcolors.Count));
            this.rowcolors.Add(new ItemLevel(Color.LightCoral, this.rowcolors.Count));
            this.rowcolors.Add(new ItemLevel(Color.LightCyan, this.rowcolors.Count));
            this.rowcolors.Add(new ItemLevel(Color.LightBlue, this.rowcolors.Count));
            this.rowcolors.Add(new ItemLevel(Color.LemonChiffon, this.rowcolors.Count));
            this.rowcolors.Add(new ItemLevel(Color.LightPink, this.rowcolors.Count));
            this.rowcolors.Add(new ItemLevel(Color.LightGreen, this.rowcolors.Count));
            this.rowcolors.Add(new ItemLevel(Color.LightPink, this.rowcolors.Count));
            this.rowcolors.Add(new ItemLevel(Color.LightSalmon, this.rowcolors.Count));
            this.rowcolors.Add(new ItemLevel(Color.LightSeaGreen, this.rowcolors.Count));
            this.rowcolors.Add(new ItemLevel(Color.LightSkyBlue, this.rowcolors.Count));
            this.rowcolors.Add(new ItemLevel(Color.LightSlateGray, this.rowcolors.Count));
            this.rowcolors.Add(new ItemLevel(Color.LightSteelBlue, this.rowcolors.Count));
            this.rowcolors.Add(new ItemLevel(Color.LightYellow, this.rowcolors.Count));

            while (this.rowcolors.Count < 21)
            {
                this.rowcolors.Add(new ItemLevel(Color.LightCyan, this.rowcolors.Count));
            }

            this.comboBoxPageNumFormat.Items.Clear();
            var values = Enum.GetValues(typeof(PaginationFormatting.PaginationFormats));

            foreach (var fmt in values)
            {
                string s = fmt.ToString();
                s = s.Replace("PF", string.Empty);
                s = s.Replace("_", " ");
                s = s.Replace("fwdslash", "/");
                this.comboBoxPageNumFormat.Items.Add(s);
            }

            this.PaginationFormat = PaginationFormatting.PaginationFormats.PF_Page_1_of_N;

            if (outFile != string.Empty)
            {
                this.outBox.Text = outFile;
            }

            if (cmdFile != string.Empty)
            {
                try
                {
                    this.merger.Load(cmdFile);
                    this.mergerOrig  = (SplitMergeCmdFile)this.merger.Clone();
                    this.currentFile = cmdFile;
                    this.UpdateGrid();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "File Load Error", MessageBoxButtons.OK);
                }
            }
        }
예제 #10
0
 private void UndoToolStripMenuItem_Click(object sender, EventArgs e)
 {
     this.merger = (SplitMergeCmdFile)this.mergerOrig.Clone();
     this.UpdateGrid();
 }