This commit is contained in:
2010-08-12 16:05:52 +00:00
parent f91459b9f0
commit 0849b002b4
18 changed files with 231 additions and 212 deletions

View File

@@ -709,9 +709,9 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["PrintSettings", "AlwaysOverwritePDF"];
// If there is no value, then default to false
// If there is no value, then default to true
if (s == string.Empty)
s = "false"; // default
s = "true"; // default
return bool.Parse(s);
}
@@ -737,9 +737,9 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["PrintSettings", "AlwaysViewPDFAfterCreate"];
// If there is no value, then default to false
// If there is no value, then default to true
if (s == string.Empty)
s = "false"; // default
s = "true"; // default
return bool.Parse(s);
}

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Drawing;
using System.Text.RegularExpressions;
namespace VEPROMS.CSLA.Library
{
@@ -83,6 +84,24 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Printing_Length");
}
}
private static Regex byARGB = new Regex(@"Color \[A=([0-9]*), R=([0-9]*), G=([0-9]*), B=([0-9]*)\]");
private static Regex byName = new Regex(@"Color \[(.*)\]");
public static Color ColorFromString(string sColor)
{
Match myMatch = byARGB.Match(sColor);
if (myMatch.Groups.Count == 5)
return Color.FromArgb(int.Parse(myMatch.Groups[1].Value), int.Parse(myMatch.Groups[2].Value), int.Parse(myMatch.Groups[3].Value), int.Parse(myMatch.Groups[4].Value));
myMatch = byName.Match(sColor);
if (myMatch.Groups.Count == 2)
return Color.FromName(myMatch.Groups[1].Value);
if (sColor[0] == '[')
{
string[] parts = sColor.Substring(1, sColor.Length - 2).Split(",".ToCharArray());
return Color.FromArgb(Int32.Parse(parts[0]), Int32.Parse(parts[1]), Int32.Parse(parts[2]), Int32.Parse(parts[3]));
}
else return Color.FromName(sColor);
}
[Category("Printing")]
[DisplayName("Color")]
[Description("Color of Document Text")]
@@ -91,21 +110,11 @@ namespace VEPROMS.CSLA.Library
get
{
string sColor = _Xp["Printing", "Color"];
if (sColor == string.Empty) sColor = "Transparent";
if (sColor[0] == '[')
{
string[] parts = sColor.Substring(1, sColor.Length - 2).Split(",".ToCharArray());
return Color.FromArgb(Int32.Parse(parts[0]), Int32.Parse(parts[1]), Int32.Parse(parts[2]), Int32.Parse(parts[3]));
}
else return Color.FromName(sColor);
return ColorFromString(sColor);
}
set
{
if (value.IsNamedColor) _Xp["Printing", "Color"] = value.Name;
else
{
_Xp["Printing", "Color"] = string.Format("[{0},{1},{2},{3}]", value.A, value.R, value.G, value.B);
}
_Xp["Printing", "Color"] = value.ToString();
OnPropertyChanged("Printing_Color");
}
}

View File

