Fixed up a few things

This commit is contained in:
Alex-TIMEHACK 2017-08-27 15:48:28 +01:00
parent 1d2e7331e3
commit a751c8fcac
4 changed files with 83 additions and 43 deletions

View file

@ -46,7 +46,7 @@ public static void SaveRtfDocument(RichTextBox tbox, string path)
THFileInfo info = new THFileInfo();
info.Name = Path.GetFileName(path);
info.FileIcon = 17;
info.FileIcon = 20;
info.ByteSize = fileBytes;
SaveSystem.CurrentSave.BytesLeft -= fileBytes;
SaveSystem.UpdateDirectoryInfo(new FileInfo(path).Directory.FullName, info);

View file

@ -226,6 +226,13 @@ public void OpenFile(string fileDir)
Program.AddTaskbarItem(app, app.Tag.ToString(), "Notepad", Properties.Resources.Win95IconNotepad);
break;
case 2:
WinClassicWordPad wp = new WinClassicWordPad();
wp.mainText.LoadFile(fileDir);
WinClassic app2 = wm.StartWin95(wp, "Wordpad", Properties.Resources.Win95IconWordpad, true, true);
Program.AddTaskbarItem(app2, app2.Tag.ToString(), "Wordpad", Properties.Resources.Win95IconWordpad);
break;
case 12:
OpenApplication(FileDialogBoxManager.ReadTextFile(fileDir), fileDir);
break;

View file

@ -31,6 +31,9 @@ private void InitializeComponent()
this.topmenu = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.sendToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -79,10 +82,6 @@ private void InitializeComponent()
this.lblStatus = new System.Windows.Forms.Label();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.pictureBox4 = new System.Windows.Forms.PictureBox();
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.topmenu.SuspendLayout();
this.pnlToolbar.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
@ -119,7 +118,6 @@ private void InitializeComponent()
this.saveToolStripMenuItem,
this.saveAsToolStripMenuItem,
this.toolStripSeparator1,
this.openToolStripMenuItem,
this.sendToolStripMenuItem,
this.exitToolStripMenuItem});
this.fileToolStripMenuItem.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F);
@ -134,6 +132,27 @@ private void InitializeComponent()
this.newToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.newToolStripMenuItem.Text = "New";
//
// openToolStripMenuItem1
//
this.openToolStripMenuItem1.Name = "openToolStripMenuItem1";
this.openToolStripMenuItem1.Size = new System.Drawing.Size(152, 22);
this.openToolStripMenuItem1.Text = "Open...";
this.openToolStripMenuItem1.Click += new System.EventHandler(this.openToolStripMenuItem1_Click);
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.saveToolStripMenuItem.Text = "Save...";
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
//
// saveAsToolStripMenuItem
//
this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.saveAsToolStripMenuItem.Text = "Save As...";
this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
@ -279,7 +298,7 @@ private void InitializeComponent()
//
this.bulletStyleToolStripMenuItem.CheckOnClick = true;
this.bulletStyleToolStripMenuItem.Name = "bulletStyleToolStripMenuItem";
this.bulletStyleToolStripMenuItem.Size = new System.Drawing.Size(131, 22);
this.bulletStyleToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.bulletStyleToolStripMenuItem.Text = "Bullet style";
//
// helpToolStripMenuItem
@ -392,6 +411,7 @@ private void InitializeComponent()
this.btnSave.Size = new System.Drawing.Size(23, 22);
this.btnSave.TabIndex = 3;
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// btnOpen
//
@ -403,6 +423,7 @@ private void InitializeComponent()
this.btnOpen.Size = new System.Drawing.Size(23, 22);
this.btnOpen.TabIndex = 2;
this.btnOpen.UseVisualStyleBackColor = true;
this.btnOpen.Click += new System.EventHandler(this.btnOpen_Click);
//
// btnPaste
//
@ -447,6 +468,7 @@ private void InitializeComponent()
this.btnNew.Size = new System.Drawing.Size(23, 22);
this.btnNew.TabIndex = 1;
this.btnNew.UseVisualStyleBackColor = true;
this.btnNew.Click += new System.EventHandler(this.btnNew_Click);
//
// pictureBox1
//
@ -613,40 +635,6 @@ private void InitializeComponent()
this.pictureBox4.TabIndex = 6;
this.pictureBox4.TabStop = false;
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.saveToolStripMenuItem.Text = "Save...";
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
//
// openToolStripMenuItem
//
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.openToolStripMenuItem.Text = "Open...";
//
// saveAsToolStripMenuItem
//
this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.saveAsToolStripMenuItem.Text = "Save As...";
this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click);
//
// openToolStripMenuItem1
//
this.openToolStripMenuItem1.Name = "openToolStripMenuItem1";
this.openToolStripMenuItem1.Size = new System.Drawing.Size(152, 22);
this.openToolStripMenuItem1.Text = "Open...";
this.openToolStripMenuItem1.Click += new System.EventHandler(this.openToolStripMenuItem1_Click);
this.pictureBox5.BackgroundImage = global::Histacom2.Properties.Resources.ie4_vsplitter;
this.pictureBox5.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.pictureBox5.Location = new System.Drawing.Point(297, 0);
this.pictureBox5.Name = "pictureBox5";
this.pictureBox5.Size = new System.Drawing.Size(2, 28);
this.pictureBox5.TabIndex = 7;
this.pictureBox5.TabStop = false;
//
// WinClassicWordPad
//
this.BackColor = System.Drawing.Color.Silver;
@ -687,7 +675,7 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem sendToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.RichTextBox mainText;
public System.Windows.Forms.RichTextBox mainText;
private System.Windows.Forms.ToolStripMenuItem undoToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem cutToolStripMenuItem;
@ -729,7 +717,6 @@ private void InitializeComponent()
private System.Windows.Forms.PictureBox pictureBox5;
private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem1;
}
}

View file

@ -186,6 +186,7 @@ private void openToolStripMenuItem1_Click(object sender, EventArgs e)
try
{
mainText.LoadFile(selectedPath);
CurrentFilePath = selectedPath;
} catch
{
(new WindowManager()).StartInfobox95("Wordpad", "An error occured opening the file.", Engine.Template.InfoboxType.Error, Engine.Template.InfoboxButtons.OK);
@ -233,5 +234,50 @@ void SaveAs()
}
catch (Exception ex) { MessageBox.Show(ex.Message); }
}
private void btnNew_Click(object sender, EventArgs e)
{
}
private void btnOpen_Click(object sender, EventArgs e)
{
try
{
ActivateOpenFileDialog(".rtf");
string selectedPath = Program.OpenFileExplorerAsDialogAndReturnGivenPath();
if (selectedPath != null)
{
try
{
mainText.LoadFile(selectedPath);
}
catch
{
(new WindowManager()).StartInfobox95("Wordpad", "An error occured opening the file.", Engine.Template.InfoboxType.Error, Engine.Template.InfoboxButtons.OK);
}
}
}
catch
{
}
}
private void btnSave_Click(object sender, EventArgs e)
{
if (CurrentFilePath == "")
{
// We aren't in a file right now
SaveAs();
}
else
{
File.Delete(CurrentFilePath);
SaveRtfDocument(mainText, CurrentFilePath);
}
}
}
}