This commit is contained in:
John Jenko 2010-08-04 15:17:19 +00:00
parent 1d5a43627c
commit 935802a57a
13 changed files with 151 additions and 188 deletions

View File

@ -62,6 +62,7 @@
</logger>
</log4net>
<appSettings>
<add key ="Debug" value ="true"/>
<add key="CslaAuthentication" value="Windows" />
<!--
<add key="CslaDataPortalProxy"

View File

@ -8,6 +8,7 @@ using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Configuration;
using VEPROMS.CSLA.Library;
//using Csla;
using DevComponents;
@ -87,32 +88,33 @@ namespace VEPROMS
#endregion
public frmVEPROMS()
{
#if (DEBUG)
//use local data (for development/debug mode)
if (Environment.MachineName == "RMARK-PC")
VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS_RMARK_DEBUG";
if (vlnStackTrace.DebugMode)
{
//use local data (for development/debug mode)
if (Environment.MachineName == "RMARK-PC")
VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS_RMARK_DEBUG";
else
VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS_LOCAL";
}
else
VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS_LOCAL";
#else
// use server data (default)
// - except for the volian laptop and Rich's Demo version where we need to use local data
if (Environment.MachineName == "RMARK-PC")
VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS_RMARK_DEMO";
//else if (Environment.MachineName == "DELL-D430")
// VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS_LOCAL";
//else
// VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS";
else
VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS_LOCAL";
#endif
{
// use server data (default)
// - except for the volian laptop and Rich's Demo version where we need to use local data
if (Environment.MachineName == "RMARK-PC")
VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS_RMARK_DEMO";
//else if (Environment.MachineName == "DELL-D430")
// VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS_LOCAL";
//else
// VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS";
else
VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS_LOCAL";
}
InitializeComponent();
// When creating an XY Plot, a System.Drawing.Graphics is needed and it requires a form. Use the main
// form.
#if (DEBUG)
MSWordToPDF.OverrideColor = Color.Red;
#endif
if (vlnStackTrace.DebugMode)
MSWordToPDF.OverrideColor = Color.Red;
MSWordToPDF.FormForPlotGraphics = this;
// set the color of the ribbon
@ -181,6 +183,8 @@ namespace VEPROMS
}
private void frmVEPROMS_Load(object sender, EventArgs e)
{
string debugMode = ConfigurationManager.AppSettings["Debug"];
vlnStackTrace.DebugMode = bool.Parse(debugMode); // set debug for the Volian.Controls.Library
// get the saved location and size of the VE-PROMS appication for this user
if (Settings.Default["Location"] != null) this.Location = Settings.Default.Location;
if (Settings.Default["Size"] != null) this.Size = Settings.Default.Size;
@ -200,12 +204,12 @@ namespace VEPROMS
}
private void SetupButtons()
{
#if (DEBUG)
#else
lblItemID.Visible = false;
btnItemInfo.Visible = false;
cmbFont.Visible = false;
#endif
if (!vlnStackTrace.DebugMode)
{
lblItemID.Visible = false;
btnItemInfo.Visible = false;
cmbFont.Visible = false;
}
}
#region MRU
private MostRecentItemList _MyMRIList;
@ -242,11 +246,6 @@ namespace VEPROMS
//SaveMRU();
SetupMRU();
if (mri != null) tc.OpenItem(mri.MyItemInfo);
#if (DEBUG)
// display a property page contianing the Tab Cotrol information
//f = new frmPropGrid(tc);
//f.Show();
#endif
}
private void SaveMRU()
{
@ -560,11 +559,10 @@ namespace VEPROMS
/// <param name="args"></param>
void tn_LoadingChildernDone(object sender, VETreeNodeEventArgs args)
{
#if (DEBUG)
ProgBarText = args.Info + " Seconds";
#else
ProgBarText = "";
#endif
if (vlnStackTrace.DebugMode)
ProgBarText = args.Info + " Seconds";
else
ProgBarText = "";
}
public int ProgBarMax

View File

@ -242,10 +242,6 @@ namespace VEPROMS.CSLA.Library
OnLoadingChildrenSQL(tn, new VETreeNodeEventArgs());
IList ol;
ItemInfo item = veobj as ItemInfo;
#if DEBUG
if (item != null && item.ItemID == 378)
Console.WriteLine("here");
#endif
if (veobj.GetType() == typeof(StepInfo) || veobj.GetType() == typeof(SectionInfo) || veobj.GetType() == typeof(ItemInfo))
ol = ((ItemInfo)veobj).GetChildren(true);
else

View File

@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using C1.C1Pdf;
using iTextSharp.text.pdf;
using iTextSharp.text.factories;
using Microsoft.Win32;
@ -22,41 +21,6 @@ namespace VG
void Save(string fileName);
float FontSizeAdjust { get;}
}
public partial class VGOut_C1PDF : IVGOutput
{
private C1PdfDocument _VGOutput;
//public C1PdfDocument VGOutput
//{ get { return _VGOutput; } }
public static VGOut_C1PDF Create()
{
C1PdfDocument pdf = new C1.C1Pdf.C1PdfDocument();
pdf.FontType = C1.C1Pdf.FontTypeEnum.Embedded; // embed fonts
return new VGOut_C1PDF(pdf);
}
public VGOut_C1PDF(C1PdfDocument vgOutput)
{ _VGOutput = vgOutput; }
public float Scale
// { get { return _VGOutput.Transform.Elements[0]; } }
{ get { return 1; } }
public void DrawLine(Pen pn, float startx, float starty, float endx, float endy)
{ _VGOutput.DrawLine(pn, startx, starty, endx, endy); }
public void DrawRectangle(Pen pn, RectangleF rectf)
{ _VGOutput.DrawRectangle(pn, rectf.X, rectf.Y, rectf.Width, rectf.Height); }
public void DrawEllipse(Pen pn, float cx, float cy, float dx, float dy)
{ _VGOutput.DrawEllipse(pn, cx, cy, dx, dy); }
public void DrawImage(Bitmap bm, RectangleF rectf)
{ _VGOutput.DrawImage(bm, rectf, ContentAlignment.MiddleCenter, ImageSizeModeEnum.Scale); }
public void DrawString(string text, Font myFont, Brush brush, RectangleF rectf)
{ _VGOutput.DrawString(text, myFont, brush, rectf, StringFormat.GenericTypographic); }
public void DrawArc(Pen pn, RectangleF rectf, float startAngle, float sweepAngle)
{ _VGOutput.DrawArc(pn, rectf, startAngle, sweepAngle); }
public SizeF MeasureString(string text, Font myFont)
{ return _VGOutput.MeasureString(text, myFont, 500); } //, StringFormat.GenericTypographic
public void Save(string fileName)
{ _VGOutput.Save(fileName); }
public float FontSizeAdjust
{ get { return .95F; } }
}
public partial class VGOut_Graphics: IVGOutput
{
private Graphics _VGOutput;

View File

@ -371,12 +371,12 @@ namespace VG
lnwid = w;
pg = ipg;
}
#if DEBUG
//#if DEBUG
public static int iColor = 0;
public Color[] myColors = { Color.Red, Color.Green, Color.OrangeRed, Color.Cyan, Color.Orange, Color.Blue, Color.Yellow, Color.Indigo, Color.YellowGreen, Color.Violet };
//public Color[] myColors ={ Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Blue, Color.BlueViolet, Color.Violet };
#endif
//public static int iColor = 0;
//public Color[] myColors = { Color.Red, Color.Green, Color.OrangeRed, Color.Cyan, Color.Orange, Color.Blue, Color.Yellow, Color.Indigo, Color.YellowGreen, Color.Violet };
////public Color[] myColors ={ Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Blue, Color.BlueViolet, Color.Violet };
//#endif
public void Draw(IVGOutput vgOutput)
{
//#if DEBUG

View File

@ -90,9 +90,9 @@ namespace Volian.Controls.Library
public AnnotationDetails()
{
InitializeComponent();
#if(DEBUG)
//#if(DEBUG)
//Resize+=new EventHandler(AnnotationDetails_Resize); // Debug the resize event
#endif
//#endif
}
#endregion

View File

@ -10,7 +10,7 @@ using VEPROMS.CSLA.Library;
using XYPlots;
using DevComponents.DotNetBar;
using System.Text.RegularExpressions;
using VG;
//using VG;
namespace Volian.Controls.Library
{

View File

@ -863,10 +863,8 @@ namespace Volian.Controls.Library
private void btnSearch_Click(object sender, EventArgs e)
{
#if DEBUG
DateTime start = DateTime.Now;
#endif
Cursor savcursor = Cursor;
DateTime start = DateTime.Now;
Cursor savcursor = Cursor;
try
{
string[] strSearchText = null;
@ -948,10 +946,9 @@ namespace Volian.Controls.Library
{
Cursor = savcursor;
}
#if DEBUG
MessageBox.Show(string.Format("{0} Milliseconds", TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalMilliseconds));
#endif
}
if (vlnStackTrace.DebugMode)
MessageBox.Show(string.Format("{0} Milliseconds", TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalMilliseconds));
}
private void cbxTextSearchText_Leave(object sender, EventArgs e)
{

View File

@ -46,15 +46,9 @@ namespace Volian.Controls.Library
private Font _SectFont = new Font("Arial", 10, FontStyle.Bold);
private Font _StepFont = new Font("Arial", 10);
private Color _ActiveColor = Color.SkyBlue;
#if (DEBUG)
private Color _InactiveColor = Color.Linen;
private Color _TabColor = Color.Beige;
private Color _PanelColor = Color.LightGray;
#else
private Color _InactiveColor = Color.White;
private Color _TabColor = Color.White;
private Color _PanelColor = Color.White;
#endif
// Whether panel is in view or edit mode. Toggled from steprtb
// or set based on approval/multi-user (these two will be done
// later.
@ -232,27 +226,34 @@ namespace Volian.Controls.Library
public StepPanel()
{
InitializeComponent();
SetupStepPanel();
}
private void SetupStepPanel()
{
this.BackColorChanged += new EventHandler(StepPanel_BackColorChanged);
#if(DEBUG)
this.Paint += new PaintEventHandler(StepPanel_Paint);
this.DoubleClick += new EventHandler(StepPanel_DoubleClick); // Toggles Vertical lines on and off
#else
this.BackColor = Color.White;
#endif
if (vlnStackTrace.DebugMode)
{
_InactiveColor = Color.Linen;
_TabColor = Color.Beige;
_PanelColor = Color.LightGray;
this.Paint += new PaintEventHandler(StepPanel_Paint);
this.DoubleClick += new EventHandler(StepPanel_DoubleClick); // Toggles Vertical lines on and off
}
else
{
_InactiveColor = Color.White;
_TabColor = Color.White;
_PanelColor = Color.White;
this.BackColor = Color.White;
}
this.AutoScroll = true;
}
public StepPanel(IContainer container)
{
container.Add(this);
InitializeComponent();
this.BackColorChanged += new EventHandler(StepPanel_BackColorChanged);
#if(DEBUG)
this.Paint += new PaintEventHandler(StepPanel_Paint); // Toggles Vertical lines on and off
this.DoubleClick += new EventHandler(StepPanel_DoubleClick);
#else
this.BackColor = Color.White;
#endif
this.AutoScroll = true;
SetupStepPanel();
}
void StepPanel_BackColorChanged(object sender, EventArgs e)
{

View File

@ -203,28 +203,18 @@ namespace Volian.Controls.Library
// return;
//}
_origDisplayText = vlntxt;
#if(DEBUG)
// Use Times New Roman for Debugging
//Font = new Font("Times New Roman", 14, FontStyle.Regular);
//Font = _origDisplayText.TextFont.WindowsFont;
Font formatFont = _origDisplayText.TextFont.WindowsFont;
Font formatFont = _origDisplayText.TextFont.WindowsFont;
if (_MyItemInfo.IsTable || _MyItemInfo.IsFigure)
Font = formatFont;
else
Font = new Font(_MyFontFamily == null ? formatFont.FontFamily : _MyFontFamily, formatFont.Size, formatFont.Style);
//Font = new Font("Bookman Old Style", formatFont.Size, formatFont.Style);
#elif(RELEASE)
Font = _origDisplayText.TextFont.WindowsFont; // font defined in plant's format
#else //DEMO
// Comment this out for DEMO to customer
// UN-Comment this for testing
//Font = _origDisplayText.TextFont.WindowsFont; // font defined in plant's format
Font formatFont = _origDisplayText.TextFont.WindowsFont;
if (_MyItemInfo.IsTable || _MyItemInfo.IsFigure)
Font = formatFont;
else
Font = new Font("Bookman Old Style", formatFont.Size, formatFont.Style);
#endif
{
if (vlnStackTrace.DebugMode)
Font = new Font(_MyFontFamily == null ? formatFont.FontFamily : _MyFontFamily, formatFont.Size, formatFont.Style);
else
Font = new Font("Bookman Old Style", formatFont.Size, formatFont.Style);
// TODO: Release Mode
//Font = _origDisplayText.TextFont.WindowsFont; // font defined in plant's format
}
Text = ""; // Initialize text before add text
// IMPORTANT: SetLineSpacing must be set before Links, otherwise it
// was confusing the 'handle' of the rtf box.

View File

@ -738,47 +738,47 @@ namespace Volian.Controls.Library
}
#endregion
#region RHM debug
#if DEBUG
// The following code generates an XML output for the selected item for print testing.
private void btnPageBreak_Click(object sender, EventArgs e)
{
// This is here temporarily to get a node and all of it's children for print testing.
OutputAllChildren(MyStepItem);
}
private void OutputAllChildren(StepItem myStepItem)
{
OutputAllChildren(myStepItem.MyBeforeStepItems);
OutputStepInfo(myStepItem);
OutputAllChildren(myStepItem.MyAfterStepItems);
OutputAllChildren(myStepItem.MyRNOStepItems);
}
private void OutputStepInfo(StepItem myStepItem)
{
Label lbl = myStepItem.MyLabel;
if (lbl.Text.Trim() != "")
Console.WriteLine("<text x='{0}In' y='{1}In' font-family='{2}' font-size='{3}Pt'>{4}</text>",
ToInches(myStepItem.Left + lbl.Left), ToInches(myStepItem.Top + lbl.Top),
lbl.Font.FontFamily.Name,lbl.Font.SizeInPoints,lbl.Text);
StepRTB rtb = myStepItem.MyStepRTB;
Console.WriteLine("<foreignObject x='{0}In' y='{1}In' width='{2}In' " +
"requiredExtensions='http://Volian.Com/EmbeddedRTF'>{3}</foreignObject>",
ToInches(myStepItem.Left + rtb.Left), ToInches(myStepItem.Top + rtb.Top), ToInches(rtb.Width), myStepItem.MyItemInfo.MyContent.Text);
// ToInches(myStepItem.Left + rtb.Left), ToInches(myStepItem.Top + rtb.Top), ToInches(rtb.Width), rtb.Rtf);
}
private float ToInches(int val)
{
return Convert.ToSingle(val)/96F;
}
//#if DEBUG
// // The following code generates an XML output for the selected item for print testing.
// private void btnPageBreak_Click(object sender, EventArgs e)
// {
// // This is here temporarily to get a node and all of it's children for print testing.
// OutputAllChildren(MyStepItem);
// }
// private void OutputAllChildren(StepItem myStepItem)
// {
// OutputAllChildren(myStepItem.MyBeforeStepItems);
// OutputStepInfo(myStepItem);
// OutputAllChildren(myStepItem.MyAfterStepItems);
// OutputAllChildren(myStepItem.MyRNOStepItems);
// }
// private void OutputStepInfo(StepItem myStepItem)
// {
// Label lbl = myStepItem.MyLabel;
// if (lbl.Text.Trim() != "")
// Console.WriteLine("<text x='{0}In' y='{1}In' font-family='{2}' font-size='{3}Pt'>{4}</text>",
// ToInches(myStepItem.Left + lbl.Left), ToInches(myStepItem.Top + lbl.Top),
// lbl.Font.FontFamily.Name,lbl.Font.SizeInPoints,lbl.Text);
// StepRTB rtb = myStepItem.MyStepRTB;
// Console.WriteLine("<foreignObject x='{0}In' y='{1}In' width='{2}In' " +
// "requiredExtensions='http://Volian.Com/EmbeddedRTF'>{3}</foreignObject>",
// ToInches(myStepItem.Left + rtb.Left), ToInches(myStepItem.Top + rtb.Top), ToInches(rtb.Width), myStepItem.MyItemInfo.MyContent.Text);
//// ToInches(myStepItem.Left + rtb.Left), ToInches(myStepItem.Top + rtb.Top), ToInches(rtb.Width), rtb.Rtf);
// }
// private float ToInches(int val)
// {
// return Convert.ToSingle(val)/96F;
// }
private void OutputAllChildren(List<StepItem> list)
{
if(list != null)
foreach (StepItem itm in list)
OutputAllChildren(itm);
}
// private void OutputAllChildren(List<StepItem> list)
// {
// if(list != null)
// foreach (StepItem itm in list)
// OutputAllChildren(itm);
// }
#endif
//#endif
private void btnToggleEditView_Click(object sender, EventArgs e)
{
MyStepRTB.ToggleEditView();

View File

@ -190,6 +190,12 @@ namespace Volian.Controls.Library
}
#endif
}
private static bool _DebugMode = true;
public static bool DebugMode
{
get { return vlnStackTrace._DebugMode; }
set { vlnStackTrace._DebugMode = value; }
}
}
}

