Browse Source

bugfixes and new features

main
Stephan Richter 3 years ago
parent
commit
6b24f21147
  1. 9
      Belegscanner.lpi
  2. 87
      Belegscanner.lps
  3. BIN
      Belegscanner.res
  4. 59
      scanner.lfm
  5. 152
      scanner.pas

9
Belegscanner.lpi

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<Version Value="11"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
@ -17,9 +17,10 @@ @@ -17,9 +17,10 @@
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
<FormatVersion Value="2"/>
<Modes Count="1">
<Mode0 Name="default"/>
</Modes>
</RunParams>
<RequiredPackages Count="1">
<Item1>

87
Belegscanner.lps

@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="10"/>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="15">
<Units Count="16">
<Unit0>
<Filename Value="Belegscanner.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<CursorPos X="17" Y="10"/>
<UsageCount Value="32"/>
<UsageCount Value="36"/>
</Unit0>
<Unit1>
<Filename Value="scanner.pas"/>
@ -18,9 +18,9 @@ @@ -18,9 +18,9 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<TopLine Value="304"/>
<CursorPos X="30" Y="358"/>
<UsageCount Value="32"/>
<TopLine Value="374"/>
<CursorPos X="45" Y="377"/>
<UsageCount Value="36"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
@ -80,8 +80,8 @@ @@ -80,8 +80,8 @@
<Unit9>
<Filename Value="/usr/share/fpcsrc/3.0.4/rtl/objpas/classes/classesh.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="1834"/>
<CursorPos X="14" Y="1873"/>
<TopLine Value="647"/>
<CursorPos X="14" Y="681"/>
<UsageCount Value="10"/>
</Unit9>
<Unit10>
@ -122,128 +122,139 @@ @@ -122,128 +122,139 @@
<CursorPos X="14" Y="1696"/>
<UsageCount Value="10"/>
</Unit14>
<Unit15>
<Filename Value="/usr/lib/lazarus/2.0.6/components/lazutils/laztracer.pas"/>
<UnitName Value="LazTracer"/>
<EditorIndex Value="-1"/>
<CursorPos Y="50"/>
<UsageCount Value="10"/>
</Unit15>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="scanner.pas"/>
<Caret Line="133" Column="107" TopLine="46"/>
<Caret Line="207" Column="21" TopLine="173"/>
</Position1>
<Position2>
<Filename Value="scanner.pas"/>
<Caret Line="238" Column="49" TopLine="228"/>
<Caret Line="215" Column="22" TopLine="175"/>
</Position2>
<Position3>
<Filename Value="scanner.pas"/>
<Caret Line="153" Column="3" TopLine="151"/>
<Caret Line="207" Column="82" TopLine="175"/>
</Position3>
<Position4>
<Filename Value="scanner.pas"/>
<Caret Line="168" Column="15" TopLine="133"/>
<Caret Line="62" Column="42" TopLine="29"/>
</Position4>
<Position5>
<Filename Value="scanner.pas"/>
<Caret Line="167" Column="7" TopLine="133"/>
<Caret Line="60" Column="61" TopLine="27"/>
</Position5>
<Position6>
<Filename Value="scanner.pas"/>
<Caret Line="168" Column="11" TopLine="134"/>
<Caret Line="62" Column="42" TopLine="29"/>
</Position6>
<Position7>
<Filename Value="scanner.pas"/>
<Caret Line="196" Column="66" TopLine="189"/>
<Caret Line="432" Column="5" TopLine="364"/>
</Position7>
<Position8>
<Filename Value="scanner.pas"/>
<Caret Line="363" Column="97" TopLine="302"/>
<Caret Line="62" Column="42" TopLine="29"/>
</Position8>
<Position9>
<Filename Value="scanner.pas"/>
<Caret Line="131" Column="24" TopLine="97"/>
<Caret Line="56" Column="40" TopLine="27"/>
</Position9>
<Position10>
<Filename Value="scanner.pas"/>
<Caret Line="363" Column="97" TopLine="302"/>
<Caret Line="62" Column="32" TopLine="29"/>
</Position10>
<Position11>
<Filename Value="scanner.pas"/>
<Caret Line="131" Column="24"/>
<Caret Line="59" Column="37" TopLine="27"/>
</Position11>
<Position12>
<Filename Value="scanner.pas"/>
<Caret Line="238" Column="3" TopLine="231"/>
<Caret Line="203" Column="45" TopLine="187"/>
</Position12>
<Position13>
<Filename Value="scanner.pas"/>
<Caret Line="153" Column="3" TopLine="151"/>
<Caret Line="62" Column="39" TopLine="19"/>
</Position13>
<Position14>
<Filename Value="scanner.pas"/>
<Caret Line="168" Column="31" TopLine="161"/>
<Caret Line="208" Column="13" TopLine="174"/>
</Position14>
<Position15>
<Filename Value="scanner.pas"/>
<Caret Line="150" Column="49" TopLine="134"/>
<Caret Line="213" Column="13" TopLine="174"/>
</Position15>
<Position16>
<Filename Value="scanner.pas"/>
<Caret Line="168" Column="26" TopLine="134"/>
<Caret Line="206" Column="19" TopLine="176"/>
</Position16>
<Position17>
<Filename Value="scanner.pas"/>
<Caret Line="242" Column="18" TopLine="230"/>
<Caret Line="214" Column="42" TopLine="177"/>
</Position17>
<Position18>
<Filename Value="scanner.pas"/>
<Caret Line="188" Column="3" TopLine="184"/>
<Caret Line="217" Column="93" TopLine="177"/>
</Position18>
<Position19>
<Filename Value="scanner.pas"/>
<Caret Line="310" Column="48" TopLine="301"/>
<Caret Line="219" Column="65" TopLine="183"/>
</Position19>
<Position20>
<Filename Value="scanner.pas"/>
<Caret Line="224" Column="29" TopLine="190"/>
<Caret Line="204" Column="117" TopLine="186"/>
</Position20>
<Position21>
<Filename Value="scanner.pas"/>
<Caret Line="188" Column="3" TopLine="184"/>
<Caret Line="203" Column="117" TopLine="203"/>
</Position21>
<Position22>
<Filename Value="scanner.pas"/>
<Caret Line="365" Column="45" TopLine="301"/>
<Caret Line="204" Column="117" TopLine="204"/>
</Position22>
<Position23>
<Filename Value="scanner.pas"/>
<Caret Line="357" Column="33" TopLine="301"/>
<Caret Line="403" Column="63" TopLine="365"/>
</Position23>
<Position24>
<Filename Value="scanner.pas"/>
<Caret TopLine="109"/>
<Caret Line="376" Column="32" TopLine="320"/>
</Position24>
<Position25>
<Filename Value="scanner.pas"/>
<Caret Line="237" Column="3" TopLine="230"/>
<Caret Line="382" Column="24" TopLine="320"/>
</Position25>
<Position26>
<Filename Value="scanner.pas"/>
<Caret Line="153" Column="3" TopLine="151"/>
<Caret Line="21" Column="19"/>
</Position26>
<Position27>
<Filename Value="scanner.pas"/>
<Caret Line="168" Column="8" TopLine="161"/>
<Caret Line="100" Column="26" TopLine="34"/>
</Position27>
<Position28>
<Filename Value="scanner.pas"/>
<Caret Line="318" Column="172" TopLine="302"/>
<Caret Line="382" Column="24" TopLine="316"/>
</Position28>
<Position29>
<Filename Value="scanner.pas"/>
<Caret Line="168" TopLine="134"/>
<Caret Line="21" Column="19"/>
</Position29>
<Position30>
<Filename Value="scanner.pas"/>
<Caret Line="358" Column="28" TopLine="302"/>
<Caret Line="116" Column="134" TopLine="67"/>
</Position30>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0" ActiveMode="default"/>
</RunParams>
</ProjectSession>
</CONFIG>

