Changeset 3 for trunk


Ignore:
Timestamp:
Apr 7, 2026, 10:43:55 AM (3 weeks ago)
Author:
chronos
Message:
  • Added: Third selectable EAN on chart tab.
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ean.pas

    r1 r3  
    4444  TEans = class(TObjectList<TEan>)
    4545    function SearchByNumber(Number: string): TEan;
    46     procedure LoadToStrings(Strings: TStrings);
     46    procedure LoadToStrings(Strings: TStrings; AllowNone: Boolean = False);
    4747  end;
    4848
     
    142142end;
    143143
    144 procedure TEans.LoadToStrings(Strings: TStrings);
     144procedure TEans.LoadToStrings(Strings: TStrings; AllowNone: Boolean = False);
    145145var
    146146  I: Integer;
     147  Shift: Integer;
    147148begin
     149  if AllowNone then Shift := 1 else Shift := 0;
    148150  Strings.BeginUpdate;
    149151  try
    150     while Strings.Count > Count do Strings.Delete(Strings.Count - 1);
    151     while Strings.Count < Count do Strings.Add('');
     152    while Strings.Count > Count + Shift do Strings.Delete(Strings.Count - 1);
     153    while Strings.Count < Count + Shift do Strings.Add('');
    152154    for I := 0 to Count - 1 do begin
    153       Strings[I] := Items[I].Number + ' (' + Items[I].Owner + ')';
    154       Strings.Objects[I] := Items[I];
     155      Strings[I + Shift] := Items[I].Number + ' (' + Items[I].Owner + ')';
     156      Strings.Objects[I + Shift] := Items[I];
    155157    end;
    156158  finally
  • trunk/FormMain.lfm

    r2 r3  
    2727    Top = 64
    2828    Width = 1176
    29     ActivePage = TabSheetOverview
     29    ActivePage = TabSheetChart
    3030    Anchors = [akTop, akLeft, akRight, akBottom]
    31     TabIndex = 0
     31    TabIndex = 2
    3232    TabOrder = 1
    3333    object TabSheetOverview: TTabSheet
     
    9595      OnShow = TabSheetChartShow
    9696      object ComboBoxEan: TComboBox
    97         Left = 120
     97        Left = 88
    9898        Height = 42
    9999        Top = 24
     
    108108        Height = 26
    109109        Top = 32
    110         Width = 41
    111         Caption = 'EAN:'
     110        Width = 56
     111        Caption = 'EAN 1:'
    112112      end
    113113      object Chart1: TChart
     
    135135        object Chart1LineSeries1: TLineSeries
    136136          LinePen.Color = clYellow
    137           LinePen.Width = 2
     137          LinePen.Width = 3
    138138        end
    139139        object Chart1LineSeries2: TLineSeries
    140140          LinePen.Color = clFuchsia
    141           LinePen.Width = 2
     141          LinePen.Width = 3
    142142        end
     143        object Chart1LineSeries3: TLineSeries
     144          LinePen.Color = clAqua
     145          LinePen.Width = 3
     146        end
    143147      end
    144148      object Label3: TLabel
    145         Left = 600
     149        Left = 544
    146150        Height = 26
    147151        Top = 32
     
    150154      end
    151155      object ComboBoxEan2: TComboBox
    152         Left = 680
     156        Left = 608
    153157        Height = 42
    154158        Top = 24
     
    157161        Style = csDropDownList
    158162        TabOrder = 2
     163        OnSelect = ComboBoxEanSelect
     164      end
     165      object Label6: TLabel
     166        Left = 1048
     167        Height = 26
     168        Top = 32
     169        Width = 56
     170        Caption = 'EAN 3:'
     171      end
     172      object ComboBoxEan3: TComboBox
     173        Left = 1112
     174        Height = 42
     175        Top = 24
     176        Width = 432
     177        ItemHeight = 0
     178        Style = csDropDownList
     179        TabOrder = 3
    159180        OnSelect = ComboBoxEanSelect
    160181      end
     
    303324    POFilesFolder = 'Languages'
    304325    OnTranslate = Translator1Translate
    305     Left = 901
    306     Top = 130
     326    Left = 776
     327    Top = 408
    307328  end
    308329  object ApplicationInfo1: TApplicationInfo
     
    318339    RegistryRoot = rrKeyCurrentUser
    319340    License = 'CC0'
    320     Left = 1037
    321     Top = 125
     341    Left = 936
     342    Top = 408
    322343  end
    323344  object PersistentForm1: TPersistentForm
    324345    MinVisiblePart = 50
    325346    EntireVisible = False
    326     Left = 776
    327     Top = 136
     347    Left = 584
     348    Top = 416
    328349  end
    329350  object ThemeManager1: TThemeManager
    330     Left = 657
    331     Top = 140
     351    Left = 408
     352    Top = 416
    332353  end
    333354end
  • trunk/FormMain.lrj

    r2 r3  
    1111{"hash":21335,"name":"tformmain.tabsheetlog.caption","sourcebytes":[76,111,103],"value":"Log"},
    1212{"hash":4843668,"name":"tformmain.tabsheetchart.caption","sourcebytes":[67,104,97,114,116],"value":"Chart"},
    13 {"hash":300570,"name":"tformmain.label1.caption","sourcebytes":[69,65,78,58],"value":"EAN:"},
     13{"hash":76940106,"name":"tformmain.label1.caption","sourcebytes":[69,65,78,32,49,58],"value":"EAN 1:"},
    1414{"hash":76940122,"name":"tformmain.label3.caption","sourcebytes":[69,65,78,32,50,58],"value":"EAN 2:"},
     15{"hash":76940138,"name":"tformmain.label6.caption","sourcebytes":[69,65,78,32,51,58],"value":"EAN 3:"},
    1516{"hash":305313,"name":"tformmain.tabsheetdata.caption","sourcebytes":[68,97,116,97],"value":"Data"},
    1617{"hash":372789,"name":"tformmain.listview2.columns[0].caption","sourcebytes":[84,105,109,101],"value":"Time"},
  • trunk/FormMain.pas

    r2 r3  
    2424    Chart1LineSeries1: TLineSeries;
    2525    Chart1LineSeries2: TLineSeries;
     26    Chart1LineSeries3: TLineSeries;
    2627    ComboBoxEan: TComboBox;
     28    ComboBoxEan3: TComboBox;
    2729    ComboBoxEanData: TComboBox;
    2830    ComboBoxEan2: TComboBox;
     
    3537    Label4: TLabel;
    3638    Label5: TLabel;
     39    Label6: TLabel;
    3740    ListView1: TListView;
    3841    ListView2: TListView;
     
    138141  CreateEan('', STotalConsumtion, ekConsumption);
    139142
    140   IntervalTo := Eans[0].Values.Last.Time;
     143  IntervalTo := Eans[0].Values.Last.Time + 15 * OneMinute;
    141144  UpdateInterval;
    142145  ShowActiveTab;
     
    181184procedure TFormMain.FormCreate(Sender: TObject);
    182185begin
     186  PageControl1.TabIndex := 0;
    183187  Eans := TEans.Create;
    184188  LoadConfig;
     
    193197procedure TFormMain.FormShow(Sender: TObject);
    194198begin
    195   PageControl1.TabIndex := 0;
    196199  ButtonLoadClick(nil);
    197200end;
     
    204207procedure TFormMain.TabSheetChartShow(Sender: TObject);
    205208begin
    206   Eans.LoadToStrings(ComboBoxEan.Items);
    207   if (ComboBoxEan.Items.Count > 0) and (ComboBoxEan.ItemIndex = -1) then ComboBoxEan.ItemIndex := 0;
    208   Eans.LoadToStrings(ComboBoxEan2.Items);
     209  Eans.LoadToStrings(ComboBoxEan.Items, True);
     210  if (ComboBoxEan.Items.Count > 1) and (ComboBoxEan.ItemIndex = -1) then ComboBoxEan.ItemIndex := 1;
     211  Eans.LoadToStrings(ComboBoxEan2.Items, True);
     212  Eans.LoadToStrings(ComboBoxEan3.Items, True);
    209213  ReloadChart;
    210214end;
     
    463467    end;
    464468  end;
     469
     470  Chart1LineSeries3.Clear;
     471  if ComboBoxEan3.ItemIndex <> -1 then begin
     472    Ean := TEan(ComboBoxEan3.Items.Objects[ComboBoxEan3.ItemIndex]);
     473    if not Assigned(Ean) then Exit;
     474    with Ean do begin
     475      for I := 0 to Values.Count - 1 do
     476        if (Values[I].Time >= IntervalFrom) and (Values[I].Time < IntervalTo) then
     477        Chart1LineSeries3.AddXY(Values[I].Time, MeasureToFloat(Values[I].ValueIn, 1 / 4));
     478    end;
     479  end;
    465480end;
    466481
     
    522537    ReportsDir := ReadStringWithDefault('ReportsDir', ReportsDir);
    523538    OwnersFileName := ReadStringWithDefault('OwnersFileName', OwnersFileName);
     539    PageControl1.TabIndex := ReadIntegerWithDefault('ActiveTab', PageControl1.TabIndex);
    524540  finally
    525541    Free;
     
    542558    WriteString('ReportsDir', ReportsDir);
    543559    WriteString('OwnersFileName', OwnersFileName);
     560    WriteInteger('ActiveTab', PageControl1.TabIndex);
    544561  finally
    545562    Free;
  • trunk/Languages/EdcStats.cs.po

    r2 r3  
    7474#: tformmain.label1.caption
    7575msgctxt "tformmain.label1.caption"
    76 msgid "EAN:"
    77 msgstr "EAN:"
     76msgid "EAN 1:"
     77msgstr "EAN 1:"
    7878
    7979#: tformmain.label2.caption
     
    9393msgid "Unit:"
    9494msgstr "Jednotky:"
     95
     96#: tformmain.label6.caption
     97msgid "EAN 3:"
     98msgstr "EAN 3:"
    9599
    96100#: tformmain.listview1.columns[0].caption
  • trunk/Languages/EdcStats.pot

    r2 r3  
    6464#: tformmain.label1.caption
    6565msgctxt "tformmain.label1.caption"
    66 msgid "EAN:"
     66msgid "EAN 1:"
    6767msgstr ""
    6868
     
    8282#: tformmain.label5.caption
    8383msgid "Unit:"
     84msgstr ""
     85
     86#: tformmain.label6.caption
     87msgid "EAN 3:"
    8488msgstr ""
    8589
Note: See TracChangeset for help on using the changeset viewer.