View File

@ -584,9 +584,9 @@ namespace XYPlots
CalculateSlopes(dataPoints);
else
LineFlag = STRAIGHT;
#if DEBUG
ShowPoints(dataPoints);
#endif
//#if DEBUG
//ShowPoints(dataPoints);
//#endif
AddAPlot(dataPoints);
}
private double FindSlope(point first, point last)
@ -1219,7 +1219,9 @@ namespace XYPlots
delta2 = delta1 * sin_deg(theta1) / sin_deg(theta2);
r2 = Math.Floor(0.5 + r2 - delta2);
cp2 = FindModifiedCenter(r2, pt2.APoint, t2);
DebugOutput("DrawArc1"); VG_Arc.iColor = 1;
//#if DEBUG
//DebugOutput("DrawArc1"); VG_Arc.iColor = 1;
//#endif
DrawArc(r1, t1, t1 + theta1, cp1, x, y, pg, vgOutput);
DebugShowLocation("DrawArc1");
MoveTo(pt2.APoint);
@ -1232,7 +1234,9 @@ namespace XYPlots
}
else
{
DebugOutput("DrawArc2"); VG_Arc.iColor = 2;
//#if DEBUG
//DebugOutput("DrawArc2"); VG_Arc.iColor = 2;
//#endif
DrawArc(r2, t2, t2 - theta2, cp2, x, y, pg, vgOutput);
DebugShowLocation("DrawArc2");
}
@ -1254,8 +1258,10 @@ namespace XYPlots
else
{
//Console.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", t3, t3a, t4, t4a, thetaa, t1, t2, r1, r2, aryIdx);
DebugOutput("DrawArc3"); VG_Arc.iColor = 3;
VG_Arc.iColor = 4;
//#if DEBUG
//DebugOutput("DrawArc3"); VG_Arc.iColor = 3;
//VG_Arc.iColor = 4;
//#endif
DrawArc(r1, t1, t1 + theta1, cp1, x, y, pg, vgOutput);
//Console.WriteLine("'DrawArc3','{0}',{1},{2}", Key, r1, theta1);
DebugShowLocation("DrawArc3");
@ -1290,8 +1296,10 @@ namespace XYPlots
}
else
{
DebugOutput("DrawArc5"); VG_Arc.iColor = 5;
VG_Arc.iColor = 6;
//#if DEBUG
//DebugOutput("DrawArc5"); VG_Arc.iColor = 5;
//VG_Arc.iColor = 6;
//#endif
DrawArc(r2, t2, t2 - theta2, cp2, x, y, pg, vgOutput);
DebugShowLocation("DrawArc5");
}
@ -1789,7 +1797,9 @@ namespace XYPlots
{
LoadBuffFromString(PlotCommands);
Setup();
VG.VG_Arc.iColor = 0;
//#if DEBUG
//VG.VG_Arc.iColor = 0;
//#endif
}
public void Setup()
{
@ -1865,21 +1875,21 @@ namespace XYPlots
}
private void ShowPoints(DataPoints dataPoints)
{
#if DEBUG
foreach (DataPoint pl in dataPoints)
{
DebugOutput("x={0},y={1},slope={2}", pl.APoint.xyValue[0], pl.APoint.xyValue[1], pl.slope);
}
#endif
//#if DEBUG
//foreach (DataPoint pl in dataPoints)
//{
// DebugOutput("x={0},y={1},slope={2}", pl.APoint.xyValue[0], pl.APoint.xyValue[1], pl.slope);
//}
//#endif
}
public static string Key = "";
private void DebugOutput(string format, params object[] args)
{
#if DEBUG
//#if DEBUG
//if (args.Length == 0)
// Console.WriteLine("'{0}','{1}'",Key,format);
//Console.WriteLine(format, args);
#endif
//#endif
}
private void DebugShowLocation(string command)
{