ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/RomCheater/trunk/RomCheater.ScratchPad/ScratchPadDocument.cs
(Generate patch)

Comparing trunk/RomCheater.ScratchPad/ScratchPadDocument.cs (file contents):
Revision 776 by william, Thu Jun 20 23:07:32 2013 UTC vs.
Revision 777 by william, Thu Jun 20 23:10:49 2013 UTC

# Line 31 | Line 31 | namespace RomCheater.ScratchPad
31              this.DocumentTab.Name = string.Format("tp{0}", this.DocumentIndex);
32              this.DocumentTab.Text = string.Format("{0}{1}", this.DocumentFilename, this.DocumentIndex);
33              //this.DocumentClosing += new BaseEventHandler<ControlClosingEventArgs<int>>(ScratchPadDocument_DocumentClosing);
34 +            this.IsDefaultDocument = true;
35              this.DocumentTab.Controls.Add(this);
36          }
37  
# Line 54 | Line 55 | namespace RomCheater.ScratchPad
55              return !DocumentSaved;
56          }
57  
58 +        private bool _IsDefaultDocument;
59 +        public bool IsDefaultDocument { get { return _IsDefaultDocument; } private set { _IsDefaultDocument = value; } }
60  
61          private bool _DocumentSaved;
62          public bool DocumentSaved { get { return _DocumentSaved; } private set { _DocumentSaved = value; } }
# Line 104 | Line 107 | namespace RomCheater.ScratchPad
107              DialogResult result = FileLoader.ShowDialog();
108              if (result != DialogResult.OK) return;
109              FileInfo fi = new FileInfo(FileLoader.FileName);
110 +            this.DocumentFilename = fi.FullName;
111              try
112              {
113                  
# Line 124 | Line 128 | namespace RomCheater.ScratchPad
128                                  CodeEditorSyntaxLoader.SetSyntax(txtEditor, language);
129                                  txtEditor.Document.ReParse();
130                                  this.UpdateTabName(fi.Name);
131 +                                this.IsDefaultDocument = false;
132                              }
133                              catch (Exception ex)
134                              {
# Line 146 | Line 151 | namespace RomCheater.ScratchPad
151          }
152          private void SaveDocument()
153          {
154 <            DialogResult result = FileSaver.ShowDialog();
155 <            if (result != DialogResult.OK) return;
156 <            FileInfo fi = new FileInfo(FileSaver.FileName);
154 >            FileInfo fi = null;
155 >            if (this.IsDefaultDocument)
156 >            {
157 >                DialogResult result = FileSaver.ShowDialog();
158 >                if (result != DialogResult.OK) return;
159 >                fi = new FileInfo(FileSaver.FileName);
160 >            }
161 >            else
162 >            {
163 >                fi = new FileInfo(this.DocumentFilename);
164 >            }          
165              try
166              {
167                  using (FileStream fs = new FileStream(fi.FullName, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines