new button copy including attributes

This commit is contained in:
2015-11-03 14:10:41 +01:00
parent b4e8089efc
commit 3e128794e1
2 changed files with 68 additions and 29 deletions

View File

@ -71,6 +71,7 @@
this.grpSettings = new System.Windows.Forms.GroupBox();
this.btnSaveArea = new System.Windows.Forms.Button();
this.btnShowWorkFiles = new System.Windows.Forms.Button();
this.btnXmlKopAttr = new System.Windows.Forms.Button();
this.grpProduce.SuspendLayout();
this.grpSettings.SuspendLayout();
this.SuspendLayout();
@ -94,7 +95,7 @@
this.outText.Multiline = true;
this.outText.Name = "outText";
this.outText.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.outText.Size = new System.Drawing.Size(380, 418);
this.outText.Size = new System.Drawing.Size(380, 456);
this.outText.TabIndex = 1;
this.outText.WordWrap = false;
//
@ -108,7 +109,7 @@
this.outCob.Multiline = true;
this.outCob.Name = "outCob";
this.outCob.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.outCob.Size = new System.Drawing.Size(545, 416);
this.outCob.Size = new System.Drawing.Size(545, 454);
this.outCob.TabIndex = 2;
this.outCob.WordWrap = false;
this.outCob.KeyDown += new System.Windows.Forms.KeyEventHandler(this.outCob_KeyDown);
@ -136,7 +137,7 @@
// btnClose
//
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnClose.Location = new System.Drawing.Point(880, 628);
this.btnClose.Location = new System.Drawing.Point(880, 688);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(72, 23);
this.btnClose.TabIndex = 6;
@ -308,7 +309,7 @@
// btnSettings
//
this.btnSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnSettings.Location = new System.Drawing.Point(9, 17);
this.btnSettings.Location = new System.Drawing.Point(9, 26);
this.btnSettings.Margin = new System.Windows.Forms.Padding(2);
this.btnSettings.Name = "btnSettings";
this.btnSettings.Size = new System.Drawing.Size(81, 23);
@ -338,7 +339,7 @@
// btnTestThings
//
this.btnTestThings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnTestThings.Location = new System.Drawing.Point(9, 41);
this.btnTestThings.Location = new System.Drawing.Point(9, 63);
this.btnTestThings.Name = "btnTestThings";
this.btnTestThings.Size = new System.Drawing.Size(81, 23);
this.btnTestThings.TabIndex = 33;
@ -349,7 +350,7 @@
// btnCrossref
//
this.btnCrossref.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnCrossref.Location = new System.Drawing.Point(93, 17);
this.btnCrossref.Location = new System.Drawing.Point(95, 26);
this.btnCrossref.Name = "btnCrossref";
this.btnCrossref.Size = new System.Drawing.Size(81, 23);
this.btnCrossref.TabIndex = 35;
@ -361,7 +362,7 @@
//
this.chkBackupVars.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.chkBackupVars.AutoSize = true;
this.chkBackupVars.Location = new System.Drawing.Point(96, 45);
this.chkBackupVars.Location = new System.Drawing.Point(96, 67);
this.chkBackupVars.Name = "chkBackupVars";
this.chkBackupVars.Size = new System.Drawing.Size(87, 17);
this.chkBackupVars.TabIndex = 36;
@ -383,6 +384,7 @@
//
this.grpProduce.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.grpProduce.Controls.Add(this.btnXmlKopAttr);
this.grpProduce.Controls.Add(this.btnFrXMLTo);
this.grpProduce.Controls.Add(this.chkAttribs);
this.grpProduce.Controls.Add(this.chkNewArea);
@ -392,9 +394,9 @@
this.grpProduce.Controls.Add(this.btnMoveFrom);
this.grpProduce.Controls.Add(this.btnMoves);
this.grpProduce.Controls.Add(this.btnGenICode);
this.grpProduce.Location = new System.Drawing.Point(406, 545);
this.grpProduce.Location = new System.Drawing.Point(406, 583);
this.grpProduce.Name = "grpProduce";
this.grpProduce.Size = new System.Drawing.Size(545, 77);
this.grpProduce.Size = new System.Drawing.Size(545, 99);
this.grpProduce.TabIndex = 38;
this.grpProduce.TabStop = false;
this.grpProduce.Text = "Producera";
@ -402,7 +404,7 @@
// btnFrXMLTo
//
this.btnFrXMLTo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnFrXMLTo.Location = new System.Drawing.Point(297, 49);
this.btnFrXMLTo.Location = new System.Drawing.Point(290, 49);
this.btnFrXMLTo.Name = "btnFrXMLTo";
this.btnFrXMLTo.Size = new System.Drawing.Size(92, 22);
this.btnFrXMLTo.TabIndex = 43;
@ -414,19 +416,20 @@
//
this.chkAttribs.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chkAttribs.AutoSize = true;
this.chkAttribs.Location = new System.Drawing.Point(396, 54);
this.chkAttribs.Location = new System.Drawing.Point(389, 54);
this.chkAttribs.Name = "chkAttribs";
this.chkAttribs.Size = new System.Drawing.Size(85, 17);
this.chkAttribs.TabIndex = 42;
this.chkAttribs.Text = "Move Attribs";
this.chkAttribs.UseVisualStyleBackColor = true;
this.chkAttribs.Visible = false;
this.chkAttribs.CheckedChanged += new System.EventHandler(this.chkAttribs_CheckedChanged);
//
// chkNewArea
//
this.chkNewArea.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chkNewArea.AutoSize = true;
this.chkNewArea.Location = new System.Drawing.Point(395, 21);
this.chkNewArea.Location = new System.Drawing.Point(388, 21);
this.chkNewArea.Name = "chkNewArea";
this.chkNewArea.Size = new System.Drawing.Size(64, 17);
this.chkNewArea.TabIndex = 41;
@ -439,7 +442,7 @@
//
this.chkMvToDisp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chkMvToDisp.AutoSize = true;
this.chkMvToDisp.Location = new System.Drawing.Point(219, 38);
this.chkMvToDisp.Location = new System.Drawing.Point(212, 38);
this.chkMvToDisp.Name = "chkMvToDisp";
this.chkMvToDisp.Size = new System.Drawing.Size(71, 17);
this.chkMvToDisp.TabIndex = 40;
@ -451,7 +454,7 @@
//
this.chkPerform.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chkPerform.AutoSize = true;
this.chkPerform.Location = new System.Drawing.Point(219, 21);
this.chkPerform.Location = new System.Drawing.Point(212, 21);
this.chkPerform.Name = "chkPerform";
this.chkPerform.Size = new System.Drawing.Size(62, 17);
this.chkPerform.TabIndex = 39;
@ -464,7 +467,7 @@
this.chkDisplays.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.chkDisplays.AutoSize = true;
this.chkDisplays.Enabled = false;
this.chkDisplays.Location = new System.Drawing.Point(396, 38);
this.chkDisplays.Location = new System.Drawing.Point(389, 38);
this.chkDisplays.Name = "chkDisplays";
this.chkDisplays.Size = new System.Drawing.Size(71, 17);
this.chkDisplays.TabIndex = 38;
@ -476,7 +479,7 @@
//
this.btnMoveFrom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnMoveFrom.Enabled = false;
this.btnMoveFrom.Location = new System.Drawing.Point(297, 26);
this.btnMoveFrom.Location = new System.Drawing.Point(290, 26);
this.btnMoveFrom.Name = "btnMoveFrom";
this.btnMoveFrom.Size = new System.Drawing.Size(92, 23);
this.btnMoveFrom.TabIndex = 37;
@ -488,7 +491,7 @@
//
this.btnMoves.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnMoves.Enabled = false;
this.btnMoves.Location = new System.Drawing.Point(120, 26);
this.btnMoves.Location = new System.Drawing.Point(113, 26);
this.btnMoves.Margin = new System.Windows.Forms.Padding(2);
this.btnMoves.Name = "btnMoves";
this.btnMoves.Size = new System.Drawing.Size(93, 23);
@ -501,7 +504,7 @@
//
this.btnGenICode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnGenICode.Enabled = false;
this.btnGenICode.Location = new System.Drawing.Point(35, 26);
this.btnGenICode.Location = new System.Drawing.Point(28, 26);
this.btnGenICode.Margin = new System.Windows.Forms.Padding(2);
this.btnGenICode.Name = "btnGenICode";
this.btnGenICode.Size = new System.Drawing.Size(81, 23);
@ -519,9 +522,9 @@
this.grpSettings.Controls.Add(this.btnSettings);
this.grpSettings.Controls.Add(this.btnTestThings);
this.grpSettings.Controls.Add(this.btnCrossref);
this.grpSettings.Location = new System.Drawing.Point(21, 545);
this.grpSettings.Location = new System.Drawing.Point(21, 583);
this.grpSettings.Name = "grpSettings";
this.grpSettings.Size = new System.Drawing.Size(379, 77);
this.grpSettings.Size = new System.Drawing.Size(379, 99);
this.grpSettings.TabIndex = 39;
this.grpSettings.TabStop = false;
this.grpSettings.Text = "Ställ in, testa";
@ -529,7 +532,7 @@
// btnSaveArea
//
this.btnSaveArea.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnSaveArea.Location = new System.Drawing.Point(255, 12);
this.btnSaveArea.Location = new System.Drawing.Point(255, 26);
this.btnSaveArea.Name = "btnSaveArea";
this.btnSaveArea.Size = new System.Drawing.Size(99, 23);
this.btnSaveArea.TabIndex = 40;
@ -539,7 +542,7 @@
//
// btnShowWorkFiles
//
this.btnShowWorkFiles.Location = new System.Drawing.Point(255, 41);
this.btnShowWorkFiles.Location = new System.Drawing.Point(255, 63);
this.btnShowWorkFiles.Name = "btnShowWorkFiles";
this.btnShowWorkFiles.Size = new System.Drawing.Size(99, 23);
this.btnShowWorkFiles.TabIndex = 41;
@ -547,11 +550,21 @@
this.btnShowWorkFiles.UseVisualStyleBackColor = true;
this.btnShowWorkFiles.Click += new System.EventHandler(this.btnShowWorkFiles_Click);
//
// btnXmlKopAttr
//
this.btnXmlKopAttr.Location = new System.Drawing.Point(290, 71);
this.btnXmlKopAttr.Name = "btnXmlKopAttr";
this.btnXmlKopAttr.Size = new System.Drawing.Size(92, 22);
this.btnXmlKopAttr.TabIndex = 44;
this.btnXmlKopAttr.Text = "Kop XML+Attr";
this.btnXmlKopAttr.UseVisualStyleBackColor = true;
this.btnXmlKopAttr.Click += new System.EventHandler(this.btnXmlKopAttr_Click);
//
// GenCobCode
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(963, 659);
this.ClientSize = new System.Drawing.Size(963, 719);
this.Controls.Add(this.grpSettings);
this.Controls.Add(this.grpProduce);
this.Controls.Add(this.btnRerun);
@ -637,6 +650,7 @@
private System.Windows.Forms.GroupBox grpSettings;
private System.Windows.Forms.Button btnSaveArea;
private System.Windows.Forms.Button btnShowWorkFiles;
private System.Windows.Forms.Button btnXmlKopAttr;
}
}