@@ -227,103 +227,103 @@ namespace VEPROMS.CSLA.Library
}
}
#endregion
#region ColorCategory // From veproms.ini
// ** Note that not all possibilities from 16-bit will be added here, until
// ** it is determined how these will be used
// ** If this is used (unhidden), then we need to add logic to blank setting if the value
// ** we are saving is the same as the parent's value.
//#region ColorCategory // From veproms.ini
//// ** Note that not all possibilities from 16-bit will be added here, until
//// ** it is determined how these will be used
//// ** If this is used (unhidden), then we need to add logic to blank setting if the value
//// ** we are saving is the same as the parent's value.
//PROPGRID: Hide Editor Color for ROs
[Category("Editor Settings")]
[Browsable(false)]
[DisplayName("Step Editor Colors - Referenced Objects")]
[RefreshProperties(RefreshProperties.All)]
[Description("Color used to highlight an RO in procedure text")]
public string Color_ro
{
get
{
return _Xp["Color", "ro"];
}
set
{
_Xp["Color", "ro"] = value;
OnPropertyChanged("Color_ro");
}
}
//PROPGRID: Hide Editor Color for Transitions
[Category("Editor Settings")]
[Browsable(false)]
[DisplayName("Step Editor Colors - Transitions")]
[RefreshProperties(RefreshProperties.All)]
[Description("Color used to highlight a Transition in procedure text")]
public string Color_transition
{
get
{
return _Xp["Color", "transition"];
}
set
{
_Xp["Color", "transition"] = value;
OnPropertyChanged("Color_transition");
}
}
//PROPGRID: Hide Active Text Background Color
[Category("Editor Settings")]
[Browsable(false)]
[DisplayName("Step Editor Colors - Active Background")]
[RefreshProperties(RefreshProperties.All)]
[Description("editbackground")]
public string Color_editbackground
{
get
{
return _Xp["Color", "editbackground"];
}
set
{
_Xp["Color", "editbackground"] = value;
OnPropertyChanged("Color_editbackground");
}
}
//PROPGRID: Hide color setting for Black
[Category("Color")]
[Browsable(false)]
[DisplayName("black")]
[RefreshProperties(RefreshProperties.All)]
[Description("black")]
public string Color_black
{
get
{
return _Xp["Color", "black"];
}
set
{
_Xp["Color", "black"] = value;
OnPropertyChanged("Color_black");
}
}
//PROPGRID: Hide Color Setting for Blue
[Category("Color")]
[Browsable(false)]
[DisplayName("blue")]
[RefreshProperties(RefreshProperties.All)]
[Description("blue")]
public string Color_blue
{
get
{
return _Xp["Color", "blue"];
}
set
{
_Xp["Color", "blue"] = value;
OnPropertyChanged("Color_blue");
}
}
#endregion // From veproms.ini
////PROPGRID: Hide Editor Color for ROs
//[Category("Editor Settings")]
//[Browsable(false)]
//[DisplayName("Step Editor Colors - Referenced Objects")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Color used to highlight an RO in procedure text")]
//public string Color_ro
//{
// get
// {
// return _Xp["Color", "ro"];
// }
// set
// {
// _Xp["Color", "ro"] = value;
// OnPropertyChanged("Color_ro");
// }
//}
////PROPGRID: Hide Editor Color for Transitions
//[Category("Editor Settings")]
//[Browsable(false)]
//[DisplayName("Step Editor Colors - Transitions")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Color used to highlight a Transition in procedure text")]
//public string Color_transition
//{
// get
// {
// return _Xp["Color", "transition"];
// }
// set
// {
// _Xp["Color", "transition"] = value;
// OnPropertyChanged("Color_transition");
// }
//}
////PROPGRID: Hide Active Text Background Color
//[Category("Editor Settings")]
//[Browsable(false)]
//[DisplayName("Step Editor Colors - Active Background")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("editbackground")]
//public string Color_editbackground
//{
// get
// {
// return _Xp["Color", "editbackground"];
// }
// set
// {
// _Xp["Color", "editbackground"] = value;
// OnPropertyChanged("Color_editbackground");
// }
//}
////PROPGRID: Hide color setting for Black
//[Category("Color")]
//[Browsable(false)]
//[DisplayName("black")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("black")]
//public string Color_black
//{
// get
// {
// return _Xp["Color", "black"];
// }
// set
// {
// _Xp["Color", "black"] = value;
// OnPropertyChanged("Color_black");
// }
//}
////PROPGRID: Hide Color Setting for Blue
//[Category("Color")]
//[Browsable(false)]
//[DisplayName("blue")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("blue")]
//public string Color_blue
//{
// get
// {
// return _Xp["Color", "blue"];
// }
// set
// {
// _Xp["Color", "blue"] = value;
// OnPropertyChanged("Color_blue");
// }
//}
//#endregion // From veproms.ini
#region SystemPrintCategory // From veproms.ini
[Category("Print Settings")]
[DisplayName("Override Underline Thickness (dots)")]

View File