BIN
Belegscanner.res

Binary file not shown.

59
scanner.lfm

@ -7,48 +7,51 @@ object ScanForm: TScanForm @@ -7,48 +7,51 @@ object ScanForm: TScanForm
ClientHeight = 880
ClientWidth = 1188
OnCreate = FormCreate
LCLVersion = '1.8.2.0'
LCLVersion = '2.0.6.0'
object TypeSelector: TComboBox
Left = 904
Height = 28
Height = 27
Top = 208
Width = 276
Anchors = [akTop, akRight]
Enabled = False
ItemHeight = 0
OnChange = TypeSelectorChange
OnKeyDown = ComboKey
TabOrder = 1
Text = 'Select Type'
Text = 'Herkunft'
end
object Origin: TComboBox
Left = 904
Height = 28
Height = 27
Top = 240
Width = 272
Anchors = [akTop, akRight]
Enabled = False
ItemHeight = 0
OnChange = OriginChange
OnKeyDown = ComboKey
TabOrder = 3
Text = 'Start'
end
object Destination: TComboBox
Left = 904
Height = 28
Height = 27
Top = 304
Width = 272
Anchors = [akTop, akRight]
Enabled = False
ItemHeight = 0
OnChange = DestinationChange
OnKeyDown = ComboKey
TabOrder = 5
Text = 'Ziel'
end
object FolderName: TLabel
Left = 8
Height = 19
Top = 840
Width = 103
Height = 17
Top = 842
Width = 101
Anchors = [akLeft, akBottom]
Caption = 'Ordnername'
Font.Height = -16
@ -58,13 +61,14 @@ object ScanForm: TScanForm @@ -58,13 +61,14 @@ object ScanForm: TScanForm
end
object Product: TComboBox
Left = 904
Height = 28
Height = 27
Top = 240
Width = 276
Anchors = [akTop, akRight]
Enabled = False
ItemHeight = 0
OnChange = ProductChange
OnKeyDown = ComboKey
TabOrder = 2
Text = 'Produkt'
Visible = False
@ -82,7 +86,7 @@ object ScanForm: TScanForm @@ -82,7 +86,7 @@ object ScanForm: TScanForm
end
object Resolution: TComboBox
Left = 904
Height = 28
Height = 27
Top = 368
Width = 72
Anchors = [akTop, akRight]
@ -97,7 +101,7 @@ object ScanForm: TScanForm @@ -97,7 +101,7 @@ object ScanForm: TScanForm
end
object DPI: TLabel
Left = 984
Height = 16
Height = 14
Top = 376
Width = 19
Anchors = [akTop, akRight]
@ -106,9 +110,9 @@ object ScanForm: TScanForm @@ -106,9 +110,9 @@ object ScanForm: TScanForm
end
object BaseFolder: TLabel
Left = 8
Height = 19
Top = 816
Width = 88
Height = 17
Top = 818
Width = 89
Anchors = [akLeft, akBottom]
Caption = 'BaseFolder'
Font.Height = -16
@ -119,13 +123,14 @@ object ScanForm: TScanForm @@ -119,13 +123,14 @@ object ScanForm: TScanForm
end
object Stop: TComboBox
Left = 904
Height = 28
Height = 27
Top = 272
Width = 272
Anchors = [akTop, akRight]
Enabled = False
ItemHeight = 0
OnChange = StopChange
OnKeyDown = ComboKey
TabOrder = 4
Text = 'Zwischenhalt'
end
@ -150,7 +155,7 @@ object ScanForm: TScanForm @@ -150,7 +155,7 @@ object ScanForm: TScanForm
end
object PicSize: TComboBox
Left = 904
Height = 28
Height = 27
Top = 336
Width = 272
Anchors = [akTop, akRight]
@ -192,6 +197,28 @@ object ScanForm: TScanForm @@ -192,6 +197,28 @@ object ScanForm: TScanForm
OnClick = extButtonClick
TabOrder = 11
end
object dropBtn: TButton
Left = 904
Height = 49
Top = 512
Width = 272
Anchors = [akTop, akRight]
Caption = 'Datensatz löschen'
OnClick = dropBtnClick
TabOrder = 12
end
object OpenDir: TButton
Left = 904
Height = 32
Top = 744
Width = 276
Anchors = [akRight, akBottom]
Caption = 'Ordner öffnen'
OnClick = OpenDirClick
ParentShowHint = False
ShowHint = True
TabOrder = 13
end
object BaseFolderDialog: TSelectDirectoryDialog
left = 520
top = 128

