Skip to content

Commit

Permalink
- improved per-monitor DPI scaling (i.e. moving the window from a Ful…
Browse files Browse the repository at this point in the history
…l-HD to a 4K display with 100% and 200% scale)

- improved "column auto width" (right clicking a column header) by forcing line breaks in the column captions
- Philips: improved and re-enabled favorite list editing for FLASH\_\*/\*.db lists
- Panasonic: fixed display of symbol ra
  • Loading branch information
Horst Beham committed Sep 23, 2021
1 parent 063ed16 commit 4df90ca
Show file tree
Hide file tree
Showing 21 changed files with 2,499 additions and 3,556 deletions.
44 changes: 32 additions & 12 deletions source/ChanSort.Loader.Panasonic/DbChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ internal DbChannel(IDataReader r, IDictionary<string, int> field, DataRoot dataR
this.SignalSource |= SignalSource.SatIP;

byte[] buffer = new byte[1000];
int len = 0;
if (!r.IsDBNull(field["delivery"]))
{
var len = r.GetBytes(field["delivery"], 0, buffer, 0, 1000);
len = (int)r.GetBytes(field["delivery"], 0, buffer, 0, 1000);
this.AddDebug(buffer, 0, (int) len);
}

Expand All @@ -55,7 +56,7 @@ internal DbChannel(IDataReader r, IDictionary<string, int> field, DataRoot dataR
if (ntype == 10 || ntype == 14)
this.ReadAnalogData(r, field);
else
this.ReadDvbData(r, field, dataRoot, buffer);
this.ReadDvbData(r, field, dataRoot, buffer, len);
}

#endregion
Expand Down Expand Up @@ -84,7 +85,7 @@ private void ReadAnalogData(IDataReader r, IDictionary<string, int> field)
#endregion

#region ReadDvbData()
protected void ReadDvbData(IDataReader r, IDictionary<string, int> field, DataRoot dataRoot, byte[] delivery)
protected void ReadDvbData(IDataReader r, IDictionary<string, int> field, DataRoot dataRoot, byte[] delivery, int deliveryLength)
{
int stype = r.GetInt32(field["stype"]);
this.SignalSource |= LookupData.Instance.IsRadioTvOrData(stype);
Expand All @@ -96,18 +97,37 @@ protected void ReadDvbData(IDataReader r, IDictionary<string, int> field, DataRo
// ReSharper disable PossibleLossOfFraction
this.FreqInMhz = freq/10;
// ReSharper restore PossibleLossOfFraction
int satId = r.GetInt32(field["physical_ch"]) >> 12;
var sat = dataRoot.Satellites.TryGet(satId);
if (sat != null)

if (deliveryLength == 17) // files of this version also include an additional "cicam_identifier" column
{
this.Satellite = sat.Name;
this.SatPosition = sat.OrbitalPosition;
// 50 94 14 01 90 99 21 00 22 31 92 01 00 00 00 00 00
this.SymbolRate = (delivery[6] >> 4) * 10000 + (delivery[6] & 0x0F) * 1000 +
(delivery[5] >> 4) * 100 + (delivery[5] & 0x0F) * 10;
this.SatPosition = ((decimal)((delivery[11] >> 4) * 1000 + (delivery[11] & 0x0F) * 100 +
(delivery[10] >> 4) * 10 + (delivery[10] & 0x0F)) / 10).ToString("n1"); // 92 01 => 19.2
this.Satellite = this.SatPosition;
}
if (delivery.Length >= 7)
else if (deliveryLength == 15)
{
this.SymbolRate = (delivery[5] >> 4)*10000 + (delivery[5] & 0x0F)*1000 +
(delivery[6] >> 4)*100 + (delivery[6] & 0x0F)*10;
// 01 14 92 99 00 21 99 90 02 31 01 92 00 00 00
this.SymbolRate = (delivery[5] >> 4) * 10000 + (delivery[5] & 0x0F) * 1000 +
(delivery[6] >> 4) * 100 + (delivery[6] & 0x0F) * 10;
this.SatPosition = ((decimal)((delivery[10] >> 4) * 1000 + (delivery[10] & 0x0F) * 100 + (delivery[11] >> 4) * 10 +
(delivery[11] & 0x0F)) / 10).ToString("n1"); // 01 92 => 19.2
this.Satellite = this.SatPosition;
}
else
{
int satId = r.GetInt32(field["physical_ch"]) >> 12;
var sat = dataRoot.Satellites.TryGet(satId);
if (sat != null)
{
this.Satellite = sat.Name;
this.SatPosition = sat.OrbitalPosition;
}
}

this.Source = "DVB-S";
}
else
{
Expand All @@ -116,7 +136,7 @@ protected void ReadDvbData(IDataReader r, IDictionary<string, int> field, DataRo
this.ChannelOrTransponder = (this.SignalSource & SignalSource.Antenna) != 0 ?
LookupData.Instance.GetDvbtTransponder(freq).ToString() :
LookupData.Instance.GetDvbcTransponder(freq).ToString();
this.Satellite = (this.SignalSource & SignalSource.Antenna) != 0 ? "DVB-T" : "DVB-C";
this.Source = (this.SignalSource & SignalSource.Antenna) != 0 ? "DVB-T" : "DVB-C";
}

this.OriginalNetworkId = r.GetInt32(field["onid"]);
Expand Down
18 changes: 15 additions & 3 deletions source/ChanSort.Loader.Philips/ChanSort.Loader.Philips.ini
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,15 @@ channelBlockSize=0x3C

[mgr.db_entry:472]
offProgNr=0
offFav=16
offFav=16,436
offName=20
lenName=200
offProvider=224
lenProvider=200
offFavFlags1=428
maskFavFlags1=0x01
offFavFlags2=430
maskFavFlags2=0x08
offFreq=440
offOldProgNr=448
offRecordIndex=456
Expand All @@ -76,9 +80,13 @@ offOnid=466

[mgr.db_entry:476]
offProgNr=0
offFav=16
offFav=16,436
offName=20
lenName=200
offFavFlags1=428
maskFavFlags1=0x01
offFavFlags2=430
maskFavFlags2=0x08
offFreq=444,468
offSymbolRate=450
offOldProgNr=452
Expand All @@ -89,9 +97,13 @@ offOnid=466

[mgr.db_entry:480]
offProgNr=0
offFav=16
offFav=16,436
offName=20
lenName=200
offFavFlags1=428
maskFavFlags1=0x01
offFavFlags2=430
maskFavFlags2=0x08
offFreq=444,468
offSymbolRate=450
offOldProgNr=452
Expand Down
14 changes: 11 additions & 3 deletions source/ChanSort.Loader.Philips/DbSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class DbSerializer : SerializerBase
#region ctor()
public DbSerializer(string inputFile) : base(inputFile)
{
this.Features.MaxFavoriteLists = 0; //1;
this.Features.FavoritesMode = FavoritesMode.None; // FavoritesMode.OrderedPerSource; // doesn't work yet, must be hidden somewhere inside the FLASH files too
this.Features.MaxFavoriteLists = 1;
this.Features.FavoritesMode = FavoritesMode.OrderedPerSource; // doesn't work yet, must be hidden somewhere inside the FLASH files too
this.Features.DeleteMode = DeleteMode.NotSupported;
this.Features.CanHaveGaps = true; // the mgr_chan_s_pkg can have gaps

Expand Down Expand Up @@ -237,6 +237,10 @@ private void LoadDvb(string path, string sectionName, ChannelList list, ref int
ch.TransportStreamId = mapping.GetWord("offTsid");
ch.OriginalNetworkId = mapping.GetWord("offOnid");
ch.ServiceId = mapping.GetWord("offSid");

ch.AddDebug(mapping.GetByte("offFavFlags1"));
ch.AddDebug(mapping.GetByte("offFavFlags2"));

this.DataRoot.AddChannel(list, ch);
}

Expand Down Expand Up @@ -406,6 +410,7 @@ private void ReadChannelsFromFlashChannelBlock(string filename, ChannelList chan

var ch = (Channel)channelList.Channels[idMapping.ChannelIndex];
ch.FlashFileOffset = mapping.BaseOffset;
ch.AddDebug($"{ch.FlashFileOffset:x5}:{block}.{i:d3}");
var hasDiff = false;
var sid = mapping.GetWord("sid");
var progNr = (mapping.GetWord("progNr") & 0x3FFF);
Expand Down Expand Up @@ -513,11 +518,14 @@ private void SaveDvb(string file, string secName, ChannelList list, int channelR
continue;
var newOff = lenHeader + newIndex * lenEntry;
Array.Copy(oldData, lenHeader + (int)ch.RecordIndex * lenEntry, newData, newOff, lenEntry);
var favPos = Math.Max(0, ch.GetPosition(1));
mapping.SetDataPtr(newData, newOff);
mapping.SetWord("offProgNr", ch.NewProgramNr);
mapping.SetWord("offFav", Math.Max(0, ch.GetPosition(1)));
mapping.SetWord("offFav", favPos);
mapping.SetWord("offOldProgNr", ch.NewProgramNr);
mapping.SetWord("offRecordIndex", newIndex);
mapping.SetFlag("FavFlags1", favPos > 0);
mapping.SetFlag("FavFlags2", favPos > 0);
//ch.RecordIndex = newIndex; // will be updated when saving the FLASH file
++newIndex;
}
Expand Down
16 changes: 9 additions & 7 deletions source/ChanSort/ActionBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,17 @@ public void AddAction(string text, int result, Image image = null, bool isDefaul

private void AddAction(string text, object result, Image image = null, bool isDefault = false)
{
int width = this.ClientSize.Width-20;
int scaled20 = this.ScaleHelper.ScaleHorizontal(20);
int width = this.ClientSize.Width - scaled20;
var button = new SimpleButton();
button.Text = text;
button.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
button.Image = image;
button.Width = width;
button.Left = 10;
button.Height = ButtonHeight;
button.Left = scaled20 / 2;
button.Height = this.ScaleHelper.ScaleVertical(ButtonHeight);
button.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
button.Padding = new Padding(20,button.Padding.Top, 20, button.Padding.Bottom);
button.Padding = new Padding(scaled20, button.Padding.Top, scaled20, button.Padding.Bottom);
button.Tag = result;
button.Click += button_Click;

Expand Down Expand Up @@ -93,17 +94,18 @@ private void AddAction(string text, object result, Image image = null, bool isDe
protected override void OnCreateControl()
{
base.OnCreateControl();
int top = this.lblMessage.Bottom + 20;
int top = this.lblMessage.Bottom + this.ScaleHelper.ScaleVertical(20);
var spacing = this.ScaleHelper.ScaleVertical(ButtonSpacing);
foreach (Control c in this.Controls)
{
var button = c as SimpleButton;
if (button != null)
{
button.Top = top;
top += button.Height + ButtonSpacing;
top += button.Height + spacing;
}
}
this.ClientSize = new Size(this.ClientSize.Width, top + 10);
this.ClientSize = new Size(this.ClientSize.Width, top + this.ScaleHelper.ScaleVertical(10));
this.ActiveControl = this.lblMessage;
}
#endregion
Expand Down
Loading

0 comments on commit 4df90ca

Please sign in to comment.