using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GraphicText;
using BitmapRegion;
namespace Mars_Mission
{
public partial class formReport : Form
{
public enum enuLayoutStyle { Left, Center, Right };
classReport[] cReportsPending = new classReport[0];
Panel_GraphicText pnlGrText;
static classGraphicText cGrText;
public static Font fntRegular = new Font("ms sans-serif", 12);
public static Font fntItalic = new Font(fntRegular.FontFamily, fntRegular.Size, FontStyle.Italic);
public static Font fntBold = new Font(fntRegular.FontFamily, fntRegular.Size, FontStyle.Bold);
public static formReport frmReport = new formReport();
public formReport()
{
InitializeComponent();
FormBorderStyle = FormBorderStyle.None;
ShowInTaskbar = false;
Visible = false;
TopMost = true;
BitmapRegion.BitmapRegion.CreateControlRegion(this, (Bitmap)Mars_Mission.Properties.Resources.frame);
pnlGrText = new Panel_GraphicText(this);
pnlGrText.Size = new System.Drawing.Size(542, 248);
pnlGrText.Location = new Point(27, 24);
pnlGrText.BringToFront();
pnlGrText.BackColor
= pnlGrText.pic.BackColor
= Color.FromArgb(255, 240, 240, 240);
lbtnOk.BringToFront();
cGrText = new classGraphicText(this);
lbtnOk.Click += new EventHandler(lbtnOk_Click);
lbtnNext.Click += new EventHandler(lbtnNext_Click);
VisibleChanged += new EventHandler(formReport_VisibleChanged);
Hide();
Controls.Add(pnlGrText);
}
void lbtnNext_Click(object sender, EventArgs e)
{
publishNextReport();
}
void formReport_VisibleChanged(object sender, EventArgs e)
{
if (Visible)
{
Top = (Screen.PrimaryScreen.WorkingArea.Height - Height) / 2;
Left = (Screen.PrimaryScreen.WorkingArea.Width - Width) / 2;
}
}
void lbtnOk_Click(object sender, EventArgs e)
{
Hide();
setLabelButtonVisible();
}
void setLabelButtonVisible()
{
formMarsMission.lbtnReport.Visible = cReportsPending.Length > 0;
}
public void quickReport(string strText)
{
classReport cNewReport = new classReport();
cNewReport.appendReport(strText, formReport.fntRegular);
newReport(ref cNewReport);
}
public void newReport(ref classReport cNewReport)
{
Array.Resize<classReport>(ref cReportsPending, cReportsPending.Length + 1);
cReportsPending[cReportsPending.Length - 1] = cNewReport;
setLabelButtonVisible();
}
public void publishNextReport()
{ // put next report onto screen
if (cReportsPending.Length > 0)
{
classReport cThisReport = cReportsPending[0];
for (int intReportCounter = 0; intReportCounter < cReportsPending.Length - 1; intReportCounter++)
{
cReportsPending[intReportCounter] = cReportsPending[intReportCounter + 1];
}
Array.Resize<classReport>(ref cReportsPending, cReportsPending.Length - 1);
pnlGrText.udrWordArray = cThisReport.udrWordArray;
pnlGrText.putWordArrayToScreen();
pnlGrText.BringToFront();
Show();
lbtnNext.Visible = cReportsPending.Length > 0;
pnlGrText.resize();
}
else
{
Hide();
setLabelButtonVisible();
}
}
public void clearReports()
{
cReportsPending = new classReport[0];
setLabelButtonVisible();
}
public class classReport
{
public classWordImage[] udrWordArray;
static Font fntLast = new Font("Ms sans-serif", 12);
static Color clrLast = Color.Black;
public void appendReport(string strNewText) { appendReport(strNewText, fntLast, clrLast, enuWordPositionRelativeToPreviousWord.right, enuScript.normal); }
public void appendReport(string strNewText, Color clrForeground) { appendReport(strNewText, fntLast, clrForeground, enuWordPositionRelativeToPreviousWord.right, enuScript.normal); }
public void appendReport(string strNewText, Font fntNew) { appendReport(strNewText, fntNew, clrLast, enuWordPositionRelativeToPreviousWord.right, enuScript.normal); }
public void appendReport(string strNewText, Font fntNew, Color clrForeground, enuWordPositionRelativeToPreviousWord ePos, enuScript eScript)
{
clrLast = clrForeground;
fntLast = fntNew;
if (udrWordArray == null)
{
udrWordArray = new classWordImage[0];
cGrText.appendArrayWordImage(ref udrWordArray, strNewText, new classMyFont(fntNew, clrForeground), enuWordPositionRelativeToPreviousWord.NL, eScript);
}
else
cGrText.appendArrayWordImage(ref udrWordArray, strNewText, new classMyFont(fntNew, clrForeground), ePos, eScript);
}
}
}
}