152
scanner.pas

@ -25,6 +25,8 @@ type @@ -25,6 +25,8 @@ type
{ TScanForm }
TScanForm = class(TForm)
dropBtn: TButton;
OpenDir: TButton;
extButton: TButton;
Swap: TButton;
DropButton: TButton;
@ -44,10 +46,12 @@ type @@ -44,10 +46,12 @@ type
TypeSelector: TComboBox;
procedure BaseFolderClick(Sender: TObject);
procedure dropBtnClick(Sender: TObject);
procedure extButtonClick(Sender: TObject);
procedure DropButtonClick(Sender: TObject);
procedure CalendarChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure OpenDirClick(Sender: TObject);
procedure ProductChange(Sender: TObject);
procedure DestinationChange(Sender: TObject);
procedure OriginChange(Sender: TObject);
@ -57,8 +61,11 @@ type @@ -57,8 +61,11 @@ type
procedure TypeSelectorChange(Sender: TObject);
function ExportConfig(): string;
function ExportOptions(dropDown: TComboBox): string;
procedure ComboKey(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure UpdateFolder();
procedure MixLocations(d1: TComboBox; d2: TComboBox; d3: TComboBox);
procedure DeleteStationFrom(combo: TComboBox; station: string; defaultName : string);
procedure DeleteStation(station : string);
private
date: TDateTime;
function getSize(): TPoint;
@ -161,11 +168,25 @@ end; @@ -161,11 +168,25 @@ end;
function TScanForm.ExportOptions(dropDown: TComboBox): string;
var
list: TStringList;
tx: string;
item, current: string;
i: integer;
drop: Boolean;
begin
// make sure the current text appears in future lists
tx := dropDown.Text;
if (tx[1] <> ' ') then dropDown.Items.Add(tx);
item := dropDown.Text;
drop := item.StartsWith(' ');
if drop then
begin
i := 0;
while i < dropDown.Items.Count do
begin
item := Trim(item);
current := Trim(dropDown.Items[i]);
if current = item then dropDown.Items.Delete(i) else i := i+1;
end;
end else dropDown.Items.Add(item);
// create a StringList to sort and concatenate
list := TStringList.Create;
list.StrictDelimiter := True;
@ -181,6 +202,30 @@ begin @@ -181,6 +202,30 @@ begin
Result := list.DelimitedText
end;
procedure TScanForm.ComboKey(Sender: TObject; var Key: Word; Shift: TShiftState);
var
combo : TComboBox;
index : integer;
tx : string;
begin
if key = 40 then
begin
if TObject(Sender) is TComboBox then
begin
combo := TComboBox(Sender);
tx := combo.Text;
for index := 0 to combo.Items.Count-1 do
begin
if combo.Items[index].StartsWith(tx,true) then
begin
combo.ItemIndex:=index-1;
Exit;
end;
end;
end;
end;
end;
procedure TScanForm.TypeSelectorChange(Sender: TObject);
var
state: boolean;
@ -276,6 +321,20 @@ begin @@ -276,6 +321,20 @@ begin
UpdateFolder();
end;
procedure addItemsTo(combo: TComboBox; line: String);
var
parts: TStringArray;
fixed, part: string;
begin
parts := line.Split(',');
for part in parts do
begin
fixed := part.Replace('"','');
if (fixed <> '') then combo.Items.Add(fixed);
end;
end;
procedure TScanForm.FormCreate(Sender: TObject);
var
filename: String;
@ -297,33 +356,27 @@ begin @@ -297,33 +356,27 @@ begin
line:=line.Substring(7);
BaseFolder.Caption:=line;
end;
if line.StartsWith('types:') then
begin
line := line.Substring(6);
TypeSelector.Items.AddStrings(line.Split(','));
end;
if line.StartsWith('items:') then
begin
line := line.Substring(6);
Product.Items.AddStrings(line.Split(','));
end;
if line.StartsWith('sizes:') then
begin
line := line.Substring(6);
PicSize.Items.AddStrings(line.Split(','));
end;
if line.StartsWith('types:') then addItemsTo(TypeSelector,line.Substring(6));
if line.StartsWith('items:') then addItemsTo(Product,line.Substring(6));
if line.StartsWith('sizes:') then addItemsTo(PicSize,line.Substring(6));
if line.StartsWith('locations:') then
begin
line := line.Substring(10);
Origin.Items.AddStrings(line.Split(','));
Destination.Items.AddStrings(line.Split(','));
Stop.Items.AddStrings(line.Split(','));
addItemsTo(Origin,line);
addItemsTo(Destination,line);
addItemsTo(Stop,line);
end;
end
finally
end;
end;
procedure TScanForm.OpenDirClick(Sender: TObject);
begin
WriteLn(BaseFolder.Caption);
fpSystem('gio open "'+BaseFolder.Caption+'"');
end;
procedure TScanForm.BaseFolderClick(Sender: TObject);
begin
BaseFolderDialog.FileName:=BaseFolder.Caption;
@ -331,6 +384,48 @@ begin @@ -331,6 +384,48 @@ begin
BaseFolder.Caption := BaseFolderDialog.FileName;
end;
procedure TScanForm.DeleteStationFrom(combo: TComboBox; station : string; defaultName : string);
var
index : integer;
begin
index := combo.Items.IndexOf(station);
if index > -1 then
begin
combo.Items.Delete(index);
combo.Text := defaultName;
end;
end;
procedure TScanForm.DeleteStation(station : string);
begin
DeleteStationFrom(Origin,station,'Start');
DeleteStationFrom(Stop,station,'Zwischenhalt');
DeleteStationFrom(Destination,station,'Ziel');
end;
procedure TScanForm.dropBtnClick(Sender: TObject);
var
tx : string;
begin
tx := TypeSelector.Text;
if (tx <> 'Herkunft') and (tx <> 'Ticket') then
begin
TypeSelector.Items.Delete(TypeSelector.ItemIndex);
TypeSelector.Text := 'Herkunft';
end;
tx := Product.Text;
if Product.Enabled and (tx <> 'Produkt') then
begin
Product.Items.Delete(Product.ItemIndex);
Product.Text := 'Produkt';
end;
if Origin.Enabled and (Origin.Text <> 'Start') then deleteStation(Origin.Text);
if Stop.Enabled and (Stop.Text <> 'Zwischenhalt') then deleteStation(Stop.Text);
if Destination.Enabled and (Destination.Text <> 'Ziel') then deleteStation(Destination.Text);
end;
procedure TScanForm.extButtonClick(Sender: TObject);
var
cmd: string;
@ -353,16 +448,11 @@ var @@ -353,16 +448,11 @@ var
tx: string;
begin
tx := FormatDateTime('YYYY-MM-DD', date) + ' - ';
if (Product.Enabled and (Product.Tag > 0) and not( Product.Text = '') and not (Product.Text = 'Produkt')) then
tx := tx + Trim(Product.Text) + ' von ';
if (TypeSelector.Tag > 0) then
tx := tx + Trim(TypeSelector.Text);
if (Origin.Enabled and (Origin.Tag > 0)) then
tx := tx + ': ' + Trim(Origin.Text);
if (Stop.Enabled and (Stop.Tag > 0) and not (Stop.Text = '')and not (Stop.Text = 'Zwischenhalt')) then
tx := tx + ' - ' + Trim(Stop.Text);
if (Destination.Enabled and (Destination.Tag > 0)) then
tx := tx + ' - ' + Trim(Destination.Text);
if (Product.Enabled and (Product.Tag > 0) and not( Product.Text = '') and not (Product.Text = 'Produkt')) then tx := tx + Trim(Product.Text) + ' von ';
if (TypeSelector.Tag > 0) then tx := tx + Trim(TypeSelector.Text);
if (Origin.Enabled and (Origin.Tag > 0)) then tx := tx + ': ' + Trim(Origin.Text);
if (Stop.Enabled and (Stop.Tag > 0) and not (Stop.Text = '')and not (Stop.Text = 'Zwischenhalt')) then tx := tx + ' - ' + Trim(Stop.Text);
if (Destination.Enabled and (Destination.Tag > 0)) then tx := tx + ' - ' + Trim(Destination.Text);
FolderName.Caption := tx;
end;

Loading…
Cancel
Save