Beispiel #1
0
        private void addLineBtn_Click(object sender, EventArgs e)
        {
            string currentFile = fileListBox.SelectedItem.ToString();
            int    currentId   = -1;

            if (pf.project.files.ContainsKey(currentFile))
            {
                foreach (var content in pf.project.files[currentFile].content)
                {
                    if (content.contentId > currentId)
                    {
                        currentId = content.contentId;
                    }
                }
            }

            LineEditor.LineData ld = new LineEditor.LineData()
            {
                newLine       = true,
                origPath      = pf.project.orig_path,
                tranPath      = pf.project.tran_path,
                currentFile   = currentFile,
                lastContentId = currentId,
                filelist      = pf.project.file_list
            };

            OpenLineEditor(ld);
        }
Beispiel #2
0
        private void OpenLineEditor(LineEditor.LineData ld)
        {
            LineEditor lineEditor = new LineEditor(ld, pf.project.type);

            if (lineEditor.ShowDialog() == DialogResult.OK)
            {
                string currentItem = fileListBox.SelectedItem.ToString();

                if (!pf.project.files.ContainsKey(currentItem))
                {
                    ProjectFile.RevisedFile rf = new ProjectFile.RevisedFile
                    {
                        complete = false,
                        note     = "",
                        content  = new List <ProjectFile.FileContent>(),
                    };

                    pf.project.files.Add(currentItem, rf);
                }

                int contentId = lineEditor.newfc.contentId;

                if (pf.project.files[currentItem].content.FindIndex(line => line.contentId == contentId) != -1)
                {
                    var item = pf.project.files[currentItem].content.Single(line => line.contentId == contentId);

                    if (pf.project.files[currentItem].content.Contains(item))
                    {
                        pf.project.files[currentItem].content.Remove(item);
                    }
                }

                ProjectFile.FileContent fc = new ProjectFile.FileContent
                {
                    contentId  = lineEditor.newfc.contentId,
                    lineId     = lineEditor.newfc.lineId,
                    proposal   = lineEditor.newfc.proposal,
                    prevLineId = lineEditor.newfc.prevLineId,
                    comment    = lineEditor.newfc.comment,
                    color      = lineEditor.newfc.color
                };

                pf.project.files[currentItem].content.Add(fc);

                ListViewUpdate();

                fileChanged = true;
            }
        }
Beispiel #3
0
        private void editLineBtn_Click(object sender, EventArgs e)
        {
            string currentFile = fileListBox.SelectedItem.ToString();
            string lineId      = listView.SelectedItems[0].SubItems[0].Text;
            var    item        = pf.project.files[currentFile].content.Single(line => line.lineId == lineId);

            LineEditor.LineData ld = new LineEditor.LineData()
            {
                newLine       = false,
                origPath      = pf.project.orig_path,
                tranPath      = pf.project.tran_path,
                fc            = item,
                currentFile   = currentFile,
                lastContentId = item.contentId,
                filelist      = pf.project.file_list
            };

            OpenLineEditor(ld);
        }