@@ -11,7 +11,7 @@ using System.Drawing;
using System.Text.RegularExpressions;
using LBWordLibrary;
using System.Drawing.Imaging;
using Volian.Base.Library;
namespace VEPROMS.CSLA.Library
{
@@ -179,29 +179,11 @@ namespace VEPROMS.CSLA.Library
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Fields
private bool _IsDisposed;
private static string _TemporaryFolder = null;
private DocumentInfo _MyDocument = null;
private FileInfo _MyFile = null;
private string _Extension = "DOC";
#endregion
#region Properties
public static string TemporaryFolder
{
get
{
if (_TemporaryFolder == null)
{
// This will create a Temp\VE-PROMS folder in the LocalSettings Folder.
//XP - C:\Documents and Settings\{user}\Local Settings\Application Data\Temp\VE-PROMS
//Vista - C:\Users\{user}\AppData\Local\Temp\VE-PROMS
_TemporaryFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Temp";
if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder);
_TemporaryFolder += @"\VE-PROMS";
if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder);
}
return _TemporaryFolder;
}
}
public DocumentInfo MyDocument
{
get { return _MyDocument; }
@@ -268,7 +250,7 @@ namespace VEPROMS.CSLA.Library
{
if (_MyDocument != null)
{
_MyFile = new FileInfo(string.Format(@"{0}\tmp_{1}{2}{3}", TemporaryFolder, MyDocument.DocID, Unique, MyDocument.FileExtension));
_MyFile = new FileInfo(string.Format(@"{0}\tmp_{1}{2}{3}", VlnSettings.TemporaryFolder, MyDocument.DocID, Unique, MyDocument.FileExtension));
FileStream fs = _MyFile.Create();
if(MyDocument.DocContent != null)fs.Write(MyDocument.DocContent, 0, MyDocument.DocContent.Length);
fs.Close();
@@ -502,7 +484,7 @@ namespace VEPROMS.CSLA.Library
sel.Text = "";
//float width = 72 * Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) / 12.0F;
//float height = 72 * lines / 6.0F;
string pngFile = @"C:\Temp\XYPlot1.png";
string pngFile = VlnSettings.TemporaryFolder + @"\XYPlot1.png"; //@"C:\Temp\XYPlot1.png";
RectangleF plotRect = CreatePlot(pngFile, val, 600F, FormForPlotGraphics);
//LBShape shape = myDoc.Shapes.AddPicture(@"C:\Temp\XYPlot.png", 0, 0, sel.Range);
float x = (float)sel.get_Information(LBWdInformation.wdHorizontalPositionRelativeToPage);
@@ -513,6 +495,7 @@ namespace VEPROMS.CSLA.Library
float xAdjust = -29.3F; // TODO: Check this value
float yAdjust = 9.1F; // TODO: Check this value
LBShape shape = myDoc.Shapes.AddPicture(pngFile, x + xAdjust + plotRect.X, yAdjust + y - yTop + plotRect.Y, sel.Range);
File.Delete(pngFile);
//Console.WriteLine(",{0},{1},{2},{3}", x, y - yTop, xAdjust,yAdjust);
shape.LockAspectRatio = LBMsoTriState.msoTrue;
//shape.Width = .89F * shape.Width;
@@ -576,7 +559,7 @@ namespace VEPROMS.CSLA.Library
grfx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
grfx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
grfx.Clear(System.Drawing.Color.Transparent);
XYPlots.XYPlot.BlackColor = System.Drawing.Color.Red;
XYPlots.XYPlot.BlackColor = VlnSettings.DebugMode ? System.Drawing.Color.Red : System.Drawing.Color.Black;
XYPlots.XYPlot myPlot = new XYPlots.XYPlot(xyPlot);
myPlot.SetMargins(0, 0, 0, 0);
myPlot.Process(new VG.VGOut_Graphics(grfx));
@@ -657,7 +640,8 @@ namespace VEPROMS.CSLA.Library
}
private static string CreatePDF(string fileName, bool openPdf)
{
return MyApp.CreatePDF(@"C:\Temp\" + fileName + ".pdf", openPdf);
//return MyApp.CreatePDF(@"C:\Temp\" + fileName + ".pdf", openPdf);
return MyApp.CreatePDF(VlnSettings.TemporaryFolder + "\\" + fileName + ".pdf", openPdf);
}
}

View File

@@ -6,6 +6,7 @@ using System.Data.SqlClient;
using Csla;
using Csla.Data;
using System.IO;
using Volian.Base.Library;
namespace VEPROMS.CSLA.Library
{
@@ -88,26 +89,9 @@ namespace VEPROMS.CSLA.Library
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Fields
private bool _IsDisposed;
private static string _TemporaryFolder = null;
//private static string _TemporaryFolder = null;
#endregion
#region Properties
public static string TemporaryFolder
{
get
{
if (_TemporaryFolder == null)
{
// This will create a Temp\VE-PROMS folder in the LocalSettings Folder.
//XP - C:\Documents and Settings\{user}\Local Settings\Application Data\Temp\VE-PROMS
//Vista - C:\Users\{user}\AppData\Local\Temp\VE-PROMS
_TemporaryFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Temp";
if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder);
_TemporaryFolder += @"\VE-PROMS";
if (!Directory.Exists(TemporaryFolder)) Directory.CreateDirectory(TemporaryFolder);
}
return _TemporaryFolder;
}
}
private ROImageInfo _MyROImage = null;
public ROImageInfo MyROImage
{
@@ -177,7 +161,7 @@ namespace VEPROMS.CSLA.Library
{
if (_MyROImage != null)
{
_MyFile = new FileInfo(string.Format(@"{0}\tmp_{1}{2}", TemporaryFolder, Unique, MyROImage.FileName));
_MyFile = new FileInfo(string.Format(@"{0}\tmp_{1}{2}", VlnSettings.TemporaryFolder, Unique, MyROImage.FileName));
FileStream fs = _MyFile.Create();
fs.Write(MyROImage.Content, 0, MyROImage.Content.Length);
fs.Close();