1.1 --- a/Server/MainForm.cs Fri Oct 30 16:45:33 2015 +0100
1.2 +++ b/Server/MainForm.cs Sun Nov 22 23:46:52 2015 +0100
1.3 @@ -1580,32 +1580,35 @@
1.4 while (client.Fields.Count < (aField.Index + 1))
1.5 {
1.6 //Add a data field with proper index
1.7 - client.Fields.Add(new DataField(client.Fields.Count));
1.8 + client.Fields.Add(new TextField(client.Fields.Count));
1.9 layoutChanged = true;
1.10 }
1.11
1.12 //Now that we know our fields are in place just update that one
1.13 client.Fields[aField.Index] = aField;
1.14
1.15 +
1.16 if (client.Fields[aField.Index].IsSameLayout(aField))
1.17 {
1.18 //If we are updating a field in our current client we need to update it in our panel
1.19 if (aSessionId == iCurrentClientSessionId)
1.20 {
1.21 - if (aField.IsText && aField.Index < tableLayoutPanel.Controls.Count && tableLayoutPanel.Controls[aField.Index] is MarqueeLabel)
1.22 + if (aField.IsTextField && aField.Index < tableLayoutPanel.Controls.Count && tableLayoutPanel.Controls[aField.Index] is MarqueeLabel)
1.23 {
1.24 + TextField textField=(TextField)aField;
1.25 //Text field control already in place, just change the text
1.26 MarqueeLabel label = (MarqueeLabel)tableLayoutPanel.Controls[aField.Index];
1.27 - contentChanged = (label.Text != aField.Text || label.TextAlign != aField.Alignment);
1.28 - label.Text = aField.Text;
1.29 - label.TextAlign = aField.Alignment;
1.30 + contentChanged = (label.Text != textField.Text || label.TextAlign != textField.Alignment);
1.31 + label.Text = textField.Text;
1.32 + label.TextAlign = textField.Alignment;
1.33 }
1.34 - else if (aField.IsBitmap && aField.Index < tableLayoutPanel.Controls.Count && tableLayoutPanel.Controls[aField.Index] is PictureBox)
1.35 + else if (aField.IsBitmapField && aField.Index < tableLayoutPanel.Controls.Count && tableLayoutPanel.Controls[aField.Index] is PictureBox)
1.36 {
1.37 + BitmapField bitmapField = (BitmapField)aField;
1.38 contentChanged = true; //TODO: Bitmap comp or should we leave that to clients?
1.39 //Bitmap field control already in place just change the bitmap
1.40 PictureBox pictureBox = (PictureBox)tableLayoutPanel.Controls[aField.Index];
1.41 - pictureBox.Image = aField.Bitmap;
1.42 + pictureBox.Image = bitmapField.Bitmap;
1.43 }
1.44 else
1.45 {
1.46 @@ -1752,15 +1755,19 @@
1.47 //For each text add a new entry
1.48 foreach (DataField field in aClient.Fields)
1.49 {
1.50 - if (!field.IsBitmap)
1.51 + if (field.IsTextField)
1.52 {
1.53 - DataField textField = (DataField)field;
1.54 + TextField textField = (TextField)field;
1.55 textsRoot.Nodes.Add(new TreeNode("[Text]" + textField.Text));
1.56 }
1.57 - else
1.58 + else if (field.IsBitmapField)
1.59 {
1.60 textsRoot.Nodes.Add(new TreeNode("[Bitmap]"));
1.61 }
1.62 + else if (field.IsRecordingField)
1.63 + {
1.64 + textsRoot.Nodes.Add(new TreeNode("[Recording]"));
1.65 + }
1.66 }
1.67 }
1.68
1.69 @@ -1843,18 +1850,28 @@
1.70 if (aClient.Fields.Count <= tableLayoutPanel.Controls.Count)
1.71 {
1.72 //No client field specified, create a text field by default
1.73 - aClient.Fields.Add(new DataField(aClient.Fields.Count));
1.74 + aClient.Fields.Add(new TextField(aClient.Fields.Count));
1.75 }
1.76
1.77 + //
1.78 + DataField field = aClient.Fields[tableLayoutPanel.Controls.Count];
1.79 + if (!field.IsTableField)
1.80 + {
1.81 + //That field is not taking part in our table layout then
1.82 + //We should be ok I guess
1.83 + continue;
1.84 + }
1.85 +
1.86 + TableField tableField = (TableField)field;
1.87 +
1.88 //Create a control corresponding to the field specified for that cell
1.89 - DataField field = aClient.Fields[tableLayoutPanel.Controls.Count];
1.90 - Control control = CreateControlForDataField(field);
1.91 + Control control = CreateControlForDataField(tableField);
1.92
1.93 //Add newly created control to our table layout at the specified row and column
1.94 tableLayoutPanel.Controls.Add(control, i, j);
1.95 //Make sure we specify row and column span for that new control
1.96 - tableLayoutPanel.SetRowSpan(control,field.RowSpan);
1.97 - tableLayoutPanel.SetColumnSpan(control, field.ColumnSpan);
1.98 + tableLayoutPanel.SetRowSpan(control, tableField.RowSpan);
1.99 + tableLayoutPanel.SetColumnSpan(control, tableField.ColumnSpan);
1.100 }
1.101 }
1.102
1.103 @@ -1876,7 +1893,7 @@
1.104 private Control CreateControlForDataField(DataField aField)
1.105 {
1.106 Control control=null;
1.107 - if (!aField.IsBitmap)
1.108 + if (aField.IsTextField)
1.109 {
1.110 MarqueeLabel label = new SharpDisplayManager.MarqueeLabel();
1.111 label.AutoEllipsis = true;
1.112 @@ -1895,13 +1912,14 @@
1.113 //control.TabIndex = 2;
1.114 label.Font = cds.Font;
1.115
1.116 - label.TextAlign = aField.Alignment;
1.117 + TextField field = (TextField)aField;
1.118 + label.TextAlign = field.Alignment;
1.119 label.UseCompatibleTextRendering = true;
1.120 - label.Text = aField.Text;
1.121 + label.Text = field.Text;
1.122 //
1.123 control = label;
1.124 }
1.125 - else
1.126 + else if (aField.IsBitmapField)
1.127 {
1.128 //Create picture box
1.129 PictureBox picture = new PictureBox();
1.130 @@ -1912,10 +1930,12 @@
1.131 picture.Margin = new System.Windows.Forms.Padding(0);
1.132 picture.Name = "pictureBox" + aField;
1.133 //Set our image
1.134 - picture.Image = aField.Bitmap;
1.135 + BitmapField field = (BitmapField)aField;
1.136 + picture.Image = field.Bitmap;
1.137 //
1.138 control = picture;
1.139 }
1.140 + //TODO: Handle recording field?
1.141
1.142 return control;
1.143 }