Subversion Repositories LassyPad

Compare Revisions

Ignore whitespace Rev 1 → Rev 4

/LassyPad/MainForm.resx
206,6 → 206,15
wbZRY2wAAAAASUVORK5CYII=
</value>
</data>
<data name="toolStripButton8.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAHZJREFUOE9jYKAG
eMHw/z85GG43OZpBelAMYLgCFIDhBUIQNoxGloOyCRtAwBDcBoA0omOyXPBfkUwvwJwOMgBPOOAPA5BG
mAFYnA8yGMOA7//F/iNjkAHoYsh8ggbg0wySw/RCKNDZJGDqG0BOcqZeXqAkRwMAkgcVdDDC2TAAAAAA
SUVORK5CYII=
</value>
</data>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>217, 17</value>
</metadata>
/LassyPad/bin/Debug/LassyPad.exe
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/LassyPad/bin/Debug/LassyPad.pdb
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/LassyPad/bin/Debug/icons/Thumbs.db
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/LassyPad/obj/x86/Debug/LassyPad.exe
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/LassyPad/obj/x86/Debug/LassyPad.csproj.GenerateResource.Cache
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/LassyPad/obj/x86/Debug/LassyPad.pdb
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/LassyPad/MainForm.Designer.cs
57,15 → 57,18
this.toolStripButton5 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton6 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton7 = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripButton8 = new System.Windows.Forms.ToolStripButton();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.wordWrapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.editorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.wordWrapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fileBar.SuspendLayout();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
89,6 → 92,7
this.fileBar.Size = new System.Drawing.Size(755, 25);
this.fileBar.TabIndex = 1;
this.fileBar.Text = "toolStrip1";
this.fileBar.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.FileBarItemClicked);
//
// toolStripButton1
//
221,7 → 225,9
this.underlineF,
this.toolStripButton5,
this.toolStripButton6,
this.toolStripButton7});
this.toolStripButton7,
this.toolStripSeparator1,
this.toolStripButton8});
this.formatBar.Location = new System.Drawing.Point(0, 24);
this.formatBar.Name = "formatBar";
this.formatBar.Size = new System.Drawing.Size(755, 25);
294,6 → 300,20
this.toolStripButton7.Text = "toolStripButton7";
this.toolStripButton7.Click += new System.EventHandler(this.ToolStripButton7Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
//
// toolStripButton8
//
this.toolStripButton8.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton8.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton8.Image")));
this.toolStripButton8.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton8.Name = "toolStripButton8";
this.toolStripButton8.Size = new System.Drawing.Size(23, 22);
this.toolStripButton8.Text = "toolStripButton8";
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
310,7 → 330,8
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.newToolStripMenuItem,
this.openToolStripMenuItem,
this.saveToolStripMenuItem});
this.saveToolStripMenuItem,
this.saveAsToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20);
this.fileToolStripMenuItem.Text = "File";
319,7 → 340,7
//
this.newToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("newToolStripMenuItem.Image")));
this.newToolStripMenuItem.Name = "newToolStripMenuItem";
this.newToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.newToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.newToolStripMenuItem.Text = "New";
this.newToolStripMenuItem.Click += new System.EventHandler(this.NewToolStripMenuItemClick);
//
327,7 → 348,7
//
this.openToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("openToolStripMenuItem.Image")));
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.openToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.openToolStripMenuItem.Text = "Open";
this.openToolStripMenuItem.Click += new System.EventHandler(this.OpenToolStripMenuItemClick);
//
335,13 → 356,16
//
this.saveToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripMenuItem.Image")));
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.saveToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.saveToolStripMenuItem.Text = "Save";
this.saveToolStripMenuItem.Click += new System.EventHandler(this.SaveToolStripMenuItemClick);
//
// openFileDialog1
// saveAsToolStripMenuItem
//
this.openFileDialog1.FileName = "openFileDialog1";
this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(124, 22);
this.saveAsToolStripMenuItem.Text = "Save As";
this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.SaveAsToolStripMenuItemClick);
//
// editorToolStripMenuItem
//
353,11 → 377,22
//
// wordWrapToolStripMenuItem
//
this.wordWrapToolStripMenuItem.Checked = true;
this.wordWrapToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.wordWrapToolStripMenuItem.Name = "wordWrapToolStripMenuItem";
this.wordWrapToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.wordWrapToolStripMenuItem.Size = new System.Drawing.Size(140, 22);
this.wordWrapToolStripMenuItem.Text = "Word Wrap";
this.wordWrapToolStripMenuItem.Click += new System.EventHandler(this.WordWrapToolStripMenuItemClick);
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
this.openFileDialog1.Filter = "Rich Text Format|*.rtf|Plain Text|*.txt|All Files|*.*";
//
// saveFileDialog1
//
this.saveFileDialog1.Filter = "Rich Text Format|*.rtf|Plain Text|*.txt";
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
385,6 → 420,9
this.ResumeLayout(false);
this.PerformLayout();
}
private System.Windows.Forms.ToolStripButton toolStripButton8;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem wordWrapToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem editorToolStripMenuItem;
private System.Windows.Forms.ToolStripTextBox sizeF;
414,5 → 452,6
private System.Windows.Forms.TabControl tabControl;
private System.Windows.Forms.ToolStrip fileBar;
private System.Windows.Forms.SplitContainer splitContainer1;
}
}
/LassyPad/MainForm.cs
38,7 → 38,7
saved = true;
}
public void open()
public bool open()
{
try
{
48,7 → 48,9
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Load Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
return true;
}
}
115,6 → 117,7
}
case ("Files"):
{
showFile(e.Node.Name);
break;
}
141,10 → 144,12
tabControl.SelectedIndex = 1;
for (int i = 0; i < files.Count; i++)
{
// editorView.Text = files[i].rtfBox.Text;
//editorView = files[i].rtfBox;
curFileID = i;
return;
if (files[i].loc == filename)
{
editorView.Rtf = files[i].rtfBox.Rtf;
curFileID = i;
return;
}
}
}
153,18 → 158,22
public void newFile()
{
int i = 0;
bool exists;
while (true)
{
exists = false;
for (int j = 0; j < files.Count; j++)
{
if (!(files[j].loc == "NewFile" + i.ToString() + ".rtf"))
{
files.Add(new rtfFile("NewFile" + i.ToString() + ".rtf"));
treeView.Nodes["Files"].Nodes.Add("NewFile" + i.ToString() + ".rtf", "NewFile" + i.ToString() + ".rtf");
showFile(files.Count - 1);
return;
}
if ((files[j].loc == "NewFile" + i.ToString() + ".rtf"))
exists = true;
}
if (!exists)
{
files.Add(new rtfFile("NewFile" + i.ToString() + ".rtf"));
treeView.Nodes["Files"].Nodes.Add("NewFile" + i.ToString() + ".rtf", "NewFile" + i.ToString() + ".rtf");
showFile(files.Count - 1);
return;
}
i++;
}
172,6 → 181,8
public void renameFile(string filename, string newFilename)
{
treeView.Nodes["Files"].Nodes[filename].Text = newFilename;
treeView.Nodes["Files"].Nodes[filename].Name = newFilename;
for (int i = 0; i < files.Count; i++)
{
if (files[i].loc == filename)
179,16 → 190,29
}
}
public void renameFile(int fileID, string newFilename)
{
treeView.Nodes["Files"].Nodes[files[fileID].loc].Text = newFilename;
treeView.Nodes["Files"].Nodes[files[fileID].loc].Name = newFilename;
files[fileID].loc = newFilename;
}
public void openFile()
{
bool openRes;
DialogResult res = openFileDialog1.ShowDialog();
if (openFileDialog1.FileName != "" && res != DialogResult.Cancel)
{
files.Add(new rtfFile(openFileDialog1.FileName));
files[files.Count - 1].open();
treeView.Nodes["Files"].Nodes.Add(openFileDialog1.FileName, openFileDialog1.FileName);
openRes = files[files.Count - 1].open();
if (openRes)
{
treeView.Nodes["Files"].Nodes.Add(openFileDialog1.FileName, openFileDialog1.FileName);
showFile(files.Count - 1);
}
else
files.RemoveAt(files.Count - 1);
}
showFile(files.Count - 1);
}
public void closeFile()
236,7 → 260,7
{
selectionStart = editorView.SelectionStart;
selectionLength = editorView.SelectionLength;
sizeF.Text = editorView.SelectionFont.Size.ToString();
// sizeF.Text = editorView.SelectionFont.Size.ToString();
}
#region File stuff
276,6 → 300,17
closeFile();
}
void SaveAsToolStripMenuItemClick(object sender, EventArgs e)
{
DialogResult res = saveFileDialog1.ShowDialog();
if (saveFileDialog1.FileName != "" && res != DialogResult.Cancel)
{
renameFile(curFileID, saveFileDialog1.FileName);
files[curFileID].loc = saveFileDialog1.FileName;
files[curFileID].save();
}
}
#endregion
#region Format stuff