View File

@ -2197,10 +2197,10 @@ namespace CobXmlSupport
}
private void createXMLMoveCode(savedFile SF, bool justOut = false)
private void createXMLMoveCode(savedFile SF, bool justOut = false, bool inclAttribs = false)
{
bool loopTyp = false;
string SectionNames="",BoolVars="";
string SectionNames = "", BoolVars = "";
qualifieldhlp locTmpQfh = null;
Stack<string> indexStack = new Stack<string>();
@ -2247,7 +2247,9 @@ namespace CobXmlSupport
fromToMoves.CodeShower.Text += "\r\n";
}
if (!tmpQfh.qualCobRow.isAttribute && !tmpQfh.qualCobRow.SampleStr.Equals(NOMOVE))
// inclAttribs)
//if (!tmpQfh.qualCobRow.isAttribute && !tmpQfh.qualCobRow.SampleStr.Equals(NOMOVE))
if (bringAttrs(tmpQfh,inclAttribs))
{
//IndStatus-object takes care of optionally occuring indexes
@ -2257,7 +2259,7 @@ namespace CobXmlSupport
for (int i = 0; i < indSt.Returns; i++)
{
string xtIndex = indexStack.Pop();
string chosenKey = testIndexes.FirstOrDefault(x => x.Value == xtIndex ).Key; // indexes = <FieldName , FieldIndex> search FieldName from present FieldIndex
string chosenKey = testIndexes.FirstOrDefault(x => x.Value == xtIndex).Key; // indexes = <FieldName , FieldIndex> search FieldName from present FieldIndex
locTmpQfh = qldList.First(x => x.qualCobRow.FieldName == chosenKey); // Find QualifiedHelp-object for right field
fromToMoves.CodeShower.Text += " PERFORM " + createAftReferenceSections(locTmpQfh.qualCobRow.TagName, "LAST-in-",
@ -2379,10 +2381,18 @@ namespace CobXmlSupport
}
private bool bringAttrs(qualifieldhlp qfh, bool yes)
{
if (yes)
return (!qfh.qualCobRow.SampleStr.Equals(NOMOVE));
else
return (!qfh.qualCobRow.isAttribute && !qfh.qualCobRow.SampleStr.Equals(NOMOVE));
}
private string createAftReferenceSections(string tagName, string procPrefix, string indexVar, ref string wrkSectStr)
{
string tmpProcName = procPrefix + tagName.Replace("\"", "").Replace(":", "")+"-x";
if (!wrkSectStr.Contains(tmpProcName+"-x"))
string tmpProcName = procPrefix + tagName.Replace("\"", "").Replace(":", "") + "-x";
if (!wrkSectStr.Contains(tmpProcName + "-x"))
{
wrkSectStr += "\r\n *>------------------- HANDLE SECTION --------------*" + tmpProcName;
wrkSectStr += "\r\n * Den här sektionen används för att positionera ";
@ -2562,5 +2572,20 @@ namespace CobXmlSupport
cwi.ShowDialog();
}
private void chkAttribs_CheckedChanged(object sender, EventArgs e)
{
}
private void btnXmlKopAttr_Click(object sender, EventArgs e)
{
// kopiera xml inclusive Attribut
savedFile SF = new savedFile();
SF.idConnect = "598A5F20-9A8A-415D-81B2-BBFE04465381";
SF.usageName = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Transfer";
SF.fNameSaved = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Transfer.cbl";
createXMLMoveCode(SF, inclAttribs: true);
}
}
}