1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
namespace Tango.BuildExtensions
{
partial class BuildForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.btnCancel = new System.Windows.Forms.Button();
this.btnOK = new System.Windows.Forms.Button();
this.chkBuildSolution = new System.Windows.Forms.CheckBox();
this.chkUpdateAndBuildPMR = new System.Windows.Forms.CheckBox();
this.chkGeneratePMR = new System.Windows.Forms.CheckBox();
this.chkGenerateObservables = new System.Windows.Forms.CheckBox();
this.chkUpdateDatabase = new System.Windows.Forms.CheckBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.chkSQLite = new System.Windows.Forms.CheckBox();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// panel1
//
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Controls.Add(this.chkSQLite);
this.panel1.Controls.Add(this.btnCancel);
this.panel1.Controls.Add(this.btnOK);
this.panel1.Controls.Add(this.chkBuildSolution);
this.panel1.Controls.Add(this.chkUpdateAndBuildPMR);
this.panel1.Controls.Add(this.chkGeneratePMR);
this.panel1.Controls.Add(this.chkGenerateObservables);
this.panel1.Controls.Add(this.chkUpdateDatabase);
this.panel1.Controls.Add(this.pictureBox1);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.label1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(596, 327);
this.panel1.TabIndex = 2;
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Arrow;
this.btnCancel.FlatAppearance.BorderSize = 0;
this.btnCancel.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15)))));
this.btnCancel.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCancel.Location = new System.Drawing.Point(349, 272);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(114, 42);
this.btnCancel.TabIndex = 11;
this.btnCancel.Text = "CANCEL";
this.btnCancel.UseVisualStyleBackColor = false;
//
// btnOK
//
this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnOK.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.btnOK.Cursor = System.Windows.Forms.Cursors.Arrow;
this.btnOK.FlatAppearance.BorderSize = 0;
this.btnOK.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15)))));
this.btnOK.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
this.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnOK.Location = new System.Drawing.Point(469, 272);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(114, 42);
this.btnOK.TabIndex = 10;
this.btnOK.Text = "START";
this.btnOK.UseVisualStyleBackColor = false;
//
// chkBuildSolution
//
this.chkBuildSolution.AutoSize = true;
this.chkBuildSolution.Cursor = System.Windows.Forms.Cursors.Arrow;
this.chkBuildSolution.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.chkBuildSolution.Location = new System.Drawing.Point(27, 222);
this.chkBuildSolution.Name = "chkBuildSolution";
this.chkBuildSolution.Size = new System.Drawing.Size(111, 20);
this.chkBuildSolution.TabIndex = 9;
this.chkBuildSolution.Text = "Build Solution.";
this.chkBuildSolution.UseVisualStyleBackColor = true;
//
// chkUpdateAndBuildPMR
//
this.chkUpdateAndBuildPMR.AutoSize = true;
this.chkUpdateAndBuildPMR.Cursor = System.Windows.Forms.Cursors.Arrow;
this.chkUpdateAndBuildPMR.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.chkUpdateAndBuildPMR.Location = new System.Drawing.Point(27, 170);
this.chkUpdateAndBuildPMR.Name = "chkUpdateAndBuildPMR";
this.chkUpdateAndBuildPMR.Size = new System.Drawing.Size(233, 20);
this.chkUpdateAndBuildPMR.TabIndex = 8;
this.chkUpdateAndBuildPMR.Text = "Update and build PMR messages.";
this.chkUpdateAndBuildPMR.UseVisualStyleBackColor = true;
//
// chkGeneratePMR
//
this.chkGeneratePMR.AutoSize = true;
this.chkGeneratePMR.Cursor = System.Windows.Forms.Cursors.Arrow;
this.chkGeneratePMR.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.chkGeneratePMR.Location = new System.Drawing.Point(27, 144);
this.chkGeneratePMR.Name = "chkGeneratePMR";
this.chkGeneratePMR.Size = new System.Drawing.Size(215, 20);
this.chkGeneratePMR.TabIndex = 7;
this.chkGeneratePMR.Text = "Generate auto PMR messages.";
this.chkGeneratePMR.UseVisualStyleBackColor = true;
//
// chkGenerateObservables
//
this.chkGenerateObservables.AutoSize = true;
this.chkGenerateObservables.Cursor = System.Windows.Forms.Cursors.Arrow;
this.chkGenerateObservables.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.chkGenerateObservables.Location = new System.Drawing.Point(27, 118);
this.chkGenerateObservables.Name = "chkGenerateObservables";
this.chkGenerateObservables.Size = new System.Drawing.Size(223, 20);
this.chkGenerateObservables.TabIndex = 6;
this.chkGenerateObservables.Text = "Generate and build observables.";
this.chkGenerateObservables.UseVisualStyleBackColor = true;
//
// chkUpdateDatabase
//
this.chkUpdateDatabase.AutoSize = true;
this.chkUpdateDatabase.Cursor = System.Windows.Forms.Cursors.Arrow;
this.chkUpdateDatabase.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.chkUpdateDatabase.Location = new System.Drawing.Point(27, 92);
this.chkUpdateDatabase.Name = "chkUpdateDatabase";
this.chkUpdateDatabase.Size = new System.Drawing.Size(181, 20);
this.chkUpdateDatabase.TabIndex = 5;
this.chkUpdateDatabase.Text = "Update database entities.";
this.chkUpdateDatabase.UseVisualStyleBackColor = true;
//
// pictureBox1
//
this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Arrow;
this.pictureBox1.Image = global::Tango.BuildExtensions.Properties.Resources.machine_trans_small;
this.pictureBox1.Location = new System.Drawing.Point(499, 47);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(63, 68);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox1.TabIndex = 4;
this.pictureBox1.TabStop = false;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Cursor = System.Windows.Forms.Cursors.Arrow;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(24, 47);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(266, 16);
this.label2.TabIndex = 1;
this.label2.Text = "Select the components you want to initialize.";
//
// label1
//
this.label1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40)))));
this.label1.Cursor = System.Windows.Forms.Cursors.Arrow;
this.label1.Dock = System.Windows.Forms.DockStyle.Top;
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Margin = new System.Windows.Forms.Padding(0);
this.label1.Name = "label1";
this.label1.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0);
this.label1.Size = new System.Drawing.Size(594, 29);
this.label1.TabIndex = 0;
this.label1.Text = "Tango Build Engine";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// chkSQLite
//
this.chkSQLite.AutoSize = true;
this.chkSQLite.Cursor = System.Windows.Forms.Cursors.Arrow;
this.chkSQLite.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.chkSQLite.Location = new System.Drawing.Point(27, 196);
this.chkSQLite.Name = "chkSQLite";
this.chkSQLite.Size = new System.Drawing.Size(252, 20);
this.chkSQLite.TabIndex = 12;
this.chkSQLite.Text = "Generate SQLite DB from SQL Server.";
this.chkSQLite.UseVisualStyleBackColor = true;
//
// BuildForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
this.ClientSize = new System.Drawing.Size(596, 327);
this.ControlBox = false;
this.Controls.Add(this.panel1);
this.ForeColor = System.Drawing.Color.Gainsboro;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "BuildForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Tango Build Engine";
this.TopMost = true;
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.CheckBox chkUpdateDatabase;
private System.Windows.Forms.CheckBox chkGenerateObservables;
private System.Windows.Forms.CheckBox chkGeneratePMR;
private System.Windows.Forms.CheckBox chkUpdateAndBuildPMR;
private System.Windows.Forms.CheckBox chkBuildSolution;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.CheckBox chkSQLite;
}
}
Pos = GetTextLineVisualXPosition(textLine, visualColumn);
double yPos = GetTextLineVisualYPosition(textLine, yPositionMode);
return new Point(xPos, yPos);
}
/// <summary>
/// Gets the distance to the left border of the text area of the specified visual column.
/// The visual column must belong to the specified text line.
/// </summary>
public double GetTextLineVisualXPosition(TextLine textLine, int visualColumn)
{
if (textLine == null)
throw new ArgumentNullException("textLine");
double xPos = textLine.GetDistanceFromCharacterHit(
new CharacterHit(Math.Min(visualColumn, VisualLengthWithEndOfLineMarker), 0));
if (visualColumn > VisualLengthWithEndOfLineMarker) {
xPos += (visualColumn - VisualLengthWithEndOfLineMarker) * textView.WideSpaceWidth;
}
return xPos;
}
/// <summary>
/// Gets the visual column from a document position (relative to top left of the document).
/// If the user clicks between two visual columns, rounds to the nearest column.
/// </summary>
public int GetVisualColumn(Point point)
{
return GetVisualColumn(point, textView.Options.EnableVirtualSpace);
}
/// <summary>
/// Gets the visual column from a document position (relative to top left of the document).
/// If the user clicks between two visual columns, rounds to the nearest column.
/// </summary>
public int GetVisualColumn(Point point, bool allowVirtualSpace)
{
return GetVisualColumn(GetTextLineByVisualYPosition(point.Y), point.X, allowVirtualSpace);
}
/// <summary>
/// Gets the visual column from a document position (relative to top left of the document).
/// If the user clicks between two visual columns, rounds to the nearest column.
/// </summary>
public int GetVisualColumn(TextLine textLine, double xPos, bool allowVirtualSpace)
{
if (xPos > textLine.WidthIncludingTrailingWhitespace) {
if (allowVirtualSpace && textLine == TextLines[TextLines.Count - 1]) {
int virtualX = (int)Math.Round((xPos - textLine.WidthIncludingTrailingWhitespace) / textView.WideSpaceWidth);
return VisualLengthWithEndOfLineMarker + virtualX;
}
}
CharacterHit ch = textLine.GetCharacterHitFromDistance(xPos);
return ch.FirstCharacterIndex + ch.TrailingLength;
}
/// <summary>
/// Validates the visual column and returns the correct one.
/// </summary>
public int ValidateVisualColumn(TextViewPosition position, bool allowVirtualSpace)
{
return ValidateVisualColumn(Document.GetOffset(position.Location), position.VisualColumn, allowVirtualSpace);
}
/// <summary>
/// Validates the visual column and returns the correct one.
/// </summary>
public int ValidateVisualColumn(int offset, int visualColumn, bool allowVirtualSpace)
{
int firstDocumentLineOffset = this.FirstDocumentLine.Offset;
if (visualColumn < 0) {
return GetVisualColumn(offset - firstDocumentLineOffset);
} else {
int offsetFromVisualColumn = GetRelativeOffset(visualColumn);
offsetFromVisualColumn += firstDocumentLineOffset;
if (offsetFromVisualColumn != offset) {
return GetVisualColumn(offset - firstDocumentLineOffset);
} else {
if (visualColumn > VisualLength && !allowVirtualSpace) {
return VisualLength;
}
}
}
return visualColumn;
}
/// <summary>
/// Gets the visual column from a document position (relative to top left of the document).
/// If the user clicks between two visual columns, returns the first of those columns.
/// </summary>
public int GetVisualColumnFloor(Point point)
{
return GetVisualColumnFloor(point, textView.Options.EnableVirtualSpace);
}
/// <summary>
/// Gets the visual column from a document position (relative to top left of the document).
/// If the user clicks between two visual columns, returns the first of those columns.
/// </summary>
public int GetVisualColumnFloor(Point point, bool allowVirtualSpace)
{
TextLine textLine = GetTextLineByVisualYPosition(point.Y);
if (point.X > textLine.WidthIncludingTrailingWhitespace) {
if (allowVirtualSpace && textLine == TextLines[TextLines.Count - 1]) {
// clicking virtual space in the last line
int virtualX = (int)((point.X - textLine.WidthIncludingTrailingWhitespace) / textView.WideSpaceWidth);
return VisualLengthWithEndOfLineMarker + virtualX;
} else {
// GetCharacterHitFromDistance returns a hit with FirstCharacterIndex=last character in line
// and TrailingLength=1 when clicking behind the line, so the floor function needs to handle this case
// specially and return the line's end column instead.
return GetTextLineVisualStartColumn(textLine) + textLine.Length;
}
}
CharacterHit ch = textLine.GetCharacterHitFromDistance(point.X);
return ch.FirstCharacterIndex;
}
/// <summary>
/// Gets whether the visual line was disposed.
/// </summary>
public bool IsDisposed {
get { return phase == LifetimePhase.Disposed; }
}
internal void Dispose()
{
if (phase == LifetimePhase.Disposed)
return;
Debug.Assert(phase == LifetimePhase.Live);
phase = LifetimePhase.Disposed;
foreach (TextLine textLine in TextLines) {
textLine.Dispose();
}
}
/// <summary>
/// Gets the next possible caret position after visualColumn, or -1 if there is no caret position.
/// </summary>
public int GetNextCaretPosition(int visualColumn, LogicalDirection direction, CaretPositioningMode mode, bool allowVirtualSpace)
{
if (!HasStopsInVirtualSpace(mode))
allowVirtualSpace = false;
if (elements.Count == 0) {
// special handling for empty visual lines:
if (allowVirtualSpace) {
if (direction == LogicalDirection.Forward)
return Math.Max(0, visualColumn + 1);
else if (visualColumn > 0)
return visualColumn - 1;
else
return -1;
} else {
// even though we don't have any elements,
// there's a single caret stop at visualColumn 0
if (visualColumn < 0 && direction == LogicalDirection.Forward)
return 0;
else if (visualColumn > 0 && direction == LogicalDirection.Backward)
return 0;
else
return -1;
}
}
int i;
if (direction == LogicalDirection.Backward) {
// Search Backwards:
// If the last element doesn't handle line borders, return the line end as caret stop
if (visualColumn > this.VisualLength && !elements[elements.Count-1].HandlesLineBorders && HasImplicitStopAtLineEnd(mode)) {
if (allowVirtualSpace)
return visualColumn - 1;
else
return this.VisualLength;
}
// skip elements that start after or at visualColumn
for (i = elements.Count - 1; i >= 0; i--) {
if (elements[i].VisualColumn < visualColumn)
break;
}
// search last element that has a caret stop
for (; i >= 0; i--) {
int pos = elements[i].GetNextCaretPosition(
Math.Min(visualColumn, elements[i].VisualColumn + elements[i].VisualLength + 1),
direction, mode);
if (pos >= 0)
return pos;
}
// If we've found nothing, and the first element doesn't handle line borders,
// return the line start as normal caret stop.
if (visualColumn > 0 && !elements[0].HandlesLineBorders && HasImplicitStopAtLineStart(mode))
return 0;
} else {
// Search Forwards:
// If the first element doesn't handle line borders, return the line start as caret stop
if (visualColumn < 0 && !elements[0].HandlesLineBorders && HasImplicitStopAtLineStart(mode))
return 0;
// skip elements that end before or at visualColumn
for (i = 0; i < elements.Count; i++) {
if (elements[i].VisualColumn + elements[i].VisualLength > visualColumn)
break;
}
// search first element that has a caret stop
for (; i < elements.Count; i++) {
int pos = elements[i].GetNextCaretPosition(
Math.Max(visualColumn, elements[i].VisualColumn - 1),
direction, mode);
if (pos >= 0)
return pos;
}
// if we've found nothing, and the last element doesn't handle line borders,
// return the line end as caret stop
if ((allowVirtualSpace || !elements[elements.Count-1].HandlesLineBorders) && HasImplicitStopAtLineEnd(mode)) {
if (visualColumn < this.VisualLength)
return this.VisualLength;
else if (allowVirtualSpace)
return visualColumn + 1;
}
}
// we've found nothing, return -1 and let the caret search continue in the next line
return -1;
}
static bool HasStopsInVirtualSpace(CaretPositioningMode mode)
{
return mode == CaretPositioningMode.Normal;
}
static bool HasImplicitStopAtLineStart(CaretPositioningMode mode)
{
return mode == CaretPositioningMode.Normal;
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "mode",
Justification = "make method consistent with HasImplicitStopAtLineStart; might depend on mode in the future")]
static bool HasImplicitStopAtLineEnd(CaretPositioningMode mode)
{
return true;
}
VisualLineDrawingVisual visual;
internal VisualLineDrawingVisual Render()
{
Debug.Assert(phase == LifetimePhase.Live);
if (visual == null)
visual = new VisualLineDrawingVisual(this);
return visual;
}
}
sealed class VisualLineDrawingVisual : DrawingVisual
{
public readonly VisualLine VisualLine;
public readonly double Height;
internal bool IsAdded;
public VisualLineDrawingVisual(VisualLine visualLine)
{
this.VisualLine = visualLine;
var drawingContext = RenderOpen();
double pos = 0;
foreach (TextLine textLine in visualLine.TextLines) {
textLine.Draw(drawingContext, new Point(0, pos), InvertAxes.None);
pos += textLine.Height;
}
this.Height = pos;
drawingContext.Close();
}
protected override GeometryHitTestResult HitTestCore(GeometryHitTestParameters hitTestParameters)
{
return null;
}
protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
{
return null;
}
}
}
|