Added parameter for frmPDFStatusForm
Added parameters for PromsPrinter Changed ItemID TextBox to a multiline TextBox Added Next and Previous button to move through IDs in TextBox Added a print button to print all of the procedures associated with the list of IDs Added code asociated with controls above Added error handler for the Clipboard
This commit is contained in:
parent
69f77955de
commit
c5fc60bfbd
@ -60,13 +60,20 @@ namespace VEPROMS
|
||||
set { _OpenPDF = value; }
|
||||
}
|
||||
private Point _NewLocation;
|
||||
public frmPDFStatusForm(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd,string pdfFile, Point newLocation,bool insertBlankPages, bool allOrAuto)
|
||||
private string _Prefix = ""; // RHM20150506 Multiline ItemID TextBox
|
||||
public string Prefix
|
||||
{
|
||||
get { return _Prefix; }
|
||||
set { _Prefix = value; }
|
||||
}
|
||||
public frmPDFStatusForm(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd,string pdfFile, Point newLocation,bool insertBlankPages, bool allOrAuto, string prefix)
|
||||
{
|
||||
Prefix = prefix;
|
||||
OpenPDF = openPDF;
|
||||
InitializeComponent();
|
||||
// if the version number of PROMS is 1.0, then we are running a Demo version.
|
||||
// When running a Demo version, force a "Sample" watermark when printing.
|
||||
MyPromsPrinter = new PromsPrinter(myItem, rev, (VlnSettings.ReleaseMode.Equals("DEMO")) ? "Sample" : watermark, debugOutput, origPgBrk, pdfPath + @"\\Compare", false, overWrite, cbd, pdfFile, insertBlankPages, allOrAuto);
|
||||
MyPromsPrinter = new PromsPrinter(myItem, rev, (VlnSettings.ReleaseMode.Equals("DEMO")) ? "Sample" : watermark, debugOutput, origPgBrk, pdfPath + @"\\Compare", false, overWrite, cbd, pdfFile, insertBlankPages, allOrAuto,Prefix);
|
||||
PDFPath = pdfPath;
|
||||
this.Text = "Creating PDF of " + myItem.DisplayNumber;
|
||||
_NewLocation = newLocation;
|
||||
|
57
PROMS/VEPROMS User Interface/frmVEPROMS.Designer.cs
generated
57
PROMS/VEPROMS User Interface/frmVEPROMS.Designer.cs
generated
@ -72,7 +72,12 @@ namespace VEPROMS
|
||||
this.lblItemID = new DevComponents.DotNetBar.LabelItem();
|
||||
this.lblResolution = new DevComponents.DotNetBar.LabelItem();
|
||||
this.lblUser = new DevComponents.DotNetBar.LabelItem();
|
||||
this.txtSearch = new DevComponents.DotNetBar.TextBoxItem();
|
||||
//this.txtSearch = new DevComponents.DotNetBar.TextBoxItem(); // RHM20150506 Multiline ItemID TextBox
|
||||
this.txtSearch = new System.Windows.Forms.TextBox();
|
||||
this.btnPrevious = new System.Windows.Forms.Button();
|
||||
this.btnPrint1 = new System.Windows.Forms.Button();
|
||||
this.cbScrunch = new System.Windows.Forms.CheckBox();
|
||||
this.btnNext = new System.Windows.Forms.Button();
|
||||
this.btnEditItem = new DevComponents.DotNetBar.ButtonItem();
|
||||
this.btnFixMSWord = new DevComponents.DotNetBar.ButtonItem();
|
||||
this.epAnnotations = new DevComponents.DotNetBar.ExpandablePanel();
|
||||
@ -481,6 +486,11 @@ namespace VEPROMS
|
||||
//
|
||||
// bottomBar
|
||||
//
|
||||
this.bottomBar.Controls.Add(this.txtSearch); // RHM20150506 Multiline ItemID TextBox
|
||||
this.bottomBar.Controls.Add(this.btnPrevious);
|
||||
this.bottomBar.Controls.Add(this.btnPrint1);
|
||||
this.bottomBar.Controls.Add(this.cbScrunch);
|
||||
this.bottomBar.Controls.Add(this.btnNext);
|
||||
this.bottomBar.Controls.Add(this.cmbFont);
|
||||
this.bottomBar.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.bottomBar.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
@ -497,7 +507,7 @@ namespace VEPROMS
|
||||
this.lblResolution,
|
||||
this.btnEditItem,
|
||||
this.lblUser,
|
||||
this.txtSearch,
|
||||
//this.txtSearch, // RHM20150506 Multiline ItemID TextBox
|
||||
this.btnFixMSWord});
|
||||
this.bottomBar.Location = new System.Drawing.Point(5, 569);
|
||||
this.bottomBar.Name = "bottomBar";
|
||||
@ -600,6 +610,42 @@ namespace VEPROMS
|
||||
// txtSearch
|
||||
//
|
||||
this.txtSearch.Name = "txtSearch";
|
||||
this.txtSearch.Font = new System.Drawing.Font(this.txtSearch.Font.FontFamily, 10); // RHM20150506 Multiline ItemID TextBox
|
||||
this.txtSearch.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.txtSearch.Multiline = true;
|
||||
this.txtSearch.Height = this.cmbFont.Height;
|
||||
//
|
||||
// btnPrevious
|
||||
//
|
||||
this.btnPrevious.Name = "btnPrevious";
|
||||
this.btnPrevious.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.btnPrevious.Text = "<";
|
||||
this.btnPrevious.Width = this.btnPrevious.Height;
|
||||
this.btnPrevious.Visible = false;
|
||||
//
|
||||
// btnPrint
|
||||
//
|
||||
this.btnPrint1.Name = "btnPrint1";
|
||||
this.btnPrint1.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.btnPrint1.Text = "P";
|
||||
this.btnPrint1.Width = this.btnPrint1.Height;
|
||||
this.btnPrint1.Visible = false;
|
||||
//
|
||||
// cbScrunch
|
||||
//
|
||||
this.cbScrunch.Name = "cbScrunch";
|
||||
this.cbScrunch.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.Text = "";
|
||||
this.cbScrunch.Width = this.cbScrunch.Height;
|
||||
this.cbScrunch.Visible = false;
|
||||
//
|
||||
// btnNext
|
||||
//
|
||||
this.btnNext.Name = "btnNext";
|
||||
this.btnNext.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.btnNext.Text = ">";
|
||||
this.btnNext.Width = this.btnNext.Height;
|
||||
this.btnNext.Visible = false;
|
||||
//
|
||||
// btnEditItem
|
||||
//
|
||||
@ -1618,7 +1664,12 @@ namespace VEPROMS
|
||||
private System.Windows.Forms.ComboBox cmbFont;
|
||||
private DevComponents.DotNetBar.LabelItem lblResolution;
|
||||
private DevComponents.DotNetBar.LabelItem lblUser;
|
||||
private DevComponents.DotNetBar.TextBoxItem txtSearch;
|
||||
//private DevComponents.DotNetBar.TextBoxItem txtSearch; // RHM20150506 Multiline ItemID TextBox
|
||||
private System.Windows.Forms.TextBox txtSearch;
|
||||
private System.Windows.Forms.Button btnPrevious;
|
||||
private System.Windows.Forms.Button btnPrint1;
|
||||
private System.Windows.Forms.CheckBox cbScrunch;
|
||||
private System.Windows.Forms.Button btnNext;
|
||||
private DevComponents.DotNetBar.ButtonItem btnEditItem;
|
||||
private DevComponents.DotNetBar.TabControlPanel tabControlPanel1;
|
||||
private DevComponents.DotNetBar.TabItem infotabHistory;
|
||||
|
@ -972,6 +972,12 @@ namespace VEPROMS
|
||||
//VlnSettings.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
|
||||
this.txtSearch.KeyPress += new KeyPressEventHandler(txtSearch_KeyPress);
|
||||
this.txtSearch.KeyUp += txtSearch_KeyUp; // RHM20150506 Multiline ItemID TextBox
|
||||
this.txtSearch.TextChanged+=txtSearch_TextChanged; // RHM20150506 Multiline ItemID TextBox
|
||||
this.btnNext.Click += btnNext_Click; // RHM20150506 Multiline ItemID TextBox
|
||||
this.btnPrint1.Click += btnPrint1_Click; // RHM20150506 Multiline ItemID TextBox
|
||||
this.cbScrunch.Click += cbScrunch_Click; // RHM20150506 Multiline ItemID TextBox
|
||||
this.btnPrevious.Click += btnPrevious_Click; // RHM20150506 Multiline ItemID TextBox
|
||||
if (Settings.Default["Location"] != null) this.Location = Settings.Default.Location;
|
||||
if (Settings.Default["Size"] != null) this.Size = Settings.Default.Size;
|
||||
if (Settings.Default["WindowState"] != null) this.WindowState = Settings.Default.WindowState;
|
||||
@ -1040,30 +1046,166 @@ namespace VEPROMS
|
||||
// dlgChgId dlgCI = new dlgChgId(tc);
|
||||
// dlgCI.ShowDialog(this);
|
||||
//}
|
||||
// RHM20150506 Multiline ItemID TextBox
|
||||
this.txtSearch.Text = Volian.Base.Library.VlnSettings.GetCommand("ItemIDs", "").Replace(",","\r\n");
|
||||
}
|
||||
void cbScrunch_Click(object sender, EventArgs e) // RHM20150506 Multiline ItemID TextBox
|
||||
{
|
||||
//Rtf2Pdf._AllowTableScrunching = TableScrunching.Phase1;
|
||||
}
|
||||
void btnPrint1_Click(object sender, EventArgs e)
|
||||
{
|
||||
string[] ids = txtSearch.Text.Split("\r\n ".ToCharArray());
|
||||
Dictionary<int,ProcedureInfo> dicProcs= new Dictionary<int,ProcedureInfo>();
|
||||
foreach (string id in ids)
|
||||
{
|
||||
if(id != "")
|
||||
{
|
||||
ItemInfo ii = GetItemInfoFromString(id);
|
||||
if (!dicProcs.ContainsKey(ii.MyProcedure.ItemID))
|
||||
dicProcs.Add(ii.MyProcedure.ItemID, ii.MyProcedure);
|
||||
}
|
||||
}
|
||||
DialogResult dr = System.Windows.Forms.DialogResult.Yes;
|
||||
//dr = MessageBox.Show("Do you want all of the PDFs to be opened?", "Open After Create", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
//Rtf2Pdf.AllowTableScrunching = TableScrunching.None;//TableScrunching.Phase1 | TableScrunching.Phase2 | TableScrunching.Phase3 | TableScrunching.Phase4| TableScrunching.Phase5 | TableScrunching.Phase6 | TableScrunching.Phase7 | TableScrunching.Phase8;
|
||||
//Rtf2Pdf.AllowTableScrunching = TableScrunching.Phase5 | TableScrunching.Phase2 | TableScrunching.Phase3 | TableScrunching.Phase4| TableScrunching.Phase5 | TableScrunching.Phase6 | TableScrunching.Phase7 | TableScrunching.Phase8 |
|
||||
// 0;
|
||||
foreach (int key in dicProcs.Keys)
|
||||
{
|
||||
ProcedureInfo proc = dicProcs[key];
|
||||
Console.WriteLine("{0}", proc.ShortPath);
|
||||
DlgPrintProcedure prnDlg = new DlgPrintProcedure(proc,true);//dvi.DocVersionConfig,pnum);
|
||||
prnDlg.MySessionInfo = MySessionInfo;
|
||||
//prnDlg.ShowDialog(this); // RHM 20120925 - Center dialog over PROMS window
|
||||
prnDlg.Prefix = proc.MyDocVersion.VersionID.ToString() + "_";
|
||||
prnDlg.Automatic = true;
|
||||
prnDlg.OpenAfterCreate = (dr == System.Windows.Forms.DialogResult.Yes);
|
||||
prnDlg.SetupForProcedure();
|
||||
prnDlg.CreatePDF();
|
||||
}
|
||||
}
|
||||
bool ProcessingPaste = false;
|
||||
private void txtSearch_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!ProcessingPaste)
|
||||
{
|
||||
if (txtSearch.Text.Contains("\n"))
|
||||
{
|
||||
ProcessingPaste = true;
|
||||
txtSearch.Text = txtSearch.Text.Trim("\r\n ".ToCharArray());
|
||||
btnNext.Visible = btnPrint1.Visible = cbScrunch.Visible = btnPrevious.Visible = txtSearch.Text.Contains("\r\n");
|
||||
txtSearch.SelectionStart = 0;
|
||||
CurrentID = GetCurrentLine();
|
||||
ProcessingPaste = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
void btnPrevious_Click(object sender, EventArgs e)
|
||||
{
|
||||
CurrentID = FindPreviousLine();
|
||||
}
|
||||
void btnNext_Click(object sender, EventArgs e)
|
||||
{
|
||||
CurrentID = FindNextLine();
|
||||
}
|
||||
public string CurrentID
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetCurrentLine();
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
System.Media.SystemSounds.Beep.Play();
|
||||
}
|
||||
else
|
||||
OpenMyItem(value);
|
||||
}
|
||||
}
|
||||
private string FindNextLine()
|
||||
{
|
||||
if (txtSearch.SelectionLength > 0)
|
||||
txtSearch.SelectionLength = 0;
|
||||
string sub = txtSearch.Text.Substring(txtSearch.SelectionStart);
|
||||
if (sub.Contains("\n"))
|
||||
{
|
||||
txtSearch.SelectionStart += sub.IndexOf("\n") + 1;
|
||||
txtSearch.ScrollToCaret();
|
||||
return GetCurrentLine();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private string FindPreviousLine()
|
||||
{
|
||||
if (txtSearch.SelectionLength > 0)
|
||||
txtSearch.SelectionLength = 0;
|
||||
string sub = txtSearch.Text;
|
||||
int selStart = 0;
|
||||
if (txtSearch.SelectionStart == 0) return null;
|
||||
if (txtSearch.SelectionStart > 2)
|
||||
{
|
||||
sub = txtSearch.Text.Substring(0, txtSearch.SelectionStart - 2);
|
||||
if (sub.Contains("\n"))
|
||||
selStart = sub.LastIndexOf("\r\n") + 2;
|
||||
}
|
||||
txtSearch.SelectionStart = selStart;
|
||||
txtSearch.ScrollToCaret();
|
||||
return GetCurrentLine();
|
||||
}
|
||||
void txtSearch_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Control && e.KeyCode == Keys.V)
|
||||
{
|
||||
txtSearch.SelectionStart = 0;
|
||||
txtSearch.SelectionLength = txtSearch.TextLength;
|
||||
txtSearch.SelectedText = Clipboard.GetText().TrimEnd("\r\n ".ToCharArray());
|
||||
btnNext.Visible = btnPrint1.Visible = cbScrunch.Visible = btnPrevious.Visible = txtSearch.Text.Contains("\r\n");
|
||||
txtSearch.SelectionLength = 0;
|
||||
txtSearch.SelectionStart = 0;
|
||||
txtSearch.ScrollToCaret();
|
||||
CurrentID= GetCurrentLine();
|
||||
e.Handled = true;
|
||||
}
|
||||
if (e.Control && e.KeyCode == Keys.A)
|
||||
{
|
||||
txtSearch.SelectionStart = 0;
|
||||
txtSearch.SelectionLength = txtSearch.TextLength;
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
private string GetCurrentLine()
|
||||
{
|
||||
while (txtSearch.SelectionStart > 0 && txtSearch.Text[txtSearch.SelectionStart - 1] != '\n')
|
||||
txtSearch.SelectionStart--;
|
||||
string sub = txtSearch.Text.Substring(txtSearch.SelectionStart).TrimStart("\r\n ".ToCharArray());
|
||||
if (sub.Contains("\r\n")) return sub.Substring(0, sub.IndexOf("\r\n"));
|
||||
return sub;
|
||||
}
|
||||
|
||||
void txtSearch_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (e.KeyChar == '\r')
|
||||
{
|
||||
e.Handled = true;
|
||||
ItemInfo ii = null;
|
||||
ContentInfo ci = null;
|
||||
if (txtSearch.Text.Length > 0)
|
||||
{
|
||||
int id = 0;
|
||||
if (txtSearch.Text.ToUpper().StartsWith("C="))
|
||||
{
|
||||
if (int.TryParse(txtSearch.Text.Substring(2), out id))
|
||||
ci = ContentInfo.Get(id);
|
||||
if (ci != null)
|
||||
ii = ci.ContentItems[0];
|
||||
}
|
||||
if (txtSearch.Text.Contains("\r\n")) // RHM20150506 Multiline ItemID TextBox
|
||||
CurrentID = GetCurrentLine();
|
||||
else
|
||||
{
|
||||
if (int.TryParse(txtSearch.Text, out id))
|
||||
ii = ItemInfo.Get(id);
|
||||
OpenMyItem(txtSearch.Text);
|
||||
}
|
||||
}
|
||||
if (e.KeyChar == 1 || e.KeyChar==22)
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenMyItem(string str) // RHM20150506 Multiline ItemID TextBox
|
||||
{
|
||||
ItemInfo ii = GetItemInfoFromString(str); // RHM20150506 Multiline ItemID TextBox
|
||||
if (ii != null)
|
||||
{
|
||||
tc.OpenItem(ii);
|
||||
@ -1072,7 +1214,25 @@ namespace VEPROMS
|
||||
else
|
||||
MessageBox.Show("No item found");
|
||||
}
|
||||
|
||||
private static ItemInfo GetItemInfoFromString(string str) // RHM20150506 Multiline ItemID TextBox
|
||||
{
|
||||
ItemInfo ii = null;
|
||||
int id = 0;
|
||||
ContentInfo ci = null;
|
||||
if (str.ToUpper().StartsWith("C="))
|
||||
{
|
||||
if (int.TryParse(str.Substring(2), out id))
|
||||
ci = ContentInfo.Get(id);
|
||||
if (ci != null)
|
||||
ii = ci.ContentItems[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (int.TryParse(str, out id))
|
||||
ii = ItemInfo.Get(id);
|
||||
}
|
||||
return ii;
|
||||
}
|
||||
|
||||
void btnAdministrativeTools_Click(object sender, EventArgs e)
|
||||
|
@ -916,6 +916,8 @@ namespace Volian.Controls.Library
|
||||
btnCMRedo.Enabled = btnRedo.Enabled = _MyStepRTB.CanRedo;
|
||||
|
||||
// for paste, see if there is clipboard data, & if so, of a type we can use.
|
||||
try // RHM20150506 Multiline ItemID TextBox
|
||||
{
|
||||
IDataObject iData = Clipboard.GetDataObject();
|
||||
//btnEdit3CMPaste.Enabled = btnPasteText.Enabled = btnCMPasteText.Enabled = btnCMPaste.Enabled = btnPaste.Enabled = (iData.GetDataPresent(DataFormats.Text) || iData.GetDataPresent(DataFormats.Rtf));
|
||||
//btnPasteText.Enabled = btnPasteStepText.Enabled = btnPaste.Enabled = (iData.GetDataPresent(DataFormats.Text) || iData.GetDataPresent(DataFormats.Rtf));
|
||||
@ -923,6 +925,14 @@ namespace Volian.Controls.Library
|
||||
btnCMPasteText.Enabled = btnPasteText.Enabled = iData.GetDataPresent(DataFormats.Text);
|
||||
btnCMPaste.Enabled = btnPasteStepText.Enabled = iData.GetDataPresent(DataFormats.Rtf);
|
||||
}
|
||||
catch (Exception) // Error while trying to access the clipboard
|
||||
{ // This happens when the ItemID Text Box at the bottom of the screen is used to paste
|
||||
// a list of IDs using the context menu (Right-Click, Paste)
|
||||
btnPaste.Enabled = false;
|
||||
btnCMPasteText.Enabled = btnPasteText.Enabled = false;
|
||||
btnCMPaste.Enabled = btnPasteStepText.Enabled = false;
|
||||
}
|
||||
}
|
||||
// all selected copy while in either Edit or View mode
|
||||
btnCMCopy.Enabled = btnCopy.Enabled = _MyStepRTB.SelectionLength > 0;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user